summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c30
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.h11
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_lock.c14
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c35
5 files changed, 57 insertions, 34 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 6328c08442..e4dcc96466 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -70,7 +70,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define need_GL_EXT_secondary_color
#include "extension_helper.h"
-#define DRIVER_DATE "20060327"
+#define DRIVER_DATE "20061018"
#include "vblank.h"
#include "utils.h"
@@ -80,21 +80,6 @@ int RADEON_DEBUG = (0);
#endif
-/* Return the width and height of the given buffer.
- */
-static void radeonGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- LOCK_HARDWARE( rmesa );
- *width = rmesa->dri.drawable->w;
- *height = rmesa->dri.drawable->h;
-
- UNLOCK_HARDWARE( rmesa );
-}
-
/* Return various strings for glGetString().
*/
static const GLubyte *radeonGetString( GLcontext *ctx, GLenum name )
@@ -186,7 +171,7 @@ static const struct tnl_pipeline_stage *radeon_pipeline[] = {
*/
static void radeonInitDriverFuncs( struct dd_function_table *functions )
{
- functions->GetBufferSize = radeonGetBufferSize;
+ functions->GetBufferSize = NULL; /* OBSOLETE */
functions->GetString = radeonGetString;
}
@@ -280,7 +265,8 @@ radeonCreateContext( const __GLcontextModes *glVisual,
/* 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 +607,17 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
/* 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 );
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h
index 9902e60c59..0a7c3b2f54 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_context.h
@@ -496,7 +496,16 @@ struct radeon_dma {
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;
diff --git a/src/mesa/drivers/dri/radeon/radeon_lock.c b/src/mesa/drivers/dri/radeon/radeon_lock.c
index ba87271f2f..e6ab6af456 100644
--- a/src/mesa/drivers/dri/radeon/radeon_lock.c
+++ b/src/mesa/drivers/dri/radeon/radeon_lock.c
@@ -71,7 +71,8 @@ radeonUpdatePageFlipping( radeonContextPtr rmesa )
*/
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 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
* 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 );
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 5cfa792cdb..279357ab59 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -727,6 +727,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
(*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)
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index 449c63eb7a..86d8c4d963 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1635,25 +1635,42 @@ static void radeonLogicOpCode( GLcontext *ctx, GLenum opcode )
*/
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)