[PATCH v2 04/14] etnaviv: put logic for rs clear format selection into caller

Philipp Zabel p.zabel at pengutronix.de
Tue May 15 15:03:03 UTC 2018


On Tue, 2018-05-01 at 16:48 +0200, Christian Gmeiner wrote:
> We do no need to call translate_rs_format(..) as we can simplify
> things by using formats blocksize to choose the correct RS format
> for clearing.
> 
> No piglit regressions.
> 
> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_rs.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_rs.c b/src/gallium/drivers/etnaviv/etnaviv_rs.c
> index fc4f65dbee..3febd8daef 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_rs.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_rs.c
> @@ -254,7 +254,19 @@ etna_rs_gen_clear_surface(struct etna_context *ctx, struct etna_surface *surf,
>                            uint32_t clear_value)
>  {
>     struct etna_resource *dst = etna_resource(surf->base.texture);
> -   uint32_t format = translate_rs_format(surf->base.format);
> +   uint32_t format;
> +
> +   switch (util_format_get_blocksize(surf->base.format)) {
> +   case 2:
> +      format = RS_FORMAT_A4R4G4B4;
> +      break;
> +   case 4:
> +      format = RS_FORMAT_A8R8G8B8;
> +      break;
> +   default:
> +      format = ETNA_NO_MATCH;
> +      break;
> +   }

Naively, this does not look like a simplification to me.

It effectively replaces a call to translate_rs_format with a call to
util_format_description. Is there an advantage to doing it this way?

regards
Philipp


More information about the etnaviv mailing list