All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH] drm: don't override possible_crtcs for primary/cursor planes
Date: Thu, 20 Oct 2016 15:06:06 -0400	[thread overview]
Message-ID: <1476990366-10774-1-git-send-email-robdclark@gmail.com> (raw)

It is kind of a pointless restriction.  If userspace does silly things
like using crtcA's cursor plane on crtcB, and then setcursor on crtcA,
it will end up with the overlay disabled on crtcB.  But userspace is
allowed to shoot itself like this.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
Note that cursor and primary planes are slightly useless to non-atomic
userspace, since userspace has no way to know *which* crtc a primary
or cursor plane belongs to.  So lighting up a 2nd display may or may
not make your overlay planes go *poof*.

So basically use of cursor/primary planes plus legacy ioctls is an
undefined behavior if we go with this patch.

*Maybe* we want to restrict this to atomic userspace.  (Ie. advertise
the more limited possible_crtcs for legacy userspace.)  Depends on
whether we can (slightly retroactively) declare that mixing atomic
and legacy APIs is undefined behavior.  Or if really needed, add
DRM_CLIENT_CAP_REALLY_REALLY_ATOMIC_NO_LEGACY_PLS.  (Or just pass in
value 2 for existing DRM_CLIENT_CAP_ATOMIC)

 drivers/gpu/drm/drm_crtc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index c215802..1e6d37f 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -707,9 +707,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
 	crtc->primary = primary;
 	crtc->cursor = cursor;
 	if (primary)
-		primary->possible_crtcs = 1 << drm_crtc_index(crtc);
+		WARN_ON(!(primary->possible_crtcs & (1 << drm_crtc_index(crtc))));
 	if (cursor)
-		cursor->possible_crtcs = 1 << drm_crtc_index(crtc);
+		WARN_ON(!(cursor->possible_crtcs & (1 << drm_crtc_index(crtc))));
 
 	if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
 		drm_object_attach_property(&crtc->base, config->prop_active, 0);
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2016-10-20 19:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-20 19:06 Rob Clark [this message]
2016-10-20 19:19 ` [PATCH] drm: don't override possible_crtcs for primary/cursor planes Ville Syrjälä
2016-10-20 20:02   ` Rob Clark
2016-10-20 19:22 ` Sean Paul
  -- strict thread matches above, loose matches on Subject: below --
2016-11-05 14:52 Rob Clark
2016-11-08 10:19 ` Daniel Vetter

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=1476990366-10774-1-git-send-email-robdclark@gmail.com \
    --to=robdclark@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /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.