From 68ec876a252a0e78d7eb2991bb0397752bbeec25 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Tue, 4 Jul 2017 16:19:51 +0200 Subject: 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 Reviewed-by: Christian Gmeiner --- src/gallium/drivers/etnaviv/etnaviv_translate.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/gallium/drivers/etnaviv/etnaviv_translate.h') diff --git a/src/gallium/drivers/etnaviv/etnaviv_translate.h b/src/gallium/drivers/etnaviv/etnaviv_translate.h index cbbfdf23d93..0761251a369 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_translate.h +++ b/src/gallium/drivers/etnaviv/etnaviv_translate.h @@ -37,6 +37,7 @@ #include "hw/state_3d.xml.h" #include "util/u_format.h" +#include "util/u_math.h" #include @@ -405,6 +406,18 @@ etna_layout_multiple(unsigned layout, unsigned pixel_pipes, bool rs_align, } } +static inline void etna_adjust_rs_align(unsigned num_pixelpipes, + unsigned *paddingX, unsigned *paddingY) +{ + unsigned alignX = ETNA_RS_WIDTH_MASK + 1; + unsigned alignY = (ETNA_RS_HEIGHT_MASK + 1) * num_pixelpipes; + + if (paddingX) + *paddingX = align(*paddingX, alignX); + if (paddingY) + *paddingY = align(*paddingY, alignY); +} + static inline uint32_t translate_clear_depth_stencil(enum pipe_format format, float depth, unsigned stencil) -- cgit v1.2.3