diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2018-01-26 12:26:40 -0600 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2018-01-26 15:54:00 -0600 |
commit | 07c41f48c4152f13129000dc9ac3b715bf258dfa (patch) | |
tree | 981327588d66c5ec0f50c12e506fdb2341ebc2b1 /src/lib/ecore_wl2/ecore_wl2_surface.c | |
parent | 044106c8a28f03b63bac55b3bbd8db968f781e8f (diff) |
ecore_wl2: Move private data allocation into back-end code
The backend should allocate its own private data and return it instead
of a bool.
This assumes all back-ends will need some manner of private data, which
is certanly true for the one back-end we provide.
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_surface.c')
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_surface.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_surface.c b/src/lib/ecore_wl2/ecore_wl2_surface.c index bfabd9172d..bb05a8190a 100644 --- a/src/lib/ecore_wl2/ecore_wl2_surface.c +++ b/src/lib/ecore_wl2/ecore_wl2_surface.c | |||
@@ -16,12 +16,16 @@ typedef struct _Ecore_Wl2_Dmabuf_Private | |||
16 | Eina_List *buffers; | 16 | Eina_List *buffers; |
17 | } Ecore_Wl2_Dmabuf_Private; | 17 | } Ecore_Wl2_Dmabuf_Private; |
18 | 18 | ||
19 | static Eina_Bool | 19 | static void * |
20 | _evas_dmabuf_surface_check(Ecore_Wl2_Window *win) | 20 | _evas_dmabuf_surface_setup(Ecore_Wl2_Window *win) |
21 | { | 21 | { |
22 | Ecore_Wl2_Dmabuf_Private *priv; | ||
22 | Ecore_Wl2_Display *ewd; | 23 | Ecore_Wl2_Display *ewd; |
23 | Ecore_Wl2_Buffer_Type types = 0; | 24 | Ecore_Wl2_Buffer_Type types = 0; |
24 | 25 | ||
26 | priv = calloc(1, sizeof(*priv)); | ||
27 | if (!priv) return NULL; | ||
28 | |||
25 | ewd = ecore_wl2_window_display_get(win); | 29 | ewd = ecore_wl2_window_display_get(win); |
26 | if (ecore_wl2_display_shm_get(ewd)) | 30 | if (ecore_wl2_display_shm_get(ewd)) |
27 | types |= ECORE_WL2_BUFFER_SHM; | 31 | types |= ECORE_WL2_BUFFER_SHM; |
@@ -29,9 +33,12 @@ _evas_dmabuf_surface_check(Ecore_Wl2_Window *win) | |||
29 | types |= ECORE_WL2_BUFFER_DMABUF; | 33 | types |= ECORE_WL2_BUFFER_DMABUF; |
30 | 34 | ||
31 | if (!ecore_wl2_buffer_init(ewd, types)) | 35 | if (!ecore_wl2_buffer_init(ewd, types)) |
32 | return EINA_FALSE; | 36 | { |
37 | free(priv); | ||
38 | return NULL; | ||
39 | } | ||
33 | 40 | ||
34 | return EINA_TRUE; | 41 | return priv; |
35 | } | 42 | } |
36 | 43 | ||
37 | static void | 44 | static void |
@@ -237,7 +244,7 @@ ecore_wl2_surface_flush(Ecore_Wl2_Surface *surface) | |||
237 | 244 | ||
238 | static Ecore_Wl2_Surface_Interface dmabuf_smanager = | 245 | static Ecore_Wl2_Surface_Interface dmabuf_smanager = |
239 | { | 246 | { |
240 | .check = _evas_dmabuf_surface_check, | 247 | .setup = _evas_dmabuf_surface_setup, |
241 | .destroy = _evas_dmabuf_surface_destroy, | 248 | .destroy = _evas_dmabuf_surface_destroy, |
242 | .reconfigure = _evas_dmabuf_surface_reconfigure, | 249 | .reconfigure = _evas_dmabuf_surface_reconfigure, |
243 | .data_get = _evas_dmabuf_surface_data_get, | 250 | .data_get = _evas_dmabuf_surface_data_get, |
@@ -257,15 +264,15 @@ ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha) | |||
257 | 264 | ||
258 | out = calloc(1, sizeof(*out)); | 265 | out = calloc(1, sizeof(*out)); |
259 | if (!out) return NULL; | 266 | if (!out) return NULL; |
260 | out->private_data = calloc(1, sizeof(Ecore_Wl2_Dmabuf_Private)); | 267 | |
261 | if (!out->private_data) return NULL; | ||
262 | out->wl2_win = win; | 268 | out->wl2_win = win; |
263 | out->alpha = alpha; | 269 | out->alpha = alpha; |
264 | out->w = 0; | 270 | out->w = 0; |
265 | out->h = 0; | 271 | out->h = 0; |
266 | out->funcs = &dmabuf_smanager; | 272 | out->funcs = &dmabuf_smanager; |
267 | 273 | ||
268 | if (out->funcs->check(win)) | 274 | out->private_data = out->funcs->setup(win); |
275 | if (out->private_data) | ||
269 | { | 276 | { |
270 | win->wl2_surface = out; | 277 | win->wl2_surface = out; |
271 | return out; | 278 | return out; |