[Mesa-dev] [PATCH] nvc0: fix 64-bit integer query buffer writes

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Feb 10 10:26:22 UTC 2017



On 02/10/2017 02:29 AM, Ilia Mirkin wrote:
> The former logic just plain didn't work at all. We need to write the
> subsequent dword to the next buffer location.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  src/gallium/drivers/nouveau/nvc0/mme/com9097.mme   | 22 ++++++++++++-----
>  src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h | 28 ++++++++++++++--------
>  src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c   |  7 +++---
>  3 files changed, 37 insertions(+), 20 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
> index 11c2056..7c5ec8f 100644
> --- a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
> +++ b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
> @@ -508,18 +508,21 @@ daic_runout_check:
>   * parm[3] = MSB of start value
>   * parm[4] = desired sequence
>   * parm[5] = actual sequence
> + * parm[6] = query high address
> + * parm[7] = query low address
>   */
>  .section #mme9097_query_buffer_write
>     parm $r2
>     parm $r3
>     parm $r4
> -   parm $r5 maddr 0x16c2 /* QUERY_SEQUENCE */
> +   parm $r5 maddr 0x16c0 /* QUERY_ADDRESS_HIGH */
>     parm $r6
>     parm $r7
>     mov $r6 (sub $r7 $r6) /* actual - desired */
>     mov $r6 (sbb 0x0 0x0) /* if there was underflow, not reached yet */
> -   braz annul $r6 #qbw_ready
> -   exit
> +   parm $r7
> +   exit braz $r6 #qbw_ready
> +   parm $r6
>  qbw_ready:
>     mov $r2 (sub $r2 $r4)
>     braz $r1 #qbw_postclamp
> @@ -531,12 +534,19 @@ qbw_ready:
>  qbw_clamp:
>     mov $r2 $r1
>  qbw_postclamp:
> +   send $r7
> +   send $r6
>     send $r2
> +   branz $r1 #qbw_done
>     mov $r4 0x1000
> -   branz annul $r1 #qbw_done
>     send (extrinsrt 0x0 $r4 0x0 0x10 0x10)
> -   maddr 0x16c2 /* QUERY_SEQUENCE */
> +   maddr 0x16c0 /* QUERY_ADDRESS_HIGH */
> +   mov $r5 0x4
> +   mov $r6 (add $r6 $r5)
> +   mov $r7 (adc $r7 0x0)
> +   send $r7
> +   send $r6
>     send $r3
>  qbw_done:
>     exit send (extrinsrt 0x0 $r4 0x0 0x10 0x10)
> -   nop
> +   maddrsend 0x44
> diff --git a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
> index 1c8f4bb..9618da6 100644
> --- a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
> +++ b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
> @@ -336,18 +336,19 @@ uint32_t mme9097_draw_arrays_indirect_count[] = {
>  uint32_t mme9097_query_buffer_write[] = {
>  	0x00000201,
>  	0x00000301,
> -/* 0x000a: qbw_ready */
> +/* 0x000b: qbw_ready */
>  	0x00000401,
> -	0x05b08551,
> -/* 0x0011: qbw_clamp */
> -/* 0x0012: qbw_postclamp */
> +	0x05b00551,
> +/* 0x0012: qbw_clamp */
> +/* 0x0013: qbw_postclamp */
>  	0x00000601,
>  	0x00000701,
> -/* 0x0018: qbw_done */
>  	0x0005be10,
>  	0x00060610,
> -	0x0000b027,
> -	0x00000091,
> +/* 0x0020: qbw_done */
> +	0x00000701,
> +	0x0000b087,
> +	0x00000601,
>  	0x00051210,
>  	0x0001c807,
>  	0x00075b10,
> @@ -356,12 +357,19 @@ uint32_t mme9097_query_buffer_write[] = {
>  	0x00060410,
>  	0x0000a027,
>  	0x00000a11,
> +	0x00003841,
> +	0x00003041,
>  	0x00001041,
> +	0x00028817,
>  	0x04000411,
> -	0x00010837,
>  	0x84010042,
> -	0x05b08021,
> +	0x05b00021,
> +	0x00010511,
> +	0x00017610,
> +	0x00023f10,
> +	0x00003841,
> +	0x00003041,
>  	0x00001841,
>  	0x840100c2,
> -	0x00000011,
> +	0x00110071,
>  };
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c
> index ff20fe6..0991af8 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c
> @@ -406,10 +406,7 @@ nvc0_hw_get_query_result_resource(struct nvc0_context *nvc0,
>     nouveau_pushbuf_space(push, 32, 2, 0);
>     PUSH_REFN (push, hq->bo, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
>     PUSH_REFN (push, buf->bo, buf->domain | NOUVEAU_BO_WR);
> -   BEGIN_NVC0(push, NVC0_3D(QUERY_ADDRESS_HIGH), 2);
> -   PUSH_DATAh(push, buf->address + offset);
> -   PUSH_DATA (push, buf->address + offset);
> -   BEGIN_1IC0(push, NVC0_3D(MACRO_QUERY_BUFFER_WRITE), 7);
> +   BEGIN_1IC0(push, NVC0_3D(MACRO_QUERY_BUFFER_WRITE), 9);
>     if (q->type == PIPE_QUERY_OCCLUSION_PREDICATE) /* XXX what if 64-bit? */

What about that comment? Maybe you should remove it?

I would recommend you to run some query tests from piglit however. :)

>        PUSH_DATA(push, 0x00000001);
>     else if (result_type == PIPE_QUERY_TYPE_I32)
> @@ -468,6 +465,8 @@ nvc0_hw_get_query_result_resource(struct nvc0_context *nvc0,
>        nouveau_pushbuf_data(push, hq->bo, hq->offset,
>                             4 | NVC0_IB_ENTRY_1_NO_PREFETCH);
>     }
> +   PUSH_DATAh(push, buf->address + offset);
> +   PUSH_DATA (push, buf->address + offset);
>
>     if (buf->mm) {
>        nouveau_fence_ref(nvc0->screen->base.fence.current, &buf->fence);
>


More information about the mesa-dev mailing list