From 2041913a05b79b96c5c084f30bb8944049a976c8 Mon Sep 17 00:00:00 2001 From: Jiwen 'Steve' Cai Date: Fri, 21 Apr 2017 18:49:53 -0700 Subject: BufferQueue: plumbing mConsumerIsProtected This replaces current logic in BufferQueue that uses GRALLOC_USAGE_PROTECTED to indicate whether an ANativeWindow is capable of handling hardware protected gralloc buffers. Current logic is problematic as it enforces producer to use protected buffer no matter whether producer side is capable of writing into a protected buffer. This new solution, however, introduces a new NATIVE_WINDOW_* flag that consumer can set on IGraphicBufferConsumer to indicate its capacity, which can then be queried by producer via Surface::query (or IGraphicBufferProducer::query). When consumer is capable of reading protected buffer (e.g. a protected GL context), the producer can generate either a protected or unprotected buffer. When consumer is not capable of reading protected buffer, the producer should only generate unprotected buffer. Bug: 35726763 Test: videoplayer-nodrm-protected.apk and videoplayer-drm-protected.apk both works. Change-Id: I1bf6814c9f1f81f9e04f0e89646b0733ff1a4758 --- libs/gui/BufferQueueProducer.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libs/gui/BufferQueueProducer.cpp') diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp index cddb1fd71b..8159aefc08 100644 --- a/libs/gui/BufferQueueProducer.cpp +++ b/libs/gui/BufferQueueProducer.cpp @@ -1105,6 +1105,9 @@ int BufferQueueProducer::query(int what, int *outValue) { value = static_cast(mCore->mBufferAge); } break; + case NATIVE_WINDOW_CONSUMER_IS_PROTECTED: + value = static_cast(mCore->mConsumerIsProtected); + break; default: return BAD_VALUE; } -- cgit v1.2.3-59-g8ed1b