diff options
author | Yichi Chen <yichichen@google.com> | 2020-05-27 20:16:13 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2020-08-11 05:28:56 -0700 |
commit | 24d146c89d3016ad28b8f62f9aaef05f1daf895c (patch) | |
tree | 0db2a56e34b2727756b7e2d78e662ef9ad94b4d0 /gralloc/gr_buf_mgr.cpp | |
parent | 54cac898e5c75d41496411c17c714ee7629ec6bd (diff) |
gralloc: Add the support of RAW data in getComponentSizeAndOffset
To support RAW8, RAW10, RAW12, and RAW16 in gralloc4.0, the patch sets
the corresponding data in PlaneLayoutInfo and PlaneLayoutComponent.
(Not a contribution)
Bug: 157534008
Test: VtsHalGraphicsMapperV4_0TargetTest
CRs-Fixed: 2728586
Change-Id: I5c0d7c31199b949dc32e112e2743ec6cdc7106bd
Diffstat (limited to 'gralloc/gr_buf_mgr.cpp')
-rw-r--r-- | gralloc/gr_buf_mgr.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/gralloc/gr_buf_mgr.cpp b/gralloc/gr_buf_mgr.cpp index f0b46395..620b8c1d 100644 --- a/gralloc/gr_buf_mgr.cpp +++ b/gralloc/gr_buf_mgr.cpp @@ -528,6 +528,31 @@ static void getComponentSizeAndOffset(int32_t format, PlaneLayoutComponent &comp comp.sizeInBits = 10; } break; + case static_cast<int32_t>(HAL_PIXEL_FORMAT_RAW16): + if (comp.type.value == android::gralloc4::PlaneLayoutComponentType_RAW.value) { + comp.offsetInBits = 0; + comp.sizeInBits = 16; + } else { + return Error::BAD_VALUE; + } + break; + case static_cast<int32_t>(HAL_PIXEL_FORMAT_RAW12): + case static_cast<int32_t>(HAL_PIXEL_FORMAT_RAW10): + if (comp.type.value == android::gralloc4::PlaneLayoutComponentType_RAW.value) { + comp.offsetInBits = 0; + comp.sizeInBits = -1; + } else { + return Error::BAD_VALUE; + } + break; + case static_cast<int32_t>(HAL_PIXEL_FORMAT_RAW8): + if (comp.type.value == android::gralloc4::PlaneLayoutComponentType_RAW.value) { + comp.offsetInBits = 0; + comp.sizeInBits = 8; + } else { + return Error::BAD_VALUE; + } + break; default: break; } @@ -583,8 +608,9 @@ static void grallocToStandardPlaneLayoutComponentType(uint32_t in, } if (in & PLANE_COMPONENT_RAW) { - comp.type = qtigralloc::PlaneLayoutComponentType_Raw; - components->push_back(comp); + comp.type = android::gralloc4::PlaneLayoutComponentType_RAW; + if (getComponentSizeAndOffset(format, comp) == Error::NONE) + components->push_back(comp); } if (in & PLANE_COMPONENT_META) { |