From 0ae16fb565f5334c5d35a90836c675a32de2bf28 Mon Sep 17 00:00:00 2001 From: Khaled Emara Date: Sat, 3 Aug 2019 14:59:18 +0200 Subject: [PATCH] freedreno: add tiling parameters for 2D/2DArray/3D --- .../drivers/freedreno/a3xx/fd3_resource.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_resource.c b/src/gallium/drivers/freedreno/a3xx/fd3_resource.c index e41043e2d3d..f6b52bd30a1 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_resource.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_resource.c @@ -40,9 +40,17 @@ setup_slices(struct fd_resource *rsc, uint32_t alignment, enum pipe_format forma struct fd_resource_slice *slice = fd_resource_slice(rsc, level); uint32_t blocks; - slice->pitch = width = align(width, pitchalign); + if (rsc->tile_mode) { + width = util_next_power_of_two(width); + height = util_next_power_of_two(height); + uint32_t tpitch = width * rsc->cpp; + slice->pitch = (tpitch > 32) ? tpitch : 32; + } else { + slice->pitch = width = align(width, pitchalign); + } + slice->offset = size; - blocks = util_format_get_nblocks(format, width, height); + blocks = util_format_get_nblocks(format, slice->pitch, height); /* 1d array and 2d array textures must all have the same layer size * for each miplevel on a3xx. 3d textures can have different layer * sizes for high levels, but the hw auto-sizer is buggy (or at least @@ -95,6 +103,15 @@ ok_format(enum pipe_format pfmt) if (fmt == ~0) return false; + switch (pfmt) { + case PIPE_FORMAT_R8_UINT: + case PIPE_FORMAT_R8_SINT: + case PIPE_FORMAT_Z32_FLOAT: + return false; + default: + break; + } + return true; } -- 2.30.2