tests/api_intel_bb: Verify delta is properly added in emit relocation
PATCH v2 1/1 tests/api_intel_bb: Verify delta is properly added in emit relocation
When delta is added to buffer address and sum exceeds 32bits verify emit relocation contains properly set low + high address dwords.
v2: Simplify code and add write/read check (suggested by Imre)
References: https://patchwork.freedesktop.org/series/83644/
--- tests/i915/api_intel_bb.c | 68 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
tests/i915/api_intel_bb.c +68 -0
@@ -860,6 +860,71 @@ static void offset_control(struct buf_ops *bops)intel_bb_destroy (ibb); } +/* +* Idea of the test is to verify delta is properly added to address +* when emit_reloc() is called. +*/ +#define DELTA_BUFFERS 3 +static void delta_check (struct buf_ops *bops) +{ +int i915 =buf_ops_get_fd (bops); +struct intel_bb *ibb; +struct intel_buf *buf; +uint32_t *ptr, hi, lo, val; +uint64_t offset; +bool supports_48bit; + + ibb =intel_bb_create (i915,PAGE_SIZE ); + supports_48bit = ibb->supports_48b_address; +if (!supports_48bit) +intel_bb_destroy (ibb); +igt_require_f (supports_48bit,"We need 48bit ppgtt for testing\n" ); + +if (debug_bb) +intel_bb_set_debug (ibb, true); + + buf =create_buf (bops,0x1000 ,0x10 ,COLOR_CC ); + buf->addr.offset =0xfffff000 ; +intel_bb_add_object (ibb, buf->handle,intel_buf_bo_size (buf), + buf->addr.offset, false); + +intel_bb_out (ibb,MI_STORE_DWORD_IMM | (ibb->gen <6 ?1 <<22 :0 )); +intel_bb_emit_reloc (ibb, buf->handle, +I915_GEM_DOMAIN_RENDER , +I915_GEM_DOMAIN_RENDER , +0x2000 , buf->addr.offset); +intel_bb_out (ibb,0x1234abcd ); + +intel_bb_out (ibb,MI_BATCH_BUFFER_END ); +intel_bb_ptr_align (ibb,8 ); + +intel_bb_exec (ibb,intel_bb_offset (ibb),I915_EXEC_DEFAULT , false); +intel_bb_sync (ibb); + +/* Buffer should be @ 0xc000_0000 */ + offset =intel_bb_get_object_offset (ibb, buf->handle); +igt_assert (offset ==0xfffff000 ); + + ptr =gem_mmap__device_coherent (i915, ibb->handle,0 , ibb->size,PROT_READ ); + lo = ptr[1 ]; + hi = ptr[2 ]; +gem_munmap (ptr, ibb->size); + + ptr =gem_mmap__device_coherent (i915, buf->handle,0 , +intel_buf_bo_size (buf),PROT_READ ); + val = ptr[0x2000 /sizeof (uint32_t )]; +gem_munmap (ptr, ibb->size); + +intel_buf_destroy (buf); +intel_bb_destroy (ibb); + +/* Assert after all resources are freed */ +igt_assert_f (lo ==0x1000 && hi ==0x1 , +"intel-bb doesn't properly handle delta in emit relocation\n" ); +igt_assert_f (val ==0x1234abcd , +"Address doesn't contain expected value\n" ); +} +static void full_batch (struct buf_ops *bops) {int i915 =buf_ops_get_fd (bops);
@@ -1150,6 +1215,9 @@ igt_main_args("dpib", NULL, help_str, opt_handler, NULL) igt_subtest("offset-control")offset_control (bops); + igt_subtest("delta-check") +delta_check (bops); + igt_subtest("full-batch")full_batch (bops);
Signature · 6 lines
2.26.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoting Zbigniew Kempczyński (2020-11-10 12:24:48)
Quoted 42 lines
When delta is added to buffer address and sum exceeds 32bits verify emit relocation contains properly set low + high address dwords.
v2: Simplify code and add write/read check (suggested by Imre)
References: https://patchwork.freedesktop.org/series/83644/
Signed-off-by Zbigniew Kempczyński <[email protected]>Reported-by Imre Deak <[email protected]>Cc Imre Deak <[email protected]>Cc Chris Wilson <[email protected]>--- tests/i915/api_intel_bb.c | 68 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)tests/i915/api_intel_bb.c +19
-0@@ -860,6 +860,71 @@ static void offset_control(struct buf_ops *bops)intel_bb_destroy (ibb); } +/* +* Idea of the test is to verify delta is properly added to address +* when emit_reloc() is called. +*/ +#define DELTA_BUFFERS 3 +static void delta_check (struct buf_ops *bops) +{ +int i915 =buf_ops_get_fd (bops); +struct intel_bb *ibb; +struct intel_buf *buf; +uint32_t *ptr, hi, lo, val; +uint64_t offset; +bool supports_48bit; + + ibb =intel_bb_create (i915,PAGE_SIZE ); + supports_48bit = ibb->supports_48b_address; +if (!supports_48bit) +intel_bb_destroy (ibb); +igt_require_f (supports_48bit,"We need 48bit ppgtt for testing\n" );
tests/i915/api_intel_bb.c static void offset_control(struct buf_ops *bops) · line 891
Quoted 10 lines
tests/i915/api_intel_bb.c +10
-0+ +if (debug_bb) +intel_bb_set_debug (ibb, true); + + buf =create_buf (bops,0x1000 ,0x10 ,COLOR_CC ); + buf->addr.offset =0xfffff000 ; +intel_bb_add_object (ibb, buf->handle,intel_buf_bo_size (buf), + buf->addr.offset, false); + +intel_bb_out (ibb,MI_STORE_DWORD_IMM | (ibb->gen <6 ?1 <<22 :0 ));
The instruction is different lengths; 1 upto gen8, 2 gen8+. -Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 48 lines · Chris Wilson
Quoting Zbigniew Kempczyński (2020-11-10 12:24:48)
Quoted 47 lines
When delta is added to buffer address and sum exceeds 32bits verify emit relocation contains properly set low + high address dwords.
v2: Simplify code and add write/read check (suggested by Imre)
References: https://patchwork.freedesktop.org/series/83644/
Signed-off-by Zbigniew Kempczyński <[email protected]>Reported-by Imre Deak <[email protected]>Cc Imre Deak <[email protected]>Cc Chris Wilson <[email protected]>--- tests/i915/api_intel_bb.c | 68 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)tests/i915/api_intel_bb.c +24
-0@@ -860,6 +860,71 @@ static void offset_control(struct buf_ops *bops)intel_bb_destroy (ibb); } +/* +* Idea of the test is to verify delta is properly added to address +* when emit_reloc() is called. +*/ +#define DELTA_BUFFERS 3 +static void delta_check (struct buf_ops *bops) +{ +int i915 =buf_ops_get_fd (bops); +struct intel_bb *ibb; +struct intel_buf *buf; +uint32_t *ptr, hi, lo, val; +uint64_t offset; +bool supports_48bit; + + ibb =intel_bb_create (i915,PAGE_SIZE ); + supports_48bit = ibb->supports_48b_address; +if (!supports_48bit) +intel_bb_destroy (ibb); +igt_require_f (supports_48bit,"We need 48bit ppgtt for testing\n" ); + +if (debug_bb) +intel_bb_set_debug (ibb, true); + + buf =create_buf (bops,0x1000 ,0x10 ,COLOR_CC );
Quoted 8 lines
tests/i915/api_intel_bb.c static void offset_control(struct buf_ops *bops) · line 891
Quoted 5 lines
tests/i915/api_intel_bb.c +5
-0+ buf->addr.offset =0xfffff000 ; +intel_bb_add_object (ibb, buf->handle,intel_buf_bo_size (buf), + buf->addr.offset, false); + +intel_bb_out (ibb,MI_STORE_DWORD_IMM | (ibb->gen <6 ?1 <<22 :0 ));The instruction is different lengths; 1 upto gen8, 2 gen8+. -Chris
It requires 48b ppgtt, I thought it is not available before gen9.
--
Zbigniew
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoting Zbigniew Kempczyński (2020-11-10 14:03:21)
Quoted 58 lines · Chris Wilson
Quoted 48 lines
Quoting Zbigniew Kempczyński (2020-11-10 12:24:48)
Quoted 47 lines
When delta is added to buffer address and sum exceeds 32bits verify emit relocation contains properly set low + high address dwords.
v2: Simplify code and add write/read check (suggested by Imre)
References: https://patchwork.freedesktop.org/series/83644/
Signed-off-by Zbigniew Kempczyński <[email protected]>Reported-by Imre Deak <[email protected]>Cc Imre Deak <[email protected]>Cc Chris Wilson <[email protected]>--- tests/i915/api_intel_bb.c | 68 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)tests/i915/api_intel_bb.c +24
-0@@ -860,6 +860,71 @@ static void offset_control(struct buf_ops *bops)intel_bb_destroy (ibb); } +/* +* Idea of the test is to verify delta is properly added to address +* when emit_reloc() is called. +*/ +#define DELTA_BUFFERS 3 +static void delta_check (struct buf_ops *bops) +{ +int i915 =buf_ops_get_fd (bops); +struct intel_bb *ibb; +struct intel_buf *buf; +uint32_t *ptr, hi, lo, val; +uint64_t offset; +bool supports_48bit; + + ibb =intel_bb_create (i915,PAGE_SIZE ); + supports_48bit = ibb->supports_48b_address; +if (!supports_48bit) +intel_bb_destroy (ibb); +igt_require_f (supports_48bit,"We need 48bit ppgtt for testing\n" ); + +if (debug_bb) +intel_bb_set_debug (ibb, true); + + buf =create_buf (bops,0x1000 ,0x10 ,COLOR_CC );Quoted 8 lines
tests/i915/api_intel_bb.c static void offset_control(struct buf_ops *bops) · line 891
Quoted 5 lines
tests/i915/api_intel_bb.c +5
-0+ buf->addr.offset =0xfffff000 ; +intel_bb_add_object (ibb, buf->handle,intel_buf_bo_size (buf), + buf->addr.offset, false); + +intel_bb_out (ibb,MI_STORE_DWORD_IMM | (ibb->gen <6 ?1 <<22 :0 ));The instruction is different lengths; 1 upto gen8, 2 gen8+. -Chris
Quoted 1 line
It requires 48b ppgtt, I thought it is not available before gen9.
48b is gen8+.
But you also have ibb->gen < 6, which is what I read and reacted to :) -Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 9 lines · Chris Wilson
Quoted 5 lines
Quoted 3 lines
The instruction is different lengths; 1 upto gen8, 2 gen8+. -Chris
It requires 48b ppgtt, I thought it is not available before gen9.
48b is gen8+.
But you also have
ibb->gen< 6, which is what I read and reacted to :) -Chris
Eh, copy-paste issue. v3 is almost on the way...
--
Zbigniew
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev