etnaviv: drop translate_blend(..)
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Sat, 6 Jun 2020 10:28:13 +0000 (12:28 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 8 Jun 2020 15:35:13 +0000 (15:35 +0000)
PIPE_BLEND_* matches 1:1 the hardware defines.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4187>

src/gallium/drivers/etnaviv/etnaviv_blend.c
src/gallium/drivers/etnaviv/etnaviv_translate.h

index b9a7c0373d5debe834045b8ad54e3dcdb004f564..644409a437eacdd8a25e1a540dd80449e6cb306f 100644 (file)
@@ -43,6 +43,13 @@ etna_blend_state_create(struct pipe_context *pctx,
    struct etna_blend_state *co = CALLOC_STRUCT(etna_blend_state);
    bool alpha_enable, logicop_enable;
 
+   /* pipe_blend_func happens to match the hardware. */
+   STATIC_ASSERT(PIPE_BLEND_ADD == BLEND_EQ_ADD);
+   STATIC_ASSERT(PIPE_BLEND_SUBTRACT == BLEND_EQ_SUBTRACT);
+   STATIC_ASSERT(PIPE_BLEND_REVERSE_SUBTRACT == BLEND_EQ_REVERSE_SUBTRACT);
+   STATIC_ASSERT(PIPE_BLEND_MIN == BLEND_EQ_MIN);
+   STATIC_ASSERT(PIPE_BLEND_MAX == BLEND_EQ_MAX);
+
    if (!co)
       return NULL;
 
@@ -79,8 +86,8 @@ etna_blend_state_create(struct pipe_context *pctx,
          VIVS_PE_ALPHA_CONFIG_SRC_FUNC_ALPHA(translate_blend_factor(rt0->alpha_src_factor)) |
          VIVS_PE_ALPHA_CONFIG_DST_FUNC_COLOR(translate_blend_factor(rt0->rgb_dst_factor)) |
          VIVS_PE_ALPHA_CONFIG_DST_FUNC_ALPHA(translate_blend_factor(rt0->alpha_dst_factor)) |
-         VIVS_PE_ALPHA_CONFIG_EQ_COLOR(translate_blend(rt0->rgb_func)) |
-         VIVS_PE_ALPHA_CONFIG_EQ_ALPHA(translate_blend(rt0->alpha_func));
+         VIVS_PE_ALPHA_CONFIG_EQ_COLOR(rt0->rgb_func) |
+         VIVS_PE_ALPHA_CONFIG_EQ_ALPHA(rt0->alpha_func);
    } else {
       co->PE_ALPHA_CONFIG = 0;
    }
index 0638bfd5dcaff5ad66885a8acbf0794ccb3db49c..758a682d084ffcd76d322af60a013806a9d24f87 100644 (file)
@@ -113,26 +113,6 @@ translate_stencil_op(unsigned stencil_op)
    }
 }
 
-static inline uint32_t
-translate_blend(unsigned blend)
-{
-   switch (blend) {
-   case PIPE_BLEND_ADD:
-      return BLEND_EQ_ADD;
-   case PIPE_BLEND_SUBTRACT:
-      return BLEND_EQ_SUBTRACT;
-   case PIPE_BLEND_REVERSE_SUBTRACT:
-      return BLEND_EQ_REVERSE_SUBTRACT;
-   case PIPE_BLEND_MIN:
-      return BLEND_EQ_MIN;
-   case PIPE_BLEND_MAX:
-      return BLEND_EQ_MAX;
-   default:
-      DBG("Unhandled blend: %i", blend);
-      return ETNA_NO_MATCH;
-   }
-}
-
 static inline uint32_t
 translate_blend_factor(unsigned blend_factor)
 {