Commit 2bb37b36 authored by Sjoerd Simons's avatar Sjoerd Simons Committed by Nicolas Dufresne

glupload: dmabuf: be explicit about gl formats used

Rather then letting gst_gl_memory_setup_buffer guess the GL format used
for an eglimage after importing a dmabuf be explicit about it. This
fixes issues where dmabuf import may have used another format then
gst_gl_format_from_video_info would guess on the basis of the available
GL extensions.

In particular on etnaviv the gst_gl_format_from_video_info would
assuming a luminance + alpha GL format is used for YUY2, but the dmabuf
import will always use RG88. Which causes images to end up somewhat pink when
displayed on the screen.
parent 2041434f
......@@ -487,6 +487,7 @@ struct DmabufUpload
GstGLUpload *upload;
GstEGLImage *eglimage[GST_VIDEO_MAX_PLANES];
GstGLFormat formats[GST_VIDEO_MAX_PLANES];
GstBuffer *outbuf;
GstGLVideoAllocationParams *params;
};
......@@ -667,6 +668,7 @@ _dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
return FALSE;
_set_cached_eglimage (mems[i], dmabuf->eglimage[i], i);
dmabuf->formats[i] = dmabuf->eglimage[i]->format;
}
return TRUE;
......@@ -691,8 +693,9 @@ _dma_buf_upload_perform_gl_thread (GstGLContext * context,
/* FIXME: buffer pool */
dmabuf->outbuf = gst_buffer_new ();
gst_gl_memory_setup_buffer (allocator, dmabuf->outbuf, dmabuf->params, NULL,
(gpointer *) dmabuf->eglimage, gst_buffer_n_memory (dmabuf->outbuf));
gst_gl_memory_setup_buffer (allocator, dmabuf->outbuf, dmabuf->params,
dmabuf->formats, (gpointer *) dmabuf->eglimage,
gst_buffer_n_memory (dmabuf->outbuf));
gst_object_unref (allocator);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment