[PATCH v2 2/4] compositor: Add a switch_mode hook and a wrapper
zhiwen.wu at linux.intel.com
zhiwen.wu at linux.intel.com
Tue Mar 13 08:18:24 PDT 2012
From: Alex Wu <zhiwen.wu at linux.intel.com>
This allow each output backend to switch the display mode. It is
useful to some applications like fullscreen game, xbmc.
---
src/compositor-drm.c | 1 +
src/compositor-openwfd.c | 1 +
src/compositor-wayland.c | 1 +
src/compositor-x11.c | 1 +
src/compositor.c | 9 +++++++++
src/compositor.h | 5 +++++
6 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index ba7e642..b01879f 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1149,6 +1149,7 @@ create_output_for_connector(struct drm_compositor *ec,
output->base.destroy = drm_output_destroy;
output->base.assign_planes = drm_assign_planes;
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 2dba07d..bbf1067 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 48358e3..c7bb5ed 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -438,6 +438,7 @@ wayland_compositor_create_output(struct wayland_compositor *c,
output->base.assign_planes = NULL;
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 c3eaab7..18540fe 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -448,6 +448,7 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
output->base.assign_planes = NULL;
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 f2ae2f6..1b1a1d7 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -52,6 +52,15 @@
static struct wl_list child_process_list;
static jmp_buf segv_jmp_buf;
+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->width, mode->height, mode->refresh);
+}
+
static int
sigchld_handler(int signal_number, void *data)
{
diff --git a/src/compositor.h b/src/compositor.h
index b5ba7b2..07b39d6 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -101,6 +101,8 @@ struct weston_output {
uint32_t backlight_current;
void (*set_backlight)(struct weston_output *output, uint32_t value);
void (*set_dpms)(struct weston_output *output, enum dpms_enum level);
+
+ int (*switch_mode)(struct weston_output *output, int32_t w, int32_t h, uint32_t refresh);
};
struct weston_input_device {
@@ -479,6 +481,9 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c,
void
weston_output_destroy(struct weston_output *output);
+int
+weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode);
+
void
weston_input_device_init(struct weston_input_device *device,
struct weston_compositor *ec);
--
1.7.5.4
More information about the wayland-devel
mailing list