diff options
author | Marek Olšák <[email protected]> | 2010-12-27 22:32:31 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-01-06 16:16:29 +0100 |
commit | 06286110b4fc0ff80ae21bb3d8ff9909db1f5d47 (patch) | |
tree | 9f2fbb63c1ea124ad6c84560b19f3ec999d5d8de /src/gallium/drivers | |
parent | 8b7bd3ce8875f5028bbf234d107f56d595a0d0b7 (diff) |
u_upload_mgr: new features
- Added a parameter to specify a minimum offset that should be returned.
r300g needs this to better implement user buffer uploads. This weird
requirement comes from the fact that the Radeon DRM doesn't support negative
offsets.
- Added a parameter to notify a driver that the upload flush occured.
A driver may skip buffer validation if there was no flush, resulting
in a better performance.
- Added a new upload function that returns a pointer to the upload buffer
directly, so that the buffer can be filled e.g. by the translate module.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/i965/brw_draw_upload.c | 12 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen_buffer.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_draw_elements.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_state_vdecl.c | 6 |
4 files changed, 23 insertions, 10 deletions
diff --git a/src/gallium/drivers/i965/brw_draw_upload.c b/src/gallium/drivers/i965/brw_draw_upload.c index ebeb1e146aa..cf9405470c8 100644 --- a/src/gallium/drivers/i965/brw_draw_upload.c +++ b/src/gallium/drivers/i965/brw_draw_upload.c @@ -89,13 +89,16 @@ static int brw_prepare_vertices(struct brw_context *brw) vb->buffer->width0 - vb->buffer_offset : MAX2(vb->buffer->width0 - vb->buffer_offset, vb->stride * (max_index + 1 - min_index))); + boolean flushed; - ret = u_upload_buffer( brw->vb.upload_vertex, + ret = u_upload_buffer( brw->vb.upload_vertex, + 0, vb->buffer_offset + min_index * vb->stride, size, vb->buffer, &offset, - &upload_buf ); + &upload_buf, + &flushed ); if (ret) return ret; @@ -251,13 +254,16 @@ static int brw_prepare_indices(struct brw_context *brw) /* Turn userbuffer into a proper hardware buffer? */ if (brw_buffer_is_user_buffer(index_buffer)) { + boolean flushed; ret = u_upload_buffer( brw->vb.upload_index, + 0, index_offset, ib_size, index_buffer, &offset, - &upload_buf ); + &upload_buf, + &flushed ); if (ret) return ret; diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c index f96998195af..11ad87ed89b 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.c +++ b/src/gallium/drivers/r300/r300_screen_buffer.c @@ -62,15 +62,16 @@ void r300_upload_index_buffer(struct r300_context *r300, unsigned count) { unsigned index_offset; + boolean flushed; uint8_t *ptr = r300_buffer(*index_buffer)->user_buffer; *index_buffer = NULL; u_upload_data(r300->upload_ib, - count * index_size, + 0, count * index_size, ptr + (*start * index_size), &index_offset, - index_buffer); + index_buffer, &flushed); *start = index_offset / index_size; } @@ -78,6 +79,7 @@ void r300_upload_index_buffer(struct r300_context *r300, void r300_upload_user_buffers(struct r300_context *r300) { int i, nr = r300->velems->count; + boolean flushed; for (i = 0; i < nr; i++) { struct pipe_vertex_buffer *vb = @@ -85,9 +87,9 @@ void r300_upload_user_buffers(struct r300_context *r300) if (r300_buffer_is_user_buffer(vb->buffer)) { u_upload_data(r300->upload_vb, - vb->buffer->width0, + 0, vb->buffer->width0, r300_buffer(vb->buffer)->user_buffer, - &vb->buffer_offset, &vb->buffer); + &vb->buffer_offset, &vb->buffer, &flushed); r300->validate_buffers = TRUE; r300->vertex_arrays_dirty = TRUE; diff --git a/src/gallium/drivers/svga/svga_draw_elements.c b/src/gallium/drivers/svga/svga_draw_elements.c index c7ea014bba5..83527c6ef49 100644 --- a/src/gallium/drivers/svga/svga_draw_elements.c +++ b/src/gallium/drivers/svga/svga_draw_elements.c @@ -120,14 +120,17 @@ svga_hwtnl_simple_draw_range_elements( struct svga_hwtnl *hwtnl, if (index_buffer && svga_buffer_is_user_buffer(index_buffer)) { + boolean flushed; assert( index_buffer->width0 >= index_offset + count * index_size ); ret = u_upload_buffer( hwtnl->upload_ib, + 0, index_offset, count * index_size, index_buffer, &index_offset, - &upload_buffer ); + &upload_buffer, + &flushed ); if (ret) goto done; diff --git a/src/gallium/drivers/svga/svga_state_vdecl.c b/src/gallium/drivers/svga/svga_state_vdecl.c index 3af7bf2b358..958d00393f2 100644 --- a/src/gallium/drivers/svga/svga_state_vdecl.c +++ b/src/gallium/drivers/svga/svga_state_vdecl.c @@ -57,12 +57,14 @@ upload_user_buffers( struct svga_context *svga ) struct svga_buffer *buffer = svga_buffer(svga->curr.vb[i].buffer); if (!buffer->uploaded.buffer) { + boolean flushed; ret = u_upload_buffer( svga->upload_vb, - 0, + 0, 0, buffer->b.b.width0, &buffer->b.b, &buffer->uploaded.offset, - &buffer->uploaded.buffer ); + &buffer->uploaded.buffer, + &flushed); if (ret) return ret; |