Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 357960
b: refs/heads/master
c: 29494c1
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Vetter committed Jan 20, 2013
1 parent 4e1250c commit 110308b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d5d2636ed7990b93c7216f6a4d323f6b0eee08af
refs/heads/master: 29494c174dc4793ebd236aa522a2a1ed73b7180e
12 changes: 12 additions & 0 deletions trunk/drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@
*/
void drm_modeset_lock_all(struct drm_device *dev)
{
struct drm_crtc *crtc;

mutex_lock(&dev->mode_config.mutex);

list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
mutex_lock_nest_lock(&crtc->mutex, &dev->mode_config.mutex);
}
EXPORT_SYMBOL(drm_modeset_lock_all);

Expand All @@ -56,6 +61,11 @@ EXPORT_SYMBOL(drm_modeset_lock_all);
*/
void drm_modeset_unlock_all(struct drm_device *dev)
{
struct drm_crtc *crtc;

list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
mutex_unlock(&crtc->mutex);

mutex_unlock(&dev->mode_config.mutex);
}
EXPORT_SYMBOL(drm_modeset_unlock_all);
Expand Down Expand Up @@ -449,6 +459,8 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
crtc->invert_dimensions = false;

drm_modeset_lock_all(dev);
mutex_init(&crtc->mutex);
mutex_lock_nest_lock(&crtc->mutex, &dev->mode_config.mutex);

ret = drm_mode_object_get(dev, &crtc->base, DRM_MODE_OBJECT_CRTC);
if (ret)
Expand Down
9 changes: 9 additions & 0 deletions trunk/include/drm/drm_crtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,15 @@ struct drm_crtc {
struct drm_device *dev;
struct list_head head;

/**
* crtc mutex
*
* This provides a read lock for the overall crtc state (mode, dpms
* state, ...) and a write lock for everything which can be update
* without a full modeset (fb, cursor data, ...)
*/
struct mutex mutex;

struct drm_mode_object base;

/* framebuffer the connector is currently bound to */
Expand Down

0 comments on commit 110308b

Please sign in to comment.