[Piglit] [PATCH v2] utils: define DRM_FORMATS needed by dma_buf tests

Dylan Baker dylan at pnwbakers.com
Wed Sep 28 19:09:09 UTC 2016


If they're not defined by the installed libdrm already.

This moves code already defined in transcode-nv12-as-r8-gr88 to the
utils level, so that all tests that require these formats get them, and also
adds on additional define that wasn't in the mentioned test.

bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97951
cc: Vinson Lee <vlee at freedesktop.org>
cc: Rob Clark <robdclark at gmail.com>
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---

This is a completely different approach than the last time, but I think this
might be better than the previous approach too.

I've compile tested this and it's running through CI now.

 .../ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c  | 12 ------------
 tests/util/piglit-framework-gl/piglit_drm_dma_buf.c       | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c b/tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c
index f968539..7e5d5c8 100644
--- a/tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c
+++ b/tests/spec/ext_image_dma_buf_import/transcode-nv12-as-r8-gr88.c
@@ -48,18 +48,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
-/* The kernel header drm_fourcc.h defines the DRM formats below. We duplicate
- * some of the definitions so that building Piglit won't require bleeding-edge
- * kernel headers.
- */
-#ifndef DRM_FORMAT_R8
-#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ')
-#endif
-
-#ifndef DRM_FORMAT_GR88
-#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8')
-#endif
-
 /* Fake data for a 4x4 pixel image in NV12 format. */
 static const uint8_t y_data[] = {
 	0x00, 0x11, 0x22, 0x33,
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 c3225c3..a0a2fc4 100644
--- a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
+++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
@@ -40,6 +40,21 @@
 #include <drm.h>
 #include <unistd.h>
 
+/* These definitions were added in libdrm 2.4.68, since that's still pretty
+ * recent defined these to allow older libdrm to continue working.
+ */
+#ifndef DRM_FORMAT_R8
+#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ')
+#endif
+
+#ifndef DRM_FORMAT_RG88
+#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8')
+#endif
+
+#ifndef DRM_FORMAT_GR88
+#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8')
+#endif
+
 #define ALIGN(value, alignment) (((value) + alignment - 1) & ~(alignment - 1))
 
 struct piglit_drm_driver {
-- 
2.10.0



More information about the Piglit mailing list