982 Commits

Author SHA1 Message Date
Joonas Lahtinen
d84e62478b lib/igt_core: Prefer CLOCK_MONOTONIC_RAW
CLOCK_MONOTONIC_RAW is not affected by NTP, so it should be THE clock
used for timing execution of tests.

When fetching either the starting or ending time of a test, show the
time as -1.000s.

v6:
- Whitespace corrections (Chris)

v5:
- Do not use C99 style comments (Chris)

v4:
- Introduce time_valid macro (Chris)
- Reduce amount of boilerplate code for calculating elapsed time

v3:
- Do not exit directly from handler (Chris)
- Show elapsed time as -1 if it is not calculable

v2:
- Cache the used clock (Chris)
- Do not change the clock during execution
- Spit out and error if monotonic time can not be read

Cc: Thomas Wood <thomas.wood@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-24 16:36:54 +00:00
Wayne Boyer
4bc68b1baa lib/kbl: Add Kabylake GT4 PCI IDs
Add the Kabylake GT4 PCI IDs as defined in this kernel patch.

    commit 8b10c0cf21ec84618d4bf02c73c0543500ece68d
    Author: Deepak S <deepak.s@intel.com>
    Date:   Wed Oct 28 12:21:12 2015 -0700
        drm/i915/kbl: Add Kabylake GT4 PCI ID

Signed-off-by: Wayne Boyer <wayne.boyer@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-24 16:36:54 +00:00
Wayne Boyer
526a63ec6b lib/kbl: move KBL check from IS_SKYLAKE() to IS_GEN9()
Remove the KBL check from IS_SKYLAKE() following the kernel definition.
Then, add the KBL check to IS_GEN9().

The idea is to avoid confusion.  On the kernel side, the mix of SKY
and KBL was nacked so the platforms are split.

Signed-off-by: Wayne Boyer <wayne.boyer@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-24 16:36:54 +00:00
Chris Wilson
59f076a089 drmtest: Use standard gem_execbuf() calls in gem_quiescent_gpu()
Now that we have better ioctl wrappers, let's make us of them. The
advantage should be in improved error reporting in case
gem_quiescent_gpu() ever fails.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-20 11:25:00 +00:00
Mika Kuoppala
b718f50f92 lib: Add Skylake Intel Graphics GT4 PCI IDs
Add Skylake Intel Graphics GT4 PCI IDs.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
2015-11-19 11:31:51 +02:00
Ville Syrjälä
4d8983bcdf lib/kms: Pass fb_id=0 to setcrtc in kmstest_unset_all_crtcs()
The setcrtc ioctl ignores the fb_id when there's no mode specified.
So passing -1 doens't make much sense. When there is a more, -1 means
to preserve the current fb.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-11-16 15:35:28 +02:00
Thomas Wood
790f1f804b lib: add a environment variable to control output
Disable output of terminal control characters and progress meters when
IGT_PLAIN_OUTPUT is set in the environment.

Cc: Derek Morton <derek.j.morton@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-11 14:52:47 +00:00
Thomas Wood
fca7b1b5fd lib: highlight subtest results on terminals
Make subtest results easier to identify by making them bold when the output
is a terminal.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-11 14:52:47 +00:00
Thomas Wood
2e5a43d296 lib: add documentation for igt_display_init/fini
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-11 14:21:12 +00:00
Thomas Wood
0986b432f8 lib: add PIPE_ANY to the pipe enum
This avoids compiler warnings about invalid enum values.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-11 14:20:55 +00:00
Thomas Wood
36b8143c22 Add missing noreturn attribute to various functions
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-11 14:20:55 +00:00
Chris Wilson
3b0e336081 lib: Add missing #include <stdbool.h>
A forgotten fixup to allow instdone.h to compile.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-09 20:37:52 +00:00
Chris Wilson
70ee508421 lib: Make instdone initialisation fail gracefully
Just report that we don't recognise the chipset rather than explode.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-09 16:57:22 +00:00
Daniel Stone
f735015ed3 lib/tests: Add igt_assert_*() self-tests
Make sure our igt_assert variants are doing something that looks vaguely
like the right thing.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-11-03 19:46:11 +00:00
Ville Syrjälä
8a17af80e0 lib: Skip suspend/hibernate tests if the system doesn't support them
Do a dry run with rtcwake first to determine if the system even supports
the intended suspend state. If not, skip the test.

Fixes a bunch of stuff on my BYT FFRD8 that doesn't support S3.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-10-23 15:40:09 +03:00
Chris Wilson
5ec54d8a21 Update CONTEXT_PARAM for GTT_SIZE reporting
Add the new PARAM identifier for reporting the context's GTT size.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-19 11:37:07 +01:00
Chris Wilson
a22719358d lib: Fix querying context GTT size
We need a new ioctl to find the correct GTT size to use when submitting
execbuffers (as opposed to wishing to know the global GTT size).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-19 11:33:01 +01:00
Rodrigo Vivi
5bc210a5b5 lib/kbl: Add Kabylake PCI IDs
Also, following kernel definition Kabylake is Skylake.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-10-14 15:45:23 +01:00
Ville Syrjälä
f52e7ec787 Replace __gem_mmap__{cpu,gtt,wc}() + igt_assert() with gem_mmap__{cpu,gtt,wc}()
gem_mmap__{cpu,gtt,wc}() already has the assert built in, so replace
 __gem_mmap__{cpu,gtt,wc}() + igt_assert() with it.

Mostly done with coccinelle, with some manual help:
@@
identifier I;
expression E1, E2, E3, E4, E5, E6;
@@
(
-  I = __gem_mmap__gtt(E1, E2, E3, E4);
+  I = gem_mmap__gtt(E1, E2, E3, E4);
...
-  igt_assert(I);
|
-  I = __gem_mmap__cpu(E1, E2, E3, E4, E5);
+  I = gem_mmap__cpu(E1, E2, E3, E4, E5);
...
-  igt_assert(I);
|
-  I = __gem_mmap__wc(E1, E2, E3, E4, E5);
+  I = gem_mmap__wc(E1, E2, E3, E4, E5);
...
-  igt_assert(I);
)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-12 19:57:58 +03:00
Ville Syrjälä
b8a77dd6c8 Make gem_mmap__{cpu,gtt,wc}() assert on failure
Rename the current gem_mmap__{cpu,gtt,wc}() functions into
__gem_mmap__{cpu,gtt,wc}(), and add back wrappers with the original name
that assert that the pointer is valid. Most callers will expect a valid
pointer and shouldn't have to bother with failures.

To avoid changing anything (yet), sed 's/gem_mmap__/__gem_mmap__/g'
over the entire codebase.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09 19:16:26 +03:00
Ville Syrjälä
106fe21373 lib: Die if framebuffer GTT mapping fails
Cairo helpfully allocates a new buffer for us when
cairo_image_surface_create_for_data() is called with a NULL ptr. That
means if gem_mmap__gtt() fails, we get a totally silent failure and
nothing ever drawn into the framebuffer. Very confusing.

Put in an igt_assert() to make sure we managed to mmap something.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09 18:36:24 +03:00
Ville Syrjälä
8986bbc0ce lib: Document that gem_mmap__{cpu,gtt,wc} return NULL on failure
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09 16:59:13 +03:00
Ville Syrjälä
9792e7b580 s/gem_mmap/gem_mmap__gtt/
Get rid of the gem_mmap() alias of gem_mmap__gtt(). I don't see any
point in having it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09 16:47:05 +03:00
Paulo Zanoni
f974422c21 lib/igt_fb: don't forget to close parens on message printed
Restore the anxiety levels back to the normal values.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-10-08 15:00:59 -03:00
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