diff --git a/src/compositor-drm.c b/src/compositor-drm.c index d2a2ea16..01211000 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -1166,6 +1166,7 @@ create_output_for_connector(struct drm_compositor *ec, output->base.assign_planes = drm_assign_planes; output->base.read_pixels = drm_output_read_pixels; output->base.set_dpms = drm_set_dpms; + output->base.switch_mode = NULL; return 0; diff --git a/src/compositor-openwfd.c b/src/compositor-openwfd.c index 2dba07d0..bbf1067b 100644 --- a/src/compositor-openwfd.c +++ b/src/compositor-openwfd.c @@ -409,6 +409,7 @@ create_output_for_port(struct wfd_compositor *ec, output->base.assign_planes = NULL; output->base.set_backlight = NULL; output->base.set_dpms = NULL; + output->base.switch_mode = NULL; wl_list_insert(ec->base.output_list.prev, &output->base.link); diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index c9d599d6..93094b05 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -462,6 +462,7 @@ wayland_compositor_create_output(struct wayland_compositor *c, output->base.read_pixels = wayland_output_read_pixels; output->base.set_backlight = NULL; output->base.set_dpms = NULL; + output->base.switch_mode = NULL; wl_list_insert(c->base.output_list.prev, &output->base.link); diff --git a/src/compositor-x11.c b/src/compositor-x11.c index 4361a01f..87ab5dd3 100644 --- a/src/compositor-x11.c +++ b/src/compositor-x11.c @@ -472,6 +472,7 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y, output->base.read_pixels = x11_output_read_pixels; output->base.set_backlight = NULL; output->base.set_dpms = NULL; + output->base.switch_mode = NULL; wl_list_insert(c->base.output_list.prev, &output->base.link); diff --git a/src/compositor.c b/src/compositor.c index 17daac4e..9b7badf2 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -79,6 +79,15 @@ sigchld_handler(int signal_number, void *data) return 1; } +WL_EXPORT int +weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode) +{ + if (!output->switch_mode) + return -1; + + return output->switch_mode(output, mode); +} + WL_EXPORT void weston_watch_process(struct weston_process *process) { diff --git a/src/compositor.h b/src/compositor.h index 93284c5f..f21f769b 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -99,6 +99,7 @@ struct weston_output { void (*destroy)(struct weston_output *output); void (*assign_planes)(struct weston_output *output); void (*read_pixels)(struct weston_output *output, void *data); + int (*switch_mode)(struct weston_output *output, struct weston_mode *mode); /* backlight values are on 0-255 range, where higher is brighter */ uint32_t backlight_current; @@ -563,4 +564,7 @@ weston_surface_destroy(struct weston_surface *surface); struct weston_compositor * backend_init(struct wl_display *display, int argc, char *argv[]); +int +weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode); + #endif