mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
egl: Fix indirect dmabuf importation of none DRM formats
DRM Modifiers are not generically transferrable from a format like NV12 to their indirect shading format (R8 / RG88). So the helper to this do needs to be removed from our API. To make things worse, we support indirect formats that aren't DRM format in the first place. Notably NV12_16L32 (aka MM21) is not (yet) a DRM format. Yet, each plane can be indirectly imported using R8/RG88 and a detiling shader. This patch also removes this constraint restoring zero-copy playback on Mediatek SoC. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5461>
This commit is contained in:
parent
8a7d0efd96
commit
a869760199
3 changed files with 6 additions and 52 deletions
|
@ -644,45 +644,9 @@ get_egl_stride (const GstVideoInfo * info, gint plane)
|
|||
GstEGLImage *
|
||||
gst_egl_image_from_dmabuf (GstGLContext * context,
|
||||
gint dmabuf, const GstVideoInfo * in_info, gint plane, gsize offset)
|
||||
{
|
||||
GstVideoInfoDmaDrm in_info_dma;
|
||||
|
||||
if (!gst_video_info_dma_drm_from_video_info (&in_info_dma, in_info,
|
||||
DRM_FORMAT_MOD_LINEAR))
|
||||
return FALSE;
|
||||
|
||||
return gst_egl_image_from_dmabuf_with_dma_drm (context, dmabuf,
|
||||
&in_info_dma, plane, offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_egl_image_from_dmabuf_with_dma_drm:
|
||||
* @context: a #GstGLContext (must be an EGL context)
|
||||
* @dmabuf: the DMA-Buf file descriptor
|
||||
* @in_info_dma: the #GstVideoInfoDmaDrm in @dmabuf
|
||||
* @plane: the plane in @in_info to create and #GstEGLImage for
|
||||
* @offset: the byte-offset in the data
|
||||
*
|
||||
* Creates an EGL image that imports the dmabuf FD. The dmabuf data
|
||||
* is passed as RGBA data. Shaders later take this "RGBA" data and
|
||||
* convert it from its true format (described by in_info) to actual
|
||||
* RGBA output. For example, with I420, three EGL images are created,
|
||||
* one for each @plane, each EGL image with a single-channel R format.
|
||||
* With NV12, two EGL images are created, one with R format, one
|
||||
* with RG format etc. User can specify the modifier in @in_info_dma
|
||||
* for non-linear dmabuf.
|
||||
*
|
||||
* Returns: (nullable): a #GstEGLImage wrapping @dmabuf or %NULL on failure
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
GstEGLImage *
|
||||
gst_egl_image_from_dmabuf_with_dma_drm (GstGLContext * context, gint dmabuf,
|
||||
const GstVideoInfoDmaDrm * in_info_dma, gint plane, gsize offset)
|
||||
{
|
||||
gint comp[GST_VIDEO_MAX_COMPONENTS];
|
||||
GstGLFormat format = 0;
|
||||
const GstVideoInfo *in_info = &in_info_dma->vinfo;
|
||||
guintptr attribs[17];
|
||||
EGLImageKHR img;
|
||||
gint atti = 0;
|
||||
|
@ -713,11 +677,11 @@ gst_egl_image_from_dmabuf_with_dma_drm (GstGLContext * context, gint dmabuf,
|
|||
attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
|
||||
attribs[atti++] = get_egl_stride (in_info, plane);
|
||||
|
||||
if (with_modifiers && in_info_dma->drm_modifier != DRM_FORMAT_MOD_INVALID) {
|
||||
if (with_modifiers) {
|
||||
attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT;
|
||||
attribs[atti++] = in_info_dma->drm_modifier & 0xffffffff;
|
||||
attribs[atti++] = DRM_FORMAT_MOD_LINEAR & 0xffffffff;
|
||||
attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT;
|
||||
attribs[atti++] = (in_info_dma->drm_modifier >> 32) & 0xffffffff;
|
||||
attribs[atti++] = (DRM_FORMAT_MOD_LINEAR >> 32) & 0xffffffff;
|
||||
}
|
||||
|
||||
attribs[atti] = EGL_NONE;
|
||||
|
|
|
@ -88,12 +88,7 @@ GstEGLImage * gst_egl_image_from_dmabuf (GstGLContext *
|
|||
const GstVideoInfo * in_info,
|
||||
gint plane,
|
||||
gsize offset);
|
||||
GST_GL_API
|
||||
GstEGLImage * gst_egl_image_from_dmabuf_with_dma_drm (GstGLContext * context,
|
||||
gint dmabuf,
|
||||
const GstVideoInfoDmaDrm * in_info_dma,
|
||||
gint plane,
|
||||
gsize offset);
|
||||
|
||||
GST_GL_API
|
||||
GstEGLImage * gst_egl_image_from_dmabuf_direct (GstGLContext * context,
|
||||
gint *fd,
|
||||
|
|
|
@ -1390,11 +1390,6 @@ _dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
|
|||
if (_filter_caps_with_features (in_caps, filter_features, NULL)) {
|
||||
in_info_drm->drm_fourcc = gst_video_dma_drm_fourcc_from_format
|
||||
(GST_VIDEO_INFO_FORMAT (in_info));
|
||||
if (in_info_drm->drm_fourcc == DRM_FORMAT_INVALID) {
|
||||
gst_caps_features_free (filter_features);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
in_info_drm->drm_modifier = DRM_FORMAT_MOD_LINEAR;
|
||||
} else if (!gst_caps_features_contains (gst_caps_get_features (in_caps, 0),
|
||||
GST_CAPS_FEATURE_MEMORY_DMABUF)) {
|
||||
|
@ -1538,8 +1533,8 @@ _dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
|
|||
dmabuf->eglimage[i] = gst_egl_image_from_dmabuf_direct_target_with_dma_drm
|
||||
(dmabuf->upload->context, fd, offset, in_info_drm, dmabuf->target);
|
||||
} else {
|
||||
dmabuf->eglimage[i] = gst_egl_image_from_dmabuf_with_dma_drm
|
||||
(dmabuf->upload->context, fd[i], in_info_drm, i, offset[i]);
|
||||
dmabuf->eglimage[i] = gst_egl_image_from_dmabuf
|
||||
(dmabuf->upload->context, fd[i], in_info, i, offset[i]);
|
||||
}
|
||||
|
||||
if (!dmabuf->eglimage[i]) {
|
||||
|
|
Loading…
Reference in a new issue