From 5d2018a2e306030406c0f996d2b01adac7699afe Mon Sep 17 00:00:00 2001 From: Peiyong Lin Date: Tue, 26 Mar 2019 15:07:54 -0700 Subject: Reallocate GraphicBuffer as long as the protected bit is different. Previously as long as the usage bit is the superset of the requested usage bit, we don't reallocate GraphicBuffer. However, this is wrong for protected contents, the protected usage bit on GraphicBuffer must align with the protected context. Since we turn off protected context when there's no protected content, we need to reallocate non-protected GraphicBuffer, otherwise it's undefined behaviour and will result in crash. BUG: b/35315015, b/127862411 Test: Verify no kgsl page fault with protected contents. Change-Id: I789076ba411079364528bd844e6abb5dcbfa77f7 --- libs/ui/GraphicBuffer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'libs/ui/GraphicBuffer.cpp') diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp index 40df260fda..45340a1fe9 100644 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@ -194,6 +194,7 @@ bool GraphicBuffer::needsReallocation(uint32_t inWidth, uint32_t inHeight, if (inFormat != format) return true; if (inLayerCount != layerCount) return true; if ((usage & inUsage) != inUsage) return true; + if ((usage & USAGE_PROTECTED) != (inUsage & USAGE_PROTECTED)) return true; return false; } -- cgit v1.2.3-59-g8ed1b