dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915/selftests: fixup min_alignment usage
@ 2022-04-06 19:30 Matthew Auld
  2022-04-06 19:30 ` [PATCH 2/2] drm/i915/selftests: tweak the misaligned_case Matthew Auld
  2022-04-21  7:56 ` [PATCH 1/2] drm/i915/selftests: fixup min_alignment usage Das, Nirmoy
  0 siblings, 2 replies; 4+ messages in thread
From: Matthew Auld @ 2022-04-06 19:30 UTC (permalink / raw)
  To: intel-gfx; +Cc: Thomas Hellström, dri-devel, Nirmoy Das

Trying to cast the region id into the region type doesn't work too well,
since the i915_vm_min_alignment() won't give us the correct value for
the stolen-lmem case.

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index 5c9bfa409ff5..bccc49a8ab5e 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -1150,7 +1150,7 @@ static int misaligned_pin(struct i915_address_space *vm,
 		flags |= PIN_GLOBAL;
 
 	for_each_memory_region(mr, vm->i915, id) {
-		u64 min_alignment = i915_vm_min_alignment(vm, (enum intel_memory_type)id);
+		u64 min_alignment = i915_vm_min_alignment(vm, mr->type);
 		u64 size = min_alignment;
 		u64 addr = round_down(hole_start + (hole_size / 2), min_alignment);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] drm/i915/selftests: tweak the misaligned_case
  2022-04-06 19:30 [PATCH 1/2] drm/i915/selftests: fixup min_alignment usage Matthew Auld
@ 2022-04-06 19:30 ` Matthew Auld
  2022-04-21  8:18   ` Das, Nirmoy
  2022-04-21  7:56 ` [PATCH 1/2] drm/i915/selftests: fixup min_alignment usage Das, Nirmoy
  1 sibling, 1 reply; 4+ messages in thread
From: Matthew Auld @ 2022-04-06 19:30 UTC (permalink / raw)
  To: intel-gfx; +Cc: Thomas Hellström, dri-devel, Nirmoy Das

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) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] drm/i915/selftests: fixup min_alignment usage
  2022-04-06 19:30 [PATCH 1/2] drm/i915/selftests: fixup min_alignment usage Matthew Auld
  2022-04-06 19:30 ` [PATCH 2/2] drm/i915/selftests: tweak the misaligned_case Matthew Auld
@ 2022-04-21  7:56 ` Das, Nirmoy
  1 sibling, 0 replies; 4+ messages in thread
From: Das, Nirmoy @ 2022-04-21  7:56 UTC (permalink / raw)
  To: Matthew Auld, intel-gfx; +Cc: Thomas Hellström, dri-devel

Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>

On 4/6/2022 9:30 PM, Matthew Auld wrote:
> Trying to cast the region id into the region type doesn't work too well,
> since the i915_vm_min_alignment() won't give us the correct value for
> the stolen-lmem case.
>
> 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 | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> index 5c9bfa409ff5..bccc49a8ab5e 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> @@ -1150,7 +1150,7 @@ static int misaligned_pin(struct i915_address_space *vm,
>   		flags |= PIN_GLOBAL;
>   
>   	for_each_memory_region(mr, vm->i915, id) {
> -		u64 min_alignment = i915_vm_min_alignment(vm, (enum intel_memory_type)id);
> +		u64 min_alignment = i915_vm_min_alignment(vm, mr->type);
>   		u64 size = min_alignment;
>   		u64 addr = round_down(hole_start + (hole_size / 2), min_alignment);
>   

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] drm/i915/selftests: tweak the misaligned_case
  2022-04-06 19:30 ` [PATCH 2/2] drm/i915/selftests: tweak the misaligned_case Matthew Auld
@ 2022-04-21  8:18   ` Das, Nirmoy
  0 siblings, 0 replies; 4+ messages in thread
From: Das, Nirmoy @ 2022-04-21  8:18 UTC (permalink / raw)
  To: Matthew Auld, intel-gfx; +Cc: Thomas Hellström, dri-devel

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) {

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-21  8:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 19:30 [PATCH 1/2] drm/i915/selftests: fixup min_alignment usage Matthew Auld
2022-04-06 19:30 ` [PATCH 2/2] drm/i915/selftests: tweak the misaligned_case Matthew Auld
2022-04-21  8:18   ` Das, Nirmoy
2022-04-21  7:56 ` [PATCH 1/2] drm/i915/selftests: fixup min_alignment usage Das, Nirmoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).