Bug 154814 - [GTK] webkitWebViewBaseRealize broken in Wayland with USE_OPENGL=OFF
Summary: [GTK] webkitWebViewBaseRealize broken in Wayland with USE_OPENGL=OFF
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-29 07:01 PST by Ray Strode [halfline]
Modified: 2016-02-29 11:59 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ray Strode [halfline] 2016-02-29 07:01:53 PST
if I run epiphany in Fedora 24, I see warnings like:

$ epiphany 

Gdk-WARNING **: gdkwindow-x11.c:5550 drawable is not a native X11 window

Gdk-WARNING **: gdkwindow-x11.c:5550 drawable is not a native X11 window

GLib-GObject-WARNING **: invalid cast from 'GdkWaylandVisual' to 'GdkX11Visual'

Gdk-WARNING **: gdkwindow-x11.c:5550 drawable is not a native X11 window

GLib-GObject-WARNING **: invalid cast from 'GdkWaylandVisual' to 'GdkX11Visual'

Gdk-WARNING **: gdkwindow-x11.c:5550 drawable is not a native X11 window

GLib-GObject-WARNING **: invalid cast from 'GdkWaylandVisual' to 'GdkX11Visual'

Gdk-WARNING **: gdkwindow-x11.c:5550 drawable is not a native X11 window

GLib-GObject-WARNING **: invalid cast from 'GdkWaylandVisual' to 'GdkX11Visual'

Gdk-WARNING **: gdkwindow-x11.c:5550 drawable is not a native X11 window

** WARNING **: Failed to connect to UI process: Could not connect: Resource temporarily unavailable

** WARNING **: Failed to connect to UI process: Could not connect: Resource temporarily unavailable


It seems to be trying to use X on a wayland display.  I also get a crash:

                #0  0x00007f20a08e1c0d XCreatePixmap (libX11.so.6)
                #1  0x00007f209eb27a43 _ZN7WebCore27BackingStoreBackendCairoX11C2EmP6VisualiRKNS_7IntSizeEf (libwebkit2gtk-4.0.so.37)
                #2  0x00007f209de08917 _ZN6WebKit12BackingStore13createBackendEv (libwebkit2gtk-4.0.so.37)
                #3  0x00007f209de08c37 _ZN6WebKit12BackingStore17incorporateUpdateEPNS_15ShareableBitmapERKNS_10UpdateInfoE (libwebkit2gtk-4.0.so.37)
                #4  0x00007f209ddb3d76 _ZN6WebKit12BackingStore17incorporateUpdateERKNS_10UpdateInfoE (libwebkit2gtk-4.0.so.37)
                #5  0x00007f209ddb41cf _ZN6WebKit20DrawingAreaProxyImpl17incorporateUpdateERKNS_10UpdateInfoE (libwebkit2gtk-4.0.so.37)
                #6  0x00007f209de38bf6 _ZN6WebKit16DrawingAreaProxy17didReceiveMessageERN3IPC10ConnectionERNS1_14MessageDecoderE (libwebkit2gtk-4.0.so.37)
                #7  0x00007f209dba9f29 _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_14MessageDecoderE (libwebkit2gtk-4.0.so.37)
                #8  0x00007f209dc5da82 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_14MessageDecoderE (libwebkit2gtk-4.0.so.37)
                #9  0x00007f209dba6326 _ZN3IPC10Connection15dispatchMessageESt10unique_ptrINS_14MessageDecoderESt14default_deleteIS2_EE (libwebkit2gtk-4.0.so.37)
                #10 0x00007f209dba6c40 _ZN3IPC10Connection18dispatchOneMessageEv (libwebkit2gtk-4.0.so.37)
                #11 0x00007f209d5069ac _ZN3WTF7RunLoop11performWorkEv (libjavascriptcoregtk-4.0.so.18)
                #12 0x00007f209d529be9 _ZZN3WTF7RunLoopC4EvENUlPvE_4_FUNES1_ (libjavascriptcoregtk-4.0.so.18)
                #13 0x00007f2099444f9a g_main_dispatch (libglib-2.0.so.0)
                #14 0x00007f2099445330 g_main_context_iterate (libglib-2.0.so.0)
                #15 0x00007f20994453dc g_main_context_iteration (libglib-2.0.so.0)
                #16 0x00007f2099a125cd g_application_run (libgio-2.0.so.0)
                #17 0x000055714cb39207 main (epiphany)
                #18 0x00007f20985a6800 __libc_start_main (libc.so.6)
                #19 0x000055714cb397a9 _start (epiphany)

