summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2011-12-14 12:38:27 +0100
committerThomas Hellstrom <thellstrom@vmware.com>2011-12-15 08:32:14 +0100
commit5748c33535bc7d3009b9758653885e6ae0e73002 (patch)
tree311799a48c3d1f7c55f79aa8f8f4fa3fe758fba2
parentf664e31d73bd31594e069d8bcca872687b84d8d9 (diff)
saa, vmwgfx: Fix saa_copy_compositevmwgfx_branch
The traditional accelerated copy methods aren't format aware. Make saa copy format aware,and pass formats on to the driver copy function if available. If the driver can't handle format conversions it needs to return FALSE. This fixes format confusion in the copy composite fastpath. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
-rw-r--r--saa/saa.h2
-rw-r--r--saa/saa_render.c38
-rw-r--r--vmwgfx/vmwgfx_saa.c21
3 files changed, 37 insertions, 24 deletions
diff --git a/saa/saa.h b/saa/saa.h
index 3101353..c7aa3b6 100644
--- a/saa/saa.h
+++ b/saa/saa.h
@@ -74,6 +74,8 @@ struct saa_pixmap {
74 void *addr; 74 void *addr;
75 void *override; 75 void *override;
76 enum saa_pixmap_loc auth_loc; 76 enum saa_pixmap_loc auth_loc;
77 PictFormatShort src_format;
78 PictFormatShort dst_format;
77 uint32_t pad[16]; 79 uint32_t pad[16];
78}; 80};
79 81
diff --git a/saa/saa_render.c b/saa/saa_render.c
index 3c441da..c69f2c9 100644
--- a/saa/saa_render.c
+++ b/saa/saa_render.c
@@ -311,35 +311,29 @@ saa_copy_composite(CARD8 op,
311 ySrc + height > pSrc->pDrawable->height) 311 ySrc + height > pSrc->pDrawable->height)
312 return FALSE; 312 return FALSE;
313 313
314 if (saa_pixmap(saa_get_drawable_pixmap(pSrc->pDrawable))->auth_loc != 314 if (op == PictOpSrc ||
315 saa_loc_driver) 315 (op == PictOpOver && PICT_FORMAT_A(pSrc->format) == 0 &&
316 return FALSE; 316 pMask == NULL)) {
317 317
318 if ((op == PictOpSrc &&
319 (pSrc->format == pDst->format ||
320 (PICT_FORMAT_COLOR(pDst->format) &&
321 PICT_FORMAT_COLOR(pSrc->format) &&
322 pDst->format == PICT_FORMAT(PICT_FORMAT_BPP(pSrc->format),
323 PICT_FORMAT_TYPE(pSrc->format),
324 0,
325 PICT_FORMAT_R(pSrc->format),
326 PICT_FORMAT_G(pSrc->format),
327 PICT_FORMAT_B(pSrc->format))))) ||
328 (op == PictOpOver && pSrc->format == pDst->format &&
329 !PICT_FORMAT_A(pSrc->format))) {
330 Bool ret;
331 int xoff, yoff; 318 int xoff, yoff;
332 PixmapPtr pixmap = saa_get_pixmap(pDst->pDrawable, &xoff, &yoff); 319 PixmapPtr dst_pix = saa_get_pixmap(pDst->pDrawable, &xoff, &yoff);
333 320 struct saa_pixmap *dst_spix = saa_pixmap(dst_pix);
334 if (saa_pixmap(pixmap)->auth_loc != saa_loc_driver) 321 struct saa_pixmap *src_spix =
322 saa_pixmap(saa_get_drawable_pixmap(pSrc->pDrawable));
323 int ret;
324
325 if (src_spix->auth_loc != saa_loc_driver ||
326 dst_spix->auth_loc != saa_loc_driver)
335 return FALSE; 327 return FALSE;
336 328
329 src_spix->src_format = pSrc->format;
330 dst_spix->dst_format = pDst->format;
331
337 xDst += pDst->pDrawable->x; 332 xDst += pDst->pDrawable->x;
338 yDst += pDst->pDrawable->y; 333 yDst += pDst->pDrawable->y;
339 xSrc += pSrc->pDrawable->x; 334 xSrc += pSrc->pDrawable->x;
340 ySrc += pSrc->pDrawable->y; 335 ySrc += pSrc->pDrawable->y;
341 336
342
343 /* 337 /*
344 * Dst region is in backing pixmap space. We need to 338 * Dst region is in backing pixmap space. We need to
345 * translate it. 339 * translate it.
@@ -350,6 +344,10 @@ saa_copy_composite(CARD8 op,
350 REGION_NUM_RECTS(dst_region), 344 REGION_NUM_RECTS(dst_region),
351 xSrc - xDst, ySrc - yDst, FALSE, FALSE); 345 xSrc - xDst, ySrc - yDst, FALSE, FALSE);
352 REGION_TRANSLATE(pScreen, dst_region, xoff, yoff); 346 REGION_TRANSLATE(pScreen, dst_region, xoff, yoff);
347
348 src_spix->src_format = 0;
349 dst_spix->dst_format = 0;
350
353 if (ret) 351 if (ret)
354 return TRUE; 352 return TRUE;
355 } 353 }
diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
index 7788ed5..0a6b98f 100644
--- a/vmwgfx/vmwgfx_saa.c
+++ b/vmwgfx/vmwgfx_saa.c
@@ -896,10 +896,23 @@ vmwgfx_copy_prepare(struct saa_driver *driver,
896 * Determine surface formats. 896 * Determine surface formats.
897 */ 897 */
898 898
899 if (!vmwgfx_hw_accel_stage(src_pixmap, 0, XA_FLAG_RENDER_TARGET, 0)) 899 if (src_vpix->base.src_format == 0) {
900 return FALSE; 900 if (!vmwgfx_hw_accel_stage(src_pixmap, 0, XA_FLAG_RENDER_TARGET, 0))
901 if (!vmwgfx_hw_accel_stage(dst_pixmap, 0, XA_FLAG_RENDER_TARGET, 0)) 901 return FALSE;
902 return FALSE; 902 } else {
903 if (PICT_FORMAT_TYPE(src_vpix->base.src_format) != PICT_TYPE_ARGB ||
904 !vmwgfx_hw_composite_src_stage(src_pixmap, src_vpix->base.src_format))
905 return FALSE;
906 }
907
908 if (dst_vpix->base.dst_format == 0) {
909 if (!vmwgfx_hw_accel_stage(dst_pixmap, 0, XA_FLAG_RENDER_TARGET, 0))
910 return FALSE;
911 } else {
912 if (PICT_FORMAT_TYPE(dst_vpix->base.dst_format) != PICT_TYPE_ARGB ||
913 !vmwgfx_hw_composite_dst_stage(dst_pixmap, dst_vpix->base.dst_format))
914 return FALSE;
915 }
903 916
904 /* 917 /*
905 * Create hardware surfaces. 918 * Create hardware surfaces.