diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-25 12:26:45 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-07-01 05:14:46 -0400 |
commit | a35cdaa0e13e24f3fccc518bfef1516aa8a8a665 (patch) | |
tree | b28ec025f4a9e0d582c7cf81ba044b05b0eb1412 | |
parent | e4e9222d4b5e041c3b5a54ee21d6c62e7cc56609 (diff) |
drm/i915: Detect invalid scanout pitches
Report back the user error of attempting to setup a CRTC with an invalid
framebuffer pitch. This is trickier than it should be as on gen4, there
is a restriction that tiled surfaces must have a stride less than 16k -
which is less than the largest supported CRTC size.
v2: Fix the limits for gen3
v3: Move check into intel_framebuffer_init() and fix VLV limits. (vsyrjala)
v4: Use idiomatic '>=' for generation checks
References: https://bugs.freedesktop.org/show_bug.cgi?id=65099
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 623acf49358e..d723819a450c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -9121,6 +9121,7 @@ int intel_framebuffer_init(struct drm_device *dev, | |||
9121 | struct drm_mode_fb_cmd2 *mode_cmd, | 9121 | struct drm_mode_fb_cmd2 *mode_cmd, |
9122 | struct drm_i915_gem_object *obj) | 9122 | struct drm_i915_gem_object *obj) |
9123 | { | 9123 | { |
9124 | int pitch_limit; | ||
9124 | int ret; | 9125 | int ret; |
9125 | 9126 | ||
9126 | if (obj->tiling_mode == I915_TILING_Y) { | 9127 | if (obj->tiling_mode == I915_TILING_Y) { |
@@ -9134,10 +9135,26 @@ int intel_framebuffer_init(struct drm_device *dev, | |||
9134 | return -EINVAL; | 9135 | return -EINVAL; |
9135 | } | 9136 | } |
9136 | 9137 | ||
9137 | /* FIXME <= Gen4 stride limits are bit unclear */ | 9138 | if (INTEL_INFO(dev)->gen >= 5 && !IS_VALLEYVIEW(dev)) { |
9138 | if (mode_cmd->pitches[0] > 32768) { | 9139 | pitch_limit = 32*1024; |
9139 | DRM_DEBUG("pitch (%d) must be at less than 32768\n", | 9140 | } else if (INTEL_INFO(dev)->gen >= 4) { |
9140 | mode_cmd->pitches[0]); | 9141 | if (obj->tiling_mode) |
9142 | pitch_limit = 16*1024; | ||
9143 | else | ||
9144 | pitch_limit = 32*1024; | ||
9145 | } else if (INTEL_INFO(dev)->gen >= 3) { | ||
9146 | if (obj->tiling_mode) | ||
9147 | pitch_limit = 8*1024; | ||
9148 | else | ||
9149 | pitch_limit = 16*1024; | ||
9150 | } else | ||
9151 | /* XXX DSPC is limited to 4k tiled */ | ||
9152 | pitch_limit = 8*1024; | ||
9153 | |||
9154 | if (mode_cmd->pitches[0] > pitch_limit) { | ||
9155 | DRM_DEBUG("%s pitch (%d) must be at less than %d\n", | ||
9156 | obj->tiling_mode ? "tiled" : "linear", | ||
9157 | mode_cmd->pitches[0], pitch_limit); | ||
9141 | return -EINVAL; | 9158 | return -EINVAL; |
9142 | } | 9159 | } |
9143 | 9160 | ||