mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 07:08:23 +00:00
vabase: Use correct VideoInfo during DMABUF import
The changes to the VideoInfo, notably the stride from the VideoMeta,
were lost. Avoid such mistakes by explicitly using the VideoInfo from
drm_info.
Fixes: 9f5b2c4e25
("va: use GstVideoInfoDmaDrm when importing buffers")
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7196>
This commit is contained in:
parent
3b398e7d9c
commit
7b7cf0afe4
1 changed files with 8 additions and 9 deletions
|
@ -39,7 +39,6 @@ static gboolean
|
||||||
_try_import_dmabuf_unlocked (GstVaBufferImporter * importer, GstBuffer * inbuf)
|
_try_import_dmabuf_unlocked (GstVaBufferImporter * importer, GstBuffer * inbuf)
|
||||||
{
|
{
|
||||||
GstVideoMeta *meta;
|
GstVideoMeta *meta;
|
||||||
GstVideoInfo in_info = *importer->in_info;
|
|
||||||
GstVideoInfoDmaDrm drm_info = *importer->in_drm_info;
|
GstVideoInfoDmaDrm drm_info = *importer->in_drm_info;
|
||||||
GstMemory *mems[GST_VIDEO_MAX_PLANES];
|
GstMemory *mems[GST_VIDEO_MAX_PLANES];
|
||||||
guint i, n_planes, usage_hint;
|
guint i, n_planes, usage_hint;
|
||||||
|
@ -52,24 +51,24 @@ _try_import_dmabuf_unlocked (GstVaBufferImporter * importer, GstBuffer * inbuf)
|
||||||
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;
|
||||||
|
|
||||||
n_planes = GST_VIDEO_INFO_N_PLANES (&in_info);
|
n_planes = GST_VIDEO_INFO_N_PLANES (&drm_info.vinfo);
|
||||||
|
|
||||||
meta = gst_buffer_get_video_meta (inbuf);
|
meta = gst_buffer_get_video_meta (inbuf);
|
||||||
|
|
||||||
/* Update video info importerd on video meta */
|
/* Update video info importerd on video meta */
|
||||||
if (meta) {
|
if (meta) {
|
||||||
GST_VIDEO_INFO_WIDTH (&in_info) = meta->width;
|
GST_VIDEO_INFO_WIDTH (&drm_info.vinfo) = meta->width;
|
||||||
GST_VIDEO_INFO_HEIGHT (&in_info) = meta->height;
|
GST_VIDEO_INFO_HEIGHT (&drm_info.vinfo) = meta->height;
|
||||||
|
|
||||||
g_assert (n_planes == meta->n_planes);
|
g_assert (n_planes == meta->n_planes);
|
||||||
|
|
||||||
for (i = 0; i < n_planes; i++) {
|
for (i = 0; i < n_planes; i++) {
|
||||||
GST_VIDEO_INFO_PLANE_OFFSET (&in_info, i) = meta->offset[i];
|
GST_VIDEO_INFO_PLANE_OFFSET (&drm_info.vinfo, i) = meta->offset[i];
|
||||||
GST_VIDEO_INFO_PLANE_STRIDE (&in_info, i) = meta->stride[i];
|
GST_VIDEO_INFO_PLANE_STRIDE (&drm_info.vinfo, i) = meta->stride[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_video_info_align_full (&in_info, &align, plane_size))
|
if (!gst_video_info_align_full (&drm_info.vinfo, &align, plane_size))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Find and validate all memories */
|
/* Find and validate all memories */
|
||||||
|
@ -79,8 +78,8 @@ _try_import_dmabuf_unlocked (GstVaBufferImporter * importer, GstBuffer * inbuf)
|
||||||
gsize mem_skip;
|
gsize mem_skip;
|
||||||
|
|
||||||
if (!gst_buffer_find_memory (inbuf,
|
if (!gst_buffer_find_memory (inbuf,
|
||||||
GST_VIDEO_INFO_PLANE_OFFSET (&in_info, i), plane_size[i], &mem_idx,
|
GST_VIDEO_INFO_PLANE_OFFSET (&drm_info.vinfo, i), plane_size[i],
|
||||||
&length, &mem_skip))
|
&mem_idx, &length, &mem_skip))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* We can't have more then one dmabuf per plane */
|
/* We can't have more then one dmabuf per plane */
|
||||||
|
|
Loading…
Reference in a new issue