On 12/15/2010 08:20 PM, Christoph Bumiller wrote:
> On 12/15/2010 07:55 PM, Jerome Glisse wrote:
>> Hi,
>>
>> I am facing an issue which i am not sure what is the proper things to
>> do about. piglit tfp test try to upload PIPE_FORMAT_B8G8R8A8_UNORM to
>> texture pixmap which is  PIPE_FORMAT_B8G8R8X8_UNORM r600g assert in
>> blitter util because format are not compatible. Should all pixmap
>> texture considered with A8 ? Should i just disable the assert in case
>> of A->X convertion ? Other answer ?
>>
> 
> 1. The assertion is in the wrong place, since util_blitter_copy_region's
> description reads:
> "You can copy from any color format to any other color format provided
> the former can be sampled and the latter can be rendered to. Otherwise,
> a software fallback path is taken and both surfaces must be of the same
> format."
> 
> 2. The arguments to util_is_format_compatible in the assertion are
> reversed:
> "Whether the src format can be blitted to destation format with a simple
> memcpy." - this is true for A8 -> X8, only X8 -> A8 cannot be done with
> memcpy.
> 
> assert(util_is_format_compatible(util_format_description(dst->format),
> util_format_description(src->format)));
> 
> boolean util_is_format_compatible(const struct util_format_description
> *src_desc, const struct util_format_description *dst_desc);
> 
Patch attached.

> Christoph
> 
>> https://bugs.freedesktop.org/show_bug.cgi?id=32370
>>
>> Cheers,
>> Jerome
>> _______________________________________________
>> mesa-dev mailing list
>> [email protected]
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
> _______________________________________________
> mesa-dev mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

>From 211ae8b80f8e82c1313a638458ae8297f2190111 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <[email protected]>
Date: Wed, 15 Dec 2010 21:29:38 +0100
Subject: [PATCH] u_blitter: fix format compatibility assertion

The description of util_blitter_copy_region promises that format
conversion will be done if it is possible.
The assertion only applies if resource_copy_region must be used.
---
 src/gallium/auxiliary/util/u_blitter.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c 
b/src/gallium/auxiliary/util/u_blitter.c
index 4c986e3..dc411ab 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -727,6 +727,7 @@ void util_blitter_copy_region(struct blitter_context 
*blitter,
    unsigned height = srcbox->height;
    boolean is_stencil, is_depth;
    boolean normalized;
+   boolean compatible;
 
    /* Give up if textures are not set. */
    assert(dst && src);
@@ -735,11 +736,13 @@ void util_blitter_copy_region(struct blitter_context 
*blitter,
 
    /* Sanity checks. */
    if (dst == src) {
+      compatible = TRUE;
       assert(!is_overlap(srcbox->x, srcbox->x + width, srcbox->y, srcbox->y + 
height,
                          dstx, dstx + width, dsty, dsty + height));
    } else {
-      assert(util_is_format_compatible(util_format_description(dst->format),
-                                       util_format_description(src->format)));
+      compatible =
+         util_is_format_compatible(util_format_description(src->format),
+                                   util_format_description(dst->format));
    }
    assert(src->target < PIPE_MAX_TEXTURE_TYPES);
    /* XXX should handle 3d regions */
@@ -757,13 +760,15 @@ void util_blitter_copy_region(struct blitter_context 
*blitter,
    /* Check if we can sample from and render to the surfaces. */
    /* (assuming copying a stencil buffer is not possible) */
     if ((!ignore_stencil && is_stencil) ||
+        compatible ||
        !screen->is_format_supported(screen, dst->format, dst->target,
                                     dst->nr_samples, bind, 0) ||
        !screen->is_format_supported(screen, src->format, src->target,
                                     src->nr_samples, PIPE_BIND_SAMPLER_VIEW, 
0)) {
-      util_resource_copy_region(pipe, dst, dstlevel, dstx, dsty, dstz,
-                                src, srclevel, srcbox);
-      return;
+       assert(compatible);
+       util_resource_copy_region(pipe, dst, dstlevel, dstx, dsty, dstz,
+                                 src, srclevel, srcbox);
+       return;
    }
 
    /* Get surface. */
-- 
1.7.2.2

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to