Skip to contentSkip to conversation

igt: Add LOCAL defines for distro compatibility

PATCH In review Arkadiusz Hiler 2 participants 3 messages Jul 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igt: Add LOCAL defines for distro compatibility

Each Linux distro takes a different spin on providing kernel's uapi headers (especialy the *drm*.h).

You can get them with linux-headers, you can get them with libdrm. Sometime you can even get them twice, from both sources.

Sometimes the headers match your kernel version, sometimes you end up stuck with headers matching the kernel that the given release of the distro came out with.

This makes things harder for code that does not depend on libdrm, as we cannot have sane ./configure-time checks.

So let's define LOCAL_ version for FENCE and EXECBUFFER2_WB defines until all the stable distros catch up (+/- some epsilon).

Cc Petri Latvala <[email protected]>
Cc Chris Wilson <[email protected]>
---
 benchmarks/gem_exec_tracer.c | 10 ++++++++--
 tools/aubdump.c              |  5 ++++-
 2 files changed, 12 insertions(+), 3 deletions(-)
benchmarks/gem_exec_tracer.c +8 -2
index d958985..a49c11a 100644
@@ -138,6 +138,9 @@ fail_if(int cond, const char *format, ...)
 	abort();
 }
 
+#define LOCAL_I915_EXEC_FENCE_IN              (1<<16)
+#define LOCAL_I915_EXEC_FENCE_OUT             (1<<17)
+
 static void
 trace_exec(struct trace *trace,
 	   const struct drm_i915_gem_execbuffer2 *execbuffer2)
@@ -146,7 +149,7 @@ trace_exec(struct trace *trace,
 	const struct drm_i915_gem_exec_object2 *exec_objects =
 		to_ptr(typeof(*exec_objects), execbuffer2->buffers_ptr);
 
-	fail_if(execbuffer2->flags & (I915_EXEC_FENCE_IN | I915_EXEC_FENCE_OUT),
+	fail_if(execbuffer2->flags & (LOCAL_I915_EXEC_FENCE_IN | LOCAL_I915_EXEC_FENCE_OUT),
 		"fences not supported yet\n");
 
 	flockfile(trace->file);
@@ -268,6 +271,9 @@ static int is_i915(int fd)
 	return strcmp(name, "i915") == 0;
 }
 
+#define LOCAL_IOCTL_I915_GEM_EXECBUFFER2_WR \
+    DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
+
 int
 ioctl(int fd, unsigned long request, ...)
 {
@@ -326,7 +332,7 @@ ioctl(int fd, unsigned long request, ...)
 
 	switch (request) {
 	case DRM_IOCTL_I915_GEM_EXECBUFFER2:
-	case DRM_IOCTL_I915_GEM_EXECBUFFER2_WR:
+	case LOCAL_IOCTL_I915_GEM_EXECBUFFER2_WR:
 		trace_exec(t, argp);
 		break;
 
tools/aubdump.c +4 -1
index eccea74..610526c 100644
@@ -578,6 +578,9 @@ maybe_init(void)
 	fail_if(bos == NULL, "intel_aubdump: out of memory\n");
 }
 
+#define LOCAL_IOCTL_I915_GEM_EXECBUFFER2_WR \
+    DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
+
 int
 ioctl(int fd, unsigned long request, ...)
 {
@@ -633,7 +636,7 @@ ioctl(int fd, unsigned long request, ...)
 		}
 
 		case DRM_IOCTL_I915_GEM_EXECBUFFER2:
-		case DRM_IOCTL_I915_GEM_EXECBUFFER2_WR: {
+		case LOCAL_IOCTL_I915_GEM_EXECBUFFER2_WR: {
 			dump_execbuffer2(fd, argp);
 			if (device_override)
 				return 0;
Signature · 6 lines
2.9.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw

Hi Arkadiusz,

Quoted 6 lines · Arkadiusz Hiler

Each Linux distro takes a different spin on providing kernel's uapi headers (especialy the *drm*.h).

You can get them with linux-headers, you can get them with libdrm. Sometime you can even get them twice, from both sources.

Your distro should _not_ provide the files with linux-headers, exactly for the reasons mentioned.
Please speak with your distro to fix their packaging.

Quoted 10 lines

Sometimes the headers match your kernel version, sometimes you end up stuck with headers matching the kernel that the given release of the distro came out with.

This makes things harder for code that does not depend on libdrm, as we cannot have sane ./configure-time checks.

So let's define LOCAL_ version for FENCE and EXECBUFFER2_WB defines until all the stable distros catch up (+/- some epsilon).

One could bump the libdrm version in configure, but some distros (same one as the one doing linux-headers goofups?) are slow to ship new versions.
Please consider voting for the package so it can be updated in timely manner, or even lend packagers a hand ;-)

Note this is _not_ an objection to the patch. Adding [temporary] local makes perfect sense.

FWIW

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

#2 lore raw
Quoted 6 lines · Emil Velikov

Hi Arkadiusz,

Quoted 3 lines · Arkadiusz Hiler

Each Linux distro takes a different spin on providing kernel's uapi headers (especialy the *drm*.h).

Quoted 6 lines
Quoted 3 lines

You can get them with linux-headers, you can get them with libdrm. Sometime you can even get them twice, from both sources.

Your distro should _not_ provide the files with linux-headers, exactly for the reasons mentioned.
Please speak with your distro to fix their packaging.

That fix is not actually for me. I am just maintaining stuff.

My distors are fine, but the header thing seems to be a common headache.

Quoted 7 lines
Quoted 7 lines

Sometimes the headers match your kernel version, sometimes you end up stuck with headers matching the kernel that the given release of the distro came out with.

This makes things harder for code that does not depend on libdrm, as we cannot have sane ./configure-time checks.

Quoted 6 lines
Quoted 3 lines

So let's define LOCAL_ version for FENCE and EXECBUFFER2_WB defines until all the stable distros catch up (+/- some epsilon).

One could bump the libdrm version in configure, but some distros (same one as the one doing linux-headers goofups?) are slow to ship new versions.

The version is correct and it is in effect for components that do depend on it.

This is for the kernel uapi headers which suffer for being both in kernel-headers (some distro butcher them out though) and in libdrm-dev(el).

Quoted 7 lines

Please consider voting for the package so it can be updated in timely manner, or even lend packagers a hand ;-)
Note this is _not_ an objection to the patch. Adding [temporary] local makes perfect sense.

FWIW

Thanks, I'll push it in a moment.

Signature · 6 lines
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx