4208 Commits

Author SHA1 Message Date
Paulo Zanoni
7ca55f433c tests/igt_fb: rename igt_get_all_formats to igt_get_all_cairo_formats
I recently had this discussion with Daniel where I didn't want to use
igt_drm_format_to_bpp() because it uses the format_desc array, and
igt_fb currently assumes that all the format_desc formats have a
matching valid Cairo format, so I wouldn't be able to easily add
formats such as ARGB2101010.

The function that has the assumption mentioned above is
igt_get_all_formats: its current users call igt_get_all_formats, and
then call cairo-dependent functions, such as igt_get_cairo_ctx on the
returned formats.

In order to document the current behavior and prevent any problems in
case we start adding new formats without matching Cairo versions to
format_desc, rename igt_get_all_formats to igt_get_all_cairo_formats
and make it explicitly check for CAIRO_FORMAT_INVALID.

Requested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29 16:30:15 -02:00
Paulo Zanoni
55229f173e lib/igt_fb: fix igt_get_all_formats documentation
We give the callers a const pointer to a static variable that we reuse
between multiple calls: they're not supposed to free it, and they
don't free it today.

Fix the documentation and leave the still reachable pointer instead of
reworking the function and its callers.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29 16:29:51 -02:00
Paulo Zanoni
12c1eb653f lib/igt_draw: use igt_drm_format_to_bpp()
Don't reimplement the function.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29 16:29:30 -02:00
Paulo Zanoni
0432201e6d kms_frontbuffer_tracking: standardize the used FB sizes
We want to make sure that both tiled and untiled buffers have the same
size for the same width/height/format. This will allow better control
over the failure paths exercised by our tests: when we try to flip
from tiled to untiled, we'll be sure that we won't execute the error
path that checks for buffer sizes.

v2: Use the new igt_calc_fb_size() instead of implementing our own
size calculation (Daniel).
v3: We can now use igt_drm_format_to_bpp() (Daniel).

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29 16:29:08 -02:00
Paulo Zanoni
096e020743 kms_frontbuffer_tracking: use igt_drm_format_to_bpp()
The only format from fb_get_bpp() not supported by
igt_drm_format_to_bpp() is ARGB2101010, but we don't really use it in
kms_frontbuffer_tracking, so we can do the switch.

Adding ARGB2101010 to igt_fb won't be that simple since there's no
equivalent Cairo format, and igt_fb users assume that all formats
known by igt_fb have equivalent Cairo formats.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29 16:28:47 -02:00
Paulo Zanoni
be6f3fadaf lib/igt_fb: make the automatic buffer sizes/strides smaller
The big motivation behind this patch is that the current power-of-two
granularity from igt_fb is way too big. There was more than one
occasion where I had to work around this problem on
kms_frontbuffer_tracking, and during my last workaround I was
requested to just make igt_fb use more minimal buffers.

I also need to export the size computation function so I won't need to
reimplement it inside kms_frontbuffer_tracking.

v2:
 - Fix the Yf sizes (Ville).
 - Don't change the Gen 2/3 behavior for both tiled and non-tiled.
v3:
 - Edit the commit message, clarify that v1 was wrongly treating gen
   2/3 non-tiled as tiled (Chris).

