[igt-dev] [PATCH i-g-t v2] tests/api_intel_bb: Verify delta is properly added in emit relocation

Chris Wilson chris at chris-wilson.co.uk
Tue Nov 10 13:00:07 UTC 2020


Quoting Zbigniew Kempczyński (2020-11-10 12:24:48)
> 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 <zbigniew.kempczynski at intel.com>
> Reported-by: Imre Deak <imre.deak at intel.com>
> Cc: Imre Deak <imre.deak at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  tests/i915/api_intel_bb.c | 68 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 68 insertions(+)
> 
> diff --git a/tests/i915/api_intel_bb.c b/tests/i915/api_intel_bb.c
> index 965a7dde..4e373f17 100644
> --- a/tests/i915/api_intel_bb.c
> +++ b/tests/i915/api_intel_bb.c
> @@ -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));

The instruction is different lengths; 1 upto gen8, 2 gen8+.
-Chris


More information about the igt-dev mailing list