Changeset 122554 in webkit
- Timestamp:
- Jul 13, 2012 2:20:49 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r122553 r122554 1 2012-07-13 Zeno Albisser <zeno@webkit.org> 2 3 [Qt][WK2] Implement GraphicsSurface for Linux/GLX. 4 https://bugs.webkit.org/show_bug.cgi?id=90881 5 6 Add a GLX based GraphicsSurface implementation for Linux. 7 Native X windows are being used for exchanging textures 8 with the UIProcess. 9 10 Reviewed by Noam Rosenthal. 11 12 * Target.pri: 13 * WebCore.pri: 14 * platform/graphics/surfaces/GraphicsSurface.cpp: 15 (WebCore::GraphicsSurface::create): 16 Move creating GraphicsSurface instance into 17 platformCreate/platformImport functions to allow 18 platform specific creation based on the provided flags. 19 (WebCore::GraphicsSurface::GraphicsSurface): 20 (WebCore::GraphicsSurface::~GraphicsSurface): 21 Call platformDestroy when destroying a GraphicsSurface. 22 (WebCore): 23 * platform/graphics/surfaces/GraphicsSurface.h: 24 Make platformCreate/platformImport functions static 25 to be able to call these from the static create function. 26 Add Destructor prototype and add GraphicsSurfacePrivate member. 27 (WebCore): 28 (GraphicsSurface): 29 * platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp: 30 (WebCore): 31 (WebCore::GraphicsSurface::platformCreate): 32 (WebCore::GraphicsSurface::platformImport): 33 Insert creation of GraphicsSurface instance. 34 This allows having a platform specific creation mechanism 35 for GLX. 36 * platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp: Added. 37 (WebCore): 38 (OffScreenRootWindow): 39 (WebCore::OffScreenRootWindow::OffScreenRootWindow): 40 (WebCore::OffScreenRootWindow::get): 41 (WebCore::OffScreenRootWindow::~OffScreenRootWindow): 42 Add an OffScreenRootWindow singelton that is being used 43 as a parent for all native offscreen windows. 44 (GraphicsSurfacePrivate): 45 This class is used to manage all the X related resources 46 such as opening a display or creating XPixmaps etc. 47 (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate): 48 Open a connection to the X server and create a 49 QOpenGLContext that can be used to resolve GL functions. 50 (WebCore::GraphicsSurfacePrivate::~GraphicsSurfacePrivate): 51 Properly cleanup and release all the X resources again. 52 (WebCore::GraphicsSurfacePrivate::createSurface): 53 Create a surface that is placed off screen and can be 54 used as a rendering target by the WebProcess. 55 (WebCore::GraphicsSurfacePrivate::createPixmap): 56 Create a GLXPixmap from the XWindow that was previously 57 redirected by the WebProcess. This GLXPixmap can then be 58 bound to a texture and being painted on screen by the 59 UIProcess. 60 (WebCore::GraphicsSurfacePrivate::makeCurrent): 61 (WebCore::GraphicsSurfacePrivate::swapBuffers): 62 (WebCore::GraphicsSurfacePrivate::display): 63 (WebCore::GraphicsSurfacePrivate::glxPixmap): 64 (WebCore::GraphicsSurfacePrivate::size): 65 (WebCore::GraphicsSurfacePrivate::glContext): 66 (WebCore::resolveGLMethods): 67 Initialize all the function pointers for the GL functions used. 68 (WebCore::GraphicsSurface::platformExport): 69 (WebCore::GraphicsSurface::platformGetTextureID): 70 Bind the GLXPixmap to a texture. 71 (WebCore::GraphicsSurface::platformCopyToGLTexture): 72 Not beeing implemented for GLX. 73 (WebCore::GraphicsSurface::platformCopyFromFramebuffer): 74 Blit origin fbo onto the GraphicsSurface's backing. 75 (WebCore::GraphicsSurface::platformCreate): 76 (WebCore::GraphicsSurface::platformImport): 77 (WebCore::GraphicsSurface::platformLock): 78 (WebCore::GraphicsSurface::platformUnlock): 79 (WebCore::GraphicsSurface::platformDestroy): 80 1 81 2012-07-13 Dongwoo Im <dw.im@samsung.com> 2 82 -
trunk/Source/WebCore/Target.pri
r122484 r122554 4180 4180 INCLUDEPATH += /System/Library/Frameworks/CoreFoundation.framework/Headers 4181 4181 } 4182 contains(DEFINES, HAVE_XCOMPOSITE=1) { 4183 SOURCES += platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp 4184 } 4182 4185 } 4183 4186 -
trunk/Source/WebCore/WebCore.pri
r122445 r122554 9 9 10 10 QT *= network sql 11 haveQt(5): QT *= gui-private11 haveQt(5): QT *= core-private gui-private 12 12 13 13 WEBCORE_GENERATED_SOURCES_DIR = $${ROOT_BUILD_DIR}/Source/WebCore/$${GENERATED_SOURCES_DESTDIR} … … 205 205 contains(QT_CONFIG, opengles2): LIBS += -lEGL 206 206 mac: LIBS += -framework IOSurface -framework CoreFoundation 207 linux-*:contains(DEFINES, HAVE_XCOMPOSITE=1): LIBS += -lXcomposite 207 208 # Only WebKit1 needs the opengl module, so it's optional for Qt5. 208 209 haveQt(4)|contains(QT_CONFIG, opengl): QT *= opengl -
trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp
r118987 r122554 28 28 PassRefPtr<GraphicsSurface> GraphicsSurface::create(const IntSize& size, Flags flags, uint32_t token) 29 29 { 30 RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); 31 if (!surface->platformImport(token)) 32 return PassRefPtr<GraphicsSurface>(); 33 return surface; 30 return platformImport(size, flags, token); 34 31 } 35 32 36 33 PassRefPtr<GraphicsSurface> GraphicsSurface::create(const IntSize& size, GraphicsSurface::Flags flags) 37 34 { 38 RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); 39 if (!surface->platformCreate(size, flags)) 40 return PassRefPtr<GraphicsSurface>(); 41 return surface; 35 return platformCreate(size, flags); 42 36 } 43 37 … … 71 65 72 66 GraphicsSurface::GraphicsSurface(const IntSize& size, Flags flags) 73 : m_ size(size)74 , m_ flags(flags)67 : m_flags(flags) 68 , m_size(size) 75 69 , m_platformSurface(0) 76 70 , m_texture(0) 77 71 , m_fbo(0) 72 , m_private(0) 78 73 { 74 } 75 76 GraphicsSurface::~GraphicsSurface() 77 { 78 platformDestroy(); 79 79 } 80 80 -
trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h
r120076 r122554 33 33 typedef struct __IOSurface* IOSurfaceRef; 34 34 typedef IOSurfaceRef PlatformGraphicsSurface; 35 #else 36 typedef uint32_t PlatformGraphicsSurface; 35 37 #endif 36 38 37 39 namespace WebCore { 40 41 struct GraphicsSurfacePrivate; 38 42 39 43 class GraphicsSurface : public RefCounted<GraphicsSurface> { … … 70 74 PassOwnPtr<GraphicsContext> beginPaint(const IntRect&, LockOptions); 71 75 PassRefPtr<Image> createReadOnlyImage(const IntRect&); 76 ~GraphicsSurface(); 72 77 73 78 protected: 74 boolplatformCreate(const IntSize&, Flags);75 bool platformImport(uint32_t);79 static PassRefPtr<GraphicsSurface> platformCreate(const IntSize&, Flags); 80 static PassRefPtr<GraphicsSurface> platformImport(const IntSize&, Flags, uint32_t); 76 81 uint32_t platformExport(); 77 82 void platformDestroy(); … … 101 106 uint32_t m_texture; 102 107 uint32_t m_fbo; 108 GraphicsSurfacePrivate* m_private; 103 109 }; 104 110 -
trunk/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp
r121250 r122554 30 30 31 31 namespace WebCore { 32 33 struct GraphicsSurfacePrivate { }; 32 34 33 35 uint32_t GraphicsSurface::platformExport() … … 119 121 } 120 122 121 boolGraphicsSurface::platformCreate(const IntSize& size, Flags flags)123 PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size, Flags flags) 122 124 { 123 125 unsigned pixelFormat = 'BGRA'; … … 155 157 CFRelease(values[i]); 156 158 157 m_platformSurface = IOSurfaceCreate(dict); 158 return !!m_platformSurface; 159 } 160 161 bool GraphicsSurface::platformImport(uint32_t token) 162 { 163 m_platformSurface = IOSurfaceLookup(token); 164 return !!m_platformSurface; 159 RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); 160 surface->m_platformSurface = IOSurfaceCreate(dict); 161 if (!surface->m_platformSurface) 162 return PassRefPtr<GraphicsSurface>(); 163 return surface; 164 } 165 166 PassRefPtr<GraphicsSurface> GraphicsSurface::platformImport(const IntSize& size, Flags flags, uint32_t token) 167 { 168 RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); 169 surface->m_platformSurface = IOSurfaceLookup(token); 170 if (!surface->m_platformSurface) 171 return PassRefPtr<GraphicsSurface>(); 172 return surface; 165 173 } 166 174 -
trunk/Source/WebKit2/ChangeLog
r122547 r122554 1 2012-07-13 Zeno Albisser <zeno@webkit.org> 2 3 [Qt][WK2] Implement GraphicsSurface for Linux/GLX. 4 https://bugs.webkit.org/show_bug.cgi?id=90881 5 6 Add a GLX based GraphicsSurface implementation for Linux. 7 8 Reviewed by Noam Rosenthal. 9 10 * Shared/ShareableSurface.cpp: 11 (WebKit::ShareableSurface::create): 12 Only create a GraphicsSurface from a ShareableSurface::Handle 13 in case the Handle contains a valid GraphicsSurface token. 14 Otherwise fall back to creating a ShareableBitmap. 15 * UIProcess/LayerTreeCoordinatorProxy.cpp: 16 (WebKit::createLayerTileUniqueKey): 17 Create a unique key for a surface based on tileID and layerID. 18 (WebKit::LayerTreeCoordinatorProxy::updateTileForLayer): 19 Even when GraphicsSurface is enabled, not all ShareableSurfaces 20 will necessarily be backed by a GraphicsSurface. In case of 21 a ShareableSurface being backed by a ShareableBitmap instead, 22 the GraphicsSurface token will always be null. 23 So instead of using the GraphicsSurface token as a key for 24 storing surfaces in a map, we create a unique key from 25 layerID and tileID. 26 * UIProcess/LayerTreeCoordinatorProxy.h: 27 (LayerTreeCoordinatorProxy): 28 1 29 2012-07-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 30 -
trunk/Source/WebKit2/Shared/ShareableSurface.cpp
r113773 r122554 150 150 { 151 151 #if USE(GRAPHICS_SURFACE) 152 if (handle.graphicsSurfaceToken()) { 152 153 RefPtr<GraphicsSurface> surface = GraphicsSurface::create(handle.m_size, handle.m_flags, handle.m_graphicsSurfaceToken); 153 154 if (surface) 154 155 return adoptRef(new ShareableSurface(handle.m_size, handle.m_flags, PassRefPtr<GraphicsSurface>(surface))); 156 } 155 157 #endif 156 158 -
trunk/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp
r121221 r122554 62 62 } 63 63 64 static inline uint64_t createLayerTileUniqueKey(int layerID, int tileID) 65 { 66 uint64_t key = layerID; 67 key <<= 32; 68 key |= tileID; 69 return key; 70 } 71 64 72 void LayerTreeCoordinatorProxy::updateTileForLayer(int layerID, int tileID, const IntRect& targetRect, const WebKit::SurfaceUpdateInfo& updateInfo) 65 73 { 66 74 RefPtr<ShareableSurface> surface; 67 75 #if USE(GRAPHICS_SURFACE) 68 uint32_t token = updateInfo.surfaceHandle.graphicsSurfaceToken(); 69 HashMap<uint32_t, RefPtr<ShareableSurface> >::iterator it = m_surfaces.find(token); 76 uint64_t key = createLayerTileUniqueKey(layerID, tileID); 77 78 HashMap<uint64_t, RefPtr<ShareableSurface> >::iterator it = m_surfaces.find(key); 70 79 if (it == m_surfaces.end()) { 71 80 surface = ShareableSurface::create(updateInfo.surfaceHandle); 72 m_surfaces.add( token, surface);81 m_surfaces.add(key, surface); 73 82 } else 74 83 surface = it->second; -
trunk/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h
r121221 r122554 80 80 RefPtr<WebLayerTreeRenderer> m_renderer; 81 81 #if USE(GRAPHICS_SURFACE) 82 HashMap<uint 32_t, RefPtr<ShareableSurface> > m_surfaces;82 HashMap<uint64_t, RefPtr<ShareableSurface> > m_surfaces; 83 83 #endif 84 84 }; -
trunk/Tools/ChangeLog
r122551 r122554 1 2012-07-13 Zeno Albisser <zeno@webkit.org> 2 3 [Qt][WK2] Implement GraphicsSurface for Linux/GLX. 4 https://bugs.webkit.org/show_bug.cgi?id=90881 5 6 Enable GraphicsSurface for Linux based platforms 7 whenever the Xcomposite extension is available. 8 9 Reviewed by Noam Rosenthal. 10 11 * qmake/config.tests/libXcomposite/libXcomposite.cpp: Added. 12 (main): 13 * qmake/config.tests/libXcomposite/libXcomposite.pro: Added. 14 Add a configure test to detect Xcomposite extension and 15 activate GraphicsSurface on linux in case the extension is available. 16 * qmake/configure.pri: 17 * qmake/mkspecs/features/features.prf: 18 1 19 2012-07-13 David Grogan <dgrogan@chromium.org> 2 20 -
trunk/Tools/qmake/configure.pri
r121963 r122554 16 16 libjpeg \ 17 17 libwebp \ 18 libXcomposite \ 18 19 libxml2 \ 19 20 libxslt \ -
trunk/Tools/qmake/mkspecs/features/features.prf
r122219 r122554 171 171 } 172 172 173 # Xcomposite Support 174 haveQt(5):linux-*:config_libXcomposite: DEFINES += HAVE_XCOMPOSITE=1 175 176 # Support for Graphics Surface 173 177 !contains(DEFINES, WTF_USE_GRAPHICS_SURFACE=.) { 174 haveQt(5):mac: DEFINES += WTF_USE_GRAPHICS_SURFACE=1 178 haveQt(5) { 179 mac: DEFINES += WTF_USE_GRAPHICS_SURFACE=1 180 # On linux we require libXcomposite to enable graphics surface. 181 linux-*:contains(DEFINES, HAVE_XCOMPOSITE=1): DEFINES += WTF_USE_GRAPHICS_SURFACE=1 182 } 175 183 } 176 184
Note: See TracChangeset
for help on using the changeset viewer.