[PATCH 3/5] etnaviv: apply feature overrides in one central location

Wladimir J. van der Laan laanwj at gmail.com
Wed May 10 18:11:56 UTC 2017


Yes, good idea to do this in one place.

Reviewed-By: Wladimir J. van der Laan <laanwj at gmail.com>

On Wed, May 10, 2017 at 06:01:06PM +0200, Lucas Stach wrote:
> This way we can just test the feature bits and don't need to spread
> the debug overrides to all locations touching a feature.
> 
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_clear_blit.c |  6 ++----
>  src/gallium/drivers/etnaviv/etnaviv_resource.c   |  2 +-
>  src/gallium/drivers/etnaviv/etnaviv_screen.c     | 10 ++++++++++
>  src/gallium/drivers/etnaviv/etnaviv_surface.c    |  2 +-
>  src/gallium/drivers/etnaviv/etnaviv_zsa.c        |  9 +++++----
>  5 files changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> index 528b57389d57..ae1c5862880f 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> @@ -111,8 +111,7 @@ etna_blit_clear_color(struct pipe_context *pctx, struct pipe_surface *dst,
>     if (surf->surf.ts_size) { /* TS: use precompiled clear command */
>        ctx->framebuffer.TS_COLOR_CLEAR_VALUE = new_clear_value;
>  
> -      if (!DBG_ENABLED(ETNA_DBG_NO_AUTODISABLE) &&
> -          VIV_FEATURE(ctx->screen, chipMinorFeatures1, AUTO_DISABLE)) {
> +      if (VIV_FEATURE(ctx->screen, chipMinorFeatures1, AUTO_DISABLE)) {
>           /* Set number of color tiles to be filled */
>           etna_set_state(ctx->stream, VIVS_TS_COLOR_AUTO_DISABLE_COUNT,
>                          surf->surf.padded_width * surf->surf.padded_height / 16);
> @@ -171,8 +170,7 @@ etna_blit_clear_zs(struct pipe_context *pctx, struct pipe_surface *dst,
>     if (surf->surf.ts_size) { /* TS: use precompiled clear command */
>        /* Set new clear depth value */
>        ctx->framebuffer.TS_DEPTH_CLEAR_VALUE = new_clear_value;
> -      if (!DBG_ENABLED(ETNA_DBG_NO_AUTODISABLE) &&
> -          VIV_FEATURE(ctx->screen, chipMinorFeatures1, AUTO_DISABLE)) {
> +      if (VIV_FEATURE(ctx->screen, chipMinorFeatures1, AUTO_DISABLE)) {
>           /* Set number of depth tiles to be filled */
>           etna_set_state(ctx->stream, VIVS_TS_DEPTH_AUTO_DISABLE_COUNT,
>                          surf->surf.padded_width * surf->surf.padded_height / 16);
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index 26f2ed733498..103b53c1c310 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -247,7 +247,7 @@ etna_resource_create(struct pipe_screen *pscreen,
>           layout = ETNA_LAYOUT_LINEAR;
>     } else if (templat->target != PIPE_BUFFER) {
>        bool want_multitiled = false;
> -      bool want_supertiled = screen->specs.can_supertile && !DBG_ENABLED(ETNA_DBG_NO_SUPERTILE);
> +      bool want_supertiled = screen->specs.can_supertile;
>  
>        /* When this GPU supports single-buffer rendering, don't ever enable
>         * multi-tiling. This replicates the blob behavior on GC3000.
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index 626f7c778985..aba6bb701dc3 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -829,6 +829,16 @@ etna_screen_create(struct etna_device *dev, struct etna_gpu *gpu,
>     if (!etna_get_specs(screen))
>        goto fail;
>  
> +   /* apply debug options that disable individual features */
> +   if (DBG_ENABLED(ETNA_DBG_NO_EARLY_Z))
> +      screen->features[viv_chipFeatures] |= chipFeatures_NO_EARLY_Z;
> +   if (DBG_ENABLED(ETNA_DBG_NO_TS))
> +         screen->features[viv_chipFeatures] &= ~chipFeatures_FAST_CLEAR;
> +   if (DBG_ENABLED(ETNA_DBG_NO_AUTODISABLE))
> +      screen->features[viv_chipMinorFeatures1] &= ~chipMinorFeatures1_AUTO_DISABLE;
> +   if (DBG_ENABLED(ETNA_DBG_NO_SUPERTILE))
> +      screen->specs.can_supertile = 0;
> +
>     pscreen->destroy = etna_screen_destroy;
>     pscreen->get_param = etna_screen_get_param;
>     pscreen->get_paramf = etna_screen_get_paramf;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_surface.c b/src/gallium/drivers/etnaviv/etnaviv_surface.c
> index 1db9b40a5108..4b95f6575a45 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_surface.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_surface.c
> @@ -66,7 +66,7 @@ etna_create_surface(struct pipe_context *pctx, struct pipe_resource *prsc,
>  
>     if (VIV_FEATURE(ctx->screen, chipFeatures, FAST_CLEAR) &&
>         VIV_FEATURE(ctx->screen, chipMinorFeatures0, MC20) &&
> -       !DBG_ENABLED(ETNA_DBG_NO_TS) && !rsc->ts_bo &&
> +       !rsc->ts_bo &&
>         (rsc->levels[level].padded_width & ETNA_RS_WIDTH_MASK) == 0 &&
>         (rsc->levels[level].padded_height & ETNA_RS_HEIGHT_MASK) == 0) {
>        etna_screen_resource_alloc_ts(pctx->screen, rsc);
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_zsa.c b/src/gallium/drivers/etnaviv/etnaviv_zsa.c
> index 7caba279b376..22c2020fe5c3 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_zsa.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_zsa.c
> @@ -27,13 +27,17 @@
>  #include "etnaviv_zsa.h"
>  
>  #include "etnaviv_context.h"
> +#include "etnaviv_screen.h"
>  #include "etnaviv_translate.h"
>  #include "util/u_memory.h"
>  
> +#include "hw/common.xml.h"
> +
>  void *
>  etna_zsa_state_create(struct pipe_context *pctx,
>                        const struct pipe_depth_stencil_alpha_state *so)
>  {
> +   struct etna_context *ctx = etna_context(pctx);
>     struct etna_zsa_state *cs = CALLOC_STRUCT(etna_zsa_state);
>  
>     if (!cs)
> @@ -42,7 +46,7 @@ etna_zsa_state_create(struct pipe_context *pctx,
>     cs->base = *so;
>  
>     /* XXX does stencil[0] / stencil[1] order depend on rs->front_ccw? */
> -   bool early_z = true;
> +   bool early_z = !VIV_FEATURE(ctx->screen, chipFeatures, NO_EARLY_Z);
>     bool disable_zs =
>        (!so->depth.enabled || so->depth.func == PIPE_FUNC_ALWAYS) &&
>        !so->depth.writemask;
> @@ -88,9 +92,6 @@ etna_zsa_state_create(struct pipe_context *pctx,
>     if (so->depth.enabled == false || so->depth.func == PIPE_FUNC_ALWAYS)
>        early_z = false;
>  
> -   if (DBG_ENABLED(ETNA_DBG_NO_EARLY_Z))
> -      early_z = false;
> -
>     /* compare funcs have 1 to 1 mapping */
>     cs->PE_DEPTH_CONFIG =
>        VIVS_PE_DEPTH_CONFIG_DEPTH_FUNC(so->depth.enabled ? so->depth.func
> -- 
> 2.11.0
> 
> _______________________________________________
> etnaviv mailing list
> etnaviv at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv


More information about the etnaviv mailing list