ecore_wl2: Move dmabuf surface specific tests into their own function
Refactoring to allow non-dmabuf surface managers.
This commit is contained in:
parent
601f9cc484
commit
bf4b828cb6
|
@ -11,6 +11,24 @@
|
||||||
|
|
||||||
#define MAX_BUFFERS 4
|
#define MAX_BUFFERS 4
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_evas_dmabuf_surface_check(Ecore_Wl2_Window *win)
|
||||||
|
{
|
||||||
|
Ecore_Wl2_Display *ewd;
|
||||||
|
Ecore_Wl2_Buffer_Type types = 0;
|
||||||
|
|
||||||
|
ewd = ecore_wl2_window_display_get(win);
|
||||||
|
if (ecore_wl2_display_shm_get(ewd))
|
||||||
|
types |= ECORE_WL2_BUFFER_SHM;
|
||||||
|
if (ecore_wl2_display_dmabuf_get(ewd))
|
||||||
|
types |= ECORE_WL2_BUFFER_DMABUF;
|
||||||
|
|
||||||
|
if (!ecore_wl2_buffer_init(ewd, types))
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_evas_dmabuf_surface_reconfigure(Ecore_Wl2_Surface *s, int w, int h, uint32_t flags EINA_UNUSED, Eina_Bool force)
|
_evas_dmabuf_surface_reconfigure(Ecore_Wl2_Surface *s, int w, int h, uint32_t flags EINA_UNUSED, Eina_Bool force)
|
||||||
{
|
{
|
||||||
|
@ -215,8 +233,6 @@ EAPI Ecore_Wl2_Surface *
|
||||||
ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha)
|
ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha)
|
||||||
{
|
{
|
||||||
Ecore_Wl2_Surface *out;
|
Ecore_Wl2_Surface *out;
|
||||||
Ecore_Wl2_Display *ewd;
|
|
||||||
Ecore_Wl2_Buffer_Type types = 0;
|
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
|
||||||
|
|
||||||
|
@ -225,19 +241,11 @@ ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha)
|
||||||
out = calloc(1, sizeof(*out));
|
out = calloc(1, sizeof(*out));
|
||||||
if (!out) return NULL;
|
if (!out) return NULL;
|
||||||
out->wl2_win = win;
|
out->wl2_win = win;
|
||||||
|
|
||||||
ewd = ecore_wl2_window_display_get(win);
|
|
||||||
if (ecore_wl2_display_shm_get(ewd))
|
|
||||||
types |= ECORE_WL2_BUFFER_SHM;
|
|
||||||
if (ecore_wl2_display_dmabuf_get(ewd))
|
|
||||||
types |= ECORE_WL2_BUFFER_DMABUF;
|
|
||||||
|
|
||||||
out->alpha = alpha;
|
out->alpha = alpha;
|
||||||
out->w = 0;
|
out->w = 0;
|
||||||
out->h = 0;
|
out->h = 0;
|
||||||
|
|
||||||
/* create surface buffers */
|
if (!_evas_dmabuf_surface_check(win)) goto err;
|
||||||
if (!ecore_wl2_buffer_init(ewd, types)) goto err;
|
|
||||||
|
|
||||||
out->funcs.destroy = _evas_dmabuf_surface_destroy;
|
out->funcs.destroy = _evas_dmabuf_surface_destroy;
|
||||||
out->funcs.reconfigure = _evas_dmabuf_surface_reconfigure;
|
out->funcs.reconfigure = _evas_dmabuf_surface_reconfigure;
|
||||||
|
|
Loading…
Reference in New Issue