From 0b72c15041af2f2c890fd645ab3118c125864627 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 22 Jul 2023 02:59:37 +0200 Subject: Restrict recording to drm card controlled displays on amd/intel --- TODO | 3 ++- src/main.cpp | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/TODO b/TODO index 9b9ee92..cece952 100644 --- a/TODO +++ b/TODO @@ -5,4 +5,5 @@ Disable overclocking and show some kind of sign that overclocking is not possibl Button (in the field) to remove hotkey. Implement global hotkeys on wayland. Add pipewire capture option. -Error if polkit agent is not running (pkexec --help may work but the agent might not be running anyways). \ No newline at end of file +Error if polkit agent is not running (pkexec --help may work but the agent might not be running anyways). +Fix gui crash on stop recording on sway. \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index a9a777b..f78330e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2016,7 +2016,7 @@ static bool audio_inputs_contains(const std::vector &audio_inputs, c } static void get_connection_by_active_type(void **connection, gsr_connection_type *connection_type) { - if(wayland) { + if(wayland || gpu_inf.vendor != GPU_VENDOR_NVIDIA) { if(gsr_egl_supports_wayland_capture(&egl)) { *connection = &egl; *connection_type = GSR_CONNECTION_WAYLAND; @@ -2860,7 +2860,16 @@ static void activate(GtkApplication *app, gpointer) { return; } - if(wayland && !gsr_egl_supports_wayland_capture(&egl)) { + if(!gl_get_gpu_info(&egl, &gpu_inf)) { + GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "Failed to get OpenGL information. Make sure your GPU drivers are properly installed."); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + g_application_quit(G_APPLICATION(app)); + return; + } + + if((gpu_inf.vendor != GPU_VENDOR_NVIDIA) || (wayland && !gsr_egl_supports_wayland_capture(&egl))) { if(!gsr_get_valid_card_path(drm_card_path)) { GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Failed to find a valid DRM card."); @@ -2873,15 +2882,6 @@ static void activate(GtkApplication *app, gpointer) { drm_card_path[0] = '\0'; } - if(!gl_get_gpu_info(&egl, &gpu_inf)) { - GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Failed to get OpenGL information. Make sure your GPU drivers are properly installed."); - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - g_application_quit(G_APPLICATION(app)); - return; - } - if(gpu_inf.vendor == GPU_VENDOR_NVIDIA) { if(!is_cuda_installed()) { GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, -- cgit v1.2.3-70-g09d2