Skip to content

Commit 00b920f

Browse files
tytan652RytoEX
authored andcommitted
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 be8e590 commit 00b920f

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

cmake/os-linux.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get_target_property(libdrm_include_directories Libdrm::Libdrm INTERFACE_INCLUDE_
44

55
target_include_directories(obs-browser PRIVATE ${libdrm_include_directories})
66

7-
target_link_libraries(obs-browser PRIVATE CEF::Wrapper CEF::Library X11::X11)
7+
target_link_libraries(obs-browser PRIVATE CEF::Wrapper CEF::Library X11::X11 OBS::glad)
88
set_target_properties(obs-browser PROPERTIES BUILD_RPATH "$ORIGIN/" INSTALL_RPATH "$ORIGIN/")
99

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

obs-browser-plugin.cpp

Lines changed: 19 additions & 0 deletions
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

@@ -705,6 +706,24 @@ static void check_hwaccel_support(void)
705706
}
706707
}
707708
}
709+
#elif __linux__
710+
static void check_hwaccel_support(void)
711+
{
712+
/* NOTE: GL_VERSION returns a string that contains the driver vendor */
713+
const char *glVersion = NULL;
714+
715+
obs_enter_graphics();
716+
gladLoadGL();
717+
glVersion = (const char *)glGetString(GL_VERSION);
718+
obs_leave_graphics();
719+
720+
if (strstr(glVersion, "NVIDIA") != NULL) {
721+
hwaccel = false;
722+
blog(LOG_INFO,
723+
"[obs-browser]: Blacklisted driver detected, disabling browser source hardware acceleration.");
724+
}
725+
return;
726+
}
708727
#else
709728
static void check_hwaccel_support(void)
710729
{

0 commit comments

Comments
 (0)