From: Marek Olšák Date: Mon, 27 Jan 2014 20:46:21 +0000 (+0100) Subject: r300g,r600g,radeonsi: add support for ARB_buffer_storage X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6381dd7e9dd22987df21624965cc82cbeec237a3;p=mesa.git r300g,r600g,radeonsi: add support for ARB_buffer_storage All GTT memory mappings are coherent and therefore can be persistent. Reviewed-by: Fredrik Höglund --- diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 26d73e47ccd..0977d3920a3 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -106,6 +106,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_USER_INDEX_BUFFERS: case PIPE_CAP_USER_CONSTANT_BUFFERS: case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER: + case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT: return 1; case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 048672c5f61..5472263781e 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -2129,6 +2129,10 @@ static void r300_texture_barrier(struct pipe_context *pipe) r300_mark_atom_dirty(r300, &r300->texture_cache_inval); } +static void r300_memory_barrier(struct pipe_context *pipe, unsigned flags) +{ +} + void r300_init_state_functions(struct r300_context* r300) { r300->context.create_blend_state = r300_create_blend_state; @@ -2189,4 +2193,5 @@ void r300_init_state_functions(struct r300_context* r300) r300->context.delete_vs_state = r300_delete_vs_state; r300->context.texture_barrier = r300_texture_barrier; + r300->context.memory_barrier = r300_memory_barrier; } diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 630e21d3484..f2782e6baa0 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -355,6 +355,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER: case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_TEXTURE_MULTISAMPLE: + case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT: return 1; case PIPE_CAP_TGSI_TEXCOORD: diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c index e75b3371f59..340ebb2bcd5 100644 --- a/src/gallium/drivers/radeon/r600_buffer_common.c +++ b/src/gallium/drivers/radeon/r600_buffer_common.c @@ -122,6 +122,14 @@ bool r600_init_resource(struct r600_common_screen *rscreen, break; } + /* Use GTT for all persistent mappings, because they are + * always cached and coherent. */ + if (res->b.b.target == PIPE_BUFFER && + res->b.b.flags & (PIPE_RESOURCE_FLAG_MAP_PERSISTENT | + PIPE_RESOURCE_FLAG_MAP_COHERENT)) { + res->domains = RADEON_DOMAIN_GTT; + } + /* Tiled textures are unmappable. Always put them in VRAM. */ if (res->b.b.target != PIPE_BUFFER && rtex->surface.level[0].mode >= RADEON_SURF_MODE_1D) { diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index dbca157f04a..f38e333ebd3 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -39,6 +39,10 @@ * pipe_context */ +static void r600_memory_barrier(struct pipe_context *ctx, unsigned flags) +{ +} + bool r600_common_context_init(struct r600_common_context *rctx, struct r600_common_screen *rscreen) { @@ -56,6 +60,7 @@ bool r600_common_context_init(struct r600_common_context *rctx, rctx->b.transfer_flush_region = u_default_transfer_flush_region; rctx->b.transfer_unmap = u_transfer_unmap_vtbl; rctx->b.transfer_inline_write = u_default_transfer_inline_write; + rctx->b.memory_barrier = r600_memory_barrier; r600_streamout_init(rctx); r600_query_init(rctx); diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index c69be584c2f..ff11a67b7b1 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -252,6 +252,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: case PIPE_CAP_TGSI_VS_LAYER: case PIPE_CAP_QUERY_PIPELINE_STATISTICS: + case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT: return 1; case PIPE_CAP_TEXTURE_MULTISAMPLE: