st/xorg: lots of fixes
authorZack Rusin <zackr@vmware.com>
Tue, 15 Sep 2009 13:02:20 +0000 (09:02 -0400)
committerZack Rusin <zackr@vmware.com>
Tue, 15 Sep 2009 23:50:34 +0000 (19:50 -0400)
fixes blending binding and copy coordinates

src/gallium/state_trackers/xorg/xorg_composite.c
src/gallium/state_trackers/xorg/xorg_exa.c

index e45a82944b81a94bd366e3909c75b8217173a903..edb7620f1241dcc8317b93b38a72a20307125951 100644 (file)
@@ -12,9 +12,9 @@ struct xorg_composite_blend {
    int op:8;
 
    unsigned rgb_src_factor:5;    /**< PIPE_BLENDFACTOR_x */
-   unsigned rgb_dst_factor:5;    /**< PIPE_BLENDFACTOR_x */
-
    unsigned alpha_src_factor:5;  /**< PIPE_BLENDFACTOR_x */
+
+   unsigned rgb_dst_factor:5;    /**< PIPE_BLENDFACTOR_x */
    unsigned alpha_dst_factor:5;  /**< PIPE_BLENDFACTOR_x */
 };
 
@@ -836,11 +836,6 @@ static void renderer_copy_texture(struct exa_context *exa,
    assert(dst->width[0] != 0);
    assert(dst->height[0] != 0);
 
-#if 0
-   debug_printf("copy texture [%f, %f, %f, %f], [%f, %f, %f, %f]\n",
-                sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2);
-#endif
-
 #if 1
    s0 = sx1 / src->width[0];
    s1 = sx2 / src->width[0];
@@ -853,6 +848,12 @@ static void renderer_copy_texture(struct exa_context *exa,
    t1 = 1;
 #endif
 
+#if 1
+   debug_printf("copy texture src=[%f, %f, %f, %f], dst=[%f, %f, %f, %f], tex=[%f, %f, %f, %f]\n",
+                sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2,
+                s0, t0, s1, t1);
+#endif
+
    assert(screen->is_format_supported(screen, dst_surf->format,
                                       PIPE_TEXTURE_2D,
                                       PIPE_TEXTURE_USAGE_RENDER_TARGET,
@@ -920,6 +921,8 @@ static void renderer_copy_texture(struct exa_context *exa,
          fb.cbufs[i] = 0;
    }
    cso_set_framebuffer(exa->cso, &fb);
+   setup_vs_constant_buffer(exa, fb.width, fb.height);
+   setup_fs_constant_buffer(exa);
 
    /* draw quad */
    buf = setup_vertex_data_tex(exa,
@@ -1002,14 +1005,14 @@ void xorg_copy_pixmap(struct exa_context *ctx,
       renderer_copy_texture(ctx,
                             src,
                             src_loc[0],
-                            src_loc[1] + src_loc[3],
-                            src_loc[0] + src_loc[2],
                             src_loc[1],
+                            src_loc[0] + src_loc[2],
+                            src_loc[1] + src_loc[3],
                             dst,
                             dst_loc[0],
-                            dst_loc[1] + dst_loc[3],
+                            dst_loc[1],
                             dst_loc[0] + dst_loc[2],
-                            dst_loc[1]);
+                            dst_loc[1] + dst_loc[3]);
    }
 }
 
index 75524891f7a2d4495f741dec3fb48bdf9d866030..3c2639e7d978a9d08b7d0b25d348660c45f4552f 100644 (file)
@@ -309,6 +309,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
 #if 1
     debug_printf("  ExaPrepareSolid(0x%x)\n", fg);
 #endif
+
     return xorg_solid_bind_state(exa, priv, fg);
 }
 
@@ -332,6 +333,15 @@ ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1)
 #endif
 
 #if DEBUG_SOLID
+       exa->solid_color[0] = 0.f;
+       exa->solid_color[1] = 1.f;
+       exa->solid_color[2] = 0.f;
+       exa->solid_color[3] = 1.f;
+    xorg_solid(exa, priv, 0, 0, 1024, 768);
+       exa->solid_color[0] = 1.f;
+       exa->solid_color[1] = 0.f;
+       exa->solid_color[2] = 0.f;
+       exa->solid_color[3] = 1.f;
     xorg_solid(exa, priv, 0, 0, 300, 300);
     xorg_solid(exa, priv, 300, 300, 350, 350);
     xorg_solid(exa, priv, 350, 350, 500, 500);
@@ -340,6 +350,12 @@ ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1)
                priv->tex->height[0] - 10,
                priv->tex->width[0],
                priv->tex->height[0]);
+
+    ExaPrepareCopy(pPixmap, pPixmap, 0, 0, GXcopy, 0xffffffff);
+    ExaCopy(pPixmap, 350, 350, 510, 350, 150, 150);
+    ExaCopy(pPixmap, 350, 350, 510, 190, 150, 150);
+    xorg_exa_finish(exa);
+    ExaCopy(pPixmap, 0, 0, 0, 0, 1024, 768);
 #else
     xorg_solid(exa, priv, x0, y0, x1, y1) ;
 #endif
@@ -613,8 +629,8 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
                struct pipe_surface *dst_surf;
                 struct pipe_surface *src_surf;
 
-               dst_surf = exa->scrn->get_tex_surface(exa->scrn, texture, 0, 0, 0,
-                                                     PIPE_BUFFER_USAGE_GPU_WRITE);
+               dst_surf = exa->scrn->get_tex_surface(
+                   exa->scrn, texture, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE);
                src_surf = exa_gpu_surface(exa, priv);
                exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf,
                                         0, 0, min(width, texture->width[0]),