Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1042683lqm; Thu, 2 May 2024 03:41:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+ZIXRb2WITIk6e5cLYsskaaLTEdYyVGovoZgm4/jBlVYBKlOLUKSqHjUI01ryL+Fe9iDht6CPn2QNV1ijKwavLL+QR15NftxVZVWsTA== X-Google-Smtp-Source: AGHT+IGw00ZId0VGwafRz18VoQ5qXiIpeIQQwIXDLXgc8Cxxy5Tavl7Q+4oX7sl0QJj83KdslNZr X-Received: by 2002:aa7:de17:0:b0:572:ad86:d317 with SMTP id h23-20020aa7de17000000b00572ad86d317mr2507415edv.11.1714646467395; Thu, 02 May 2024 03:41:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714646467; cv=pass; d=google.com; s=arc-20160816; b=CJmZGR5WlZZbCPm3b7fFbgxqoHrUNZlPhR9yAw6DM55YkiYyr46YPe9JMkHYIb/2Zq hicyk9Qcpj5DD0v/3TRniubW/IhymCKvm2hGGiO+QDttY3252H7OC411fZiXofj8fBwc kB+cHmnHZEfOoZ7UJ9+XW8zERPAnVPejG5fStNFy6B1CH5MqSpcSqTcYZNAkzPOMDdxX /mh4V1p1pwPoLqHKBnlVbfOpCxZEXDQgCkA1pipdR4hrhirayuzG2ygctAtf1UCT7NQH AlMmFAPr4qA//eFTULjSvo/pxkGxtNRmfGLNFDSkgY2zk99PlXJwO15ky75UQBvBEEqq ga4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oSpYAptlh/gMDRNgjPiOXVaha68b6mP4NwlcOf4Q0S0=; fh=WDbJBf7vmcLtsuNVv5t5UxvBRtuOFYPCW/4VP7Yx+3k=; b=dcVIpf7XHdc6IyxPz0U1lI3xJ7vUEcpIB2YHGduN4UpBCiCA5/YQ/2xaXpjW70vd7K kZjY2Q+3csfOyCo3w8eG9WRyItMJp9mPgZDfE5QQsSKRWhppePAe5A8xmkB/G0EXVFpD zGDeFhFkRXWKqBpeeMISBWe66CF0ics423IIZ1zABTQGYd+Qqs5nzCJXV8hnfxd5z7U1 OFJkwssZGM/uMewzwZCrGCS/fAmdhT20KNJ8i7F+yxUzZNHA1030UDoNQpQkxt1A5loF 8+g0i22MFSuKK9FZO8zf5La6KkhV5E51T3LwukfLTyfLuEimzvftxPd5Uo1Leyd9O7LA hOPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mvfxIU3l; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-166326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166326-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l1-20020aa7c3c1000000b00571d70d1b05si375962edr.370.2024.05.02.03.41.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 03:41:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mvfxIU3l; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-166326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166326-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 154B61F229B1 for ; Thu, 2 May 2024 10:41:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D72484A3F; Thu, 2 May 2024 10:39:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="mvfxIU3l" Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (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 0758360DE9 for ; Thu, 2 May 2024 10:39:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.244.123.138 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714646349; cv=none; b=hKuS2lpKvSU1/DqYjhEvS04XtMQfN4zwJKet8zn+Prflyo0+bjRik2CEykVk9II4ujVZlqawq+sYoOGNVSVIrBmy7+qFKH2GPQJUbvR5ee1OJ3cHg3KOf3m7cKQ/cjNYfZ6ciEAauyfiGoftck9aTbDCUM0wmQg4iXNi3Zhek8o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714646349; c=relaxed/simple; bh=T/IXaTidzWw/5vgCdqgZtJJG+jHHqm3cuU5pgacLDSI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VUSyKOE4AsKAc1Kqp6UlZgfnndZ05irvMo/pVyo1TTmHb8PQJvZZ0dUeL39TEcATuaPr4Kmz7liT7/ukgaZwOb+GH6GuyivnxNrQryFYu6FzVK+M11AiNN5bCX7uv4OCivbW3Yk717Adf/b/AKAwLRiAednboNzLu5tEzz+Rlbo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=mvfxIU3l; arc=none smtp.client-ip=60.244.123.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: 2ed87862087011efb92737409a0e9459-20240502 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=oSpYAptlh/gMDRNgjPiOXVaha68b6mP4NwlcOf4Q0S0=; b=mvfxIU3lgBFc7B57Lrzo7bqJbLf2SwCMm2FtUQ3idrzGuIpFZ53CtI8k+3WfS3cIQbpYCLBAKq1lFnr5lt/I3QYMOmo36SRsmzdhyubAE6y5E8NAHPBkpkqaKwocVRCTCnkdfGA3wtvxgPZ2R+rFD3tE2l1cJlP0vauz6tLv7gs=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.38,REQID:d452f37b-a597-4f99-b7af-ed3f96eae9c8,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:82c5f88,CLOUDID:c6aede86-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1, SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 2ed87862087011efb92737409a0e9459-20240502 Received: from mtkmbs09n1.mediatek.inc [(172.21.101.35)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1341939138; Thu, 02 May 2024 18:38:58 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 2 May 2024 18:38:57 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 2 May 2024 18:38:57 +0800 From: Shawn Sung To: Chun-Kuang Hu , AngeloGioacchino Del Regno CC: Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , Bibby Hsieh , CK Hu , "Nancy . Lin" , Fei Shao , Sean Paul , Jason Chen , , , , , Hsiao Chien Sung Subject: [PATCH v7 12/18] drm/mediatek: Support "Pre-multiplied" blending in Mixer Date: Thu, 2 May 2024 18:38:42 +0800 Message-ID: <20240502103848.5845-13-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240502103848.5845-1-shawn.sung@mediatek.com> References: <20240502103848.5845-1-shawn.sung@mediatek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N From: Hsiao Chien Sung Support "Pre-multiplied" alpha blending mode in Mixer. Before this patch, only the coverage mode is supported. Signed-off-by: Hsiao Chien Sung --- drivers/gpu/drm/mediatek/mtk_ethdr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c index 5283e0993ed65..4f043be21ee36 100644 --- a/drivers/gpu/drm/mediatek/mtk_ethdr.c +++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -35,6 +36,7 @@ #define MIX_SRC_L0_EN BIT(0) #define MIX_L_SRC_CON(n) (0x28 + 0x18 * (n)) #define NON_PREMULTI_SOURCE (2 << 12) +#define PREMULTI_SOURCE (3 << 12) #define MIX_L_SRC_SIZE(n) (0x30 + 0x18 * (n)) #define MIX_L_SRC_OFFSET(n) (0x34 + 0x18 * (n)) #define MIX_FUNC_DCM0 0x120 @@ -153,7 +155,7 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx, struct mtk_plane_pending_state *pending = &state->pending; unsigned int offset = (pending->x & 1) << 31 | pending->y << 16 | pending->x; unsigned int align_width = ALIGN_DOWN(pending->width, 2); - unsigned int alpha_con = 0; + unsigned int mix_con = 0; bool replace_src_a = false; dev_dbg(dev, "%s+ idx:%d", __func__, idx); @@ -171,8 +173,12 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx, return; } - if (state->base.fb && state->base.fb->format->has_alpha) - alpha_con = MIXER_ALPHA_AEN | MIXER_ALPHA; + mix_con |= MIXER_ALPHA_AEN | (state->base.alpha & MIXER_ALPHA); + + if (state->base.pixel_blend_mode != DRM_MODE_BLEND_COVERAGE) + mix_con |= PREMULTI_SOURCE; + else + mix_con |= NON_PREMULTI_SOURCE; if (state->base.fb && !state->base.fb->format->has_alpha) { /* @@ -189,8 +195,7 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx, mtk_ddp_write(cmdq_pkt, pending->height << 16 | align_width, &mixer->cmdq_base, mixer->regs, MIX_L_SRC_SIZE(idx)); mtk_ddp_write(cmdq_pkt, offset, &mixer->cmdq_base, mixer->regs, MIX_L_SRC_OFFSET(idx)); - mtk_ddp_write_mask(cmdq_pkt, alpha_con, &mixer->cmdq_base, mixer->regs, MIX_L_SRC_CON(idx), - 0x1ff); + mtk_ddp_write(cmdq_pkt, mix_con, &mixer->cmdq_base, mixer->regs, MIX_L_SRC_CON(idx)); mtk_ddp_write_mask(cmdq_pkt, BIT(idx), &mixer->cmdq_base, mixer->regs, MIX_SRC_CON, BIT(idx)); } -- 2.18.0