gallium: Handle non-NULL data pointer in EXA ModifyPixmapHeader hook.
authorMichel Dänzer <daenzer@vmware.com>
Thu, 23 Apr 2009 13:47:31 +0000 (14:47 +0100)
committerMichel Dänzer <daenzer@vmware.com>
Thu, 23 Apr 2009 13:47:31 +0000 (14:47 +0100)
Need to use the data pointed to for pixmap contents in that case.

Fixes RENDER based text rendering.

src/gallium/state_trackers/xorg/xorg_exa.c

index d743e1e300e4c20600e3b1578611a3d43cac7927..791317435427c441b9f936328beb9697fdcf7202 100644 (file)
@@ -37,6 +37,8 @@
 #include "pipe/p_state.h"
 #include "pipe/p_inlines.h"
 
+#include "util/u_rect.h"
+
 struct exa_entity
 {
     ExaDriverPtr pExa;
@@ -436,6 +438,18 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
        priv->tex = exa->scrn->texture_create(exa->scrn, &template);
     }
 
+    if (pPixData) {
+       struct pipe_transfer *transfer =
+           exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
+                                       PIPE_TRANSFER_WRITE,
+                                       0, 0, width, height);
+        pipe_copy_rect(exa->scrn->transfer_map(exa->scrn, transfer),
+                       &priv->tex->block, transfer->stride, 0, 0,
+                       width, height, pPixData, pPixmap->devKind, 0, 0);
+        exa->scrn->transfer_unmap(exa->scrn, transfer);
+        exa->scrn->tex_transfer_destroy(transfer);
+    }
+
     return TRUE;
 }