mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 15:48:23 +00:00
glimagesink: add support for P010 variants
This makes a pipeline below works: little endian: gst-launch-1.0 videotestsrc ! video/x-raw,format=P010_10LE ! glimagesink big endian: gst-launch-1.0 videotestsrc ! video/x-raw,format=P010_10BE ! glimagesink
This commit is contained in:
parent
49f16489ab
commit
6d0f796591
6 changed files with 75 additions and 4 deletions
|
@ -78,6 +78,18 @@
|
||||||
#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0')
|
#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0')
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DRM_FORMAT_R16
|
||||||
|
#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ')
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DRM_FORMAT_GR1616
|
||||||
|
#define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2')
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DRM_FORMAT_RG1616
|
||||||
|
#define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2')
|
||||||
|
#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
|
||||||
|
@ -517,6 +529,14 @@ _drm_rgba_fourcc_from_info (GstVideoInfo * info, int plane,
|
||||||
*out_format = GST_GL_RGB10_A2;
|
*out_format = GST_GL_RGB10_A2;
|
||||||
return DRM_FORMAT_RGBA1010102;
|
return DRM_FORMAT_RGBA1010102;
|
||||||
|
|
||||||
|
case GST_VIDEO_FORMAT_P010_10LE:
|
||||||
|
*out_format = plane == 0 ? GST_GL_R16 : GST_GL_RG16;
|
||||||
|
return plane == 0 ? DRM_FORMAT_R16 : DRM_FORMAT_GR1616;
|
||||||
|
|
||||||
|
case GST_VIDEO_FORMAT_P010_10BE:
|
||||||
|
*out_format = plane == 0 ? GST_GL_R16 : GST_GL_RG16;
|
||||||
|
return plane == 0 ? DRM_FORMAT_R16 : DRM_FORMAT_RG1616;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
GST_ERROR ("Unsupported format for DMABuf.");
|
GST_ERROR ("Unsupported format for DMABuf.");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -956,6 +956,14 @@ _init_supported_formats (GstGLContext * context, gboolean output,
|
||||||
_append_value_string_list (supported_formats, "BGR10A2_LE", "RGB10A2_LE",
|
_append_value_string_list (supported_formats, "BGR10A2_LE", "RGB10A2_LE",
|
||||||
NULL);
|
NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!context || (gst_gl_format_is_supported (context, GST_GL_R16) &&
|
||||||
|
gst_gl_format_is_supported (context, GST_GL_RG16)))
|
||||||
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
|
_append_value_string_list (supported_formats, "P010_10LE", NULL);
|
||||||
|
#else
|
||||||
|
_append_value_string_list (supported_formats, "P010_10BE", NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copies the given caps */
|
/* copies the given caps */
|
||||||
|
@ -1547,6 +1555,8 @@ _get_n_textures (GstVideoFormat v_format)
|
||||||
return 1;
|
return 1;
|
||||||
case GST_VIDEO_FORMAT_NV12:
|
case GST_VIDEO_FORMAT_NV12:
|
||||||
case GST_VIDEO_FORMAT_NV21:
|
case GST_VIDEO_FORMAT_NV21:
|
||||||
|
case GST_VIDEO_FORMAT_P010_10LE:
|
||||||
|
case GST_VIDEO_FORMAT_P010_10BE:
|
||||||
return 2;
|
return 2;
|
||||||
case GST_VIDEO_FORMAT_I420:
|
case GST_VIDEO_FORMAT_I420:
|
||||||
case GST_VIDEO_FORMAT_Y444:
|
case GST_VIDEO_FORMAT_Y444:
|
||||||
|
@ -1705,6 +1715,17 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
||||||
info->shader_tex_names[1] = "UVtex";
|
info->shader_tex_names[1] = "UVtex";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GST_VIDEO_FORMAT_P010_10LE:
|
||||||
|
case GST_VIDEO_FORMAT_P010_10BE:
|
||||||
|
{
|
||||||
|
info->templ = &templ_SEMI_PLANAR_to_RGB;
|
||||||
|
info->frag_body =
|
||||||
|
g_strdup_printf (templ_SEMI_PLANAR_to_RGB_BODY, 'r', 'g',
|
||||||
|
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||||
|
info->shader_tex_names[0] = "Ytex";
|
||||||
|
info->shader_tex_names[1] = "UVtex";
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,9 +88,9 @@ struct _GstGLColorConvertClass
|
||||||
* The currently supported formats that can be converted
|
* The currently supported formats that can be converted
|
||||||
*/
|
*/
|
||||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
#define COLOR_CONVERT_EXT_FORMATS ", BGR10A2_LE, RGB10A2_LE"
|
#define COLOR_CONVERT_EXT_FORMATS ", BGR10A2_LE, RGB10A2_LE, P010_10LE"
|
||||||
#else
|
#else
|
||||||
#define COLOR_CONVERT_EXT_FORMATS ""
|
#define COLOR_CONVERT_EXT_FORMATS ", P010_10BE"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GST_GL_COLOR_CONVERT_FORMATS "{ RGBA, RGB, RGBx, BGR, BGRx, BGRA, xRGB, " \
|
#define GST_GL_COLOR_CONVERT_FORMATS "{ RGBA, RGB, RGBx, BGR, BGRx, BGRA, xRGB, " \
|
||||||
|
|
|
@ -75,6 +75,7 @@ _gl_format_n_components (guint format)
|
||||||
case GST_GL_LUMINANCE_ALPHA:
|
case GST_GL_LUMINANCE_ALPHA:
|
||||||
case GST_GL_RG:
|
case GST_GL_RG:
|
||||||
case GST_GL_RG8:
|
case GST_GL_RG8:
|
||||||
|
case GST_GL_RG16:
|
||||||
return 2;
|
return 2;
|
||||||
case GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE:
|
case GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE:
|
||||||
case GST_VIDEO_GL_TEXTURE_TYPE_R:
|
case GST_VIDEO_GL_TEXTURE_TYPE_R:
|
||||||
|
@ -82,6 +83,7 @@ _gl_format_n_components (guint format)
|
||||||
case GST_GL_ALPHA:
|
case GST_GL_ALPHA:
|
||||||
case GST_GL_RED:
|
case GST_GL_RED:
|
||||||
case GST_GL_R8:
|
case GST_GL_R8:
|
||||||
|
case GST_GL_R16:
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -201,6 +203,9 @@ gst_gl_format_from_video_info (GstGLContext * context, GstVideoInfo * vinfo,
|
||||||
case GST_VIDEO_FORMAT_BGR10A2_LE:
|
case GST_VIDEO_FORMAT_BGR10A2_LE:
|
||||||
case GST_VIDEO_FORMAT_RGB10A2_LE:
|
case GST_VIDEO_FORMAT_RGB10A2_LE:
|
||||||
return GST_GL_RGB10_A2;
|
return GST_GL_RGB10_A2;
|
||||||
|
case GST_VIDEO_FORMAT_P010_10LE:
|
||||||
|
case GST_VIDEO_FORMAT_P010_10BE:
|
||||||
|
return plane == 0 ? GST_GL_R16 : GST_GL_RG16;
|
||||||
default:
|
default:
|
||||||
n_plane_components = 4;
|
n_plane_components = 4;
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
@ -269,6 +274,8 @@ gst_gl_sized_gl_format_from_gl_format_type (GstGLContext * context,
|
||||||
if (!USING_GLES3 (context) && USING_GLES2 (context) && ext_texture_rg)
|
if (!USING_GLES3 (context) && USING_GLES2 (context) && ext_texture_rg)
|
||||||
return GST_GL_RG;
|
return GST_GL_RG;
|
||||||
return GST_GL_RG8;
|
return GST_GL_RG8;
|
||||||
|
case GL_UNSIGNED_SHORT:
|
||||||
|
return GST_GL_RG16;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_GL_RED:
|
case GST_GL_RED:
|
||||||
|
@ -277,6 +284,8 @@ gst_gl_sized_gl_format_from_gl_format_type (GstGLContext * context,
|
||||||
if (!USING_GLES3 (context) && USING_GLES2 (context) && ext_texture_rg)
|
if (!USING_GLES3 (context) && USING_GLES2 (context) && ext_texture_rg)
|
||||||
return GST_GL_RED;
|
return GST_GL_RED;
|
||||||
return GST_GL_R8;
|
return GST_GL_R8;
|
||||||
|
case GL_UNSIGNED_SHORT:
|
||||||
|
return GST_GL_R16;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_GL_RGBA8:
|
case GST_GL_RGBA8:
|
||||||
|
@ -292,6 +301,8 @@ gst_gl_sized_gl_format_from_gl_format_type (GstGLContext * context,
|
||||||
case GST_GL_DEPTH_COMPONENT16:
|
case GST_GL_DEPTH_COMPONENT16:
|
||||||
case GST_GL_DEPTH24_STENCIL8:
|
case GST_GL_DEPTH24_STENCIL8:
|
||||||
case GST_GL_RGB10_A2:
|
case GST_GL_RGB10_A2:
|
||||||
|
case GST_GL_R16:
|
||||||
|
case GST_GL_RG16:
|
||||||
return format;
|
return format;
|
||||||
default:
|
default:
|
||||||
g_critical ("Unknown GL format 0x%x type 0x%x provided", format, type);
|
g_critical ("Unknown GL format 0x%x type 0x%x provided", format, type);
|
||||||
|
@ -363,6 +374,14 @@ gst_gl_format_type_from_sized_gl_format (GstGLFormat format,
|
||||||
*unsized_format = GST_GL_RGBA;
|
*unsized_format = GST_GL_RGBA;
|
||||||
*gl_type = GL_UNSIGNED_INT_2_10_10_10_REV;
|
*gl_type = GL_UNSIGNED_INT_2_10_10_10_REV;
|
||||||
break;
|
break;
|
||||||
|
case GST_GL_R16:
|
||||||
|
*unsized_format = GST_GL_RED;
|
||||||
|
*gl_type = GL_UNSIGNED_SHORT;
|
||||||
|
break;
|
||||||
|
case GST_GL_RG16:
|
||||||
|
*unsized_format = GST_GL_RG;
|
||||||
|
*gl_type = GL_UNSIGNED_SHORT;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
g_critical ("Unknown GL format 0x%x provided", format);
|
g_critical ("Unknown GL format 0x%x provided", format);
|
||||||
*unsized_format = format;
|
*unsized_format = format;
|
||||||
|
@ -435,6 +454,12 @@ gst_gl_format_is_supported (GstGLContext * context, GstGLFormat format)
|
||||||
|| USING_GLES3 (context)
|
|| USING_GLES3 (context)
|
||||||
|| gst_gl_context_check_feature (context,
|
|| gst_gl_context_check_feature (context,
|
||||||
"GL_OES_required_internalformat");
|
"GL_OES_required_internalformat");
|
||||||
|
case GST_GL_R16:
|
||||||
|
case GST_GL_RG16:
|
||||||
|
return gst_gl_context_check_gl_version (context,
|
||||||
|
GST_GL_API_OPENGL | GST_GL_API_OPENGL3, 3, 0)
|
||||||
|
|| (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 1)
|
||||||
|
&& gst_gl_context_check_feature (context, "GL_EXT_texture_norm16"));
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -98,6 +98,8 @@ G_BEGIN_DECLS
|
||||||
* a 8-bit component for stencil informat.
|
* a 8-bit component for stencil informat.
|
||||||
* @GST_GL_RGBA10_A2: Four components of bit depth 10, 10, 10 and 2 stored in the
|
* @GST_GL_RGBA10_A2: Four components of bit depth 10, 10, 10 and 2 stored in the
|
||||||
* R, G, B and A texture components respectively.
|
* R, G, B and A texture components respectively.
|
||||||
|
* @GST_GL_R16: Single 16-bit component stored in the R texture component
|
||||||
|
* @GST_GL_RG16: Two 16-bit components stored in the R and G texture components
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -128,6 +130,9 @@ typedef enum
|
||||||
GST_GL_DEPTH24_STENCIL8 = 0x88F0,
|
GST_GL_DEPTH24_STENCIL8 = 0x88F0,
|
||||||
|
|
||||||
GST_GL_RGB10_A2 = 0x8059,
|
GST_GL_RGB10_A2 = 0x8059,
|
||||||
|
|
||||||
|
GST_GL_R16 = 0x822A,
|
||||||
|
GST_GL_RG16 = 0x822C,
|
||||||
} GstGLFormat;
|
} GstGLFormat;
|
||||||
|
|
||||||
GST_GL_API
|
GST_GL_API
|
||||||
|
|
|
@ -51,9 +51,9 @@ GType gst_gl_memory_allocator_get_type(void);
|
||||||
* List of video formats that are supported by #GstGLMemory
|
* List of video formats that are supported by #GstGLMemory
|
||||||
*/
|
*/
|
||||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
#define MEMORY_VIDEO_EXT_FORMATS ", BGR10A2_LE, RGB10A2_LE"
|
#define MEMORY_VIDEO_EXT_FORMATS ", BGR10A2_LE, RGB10A2_LE, P010_10LE"
|
||||||
#else
|
#else
|
||||||
#define MEMORY_VIDEO_EXT_FORMATS ""
|
#define MEMORY_VIDEO_EXT_FORMATS ", P010_10BE"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GST_GL_MEMORY_VIDEO_FORMATS_STR \
|
#define GST_GL_MEMORY_VIDEO_FORMATS_STR \
|
||||||
|
|
Loading…
Reference in a new issue