[PATCH 4/6] drm/i915: Check the framebuffer offset
ville.syrjala at linux.intel.com
ville.syrjala at linux.intel.com
Thu May 24 11:08:57 PDT 2012
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
The framebuffer offset must be aligned to (macro)pixel size.
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8fea475..9df15ee 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6660,6 +6660,7 @@ int intel_framebuffer_init(struct drm_device *dev,
struct drm_i915_gem_object *obj)
{
int ret;
+ unsigned int align = drm_format_plane_cpp(mode_cmd->pixel_format, 0);
if (obj->tiling_mode == I915_TILING_Y)
return -EINVAL;
@@ -6699,6 +6700,7 @@ int intel_framebuffer_init(struct drm_device *dev,
case DRM_FORMAT_UYVY:
case DRM_FORMAT_YVYU:
case DRM_FORMAT_VYUY:
+ align <<= 1;
if (INTEL_INFO(dev)->gen < 6)
return -EINVAL;
break;
@@ -6707,6 +6709,9 @@ int intel_framebuffer_init(struct drm_device *dev,
return -EINVAL;
}
+ if (mode_cmd->offsets[0] % align)
+ return -EINVAL;
+
ret = drm_framebuffer_init(dev, &intel_fb->base, &intel_fb_funcs);
if (ret) {
DRM_ERROR("framebuffer init failed %d\n", ret);
--
1.7.3.4
More information about the dri-devel
mailing list