-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brian Paul wrote:
> Ian Romanick wrote:
>> Brian Paul wrote:
>>
>>> In order to do 1, each driver must be updated.  Basically, before a 
>>> GLframebuffer is bound for the first time, it must be initialized. 
>>> Specifically, the GLframebuffer's Width and Height fields need to be 
>>> set correctly and _mesa_resize_framebuffer() should be called in order 
>>> to make sure the software buffers (accum, stencil, etc) are allocated 
>>> to the proper size).
>>>
>>> In the intel drivers, it looks like the preceeding call to 
>>> intelWindowMoved() will do this.
>>>
>>> I've added #ifdef/#else/#endif in _mesa_make_current() to show what 
>>> code should be removed, and to check that the caller does what's expected.
>>>
>>> I'm looking for a maintainer of each DRI driver to change the #if 1 to 
>>> #if 0 and update the driver code to do the needed initializations. 
>>> I'll try to do this for the i915 driver once I get my DRI environment 
>>> up to date.
>>
>> I can handle this for radeon and mga.  It looks like this means just
>> adding a the call to _mesa_resize_framebuffer to the driver's
>> MakeCurrent routine.
> 
> That's basically it.  But you don't want to do it unconditionally, 
> just the first time the buffer is bound.  Also, set the buffer's 
> Initialized flag = GL_TRUE, to avoid the soon-to-be-obsolete code in 
> _mesa_make_current().
> 
> The Initalized flag will eventually be removed.

Here's my patch for the Radeon driver.  There's some additional code in
there to enable GLX_SGI_make_current_read.  Is it necessary to do the
same initialization on the read-drawable as on the draw-drawable?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFNAkrX1gOwKyEAw8RAj95AJ911jQJDOftMneRgbEcuoxXVRqVfwCfaSaE
/e2Okwg1ydv4ORTPSzyD00w=
=FKjA
-----END PGP SIGNATURE-----
Index: src/mesa/drivers/dri/radeon/radeon_context.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/radeon/radeon_context.c,v
retrieving revision 1.55
diff -u -d -r1.55 radeon_context.c
--- src/mesa/drivers/dri/radeon/radeon_context.c	15 Oct 2006 18:18:40 -0000	1.55
+++ src/mesa/drivers/dri/radeon/radeon_context.c	16 Oct 2006 22:33:53 -0000
@@ -280,7 +280,8 @@
    /* Init radeon context data */
    rmesa->dri.context = driContextPriv;
    rmesa->dri.screen = sPriv;
-   rmesa->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
+   rmesa->dri.drawable = NULL;
+   rmesa->dri.readable = NULL;
    rmesa->dri.hwContext = driContextPriv->hHWContext;
    rmesa->dri.hwLock = &sPriv->pSAREA->lock;
    rmesa->dri.fd = sPriv->fd;
@@ -621,11 +622,17 @@
          /* XXX we may need to validate the drawable here!!! */
 	 driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags,
 				&newCtx->vbl_seq );
+      }
+      
+      if ( (newCtx->dri.drawable != driDrawPriv)
+	   || (newCtx->dri.readable != driReadPriv) ) {
 	 newCtx->dri.drawable = driDrawPriv;
+	 newCtx->dri.readable = driReadPriv;
+
 	 radeonUpdateWindow( newCtx->glCtx );
 	 radeonUpdateViewportOffset( newCtx->glCtx );
       }
-  
+
       _mesa_make_current( newCtx->glCtx,
 			  (GLframebuffer *) driDrawPriv->driverPrivate,
 			  (GLframebuffer *) driReadPriv->driverPrivate );
