Bug 48221

Summary: Wayland gtk clients broken by 38a242a: spans,image,gl: Add fast-path for simple copies
Product: cairo Reporter: bugzilla
Component: gl backendAssignee: cairo-bugs mailing list <cairo-bugs>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: blocker    
Priority: highest CC: darxus
Version: 1.12.0   
Hardware: Other   
OS: All   
i915 platform: i915 features:
Attachments: Patch against 38a242a which fixes this bug

Description bugzilla 2012-04-02 16:34:14 UTC
When using gtk-based programs on wayland, cairo commit 38a242a "spans,image,gl: Add fast-path for simple copies" makes them corrupted. Specifically, I think, any partly-repainted regions become transparent, and remain so until the window is fully repainted.

gnome-calculator demonstrates the problem quite nicely.
Comment 1 Darxus 2012-04-05 07:17:04 UTC
Verified mentioned first bad commit glitches, and commit before it works.  With wayland 0.85.

Video of problem here:  http://www.chaosreigns.com/wayland/demos/2012-04-03-wayland-gtk-glitches.html
Comment 2 Uli Schlachter 2012-04-05 09:42:55 UTC
Something caught my eye in that commit:

(In function composite_boxes(), cairo-gl-spans-compositor.c, line 371)

-    _cairo_gl_operand_translate (&setup.mask, -src_x, -src_y);
+    _cairo_gl_operand_translate (&setup.src, -src_x, -src_y);

From the surrounding code, I see that this change makes sense. However, it seems unrelated to the rest of this commit. Could someone check if just reverting this change makes the problems go away?

Disclaimer: I have no clue what I am doing here. :-)
Comment 3 Darxus 2012-04-06 19:09:06 UTC
(In reply to comment #2)
> seems unrelated to the rest of this commit. Could someone check if just
> reverting this change makes the problems go away?

I tried, it didn't help.
Comment 4 Darxus 2012-04-12 07:44:11 UTC
Created attachment 59861 [details] [review]
Patch against 38a242a which fixes this bug


-       spans.draw_image_boxes = draw_image_boxes;
+//     spans.draw_image_boxes = draw_image_boxes;

in src/cairo-gl-spans-compositor.c
Comment 5 Darxus 2012-04-12 07:45:57 UTC
Ugh, please ignore the previous comment.  That change did not fix this problem.
Comment 6 Darxus 2012-04-12 08:03:17 UTC

-       spans.copy_boxes = copy_boxes;
+//     spans.copy_boxes = copy_boxes;

Doesn't seem to fix it either.
Comment 7 bugzilla 2012-04-13 13:21:42 UTC
Created attachment 59939 [details] [review]

The attached sign-swap in _cairo_gl_operand_translate fixes this bug for me. I've checked gnome-calculator and gtk3-demo in wayland, and this fixes both of them.

I don't understand the code well enough to know why this fixes it, or why it was this way in the first place.
Comment 8 Chris Wilson 2012-05-04 02:16:17 UTC
commit 748dcdef4b67097c079a3ff98f970451428c24f3
Author: Chuanbo Weng <strgnm@gmail.com>
Date:   Fri May 4 08:53:20 2012 +0800

    gl: fix the translate value in copy_boxes.
    Fixes 36 test cases (such as push-group-color)
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48221