summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-11-10 09:55:58 -0600
committerDerek Foreman <derekf@osg.samsung.com>2017-11-10 09:55:58 -0600
commitcf345cff74d893ece4a5e3855a41522ad381189c (patch)
treeffb867b606946926fc9d033b56430fd17906a381 /src
parent753359230ab33e07f0c52acf943db75c692f8aa1 (diff)
wayland_shm: Respect the alpha
The dmabuf code has been creating ARGB buffers all the time. The old wl_shm code correctly respected the alpha field, but that was lost in the new version. I'm not sure we ever create non-alpha wayland buffers, since CSD has to have alpha to do shadows, but if there's any way to do it it'll work now.
Diffstat (limited to 'src')
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_dmabuf.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
index d4b278dd0d..ad46ad83ba 100644
--- a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
+++ b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
@@ -381,10 +381,16 @@ _wl_shm_to_buffer(Ecore_Wl2_Display *ewd, Dmabuf_Buffer *db)
381 struct wl_buffer *buf; 381 struct wl_buffer *buf;
382 struct wl_shm_pool *pool; 382 struct wl_shm_pool *pool;
383 struct wl_shm *shm; 383 struct wl_shm *shm;
384 uint32_t format;
385
386 if (db->surface->alpha)
387 format = WL_SHM_FORMAT_ARGB8888;
388 else
389 format = WL_SHM_FORMAT_XRGB8888;
384 390
385 shm = ecore_wl2_display_shm_get(ewd); 391 shm = ecore_wl2_display_shm_get(ewd);
386 pool = wl_shm_create_pool(shm, db->fd, db->size); 392 pool = wl_shm_create_pool(shm, db->fd, db->size);
387 buf = wl_shm_pool_create_buffer(pool, 0, db->w, db->h, db->stride, 0); 393 buf = wl_shm_pool_create_buffer(pool, 0, db->w, db->h, db->stride, format);
388 wl_shm_pool_destroy(pool); 394 wl_shm_pool_destroy(pool);
389 close(db->fd); 395 close(db->fd);
390 db->fd = -1; 396 db->fd = -1;
@@ -675,12 +681,18 @@ _evas_dmabuf_wl_buffer_from_dmabuf(Ecore_Wl2_Display *ewd, Dmabuf_Buffer *db)
675 struct zwp_linux_dmabuf_v1 *dmabuf; 681 struct zwp_linux_dmabuf_v1 *dmabuf;
676 struct zwp_linux_buffer_params_v1 *dp; 682 struct zwp_linux_buffer_params_v1 *dp;
677 uint32_t flags = 0; 683 uint32_t flags = 0;
684 uint32_t format;
685
686 if (db->surface->alpha)
687 format = DRM_FORMAT_ARGB8888;
688 else
689 format = DRM_FORMAT_XRGB8888;
678 690
679 dmabuf = ecore_wl2_display_dmabuf_get(ewd); 691 dmabuf = ecore_wl2_display_dmabuf_get(ewd);
680 dp = zwp_linux_dmabuf_v1_create_params(dmabuf); 692 dp = zwp_linux_dmabuf_v1_create_params(dmabuf);
681 zwp_linux_buffer_params_v1_add(dp, db->fd, 0, 0, db->stride, 0, 0); 693 zwp_linux_buffer_params_v1_add(dp, db->fd, 0, 0, db->stride, 0, 0);
682 buf = zwp_linux_buffer_params_v1_create_immed(dp, db->w, db->h, 694 buf = zwp_linux_buffer_params_v1_create_immed(dp, db->w, db->h,
683 DRM_FORMAT_ARGB8888, flags); 695 format, flags);
684 wl_buffer_add_listener(buf, &buffer_listener, db); 696 wl_buffer_add_listener(buf, &buffer_listener, db);
685 zwp_linux_buffer_params_v1_destroy(dp); 697 zwp_linux_buffer_params_v1_destroy(dp);
686 698