1008 Commits

Author SHA1 Message Date
Daniel Stone
668c053e6a lib/igt.cocci: De-opencode ioctls
Use do_ioctl and do_ioctl_err where possible.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-10-07 17:57:26 +01:00
Daniel Stone
c8cec6b885 lib/drmtest: Add do_ioctl_err to expect failure
do_ioctl demands that the ioctl returns success; add a variant named
do_ioctl_err, which expects the ioctl to fail, and demands a particular
result.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-10-07 17:57:26 +01:00
Daniel Stone
31821fce59 lib/igt.cocci: Add greater-than to igt_assert_lt*
Change m >= n patterns to igt_assert_lte(n, m), and ditto for strict
greater-than.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-10-07 17:57:26 +01:00
Daniel Stone
6ead44d70b lib/igt_core: Add igt_assert_fd
Skip open-coding and assert that fds are valid.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-10-07 17:57:26 +01:00
Daniel Stone
715a17bb35 lib/igt_core: Add igt_assert_neq_*() variants
Similar to igt_assert_eq_*(), add variants for non-equality of types
other than int.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-10-07 17:57:26 +01:00
Daniel Vetter
c9112dca9e lib/core: Fix docs for igt_assert_lt(e)
Logical negation is hard.

v2: The second integer isn't plural (Daniel).

Cc: "Morton, Derek J" <derek.j.morton@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-10-07 18:24:54 +02:00
Thomas Wood
93f1250013 lib: fix fopen mode in igt_debugfs_search
Reported-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-25 09:42:42 +01:00
Thomas Wood
6c89204da7 lib: add igt_debugfs_search
Add igt_debugfs_search to search each line in a debugfs file for a
specified substring.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-24 14:24:18 +01:00
Thomas Wood
2442f595d2 lib/tests: explicitly raise SIGSEGV
Dereferencing a NULL pointer is undefined behaviour and may not always
result in a segmentation fault. Explicitly raise the SIGSEGV signal to
test handling of this signal.

v2: include signal.h (Derek Morton)

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-24 14:23:44 +01:00
Thomas Wood
982934625a lib: allow wildcard matching when specifying subtests
This allows multiple subtests to be specified using standard wildcard
characters when using the --run-subtest command line option.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-17 12:41:35 +01:00
Micah Fedke
f91e93fa40 lib: remove support for deprecated drm_open_any*() calls
Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-11 14:39:43 +01:00
Micah Fedke
c81d293aed convert drm_open_any*() calls to drm_open_driver*(DRIVER_INTEL) calls with cocci
Apply the new API to all call sites within the test suite using the following
semantic patch:

// Semantic patch for replacing drm_open_any* with arch-specific drm_open_driver* calls
@@
identifier i =~ "\bdrm_open_any\b";
@@
- i()
+ drm_open_driver(DRIVER_INTEL)

@@
identifier i =~ "\bdrm_open_any_master\b";
@@
- i()
+ drm_open_driver_master(DRIVER_INTEL)

@@
identifier i =~ "\bdrm_open_any_render\b";
@@
- i()
+ drm_open_driver_render(DRIVER_INTEL)

@@
identifier i =~ "\b__drm_open_any\b";
@@
- i()
+ __drm_open_driver(DRIVER_INTEL)

Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-11 14:39:43 +01:00
Micah Fedke
e2241805a4 lib: adding drm_open_driver() interface
The drm_open_driver*() functions replace the drm_open_any*() functions and
provide the same utility, but in a way that is platform agnostic, not
intel-specific.  This opens the path for adopting intel-gpu-tools to non-intel
platforms.

This commit renames the calls and adds the chipset parameter which can be used
to restrict the opening to a specific hardware family.  For example,
drm_open_driver(DRIVER_INTEL) will only return a valid fd if an intel GPU is
found on the system, along with performing intel-specific initialization stuff
like gem_quiescent_gpu(), et al.  If OPEN_ANY_GPU is specified, the first
available drm device of any type will be opened.

