diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index bdb46b95f73..c0e31c2de9e 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -1,5 +1,7 @@ /* * Copyright 2010 Red Hat Inc. + * Copyright © 2014-2017 Broadcom + * Copyright (C) 2019-2020 Collabora, Ltd. * Copyright 2006 VMware, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -193,6 +195,10 @@ agx_resource_create(struct pipe_screen *screen, offset += ALIGN_POT(nresource->slices[l].line_stride * height, 0x80); } + /* Arrays and cubemaps have the entire miptree duplicated */ + nresource->array_stride = ALIGN_POT(offset, 64); + unsigned size = ALIGN_POT(nresource->array_stride * templ->array_size, 4096); + pipe_reference_init(&nresource->base.reference, 1); struct sw_winsys *winsys = ((struct agx_screen *) screen)->winsys; @@ -227,7 +233,6 @@ agx_resource_create(struct pipe_screen *screen, } } - unsigned size = ALIGN_POT(offset, 4096); nresource->bo = agx_bo_create(dev, size, AGX_MEMORY_TYPE_FRAMEBUFFER); if (!nresource->bo) { diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h index a652f773329..a4abc0760de 100644 --- a/src/gallium/drivers/asahi/agx_state.h +++ b/src/gallium/drivers/asahi/agx_state.h @@ -247,6 +247,9 @@ struct agx_resource { unsigned offset; unsigned line_stride; } slices[PIPE_MAX_TEXTURE_LEVELS]; + + /* Bytes from one miptree to the next */ + unsigned array_stride; }; static inline struct agx_resource *