Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp544725lqs; Thu, 13 Jun 2024 19:48:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzZR1OUQLCVM9CfPfSWPnf6pJiluaroo2ph6xr7YiO+oemA70ElrwlSNOyZkYHmWME8XpcCRNwEqCd5JDJ/HgCAr8NQhp0wWJFuxBr2g== X-Google-Smtp-Source: AGHT+IGZH8pF3OoVBkebFVZxC1NtOXPkzwq8DFznC3C2wmZJSf4k6zcjxIBZdHO2fKCTWSdAgmVT X-Received: by 2002:a05:620a:2449:b0:796:af63:b7cc with SMTP id af79cd13be357-798d23e6942mr138006785a.15.1718333333180; Thu, 13 Jun 2024 19:48:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718333333; cv=pass; d=google.com; s=arc-20160816; b=qku5AJpytfeTDk4wBhgb3ffG7g0u4vDf/ldvdj1IUwwDiEl7tG+zPJcCxT3m4CeOyw hTCOgFMwNfkBFrhm3NJBy/LRDwgvzKqerW8pnogTKDtvzTt6fSuv3Jd6Va2eto0QKHVA P31kICVpGazSmaF9U/EPpBdMN+AQF/6cOJTRQzr2deSL/Wr+3lAG3iqIc2RdsIhP5eVy PQsrHRz5YX5ffgfVIGsatSp/XOXmk+9zwWMhw3Wh8oQfSvwcdQ/x/x3dAC3KSiAJzoXF LetP7SP86OiKFo45Lt4btoubXAAhoUiS8fY+zqsDf20BOcga3HvJvup/tWUNhXkD8qG1 5ENw== 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=JEZn22CVYdNgy3llz30TgBu2MjXVr5AFuBOydxXER6E=; fh=Cte0M41KL382K/845AypIeaUjyBIokCILHK+7S14cpc=; b=eRvZXpBbaDQYkNOov+h1RprRoc9TgoRpoJOpY25Uq2BoZiOflPYms9InkOvVvHTfNl OoWJrcy2/FbS7jILCip8O9pAAkOF9SmtfIJjb6yQ523jcLo3NuN3j5JAL+Aatp+MBD8Y j6+ipU7ankYu8i+a62aP5T0ZdLMiyh87XjNdpQVFEprGayzS7V7DdlAFccg6iMg72R8K cBnvFl6OOPMxqBxemZRhHFrNtz0ED5gH/RqgNQ3pgp7y98zMvSkNVugtHmUZu4w6DMVd Bt8AP4Rnivzd6DCNQMOsuql/2SMpC5gv4FsWMcG7Azof3eu2r8aaf2VGBiBHu4nGK7pL uyig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=n16cJO4g; 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-214260-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-798abe5ba01si270724485a.631.2024.06.13.19.48.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 19:48:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214260-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=n16cJO4g; 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-214260-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214260-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 99B7F1C21E85 for ; Fri, 14 Jun 2024 02:48:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A958A187573; Fri, 14 Jun 2024 02:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="n16cJO4g" Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (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 8C59B1850A4 for ; Fri, 14 Jun 2024 02:46:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718333194; cv=none; b=Qw278/NbV6BuXebcYFI8D+EgFS30NbnZrpBNs+rJlVtcBbFqDhsxJJWucVjUpWt/oeLpxpvncG9vwYuSx6C616Ujw8YAb2FooxNZ2eA2/il+OpBviQSmzoO6tp6NdU04FptyENY0ZdRcBn+7CjMomrptCrTfnVM/uoIV1+/lTAU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718333194; c=relaxed/simple; bh=t9PoXd7lvKi+h8gX32bxmAOP51RXBNKMqTi3tVAD+vI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GTf2O7R47svn0dqrX9m1RHAxjZd/bipilF3ETTj1DHWS7ReEcMXg+4mjleMnmzl6qMrCyhx8Vt6H07rPDV9JNR3cUOwc6eD0oBsOeyhlPO30Ca9V37pvoaejpGnx9innsVLJMVlLGn6aPVy07/i9Cj7cuVy/W//jYAbOcYOpYAE= 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=n16cJO4g; arc=none smtp.client-ip=210.61.82.184 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: 4a9f0c9c29f811efa22eafcdcd04c131-20240614 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=JEZn22CVYdNgy3llz30TgBu2MjXVr5AFuBOydxXER6E=; b=n16cJO4gc8XwJZ1p0FBONR6AaD9830VmZFb93LcCfrP0meNh89cBmn+xRIX1M57RMnT+wFlL1Z6JipXa8ezPwXWV343S/GhEzJL81+Oa65PJsfp3QzRoO+0U5zzrdjWN2MTeDHY3jLgYlhJwOMNQjHyALtEVKBTUGiNjDRPaiUw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.39,REQID:6275c0c1-8bdf-425f-abaf-743026f62bd8,IP:0,U RL:0,TC:0,Content:0,EDM:-30,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-30 X-CID-META: VersionHash:393d96e,CLOUDID:e3fe1185-4f93-4875-95e7-8c66ea833d57,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:2,IP:nil,UR L:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,S PR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 4a9f0c9c29f811efa22eafcdcd04c131-20240614 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1706330925; Fri, 14 Jun 2024 10:46:25 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 14 Jun 2024 10:46:23 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 14 Jun 2024 10:46:23 +0800 From: Shawn Sung To: Chun-Kuang Hu CC: Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , AngeloGioacchino Del Regno , "Bibby Hsieh" , CK Hu , "Nancy . Lin" , Sean Paul , Jason Chen , Fei Shao , , , , , Hsiao Chien Sung Subject: [PATCH v9 11/21] drm/mediatek: Add new color format MACROs in OVL Date: Fri, 14 Jun 2024 10:46:10 +0800 Message-ID: <20240614024620.19011-12-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240614024620.19011-1-shawn.sung@mediatek.com> References: <20240614024620.19011-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-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--5.032700-8.000000 X-TMASE-MatchedRID: B7xIh5hTocA/mJEvNFL+dbqQyAveNtg65hCwQ3LNHZ0vM0Gdq0fzqfMT uIrC6WWhPkn/V88HF8sSqo3ZUfrHh5Coy9iDotiwHcQQBuf4ZFvtMsBKGEjbqZsoi2XrUn/Jn6K dMrRsL14qtq5d3cxkNWqnMjmJR+9JCQBf3hdsghh5wY7hpybcOB9VaJFic4bCpj6vpo5Zq+s= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--5.032700-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 840A6161F61534913DE749BAA662769628037593C2C1F54BF2FFFC234EF60B802000:8 X-MTK: N From: Hsiao Chien Sung Define new color formats to hide the bit operation in the MACROs to make the switch statement more concise. Change the MACROs to align the naming rule in DRM. Signed-off-by: Hsiao Chien Sung --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index fd390fb83d0e..1923bbd96014 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c @@ -55,8 +55,10 @@ #define OVL_CON_BYTE_SWAP BIT(24) #define OVL_CON_MTX_YUV_TO_RGB (6 << 16) #define OVL_CON_CLRFMT_RGB (1 << 12) -#define OVL_CON_CLRFMT_RGBA8888 (2 << 12) -#define OVL_CON_CLRFMT_ARGB8888 (3 << 12) +#define OVL_CON_CLRFMT_ARGB8888 (2 << 12) +#define OVL_CON_CLRFMT_RGBA8888 (3 << 12) +#define OVL_CON_CLRFMT_ABGR8888 (OVL_CON_CLRFMT_RGBA8888 | OVL_CON_BYTE_SWAP) +#define OVL_CON_CLRFMT_BGRA8888 (OVL_CON_CLRFMT_ARGB8888 | OVL_CON_BYTE_SWAP) #define OVL_CON_CLRFMT_UYVY (4 << 12) #define OVL_CON_CLRFMT_YUYV (5 << 12) #define OVL_CON_CLRFMT_RGB565(ovl) ((ovl)->data->fmt_rgb565_is_0 ? \ @@ -393,22 +395,22 @@ static unsigned int ovl_fmt_convert(struct mtk_disp_ovl *ovl, unsigned int fmt) case DRM_FORMAT_RGBA8888: case DRM_FORMAT_RGBX1010102: case DRM_FORMAT_RGBA1010102: - return OVL_CON_CLRFMT_ARGB8888; + return OVL_CON_CLRFMT_RGBA8888; case DRM_FORMAT_BGRX8888: case DRM_FORMAT_BGRA8888: case DRM_FORMAT_BGRX1010102: case DRM_FORMAT_BGRA1010102: - return OVL_CON_CLRFMT_ARGB8888 | OVL_CON_BYTE_SWAP; + return OVL_CON_CLRFMT_BGRA8888; case DRM_FORMAT_XRGB8888: case DRM_FORMAT_ARGB8888: case DRM_FORMAT_XRGB2101010: case DRM_FORMAT_ARGB2101010: - return OVL_CON_CLRFMT_RGBA8888; + return OVL_CON_CLRFMT_ARGB8888; case DRM_FORMAT_XBGR8888: case DRM_FORMAT_ABGR8888: case DRM_FORMAT_XBGR2101010: case DRM_FORMAT_ABGR2101010: - return OVL_CON_CLRFMT_RGBA8888 | OVL_CON_BYTE_SWAP; + return OVL_CON_CLRFMT_ABGR8888; case DRM_FORMAT_UYVY: return OVL_CON_CLRFMT_UYVY | OVL_CON_MTX_YUV_TO_RGB; case DRM_FORMAT_YUYV: -- 2.18.0