Other hardware type flags may be added in the future.

The drm_open_any*() calls are retained as aliases of
drm_open_driver*(OPEN_ANY_GPU) but will be removed in a subsequent patch.

Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-11 14:39:43 +01:00
Thomas Wood
2bacd07eb3 lib: don't use igt_warn in signal handlers
igt_wan and other log functions are not async-signal safe, so should not
be used in signal handlers.

Reported-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-11 14:39:43 +01:00
Thomas Wood
1dcace3018 build: fix unused-result warnings
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-08 16:15:16 +01:00
Thomas Wood
f0381d1abe lib: various documentation fixes
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-08 16:15:16 +01:00
Thomas Wood
88cbb41ade lib/gpgpu_fill.c: fix file permissions
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-25 17:20:14 +01:00
Thomas Wood
05f5e16eaf lib: fix distcheck issues
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-21 14:13:16 +01:00
Thomas Wood
804e11f40d lib: add a single include header
Add a header that includes all the headers for the library. This allows
reorganisation of the library without affecting programs using it and
also simplifies the headers that need to be included to use the library.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-21 09:37:10 +01:00
Paulo Zanoni
9113c9aa9b lib/igt_draw: break if we already wrote every pixel
Due to the nature of accessing a tiled buffer in an untiled way, we
used to loop through the whole buffer all the time. Add a small
mechanism to just break in case we know we already wrote every pixel
we should have written.

On kms_frontbuffer_tracknig/fbc-2p-primscrn-pri-shrfb-draw-pwrite
(with a 3200x1800 primary screen and a 1920x1080 secondary screen), I
could reduce the runtime from ~7.53s to ~6.01s.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:28:27 -03:00
Paulo Zanoni
9194f4efdf lib/igt_draw: fix pwrite_tiled()
Don't forget to flush in case we're in the last iteration of the loop.
This fixes failures of kms_frontbuffer_tracking when used with
--use-small-modes on eDP monitors.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:28:07 -03:00
Paulo Zanoni
caaf3b869f lib/igt_draw: add support for RGB565 and XRGB2101010
We need to test those pixel formats on the FBC code, so let's make
sure the drawing library works on them first.

