[Mesa-dev] [PATCH] r300g: restore performance after RADEON_FLAG_NO_INTERPROCESS_SHARING was added

Marek Olšák maraeo at gmail.com
Mon Jun 3 20:23:41 UTC 2019


From: Marek Olšák <marek.olsak at amd.com>

It skipped slab allocators and the buffer cache.

Cc: 19.1 <mesa-stable at lists.freedesktop.org>
---
 src/gallium/drivers/r300/r300_query.c         | 3 ++-
 src/gallium/drivers/r300/r300_render.c        | 3 ++-
 src/gallium/drivers/r300/r300_screen_buffer.c | 6 ++++--
 src/gallium/drivers/r300/r300_texture.c       | 5 ++++-
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
index 014055b221e..0ccc753147b 100644
--- a/src/gallium/drivers/r300/r300_query.c
+++ b/src/gallium/drivers/r300/r300_query.c
@@ -55,21 +55,22 @@ static struct pipe_query *r300_create_query(struct pipe_context *pipe,
     }
 
     if (r300screen->caps.family == CHIP_RV530)
         q->num_pipes = r300screen->info.r300_num_z_pipes;
     else
         q->num_pipes = r300screen->info.r300_num_gb_pipes;
 
     q->buf = r300->rws->buffer_create(r300->rws,
                                       r300screen->info.gart_page_size,
                                       r300screen->info.gart_page_size,
-                                      RADEON_DOMAIN_GTT, 0);
+                                      RADEON_DOMAIN_GTT,
+                                      RADEON_FLAG_NO_INTERPROCESS_SHARING);
     if (!q->buf) {
         FREE(q);
         return NULL;
     }
     return (struct pipe_query*)q;
 }
 
 static void r300_destroy_query(struct pipe_context* pipe,
                                struct pipe_query* query)
 {
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index ed129e1a306..c0d7e7ee0f8 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -908,21 +908,22 @@ static boolean r300_render_allocate_vertices(struct vbuf_render* render,
     DBG(r300, DBG_DRAW, "r300: render_allocate_vertices (size: %d)\n", size);
 
     if (!r300->vbo || size + r300->draw_vbo_offset > r300->vbo->size) {
 	pb_reference(&r300->vbo, NULL);
         r300->vbo = NULL;
         r300render->vbo_ptr = NULL;
 
         r300->vbo = rws->buffer_create(rws,
                                        MAX2(R300_MAX_DRAW_VBO_SIZE, size),
                                        R300_BUFFER_ALIGNMENT,
-                                       RADEON_DOMAIN_GTT, 0);
+                                       RADEON_DOMAIN_GTT,
+                                       RADEON_FLAG_NO_INTERPROCESS_SHARING);
         if (!r300->vbo) {
             return FALSE;
         }
         r300->draw_vbo_offset = 0;
         r300render->vbo_ptr = rws->buffer_map(r300->vbo, r300->cs,
                                               PIPE_TRANSFER_WRITE);
     }
 
     r300render->vertex_size = vertex_size;
     return TRUE;
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index 4af1c46856e..c946cfc8d03 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -96,21 +96,22 @@ r300_buffer_transfer_map( struct pipe_context *context,
 
         /* Check if mapping this buffer would cause waiting for the GPU. */
         if (r300->rws->cs_is_buffer_referenced(r300->cs, rbuf->buf, RADEON_USAGE_READWRITE) ||
             !r300->rws->buffer_wait(rbuf->buf, 0, RADEON_USAGE_READWRITE)) {
             unsigned i;
             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->domain, 0);
+                                               rbuf->domain,
+                                               RADEON_FLAG_NO_INTERPROCESS_SHARING);
             if (new_buf) {
                 /* Discard the old buffer. */
                 pb_reference(&rbuf->buf, NULL);
                 rbuf->buf = new_buf;
 
                 /* We changed the buffer, now we need to bind it where the old one was bound. */
                 for (i = 0; i < r300->nr_vertex_buffers; i++) {
                     if (r300->vertex_buffer[i].buffer.resource == &rbuf->b.b) {
                         r300->vertex_arrays_dirty = TRUE;
                         break;
@@ -176,17 +177,18 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
      */
     if (templ->bind & PIPE_BIND_CONSTANT_BUFFER ||
         (!r300screen->caps.has_tcl && !(templ->bind & PIPE_BIND_CUSTOM))) {
         rbuf->malloced_buffer = align_malloc(templ->width0, 64);
         return &rbuf->b.b;
     }
 
     rbuf->buf =
         r300screen->rws->buffer_create(r300screen->rws, rbuf->b.b.width0,
                                        R300_BUFFER_ALIGNMENT,
-                                       rbuf->domain, 0);
+                                       rbuf->domain,
+                                       RADEON_FLAG_NO_INTERPROCESS_SHARING);
     if (!rbuf->buf) {
         FREE(rbuf);
         return NULL;
     }
     return &rbuf->b.b;
 }
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 46d88b34638..2a3285cd3cd 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -1107,21 +1107,24 @@ r300_texture_create_object(struct r300_screen *rscreen,
         tex->domain &= ~RADEON_DOMAIN_GTT;
     }
     /* Just fail if the texture is too large. */
     if (!tex->domain) {
         goto fail;
     }
 
     /* Create the backing buffer if needed. */
     if (!tex->buf) {
         tex->buf = rws->buffer_create(rws, tex->tex.size_in_bytes, 2048,
-                                      tex->domain, RADEON_FLAG_NO_SUBALLOC);
+                                      tex->domain,
+                                      RADEON_FLAG_NO_SUBALLOC |
+                                      /* Use the reusable pool: */
+                                      RADEON_FLAG_NO_INTERPROCESS_SHARING);
 
         if (!tex->buf) {
             goto fail;
         }
     }
 
     if (SCREEN_DBG_ON(rscreen, DBG_MSAA) && base->nr_samples > 1) {
         fprintf(stderr, "r300: %ix MSAA %s buffer created\n",
                 base->nr_samples,
                 util_format_is_depth_or_stencil(base->format) ? "depth" : "color");
-- 
2.17.1



More information about the mesa-dev mailing list