aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-12-09 00:02:46 +0100
committerMarek Olšák <[email protected]>2012-12-12 13:09:54 +0100
commit448cd5ea60403576c3eec86ffb2b892e78b9dfe0 (patch)
tree395a69bf618864ee3af1263a5531fea7a3c64f01
parent1d0bf69f831e138a05a282e59746f20141046fd6 (diff)
winsys/radeon: don't use BIND flags, add a flag for the cache bufmgr instead
-rw-r--r--src/gallium/drivers/r300/r300_flush.c3
-rw-r--r--src/gallium/drivers/r300/r300_query.c4
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.c12
-rw-r--r--src/gallium/drivers/r300/r300_texture.c4
-rw-r--r--src/gallium/drivers/r600/r600_buffer.c10
-rw-r--r--src/gallium/drivers/r600/r600_pipe.h2
-rw-r--r--src/gallium/drivers/r600/r600_texture.c2
-rw-r--r--src/gallium/drivers/radeonsi/r600_buffer.c8
-rw-r--r--src/gallium/drivers/radeonsi/r600_texture.c2
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_pipe.h2
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_bo.c5
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_winsys.h4
12 files changed, 30 insertions, 28 deletions
diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c
index 732529a317e..2170c591f99 100644
--- a/src/gallium/drivers/r300/r300_flush.c
+++ b/src/gallium/drivers/r300/r300_flush.c
@@ -79,8 +79,7 @@ void r300_flush(struct pipe_context *pipe,
if (rfence) {
/* Create a fence, which is a dummy BO. */
- *rfence = r300->rws->buffer_create(r300->rws, 1, 1,
- PIPE_BIND_CUSTOM,
+ *rfence = r300->rws->buffer_create(r300->rws, 1, 1, TRUE,
RADEON_DOMAIN_GTT);
/* Add the fence as a dummy relocation. */
r300->rws->cs_add_reloc(r300->cs,
diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
index 3ea6be7ef57..4443362d102 100644
--- a/src/gallium/drivers/r300/r300_query.c
+++ b/src/gallium/drivers/r300/r300_query.c
@@ -57,8 +57,8 @@ static struct pipe_query *r300_create_query(struct pipe_context *pipe,
else
q->num_pipes = r300screen->info.r300_num_gb_pipes;
- q->buf = r300->rws->buffer_create(r300->rws, 4096, 4096,
- PIPE_BIND_CUSTOM, RADEON_DOMAIN_GTT);
+ q->buf = r300->rws->buffer_create(r300->rws, 4096, 4096, TRUE,
+ RADEON_DOMAIN_GTT);
if (!q->buf) {
FREE(q);
return NULL;
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index c92ec56507c..0c1e69b7a4c 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -101,9 +101,9 @@ r300_buffer_transfer_map( struct pipe_context *context,
struct pb_buffer *new_buf;
/* Create a new one in the same pipe_resource. */
- new_buf = r300->rws->buffer_create(r300->rws,
- rbuf->b.b.width0, R300_BUFFER_ALIGNMENT,
- rbuf->b.b.bind, rbuf->domain);
+ new_buf = r300->rws->buffer_create(r300->rws, rbuf->b.b.width0,
+ R300_BUFFER_ALIGNMENT, TRUE,
+ rbuf->domain);
if (new_buf) {
/* Discard the old buffer. */
pb_reference(&rbuf->buf, NULL);
@@ -181,9 +181,9 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
}
rbuf->buf =
- r300screen->rws->buffer_create(r300screen->rws,
- rbuf->b.b.width0, R300_BUFFER_ALIGNMENT,
- rbuf->b.b.bind, rbuf->domain);
+ r300screen->rws->buffer_create(r300screen->rws, rbuf->b.b.width0,
+ R300_BUFFER_ALIGNMENT, TRUE,
+ rbuf->domain);
if (!rbuf->buf) {
FREE(rbuf);
return NULL;
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 6197cf719ef..568558f0adb 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -997,8 +997,8 @@ r300_texture_create_object(struct r300_screen *rscreen,
/* Create the backing buffer if needed. */
if (!tex->buf) {
- tex->buf = rws->buffer_create(rws, tex->tex.size_in_bytes, 2048,
- base->bind, tex->domain);
+ tex->buf = rws->buffer_create(rws, tex->tex.size_in_bytes, 2048, TRUE,
+ tex->domain);
if (!tex->buf) {
goto fail;
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c
index 3b8d227bd38..9e2cf6650ad 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -112,7 +112,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx,
/* Create a new one in the same pipe_resource. */
/* XXX We probably want a different alignment for buffers and textures. */
r600_init_resource(rctx->screen, rbuffer, rbuffer->b.b.width0, 4096,
- rbuffer->b.b.bind, rbuffer->b.b.usage);
+ TRUE, rbuffer->b.b.usage);
/* We changed the buffer, now we need to bind it where the old one was bound. */
/* Vertex buffers. */
@@ -203,7 +203,7 @@ static const struct u_resource_vtbl r600_buffer_vtbl =
bool r600_init_resource(struct r600_screen *rscreen,
struct r600_resource *res,
unsigned size, unsigned alignment,
- unsigned bind, unsigned usage)
+ bool use_reusable_pool, unsigned usage)
{
uint32_t initial_domain, domains;
@@ -234,7 +234,9 @@ bool r600_init_resource(struct r600_screen *rscreen,
break;
}
- res->buf = rscreen->ws->buffer_create(rscreen->ws, size, alignment, bind, initial_domain);
+ res->buf = rscreen->ws->buffer_create(rscreen->ws, size, alignment,
+ use_reusable_pool,
+ initial_domain);
if (!res->buf) {
return false;
}
@@ -258,7 +260,7 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
rbuffer->b.b.screen = screen;
rbuffer->b.vtbl = &r600_buffer_vtbl;
- if (!r600_init_resource(rscreen, rbuffer, templ->width0, alignment, templ->bind, templ->usage)) {
+ if (!r600_init_resource(rscreen, rbuffer, templ->width0, alignment, TRUE, templ->usage)) {
FREE(rbuffer);
return NULL;
}
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 219bd54304a..a61a6e8c082 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -591,7 +591,7 @@ void r600_decompress_color_textures(struct r600_context *rctx,
bool r600_init_resource(struct r600_screen *rscreen,
struct r600_resource *res,
unsigned size, unsigned alignment,
- unsigned bind, unsigned usage);
+ bool use_reusable_pool, unsigned usage);
struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
const struct pipe_resource *templ,
unsigned alignment);
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index efff2c36297..56e9b64fc47 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -443,7 +443,7 @@ r600_texture_create_object(struct pipe_screen *screen,
unsigned base_align = rtex->surface.bo_alignment;
unsigned usage = R600_TEX_IS_TILED(rtex, 0) ? PIPE_USAGE_STATIC : base->usage;
- if (!r600_init_resource(rscreen, resource, rtex->size, base_align, base->bind, usage)) {
+ if (!r600_init_resource(rscreen, resource, rtex->size, base_align, FALSE, usage)) {
FREE(rtex);
return NULL;
}
diff --git a/src/gallium/drivers/radeonsi/r600_buffer.c b/src/gallium/drivers/radeonsi/r600_buffer.c
index 66bb4d5d914..0c33c1e162f 100644
--- a/src/gallium/drivers/radeonsi/r600_buffer.c
+++ b/src/gallium/drivers/radeonsi/r600_buffer.c
@@ -100,7 +100,7 @@ static const struct u_resource_vtbl r600_buffer_vtbl =
bool si_init_resource(struct r600_screen *rscreen,
struct si_resource *res,
unsigned size, unsigned alignment,
- unsigned bind, unsigned usage)
+ boolean use_reusable_pool, unsigned usage)
{
uint32_t initial_domain, domains;
@@ -129,7 +129,9 @@ bool si_init_resource(struct r600_screen *rscreen,
}
}
- res->buf = rscreen->ws->buffer_create(rscreen->ws, size, alignment, bind, initial_domain);
+ res->buf = rscreen->ws->buffer_create(rscreen->ws, size, alignment,
+ use_reusable_pool,
+ initial_domain);
if (!res->buf) {
return false;
}
@@ -154,7 +156,7 @@ struct pipe_resource *si_buffer_create(struct pipe_screen *screen,
rbuffer->b.b.screen = screen;
rbuffer->b.vtbl = &r600_buffer_vtbl;
- if (!si_init_resource(rscreen, rbuffer, templ->width0, alignment, templ->bind, templ->usage)) {
+ if (!si_init_resource(rscreen, rbuffer, templ->width0, alignment, TRUE, templ->usage)) {
FREE(rbuffer);
return NULL;
}
diff --git a/src/gallium/drivers/radeonsi/r600_texture.c b/src/gallium/drivers/radeonsi/r600_texture.c
index fdfc8f3fa28..de46640d7e4 100644
--- a/src/gallium/drivers/radeonsi/r600_texture.c
+++ b/src/gallium/drivers/radeonsi/r600_texture.c
@@ -500,7 +500,7 @@ r600_texture_create_object(struct pipe_screen *screen,
unsigned size = rtex->surface.bo_size;
base_align = rtex->surface.bo_alignment;
- if (!si_init_resource(rscreen, resource, size, base_align, base->bind, base->usage)) {
+ if (!si_init_resource(rscreen, resource, size, base_align, FALSE, base->usage)) {
FREE(rtex);
return NULL;
}
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index 1ccf95274dc..29e8960c9b1 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -194,7 +194,7 @@ void si_flush_depth_textures(struct r600_context *rctx);
bool si_init_resource(struct r600_screen *rscreen,
struct si_resource *res,
unsigned size, unsigned alignment,
- unsigned bind, unsigned usage);
+ boolean use_reusable_pool, unsigned usage);
struct pipe_resource *si_buffer_create(struct pipe_screen *screen,
const struct pipe_resource *templ);
void r600_upload_index_buffer(struct r600_context *rctx,
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index 090a6faf50d..07e92c591b5 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -813,7 +813,7 @@ static struct pb_buffer *
radeon_winsys_bo_create(struct radeon_winsys *rws,
unsigned size,
unsigned alignment,
- unsigned bind,
+ boolean use_reusable_pool,
enum radeon_bo_domain domain)
{
struct radeon_drm_winsys *ws = radeon_drm_winsys(rws);
@@ -829,8 +829,7 @@ radeon_winsys_bo_create(struct radeon_winsys *rws,
desc.initial_domains = domain;
/* Assign a buffer manager. */
- if (bind & (PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER |
- PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_CUSTOM))
+ if (use_reusable_pool)
provider = ws->cman;
else
provider = ws->kman;
diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h
index 8e4693be92a..b7eac3cfc1b 100644
--- a/src/gallium/winsys/radeon/drm/radeon_winsys.h
+++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h
@@ -142,14 +142,14 @@ struct radeon_winsys {
* \param ws The winsys this function is called from.
* \param size The size to allocate.
* \param alignment An alignment of the buffer in memory.
- * \param bind A bitmask of the PIPE_BIND_* flags.
+ * \param use_reusable_pool Whether the cache buffer manager should be used.
* \param domain A bitmask of the RADEON_DOMAIN_* flags.
* \return The created buffer object.
*/
struct pb_buffer *(*buffer_create)(struct radeon_winsys *ws,
unsigned size,
unsigned alignment,
- unsigned bind,
+ boolean use_reusable_pool,
enum radeon_bo_domain domain);
struct radeon_winsys_cs_handle *(*buffer_get_cs_handle)(