Mesa (master): r600: consolidate PIPE_BIND_SHARED/SCANOUT handling

Michel Dänzer daenzer at kemper.freedesktop.org
Fri Mar 16 16:33:42 UTC 2018


Module: Mesa
Branch: master
Commit: f099c3aef1635f05f295969d296375fe9983a53a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f099c3aef1635f05f295969d296375fe9983a53a

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Thu Mar 15 18:39:52 2018 +0100

r600: consolidate PIPE_BIND_SHARED/SCANOUT handling

(Ported from radeonsi commit f70f6baaa3bb0f8b280ac2eaea69bbffaf7de840)

Allows cached BOs to be reused in more cases.

Bugzilla: https://bugs.freedesktop.org/105171
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>

---

 src/gallium/drivers/r600/r600_buffer_common.c | 14 ++++----------
 src/gallium/drivers/r600/r600_texture.c       |  4 ----
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_buffer_common.c b/src/gallium/drivers/r600/r600_buffer_common.c
index 501b96fa0b..ca19af9b2e 100644
--- a/src/gallium/drivers/r600/r600_buffer_common.c
+++ b/src/gallium/drivers/r600/r600_buffer_common.c
@@ -167,21 +167,15 @@ void r600_init_resource_fields(struct r600_common_screen *rscreen,
 			 RADEON_FLAG_GTT_WC;
 	}
 
-	/* Only displayable single-sample textures can be shared between
-	 * processes. */
-	if (res->b.b.target == PIPE_BUFFER ||
-	    res->b.b.nr_samples >= 2 ||
-	    (rtex->surface.micro_tile_mode != RADEON_MICRO_MODE_DISPLAY &&
-	     /* Raven doesn't use display micro mode for 32bpp, so check this: */
-	     !(res->b.b.bind & PIPE_BIND_SCANOUT)))
+	/* Displayable and shareable surfaces are not suballocated. */
+	if (res->b.b.bind & (PIPE_BIND_SHARED | PIPE_BIND_SCANOUT))
+		res->flags |= RADEON_FLAG_NO_SUBALLOC; /* shareable */
+	else
 		res->flags |= RADEON_FLAG_NO_INTERPROCESS_SHARING;
 
 	if (rscreen->debug_flags & DBG_NO_WC)
 		res->flags &= ~RADEON_FLAG_GTT_WC;
 
-	if (res->b.b.bind & PIPE_BIND_SHARED)
-		res->flags |= RADEON_FLAG_NO_SUBALLOC;
-
 	/* Set expected VRAM and GART usage for the buffer. */
 	res->vram_usage = 0;
 	res->gart_usage = 0;
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index fbcc878a24..806bc278b0 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -953,10 +953,6 @@ r600_texture_create_object(struct pipe_screen *screen,
 		r600_init_resource_fields(rscreen, resource, rtex->size,
 					  rtex->surface.surf_alignment);
 
-		/* Displayable surfaces are not suballocated. */
-		if (resource->b.b.bind & PIPE_BIND_SCANOUT)
-			resource->flags |= RADEON_FLAG_NO_SUBALLOC;
-
 		if (!r600_alloc_resource(rscreen, resource)) {
 			FREE(rtex);
 			return NULL;




More information about the mesa-commit mailing list