From a7292f2920a28a190ca39ce530454a852ec36d59 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 19 Jul 2010 22:40:22 -0400 Subject: [PATCH] glx: Move DRI CopySubBuffer extension to DRI1 code We do this in the X server for DRI2. --- src/glx/dri2_glx.c | 2 +- src/glx/dri_common.c | 25 ------------------------- src/glx/dri_common.h | 3 --- src/glx/dri_glx.c | 17 +++++++++++++---- src/glx/drisw_glx.c | 1 - src/glx/glxclient.h | 5 ----- 6 files changed, 14 insertions(+), 39 deletions(-) diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index df7ad477ffd..4fbe9496b11 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -675,6 +675,7 @@ dri2BindExtensions(struct dri2_screen *psc, const __DRIextension **extensions) __glXEnableDirectExtension(&psc->base, "GLX_SGI_video_sync"); __glXEnableDirectExtension(&psc->base, "GLX_SGI_swap_control"); __glXEnableDirectExtension(&psc->base, "GLX_MESA_swap_control"); + __glXEnableDirectExtension(&psc->base, "GLX_SGI_make_current_read"); /* FIXME: if DRI2 version supports it... */ __glXEnableDirectExtension(&psc->base, "INTEL_swap_event"); @@ -779,7 +780,6 @@ dri2CreateScreen(int screen, __GLXdisplayPrivate * priv) } extensions = psc->core->getExtensions(psc->driScreen); - driBindCommonExtensions(&psc->base, extensions); dri2BindExtensions(psc, extensions); psc->base.configs = diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 796654a65d0..eb9f1e4b397 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -346,29 +346,4 @@ driDestroyConfigs(const __DRIconfig **configs) free(configs); } -/* Bind extensions common to DRI1 and DRI2 */ -_X_HIDDEN void -driBindCommonExtensions(__GLXscreenConfigs *psc, - const __DRIextension **extensions) -{ - int i; - - for (i = 0; extensions[i]; i++) { -#ifdef __DRI_COPY_SUB_BUFFER - if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) { - psc->driCopySubBuffer = (__DRIcopySubBufferExtension *) extensions[i]; - __glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer"); - } -#endif - -#ifdef __DRI_READ_DRAWABLE - if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) { - __glXEnableDirectExtension(psc, "GLX_SGI_make_current_read"); - } -#endif - - /* Ignore unknown extensions */ - } -} - #endif /* GLX_DIRECT_RENDERING */ diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h index 509ddab8edd..44104969e24 100644 --- a/src/glx/dri_common.h +++ b/src/glx/dri_common.h @@ -58,7 +58,4 @@ extern void ErrorMessageF(const char *f, ...); extern void *driOpenDriver(const char *driverName); -extern void driBindCommonExtensions(__GLXscreenConfigs * psc, - const __DRIextension **extensions); - #endif /* _DRI_COMMON_H */ diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c index aba7b1b844e..369d07a27fe 100644 --- a/src/glx/dri_glx.c +++ b/src/glx/dri_glx.c @@ -70,6 +70,7 @@ struct dri_screen const __DRIswapControlExtension *swapControl; const __DRImediaStreamCounterExtension *msc; const __DRIconfig **driver_configs; + const __DRIcopySubBufferExtension *driCopySubBuffer; void *driver; int fd; @@ -652,9 +653,10 @@ driCopySubBuffer(__GLXDRIdrawable * pdraw, int x, int y, int width, int height) { struct dri_drawable *pdp = (struct dri_drawable *) pdraw; + struct dri_screen *psc = (struct dri_screen *) pdp->base.psc; - (*pdp->base.psc->driCopySubBuffer->copySubBuffer) (pdp->driDrawable, - x, y, width, height); + (*psc->driCopySubBuffer->copySubBuffer) (pdp->driDrawable, + x, y, width, height); } static void @@ -788,6 +790,14 @@ driBindExtensions(struct dri_screen *psc, const __DRIextension **extensions) __glXEnableDirectExtension(&psc->base, "GLX_SGI_video_sync"); } + if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) { + psc->driCopySubBuffer = (__DRIcopySubBufferExtension *) extensions[i]; + __glXEnableDirectExtension(&psc->base, "GLX_MESA_copy_sub_buffer"); + } + + if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) { + __glXEnableDirectExtension(&psc->base, "GLX_SGI_make_current_read"); + } /* Ignore unknown extensions */ } } @@ -852,11 +862,10 @@ driCreateScreen(int screen, __GLXdisplayPrivate *priv) extensions = psc->core->getExtensions(psc->driScreen); driBindExtensions(psc, extensions); - driBindCommonExtensions(&psc->base, extensions); psp = &psc->vtable; psc->base.driScreen = psp; - if (psc->base.driCopySubBuffer) + if (psc->driCopySubBuffer) psp->copySubBuffer = driCopySubBuffer; psp->destroyScreen = driDestroyScreen; diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 94866269c47..441606106ec 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -452,7 +452,6 @@ driCreateScreen(int screen, __GLXdisplayPrivate *priv) } extensions = psc->core->getExtensions(psc->driScreen); - driBindCommonExtensions(&psc->base, extensions); psc->base.configs = driConvertConfigs(psc->core, psc->base.configs, driver_configs); diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index c6c02aee1ea..31d2beb5d42 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -533,11 +533,6 @@ struct __GLXscreenConfigsRec int scr; __GLXDRIscreen *driScreen; - -#ifdef __DRI_COPY_SUB_BUFFER - const __DRIcopySubBufferExtension *driCopySubBuffer; -#endif - #endif /** -- 2.30.2