Commit 53d746d7 authored by Laurent Aimar's avatar Laurent Aimar Committed by Rémi Duraffort

Used VA_INVALID_SURFACE when appropriate.

(cherry picked from commit 7b27f950b0fe4c76acbea58ea183a486bdc7da2e)
Signed-off-by: default avatarRémi Duraffort <ivoire@videolan.org>
parent 90485043
...@@ -173,7 +173,7 @@ error: ...@@ -173,7 +173,7 @@ error:
static void DestroySurfaces( vlc_va_vaapi_t *p_va ) static void DestroySurfaces( vlc_va_vaapi_t *p_va )
{ {
if( p_va->image.image_id ) if( p_va->image.image_id != VA_INVALID_SURFACE )
{ {
CopyCleanCache( &p_va->image_cache ); CopyCleanCache( &p_va->image_cache );
vaDestroyImage( p_va->p_display, p_va->image.image_id ); vaDestroyImage( p_va->p_display, p_va->image.image_id );
...@@ -192,7 +192,7 @@ static void DestroySurfaces( vlc_va_vaapi_t *p_va ) ...@@ -192,7 +192,7 @@ static void DestroySurfaces( vlc_va_vaapi_t *p_va )
free( p_va->p_surface ); free( p_va->p_surface );
/* */ /* */
p_va->image.image_id = 0; p_va->image.image_id = VA_INVALID_SURFACE;
p_va->i_context_id = 0; p_va->i_context_id = 0;
p_va->p_surface = NULL; p_va->p_surface = NULL;
p_va->i_surface_width = 0; p_va->i_surface_width = 0;
...@@ -207,6 +207,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t ...@@ -207,6 +207,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
p_va->p_surface = calloc( p_va->i_surface_count, sizeof(*p_va->p_surface) ); p_va->p_surface = calloc( p_va->i_surface_count, sizeof(*p_va->p_surface) );
if( !p_va->p_surface ) if( !p_va->p_surface )
return VLC_EGENERIC; return VLC_EGENERIC;
p_va->image.image_id = VA_INVALID_SURFACE;
/* Create surfaces */ /* Create surfaces */
VASurfaceID pi_surface_id[p_va->i_surface_count]; VASurfaceID pi_surface_id[p_va->i_surface_count];
...@@ -258,7 +259,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t ...@@ -258,7 +259,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
{ {
if( vaCreateImage( p_va->p_display, &p_fmt[i], i_width, i_height, &p_va->image ) ) if( vaCreateImage( p_va->p_display, &p_fmt[i], i_width, i_height, &p_va->image ) )
{ {
p_va->image.image_id = 0; p_va->image.image_id = VA_INVALID_SURFACE;
continue; continue;
} }
/* Validate that vaGetImage works with this format */ /* Validate that vaGetImage works with this format */
...@@ -267,7 +268,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t ...@@ -267,7 +268,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
p_va->image.image_id) ) p_va->image.image_id) )
{ {
vaDestroyImage( p_va->p_display, p_va->image.image_id ); vaDestroyImage( p_va->p_display, p_va->image.image_id );
p_va->image.image_id = 0; p_va->image.image_id = VA_INVALID_SURFACE;
continue; continue;
} }
......
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