Closed Bug 1285561 Opened 8 years ago Closed 8 years ago

gdk_cairo_create is called off the main thread

Categories

(Core :: Graphics, defect)

50 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: acomminos, Assigned: acomminos)

References

Details

Attachments

(1 file)

When we are unable to acquire a MIT-SHM backed draw target, we use gdk_cairo_create on the compositor thread to create a cairo context.

gdk_cairo_create touches internal GDK state and should not be called off the main thread. I believe it is causing crashes such as;

https://public-artifacts.taskcluster.net/M_kK7CwEReSbobk_kjr-yw/0/public/logs/live_backing.log
This patch refactors swapping to an X11 window on GTK. Some things of interest;

- Adds WindowSurface class which fills the void of an opaque native SourceSurface that can be locked and drawn to. May be useful on other platforms.
- SHM backend currently wraps nsShmImage, but there are plans to replace with an XCB-based implementation.
- Uses BufferMode::BUFFER_NONE for all cases, allowing the removal of BufferMode::BUFFERED.
- Native cairo is avoided entirely.

This removes the wayland path, which breaks sometimes anyway due to gdk_cairo_create being unreliable off the main thread. We're going to focus on EGL as a wayland target for now once we have CSD anyway.

Thanks!
Comment on attachment 8769852 [details]
Bug 1285561 - Refactor surface blitting on X11.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63546/diff/1-2/
FWIW, in the future we could also add a Wayland WindowSurface backend using wl_shm.
https://reviewboard.mozilla.org/r/63546/#review60416

::: widget/gtk/nsWindow.h:458
(Diff revision 2)
>  
>      // for touch event handling
>      nsRefPtrHashtable<nsPtrHashKey<GdkEventSequence>, mozilla::dom::Touch> mTouches;
>  #endif
>  
> +    RefPtr<mozilla::widget::WindowSurface> mWindowSurface;

It doesn't seem like we need to share these things so lets not refcount them.
Comment on attachment 8769852 [details]
Bug 1285561 - Refactor surface blitting on X11.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63546/diff/2-3/
Comment on attachment 8769852 [details]
Bug 1285561 - Refactor surface blitting on X11.

https://reviewboard.mozilla.org/r/63546/#review61158

This is a great looking patch.
Attachment #8769852 - Flags: review?(jmuizelaar) → review+
Pushed by acomminos@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/586815d86b50
Refactor surface blitting on X11. r=jrmuizel
https://hg.mozilla.org/mozilla-central/rev/586815d86b50
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Depends on: 1319554
Depends on: 1449352
You need to log in before you can comment on or make changes to this bug.