Bug 37916 - Assertion triggered with SunRay thin clients connected to a Solaris/SPARC server
Summary: Assertion triggered with SunRay thin clients connected to a Solaris/SPARC server
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: xlib backend (show other bugs)
Version: 1.9.2
Hardware: SPARC Solaris
: medium normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-04 04:04 UTC by Nicolai Stange
Modified: 2011-07-13 07:46 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Backtrace of assertion (7.42 KB, text/plain)
2011-06-04 04:04 UTC, Nicolai Stange
Details
Desperade attempt to work around. Does not fix this issue in general and may have evil side effects. (934 bytes, patch)
2011-06-04 04:06 UTC, Nicolai Stange
Details | Splinter Review
image: Don't crash on weird pixman formats (2.75 KB, patch)
2011-06-04 04:53 UTC, Benjamin Otte
Details | Splinter Review

Description Nicolai Stange 2011-06-04 04:04:47 UTC
Created attachment 47514 [details]
Backtrace of assertion

Hi everybody,

I've already discussed this on #cairo (IRC) and the people there told me to file a bug report.

From time to time, our users are getting the following (reproduceable) assertion while surfing the web with firefox linked against cairo:

Assertion failed: !"reached", file
/tmp/xas/build/X11_cairo_1.9.12_default_default_32/src/cairo-1.9.12/src/cairo-image-surface.c,
line 1294

See the backtrace attached.

Playing a bit around with gdb, I've found out that
cairo-image-surface.c:_pixman_format_from_masks
returns
PIXMAN_b8g8r8x8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8)
and 
cairo-image-surface.c:_cairo_format_from_pixman_format
returns a CAIRO_FORMAT_INVALID for this guy.
This then triggers the assertion later on.

xdpyinfo returns the same mask for the visuals as the one given within the backtrace.


Because of the backtrace, the guys on IRC guessed that there might be a bug within the fallback code. If this is the case and it is easy to fix: Fine, please let me know.
If on the other hand, it is a deeper problem like no BGR support in cairo,
could you have a look at the very desperade workaround attached in 
cairo_sparc_bgr2rgb.diff? It makes cairo believe BGR is RGB and seems to work on this platform, but the possible side effects are very unclear to me. However, I'm highly interested in a quick fix allowing our users to browse their favourite websites again (while not breaking other things, of course).


Thank you very much for having a look and let me know if you need some other information!
Best regards

Nicolai
Comment 1 Nicolai Stange 2011-06-04 04:06:47 UTC
Created attachment 47515 [details] [review]
Desperade attempt to work around. Does not fix this issue in general and may have evil side effects.

Make cairo believe that BGR is RGB and the other way around.
Comment 2 Benjamin Otte 2011-06-04 04:53:17 UTC
Created attachment 47516 [details] [review]
image: Don't crash on weird pixman formats

_pixel_to_solid() used to assert that it got a known cairo_format_t.
However, this might not be the case when backends decide to use a pixman
format that is not representable by a cairo format (X and DirectFB are
examples for backends that do that).

This patch makes _pixel_to_solid() return NULL in that case and fixes
the callers to deal with it.
Comment 3 Benjamin Otte 2011-06-04 04:54:21 UTC
Could you try that patch and see if it works?
Comment 4 Nicolai Stange 2011-06-04 06:05:02 UTC
(In reply to comment #3)
> Could you try that patch and see if it works?
Wow, that was really quick, thank you! 
I'll have a look on monday, when I've got physical access to some SunRay at work.
Comment 5 Nicolai Stange 2011-07-13 02:24:47 UTC
Sorry for the delay, I had to do some oral exam last week.
Anyway, it works like a charm!

Thanks again
Comment 6 Andrea Canciani 2011-07-13 07:46:25 UTC
The patch has been committed:

commit 00de16b7ac54d4c620e0be3565c83f58e01567ac
Author: Benjamin Otte <otte@redhat.com>
Date:   Sat Jun 4 13:47:15 2011 +0200

    image: Don't crash on weird pixman formats
    
    _pixel_to_solid() used to assert that it got a known cairo_format_t.
    However, this might not be the case when backends decide to use a pixman
    format that is not representable by a cairo format (X and DirectFB are
    examples for backends that do that).
    
    This patch makes _pixel_to_solid() return NULL in that case and fixes
    the callers to deal with it.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=37916


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.