nvc0: fix 64-bit integer query buffer writes
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 17 Sep 2016 22:23:49 +0000 (18:23 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 12 Feb 2017 01:25:26 +0000 (20:25 -0500)
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@alum.mit.edu>
src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c

index 11c20564c362802660474bf7b2cba601db07c87b..7c5ec8f52b9fcf72e7c2dd26cf25f6c02a67de1d 100644 (file)
@@ -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
index 1c8f4bbf2730742086fe59d9acd2432b24293ba6..9618da6e28ccf19589624dd64cecaf0cc7b8f632 100644 (file)
@@ -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,
 };
index ff20fe6355bfa1bdb3068b49281b39ad3bd5c0eb..0991af872bed75dfddee0477ecce0609cb77eee8 100644 (file)
@@ -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? */
       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);