Changeset 132615 in webkit


Ignore:
Timestamp:
Oct 26, 2012 4:21:25 AM (11 years ago)
Author:
commit-queue@webkit.org
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 <hw1008.kim@samsung.com> 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):

Location:
trunk/Source/WebKit/efl
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/efl/ChangeLog

    r132396 r132615  
     12012-10-26  Hyowon Kim  <hw1008.kim@samsung.com>
     2
     3        [Texmap][EFL] Implementation of AC related functions in ChromeClientEfl and ewkView.
     4        https://bugs.webkit.org/show_bug.cgi?id=82315
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        This patch implements accelerated-compositing-related functions
     9        to enter accelerated-compositing mode and sync layers
     10        in ChromeClientEfl and ewkView.
     11
     12        * WebCoreSupport/ChromeClientEfl.cpp:
     13        (WebCore::ChromeClientEfl::attachRootGraphicsLayer):
     14        (WebCore::ChromeClientEfl::setNeedsOneShotDrawingSynchronization):
     15        (WebCore::ChromeClientEfl::scheduleCompositingLayerFlush):
     16        (WebCore::ChromeClientEfl::allowedCompositingTriggers):
     17        * ewk/ewk_view.cpp:
     18        (_Ewk_View_Private_Data):
     19        (_ewk_view_priv_new):
     20        (_ewk_view_priv_del):
     21        (_ewk_view_accelerated_compositing_cb):
     22        Sync and render layers.
     23        (_ewk_view_accelerated_compositing_context_create_if_needed):
     24        Create a new AcceleratedCompositingContext.
     25        (ewk_view_accelerated_compositing_object_create):
     26        Create a new evas_image_object act as render target surface.
     27        (ewk_view_accelerated_compositing_context_get):
     28        Return the GraphicsContext3D for accelerated compositing.
     29        (ewk_view_root_graphics_layer_set):
     30        Set the root layer to AcceleratedCompositingContext.
     31        (ewk_view_mark_for_sync):
     32        Mark the evas_image_object for accelerated compositing as dirty to make it update.
     33        * ewk/ewk_view_private.h:
     34        (WebCore):
     35
    1362012-10-24  Brady Eidson  <beidson@apple.com>
    237
  • trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp

    r131617 r132615  
    592592
    593593#if USE(ACCELERATED_COMPOSITING)
    594 void ChromeClientEfl::attachRootGraphicsLayer(Frame*, GraphicsLayer*)
    595 {
    596     notImplemented();
     594void ChromeClientEfl::attachRootGraphicsLayer(Frame*, GraphicsLayer* rootLayer)
     595{
     596    ewk_view_root_graphics_layer_set(m_view, rootLayer);
    597597}
    598598
    599599void ChromeClientEfl::setNeedsOneShotDrawingSynchronization()
    600600{
    601     notImplemented();
     601    ewk_view_mark_for_sync(m_view);
    602602}
    603603
    604604void ChromeClientEfl::scheduleCompositingLayerFlush()
    605605{
    606     notImplemented();
     606    ewk_view_mark_for_sync(m_view);
    607607}
    608608
    609609ChromeClient::CompositingTriggerFlags ChromeClientEfl::allowedCompositingTriggers() const
    610610{
    611     return 0;
     611    return AllTriggers;
    612612}
    613613#endif
  • trunk/Source/WebKit/efl/ewk/ewk_view.cpp

    r132193 r132615  
    9595
    9696#if USE(ACCELERATED_COMPOSITING)
    97 #include "NotImplemented.h"
     97#include "AcceleratedCompositingContextEfl.h"
    9898#endif
    9999
     
    251251    Ewk_History* history;
    252252    OwnPtr<PageClientEfl> pageClient;
     253#if USE(ACCELERATED_COMPOSITING)
     254    OwnPtr<WebCore::AcceleratedCompositingContext> acceleratedCompositingContext;
     255    bool isCompositingActive;
     256    RefPtr<Evas_Object> compositingObject;
     257#endif
    253258#if ENABLE(NETWORK_INFO)
    254259    OwnPtr<WebCore::NetworkInfoClientEfl> networkInfoClient;
     
    908913    priv->contextMenu = 0;
    909914
     915#if USE(ACCELERATED_COMPOSITING)
     916    priv->isCompositingActive = false;
     917#endif
     918
    910919    return priv;
    911920}
     
    943952    if (priv->contextMenu)
    944953        ewk_context_menu_free(priv->contextMenu);
     954
     955#if USE(ACCELERATED_COMPOSITING)
     956    priv->acceleratedCompositingContext = nullptr;
     957#endif
    945958
    946959    delete priv;
     
    44954508
    44964509#if USE(ACCELERATED_COMPOSITING)
    4497 bool ewk_view_accelerated_compositing_object_create(Evas_Object*, Evas_Native_Surface*, const WebCore::IntRect& /*rect*/)
    4498 {
    4499     notImplemented();
    4500     return false;
    4501 }
    4502 
    4503 WebCore::GraphicsContext3D* ewk_view_accelerated_compositing_context_get(Evas_Object*)
    4504 {
    4505     notImplemented();
    4506     return 0;
     4510void _ewk_view_accelerated_compositing_cb(void* data, Evas_Object*)
     4511{
     4512    Ewk_View_Private_Data* priv = static_cast<Ewk_View_Private_Data*>(data);
     4513
     4514    if (priv->isCompositingActive) {
     4515        priv->acceleratedCompositingContext->syncLayersNow();
     4516        priv->acceleratedCompositingContext->renderLayers();
     4517    }
     4518}
     4519
     4520void _ewk_view_accelerated_compositing_context_create_if_needed(Evas_Object* ewkView)
     4521{
     4522    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
     4523    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
     4524
     4525    if (!priv->acceleratedCompositingContext)
     4526        priv->acceleratedCompositingContext = WebCore::AcceleratedCompositingContext::create(priv->page->chrome());
     4527}
     4528
     4529bool ewk_view_accelerated_compositing_object_create(Evas_Object* ewkView, Evas_Native_Surface* nativeSurface, const WebCore::IntRect& rect)
     4530{
     4531    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     4532    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
     4533
     4534    if (!priv->compositingObject) {
     4535        priv->compositingObject = evas_object_image_add(smartData->base.evas);
     4536
     4537        evas_object_pass_events_set(priv->compositingObject.get(), true); // Just for rendering, ignore events.
     4538        evas_object_image_alpha_set(priv->compositingObject.get(), true);
     4539        evas_object_image_content_hint_set(priv->compositingObject.get(), EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
     4540
     4541        // Set the pixel get callback.
     4542        evas_object_image_pixels_get_callback_set(priv->compositingObject.get(), _ewk_view_accelerated_compositing_cb, priv);
     4543
     4544        evas_object_smart_member_add(priv->compositingObject.get(), ewkView);
     4545    }
     4546
     4547    evas_object_image_size_set(priv->compositingObject.get(), rect.width(), rect.height());
     4548    evas_object_image_fill_set(priv->compositingObject.get(), 0, 0, rect.width(), rect.height());
     4549
     4550    evas_object_move(priv->compositingObject.get(), rect.x(), rect.y());
     4551    evas_object_resize(priv->compositingObject.get(), rect.width(), rect.height());
     4552    evas_object_hide(priv->compositingObject.get());
     4553
     4554    // Set up the native surface info to use the context and surface created in GC3DPrivate.
     4555    evas_object_image_native_surface_set(priv->compositingObject.get(), nativeSurface);
     4556    return true;
     4557}
     4558
     4559WebCore::GraphicsContext3D* ewk_view_accelerated_compositing_context_get(Evas_Object* ewkView)
     4560{
     4561    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
     4562    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
     4563
     4564    _ewk_view_accelerated_compositing_context_create_if_needed(ewkView);
     4565    return priv->acceleratedCompositingContext->context();
     4566}
     4567
     4568void ewk_view_root_graphics_layer_set(Evas_Object* ewkView, WebCore::GraphicsLayer* rootLayer)
     4569{
     4570    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
     4571    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
     4572
     4573    bool active = !!rootLayer;
     4574    if (priv->isCompositingActive == active)
     4575        return;
     4576
     4577    priv->isCompositingActive = active;
     4578
     4579    if (priv->isCompositingActive) {
     4580        _ewk_view_accelerated_compositing_context_create_if_needed(ewkView);
     4581        evas_object_show(priv->compositingObject.get());
     4582    } else
     4583        evas_object_hide(priv->compositingObject.get());
     4584
     4585    priv->acceleratedCompositingContext->attachRootGraphicsLayer(rootLayer);
     4586}
     4587
     4588void ewk_view_mark_for_sync(Evas_Object* ewkView)
     4589{
     4590    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
     4591    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
     4592
     4593    // Mark the image as "dirty" meaning it needs an update next time evas renders.
     4594    // It will call the pixel get callback then.
     4595    evas_object_image_pixels_dirty_set(priv->compositingObject.get(), true);
    45074596}
    45084597#endif
  • trunk/Source/WebKit/efl/ewk/ewk_view_private.h

    r129594 r132615  
    3636
    3737class Cursor;
     38#if USE(ACCELERATED_COMPOSITING)
     39class GraphicsContext3D;
     40class GraphicsLayer;
     41#endif
    3842class PopupMenuClient;
    3943}
     
    155159bool ewk_view_accelerated_compositing_object_create(Evas_Object* ewkView, Evas_Native_Surface* nativeSurface, const WebCore::IntRect& rect);
    156160WebCore::GraphicsContext3D* ewk_view_accelerated_compositing_context_get(Evas_Object* ewkView);
     161void ewk_view_root_graphics_layer_set(Evas_Object* ewkView, WebCore::GraphicsLayer* rootLayer);
     162void ewk_view_mark_for_sync(Evas_Object* ewkView);
    157163#endif
    158164
Note: See TracChangeset for help on using the changeset viewer.