diff mbox

[12/29] drm/armada: Drop struct_mutex from cursor paths

Message ID 1448271183-20523-13-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter Nov. 23, 2015, 9:32 a.m. UTC
The kms state itself is already protected by the modeset locks
acquired by the drm core. The only thing left is gem bo state, and
since the cursor code expects small objects which are statically
mapped at create time and then invariant over the lifetime of the gem
bo there's nothing to protect.

See armada_gem_dumb_create -> armada_gem_linear_back which assigns
obj->addr which is the only thing used by the cursor code.

Only tricky bit is to switch to the _unlocked unreference function.

Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/armada/armada_crtc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Russell King - ARM Linux Dec. 3, 2015, 4:08 p.m. UTC | #1
On Mon, Nov 23, 2015 at 10:32:45AM +0100, Daniel Vetter wrote:
> @@ -957,11 +955,9 @@ static int armada_drm_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
>  	if (!dcrtc->variant->has_spu_adv_reg)
>  		return -EFAULT;
>  
> -	mutex_lock(&dev->struct_mutex);
>  	dcrtc->cursor_x = x;
>  	dcrtc->cursor_y = y;
>  	ret = armada_drm_crtc_cursor_update(dcrtc, false);
> -	mutex_unlock(&dev->struct_mutex);
>  
>  	return ret;
>  }

drivers/gpu/drm/armada/armada_crtc.c: In function 'armada_drm_crtc_cursor_move':
drivers/gpu/drm/armada/armada_crtc.c:916:21: warning: unused variable 'dev' [-Wunused-variable]

Shall I add to your patch a change to remove that variable too? :)
Daniel Vetter Dec. 4, 2015, 7:51 a.m. UTC | #2
On Thu, Dec 03, 2015 at 04:08:45PM +0000, Russell King - ARM Linux wrote:
> On Mon, Nov 23, 2015 at 10:32:45AM +0100, Daniel Vetter wrote:
> > @@ -957,11 +955,9 @@ static int armada_drm_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
> >  	if (!dcrtc->variant->has_spu_adv_reg)
> >  		return -EFAULT;
> >  
> > -	mutex_lock(&dev->struct_mutex);
> >  	dcrtc->cursor_x = x;
> >  	dcrtc->cursor_y = y;
> >  	ret = armada_drm_crtc_cursor_update(dcrtc, false);
> > -	mutex_unlock(&dev->struct_mutex);
> >  
> >  	return ret;
> >  }
> 
> drivers/gpu/drm/armada/armada_crtc.c: In function 'armada_drm_crtc_cursor_move':
> drivers/gpu/drm/armada/armada_crtc.c:916:21: warning: unused variable 'dev' [-Wunused-variable]
> 
> Shall I add to your patch a change to remove that variable too? :)

Yes please ;-) I guess I should stop relying on 0-day for arm builds and
set up a proper arm toolchain again (the old one went to waste a bit).

Thanks, Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index 7ea35bee7cd5..4bd1ce75a9f7 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -928,11 +928,10 @@  static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc,
 		}
 	}
 
-	mutex_lock(&dev->struct_mutex);
 	if (dcrtc->cursor_obj) {
 		dcrtc->cursor_obj->update = NULL;
 		dcrtc->cursor_obj->update_data = NULL;
-		drm_gem_object_unreference(&dcrtc->cursor_obj->obj);
+		drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj);
 	}
 	dcrtc->cursor_obj = obj;
 	dcrtc->cursor_w = w;
@@ -942,7 +941,6 @@  static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc,
 		obj->update_data = dcrtc;
 		obj->update = cursor_update;
 	}
-	mutex_unlock(&dev->struct_mutex);
 
 	return ret;
 }
@@ -957,11 +955,9 @@  static int armada_drm_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
 	if (!dcrtc->variant->has_spu_adv_reg)
 		return -EFAULT;
 
-	mutex_lock(&dev->struct_mutex);
 	dcrtc->cursor_x = x;
 	dcrtc->cursor_y = y;
 	ret = armada_drm_crtc_cursor_update(dcrtc, false);
-	mutex_unlock(&dev->struct_mutex);
 
 	return ret;
 }