[PATCH 3/3] compositor-drm: add sprite support v6
Pekka Paalanen
ppaalanen at gmail.com
Fri Feb 10 01:55:45 PST 2012
On Thu, 9 Feb 2012 13:12:58 -0800
Jesse Barnes <jbarnes at virtuousgeek.org> wrote:
> Add support for assigning surfaces to overlay sprites using the new
> assign_planes hook.
>
> v2: queue per-sprite vblank events to avoid de-queuing sprite updates
> for unrelated outputs (reported by krh)
> v3: handle output and surface transformation when calculating src & dest
> rects for the sprite (from pq & krh)
> v4: use new gbm function to get actual surface format and check against
> supported formats in sprite
> v5: track overlapped surfaces in compositor-drm better (krh)
> v6: update with comments from Pekka
> - remove is_cursor, it was really just checking for buffers
> - use pixman_region32_fini before damaging the old surface
> - add comments about damage requirements and transform update
> ---
> configure.ac | 2 +-
> src/compositor-drm.c | 447 +++++++++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 447 insertions(+), 2 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 62d36eb..94c5ab9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -73,7 +73,7 @@ AC_ARG_ENABLE(drm-compositor, [ --enable-drm-compositor],,
> AM_CONDITIONAL(ENABLE_DRM_COMPOSITOR, test x$enable_drm_compositor == xyes)
> if test x$enable_drm_compositor == xyes; then
> AC_DEFINE([BUILD_DRM_COMPOSITOR], [1], [Build the DRM compositor])
> - PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.23 gbm])
> + PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm])
> fi
>
>
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index adbd03c..97bdfd0 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
...
> +static void
> +drm_assign_planes(struct weston_output *output)
> +{
> + struct weston_compositor *ec = output->compositor;
> + struct weston_surface *es;
> + pixman_region32_t overlap, surface_overlap;
> +
> + /*
> + * Find a surface for each sprite in the output using some heuristics:
> + * 1) size
> + * 2) frequency of update
> + * 3) opacity (though some hw might support alpha blending)
> + * 4) clipping (this can be fixed with color keys)
> + *
> + * The idea is to save on blitting since this should save power.
> + * If we can get a large video surface on the sprite for example,
> + * the main display surface may not need to update at all, and
> + * the client buffer can be used directly for the sprite surface
> + * as we do for flipping full screen surfaces.
> + */
> + pixman_region32_init(&overlap);
> + wl_list_for_each(es, &ec->surface_list, link) {
> + weston_surface_update_transform(es);
I am going to propose, that weston_output_repaint() will guarantee,
that no surface (in the list) has dirty geometry, when it calls any
functions, backend or otherwise. Therefore we would not need to take
care of it inside any repaint functions by calling
weston_surface_update_transform().
The reason is that I am adding damage_below and damage calls into
weston_surface_update_transform(), which will apply damage while
dealing with dirty geometry. Also, as weston_output_repaint() needs to
compute e.g. overlaps, it already has a loop iterating over all
surfaces, where I can call weston_surface_update_transform().
I hope this is ok for your output work.
> +
> + /*
> + * FIXME: try to assign hw cursors here too, they're just
> + * special overlays
> + */
> + pixman_region32_init(&surface_overlap);
> + pixman_region32_intersect(&surface_overlap, &overlap,
> + &es->transform.boundingbox);
> +
> + if (!drm_output_prepare_overlay_surface(output, es,
> + &surface_overlap)) {
> + pixman_region32_fini(&es->damage);
> + pixman_region32_init(&es->damage);
> + } else {
> + pixman_region32_union(&overlap, &overlap,
> + &es->transform.boundingbox);
> + }
> + pixman_region32_fini(&surface_overlap);
> + }
> + pixman_region32_fini(&overlap);
> +
> + drm_disable_unused_sprites(output);
> +}
Thanks,
pq
More information about the wayland-devel
mailing list