glx: Move DRI CopySubBuffer extension to DRI1 code
authorKristian Høgsberg <krh@bitplanet.net>
Tue, 20 Jul 2010 02:40:22 +0000 (22:40 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 20 Jul 2010 02:45:51 +0000 (22:45 -0400)
We do this in the X server for DRI2.

src/glx/dri2_glx.c
src/glx/dri_common.c
src/glx/dri_common.h
src/glx/dri_glx.c
src/glx/drisw_glx.c
src/glx/glxclient.h

index df7ad477ffd1008f70d57f6c442295836ea83a04..4fbe9496b111420c81e6122953cca0823bfdfc51 100644 (file)
@@ -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 =
index 796654a65d03d5c4c60dc857ef35afeb724ff84c..eb9f1e4b397197f14e9d38e6de04a4ca076303cc 100644 (file)
@@ -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 */
index 509ddab8eddb0834fd4072505f931ac9c191ffbe..44104969e24f65d5174980cbfb4359b72a5e5cf4 100644 (file)
@@ -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 */
index aba7b1b844ed30d6ec730f14cafb88c5f7bcb133..369d07a27fe2894c5415edbbb3ef400e97ee6a22 100644 (file)
@@ -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;
index 94866269c4734ec5b90044849e031b4eec09ad8a..441606106ec6b2f79deb3e8814207de0339167c7 100644 (file)
@@ -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);
index c6c02aee1ea2bad41e99da91037dddb0df1adbe5..31d2beb5d428029d2890795717c2c7da70c2ef48 100644 (file)
@@ -533,11 +533,6 @@ struct __GLXscreenConfigsRec
    int scr;
 
    __GLXDRIscreen *driScreen;
-
-#ifdef __DRI_COPY_SUB_BUFFER
-   const __DRIcopySubBufferExtension *driCopySubBuffer;
-#endif
-
 #endif
 
     /**