i965: defined BRW_MAX_MRF
[mesa.git] / src / mesa / drivers / x11 / xm_span.c
index 3776891e2eca5c7d44ac50d80c18f1e1fffd0280..309cefcb8e8152dc7b6afdafa4afa0a93c866bfd 100644 (file)
  */
 
 #include "glxheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "depth.h"
-#include "drawpix.h"
-#include "extensions.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "state.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/depth.h"
+#include "main/drawpix.h"
+#include "main/extensions.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
+#include "main/state.h"
 #include "xmesaP.h"
 
 #include "swrast/swrast.h"
@@ -471,8 +471,26 @@ static void put_row_8R8G8B_pixmap( PUT_ROW_ARGS )
    if (mask) {
       for (i=0;i<n;i++,x++) {
          if (mask[i]) {
+#if 1
+            /*
+             * XXX Something funny is going on here.
+             * If we're drawing into a window that uses a depth 32 TrueColor
+             * visual, we see the right pixels on screen, but when we read
+             * them back with XGetImage() we get random colors.
+             * The alternative code below which uses XPutImage() instead
+             * seems to mostly fix the problem, but not always.
+             * We don't normally create windows with this visual, but glean
+             * does and we're seeing some failures there.
+             */
             XMesaSetForeground( dpy, gc, PACK_8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ));
             XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y );
+#else
+            /* This code works more often, but not always */
+            XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage;
+            GLuint *ptr4 = (GLuint *) rowimg->data;
+            *ptr4 = PACK_8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
+            XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, 1, 1 );
+#endif
          }
       }
    }
@@ -1303,17 +1321,6 @@ static void put_row_rgb_TRUEDITHER_ximage( RGB_SPAN_ARGS )
 }
 
 
-
-static void *get_pointer_4_ximage( GLcontext *ctx, 
-                                  struct gl_renderbuffer *rb, 
-                                  GLint x, GLint y )
-{
-   GET_XRB(xrb);
-   return PIXEL_ADDR4(xrb, x, y);
-}
-
-
-
 /*
  * Write a span of PF_8A8B8G8R-format pixels to an ximage.
  */
@@ -4604,7 +4611,6 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb,
          xrb->Base.PutMonoRow    = put_mono_row_8A8B8G8R_ximage;
          xrb->Base.PutValues     = put_values_8A8B8G8R_ximage;
          xrb->Base.PutMonoValues = put_mono_values_8A8B8G8R_ximage;
-        xrb->Base.GetPointer    = get_pointer_4_ximage;
       }
       break;
    case PF_8A8R8G8B:
@@ -4621,7 +4627,6 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb,
          xrb->Base.PutMonoRow    = put_mono_row_8A8R8G8B_ximage;
          xrb->Base.PutValues     = put_values_8A8R8G8B_ximage;
          xrb->Base.PutMonoValues = put_mono_values_8A8R8G8B_ximage;
-        xrb->Base.GetPointer    = get_pointer_4_ximage;
       }
       break;
    case PF_8R8G8B: