On 1/30/23 19:35, Zack Rusin wrote: > From: Zack Rusin <zackr@xxxxxxxxxx> > > Base mapped count is useless because the ttm unmap functions handle > null maps just fine so completely remove all the code related to it. > > Signed-off-by: Zack Rusin <zackr@xxxxxxxxxx> > Reviewed-by: Martin Krastev <krastevm@xxxxxxxxxx> > --- > drivers/gpu/drm/vmwgfx/vmwgfx_bo.h | 3 --- > drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 12 +----------- > 2 files changed, 1 insertion(+), 14 deletions(-) > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.h b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.h > index e2dadd68a16d..2ede1e28d7ce 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.h > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.h > @@ -44,7 +44,6 @@ struct vmw_resource; > * struct vmw_bo - TTM buffer object with vmwgfx additions > * @base: The TTM buffer object > * @res_tree: RB tree of resources using this buffer object as a backing MOB > - * @base_mapped_count: ttm BO mapping count; used by KMS atomic helpers. > * @cpu_writers: Number of synccpu write grabs. Protected by reservation when > * increased. May be decreased without reservation. > * @dx_query_ctx: DX context if this buffer object is used as a DX query MOB > @@ -55,8 +54,6 @@ struct vmw_resource; > struct vmw_bo { > struct ttm_buffer_object base; > struct rb_root res_tree; > - /* For KMS atomic helpers: ttm bo mapping count */ > - atomic_t base_mapped_count; > > atomic_t cpu_writers; > /* Not ref-counted. Protected by binding_mutex */ > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c > index 6780391c57ea..1082218a1cfc 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c > @@ -669,8 +669,7 @@ vmw_du_cursor_plane_cleanup_fb(struct drm_plane *plane, > const int ret = ttm_bo_reserve(&vps->bo->base, true, false, NULL); > > if (likely(ret == 0)) { > - if (atomic_read(&vps->bo->base_mapped_count) == 0) > - ttm_bo_kunmap(&vps->bo->map); > + ttm_bo_kunmap(&vps->bo->map); > ttm_bo_unreserve(&vps->bo->base); > } > } > @@ -744,9 +743,6 @@ vmw_du_cursor_plane_prepare_fb(struct drm_plane *plane, > > ret = ttm_bo_kmap(&vps->bo->base, 0, PFN_UP(size), &vps->bo->map); > > - if (likely(ret == 0)) > - atomic_inc(&vps->bo->base_mapped_count); > - > ttm_bo_unreserve(&vps->bo->base); > > if (unlikely(ret != 0)) > @@ -786,7 +782,6 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane, > struct vmw_plane_state *vps = vmw_plane_state_to_vps(new_state); > struct vmw_plane_state *old_vps = vmw_plane_state_to_vps(old_state); > s32 hotspot_x, hotspot_y; > - bool dummy; > > hotspot_x = du->hotspot_x; > hotspot_y = du->hotspot_y; > @@ -828,11 +823,6 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane, > hotspot_x, hotspot_y); > } > > - if (vps->bo) { > - if (ttm_kmap_obj_virtual(&vps->bo->map, &dummy)) > - atomic_dec(&vps->bo->base_mapped_count); > - } > - > du->cursor_x = new_state->crtc_x + du->set_gui_x; > du->cursor_y = new_state->crtc_y + du->set_gui_y; > LGTM! Reviewed-by: Maaz Mombasawala <mombasawalam@xxxxxxxxxx> -- Maaz Mombasawala (VMware) <maazm@xxxxxxxxxxxx>