summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Michael <cp.michael@samsung.com>2013-01-24 12:16:33 +0000
committerChristopher Michael <cpmichael1@comcast.net>2013-01-24 12:16:33 +0000
commita9e39877d2e70e2ce55a415bd3c4b3bf659693cc (patch)
treea04cf5ceeb52bec74eb01e8b5377f9cd0b4141b0
parent4db2eca3503c4435746fc7d511d992a93bef528b (diff)
Modify expedite wayland shm engine to work with new Evas one.
Signed-off-by: Christopher Michael <cp.michael@samsung.com> SVN revision: 83295
-rw-r--r--src/bin/engine_wayland_shm.c99
1 files changed, 53 insertions, 46 deletions
diff --git a/src/bin/engine_wayland_shm.c b/src/bin/engine_wayland_shm.c
index 1f1d468..7ff17d2 100644
--- a/src/bin/engine_wayland_shm.c
+++ b/src/bin/engine_wayland_shm.c
@@ -22,7 +22,7 @@ struct _engine_wayland_shm_display
22 struct wl_shell *shell; 22 struct wl_shell *shell;
23 struct wl_shell_surface *shell_surface; 23 struct wl_shell_surface *shell_surface;
24 struct wl_shm *shm; 24 struct wl_shm *shm;
25 struct wl_buffer *buffer; 25 /* struct wl_buffer *buffer; */
26 void *data; 26 void *data;
27 int width; 27 int width;
28 int height; 28 int height;
@@ -33,7 +33,7 @@ static struct _engine_wayland_shm_display wl;
33/* 33/*
34 * Function Prototypes 34 * Function Prototypes
35 */ 35 */
36static void _engine_wayland_shm_create_buffer(int width, int height); 36/* static void _engine_wayland_shm_create_buffer(int width, int height); */
37 37
38/* Registry handler */ 38/* Registry handler */
39static void _registry_handle_global(void *data, struct wl_registry *registry, unsigned int id, const char *interface, unsigned int version __UNUSED__); 39static void _registry_handle_global(void *data, struct wl_registry *registry, unsigned int id, const char *interface, unsigned int version __UNUSED__);
@@ -68,6 +68,12 @@ engine_wayland_shm_args(const char *engine __UNUSED__, int width, int height)
68 } 68 }
69 69
70 wl.display = wl_display_connect(NULL); 70 wl.display = wl_display_connect(NULL);
71 if (!wl.display)
72 {
73 printf("Expedite cannot connect to wayland display\n");
74 return EINA_FALSE;
75 }
76
71 wl.registry = wl_display_get_registry(wl.display); 77 wl.registry = wl_display_get_registry(wl.display);
72 wl_registry_add_listener(wl.registry, &_registry_listener, NULL); 78 wl_registry_add_listener(wl.registry, &_registry_listener, NULL);
73 wl_display_roundtrip(wl.display); 79 wl_display_roundtrip(wl.display);
@@ -79,14 +85,15 @@ engine_wayland_shm_args(const char *engine __UNUSED__, int width, int height)
79 wl.surface = wl_compositor_create_surface(wl.compositor); 85 wl.surface = wl_compositor_create_surface(wl.compositor);
80 wl.shell_surface = engine_wayland_create_shell_surface(wl.shell, wl.surface, "Expedite Wayland SHM"); 86 wl.shell_surface = engine_wayland_create_shell_surface(wl.shell, wl.surface, "Expedite Wayland SHM");
81 87
82 _engine_wayland_shm_create_buffer(width, height); 88 /* _engine_wayland_shm_create_buffer(width, height); */
83 89
84 assert(wl.buffer != NULL); 90 /* assert(wl.buffer != NULL); */
85 assert(wl.data != NULL); 91 /* assert(wl.data != NULL); */
86 92
87 wl_surface_attach(wl.surface, wl.buffer, 0, 0); 93 /* wl_surface_attach(wl.surface, wl.buffer, 0, 0); */
88 94
89 einfo->info.dest = wl.data; 95 einfo->info.wl_shm = wl.shm;
96 einfo->info.wl_surface = wl.surface;
90 if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo)) 97 if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
91 { 98 {
92 printf("Evas can not setup the informations of the Wayland SHM Engine\n"); 99 printf("Evas can not setup the informations of the Wayland SHM Engine\n");
@@ -114,7 +121,7 @@ engine_wayland_shm_shutdown(void)
114 if (wl.frame_callback) 121 if (wl.frame_callback)
115 wl_callback_destroy(wl.frame_callback); 122 wl_callback_destroy(wl.frame_callback);
116 123
117 wl_buffer_destroy(wl.buffer); 124 /* wl_buffer_destroy(wl.buffer); */
118 wl_shell_surface_destroy(wl.shell_surface); 125 wl_shell_surface_destroy(wl.shell_surface);
119 wl_surface_destroy(wl.surface); 126 wl_surface_destroy(wl.surface);
120 wl_shm_destroy(wl.shm); 127 wl_shm_destroy(wl.shm);
@@ -141,44 +148,44 @@ _registry_handle_global(void *data __UNUSED__, struct wl_registry *registry, uns
141 wl.shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); 148 wl.shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
142} 149}
143 150
144static void 151/* static void */
145_engine_wayland_shm_create_buffer(int width, int height) 152/* _engine_wayland_shm_create_buffer(int width, int height) */
146{ 153/* { */
147 struct wl_shm_pool *pool; 154/* struct wl_shm_pool *pool; */
148 int fd, size, stride; 155/* int fd, size, stride; */
149 char tmp[PATH_MAX]; 156/* char tmp[PATH_MAX]; */
150 157
151 stride = width * 4; 158/* stride = width * 4; */
152 size = stride * height; 159/* size = stride * height; */
153 160
154 strcpy(tmp, "/tmp/expedite-wayland_shm-XXXXXX"); 161/* strcpy(tmp, "/tmp/expedite-wayland_shm-XXXXXX"); */
155 if ((fd = mkstemp(tmp)) < 0) 162/* if ((fd = mkstemp(tmp)) < 0) */
156 { 163/* { */
157 fprintf(stderr, "Could not create temporary file.\n"); 164/* fprintf(stderr, "Could not create temporary file.\n"); */
158 return; 165/* return; */
159 } 166/* } */
160 167
161 if (ftruncate(fd, size) < 0) 168/* if (ftruncate(fd, size) < 0) */
162 { 169/* { */
163 fprintf(stderr, "Could not truncate temporary file.\n"); 170/* fprintf(stderr, "Could not truncate temporary file.\n"); */
164 goto end; 171/* goto end; */
165 } 172/* } */
166 173
167 wl.data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); 174/* wl.data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); */
168 if (wl.data == MAP_FAILED) 175/* if (wl.data == MAP_FAILED) */
169 { 176/* { */
170 wl.data = NULL; 177/* wl.data = NULL; */
171 fprintf(stderr, "mmap failed\n"); 178/* fprintf(stderr, "mmap failed\n"); */
172 goto end; 179/* goto end; */
173 } 180/* } */
174 181
175 pool = wl_shm_create_pool(wl.shm, fd, size); 182/* pool = wl_shm_create_pool(wl.shm, fd, size); */
176 wl.buffer = wl_shm_pool_create_buffer(pool, 0, width, height, stride, WL_SHM_FORMAT_XRGB8888); 183/* wl.buffer = wl_shm_pool_create_buffer(pool, 0, width, height, stride, WL_SHM_FORMAT_XRGB8888); */
177 wl_shm_pool_destroy(pool); 184/* wl_shm_pool_destroy(pool); */
178 185
179 end: 186/* end: */
180 close(fd); 187/* close(fd); */
181} 188/* } */
182 189
183static void 190static void
184_surface_frame_handle_complete(void *data __UNUSED__, struct wl_callback *callback __UNUSED__, uint32_t time __UNUSED__) 191_surface_frame_handle_complete(void *data __UNUSED__, struct wl_callback *callback __UNUSED__, uint32_t time __UNUSED__)