Commit 97e7b030 authored by Jean-Paul Saman's avatar Jean-Paul Saman

VAAPI: vaQuerySurfaceStatus() is totally unreliable.

The first time befor a surface is used it will return VASurfaceReady.
However whenever it has been used it status is ALWAYS VASurfaceRendering,
therefor it is unusable as a guard against selecting a surface that is
being used for rendering or displaying.
parent e3d44222
......@@ -289,6 +289,7 @@ static void destroy_surfaces( vlc_va_conn_t *conn )
abort();
}
if( surface->i_refcount > 0 )
surface->i_refcount --;
assert(surface->i_refcount == 0);
......@@ -310,25 +311,18 @@ static vlc_va_surface_t *get_surface(vlc_va_conn_t *conn)
assert( conn->pool.count > 0 );
assert( conn->pool.p_surfaces );
unsigned int next = conn->pool.current;
unsigned int next = (conn->pool.current + 1) % conn->pool.count;
unsigned int tries = 0;
while (tries < conn->pool.count)
while(tries < conn->pool.count)
{
VAStatus status;
VASurfaceStatus ready;
vlc_va_surface_t *surface;
surface = &conn->pool.p_surfaces[next];
vlc_mutex_lock(&surface->lock);
VASurfaceID id = surface->i_id;
status = vaQuerySurfaceStatus(conn->p_display, id, &ready);
if ((status == VA_STATUS_SUCCESS) &&
(ready == VASurfaceReady) &&
(surface->i_refcount == 0))
if (surface->i_refcount == 0)
{
surface->i_refcount++;
conn->pool.current = (next + 1) % conn->pool.count;
conn->pool.current = next;
vlc_mutex_unlock(&surface->lock);
return surface;
}
......@@ -351,16 +345,8 @@ static void release_surface(vlc_va_conn_t *conn, vlc_va_surface_t *surface)
if (surface->i_refcount == 0)
abort();
VAStatus status;
VASurfaceStatus ready;
VASurfaceID id = surface->i_id;
status = vaQuerySurfaceStatus(conn->p_display, id, &ready);
if ((status == VA_STATUS_SUCCESS) &&
(ready == VASurfaceReady))
{
surface->i_refcount--;
assert(surface->i_refcount == 0);
}
vlc_mutex_unlock(&surface->lock);
}
......
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