From eaffaec06e64b3f3ab1d11e4df52e61772f3c0f8 Mon Sep 17 00:00:00 2001 From: Kondapally Kalyan Date: Wed, 8 May 2013 13:52:46 +0300 Subject: [PATCH] [Title] Avoid unnecessary MakeCurrent calls before locking surface. [Issue#] TZSP-5951 [Problem] Redundant EGLMakeCurrent calls on IA before locking surface. [Solution] A call to make surface and context as current before locking the surface was introduced to fix issues for Qualcomm(as per the changelog). This causes a un-necessary regression on IA side. This patch ensures that the makecurrent call is skipped for Imagination, arm and mesa drivers. --- .../efl/tizen/SharedPlatformSurfaceTizen.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp b/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp index 5e76b59..84b5a22 100755 --- a/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp +++ b/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -45,6 +46,24 @@ static PFNEGLLOCKSURFACEKHRPROC eglLockSurfaceKHR = 0; static PFNEGLUNLOCKSURFACEKHRPROC eglUnlockSurfaceKHR = 0; +static bool vendorNeedsMakeCurrent(const EGLDisplay display) +{ + static bool queryDone = false; + static bool needsMakeCurrent = true; + + if (!queryDone) { + queryDone = true; + String vendor = eglQueryString(display, EGL_VENDOR); + Vector vendorComponents; + vendor.lower().split(' ', vendorComponents); + + if (vendorComponents.contains("imagination") || vendorComponents.contains("mesa") || vendorComponents.contains("arm")) + needsMakeCurrent = false; + } + + return needsMakeCurrent; +} + namespace WebCore { Display* g_nativeDisplay; @@ -279,8 +298,7 @@ bool PixmapContextTizen::lockSurface(EGLSurface surface) if (!eglLockSurfaceKHR) eglLockSurfaceKHR = (PFNEGLLOCKSURFACEKHRPROC)eglGetProcAddress("eglLockSurfaceKHR"); - static bool needsMakeCurrent = strcmp(eglQueryString(m_display, EGL_VENDOR), "ARM") != 0; - if (needsMakeCurrent) + if (vendorNeedsMakeCurrent(m_display)) eglMakeCurrent(m_display, surface, surface, m_context); if (eglLockSurfaceKHR(m_display, surface, lockAttrib) != EGL_TRUE) { -- 2.7.4