summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2014-07-07 17:19:49 +0200
committerAndras Becsi <andras.becsi@digia.com>2014-08-06 19:25:30 +0200
commitadcb7979a5f7193d1b8c6b87c0f2c92cfa80a316 (patch)
treea5e6aa33178b20b72d3487a8add6dc3aca0b9f9a /src
parent3b1caeb21a66ca939854b897824e9e853ba60b67 (diff)
Remove duplicate code for egl extensions and native display querying
This is now possible through GLSurfaceQt, and GLContextHelper respectively. Change-Id: I06e13ccdea9737dc41b034befb4f01aa08d72c2a Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/chromium_overrides.cpp13
-rw-r--r--src/core/delegated_frame_node.cpp12
-rw-r--r--src/core/gl_surface_qt.cpp5
-rw-r--r--src/core/gl_surface_qt.h2
4 files changed, 12 insertions, 20 deletions
diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp
index 2b1b1632e..a1758768d 100644
--- a/src/core/chromium_overrides.cpp
+++ b/src/core/chromium_overrides.cpp
@@ -41,10 +41,10 @@
#include "chromium_overrides.h"
+#include "gl_context_qt.h"
#include "qtwebenginecoreglobal.h"
#include "base/values.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
-
#include "content/browser/renderer_host/pepper/pepper_truetype_font_list.h"
#include "content/common/font_list.h"
@@ -59,7 +59,6 @@
#if defined(USE_X11)
#include "base/message_loop/message_pump_x11.h"
-#include <X11/Xlib.h>
#endif
#if defined(USE_AURA) && !defined(USE_OZONE)
@@ -90,14 +89,8 @@ namespace base {
#if defined(USE_X11)
Display* MessagePumpForUI::GetDefaultXDisplay() {
- static void *display = qApp->platformNativeInterface()->nativeResourceForScreen(QByteArrayLiteral("display"), qApp->primaryScreen());
- if (!display) {
- // XLib isn't available or has not been initialized, which is a decision we wish to
- // support, for example for the GPU process.
- static Display* xdisplay = XOpenDisplay(NULL);
- return xdisplay;
- }
- return static_cast<Display*>(display);
+ static void *display = GLContextHelper::getXDisplay();
+ return static_cast<Display*>(display);
}
#endif
diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp
index 434530e17..60be2e6cc 100644
--- a/src/core/delegated_frame_node.cpp
+++ b/src/core/delegated_frame_node.cpp
@@ -51,6 +51,7 @@
#include "delegated_frame_node.h"
#include "chromium_gpu_helper.h"
+#include "gl_surface_qt.h"
#include "stream_video_node.h"
#include "type_conversion.h"
#include "yuv_video_node.h"
@@ -206,15 +207,6 @@ static QSGNode *buildLayerChain(QSGNode *chainParent, const cc::SharedQuadState
return layerChain;
}
-#if !defined(QT_NO_EGL)
-static bool hasEGLExtension(EGLDisplay display, const char *name)
-{
- QList<QByteArray> extensions = QByteArray(reinterpret_cast<const char *>(
- eglQueryString(display, EGL_EXTENSIONS))).split(' ');
- return extensions.contains(name);
-}
-#endif
-
static void waitAndDeleteChromiumSync(FenceSync *sync)
{
// Chromium uses its own GL bindings and stores in in thread local storage.
@@ -231,7 +223,7 @@ static void waitAndDeleteChromiumSync(FenceSync *sync)
static PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR = 0;
if (!resolved) {
- if (hasEGLExtension(sync->egl.display, "EGL_KHR_reusable_sync")) {
+ if (gfx::GLSurfaceQt::HasEGLExtension("EGL_KHR_reusable_sync")) {
QOpenGLContext *context = QOpenGLContext::currentContext();
eglClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC)context->getProcAddress("eglClientWaitSyncKHR");
eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC)context->getProcAddress("eglDestroySyncKHR");
diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp
index d8d306c5c..a338fe5cd 100644
--- a/src/core/gl_surface_qt.cpp
+++ b/src/core/gl_surface_qt.cpp
@@ -316,6 +316,11 @@ GLSurfaceQt::GLSurfaceQt(const gfx::Size& size)
{
}
+bool GLSurfaceQt::HasEGLExtension(const char* name)
+{
+ return ExtensionsContain(g_extensions, name);
+}
+
GLSurfaceQtEGL::GLSurfaceQtEGL(const gfx::Size& size)
: GLSurfaceQt(size),
m_surfaceBuffer(0)
diff --git a/src/core/gl_surface_qt.h b/src/core/gl_surface_qt.h
index 010f7064a..70b5fb6b6 100644
--- a/src/core/gl_surface_qt.h
+++ b/src/core/gl_surface_qt.h
@@ -53,6 +53,8 @@ class GLSurfaceQt: public GLSurface {
public:
explicit GLSurfaceQt(const gfx::Size& size);
+ static bool HasEGLExtension(const char* name);
+
// Implement GLSurface.
virtual void* GetDisplay() Q_DECL_OVERRIDE;
virtual void* GetConfig() Q_DECL_OVERRIDE;