#endif
#endif
+#ifndef DRM_FORMAT_BGRA1010102
+#define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0')
+#endif
+
+#ifndef DRM_FORMAT_RGBA1010102
+#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0')
+#endif
+
#ifndef EGL_LINUX_DMA_BUF_EXT
#define EGL_LINUX_DMA_BUF_EXT 0x3270
#endif
*out_format = GST_GL_RED;
return DRM_FORMAT_R8;
+ case GST_VIDEO_FORMAT_BGR10A2_LE:
+ *out_format = GST_GL_RGB10_A2;
+ return DRM_FORMAT_BGRA1010102;
+
+ case GST_VIDEO_FORMAT_RGB10A2_LE:
+ *out_format = GST_GL_RGB10_A2;
+ return DRM_FORMAT_RGBA1010102;
+
default:
GST_ERROR ("Unsupported format for DMABuf.");
return -1;
if (!context || gst_gl_format_is_supported (context, GST_GL_RGB565))
_append_value_string_list (supported_formats, "RGB16", "BGR16", NULL);
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ if (!context || gst_gl_format_is_supported (context, GST_GL_RGB10_A2))
+ _append_value_string_list (supported_formats, "BGR10A2_LE", "RGB10A2_LE",
+ NULL);
+#endif
}
/* copies the given caps */
*/
_init_value_string_list (&rgb_formats, "RGBA", "ARGB", "BGRA", "ABGR", "RGBx",
- "xRGB", "BGRx", "xBGR", "RGB", "BGR", "ARGB64", NULL);
+ "xRGB", "BGRx", "xBGR", "RGB", "BGR", "ARGB64", "BGR10A2_LE",
+ "RGB10A2_LE", NULL);
_init_supported_formats (context, output, &supported_formats);
gst_value_intersect (&supported_rgb_formats, &rgb_formats,
&supported_formats);
gchar *temp = expect;
expect = g_strndup (temp, 3);
g_free (temp);
+ } else if (strcmp (expect, "bgr10a2_le") == 0) {
+ gchar *temp = expect;
+ expect = g_strndup ("bgra", 4);
+ g_free (temp);
+ } else if (strcmp (expect, "rgb10a2_le") == 0) {
+ gchar *temp = expect;
+ expect = g_strndup ("rgba", 4);
+ g_free (temp);
}
if (strcmp (want, "rgb16") == 0 || strcmp (want, "bgr16") == 0) {
gchar *temp = want;
orig_want = want = g_strndup (temp, 3);
g_free (temp);
+ } else if (strcmp (want, "bgr10a2_le") == 0) {
+ gchar *temp = want;
+ orig_want = want = g_strndup ("bgra", 4);
+ g_free (temp);
+ } else if (strcmp (want, "rgb10a2_le") == 0) {
+ gchar *temp = want;
+ orig_want = want = g_strndup ("rgba", 4);
+ g_free (temp);
}
/* pad want with 'a's */
case GST_VIDEO_FORMAT_RGB16:
case GST_VIDEO_FORMAT_BGR16:
case GST_VIDEO_FORMAT_ARGB64:
+ case GST_VIDEO_FORMAT_BGR10A2_LE:
+ case GST_VIDEO_FORMAT_RGB10A2_LE:
return 1;
case GST_VIDEO_FORMAT_NV12:
case GST_VIDEO_FORMAT_NV21:
*
* The currently supported formats that can be converted
*/
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define COLOR_CONVERT_EXT_FORMATS ", BGR10A2_LE, RGB10A2_LE"
+#else
+#define COLOR_CONVERT_EXT_FORMATS ""
+#endif
+
#define GST_GL_COLOR_CONVERT_FORMATS "{ RGBA, RGB, RGBx, BGR, BGRx, BGRA, xRGB, " \
"xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, " \
"Y41B, NV12, NV21, YUY2, UYVY, AYUV, VUYA, " \
- "GRAY8, GRAY16_LE, GRAY16_BE, RGB16, BGR16, ARGB64 }"
+ "GRAY8, GRAY16_LE, GRAY16_BE, RGB16, BGR16, ARGB64 " \
+ COLOR_CONVERT_EXT_FORMATS "}"
/**
* GST_GL_COLOR_CONVERT_VIDEO_CAPS:
#ifndef GL_TEXTURE_EXTERNAL_OES
#define GL_TEXTURE_EXTERNAL_OES 0x8D65
#endif
+#ifndef GL_UNSIGNED_INT_2_10_10_10_REV
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#endif
static inline guint
_gl_format_n_components (guint format)
case GST_GL_RGBA:
case GST_GL_RGBA8:
case GST_GL_RGBA16:
+ case GST_GL_RGB10_A2:
return 4;
case GST_VIDEO_GL_TEXTURE_TYPE_RGB:
case GST_VIDEO_GL_TEXTURE_TYPE_RGB16:
return 1;
case GL_UNSIGNED_SHORT_5_6_5:
return 3;
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return 4;
default:
g_assert_not_reached ();
return 0;
case GL_UNSIGNED_SHORT:
case GL_UNSIGNED_SHORT_5_6_5:
return 2;
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return 4;
default:
g_assert_not_reached ();
return 0;
case GST_VIDEO_FORMAT_YV12:
n_plane_components = 1;
break;
+ case GST_VIDEO_FORMAT_BGR10A2_LE:
+ case GST_VIDEO_FORMAT_RGB10A2_LE:
+ return GST_GL_RGB10_A2;
default:
n_plane_components = 4;
g_assert_not_reached ();
&& !USING_GLES3 (context) ? GST_GL_RGBA : GST_GL_RGBA8;
case GL_UNSIGNED_SHORT:
return GST_GL_RGBA16;
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return GST_GL_RGB10_A2;
}
break;
case GST_GL_RGB:
case GST_GL_ALPHA:
case GST_GL_DEPTH_COMPONENT16:
case GST_GL_DEPTH24_STENCIL8:
+ case GST_GL_RGB10_A2:
return format;
default:
g_critical ("Unknown GL format 0x%x type 0x%x provided", format, type);
*unsized_format = format;
*gl_type = GL_UNSIGNED_BYTE;
break;
+ case GST_GL_RGB10_A2:
+ *unsized_format = GST_GL_RGBA;
+ *gl_type = GL_UNSIGNED_INT_2_10_10_10_REV;
+ break;
default:
g_critical ("Unknown GL format 0x%x provided", format);
*unsized_format = format;
"GL_OES_packed_depth_stencil")
|| gst_gl_context_check_feature (context,
"GL_EXT_packed_depth_stencil");
+ case GST_GL_RGB10_A2:
+ return USING_OPENGL (context) || USING_OPENGL3 (context)
+ || USING_GLES3 (context)
+ || gst_gl_context_check_feature (context,
+ "GL_OES_required_internalformat");
default:
g_assert_not_reached ();
return FALSE;
* @GST_GL_DEPTH_COMPONENT16: A single 16-bit component for depth information.
* @GST_GL_DEPTH24_STENCIL8: A 24-bit component for depth information and
* a 8-bit component for stencil informat.
+ * @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.
*/
typedef enum
{
GST_GL_DEPTH_COMPONENT16 = 0x81A5,
GST_GL_DEPTH24_STENCIL8 = 0x88F0,
+
+ GST_GL_RGB10_A2 = 0x8059,
} GstGLFormat;
GST_GL_API
*
* List of video formats that are supported by #GstGLMemory
*/
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define MEMORY_VIDEO_EXT_FORMATS ", BGR10A2_LE, RGB10A2_LE"
+#else
+#define MEMORY_VIDEO_EXT_FORMATS ""
+#endif
+
#define GST_GL_MEMORY_VIDEO_FORMATS_STR \
"{ RGBA, BGRA, RGBx, BGRx, ARGB, ABGR, xRGB, xBGR, RGB, BGR, RGB16, BGR16, " \
"AYUV, VUYA, I420, YV12, NV12, NV21, YUY2, UYVY, Y41B, Y42B, Y444, " \
- "GRAY8, GRAY16_LE, GRAY16_BE, ARGB64 }"
+ "GRAY8, GRAY16_LE, GRAY16_BE, ARGB64" MEMORY_VIDEO_EXT_FORMATS "}"
/**
* GstGLMemory: