From af04f17909109b91425ac21d0d9d54f2ec3b59af Mon Sep 17 00:00:00 2001 From: "duncan.hopkins" Date: Fri, 27 Oct 2023 12:14:13 +0100 Subject: [PATCH] glx: Switched DRI2 functions over to use Apple specific alternatives and extension name. DRI2 calls are different between Linux and MacOS. Calling these Linux version on MacOS using xquartz fails with 'unknown' codes. This patch hardwires a number of the utility DRI2 functions to use the MacOS specific version that already exist for APPLEGL. Part-of: --- src/glx/dri2.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/glx/dri2.c b/src/glx/dri2.c index 36728285f08..a6b7e9e759f 100644 --- a/src/glx/dri2.c +++ b/src/glx/dri2.c @@ -42,6 +42,11 @@ #include "glxclient.h" #include "GL/glxext.h" +#if defined(__APPLE__) || defined(__MACOSX) +#include "apple/appledri.h" +#include "apple/appledristr.h" +#endif + /* Allow the build to work with an older versions of dri2proto.h and * dri2tokens.h. */ @@ -52,7 +57,11 @@ #endif +#if defined(__APPLE__) || defined(__MACOSX) +static char dri2ExtensionName[] = APPLEDRINAME; +#else static char dri2ExtensionName[] = DRI2_NAME; +#endif static XExtensionInfo _dri2Info_data; static XExtensionInfo *dri2Info = &_dri2Info_data; static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info) @@ -207,6 +216,9 @@ DRI2Error(Display *display, xError *err, XExtCodes *codes, int *ret_code) Bool DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase) { +#if defined(__APPLE__) || defined(__MACOSX) + return XAppleDRIQueryExtension(dpy, eventBase, errorBase); +#else XExtDisplayInfo *info = DRI2FindDisplay(dpy); if (XextHasExtension(info)) { @@ -216,11 +228,16 @@ DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase) } return False; +#endif } Bool DRI2QueryVersion(Display * dpy, int *major, int *minor) { +#if defined(__APPLE__) || defined(__MACOSX) + int patch; + return XAppleDRIQueryVersion(dpy, major, minor, &patch); +#else XExtDisplayInfo *info = DRI2FindDisplay(dpy); xDRI2QueryVersionReply rep; xDRI2QueryVersionReq *req; @@ -263,6 +280,7 @@ DRI2QueryVersion(Display * dpy, int *major, int *minor) } return True; +#endif } Bool