summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2011-12-19 22:06:47 (GMT)
committerDave Airlie <airlied@redhat.com>2011-12-20 10:05:32 (GMT)
commit62443be626a3a753e6c650abd87e8a39fd569d7e (patch)
tree5c7239f89724b31a8d24f77c451cb832ffbff710
parent22cd7c625837e520c94ffda7bc926396bbc4ba67 (diff)
downloadlinux-fsl-qoriq-62443be626a3a753e6c650abd87e8a39fd569d7e.tar.xz
drm: plane: Check that the fb pixel format is supported by the plane
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_crtc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 80cfe1c..66a165d 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1662,6 +1662,7 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
struct drm_framebuffer *fb;
int ret = 0;
unsigned int fb_width, fb_height;
+ int i;
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
@@ -1710,6 +1711,16 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
}
fb = obj_to_fb(obj);
+ /* Check whether this plane supports the fb pixel format. */
+ for (i = 0; i < plane->format_count; i++)
+ if (fb->pixel_format == plane->format_types[i])
+ break;
+ if (i == plane->format_count) {
+ DRM_DEBUG_KMS("Invalid pixel format 0x%08x\n", fb->pixel_format);
+ ret = -EINVAL;
+ goto out;
+ }
+
fb_width = fb->width << 16;
fb_height = fb->height << 16;