Mesa (main): softpipe: unmap display target of shader sampler
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jul 9 16:17:35 UTC 2021
Module: Mesa
Branch: main
Commit: 8192ffe3bee952b4908b05461412007d034e0cf6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8192ffe3bee952b4908b05461412007d034e0cf6
Author: Heinrich Fink <hfink at snap.com>
Date: Thu Jul 1 14:39:36 2021 +0200
softpipe: unmap display target of shader sampler
Unmap display target in cleanup routine for sampler views that are using
textures backed by a display target.
v2:
- remove obsolete comment
Signed-off-by: Heinrich Fink <hfink at snap.com>
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11741>
---
src/gallium/drivers/softpipe/sp_state_sampler.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c
index b6a97c13c41..16db953b163 100644
--- a/src/gallium/drivers/softpipe/sp_state_sampler.c
+++ b/src/gallium/drivers/softpipe/sp_state_sampler.c
@@ -255,9 +255,6 @@ prepare_shader_sampling(
}
else {
/* display target texture/surface */
- /*
- * XXX: Where should this be unmapped?
- */
struct softpipe_screen *screen = softpipe_screen(tex->screen);
struct sw_winsys *winsys = screen->winsys;
addr = winsys->displaytarget_map(winsys, sp_tex->dt,
@@ -278,6 +275,20 @@ prepare_shader_sampling(
}
}
+static void
+sp_sampler_view_display_target_unmap(struct softpipe_context *sp,
+ struct pipe_sampler_view *view)
+{
+ if (view) {
+ struct pipe_resource *tex = view->texture;
+ struct softpipe_resource *sp_tex = softpipe_resource(tex);
+ if (sp_tex->dt) {
+ struct softpipe_screen *screen = softpipe_screen(tex->screen);
+ struct sw_winsys *winsys = screen->winsys;
+ winsys->displaytarget_unmap(winsys, sp_tex->dt);
+ }
+ }
+}
/**
* Called during state validation when SP_NEW_TEXTURE is set.
@@ -296,6 +307,8 @@ softpipe_cleanup_vertex_sampling(struct softpipe_context *ctx)
{
unsigned i;
for (i = 0; i < ARRAY_SIZE(ctx->mapped_vs_tex); i++) {
+ sp_sampler_view_display_target_unmap(
+ ctx, ctx->sampler_views[PIPE_SHADER_VERTEX][i]);
pipe_resource_reference(&ctx->mapped_vs_tex[i], NULL);
}
}
@@ -318,6 +331,8 @@ softpipe_cleanup_geometry_sampling(struct softpipe_context *ctx)
{
unsigned i;
for (i = 0; i < ARRAY_SIZE(ctx->mapped_gs_tex); i++) {
+ sp_sampler_view_display_target_unmap(
+ ctx, ctx->sampler_views[PIPE_SHADER_GEOMETRY][i]);
pipe_resource_reference(&ctx->mapped_gs_tex[i], NULL);
}
}
More information about the mesa-commit
mailing list