From 45d159cb4102aac7eab095c6567707779518933b Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 16 Jul 2020 17:29:26 -0400 Subject: [PATCH] glx: Fix build and warnings with -Dglx=dri -Dglx-direct=false Acked-by: Matt Turner Part-of: --- src/glx/dri_common.h | 4 ++++ src/glx/glx_pbuffer.c | 2 +- src/glx/glxcmds.c | 24 ++++++++---------------- src/mapi/glapi/gen/glX_proto_send.py | 4 +--- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h index 1b74397063b..6c634d81608 100644 --- a/src/glx/dri_common.h +++ b/src/glx/dri_common.h @@ -36,6 +36,8 @@ #ifndef _DRI_COMMON_H #define _DRI_COMMON_H +#ifdef GLX_DIRECT_RENDERING + #include #include #include "loader.h" @@ -83,4 +85,6 @@ dri2_check_no_error(uint32_t flags, struct glx_context *share_context, int major, unsigned *error); +#endif /* GLX_DIRECT_RENDERING */ + #endif /* _DRI_COMMON_H */ diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c index 515099aa0d8..b654168324c 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -86,10 +86,10 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable, struct glx_display *priv = __glXInitialize(dpy); #ifdef GLX_DIRECT_RENDERING __GLXDRIdrawable *pdraw; + int i; #endif CARD32 *output; CARD8 opcode; - int i; if ((priv == NULL) || (dpy == NULL) || (drawable == 0)) { return; diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 8927976f587..8766b007d73 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -1731,7 +1731,9 @@ __glXSwapIntervalSGI(int interval) { xGLXVendorPrivateReq *req; struct glx_context *gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING struct glx_screen *psc; +#endif Display *dpy; CARD32 *interval_ptr; CARD8 opcode; @@ -1744,9 +1746,9 @@ __glXSwapIntervalSGI(int interval) return GLX_BAD_VALUE; } +#ifdef GLX_DIRECT_RENDERING psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen); -#ifdef GLX_DIRECT_RENDERING if (gc->isDirect && psc && psc->driScreen && psc->driScreen->setSwapInterval) { __GLXDRIdrawable *pdraw = @@ -1846,32 +1848,26 @@ __glXGetSwapIntervalMESA(void) static int __glXGetVideoSyncSGI(unsigned int *count) { +#ifdef GLX_DIRECT_RENDERING int64_t ust, msc, sbc; int ret; struct glx_context *gc = __glXGetCurrentContext(); struct glx_screen *psc; -#ifdef GLX_DIRECT_RENDERING __GLXDRIdrawable *pdraw; -#endif if (gc == &dummyContext) return GLX_BAD_CONTEXT; -#ifdef GLX_DIRECT_RENDERING if (!gc->isDirect) return GLX_BAD_CONTEXT; -#endif psc = GetGLXScreenConfigs(gc->currentDpy, gc->screen); -#ifdef GLX_DIRECT_RENDERING pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable); -#endif /* FIXME: Looking at the GLX_SGI_video_sync spec in the extension registry, * FIXME: there should be a GLX encoding for this call. I can find no * FIXME: documentation for the GLX encoding. */ -#ifdef GLX_DIRECT_RENDERING if (psc && psc->driScreen && psc->driScreen->getDrawableMSC) { ret = psc->driScreen->getDrawableMSC(psc, pdraw, &ust, &msc, &sbc); *count = (unsigned) msc; @@ -1886,12 +1882,12 @@ static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) { struct glx_context *gc = __glXGetCurrentContext(); - struct glx_screen *psc; #ifdef GLX_DIRECT_RENDERING + struct glx_screen *psc; __GLXDRIdrawable *pdraw; -#endif int64_t ust, msc, sbc; int ret; +#endif if (divisor <= 0 || remainder < 0) return GLX_BAD_VALUE; @@ -1902,14 +1898,10 @@ __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) #ifdef GLX_DIRECT_RENDERING if (!gc->isDirect) return GLX_BAD_CONTEXT; -#endif psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen); -#ifdef GLX_DIRECT_RENDERING pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable); -#endif -#ifdef GLX_DIRECT_RENDERING if (psc && psc->driScreen && psc->driScreen->waitForMSC) { ret = psc->driScreen->waitForMSC(pdraw, 0, divisor, remainder, &ust, &msc, &sbc); @@ -2048,11 +2040,11 @@ __glXGetSyncValuesOML(Display * dpy, GLXDrawable drawable, int64_t * ust, int64_t * msc, int64_t * sbc) { struct glx_display * const priv = __glXInitialize(dpy); - int ret; #ifdef GLX_DIRECT_RENDERING + int ret; __GLXDRIdrawable *pdraw; -#endif struct glx_screen *psc; +#endif if (!priv) return False; diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py index a269ff2068d..a55c737d03e 100644 --- a/src/mapi/glapi/gen/glX_proto_send.py +++ b/src/mapi/glapi/gen/glX_proto_send.py @@ -441,10 +441,8 @@ __indirect_get_proc_address(const char *name) print('#define %s %d' % (func.opcode_vendor_name(name), func.glx_vendorpriv)) print('%s gl%s(%s)' % (func.return_type, func_name, func.get_parameter_string())) print('{') - print(' struct glx_context * const gc = __glXGetCurrentContext();') - print('') print('#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)') - print(' if (gc->isDirect) {') + print(' if (((struct glx_context *)__glXGetCurrentContext())->isDirect) {') print(' const _glapi_proc *const disp_table = (_glapi_proc *)GET_DISPATCH();') print(' PFNGL%sPROC p =' % (name.upper())) print(' (PFNGL%sPROC) disp_table[%d];' % (name.upper(), func.offset)) -- 2.30.2