From patchwork Mon Sep 18 07:10:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?U2hhd24gU3VuZyAo5a6L5a2d6KyZKQ==?= X-Patchwork-Id: 141406 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2628324vqi; Mon, 18 Sep 2023 05:45:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0+/xuyB7EkLFAq2M2aQf/8F8FFaWC23AMng4OycdzrgeENe2bhPGu2STdBRsbd731eLk7 X-Received: by 2002:a17:90a:d252:b0:26d:1f3d:6e85 with SMTP id o18-20020a17090ad25200b0026d1f3d6e85mr6196853pjw.37.1695041133083; Mon, 18 Sep 2023 05:45:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695041133; cv=none; d=google.com; s=arc-20160816; b=kZc1kGs4sy9tii/9X+ifoGtDSzO51UAyKwwex5xvryTOQxojzLqf5M78zBuqDkpAri ArRHwNQcRVibjash14T8jbHJO6yLekDRW2TQY9rTvGfYqlmEyV1uGBnQ3PX+hPMxsZyK M2K6PTu1giJLsGaiD+jV3PGwjaxowA2azFNh+fa3097hmIRVel37Ztx58kWJ94Zv0z/h JjrnfhlQ5nboKtQCt7P+anAFDiBC37XO5KXAJJxp47+7//epTvDyp1cT+Yk5TNyLa58E ASnd38Gn3WJMFUFJC7ZB6qizmf+zXIesgBXFc+YZR5swROKYYjR1Guyp2LhxtHdU49F3 22jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=MI804DzGasaQoKhuNJQFOPViwmRGLb1M7P9KclzvJ38=; fh=OaQ+2leIWfF9JRok7s0gTHYuEhb3q67P+9KbgJh4cW4=; b=R6LI2BhKM8Uy0XALLaWzBr9N/+9HRQ2filF6a2hI3z3m+M/eTfCIhUQWFLHUBZuQBC CO/kRkIoancKu+n19RKUMAzxrPxMtm8U7koC2Q8NZi6QxbQAXWKAqacY97J7jet5ZTqp wPZrAH1Fogqzari51owpyv1dAk5lzRyUHTR34fGs/CgtIktMt/nQuR6+m7tfu2MuWL82 U1y2s4PakUG/F/7pNR7DP+/Xv+YEvEM8ykLOWh8UOe2s4qQwvVbZtS909j6G23TfFSzc 1v7peQAQHX4NR/Kv499iouILUX6BVSHC/2FNCsL2Mqk1CB09wjKJ6n8bTQnILqK7tbI/ P7oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=CsfmRpQF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id me5-20020a17090b17c500b00274af8f26adsi1793164pjb.1.2023.09.18.05.45.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 05:45:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=CsfmRpQF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 6C47F837340F; Mon, 18 Sep 2023 00:11:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240049AbjIRHKt (ORCPT + 27 others); Mon, 18 Sep 2023 03:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240092AbjIRHKk (ORCPT ); Mon, 18 Sep 2023 03:10:40 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E830818D for ; Mon, 18 Sep 2023 00:10:22 -0700 (PDT) X-UUID: 6a85db5655f211eea33bb35ae8d461a2-20230918 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=MI804DzGasaQoKhuNJQFOPViwmRGLb1M7P9KclzvJ38=; b=CsfmRpQFboU80emABMGFnTauOjQ89+4Fai7+2OGB/6lWBJI+3yjn3lQtwmRF7RqlsAvHpOGWFBdpXBnEeC0UM23H6/Jxn+j3/bAyY01fmJhx3+kGKzAy0nBuSSdyw0OkTiGTSjnysnFbNgVyBCMcEYI1XoKQkGfvJs6Vzwv4dXE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.31,REQID:f7ee2d2a-1cad-4517-9986-827a6589c3e5,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:0ad78a4,CLOUDID:fc3326c3-1e57-4345-9d31-31ad9818b39f,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File: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: 6a85db5655f211eea33bb35ae8d461a2-20230918 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 1993278181; Mon, 18 Sep 2023 15:10:15 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Mon, 18 Sep 2023 15:10:14 +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; Mon, 18 Sep 2023 15:10:14 +0800 From: Hsiao Chien Sung To: AngeloGioacchino Del Regno , CK Hu CC: David Airlie , Daniel Vetter , Matthias Brugger , Philipp Zabel , Sean Paul , , , , , Hsiao Chien Sung Subject: [PATCH 1/1] drm/mediatek: Fix errors when reporting rotation capability Date: Mon, 18 Sep 2023 15:10:11 +0800 Message-ID: <20230918071011.18481-2-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230918071011.18481-1-shawn.sung@mediatek.com> References: <20230918071011.18481-1-shawn.sung@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 18 Sep 2023 00:11:31 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777379450699081181 X-GMAIL-MSGID: 1777379450699081181 For CRTCs that doesn't support rotation should still return DRM_MODE_ROTATE_0. Since both OVL and OVL adaptor on MTK chip doesn't support rotation, return the capability of the hardware accordingly. Fixes: df4444577118 ("drm/mediatek: Support 180 degree rotation") Fixes: 84d805753983 ("drm/mediatek: Support reflect-y plane rotation") Signed-off-by: Hsiao Chien Sung Reviewed-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 1 + drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 8 +------- drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 5 +++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) -- 2.18.0 diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h b/drivers/gpu/drm/mediatek/mtk_disp_drv.h index 2254038519e1..f4c7dba8f73d 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h @@ -120,6 +120,7 @@ void mtk_ovl_adaptor_register_vblank_cb(struct device *dev, void (*vblank_cb)(vo void mtk_ovl_adaptor_unregister_vblank_cb(struct device *dev); void mtk_ovl_adaptor_enable_vblank(struct device *dev); void mtk_ovl_adaptor_disable_vblank(struct device *dev); +unsigned int mtk_ovl_adaptor_supported_rotations(struct device *dev); void mtk_ovl_adaptor_start(struct device *dev); void mtk_ovl_adaptor_stop(struct device *dev); unsigned int mtk_ovl_adaptor_layer_nr(struct device *dev); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index 2bffe4245466..5fd1f6ae41f3 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c @@ -288,8 +288,7 @@ unsigned int mtk_ovl_layer_nr(struct device *dev) unsigned int mtk_ovl_supported_rotations(struct device *dev) { - return DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180 | - DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y; + return DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y; } int mtk_ovl_layer_check(struct device *dev, unsigned int idx, @@ -302,11 +301,6 @@ int mtk_ovl_layer_check(struct device *dev, unsigned int idx, 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) - return -EINVAL; /* * TODO: Rotating/reflecting YUV buffers is not supported at this time. diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c index 6bf6367853fb..922db8df572d 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c @@ -277,6 +277,11 @@ void mtk_ovl_adaptor_register_vblank_cb(struct device *dev, void (*vblank_cb)(vo vblank_cb, vblank_cb_data); } +unsigned int mtk_ovl_adaptor_supported_rotations(struct device *dev) +{ + return DRM_MODE_ROTATE_0; +} + void mtk_ovl_adaptor_unregister_vblank_cb(struct device *dev) { struct mtk_disp_ovl_adaptor *ovl_adaptor = dev_get_drvdata(dev); diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c index 771f4e173353..f7f972f0d46d 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c @@ -412,6 +412,7 @@ static const struct mtk_ddp_comp_funcs ddp_ovl_adaptor = { .remove = mtk_ovl_adaptor_remove_comp, .get_formats = mtk_ovl_adaptor_get_formats, .get_num_formats = mtk_ovl_adaptor_get_num_formats, + .supported_rotations = mtk_ovl_adaptor_supported_rotations, }; static const char * const mtk_ddp_comp_stem[MTK_DDP_COMP_TYPE_MAX] = { diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c index db2f70ae060d..371de196d400 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c @@ -315,7 +315,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);