69 Commits

Author SHA1 Message Date
Ville Syrjälä
1ecd91a8c6 Fix a bunch of printf types
igt_kms.c: In function ‘igt_crtc_set_background’:
igt_kms.c:1940:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
  LOG(display, "%s.%d: crtc_set_background(%lu)\n",
  ^
intel_firmware_decode.c: In function ‘csr_open’:
intel_firmware_decode.c:169:2: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 3 has type ‘__off_t’ [-Wformat=]
  printf("Firmware: %s (%zd bytes)\n", filename, st.st_size);
  ^
intel_gpu_top.c: In function ‘main’:
intel_gpu_top.c:683:10: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Wformat=]
          stats[i] - last_stats[i]);
          ^
hsw_compute_wrpll.c: In function ‘main’:
hsw_compute_wrpll.c:644:3: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘long long int’ [-Wformat=]
   igt_fail_on_f(ref->r2 != r2 || ref->n2 != n2 || ref->p != p,
   ^
gem_gtt_hog.c: In function ‘__real_main155’:
gem_gtt_hog.c:177:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat=]
  igt_info("Time to execute %lu children:  %7.3fms\n",
  ^
kms_flip.c: In function ‘run_test_step’:
kms_flip.c:985:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 10 has type ‘__time_t’ [-Wformat=]
   igt_assert_f(end - start > 0.9 * frame_time(o) &&
   ^
kms_flip.c:985:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 11 has type ‘__suseconds_t’ [-Wformat=]
kms_frontbuffer_tracking.c: In function ‘setup_sink_crc’:
kms_frontbuffer_tracking.c:1364:3: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘ssize_t’ [-Wformat=]
   igt_info("Unexpected sink CRC error, rc=:%ld errno:%d %s\n",
   ^
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-01-08 19:56:49 +02:00
Rodrigo Vivi
e6848c5839 kms_frontbuffer_tracking: Skip on unreliable CRC.
Even with all sink crc re-works we still have platforms
where after 6 vblanks it is unable to calculate the
sink crc. But if we don't get the sink crc it isn't true
that test failed, but that we have no ways to say test
passed or failed.

So let's print a message and move forward in case sink crc
cannot help us to know if the screen has been updated.

v2: Also include a message on setup_sink_crc and also
only skip when it is mandatory, i.e. when running for PSR.

Acked-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2015-12-07 09:06:33 -08:00
Rodrigo Vivi
ea3806bade kms_frontbuffer_tracking: Make sink crc mandatory only for PSR.
Unfortunately Sink CRC is not 100% reliable for all platforms.
So we cannot block FBC tests nor skip them when we are getting
unreliable Sink CRC results, or not getting them at all.

Acked-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2015-12-07 09:06:20 -08:00
Rodrigo Vivi
d074b44ab6 kms_frontbuffer_tracking: Increase the time we wait for PSR.
With commit (drm/i915: Delay first PSR activation.) in kernel
PSR might take a bit longer to really activate after the modeset.
The first PSR activation after modeset is taking 5 times the panel
power cycle delay time, which is 600ms for our machines here.
So timeout here needs to be a minimum of 3s. However let's use
5s as the safe value in case we find machines with higher power
cycle delay.

Since we do a lot of assert(psr_disabled), this commit is increasing
the time it takes to run the whole set of PSR tests by a few minutes,
which had been reduced by commit f4db3b18841
("kms_frontbuffer_tracking: reduce the PSR wait timeout to 2s").

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2015-12-07 09:05:55 -08:00
Daniel Vetter
db4f83ca5d lib/kms+tests: Use cached connector state
Speeds up testcases except for those where we want to exercise the
probing itself. The only exceptions left where we do a full probe are

- pm_rpm: We use it to make sure the kernel doesn't get things wrong
  with power domains, so we really want to exercise the full probe
  paths. And there the only place really is the specific validation
  done with the data gathered by get_drm_info.

- kmstest_force_ functions: Newer kernels should be better at
  re-probing state when the force sysfs fields change, but better safe
  than sorry.

v2: I also consolidated the start_n_modes and start_connectors while
at it - move one of the fixup hunks to this patch that accidentally
got misplaced (Thomas).

Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-12-04 10:49:11 +01:00
Paulo Zanoni
d2a17f4bc4 kms_frontbuffer_tracking: add tilingchange subtest
During the review of a recent FBC patch, Ville pointed a problem that
happens when we use the page flip IOCTL to switch between buffers that
have different tiling formats. This test should catch the problem
introduced by that patch - which was not merged, by the way, so the
test should be passing.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-11-27 09:57:35 -02:00
Paulo Zanoni
98bb8428b2 kms_frontbuffer_tracking: assert the stride changes at stridechange()
We use igt_create_fb(), which decides the stride by itself: there's no
guarantee that making a buffer 512 pixels bigger is going to make its
stride change.

I had a fix for this problem that was supposed to be applied before
this patch, but due to a rework request I'm changing the order of the
patches, so we should expect to hit this assertion for now. At least
the root cause of the problem is clear now.

v2: Update the commit message due to the patch order changing.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-11-27 09:57:35 -02:00
Paulo Zanoni
f23ea58f1f kms_frontbuffer_tracking: expand badstride and stridechange
Make those subtests try to change the stride using multiple APIs so we
can catch errors that affect full modesets, fast modesets and page
flips.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-11-27 09:57:35 -02:00
Paulo Zanoni
340599c986 kms_frontbuffer_tracking: move flip_type to struct test_mode
Handle it just like we handle t->format. IMHO, it's better.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-11-27 09:57:35 -02:00
Paulo Zanoni
b4c58857e5 kms_frontbuffer_tracking: do page flips using the planes API
Add a new FLIP_PLANES enum so we can do "page flips" using it too. The
goal is to exercise the fast modeset paths on the Kernel.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-11-27 09:57:35 -02:00
Thomas Wood
52a393a311 tests: remove duplicate struct member initializers
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-11 14:20:55 +00:00
Daniel Stone
de7ccdd083 tests: Run igt.cocci
Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-11-03 19:46:11 +00:00
Paulo Zanoni
a2c67866fb kms_frontbuffer_tracking: remove opt.only_feature
That option is not needed anymore since:

commit 982934625ac67234c6d85c6cf29a5a487e54d4f0
Author: Thomas Wood <thomas.wood@intel.com>
Date:   Wed Sep 16 14:36:24 2015 +0100
    lib: allow wildcard matching when specifying subtests

In fact, using "--run-subtest 'fbc-*'" is better than using --fbc-only
due to how SKIPs are handled. In the former, only the tests matching
the expression are tried, so the number of SKIPs only contains the
number of tests on the specified pattern that were skipped. If you
used --fbc-only, all the non-fbc tests would count as SKIPs, so it
would be harder to know which of the tests marked as skipped were
actual FBC tests.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-10-23 15:01:05 -02:00
Paulo Zanoni
efc2e39a45 kms_frontbuffer_tracking: add stridechange subtest
This is a corner case not exercised by the other subtests. The test is
expected to pass both with the current Kernel tree and with the
patches that are on the mailing list.

The patches currently on the mailing list change how the CFB is
allocated, and this subtest is designed to make sure everything still
works as expected.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-10-23 15:00:45 -02:00
Paulo Zanoni
196179a2bc kms_frontbuffer_tracking: add flag to not assert feature status
This will be used by the stridechange subtest.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-10-23 15:00:21 -02:00
Paulo Zanoni
a4697fc8ba kms_frontbuffer_tracking: unset crtcs after getting the base blue CRC
This fixes the failures for cases where you use --run-subtest to run
single subtests that don't use any drawing patterns.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-10-23 14:59:56 -02:00
Paulo Zanoni
bfea74a9f6 kms_frontbuffer_tracking: add fliptrack subtest
The current upstream Kernel code stops and then restarts FBC at every
page flip. I am working on patches to keep FBC enabled all the time,
so this brings the possibility of having the hardware tracking
mechanism looking at the old buffer instead of the new one. This test
should catch this problem.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-10-08 15:02:50 -03:00
Paulo Zanoni
f0c067ddb3 kms_frontbuffer_tracking: don't mode unset when checking sink CRC support
There's no reason to do a mode unset since we don't care about whether
FBC or PSR are enabled or disabled. This should save about a second
for each time you invoke the program.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-10-08 15:02:30 -03:00
Paulo Zanoni
c1daf330e9 kms_frontbuffer_tracking: add scaledprimary subtest
It's not testing a lot since we lack the Kernel Stolen Memory Checker,
but some day this will be useful.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-10-08 15:02:06 -03:00
Paulo Zanoni
bb2ebe92ef kms_frontbuffer_tracking: set the universal planes cap in the setup
... instead of just setting it for the fullscreen_plane subtest and
then unsetting it. We want to use it more, so just make sure all the
code knows how to deal with multiple planes per CRTC.

This also allows us to do some upfront caching of the plane
information, so the code for the tests gets simpler.

There's a new test that's going to use all these changes.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-10-08 15:01:46 -03:00
Paulo Zanoni
68cb0de70c kms_frontbuffer_tracking: change pattern 1's last rect to 1x1
Make sure the tracking mechanism is able to track a write in the very
last pixel.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-10-08 15:01:20 -03: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
Paulo Zanoni
71b85f9713 kms_frontbuffer_tracking: print the status when it's not what we expect
Printing the status on an unexpected failure is always the first thing
I do. So do this always.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-25 11:36:01 -03:00
Paulo Zanoni
a07d0a47be kms_frontbuffer_tracking: add slow_draw() subtest
It fails on my SKL machine.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-25 11:35:30 -03:00
Paulo Zanoni
229110442a kms_frontbuffer_tracking: wait for PSR to be HW Enabled & Active
Make sure PSR is fully there.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-25 11:34:56 -03:00
Paulo Zanoni
c1fe951b8a kms_frontbuffer_tracking: add options for setting the shared fb X/Y
I'm using this to debug some aspects of the GTT tracking.

While at it, do a small rename and fix the ASCII art.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-25 11:34:28 -03: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
64590c7b76 kms_frontbuffer_tracking: reduce the FBC wait timeout to 2s
Just like we did for PSR, let's do it for FBC. FBC gets reenabled in
just 50ms, so the 5000ms timeout is huge. On the other hand, we only
pay the 5000ms timeout full price 9 times when running
kms_frontbuffer_tracking --fbc-only, so this change shouldn't save too
much time.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 19:14:49 -03:00
Paulo Zanoni
f4db3b1884 kms_frontbuffer_tracking: reduce the PSR wait timeout to 2s
PSR only takes up to 100ms to be enabled, but we were using 5000ms
timeouts. The problem with PSR is that the MMAP_GTT tests have to
assert that PSR is disabled and stays disabled during the whole
timeout, so that 5s cost is a little to high when we consider that we
do the full 5s wait 74 times when running kms_frontbuffer_tracking
--psr-only.

By reducing to 2s we still make sure we're safe, since we're waiting
20x the time PSR needs to get reenabled, and we reduce the runtime of
running kms_frontbuffer_tracking --psr-only from 14m10s to 10m29s.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 19:14:26 -03:00
Paulo Zanoni
78120d8158 kms_frontbuffer_tracking: add subtests for rgb565 and rgb101010
Make sure valid formats work properly and invalid formats keep the
features disabled.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:33:50 -03:00
Paulo Zanoni
c3fb972ee9 kms_frontbuffer_tracking: fix psr-farfromfence assertions
We're using GTT draws and they disable PSR. This test is mostly for
FBC anyway.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:33:26 -03:00
Paulo Zanoni
d675cf3ed7 kms_frontbuffer_tracking: split prepare_subtest() in two functions
And remove duplicated code by calling prepare_subtest_data() on
rte_subtest().

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:32:59 -03:00
Paulo Zanoni
6de5b06112 kms_frontbuffer_tracking: remove duplicated pairs on multidraw
If we already tested the combination of m1+m2, don't test m2+m1 later:
the drawing pattern used already has 4 squares, so we're already
testing the "m2 followed by m1" case.

This should reduce the test time from about 60s to about 30s.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:32:36 -03:00
Paulo Zanoni
a2904ead74 kms_frontbuffer_tracking: SKIP if not enough stolen is available
This is not an FBC bug.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:32:12 -03:00
Paulo Zanoni
f62a683acd kms_frontbuffer_tracking: use all drawing methods on multidraw_subtest
Instead of having a single pair of methods per subtest. Having this in
pairs is not very useful since we end doing all the drawing methods
per subtest anyway.

This saves a few modesets, which makes eDP slightly faster - about 22s
on my local machine.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:31:44 -03:00
Paulo Zanoni
b53bcf789b kms_frontbuffer_tracking: improve support for multiple pixel formats
We now have per-pixel-format FBs and CRC values. Also t->format to
indicate the format we're using on the subtest. We still only use the
default RGB888 format (AKA FORMAT_DEFAULT) for all tests since
multiplying the current number of tests by the number of new pixel
formats doesn't sound like a great idea.

With this, it should be really easy to add new tests that use
different pixel formats.

Also, if you want a full IGT run on a specific pixel format, all you
need to do is to change FORMAT_DEFAULT.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:31:22 -03:00
Paulo Zanoni
3b17600789 kms_frontbuffer_tracking: add information about more formats
We're not using those formats yet, but a simple change to create_fb()
allows us to use these formats without problems now.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:30:56 -03:00
Paulo Zanoni
606f039dec kms_frontbuffer_tracking: introduce enum color
We want to add support for different pixel formats and the current
hardcoded pixel values won't work with that. So add enum color and
its auxiliary functions so we can decide the pixel values based on the
chosen color enum.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:30:28 -03:00
Paulo Zanoni
7009b10c42 kms_frontbuffer_tracking: don't pass the format to create_fb()
It is create_fb() who is going to decide the buffer format based on
the arguments provided by the caller. This is another step for the
non-XRGB8888 support.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:30:07 -03:00
Paulo Zanoni
e4b94900b5 kms_frontbuffer_tracking: add a wrapper for igt_create_fb()
The wrapper will do a few additional things when we add support for
formats different than XRGB8888.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:29:18 -03:00
Paulo Zanoni
445182f26b kms_frontbuffer_tracking: fix MMAP_WC assertions on PSR
Now that the MMAP_WC operations call the dirty ioctl, PSR gets
reenabled after some time. So we have to adjust op_disables_psr() to
take that into account.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:28:49 -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
c049096eb6 kms_frontbuffer_tracking: don't test SPR or CUR on multidraw
The goal of the multidraw subtest is to check if alternating drawing
methods can somehow break the feature. The plane we're drawing to
really shouldn't matter here - we have other tests to make sure
drawing on the different planes works correctly. So after this patch
we'll only run the multidraw subtest for the primary plane, not for
sprite and cursors anymore.

This makes "--no-edp --fbc-only --1p-only" go from 2m29s to 1m40s on
my machine.

Of course, we can still run these tests with the --show-hidden flag.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-13 10:08:33 -03:00
Paulo Zanoni
78d076268c kms_frontbuffer_tracking: don't test CUR or SPR planes on FBS_SHARED
We already tested these planes for FBS_INDIVIDUAL, and there are no
reasons to believe those planes will behave differently under
FBS_SHARED, so save some time avoiding potentially useless tests.

This makes "--no-edp --fbc-only --1p-only" go from 2m49s to 2m29s on
my machine.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-13 10:07:56 -03: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
Paulo Zanoni
ffd7321c70 kms_frontbuffer_tracking: use the dirty ioctl after MMAP_WC calls
We can't add this to igt_draw since igt_draw doesn't care whether it's
writing on a frontbuffer or not.

PS: the ENOSYS is for Kernels without the patch implementing the
IOCTL.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-05 17:21:48 -03:00
Paulo Zanoni
7f952bd976 kms_frontbuffer_tracking: don't keep debugfs open
Make the code smaller and simpler, also ready for when we move
debugfs_read() to lib/.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-07-14 15:21:26 -03:00
Paulo Zanoni
7c5a218cc3 kms_frontbuffer_tracking: implement suspend subtest
Make sure we survive suspend/resume.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-07-14 13:06:41 -03:00
Paulo Zanoni
1c389f69f0 kms_frontbuffer_tracking: allow passing a NULL pattern
So we don't need to initialize CRCs we won't use. This makes the
modesetfrombusy and badstride tests a little faster.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-07-14 13:06:08 -03:00
Paulo Zanoni
91f097aefa kms_frontbuffer_tracking: simplify subtest enumeration
Just a small bikeshed.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-07-14 13:05:40 -03:00