Diff
Modified: trunk/Source/WebCore/ChangeLog (234687 => 234688)
--- trunk/Source/WebCore/ChangeLog 2018-08-08 09:14:35 UTC (rev 234687)
+++ trunk/Source/WebCore/ChangeLog 2018-08-08 09:31:08 UTC (rev 234688)
@@ -1,3 +1,97 @@
+2018-08-08 Zan Dobersek <[email protected]>
+
+ [Nicosia] Add the Nicosia-specific PlatformLayer type alias
+ https://bugs.webkit.org/show_bug.cgi?id=188405
+
+ Reviewed by Carlos Garcia Campos.
+
+ Add a Nicosia-specific PlatformLayer type alias that points to the
+ Nicosia::PlatformLayer type. This is guarded by the USE(NICOSIA) macro,
+ which guards additional code in this patch but will be added to other
+ Nicosia-specific classes later.
+
+ To keep things buildable when USE(NICOSIA) is defined, additional
+ changes are made to classes that operate with platform layers.
+ Cairo-specific ImageBuffer implementation and the related
+ ImageBufferData class are modified to work with a Nicosia::ContentLayer
+ object. This object is using the TextureMapper-specific Impl class which
+ internally keeps a TextureMapperPlatformLayerProxy object. This way
+ we can reuse existing code that also works with an object of this type,
+ only difference is where the proxy object is kept. Main difference is in
+ the ImageBuffer::platformLayer() method, where pointer to the
+ Nicosia::ContentLayer object is returned when USE(NICOSIA) is enabled.
+
+ Similar approach is taked for the MediaPlayerPrivateGStreamerBase class.
+ When USE(NICOSIA) is enabled, a Nicosia::ContentLayer object is
+ constructed, and with the TextureMapper-specific Impl we again operate
+ on the TextureMapperPlatformLayerProxy object like before, so all of
+ the proxy-specific code is bundled into helper lambdas that operate on
+ the given proxy object. In the platformLayer() method, we again return
+ pointer to the Nicosia::ContentLayer object when USE(NICOSIA) is on.
+
+ For the GraphicsContext3D integration, we have to provide a separate
+ class that replicates most of the functionality currently present in the
+ TextureMapperGC3DPlatformLayer class. Main difference is that in the new
+ Nicosia::GC3DLayer class, a Nicosia::ContentLayer object is spawned with
+ the TextureMapper-specific Impl. The proxy object held by that Impl is
+ then again used to push new buffers into the rendering pipeline. As
+ before, pointer to the Nicosia::ContentLayer is returned in the
+ GraphicsContext3D::platformLayer() object.
+
+ Integration of the GraphicsContext3D class into Nicosia layering needs
+ further work in the future. Target should be providing a class that is
+ not specific to the TextureMapper layer. Additionally, when USE(NICOSIA)
+ is enabled, we remove the TextureMapperGC3DPlatformLayer class from
+ compilation since it depends on a PlatformLayer type alias to the
+ TextureMapperPlatformLayerProxyProvider class.
+
+ This patch also doesn't address the abundance of macros that this code
+ now uses. While USE(NICOSIA) is introduced, we have to work around
+ four additional macros in this code: USE(TEXTURE_MAPPER),
+ USE(TEXTURE_MAPPER_GL), USE(COORDINATED_GRAPHICS) and
+ USE(COORDINATED_GRAPHICS_THREADED). In a lot of places these are used
+ interchangeably, but they should be merged and simplified in use. I hope
+ to approach this once the USE(NICOSIA) functionality lands and is turned
+ on for ports that currently build with USE(COORDINATED_GRAPHICS).
+
+ * platform/TextureMapper.cmake:
+ * platform/graphics/GraphicsContext3D.h:
+ * platform/graphics/PlatformLayer.h:
+ * platform/graphics/cairo/ImageBufferCairo.cpp:
+ (WebCore::ImageBufferData::ImageBufferData):
+ (WebCore::ImageBufferData::~ImageBufferData):
+ (WebCore::ImageBufferData::swapBuffersIfNeeded):
+ (WebCore::ImageBuffer::platformLayer const):
+ * platform/graphics/cairo/ImageBufferDataCairo.h:
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
+ (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
+ (WebCore::MediaPlayerPrivateGStreamerBase::platformLayer const):
+ (WebCore::MediaPlayerPrivateGStreamerBase::swapBuffersIfNeeded):
+ (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
+ (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
+ (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+ * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp: Added.
+ (Nicosia::GC3DLayer::GC3DLayer):
+ (Nicosia::GC3DLayer::~GC3DLayer):
+ (Nicosia::GC3DLayer::makeContextCurrent):
+ (Nicosia::GC3DLayer::platformContext):
+ (Nicosia::GC3DLayer::swapBuffersIfNeeded):
+ * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.h: Added.
+ (Nicosia::GC3DLayer::contentLayer const):
+ * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
+ (WebCore::GraphicsContext3D::GraphicsContext3D):
+ (WebCore::GraphicsContext3D::makeContextCurrent):
+ (WebCore::GraphicsContext3D::platformGraphicsContext3D):
+ (WebCore::GraphicsContext3D::platformLayer const):
+ * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
+ * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+ (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
+ (WebCore::CoordinatedGraphicsLayer::syncPlatformLayer):
+ (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
+
2018-08-08 Manuel Rego Casasnovas <[email protected]>
[css-grid] Update behavior of percentage row tracks and gutters
Modified: trunk/Source/WebCore/platform/TextureMapper.cmake (234687 => 234688)
--- trunk/Source/WebCore/platform/TextureMapper.cmake 2018-08-08 09:14:35 UTC (rev 234687)
+++ trunk/Source/WebCore/platform/TextureMapper.cmake 2018-08-08 09:31:08 UTC (rev 234688)
@@ -60,6 +60,7 @@
platform/graphics/nicosia/texmap/NicosiaCompositionLayerTextureMapperImpl.cpp
platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp
+ platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp
)
else ()
list(APPEND WebCore_SOURCES
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (234687 => 234688)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2018-08-08 09:14:35 UTC (rev 234687)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2018-08-08 09:31:08 UTC (rev 234688)
@@ -74,6 +74,12 @@
typedef struct __IOSurface* IOSurfaceRef;
#endif // PLATFORM(COCOA)
+#if USE(NICOSIA)
+namespace Nicosia {
+class GC3DLayer;
+}
+#endif
+
#if !PLATFORM(COCOA)
typedef unsigned GLuint;
typedef void* PlatformGraphicsContext3D;
@@ -1481,7 +1487,10 @@
// Errors raised by synthesizeGLError().
ListHashSet<GC3Denum> m_syntheticErrors;
-#if USE(TEXTURE_MAPPER)
+#if USE(NICOSIA) && USE(TEXTURE_MAPPER)
+ friend class Nicosia::GC3DLayer;
+ std::unique_ptr<Nicosia::GC3DLayer> m_nicosiaLayer;
+#elif USE(TEXTURE_MAPPER)
friend class TextureMapperGC3DPlatformLayer;
std::unique_ptr<TextureMapperGC3DPlatformLayer> m_texmapLayer;
#else
Modified: trunk/Source/WebCore/platform/graphics/PlatformLayer.h (234687 => 234688)
--- trunk/Source/WebCore/platform/graphics/PlatformLayer.h 2018-08-08 09:14:35 UTC (rev 234687)
+++ trunk/Source/WebCore/platform/graphics/PlatformLayer.h 2018-08-08 09:31:08 UTC (rev 234688)
@@ -30,6 +30,11 @@
typedef CALayer PlatformLayer;
#elif PLATFORM(WIN) && USE(CA)
typedef struct _CACFLayer PlatformLayer;
+#elif USE(NICOSIA)
+namespace Nicosia {
+class PlatformLayer;
+}
+typedef Nicosia::PlatformLayer PlatformLayer;
#elif USE(COORDINATED_GRAPHICS_THREADED)
namespace WebCore {
class TextureMapperPlatformLayerProxyProvider;
Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp (234687 => 234688)
--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp 2018-08-08 09:14:35 UTC (rev 234687)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp 2018-08-08 09:31:08 UTC (rev 234688)
@@ -91,9 +91,14 @@
#endif
{
#if ENABLE(ACCELERATED_2D_CANVAS) && USE(COORDINATED_GRAPHICS_THREADED)
- if (m_renderingMode == RenderingMode::Accelerated)
+ if (m_renderingMode == RenderingMode::Accelerated) {
+#if USE(NICOSIA)
+ m_nicosiaLayer = Nicosia::ContentLayer::create(Nicosia::ContentLayerTextureMapperImpl::createFactory(*this));
+#else
m_platformLayerProxy = adoptRef(new TextureMapperPlatformLayerProxy);
#endif
+ }
+#endif
}
ImageBufferData::~ImageBufferData()
@@ -102,6 +107,10 @@
return;
#if ENABLE(ACCELERATED_2D_CANVAS)
+#if USE(COORDINATED_GRAPHICS_THREADED) && USE(NICOSIA)
+ downcast<Nicosia::ContentLayerTextureMapperImpl>(m_nicosiaLayer->impl()).invalidateClient();
+#endif
+
GLContext* previousActiveContext = GLContext::current();
PlatformDisplay::sharedDisplayForCompositing().sharingGLContext()->makeContextCurrent();
@@ -139,10 +148,12 @@
cairo_set_antialias(m_compositorCr.get(), CAIRO_ANTIALIAS_NONE);
}
+#if !USE(NICOSIA)
RefPtr<TextureMapperPlatformLayerProxy> ImageBufferData::proxy() const
{
return m_platformLayerProxy.copyRef();
}
+#endif
void ImageBufferData::swapBuffersIfNeeded()
{
@@ -150,8 +161,18 @@
if (!m_compositorTexture) {
createCompositorBuffer();
- LockHolder holder(m_platformLayerProxy->lock());
- m_platformLayerProxy->pushNextBuffer(std::make_unique<TextureMapperPlatformLayerBuffer>(m_compositorTexture, m_size, TextureMapperGL::ShouldBlend, GL_RGBA));
+
+ auto proxyOperation =
+ [this](TextureMapperPlatformLayerProxy& proxy)
+ {
+ LockHolder holder(proxy.lock());
+ proxy.pushNextBuffer(std::make_unique<TextureMapperPlatformLayerBuffer>(m_compositorTexture, m_size, TextureMapperGL::ShouldBlend, GL_RGBA));
+ };
+#if USE(NICOSIA)
+ proxyOperation(downcast<Nicosia::ContentLayerTextureMapperImpl>(m_nicosiaLayer->impl()).proxy());
+#else
+ proxyOperation(*m_platformLayerProxy);
+#endif
}
// It would be great if we could just swap the buffers here as we do with webgl, but that breaks the cases
@@ -671,9 +692,14 @@
PlatformLayer* ImageBuffer::platformLayer() const
{
#if ENABLE(ACCELERATED_2D_CANVAS)
+#if USE(NICOSIA)
+ if (m_data.m_renderingMode == RenderingMode::Accelerated)
+ return m_data.m_nicosiaLayer.get();
+#else
if (m_data.m_texture)
return const_cast<ImageBufferData*>(&m_data);
#endif
+#endif
return 0;
}
Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h (234687 => 234688)
--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h 2018-08-08 09:14:35 UTC (rev 234687)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h 2018-08-08 09:31:08 UTC (rev 234688)
@@ -38,6 +38,10 @@
#include "TextureMapperPlatformLayerProxyProvider.h"
#endif
+#if ENABLE(ACCELERATED_2D_CANVAS) && USE(NICOSIA)
+#include "NicosiaContentLayerTextureMapperImpl.h"
+#endif
+
namespace WebCore {
class IntSize;
@@ -45,8 +49,12 @@
class ImageBufferData
#if ENABLE(ACCELERATED_2D_CANVAS)
+#if USE(NICOSIA)
+ : public Nicosia::ContentLayerTextureMapperImpl::Client
+#else
: public PlatformLayer
#endif
+#endif
{
public:
ImageBufferData(const IntSize&, RenderingMode);
@@ -62,15 +70,24 @@
void createCairoGLSurface();
#if USE(COORDINATED_GRAPHICS_THREADED)
+#if USE(NICOSIA)
+ void swapBuffersIfNeeded() override;
+#else
RefPtr<TextureMapperPlatformLayerProxy> proxy() const override;
void swapBuffersIfNeeded() override;
+#endif
void createCompositorBuffer();
- RefPtr<TextureMapperPlatformLayerProxy> m_platformLayerProxy;
RefPtr<cairo_surface_t> m_compositorSurface;
uint32_t m_compositorTexture;
RefPtr<cairo_t> m_compositorCr;
+
+#if USE(NICOSIA)
+ RefPtr<Nicosia::ContentLayer> m_nicosiaLayer;
#else
+ RefPtr<TextureMapperPlatformLayerProxy> m_platformLayerProxy;
+#endif
+#else
virtual void paintToTextureMapper(TextureMapper&, const FloatRect& target, const TransformationMatrix&, float opacity);
#endif
uint32_t m_texture;
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (234687 => 234688)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2018-08-08 09:14:35 UTC (rev 234687)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2018-08-08 09:31:08 UTC (rev 234688)
@@ -284,13 +284,21 @@
, m_networkState(MediaPlayer::Empty)
, m_drawTimer(RunLoop::main(), this, &MediaPlayerPrivateGStreamerBase::repaint)
#if USE(TEXTURE_MAPPER_GL)
+#if USE(NICOSIA)
+ , m_nicosiaLayer(Nicosia::ContentLayer::create(Nicosia::ContentLayerTextureMapperImpl::createFactory(*this)))
+#else
, m_platformLayerProxy(adoptRef(new TextureMapperPlatformLayerProxy()))
#endif
+#endif
{
}
MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase()
{
+#if USE(TEXTURE_MAPPER_GL) && USE(NICOSIA)
+ downcast<Nicosia::ContentLayerTextureMapperImpl>(m_nicosiaLayer->impl()).invalidateClient();
+#endif
+
#if ENABLE(ENCRYPTED_MEDIA)
m_protectionCondition.notifyAll();
#endif
@@ -735,6 +743,20 @@
}
#if USE(TEXTURE_MAPPER_GL)
+PlatformLayer* MediaPlayerPrivateGStreamerBase::platformLayer() const
+{
+#if USE(NICOSIA)
+ return m_nicosiaLayer.ptr();
+#else
+ return const_cast<MediaPlayerPrivateGStreamerBase*>(this);
+#endif
+}
+
+#if USE(NICOSIA)
+void MediaPlayerPrivateGStreamerBase::swapBuffersIfNeeded()
+{
+}
+#else
RefPtr<TextureMapperPlatformLayerProxy> MediaPlayerPrivateGStreamerBase::proxy() const
{
return m_platformLayerProxy.copyRef();
@@ -743,6 +765,7 @@
void MediaPlayerPrivateGStreamerBase::swapBuffersIfNeeded()
{
}
+#endif
void MediaPlayerPrivateGStreamerBase::pushTextureToCompositor()
{
@@ -750,32 +773,42 @@
if (!GST_IS_SAMPLE(m_sample.get()))
return;
- LockHolder holder(m_platformLayerProxy->lock());
+ auto proxyOperation =
+ [this](TextureMapperPlatformLayerProxy& proxy)
+ {
+ LockHolder holder(proxy.lock());
- if (!m_platformLayerProxy->isActive())
- return;
+ if (!proxy.isActive())
+ return;
- std::unique_ptr<GstVideoFrameHolder> frameHolder = std::make_unique<GstVideoFrameHolder>(m_sample.get(), texMapFlagFromOrientation(m_videoSourceOrientation), !m_usingFallbackVideoSink);
+ std::unique_ptr<GstVideoFrameHolder> frameHolder = std::make_unique<GstVideoFrameHolder>(m_sample.get(), texMapFlagFromOrientation(m_videoSourceOrientation), !m_usingFallbackVideoSink);
#if USE(GSTREAMER_GL)
- GLuint textureID = frameHolder->textureID();
- if (textureID) {
- std::unique_ptr<TextureMapperPlatformLayerBuffer> layerBuffer = std::make_unique<TextureMapperPlatformLayerBuffer>(textureID, frameHolder->size(), frameHolder->flags(), GraphicsContext3D::RGBA);
- layerBuffer->setUnmanagedBufferDataHolder(WTFMove(frameHolder));
- m_platformLayerProxy->pushNextBuffer(WTFMove(layerBuffer));
- } else
+ GLuint textureID = frameHolder->textureID();
+ if (textureID) {
+ std::unique_ptr<TextureMapperPlatformLayerBuffer> layerBuffer = std::make_unique<TextureMapperPlatformLayerBuffer>(textureID, frameHolder->size(), frameHolder->flags(), GraphicsContext3D::RGBA);
+ layerBuffer->setUnmanagedBufferDataHolder(WTFMove(frameHolder));
+ proxy.pushNextBuffer(WTFMove(layerBuffer));
+ } else
#endif
- {
- std::unique_ptr<TextureMapperPlatformLayerBuffer> buffer = m_platformLayerProxy->getAvailableBuffer(frameHolder->size(), GL_DONT_CARE);
- if (UNLIKELY(!buffer)) {
- auto texture = BitmapTextureGL::create(TextureMapperContextAttributes::get());
- texture->reset(frameHolder->size(), frameHolder->hasAlphaChannel() ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
- buffer = std::make_unique<TextureMapperPlatformLayerBuffer>(WTFMove(texture));
- }
- frameHolder->updateTexture(buffer->textureGL());
- buffer->setExtraFlags(texMapFlagFromOrientation(m_videoSourceOrientation) | (frameHolder->hasAlphaChannel() ? TextureMapperGL::ShouldBlend : 0));
- m_platformLayerProxy->pushNextBuffer(WTFMove(buffer));
- }
+ {
+ std::unique_ptr<TextureMapperPlatformLayerBuffer> buffer = proxy.getAvailableBuffer(frameHolder->size(), GL_DONT_CARE);
+ if (UNLIKELY(!buffer)) {
+ auto texture = BitmapTextureGL::create(TextureMapperContextAttributes::get());
+ texture->reset(frameHolder->size(), frameHolder->hasAlphaChannel() ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
+ buffer = std::make_unique<TextureMapperPlatformLayerBuffer>(WTFMove(texture));
+ }
+ frameHolder->updateTexture(buffer->textureGL());
+ buffer->setExtraFlags(texMapFlagFromOrientation(m_videoSourceOrientation) | (frameHolder->hasAlphaChannel() ? TextureMapperGL::ShouldBlend : 0));
+ proxy.pushNextBuffer(WTFMove(buffer));
+ }
+ };
+
+#if USE(NICOSIA)
+ proxyOperation(downcast<Nicosia::ContentLayerTextureMapperImpl>(m_nicosiaLayer->impl()).proxy());
+#else
+ proxyOperation(*m_platformLayerProxy);
+#endif
}
#endif // USE(TEXTURE_MAPPER_GL)
@@ -818,8 +851,18 @@
#if USE(TEXTURE_MAPPER_GL)
if (m_usingFallbackVideoSink) {
LockHolder lock(m_drawMutex);
- if (!m_platformLayerProxy->scheduleUpdateOnCompositorThread([this] { this->pushTextureToCompositor(); }))
+ auto proxyOperation =
+ [this](TextureMapperPlatformLayerProxy& proxy)
+ {
+ return proxy.scheduleUpdateOnCompositorThread([this] { this->pushTextureToCompositor(); });
+ };
+#if USE(NICOSIA)
+ if (!proxyOperation(downcast<Nicosia::ContentLayerTextureMapperImpl>(m_nicosiaLayer->impl()).proxy()))
return;
+#else
+ if (!proxyOperation(*m_platformLayerProxy))
+ return;
+#endif
m_drawTimer.startOneShot(0_s);
m_drawCondition.wait(m_drawMutex);
} else
@@ -881,12 +924,20 @@
m_sample = adoptGRef(gst_sample_new(nullptr, gst_sample_get_caps(m_sample.get()),
gst_sample_get_segment(m_sample.get()), info ? gst_structure_copy(info) : nullptr));
- {
- LockHolder locker(m_platformLayerProxy->lock());
+ auto proxyOperation =
+ [](TextureMapperPlatformLayerProxy& proxy)
+ {
+ LockHolder locker(proxy.lock());
- if (m_platformLayerProxy->isActive())
- m_platformLayerProxy->dropCurrentBufferWhilePreservingTexture();
- }
+ if (proxy.isActive())
+ proxy.dropCurrentBufferWhilePreservingTexture();
+ };
+
+#if USE(NICOSIA)
+ proxyOperation(downcast<Nicosia::ContentLayerTextureMapperImpl>(m_nicosiaLayer->impl()).proxy());
+#else
+ proxyOperation(*m_platformLayerProxy);
+#endif
}
#endif
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (234687 => 234688)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2018-08-08 09:14:35 UTC (rev 234687)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2018-08-08 09:31:08 UTC (rev 234688)
@@ -37,8 +37,12 @@
#include <wtf/WeakPtr.h>
#if USE(TEXTURE_MAPPER_GL)
+#if USE(NICOSIA)
+#include "NicosiaContentLayerTextureMapperImpl.h"
+#else
#include "TextureMapperPlatformLayerProxyProvider.h"
#endif
+#endif
typedef struct _GstStreamVolume GstStreamVolume;
typedef struct _GstVideoInfo GstVideoInfo;
@@ -63,8 +67,12 @@
class MediaPlayerPrivateGStreamerBase : public MediaPlayerPrivateInterface, public CanMakeWeakPtr<MediaPlayerPrivateGStreamerBase>
#if USE(TEXTURE_MAPPER_GL)
+#if USE(NICOSIA)
+ , public Nicosia::ContentLayerTextureMapperImpl::Client
+#else
, public PlatformLayer
#endif
+#endif
{
public:
@@ -126,7 +134,7 @@
void acceleratedRenderingStateChanged() override;
#if USE(TEXTURE_MAPPER_GL)
- PlatformLayer* platformLayer() const override { return const_cast<MediaPlayerPrivateGStreamerBase*>(this); }
+ PlatformLayer* platformLayer() const override;
#if PLATFORM(WIN_CAIRO)
// FIXME: Accelerated rendering has not been implemented for WinCairo yet.
bool supportsAcceleratedRendering() const override { return false; }
@@ -175,10 +183,14 @@
#endif
#if USE(TEXTURE_MAPPER_GL)
+ void pushTextureToCompositor();
+#if USE(NICOSIA)
+ void swapBuffersIfNeeded() override;
+#else
RefPtr<TextureMapperPlatformLayerProxy> proxy() const override;
void swapBuffersIfNeeded() override;
- void pushTextureToCompositor();
#endif
+#endif
GstElement* videoSink() const { return m_videoSink.get(); }
@@ -238,8 +250,12 @@
RunLoop::Timer<MediaPlayerPrivateGStreamerBase> m_drawTimer;
#if USE(TEXTURE_MAPPER_GL)
+#if USE(NICOSIA)
+ Ref<Nicosia::ContentLayer> m_nicosiaLayer;
+#else
RefPtr<TextureMapperPlatformLayerProxy> m_platformLayerProxy;
#endif
+#endif
#if USE(GSTREAMER_GL)
GRefPtr<GstGLContext> m_glContext;
Added: trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp (0 => 234688)
--- trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp 2018-08-08 09:31:08 UTC (rev 234688)
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2018 Metrological Group B.V.
+ * Copyright (C) 2018 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NicosiaGC3DLayer.h"
+
+#if USE(NICOSIA) && USE(TEXTURE_MAPPER)
+
+#if USE(COORDINATED_GRAPHICS_THREADED)
+#include "TextureMapperGL.h"
+#include "TextureMapperPlatformLayerBuffer.h"
+#include "TextureMapperPlatformLayerProxy.h"
+#endif
+
+#include "GLContext.h"
+
+namespace Nicosia {
+
+using namespace WebCore;
+
+GC3DLayer::GC3DLayer(GraphicsContext3D& context, GraphicsContext3D::RenderStyle renderStyle)
+ : m_context(context)
+ , m_contentLayer(Nicosia::ContentLayer::create(Nicosia::ContentLayerTextureMapperImpl::createFactory(*this)))
+{
+ switch (renderStyle) {
+ case GraphicsContext3D::RenderOffscreen:
+ m_glContext = GLContext::createOffscreenContext(&PlatformDisplay::sharedDisplayForCompositing());
+ break;
+ case GraphicsContext3D::RenderDirectlyToHostWindow:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+}
+
+GC3DLayer::~GC3DLayer()
+{
+ downcast<ContentLayerTextureMapperImpl>(m_contentLayer->impl()).invalidateClient();
+}
+
+bool GC3DLayer::makeContextCurrent()
+{
+ ASSERT(m_glContext);
+ return m_glContext->makeContextCurrent();
+}
+
+PlatformGraphicsContext3D GC3DLayer::platformContext()
+{
+ ASSERT(m_glContext);
+ return m_glContext->platformContext();
+}
+
+void GC3DLayer::swapBuffersIfNeeded()
+{
+#if USE(COORDINATED_GRAPHICS_THREADED)
+ if (m_context.layerComposited())
+ return;
+
+ m_context.prepareTexture();
+ IntSize textureSize(m_context.m_currentWidth, m_context.m_currentHeight);
+ TextureMapperGL::Flags flags = TextureMapperGL::ShouldFlipTexture | (m_context.m_attrs.alpha ? TextureMapperGL::ShouldBlend : 0);
+
+ {
+ auto& proxy = downcast<Nicosia::ContentLayerTextureMapperImpl>(m_contentLayer->impl()).proxy();
+
+ LockHolder holder(proxy.lock());
+ proxy.pushNextBuffer(std::make_unique<TextureMapperPlatformLayerBuffer>(m_context.m_compositorTexture, textureSize, flags, m_context.m_internalColorFormat));
+ }
+
+ m_context.markLayerComposited();
+#endif
+}
+
+} // namespace Nicosia
+
+#endif // USE(NICOSIA) && USE(TEXTURE_MAPPER)
Added: trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.h (0 => 234688)
--- trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.h 2018-08-08 09:31:08 UTC (rev 234688)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2018 Metrological Group B.V.
+ * Copyright (C) 2018 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(NICOSIA) && USE(TEXTURE_MAPPER)
+
+#include "GraphicsContext3D.h"
+#include "NicosiaContentLayerTextureMapperImpl.h"
+#include <memory>
+
+namespace WebCore {
+class GLContext;
+}
+
+namespace Nicosia {
+
+class GC3DLayer : public ContentLayerTextureMapperImpl::Client {
+public:
+ GC3DLayer(WebCore::GraphicsContext3D&, WebCore::GraphicsContext3D::RenderStyle);
+ virtual ~GC3DLayer();
+
+ ContentLayer& contentLayer() const { return m_contentLayer; }
+ bool makeContextCurrent();
+ PlatformGraphicsContext3D platformContext();
+
+ void swapBuffersIfNeeded() override;
+
+private:
+ WebCore::GraphicsContext3D& m_context;
+ std::unique_ptr<WebCore::GLContext> m_glContext;
+
+ Ref<ContentLayer> m_contentLayer;
+};
+
+} // namespace Nicosia
+
+#endif // USE(NICOSIA) && USE(TEXTURE_MAPPER)
Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp (234687 => 234688)
--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp 2018-08-08 09:14:35 UTC (rev 234687)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp 2018-08-08 09:31:08 UTC (rev 234688)
@@ -53,6 +53,8 @@
#include "Extensions3DOpenGL.h"
#endif
+#include "NicosiaGC3DLayer.h"
+
namespace WebCore {
static const size_t MaxActiveContexts = 16;
@@ -105,7 +107,11 @@
: m_attrs(attributes)
{
ASSERT_UNUSED(sharedContext, !sharedContext);
+#if USE(NICOSIA)
+ m_nicosiaLayer = std::make_unique<Nicosia::GC3DLayer>(*this, renderStyle);
+#else
m_texmapLayer = std::make_unique<TextureMapperGC3DPlatformLayer>(*this, renderStyle);
+#endif
makeContextCurrent();
@@ -270,7 +276,11 @@
bool GraphicsContext3D::makeContextCurrent()
{
+#if USE(NICOSIA)
+ return m_nicosiaLayer->makeContextCurrent();
+#else
return m_texmapLayer->makeContextCurrent();
+#endif
}
void GraphicsContext3D::checkGPUStatus()
@@ -279,7 +289,11 @@
PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D()
{
+#if USE(NICOSIA)
+ return m_nicosiaLayer->platformContext();
+#else
return m_texmapLayer->platformContext();
+#endif
}
Platform3DObject GraphicsContext3D::platformTexture() const
@@ -298,7 +312,11 @@
PlatformLayer* GraphicsContext3D::platformLayer() const
{
+#if USE(NICOSIA)
+ return &m_nicosiaLayer->contentLayer();
+#else
return m_texmapLayer.get();
+#endif
}
#if PLATFORM(GTK)
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp (234687 => 234688)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp 2018-08-08 09:14:35 UTC (rev 234687)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp 2018-08-08 09:31:08 UTC (rev 234688)
@@ -20,7 +20,7 @@
#include "config.h"
#include "TextureMapperGC3DPlatformLayer.h"
-#if ENABLE(GRAPHICS_CONTEXT_3D) && USE(TEXTURE_MAPPER)
+#if ENABLE(GRAPHICS_CONTEXT_3D) && USE(TEXTURE_MAPPER) && !USE(NICOSIA)
#include "BitmapTextureGL.h"
#include "GLContext.h"
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h (234687 => 234688)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h 2018-08-08 09:14:35 UTC (rev 234687)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h 2018-08-08 09:31:08 UTC (rev 234688)
@@ -19,7 +19,7 @@
#pragma once
-#if ENABLE(GRAPHICS_CONTEXT_3D) && USE(TEXTURE_MAPPER)
+#if ENABLE(GRAPHICS_CONTEXT_3D) && USE(TEXTURE_MAPPER) && !USE(NICOSIA)
#include "GraphicsContext3D.h"
#include "PlatformLayer.h"
Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (234687 => 234688)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp 2018-08-08 09:14:35 UTC (rev 234687)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp 2018-08-08 09:31:08 UTC (rev 234688)
@@ -432,10 +432,13 @@
void CoordinatedGraphicsLayer::setContentsToPlatformLayer(PlatformLayer* platformLayer, ContentsLayerPurpose)
{
#if USE(COORDINATED_GRAPHICS_THREADED)
+#if USE(NICOSIA)
+#else
if (m_platformLayer != platformLayer)
m_shouldSyncPlatformLayer = true;
m_platformLayer = platformLayer;
+#endif
notifyFlushRequired();
#else
UNUSED_PARAM(platformLayer);
@@ -742,28 +745,34 @@
void CoordinatedGraphicsLayer::syncPlatformLayer()
{
-#if USE(COORDINATED_GRAPHICS_THREADED)
if (!m_shouldSyncPlatformLayer)
return;
m_shouldSyncPlatformLayer = false;
+#if USE(COORDINATED_GRAPHICS_THREADED)
+#if USE(NICOSIA)
+#else
m_layerState.platformLayerChanged = true;
if (m_platformLayer)
m_layerState.platformLayerProxy = m_platformLayer->proxy();
#endif
+#endif
}
void CoordinatedGraphicsLayer::updatePlatformLayer()
{
-#if USE(COORDINATED_GRAPHICS_THREADED)
if (!m_shouldUpdatePlatformLayer)
return;
m_shouldUpdatePlatformLayer = false;
+#if USE(COORDINATED_GRAPHICS_THREADED)
+#if USE(NICOSIA)
+#else
m_layerState.platformLayerUpdated = true;
if (m_platformLayer)
m_platformLayer->swapBuffersIfNeeded();
#endif
+#endif
}
void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly()