From 866abc15d932901d8f0f821575f591cddcd39e1f Mon Sep 17 00:00:00 2001 From: Jason Macnak Date: Wed, 7 Sep 2022 10:02:41 -0700 Subject: [PATCH] Support P010 with Gralloc2 on Gralloc1 passthrough ... by updating the toYCbCrLayout function to more closely follow the requirements found in the comments of `android_flex_plane_t`. Bug: b/244411455 Test: untested. Change-Id: I1173253e25583336bf480160d4f6ac9f72882971 --- .../include/mapper-passthrough/2.0/Gralloc1Hal.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/graphics/mapper/2.0/utils/passthrough/include/mapper-passthrough/2.0/Gralloc1Hal.h b/graphics/mapper/2.0/utils/passthrough/include/mapper-passthrough/2.0/Gralloc1Hal.h index db7e67dd9c..5f0a176a46 100644 --- a/graphics/mapper/2.0/utils/passthrough/include/mapper-passthrough/2.0/Gralloc1Hal.h +++ b/graphics/mapper/2.0/utils/passthrough/include/mapper-passthrough/2.0/Gralloc1Hal.h @@ -259,19 +259,22 @@ class Gralloc1HalImpl : public Hal { for (int i = 0; i < 3; i++) { const auto& plane = flex.planes[i]; - // must have 8-bit depth - if (plane.bits_per_component != 8 || plane.bits_used != 8) { + // Must be a positive multiple of 8. + if (plane.bits_per_component <= 0 || (plane.bits_per_component % 8) != 0) { + return false; + } + // Must be between 1 and bits_per_component, inclusive. + if (plane.bits_used < 1 || plane.bits_used > plane.bits_per_component) { return false; } - if (plane.component == FLEX_COMPONENT_Y) { // Y must not be interleaved - if (plane.h_increment != 1) { + if (plane.h_increment != 1 && plane.h_increment != 2) { return false; } } else { // Cb and Cr can be interleaved - if (plane.h_increment != 1 && plane.h_increment != 2) { + if (plane.h_increment != 1 && plane.h_increment != 2 && plane.h_increment != 4) { return false; } }