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
vout_window_t *embed; /* VLC window */
struct wl_event_queue *eventq;
struct wl_shm *shm;
struct wl_shm_pool *shm_pool;
picture_pool_t *pool; /* picture pool */
......@@ -122,9 +121,9 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
memset(base, 0x80, length); /* gray fill */
#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);
if (sys->shm_pool == NULL)
if (shm_pool == NULL)
{
munmap(base, length);
return NULL;
......@@ -149,7 +148,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
{
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);
if (buf == NULL)
break;
......@@ -171,24 +170,22 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
pics[count++] = pic;
}
wl_shm_pool_destroy(shm_pool);
wl_display_flush(sys->embed->display.wl);
if (length > 0)
munmap(base, length); /* Left-over buffers */
if (count == 0)
goto error;
wl_display_flush(sys->embed->display.wl);
return NULL;
sys->pool = picture_pool_New (count, pics);
if (unlikely(sys->pool == NULL))
{
while (count > 0)
picture_Release(pics[--count]);
goto error;
return NULL;
}
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)
......@@ -229,8 +226,6 @@ static void ResetPictures(vout_display_t *vd)
return;
picture_pool_Delete(sys->pool);
wl_shm_pool_destroy(sys->shm_pool);
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