backtrace of the first message is:

(gdb) bt 
#0  0x00007ffff0104700 in g_logv (log_domain=0x7ffff1d27ccd "Gdk", log_level=G_LOG_LEVEL_WARNING, format=0x7ffff1d28638 "gdkwindow-x11.c:5550 drawable is not a native X11 window", args=args@entry=0x7fffffffb550) at gmessages.c:965
#1  0x00007ffff0104b1f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1118
#2  0x00007ffff1ceb1d7 in gdk_x11_window_get_xid (window=0x555555fe5840 [GdkWaylandWindow]) at gdkwindow-x11.c:5550
#3  0x00007ffff4cf324e in webkitWebViewBaseRealize(_GtkWidget*) () at /lib64/libwebkit2gtk-4.0.so.37
#7  0x00007ffff03ef88f in <emit signal ??? on instance 0x555555f95390 [EphyWebView]> (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3441
    #4  0x00007ffff03d3995 in g_closure_invoke (closure=closure@entry=0x55555587dc70, return_value=return_value@entry=0x0, n_param_values=1, param_values=param_values@entry=0x7fffffffb8d0, invocation_hint=invocation_hint@entry=0x7fffffffb850) at gclosure.c:804
    #5  0x00007ffff03e604c in signal_emit_unlocked_R (node=node@entry=0x55555587ff90, detail=detail@entry=0, instance=instance@entry=0x555555f95390, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffb8d0) at gsignal.c:3559
    #6  0x00007ffff03ef4c0 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffba90) at gsignal.c:3385
#8  0x00007ffff2411668 in gtk_widget_realize (widget=0x555555f95390 [EphyWebView]) at gtkwidget.c:5454
#9  0x00007ffff24107f4 in gtk_widget_map (widget=0x555555f95390 [EphyWebView]) at gtkwidget.c:4981
#10 0x00007ffff211e025 in gtk_container_map_child (child=0x555555f95390 [EphyWebView], client_data=0x0) at gtkcontainer.c:3645
#11 0x00007ffff228be1e in gtk_overlay_forall (overlay=0x555555fa9b20 [GtkOverlay], include_internals=1, callback=0x7ffff211dfd9 <gtk_container_map_child>, callback_data=0x0) at gtkoverlay.c:617
#12 0x00007ffff211b877 in gtk_container_forall (container=0x555555fa9b20 [GtkOverlay], callback=0x7ffff211dfd9 <gtk_container_map_child>, callback_data=0x0)
    at gtkcontainer.c:2412
#13 0x00007ffff211e070 in gtk_container_map (widget=0x555555fa9b20 [GtkOverlay]) at gtkcontainer.c:3653
#14 0x00007ffff228b7d1 in gtk_overlay_map (widget=0x555555fa9b20 [GtkOverlay]) at gtkoverlay.c:453
#15 0x00007ffff03d3b12 in _g_closure_invoke_va (closure=closure@entry=0x55555587de90, return_value=return_value@entry=0x0, instance=instance@entry=0x555555fa9b20, args=args@entry=0x7fffffffbf60, n_params=0, param_types=0x0) at gclosure.c:867
#16 0x00007ffff03ef24d in g_signal_emit_valist (instance=0x555555fa9b20, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffbf60)
    at gsignal.c:3294
#17 0x00007ffff03ef88f in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3441
#18 0x00007ffff2410812 in gtk_widget_map (widget=0x555555fa9b20 [GtkOverlay]) at gtkwidget.c:4983
#19 0x00007ffff211e025 in gtk_container_map_child (child=0x555555fa9b20 [GtkOverlay], client_data=0x0) at gtkcontainer.c:3645
#20 0x00007ffff22930f4 in gtk_paned_forall (container=0x555555fab7a0 [GtkPaned], include_internals=1, callback=0x7ffff211dfd9 <gtk_container_map_child>, callback_data=0x0) at gtkpaned.c:2324
#21 0x00007ffff211b877 in gtk_container_forall (container=0x555555fab7a0 [GtkPaned], callback=0x7ffff211dfd9 <gtk_container_map_child>, callback_data=0x0)
    at gtkcontainer.c:2412
