[Mesa-dev] [RFC 3/4] intel/i965: add InitializeVersionFeatures driver function

Jordan Justen jordan.l.justen at intel.com
Wed Nov 14 10:32:21 PST 2012


Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_context.c    |   23 ++++++++++++++++++-----
 src/mesa/drivers/dri/intel/intel_context.c |   18 +++++++++++++-----
 src/mesa/drivers/dri/intel/intel_context.h |    3 +++
 3 files changed, 34 insertions(+), 10 deletions(-)
 mode change 100644 => 100755 src/mesa/drivers/dri/intel/intel_context.c

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 1448965..3aea256 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -55,6 +55,9 @@
  * Mesa's Driver Functions
  ***************************************/
 
+static void
+brwInitializeVersionFeatures(struct gl_context * ctx);
+
 static void brwInitDriverFunctions(struct intel_screen *screen,
 				   struct dd_function_table *functions)
 {
@@ -63,6 +66,8 @@ static void brwInitDriverFunctions(struct intel_screen *screen,
    brwInitFragProgFuncs( functions );
    brw_init_queryobj_functions(functions);
 
+   functions->InitializeVersionFeatures = brwInitializeVersionFeatures;
+
    functions->BeginTransformFeedback = brw_begin_transform_feedback;
 
    if (screen->gen >= 7)
@@ -214,11 +219,6 @@ brwCreateContext(int api,
    ctx->Const.MaxTransformFeedbackSeparateComponents =
       BRW_MAX_SOL_BINDINGS / BRW_MAX_SOL_BUFFERS;
 
-   if (intel->gen == 6)
-      ctx->Const.MaxSamples = 4;
-   else if (intel->gen >= 7)
-      ctx->Const.MaxSamples = 8;
-
    /* if conformance mode is set, swrast can handle any size AA point */
    ctx->Const.MaxPointSizeAA = 255.0;
 
@@ -394,3 +394,16 @@ brwCreateContext(int api,
    return true;
 }
 
+static void
+brwInitializeVersionFeatures(struct gl_context * ctx)
+{
+   struct intel_context *intel = intel_context(ctx);
+
+   intelInitializeVersionFeatures(ctx);
+
+   if (intel->gen == 6)
+      ctx->Const.MaxSamples = 4;
+   else if (intel->gen >= 7)
+      ctx->Const.MaxSamples = 8;
+
+}
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
old mode 100644
new mode 100755
index 204609e..113af90
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -495,6 +495,12 @@ static const struct dri_debug_control debug_control[] = {
 };
 
 
+void
+intelInitializeVersionFeatures(struct gl_context * ctx)
+{
+   intelInitExtensions(ctx);
+}
+
 static void
 intelInvalidateState(struct gl_context * ctx, GLuint new_state)
 {
@@ -561,6 +567,7 @@ intelInitDriverFunctions(struct dd_function_table *functions)
 {
    _mesa_init_driver_functions(functions);
 
+   functions->InitializeVersionFeatures = intelInitializeVersionFeatures;
    functions->Flush = intel_glFlush;
    functions->Finish = intelFinish;
    functions->GetString = intelGetString;
@@ -607,6 +614,11 @@ intelInitContext(struct intel_context *intel,
       mesaVis = &visual;
    }
 
+   intel->bufmgr = intelScreen->bufmgr;
+
+   driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
+                       sPriv->myNum, (intel->gen >= 4) ? "i965" : "i915");
+
    if (!_mesa_initialize_context(&intel->ctx, api, mesaVis, shareCtx,
                                  functions)) {
       printf("%s: failed to init mesa context\n", __FUNCTION__);
@@ -649,15 +661,11 @@ intelInitContext(struct intel_context *intel,
    memset(&ctx->TextureFormatSupported,
 	  0, sizeof(ctx->TextureFormatSupported));
 
-   driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
-                       sPriv->myNum, (intel->gen >= 4) ? "i965" : "i915");
    if (intel->gen < 4)
       intel->maxBatchSize = 4096;
    else
       intel->maxBatchSize = sizeof(intel->batch.map);
 
-   intel->bufmgr = intelScreen->bufmgr;
-
    bo_reuse_mode = driQueryOptioni(&intel->optionCache, "bo_reuse");
    switch (bo_reuse_mode) {
    case DRI_CONF_BO_REUSE_DISABLED:
@@ -741,7 +749,7 @@ intelInitContext(struct intel_context *intel,
 
    intel->RenderIndex = ~0;
 
-   intelInitExtensions(ctx);
+   ctx->Driver.InitializeVersionFeatures(ctx);
 
    INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
    if (INTEL_DEBUG & DEBUG_BUFMGR)
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index eeefadf..218c6fc 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -519,6 +519,9 @@ extern bool intelInitContext(struct intel_context *intel,
                                   void *sharedContextPrivate,
                                   struct dd_function_table *functions);
 
+extern void
+intelInitializeVersionFeatures(struct gl_context * ctx);
+
 extern void intelFinish(struct gl_context * ctx);
 extern void intel_flush_rendering_to_batch(struct gl_context *ctx);
 extern void _intel_flush(struct gl_context * ctx, const char *file, int line);
-- 
1.7.9.5



More information about the mesa-dev mailing list