summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-11-09 16:08:30 -0600
committerDerek Foreman <derekf@osg.samsung.com>2017-11-09 16:08:30 -0600
commitba2abb2eb9e395b049515f70416559982f503b74 (patch)
treee3a4faafd81bb956186d98faa6240f24a47c380c
parent132a77c6827b91eba3fa3094afd99ef9efa8e058 (diff)
wayland_shm: Don't require dmabuf support to use wl_shm
Unintended side effect of my merging of the two code paths. We should still try to use wl_shm if we can't use dmabuf here.
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_dmabuf.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
index 77849a4e46..d4b278dd0d 100644
--- a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
+++ b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
@@ -405,9 +405,11 @@ _wl_shm_buffer_manager_setup(int fd EINA_UNUSED)
405} 405}
406 406
407static Buffer_Manager * 407static Buffer_Manager *
408_buffer_manager_get(void) 408_buffer_manager_get(Surface_Type types)
409{ 409{
410 int fd; 410 int fd;
411 Eina_Bool dmabuf = types & SURFACE_DMABUF;
412 Eina_Bool shm = types & SURFACE_SHM;
411 Eina_Bool success = EINA_FALSE; 413 Eina_Bool success = EINA_FALSE;
412 414
413 if (buffer_manager) 415 if (buffer_manager)
@@ -424,10 +426,10 @@ _buffer_manager_get(void)
424 426
425 if (!getenv("EVAS_WAYLAND_SHM_DISABLE_DMABUF")) 427 if (!getenv("EVAS_WAYLAND_SHM_DISABLE_DMABUF"))
426 { 428 {
427 success = _intel_buffer_manager_setup(fd); 429 success = dmabuf && _intel_buffer_manager_setup(fd);
428 if (!success) success = _exynos_buffer_manager_setup(fd); 430 if (!success) success = dmabuf && _exynos_buffer_manager_setup(fd);
429 } 431 }
430 if (!success) success = _wl_shm_buffer_manager_setup(fd); 432 if (!success) success = shm && _wl_shm_buffer_manager_setup(fd);
431 if (!success) goto err_bm; 433 if (!success) goto err_bm;
432 434
433 drm_fd = fd; 435 drm_fd = fd;
@@ -736,11 +738,15 @@ _evas_dmabuf_surface_destroy(Surface *s)
736Eina_Bool 738Eina_Bool
737_evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff) 739_evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff)
738{ 740{
741 Surface_Type types = 0;
739 Dmabuf_Surface *surf = NULL; 742 Dmabuf_Surface *surf = NULL;
740 int i = 0; 743 int i = 0;
741 744
742 if (dmabuf_totally_hosed) return EINA_FALSE; 745 if (dmabuf_totally_hosed) return EINA_FALSE;
743 if (!ecore_wl2_display_dmabuf_get(s->info->info.wl2_display)) return EINA_FALSE; 746 if (ecore_wl2_display_shm_get(s->info->info.wl2_display))
747 types |= SURFACE_SHM;
748 if (ecore_wl2_display_dmabuf_get(s->info->info.wl2_display))
749 types |= SURFACE_DMABUF;
744 750
745 if (!(s->surf.dmabuf = calloc(1, sizeof(Dmabuf_Surface)))) return EINA_FALSE; 751 if (!(s->surf.dmabuf = calloc(1, sizeof(Dmabuf_Surface)))) return EINA_FALSE;
746 surf = s->surf.dmabuf; 752 surf = s->surf.dmabuf;
@@ -754,7 +760,7 @@ _evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff)
754 surf->buffer = calloc(surf->nbuf, sizeof(Dmabuf_Buffer *)); 760 surf->buffer = calloc(surf->nbuf, sizeof(Dmabuf_Buffer *));
755 if (!surf->buffer) goto err; 761 if (!surf->buffer) goto err;
756 762
757 if (!_buffer_manager_get()) goto err; 763 if (!_buffer_manager_get(types)) goto err;
758 764
759 if (w && h) 765 if (w && h)
760 { 766 {