summaryrefslogtreecommitdiffstats
path: root/libs/ui
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2015-01-28 16:16:40 -0800
committerLajos Molnar <lajos@google.com>2015-01-28 16:26:36 -0800
commit1f9f71e183946b390fff4d20900bc4a03246a882 (patch)
treea42066626876f4befbed0cf783c4529da366a23e /libs/ui
parentd6fce7ab66e5d33e3ee16247485d1b8c26dd7ee8 (diff)
downloadframeworks_native-1f9f71e183946b390fff4d20900bc4a03246a882.zip
frameworks_native-1f9f71e183946b390fff4d20900bc4a03246a882.tar.gz
frameworks_native-1f9f71e183946b390fff4d20900bc4a03246a882.tar.bz2
GraphicBufferMapper: handle devices that do not implement lock_ycbcr
Bug: 19179927 Change-Id: I09ffca954fed3cd2d3466c8396627dc7dbc0052d
Diffstat (limited to 'libs/ui')
-rw-r--r--libs/ui/GraphicBufferMapper.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp
index 320b6c0..e949b0c 100644
--- a/libs/ui/GraphicBufferMapper.cpp
+++ b/libs/ui/GraphicBufferMapper.cpp
@@ -92,6 +92,10 @@ status_t GraphicBufferMapper::lockYCbCr(buffer_handle_t handle,
ATRACE_CALL();
status_t err;
+ if (mAllocMod->lock_ycbcr == NULL) {
+ return -EINVAL; // do not log failure
+ }
+
err = mAllocMod->lock_ycbcr(mAllocMod, handle, usage,
bounds.left, bounds.top, bounds.width(), bounds.height(),
ycbcr);
@@ -139,16 +143,19 @@ status_t GraphicBufferMapper::lockAsyncYCbCr(buffer_handle_t handle,
ATRACE_CALL();
status_t err;
- if (mAllocMod->common.module_api_version >= GRALLOC_MODULE_API_VERSION_0_3) {
+ if (mAllocMod->common.module_api_version >= GRALLOC_MODULE_API_VERSION_0_3
+ && mAllocMod->lockAsync_ycbcr != NULL) {
err = mAllocMod->lockAsync_ycbcr(mAllocMod, handle, usage,
bounds.left, bounds.top, bounds.width(), bounds.height(),
ycbcr, fenceFd);
- } else {
+ } else if (mAllocMod->lock_ycbcr != NULL) {
sync_wait(fenceFd, -1);
close(fenceFd);
err = mAllocMod->lock_ycbcr(mAllocMod, handle, usage,
bounds.left, bounds.top, bounds.width(), bounds.height(),
ycbcr);
+ } else {
+ return -EINVAL; // do not log failure
}
ALOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err));