diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2017-11-15 11:47:35 -0600 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2017-11-15 11:54:37 -0600 |
commit | fcdbc07fe34d3b030d5e0136c003a38dbdb036e6 (patch) | |
tree | 6528e38b14aa8ff0fb1bdc76fdf04dd68033f79d | |
parent | 23f5b411766ddd394c72a6b66143977c94b0878b (diff) | |
download | efl-fcdbc07fe34d3b030d5e0136c003a38dbdb036e6.tar.gz |
ecore_wl2: Don't open rendernode if we're not going to use it
We should only open this when actually testing dmabuf. Otherwise we're
just wasting time and adding an opportunity to fail shm init over
unrelated issues.
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_buffer.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_buffer.c b/src/lib/ecore_wl2/ecore_wl2_buffer.c index 60e4312153..22ecc5c29d 100644 --- a/src/lib/ecore_wl2/ecore_wl2_buffer.c +++ b/src/lib/ecore_wl2/ecore_wl2_buffer.c @@ -400,7 +400,7 @@ _wl_shm_buffer_manager_setup(int fd EINA_UNUSED) EAPI Eina_Bool ecore_wl2_buffer_init(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer_Type types) { - int fd; + int fd = -1; 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; @@ -414,15 +414,15 @@ ecore_wl2_buffer_init(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer_Type types) buffer_manager = calloc(1, sizeof(Buffer_Manager)); if (!buffer_manager) goto err_alloc; - fd = open("/dev/dri/renderD128", O_RDWR | O_CLOEXEC); - if (fd < 0) goto err_drm; - - if (!getenv("EVAS_WAYLAND_SHM_DISABLE_DMABUF")) + if (!getenv("EVAS_WAYLAND_SHM_DISABLE_DMABUF") && dmabuf) { - success = dmabuf && _intel_buffer_manager_setup(fd); - if (!success) success = dmabuf && _exynos_buffer_manager_setup(fd); + fd = open("/dev/dri/renderD128", O_RDWR | O_CLOEXEC); + if (fd < 0) goto err_drm; + + success = _intel_buffer_manager_setup(fd); + if (!success) success = _exynos_buffer_manager_setup(fd); } - if (!success) success = shm && _wl_shm_buffer_manager_setup(fd); + if (!success) success = shm && _wl_shm_buffer_manager_setup(0); if (!success) goto err_bm; drm_fd = fd; @@ -430,7 +430,7 @@ ecore_wl2_buffer_init(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer_Type types) return EINA_TRUE; err_bm: - close(fd); + if (fd >= 0) close(fd); err_drm: free(buffer_manager); buffer_manager = NULL; |