57 Commits

Author SHA1 Message Date
Vivek Kasireddy
fe548fab0a igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v3)
The main goal of this subtest is to trigger the following warning in
the function i915_gem_object_get_fence():
	if (WARN_ON(!obj->map_and_fenceable))

To trigger this warning, the subtest first creates a Y-tiled object and
an associated framebuffer with the Y-fb modifier. Furthermore, to
prevent the map_and_fenceable from being set, we make sure that
the object does not have a normal VMA by refraining from rendering to the
object and by setting the rotation property upfront before calling commit.

v2: Do not call paint_squares and just use one output.

v3: Convert an if condition to igt_require and move the plane rotation
requirement further up before the fb allocation.

Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-10-30 09:15:55 +01:00
Tvrtko Ursulin
061a38fca0 kms_rotation_crc: Exercise page flips with 90 degree rotation
Do some page flipping on the rotated plane just to exercise
that code path.

v2: Actually render to flip fb and fixed flip counter.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
Cc: Arun R Murthy <arun.r.murthy@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-10-14 15:45:23 +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
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
Tvrtko Ursulin
f2a5896bdd kms_rotation_crc: Update rotation direction for kernel changes
commit 1e8df16778b0d8fd8102b3ee799b028f8f961089
Author: Sonika Jindal <sonika.jindal@intel.com>
Date:   Wed May 20 13:40:48 2015 +0530

    drm/i915/skl: Swapping 90 and 270 to be compliant with Xrand

Changed the rotation direction so IGT needs to be told.

Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-05-27 14:24:49 +01:00
Tvrtko Ursulin
637f0455da kms_rotation_crc: Do not leak framebuffers during test duration
Test used to call prepare_crtc twice in the plane loop and leaked two
framebuffers per [subtest]x[pipe]x[plane].

What the loops really wants to do, instead of second invocation of
prepare_crtc, is to just turn on the display with the unrotated fb to
verify that the plane property has been restored by the VT transition
from previous to graphics mode.

To enable that factor out code which does that from prepare_crtc into
commit_crtc and call it instead.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-05-01 16:24:28 +01:00
Tvrtko Ursulin
dbf6468f90 kms_rotation_crc: Use main test for negative cases
Saves a good amount of code duplication by supporting expected
failures from the main loop.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-27 15:26:00 +01:00
Tvrtko Ursulin
6f5d400ae9 kms_rotation_crc: No need to square the buffer in paint
Now that size is calculated in a single place and correct geometry passed in,
paint squares does not need to concern itself with it.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-27 15:26:00 +01:00
Tvrtko Ursulin
b769a7c96b kms_rotation_crc: Consolidate plane and cursor code paths
There can only be one, either a plane or a cursor, in each subtest so there
is no need for two framebuffer varilables and also some codepaths can be
unified.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-27 15:26:00 +01:00
Tvrtko Ursulin
e23a818c18 kms_rotation_crc: Negative test does not need to render anything
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-27 15:26:00 +01:00
Tvrtko Ursulin
148c0d2281 kms_rotation_crc: Remove unused variable in negative test
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-27 15:26:00 +01:00
Tvrtko Ursulin
d901106240 kms_rotation_crc: Framebuffer used for initial modeset does not need to be painted
It is just there to light up the display using the full modeset. Also renamed it
from fb_full to fb_modeset to be more descriptive.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-27 15:26:00 +01:00
Tvrtko Ursulin
4dd79d13c9 kms_rotation_crc: Local framebuffers do not need to be global
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-27 15:26:00 +01:00
Sonika Jindal
e1ce5eac33 kms_rotation_crc: Adding test for 90/270 rotation
Adding 90/270 rotation testcase for primary and sprite planes.

v2: Added position test for sprite. Checking for gen > 9 for 90/270.
Some cleanup and rebase.
v3: Added test for unsupported tiling and unsupported pixel format for 90/270
v4: Added the legacy commit to initiate modeset in the negative test(Tvrtko)

Signed-off-by: Sonika Jindal <sonika.jindal@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-22 18:00:42 +01:00
Daniel Vetter
e588f6dfa6 lib/debugfs: Add igt_assert_crc_equal
Because of hash collisions tests should only ever compare crc
checksums for equality. Checking for inequality can result in random
failures.

To ensure this only expose and igt_assert function and use that.
Follow-up patches will rework the code for tests which don't follow
this requirement and try to compare for CRC inequality.

v2: Rebase on top of Matt's kms_plane changes.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-03-23 11:02:28 +01:00
Tvrtko Ursulin
e36091d1c7 tiling: Convert framebuffer helpers to use fb modifiers
This converts the IGT API only, underneath legacy set_tiling is still used.

v2: One got away in kms_flip.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-03-12 14:23:48 +00:00
Daniel Vetter
57259d714d lib/igt_debugfs: Don't setup crc in _new
The problem is that this causes writes to registers, and if the pipe
is off they might go nowhere (e.g. when runtime pm is enabled).
Furthermore we can only really check once the modeset setup is done,
but again most tests set up the CRC structure before calling
igt_commit and friends. We could add crc restore support to the
kernel's rpm code, but that will end up being rather invasive and
fragile hard-to-test code.

Now originally this was needed back when CRC support wasn't available
everywhere. But that's fixed now.

So given all this just drop that sanity check and make sure that we
only touch the debugfs file (and so the hw state) when we know the
pipe is running in the desired configuration.

A complementary kernel patch will try to catch offenders by returning
-EIO if the pipe is off.

v2: Forgot to git add one hunk.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86092
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2014-11-24 16:29:27 +01:00
Sonika Jindal
47246981b2 kms_rotation_crc: Add test for cursor rotation (v2)
v2: Slight rebasing onto latest i-g-t codebase (Matt).

