Changeset 165525 in webkit
- Timestamp:
- Mar 12, 2014 9:46:26 PM (10 years ago)
- Location:
- trunk/Source/WebKit/efl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/efl/ChangeLog
r165428 r165525 1 2014-03-12 Hyowon Kim <hw1008.kim@samsung.com> 2 3 [EFL] Revise AcceleratedCompositingEfl implementation. 4 https://bugs.webkit.org/show_bug.cgi?id=130072 5 6 Reviewed by Gyuyoung Kim. 7 8 This patch revises the AcceleratedCompositingEfl class implementation 9 similar with gtk port. 10 And accelerated compositing will be enabled by default on WK1 efl. 11 12 * WebCoreSupport/AcceleratedCompositingContextEfl.cpp: 13 (WebCore::AcceleratedCompositingContext::AcceleratedCompositingContext): 14 (WebCore::AcceleratedCompositingContext::initialize): 15 (WebCore::AcceleratedCompositingContext::syncLayers): 16 (WebCore::AcceleratedCompositingContext::resize): 17 (WebCore::AcceleratedCompositingContext::canComposite): 18 (WebCore::AcceleratedCompositingContext::flushAndRenderLayers): 19 (WebCore::AcceleratedCompositingContext::flushPendingLayerChanges): 20 (WebCore::AcceleratedCompositingContext::compositeLayersToContext): 21 (WebCore::AcceleratedCompositingContext::attachRootGraphicsLayer): 22 * WebCoreSupport/AcceleratedCompositingContextEfl.h: 23 * ewk/ewk_view.cpp: 24 (_ewk_view_priv_new): 25 (_ewk_view_accelerated_compositing_cb): 26 (_ewk_view_accelerated_compositing_context_create_if_needed): 27 1 28 2014-03-10 Hyowon Kim <hw1008.kim@samsung.com> 2 29 -
trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.cpp
r165314 r165525 23 23 24 24 #include "AcceleratedCompositingContextEfl.h" 25 #include "FrameView.h"26 25 #include "GraphicsLayerTextureMapper.h" 27 #include "HostWindow.h"28 26 #include "MainFrame.h" 29 27 #include "TextureMapperGL.h" … … 31 29 #include "ewk_view_private.h" 32 30 31 const double compositingFrameRate = 60; 32 33 33 namespace WebCore { 34 34 35 PassOwnPtr<AcceleratedCompositingContext> AcceleratedCompositingContext::create(HostWindow* hostWindow) 35 AcceleratedCompositingContext::AcceleratedCompositingContext(Evas_Object* ewkView, Evas_Object* compositingObject) 36 : m_view(ewkView) 37 , m_compositingObject(compositingObject) 38 , m_syncTimer(this, &AcceleratedCompositingContext::syncLayers) 36 39 { 37 OwnPtr<AcceleratedCompositingContext> context = adoptPtr(new AcceleratedCompositingContext); 38 if (!context->initialize(hostWindow)) 39 return nullptr; 40 41 return context.release(); 42 } 43 44 AcceleratedCompositingContext::AcceleratedCompositingContext() 45 : m_view(0) 46 , m_rootTextureMapperLayer(0) 47 { 40 ASSERT(m_view); 41 ASSERT(m_compositingObject); 48 42 } 49 43 … … 52 46 } 53 47 54 bool AcceleratedCompositingContext::initialize( HostWindow* hostWindow)48 bool AcceleratedCompositingContext::initialize() 55 49 { 56 m_view = hostWindow->platformPageClient();57 if (!m_view)58 return false;59 60 50 m_evasGL = adoptPtr(evas_gl_new(evas_object_evas_get(m_view))); 61 51 if (!m_evasGL) … … 77 67 } 78 68 69 void AcceleratedCompositingContext::syncLayers(Timer<AcceleratedCompositingContext>*) 70 { 71 ewk_view_mark_for_sync(m_view); 72 } 73 79 74 bool AcceleratedCompositingContext::resize(const IntSize& size) 80 75 { … … 91 86 return false; 92 87 88 Evas_Native_Surface nativeSurface; 89 evas_gl_native_surface_get(m_evasGL.get(), m_evasGLSurface->surface(), &nativeSurface); 90 evas_object_image_native_surface_set(m_compositingObject, &nativeSurface); 93 91 return true; 94 92 } 95 93 96 void AcceleratedCompositingContext::syncLayersNow()94 bool AcceleratedCompositingContext::canComposite() 97 95 { 98 if (m_rootGraphicsLayer) 99 m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly(); 100 101 EWKPrivate::corePage(m_view)->mainFrame().view()->flushCompositingStateIncludingSubframes(); 96 return m_rootGraphicsLayer && m_textureMapper; 102 97 } 103 98 104 void AcceleratedCompositingContext:: renderLayers()99 void AcceleratedCompositingContext::flushAndRenderLayers() 105 100 { 106 if (!m_rootGraphicsLayer) 101 if (!canComposite()) 102 return; 103 104 MainFrame& frame = EWKPrivate::corePage(m_view)->mainFrame(); 105 if (!frame.contentRenderer() || !frame.view()) 106 return; 107 frame.view()->updateLayoutAndStyleIfNeededRecursive(); 108 109 if (!canComposite()) 107 110 return; 108 111 … … 110 113 return; 111 114 115 if (!flushPendingLayerChanges()) 116 return; 117 118 compositeLayersToContext(); 119 120 if (toTextureMapperLayer(m_rootGraphicsLayer.get())->descendantsOrSelfHaveRunningAnimations() && !m_syncTimer.isActive()) 121 m_syncTimer.startOneShot(1 / compositingFrameRate); 122 } 123 124 bool AcceleratedCompositingContext::flushPendingLayerChanges() 125 { 126 m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly(); 127 return EWKPrivate::corePage(m_view)->mainFrame().view()->flushCompositingStateIncludingSubframes(); 128 } 129 130 void AcceleratedCompositingContext::compositeLayersToContext() 131 { 112 132 Evas_Coord width = 0; 113 133 Evas_Coord height = 0; 114 134 evas_object_geometry_get(m_view, 0, 0, &width, &height); 135 115 136 evas_gl_api_get(m_evasGL.get())->glViewport(0, 0, width, height); 137 evas_gl_api_get(m_evasGL.get())->glClear(GL_COLOR_BUFFER_BIT); 116 138 117 139 m_textureMapper->beginPainting(); 118 m_rootTextureMapperLayer->paint(); 140 m_textureMapper->beginClip(TransformationMatrix(), FloatRect(0, 0, width, height)); 141 toTextureMapperLayer(m_rootGraphicsLayer.get())->paint(); 119 142 m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get()); 143 m_textureMapper->endClip(); 120 144 m_textureMapper->endPainting(); 121 145 } … … 125 149 if (!rootLayer) { 126 150 m_rootGraphicsLayer = nullptr; 127 m_rootTextureMapperLayer = 0;128 151 return; 129 152 } 130 153 131 m_rootGraphicsLayer = WebCore::GraphicsLayer::create(0, 0); 132 m_rootTextureMapperLayer = toTextureMapperLayer(m_rootGraphicsLayer.get()); 154 if (!m_textureMapper) { 155 evas_gl_make_current(m_evasGL.get(), m_evasGLSurface->surface(), m_evasGLContext->context()); 156 m_textureMapper = TextureMapperGL::create(); 157 } 158 159 m_rootGraphicsLayer = GraphicsLayer::create(0, 0); 133 160 m_rootGraphicsLayer->addChild(rootLayer); 134 161 m_rootGraphicsLayer->setDrawsContent(false); 135 162 m_rootGraphicsLayer->setMasksToBounds(false); 136 m_rootGraphicsLayer->setSize( WebCore::IntSize(1, 1));163 m_rootGraphicsLayer->setSize(IntSize(1, 1)); 137 164 138 m_textureMapper = TextureMapperGL::create(); 139 m_rootTextureMapperLayer->setTextureMapper(m_textureMapper.get()); 165 toTextureMapperLayer(m_rootGraphicsLayer.get())->setTextureMapper(m_textureMapper.get()); 140 166 141 167 m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly(); -
trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.h
r165428 r165525 25 25 #include "EvasGLSurface.h" 26 26 #include "TextureMapperFPSCounter.h" 27 #include "Timer.h" 27 28 #include <wtf/Noncopyable.h> 28 29 #include <wtf/OwnPtr.h> … … 38 39 WTF_MAKE_NONCOPYABLE(AcceleratedCompositingContext); 39 40 public: 40 static PassOwnPtr<AcceleratedCompositingContext> create(HostWindow*); 41 virtual ~AcceleratedCompositingContext(); 41 AcceleratedCompositingContext(Evas_Object* ewkView, Evas_Object* compositingObject); 42 ~AcceleratedCompositingContext(); 43 44 bool initialize(); 42 45 43 46 bool resize(const IntSize&); 47 void attachRootGraphicsLayer(GraphicsLayer* rootLayer); 44 48 45 virtual void syncLayersNow(); 46 virtual void renderLayers(); 47 virtual void attachRootGraphicsLayer(GraphicsLayer* rootLayer); 49 void flushAndRenderLayers(); 50 bool flushPendingLayerChanges(); 51 void compositeLayersToContext(); 52 53 bool canComposite(); 54 55 void syncLayers(Timer<AcceleratedCompositingContext>*); 48 56 49 57 private: 50 AcceleratedCompositingContext();51 52 virtual bool initialize(HostWindow*);53 54 58 Evas_Object* m_view; 59 Evas_Object* m_compositingObject; 55 60 56 61 OwnPtr<TextureMapper> m_textureMapper; 57 62 std::unique_ptr<GraphicsLayer> m_rootGraphicsLayer; 58 T extureMapperLayer* m_rootTextureMapperLayer;63 Timer<AcceleratedCompositingContext> m_syncTimer; 59 64 60 65 OwnPtr<Evas_GL> m_evasGL; -
trunk/Source/WebKit/efl/ewk/ewk_view.cpp
r165428 r165525 255 255 WebCore::ViewportArguments viewportArguments; 256 256 Ewk_History* history; 257 OwnPtr<WebCore::AcceleratedCompositingContext> acceleratedCompositingContext;257 std::unique_ptr<WebCore::AcceleratedCompositingContext> acceleratedCompositingContext; 258 258 bool isCompositingActive; 259 259 RefPtr<Evas_Object> compositingObject; … … 747 747 #endif 748 748 pageSettings.setInteractiveFormValidationEnabled(true); 749 pageSettings.setAcceleratedCompositingEnabled( false);749 pageSettings.setAcceleratedCompositingEnabled(true); 750 750 char* debugVisualsEnvironment = getenv("WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS"); 751 751 bool showDebugVisuals = debugVisualsEnvironment && !strcmp(debugVisualsEnvironment, "1"); … … 4631 4631 Ewk_View_Private_Data* priv = static_cast<Ewk_View_Private_Data*>(data); 4632 4632 4633 if (priv->isCompositingActive) { 4634 priv->acceleratedCompositingContext->syncLayersNow(); 4635 priv->acceleratedCompositingContext->renderLayers(); 4636 } 4633 if (priv->isCompositingActive) 4634 priv->acceleratedCompositingContext->flushAndRenderLayers(); 4637 4635 } 4638 4636 … … 4643 4641 4644 4642 if (!priv->acceleratedCompositingContext) { 4645 priv->acceleratedCompositingContext = WebCore::AcceleratedCompositingContext::create(&priv->page->chrome()); 4646 if (!priv->acceleratedCompositingContext) 4643 priv->acceleratedCompositingContext = std::make_unique<WebCore::AcceleratedCompositingContext>(ewkView, priv->compositingObject.get()); 4644 if (!priv->acceleratedCompositingContext->initialize()) { 4645 priv->acceleratedCompositingContext = nullptr; 4647 4646 return false; 4647 } 4648 4648 } 4649 4649 return true;
Note: See TracChangeset
for help on using the changeset viewer.