From patchwork Mon May 27 23:11:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Val Packett X-Patchwork-Id: 13675927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 666A0C25B74 for ; Mon, 27 May 2024 23:12:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A0FD110ED56; Mon, 27 May 2024 23:12:45 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=packett.cool header.i=@packett.cool header.b="V+rroTeF"; dkim-atps=neutral Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [91.218.175.175]) by gabe.freedesktop.org (Postfix) with ESMTPS id 550BC10EE31 for ; Mon, 27 May 2024 23:12:43 +0000 (UTC) X-Envelope-To: heiko@sntech.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=packett.cool; s=key1; t=1716851561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NhJB2QVODdUA35I9pFEh6dmBBV56wUfJsZyxgaUD6Yc=; b=V+rroTeFfCggIU6g9FhwO+eUXGJJS0N0JEH51ksOYwRUE1xcX8iTW1M2Lz3MLIx3L8gEaE AMkJdPsStaC/7RR4woi4luZbmlVOy+Bd4AktN+ZMXGpthefQM4EVwhH+9IZCpRzwuU+lqQ wLNLgFWNkmVKrPD5uAScrjw0LRhXVUXb1PB2ovRXV7rOqnnUztJ+qUxrBfsrwFt7/g0L4b xLaL860E8FHpdok32JAMsdBjCjIvOUNAi0bqeHaCSFEBNpkapW4pBiZZorrZ+TbEjQx6AW BgB63Xzdtil7TkB9VqkaJG0js7plpSgPDkxcwaQXOsZnkv5QHfUWBKmX35mRdg== X-Envelope-To: val@packett.cool X-Envelope-To: stable@vger.kernel.org X-Envelope-To: hjc@rock-chips.com X-Envelope-To: andy.yan@rock-chips.com X-Envelope-To: maarten.lankhorst@linux.intel.com X-Envelope-To: mripard@kernel.org X-Envelope-To: tzimmermann@suse.de X-Envelope-To: airlied@gmail.com X-Envelope-To: daniel@ffwll.ch X-Envelope-To: dri-devel@lists.freedesktop.org X-Envelope-To: linux-arm-kernel@lists.infradead.org X-Envelope-To: linux-rockchip@lists.infradead.org X-Envelope-To: linux-kernel@vger.kernel.org X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Val Packett To: =?utf-8?q?Heiko_St=C3=BCbner?= Cc: Val Packett , stable@vger.kernel.org, Sandy Huang , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] drm/rockchip: vop: clear DMA stop bit upon vblank on RK3066 Date: Mon, 27 May 2024 20:11:49 -0300 Message-ID: <20240527231202.23365-1-val@packett.cool> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The RK3066 VOP sets a dma_stop bit when it's done scanning out a frame and needs the driver to acknowledge that by clearing the bit. So unless we clear it "between" frames, the RGB output only shows noise instead of the picture. vblank seems to be the most appropriate place to do it, since it indicates exactly that: that the hardware is done with the frame. This seems to be a redundant synchronization mechanism that was removed in later iterations of the VOP hardware block. Fixes: f4a6de8 ("drm: rockchip: vop: add rk3066 vop definitions") Cc: stable@vger.kernel.org Signed-off-by: Val Packett --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 ++++++ drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 1 + drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 1 + 3 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index a13473b2d..2731fe2b2 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1766,6 +1766,12 @@ static void vop_handle_vblank(struct vop *vop) } spin_unlock(&drm->event_lock); + if (VOP_HAS_REG(vop, common, dma_stop)) { + spin_lock(&vop->reg_lock); + VOP_REG_SET(vop, common, dma_stop, 0); + spin_unlock(&vop->reg_lock); + } + if (test_and_clear_bit(VOP_PENDING_FB_UNREF, &vop->pending)) drm_flip_work_commit(&vop->fb_unref_work, system_unbound_wq); } diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h index b33e5bdc2..0cf512cc1 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h @@ -122,6 +122,7 @@ struct vop_common { struct vop_reg lut_buffer_index; struct vop_reg gate_en; struct vop_reg mmu_en; + struct vop_reg dma_stop; struct vop_reg out_mode; struct vop_reg standby; }; diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c index b9ee02061..9bcb40a64 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c @@ -466,6 +466,7 @@ static const struct vop_output rk3066_output = { }; static const struct vop_common rk3066_common = { + .dma_stop = VOP_REG(RK3066_SYS_CTRL0, 0x1, 0), .standby = VOP_REG(RK3066_SYS_CTRL0, 0x1, 1), .out_mode = VOP_REG(RK3066_DSP_CTRL0, 0xf, 0), .cfg_done = VOP_REG(RK3066_REG_CFG_DONE, 0x1, 0),