Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1721683lqs; Sun, 16 Jun 2024 01:30:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXgZtJ0bLNM73J3w0tBwDsk57GpoSJwEtlQgXcVG9pHQ+QC8vH5G0nin06DW8EwIKFvEV0TVO62g/JJVA7gkXVsGQw+Ef1e9vVYk7ZwBA== X-Google-Smtp-Source: AGHT+IHH5896sZj7no8MeIkudUnkpGteIlY2VNrCO407I4PJ9rVxuW7ekhpsKeNhjehWEBX0Hm4E X-Received: by 2002:a05:620a:4454:b0:795:5b8b:7a03 with SMTP id af79cd13be357-798d022c4e1mr1278087785a.16.1718526608563; Sun, 16 Jun 2024 01:30:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718526608; cv=pass; d=google.com; s=arc-20160816; b=lJYdNWnCfUgrNNtWEL9zftHM2OLs/4iDtTryznG1DQPwbL3el2SUvq/gXvKsn/TNXp y107k9GeSdTHHDq30sU2G7FcsN4JOZFDXhEbr5FfitVs8/XHzaN3NMSW8HabyAOU5h+d UF+gKUA4YpTBHK2oZSkUD9+5IjSmP8gwLGEP/0IRzbGUdEoykrYWXIT70XhXE1imOMTT LRFC46dQQgYn4JDRidEoS32QYUKJ3AfoBNMc9lYbdePMgZmg5W1wxp1hm6xjhtTMY70H omp3MobOmjfvqxwUXoJu7syu56H74R0YVuK1RHH4tvir87YhBdZZ1My/tDRc/E/2e9FW +TTg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=ZUV7HIETMNgFahKTFGwR9GyqKaM5n+1VzmUpGIimyS0=; fh=6tE54z06ulRkgzfrooKGswCitNkbv5FNTOdWO2JiScs=; b=s+gS1Gty8IfRxkyVnkrBtGJ/36lyg1W6F0hsOC164JmQQyVaqje4BeCDCaahdHR1ln qiW+Akh1+hOUMVR16Ou9TvH/vAb4jO7GyqT1SwTUOU5w9yGmJrb8KmMYOq01VBHLRo5m YnaWJKu2rOhOPWK7n22XXnI49EBf6aOHZfcVwwYPGOqqbDEwLGHdFUk8EJs66Zawort6 3IoBTaJ24oCRCFTagQTiH4qCP5rfQBDzUEKMbAEtqXRlEgzkC9b5+sULk5qR/KVUnf9P Bn0MNG+7abXxkrdtHBs1D0DnZmiSv8/qzXkA7DA7NcGIfC5KAVMaHRX8Ws6ds4qO90aI QaLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cf8fve1z; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-216196-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216196-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-798aacc5d51si725297685a.176.2024.06.16.01.30.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jun 2024 01:30:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-216196-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cf8fve1z; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-216196-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216196-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 06CEB1C20C1B for ; Sun, 16 Jun 2024 08:30:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00984188CAE; Sun, 16 Jun 2024 08:29:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Cf8fve1z" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B385D186E46 for ; Sun, 16 Jun 2024 08:29:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718526555; cv=none; b=o8/MlMhiAW7R5Aeyk3Zu/m29L5D4Q0LMKYV7jLVScot8WSRfnh/bzvvFMPlvJP97U7ezpHk04BWqlNjrxZipfZl0CW9tvScuKKazqma7xbuOoxkIHELroMO32rMPGdT5stZU704Y4H6UR3ju2x7G/0ZlodCeUwc/r1yVawwO3tg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718526555; c=relaxed/simple; bh=oxb98+Wjy7FjeM9SCAgGOpXxtSD5dWzTsQu21L3Bfoo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rdK0uRR+6sNC2gH1lvodDgWgcel4jW5TFS6iij1AuOzgrcsQp6nko1WnvCBd8PpDhulm9V4CKEyAW6vVHlAxZ3qaDVxt+efTkUb/huhAxQ0PSTHoCscy4R+7sktghRGls5UHsw0S2b44O3vIzZ5bkW2HaedaS7+nwTsluVYIE+I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Cf8fve1z; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 4C6F5C4AF63; Sun, 16 Jun 2024 08:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718526555; bh=oxb98+Wjy7FjeM9SCAgGOpXxtSD5dWzTsQu21L3Bfoo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Cf8fve1zALnXtP2E3IypIGjIbnh7OmphnienG/0XEHp6HfwQ5b5srvHqszmc0Fd2F Eo0tKvpRgEcdyLm3HHjxtduKl50LDn3YL46dSMS1MD7AWa23fesK7TcxqVbSzUe+87 nx17WbWD4II1oAbECqQWb8SyWmcLkJVkV/nf7xTwoXv49PHFIucLa+CiQ6gFCRFnXS K6gI9P7JoCZBWYYKMwsTpQvdfAFX+muLrkjAHfKLYbdm0CLQAOQCg8LTsWJERGlbxi fGR6Wn5RTA0FnM8sqIXIF737Cd3K0MJ2GRFKbeALudluJE48odBcIFAcw+ibCbWnBX g1bBm4Srly08w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44C2BC27C6E; Sun, 16 Jun 2024 08:29:15 +0000 (UTC) From: Hsiao Chien Sung via B4 Relay Date: Sun, 16 Jun 2024 16:29:19 +0800 Subject: [PATCH 09/13] drm/mediatek: Fix XRGB setting error in OVL Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240616-mediatek-drm-next-v1-9-7e8f9cf785d8@mediatek.com> References: <20240616-mediatek-drm-next-v1-0-7e8f9cf785d8@mediatek.com> In-Reply-To: <20240616-mediatek-drm-next-v1-0-7e8f9cf785d8@mediatek.com> To: Chun-Kuang Hu , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , AngeloGioacchino Del Regno , CK Hu , Bibby Hsieh , Daniel Kurtz , YT Shen , Mao Huang , "Nancy.Lin" Cc: dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Hsiao Chien Sung X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718526553; l=2836; i=shawn.sung@mediatek.com; s=20240616; h=from:subject:message-id; bh=vVW9D7krUv/QeI7mKMXg4dCoJYZZZHxYjH8XtvTllws=; b=QoL51j2R0DiY+OHpy49e3QAW6LGgdoVCPECx4xnWLYMZrD3YfeTfIC47sGwymgVf4ZbeyXm38 Fq2J9Sfl+eXBwiwskTMoIlnl52iizChvE30QSBSkFtxhw2+0cG/HEO3 X-Developer-Key: i=shawn.sung@mediatek.com; a=ed25519; pk=lq1w8BuWDINX+4JHjGHhhbAU5ICP+cL9VCj7wn+cEDA= X-Endpoint-Received: by B4 Relay for shawn.sung@mediatek.com/20240616 with auth_id=172 X-Original-From: Hsiao Chien Sung Reply-To: shawn.sung@mediatek.com From: Hsiao Chien Sung CONST_BLD must be enabled for XRGB formats although the alpha channel can be ignored, or OVL will still read the value from memory. This error only affects CRC generation. Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.") Signed-off-by: Hsiao Chien Sung --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index 738244a6164e..615b75919d1b 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c @@ -38,6 +38,7 @@ #define DISP_REG_OVL_PITCH_MSB(n) (0x0040 + 0x20 * (n)) #define OVL_PITCH_MSB_2ND_SUBBUF BIT(16) #define DISP_REG_OVL_PITCH(n) (0x0044 + 0x20 * (n)) +#define OVL_CONST_BLEND BIT(28) #define DISP_REG_OVL_RDMA_CTRL(n) (0x00c0 + 0x20 * (n)) #define DISP_REG_OVL_RDMA_GMC(n) (0x00c8 + 0x20 * (n)) #define DISP_REG_OVL_ADDR_MT2701 0x0040 @@ -428,6 +429,7 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx, unsigned int fmt = pending->format; unsigned int offset = (pending->y << 16) | pending->x; unsigned int src_size = (pending->height << 16) | pending->width; + unsigned int ignore_pixel_alpha = 0; unsigned int con; bool is_afbc = pending->modifier != DRM_FORMAT_MOD_LINEAR; union overlay_pitch { @@ -449,6 +451,14 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx, if (state->base.fb && state->base.fb->format->has_alpha) con |= OVL_CON_AEN | OVL_CON_ALPHA; + /* CONST_BLD must be enabled for XRGB formats although the alpha channel + * can be ignored, or OVL will still read the value from memory. + * For RGB888 related formats, whether CONST_BLD is enabled or not won't + * affect the result. Therefore we use !has_alpha as the condition. + */ + if (state->base.fb && !state->base.fb->format->has_alpha) + ignore_pixel_alpha = OVL_CONST_BLEND; + if (pending->rotation & DRM_MODE_REFLECT_Y) { con |= OVL_CON_VIRT_FLIP; addr += (pending->height - 1) * pending->pitch; @@ -464,8 +474,8 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx, mtk_ddp_write_relaxed(cmdq_pkt, con, &ovl->cmdq_reg, ovl->regs, DISP_REG_OVL_CON(idx)); - mtk_ddp_write_relaxed(cmdq_pkt, overlay_pitch.split_pitch.lsb, &ovl->cmdq_reg, ovl->regs, - DISP_REG_OVL_PITCH(idx)); + mtk_ddp_write_relaxed(cmdq_pkt, overlay_pitch.split_pitch.lsb | ignore_pixel_alpha, + &ovl->cmdq_reg, ovl->regs, DISP_REG_OVL_PITCH(idx)); mtk_ddp_write_relaxed(cmdq_pkt, src_size, &ovl->cmdq_reg, ovl->regs, DISP_REG_OVL_SRC_SIZE(idx)); mtk_ddp_write_relaxed(cmdq_pkt, offset, &ovl->cmdq_reg, ovl->regs, -- Git-146)