lib/ioctl: Document ctx param functions

And move them so that they're grouped with the other context wrappers.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
Daniel Vetter 2015-02-06 17:13:59 +01:00
parent 364efcdf9b
commit 75c075cb26
2 changed files with 63 additions and 38 deletions

View File

@ -662,6 +662,59 @@ void gem_context_destroy(int fd, uint32_t ctx_id)
do_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &destroy);
}
/**
* gem_context_get_param:
* @fd: open i915 drm file descriptor
* @p: i915 hw context parameter
*
* This is a wraps the CONTEXT_GET_PARAM ioctl, which is used to free a hardware
* context. Not that similarly to gem_set_caching() this wrapper calls
* igt_require() internally to correctly skip on kernels and platforms where hw
* context parameter support is not available.
*/
void gem_context_get_param(int fd, struct local_i915_gem_context_param *p)
{
#define LOCAL_I915_GEM_CONTEXT_GETPARAM 0x34
#define LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_GETPARAM, struct local_i915_gem_context_param)
do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, p);
}
/**
* gem_context_set_param:
* @fd: open i915 drm file descriptor
* @p: i915 hw context parameter
*
* This is a wraps the CONTEXT_SET_PARAM ioctl, which is used to free a hardware
* context. Not that similarly to gem_set_caching() this wrapper calls
* igt_require() internally to correctly skip on kernels and platforms where hw
* context parameter support is not available.
*/
void gem_context_set_param(int fd, struct local_i915_gem_context_param *p)
{
#define LOCAL_I915_GEM_CONTEXT_SETPARAM 0x35
#define LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_SETPARAM, struct local_i915_gem_context_param)
do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, p);
}
/**
* gem_require_caching:
* @fd: open i915 drm file descriptor
*
* Feature test macro to query whether hw context parameter support for @param
* is available. Automatically skips through igt_require() if not.
*/
void gem_context_require_param(int fd, uint64_t param)
{
struct local_i915_gem_context_param p;
p.context = 0;
p.param = param;
p.value = 0;
p.size = 0;
igt_require(drmIoctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, &p) == 0);
}
/**
* gem_sw_finish:
* @fd: open i915 drm file descriptor
@ -1089,29 +1142,3 @@ off_t prime_get_size(int dma_buf_fd)
return ret;
}
void gem_context_get_param(int fd, struct local_i915_gem_context_param *p)
{
#define LOCAL_I915_GEM_CONTEXT_GETPARAM 0x34
#define LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_GETPARAM, struct local_i915_gem_context_param)
do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, p);
}
void gem_context_set_param(int fd, struct local_i915_gem_context_param *p)
{
#define LOCAL_I915_GEM_CONTEXT_SETPARAM 0x35
#define LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_SETPARAM, struct local_i915_gem_context_param)
do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, p);
}
void gem_context_require_param(int fd, uint64_t param)
{
struct local_i915_gem_context_param p;
p.context = 0;
p.param = param;
p.value = 0;
p.size = 0;
igt_require(drmIoctl(fd, LOCAL_I915_GEM_CONTEXT_GETPARAM, &p) == 0);
}

View File

@ -97,6 +97,16 @@ int gem_madvise(int fd, uint32_t handle, int state);
uint32_t gem_context_create(int fd);
void gem_context_destroy(int fd, uint32_t ctx_id);
int __gem_context_destroy(int fd, uint32_t ctx_id);
struct local_i915_gem_context_param {
uint32_t context;
uint32_t size;
uint64_t param;
#define LOCAL_CONTEXT_PARAM_BAN_PERIOD 0x1
uint64_t value;
};
void gem_context_require_param(int fd, uint64_t param);
void gem_context_get_param(int fd, struct local_i915_gem_context_param *p);
void gem_context_set_param(int fd, struct local_i915_gem_context_param *p);
void gem_sw_finish(int fd, uint32_t handle);
@ -125,16 +135,4 @@ int prime_handle_to_fd(int fd, uint32_t handle);
uint32_t prime_fd_to_handle(int fd, int dma_buf_fd);
off_t prime_get_size(int dma_buf_fd);
struct local_i915_gem_context_param {
uint32_t context;
uint32_t size;
uint64_t param;
#define LOCAL_CONTEXT_PARAM_BAN_PERIOD 0x1
uint64_t value;
};
void gem_context_require_param(int fd, uint64_t param);
void gem_context_get_param(int fd, struct local_i915_gem_context_param *p);
void gem_context_set_param(int fd, struct local_i915_gem_context_param *p);
#endif /* IOCTL_WRAPPERS_H */