Signed-off-by: Sonika Jindal <sonika.jindal@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-10-23 17:51:47 +02:00
Imre Deak
c256af5d44 test/kms, pm: use drm_open_any_master
These tests require DRM master right, so make sure they have it from the
beginning. This gives an early indication if another DRM master is running
and makes the given test skip (with a proper explanation of the reason)
instead of exiting with error.

Signed-off-by: Imre Deak <imre.deak@intel.com>
2014-09-30 16:46:28 +03:00
Sonika Jindal
4428151960 kms_rotation_crc: Calling commit2 instead of legacy commit
Since planes are universal now, using commit2 so that drmModeSetPlane can be
called for primary plane as well instead of drmModeSetCrtc. drmModeSetPlane will
update the x,y,w,h for the plane.

Cc: Damien Lespiau <damien.lespiau@intel.com>

Signed-off-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-08-26 12:46:57 +02:00
Thomas Wood
1bec6cb2c2 tests: check plane rotation is reset after the VT mode is restored
Make sure the rotation is reset after the VT mode is restored by
collecting the unrotated CRC and comparing with the CRC value after VT mode
has been restored. The CRC is used to ensure the hardware state is checked,
rather than any software state.

References: https://bugs.freedesktop.org/show_bug.cgi?id=82236
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-08-14 16:34:34 +01:00
Daniel Vetter
33f0884f3c lib/igt_kms: set_vt_graphics_mode is a low-level helper
So give it a kmstest_ prefix and shuffle it around a bit.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-08-12 19:36:53 +02:00
Damien Lespiau
92a2b292df kms_rotation_crc: Use the igt_kms enum to encode the plane rotation
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:23 +01:00
Damien Lespiau
a58f8b93b4 kms_rotation_crc: Remove unnecessary includes
Turns out we didn't need most of them.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:23 +01:00
Damien Lespiau
1a75439667 kms_rotation_crc: Always use the primary plane to compute the reference CRC
Trying to disable the primary planes isn't exactly working at the
moment. W/A it until it works.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:23 +01:00
Damien Lespiau
282f5605b0 kms_rotation_crc: Document the two steps in prepare_crtc()
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:23 +01:00
Damien Lespiau
8767a794bb kms_rotation_crc: Properly paint the whole frame buffer
The -1 meant we weren't properly filling the whole fb.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
1bcac4dcb3 kms_rotation_crc: Don't commit with no fb set up
prepare_crtc() was trying to commit a display state without any fb to
scan out...

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
c4564e0a51 kms_rotation_crc: Allow the sprite test to run even without universal planes
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
2eaa50f02e kms_rotation_crc: No need to test for NULL before freeing the pipe CRC object
igt_pipe_crc_free() does that check already.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
05f90b0308 kms_rotation_crc: Remove plane from the state
having everythin in the data_t structure makes it hard to understand
what should be set when. Replace that by explicit function parameters.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
fe8373d437 kms_rotation_crc: Remove the sleep(2)
One can inspect the output of the igt_kms API by setting
IGT_DISPLAY_WAIT_AT_COMMIT=1.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
ffc954e739 kms_rotation_crc: Remove 'output' from the state
This restore the balance between prepare_crtc() and cleanup_crtc(), both
now taking the output as a parameter.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
b146e8128d kms_rotation_crc: Remove the test on output->valid
This test is already done by the for_each_connected_output() macro.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
aef475b6f9 kms_rotation_crc: Use for_each_pipe()
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
8843bef280 kms_rotation_crc: Remove now unnecessary defines
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
39abe7790f kms_rotation_crc: Use igt_plane_set_rotation()
More code we can remove from the test.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
8facccfae4 kms_rotation_crc: Don't store 'pipe' in the state
This variable is only needed for prepare_crtc(), need need to put it in
the test state.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
f7250d041d kms_rotation_crc: Don't store rotate in the test state
We don't use it anywhere else than the test function.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
eb81a922c7 kms_rotation_crc: Always disable the plane in cleanup
There's no need for this check, always use set_fb(NULL) on the plane.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
13e979c764 kms_rotation_crc: Unify the two tests
The only difference is which plane we are talking about. So we really
need one function here with a paramater.

Well, almost. For the primary plane we need to ensure we support
unviversal planes.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
063d22ecea kms_rotation_crc: Just store the igt_plane_t in data
Now that we're always using an igt_plane_t, we can get rid of ->type to
use ->directly without those switch() or if()/else

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
0b3a30ee5a kms_rotation_crc: Skip the tests if rotation is not supported
This happens when the kernel lacks the rotation patches.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
5edab97f7f kms_rotation_crc: Style issue: binary operators need spaces before and after
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
7ae5d9b347 kms_rotation_crc: Use drm_plane from igt_plane_t
So we don't need all that extra code to grab the drm_plane structure for
the primary_plane.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
7e7c625441 kms_rotation_crc: Remove useless comments
A typical example of what comments shouldn't be:

 case DRM_PLANE_TYPE_PRIMARY: /* primary */

Well, yes!, it's written just there, PRIMARY!

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
19743a1435 kms_rotation_crc: Factor out common primary/sprite code in prepare_crtc()
This results in less code, always a good thing. Also, we only really
need one reference CRC.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
92b29b18ca kms_rotation_crc: Factor out the square drawing function
Making function to the similar things is very common in programming.
Let's do it once again.

Cairo being a drawing library, it can be used to do the rotation!

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
78fac76523 kms_rotation_crc: Fix style issue: single statement conditionals
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00
Damien Lespiau
de9c1687f9 kms_rotation_crc: Fix style issue: '{' at the end of lines
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:22 +01:00