r300g,r600g,radeonsi: add support for ARB_buffer_storage
authorMarek Olšák <marek.olsak@amd.com>
Mon, 27 Jan 2014 20:46:21 +0000 (21:46 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 25 Feb 2014 15:05:41 +0000 (16:05 +0100)
All GTT memory mappings are coherent and therefore can be persistent.

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/radeon/r600_buffer_common.c
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/drivers/radeonsi/si_pipe.c

index 26d73e47ccdde735e1a0f60c6d53c80401e73ad7..0977d3920a3a17e71648005d6b761a46cb332f5d 100644 (file)
@@ -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:
index 048672c5f61496aa711bf95d945ba5f9a8bffd19..5472263781e099a36e293fc8fa3e87bb18295658 100644 (file)
@@ -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;
 }
index 630e21d3484b300647a8c0b8f50f22a7e98a8db8..f2782e6baa01eb0ec90c002294151c99d289e405 100644 (file)
@@ -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:
index e75b3371f592986b6f00d35aece6b1f2f7a2f703..340ebb2bcd50fea86d0add02c18be0176b684cc5 100644 (file)
@@ -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) {
index dbca157f04a5d9b76f97c1b873c720c5d1736e92..f38e333ebd34ce1889c8feb87c43898167a1655c 100644 (file)
  * 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);
index c69be584c2f567a5381fd2115aa0f34ac556e041..ff11a67b7b1734edb07f767d7f2c53318457e5e1 100644 (file)
@@ -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: