@@ -750,6 +750,7 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
750
750
struct vmw_plane_state * old_vps = vmw_plane_state_to_vps (old_state );
751
751
struct vmw_bo * old_bo = NULL ;
752
752
struct vmw_bo * new_bo = NULL ;
753
+ struct ww_acquire_ctx ctx ;
753
754
s32 hotspot_x , hotspot_y ;
754
755
int ret ;
755
756
@@ -769,19 +770,26 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
769
770
if (du -> cursor_surface )
770
771
du -> cursor_age = du -> cursor_surface -> snooper .age ;
771
772
773
+ ww_acquire_init (& ctx , & reservation_ww_class );
774
+
772
775
if (!vmw_user_object_is_null (& old_vps -> uo )) {
773
776
old_bo = vmw_user_object_buffer (& old_vps -> uo );
774
- ret = ttm_bo_reserve (& old_bo -> tbo , false, false, NULL );
777
+ ret = ttm_bo_reserve (& old_bo -> tbo , false, false, & ctx );
775
778
if (ret != 0 )
776
779
return ;
777
780
}
778
781
779
782
if (!vmw_user_object_is_null (& vps -> uo )) {
780
783
new_bo = vmw_user_object_buffer (& vps -> uo );
781
784
if (old_bo != new_bo ) {
782
- ret = ttm_bo_reserve (& new_bo -> tbo , false, false, NULL );
783
- if (ret != 0 )
785
+ ret = ttm_bo_reserve (& new_bo -> tbo , false, false, & ctx );
786
+ if (ret != 0 ) {
787
+ if (old_bo ) {
788
+ ttm_bo_unreserve (& old_bo -> tbo );
789
+ ww_acquire_fini (& ctx );
790
+ }
784
791
return ;
792
+ }
785
793
} else {
786
794
new_bo = NULL ;
787
795
}
@@ -803,10 +811,12 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
803
811
hotspot_x , hotspot_y );
804
812
}
805
813
806
- if (old_bo )
807
- ttm_bo_unreserve (& old_bo -> tbo );
808
814
if (new_bo )
809
815
ttm_bo_unreserve (& new_bo -> tbo );
816
+ if (old_bo )
817
+ ttm_bo_unreserve (& old_bo -> tbo );
818
+
819
+ ww_acquire_fini (& ctx );
810
820
811
821
du -> cursor_x = new_state -> crtc_x + du -> set_gui_x ;
812
822
du -> cursor_y = new_state -> crtc_y + du -> set_gui_y ;
0 commit comments