diff options
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 27 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 |
5 files changed, 21 insertions, 14 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 9555e204814a..e80497eb6c9c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
| @@ -628,6 +628,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
| 628 | mutex_init(&dev_priv->cmdbuf_mutex); | 628 | mutex_init(&dev_priv->cmdbuf_mutex); |
| 629 | mutex_init(&dev_priv->release_mutex); | 629 | mutex_init(&dev_priv->release_mutex); |
| 630 | mutex_init(&dev_priv->binding_mutex); | 630 | mutex_init(&dev_priv->binding_mutex); |
| 631 | mutex_init(&dev_priv->global_kms_state_mutex); | ||
| 631 | rwlock_init(&dev_priv->resource_lock); | 632 | rwlock_init(&dev_priv->resource_lock); |
| 632 | ttm_lock_init(&dev_priv->reservation_sem); | 633 | ttm_lock_init(&dev_priv->reservation_sem); |
| 633 | spin_lock_init(&dev_priv->hw_lock); | 634 | spin_lock_init(&dev_priv->hw_lock); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 019a6ca3e8e9..6db358a85b46 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
| @@ -412,6 +412,7 @@ struct vmw_private { | |||
| 412 | struct drm_property *implicit_placement_property; | 412 | struct drm_property *implicit_placement_property; |
| 413 | unsigned num_implicit; | 413 | unsigned num_implicit; |
| 414 | struct vmw_framebuffer *implicit_fb; | 414 | struct vmw_framebuffer *implicit_fb; |
| 415 | struct mutex global_kms_state_mutex; | ||
| 415 | 416 | ||
| 416 | /* | 417 | /* |
| 417 | * Context and surface management. | 418 | * Context and surface management. |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index fc20d45e3da9..55231cce73a0 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
| @@ -2143,13 +2143,13 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv, | |||
| 2143 | void vmw_kms_del_active(struct vmw_private *dev_priv, | 2143 | void vmw_kms_del_active(struct vmw_private *dev_priv, |
| 2144 | struct vmw_display_unit *du) | 2144 | struct vmw_display_unit *du) |
| 2145 | { | 2145 | { |
| 2146 | lockdep_assert_held_once(&dev_priv->dev->mode_config.mutex); | 2146 | mutex_lock(&dev_priv->global_kms_state_mutex); |
| 2147 | |||
| 2148 | if (du->active_implicit) { | 2147 | if (du->active_implicit) { |
| 2149 | if (--(dev_priv->num_implicit) == 0) | 2148 | if (--(dev_priv->num_implicit) == 0) |
| 2150 | dev_priv->implicit_fb = NULL; | 2149 | dev_priv->implicit_fb = NULL; |
| 2151 | du->active_implicit = false; | 2150 | du->active_implicit = false; |
| 2152 | } | 2151 | } |
| 2152 | mutex_unlock(&dev_priv->global_kms_state_mutex); | ||
| 2153 | } | 2153 | } |
| 2154 | 2154 | ||
| 2155 | /** | 2155 | /** |
| @@ -2165,8 +2165,7 @@ void vmw_kms_add_active(struct vmw_private *dev_priv, | |||
| 2165 | struct vmw_display_unit *du, | 2165 | struct vmw_display_unit *du, |
| 2166 | struct vmw_framebuffer *vfb) | 2166 | struct vmw_framebuffer *vfb) |
| 2167 | { | 2167 | { |
| 2168 | lockdep_assert_held_once(&dev_priv->dev->mode_config.mutex); | 2168 | mutex_lock(&dev_priv->global_kms_state_mutex); |
| 2169 | |||
| 2170 | WARN_ON_ONCE(!dev_priv->num_implicit && dev_priv->implicit_fb); | 2169 | WARN_ON_ONCE(!dev_priv->num_implicit && dev_priv->implicit_fb); |
| 2171 | 2170 | ||
| 2172 | if (!du->active_implicit && du->is_implicit) { | 2171 | if (!du->active_implicit && du->is_implicit) { |
| @@ -2174,6 +2173,7 @@ void vmw_kms_add_active(struct vmw_private *dev_priv, | |||
| 2174 | du->active_implicit = true; | 2173 | du->active_implicit = true; |
| 2175 | dev_priv->num_implicit++; | 2174 | dev_priv->num_implicit++; |
| 2176 | } | 2175 | } |
| 2176 | mutex_unlock(&dev_priv->global_kms_state_mutex); | ||
| 2177 | } | 2177 | } |
| 2178 | 2178 | ||
| 2179 | /** | 2179 | /** |
| @@ -2190,16 +2190,13 @@ bool vmw_kms_crtc_flippable(struct vmw_private *dev_priv, | |||
| 2190 | struct drm_crtc *crtc) | 2190 | struct drm_crtc *crtc) |
| 2191 | { | 2191 | { |
| 2192 | struct vmw_display_unit *du = vmw_crtc_to_du(crtc); | 2192 | struct vmw_display_unit *du = vmw_crtc_to_du(crtc); |
| 2193 | bool ret; | ||
| 2193 | 2194 | ||
| 2194 | lockdep_assert_held_once(&dev_priv->dev->mode_config.mutex); | 2195 | mutex_lock(&dev_priv->global_kms_state_mutex); |
| 2195 | 2196 | ret = !du->is_implicit || dev_priv->num_implicit == 1; | |
| 2196 | if (!du->is_implicit) | 2197 | mutex_unlock(&dev_priv->global_kms_state_mutex); |
| 2197 | return true; | ||
| 2198 | |||
| 2199 | if (dev_priv->num_implicit != 1) | ||
| 2200 | return false; | ||
| 2201 | 2198 | ||
| 2202 | return true; | 2199 | return ret; |
| 2203 | } | 2200 | } |
| 2204 | 2201 | ||
| 2205 | /** | 2202 | /** |
| @@ -2214,16 +2211,18 @@ void vmw_kms_update_implicit_fb(struct vmw_private *dev_priv, | |||
| 2214 | struct vmw_display_unit *du = vmw_crtc_to_du(crtc); | 2211 | struct vmw_display_unit *du = vmw_crtc_to_du(crtc); |
| 2215 | struct vmw_framebuffer *vfb; | 2212 | struct vmw_framebuffer *vfb; |
| 2216 | 2213 | ||
| 2217 | lockdep_assert_held_once(&dev_priv->dev->mode_config.mutex); | 2214 | mutex_lock(&dev_priv->global_kms_state_mutex); |
| 2218 | 2215 | ||
| 2219 | if (!du->is_implicit) | 2216 | if (!du->is_implicit) |
| 2220 | return; | 2217 | goto out_unlock; |
| 2221 | 2218 | ||
| 2222 | vfb = vmw_framebuffer_to_vfb(crtc->primary->fb); | 2219 | vfb = vmw_framebuffer_to_vfb(crtc->primary->fb); |
| 2223 | WARN_ON_ONCE(dev_priv->num_implicit != 1 && | 2220 | WARN_ON_ONCE(dev_priv->num_implicit != 1 && |
| 2224 | dev_priv->implicit_fb != vfb); | 2221 | dev_priv->implicit_fb != vfb); |
| 2225 | 2222 | ||
| 2226 | dev_priv->implicit_fb = vfb; | 2223 | dev_priv->implicit_fb = vfb; |
| 2224 | out_unlock: | ||
| 2225 | mutex_unlock(&dev_priv->global_kms_state_mutex); | ||
| 2227 | } | 2226 | } |
| 2228 | 2227 | ||
| 2229 | /** | 2228 | /** |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c index 0ea22fd112c9..b74eae2b8594 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | |||
| @@ -285,14 +285,17 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set) | |||
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | /* Only one active implicit frame-buffer at a time. */ | 287 | /* Only one active implicit frame-buffer at a time. */ |
| 288 | mutex_lock(&dev_priv->global_kms_state_mutex); | ||
| 288 | if (sou->base.is_implicit && | 289 | if (sou->base.is_implicit && |
| 289 | dev_priv->implicit_fb && vfb && | 290 | dev_priv->implicit_fb && vfb && |
| 290 | !(dev_priv->num_implicit == 1 && | 291 | !(dev_priv->num_implicit == 1 && |
| 291 | sou->base.active_implicit) && | 292 | sou->base.active_implicit) && |
| 292 | dev_priv->implicit_fb != vfb) { | 293 | dev_priv->implicit_fb != vfb) { |
| 294 | mutex_unlock(&dev_priv->global_kms_state_mutex); | ||
| 293 | DRM_ERROR("Multiple implicit framebuffers not supported.\n"); | 295 | DRM_ERROR("Multiple implicit framebuffers not supported.\n"); |
| 294 | return -EINVAL; | 296 | return -EINVAL; |
| 295 | } | 297 | } |
| 298 | mutex_unlock(&dev_priv->global_kms_state_mutex); | ||
| 296 | 299 | ||
| 297 | /* since they always map one to one these are safe */ | 300 | /* since they always map one to one these are safe */ |
| 298 | connector = &sou->base.connector; | 301 | connector = &sou->base.connector; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c index b949102ad864..9ca818fb034c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | |||
| @@ -553,12 +553,15 @@ static int vmw_stdu_crtc_set_config(struct drm_mode_set *set) | |||
| 553 | } | 553 | } |
| 554 | 554 | ||
| 555 | /* Only one active implicit frame-buffer at a time. */ | 555 | /* Only one active implicit frame-buffer at a time. */ |
| 556 | mutex_lock(&dev_priv->global_kms_state_mutex); | ||
| 556 | if (!turning_off && stdu->base.is_implicit && dev_priv->implicit_fb && | 557 | if (!turning_off && stdu->base.is_implicit && dev_priv->implicit_fb && |
| 557 | !(dev_priv->num_implicit == 1 && stdu->base.active_implicit) | 558 | !(dev_priv->num_implicit == 1 && stdu->base.active_implicit) |
| 558 | && dev_priv->implicit_fb != vfb) { | 559 | && dev_priv->implicit_fb != vfb) { |
| 560 | mutex_unlock(&dev_priv->global_kms_state_mutex); | ||
| 559 | DRM_ERROR("Multiple implicit framebuffers not supported.\n"); | 561 | DRM_ERROR("Multiple implicit framebuffers not supported.\n"); |
| 560 | return -EINVAL; | 562 | return -EINVAL; |
| 561 | } | 563 | } |
| 564 | mutex_unlock(&dev_priv->global_kms_state_mutex); | ||
| 562 | 565 | ||
| 563 | /* Since they always map one to one these are safe */ | 566 | /* Since they always map one to one these are safe */ |
| 564 | connector = &stdu->base.connector; | 567 | connector = &stdu->base.connector; |
