#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
#include <wtf/StdLibExtras.h>
+#include <wtf/text/WTFString.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
return pixmap.release();
}
+// FIXME: This function needs a better place
+bool SharedPlatformSurfaceTizen::supportsLockSurfaceExtension()
+{
+ static bool extSupportQueried = false;
+ static bool supportLockSurfaceExt = false;
+
+ if (extSupportQueried)
+ return supportLockSurfaceExt;
+
+ extSupportQueried = true;
+ Display* nativeDisplay = 0;
+ EGLDisplay display = eglGetCurrentDisplay();
+
+ if (display == EGL_NO_DISPLAY) {
+ nativeDisplay = XOpenDisplay(0);
+ display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(nativeDisplay));
+ eglInitialize(display, 0, 0);
+ }
+
+ if (display != EGL_NO_DISPLAY) {
+ String rawExtensions = reinterpret_cast<const char*>(eglQueryString(display, EGL_EXTENSIONS));
+ Vector<String> extNames;
+ rawExtensions.lower().split(" ", extNames);
+
+ if (extNames.contains("egl_khr_lock_surface"))
+ supportLockSurfaceExt = true;
+
+ extNames.clear();
+ }
+
+ return supportLockSurfaceExt;
+}
+
SharedPlatformSurfaceTizen::SharedPlatformSurfaceTizen(const IntSize& size, bool lockable, bool hasAlpha, bool hasDepth, bool hasStencil, PixmapContextTizen* pixmapContext)
: m_pixmap(0)
, m_size(size)
#include "WebLayerTreeRendererTizen.h"
#endif
+#include <EGL/egl.h>
+#ifdef HAVE_ECORE_X
+#include <X11/Xlib.h>
+#endif
+
namespace WebKit {
using namespace WebCore;
+// FIXME: This function needs a better place
+static bool supportsLockSurfaceExtension()
+{
+ static bool extSupportQueried = false;
+ static bool supportLockSurfaceExt = false;
+
+ if (extSupportQueried)
+ return supportLockSurfaceExt;
+
+#ifdef HAVE_ECORE_X
+ extSupportQueried = true;
+ Display* nativeDisplay = 0;
+ EGLDisplay display = eglGetCurrentDisplay();
+
+ if (display == EGL_NO_DISPLAY) {
+ nativeDisplay = XOpenDisplay(0);
+ display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(nativeDisplay));
+ eglInitialize(display, 0, 0);
+ }
+
+ if (display != EGL_NO_DISPLAY) {
+ String rawExtensions = reinterpret_cast<const char*>(eglQueryString(display, EGL_EXTENSIONS));
+ Vector<String> extNames;
+ rawExtensions.lower().split(" ", extNames);
+
+ if (extNames.contains("egl_khr_lock_surface"))
+ supportLockSurfaceExt = true;
+
+ extNames.clear();
+ }
+#endif // HAVE_ECORE_X
+
+ return supportLockSurfaceExt;
+}
+
LayerTreeCoordinatorProxy::LayerTreeCoordinatorProxy(DrawingAreaProxy* drawingAreaProxy)
: m_drawingAreaProxy(drawingAreaProxy)
#if !ENABLE(TIZEN_WEBKIT2_TILED_AC)
: m_drawingAreaProxy(drawingAreaProxy)
{
#if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
- WebLayerTreeRenderer* renderer = isGLMode ? new WebLayerTreeRendererTizen(this, drawingAreaProxy) : new WebLayerTreeRenderer(this, drawingAreaProxy, isGLMode);
+ WebLayerTreeRenderer* renderer = (isGLMode && supportsLockSurfaceExtension()) ? new WebLayerTreeRendererTizen(this, drawingAreaProxy) : new WebLayerTreeRenderer(this, drawingAreaProxy, isGLMode);
m_renderer = adoptRef(renderer);
#else
m_renderer = adoptRef(new WebLayerTreeRenderer(this, drawingAreaProxy, isGLMode));
void LayerTreeCoordinatorProxy::updateTileForLayer(int layerID, int tileID, const IntRect& targetRect, const WebKit::SurfaceUpdateInfo& updateInfo)
{
RefPtr<ShareableSurface> surface;
-#if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
+#if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION) && ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
if (!m_renderer->isUsingPlatformSurface()) {
#endif
#if USE(GRAPHICS_SURFACE)
#else
surface = ShareableSurface::create(updateInfo.surfaceHandle);
#endif
-#if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
+#if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION) && ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
}
#endif
#if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
#if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
- dispatchUpdate(bind(&WebLayerTreeRenderer::updateTileWithUpdateInfo, m_renderer.get(), layerID, tileID, WebLayerTreeRenderer::TileUpdate(updateInfo.updateRect, targetRect, surface, updateInfo.surfaceOffset, updateInfo.platformSurfaceID, updateInfo.platformSurfaceSize)));
-#else
- dispatchUpdate(bind(&WebLayerTreeRenderer::updateTileWithUpdateInfo, m_renderer.get(), layerID, tileID, WebLayerTreeRenderer::TileUpdate(updateInfo.updateRect, targetRect, surface, updateInfo.surfaceOffset)));
+ if (m_renderer->isUsingPlatformSurface())
+ dispatchUpdate(bind(&WebLayerTreeRenderer::updateTileWithUpdateInfo, m_renderer.get(), layerID, tileID, WebLayerTreeRenderer::TileUpdate(updateInfo.updateRect, targetRect, surface, updateInfo.surfaceOffset, updateInfo.platformSurfaceID, updateInfo.platformSurfaceSize)));
+ else
#endif
+ dispatchUpdate(bind(&WebLayerTreeRenderer::updateTileWithUpdateInfo, m_renderer.get(), layerID, tileID, WebLayerTreeRenderer::TileUpdate(updateInfo.updateRect, targetRect, surface, updateInfo.surfaceOffset)));
#else
#if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
- dispatchUpdate(bind(&WebLayerTreeRenderer::updatePlatformSurfaceTile, m_renderer.get(), layerID, tileID, updateInfo.updateRect, updateInfo.platformSurfaceID, updateInfo.platformSurfaceSize));
-#else
- dispatchUpdate(bind(&WebLayerTreeRenderer::updateTile, m_renderer.get(), layerID, tileID, WebLayerTreeRenderer::TileUpdate(updateInfo.updateRect, targetRect, surface, updateInfo.surfaceOffset)));
+ if (m_renderer->isUsingPlatformSurface())
+ dispatchUpdate(bind(&WebLayerTreeRenderer::updatePlatformSurfaceTile, m_renderer.get(), layerID, tileID, updateInfo.updateRect, updateInfo.platformSurfaceID, updateInfo.platformSurfaceSize));
+ else
#endif
+ dispatchUpdate(bind(&WebLayerTreeRenderer::updateTile, m_renderer.get(), layerID, tileID, WebLayerTreeRenderer::TileUpdate(updateInfo.updateRect, targetRect, surface, updateInfo.surfaceOffset)));
#endif
}
int platformSurfaceID;
WebCore::IntSize platformSurfaceSize;
TileUpdate(const WebCore::IntRect& source, const WebCore::IntRect& target, PassRefPtr<ShareableSurface> newSurface, const WebCore::IntPoint& newOffset, int pmID, WebCore::IntSize pmSize)
-#else
- TileUpdate(const WebCore::IntRect& source, const WebCore::IntRect& target, PassRefPtr<ShareableSurface> newSurface, const WebCore::IntPoint& newOffset)
-#endif
: sourceRect(source)
, targetRect(target)
, surface(newSurface)
, offset(newOffset)
-#if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
, platformSurfaceID(pmID)
, platformSurfaceSize(pmSize)
-#endif
{
}
+#endif
+ TileUpdate(const WebCore::IntRect& source, const WebCore::IntRect& target, PassRefPtr<ShareableSurface> newSurface, const WebCore::IntPoint& newOffset)
+ : sourceRect(source)
+ , targetRect(target)
+ , surface(newSurface)
+ , offset(newOffset)
+ {
+ }
};
WebLayerTreeRenderer(LayerTreeCoordinatorProxy*);
virtual ~WebLayerTreeRenderer();
void updateTile(WebLayerID, int, const TileUpdate&);
#if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
virtual void updateTileWithUpdateInfo(WebLayerID, int, const TileUpdate&);
- virtual bool isUsingPlatformSurface() { return false; }
#endif
TIZEN_VIRTUAL void flushLayerChanges();
-
void createImage(int64_t, PassRefPtr<ShareableBitmap>);
void destroyImage(int64_t);
void setLayerAnimations(WebLayerID, const WebCore::GraphicsLayerAnimations&);
TIZEN_VIRTUAL void clearBackingStores();
#if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
+ virtual bool isUsingPlatformSurface() { return false; }
virtual void freePlatformSurface() { }
virtual bool hasPlatformSurfaceToFree() { return false; }
#include "Page.h"
#include "TextureMapperPlatformLayer.h"
#include "TiledBackingStoreRemoteTile.h"
+#include "SharedPlatformSurfaceTizen.h"
#include "WebPage.h"
#include <wtf/CurrentTime.h>
#include <wtf/HashMap.h>
void WebGraphicsLayer::createBackingStore()
{
+
#if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
+ if (SharedPlatformSurfaceTizen::supportsLockSurfaceExtension()) {
#if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
- if (!m_webGraphicsLayerClient->isGLAccelerationMode())
+ if (!m_webGraphicsLayerClient->isGLAccelerationMode())
+ m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
+ else
+#endif // TIZEN_RUNTIME_BACKEND_SELECTION
+ m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackendTizen::create(this)));
+ } else {
m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
- else
-#endif
- m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackendTizen::create(this)));
+ }
#else
m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
#endif
+
m_mainBackingStore->setSupportsAlpha(!contentsOpaque());
m_mainBackingStore->setContentsScale(effectiveContentsScale());
}