From 22e153e654ce912f2b7e8d4746b60a624208a11b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 19 Sep 2024 20:36:21 +0200 Subject: Show warning when selecting hevc/av1 on amd because of amd driver/ffmpeg bug --- src/config.hpp | 4 ++++ src/main.cpp | 32 +++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/config.hpp b/src/config.hpp index 4e01b6b..4cd0524 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -40,6 +40,8 @@ struct MainConfig { bool hide_window_when_recording = false; bool software_encoding_warning_shown = false; bool steam_deck_warning_shown = false; + bool hevc_amd_bug_warning_shown = false; + bool av1_amd_bug_warning_shown = false; bool restore_portal_session = true; }; @@ -319,6 +321,8 @@ static std::map get_config_options(Config &config) { {"main.hide_window_when_recording", {CONFIG_TYPE_BOOL, &config.main_config.hide_window_when_recording}}, {"main.software_encoding_warning_shown", {CONFIG_TYPE_BOOL, &config.main_config.software_encoding_warning_shown}}, {"main.steam_deck_warning_shown", {CONFIG_TYPE_BOOL, &config.main_config.steam_deck_warning_shown}}, + {"main.hevc_amd_bug_warning_shown", {CONFIG_TYPE_BOOL, &config.main_config.hevc_amd_bug_warning_shown}}, + {"main.av1_amd_bug_warning_shown", {CONFIG_TYPE_BOOL, &config.main_config.av1_amd_bug_warning_shown}}, {"main.restore_portal_session", {CONFIG_TYPE_BOOL, &config.main_config.restore_portal_session}}, {"streaming.service", {CONFIG_TYPE_STRING, &config.streaming_config.streaming_service}}, diff --git a/src/main.cpp b/src/main.cpp index 2b6cac9..e40f5ae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1362,10 +1362,36 @@ static bool show_pkexec_flatpak_error_if_needed() { return false; } +static void show_bugged_driver_warning() { + if(gsr_info.gpu_info.vendor != GpuVendor::AMD) + return; + + const std::string video_codec = video_codec_selection_menu_get_active_id(); + if((video_codec == "hevc" || video_codec == "hevc_10bit" || video_codec == "hevc_hdr") && !config.main_config.hevc_amd_bug_warning_shown) { + GtkWidget *dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, + "There is an AMD driver bug and FFmpeg bug that causes black bars to appear on the sides of the video at certain resolutions when using HEVC codec.\n" + "Select H264 video codec instead if this is an issue for you."); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + config.main_config.hevc_amd_bug_warning_shown = true; + } + + if((video_codec == "av1" || video_codec == "av1_10bit" || video_codec == "av1_hdr") && !config.main_config.av1_amd_bug_warning_shown) { + GtkWidget *dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, + "There is an AMD hardware bug that causes black bars to appear on the sides of the video at certain resolutions when using AV1 codec.\n" + "Select H264 video codec instead if this is an issue for you."); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + config.main_config.av1_amd_bug_warning_shown = true; + } +} + static gboolean on_start_replay_click(GtkButton*, gpointer userdata) { if(show_pkexec_flatpak_error_if_needed()) return true; + show_bugged_driver_warning(); + PageNavigationUserdata *_page_navigation_userdata = (PageNavigationUserdata*)userdata; gtk_stack_set_visible_child(_page_navigation_userdata->stack, _page_navigation_userdata->replay_page); app_indicator_set_menu(app_indicator, GTK_MENU(create_systray_menu(_page_navigation_userdata->app, SystrayPage::REPLAY))); @@ -1380,6 +1406,8 @@ static gboolean on_start_recording_click(GtkButton*, gpointer userdata) { if(show_pkexec_flatpak_error_if_needed()) return true; + show_bugged_driver_warning(); + PageNavigationUserdata *_page_navigation_userdata = (PageNavigationUserdata*)userdata; gtk_stack_set_visible_child(_page_navigation_userdata->stack, _page_navigation_userdata->recording_page); app_indicator_set_menu(app_indicator, GTK_MENU(create_systray_menu(_page_navigation_userdata->app, SystrayPage::RECORDING))); @@ -1400,6 +1428,8 @@ static gboolean on_start_streaming_click(GtkButton*, gpointer userdata) { if(show_pkexec_flatpak_error_if_needed()) return true; + show_bugged_driver_warning(); + int num_audio_tracks = 0; for_each_used_audio_input(GTK_LIST_BOX(audio_input_used_list), [&num_audio_tracks](const AudioRow*) { ++num_audio_tracks; @@ -2629,7 +2659,7 @@ static GtkWidget* create_common_settings_page(GtkStack *stack, GtkApplication *a if(gsr_info.system_info.display_server == DisplayServer::WAYLAND) { gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, gsr_info.supported_capture_options.portal ? "Desktop portal (Experimental, HDR not supported)" : "Desktop portal (Not available on your system)", -1); + gtk_list_store_set(store, &iter, 0, gsr_info.supported_capture_options.portal ? "Desktop portal (HDR not supported)" : "Desktop portal (Not available on your system)", -1); gtk_list_store_set(store, &iter, 1, "portal", -1); } else { gtk_list_store_append(store, &iter); -- cgit v1.2.3