Requested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29 16:28:11 -02:00
Chris Wilson
d63e72f0ad igt/gem_cs_tlb: Increase BB start alignment to 64bytes
Ironlake requires 64byte alignment for its MI_BATCH_BUFFER_START.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-28 17:03:21 +00:00
Chris Wilson
89f81e0396 igt: More MI_STORE_DWORD fixes for gen5
A few other tests I have updated recently to use MI_STORE_DWORD also need
the magic bit for gen4/5.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-28 16:22:43 +00:00
Chris Wilson
3ec8b1d28e igt/gem_ringfill: Set MI_MEM_VIRTUAL flag for gen<6
bit22 of MI_STORE_DWORD is confusing as the meaning changed between
physical/virtual addressing in early gen and GTT/ppGTT in later gen. It
looks like gen4 and gen5 still need the flag.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-28 14:04:07 +00:00
Chris Wilson
eaa03678b0 lib: Hide BSD1/BSD2 rings on hardware without BSD2
The kernel happily lets us run on I915_EXEC_BSD2 even with such hardware
existing. Sigh.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-28 14:04:07 +00:00
Chris Wilson
506d683da1 tests: Add gem_exec_reloc
The first steps towards basic relocation handling. In today's edition,
we ask how well does the kernel fare if we pass it relocations via
mmappings of our buffer objects.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-28 12:18:22 +00:00
Chris Wilson
d18d1eca81 igt/gem_reset_stats: Convert residual calllers of gem_exec() to gem_execbuf()
Missed from e3b68bb66683ad4cb4c80df904a3a21c98a2b6c2 due to rebasing
fun.

gem_reset_stats.c: In function 'inject_hang_ring':
gem_reset_stats.c:227:19: error: implicit declaration of function 'gem_exec' [-Werror=implicit-function-declaration]
gem_reset_stats.c:227:2: warning: nested extern declaration of 'gem_exec' [-Wnested-externs]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 20:23:45 +00:00
Chris Wilson
a1b47ef6ae igt/gem_concurrent_blit: Disable libdrm buffer cache for child inheritance
It just ends up with buffer leaks all over. On the flip side, it does
allow us to inherit the bufmgr directly without worry of stomping over
the aliased entries (and causing double closes).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 19:59:16 +00:00
Chris Wilson
37f4da0d98 igt/gem_concurrent_all: Pass buffer data down
In order reduce the number of parameters being passed everywhere, whilst
simultaneously making more information available to the lower levels,
pass the struct buffers around.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 19:59:16 +00:00
Chris Wilson
5dea5deffc igt/gem_cs_prefetch: Check each ring
Since each engine has its own ring, each is subject to CS prefetching
and has its own layout that needs probing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 18:34:05 +00:00
Chris Wilson
de70769cc0 Add I915_EXEC_DEFAULT to list of known engines
I dropped this from the list of rings for some tests when refactoring to
a common array. Almost all of the tests should be run over the default
exec engine to ensure ABI backwards compatiblity.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 16:42:10 +00:00
Chris Wilson
d130899084 igt/gem_sync: Use common array of rings
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 14:47:19 +00:00
Chris Wilson
dd6b45235b igt/gem_ringfill: Use common array of rings
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 14:47:19 +00:00
Chris Wilson
8cd5289334 igt/gem_cs_tlb: Use common array of rings
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 14:47:19 +00:00
Chris Wilson
7e0853c9c7 igt/gem_exec_nop: Use common array of rings
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 14:47:19 +00:00
Chris Wilson
b09ef449af igt/gem_storedw_loop: Use common array of rings
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 14:47:19 +00:00
Chris Wilson
01acd70762 igt: Add gem_exec_basic
Extremely basic check that we can dispatch an execbuf on every ring.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-01-27 14:47:00 +00:00
Chris Wilson
04f5215f00 Extract array of execution engines
A few tests wish to execute on every engine, so centralise the array of
known engines.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 14:45:19 +00:00
Chris Wilson
b7f150b606 lib: Query the kernel for support of a particular exec id
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 14:45:19 +00:00
Chris Wilson
e3b68bb666 lib: Share common __gem_execbuf()
An oft-repeated function to check EXECBUFFER2 for a particular fail
condition.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 14:45:18 +00:00
Gabriel Feceoru
711398e82a igt/gem_ringfill: Allow listing subtests in gem_ringfill
Moved gem_quiescent_gpu() call to the run path.

