summaryrefslogtreecommitdiffstats
path: root/src/core/chromium_gpu_helper.h
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-04-10 17:32:36 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-10 21:03:22 +0200
commit682ddcd7187b16723af66d7f9c1b61bc060f44c1 (patch)
treeda181af0cbb3656a95c6b3c3b0708d6fda91a369 /src/core/chromium_gpu_helper.h
parentf61493ee97f285e4b7257f7590f45764980ca52e (diff)
Use a fence sync to synchronize GL between threads
The NVidia driver needs more than a glFlush to ensure that GL commands consuming Chromium resources are run only when the resource is completely produced by the Chromium GPU thread. This produces artifacts and an uneven frame rate in WebGL examples on this kind of hardware. Use the same mechanism as used by gfx::GLFence, doing a few things manually to cope with the fact that Chromium and Qt both have their own GL function table and contexts. Change-Id: I33eeb1068994dc4176038a74579ce768b2bccb9d Reviewed-by: Andras Becsi <andras.becsi@digia.com> Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'src/core/chromium_gpu_helper.h')
-rw-r--r--src/core/chromium_gpu_helper.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/core/chromium_gpu_helper.h b/src/core/chromium_gpu_helper.h
index 09ae5a77e..285554cc9 100644
--- a/src/core/chromium_gpu_helper.h
+++ b/src/core/chromium_gpu_helper.h
@@ -60,11 +60,38 @@ class Texture;
}
}
+typedef void *EGLDisplay;
+typedef void *EGLSyncKHR;
+typedef struct __GLsync *GLsync;
+
+union FenceSync {
+ enum SyncType {
+ NoSync,
+ EglSync,
+ ArbSync
+ };
+ SyncType type;
+ struct {
+ SyncType type;
+ EGLDisplay display;
+ EGLSyncKHR sync;
+ } egl;
+ struct {
+ SyncType type;
+ GLsync sync;
+ } arb;
+
+ FenceSync() : type(NoSync) { }
+ operator bool() { return type != NoSync; }
+ void reset() { type = NoSync; }
+};
+
// These functions wrap code that needs to include headers that are
// incompatible with Qt GL headers.
// From the outside, types from incompatible headers referenced in these
// functions should only be forward-declared and considered as opaque types.
+FenceSync createFence();
base::MessageLoop *gpu_message_loop();
content::SyncPointManager *sync_point_manager();
gpu::gles2::MailboxManager *mailbox_manager();