diff options
author | Gurpreet Singh Dhami <gdhami@codeaurora.org> | 2018-06-08 11:49:10 -0400 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-06-12 09:08:42 -0700 |
commit | 0ceb16be81f64595d4c8021f05f09a017a946e04 (patch) | |
tree | a5fcceff30964e5916a78dd4edf37155dcf22132 /sdm | |
parent | dc58f2f991c6bf3d9ac30e3dda059aac89d47729 (diff) | |
download | android_hardware_qcom_sdm710_display-0ceb16be81f64595d4c8021f05f09a017a946e04.tar.gz android_hardware_qcom_sdm710_display-0ceb16be81f64595d4c8021f05f09a017a946e04.tar.bz2 android_hardware_qcom_sdm710_display-0ceb16be81f64595d4c8021f05f09a017a946e04.zip |
hwc: Fix HWC Writeback one less frame dump
Fix HWC Writeback failure to capture first frame if directory does not exist.
Change-Id: I051238462cd3f12c1bda5345201f8cf0c7ed4701
Diffstat (limited to 'sdm')
-rw-r--r-- | sdm/libs/hwc2/hwc_display.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp index 07dab479..37e408fc 100644 --- a/sdm/libs/hwc2/hwc_display.cpp +++ b/sdm/libs/hwc2/hwc_display.cpp @@ -1541,6 +1541,7 @@ LayerBufferFormat HWCDisplay::GetSDMFormat(const int32_t &source, const int flag void HWCDisplay::DumpInputBuffers() { char dir_path[PATH_MAX]; + int status; if (!dump_frame_count_ || flush_ || !dump_input_layers_) { return; @@ -1550,13 +1551,14 @@ void HWCDisplay::DumpInputBuffers() { snprintf(dir_path, sizeof(dir_path), "%s/frame_dump_%s", HWCDebugHandler::DumpDir(), GetDisplayString()); - if (mkdir(dir_path, 0777) != 0 && errno != EEXIST) { + status = mkdir(dir_path, 777); + if ((status != 0) && errno != EEXIST) { DLOGW("Failed to create %s directory errno = %d, desc = %s", dir_path, errno, strerror(errno)); return; } - // if directory exists already, need to explicitly change the permission. - if (errno == EEXIST && chmod(dir_path, 0777) != 0) { + // Even if directory exists already, need to explicitly change the permission. + if (chmod(dir_path, 0777) != 0) { DLOGW("Failed to change permissions on %s directory", dir_path); return; } @@ -1617,17 +1619,19 @@ void HWCDisplay::DumpInputBuffers() { void HWCDisplay::DumpOutputBuffer(const BufferInfo &buffer_info, void *base, int fence) { char dir_path[PATH_MAX]; + int status; snprintf(dir_path, sizeof(dir_path), "%s/frame_dump_%s", HWCDebugHandler::DumpDir(), GetDisplayString()); - if (mkdir(dir_path, 777) != 0 && errno != EEXIST) { + status = mkdir(dir_path, 777); + if ((status != 0) && errno != EEXIST) { DLOGW("Failed to create %s directory errno = %d, desc = %s", dir_path, errno, strerror(errno)); return; } - // if directory exists already, need to explicitly change the permission. - if (errno == EEXIST && chmod(dir_path, 0777) != 0) { + // Even if directory exists already, need to explicitly change the permission. + if (chmod(dir_path, 0777) != 0) { DLOGW("Failed to change permissions on %s directory", dir_path); return; } |