Index: src/mesa/drivers/dri/radeon/radeon_context.h
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/radeon/radeon_context.h,v
retrieving revision 1.30
diff -u -d -r1.30 radeon_context.h
--- src/mesa/drivers/dri/radeon/radeon_context.h	11 Apr 2006 11:41:11 -0000	1.30
+++ src/mesa/drivers/dri/radeon/radeon_context.h	16 Oct 2006 22:33:53 -0000
@@ -496,7 +496,16 @@
 struct radeon_dri_mirror {
    __DRIcontextPrivate	*context;	/* DRI context */
    __DRIscreenPrivate	*screen;	/* DRI screen */
-   __DRIdrawablePrivate	*drawable;	/* DRI drawable bound to this ctx */
+
+   /**
+    * DRI drawable bound to this context for drawing.
+    */
+   __DRIdrawablePrivate	*drawable;	
+
+   /**
+    * DRI drawable bound to this context for reading.
+    */
+   __DRIdrawablePrivate	*readable;
 
    drm_context_t hwContext;
    drm_hw_lock_t *hwLock;
Index: src/mesa/drivers/dri/radeon/radeon_lock.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/radeon/radeon_lock.c,v
retrieving revision 1.15
diff -u -d -r1.15 radeon_lock.c
--- src/mesa/drivers/dri/radeon/radeon_lock.c	14 Sep 2005 00:10:27 -0000	1.15
+++ src/mesa/drivers/dri/radeon/radeon_lock.c	16 Oct 2006 22:33:53 -0000
@@ -71,7 +71,8 @@
  */
 void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
 {
-   __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
+   __DRIdrawablePrivate *const drawable = rmesa->dri.drawable;
+   __DRIdrawablePrivate *const readable = rmesa->dri.readable;
    __DRIscreenPrivate *sPriv = rmesa->dri.screen;
    drm_radeon_sarea_t *sarea = rmesa->sarea;
 
@@ -85,14 +86,17 @@
     * Since the hardware state depends on having the latest drawable
     * clip rects, 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 ( rmesa->lastStamp != dPriv->lastStamp ) {
+   if ( rmesa->lastStamp != drawable->lastStamp ) {
       radeonUpdatePageFlipping( rmesa );
       radeonSetCliprects( rmesa );
       radeonUpdateViewportOffset( rmesa->glCtx );
-      driUpdateFramebufferSize(rmesa->glCtx, dPriv);
-      rmesa->lastStamp = dPriv->lastStamp;
+      driUpdateFramebufferSize(rmesa->glCtx, drawable);
+      rmesa->lastStamp = drawable->lastStamp;
    }
 
    RADEON_STATECHANGE( rmesa, ctx );
Index: src/mesa/drivers/dri/radeon/radeon_screen.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c,v
retrieving revision 1.67
diff -u -d -r1.67 radeon_screen.c
--- src/mesa/drivers/dri/radeon/radeon_screen.c	13 Oct 2006 22:10:05 -0000	1.67
+++ src/mesa/drivers/dri/radeon/radeon_screen.c	16 Oct 2006 22:33:54 -0000
@@ -727,6 +727,7 @@
 	 (*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" );
 
       (*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" );
+      (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
    }
 
 #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200)
Index: src/mesa/drivers/dri/radeon/radeon_state.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/radeon/radeon_state.c,v
retrieving revision 1.46
diff -u -d -r1.46 radeon_state.c
--- src/mesa/drivers/dri/radeon/radeon_state.c	13 Sep 2006 22:41:46 -0000	1.46
+++ src/mesa/drivers/dri/radeon/radeon_state.c	16 Oct 2006 22:33:54 -0000
@@ -1635,25 +1635,42 @@
  */
 void radeonSetCliprects( radeonContextPtr rmesa )
 {
-   __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
+   __DRIdrawablePrivate *const drawable = rmesa->dri.drawable;
+   __DRIdrawablePrivate *const readable = rmesa->dri.readable;
+   GLframebuffer *const draw_fb = (GLframebuffer*) drawable->driverPrivate
+   GLframebuffer *const read_fb = (GLframebuffer*) readable->driverPrivate
 
-   if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]
+   if (draw_fb->_ColorDrawBufferMask[0]
        == BUFFER_BIT_BACK_LEFT) {
       /* Can't ignore 2d windows if we are page flipping.
        */
-      if ( dPriv->numBackClipRects == 0 || rmesa->doPageFlip ) {
-	 rmesa->numClipRects = dPriv->numClipRects;
-	 rmesa->pClipRects = dPriv->pClipRects;
+      if ( drawable->numBackClipRects == 0 || rmesa->doPageFlip ) {
+	 rmesa->numClipRects = drawable->numClipRects;
+	 rmesa->pClipRects = drawable->pClipRects;
       }
       else {
-	 rmesa->numClipRects = dPriv->numBackClipRects;
-	 rmesa->pClipRects = dPriv->pBackClipRects;
+	 rmesa->numClipRects = drawable->numBackClipRects;
+	 rmesa->pClipRects = drawable->pBackClipRects;
       }
    }
    else {
       /* front buffer (or none, or multiple buffers */
-      rmesa->numClipRects = dPriv->numClipRects;
-      rmesa->pClipRects = dPriv->pClipRects;
+      rmesa->numClipRects = drawable->numClipRects;
+      rmesa->pClipRects = drawable->pClipRects;
+   }
+
+   if ((draw_fb->Width != drawable->w) || (draw_fb->Height != drawable->h)) {
+      _mesa_resize_framebuffer(&rmesa->glCtx, draw_fb,
+			       drawable->w, drawable->h);
+      draw_fb->Initialized = GL_TRUE;
+   }
+
+   if (drawable != readable) {
+      if ((read_fb->Width != readable->w) || (read_fb->Height != readable->h)) {
+	 _mesa_resize_framebuffer(&rmesa->glCtx, read_fb,
+				  readable->w, readable->h);
+	 read_fb->Initialized = GL_TRUE;
+      }
    }
 
    if (rmesa->state.scissor.enabled)
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to