eglimage: add Y410 DMABuf import support

This fixed the error below:

GST_GL_PLATFORM=egl gst-launch-1.0 videotestsrc ! msdkvpp ! \
"video/x-raw(memory:DMABuf),format=Y410" ! glimagesink

0:00:00.040553883 576732 0x55be9b35f920 ERROR             gleglimage
gsteglimage.c:577:_drm_rgba_fourcc_from_info: Unsupported format for
DMABuf.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1389>
This commit is contained in:
Haihao Xiang 2021-07-02 16:01:19 +08:00
parent 2d1496bc70
commit fbbf44c48c

View file

@ -91,6 +91,14 @@
#define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2') #define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2')
#endif #endif
#ifndef DRM_FORMAT_ABGR2101010
#define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0')
#endif
#ifndef DRM_FORMAT_RGBA1010102
#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0')
#endif
#ifndef EGL_LINUX_DMA_BUF_EXT #ifndef EGL_LINUX_DMA_BUF_EXT
#define EGL_LINUX_DMA_BUF_EXT 0x3270 #define EGL_LINUX_DMA_BUF_EXT 0x3270
#endif #endif
@ -465,11 +473,13 @@ _drm_rgba_fourcc_from_info (const GstVideoInfo * info, int plane,
const gint rgb_fourcc = DRM_FORMAT_BGR888; const gint rgb_fourcc = DRM_FORMAT_BGR888;
const gint rg_fourcc = DRM_FORMAT_GR88; const gint rg_fourcc = DRM_FORMAT_GR88;
const gint rg16_fourcc = DRM_FORMAT_GR1616; const gint rg16_fourcc = DRM_FORMAT_GR1616;
const gint rgb10a2_fourcc = DRM_FORMAT_ABGR2101010;
#else #else
const gint rgba_fourcc = DRM_FORMAT_RGBA8888; const gint rgba_fourcc = DRM_FORMAT_RGBA8888;
const gint rgb_fourcc = DRM_FORMAT_RGB888; const gint rgb_fourcc = DRM_FORMAT_RGB888;
const gint rg_fourcc = DRM_FORMAT_RG88; const gint rg_fourcc = DRM_FORMAT_RG88;
const gint rg16_fourcc = DRM_FORMAT_RG1616; const gint rg16_fourcc = DRM_FORMAT_RG1616;
const gint rgb10a2_fourcc = DRM_FORMAT_RGBA1010102;
#endif #endif
GST_DEBUG ("Getting DRM fourcc for %s plane %i", GST_DEBUG ("Getting DRM fourcc for %s plane %i",
@ -563,6 +573,10 @@ _drm_rgba_fourcc_from_info (const GstVideoInfo * info, int plane,
*out_format = GST_GL_RG16; *out_format = GST_GL_RG16;
return DRM_FORMAT_RG1616; return DRM_FORMAT_RG1616;
case GST_VIDEO_FORMAT_Y410:
*out_format = GST_GL_RGB10_A2;
return rgb10a2_fourcc;
default: default:
GST_ERROR ("Unsupported format for DMABuf."); GST_ERROR ("Unsupported format for DMABuf.");
return -1; return -1;