drm_hwcomposer: always put protected layers on hardware planes
Protected layers will not work inside of the GLWorker, so we are forced to put
them into planes directly.
Because we can now receive display contents which can never be properly
composited (e.g. 4 protected layers on hardware with only 3 planes), some
compromises had to be made for the composition planning algorithm. First all
protected layers are given a plane. Then the remaining planes are used by the
remaining layers, pre-composite buffer, and squash buffer. In the case where
there are too few planes for both a pre-composite buffer and squash buffer,
everything gets pushed into the pre-composite buffer and the squash buffer
will not be composited onto the screen. Another major limitation is that any
unprotected layers appearing behind a protected layer will actually appear on
top of that protected layer.
BUG=chrome-os-partner:43674
TEST=run protected content with lots of other layers
Change-Id: I94620d93f68ca14dc1966422dc89035ab84e3ff4
diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp
index e51d932..50a04d6 100644
--- a/drmdisplaycompositor.cpp
+++ b/drmdisplaycompositor.cpp
@@ -74,9 +74,10 @@
std::bitset<kMaxLayers> changed_layers;
for (size_t i = 0; i < last_handles_.size(); i++) {
DrmHwcLayer *layer = &layers[i];
- if (last_handles_[i] != layer->sf_handle) {
+ // Protected layers can't be squashed so we treat them as constantly
+ // changing.
+ if (layer->protected_usage() || last_handles_[i] != layer->sf_handle)
changed_layers.set(i);
- }
}
for (size_t i = 0; i < regions_.size(); i++) {