767 Commits

Author SHA1 Message Date
Damien Lespiau
1d2c9d5e57 lib: Include drm_fourcc.h from igt_kms.h
This include is needed for the DRM_FORMAT* defines used in the fb
creation helpers.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
a1df2f4363 lib: Introduce a new helper kmstest_create_color_fb()
We need to create fbs of a single color in a few places. Time to
abstract that out to a helper function.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
f0e0b2ae65 lib/display: Add support for DRM planes
We can now extend our plane support beyond primary and cursor planes.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
6954103192 lib/crc: Add a helper to read a single CRC value
In this case, we also take care of starting/stopping the CRC collection.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
7d0e2f618c lib/crc: Factor out reading a single CRC value
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
162914b9ed lib/display: Check if we're trying to use the same pipe on 2 outputs
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
65fef0a434 lib/display: Allow to override the display verbosity with an env variale
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
09faa45f52 lib/display: Add a way to specify we don't care about the pipe to use
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
5ec399b4a6 lib/display: Add support for the cursor plane
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
c4823ce9a4 lib/display: Fix the SetCrtc disabling log message
We were displaying the value of fb_id (0), when the actual interesting
thing about this call it that it'll just down the pipe.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
72e9a6c8d5 lib/display: Add an accessor to retrieve the number of pipes
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
992bd5d62a lib: Introduce a for_each_connected_output() macro
So we can easily cycle through them in tests without knowing too many
internal details about how igt_display_t organize its data.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
09e84cee8b lib: Introduce symbolic names for display planes
It'd be nice to have symbolic names for planes instead of using an index
in igt_output_get_plane().

We also namespace the enum to not conflict with anyone.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Damien Lespiau
3670d6dbff lib: Introduce a modeset API
The goals here are:
  - Reduce duplicated code in each KMS test
  - Provide an API that looks more like what we want for atomic
    modesets. The hope is then that it'll be easy to switch, at
    run-time, between the "legacy" path and atomic modesets, keeping
    the same API for tests.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Daniel Vetter
333a5c6f07 lib/drmtest: Fix up skip_henceforth checks
We need to first check whether we'll even run the testcase before
deciding to print a premature SKIP/FAIL. Without this and global
skipped resulted in superflous output when running only one testcase.

References: https://bugs.freedesktop.org/show_bug.cgi?id=74100
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-11 12:14:09 +01:00
Thomas Wood
0269d1da49 lib: fix signed/unsigned comparison issues
Store the result of set_vt_mode as a signed value so that errors can be
caught correctly.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-06 18:32:12 +01:00
Jeff McGee
fd3fcbd3b3 lib/drmtest: Add igt_wait_helper
igt_wait_helper compliments igt_stop_helper and is used when helper
processes are expected to exit naturally.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-06 07:45:53 +01:00
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