700 Commits

Author SHA1 Message Date
Imre Deak
2423b6c04e lib/drmtest: fix hang in quiescent_gpu_at_exit due to signal-unsafe asprintf
I got kms_flip in hung state with the backtrace below, while the parent process
waiting for the signal helper to exit. It was quite easy to reproduce the bug
by running

kms_flip --run-subtest=flip-vs-dpms-off-vs-modeset

With the change I couldn't reproduce it.

TODO: audit/fix other signal handlers with signal-unsafe functions

0  0x00007f9a1362018b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
1  0x00007f9a1359df81 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
2  0x00007f9a1359b6cf in ?? () from /lib/x86_64-linux-gnu/libc.so.6
3  0x00007f9a13628eb6 in __vasprintf_chk () from /lib/x86_64-linux-gnu/libc.so.6
4  0x00007f9a13628e72 in __asprintf_chk () from /lib/x86_64-linux-gnu/libc.so.6
5  0x000000000040a4a2 in asprintf (__fmt=0x417441 "/dev/dri/card%u", __ptr=0x7fff1a972c08)
    at /usr/include/x86_64-linux-gnu/bits/stdio2.h:178
6  drm_get_card () at drmtest.c:190
7  0x000000000040a54a in __drm_open_any () at drmtest.c:229
8  0x000000000040a846 in quiescent_gpu_at_exit (sig=<optimized out>) at drmtest.c:281
9  0x0000000000408759 in call_exit_handlers (sig=3) at drmtest.c:1519
10 fatal_sig_handler (sig=3) at drmtest.c:1543
11 <signal handler called>
12 0x00007f9a13596770 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
13 0x00007f9a135d8f3f in fork () from /lib/x86_64-linux-gnu/libc.so.6
14 0x000000000040b3af in __igt_fork_helper (proc=0x61d8cc <signal_helper>) at drmtest.c:1199
15 0x000000000040b4ce in igt_fork_signal_helper () at drmtest.c:751
16 0x0000000000404167 in main (argc=<optimized out>, argv=<optimized out>) at kms_flip.c:1533

v2:
- can't use snprintf as that's also signal-unsafe, so just use a dup'ed fd (Chris,Daniel)

Signed-off-by: Imre Deak <imre.deak@intel.com>
2014-02-05 15:28:45 +02:00
Rafael Barbalho
09bcb0ab4b android: Change tests & tools directory to use the lib directory
Instead of recompiling the lib directory for every tool or tests we can just
re-use the static library. This also has the nice side effect of fixing the
android "mm" command to allow android users to only rebuild the local changes
in either the test or tools directory.

Signed-off-by: Rafael Barbalho <rafael.barbalho@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-04 10:52:15 +00:00
Rafael Barbalho
bdb08f981c android: Add the generation of vesion.h & config.h to lib
The lib directory is used by all the tests & tools so it should really be
the place where the generate files are created.

Signed-off-by: Rafael Barbalho <rafael.barbalho@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-04 10:52:13 +00:00
Rafael Barbalho
005c333e5c android: Add makefile for the lib directory
The lib directory should really be compiled as a static library on its own
and be re-used by any tests or tools that require it.

Signed-off-by: Rafael Barbalho <rafael.barbalho@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-04 10:52:09 +00:00
Rafael Barbalho
79ea9a9071 android: Handle the case when android doesn't have mmap64
Not all versions of Android have the mmap64 call, thus a suitable alternative
must be called.

Signed-off-by: Rafael Barbalho <rafael.barbalho@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-04 10:51:46 +00:00
Chris Wilson
48ad03ca0c lib: Capture errno on entry
When printing the errno, it is important that we capture the user errno
before we make any library calls - as they may alter the value.