#22 0x00007ffff211e070 in gtk_container_map (widget=0x555555fab7a0 [GtkPaned]) at gtkcontainer.c:3653
#23 0x00007ffff2291a67 in gtk_paned_map (widget=0x555555fab7a0 [GtkPaned]) at gtkpaned.c:1759
#24 0x00007ffff03d3b12 in _g_closure_invoke_va (closure=closure@entry=0x55555587de90, return_value=return_value@entry=0x0, instance=instance@entry=0x555555fab7a0, args=args@entry=0x7fffffffc3a0, n_params=0, param_types=0x0) at gclosure.c:867
#25 0x00007ffff03ef24d in g_signal_emit_valist (instance=0x555555fab7a0, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffc3a0)
    at gsignal.c:3294
#26 0x00007ffff03ef88f in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3441
#27 0x00007ffff2410812 in gtk_widget_map (widget=0x555555fab7a0 [GtkPaned]) at gtkwidget.c:4983
---Type <return> to continue, or q <return> to quit---
#28 0x00007ffff211e025 in gtk_container_map_child (child=0x555555fab7a0 [GtkPaned], client_data=0x0) at gtkcontainer.c:3645
#29 0x00007ffff20b596f in gtk_box_forall (container=0x555555fa8bd0 [EphyEmbed], include_internals=1, callback=0x7ffff211dfd9 <gtk_container_map_child>, callback_data=0x0) at gtkbox.c:2661
#30 0x00007ffff211b877 in gtk_container_forall (container=0x555555fa8bd0 [EphyEmbed], callback=0x7ffff211dfd9 <gtk_container_map_child>, callback_data=0x0)
    at gtkcontainer.c:2412
#31 0x00007ffff211e070 in gtk_container_map (widget=0x555555fa8bd0 [EphyEmbed]) at gtkcontainer.c:3653
#35 0x00007ffff03ef88f in <emit signal ??? on instance 0x555555fa8bd0 [EphyEmbed]> (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3441
    #32 0x00007ffff03d38ef in g_closure_invoke (closure=closure@entry=0x55555587de90, return_value=return_value@entry=0x0, n_param_values=1, param_values=param_values@entry=0x7fffffffc760, invocation_hint=invocation_hint@entry=0x7fffffffc6e0) at gclosure.c:804
    #33 0x00007ffff03e604c in signal_emit_unlocked_R (node=node@entry=0x555555880310, detail=detail@entry=0, instance=instance@entry=0x555555fa8bd0, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffc760) at gsignal.c:3559
    #34 0x00007ffff03ef4c0 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffc920) at gsignal.c:3385
#36 0x00007ffff2410812 in gtk_widget_map (widget=0x555555fa8bd0 [EphyEmbed]) at gtkwidget.c:4983
#37 0x00007ffff211e025 in gtk_container_map_child (child=0x555555fa8bd0 [EphyEmbed], client_data=0x0) at gtkcontainer.c:3645
#38 0x00007ffff2280fdc in gtk_notebook_forall (container=0x5555558d41c0 [EphyNotebook], include_internals=1, callback=0x7ffff211dfd9 <gtk_container_map_child>, callback_data=0x0) at gtknotebook.c:4532
#39 0x00007ffff211b877 in gtk_container_forall (container=0x5555558d41c0 [EphyNotebook], callback=0x7ffff211dfd9 <gtk_container_map_child>, callback_data=0x0) at gtkcontainer.c:2412
#40 0x00007ffff211e070 in gtk_container_map (widget=0x5555558d41c0 [EphyNotebook]) at gtkcontainer.c:3653
#41 0x00007ffff227b3cc in gtk_notebook_map (widget=0x5555558d41c0 [EphyNotebook]) at gtknotebook.c:1885
#42 0x00007ffff03d3b12 in _g_closure_invoke_va (closure=closure@entry=0x55555587de90, return_value=return_value@entry=0x0, instance=instance@entry=0x5555558d41c0, args=args@entry=0x7fffffffcd80, n_params=0, param_types=0x0) at gclosure.c:867
#43 0x00007ffff03ef24d in g_signal_emit_valist (instance=0x5555558d41c0, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffcd80)
    at gsignal.c:3294
