diff options
author | Rob Clark <robdclark@gmail.com> | 2018-11-29 10:27:22 -0500 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2018-12-11 13:07:05 -0500 |
commit | f05c83e7746088e6ada6ce83fd7840b4b7b52ffe (patch) | |
tree | be32cf3e9de934d0cfb7993626cc355c486ea083 /drivers/gpu/drm/msm/msm_drv.c | |
parent | 789d2e5a772ce312a7a2b81ffaf304946195beb5 (diff) | |
download | linux-f05c83e7746088e6ada6ce83fd7840b4b7b52ffe.tar.gz linux-f05c83e7746088e6ada6ce83fd7840b4b7b52ffe.tar.bz2 linux-f05c83e7746088e6ada6ce83fd7840b4b7b52ffe.zip |
drm/msm: add uapi to get/set debug name
Add UAPI to get/set GEM objects' debug name.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_drv.c')
-rw-r--r-- | drivers/gpu/drm/msm/msm_drv.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index fe86c675d5b7..c08f83c7ca57 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -23,6 +23,7 @@ #include "msm_drv.h" #include "msm_debugfs.h" #include "msm_fence.h" +#include "msm_gem.h" #include "msm_gpu.h" #include "msm_kms.h" @@ -880,7 +881,8 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data, { struct drm_msm_gem_info *args = data; struct drm_gem_object *obj; - int ret = 0; + struct msm_gem_object *msm_obj; + int i, ret = 0; if (args->pad) return -EINVAL; @@ -892,6 +894,9 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data, if (args->len) return -EINVAL; break; + case MSM_INFO_SET_NAME: + case MSM_INFO_GET_NAME: + break; default: return -EINVAL; } @@ -900,6 +905,8 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data, if (!obj) return -ENOENT; + msm_obj = to_msm_bo(obj); + switch (args->info) { case MSM_INFO_GET_OFFSET: args->value = msm_gem_mmap_offset(obj); @@ -907,6 +914,33 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data, case MSM_INFO_GET_IOVA: ret = msm_ioctl_gem_info_iova(dev, obj, &args->value); break; + case MSM_INFO_SET_NAME: + /* length check should leave room for terminating null: */ + if (args->len >= sizeof(msm_obj->name)) { + ret = -EINVAL; + break; + } + ret = copy_from_user(msm_obj->name, + u64_to_user_ptr(args->value), args->len); + msm_obj->name[args->len] = '\0'; + for (i = 0; i < args->len; i++) { + if (!isprint(msm_obj->name[i])) { + msm_obj->name[i] = '\0'; + break; + } + } + break; + case MSM_INFO_GET_NAME: + if (args->value && (args->len < strlen(msm_obj->name))) { + ret = -EINVAL; + break; + } + args->len = strlen(msm_obj->name); + if (args->value) { + ret = copy_to_user(u64_to_user_ptr(args->value), + msm_obj->name, args->len); + } + break; } drm_gem_object_put_unlocked(obj); |