References: https://bugs.freedesktop.org/show_bug.cgi?id=74007
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 16:57:17 +00:00
Jesse Barnes
5e21b434da iosf: make iosf_rw take a larger addr
For higher DPIO ranges for example.  Also fix it up to use
intel_register_read/write.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2014-01-28 14:20:22 -08:00
Jesse Barnes
670a717b5b mmio: drop unused i915_loaded fn
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2014-01-28 13:58:23 -08:00
Jesse Barnes
81095305f4 mmio: use intel_iosf.c for DPIO reads and writes
This makes it a bit more like the kernel, so we can go poke at DPIO and
other IOSF regs a bit more easily.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2014-01-28 13:58:01 -08:00
Jesse Barnes
5ecac45ff0 mmio: allow register init even if debugfs isn't available and i915 isn't loaded
This lets us dump regs even if modeset=0 for example.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2014-01-27 10:27:20 -08:00
Daniel Vetter
7d2ba073ad lib: add __gem_create
Useful for when a gem_create ioctl is expected to fail.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-19 22:13:36 +01:00
Daniel Vetter
862de5636f lib: extract igt_drop_root
Useful in other tests.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-19 22:06:48 +01:00
Damien Lespiau
a1baf3050e lib: Use INSTDONE_I965 and INSTDONE_1 for gen6
The GEN6_INSTDONE_1 and GEN6_INSTDONE_2 registers are just the old
INSTDONE_I965 and INSTDONE_1 registers but renamed. Let's use the old
names (this is what the kernel does).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-01-07 16:48:04 +00:00
Damien Lespiau
3ebd8aa95e lib: Move the INSTDONE bit definitions to instdone.c
This is the only place where they are used and we've even started using
1 << n constants with gen 7.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-01-07 16:48:02 +00:00
Damien Lespiau
da78bc497b instdone: Add an assert to make sure we never overflow instdone_bits
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-01-07 16:48:00 +00:00
Damien Lespiau
d8b1dee220 intel_reg: Renamed INST_DONE to INSTDONE
That's how the registers are named in the kernel defines.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-01-07 16:47:33 +00:00
Paulo Zanoni
329faeccf7 drmtest: don't leak memory when parsing the arguments
Found this while investigating memory leaks on kms_flip. Detected by
Valgrind.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2014-01-07 09:57:03 -02:00
Chris Wilson
164d9d26ac kmstest: Fix up lifetimes of cairo objects
cairo_t is the short lived drawing context, whereas cairo_surface_t is
the heavyweight object that persists and is also tied to underlying GEM
objects. So make the kmstest API reflect the different weights and fix
the lifetime and underlying object reference leaks.

Based on the fix by Paulo Zanoni.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-12-31 12:30:30 +00:00
Damien Lespiau
be14c7bb04 lib: Include the necessary stdint.h in gen6_render.h
Instead of assuming someone else will do it.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-12-13 15:04:07 +00:00
Kenneth Graunke
f034817b40 rendercopy/bdw: Fix length of a bunch of zeroed out packets.
A bunch of packets were too short.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Cc: Ben Widawsky <ben@bwidawsk.net>
Cc: Damien Lespiau <damien.lespiau@intel.com>
2013-12-10 11:37:19 +00:00
Kenneth Graunke
fdbdc7f325 rendercopy/bdw: Emit 3DSTATE_WM_HZ_OP.
We don't want depth/stencil fast clears or HiZ resolves; we want normal
drawing.  Without this, the pixel pipeline doesn't work.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Cc: Ben Widawsky <ben@bwidawsk.net>
Cc: Damien Lespiau <damien.lespiau@intel.com>
2013-12-10 11:36:23 +00:00
Daniel Vetter
ef9745b7fa lib: igt_simple_main/init for subtest-less tests
Atm only used to print the version information.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-10 09:41:48 +01:00
Daniel Vetter
f1c4ec936c lib: print uname information in the version string
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-10 09:26:08 +01:00
Daniel Vetter
831a47196d lib: Add host platform to version string
This is import on systems where we compile 32bit tests that run on
64bit platforms.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-10 09:23:44 +01:00
Ben Widawsky
8c33e9ad11 intel-gpu-tools: Version information
Provide two arguments version, and verbose, which allow printing from an
arbitrary igt test. It will show system information (from build time,
not runtime), as well as the git SHA being used.

