diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-09-14 10:30:35 -0400 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-09-17 10:06:13 +0200 |
commit | 38ed8008b126ed0ff5e06da67c9c2a19bcb3eedd (patch) | |
tree | da3ffd3f1b2778de19adbefa7eb0a38fbbde3888 /gst-libs | |
parent | 5c89b66dae6e496868fbd381afb45ec2264a3158 (diff) |
wayland: set opaque region for YUV surface.
This allows the compositor to optimize redraws and cull away changes
obscured by the video surface.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiwindow_wayland.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c index ac2882e6..2607c643 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c +++ b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c @@ -49,6 +49,7 @@ struct _GstVaapiWindowWaylandPrivate { struct wl_shell_surface *shell_surface; struct wl_surface *surface; struct wl_buffer *buffer; + struct wl_region *opaque_region; guint redraw_pending : 1; }; @@ -161,7 +162,18 @@ gst_vaapi_window_wayland_resize( guint height ) { + GstVaapiWindowWaylandPrivate * const priv = + GST_VAAPI_WINDOW_WAYLAND(window)->priv; + GstVaapiDisplayWaylandPrivate * const priv_display = + GST_VAAPI_OBJECT_DISPLAY_WAYLAND(window)->priv; + GST_DEBUG("resize window, new size %ux%u", width, height); + + if (priv->opaque_region) + wl_region_destroy(priv->opaque_region); + priv->opaque_region = wl_compositor_create_region(priv_display->compositor); + wl_region_add(priv->opaque_region, 0, 0, width, height); + return TRUE; } @@ -248,6 +260,12 @@ gst_vaapi_window_wayland_render( wl_surface_attach(priv->surface, buffer, 0, 0); wl_surface_damage(priv->surface, 0, 0, width, height); + if (priv->opaque_region) { + wl_surface_set_opaque_region(priv->surface, priv->opaque_region); + wl_region_destroy(priv->opaque_region); + priv->opaque_region = NULL; + } + wl_display_iterate(wl_display, WL_DISPLAY_WRITABLE); priv->redraw_pending = TRUE; priv->buffer = buffer; |