Changeset 285099 in webkit


Ignore:
Timestamp:
Oct 31, 2021, 5:56:28 PM (4 years ago)
Author:
Fujii Hironori
Message:

[WinCairo] New GraphicsLayer for GPU process mode
https://bugs.webkit.org/show_bug.cgi?id=228308

Reviewed by Don Olmstead.

.:

  • Source/cmake/OptionsWinCairo.cmake:

Source/WebCore:

  • PlatformWinCairo.cmake:
  • platform/graphics/RemoteGraphicsContextGLProxyBase.cpp:
  • platform/graphics/RemoteGraphicsContextGLProxyBase.h:
  • platform/graphics/wc/RemoteGraphicsContextGLProxyBaseWC.cpp: Added.

(WebCore::RemoteGraphicsContextGLProxyBase::platformInitialize):
(WebCore::RemoteGraphicsContextGLProxyBase::platformLayer const):
(WebCore::RemoteGraphicsContextGLProxyBase::setPlatformLayer):

  • platform/graphics/wc/WCPlatformLayer.h: Added.
  • platform/graphics/win/GraphicsContextWin.cpp:

(WebCore::GraphicsContext::getWindowsContext): DisplayList
GraphicsContext doesn't have a HDC. Do nothing for DisplayList
context.

  • platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:

