drm/msm: rework GEM_INFO ioctl
Prep work to add a way to get/set the GEM objects debug name. Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
parent
7a93d5c38e
commit
789d2e5a77
@ -882,21 +882,31 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
|
|||||||
struct drm_gem_object *obj;
|
struct drm_gem_object *obj;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (args->flags & ~MSM_INFO_FLAGS)
|
if (args->pad)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
switch (args->info) {
|
||||||
|
case MSM_INFO_GET_OFFSET:
|
||||||
|
case MSM_INFO_GET_IOVA:
|
||||||
|
/* value returned as immediate, not pointer, so len==0: */
|
||||||
|
if (args->len)
|
||||||
|
return -EINVAL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
obj = drm_gem_object_lookup(file, args->handle);
|
obj = drm_gem_object_lookup(file, args->handle);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
if (args->flags & MSM_INFO_IOVA) {
|
switch (args->info) {
|
||||||
uint64_t iova;
|
case MSM_INFO_GET_OFFSET:
|
||||||
|
args->value = msm_gem_mmap_offset(obj);
|
||||||
ret = msm_ioctl_gem_info_iova(dev, obj, &iova);
|
break;
|
||||||
if (!ret)
|
case MSM_INFO_GET_IOVA:
|
||||||
args->offset = iova;
|
ret = msm_ioctl_gem_info_iova(dev, obj, &args->value);
|
||||||
} else {
|
break;
|
||||||
args->offset = msm_gem_mmap_offset(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_gem_object_put_unlocked(obj);
|
drm_gem_object_put_unlocked(obj);
|
||||||
|
@ -105,14 +105,22 @@ struct drm_msm_gem_new {
|
|||||||
__u32 handle; /* out */
|
__u32 handle; /* out */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MSM_INFO_IOVA 0x01
|
/* Get or set GEM buffer info. The requested value can be passed
|
||||||
|
* directly in 'value', or for data larger than 64b 'value' is a
|
||||||
#define MSM_INFO_FLAGS (MSM_INFO_IOVA)
|
* pointer to userspace buffer, with 'len' specifying the number of
|
||||||
|
* bytes copied into that buffer. For info returned by pointer,
|
||||||
|
* calling the GEM_INFO ioctl with null 'value' will return the
|
||||||
|
* required buffer size in 'len'
|
||||||
|
*/
|
||||||
|
#define MSM_INFO_GET_OFFSET 0x00 /* get mmap() offset, returned by value */
|
||||||
|
#define MSM_INFO_GET_IOVA 0x01 /* get iova, returned by value */
|
||||||
|
|
||||||
struct drm_msm_gem_info {
|
struct drm_msm_gem_info {
|
||||||
__u32 handle; /* in */
|
__u32 handle; /* in */
|
||||||
__u32 flags; /* in - combination of MSM_INFO_* flags */
|
__u32 info; /* in - one of MSM_INFO_* */
|
||||||
__u64 offset; /* out, mmap() offset or iova */
|
__u64 value; /* in or out */
|
||||||
|
__u32 len; /* in or out */
|
||||||
|
__u32 pad;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MSM_PREP_READ 0x01
|
#define MSM_PREP_READ 0x01
|
||||||
|
Loading…
Reference in New Issue
Block a user