[Mesa-dev] [PATCH v3 3/7] drivers: compute version and then initialize exec table

Jordan Justen jordan.l.justen at intel.com
Mon Nov 19 17:01:32 PST 2012


This change forces the context version to be computed before
initilizing the exec dispatch tables.

v3:
 * Merge changes to all drivers into a single change
 * Initialize VBO functions after computing the version

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/drivers/dri/i915/i830_context.c       |    8 ++++++++
 src/mesa/drivers/dri/i915/i915_context.c       |    8 ++++++++
 src/mesa/drivers/dri/i965/brw_context.c        |    8 ++++++++
 src/mesa/drivers/dri/nouveau/nouveau_context.c |    6 ++++++
 src/mesa/drivers/dri/r200/r200_context.c       |    6 ++++++
 src/mesa/drivers/dri/radeon/radeon_context.c   |    6 ++++++
 src/mesa/drivers/dri/swrast/swrast.c           |    8 ++++++++
 src/mesa/drivers/osmesa/osmesa.c               |    9 +++++++++
 src/mesa/drivers/windows/gdi/wmesa.c           |    7 +++++++
 src/mesa/drivers/x11/xm_api.c                  |    7 +++++++
 src/mesa/state_tracker/st_context.c            |    8 ++++++++
 src/mesa/state_tracker/st_manager.c            |    2 --
 12 files changed, 81 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c
index 3da0745..e822660 100644
--- a/src/mesa/drivers/dri/i915/i830_context.c
+++ b/src/mesa/drivers/dri/i915/i830_context.c
@@ -26,7 +26,10 @@
  **************************************************************************/
 
 #include "i830_context.h"
+#include "main/api_exec.h"
 #include "main/imports.h"
+#include "main/version.h"
+#include "main/vtxfmt.h"
 #include "tnl/tnl.h"
 #include "tnl/t_vertex.h"
 #include "tnl/t_context.h"
@@ -111,5 +114,10 @@ i830CreateContext(const struct gl_config * mesaVis,
    _tnl_allow_vertex_fog(ctx, 1);
    _tnl_allow_pixel_fog(ctx, 0);
 
+   _mesa_compute_version(ctx);
+
+   _mesa_initialize_exec_table(ctx);
+   _mesa_initialize_vbo_vtxfmt(ctx);
+
    return true;
 }
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c
index c0d1f93..3ef4eca 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -26,8 +26,11 @@
  **************************************************************************/
 
 #include "i915_context.h"
+#include "main/api_exec.h"
 #include "main/imports.h"
 #include "main/macros.h"
+#include "main/version.h"
+#include "main/vtxfmt.h"
 #include "intel_tris.h"
 #include "tnl/t_context.h"
 #include "tnl/t_pipeline.h"
@@ -295,5 +298,10 @@ i915CreateContext(int api,
    _tnl_allow_vertex_fog(ctx, 0);
    _tnl_allow_pixel_fog(ctx, 1);
 
+   _mesa_compute_version(ctx);
+
+   _mesa_initialize_exec_table(ctx);
+   _mesa_initialize_vbo_vtxfmt(ctx);
+
    return true;
 }
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 1448965..296aa46 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -30,9 +30,12 @@
   */
 
 
+#include "main/api_exec.h"
 #include "main/imports.h"
 #include "main/macros.h"
 #include "main/simple_list.h"
+#include "main/version.h"
+#include "main/vtxfmt.h"
 
 #include "vbo/vbo_context.h"
 
@@ -391,6 +394,11 @@ brwCreateContext(int api,
 
    brw_fs_alloc_reg_sets(brw);
 
+   _mesa_compute_version(ctx);
+
+   _mesa_initialize_exec_table(ctx);
+   _mesa_initialize_vbo_vtxfmt(ctx);
+
    return true;
 }
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 80e9395..fc3f30b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -31,12 +31,14 @@
 #include "nouveau_fbo.h"
 #include "nv_object.xml.h"
 
+#include "main/api_exec.h"
 #include "main/dd.h"
 #include "main/framebuffer.h"
 #include "main/fbobject.h"
 #include "main/light.h"
 #include "main/state.h"
 #include "main/version.h"
+#include "main/vtxfmt.h"
 #include "drivers/common/meta.h"
 #include "drivers/common/driverfuncs.h"
 #include "swrast/swrast.h"
@@ -103,6 +105,10 @@ nouveau_context_create(gl_api api,
 	   return GL_FALSE;
 	}
 
+	/* Exec table initialization requires the version to be computed */
+	_mesa_initialize_exec_table(ctx);
+	_mesa_initialize_vbo_vtxfmt(ctx);
+
 	if (nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_VRAM, 0, 4096,
 			   NULL, &nctx->fence)) {
 		nouveau_context_destroy(dri_ctx);
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 677dc8d..80b417c 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -35,12 +35,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <stdbool.h>
 #include "main/glheader.h"
 #include "main/api_arrayelt.h"
+#include "main/api_exec.h"
 #include "main/context.h"
 #include "main/simple_list.h"
 #include "main/imports.h"
 #include "main/extensions.h"
 #include "main/mfeatures.h"
 #include "main/version.h"
+#include "main/vtxfmt.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
@@ -460,6 +462,10 @@ GLboolean r200CreateContext( gl_api api,
 
    _mesa_compute_version(ctx);
 
+   /* Exec table initialization requires the version to be computed */
+   _mesa_initialize_exec_table(ctx);
+   _mesa_initialize_vbo_vtxfmt(ctx);
+
    *error = __DRI_CTX_ERROR_SUCCESS;
    return GL_TRUE;
 }
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 962f08a..7be9a01 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -37,12 +37,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <stdbool.h>
 #include "main/glheader.h"
 #include "main/api_arrayelt.h"
+#include "main/api_exec.h"
 #include "main/context.h"
 #include "main/simple_list.h"
 #include "main/imports.h"
 #include "main/extensions.h"
 #include "main/mfeatures.h"
 #include "main/version.h"
+#include "main/vtxfmt.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
@@ -412,6 +414,10 @@ r100CreateContext( gl_api api,
 
    _mesa_compute_version(ctx);
 
+   /* Exec table initialization requires the version to be computed */
+   _mesa_initialize_exec_table(ctx);
+   _mesa_initialize_vbo_vtxfmt(ctx);
+
    *error = __DRI_CTX_ERROR_SUCCESS;
    return GL_TRUE;
 }
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 45ef3c2..140c701 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -31,12 +31,15 @@
  * The back-buffer is allocated by the driver and is private.
  */
 
+#include "main/api_exec.h"
 #include "main/context.h"
 #include "main/extensions.h"
 #include "main/formats.h"
 #include "main/framebuffer.h"
 #include "main/imports.h"
 #include "main/renderbuffer.h"
+#include "main/version.h"
+#include "main/vtxfmt.h"
 #include "swrast/swrast.h"
 #include "swrast/s_renderbuffer.h"
 #include "swrast_setup/swrast_setup.h"
@@ -786,6 +789,11 @@ dri_create_context(gl_api api,
         break;
     }
 
+    _mesa_compute_version(mesaCtx);
+
+    _mesa_initialize_exec_table(mesaCtx);
+    _mesa_initialize_vbo_vtxfmt(mesaCtx);
+
     *error = __DRI_CTX_ERROR_SUCCESS;
     return GL_TRUE;
 
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 1b12d8c..2a39554 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -35,6 +35,7 @@
 
 #include "main/glheader.h"
 #include "GL/osmesa.h"
+#include "main/api_exec.h"
 #include "main/context.h"
 #include "main/extensions.h"
 #include "main/formats.h"
@@ -43,6 +44,8 @@
 #include "main/macros.h"
 #include "main/mtypes.h"
 #include "main/renderbuffer.h"
+#include "main/version.h"
+#include "main/vtxfmt.h"
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
 #include "swrast/s_context.h"
@@ -787,6 +790,12 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
          swrast->choose_line = osmesa_choose_line;
          swrast->choose_triangle = osmesa_choose_triangle;
       }
+
+      _mesa_compute_version(ctx);
+
+      /* Exec table initialization requires the version to be computed */
+      _mesa_initialize_exec_table(ctx);
+      _mesa_initialize_vbo_vtxfmt(ctx);
    }
    return osmesa;
 }
diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c
index 5728d3a..4a52ac3 100644
--- a/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/src/mesa/drivers/windows/gdi/wmesa.c
@@ -12,6 +12,7 @@
 #include "main/framebuffer.h"
 #include "main/renderbuffer.h"
 #include "main/macros.h"
+#include "main/vtxfmt.h"
 #include "drivers/common/driverfuncs.h"
 #include "drivers/common/meta.h"
 #include "vbo/vbo.h"
@@ -637,6 +638,12 @@ WMesaContext WMesaCreateContext(HDC hDC,
     _swsetup_Wakeup(ctx);
     TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
 
+    _mesa_compute_version(ctx);
+
+    /* Exec table initialization requires the version to be computed */
+    _mesa_initialize_exec_table(ctx);
+    _mesa_initialize_vbo_vtxfmt(ctx);
+
     return c;
 }
 
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 43a97f9..8dc2733 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -71,6 +71,7 @@
 #include "main/macros.h"
 #include "main/renderbuffer.h"
 #include "main/teximage.h"
+#include "main/vtxfmt.h"
 #include "glapi/glthread.h"
 #include "swrast/swrast.h"
 #include "swrast/s_renderbuffer.h"
@@ -958,6 +959,12 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
 
    _mesa_meta_init(mesaCtx);
 
+   _mesa_compute_version(ctx);
+
+    /* Exec table initialization requires the version to be computed */
+   _mesa_initialize_exec_table(ctx);
+   _mesa_initialize_vbo_vtxfmt(ctx);
+
    return c;
 }
 
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 69bd503..fc2e75f 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -27,9 +27,12 @@
 
 #include "main/imports.h"
 #include "main/accum.h"
+#include "main/api_exec.h"
 #include "main/context.h"
 #include "main/samplerobj.h"
 #include "main/shaderobj.h"
+#include "main/version.h"
+#include "main/vtxfmt.h"
 #include "program/prog_cache.h"
 #include "vbo/vbo.h"
 #include "glapi/glapi.h"
@@ -201,6 +204,11 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
    st_init_limits(st);
    st_init_extensions(st);
 
+   _mesa_compute_version(ctx);
+
+   _mesa_initialize_exec_table(ctx);
+   _mesa_initialize_vbo_vtxfmt(ctx);
+
    return st;
 }
 
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 88b886d..505a34f 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -646,8 +646,6 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
 
    /* need to perform version check */
    if (attribs->major > 1 || attribs->minor > 0) {
-      _mesa_compute_version(st->ctx);
-
       /* Is the actual version less than the requested version?  Mesa can't
        * yet enforce the added restrictions of a forward-looking context, so
        * fail that too.
-- 
1.7.10.4



More information about the mesa-dev mailing list