[WPE] GLContextEGL::createWPEContext() should fall back to pbuffer-based contexts...
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 May 2017 13:04:30 +0000 (13:04 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 May 2017 13:04:30 +0000 (13:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172162

Reviewed by Carlos Garcia Campos.

When creating an offscreen GLContext, the underlying implementation might
provide a mock native window that's to be used as the window target upon
which a window-based GLContext should be created. But we should also support
falling back to pbuffer-based GLContexts when the underlying implementation
can't provide such mock targets.

* platform/graphics/egl/GLContextEGLWPE.cpp:
(WebCore::GLContextEGL::createWPEContext):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216930 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/egl/GLContextEGLWPE.cpp

index 8320c1a..cca18f0 100644 (file)
@@ -1,5 +1,21 @@
 2017-05-16  Zan Dobersek  <zdobersek@igalia.com>
 
+        [WPE] GLContextEGL::createWPEContext() should fall back to pbuffer-based contexts when offscreen target provides no native window
+        https://bugs.webkit.org/show_bug.cgi?id=172162
+
+        Reviewed by Carlos Garcia Campos.
+
+        When creating an offscreen GLContext, the underlying implementation might
+        provide a mock native window that's to be used as the window target upon
+        which a window-based GLContext should be created. But we should also support
+        falling back to pbuffer-based GLContexts when the underlying implementation
+        can't provide such mock targets.
+
+        * platform/graphics/egl/GLContextEGLWPE.cpp:
+        (WebCore::GLContextEGL::createWPEContext):
+
+2017-05-16  Zan Dobersek  <zdobersek@igalia.com>
+
         [GLib] Name more GSource-based RunLoop::Timers
         https://bugs.webkit.org/show_bug.cgi?id=172158
 
index 9f3f42d..19c503d 100644 (file)
@@ -28,7 +28,16 @@ namespace WebCore {
 std::unique_ptr<GLContextEGL> GLContextEGL::createWPEContext(PlatformDisplay& platformDisplay, EGLContext sharingContext)
 {
     auto offscreenTarget = downcast<PlatformDisplayWPE>(platformDisplay).createEGLOffscreenTarget();
-    auto context = createWindowContext(offscreenTarget->nativeWindow(), platformDisplay, sharingContext);
+
+    std::unique_ptr<GLContextEGL> context;
+    if (offscreenTarget->nativeWindow())
+        context = createWindowContext(offscreenTarget->nativeWindow(), platformDisplay, sharingContext);
+    if (!context)
+        context = createPbufferContext(platformDisplay, sharingContext);
+
+    // FIXME: if available, we could also fallback to the surfaceless-based GLContext
+    // before falling back to the pbuffer-based one.
+
     if (context)
         context->m_wpeTarget = WTFMove(offscreenTarget);
     return context;