#44 0x00007ffff03ef88f in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3441
#45 0x00007ffff2410812 in gtk_widget_map (widget=0x5555558d41c0 [EphyNotebook]) at gtkwidget.c:4983
#46 0x00007ffff2438261 in gtk_window_map (widget=0x5555558eade0 [EphyWindow]) at gtkwindow.c:6189
#47 0x00007ffff20a0a38 in gtk_application_window_real_map (widget=0x5555558eade0 [EphyWindow]) at gtkapplicationwindow.c:712
#48 0x00007ffff03d3bc4 in _g_closure_invoke_va (closure=closure@entry=0x55555587de90, return_value=return_value@entry=0x0, instance=instance@entry=0x5555558eade0, args=args@entry=0x7fffffffd170, n_params=<optimized out>, param_types=0x0) at gclosure.c:867
#49 0x00007ffff03ef24d in g_signal_emit_valist (instance=0x5555558eade0, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffd170)
    at gsignal.c:3294
#50 0x00007ffff03ef88f in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3441
#51 0x00007ffff2410812 in gtk_widget_map (widget=0x5555558eade0 [EphyWindow]) at gtkwidget.c:4983
#52 0x00007ffff2437e70 in gtk_window_show (widget=0x5555558eade0 [EphyWindow]) at gtkwindow.c:6094
#56 0x00007ffff03ef88f in <emit signal ??? on instance 0x5555558eade0 [EphyWindow]> (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3441
    #53 0x00007ffff03d3995 in g_closure_invoke (closure=closure@entry=0x55555587e0b0, return_value=return_value@entry=0x0, n_param_values=1, param_values=param_values@entry=0x7fffffffd4c0, invocation_hint=invocation_hint@entry=0x7fffffffd440) at gclosure.c:804
---Type <return> to continue, or q <return> to quit---
    #54 0x00007ffff03e604c in signal_emit_unlocked_R (node=node@entry=0x55555587fe70, detail=detail@entry=0, instance=instance@entry=0x5555558eade0, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffd4c0) at gsignal.c:3559
    #55 0x00007ffff03ef4c0 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffd680) at gsignal.c:3385
#57 0x00007ffff24100db in gtk_widget_show (widget=0x5555558eade0 [EphyWindow]) at gtkwidget.c:4784
#58 0x0000555555588159 in ephy_shell_new_tab_full ()
#59 0x000055555559f89e in session_start_element ()
#60 0x00007ffff0101503 in emit_start_element (context=context@entry=0x5555559a8d80, error=error@entry=0x7fffffffd9f0) at gmarkup.c:1042
#61 0x00007ffff01026be in g_markup_parse_context_parse (context=0x5555559a8d80, text=<optimized out>, text_len=<optimized out>, error=0x7fffffffd9f0)
    at gmarkup.c:1389
#62 0x00005555555a0526 in load_stream_read_cb ()
#63 0x00007ffff067a446 in async_ready_callback_wrapper (source_object=0x7fff800014a0 [GLocalFileInputStream], res=0x555555917560, user_data=0x5555559171d0)
    at ginputstream.c:532
#64 0x00007ffff06a3719 in g_task_return_now (task=0x555555917560 [GTask]) at gtask.c:1107
#65 0x00007ffff06a3759 in complete_in_idle_cb (task=0x555555917560) at gtask.c:1121
#66 0x00007ffff00fdf9a in g_main_context_dispatch (context=0x555555847ee0) at gmain.c:3154
#67 0x00007ffff00fdf9a in g_main_context_dispatch (context=context@entry=0x555555847ee0) at gmain.c:3769
#68 0x00007ffff00fe330 in g_main_context_iterate (context=context@entry=0x555555847ee0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at gmain.c:3840
#69 0x00007ffff00fe3dc in g_main_context_iteration (context=context@entry=0x555555847ee0, may_block=may_block@entry=1) at gmain.c:3901
#70 0x00007ffff06cb5cd in g_application_run (application=0x5555558aaf60 [EphyShell], argc=1, argv=0x7fffffffdd38) at gapplication.c:2363
#71 0x0000555555586a94 in main ()

Might be related to the fact that Fedora 24 is built with ENABLE_OPENGL=off since the problem doesn't happen in rawhide with the same version (but has opengl enabled)
Comment 1 Michael Catanzaro 2016-02-29 07:14:18 PST
(In reply to comment #0)
> Might be related to the fact that Fedora 24 is built with ENABLE_OPENGL=off
> since the problem doesn't happen in rawhide with the same version (but has
> opengl enabled)

