All elements of pre-DRI_NEW_INTERFACE_ONLY are removed. This allows
[mesa.git] / src / mesa / drivers / dri / mga / mgastate.c
index 2066b934364152455739a40e09633adf83481950..72d5c9fb0829675e0d689f13815e380f87151e03 100644 (file)
@@ -28,6 +28,7 @@
 
 
 #include "mtypes.h"
+#include "buffers.h"
 #include "colormac.h"
 #include "dd.h"
 
@@ -299,8 +300,8 @@ void mgaUpdateClipping(const GLcontext *ctx)
       int x1 = mmesa->driDrawable->x + ctx->Scissor.X;
       int y1 = mmesa->driDrawable->y + mmesa->driDrawable->h
         - (ctx->Scissor.Y + ctx->Scissor.Height);
-      int x2 = x1 + ctx->Scissor.Width - 1;
-      int y2 = y1 + ctx->Scissor.Height - 1;
+      int x2 = x1 + ctx->Scissor.Width;
+      int y2 = y1 + ctx->Scissor.Height;
 
       if (x1 < 0) x1 = 0;
       if (y1 < 0) y1 = 0;
@@ -695,6 +696,8 @@ static void mgaViewport( GLcontext *ctx,
                          GLint x, GLint y, 
                          GLsizei width, GLsizei height )
 {
+   /* update size of Mesa/software ancillary buffers */
+   _mesa_ResizeBuffersMESA();
    mgaCalcViewport( ctx );
 }
 
@@ -746,7 +749,7 @@ static void mgaXMesaSetFrontClipRects( mgaContextPtr mmesa )
    __DRIdrawablePrivate *driDrawable = mmesa->driDrawable;
 
    if (driDrawable->numClipRects == 0) {
-       static XF86DRIClipRectRec zeroareacliprect = {0,0,0,0};
+       static drm_clip_rect_t zeroareacliprect = {0,0,0,0};
        mmesa->numClipRects = 1;
        mmesa->pClipRects = &zeroareacliprect;
    } else {
@@ -768,7 +771,7 @@ static void mgaXMesaSetBackClipRects( mgaContextPtr mmesa )
    if (driDrawable->numBackClipRects == 0)
    {
       if (driDrawable->numClipRects == 0) {
-         static XF86DRIClipRectRec zeroareacliprect = {0,0,0,0};
+         static drm_clip_rect_t zeroareacliprect = {0,0,0,0};
          mmesa->numClipRects = 1;
          mmesa->pClipRects = &zeroareacliprect;
       } else {
@@ -792,7 +795,7 @@ static void mgaXMesaSetBackClipRects( mgaContextPtr mmesa )
 void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers )
 {
    __DRIdrawablePrivate *driDrawable = mmesa->driDrawable;
-   MGASAREAPrivPtr sarea = mmesa->sarea;
+   drm_mga_sarea_t *sarea = mmesa->sarea;
 
 
    DRI_VALIDATE_DRAWABLE_INFO(mmesa->driScreen, driDrawable); 
@@ -803,10 +806,9 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers )
    else
       mgaXMesaSetBackClipRects( mmesa );
 
-#ifndef _SOLO
    sarea->req_drawable = driDrawable->draw;
    sarea->req_draw_buffer = mmesa->draw_buffer;
-#endif
+
    mgaUpdateClipping( mmesa->glCtx );
    mgaCalcViewport( mmesa->glCtx );
 
@@ -823,15 +825,15 @@ static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode )
    /*
     * _DrawDestMask is easier to cope with than <mode>.
     */
-   switch ( ctx->Color._DrawDestMask ) {
-   case FRONT_LEFT_BIT:
+   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 BACK_LEFT_BIT:
+   case BUFFER_BIT_BACK_LEFT:
       mmesa->setup.dstorg = mmesa->mgaScreen->backOffset;
       mmesa->draw_buffer = MGA_BACK;
       mmesa->dirty |= MGA_UPLOAD_CONTEXT;
@@ -959,7 +961,7 @@ static void mgaDDPrintDirty( const char *msg, GLuint state )
  */
 void mgaEmitHwStateLocked( mgaContextPtr mmesa )
 {
-   MGASAREAPrivPtr sarea = mmesa->sarea;
+   drm_mga_sarea_t *sarea = mmesa->sarea;
    GLcontext * ctx = mmesa->glCtx;
 
    if (MGA_DEBUG & DEBUG_VERBOSE_MSG)
@@ -1001,31 +1003,31 @@ void mgaEmitHwStateLocked( mgaContextPtr mmesa )
         ((AC_src_one | AC_dst_zero) & ~mmesa->hw.blend_func_enable) |
         mmesa->hw.alpha_sel;
 
-      memcpy( &sarea->ContextState, &mmesa->setup, sizeof(mmesa->setup));
+      memcpy( &sarea->context_state, &mmesa->setup, sizeof(mmesa->setup));
    }
 
    if ((mmesa->dirty & MGA_UPLOAD_TEX0) && mmesa->CurrentTexObj[0]) {
-      memcpy(&sarea->TexState[0],
+      memcpy(&sarea->tex_state[0],
             &mmesa->CurrentTexObj[0]->setup,
-            sizeof(sarea->TexState[0]));
+            sizeof(sarea->tex_state[0]));
    }
 
    if ((mmesa->dirty & MGA_UPLOAD_TEX1) && mmesa->CurrentTexObj[1]) {
-      memcpy(&sarea->TexState[1],
+      memcpy(&sarea->tex_state[1],
             &mmesa->CurrentTexObj[1]->setup,
-            sizeof(sarea->TexState[1]));
+            sizeof(sarea->tex_state[1]));
    }
 
    if (mmesa->dirty & (MGA_UPLOAD_TEX0 | MGA_UPLOAD_TEX1)) {
-      sarea->TexState[0].texctl2 &= ~TMC_specen_enable;
-      sarea->TexState[1].texctl2 &= ~TMC_specen_enable;
-      sarea->TexState[0].texctl2 |= mmesa->hw.specen;
-      sarea->TexState[1].texctl2 |= mmesa->hw.specen;
+      sarea->tex_state[0].texctl2 &= ~TMC_specen_enable;
+      sarea->tex_state[1].texctl2 &= ~TMC_specen_enable;
+      sarea->tex_state[0].texctl2 |= mmesa->hw.specen;
+      sarea->tex_state[1].texctl2 |= mmesa->hw.specen;
    }
 
    if (mmesa->dirty & MGA_UPLOAD_PIPE) {
 /*        mmesa->sarea->wacceptseq = mmesa->hw_primitive; */
-      mmesa->sarea->WarpPipe = mmesa->vertex_format;
+      mmesa->sarea->warp_pipe = mmesa->vertex_format;
       mmesa->sarea->vertsize = mmesa->vertex_size;
    }