summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/r600_texture.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-03-24 03:02:53 +0100
committerMarek Olšák <[email protected]>2017-03-31 20:57:53 +0200
commit8c7d1ded1919dcfe41ab38b92557713b3f904106 (patch)
tree3df4e7f2c49cb68ea29e8db6b1076b94e9ed84b5 /src/gallium/drivers/radeon/r600_texture.c
parentd10fbe5159ce1f7e05e959bb44e50f40a2402fb5 (diff)
radeonsi: decompress DCC in set_framebuffer_state instead of create_surface (v2)
for threaded gallium, which can't use pipe_context in create_surface v2: don't add a new decompress helper function Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon/r600_texture.c')
-rw-r--r--src/gallium/drivers/radeon/r600_texture.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index 0daa5ea53e2..877f5552bd5 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -1903,6 +1903,18 @@ bool vi_dcc_formats_compatible(enum pipe_format format1,
type1 == type2;
}
+bool vi_dcc_formats_are_incompatible(struct pipe_resource *tex,
+ unsigned level,
+ enum pipe_format view_format)
+{
+ struct r600_texture *rtex = (struct r600_texture *)tex;
+
+ return vi_dcc_enabled(rtex, level) &&
+ !vi_dcc_formats_compatible(tex->format, view_format);
+}
+
+/* This can't be merged with the above function, because
+ * vi_dcc_formats_compatible should be called only when DCC is enabled. */
void vi_disable_dcc_if_incompatible_format(struct r600_common_context *rctx,
struct pipe_resource *tex,
unsigned level,
@@ -1922,7 +1934,6 @@ struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe,
unsigned width0, unsigned height0,
unsigned width, unsigned height)
{
- struct r600_common_context *rctx = (struct r600_common_context*)pipe;
struct r600_surface *surface = CALLOC_STRUCT(r600_surface);
if (!surface)
@@ -1942,11 +1953,10 @@ struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe,
surface->width0 = width0;
surface->height0 = height0;
- if (texture->target != PIPE_BUFFER)
- vi_disable_dcc_if_incompatible_format(rctx, texture,
- templ->u.tex.level,
- templ->format);
-
+ surface->dcc_incompatible =
+ texture->target != PIPE_BUFFER &&
+ vi_dcc_formats_are_incompatible(texture, templ->u.tex.level,
+ templ->format);
return &surface->base;
}