Commit 4cd31c83 authored by Steve Lhomme's avatar Steve Lhomme

directx_va: get the picture_context_t from the va_pool

We can fill the picture outside of this call.
parent e3ad334a
......@@ -287,9 +287,10 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
else
#endif
{
int res = va_pool_Get(&va->sys->dx_sys.va_pool, pic);
if (unlikely(res != VLC_SUCCESS))
return res;
picture_context_t *pic_ctx = va_pool_Get(&va->sys->dx_sys.va_pool);
if (unlikely(pic_ctx == NULL))
return VLC_ENOITEM;
pic->context = pic_ctx;
}
*data = (uint8_t*)((struct va_pic_context *)pic->context)->picsys.decoder;
return VLC_SUCCESS;
......
......@@ -229,10 +229,13 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
return VLC_EGENERIC;
}
int res = va_pool_Get(&sys->dx_sys.va_pool, pic);
if (likely(res==VLC_SUCCESS))
*data = (uint8_t*)((struct va_pic_context*)pic->context)->picsys.surface;
return res;
picture_context_t *pic_ctx = va_pool_Get(&sys->dx_sys.va_pool);
if (likely(pic_ctx==NULL))
return VLC_ENOITEM;
pic->context = pic_ctx;
*data = (uint8_t*)((struct va_pic_context*)pic->context)->picsys.surface;
return VLC_SUCCESS;
}
static void Close(vlc_va_t *va, void **ctx)
......
......@@ -157,24 +157,23 @@ static picture_context_t *GetSurface(va_pool_t *va_pool)
return NULL;
}
int va_pool_Get(va_pool_t *va_pool, picture_t *pic)
picture_context_t *va_pool_Get(va_pool_t *va_pool)
{
unsigned tries = (VLC_TICK_FROM_SEC(1) + VOUT_OUTMEM_SLEEP) / VOUT_OUTMEM_SLEEP;
picture_context_t *field;
if (va_pool->surface_count == 0)
return VLC_ENOITEM;
return NULL;
while ((field = GetSurface(va_pool)) == NULL)
{
if (--tries == 0)
return VLC_ENOITEM;
return NULL;
/* Pool empty. Wait for some time as in src/input/decoder.c.
* XXX: Both this and the core should use a semaphore or a CV. */
vlc_tick_sleep(VOUT_OUTMEM_SLEEP);
}
pic->context = field;
return VLC_SUCCESS;
return field;
}
void va_surface_AddRef(vlc_va_surface_t *surface)
......
......@@ -78,7 +78,7 @@ int va_pool_Open(vlc_va_t *, const video_format_t *, va_pool_t *);
void va_pool_Close(vlc_va_t *va, va_pool_t *);
int va_pool_SetupDecoder(vlc_va_t *, va_pool_t *, const AVCodecContext *, unsigned count, int alignment);
int va_pool_SetupSurfaces(vlc_va_t *, va_pool_t *, unsigned count);
int va_pool_Get(va_pool_t *, picture_t *);
picture_context_t *va_pool_Get(va_pool_t *);
void va_surface_AddRef(vlc_va_surface_t *surface);
void va_surface_Release(vlc_va_surface_t *surface);
......
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