summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2004-05-07 22:46:37 +0000
committerIan Romanick <[email protected]>2004-05-07 22:46:37 +0000
commitc94a96bae4225f6c31b5908f633703c03aee7079 (patch)
treeb36bd89a611780b2a79f93de4b099339386d5f2d /src/mesa
parent3d769b81faea6a066c07c4e5ee0df9cf12870b92 (diff)
Add support for GLX_SGI_make_current_read.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i830/i830_context.c3
-rw-r--r--src/mesa/drivers/dri/i830/i830_context.h20
-rw-r--r--src/mesa/drivers/dri/i830/i830_screen.c2
-rw-r--r--src/mesa/drivers/dri/i830/i830_span.c22
4 files changed, 36 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i830/i830_context.c b/src/mesa/drivers/dri/i830/i830_context.c
index 1c169e1d33f..07a5267c29f 100644
--- a/src/mesa/drivers/dri/i830/i830_context.c
+++ b/src/mesa/drivers/dri/i830/i830_context.c
@@ -506,11 +506,12 @@ GLboolean i830MakeCurrent(__DRIcontextPrivate *driContextPriv,
i830ContextPtr imesa = (i830ContextPtr) driContextPriv->driverPrivate;
if ( imesa->driDrawable != driDrawPriv ) {
- /* Shouldn't the readbuffer be stored also? */
imesa->driDrawable = driDrawPriv;
i830XMesaWindowMoved( imesa );
}
+ imesa->driReadable = driReadPriv;
+
_mesa_make_current2(imesa->glCtx,
(GLframebuffer *) driDrawPriv->driverPrivate,
(GLframebuffer *) driReadPriv->driverPrivate);
diff --git a/src/mesa/drivers/dri/i830/i830_context.h b/src/mesa/drivers/dri/i830/i830_context.h
index 6dcaf1febe6..99d2a39c787 100644
--- a/src/mesa/drivers/dri/i830/i830_context.h
+++ b/src/mesa/drivers/dri/i830/i830_context.h
@@ -212,12 +212,26 @@ struct i830_context_t
drm_clip_rect_t scissor_rect;
drmContext hHWContext;
- drm_hw_lock_t *driHwLock;
+ drmLock *driHwLock;
int driFd;
- __DRIdrawablePrivate *driDrawable;
+ __DRIdrawablePrivate *driDrawable; /**< DRI drawable bound to this
+ * context for drawing.
+ */
+ __DRIdrawablePrivate *driReadable; /**< DRI drawable bound to this
+ * context for reading.
+ */
+
+ /**
+ * Drawable used by Mesa for software fallbacks for reading and
+ * writing. It is set by Mesa's \c SetBuffer callback, and will always be
+ * either \c i830_context_t::driDrawable or \c i830_context_t::driReadable.
+ */
+
+ __DRIdrawablePrivate * mesa_drawable;
+
__DRIscreenPrivate *driScreen;
- i830ScreenPrivate *i830Screen;
+ i830ScreenPrivate *i830Screen;
I830SAREAPtr sarea;
/**
diff --git a/src/mesa/drivers/dri/i830/i830_screen.c b/src/mesa/drivers/dri/i830/i830_screen.c
index 18dab3d4020..10a1f4e5b76 100644
--- a/src/mesa/drivers/dri/i830/i830_screen.c
+++ b/src/mesa/drivers/dri/i830/i830_screen.c
@@ -300,6 +300,8 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv)
void * const psc = sPriv->psc->screenConfigs;
if ( glx_enable_extension != NULL ) {
+ (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
+
if ( driCompareGLXAPIVersion( 20030915 ) >= 0 ) {
(*glx_enable_extension)( psc, "GLX_SGIX_fbconfig" );
(*glx_enable_extension)( psc, "GLX_OML_swap_method" );
diff --git a/src/mesa/drivers/dri/i830/i830_span.c b/src/mesa/drivers/dri/i830/i830_span.c
index 28610923e3f..9076b344233 100644
--- a/src/mesa/drivers/dri/i830/i830_span.c
+++ b/src/mesa/drivers/dri/i830/i830_span.c
@@ -27,12 +27,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_span.c,v 1.4 2002/12/10 01:26:53 dawes Exp $ */
-/*
- * Author:
- * Jeff Hartmann <[email protected]>
+/**
+ * \file i830_span.c
+ *
+ * Heavily based on the I810 driver, which was written by Keith Whitwell.
*
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <[email protected]>
+ * \author Jeff Hartmann <[email protected]>
+ * \author Keith Whitwell <[email protected]>
*/
#include "glheader.h"
@@ -52,7 +53,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOCAL_VARS \
i830ContextPtr imesa = I830_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
+ __DRIdrawablePrivate *dPriv = imesa->mesa_drawable; \
i830ScreenPrivate *i830Screen = imesa->i830Screen; \
GLuint pitch = i830Screen->backPitch * i830Screen->cpp; \
GLuint height = dPriv->h; \
@@ -67,7 +68,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOCAL_DEPTH_VARS \
i830ContextPtr imesa = I830_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
+ __DRIdrawablePrivate *dPriv = imesa->mesa_drawable; \
i830ScreenPrivate *i830Screen = imesa->i830Screen; \
GLuint pitch = i830Screen->backPitch * i830Screen->cpp; \
GLuint height = dPriv->h; \
@@ -267,6 +268,13 @@ static void i830SetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
GLuint bufferBit)
{
i830ContextPtr imesa = I830_CONTEXT(ctx);
+
+ assert( (colorBuffer == imesa->driDrawable->driverPrivate)
+ || (colorBuffer == imesa->driReadable->driverPrivate) );
+
+ imesa->mesa_drawable = (colorBuffer == imesa->driDrawable->driverPrivate)
+ ? imesa->driDrawable : imesa->driReadable;
+
if (bufferBit == DD_FRONT_LEFT_BIT) {
imesa->drawMap = (char *)imesa->driScreen->pFB;
imesa->readMap = (char *)imesa->driScreen->pFB;