Skip to content

Commit b957a0a

Browse files
committed
Blacklist NVIDIA driver for hardware accel under Linux
Testers have reported that CEF and NVIDIA driver does not seem to work well together.
1 parent 7c2b9f2 commit b957a0a

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

cmake/os-linux.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ target_compile_definitions(obs-browser PRIVATE ENABLE_BROWSER_QT_LOOP)
66

77
target_include_directories(obs-browser PRIVATE ${libdrm_include_directories})
88

9-
target_link_libraries(obs-browser PRIVATE CEF::Wrapper CEF::Library X11::X11)
9+
target_link_libraries(obs-browser PRIVATE CEF::Wrapper CEF::Library X11::X11 OBS::glad)
1010
set_target_properties(obs-browser PROPERTIES BUILD_RPATH "$ORIGIN/" INSTALL_RPATH "$ORIGIN/")
1111

1212
target_sources(obs-browser PRIVATE drm-format.cpp drm-format.hpp)

obs-browser-plugin.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#endif
5757

5858
#if !defined(_WIN32) && !defined(__APPLE__)
59+
#include <glad/glad.h>
5960
#include "drm-format.hpp"
6061
#endif
6162

@@ -700,6 +701,28 @@ static void check_hwaccel_support(void)
700701
}
701702
}
702703
}
704+
#elif __linux__
705+
static void check_hwaccel_support(void)
706+
{
707+
/* NOTE: GL_VERSION returns a string that contains the driver vendor */
708+
const char *glVersion = NULL;
709+
710+
obs_enter_graphics();
711+
gladLoadGL();
712+
glVersion = (const char *)glGetString(GL_VERSION);
713+
obs_leave_graphics();
714+
715+
if (strstr(glVersion, "NVIDIA") != NULL) {
716+
hwaccel = false;
717+
blog(LOG_INFO, "[obs-browser]: "
718+
"Blacklisted driver "
719+
"detected, "
720+
"disabling browser "
721+
"source hardware "
722+
"acceleration.");
723+
}
724+
return;
725+
}
703726
#else
704727
static void check_hwaccel_support(void)
705728
{

0 commit comments

Comments
 (0)