Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Source/WPE/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,6 +49,10 @@ if (USE_WPE_BACKEND_WESTEROS)
add_definitions(-DWPE_BACKEND_WESTEROS=1)
endif ()

if (USE_WPE_BACKEND_WINDOWLESS)
add_definitions(-DWPE_BACKEND_WINDOWLESS=1)
endif ()

if (USE_WPE_BUFFER_MANAGEMENT_GBM)
find_package(LibGBM REQUIRED)
add_definitions(-DWPE_BUFFER_MANAGEMENT_GBM=1)
Expand DownExpand Up@@ -84,6 +88,7 @@ set(WPE_INCLUDE_DIRECTORIES
"${CMAKE_SOURCE_DIR}/Source/WPE/Source/ViewBackend/Wayland"
"${CMAKE_SOURCE_DIR}/Source/WPE/Source/ViewBackend/Wayland/Protocols"
"${CMAKE_SOURCE_DIR}/Source/WPE/Source/ViewBackend/Westeros"
"${CMAKE_SOURCE_DIR}/Source/WPE/Source/ViewBackend/Windowless"
${BCM_HOST_INCLUDE_DIRS}
${GDL_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS}
Expand DownExpand Up@@ -131,6 +136,7 @@ if (USE_WPE_BACKEND_BCM_NEXUS)

Source/ViewBackend/BCMNexus/ViewBackendBCMNexus.cpp
)
list(APPEND WPE_LIBRARIES nxclient)
endif ()

if (USE_WPE_BACKEND_BCM_RPI)
Expand DownExpand Up@@ -176,6 +182,16 @@ if (USE_WPE_BACKEND_WESTEROS)
)
endif ()

if (USE_WPE_BACKEND_WINDOWLESS)
list(APPEND WPE_SOURCES
Source/Graphics/Westeros/RenderingBackendWesteros.cpp

Source/ViewBackend/Westeros/ViewBackendWesteros.cpp
Source/ViewBackend/Westeros/WesterosViewbackendInput.cpp
Source/ViewBackend/Windowless/ViewBackendWindowless.cpp
)
endif ()

if (USE_WPE_BUFFER_MANAGEMENT_GBM)
list(APPEND WPE_INCLUDE_DIRECTORIES
"${CMAKE_SOURCE_DIR}/Source/WPE/Source/Graphics/GBM"
Expand Down
1 change: 1 addition & 0 deletions Source/WPE/Source/Graphics/RenderingBackend.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,7 @@

#include "Config.h"

#include <WPE/Graphics/RenderingBackend.h>
#include "RenderingBackendBCMNexus.h"
#include "RenderingBackendBCMRPi.h"
#include "RenderingBackendIntelCE.h"
Expand Down
8 changes: 8 additions & 0 deletions Source/WPE/Source/ViewBackend/ViewBackend.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,9 @@
#include "ViewBackendBCMRPi.h"
#include "ViewBackendIntelCE.h"
#include "ViewBackendWesteros.h"
#if WPE_BACKEND(WINDOWLESS)
#include "ViewBackendWindowless.h"
#endif
#include <cstring>
#include <cstdio>
#include <cstdlib>
Expand DownExpand Up@@ -80,6 +83,11 @@ std::unique_ptr<ViewBackend> ViewBackend::create()
return std::unique_ptr<ViewBackendWesteros>(new ViewBackendWesteros);
#endif

#if WPE_BACKEND(WINDOWLESS)
if (!backendEnv || !std::strcmp(backendEnv, "windowless"))
return std::unique_ptr<ViewBackendWindowless>(new ViewBackendWindowless);
#endif

fprintf(stderr, "ViewBackend: no usable backend found, will crash.\n");
return nullptr;
}
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
/*
* Copyright (C) 2015 Igalia S.L.
* All rights reserved.
*
* 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 "ViewBackendWindowless.h"

#if WPE_BACKEND(WINDOWLESS)

#include <cassert>
#include <cstdio>
#include <unistd.h>

namespace WPE {

namespace ViewBackend {


ViewBackendWindowless::ViewBackendWindowless()
{
}

ViewBackendWindowless::~ViewBackendWindowless()
{
}

uint32_t ViewBackendWindowless::constructRenderingTarget(uint32_t width, uint32_t height)
{
return 0;
}

void ViewBackendWindowless::commitBuffer(int fd, const uint8_t* data, size_t size)
{
}

void ViewBackendWindowless::destroyBuffer(uint32_t handle)
{
}

} // namespace ViewBackend

} // namespace WPE

#endif // WPE_BACKEND(WINDOWLESS)
63 changes: 63 additions & 0 deletions Source/WPE/Source/ViewBackend/Windowless/ViewBackendWindowless.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2015 Igalia S.L.
* All rights reserved.
*
* 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.
*/

