Default value is On.
Therefore, if you want to disable direct rendering explicitly,
set the env value "TIZEN_WEBKIT_DIRECT_RENDERING" as 0.
[Title] Use the env value "TIZEN_WEBKIT_DIRECT_RENDERING" to enable EVAS_GL_DIRECT_RENDERING.
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] N/A
Change-Id: Ia039c9b7a809010d542ebdbff90f1f3b5dc700e3
Conflicts:
Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
namespace WebCore {
#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
static int gAngle = 0;
+static bool gDirectRendering = false;
#endif
struct TextureMapperGLData {
GLint viewport[4];
GL_CMD(glGetIntegerv(GL_VIEWPORT, viewport));
#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
- if (gAngle == 90)
- GL_CMD(glScissor(viewport[3] - rect.maxX(), viewport[2] - rect.maxY(), rect.width(), rect.height()));
- else if (gAngle == 180)
- GL_CMD(glScissor(viewport[2] - rect.maxX(), rect.y(), rect.width(), rect.height()));
- else if (gAngle == 270)
- GL_CMD(glScissor(rect.x(), rect.y(), rect.width(), rect.height()));
- else
+ if (gDirectRendering) {
+ if (gAngle == 90)
+ GL_CMD(glScissor(viewport[3] - rect.maxX(), viewport[2] - rect.maxY(), rect.width(), rect.height()));
+ else if (gAngle == 180)
+ GL_CMD(glScissor(viewport[2] - rect.maxX(), rect.y(), rect.width(), rect.height()));
+ else if (gAngle == 270)
+ GL_CMD(glScissor(rect.x(), rect.y(), rect.width(), rect.height()));
+ else
+ GL_CMD(glScissor(rect.x(), viewport[3] - rect.maxY(), rect.width(), rect.height()));
+ } else
#endif
GL_CMD(glScissor(rect.x(), viewport[3] - rect.maxY(), rect.width(), rect.height()));
}
, m_context(0)
, m_enableEdgeDistanceAntialiasing(false)
{
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ char* directRenderingEnv = getenv("TIZEN_WEBKIT_DIRECT_RENDERING");
+ gDirectRendering = directRenderingEnv ? atoi(directRenderingEnv) : true;
+#endif
}
TextureMapperGL::ClipStack& TextureMapperGL::clipStack()
return;
#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
- data().didModifyStencil = false;
- GL_CMD(glGetIntegerv(GL_VIEWPORT, data().viewport));
- m_clipStack.init(IntRect(0, 0, data().viewport[2], data().viewport[3]));
- GL_CMD(glGetIntegerv(GL_FRAMEBUFFER_BINDING, &data().targetFrameBuffer));
-#else
+ if (gDirectRendering) {
+ data().didModifyStencil = false;
+ GL_CMD(glGetIntegerv(GL_VIEWPORT, data().viewport));
+ m_clipStack.init(IntRect(0, 0, data().viewport[2], data().viewport[3]));
+ GL_CMD(glGetIntegerv(GL_FRAMEBUFFER_BINDING, &data().targetFrameBuffer));
+ } else {
+#endif
GL_CMD(glGetIntegerv(GL_CURRENT_PROGRAM, &data().previousProgram));
data().previousScissorState = glIsEnabled(GL_SCISSOR_TEST);
data().previousDepthState = glIsEnabled(GL_DEPTH_TEST);
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &data().targetFrameBuffer);
m_clipStack.init(IntRect(0, 0, data().viewport[2], data().viewport[3]));
GL_CMD(glGetIntegerv(GL_FRAMEBUFFER_BINDING, &data().targetFrameBuffer));
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ }
#endif
data().PaintFlags = flags;
glClear(GL_STENCIL_BUFFER_BIT);
}
-#if !ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ if (gDirectRendering)
+ return;
+#endif
glUseProgram(data().previousProgram);
glScissor(data().previousScissor[0], data().previousScissor[1], data().previousScissor[2], data().previousScissor[3]);
painter->endNativePainting();
painter->restore();
#endif
-#endif
}
#if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
}
#endif
-#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
-static inline TransformationMatrix createProjectionMatrix(const IntSize& size, bool mirrored, int angle = 0)
-#else
static inline TransformationMatrix createProjectionMatrix(const IntSize& size, bool mirrored)
-#endif
{
const float near = 9999999;
const float far = -99999;
#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
- if (angle == 90 || angle == 270)
- return TransformationMatrix(2.0 / float(size.height()), 0, 0, 0,
- 0, (mirrored ? 2.0 : -2.0) / float(size.width()), 0, 0,
- 0, 0, -2.f / (far - near), 0,
- -1, mirrored ? -1 : 1, -(far + near) / (far - near), 1);
- else
+ if (gDirectRendering) {
+ if (gAngle == 90 || gAngle == 270)
+ return TransformationMatrix(2.0 / float(size.height()), 0, 0, 0,
+ 0, (mirrored ? 2.0 : -2.0) / float(size.width()), 0, 0,
+ 0, 0, -2.f / (far - near), 0,
+ -1, mirrored ? -1 : 1, -(far + near) / (far - near), 1);
+
+ else
+ return TransformationMatrix(2.0 / float(size.width()), 0, 0, 0,
+ 0, (mirrored ? 2.0 : -2.0) / float(size.height()), 0, 0,
+ 0, 0, -2.f / (far - near), 0,
+ -1, mirrored ? -1 : 1, -(far + near) / (far - near), 1);
+ } else
#endif
return TransformationMatrix(2.0 / float(size.width()), 0, 0, 0,
0, (mirrored ? 2.0 : -2.0) / float(size.height()), 0, 0,
GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, data().targetFrameBuffer));
IntSize viewportSize(data().viewport[2], data().viewport[3]);
-#if !ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
data().projectionMatrix = createProjectionMatrix(viewportSize, data().PaintFlags & PaintingMirrored);
-#else
- data().projectionMatrix = createProjectionMatrix(viewportSize, data().PaintFlags & PaintingMirrored, gAngle);
-#endif
#if !USE(TIZEN_TEXTURE_MAPPER)
GL_CMD(glViewport(data().viewport[0], data().viewport[1], viewportSize.width(), viewportSize.height()));
return false;
#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
- if (gAngle == 90 || gAngle == 270)
- rect = IntRect(rect.y(), rect.x(), rect.height(), rect.width());
+ if (gDirectRendering)
+ if (gAngle == 90 || gAngle == 270)
+ rect = IntRect(rect.y(), rect.x(), rect.height(), rect.width());
#endif
clipStack().current().scissorBox.intersect(rect);
void PageClientEvasGL::setViewNeedsDisplay(const WebCore::IntRect& rect)
{
-#if !ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
- drawContents();
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ if (!isDirectRendering())
#endif
+ drawContents();
m_viewImpl->redrawRegion(rect);
#if ENABLE(TIZEN_SCREEN_READER)
#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
// We should not draw here when Direct Rendering is enabled.
// Because we will draw directly when evas is updated - on_pixels_for_accelerated_compositing().
- ewk_view_mark_for_sync(m_viewImpl->view());
-#else
- setViewNeedsDisplay(IntRect(IntPoint(), viewSize()));
+ if (isDirectRendering())
+ ewk_view_mark_for_sync(m_viewImpl->view());
+ else
#endif
+ setViewNeedsDisplay(IntRect(IntPoint(), viewSize()));
#if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
updateScrollbar();
void PageClientEvasGL::drawContents()
{
- if (evas_gl_make_current(m_evasGL, m_surface, m_context) != EINA_TRUE)
+ if (!drawingArea() || !(drawingArea()->layerTreeCoordinatorProxy()))
+ return;
+
+ WebLayerTreeRenderer* renderer = drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer();
+ if (!renderer)
+ return;
+
+ if (!makeContextCurrent())
return;
WebCore::TransformationMatrix matrix;
IntSize ewkViewSize = viewSize();
#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
- Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(m_viewImpl->view()));
- m_angle = ecore_evas_rotation_get(ee);
- if (drawingArea())
- drawingArea()->setAngle(m_angle);
- matrix.rotate3d(0.0, 0.0, 1.0, 360 - m_angle);
-
- if (m_angle == 90 || m_angle == 270) {
- glViewport(0, 0, ewkViewSize.height(), ewkViewSize.width());
- if (m_angle == 90)
- matrix.translate(-ewkViewSize.width(), 0);
- else if (m_angle == 270)
- matrix.translate(0, -ewkViewSize.height());
- clipRect = IntRect(IntPoint(), ewkViewSize.transposedSize());
- } else {
+ if (isDirectRendering()) {
+ Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(m_viewImpl->view()));
+ m_angle = ecore_evas_rotation_get(ee);
+ renderer->setAngle(m_angle);
+ matrix.rotate3d(0.0, 0.0, 1.0, 360 - m_angle);
+
+ if (m_angle == 90 || m_angle == 270) {
+ glViewport(0, 0, ewkViewSize.height(), ewkViewSize.width());
+ if (m_angle == 90)
+ matrix.translate(-ewkViewSize.width(), 0);
+ else if (m_angle == 270)
+ matrix.translate(0, -ewkViewSize.height());
+ clipRect = IntRect(IntPoint(), ewkViewSize.transposedSize());
+ } else {
+ glViewport(0, 0, ewkViewSize.width(), ewkViewSize.height());
+ if (m_angle == 180)
+ matrix.translate(-ewkViewSize.width(), -ewkViewSize.height());
+ clipRect = IntRect(IntPoint(), ewkViewSize);
+ }
+ } else
+#endif
+ {
glViewport(0, 0, ewkViewSize.width(), ewkViewSize.height());
- if (m_angle == 180)
- matrix.translate(-ewkViewSize.width(), -ewkViewSize.height());
clipRect = IntRect(IntPoint(), ewkViewSize);
}
-#else
- glViewport(0, 0, ewkViewSize.width(), ewkViewSize.height());
- clipRect = IntRect(IntPoint(), ewkViewSize);
-#endif
+
matrix *= m_viewImpl->transformToView().toTransformationMatrix();
- if (drawingArea()) {
- if (drawingArea()->layerTreeCoordinatorProxy()) {
- WebLayerTreeRenderer* renderer = drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer();
#if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE_BACKUP_IMAGE)
- if (m_shouldMakeBackupTexture) {
- glViewport(0, 0, m_initialViewRect.width(), m_initialViewRect.height());
- glClearColor(1, 1, 1, 1);
- glClear(GL_COLOR_BUFFER_BIT);
- renderer->paintToBackupTexture(matrix, 1.0f, m_initialViewRect, m_bgColor);
- m_shouldMakeBackupTexture = false;
- } else if (m_shouldShowBackupTexture) {
- matrix.makeIdentity();
- glViewport(0, 0, m_initialViewRect.width(), m_initialViewRect.height());
- renderer->showBackupTexture(matrix, 1.0f, m_initialViewRect);
- } else
-#endif
- renderer->paintToCurrentGLContext(matrix, 1.0f, clipRect, m_bgColor);
- }
- }
+ if (m_shouldMakeBackupTexture) {
+ glViewport(0, 0, m_initialViewRect.width(), m_initialViewRect.height());
+ glClearColor(1, 1, 1, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+ renderer->paintToBackupTexture(matrix, 1.0f, m_initialViewRect, m_bgColor);
+ m_shouldMakeBackupTexture = false;
+ } else if (m_shouldShowBackupTexture) {
+ matrix.makeIdentity();
+ glViewport(0, 0, m_initialViewRect.width(), m_initialViewRect.height());
+ renderer->showBackupTexture(matrix, 1.0f, m_initialViewRect);
+ } else
+#endif
+ renderer->paintToCurrentGLContext(matrix, 1.0f, clipRect, m_bgColor);
}
void PageClientEvasGL::didRenderFrame()
m_config = evas_gl_config_new();
#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
- setenv("EVAS_GL_DIRECT_OVERRIDE", "1", 1);
- m_config->options_bits = EVAS_GL_OPTIONS_DIRECT;
+ char* directRenderingEnv = getenv("TIZEN_WEBKIT_DIRECT_RENDERING");
+ if (!directRenderingEnv || atoi(directRenderingEnv)) {
+ setenv("EVAS_GL_DIRECT_OVERRIDE", "1", 1);
+ m_config->options_bits = EVAS_GL_OPTIONS_DIRECT;
+ }
#endif
m_config->color_format = EVAS_GL_RGBA_8888;
m_config->depth_bits = EVAS_GL_DEPTH_BIT_24;
}
#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
- makeContextCurrent();
-#else
- if (makeContextCurrent()) {
- glViewport(0, 0, width, height);
- glClearColor(1.0, 1.0, 1.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- glFinish();
- }
+ if (isDirectRendering())
+ makeContextCurrent();
+ else
#endif
+ {
+ if (makeContextCurrent()) {
+ glViewport(0, 0, width, height);
+ glClearColor(1.0, 1.0, 1.0, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glFinish();
+ }
+ }
Evas_Native_Surface nativeSurface;
if (evas_gl_native_surface_get(m_evasGL, m_surface, &nativeSurface))
void setTargetSurface();
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ bool isDirectRendering() { return (m_config->options_bits == EVAS_GL_OPTIONS_DIRECT); }
+#endif
+
Evas_GL* m_evasGL;
Evas_GL_API* m_evasGlApi;
Evas_GL_Context* m_context;
#endif
#if ENABLE(TIZEN_WEBKIT2_TILED_AC)
-#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
- virtual void setAngle(int) { }
-#endif
virtual void didSuspendPainting() { }
#endif
m_layerTreeCoordinatorProxy->setVisibleContentsRectForScrollingContentsLayers(visibleRect);
}
#endif
-
-#if ENABLE(TIZEN_WEBKIT2_TILED_AC) && ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
-void DrawingAreaProxyImpl::setAngle(int angle)
-{
- if (m_layerTreeCoordinatorProxy)
- m_layerTreeCoordinatorProxy->setAngle(angle);
-}
-#endif
#endif // #if USE(UI_SIDE_COMPOSITING)
void DrawingAreaProxyImpl::exitAcceleratedCompositingMode()
void paint(BackingStore::PlatformGraphicsContext, const WebCore::IntRect&, WebCore::Region& unpaintedRegion);
#if ENABLE(TIZEN_WEBKIT2_TILED_AC)
-#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
- virtual void setAngle(int);
-#endif
virtual void didSuspendPainting();
#endif
}
#if ENABLE(TIZEN_WEBKIT2_TILED_AC)
-#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
-void LayerTreeCoordinatorProxy::setAngle(int angle)
-{
- m_renderer->setAngle(angle);
-}
-#endif
-
void LayerTreeCoordinatorProxy::clearBackingStores()
{
m_renderer->syncRemoteContent();
void setLayerAnimations(WebLayerID, const WebCore::GraphicsLayerAnimations&);
void setAnimationsLocked(bool);
#if ENABLE(TIZEN_WEBKIT2_TILED_AC)
-#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
- void setAngle(int);
-#endif
void clearBackingStores();
#endif