Mesa (master): mesa: inline vbo_exec_invalidate_state() and call from mesa core

Timothy Arceri tarceri at kemper.freedesktop.org
Thu Jun 8 23:14:02 UTC 2017


Module: Mesa
Branch: master
Commit: bc70bad59bde311434349bbe07b7fb1d3b0ec559
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc70bad59bde311434349bbe07b7fb1d3b0ec559

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Wed Jun  7 13:26:16 2017 +1000

mesa: inline vbo_exec_invalidate_state() and call from mesa core

Rather than calling it indirectly in each driver.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/mesa/drivers/dri/i915/i915_context.c     |  1 -
 src/mesa/drivers/dri/i915/intel_context.c    |  1 -
 src/mesa/drivers/dri/i965/brw_context.c      |  1 -
 src/mesa/drivers/dri/nouveau/nouveau_state.c |  1 -
 src/mesa/drivers/dri/r200/r200_state.c       |  1 -
 src/mesa/drivers/dri/radeon/radeon_state.c   |  1 -
 src/mesa/drivers/dri/swrast/swrast.c         |  1 -
 src/mesa/drivers/osmesa/osmesa.c             |  1 -
 src/mesa/drivers/x11/xm_dd.c                 |  1 -
 src/mesa/main/state.c                        |  5 ++++-
 src/mesa/state_tracker/st_context.c          |  5 -----
 src/mesa/vbo/vbo.h                           |  1 -
 src/mesa/vbo/vbo_context.c                   |  6 ------
 src/mesa/vbo/vbo_context.h                   | 18 ++++++++++++++++++
 src/mesa/vbo/vbo_exec.c                      | 22 ----------------------
 src/mesa/vbo/vbo_exec.h                      |  1 -
 16 files changed, 22 insertions(+), 45 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c
index 1406b65b65..4d89af182d 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -58,7 +58,6 @@ i915InvalidateState(struct gl_context * ctx)
 
    _swrast_InvalidateState(ctx, new_state);
    _swsetup_InvalidateState(ctx, new_state);
-   _vbo_InvalidateState(ctx, new_state);
    _tnl_InvalidateState(ctx, new_state);
    _tnl_invalidate_vertex_state(ctx, new_state);
    intel_context(ctx)->NewGLState |= new_state;
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index 6c59b425a9..7f3924573f 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -321,7 +321,6 @@ intelInvalidateState(struct gl_context * ctx)
 
     if (ctx->swrast_context)
        _swrast_InvalidateState(ctx, new_state);
-   _vbo_InvalidateState(ctx, new_state);
 
    intel->NewGLState |= new_state;
 
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 81166450b9..6d27866fce 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -196,7 +196,6 @@ intel_update_state(struct gl_context * ctx)
 
    if (ctx->swrast_context)
       _swrast_InvalidateState(ctx, new_state);
-   _vbo_InvalidateState(ctx, new_state);
 
    brw->NewGLState |= new_state;
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index 567f32fa43..6d998fca83 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -494,7 +494,6 @@ nouveau_update_state(struct gl_context *ctx)
 
 	_swrast_InvalidateState(ctx, new_state);
 	_tnl_InvalidateState(ctx, new_state);
-	_vbo_InvalidateState(ctx, new_state);
 
 	nouveau_state_emit(ctx);
 }
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index d5a6f09174..30437e3201 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -2284,7 +2284,6 @@ static void r200InvalidateState(struct gl_context *ctx)
 
    _swrast_InvalidateState( ctx, new_state );
    _swsetup_InvalidateState( ctx, new_state );
-   _vbo_InvalidateState( ctx, new_state );
    _tnl_InvalidateState( ctx, new_state );
    R200_CONTEXT(ctx)->radeon.NewGLState |= new_state;
 
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index ff2a7089dd..940f8de3b4 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -2050,7 +2050,6 @@ static void radeonInvalidateState(struct gl_context *ctx)
 
    _swrast_InvalidateState( ctx, new_state );
    _swsetup_InvalidateState( ctx, new_state );
-   _vbo_InvalidateState( ctx, new_state );
    _tnl_InvalidateState( ctx, new_state );
    R100_CONTEXT(ctx)->radeon.NewGLState |= new_state;
 }
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index a68f7a0b96..3b1de420f6 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -704,7 +704,6 @@ update_state(struct gl_context *ctx)
     /* not much to do here - pass it on */
     _swrast_InvalidateState( ctx, new_state );
     _swsetup_InvalidateState( ctx, new_state );
-    _vbo_InvalidateState( ctx, new_state );
     _tnl_InvalidateState( ctx, new_state );
 }
 
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index ed69353743..c77dcc4d37 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -123,7 +123,6 @@ osmesa_update_state(struct gl_context *ctx, GLuint new_state)
    _swrast_InvalidateState( ctx, new_state );
    _swsetup_InvalidateState( ctx, new_state );
    _tnl_InvalidateState( ctx, new_state );
-   _vbo_InvalidateState( ctx, new_state );
 }
 
 static void
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index e06831ca77..61aa6c88aa 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -689,7 +689,6 @@ xmesa_update_state(struct gl_context *ctx)
     */
    _swrast_InvalidateState( ctx, new_state );
    _tnl_InvalidateState( ctx, new_state );
-   _vbo_InvalidateState( ctx, new_state );
    _swsetup_InvalidateState( ctx, new_state );
 
    if (_mesa_is_user_fbo(ctx->DrawBuffer))
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 04dafa983c..b7e165fab6 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -51,6 +51,7 @@
 #include "texobj.h"
 #include "texstate.h"
 #include "varray.h"
