sway/config: add allow_drm_leasing config

This commit is contained in:
Simon Zeni 2025-06-13 17:05:13 -04:00
parent 73c244fb48
commit 7d0290bae7
5 changed files with 19 additions and 2 deletions

View file

@ -291,6 +291,7 @@ struct output_config {
bool set_color_transform;
struct wlr_color_transform *color_transform;
int allow_tearing;
int allow_drm_leasing;
int hdr;
char *background;

View file

@ -70,6 +70,7 @@ struct sway_output {
struct wl_event_source *repaint_timer;
bool allow_tearing;
bool allow_drm_leasing;
bool hdr;
};

View file

@ -79,6 +79,7 @@ struct output_config *new_output_config(const char *name) {
oc->color_transform = NULL;
oc->power = -1;
oc->allow_tearing = -1;
oc->allow_drm_leasing = -1;
oc->hdr = -1;
return oc;
}
@ -155,6 +156,9 @@ static void supersede_output_config(struct output_config *dst, struct output_con
if (src->allow_tearing != -1) {
dst->allow_tearing = -1;
}
if (src->allow_drm_leasing != -1) {
dst->allow_drm_leasing = -1;
}
if (src->hdr != -1) {
dst->hdr = -1;
}
@ -233,6 +237,9 @@ static void merge_output_config(struct output_config *dst, struct output_config
if (src->allow_tearing != -1) {
dst->allow_tearing = src->allow_tearing;
}
if (src->allow_drm_leasing != -1) {
dst->allow_drm_leasing = src->allow_drm_leasing;
}
if (src->hdr != -1) {
dst->hdr = src->hdr;
}
@ -278,11 +285,11 @@ void store_output_config(struct output_config *oc) {
sway_log(SWAY_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz "
"position %d,%d scale %f subpixel %s transform %d) (bg %s %s) (power %d) "
"(max render time: %d) (allow tearing: %d) (hdr: %d)",
"(max render time: %d) (allow tearing: %d) (allow drm leasing: %d) (hdr: %d)",
oc->name, oc->enabled, oc->width, oc->height, oc->refresh_rate,
oc->x, oc->y, oc->scale, sway_wl_output_subpixel_to_string(oc->subpixel),
oc->transform, oc->background, oc->background_option, oc->power,
oc->max_render_time, oc->allow_tearing, oc->hdr);
oc->max_render_time, oc->allow_tearing, oc->allow_drm_leasing, oc->hdr);
// If the configuration was not merged into an existing configuration, add
// it to the list. Otherwise we're done with it and can free it.
@ -622,6 +629,7 @@ static bool finalize_output_config(struct output_config *oc, struct sway_output
output->max_render_time = oc && oc->max_render_time > 0 ? oc->max_render_time : 0;
output->allow_tearing = oc && oc->allow_tearing > 0;
output->allow_drm_leasing = oc && oc->allow_drm_leasing > 0;
output->hdr = applied->image_description != NULL;
return true;

View file

@ -409,6 +409,8 @@ static void ipc_json_describe_enabled_output(struct sway_output *output,
json_object_object_add(object, "max_render_time", json_object_new_int(output->max_render_time));
json_object_object_add(object, "allow_tearing", json_object_new_boolean(output->allow_tearing));
json_object_object_add(object, "allow_drm_leasing",
json_object_new_boolean(output->allow_drm_leasing));
json_object_object_add(object, "hdr", json_object_new_boolean(output->hdr));
}

View file

@ -210,6 +210,11 @@ must be separated by one space. For example:
This setting only has effect when a window is fullscreen on the output.
*output* <name> allow_drm_leasing yes|no
Allows or disallows leasing a DRM output. The DRM lease interface must be
active when calling this command. Outputs offered for leasing will be
disabled when leased by a client.
*output* <name> hdr on|off|toggle
Enables or disables HDR (High Dynamic Range). HDR enables a larger color
gamut and brightness range. HDR uses the BT2020 primaries and the PQ