aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2015-03-09 04:41:07 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-03-10 04:59:36 -0400
commit7eb5f302bbe78b88da8b2008c502c1975e75db05 (patch)
tree1b07b37cf0d9aa68712ad93d7da50a1b754bca44 /drivers/gpu/drm/drm_crtc.c
parentc484f02d0f02fbbfc6decc945a69aae011041a27 (diff)
drm: Check in setcrtc if the primary plane supports the fb pixel format
Drivers implementing the universal planes API report the list of supported pixel formats for the primary plane. Make sure the fb passed to the setcrtc ioctl is compatible. Drivers not implementing the universal planes API will have no format reported for the primary plane, skip the check in that case. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 447db50e6838..5785336695ca 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2798,6 +2798,23 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
2798 2798
2799 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); 2799 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
2800 2800
2801 /*
2802 * Check whether the primary plane supports the fb pixel format.
2803 * Drivers not implementing the universal planes API use a
2804 * default formats list provided by the DRM core which doesn't
2805 * match real hardware capabilities. Skip the check in that
2806 * case.
2807 */
2808 if (!crtc->primary->format_default) {
2809 ret = drm_plane_check_pixel_format(crtc->primary,
2810 fb->pixel_format);
2811 if (ret) {
2812 DRM_DEBUG_KMS("Invalid pixel format %s\n",
2813 drm_get_format_name(fb->pixel_format));
2814 goto out;
2815 }
2816 }
2817
2801 ret = drm_crtc_check_viewport(crtc, crtc_req->x, crtc_req->y, 2818 ret = drm_crtc_check_viewport(crtc, crtc_req->x, crtc_req->y,
2802 mode, fb); 2819 mode, fb);
2803 if (ret) 2820 if (ret)