From 54a98142327a62a4b78a1eba00de1c98b1d7f7d6 Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 21 Nov 2023 11:13:40 -0500 Subject: Skip pixel format validation if IMPLEMENTATION_DEFINED Bug: 307349474 Test: make Change-Id: I5ffd1593968e9bf3c39d5a173d1e0732af3ce9cc --- libs/ui/Gralloc5.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'libs/ui/Gralloc5.cpp') diff --git a/libs/ui/Gralloc5.cpp b/libs/ui/Gralloc5.cpp index 37ebfc4617..2ec6d18fda 100644 --- a/libs/ui/Gralloc5.cpp +++ b/libs/ui/Gralloc5.cpp @@ -518,14 +518,16 @@ status_t Gralloc5Mapper::validateBufferSize(buffer_handle_t bufferHandle, uint32 } } { - auto value = - getStandardMetadata(mMapper, - bufferHandle); - if (static_cast<::aidl::android::hardware::graphics::common::PixelFormat>(format) != - value) { - ALOGW("Format didn't match, expected %d got %s", format, - value.has_value() ? toString(*value).c_str() : ""); - return BAD_VALUE; + auto expected = static_cast(format); + if (expected != APixelFormat::IMPLEMENTATION_DEFINED) { + auto value = + getStandardMetadata(mMapper, + bufferHandle); + if (expected != value) { + ALOGW("Format didn't match, expected %d got %s", format, + value.has_value() ? toString(*value).c_str() : ""); + return BAD_VALUE; + } } } { -- cgit v1.2.3-59-g8ed1b