Commit cb8097a4 authored by Zack Rusin's avatar Zack Rusin

drm/vmwgfx: Cleanup the vmw bo usage in the cursor paths

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: default avatarZack Rusin <zackr@vmware.com>
Reviewed-by: default avatarMartin Krastev <krastevm@vmware.com>
Reviewed-by: default avatarMaaz Mombasawala <mombasawalam@vmware.com>
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230131033542.953249-6-zack@kde.org
parent 6703e28f
...@@ -44,7 +44,6 @@ struct vmw_resource; ...@@ -44,7 +44,6 @@ struct vmw_resource;
* struct vmw_bo - TTM buffer object with vmwgfx additions * struct vmw_bo - TTM buffer object with vmwgfx additions
* @base: The TTM buffer object * @base: The TTM buffer object
* @res_tree: RB tree of resources using this buffer object as a backing MOB * @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 * @cpu_writers: Number of synccpu write grabs. Protected by reservation when
* increased. May be decreased without reservation. * increased. May be decreased without reservation.
* @dx_query_ctx: DX context if this buffer object is used as a DX query MOB * @dx_query_ctx: DX context if this buffer object is used as a DX query MOB
...@@ -55,8 +54,6 @@ struct vmw_resource; ...@@ -55,8 +54,6 @@ struct vmw_resource;
struct vmw_bo { struct vmw_bo {
struct ttm_buffer_object base; struct ttm_buffer_object base;
struct rb_root res_tree; struct rb_root res_tree;
/* For KMS atomic helpers: ttm bo mapping count */
atomic_t base_mapped_count;
atomic_t cpu_writers; atomic_t cpu_writers;
/* Not ref-counted. Protected by binding_mutex */ /* Not ref-counted. Protected by binding_mutex */
......
...@@ -669,8 +669,7 @@ vmw_du_cursor_plane_cleanup_fb(struct drm_plane *plane, ...@@ -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); const int ret = ttm_bo_reserve(&vps->bo->base, true, false, NULL);
if (likely(ret == 0)) { 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); ttm_bo_unreserve(&vps->bo->base);
} }
} }
...@@ -744,9 +743,6 @@ vmw_du_cursor_plane_prepare_fb(struct drm_plane *plane, ...@@ -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); 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); ttm_bo_unreserve(&vps->bo->base);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
...@@ -786,7 +782,6 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane, ...@@ -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 *vps = vmw_plane_state_to_vps(new_state);
struct vmw_plane_state *old_vps = vmw_plane_state_to_vps(old_state); struct vmw_plane_state *old_vps = vmw_plane_state_to_vps(old_state);
s32 hotspot_x, hotspot_y; s32 hotspot_x, hotspot_y;
bool dummy;
hotspot_x = du->hotspot_x; hotspot_x = du->hotspot_x;
hotspot_y = du->hotspot_y; hotspot_y = du->hotspot_y;
...@@ -828,11 +823,6 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane, ...@@ -828,11 +823,6 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
hotspot_x, hotspot_y); 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_x = new_state->crtc_x + du->set_gui_x;
du->cursor_y = new_state->crtc_y + du->set_gui_y; du->cursor_y = new_state->crtc_y + du->set_gui_y;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment