Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1043152lqm; Thu, 2 May 2024 03:42:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVloVKqI1k2wX+hDQIqJwl7Wu7apxoTF2QybWHOCgLfU2UsRxWbJ/FT1ufoWboNeW/xZ7R9iSoxehO8iBUrVw/OLVfryZ+SuX7/0f5mZA== X-Google-Smtp-Source: AGHT+IEiLSXGzmqvdrlUge+qVFnV2+8YkcqYD7vjA3t+4zWqKnVZJcVi4+x6+UrtLPA4FDSCv1Ks X-Received: by 2002:a17:902:f7cc:b0:1e7:b7a7:9f20 with SMTP id h12-20020a170902f7cc00b001e7b7a79f20mr4792131plw.59.1714646538064; Thu, 02 May 2024 03:42:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714646538; cv=pass; d=google.com; s=arc-20160816; b=Y23BR3T7agkeoS5/TQLiyreauPbR2A/oD8swooqkJLvfYGyEEtQjhyY5XEj9ie5R8K 3ZDG7V5rsLja0ZyjGIMxmCk6E6NWatxRg5BTd7gV7LS7BjyqmMwmi0GtrJe1kQmV67JE cgxAgu5tLjAHahXKdhxqTHeJaDh723ou9KJsM5b1oWryFJp0ViYMgZcpmYVQ/tUk2+jw o8JXAuBs34xhTK1HzitJSVtR+30Gx2s5RnFux4caSa16ng2IGaaN0rvXk92mezzpdNOj dSQ6NNI+RUOBX6WhDT2JnkxYcNbiDOlnmbVga+wMnsGuoyQt2L6p1OG7WQ0nVi7mn4kY sfIg== 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=hPhtlP7Rn06e69fD+fOVWxVIRkVvwg2I4eg43m4ZBdA=; fh=WDbJBf7vmcLtsuNVv5t5UxvBRtuOFYPCW/4VP7Yx+3k=; b=vncYFMIIBU35dtMImz7QqgoWwPUSBq9XslHeKNz0qzpJXNKPBkKTrnF/zU4/VuUnF1 4NRVBaEqwzU+E9firQsPJXMp9bW+FhDgVhcfWJ6o+TwuWOLEAn8ibwT/WFAcskiJqe0F fgJTWwLZC2chIeSicuX0/Z8ve0Vs0jYGiRsxvlkAfE1Jx/KVpioQiu2Kpmi08cAnNzbk uoic4928IIvTczOhepwaAx90YcPivL1oY2dTD+jHG2VJy1hiPWG9pZUqo7BJrBy51O5U kcYL6zyH/qYLxuNzpvx6ZE8krHDLU/24rQdYzH1vIrnaUMyZkzFYNxLFMeGHEco1+dz2 veSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=RwMC4fzB; 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-166329-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166329-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m16-20020a170902f65000b001ec4e457c42si778679plg.277.2024.05.02.03.42.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 03:42:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166329-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=RwMC4fzB; 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-166329-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166329-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7EC7C285FBF for ; Thu, 2 May 2024 10:41:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 557EF129E93; Thu, 2 May 2024 10:39:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="RwMC4fzB" 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 EEA6B77A1E for ; Thu, 2 May 2024 10:39:07 +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=1714646351; cv=none; b=NOSlxeaEnGTiwgL9RPL5AGDw9CJc8Xx7wGf+gGdwbXAQ9miMzmc3Jp+NixxbXIxxNAQX/MetxTJGlILjwOaO+IJ3B7WnHIGU0cB5EV/UIe55EEnsDrUmW5+ZptIE48tXTiJQoTEdzKK90nfUwcLmHVa+36+bi5w8NoHBrrGnb3M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714646351; c=relaxed/simple; bh=Ys4t+wexxrPGt+Y1FNRAbvu09iISUMVZLqduxu/nXDg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ly8FjjFeWrPNyz1tApJELsbHlnvRZh7Jh3QWMQbE+qnZ7R6U6wOcpglS3cS99xOvw5Pt3OqcvVVl18zu99FEdfVzJVCnVZHpPrKcefHvibFSU9X27ALxKowuIPQHgOI0tM/bIwyAQiB+02/Z0FNFTVJjYNychUeWzBEQwwk6N8s= 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=RwMC4fzB; 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: 2e560ce2087011efb92737409a0e9459-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=hPhtlP7Rn06e69fD+fOVWxVIRkVvwg2I4eg43m4ZBdA=; b=RwMC4fzBLVich4PHk04KRFc6RQFJ3V6R0lWkvJSXPW9zR+ZrisS1aPlgQaxV3w2R8xJcBrrJVy4VI5pi+cesxOdyssl0Ac185GYI+6C6TykOnFH/T+UpmqK5/TqQ0vFKbZZycb9RIc1nmmc3+aGlweYrjA1NnoLaKcm8QSCXqjk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.38,REQID:46da1762-758c-410d-bf69-c4ebea4d1295,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:82c5f88,CLOUDID:bdee9afb-ed05-4274-9204-014369d201e8,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: 2e560ce2087011efb92737409a0e9459-20240502 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1663154014; Thu, 02 May 2024 18:38:57 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs11n2.mediatek.inc (172.21.101.187) 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:56 +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:56 +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 07/18] drm/mediatek: Support more 10bit formats in OVL Date: Thu, 2 May 2024 18:38:37 +0800 Message-ID: <20240502103848.5845-8-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 more 10bit formats in OVL. Signed-off-by: Hsiao Chien Sung --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 32 ++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index 862ab683ed1b4..d970cdce06bc7 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c @@ -71,6 +71,22 @@ #define OVL_CON_VIRT_FLIP BIT(9) #define OVL_CON_HORZ_FLIP BIT(10) +static inline bool is_10bit_rgb(u32 fmt) +{ + switch (fmt) { + case DRM_FORMAT_XRGB2101010: + case DRM_FORMAT_ARGB2101010: + case DRM_FORMAT_RGBX1010102: + case DRM_FORMAT_RGBA1010102: + case DRM_FORMAT_XBGR2101010: + case DRM_FORMAT_ABGR2101010: + case DRM_FORMAT_BGRX1010102: + case DRM_FORMAT_BGRA1010102: + return true; + } + return false; +} + static const u32 mt8173_formats[] = { DRM_FORMAT_XRGB8888, DRM_FORMAT_ARGB8888, @@ -88,12 +104,18 @@ static const u32 mt8173_formats[] = { static const u32 mt8195_formats[] = { DRM_FORMAT_XRGB8888, DRM_FORMAT_ARGB8888, + DRM_FORMAT_XRGB2101010, DRM_FORMAT_ARGB2101010, DRM_FORMAT_BGRX8888, DRM_FORMAT_BGRA8888, + DRM_FORMAT_BGRX1010102, DRM_FORMAT_BGRA1010102, DRM_FORMAT_ABGR8888, DRM_FORMAT_XBGR8888, + DRM_FORMAT_XBGR2101010, + DRM_FORMAT_ABGR2101010, + DRM_FORMAT_RGBX1010102, + DRM_FORMAT_RGBA1010102, DRM_FORMAT_RGB888, DRM_FORMAT_BGR888, DRM_FORMAT_RGB565, @@ -253,9 +275,7 @@ static void mtk_ovl_set_bit_depth(struct device *dev, int idx, u32 format, reg = readl(ovl->regs + DISP_REG_OVL_CLRFMT_EXT); reg &= ~OVL_CON_CLRFMT_BIT_DEPTH_MASK(idx); - if (format == DRM_FORMAT_RGBA1010102 || - format == DRM_FORMAT_BGRA1010102 || - format == DRM_FORMAT_ARGB2101010) + if (is_10bit_rgb(format)) bit_depth = OVL_CON_CLRFMT_10_BIT; reg |= OVL_CON_CLRFMT_BIT_DEPTH(bit_depth, idx); @@ -368,17 +388,23 @@ static unsigned int ovl_fmt_convert(struct mtk_disp_ovl *ovl, unsigned int fmt) return OVL_CON_CLRFMT_RGB888(ovl) | OVL_CON_BYTE_SWAP; case DRM_FORMAT_RGBX8888: case DRM_FORMAT_RGBA8888: + case DRM_FORMAT_RGBX1010102: + case DRM_FORMAT_RGBA1010102: return OVL_CON_CLRFMT_ARGB8888; 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; case DRM_FORMAT_XRGB8888: case DRM_FORMAT_ARGB8888: + case DRM_FORMAT_XRGB2101010: case DRM_FORMAT_ARGB2101010: return OVL_CON_CLRFMT_RGBA8888; 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; case DRM_FORMAT_UYVY: return OVL_CON_CLRFMT_UYVY | OVL_CON_MTX_YUV_TO_RGB; -- 2.18.0