glx: Move __driScreen into the dri screen privates
authorKristian Høgsberg <krh@bitplanet.net>
Mon, 19 Jul 2010 20:45:23 +0000 (16:45 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 20 Jul 2010 02:45:50 +0000 (22:45 -0400)
src/glx/dri2_glx.c
src/glx/dri_glx.c
src/glx/drisw_glx.c
src/glx/glxclient.h

index 7d0a8603e05e837d43636050f3145dfd78672bd3..3187fa16d9c4c7904d763c43c7c7394e80047407 100644 (file)
@@ -78,7 +78,8 @@ struct dri2_display
 struct dri2_screen {
    __GLXscreenConfigs base;
 
-   __GLXDRIscreen driScreen;
+   __DRIscreen *driScreen;
+   __GLXDRIscreen vtable;
    const __DRIdri2Extension *dri2;
    const __DRIcoreExtension *core;
 
@@ -161,7 +162,7 @@ dri2CreateContext(__GLXscreenConfigs *base,
 
    pcp->psc = &psc->base;
    pcp->driContext =
-      (*psc->dri2->createNewContext) (psc->base.__driScreen,
+      (*psc->dri2->createNewContext) (psc->driScreen,
                                       config->driConfig, shared, pcp);
    gc->__driContext = pcp->driContext;
 
@@ -217,7 +218,7 @@ dri2CreateDrawable(__GLXscreenConfigs *base, XID xDrawable,
    pdraw->have_back = 0;
 
    if (psc->config)
-      psc->config->configQueryi(psc->base.__driScreen,
+      psc->config->configQueryi(psc->driScreen,
                                "vblank_mode", &vblank_mode);
 
    switch (vblank_mode) {
@@ -238,7 +239,7 @@ dri2CreateDrawable(__GLXscreenConfigs *base, XID xDrawable,
    pdp = (struct dri2_display *)dpyPriv->dri2Display;;
    /* Create a new drawable */
    pdraw->base.driDrawable =
-      (*psc->dri2->createNewDrawable) (psc->base.__driScreen,
+      (*psc->dri2->createNewDrawable) (psc->driScreen,
                                        config->driConfig, pdraw);
 
    if (!pdraw->base.driDrawable) {
@@ -400,9 +401,8 @@ dri2DestroyScreen(__GLXscreenConfigs *base)
    struct dri2_screen *psc = (struct dri2_screen *) base;
 
    /* Free the direct rendering per screen data */
-   (*psc->core->destroyScreen) (psc->base.__driScreen);
+   (*psc->core->destroyScreen) (psc->driScreen);
    close(psc->fd);
-   base->__driScreen = NULL;
    Xfree(psc);
 }
 
@@ -530,7 +530,7 @@ dri2SetSwapInterval(__GLXDRIdrawable *pdraw, int interval)
    struct dri2_screen *psc = (struct dri2_screen *) priv->base.psc;
 
    if (psc->config)
-      psc->config->configQueryi(psc->base.__driScreen,
+      psc->config->configQueryi(psc->driScreen,
                                "vblank_mode", &vblank_mode);
 
    switch (vblank_mode) {
@@ -737,18 +737,18 @@ dri2CreateScreen(int screen, __GLXdisplayPrivate * priv)
    /* If the server does not support the protocol for
     * DRI2GetBuffersWithFormat, don't supply that interface to the driver.
     */
-   psc->base.__driScreen =
+   psc->driScreen =
       psc->dri2->createNewScreen(screen, psc->fd,
                                 (const __DRIextension **)
                                 &pdp->loader_extensions[0],
                                 &driver_configs, psc);
 
-   if (psc->base.__driScreen == NULL) {
+   if (psc->driScreen == NULL) {
       ErrorMessageF("failed to create dri screen\n");
       goto handle_error;
    }
 
-   extensions = psc->core->getExtensions(psc->base.__driScreen);
+   extensions = psc->core->getExtensions(psc->driScreen);
    driBindCommonExtensions(&psc->base, extensions);
    dri2BindExtensions(psc, extensions);
 
@@ -759,7 +759,7 @@ dri2CreateScreen(int screen, __GLXdisplayPrivate * priv)
 
    psc->base.driver_configs = driver_configs;
 
-   psp = &psc->driScreen;
+   psp = &psc->vtable;
    psc->base.driScreen = psp;
    psp->destroyScreen = dri2DestroyScreen;
    psp->createContext = dri2CreateContext;
index 42d5994b2e2aa44db3032cd0539dde1df58e7417..373f9fb649db9781dcf8edd4b41142dcfbb16e1d 100644 (file)
@@ -63,7 +63,8 @@ struct dri_screen
 {
    __GLXscreenConfigs base;
 
-   __GLXDRIscreen driScreen;
+   __DRIscreen *driScreen;
+   __GLXDRIscreen vtable;
    const __DRIlegacyExtension *legacy;
    const __DRIcoreExtension *core;
    const __DRIswapControlExtension *swapControl;
@@ -551,7 +552,7 @@ driCreateContext(__GLXscreenConfigs *base,
    }
 
    pcp->driContext =
-      (*psc->legacy->createNewContext) (psc->base.__driScreen,
+      (*psc->legacy->createNewContext) (psc->driScreen,
                                         config->driConfig,
                                         renderType, shared, hwContext, pcp);
    if (pcp->driContext == NULL) {
@@ -607,7 +608,7 @@ driCreateDrawable(__GLXscreenConfigs *base,
 
    /* Create a new drawable */
    pdraw->driDrawable =
-      (*psc->legacy->createNewDrawable) (psc->base.__driScreen,
+      (*psc->legacy->createNewDrawable) (psc->driScreen,
                                          config->driConfig,
                                          hwDrawable,
                                          GLX_WINDOW_BIT,
@@ -648,9 +649,9 @@ driDestroyScreen(__GLXscreenConfigs *base)
    struct dri_screen *psc = (struct dri_screen *) base;
 
    /* Free the direct rendering per screen data */
-   if (psc->base.__driScreen)
-      (*psc->core->destroyScreen) (psc->base.__driScreen);
-   psc->base.__driScreen = NULL;
+   if (psc->driScreen)
+      (*psc->core->destroyScreen) (psc->driScreen);
+   psc->driScreen = NULL;
    if (psc->driver)
       dlclose(psc->driver);
 }
@@ -820,19 +821,19 @@ driCreateScreen(int screen, __GLXdisplayPrivate *priv)
    }
 
    pdp = (struct dri_display *) priv->driDisplay;
-   psc->base.__driScreen =
+   psc->driScreen =
       CallCreateNewScreen(psc->base.dpy, screen, psc, pdp);
-   if (psc->base.__driScreen == NULL) {
+   if (psc->driScreen == NULL) {
       dlclose(psc->driver);
       Xfree(psc);
       return NULL;
    }
 
-   extensions = psc->core->getExtensions(psc->base.__driScreen);
+   extensions = psc->core->getExtensions(psc->driScreen);
    driBindExtensions(psc, extensions);
    driBindCommonExtensions(&psc->base, extensions);
 
-   psp = &psc->driScreen;
+   psp = &psc->vtable;
    psc->base.driScreen = psp;
    if (psc->base.driCopySubBuffer)
       psp->copySubBuffer = driCopySubBuffer;
index d403b235372f5ff880b9d921bf56f85cd1c00e20..e9a88e6db0cb3786f457328a582ccc8e61478243 100644 (file)
@@ -44,7 +44,8 @@ struct drisw_screen
 {
    __GLXscreenConfigs base;
 
-   __GLXDRIscreen driScreen;
+   __DRIscreen *driScreen;
+   __GLXDRIscreen vtable;
    const __DRIcoreExtension *core;
    const __DRIswrastExtension *swrast;
    void *driver;
@@ -290,7 +291,7 @@ driCreateContext(__GLXscreenConfigs *base,
 
    pcp->psc = &psc->base;
    pcp->driContext =
-      (*psc->core->createNewContext) (psc->base.__driScreen,
+      (*psc->core->createNewContext) (psc->driScreen,
                                      config->driConfig, shared, pcp);
    if (pcp->driContext == NULL) {
       Xfree(pcp);
@@ -344,7 +345,7 @@ driCreateDrawable(__GLXscreenConfigs *base, XID xDrawable,
 
    /* Create a new drawable */
    pdraw->driDrawable =
-      (*swrast->createNewDrawable) (psc->base.__driScreen,
+      (*swrast->createNewDrawable) (psc->driScreen,
                                    config->driConfig, pdp);
 
    if (!pdraw->driDrawable) {
@@ -380,8 +381,8 @@ driDestroyScreen(__GLXscreenConfigs *base)
    struct drisw_screen *psc = (struct drisw_screen *) base;
 
    /* Free the direct rendering per screen data */
-   (*psc->core->destroyScreen) (psc->base.__driScreen);
-   psc->base.__driScreen = NULL;
+   (*psc->core->destroyScreen) (psc->driScreen);
+   psc->driScreen = NULL;
    if (psc->driver)
       dlclose(psc->driver);
 }
@@ -439,15 +440,15 @@ driCreateScreen(int screen, __GLXdisplayPrivate *priv)
       goto handle_error;
    }
 
-   psc->base.__driScreen =
+   psc->driScreen =
       psc->swrast->createNewScreen(screen, loader_extensions,
                                   &driver_configs, psc);
-   if (psc->base.__driScreen == NULL) {
+   if (psc->driScreen == NULL) {
       ErrorMessageF("failed to create dri screen\n");
       goto handle_error;
    }
 
-   extensions = psc->core->getExtensions(psc->base.__driScreen);
+   extensions = psc->core->getExtensions(psc->driScreen);
    driBindCommonExtensions(&psc->base, extensions);
 
    psc->base.configs =
@@ -457,7 +458,7 @@ driCreateScreen(int screen, __GLXdisplayPrivate *priv)
 
    psc->base.driver_configs = driver_configs;
 
-   psp = &psc->driScreen;
+   psp = &psc->vtable;
    psc->base.driScreen = psp;
    psp->destroyScreen = driDestroyScreen;
    psp->createContext = driCreateContext;
index b865e24b36ebfbe479f211e55a1d591ed46186a6..d7af44470f074d904d329752bf677bdfe4e3626a 100644 (file)
@@ -528,7 +528,6 @@ struct __GLXscreenConfigsRec
     /**
      * Per screen direct rendering interface functions and data.
      */
-   __DRIscreen *__driScreen;
    __glxHashTable *drawHash;
    Display *dpy;
    int scr;