summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2022-06-30lib/i915: request CPU_ACCESS for fb objectsMatthew Auld
kms_frontbuffer_tracking@basic falls over if the fb needs to be migrated from non-mappable device memory, to the mappable part, due to being temporarily pinned for scanout, when hitting the CPU fault handler, which just gives us SIGBUS. If the device has a small BAR let's attempt to use the mappable portion, if possible. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
2022-06-30lib/i915/intel_memory_region: plumb through the cpu_sizeMatthew Auld
Will be useful later. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
2022-06-30lib/i915: add gem_create_with_cpu_access_in_memory_regionsMatthew Auld
Most users shouldn't care about such an interface, but where required, this should be useful to aid in setting NEEDS_CPU_ACCESS for a given BO. Underneath we try to smooth over needing to provide an explicit SMEM region, or if this is SMEM-only, we don't want the kernel to throw an error. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
2022-06-30lib/i915: wire up optional flags for gem_create_extMatthew Auld
For now limit to direct callers. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
2022-06-30lib/i915_drm_local: Add I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESSMatthew Auld
For now dump into i915_drm_local.h. Once the uapi on the kernel side is merged, and is part of drm-next, we can sync the kernel headers and remove this. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
2022-06-28tests/i915: adapt __copy_ccs for discreteMatthew Auld
We can't explicitly control the mmap caching type for discrete, but using mmap_device_coherent should be good enough here on such devices. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/4842 Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
2022-06-28lib/igt_fb: Ignore the X component when computing CRCMaxime Ripard
The igt_fb_get_fnv1a_crc() function will compute a FNV-1a hash over the content of the framebuffer. The sole user of this function is the writeback test suite, which will use it to compare an XRGB8888 buffer used in input to an XRGB8888 buffer filled by the writeback connector. However, that function uses each bytes of each buffers to compute the hash, and therefore the writeback code assumes that the hardware will preserve the content of the X component through the writeback pipeline, which isn't true for all hardware. VC4 doesn't for example. Since that function is only ever used for XRGB8888 buffers, let's just set the most significant to 0 (which is the X padding) for each pixel when computing the hash, and thus ignore whatever the hardware will return here. Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2022-06-28tests/kms_writeback: Use endianness accessor to fill pixelsMaxime Ripard
The fill_fb() function in the kms_writeback test suite will fill an XRGB8888 buffer using a pattern passed an an argument. However, the pattern is native endian, while XRGB8888 is little-endian. Add an accessor and use it to fill the framebuffer with our pattern. Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2022-06-17lib/igt_fb: Allow XY_FAST_COPY_BLT on DG2Imre Deak
Allow XY_FAST_COPY_BLT on DG2. This fixes x-tiled blits on DG2. Signed-off-by: Imre Deak <imre.deak@intel.com> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5450 Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5409 Tested-by: Mika Kahola <mika.kahola@intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2022-06-15lib/i915: Fix ATS-M definitionsKarolina Drobnik
Instead of using a separate "is_ats_m" flag, reuse "is_dg2" in ATS-M intel_device_info definition. Delete is_ats_m in intel_device_info struct definition and IS_ATS_M() macro, as they are no longer needed. Signed-off-by: Karolina Drobnik <karolina.drobnik@intel.com> Acked-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
2022-06-15lib/igt_kms: Add a helper function to check Bigjoiner supportBhanuprakash Modem
Create a helper function to check that the system supports the given crtc/connector mode(s). Example: * Pipe-D won't support Bigjoiner, hence we can't use the connector modes greater than 5K on Pipe-D * To use 8K mode on a pipe, then the consecutive pipe must be free. The Kernel is expected to reject the invalid combo (which must be validated as a scenario separately). So, this helper function checks the validity of the combo to avoid failures. To use this helper, each individual subtest needs to set the @pipe to a specific @output by igt_output_set_pipe() and call this helper to check the validity of the combo. V2: * Rebase * Add support to handle fused pipes V3: * Reject the bigjoiner if the consecutive pipe is not available Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com> Reviewed-by: Manasi Navare <manasi.d.navare@intel.com> Reviewed-by: Karthik B S <karthik.b.s@intel.com>
2022-06-14lib/igt_debugfs: Add IGT_CRC_SOURCE environmental variableJessica Zhang
Adds support for the IGT_CRC_SOURCE environmental variable to make it easier for drivers to run tests using custom CRC sources. Example usage: `IGT_CRC_SOURCE=intf ./kms_pipe_crc_basic` If the IGT_CRC_SOURCE isn't set, use the original source that was passed in as a parameter to pipe_crc_new(). Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-06-14tests/i915/query: Query, parse and validate the hwconfig tableRodrigo Vivi
Newer platforms have an embedded table giving details about that platform's hardware configuration. This table can be retrieved from the KMD via the existing query API. So add a test for it as both an example of how to fetch the table and to validate the contents as much as is possible. Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Cc: Slawomir Milczarek <slawomir.milczarek@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com>
2022-06-14lib/intel_memory_region: Fix missing header inclusionJanusz Krzysztofik
IGT commit 68efa99c62e2 ("i915/gem_eio: Exercise object creation while wedged") extended lib/i915/intel_memory_region.h header with a definition of new struct gem_memory_region. That structure contains a member of type struct drm_i915_gem_memory_class_instance, but definition of that type is not available unless "i915_drm.h" header is included. Include the missing header. ../lib/i915/intel_memory_region.h:118:44: error: field ‘ci’ has incomplete type 118 | struct drm_i915_gem_memory_class_instance ci; Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-06-13lib/i915_crc: Introduce crc32 on gpu for DG2Zbigniew Kempczyński
Adding crc32 calculation on gpu gives us new possibility to verify data integrity without relying on trust cpu mapping is correct. Patch introduces calculating crc32 on DG2 only. On older gens ALU (MI_MATH) doesn't support bit-shifting instructions as well as multiply or divide. Emulating n-bit shifts cost hundred of instructions with predicated SRM (works on render engine only). Another limitation is lack of indexed load / store. On DG2 we can use WPARID and CS_MI_ADDRESS_OFFSET to achieve indexed operation on memory. Due to performance reasons (cpu crc32 calculation even on WC memory is still much faster than on gpu, also depends on calculated object memory region) calculation will complete in reasonable of time only for few MiB. v2: - use registers relative to engine to allow run on all engines (Chris) - use predication instead of memory access to get better performance (Chris) - add location where crc32 implementation comes from (Petri) v4: - use common crc32 table from igt_crc - add docs v5: - change BIT(n) to informative macros (Zbigniew) Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com>
2022-06-13lib/igt_crc: Introduce common place for crc tables and functionsZbigniew Kempczyński
Add crc32 table for on-cpu crc calculation function. Other tables and algorithms should be added here allowing reuse tables for in-gpu crc calculation. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-06-13lib/intel_reg: Add common MI_* macros to remove duplicatesZbigniew Kempczyński
In few tests we got some MI_* duplicates (MI_MATH for example). Add common definitions in intel_reg.h and remove local definitions in the tests. v2: Definitions MI_LOAD_REGISTER_MEM_GEN8 was removed so from now on user will need to encode length on it own. : Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-06-09i915/gem_exec_balancer: Fix execution of parallel-submit on dg2+Chris Wilson
From dg2, there are multiple compute engines which conflict with the parallel-submit restriction; check for the illegal engine class prior to running the test. And from dg2, MI_ATOMIC is only valid for use with system memory for INC, DEC and MOV operation, not the ADD used in the test workload. Replace the ADD+1 with an INC, so that the same workload runs on all platforms. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6157 Signed-off-by: Chris Wilson <chris.p.wilson@intel.com> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
2022-06-07lib/intel_chipset: restore usage of has_flatccs flagJuha-Pekka Heikkila
When older patches had been merged on top of newer patches has_flatccs flag usage had gotten lost, put it back here. While at it also set has_flatccs flag to take only one bit since it is of boolean type. CC: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Acked-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2022-06-03lib/igt_kms: Call get_assigned_primary only if display is initializedJessica Zhang
Move code for getting the driver-assigned primary plane to before the `out` tag. This will avoid any crashes in cases where the display resources haven't been initialized. Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
2022-06-01tests/amdgpu: refactoring and update amd_basic testsVitaly Prosyak
1. Create auxiliary directory amdgpu into igt-gpu-tools/lib Put all helpers and reusable functions into this directory using the following assumptions: - group memory alloc/free functions into separate file amd_memory.c and h. - group command submissions helper functions for GFX, COMPUTE and SDMA into separate file amd_command_submission.c and h. - for compute put nop command submission into separate file amd_compute.c and h. - for graphics put command submission into separate file amd_gfx.c and h. - for fence put command submission into separate file amd_fence.c and h. 2. Simplify implementation and reduce the number of local variables and allocations. 3. The file igt-gpu-tools/tests/amdgpu/amd_basic.c has only functions responsible for single sub test: - amdgpu_memory_alloc - amdgpu_userptr_test - amdgpu_command_submission_gfx - amdgpu_command_submission_compute - amdgpu_command_submission_multi_fence - amdgpu_command_submission_sdma - amdgpu_semaphore_test 4. No helper functions into amd_basic.c file. 5. Updated command submissions for secure buffer. Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com> Reviewed-by: Christian Koenig <christian.koenig@amd.com> Reviewed-by: Alexander Deucher <alexander.deucher@amd.com>
2022-06-01lib/igt_kms: Add helper functions to sort drm modesBhanuprakash Modem
Add helper function to sort drm modes based on the clock, resolution in both ascending & descending order. V2: * Minor changes V3: * Added documentaion for helper functions Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com> Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2022-06-01lib/i915: Add ATS-M definitionsKarolina Drobnik
Add local definitions for ATS-M to enable it for testing. Signed-off-by: Karolina Drobnik <karolina.drobnik@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-05-31igt: Promote/rename OS helpersRob Clark
Promote intel_os.c helpers to igt_os.c, so that I can re-use them for some additional msm tests. Just big churny rename, no functional change. Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-05-31lib/igt_debugfs: Drop-caches support for msmRob Clark
Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-05-30lib/drm_fdinfo: Ensure buffer is null terminatedTvrtko Ursulin
Ensure buffer is null terminated at the point where the read ended and not at the end of the whole buffer. Otherwise string parsing can stray into un-initialised memory. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-05-30lib/igt_device_scan: Free filtered devices in igt_devices_freeTvrtko Ursulin
Fix a possible oversight. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2022-05-30lib/igt_kms: Fix mixed declarations warningBhanuprakash Modem
Fix mixed declarations warning introduced by (58a5a2d5) [214/1052] Compiling C object lib/libigt-igt_kms_c.a.p/igt_kms.c.o ../lib/igt_kms.c: In function ‘igt_display_require’: ../lib/igt_kms.c:2468:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 2468 | igt_output_t *output = igt_get_single_output_for_pipe(display, i); | ^~~~~~~~~~~~ Cc: Jessica Zhang <quic_jesszhan@quicinc.com> Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-05-27lib/igt_kms: Set pipe->plane_primary to driver-assigned primary plane when ↵Jessica Zhang
there are multiple possible primary planes Currently, IGT populates pipe->planes using possible_crtcs and assumes that the first primary plane it encounters is the one being actively used by the pipe. This is not always true in cases where there are multiple possible primary planes. This will cause problems whenever IGT calls drmModePageFlip since drmModePageFlip will use the primary plane assigned to the pipe by the driver to perform the page flip [1]. So a mismatch between the primary plane used by IGT and the driver can cause the page flip to fail. To fix this, let's implement a helper method to get the primary plane that's being assigned to the pipe by the driver. We can then call it during igt_display_require() and, if there's a mismatch between pipe->plane_primary and the assigned primary plane's index, we can swap the unused primary plane with the driver-assigned primary plane [1] https://gitlab.freedesktop.org/drm/msm/-/blob/msm-next/drivers/gpu/drm/drm_plane.c#L1234 Changes since v1: - Instead of swapping the pointers of the planes within the array, we can just change the value of pipe->plane_primary. Changes since v2: - Reverted `if (type == DRM_PLANE_TYPE_PRIMARY)` conditional then added a nested if statement to increment num_primary_planes if plane type is primary. Changes since v3: - Created helper method igt_pipe_has_valid_output and added a check for if pipe has valid output before getting the output of a pipe to get the assigned primary plane - Reverted back to using igt_swap to swap the order of the primary planes within the pipe->planes array. Some kms_* tests use igt_output_get_plane(output, 0) to get the primary plane, so this will avoid regressions in those tests. - Updated the plane->index of the primary planes that are being swapped. Suggested-by: Rob Clark <robdclark@chromium.org> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Mark Yacoub <markyacoub@chromium.org>
2022-05-26lib/intel_allocator: Add flag signalling multiprocess readynessZbigniew Kempczyński
Currently when children processes try to communicate to not existing allocator thread they got crash with vague SIGSEGV. Adding readyness flag and detailed explanation in assert should hint the developer to add missing intel_allocator_multiprocess_start|stop) functions. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-05-26lib/kms: Replace libdrm connector name with outputSwati Sharma
Use libdrm connector name from output->name, instead of constructing it from drm resources. Suggested-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com> Signed-off-by: Swati Sharma <swati2.sharma@intel.com> Reviewed-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
2022-05-25lib/igt_aux: fix kselftest module unloadMauro Carvalho Chehab
Most of the time, i915 module unload happens inside a subtest. So, using igt_fork() is OK. However, on i915_selftest, this is called earlier, at igt_kselftest_begin. This causes an error on IGT: forking is only allowed in subtests or igt_simple_main please refer to lib/igt_core documentation As igt_fork() can only be used inside subtests. So, use igt_fork_helper() instead. Reviewed-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-25lib/igt_core: use print_backtrace() on internal_assert()Mauro Carvalho Chehab
When internal_assert() hits, it is desired to know what part of the code actually hit the issue. Reviewed-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-25lib/intel_batchbuffer: Use detected start offset in intel-bb instead 0x0Zbigniew Kempczyński
On some platforms (like on ATS) 0x0 may not be available so allocator should be instantiated with safe start offset to avoid getting -ENOSPC. Change require also relaxation of automatic range selection in the allocator. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com> Cc: Dominik Grzegorzek <dominik.grzegorzek@intel.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
2022-05-25tests/kms_chamelium: Check if port adapters are in useRyszard Knop
If a DUT has Chamelium ports connected via an adapter (for example, DP on the Chamelium side -> DP-HDMI adapter -> HDMI on the DUT), this will usually cause many tests to fail. If mismatching port types are found on both sides, the tests will now be aborted with a warning. This behavior can be overridden with a new AdapterAllowed config value, which must be set in [Chamelium:PORT] blocks in .igtrc. Signed-off-by: Ryszard Knop <ryszard.knop@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-05-25lib/DG2: create flat ccs framebuffers with 4-tileJuha-Pekka Heikkilä
Add support for DG2 flat ccs framebuffers with tile-4. Signed-off-by: Juha-Pekka Heikkilä <juha-pekka.heikkila@intel.com> Signed-off-by: Jeevan B <jeevan.b@intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2022-05-24lib/igt_fb: Add support for drawing rectangles with random colorsAndré Almeida
Add support for drawing rectangles with random colors, useful for tests that you don't mind which color will be used. Signed-off-by: André Almeida <andrealmeid@igalia.com> Reviewed-by: Melissa Wen <mwen@igalia.com> Reviewed-by: Alex Hung <alex.hung@amd.com>
2022-05-18lib: Optional autosuspend_delay_ms configurationAnshuman Gupta
Add an option to configure autosuspend_delay_ms as i915 read autosuspend_delay_ms to all PCI devices under GFX root port. configuring autosuspend_delay_ms as optional. Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com> Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
2022-05-18lib/igt_pm: D3Cold runtime pm infrastructureAnshuman Gupta
Enable gfx card pci devices runtime pm for all pci devices and bridge under the topology of Gfx Card root port. Added a library function to get the PCI root port ACPI D state and to print the pci card devices runtime pm status. v2: - Save pci dev power attrs to dynamically allocated array. [Rodrigo] - Set autosuspend delay to 0 on supported devices. [Rodrigo] - %s/else if/else in igt_pm_get_acpi_real_d_state. [Kamil] v3: - Add comment for MAX_PCI_DEVICES. [Badal] - Use static global array __pci_dev_pwrattr[]. [Rodrigo] - Use pci_slot_match iter. [Badal] - Destroy the iter. [Badal] v4: - Added igt_pm_enable_pci_card_autosuspend() to avoid any control attr save/restore by exit handler. [Rodrigo] v5: - Code refactoring to avoid code duplication. - Few function name changed. [Rodrigo] %s/igt_pm_enable_pci_card_autosuspend/igt_pm_enable_runtime_pm. %s/__igt_pm_setup_pci_card_runtime_pm/igt_pm_setup_pci_dev_power_attrs. %s/igt_pm_setup_power_attr/igt_pm_write_power_attr. v5: - %s/igt_pm_save_power_attr/igt_pm_read_power_attr/ - Added len argument to igt_pm_write_power_attr(). Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2022-05-18lib/igt_device: Get gfx PCI card root portAnshuman Gupta
Utility library function to get the Gfx Card PCI topology root port pci device using libpaciaccess. root port will be used to get the real ACPI D state. Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2022-05-18lib/igt_aux: get rid of passing pipewire-pulse pid on functionsMauro Carvalho Chehab
The logic already stores pw-reserve PID on a static var. Store also the pipewire-pulse pid, in order to keep passing the arguments on all functions. Suggested-by: Andi Shyti <andi.shyti@linux.intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-18lib/igt_kmod: properly handle pipewire-pulseMauro Carvalho Chehab
Newer distributions like Fedora and openSUSE thumbweed are now coming with pipewire-pulse instead of pulseaudio - either as default or as an optional audio stack. That adds a new requirement when unloading sound drivers, which, in turn, is needed when the DRM driver is bound into it. Add the needed logic to work properly in case pipewire-pulse is detected. Tested on ADL-N with Fedora 35 and wireplumber: IGT-Version: 1.26-g982672f3 (x86_64) (Linux: 5.18.0-rc7-drm-ad75b5b819c9+ x86_64) Starting subtest: unbind-rebind process 585 (alsactl) is using audio device. Should be terminated. process 11932 (pipewire) is using audio device. Should be terminated. process 11937 (pipewire-pulse) is using audio device. Should be requested to stop using them. Preventing pipewire-pulse to use the audio drivers Device Audio0 can not be acquired: Success reserve acquired Unloaded audio driver snd_hda_intel Realoading snd_hda_intel Subtest unbind-rebind: SUCCESS (2.603s) Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-18lib/igt_core: export kill_children() functionMauro Carvalho Chehab
This function is needed outside igt_core. So, make it exportable, and allow passing different signs to the children. Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-18lib/igt_kmod: make it less pedantic with audio driver removalMauro Carvalho Chehab
Current Linux Kernel don't report if the audio driver binds into the DRM driver. As this is CPU specific, allow audio driver unload fail without skipping the IGT tests on legacy Kernels, as this may not be mandatory. On new kernels where lsmod will properly display the dependency between the audio and DRM drivers, skip the core hotunplug test if it fails to unload the audio driver, as this is unrelated to the DRM driver - and it could simply because there are some userspace code using the audio device while the IGT test is running. Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-18lib/igt_kmod: don't leak who from module unload routinesMauro Carvalho Chehab
Add code to free allocated strings at the module unload routines from igt_kmod. Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-18lib/igt_kmod: improve audio unbind logicMauro Carvalho Chehab
The dependencies between audio and DRM drivers are not trivial. On several CPUs, the logic inside snd-hda-intel, for instance, tries to hook into i915 driver, via drm_audio_component logic. That also happens when there's no runtime PM. When the audio driver is bound into i915, removing or unbinding i915 without first removing the audio driver produce Kernel errors. So, the audio driver(s) should be removed first, and this can only happen after pulseaudio, pipewire-pulse, audioctl and any other userspace program stops using it. This is more prune to failures. So, the best is to only try to stop the audio driver when it is known to have dependencies on the video driver. Before an upcoming Kernel patch, there's no way to detect if the audio driver required a DRM one. So, the safest way is to always remove the audio drivers that are known to cause issues. After the new Kernel, the logic can be more selective, only removing the audio driver if /proc/modules shows dependencies with the DRM driver. Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-18lib/igt_kmod: always fill who when unloading audio driverMauro Carvalho Chehab
As we'll use this information at core_hotunplug to announce when an audio module is unloaded, fill it even if return code is zero. Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-18tests/core_hotunplug: properly finish processes using audio devicesMauro Carvalho Chehab
Before unloading or unbinding an audio driver, all processes that are using it must be terminated. The current logic seeks only for alsactl, but ignore other processes, including pulseaudio. Make the logic more general, extending it to any processes that could have an open device under /dev/snd. It should be noticed that some distros like Fedora and openSUSE are now migrating from pulseaudio into pipewire-pulse. Right now, there's no standard distribution-agnostic way to request pipewire-pulse to stop using audio devices, but there's a new patch upstream that will make things easier: https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/6ad6300ec657c88322a8cd6f3548261d3dc05359 Which should be available for pipewire-pulse versions 0.3.50 and upper. Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-17lib/intel_batchbuffer: Fix typo from src_tiling to dst_tilingJeevan B
fix typo to avoid CRC mismatch for tile-4 tests Signed-off-by: Jeevan B <jeevan.b@intel.com> Fixes: ff9b8f21ce93 ("igt/lib: Add tile 4(F-tile) format support") Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
2022-05-17lib/igt_kms: Add helper functions to read few debugfsBhanuprakash Modem
Add helper functions: - Read maximum bpc from connector debugfs - Read Current bpc from crtc debugfs - Compare/Assert if Current & Requested bpc are not equal V2: * New function to compare current & requested bpc Cc: Mark Yacoub <markyacoub@chromium.org> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com> Reviewed-by: Swati Sharma <swati2.sharma@intel.com>