@@ -54,6 +54,53 @@ PIGLIT_GL_TEST_CONFIG_END
#define DRM_FORMAT_INVALID fourcc_code('F', 'O', 'O', '0')
static bool
+test_half_modifier(unsigned w, unsigned h, int fd, unsigned stride,
+ unsigned offset) {
+ const EGLint attr_lo[15] = {
+ EGL_HEIGHT, h,
+ EGL_WIDTH, w,
+ EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_ARGB8888,
+ EGL_DMA_BUF_PLANE0_FD_EXT, fd,
+ EGL_DMA_BUF_PLANE0_OFFSET_EXT, offset,
+ EGL_DMA_BUF_PLANE0_PITCH_EXT, stride,
+ EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, 1,
+ EGL_NONE };
+
+ const EGLint attr_hi[15] = {
+ EGL_HEIGHT, h,
+ EGL_WIDTH, w,
+ EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_ARGB8888,
+ EGL_DMA_BUF_PLANE0_FD_EXT, fd,
+ EGL_DMA_BUF_PLANE0_OFFSET_EXT, offset,
+ EGL_DMA_BUF_PLANE0_PITCH_EXT, stride,
+ EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, 1,
+ EGL_NONE };
+
+ EGLImageKHR img = eglCreateImageKHR(eglGetCurrentDisplay(),
+ EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT,
+ (EGLClientBuffer)NULL, attr_lo);
+
+ if (!piglit_check_egl_error(EGL_BAD_PARAMETER)) {
+ if (img)
+ eglDestroyImageKHR(eglGetCurrentDisplay(), img);
+ return false;
+ }
+ eglDestroyImageKHR(eglGetCurrentDisplay(), img);
+
+ img = eglCreateImageKHR(eglGetCurrentDisplay(),
+ EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT,
+ (EGLClientBuffer)NULL, attr_hi);
+
+ if (!piglit_check_egl_error(EGL_BAD_PARAMETER)) {
+ if (img)
+ eglDestroyImageKHR(eglGetCurrentDisplay(), img);
+ return false;
+ }
+
+ return true;
+}
+
+static bool
test_excess_attributes(unsigned w, unsigned h, int fd, unsigned stride,
unsigned offset, EGLint attr_id, EGLint attr_val)
{
@@ -238,6 +285,14 @@ piglit_display(void)
pass = test_invalid_format(w, h, buf->fd, buf->stride[0], buf->offset[0]) && pass;
pass = test_pitch_zero(w, h, buf->fd, buf->stride[0], buf->offset[0]) && pass;
+ if (piglit_is_egl_extension_supported(eglGetCurrentDisplay(),
+ "EGL_EXT_image_dma_buf_import_modifiers")) {
+ pass = test_half_modifier(w, h, buf->fd, buf->stride[0],
+ buf->offset[0]) && pass;
+ pass = test_half_modifier(w, h, buf->fd, buf->stride[0],
+ buf->offset[0]) && pass;
+ }
+
/**
* EGL stack can claim the ownership of the file descriptor only when it
* succeeds. Close the file descriptor here and check that it really