This will help reduce errors when people try to reproduce problems.

As an example if I want to verify someone is running the correct version
of a test, I could ask them to do:
bwidawsk@ironside ~/intel-gfx/intel-gpu-tools (master)$ sudo ./tests/gem_exec_nop --verbose
gem_exec_nop-git-3c5423b (Linux ironside 3.12.0-1-ARCH #1 SMP PREEMPT
Wed Nov 6 09:06:27 CET 2013 x86_64 GNU/Linux)
Time to exec x 1:		 35.000µs (ring=render)
Time to exec x 2:		 28.000µs (ring=render)
Time to exec x 4:		 20.000µs (ring=render)
Time to exec x 8:		 14.625µs (ring=render)
Time to exec x 16:		 11.188µs (ring=render)
Time to exec x 32:		 11.125µs (ring=render)
Time to exec x 64:		 10.328µs (ring=render)
Time to exec x 128:		 10.172µs (ring=render)
Time to exec x 256:		 10.234µs (ring=render)
Time to exec x 512:		 10.232µs (ring=render)
Time to exec x 1024:		 10.121µs (ring=render)
Time to exec x 2048:		 10.151µs (ring=render)
Time to exec x 4096:		 11.474µs (ring=render)
Time to exec x 8192:		  9.432µs (ring=render)
Time to exec x 16384:		  6.003µs (ring=render)
Time to exec x 32768:		  5.029µs (ring=render)
Time to exec x 65536:		  4.206µs (ring=render)
Time to exec x 131072:		  3.630µs (ring=render)
Subtest render: SUCCESS

--verbose is provided for completeness, but doesn't seem too useful at
the moement.

bwidawsk@ironside ~/intel-gfx/intel-gpu-tools (master)$ sudo ./tests/gem_exec_nop --version
gem_exec_nop-git-3c5423b (Linux ironside 3.12.0-1-ARCH #1 SMP PREEMPT
Wed Nov 6 09:06:27 CET 2013 x86_64 GNU/Linux)

I've put version.h in the root directory so that any subdir can access
it. I've added the tests usage since it's immediately useful, and done
easily via Daniels igt infrastructure work.

v2:
- Always print the version number.
- We want to print uname at runtime.
- Also prefix the i-g-t release version.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net> (v1)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-10 09:23:40 +01:00
Daniel Vetter
ea8c086919 lib: Always print errno in igt assert/require macros
Useful to figure out why things have failed.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-10 08:07:11 +01:00
Paulo Zanoni
d5cdee95d5 lib: rename some power well bit names
I did the same change in the Kernel a few months ago. This should help
not getting confused about which bit does what.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2013-12-06 13:10:36 -02:00
Daniel Vetter
a4d3a6c013 lib: make igt_pipe_crc_start never fail
It's what callers expect - pipe_crc_new is the function where
we pass a potential failure back to callers.

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-06 14:51:14 +01:00
Daniel Vetter
c1b7e722da lib: add igt_pipe_crc_check
No need to duplicate this all over the place.

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-06 14:51:14 +01:00
Xiang, Haihao
adbd83cdc3 rendercopy/bdw: Set Instruction Buffer size Modify Enable to 1
Otherwise it may result in GPU hang

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-12-06 13:01:25 +00:00
Xiang, Haihao
4570e1b3de lib: Clean the batch buffer store after reset
Otherwise the stale data in the buffer

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-12-06 13:00:22 +00:00
Xiang, Haihao
c683569725 tests/gem_media_fill: add support for gen7
v2: Fixed the source register used for the send with EOT
    Fixed the posted destination operand for the send with EOT

Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
2013-12-06 15:11:08 +08:00
Xiang, Haihao
bd384c2ba3 tests/gem_media_fill: add support for gen8
v2: Fixed the source register used for the send with EOT
    Fixed the posted destination operand for the send with EOT

