diff mbox

drm/i915/selftests: Detect unknown swizzling correctly

Message ID 20180705171523.18462-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson July 5, 2018, 5:15 p.m. UTC
i915_gem_detect_bit_6_swizzle() tries to hide unknown swizzling from
userspace (and ourselves) leaving us with the only clue inside
i915->quirks & QUIRK_PIN_SWIZZLED_PAGES. If we see this bit set, it
means that we really have no clue as to what the swizzle pattern is
being used in any one page and so cannot compute what the reference
value should be in our tiling selftests. We have to skip the test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107133
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/i915_gem_object.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Ville Syrjälä July 5, 2018, 6:35 p.m. UTC | #1
On Thu, Jul 05, 2018 at 06:15:23PM +0100, Chris Wilson wrote:
> i915_gem_detect_bit_6_swizzle() tries to hide unknown swizzling from
> userspace (and ourselves) leaving us with the only clue inside
> i915->quirks & QUIRK_PIN_SWIZZLED_PAGES. If we see this bit set, it
> means that we really have no clue as to what the swizzle pattern is
> being used in any one page and so cannot compute what the reference
> value should be in our tiling selftests. We have to skip the test.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107133
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

i915_gem_detect_bit_6_swizzle() indeed seems to lie.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/selftests/i915_gem_object.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_object.c b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> index 77dd7a510ea6..885153268968 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> @@ -347,6 +347,14 @@ static int igt_partial_tiling(void *arg)
>  		unsigned int pitch;
>  		struct tile tile;
>  
> +		if (i915->quirks & QUIRK_PIN_SWIZZLED_PAGES)
> +			/*
> +			 * The swizzling pattern is actually unknown as it
> +			 * varies based on physical address of each page.
> +			 * See i915_gem_detect_bit_6_swizzle().
> +			 */
> +			break;
> +
>  		tile.tiling = tiling;
>  		switch (tiling) {
>  		case I915_TILING_X:
> @@ -357,8 +365,8 @@ static int igt_partial_tiling(void *arg)
>  			break;
>  		}
>  
> -		if (tile.swizzle == I915_BIT_6_SWIZZLE_UNKNOWN ||
> -		    tile.swizzle == I915_BIT_6_SWIZZLE_9_10_17)
> +		GEM_BUG_ON(tile.swizzle == I915_BIT_6_SWIZZLE_UNKNOWN);
> +		if (tile.swizzle == I915_BIT_6_SWIZZLE_9_10_17)
>  			continue;
>  
>  		if (INTEL_GEN(i915) <= 2) {
> -- 
> 2.18.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_object.c b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
index 77dd7a510ea6..885153268968 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
@@ -347,6 +347,14 @@  static int igt_partial_tiling(void *arg)
 		unsigned int pitch;
 		struct tile tile;
 
+		if (i915->quirks & QUIRK_PIN_SWIZZLED_PAGES)
+			/*
+			 * The swizzling pattern is actually unknown as it
+			 * varies based on physical address of each page.
+			 * See i915_gem_detect_bit_6_swizzle().
+			 */
+			break;
+
 		tile.tiling = tiling;
 		switch (tiling) {
 		case I915_TILING_X:
@@ -357,8 +365,8 @@  static int igt_partial_tiling(void *arg)
 			break;
 		}
 
-		if (tile.swizzle == I915_BIT_6_SWIZZLE_UNKNOWN ||
-		    tile.swizzle == I915_BIT_6_SWIZZLE_9_10_17)
+		GEM_BUG_ON(tile.swizzle == I915_BIT_6_SWIZZLE_UNKNOWN);
+		if (tile.swizzle == I915_BIT_6_SWIZZLE_9_10_17)
 			continue;
 
 		if (INTEL_GEN(i915) <= 2) {