Title: [203498] trunk/Source/WebCore
Revision
203498
Author
[email protected]
Date
2016-07-21 00:29:39 -0700 (Thu, 21 Jul 2016)

Log Message

[Threaded Compositor] Flickering when zooming in/out in maps.google.com
https://bugs.webkit.org/show_bug.cgi?id=154069

Patch by Miguel Gomez <[email protected]> on 2016-07-21
Reviewed by Carlos Garcia Campos.

Add a new extra buffer to GraphicsContext3D when using the Threaded Compositor,
so it doesn't have to reuse the buffers that are still waiting for composition.

Covered by existing tests.

* platform/graphics/GraphicsContext3D.h:
Add a new texture to use for the rendering. Remove the compositor fbo we were using.
* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):
Initialize the new texture and remove the previous fbo related code.
(WebCore::GraphicsContext3D::~GraphicsContext3D):
Properly destroy the new texture and remove the previous fbo related code.
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
(WebCore::GraphicsContext3D::reshapeFBOs):
Allocate the new texture and remove the previous fbo allocation.
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::prepareTexture):
Use a single fbo with three textures instead of two fbos with a texture each.
Rotate the three textures usage so:
- m_texture becomes m_compositorTexture to be pushed to the compositor.
- m_intermediateTexture becomes m_texture to receive the next rendering.
- m_compositorTexture becomes m_intermediateTexture.
And add a glFlush() to ensure that the gl commands are sent to the pipeline.
* platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
(WebCore::GraphicsContext3D::reshapeFBOs):
Allocate the new texture.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (203497 => 203498)


--- trunk/Source/WebCore/ChangeLog	2016-07-21 07:25:26 UTC (rev 203497)
+++ trunk/Source/WebCore/ChangeLog	2016-07-21 07:29:39 UTC (rev 203498)
@@ -1,3 +1,37 @@
+2016-07-21  Miguel Gomez  <[email protected]>
+
+        [Threaded Compositor] Flickering when zooming in/out in maps.google.com
+        https://bugs.webkit.org/show_bug.cgi?id=154069
+
+        Reviewed by Carlos Garcia Campos.
+
+        Add a new extra buffer to GraphicsContext3D when using the Threaded Compositor,
+        so it doesn't have to reuse the buffers that are still waiting for composition.
+
+        Covered by existing tests.
+
+        * platform/graphics/GraphicsContext3D.h:
+        Add a new texture to use for the rendering. Remove the compositor fbo we were using.
+        * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        Initialize the new texture and remove the previous fbo related code.
+        (WebCore::GraphicsContext3D::~GraphicsContext3D):
+        Properly destroy the new texture and remove the previous fbo related code.
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+        (WebCore::GraphicsContext3D::reshapeFBOs):
+        Allocate the new texture and remove the previous fbo allocation.
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        (WebCore::GraphicsContext3D::prepareTexture):
+        Use a single fbo with three textures instead of two fbos with a texture each.
+        Rotate the three textures usage so:
+        - m_texture becomes m_compositorTexture to be pushed to the compositor.
+        - m_intermediateTexture becomes m_texture to receive the next rendering.
+        - m_compositorTexture becomes m_intermediateTexture.
+        And add a glFlush() to ensure that the gl commands are sent to the pipeline.
+        * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
+        (WebCore::GraphicsContext3D::reshapeFBOs):
+        Allocate the new texture.
+
 2016-07-21  Carlos Garcia Campos  <[email protected]>
 
         [GTK][Threaded Compositor] Web view background colors don't work

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (203497 => 203498)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2016-07-21 07:25:26 UTC (rev 203497)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2016-07-21 07:29:39 UTC (rev 203498)
@@ -1422,7 +1422,7 @@
     GC3Duint m_compositorTexture;
     GC3Duint m_fbo;
 #if USE(COORDINATED_GRAPHICS_THREADED)
-    GC3Duint m_compositorFBO;
+    GC3Duint m_intermediateTexture;
 #endif
 
     GC3Duint m_depthBuffer;

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp (203497 => 203498)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp	2016-07-21 07:25:26 UTC (rev 203497)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp	2016-07-21 07:29:39 UTC (rev 203498)
@@ -85,7 +85,7 @@
     , m_compositorTexture(0)
     , m_fbo(0)
 #if USE(COORDINATED_GRAPHICS_THREADED)
-    , m_compositorFBO(0)
+    , m_intermediateTexture(0)
 #endif
     , m_depthStencilBuffer(0)
     , m_layerComposited(false)
@@ -113,7 +113,6 @@
         ::glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
 
 #if USE(COORDINATED_GRAPHICS_THREADED)
-        ::glGenFramebuffers(1, &m_compositorFBO);
         ::glGenTextures(1, &m_compositorTexture);
         ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture);
         ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -120,6 +119,14 @@
         ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
         ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
         ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+        ::glGenTextures(1, &m_intermediateTexture);
+        ::glBindTexture(GL_TEXTURE_2D, m_intermediateTexture);
+        ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+        ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+        ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+        ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
         ::glBindTexture(GL_TEXTURE_2D, 0);
 #endif
 
@@ -189,7 +196,7 @@
     }
     ::glDeleteFramebuffers(1, &m_fbo);
 #if USE(COORDINATED_GRAPHICS_THREADED)
-    ::glDeleteFramebuffers(1, &m_compositorFBO);
+    ::glDeleteTextures(1, &m_intermediateTexture);
 #endif
 }
 

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp (203497 => 203498)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2016-07-21 07:25:26 UTC (rev 203497)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2016-07-21 07:29:39 UTC (rev 203498)
@@ -177,10 +177,9 @@
         ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
         ::glBindTexture(GL_TEXTURE_2D, 0);
 #if USE(COORDINATED_GRAPHICS_THREADED)
-        ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_compositorFBO);
-        ::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_compositorTexture, 0);
-        attachDepthAndStencilBufferIfNeeded(internalDepthStencilFormat, width, height);
-        ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);
+        ::glBindTexture(GL_TEXTURE_2D, m_intermediateTexture);
+        ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
+        ::glBindTexture(GL_TEXTURE_2D, 0);
 #endif
     }
 #endif

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (203497 => 203498)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2016-07-21 07:25:26 UTC (rev 203497)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2016-07-21 07:29:39 UTC (rev 203498)
@@ -236,10 +236,13 @@
         resolveMultisamplingIfNecessary();
 
 #if USE(COORDINATED_GRAPHICS_THREADED)
-    std::swap(m_fbo, m_compositorFBO);
     std::swap(m_texture, m_compositorTexture);
+    std::swap(m_texture, m_intermediateTexture);
+    ::glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
+    ::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_texture, 0);
+    glFlush();
 
-    if (m_state.boundFBO != m_compositorFBO)
+    if (m_state.boundFBO != m_fbo)
         ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_state.boundFBO);
     else
         ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo);

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp (203497 => 203498)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp	2016-07-21 07:25:26 UTC (rev 203497)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp	2016-07-21 07:29:39 UTC (rev 203498)
@@ -110,6 +110,12 @@
         ::glBindTexture(GL_TEXTURE_2D, 0);
     }
 
+#if USE(COORDINATED_GRAPHICS_THREADED)
+        ::glBindTexture(GL_TEXTURE_2D, m_intermediateTexture);
+        ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
+        ::glBindTexture(GL_TEXTURE_2D, 0);
+#endif
+
     Extensions3DOpenGLES* extensions = static_cast<Extensions3DOpenGLES*>(getExtensions());
     if (extensions->isImagination() && m_attrs.antialias) {
         GLint maxSampleCount;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to