From 535674d180f78191eb61157e96552aef2e84816b Mon Sep 17 00:00:00 2001 From: tytan652 Date: Sun, 27 Oct 2024 17:34:03 +0100 Subject: [PATCH] Blacklist NVIDIA driver for hardware accel under Linux Testers have reported that CEF and NVIDIA driver does not seem to work well together. --- cmake/os-linux.cmake | 2 +- obs-browser-plugin.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cmake/os-linux.cmake b/cmake/os-linux.cmake index e4da2fe95..6fd5b776f 100644 --- a/cmake/os-linux.cmake +++ b/cmake/os-linux.cmake @@ -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) diff --git a/obs-browser-plugin.cpp b/obs-browser-plugin.cpp index 55482da6b..e0bd790a4 100644 --- a/obs-browser-plugin.cpp +++ b/obs-browser-plugin.cpp @@ -56,6 +56,7 @@ #endif #if !defined(_WIN32) && !defined(__APPLE__) +#include #include "drm-format.hpp" #endif @@ -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) {