diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2018-01-25 14:28:23 -0600 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2018-01-26 15:53:59 -0600 |
commit | bf4b828cb6537c5e0cb9287669877f6ff2344fb6 (patch) | |
tree | b2bb1b9ab537a68ec228601af69d1a9337caa030 /src/lib/ecore_wl2/ecore_wl2_surface.c | |
parent | 601f9cc484ce992f3eabf27862f5d12528ba2bd8 (diff) |
ecore_wl2: Move dmabuf surface specific tests into their own function
Refactoring to allow non-dmabuf surface managers.
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_surface.c')
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_surface.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_surface.c b/src/lib/ecore_wl2/ecore_wl2_surface.c index cd810d21b5..de10b8ad5f 100644 --- a/src/lib/ecore_wl2/ecore_wl2_surface.c +++ b/src/lib/ecore_wl2/ecore_wl2_surface.c | |||
@@ -11,6 +11,24 @@ | |||
11 | 11 | ||
12 | #define MAX_BUFFERS 4 | 12 | #define MAX_BUFFERS 4 |
13 | 13 | ||
14 | static Eina_Bool | ||
15 | _evas_dmabuf_surface_check(Ecore_Wl2_Window *win) | ||
16 | { | ||
17 | Ecore_Wl2_Display *ewd; | ||
18 | Ecore_Wl2_Buffer_Type types = 0; | ||
19 | |||
20 | ewd = ecore_wl2_window_display_get(win); | ||
21 | if (ecore_wl2_display_shm_get(ewd)) | ||
22 | types |= ECORE_WL2_BUFFER_SHM; | ||
23 | if (ecore_wl2_display_dmabuf_get(ewd)) | ||
24 | types |= ECORE_WL2_BUFFER_DMABUF; | ||
25 | |||
26 | if (!ecore_wl2_buffer_init(ewd, types)) | ||
27 | return EINA_FALSE; | ||
28 | |||
29 | return EINA_TRUE; | ||
30 | } | ||
31 | |||
14 | static void | 32 | static void |
15 | _evas_dmabuf_surface_reconfigure(Ecore_Wl2_Surface *s, int w, int h, uint32_t flags EINA_UNUSED, Eina_Bool force) | 33 | _evas_dmabuf_surface_reconfigure(Ecore_Wl2_Surface *s, int w, int h, uint32_t flags EINA_UNUSED, Eina_Bool force) |
16 | { | 34 | { |
@@ -215,8 +233,6 @@ EAPI Ecore_Wl2_Surface * | |||
215 | ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha) | 233 | ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha) |
216 | { | 234 | { |
217 | Ecore_Wl2_Surface *out; | 235 | Ecore_Wl2_Surface *out; |
218 | Ecore_Wl2_Display *ewd; | ||
219 | Ecore_Wl2_Buffer_Type types = 0; | ||
220 | 236 | ||
221 | EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL); | 237 | EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL); |
222 | 238 | ||
@@ -225,19 +241,11 @@ ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha) | |||
225 | out = calloc(1, sizeof(*out)); | 241 | out = calloc(1, sizeof(*out)); |
226 | if (!out) return NULL; | 242 | if (!out) return NULL; |
227 | out->wl2_win = win; | 243 | out->wl2_win = win; |
228 | |||
229 | ewd = ecore_wl2_window_display_get(win); | ||
230 | if (ecore_wl2_display_shm_get(ewd)) | ||
231 | types |= ECORE_WL2_BUFFER_SHM; | ||
232 | if (ecore_wl2_display_dmabuf_get(ewd)) | ||
233 | types |= ECORE_WL2_BUFFER_DMABUF; | ||
234 | |||
235 | out->alpha = alpha; | 244 | out->alpha = alpha; |
236 | out->w = 0; | 245 | out->w = 0; |
237 | out->h = 0; | 246 | out->h = 0; |
238 | 247 | ||
239 | /* create surface buffers */ | 248 | if (!_evas_dmabuf_surface_check(win)) goto err; |
240 | if (!ecore_wl2_buffer_init(ewd, types)) goto err; | ||
241 | 249 | ||
242 | out->funcs.destroy = _evas_dmabuf_surface_destroy; | 250 | out->funcs.destroy = _evas_dmabuf_surface_destroy; |
243 | out->funcs.reconfigure = _evas_dmabuf_surface_reconfigure; | 251 | out->funcs.reconfigure = _evas_dmabuf_surface_reconfigure; |