Skip to contentSkip to conversation

Remove viral glib dependency

PATCH In review Petri Latvala 5 participants 9 messages Sep 29, 2017 – Oct 2, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Remove viral glib dependency

An adventure that started from a reported build error that was easy to see why it happened, but not as easy to see why it didn't happen on my end.

A user attempted to build IGT with a cairo that was built without glib. That revealed a spot of code that unconditionally used glib headers, making everything in IGT depend on glib headers. Why everything worked was because glib's cflags come with cairo's cflags typically [citation needed]. Fixing that revealed a couple of missing includes that glib.h ended up providing.

Petri Latvala (3):
kms_atomic_interruptible: Add missing #include
gem_exec_schedule: Add missing #include
lib: Reduce dependency on glib

 lib/Makefile.sources             |  1 +
 lib/igt_chamelium.c              |  1 +
 lib/igt_core.c                   |  3 +++
 lib/igt_core.h                   |  2 --
 lib/igt_rc.h                     | 34 ++++++++++++++++++++++++++++++++++
 lib/meson.build                  |  1 +
 tests/gem_exec_schedule.c        |  1 +
 tests/kms_atomic_interruptible.c |  2 ++
 8 files changed, 43 insertions(+), 2 deletions(-)
 create mode 100644 lib/igt_rc.h
Signature · 6 lines
2.14.1

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

PATCH 1/3 kms_atomic_interruptible: Add missing #include

kms_atomic_interruptible used signal() without #include <signal.h>

CC Maarten Lankhorst <[email protected]>
---
 tests/kms_atomic_interruptible.c | 2 ++
 1 file changed, 2 insertions(+)
tests/kms_atomic_interruptible.c +2 -0
index 4e06ee4e..a9f9cb13 100644
@@ -21,6 +21,8 @@
  * IN THE SOFTWARE.
  */
 
+#include <signal.h>
+
 #include "igt.h"
 #include "drmtest.h"
 #include "sw_sync.h"
Signature · 6 lines
2.14.1

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

PATCH 2/3 gem_exec_schedule: Add missing #include

In reply to Petri Latvala

gem_exec_schedule used sigaction() without #include <signal.h>

---
 tests/gem_exec_schedule.c | 1 +
 1 file changed, 1 insertion(+)
tests/gem_exec_schedule.c +1 -0
index 95128420..e3cfffda 100644
@@ -26,6 +26,7 @@
 #include <sys/poll.h>
 #include <sys/ioctl.h>
 #include <sched.h>
+#include <signal.h>
 
 #include "igt.h"
 #include "igt_vgem.h"
Signature · 6 lines
2.14.1

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

Re: [PATCH i-g-t 2/3] gem_exec_schedule: Add missing #include

Quoting Petri Latvala (2017-09-29 11:51:58)

Quoted 4 lines

gem_exec_schedule used sigaction() without #include <signal.h>

And I've probably missed it in a few other files...

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

#4 lore raw

PATCH 3/3 lib: Reduce dependency on glib

In reply to Petri Latvala

In commit ebd6eb69f57b ("Make igtrc configuration common, with configurable suspend/resume delay") .igtrc handling was moved to igt_core from igt_chamelium. That made everything in IGT depend on GLIB by accident.

In short, igt_core.h declared a variable of type GKeyFile*, requiring glib.h. Everything that tried to #include igt_core.h required glib.h to be available, by use of GLIB_CFLAGS. This "worked" so far because CAIRO_CFLAGS contained GLIB_CFLAGS.

As the variable is only used by other stuff in lib/, stuff it in its own header file to leave igt_core.h without a dependency to glib.h.

Also add a couple of missing #ifdef HAVE_GLIBs around.

---
 lib/Makefile.sources |  1 +
 lib/igt_chamelium.c  |  1 +
 lib/igt_core.c       |  3 +++
 lib/igt_core.h       |  2 --
 lib/igt_rc.h         | 34 ++++++++++++++++++++++++++++++++++
 lib/meson.build      |  1 +
 6 files changed, 40 insertions(+), 2 deletions(-)
 create mode 100644 lib/igt_rc.h
lib/Makefile.sources +1 -0
index 53fdb54c..e851f62b 100644
@@ -20,6 +20,7 @@ lib_source_list =	 	\
 	igt_primes.h		\
 	igt_rand.c		\
 	igt_rand.h		\
+	igt_rc.h		\
 	igt_stats.c		\
 	igt_stats.h		\
 	igt_sysfs.c		\
lib/igt_chamelium.c +1 -0
index fb250366..b25855a4 100644
@@ -40,6 +40,7 @@
 #include "igt_aux.h"
 #include "igt_kms.h"
 #include "igt_frame.h"
+#include "igt_rc.h"
 
 /**
  * SECTION:igt_chamelium
lib/igt_core.c +3 -0
index 47b4682d..950ea9b0 100644
@@ -55,7 +55,9 @@
 #include <limits.h>
 #include <locale.h>
 #include <uwildmat/uwildmat.h>
+#ifdef HAVE_GLIB
 #include <glib.h>
+#endif
 
 #include "drmtest.h"
 #include "intel_chipset.h"
@@ -67,6 +69,7 @@
 #include "igt_core.h"
 #include "igt_aux.h"
 #include "igt_sysfs.h"
+#include "igt_rc.h"
 
 #ifdef HAVE_LIBGEN_H
 #include <libgen.h>   /* for basename() on Solaris */
lib/igt_core.h +0 -2
index c90ae2de..f8543d65 100644
@@ -40,7 +40,6 @@
 #include <stdarg.h>
 #include <getopt.h>
 #include <unistd.h>
-#include <glib.h>
 
 #ifndef IGT_LOG_DOMAIN
 #define IGT_LOG_DOMAIN (NULL)
@@ -49,7 +48,6 @@
 
 extern const char* __igt_test_description __attribute__((weak));
 extern bool __igt_plain_output;
