drm/rockchip: vop: Use DRM plane info to implement the buffer dump

This patch deprecates the plane list record method used in the
previous plane buffer dump. There is no need to record these
information additionally now, as they are already accessible in DRM.

Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
Change-Id: I965f42cc7372c4314aa8cd4de2a8a811b41badaf
This commit is contained in:
Chaoyi Chen
2024-03-25 14:17:32 +08:00
committed by Tao Huang
parent 9a9306f9ce
commit a607e5fabf

View File

@@ -189,7 +189,6 @@ struct vop_plane_state {
unsigned long offset;
int pdaf_data_type;
bool async_commit;
struct vop_dump_list *planlist;
};
struct vop_win {
@@ -1973,10 +1972,6 @@ static void vop_plane_atomic_disable(struct drm_plane *plane,
plane);
struct vop_win *win = to_vop_win(plane);
struct vop *vop = to_vop(old_state->crtc);
#if defined(CONFIG_ROCKCHIP_DRM_DEBUG)
struct vop_plane_state *vop_plane_state =
to_vop_plane_state(plane->state);
#endif
if (!old_state->crtc)
return;
@@ -1997,11 +1992,6 @@ static void vop_plane_atomic_disable(struct drm_plane *plane,
win->win_id == 2)
VOP_WIN_SET(vop, win, yrgb_mst, 0);
#if defined(CONFIG_ROCKCHIP_DRM_DEBUG)
kfree(vop_plane_state->planlist);
vop_plane_state->planlist = NULL;
#endif
spin_unlock(&vop->reg_lock);
}
@@ -2093,23 +2083,6 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
int is_yuv = fb->format->is_yuv;
bool afbc_en = false;
#if defined(CONFIG_ROCKCHIP_DRM_DEBUG)
struct vop_dump_list *planlist;
unsigned long num_pages;
struct page **pages;
struct drm_gem_object *obj;
struct rockchip_gem_object *rk_obj;
num_pages = 0;
pages = NULL;
obj = fb->obj[0];
rk_obj = to_rockchip_obj(obj);
if (rk_obj) {
num_pages = rk_obj->num_pages;
pages = rk_obj->pages;
}
#endif
/*
* can't update plane when vop is disabled.
*/
@@ -2267,35 +2240,6 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
* actual_w, actual_h)
*/
vop->is_iommu_needed = true;
#if defined(CONFIG_ROCKCHIP_DRM_DEBUG)
kfree(vop_plane_state->planlist);
vop_plane_state->planlist = NULL;
planlist = kmalloc(sizeof(*planlist), GFP_KERNEL);
if (planlist) {
planlist->dump_info.AFBC_flag = afbc_en;
planlist->dump_info.area_id = win->area_id;
planlist->dump_info.win_id = win->win_id;
planlist->dump_info.yuv_format =
is_yuv_support(fb->format->format);
planlist->dump_info.num_pages = num_pages;
planlist->dump_info.pages = pages;
planlist->dump_info.offset = vop_plane_state->offset;
planlist->dump_info.pitches = fb->pitches[0];
planlist->dump_info.height = actual_h;
planlist->dump_info.format = fb->format;
list_add_tail(&planlist->entry, &vop->rockchip_crtc.vop_dump_list_head);
vop_plane_state->planlist = planlist;
} else {
DRM_ERROR("can't alloc a node of planlist %p\n", planlist);
return;
}
if (vop->rockchip_crtc.vop_dump_status == DUMP_KEEP ||
vop->rockchip_crtc.vop_dump_times > 0) {
rockchip_drm_dump_plane_buffer(&planlist->dump_info, vop->rockchip_crtc.frame_count);
vop->rockchip_crtc.vop_dump_times--;
}
#endif
}
static int vop_plane_atomic_async_check(struct drm_plane *plane,
@@ -3060,28 +3004,10 @@ static size_t vop_crtc_bandwidth(struct drm_crtc *crtc,
u64 line_bw_mbyte = 0;
int cnt = 0, plane_num = 0;
struct drm_atomic_state *state = crtc_state->state;
#if defined(CONFIG_ROCKCHIP_DRM_DEBUG)
struct vop_dump_list *pos, *n;
struct vop *vop = to_vop(crtc);
#endif
if (!htotal || !vdisplay)
return 0;
#if defined(CONFIG_ROCKCHIP_DRM_DEBUG)
if (!vop->rockchip_crtc.vop_dump_list_init_flag) {
INIT_LIST_HEAD(&vop->rockchip_crtc.vop_dump_list_head);
vop->rockchip_crtc.vop_dump_list_init_flag = true;
}
list_for_each_entry_safe(pos, n, &vop->rockchip_crtc.vop_dump_list_head, entry) {
list_del(&pos->entry);
}
if (vop->rockchip_crtc.vop_dump_status == DUMP_KEEP ||
vop->rockchip_crtc.vop_dump_times > 0) {
vop->rockchip_crtc.frame_count++;
}
#endif
drm_atomic_crtc_state_for_each_plane(plane, crtc_state)
plane_num++;
@@ -4294,6 +4220,14 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
struct rockchip_crtc_state *s =
to_rockchip_crtc_state(crtc->state);
#if defined(CONFIG_ROCKCHIP_DRM_DEBUG)
if (vop->rockchip_crtc.vop_dump_status == DUMP_KEEP ||
vop->rockchip_crtc.vop_dump_times > 0) {
rockchip_drm_crtc_dump_plane_buffer(crtc);
vop->rockchip_crtc.vop_dump_times--;
}
#endif
vop_cfg_update(crtc, old_crtc_state);
if (!vop->is_iommu_enabled && vop->is_iommu_needed) {