aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_resource.c
diff options
context:
space:
mode:
authorLucas Stach <[email protected]>2017-07-04 16:19:51 +0200
committerLucas Stach <[email protected]>2017-07-19 16:26:49 +0200
commit68ec876a252a0e78d7eb2991bb0397752bbeec25 (patch)
treec07bd2378127299b043a48329e6c12bfa118feeb /src/gallium/drivers/etnaviv/etnaviv_resource.c
parentc4818808991134cc7d7741c8f29dc50f6d2102a0 (diff)
etnaviv: add helper to work out RS alignment
The minimum RS alignment calculation is needed in various places. Extract a helper to avoid open-coding the calcuation at every site. Signed-off-by: Lucas Stach <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_resource.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_resource.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index 8d96baf2a04..1cd906d4afa 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -180,11 +180,8 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
&paddingY, &halign);
assert(paddingX && paddingY);
- if (templat->target != PIPE_BUFFER) {
- unsigned min_paddingY = 4 * screen->specs.pixel_pipes;
- if (paddingY < min_paddingY)
- paddingY = min_paddingY;
- }
+ if (templat->target != PIPE_BUFFER)
+ etna_adjust_rs_align(screen->specs.pixel_pipes, NULL, &paddingY);
struct etna_resource *rsc = CALLOC_STRUCT(etna_resource);
@@ -368,11 +365,10 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
/* We will be using the RS to copy with this resource, so we must
* ensure that it is appropriately aligned for the RS requirements. */
- unsigned paddingX = ETNA_RS_WIDTH_MASK + 1;
- unsigned paddingY = (ETNA_RS_HEIGHT_MASK + 1) * screen->specs.pixel_pipes;
+ level->padded_width = level->width;
+ level->padded_height = level->height;
+ etna_adjust_rs_align(&level->padded_width, &level->padded_height);
- level->padded_width = align(level->width, paddingX);
- level->padded_height = align(level->height, paddingY);
level->layer_stride = level->stride * util_format_get_nblocksy(prsc->format,
level->padded_height);