summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2018-03-20igt: Replace 'all-engines' magic numbers with macroAntonio Argenziano
In interfaces where a parameter allow to select an engine, we usually use '-1' or '~0u' to select all engines. This patch replaces magic numbers with a named constant. Suggested-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-03-19lib/igt_kms: Add functions to get only a single output for a pipe, v2.Maarten Lankhorst
igt_get_single_output_for_pipe() will give a valid output for a pipe, for_each_pipe_with_single_output will iterate over all pipes, and will be called for each pipe with an output once. Changes since v1: - pipe = __outputs - __output returned a negative number for pipe, correctly set it to __output - __outputs. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2018-03-16lib: Parse plane IN_FORMATS blobifiers into a nicer formVille Syrjälä
Maintain straight up arrays of format+modifier tuples for each plane, and also collect up a similar device wide array. These will make it easy to confirm whether each plane (or the whole device) supports a specific format+modifier pair. v2: s/igt_hweight64/igt_hweight/ Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-03-16lib: Add igt_hweight()Ville Syrjälä
Add the binary hamming weight helper to igt_aux.h. v2: Add just the one macro that works for 64 and 32 bits (Chris) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-03-15lib/igt_kms: Fix enum type in igt_pipe_has_prop.Maarten Lankhorst
Found when compiling igt with clang: [284/819] Compiling C object 'tests/kms_crtc_background_color@exe/kms_crtc_background_color.c.o'. ../tests/kms_crtc_background_color.c:140:48: warning: implicit conversion from enumeration type 'enum igt_atomic_crtc_properties' to different enumeration type 'enum igt_atomic_connector_properties' [-Wenum-conversion] Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2018-03-12lib/igt_kms: Fix igt_plane_reset to handle cursor planes correctly tooMaarten Lankhorst
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-03-12intel_chipsets: store GT information in device infoLionel Landwerlin
Right now we define this only for big core skus and leave the gt field to 0 to mean unknown. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-03-12include: bump drm uAPI headersLionel Landwerlin
Taken from drm-tip : commit 1e6aa7e55c28ecd842b8b4599e4273c2429ee061 Author: Jani Nikula <jani.nikula@intel.com> Date: Tue Mar 6 12:41:55 2018 +0200 drm/i915/icl: do not save DDI A/E sharing bit for ICL Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Acked-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2018-03-07lib: Use C99 initialisers to clear context parametersChris Wilson
valgrind complains we feed uninitialised stack into the CONTEXT_SETPARAM ioctl. It is unused by the kernel, but valgrind doesn't know that and it's easy enough to clear the struct to prevent the warning. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2018-03-07Bump measure_ring_size() timer intervalChris Wilson
It appears that waiting for a 100us period whereby we are unable to submit another batch and proclaim the ring full, may have the false positive where the scheduler intervenes and we are signalled twice before having slept on ring space. Increasing the interval reduces the likelihood of the scheduler stealing the cpu from us, but does not eliminate it. Fortuitously it appears to be a rare false positive. For the library routine, we can fork a RT process but that seems a bit overkill! References: https://bugs.freedesktop.org/show_bug.cgi?id=105343 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Antonio Argenziano <antonio.argenziano@intel.com> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
2018-03-05lib/sysfs: s/kick_fbcon/bind_fbcon/Ville Syrjälä
Rename kick_fbcon() into bind_fbcon() so that it's not so confusing. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-03-05lib/sysfs: Fix fbcon unbind, againVille Syrjälä
Looks like unbinding the dummy con doesn't work on all machines. Instead we have to bind fbcon (which is what we used to do before commit d18fca7f6cf3 ("lib/sysfs: Fix fbcon rebind")). Since some machines need the bind and others need the unbind let's do both. The most obvious difference I observed between two machines that behave differently was the order in which the console drivers were listed in sysfs. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-03-05lib/igt_pm: Restore runtime pm state on test exitTvrtko Ursulin
Some tests (the ones which call igt_setup_runtime_pm and igt_pm_enable_audio_runtime_pm) change default system configuration and never restore it. The configured runtime suspend is aggressive and may influence behaviour of subsequent tests, so it is better to restore to previous values on test exit. This way system behaviour, with regards to a random sequence of executed tests, will be more consistent from one run to another. v2: Read failure means no runtime pm support so don't assert on it. v3: Install exit handler before the write to close the Ctrl^C race. (Imre) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Imre Deak <imre.deak@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> # v2 Acked-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
2018-03-05tests/perf_pmu: Handle CPU hotplug failures betterChris Wilson
CPU hotplug, especially CPU0, can be flaky on commodity hardware. To improve test reliability and reponse times when testing larger runs we need to handle those cases better. Handle failures to off-line a CPU by immediately skipping the test, and failures to on-line a CPU by immediately rebooting the machine. This patch includes igt_sysrq_reboot implementation from Chris Wilson. v2: Halt by default, reboot if env variable IGT_REBOOT_ON_FATAL_ERROR is set. (Petri Latvala) v3: Add missign docs and update stale comment. (Petri Latvala) v4: Use pause instead of sleep. (Chris Wilson) v5: Newlines! (Chris Wilson) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Tomi Sarvela <tomi.p.sarvela@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2018-03-03lib: Fix MI_BATCH_BUFFER_START for hang injectionChris Wilson
A couple of bugs inside the hang injector, the worst being that the presumed_offset of the reloc didn't match the batch; so if the reloc was skipped (as the presumed_offset matched the reloc offset), the batch wasn't updated and so we may not have generated a hanging batch at all! Secondly, the MI_BATCH_BUFFER_START was not correct for all gen. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2018-03-01lib: Provide an accelerated routine for readback from WCChris Wilson
Reading from WC is awfully slow as each access is uncached and so performed synchronously, stalling for the memory load. x86 did introduce some new instructions in SSE 4.1 to provide a small internal buffer to accelerate reading back a cacheline at a time from uncached memory, for this purpose. v2: Don't be lazy and handle misalignment. v3: Switch out of sse41 before emitting the generic memcpy routine v4: Replace opencoded memcpy_from_wc v5: Always flush the internal buffer before use (Eric) v6: Assume bulk moves, so check for dst alignment. v7: Use _mm_fence for _buitlin_ia32_mfence for consistency, remove superfluous defines (Ville) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Eric Anholt <eric@anholt.net> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2018-03-01lib/dummyload: Avoid assertions in lowlevel spin constructorChris Wilson
__igt_spin_batch_new() may be used inside a background helper which is competing against the GPU being reset. As such, we cannot even assert that the spin->handle is busy immediately after submission as it may have already been reset by another client writing to i915_wedged. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
2018-02-28lib/igt_draw: Fix bo leak in gpu draw routinesMaarten Lankhorst
gem_handle_to_libdrm_bo creates a new handle through the use of flink, which makes kms_frontbuffer_tracking through a single run not complete when it starts leaking 50MB objects. Add the missing bo_unref to kill the duplicated handle and fix the leaks! Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-02-27meson: Get rid of lib_headersArkadiusz Hiler
Unused since commit 1f53e0dcec7a ("meson: Don't install headers"). Suggested-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com>
2018-02-27igt: Make libudev mandatoryAntonio Argenziano
Since more essential components use libudev, make its dependency mandatory. Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Petri Latvala <petri.latvala@intel.com>
2018-02-27lib/igt_kms: Remove remaining docbook warnings mentioning igt_kms files.Maarten Lankhorst
Some warnings still exist, but they are about missing descriptions for structs enums and their members. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-02-27lib/igt_kms: Fix docbook warningsMaarten Lankhorst
This gets rid of the following warnings: lib/igt_kms.c:2688: warning: Symbol name not found at the start of the comment block. lib/igt_kms.c:2738: warning: Symbol name not found at the start of the comment block. lib/igt_kms.c:2788: warning: Symbol name not found at the start of the comment block. lib/igt_kms.c:2812: warning: Parameter description for igt_pipe_obj_replace_prop_blob::pipe is not used from source code comment block. lib/igt_kms.c:2812: warning: Parameter description for igt_pipe_obj_replace_prop_blob::pipe_obj is missing in source code comment block. lib/igt_kms.c:3794: warning: Parameter description for igt_cleanup_hotplug::mon is missing in source code comment block. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-02-27lib: Export kmsg()Chris Wilson
Export the kmsg() function for use by tests to write into the kernel message log, useful for tests to inline their progress with kernel error messages. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-02-23Iterate over physical enginesChris Wilson
We current have a single for_each_engine() iterator which we use to generate both a set of uABI engines and a set of physical engines. Determining what uABI ring-id corresponds to an actual HW engine is tricky, so pull that out to a library function and introduce for_each_physical_engine() for cases where we want to issue requests once on each HW ring (avoiding aliasing issues). v2: Remember can_store_dword for gem_sync v3: Find more open-coded for_each_physical Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2018-02-23meson: Use bufmgr stubs headers if libdrm_intel is not foundArkadiusz Hiler
Just adding the .h file to lib_headers is not enough. With this change we are passing 'stubs/drm' as a part of include_directories when building, so a proper -I will be issued to the compiler. This can be done by turning 'inc' into a list of include_directories()-generated objects. Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Eric Anholt <eric@anholt.net> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Tested-by: Petri Latvala <petri.latvala@intel.com>
2018-02-23lib/igt_gt: add intel_measure_ring_sizeDaniele Ceraolo Spurio
The logic to measure the ring size is replicated almost identically in several tests. Adding it as a common function will make the code cleaner. The tests are updated in follow up patches. v2: - Move into a new file: 'gem_ring'. (Chris) v3: - Rename ring measure function. (Chris) Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Signed-off-by: Antonio Argenziano <antonio.argenziano@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-02-23lib/igt_dummyload: add igt_corkDaniele Ceraolo Spurio
The "cork" bo (imported bo with attached fence) and fence is used in several tests to stall execution. Moving it to a common place makes the codebase cleaner. Note that the actual test updates is done in follow up patches as it is simpler to do in one go after one more common function is added in the next patch. v2: don't use new/free naming, don't use dynamic alloc (Chris) v3: add sw_sync common functions. (Chris) v4: squash sw_sync and vgem cork structs into one. (Chris) v5: use anonymous enum in cork struct. (Chris) v6: reset cork after unplugging. (Chris) Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-02-22igt: Add igt_vc4_get_param() helperBoris Brezillon
v2: Rebase on get/set_tiling helpers (by anholt). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net>
2018-02-22igt/vc4: Add a helper function to mark BOs purgeableBoris Brezillon
v2: Rebase on get/set_tiling helpers (by anholt). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net>
2018-02-22lib/igt_perf: Find active perf CPUTvrtko Ursulin
Instead of assuming PMU runs on CPU0, try all possible CPUs if that is not the case. This makes the callers handle fallout from broken tests better, as well as sysadmin interventions where callers are not tests. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-02-21igt/gem_eio: Use slow spinners to inject hangsChris Wilson
One weird issue we see in bug 104676 is that the hangs are too fast on HSW! So force the use of the slow spinners that do not try to trigger a hang by injecting random bytes into the batch. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104676 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
2018-02-20lib/igt_kms: Add doc for kmstest_ and igt_ functionsCarlos Santa
It seems some of the documentation is still not complete, finish it for the benefit of IGT newcomers. These functions include: kmstest_dumb_map_buffer kmstest_get_vblank igt_assert_plane_visible igt_display_require_output igt_display_require_output_on_pipe igt_pipe_get_plane_type igt_output_get_mode igt_output_set_pipe igt_output_get_plane_type igt_plane_set_fb igt_plane_set_position igt_plane_set_rotation igt_wait_for_vblank_count igt_wait_for_vblank Signed-off-by: Carlos Santa <carlos.santa@intel.com> CC: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2018-02-20lib: Remove overzealous assertion on gem_set_caching()Chris Wilson
When the asserts were added for the acceptable error codes for SET_CACHING ioctl, foresight was not given to the possibility that the device may not handle the caching mode and return -ENODEV. Remove the error code assertion from the library, that is the job for the ABI tests. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
2018-02-20lib: Always set mismatching index for igt_find_crc_mismatchChris Wilson
igt_debugfs.c: In function 'igt_assert_crc_equal': igt_debugfs.c:353:3: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized] igt_debugfs.c: In function 'igt_check_crc_equal': igt_debugfs.c:375:3: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized] Fixes: 7422d7540a3b ("lib/igt_debugfs: Introduce CRC check function, with logic made common") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
2018-02-20lib: Cache the debugfs mountpointChris Wilson
When using igt_debugfs_*() inside a tight loop, the overhead of calling xstat64 (from is_mountpoint()) creeps up in the profiles. Eliminate it by caching the resultant path for finding/mounting debugfs. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
2018-02-16lib/igt_aux: Add function to swap int64 in arrayAntonio Argenziano
v2: Use igt_swap() Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Michal Winiarski <michal.winiarski@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-02-15lib/i915_pciids.h: Add Cannonlake PCI IDs for another SKU.Rodrigo Vivi
Pure copy of kernel's i915_pciid.h in order to keep in sync with kernel commit '3f43031b1693 ("drm/i915/cnl: Add Cannonlake PCI IDs for another SKU.")' and commit 'e3890d05b342 ("drm/i915/cnl: Sync PCI ID with Spec.")' Cc: James Ausmus <james.ausmus@intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2018-02-15lib/igt_kms: Fix igt_display_drop_events() to work as intendedMaarten Lankhorst
Short reads don't work, you either read the whole event or nothing at all, so follow the recommendations in the documentation and allocate a buffer of 4096 bytes for the event, if we capture multiple events read them all. Cc: Jari Tahvanainen <jari.tahvanainen@intel.com> Reported-by: Jari Tahvanainen <jari.tahvanainen@intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104538 [mlankhorst: Assign ev once in the loop, instead of 2 places. (ickle)] Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-02-15lib/igt_debugfs: Fix igt_pipe_get_crcs.Maarten Lankhorst
read_crc returns an error instead of 0 on timeout now, so handle this correctly. This is a small error introduced in commit 7d48c0252c384d18318de89c54817bdfe9c832fc Author: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Date: Fri Feb 2 13:34:25 2018 +0100 lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v4. It causes the kms_chv_cursor_fail to take 27 minutes, so fix this.. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2018-02-14lib/kms: Clear unused fields for getproperty ioctlChris Wilson
==24749== Syscall param ioctl(generic) points to uninitialised byte(s) ==24749== at 0x6A8ADC7: ioctl (syscall-template.S:84) ==24749== by 0x5067687: drmIoctl (in /opt/xorg/lib64/libdrm.so.2.4.0) ==24749== by 0x138531: kmstest_set_connector_dpms (igt_kms.c:1022) ==24749== by 0x112937: set_dpms (kms_flip.c:263) ==24749== by 0x112937: run_test_step (kms_flip.c:776) ==24749== by 0x112937: event_loop (kms_flip.c:1138) ==24749== by 0x115468: run_test_on_crtc_set (kms_flip.c:1378) ==24749== by 0x115468: run_test (kms_flip.c:1450) ==24749== by 0x1111CF: main (kms_flip.c:1673) ==24749== Address 0x1ffefff2a0 is on thread 1's stack ==24749== in frame #2, created by kmstest_set_connector_dpms (igt_kms.c:1012) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2018-02-13lib: force a reset on an uncooperative i915 deviceChris Wilson
Try to reset the GPU from within igt_require_gem() if we notice we are starting with a wedged device. If it remains wedged, the test definitely cannot run. We leave a warning in place to highlight the potentially suspect result, which will keep the flip-flops alive in CI! v2: Split out device reset to avoid reusing a local variable Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
2018-02-12lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v4.Maarten Lankhorst
Collecting CRC may result in a modeset and extra vblank waits. On some tests this will increase the runtime a lot, so it makes sense to keep it enabled, and only collect the most recent CRC when needed. Changes since v1: - Fix read_crc semantics. (Ville) Changes since v2: - Remove EAGAIN assert, can be reached from drain_crc. Changes since v3: - Do not infinitely loop in igt_pipe_crc_drain(). Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com> #v2 Tested-by: Vidya Srinivas <vidya.srinivas@intel.com>
2018-02-12lib/igt_fb: Remove igt_get_all_cairo_formats()Maarten Lankhorst
All users have been converted to igt_fb_supported_format(), I don't think there's a valid use left for this. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com> Tested-by: Vidya Srinivas <vidya.srinivas@intel.com>
2018-02-12lib/igt_fb: Add igt_fb_supported_format()Maarten Lankhorst
This makes it possible to iterate whether a format is supported or not, without each driver having to open code it. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com> Tested-by: Vidya Srinivas <vidya.srinivas@intel.com>
2018-02-12lib/igt_fb: Make igt_remove_fb more robustMaarten Lankhorst
This will make it easier for tests to unconditionally call igt_remove_fb, without first checking whether the FB is allocated. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com> Tested-by: Vidya Srinivas <vidya.srinivas@intel.com>
2018-02-07lib: Move __gem_context_create to common ioctl wrapper library.Antonio Argenziano
This patch adds a context creation ioctl wrapper that returns the error for the caller to consume. Multiple tests that implemented this already, have been changed to use the new library function. v2: - Add gem_require_contexts() to check for contexts support (Chris) v3: - Add gem_has_contexts to check for contexts support and change gem_require_contexts to skip if contests support is not available. (Chris) v4: - Cosmetic changes and use lib function in gem_ctx_create where possible. (Michal) v5: - Use gem_contexts_require() in tests and fixtures. (Chris) Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-02-01lib/igt_fb: Add support for NV12 format through conversion, v2.Maarten Lankhorst
For NV12 a format conversion is needed. Because YUV formats are not fully defined with just a fourcc, I've chosen BT.601 limited range. This puts the pixel center of the CbCr components between the top left Y and bottom left Y: Y Y Y Y UV UV Y Y Y Y Some work is put into optimising the conversion routines in order to make it fast enough. Before converting nv12 to rgb24, it is copied to a temporary buffer to take advantage of memory caching. This is approximately 20x faster than directly reading the BO. When testing on my KBL with a 1080p buffer, it takes approximately .1s to convert either way, this is fast enough not to bother optimising even further for me. Changes since v1: - Use BT.601 instead of BT.709 coefficients. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2018-02-01lib/fb: Add support for creating planar framebuffers, v3.Maarten Lankhorst
Add support to create planar framebuffers, but don't add formats that support them yet. This first requires conversion to the RGB24 format. Changes since v1: - Don't crash in igt_create_bo_with_dimensions(). Changes since v2: - Zero offsets for dumb fb too. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com> [mlankhorst: Change memset(4 * ..) to memset(ARRAY_SIZE(format->plane_bpp) * ..)]
2018-02-01lib/intel_batchbuffer: Add src/dst delta arguments to igt_blitter_fast_copy tooMaarten Lankhorst
Nothing uses this currently, but other copy functions have the same delta now. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2018-02-01lib/intel_batchbuffer: Add delta argument to igt_blitter_fast_copy__raw, v2.Maarten Lankhorst
Adding a delta offset will allow us to copy planar framebuffers with this function. Changes since v1: - Set src and destination addresses to the delta, in case BO is mapped at offset 0. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com> #v1