From patchwork Thu Nov 5 14:01:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Palcu X-Patchwork-Id: 11884485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A1E3C4741F for ; Thu, 5 Nov 2020 14:03:47 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90AEB2074B for ; Thu, 5 Nov 2020 14:03:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="onJEytaw"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="X0MVHzAj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90AEB2074B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=o5Y49/WAzuftcE6QjKfbAtrRZiOZ3ghj8zsRbXCojWA=; b=onJEytawrGrS7hzCusnwjSvGu hDhiHrWOEVRw6+NltS5cwuDDHkslKKOGTvx082SM5DP6NAow03RfFLO7iA0eEeUOgvPdFj3cvKhjB 3IgeMTLoFiSByTFvWQzw1bwjM0j8zVDikWNgHA6g/HvZhj4WJC9BRekFmWByn6OjgoFSfw5fpLVae 9RImCTJueVRcte3Ky1ta9NfeFw00HZhKH8X46o00AncFQqOesWk/cTrgMyUkhL6r3tagiqJH3zEaA 9Fj98PjwSClx1pEvsw/8MSJRFsgaiVOnHhHdpy10kLU+jBXkGRdQWoAVSF3iDNquufyzVqLtjnwSK FBAsXOCaA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kafqC-0005dK-H9; Thu, 05 Nov 2020 14:02:16 +0000 Received: from mail-eopbgr50040.outbound.protection.outlook.com ([40.107.5.40] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kafq9-0005cC-Eh for linux-arm-kernel@lists.infradead.org; Thu, 05 Nov 2020 14:02:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O28JFvt651g1oT/nqb1TcnMv1wd/UqvyqRMqmQOVLTficCncSTI3l12e+Er0yT4on2V8J+aSrOw5091NBswXUwl9sxxsjnEOv7cLy/BafLDdVuVrJppgi/1a0xOInaU1f0wnYD5/GD6AVYF89qxDJ8efoyv3BZ+YNVv3v6SUjvGLjqfpTnIjJK6fpgPB8RSC7aK3woTa7lu0H0d0hYez+dpmsu5CAM2bwMA4txPuq2Vghj8+a9soB+V5ltZyVTdW1eZn0LckU1yWHnVZs4tc/z6oim8Pv09HVMfmj2fKSVH5+CMzIEdiDVznxXarb7XgGHhfuFIP4wWOe6IefcaH8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R9vob6+exkqWS69bcbRacyP8nAzMKeqPd6B8Ph05QXc=; b=On5TQZ4iJxxLWg9p4/1lsK7gyKlyejrQzqDkBdiKexmcTvto2ecQU560ffo4TOHLucBEj5OixqvJSWdStaOFoqPq0H2IRsgE0AQEM35SsTzQ/gu19iWca4hNlyjwgPUNSIO8+pneJ6mMbBFVnmVzgkJHVZD1x/0GUVYPNGqcW0hzfpf2pcKZPLUZ1LbnTxfCKZYBCufCi+sySfe/bN/CbW+RVh0x/YsBdV0fcRqHgzBXNk0WOVVggjhq0IfZ2apsB7fNIb4D2PlV5c8ZXhD9yfGZgkJItdHBx1N/+KwCXho0htPyUhh2sImwTU51O5vl6EmQ+awC4IQUijC5X8VgTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R9vob6+exkqWS69bcbRacyP8nAzMKeqPd6B8Ph05QXc=; b=X0MVHzAjU4o28HYRqw4CjuC0la+miAv/UU8Nnli9ZwDWE8sWOoZYKYz5pIlBlZqgpZRPAvmdv79Xfp4AXMaZk7lfUZ7SZ0GmleDvZrh06tz+hkbKED0fucksc7sSaTyj/YwPHZX4GYys/y+jmB+ZtjugAvHZa1J8pY3enufG8F8= Authentication-Results: pengutronix.de; dkim=none (message not signed) header.d=none; pengutronix.de; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR0402MB3902.eurprd04.prod.outlook.com (2603:10a6:803:22::27) by VI1PR04MB6783.eurprd04.prod.outlook.com (2603:10a6:803:130::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.21; Thu, 5 Nov 2020 14:02:11 +0000 Received: from VI1PR0402MB3902.eurprd04.prod.outlook.com ([fe80::f000:d709:509:bb5]) by VI1PR0402MB3902.eurprd04.prod.outlook.com ([fe80::f000:d709:509:bb5%3]) with mapi id 15.20.3499.032; Thu, 5 Nov 2020 14:02:11 +0000 From: Laurentiu Palcu To: Lucas Stach , Philipp Zabel , David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , =?utf-8?q?Guido_G=C3=BCnther?= Subject: [PATCH 1/2] drm/imx/dcss: fix rotations for Vivante tiled formats Date: Thu, 5 Nov 2020 16:01:25 +0200 Message-Id: <20201105140127.25249-2-laurentiu.palcu@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201105140127.25249-1-laurentiu.palcu@oss.nxp.com> References: <20201105140127.25249-1-laurentiu.palcu@oss.nxp.com> X-Originating-IP: [83.217.231.2] X-ClientProxiedBy: AM3PR07CA0084.eurprd07.prod.outlook.com (2603:10a6:207:6::18) To VI1PR0402MB3902.eurprd04.prod.outlook.com (2603:10a6:803:22::27) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1864-141.ea.freescale.net (83.217.231.2) by AM3PR07CA0084.eurprd07.prod.outlook.com (2603:10a6:207:6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.15 via Frontend Transport; Thu, 5 Nov 2020 14:02:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d13d25e6-b136-4413-3ea8-08d8819363df X-MS-TrafficTypeDiagnostic: VI1PR04MB6783: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OlrqEQR7nsPctIbtLukdMjz1rlHOH0lGFpoWZs2hONyvB2i9VjE6BaGzUTQPf4DvwelAl1R0BbKPA0N74boLfuByx1IJdcoAqqjDDzErub/HBGWwgEjkwp1rxko8d42DHTbgcEsAQSafWNiCMH/1Zues0wfAJxKJ7VglkLjBDpB9NxcwfYMlNQkeTHIZ2BxIIQJY5IR9Xx7vMo2uycF1FV5FQxREWFj1pcPv4bHyQ4UiPuwetl76KH2VK5Onj7cQufUXkCRGKaQP2gfacElHieXpYQGE4dubST8JmDRhq6vL9larZphfxq5sDNbm2GVtrdSyMyy7DOYYzd7qBujPNoWBzLe4YPE6McHsgGbE/xs= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR0402MB3902.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(396003)(39860400002)(376002)(136003)(346002)(8676002)(2616005)(956004)(6512007)(44832011)(83380400001)(6666004)(8936002)(66946007)(2906002)(6486002)(66476007)(66556008)(7416002)(316002)(4326008)(52116002)(86362001)(478600001)(5660300002)(1076003)(6506007)(186003)(26005)(16526019)(110136005)(921003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: yOgm+zg2p6koS7k/ttomf9tyMGiNNAXnrZt6FgwCzilifNVu7ptKn8hvt0jOFL9IGRs6dnZeH0xRLJAvowTA43o0cFruIqa/WchF2TiNAKx8Uovf5dlQMgwAKpUKutgEuFH/6msO1okmER/pV1AYD1JL7zHGvqHnLENiGiX7xfQ1pwMvoWA1GpPONVsE2Z/RczAiOi8i6yiqdRR7ED9KjKNKqcdt2sqE1mtt6uZ12e/HT9oaTaDOK8QoFqSTb5fP6UAr1rJxXbjr4wOsKgZI9tCscyPnQbr95uuuQm00BKtPNzsBIAorxsSKrHC40aXfm7vyrWhj+C4q9csg4SRjXxrwN9D7CI7pciCYDsjT495EAJrmo9pTeMWvMM81yIc+NeI1fApfFsKPYaX77RZ8MT4UW99FCwCgWRje8ULWsdX8ggl3E+K7iauYJdLAcQNTrdS1CwN93GS2FdN3Fhexi5eL7LKxKmKhIagUKtkjUtt45WasjE2MWaEWLi+RjZM6B6og9bseX3GhH5P0097JQnp2hQ7xOhGq1n4W31Nj1tAnB907+zj/hty4ipqGhv6hJ5nP2kcRLWL8Kne6zoMM/By6WH2zR5f2b/vUI2GydcG+RKZESYdH2frtiktWVGtNcGN+XyyagNLt95B/r11WWQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d13d25e6-b136-4413-3ea8-08d8819363df X-MS-Exchange-CrossTenant-AuthSource: VI1PR0402MB3902.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2020 14:02:11.0367 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 26aq0Yg/L3Ggmig1mplWKUwjQXbwDHjLV5ms+vTUD7ZUv6zxuOXCxmRkGUQ3AM+rzIm3TDEQOQIsG71y0xmBMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6783 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201105_090213_560908_71E045D6 X-CRM114-Status: GOOD ( 15.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurentiu Palcu , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DCSS supports 90/180/270 degree rotations for Vivante tiled and super-tiled formats. Unfortunately, with the current code, they didn't work properly. This simple patch makes the rotations work by fixing the way the scaler is set up for 90/270 degree rotations. In this particular case, the source width and height need to be swapped since DPR is sending the buffer to scaler already rotated. Also, make sure to allow full rotations for DRM_FORMAT_MOD_VIVANTE_SUPER_TILED. Fixes: 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ") Signed-off-by: Laurentiu Palcu --- drivers/gpu/drm/imx/dcss/dcss-plane.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/imx/dcss/dcss-plane.c b/drivers/gpu/drm/imx/dcss/dcss-plane.c index e13652e3a115..46a188dd02ad 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-plane.c +++ b/drivers/gpu/drm/imx/dcss/dcss-plane.c @@ -111,7 +111,8 @@ static bool dcss_plane_can_rotate(const struct drm_format_info *format, supported_rotation = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_MASK; else if (!format->is_yuv && - modifier == DRM_FORMAT_MOD_VIVANTE_TILED) + (modifier == DRM_FORMAT_MOD_VIVANTE_TILED || + modifier == DRM_FORMAT_MOD_VIVANTE_SUPER_TILED)) supported_rotation = DRM_MODE_ROTATE_MASK | DRM_MODE_REFLECT_MASK; else if (format->is_yuv && linear_format && @@ -272,6 +273,7 @@ static void dcss_plane_atomic_update(struct drm_plane *plane, u32 src_w, src_h, dst_w, dst_h; struct drm_rect src, dst; bool enable = true; + bool is_rotation_90_or_270; if (!fb || !state->crtc || !state->visible) return; @@ -309,8 +311,13 @@ static void dcss_plane_atomic_update(struct drm_plane *plane, dcss_plane_atomic_set_base(dcss_plane); + is_rotation_90_or_270 = state->rotation & (DRM_MODE_ROTATE_90 | + DRM_MODE_ROTATE_270); + dcss_scaler_setup(dcss->scaler, dcss_plane->ch_num, - state->fb->format, src_w, src_h, + state->fb->format, + is_rotation_90_or_270 ? src_h : src_w, + is_rotation_90_or_270 ? src_w : src_h, dst_w, dst_h, drm_mode_vrefresh(&crtc_state->mode));