drm/i915: Reject fence stride=0 on gen4+
Subsystems (2)
PATCH 1/1 drm/i915: Reject fence stride=0 on gen4+
From: Ville Syrjälä <[email protected]>
Our checks for an invalid fence stride forgot to guard against zero stride on gen4+. Fix it.
--- drivers/gpu/drm/i915/i915_gem_tiling.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_gem_tiling.c +2 -0
@@ -240,6 +240,8 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)/* 965+ just needs multiples of tile width */ if (INTEL_INFO (dev)->gen >=4 ) { +if (stride < tile_width) +return false;if (stride & (tile_width -1 ))return false;return true;
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · On Tue, Apr 09, 2013 at 05:46:45PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Our checks for an invalid fence stride forgot to guard against zero stride on gen4+. Fix it.
Signed-off-by Ville Syrjälä <[email protected]>
This duplicates the tiny stride check a bit with the gen2/3 code. What about
drivers/gpu/drm/i915/i915_gem_tiling.c +3 -3
@@ -235,6 +235,9 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) } } +if (stride < tile_width) +return false; +/* 965+ just needs multiples of tile width */ if (INTEL_INFO (dev)->gen >=4 ) {if (stride & (tile_width -1 ))
@@ -243,9 +246,6 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) }/* Pre-965 needs power of two tile widths */ -if (stride < tile_width) -return false; -if (stride & (stride -1 ))return false;
instead?
-Daniel
Quoted 24 lines
--- drivers/gpu/drm/i915/i915_gem_tiling.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/i915/i915_gem_tiling.c +2
-0@@ -240,6 +240,8 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)/* 965+ just needs multiples of tile width */ if (INTEL_INFO (dev)->gen >=4 ) { +if (stride < tile_width) +return false;if (stride & (tile_width -1 ))return false;return true;Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 36 lines · Daniel Vetter
Quoted 6 lines · On Tue, Apr 09, 2013 at 05:46:45PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Our checks for an invalid fence stride forgot to guard against zero stride on gen4+. Fix it.
Signed-off-by Ville Syrjälä <[email protected]>This duplicates the tiny stride check a bit with the gen2/3 code. What about
drivers/gpu/drm/i915/i915_gem_tiling.c +3
-3@@ -235,6 +235,9 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) } } +if (stride < tile_width) +return false; +/* 965+ just needs multiples of tile width */ if (INTEL_INFO (dev)->gen >=4 ) {if (stride & (tile_width -1 ))@@ -243,9 +246,6 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) }/* Pre-965 needs power of two tile widths */ -if (stride < tile_width) -return false; -if (stride & (stride -1 ))return false;
Quoted 1 line
instead?
Looks OK. The same idea occured to me, but only after hitting enter.
Quoted 31 lines
-Daniel
Quoted 24 lines
--- drivers/gpu/drm/i915/i915_gem_tiling.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/i915/i915_gem_tiling.c +2
-0@@ -240,6 +240,8 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)/* 965+ just needs multiples of tile width */ if (INTEL_INFO (dev)->gen >=4 ) { +if (stride < tile_width) +return false;if (stride & (tile_width -1 ))return false;return true;Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 2 lines
Ville Syrjälä Intel OTC
PATCH v2 1/1 drm/i915: Reject fence stride=0 on gen4+
In reply to Daniel VetterFrom: Ville Syrjälä <[email protected]>
Our checks for an invalid fence stride forgot to guard against zero stride on gen4+. Fix it.
v2: Avoid duplicated code (danvet)
--- drivers/gpu/drm/i915/i915_gem_tiling.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_tiling.c +3 -3
@@ -238,6 +238,9 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) } } +if (stride < tile_width) +return false; +/* 965+ just needs multiples of tile width */ if (INTEL_INFO (dev)->gen >=4 ) {if (stride & (tile_width -1 ))
@@ -246,9 +249,6 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) }/* Pre-965 needs power of two tile widths */ -if (stride < tile_width) -return false; -if (stride & (stride -1 ))return false;
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter
AppliedQuoted 8 lines · On Tue, Apr 09, 2013 at 08:09:13PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Our checks for an invalid fence stride forgot to guard against zero stride on gen4+. Fix it.
v2: Avoid duplicated code (danvet)
Signed-off-by Ville Syrjälä <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Quoted 31 lines
--- drivers/gpu/drm/i915/i915_gem_tiling.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_gem_tiling.c +3
-3@@ -238,6 +238,9 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) } } +if (stride < tile_width) +return false; +/* 965+ just needs multiples of tile width */ if (INTEL_INFO (dev)->gen >=4 ) {if (stride & (tile_width -1 ))@@ -246,9 +249,6 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) }/* Pre-965 needs power of two tile widths */ -if (stride < tile_width) -return false; -if (stride & (stride -1 ))return false;Signature · 1 line
1.8.1.5
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch