Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp544228lqs; Thu, 13 Jun 2024 19:47:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXpTkg/TV0JcRwcV+5/U20xtmIJsN27C1uDuJdOVFZ72FPrVMNJ9RzGhyZOTcacGE5c2Yz8j6Nv/TWMcpTQ4v0KrY1v0oGj8+xCwCiUrA== X-Google-Smtp-Source: AGHT+IErKDkmlfQXxYrrEdiIG9PeYLLqyrPMqJIeFQqN/JYGXZ9mR7UrP9kqqMpZbyHF3aeHXO29 X-Received: by 2002:a25:2d1b:0:b0:df7:6c37:5bb3 with SMTP id 3f1490d57ef6-dff1538d388mr1274516276.15.1718333224045; Thu, 13 Jun 2024 19:47:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718333224; cv=pass; d=google.com; s=arc-20160816; b=dN7Inh0zrtPb76x1B6gbx28PQyffcJ+fEx0FIrTQZTWI7kk39akKDnvYC50T3g2MP+ lDrcRd1lcl0gY0rTq269+a7QwUjVKjWUS7rNhgzscF1S0eCgXfrms2JRkx9hnijAc2Rm bxLuDYhAKZWQx2Xvp+C6qIdtyKUDxpgCFGc4IF6z90wDT/l/dseKAOwy5zGUMIaNHmXh U1oB3URFfKCpQgba6as78WVnGYQ7P+BrWWGxroXRtxA5Ny0HUNxGAojWOWTl8FHbBpea +Goq4KMSgYK0iu2yK4LTu01qCF5E297cXAzK2wjgZ6WBojvFCPNnooZ00lMonRhJ4ALT JrMQ== 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=q1VEYsaTRBuapIDGlm2Ds9ITMgUQ0qhzoxCFj/P5Sug=; fh=q/Ppq8/frEfcA3kotGB0IrpJr8gO0uNs3CtN4uoBAAY=; b=nJBWfwODMspKLdnmUFtzSckz9fcMffYrLZtCJCIudu9cPtcBpbQQtHDkZFm9ouo7cc BkgPVUF7n3Yrasx87YogKD2qDVFQZYAMkzg5XPLJDqeHWO6oc3xKgYbbWH6Aeu+7mBKn +2fW15iUZdeGCXidxf7BkzoT1rFcPFv3SPriBYCltFuU6wsmhNDc6RTp0wyNs9CQFIQX Surw6Wy+5vyG/5NFfSgKBGP6oqn9DVfJpTytmgtEq8014CJsjumAx12cE3GdabADvkW8 /mqiBG/ueTURpwtfVPXj6/w+l0QNEipjfpKa+hV6A0zUWg6BcoLin6v8jqBGXMu+AZLi unbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=MYL07Jtt; 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-214250-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214250-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. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-441f30f8852si30246931cf.662.2024.06.13.19.47.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 19:47:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214250-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=@mediatek.com header.s=dk header.b=MYL07Jtt; 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-214250-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214250-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 BC5A11C218A0 for ; Fri, 14 Jun 2024 02:47:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79D78184132; Fri, 14 Jun 2024 02:46:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="MYL07Jtt" 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 C61161836F9 for ; Fri, 14 Jun 2024 02:46:28 +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=1718333190; cv=none; b=CpwyKDed11IusauHQO3jaYfW9t1iMKOYy0GPrtjnOA89IgrkipikM1wEpNkPbRSWacYftfiLE8HeRmDpDAwXMS/97d00mL15FDIyaJDyxaNxQEItd8p4uj1+nAJz2JL2tw0GmM3mJCNNS8SZIZjlCt9V0N8rfl7/egw9IsvN4AI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718333190; c=relaxed/simple; bh=UTsBO1qXZUduXiFWMlA85vB3ALhlyPZgNWdVdj9oB0w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TWmZ9RiubumNkILmZkITgLniqOF9hgxzJG1W6Lt1JSftaBKxQ10i7orfczlF5FexqIcLRcM0qTWjtb8AUbL/0cu9x526vAD67bnDqj8pujzAPAdQ2kxDAJprEQQ27kUf3vq5G8cgxNFdi9tyjsyUV7081w8N1Kx8PnPvjLhFYec= 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=MYL07Jtt; 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: 496a007029f811efa22eafcdcd04c131-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=q1VEYsaTRBuapIDGlm2Ds9ITMgUQ0qhzoxCFj/P5Sug=; b=MYL07JttS/BA0nMDmle7dsAGkb7Mv/2w6eRX1m1iyJkzsEO8gePKkRW/XcYsv/04bRnQp2VY5yFh+jUEaq/MlYEbxwxGZpg/+rmiwlb+9sOP/5lrA1270yvSGM+0/jzSF5C2VNScjnRvrxTt2HPmott4Vh/Ly/oAvH+kNbT4A/E=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.39,REQID:1a00732c-2686-4d1e-b9f1-6490829a7bb8,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:393d96e,CLOUDID:94df9188-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,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,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: 496a007029f811efa22eafcdcd04c131-20240614 Received: from mtkmbs09n1.mediatek.inc [(172.21.101.35)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1757014030; Fri, 14 Jun 2024 10:46:23 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) 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; Fri, 14 Jun 2024 10:46:22 +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:22 +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 04/21] drm/mediatek: Add DRM_MODE_ROTATE_0 to rotation property Date: Fri, 14 Jun 2024 10:46:03 +0800 Message-ID: <20240614024620.19011-5-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-MTK: N From: Hsiao Chien Sung Always add DRM_MODE_ROTATE_0 to rotation property to meet IGT's (Intel GPU Tools) requirement. Reviewed-by: CK Hu Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Hsiao Chien Sung --- drivers/gpu/drm/mediatek/mtk_ddp_comp.h | 6 +++++- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 17 +++++------------ drivers/gpu/drm/mediatek/mtk_plane.c | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h index 792fd1b004ee..2d9cdcb7100c 100644 --- a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h +++ b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h @@ -193,7 +193,11 @@ unsigned int mtk_ddp_comp_supported_rotations(struct mtk_ddp_comp *comp) if (comp->funcs && comp->funcs->supported_rotations) return comp->funcs->supported_rotations(comp->dev); - return 0; + /* + * In order to pass IGT tests, DRM_MODE_ROTATE_0 is required when + * rotation is not supported. + */ + return DRM_MODE_ROTATE_0; } static inline unsigned int mtk_ddp_comp_layer_nr(struct mtk_ddp_comp *comp) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index 14c9b30c599b..20faac97f910 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c @@ -296,27 +296,20 @@ int mtk_ovl_layer_check(struct device *dev, unsigned int idx, struct mtk_plane_state *mtk_state) { struct drm_plane_state *state = &mtk_state->base; - unsigned int rotation = 0; - rotation = drm_rotation_simplify(state->rotation, - DRM_MODE_ROTATE_0 | - DRM_MODE_REFLECT_X | - DRM_MODE_REFLECT_Y); - rotation &= ~DRM_MODE_ROTATE_0; - - /* We can only do reflection, not rotation */ - if ((rotation & DRM_MODE_ROTATE_MASK) != 0) + /* check if any unsupported rotation is set */ + if (state->rotation & ~mtk_ovl_supported_rotations(dev)) return -EINVAL; /* * TODO: Rotating/reflecting YUV buffers is not supported at this time. * Only RGB[AX] variants are supported. + * Since DRM_MODE_ROTATE_0 means "no rotation", we should not + * reject layers with this property. */ - if (state->fb->format->is_yuv && rotation != 0) + if (state->fb->format->is_yuv && (state->rotation & ~DRM_MODE_ROTATE_0)) return -EINVAL; - state->rotation = rotation; - return 0; } diff --git a/drivers/gpu/drm/mediatek/mtk_plane.c b/drivers/gpu/drm/mediatek/mtk_plane.c index d20770162736..713e17473930 100644 --- a/drivers/gpu/drm/mediatek/mtk_plane.c +++ b/drivers/gpu/drm/mediatek/mtk_plane.c @@ -346,7 +346,7 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, return err; } - if (supported_rotations & ~DRM_MODE_ROTATE_0) { + if (supported_rotations) { err = drm_plane_create_rotation_property(plane, DRM_MODE_ROTATE_0, supported_rotations); -- 2.18.0