aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-08-08 07:34:44 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-08 05:13:37 -0400
commit57cd6508da65adabcb14be6ba3b9370d750b647d (patch)
tree41e7abb39f90c5fd1ff0aa1d6808f9e211380eff /drivers/gpu/drm/i915/intel_display.c
parent763a4a019105dccdcd44883f1712571ae8ea8f1f (diff)
drm/i915: Sanity check user framebuffer parameters on creation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3a03c62496d3..adce19304eee 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5371,8 +5371,25 @@ int intel_framebuffer_init(struct drm_device *dev,
5371 struct drm_mode_fb_cmd *mode_cmd, 5371 struct drm_mode_fb_cmd *mode_cmd,
5372 struct drm_gem_object *obj) 5372 struct drm_gem_object *obj)
5373{ 5373{
5374 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
5374 int ret; 5375 int ret;
5375 5376
5377 if (obj_priv->tiling_mode == I915_TILING_Y)
5378 return -EINVAL;
5379
5380 if (mode_cmd->pitch & 63)
5381 return -EINVAL;
5382
5383 switch (mode_cmd->bpp) {
5384 case 8:
5385 case 16:
5386 case 24:
5387 case 32:
5388 break;
5389 default:
5390 return -EINVAL;
5391 }
5392
5376 ret = drm_framebuffer_init(dev, &intel_fb->base, &intel_fb_funcs); 5393 ret = drm_framebuffer_init(dev, &intel_fb->base, &intel_fb_funcs);
5377 if (ret) { 5394 if (ret) {
5378 DRM_ERROR("framebuffer init failed %d\n", ret); 5395 DRM_ERROR("framebuffer init failed %d\n", ret);