From 4f4a33467f4d41b1224948cc4c5d8828232b141a Mon Sep 17 00:00:00 2001
From: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Date: Tue, 11 Nov 2014 16:15:36 +0100
Subject: [PATCH] Disable accelerated 2D canvas rendering with ANGLE

ANGLE isn't thread-safe and we're already taking a risk by letting
Chromium do texture upload from the GPU thread with a shared GL
context.

Any kind of drawing happening concurrently between the GPU thread and
the Qt scene graph thread might currently end up drawing on the same
device context and this is creating visual artifacts and Direct3D
errors.

We're already disabling WebGL but we should also disable accelerated
2D canvas rendering to lower that risk. We should ultimately disable
ANGLE from within Chromium or fix multithreading issues to properly
support GL rendering scenarios across threads.

Task-number: QTBUG-41627
Change-Id: I37a7a778f0e1066a454f51bb38e98df4dea8767e
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
---
 src/core/web_engine_context.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 20bf3e051..ac9a921e7 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -142,7 +142,11 @@ WebEngineContext::WebEngineContext()
 
 #if defined(OS_WIN)
     parsedCommandLine->AppendSwitch(switches::kDisableD3D11);
+    // ANGLE doesn't support multi-threading, doing texture upload from the GPU thread
+    // hasn't been causing problems yet but doing rendering there is conflicting with
+    // Qt's rendering of the scene graph.
     parsedCommandLine->AppendSwitch(switches::kDisableExperimentalWebGL);
+    parsedCommandLine->AppendSwitch(switches::kDisableAccelerated2dCanvas);
 #endif
 
 #if defined(QTWEBENGINE_MOBILE_SWITCHES)
-- 
GitLab