From c854294dc82dbbcc5fc6795f6f38fe32725e97b9 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 5 May 2017 16:45:29 +0100 Subject: [PATCH] Add calls to XInitThreads() to allow driver multithreading optimisations --- qrenderdoc/Code/qrenderdoc.cpp | 4 ++++ renderdoccmd/renderdoccmd_linux.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/qrenderdoc/Code/qrenderdoc.cpp b/qrenderdoc/Code/qrenderdoc.cpp index 2613a4929..97e8b7d14 100644 --- a/qrenderdoc/Code/qrenderdoc.cpp +++ b/qrenderdoc/Code/qrenderdoc.cpp @@ -52,6 +52,10 @@ void sharedLogOutput(QtMsgType type, const QMessageLogContext &context, const QS int main(int argc, char *argv[]) { + // call this as the very first thing - no-op on other platforms, but on linux it means + // XInitThreads will be called allowing driver access to xlib on multiple threads. + QCoreApplication::setAttribute(Qt::AA_X11InitThreads); + qInstallMessageHandler(sharedLogOutput); qInfo() << "QRenderDoc initialising."; diff --git a/renderdoccmd/renderdoccmd_linux.cpp b/renderdoccmd/renderdoccmd_linux.cpp index 52eb22b74..4be601c5b 100644 --- a/renderdoccmd/renderdoccmd_linux.cpp +++ b/renderdoccmd/renderdoccmd_linux.cpp @@ -210,6 +210,9 @@ void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &display // need to create a hybrid setup xlib and xcb in case only one or the other is supported. // We'll prefer xcb + // call XInitThreads - although we don't use xlib concurrently the driver might need to. + XInitThreads(); + Display *display = XOpenDisplay(NULL); if(display == NULL)