[RFC,3/4,v2] drm_hwcomposer: Use client compositing if there is only one plane

Message ID 1516749399-29504-4-git-send-email-john.stultz@linaro.org
State New
Headers show
Series
  • drm_hwcomposer: Changes to support HiKey/HiKey960
Related show

Commit Message

John Stultz Jan. 23, 2018, 11:16 p.m.
Originally based on work by Rob Herring, this patch changes
ValidateDisplay() so that if there is only one plane, we modify
Device composited layers to be Client composited.

Without this, on devices with just one plane, nothing gets
displayed on the screen.

Suggestions for alternative solutions here would be greatly
appreciated!

Cc: Marissa Wall <marissaw@google.com>
Cc: Sean Paul <seanpaul@google.com>
Cc: Dmitry Shmidt <dimitrysh@google.com>
Cc: Robert Foss <robert.foss@collabora.com>
Cc: Matt Szczesiak <matt.szczesiak@arm.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: David Hanna <david.hanna11@gmail.com>
Cc: Rob Herring <rob.herring@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>

---
v2:
* Rework Rob's change to check planes
---
 drmhwctwo.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

-- 
2.7.4

Comments

Rob Herring Jan. 24, 2018, 2:47 p.m. | #1
On Tue, Jan 23, 2018 at 5:16 PM, John Stultz <john.stultz@linaro.org> wrote:
> Originally based on work by Rob Herring, this patch changes
> ValidateDisplay() so that if there is only one plane, we modify
> Device composited layers to be Client composited.
>
> Without this, on devices with just one plane, nothing gets
> displayed on the screen.
>
> Suggestions for alternative solutions here would be greatly
> appreciated!
>
> Cc: Marissa Wall <marissaw@google.com>
> Cc: Sean Paul <seanpaul@google.com>
> Cc: Dmitry Shmidt <dimitrysh@google.com>
> Cc: Robert Foss <robert.foss@collabora.com>
> Cc: Matt Szczesiak <matt.szczesiak@arm.com>
> Cc: Liviu Dudau <Liviu.Dudau@arm.com>
> Cc: David Hanna <david.hanna11@gmail.com>
> Cc: Rob Herring <rob.herring@linaro.org>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
> v2:
> * Rework Rob's change to check planes
> ---
>  drmhwctwo.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp
> index dfca1a6..6d88c5c 100644
> --- a/drmhwctwo.cpp
> +++ b/drmhwctwo.cpp
> @@ -695,6 +695,13 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
>          layer.set_validated_type(HWC2::Composition::Client);
>          ++*num_types;
>          break;
> +      case HWC2::Composition::Device:
> +       /* If we only have one plane, always do Client composition */
> +        if (primary_planes_.size() + overlay_planes_.size() == 1) {
> +          layer.set_validated_type(HWC2::Composition::Client);
> +          ++*num_types;
> +          break;
> +        }

This needs to be conditional on GL compositing being disabled (either
thru init failure or a property flag). Also, this can be generalized
to use as many planes as we have. Something like the following patch.

BTW, "gl_enabled" doesn't exist. I left that for you to figure out how
to set and propagate.

diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp
index dfca1a6e9d2d..d7a85bbf67dd 100644
--- a/drmhwctwo.cpp
+++ b/drmhwctwo.cpp
@@ -684,6 +684,8 @@ HWC2::Error
DrmHwcTwo::HwcDisplay::SetVsyncEnabled(int32_t enabled) {
 HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
                                                    uint32_t *num_requests) {
   supported(__func__);
+  int planes = primary_planes_.size() + overlay_planes_.size();
+
   *num_types = 0;
   *num_requests = 0;
   for (std::pair<const hwc2_layer_t, DrmHwcTwo::HwcLayer> &l : layers_) {
@@ -696,7 +698,12 @@ HWC2::Error
DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
         ++*num_types;
         break;
       default:
-        layer.set_validated_type(layer.sf_type());
+        if (--planes > 0 || gl_enabled) {
+          layer.set_validated_type(layer.sf_type());
+        } else {
+          layer.set_validated_type(HWC2::Composition::Client);
+          ++*num_types;
+        }
         break;
     }
   }

Patch

diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp
index dfca1a6..6d88c5c 100644
--- a/drmhwctwo.cpp
+++ b/drmhwctwo.cpp
@@ -695,6 +695,13 @@  HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
         layer.set_validated_type(HWC2::Composition::Client);
         ++*num_types;
         break;
+      case HWC2::Composition::Device:
+	/* If we only have one plane, always do Client composition */
+        if (primary_planes_.size() + overlay_planes_.size() == 1) {
+          layer.set_validated_type(HWC2::Composition::Client);
+          ++*num_types;
+          break;
+        }
       default:
         layer.set_validated_type(layer.sf_type());
         break;