Mesa (master): gallium/radeon: allow suballocating textures
Marek Olšák
mareko at kemper.freedesktop.org
Tue Jul 4 13:41:07 UTC 2017
Module: Mesa
Branch: master
Commit: c78401564327454e08e0040e5801ce3a5fefcea4
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c78401564327454e08e0040e5801ce3a5fefcea4
Author: Marek Olšák <marek.olsak at amd.com>
Date: Tue Jun 27 20:32:37 2017 +0200
gallium/radeon: allow suballocating textures
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/gallium/drivers/radeon/r600_buffer_common.c | 3 +++
src/gallium/drivers/radeon/r600_texture.c | 13 ++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
index 4bf293daf2..40d763bd9f 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -184,6 +184,9 @@ void r600_init_resource_fields(struct r600_common_screen *rscreen,
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/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index 40cb8c0ab6..2deb56af66 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -565,6 +565,15 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
if (resource->nr_samples > 1 || rtex->is_depth)
return false;
+ /* Move a suballocated texture into a non-suballocated allocation. */
+ if (rscreen->ws->buffer_is_suballocated(res->buf)) {
+ assert(!res->b.is_shared);
+ r600_reallocate_texture_inplace(rctx, rtex,
+ PIPE_BIND_SHARED, false);
+ assert(res->b.b.bind & PIPE_BIND_SHARED);
+ assert(res->flags & RADEON_FLAG_NO_SUBALLOC);
+ }
+
/* Since shader image stores don't support DCC on VI,
* disable it for external clients that want write
* access.
@@ -1226,7 +1235,9 @@ r600_texture_create_object(struct pipe_screen *screen,
r600_init_resource_fields(rscreen, resource, rtex->size,
rtex->surface.surf_alignment);
- resource->flags |= RADEON_FLAG_NO_SUBALLOC;
+ /* 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);
More information about the mesa-commit
mailing list