diff options
author | Sushil Chauhan <sushilchauhan@codeaurora.org> | 2018-03-19 14:00:23 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-04-17 15:04:35 -0700 |
commit | 80e360ff0940b256737089c8db47836b3a2f83f3 (patch) | |
tree | 623c454a0e2b697f055c6822d015c0ebf1eb246f /sdm/libs/hwc2/hwc_color_manager.cpp | |
parent | cfd04f8672774e126b5f8a35bb436ff9740b742c (diff) | |
download | display-80e360ff0940b256737089c8db47836b3a2f83f3.tar.gz |
sdm: hwc2: Add support for HWC Readback feature
Add support for HWC Readback feature in HWC2 and SDM.
CRs-Fixed: 2217822
Change-Id: If2df64dc0bdea7a9ca4c2b0498f1cd3f3dc9de9d
Diffstat (limited to 'sdm/libs/hwc2/hwc_color_manager.cpp')
-rw-r--r-- | sdm/libs/hwc2/hwc_color_manager.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sdm/libs/hwc2/hwc_color_manager.cpp b/sdm/libs/hwc2/hwc_color_manager.cpp index 8023b6a8..1b4e15ad 100644 --- a/sdm/libs/hwc2/hwc_color_manager.cpp +++ b/sdm/libs/hwc2/hwc_color_manager.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015 - 2017, The Linux Foundation. All rights reserved. +* Copyright (c) 2015 - 2018, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -30,6 +30,7 @@ #include <dlfcn.h> #include <cutils/sockets.h> #include <cutils/native_handle.h> +#include <sync/sync.h> #include <utils/String16.h> #include <binder/Parcel.h> #include <gralloc_priv.h> @@ -259,7 +260,13 @@ int HWCColorManager::SetFrameCapture(void *params, bool enable, HWCDisplay *hwc_ } } } else { - ret = hwc_display->GetFrameCaptureStatus(); + ret = -EAGAIN; + int fence_fd = -1; + if (hwc_display->GetFrameCaptureFence(&fence_fd) && (fence_fd >= 0)) { + ret = sync_wait(fence_fd, 1000); + ::close(fence_fd); + } + if (!ret) { if (frame_capture_data->buffer != NULL) { if (munmap(frame_capture_data->buffer, buffer_info.alloc_buffer_info.size) != 0) { @@ -274,7 +281,7 @@ int HWCColorManager::SetFrameCapture(void *params, bool enable, HWCDisplay *hwc_ } } } else { - DLOGE("GetFrameCaptureStatus failed. ret = %d", ret); + DLOGE("GetFrameCaptureFence failed. ret = %d", ret); } } return ret; |