mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
vaallocator: force non-derived for old mesa drivers
Mesa <23.3 can't map derived images for P010 format. This patch forces non-derived if this is the case. See: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24381 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5760>
This commit is contained in:
parent
ddf6fd9c61
commit
7332eb6427
1 changed files with 58 additions and 0 deletions
|
@ -42,6 +42,8 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h> /* sscanf */
|
||||||
|
|
||||||
#include "gstvasurfacecopy.h"
|
#include "gstvasurfacecopy.h"
|
||||||
#include "gstvavideoformat.h"
|
#include "gstvavideoformat.h"
|
||||||
#include "vasurfaceimage.h"
|
#include "vasurfaceimage.h"
|
||||||
|
@ -1321,6 +1323,50 @@ _reset_mem (GstVaMemory * mem, GstAllocator * allocator, gsize size)
|
||||||
0 /* align */ , 0 /* offset */ , size);
|
0 /* align */ , 0 /* offset */ , size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HACK:
|
||||||
|
*
|
||||||
|
* This method should be defined as a public method of GstVaDisplay. But in
|
||||||
|
* order to backport this fix, it's kept locally.
|
||||||
|
*/
|
||||||
|
static gboolean
|
||||||
|
_gst_va_display_get_vendor_version (GstVaDisplay * display, guint * major,
|
||||||
|
guint * minor)
|
||||||
|
{
|
||||||
|
VADisplay dpy;
|
||||||
|
guint maj, min;
|
||||||
|
const char *vendor;
|
||||||
|
|
||||||
|
dpy = gst_va_display_get_va_dpy (display);
|
||||||
|
vendor = vaQueryVendorString (dpy);
|
||||||
|
if (vendor && sscanf (vendor, "Mesa Gallium driver %d.%d.", &maj, &min) == 2) {
|
||||||
|
*major = maj;
|
||||||
|
*minor = min;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_is_old_mesa (GstVaAllocator * va_allocator)
|
||||||
|
{
|
||||||
|
guint major, minor;
|
||||||
|
|
||||||
|
if (!GST_VA_DISPLAY_IS_IMPLEMENTATION (va_allocator->display, MESA_GALLIUM))
|
||||||
|
return FALSE;
|
||||||
|
if (!_gst_va_display_get_vendor_version (va_allocator->display, &major,
|
||||||
|
&minor)) {
|
||||||
|
GST_WARNING ("Could not parse version from Mesa vendor string");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (major > 23)
|
||||||
|
return FALSE;
|
||||||
|
if (major == 23 && minor > 2)
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
_update_info (GstVideoInfo * info, const VAImage * image)
|
_update_info (GstVideoInfo * info, const VAImage * image)
|
||||||
{
|
{
|
||||||
|
@ -1364,6 +1410,18 @@ _update_image_info (GstVaAllocator * va_allocator)
|
||||||
va_allocator->feat_use_derived = GST_VA_FEATURE_DISABLED;
|
va_allocator->feat_use_derived = GST_VA_FEATURE_DISABLED;
|
||||||
}
|
}
|
||||||
va_allocator->use_derived = FALSE;
|
va_allocator->use_derived = FALSE;
|
||||||
|
#else
|
||||||
|
/* XXX: Derived in Mesa <23.3 can't use derived images for P010 format
|
||||||
|
* https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24381
|
||||||
|
*/
|
||||||
|
if (va_allocator->img_format == GST_VIDEO_FORMAT_P010_10LE
|
||||||
|
&& _is_old_mesa (va_allocator)) {
|
||||||
|
if (va_allocator->feat_use_derived != GST_VA_FEATURE_DISABLED) {
|
||||||
|
GST_INFO_OBJECT (va_allocator, "Disable image derive on old Mesa.");
|
||||||
|
va_allocator->feat_use_derived = GST_VA_FEATURE_DISABLED;
|
||||||
|
}
|
||||||
|
va_allocator->use_derived = FALSE;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Try derived first, but different formats can never derive */
|
/* Try derived first, but different formats can never derive */
|
||||||
if (va_allocator->feat_use_derived != GST_VA_FEATURE_DISABLED
|
if (va_allocator->feat_use_derived != GST_VA_FEATURE_DISABLED
|
||||||
|
|
Loading…
Reference in a new issue