Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1721713lqs; Sun, 16 Jun 2024 01:30:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUIvw503zqZ9SizqUzkUkybz1duuQ1fzFgF+JneH62sJ/EB7Bq8VSk/nBFy3+rQbQ23dWlDAITLTa1lIt+3Ya32lRCDEF2FhCTjVIe+yQ== X-Google-Smtp-Source: AGHT+IFDnNR1F+ilEtRCeaq0OlFZT6Z7jeHOKOGYGty/S5D24+L8L2kupY4gnw8tOKyfk8+6I5W/ X-Received: by 2002:a17:907:d50d:b0:a6f:61c7:dea7 with SMTP id a640c23a62f3a-a6f61c7df44mr493813666b.18.1718526612533; Sun, 16 Jun 2024 01:30:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718526612; cv=pass; d=google.com; s=arc-20160816; b=cdyuo5CuJCJXxTfuZd1v0Zih0jjfUq2TWSvihDidMmd16jvNlcFxvOO7OxZWXcPqdx fpog4rzue4PN20YxliHz8eiffTNU2vnxovq78QnBydY59wwXiZpL/qmcLrhTjx8viK0a vyF8iBLVAqIrergz7FgHtaeoafYSSTRUnve2XuJGErhZjeqgO/JEtQKFbyfJM4x+1Qdz dQhGzLBDQ0YXgSL0SK+VOey3NJkjckbhjVSs/z1czeenq6Vx2c6iIkfWaFTVVUBL4Jp3 qG6IweOWwZkaP8m8YwvYXvYKG8jlSP+Kem33vZMSqDwI25scEItvkYEcb8yR2EekZAw2 Ri8Q== 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=Sm6pLRMIadhWUQbTm+SU3xjWdShSo5je89g5gVd1CM8=; fh=6tE54z06ulRkgzfrooKGswCitNkbv5FNTOdWO2JiScs=; b=C6BSnwpRL7HvPzzhaHjdDJE1E4lyUYuNlOkdr504Oa97FRq0zw0boPO2mLBHsYoUNI FnH93a+U1e5MBGMM6Bex6ZDbGqvlvweg+Bt+apFU8ptFo0NCzhaCfN6wOwecV1t/pWrf pWH/+SM0Lqz4ziLQL08PC7iWDysepgPkX2vAbalWFkQWwZp0+cc2Ekb7tr09hbVK0ake gRLbWV992PRfhbF0LwCqdye4GOG/MuMJ5tigiN5/otR7zfQvZDeRwpgzKe+qc2W33f85 32+6DDFhGJSs+FzWsMUOevULVEJUwh5zQ9d0fhQ60p4ZIs83fIlfo/w5bYMBoQcaerey 4SkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A2G9MSCw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-216198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216198-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56d4d51asi346425466b.255.2024.06.16.01.30.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jun 2024 01:30:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-216198-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=@kernel.org header.s=k20201202 header.b=A2G9MSCw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-216198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216198-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 16BF61F218A3 for ; Sun, 16 Jun 2024 08:30:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 30151188CC2; 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="A2G9MSCw" 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 B3957186E47 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=U6HgGFfHqH72svtLhQob7M/Ebo2CrbqMIJCI4pMqkxDC0GCLfebm4Xfx6YLb+CChVLCMcntKXJDRgvoiyGkVww/qufXaG9KY6Yh29b7R71sm7x9VUYbn1CyQL7grwBxOXZ1yb8j5hp6+lZmPwb2gORhMvWKnLqYwjk+20j9lMwM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718526555; c=relaxed/simple; bh=xKNWUgFXfxxJxsbsrQFN+oCq3wUTCBTqUZlVxCgJNX4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QDTNLJYG3oxItP6o/Zc9MEq1owa5g/qAwJq8HIM43XW8Pk/4TESAulGiL5GsmLi23RabRBJObkfxk3wFhge2jr0dJbN5y0nIb/ubzB5vwTU+znWYkXiapYG4Ys7aF+D84c1jwx0WKaz3lsj8woM9STEu/VAh75zolp4Djl3XNhc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A2G9MSCw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 6954AC4DDE0; 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=xKNWUgFXfxxJxsbsrQFN+oCq3wUTCBTqUZlVxCgJNX4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=A2G9MSCwZZPyma9W/SYiNf1zoeP8UhkSH3N1SqUh4EoNCqoYGTkcLS9VGflC5PS1X RqzecikdnUSmwTNbp22GpA4Drpt7UodYyrI29V8Tp5zAMJub7CGxcqftyheEmpwl1F z4KIuYoCNXICD3ySG1rIn7pFjlRtLPxCVU2j6QRXThZwSwKG7BOd4v++N+y4vbxnOg HYJv37dDEqyk0njGrlfYVuiWtheo7vJy7bEnqXkQec9Km75KZPmn0x2+RO55kMTa85 jGahIEW5uERePrkw7TXbz5OjT03nNyzlSWetmtKFtQ7qoPlPCh1jVx9c9Q8PaNwek9 G+3Sdli+Xwe9w== 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 6211BC27C6E; Sun, 16 Jun 2024 08:29:15 +0000 (UTC) From: Hsiao Chien Sung via B4 Relay Date: Sun, 16 Jun 2024 16:29:21 +0800 Subject: [PATCH 11/13] drm/mediatek: Add new color format MACROs 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-11-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=2253; i=shawn.sung@mediatek.com; s=20240616; h=from:subject:message-id; bh=J0/Anzi+y4uw+0O9klzleyv0GI7jaR27OwOPnsYdzkY=; b=61A1PX0aFgANjdf8c2g76ZouHwLz25Jo7qmbTB7Cn093WSF0A+7G2Zinv8syelPa5sbJ5xcvH GO7sibSuAJ9DNy49JwGCMoqcKJHYZJpTObxabS6bipMc+DsuBVzCdq1 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 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 Reviewed-by: CK Hu --- 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 615b75919d1b..33b58da15ba4 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: -- Git-146)