From: Marek Olšák <marek.ol...@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 262fe1d..766f083 100644 --- a/src/gallium/drivers/radeon/r600_buffer_common.c +++ b/src/gallium/drivers/radeon/r600_buffer_common.c @@ -175,20 +175,23 @@ void r600_init_resource_fields(struct r600_common_screen *rscreen, * placements even with a low amount of stolen VRAM. */ if (!rscreen->info.has_dedicated_vram && (rscreen->info.drm_major < 3 || rscreen->info.drm_minor < 6) && res->domains == RADEON_DOMAIN_VRAM) res->domains = RADEON_DOMAIN_VRAM_GTT; 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; if (res->domains & RADEON_DOMAIN_VRAM) res->vram_usage = size; else if (res->domains & RADEON_DOMAIN_GTT) res->gart_usage = size; } diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 40cb8c0..2deb56a 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -558,20 +558,29 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, ctx = threaded_context_unwrap_sync(ctx); rctx = (struct r600_common_context*)(ctx ? ctx : rscreen->aux_context); if (resource->target != PIPE_BUFFER) { /* This is not supported now, but it might be required for OpenCL * interop in the future. */ 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. */ if (usage & PIPE_HANDLE_USAGE_WRITE && rtex->dcc_offset) { if (r600_texture_disable_dcc(rctx, rtex)) update_metadata = true; } if (!(usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH) && @@ -1219,21 +1228,23 @@ r600_texture_create_object(struct pipe_screen *screen, rtex->dcc_offset = align64(rtex->size, rtex->surface.dcc_alignment); rtex->size = rtex->dcc_offset + rtex->surface.dcc_size; } } /* Now create the backing buffer. */ if (!buf) { 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); return NULL; } } else { resource->buf = buf; resource->gpu_address = rscreen->ws->buffer_get_virtual_address(resource->buf); resource->bo_size = buf->size; resource->bo_alignment = buf->alignment; -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev