Skip to contentSkip to conversation

Fix IGTs for Android

PATCH Superseded Arkadiusz Hiler 4 participants 26 messages Apr 19, 2017 – May 5, 2017 Library code

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Fix IGTs for Android

IGTs are broken for Android since the introduction of dependency on procps. Over time other incompatibilities built up.

I took the liberty to fix some of the issues, workaround couple of others and blacklist heavily incompatible tools/tests.

It builds on (almost) vanilla AOSP now.

Github: <https://github.com/ivyl/igt/commits/android>
Howto:  <https://gist.github.com/ivyl/1e05af15ae37b575e03dc69e5e2488fc>

DEP1: <https://github.com/ivyl/libkmod-android>
DEP2: <https://github.com/android-ia/external_libpciaccess>

We should include a note on Android compatibility in the README and do "continuous compilation" of the patches as they arrive on the mailing list, otherwise this **will get broken again soon**.

This is long as it is, but not complete yet.

Here are some of more obvious TODOs:
* introduce something like IGT_HAS_CAIRO define for convenience
* revise igt_kms dependency on cairo and enable everything what is independent
* revise kms tests and do the above
* review all things that are disabled on Android and try to enable them
* do something less ugly with config.h generation on Android

Cc Antonio Argenziano <[email protected]>
Cc Vinay Belgaumkar <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Robert Foss <[email protected]>

Arkadiusz Hiler (13):
tests/drm_import_export: Include {i915_,}drm.h properly Make conditions on HAVE_UDEV consistent
lib/igt_aux: Include unistd.h for gettid() on Android lib/igt_aux: Make procps optional
chamelium: Fix build issues on Android tools/Android.mk: Add guc_logger and l3_parity skip list tests/Android.mk: Add perf to skip list benchmarks/Android.mk: Add gem_latency to skip list Android.mk: Fix libkmod use
Android.mk: Filter out *.h from src files
Android.mk: Use drm stubs
tools/Android.mk: Fix zlib inclusion tests/gem_exec_nop: Disable headless subtest on cairoless Android

 benchmarks/Android.mk          |  9 +++++++--
 configure.ac                   |  6 +++++-
 demos/Android.mk               |  3 ++-
 lib/Android.mk                 |  8 +++++---
 lib/Makefile.am                |  7 +++++++
 lib/Makefile.sources           |  7 -------
 lib/igt.h                      |  2 ++
 lib/igt_aux.c                  | 26 ++++++++++++++++++++++----
 lib/igt_aux.h                  |  5 +++++
 lib/igt_chamelium.h            |  3 +++
 lib/igt_kmod.h                 |  4 ++++
 lib/tests/Android.mk           |  4 ++--
 tests/Android.mk               |  9 +++++----
 tests/Makefile.am              |  6 ++++++
 tests/Makefile.sources         |  6 ------
 tests/drm_import_export.c      |  4 ++--
 tests/gem_exec_nop.c           |  4 ++++
 tests/testdisplay_hotplug.c    |  2 +-
 tools/Android.mk               | 14 +++++++++-----
 tools/intel_l3_parity.c        |  2 +-
 tools/intel_l3_parity.h        |  2 +-
 tools/intel_l3_udev_listener.c |  2 +-
 22 files changed, 94 insertions(+), 41 deletions(-)
Signature · 6 lines
2.9.3

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

PATCH 1/13 tests/drm_import_export: Include {i915_, }drm.h properly

Using libdrm/ impairs compatibility with android build system and pkg-config manages -I for us on regular distros.

---
 tests/drm_import_export.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/drm_import_export.c +2 -2
index cfe5f6d..f1234bd 100644
@@ -32,8 +32,8 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <string.h>
-#include <libdrm/drm.h>
-#include <libdrm/i915_drm.h>
+#include <drm.h>
+#include <i915_drm.h>
 #include <xf86drm.h>
 #include <intel_bufmgr.h>
 #include <errno.h>
Signature · 6 lines
2.9.3

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

PATCH 2/13 Make conditions on HAVE_UDEV consistent

In reply to Arkadiusz Hiler

We have a lot of #ifdef HAVE_UDEV and #if HAVE_UDEV all over the place, but ifdef and if have a slightly different semantics.

Let make it consistent by using #ifdefs only.

---
 lib/igt_aux.c                  | 2 +-
 tests/testdisplay_hotplug.c    | 2 +-
 tools/intel_l3_parity.c        | 2 +-
 tools/intel_l3_parity.h        | 2 +-
 tools/intel_l3_udev_listener.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
lib/igt_aux.c +1 -1
index 1222806..2ec6b78 100644
@@ -388,7 +388,7 @@ void igt_stop_shrink_helper(void)
 	igt_stop_helper(&shrink_helper);
 }
 
-#if HAVE_UDEV
+#ifdef HAVE_UDEV
 #include <libudev.h>
 
 static struct igt_helper_process hang_detector;
tests/testdisplay_hotplug.c +1 -1
index 3b900ca..cf15511 100644
@@ -34,7 +34,7 @@
 #endif
 
 
-#if HAVE_UDEV
+#ifdef HAVE_UDEV
 #include <libudev.h>
 static struct udev_monitor *uevent_monitor;
 static struct udev *udev;
tools/intel_l3_parity.c +1 -1
index dce7f32..eb00c50 100644
@@ -42,7 +42,7 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
-#if HAVE_UDEV
+#ifdef HAVE_UDEV
 #include <libudev.h>
 #include <syslog.h>
 #endif
tools/intel_l3_parity.h +1 -1
index 65697c4..759c4f4 100644
@@ -18,7 +18,7 @@ struct l3_location {
 	uint8_t subbank;
 };
 
-#if HAVE_UDEV
+#ifdef HAVE_UDEV
 int l3_uevent_setup(struct l3_parity *par);
 /* Listens (blocks) for an l3 parity event. Returns the location of the error. */
 int l3_listen(struct l3_parity *par, bool daemon, struct l3_location *loc);
tools/intel_l3_udev_listener.c +1 -1
index 0b94c1c..270bfff 100644
@@ -25,7 +25,7 @@
 #include "config.h"
 #endif
 
-#if HAVE_UDEV
+#ifdef HAVE_UDEV
 #include <libudev.h>
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
Signature · 6 lines
2.9.3

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

PATCH 3/13 lib/igt_aux: Include unistd.h for gettid() on Android

In reply to Arkadiusz Hiler

We define gettid() using syscall() because glibc does not provide a wrapper.

Android's bionic got the syscall covered though.

---
 lib/igt_aux.h | 5 +++++
 1 file changed, 5 insertions(+)
lib/igt_aux.h +5 -0
index e62858e..54b9716 100644
@@ -43,7 +43,12 @@ extern int num_trash_bos;
 #define NSEC_PER_SEC (1000*USEC_PER_SEC)
 
 /* signal interrupt helpers */
+#ifdef ANDROID
+#include <unistd.h> /* on Android bionic has this implemented */
+#else
 #define gettid() syscall(__NR_gettid)
+#endif
+
 #define sigev_notify_thread_id _sigev_un._tid
 
 /* auxialiary igt helpers from igt_aux.c */
Signature · 6 lines
2.9.3

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

Re: [PATCH i-g-t 03/13] lib/igt_aux: Include unistd.h for gettid() on Android

Quoted 15 lines · Arkadiusz Hiler

We define gettid() using syscall() because glibc does not provide a wrapper.

Android's bionic got the syscall covered though.

---
 lib/igt_aux.h | 5 +++++
 1 file changed, 5 insertions(+)
lib/igt_aux.h +0 -0
index e62858e..54b9716 100644

lib/igt_aux.h extern int num_trash_bos; · line 46

Quoted 4 lines
lib/igt_aux.h +1 -0
@@ -43,7 +43,12 @@ extern int num_trash_bos;
 #define NSEC_PER_SEC (1000*USEC_PER_SEC)
 
 /* signal interrupt helpers */
+#ifdef ANDROID

Seems like this should be something like HAVE_GETTID, defined by configure or by android makefiles?

BR,
Jani.

Quoted 8 lines
lib/igt_aux.h +4 -0
+#include <unistd.h> /* on Android bionic has this implemented */
+#else
 #define gettid() syscall(__NR_gettid)
+#endif
+
 #define sigev_notify_thread_id _sigev_un._tid
 
 /* auxialiary igt helpers from igt_aux.c */
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Re: [PATCH i-g-t 03/13] lib/igt_aux: Include unistd.h for gettid() on Android

Quoted 18 lines · Jani Nikula
Quoted 17 lines · Arkadiusz Hiler

We define gettid() using syscall() because glibc does not provide a wrapper.

Android's bionic got the syscall covered though.

---
 lib/igt_aux.h | 5 +++++
 1 file changed, 5 insertions(+)
lib/igt_aux.h +0 -0
index e62858e..54b9716 100644
@@ -43,7 +43,12 @@ extern int num_trash_bos;
 #define NSEC_PER_SEC (1000*USEC_PER_SEC)
 
Quoted 5 lines

lib/igt_aux.h extern int num_trash_bos; · line 46

Quoted 2 lines
lib/igt_aux.h +1 -0
 /* signal interrupt helpers */
+#ifdef ANDROID

Seems like this should be something like HAVE_GETTID, defined by configure or by android makefiles?

Yeah, but that's not that easy (yet) and that's not the only area which would use it - notice the thing with cairo from the cover letter.

config.h is generated in a ugly way for Android - lib/Android.mk does that. Also if you ./configure it stops compiling for Android causing confusing error.

Whole area could use some heavy reworking.

One approach would be to mimic what other projects do:

* have config_android.h with set of sane #defines (as environment is more static and there is no ac/am)

* don't define HAVE_CONFIG_H and just -include config_android.h on... Android

* add gettid() discovery via ac for Linux (I don't think that any libc other than bionic wraps that call though)

But that would made a whole series.
I would like to go with #ifdef ANDROID for now.

Signature · 2 lines
Cheers,
Arek
Quoted 8 lines

lib/igt_aux.h extern int num_trash_bos; · line 54

Quoted 8 lines
lib/igt_aux.h +4 -0
+#include <unistd.h> /* on Android bionic has this implemented */
+#else
 #define gettid() syscall(__NR_gettid)
+#endif
+
 #define sigev_notify_thread_id _sigev_un._tid
 
 /* auxialiary igt helpers from igt_aux.c */

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

#6 lore raw

Re: [PATCH i-g-t 03/13] lib/igt_aux: Include unistd.h for gettid() on Android

Quoted 42 lines · Arkadiusz Hiler
Quoted 18 lines · Jani Nikula
Quoted 17 lines · Arkadiusz Hiler

We define gettid() using syscall() because glibc does not provide a wrapper.

Android's bionic got the syscall covered though.

---
 lib/igt_aux.h | 5 +++++
 1 file changed, 5 insertions(+)
lib/igt_aux.h +0 -0
index e62858e..54b9716 100644
@@ -43,7 +43,12 @@ extern int num_trash_bos;
 #define NSEC_PER_SEC (1000*USEC_PER_SEC)
 
Quoted 5 lines

lib/igt_aux.h extern int num_trash_bos; · line 46

Quoted 2 lines
lib/igt_aux.h +1 -0
 /* signal interrupt helpers */
+#ifdef ANDROID

Seems like this should be something like HAVE_GETTID, defined by configure or by android makefiles?

Yeah, but that's not that easy (yet) and that's not the only area which would use it - notice the thing with cairo from the cover letter.

config.h is generated in a ugly way for Android - lib/Android.mk does that. Also if you ./configure it stops compiling for Android causing confusing error.

Whole area could use some heavy reworking.

One approach would be to mimic what other projects do:

* have config_android.h with set of sane #defines (as environment is more static and there is no ac/am)

* don't define HAVE_CONFIG_H and just -include config_android.h on... Android

Quoted 6 lines

* add gettid() discovery via ac for Linux (I don't think that any libc other than bionic wraps that call though)

But that would made a whole series.
I would like to go with #ifdef ANDROID for now.

Fair enough.

It's just that I cringe seeing #ifdef <ENVIRONMENT> instead of #ifdef <FEATURE>, when <ENVIRONMENT> and <FEATURE> are not interchangeable or 1:1. For example, glibc might include gettid later.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH i-g-t 03/13] lib/igt_aux: Include unistd.h for gettid() on Android

Quoted 50 lines · Jani Nikula
Quoted 42 lines · Arkadiusz Hiler
Quoted 18 lines · Jani Nikula
Quoted 17 lines · Arkadiusz Hiler

We define gettid() using syscall() because glibc does not provide a wrapper.

Android's bionic got the syscall covered though.

---
 lib/igt_aux.h | 5 +++++
 1 file changed, 5 insertions(+)
lib/igt_aux.h +0 -0
index e62858e..54b9716 100644
@@ -43,7 +43,12 @@ extern int num_trash_bos;
 #define NSEC_PER_SEC (1000*USEC_PER_SEC)
 
Quoted 5 lines

lib/igt_aux.h extern int num_trash_bos; · line 46

Quoted 2 lines
lib/igt_aux.h +1 -0
 /* signal interrupt helpers */
+#ifdef ANDROID

Seems like this should be something like HAVE_GETTID, defined by configure or by android makefiles?

Yeah, but that's not that easy (yet) and that's not the only area which would use it - notice the thing with cairo from the cover letter.

config.h is generated in a ugly way for Android - lib/Android.mk does that. Also if you ./configure it stops compiling for Android causing confusing error.

Whole area could use some heavy reworking.

One approach would be to mimic what other projects do:

* have config_android.h with set of sane #defines (as environment is more static and there is no ac/am)

* don't define HAVE_CONFIG_H and just -include config_android.h on... Android

Quoted 6 lines

* add gettid() discovery via ac for Linux (I don't think that any libc other than bionic wraps that call though)

But that would made a whole series.
I would like to go with #ifdef ANDROID for now.

Quoted 8 lines

Fair enough.

It's just that I cringe seeing #ifdef <ENVIRONMENT> instead of #ifdef <FEATURE>, when <ENVIRONMENT> and <FEATURE> are not interchangeable or 1:1. For example, glibc might include gettid later.

BR,
Jani.

I completetly get that, I had mixed feeling adding the ifdef.
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

PATCH 4/13 lib/igt_aux: Make procps optional

In reply to Arkadiusz Hiler

Android does not have procps and it's not easy to compile it as a dependency.

We can provide alternative, "naive" implementation that just shells out to external commands (i.e. pkill and lsof) in case we do not have the library.

---
 configure.ac  |  6 +++++-
 lib/igt_aux.c | 24 +++++++++++++++++++++---
 2 files changed, 26 insertions(+), 4 deletions(-)
configure.ac +5 -1
index 12b0ab0..a5a92d5 100644
@@ -123,7 +123,11 @@ AC_SUBST(ASSEMBLER_WARN_CFLAGS)
 PKG_CHECK_MODULES(DRM, [libdrm])
 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
 PKG_CHECK_MODULES(KMOD, [libkmod])
-PKG_CHECK_MODULES(PROCPS, [libprocps])
+PKG_CHECK_MODULES(PROCPS, [libprocps], [procps=yes], [procps=no])
+AM_CONDITIONAL(HAVE_PROCPS, [test "x$procps" = xyes])
+if test x"$procps" = xyes; then
+	AC_DEFINE(HAVE_PROCPS,1,[Enable process managment without shelling out])
+fi
 PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no])
 
 if test x$have_valgrind = xyes; then
lib/igt_aux.c +21 -3
index 2ec6b78..4efb45b 100644
@@ -50,9 +50,7 @@
 #include <sys/utsname.h>
 #include <termios.h>
 #include <assert.h>
-
-#include <proc/readproc.h>
-
+#include <linux/limits.h>
 #include "drmtest.h"
 #include "i915_drm.h"
 #include "intel_chipset.h"
@@ -71,6 +69,10 @@
 #include <libgen.h>   /* for dirname() */
 #endif
 
+#ifdef HAVE_PROCPS
+#include <proc/readproc.h>
+#endif
+
 /**
  * SECTION:igt_aux
  * @short_description: Auxiliary libraries and support functions
@@ -1295,6 +1297,7 @@ void igt_set_module_param_int(const char *name, int val)
  */
 int igt_terminate_process(int sig, const char *comm)
 {
+#ifdef HAVE_PROCPS
 	PROCTAB *proc;
 	proc_t *proc_info;
 	int err = 0;
@@ -1316,6 +1319,12 @@ int igt_terminate_process(int sig, const char *comm)
 
 	closeproc(proc);
 	return err;
+#else
+#warning "No procps, using naive implementation of igt_terminate_process"
+	char pkill_cmd[NAME_MAX];
+	snprintf(pkill_cmd, sizeof(pkill_cmd), "pkill -x -%d %s", sig, comm);
+	return system(pkill_cmd);
+#endif
 }
 
 struct pinfo {
@@ -1324,6 +1333,7 @@ struct pinfo {
 	const char *fn;
 };
 
+#ifdef HAVE_PROCPS
 static void
 __igt_show_stat(struct pinfo *info)
 {
@@ -1499,6 +1509,7 @@ __igt_lsof(const char *dir)
 
 	closeproc(proc);
 }
+#endif
 
 /**
  * igt_lsof: Lists information about files opened by processes.
@@ -1510,6 +1521,7 @@ __igt_lsof(const char *dir)
 void
 igt_lsof(const char *dpath)
 {
+#ifdef HAVE_PROCPS
 	struct stat st;
 	size_t len = strlen(dpath);
 	char *sanitized;
@@ -1530,6 +1542,12 @@ igt_lsof(const char *dpath)
 	__igt_lsof(sanitized);
 
 	free(sanitized);
+#else
+#warning "No procps, using naive implementation of igt_lsof"
+	char lsof_cmd[NAME_MAX];
+	snprintf(lsof_cmd, sizeof(lsof_cmd), "lsof +d %s", dpath);
+	system(lsof_cmd);
+#endif
 }
 
 static struct igt_siglatency {
Signature · 6 lines
2.9.3

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

Re: [PATCH i-g-t 04/13] lib/igt_aux: Make procps optional

Quoted 57 lines · Arkadiusz Hiler

Android does not have procps and it's not easy to compile it as a dependency.

We can provide alternative, "naive" implementation that just shells out to external commands (i.e. pkill and lsof) in case we do not have the library.

---
 configure.ac  |  6 +++++-
 lib/igt_aux.c | 24 +++++++++++++++++++++---
 2 files changed, 26 insertions(+), 4 deletions(-)
configure.ac +5 -1
index 12b0ab0..a5a92d5 100644
@@ -123,7 +123,11 @@ AC_SUBST(ASSEMBLER_WARN_CFLAGS)
 PKG_CHECK_MODULES(DRM, [libdrm])
 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
 PKG_CHECK_MODULES(KMOD, [libkmod])
-PKG_CHECK_MODULES(PROCPS, [libprocps])
+PKG_CHECK_MODULES(PROCPS, [libprocps], [procps=yes], [procps=no])
+AM_CONDITIONAL(HAVE_PROCPS, [test "x$procps" = xyes])
+if test x"$procps" = xyes; then
+	AC_DEFINE(HAVE_PROCPS,1,[Enable process managment without shelling out])
+fi
 PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no])
 
 if test x$have_valgrind = xyes; then
lib/igt_aux.c +5 -3
index 2ec6b78..4efb45b 100644
@@ -50,9 +50,7 @@
 #include <sys/utsname.h>
 #include <termios.h>
 #include <assert.h>
-
-#include <proc/readproc.h>
-
+#include <linux/limits.h>
 #include "drmtest.h"
 #include "i915_drm.h"
 #include "intel_chipset.h"
@@ -71,6 +69,10 @@
 #include <libgen.h>   /* for dirname() */
 #endif
 
+#ifdef HAVE_PROCPS
+#include <proc/readproc.h>
+#endif
+
 /**
  * SECTION:igt_aux
  * @short_description: Auxiliary libraries and support functions

lib/igt_aux.c void igt_set_module_param_int(const char *name, int val) · line 1300

Quoted 4 lines
lib/igt_aux.c +1 -0
@@ -1295,6 +1297,7 @@ void igt_set_module_param_int(const char *name, int val)
  */
 int igt_terminate_process(int sig, const char *comm)
 {
+#ifdef HAVE_PROCPS

Please move ifdefs *outside* the functions, and add another function for the !HAVE_PROCPS branch.

Same below.

BR,
Jani.

Quoted 53 lines
lib/igt_aux.c +15 -0
 	PROCTAB *proc;
 	proc_t *proc_info;
 	int err = 0;
@@ -1316,6 +1319,12 @@ int igt_terminate_process(int sig, const char *comm)
 
 	closeproc(proc);
 	return err;
+#else
+#warning "No procps, using naive implementation of igt_terminate_process"
+	char pkill_cmd[NAME_MAX];
+	snprintf(pkill_cmd, sizeof(pkill_cmd), "pkill -x -%d %s", sig, comm);
+	return system(pkill_cmd);
+#endif
 }
 
 struct pinfo {
@@ -1324,6 +1333,7 @@ struct pinfo {
 	const char *fn;
 };
 
+#ifdef HAVE_PROCPS
 static void
 __igt_show_stat(struct pinfo *info)
 {
@@ -1499,6 +1509,7 @@ __igt_lsof(const char *dir)
 
 	closeproc(proc);
 }
+#endif
 
 /**
  * igt_lsof: Lists information about files opened by processes.
@@ -1510,6 +1521,7 @@ __igt_lsof(const char *dir)
 void
 igt_lsof(const char *dpath)
 {
+#ifdef HAVE_PROCPS
 	struct stat st;
 	size_t len = strlen(dpath);
 	char *sanitized;
@@ -1530,6 +1542,12 @@ igt_lsof(const char *dpath)
 	__igt_lsof(sanitized);
 
 	free(sanitized);
+#else
+#warning "No procps, using naive implementation of igt_lsof"
+	char lsof_cmd[NAME_MAX];
+	snprintf(lsof_cmd, sizeof(lsof_cmd), "lsof +d %s", dpath);
+	system(lsof_cmd);
+#endif
 }
 
 static struct igt_siglatency {
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH v2 1/1 lib/igt_aux: Make procps optional

Android does not have procps and it's not easy to compile it as a dependency.

We can provide alternative, "naive" implementation that just shells out to external commands (i.e. pkill and lsof) in case we do not have the library.

v2: do not ifdef insides of functions (J. Nikula)

---
 configure.ac  |  6 +++++-
 lib/igt_aux.c | 32 +++++++++++++++++++++++++++++---
 2 files changed, 34 insertions(+), 4 deletions(-)
configure.ac +5 -1
index 12b0ab0..a5a92d5 100644
@@ -123,7 +123,11 @@ AC_SUBST(ASSEMBLER_WARN_CFLAGS)
 PKG_CHECK_MODULES(DRM, [libdrm])
 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
 PKG_CHECK_MODULES(KMOD, [libkmod])
-PKG_CHECK_MODULES(PROCPS, [libprocps])
+PKG_CHECK_MODULES(PROCPS, [libprocps], [procps=yes], [procps=no])
+AM_CONDITIONAL(HAVE_PROCPS, [test "x$procps" = xyes])
+if test x"$procps" = xyes; then
+	AC_DEFINE(HAVE_PROCPS,1,[Enable process managment without shelling out])
+fi
 PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no])
 
 if test x$have_valgrind = xyes; then
lib/igt_aux.c +29 -3
index 2ec6b78..3695fa5 100644
@@ -50,9 +50,7 @@
 #include <sys/utsname.h>
 #include <termios.h>
 #include <assert.h>
-
-#include <proc/readproc.h>
-
+#include <linux/limits.h>
 #include "drmtest.h"
 #include "i915_drm.h"
 #include "intel_chipset.h"
@@ -71,6 +69,10 @@
 #include <libgen.h>   /* for dirname() */
 #endif
 
+#ifdef HAVE_PROCPS
+#include <proc/readproc.h>
+#endif
+
 /**
  * SECTION:igt_aux
  * @short_description: Auxiliary libraries and support functions
@@ -1281,6 +1283,7 @@ void igt_set_module_param_int(const char *name, int val)
 	igt_set_module_param(name, str);
 }
 
+#ifdef HAVE_PROCPS
 /**
  * igt_terminate_process:
  * @sig: Signal to send
@@ -1317,7 +1320,18 @@ int igt_terminate_process(int sig, const char *comm)
 	closeproc(proc);
 	return err;
 }
+#else /* HAVE_PROCPS */
+#warning "No procps, using naive implementatio of igt_terminate_process"
 
+int igt_terminate_process(int sig, const char *comm)
+{
+	char pkill_cmd[NAME_MAX];
+	snprintf(pkill_cmd, sizeof(pkill_cmd), "pkill -x -%d %s", sig, comm);
+	return system(pkill_cmd);
+}
+#endif /* HAVE_PROCPS */
+
+#ifdef HAVE_PROCPS
 struct pinfo {
 	pid_t pid;
 	const char *comm;
@@ -1531,6 +1545,18 @@ igt_lsof(const char *dpath)
 
 	free(sanitized);
 }
+#else /* HAVE_PROCPS */
+#warning "No procps, using naive implementatio of igt_lsof"
+
+void
+igt_lsof(const char *dpath)
+{
+	char lsof_cmd[NAME_MAX];
+	snprintf(lsof_cmd, sizeof(lsof_cmd), "lsof +d %s", dpath);
+	system(lsof_cmd);
+
+}
+#endif /* HAVE_PROCPS */
 
 static struct igt_siglatency {
 	timer_t timer;
Signature · 6 lines
2.9.3

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

PATCH 5/13 chamelium: Fix build issues on Android

In reply to Arkadiusz Hiler

Makefile.sources are included 1:1 in Android.mk files, and are not parsed by automake. And yet those had some automake conditional logic. Moving it to .am file is enough for now.

Also igt_chamelium.h included config.h without proper "HAVE_CONFIG_H" guard, and the file itself was included unconditionally.

---
 lib/Makefile.am        | 7 +++++++
 lib/Makefile.sources   | 7 -------
 lib/igt.h              | 2 ++
 lib/igt_chamelium.h    | 3 +++
 tests/Makefile.am      | 6 ++++++
 tests/Makefile.sources | 6 ------
 6 files changed, 18 insertions(+), 13 deletions(-)
lib/Makefile.am +7 -0
index c0ddf29..91e72c4 100644
@@ -22,6 +22,13 @@ if !HAVE_LIBDRM_INTEL
         stubs/drm/intel_bufmgr.h
 endif
 
+if HAVE_CHAMELIUM
+lib_source_list +=	 	\
+	igt_chamelium.h		\
+	igt_chamelium.c		\
+	$(NULL)
+endif
+
 AM_CPPFLAGS = -I$(top_srcdir)
 AM_CFLAGS = \
 	    $(CWARNFLAGS) \
lib/Makefile.sources +0 -7
index 6348487..53fdb54 100644
@@ -85,13 +85,6 @@ lib_source_list =	 	\
 	igt_kmod.h		\
 	$(NULL)
 
-if HAVE_CHAMELIUM
-lib_source_list +=	 	\
-	igt_chamelium.h		\
-	igt_chamelium.c		\
-	$(NULL)
-endif
-
 .PHONY: version.h.tmp
 
 # leaving a space here to work around automake's conditionals
lib/igt.h +2 -0
index a97923e..a069deb 100644
@@ -38,7 +38,9 @@
 #include "igt_kms.h"
 #include "igt_pm.h"
 #include "igt_stats.h"
+#ifdef HAVE_CHAMELIUM
 #include "igt_chamelium.h"
+#endif
 #include "instdone.h"
 #include "intel_batchbuffer.h"
 #include "intel_chipset.h"
lib/igt_chamelium.h +3 -0
index f421d83..15f6024 100644
@@ -26,7 +26,10 @@
 #ifndef IGT_CHAMELIUM_H
 #define IGT_CHAMELIUM_H
 
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
+
 #include "igt.h"
 #include <stdbool.h>
 
tests/Makefile.am +6 -0
index 8930c24..f2358d5 100644
@@ -8,6 +8,12 @@ if HAVE_LIBDRM_VC4
     TESTS_progs_M += $(VC4_TESTS_M)
 endif
 
+if HAVE_CHAMELIUM
+TESTS_progs_M += \
+	chamelium \
+	$(NULL)
+endif
+
 if BUILD_TESTS
 test-list.txt: Makefile.sources
 	@echo TESTLIST > $@
tests/Makefile.sources +0 -6
index 7fa9b8f..3f10cd2 100644
@@ -146,12 +146,6 @@ TESTS_progs_M = \
 	meta_test \
 	$(NULL)
 
-if HAVE_CHAMELIUM
-TESTS_progs_M += \
-	chamelium \
-	$(NULL)
-endif
-
 TESTS_progs_XM = \
     gem_concurrent_all \
     $(NULL)
Signature · 6 lines
2.9.3

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

Re: [PATCH i-g-t 05/13] chamelium: Fix build issues on Android

Quoted 2 lines · Arkadiusz Hiler

Also igt_chamelium.h included config.h without proper "HAVE_CONFIG_H" guard, and the file itself was included unconditionally.

I see unconditional config.h inclusion in several other places, is igt_chamelium.h the only file where it causes problems?

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

#13 lore raw

Re: [PATCH i-g-t 05/13] chamelium: Fix build issues on Android

Quoted 6 lines · Petri Latvala
Quoted 2 lines · Arkadiusz Hiler

Also igt_chamelium.h included config.h without proper "HAVE_CONFIG_H" guard, and the file itself was included unconditionally.

I see unconditional config.h inclusion in several other places, is igt_chamelium.h the only file where it causes problems?

Yes that we the reason for this ifdef, but that might have been fixed in other way by different patch as I can't reproduce the error anymore.

I'll drop that from this patch and later we can have one dedicated to adding ifdefs everywhere.

The approach with config_android.h would need that, so that would be good series to do it.

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

PATCH 6/13 tools/Android.mk: Add guc_logger and l3_parity skip list

In reply to Arkadiusz Hiler

Those tools does not build on Android due to "Linux-only" dependencies.

Let's blacklist them for now.

---
 tools/Android.mk | 2 ++
 1 file changed, 2 insertions(+)
tools/Android.mk +2 -0
index 6cdedeb..0602e8c 100644
@@ -59,6 +59,8 @@ bin_PROGRAMS := $(tools_prog_lists)
 
 skip_tools_list := \
     intel_framebuffer_dump \
+    intel_guc_logger \
+    intel_l3_parity \
     intel_reg_dumper \
     intel_vga_read \
     intel_vga_write
Signature · 6 lines
2.9.3

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

PATCH 7/13 tests/Android.mk: Add perf to skip list

In reply to Arkadiusz Hiler

It does not build on Android with top libdrm.

Temporary hax.

---
 tests/Android.mk | 1 +
 1 file changed, 1 insertion(+)
tests/Android.mk +1 -0
index 3186a2a..c67ddbd 100644
@@ -59,6 +59,7 @@ else
     pm_lpsp \
 	drm_read \
 	gem_exec_blt \
+	perf \
 	prime_mmap_kms
 
 # All kms tests depend on cairo
Signature · 6 lines
2.9.3

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

PATCH 8/13 benchmarks/Android.mk: Add gem_latency to skip list

In reply to Arkadiusz Hiler

AOSP, as of this commit, does not include libdrm with fence defines.

---
 benchmarks/Android.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
benchmarks/Android.mk +3 -1
index c0fa09f..a790ec7 100644
@@ -34,7 +34,9 @@ endef
 
 #================#
 
-benchmark_list := $(benchmarks_prog_list)
+skip_benchmark_list = gem_latency
+
+benchmark_list := $(filter-out $(skip_benchmark_list),$(benchmarks_prog_list))
 
 ifeq ($(HAVE_LIBDRM_INTEL),true)
     benchmark_list += $(LIBDRM_INTEL_BENCHMARKS)
Signature · 6 lines
2.9.3

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

Re: [PATCH i-g-t 08/13] benchmarks/Android.mk: Add gem_latency to skip list

Quoted 1 line · Arkadiusz Hiler

AOSP, as of this commit, does not include libdrm with fence defines.

Pushed local defines that should keep the benchmark happy.

Please do reset the configure libdrm requirements to what is available on min(Android, debian stable). They should be our compile targets. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

Re: [PATCH i-g-t 08/13] benchmarks/Android.mk: Add gem_latency to skip list

Quoted 8 lines · Chris Wilson
Quoted 1 line · Arkadiusz Hiler

AOSP, as of this commit, does not include libdrm with fence defines.

Pushed local defines that should keep the benchmark happy.

Please do reset the configure libdrm requirements to what is available on min(Android, debian stable). They should be our compile targets. -Chris

Series rebased (sans this patch) cleanly on current master.

Everything compiles just fine :-)

Thanks!

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

PATCH 9/13 Android.mk: Fix libkmod use

In reply to Arkadiusz Hiler

On Android libkmod.h is nested under libkmod directory, so we should include appropriately.

Also we need to link with it.

---
 benchmarks/Android.mk | 2 ++
 lib/Android.mk        | 1 +
 lib/igt_kmod.h        | 4 ++++
 tests/Android.mk      | 4 ++--
 tools/Android.mk      | 2 ++
 5 files changed, 11 insertions(+), 2 deletions(-)
benchmarks/Android.mk +2 -0
index a790ec7..fa9eec6 100644
@@ -18,6 +18,7 @@ define add_benchmark
     LOCAL_CFLAGS += -Wno-error=return-type
     # Excessive complaining for established cases. Rely on the Linux version warnings.
     LOCAL_CFLAGS += -Wno-sign-compare
+    LOCAL_LDFLAGS += -lkmod
 
     LOCAL_MODULE := $1_benchmark
     LOCAL_MODULE_TAGS := optional
@@ -26,6 +27,7 @@ define add_benchmark
     LOCAL_STATIC_LIBRARIES := libintel_gpu_tools
 
     LOCAL_SHARED_LIBRARIES := libpciaccess  \
+                              libkmod       \
                               libdrm        \
                               libdrm_intel
 
lib/Android.mk +1 -0
index eb72f84..0596e4a 100644
@@ -29,6 +29,7 @@ LOCAL_CFLAGS += -std=gnu99 -UNDEBUG
 LOCAL_MODULE:= libintel_gpu_tools
 
 LOCAL_SHARED_LIBRARIES := libpciaccess  \
+			  libkmod       \
 			  libdrm        \
 			  libdrm_intel
 
lib/igt_kmod.h +4 -0
index fd307a4..6a7584f 100644
@@ -24,7 +24,11 @@
 #ifndef IGT_KMOD_H
 #define IGT_KMOD_H
 
+#ifdef ANDROID
+#include <libkmod/libkmod.h>
+#else
 #include <libkmod.h>
+#endif
 
 #include "igt_aux.h"
 
tests/Android.mk +2 -2
index c67ddbd..b664dff 100644
@@ -19,7 +19,7 @@ define add_test
 
     LOCAL_MODULE_TAGS := optional
     # ask linker to define a specific symbol; we use this to identify IGT tests
-    LOCAL_LDFLAGS := -Wl,--defsym=$2=0
+    LOCAL_LDFLAGS := -Wl,--defsym=$2=0 -lkmod
     LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/intel/validation/core/igt
 
     include $(BUILD_EXECUTABLE)
@@ -45,7 +45,7 @@ IGT_LOCAL_C_INCLUDES += ${ANDROID_BUILD_TOP}/external/PRIVATE/drm/include/drm
 
 # set local libraries
 IGT_LOCAL_STATIC_LIBRARIES := libintel_gpu_tools
-IGT_LOCAL_SHARED_LIBRARIES := libpciaccess libdrm libdrm_intel
+IGT_LOCAL_SHARED_LIBRARIES := libpciaccess libkmod libdrm libdrm_intel
 
 # handle cairo requirements if it is enabled
 ifeq ("${ANDROID_HAS_CAIRO}", "1")
tools/Android.mk +2 -0
index 0602e8c..a8e649b 100644
@@ -23,6 +23,7 @@ define add_tool
     LOCAL_CFLAGS += -Wno-error=return-type
     # Excessive complaining for established cases. Rely on the Linux version warnings.
     LOCAL_CFLAGS += -Wno-sign-compare
+    LOCAL_LDFLAGS += -lkmod
     ifeq ($($(1)_LDFLAGS),)
     else
         LOCAL_LDFLAGS += $($(1)_LDFLAGS)
@@ -38,6 +39,7 @@ define add_tool
     LOCAL_STATIC_LIBRARIES := libintel_gpu_tools
 
     LOCAL_SHARED_LIBRARIES := libpciaccess  \
+                              libkmod       \
                               libdrm        \
                               libdrm_intel
 
Signature · 6 lines
2.9.3

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

PATCH 10/13 Android.mk: Filter out *.h from src files

In reply to Arkadiusz Hiler

Newer Android's build system complains about unused files if we leave those there.

---
 lib/Android.mk   | 2 +-
 tools/Android.mk | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
lib/Android.mk +1 -1
index 0596e4a..003ade5 100644
@@ -45,7 +45,7 @@ skip_lib_list := \
     -DANDROID_HAS_CAIRO=0
 endif
 
-LOCAL_SRC_FILES := $(filter-out $(skip_lib_list),$(lib_source_list))
+LOCAL_SRC_FILES := $(filter-out %.h $(skip_lib_list),$(lib_source_list))
 
 include $(BUILD_STATIC_LIBRARY)
 
tools/Android.mk +1 -1
index a8e649b..0bad29c 100644
@@ -12,7 +12,7 @@ define add_tool
     ifeq ($($(1)_SOURCES),)
         LOCAL_SRC_FILES := $1.c
     else
-        LOCAL_SRC_FILES := $($(1)_SOURCES)
+        LOCAL_SRC_FILES := $(filter-out %.h,$($(1)_SOURCES))
     endif
 
     LOCAL_CFLAGS += -DHAVE_TERMIOS_H
Signature · 6 lines
2.9.3

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

PATCH 11/13 Android.mk: Use drm stubs

In reply to Arkadiusz Hiler

Use drm stubs that sit under lib/stubs.

Also drop strange, nonexistent additions to LOCAL_C_INCLUDES.

---
 benchmarks/Android.mk | 3 ++-
 demos/Android.mk      | 3 ++-
 lib/Android.mk        | 4 ++--
 lib/tests/Android.mk  | 4 ++--
 tests/Android.mk      | 4 ++--
 tools/Android.mk      | 2 +-
 6 files changed, 11 insertions(+), 9 deletions(-)
benchmarks/Android.mk +2 -1
index fa9eec6..a4f1858 100644
@@ -10,7 +10,8 @@ define add_benchmark
 
     LOCAL_SRC_FILES := $1.c
 
-    LOCAL_C_INCLUDES = ${IGT_LOCAL_C_INCLUDES}
+    LOCAL_C_INCLUDES = ${IGT_LOCAL_C_INCLUDES} \
+                       $(LOCAL_PATH)/../lib/stubs/drm/
     LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM
     LOCAL_CFLAGS += -DANDROID -UNDEBUG -include "check-ndebug.h"
     LOCAL_CFLAGS += -std=gnu99
demos/Android.mk +2 -1
index 90d8b37..1f50fdc 100644
@@ -16,7 +16,8 @@ LOCAL_CFLAGS += -std=gnu99
 # Excessive complaining for established cases. Rely on the Linux version warnings.
 LOCAL_CFLAGS += -Wno-sign-compare
 
-LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib
+LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib \
+                   $(LOCAL_PATH)/../lib/stubs/drm/
 
 LOCAL_MODULE := intel_sprite_on
 
lib/Android.mk +2 -2
index 003ade5..31f88be 100644
@@ -17,8 +17,8 @@ LOCAL_GENERATED_SOURCES :=       \
 	$(IGT_LIB_PATH)/version.h  \
 	$(GPU_TOOLS_PATH)/config.h
 
-LOCAL_C_INCLUDES +=              \
-	$(LOCAL_PATH)/..
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/.. \
+                    $(LOCAL_PATH)/stubs/drm/
 
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
 
lib/tests/Android.mk +2 -2
index 026f17f..bbbd4d8 100644
@@ -30,8 +30,8 @@ IGT_LOCAL_CFLAGS += -std=gnu99
 IGT_LOCAL_CFLAGS += -Wno-error=return-type
 
 # set local includes
-IGT_LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib
-IGT_LOCAL_C_INCLUDES += ${ANDROID_BUILD_TOP}/external/PRIVATE/drm/include/drm
+IGT_LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib \
+                       $(LOCAL_PATH)/../lib/stubs/drm/
 
 # set local libraries
 IGT_LOCAL_STATIC_LIBRARIES := libintel_gpu_tools
tests/Android.mk +2 -2
index b664dff..c6e966f 100644
@@ -40,8 +40,8 @@ IGT_LOCAL_CFLAGS += -Wno-error=return-type
 IGT_LOCAL_CFLAGS += -Wno-sign-compare
 
 # set local includes
-IGT_LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib
-IGT_LOCAL_C_INCLUDES += ${ANDROID_BUILD_TOP}/external/PRIVATE/drm/include/drm
+IGT_LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib \
+                       $(LOCAL_PATH)/../lib/stubs/drm/
 
 # set local libraries
 IGT_LOCAL_STATIC_LIBRARIES := libintel_gpu_tools
tools/Android.mk +1 -1
index 0bad29c..5653572 100644
@@ -30,7 +30,7 @@ define add_tool
     endif
 
     LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib
-    LOCAL_C_INCLUDES += ${ANDROID_BUILD_TOP}/external/PRIVATE/drm/include/drm
+    LOCAL_C_INCLUDES += $(LOCAL_PATH)/../lib/stubs/drm/
     LOCAL_C_INCLUDES += ${ANDROID_BUILD_TOP}/external/zlib
 
     LOCAL_MODULE := $1_tool
Signature · 6 lines
2.9.3

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

PATCH 12/13 tools/Android.mk: Fix zlib inclusion

In reply to Arkadiusz Hiler

Add dependency on libz instead of doing path magic.

---
 tools/Android.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/Android.mk +4 -4
index 5653572..96075c9 100644
@@ -29,9 +29,8 @@ define add_tool
         LOCAL_LDFLAGS += $($(1)_LDFLAGS)
     endif
 
-    LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib
-    LOCAL_C_INCLUDES += $(LOCAL_PATH)/../lib/stubs/drm/
-    LOCAL_C_INCLUDES += ${ANDROID_BUILD_TOP}/external/zlib
+    LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib \
+                       $(LOCAL_PATH)/../lib/stubs/drm/
 
     LOCAL_MODULE := $1_tool
     LOCAL_MODULE_TAGS := optional
@@ -41,7 +40,8 @@ define add_tool
     LOCAL_SHARED_LIBRARIES := libpciaccess  \
                               libkmod       \
                               libdrm        \
-                              libdrm_intel
+                              libdrm_intel \
+                              libz
 
     # Tools dir on host
     LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/$(LOCAL_TOOLS_DIR)
Signature · 6 lines
2.9.3

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

PATCH 13/13 tests/gem_exec_nop: Disable headless subtest on cairoless Android

In reply to Arkadiusz Hiler

Currently whole igt_kms.c is disabled while compiling on Android without cairo, so this tests does not compile.

There should be cleaner a way to disable only cairo dependant parts which should allow us to enable at least some of the KMS tests, but that's a bigger rework for another time.

---
 lib/Android.mk       | 1 +
 tests/gem_exec_nop.c | 4 ++++
 2 files changed, 5 insertions(+)
lib/Android.mk +1 -0
index 31f88be..dc538b8 100644
@@ -38,6 +38,7 @@ ifeq ("${ANDROID_HAS_CAIRO}", "1")
     LOCAL_C_INCLUDES += $(ANDROID_BUILD_TOP)/external/cairo-1.12.16/src
     LOCAL_CFLAGS += -DANDROID_HAS_CAIRO=1 -DIGT_DATADIR=\".\" -DIGT_SRCDIR=\".\"
 else
+
 skip_lib_list := \
     igt_kms.c \
     igt_kms.h \
tests/gem_exec_nop.c +4 -0
index 66c2fc1..967caef 100644
@@ -138,6 +138,7 @@ stable_nop_on_ring(int fd, uint32_t handle, unsigned int engine,
 	return n;
 }
 
+#if (!defined(ANDROID)) || (defined(ANDROID) && ANDROID_HAS_CAIRO)
 #define assert_within_epsilon(x, ref, tolerance) \
         igt_assert_f((x) <= (1.0 + tolerance) * ref && \
                      (x) >= (1.0 - tolerance) * ref, \
@@ -178,6 +179,7 @@ static void headless(int fd, uint32_t handle)
 	/* check that the two execution speeds are roughly the same */
 	assert_within_epsilon(n_headless, n_display, 0.1f);
 }
+#endif
 
 static bool ignore_engine(int fd, unsigned engine)
 {
@@ -561,8 +563,10 @@ igt_main
 	igt_subtest("context-sequential")
 		sequential(device, handle, FORKED | CONTEXT, 150);
 
+#if (!defined(ANDROID)) || (defined(ANDROID) && ANDROID_HAS_CAIRO)
 	igt_subtest("headless")
 		headless(device, handle);
+#endif
 
 	igt_fixture {
 		igt_stop_hang_detector();
Signature · 6 lines
2.9.3

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

Re: [PATCH i-g-t 13/13] tests/gem_exec_nop: Disable headless subtest on cairoless Android

Quoted 30 lines · Arkadiusz Hiler

Currently whole igt_kms.c is disabled while compiling on Android without cairo, so this tests does not compile.

There should be cleaner a way to disable only cairo dependant parts which should allow us to enable at least some of the KMS tests, but that's a bigger rework for another time.

---
 lib/Android.mk       | 1 +
 tests/gem_exec_nop.c | 4 ++++
 2 files changed, 5 insertions(+)
lib/Android.mk +1 -0
index 31f88be..dc538b8 100644
@@ -38,6 +38,7 @@ ifeq ("${ANDROID_HAS_CAIRO}", "1")
     LOCAL_C_INCLUDES += $(ANDROID_BUILD_TOP)/external/cairo-1.12.16/src
     LOCAL_CFLAGS += -DANDROID_HAS_CAIRO=1 -DIGT_DATADIR=\".\" -DIGT_SRCDIR=\".\"
 else
+
 skip_lib_list := \
     igt_kms.c \
     igt_kms.h \
tests/gem_exec_nop.c +0 -0
index 66c2fc1..967caef 100644

tests/gem_exec_nop.c stable_nop_on_ring(int fd, uint32_t handle, unsigned int engine, · line 141

Quoted 4 lines
tests/gem_exec_nop.c +1 -0
@@ -138,6 +138,7 @@ stable_nop_on_ring(int fd, uint32_t handle, unsigned int engine,
 	return n;
 }
 
+#if (!defined(ANDROID)) || (defined(ANDROID) && ANDROID_HAS_CAIRO)

Tautological check for ANDROID being defined. Is it too confusing to reduce this to

#if !defined(ANDROID) || ANDROID_HAS_CAIRO

Quoted 12 lines
tests/gem_exec_nop.c +1 -0
 #define assert_within_epsilon(x, ref, tolerance) \
         igt_assert_f((x) <= (1.0 + tolerance) * ref && \
                      (x) >= (1.0 - tolerance) * ref, \
@@ -178,6 +179,7 @@ static void headless(int fd, uint32_t handle)
 	/* check that the two execution speeds are roughly the same */
 	assert_within_epsilon(n_headless, n_display, 0.1f);
 }
+#endif
 
 static bool ignore_engine(int fd, unsigned engine)
 {

tests/gem_exec_nop.c igt_main · line 566

Quoted 4 lines
tests/gem_exec_nop.c +1 -0
@@ -561,8 +563,10 @@ igt_main
 	igt_subtest("context-sequential")
 		sequential(device, handle, FORKED | CONTEXT, 150);
 
+#if (!defined(ANDROID)) || (defined(ANDROID) && ANDROID_HAS_CAIRO)

Likewise.

--
Petri Latvala

Quoted 13 lines
tests/gem_exec_nop.c +1 -0
 	igt_subtest("headless")
 		headless(device, handle);
+#endif
 
 	igt_fixture {
 		igt_stop_hang_detector();
Signature · 6 lines
2.9.3

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

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

#25 lore raw

Re: [PATCH i-g-t 13/13] tests/gem_exec_nop: Disable headless subtest on cairoless Android

Quoted 34 lines · Petri Latvala
Quoted 33 lines · Arkadiusz Hiler

Currently whole igt_kms.c is disabled while compiling on Android without cairo, so this tests does not compile.

There should be cleaner a way to disable only cairo dependant parts which should allow us to enable at least some of the KMS tests, but that's a bigger rework for another time.

---
 lib/Android.mk       | 1 +
 tests/gem_exec_nop.c | 4 ++++
 2 files changed, 5 insertions(+)
lib/Android.mk +1 -0
index 31f88be..dc538b8 100644
@@ -38,6 +38,7 @@ ifeq ("${ANDROID_HAS_CAIRO}", "1")
     LOCAL_C_INCLUDES += $(ANDROID_BUILD_TOP)/external/cairo-1.12.16/src
     LOCAL_CFLAGS += -DANDROID_HAS_CAIRO=1 -DIGT_DATADIR=\".\" -DIGT_SRCDIR=\".\"
 else
+
 skip_lib_list := \
     igt_kms.c \
     igt_kms.h \
tests/gem_exec_nop.c +0 -0
index 66c2fc1..967caef 100644
@@ -138,6 +138,7 @@ stable_nop_on_ring(int fd, uint32_t handle, unsigned int engine,
 	return n;
 }
 
Quoted 6 lines

tests/gem_exec_nop.c stable_nop_on_ring(int fd, uint32_t handle, unsigned int engine, · line 141

Quoted 1 line
tests/gem_exec_nop.c +1 -0
+#if (!defined(ANDROID)) || (defined(ANDROID) && ANDROID_HAS_CAIRO)

Tautological check for ANDROID being defined. Is it too confusing to reduce this to

#if !defined(ANDROID) || ANDROID_HAS_CAIRO

Indeed, thanks.

Signature · 2 lines
Cheers,
Arek
Quoted 23 lines
Quoted 12 lines
tests/gem_exec_nop.c +1 -0
 #define assert_within_epsilon(x, ref, tolerance) \
         igt_assert_f((x) <= (1.0 + tolerance) * ref && \
                      (x) >= (1.0 - tolerance) * ref, \
@@ -178,6 +179,7 @@ static void headless(int fd, uint32_t handle)
 	/* check that the two execution speeds are roughly the same */
 	assert_within_epsilon(n_headless, n_display, 0.1f);
 }
+#endif
 
 static bool ignore_engine(int fd, unsigned engine)
 {

tests/gem_exec_nop.c igt_main · line 566

Quoted 4 lines
tests/gem_exec_nop.c +1 -0
@@ -561,8 +563,10 @@ igt_main
 	igt_subtest("context-sequential")
 		sequential(device, handle, FORKED | CONTEXT, 150);
 
+#if (!defined(ANDROID)) || (defined(ANDROID) && ANDROID_HAS_CAIRO)

Likewise.

Quoted 20 lines

--
Petri Latvala

Quoted 13 lines
tests/gem_exec_nop.c +1 -0
 	igt_subtest("headless")
 		headless(device, handle);
+#endif
 
 	igt_fixture {
 		igt_stop_hang_detector();
Signature · 6 lines
2.9.3

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

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