kmssink: ensure we have a valid vinfo_drm after set_caps

Consequently drop the check in import_dmabuf

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5174>
This commit is contained in:
Jakub Adam 2024-09-07 00:43:37 +02:00 committed by He Junyan
parent d04a03d176
commit 9e81a6517b

View file

@ -1664,6 +1664,13 @@ gst_kms_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
} else { } else {
if (!gst_video_info_from_caps (&vinfo, caps)) if (!gst_video_info_from_caps (&vinfo, caps))
goto invalid_format; goto invalid_format;
self->vinfo_drm.drm_fourcc =
gst_video_dma_drm_fourcc_from_format (GST_VIDEO_INFO_FORMAT (&vinfo));
if (self->vinfo_drm.drm_fourcc == DRM_FORMAT_INVALID)
goto invalid_format;
self->vinfo_drm.vinfo = vinfo;
self->vinfo_drm.drm_modifier = DRM_FORMAT_MOD_LINEAR;
} }
self->vinfo = vinfo; self->vinfo = vinfo;
@ -1902,11 +1909,6 @@ gst_kms_sink_import_dmabuf (GstKMSSink * self, GstBuffer * inbuf,
if (!self->has_prime_import) if (!self->has_prime_import)
return FALSE; return FALSE;
/* Not a DMA format. */
if (GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo) !=
GST_VIDEO_FORMAT_DMA_DRM)
return FALSE;
/* This will eliminate most non-dmabuf out there */ /* This will eliminate most non-dmabuf out there */
if (!gst_is_dmabuf_memory (gst_buffer_peek_memory (inbuf, 0))) if (!gst_is_dmabuf_memory (gst_buffer_peek_memory (inbuf, 0)))
return FALSE; return FALSE;