Enable GLX_SGI_make_current_read.
authorIan Romanick <idr@us.ibm.com>
Fri, 10 Nov 2006 18:47:22 +0000 (18:47 +0000)
committerIan Romanick <idr@us.ibm.com>
Fri, 10 Nov 2006 18:47:22 +0000 (18:47 +0000)
Eliminate use of deprecated GetBufferSize interface.  Keep framebuffer
state associated with the read-drawable and the draw-drawable up to
date.

Tested with progs/demos/wincopy.

src/mesa/drivers/dri/savage/savage_init.h
src/mesa/drivers/dri/savage/savage_xmesa.c
src/mesa/drivers/dri/savage/savagedd.c
src/mesa/drivers/dri/savage/savagespan.c

index 0dec397b7ba70c7095f890ef41280dd368389c24..9cf8e66b7c2a8b11919291a64847641a70b22adb 100644 (file)
@@ -80,16 +80,6 @@ typedef struct {
 } savageScreenPrivate;
 
 
-/**
- * savageRenderbuffer, derived from Mesa's gl_renderbuffer
- */
-typedef struct {
-   struct gl_renderbuffer Base;
-   /* XXX per-window info should go here */
-   int foo, bar;
-} savageRenderbuffer;
-
-
 #include "savagecontext.h"
 
 extern void savageGetLock( savageContextPtr imesa, GLuint flags );
index aaba58ed33ee1901b7889cf4df5d9399a334d6e0..f8d68d7874eae519767766a010fab3072607e97b 100644 (file)
@@ -173,6 +173,9 @@ savageInitDriver(__DRIscreenPrivate *sPriv)
 {
   savageScreenPrivate *savageScreen;
   SAVAGEDRIPtr         gDRIPriv = (SAVAGEDRIPtr)sPriv->pDevPriv;
+   PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
+     (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
+
 
    if (sPriv->devPrivSize != sizeof(SAVAGEDRIRec)) {
       fprintf(stderr,"\nERROR!  sizeof(SAVAGEDRIRec) does not match passed size from device driver\n");
@@ -260,6 +263,11 @@ savageInitDriver(__DRIscreenPrivate *sPriv)
    driParseOptionInfo (&savageScreen->optionCache,
                       __driConfigOptions, __driNConfigOptions);
 
+   if (glx_enable_extension != NULL) {
+      (*glx_enable_extension)(sPriv->psc->screenConfigs,
+                             "GLX_SGI_make_current_read");
+   }
+
 #if 0
    savageDDFastPathInit();
    savageDDTrifuncInit();
@@ -756,6 +764,9 @@ void savageXMesaSetBackClipRects( savageContextPtr imesa )
 
 static void savageXMesaWindowMoved( savageContextPtr imesa ) 
 {
+   __DRIdrawablePrivate *const drawable = imesa->driDrawable;
+   __DRIdrawablePrivate *const readable = imesa->driReadable;
+
    if (0)
       fprintf(stderr, "savageXMesaWindowMoved\n\n");
 
@@ -769,6 +780,11 @@ static void savageXMesaWindowMoved( savageContextPtr imesa )
    default:
        break;
    }
+
+   driUpdateFramebufferSize(imesa->glCtx, drawable);
+   if (drawable != readable) {
+      driUpdateFramebufferSize(imesa->glCtx, readable);
+   }
 }
 
 
@@ -858,11 +874,12 @@ savageMakeCurrent(__DRIcontextPrivate *driContextPriv,
 
 void savageGetLock( savageContextPtr imesa, GLuint flags ) 
 {
-   __DRIdrawablePrivate *dPriv = imesa->driDrawable;
+   __DRIdrawablePrivate *const drawable = imesa->driDrawable;
+   __DRIdrawablePrivate *const readable = imesa->driReadable;
    __DRIscreenPrivate *sPriv = imesa->driScreen;
    drm_savage_sarea_t *sarea = imesa->sarea;
    int me = imesa->hHWContext;
-   int stamp = dPriv->lastStamp; 
+   int stamp = drawable->lastStamp; 
    int heap;
    unsigned int timestamp = 0;
 
@@ -882,10 +899,11 @@ void savageGetLock( savageContextPtr imesa, GLuint flags )
     * NOTE: This releases and regains the hw lock, so all state
     * checking must be done *after* this call:
     */
-   DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);           
-
+   DRI_VALIDATE_DRAWABLE_INFO(sPriv, drawable);
+   if (drawable != readable) {
+      DRI_VALIDATE_DRAWABLE_INFO(sPriv, readable);
+   }
 
-  
 
    /* If we lost context, need to dump all registers to hardware.
     * Note that we don't care about 2d contexts, even if they perform
@@ -916,8 +934,8 @@ void savageGetLock( savageContextPtr imesa, GLuint flags )
       DRI_AGE_TEXTURES( imesa->textureHeaps[heap] );
    }
 
-   if (dPriv->lastStamp != stamp) {
-      driUpdateFramebufferSize(imesa->glCtx, dPriv);
+   if (drawable->lastStamp != stamp) {
+      driUpdateFramebufferSize(imesa->glCtx, drawable);
       savageXMesaWindowMoved( imesa );
    }
 }
index ae19481f0393f483d3a5cf375bf30e40ce9035de..92431065bfb209150c50ebf578f854742176022f 100644 (file)
@@ -95,24 +95,7 @@ static GLint savageGetParameteri(const GLcontext *ctx, GLint param)
 #endif
 
 
-static void savageBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
-
-   /* Need to lock to make sure the driDrawable is uptodate.  This
-    * information is used to resize Mesa's software buffers, so it has
-    * to be correct.
-    */
-   LOCK_HARDWARE(imesa);
-   *width = imesa->driDrawable->w;
-   *height = imesa->driDrawable->h;
-   UNLOCK_HARDWARE(imesa);
-}
-
-
 void savageDDInitDriverFuncs( GLcontext *ctx )
 {
-   ctx->Driver.GetBufferSize = savageBufferSize;
    ctx->Driver.GetString = savageDDGetString;
 }
index 5d6246797f28dc7359d9eb659ecb2fae4181b066..2fe991a6b99c205623fa340e31057487d21d9209 100644 (file)
@@ -34,8 +34,8 @@
 
 #define LOCAL_VARS                                             \
    savageContextPtr imesa = SAVAGE_CONTEXT(ctx);               \
-   __DRIdrawablePrivate *dPriv = imesa->driDrawable;           \
    driRenderbuffer *drb = (driRenderbuffer *) rb;              \
+   __DRIdrawablePrivate *const dPriv = drb->dPriv;             \
    GLuint cpp   = drb->cpp;                                    \
    GLuint pitch = drb->pitch;                                  \
    GLuint height = dPriv->h;                                   \
@@ -45,8 +45,8 @@
 
 #define LOCAL_DEPTH_VARS                                       \
    savageContextPtr imesa = SAVAGE_CONTEXT(ctx);               \
-   __DRIdrawablePrivate *dPriv = imesa->driDrawable;           \
    driRenderbuffer *drb = (driRenderbuffer *) rb;              \
+   __DRIdrawablePrivate *const dPriv = drb->dPriv;             \
    GLuint zpp   = drb->cpp;                                    \
    GLuint pitch = drb->pitch;                                  \
    GLuint height = dPriv->h;                                   \