Commit 65c22d49 authored by Jean-Paul Saman's avatar Jean-Paul Saman

VAAPI: Add workaround for 'via' VDPAU drivers: do not block on closing vaapi context.

The code blocks in libva vaSyncSurface() when the decoding context has been destroyed.
The problem is observed with a 'via' vdpau driver.
parent 93028df6
...@@ -179,6 +179,11 @@ static void destroy_surfaces( vlc_va_conn_t *conn ) ...@@ -179,6 +179,11 @@ static void destroy_surfaces( vlc_va_conn_t *conn )
if( conn->i_ref_count > 1 ) if( conn->i_ref_count > 1 )
return; return;
bool b_workaround = false;
const char *psz_driver = getenv("VDPAU_DRIVER");
if( psz_driver && (strcmp(psz_driver, "via") == 0) )
b_workaround = true;
for( unsigned int i = 0; i < conn->pool.count; i++ ) for( unsigned int i = 0; i < conn->pool.count; i++ )
{ {
vlc_va_surface_t *surface = &conn->pool.p_surfaces[i]; vlc_va_surface_t *surface = &conn->pool.p_surfaces[i];
...@@ -187,11 +192,13 @@ static void destroy_surfaces( vlc_va_conn_t *conn ) ...@@ -187,11 +192,13 @@ static void destroy_surfaces( vlc_va_conn_t *conn )
if( surface->i_refcount > 1 ) if( surface->i_refcount > 1 )
abort(); abort();
if( !b_workaround &&
#if VA_CHECK_VERSION(0,31,0) #if VA_CHECK_VERSION(0,31,0)
if( vaSyncSurface( conn->p_display, surface->i_id ) ) vaSyncSurface( conn->p_display, surface->i_id )
#else #else
if( vaSyncSurface( conn->p_display, conn->i_context_id, surface->i_id ) ) vaSyncSurface( conn->p_display, conn->i_context_id, surface->i_id )
#endif #endif
)
{ {
fprintf(stderr, "Fatal error reboot your system\n" ); fprintf(stderr, "Fatal error reboot your system\n" );
abort(); abort();
......
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