compositor: Add a switch_mode hook and a wrapper into the output.

This allow each output backend to switch the display mode. It is
useful to some applications like fullscreen game, xbmc.
This commit is contained in:
Alex Wu 2012-04-17 17:20:47 +08:00 committed by Kristian Høgsberg
parent 314db6edef
commit 2dda604093
6 changed files with 17 additions and 0 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)
{

View File

@ -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