+#include "vbo/vbo_context.h"
 #include "viewport.h"
 #include "blend.h"
 
@@ -410,13 +411,15 @@ _mesa_update_state_locked( struct gl_context *ctx )
  out:
    new_prog_state |= update_program_constants(ctx);
 
+   ctx->NewState |= new_prog_state;
+   vbo_exec_invalidate_state(ctx);
+
    /*
     * Give the driver a chance to act upon the new_state flags.
     * The driver might plug in different span functions, for example.
     * Also, this is where the driver can invalidate the state of any
     * active modules (such as swrast_setup, swrast, tnl, etc).
     */
-   ctx->NewState |= new_prog_state;
    ctx->Driver.UpdateState(ctx);
    ctx->NewState = 0;
    ctx->Array.VAO->NewArrays = 0x0;
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 0e768ea9e4..743c7bde28 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -279,11 +279,6 @@ st_invalidate_state(struct gl_context * ctx)
 
    if (new_state & _NEW_PROGRAM_CONSTANTS)
       st->dirty |= st->active_states & ST_NEW_CONSTANTS;
-
-   /* This is the only core Mesa module we depend upon.
-    * No longer use swrast, swsetup, tnl.
-    */
-   _vbo_InvalidateState(ctx, new_state);
 }
 
 
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index 79f75386f7..eec484b376 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -78,7 +78,6 @@ struct _mesa_index_buffer {
 
 GLboolean _vbo_CreateContext( struct gl_context *ctx );
 void _vbo_DestroyContext( struct gl_context *ctx );
-void _vbo_InvalidateState( struct gl_context *ctx, GLbitfield new_state );
 
 
 void
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index 384e40516c..a5f915d9bd 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -227,12 +227,6 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx )
 }
 
 
-void _vbo_InvalidateState( struct gl_context *ctx, GLbitfield new_state )
-{
-   vbo_exec_invalidate_state(ctx, new_state);
-}
-
-
 void _vbo_DestroyContext( struct gl_context *ctx )
 {
    struct vbo_context *vbo = vbo_context(ctx);
diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h
index 5cf399ffcd..0418643f8f 100644
--- a/src/mesa/vbo/vbo_context.h
+++ b/src/mesa/vbo/vbo_context.h
@@ -56,6 +56,7 @@
 #include "vbo_exec.h"
 #include "vbo_save.h"
 
+#include "main/api_arrayelt.h"
 #include "main/macros.h"
 
 #ifdef __cplusplus
@@ -91,6 +92,23 @@ static inline struct vbo_context *vbo_context(struct gl_context *ctx)
 }
 
 
+static inline void
+vbo_exec_invalidate_state(struct gl_context *ctx)
+{
+   struct vbo_context *vbo = vbo_context(ctx);
+   struct vbo_exec_context *exec = &vbo->exec;
+
+   if (!exec->validating && ctx->NewState & (_NEW_PROGRAM | _NEW_ARRAY)) {
+      exec->array.recalculate_inputs = GL_TRUE;
+   }
+
+   if (ctx->NewState & _NEW_EVAL)
+      exec->eval.recalculate_maps = GL_TRUE;
+
+   _ae_invalidate_state(ctx, ctx->NewState);
+}
+
+
 /**
  * Return VP_x token to indicate whether we're running fixed-function
  * vertex transformation, an NV vertex program or ARB vertex program/shader.
diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c
index de8461f1fc..dc26dfd37b 100644
--- a/src/mesa/vbo/vbo_exec.c
+++ b/src/mesa/vbo/vbo_exec.c
@@ -26,7 +26,6 @@
  */
 
 
-#include "main/api_arrayelt.h"
 #include "main/glheader.h"
 #include "main/mtypes.h"
 #include "main/vtxfmt.h"
@@ -71,27 +70,6 @@ void vbo_exec_destroy( struct gl_context *ctx )
 
 
 /**
- * Really want to install these callbacks to a central facility to be
- * invoked according to the state flags.  That will have to wait for a
- * mesa rework:
- */ 
-void vbo_exec_invalidate_state( struct gl_context *ctx, GLbitfield new_state )
-{
-   struct vbo_context *vbo = vbo_context(ctx);
-   struct vbo_exec_context *exec = &vbo->exec;
-
-   if (!exec->validating && new_state & (_NEW_PROGRAM|_NEW_ARRAY)) {
-      exec->array.recalculate_inputs = GL_TRUE;
-   }
-
-   if (new_state & _NEW_EVAL)
-      exec->eval.recalculate_maps = GL_TRUE;
-
-   _ae_invalidate_state(ctx, new_state);
-}
-
-
-/**
  * Figure out the number of transform feedback primitives that will be output
  * considering the drawing mode, number of vertices, and instance count,
  * assuming that no geometry shading is done and primitive restart is not
diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
index 9358ca2acf..f1e3881b1f 100644
--- a/src/mesa/vbo/vbo_exec.h
+++ b/src/mesa/vbo/vbo_exec.h
@@ -147,7 +147,6 @@ struct vbo_exec_context
  */
 void vbo_exec_init( struct gl_context *ctx );
 void vbo_exec_destroy( struct gl_context *ctx );
-void vbo_exec_invalidate_state( struct gl_context *ctx, GLbitfield new_state );
 
 
 /* Internal functions:




More information about the mesa-commit mailing list