compositor-drm: Disable planes when zoomed or capturing

When the entire output is transformed or we're capturing the output
for screenshot or video, disable all output specific overlays
(drm planes, hw cursors etc) and move all surfaces into the primary
plane.
This commit is contained in:
Kristian Høgsberg 2012-08-03 15:45:23 -04:00
parent bcf4864bb7
commit 79af73e313
6 changed files with 19 additions and 11 deletions

View file

@ -732,6 +732,7 @@ drm_output_set_cursor(struct drm_output *output)
unsigned char *s;
int i, x, y;
output->cursor_surface = NULL;
if (es == NULL) {
drmModeSetCursor(c->drm.fd, output->crtc_id, 0, 0, 0);
return;
@ -773,7 +774,6 @@ drm_assign_planes(struct weston_output *output)
{
struct drm_compositor *c =
(struct drm_compositor *) output->compositor;
struct drm_output *drm_output = (struct drm_output *) output;
struct weston_surface *es, *next;
pixman_region32_t overlap, surface_overlap;
struct weston_plane *primary, *next_plane;
@ -792,7 +792,6 @@ drm_assign_planes(struct weston_output *output)
* as we do for flipping full screen surfaces.
*/
pixman_region32_init(&overlap);
drm_output->cursor_surface = NULL;
primary = &c->base.primary_plane;
wl_list_for_each_safe(es, next, &c->base.surface_list, link) {
pixman_region32_init(&surface_overlap);

View file

@ -1148,14 +1148,12 @@ weston_output_repaint(struct weston_output *output, uint32_t msecs)
}
}
if (output->assign_planes)
/*
* This will queue flips for the fbs and sprites where
* applicable and clear the damage for those surfaces.
* The repaint loop below will repaint everything
* else.
*/
if (output->assign_planes && !output->disable_planes)
output->assign_planes(output);
else
wl_list_for_each(es, &ec->surface_list, link)
weston_surface_move_to_plane(es, &ec->primary_plane);
pixman_region32_init(&opaque);

View file

@ -165,6 +165,7 @@ struct weston_output {
int dirty;
struct wl_signal frame_signal;
uint32_t frame_time;
int disable_planes;
char *make, *model;
uint32_t subpixel;

View file

@ -101,6 +101,7 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data)
int32_t stride;
uint8_t *pixels, *d, *s;
output->disable_planes--;
wl_list_remove(&listener->link);
stride = l->buffer->width * 4;
pixels = malloc(stride * l->buffer->height);
@ -165,6 +166,7 @@ screenshooter_shoot(struct wl_client *client,
l->listener.notify = screenshooter_frame_notify;
wl_signal_add(&output->frame_signal, &l->listener);
output->disable_planes++;
weston_output_schedule_repaint(output);
}
@ -212,6 +214,7 @@ screenshooter_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
}
struct weston_recorder {
struct weston_output *output;
uint32_t *frame, *rect;
uint32_t total;
int fd;
@ -346,6 +349,7 @@ weston_recorder_create(struct weston_output *output, const char *filename)
recorder->rect = malloc(size);
recorder->total = 0;
recorder->count = 0;
recorder->output = output;
memset(recorder->frame, 0, size);
recorder->fd = open(filename,
@ -368,6 +372,7 @@ weston_recorder_create(struct weston_output *output, const char *filename)
recorder->frame_listener.notify = weston_recorder_frame_notify;
wl_signal_add(&output->frame_signal, &recorder->frame_listener);
output->disable_planes++;
weston_output_damage(output);
}
@ -378,6 +383,7 @@ weston_recorder_destroy(struct weston_recorder *recorder)
close(recorder->fd);
free(recorder->frame);
free(recorder->rect);
recorder->output->disable_planes--;
free(recorder);
}

View file

@ -2166,8 +2166,10 @@ do_zoom(struct wl_seat *seat, uint32_t time, uint32_t key, uint32_t axis,
output->zoom.level = 0.0;
else if (output->zoom.level > output->zoom.max_level)
output->zoom.level = output->zoom.max_level;
else
else {
output->zoom.active = 1;
output->disable_planes++;
}
output->zoom.spring_z.target = output->zoom.level;

View file

@ -123,8 +123,10 @@ weston_zoom_frame_z(struct weston_animation *animation,
output->zoom.spring_z.current = 0.0;
if (weston_spring_done(&output->zoom.spring_z)) {
if (output->zoom.level <= 0.0)
if (output->zoom.level <= 0.0) {
output->zoom.active = 0;
output->disable_planes--;
}
output->zoom.spring_z.current = output->zoom.level;
wl_list_remove(&animation->link);
wl_list_init(&animation->link);