summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-04-08 23:19:53 +0200
committerMarek Olšák <[email protected]>2011-04-08 23:20:00 +0200
commitee678895e903f3ecbbd95b4584dbfbb127f9d4f0 (patch)
tree4f1bd593b863f85838ae253f6b8eced058ea58e6
parent69c71396c6e947cbdf878bacb655d472a11c7708 (diff)
Revert "r300g: handle DISCARD_WHOLE_RESOURCE for buffers"
This reverts commit 437c748bf5072d2bded77a00c74c51cdb8b510e5. The commit is wrong for several reasons. One of them is when we grab a new buffer, we should update all the states it is bound in, including all parallel contexts. I don't think this is even doable. The correct solution would be upload data via a temporary buffer and do resource_copy_region to the original one. https://bugs.freedesktop.org/show_bug.cgi?id=36088
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index 6c31c39b239..986ae384fbf 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -67,20 +67,6 @@ static void r300_buffer_destroy(struct pipe_screen *screen,
util_slab_free(&r300screen->pool_buffers, rbuf);
}
-static boolean r300_setup_new_winsys_buffer(struct r300_winsys_screen *rws,
- struct r300_resource *rbuf)
-{
- rbuf->buf = rws->buffer_create(rws,
- rbuf->b.b.b.width0, 16,
- rbuf->b.b.b.bind, rbuf->b.b.b.usage,
- rbuf->domain);
- if (!rbuf->buf)
- return FALSE;
-
- rbuf->cs_buf = rws->buffer_get_cs_handle(rbuf->buf);
- return TRUE;
-}
-
static struct pipe_transfer*
r300_buffer_get_transfer(struct pipe_context *context,
struct pipe_resource *resource,
@@ -128,16 +114,6 @@ r300_buffer_transfer_map( struct pipe_context *pipe,
if (rbuf->constant_buffer)
return (uint8_t *) rbuf->constant_buffer + transfer->box.x;
- /* Discard the whole resource if needed. */
- if (transfer->usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE &&
- (rws->cs_is_buffer_referenced(r300->cs, rbuf->cs_buf) ||
- rws->buffer_is_busy(rbuf->buf))) {
- r300_winsys_bo_reference(&rbuf->buf, NULL);
-
- r300_setup_new_winsys_buffer(rws, rbuf);
- assert(rbuf->buf);
- }
-
map = rws->buffer_map(rbuf->buf, r300->cs, transfer->usage);
if (map == NULL)
@@ -203,6 +179,7 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
{
struct r300_screen *r300screen = r300_screen(screen);
struct r300_resource *rbuf;
+ unsigned alignment = 16;
rbuf = util_slab_alloc(&r300screen->pool_buffers);
@@ -222,11 +199,19 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
return &rbuf->b.b.b;
}
- if (!r300_setup_new_winsys_buffer(r300screen->rws, rbuf)) {
+ rbuf->buf =
+ r300screen->rws->buffer_create(r300screen->rws,
+ rbuf->b.b.b.width0, alignment,
+ rbuf->b.b.b.bind, rbuf->b.b.b.usage,
+ rbuf->domain);
+ if (!rbuf->buf) {
util_slab_free(&r300screen->pool_buffers, rbuf);
return NULL;
}
+ rbuf->cs_buf =
+ r300screen->rws->buffer_get_cs_handle(rbuf->buf);
+
return &rbuf->b.b.b;
}