Commit 99613a82 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

wayland/shm: no need to retain the shm_pool

parent 23e13d55
...@@ -47,7 +47,6 @@ struct vout_display_sys_t ...@@ -47,7 +47,6 @@ struct vout_display_sys_t
vout_window_t *embed; /* VLC window */ vout_window_t *embed; /* VLC window */
struct wl_event_queue *eventq; struct wl_event_queue *eventq;
struct wl_shm *shm; struct wl_shm *shm;
struct wl_shm_pool *shm_pool;
picture_pool_t *pool; /* picture pool */ picture_pool_t *pool; /* picture pool */
...@@ -122,9 +121,9 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req) ...@@ -122,9 +121,9 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
memset(base, 0x80, length); /* gray fill */ memset(base, 0x80, length); /* gray fill */
#endif #endif
sys->shm_pool = wl_shm_create_pool(sys->shm, fd, length); struct wl_shm_pool *shm_pool = wl_shm_create_pool(sys->shm, fd, length);
close(fd); close(fd);
if (sys->shm_pool == NULL) if (shm_pool == NULL)
{ {
munmap(base, length); munmap(base, length);
return NULL; return NULL;
...@@ -149,7 +148,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req) ...@@ -149,7 +148,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
{ {
struct wl_buffer *buf; struct wl_buffer *buf;
buf = wl_shm_pool_create_buffer(sys->shm_pool, offset, width, height, buf = wl_shm_pool_create_buffer(shm_pool, offset, width, height,
stride, WL_SHM_FORMAT_XRGB8888); stride, WL_SHM_FORMAT_XRGB8888);
if (buf == NULL) if (buf == NULL)
break; break;
...@@ -171,24 +170,22 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req) ...@@ -171,24 +170,22 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
pics[count++] = pic; pics[count++] = pic;
} }
wl_shm_pool_destroy(shm_pool);
wl_display_flush(sys->embed->display.wl);
if (length > 0) if (length > 0)
munmap(base, length); /* Left-over buffers */ munmap(base, length); /* Left-over buffers */
if (count == 0) if (count == 0)
goto error; return NULL;
wl_display_flush(sys->embed->display.wl);
sys->pool = picture_pool_New (count, pics); sys->pool = picture_pool_New (count, pics);
if (unlikely(sys->pool == NULL)) if (unlikely(sys->pool == NULL))
{ {
while (count > 0) while (count > 0)
picture_Release(pics[--count]); picture_Release(pics[--count]);
goto error; return NULL;
} }
return sys->pool; return sys->pool;
error:
wl_shm_pool_destroy(sys->shm_pool);
return NULL;
} }
static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic) static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic)
...@@ -229,8 +226,6 @@ static void ResetPictures(vout_display_t *vd) ...@@ -229,8 +226,6 @@ static void ResetPictures(vout_display_t *vd)
return; return;
picture_pool_Delete(sys->pool); picture_pool_Delete(sys->pool);
wl_shm_pool_destroy(sys->shm_pool);
sys->pool = NULL; sys->pool = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment