diff mbox

[4/7] drm/vmwgfx: Stop using plane->fb in vmw_kms_update_implicit_fb()

Message ID 20180405195035.24722-4-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä April 5, 2018, 7:50 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The only caller of vmw_kms_update_implicit_fb() is the page_flip
hook which itself gets called with the plane mutex already held.
Hence we can look at plane->state safely. Toss in a lockdep assert
to make the situation more clear.

Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Deepak Singh Rawat April 6, 2018, 6:21 p.m. UTC | #1
Reviewed-by: Deepak Rawat <drawat@vmware.com>


> 

> From: Ville Syrjälä <ville.syrjala@linux.intel.com>

> 

> The only caller of vmw_kms_update_implicit_fb() is the page_flip

> hook which itself gets called with the plane mutex already held.

> Hence we can look at plane->state safely. Toss in a lockdep assert

> to make the situation more clear.

> 

> Cc: Thomas Hellstrom <thellstrom@vmware.com>

> Cc: Sinclair Yeh <syeh@vmware.com>

> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>

> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---

>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 5 ++++-

>  1 file changed, 4 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

> b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

> index 5a824125c231..a93d290b0f35 100644

> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

> @@ -2811,14 +2811,17 @@ void vmw_kms_update_implicit_fb(struct

> vmw_private *dev_priv,

>  				struct drm_crtc *crtc)

>  {

>  	struct vmw_display_unit *du = vmw_crtc_to_du(crtc);

> +	struct drm_plane *plane = crtc->primary;

>  	struct vmw_framebuffer *vfb;

> 

> +	lockdep_assert_held(&plane->mutex);

> +

>  	mutex_lock(&dev_priv->global_kms_state_mutex);

> 

>  	if (!du->is_implicit)

>  		goto out_unlock;

> 

> -	vfb = vmw_framebuffer_to_vfb(crtc->primary->fb);

> +	vfb = vmw_framebuffer_to_vfb(plane->state->fb);

>  	WARN_ON_ONCE(dev_priv->num_implicit != 1 &&

>  		     dev_priv->implicit_fb != vfb);

> 

> --

> 2.16.1

>
diff mbox

Patch

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 5a824125c231..a93d290b0f35 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -2811,14 +2811,17 @@  void vmw_kms_update_implicit_fb(struct vmw_private *dev_priv,
 				struct drm_crtc *crtc)
 {
 	struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
+	struct drm_plane *plane = crtc->primary;
 	struct vmw_framebuffer *vfb;
 
+	lockdep_assert_held(&plane->mutex);
+
 	mutex_lock(&dev_priv->global_kms_state_mutex);
 
 	if (!du->is_implicit)
 		goto out_unlock;
 
-	vfb = vmw_framebuffer_to_vfb(crtc->primary->fb);
+	vfb = vmw_framebuffer_to_vfb(plane->state->fb);
 	WARN_ON_ONCE(dev_priv->num_implicit != 1 &&
 		     dev_priv->implicit_fb != vfb);