drm/rockchip: vop: optimize dump buffer cmd

vop driver need to backup the last plane info for dump buffer cmd,
but the kmemleak tool will identify as a memleak buffer, so store the
planelist to rockchip_plane_state, and kfree the planlist at next frame
update or disable.

Change-Id: I6e95bfb9740a0ff4ad9033bbe3a34c28e1114c3d
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
This commit is contained in:
Sandy Huang
2020-04-29 20:11:33 +08:00
committed by Tao Huang
parent 9f4bb6067d
commit 5be8f596ff

View File

@@ -188,6 +188,7 @@ struct vop_plane_state {
unsigned long offset;
int pdaf_data_type;
bool async_commit;
struct vop_dump_list *planlist;
};
struct rockchip_mcu_timing {
@@ -1646,6 +1647,8 @@ static void vop_plane_atomic_disable(struct drm_plane *plane,
{
struct vop_win *win = to_vop_win(plane);
struct vop *vop = to_vop(old_state->crtc);
struct vop_plane_state *vop_plane_state =
to_vop_plane_state(plane->state);
if (!old_state->crtc)
return;
@@ -1663,6 +1666,9 @@ static void vop_plane_atomic_disable(struct drm_plane *plane,
win->win_id == 2)
VOP_WIN_SET(vop, win, yrgb_mst, 0);
kfree(vop_plane_state->planlist);
vop_plane_state->planlist = NULL;
spin_unlock(&vop->reg_lock);
}
@@ -1827,6 +1833,9 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
*/
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_flag;
@@ -1841,6 +1850,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
planlist->dump_info.height = actual_h;
planlist->dump_info.pixel_format = fb->format->format;
list_add_tail(&planlist->entry, &crtc->vop_dump_list_head);
vop_plane_state->planlist = planlist;
} else {
DRM_ERROR("can't alloc a node of planlist %p\n", planlist);
return;
@@ -2567,7 +2577,6 @@ static size_t vop_crtc_bandwidth(struct drm_crtc *crtc,
}
list_for_each_entry_safe(pos, n, &crtc->vop_dump_list_head, entry) {
list_del(&pos->entry);
kfree(pos);
}
if (crtc->vop_dump_status == DUMP_KEEP ||
crtc->vop_dump_times > 0) {