From 47390ece3c85ef17091b49d3503286e632b11c41 Mon Sep 17 00:00:00 2001 From: John Reck Date: Wed, 24 May 2023 13:46:37 -0400 Subject: Fix USAGE_FRONT_BUFFER failure on Cuttlefish Bug: 280866371 Test: repro in bug Change-Id: I2963143d88a6ffba68012f47b79155a01367d49d --- libs/ui/Gralloc5.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'libs/ui/Gralloc5.cpp') diff --git a/libs/ui/Gralloc5.cpp b/libs/ui/Gralloc5.cpp index 21068394d2..c3b2d3d808 100644 --- a/libs/ui/Gralloc5.cpp +++ b/libs/ui/Gralloc5.cpp @@ -343,14 +343,17 @@ status_t Gralloc5Mapper::validateBufferSize(buffer_handle_t bufferHandle, uint32 return BAD_VALUE; } } - { - auto value = getStandardMetadata(mMapper, bufferHandle); - if (static_cast(usage) != value) { - ALOGW("Usage didn't match, expected %" PRIu64 " got %" PRId64, usage, - static_cast(value.value_or(BufferUsage::CPU_READ_NEVER))); - return BAD_VALUE; - } - } + // TODO: This can false-positive fail if the allocator adjusted the USAGE bits internally + // Investigate further & re-enable or remove, but for now ignoring usage should be OK + (void)usage; + // { + // auto value = getStandardMetadata(mMapper, bufferHandle); + // if (static_cast(usage) != value) { + // ALOGW("Usage didn't match, expected %" PRIu64 " got %" PRId64, usage, + // static_cast(value.value_or(BufferUsage::CPU_READ_NEVER))); + // return BAD_VALUE; + // } + // } { auto value = getStandardMetadata(mMapper, bufferHandle); if (stride != value) { -- cgit v1.2.3-59-g8ed1b