Skip to content

Commit

Permalink
Blacklist NVIDIA driver for hardware accel under Linux
Browse files Browse the repository at this point in the history
Testers have reported that CEF and NVIDIA driver does not seem to work
well together.
  • Loading branch information
tytan652 committed Oct 27, 2024
1 parent 7c2b9f2 commit 535674d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/os-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ target_compile_definitions(obs-browser PRIVATE ENABLE_BROWSER_QT_LOOP)

target_include_directories(obs-browser PRIVATE ${libdrm_include_directories})

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

target_sources(obs-browser PRIVATE drm-format.cpp drm-format.hpp)
Expand Down
24 changes: 24 additions & 0 deletions obs-browser-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#endif

#if !defined(_WIN32) && !defined(__APPLE__)
#include <glad/glad.h>
#include "drm-format.hpp"
#endif

Expand Down Expand Up @@ -700,6 +701,29 @@ static void check_hwaccel_support(void)
}
}
}
#elif __linux__
static void check_hwaccel_support(void)
{
/* NOTE: GL_VERSION returns a string that contains the driver vendor */
const char *glVersion = NULL;

obs_enter_graphics();
gladLoadGL();
glVersion = (const char *)glGetString(GL_VERSION);
obs_leave_graphics();

if (strstr(glVersion, "NVIDIA") != NULL)
{
hwaccel = false;
blog(LOG_INFO, "[obs-browser]: "
"Blacklisted driver "
"detected, "
"disabling browser "
"source hardware "
"acceleration.");
}
return;
}
#else
static void check_hwaccel_support(void)
{
Expand Down

0 comments on commit 535674d

Please sign in to comment.