Commit df3cbd54 authored by Jean-Paul Saman's avatar Jean-Paul Saman

codec/avcodec/vaapi: cleanup

Cleanup no longer needed variables.
parent 76a2372f
......@@ -179,7 +179,6 @@ static void DestroySurfaces( vlc_va_vaapi_t *p_va )
for( int i = 0; i < p_va->i_surface_count && p_va->p_surface; i++ )
{
vlc_va_surface_t *p_surface = &p_va->p_surface[i];
p_surface->i_state = FREE;
if( p_surface->i_id != VA_INVALID_SURFACE )
vaDestroySurfaces( p_va->conn->p_display, &p_surface->i_id, 1 );
}
......@@ -224,8 +223,6 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
p_surface->i_id = pi_surface_id[i];
p_surface->i_refcount = 0;
p_surface->i_order = 0;
p_surface->i_state = FREE;
p_surface->i_cache = VA_INVALID_ID;
}
/* Create a context */
......@@ -416,11 +413,8 @@ static void Put(vlc_va_t *p_external, AVFrame *p_ff, picture_t *p_picture )
if (!p_picture->p_sys)
abort();
assert( p_picture->p_sys->i_state == FREE );
picture_sys_t *p_surface = p_picture->p_sys;
p_surface->i_state = DECODE;
p_surface->i_order = p_va->i_surface_order++;
assert(p_surface->i_refcount == 1);
/* */
for( int i = 0; i < 4; i++ )
......@@ -453,10 +447,6 @@ static int DisplayPicture( vlc_va_t *p_external, picture_t *p_picture )
#endif
goto error;
assert( p_picture->p_sys->i_state == DECODE );
p_picture->p_sys->i_state = DISPLAY;
p_va->conn->unlock();
return VLC_SUCCESS;
......@@ -478,28 +468,21 @@ static int Get( vlc_va_t *p_external, AVFrame *p_ff )
{
vlc_va_surface_t *p_surface = &p_va->p_surface[i];
if( p_surface->i_refcount == 0 &&
p_surface->i_state == FREE )
if( p_surface->i_refcount == 0 )
break;
if( p_surface->i_order < p_va->p_surface[i_old].i_order )
i_old = i;
}
if( i >= p_va->i_surface_count )
{
vlc_va_surface_t *p_surface = &p_va->p_surface[i];
if( p_surface->i_state != FREE )
return VLC_EGENERIC;
i = i_old;
}
vlc_va_surface_t *p_surface = &p_va->p_surface[i];
assert( p_surface->i_state == FREE );
/* NOTE: reset surface refcount otherwise they will be leaked and
* mayhem may happen down the road.
*/
p_surface->i_refcount = 1;
p_surface->i_state = DECODE;
p_surface->i_order = p_va->i_surface_order++;
/* */
......@@ -528,13 +511,6 @@ static void Release( vlc_va_t *p_external, AVFrame *p_ff )
{
if( p_surface->i_refcount > 0 )
p_surface->i_refcount--;
if (p_surface->i_state == DECODE)
{
assert( p_surface->i_refcount == 0 );
p_surface->i_state = FREE;
}
else if( p_surface->i_state == DISPLAY )
p_surface->i_refcount = 1;
}
}
}
......
......@@ -30,16 +30,11 @@ struct vlc_va_conn_t
void (*unlock)(void);
};
typedef enum { FREE=0, DECODE=1, DISPLAY=2 } vlc_va_state_t;
typedef struct
{
VASurfaceID i_id;
int i_refcount;
unsigned int i_order;
vlc_va_state_t i_state;
/* subpicture */
unsigned int i_cache;
} vlc_va_surface_t;
struct picture_sys_t
......@@ -49,9 +44,7 @@ struct picture_sys_t
/* Link surface with picture_sys_t permanently */
VASurfaceID i_id;
int i_refcount; /* no longer needed */
unsigned int i_order; /* no longer needed */
vlc_va_state_t i_state; /* no longer needed */
int i_refcount;
/* subpicture */
unsigned int i_cache;
......
......@@ -1189,7 +1189,6 @@ static void DisplayPicture(vout_display_t *vd, picture_t *pic, subpicture_t *sub
picture_sys_t *surface = pic->p_sys;
if (surface->i_state == DISPLAY)
DisplayVASurface(vd, surface->i_id, pic);
/* Check if we still need this subpicture cache */
......@@ -1283,7 +1282,6 @@ static void PictureUnlock(picture_t *picture)
//assert(surface->i_refcount == 0);
surface->i_refcount = 0;
surface->i_cache = VA_INVALID_ID;
surface->i_state = FREE;
}
/**
......@@ -1317,9 +1315,7 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
pic->format.i_chroma = VLC_CODEC_VAAPI_SURFACE;
pic_sys->i_id = VA_INVALID_SURFACE;
pic_sys->i_refcount = 0; /* No longer needed ? */
pic_sys->i_order = 0; /* No longer needed ? */
pic_sys->i_state = FREE; /* No longer needed ? */
pic_sys->i_refcount = 0;
pic_sys->i_cache = VA_INVALID_ID;
pic_sys->obj = VLC_OBJECT(vd);
......
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