Signed-off-by: Gabriel Feceoru <gabriel.feceoru@intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-01-27 13:32:48 +01:00
Maarten Lankhorst
336235c0a8 gem_ringfill: fix typo in test name
Missing a r!

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-01-27 13:31:16 +01:00
Chris Wilson
5f6ebb2cb7 igt/gem_concurrent_blit: Tighter scoping of buffers variable
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 11:44:39 +00:00
Chris Wilson
a64f31b31e igt/gem_concurrent_blit: Close userptr handle after importing into bufmgr
The bufmgr import creates a new handle from a name for the userptr - we
can discard our original handle immediately.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 11:44:39 +00:00
Chris Wilson
6f75990af0 igt/gem_concurrent_blit: Tidy blt-fill using gem wrappers
Replace the open-coded ioctls with the thin gem wrappers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 11:44:39 +00:00
Derek Morton
3598fff994 tests/Android.mk: Make intel_residency CAIRO dependant
intel_residency has a cairo dependency through igt_fb.c. Remove it
if ANDROID_HAS_CAIRO is not defined.

Signed-off-by: Derek Morton <derek.j.morton@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-26 15:45:44 -02:00
Jesse Barnes
e28acefc5c lib/igt_kms, tests/testdisplay: allow probing of new connector modes
Fixup some fallout from the connector probing changes so testdisplay -m
will pick up newly hotplugged displays correctly.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org.
2016-01-26 09:32:43 -08:00
Chris Wilson
e2c9a023f2 igt/gem_exec_alignment: Reduce GTT usage if !full-ppgtt
If we have to share the GTT with others, we cannot rely on being able to
fill it and have to factor in some slack for others.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-26 09:19:00 +00:00
Chris Wilson
49b1337881 igt/gem_exec_alignment: Actually check aligned locations after many
As well as ensuring the kernel doesn't simply crash when asked to do
lots of objects, check it actually aligns them.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-26 09:18:59 +00:00
Eric Anholt
ea3331d120 igt: Disable igt_clflush_range() implementation on ARM builds
Daniel has suggested that I put vc4 testing into igt, since it's got
the piglit integration and KMS coverage already.  This gets the ccore
building so that I can start writing tests.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-25 19:53:36 +00:00
Daniel Stone
bccc0ec6a3 build: Disable x86-specific utilities on non-x86
Some bits can't be built on non-x86 architectures, mostly because they
require x86-specific assembly primitives. Disable these by default on
non-x86 architectures.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-01-25 19:53:36 +00:00
Michał Winiarski
e6ca4bd7cd lib/ioctl_wrappers: Add gem_has_softpin
We can move it from softpin test into lib, and since softpin support is
highly unlikely to go away in-between getparam ioctl calls, let's just
do a single call and store the value.

v2: rebase

Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-01-25 19:44:34 +01:00
Michał Winiarski
52b5d5016e lib/ioctl_wrappers: Add gem_gtt_type exposing raw HAS_ALIASING_PPGTT param
No functional changes.
While I'm here, let's also rename gem_uses_aliasing_ppgtt (since it's
being used to indicate if we are using ANY kind of ppgtt) and introduce
gem_uses_full_ppgtt to drop some unnecessary code from tests that were
previously calling getparam directly instead of using ioctl wrapper.

v2: drop gem_uses_full_48b_ppgtt since it's no longer used anywhere,
    s/48b/64b (Chris)
v3: rebase

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-01-25 19:44:31 +01:00
Chris Wilson
0e2071411a Promote eviction memory sizes and buffer counts to uint64_t
References: https://bugs.freedesktop.org/show_bug.cgi?id=93849
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-25 14:03:56 +00:00
Paulo Zanoni
beb936f188 tools: add intel_residency
After the recent discussions regarding the effects of the vblank
disabling policies on PC state residencies, I started running some
experiments to reevaluate some non-intuitive conclusions I had
reached. In order to help me do this, I decided to write this tool.

The idea is very simple: the tool puts the system on an screen-on idle
state, checks which PC state residency is the deepest we can reach,
measures its residency, then does some not-so-idle tests and measures
the residencies. You can use the tool to compare different Kernel
trees and you can also use the tool to compare enabled vs disabled
features.

It's obvious that these cases do not represent real-world use cases of
our driver, but they are already enough to highlight differences
between the many patches I wrote. I was even able to catch a bug in
one of my patches by spotting an unexpected regression in the
residencies.

