glx: Pull get_proc_address out of the context vtable
authorAdam Jackson <ajax@redhat.com>
Thu, 18 Mar 2021 15:36:12 +0000 (11:36 -0400)
committerAdam Jackson <ajax@redhat.com>
Fri, 19 Mar 2021 15:13:07 +0000 (11:13 -0400)
One, only applegl needs this. Two, this isn't a function of the context
in any way so it doesn't belong in the context vtable. Just special-case
applegl for now, we can revisit applegl's dispatch later.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9690>

src/glx/applegl_glx.c
src/glx/dri2_glx.c
src/glx/dri3_glx.c
src/glx/drisw_glx.c
src/glx/driwindows_glx.c
src/glx/glxclient.h
src/glx/glxcmds.c
src/glx/indirect_glx.c

index b15e533..31da9d0 100644 (file)
@@ -102,7 +102,7 @@ applegl_wait_x(struct glx_context *gc)
    apple_glx_waitx(dpy, gc->driContext);
 }
 
-static void *
+void *
 applegl_get_proc_address(const char *symbol)
 {
    return dlsym(apple_cgl_get_dl_handle(), symbol);
@@ -116,7 +116,6 @@ static const struct glx_context_vtable applegl_context_vtable = {
    .wait_x              = applegl_wait_x,
    .bind_tex_image      = NULL,
    .release_tex_image   = NULL,
-   .get_proc_address    = applegl_get_proc_address,
 };
 
 struct glx_context *
index 53bebe7..ffc34ab 100644 (file)
@@ -1049,7 +1049,6 @@ static const struct glx_context_vtable dri2_context_vtable = {
    .wait_x              = dri2_wait_x,
    .bind_tex_image      = dri2_bind_tex_image,
    .release_tex_image   = dri2_release_tex_image,
-   .get_proc_address    = NULL,
    .interop_query_device_info = dri2_interop_query_device_info,
    .interop_export_object = dri2_interop_export_object
 };
index 4afad89..c07844d 100644 (file)
@@ -716,7 +716,6 @@ static const struct glx_context_vtable dri3_context_vtable = {
    .wait_x              = dri3_wait_x,
    .bind_tex_image      = dri3_bind_tex_image,
    .release_tex_image   = dri3_release_tex_image,
-   .get_proc_address    = NULL,
    .interop_query_device_info = dri3_interop_query_device_info,
    .interop_export_object = dri3_interop_export_object
 };
index 32a876c..4089f9f 100644 (file)
@@ -478,7 +478,6 @@ static const struct glx_context_vtable drisw_context_vtable = {
    .wait_x              = NULL,
    .bind_tex_image      = drisw_bind_tex_image,
    .release_tex_image   = drisw_release_tex_image,
-   .get_proc_address    = NULL,
 };
 
 static struct glx_context *
index 0df7e49..a167a19 100644 (file)
@@ -152,7 +152,6 @@ static const struct glx_context_vtable driwindows_context_vtable = {
    .wait_x              = NULL,
    .bind_tex_image      = driwindows_bind_tex_image,
    .release_tex_image   = driwindows_release_tex_image,
-   .get_proc_address    = NULL,
 };
 
 static struct glx_context *
index ecda3e5..178b4cb 100644 (file)
@@ -231,7 +231,6 @@ struct glx_context_vtable {
                          GLXDrawable drawable,
                          int buffer, const int *attrib_list);
    void (*release_tex_image)(Display * dpy, GLXDrawable drawable, int buffer);
-   void * (*get_proc_address)(const char *symbol);
    int (*interop_query_device_info)(struct glx_context *ctx,
                                     struct mesa_glinterop_device_info *out);
    int (*interop_export_object)(struct glx_context *ctx,
@@ -807,6 +806,9 @@ applegl_create_context(struct glx_screen *psc,
 
 extern int
 applegl_create_display(struct glx_display *display);
+
+extern void *
+applegl_get_proc_address(const char *symbol);
 #endif
 
 extern Bool validate_renderType_against_config(const struct glx_config *config,
index 9a16cce..8cef528 100644 (file)
@@ -2648,12 +2648,10 @@ _GLX_PUBLIC void (*glXGetProcAddressARB(const GLubyte * procName)) (void)
 #endif
       if (!f)
          f = (gl_function) _glapi_get_proc_address((const char *) procName);
-      if (!f) {
-         struct glx_context *gc = __glXGetCurrentContext();
-      
-         if (gc != NULL && gc->vtable->get_proc_address != NULL)
-            f = gc->vtable->get_proc_address((const char *) procName);
-      }
+#ifdef GLX_USE_APPLEGL
+      if (!f)
+         f = applegl_get_proc_address((const char *) procName);
+#endif
    }
    return f;
 }
index 3e27929..ce52779 100644 (file)
@@ -320,7 +320,6 @@ static const struct glx_context_vtable indirect_context_vtable = {
    .wait_x              = indirect_wait_x,
    .bind_tex_image      = indirect_bind_tex_image,
    .release_tex_image   = indirect_release_tex_image,
-   .get_proc_address    = NULL,
 };
 
 _X_HIDDEN struct glx_context *