compositor: Track which plane a surface is on

We start tracking which hardware plane a surface is displayed on, which
lets us avoid generating damage when a hardware overlay/cursor is moved
around.
dev
Kristian Høgsberg 13 years ago
parent f6f69d3250
commit d553bfc127
  1. 16
      src/compositor-drm.c
  2. 3
      src/compositor.c
  3. 6
      src/compositor.h

@ -42,6 +42,10 @@
#include "launcher-util.h" #include "launcher-util.h"
#include "log.h" #include "log.h"
enum {
WESTON_PLANE_DRM_CURSOR = 0x100
};
struct drm_compositor { struct drm_compositor {
struct weston_compositor base; struct weston_compositor base;
@ -635,7 +639,6 @@ weston_output_set_cursor(struct weston_output *output,
pixman_region32_t *overlap) pixman_region32_t *overlap)
{ {
pixman_region32_t cursor_region; pixman_region32_t cursor_region;
int prior_was_hardware;
if (seat->sprite == NULL) if (seat->sprite == NULL)
return; return;
@ -650,19 +653,18 @@ weston_output_set_cursor(struct weston_output *output,
goto out; goto out;
} }
prior_was_hardware = seat->hw_cursor;
if (pixman_region32_not_empty(overlap) || if (pixman_region32_not_empty(overlap) ||
drm_output_set_cursor(output, seat) < 0) { drm_output_set_cursor(output, seat) < 0) {
if (prior_was_hardware) { if (seat->sprite->plane == WESTON_PLANE_DRM_CURSOR) {
weston_surface_damage(seat->sprite); weston_surface_damage(seat->sprite);
drm_output_set_cursor(output, NULL); drm_output_set_cursor(output, NULL);
} }
seat->hw_cursor = 0; seat->sprite->plane = WESTON_PLANE_PRIMARY;
} else { } else {
if (!prior_was_hardware) if (seat->sprite->plane == WESTON_PLANE_PRIMARY)
weston_surface_damage_below(seat->sprite); weston_surface_damage_below(seat->sprite);
wl_list_remove(&seat->sprite->link); wl_list_remove(&seat->sprite->link);
seat->hw_cursor = 1; seat->sprite->plane = WESTON_PLANE_DRM_CURSOR;
} }
out: out:
@ -705,7 +707,7 @@ drm_assign_planes(struct weston_output *output)
weston_output_set_cursor(output, seat, weston_output_set_cursor(output, seat,
&surface_overlap); &surface_overlap);
if (!seat->hw_cursor) if (seat->sprite->plane == WESTON_PLANE_PRIMARY)
pixman_region32_union(&overlap, &overlap, pixman_region32_union(&overlap, &overlap,
&es->transform.boundingbox); &es->transform.boundingbox);
} else if (!drm_output_prepare_overlay_surface(output, es, } else if (!drm_output_prepare_overlay_surface(output, es,

@ -306,6 +306,9 @@ weston_surface_damage_below(struct weston_surface *surface)
struct weston_compositor *compositor = surface->compositor; struct weston_compositor *compositor = surface->compositor;
pixman_region32_t damage; pixman_region32_t damage;
if (surface->plane != WESTON_PLANE_PRIMARY)
return;
pixman_region32_init(&damage); pixman_region32_init(&damage);
pixman_region32_subtract(&damage, &surface->transform.boundingbox, pixman_region32_subtract(&damage, &surface->transform.boundingbox,
&surface->clip); &surface->clip);

@ -222,7 +222,6 @@ struct weston_seat {
int32_t hotspot_x, hotspot_y; int32_t hotspot_x, hotspot_y;
struct wl_list link; struct wl_list link;
enum weston_keyboard_modifier modifier_state; enum weston_keyboard_modifier modifier_state;
int hw_cursor;
struct wl_surface *saved_kbd_focus; struct wl_surface *saved_kbd_focus;
struct wl_listener saved_kbd_focus_listener; struct wl_listener saved_kbd_focus_listener;
@ -382,6 +381,10 @@ struct weston_region {
* transformation in global coordinates, add it to the tail of the list. * transformation in global coordinates, add it to the tail of the list.
*/ */
enum {
WESTON_PLANE_PRIMARY
};
struct weston_surface { struct weston_surface {
struct wl_surface surface; struct wl_surface surface;
struct weston_compositor *compositor; struct weston_compositor *compositor;
@ -398,6 +401,7 @@ struct weston_surface {
GLfloat opaque_rect[4]; GLfloat opaque_rect[4];
GLfloat alpha; GLfloat alpha;
int blend; int blend;
int plane;
/* Surface geometry state, mutable. /* Surface geometry state, mutable.
* If you change anything, set dirty = 1. * If you change anything, set dirty = 1.

Loading…
Cancel
Save