I've been using this tool for FBC, but I expect it to also be useful
for PSR, DRRS and similar features. I've been measuring the effects of
different optimizations I wrote, and I've also been measuring the FBC
vs no-FBC cases.

It is also important to highlight that if your system is not properly
configured for efficient power savings the tool may not be able to
show differences between the results. On my Broadwell machine, for
example, if I don't run "powertop --auto-tune" before running the
tool, I get PC2 as the deepest state, and 90%+ residency for every
workload. After properly configuring the machine, I get PC7 as the
deepest state, which is the expected.

So far I only tested this tool on BDW and SKL, and it may hit some
unexpected assertions for older platforms.

I only implemented the cases that are immediately useful for me, but
we may also expand the tool in the future. We can add more important
workloads. We can add support for screen-off cases, so we can compare
the effects of runtime PM and other screen-off features. There's a lot
we can do, but none of this is on my current priority list.

And remember: /usr/bin/paste is your friend when comparing results.

v2:
  - Be more idle at setup_idle().
  - Improve printing for /usr/bin/paste usage.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-25 11:58:05 -02:00
Chris Wilson
9bf4e19125 igt/gem_softpin: Keep last_handle around to vary hole generation
If we don't close the handle from the last pass, we don't free up the
previous pass's vma immediately, changing the hole allocation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-24 15:35:31 +00:00
Chris Wilson
c5b0293ca3 igt/gem_softpin: Exercise snoop+uncached abutting
snooped objects are not allowed to abutt uncached objects on older gen
(!llc and global GTT) or else the GPU may hang if it prefetches across a
page boundary into a different memory type (i.e. CS reading from snoop).
The kernel should be checking the alignment rules as normal.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-23 18:35:20 +00:00
Chris Wilson
d4a05bc009 igt/gem_concurrent_blit: Switch to a shared mmap for userptr
If we use a MAP_SHARED mmaping for the our backing storage for userptr,
then it will be inherited across the fork with the same address. ideal
for continuity testing of children.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-23 09:08:39 +00:00
Chris Wilson
69ecedea73 igt/gem_concurrent_blit: Allocate a private batch cache for the child
We have to avoid the COW alias for the intel_bufmgr and intel_batch
cache as the child may close the object (in its local cache) leaving an
alias in the parent cache pointing to a stale object.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-23 08:18:23 +00:00
Chris Wilson
3eae640b81 igt/gem_concurrent_blit: Disable userptr+child tests
The issue here is that the pointer inherited upon the child is
copied-on-write, i.e. the pointer is private to each process, but the
handle is shared. This means that writes and reads in the child are
going to a different set of pages than the GPU's object - the test is
simply broken. To overcome this we would need to mmap the shared buffer
into the child.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-22 20:01:55 +00:00
Chris Wilson
4645630d3e igt/gem_concurrent_blit: Check inheritance of buffers
The current forked modes recreate their handles in the children and just
look at any complications arising from contention. This mode looks at
inheriting the fd+handles from the parent into the child and seeing if
we can use them within the child.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-22 19:40:30 +00:00
Chris Wilson
512f846f37 igt/gem_ringfill: Mark the write object as EXEC_OBJECT_WRITE
After setting the flag for NORELOC (to avoid having to pay the cost of
validating the relocations on every pass), we need to make sure that
we set EXEC_OBJECT_WRITE so that we do track the outstanding writes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-22 19:28:34 +00:00
Chris Wilson
291ff6bcf1 igt/gem_ringfill: Disable MI_STORE_DATA_IMM on BSD/gen6
It's broken, avoid at all costs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-22 19:11:46 +00:00
Chris Wilson
0091e6787c igt/gem_userptr_blits: Exercise applying relocations to a userptr bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-22 18:28:01 +00:00
Chris Wilson
5b675f7b2f lib: Refactor common detection of missed interrupts
As we have the same function in a few places to read the
debugfs/i915_ring_missed_irq file, move it to the core.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-22 17:45:06 +00:00