Mesa (master): freedreno/a5xx: align height to GMEM
Rob Clark
robclark at kemper.freedesktop.org
Mon Oct 2 13:26:01 UTC 2017
Module: Mesa
Branch: master
Commit: 16ac70bdcf29d075e11f1ebc54405d0ea19b561c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=16ac70bdcf29d075e11f1ebc54405d0ea19b561c
Author: Rob Clark <robdclark at gmail.com>
Date: Thu Sep 14 15:03:11 2017 -0400
freedreno/a5xx: align height to GMEM
Similar to the way width/pitch alignment works, it seems like we need to
do similar for height. Otherwise the BLIT from system memory to GMEM
can over-fetch beyond the end of the buffer, triggering a fault.
I'm not sure if there is a better solution yet. Possibly we could fall
back to pre-a5xx style DRAW packets for cases where BLIT might over-
fetch. (We in theory have that problem already with rendering to higher
mipmap levels, although fortunately those tend to use GMEM bypass.)
This fixes issues reported with glamor.
Reported-by: don.harbin at linaro.org
Cc: 17.2 <mesa-stable at lists.freedesktop.org>
Signed-off-by: Rob Clark <robdclark at gmail.com>
---
src/gallium/drivers/freedreno/freedreno_resource.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index 79d831c6d7..5aa90ced69 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -704,8 +704,9 @@ static uint32_t
setup_slices(struct fd_resource *rsc, uint32_t alignment, enum pipe_format format)
{
struct pipe_resource *prsc = &rsc->base.b;
+ struct fd_screen *screen = fd_screen(prsc->screen);
enum util_format_layout layout = util_format_description(format)->layout;
- uint32_t pitchalign = fd_screen(prsc->screen)->gmem_alignw;
+ uint32_t pitchalign = screen->gmem_alignw;
uint32_t level, size = 0;
uint32_t width = prsc->width0;
uint32_t height = prsc->height0;
@@ -715,6 +716,9 @@ setup_slices(struct fd_resource *rsc, uint32_t alignment, enum pipe_format forma
*/
uint32_t layers_in_level = rsc->layer_first ? 1 : prsc->array_size;
+ if (is_a5xx(screen) && (rsc->base.b.target >= PIPE_TEXTURE_2D))
+ height = align(height, screen->gmem_alignh);
+
for (level = 0; level <= prsc->last_level; level++) {
struct fd_resource_slice *slice = fd_resource_slice(rsc, level);
uint32_t blocks;
More information about the mesa-commit
mailing list