[Mesa-dev] [PATCH 15/15] st/mesa: inline _mesa_create_context() into its only caller

Emil Velikov emil.l.velikov at gmail.com
Tue Jun 7 16:33:48 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

Inline the function into it's only caller. This way it's more obvious
how the classic and gallium drivers (st/mesa) use _mesa_initialize_context.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/mesa/main/context.c             | 38 -------------------------------------
 src/mesa/main/context.h             |  6 ------
 src/mesa/state_tracker/st_context.c |  8 ++++++--
 3 files changed, 6 insertions(+), 46 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index f8961fc..64d93de 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1261,44 +1261,6 @@ fail:
 
 
 /**
- * Allocate and initialize a struct gl_context structure.
- * Note that the driver needs to pass in its dd_function_table here since
- * we need to at least call driverFunctions->NewTextureObject to initialize
- * the rendering context.
- *
- * \param api the GL API type to create the context for
- * \param visual a struct gl_config pointer (we copy the struct contents) or
- *               NULL to create a configless context
- * \param share_list another context to share display lists with or NULL
- * \param driverFunctions points to the dd_function_table into which the
- *        driver has plugged in all its special functions.
- * 
- * \return pointer to a new __struct gl_contextRec or NULL if error.
- */
-struct gl_context *
-_mesa_create_context(gl_api api,
-                     const struct gl_config *visual,
-                     struct gl_context *share_list,
-                     const struct dd_function_table *driverFunctions)
-{
-   struct gl_context *ctx;
-
-   ctx = calloc(1, sizeof(struct gl_context));
-   if (!ctx)
-      return NULL;
-
-   if (_mesa_initialize_context(ctx, api, visual, share_list,
-                                driverFunctions)) {
-      return ctx;
-   }
-   else {
-      free(ctx);
-      return NULL;
-   }
-}
-
-
-/**
  * Free the data associated with the given context.
  * 
  * But doesn't free the struct gl_context struct itself.
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 0ec94ec..63493f0 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -113,12 +113,6 @@ _mesa_initialize_context( struct gl_context *ctx,
                           struct gl_context *share_list,
                           const struct dd_function_table *driverFunctions);
 
-extern struct gl_context *
-_mesa_create_context(gl_api api,
-                     const struct gl_config *visual,
-                     struct gl_context *share_list,
-                     const struct dd_function_table *driverFunctions);
-
 extern void
 _mesa_free_context_data( struct gl_context *ctx );
 
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 1ee0aec..0c4bd10 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -412,8 +412,12 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
    memset(&funcs, 0, sizeof(funcs));
    st_init_driver_functions(pipe->screen, &funcs);
 
-   ctx = _mesa_create_context(api, visual, shareCtx, &funcs);
-   if (!ctx) {
+   ctx = calloc(1, sizeof(struct gl_context));
+   if (!ctx)
+      return NULL;
+
+   if (!_mesa_initialize_context(ctx, api, visual, shareCtx, &funcs)) {
+      free(ctx);
       return NULL;
    }
 
-- 
2.8.2



More information about the mesa-dev mailing list