summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/mga
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2006-11-02 12:02:13 +0000
committerAlan Hourihane <alanh@tungstengraphics.com>2006-11-02 12:02:13 +0000
commit6d104cb932080c5c0d951fbc0ec6d30fb7ebef45 (patch)
tree17207f566d6eda4d3884ec03dfff6cdb5a1965ea /src/mesa/drivers/dri/mga
parent18d52f96bb1f20b1887b67e87506835bca05d73a (diff)
merge current trunk into vbo branch
Diffstat (limited to 'src/mesa/drivers/dri/mga')
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c1
-rw-r--r--src/mesa/drivers/dri/mga/mgacontext.h7
-rw-r--r--src/mesa/drivers/dri/mga/mgadd.c19
-rw-r--r--src/mesa/drivers/dri/mga/mgaioctl.c5
-rw-r--r--src/mesa/drivers/dri/mga/mgaspan.c4
-rw-r--r--src/mesa/drivers/dri/mga/mgastate.c52
6 files changed, 20 insertions, 68 deletions
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index 32cfbc6a1c..f024f73eb6 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -883,7 +883,6 @@ mgaMakeCurrent(__DRIcontextPrivate *driContextPriv,
mmesa->driDrawable = driDrawPriv;
mmesa->dirty = ~0;
mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK);
- mmesa->mesa_drawable = driDrawPriv;
}
mmesa->driReadable = driReadPriv;
diff --git a/src/mesa/drivers/dri/mga/mgacontext.h b/src/mesa/drivers/dri/mga/mgacontext.h
index 81348b6c7f..2124006ade 100644
--- a/src/mesa/drivers/dri/mga/mgacontext.h
+++ b/src/mesa/drivers/dri/mga/mgacontext.h
@@ -303,13 +303,6 @@ struct mga_context_t {
__DRIdrawablePrivate *driDrawable;
__DRIdrawablePrivate *driReadable;
- /**
- * 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 mga_context_t::driDrawable or \c mga_context_t::driReadable.
- */
- __DRIdrawablePrivate *mesa_drawable;
-
__DRIscreenPrivate *driScreen;
struct mga_screen_private_s *mgaScreen;
drm_mga_sarea_t *sarea;
diff --git a/src/mesa/drivers/dri/mga/mgadd.c b/src/mesa/drivers/dri/mga/mgadd.c
index faf46f3139..b1d5e0c48f 100644
--- a/src/mesa/drivers/dri/mga/mgadd.c
+++ b/src/mesa/drivers/dri/mga/mgadd.c
@@ -41,7 +41,7 @@
#include "mga_xmesa.h"
#include "utils.h"
-#define DRIVER_DATE "20050609"
+#define DRIVER_DATE "20061030"
/***************************************
@@ -74,24 +74,7 @@ static const GLubyte *mgaGetString( GLcontext *ctx, GLenum name )
}
-static void mgaBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- mgaContextPtr mmesa = MGA_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( mmesa );
- *width = mmesa->driDrawable->w;
- *height = mmesa->driDrawable->h;
- UNLOCK_HARDWARE( mmesa );
-}
-
-
void mgaInitDriverFuncs( struct dd_function_table *functions )
{
- functions->GetBufferSize = mgaBufferSize;
functions->GetString = mgaGetString;
}
diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c
index c9fa9d1294..f8587fc541 100644
--- a/src/mesa/drivers/dri/mga/mgaioctl.c
+++ b/src/mesa/drivers/dri/mga/mgaioctl.c
@@ -204,8 +204,7 @@ drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa )
static void
-mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
- GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo )
+mgaClear( GLcontext *ctx, GLbitfield mask )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = mmesa->driDrawable;
@@ -334,7 +333,7 @@ mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
}
if (mask)
- _swrast_Clear( ctx, mask, 0, 0, 0, 0, 0 );
+ _swrast_Clear( ctx, mask );
}
diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c
index dbc7fc884c..05dcbb8526 100644
--- a/src/mesa/drivers/dri/mga/mgaspan.c
+++ b/src/mesa/drivers/dri/mga/mgaspan.c
@@ -36,9 +36,9 @@
#define LOCAL_VARS \
mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = mmesa->mesa_drawable; \
__DRIscreenPrivate *sPriv = mmesa->driScreen; \
driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ const __DRIdrawablePrivate *dPriv = drb->dPriv; \
GLuint pitch = drb->pitch; \
GLuint height = dPriv->h; \
char *buf = (char *)(sPriv->pFB + \
@@ -52,9 +52,9 @@
#define LOCAL_DEPTH_VARS \
mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = mmesa->mesa_drawable; \
__DRIscreenPrivate *sPriv = mmesa->driScreen; \
driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ const __DRIdrawablePrivate *dPriv = drb->dPriv; \
GLuint pitch = drb->pitch; \
GLuint height = dPriv->h; \
char *buf = (char *)(sPriv->pFB + \
diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c
index 69f85d62a5..f7e07c330a 100644
--- a/src/mesa/drivers/dri/mga/mgastate.c
+++ b/src/mesa/drivers/dri/mga/mgastate.c
@@ -744,32 +744,12 @@ static void mgaDDLogicOp( GLcontext *ctx, GLenum opcode )
}
-static void mgaXMesaSetFrontClipRects( mgaContextPtr mmesa )
+static void mga_set_cliprects(mgaContextPtr mmesa)
{
__DRIdrawablePrivate *driDrawable = mmesa->driDrawable;
- if (driDrawable->numClipRects == 0) {
- static drm_clip_rect_t zeroareacliprect = {0,0,0,0};
- mmesa->numClipRects = 1;
- mmesa->pClipRects = &zeroareacliprect;
- } else {
- mmesa->numClipRects = driDrawable->numClipRects;
- mmesa->pClipRects = driDrawable->pClipRects;
- }
- mmesa->drawX = driDrawable->x;
- mmesa->drawY = driDrawable->y;
-
- mmesa->setup.dstorg = mmesa->drawOffset;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_CLIPRECTS;
-}
-
-
-static void mgaXMesaSetBackClipRects( mgaContextPtr mmesa )
-{
- __DRIdrawablePrivate *driDrawable = mmesa->driDrawable;
-
- if (driDrawable->numBackClipRects == 0)
- {
+ if ((mmesa->draw_buffer != MGA_FRONT)
+ || (driDrawable->numBackClipRects == 0)) {
if (driDrawable->numClipRects == 0) {
static drm_clip_rect_t zeroareacliprect = {0,0,0,0};
mmesa->numClipRects = 1;
@@ -794,25 +774,25 @@ static void mgaXMesaSetBackClipRects( mgaContextPtr mmesa )
void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers )
{
- __DRIdrawablePrivate *driDrawable = mmesa->driDrawable;
+ __DRIdrawablePrivate *const driDrawable = mmesa->driDrawable;
+ __DRIdrawablePrivate *const driReadable = mmesa->driReadable;
drm_mga_sarea_t *sarea = mmesa->sarea;
- DRI_VALIDATE_DRAWABLE_INFO(mmesa->driScreen, driDrawable);
mmesa->dirty_cliprects = 0;
- if (mmesa->draw_buffer == MGA_FRONT)
- mgaXMesaSetFrontClipRects( mmesa );
- else
- mgaXMesaSetBackClipRects( mmesa );
+ driUpdateFramebufferSize(mmesa->glCtx, driDrawable);
+ if (driDrawable != driReadable) {
+ driUpdateFramebufferSize(mmesa->glCtx, driReadable);
+ }
+
+ mga_set_cliprects(mmesa);
sarea->req_drawable = driDrawable->draw;
sarea->req_draw_buffer = mmesa->draw_buffer;
mgaUpdateClipping( mmesa->glCtx );
mgaCalcViewport( mmesa->glCtx );
-
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
}
@@ -828,23 +808,21 @@ static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode )
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
case BUFFER_BIT_FRONT_LEFT:
mmesa->setup.dstorg = mmesa->mgaScreen->frontOffset;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
mmesa->draw_buffer = MGA_FRONT;
- mgaXMesaSetFrontClipRects( mmesa );
- FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
case BUFFER_BIT_BACK_LEFT:
mmesa->setup.dstorg = mmesa->mgaScreen->backOffset;
mmesa->draw_buffer = MGA_BACK;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
- mgaXMesaSetBackClipRects( mmesa );
- FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
default:
/* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_TRUE );
return;
}
+
+ mmesa->dirty |= MGA_UPLOAD_CONTEXT;
+ mga_set_cliprects(mmesa);
+ FALLBACK(ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE);
}