]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm: Check CRTC compatibility in setplane
authorMatt Roper <matthew.d.roper@intel.com>
Thu, 29 May 2014 15:06:51 +0000 (08:06 -0700)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 3 Jun 2014 14:36:00 +0000 (16:36 +0200)
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
Reviewed-by: Chon Ming Lee <chon.ming.lee@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_plane_helper.c

index 34f0bf18d80d44538f0a58fe61071a01775c07fe..919dabde3932a411fd111d6ed76749684c707ee2 100644 (file)
@@ -2146,6 +2146,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",
index d966afa7ecae66e620cf38a1ec237a6b47b08b68..b601233d733fa49aa7eca802715132c9ec60760c 100644 (file)
@@ -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;