Bug 31604

Summary: CAIRO_FORMAT_A1 broken for many routines in the image backend
Product: cairo Reporter: holger+fdo
Component: image backendAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium CC: siarhei.siamashka, soren.sandmann
Version: 1.10.1   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Check the result of pixman_fill with an assertion
Avoid going through pixman for A1 formats
Use the fallback implementation of surface_fill for CAIRO_FORMAT_A1

Description holger+fdo 2010-11-13 08:21:37 UTC
CAIRO_OPERATOR_CLEAR is broken due the lack of a PIXMAN_A1 implementation of pixman_fill. The same for drawing a black rectangle. Also drawing a polygon is broken. This was posted on the mailinglist with a test case.
Comment 1 holger+fdo 2010-11-13 08:22:55 UTC
Created attachment 40255 [details] [review]
Check the result of pixman_fill with an assertion

Check the result of pixman_fill. It is returning in case there is no implementation.
Comment 2 holger+fdo 2010-11-13 08:24:26 UTC
Created attachment 40256 [details] [review]
Avoid going through pixman for A1 formats

Patch to fix the test case posted on the website. This will change the code paths to not use pixman_fill for the A1 format.
Comment 3 holger+fdo 2010-11-13 08:26:45 UTC
Created attachment 40257 [details] [review]
Use the fallback implementation of surface_fill for CAIRO_FORMAT_A1

Use the same implementation as cairo 1.8 for CAIRO_FORMAT_A1.
Comment 4 M Joonas Pihlaja 2010-11-13 13:05:06 UTC
Would it be easy and effective to add PIXMAN_A1 support to pixman?
Comment 5 Siarhei Siamashka 2010-11-15 13:14:48 UTC
(In reply to comment #4)
> Would it be easy and effective to add PIXMAN_A1 support to pixman?

Tried to make a patch for that:
http://lists.freedesktop.org/archives/pixman/2010-November/000740.html
Comment 6 holger+fdo 2010-11-15 13:40:32 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Would it be easy and effective to add PIXMAN_A1 support to pixman?
> 
> Tried to make a patch for that:
> http://lists.freedesktop.org/archives/pixman/2010-November/000740.html

Thanks, what about test coverage for cairo? It would be nice to know that such things don't happen in the future.
Comment 7 Siarhei Siamashka 2010-11-17 09:37:51 UTC
(In reply to comment #6)
> Thanks, what about test coverage for cairo? It would be nice to know that such
> things don't happen in the future.

Pixman has some coverage for this functionality in its tests. Don't know about cairo.
Comment 8 Siarhei Siamashka 2010-11-22 15:11:48 UTC
Pushed a1 fill patch to pixman git. Now the testcase from http://lists.cairographics.org/archives/cairo/2010-November/021087.html works properly.

Don't know what would be the best immediate solution for the end users. The patch is also applicable for pixman 0.20.0 and 0.18.4. Technically it is not a bugfix, but introduces a new feature thus fulfilling cairo expectations.
Comment 9 Chris Wilson 2011-09-16 08:27:11 UTC
The way I actually choose to fix is to fallback to using a pixman_image_composite if pixman_fill fails. Thanks to Siarhei for adding the functionality to pixman as well.

Test case record for posterity:

commit f3a9a0c9e646ca684ee8e7bd65506cf2793178d2
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Sep 16 16:24:23 2011 +0100

    test: Add a1-fill
    
    Capture the bug report:
    https://bugs.freedesktop.org/show_bug.cgi?id=31604
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.