OSDN Git Service

Fix protected content playback via HWC2on1Adapter
authorFabien Sanglard <sanglardf@google.com>
Fri, 3 Feb 2017 00:59:44 +0000 (16:59 -0800)
committerFabien Sanglard <sanglardf@google.com>
Fri, 3 Feb 2017 22:52:41 +0000 (14:52 -0800)
The adapter marked unsupported dataspace layer with HWC_SKIP_LAYER
which prevented HWC to mark protected content with HWC_OVERLAY.

Test: AUPT
Change-Id: Id8c05c7e575ffcc4160cdd8d23b151c4901b4c5c

services/surfaceflinger/DisplayHardware/HWC2On1Adapter.cpp
services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h

index 37de7a2..2b603cc 100644 (file)
@@ -1298,6 +1298,7 @@ bool HWC2On1Adapter::Display::prepare()
         auto& hwc1Layer = mHwc1RequestedContents->hwLayers[layer->getHwc1Id()];
         hwc1Layer.releaseFenceFd = -1;
         hwc1Layer.acquireFenceFd = -1;
+        ALOGV("Applying states for layer %" PRIu64 " ", layer->getId());
         layer->applyState(hwc1Layer, applyAllState);
     }
 
@@ -2009,7 +2010,6 @@ HWC2On1Adapter::Layer::Layer(Display& display)
     mZ(0),
     mReleaseFence(),
     mHwc1Id(0),
-    mHasUnsupportedDataspace(false),
     mHasUnsupportedPlaneAlpha(false) {}
 
 bool HWC2On1Adapter::SortLayersByZ::operator()(
@@ -2070,9 +2070,8 @@ Error HWC2On1Adapter::Layer::setCompositionType(Composition type)
     return Error::None;
 }
 
-Error HWC2On1Adapter::Layer::setDataspace(android_dataspace_t dataspace)
+Error HWC2On1Adapter::Layer::setDataspace(android_dataspace_t)
 {
-    mHasUnsupportedDataspace = (dataspace != HAL_DATASPACE_UNKNOWN);
     return Error::None;
 }
 
@@ -2318,8 +2317,13 @@ void HWC2On1Adapter::Layer::applyCompositionType(hwc_layer_1_t& hwc1Layer,
     // HWC1 never supports color transforms or dataspaces and only sometimes
     // supports plane alpha (depending on the version). These require us to drop
     // some or all layers to client composition.
-    if (mHasUnsupportedDataspace || mHasUnsupportedPlaneAlpha ||
-            mDisplay.hasColorTransform() || mHasUnsupportedBackgroundColor) {
+    ALOGV("applyCompositionType");
+    ALOGV("mHasUnsupportedPlaneAlpha = %d", mHasUnsupportedPlaneAlpha);
+    ALOGV("mDisplay.hasColorTransform() = %d", mDisplay.hasColorTransform());
+    ALOGV("mHasUnsupportedBackgroundColor = %d", mHasUnsupportedBackgroundColor);
+
+    if (mHasUnsupportedPlaneAlpha || mDisplay.hasColorTransform() ||
+        mHasUnsupportedBackgroundColor) {
         hwc1Layer.compositionType = HWC_FRAMEBUFFER;
         hwc1Layer.flags = HWC_SKIP_LAYER;
         return;
index 9abdc38..df33ec3 100644 (file)
@@ -605,7 +605,6 @@ private:
             DeferredFence mReleaseFence;
 
             size_t mHwc1Id;
-            bool mHasUnsupportedDataspace;
             bool mHasUnsupportedPlaneAlpha;
             bool mHasUnsupportedBackgroundColor;
     };