v3: Workaround: Insert MEDIA_STATE_FLUSH after MEDIA_OBJECT.
    Fixed the cache agent used in media_block_write message
    Set Instruction Buffer size Modify Enable to 1, otherwise it may result in GPU hang

Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
2013-12-06 15:11:05 +08:00
Xiang, Haihao
641267dd73 tests: add gem_media_fill
It is to check whether media pipeline on render ring works. Codes
are copied and modified from the rendercopy case which uses 3D pipeline.
However media pipeline is simpler than 3D pipeline and there is few changes
between gen6,gen7 and gen8

Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
2013-12-06 15:11:03 +08:00
Ben Widawsky
e41928e6c9 gen8 rendercpy: temporarily disable
We don't yet have this working, and the excessive hangs are annoying.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
2013-12-05 15:35:01 -08:00
Ben Widawsky
da4258529f Kill XY_COLOR_BLT_CMD
Since we now always want a length for this command, and we've created a
non-length variant, remove the #define to prevent further foot shooting.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
2013-12-05 15:32:42 -08:00
Ben Widawsky
672911d714 gem_pipe_control_store_loop: BDW update
I've opted to not use the PIPE_CONTROL w/a for now. I am unclear if it
is actually required (the test does pass).

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
2013-12-05 14:30:14 -08:00
Daniel Vetter
1a95c710f9 lib: add gem_available_aperture_size helper
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-05 15:50:43 +01:00
Chon Ming Lee
0b67c0c421 Update dpio read/write to take in extra PHY parameter.
The extra parameter is for future platform.

Signed-off-by: Chon Ming Lee <chon.ming.lee@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2013-12-05 13:04:36 +02:00
Mika Kuoppala
fb03ea7737 lib/drmtest: Fix filedesc leak on gem_quiescent_gpu
to not run out of filedescs as some tests call gem_quiescent_gpu
directly.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-04 13:23:01 +01:00
Tvrtko Ursulin
ab7cbf9737 Revert "lib/drmtest: ducttape over fork race"
This reverts commit a031a1bf93b828585e7147f06145fc5030814547.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Conflicts:
	lib/drmtest.c
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-03 17:57:27 +01:00
Daniel Vetter
b34322fd15 Revert "test/gem_concurrent_blt"
This reverts commit aee0dcb1ec2075991d310dd6f3fb5e50160847d1.

Oops, accidentally commit a bit of wip changes.
2013-12-03 17:57:06 +01:00
Tvrtko Ursulin
139c72f38a drmtest: Avoid wrong PID/TID after clone races
Various C library implementations have various races with regards
to caching getpid() or TID inside pthread_kill() implementations.

For example see clone(2) glibc man page and pthread_kill
Bionic C library source.

Work around that by making sure correct PID/TGID and TID values
are retrieved from the kernel when re-raising the signal. It
can be delivered immediately after the clone system call while C
library cached copies have not yet been updated.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-03 17:55:56 +01:00
Tvrtko Ursulin
b92b397d5e build: Make sure asserts are enabled for tests
Tests depend on assertions being enabled since they can, and do,
contain actual test steps. They are also mandatory for ensuring
sane test case behaviour.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-03 17:08:03 +01:00
Daniel Vetter
aee0dcb1ec test/gem_concurrent_blt
Limit working set size also with available ram.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72255
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-03 16:32:52 +01:00
Daniel Vetter
26b336f811 lib: Don't put functional code into asserts
Android apparently compiles with NDEBUG. Which is strongly advised
against, since the big pile of asserts mostly check correct usage of
the helper code in testcases.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-03 13:07:28 +01:00
Chris Wilson
38354ec4d8 drmtest: Fix weird signage on errno
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-12-03 10:13:43 +00:00
Damien Lespiau
34f104aed7 rendercopy/bdw: Fix the 3DSTATE_STENCIL_BUFFER instruction length
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-11-28 14:33:37 +00:00
Damien Lespiau
09f144b649 rendercopy/bdw: Fix the 3DSTATE_HIER_DEPTH_BUFFER instruction length
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-11-28 14:33:37 +00:00
Damien Lespiau
e824fdd033 rendercopy/bdw: Fix the various 3DSTATE_CONSTANT_* instruction length
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-11-28 14:33:37 +00:00