From 6db46c9e7e25ca20ce891a117bf5128c66c0992c Mon Sep 17 00:00:00 2001 From: Mark Yao Date: Wed, 22 Mar 2017 16:40:05 +0800 Subject: [PATCH] drm/rockchip: fixup display reference count Change-Id: I9ae0699f26e3971e1f01cf36aa7a2f64dcade8dc Signed-off-by: Mark Yao --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 13 +++++++++++++ drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 59605f9056af..4e3ff4315e49 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -604,6 +604,19 @@ static void show_loader_logo(struct drm_device *drm_dev) list_for_each_entry_safe(set, tmp, &mode_set_list, head) { struct drm_crtc *crtc = set->crtc; + struct drm_connector *conn = set->connector; + + if (!set->mode_changed) { + /* + * restore connector and crtc's state, keep all the + * reference fine. + */ + WARN_ON(drm_atomic_set_crtc_for_connector(conn->state, + NULL)); + WARN_ON(drm_atomic_set_mode_for_crtc(crtc->state, + NULL)); + crtc->state->active = false; + } list_del(&set->head); kfree(set); diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 8cb455843f16..017304927979 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1494,6 +1494,11 @@ static void vop_crtc_enable(struct drm_crtc *crtc) u16 vact_end = vact_st + vdisplay; uint32_t val; + if (vop->loader_protect) { + vop->loader_protect = false; + return; + } + vop_initial(crtc); val = BIT(DCLK_INVERT); -- 2.34.1