Merge pull request from 21pages/part-fix-nvidia-crash

optional software render to fix flutter render problem on some nvidia card
This commit is contained in:
RustDesk 2023-01-06 10:27:31 +08:00 committed by GitHub
commit 09435f43df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 175 additions and 2 deletions

1
Cargo.lock generated

@ -4562,6 +4562,7 @@ dependencies = [
"arboard", "arboard",
"async-process", "async-process",
"async-trait", "async-trait",
"backtrace",
"base64", "base64",
"bytes", "bytes",
"cc", "cc",

@ -119,6 +119,7 @@ dbus-crossroads = "0.5"
gtk = "0.15" gtk = "0.15"
libappindicator = "0.7" libappindicator = "0.7"
glib = "0.16.5" glib = "0.16.5"
backtrace = "0.3"
[target.'cfg(target_os = "android")'.dependencies] [target.'cfg(target_os = "android")'.dependencies]
android_logger = "0.11" android_logger = "0.11"

@ -274,6 +274,15 @@ class _GeneralState extends State<_General> {
_OptionCheckBox(context, 'Confirm before closing multiple tabs', _OptionCheckBox(context, 'Confirm before closing multiple tabs',
'enable-confirm-closing-tabs'), 'enable-confirm-closing-tabs'),
_OptionCheckBox(context, 'Adaptive Bitrate', 'enable-abr'), _OptionCheckBox(context, 'Adaptive Bitrate', 'enable-abr'),
if (Platform.isLinux)
Tooltip(
message: translate('software_render_tip'),
child: _OptionCheckBox(
context,
"Always use software rendering",
'allow-always-software-render',
),
)
]); ]);
} }
@ -1223,7 +1232,7 @@ Widget _OptionCheckBox(BuildContext context, String label, String key,
ref.value = option; ref.value = option;
if (reverse) option = !option; if (reverse) option = !option;
String value = bool2option(key, option); String value = bool2option(key, option);
bind.mainSetOption(key: key, value: value); await bind.mainSetOption(key: key, value: value);
update?.call(); update?.call();
} }
} }

@ -38,6 +38,17 @@ pub fn core_main() -> Option<Vec<String>> {
} }
i += 1; i += 1;
} }
#[cfg(target_os = "linux")]
#[cfg(feature = "flutter")]
{
crate::platform::linux::register_breakdown_handler();
let (k, v) = ("LIBGL_ALWAYS_SOFTWARE", "true");
if !hbb_common::config::Config::get_option("allow-always-software-render").is_empty() {
std::env::set_var(k, v);
} else {
std::env::remove_var(k);
}
}
#[cfg(feature = "flutter")] #[cfg(feature = "flutter")]
if _is_flutter_connect { if _is_flutter_connect {
return core_main_invoke_new_connection(std::env::args()); return core_main_invoke_new_connection(std::env::args());

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", "被web控制台手动关闭"), ("Closed manually by the web console", "被web控制台手动关闭"),
("Local keyboard type", "本地键盘类型"), ("Local keyboard type", "本地键盘类型"),
("Select local keyboard type", "请选择本地键盘类型"), ("Select local keyboard type", "请选择本地键盘类型"),
("software_render_tip", "如果你使用英伟达显卡, 并且远程窗口在会话建立后会立刻关闭, 那么安装nouveau驱动并且选择使用软件渲染可能会有帮助。重启软件后生效。"),
("Always use software rendering", "使用软件渲染"),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", "Manuell über die Webkonsole beendet"), ("Closed manually by the web console", "Manuell über die Webkonsole beendet"),
("Local keyboard type", "Lokaler Tastaturtyp"), ("Local keyboard type", "Lokaler Tastaturtyp"),
("Select local keyboard type", "Lokalen Tastaturtyp auswählen"), ("Select local keyboard type", "Lokalen Tastaturtyp auswählen"),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -36,5 +36,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("hide_cm_tip", "Allow hiding only if accepting sessions via password and using permanent password"), ("hide_cm_tip", "Allow hiding only if accepting sessions via password and using permanent password"),
("wayland_experiment_tip", "Wayland support is in experimental stage, please use X11 if you require unattended access."), ("wayland_experiment_tip", "Wayland support is in experimental stage, please use X11 if you require unattended access."),
("Slogan_tip", "Made with heart in this chaotic world!"), ("Slogan_tip", "Made with heart in this chaotic world!"),
("software_render_tip", "If you have an Nvidia graphics card and the remote window closes immediately after connecting, installing the nouveau driver and choosing to use software rendering may help. A software restart is required.")
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", "Cerrado manualmente por la consola web"), ("Closed manually by the web console", "Cerrado manualmente por la consola web"),
("Local keyboard type", "Tipo de teclado local"), ("Local keyboard type", "Tipo de teclado local"),
("Select local keyboard type", "Seleccionar tipo de teclado local"), ("Select local keyboard type", "Seleccionar tipo de teclado local"),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", "Fermé manuellement par la console Web"), ("Closed manually by the web console", "Fermé manuellement par la console Web"),
("Local keyboard type", "Disposition du clavier local"), ("Local keyboard type", "Disposition du clavier local"),
("Select local keyboard type", "Selectionner la disposition du clavier local"), ("Select local keyboard type", "Selectionner la disposition du clavier local"),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", "Chiudi manualmente dalla console Web"), ("Closed manually by the web console", "Chiudi manualmente dalla console Web"),
("Local keyboard type", "Tipo di tastiera locale"), ("Local keyboard type", "Tipo di tastiera locale"),
("Select local keyboard type", "Seleziona il tipo di tastiera locale"), ("Select local keyboard type", "Seleziona il tipo di tastiera locale"),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", "Закрыто вручную через веб-консоль"), ("Closed manually by the web console", "Закрыто вручную через веб-консоль"),
("Local keyboard type", "Тип локальной клавиатуры"), ("Local keyboard type", "Тип локальной клавиатуры"),
("Select local keyboard type", "Выберите тип локальной клавиатуры"), ("Select local keyboard type", "Выберите тип локальной клавиатуры"),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -280,7 +280,6 @@ lazy_static::lazy_static! {
("android_stop_service_tip", "การปิดการใช้งานเซอร์วิสจะปิดการเชื่อมต่อทั้งหมดโดยอัตโนมัติ"), ("android_stop_service_tip", "การปิดการใช้งานเซอร์วิสจะปิดการเชื่อมต่อทั้งหมดโดยอัตโนมัติ"),
("android_version_audio_tip", "เวอร์ชั่นแอนดรอยด์ปัจจุบันของคุณไม่รองรับการบันทึกข้อมูลเสียง กรุณาอัปเกรดเป็นแอนดรอยด์เวอร์ชั่น 10 หรือสูงกว่า"), ("android_version_audio_tip", "เวอร์ชั่นแอนดรอยด์ปัจจุบันของคุณไม่รองรับการบันทึกข้อมูลเสียง กรุณาอัปเกรดเป็นแอนดรอยด์เวอร์ชั่น 10 หรือสูงกว่า"),
("android_start_service_tip", "แตะ [เริ่มต้นใช้งานเซอร์วิส] หรือเปิดสิทธิ์ [การบันทึกหน้าจอ] เพื่อเริ่มเซอร์วิสการแชร์หน้าจอ"), ("android_start_service_tip", "แตะ [เริ่มต้นใช้งานเซอร์วิส] หรือเปิดสิทธิ์ [การบันทึกหน้าจอ] เพื่อเริ่มเซอร์วิสการแชร์หน้าจอ"),
("Account", "บัญชี"),
("Overwrite", "เขียนทับ"), ("Overwrite", "เขียนทับ"),
("This file exists, skip or overwrite this file?", "พบไฟล์ที่มีอยู่แล้ว ต้องการเขียนทับหรือไม่?"), ("This file exists, skip or overwrite this file?", "พบไฟล์ที่มีอยู่แล้ว ต้องการเขียนทับหรือไม่?"),
("Quit", "ออก"), ("Quit", "ออก"),
@ -334,6 +333,7 @@ lazy_static::lazy_static! {
("Scale adaptive", "ขนาดยืดหยุ่น"), ("Scale adaptive", "ขนาดยืดหยุ่น"),
("General", "ทั่วไป"), ("General", "ทั่วไป"),
("Security", "ความปลอดภัย"), ("Security", "ความปลอดภัย"),
("Account", "บัญชี"),
("Theme", "ธีม"), ("Theme", "ธีม"),
("Dark Theme", "ธีมมืด"), ("Dark Theme", "ธีมมืด"),
("Dark", "มืด"), ("Dark", "มืด"),
@ -405,5 +405,8 @@ lazy_static::lazy_static! {
("Closed manually by the web console", "ถูกปิดโดยเว็บคอนโซล"), ("Closed manually by the web console", "ถูกปิดโดยเว็บคอนโซล"),
("Local keyboard type", "ประเภทคีย์บอร์ด"), ("Local keyboard type", "ประเภทคีย์บอร์ด"),
("Select local keyboard type", "เลือกประเภทคีย์บอร์ด"), ("Select local keyboard type", "เลือกประเภทคีย์บอร์ด"),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", "被web控制台手動關閉"), ("Closed manually by the web console", "被web控制台手動關閉"),
("Local keyboard type", "本地鍵盤類型"), ("Local keyboard type", "本地鍵盤類型"),
("Select local keyboard type", "請選擇本地鍵盤類型"), ("Select local keyboard type", "請選擇本地鍵盤類型"),
("software_render_tip", "如果你使用英偉達顯卡, 並且遠程窗口在會話建立後會立刻關閉, 那麼安裝nouveau驅動並且選擇使用軟件渲染可能會有幫助。重啟軟件後生效。"),
("Always use software rendering", "使用軟件渲染"),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -405,5 +405,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Closed manually by the web console", ""), ("Closed manually by the web console", ""),
("Local keyboard type", ""), ("Local keyboard type", ""),
("Select local keyboard type", ""), ("Select local keyboard type", ""),
("software_render_tip", ""),
("Always use software rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

@ -717,3 +717,92 @@ pub fn get_double_click_time() -> u32 {
} }
} }
/// forever: may not work
pub fn system_message(title: &str, msg: &str, forever: bool) -> ResultType<()> {
if std::process::Command::new("notify-send")
.arg(title)
.arg(msg)
.spawn()
.is_ok()
{
return Ok(());
}
if std::process::Command::new("zenity")
.arg("--info")
.arg("--timeout")
.arg(if forever { "0" } else { "3" })
.arg("--title")
.arg(title)
.arg("--text")
.arg(msg)
.spawn()
.is_ok()
{
return Ok(());
}
if std::process::Command::new("kdialog")
.arg("--title")
.arg(title)
.arg("--msgbox")
.arg(msg)
.spawn()
.is_ok()
{
return Ok(());
}
if std::process::Command::new("xmessage")
.arg("-center")
.arg("-timeout")
.arg(if forever { "0" } else { "3" })
.arg(title)
.arg(msg)
.spawn()
.is_ok()
{
return Ok(());
}
bail!("failed to post system message");
}
extern "C" fn breakdown_signal_handler(sig: i32) {
let mut stack = vec![];
backtrace::trace(|frame| {
backtrace::resolve_frame(frame, |symbol| {
if let Some(name) = symbol.name() {
stack.push(name.to_string());
}
});
true // keep going to the next frame
});
let mut info = String::default();
if stack.iter().any(|s| {
s.contains(&"nouveau_pushbuf_kick")
|| s.to_lowercase().contains("nvidia")
|| s.contains("gdk_window_end_draw_frame")
}) {
hbb_common::config::Config::set_option(
"allow-always-software-render".to_string(),
"Y".to_string(),
);
info = "Always use software rendering will be set.".to_string();
log::info!("{}", info);
}
log::error!(
"Got signal {} and exit. stack:\n{}",
sig,
stack.join("\n").to_string()
);
system_message(
"RustDesk",
&format!("Got signal {} and exit.{}", sig, info),
true,
)
.ok();
std::process::exit(0);
}
pub fn register_breakdown_handler() {
unsafe {
libc::signal(libc::SIGSEGV, breakdown_signal_handler as _);
}
}