summaryrefslogtreecommitdiff
path: root/lib/ioctl_wrappers.c
AgeCommit message (Collapse)Author
2022-07-09tests/i915/vm_bind: Add vm_bind sanity testNiranjana Vishwanathapura
Add sanity test to exercise vm_bind uapi. Test for various cases with vm_bind and vm_unbind ioctls. Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
2022-07-09lib/vm_bind: Add interface to support VM_BINDAdam Miszczak
Add required library interfaces to support VM_BIND functionality. Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
2022-07-08Revert "lib/i915: request CPU_ACCESS for fb objects"Matthew Auld
This reverts commit 3cf110f8dcd1f4f02cf84339664b413abdaebf7d. This is too big of a hammer it seems, since we can't really support flat-CCS with lmem + smem objects, and here adding the flag means we also attach the smem placement, which seems to break kms_ccs. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Cc: Nirmoy Das <nirmoy.das@intel.com> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
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>
2021-10-03lib: Partially revert 22643ce4014aAshutosh Dixit
In 22643ce4014a ("Return allocated size in gem_create_in_memory_regions() and friends") we modified __gem_create_in_memory_regions and gem_create_in_memory_regions to return the allocated size for buffer objects. However, this also unnecessarily complicates programming in the majority of cases where the allocated size is not needed. For example in several cases it requires tracking the requested and allocated sizes separately, the size used must be strictly uint64_t etc. In order to simplify things and provide greater flexibility, here we change 22643ce4014a to follow the same scheme followed in gem_create_ext (and in gem_create) where __gem_create_ext returns the allocated size but gem_create_ext doesn't. With this change, __gem_create_in_memory_regions returns the allocated size for situations where it is needed but in the majority of cases where the allocated size is not needed we can just use gem_create_in_memory_regions for casual use as before. v2: Store requested not allocated bo size in intel_buf->size (Zbigniew) Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
2021-09-29Return allocated size in gem_create_in_memory_regions() and friendsAshutosh Dixit
Often the allocated size is of interest and is different from the requested size. Therefore return allocated size for the object (by __gem_create_ext()) in gem_create_in_memory_regions() and friends. v2: Assign buf->size correctly in __intel_buf_init (Zbigniew) Cc: Andrzej Turko <andrzej.turko@linux.intel.com> Cc: Zbigniew Kempczynski <zbigniew.kempczynski@intel.com> Cc: John Harrison <John.C.Harrison@intel.com> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2021-08-06lib/ioctl_wrappers: update set_domain for discreteMatthew Auld
On discrete set_domain is now gone, instead we just need to add the wait. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Ramalingam C <ramalingam.c@intel.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2021-08-06lib/ioctl_wrappers: update mmap_{read, write} for discreteMatthew Auld
We can no longer just call get_caching or set_domain, and the mmap mode must be FIXED. This should bring back gem_exec_basic and a few others in CI on DG1. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Ramalingam C <ramalingam.c@intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2021-07-15lib/ioctl_wrappers: drop gem_require_stolen_support()Lucas De Marchi
There is no such thing in the kernel as ioctl DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE returning a struct with stolen_total_size. So gem_total_stolen_size() always returns 0. Also there are no callers for gem_total_stolen_size(), except for gem_require_stolen_support() which is unused. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
2021-06-30tests/kms: Create buffer object from LMEM for discreteMohammed Khajapasha
Create framebuffer object from lmem for discrete file descriptor The framebuffer backing object should be from local memory for discrete. Cc: Michael J. Ruhl <michael.j.ruhl@intel.com> Signed-off-by: Mohammed Khajapasha <mohammed.khajapasha@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
2021-06-03lib: Use fast WC reads for gem_pread fallbackChris Wilson
Replacing pread with an uncached read is abysmmally slow. Replacing pread with a streaming read is still slow, but at least faster than not. Signed-off-by: Chris Wilson <chris.p.wilson@intel.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
2021-05-27lib/i915/gem_create: Add gem_create_extAndrzej Turko
Add a wrapper for gem_create_ext ioctl (a version of gem_create that accepts extensions). In preparation for the driver change implementing it, a local definition of its id and necessary structs have been added, which are to be erased as soon as those definitions appear in the i915_drm.h file. The new ioctl wrapper is added to a separate file. For consistency the wrapper of the old ioctl, gem_create is moved from ioctl_wrappers to gem_create. Signed-off-by: Andrzej Turko <andrzej.turko@linux.intel.com> Cc: Zbigniew Kempczynski <zbigniew.kempczynski@intel.com> Cc: Dominik Grzegorzek <dominik.grzegorzek@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Chris P Wilson <chris.p.wilson@intel.com> Signed-off-by: Matthew Auld <matthew.auld@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com>
2021-03-17lib/ioctl_wrappers: Keep IGT working without pread/pwrite ioctlsAshutosh Dixit
The general direction at this time is to phase out pread/write ioctls and not support them in future products. This means IGT must handle the absence of these ioctls. This patch does this by modifying gem_read() and gem_write() to do the read/write using the pread/pwrite ioctls first but when these ioctls are unavailable fall back to doing the read/write using a combination of mmap and memcpy. Callers who must absolutely use the pread/pwrite ioctls (such as tests which test these ioctls or must otherwise only use the pread/pwrite ioctls) must use gem_require_pread_pwrite() to skip when these ioctls are not available. v1: Removed __gem_pread, gem_pread, __gem_pwrite and gem_pwrite introduced previously since they are not necessary, gem_require_pread_pwrite is sufficient v2: Fix CI failures in gem_advise and gen9_exec_parse by introducing gem_require_pread_pwrite v3: Skip mmap for 0 length read/write's v4: Remove redundant igt_assert's v5: Re-run v6: s/EOPNOTSUPP/-EOPNOTSUPP/ v7: Rebase on latest master, skip gem_exec_parallel@userptr with gem_require_pread_pwrite v8: Re-run v9: Rebase Acked-by: Dave Airlie <airlied@redhat.com> Acked-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
2021-01-11lib/i915: Split gem_create.c from ioctl_wrappers.cAndrzej Turko
In preparation for a variation on the exisiting GEM_CREATE API, split the ioctl from out of the large ioctl_wrappers.c Signed-off-by: Andrzej Turko <andrzej.turko@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2020-12-12lib: Pass device fd to gem_mmappable_aperture_size()Chris Wilson
In order to find the correct aperture size for the test, we want to pass the test's device into the query. Reported-by: Bruce Chang <yu.bruce.chang@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Bruce Chang <yu.bruce.chang@intel.com> Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
2020-10-28lib/ioctl_wrappers: Improve a confusing commentDominik Grzegorzek
I believe that the word 'mappable' was added there by pasting it from doc comment above. It is quite confusing. Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2020-09-25lib/igt_ioctl_wrappers: Add igt_has_drm_cap ioctl wrapperKarthik B S
Add a generic helper for DRM_IOCTL_GET_CAP ioctl. v10: -No changes. v11: -Pass cap ID instead of the whole structure. (Ville) -Fix the patch ordering. (Ville) Signed-off-by: Karthik B S <karthik.b.s@intel.com> [vsyrjala: make the docs and code match] Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2020-06-03i915: purge i915_gem_create_v2Matthew Auld
The gem_create_v2 uapi was never merged, which would have been a nice addition to allow userspace to utilise stolen memory. Since it can only get in the way at this point, let's just remove it. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2020-05-07lib/i915: Split igt_require_gem() into i915/Chris Wilson
igt_require_gem() is a pecularity of i915/, move it out of the core. Similar opportunistic move of gem_reopen_driver() and gem_quiescent_gpu(). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2020-04-29lib/ioctl_wrappers: Delete gem_total_mappable_size()Ashutosh Dixit
gem_total_mappable_size() has no callers and calls the DRM_I915_GEM_GET_APERTURE ioctl using 'struct local_i915_gem_get_aperture' which has fields which are unsupported in the kernel. Delete the function. Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-12-11lib/ioctl_wrappers: Remove static variables for getting paramsZbigniew Kempczyński
For multi-device support caching parameters (GET_PARAM and other queries) is bad idea. Remove static variables to avoid making wrong decisions in the tests. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-11-28tests/prime_vgem: Skip basic-read/write subtests if not supportedJanusz Krzysztofik
As we've agreed that using I915_GEM_PREAD/PWRITE IOCTLs on dma-buf objects doesn't make much sense, we are not going to extend their handlers in the i915 driver with new processing paths required for them to work correctly with dma-buf objects on future hardware with no mappable aperture. When running on that kind of hardware, just skip subtests which use those IOCTLs. v2: Examine pread/pwrite ABI, not mmap ABI (Chris) v3: Don't use "no mappable GGTT" wording in commit message (Chris) Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-10-19lib: Stop leaking errno from gem_wait()Chris Wilson
We return the error code, errno just adds spam to later unrelated asserts. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Andi Shyti <andi.shyti@intel.com>
2019-04-05lib: ioctl_wrappers: reach engines by index as wellAndi Shyti
With the new engine query method engines are reachable through an index and context they are combined with. The 'gem_has_ring()' becomes 'gem_context_has_engine()' that requires the index that the engine is mapped within the driver. The function has been moved from lib/ioctl_wappers to lib/i915/gem_context where it is more appropriate. The previous 'gem_has_ring()' function becomes a wrapper to the new 'gem_context_has_engine()'. Signed-off-by: Andi Shyti <andi.shyti@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2019-03-29Revert "lib/igt_device: Move intel_get_pci_device under igt_device"Ville Syrjälä
One significant usecase for intel_reg/etc. is to be able to examine the hardware state *before* loading the driver. If the tool forces the driver to load we've totally lost that capability. This reverts commit 8ae86621d6fff60b6e20c6b0f9b336785c935b0f. Cc: Michał Winiarski <michal.winiarski@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Michał Winiarski <michal.winiarski@intel.com>
2019-03-20lib/igt_device: Move intel_get_pci_device under igt_deviceMichał Winiarski
It allows us to make things a little bit more generic. Also, we now require fd rather than doing guesswork when it comes to pci address. v2: Use readlinkat rather than string concat, move stuff around, provide a version that does not assert. (Chris) v3: Print addr on failure, avoid assignment in conditionals. (Chris) Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-02-26lib/i915: Move mmap IOCTLs wrappers into separate fileAntonio Argenziano
Move all mmap flavours and support function to separate file in i915 folder. This helps with moving i915 specific functions away from common libraries. v2: - Autotools still exists. (Petri) - Include gem_mman.h directly. (Chris) v3: - Keep includes explicit. (Chris) Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-01-21lib/ioctl_wrappers: Help static analysis with execution flowPetri Latvala
If an ioctl fails, errno is set to non-zero, and static analysis doesn't quite get it. Add igt_assume()s where applicable. v2: Braces on both branches of an if (Chris) Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-01-16lib/ioctl_wrapper: Implement __gem_mmapLukasz Kalamarz
Previous implementation of __gem_mmap__cpu and __gem_mmap_wc only differ with setting proper flag for caching. This patch implement __gem_mmap, which merge those two functions into one v2: Reordered and splited this patch into two separete patches v3: Dropped unnecessary check v4: Remerge patches again and fixed __gem_mmap description Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com> Cc: Michal Winiarski <michal.winiarski@intel.com> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-01-16lib/ioctl_wrapper: use defines for get_param instead of param numberLukasz Kalamarz
In lib code there were few functions using param number instead of defines. We would like to use defines, since they are providing more information to user comparing to param number. v2: Rebased patch v4: Fixed commit message Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com> Cc: Michal Winiarski <michal.winiarski@intel.com> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
2018-10-17lib: Don't call igt_require_fb_modifiers() when no modifierDeepak Rawat
vmwgfx and amdgpu doesn't support fb modifiers, yet kms_addfb() requires modifier support. Since many tests don't need this to run, the requirement can be made less broad. Therefore, tighten the requirement to cases where modifiers are actually needed. v2: * In create_fb() calls to kms_addfb(), remove the modifier flag iff the driver doesn't support modifiers and the modifer is 0 * Don't modify the flag in kms_addfb(). Signed-off-by: Deepak Rawat <drawat@vmware.com> Signed-off-by: Leo Li <sunpeng.li@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2018-10-16lib: Skip tests that require fb modifiers when KMS is disabledJosé Roberto de Souza
When KMS is disabled, drmGetCap() for DRM_CAP_ADDFB2_MODIFIERS() will return -1 and set errno as EOPNOTSUPP, the current assert was only checking for a sucess result or invalid argument causing prime_vgem@basic-fence-flip test to fail when KMS is disabled. Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2018-09-26lib: Unexport gem_gtt_type()Chris Wilson
Nobody uses the function directly, instead using the various helpers to determine if ppgtt is present. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
2018-09-25lib/kms: Pass the number of planes explicitly to __kms_addfb()Ville Syrjälä
Currently __kms_addfb() assumes that only the first plane can be at offset 0. I don't particularly like such assumptions so let's just pass in the number of planes explicitly. We'll also require offsets[] to be passed in always. Nothing really to gain by making it optional. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2018-09-25lib/kms: Pass strides[] to __kms_addfbVille Syrjälä
Make __kms_addfb() usable with planar formats by passing in the stride for each plane. v2: Handle strides[1] for planar formats in kms_available_modes_crc Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@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-05-07lib: drop drmtest dependency on intel_batchbufferLionel Landwerlin
It doesn't look like there should be a dependency there. v2: s/intel_batchbuffer/intel_reg/ v3: One more s/intel_batchbuffer/intel_reg/ in benchmarks Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
2018-03-26lib/dummyload: Add pollable spin batchTvrtko Ursulin
Pollable spin batch exports a spin->running pointer which can be checked by dereferencing it to see if the spinner is actually executing on the GPU. This is useful for tests which want to make sure they do not proceed with their next step whilst the spinner is potentially only being processed by the driver and not actually executing. Pollable spinner can be created with igt_spin_batch_new_poll or __igt_spin_batch_new_poll, after which igt_spin_busywait_until_running can be used to busy wait until it is executing. v2: * Move READ_ONCE to igt_core. * Add igt_spin_busywait_until_running. (Chris Wilson) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
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-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-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-01-04lib/gem: Reset the global seqno at the start of each testChris Wilson
When we require GEM, reset the global seqno. This gives each test a clean slate to work with, and avoids left-over state from previous tests impacting on the next. In particular, somes tests may be setting up long sequence of stalling batches not expecting to hit a seqno wraparound (leftover from, for example, gem_exec_whisper), causing long GPU hangs and incompletes in CI if they do. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2017-11-21lib: Use drm-uapi/i915_drm.h instead of local defines.Eric Anholt
The MMAP_V2 is replaced by just using MMAP, since the official header has the updated struct. The gem_create_v2 and gem_get_aperture are left as is, because they seem to not be reflected in the UABI header! Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-11-21lib: Use the imported uapi's addfb2 defines.Eric Anholt
Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-10-17lib/i915: Move context related helpers to lib/i915/gem_contextMichał Winiarski
We'd like to make ioctl_wrappers a bit thinner, and we plan to add new helpers in the following patch. Let's move context related helpers before adding more content. Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2017-10-03lib: Fixup __gem_create() to be 64b safe.Chris Wilson
We want to create very large objects, larger than the 2G limit imposed by using ints. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviwed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
2017-10-03lib: Report the error from __gem_create()Chris Wilson
We have two style of ioctl wrappers. The principle interface does error checking on behalf of the caller (to avoid having lots of repetitious code in each test), and for the few cases where the error is important for the test, we also expose a double underscore version. Fix up __gem_create() to follow this pattern and report the negative error code returned by the kernel. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
2017-09-08lib/ioctl_wrappers: make the valgrind wrapper always emit a statement:wDaniel Vetter
gcc complains otherwise about empty ; statements ... Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-09-08build: use HAVE_LIBGEN_H consistentlyDaniel Vetter
Also, we are _GNU_SOURCE, so simplify the conditions accordingly. The next patch will remove _GNU_SOURCE everywhere else. Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-09-06lib: Avoid actually throttling from igt_require_gem()Chris Wilson
igt_require_gem() checks whether we can use the i915 fd for submitting requests by detecting a wedged driver. It was intended to be used just after opening DRIVER_INTEL for a gem test to provide an early skip if the device was unusable. However, it is also used at the start of library functions like igt_spin_batch_new() which may be called after the test has setup some state, and importantly submitted some batches. igt_require_gem() has the risk of then waiting on those batches, unless we tell it to use a clean fd. v2: Chase the /proc/self/fd/$fd link 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>