vaapi: decoder: modify the condition to judge whether dma buffer is supported

It seems "GST_VAAPI_PLUGIN_BASE_SRC_PAD_CAN_DMABUF (decode)" will
return false even if this platform support the mem_type dma buffer.
And media-driver will return GST_VAAPI_BUFFER_MEMORY_TYPE_DMA_BUF2
on Gen12(such as TGL).
Without this patch, The command such as:
gst-launch-1.0 videotestsrc num-buffers=100 ! video/x-raw, format=I420 ! \
x264enc ! h264parse ! vaapih264dec ! video/x-raw\(memory:DMABuf\) ! fakesink
will return not-negotiated.

Signed-off-by: Zhang Yuankun <yuankunx.zhang@intel.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/437>
This commit is contained in:
Zhang Yuankun 2021-08-26 15:06:53 +08:00
parent 7809c58664
commit bd8c0b33e7

View file

@ -274,9 +274,10 @@ gst_vaapidecode_ensure_allowed_srcpad_caps (GstVaapiDecode * decode)
gst_caps_set_features_simple (va_caps,
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE));
if (GST_VAAPI_PLUGIN_BASE_SRC_PAD_CAN_DMABUF (decode)
&& gst_vaapi_mem_type_supports (mem_types,
GST_VAAPI_BUFFER_MEMORY_TYPE_DMA_BUF)) {
if (gst_vaapi_mem_type_supports (mem_types,
GST_VAAPI_BUFFER_MEMORY_TYPE_DMA_BUF) ||
gst_vaapi_mem_type_supports (mem_types,
GST_VAAPI_BUFFER_MEMORY_TYPE_DMA_BUF2)) {
dma_caps = gst_caps_copy (base_caps);
gst_caps_set_features_simple (dma_caps,
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_DMABUF));