-extern GKeyFile *igt_key_file;
 extern char *igt_frame_dump_path;
 
 /**
lib/igt_rc.h new file +34 -0
new file mode 100644
index 00000000..d7a314c5
@@ -0,0 +1,34 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+
+#ifndef IGT_RC_H
+#define IGT_RC_H
+
+#ifdef HAVE_GLIB
+#include <glib.h>
+
+extern GKeyFile *igt_key_file;
+
+#endif /* HAVE_GLIB */
+#endif /* IGT_RC_H */
lib/meson.build +1 -0
index 203be520..54ff4f9b 100644
@@ -13,6 +13,7 @@ lib_headers = [
 	'igt_gvt.h',
 	'igt_primes.h',
 	'igt_rand.h',
+	'igt_rc.h',
 	'igt_stats.h',
 	'igt_sysfs.h',
 	'igt_x86.h',
Signature · 6 lines
2.14.1

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

Re: [PATCH i-g-t 3/3] lib: Reduce dependency on glib

Quoted 10 lines · Petri Latvala

In commit ebd6eb69f57b ("Make igtrc configuration common, with configurable suspend/resume delay") .igtrc handling was moved to igt_core from igt_chamelium. That made everything in IGT depend on GLIB by accident.

In short, igt_core.h declared a variable of type GKeyFile*, requiring glib.h. Everything that tried to #include igt_core.h required glib.h to be available, by use of GLIB_CFLAGS. This "worked" so far because CAIRO_CFLAGS contained GLIB_CFLAGS.

Quoted 7 lines

As the variable is only used by other stuff in lib/, stuff it in its own header file to leave igt_core.h without a dependency to glib.h.

Also add a couple of missing #ifdef HAVE_GLIBs around.

The whole igtrc implementation has plenty of other issues (using asserts in a wrong scope, etc).

I have a bigger rework on my TODO list...

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

Re: [PATCH i-g-t 3/3] lib: Reduce dependency on glib

Quoted 16 lines · Arkadiusz Hiler
Quoted 15 lines · Petri Latvala

In commit ebd6eb69f57b ("Make igtrc configuration common, with configurable suspend/resume delay") .igtrc handling was moved to igt_core from igt_chamelium. That made everything in IGT depend on GLIB by accident.

In short, igt_core.h declared a variable of type GKeyFile*, requiring glib.h. Everything that tried to #include igt_core.h required glib.h to be available, by use of GLIB_CFLAGS. This "worked" so far because CAIRO_CFLAGS contained GLIB_CFLAGS.

As the variable is only used by other stuff in lib/, stuff it in its own header file to leave igt_core.h without a dependency to glib.h.

Also add a couple of missing #ifdef HAVE_GLIBs around.

Quoted 8 lines
Quoted 2 lines

The whole igtrc implementation has plenty of other issues (using asserts in a wrong scope, etc).

I have a bigger rework on my TODO list...

Imo biggest is inversion of control, the core igtrc does all the parsing for all the other bits in igt, which means we leak all the submodule stuff into igt_core.c. Which isn't cool.

Is there a JIRA or similar for this already where I could bikeshed? -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

✓ Fi.CI.BAT: success for Remove viral glib dependency

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: Remove viral glib dependency
URL : https://patchwork.freedesktop.org/series/31163/
State : success

== Summary ==

IGT patchset tested on top of latest successful build cf3e683a3650c18c89a3322c4171e1db94b5b9f8 igt/gem_exec_nop: Measure high-priority throughput over a bg load

with latest DRM-Tip kernel build CI_DRM_3156
496f1cf87464 drm-tip: 2017y-09m-29d-10h-50m-53s UTC integration manifest

Test chamelium:

        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102514
Test gem_exec_suspend:
        Subgroup basic-s3:
                incomplete -> PASS       (fi-kbl-7560u)
Test drv_module_reload:
        Subgroup basic-reload:
                pass       -> DMESG-WARN (fi-glk-1) fdo#102777

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#102777 https://bugs.freedesktop.org/show_bug.cgi?id=102777

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:445s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:477s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:421s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:528s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:281s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:496s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:509s
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:502s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:486s
fi-cfl-s         total:289  pass:256  dwarn:1   dfail:0   fail:0   skip:32  time:555s
fi-cnl-y         total:289  pass:261  dwarn:1   dfail:0   fail:0   skip:27  time:660s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:420s
fi-glk-1         total:289  pass:259  dwarn:1   dfail:0   fail:0   skip:29  time:566s
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:427s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:401s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:433s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:487s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:469s
fi-kbl-7500u     total:289  pass:263  dwarn:1   dfail:0   fail:1   skip:24  time:464s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:582s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:596s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:543s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:457s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:757s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:496s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:477s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:581s
fi-snb-2600      total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:416s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_275/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

✗ Fi.CI.IGT: failure for Remove viral glib dependency

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: Remove viral glib dependency
URL : https://patchwork.freedesktop.org/series/31163/
State : failure

== Summary ==

Test gem_eio:

        Subgroup in-flight:
                pass       -> DMESG-WARN (shard-hsw) fdo#102886 +4
Test kms_flip:
        Subgroup flip-vs-absolute-wf_vblank-interruptible:
                fail       -> PASS       (shard-hsw)
Test prime_mmap:
        Subgroup test_userptr:
                pass       -> DMESG-WARN (shard-hsw) fdo#102939
Test prime_self_import:
        Subgroup reimport-vs-gem_close-race:
                pass       -> FAIL       (shard-hsw) fdo#102655
        Subgroup export-vs-gem_close-race:
                pass       -> FAIL       (shard-hsw)
Test perf:
        Subgroup blocking:
                pass       -> FAIL       (shard-hsw) fdo#102252 +1
Test kms_setmode:
        Subgroup basic:
                fail       -> PASS       (shard-hsw) fdo#99912

fdo#102886 https://bugs.freedesktop.org/show_bug.cgi?id=102886
fdo#102939 https://bugs.freedesktop.org/show_bug.cgi?id=102939
fdo#102655 https://bugs.freedesktop.org/show_bug.cgi?id=102655
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

shard-hsw total:2429 pass:1331 dwarn:3 dfail:0 fail:12 skip:1083 time:10026s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_275/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx