From 0824eb521f8e26e4c0f143ec7850d45c4b2f675b Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Mon, 9 Dec 2024 19:43:46 +0200 Subject: compositor: Read modeline for PipeWire output We seem to have missed adding the ability to specify a modeline. This is similar to native DRM outputs, specifying mode=widthXheight would give us the output modeline resolution. Bug-AGL: SPEC-5235 Signed-off-by: Marius Vlad Change-Id: I455cfec7b4f937aa8b5d038b4df599aa1dff5d3f --- src/compositor.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index 00cf8d5..36a12d4 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1395,8 +1395,11 @@ pipewire_backend_config_init(struct weston_pipewire_backend_config *config) static int pipewire_backend_output_configure(struct weston_output *output) { - int width = 640; - int height = 480; + int default_width = 640; + int default_height = 480; + int width = 0; + int height = 0; + char *mode; struct ivi_compositor *ivi = to_ivi_compositor(output->compositor); struct ivi_output_config *parsed_options = ivi->parsed_options; @@ -1417,8 +1420,13 @@ pipewire_backend_output_configure(struct weston_output *output) section = weston_config_get_section(ivi->config, "output", "name", output->name); - weston_config_section_get_int(section, "width", &width, width); - weston_config_section_get_int(section, "height", &height, height); + weston_config_section_get_string(section, "mode", &mode, NULL); + if (!mode || sscanf(mode, "%dx%d", &width, &height) != 2) { + weston_log("Invalid mode for output %s. Using defaults.\n", + output->name); + width = default_width; + height = default_height; + } if (parsed_options->width) width = parsed_options->width; -- cgit 1.2.3-korg