[Piglit] [PATCH v2] EGL_EXT_image_dma_buf_import: add P10 format support
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Mon Feb 11 10:31:16 UTC 2019
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
On 11/02/2019 09:44, Tapani Pälli wrote:
> v2: use correct range for P10
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> Signed-off-by: Harish Krupo <harish.krupo.kps at intel.com>
> ---
> tests/opengl.py | 2 ++
> .../spec/ext_image_dma_buf_import/sample_common.c | 1 +
> .../spec/ext_image_dma_buf_import/sample_common.h | 1 +
> tests/spec/ext_image_dma_buf_import/sample_yuv.c | 14 ++++++++++++++
> .../util/piglit-framework-gl/piglit_drm_dma_buf.c | 5 +++++
> .../util/piglit-framework-gl/piglit_drm_dma_buf.h | 4 ++++
> 6 files changed, 27 insertions(+)
>
> diff --git a/tests/opengl.py b/tests/opengl.py
> index 97dfbf984..8676e231c 100644
> --- a/tests/opengl.py
> +++ b/tests/opengl.py
> @@ -3030,6 +3030,8 @@ with profile.test_list.group_manager(
> 'ext_image_dma_buf_import-sample_yvu420', run_concurrent=False)
> g(['ext_image_dma_buf_import-sample_yuv', '-fmt=AYUV'],
> '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-transcode-nv12-as-r8-gr88'],
> 'ext_image_dma_buf_import-transcode-nv12-as-r8-gr88',
> run_concurrent=False)
> diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.c b/tests/spec/ext_image_dma_buf_import/sample_common.c
> index 2f586c774..426f4cc52 100644
> --- a/tests/spec/ext_image_dma_buf_import/sample_common.c
> +++ b/tests/spec/ext_image_dma_buf_import/sample_common.c
> @@ -153,6 +153,7 @@ egl_image_for_dma_buf_fd(struct piglit_dma_buf *buf, int fd, int fourcc, EGLImag
> EGLint *attr;
> switch (fourcc) {
> case DRM_FORMAT_NV12:
> + case DRM_FORMAT_P010:
> attr = attr_nv12;
> break;
> case DRM_FORMAT_YUV420:
> diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.h b/tests/spec/ext_image_dma_buf_import/sample_common.h
> index 36a5bb584..155301250 100644
> --- a/tests/spec/ext_image_dma_buf_import/sample_common.h
> +++ b/tests/spec/ext_image_dma_buf_import/sample_common.h
> @@ -25,6 +25,7 @@
>
> #include "piglit-util-egl.h"
> #include "piglit-util-gl.h"
> +#include "piglit-framework-gl/piglit_drm_dma_buf.h"
>
> /**
> * Create a dma buffer with format 'fourcc' setting the given pixels as its
> diff --git a/tests/spec/ext_image_dma_buf_import/sample_yuv.c b/tests/spec/ext_image_dma_buf_import/sample_yuv.c
> index ed9f87e0f..78a0f25f3 100644
> --- a/tests/spec/ext_image_dma_buf_import/sample_yuv.c
> +++ b/tests/spec/ext_image_dma_buf_import/sample_yuv.c
> @@ -45,6 +45,17 @@ static int fourcc = -1;
> enum piglit_result
> piglit_display(void)
> {
> + static const uint16_t p010[] = {
> + /* Y */
> + 201, 281, 361, 441,
> + 201, 281, 361, 441,
> + 201, 281, 361, 441,
> + 201, 281, 361, 441,
> + /* UV */
> + 481, 522, 562, 522,
> + 481, 642, 562, 642,
> + };
> +
> static const unsigned char nv12[] = {
> /* Y */
> 50, 70, 90, 110,
> @@ -127,6 +138,9 @@ piglit_display(void)
>
> enum piglit_result res;
> switch (fourcc) {
> + case DRM_FORMAT_P010:
> + t = (unsigned char *) p010;
> + break;
> case DRM_FORMAT_NV12:
> t = nv12;
> break;
> diff --git a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
> index 13bf883f2..7f7420b23 100644
> --- a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
> +++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
> @@ -163,6 +163,10 @@ piglit_intel_buf_create(unsigned w, unsigned h, unsigned fourcc,
> cpp = 1;
> buf_h = h * 3 / 2;
> break;
> + case DRM_FORMAT_P010:
> + cpp = 2;
> + buf_h = h * 3 / 2;
> + break;
> default:
> fprintf(stderr, "invalid fourcc: %.4s\n", (char *)&fourcc);
> return false;
> @@ -192,6 +196,7 @@ piglit_intel_buf_create(unsigned w, unsigned h, unsigned fourcc,
>
> switch (fourcc) {
> case DRM_FORMAT_NV12:
> + case DRM_FORMAT_P010:
> buf->offset[1] = stride * h;
> buf->stride[1] = stride;
> break;
> diff --git a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.h b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.h
> index b8a4e485d..b57ffa484 100644
> --- a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.h
> +++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.h
> @@ -40,6 +40,10 @@
> #define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8')
> #endif
>
> +#ifndef DRM_FORMAT_P010
> +#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cb:Cr plane 10 bits per channel */
> +#endif
> +
> /* added in libdrm 2.4.95 */
> #ifndef DRM_FORMAT_INVALID
> #define DRM_FORMAT_INVALID 0
More information about the Piglit
mailing list