mesa/st: move some context functions to direct calls
authorDave Airlie <airlied@redhat.com>
Tue, 7 Dec 2021 01:42:56 +0000 (11:42 +1000)
committerMarge Bot <emma+marge@anholt.net>
Wed, 8 Dec 2021 19:06:48 +0000 (19:06 +0000)
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14100>

src/mesa/main/dd.h
src/mesa/main/glthread.c
src/mesa/main/version.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h

index 06f8154..5616a07 100644 (file)
@@ -529,25 +529,6 @@ struct dd_function_table {
    /*@}*/
 
    /**
-    * Indicate that this thread is being used by Mesa as a background drawing
-    * thread for the given GL context.
-    *
-    * If this function is called more than once from any given thread, each
-    * subsequent call overrides the context that was passed in the previous
-    * call.  Mesa takes advantage of this to re-use a background thread to
-    * perform drawing on behalf of multiple contexts.
-    *
-    * Mesa may sometimes call this function from a non-background thread
-    * (i.e. a thread that has already been bound to a context using
-    * __DriverAPIRec::MakeCurrent()); when this happens, ctx will be equal to
-    * the context that is bound to this thread.
-    *
-    * Mesa will only call this function if GL multithreading is enabled.
-    */
-   void (*SetBackgroundContext)(struct gl_context *ctx,
-                                struct util_queue_monitoring *queue_info);
-
-   /**
     * \name GL_ARB_sparse_buffer interface
     */
    /*@{*/
@@ -569,23 +550,6 @@ struct dd_function_table {
                               struct gl_buffer_object *bufObj);
 
    /**
-    * Fill uuid with an unique identifier for this driver
-    *
-    * uuid must point to GL_UUID_SIZE_EXT bytes of available memory
-    */
-   void (*GetDriverUuid)(struct gl_context *ctx, char *uuid);
-
-   /**
-    * Fill uuid with an unique identifier for the device associated
-    * to this driver
-    *
-    * uuid must point to GL_UUID_SIZE_EXT bytes of available memory
-    */
-   void (*GetDeviceUuid)(struct gl_context *ctx, char *uuid);
-
-   /*@}*/
-
-   /**
     * \name GL_ARB_get_program_binary
     */
    /*@{*/
index 49c3502..9738e74 100644 (file)
@@ -40,6 +40,7 @@
 #include "util/u_thread.h"
 #include "util/u_cpu_detect.h"
 
+#include "state_tracker/st_context.h"
 
 static void
 glthread_unmarshal_batch(void *job, void *gdata, int thread_index)
@@ -84,7 +85,7 @@ glthread_thread_initialization(void *job, void *gdata, int thread_index)
 {
    struct gl_context *ctx = (struct gl_context*)job;
 
-   ctx->Driver.SetBackgroundContext(ctx, &ctx->GLThread.stats);
+   st_set_background_context(ctx, &ctx->GLThread.stats);
    _glapi_set_context(ctx);
 }
 
index 33465e2..e2cfff3 100644 (file)
@@ -34,6 +34,8 @@
 #include "version.h"
 #include "git_sha1.h"
 
+#include "state_tracker/st_context.h"
+
 static simple_mtx_t override_lock = _SIMPLE_MTX_INITIALIZER_NP;
 
 /**
@@ -726,13 +728,13 @@ done:
 void
 _mesa_get_driver_uuid(struct gl_context *ctx, GLint *uuid)
 {
-   ctx->Driver.GetDriverUuid(ctx, (char*) uuid);
+   st_get_driver_uuid(ctx, (char*) uuid);
 }
 
 void
 _mesa_get_device_uuid(struct gl_context *ctx, GLint *uuid)
 {
-   ctx->Driver.GetDeviceUuid(ctx, (char*) uuid);
+   st_get_device_uuid(ctx, (char*) uuid);
 }
 
 /**
index 99d8da1..d9e5c82 100644 (file)
@@ -872,7 +872,7 @@ st_emit_string_marker(struct gl_context *ctx, const GLchar *string, GLsizei len)
 }
 
 
-static void
+void
 st_set_background_context(struct gl_context *ctx,
                           struct util_queue_monitoring *queue_info)
 {
@@ -885,7 +885,7 @@ st_set_background_context(struct gl_context *ctx,
 }
 
 
-static void
+void
 st_get_device_uuid(struct gl_context *ctx, char *uuid)
 {
    struct pipe_screen *screen = st_context(ctx)->screen;
@@ -896,7 +896,7 @@ st_get_device_uuid(struct gl_context *ctx, char *uuid)
 }
 
 
-static void
+void
 st_get_driver_uuid(struct gl_context *ctx, char *uuid)
 {
    struct pipe_screen *screen = st_context(ctx)->screen;
@@ -942,10 +942,6 @@ st_init_driver_functions(struct pipe_screen *screen,
    if (screen->get_param(screen, PIPE_CAP_STRING_MARKER))
       functions->EmitStringMarker = st_emit_string_marker;
 
-   functions->SetBackgroundContext = st_set_background_context;
-   functions->GetDriverUuid = st_get_driver_uuid;
-   functions->GetDeviceUuid = st_get_device_uuid;
-
    /* GL_ARB_get_program_binary */
    functions->GetProgramBinaryDriverSHA1 = st_get_program_binary_driver_sha1;
 
index b650696..24f68d4 100644 (file)
@@ -457,7 +457,10 @@ void st_Enable(struct gl_context *ctx, GLenum cap);
 void st_query_memory_info(struct gl_context *ctx, struct gl_memory_info *out);
 
 void st_invalidate_state(struct gl_context *ctx);
-
+void st_get_driver_uuid(struct gl_context *ctx, char *uuid);
+void st_get_device_uuid(struct gl_context *ctx, char *uuid);
+void st_set_background_context(struct gl_context *ctx,
+                               struct util_queue_monitoring *queue_info);
 #ifdef __cplusplus
 }
 #endif