public inbox for dri-devel@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm: Check CRTC compatibility in setplane
@ 2014-04-23 17:03 Matt Roper
  2014-04-23 17:04 ` [PATCH 2/3] drm/plane-helper: Add drm_primary_helper_check_update() Matt Roper
  2014-04-23 18:03 ` [Intel-gfx] [PATCH 1/3] drm: Check CRTC compatibility in setplane Daniel Vetter
  0 siblings, 2 replies; 6+ messages in thread
From: Matt Roper @ 2014-04-23 17:03 UTC (permalink / raw)
  To: intel-gfx; +Cc: dri-devel

The DRM core setplane code should check that the plane is usable on the
specified CRTC before calling into the driver.

Prior to this patch, a plane's possible_crtcs field was purely
informational for userspace and was never actually verified at the
kernel level (aside from the primary plane helper).

Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/drm_crtc.c         | 7 +++++++
 drivers/gpu/drm/drm_plane_helper.c | 6 ------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 461d19b..b6d6c04 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2140,6 +2140,13 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
 	}
 	crtc = obj_to_crtc(obj);
 
+	/* Check whether this plane is usable on this CRTC */
+	if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) {
+		DRM_DEBUG_KMS("Invalid crtc for plane\n");
+		ret = -EINVAL;
+		goto out;
+	}
+
 	fb = drm_framebuffer_lookup(dev, plane_req->fb_id);
 	if (!fb) {
 		DRM_DEBUG_KMS("Unknown framebuffer ID %d\n",
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index b72736d..65c4a00 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -137,12 +137,6 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
 		return -EINVAL;
 	}
 
-	/* Primary planes are locked to their owning CRTC */
-	if (plane->possible_crtcs != drm_crtc_mask(crtc)) {
-		DRM_DEBUG_KMS("Cannot change primary plane CRTC\n");
-		return -EINVAL;
-	}
-
 	/* Disallow scaling */
 	src_w >>= 16;
 	src_h >>= 16;
-- 
1.8.5.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-23 18:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-23 17:03 [PATCH 1/3] drm: Check CRTC compatibility in setplane Matt Roper
2014-04-23 17:04 ` [PATCH 2/3] drm/plane-helper: Add drm_primary_helper_check_update() Matt Roper
2014-04-23 18:39   ` Ville Syrjälä
2014-04-23 18:03 ` [Intel-gfx] [PATCH 1/3] drm: Check CRTC compatibility in setplane Daniel Vetter
2014-04-23 18:26   ` Matt Roper
2014-04-23 18:33     ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox