diff options
Diffstat (limited to 'libs/ui/GraphicBufferMapper.cpp')
-rw-r--r-- | libs/ui/GraphicBufferMapper.cpp | 50 |
1 files changed, 8 insertions, 42 deletions
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp index 2d8e5824b0..8dd939668a 100644 --- a/libs/ui/GraphicBufferMapper.cpp +++ b/libs/ui/GraphicBufferMapper.cpp @@ -59,22 +59,15 @@ status_t GraphicBufferMapper::importBuffer(buffer_handle_t rawHandle, ATRACE_CALL(); buffer_handle_t bufferHandle; - Gralloc2::Error error = mMapper->importBuffer( - hardware::hidl_handle(rawHandle), &bufferHandle); - if (error != Gralloc2::Error::NONE) { + status_t error = mMapper->importBuffer(hardware::hidl_handle(rawHandle), &bufferHandle); + if (error != NO_ERROR) { ALOGW("importBuffer(%p) failed: %d", rawHandle, error); - return static_cast<status_t>(error); + return error; } - Gralloc2::IMapper::BufferDescriptorInfo info = {}; - info.width = width; - info.height = height; - info.layerCount = layerCount; - info.format = static_cast<Gralloc2::PixelFormat>(format); - info.usage = usage; - - error = mMapper->validateBufferSize(bufferHandle, info, stride); - if (error != Gralloc2::Error::NONE) { + error = mMapper->validateBufferSize(bufferHandle, width, height, format, layerCount, usage, + stride); + if (error != NO_ERROR) { ALOGE("validateBufferSize(%p) failed: %d", rawHandle, error); freeBuffer(bufferHandle); return static_cast<status_t>(error); @@ -100,15 +93,6 @@ status_t GraphicBufferMapper::freeBuffer(buffer_handle_t handle) return NO_ERROR; } -static inline Gralloc2::IMapper::Rect asGralloc2Rect(const Rect& rect) { - Gralloc2::IMapper::Rect outRect{}; - outRect.left = rect.left; - outRect.top = rect.top; - outRect.width = rect.width(); - outRect.height = rect.height(); - return outRect; -} - status_t GraphicBufferMapper::lock(buffer_handle_t handle, uint32_t usage, const Rect& bounds, void** vaddr) { @@ -146,13 +130,7 @@ status_t GraphicBufferMapper::lockAsync(buffer_handle_t handle, const uint64_t usage = static_cast<uint64_t>( android_convertGralloc1To0Usage(producerUsage, consumerUsage)); - Gralloc2::Error error = mMapper->lock(handle, usage, - asGralloc2Rect(bounds), fenceFd, vaddr); - - ALOGW_IF(error != Gralloc2::Error::NONE, "lock(%p, ...) failed: %d", - handle, error); - - return static_cast<status_t>(error); + return mMapper->lock(handle, usage, bounds, fenceFd, vaddr); } status_t GraphicBufferMapper::lockAsyncYCbCr(buffer_handle_t handle, @@ -160,19 +138,7 @@ status_t GraphicBufferMapper::lockAsyncYCbCr(buffer_handle_t handle, { ATRACE_CALL(); - Gralloc2::YCbCrLayout layout; - Gralloc2::Error error = mMapper->lock(handle, usage, - asGralloc2Rect(bounds), fenceFd, &layout); - if (error == Gralloc2::Error::NONE) { - ycbcr->y = layout.y; - ycbcr->cb = layout.cb; - ycbcr->cr = layout.cr; - ycbcr->ystride = static_cast<size_t>(layout.yStride); - ycbcr->cstride = static_cast<size_t>(layout.cStride); - ycbcr->chroma_step = static_cast<size_t>(layout.chromaStep); - } - - return static_cast<status_t>(error); + return mMapper->lock(handle, usage, bounds, fenceFd, ycbcr); } status_t GraphicBufferMapper::unlockAsync(buffer_handle_t handle, int *fenceFd) |