From patchwork Fri Mar 18 11:22:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 8618561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2DD6FC0553 for ; Fri, 18 Mar 2016 11:32:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4E68C20377 for ; Fri, 18 Mar 2016 11:32:34 +0000 (UTC) Received: from bombadil.infradead.org (unknown [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 58EB920389 for ; Fri, 18 Mar 2016 11:32:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1agsUq-0008OL-A0; Fri, 18 Mar 2016 11:23:12 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1agsUn-0008G0-DK; Fri, 18 Mar 2016 11:23:10 +0000 Received: by mail-wm0-x235.google.com with SMTP id l68so64017104wml.0; Fri, 18 Mar 2016 04:22:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=Pmmkg9OGgVd8hdSJ0h0IZXrEqXjQj5dvOkx/71Xbznc=; b=URgPvlwPFab1DEbJ2U0MkH2PyCqL85gyRGrUdnIdPOO3XmOHKAq1gZYOLamlDrzVHw P6pN2OqxZZUd3TKba1uWDdPJotl9W3+NYdZUQowEjqACcVySZzexepI7l4Ps07lUFAHA akb55K+1BY29m1Z0sUxWW4z1b4MNF8bbFnP7Vj+WmWSxLOzt4oCPsrLIrZhu0np7UjIr OYhDwYpEhb5xZN6DTLv0tzSt/d+tXUuS5So298+5wClIOQz5B815TuvsjiNTUUXU/M2E 6/B/HZdb0VqSbRU5MkSWPPCFRcIrv2OhLJaHK1y9yAbO+AX4o1FSfoGRfRqRppmNaZk3 0tWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=Pmmkg9OGgVd8hdSJ0h0IZXrEqXjQj5dvOkx/71Xbznc=; b=jx9dl7566nhP8GPMyAd9ez7BI045aLBVJAVlkn6pav+Hn5dR/JP5O/8enO/yblOTpX Xf/+UMnZ1Qt8j31Fb8FHxTnQZvSxTeyEJna1juW+bHz4MeUxIXKbgTY0KZ/RkPbxYfi5 ELlfuuqzvHlsqSw4tOuar9ztAQbPqsmRSn354fiCN4AR+i7TVvK95FU/gFzVxP+N5hw1 O1xAcLJMVz2GFIjZFLEEIa5cjleZU1Yl3W8cwGmwnPIgx5BeIlq4nHAZEuBkbE6IY22m pckqaV3llcSDGgUlgtGSItTlYEkYyukeSx+4i0ekQD+n9VC3+A4dtLicK2VcgH6CcsOV V9tA== X-Gm-Message-State: AD7BkJIyVhkioPa57c091m4Tdzt/dIq/QcLWYKeG+3f5iboAuSoQ1dHMXJqsiJrDi1rCMQ== X-Received: by 10.28.128.80 with SMTP id b77mr43733206wmd.42.1458300167644; Fri, 18 Mar 2016 04:22:47 -0700 (PDT) Received: from cizrna.lan ([109.72.12.137]) by smtp.gmail.com with ESMTPSA id g203sm34252216wmf.23.2016.03.18.04.22.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Mar 2016 04:22:46 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [PATCH] drm/rockchip: vop: Reset yrgb_mst when re-enabling Date: Fri, 18 Mar 2016 12:22:27 +0100 Message-Id: <1458300147-6472-1-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.5.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160318_042309_612174_C1B37EB7 X-CRM114-Status: GOOD ( 11.52 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , Tomeu Vizoso , David Airlie , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Mark Yao MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, RDNS_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the VOP is re-enabled, it will start scanning right away the framebuffers that were configured from the last time, even if those have been destroyed already. To prevent the VOP from trying to access freed memory, reset the registers that hold pointers to framebuffers right after we can write to them, but before the VOP is awaken from standby. Signed-off-by: Tomeu Vizoso Link: http://lkml.kernel.org/g/CAAObsKAv+05ih5U+=4kic_NsjGMhfxYheHR8xXXmacZs+p5SHw@mail.gmail.com --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 5e57f5b2e4b0..0df91c28740b 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -429,6 +429,7 @@ static void vop_dsp_hold_valid_irq_disable(struct vop *vop) static void vop_enable(struct drm_crtc *crtc) { struct vop *vop = to_vop(crtc); + int i; int ret; if (vop->is_enabled) @@ -476,6 +477,18 @@ static void vop_enable(struct drm_crtc *crtc) */ vop->is_enabled = true; + /* + * Before turning the VOP completely on, unset the registers + * containing FB addresses to avoid the HW start scanning old FBs. + */ + for (i = 0; i < vop->data->win_size; i++) { + struct vop_win *vop_win = &vop->win[i]; + const struct vop_win_data *win = vop_win->data; + + VOP_WIN_SET(vop, win, yrgb_mst, 0x0); + VOP_WIN_SET(vop, win, uv_mst, 0x0); + } + spin_lock(&vop->reg_lock); VOP_CTRL_SET(vop, standby, 0);