[Mesa-dev] [PATCH v3 5/7] i965: Add support for xfb overflow on query buffer objects.
Kenneth Graunke
kenneth at whitecape.org
Thu Jan 5 19:17:51 UTC 2017
On Tuesday, December 13, 2016 2:50:57 PM PST Rafael Antognolli wrote:
> Enable getting the results of a transform feedback overflow query with a
> buffer object.
>
> Signed-off-by: Rafael Antognolli <rafael.antognolli at intel.com>
> ---
> src/mesa/drivers/dri/i965/hsw_queryobj.c | 108 +++++++++++++++++++++++++++++++
> 1 file changed, 108 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/hsw_queryobj.c b/src/mesa/drivers/dri/i965/hsw_queryobj.c
> index 0da2c3d..0c9dbdc 100644
> --- a/src/mesa/drivers/dri/i965/hsw_queryobj.c
> +++ b/src/mesa/drivers/dri/i965/hsw_queryobj.c
> @@ -187,6 +187,103 @@ gpr0_to_bool(struct brw_context *brw)
> }
>
> static void
> +load_gen_written_data_to_regs(struct brw_context *brw,
> + struct brw_query_object *query,
> + int idx)
Might it make sense to call this load_overflow_data_to_cs_gprs?
"gen_written_data" seems a bit generic :)
> +{
> + int offset = idx * sizeof(uint64_t) * 4;
> +
> + brw_load_register_mem64(brw,
> + HSW_CS_GPR(1),
> + query->bo,
> + I915_GEM_DOMAIN_INSTRUCTION,
> + I915_GEM_DOMAIN_INSTRUCTION,
> + offset);
> +
> + offset += sizeof(uint64_t);
> + brw_load_register_mem64(brw,
> + HSW_CS_GPR(2),
> + query->bo,
> + I915_GEM_DOMAIN_INSTRUCTION,
> + I915_GEM_DOMAIN_INSTRUCTION,
> + offset);
> +
> + offset += sizeof(uint64_t);
> + brw_load_register_mem64(brw,
> + HSW_CS_GPR(3),
> + query->bo,
> + I915_GEM_DOMAIN_INSTRUCTION,
> + I915_GEM_DOMAIN_INSTRUCTION,
> + offset);
> +
> + offset += sizeof(uint64_t);
> + brw_load_register_mem64(brw,
> + HSW_CS_GPR(4),
> + query->bo,
> + I915_GEM_DOMAIN_INSTRUCTION,
> + I915_GEM_DOMAIN_INSTRUCTION,
> + offset);
> +}
> +
> +/*
> + * R3 = R4 - R3;
> + * R1 = R2 - R1;
> + * R1 = R3 - R1;
> + * R0 = R0 | R1;
> + */
> +static void
> +calc_overflow_for_stream(struct brw_context *brw)
> +{
> + static const uint32_t maths[] = {
> + MI_MATH_ALU2(LOAD, SRCA, R4),
> + MI_MATH_ALU2(LOAD, SRCB, R3),
> + MI_MATH_ALU0(SUB),
> + MI_MATH_ALU2(STORE, R3, ACCU),
> + MI_MATH_ALU2(LOAD, SRCA, R2),
> + MI_MATH_ALU2(LOAD, SRCB, R1),
> + MI_MATH_ALU0(SUB),
> + MI_MATH_ALU2(STORE, R1, ACCU),
> + MI_MATH_ALU2(LOAD, SRCA, R3),
> + MI_MATH_ALU2(LOAD, SRCB, R1),
> + MI_MATH_ALU0(SUB),
> + MI_MATH_ALU2(STORE, R1, ACCU),
> + MI_MATH_ALU2(LOAD, SRCA, R1),
> + MI_MATH_ALU2(LOAD, SRCB, R0),
> + MI_MATH_ALU0(OR),
> + MI_MATH_ALU2(STORE, R0, ACCU),
> + };
> +
> + BEGIN_BATCH(1 + ARRAY_SIZE(maths));
> + OUT_BATCH(HSW_MI_MATH | (1 + ARRAY_SIZE(maths) - 2));
> +
> + for (int m = 0; m < ARRAY_SIZE(maths); m++)
> + OUT_BATCH(maths[m]);
> +
> + ADVANCE_BATCH();
> +}
> +
> +static void
> +calc_overflow_to_gpr0(struct brw_context *brw, struct brw_query_object *query,
> + int count)
> +{
> + brw_load_register_imm64(brw, HSW_CS_GPR(0), 0ull);
> +
> + for (int i = 0; i < count; i++) {
> + load_gen_written_data_to_regs(brw, query, i);
> + calc_overflow_for_stream(brw);
> + }
> +}
> +
> +static void
> +overflow_result_to_grp0(struct brw_context *brw,
typo here - gpr0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170105/11445cbc/attachment.sig>
More information about the mesa-dev
mailing list