summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2018-09-14intel: Be consistent with test results on simulationTvrtko Ursulin
Tests which call intel_require_memory currently always skip on simulation, unless they fail first due insufficient memory. This can create different outcomes depending on the simulation environment so move the simulation skip to the start of the function for 100% consistency in results. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-09-14igt_sysfs: Avoid double closing the fd in igt_sysfs_scanfTvrtko Ursulin
fdopen takes ownership of the fd so only one flavour of closing it is needed. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-09-11lib: Add roundup_power_of_two()Ville Syrjälä
Add a helper to round a value to the next power of two size. And since we need fls() to implement that, reuse that elsewhere as well. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-09-11lib/igt_fb: Make fb size 64bitVille Syrjälä
Switch all fb size handling to 64bits to accomodate >4GiB framebuffers. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-09-07lib: Cancel all outstanding requests at the end of a testChris Wilson
Quite often on catastrophic failure the test leaves a long queue of unterminated batches pending execution. Each runs until hangcheck fires and skips onto the next, leaving us waiting for a very long time at test exit. On older kernels, this gracefully degrades into the existing mechanism. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
2018-09-07lib/igt_fb: Add missing set_domain callsVille Syrjälä
We're missing some set_domain calls around the ggtt mmap paths. This means we never tell the kernel that we've dirtied the object. And then at some point down the line the kernel throws the pages into /dev/null instead of hanging on to them/swapping them out because they were never marked as dirty. Throw in the missing set_domains(GTT,GTT) calls and rip out the old bogus set_domain(CPU,CPU). Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
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-09-05lib/debugfs: Function to read debugfs with the directory already openDhinakaran Pandiyan
tests/kms_frontbuffer_tracking and tests/kms_psr read debugfs nodes several times after opening the directory once. There is already an implementation of this in the kms_frontbuffer_tracking, moving that functionality to the library will allow us to share the code with kms_psr and kms_fbcon_fbt Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2018-09-05lib/pm: Fail gracefully if CONFIG_PM is not built into the kernelChris Wilson
We report the failure from igt_setup_runtime_pm() so that the caller can decide how they may proceed, so replace the hard assert with the error propagation. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Imre Deak <imre.deak@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2018-09-04lib/pm: Increase snd module probe timeout to 10sChris Wilson
5s is often not enough for the sound module to finish loading, so bump the timeout to 10s. For fun, poll quicker over the first 1s! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.linux.com> Reviewed-by: Imre Deak <imre.deak@intel.linux.com>
2018-09-04lib/pm: Wait a little for sound module load to completeChris Wilson
Sometimes we may probe the sound module as it is still being registered and its debugfs not yet fully populated. If we do not find a file we expect to exist, sleep a little and check again. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107801 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.linux.com> Reviewed-by: Imre Deak <imre.deak@intel.linux.com>
2018-09-04lib/pm: Squelch warning for failing to enable audio powermanagementChris Wilson
It doesn't seem to be preventing rpm (see the pm_rpm tests) if we fail to enable runtime-powermanagement for audio, so reduce the warning to a debug. It will still be visible if it fails, but only if it fails. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
2018-09-03lib: Check for a specific match if requested.Chris Wilson
We only want to allow driver_open to match an unknown driver if asked for DRIVER_ANY, so we need to double check. Fixes: 9e5fa9112546 ("lib/drmtest: Move open device to separate function") Reported-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2018-09-03lib: Fix strcmp() direction for bsearch.Chris Wilson
I fluked out as vgem was the initial mid value, hiding the worst of the errors as i915 matched with DRIVER_ANY. Fixes: 20087bf22698 ("lib: Use a bsearch to find the module name") Reported-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2018-09-03lib: Use a bsearch to find the module nameChris Wilson
Even with a small number of known drivers (6), a bsearch will take at most 3 steps, whereas the linear search will take 3 steps on average. In the future with more known drivers, the logN bsearch will be even more advantageous. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
2018-09-01lib/drmtest: Move open device to separate functionKatarzyna Dec
While working on IGT code and during reviewes I've noticed that it could be nice to have function that is opening particular device. Let's move out conditions for opening device and rename __open_device to __search_and_open() function. v2: Refactored open_device even more by getting device name once and returning fd for it. (Chris) v3: Added name_size to __get_drm_device_name, removed unused is_X_device. v4: Fixed cases with failing virtio_gpu v5: Rebase, indent fixes Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-08-31lib: Stop caching __drm_device_idChris Wilson
In a multi-device system there is no guarantee that the fd being probed in intel_get_drm_devid() is the same as was opened earlier. Any cache may outlive the fd, so is frought with lifetime issues. The primary reason for caching the devid was to avoid extra ioctls in the dmesg/strace, but hopefully all users now grab the id in their fixture and not inside every function. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
2018-08-30lib/sysfs: Avoid using FILE* temporary for igt_sysfs_[v]printfChris Wilson
Currently we wrap our fd inside a FILE* stream to make use of vfprintf, but the man page leaves the question of errno and signal handling in doubt. It is documented as returning a negative value and setting ferror(), but we have been interpreting errno to handle signal restarting. As that is in doubt, reduce it to a sprintf and reuse our common interrupt handling write() that already returns -errno. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
2018-08-30lib/core: Use libdw to decode stack trace with debugging symbols, v2.Maarten Lankhorst
libdw is a new dependency built from the elfutils package. It provides us a way to generate line numbers and file names from the instruction pointer. elfutils is LGPLv3 or GPLv2, so it's ok to link against it. Before: IGT-Version: 1.23-g8ae86abd419d (x86_64) (Linux: 4.16.0-1-amd64 x86_64) Starting subtest: fail-result (meta_test:29661) CRITICAL: Test assertion failure function test_result, file ../tests/meta_test.c:94: (meta_test:29661) CRITICAL: Failed assertion: result == 1 (meta_test:29661) CRITICAL: error: 0 != 1 Stack trace: #0 [__igt_fail_assert+0x20a] #1 [test_result+0x7a] #2 [__real_main120+0x240] #3 [main+0x4a] #4 (../csu/libc-start.c) __libc_start_main:344 #5 [_start+0x2a] After: IGT-Version: 1.23-g8ae86abd419d (x86_64) (Linux: 4.16.0-1-amd64 x86_64) Starting subtest: fail-result (meta_test:1357) CRITICAL: Test assertion failure function test_result, file ../tests/meta_test.c:94: (meta_test:1357) CRITICAL: Failed assertion: result == 1 (meta_test:1357) CRITICAL: error: 0 != 1 Stack trace: #0 ../lib/igt_core.c:1467 __igt_fail_assert() #1 ../tests/meta_test.c:95 test_result() #2 ../tests/meta_test.c:137 __real_main120() #3 ../tests/meta_test.c:120 main() #4 ../csu/libc-start.c:344 __libc_start_main() #5 [_start+0x2a] Changes since v1: - Add libdw dependency to readme. - Change backtrace format slightly. Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> [mlankhorst: Add description about libdw in commit msg, name -> dwfl_name] Reviewed-by: Petri Latvala <petri.latvala@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-08-30lib/kms: Remove special enum handling and replace with call to ↵Maarten Lankhorst
igt_plane_set_prop_enum, v2. We now have infrastructure for generic enum handling. This will make it easier to write new tests without defining all enum constants beforehand. Changes since v1: - Fix compile error, sent old version by accident. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2018-08-30lib/igt_kms: Add try_prop_enum and set_prop_enum for mode objects, v2.Maarten Lankhorst
This adds the possibility to test arbitrary enumerations in IGT without having to define mappings for each and every one. Changes since v1: - Add commit description. - Add try_prop_enum, to allow handling unknown enumerations. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2018-08-17lib: Poll for snd_hda_intel discoveryChris Wilson
Loading the sounds modules is asynchronous with the sysfs device hierarchy being instantiated sometime after modprobe returns. As such while we are probing for the sound device, poll a few times to accommodate the async discovery. v2: closedir() after use Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
2018-08-16Revert "lib: Keep upto half of RAM reserved for test runner"Chris Wilson
This reverts commit 2c7224e488457afb7bb76664c4b7c857baef1e08 as it was accidentally pushed when fixing up the pm_rpm compilation. Oops. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Petri Latvala <petri.latvala@intel.com>
2018-08-16lib: Keep upto half of RAM reserved for test runnerChris Wilson
Halve our estimated available RAM for use by the tests to avoid nasty situations where the test runner may force us into swap. Rumour has it that the new runner isn't quite so bloated as piglit... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tomi Sarvela <tomi.p.sarvela@intel.com> Cc: Petri Latvala <petri.latvala@intel.com>
2018-08-14lib: sync with the newer i915_pciids.h from the kernel (CFL)Rodrigo Vivi
One more CFL ID added to spec. Align with kernel commit d0e062ebb3a4 ("drm/i915/cfl: Add a new CFL PCI ID.") v2: Fixed commit subject per Petri request. Cc: José Roberto de Souza <jose.souza@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2018-08-14lib/igt_debugfs: Add igt_pipe_crc_get_current() to get a crc.Maarten Lankhorst
A pair of igt_pipe_crc_drain() and igt_pipe_crc_get_single() has a bug in which you're not sure whether the new CRC is captured because the vblank irq may race against the CRC irq and delivered to userspace too soon. When receiving a vblank event, igt_pipe_crc_drain() will then drain all crc's, but not the new (stale) crc, which is then delivered and immediately returned by igt_pipe_crc_get_single(). Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2018-08-14lib/igt_debugfs: explicitly wait for first crc in igt_pipe_crc_startMahesh Kumar
Now crc framework does not wait for first CRC during open, User need to wait for crc if he wants so. This patch make changes in igt_pipe_crc_start to make sure we wait until first crc available after open to keep the tests behaviour same. Without this if driver is skipping few initial crcs there will be mismatch in expected and actual number of crcs returned by crc framework. Changes Since V1: - poll instead of read_one_crc (Maarten) Changes Since V2: - poll without timeout, we already have igt_timeout (Maarten) Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2018-08-09uwildmat: Case-insensitive test selectionPetri Latvala
Since we only use plain ascii in subtest names, using non-locale-aware tolower() to compare case-insensitively works. Doing this within uwildmat instead of tolowering the subtest name and then calling uwildmat() is required, because of selection strings like: foo,bar,!Foo The above line will select subtest Bar, and not select Foo. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-08-09lib: Export igt_gettime and igt_time_elapsedPetri Latvala
Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-08-09lib: Print subtest starting/ending line to stderr tooPetri Latvala
when instructed via the environment. This is needed for the new test runner to properly assign stderr output to the correct subtest. v2: Print the subtest result from skip_subtests_henceforth handling also to stderr. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-08-02lib/igt_pm: Export function to restore runtime PM statusTvrtko Ursulin
In cases when runtime PM is enabled only from individual subtests and not whole tests it is usable to be able to restore the old runtime PM config and so avoid running subsequent subtests in an unexpected environment. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-08-02lib/igt_pm: Find HDA device when attempting to enable runtime PMTvrtko Ursulin
HDA audio device can be present at various PCI paths on different systems which the existing code did not account for. Furthermore the failure to enable runtime PM was silent leaving callers in the dark. Improve it by auto-locating the PCI path and logging a warning when something is not as expected. v2: * If there is no audio hw/driver there is no failure. v3: * Comment. * Skip non-symlinks. * Free path on failure and restore. * Simplify with asprintf. (Chris Wilson) v4: * Find snd_hda_intel instance tied with an Intel device. v5: * Fix memory leak and silence Valgrind warning. v6: * Fix error out logic. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-08-02lib/igt_pm: Make exit handlers signal safeTvrtko Ursulin
IGT logging helpers are not signal safe so avoid calling them from exit handlers. At the same time refactor the code a bit to enable following patches. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-07-27lib/igt_core: Fix typoGwan-gyeong Mun
"overridden" was misspelled as "overriden". Fix it. Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2018-07-25build: provide stub implementation for memfd_createLucas De Marchi
When libc misses memfd_create(), provide a stub implementation to go through the syscall() route. Syscall numbers are provided for platforms currently supported by i-g-t only. v2: add support to autotools Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Acked-by: Antonio Argenziano <antonio.argenziano@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2018-07-25build: provide include for missing syscallsLucas De Marchi
Add directory with README file to allow missing syscalls to be defined. The syscalls themselves will be provided in follow up patches. v2: add support to autotools Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Acked-by: Antonio Argenziano <antonio.argenziano@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2018-07-24lib: Don't assert all KMS drivers support edid_overrideChris Wilson
edid_override is a i915.ko debugfs feature; just skip any kms test that depends on being able to override the edid. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107337 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
2018-07-20lib/rendercopy: Fix lack of const throughout gen4 rendercopyChris Wilson
The gen4 code was pushed without being fixed up for the constification of igt_render_copyfunc_t ../lib/intel_batchbuffer.c: In function ‘igt_get_render_copyfunc’: ../lib/intel_batchbuffer.c:837:8: warning: assignment to ‘igt_render_copyfunc_t’ {aka ‘void (*)(struct intel_batchbuffer *, struct _drm_intel_context *, const struct igt_buf *, unsigned int, unsigned int, unsigned int, unsigned int, const struct igt_buf *, unsigned int, unsigned int)’} from incompatible pointer type ‘void (*)(struct intel_batchbuffer *, drm_intel_context *, struct igt_buf *, unsigned int, unsigned int, unsigned int, unsigned int, struct igt_buf *, unsigned int, unsigned int)’ {aka ‘void (*)(struct intel_batchbuffer *, struct _drm_intel_context *, struct igt_buf *, unsigned int, unsigned int, unsigned int, unsigned int, struct igt_buf *, unsigned int, unsigned int)’} [-Wincompatible-pointer-types] copy = gen4_render_copyfunc; Fixes: 61370b2d43db ("lib/rendercopy: Add gen4/5 rendercopy") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2018-07-19lib: Move trash_bos to their only userChris Wilson
Only pm_rpm still uses the igt_trash_aperture() and so we can remove it from the lib and in the process convert it over from the legacy libdrm_intel. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
2018-07-18lib/gen6_render: Drop duplicated definitionsLukasz Kalamarz
Dropping duplicated definitions of registers,fields and shiftsm, which were implemented in gen4 and does not changed in gen6. v3: Rebase Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Cc: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
2018-07-18lib/rendercopy: Use gen4 definitions if applicableLukasz Kalamarz
Instead of using definitions duplicated in gen7_render header, we should use the oldest definition that is working with chosen gen. This patch reuse gen6 definitons if registers/fields/shifts that were introduced in other genX_render headers. v3: Rebase and checkpatch Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Cc: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
2018-07-18lib/rendercopy: Add gen4/5 rendercopyLukasz Kalamarz
Add rendercopy implementation for gen4/5. Basic structure copied from the gen6 implementation, and the gen4/5 specific bits were mostly lifted from sna. v2: Renamed registers definitions, which are GEN4 specific to include that prefix (Lukasz) v3: Rebase and checkpatch Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Cc: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Reviewed-by: Katarzyna Dec <katarzyna.dec@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>
2018-07-13lib/gt: Make use of dummyload library to create recursive batchAntonio Argenziano
An hanging batch is nothing more than a spinning batch that never gets stopped, so re-use the routines implemented in dummyload.c. v2: Let caller decide spin loop size v3: Only use loose loops for hangs (Chris) v4: No requires v5: Free the spinner v6: Chamelium exists. Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> #v3 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
2018-07-13igt/gem_userptr: Check read-only mappingsChris Wilson
Setup a userptr object that only has a read-only mapping back to a file store (memfd). Then attempt to write into that mapping using the GPU and assert that those writes do not land (while also writing via a writable userptr mapping into the same memfd to verify that the GPU is working!) v2: Pull the random batch construction into a routine to avoid duplication. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2018-07-12igt/pm_rpm: Pass NULL to require no extra module optionsChris Wilson
We use options!=NULL to determine if we should require the module to be reloaded and fail if we find it already loaded. In pm_rpm, we are only ensuring the MSR module is loaded, and only want default options. Fixes: 4dc2ce0e ("lib/kmod: Fail if the module is already loaded") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
2018-07-12lib/igt_kms: simplify pipe <-> name conversionLucas De Marchi
Now that we can use _Static_assert() due to C11, make it future proof so we remember to update this if IGT_MAX_PIPES changes. Also reduce verbosity a little bit by calculating indexes instead of if/else chain. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-07-12lib/igt_core: fix check for running under gdbLucas De Marchi
Properly check for errors and rename the function since we are checking if we are running under gdb, not making it run under gdb. Previously we were passing uninitialized data to basename() due to not properly adding the nul termination. ==22293== Conditional jump or move depends on uninitialised value(s) ==22293== at 0x4C306D0: rindex (vg_replace_strmem.c:199) ==22293== by 0x4EC55DD: basename (in /usr/lib64/libc-2.27.so) ==22293== by 0x400744: running_under_gdb (in /tmp/a) There's another problem with this function that it doesn't detect when we are running gdb from a toolchain using a toolchain triplet, but that's left for another patch. v2: remove the fix for repeating the argument on readlink() since that landed in another patch Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-07-11Avoid truncate string in __igt_lsof_fdsRodrigo Siqueira
Note that 'proc_path' parameter in __igt_lsof_fds receives a string which was initialized with the size of PATH_MAX and the local variable 'path' has the same size, but it also have to append: '/', '\0', and the directory name. This situation caused the warning described below. warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 0 and 4095 [-Wformat-truncation=] snprintf(path, sizeof(path), "%s/%s", proc_path, d->d_name); note: ‘snprintf’ output between 2 and 4352 bytes into a destination of size 4096 [..] This commit fixes this problem by changing the string size passed by __igt_lsoft to __igt_lsof_fds. The max size for the string is strlen("/proc/%d/cwd")+1 where "%d" can be estimated with CEILING(LOG_10(INT_MAX)), in this sense, it is safe to define a path size of 30 characters. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>