#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
#include <wtf/StdLibExtras.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
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<String> vendorComponents;
+ vendor.lower().split(' ', vendorComponents);
+
+ if (vendorComponents.contains("imagination") || vendorComponents.contains("mesa") || vendorComponents.contains("arm"))
+ needsMakeCurrent = false;
+ }
+
+ return needsMakeCurrent;
+}
+
namespace WebCore {
Display* g_nativeDisplay;
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) {