This code in webkitWebViewBaseRealize is wrong:

#if USE(TEXTURE_MAPPER) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW)
    if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea()))
        drawingArea->setNativeSurfaceHandleForCompositing(GDK_WINDOW_XID(window));
#endif

You can see it improperly casts the GdkWindow to a GdkX11Window without checking to make sure it's X11. And I see it's guarded by USE(TEXTURE_MAPPER) so it's indeed not enabled by default, that explains why it works in rawhide (where I reenabled USE_OPENGL after our recent bugfixes) but not F24 (which I accidentally did not reenable USE_OPENGL until just now).
Comment 2 Michael Catanzaro 2016-02-29 07:22:18 PST
Similar problem in webkitWebViewBaseUnrealize, I'll test a fix later today. And I'm switching F24 back to USE_OPENGL since bug #126122 and bug #150955 will both be fixed in the 2.11.91 update.
Comment 3 Michael Catanzaro 2016-02-29 08:43:44 PST
It's not so simple, another problem is that in WebCore::PlatformDisplay::createPlatformDisplay, gdk_display_manager_get_default_display returns some non-null display for which neither GDK_IS_X11_DISPLAY nor GDK_IS_WAYLAND_DISPLAY is true, and we wind up creating a PlatformDisplayX11 in the fallback path (we should really have an ASSERT_NOT_REACHED there), so any code that checks the display type can never work.

Since I think nobody cares about this configuration, I'd rather just fail the build at the configure stage, rather than investigate more and try to make this work.
Comment 4 Michael Catanzaro 2016-02-29 11:59:54 PST
(In reply to comment #3)
> It's not so simple, another problem is that in
> WebCore::PlatformDisplay::createPlatformDisplay,
> gdk_display_manager_get_default_display returns some non-null display for
> which neither GDK_IS_X11_DISPLAY nor GDK_IS_WAYLAND_DISPLAY is true

Well I couldn't explain that, so I thought about it a bit more, and actually it is returning a GdkDisplayWayland. The problem is that our Wayland support depends on OpenGL, and we have it baked into our build system to enforce this. I can see in our build logs:

-- Disabling ENABLE_3D_TRANSFORMS since ENABLE_OPENGL is disabled.
-- Disabling ENABLE_WAYLAND_TARGET since ENABLE_OPENGL is disabled.
-- Disabling ENABLE_WEBGL since ENABLE_OPENGL is disabled.
-- Disabling USE_REDIRECTED_XCOMPOSITE_WINDOW since ENABLE_OPENGL is disabled.

-- Enabled features:
--  ENABLE_ACCELERATED_2D_CANVAS ............ OFF
--  ENABLE_CREDENTIAL_STORAGE                 ON
--  ENABLE_DRAG_SUPPORT ..................... ON
--  ENABLE_GEOLOCATION                        ON
--  ENABLE_GLES2 ............................ OFF
--  ENABLE_GTKDOC                             ON
--  ENABLE_ICONDATABASE ..................... ON
--  ENABLE_INTROSPECTION                      ON
--  ENABLE_JIT .............................. ON
--  ENABLE_MEMORY_SAMPLER                     ON
--  ENABLE_MINIBROWSER ...................... ON
--  ENABLE_OPENGL                             OFF
--  ENABLE_PLUGIN_PROCESS_GTK2 .............. ON
--  ENABLE_QUARTZ_TARGET                      OFF
--  ENABLE_SAMPLING_PROFILER ................ ON
--  ENABLE_SPELLCHECK                         ON
--  ENABLE_TOUCH_EVENTS ..................... ON
--  ENABLE_VIDEO                              ON
--  ENABLE_WAYLAND_TARGET ................... OFF
--  ENABLE_WEB_AUDIO                          ON
--  ENABLE_X11_TARGET ....................... ON
--  USE_LIBHYPHEN                             ON
--  USE_LIBNOTIFY ........................... ON
--  USE_SYSTEM_MALLOC                         OFF

There is in fact no need to check if we're running under Wayland at those points in webkitWebViewBaseRealize/Unrealize, as they're unreachable if Wayland support is enabled. Nothing to change here, I think.