summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/wayland_shm/evas_shm.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2016-04-15 10:38:28 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-04-19 15:11:10 -0400
commit0d684d4559c6cd4e8195b3334ab07d3631a64887 (patch)
tree939733cf178fcec7daa1822b17c964bcbe1af21c /src/modules/evas/engines/wayland_shm/evas_shm.c
parent8635f56aeb5d98c7de204b6a1a0c3a9b54af77f3 (diff)
wayland_shm: Refactor surface creation
Split this into two parts, one that makes the base surface, one that calls the potential back ends. Once the dmabuf backend is added this will allow a fallback path to re-initialize the surface as wl_shm if dmabuf fails.
Diffstat (limited to 'src/modules/evas/engines/wayland_shm/evas_shm.c')
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_shm.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c b/src/modules/evas/engines/wayland_shm/evas_shm.c
index f716865a45..2f4fe59245 100644
--- a/src/modules/evas/engines/wayland_shm/evas_shm.c
+++ b/src/modules/evas/engines/wayland_shm/evas_shm.c
@@ -407,7 +407,6 @@ _evas_shm_surface_destroy(Surface *surface)
407 _shm_leaf_destroy(&surface->surf.shm->leaf[i]); 407 _shm_leaf_destroy(&surface->surf.shm->leaf[i]);
408 408
409 free(surface->surf.shm); 409 free(surface->surf.shm);
410 free(surface);
411} 410}
412 411
413void 412void
@@ -568,28 +567,25 @@ _evas_shm_surface_post(Surface *s, Eina_Rectangle *rects, unsigned int count)
568 surf->current = NULL; 567 surf->current = NULL;
569} 568}
570 569
571Surface * 570Eina_Bool
572_evas_shm_surface_create(Evas_Engine_Info_Wayland_Shm *info, int w, int h, int num_buff) 571_evas_shm_surface_create(Surface *s, int w, int h, int num_buff)
573{ 572{
574 Surface *s;
575 Shm_Surface *surf; 573 Shm_Surface *surf;
576 int i = 0; 574 int i = 0;
577 575
578 LOGFN(__FILE__, __LINE__, __FUNCTION__); 576 LOGFN(__FILE__, __LINE__, __FUNCTION__);
579 577
580 if (!(s = calloc(1, sizeof(Surface)))) return NULL; 578 if (!(s->surf.shm = calloc(1, sizeof(Shm_Surface)))) return EINA_FALSE;
581 if (!(s->surf.shm = calloc(1, sizeof(Shm_Surface)))) goto err;
582 s->type = SURFACE_SHM;
583 surf = s->surf.shm; 579 surf = s->surf.shm;
584 580
585 surf->w = w; 581 surf->w = w;
586 surf->h = h; 582 surf->h = h;
587 surf->disp = info->info.wl_disp; 583 surf->disp = s->info->info.wl_disp;
588 surf->shm = info->info.wl_shm; 584 surf->shm = s->info->info.wl_shm;
589 surf->surface = info->info.wl_surface; 585 surf->surface = s->info->info.wl_surface;
590 surf->num_buff = num_buff; 586 surf->num_buff = num_buff;
591 surf->alpha = info->info.destination_alpha; 587 surf->alpha = s->info->info.destination_alpha;
592 surf->compositor_version = info->info.compositor_version; 588 surf->compositor_version = s->info->info.compositor_version;
593 589
594 /* create surface buffers */ 590 /* create surface buffers */
595 for (; i < surf->num_buff; i++) 591 for (; i < surf->num_buff; i++)
@@ -601,15 +597,16 @@ _evas_shm_surface_create(Evas_Engine_Info_Wayland_Shm *info, int w, int h, int n
601 } 597 }
602 } 598 }
603 599
600 s->type = SURFACE_SHM;
604 s->funcs.destroy = _evas_shm_surface_destroy; 601 s->funcs.destroy = _evas_shm_surface_destroy;
605 s->funcs.reconfigure = _evas_shm_surface_reconfigure; 602 s->funcs.reconfigure = _evas_shm_surface_reconfigure;
606 s->funcs.data_get = _evas_shm_surface_data_get; 603 s->funcs.data_get = _evas_shm_surface_data_get;
607 s->funcs.assign = _evas_shm_surface_assign; 604 s->funcs.assign = _evas_shm_surface_assign;
608 s->funcs.post = _evas_shm_surface_post; 605 s->funcs.post = _evas_shm_surface_post;
609 606
610 return s; 607 return EINA_TRUE;
611 608
612err: 609err:
613 _evas_shm_surface_destroy(s); 610 _evas_shm_surface_destroy(s);
614 return NULL; 611 return EINA_FALSE;
615} 612}