After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 797308 - vaapiencoder: Surface concurrency issues, failed to encode frame due to 'surface in use'
vaapiencoder: Surface concurrency issues, failed to encode frame due to 'surf...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer-vaapi
1.12.2
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-10-19 13:21 UTC by Myles Inglis
Modified: 2018-11-03 15:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add lock to gstvaapisurface patch (4.31 KB, patch)
2018-10-19 13:21 UTC, Myles Inglis
none Details | Review

Description Myles Inglis 2018-10-19 13:21:51 UTC
Created attachment 373971 [details] [review]
Add lock to gstvaapisurface patch

It seems that gstreamer-vaapi currently does not synchronise access to the vaapi surfaces correctly.

Attempting to use a VASurface while it is mapped (with vaMapBuffer) results in a surface is in use error from vaapi. This was causing an issue for us where one branch of the pipeline would map a GstBuffer and another branch of the pipeline would attempt to encode the buffer with the vaapiencoder while it is mapped. The result is that gstvaapiencoder fails to encode the buffer, and the whole pipeline is stopped.

I've attached the patch we have used to fix the issue. This adds a mutex to gstvaapisurface that is used to correctly synchronise access.

We're using a slightly older version of gstreamer but it doesn't seem like this has changed in the latest master.
Comment 1 Víctor Manuel Jáquez Leal 2018-10-19 13:43:59 UTC
Hi,

Thanks for the patch.

Do you have any pipeline/program that shows the problem?
Comment 2 Myles Inglis 2018-10-31 16:01:03 UTC
Hi,

Sorry for the delayed response.

The problem is that we have quite a complex pipeline with many custom elements. I've tried to find a pipeline with standard gstreamer elements that demonstrates this but most of my attempts have just resulted in a deadlock...

In theory you should see the problem if a GstBuffer is mapped in one thread while another tries to encode it. I tried to write a small program to prove this but again I only saw deadlocks.

I'll get back to you if I find a reliable way to reproduce the issue.
Comment 3 GStreamer system administrator 2018-11-03 15:56:05 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/109.