diff options
| author | Camus Wong <camusw@codeaurora.org> | 2018-02-16 15:05:57 -0500 |
|---|---|---|
| committer | Camus Wong <camusw@codeaurora.org> | 2018-03-06 09:54:53 -0500 |
| commit | 74f60692b11f61522ca41cc676fcbe7386ff3e2c (patch) | |
| tree | 355e0ee3b9e656b46d453abdadcb8b3a54670b97 /drivers | |
| parent | 99b73ed59a2865a23d0106c4392b6efe31fb5342 (diff) | |
drm/msm-hyp: overwrite hyp ioctls used by libgbm
Handle ioctls called by libgbm in the virtual kernel driver
to support front-end library and avoid modifying libgbm.
Change-Id: Ie4e567cea7338b4ba68080decf85dfa45e040dac
Signed-off-by: Camus Wong <camusw@codeaurora.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpu/drm/msm-hyp/msm_drv_hyp.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm-hyp/msm_drv_hyp.c b/drivers/gpu/drm/msm-hyp/msm_drv_hyp.c index baf7ee266088..133b1220f5fb 100644 --- a/drivers/gpu/drm/msm-hyp/msm_drv_hyp.c +++ b/drivers/gpu/drm/msm-hyp/msm_drv_hyp.c @@ -355,11 +355,35 @@ static int msm_ioctl_query_client_id(struct drm_device *dev, void *data, return ret; } +static long msm_drm_ioctl(struct file *filp, + unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + case DRM_IOCTL_PRIME_FD_TO_HANDLE: + { + struct drm_prime_handle cmd_data; + + if (copy_from_user(&cmd_data, (void __user *)arg, + sizeof(struct drm_prime_handle)) != 0) + return -EFAULT; + cmd_data.handle = cmd_data.fd; + if (copy_to_user((void __user *)arg, &cmd_data, + sizeof(struct drm_prime_handle)) != 0) + return -EFAULT; + return 0; + } + case DRM_IOCTL_GEM_CLOSE: + return 0; + default: + return drm_ioctl(filp, cmd, arg); + } +} + static const struct file_operations fops = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, - .unlocked_ioctl = drm_ioctl, + .unlocked_ioctl = msm_drm_ioctl, .poll = drm_poll, .read = drm_read, .write = msm_drm_write, |
