mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-11 16:32:58 +00:00
lib/ioctl_wrappers: Add gem_has_softpin
We can move it from softpin test into lib, and since softpin support is highly unlikely to go away in-between getparam ioctl calls, let's just do a single call and store the value. v2: rebase Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
committed by
Daniel Vetter
parent
52b5d5016e
commit
e6ca4bd7cd
@@ -1242,6 +1242,35 @@ uint64_t gem_mappable_aperture_size(void)
|
||||
return pci_dev->regions[bar].size;
|
||||
}
|
||||
|
||||
#define LOCAL_I915_PARAM_HAS_EXEC_SOFTPIN 37
|
||||
/**
|
||||
* gem_has_softpin:
|
||||
* @fd: open i915 drm file descriptor
|
||||
*
|
||||
* Feature test macro to query whether the softpinning functionality is
|
||||
* supported.
|
||||
*
|
||||
* Returns: Whether softpin support is available
|
||||
*/
|
||||
bool gem_has_softpin(int fd)
|
||||
{
|
||||
static int has_softpin = -1;
|
||||
|
||||
if (has_softpin < 0) {
|
||||
struct drm_i915_getparam gp;
|
||||
|
||||
memset(&gp, 0, sizeof(gp));
|
||||
gp.param = LOCAL_I915_PARAM_HAS_EXEC_SOFTPIN;
|
||||
gp.value = &has_softpin;
|
||||
|
||||
has_softpin = 0;
|
||||
ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
return has_softpin;
|
||||
}
|
||||
|
||||
/**
|
||||
* gem_require_caching:
|
||||
* @fd: open i915 drm file descriptor
|
||||
|
||||
@@ -132,6 +132,7 @@ int gem_available_fences(int fd);
|
||||
uint64_t gem_available_aperture_size(int fd);
|
||||
uint64_t gem_aperture_size(int fd);
|
||||
uint64_t gem_mappable_aperture_size(void);
|
||||
bool gem_has_softpin(int fd);
|
||||
|
||||
/* check functions which auto-skip tests by calling igt_skip() */
|
||||
void gem_require_caching(int fd);
|
||||
|
||||
Reference in New Issue
Block a user