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

vmem: lock pictures before creating pool

parent f33d8151
......@@ -105,22 +105,9 @@ typedef unsigned (*vlc_format_cb)(void **, char *, unsigned *, unsigned *,
unsigned *, unsigned *);
static picture_pool_t *Pool (vout_display_t *, unsigned);
static void Prepare(vout_display_t *, picture_t *, subpicture_t *);
static void Display(vout_display_t *, picture_t *, subpicture_t *);
static int Control(vout_display_t *, int, va_list);
static void Lock(void *data, picture_t *pic)
{
vout_display_sys_t *sys = data;
picture_sys_t *picsys = pic->p_sys;
void *planes[PICTURE_PLANE_MAX];
picsys->id = sys->lock(sys->opaque, planes);
for (int i = 0; i < pic->i_planes; i++)
pic->p[i].p_pixels = planes[i];
}
static void Unlock(void *data, picture_t *pic)
{
vout_display_sys_t *sys = data;
......@@ -247,7 +234,7 @@ static int Open(vlc_object_t *object)
vd->fmt = fmt;
vd->info = info;
vd->pool = Pool;
vd->prepare = Prepare;
vd->prepare = NULL;
vd->display = Display;
vd->control = Control;
vd->manage = NULL;
......@@ -298,10 +285,12 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
picsys->id = NULL;
picture_resource_t rsc = { .p_sys = picsys };
void *planes[PICTURE_PLANE_MAX];
picsys->id = sys->lock(sys->opaque, planes);
for (unsigned i = 0; i < PICTURE_PLANE_MAX; i++) {
/* vmem-lock is responsible for the allocation */
rsc.p[i].p_pixels = NULL;
rsc.p[i].p_pixels = planes[i];
rsc.p[i].i_lines = sys->lines[i];
rsc.p[i].i_pitch = sys->pitches[i];
}
......@@ -321,17 +310,9 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
picture_Release(pictures[i]);
}
picture_pool_Enum(sys->pool, Lock, sys);
return sys->pool;
}
static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic)
{
Unlock(vd->sys, pic);
VLC_UNUSED(subpic);
}
static void Display(vout_display_t *vd, picture_t *pic, subpicture_t *subpic)
{
vout_display_sys_t *sys = vd->sys;
......@@ -339,7 +320,6 @@ static void Display(vout_display_t *vd, picture_t *pic, subpicture_t *subpic)
if (sys->display != NULL)
sys->display(sys->opaque, pic->p_sys->id);
Lock(sys, pic);
picture_Release(pic);
VLC_UNUSED(subpic);
}
......
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