compositor: Store opaque clip for previous frame in weston_surface
This commit is contained in:
@@ -214,7 +214,8 @@ drm_output_prepare_scanout_surface(struct drm_output *output)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drm_output_repaint(struct weston_output *output_base)
|
drm_output_repaint(struct weston_output *output_base,
|
||||||
|
pixman_region32_t *damage)
|
||||||
{
|
{
|
||||||
struct drm_output *output = (struct drm_output *) output_base;
|
struct drm_output *output = (struct drm_output *) output_base;
|
||||||
struct drm_compositor *compositor =
|
struct drm_compositor *compositor =
|
||||||
@@ -235,7 +236,7 @@ drm_output_repaint(struct weston_output *output_base)
|
|||||||
drm_output_prepare_scanout_surface(output);
|
drm_output_prepare_scanout_surface(output);
|
||||||
|
|
||||||
wl_list_for_each_reverse(surface, &compositor->base.surface_list, link)
|
wl_list_for_each_reverse(surface, &compositor->base.surface_list, link)
|
||||||
weston_surface_draw(surface, &output->base);
|
weston_surface_draw(surface, &output->base, damage);
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
||||||
|
|||||||
@@ -329,7 +329,8 @@ static const struct wl_callback_listener frame_listener = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wayland_output_repaint(struct weston_output *output_base)
|
wayland_output_repaint(struct weston_output *output_base,
|
||||||
|
pixman_region32_t *damage)
|
||||||
{
|
{
|
||||||
struct wayland_output *output = (struct wayland_output *) output_base;
|
struct wayland_output *output = (struct wayland_output *) output_base;
|
||||||
struct wayland_compositor *compositor =
|
struct wayland_compositor *compositor =
|
||||||
@@ -344,7 +345,7 @@ wayland_output_repaint(struct weston_output *output_base)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wl_list_for_each_reverse(surface, &compositor->base.surface_list, link)
|
wl_list_for_each_reverse(surface, &compositor->base.surface_list, link)
|
||||||
weston_surface_draw(surface, &output->base);
|
weston_surface_draw(surface, &output->base, damage);
|
||||||
|
|
||||||
draw_border(output);
|
draw_border(output);
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,8 @@ x11_compositor_fini_egl(struct x11_compositor *compositor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
x11_output_repaint(struct weston_output *output_base)
|
x11_output_repaint(struct weston_output *output_base,
|
||||||
|
pixman_region32_t *damage)
|
||||||
{
|
{
|
||||||
struct x11_output *output = (struct x11_output *)output_base;
|
struct x11_output *output = (struct x11_output *)output_base;
|
||||||
struct x11_compositor *compositor =
|
struct x11_compositor *compositor =
|
||||||
@@ -200,7 +201,7 @@ x11_output_repaint(struct weston_output *output_base)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wl_list_for_each_reverse(surface, &compositor->base.surface_list, link)
|
wl_list_for_each_reverse(surface, &compositor->base.surface_list, link)
|
||||||
weston_surface_draw(surface, &output->base);
|
weston_surface_draw(surface, &output->base, damage);
|
||||||
|
|
||||||
eglSwapBuffers(compositor->base.display, output->egl_surface);
|
eglSwapBuffers(compositor->base.display, output->egl_surface);
|
||||||
|
|
||||||
|
|||||||
+24
-24
@@ -225,6 +225,7 @@ weston_surface_create(struct weston_compositor *compositor)
|
|||||||
|
|
||||||
pixman_region32_init(&surface->damage);
|
pixman_region32_init(&surface->damage);
|
||||||
pixman_region32_init(&surface->opaque);
|
pixman_region32_init(&surface->opaque);
|
||||||
|
pixman_region32_init(&surface->clip);
|
||||||
undef_region(&surface->input);
|
undef_region(&surface->input);
|
||||||
pixman_region32_init(&surface->transform.opaque);
|
pixman_region32_init(&surface->transform.opaque);
|
||||||
wl_list_init(&surface->frame_callback_list);
|
wl_list_init(&surface->frame_callback_list);
|
||||||
@@ -647,6 +648,7 @@ destroy_surface(struct wl_resource *resource)
|
|||||||
pixman_region32_fini(&surface->transform.boundingbox);
|
pixman_region32_fini(&surface->transform.boundingbox);
|
||||||
pixman_region32_fini(&surface->damage);
|
pixman_region32_fini(&surface->damage);
|
||||||
pixman_region32_fini(&surface->opaque);
|
pixman_region32_fini(&surface->opaque);
|
||||||
|
pixman_region32_fini(&surface->clip);
|
||||||
if (!region_is_undefined(&surface->input))
|
if (!region_is_undefined(&surface->input))
|
||||||
pixman_region32_fini(&surface->input);
|
pixman_region32_fini(&surface->input);
|
||||||
|
|
||||||
@@ -762,7 +764,8 @@ texture_region(struct weston_surface *es, pixman_region32_t *region)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
weston_surface_draw(struct weston_surface *es, struct weston_output *output)
|
weston_surface_draw(struct weston_surface *es, struct weston_output *output,
|
||||||
|
pixman_region32_t *damage)
|
||||||
{
|
{
|
||||||
struct weston_compositor *ec = es->compositor;
|
struct weston_compositor *ec = es->compositor;
|
||||||
GLfloat *v;
|
GLfloat *v;
|
||||||
@@ -771,12 +774,9 @@ weston_surface_draw(struct weston_surface *es, struct weston_output *output)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
pixman_region32_init(&repaint);
|
pixman_region32_init(&repaint);
|
||||||
pixman_region32_intersect(&repaint, &es->transform.boundingbox,
|
pixman_region32_intersect(&repaint,
|
||||||
&output->region);
|
&es->transform.boundingbox, damage);
|
||||||
pixman_region32_intersect(&repaint, &repaint, &es->damage);
|
pixman_region32_subtract(&repaint, &repaint, &es->clip);
|
||||||
|
|
||||||
/* Clear damage, assume outputs do not overlap. */
|
|
||||||
pixman_region32_subtract(&es->damage, &es->damage, &output->region);
|
|
||||||
|
|
||||||
if (!pixman_region32_not_empty(&repaint))
|
if (!pixman_region32_not_empty(&repaint))
|
||||||
goto out;
|
goto out;
|
||||||
@@ -937,7 +937,7 @@ weston_output_repaint(struct weston_output *output, int msecs)
|
|||||||
struct weston_surface *es;
|
struct weston_surface *es;
|
||||||
struct weston_animation *animation, *next;
|
struct weston_animation *animation, *next;
|
||||||
struct weston_frame_callback *cb, *cnext;
|
struct weston_frame_callback *cb, *cnext;
|
||||||
pixman_region32_t opaque, new_damage, total_damage;
|
pixman_region32_t opaque, new_damage, output_damage;
|
||||||
int32_t width, height;
|
int32_t width, height;
|
||||||
|
|
||||||
weston_compositor_update_drag_surfaces(ec);
|
weston_compositor_update_drag_surfaces(ec);
|
||||||
@@ -948,9 +948,6 @@ weston_output_repaint(struct weston_output *output, int msecs)
|
|||||||
output->border.top + output->border.bottom;
|
output->border.top + output->border.bottom;
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
|
|
||||||
pixman_region32_init(&new_damage);
|
|
||||||
pixman_region32_init(&opaque);
|
|
||||||
|
|
||||||
wl_list_for_each(es, &ec->surface_list, link)
|
wl_list_for_each(es, &ec->surface_list, link)
|
||||||
/* Update surface transform now to avoid calling it ever
|
/* Update surface transform now to avoid calling it ever
|
||||||
* again from the repaint sub-functions. */
|
* again from the repaint sub-functions. */
|
||||||
@@ -965,33 +962,36 @@ weston_output_repaint(struct weston_output *output, int msecs)
|
|||||||
*/
|
*/
|
||||||
output->assign_planes(output);
|
output->assign_planes(output);
|
||||||
|
|
||||||
|
pixman_region32_init(&new_damage);
|
||||||
|
pixman_region32_init(&opaque);
|
||||||
|
|
||||||
wl_list_for_each(es, &ec->surface_list, link) {
|
wl_list_for_each(es, &ec->surface_list, link) {
|
||||||
pixman_region32_subtract(&es->damage, &es->damage, &opaque);
|
pixman_region32_subtract(&es->damage, &es->damage, &opaque);
|
||||||
pixman_region32_union(&new_damage, &new_damage, &es->damage);
|
pixman_region32_union(&new_damage, &new_damage, &es->damage);
|
||||||
|
empty_region(&es->damage);
|
||||||
|
pixman_region32_copy(&es->clip, &opaque);
|
||||||
pixman_region32_union(&opaque, &opaque, &es->transform.opaque);
|
pixman_region32_union(&opaque, &opaque, &es->transform.opaque);
|
||||||
}
|
}
|
||||||
|
|
||||||
pixman_region32_init(&total_damage);
|
pixman_region32_union(&ec->damage, &ec->damage, &new_damage);
|
||||||
pixman_region32_union(&total_damage, &new_damage,
|
|
||||||
&output->previous_damage);
|
pixman_region32_init(&output_damage);
|
||||||
pixman_region32_intersect(&output->previous_damage,
|
pixman_region32_union(&output_damage,
|
||||||
&new_damage, &output->region);
|
&ec->damage, &output->previous_damage);
|
||||||
|
pixman_region32_copy(&output->previous_damage, &ec->damage);
|
||||||
|
pixman_region32_intersect(&output_damage,
|
||||||
|
&output_damage, &output->region);
|
||||||
|
pixman_region32_subtract(&ec->damage, &ec->damage, &output->region);
|
||||||
|
|
||||||
pixman_region32_fini(&opaque);
|
pixman_region32_fini(&opaque);
|
||||||
pixman_region32_fini(&new_damage);
|
pixman_region32_fini(&new_damage);
|
||||||
|
|
||||||
wl_list_for_each(es, &ec->surface_list, link) {
|
|
||||||
pixman_region32_copy(&es->damage, &total_damage);
|
|
||||||
pixman_region32_subtract(&total_damage,
|
|
||||||
&total_damage, &es->transform.opaque);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (output->dirty)
|
if (output->dirty)
|
||||||
weston_output_update_matrix(output);
|
weston_output_update_matrix(output);
|
||||||
|
|
||||||
output->repaint(output);
|
output->repaint(output, &output_damage);
|
||||||
|
|
||||||
pixman_region32_fini(&total_damage);
|
pixman_region32_fini(&output_damage);
|
||||||
|
|
||||||
output->repaint_needed = 0;
|
output->repaint_needed = 0;
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -91,7 +91,8 @@ struct weston_output {
|
|||||||
struct weston_mode *current;
|
struct weston_mode *current;
|
||||||
struct wl_list mode_list;
|
struct wl_list mode_list;
|
||||||
|
|
||||||
void (*repaint)(struct weston_output *output);
|
void (*repaint)(struct weston_output *output,
|
||||||
|
pixman_region32_t *damage);
|
||||||
void (*destroy)(struct weston_output *output);
|
void (*destroy)(struct weston_output *output);
|
||||||
void (*assign_planes)(struct weston_output *output);
|
void (*assign_planes)(struct weston_output *output);
|
||||||
|
|
||||||
@@ -198,8 +199,8 @@ struct weston_compositor {
|
|||||||
int idle_time; /* effective timeout, s */
|
int idle_time; /* effective timeout, s */
|
||||||
|
|
||||||
/* Repaint state. */
|
/* Repaint state. */
|
||||||
struct timespec previous_swap;
|
|
||||||
struct wl_array vertices, indices;
|
struct wl_array vertices, indices;
|
||||||
|
pixman_region32_t damage;
|
||||||
|
|
||||||
uint32_t focus;
|
uint32_t focus;
|
||||||
|
|
||||||
@@ -260,6 +261,7 @@ struct weston_surface {
|
|||||||
struct wl_surface surface;
|
struct wl_surface surface;
|
||||||
struct weston_compositor *compositor;
|
struct weston_compositor *compositor;
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
|
pixman_region32_t clip;
|
||||||
pixman_region32_t damage;
|
pixman_region32_t damage;
|
||||||
pixman_region32_t opaque;
|
pixman_region32_t opaque;
|
||||||
pixman_region32_t input;
|
pixman_region32_t input;
|
||||||
@@ -341,7 +343,8 @@ void
|
|||||||
weston_surface_activate(struct weston_surface *surface,
|
weston_surface_activate(struct weston_surface *surface,
|
||||||
struct weston_input_device *device, uint32_t time);
|
struct weston_input_device *device, uint32_t time);
|
||||||
void
|
void
|
||||||
weston_surface_draw(struct weston_surface *es, struct weston_output *output);
|
weston_surface_draw(struct weston_surface *es,
|
||||||
|
struct weston_output *output, pixman_region32_t *damage);
|
||||||
|
|
||||||
void
|
void
|
||||||
notify_motion(struct wl_input_device *device,
|
notify_motion(struct wl_input_device *device,
|
||||||
|
|||||||
Reference in New Issue
Block a user