diff options
author | Marek Olšák <[email protected]> | 2017-04-02 14:30:16 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-05-10 19:00:16 +0200 |
commit | c24c3b94ed29ecd99b1101c74c6c4606f9b5580e (patch) | |
tree | 81f6966bc59a68d9867693c65d35fae9bb1d9819 /src/gallium/drivers/svga | |
parent | fe437882ea2d60e91c244cc95beb4b79c615af49 (diff) |
gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r-- | src/gallium/drivers/svga/svga_draw.c | 18 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_pipe_vertex.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_state_vdecl.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_swtnl_backend.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_swtnl_draw.c | 6 |
5 files changed, 17 insertions, 21 deletions
diff --git a/src/gallium/drivers/svga/svga_draw.c b/src/gallium/drivers/svga/svga_draw.c index 6de233888f6..6a89e661dd7 100644 --- a/src/gallium/drivers/svga/svga_draw.c +++ b/src/gallium/drivers/svga/svga_draw.c @@ -74,7 +74,7 @@ svga_hwtnl_destroy(struct svga_hwtnl *hwtnl) } for (i = 0; i < hwtnl->cmd.vbuf_count; i++) - pipe_resource_reference(&hwtnl->cmd.vbufs[i].buffer, NULL); + pipe_vertex_buffer_unreference(&hwtnl->cmd.vbufs[i]); for (i = 0; i < hwtnl->cmd.prim_count; i++) pipe_resource_reference(&hwtnl->cmd.prim_ib[i], NULL); @@ -139,16 +139,12 @@ svga_hwtnl_vertex_buffers(struct svga_hwtnl *hwtnl, unsigned i; for (i = 0; i < count; i++) { - pipe_resource_reference(&dst[i].buffer, src[i].buffer); - dst[i].user_buffer = src[i].user_buffer; - dst[i].stride = src[i].stride; - dst[i].buffer_offset = src[i].buffer_offset; + pipe_vertex_buffer_reference(&dst[i], &src[i]); } /* release old buffer references */ for ( ; i < hwtnl->cmd.vbuf_count; i++) { - pipe_resource_reference(&dst[i].buffer, NULL); - dst[i].user_buffer = NULL; /* just to be safe */ + pipe_vertex_buffer_unreference(&dst[i]); /* don't bother zeroing stride/offset fields */ } @@ -175,7 +171,7 @@ svga_hwtnl_is_buffer_referred(struct svga_hwtnl *hwtnl, } for (i = 0; i < hwtnl->cmd.vbuf_count; ++i) { - if (hwtnl->cmd.vbufs[i].buffer == buffer) { + if (hwtnl->cmd.vbufs[i].buffer.resource == buffer) { return TRUE; } } @@ -205,7 +201,7 @@ draw_vgpu9(struct svga_hwtnl *hwtnl) for (i = 0; i < hwtnl->cmd.vdecl_count; i++) { unsigned j = hwtnl->cmd.vdecl_buffer_index[i]; - handle = svga_buffer_handle(svga, hwtnl->cmd.vbufs[j].buffer); + handle = svga_buffer_handle(svga, hwtnl->cmd.vbufs[j].buffer.resource); if (!handle) return PIPE_ERROR_OUT_OF_MEMORY; @@ -526,7 +522,7 @@ draw_vgpu10(struct svga_hwtnl *hwtnl, /* Get handle for each referenced vertex buffer */ for (i = 0; i < vbuf_count; i++) { - struct svga_buffer *sbuf = svga_buffer(hwtnl->cmd.vbufs[i].buffer); + struct svga_buffer *sbuf = svga_buffer(hwtnl->cmd.vbufs[i].buffer.resource); if (sbuf) { assert(sbuf->key.flags & SVGA3D_SURFACE_BIND_VERTEX_BUFFER); @@ -800,7 +796,7 @@ check_draw_params(struct svga_hwtnl *hwtnl, for (i = 0; i < hwtnl->cmd.vdecl_count; i++) { unsigned j = hwtnl->cmd.vdecl_buffer_index[i]; const struct pipe_vertex_buffer *vb = &hwtnl->cmd.vbufs[j]; - unsigned size = vb->buffer ? vb->buffer->width0 : 0; + unsigned size = vb->buffer.resource ? vb->buffer.resource->width0 : 0; unsigned offset = hwtnl->cmd.vdecl[i].array.offset; unsigned stride = hwtnl->cmd.vdecl[i].array.stride; int index_bias = (int) range->indexBias + hwtnl->index_bias; diff --git a/src/gallium/drivers/svga/svga_pipe_vertex.c b/src/gallium/drivers/svga/svga_pipe_vertex.c index 4b3f5d82e8c..5243ae613ee 100644 --- a/src/gallium/drivers/svga/svga_pipe_vertex.c +++ b/src/gallium/drivers/svga/svga_pipe_vertex.c @@ -328,7 +328,7 @@ void svga_cleanup_vertex_state( struct svga_context *svga ) unsigned i; for (i = 0 ; i < svga->curr.num_vertex_buffers; i++) - pipe_resource_reference(&svga->curr.vb[i].buffer, NULL); + pipe_vertex_buffer_unreference(&svga->curr.vb[i]); pipe_resource_reference(&svga->state.hw_draw.ib, NULL); diff --git a/src/gallium/drivers/svga/svga_state_vdecl.c b/src/gallium/drivers/svga/svga_state_vdecl.c index e1b6a1c2a44..fd6a238ef16 100644 --- a/src/gallium/drivers/svga/svga_state_vdecl.c +++ b/src/gallium/drivers/svga/svga_state_vdecl.c @@ -73,10 +73,10 @@ emit_hw_vs_vdecl(struct svga_context *svga, unsigned dirty) unsigned int offset = vb->buffer_offset + ve[i].src_offset; unsigned tmp_neg_bias = 0; - if (!vb->buffer) + if (!vb->buffer.resource) continue; - buffer = svga_buffer(vb->buffer); + buffer = svga_buffer(vb->buffer.resource); if (buffer->uploaded.start > offset) { tmp_neg_bias = buffer->uploaded.start - offset; if (vb->stride) @@ -91,10 +91,10 @@ emit_hw_vs_vdecl(struct svga_context *svga, unsigned dirty) unsigned usage, index; struct svga_buffer *buffer; - if (!vb->buffer) + if (!vb->buffer.resource) continue; - buffer = svga_buffer(vb->buffer); + buffer = svga_buffer(vb->buffer.resource); svga_generate_vdecl_semantics( i, &usage, &index ); /* SVGA_NEW_VELEMENT diff --git a/src/gallium/drivers/svga/svga_swtnl_backend.c b/src/gallium/drivers/svga/svga_swtnl_backend.c index 576fd853e7f..51be4846183 100644 --- a/src/gallium/drivers/svga/svga_swtnl_backend.c +++ b/src/gallium/drivers/svga/svga_swtnl_backend.c @@ -245,10 +245,10 @@ svga_vbuf_submit_state( struct svga_vbuf_render *svga_render ) /* Specify the vertex buffer (there's only ever one) */ { struct pipe_vertex_buffer vb; - vb.buffer = svga_render->vbuf; + vb.is_user_buffer = false; + vb.buffer.resource = svga_render->vbuf; vb.buffer_offset = svga_render->vdecl_offset; vb.stride = vdecl[0].array.stride; - vb.user_buffer = NULL; svga_hwtnl_vertex_buffers(svga->hwtnl, 1, &vb); } diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c index 24b4f5cdc28..76d128d3ced 100644 --- a/src/gallium/drivers/svga/svga_swtnl_draw.c +++ b/src/gallium/drivers/svga/svga_swtnl_draw.c @@ -70,9 +70,9 @@ svga_swtnl_draw_vbo(struct svga_context *svga, * Map vertex buffers */ for (i = 0; i < svga->curr.num_vertex_buffers; i++) { - if (svga->curr.vb[i].buffer) { + if (svga->curr.vb[i].buffer.resource) { map = pipe_buffer_map(&svga->pipe, - svga->curr.vb[i].buffer, + svga->curr.vb[i].buffer.resource, PIPE_TRANSFER_READ, &vb_transfer[i]); @@ -120,7 +120,7 @@ svga_swtnl_draw_vbo(struct svga_context *svga, * unmap vertex/index buffers */ for (i = 0; i < svga->curr.num_vertex_buffers; i++) { - if (svga->curr.vb[i].buffer) { + if (svga->curr.vb[i].buffer.resource) { pipe_buffer_unmap(&svga->pipe, vb_transfer[i]); draw_set_mapped_vertex_buffer(draw, i, NULL, 0); } |