mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
gstgl: Fix handling of padded tile formats
When a tile format is padded and imported as DMABuf, the stride contains the information about the actual width and height in number of tiles. This information is needed by the detiling shader in order accuratly calculate the location of pixels. To fix that, we also copy the offset and strides into the otuput format and the converter will ensure that the shader is recompiled whenever the stride changes. This fixes video corruptions observed when decoding on MT8195 with videos that aren't not aligned to 64bytes in width. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3365>
This commit is contained in:
parent
e3637e3207
commit
aaa01ac30a
2 changed files with 27 additions and 0 deletions
|
@ -3055,6 +3055,18 @@ _do_convert (GstGLContext * context, GstGLColorConvert * convert)
|
|||
gst_gl_color_convert_reset_shader (convert);
|
||||
}
|
||||
|
||||
if (GST_VIDEO_FORMAT_INFO_IS_TILED (convert->in_info.finfo)) {
|
||||
GstVideoMeta *vmeta = gst_buffer_get_video_meta (convert->inbuf);
|
||||
gsize stride;
|
||||
|
||||
stride = GST_VIDEO_INFO_PLANE_STRIDE (&convert->in_info, 0);
|
||||
|
||||
if (vmeta && vmeta->stride[0] != stride) {
|
||||
GST_VIDEO_INFO_PLANE_STRIDE (&convert->in_info, 0) = vmeta->stride[0];
|
||||
gst_gl_color_convert_reset_shader (convert);
|
||||
}
|
||||
}
|
||||
|
||||
if (!_init_convert (convert)) {
|
||||
convert->priv->result = FALSE;
|
||||
return;
|
||||
|
|
|
@ -676,6 +676,21 @@ _dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
|
|||
dmabuf->out_caps = out_caps;
|
||||
if (!gst_video_info_from_caps (out_info, out_caps))
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* When we zero-copy tiles, we need to propagate the strides, which contains
|
||||
* the tile dimension. This is because the shader needs to know the padded
|
||||
* size in order to correctly sample into these special buffer.
|
||||
*/
|
||||
if (meta && GST_VIDEO_FORMAT_INFO_IS_TILED (out_info->finfo)) {
|
||||
out_info->width = meta->width;
|
||||
out_info->height = meta->height;
|
||||
|
||||
for (i = 0; i < meta->n_planes; i++) {
|
||||
out_info->offset[i] = meta->offset[i];
|
||||
out_info->stride[i] = meta->stride[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dmabuf->params)
|
||||
|
|
Loading…
Reference in a new issue