From f202a16abe5bd0c79d698ad6090009c624330c60 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 17 Jun 2025 15:45:17 +0800 Subject: [PATCH] feat: add option to disable syncobj for nvidia --- src/config/parse_config.h | 5 +++++ src/config/preset_config.h | 1 + src/maomao.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/config/parse_config.h b/src/config/parse_config.h index 9ab68cf..cbc9def 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -241,6 +241,7 @@ typedef struct { int single_scratchpad; int xwayland_persistence; + int syncobj_enable; struct xkb_rule_names xkb_rules; } Config; @@ -876,6 +877,8 @@ void parse_config_line(Config *config, const char *line) { config->single_scratchpad = atoi(value); } else if (strcmp(key, "xwayland_persistence") == 0) { config->xwayland_persistence = atoi(value); + } else if (strcmp(key, "syncobj_enable") == 0) { + config->syncobj_enable = atoi(value); } else if (strcmp(key, "no_border_when_single") == 0) { config->no_border_when_single = atoi(value); } else if (strcmp(key, "snap_distance") == 0) { @@ -1969,6 +1972,7 @@ void override_config(void) { // 杂项设置 xwayland_persistence = CLAMP_INT(config.xwayland_persistence, 0, 1); + syncobj_enable = CLAMP_INT(config.syncobj_enable, 0, 1); axis_bind_apply_timeout = CLAMP_INT(config.axis_bind_apply_timeout, 0, 1000); focus_on_activate = CLAMP_INT(config.focus_on_activate, 0, 1); @@ -2091,6 +2095,7 @@ void set_value_default() { config.focus_cross_tag = focus_cross_tag; config.single_scratchpad = single_scratchpad; config.xwayland_persistence = xwayland_persistence; + config.syncobj_enable = syncobj_enable; config.no_border_when_single = no_border_when_single; config.snap_distance = snap_distance; config.drag_tile_to_tile = drag_tile_to_tile; diff --git a/src/config/preset_config.h b/src/config/preset_config.h index dab4400..8132b30 100644 --- a/src/config/preset_config.h +++ b/src/config/preset_config.h @@ -87,6 +87,7 @@ float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; int warpcursor = 1; /* Warp cursor to focused client */ int xwayland_persistence = 1; /* xwayland persistence */ +int syncobj_enable = 0; /* layout(s) */ Layout overviewlayout = {"󰃇", overview, "overview"}; diff --git a/src/maomao.c b/src/maomao.c index 034925e..6ff854d 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -6430,7 +6430,7 @@ void setup(void) { scene, wlr_linux_dmabuf_v1_create_with_renderer(dpy, 5, drw)); } - if ((drm_fd = wlr_renderer_get_drm_fd(drw)) >= 0 && + if (syncobj_enable && (drm_fd = wlr_renderer_get_drm_fd(drw)) >= 0 && drw->features.timeline && backend->features.timeline) wlr_linux_drm_syncobj_manager_v1_create(dpy, 1, drm_fd);