Commit 8a9898b6 authored by Jean-Paul Saman's avatar Jean-Paul Saman

src/xvba_video_glx.c: fix refcounting surface.

A GLX surface can be in use by multiple VASurfaces, therefor make
sure refcounting is done properly. The code did not honor this and
could destroy a surface that was still in use by another GLX Surface
object.

The code is changed to enforce proper refcounting. Basically using

   destroy_glx_surface(driver_data, obj_glx_surface);

is suspicious and should be replaced by:

   glx_surface_unref(driver_data, obj_glx_surface);

instead. This function decreases the refcount on obj_glx_surface and
when it reaches 0, then it destroys the surface properly.
parent 265d9f65
......@@ -792,6 +792,7 @@ end:
glDisable(target);
if (is_error && obj_glx_surface) {
obj_glx_surface->refcount = 0;
destroy_glx_surface(driver_data, obj_glx_surface);
obj_glx_surface = NULL;
}
......@@ -1598,7 +1599,7 @@ xvba_DestroySurfaceGLX(
if (!gl_set_current_context(new_cs, &old_cs))
return VA_STATUS_ERROR_OPERATION_FAILED;
destroy_glx_surface(driver_data, obj_glx_surface);
glx_surface_unref(driver_data, obj_glx_surface);
gl_destroy_context(new_cs);
gl_set_current_context(&old_cs, NULL);
......@@ -1807,7 +1808,7 @@ glx_output_surface_destroy(
if (obj_output->gl_surface) {
if (!obj_output->parent)
destroy_glx_surface(driver_data, obj_output->gl_surface);
glx_surface_unref(driver_data, obj_output->gl_surface);
obj_output->gl_surface = NULL;
}
......@@ -2093,7 +2094,7 @@ glx_output_surface_ensure_size(
/* Make sure the VA/GLX surface is created */
if (size_changed) {
destroy_glx_surface(driver_data, glx_output->gl_surface);
glx_surface_unref(driver_data, glx_output->gl_surface);
glx_output->gl_surface = NULL;
}
if (!glx_output->gl_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