EGL_EXT_image_dma_buf_import: add AYUV format support

Submitted by Lionel Landwerlin on Nov. 8, 2018, 6:16 p.m.

Details

Message ID 20181108181619.461-1-lionel.g.landwerlin@intel.com
State New
Headers show
Series "EGL_EXT_image_dma_buf_import: add AYUV format support" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Lionel Landwerlin Nov. 8, 2018, 6:16 p.m.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 .../ext_image_dma_buf_import/sample_yuv.c     | 33 ++++++++++++++++++-
 .../piglit-framework-gl/piglit_drm_dma_buf.c  |  1 +
 2 files changed, 33 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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 a314bc56f..b909221ee 100644
--- a/tests/spec/ext_image_dma_buf_import/sample_yuv.c
+++ b/tests/spec/ext_image_dma_buf_import/sample_yuv.c
@@ -77,9 +77,30 @@  piglit_display(void)
 		/* U */
 		120, 140,
 		120, 140,
+	}, ayuv[] = {
+		/* AYUV (TODO: find a way to test alpha channel) */
+		130, 120,  50, 255,
+		130, 127,  70, 255,
+		130, 133,  90, 255,
+		130, 140, 110, 255,
+
+		140, 120,  50, 255,
+		140, 127,  70, 255,
+		140, 133,  90, 255,
+		140, 140, 110, 255,
+
+		150, 120,  50, 255,
+		150, 127,  70, 255,
+		150, 133,  90, 255,
+		150, 140, 110, 255,
+
+		160, 120,  50, 255,
+		160, 127,  70, 255,
+		160, 133,  90, 255,
+		160, 140, 110, 255,
 	};
 
-	static const unsigned char expected[4 * 4 * 4] = {
+	unsigned char expected[4 * 4 * 4] = {
 		 44,  41,  25, 255,
 		 67,  64,  48, 255,
 		 90,  79, 111, 255,
@@ -114,6 +135,16 @@  piglit_display(void)
 	case DRM_FORMAT_YVU420:
 		t = yvu420;
 		break;
+	case DRM_FORMAT_AYUV:
+		t = ayuv;
+		/* Override the alpha channel. */
+		for (int y = 0; y < 4; y++) {
+			for (int x = 0; x < 4; x++) {
+				expected[y * 4 * 4 + x * 4 + 3] =
+					ayuv[y * 4 * 4 + x * 4 + 3];
+			}
+		}
+		break;
 	default:
 		return PIGLIT_SKIP;
 	}
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 869d9db7d..13bf883f2 100644
--- a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
+++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
@@ -154,6 +154,7 @@  piglit_intel_buf_create(unsigned w, unsigned h, unsigned fourcc,
 	case DRM_FORMAT_ABGR8888:
 	case DRM_FORMAT_RGBA8888:
 	case DRM_FORMAT_BGRA8888:
+	case DRM_FORMAT_AYUV:
 		cpp = 4;
 		break;
 	case DRM_FORMAT_NV12: