diff options
author | Subhajit Paul <a0132170@ti.com> | 2015-09-23 15:48:11 +0530 |
---|---|---|
committer | Praneeth Bajjuri <praneeth@ti.com> | 2016-11-16 16:54:17 -0600 |
commit | 70df70ae0980ee5b1ce367821f74420c5af83f3b (patch) | |
tree | df6559c9b5a0ba11c4773aa11ddfbcad9fdef87c | |
parent | 858b406569ba443a448f01da7d91a07e8e8d0743 (diff) | |
download | jacinto6evm-70df70ae0980ee5b1ce367821f74420c5af83f3b.tar.gz |
temp-patch for plane locking
Signed-off-by: Subhajit Paul <a0132170@ti.com>
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_fops.c | 10 | ||||
-rw-r--r-- | include/drm/drmP.h | 2 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 8 |
5 files changed, 37 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 903db3cf288a..42e73ecaa935 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -1947,6 +1947,22 @@ int drm_mode_setplane(struct drm_device *dev, void *data, } plane = obj_to_plane(obj); + if(plane->lock_file && plane->lock_file != file_priv) { + DRM_DEBUG_KMS("plane ID %d is locked by another fd\n", + plane_req->plane_id); + return -EPERM; + } + + if(!plane->lock_file) { + plane->lock_file = file_priv; + struct drm_plane_lock *plane_lock = kmalloc(sizeof(struct drm_plane_lock), GFP_KERNEL); + plane_lock->plane = plane; + list_add_tail(&plane_lock->node, &file_priv->locked_planes); + DRM_DEBUG_KMS("plane ID %d locked by fd\n", + plane_req->plane_id); + + } + /* No fb means shut it down */ if (!plane_req->fb_id) { drm_modeset_lock_all(dev); diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 345be03c23db..3a4e0f849f8d 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -144,7 +144,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, DRM_CONTROL_ALLOW|DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANE, drm_mode_getplane, DRM_CONTROL_ALLOW|DRM_UNLOCKED), - DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPLANE, drm_mode_setplane, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), + DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPLANE, drm_mode_setplane, DRM_CONTROL_ALLOW|DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_MODE_CURSOR, drm_mode_cursor_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETGAMMA, drm_mode_gamma_get_ioctl, DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETGAMMA, drm_mode_gamma_set_ioctl, DRM_MASTER|DRM_UNLOCKED), diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 147a84d9da9b..5d0fd9c9cbf7 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -226,6 +226,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, INIT_LIST_HEAD(&priv->fbs); mutex_init(&priv->fbs_lock); INIT_LIST_HEAD(&priv->event_list); + INIT_LIST_HEAD(&priv->locked_planes); init_waitqueue_head(&priv->event_wait); priv->event_space = 4096; /* set aside 4k for event buffer */ @@ -475,6 +476,15 @@ int drm_release(struct inode *inode, struct file *filp) drm_events_release(file_priv); + struct drm_plane_lock *plane, *temp; + if(!list_empty(&file_priv->locked_planes)) { + list_for_each_entry_safe(plane, temp, &file_priv->locked_planes, node) { + plane->plane->lock_file = NULL; + list_del(&plane->node); + kfree(plane); + } + } + if (dev->driver->driver_features & DRIVER_MODESET) drm_fb_release(file_priv); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 1e49058741cd..29a9c08118f7 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -469,6 +469,8 @@ struct drm_file { int event_space; struct drm_prime_file_private prime; + + struct list_head locked_planes; }; /** Wait queue */ diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 8f3dee097579..aa4db2eec49e 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -694,6 +694,14 @@ struct drm_plane { const struct drm_plane_funcs *funcs; struct drm_object_properties properties; + + struct drm_file *lock_file; + +}; + +struct drm_plane_lock { + struct drm_plane *plane; + struct list_head node; }; /** |