All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: dri-devel <dri-devel@lists.freedesktop.org>
Cc: Rob Herring <rob.herring@linaro.org>,
	Matt Szczesiak <matt.szczesiak@arm.com>,
	Dmitry Shmidt <dimitrysh@google.com>,
	Sean Paul <seanpaul@google.com>,
	Robert Foss <robert.foss@collabora.com>,
	Alexandru-Cosmin Gheorghe <Alexandru-Cosmin.Gheorghe@arm.com>,
	Liviu Dudau <Liviu.Dudau@arm.com>,
	Alistair Strachan <astrachan@google.com>,
	Marissa Wall <marissaw@google.com>,
	David Hanna <david.hanna11@gmail.com>
Subject: [RFC][PATCH 2/2] drm_hwcomposer: Fall back to client compositon if the gl precompostior fails
Date: Mon, 23 Apr 2018 17:06:44 -0700	[thread overview]
Message-ID: <1524528404-12331-2-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1524528404-12331-1-git-send-email-john.stultz@linaro.org>

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@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>
Cc: Alexandru-Cosmin Gheorghe <Alexandru-Cosmin.Gheorghe@arm.com>
Cc: Alistair Strachan <astrachan@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-04-24  0:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-24  0:06 [RFC][PATCH 1/2] drm_hwcomposer: Cleanup gl precompositor init and provide uses_GL flag John Stultz
2018-04-24  0:06 ` John Stultz [this message]
2018-04-24  0:09   ` [RFC][PATCH 2/2] drm_hwcomposer: Fall back to client compositon if the gl precompostior fails John Stultz
2018-04-24  8:09   ` Alexandru-Cosmin Gheorghe
2018-04-24 10:34     ` Stefan Schake
2018-04-24 18:38       ` John Stultz
2018-04-24 19:40         ` Sean Paul
2018-04-25 18:15         ` Alistair Strachan
2018-04-24  1:30 ` [RFC][PATCH 1/2] drm_hwcomposer: Cleanup gl precompositor init and provide uses_GL flag Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1524528404-12331-2-git-send-email-john.stultz@linaro.org \
    --to=john.stultz@linaro.org \
    --cc=Alexandru-Cosmin.Gheorghe@arm.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=astrachan@google.com \
    --cc=david.hanna11@gmail.com \
    --cc=dimitrysh@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=marissaw@google.com \
    --cc=matt.szczesiak@arm.com \
    --cc=rob.herring@linaro.org \
    --cc=robert.foss@collabora.com \
    --cc=seanpaul@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.