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.
This commit is contained in:
Derek Foreman 2017-11-14 15:45:39 -06:00
parent 579b6d69b3
commit 04cebba623
3 changed files with 9 additions and 7 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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)
{