diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-04-24 02:09:10 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-05-05 03:08:42 -0400 |
commit | c0f5b82cd1a839090db19009ab126a8ad4a7602d (patch) | |
tree | cef658eefa1822f1dc9552f3e65357af005366e0 | |
parent | 9d662da8b695c86849288d463e45d0920b189c86 (diff) |
drm/i915: Catch abuse of I915_EXEC_CONSTANTS_*
A bit tricky since 0 is also a valid constant ...
v2: Add DRM_DEBUG (Chris)
Testcase: igt/gem_exec_params/rel-constants-*
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_execbuffer.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 04102cc80ef4..c7ef65c3ae91 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -1060,14 +1060,22 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | |||
1060 | case I915_EXEC_CONSTANTS_REL_GENERAL: | 1060 | case I915_EXEC_CONSTANTS_REL_GENERAL: |
1061 | case I915_EXEC_CONSTANTS_ABSOLUTE: | 1061 | case I915_EXEC_CONSTANTS_ABSOLUTE: |
1062 | case I915_EXEC_CONSTANTS_REL_SURFACE: | 1062 | case I915_EXEC_CONSTANTS_REL_SURFACE: |
1063 | if (ring == &dev_priv->ring[RCS] && | 1063 | if (mode != 0 && ring != &dev_priv->ring[RCS]) { |
1064 | mode != dev_priv->relative_constants_mode) { | 1064 | DRM_DEBUG("non-0 rel constants mode on non-RCS\n"); |
1065 | if (INTEL_INFO(dev)->gen < 4) | 1065 | return -EINVAL; |
1066 | } | ||
1067 | |||
1068 | if (mode != dev_priv->relative_constants_mode) { | ||
1069 | if (INTEL_INFO(dev)->gen < 4) { | ||
1070 | DRM_DEBUG("no rel constants on pre-gen4\n"); | ||
1066 | return -EINVAL; | 1071 | return -EINVAL; |
1072 | } | ||
1067 | 1073 | ||
1068 | if (INTEL_INFO(dev)->gen > 5 && | 1074 | if (INTEL_INFO(dev)->gen > 5 && |
1069 | mode == I915_EXEC_CONSTANTS_REL_SURFACE) | 1075 | mode == I915_EXEC_CONSTANTS_REL_SURFACE) { |
1076 | DRM_DEBUG("rel surface constants mode invalid on gen5+\n"); | ||
1070 | return -EINVAL; | 1077 | return -EINVAL; |
1078 | } | ||
1071 | 1079 | ||
1072 | /* The HW changed the meaning on this bit on gen6 */ | 1080 | /* The HW changed the meaning on this bit on gen6 */ |
1073 | if (INTEL_INFO(dev)->gen >= 6) | 1081 | if (INTEL_INFO(dev)->gen >= 6) |