#define ENABLE_TIZEN_2D_CANVAS_JS_SUSPEND 0 /* Hyunki Baik(hyunki.baik@samsung.com): Suspend JavasScript during UIProcess access the shared platformSurface for 2D Canvas */
#endif
-#if !USE(MESA)
+#if !USE(MESA) && !(ENABLE(TIZEN_EMULATOR) && PLATFORM(WAYLAND))
#define ENABLE_TIZEN_DDK_WORKAROUND 1 /* kalyan.kondapally@intel.com WorkAround in AcceleratedPlatformLayer for ddk issues*/
#endif
LIST(APPEND WebCore_SOURCES
platform/graphics/surfaces/wayland/WaylandMesaBufferManager.cpp
)
+ ELSEIF (ENABLE_TIZEN_EMULATOR)
+ LIST(APPEND WebCore_SOURCES
+ platform/graphics/surfaces/wayland/WaylandVIGSBufferManager.cpp
+ )
ENDIF()
ENDIF()
ENDIF()
#define EGL_EGLEXT_PROTOTYPES 1
#include <EGL/egl.h>
#include <EGL/eglext.h>
-
-#if PLATFORM(WAYLAND) && USE(MESA)
-#include <EGL/eglmesaext.h>
-#endif
+#include "WaylandPlatformExt.h"
#define GL_GLEXT_PROTOTYPES 1
#if USE(OPENGL_ES_2)
#include "config.h"
#include "WaylandBufferManager.h"
-#ifdef USE(MESA)
+#if USE(MESA)
#include "WaylandMesaBufferManager.h"
+#elif ENABLE(TIZEN_EMULATOR)
+#include "WaylandVIGSBufferManager.h"
#endif
namespace WebCore {
WaylandBufferManager* WaylandBufferManager::create(int fd)
{
-#ifdef USE(MESA)
+#if USE(MESA)
return new WaylandMesaBufferManager(fd);
+#elif ENABLE(TIZEN_EMULATOR)
+ return new WaylandVIGSBufferManager(fd);
#else
- return nullptr;
+ return NULL;
#endif
}
static WaylandBufferManager* create(int);
WaylandBufferManager() { }
virtual ~WaylandBufferManager() { }
- virtual int allocateBO(unsigned, unsigned, uint32_t*) = 0;
+ virtual int allocateBO(unsigned, unsigned, unsigned, unsigned, unsigned, uint32_t*) = 0;
virtual bool lockSurface(unsigned) = 0;
virtual bool unlockSurface(unsigned) = 0;
virtual bool querySurface(unsigned, int**) = 0;
#include <wtf/text/StringBuilder.h>
#include <wtf/text/WTFString.h>
#include <libdrm/drm.h>
-#ifdef USE(MESA)
#include <xf86drm.h>
-#endif
// os-compatibility
static struct wl_drm* m_drm = 0;
total = stride * height;
offset = align(total, 4096);
total = offset + (width * height) / 2;
- *drmHandle = m_bufmgr->allocateBO(total, 0, &name);
+ *drmHandle = m_bufmgr->allocateBO(width, height, stride, total, 0, &name);
buffer = wl_drm_create_buffer(m_drm, name, width, height, stride, WL_DRM_FORMAT_ARGB8888);
return buffer;
#include "config.h"
#include "WaylandMesaBufferManager.h"
-#ifdef USE(MESA)
+#if USE(MESA)
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
#include <wtf/text/WTFString.h>
drm_intel_bufmgr_destroy(m_bufferManager);
}
-int WaylandMesaBufferManager::allocateBO(unsigned size, unsigned alignment, uint32_t* fd)
+int WaylandMesaBufferManager::allocateBO(unsigned width, unsigned height, unsigned stride, unsigned size, unsigned alignment, uint32_t* fd)
{
static int allocationId = 0;
allocationId++;
#ifndef WaylandMesaBufferManager_h
#define WaylandMesaBufferManager_h
-#ifdef USE(MESA)
+#if USE(MESA)
#include "WaylandBufferManager.h"
#include <wtf/HashMap.h>
public:
explicit WaylandMesaBufferManager(int);
virtual ~WaylandMesaBufferManager();
- virtual int allocateBO(unsigned, unsigned, uint32_t*) OVERRIDE;
+ virtual int allocateBO(unsigned, unsigned, unsigned, unsigned, unsigned, uint32_t*) OVERRIDE;
virtual bool lockSurface(unsigned) OVERRIDE;
virtual bool unlockSurface(unsigned) OVERRIDE;
virtual bool querySurface(unsigned, int**) OVERRIDE;
--- /dev/null
+/*
+ * Copyright (C) 2013 Samsung Electronics. 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 WaylandPlatformExt_h
+#define WaylandPlatformExt_h
+
+#if PLATFORM(WAYLAND)
+
+#if USE(MESA)
+#include <EGL/eglmesaext.h>
+#else
+#include <EGL/eglplatform.h>
+
+#ifndef EGL_WL_bind_wayland_display
+
+#if !defined(EGL_WAYLAND_BUFFER_WL)
+#define EGL_WAYLAND_BUFFER_WL 0x31D5
+#endif
+
+#if !defined(EGL_WAYLAND_PLANE_WL)
+#define EGL_WAYLAND_PLANE_WL 0x31D6
+#endif
+
+#if !defined(EGL_TEXTURE_Y_U_V_WL)
+#define EGL_TEXTURE_Y_U_V_WL 0x31D7
+#endif
+
+#if !defined(EGL_TEXTURE_Y_UV_WL)
+#define EGL_TEXTURE_Y_UV_WL 0x31D8
+#endif
+
+#if !defined(EGL_TEXTURE_Y_XUXV_WL)
+#define EGL_TEXTURE_Y_XUXV_WL 0x31D9
+#endif
+
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWL) (EGLDisplay dpy, struct wl_resource *buffer, EGLint attribute, EGLint *value);
+#endif
+#endif
+
+#endif
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2013 Samsung Electronics. 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 "WaylandVIGSBufferManager.h"
+
+namespace WebCore {
+
+WaylandVIGSBufferManager::WaylandVIGSBufferManager(int fd)
+ : WaylandBufferManager()
+{
+ int ret = vigs_drm_device_create(fd, &m_device);
+
+ if (ret != 0) {
+ LOG_ERROR("Failed to Create Drm Device - %d.", ret);
+ m_device = NULL;
+ }
+}
+
+WaylandVIGSBufferManager::~WaylandVIGSBufferManager()
+{
+ vigs_drm_device_destroy(m_device);
+}
+
+int WaylandVIGSBufferManager::allocateBO(unsigned width, unsigned height, unsigned stride, unsigned size, unsigned alignment, uint32_t* fd)
+{
+ static int allocationId = 0;
+ allocationId++;
+ vigs_drm_surface* sfc;
+ int ret = vigs_drm_surface_create(m_device,
+ width,
+ height,
+ stride,
+ vigs_drm_surface_bgra8888,
+ &sfc);
+
+ if (ret != 0) {
+ LOG_ERROR("Failed to Allocate Drm Buffer - %d.", ret);
+ return 0;
+ }
+
+ ret = vigs_drm_gem_map(&sfc->gem, 1);
+
+ if (ret != 0) {
+ LOG_ERROR("Failed to Map Drm Buffer - %d.", ret);
+ vigs_drm_gem_unref(&sfc->gem);
+ return 0;
+ }
+
+ ret = vigs_drm_gem_get_name(&sfc->gem);
+
+ if (ret != 0) {
+ LOG_ERROR("Failed to Get Drm Buffer Name - %d.", ret);
+ vigs_drm_gem_unref(&sfc->gem);
+ return 0;
+ }
+
+ if (fd)
+ *fd = sfc->gem.name;
+
+ m_surfaces.add(allocationId, sfc);
+
+ return allocationId;
+}
+
+void WaylandVIGSBufferManager::freeBO(unsigned handleId)
+{
+ SurfaceMap::iterator it = m_surfaces.find(handleId);
+ if (it != m_surfaces.end()) {
+ vigs_drm_gem_unref(&it->second->gem);
+
+ m_surfaces.remove(it);
+ }
+}
+
+bool WaylandVIGSBufferManager::lockSurface(unsigned handleId)
+{
+ SurfaceMap::iterator it = m_surfaces.find(handleId);
+ if (it != m_surfaces.end()) {
+ vigs_drm_surface_start_access(it->second,
+ VIGS_DRM_SAF_WRITE);
+ return true;
+ }
+
+ return false;
+}
+
+bool WaylandVIGSBufferManager::unlockSurface(unsigned handleId)
+{
+ SurfaceMap::iterator it = m_surfaces.find(handleId);
+ if (it != m_surfaces.end()) {
+ vigs_drm_surface_end_access(it->second, 1);
+ return true;
+ }
+
+ return false;
+}
+
+bool WaylandVIGSBufferManager::querySurface(unsigned handleId, int** value)
+{
+ SurfaceMap::iterator it = m_surfaces.find(handleId);
+ if (it == m_surfaces.end()) {
+ return false;
+ }
+
+ *value = (int*)it->second->gem.vaddr;
+
+ return true;
+}
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2013 Samsung Electronics. 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 WaylandVIGSBufferManager_h
+#define WaylandVIGSBufferManager_h
+
+#include "WaylandBufferManager.h"
+#include <wtf/HashMap.h>
+#include <vigs.h>
+
+namespace WebCore {
+
+class WaylandVIGSBufferManager : public WaylandBufferManager {
+public:
+ explicit WaylandVIGSBufferManager(int fd);
+ virtual ~WaylandVIGSBufferManager();
+ virtual int allocateBO(unsigned width, unsigned height, unsigned stride, unsigned size, unsigned alignment, uint32_t* fd) OVERRIDE;
+ virtual bool lockSurface(unsigned handleId) OVERRIDE;
+ virtual bool unlockSurface(unsigned handleId) OVERRIDE;
+ virtual bool querySurface(unsigned handleId, int** value) OVERRIDE;
+ virtual void freeBO(unsigned handleId) OVERRIDE;
+private:
+ typedef HashMap<int, vigs_drm_surface*> SurfaceMap;
+
+ vigs_drm_device* m_device;
+ SurfaceMap m_surfaces;
+};
+
+}
+
+#endif
#if PLATFORM(WAYLAND)
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#if USE(MESA)
-#include <EGL/eglmesaext.h>
-#endif
+#include "WaylandPlatformExt.h"
#endif
#define GL_CMD(...) do { __VA_ARGS__; ASSERT_ARG(__VA_ARGS__, !glGetError()); } while (0)
FIND_LIBRARY(WAYLAND_GBM_LIBRARY NAMES gbm PATHS /usr/lib)
FIND_LIBRARY(WAYLAND_DRM_INTEL_LIBRARY NAMES DRM_INTEL drm_intel PATHS /usr/lib)
+IF (ENABLE_TIZEN_EMULATOR)
+ FIND_LIBRARY(WAYLAND_DRM_VIGS_LIBRARY NAMES DRM_VIGS drm_vigs PATHS /usr/lib)
+ELSE ()
+ SET(WAYLAND_DRM_VIGS_LIBRARY "")
+ENDIF ()
-SET(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARY} ${WAYLAND_EGL_LIBRARY} ${WAYLAND_GBM_LIBRARY} ${WAYLAND_DRM_INTEL_LIBRARY})
+SET(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARY} ${WAYLAND_EGL_LIBRARY} ${WAYLAND_GBM_LIBRARY} ${WAYLAND_DRM_INTEL_LIBRARY} ${WAYLAND_DRM_VIGS_LIBRARY})
SET(WAYLAND_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR} ${WAYLAND_DRM_INCLUDE_DIR})
list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIRS)
ADD_DEFINITIONS(-DWTF_USE_TEXTURE_MAPPER=1)
ENDIF ()
-IF (ENABLE_TIZEN_GSTREAMER_VIDEO_SET_SINK AND NOT ("${EFL_TARGET}" STREQUAL "i386"))
- SET(WTF_USE_TIZEN_GSTREAMER_VIDEO_SET_SINK 1)
- ADD_DEFINITIONS(-DWTF_USE_TIZEN_GSTREAMER_VIDEO_SET_SINK=1)
-ENDIF ()
-
IF ("${EFL_TARGET}" STREQUAL "i386")
MESSAGE("i386 target Build Mode <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
ADD_DEFINITIONS(-DENABLE_TIZEN_WEBKIT2_DIRECT_RENDERING=1)
ADD_DEFINITIONS(-DENABLE_TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE=1)
SET(ENABLE_TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE 1)
ADD_DEFINITIONS(-DENABLE_TIZEN_EMULATOR=1)
+ SET(ENABLE_TIZEN_EMULATOR 1)
ELSE ()
ADD_DEFINITIONS(-DENABLE_TIZEN_WEBKIT2_DIRECT_RENDERING=1)
SET(ENABLE_TIZEN_WEBKIT2_DIRECT_RENDERING 1)
FIND_PACKAGE(Wayland REQUIRED)
ADD_DEFINITIONS(-DWTF_PLATFORM_WAYLAND=1)
SET(WTF_PLATFORM_WAYLAND 1)
+ IF (ENABLE_TIZEN_EMULATOR)
+ ADD_DEFINITIONS(-DWTF_USE_ACCELERATED_VIDEO_VAAPI=1)
+ ENDIF ()
+ENDIF ()
+
+IF (ENABLE_TIZEN_GSTREAMER_VIDEO_SET_SINK AND NOT ("${EFL_TARGET}" STREQUAL "i386"))
+ IF (ENABLE_ECORE_X OR NOT ENABLE_TIZEN_EMULATOR)
+ SET(WTF_USE_TIZEN_GSTREAMER_VIDEO_SET_SINK 1)
+ ADD_DEFINITIONS(-DWTF_USE_TIZEN_GSTREAMER_VIDEO_SET_SINK=1)
+ ENDIF ()
ENDIF ()
IF (USE_MESA)
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(tts)
BuildRequires: pkgconfig(capi-system-power)
+%if 0%{?simulator}
+%if %{with wayland}
+BuildRequires: pkgconfig(glesv2)
+%else
+BuildRequires: pkgconfig(gles20)
+%endif
+%else
%if %{with mesa}
BuildRequires: pkgconfig(gl)
BuildRequires: pkgconfig(glesv2)
%else
BuildRequires: pkgconfig(gles20)
%endif
+%endif
BuildRequires: pkgconfig(egl)
%if %{with wayland}
$ECORE_X \
$ENABLE_LLINT \
%if %{with mesa}
+%if !0%{?simulator}
-DUSE_MESA=On \
%endif
+%endif
%if %{with desktop}
-DENABLE_TIZEN_DESKTOP_BROWSING=On \
%endif