Skip to content
Permalink
Browse files
[CoordinatedGraphics] Handle null native surface handle for surfacele…
…ss rendering

https://bugs.webkit.org/show_bug.cgi?id=226165

Patch by Zan Dobersek <zdobersek@igalia.com> on 2021-05-24
Reviewed by Philippe Normand.

During ThreadedCompositor initialization, a null native surface handle
would represent a surfaceless rendering target. Assuming corresponding
driver support for this behavior, the GL context creation would still
succeed and composition could be performed.

To support this behavior, the GL context is now spawned first, and if
successful, the scene is set as active. But in case of a null native
surface (i.e. surfaceless rendering), the painting has to be mirrored
by default because of the OpenGL coordinate system being the immediate
coordinate system inside which we end up working.

* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::m_displayRefreshMonitor):
(WebKit::ThreadedCompositor::createGLContext):

Canonical link: https://commits.webkit.org/238111@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277998 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
commit-queue@webkit.org committed May 25, 2021
1 parent 74c136d commit 0cc89087b82aa02108d15972bb3c4ce3357a1ef3
Showing 2 changed files with 28 additions and 5 deletions.
@@ -1,3 +1,25 @@
2021-05-24 Zan Dobersek <zdobersek@igalia.com>

[CoordinatedGraphics] Handle null native surface handle for surfaceless rendering
https://bugs.webkit.org/show_bug.cgi?id=226165

Reviewed by Philippe Normand.

During ThreadedCompositor initialization, a null native surface handle
would represent a surfaceless rendering target. Assuming corresponding
driver support for this behavior, the GL context creation would still
succeed and composition could be performed.

To support this behavior, the GL context is now spawned first, and if
successful, the scene is set as active. But in case of a null native
surface (i.e. surfaceless rendering), the painting has to be mirrored
by default because of the OpenGL coordinate system being the immediate
coordinate system inside which we end up working.

* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::m_displayRefreshMonitor):
(WebKit::ThreadedCompositor::createGLContext):

2021-05-24 Chris Dumez <cdumez@apple.com>

[GLIB] Stop using UncheckedLock in IconDatabase
@@ -70,9 +70,12 @@ ThreadedCompositor::ThreadedCompositor(Client& client, ThreadedDisplayRefreshMon
m_scene = adoptRef(new CoordinatedGraphicsScene(this));
m_nativeSurfaceHandle = m_client.nativeSurfaceHandleForCompositing();

m_scene->setActive(!!m_nativeSurfaceHandle);
if (m_nativeSurfaceHandle)
createGLContext();
createGLContext();
if (m_context) {
if (!m_nativeSurfaceHandle)
m_paintFlags |= TextureMapper::PaintingMirrored;
m_scene->setActive(true);
}
});
}

@@ -84,8 +87,6 @@ void ThreadedCompositor::createGLContext()
{
ASSERT(!RunLoop::isMain());

ASSERT(m_nativeSurfaceHandle);

// GLNativeWindowType depends on the EGL implementation: reinterpret_cast works
// for pointers (only if they are 64-bit wide and not for other cases), and static_cast for
// numeric types (and when needed they get extended to 64-bit) but not for pointers. Using

0 comments on commit 0cc8908

Please sign in to comment.