summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2017-11-02 16:08:42 +0100
committerChristian Gmeiner <[email protected]>2017-11-06 21:31:20 +0100
commit96463614a30589d30c81eb33f559d633dc937eae (patch)
tree8e12803a5ac76c1c4c9d4c7a96007983e76db314 /src
parent93ba3f29bbfd996dea5ecd053501800c11fc7f1c (diff)
etnaviv: Don't over-pad compressed textures
HALIGN_FOUR/SIXTEEN has no meaning for compressed textures, and we can't render to them anyway. So use the tightest possible packing. This avoids bugs with non-power-of-two block sizes. Signed-off-by: Wladimir J. van der Laan <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_resource.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index d6cccd2dbb1..0a82807b401 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -209,18 +209,24 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
return NULL;
}
- /* If we have the TEXTURE_HALIGN feature, we can always align to the
- * resolve engine's width. If not, we must not align resources used
- * only for textures. */
- bool rs_align = VIV_FEATURE(screen, chipMinorFeatures1, TEXTURE_HALIGN) ||
- !etna_resource_sampler_only(templat);
-
/* Determine needed padding (alignment of height/width) */
unsigned paddingX = 0, paddingY = 0;
unsigned halign = TEXTURE_HALIGN_FOUR;
- etna_layout_multiple(layout, screen->specs.pixel_pipes, rs_align, &paddingX,
- &paddingY, &halign);
- assert(paddingX && paddingY);
+ if (!util_format_is_compressed(templat->format)) {
+ /* If we have the TEXTURE_HALIGN feature, we can always align to the
+ * resolve engine's width. If not, we must not align resources used
+ * only for textures. */
+ bool rs_align = VIV_FEATURE(screen, chipMinorFeatures1, TEXTURE_HALIGN) ||
+ !etna_resource_sampler_only(templat);
+ etna_layout_multiple(layout, screen->specs.pixel_pipes, rs_align, &paddingX,
+ &paddingY, &halign);
+ assert(paddingX && paddingY);
+ } else {
+ /* Compressed textures are padded to their block size, but we don't have
+ * to do anything special for that. */
+ paddingX = 1;
+ paddingY = 1;
+ }
if (templat->target != PIPE_BUFFER)
etna_adjust_rs_align(screen->specs.pixel_pipes, NULL, &paddingY);