Commit 3ce4e483 authored by Tapani Pälli's avatar Tapani Pälli

EGL_EXT_image_dma_buf_import: add P12, P16 format support

v2: fix indentation and add /* Y */ comment to P16
Signed-off-by: Tapani Pälli's avatarTapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin's avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
parent 11a2588a
......@@ -3037,6 +3037,10 @@ with profile.test_list.group_manager(
'ext_image_dma_buf_import-sample_ayuv', run_concurrent=False)
g(['ext_image_dma_buf_import-sample_yuv', '-fmt=P010'],
'ext_image_dma_buf_import-sample_p010', run_concurrent=False)
g(['ext_image_dma_buf_import-sample_yuv', '-fmt=P012'],
'ext_image_dma_buf_import-sample_p012', run_concurrent=False)
g(['ext_image_dma_buf_import-sample_yuv', '-fmt=P016'],
'ext_image_dma_buf_import-sample_p016', run_concurrent=False)
g(['ext_image_dma_buf_import-transcode-nv12-as-r8-gr88'],
'ext_image_dma_buf_import-transcode-nv12-as-r8-gr88',
run_concurrent=False)
......
......@@ -154,6 +154,8 @@ egl_image_for_dma_buf_fd(struct piglit_dma_buf *buf, int fd, int fourcc, EGLImag
switch (fourcc) {
case DRM_FORMAT_NV12:
case DRM_FORMAT_P010:
case DRM_FORMAT_P012:
case DRM_FORMAT_P016:
attr = attr_nv12;
break;
case DRM_FORMAT_YUV420:
......
......@@ -56,6 +56,28 @@ piglit_display(void)
481, 642, 562, 642,
};
static const uint16_t p012[] = {
/* Y */
803, 1124, 1445, 1766,
803, 1124, 1445, 1766,
803, 1124, 1445, 1766,
803, 1124, 1445, 1766,
/* UV */
1927, 2088, 2248, 2088,
1927, 2569, 2248, 2569,
};
static const uint16_t p016[] = {
/* Y */
12850, 17990, 23130, 28270,
12850, 17990, 23130, 28270,
12850, 17990, 23130, 28270,
12850, 17990, 23130, 28270,
/* UV */
30840, 33410, 35980, 33410,
30840, 41120, 35980, 41120,
};
static const unsigned char nv12[] = {
/* Y */
50, 70, 90, 110,
......@@ -141,6 +163,12 @@ piglit_display(void)
case DRM_FORMAT_P010:
t = (unsigned char *) p010;
break;
case DRM_FORMAT_P012:
t = (unsigned char *) p012;
break;
case DRM_FORMAT_P016:
t = (unsigned char *) p016;
break;
case DRM_FORMAT_NV12:
t = nv12;
break;
......
......@@ -164,6 +164,8 @@ piglit_intel_buf_create(unsigned w, unsigned h, unsigned fourcc,
buf_h = h * 3 / 2;
break;
case DRM_FORMAT_P010:
case DRM_FORMAT_P012:
case DRM_FORMAT_P016:
cpp = 2;
buf_h = h * 3 / 2;
break;
......@@ -197,6 +199,8 @@ piglit_intel_buf_create(unsigned w, unsigned h, unsigned fourcc,
switch (fourcc) {
case DRM_FORMAT_NV12:
case DRM_FORMAT_P010:
case DRM_FORMAT_P012:
case DRM_FORMAT_P016:
buf->offset[1] = stride * h;
buf->stride[1] = stride;
break;
......
......@@ -44,6 +44,14 @@
#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cb:Cr plane 10 bits per channel */
#endif
#ifndef DRM_FORMAT_P012
#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cb:Cr plane 12 bits per channel */
#endif
#ifndef DRM_FORMAT_P016
#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cb:Cr plane 16 bits per channel */
#endif
/* added in libdrm 2.4.95 */
#ifndef DRM_FORMAT_INVALID
#define DRM_FORMAT_INVALID 0
......
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