summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-01-02 00:06:22 -0500
committerIlia Mirkin <[email protected]>2016-01-07 18:38:46 -0500
commitd3e43baffe06d8375b63cf8009410391f4900e05 (patch)
treebc54186b92bbb0da3988f769eced2cd63729bc0b
parent2860f20859454b38ce44e4e3377c036e67c20ae7 (diff)
nvc0: adjust indirect draw macros to handle multiple draws at once
These are still invoked one at a time, but the underlying macro can handle multiple draws. Signed-off-by: Ilia Mirkin <[email protected]>
-rw-r--r--src/gallium/drivers/nouveau/nvc0/mme/com9097.mme75
-rw-r--r--src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h58
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c20
3 files changed, 101 insertions, 52 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
index 8c647d0c66c..35355edf2e7 100644
--- a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
+++ b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
@@ -230,29 +230,43 @@ locn_0f_ts:
* Forcefully sets VERTEX_ID_BASE to the value of VB_ELEMENT_BASE.
*
* arg = mode
- * parm[0] = count
- * parm[1] = instance_count
- * parm[2] = start
- * parm[3] = index_bias
- * parm[4] = start_instance
+ * parm[0] = start_drawid
+ * parm[1] = numparams
+ * parm[2 + 5n + 0] = count
+ * parm[2 + 5n + 1] = instance_count
+ * parm[2 + 5n + 2] = start
+ * parm[2 + 5n + 3] = index_bias
+ * parm[2 + 5n + 4] = start_instance
+ *
+ * SCRATCH[0] = saved VB_ELEMENT_BASE
+ * SCRATCH[1] = saved VB_INSTANCE_BASE
*/
.section #mme9097_draw_elts_indirect
+ read $r6 0x50d /* VB_ELEMENT_BASE */
+ read $r7 0x50e /* VB_INSTANCE_BASE */
+ maddr 0x1d00
+ send $r6 /* SCRATCH[0] = VB_ELEMENT_BASE */
+ send $r7 /* SCRATCH[1] = VB_INSTANCE_BASE */
+ parm $r6 /* start_drawid */
+ parm $r7 /* numparams */
+dei_draw_again:
parm $r3 /* count */
parm $r2 /* instance_count */
parm $r4 maddr 0x5f7 /* INDEX_BATCH_FIRST, start */
parm $r4 send $r4 /* index_bias, send start */
- maddr 0x8e4 /* CB_DATA */
+ maddr 0x18e3 /* CB_POS */
+ send 0x180 /* 256 + 128 */
braz $r2 #dei_end
parm $r5 send $r4 /* start_instance, send index_bias */
send $r5 /* send start_instance */
- read $r6 0x50d /* VB_ELEMENT_BASE */
- read $r7 0x50e /* VB_INSTANCE_BASE */
+ send $r6 /* draw id */
maddr 0x150d /* VB_ELEMENT,INSTANCE_BASE */
send $r4
send $r5
maddr 0x446
send $r4
mov $r4 0x1
+ mov $r1 (extrinsrt $r1 0x0 0 1 26) /* clear INSTANCE_NEXT */
dei_again:
maddr 0x586 /* VERTEX_BEGIN_GL */
send $r1 /* mode */
@@ -262,48 +276,61 @@ dei_again:
maddrsend 0x585 /* VERTEX_END_GL */
branz $r2 #dei_again
mov $r1 (extrinsrt $r1 $r4 0 1 26) /* set INSTANCE_NEXT */
+dei_end:
+ mov $r7 (add $r7 -1)
+ branz $r7 #dei_draw_again
+ mov $r6 (add $r6 1)
+ read $r6 0xd00
+ read $r7 0xd01
maddr 0x150d /* VB_ELEMENT,INSTANCE_BASE */
send $r6
send $r7
exit maddr 0x446
send $r6
-dei_end:
- exit
- nop
/* NVC0_3D_MACRO_DRAW_ARRAYS_INDIRECT:
*
* NOTE: Saves and restores VB_INSTANCE_BASE.
*
* arg = mode
- * parm[0] = count
- * parm[1] = instance_count
- * parm[2] = start
- * parm[3] = start_instance
+ * parm[0] = start_drawid
+ * parm[1] = numparams
+ * parm[2 + 4n + 0] = count
+ * parm[2 + 4n + 1] = instance_count
+ * parm[2 + 4n + 2] = start
+ * parm[2 + 4n + 3] = start_instance
*/
.section #mme9097_draw_arrays_indirect
+ read $r5 0x50e /* VB_INSTANCE_BASE */
+ parm $r6 /* start_drawid */
+ parm $r7 /* numparams */
+dai_draw_again:
parm $r2 /* count */
parm $r3 /* instance_count */
parm $r4 maddr 0x35d /* VERTEX_BUFFER_FIRST, start */
braz $r3 #dai_end
parm $r4 send $r4 /* start_instance */
- maddrsend 0x8e4 /* CB_DATA, send 0 as base_vertex */
+ maddr 0x18e3 /* CB_POS */
+ send 0x180 /* 256 + 128 */
+ send 0x0 /* send 0 as base_vertex */
send $r4 /* send start_instance */
- read $r6 0x50e /* VB_INSTANCE_BASE */
+ send $r6 /* draw id */
maddr 0x50e /* VB_INSTANCE_BASE */
- mov $r5 0x1
send $r4
+ mov $r4 0x1
+ mov $r1 (extrinsrt $r1 0x0 0 1 26) /* clear INSTANCE_NEXT */
dai_again:
maddr 0x586 /* VERTEX_BEGIN_GL */
send $r1 /* mode */
maddr 0x35e /* VERTEX_BUFFER_COUNT */
send $r2
- mov $r3 (sub $r3 $r5)
+ mov $r3 (sub $r3 $r4)
maddrsend 0x585 /* VERTEX_END_GL */
branz $r3 #dai_again
- mov $r1 (extrinsrt $r1 $r5 0 1 26) /* set INSTANCE_NEXT */
- exit maddr 0x50e /* VB_INSTANCE_BASE to restore */
- send $r6
+ mov $r1 (extrinsrt $r1 $r4 0 1 26) /* set INSTANCE_NEXT */
dai_end:
- exit
- nop
+ mov $r7 (add $r7 -1)
+ branz $r7 #dai_draw_again
+ mov $r6 (add $r6 1)
+ exit maddr 0x50e /* VB_INSTANCE_BASE to restore */
+ send $r5
diff --git a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
index acad303ce60..0aebeeb6e66 100644
--- a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
+++ b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
@@ -125,24 +125,33 @@ uint32_t mme9097_tep_select[] = {
};
uint32_t mme9097_draw_elts_indirect[] = {
+ 0x01434615,
+/* 0x0007: dei_draw_again */
+ 0x01438715,
+ 0x07400021,
+ 0x00003041,
+ 0x00003841,
+ 0x00000601,
+/* 0x0018: dei_again */
+ 0x00000701,
0x00000301,
+/* 0x0020: dei_end */
0x00000201,
0x017dc451,
0x00002431,
-/* 0x0010: dei_again */
- 0x02390021,
- 0x00061007,
+ 0x0638c021,
+ 0x00600041,
+ 0x0004d007,
0x00002531,
-/* 0x001d: dei_end */
0x00002841,
- 0x01434615,
- 0x01438715,
+ 0x00003041,
0x05434021,
0x00002041,
0x00002841,
0x01118021,
0x00002041,
0x00004411,
+ 0xd0400912,
0x01618021,
0x00000841,
0x017e0021,
@@ -151,39 +160,50 @@ uint32_t mme9097_draw_elts_indirect[] = {
0x01614071,
0xfffe9017,
0xd0410912,
+ 0xffffff11,
+ 0xfff9b817,
+ 0x00007611,
+ 0x03400615,
+ 0x03404715,
0x05434021,
0x00003041,
0x00003841,
0x011180a1,
0x00003041,
- 0x00000091,
- 0x00000011,
};
uint32_t mme9097_draw_arrays_indirect[] = {
+/* 0x0003: dai_draw_again */
+ 0x01438515,
+ 0x00000601,
+ 0x00000701,
0x00000201,
+/* 0x0011: dai_again */
0x00000301,
-/* 0x000b: dai_again */
0x00d74451,
- 0x00049807,
+/* 0x0019: dai_end */
+ 0x0004d807,
0x00002431,
-/* 0x0015: dai_end */
- 0x02390071,
+ 0x0638c021,
+ 0x00600041,
+ 0x00000041,
0x00002041,
- 0x01438615,
+ 0x00003041,
0x01438021,
- 0x00004511,
0x00002041,
+ 0x00004411,
+ 0xd0400912,
0x01618021,
0x00000841,
0x00d78021,
0x00001041,
- 0x00055b10,
+ 0x00051b10,
0x01614071,
0xfffe9817,
- 0xd0414912,
+ 0xd0410912,
+ 0xffffff11,
+ 0xfffa7817,
+ 0x00007611,
0x014380a1,
- 0x00003041,
- 0x00000091,
- 0x00000011,
+ 0x00002841,
};
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
index 251753357eb..55aeb806288 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
@@ -819,8 +819,6 @@ nvc0_draw_indirect(struct nvc0_context *nvc0, const struct pipe_draw_info *info)
PUSH_DATA (push, 512);
PUSH_DATAh(push, nvc0->screen->uniform_bo->offset + (5 << 16) + (0 << 9));
PUSH_DATA (push, nvc0->screen->uniform_bo->offset + (5 << 16) + (0 << 9));
- BEGIN_NVC0(push, NVC0_3D(CB_POS), 1);
- PUSH_DATA (push, 256 + 128);
nouveau_pushbuf_space(push, 8, 0, 1);
PUSH_REFN(push, buf->bo, NOUVEAU_BO_RD | buf->domain);
@@ -828,7 +826,7 @@ nvc0_draw_indirect(struct nvc0_context *nvc0, const struct pipe_draw_info *info)
assert(nvc0->idxbuf.buffer);
assert(nouveau_resource_mapped_by_gpu(nvc0->idxbuf.buffer));
size = 5 * 4;
- BEGIN_1IC0(push, NVC0_3D(MACRO_DRAW_ELEMENTS_INDIRECT), 1 + size / 4);
+ BEGIN_1IC0(push, NVC0_3D(MACRO_DRAW_ELEMENTS_INDIRECT), 3 + size / 4);
} else {
if (nvc0->state.index_bias) {
/* index_bias is implied 0 if !info->indexed (really ?) */
@@ -837,9 +835,11 @@ nvc0_draw_indirect(struct nvc0_context *nvc0, const struct pipe_draw_info *info)
nvc0->state.index_bias = 0;
}
size = 4 * 4;
- BEGIN_1IC0(push, NVC0_3D(MACRO_DRAW_ARRAYS_INDIRECT), 1 + size / 4);
+ BEGIN_1IC0(push, NVC0_3D(MACRO_DRAW_ARRAYS_INDIRECT), 3 + size / 4);
}
PUSH_DATA(push, nvc0_prim_gl(info->mode));
+ PUSH_DATA(push, info->drawid);
+ PUSH_DATA(push, 1);
#define NVC0_IB_ENTRY_1_NO_PREFETCH (1 << (31 - 8))
nouveau_pushbuf_data(push,
buf->bo, offset, NVC0_IB_ENTRY_1_NO_PREFETCH | size);
@@ -913,11 +913,13 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
PUSH_DATA (push, 512);
PUSH_DATAh(push, nvc0->screen->uniform_bo->offset + (5 << 16) + (0 << 9));
PUSH_DATA (push, nvc0->screen->uniform_bo->offset + (5 << 16) + (0 << 9));
- BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 3);
- PUSH_DATA (push, 256 + 128);
- PUSH_DATA (push, info->index_bias);
- PUSH_DATA (push, info->start_instance);
- PUSH_DATA (push, info->drawid);
+ if (!info->indirect) {
+ BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 3);
+ PUSH_DATA (push, 256 + 128);
+ PUSH_DATA (push, info->index_bias);
+ PUSH_DATA (push, info->start_instance);
+ PUSH_DATA (push, info->drawid);
+ }
}
push->kick_notify = nvc0_draw_vbo_kick_notify;