[Piglit] [PATCH 1/6] image_common: resolve EGL_EXT_image_dma_buf_import_modifiers functions
Varad Gautam
varadgautam at gmail.com
Fri Nov 25 09:35:14 UTC 2016
From: Varad Gautam <varad.gautam at collabora.com>
Signed-off-by: Varad Gautam <varad.gautam at collabora.com>
---
tests/spec/ext_image_dma_buf_import/image_common.c | 59 ++++++++++++++++++++++
tests/spec/ext_image_dma_buf_import/image_common.h | 23 +++++++++
2 files changed, 82 insertions(+)
diff --git a/tests/spec/ext_image_dma_buf_import/image_common.c b/tests/spec/ext_image_dma_buf_import/image_common.c
index af01c3d..4d2c913 100644
--- a/tests/spec/ext_image_dma_buf_import/image_common.c
+++ b/tests/spec/ext_image_dma_buf_import/image_common.c
@@ -75,3 +75,62 @@ stub_eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
PFNEGLDESTROYIMAGEKHRPROC image_common_dispatch_eglDestroyImageKHR =
stub_eglDestroyImageKHR;
+
+static void
+resolve_eglQueryDmaBufFormatsEXT()
+{
+ if (piglit_is_egl_extension_supported(eglGetCurrentDisplay(),
+ "EGL_EXT_image_dma_buf_import_modifiers"))
+ image_common_dispatch_eglQueryDmaBufFormatsEXT =
+ (PFNEGLQUERYDMABUFFORMATSEXTPROC) eglGetProcAddress(
+ "eglQueryDmaBufFormatsEXT");
+ else
+ image_common_unsupported("QueryDmaBufFormatsEXT");
+}
+
+EGLAPI EGLBoolean EGLAPIENTRY
+stub_eglQueryDmaBufFormatsEXT(EGLDisplay dpy, EGLint max_formats,
+ EGLint *formats,
+ EGLint *num_formats)
+{
+ resolve_eglQueryDmaBufFormatsEXT();
+ return image_common_dispatch_eglQueryDmaBufFormatsEXT(dpy,
+ max_formats,
+ formats,
+ num_formats);
+}
+
+PFNEGLQUERYDMABUFFORMATSEXTPROC
+image_common_dispatch_eglQueryDmaBufFormatsEXT =
+ stub_eglQueryDmaBufFormatsEXT;
+static void
+resolve_eglQueryDmaBufModifiersEXT()
+{
+ if (piglit_is_egl_extension_supported(eglGetCurrentDisplay(),
+ "EGL_EXT_image_dma_buf_import_modifiers"))
+ image_common_dispatch_eglQueryDmaBufModifiersEXT =
+ (PFNEGLQUERYDMABUFMODIFIERSEXTPROC) eglGetProcAddress(
+ "eglQueryDmaBufModifiersEXT");
+ else
+ image_common_unsupported("QueryDmaBufModifiersEXT");
+}
+
+EGLAPI EGLBoolean EGLAPIENTRY
+stub_eglQueryDmaBufModifiersEXT(EGLDisplay dpy, EGLint format,
+ EGLint max_modifiers,
+ EGLuint64KHR *modifiers,
+ EGLBoolean *external_only,
+ EGLint *num_modifiers)
+{
+ resolve_eglQueryDmaBufModifiersEXT();
+ return image_common_dispatch_eglQueryDmaBufModifiersEXT(dpy,
+ format,
+ max_modifiers,
+ modifiers,
+ external_only,
+ num_modifiers);
+}
+
+PFNEGLQUERYDMABUFMODIFIERSEXTPROC
+image_common_dispatch_eglQueryDmaBufModifiersEXT =
+ stub_eglQueryDmaBufModifiersEXT;
diff --git a/tests/spec/ext_image_dma_buf_import/image_common.h b/tests/spec/ext_image_dma_buf_import/image_common.h
index f9845c7..81ef7c5 100644
--- a/tests/spec/ext_image_dma_buf_import/image_common.h
+++ b/tests/spec/ext_image_dma_buf_import/image_common.h
@@ -73,4 +73,27 @@ extern PFNEGLCREATEIMAGEKHRPROC image_common_dispatch_eglCreateImageKHR;
extern PFNEGLDESTROYIMAGEKHRPROC image_common_dispatch_eglDestroyImageKHR;
#define eglDestroyImageKHR image_common_dispatch_eglDestroyImageKHR
+#ifndef EGL_EXT_image_dma_buf_import_modifiers
+#define EGL_EXT_image_dma_buf_import_modifiers 1
+#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440
+#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441
+#define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442
+#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443
+#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444
+#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445
+#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446
+#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447
+#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448
+#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449
+#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers);
+#endif
+
+extern PFNEGLQUERYDMABUFFORMATSEXTPROC image_common_dispatch_eglQueryDmaBufFormatsEXT;
+#define eglQueryDmaBufFormatsEXT image_common_dispatch_eglQueryDmaBufFormatsEXT
+
+extern PFNEGLQUERYDMABUFMODIFIERSEXTPROC image_common_dispatch_eglQueryDmaBufModifiersEXT;
+#define eglQueryDmaBufModifiersEXT image_common_dispatch_eglQueryDmaBufModifiersEXT
+
#endif /* IMAGE_COMMON_H */
--
2.6.2
More information about the Piglit
mailing list