diff options
author | Archit Taneja <archit@ti.com> | 2014-04-11 03:23:35 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-04-15 06:35:29 -0400 |
commit | 38e5597a03d2d1499a785230031c4f48e1d9c6b7 (patch) | |
tree | fd4a2119b76eee7a9b1deb66c7114f5216af0c13 /drivers/gpu/drm/omapdrm/omap_crtc.c | |
parent | bc905aced30e48a39af7c452bf46228d7c6188b9 (diff) |
drm/omap: protect omap_crtc's event with event_lock spinlock
The vblank_cb callback and the page_flip ioctl can occur together in different
CPU contexts. vblank_cb uses takes tje drm device's event_lock spinlock when
sending the vblank event and updating omap_crtc->event and omap_crtc->od_fb.
Use the same spinlock in page_flip, to make sure the above omap_crtc parameters
are configured sequentially.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_crtc.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_crtc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 00798247190b..e3c47a8005ff 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c | |||
@@ -350,11 +350,15 @@ static int omap_crtc_page_flip_locked(struct drm_crtc *crtc, | |||
350 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); | 350 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); |
351 | struct drm_plane *primary = crtc->primary; | 351 | struct drm_plane *primary = crtc->primary; |
352 | struct drm_gem_object *bo; | 352 | struct drm_gem_object *bo; |
353 | unsigned long flags; | ||
353 | 354 | ||
354 | DBG("%d -> %d (event=%p)", primary->fb ? primary->fb->base.id : -1, | 355 | DBG("%d -> %d (event=%p)", primary->fb ? primary->fb->base.id : -1, |
355 | fb->base.id, event); | 356 | fb->base.id, event); |
356 | 357 | ||
358 | spin_lock_irqsave(&dev->event_lock, flags); | ||
359 | |||
357 | if (omap_crtc->old_fb) { | 360 | if (omap_crtc->old_fb) { |
361 | spin_unlock_irqrestore(&dev->event_lock, flags); | ||
358 | dev_err(dev->dev, "already a pending flip\n"); | 362 | dev_err(dev->dev, "already a pending flip\n"); |
359 | return -EINVAL; | 363 | return -EINVAL; |
360 | } | 364 | } |
@@ -362,6 +366,8 @@ static int omap_crtc_page_flip_locked(struct drm_crtc *crtc, | |||
362 | omap_crtc->event = event; | 366 | omap_crtc->event = event; |
363 | omap_crtc->old_fb = primary->fb = fb; | 367 | omap_crtc->old_fb = primary->fb = fb; |
364 | 368 | ||
369 | spin_unlock_irqrestore(&dev->event_lock, flags); | ||
370 | |||
365 | /* | 371 | /* |
366 | * Hold a reference temporarily until the crtc is updated | 372 | * Hold a reference temporarily until the crtc is updated |
367 | * and takes the reference to the bo. This avoids it | 373 | * and takes the reference to the bo. This avoids it |