--- a/drivers/gpu/drm/vkms/vkms_composer.c +++ b/drivers/gpu/drm/vkms/vkms_composer.c @@ -408,7 +408,7 @@ void vkms_set_composer(struct vkms_outpu if (enabled) drm_crtc_vblank_get(&out->crtc); - mutex_lock(&out->enabled_lock); + down(&out->enabled_lock); old_enabled = out->composer_enabled; out->composer_enabled = enabled; @@ -416,7 +416,7 @@ void vkms_set_composer(struct vkms_outpu * will be balanced even if we have a failed commit */ if (!out->composer_enabled) - mutex_unlock(&out->enabled_lock); + up(&out->enabled_lock); if (old_enabled) drm_crtc_vblank_put(&out->crtc); --- a/drivers/gpu/drm/vkms/vkms_crtc.c +++ b/drivers/gpu/drm/vkms/vkms_crtc.c @@ -31,7 +31,7 @@ static enum hrtimer_restart vkms_vblank_ state = output->composer_state; composer_enabled = output->composer_enabled; - mutex_unlock(&output->enabled_lock); + up(&output->enabled_lock); if (state && composer_enabled) { u64 frame = drm_crtc_accurate_vblank_count(crtc); @@ -295,7 +295,7 @@ int vkms_crtc_init(struct drm_device *de spin_lock_init(&vkms_out->lock); spin_lock_init(&vkms_out->composer_lock); - mutex_init(&vkms_out->enabled_lock); + sema_init(&vkms_out->enabled_lock, 1); vkms_out->composer_workq = alloc_ordered_workqueue("vkms_composer", 0); if (!vkms_out->composer_workq) --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -4,6 +4,7 @@ #define _VKMS_DRV_H_ #include +#include #include #include @@ -109,7 +110,7 @@ struct vkms_output { /* protects concurrent access to composer */ spinlock_t lock; /* guarantees that if the composer is enabled, a job will be queued */ - struct mutex enabled_lock; + struct semaphore enabled_lock; /* protected by @enabled_lock */ bool composer_enabled;