diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-08-08 12:34:44 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-09-08 10:13:37 +0100 |
commit | 57cd6508da65adabcb14be6ba3b9370d750b647d (patch) | |
tree | 41e7abb39f90c5fd1ff0aa1d6808f9e211380eff /drivers/gpu/drm/i915/intel_display.c | |
parent | 763a4a019105dccdcd44883f1712571ae8ea8f1f (diff) | |
download | lwn-57cd6508da65adabcb14be6ba3b9370d750b647d.tar.gz lwn-57cd6508da65adabcb14be6ba3b9370d750b647d.zip |
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.c | 17 |
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, struct drm_mode_fb_cmd *mode_cmd, struct drm_gem_object *obj) { + struct drm_i915_gem_object *obj_priv = to_intel_bo(obj); int ret; + if (obj_priv->tiling_mode == I915_TILING_Y) + return -EINVAL; + + if (mode_cmd->pitch & 63) + return -EINVAL; + + switch (mode_cmd->bpp) { + case 8: + case 16: + case 24: + case 32: + break; + default: + return -EINVAL; + } + ret = drm_framebuffer_init(dev, &intel_fb->base, &intel_fb_funcs); if (ret) { DRM_ERROR("framebuffer init failed %d\n", ret); |