From patchwork Fri Oct 12 16:35:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10638853 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7385157A for ; Fri, 12 Oct 2018 16:36:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5C712BEEE for ; Fri, 12 Oct 2018 16:36:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98E9A2BF8D; Fri, 12 Oct 2018 16:36:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 376582BEEE for ; Fri, 12 Oct 2018 16:36:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CD44A6E4C4; Fri, 12 Oct 2018 16:36:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80071.outbound.protection.outlook.com [40.107.8.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2B4D16E4C4 for ; Fri, 12 Oct 2018 16:36:25 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Fri, 12 Oct 2018 16:36:22 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, ayan.halder@arm.com, daniel.vetter@ffwll.ch, raymond.smith@arm.com, david.garbett@arm.com, lisa.wu@arm.com, matt.szczesiak@arm.com, charles.xu@arm.com, james.qian.wang@arm.com Subject: [PATCH v4 1/9] drm: fourcc: Convert drm_format_info kerneldoc to in-line member documentation Date: Fri, 12 Oct 2018 17:35:52 +0100 Message-Id: <20181012163600.20331-2-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> References: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: CWLP265CA0200.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::20) To AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 773b4742-aa2a-4d84-dcfa-08d63060d8a2 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2545; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 3:2oKQMGAj1OtwmUiL1enMbDp2/EYz15C7H2dDJbJh7EJUs0+NRQE6tsXLXU6nBAxxlk2kxlpPrrz7VFa7C5VIj6itz0/rNuWAYyU2xXpDUKYXwACs46QHQZvESrKWrZCgrl1r2lXFBAkPagE+iPrrnedGAEZ+JV4BvF9C6ZeLEuh5rcXWOwn8Fo1cZxRhD5AQbd5bDERbIfMXMYn0HFJACQMgC+T/i6M4+KV6GqpZV7459ufO757JeAwro8DGJN8q; 25:awcGCN+5x5CSaEphWxHb9uMuyqzPPWli8ypP5tw5YCQSgqz20agbB/WmfxXaxQskacjPOKsfI6yYquYlSW6WZlz2v/WDcyaxWHCDglcmF25C+Zahvc5QCKv47MXfhU4vstNbyNNywdZp2lfk/Rr7ejEKwmF5YEia6SO1/4iQVdXkiHu2EkRFQ02/by+C0FWj+8+Mgip1ND2tdjddoiICa+OewDH5cqLau4PytNfdbOzLYmJLFm3YWkm63plGmIZhL8tzcZCqpAWtI59OiIZ56O5njLygks1IIUKHhX2+lafsHaV39Ln7iP7eRT1X58J6bjsgUi6P4W1FcEqH/DjU3w==; 31:OHCzJ4wXg07u1n13gZ9sn+yKMp8fUGwoCeMxD97gpZ4a5RahOgT31PRnDhzLmVCEA8kr3wAdIflSgtiXidATK+GM4UbUUgl+YLAaf9+ii50t9Bt3t55mCcS4STedRiW/18nxqVc9xDxuUyIhtKU+ohlbYINLi4AVsFz0huZ4saA3jrRZMNNbxL+sDR38Z55xAInLmaFWE43B6q6ak8iMlDmFRm61wg9LoKVKwrhHT0Y= X-MS-TrafficTypeDiagnostic: AM5PR0802MB2545: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 20:GH0Pe1K39XK5uR7wHTAt4gj0c22lmYcSjAHHuTjaH0CBktMP1lqfH29o+f1DaV6PsP6+Dn/EKnFuETUK8S8OqaDPtceag4tVOU9Hw0ZPkN2/D7C38YdL4PUUFcP5tYHf2TwlitywoujB2CPG1IDlwwAi56oJxiy7xXajaWU/YqKeLNLG0oKOtVxVtz5ldRdq46Kg1Cnlz0jSAuPtdEWO9grvYCX3H8UrwY+BA8Ln2pt8/jAyaxsWK6/qRh/k/gy+U/FuIeMu2CxBib14/C1QqUu7jRExQyeKvMwft6YopAj/vGegV/XeNl3m9fjZD/GgJyaPXX89KPbrZj5854H7S2AKUwlZpPdYRrIS2jEBPGZe/eU7vFHtY6T2OFx3MfBELZ7h8Dl9HGoijQQqTSYE7D2b8OuxkXPuDsrcvJufZ0o=; 4:2P2XhGRovQJKAGWToahj/FMJ22H91VbP5yjj+RrHstIMrzoPXNF0MMtjtxYGDdkh53Ce3gTc0auA7/YKnpHRmSIugtFC79jZFVJfAuMUjBCX7hZ5Dnxt+xlFF8Py/G6DxVkB5VHEPaqutRYreYeHvHui/dS/1fy3wL/c+YxnspdGB77XkapJu2lFSlquwvUOiYPOHfoKt6szr9hT9qGUzOD5WFVYG/cZcfIStNWopmFRhApiLNCYUm0TjG9aayOSGfPZh9QAQeMe/DlbWsixRGHwPQuJZ6/oW8paDzmAf1J3+4Z25BsBmZOh9CBR8A5a+mwdqiN+D5zrPFVfRIzTTgQrEV6FWnYwme9IBSVcXWc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(217544274631240)(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:AM5PR0802MB2545; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2545; X-Forefront-PRVS: 0823A5777B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(366004)(199004)(189003)(6306002)(25786009)(4326008)(81156014)(72206003)(966005)(106356001)(105586002)(81166006)(478600001)(5660300001)(47776003)(97736004)(26005)(8936002)(50226002)(66066001)(476003)(16526019)(6486002)(186003)(2906002)(8676002)(316002)(16586007)(7696005)(50466002)(956004)(2616005)(486006)(6666004)(7736002)(305945005)(52116002)(48376002)(68736007)(76176011)(51416003)(86362001)(36756003)(53936002)(386003)(446003)(1076002)(3846002)(6116002)(11346002)(6636002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2545; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2545; 23:C5wk/LUMkcY0+QqRVi37li4jgINvGEZjoycY5Ln?= 3COFVt1vmY5xW+z7JDTRogFaKTDineNt3WVJz5MLBTvehXOTAei0SuzlC7hqLTMYVAT7V2jDdlK496CW3MBK7e7y/DRufZCvutJJ0bcFmvBAN4eIWaKXDnqCzBA2l8u7V/3YuqTVr0Upw4Bxt2N6E4RbSCkeNExmfcSzBcff+tmSFKkdKkJMVMiM2csS1QPFQJicdeYLgfWbMlK4gkzPQRK5stvNQN+pXhWJ467RaCm3fHHFuaLzA48iB6J5ZFWi0RDdwMBHkTET2uMEiT6HIn+22myNvJYaJ7wA8j0PkqWvYilGoLo8XAC3HbhQ+DIUT0c+51D2KyXQNfBpDWQu56LuhdxWcOa9fi7BNIOEx2IAClY2o3bvszh9UhQ8elvBQlV/i1BHUYCdzGzFHedfOmdFWDLsg5rNZE7VeJl3DmYLD7scpxB/fDGmPH10BBU2LmcnvT32e08ejDZDOCxqUmmZsRztDUG7zp2qicvdehezfvKj3GV2iNYxZV1hE7HWJvv3j7vnrpPBw4twehLtutzFxqERkyB/uVzz2ljZLWotPqD4BULBx6wDVwwZG7KLDIHYEIkopuDQqGOKmEyy66GpdqGNFYFOH0MFTfUQl31iw5LQHqZBCfxhT6XP2qpYx08qGWInZHQEHGYf0wx4pYNUQwr5spAR6iLAqN4XDiq0bArYpI59ex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++npuuUfnwVBnB5I15EBJLgevnXhNeurz0sUPbCZLY+66CC1GwPOx0KZ5RcZxJNUgSZBZ/e+FgcIlHPlxNNpDEactoPU9eeoedCpnvsp9hhcnyih96niSm9mas2drATlzqrF/GqdMqqJDBCvQHRPvt51rYbqApK4UsgXdthO2Ds8Fk8VBS1UVIEATTf/Mtoa17GRwccEWsCh46mj6uiIyL7ywShr+K0yj+ewvUUbH7EdDY3EoACKbvZUM/dNT3a/Ifl8sZwxmSH8C8I8dYPyKHdCChIhuHlTPMq4l7Yg4qWmkkNnzFSnI+7zde2LB+Bo7pbYEqDzCgI3X6HZd98CJ84A==; 5:M0JWdVtDMfjnbHDHf2qcn51OKtKC1GdaddbdGExIblzelHEMv08gaYI46XY0iBQp6vNAwB1i85jyGM6Z35imf06Jun6JsH3XkEJniNi1y63d6ZA4fj8z7Ku5dpH+q6hxEtVuZ7kw+ktA7IEyip906Z36cSc+Gv+6IegfAYnCCDQ=; 7:kZQstR+ac/ELHA+1xq7YTH1aXK7aZVdx4fVUUzlZ9aMFKYKa+HANDHuadd6H1fHe5Esxsafgm1ZOCJG6AQAA4LSRKLVIGqD2LkYskHpf6VJ76JwOzNRsyUqMIujwWQ2ZaarBvEf8LxQPBxOiUDEUVKhQVjsiuxXlIUVhta+6FCzLO3wRA+yd3D02pARZ4VJeE1x7EngVsBj4wSzG/wtJ6w0ABqNHRtCJtR7L9d5YZYez1CL0asRtAvEfx6pkvoMI SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2018 16:36:22.5626 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 773b4742-aa2a-4d84-dcfa-08d63060d8a2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2545 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In-line member documentation seems to be desired way of documenting structure members. This change had been suggested by Daniel Vetter here: https://lists.freedesktop.org/archives/dri-devel/2018-October/192176.html Signed-off-by: Alexandru Gheorghe --- include/drm/drm_fourcc.h | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index 865ef60c17af..345f11227e9e 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h @@ -52,25 +52,35 @@ struct drm_mode_fb_cmd2; /** * struct drm_format_info - information about a DRM format - * @format: 4CC format identifier (DRM_FORMAT_*) - * @depth: Color depth (number of bits per pixel excluding padding bits), - * valid for a subset of RGB formats only. This is a legacy field, do not - * use in new code and set to 0 for new formats. - * @num_planes: Number of color planes (1 to 3) - * @cpp: Number of bytes per pixel (per plane) - * @hsub: Horizontal chroma subsampling factor - * @vsub: Vertical chroma subsampling factor - * @has_alpha: Does the format embeds an alpha component? - * @is_yuv: Is it a YUV format? */ struct drm_format_info { + /** @format: 4CC format identifier (DRM_FORMAT_*) */ u32 format; + + /** + * @depth: + * + * Color depth (number of bits per pixel excluding padding bits), + * valid for a subset of RGB formats only. This is a legacy field, do + * not use in new code and set to 0 for new formats. + */ u8 depth; + + /** @num_planes: Number of color planes (1 to 3) */ u8 num_planes; + + /** @cpp: Number of bytes per pixel (per plane) */ u8 cpp[3]; + + /** @hsub: Horizontal chroma subsampling factor */ u8 hsub; + /** @vsub: Vertical chroma subsampling factor */ u8 vsub; + + /** @has_alpha: Does the format embeds an alpha component? */ bool has_alpha; + + /** @is_yuv: Is it a YUV format? */ bool is_yuv; }; From patchwork Fri Oct 12 16:35:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10638855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB887933 for ; Fri, 12 Oct 2018 16:36:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D67F32BEEE for ; Fri, 12 Oct 2018 16:36:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C78272BF8D; Fri, 12 Oct 2018 16:36:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0EEB12BEEE for ; Fri, 12 Oct 2018 16:36:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A7FB6E4C6; Fri, 12 Oct 2018 16:36:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80071.outbound.protection.outlook.com [40.107.8.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id E4A366E4C4 for ; Fri, 12 Oct 2018 16:36:25 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Fri, 12 Oct 2018 16:36:24 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, ayan.halder@arm.com, daniel.vetter@ffwll.ch, raymond.smith@arm.com, david.garbett@arm.com, lisa.wu@arm.com, matt.szczesiak@arm.com, charles.xu@arm.com, james.qian.wang@arm.com Subject: [PATCH v4 2/9] drm/fourcc: Add char_per_block, block_w and block_h in drm_format_info Date: Fri, 12 Oct 2018 17:35:53 +0100 Message-Id: <20181012163600.20331-3-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> References: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: CWLP265CA0200.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::20) To AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b4a8540-fb88-4519-4640-08d63060d9c2 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2545; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 3:uRgXMThbFkgQ3Dta98v1MJVDlifmva5PaWGU89zNwpJZ4K88Ee84zzV+onMqa+q/ANNnjj/Bqx7SoPzj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0e5PdesWEoKL8bR3iWX5KvSCtKY1M5g4ceuG+AjrF6c0vo/ueWjLkwiivJlgJ+3YuPLDaKoqZ4OUHibHXtLXeXVdLagdbIj6UbFtynYdBgi82Ec2AY3T77FBb39x8cmsMFsGxen7qmIMdFNuPUQ1dq3vl/aJ39AQIjqHtMuCICAhAeWLcWT/13AnY0a7viAPcd8BHyj3pETmjmoPMY=; 4:eSCLxt9Og6BsIU6hhLpO7jq98JC9ysxMb8WyrVs8QTEXS5utoz2XVxMzLRR7Rr7YMUrccagqB+eMTNo79DkuDx5kzcQbIkEhZTUI1xaukPxrKvr6+kXpF5BNU2n7rg9s4Gty+KYMgdrw0FKOGq5pnYPA+3Qyb73LydcED8YWFf89sQum4fmv63dOJhJDQVismn86bK5FKR9WWJtSiVafgLYAXL0F4bSL/9M6DmR9q4ddc2ajylmI/JPAzonr6uJgnECmNm7OhY8lkoTiVlT5SgbWr84G/aoHzZNVQ7ON7+aebrrzBfBNTmUzh+AH+/fQ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:AM5PR0802MB2545; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2545; X-Forefront-PRVS: 0823A5777B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(366004)(199004)(189003)(25786009)(4326008)(81156014)(72206003)(106356001)(105586002)(81166006)(478600001)(5660300001)(47776003)(97736004)(26005)(8936002)(50226002)(66066001)(476003)(16526019)(6486002)(186003)(2906002)(8676002)(316002)(16586007)(7696005)(50466002)(956004)(2616005)(575784001)(486006)(6666004)(7736002)(305945005)(52116002)(48376002)(4744004)(68736007)(76176011)(51416003)(86362001)(36756003)(53936002)(386003)(446003)(1076002)(3846002)(6116002)(11346002)(6636002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2545; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2545; 23:uk9WH1RuR33fVrfZa56sO7ja1JtINkBzNDwaCLs?= 3mQ5+cdH5PvweJoA074SF701HjwxOT6q4Op2mEnI7ZiiQ3mzF1AcKCS0w6BVX1lbMhCWKXI7ukOyiD+rGe1XGVCCV7PuW+QepMgFpAWMHZJfGZtnXsmbuUA8fKnw2haK5kldSL6c2AXh+8KfT7CFHFuSmGw1XsQ3+/V1dafCZEgKo2aYwAsWtmGEhOqfNcz8jh/1LhLXn2lZJA81kDsNC4yXXjKCM+ESJxkI/EbEyDDNeuvQazIMk+/q3yCYzZVuOSMihaEjxWiXugmrkJaECXfCP/qAfeGwEgRo2NcF5/ZmP9lkZWaDfJd1X2QHZbGio/XHvq7i5Ha8qMRhkZKn+ahY85UMqt2z2iIKqkursmq+kIJwKwe1En2J/cUHw2iX6RA0Rd4uxwGuV6DWmlFp0VfUkpwptopFP9BkmFXTSiKmYmxxXDxXvdnmRUbgtZnpevCPRvbn7pOlmyKe1uVD4Qy8EecJnx1p9WCgk+YpXk3M0qA2EqxTXX+FdxhjSvAa2HATvPvCBQy50hQej0B0AtjJsxOXH0nwW4Ui4kJuepoK7/RNaljZzULr5/rwv9v978gCSQuQeYFsveya+wLrWpmzraLDIkcp0VUmb9f5TDcqV21QDKb4a+q5nSsPJvkM1N/6PmE2dowZZD0jcLN1A0OTI3eRjYa6VyoaFvMWq1vLnebS35biJWoOmCgYAXsVMsY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lniNysI0TX/KptJ1j6Hyky6n+nq07MLgaRYi60NvfFnsVKceVqKhnC2OrjM696O8UO4qPbjqLQLhc1UQ7MwrBvYE2CUrCGnbm7QOdAFQ5Stnm8PHJT1bPOBzPn/uVaMhCmMVf4VXiryKovcN3alf1c2I+rcW395t/mjkhMOs2GNasjvWb3ila6dMRI1N70e+XLD3K/JqAdMmNjyc7P8E43oHW4MgtrG/RTNj9hviM5hKSh9B5+WrBjMC3R8zSED/dOmp4DucvqzsUc905uBQCfWH6/t7XAadtC4/X37AC7GTMTMs1wRyfJ6ye3lwAnbRXfPn67pmBI8QqI4YHQ==; 5:KPWD5YDQr+SG5WWW6l9bMWD89X2l6mqLnSHHeDHlZVcDe1UeLxrSdp7D57TUCn+dEWQSetlxEkb0CDq32Y7877wTQc7CwSCMv7sprfIfPxluqGVBGFFY5TOLCafSgO5yuCcJiMQCTHQIExWHau+gIHr+5T+wKBunpfvNdBnOFqE=; 7:tYkmQRauH9dZcbC3STFUbttYo2nA+OWYKO9NjKlPMrV3fWSKxKhPnDPtSih0oybt8/ZoFZgZVCrx8CNjBZ2vVamauMg/d/3nC5ayHe+vsg6M42/AIp4mIgvL8wnxnd/pEB9p77ipByCyFp2fXX7o38a5Ad6rpZp9ZPFeGHxaWJQOoQPsDOWco2/cckQQ9dno5Qm7nFLdFhuBkukT82NbAbwJw8t3ORFXjADyXtIQbZdhbCNcT6RcVZmMb984ChQ1 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2018 16:36:24.4452 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b4a8540-fb88-4519-4640-08d63060d9c2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2545 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP For some pixel formats .cpp structure in drm_format info it's not enough to describe the peculiarities of the pixel layout, for example tiled formats or packed formats at bit level. What's implemented here is to add three new members to drm_format_info that could describe such formats: - char_per_block[3] - block_w[3] - block_h[3] char_per_block will be put in a union alongside cpp, for transparent compatibility with the existing format descriptions. Regarding, block_w and block_h they are intended to be used through their equivalent getters drm_format_info_block_width / drm_format_info_block_height, the reason of the getters is to abstract the fact that for normal formats block_w and block_h will be unset/0, but the methods will be returning 1. Additionally, convenience function drm_format_info_min_pitch had been added that computes the minimum required pitch for a given pixel format and buffer width. Using that the following drm core functions had been updated to generically handle both block and non-block formats: - drm_fb_cma_get_gem_addr: for block formats it will just return the beginning of the block. - framebuffer_check: Use the newly added drm_format_info_min_pitch. - drm_gem_fb_create_with_funcs: Use the newly added drm_format_info_min_pitch. - In places where is not expecting to handle block formats, like fbdev helpers I just added some warnings in case the block width/height are greater than 1. Changes since v3: - Add helper function for computing the minimum required pitch. - Improve/cleanup documentation Signed-off-by: Alexandru Gheorghe --- drivers/gpu/drm/drm_fb_cma_helper.c | 21 ++++++- drivers/gpu/drm/drm_fb_helper.c | 6 ++ drivers/gpu/drm/drm_fourcc.c | 62 ++++++++++++++++++++ drivers/gpu/drm/drm_framebuffer.c | 6 +- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 2 +- include/drm/drm_fourcc.h | 61 ++++++++++++++++++- 6 files changed, 149 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c index d52344a03aa8..83941a8ca0e0 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c @@ -72,7 +72,9 @@ struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb, EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_obj); /** - * drm_fb_cma_get_gem_addr() - Get physical address for framebuffer + * drm_fb_cma_get_gem_addr() - Get physical address for framebuffer, for pixel + * formats where values are grouped in blocks this will get you the beginning of + * the block * @fb: The framebuffer * @state: Which state of drm plane * @plane: Which plane @@ -87,6 +89,14 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, struct drm_gem_cma_object *obj; dma_addr_t paddr; u8 h_div = 1, v_div = 1; + u32 block_w = drm_format_info_block_width(fb->format, plane); + u32 block_h = drm_format_info_block_height(fb->format, plane); + u32 block_size = fb->format->char_per_block[plane]; + u32 sample_x; + u32 sample_y; + u32 block_start_y; + u32 num_hblocks; + obj = drm_fb_cma_get_gem_obj(fb, plane); if (!obj) @@ -99,8 +109,13 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, v_div = fb->format->vsub; } - paddr += (fb->format->cpp[plane] * (state->src_x >> 16)) / h_div; - paddr += (fb->pitches[plane] * (state->src_y >> 16)) / v_div; + sample_x = (state->src_x >> 16) / h_div; + sample_y = (state->src_y >> 16) / v_div; + block_start_y = (sample_y / block_h) * block_h; + num_hblocks = sample_x / block_w; + + paddr += fb->pitches[plane] * block_start_y; + paddr += block_size * num_hblocks; return paddr; } diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index a504a5e05676..9add0d7da744 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1595,6 +1595,10 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, if (var->pixclock != 0 || in_dbg_master()) return -EINVAL; + if ((drm_format_info_block_width(fb->format, 0) > 1) || + (drm_format_info_block_height(fb->format, 0) > 1)) + return -EINVAL; + /* * Changes struct fb_var_screeninfo are currently not pushed back * to KMS, hence fail if different settings are requested. @@ -1969,6 +1973,8 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe { struct drm_framebuffer *fb = fb_helper->fb; + WARN_ON((drm_format_info_block_width(fb->format, 0) > 1) || + (drm_format_info_block_height(fb->format, 0) > 1)); info->pseudo_palette = fb_helper->pseudo_palette; info->var.xres_virtual = fb->width; info->var.yres_virtual = fb->height; diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index e177f6d0d1f4..a843a5fc8dbf 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -403,3 +403,65 @@ int drm_format_plane_height(int height, uint32_t format, int plane) return height / info->vsub; } EXPORT_SYMBOL(drm_format_plane_height); + +/** + * drm_format_info_block_width - width in pixels of block. + * @info: pixel format info + * @plane: plane index + * + * Returns: + * The width in pixels of a block, depending on the plane index. + */ +unsigned int drm_format_info_block_width(const struct drm_format_info *info, + int plane) +{ + if (!info || plane < 0 || plane >= info->num_planes) + return 0; + + if (!info->block_w[plane]) + return 1; + return info->block_w[plane]; +} +EXPORT_SYMBOL(drm_format_info_block_width); + +/** + * drm_format_info_block_height - height in pixels of a block + * @info: pixel format info + * @plane: plane index + * + * Returns: + * The height in pixels of a block, depending on the plane index. + */ +unsigned int drm_format_info_block_height(const struct drm_format_info *info, + int plane) +{ + if (!info || plane < 0 || plane >= info->num_planes) + return 0; + + if (!info->block_h[plane]) + return 1; + return info->block_h[plane]; +} +EXPORT_SYMBOL(drm_format_info_block_height); + +/** + * drm_format_info_min_pitch - computes the minimum required pitch in bytes + * @info: pixel format info + * @plane: plane index + * @buffer_width: buffer width in pixels + * + * Returns: + * The minimum required pitch in bytes for a buffer by taking into consideration + * the pixel format information and the buffer width. + */ +uint64_t drm_format_info_min_pitch(const struct drm_format_info *info, + int plane, unsigned int buffer_width) +{ + if (!info || plane < 0 || plane >= info->num_planes) + return 0; + + return DIV_ROUND_UP((u64)buffer_width * info->char_per_block[plane], + drm_format_info_block_width(info, plane) * + drm_format_info_block_height(info, plane)); +} +EXPORT_SYMBOL(drm_format_info_min_pitch); diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 3bf729d0aae5..6aca8a1ccdb6 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -195,20 +195,20 @@ static int framebuffer_check(struct drm_device *dev, for (i = 0; i < info->num_planes; i++) { unsigned int width = fb_plane_width(r->width, info, i); unsigned int height = fb_plane_height(r->height, info, i); - unsigned int cpp = info->cpp[i]; + u64 min_pitch = drm_format_info_min_pitch(info, i, width); if (!r->handles[i]) { DRM_DEBUG_KMS("no buffer object handle for plane %d\n", i); return -EINVAL; } - if ((uint64_t) width * cpp > UINT_MAX) + if (min_pitch > UINT_MAX) return -ERANGE; if ((uint64_t) height * r->pitches[i] + r->offsets[i] > UINT_MAX) return -ERANGE; - if (r->pitches[i] < width * cpp) { + if (r->pitches[i] < min_pitch) { DRM_DEBUG_KMS("bad pitch %u for plane %d\n", r->pitches[i], i); return -EINVAL; } diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c index ded7a379ac35..acb466d25afc 100644 --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c @@ -171,7 +171,7 @@ drm_gem_fb_create_with_funcs(struct drm_device *dev, struct drm_file *file, } min_size = (height - 1) * mode_cmd->pitches[i] - + width * info->cpp[i] + + drm_format_info_min_pitch(info, i, width) + mode_cmd->offsets[i]; if (objs[i]->size < min_size) { diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index 345f11227e9e..253d4c07a10c 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h @@ -69,8 +69,59 @@ struct drm_format_info { /** @num_planes: Number of color planes (1 to 3) */ u8 num_planes; - /** @cpp: Number of bytes per pixel (per plane) */ - u8 cpp[3]; + union { + /** + * @cpp: + * + * Number of bytes per pixel (per plane), this is aliased with + * @char_per_block. It is deprecated in favour of using the + * triplet @char_per_block, @block_w, @block_h for better + * describing the pixel format. + */ + u8 cpp[3]; + + /** + * @char_per_block: + * + * Number of bytes per block (per plane), where blocks are + * defined as a rectangle of pixels which are stored next to + * each other in a byte aligned memory region. Together with + * @block_w and @block_h this is used to properly describe tiles + * in tiled formats or to describe groups of pixels in packed + * formats for which the memory needed for a single pixel it's + * not byte aligned. + * + * @cpp had been kept from historical reasons because there are + * a lot of places in drivers where it's used. In drm core for + * generic code paths the preferred way is to use + * @char_per_block, drm_format_info_block_width() and + * drm_format_info_block_height() which allows handling both + * block and non-block formats in the same way. + * + * For formats that are intended to be used only with non-linear + * modifiers both @cpp and @char_per_block must be 0 in the + * generic format table. Drivers could supply accurate + * information from their drm_mode_config.get_format_info hook + * if they want the core to be validating the pitch. + */ + u8 char_per_block[3]; + }; + + /** + * @block_w: + * + * Block width in pixels, this is intended to be accessed through + * drm_format_info_block_width() + */ + u8 block_w[3]; + + /** + * @block_h: + * + * Block height in pixels, this is intended to be accessed through + * drm_format_info_block_height() + */ + u8 block_h[3]; /** @hsub: Horizontal chroma subsampling factor */ u8 hsub; @@ -106,6 +157,12 @@ int drm_format_horz_chroma_subsampling(uint32_t format); int drm_format_vert_chroma_subsampling(uint32_t format); int drm_format_plane_width(int width, uint32_t format, int plane); int drm_format_plane_height(int height, uint32_t format, int plane); +unsigned int drm_format_info_block_width(const struct drm_format_info *info, + int plane); +unsigned int drm_format_info_block_height(const struct drm_format_info *info, + int plane); +uint64_t drm_format_info_min_pitch(const struct drm_format_info *info, + int plane, unsigned int buffer_width); const char *drm_get_format_name(uint32_t format, struct drm_format_name_buf *buf); #endif /* __DRM_FOURCC_H__ */ From patchwork Fri Oct 12 16:35:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10638861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4EC5A933 for ; Fri, 12 Oct 2018 16:36:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D0BA2BEEE for ; Fri, 12 Oct 2018 16:36:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 306FF2BF8D; Fri, 12 Oct 2018 16:36:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AED6E2BEEE for ; Fri, 12 Oct 2018 16:36:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E46976E4CC; Fri, 12 Oct 2018 16:36:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on062f.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::62f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 88AC36E4C5 for ; Fri, 12 Oct 2018 16:36:28 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Fri, 12 Oct 2018 16:36:26 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, ayan.halder@arm.com, daniel.vetter@ffwll.ch, raymond.smith@arm.com, david.garbett@arm.com, lisa.wu@arm.com, matt.szczesiak@arm.com, charles.xu@arm.com, james.qian.wang@arm.com Subject: [PATCH v4 3/9] drm/fourcc: Add fourcc for Mali linear tiled formats Date: Fri, 12 Oct 2018 17:35:54 +0100 Message-Id: <20181012163600.20331-4-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> References: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: CWLP265CA0200.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::20) To AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f50cac17-e9f1-4497-2d44-08d63060dab4 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2545; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 3:XZyfJHQvWBwMqs6gpy2gdwhBujnYsGUjiRE0dFDfhVvLoDS9tYoQ+rxzcicTZoUNBr1+fDGnIIAv7O+73hz3iYjxV5DczoC9XFLrwBD8twyVWWgdYHXWOD1KUGW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2beD1QblPPqet1jdP7Mu6WKc7Kwh8P8i16a611rmY9BCHxBHmte0BWg+xDzzA2WE1GYiW8v9e9022hOU5gXMj89ndd9vrvsfY5edVsNQPqhz4fhEvNtMsBGQ1t/PODbeSCqgGhYZDT32yMe5b0JPg=; 4:f8aifJwvFhXfNZGveKs3mMRYjt4ZciLOvPaIAg6I8AhAkMCnsx1oxZho755JcrAggD9k8QMl9ShJ156r7zmEotwr6Z3Jk76DzXHRuDrDj4hlZEituriri+Xo8f63umreq53vp1onD5XdHXCu66Pyei3F9G653MiL35J291ZMVAXxpoi1F/r5A6QsMVytnF1zVkfzSWlBe0U1lZdROpKUpybeSulmCykYmlhoke8UoDQymAmnmZKgKNTKfQZau1LhA+ShfrHCSY9DmKbLmcsNUTqENOc8KdJddj70d3ndLzVPLhGAuKH0VNkrbOjmXSmg X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:AM5PR0802MB2545; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2545; X-Forefront-PRVS: 0823A5777B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(366004)(199004)(189003)(25786009)(4326008)(81156014)(72206003)(106356001)(105586002)(81166006)(478600001)(5660300001)(47776003)(97736004)(26005)(8936002)(50226002)(66066001)(476003)(16526019)(6486002)(186003)(2906002)(8676002)(316002)(16586007)(7696005)(50466002)(956004)(2616005)(575784001)(486006)(6666004)(7736002)(305945005)(52116002)(48376002)(68736007)(76176011)(51416003)(86362001)(36756003)(53936002)(386003)(446003)(1076002)(3846002)(6116002)(11346002)(6636002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2545; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2545; 23:eu6HVg8o8a01haY8Q8MUTWljHm2m5KyrxZyRXNo?= cSeRzIUXUOULh3K7fDBuu8u8GVY3UYHjp+JZY6Auo/R3fZAvyYMlkLgcnw8MRzrYH8ur84XYulZ8LDFnqwCu3lrLTqGG9RDkMkzTjhDa3wTpu17zb8Ygq0qIyNcAb6vZ/SEdkDjz8wo1pp5tH6sFbY2oUJdOelzcbQWARdrAIi0dosbhKsrt4jBMoHUD7EHlmA3rRhNl0HobKeu2bjqGOXLslswS3PkdZe0L6rJb+SKcTjnsgHzZ71fN6rOSe8OATkmr2G7CWr6wy4O+wHCNM7KIQwUJFOcC6iLRW91txprTRhFx9Hj7WGPwL3hX4pM2Dde1vuZi0IJvprmqvsxYPB7vnpLoZ5S6R+HReWdD2qMTK9aJjTXuY8WH/LrfzPQAas0pfZPh5MMZ3rknkl9Ly4pSd4Vnmm1Lv9q1nuCVGYjv7gRmupY+puELEN3KHpLScW9PzREktJ5x281MNHbNKm7iXYBRyzBYpqadiTGT3DQyNMkaq8vJDjOmIS1YmYB24Nqcpsz03DDh+QZzpRZkckHwijCwkAQfivKu8orUuqzH1aHBqP4EaGSsGj6gBmKB7O7u7H4Vhe+4lu/r0XUj7M7ChtXEiPRSEu01ZLUJ4mXrRi6PtvW65yXweA86/kqZE8RCNpooXp5D/EjO6PfspXKcs1vg9Wy9ZVA2g/u5vFcDZAzjHNbYXLism2iPICfuhRv+uG8NNcyVOpvX1O4P5cz77QLec8Jq44L5Nn2Uge7uI5Uq+DVe/BqdwciZhocvzIpgbJ9+UzgU5bynMF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zdOQBr1qWh/CmZEh2bHjtidldY6yxeb9vAfqC6bB0jziQe2JPgsnf1pUdoVWSyr9gPLwnEQAjdTbi1UyJQ2s5XfGmt1d274mybLwspx3zQFgTDJANruhemaR27qnSNcyBT2Oy300wLIfw7IB8aC24Hfk1uzZg4fENsljMclKXI0OUIsmjYTR1ERfNNFCWRBljtOIx/PPi5he7aN1Bn0r6WTSFaYIZIGFSkUCrpyErXV8AqwQDcak+LrTz0j2CuLNvrwNf1FdpQ==; 5:X67QrnSoAFq2J6XKJnVtTfFecp9IMH/nTiQ7WosY1l0Q2/A5McYK2VW/ENx0Yllwa3A12bEgkUTCFeEG+hFtiM+nPklcH2gT2QpqX5dpJvdU3EiaNz0aHMkBu8BXNjM462XEPF6cTF9DxUOBH1NXuU9vviV8Vai6crFcvT2wZmA=; 7:hjos3QPZYJ1aQYbyL/jiTvKSLtjPDBYMQnadZFZZQVIQfVeFkSsRP+UyIWnvq1X/k4xkSyMqi2juk5RJ4Fj/pmNp3GDeFUUg+CCdpAruaVLkLK6bZvqmlL/ANF+vx8JhIPbKsTCXbqiVEuE4Xrtbou4Z+JAyrOoLj6FPro1X/nq/R1rUUh6zmjVrVcavIzVV205jgQmVavwR5Wo2jz+9BK/1cpBOQXaMjbiw9GJTbCAVHgEVKXEaalycqgHHdUz6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2018 16:36:26.0305 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f50cac17-e9f1-4497-2d44-08d63060dab4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2545 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Mali-DP implements a number of tiled yuv formats which are not currently described in drm_fourcc.h. This adds those definitions and describes their memory layout by using the newly added char_per_block, block_w, block_h. Signed-off-by: Alexandru Gheorghe Acked-by: Liviu Dudau --- drivers/gpu/drm/drm_fourcc.c | 12 ++++++++++++ include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index a843a5fc8dbf..69caa577149c 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -228,6 +228,18 @@ const struct drm_format_info *__drm_format_info(u32 format) { .format = DRM_FORMAT_P010, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true }, { .format = DRM_FORMAT_P012, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true }, { .format = DRM_FORMAT_P016, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true }, + { .format = DRM_FORMAT_Y0L0, .depth = 0, .num_planes = 1, + .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0}, + .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv = true }, + { .format = DRM_FORMAT_X0L0, .depth = 0, .num_planes = 1, + .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0}, + .hsub = 2, .vsub = 2, .is_yuv = true }, + { .format = DRM_FORMAT_Y0L2, .depth = 0, .num_planes = 1, + .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0}, + .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv = true }, + { .format = DRM_FORMAT_X0L2, .depth = 0, .num_planes = 1, + .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0}, + .hsub = 2, .vsub = 2, .is_yuv = true }, }; unsigned int i; diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 600106adf91f..4de86dbf40ca 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -152,6 +152,20 @@ extern "C" { #define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ +/* + * packed YCbCr420 2x2 tiled formats + * first 64 bits will contain Y,Cb,Cr components for a 2x2 tile + */ +/* [63:0] A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */ +#define DRM_FORMAT_Y0L0 fourcc_code('Y', '0', 'L', '0') +/* [63:0] X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */ +#define DRM_FORMAT_X0L0 fourcc_code('X', '0', 'L', '0') + +/* [63:0] A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian */ +#define DRM_FORMAT_Y0L2 fourcc_code('Y', '0', 'L', '2') +/* [63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian */ +#define DRM_FORMAT_X0L2 fourcc_code('X', '0', 'L', '2') + /* * 2 plane RGB + A * index 0 = RGB plane, same format as the corresponding non _A8 format has From patchwork Fri Oct 12 16:35:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10638857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A0E7157A for ; Fri, 12 Oct 2018 16:36:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 386F22BEEE for ; Fri, 12 Oct 2018 16:36:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C2DD2BF8D; Fri, 12 Oct 2018 16:36:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B791B2BEEE for ; Fri, 12 Oct 2018 16:36:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E082E6E4C9; Fri, 12 Oct 2018 16:36:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on062f.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::62f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 40F8F6E4C5 for ; Fri, 12 Oct 2018 16:36:29 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Fri, 12 Oct 2018 16:36:27 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, ayan.halder@arm.com, daniel.vetter@ffwll.ch, raymond.smith@arm.com, david.garbett@arm.com, lisa.wu@arm.com, matt.szczesiak@arm.com, charles.xu@arm.com, james.qian.wang@arm.com Subject: [PATCH v4 4/9] drm: mali-dp: Enable Mali-DP tiled buffer formats Date: Fri, 12 Oct 2018 17:35:55 +0100 Message-Id: <20181012163600.20331-5-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> References: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: CWLP265CA0200.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::20) To AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0d6d501c-b126-4c71-292a-08d63060db86 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2545; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 3:CERjLo/XSxlM955kzF6vs5MT/AVxQs51tH6cU5DofkAXqsNJQ6a6X7+U3uTKPBC2mfn/Wu/6qQgEyjge5rRfuIYZja/2zKbnMuahzLIxZ60jcesAzijjyGSb9q3wiHSBd3O+YJyLaLsDRVso5hlXDau0rXwFMeTrtU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hxLKlbD+J972W05YtWfI/aTYjSzBjSf2vVPMroTHmhffnmBRAxicxIUUfnlfewyWbWke77vB0xD9bh+87/QaP3U4VJuBwSjOoc9UpRvO+IyemUksvkcgjaM8H/I=; 4:1LGevlPHe/3/ECRXDrZRCt+wxBaBcjZgR8u6UvFW0gsk253/Wxs2W3DhlU1k+sKKJYw1Vl6+28FaHjrTbGZTDTrJdwR12D/Dgt0UnL0YIhMdSwO3i94O4dD+Jf5PFUYTrOCYMfPS5Hw4pjRrPTA3mhHoPb2RccVJBxATF44hMgz8QHrweIKxcx/f4y4kCyxnKblDvG2N8euJn68BBOWfBWrMBnr9/77R4jlKe+BDfOrnrRQ32kzWK1iUagXJQQclGxbyjaIYPjfpupygH25ISRfPIEjXM6NwvxxL7mBakFPJc4sWLq2W0e8L0twDmpAm X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:AM5PR0802MB2545; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2545; X-Forefront-PRVS: 0823A5777B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(366004)(199004)(189003)(25786009)(4326008)(81156014)(72206003)(106356001)(105586002)(81166006)(478600001)(5660300001)(47776003)(45080400002)(97736004)(26005)(8936002)(50226002)(66066001)(476003)(16526019)(6486002)(186003)(2906002)(8676002)(316002)(16586007)(7696005)(50466002)(956004)(2616005)(575784001)(486006)(6666004)(7736002)(305945005)(52116002)(48376002)(68736007)(76176011)(51416003)(86362001)(36756003)(53936002)(386003)(446003)(1076002)(3846002)(6116002)(11346002)(6636002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2545; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2545; 23:lXuZszTS9w3X7TdDPZzU7TzzbOeeKeU6G8xqE9k?= jwVIRSvkFnPQTNZyjBn+hJIQh50oU8Lx10vhfnTbDemBQ2BF8BEThf2N0VtD+AMaNAtGcsf+Ct8tDZJHFeB8RifhGTeEig17qUlaaYdKBX140O/bNDN1lOBc6ewwOR86C3gD/kjQNMmR9SA78QHINQBH9TCjl7ed4MMDWa70Oky8FXe+T26dwlu4XTRkY+hpHCAACUUJ/37ZKCm6HIxGXus+YPAu+swbQq27l0pb3dFh8xE544pQuvBV1qxVIZV/Dsyjfp15EG5i2UjutcmoVn5P6B2ljiSuJ+UZZS5QPSHz/vaXIPv9Cq/+gBAvzHG3SadwrhV9N8SLq8WOjCx32y7QyaNOy6+aTEh/2SN2/dN9S6wyb8TSfg10Ohx35h34MMRD3FczCrmR2OYbplfsfTVe87LSEr8IEtXoqc75aerDxOX61LFQAKRWeBh1l5RTvUM99/blljPwa/e1EKnHa+9Mmxdl/LGDcNcC0z8LkkGrtKZu5MKDnP28lxSxFUCG1e4HELhAIOzCC0hTB2EQ8jFyhi+WRncFbTEc3Xfx0x60bLJIwZKwBQ0ASWNgMpvIw6pyEWotEYdvtDaBxUZoultO4kTy8lmdWdIOWbs5WNwOmnZxOLRuFO1MWLBDhSxPcvRvX9LxRxT11DAOPOjlXCu66q2XN+oQiOi/VBV39jZNIPOPd5Lln47yFX9zrmE2afdLSh42r9jifDGYQEJ4DKvePzDqLBcTmkrFfwokacmfZrqakXKT5aSl+31/3c98S3Kx0K/CxV0wX2XdIW0Le1DIqk3CGAvAK6PlT18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U/sV5UcG5bWk5W4fmu6+kHNx0WZncUcfTWe0rvmG9+ktSCtEkLDk1CMUdi2Z8t0tqM3xCNr02cCdU99gkGdbnZeUMPhbuvyxUTSy6E/uV16fGRIpVkfXfr7U9iM9nKtno2Et8dnAtXZNDlaD4QaqdbN03gZxwzzkzXZIJVtSGPJnaK/cwIUoxXNy1Uf3FaqnpDVSFamaqQ6+4EqIpDlNwebaXfUR52jTzsO1i0djrRXiWeddj081PHt8BC8daA==; 5:dC//dZ5UUUaOIgicya02pg8fqR3brbYGgDm+TbXuYzPUZFnQFXFLKKTb5j6VfdcgbzGmeQxRGgvHamjKjpxQIH3u6Xisfuh3Fe7ZsGMTn5KwX9gYUkiN5c3BwC9wqTG6OJr0VDskNvEVvkhd/cd37gFp55Ie+Wm6mQI6YcS3hOQ=; 7:FyZqx3jietytHz8/eKGMAhFvqRMBUt+2rMb+naLMnDrA8T9peakV7HqfRGm9nxLVM4KTXSkVA7sl60qW7AsNxN55UwaMb/dSLronDcOzpNAMWzZ7dkH0p6HJ7dugrSNF55wNg0nbjPEmvUnH+1ESS8oy8ZipsZrNRVebXZO/EVpYf4Ss2xqLkC9MbN/MVK1fhGQxoP1+57QFZTQEomjZbFTJuxkE+65SBPnkhbGsHo9/oKWZ8/zP56SIlmOtaRDq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2018 16:36:27.4067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0d6d501c-b126-4c71-292a-08d63060db86 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2545 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Enable the following formats - DRM_FORMAT_X0L0: DP650 - DRM_FORMAT_X0L2: DP550, DP650 Signed-off-by: Alexandru Gheorghe Acked-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_hw.c | 14 +++++++++++--- drivers/gpu/drm/arm/malidp_planes.c | 23 +++++++++++++++++++++-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c index c94a4422e0e9..e01fc0e5b503 100644 --- a/drivers/gpu/drm/arm/malidp_hw.c +++ b/drivers/gpu/drm/arm/malidp_hw.c @@ -77,12 +77,18 @@ static const struct malidp_format_id malidp500_de_formats[] = { { DRM_FORMAT_YUYV, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 2) }, \ { DRM_FORMAT_UYVY, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 3) }, \ { DRM_FORMAT_NV12, DE_VIDEO1 | DE_VIDEO2 | SE_MEMWRITE, MALIDP_ID(5, 6) }, \ - { DRM_FORMAT_YUV420, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 7) } + { DRM_FORMAT_YUV420, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 7) }, \ + { DRM_FORMAT_X0L2, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(6, 6)} static const struct malidp_format_id malidp550_de_formats[] = { MALIDP_COMMON_FORMATS, }; +static const struct malidp_format_id malidp650_de_formats[] = { + MALIDP_COMMON_FORMATS, + { DRM_FORMAT_X0L0, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 4)}, +}; + static const struct malidp_layer malidp500_layers[] = { { DE_VIDEO1, MALIDP500_DE_LV_BASE, MALIDP500_DE_LV_PTR_BASE, MALIDP_DE_LV_STRIDE0, MALIDP500_LV_YUV2RGB }, { DE_GRAPHICS1, MALIDP500_DE_LG1_BASE, MALIDP500_DE_LG1_PTR_BASE, MALIDP_DE_LG_STRIDE, 0 }, @@ -595,6 +601,8 @@ static int malidp550_rotmem_required(struct malidp_hw_device *hwdev, u16 w, u16 case DRM_FORMAT_BGR565: case DRM_FORMAT_UYVY: case DRM_FORMAT_YUYV: + case DRM_FORMAT_X0L0: + case DRM_FORMAT_X0L2: bytes_per_col = 32; break; /* 16 lines at 1.5 bytes per pixel */ @@ -860,8 +868,8 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { MALIDP550_DC_IRQ_SE, .vsync_irq = MALIDP550_DC_IRQ_CONF_VALID, }, - .pixel_formats = malidp550_de_formats, - .n_pixel_formats = ARRAY_SIZE(malidp550_de_formats), + .pixel_formats = malidp650_de_formats, + .n_pixel_formats = ARRAY_SIZE(malidp650_de_formats), .bus_align_bytes = 16, }, .query_hw = malidp650_query_hw, diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 49c37f6dd63e..33bbc29da774 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -196,13 +196,26 @@ static int malidp_de_plane_check(struct drm_plane *plane, ms->n_planes = fb->format->num_planes; for (i = 0; i < ms->n_planes; i++) { u8 alignment = malidp_hw_get_pitch_align(mp->hwdev, rotated); - if (fb->pitches[i] & (alignment - 1)) { + + if ((fb->pitches[i] * drm_format_info_block_height(fb->format, i)) + & (alignment - 1)) { DRM_DEBUG_KMS("Invalid pitch %u for plane %d\n", fb->pitches[i], i); return -EINVAL; } } + if (fb->width % drm_format_info_block_width(fb->format, 0) || + fb->height % drm_format_info_block_height(fb->format, 0)) { + DRM_DEBUG_KMS("Buffer width/height needs to be a multiple of tile sizes"); + return -EINVAL; + } + if ((state->src_x >> 16) % drm_format_info_block_width(fb->format, 0) || + (state->src_y >> 16) % drm_format_info_block_height(fb->format, 0)) { + DRM_DEBUG_KMS("Plane src_x/src_y needs to be a multiple of tile sizes"); + return -EINVAL; + } + if ((state->crtc_w > mp->hwdev->max_line_size) || (state->crtc_h > mp->hwdev->max_line_size) || (state->crtc_w < mp->hwdev->min_line_size) || @@ -258,8 +271,14 @@ static void malidp_de_set_plane_pitches(struct malidp_plane *mp, num_strides = (mp->hwdev->hw->features & MALIDP_DEVICE_LV_HAS_3_STRIDES) ? 3 : 2; + /* + * The drm convention for pitch is that it needs to cover width * cpp, + * but our hardware wants the pitch/stride to cover all rows included + * in a tile. + */ for (i = 0; i < num_strides; ++i) - malidp_hw_write(mp->hwdev, pitches[i], + malidp_hw_write(mp->hwdev, pitches[i] * + drm_format_info_block_height(mp->base.state->fb->format, i), mp->layer->base + mp->layer->stride_offset + i * 4); } From patchwork Fri Oct 12 16:35:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10638865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3FF21157A for ; Fri, 12 Oct 2018 16:36:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F9E42BEEE for ; Fri, 12 Oct 2018 16:36:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 230FA2BF8D; Fri, 12 Oct 2018 16:36:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B63D72BEEE for ; Fri, 12 Oct 2018 16:36:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC46C6E4CF; Fri, 12 Oct 2018 16:36:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on062b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::62b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 531AD6E4C7 for ; Fri, 12 Oct 2018 16:36:31 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Fri, 12 Oct 2018 16:36:28 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, ayan.halder@arm.com, daniel.vetter@ffwll.ch, raymond.smith@arm.com, david.garbett@arm.com, lisa.wu@arm.com, matt.szczesiak@arm.com, charles.xu@arm.com, james.qian.wang@arm.com Subject: [PATCH v4 5/9] drm: Extend framebuffer_check to handle formats with cpp/char_per_block 0 Date: Fri, 12 Oct 2018 17:35:56 +0100 Message-Id: <20181012163600.20331-6-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> References: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: CWLP265CA0200.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::20) To AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cea0787c-c0fb-4f17-2055-08d63060dc65 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2545; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 3:KIzmQY+9TrPQnjJ1jWnz22z4UyBwalob3Z07gcm64c28GNilq0WyaD3BsYDOl7yGTZvWeEX7zuOe363xCvEruglh2n+tMkA/4lduu4m5wCdYShc9dMF6xRLYPJhCKYy67d6ljFDIKsuXgXrqjtruNezBgHz4gHqYJhbaYB7gu644W3KiNIU65q5c2NgTwN2Z7X4l3GduwFrsLBNZI47HitJlV6mUhvTN+TBtdknELdofmsYVALpV7Fvrz/tx/l1Z; 25:/HXLmznPhHbE1HA0IpLSgkpytLVql+rD7GgduwInxJcp4bc4Xnyy02YRNhVtayqDRuEaXo0ZooXNg4WvpdlHP8txrp21kQueCNlaqGdNp9LGA7gHn/ghqaRcxA1e8HmgSFqNqRa0wnVodc/XQC11aB1vQecwMVfqhIAYjrXtUhJeLjX5et6PJSe+8gFpBEun+OJ0LsjRLXPhM2ZZwVJsW3+lI/ONg5SCmFOJFUYhHBn7UdqPq6YxNXFMZYsgjF5pEHIJUqB8P6kUXrmvkLEsBD9bN80cEpIMrI6YFts8ync3UtYU5cFWQ9h5FupNXDuPEi+JMf0atO0UjLbq6eVhYg==; 31:sL7ZyCIcRn//9JeH1PBGEupSV+0zk7n/AAA9GJbIL9csHSeuGfwWp7zDOrYKzi7QsrX+pIdDSeNKuuHWmmZlM/6/wfbsfvvDw4ooCaSm3O+ydZKl+fqhNh29jEftFxBcJ+s8DeIguQ9JMdKaz3Taw/8uhnLfHl0MJWCIJuq6DrfadWgLr8uTmqtrDxvqg66gsz3k+P8YL790q79MFSZjQqlhNyWAgkLXpfYqgPx0wJ0= X-MS-TrafficTypeDiagnostic: AM5PR0802MB2545: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 20:rOFYwWibTj0cqv/jjcbCPpYRa5ri0uE/rJS/xcvXfZaHqH4VtsJcfdZUvmp2vcotpIZItNoqXtNwxMp6MuYWFJWy5TFqklFDV5hzhRcoviOgywaRyfCPvxtF9idRP5pfNJWMLlJmaKqMBfJL8u1bGtg2sIO/bRz7vfgfz7NjFY98YQO9WAGI659EZ28woaicIiMDBmHW5CMmE7n5znGvnUnnpkFW+7prGR+uq7PFJ39xV4YTcEbv74VnD70MeE2C3jELFOEXUCQHtRKz3hJsrqStluuXo0Am9I0DSionC3g6Pjss5j6kY092PIMcgLaMc9dy0J0ndFvXgpyYIISfcBsAVYkYLxV0OhHH8BjIqY2dp+JNSxkhuIkXK4sYMWSocr+ISESpMJ/cE79HVirAHI44rqWsQLAQD9rpZVEYTPk=; 4:lUCg8CAjpkiI5GtcQwp5JN8ulC0+j7pRbwf8PBP/3BR1BeEYbShudjoJNJ89a5TvQo7kcv9hy2rN0JIZWF0BISA+40yFE9B3I0vkkXwWEWFKA7flI5eHkJmqhgDxTBAHw+lm4Gyd2hWH59JVqYEGkn7MWb2wdBSNEpMoDC8EKqCQKnmfauJFPmLiedICt3z0ac1suLDLjUsTP/zDZJtUcDfURI7h3QbTB1FpTzidjsa7i/CZ6NTaY2x7s1XjZidIMIu4egbJPty/7H4c3TLXXcetEuWrWgZVHkXNqzUO1xnTM7TSIEmjnBcO36A4UTu/ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:AM5PR0802MB2545; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2545; X-Forefront-PRVS: 0823A5777B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(366004)(199004)(189003)(6306002)(25786009)(4326008)(81156014)(72206003)(966005)(106356001)(105586002)(81166006)(478600001)(5660300001)(47776003)(97736004)(26005)(8936002)(50226002)(66066001)(476003)(16526019)(6486002)(186003)(2906002)(8676002)(316002)(16586007)(7696005)(50466002)(956004)(2616005)(575784001)(486006)(6666004)(7736002)(305945005)(52116002)(48376002)(68736007)(76176011)(51416003)(86362001)(36756003)(53936002)(386003)(446003)(1076002)(3846002)(6116002)(5024004)(11346002)(14444005)(6636002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2545; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2545; 23:mWbtDUPYw6NjepH0c1UAWekWafLlDESpfQY+3eJ?= CCqqr+ByoWlG4BzD7LXBTEOHpzc3hmPt16EsgGbii+3ubEurYU7I9JEWLlo/apfOGFrpfXG3u1+2PqteF2IkxUhIK4mUbBLLDS/VULlJYECvZtEU7FfUGOOC3JUHW9sAY0yvpbGETpOWzZCyfbqsMfp7x0u3A8MZfp0f9COY9E8eat5n9ZkVXc/ovYTg76Gpvr+vBqWVCg6g+FT1a2kKZerU88wow9IZayFhRwIZRVz7ZSBKRQK4mkYfRWxfvcpXUGaTes+M4N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FI/Y2o0LWf7xZjnoUVLZe4+widUZ5xrdoLkIdDwOl4P7TNeygnpkSu2l55s5q5WA1taNTqQIdYi2D1SwriF1wqSY8GLcwGTXAglb8uhwuhinQY/ZUI5mW2k5iC3ANJhySwRqscjcwhY3UaBi6eUlXBUnAAPN9+iFT2lbkvbHGdDArOEim2LxreUk SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2018 16:36:28.8659 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cea0787c-c0fb-4f17-2055-08d63060dc65 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2545 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP For formats that are supported only with non-linear modifiers it doesn't make to much sense to define cpp or char_per_block, so that will be set to 0. This patch adds a restriction to force having a modifier attached when cpp/char_per_block is 0, and to bypass checking the pitch restriction. This had been discussed here. [1] https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&highlight_names=&date=2018-09-13&show_html=true Signed-off-by: Alexandru Gheorghe --- drivers/gpu/drm/drm_framebuffer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 6aca8a1ccdb6..e346d0ad92e0 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -195,8 +195,13 @@ static int framebuffer_check(struct drm_device *dev, for (i = 0; i < info->num_planes; i++) { unsigned int width = fb_plane_width(r->width, info, i); unsigned int height = fb_plane_height(r->height, info, i); + unsigned int block_size = info->char_per_block[i]; u64 min_pitch = drm_format_info_min_pitch(info, i, width); + if (!block_size && (r->modifier[i] == DRM_FORMAT_MOD_LINEAR)) { + DRM_DEBUG_KMS("Format requires non-linear modifier for plane %d\n", i); + return -EINVAL; + } if (!r->handles[i]) { DRM_DEBUG_KMS("no buffer object handle for plane %d\n", i); return -EINVAL; @@ -208,7 +213,7 @@ static int framebuffer_check(struct drm_device *dev, if ((uint64_t) height * r->pitches[i] + r->offsets[i] > UINT_MAX) return -ERANGE; - if (r->pitches[i] < min_pitch) { + if (block_size && r->pitches[i] < min_pitch) { DRM_DEBUG_KMS("bad pitch %u for plane %d\n", r->pitches[i], i); return -EINVAL; } From patchwork Fri Oct 12 16:35:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10638859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8D0B157A for ; Fri, 12 Oct 2018 16:36:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C77922BEEE for ; Fri, 12 Oct 2018 16:36:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB6DA2BF8D; Fri, 12 Oct 2018 16:36:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DB6C22BEEE for ; Fri, 12 Oct 2018 16:36:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A21986E4CB; Fri, 12 Oct 2018 16:36:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on062b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::62b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1EF3A6E4CA for ; Fri, 12 Oct 2018 16:36:32 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Fri, 12 Oct 2018 16:36:30 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, ayan.halder@arm.com, daniel.vetter@ffwll.ch, raymond.smith@arm.com, david.garbett@arm.com, lisa.wu@arm.com, matt.szczesiak@arm.com, charles.xu@arm.com, james.qian.wang@arm.com Subject: [PATCH v4 6/9] drm/fourcc: Add AFBC yuv fourccs for Mali Date: Fri, 12 Oct 2018 17:35:57 +0100 Message-Id: <20181012163600.20331-7-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> References: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: CWLP265CA0200.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::20) To AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8ca83a9c-23f1-4234-b124-08d63060dd3b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2545; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 3:RpTfE6R5+t0JUB7gCBXLCGLuDsW58q/Dhc4fdvHuQyB/P6kdGl01M1qSws9oJWBZ/jPUeGEeIR/PrrPR6vJ1YAAj3JU1bFSgAn3yRpTbzzn4yJAPzr9LFXVqGnY71e/n3xnBDMGMpCBgBzw3kAmxjWw72TGpgxAOUYTyQiXgYnOY2dUQ2L1ByN1wyoW+VNhXt7Ovs5OO1YwJ67T5ysvIxXr0KPkSloVBdedssYHJN3sGLhQ+wciZvWTgpwa/2gTl; 25:mYPBBCUFDL8euQMF/2LYLTf3HqTdh5dNc+4GXLwO5PXyAh+1hW8MUIfpTddjYF1jtsB3EX0PLM3XDVXEDeeQQ/s33LjN8MoyaluBJ4nsZPvOXk1y1GcRXmCD7R+nq0fER/oS0Z5zJ3JfL8WCGXwkym3LXlNybhM7DWtqyDrmNOfNPWrdXWfuAK02lGUiXdEDxImC+4//MJbjusl0EGGBaUACtn7d0kwP2BbKBD65c2qjrEnbj+cEiAVywHYxVL/Z+QnxuJQ8562mqtAi4aZZVrH9B13T/64gRUCM98yEXezs9dzNYRgDHT/EX+hZATJOhtTNAPqawx+Cq5YHJF44Nw==; 31:zcA6+pRI3D1Ory05S13VhL6CZ8TSji0IdYxkCNdO+yKHWwmQzetQ5EwRW/zgfbsihNBZoCz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-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(217544274631240)(28532068793085); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:AM5PR0802MB2545; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2545; X-Forefront-PRVS: 0823A5777B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(366004)(199004)(189003)(6306002)(25786009)(4326008)(81156014)(72206003)(966005)(106356001)(105586002)(81166006)(478600001)(5660300001)(47776003)(97736004)(26005)(8936002)(50226002)(66066001)(476003)(16526019)(6486002)(186003)(2906002)(8676002)(316002)(16586007)(7696005)(50466002)(956004)(2616005)(575784001)(486006)(6666004)(7736002)(305945005)(52116002)(48376002)(4744004)(68736007)(76176011)(51416003)(86362001)(36756003)(53936002)(386003)(446003)(1076002)(3846002)(6116002)(11346002)(14444005)(6636002)(921003)(21314002)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2545; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2545; 23:83sgs7avA7BECNG7iDhRcx7b4ApRU9krE+eBWn2?= ogfAkZE8pS80NMT2iB1E4bhbhV0+ew6t++Y9NY3UOyIPFCcSreaErMNzUnnPvVnjuhul8FlhI/D0BzaEEgxv5zJlGujBplDffBHSXkXJK+uPI4o9hOKECuylGKbhXN1+ArbXIR2QSfw7UiW+3h/9YFnA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/Ai/DGKqpDEiwjhl6RhFpG7WoPDL3u7z/n0BF2qgK8HYg4twi+vB+Mvs=; 7:YSxZ6ywwDsmVFAuMVKxRYumDKJKNB9Qh+g+3LBrKDVj4GDhs+2Wj0BAW/4Mhh+3cuScA/V9p31KMu4jDqx3iI695HqhMH6ReediVywlzTkMatDVBZShIivjnqiqb++/9sL4e4qDIaV+tY0aZkfFwcvQwCgRFz2Vsk6WOa5/O8XfvFqygy6Wrq2iheEVT6vrpM++qWmqmtVcoWuirC7g5S/6RtptimVK3XQrRfC/LOqCzLo2FPaimX3uAohXBf9Jl SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2018 16:36:30.2901 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ca83a9c-23f1-4234-b124-08d63060dd3b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2545 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Brian Starkey As we look to enable AFBC using DRM format modifiers, we run into problems which we've historically handled via vendor-private details (i.e. gralloc, on Android). AFBC (as an encoding) is fully flexible, and for example YUV data can be encoded into 1, 2 or 3 encoded "planes", much like the linear equivalents. Component order is also meaningful, as AFBC doesn't necessarily care about what each "channel" of the data it encodes contains. Therefore ABGR8888 and RGBA8888 can be encoded in AFBC with different representations. Similarly, 'X' components may be encoded into AFBC streams in cases where a decoder expects to decode a 4th component. In addition, AFBC is a licensable IP, meaning that to support the ecosystem we need to ensure that _all_ AFBC users are able to describe the encodings that they need. This is much better achieved by preserving meaning in the fourcc codes when they are combined with an AFBC modifier. In essence, we want to use the modifier to describe the parameters of the AFBC encode/decode, and use the fourcc code to describe the data being encoded/decoded. To do anything different would be to introduce redundancy - we would need to duplicate in the modifier information which is _already_ conveyed clearly and non-ambigiously by a fourcc code. I hope that for RGB this is non-controversial. (BGRA8888 + MODIFIER_AFBC) is a different format from (RGBA8888 + MODIFIER_AFBC). Possibly more controversial is that (XBGR8888 + MODIFIER_AFBC) is different from (BGR888 + MODIFIER_AFBC). I understand that in some schemes it is not the case - but in AFBC it is so. Where we run into problems is where there are not already fourcc codes which represent the data which the AFBC encoder/decoder is processing. To that end, we want to introduce new fourcc codes to describe the data being encoded/decoded, in the places where none of the existing fourcc codes are applicable. Where we don't support an equivalent non-compressed layout, or where no "obvious" linear layout exists, we are proposing adding fourcc codes which have no associated linear layout - because any layout we proposed would be completely arbitrary. Some formats are following the naming conventions from [2]. The summary of the new formats is: DRM_FORMAT_VUY888 - Packed 8-bit YUV 444. Y followed by U then V. DRM_FORMAT_VUY101010 - Packed 10-bit YUV 444. Y followed by U then V. No defined linear encoding. DRM_FORMAT_Y210 - Packed 10-bit YUV 422. Y followed by U (then Y) then V. 10-bit samples in 16-bit words. DRM_FORMAT_Y410 - Packed 10-bit YUV 444, with 2-bit alpha. DRM_FORMAT_P210 - Semi-planar 10-bit YUV 422. Y plane, followed by interleaved U-then-V plane. 10-bit samples in 16-bit words. DRM_FORMAT_YUV420_8BIT - Packed 8-bit YUV 420. Y followed by U then V. No defined linear encoding DRM_FORMAT_YUV420_10BIT - Packed 10-bit YUV 420. Y followed by U then V. No defined linear encoding Please also note that in the absence of AFBC, we would still need to add Y410, Y210 and P210. Full rationale follows: YUV 444 8-bit, 1-plane ---------------------- The currently defined AYUV format encodes a 4th alpha component, which makes it unsuitable for representing a 3-component YUV 444 AFBC stream. The proposed[1] XYUV format which is supported by Mali-DP in linear layout is also unsuitable, because the component order is the opposite of the AFBC version, and it encodes a 4th 'X' component. DRM_FORMAT_VUY888 is the "obvious" format for a 3-component, packed, YUV 444 8-bit format, with the component order which our HW expects to encode/decode. It conforms to the same naming convention as the existing packed YUV 444 format. The naming here is meant to be consistent with DRM_FORMAT_AYUV and DRM_FORMAT_XYUV[1] YUV 444 10-bit, 1-plane ----------------------- There is no currently-defined YUV 444 10-bit format in drm_fourcc.h, irrespective of number of planes. The proposed[1] XVYU2101010 format which is supported by Mali-DP in linear layout uses the wrong component order, and also encodes a 4th 'X' component, which doesn't match the AFBC version of YUV 444 10-bit which we support. DRM_FORMAT_Y410 is the same layout as XVYU2101010, but with 2 bits of alpha. This format is supported with linear layout by Mali GPUs. The naming follows[2]. There is no "obvious" linear encoding for a 3-component 10:10:10 packed format, and so DRM_FORMAT_VUY101010 defines a component order, but not a bit encoding. Again, the naming is meant to be consistent with DRM_FORMAT_AYUV. YUV 422 8-bit, 1-plane ---------------------- The existing DRM_FORMAT_YUYV (and the other component orders) are single-planar YUV 422 8-bit formats. Following the convention of the component orders of the RGB formats, YUYV has the correct component order for our AFBC encoding (Y followed by U followed by V). We can use YUYV for AFBC YUV 422 8-bit. YUV 422 10-bit, 1-plane ----------------------- There is no currently-defined YUV 422 10-bit format in drm_fourcc.h DRM_FORMAT_Y210 is analogous to YUYV, but with 10-bits per sample packed into the upper 10-bits of 16-bit samples. This format is supported in both linear and AFBC by Mali GPUs. YUV 422 10-bit, 2-plane ----------------------- The recently defined DRM_FORMAT_P010 format is a 10-bit semi-planar YUV 420 format, which has the correct component ordering for an AFBC 2-plane YUV 420 buffer. The linear layout contains meaningless padding bits, which will not be encoded in an AFBC stream. YUV 420 8-bit, 1-plane ---------------------- There is no currently defined single-planar YUV 420, 8-bit format in drm_fourcc.h. There's differing opinions on whether using the existing fourcc-implied n_planes where possible is a good idea or not when using modifiers. For me, it's much more "obvious" to use NV12 for 2-plane AFBC and YUV420 for 3-plane AFBC. This keeps the aforementioned separation between the AFBC codec settings (in the modifier) and the pixel data format (in the fourcc). With different vendors using AFBC, this helps to ensure that there is no confusion in interoperation. It also ensures that the AFBC modifiers describe AFBC itself (which is a licensable component), and not implementation details which are not defined by AFBC. The proposed[1] X0L0 format which Mali-DP supports with Linear layout is unsuitable, as it contains a 4th 'X' component, and our AFBC decoder expects only 3 components. To that end, we propose a new YUV 420 8-bit format. There is no "obvious" linear encoding for a 3-component 8:8:8, 420, packed format, and so DRM_FORMAT_YUV420_8BIT defines a component order, but not a bit encoding. I'm happy to hear different naming suggestions. YUV 420 8-bit, 2-, 3-plane -------------------------- These already exist, we can use NV12 and YUV420. YUV 420 10-bit, 1-plane ----------------------- As above, no current definition exists, and X0L2 encodes a 4th 'X' channel. Analogous to DRM_FORMAT_YUV420_8BIT, we define DRM_FORMAT_YUV420_10BIT. [1] https://lists.freedesktop.org/archives/dri-devel/2018-July/184598.html [2] https://docs.microsoft.com/en-us/windows/desktop/medfound/10-bit-and-16-bit-yuv-video-formats Changes since RFC v1: - Fix confusing subsampling vs bit-depth X:X:X notation in descriptions (danvet) - Rename DRM_FORMAT_AVYU1101010 to DRM_FORMAT_Y410 (Lisa Wu) - Add drm_format_info structures for the new formats, using the new 'bpp' field for those with non-integer bytes-per-pixel - Rebase, including Juha-Pekka Heikkila's format definitions Signed-off-by: Brian Starkey Reviewed-by: Liviu Dudau --- drivers/gpu/drm/drm_fourcc.c | 13 +++++++++++++ include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index 69caa577149c..48afb56d5934 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -224,10 +224,17 @@ const struct drm_format_info *__drm_format_info(u32 format) { .format = DRM_FORMAT_YVYU, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true }, { .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true }, { .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true }, + { .format = DRM_FORMAT_Y210, .depth = 0, .num_planes = 1, + .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true }, + { .format = DRM_FORMAT_VUY888, .depth = 0, .num_planes = 1, + .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true }, + { .format = DRM_FORMAT_Y410, .depth = 0, .num_planes = 1, + .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true }, { .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true }, { .format = DRM_FORMAT_P010, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true }, { .format = DRM_FORMAT_P012, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true }, { .format = DRM_FORMAT_P016, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true }, + { .format = DRM_FORMAT_P210, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true }, { .format = DRM_FORMAT_Y0L0, .depth = 0, .num_planes = 1, .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0}, .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv = true }, @@ -240,6 +247,12 @@ const struct drm_format_info *__drm_format_info(u32 format) { .format = DRM_FORMAT_X0L2, .depth = 0, .num_planes = 1, .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0}, .hsub = 2, .vsub = 2, .is_yuv = true }, + { .format = DRM_FORMAT_VUY101010, .depth = 0, .num_planes = 1, + .cpp = { 0, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true }, + { .format = DRM_FORMAT_YUV420_8BIT, .depth = 0, .num_planes = 1, + .cpp = { 0, 0, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true }, + { .format = DRM_FORMAT_YUV420_10BIT, .depth = 0, .num_planes = 1, + .cpp = { 0, 0, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true }, }; unsigned int i; diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 4de86dbf40ca..f8396d1b8fbd 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -149,8 +149,12 @@ extern "C" { #define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ #define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ #define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ +#define DRM_FORMAT_Y210 fourcc_code('Y', '2', '1', '0') /* [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian */ #define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ +#define DRM_FORMAT_VUY888 fourcc_code('V', 'U', '2', '4') /* [23:0] Cr:Cb:Y 8:8:8 little endian */ +#define DRM_FORMAT_Y410 fourcc_code('Y', '4', '1', '0') /* [31:0] A:Cr:Y:Cb 2:10:10:10 little endian */ +#define DRM_FORMAT_VUY101010 fourcc_code('V', 'U', '3', '0') /* Y followed by U then V, 10:10:10. Non-linear modifier only */ /* * packed YCbCr420 2x2 tiled formats @@ -166,6 +170,15 @@ extern "C" { /* [63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian */ #define DRM_FORMAT_X0L2 fourcc_code('X', '0', 'L', '2') +/* + * 1-plane YUV 4:2:0 + * In these formats, the component ordering is specified (Y, followed by U + * then V), but the exact Linear layout is undefined. + * These formats can only be used with a non-Linear modifier. + */ +#define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8') +#define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0') + /* * 2 plane RGB + A * index 0 = RGB plane, same format as the corresponding non _A8 format has @@ -200,6 +213,7 @@ extern "C" { * component xxx msb Y [xxx:16-xxx] * index 1 = Cr:Cb plane, [31:0] Cr:Cb little endian [xxx:16-xxx:xxx:16-xxx] */ +#define DRM_FORMAT_P210 fourcc_code('P', '2', '1', '0') /* 2x1 subsampled Cr:Cb plane, 10 bit per channel */ #define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cr:Cb plane, 10 bit per channel */ #define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cr:Cb plane, 12 bit per channel */ #define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane, 16 bit per channel */ From patchwork Fri Oct 12 16:35:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10638863 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 708B7157A for ; Fri, 12 Oct 2018 16:36:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C52E2BEEE for ; Fri, 12 Oct 2018 16:36:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 503502BF8D; Fri, 12 Oct 2018 16:36:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A37E32BF39 for ; Fri, 12 Oct 2018 16:36:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B5CC96E4CE; Fri, 12 Oct 2018 16:36:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on062b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::62b]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB0E66E4CC for ; Fri, 12 Oct 2018 16:36:32 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Fri, 12 Oct 2018 16:36:31 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, ayan.halder@arm.com, daniel.vetter@ffwll.ch, raymond.smith@arm.com, david.garbett@arm.com, lisa.wu@arm.com, matt.szczesiak@arm.com, charles.xu@arm.com, james.qian.wang@arm.com Subject: [PATCH v4 7/9] drm/afbc: Add AFBC modifier usage documentation Date: Fri, 12 Oct 2018 17:35:58 +0100 Message-Id: <20181012163600.20331-8-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> References: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: CWLP265CA0200.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::20) To AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c8711db-8725-4aad-4428-08d63060ddfc X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2545; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 3:j6trgE8Epm9SNLpUc2n5GEgTvN5XPVdYGxL3/Wjm+TlQLRDHyOTfHhmShv9q1r2kGWcBN2ykaa+fl46mISnRlyvdzcwSFdPW3bHr+K/8Lo95NsS/OdtPr+fxS5ALtAK2/2qlbMC+6x3hixIP2YaHQmRI9qntEbFmvgRQGmtdJ/QbONkf0REM6zVVi9ZG2BIa9sntNWs+eXitvgQhc1/8jxhC4E7JReb+HpjlTohQHhBXNqE6XsTsgVUIYB9kIuMd; 25:/RYvtY7XhcpEfkc1UFri1kWtA5yI3nJZJAZYnk2Vpzw4EAG3UX++twtwvCMseiO/erAiTQFzQeY0UHxL7y0SlC2iaeCaWtsiingxOsPE1GgEzG28u/IEFSzYxRhR0QwCJyNJHwP4cmnx40BYjbIyBJR4CogBRDopoLuofk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L2NKlgMCMimHKH5IeQCH/QR2+YWryy8TIKbx4WQgwjOyblRDH+nKukx7+mzT6t3y4MZV+h+w941YFZJBUV3W1ICAtTHTb79GIS2QxoDGyTAfFDea85zyURa85Caes6PgJzRVAG4sAoNrI9ml10D5A+f7kbnajcwvhXkYygQUIzts97NqqYLw5PdVANS+l X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:AM5PR0802MB2545; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2545; X-Forefront-PRVS: 0823A5777B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(366004)(199004)(189003)(25786009)(4326008)(81156014)(72206003)(106356001)(105586002)(81166006)(478600001)(5660300001)(47776003)(97736004)(26005)(8936002)(50226002)(66066001)(476003)(16526019)(6486002)(186003)(2906002)(8676002)(316002)(16586007)(7696005)(50466002)(956004)(2616005)(486006)(6666004)(7736002)(305945005)(52116002)(48376002)(68736007)(76176011)(51416003)(86362001)(36756003)(53936002)(386003)(446003)(1076002)(3846002)(6116002)(11346002)(14444005)(6636002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2545; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2545; 23:iPlSwF+ESukXYE9bghsKwf0JdWFcZVu5KmDwQ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M8tO+AZ4xLnp46jbRNTA4t3NLtRJYCWM6iRMThcQg5CWvMvDxKBY5kH12r5vtTlE+qkLhZz0x8Q19yLkJ9+3wCLeFjR3WmT+t2dofQUxbfojSHAX0eFM/li/BjqOaD47T91MtKQGPM94L+Uz4ZvgYspFlMn8=; 7:PTuv1TftBzqRlAO1MWE8O0ZFHC3JtQxDaoqpYAq2jipcMtudnskGRsAtJc3hBu7P0yEP+CQ4r2RtZ6kIoK5prTzVoI2FCZZUNku3nh8kAZUbMXfFuAk4CRxKkgFPBC6A/us1SyTXebtzgq3wb5HoB/SboF9eKBEwquBuc+iDX/CwCw/O7PnN6jpWZP5rYsC6YSuPMhC5/X+d5CbMU32pkPlGEWkiMArh2gYg9j1KXQY+ZCHExs//zdpAiKt1wdRr SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2018 16:36:31.5532 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c8711db-8725-4aad-4428-08d63060ddfc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2545 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Brian Starkey AFBC is a flexible, proprietary, lossless compression protocol and format, with a number of defined DRM format modifiers. To facilitate consistency and compatibility between different AFBC producers and consumers, document the expectations for usage of the AFBC DRM format modifiers in a new .rst chapter. Signed-off-by: Brian Starkey Reviewed-by: Liviu Dudau --- Documentation/gpu/afbc.rst | 233 ++++++++++++++++++++++++++++++++++ Documentation/gpu/drivers.rst | 1 + MAINTAINERS | 1 + include/uapi/drm/drm_fourcc.h | 3 + 4 files changed, 238 insertions(+) create mode 100644 Documentation/gpu/afbc.rst diff --git a/Documentation/gpu/afbc.rst b/Documentation/gpu/afbc.rst new file mode 100644 index 000000000000..922d955da192 --- /dev/null +++ b/Documentation/gpu/afbc.rst @@ -0,0 +1,233 @@ +=================================== + Arm Framebuffer Compression (AFBC) +=================================== + +AFBC is a proprietary lossless image compression protocol and format. +It provides fine-grained random access and minimizes the amount of +data transferred between IP blocks. + +AFBC can be enabled on drivers which support it via use of the AFBC +format modifiers defined in drm_fourcc.h. See DRM_FORMAT_MOD_ARM_AFBC(*). + +All users of the AFBC modifiers must follow the usage guidelines laid +out in this document, to ensure compatibility across different AFBC +producers and consumers. + +Components and Ordering +======================= + +AFBC streams can contain several components - where a component +corresponds to a color channel (i.e. R, G, B, X, A, Y, Cb, Cr). +The assignment of input/output color channels must be consistent +between the encoder and the decoder for correct operation, otherwise +the consumer will interpret the decoded data incorrectly. + +Furthermore, when the lossless colorspace transform is used +(AFBC_FORMAT_MOD_YTR, which should be enabled for RGB buffers for +maximum compression efficiency), the component order must be: + + * Component 0: R + * Component 1: G + * Component 2: B + +The component ordering is communicated via the fourcc code in the +fourcc:modifier pair. In general, component '0' is considered to +reside in the least-significant bits of the corresponding linear +format. For example, COMP(bits): + + * DRM_FORMAT_ABGR8888 + + * Component 0: R(8) + * Component 1: G(8) + * Component 2: B(8) + * Component 3: A(8) + + * DRM_FORMAT_BGR888 + + * Component 0: R(8) + * Component 1: G(8) + * Component 2: B(8) + + * DRM_FORMAT_YUYV + + * Component 0: Y(8) + * Component 1: Cb(8, 2x1 subsampled) + * Component 2: Cr(8, 2x1 subsampled) + +In AFBC, 'X' components are not treated any differently from any other +component. Therefore, an AFBC buffer with fourcc DRM_FORMAT_XBGR8888 +encodes with 4 components, like so: + + * DRM_FORMAT_XBGR8888 + + * Component 0: R(8) + * Component 1: G(8) + * Component 2: B(8) + * Component 3: X(8) + +Please note, however, that the inclusion of a "wasted" 'X' channel is +bad for compression efficiency, and so it's recommended to avoid +formats containing 'X' bits. If a fourth component is +required/expected by the encoder/decoder, then it is recommended to +instead use an equivalent format with alpha, setting all alpha bits to +'1'. If there is no requirement for a fourth component, then a format +which doesn't include alpha can be used, e.g. DRM_FORMAT_BGR888. + +Number of Planes +================ + +Formats which are typically multi-planar in linear layouts (e.g. YUV +420), can be encoded into one, or multiple, AFBC planes. As with +component order, the encoder and decoder must agree about the number +of planes in order to correctly decode the buffer. The fourcc code is +used to determine the number of encoded planes in an AFBC buffer, +matching the number of planes for the linear (unmodified) format. +Within each plane, the component ordering also follows the fourcc +code: + +For example: + + * DRM_FORMAT_YUYV: nplanes = 1 + + * Plane 0: + + * Component 0: Y(8) + * Component 1: Cb(8, 2x1 subsampled) + * Component 2: Cr(8, 2x1 subsampled) + + * DRM_FORMAT_NV12: nplanes = 2 + + * Plane 0: + + * Component 0: Y(8) + + * Plane 1: + + * Component 0: Cb(8, 2x1 subsampled) + * Component 1: Cr(8, 2x1 subsampled) + +Cross-device interoperability +============================= + +For maximum compatibility across devices, the table below defines +canonical formats for use between AFBC-enabled devices. Formats which +are listed here must be used exactly as specified when using the AFBC +modifiers. Formats which are not listed should be avoided. + +.. flat-table:: AFBC formats + + * - Fourcc code + - Description + - Planes/Components + + * - DRM_FORMAT_ABGR2101010 + - 10-bit per component RGB, with 2-bit alpha + - Plane 0: 4 components + * Component 0: R(10) + * Component 1: G(10) + * Component 2: B(10) + * Component 3: A(2) + + * - DRM_FORMAT_ABGR8888 + - 8-bit per component RGB, with 8-bit alpha + - Plane 0: 4 components + * Component 0: R(8) + * Component 1: G(8) + * Component 2: B(8) + * Component 3: A(8) + + * - DRM_FORMAT_BGR888 + - 8-bit per component RGB + - Plane 0: 3 components + * Component 0: R(8) + * Component 1: G(8) + * Component 2: B(8) + + * - DRM_FORMAT_BGR565 + - 5/6-bit per component RGB + - Plane 0: 3 components + * Component 0: R(5) + * Component 1: G(6) + * Component 2: B(5) + + * - DRM_FORMAT_ABGR1555 + - 5-bit per component RGB, with 1-bit alpha + - Plane 0: 4 components + * Component 0: R(5) + * Component 1: G(5) + * Component 2: B(5) + * Component 3: A(1) + + * - DRM_FORMAT_VUY888 + - 8-bit per component YCbCr 444, single plane + - Plane 0: 3 components + * Component 0: Y(8) + * Component 1: Cb(8) + * Component 2: Cr(8) + + * - DRM_FORMAT_VUY101010 + - 10-bit per component YCbCr 444, single plane + - Plane 0: 3 components + * Component 0: Y(10) + * Component 1: Cb(10) + * Component 2: Cr(10) + + * - DRM_FORMAT_YUYV + - 8-bit per component YCbCr 422, single plane + - Plane 0: 3 components + * Component 0: Y(8) + * Component 1: Cb(8, 2x1 subsampled) + * Component 2: Cr(8, 2x1 subsampled) + + * - DRM_FORMAT_NV16 + - 8-bit per component YCbCr 422, two plane + - Plane 0: 1 component + * Component 0: Y(8) + Plane 1: 2 components + * Component 0: Cb(8, 2x1 subsampled) + * Component 1: Cr(8, 2x1 subsampled) + + * - DRM_FORMAT_Y210 + - 10-bit per component YCbCr 422, single plane + - Plane 0: 3 components + * Component 0: Y(10) + * Component 1: Cb(10, 2x1 subsampled) + * Component 2: Cr(10, 2x1 subsampled) + + * - DRM_FORMAT_P210 + - 10-bit per component YCbCr 422, two plane + - Plane 0: 1 component + * Component 0: Y(10) + Plane 1: 2 components + * Component 0: Cb(10, 2x1 subsampled) + * Component 1: Cr(10, 2x1 subsampled) + + * - DRM_FORMAT_YUV420_8BIT + - 8-bit per component YCbCr 420, single plane + - Plane 0: 3 components + * Component 0: Y(8) + * Component 1: Cb(8, 2x2 subsampled) + * Component 2: Cr(8, 2x2 subsampled) + + * - DRM_FORMAT_YUV420_10BIT + - 10-bit per component YCbCr 420, single plane + - Plane 0: 3 components + * Component 0: Y(10) + * Component 1: Cb(10, 2x2 subsampled) + * Component 2: Cr(10, 2x2 subsampled) + + * - DRM_FORMAT_NV12 + - 8-bit per component YCbCr 420, two plane + - Plane 0: 1 component + * Component 0: Y(8) + Plane 1: 2 components + * Component 0: Cb(8, 2x2 subsampled) + * Component 1: Cr(8, 2x2 subsampled) + + * - DRM_FORMAT_P010 + - 10-bit per component YCbCr 420, two plane + - Plane 0: 1 component + * Component 0: Y(10) + Plane 1: 2 components + * Component 0: Cb(10, 2x2 subsampled) + * Component 1: Cr(10, 2x2 subsampled) diff --git a/Documentation/gpu/drivers.rst b/Documentation/gpu/drivers.rst index 7d2d3875ff1a..8ec755024390 100644 --- a/Documentation/gpu/drivers.rst +++ b/Documentation/gpu/drivers.rst @@ -16,6 +16,7 @@ GPU Driver Documentation vkms bridge/dw-hdmi xen-front + afbc .. only:: subproject and html diff --git a/MAINTAINERS b/MAINTAINERS index 39c3f6682ace..4d3a8822b4c5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1091,6 +1091,7 @@ M: Mali DP Maintainers S: Supported F: drivers/gpu/drm/arm/ F: Documentation/devicetree/bindings/display/arm,malidp.txt +F: Documentation/gpu/afbc.rst ARM MFM AND FLOPPY DRIVERS M: Ian Molton diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index f8396d1b8fbd..b2fb2d53fff7 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -586,6 +586,9 @@ extern "C" { * AFBC has several features which may be supported and/or used, which are * represented using bits in the modifier. Not all combinations are valid, * and different devices or use-cases may support different combinations. + * + * Further information on the use of AFBC modifiers can be found in + * Documentation/gpu/afbc.rst */ #define DRM_FORMAT_MOD_ARM_AFBC(__afbc_mode) fourcc_mod_code(ARM, __afbc_mode) From patchwork Fri Oct 12 16:35:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10638869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0FA90157A for ; Fri, 12 Oct 2018 16:37:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F02742BFCB for ; Fri, 12 Oct 2018 16:37:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E09A52C197; Fri, 12 Oct 2018 16:37:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 94D9B2BFCB for ; Fri, 12 Oct 2018 16:37:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5F2356E035; Fri, 12 Oct 2018 16:36:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on062b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::62b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 38AC76E4CF for ; Fri, 12 Oct 2018 16:36:36 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Fri, 12 Oct 2018 16:36:32 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, ayan.halder@arm.com, daniel.vetter@ffwll.ch, raymond.smith@arm.com, david.garbett@arm.com, lisa.wu@arm.com, matt.szczesiak@arm.com, charles.xu@arm.com, james.qian.wang@arm.com Subject: [PATCH v4 8/9] drm/selftests: Add module_exit for test-drm-helper Date: Fri, 12 Oct 2018 17:35:59 +0100 Message-Id: <20181012163600.20331-9-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> References: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: CWLP265CA0200.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::20) To AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14062279-4fe8-44fd-fe77-08d63060debc X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2545; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 3:KRp1B2jiVW2rPMFLLxfn7CUODy2PITKaDDp/m4fklWQYAb6OxMKtoaC1ojkL65mtEAzupO9zXjQz4PvK1kbFzJ6Q015b2BYQ/9U+0XsRD6wWiMFqg9yEbkjYImmGehsqIoLaSqDsAwrP0pgTniNIdkCGzFBDIhOUt72Cg0CZYZ68NVC6t+Rde3hiUfCwMOoBKi4vgJPSyGntU/8QUGJJSdys++QYvPSuNAN3jUT+bmvG05Xclq0xsjqCXQ+w/waK; 25:vVFtiN/577N66qz1FnTzQrQnNIxIcEB/43DzKxcIlP+hSH6JBGmGSUHLX25uvlAJYj6TaKeWr7w1fXFk+pTxE0fC8YLHr4wTeqZ+8I+bY7EnbEZO5tafPoZrmeeC1mgLv4GNOUXPgotlwAdOszF9nZmxOlJwzwZiQeJhNbh2rbR5lPvMaPwxVRsZzAKYLy6ae5BCehSC4CHDwO1NqaO6kdlPjrVm4PD1kPw42CKfka63y/gwszPibovP7W7YnuOXGmJxmmfYSw73Q7pgA4Hr3SByljESYlFfjl6yPrmqk5gHBaWOZcIqqjLsr87QGysXaaliHz7zLrrTwSzcMmLy2g==; 31:PfsODfa38k8ngjvtjacamKI8V6shiUXbkTtmlP4WDK2W9tALEGOEyNwk+IRFODFeSXbedJwZ8AE9lkTH7OPEropzAV/gDkcdgTRNbJJFOV/6RyIdphnE6XoXr/xXfJNF1SFN2Myl+zF5mWYa16NPZDf10+YfM3WjIrAWnTepjsU3HMt1Jy0RweM8PZlPZYd26rjvihJP71Le4PxhCD4cG2R100cnM0OC3BCM8ORbGG8= X-MS-TrafficTypeDiagnostic: AM5PR0802MB2545: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 20:+atnhFGHHCTO6ZcaQxtNjET/IEZS8qJSQMaft47WRORZdzS4r79IldGWkeu5drGu5bbgahzYNLAxxM7cHzIlLt3VgmivmO21UU+cIa2gsuKILUebapsTCUrghvVPD3PPZWFzSHNi8XF7/7LIbQuFxBxSBR0dLUnyCj0sj8PfhDxm4IVo3Ur2J+Cmk4QdijkvBg3cY3uJIn2QwQgmVzwxuZ3FtBarHPFC19bSI+SzaQpSer3PK2aFuQZpBvcDa1eRbcuiu7NAXXzlWu4h4t/slZYX9WOD4NS4Y2157Gi3EucyNexXtnxftcb4y5vcjeTpN7kI0hpMwBUZDngxE2/EW3lEbBorcjvOZ8p6Cz6y5hEIkI8++jtF+Y+s0+PjlMlMakkc11BsEIkyuarMWCk2ktEjZhbtA022Dxgr+TBlwjc=; 4:mt9pADFY3g4tpQiOeaUVQ+r0bA8NtsSodc8F/qenF/Owvbly6O0QDiUTY9PeEkMmPnx7leu7YQlEGZXhZ1W7xZC7I3Uja+lbLjOSLXC+34mwJFzlqH6MB7+BdSzl9zKt1FR2hNdP4gnl4Hn78ahuEc4gUkpdQ+Ce1/Zu/8GT7lVugqJOSRAEauYmktbMG9h0WmwEGwmlPb/covKIBbrPI0PyPX21+fLYG3jdRBBP2xlFhcqwVtBzjaPIo1l1eJTqw8l2jCSYGfuOi+I3vAHsFEVcvU6odndS4F5Q4H0I1RN1k6HjcTYAD2rFgYbvOWec X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:AM5PR0802MB2545; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2545; X-Forefront-PRVS: 0823A5777B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(366004)(199004)(189003)(25786009)(4326008)(81156014)(72206003)(106356001)(105586002)(81166006)(478600001)(5660300001)(47776003)(97736004)(26005)(8936002)(50226002)(66066001)(476003)(16526019)(6486002)(186003)(2906002)(8676002)(316002)(16586007)(7696005)(50466002)(956004)(2616005)(486006)(6666004)(7736002)(305945005)(52116002)(48376002)(68736007)(76176011)(51416003)(86362001)(36756003)(53936002)(386003)(446003)(1076002)(3846002)(6116002)(11346002)(6636002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2545; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2545; 23:A9ysw0q1S3HHTb4RCmQgTkNj53lu4rs2GHDHoTu?= nbkkmALIYDsvoGTTXxmVqXjbxg1MuglxWBWkpJkDJewFHt4z1fB5IgAJ2CZQKZtb83+os6C53lXUWvv3M8omh0KxT1EANjI91HUSTe5YRvuhLhcbu3CXl2tYVD4dNeHhV+PNjaY9twFbJikK5P7D4f5EK1N8IHXgGAv6N+9t02pGaxsbxVo2i1ayrsVPHKIpIA6wWxgtD59UOkyk+u0QRzzBv8uRuUMXLncC4n5BTiuxC9PfTXOiUfonvRoZhCeX5FYfq9JeZdfmsV4CMmSHrYu9W15PRnK11ubSw/1sAiUMtULc0Jv610iF4BeBg7TSGa3snxv9HKDgdR7slRakxYdddHN0I5pHntHL0XL5VutghoIt1UU94wJhdIXmerLMX6Cki5bJC/pXGZ35lwx9tNVnF3LrSYJUD1SJjfaFbmNSZoTMwMrBPPH8XLU4vb2ocjUAW4L2v/WZEXSzxkuI1kCEe6BR3wK7qbSd3Xcn79r+LgWi29+uUeMEvynoTlOviNT1XxGuttlPad5hHF2mOIeVp3PQygRFoB9H0QwDbuXMVRZI0w9eFKqhbHrrxcFeHj9IMk00I1ikXPSJjMeMsxvD52dmC2DXV0RcsdpQIUEdziuylzHiF2Z4+J7+Fxdy52JUjuHcaVxgdjBVnh8b2T3CzjISoYy8t4n6qZ1cXuSHT1QuYiGVlAaV/P6Sn9A2cVWu9ucC5NsxCLtHPxK96eRvTyM9W/PrlbZhkfW7Bh68sEtBDBWTKdLP0CFAfTvqTEWTxJ3qeD98UERge79NPR5abi918RsrvhRtH49Mz4jeyPpD8pOLlpv0dJgF78+yvzjxNunVYIJ+bUR/WN5qxVP5OcczOubdXUzKRueTzr/79xrc6NCDw3EPaGHFnlJIrgySxTvWi18r4HyL9QRgJewn1nZwuDp0AZKie5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HuH0hjZ70cO/UJxsj+P0Vra+JeU+dP9GOLT1D+usYNO/8NVzBGccGFoFSJ/sNbKmKdis/siH0FRNEYGNoFU/fowVGn8Ww==; 5:e4w/MUXq2V9MqK8pPs6TIpBwbzpHUtlUURdMGSlzDUAYc9bVpAKQWp0mlPtfHANUAJVlmVMgLI4zPk8TpUC50x1n5WBh7knCZSgNt/OSRAdC+rZBdjGPFmp8f634nOEAPt0MuBHpufEP8YalLbuhWolt9yt+kXYFTwMa+BZNgWw=; 7:dzAu0SwFmhjGubYCjSxQJzS9PHyOc19v+/O/wSF8FIjIpbBU5F9KF/YK4S6dF8EPZeN+/hrpzXqjiMcaoUJBhrcRGQ2JOHhf3qax5NVjaeiKhz5RBGcwVaHVNHHxbOKMmq3W4A9R98PQX+7bk/RZeVeyza/h6lEtd0PlC/s6MQRQLu0RiumutCz2xAOcCiXcBXKX68t2740V3ytOpX3dQ/8ub4bB45B28PAkKbXW5w9cUDs2X3pqUgRfDbXTUNpc SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2018 16:36:32.7992 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 14062279-4fe8-44fd-fe77-08d63060debc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2545 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP test-drm-helper.ko can't be rmmod-ed because it doesn't have a module_exit, that could be very inconvenient especially in the development stage where we usually want to re-run the tests without any rebooting. Signed-off-by: Alexandru Gheorghe --- drivers/gpu/drm/selftests/test-drm-helper.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/selftests/test-drm-helper.c b/drivers/gpu/drm/selftests/test-drm-helper.c index a015712b43e8..a6a1818fdafd 100644 --- a/drivers/gpu/drm/selftests/test-drm-helper.c +++ b/drivers/gpu/drm/selftests/test-drm-helper.c @@ -241,7 +241,12 @@ static int __init test_drm_helper_init(void) return err > 0 ? 0 : err; } +static void __exit test_drm_helper_exit(void) +{ +} + module_init(test_drm_helper_init); +module_exit(test_drm_helper_exit); MODULE_AUTHOR("Intel Corporation"); MODULE_LICENSE("GPL"); From patchwork Fri Oct 12 16:36:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10638867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A737A933 for ; Fri, 12 Oct 2018 16:37:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95EC12BF8D for ; Fri, 12 Oct 2018 16:37:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89E6B2C0C0; Fri, 12 Oct 2018 16:37:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B18462BF8D for ; Fri, 12 Oct 2018 16:37:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 022F06E4D4; Fri, 12 Oct 2018 16:36:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on062b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::62b]) by gabe.freedesktop.org (Postfix) with ESMTPS id E0CD96E4D3 for ; Fri, 12 Oct 2018 16:36:36 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Fri, 12 Oct 2018 16:36:34 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, ayan.halder@arm.com, daniel.vetter@ffwll.ch, raymond.smith@arm.com, david.garbett@arm.com, lisa.wu@arm.com, matt.szczesiak@arm.com, charles.xu@arm.com, james.qian.wang@arm.com Subject: [PATCH v4 9/9] drm/selftests: Add tests for drm_format_info* helpers Date: Fri, 12 Oct 2018 17:36:00 +0100 Message-Id: <20181012163600.20331-10-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> References: <20181012163600.20331-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: CWLP265CA0200.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::20) To AM5PR0802MB2545.eurprd08.prod.outlook.com (2603:10a6:203:a0::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c36f5fa0-c0ee-4b4c-0317-08d63060df80 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2545; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 3:Q18gs/MRlgB1qUIu1Gz5f3zLNzYE/pyv1MYMzWKJG27oCvFpzzj2CLy4D3phF4wMee/d3Ii1LBvweBAMq1ct2UcyHFhZ8+0wlDHCI6Z0lq6B7Kv6UUQqdIpwyzy2iszdT6DtyjLdQ5HTJLBiGWXAEff0ji2W1A169uU1ML/gD+KOhBp9Slxr0d9Q9LBBIgpyMtSDSsm/E8P0u1tC+XllURX7O/CsgfXwTWq9fu1wrcMn65zQKQq1/uS6q/k6RPRC; 25:cIW/KyC6bqxz7NOuA+wLgeKtEfuSQy9gX0ZHfR77JB2F5SsfECO01497XthM4vZe62XVxWWjCZ4eoAnff+usBtzBL5xZbbkQ/59ncjnt4u3qZL9IqcbXaDwqqiAeL0iO2KXMO2Jw5GH/PxXH2+hFQ5b6HDOq4IAXo2NOLktALsHmk71uyPdoG4e2pJAXnAkAXhe4ucLkT7kFT0A7shkxcWyDgIa9UD1/PJIx+kBkNIcT3uyrm4BozRfW33Zc3mc5SvHhDF0NcfoRNfSaFZmlpnDy7ugIwbMLqLjKWvYyMgMfoqdr/b0uWHqQ/WxpLX9U0EsfQzFaz+lsGSNg2U/zkA==; 31:tcKezV55oBxsx7XjL/ZK4/eDZ4M7RihxNyu8DjqyoWUmESaRWYMI81Hvh9h7V4p/lAlw1F5AhnArrBT1oASkBbzNWxB46sJn82kJsaYsO9Did+O9RkaII5wuuSe26StUDTK+zugiz3haVDIXp91lmIaZVDxGWmAb9qYr+rvYLN8eD1FROsi/+Qzc+NJqTycLHonTQSY2hKlkkLlL9kx+2wm2kkx/qXQ79A3wE2pjtKM= X-MS-TrafficTypeDiagnostic: AM5PR0802MB2545: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2545; 20:A5DXseK+5Uzfdr1pNg+igXTMHoqOHBoiJ6jTWDypAP05O9gnz8ADc0s9kEhAK+SUbQKLujAeQx4QqEqtvCehD0IvEouR0tu/027AvyM3fjys89GWqnfrLYdgjD8uxHSXK5KqeIByGOmbTcbPQ/OdX7dvcBCQYoaA47wfCc3/PG7HPTfLyGDzKm/FoxRIuhbK/ZOB860yJg5YnXPTkQ9mLik73mIjCrXvgaOX9CLIiWatdEiBCiCyQ96ZdrLymDErJg1IzDF3REPmj5siTW5DxtwR1//GsceQVr6VdKV22e3XyCkxizXMy3smG5A5hSAislkW9PgPQdBLUB3mM4GHSPcScYK9Bzp+QBtuJXXmDnrftuELQpVkmef5JHysv8t1zsFmPFcLtSuPhrAcG4LAWOSJVAby545/+Wc50zh2Rbk=; 4:kBGyh2yM6BdXstzQRTjkro/rpFu7RILYPFgAcNzqabK8S8QvsaVuBSfxwvQzN2JHLoXxtP+2qR43UBTHq55td3pN5eld5NQJAvJuaRMxCZt9l+c3slcsooo2ms8C223DzC1tEfhhpOjP4nNWrVEr6yYw6U1mDDzpW4i5LnJF1JMPP0tRLrAj4tRHDLVZ4Q8k81Z7n66fQi78dfyVzAEwyZdxWUBiQ0XcGalUA0vBHA+FFQywiaesNPeKYMjEljSUNNvJgHkIXyKSDEOaxjsvzj1wUR1XBFbu8t+6lSE+95HEaIZ2NU2MdR2cUVX2U2rF X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:AM5PR0802MB2545; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2545; X-Forefront-PRVS: 0823A5777B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(366004)(199004)(189003)(25786009)(4326008)(81156014)(72206003)(106356001)(105586002)(81166006)(478600001)(5660300001)(47776003)(97736004)(26005)(8936002)(50226002)(66066001)(476003)(16526019)(6486002)(186003)(2906002)(8676002)(316002)(16586007)(7696005)(50466002)(956004)(2616005)(575784001)(486006)(6666004)(7736002)(305945005)(52116002)(48376002)(4744004)(68736007)(76176011)(51416003)(86362001)(36756003)(53936002)(386003)(446003)(1076002)(3846002)(6116002)(11346002)(14444005)(6636002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2545; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2545; 23:T3jBOZMRfPGWO0TV1gcyi3+BZLkOxukxUYuio/0?= W5Ek0/r5NNNel8qo+85VFexwBJmD0hGb3hxksvsccOs7SUCLg4LLPkLsXFpnuJC8+HNGoH+Dke2maCcoG5IzIhdTZXSy2PWAyPt7r2BosbZvP9MiZRpSdcJxfUJz+kBHFgDGcClzHqAaAH8nZaN29JeNPVaqYjty0afLwudsfnJiZcEzvR5yydzxgJ3DS575a3zwuRGrfv/hQAoWbg/tya9OgfzTP4r76jHnkRS/67ldrL0uY857Hsvm+JtVxr22fuYrPakIjFdOz3ompLiDklSaFNBaPM3CPADA5UOQHKr3v1A7yf5QvvGpJlqaAx2dRRLd7D13ibQy5lYVv6BM4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3CCHq0mdcn+4uvhdXsJVg2muA0ujzwUeDcdcsdHUflv8lAoJK3s5ohq50BYVO6pJzvN3k/J9dOlqE5jhTjcTkJ1 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2018 16:36:34.0773 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c36f5fa0-c0ee-4b4c-0317-08d63060df80 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2545 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add selftests for the following newly added functions: - drm_format_info_block_width - drm_format_info_block_height - drm_format_info_min_pitch Signed-off-by: Alexandru Gheorghe --- .../gpu/drm/selftests/drm_helper_selftests.h | 3 + drivers/gpu/drm/selftests/test-drm-helper.c | 277 ++++++++++++++++++ 2 files changed, 280 insertions(+) diff --git a/drivers/gpu/drm/selftests/drm_helper_selftests.h b/drivers/gpu/drm/selftests/drm_helper_selftests.h index 9771290ed228..4e203ac8c134 100644 --- a/drivers/gpu/drm/selftests/drm_helper_selftests.h +++ b/drivers/gpu/drm/selftests/drm_helper_selftests.h @@ -7,3 +7,6 @@ * Tests are executed in order by igt/drm_selftests_helper */ selftest(check_plane_state, igt_check_plane_state) +selftest(check_drm_format_block_width, igt_check_drm_format_block_width) +selftest(check_drm_format_block_height, igt_check_drm_format_block_height) +selftest(check_drm_format_min_pitch, igt_check_drm_format_min_pitch) diff --git a/drivers/gpu/drm/selftests/test-drm-helper.c b/drivers/gpu/drm/selftests/test-drm-helper.c index a6a1818fdafd..bea77f907d83 100644 --- a/drivers/gpu/drm/selftests/test-drm-helper.c +++ b/drivers/gpu/drm/selftests/test-drm-helper.c @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -230,6 +231,282 @@ static int igt_check_plane_state(void *ignored) return 0; } +static int igt_check_drm_format_block_width(void *ignored) +{ + const struct drm_format_info *info = NULL; + + /* Test invalid arguments */ + FAIL_ON(drm_format_info_block_width(info, 0) != 0); + FAIL_ON(drm_format_info_block_width(info, -1) != 0); + FAIL_ON(drm_format_info_block_width(info, 1) != 0); + + /* Test 1 plane format */ + info = drm_format_info(DRM_FORMAT_XRGB4444); + FAIL_ON(!info); + FAIL_ON(drm_format_info_block_width(info, 0) != 1); + FAIL_ON(drm_format_info_block_width(info, 1) != 0); + FAIL_ON(drm_format_info_block_width(info, -1) != 0); + + /* Test 2 planes format */ + info = drm_format_info(DRM_FORMAT_NV12); + FAIL_ON(!info); + FAIL_ON(drm_format_info_block_width(info, 0) != 1); + FAIL_ON(drm_format_info_block_width(info, 1) != 1); + FAIL_ON(drm_format_info_block_width(info, 2) != 0); + FAIL_ON(drm_format_info_block_width(info, -1) != 0); + + /* Test 3 planes format */ + info = drm_format_info(DRM_FORMAT_YUV422); + FAIL_ON(!info); + FAIL_ON(drm_format_info_block_width(info, 0) != 1); + FAIL_ON(drm_format_info_block_width(info, 1) != 1); + FAIL_ON(drm_format_info_block_width(info, 2) != 1); + FAIL_ON(drm_format_info_block_width(info, 3) != 0); + FAIL_ON(drm_format_info_block_width(info, -1) != 0); + + /* Test a tiled format */ + info = drm_format_info(DRM_FORMAT_X0L0); + FAIL_ON(!info); + FAIL_ON(drm_format_info_block_width(info, 0) != 2); + FAIL_ON(drm_format_info_block_width(info, 1) != 0); + FAIL_ON(drm_format_info_block_width(info, -1) != 0); + + return 0; +} + +static int igt_check_drm_format_block_height(void *ignored) +{ + const struct drm_format_info *info = NULL; + + /* Test invalid arguments */ + FAIL_ON(drm_format_info_block_height(info, 0) != 0); + FAIL_ON(drm_format_info_block_height(info, -1) != 0); + FAIL_ON(drm_format_info_block_height(info, 1) != 0); + + /* Test 1 plane format */ + info = drm_format_info(DRM_FORMAT_XRGB4444); + FAIL_ON(!info); + FAIL_ON(drm_format_info_block_height(info, 0) != 1); + FAIL_ON(drm_format_info_block_height(info, 1) != 0); + FAIL_ON(drm_format_info_block_height(info, -1) != 0); + + /* Test 2 planes format */ + info = drm_format_info(DRM_FORMAT_NV12); + FAIL_ON(!info); + FAIL_ON(drm_format_info_block_height(info, 0) != 1); + FAIL_ON(drm_format_info_block_height(info, 1) != 1); + FAIL_ON(drm_format_info_block_height(info, 2) != 0); + FAIL_ON(drm_format_info_block_height(info, -1) != 0); + + /* Test 3 planes format */ + info = drm_format_info(DRM_FORMAT_YUV422); + FAIL_ON(!info); + FAIL_ON(drm_format_info_block_height(info, 0) != 1); + FAIL_ON(drm_format_info_block_height(info, 1) != 1); + FAIL_ON(drm_format_info_block_height(info, 2) != 1); + FAIL_ON(drm_format_info_block_height(info, 3) != 0); + FAIL_ON(drm_format_info_block_height(info, -1) != 0); + + /* Test a tiled format */ + info = drm_format_info(DRM_FORMAT_X0L0); + FAIL_ON(!info); + FAIL_ON(drm_format_info_block_height(info, 0) != 2); + FAIL_ON(drm_format_info_block_height(info, 1) != 0); + FAIL_ON(drm_format_info_block_height(info, -1) != 0); + + return 0; +} + +static int igt_check_drm_format_min_pitch(void *ignored) +{ + const struct drm_format_info *info = NULL; + + /* Test invalid arguments */ + FAIL_ON(drm_format_info_min_pitch(info, 0, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, -1, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 1, 0) != 0); + + /* Test 1 plane 8 bits per pixel format */ + info = drm_format_info(DRM_FORMAT_RGB332); + FAIL_ON(!info); + FAIL_ON(drm_format_info_min_pitch(info, 0, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, -1, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 1, 0) != 0); + + FAIL_ON(drm_format_info_min_pitch(info, 0, 1) != 1); + FAIL_ON(drm_format_info_min_pitch(info, 0, 2) != 2); + FAIL_ON(drm_format_info_min_pitch(info, 0, 640) != 640); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1024) != 1024); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1920) != 1920); + FAIL_ON(drm_format_info_min_pitch(info, 0, 4096) != 4096); + FAIL_ON(drm_format_info_min_pitch(info, 0, 671) != 671); + FAIL_ON(drm_format_info_min_pitch(info, 0, UINT_MAX) != + (uint64_t)UINT_MAX); + FAIL_ON(drm_format_info_min_pitch(info, 0, (UINT_MAX - 1)) != + (uint64_t)(UINT_MAX - 1)); + + /* Test 1 plane 16 bits per pixel format */ + info = drm_format_info(DRM_FORMAT_XRGB4444); + FAIL_ON(!info); + FAIL_ON(drm_format_info_min_pitch(info, 0, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, -1, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 1, 0) != 0); + + FAIL_ON(drm_format_info_min_pitch(info, 0, 1) != 2); + FAIL_ON(drm_format_info_min_pitch(info, 0, 2) != 4); + FAIL_ON(drm_format_info_min_pitch(info, 0, 640) != 1280); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1024) != 2048); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1920) != 3840); + FAIL_ON(drm_format_info_min_pitch(info, 0, 4096) != 8192); + FAIL_ON(drm_format_info_min_pitch(info, 0, 671) != 1342); + FAIL_ON(drm_format_info_min_pitch(info, 0, UINT_MAX) != + (uint64_t)UINT_MAX * 2); + FAIL_ON(drm_format_info_min_pitch(info, 0, (UINT_MAX - 1)) != + (uint64_t)(UINT_MAX - 1) * 2); + + /* Test 1 plane 24 bits per pixel format */ + info = drm_format_info(DRM_FORMAT_RGB888); + FAIL_ON(!info); + FAIL_ON(drm_format_info_min_pitch(info, 0, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, -1, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 1, 0) != 0); + + FAIL_ON(drm_format_info_min_pitch(info, 0, 1) != 3); + FAIL_ON(drm_format_info_min_pitch(info, 0, 2) != 6); + FAIL_ON(drm_format_info_min_pitch(info, 0, 640) != 1920); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1024) != 3072); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1920) != 5760); + FAIL_ON(drm_format_info_min_pitch(info, 0, 4096) != 12288); + FAIL_ON(drm_format_info_min_pitch(info, 0, 671) != 2013); + FAIL_ON(drm_format_info_min_pitch(info, 0, UINT_MAX) != + (uint64_t)UINT_MAX * 3); + FAIL_ON(drm_format_info_min_pitch(info, 0, UINT_MAX - 1) != + (uint64_t)(UINT_MAX - 1) * 3); + + /* Test 1 plane 32 bits per pixel format */ + info = drm_format_info(DRM_FORMAT_ABGR8888); + FAIL_ON(!info); + FAIL_ON(drm_format_info_min_pitch(info, 0, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, -1, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 1, 0) != 0); + + FAIL_ON(drm_format_info_min_pitch(info, 0, 1) != 4); + FAIL_ON(drm_format_info_min_pitch(info, 0, 2) != 8); + FAIL_ON(drm_format_info_min_pitch(info, 0, 640) != 2560); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1024) != 4096); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1920) != 7680); + FAIL_ON(drm_format_info_min_pitch(info, 0, 4096) != 16384); + FAIL_ON(drm_format_info_min_pitch(info, 0, 671) != 2684); + FAIL_ON(drm_format_info_min_pitch(info, 0, UINT_MAX) != + (uint64_t)UINT_MAX * 4); + FAIL_ON(drm_format_info_min_pitch(info, 0, UINT_MAX - 1) != + (uint64_t)(UINT_MAX - 1) * 4); + + /* Test 2 planes format */ + info = drm_format_info(DRM_FORMAT_NV12); + FAIL_ON(!info); + FAIL_ON(drm_format_info_min_pitch(info, 0, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 1, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, -1, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 2, 0) != 0); + + FAIL_ON(drm_format_info_min_pitch(info, 0, 1) != 1); + FAIL_ON(drm_format_info_min_pitch(info, 1, 1) != 2); + FAIL_ON(drm_format_info_min_pitch(info, 0, 2) != 2); + FAIL_ON(drm_format_info_min_pitch(info, 1, 1) != 2); + FAIL_ON(drm_format_info_min_pitch(info, 0, 640) != 640); + FAIL_ON(drm_format_info_min_pitch(info, 1, 320) != 640); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1024) != 1024); + FAIL_ON(drm_format_info_min_pitch(info, 1, 512) != 1024); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1920) != 1920); + FAIL_ON(drm_format_info_min_pitch(info, 1, 960) != 1920); + FAIL_ON(drm_format_info_min_pitch(info, 0, 4096) != 4096); + FAIL_ON(drm_format_info_min_pitch(info, 1, 2048) != 4096); + FAIL_ON(drm_format_info_min_pitch(info, 0, 671) != 671); + FAIL_ON(drm_format_info_min_pitch(info, 1, 336) != 672); + FAIL_ON(drm_format_info_min_pitch(info, 0, UINT_MAX) != + (uint64_t)UINT_MAX); + FAIL_ON(drm_format_info_min_pitch(info, 1, UINT_MAX / 2 + 1) != + (uint64_t)UINT_MAX + 1); + FAIL_ON(drm_format_info_min_pitch(info, 0, (UINT_MAX - 1)) != + (uint64_t)(UINT_MAX - 1)); + FAIL_ON(drm_format_info_min_pitch(info, 1, (UINT_MAX - 1) / 2) != + (uint64_t)(UINT_MAX - 1)); + + /* Test 3 planes 8 bits per pixel format */ + info = drm_format_info(DRM_FORMAT_YUV422); + FAIL_ON(!info); + FAIL_ON(drm_format_info_min_pitch(info, 0, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 1, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 2, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, -1, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 3, 0) != 0); + + FAIL_ON(drm_format_info_min_pitch(info, 0, 1) != 1); + FAIL_ON(drm_format_info_min_pitch(info, 1, 1) != 1); + FAIL_ON(drm_format_info_min_pitch(info, 2, 1) != 1); + FAIL_ON(drm_format_info_min_pitch(info, 0, 2) != 2); + FAIL_ON(drm_format_info_min_pitch(info, 1, 2) != 2); + FAIL_ON(drm_format_info_min_pitch(info, 2, 2) != 2); + FAIL_ON(drm_format_info_min_pitch(info, 0, 640) != 640); + FAIL_ON(drm_format_info_min_pitch(info, 1, 320) != 320); + FAIL_ON(drm_format_info_min_pitch(info, 2, 320) != 320); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1024) != 1024); + FAIL_ON(drm_format_info_min_pitch(info, 1, 512) != 512); + FAIL_ON(drm_format_info_min_pitch(info, 2, 512) != 512); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1920) != 1920); + FAIL_ON(drm_format_info_min_pitch(info, 1, 960) != 960); + FAIL_ON(drm_format_info_min_pitch(info, 2, 960) != 960); + FAIL_ON(drm_format_info_min_pitch(info, 0, 4096) != 4096); + FAIL_ON(drm_format_info_min_pitch(info, 1, 2048) != 2048); + FAIL_ON(drm_format_info_min_pitch(info, 2, 2048) != 2048); + FAIL_ON(drm_format_info_min_pitch(info, 0, 671) != 671); + FAIL_ON(drm_format_info_min_pitch(info, 1, 336) != 336); + FAIL_ON(drm_format_info_min_pitch(info, 2, 336) != 336); + FAIL_ON(drm_format_info_min_pitch(info, 0, UINT_MAX) != + (uint64_t)UINT_MAX); + FAIL_ON(drm_format_info_min_pitch(info, 1, UINT_MAX / 2 + 1) != + (uint64_t)UINT_MAX / 2 + 1); + FAIL_ON(drm_format_info_min_pitch(info, 2, UINT_MAX / 2 + 1) != + (uint64_t)UINT_MAX / 2 + 1); + FAIL_ON(drm_format_info_min_pitch(info, 0, (UINT_MAX - 1) / 2) != + (uint64_t)(UINT_MAX - 1) / 2); + FAIL_ON(drm_format_info_min_pitch(info, 1, (UINT_MAX - 1) / 2) != + (uint64_t)(UINT_MAX - 1) / 2); + FAIL_ON(drm_format_info_min_pitch(info, 2, (UINT_MAX - 1) / 2) != + (uint64_t)(UINT_MAX - 1) / 2); + + /* Test tiled format */ + info = drm_format_info(DRM_FORMAT_X0L2); + FAIL_ON(!info); + FAIL_ON(drm_format_info_min_pitch(info, 0, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, -1, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 1, 0) != 0); + + FAIL_ON(drm_format_info_min_pitch(info, 0, 1) != 2); + FAIL_ON(drm_format_info_min_pitch(info, 0, 2) != 4); + FAIL_ON(drm_format_info_min_pitch(info, 0, 640) != 1280); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1024) != 2048); + FAIL_ON(drm_format_info_min_pitch(info, 0, 1920) != 3840); + FAIL_ON(drm_format_info_min_pitch(info, 0, 4096) != 8192); + FAIL_ON(drm_format_info_min_pitch(info, 0, 671) != 1342); + FAIL_ON(drm_format_info_min_pitch(info, 0, UINT_MAX) != + (uint64_t)UINT_MAX * 2); + FAIL_ON(drm_format_info_min_pitch(info, 0, UINT_MAX - 1) != + (uint64_t)(UINT_MAX - 1) * 2); + + /* Test format with cpp/char_per_block 0 */ + info = drm_format_info(DRM_FORMAT_VUY101010); + FAIL_ON(!info); + FAIL_ON(drm_format_info_min_pitch(info, 0, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, -1, 0) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 1, 0) != 0); + + FAIL_ON(drm_format_info_min_pitch(info, 0, 1) != 0); + FAIL_ON(drm_format_info_min_pitch(info, 0, UINT_MAX) != 0); + + return 0; +} #include "drm_selftest.c" static int __init test_drm_helper_init(void)