If the gl precompositor isn't being used, we cannot accept every layer as a device composited layer. Thus this patch adds some extra logic in the validate function to try to map layers to available device planes, falling back to client side compositing if we run-out of planes. Credit to Rob Herring, who's work this single plane patch was originally based on. Feedback or alternative ideas would be greatly appreciated! Cc: Marissa Wall <marissaw@xxxxxxxxxx> Cc: Sean Paul <seanpaul@xxxxxxxxxx> Cc: Dmitry Shmidt <dimitrysh@xxxxxxxxxx> Cc: Robert Foss <robert.foss@xxxxxxxxxxxxx> Cc: Matt Szczesiak <matt.szczesiak@xxxxxxx> Cc: Liviu Dudau <Liviu.Dudau@xxxxxxx> Cc: David Hanna <david.hanna11@xxxxxxxxx> Cc: Rob Herring <rob.herring@xxxxxxxxxx> Cc: Alexandru-Cosmin Gheorghe <Alexandru-Cosmin.Gheorghe@xxxxxxx> Cc: Alistair Strachan <astrachan@xxxxxxxxxx> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx> --- drmhwctwo.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp index dfca1a6..437a439 100644 --- a/drmhwctwo.cpp +++ b/drmhwctwo.cpp @@ -686,6 +686,15 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types, supported(__func__); *num_types = 0; *num_requests = 0; + int avail_planes = primary_planes_.size() + overlay_planes_.size(); + + /* + * If more layers then planes, save one plane + * for client composited layers + */ + if (avail_planes < layers_.size()) + avail_planes--; + for (std::pair<const hwc2_layer_t, DrmHwcTwo::HwcLayer> &l : layers_) { DrmHwcTwo::HwcLayer &layer = l.second; switch (layer.sf_type()) { @@ -695,6 +704,15 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types, layer.set_validated_type(HWC2::Composition::Client); ++*num_types; break; + case HWC2::Composition::Device: + if (!compositor_.uses_GL() && !avail_planes) { + layer.set_validated_type(HWC2::Composition::Client); + ++*num_types; + break; + } else { + avail_planes--; + } + /* fall through */ default: layer.set_validated_type(layer.sf_type()); break; -- 2.7.4 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel