i915: Fix driver for the miptree x/y offset changes.
[mesa.git] / src / mesa / drivers / x11 / xm_dd.c
index 38ddd73b6c8051d5390f50d75a810d7201cb1666..465a40ac8dde27cb6a98902eb9126651defd5061 100644 (file)
 #include "swrast_setup/swrast_setup.h"
 #include "tnl/tnl.h"
 #include "tnl/t_context.h"
+#include "drivers/common/meta.h"
 #include "xmesaP.h"
 
-#include "softpipe/sp_context.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
-#include "state_tracker/st_draw.h"
 
 
 /*
@@ -222,7 +219,7 @@ clear_pixmap(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
    assert(xmbuf->cleargc);
 
    XMesaFillRectangle( xmesa->display, xrb->pixmap, xmbuf->cleargc,
-                       x, xrb->St.Base.Height - y - height,
+                       x, xrb->Base.Height - y - height,
                        width, height );
 }
 
@@ -333,9 +330,9 @@ clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
             | ((pixel << 24) & 0xff000000);
    }
 
-   if (width == xrb->St.Base.Width && height == xrb->St.Base.Height) {
+   if (width == xrb->Base.Width && height == xrb->Base.Height) {
       /* clearing whole buffer */
-      const GLuint n = xrb->St.Base.Width * xrb->St.Base.Height;
+      const GLuint n = xrb->Base.Width * xrb->Base.Height;
       GLuint *ptr4 = (GLuint *) xrb->ximage->data;
       if (pixel == 0) {
          /* common case */
@@ -379,8 +376,8 @@ clear_nbit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
 
 
 
-void
-xmesa_clear_buffers(GLcontext *ctx, GLbitfield buffers)
+static void
+clear_buffers(GLcontext *ctx, GLbitfield buffers)
 {
    if (ctx->DrawBuffer->Name == 0) {
       /* this is a window system framebuffer */
@@ -783,7 +780,7 @@ get_string( GLcontext *ctx, GLenum name )
 #ifdef XFree86Server
          return (const GLubyte *) "Mesa GLX Indirect";
 #else
-         return (const GLubyte *) "Mesa X11 (softpipe)";
+         return (const GLubyte *) "Mesa X11";
 #endif
       case GL_VENDOR:
 #ifdef XFree86Server
@@ -910,15 +907,13 @@ xmesa_update_state( GLcontext *ctx, GLbitfield new_state )
    _vbo_InvalidateState( ctx, new_state );
    _swsetup_InvalidateState( ctx, new_state );
 
-   st_invalidate_state( ctx, new_state );
-
-
    if (ctx->DrawBuffer->Name != 0)
       return;
 
    /*
     * GL_DITHER, GL_READ/DRAW_BUFFER, buffer binding state, etc. effect
     * renderbuffer span/clear funcs.
+    * Check _NEW_COLOR to detect dither enable/disable.
     */
    if (new_state & (_NEW_COLOR | _NEW_BUFFERS)) {
       XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer);
@@ -1153,17 +1148,25 @@ xmesa_init_driver_functions( XMesaVisual xmvisual,
    driver->IndexMask = index_mask;
    driver->ColorMask = color_mask;
    driver->Enable = enable;
-   driver->Clear = xmesa_clear_buffers;
    driver->Viewport = xmesa_viewport;
-#ifndef XFree86Server
-   driver->CopyPixels = xmesa_CopyPixels;
-   if (xmvisual->undithered_pf == PF_8R8G8B &&
-       xmvisual->dithered_pf == PF_8R8G8B &&
-       xmvisual->BitsPerPixel == 32) {
-      driver->DrawPixels = xmesa_DrawPixels_8R8G8B;
+   if (TEST_META_FUNCS) {
+      driver->Clear = _mesa_meta_clear;
+      driver->CopyPixels = _mesa_meta_copy_pixels;
+      driver->BlitFramebuffer = _mesa_meta_blit_framebuffer;
+      driver->DrawPixels = _mesa_meta_draw_pixels;
    }
-   else if (xmvisual->undithered_pf == PF_5R6G5B) {
-      driver->DrawPixels = xmesa_DrawPixels_5R6G5B;
+   else {
+      driver->Clear = clear_buffers;
+#ifndef XFree86Server
+      driver->CopyPixels = xmesa_CopyPixels;
+      if (xmvisual->undithered_pf == PF_8R8G8B &&
+          xmvisual->dithered_pf == PF_8R8G8B &&
+          xmvisual->BitsPerPixel == 32) {
+         driver->DrawPixels = xmesa_DrawPixels_8R8G8B;
+      }
+      else if (xmvisual->undithered_pf == PF_5R6G5B) {
+         driver->DrawPixels = xmesa_DrawPixels_5R6G5B;
+      }
    }
 #endif
    driver->TestProxyTexImage = test_proxy_teximage;
@@ -1178,7 +1181,6 @@ xmesa_init_driver_functions( XMesaVisual xmvisual,
    driver->BeginQuery = xmesa_begin_query;
    driver->EndQuery = xmesa_end_query;
 #endif
-
 }