Title: [132615] trunk/Source/WebKit/efl
Revision
132615
Author
[email protected]
Date
2012-10-26 04:21:25 -0700 (Fri, 26 Oct 2012)

Log Message

[Texmap][EFL] Implementation of AC related functions in ChromeClientEfl and ewkView.
https://bugs.webkit.org/show_bug.cgi?id=82315

Patch by Hyowon Kim <[email protected]> on 2012-10-26
Reviewed by Kenneth Rohde Christiansen.

This patch implements accelerated-compositing-related functions
to enter accelerated-compositing mode and sync layers
in ChromeClientEfl and ewkView.

* WebCoreSupport/ChromeClientEfl.cpp:
(WebCore::ChromeClientEfl::attachRootGraphicsLayer):
(WebCore::ChromeClientEfl::setNeedsOneShotDrawingSynchronization):
(WebCore::ChromeClientEfl::scheduleCompositingLayerFlush):
(WebCore::ChromeClientEfl::allowedCompositingTriggers):
* ewk/ewk_view.cpp:
(_Ewk_View_Private_Data):
(_ewk_view_priv_new):
(_ewk_view_priv_del):
(_ewk_view_accelerated_compositing_cb):
Sync and render layers.
(_ewk_view_accelerated_compositing_context_create_if_needed):
Create a new AcceleratedCompositingContext.
(ewk_view_accelerated_compositing_object_create):
Create a new evas_image_object act as render target surface.
(ewk_view_accelerated_compositing_context_get):
Return the GraphicsContext3D for accelerated compositing.
(ewk_view_root_graphics_layer_set):
Set the root layer to AcceleratedCompositingContext.
(ewk_view_mark_for_sync):
Mark the evas_image_object for accelerated compositing as dirty to make it update.
* ewk/ewk_view_private.h:
(WebCore):

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (132614 => 132615)


--- trunk/Source/WebKit/efl/ChangeLog	2012-10-26 11:21:08 UTC (rev 132614)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-10-26 11:21:25 UTC (rev 132615)
@@ -1,3 +1,38 @@
+2012-10-26  Hyowon Kim  <[email protected]>
+
+        [Texmap][EFL] Implementation of AC related functions in ChromeClientEfl and ewkView.
+        https://bugs.webkit.org/show_bug.cgi?id=82315
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        This patch implements accelerated-compositing-related functions
+        to enter accelerated-compositing mode and sync layers 
+        in ChromeClientEfl and ewkView.
+
+        * WebCoreSupport/ChromeClientEfl.cpp:
+        (WebCore::ChromeClientEfl::attachRootGraphicsLayer):
+        (WebCore::ChromeClientEfl::setNeedsOneShotDrawingSynchronization):
+        (WebCore::ChromeClientEfl::scheduleCompositingLayerFlush):
+        (WebCore::ChromeClientEfl::allowedCompositingTriggers):
+        * ewk/ewk_view.cpp:
+        (_Ewk_View_Private_Data):
+        (_ewk_view_priv_new):
+        (_ewk_view_priv_del):
+        (_ewk_view_accelerated_compositing_cb):
+        Sync and render layers.
+        (_ewk_view_accelerated_compositing_context_create_if_needed):
+        Create a new AcceleratedCompositingContext.
+        (ewk_view_accelerated_compositing_object_create):
+        Create a new evas_image_object act as render target surface.
+        (ewk_view_accelerated_compositing_context_get):
+        Return the GraphicsContext3D for accelerated compositing. 
+        (ewk_view_root_graphics_layer_set):
+        Set the root layer to AcceleratedCompositingContext.
+        (ewk_view_mark_for_sync):
+        Mark the evas_image_object for accelerated compositing as dirty to make it update.
+        * ewk/ewk_view_private.h:
+        (WebCore):
+
 2012-10-24  Brady Eidson  <[email protected]>
 
         Add a strategy for loader customization.

Modified: trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp (132614 => 132615)


--- trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2012-10-26 11:21:08 UTC (rev 132614)
+++ trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2012-10-26 11:21:25 UTC (rev 132615)
@@ -591,24 +591,24 @@
 }
 
 #if USE(ACCELERATED_COMPOSITING)
-void ChromeClientEfl::attachRootGraphicsLayer(Frame*, GraphicsLayer*)
+void ChromeClientEfl::attachRootGraphicsLayer(Frame*, GraphicsLayer* rootLayer)
 {
-    notImplemented();
+    ewk_view_root_graphics_layer_set(m_view, rootLayer);
 }
 
 void ChromeClientEfl::setNeedsOneShotDrawingSynchronization()
 {
-    notImplemented();
+    ewk_view_mark_for_sync(m_view);
 }
 
 void ChromeClientEfl::scheduleCompositingLayerFlush()
 {
-    notImplemented();
+    ewk_view_mark_for_sync(m_view);
 }
 
 ChromeClient::CompositingTriggerFlags ChromeClientEfl::allowedCompositingTriggers() const
 {
-    return 0;
+    return AllTriggers;
 }
 #endif
 

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (132614 => 132615)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2012-10-26 11:21:08 UTC (rev 132614)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2012-10-26 11:21:25 UTC (rev 132615)
@@ -94,7 +94,7 @@
 #endif
 
 #if USE(ACCELERATED_COMPOSITING)
-#include "NotImplemented.h"
+#include "AcceleratedCompositingContextEfl.h"
 #endif
 
 #if ENABLE(NETWORK_INFO)
@@ -250,6 +250,11 @@
     WebCore::ViewportArguments viewportArguments;
     Ewk_History* history;
     OwnPtr<PageClientEfl> pageClient;
+#if USE(ACCELERATED_COMPOSITING)
+    OwnPtr<WebCore::AcceleratedCompositingContext> acceleratedCompositingContext;
+    bool isCompositingActive;
+    RefPtr<Evas_Object> compositingObject;
+#endif
 #if ENABLE(NETWORK_INFO)
     OwnPtr<WebCore::NetworkInfoClientEfl> networkInfoClient;
 #endif
@@ -907,6 +912,10 @@
 
     priv->contextMenu = 0;
 
+#if USE(ACCELERATED_COMPOSITING)
+    priv->isCompositingActive = false;
+#endif
+
     return priv;
 }
 
@@ -943,6 +952,10 @@
     if (priv->contextMenu)
         ewk_context_menu_free(priv->contextMenu);
 
+#if USE(ACCELERATED_COMPOSITING)
+    priv->acceleratedCompositingContext = nullptr;
+#endif
+
     delete priv;
 }
 
@@ -4494,17 +4507,93 @@
 }
 
 #if USE(ACCELERATED_COMPOSITING)
-bool ewk_view_accelerated_compositing_object_create(Evas_Object*, Evas_Native_Surface*, const WebCore::IntRect& /*rect*/)
+void _ewk_view_accelerated_compositing_cb(void* data, Evas_Object*)
 {
-    notImplemented();
-    return false;
+    Ewk_View_Private_Data* priv = static_cast<Ewk_View_Private_Data*>(data);
+
+    if (priv->isCompositingActive) {
+        priv->acceleratedCompositingContext->syncLayersNow();
+        priv->acceleratedCompositingContext->renderLayers();
+    }
 }
 
-WebCore::GraphicsContext3D* ewk_view_accelerated_compositing_context_get(Evas_Object*)
+void _ewk_view_accelerated_compositing_context_create_if_needed(Evas_Object* ewkView)
 {
-    notImplemented();
-    return 0;
+    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+    if (!priv->acceleratedCompositingContext)
+        priv->acceleratedCompositingContext = WebCore::AcceleratedCompositingContext::create(priv->page->chrome());
 }
