Skip to contentSkip to conversation

lib/stubs: Add stubs for intel_bufmgr.

RFC Robert Foss 1 participant 1 message May 25, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 25df-57460a80-11-795d2b00@204872346

#1 lore raw

Forward to ML.

Quoted 12 lines · On Wednesday, May 25, 2016 19:18 BST, [email protected] wrote:

From: Robert Foss <[email protected]>

This patch provides stubs for functionality otherwise provided by intel_bufmgr.

The stubbed functions all fail with a call to igt_require_f(false,""). Defines and enums have been copied from libdrm_intel.

Due to the stubbed tests failing with an igt_require_f() call, these stubs are not well suited for non-tests, since tools/benchmarks/etc 'skipping'

execution is unhelpful.

Quoted 9 lines
---
 lib/Makefile.am              |   7 +
 lib/stubs/drm/intel_bufmgr.c | 275 +++++++++++++++++++++++++++
 lib/stubs/drm/intel_bufmgr.h | 430 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 712 insertions(+)
 create mode 100644 lib/stubs/drm/intel_bufmgr.c
 create mode 100644 lib/stubs/drm/intel_bufmgr.h

And now the final piece...

lib/Makefile.am if HAVE_LIBDRM_VC4 · line 16

Quoted 8 lines
lib/Makefile.am +0 -0
index d2ae98d..3e12f25 100644
@@ -14,6 +14,13 @@ if HAVE_LIBDRM_VC4
         igt_vc4.h
 endif
 

Not sure how one can do this gradually so here's the overall result... Actually we can do it with a lot less churn props to the following. I should comment on 1/7 though as it's missing some bits.

configure.ac +3 -0
@@ -155,6 +155,9 @@ PKG_CHECK_MODULES(GLIB, glib-2.0)
 if test "x$INTEL" = xyes; then
        PKG_CHECK_MODULES(DRM_INTEL, [libdrm_intel >= 2.4.64])
        AC_DEFINE(HAVE_LIBDRM_INTEL, 1, [Have intel support])
+else
+       DRM_INTEL_CFLAGS=$(top_srcdir)/lib/stubs/drm/
+       AC_SUBST([DRM_INTEL_CFLAGS])
 fi
 AM_CONDITIONAL(HAVE_LIBDRM_INTEL, [test "x$INTEL" = xyes])
 

lib/Makefile.am if HAVE_LIBDRM_VC4 · line 18

Quoted 2 lines
lib/Makefile.am +2 -0
+if HAVE_LIBDRM_INTEL
+else

Just drop the conditional ? The if guard within the source file is enough.

Quoted 14 lines
lib/Makefile.am +5 -0
+    libintel_tools_la_SOURCES += 	\
+        stubs/drm/intel_bufmgr.c	\
+        stubs/drm/intel_bufmgr.h
+endif
+
 AM_CPPFLAGS = -I$(top_srcdir)
 AM_CFLAGS = $(CWARNFLAGS) $(DRM_CFLAGS) $(PCIACCESS_CFLAGS) $(LIBUNWIND_CFLAGS) $(DEBUG_CFLAGS) \
 	    -DIGT_SRCDIR=\""$(abs_top_srcdir)/tests"\" \
lib/stubs/drm/intel_bufmgr.c new file +0 -0
new file mode 100644
index 0000000..eaf1b3e

lib/stubs/drm/intel_bufmgr.c line 10

Quoted 10 lines
lib/stubs/drm/intel_bufmgr.c new file +10 -0
@@ -0,0 +1,275 @@
+#ifndef HAVE_LIBDRM_INTEL
+
+#include <drm.h>
+#include <i915_drm.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "igt_core.h"
+#include "intel_bufmgr.h"
+

Not sure if we need all those includes. I'm leaning that at least stdint and stdbool should do. Please double-check.

lib/stubs/drm/intel_bufmgr.c line 14

Quoted 4 lines
lib/stubs/drm/intel_bufmgr.c new file +4 -0
+
+drm_intel_bufmgr *drm_intel_bufmgr_gem_init(int fd, int batch_size)
+{
+	igt_require_f(false, "Not compiled with libdrm_intel support\n");

Ideally you want something like (you might get away without the "%s")

	igt_require_f(false, "%s", compiled_without_libdrm_intel_msg);

And declare the variable at the top

static const char *compiled_without_libdrm_intel_msg = "Not compiled with libdrm_intel support\n";

Otherwise you'll end up with dozens of instances of the exact same string.

lib/stubs/drm/intel_bufmgr.c line 17

Quoted 3 lines
lib/stubs/drm/intel_bufmgr.c new file +3 -0
+}
+
+#endif//HAVE_LIBDRM_INTEL

Space around //

lib/stubs/drm/intel_bufmgr.h line 3

Quoted 9 lines
lib/stubs/drm/intel_bufmgr.h new file +3 -0
new file mode 100644
index 0000000..12bce60
@@ -0,0 +1,430 @@
+#ifndef INTEL_DRM_STUBS_H
+#define INTEL_DRM_STUBS_H
+

This file should be an exact copy of the one provided by libdrm_intel. You want to add a README here and/or update the RELEASING document to remind people to check/resync the file before release. Ideally as a follow up commit.

-Emil

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx