[Mesa-dev] [PATCH 4/9] st/mesa: skip updates of states that have no effect

Ilia Mirkin imirkin at alum.mit.edu
Mon Jul 18 13:31:07 UTC 2016


On Mon, Jul 18, 2016 at 9:11 AM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
>  src/mesa/state_tracker/st_atom.c | 15 ++++++++++++++-
>  src/mesa/state_tracker/st_atom.h | 22 ++++++++++++++--------
>  2 files changed, 28 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
> index 5843d2a..77f1ec3 100644
> --- a/src/mesa/state_tracker/st_atom.c
> +++ b/src/mesa/state_tracker/st_atom.c
> @@ -107,6 +107,7 @@ static void check_attrib_edgeflag(struct st_context *st)
>
>  void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
>  {
> +   struct gl_context *ctx = st->ctx;
>     uint64_t dirty, pipeline_mask;
>     uint32_t dirty_lo, dirty_hi;
>
> @@ -117,11 +118,23 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
>     /* Get pipeline state. */
>     switch (pipeline) {
>     case ST_PIPELINE_RENDER:
> -      check_attrib_edgeflag(st);
> +      if (st->ctx->API != API_OPENGL_CORE)

I think that should be == API_OPENGL_COMPAT. Pretty sure ES doesn't
have it either.

> +         check_attrib_edgeflag(st);
> +
>        check_program_state(st);
>        st_manager_validate_framebuffers(st);
>
>        pipeline_mask = ST_PIPELINE_RENDER_STATE_MASK;
> +
> +      /* Don't update states that have no effect. */
> +      if (!ctx->TessCtrlProgram._Current)
> +         pipeline_mask &= ~ST_NEW_TCS_RESOURCES;
> +      if (!ctx->TessEvalProgram._Current)
> +         pipeline_mask &= ~ST_NEW_TES_RESOURCES;
> +      if (!ctx->GeometryProgram._Current)
> +         pipeline_mask &= ~ST_NEW_GS_RESOURCES;
> +      if (!ctx->Transform.ClipPlanesEnabled)
> +         pipeline_mask &= ~ST_NEW_CLIP_STATE;
>        break;
>     case ST_PIPELINE_COMPUTE:
>        pipeline_mask = ST_PIPELINE_COMPUTE_STATE_MASK;
> diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
> index 871afc6..961c395 100644
> --- a/src/mesa/state_tracker/st_atom.h
> +++ b/src/mesa/state_tracker/st_atom.h
> @@ -99,30 +99,36 @@ enum {
>                                   ST_NEW_CLIP_STATE | \
>                                   ST_NEW_RASTERIZER)
>
> -#define ST_NEW_TESSCTRL_PROGRAM (ST_NEW_TCS_STATE | \
> -                                 ST_NEW_TCS_SAMPLER_VIEWS | \
> +#define ST_NEW_TCS_RESOURCES    (ST_NEW_TCS_SAMPLER_VIEWS | \
>                                   ST_NEW_TCS_IMAGES | \
>                                   ST_NEW_TCS_CONSTANTS | \
>                                   ST_NEW_TCS_UBOS | \
>                                   ST_NEW_TCS_ATOMICS | \
>                                   ST_NEW_TCS_SSBOS)
>
> -#define ST_NEW_TESSEVAL_PROGRAM (ST_NEW_TES_STATE | \
> -                                 ST_NEW_TES_SAMPLER_VIEWS | \
> +#define ST_NEW_TESSCTRL_PROGRAM (ST_NEW_TCS_STATE | \
> +                                 ST_NEW_TCS_RESOURCES)
> +
> +#define ST_NEW_TES_RESOURCES    (ST_NEW_TES_SAMPLER_VIEWS | \
>                                   ST_NEW_TES_IMAGES | \
>                                   ST_NEW_TES_CONSTANTS | \
>                                   ST_NEW_TES_UBOS | \
>                                   ST_NEW_TES_ATOMICS | \
> -                                 ST_NEW_TES_SSBOS | \
> +                                 ST_NEW_TES_SSBOS)
> +
> +#define ST_NEW_TESSEVAL_PROGRAM (ST_NEW_TES_STATE | \
> +                                 ST_NEW_TES_RESOURCES | \
>                                   ST_NEW_RASTERIZER)
>
> -#define ST_NEW_GEOMETRY_PROGRAM (ST_NEW_GS_STATE | \
> -                                 ST_NEW_GS_SAMPLER_VIEWS | \
> +#define ST_NEW_GS_RESOURCES     (ST_NEW_GS_SAMPLER_VIEWS | \
>                                   ST_NEW_GS_IMAGES | \
>                                   ST_NEW_GS_CONSTANTS | \
>                                   ST_NEW_GS_UBOS | \
>                                   ST_NEW_GS_ATOMICS | \
> -                                 ST_NEW_GS_SSBOS | \
> +                                 ST_NEW_GS_SSBOS)
> +
> +#define ST_NEW_GEOMETRY_PROGRAM (ST_NEW_GS_STATE | \
> +                                 ST_NEW_GS_RESOURCES | \
>                                   ST_NEW_RASTERIZER)
>
>  #define ST_NEW_FRAGMENT_PROGRAM (ST_NEW_FS_STATE | \
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list