drm: Don't allow page flip to change pixel format
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 21 Apr 2013 23:38:46 +0000 (01:38 +0200)
committerDave Airlie <airlied@redhat.com>
Mon, 22 Apr 2013 09:48:21 +0000 (19:48 +1000)
A page flip is not a mode set, changing the frame buffer pixel format
doesn't make sense and isn't handled by most drivers anyway. Disallow
it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_crtc.c

index 957fb70e8d0e41b16d7d078fbed5b9cff57363e6..c577baec416fecfa5c5a226226b54e2069c5e338 100644 (file)
@@ -3638,6 +3638,12 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
                goto out;
        }
 
+       if (crtc->fb->pixel_format != fb->pixel_format) {
+               DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
        if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
                ret = -ENOMEM;
                spin_lock_irqsave(&dev->event_lock, flags);