On 09/11/2013 05:34 AM, Pohjolainen, Topi wrote:
On Tue, Sep 10, 2013 at 11:07:54AM -0700, Chad Versace wrote:
The extension EGL_EXT_image_dma_buf_import is a recent extension,
published 2013-02-09, and therefore the eglext.h on many systems do not
define it.  The first Mesa version in which eglext.h defined the
extension was was Mesa 9.2.

To fix the build on such systems, define the extension's enums in
image_common.h.

Is there any way we could use the 'EGL_EGLEXT_VERSION' found in the "eglext.h"?
I'm just thinking that if the header is too old than the EGL stack is too old
to support the tests anyway.

Yes, it's possible to verify header information during CMake configuration with
check_c_source_compiles(). But, I'm not convinced that's the right thing to do 
here.
I have often seen people build Piglit in a way that the GL and EGL headers and 
libraries
that get used during compilation and linking are those located in /usr, but the
libraries used when running tests are those located in the Mesa build directory.
If Piglit were to base its decision to build the dma_buf tests on the contents
of /usr/include/EGL/eglext.h, then many users would not run the dma_buf tests
despite that their local Mesa build is capable.



Signed-off-by: Chad Versace <chad.vers...@linux.intel.com>
---
  tests/spec/ext_image_dma_buf_import/image_common.h | 30 ++++++++++++++++++++++
  .../spec/ext_image_dma_buf_import/sample_common.c  |  4 +--
  2 files changed, 31 insertions(+), 3 deletions(-)

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 29338c0..a9a1715 100644
--- a/tests/spec/ext_image_dma_buf_import/image_common.h
+++ b/tests/spec/ext_image_dma_buf_import/image_common.h
@@ -35,6 +35,36 @@
  #define EGL_EGLEXT_PROTOTYPES 1
  #include <EGL/eglext.h>

+/* We define here the enums for EGL_EXT_image_dma_buf_import because, as of
+ * today (2013-09-10), the eglext.h on many systems lack them.  The first Mesa
+ * version in which eglext.h defined the enums was Mesa 9.2 (2013-08-27).
+ */
+#ifndef EGL_EXT_image_dma_buf_import
+#define EGL_EXT_image_dma_buf_import 1
+#define EGL_LINUX_DMA_BUF_EXT                  0x3270
+#define EGL_LINUX_DRM_FOURCC_EXT               0x3271
+#define EGL_DMA_BUF_PLANE0_FD_EXT              0x3272
+#define EGL_DMA_BUF_PLANE0_OFFSET_EXT          0x3273
+#define EGL_DMA_BUF_PLANE0_PITCH_EXT           0x3274
+#define EGL_DMA_BUF_PLANE1_FD_EXT              0x3275
+#define EGL_DMA_BUF_PLANE1_OFFSET_EXT          0x3276
+#define EGL_DMA_BUF_PLANE1_PITCH_EXT           0x3277
+#define EGL_DMA_BUF_PLANE2_FD_EXT              0x3278
+#define EGL_DMA_BUF_PLANE2_OFFSET_EXT          0x3279
+#define EGL_DMA_BUF_PLANE2_PITCH_EXT           0x327A
+#define EGL_YUV_COLOR_SPACE_HINT_EXT           0x327B
+#define EGL_SAMPLE_RANGE_HINT_EXT              0x327C
+#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
+#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
+#define EGL_ITU_REC601_EXT                     0x327F
+#define EGL_ITU_REC709_EXT                     0x3280
+#define EGL_ITU_REC2020_EXT                    0x3281
+#define EGL_YUV_FULL_RANGE_EXT                 0x3282
+#define EGL_YUV_NARROW_RANGE_EXT               0x3283
+#define EGL_YUV_CHROMA_SITING_0_EXT            0x3284
+#define EGL_YUV_CHROMA_SITING_0_5_EXT          0x3285
+#endif
+
  extern PFNEGLCREATEIMAGEKHRPROC image_common_dispatch_eglCreateImageKHR;
  #define eglCreateImageKHR image_common_dispatch_eglCreateImageKHR

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 29877be..44dec39 100644
--- a/tests/spec/ext_image_dma_buf_import/sample_common.c
+++ b/tests/spec/ext_image_dma_buf_import/sample_common.c
@@ -22,9 +22,7 @@
   */

  #include "sample_common.h"
-#include "piglit-util-egl.h"
-#define EGL_EGLEXT_PROTOTYPES 1
-#include <EGL/eglext.h>
+#include "image_common.h"
  #include <unistd.h>

  static const char fs_src[] =
--
1.8.3.1



_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to