summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-06-06 14:36:41 -0700
committerAlyssa Rosenzweig <[email protected]>2019-06-10 06:48:07 -0700
commitd48d991ce272df837627790e80c06fb10266c48a (patch)
tree55ee20a7a31c040760ef321c0ec69a62b371dbc8 /src/gallium
parentd89e0716a15982528990efc888ad01bb2918e6e1 (diff)
panfrost: Align linear renderable resources
It's just -easier- to render to aligned framebuffers. For winsys targets, we already align, but even for an internal linear FBO we ought to align everything nicely. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index ef0a3ba1d9f..bce3426fd67 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -183,6 +183,15 @@ panfrost_setup_slices(const struct pipe_resource *tmpl, struct panfrost_bo *bo)
unsigned height = tmpl->height0;
unsigned bytes_per_pixel = util_format_get_blocksize(tmpl->format);
+ /* Tiled operates blockwise; linear is packed. Also, anything
+ * we render to has to be tile-aligned. Maybe not strictly
+ * necessary, but we're not *that* pressed for memory and it
+ * makes code a lot simpler */
+
+ bool renderable = tmpl->bind & PIPE_BIND_RENDER_TARGET;
+ bool tiled = bo->layout == PAN_TILED;
+ bool should_align = renderable || tiled;
+
unsigned offset = 0;
for (unsigned l = 0; l <= tmpl->last_level; ++l) {
@@ -191,9 +200,7 @@ panfrost_setup_slices(const struct pipe_resource *tmpl, struct panfrost_bo *bo)
unsigned effective_width = width;
unsigned effective_height = height;
- /* Tiled operates blockwise; linear is packed */
-
- if (bo->layout == PAN_TILED) {
+ if (should_align) {
effective_width = ALIGN(effective_width, 16);
effective_height = ALIGN(effective_height, 16);
}