+
+bool ewk_view_accelerated_compositing_object_create(Evas_Object* ewkView, Evas_Native_Surface* nativeSurface, const WebCore::IntRect& rect)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
+    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+
+    if (!priv->compositingObject) {
+        priv->compositingObject = evas_object_image_add(smartData->base.evas);
+
+        evas_object_pass_events_set(priv->compositingObject.get(), true); // Just for rendering, ignore events.
+        evas_object_image_alpha_set(priv->compositingObject.get(), true);
+        evas_object_image_content_hint_set(priv->compositingObject.get(), EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
+
+        // Set the pixel get callback.
+        evas_object_image_pixels_get_callback_set(priv->compositingObject.get(), _ewk_view_accelerated_compositing_cb, priv);
+
+        evas_object_smart_member_add(priv->compositingObject.get(), ewkView);
+    }
+
+    evas_object_image_size_set(priv->compositingObject.get(), rect.width(), rect.height());
+    evas_object_image_fill_set(priv->compositingObject.get(), 0, 0, rect.width(), rect.height());
+
+    evas_object_move(priv->compositingObject.get(), rect.x(), rect.y());
+    evas_object_resize(priv->compositingObject.get(), rect.width(), rect.height());
+    evas_object_hide(priv->compositingObject.get());
+
+    // Set up the native surface info to use the context and surface created in GC3DPrivate.
+    evas_object_image_native_surface_set(priv->compositingObject.get(), nativeSurface);
+    return true;
+}
+
+WebCore::GraphicsContext3D* ewk_view_accelerated_compositing_context_get(Evas_Object* ewkView)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
+    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+
+    _ewk_view_accelerated_compositing_context_create_if_needed(ewkView);
+    return priv->acceleratedCompositingContext->context();
+}
+
+void ewk_view_root_graphics_layer_set(Evas_Object* ewkView, WebCore::GraphicsLayer* rootLayer)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+    bool active = !!rootLayer;
+    if (priv->isCompositingActive == active)
+        return;
+
+    priv->isCompositingActive = active;
+
+    if (priv->isCompositingActive) {
+        _ewk_view_accelerated_compositing_context_create_if_needed(ewkView);
+        evas_object_show(priv->compositingObject.get());
+    } else
+        evas_object_hide(priv->compositingObject.get());
+
+    priv->acceleratedCompositingContext->attachRootGraphicsLayer(rootLayer);
+}
+
+void ewk_view_mark_for_sync(Evas_Object* ewkView)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+    // Mark the image as "dirty" meaning it needs an update next time evas renders.
+    // It will call the pixel get callback then.
+    evas_object_image_pixels_dirty_set(priv->compositingObject.get(), true);
+}
 #endif
 
 Eina_Bool ewk_view_setting_web_audio_get(const Evas_Object* ewkView)

Modified: trunk/Source/WebKit/efl/ewk/ewk_view_private.h (132614 => 132615)


--- trunk/Source/WebKit/efl/ewk/ewk_view_private.h	2012-10-26 11:21:08 UTC (rev 132614)
+++ trunk/Source/WebKit/efl/ewk/ewk_view_private.h	2012-10-26 11:21:25 UTC (rev 132615)
@@ -35,6 +35,10 @@
 #endif
 
 class Cursor;
+#if USE(ACCELERATED_COMPOSITING)
+class GraphicsContext3D;
+class GraphicsLayer;
+#endif
 class PopupMenuClient;
 }
 
@@ -154,6 +158,8 @@
 #if USE(ACCELERATED_COMPOSITING)
 bool ewk_view_accelerated_compositing_object_create(Evas_Object* ewkView, Evas_Native_Surface* nativeSurface, const WebCore::IntRect& rect);
 WebCore::GraphicsContext3D* ewk_view_accelerated_compositing_context_get(Evas_Object* ewkView);
+void ewk_view_root_graphics_layer_set(Evas_Object* ewkView, WebCore::GraphicsLayer* rootLayer);
+void ewk_view_mark_for_sync(Evas_Object* ewkView);
 #endif
 
 #if ENABLE(FULLSCREEN_API)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to