qt5-base-nouveau-freeze.patch 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. From 97600d2c2885e667ced0926815b5a12a7f25285c Mon Sep 17 00:00:00 2001
  2. From: Allan Sandfeld Jensen <allan.jensen@qt.io>
  3. Date: Mon, 19 Feb 2018 10:23:15 +0100
  4. Subject: White-list more recent Mesa version for multi-threading
  5. The issue we had has been fixed for years, but was unfortunately in
  6. libxcb which we can't check at runtime. Instead assume very recent
  7. Mesa drivers works.
  8. Change-Id: I5fdd726b480b77edbedc0f369ae82ab4acbb77c9
  9. Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
  10. Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
  11. ---
  12. .../gl_integrations/xcb_glx/qglxintegration.cpp | 60 +++++++++-------------
  13. 1 file changed, 25 insertions(+), 35 deletions(-)
  14. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
  15. index 741885e321..6316aa2d99 100644
  16. --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
  17. +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
  18. @@ -51,6 +51,7 @@
  19. #undef register
  20. #include <GL/glx.h>
  21. +#include <QtCore/QRegularExpression>
  22. #include <QtGui/QOpenGLContext>
  23. #include <QtGui/QOffscreenSurface>
  24. @@ -692,32 +693,6 @@ static const char *qglx_threadedgl_blacklist_renderer[] = {
  25. 0
  26. };
  27. -// This disables threaded rendering on anything using mesa, e.g.
  28. -// - nvidia/nouveau
  29. -// - amd/gallium
  30. -// - intel
  31. -// - some software opengl implementations
  32. -//
  33. -// The client glx vendor string is used to identify those setups as that seems to show the least
  34. -// variance between the bad configurations. It's always "Mesa Project and SGI". There are some
  35. -// configurations which don't use mesa and which can do threaded rendering (amd and nvidia chips
  36. -// with their own proprietary drivers).
  37. -//
  38. -// This, of course, is very broad and disables threaded rendering on a lot of devices which would
  39. -// be able to use it. However, the bugs listed below don't follow any easily recognizable pattern
  40. -// and we should rather be safe.
  41. -//
  42. -// http://cgit.freedesktop.org/xcb/libxcb/commit/?id=be0fe56c3bcad5124dcc6c47a2fad01acd16f71a will
  43. -// fix some of the issues. Basically, the proprietary drivers seem to have a way of working around
  44. -// a fundamental flaw with multithreaded access to xcb, but mesa doesn't. The blacklist should be
  45. -// reevaluated once that patch is released in some version of xcb.
  46. -static const char *qglx_threadedgl_blacklist_vendor[] = {
  47. - "Mesa Project and SGI", // QTCREATORBUG-10875 (crash in creator)
  48. - // QTBUG-34492 (flickering in fullscreen)
  49. - // QTBUG-38221
  50. - 0
  51. -};
  52. -
  53. void QGLXContext::queryDummyContext()
  54. {
  55. if (m_queriedDummyContext)
  56. @@ -777,18 +752,33 @@ void QGLXContext::queryDummyContext()
  57. }
  58. }
  59. - if (glxvendor) {
  60. - for (int i = 0; qglx_threadedgl_blacklist_vendor[i]; ++i) {
  61. - if (strstr(glxvendor, qglx_threadedgl_blacklist_vendor[i]) != 0) {
  62. - qCDebug(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: "
  63. - "blacklisted vendor \""
  64. - << qglx_threadedgl_blacklist_vendor[i]
  65. - << "\"";
  66. + if (glxvendor && m_supportsThreading) {
  67. + // Blacklist Mesa drivers due to QTCREATORBUG-10875 (crash in creator),
  68. + // QTBUG-34492 (flickering in fullscreen) and QTBUG-38221
  69. + const char *mesaVersionStr = nullptr;
  70. + if (strstr(glxvendor, "Mesa Project") != 0) {
  71. + mesaVersionStr = (const char *) glGetString(GL_VERSION);
  72. + m_supportsThreading = false;
  73. + }
  74. - m_supportsThreading = false;
  75. - break;
  76. + if (mesaVersionStr) {
  77. + // The issue was fixed in Xcb 1.11, but we can't check for that
  78. + // at runtime, so instead assume it fixed with recent Mesa versions
  79. + // released several years after the Xcb fix.
  80. + QRegularExpression versionTest(QStringLiteral("Mesa (\\d+)"));
  81. + QRegularExpressionMatch result = versionTest.match(QString::fromLatin1(mesaVersionStr));
  82. + int versionNr = 0;
  83. + if (result.hasMatch())
  84. + versionNr = result.captured(1).toInt();
  85. + if (versionNr >= 17) {
  86. + // White-listed
  87. + m_supportsThreading = true;
  88. }
  89. }
  90. + if (!m_supportsThreading) {
  91. + qCDebug(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: "
  92. + "blacklisted vendor \"Mesa Project\"";
  93. + }
  94. }
  95. context.doneCurrent();
  96. --
  97. cgit v1.2.1