(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
Paint a frame by using GraphicsContext::drawNativeImage instead of
Cairo API for DisplayList.

Source/WebKit:

Added a new GraphicsLayer implementation GraphicsLayerWC which
transfers GraphicsLayer tree to GPU process and runs the
compositor (TextureMapper) in GPU process.

In GPU process mode, WebGL is run in GPU process. So, the
compositor should be run in GPU process. Otherwise, the output
texture of WebGL has to be transferred from GPU process to the
compositor process (UI process or web process).

Because ANGLE isn't thread-safe, the compositor and WebGL should
be run in the same thread in GPU process.

Enabling gpu_process_webgl also enables GPU process compositing now.

reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_webgl /t REG_DWORD /d 1 /f

gpu_process_canvas_rendering can also be enabled.

reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_canvas_rendering /t REG_DWORD /d 1 /f

Enabling gpu_process_dom_rendering is still experimental.

reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_dom_rendering /t REG_DWORD /d 1 /f

The following commands restore the non-GPU process mode.

reg delete HKEY_CURRENT_USER\Software\WebKit /v gpu_process_canvas_rendering /f
reg delete HKEY_CURRENT_USER\Software\WebKit /v gpu_process_webgl /f
reg delete HKEY_CURRENT_USER\Software\WebKit /v gpu_process_dom_rendering /f

  • GPUProcess/GPUConnectionToWebProcess.cpp:

(WebKit::GPUConnectionToWebProcess::createWCLayerTreeHost):
(WebKit::GPUConnectionToWebProcess::releaseWCLayerTreeHost):
(WebKit::GPUConnectionToWebProcess::findRemoteGraphicsContextGL):

  • GPUProcess/GPUConnectionToWebProcess.h:
  • GPUProcess/GPUConnectionToWebProcess.messages.in:
  • GPUProcess/GPUProcess.h:

(WebKit::GPUProcess::sharedSceneContext):

  • GPUProcess/graphics/RemoteGraphicsContextGL.h:

(WebKit::RemoteGraphicsContextGL::platformLayer const):

  • GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.cpp:

(WebKit::ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources):

  • GPUProcess/graphics/wc/RemoteWCLayerTreeHost.cpp: Added.

(WebKit::RemoteWCLayerTreeHost::create):
(WebKit::RemoteWCLayerTreeHost::RemoteWCLayerTreeHost):
(WebKit::RemoteWCLayerTreeHost::~RemoteWCLayerTreeHost):
(WebKit::RemoteWCLayerTreeHost::messageSenderConnection const):
(WebKit::RemoteWCLayerTreeHost::messageSenderDestinationID const):
(WebKit::RemoteWCLayerTreeHost::update):

  • GPUProcess/graphics/wc/RemoteWCLayerTreeHost.h: Added.
  • GPUProcess/graphics/wc/RemoteWCLayerTreeHost.messages.in: Added.
  • GPUProcess/graphics/wc/WCScene.cpp: Added.

(WebKit::WCScene::initialize):
(WebKit::WCScene::~WCScene):
(WebKit::WCScene::update):

  • GPUProcess/graphics/wc/WCScene.h: Added.
  • GPUProcess/graphics/wc/WCSceneContext.cpp: Added.

(WebKit::WCSceneContext::WCSceneContext):
(WebKit::WCSceneContext::makeContextCurrent):
(WebKit::WCSceneContext::createTextureMapper):
(WebKit::WCSceneContext::swapBuffers):

  • GPUProcess/graphics/wc/WCSceneContext.h: Added.
  • GPUProcess/graphics/wc/WCSharedSceneContextHolder.h: Added.

(WebKit::WCSharedSceneContextHolder::ensureHolderForWindow):
(WebKit::WCSharedSceneContextHolder::removeHolder):

  • GPUProcess/win/GPUProcessMainWin.cpp:

(WebKit::GPUProcessMain):

  • PlatformWin.cmake:
  • Scripts/webkit/messages.py:

(types_that_cannot_be_forward_declared):
(conditions_for_header):

  • Shared/DrawingAreaInfo.h:
  • UIProcess/wc/DrawingAreaProxyWC.cpp: Added.

(WebKit::DrawingAreaProxyWC::DrawingAreaProxyWC):
(WebKit::DrawingAreaProxyWC::paint):
(WebKit::DrawingAreaProxyWC::sizeDidChange):
(WebKit::DrawingAreaProxyWC::update):
(WebKit::DrawingAreaProxyWC::enterAcceleratedCompositingMode):
(WebKit::DrawingAreaProxyWC::incorporateUpdate):
(WebKit::DrawingAreaProxyWC::discardBackingStore):

  • UIProcess/wc/DrawingAreaProxyWC.h: Added.
  • UIProcess/win/PageClientImpl.cpp:

(WebKit::PageClientImpl::createDrawingAreaProxy):

  • UIProcess/win/WebView.cpp:

(WebKit::WebView::paint):

  • WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:

(WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):

  • WebProcess/GPU/graphics/wc/RemoteWCLayerTreeHostProxy.cpp: Added.

(WebKit::RemoteWCLayerTreeHostProxy::RemoteWCLayerTreeHostProxy):
(WebKit::RemoteWCLayerTreeHostProxy::~RemoteWCLayerTreeHostProxy):
(WebKit::RemoteWCLayerTreeHostProxy::messageSenderConnection const):
(WebKit::RemoteWCLayerTreeHostProxy::ensureGPUProcessConnection):
(WebKit::RemoteWCLayerTreeHostProxy::disconnectGpuProcessIfNeeded):
(WebKit::RemoteWCLayerTreeHostProxy::gpuProcessConnectionDidClose):
(WebKit::RemoteWCLayerTreeHostProxy::messageSenderDestinationID const):
(WebKit::RemoteWCLayerTreeHostProxy::update):
(WebKit::RemoteWCLayerTreeHostProxy::didUpdate):

  • WebProcess/GPU/graphics/wc/RemoteWCLayerTreeHostProxy.h: Added.

(WebKit::RemoteWCLayerTreeHostProxy::wcLayerTreeHostIdentifier const):

  • WebProcess/GPU/graphics/wc/RemoteWCLayerTreeHostProxy.messages.in: Added.
  • WebProcess/GPU/graphics/wc/WCLayerTreeHostIdentifier.h: Added.
  • WebProcess/GPU/graphics/wc/WCPlatformLayerGCGL.h: Added.

(WebKit::WCPlatformLayerGCGL::WCPlatformLayerGCGL):
(WebKit::WCPlatformLayerGCGL::graphicsContextGLIdentifier):

  • WebProcess/WebPage/DrawingArea.cpp:

(WebKit::DrawingArea::create):
(WebKit::DrawingArea::supportsGPUProcessRendering):

  • WebProcess/WebPage/DrawingArea.h:

(WebKit::DrawingArea::updateGeometry):

  • WebProcess/WebPage/DrawingArea.messages.in:
  • WebProcess/WebPage/wc/DrawingAreaWC.cpp: Added.

(WebKit::DrawingAreaWC::DrawingAreaWC):
(WebKit::DrawingAreaWC::~DrawingAreaWC):
(WebKit::DrawingAreaWC::graphicsLayerFactory):
(WebKit::DrawingAreaWC::updateRootLayers):
(WebKit::DrawingAreaWC::setRootCompositingLayer):
(WebKit::DrawingAreaWC::attachViewOverlayGraphicsLayer):
(WebKit::DrawingAreaWC::setLayerTreeStateIsFrozen):
(WebKit::DrawingAreaWC::updateGeometry):
(WebKit::DrawingAreaWC::setNeedsDisplay):
(WebKit::DrawingAreaWC::setNeedsDisplayInRect):
(WebKit::DrawingAreaWC::scroll):
(WebKit::DrawingAreaWC::triggerRenderingUpdate):
(WebKit::flushLayerImageBuffers):
(WebKit::DrawingAreaWC::isCompositingMode):
(WebKit::DrawingAreaWC::updateRendering):
(WebKit::DrawingAreaWC::sendUpdateAC):
(WebKit::shouldPaintBoundsRect):
(WebKit::DrawingAreaWC::sendUpdateNonAC):
(WebKit::DrawingAreaWC::graphicsLayerAdded):
(WebKit::DrawingAreaWC::graphicsLayerRemoved):
(WebKit::DrawingAreaWC::commitLayerUpateInfo):
(WebKit::DrawingAreaWC::createImageBuffer):
(WebKit::DrawingAreaWC::didUpdate):
(WebKit::DrawingAreaWC::RootLayerClient::RootLayerClient):
(WebKit::DrawingAreaWC::RootLayerClient::paintContents):
(WebKit::DrawingAreaWC::RootLayerClient::deviceScaleFactor const):

  • WebProcess/WebPage/wc/DrawingAreaWC.h: Added.
  • WebProcess/WebPage/wc/GraphicsLayerWC.cpp: Added.

(WebKit::GraphicsLayerWC::GraphicsLayerWC):
(WebKit::GraphicsLayerWC::~GraphicsLayerWC):
(WebKit::GraphicsLayerWC::generateLayerID):
(WebKit::GraphicsLayerWC::primaryLayerID const):
(WebKit::GraphicsLayerWC::setNeedsDisplay):
(WebKit::GraphicsLayerWC::setNeedsDisplayInRect):
(WebKit::GraphicsLayerWC::setContentsNeedsDisplay):
(WebKit::GraphicsLayerWC::setChildren):
(WebKit::GraphicsLayerWC::addChild):
(WebKit::GraphicsLayerWC::addChildAtIndex):
(WebKit::GraphicsLayerWC::addChildBelow):
(WebKit::GraphicsLayerWC::addChildAbove):
(WebKit::GraphicsLayerWC::replaceChild):
(WebKit::GraphicsLayerWC::removeFromParent):
(WebKit::GraphicsLayerWC::setMaskLayer):
(WebKit::GraphicsLayerWC::setReplicatedLayer):
(WebKit::GraphicsLayerWC::setReplicatedByLayer):
(WebKit::GraphicsLayerWC::setPosition):
(WebKit::GraphicsLayerWC::setAnchorPoint):
(WebKit::GraphicsLayerWC::setSize):
(WebKit::GraphicsLayerWC::setBoundsOrigin):
(WebKit::GraphicsLayerWC::setTransform):
(WebKit::GraphicsLayerWC::setChildrenTransform):
(WebKit::GraphicsLayerWC::setPreserves3D):
(WebKit::GraphicsLayerWC::setMasksToBounds):
(WebKit::GraphicsLayerWC::setOpacity):
(WebKit::GraphicsLayerWC::setContentsRect):
(WebKit::GraphicsLayerWC::setContentsClippingRect):
(WebKit::GraphicsLayerWC::setDrawsContent):
(WebKit::GraphicsLayerWC::setContentsVisible):
(WebKit::GraphicsLayerWC::setBackfaceVisibility):
(WebKit::GraphicsLayerWC::setContentsToSolidColor):
(WebKit::GraphicsLayerWC::setContentsToPlatformLayer):
(WebKit::GraphicsLayerWC::usesContentsLayer const):
(WebKit::GraphicsLayerWC::setShowDebugBorder):
(WebKit::GraphicsLayerWC::setDebugBorder):
(WebKit::GraphicsLayerWC::setShowRepaintCounter):
(WebKit::filtersCanBeComposited):
(WebKit::GraphicsLayerWC::setFilters):
(WebKit::GraphicsLayerWC::setBackdropFilters):
(WebKit::GraphicsLayerWC::setBackdropFiltersRect):
(WebKit::GraphicsLayerWC::noteLayerPropertyChanged):
(WebKit::GraphicsLayerWC::flushCompositingState):
(WebKit::GraphicsLayerWC::flushCompositingStateForThisLayerOnly):

  • WebProcess/WebPage/wc/GraphicsLayerWC.h: Added.
  • WebProcess/WebPage/wc/WCBackingStore.h: Added.

(WebKit::WCBackingStore::WCBackingStore):
(WebKit::WCBackingStore::imageBuffer):
(WebKit::WCBackingStore::setImageBuffer):
(WebKit::WCBackingStore::bitmap const):
(WebKit::WCBackingStore::encode const):
(WebKit::WCBackingStore::decode):

  • WebProcess/WebPage/wc/WCLayerFactory.cpp: Added.

(WebKit::WCLayerFactory::WCLayerFactory):
(WebKit::WCLayerFactory::createGraphicsLayer):

  • WebProcess/WebPage/wc/WCLayerFactory.h: Added.
  • WebProcess/WebPage/wc/WCUpateInfo.h: Added.

(WebKit::WCLayerUpateInfo::encode const):
(WebKit::WCLayerUpateInfo::decode):
(WebKit::WCUpateInfo::encode const):
(WebKit::WCUpateInfo::decode):

Location:
trunk
Files:
18 added
25 edited
12 copied

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r285026 r285099  
     12021-10-31  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [WinCairo] New GraphicsLayer for GPU process mode
     4        https://bugs.webkit.org/show_bug.cgi?id=228308
     5
     6        Reviewed by Don Olmstead.
     7
     8        * Source/cmake/OptionsWinCairo.cmake:
     9
    1102021-10-29  Oriol Brufau  <obrufau@igalia.com>
    211
  • trunk/Source/WebCore/ChangeLog

    r285098 r285099  
     12021-10-31  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [WinCairo] New GraphicsLayer for GPU process mode
     4        https://bugs.webkit.org/show_bug.cgi?id=228308
     5
     6        Reviewed by Don Olmstead.
     7
     8        * PlatformWinCairo.cmake:
     9        * platform/graphics/RemoteGraphicsContextGLProxyBase.cpp:
     10        * platform/graphics/RemoteGraphicsContextGLProxyBase.h:
     11        * platform/graphics/wc/RemoteGraphicsContextGLProxyBaseWC.cpp: Added.
     12        (WebCore::RemoteGraphicsContextGLProxyBase::platformInitialize):
     13        (WebCore::RemoteGraphicsContextGLProxyBase::platformLayer const):
     14        (WebCore::RemoteGraphicsContextGLProxyBase::setPlatformLayer):
     15        * platform/graphics/wc/WCPlatformLayer.h: Added.
     16        * platform/graphics/win/GraphicsContextWin.cpp:
     17        (WebCore::GraphicsContext::getWindowsContext): DisplayList
     18        GraphicsContext doesn't have a HDC. Do nothing for DisplayList
     19        context.
     20        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
     21        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
     22        Paint a frame by using GraphicsContext::drawNativeImage instead of
     23        Cairo API for DisplayList.
     24
    1252021-10-31  Cameron McCormack  <heycam@apple.com>
    226
  • trunk/Source/WebCore/PlatformWinCairo.cmake

    r283199 r285099  
    1313    "${WEBCORE_DIR}/loader/archive/cf"
    1414    "${WEBCORE_DIR}/platform/cf"
     15    "${WEBCORE_DIR}/platform/graphics/wc"
    1516)
    1617
     
    2425
    2526    platform/graphics/harfbuzz/DrawGlyphsRecorderHarfBuzz.cpp
     27
     28    platform/graphics/wc/RemoteGraphicsContextGLProxyBaseWC.cpp
    2629
    2730    platform/graphics/win/FontCustomPlatformDataCairo.cpp
     
    4346    platform/win/ImportedModulesEnumerator.cpp
    4447    platform/win/PEImage.cpp
     48)
     49
     50list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS
     51    platform/graphics/wc/WCPlatformLayer.h
    4552)
    4653
  • trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.cpp

    r284371 r285099  
    3232#if PLATFORM(COCOA)
    3333#include "IOSurface.h"
     34#endif
     35
     36#if USE(GRAPHICS_LAYER_WC)
     37#include "TextureMapperPlatformLayer.h"
    3438#endif
    3539
     
    131135}
    132136
    133 #if !PLATFORM(COCOA)
     137#if !PLATFORM(COCOA) && !USE(GRAPHICS_LAYER_WC)
    134138void RemoteGraphicsContextGLProxyBase::platformInitialize()
    135139{
  • trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.h

    r284371 r285099  
    9797    RetainPtr<WebGLLayer> m_webGLLayer;
    9898    std::unique_ptr<IOSurface> m_displayBuffer;
     99#elif USE(GRAPHICS_LAYER_WC)
     100    void setPlatformLayer(PlatformLayerContainer&&);
     101    PlatformLayerContainer m_platformLayer;
    99102#endif
    100103private:
  • trunk/Source/WebCore/platform/graphics/wc/WCPlatformLayer.h

    r285098 r285099  
    11/*
    2  * Copyright (C) 2020 Sony Interactive Entertainment Inc.
     2 * Copyright (C) 2021 Sony Interactive Entertainment Inc.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
    1414 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    1515 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    2424 */
    2525
    26 #include "config.h"
    27 #include "GPUProcessMain.h"
     26#pragma once
    2827
    29 #if ENABLE(GPU_PROCESS)
     28#include "TextureMapperPlatformLayer.h"
    3029
    31 #include "AuxiliaryProcessMain.h"
    32 #include "GPUProcess.h"
     30namespace WebCore {
    3331
    34 namespace WebKit {
     32class WCPlatformLayer : public TextureMapperPlatformLayer {
     33    WTF_MAKE_FAST_ALLOCATED;
    3534
    36 class GPUProcessMainWin final: public AuxiliaryProcessMainBaseNoSingleton<GPUProcess> {
     35private:
     36    // TextureMapperPlatformLayer
     37    void paintToTextureMapper(TextureMapper&, const FloatRect&, const TransformationMatrix&, float) final { }
    3738};
    3839
    39 int GPUProcessMain(int argc, char** argv)
    40 {
    41     return AuxiliaryProcessMain<GPUProcessMainWin>(argc, argv);
    42 }
    43 
    4440} // namespace WebKit
    45 
    46 #endif // ENABLE(GPU_PROCESS)
  • trunk/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp

    r284201 r285099  
    5454HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend)
    5555{
     56    if (!hasPlatformContext())
     57        return nullptr;
    5658    HDC hdc = nullptr;
    5759#if !USE(CAIRO)
  • trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp

    r284439 r285099  
    28582858
    28592859        cairo_surface_t* image = nullptr;
    2860         if (cairoFormat != CAIRO_FORMAT_INVALID)
    2861             image = cairo_image_surface_create_for_data(static_cast<unsigned char*>(data), cairoFormat, width, height, pitch);
    2862 
    2863         FloatRect srcRect(0, 0, width, height);
    2864         if (image) {
    2865             ASSERT(context.hasPlatformContext());
    2866             auto& state = context.state();
    2867             Cairo::drawSurface(*context.platformContext(), image, destRect, srcRect, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state));
    2868             cairo_surface_destroy(image);
     2860        if (cairoFormat != CAIRO_FORMAT_INVALID) {
     2861            auto surface = adoptRef(cairo_image_surface_create_for_data(static_cast<unsigned char*>(data), cairoFormat, width, height, pitch));
     2862            auto image = NativeImage::create(WTFMove(surface));
     2863            FloatRect srcRect(0, 0, width, height);
     2864            context.drawNativeImage(*image, srcRect.size(), destRect, srcRect);
    28692865        }
    28702866#else
  • trunk/Source/WebKit/ChangeLog

    r285094 r285099  
     12021-10-31  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [WinCairo] New GraphicsLayer for GPU process mode
     4        https://bugs.webkit.org/show_bug.cgi?id=228308
     5
     6        Reviewed by Don Olmstead.
     7
     8        Added a new GraphicsLayer implementation GraphicsLayerWC which
     9        transfers GraphicsLayer tree to GPU process and runs the
     10        compositor (TextureMapper) in GPU process.
     11
     12        In GPU process mode, WebGL is run in GPU process. So, the
     13        compositor should be run in GPU process. Otherwise, the output
     14        texture of WebGL has to be transferred from GPU process to the
     15        compositor process (UI process or web process).
     16
     17        Because ANGLE isn't thread-safe, the compositor and WebGL should
     18        be run in the same thread in GPU process.
     19
     20        Enabling gpu_process_webgl also enables GPU process compositing now.
     21        > reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_webgl /t REG_DWORD /d 1 /f
     22
     23        gpu_process_canvas_rendering can also be enabled.
     24        > reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_canvas_rendering /t REG_DWORD /d 1 /f
     25
     26        Enabling gpu_process_dom_rendering is still experimental.
     27        > reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_dom_rendering /t REG_DWORD /d 1 /f
     28
     29        The following commands restore the non-GPU process mode.
     30        > reg delete HKEY_CURRENT_USER\Software\WebKit /v gpu_process_canvas_rendering /f
     31        > reg delete HKEY_CURRENT_USER\Software\WebKit /v gpu_process_webgl /f
     32        > reg delete HKEY_CURRENT_USER\Software\WebKit /v gpu_process_dom_rendering /f
     33
     34        * GPUProcess/GPUConnectionToWebProcess.cpp:
     35        (WebKit::GPUConnectionToWebProcess::createWCLayerTreeHost):
     36        (WebKit::GPUConnectionToWebProcess::releaseWCLayerTreeHost):
     37        (WebKit::GPUConnectionToWebProcess::findRemoteGraphicsContextGL):
     38        * GPUProcess/GPUConnectionToWebProcess.h:
     39        * GPUProcess/GPUConnectionToWebProcess.messages.in:
     40        * GPUProcess/GPUProcess.h:
     41        (WebKit::GPUProcess::sharedSceneContext):
     42        * GPUProcess/graphics/RemoteGraphicsContextGL.h:
     43        (WebKit::RemoteGraphicsContextGL::platformLayer const):
     44        * GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.cpp:
     45        (WebKit::ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources):
     46        * GPUProcess/graphics/wc/RemoteWCLayerTreeHost.cpp: Added.
     47        (WebKit::RemoteWCLayerTreeHost::create):
     48        (WebKit::RemoteWCLayerTreeHost::RemoteWCLayerTreeHost):
     49        (WebKit::RemoteWCLayerTreeHost::~RemoteWCLayerTreeHost):
     50        (WebKit::RemoteWCLayerTreeHost::messageSenderConnection const):
     51        (WebKit::RemoteWCLayerTreeHost::messageSenderDestinationID const):
     52        (WebKit::RemoteWCLayerTreeHost::update):
     53        * GPUProcess/graphics/wc/RemoteWCLayerTreeHost.h: Added.
     54        * GPUProcess/graphics/wc/RemoteWCLayerTreeHost.messages.in: Added.
     55        * GPUProcess/graphics/wc/WCScene.cpp: Added.
     56        (WebKit::WCScene::initialize):
     57        (WebKit::WCScene::~WCScene):
     58        (WebKit::WCScene::update):
     59        * GPUProcess/graphics/wc/WCScene.h: Added.
     60        * GPUProcess/graphics/wc/WCSceneContext.cpp: Added.
     61        (WebKit::WCSceneContext::WCSceneContext):
     62        (WebKit::WCSceneContext::makeContextCurrent):
     63        (WebKit::WCSceneContext::createTextureMapper):
     64        (WebKit::WCSceneContext::swapBuffers):
     65        * GPUProcess/graphics/wc/WCSceneContext.h: Added.
     66        * GPUProcess/graphics/wc/WCSharedSceneContextHolder.h: Added.
     67        (WebKit::WCSharedSceneContextHolder::ensureHolderForWindow):
     68        (WebKit::WCSharedSceneContextHolder::removeHolder):
     69        * GPUProcess/win/GPUProcessMainWin.cpp:
     70        (WebKit::GPUProcessMain):
     71        * PlatformWin.cmake:
     72        * Scripts/webkit/messages.py:
     73        (types_that_cannot_be_forward_declared):
     74        (conditions_for_header):
     75        * Shared/DrawingAreaInfo.h:
     76        * UIProcess/wc/DrawingAreaProxyWC.cpp: Added.
     77        (WebKit::DrawingAreaProxyWC::DrawingAreaProxyWC):
     78        (WebKit::DrawingAreaProxyWC::paint):
     79        (WebKit::DrawingAreaProxyWC::sizeDidChange):
     80        (WebKit::DrawingAreaProxyWC::update):
     81        (WebKit::DrawingAreaProxyWC::enterAcceleratedCompositingMode):
     82        (WebKit::DrawingAreaProxyWC::incorporateUpdate):
     83        (WebKit::DrawingAreaProxyWC::discardBackingStore):
     84        * UIProcess/wc/DrawingAreaProxyWC.h: Added.
     85        * UIProcess/win/PageClientImpl.cpp:
     86        (WebKit::PageClientImpl::createDrawingAreaProxy):
     87        * UIProcess/win/WebView.cpp:
     88        (WebKit::WebView::paint):
     89        * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
     90        (WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
     91        * WebProcess/GPU/graphics/wc/RemoteWCLayerTreeHostProxy.cpp: Added.
     92        (WebKit::RemoteWCLayerTreeHostProxy::RemoteWCLayerTreeHostProxy):
     93        (WebKit::RemoteWCLayerTreeHostProxy::~RemoteWCLayerTreeHostProxy):
     94        (WebKit::RemoteWCLayerTreeHostProxy::messageSenderConnection const):
     95        (WebKit::RemoteWCLayerTreeHostProxy::ensureGPUProcessConnection):
     96        (WebKit::RemoteWCLayerTreeHostProxy::disconnectGpuProcessIfNeeded):
     97        (WebKit::RemoteWCLayerTreeHostProxy::gpuProcessConnectionDidClose):
     98        (WebKit::RemoteWCLayerTreeHostProxy::messageSenderDestinationID const):
     99        (WebKit::RemoteWCLayerTreeHostProxy::update):
     100        (WebKit::RemoteWCLayerTreeHostProxy::didUpdate):
     101        * WebProcess/GPU/graphics/wc/RemoteWCLayerTreeHostProxy.h: Added.
     102        (WebKit::RemoteWCLayerTreeHostProxy::wcLayerTreeHostIdentifier const):
     103        * WebProcess/GPU/graphics/wc/RemoteWCLayerTreeHostProxy.messages.in: Added.
     104        * WebProcess/GPU/graphics/wc/WCLayerTreeHostIdentifier.h: Added.
     105        * WebProcess/GPU/graphics/wc/WCPlatformLayerGCGL.h: Added.
     106        (WebKit::WCPlatformLayerGCGL::WCPlatformLayerGCGL):
     107        (WebKit::WCPlatformLayerGCGL::graphicsContextGLIdentifier):
     108        * WebProcess/WebPage/DrawingArea.cpp:
     109        (WebKit::DrawingArea::create):
     110        (WebKit::DrawingArea::supportsGPUProcessRendering):
     111        * WebProcess/WebPage/DrawingArea.h:
     112        (WebKit::DrawingArea::updateGeometry):
     113        * WebProcess/WebPage/DrawingArea.messages.in:
     114        * WebProcess/WebPage/wc/DrawingAreaWC.cpp: Added.
     115        (WebKit::DrawingAreaWC::DrawingAreaWC):
     116        (WebKit::DrawingAreaWC::~DrawingAreaWC):
     117        (WebKit::DrawingAreaWC::graphicsLayerFactory):
     118        (WebKit::DrawingAreaWC::updateRootLayers):
     119        (WebKit::DrawingAreaWC::setRootCompositingLayer):
     120        (WebKit::DrawingAreaWC::attachViewOverlayGraphicsLayer):
     121        (WebKit::DrawingAreaWC::setLayerTreeStateIsFrozen):
     122        (WebKit::DrawingAreaWC::updateGeometry):
     123        (WebKit::DrawingAreaWC::setNeedsDisplay):
     124        (WebKit::DrawingAreaWC::setNeedsDisplayInRect):
     125        (WebKit::DrawingAreaWC::scroll):
     126        (WebKit::DrawingAreaWC::triggerRenderingUpdate):
     127        (WebKit::flushLayerImageBuffers):
     128        (WebKit::DrawingAreaWC::isCompositingMode):
     129        (WebKit::DrawingAreaWC::updateRendering):
     130        (WebKit::DrawingAreaWC::sendUpdateAC):
     131        (WebKit::shouldPaintBoundsRect):
     132        (WebKit::DrawingAreaWC::sendUpdateNonAC):
     133        (WebKit::DrawingAreaWC::graphicsLayerAdded):
     134        (WebKit::DrawingAreaWC::graphicsLayerRemoved):
     135        (WebKit::DrawingAreaWC::commitLayerUpateInfo):
     136        (WebKit::DrawingAreaWC::createImageBuffer):
     137        (WebKit::DrawingAreaWC::didUpdate):
     138        (WebKit::DrawingAreaWC::RootLayerClient::RootLayerClient):
     139        (WebKit::DrawingAreaWC::RootLayerClient::paintContents):
     140        (WebKit::DrawingAreaWC::RootLayerClient::deviceScaleFactor const):
     141        * WebProcess/WebPage/wc/DrawingAreaWC.h: Added.
     142        * WebProcess/WebPage/wc/GraphicsLayerWC.cpp: Added.
     143        (WebKit::GraphicsLayerWC::GraphicsLayerWC):
     144        (WebKit::GraphicsLayerWC::~GraphicsLayerWC):
     145        (WebKit::GraphicsLayerWC::generateLayerID):
     146        (WebKit::GraphicsLayerWC::primaryLayerID const):
     147        (WebKit::GraphicsLayerWC::setNeedsDisplay):
     148        (WebKit::GraphicsLayerWC::setNeedsDisplayInRect):
     149        (WebKit::GraphicsLayerWC::setContentsNeedsDisplay):
     150        (WebKit::GraphicsLayerWC::setChildren):
     151        (WebKit::GraphicsLayerWC::addChild):
     152        (WebKit::GraphicsLayerWC::addChildAtIndex):
     153        (WebKit::GraphicsLayerWC::addChildBelow):
     154        (WebKit::GraphicsLayerWC::addChildAbove):
     155        (WebKit::GraphicsLayerWC::replaceChild):
     156        (WebKit::GraphicsLayerWC::removeFromParent):
     157        (WebKit::GraphicsLayerWC::setMaskLayer):
     158        (WebKit::GraphicsLayerWC::setReplicatedLayer):
     159        (WebKit::GraphicsLayerWC::setReplicatedByLayer):
     160        (WebKit::GraphicsLayerWC::setPosition):
     161        (WebKit::GraphicsLayerWC::setAnchorPoint):
     162        (WebKit::GraphicsLayerWC::setSize):
     163        (WebKit::GraphicsLayerWC::setBoundsOrigin):
     164        (WebKit::GraphicsLayerWC::setTransform):
     165        (WebKit::GraphicsLayerWC::setChildrenTransform):
     166        (WebKit::GraphicsLayerWC::setPreserves3D):
     167        (WebKit::GraphicsLayerWC::setMasksToBounds):
     168        (WebKit::GraphicsLayerWC::setOpacity):
     169        (WebKit::GraphicsLayerWC::setContentsRect):
     170        (WebKit::GraphicsLayerWC::setContentsClippingRect):
     171        (WebKit::GraphicsLayerWC::setDrawsContent):
     172        (WebKit::GraphicsLayerWC::setContentsVisible):
     173        (WebKit::GraphicsLayerWC::setBackfaceVisibility):
     174        (WebKit::GraphicsLayerWC::setContentsToSolidColor):
     175        (WebKit::GraphicsLayerWC::setContentsToPlatformLayer):
     176        (WebKit::GraphicsLayerWC::usesContentsLayer const):
     177        (WebKit::GraphicsLayerWC::setShowDebugBorder):
     178        (WebKit::GraphicsLayerWC::setDebugBorder):
     179        (WebKit::GraphicsLayerWC::setShowRepaintCounter):
     180        (WebKit::filtersCanBeComposited):
     181        (WebKit::GraphicsLayerWC::setFilters):
     182        (WebKit::GraphicsLayerWC::setBackdropFilters):
     183        (WebKit::GraphicsLayerWC::setBackdropFiltersRect):
     184        (WebKit::GraphicsLayerWC::noteLayerPropertyChanged):
     185        (WebKit::GraphicsLayerWC::flushCompositingState):
     186        (WebKit::GraphicsLayerWC::flushCompositingStateForThisLayerOnly):
     187        * WebProcess/WebPage/wc/GraphicsLayerWC.h: Added.
     188        * WebProcess/WebPage/wc/WCBackingStore.h: Added.
     189        (WebKit::WCBackingStore::WCBackingStore):
     190        (WebKit::WCBackingStore::imageBuffer):
     191        (WebKit::WCBackingStore::setImageBuffer):
     192        (WebKit::WCBackingStore::bitmap const):
     193        (WebKit::WCBackingStore::encode const):
     194        (WebKit::WCBackingStore::decode):
     195        * WebProcess/WebPage/wc/WCLayerFactory.cpp: Added.
     196        (WebKit::WCLayerFactory::WCLayerFactory):
     197        (WebKit::WCLayerFactory::createGraphicsLayer):
     198        * WebProcess/WebPage/wc/WCLayerFactory.h: Added.
     199        * WebProcess/WebPage/wc/WCUpateInfo.h: Added.
     200        (WebKit::WCLayerUpateInfo::encode const):
     201        (WebKit::WCLayerUpateInfo::decode):
     202        (WebKit::WCUpateInfo::encode const):
     203        (WebKit::WCUpateInfo::decode):
     204
    12052021-10-31  Simon Fraser  <simon.fraser@apple.com>
    2206
  • trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp

    r284786 r285099  
    144144#endif
    145145
     146#if USE(GRAPHICS_LAYER_WC)
     147#include "RemoteWCLayerTreeHost.h"
     148#endif
     149
    146150namespace WebKit {
    147151using namespace WebCore;
     
    337341}
    338342
     343#if USE(GRAPHICS_LAYER_WC)
     344void GPUConnectionToWebProcess::createWCLayerTreeHost(WebKit::WCLayerTreeHostIdentifier identifier, uint64_t nativeWindow)
     345{
     346    auto addResult = m_remoteWCLayerTreeHostMap.add(identifier, RemoteWCLayerTreeHost::create(*this, WTFMove(identifier), nativeWindow));
     347    ASSERT_UNUSED(addResult, addResult.isNewEntry);
     348}
     349
     350void GPUConnectionToWebProcess::releaseWCLayerTreeHost(WebKit::WCLayerTreeHostIdentifier identifier)
     351{
     352    m_remoteWCLayerTreeHostMap.remove(identifier);
     353}
     354
     355RefPtr<RemoteGraphicsContextGL> GPUConnectionToWebProcess::findRemoteGraphicsContextGL(GraphicsContextGLIdentifier identifier)
     356{
     357    ASSERT(RunLoop::isMain());
     358    auto iter = m_remoteGraphicsContextGLMap.find(identifier);
     359    if (iter == m_remoteGraphicsContextGLMap.end())
     360        return nullptr;
     361    return iter->value.get();
     362}
     363#endif
     364
    339365bool GPUConnectionToWebProcess::allowsExitUnderMemoryPressure() const
    340366{
  • trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h

    r284786 r285099  
    5656#if PLATFORM(COCOA)
    5757#include <pal/spi/cocoa/TCCSPI.h>
     58#endif
     59
     60#if USE(GRAPHICS_LAYER_WC)
     61#include "WCLayerTreeHostIdentifier.h"
    5862#endif
    5963
     
    9296struct RemoteRenderingBackendCreationParameters;
    9397
     98#if USE(GRAPHICS_LAYER_WC)
     99class RemoteWCLayerTreeHost;
     100#endif
     101
    94102class GPUConnectionToWebProcess
    95103    : public ThreadSafeRefCounted<GPUConnectionToWebProcess, WTF::DestructionThread::Main>
     
    162170#endif
    163171
     172#if USE(GRAPHICS_LAYER_WC)
     173    RefPtr<RemoteGraphicsContextGL> findRemoteGraphicsContextGL(GraphicsContextGLIdentifier);
     174#endif
     175
    164176    void updateSupportedRemoteCommands();
    165177
     
    229241    void configureLoggingChannel(const String&, WTFLogChannelState, WTFLogLevel);
    230242
     243#if USE(GRAPHICS_LAYER_WC)
     244    void createWCLayerTreeHost(WebKit::WCLayerTreeHostIdentifier, uint64_t nativeWindow);
     245    void releaseWCLayerTreeHost(WebKit::WCLayerTreeHostIdentifier);
     246#endif
     247
    231248    // IPC::Connection::Client
    232249    void didClose(IPC::Connection&) final;
     
    310327    RemoteAudioHardwareListenerMap m_remoteAudioHardwareListenerMap;
    311328
     329#if USE(GRAPHICS_LAYER_WC)
     330    using RemoteWCLayerTreeHostMap = HashMap<WCLayerTreeHostIdentifier, std::unique_ptr<RemoteWCLayerTreeHost>>;
     331    RemoteWCLayerTreeHostMap m_remoteWCLayerTreeHostMap;
     332#endif
     333
    312334    RefPtr<RemoteRemoteCommandListenerProxy> m_remoteRemoteCommandListener;
    313335    bool m_isActiveNowPlayingProcess { false };
  • trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in

    r284079 r285099  
    5252    SetUserPreferredLanguages(Vector<String> languages)
    5353    ConfigureLoggingChannel(String channelName, enum:uint8_t WTFLogChannelState state, enum:uint8_t WTFLogLevel level)
     54#if USE(GRAPHICS_LAYER_WC)
     55    CreateWCLayerTreeHost(WebKit::WCLayerTreeHostIdentifier identifier, uint64_t nativeWindow)
     56    ReleaseWCLayerTreeHost(WebKit::WCLayerTreeHostIdentifier identifier)
     57#endif
    5458}
    5559
  • trunk/Source/WebKit/GPUProcess/GPUProcess.h

    r284786 r285099  
    4343#endif
    4444
     45#if USE(GRAPHICS_LAYER_WC)
     46#include "WCSharedSceneContextHolder.h"
     47#endif
     48
    4549namespace WebCore {
    4650class NowPlayingManager;
     
    9195#if USE(LIBWEBRTC) && PLATFORM(COCOA)
    9296    WorkQueue& libWebRTCCodecsQueue();
     97#endif
     98
     99#if USE(GRAPHICS_LAYER_WC)
     100    WCSharedSceneContextHolder& sharedSceneContext() { return m_sharedSceneContext; }
    93101#endif
    94102
     
    187195#endif
    188196
     197#if USE(GRAPHICS_LAYER_WC)
     198    WCSharedSceneContextHolder m_sharedSceneContext;
     199#endif
     200
    189201    struct GPUSession {
    190202        String mediaCacheDirectory;
  • trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h

    r284371 r285099  
    6868#endif
    6969
     70#if USE(GRAPHICS_LAYER_WC)
     71    PlatformLayer* platformLayer() const { return m_context->platformLayer(); }
     72#endif
     73
    7074protected:
    7175    RemoteGraphicsContextGL(GPUConnectionToWebProcess&, GraphicsContextGLIdentifier, RemoteRenderingBackend&, IPC::StreamConnectionBuffer&&);
  • trunk/Source/WebKit/GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.cpp

    r283703 r285099  
    4343void ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources()
    4444{
     45#if !USE(GRAPHICS_LAYER_WC)
    4546    if (didScheduleFreeWebGLRenderingResources)
    4647        return;
    4748    RunLoop::main().dispatchAfter(freeWebGLRenderingResourcesTimeout, freeWebGLRenderingResources);
    4849    didScheduleFreeWebGLRenderingResources = true;
     50#endif
    4951}
    5052
  • trunk/Source/WebKit/GPUProcess/graphics/wc/RemoteWCLayerTreeHost.h

    r285098 r285099  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2021 Sony Interactive Entertainment Inc.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626#pragma once
    2727
    28 #include <wtf/EnumTraits.h>
    29 #include <wtf/ObjectIdentifier.h>
     28#if USE(GRAPHICS_LAYER_WC)
     29
     30#include "Connection.h"
     31#include "MessageReceiver.h"
     32#include "MessageSender.h"
     33#include "WCLayerTreeHostIdentifier.h"
     34#include "WCSharedSceneContextHolder.h"
    3035
    3136namespace WebKit {
     37class GPUConnectionToWebProcess;
     38class WCScene;
     39struct WCUpateInfo;
    3240
    33 enum class DrawingAreaType : uint8_t {
    34 #if PLATFORM(COCOA)
    35 #if !PLATFORM(IOS_FAMILY)
    36     TiledCoreAnimation,
    37 #endif
    38     RemoteLayerTree,
    39 #elif USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
    40     CoordinatedGraphics
    41 #endif
     41class RemoteWCLayerTreeHost : public IPC::MessageReceiver, private IPC::MessageSender {
     42    WTF_MAKE_FAST_ALLOCATED;
     43public:
     44    static std::unique_ptr<RemoteWCLayerTreeHost> create(GPUConnectionToWebProcess&, WebKit::WCLayerTreeHostIdentifier, uint64_t nativeWindow);
     45    RemoteWCLayerTreeHost(GPUConnectionToWebProcess&, WebKit::WCLayerTreeHostIdentifier, uint64_t nativeWindow);
     46    ~RemoteWCLayerTreeHost();
     47    // message handlers
     48    void update(WCUpateInfo&&);
     49
     50private:
     51    // IPC::MessageReceiver
     52    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
     53    // IPC::MessageSender
     54    IPC::Connection* messageSenderConnection() const override;
     55    uint64_t messageSenderDestinationID() const override;
     56
     57    WeakPtr<GPUConnectionToWebProcess> m_connectionToWebProcess;
     58    WCLayerTreeHostIdentifier m_identifier;
     59    RefPtr<WCSharedSceneContextHolder::Holder> m_sharedSceneContextHolder;
     60    std::unique_ptr<WCScene> m_scene;
    4261};
    43    
    44 enum {
    45     ActivityStateChangeAsynchronous = 0
    46 };
    47 typedef uint64_t ActivityStateChangeID;
    48 
    49 enum DrawingAreaIdentifierType { };
    50 using DrawingAreaIdentifier = ObjectIdentifier<DrawingAreaIdentifierType>;
    5162
    5263} // namespace WebKit
    5364
    54 namespace WTF {
    55 
    56 template<> struct EnumTraits<WebKit::DrawingAreaType> {
    57     using values = EnumValues<
    58         WebKit::DrawingAreaType
    59 #if PLATFORM(COCOA)
    60 #if !PLATFORM(IOS_FAMILY)
    61         , WebKit::DrawingAreaType::TiledCoreAnimation
    62 #endif
    63         , WebKit::DrawingAreaType::RemoteLayerTree
    64 #elif USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
    65         , WebKit::DrawingAreaType::CoordinatedGraphics
    66 #endif
    67     >;
    68 };
    69 
    70 } // namespace WTF
     65#endif // USE(GRAPHICS_LAYER_WC)
  • trunk/Source/WebKit/GPUProcess/graphics/wc/RemoteWCLayerTreeHost.messages.in

    r285098 r285099  
    1 # Copyright (C) 2010-2018 Apple Inc. All rights reserved.
     1# Copyright (C) 2021 Sony Interactive Entertainment Inc.
    22#
    33# Redistribution and use in source and binary forms, with or without
     
    2121# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2222
    23 messages -> DrawingArea NotRefCounted {
    24 #if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
    25     UpdateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, WebCore::IntSize size, WebCore::IntSize scrollOffset)
    26 #endif
     23#if USE(GRAPHICS_LAYER_WC)
    2724
    28     DidUpdate()
     25messages -> RemoteWCLayerTreeHost NotRefCounted {
     26    Update(struct WebKit::WCUpateInfo updateInfo)
     27}
    2928
    30 #if PLATFORM(COCOA)
    31     // Used by TiledCoreAnimationDrawingArea.
    32     UpdateGeometry(WebCore::IntSize viewSize, bool flushSynchronously, MachSendRight fencePort)
    33     SetDeviceScaleFactor(float deviceScaleFactor)
    34     SetColorSpace(struct std::optional<WebCore::DestinationColorSpace> colorSpace)
    35     SetViewExposedRect(std::optional<WebCore::FloatRect> viewExposedRect)
    36 
    37     AcceleratedAnimationDidStart(uint64_t layerID, String key, MonotonicTime startTime)
    38     AcceleratedAnimationDidEnd(uint64_t layerID, String key)
    39    
    40     AddTransactionCallbackID(WebKit::CallbackID callbackID)
    41 #endif
    42 
    43 #if PLATFORM(COCOA) || PLATFORM(GTK)
    44     AdjustTransientZoom(double scale, WebCore::FloatPoint origin)
    45     CommitTransientZoom(double scale, WebCore::FloatPoint origin)
    46 #endif
    47 }
     29#endif // USE(GRAPHICS_LAYER_WC)
  • trunk/Source/WebKit/GPUProcess/graphics/wc/WCScene.h

    r285098 r285099  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2021 Sony Interactive Entertainment Inc.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626#pragma once
    2727
    28 #include <wtf/EnumTraits.h>
    29 #include <wtf/ObjectIdentifier.h>
     28#if USE(GRAPHICS_LAYER_WC)
     29
     30#include <WebCore/TextureMapperFPSCounter.h>
     31#include <wtf/Forward.h>
     32#include <wtf/HashMap.h>
     33
     34namespace WebCore {
     35class TextureMapper;
     36class TextureMapperLayer;
     37class TextureMapperTiledBackingStore;
     38}
    3039
    3140namespace WebKit {
    3241
    33 enum class DrawingAreaType : uint8_t {
    34 #if PLATFORM(COCOA)
    35 #if !PLATFORM(IOS_FAMILY)
    36     TiledCoreAnimation,
    37 #endif
    38     RemoteLayerTree,
    39 #elif USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
    40     CoordinatedGraphics
    41 #endif
     42class RemoteGraphicsContextGL;
     43class WCSceneContext;
     44struct WCUpateInfo;
     45
     46class WCScene {
     47    WTF_MAKE_FAST_ALLOCATED;
     48public:
     49    WCScene();
     50    ~WCScene();
     51    void initialize(WCSceneContext&);
     52    void update(WCUpateInfo&&, Vector<RefPtr<RemoteGraphicsContextGL>>&&);
     53
     54private:
     55    struct Layer;
     56    using LayerMap = HashMap<uint64_t, std::unique_ptr<Layer>>;
     57
     58    WCSceneContext* m_context { nullptr };
     59    std::unique_ptr<WebCore::TextureMapper> m_textureMapper;
     60    WebCore::TextureMapperFPSCounter m_fpsCounter;
     61    LayerMap m_layers;
    4262};
    43    
    44 enum {
    45     ActivityStateChangeAsynchronous = 0
    46 };
    47 typedef uint64_t ActivityStateChangeID;
    48 
    49 enum DrawingAreaIdentifierType { };
    50 using DrawingAreaIdentifier = ObjectIdentifier<DrawingAreaIdentifierType>;
    5163
    5264} // namespace WebKit
    5365
    54 namespace WTF {
    55 
    56 template<> struct EnumTraits<WebKit::DrawingAreaType> {
    57     using values = EnumValues<
    58         WebKit::DrawingAreaType
    59 #if PLATFORM(COCOA)
    60 #if !PLATFORM(IOS_FAMILY)
    61         , WebKit::DrawingAreaType::TiledCoreAnimation
    62 #endif
    63         , WebKit::DrawingAreaType::RemoteLayerTree
    64 #elif USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
    65         , WebKit::DrawingAreaType::CoordinatedGraphics
    66 #endif
    67     >;
    68 };
    69 
    70 } // namespace WTF
     66#endif // USE(GRAPHICS_LAYER_WC)
  • trunk/Source/WebKit/GPUProcess/graphics/wc/WCSceneContext.cpp

    r285098 r285099  
    11/*
    2  * Copyright (C) 2020 Sony Interactive Entertainment Inc.
     2 * Copyright (C) 2021 Sony Interactive Entertainment Inc.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
    1414 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    1515 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    2525
    2626#include "config.h"
    27 #include "GPUProcessMain.h"
     27#include "WCSceneContext.h"
    2828
    29 #if ENABLE(GPU_PROCESS)
     29#if USE(GRAPHICS_LAYER_WC)
    3030
    31 #include "AuxiliaryProcessMain.h"
    32 #include "GPUProcess.h"
     31#include <WebCore/GLContext.h>
     32#include <WebCore/TextureMapperGL.h>
    3333
    3434namespace WebKit {
    3535
    36 class GPUProcessMainWin final: public AuxiliaryProcessMainBaseNoSingleton<GPUProcess> {
    37 };
     36WCSceneContext::WCSceneContext(uint64_t nativeWindow)
     37{
     38    m_glContext = WebCore::GLContext::createContextForWindow(reinterpret_cast<GLNativeWindowType>(nativeWindow));
     39}
    3840
    39 int GPUProcessMain(int argc, char** argv)
     41WCSceneContext::~WCSceneContext() = default;
     42
     43bool WCSceneContext::makeContextCurrent()
    4044{
    41     return AuxiliaryProcessMain<GPUProcessMainWin>(argc, argv);
     45    return m_glContext->makeContextCurrent();
     46}
     47
     48std::unique_ptr<WebCore::TextureMapper> WCSceneContext::createTextureMapper()
     49{
     50    return WebCore::TextureMapperGL::create();
     51}
     52
     53void WCSceneContext::swapBuffers()
     54{
     55    m_glContext->swapBuffers();
    4256}
    4357
    4458} // namespace WebKit
    4559
    46 #endif // ENABLE(GPU_PROCESS)
     60#endif // USE(GRAPHICS_LAYER_WC)
  • trunk/Source/WebKit/GPUProcess/graphics/wc/WCSceneContext.h

    r285098 r285099  
    11/*
    2  * Copyright (C) 2020 Sony Interactive Entertainment Inc.
     2 * Copyright (C) 2021 Sony Interactive Entertainment Inc.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
    1414 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    1515 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    2424 */
    2525
    26 #include "config.h"
    27 #include "GPUProcessMain.h"
     26#pragma once
    2827
    29 #if ENABLE(GPU_PROCESS)
     28#if USE(GRAPHICS_LAYER_WC)
    3029
    31 #include "AuxiliaryProcessMain.h"
    32 #include "GPUProcess.h"
     30#include <wtf/FastMalloc.h>
     31
     32namespace WebCore {
     33class GLContext;
     34class TextureMapper;
     35}
    3336
    3437namespace WebKit {
    3538
    36 class GPUProcessMainWin final: public AuxiliaryProcessMainBaseNoSingleton<GPUProcess> {
     39class WCSceneContext {
     40    WTF_MAKE_FAST_ALLOCATED;
     41public:
     42    explicit WCSceneContext(uint64_t nativeWindow);
     43    ~WCSceneContext();
     44
     45    bool makeContextCurrent();
     46    std::unique_ptr<WebCore::TextureMapper> createTextureMapper();
     47    void swapBuffers();
     48
     49private:
     50    std::unique_ptr<WebCore::GLContext> m_glContext;
    3751};
    38 
    39 int GPUProcessMain(int argc, char** argv)
    40 {
    41     return AuxiliaryProcessMain<GPUProcessMainWin>(argc, argv);
    42 }
    4352
    4453} // namespace WebKit
    4554
    46 #endif // ENABLE(GPU_PROCESS)
     55#endif // USE(GRAPHICS_LAYER_WC)
  • trunk/Source/WebKit/GPUProcess/win/GPUProcessMainWin.cpp

    r271563 r285099  
    3131#include "AuxiliaryProcessMain.h"
    3232#include "GPUProcess.h"
     33#include <Objbase.h>
     34#include <wtf/win/SoftLinking.h>
     35
     36SOFT_LINK_LIBRARY(user32);
     37SOFT_LINK_OPTIONAL(user32, SetProcessDpiAwarenessContext, BOOL, STDAPICALLTYPE, (DPI_AWARENESS_CONTEXT));
    3338
    3439namespace WebKit {
    3540
    3641class GPUProcessMainWin final: public AuxiliaryProcessMainBaseNoSingleton<GPUProcess> {
     42public:
     43    bool platformInitialize() override
     44    {
     45        if (SetProcessDpiAwarenessContextPtr())
     46            SetProcessDpiAwarenessContextPtr()(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
     47        else
     48            SetProcessDPIAware();
     49        return true;
     50    }
    3751};
    3852
    3953int GPUProcessMain(int argc, char** argv)
    4054{
     55    // for DirectX
     56    HRESULT hr = ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
     57    RELEASE_ASSERT(SUCCEEDED(hr));
    4158    return AuxiliaryProcessMain<GPUProcessMainWin>(argc, argv);
    4259}
  • trunk/Source/WebKit/PlatformWin.cmake

    r285047 r285099  
    1111list(APPEND WebKit_SOURCES
    1212    GPUProcess/graphics/RemoteGraphicsContextGLWin.cpp
     13
     14    GPUProcess/graphics/wc/RemoteWCLayerTreeHost.cpp
     15    GPUProcess/graphics/wc/WCScene.cpp
     16    GPUProcess/graphics/wc/WCSceneContext.cpp
    1317
    1418    GPUProcess/media/win/RemoteMediaPlayerProxyWin.cpp
     
    7074    UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp
    7175
     76    UIProcess/wc/DrawingAreaProxyWC.cpp
     77
    7278    UIProcess/win/PageClientImpl.cpp
    7379    UIProcess/win/WebContextMenuProxyWin.cpp
     
    7783    UIProcess/win/WebView.cpp
    7884
     85    WebProcess/GPU/graphics/wc/RemoteWCLayerTreeHostProxy.cpp
     86
    7987    WebProcess/GPU/media/win/VideoLayerRemoteWin.cpp
    8088
     
    93101    WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp
    94102
     103    WebProcess/WebPage/wc/DrawingAreaWC.cpp
     104    WebProcess/WebPage/wc/GraphicsLayerWC.cpp
     105    WebProcess/WebPage/wc/WCLayerFactory.cpp
     106
    95107    WebProcess/WebPage/win/WebPageWin.cpp
    96108
     
    100112
    101113list(APPEND WebKit_INCLUDE_DIRECTORIES
     114    "${WEBKIT_DIR}/GPUProcess/graphics/wc"
    102115    "${WEBKIT_DIR}/Platform/classifier"
    103116    "${WEBKIT_DIR}/Platform/generic"
     
    117130    "${WEBKIT_DIR}/UIProcess/Inspector/win"
    118131    "${WEBKIT_DIR}/UIProcess/Plugins/win"
     132    "${WEBKIT_DIR}/UIProcess/wc"
    119133    "${WEBKIT_DIR}/UIProcess/win"
     134    "${WEBKIT_DIR}/WebProcess/GPU/graphics/wc"
    120135    "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/win"
    121136    "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/win/DOM"
     
    123138    "${WEBKIT_DIR}/WebProcess/WebCoreSupport/win"
    124139    "${WEBKIT_DIR}/WebProcess/WebPage/CoordinatedGraphics"
     140    "${WEBKIT_DIR}/WebProcess/WebPage/wc"
    125141    "${WEBKIT_DIR}/WebProcess/WebPage/win"
    126142    "${WEBKIT_DIR}/win"
     143)
     144
     145list(APPEND WebKit_MESSAGES_IN_FILES
     146    GPUProcess/graphics/wc/RemoteWCLayerTreeHost
     147
     148    WebProcess/GPU/graphics/wc/RemoteWCLayerTreeHostProxy
    127149)
    128150
  • trunk/Source/WebKit/Scripts/webkit/messages.py

    r284080 r285099  
    358358        'WebKit::TransactionID',
    359359        'WebKit::UserContentControllerIdentifier',
     360        'WebKit::WCLayerTreeHostIdentifier',
    360361        'WebKit::WebPageProxyIdentifier',
    361362        'WebKit::WebURLSchemeHandlerIdentifier',
     
    369370        '"LayerHostingContext.h"': ["PLATFORM(COCOA)", ],
    370371        '"GestureTypes.h"': ["PLATFORM(IOS_FAMILY)"],
     372        '"WCLayerTreeHostIdentifier.h"': ["USE(GRAPHICS_LAYER_WC)"],
    371373        '<WebCore/MediaPlaybackTargetContext.h>': ["ENABLE(WIRELESS_PLAYBACK_TARGET)"],
    372374        '<WebCore/DataDetectorType.h>': ["ENABLE(DATA_DETECTION)"],
  • trunk/Source/WebKit/Shared/DrawingAreaInfo.h

    r283966 r285099  
    3838    RemoteLayerTree,
    3939#elif USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
    40     CoordinatedGraphics
     40    CoordinatedGraphics,
     41#endif
     42#if USE(GRAPHICS_LAYER_WC)
     43    WC,
    4144#endif
    4245};
     
    6568        , WebKit::DrawingAreaType::CoordinatedGraphics
    6669#endif
     70#if USE(GRAPHICS_LAYER_WC)
     71        , WebKit::DrawingAreaType::WC
     72#endif
    6773    >;
    6874};
  • trunk/Source/WebKit/UIProcess/wc/DrawingAreaProxyWC.h

    r285098 r285099  
    11/*
    2  * Copyright (C) 2020 Sony Interactive Entertainment Inc.
     2 * Copyright (C) 2021 Sony Interactive Entertainment Inc.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
    1414 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    1515 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    2424 */
    2525
    26 #include "config.h"
    27 #include "GPUProcessMain.h"
     26#pragma once
    2827
    29 #if ENABLE(GPU_PROCESS)
     28#include "BackingStore.h"
     29#include "DrawingAreaProxy.h"
    3030
    31 #include "AuxiliaryProcessMain.h"
    32 #include "GPUProcess.h"
     31namespace WebCore {
     32class Region;
     33}
    3334
    3435namespace WebKit {
    3536
    36 class GPUProcessMainWin final: public AuxiliaryProcessMainBaseNoSingleton<GPUProcess> {
     37class DrawingAreaProxyWC final : public DrawingAreaProxy {
     38public:
     39    DrawingAreaProxyWC(WebPageProxy&, WebProcessProxy&);
     40
     41    void paint(BackingStore::PlatformGraphicsContext, const WebCore::IntRect&, WebCore::Region& unpaintedRegion);
     42
     43private:
     44    // DrawingAreaProxy
     45    void deviceScaleFactorDidChange() override { }
     46    void sizeDidChange() override;
     47    // message handers
     48    void update(uint64_t, const UpdateInfo&);
     49    void enterAcceleratedCompositingMode(uint64_t, const LayerTreeContext&);
     50
     51    void incorporateUpdate(const UpdateInfo&);
     52    void discardBackingStore();
     53
     54    uint64_t m_currentBackingStoreStateID { 0 };
     55    std::optional<BackingStore> m_backingStore;
    3756};
    3857
    39 int GPUProcessMain(int argc, char** argv)
    40 {
    41     return AuxiliaryProcessMain<GPUProcessMainWin>(argc, argv);
    42 }
    43 
    4458} // namespace WebKit
    45 
    46 #endif // ENABLE(GPU_PROCESS)
  • trunk/Source/WebKit/UIProcess/win/PageClientImpl.cpp

    r283911 r285099  
    2929
    3030#include "DrawingAreaProxyCoordinatedGraphics.h"
     31#include "DrawingAreaProxyWC.h"
    3132#include "WebContextMenuProxyWin.h"
    3233#include "WebPageProxy.h"
     
    4849std::unique_ptr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy(WebProcessProxy& process)
    4950{
     51    if (m_view.page()->preferences().useGPUProcessForWebGLEnabled())
     52        return makeUnique<DrawingAreaProxyWC>(*m_view.page(), process);
    5053    return makeUnique<DrawingAreaProxyCoordinatedGraphics>(*m_view.page(), process);
    5154}
  • trunk/Source/WebKit/UIProcess/win/WebView.cpp

    r274089 r285099  
    3030#include "APIPageConfiguration.h"
    3131#include "DrawingAreaProxyCoordinatedGraphics.h"
     32#include "DrawingAreaProxyWC.h"
    3233#include "Logging.h"
    3334#include "NativeWebKeyboardEvent.h"
     
    492493        return;
    493494    m_page->endPrinting();
    494     if (auto* drawingArea = static_cast<DrawingAreaProxyCoordinatedGraphics*>(m_page->drawingArea())) {
    495         // FIXME: We should port WebKit1's rect coalescing logic here.
    496         Region unpaintedRegion;
     495    if (m_page->drawingArea()) {
     496        auto painter = [&](auto drawingArea) {
     497            // FIXME: We should port WebKit1's rect coalescing logic here.
     498            Region unpaintedRegion;
    497499#if USE(CAIRO)
    498         cairo_surface_t* surface = cairo_win32_surface_create(hdc);
    499         cairo_t* context = cairo_create(surface);
    500 
    501         drawingArea->paint(context, dirtyRect, unpaintedRegion);
    502 
    503         cairo_destroy(context);
    504         cairo_surface_destroy(surface);
     500            cairo_surface_t* surface = cairo_win32_surface_create(hdc);
     501            cairo_t* context = cairo_create(surface);
     502   
     503            drawingArea->paint(context, dirtyRect, unpaintedRegion);
     504   
     505            cairo_destroy(context);
     506            cairo_surface_destroy(surface);
    505507#else
    506         COMPtr<ID3D11Texture2D> backBuffer;
    507         HRESULT hr = m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&backBuffer));
    508         if (SUCCEEDED(hr)) {
    509             BackingStore::DXConnections context { m_immediateContext.get(), backBuffer.get() };
    510             drawingArea->paint(context, dirtyRect, unpaintedRegion);
     508            COMPtr<ID3D11Texture2D> backBuffer;
     509            HRESULT hr = m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&backBuffer));
     510            if (SUCCEEDED(hr)) {
     511                BackingStore::DXConnections context { m_immediateContext.get(), backBuffer.get() };
     512                drawingArea->paint(context, dirtyRect, unpaintedRegion);
     513            }
     514   
     515            m_swapChain->Present(0, 0);
     516#endif
     517   
     518            auto unpaintedRects = unpaintedRegion.rects();
     519            for (auto& rect : unpaintedRects)
     520                drawPageBackground(hdc, m_page.get(), rect);
     521        };
     522        switch (m_page->drawingArea()->type()) {
     523        case DrawingAreaType::WC:
     524            painter(static_cast<DrawingAreaProxyWC*>(m_page->drawingArea()));
     525            break;
     526        case DrawingAreaType::CoordinatedGraphics:
     527            painter(static_cast<DrawingAreaProxyCoordinatedGraphics*>(m_page->drawingArea()));
     528            break;
     529        default:
     530            ASSERT_NOT_REACHED();
    511531        }
    512 
    513         m_swapChain->Present(0, 0);
    514 #endif
    515 
    516         auto unpaintedRects = unpaintedRegion.rects();
    517         for (auto& rect : unpaintedRects)
    518             drawPageBackground(hdc, m_page.get(), rect);
    519532    } else
    520533        drawPageBackground(hdc, m_page.get(), dirtyRect);
  • trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp

    r284371 r285099  
    4141#endif
    4242
     43#if USE(GRAPHICS_LAYER_WC)
     44#include "WCPlatformLayerGCGL.h"
     45#endif
     46
    4347namespace WebKit {
    4448
     
    6367    // during wait while in synchronous stream send. Should be fixed as part of https://bugs.webkit.org/show_bug.cgi?id=217211.
    6468    waitUntilInitialized();
     69#if USE(GRAPHICS_LAYER_WC)
     70    setPlatformLayer(makeUnique<WCPlatformLayerGCGL>(m_graphicsContextGLIdentifier));
     71#endif
    6572}
    6673
  • trunk/Source/WebKit/WebProcess/GPU/graphics/wc/RemoteWCLayerTreeHostProxy.messages.in

    r285098 r285099  
    1 # Copyright (C) 2010-2018 Apple Inc. All rights reserved.
     1# Copyright (C) 2021 Sony Interactive Entertainment Inc.
    22#
    33# Redistribution and use in source and binary forms, with or without
     
    2121# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2222
    23 messages -> DrawingArea NotRefCounted {
    24 #if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
    25     UpdateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, WebCore::IntSize size, WebCore::IntSize scrollOffset)
    26 #endif
     23#if USE(GRAPHICS_LAYER_WC)
    2724
     25messages -> RemoteWCLayerTreeHostProxy NotRefCounted {
    2826    DidUpdate()
     27}
    2928
    30 #if PLATFORM(COCOA)
    31     // Used by TiledCoreAnimationDrawingArea.
    32     UpdateGeometry(WebCore::IntSize viewSize, bool flushSynchronously, MachSendRight fencePort)
    33     SetDeviceScaleFactor(float deviceScaleFactor)
    34     SetColorSpace(struct std::optional<WebCore::DestinationColorSpace> colorSpace)
    35     SetViewExposedRect(std::optional<WebCore::FloatRect> viewExposedRect)
    36 
    37     AcceleratedAnimationDidStart(uint64_t layerID, String key, MonotonicTime startTime)
    38     AcceleratedAnimationDidEnd(uint64_t layerID, String key)
    39    
    40     AddTransactionCallbackID(WebKit::CallbackID callbackID)
    41 #endif
    42 
    43 #if PLATFORM(COCOA) || PLATFORM(GTK)
    44     AdjustTransientZoom(double scale, WebCore::FloatPoint origin)
    45     CommitTransientZoom(double scale, WebCore::FloatPoint origin)
    46 #endif
    47 }
     29#endif // USE(GRAPHICS_LAYER_WC)
  • trunk/Source/WebKit/WebProcess/GPU/graphics/wc/WCLayerTreeHostIdentifier.h

    r285098 r285099  
    11/*
    2  * Copyright (C) 2020 Sony Interactive Entertainment Inc.
     2 * Copyright (C) 2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
    1414 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    1515 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    2424 */
    2525
    26 #include "config.h"
    27 #include "GPUProcessMain.h"
     26#pragma once
    2827
    29 #if ENABLE(GPU_PROCESS)
     28#if USE(GRAPHICS_LAYER_WC)
    3029
    31 #include "AuxiliaryProcessMain.h"
    32 #include "GPUProcess.h"
     30#include <wtf/ObjectIdentifier.h>
    3331
    3432namespace WebKit {
    3533
    36 class GPUProcessMainWin final: public AuxiliaryProcessMainBaseNoSingleton<GPUProcess> {
    37 };
    38 
    39 int GPUProcessMain(int argc, char** argv)
    40 {
    41     return AuxiliaryProcessMain<GPUProcessMainWin>(argc, argv);
    42 }
     34enum WCLayerTreeHostIdentifierType { };
     35using WCLayerTreeHostIdentifier = ObjectIdentifier<WCLayerTreeHostIdentifierType>;
    4336
    4437} // namespace WebKit
    4538
    46 #endif // ENABLE(GPU_PROCESS)
     39#endif // USE(GRAPHICS_LAYER_WC)
  • trunk/Source/WebKit/WebProcess/GPU/graphics/wc/WCPlatformLayerGCGL.h

    r285098 r285099  
    11/*
    2  * Copyright (C) 2020 Sony Interactive Entertainment Inc.
     2 * Copyright (C) 2021 Sony Interactive Entertainment Inc.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
    1414 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    1515 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    2424 */
    2525
    26 #include "config.h"
    27 #include "GPUProcessMain.h"
     26#pragma once
    2827
    29 #if ENABLE(GPU_PROCESS)
    30 
    31 #include "AuxiliaryProcessMain.h"
    32 #include "GPUProcess.h"
     28#include "GraphicsContextGLIdentifier.h"
     29#include <WebCore/WCPlatformLayer.h>
    3330
    3431namespace WebKit {
    3532
    36 class GPUProcessMainWin final: public AuxiliaryProcessMainBaseNoSingleton<GPUProcess> {
     33class WCPlatformLayerGCGL : public WebCore::WCPlatformLayer {
     34public:
     35    WCPlatformLayerGCGL(GraphicsContextGLIdentifier identifier)
     36        : m_graphicsContextGLIdentifier(identifier)
     37    {
     38    }
     39    GraphicsContextGLIdentifier& graphicsContextGLIdentifier() { return m_graphicsContextGLIdentifier; }
     40
     41private:
     42    GraphicsContextGLIdentifier m_graphicsContextGLIdentifier;
    3743};
    3844
    39 int GPUProcessMain(int argc, char** argv)
    40 {
    41     return AuxiliaryProcessMain<GPUProcessMainWin>(argc, argv);
    42 }
    43 
    4445} // namespace WebKit
    45 
    46 #endif // ENABLE(GPU_PROCESS)
  • trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.cpp

    r283966 r285099  
    4141#include "DrawingAreaCoordinatedGraphics.h"
    4242#endif
     43#if USE(GRAPHICS_LAYER_WC)
     44#include "DrawingAreaWC.h"
     45#endif
    4346
    4447namespace WebKit {
     
    5861    case DrawingAreaType::CoordinatedGraphics:
    5962        return makeUnique<DrawingAreaCoordinatedGraphics>(webPage, parameters);
     63#endif
     64#if USE(GRAPHICS_LAYER_WC)
     65    case DrawingAreaType::WC:
     66        return makeUnique<DrawingAreaWC>(webPage, parameters);
    6067#endif
    6168    }
     
    110117        return false;
    111118#endif
     119#if USE(GRAPHICS_LAYER_WC)
     120    case DrawingAreaType::WC:
     121        return true;
     122#endif
    112123    default:
    113124        return false;
  • trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.h

    r283966 r285099  
    137137#endif
    138138
     139#if USE(GRAPHICS_LAYER_WC)
     140    virtual void updateGeometry(uint64_t, WebCore::IntSize) { };
     141#endif
     142
    139143#if USE(COORDINATED_GRAPHICS) || USE(GRAPHICS_LAYER_TEXTURE_MAPPER)
    140144    virtual void layerHostDidFlushLayers() { }
  • trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.messages.in

    r278880 r285099  
    4141#endif
    4242
     43#if USE(GRAPHICS_LAYER_WC)
     44    UpdateGeometry(uint64_t backingStoreStateID, WebCore::IntSize viewSize)
     45#endif
     46
    4347#if PLATFORM(COCOA) || PLATFORM(GTK)
    4448    AdjustTransientZoom(double scale, WebCore::FloatPoint origin)
  • trunk/Source/WebKit/WebProcess/WebPage/wc/WCLayerFactory.cpp

    r285098 r285099  
    11/*
    2  * Copyright (C) 2020 Sony Interactive Entertainment Inc.
     2 * Copyright (C) 2021 Sony Interactive Entertainment Inc.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
    1414 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    1515 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    2525
    2626#include "config.h"
    27 #include "GPUProcessMain.h"
     27#include "WCLayerFactory.h"
    2828
    29 #if ENABLE(GPU_PROCESS)
    30 
    31 #include "AuxiliaryProcessMain.h"
    32 #include "GPUProcess.h"
     29#include "GraphicsLayerWC.h"
    3330
    3431namespace WebKit {
     32using namespace WebCore;
    3533
    36 class GPUProcessMainWin final: public AuxiliaryProcessMainBaseNoSingleton<GPUProcess> {
    37 };
     34WCLayerFactory::WCLayerFactory(GraphicsLayerWC::Observer& observer)
     35    : m_observer(observer)
     36{
     37}
    3838
    39 int GPUProcessMain(int argc, char** argv)
     39Ref<WebCore::GraphicsLayer> WCLayerFactory::createGraphicsLayer(WebCore::GraphicsLayer::Type layerType, WebCore::GraphicsLayerClient& client)
    4040{
    41     return AuxiliaryProcessMain<GPUProcessMainWin>(argc, argv);
     41    return adoptRef(*new GraphicsLayerWC(layerType, client, m_observer));
    4242}
    4343
    4444} // namespace WebKit
    45 
    46 #endif // ENABLE(GPU_PROCESS)
  • trunk/Source/WebKit/WebProcess/WebPage/wc/WCLayerFactory.h

    r285098 r285099  
    11/*
    2  * Copyright (C) 2020 Sony Interactive Entertainment Inc.
     2 * Copyright (C) 2021 Sony Interactive Entertainment Inc.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
    1414 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    1515 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    2424 */
    2525
    26 #include "config.h"
    27 #include "GPUProcessMain.h"
     26#pragma once
    2827
    29 #if ENABLE(GPU_PROCESS)
    30 
    31 #include "AuxiliaryProcessMain.h"
    32 #include "GPUProcess.h"
     28#include "GraphicsLayerWC.h"
     29#include <WebCore/GraphicsLayerFactory.h>
    3330
    3431namespace WebKit {
    3532
    36 class GPUProcessMainWin final: public AuxiliaryProcessMainBaseNoSingleton<GPUProcess> {
     33class WCLayerFactory final : public WebCore::GraphicsLayerFactory {
     34public:
     35    WCLayerFactory(GraphicsLayerWC::Observer&);
     36
     37private:
     38    // WebCore::GraphicsLayerFactory
     39    Ref<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override;
     40
     41    GraphicsLayerWC::Observer& m_observer;
    3742};
    3843
    39 int GPUProcessMain(int argc, char** argv)
    40 {
    41     return AuxiliaryProcessMain<GPUProcessMainWin>(argc, argv);
    42 }
    43 
    4444} // namespace WebKit
    45 
    46 #endif // ENABLE(GPU_PROCESS)
  • trunk/Source/cmake/OptionsWinCairo.cmake

    r282123 r285099  
    4545SET_AND_EXPOSE_TO_BUILD(USE_CURL ON)
    4646SET_AND_EXPOSE_TO_BUILD(USE_GRAPHICS_LAYER_TEXTURE_MAPPER ON)
     47SET_AND_EXPOSE_TO_BUILD(USE_GRAPHICS_LAYER_WC ON)
    4748SET_AND_EXPOSE_TO_BUILD(USE_EGL ON)
    4849SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES ON)
Note: See TracChangeset for help on using the changeset viewer.