summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-02-16 15:43:51 +1000
committerBen Skeggs <bskeggs@redhat.com>2010-02-16 15:57:59 +1000
commit828f545274a6da9b5d05aa23ae31959b121c38a2 (patch)
treec324d076f82e9fd910fd3540bc4d52d5d0bbad60 /src/gallium
parentc6e63f3cc235b2d7b06664a493584671a2493045 (diff)
nv50: use hw idx buffers where we can
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_vbo.c33
2 files changed, 27 insertions, 8 deletions
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 8c4478e483..2232461b9b 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -134,7 +134,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
case NOUVEAU_CAP_HW_VTXBUF:
return 1;
case NOUVEAU_CAP_HW_IDXBUF:
- return 0;
+ return 1;
case PIPE_CAP_INDEP_BLEND_ENABLE:
return 1;
case PIPE_CAP_INDEP_BLEND_FUNC:
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index 7a2618d2a3..1c8ee0b9ad 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -673,8 +673,6 @@ nv50_draw_elements(struct pipe_context *pipe,
struct pipe_screen *pscreen = pipe->screen;
void *map;
- map = pipe_buffer_map(pscreen, indexBuffer, PIPE_BUFFER_USAGE_CPU_READ);
-
nv50_state_validate(nv50);
BEGIN_RING(chan, tesla, 0x142c, 1);
@@ -685,14 +683,35 @@ nv50_draw_elements(struct pipe_context *pipe,
BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
OUT_RING (chan, nv50_prim(mode));
- nv50_draw_elements_inline(nv50, map, indexSize, start, count);
+ if (!nv50->vbo_fifo && indexSize == 4) {
+ BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U32 | 0x30000, 0);
+ OUT_RING (chan, count);
+ nouveau_pushbuf_submit(chan, nouveau_bo(indexBuffer),
+ start << 2, count << 2);
+ } else
+ if (!nv50->vbo_fifo && indexSize == 2) {
+ unsigned vb_start = (start & ~1);
+ unsigned vb_end = (start + count + 1) & ~1;
+ unsigned dwords = (vb_end - vb_start) >> 1;
+
+ BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U16_SETUP, 1);
+ OUT_RING (chan, ((start & 1) << 31) | count);
+ BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U16 | 0x30000, 0);
+ OUT_RING (chan, dwords);
+ nouveau_pushbuf_submit(chan, nouveau_bo(indexBuffer),
+ vb_start << 1, dwords << 2);
+ BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U16_SETUP, 1);
+ OUT_RING (chan, 0);
+ } else {
+ map = pipe_buffer_map(pscreen, indexBuffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
+ nv50_draw_elements_inline(nv50, map, indexSize, start, count);
+ nv50_unmap_vbufs(nv50);
+ pipe_buffer_unmap(pscreen, indexBuffer);
+ }
BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
OUT_RING (chan, 0);
-
- nv50_unmap_vbufs(nv50);
-
- pipe_buffer_unmap(pscreen, indexBuffer);
}
static INLINE boolean