Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp250245lqt; Thu, 6 Jun 2024 02:27:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUJKzcrEWPR0hRCI00hBU9t/Ph3DnPTN4ydsjPEaQa/oR5n5wT3GfAsqu/uylJzGlbkqB6kb4qcQvcA0L5HN4tFnFUG5j3OjIyc6DdePw== X-Google-Smtp-Source: AGHT+IF+JYWuACqAszBLywcz44T9W+RMvM+V0GbyHyOS//X3AkWFJYXsjSqqComDTMpk1z3jZqJS X-Received: by 2002:a17:902:c40d:b0:1f3:dfe:3373 with SMTP id d9443c01a7336-1f6a59ffa62mr64812195ad.7.1717666043957; Thu, 06 Jun 2024 02:27:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717666043; cv=pass; d=google.com; s=arc-20160816; b=b5+598lX6Qu/7MqJTpHm3WA3XwGL63iyNO+W4jDKgxvrfyhl9t7TKhMlLEEqJ3mSY5 DV6d4EdnKfO2nzz4wzZki9LOKnq7pztu2IQUXuskQuXg+q7TBZe2pg1uI+XOht+JYfC7 v27dW4viqiYwGSU9QuI2K8TXWCHy+wbov44Gak3WOxolLkHPxyGqH2R9co15msX6aEjL CbVOCpgXMlhqVunY7XfoXvSgbrOUWoiS742a5pDBlRpmh8oqhGOFE8Fw28bMy7JCr+0Y 1CTML1B1wLsdcqaHy5Zy1uXD1RdT52IHSwZoYFI099UXl5i8WsnsUgAo2MbAC/1Nto8z m9sQ== 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=tN2fthEvbDALIOfu9f+hoAOF8rB39TbT5fxu0nBzcF0=; fh=q/Ppq8/frEfcA3kotGB0IrpJr8gO0uNs3CtN4uoBAAY=; b=ogjt7We2rsYS7kPcmsTWXFcYss2PhY6D+korEEL0/IyUAyYmXStywsQ9HIpdQpynb0 O+AC2xRRpyjpisM6ucK2pRSfDUG4GkDrKruDBHnO8O0+6rFGuN5ZjKVKvOEUpHkIYgf1 lJY/7UuiStT6uRj44Da7sovSwAl7e3rV4N6kuu1IAmdTfVDSpna3tF+PtdUxT9Lu3zXt kXLeBWwIUgMD+h4QxQqAgPF38P08TiqrmbEHmCHVjGVwXEmyGTVHQMIVsQQCc+cmvCeH eDP28dqbsD+c8/T7Drb8YLjdPRyWRRmGzhKt7g5hUdrTjPH/ko1gkPNf6XtPUaJJbYB7 Ew5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=RaglGVt6; 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-203992-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203992-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 d9443c01a7336-1f6bd75f79fsi7842385ad.116.2024.06.06.02.27.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 02:27:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203992-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=RaglGVt6; 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-203992-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203992-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 4CF43284109 for ; Thu, 6 Jun 2024 09:27:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB57C15250B; Thu, 6 Jun 2024 09:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="RaglGVt6" 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 4850113E05A for ; Thu, 6 Jun 2024 09:26:44 +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=1717666006; cv=none; b=b+zWZnoocYuTE1EpP10/RhYDMZLTapcorpkVSIE7MC+LuayjJuWPrLhCAkQPiw508hdFDDFsqWO8lKna4qYmFEfZjYKdJU1hT1IuKhz87yI2si0zDK4pXbtZMbOTMwTz58cX9wiwr9b5ReO8U9YljSej15Q2RIwf6ZUlhajUyYs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717666006; c=relaxed/simple; bh=ubJoFLOaudmDepAwCD6kheFg4erFXVqoWAyNnxjVTQ4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=E5b9qst0XpMYTGwbGRty9EyEUKbEkkzdHDeVHPacQKt8rUAB/7eEqiGz+iyffOtac0jl181taAKjAg8ecpcjn3rLVPoLZLy9wFJMGB3EjdU+tPzf8ogeGVPDPbluJEAY6cqcHbID1x0ABE+FbctbDUzf9ZpVfB/BEYYvslctcis= 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=RaglGVt6; 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: e0254cbc23e611efa54bbfbb386b949c-20240606 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=tN2fthEvbDALIOfu9f+hoAOF8rB39TbT5fxu0nBzcF0=; b=RaglGVt6YwvkqOwJMIvpN1FMlnJJRhLDVfPwMKRe6skv/soSzsUmj+gbE8WNxhcCDyZ1mywusrqEOedG2FQxvijvnN1+ihr2vwAjsvJqftvT+nC8vmEZ96DqvDLHw4BCnGEY6oFF5F9R4+3+twgQLuImboTnfk3+lq/vCTwCeWc=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.39,REQID:8be7cec4-ed09-4b60-98ac-a1696584c7d6,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:353b4744-4544-4d06-b2b2-d7e12813c598,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: e0254cbc23e611efa54bbfbb386b949c-20240606 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 164953707; Thu, 06 Jun 2024 17:26:38 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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, 6 Jun 2024 17:26:36 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 6 Jun 2024 17:26:36 +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 v8 04/16] drm/mediatek: Add DRM_MODE_ROTATE_0 to rotation property Date: Thu, 6 Jun 2024 17:26:23 +0800 Message-ID: <20240606092635.27981-5-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240606092635.27981-1-shawn.sung@mediatek.com> References: <20240606092635.27981-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 26236691ce4c..f7fe2e08dc8e 100644 --- a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h +++ b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h @@ -192,7 +192,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 b552a02d7eae..862ab683ed1b 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 a74b26d35985..1723d4333f37 100644 --- a/drivers/gpu/drm/mediatek/mtk_plane.c +++ b/drivers/gpu/drm/mediatek/mtk_plane.c @@ -338,7 +338,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