#ifndef WPE_ViewBackend_ViewBackendWindowless_h
#define WPE_ViewBackend_ViewBackendWindowless_h

#if WPE_BACKEND(WINDOWLESS)

#include <WPE/ViewBackend/ViewBackend.h>

#include <unordered_map>

namespace WPE {

namespace Input {
class Client;
}

namespace ViewBackend {

class Client;

class ViewBackendWindowless final : public ViewBackend {
public:
ViewBackendWindowless();
virtual ~ViewBackendWindowless();

std::pair<const uint8_t*, size_t> authenticate() override { return { nullptr, 0 }; };
uint32_t constructRenderingTarget(uint32_t, uint32_t) override;
void commitBuffer(int, const uint8_t* data, size_t size) override;
void destroyBuffer(uint32_t handle) override;
};

} // namespace ViewBackend

} // namespace WPE

#endif // WPE_BACKEND(WINDOWLESS)

#endif // WPE_ViewBackend_ViewBackendWindowless_h
8 changes: 5 additions & 3 deletions Source/WebCore/PlatformWPE.cmake
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,7 @@ list(APPEND WebCore_INCLUDE_DIRECTORIES
"${WEBCORE_DIR}/platform/text/icu"
${WPE_DIR}
${WTF_DIR}
${WAYLAND_INCLUDE_DIRS}
)

list(APPEND WebCore_SOURCES
Expand DownExpand Up@@ -111,7 +112,9 @@ list(APPEND WebCore_SOURCES
platform/graphics/opentype/OpenTypeVerticalData.cpp

platform/graphics/wpe/PlatformDisplayWPE.cpp

platform/graphics/wayland/PlatformDisplayWayland.cpp
platform/graphics/wayland/WaylandEventSource.cpp
platform/graphics/wayland/WaylandSurface.cpp
platform/image-encoders/JPEGImageEncoder.cpp

platform/image-decoders/cairo/ImageDecoderCairo.cpp
Expand DownExpand Up@@ -213,6 +216,7 @@ list(APPEND WebCore_LIBRARIES
${LIBXML2_LIBRARIES}
${LIBXSLT_LIBRARIES}
${SQLITE_LIBRARIES}
${WAYLAND_LIBRARIES}
WPE
)

Expand DownExpand Up@@ -271,5 +275,3 @@ if (ENABLE_SUBTLE_CRYPTO)
crypto/keys/CryptoKeySerializationRaw.cpp
)
endif ()


9 changes: 9 additions & 0 deletions Source/WebCore/platform/graphics/GLContext.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,8 +34,12 @@
#endif

#if PLATFORM(WPE)
#if PLATFORM(WAYLAND)
#include "PlatformDisplayWayland.h"
#else
#include "PlatformDisplayWPE.h"
#endif
#endif

using WTF::ThreadSpecific;

Expand DownExpand Up@@ -151,8 +155,13 @@ GLContext::GLContext()
std::unique_ptr<GLContext> GLContext::createOffscreenContext(GLContext* sharingContext)
{
#if PLATFORM(WPE)
#if PLATFORM(WAYLAND)
if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland)
return downcast<PlatformDisplayWayland>(PlatformDisplay::sharedDisplay()).createSharingGLContext();
#else
if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::WPE)
return downcast<PlatformDisplayWPE>(PlatformDisplay::sharedDisplay()).createOffscreenContext(sharingContext);
#endif
#endif
return createContextForWindow(0, sharingContext);
}
Expand Down
7 changes: 6 additions & 1 deletion Source/WebCore/platform/graphics/PlatformDisplay.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,8 +42,10 @@
#endif

