drm/rockchip: vop2: Use regbak to determine whether win is disabled

The vop2_win_disable() may be called multiple times in a short period
before the fs comes. Using VOP_WIN_GET(vop2, win, enable) for
judgment may cause double disable of win, leading to double decrement
of vop2_power_domain.ref_count.

This patch uses regbak to determine whether win is already disabled
in vop2_win_disable(), similar to what is done in the
vop2_win_enable().

Change-Id: I3095ef0ef0068ef3dd7245375127083a17871341
Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
This commit is contained in:
Chaoyi Chen
2025-02-22 07:55:23 +00:00
committed by Tao Huang
parent ce5794977b
commit 1f34b60222

View File

@@ -2181,7 +2181,7 @@ static void vop2_win_disable(struct vop2_win *win, bool skip_splice_win)
win->splice_win = NULL;
}
if (VOP_WIN_GET(vop2, win, enable) || VOP_WIN_GET_REG_BAK(vop2, win, enable)) {
if (VOP_WIN_GET_REG_BAK(vop2, win, enable)) {
VOP_WIN_SET(vop2, win, enable, 0);
/*
* at rk3576 platform, the esmart1/3 can merge from vp1, but the enable bit: port0_extra_alpha_en
@@ -7818,6 +7818,8 @@ static int vop2_crtc_loader_protect(struct drm_crtc *crtc, bool on, void *data)
if (crtc->primary) {
win = to_vop2_win(crtc->primary);
if (VOP_WIN_GET(vop2, win, enable)) {
/* set enable in regbaks */
VOP_WIN_SET(vop2, win, enable, 1);
pd = win->pd;
while (pd) {
pd->ref_count++;
@@ -7844,6 +7846,8 @@ static int vop2_crtc_loader_protect(struct drm_crtc *crtc, bool on, void *data)
if (splice_win->pd &&
VOP_WIN_GET(vop2, splice_win, enable)) {
/* set enable in regbaks */
VOP_WIN_SET(vop2, splice_win, enable, 1);
pd = splice_win->pd;
while (pd) {
pd->ref_count++;