glupload: dmabuf: use out_info to create allocation params for non-direct dmabuf...
authorPhilipp Zabel <p.zabel@pengutronix.de>
Wed, 12 Dec 2018 14:48:09 +0000 (15:48 +0100)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Thu, 13 Dec 2018 14:52:13 +0000 (15:52 +0100)
Non-direct dmabuf uploads, just as direct dmabuf uploads, create EGL
images and thus GL textures of the same width as the imported image.
The input dmabuf line stride is not relevant to the resulting texture
in both cases.

This fixes the case where non-direct uploads of input dmabufs with line
stride larger than the width will for example cause glcolorconvert to
sample only the left part (width * bytes per pixel / stride) of the
image, causing a horizontally stretched and cropped output image.

gst-libs/gst/gl/gstglupload.c

index 26d2a9f..f1108f4 100644 (file)
@@ -609,7 +609,7 @@ _dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
 {
   struct DmabufUpload *dmabuf = impl;
   GstVideoInfo *in_info = &dmabuf->upload->priv->in_info;
-  GstVideoInfo *out_info = in_info;
+  GstVideoInfo *out_info = &dmabuf->out_info;
   guint n_planes = GST_VIDEO_INFO_N_PLANES (in_info);
   GstVideoMeta *meta;
   guint n_mem;
@@ -649,13 +649,10 @@ _dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
     }
   }
 
-  if (dmabuf->direct) {
-    if (out_caps != dmabuf->out_caps) {
-      dmabuf->out_caps = out_caps;
-      if (!gst_video_info_from_caps (&dmabuf->out_info, out_caps))
-        return FALSE;
-    }
-    out_info = &dmabuf->out_info;
+  if (out_caps != dmabuf->out_caps) {
+    dmabuf->out_caps = out_caps;
+    if (!gst_video_info_from_caps (out_info, out_caps))
+      return FALSE;
   }
 
   if (dmabuf->params)