From dfb0413fcb12b9577e4c9a454ca1dcc20fc1831b Mon Sep 17 00:00:00 2001 From: Richard Thier Date: Tue, 4 Jun 2019 12:15:53 +0200 Subject: [PATCH] Quickfix (bug 110781): r300 performance drop regression - fix using Marek proposals and GTT+VRAM r300 fixup for 19.x --- src/gallium/drivers/r300/r300_query.c | 5 +++-- src/gallium/drivers/r300/r300_render.c | 5 +++-- src/gallium/drivers/r300/r300_screen_buffer.c | 6 ++++-- src/gallium/drivers/r300/r300_texture.c | 4 +++- src/gallium/drivers/radeon/radeon_winsys.h | 14 ++++++++++++++ 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 014055b221e..8f811c62168 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -62,7 +62,8 @@ static struct pipe_query *r300_create_query(struct pipe_context *pipe, 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; @@ -114,7 +115,7 @@ void r300_stop_query(struct r300_context *r300) } static bool r300_end_query(struct pipe_context* pipe, - struct pipe_query* query) + struct pipe_query* query) { struct r300_context* r300 = r300_context(pipe); struct r300_query *q = r300_query(query); diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index ed129e1a306..31ee5d900cd 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -908,14 +908,15 @@ 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); + 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; } 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 @@ -103,7 +103,8 @@ r300_buffer_transfer_map( struct pipe_context *context, /* 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); @@ -183,7 +184,8 @@ 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->domain, 0); + rbuf->domain, + RADEON_FLAG_NO_INTERPROCESS_SHARING); 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 46d88b34638..0b26e0340ce 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -1114,7 +1114,9 @@ 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, - 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; diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index c27627e8926..6fa7f3cb5e6 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -827,6 +827,20 @@ static inline int radeon_get_heap_index(enum radeon_bo_domain domain, RADEON_FLAG_32BIT)) return -1; + /* r300 code paths still provide VRAM | GART or-ed to + * other domains so choose fastest combination possible. + * This might be improved elsewhere in r300 to not + * even ask for a combination like this.. + * + * Fixes bitrot for r300 code paths unused for long */ + if((domain & RADEON_DOMAIN_VRAM) != 0) + /* Caller asked VRAM | something */ + domain = RADEON_DOMAIN_VRAM; + else + if((domain & RADEON_DOMAIN_GTT) != 0) + /* Caller asked GTT | something - but not VRAM */ + domain = RADEON_DOMAIN_GTT; + switch (domain) { case RADEON_DOMAIN_VRAM: switch (flags & (RADEON_FLAG_NO_CPU_ACCESS | -- 2.21.0