Mesa (master): intel: Make our context structure be a ralloc context.

Eric Anholt anholt at kemper.freedesktop.org
Mon Jul 11 16:27:34 UTC 2011


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu May  5 19:01:25 2011 -0700

intel: Make our context structure be a ralloc context.

This will let me hang cached compiler structs off of the context
without having to worry about cleaning them up at destroy time.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i915/i830_context.c   |    3 ++-
 src/mesa/drivers/dri/i915/i915_context.c   |    4 ++--
 src/mesa/drivers/dri/i965/brw_context.c    |    3 ++-
 src/mesa/drivers/dri/intel/intel_context.c |    4 ++--
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c
index abfb32b..d22118b 100644
--- a/src/mesa/drivers/dri/i915/i830_context.c
+++ b/src/mesa/drivers/dri/i915/i830_context.c
@@ -33,6 +33,7 @@
 #include "tnl/t_pipeline.h"
 #include "intel_span.h"
 #include "intel_tris.h"
+#include "../glsl/ralloc.h"
 
 /***************************************
  * Mesa's Driver Functions
@@ -53,7 +54,7 @@ i830CreateContext(const struct gl_config * mesaVis,
                   void *sharedContextPrivate)
 {
    struct dd_function_table functions;
-   struct i830_context *i830 = CALLOC_STRUCT(i830_context);
+   struct i830_context *i830 = rzalloc(NULL, struct i830_context);
    struct intel_context *intel = &i830->intel;
    struct gl_context *ctx = &intel->ctx;
    if (!i830)
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c
index f02f2d7..11bee14 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -36,6 +36,7 @@
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
 #include "tnl/tnl.h"
+#include "../glsl/ralloc.h"
 
 #include "i915_reg.h"
 #include "i915_program.h"
@@ -97,8 +98,7 @@ i915CreateContext(int api,
                   void *sharedContextPrivate)
 {
    struct dd_function_table functions;
-   struct i915_context *i915 =
-      (struct i915_context *) CALLOC_STRUCT(i915_context);
+   struct i915_context *i915 = rzalloc(NULL, struct i915_context);
    struct intel_context *intel = &i915->intel;
    struct gl_context *ctx = &intel->ctx;
 
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 6368218..ac683bd 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -40,6 +40,7 @@
 #include "brw_state.h"
 #include "intel_span.h"
 #include "tnl/t_pipeline.h"
+#include "../glsl/ralloc.h"
 
 /***************************************
  * Mesa's Driver Functions
@@ -59,7 +60,7 @@ GLboolean brwCreateContext( int api,
 			    void *sharedContextPrivate)
 {
    struct dd_function_table functions;
-   struct brw_context *brw = (struct brw_context *) CALLOC_STRUCT(brw_context);
+   struct brw_context *brw = rzalloc(NULL, struct brw_context);
    struct intel_context *intel = &brw->intel;
    struct gl_context *ctx = &intel->ctx;
    unsigned i;
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 292b7b0..2ba1363 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -56,7 +56,7 @@
 
 #include "drirenderbuffer.h"
 #include "utils.h"
-
+#include "../glsl/ralloc.h"
 
 #ifndef INTEL_DEBUG
 int INTEL_DEBUG = (0);
@@ -924,7 +924,7 @@ intelDestroyContext(__DRIcontext * driContextPriv)
 
       _math_matrix_dtr(&intel->ViewportMatrix);
 
-      FREE(intel);
+      ralloc_free(intel);
       driContextPriv->driverPrivate = NULL;
    }
 }




More information about the mesa-commit mailing list