WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP patch
wip.patch (text/plain), 16.97 KB, created by
Anton Obzhirov
on 2013-03-12 07:18:40 PDT
(
hide
)
Description:
WIP patch
Filename:
MIME Type:
Creator:
Anton Obzhirov
Created:
2013-03-12 07:18:40 PDT
Size:
16.97 KB
patch
obsolete
>Index: Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp >=================================================================== >--- Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp (revision 145510) >+++ Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp (working copy) >@@ -338,7 +338,8 @@ > if (graphicsLayer) { > if (!m_layerTreeHost) { > // We're actually entering accelerated compositing mode. >- enterAcceleratedCompositingMode(graphicsLayer); >+ if (m_webPage->nativeWindowHandle()) >+ enterAcceleratedCompositingMode(graphicsLayer); > } else { > // We're already in accelerated compositing mode, but the root compositing layer changed. > >Index: Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp >=================================================================== >--- Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp (revision 145510) >+++ Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp (working copy) >@@ -314,6 +314,7 @@ > > m_textureMapper->beginPainting(); > toTextureMapperLayer(m_rootLayer.get())->paint(); >+ m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get()); > m_textureMapper->endPainting(); > > context->swapBuffers(); >Index: Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h >=================================================================== >--- Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h (revision 145510) >+++ Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h (working copy) >@@ -31,6 +31,7 @@ > > #include "LayerTreeContext.h" > #include "LayerTreeHost.h" >+#include "TextureMapperFPSCounter.h" > #include "TextureMapperLayer.h" > #include <WebCore/GLContext.h> > #include <WebCore/GraphicsLayerClient.h> >@@ -104,6 +105,7 @@ > OwnPtr<WebCore::GLContext> m_context; > bool m_layerFlushSchedulingEnabled; > unsigned m_layerFlushTimerCallbackId; >+ WebCore::TextureMapperFPSCounter m_fpsCounter; > }; > > } // namespace WebKit >Index: Source/WebCore/platform/graphics/GraphicsContext.cpp >=================================================================== >--- Source/WebCore/platform/graphics/GraphicsContext.cpp (revision 145510) >+++ Source/WebCore/platform/graphics/GraphicsContext.cpp (working copy) >@@ -742,7 +742,7 @@ > } > #endif > >-#if !USE(SKIA) && !USE(CG) >+#if !USE(SKIA) && !USE(CG) && !USE(CAIRO) > bool GraphicsContext::isAcceleratedContext() const > { > return false; >Index: Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp >=================================================================== >--- Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp (revision 145510) >+++ Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp (working copy) >@@ -59,7 +59,11 @@ > m_fpsTimestamp += delta; > } > >+#if defined(TEXTURE_MAPPER_PRINT_FPS) >+ printf("fps=%d\n", m_lastFPS); >+#else > textureMapper->drawNumber(m_lastFPS, Color::black, location, matrix); >+#endif > } > > } // namespace WebCore >Index: Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp >=================================================================== >--- Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (revision 145510) >+++ Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (working copy) >@@ -23,7 +23,9 @@ > #include "TextureMapperGL.h" > > #include "Extensions3D.h" >+#include "GLContext.h" > #include "GraphicsContext.h" >+#include "GraphicsLayer.h" > #include "Image.h" > #include "LengthFunctions.h" > #include "NotImplemented.h" >@@ -41,8 +43,10 @@ > > #if USE(CAIRO) > #include "CairoUtilities.h" >+#include "PlatformContextCairo.h" > #include "RefPtrCairo.h" > #include <cairo.h> >+#include <cairo-gl.h> > #include <wtf/text/CString.h> > #endif > >@@ -578,6 +582,9 @@ > , m_depthBufferObject(0) > , m_shouldClear(true) > , m_context3D(textureMapper->graphicsContext3D()) >+#if defined(BITMAP_TEXTURE_GL_DIRECT_UPDATE) && USE(CAIRO) >+ , m_surface(0) >+#endif > { > } > >@@ -628,7 +635,24 @@ > { > if (!m_id) > m_id = m_context3D->createTexture(); >+#if defined(BITMAP_TEXTURE_GL_DIRECT_UPDATE) && USE(CAIRO) >+ if (m_surface) { >+ GLContext* previousActiveContext = GLContext::getCurrent(); >+ GLContext::sharingContext()->makeContextCurrent(); > >+ { >+ OwnPtr<PlatformContextCairo> platformContext = adoptPtr(new PlatformContextCairo(cairo_create(m_surface))); >+ OwnPtr<GraphicsContext> context = adoptPtr(new GraphicsContext(platformContext.get())); >+ context->clearRect(FloatRect(0, 0, m_textureSize.width(), m_textureSize.height())); >+ cairo_surface_flush(m_surface); >+ } >+ >+ cairo_surface_destroy(m_surface); >+ m_surface = 0; >+ >+ previousActiveContext->makeContextCurrent(); >+ } >+#endif > m_shouldClear = true; > if (m_textureSize == contentSize()) > return; >@@ -733,7 +757,55 @@ > > updateContents(imageData, targetRect, offset, bytesPerLine, updateContentsFlag); > } >+#if defined(BITMAP_TEXTURE_GL_DIRECT_UPDATE) && USE(CAIRO) >+#define BITMAP_TEXTURE_GL_DRAW_TILE_RECT >+void BitmapTextureGL::updateContents(TextureMapper* textureMapper, GraphicsLayer* sourceLayer, const IntRect& targetRect, const IntPoint& offset, UpdateContentsFlag updateContentsFlag) >+{ >+ m_context3D->makeContextCurrent(); >+ m_context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, m_id); >+ GLContext* previousActiveContext = GLContext::getCurrent(); >+ GLContext::sharingContext()->makeContextCurrent(); > >+ if (!m_surface) { >+ m_surface = cairo_gl_surface_create_for_texture(GLContext::sharingContext()->cairoDevice(), >+ CAIRO_CONTENT_COLOR_ALPHA, m_id, m_textureSize.width(), m_textureSize.height()); >+ >+ if (cairo_surface_status(m_surface) != CAIRO_STATUS_SUCCESS) { >+ cairo_surface_destroy(m_surface); >+ m_surface = 0; >+ >+ previousActiveContext->makeContextCurrent(); >+ >+ // Fallback to image surface >+ BitmapTexture::updateContents(textureMapper, sourceLayer, targetRect, offset, updateContentsFlag); >+ return; >+ } >+ } >+ >+ { >+ OwnPtr<PlatformContextCairo> platformContext = adoptPtr(new PlatformContextCairo(cairo_create(m_surface))); >+ OwnPtr<GraphicsContext> context = adoptPtr(new GraphicsContext(platformContext.get())); >+ context->save(); >+ >+ IntRect sourceRect(targetRect); >+ sourceRect.setLocation(offset); >+ context->translate(targetRect.x()-offset.x(), targetRect.y()-offset.y()); >+ context->setImageInterpolationQuality(textureMapper->imageInterpolationQuality()); >+ context->setTextDrawingMode(textureMapper->textDrawingMode()); >+ sourceLayer->paintGraphicsLayerContents(*context, sourceRect); >+ >+ context->restore(); >+ >+#ifdef BITMAP_TEXTURE_GL_DRAW_TILE_RECT >+ context->setStrokeColor(0xFF0000FF, ColorSpaceDeviceRGB); >+ context->strokeRect(FloatRect(0, 0, m_textureSize.width(), m_textureSize.height()), 1); >+ cairo_surface_flush(m_surface); >+#endif >+ } >+ >+ previousActiveContext->makeContextCurrent(); >+} >+#endif > #if ENABLE(CSS_FILTERS) > > static TextureMapperShaderProgram::Options optionsForFilterType(FilterOperation::OperationType type, unsigned pass) >@@ -1088,6 +1160,15 @@ > > if (m_depthBufferObject) > m_context3D->deleteRenderbuffer(m_depthBufferObject); >+ >+#if defined(BITMAP_TEXTURE_GL_DIRECT_UPDATE) && USE(CAIRO) >+ GLContext* previousActiveContext = GLContext::getCurrent(); >+ GLContext::sharingContext()->makeContextCurrent(); >+ cairo_surface_flush(m_surface); >+ cairo_surface_destroy(m_surface); >+ m_surface = 0; >+ previousActiveContext->makeContextCurrent(); >+#endif > } > > bool BitmapTextureGL::isValid() const >Index: Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.h >=================================================================== >--- Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.h (revision 145510) >+++ Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.h (working copy) >@@ -27,6 +27,8 @@ > #include "TransformationMatrix.h" > #include <wtf/Noncopyable.h> > >+#define TEXTURE_MAPPER_PRINT_FPS >+ > namespace WebCore { > class TextureMapper; > >Index: Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp >=================================================================== >--- Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp (revision 145510) >+++ Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp (working copy) >@@ -80,6 +80,13 @@ > Vector<int> tileIndicesToRemove; > static const size_t TileEraseThreshold = 6; > >+ //Reset all tiles for now - slow! >+ /*for (int i = 0; i < m_tiles.size(); i++) { >+ TextureMapperTile& tile = m_tiles[i]; >+ if (tile.texture()) >+ tile.texture()->reset(enclosingIntRect(tile.rect()).size(), hasAlpha ? BitmapTexture::SupportsAlpha : 0); >+ }*/ >+ > // This method recycles tiles. We check which tiles we need to add, which to remove, and use as many > // removable tiles as replacement for new tiles when possible. > for (float y = 0; y < m_size.height(); y += tileSize.height()) { >Index: Source/WebCore/platform/graphics/texmap/TextureMapperGL.h >=================================================================== >--- Source/WebCore/platform/graphics/texmap/TextureMapperGL.h (revision 145510) >+++ Source/WebCore/platform/graphics/texmap/TextureMapperGL.h (working copy) >@@ -29,6 +29,8 @@ > #include "TextureMapper.h" > #include "TransformationMatrix.h" > >+#define BITMAP_TEXTURE_GL_DIRECT_UPDATE >+ > namespace WebCore { > > class CustomFilterProgram; >@@ -155,6 +157,9 @@ > uint32_t textureTarget() const { return GraphicsContext3D::TEXTURE_2D; } > IntSize textureSize() const { return m_textureSize; } > void updateContents(Image*, const IntRect&, const IntPoint&, UpdateContentsFlag); >+#ifdef BITMAP_TEXTURE_GL_DIRECT_UPDATE >+ void updateContents(TextureMapper* textureMapper, GraphicsLayer* sourceLayer, const IntRect& targetRect, const IntPoint& offset, UpdateContentsFlag updateContentsFlag); >+#endif > virtual void updateContents(const void*, const IntRect& target, const IntPoint& sourceOffset, int bytesPerLine, UpdateContentsFlag); > virtual bool isBackedByOpenGL() const { return true; } > >@@ -174,7 +179,10 @@ > bool m_shouldClear; > TextureMapperGL::ClipStack m_clipStack; > RefPtr<GraphicsContext3D> m_context3D; >- >+#if defined(BITMAP_TEXTURE_GL_DIRECT_UPDATE) && USE(CAIRO) >+ cairo_surface_t* m_surface; >+#endif >+private: > explicit BitmapTextureGL(TextureMapperGL*); > BitmapTextureGL(); > >Index: Source/WebCore/platform/graphics/glx/GLContextGLX.h >=================================================================== >--- Source/WebCore/platform/graphics/glx/GLContextGLX.h (revision 145510) >+++ Source/WebCore/platform/graphics/glx/GLContextGLX.h (working copy) >@@ -50,6 +50,7 @@ > #if USE(3D_GRAPHICS) > virtual PlatformGraphicsContext3D platformContext(); > #endif >+ virtual cairo_device_t* cairoDevice(); > > private: > static PassOwnPtr<GLContextGLX> createPbufferContext(GLXContext sharingContext); >@@ -63,6 +64,7 @@ > GLXPbuffer m_pbuffer; > Pixmap m_pixmap; > GLXPixmap m_glxPixmap; >+ cairo_device_t* m_cairoDevice; > }; > > } // namespace WebCore >Index: Source/WebCore/platform/graphics/glx/GLContextGLX.cpp >=================================================================== >--- Source/WebCore/platform/graphics/glx/GLContextGLX.cpp (revision 145510) >+++ Source/WebCore/platform/graphics/glx/GLContextGLX.cpp (working copy) >@@ -23,6 +23,8 @@ > #include "GraphicsContext3D.h" > #include "OpenGLShims.h" > #include <GL/glx.h> >+#include <cairo-gl.h> >+#include <cairo.h> > #include <wtf/OwnPtr.h> > > namespace WebCore { >@@ -168,6 +170,7 @@ > , m_pbuffer(0) > , m_pixmap(0) > , m_glxPixmap(0) >+ , m_cairoDevice(0) > { > } > >@@ -177,6 +180,7 @@ > , m_pbuffer(0) > , m_pixmap(pixmap) > , m_glxPixmap(glxPixmap) >+ , m_cairoDevice(0) > { > } > >@@ -188,8 +192,14 @@ > glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); > glXMakeCurrent(sharedX11Display(), None, None); > glXDestroyContext(sharedX11Display(), m_context); >+ m_context = 0; > } > >+ if (m_cairoDevice) { >+ cairo_device_destroy(m_cairoDevice); >+ m_cairoDevice = 0; >+ } >+ > if (m_pbuffer) { > glXDestroyPbuffer(sharedX11Display(), m_pbuffer); > m_pbuffer = 0; >@@ -251,6 +261,15 @@ > glXWaitX(); > } > >+cairo_device_t* GLContextGLX::cairoDevice() >+{ >+ if (m_cairoDevice) >+ return m_cairoDevice; >+ >+ m_cairoDevice = cairo_glx_device_create(sharedX11Display(), m_context); >+ return m_cairoDevice; >+} >+ > #if USE(3D_GRAPHICS) > PlatformGraphicsContext3D GLContextGLX::platformContext() > { >Index: Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >=================================================================== >--- Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (revision 145510) >+++ Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (working copy) >@@ -1141,6 +1141,11 @@ > return platformContext()->imageInterpolationQuality(); > } > >+bool GraphicsContext::isAcceleratedContext() const >+{ >+ return cairo_surface_get_type(cairo_get_target(platformContext()->cr())) == CAIRO_SURFACE_TYPE_GL; >+} >+ > #if ENABLE(3D_RENDERING) && USE(TEXTURE_MAPPER) > TransformationMatrix GraphicsContext::get3DTransform() const > { >Index: Source/WebCore/platform/graphics/cairo/GLContext.h >=================================================================== >--- Source/WebCore/platform/graphics/cairo/GLContext.h (revision 145510) >+++ Source/WebCore/platform/graphics/cairo/GLContext.h (working copy) >@@ -29,6 +29,8 @@ > typedef struct _XDisplay Display; > #endif > >+typedef struct _cairo_device cairo_device_t; >+ > namespace WebCore { > > class GLContext { >@@ -46,6 +48,7 @@ > virtual void waitNative() = 0; > virtual bool canRenderToDefaultFramebuffer() = 0; > virtual IntSize defaultFrameBufferSize() = 0; >+ virtual cairo_device_t* cairoDevice() = 0; > > #if PLATFORM(X11) > static Display* sharedX11Display(); >Index: Source/WebCore/platform/graphics/egl/GLContextEGL.h >=================================================================== >--- Source/WebCore/platform/graphics/egl/GLContextEGL.h (revision 145510) >+++ Source/WebCore/platform/graphics/egl/GLContextEGL.h (working copy) >@@ -41,6 +41,7 @@ > virtual void waitNative(); > virtual bool canRenderToDefaultFramebuffer(); > virtual IntSize defaultFrameBufferSize(); >+ virtual cairo_device_t* cairoDevice(); > > > #if ENABLE(WEBGL) >@@ -59,6 +60,7 @@ > EGLContext m_context; > EGLSurface m_surface; > EGLSurfaceType m_type; >+ cairo_device_t* m_cairoDevice; > }; > > } // namespace WebCore >Index: Source/WebCore/platform/graphics/egl/GLContextEGL.cpp >=================================================================== >--- Source/WebCore/platform/graphics/egl/GLContextEGL.cpp (revision 145510) >+++ Source/WebCore/platform/graphics/egl/GLContextEGL.cpp (working copy) >@@ -22,6 +22,8 @@ > #if USE(EGL) > > #include "GraphicsContext3D.h" >+#include <cairo-gl.h> >+#include <cairo.h> > #include <wtf/OwnPtr.h> > > #if USE(OPENGL_ES_2) >@@ -208,11 +210,15 @@ > : m_context(context) > , m_surface(surface) > , m_type(type) >+ , m_cairoDevice(0) > { > } > > GLContextEGL::~GLContextEGL() > { >+ if (m_cairoDevice) >+ cairo_device_destroy(m_cairoDevice); >+ > EGLDisplay display = sharedEGLDisplay(); > if (m_context) { > glBindFramebuffer(GL_FRAMEBUFFER, 0); >@@ -224,6 +230,15 @@ > eglDestroySurface(display, m_surface); > } > >+cairo_device_t* GLContextEGL::cairoDevice() >+{ >+ if (m_cairoDevice) >+ return m_cairoDevice; >+ >+ m_cairoDevice = cairo_egl_device_create(sharedEGLDisplay(), m_context); >+ return m_cairoDevice; >+} >+ > bool GLContextEGL::canRenderToDefaultFramebuffer() > { > return m_type == WindowSurface; >Index: Tools/gtk/jhbuild.modules >=================================================================== >--- Tools/gtk/jhbuild.modules (revision 145510) >+++ Tools/gtk/jhbuild.modules (working copy) >@@ -44,6 +44,8 @@ > href="git://git.gnome.org/"/> > <repository type="tarball" name="cairographics.org" > href="http://cairographics.org"/> >+ <repository type="tarball" name="cairogles" >+ href="https://github.com/SRA-SiliconValley/cairogles/"/> > <repository type="tarball" name="freedesktop.org" > href="http://www.freedesktop.org"/> > <repository type="tarball" name="xmlsoft.org" >@@ -59,16 +61,13 @@ > <patch file="make-3.82-parallel-build.patch" strip="1"/> > </branch> > </autotools> >- >- <autotools id="cairo" autogen-sh="configure"> >+<autotools id="cairo" autogenargs="--enable-gl=yes"> > <dependencies> > <dep package="fontconfig"/> > <dep package="pixman"/> > </dependencies> >- <branch module="releases/cairo-1.12.8.tar.xz" version="1.12.8" >- repo="cairographics.org" >- hash="sha256:8fbb6fc66117ab4100bad830cb4479497e53c6f3facb98bf05c8d298554ebdd9" >- md5sum="8b3dcade859c44fb7e56fc68edfe9a45"> >+ <branch repo="cairogles" module="archive/cairogles-1.12.12.tar.gz" >+ version="1.12.12" checkoutdir="cairogles-1.12.12"> > </branch> > </autotools> >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 112150
: 192732