#if PLATFORM(WPE)
#if !PLATFORM(WAYLAND)
#include "PlatformDisplayWPE.h"
#endif
#endif

#if PLATFORM(GTK)
#include <gdk/gdk.h>
Expand DownExpand Up@@ -94,9 +96,12 @@ std::unique_ptr<PlatformDisplay> PlatformDisplay::createPlatformDisplay()
#endif

#if PLATFORM(WPE)
#if PLATFORM(WAYLAND)
return PlatformDisplayWayland::create();
#else
return std::make_unique<PlatformDisplayWPE>();
#endif

#endif
ASSERT_NOT_REACHED();
return nullptr;
}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -86,7 +86,7 @@
#define WL_EGL_PLATFORM

#if USE(OPENGL_ES_2)
#if GST_CHECK_VERSION(1, 3, 0)
#if GST_CHECK_VERSION(1, 3, 0) && USE(GSTREAMER_GL)
#if !USE(HOLE_PUNCH_GSTREAMER)
#define GST_USE_UNSTABLE_API
#include <gst/gl/egl/gsteglimagememory.h>
Expand DownExpand Up@@ -650,7 +650,7 @@ void MediaPlayerPrivateGStreamerBase::updateTexture(BitmapTextureGL& texture, Gs
{
GstBuffer* buffer = gst_sample_get_buffer(m_sample.get());

#if USE(OPENGL_ES_2) && GST_CHECK_VERSION(1, 1, 2) && !USE(HOLE_PUNCH_GSTREAMER)
#if USE(OPENGL_ES_2) && GST_CHECK_VERSION(1, 1, 2) && !USE(HOLE_PUNCH_GSTREAMER) && USE(GSTREAMER_GL)
GstMemory *mem;
if (gst_buffer_n_memory (buffer) >= 1) {
if ((mem = gst_buffer_peek_memory (buffer, 0)) && gst_is_egl_image_memory (mem)) {
Expand DownExpand Up@@ -942,7 +942,7 @@ void MediaPlayerPrivateGStreamerBase::paintToTextureMapper(TextureMapper& textur
#endif

#if USE(GSTREAMER_GL)
NativeImagePtr MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime()
PassNativeImagePtr MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime()
{
#if !USE(CAIRO) || !ENABLE(ACCELERATED_2D_CANVAS)
return nullptr;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@
#include <wtf/Condition.h>
#include <wtf/RunLoop.h>

#if USE(EGL)
#if USE(EGL) && USE(GSTREAMER_GL)
#define WL_EGL_PLATFORM
#include <EGL/egl.h>
#include <EGL/eglext.h>
Expand DownExpand Up@@ -70,7 +70,7 @@ using namespace WebCore;

#if GST_CHECK_VERSION(1, 1, 0)
#define GST_FEATURED_CAPS_GL GST_VIDEO_CAPS_MAKE_WITH_FEATURES(GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, GST_CAPS_FORMAT) ";"
#if GST_CHECK_VERSION(1, 3, 0)
#if GST_CHECK_VERSION(1, 3, 0) && USE(GSTREAMER_GL)
#define GST_FEATURED_CAPS GST_FEATURED_CAPS_GL GST_VIDEO_CAPS_MAKE_WITH_FEATURES(GST_CAPS_FEATURE_MEMORY_EGL_IMAGE, GST_CAPS_FORMAT) ";"
#else
#define GST_FEATURED_CAPS GST_FEATURED_CAPS_GL
Expand DownExpand Up@@ -205,7 +205,7 @@ struct _WebKitVideoSinkPrivate {
if (currentCaps)
gst_caps_unref(currentCaps);

#if USE(OPENGL_ES_2) && GST_CHECK_VERSION(1, 5, 1)
#if USE(OPENGL_ES_2) && GST_CHECK_VERSION(1, 5, 1) && USE(GSTREAMER_GL)
if (context) {
gst_gl_context_destroy(context);
gst_object_unref(context);
Expand All@@ -225,7 +225,7 @@ struct _WebKitVideoSinkPrivate {
GstVideoInfo info;
GstCaps* currentCaps;

#if USE(OPENGL_ES_2) && GST_CHECK_VERSION(1, 3, 0)
#if USE(OPENGL_ES_2) && GST_CHECK_VERSION(1, 3, 0) && USE(GSTREAMER_GL)
GstGLDisplay *display;
GstGLContext *context;
GstGLContext *other_context;
Expand DownExpand Up@@ -433,7 +433,7 @@ static gboolean webkitVideoSinkProposeAllocation(GstBaseSink* baseSink, GstQuery
if (!gst_video_info_from_caps(&sink->priv->info, caps))
return FALSE;

#if USE(OPENGL_ES_2) && GST_CHECK_VERSION(1, 3, 0)
#if USE(OPENGL_ES_2) && GST_CHECK_VERSION(1, 3, 0) && USE(GSTREAMER_GL)
// Code adapted from gst-plugins-bad's glimagesink.

if (!_ensure_gl_setup(sink))
Expand DownExpand Up@@ -492,7 +492,7 @@ static gboolean webkitVideoSinkQuery(GstBaseSink* baseSink, GstQuery* query)
switch (GST_QUERY_TYPE(query)) {
case GST_QUERY_DRAIN:
{
#if USE(OPENGL_ES_2) && GST_CHECK_VERSION(1, 3, 0)
#if USE(OPENGL_ES_2) && GST_CHECK_VERSION(1, 3, 0) && USE(GSTREAMER_GL)
priv->scheduler.drain();

LOG_MEDIA_MESSAGE("Drain query, emitting DRAIN signal and releasing EGL samples");
Expand DownExpand Up@@ -525,7 +525,7 @@ static gboolean webkitVideoSinkEvent(GstBaseSink *baseSink, GstEvent *event)

switch (GST_EVENT_TYPE(event)) {
case GST_EVENT_FLUSH_START:
#if USE(OPENGL_ES_2) && GST_CHECK_VERSION(1, 3, 0)
#if USE(OPENGL_ES_2) && GST_CHECK_VERSION(1, 3, 0) && USE(GSTREAMER_GL)
priv->scheduler.drain();

LOG_MEDIA_MESSAGE("Flush-start, emitting DRAIN signal and releasing EGL samples");
Expand All@@ -541,7 +541,7 @@ static gboolean webkitVideoSinkEvent(GstBaseSink *baseSink, GstEvent *event)
}
}

#if GST_CHECK_VERSION(1, 3, 0)
#if GST_CHECK_VERSION(1, 3, 0) && USE(GSTREAMER_GL)
static void
webkitVideoSinkSetContext(GstElement* element, GstContext* context)
{
Expand DownExpand Up@@ -579,7 +579,7 @@ static void webkit_video_sink_class_init(WebKitVideoSinkClass* klass)
baseSinkClass->query = webkitVideoSinkQuery;
baseSinkClass->event = webkitVideoSinkEvent;

#if GST_CHECK_VERSION(1, 3, 0)
#if GST_CHECK_VERSION(1, 3, 0) && USE(GSTREAMER_GL)
elementClass->set_context = webkitVideoSinkSetContext;
#endif

Expand Down
Loading