v2: Update the gtkdoc (Daniel).

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:27:19 -03:00
Paulo Zanoni
a1fce7490c lib/igt_core: use print("%s", #expr) instead of print(#expr)
If I have a program with the following:

    igt_skip_on(i % 2 == 0);
    igt_skip_on_f(i % 2 == 0, "i:%d\n", i);
    igt_require(i % 2 == 0);
    igt_require_f(i % 2 == 0, "i:%d\n", i);

then I'll get compiler error messages complaining about format
conversions related to the '%' character used in the mod operation. So
put the whole string as a %s argument to avoid interpreting '%' and
any other possible chars.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:26:28 -03:00
Chris Wilson
8af62be2ad lib: Allow caller to use uint64_t sizes with intel_require_memory()
Allow the caller to ask how many extra large objects can be created and
still fit into memory.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-14 14:07:43 +01:00
Arun Siluvery
dd82494724 lib/rendercopy_gen9: Setup Push constant pointer before sending BTP commands
From Gen9, by default push constant command is not committed to the shader unit
untill the corresponding shader's BTP_* command is parsed. This is the
behaviour when set shader is enabled. This patch updates the batch to follow
this requirement otherwise it results in gpu hang.

Set shader need to be disabled if legacy behaviour is required.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89959
Cc: Ben Widawsky <benjamin.widawsky@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Arun Siluvery <arun.siluvery@linux.intel.com>
Tested-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2015-08-13 15:20:19 +03:00
Mika Kuoppala
8a68ec1453 lib/rendercopy_gen9: WaBindlessSurfaceStateModifyEnable
Don't set the size of bindless surface state on rendercopy.
And as of doing so, take into account the workaround for setting
the command size.

This was tried during hunting for
https://bugs.freedesktop.org/show_bug.cgi?id=89959. But no
impact was found.

Cc: Arun Siluvery <arun.siluvery@linux.intel.com>
Reviewed-by: Arun Siluvery <arun.siluvery@linux.intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2015-08-13 15:17:19 +03:00
Derek Morton
d524a964fc benckmarks/Android.mk: Fix building benchmarks for Android
The commit "benchmarks: Do not install to system-wide bin/" changed
the benchmark file list from bin_PROGRAMS to benchmarks_PROGRAMS.
However Android.mk was not updated, resulting in IGT failing to
build for Android.
This commit adds that change. It also adds LOCAL_MODULE_PATH to
specify where the built benchmarks should be put.

v2: I discovered that the existing definitions of LOCAL_MODULE_PATH
were creating what should have been an invalid path. Not sure how it
was ever working previously, but fixed now.

Signed-off-by: Derek Morton <derek.j.morton@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-13 11:28:22 +01:00
Daniel Vetter
5b0a8433fd lib/core: Add igt_reset_timeout
Convenience wrapper suggested by Chris for igt_set_timeout(0, NULL).

v2: While at it add an empty line in kms_flip to make
set/reset_timeout a visual block.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-08-12 14:46:46 +02:00
Daniel Vetter
370c989723 lib/core: Add optional reason for timeout failure
"Timed out" isn't a terribly informative message, allow users to set
something more informative. Inspired by a request from Jesse.

Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-08-12 14:46:40 +02:00
David Weinehall
24617ef82a tests/gem_ctx_param_basic: support NO_ZEROMAP
Signed-off-by: David Weinehall <david.weinehall@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-08-12 14:42:46 +02:00
Paulo Zanoni
995f2738ad lib: add igt_debugfs_read()
A helpful function for when you want to read a whole debugfs file to a
string and don't want to worry about opening and closing file
descriptors and asserting buffer sizes.

We've been using this already for kms_frontbuffer_tracking and
kms_fbcon_fbt, so the only test with new code here is kms_fbc_crc.

Also notice that for kms_fbc_crc we had to increase the buffer size
since the file can sometimes be bigger than 64 bytes - depending on
the reason why FBC is disabled.

Of course, there are probably many other programs we can patch, but
I'm not doing this now.

v2: Add the macro to wrap sizeof() (Daniel).
v3: Add documentation for the macro too (Daniel).

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-05 17:30:58 -03:00
Chris Wilson
40ebf95163 igt/gem_streaming_writes: Bind into the GTT early
If we are using a streaming GGTT write into the source, we need to
trigger an early fault in order to obtain a mappable offset. This is
required when later we start reserving execbuf object top-down to try
and avoid mappable space!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-28 19:01:41 +01:00
Chris Wilson
b7c33e0939 benchmarks: Benchmarkify gem_exec_nop
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-22 15:14:05 +01:00
Dominik Zeromski
3676912970 lib/gpgpu_fill: Add SKL support
SKL changed state base address command.

Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Dominik Zeromski <dominik.zeromski@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-07-20 18:13:37 +01:00
Dominik Zeromski
a017c2905a lib/gpgpu_fill: Add BDW support
BDW changed structure of surface state and interface descriptors.
Commands like state base address, gpgpu walker were extended.

Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Dominik Zeromski <dominik.zeromski@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-07-20 18:13:37 +01:00
Dominik Zeromski
ed816d560c lib: Move gpgpu_fill code to separate file
The gpgpu fill utility functions are used in separate test so it's
logical to keep them in separate file. This is similar to what media
spin test did in the past.

Functionally only gpgpu kernel changed. Send instruction payload size
was reduced. Since offset is incremented by 0x10 bytes there is no point
in using larger writes.

Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Dominik Zeromski <dominik.zeromski@intel.com>
[Thomas: Fix typo of gpgpu_fill.h in Makefile.sources]
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-07-20 18:13:37 +01:00
Thomas Wood
e65c69b995 lib: exit immediately if igt_fail is called in an exit handler
Exit immediately if the test is already exiting and igt_fail is called.
This can happen if an igt_assert fails in an exit handler.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91349
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-07-20 18:13:37 +01:00
Chris Wilson
0705ce6d15 igt/stats: Fixup tests to compile after interface changes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-19 18:19:29 +01:00
Chris Wilson
8506cdcaa5 lib: Allow storing floating point values in igt_stats
We don't always have precise integers with which to store, so allow
degrading to double precision floating point based on available input.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-19 15:30:23 +01:00
Paulo Zanoni
4deb562659 configure: require libdrm >= 2.4.55
And drop the now unnecessary universal plane definitions. The 2.4.55
version is already quite old, so we should be fine.

Thanks to Thomas Wood for quickly spotting this.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@>
2015-07-14 12:52:09 -03:00
Damien Lespiau
ec9e5996d1 build: Don't use automake's conditional in a Makefile.sources
I just remembered that those Makefile.sources files where also
included by the Android build system, so we can't use automake's
conditionals in there.

So, we want to use GNU make's one. Unfortunately, after all those years,
GNU automake still doesn't do anything useful with GNU make's ifeq:

  lib/Makefile.sources:66: error: else without if

automake will helpfully signal that the 'else' corresponding to the
'ifeq' doesn't have a corresponding 'if'. Well, yeah, thanks.

Fortunately, we can work around this by cunningly inserting a space
before 'ifeq', 'else' and 'endif' and fool automake's regex-based
checks.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-07-02 15:23:35 +01:00
Damien Lespiau
e5653d5f1d build: Add an option to not use the git hash in version
When developing, it's quite annoying that the version changes every
commit, causing the library to be rebuild and every single binary
re-linked.

Add a config option to skip that.

I remember Ville asking for this "feature" as well.

v2: Option is now called --disable-git-hash (Thomas)
    Various spelling mistakes (Thomas)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-07-02 11:54:12 +01:00
Damien Lespiau
0a01a190f6 build: Add DEBUG_FLAGS to tools and self-tests
Makes using GDB better on those binaries.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-07-02 11:20:42 +01:00
Damien Lespiau
390653acfb aux: Don't evaluate several times the arguments of min() and max()
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-07-02 11:20:42 +01:00
Damien Lespiau
643aab2249 stats: Add wikipedia links to get_trimean() and get_iqm()
Useful knowledge for anyone looking at the documentation and following
the linkes.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-07-02 11:20:42 +01:00
Thomas Wood
d01ebbd97d docs: various documentation fixes
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-07-02 08:17:17 +01:00
Thomas Wood
85f6d82d3c docs: fix "no link" warning
igt_save_module_param is an internal static function and therefore isn't
included in the public API documentation.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-07-02 08:17:17 +01:00
Thomas Wood
5d80872009 docs: override section id to avoid '/' in filenames
The section id is generated from the section title and is used to create
the html output filename, which therefore causes problems if it includes
a '/' character.

Cc: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-07-02 08:17:17 +01:00
Chris Wilson
2d305f6199 stats: Add trimean
https://en.wikipedia.org/wiki/Trimean

	The trimean is a the most efficient 3-point L-estimator (estimator
	of central tendency, i.e. average), even more robust than the
	median at estimating the average of a sample population.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-01 18:58:46 +01:00
Chris Wilson
19135a3447 stats: Add the interquartile mean (IQM)
https://en.wikipedia.org/wiki/Interquartile_mean

	The IQM is a truncated mean and so is very similar to the scoring
	method used in sports that are evaluated by a panel of judges:
	discard the lowest and the highest scores; calculate the mean
	value of the remaining scores.

It's useful to hide outliers in measurements (due to cold cache etc),
without having to worry too much about the actual distribution.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-01 18:58:46 +01:00