summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-11-06 13:10:59 -0600
committerDerek Foreman <derekf@osg.samsung.com>2017-11-08 15:12:34 -0600
commit7e1805ada13cf9e851e02ab1cf34b24886db7e4a (patch)
treef8a8f7442a772c5b340f541fc4fea65550172a4e /src
parent1cda9fe749636484b1328e694a8dbbe4f9d0c31d (diff)
wayland_shm: Factor out wl_buffer creation code
Diffstat (limited to 'src')
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_dmabuf.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
index b3446b03fe..0194b62133 100644
--- a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
+++ b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
@@ -98,6 +98,8 @@ static void *(*sym_exynos_bo_map)(struct exynos_bo *bo) = NULL;
98static void (*sym_exynos_bo_destroy)(struct exynos_bo *bo) = NULL; 98static void (*sym_exynos_bo_destroy)(struct exynos_bo *bo) = NULL;
99static void (*sym_exynos_device_destroy)(struct exynos_device *) = NULL; 99static void (*sym_exynos_device_destroy)(struct exynos_device *) = NULL;
100 100
101static struct wl_buffer * _evas_dmabuf_wl_buffer_from_dmabuf(Ecore_Wl2_Display *disp, Dmabuf_Buffer *db);
102
101static Buffer_Handle * 103static Buffer_Handle *
102_intel_alloc(Buffer_Manager *self, const char *name, int w, int h, unsigned long *stride, int32_t *fd) 104_intel_alloc(Buffer_Manager *self, const char *name, int w, int h, unsigned long *stride, int32_t *fd)
103{ 105{
@@ -645,15 +647,30 @@ _evas_dmabuf_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count)
645 ecore_wl2_window_commit(s->info->info.wl2_win, EINA_TRUE); 647 ecore_wl2_window_commit(s->info->info.wl2_win, EINA_TRUE);
646} 648}
647 649
648static Dmabuf_Buffer * 650static struct wl_buffer *
649_evas_dmabuf_buffer_init(Dmabuf_Surface *s, int w, int h) 651_evas_dmabuf_wl_buffer_from_dmabuf(Ecore_Wl2_Display *ewd, Dmabuf_Buffer *db)
650{ 652{
651 struct wl_buffer *buf; 653 struct wl_buffer *buf;
652 Dmabuf_Buffer *out;
653 struct zwp_linux_dmabuf_v1 *dmabuf; 654 struct zwp_linux_dmabuf_v1 *dmabuf;
654 struct zwp_linux_buffer_params_v1 *dp; 655 struct zwp_linux_buffer_params_v1 *dp;
655 uint32_t flags = 0; 656 uint32_t flags = 0;
656 657
658 dmabuf = ecore_wl2_display_dmabuf_get(ewd);
659 dp = zwp_linux_dmabuf_v1_create_params(dmabuf);
660 zwp_linux_buffer_params_v1_add(dp, db->fd, 0, 0, db->stride, 0, 0);
661 buf = zwp_linux_buffer_params_v1_create_immed(dp, db->w, db->h,
662 DRM_FORMAT_ARGB8888, flags);
663 wl_buffer_add_listener(buf, &buffer_listener, db);
664 zwp_linux_buffer_params_v1_destroy(dp);
665
666 return buf;
667}
668
669static Dmabuf_Buffer *
670_evas_dmabuf_buffer_init(Dmabuf_Surface *s, int w, int h)
671{
672 Dmabuf_Buffer *out;
673
657 out = calloc(1, sizeof(Dmabuf_Buffer)); 674 out = calloc(1, sizeof(Dmabuf_Buffer));
658 if (!out) return NULL; 675 if (!out) return NULL;
659 676
@@ -669,14 +686,8 @@ _evas_dmabuf_buffer_init(Dmabuf_Surface *s, int w, int h)
669 out->w = w; 686 out->w = w;
670 out->h = h; 687 out->h = h;
671 688
672 dmabuf = ecore_wl2_display_dmabuf_get(s->surface->ob->ewd); 689 out->wl_buffer = _evas_dmabuf_wl_buffer_from_dmabuf(s->surface->ob->ewd,
673 dp = zwp_linux_dmabuf_v1_create_params(dmabuf); 690 out);
674 zwp_linux_buffer_params_v1_add(dp, out->fd, 0, 0, out->stride, 0, 0);
675 buf = zwp_linux_buffer_params_v1_create_immed(dp, out->w, out->h,
676 DRM_FORMAT_ARGB8888, flags);
677 wl_buffer_add_listener(buf, &buffer_listener, out);
678 zwp_linux_buffer_params_v1_destroy(dp);
679 out->wl_buffer = buf;
680 691
681 ecore_wl2_display_flush(s->surface->info->info.wl2_display); 692 ecore_wl2_display_flush(s->surface->info->info.wl2_display);
682 return out; 693 return out;