diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2017-11-14 16:36:02 -0600 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2017-11-15 11:54:37 -0600 |
commit | 517f929aa5b9df398359d3b4861d108795535287 (patch) | |
tree | 29ac354aaccf978f8004952014a8be9d0e3059be /src/lib/ecore_wl2/ecore_wl2_buffer.c | |
parent | 3ac556f2e1674f988efaada9c6dc6a41807254d9 (diff) |
ecore_wl2: Send a dmabuf non-immediate create at startup
We use immediate mode dmabuf creation at runtime, but this can result in
clients being killed with no option to fallback if the buffers can't be
consumed by the compositor.
This test should catch when a system can allocate a dmabuf buffer and the
compositor claims to accept dmabuf, but the buffer can't actually be used
for whatever reason. We'll then use wl_shm at runtime instead of dmabuf.
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_buffer.c')
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_buffer.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_buffer.c b/src/lib/ecore_wl2/ecore_wl2_buffer.c index a9e911bab1..58e2d6a0c4 100644 --- a/src/lib/ecore_wl2/ecore_wl2_buffer.c +++ b/src/lib/ecore_wl2/ecore_wl2_buffer.c | |||
@@ -568,3 +568,50 @@ ecore_wl2_buffer_create(Ecore_Wl2_Display *ewd, int w, int h, Eina_Bool alpha) | |||
568 | 568 | ||
569 | return out; | 569 | return out; |
570 | } | 570 | } |
571 | |||
572 | static void | ||
573 | _create_succeeded(void *data EINA_UNUSED, | ||
574 | struct zwp_linux_buffer_params_v1 *params, | ||
575 | struct wl_buffer *new_buffer) | ||
576 | { | ||
577 | wl_buffer_destroy(new_buffer); | ||
578 | zwp_linux_buffer_params_v1_destroy(params); | ||
579 | } | ||
580 | |||
581 | static void | ||
582 | _create_failed(void *data, struct zwp_linux_buffer_params_v1 *params) | ||
583 | { | ||
584 | Ecore_Wl2_Display *ewd = data; | ||
585 | |||
586 | zwp_linux_buffer_params_v1_destroy(params); | ||
587 | ewd->wl.dmabuf = NULL; | ||
588 | } | ||
589 | |||
590 | static const struct zwp_linux_buffer_params_v1_listener params_listener = | ||
591 | { | ||
592 | _create_succeeded, | ||
593 | _create_failed | ||
594 | }; | ||
595 | |||
596 | void | ||
597 | _ecore_wl2_buffer_test(Ecore_Wl2_Display *ewd) | ||
598 | { | ||
599 | struct zwp_linux_buffer_params_v1 *dp; | ||
600 | Ecore_Wl2_Buffer *buf; | ||
601 | |||
602 | if (!ecore_wl2_buffer_init(ewd, ECORE_WL2_BUFFER_DMABUF)) goto fail; | ||
603 | |||
604 | buf = _ecore_wl2_buffer_partial_create(1, 1, EINA_TRUE); | ||
605 | if (!buf) goto fail; | ||
606 | |||
607 | dp = zwp_linux_dmabuf_v1_create_params(ewd->wl.dmabuf); | ||
608 | zwp_linux_buffer_params_v1_add(dp, buf->fd, 0, 0, buf->stride, 0, 0); | ||
609 | zwp_linux_buffer_params_v1_add_listener(dp, ¶ms_listener, buf); | ||
610 | zwp_linux_buffer_params_v1_create(dp, buf->w, buf->h, | ||
611 | DRM_FORMAT_ARGB8888, 0); | ||
612 | ecore_wl2_display_flush(ewd); | ||
613 | |||
614 | return; | ||
615 | fail: | ||
616 | ewd->wl.dmabuf = NULL; | ||
617 | } | ||