mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
va: retry if surface creation fails
Old versions of mesa doesn't support VASurfaceAttribDRMFormatModifiers. To solve it, by just ignoring the modifiers assuming that linear is accepted and produced, the creation of frames will be tried again without that attribute. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5256>
This commit is contained in:
parent
52971faf14
commit
22c8d1890e
1 changed files with 16 additions and 0 deletions
|
@ -115,8 +115,24 @@ va_create_surfaces (GstVaDisplay * display, guint rt_format, guint fourcc,
|
|||
/* *INDENT-ON* */
|
||||
}
|
||||
|
||||
retry:
|
||||
status = vaCreateSurfaces (dpy, rt_format, width, height, surfaces,
|
||||
num_surfaces, attrs, num_attrs);
|
||||
|
||||
if (status == VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
|
||||
&& attrs[num_attrs - 1].type == VASurfaceAttribDRMFormatModifiers) {
|
||||
int i;
|
||||
|
||||
/* if requested modifiers contain linear, let's remove the attribute and
|
||||
* "hope" the driver will create linear dmabufs */
|
||||
for (i = 0; i < num_modifiers; ++i) {
|
||||
if (modifiers[i] == DRM_FORMAT_MOD_LINEAR) {
|
||||
num_attrs--;
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (status != VA_STATUS_SUCCESS) {
|
||||
GST_ERROR ("vaCreateSurfaces: %s", vaErrorStr (status));
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in a new issue