summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_resource.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-08-18 10:31:36 -0700
committerEric Anholt <[email protected]>2014-08-18 15:27:43 -0700
commit63fe494877177d24fd36f9955b69331939b7798c (patch)
tree35d66547c938970d0e72f3b6f061ed2c225f1297 /src/gallium/drivers/vc4/vc4_resource.c
parenta538bab0659c3bd5ed1da068c11b211cf65d6610 (diff)
vc4: Fix multi-level texture setup.
We weren't accounting for the level 0 offset in the texture setup (so it only worked if it happened to be a single-level texture), and doing so required that we get the level 0 offset page aligned so that the offset bits don't get interpreted as the texture format and such.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_resource.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_resource.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c
index 3dad566a002..e0c0c7bdd42 100644
--- a/src/gallium/drivers/vc4/vc4_resource.c
+++ b/src/gallium/drivers/vc4/vc4_resource.c
@@ -147,7 +147,17 @@ vc4_setup_slices(struct vc4_resource *rsc)
*/
offset += slice->size0 * depth;
}
- /* XXX: align level 0 offset? */
+
+ /* The texture base pointer that has to point to level 0 doesn't have
+ * intra-page bits, so we have to align it, and thus shift up all the
+ * smaller slices.
+ */
+ uint32_t page_align_offset = (align(rsc->slices[0].offset, 4096) -
+ rsc->slices[0].offset);
+ if (page_align_offset) {
+ for (int i = 0; i <= prsc->last_level; i++)
+ rsc->slices[i].offset += page_align_offset;
+ }
}
static struct vc4_resource *