diff --git a/surface/include/buffer_utils.h b/surface/include/buffer_utils.h index 4c327398d7631f9538400ef1fe521f48602c1a8b..0fe1e075f7e0bbfa0899a33ead0eb606dbc5c568 100644 --- a/surface/include/buffer_utils.h +++ b/surface/include/buffer_utils.h @@ -48,7 +48,7 @@ void WriteHDRMetaDataSet(MessageParcel &parcel, const std::vector &meta void ReadExtDataHandle(MessageParcel &parcel, sptr &handle); void WriteExtDataHandle(MessageParcel &parcel, const GraphicExtDataHandle *handle); -GSError DumpToFileAsync(pid_t pid, std::string name, sptr &buffer); +GSError DumpToFileAsync(bool isLocalRender, pid_t pid, std::string name, sptr &buffer); } // namespace OHOS #endif // FRAMEWORKS_SURFACE_INCLUDE_BUFFER_UTILS_H diff --git a/surface/src/buffer_queue.cpp b/surface/src/buffer_queue.cpp index 4b3084ab676334b40037bbec03428558bba483d6..71f5bde086ac90413a02d0c27d888f0f8e4d862a 100644 --- a/surface/src/buffer_queue.cpp +++ b/surface/src/buffer_queue.cpp @@ -740,8 +740,8 @@ GSError BufferQueue::DoFlushBuffer(uint32_t sequence, sptr beda if (dumpBufferEnabled) { // Wait for the status of the fence to change to SIGNALED. int32_t ret = fence->Wait(-1); - if (ret == 0 && access("/data/bq_dump", F_OK) == 0) { - DumpToFileAsync(GetRealPid(), name_, bufferQueueCache_[sequence].buffer); + if (ret == 0 && (access("/data/bq_dump", F_OK) == 0 || access("/data/storage/el1/base/bq_dump", F_OK) == 0)) { + DumpToFileAsync(isLocalRender_, GetRealPid(), name_, bufferQueueCache_[sequence].buffer); } } diff --git a/surface/src/buffer_utils.cpp b/surface/src/buffer_utils.cpp index 4d7ac568c72a6e14cf1360ef736821382e4e5466..ebcac7969815b8bacae4b5d1228327d22d0dec45 100644 --- a/surface/src/buffer_utils.cpp +++ b/surface/src/buffer_utils.cpp @@ -329,8 +329,8 @@ void CloneBuffer(uint8_t* dest, const uint8_t* src, size_t totalSize) } } -void WriteToFile(std::string pid, void* dest, size_t size, int32_t format, int32_t width, int32_t height, - const std::string name) +void WriteToFile(std::string prefixPath, std::string pid, void* dest, size_t size, int32_t format, int32_t width, + int32_t height, const std::string name) { struct timeval now; gettimeofday(&now, nullptr); @@ -338,7 +338,7 @@ void WriteToFile(std::string pid, void* dest, size_t size, int32_t format, int32 int64_t nowVal = (int64_t)now.tv_sec * secToUsec + (int64_t)now.tv_usec; std::stringstream ss; - ss << "/data/bq_" << pid << "_" << name << "_" << nowVal << "_" << format << "_" + ss << prefixPath << pid << "_" << name << "_" << nowVal << "_" << format << "_" << width << "x" << height << ".raw"; // Open the file for writing in binary mode @@ -358,7 +358,7 @@ void WriteToFile(std::string pid, void* dest, size_t size, int32_t format, int32 free(dest); } -GSError DumpToFileAsync(pid_t pid, std::string name, sptr &buffer) +GSError DumpToFileAsync(bool isLocalRender, pid_t pid, std::string name, sptr &buffer) { if (buffer == nullptr) { BLOGE("buffer is a nullptr."); @@ -378,8 +378,15 @@ GSError DumpToFileAsync(pid_t pid, std::string name, sptr &buffer if (dest != nullptr) { // Copy through multithreading CloneBuffer(dest, src, size); + + // Is texture export + std::string prefixPath = "/data/bq_"; + if (!isLocalRender) { + prefixPath = "/data/storage/el1/base/bq_"; + } + // create dump thread,async export file - std::thread file_writer(WriteToFile, std::to_string(pid), dest, size, buffer->GetFormat(), + std::thread file_writer(WriteToFile, prefixPath, std::to_string(pid), dest, size, buffer->GetFormat(), buffer->GetWidth(), buffer->GetHeight(), name); file_writer.detach(); } else { diff --git a/surface/test/unittest/buffer_utils_test.cpp b/surface/test/unittest/buffer_utils_test.cpp index 8cfb147909af8c69fe81c63bd3ae1c1e1075771f..7dd6c4d537f5a3d0e6fc490eec0927161acd0b79 100644 --- a/surface/test/unittest/buffer_utils_test.cpp +++ b/surface/test/unittest/buffer_utils_test.cpp @@ -86,7 +86,7 @@ HWTEST_F(BufferUtilsTest, DumpToFileAsyncTest001, Function | MediumTest | Level2 buffer->Alloc(requestConfig); // Call DumpToFileAsync - GSError ret = DumpToFileAsync(pid, name_, buffer); + GSError ret = DumpToFileAsync(true, pid, name_, buffer); ASSERT_EQ(ret, OHOS::GSERROR_OK); // Expect Buffer Dump to be completed within 20ms.