From 5de9f0f8a3238d95eea9a6cd4093c69158b40f05 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Fri, 23 Jun 2017 10:39:55 -0500 Subject: [PATCH] Allow enabling experimental hardware plane support Hardware plane support is inactive unless a scanout handler is set, this patch adds a scanout handler and uses it when the env var E_USE_HARDWARE_PLANES is set. In the future this env var will go away when hardware plane support is stable enough to enable it everywhere. --- src/bin/e_pixmap.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c index b42851d8c..9758c7e9b 100644 --- a/src/bin/e_pixmap.c +++ b/src/bin/e_pixmap.c @@ -709,6 +709,31 @@ e_pixmap_is_pixels(E_Pixmap *cp) } } +#ifdef HAVE_WAYLAND +static void +_e_pixmap_scanout_handler(void *data, Evas_Native_Surface_Status status) +{ + E_Comp_Wl_Buffer *buffer; + + buffer = data; + switch (status) + { + case EVAS_NATIVE_SURFACE_STATUS_SCANOUT_ON: + buffer->busy++; + break; + case EVAS_NATIVE_SURFACE_STATUS_SCANOUT_OFF: + _e_pixmap_wl_resource_release(buffer); + break; + case EVAS_NATIVE_SURFACE_STATUS_PLANE_ASSIGN: + buffer->busy++; + break; + case EVAS_NATIVE_SURFACE_STATUS_PLANE_RELEASE: + _e_pixmap_wl_resource_release(buffer); + break; + } +} +#endif + E_API Eina_Bool e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns) { @@ -748,6 +773,11 @@ e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns) ns->data.wl_dmabuf.attr = &cp->buffer->dmabuf_buffer->attributes; ns->data.wl_dmabuf.resource = cp->buffer->resource; + if (getenv("E_USE_HARDWARE_PLANES")) + { + ns->data.wl_dmabuf.scanout.handler = _e_pixmap_scanout_handler; + ns->data.wl_dmabuf.scanout.data = cp->buffer; + } ret = EINA_TRUE; } else if (!cp->buffer->shm_buffer)