drm/rockchip: fixup display reference count
authorMark Yao <mark.yao@rock-chips.com>
Wed, 22 Mar 2017 08:40:05 +0000 (16:40 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 23 Mar 2017 07:33:10 +0000 (15:33 +0800)
Change-Id: I9ae0699f26e3971e1f01cf36aa7a2f64dcade8dc
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
drivers/gpu/drm/rockchip/rockchip_drm_drv.c
drivers/gpu/drm/rockchip/rockchip_drm_vop.c

index 59605f9056af017a505795c3ccab1e9ec4da53ec..4e3ff4315e490f2439f4be1bd603d3a97dcd835b 100644 (file)
@@ -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);
index 8cb455843f1646a2120e0e195faf0a1fac33b384..017304927979951b94518c4edc62e8ac8559d727 100644 (file)
@@ -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);