derekf pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=04cebba6231e737457a36a81c643439c43571724
commit 04cebba6231e737457a36a81c643439c43571724 Author: Derek Foreman <[email protected]> Date: Tue Nov 14 15:45:39 2017 -0600 ecore_wl2: Filter buffer types by compositor capabilities It does us no good to be able to allocate dmabuf capable memory if the compositor can't handle it. This should fix failures on systems where allocation is possible but the compositor doesn't advertise dmabuf. --- src/lib/ecore_wl2/Ecore_Wl2.h | 2 +- src/lib/ecore_wl2/ecore_wl2_buffer.c | 6 +++--- src/modules/evas/engines/wayland_shm/evas_dmabuf.c | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index f4c1c8122a..1f58cd42ac 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -2006,7 +2006,7 @@ EAPI void ecore_wl2_window_update_begin(Ecore_Wl2_Window *window); EAPI void ecore_wl2_window_damage(Ecore_Wl2_Window *window, Eina_Rectangle *rects, unsigned int count); -EAPI Eina_Bool ecore_wl2_buffer_init(Ecore_Wl2_Buffer_Type types); +EAPI Eina_Bool ecore_wl2_buffer_init(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer_Type types); EAPI Ecore_Wl2_Buffer *ecore_wl2_buffer_create(Ecore_Wl2_Display *ewd, int w, int h, Eina_Bool alpha); EAPI void ecore_wl2_buffer_destroy(Ecore_Wl2_Buffer *b); EAPI struct wl_buffer *ecore_wl2_buffer_wl_buffer_get(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer *buf); diff --git a/src/lib/ecore_wl2/ecore_wl2_buffer.c b/src/lib/ecore_wl2/ecore_wl2_buffer.c index 32e779ed00..6fd725240c 100644 --- a/src/lib/ecore_wl2/ecore_wl2_buffer.c +++ b/src/lib/ecore_wl2/ecore_wl2_buffer.c @@ -398,11 +398,11 @@ _wl_shm_buffer_manager_setup(int fd EINA_UNUSED) } EAPI Eina_Bool -ecore_wl2_buffer_init(Ecore_Wl2_Buffer_Type types) +ecore_wl2_buffer_init(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer_Type types) { int fd; - Eina_Bool dmabuf = types & ECORE_WL2_BUFFER_DMABUF; - Eina_Bool shm = types & ECORE_WL2_BUFFER_SHM; + Eina_Bool dmabuf = ewd->wl.dmabuf && (types & ECORE_WL2_BUFFER_DMABUF); + Eina_Bool shm = ewd->wl.shm && (types & ECORE_WL2_BUFFER_SHM); Eina_Bool success = EINA_FALSE; if (buffer_manager) diff --git a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c index b54424b3d6..b137c27ddb 100644 --- a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c +++ b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c @@ -171,13 +171,15 @@ _evas_dmabuf_surface_destroy(Surface *s) Eina_Bool _evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff) { + Ecore_Wl2_Display *ewd; Ecore_Wl2_Buffer_Type types = 0; Dmabuf_Surface *surf = NULL; int i = 0; - if (ecore_wl2_display_shm_get(s->info->info.wl2_display)) + ewd = s->info->info.wl2_display; + if (ecore_wl2_display_shm_get(ewd)) types |= ECORE_WL2_BUFFER_SHM; - if (ecore_wl2_display_dmabuf_get(s->info->info.wl2_display)) + if (ecore_wl2_display_dmabuf_get(ewd)) types |= ECORE_WL2_BUFFER_DMABUF; if (!(s->surf.dmabuf = calloc(1, sizeof(Dmabuf_Surface)))) return EINA_FALSE; @@ -191,7 +193,7 @@ _evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff) surf->buffer = calloc(surf->nbuf, sizeof(Ecore_Wl2_Buffer *)); if (!surf->buffer) goto err; - if (!ecore_wl2_buffer_init(types)) goto err; + if (!ecore_wl2_buffer_init(ewd, types)) goto err; if (w && h) { --
