diff mbox series

[2/2] drm/i915/selftests: tweak the misaligned_case

Message ID 20220406193037.1060769-2-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915/selftests: fixup min_alignment usage | expand

Commit Message

Matthew Auld April 6, 2022, 7:30 p.m. UTC
The compact-pt layout restrictions should only apply to the ppGTT. Also
make this play nice on platforms that only have the 64K GTT restriction,
and not the compact-pt thing.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Nirmoy Das <nirmoy.das@linux.intel.com>
---
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Nirmoy Das April 21, 2022, 8:18 a.m. UTC | #1
LGTM Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>

On 4/6/2022 9:30 PM, Matthew Auld wrote:
> The compact-pt layout restrictions should only apply to the ppGTT. Also
> make this play nice on platforms that only have the 64K GTT restriction,
> and not the compact-pt thing.
>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Nirmoy Das <nirmoy.das@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> index bccc49a8ab5e..8633bec18fa7 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> @@ -1112,10 +1112,16 @@ static int misaligned_case(struct i915_address_space *vm, struct intel_memory_re
>   	expected_vma_size = round_up(size, 1 << (ffs(vma->resource->page_sizes_gtt) - 1));
>   	expected_node_size = expected_vma_size;
>   
> -	if (NEEDS_COMPACT_PT(vm->i915) && i915_gem_object_is_lmem(obj)) {
> -		/* compact-pt should expand lmem node to 2MB */
> +	if (HAS_64K_PAGES(vm->i915) && i915_gem_object_is_lmem(obj)) {
> +		/*
> +		 * The compact-pt should expand lmem node to 2MB for the ppGTT,
> +		 * for all other cases we should only expect 64K.
> +		 */
>   		expected_vma_size = round_up(size, I915_GTT_PAGE_SIZE_64K);
> -		expected_node_size = round_up(size, I915_GTT_PAGE_SIZE_2M);
> +		if (NEEDS_COMPACT_PT(vm->i915) && !i915_is_ggtt(vm))
> +			expected_node_size = round_up(size, I915_GTT_PAGE_SIZE_2M);
> +		else
> +			expected_node_size = round_up(size, I915_GTT_PAGE_SIZE_64K);
>   	}
>   
>   	if (vma->size != expected_vma_size || vma->node.size != expected_node_size) {
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index bccc49a8ab5e..8633bec18fa7 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -1112,10 +1112,16 @@  static int misaligned_case(struct i915_address_space *vm, struct intel_memory_re
 	expected_vma_size = round_up(size, 1 << (ffs(vma->resource->page_sizes_gtt) - 1));
 	expected_node_size = expected_vma_size;
 
-	if (NEEDS_COMPACT_PT(vm->i915) && i915_gem_object_is_lmem(obj)) {
-		/* compact-pt should expand lmem node to 2MB */
+	if (HAS_64K_PAGES(vm->i915) && i915_gem_object_is_lmem(obj)) {
+		/*
+		 * The compact-pt should expand lmem node to 2MB for the ppGTT,
+		 * for all other cases we should only expect 64K.
+		 */
 		expected_vma_size = round_up(size, I915_GTT_PAGE_SIZE_64K);
-		expected_node_size = round_up(size, I915_GTT_PAGE_SIZE_2M);
+		if (NEEDS_COMPACT_PT(vm->i915) && !i915_is_ggtt(vm))
+			expected_node_size = round_up(size, I915_GTT_PAGE_SIZE_2M);
+		else
+			expected_node_size = round_up(size, I915_GTT_PAGE_SIZE_64K);
 	}
 
 	if (vma->size != expected_vma_size || vma->node.size != expected_node_size) {