Bug 26063

Summary: [PATCH] various fixes to cairo-qt
Product: cairo Reporter: Hanno Meyer-Thurow <h.mth>
Component: qt backendAssignee: cairo-bugs mailing list <cairo-bugs>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: 1.9.5   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: flush: fix crash; if QPainter pointer is NULL(lost, wtf?!) do not try to access
flush: only call QPainter::end() & QPainter::begin() if we own QPainter pointer; otherwise call QPainter::restore()
finish: remove call to QPainter::restore() here; see patch above

Description Hanno Meyer-Thurow 2010-01-15 06:06:49 UTC
Created attachment 32656 [details] [review]
flush: fix crash; if QPainter pointer is NULL(lost, wtf?!) do not try to access

I built firefox with cairo-qt and found some bugs.
I am going to attach a patch for each of the three cases I encountered.
The fourth case where XErrors happen I can just guess that it comes from the xlib-render hack.
Comment 1 Hanno Meyer-Thurow 2010-01-15 06:08:05 UTC
Created attachment 32657 [details] [review]
flush: only call QPainter::end() & QPainter::begin() if we own QPainter pointer; otherwise call QPainter::restore()
Comment 2 Hanno Meyer-Thurow 2010-01-15 06:08:53 UTC
Created attachment 32658 [details] [review]
finish: remove call to QPainter::restore() here; see patch above
Comment 3 Hanno Meyer-Thurow 2010-01-15 06:14:30 UTC
O, well, 'cairo_qpainter_' should be replaced with 'cairo_qt_' in the patches.

$ sed -e "s/cairo_qpainter_/cairo_qt_/g" -i qt-*.diff

The XErrors I see are:

X Error: BadMatch (invalid parameter attributes) 8
Extension: 149 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x104

X Error: RenderBadPicture (invalid Picture parameter) 171
Extension: 149 (RENDER)
Minor opcode: 23 (RenderCompositeGlyphs8)
Resource id: 0x1803105 

X Error: RenderBadPicture (invalid Picture parameter) 171
Extension: 149 (RENDER)
Minor opcode: 7 (RenderFreePicture)
Resource id: 0x1803bdb 


Any ideas?
Comment 4 Chris Wilson 2010-01-15 06:38:49 UTC
Taken the flush() fixes (with a modification to balance ->restore()). As for the BadMatch, can you run xtrace and extract the erroneous sequence?

commit 6950b233e41a0c926465728c37f9bc5512f2844b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 15 14:25:16 2010 +0000

    qt: Make flush() robust.
    
    Hanno Meyer-Thurow reported in
    
      http://bugs.freedesktop.org/show_bug.cgi?id=26063
      [PATCH] various fixes to cairo-qt
    
    a few issues related to _cairo_qt_surface_flush() where firefox was
    crashing after being built to use cairo-qt.
    
    This is an amalgam of those patches that hopefully address the issue.

Comment 5 Hanno Meyer-Thurow 2010-01-15 08:07:12 UTC
xtrace does not show anything. Or I just prefer gdb. :)

Still, I have not done X Error debugging before. And google just does not help me to identify the environment variable to get xlib (error reporting) synchronized. I will be back if I find some useful docs.
Comment 6 Hanno Meyer-Thurow 2010-01-15 08:55:34 UTC
Okay, I got it synchronized and it seems to happen in _cairo_qt_surface_show_glyphs. The X Errors are inside the printf calls now, see below. But it does not always happen.
The testcase I have is simpe, open google.com. There are transparent texts that fade in, perhaps?

And I just saw that create_with_image does not create a xlib surface? But adding the creation there, too, does not help with the X Errors. Well, that is all I can help here, sorry.

___
cairo-qt: xlib start
X Error: BadMatch (invalid parameter attributes) 8
Extension:    149 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id:  0x104
X Error: RenderBadPicture (invalid Picture parameter) 171
Extension:    149 (RENDER)
Minor opcode: 5 (RenderChangePicture)
Resource id:  0x104
X Error: RenderBadPicture (invalid Picture parameter) 171
Extension:    149 (RENDER)
Minor opcode: 23 (RenderCompositeGlyphs8)
Resource id:  0x1a00168
cairo-qt: xlib stop
Comment 7 Hanno Meyer-Thurow 2010-01-16 05:37:32 UTC
Well, since the initial bugreport is fixed this can be closed/fixed. Thank you!
For the glyphs errors one may open another bugreport with better info or patch.
Comment 8 Hanno Meyer-Thurow 2010-01-17 14:22:25 UTC
O well, before this bug is closed I want to add some info about the X Errors.
They happen where opacity is set to zero. Any higher value and the X Errors disappear.
Comment 9 Hanno Meyer-Thurow 2010-01-18 22:00:17 UTC
Okay, synchronized my cairo-qt version to cairo head. Now, the X Errors are gone.

Closing as FIXED, thank you for your help!

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.