summaryrefslogtreecommitdiff
path: root/lib/igt_psr.c
AgeCommit message (Collapse)Author
2022-03-28tests: Add a new test to stress PSRJosé Roberto de Souza
This tests is intended to reproduce a issue found in real world but the software enviroment to reproduce it was not easy to duplicate, so this test was written to make it easy to reproduce it, debug and fix. To make sure we don't regress it in the future here the test. It mixes page flips and frontbuffer writes in primary and overlay planes and expects that PSR stays active after each subtest without any warnings or underruns. Reviewed-by: Jouni Högander <jouni.hogander@intel.com> Cc: Mika Kahola <mika.kahola@intel.com> Cc: Jouni Högander <jouni.hogander@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2022-03-16lib/igt_psr: pass higher versions of PSR SU panelsDavid Zhang
[why] From eDP 1.5 (eDP 1.4b SCR adopted), a higher version of PSR-SU eDP panel, i.e. version 0x4, is added into spec. Need to treat such PSR panel as PSR capable sink device. [how] validate the PSR capable sink for higher PSR version 0x4. Cc: Rodrigo Siqueira <rodrigo.siqueira@amd.com> Cc: Harry Wentland <harry.wentland@amd.com> Cc: Leo Li <sunpeng.li@amd.com> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com> Cc: Wayne Lin <wayne.lin@amd.com> Signed-off-by: David Zhang <dingchen.zhang@amd.com> Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
2021-11-25tests/kms_cursor_legacy: Disable Intel's PSR2 selective fetch in this testJosé Roberto de Souza
When doing a primary or sprite plane flip, PSR2 selective fetch code also adds all the planes including cursor that overlaps with the area being updated, so this causes legacy cursor API calls to wait for a pending atomic commit to finish causing tests that do checks with vblank counters. So here when running in an Intel platform that has PSR2 selective fetch enabled, it will switch to PSR1 before executing the subtests. Because what this whole test mostly wants to do, is check if userspace can do asynchronous cursors updates. v2: - rename functions and add documentation Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2346 Reviewed-by: Jouni Högander <jouni.hogander@intel.com> Cc: Mika Kahola <mika.kahola@intel.com> Cc: Jouni Hogander <jouni.hogander@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2021-11-03tests/kms_async_flips: Skip test when running with Intel's PSR2 selective ↵José Roberto de Souza
fetch enabled Intel's PSR2 selective fetch adds other planes to state when necessary, causing the async flip to fail because async flip is not supported in cursor plane. v2: - adding a description to the skip message Cc: Petri Latvala <petri.latvala@intel.com> Cc: Karthik B S <karthik.b.s@intel.com> Cc: Vandita Kulkarni <vandita.kulkarni@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2021-10-07tests/kms_psr2_sf: Skip tests if selected fetch is not availableVidya Srinivas
Currently the tests are failing on systems where selected fetch feature is not availble. Kernel returns -EINVAL when the test executes reporting "Invalid debug mask 4". Patch skips if selected fetch feature is not available in the kernel. v2: Incorportated Mark Yacoub's comments. Changed igt_skip to igt_require_f v3: Changing to igt_require(ret > 0) which is equivalent to original igt_assert(ret > 0) Reviewed-by: Mark Yacoub <markyacoub@chromium.org> Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
2021-03-02tests/kms_psr2_sf: Enable selective fetch feature in kernelJosé Roberto de Souza
Enable PSR2 selective fetch using debugfs during test setup, this will allow us to have some test coverage of this feature by CI. Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Cc: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
2021-01-08lib/igt_psr: Add function to check PSR2 selective fetchPankaj Bharadiya
Add a helper function to check whether "PSR2 selective fetch" is enabled. This function should be used wherever "PSR2 selective fetch" status check needed. Reviewed-by: Jose Roberto de Souza <jose.souza@intel.com> Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
2020-07-29tests/kms_psr2_su: Change to igt_info when the failing of PSR2 enablingGwan-gyeong Mun
The psr_print_debugfs() function uses igt_debug() for logging. As igt_require() does not raise printing out of IGT_LOG_DEBUG level. It changes igt_debug() to igt_info() for getting log on skipping test case of kms_psr2_su. v2: Address José's review comments. - Use igt_info for getting log instead of using igt_assert in order to avoid failure of psr test. Cc: José Roberto de Souza <jose.souza@intel.com> Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2020-06-12tests/kms_psr2_su: Print errno while it fails to read debugfsGwan-gyeong Mun
This tests is being sporadically skipped in CI as it is not due "PSR sink not reliable: yes". This commit adds printing of debugfs ("tests/kms_psr2_su: Print debugfs when skipping test"), but it is not enough to track error cases. It adds printing of errorno while it fails to read debugfs. Cc: José Roberto de Souza <jose.souza@intel.com> Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2020-06-02tests/kms_psr2_su: Print debugfs when skipping testJosé Roberto de Souza
This tests is being sporadically skipped in CI as it is not due "PSR sink not reliable: yes" lets print the i915_edp_psr_status to find out the reason. This can be reverted afterwards. Reference: https://gitlab.freedesktop.org/drm/intel/-/issues/1911 Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2020-06-02tests/kms_psr2_su: Read su blocks of frame 1 if frame 0 is 0José Roberto de Souza
Not sure why but in recent kernels + IGT when PSR status debugfs is read the frame already passed, so the su blocks is set in frame 1 and causing the test to fail for page flips. So here reading from frame 1 if frame 0 has 0 blocks, as this test always changes screen with the same number of su blocks it is not a issue. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/608 Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2020-05-20Always pass device to igt_params_setChris Wilson
Don't second guess, require the user to provide the device that wish to set the module parameter for. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
2020-05-08lib/params: add igt_params.c for module parameter accessJani Nikula
We have generic helpers for sysfs access in igt_sysfs.c, but we also have a number of module parameter access specific helpers scattered here and there. Start gathering the latter into a file of its own. For i915, the long-term goal is to migrate from module parameters to device specific debugfs parameters. With all igt module param access centralized in one place, we can make the transition much easier. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-04-29tests/kms_fbcon_fbt: Reduce execution time by not calling wait_until_enabled()José Roberto de Souza
After unset all CRTCs is expected that FBC and PSR is disabled, calling wait_until_enabled() will make it wait until timeout to it return false and pass the test. So instead lets implement is_disabled() hook, as the kmstest_unset_all_crtcs() is a synchronous call, the features will be already disabled after it, so no need to do any wait. Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
2019-12-11Revert "lib/igt_psr: Move "is enabled" implementation to lib"José Roberto de Souza
This reverts commit 4bb46f08f7cb6485642c4351cecdad93072d27a0. The next patch have more information about why this patch was reverted. Cc: Jeevan B <jeevan.b@intel.com> Cc: Anshuman Gupta <anshuman.gupta@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-11-18lib/igt_psr: Move "is enabled" implementation to libJosé Roberto de Souza
i915_pm_dc have implemented a function to check if PSR2 is enabled, that may be util to future tests so move it to PSR lib. Cc: Jeevan B <jeevan.b@intel.com> Cc: Anshuman Gupta <anshuman.gupta@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2019-11-18lib/igt_psr: Unset errno when expectedJosé Roberto de Souza
Writing 0xf to i915_edp_psr_debug is expected to have -EINVAL returned in newer kernels but this error actually comes from errno not from the return of write()(check writeN()), so unseting the expected errno so this do not cause tests to skips. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=112257 Cc: Jeevan B <jeevan.b@intel.com> Cc: Anshuman Gupta <anshuman.gupta@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2019-10-24lib/psr: Remove unused functionJosé Roberto de Souza
This function is a left-over from some versions of the patches preparing igt_psr for PSR2 tests and it is not needed. Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2019-10-24lib/psr: Skip PSR tests if sink not reliableJosé Roberto de Souza
Right now if sink reported any PSR error or if it fails to acknowledge the PSR wakeup it sets a flag and do not attempt to enable PSR anymore. That is the safest approach to avoid repetitive glitches and allowed us to have PSR enabled by default. But from time to time even good PSR panels have a PSR error, causing tests to fail. And for now we are not yet to the point were we could try to recover from PSR errors, so lets check for this information in debugfs and skip PSR tests because of sink errors and eliminate this noise from CI runs. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109454 Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Matt Roper <matthew.d.roper@intel.com> Cc: Ap Kamal <kamal.ap@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2019-04-15tests/fbcon_fbt: Add and user psr_long_wait_update()José Roberto de Souza
When fbcon is enabled, PSR will be active between cursor blinks so what it should really use to test PSR is psr_wait_entry(), so a new feature callback was added. But the fbcon cursor blinks at 5hz what give us 200ms between each screen update what make psr_wait_update() prone to fail the test because it timed out before a blink could happen, so here adding and using psr_long_wait_update() that have a longer timeout. v3: - 3 previous patches squashed in this one (Maarten) - Back to !feature->wait_until_enabled() to test feature state when all CRTCS are disabled(Dhinakaran) Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Dhinkaran Pandiyan <dhinakaran.pandiyan@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2019-02-13test: Add PSR2 selective update testsJosé Roberto de Souza
This tests checks if hardware is able to do selective update when screen changes. PSR2 don't trigger interruptions and the 'PSR2 SU status' register is not kept loaded all the times, so it is necessary keep polling PSR status debugfs until those values are loaded. Also from DEEP_SLEEP state HW will not do a seletive update, as most of the memory/context is lost in deep sleep state hardware will need to exit PSR mode then wait a configured number of frames to activate PSR again to then start doing seletive updates, that is why just one screen change is not enough to pass this tests. When a selective update happens and the values are loaded and read from debugfs it is compared with the expected value of seletive update blocks, if matches the polling is stopped and the test passed otherwise it will wait until it reachs a maximum number o screen changes to fail the test. v2: Using new SU blocks debugfs output v3: - removed the timerfd to fail the test, now failing based in a maximum number of screen changes - removing thread to read debugfs, read from main thread is enough - improved commit message v4: - getting cairo context for frontbuffer test in prepare() - droppoing poll(), using blocking timerfd instead v5: - Doing a modeset before trying to enable PSR2 v6: - doing atomic commits to fix(legacy commit is taking more time in recent kernels causing us to miss the SU when reading debugfs) and speedup test - fixed code to skip test when PSR2 is not possile Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Tested-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2019-02-01tests/kms_frontbuffer_tracking: Fix skips when PSR is not available.Maarten Lankhorst
Use psr.can_test to determine we can disable PSR, and not skip because PSR is unavailable. Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Cc: José Roberto de Souza <jose.souza@intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2019-02-01lib/psr: Do not use out of bound enum for psr_set.Maarten Lankhorst
Using an undefined int not in the enum is undefined. Use -1 and change mode to an integer. Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Cc: José Roberto de Souza <jose.souza@intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2019-01-22lib/psr: Add PSR2 support to the remaning psr functionsJosé Roberto de Souza
Add the mode parameter to psr_enable() and psr_sink_support() so PSR1 and PSR2 can be tested separated. For now all PSR tests will run only with PSR1 and the tests for PSR2 will come in the future. Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2019-01-22lib/psr: Make psr_wait_entry and psr_wait_update aware of the PSR version testedJosé Roberto de Souza
This way we can test both PSR version separated. v4: Dropping psr_state_check() to psr_active_check() Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2019-01-22lib/psr: Rename psr_wait_exit to psr_wait_updateJosé Roberto de Souza
This is a initial preparation for PSR2 test support, as in PSR2 a update to screen could mean that PSR is still active and the screen will be update by a selective update this renamed is necessary. Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2019-01-22lib/psr: Only care about DEEP_SLEEP state for PSR2José Roberto de Souza
To check if PSR is active it search for SRDENT for PSR1 and it was searching for SLEEP for PSR2 but it should really seach for DEEP_SLEEP as in this state display block is actualy saving a substancial amount of power. Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2019-01-22lib/psr: Add support to new modified i915_edp_psr_status outputJosé Roberto de Souza
The kernel patch 'drm/i915: Refactor PSR status debugfs' changed the output of i915_edp_psr_status, so adding support to the new output here while keeping the support to the old one for a while. In psr_active() we were overdoing, we just need to check the source state to know if PSR is active and doing that we keep compability to old and new i915_edp_psr_status output. Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2019-01-14tests/psr: Share the code check if sink supports PSRJosé Roberto de Souza
The same code checking if sink supports PSR was spread into 3 tests, better move it to lib and reuse. v2: splitted previous patch into this one and the next one(Dhinakaran) Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2019-01-14lib/psr: Add a macro with the maximum lenght of i915_edp_psr_status and use itJosé Roberto de Souza
So every function reading i915_edp_psr_status can allocate a buffer long enough. Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2018-09-28tests/psr: Check for PSR entry less frequentlyDhinakaran Pandiyan
We currently read debugfs every 1 ms, given that it takes about 140 ms for PSR entry on the CI machines and entry can occur at frame time intervals, bump the debugfs read interval to 20 ms. Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2018-09-28tests/psr: Wait for PSR exitDhinakaran Pandiyan
PSR appears to not exit immediately after the test commits a page flip, give some leeway for PSR to idle. Let's set the timeout at 40 ms with a 5 ms interval between each status read. Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2018-09-20lib/igt_psr: Give a explicit parameter name to functions that expect debugfs fdJosé Roberto de Souza
Let's rename to debugfs_fd all the parameters of the functions that expect debugfs fd to avoid call one those functions with the wrong file descriptor. Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2018-09-05tests/psr: Avoid opening of already open debugfs dirDhinakaran Pandiyan
The tests calls igt_debugfs_dir() to open the debugfs dir and further along calls igt_debugfs_read() each time i915_edp_psr_status needs to be read. As igt_debugfs_read() opens the directory unnecessarily, switch to using the newly added igt_debugfs_simple_read() v2: Commit message typo (Jose) Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2018-08-30lib/psr: Add support for toggling edp psr through debugfs, v5.Maarten Lankhorst
It's harmful to write to enable_psr at runtime, and the patch that allows us to change i915_edp_psr_debug with the panel running will require us to abandon the module parameter. Hence the userspace change needs to be put in IGT first before we can change it at kernel time. Toggling it to debugfs will mean we can skip a modeset when changing our feature set. Changes since v1: - Rebase with the previous patches dropped. Changes since v2: - Rebase on top of new api in i915_edp_psr_debug. Changes since v3: - Enable IRQ debugging for extra logging. - Force PSR1 mode. (dhnkrn) - Move PSR enable/disable functions to lib/igt_psr. (dhnkrn) Changes since v4: - Redisable irqs right away when debugfs api doesn't work. (dhnkrn) - Use hex everywhere. (dhnkrn) Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> [mlankhorst: Fix -ENODEV explanation in has_psr_debugfs (dhnkrn)] Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
2018-07-17tests/psr: Move PSR state test functions to libDhinakaran Pandiyan
kms_frontbuffer_tracking and kms_psr test PSR in different ways, let' fix that by creating common library functions. v2: Include the new file in meson.build v3: Leave --no-psr intact (Rodrigo) Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>