From patchwork Tue Apr 26 08:41:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 12826687 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D026C433EF for ; Tue, 26 Apr 2022 08:55:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345715AbiDZI6Q (ORCPT ); Tue, 26 Apr 2022 04:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345607AbiDZI53 (ORCPT ); Tue, 26 Apr 2022 04:57:29 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 22B3C84EFF for ; Tue, 26 Apr 2022 01:42:04 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.90,290,1643641200"; d="scan'208";a="118023982" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 26 Apr 2022 17:42:03 +0900 Received: from localhost.localdomain (unknown [10.226.92.117]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id AE0E840071E2; Tue, 26 Apr 2022 17:41:59 +0900 (JST) From: Biju Das To: David Airlie , Daniel Vetter Cc: LUU HOAI , Laurent Pinchart , Kieran Bingham , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven , Chris Paterson , Biju Das , Prabhakar Mahadev Lad , Biju Das Subject: [PATCH v2] drm: rcar-du: Fix Alpha blending issue on Gen3 Date: Tue, 26 Apr 2022 09:41:57 +0100 Message-Id: <20220426084157.10979-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: LUU HOAI As per R-Car-Gen3_Common_OPC_Customer_Notifications_V30.1.pdf, unexpected image output(such as incorrect colors or planes being invisible) can happen on the below conditions, as PnALPHAR register is not initialized by reset. When alpha blending (PpMRm.PpSPIM=0b101) is performed and: •two Planes are enabled on any DUn (n=0,1,2,3) oDSPRn= 0x0000 0031 or 0x0000 0013 •or DU0 and DU1 is used for display at the same time oDSPR0= 0x0000 0001 and DSPR1= 0x0000 0003 oDSPR0= 0x0000 0003 and DSPR1= 0x0000 0001 •or DU2 and DU3(H3 Only) is used for display at the same time oDSPR2= 0x0000 0001 and DSPR3= 0x0000 0003 oDSPR2= 0x0000 0003 and DSPR3= 0x0000 0001 This patch set PnALPHAR register to 0 to avoid this issue. Signed-off-by: LUU HOAI Signed-off-by: Biju Das Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- v1->v2: * Updated commit description * Updated the code comments --- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index f214a8b6cfd3..aa80c44dd8d7 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -510,6 +510,18 @@ static void rcar_du_plane_setup_format_gen3(struct rcar_du_group *rgrp, rcar_du_plane_write(rgrp, index, PnDDCR4, state->format->edf | PnDDCR4_CODE); + + /* + * On Gen3, some DU channels have two planes, each being wired to a + * separate VSPD instance. The DU can then blend two planes. While + * this feature isn't used by the driver, issues related to alpha + * blending (such as incorrect colors or planes being invisible) may + * still occur if the PnALPHAR register has a stale value. Set the + * register to 0 to avoid this. + */ + + /* TODO: Check if alpha-blending should be disabled in PnMR. */ + rcar_du_plane_write(rgrp, index, PnALPHAR, 0); } static void rcar_du_plane_setup_format(struct rcar_du_group *rgrp,