Bug 145701

Summary: [GTK] [Wayland] Should be possible to build with support for both X11 and Wayland.
Product: WebKit Reporter: Carlos Alberto Lopez Perez <clopez>
Component: WebKitGTKAssignee: Carlos Alberto Lopez Perez <clopez>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, commit-queue, dino, itoral, mcatanzaro, mrobinson, zan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 145881    
Bug Blocks: 81456, 146057    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Carlos Alberto Lopez Perez
Reported 2015-06-05 10:29:04 PDT
It should be possible to build with support for both X11 and Wayland targets. This was possible before r183491 <http://trac.webkit.org/r183491> that added the conflicting option in CMake.
Attachments
Patch (8.91 KB, patch)
2015-06-05 11:14 PDT, Carlos Alberto Lopez Perez
no flags
Patch (8.90 KB, patch)
2015-06-05 11:20 PDT, Carlos Alberto Lopez Perez
no flags
Patch (4.86 KB, patch)
2015-06-10 10:12 PDT, Carlos Alberto Lopez Perez
no flags
Patch (5.39 KB, patch)
2015-06-16 05:21 PDT, Carlos Alberto Lopez Perez
no flags
Carlos Alberto Lopez Perez
Comment 1 2015-06-05 11:14:18 PDT
Carlos Alberto Lopez Perez
Comment 2 2015-06-05 11:20:20 PDT
Zan Dobersek
Comment 3 2015-06-06 07:11:36 PDT
This is where things start to complicate. The patch removes support for GLContext usage with the Wayland EGL platform. If we all agree on prioritizing support for both X11 and Wayland display protocols in the same build, then this patch can proceed.
Carlos Alberto Lopez Perez
Comment 4 2015-06-08 05:53:38 PDT
(In reply to comment #3) > The patch removes support for GLContext usage with the Wayland EGL platform. But are this removed functions used anywhere? It seems dead code to me.
Zan Dobersek
Comment 5 2015-06-08 11:58:01 PDT
They're used by the pending patches in other bugs blocking bug #81456 and bug #115803.
Carlos Alberto Lopez Perez
Comment 6 2015-06-09 09:55:52 PDT
(In reply to comment #5) > They're used by the pending patches in other bugs blocking bug #81456 and > bug #115803. I see, WebCore::WaylandSurface::createGLContext is used by patch on bug 136832 and WebCore::PlatformDisplayWayland::createSharingGLContext by patch on bug 136831. So, I will try to enable building both targets without removing the above functions.
Carlos Alberto Lopez Perez
Comment 7 2015-06-10 10:12:54 PDT
WebKit Commit Bot
Comment 8 2015-06-11 08:21:42 PDT
Comment on attachment 254661 [details] Patch Clearing flags on attachment: 254661 Committed r185453: <http://trac.webkit.org/changeset/185453>
WebKit Commit Bot
Comment 9 2015-06-11 08:21:46 PDT
All reviewed patches have been landed. Closing bug.
WebKit Commit Bot
Comment 10 2015-06-11 08:56:40 PDT
Re-opened since this is blocked by bug 145881
Carlos Alberto Lopez Perez
Comment 11 2015-06-11 09:01:11 PDT
Fails to build on 32-bit :\ https://build.webkit.org/builders/GTK%20Linux%2032-bit%20Release/builds/53334/steps/compile-webkit/logs/stdio ../../Source/WebCore/platform/graphics/GLContext.cpp: In static member function ‘static std::unique_ptr<WebCore::GLContext> WebCore::GLContext::createContextForWindow(GLNativeWindowType, WebCore::GLContext*)’: ../../Source/WebCore/platform/graphics/GLContext.cpp:126:89: error: invalid cast from type ‘GLNativeWindowType {aka long long unsigned int}’ to type ‘XID {aka long unsigned int}’ if (auto glxContext = GLContextGLX::createContext(reinterpret_cast<XID>(windowHandle), sharingContext)) I'm reverting it now, and will try later to find a solution that works also for 32-bits.
Carlos Alberto Lopez Perez
Comment 12 2015-06-16 05:21:34 PDT
Darin Adler
Comment 13 2015-06-16 10:45:56 PDT
Comment on attachment 254948 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=254948&action=review > Source/WebCore/platform/graphics/GLContext.cpp:130 > +#if PLATFORM(WAYLAND) // Building both X11 and Wayland targets > + XID GLXWindowHandle = reinterpret_cast<XID>(windowHandle); > +#else > + XID GLXWindowHandle = static_cast<XID>(windowHandle); > +#endif Would it be a problem to always do reinterpret_cast?
Carlos Alberto Lopez Perez
Comment 14 2015-06-16 11:15:15 PDT
(In reply to comment #13) > Comment on attachment 254948 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=254948&action=review > > > Source/WebCore/platform/graphics/GLContext.cpp:130 > > +#if PLATFORM(WAYLAND) // Building both X11 and Wayland targets > > + XID GLXWindowHandle = reinterpret_cast<XID>(windowHandle); > > +#else > > + XID GLXWindowHandle = static_cast<XID>(windowHandle); > > +#endif > > Would it be a problem to always do reinterpret_cast? Yes. That was I tried on r185453 <http://trac.webkit.org/changeset/185453>. But it caused a build failure on 32-bits. As far as I understand this, the issue is that on the GTK port, when PLATFORM(Wayland) is not enabled we define GLNativeWindowType as uint64_t, and XID is a uintptr_t. And the compiler is not happy doing a reinterpret_cast from a 64bit uint to a 32bit one. However, doing a static_cast is ok (or an implicit cast by assignment like it was done before this patch) because we simply truncate the value if it don't fits on a 32bit uint. That shouldn't be a problem because the value of GLNativeWindowType should never be larger than a 32bit uint on a 32-bit platform.
WebKit Commit Bot
Comment 15 2015-06-16 15:19:20 PDT
Comment on attachment 254948 [details] Patch Clearing flags on attachment: 254948 Committed r185620: <http://trac.webkit.org/changeset/185620>
WebKit Commit Bot
Comment 16 2015-06-16 15:19:26 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.