From patchwork Fri Oct 19 10:57:44 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: 10649003 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 19722112B for ; Fri, 19 Oct 2018 10:58:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0810A28938 for ; Fri, 19 Oct 2018 10:58:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0872289D2; Fri, 19 Oct 2018 10:58:38 +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 9164B289CF for ; Fri, 19 Oct 2018 10:58:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A7D376E352; Fri, 19 Oct 2018 10:58:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::626]) by gabe.freedesktop.org (Postfix) with ESMTPS id AAD9C6E343 for ; Fri, 19 Oct 2018 10:58:35 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Fri, 19 Oct 2018 10:58:33 +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, maxime.ripard@bootlin.com, 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 v5 1/9] drm: fourcc: Convert drm_format_info kerneldoc to in-line member documentation Date: Fri, 19 Oct 2018 11:57:44 +0100 Message-Id: <20181019105752.17741-2-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> References: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO2P265CA0387.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::15) To AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8dd7f1f9-a62c-4033-5a09-08d635b1d00d X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2546; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 3:in59YvR/zZuKXTlqCupb1uoZuMht7V+tkIApI6pET/Y3oVQ19g5W3YcoTSsdOFjTlWTgoEG8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/bZCyUD9AcVjhio0MbnAu807u7nU8q2wqQaJ3pFXmrFsHhqttOcVXOcIT+ULDTG+rqdVwdLFGUT9cD73oRlmelNgpuba5GEJ8W5eWEBjcTfIPc/ImFFGCQZI4xit61+4r7nGEwbYdrHYtL6aJyeRKdRVVoRwp5IBAjzKpDdiMQfFX19Q0B0I0zd81FoYPGGoMH4SxA8vA4e+BudsfGgltL4FHnwU3sm4E=; 4:AnQyX+EyB6MIsBRwplTeBAbNOyuvRgAcZ5+klkUFaJIp4TSILYE9IL6+b7JmLeadHacTSxcxV2fUndbFjjntWOxf2UppmtK9fi6dLXsnXSStbpBNDEfOod8kDOdkbnh2fzs5v0eEpCpJepTMzke2oK4WHWnRNs2BvgRiBGEZpE465lTlcwE5JKccTAKzv6t1h66vNWzplDDs5qurc1c3p3ViiXzjlXJI/j7PBHe2BzWYDmNDapYi3+JnXjBNAuwlm5UHX2IZDWd4aaGermfQ9+D3wnEPS5bczAvkdBpIPjFMM32pJ5j0NLFNQpMTbBeQ4Zx2Olb6qUbULftFFPuQCOpSfeIBLHfok4ZnCtWtr0Q= 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)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM5PR0802MB2546; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2546; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(136003)(346002)(396003)(199004)(189003)(6636002)(11346002)(105586002)(81156014)(81166006)(50226002)(6306002)(106356001)(4326008)(97736004)(3846002)(476003)(25786009)(6116002)(16586007)(8676002)(53936002)(50466002)(486006)(1076002)(8936002)(316002)(2616005)(956004)(966005)(16526019)(48376002)(36756003)(26005)(478600001)(6486002)(386003)(7696005)(186003)(52116002)(51416003)(68736007)(446003)(5660300001)(305945005)(72206003)(76176011)(7736002)(2906002)(86362001)(66066001)(47776003)(6666004)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2546; 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; AM5PR0802MB2546; 23:/GyP1vdGT6M+bE3/jmcfP3CeSZkceUT2tvn0BVj?= /9tGJko7IRJfVxNMKlwe1WySrRZglZubjyzW5BNU3Rz2dPRGBCZ5MvroY+pQH30elOKw8daJWD5WOF04r7bZD2UguBrRwBedy4cjpBj0vL6pqGK/3zPrhAMM81tMJYlrcxxRQut7uLmViCBRsLpOnm8F0ojLKyuervy7wHki5hLMGiJ0BfN/KzDXkcNbpas/TYYdf7q5RKhBH7aXtzShstHDnnUp+HSW5f8PH3Ugg8hB68T2qufE7Z1DsmA87JW6tGFnKq9SSvCUX9M6NnuIEtS79qOnbmtkv33l0ySS6kpV8EJUvLN71IjzQ0AqvFBHbFoCGoAomWmp16k/TVtyQWCkEFEyNJLKWoJ6CquDe8ELn89OKW20BwcZYnb/JiNXZVWK4wTQu38LAosq+qCfhsBn8/XtV2XzoJzlanVn/fU29j9r3mBtyG/2/QGzf8SOfTi/oK/YsFMXNX4cWNVBu/JL/All7s/D6cOXhpiFiAPMbHJ8oc0Zb2ZmeWcTjkXRT5cvrmPUC1JDjGTMktK+EUVUuyVoWT/NBmJPfUhntVQEkVu87OrB+st/AhPI48gwHgpVP1Gbat0MM/3PRhkDH24q1/eFVVpC5z7E3l5jBIiO7H91tyiqWk2nivTOQVNHQQJZ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PYT4nBwup/a+FPXYlj5IHjwwKQvEIN8Rj7w8aMym+NBsNC+Rquqsg5dDh3vrMIr1cFMGJSPyA+bdJqsc2TO23tRs0vSBKdxWuHInmoI5AFiINci2578x8xX3nmcLZ01+i1juq4T7wS0Jt3gfls/6kqFCIZ1iE7lHOQfltT3D8PYjF27jxLgil9Km6ARDFxp5aq7QsEBO8eqnkwPgfDORZrNb4bQeqE4m6xE1FU2wDR6XjD8XcZs1IYXmZZ0AnSTKmlmp0Lg8XH6Go7oLJRalNw9PC9TWJuJsNOvrtbFt7n+tcjbmVSvnZX+o/TlQtysx8F8eCA5h6wA+q6YJ22jFcE9Poxpuy4b6OzOT3iJTy2Nl0x4Oa/QSx+9o+SCZU2LqLcxSY9HMa/g==; 5:uUhYc2TrupF69UJkm2uZpP5sOSBapJaT9gMb4teLvpKNJIR/Fqr9/SWIEkPc/W+b7j0n9QZKrxNEKdMGTSuR0jXu2bdEH61Wq7JoZP2E2DfCKDKuSyJGrwyTtSxiVGiNlvGGFKOAsaQR80D1J9jOxcY/WUTypRH8T0xEzwlqBzA=; 7:1H9LFpFM9rPR7nnM0T4jlzYBUYn4giX8MOWUUrsO7SW0BIp1URjS3af/Zyyj1Fls5FWmm0VE1b4P5+uXYqWhFbxAmMBhwK2QY7uc9LyYTdyl+KmSFZn5pZNTwEYoZtXfwgvzAtzO4F40BsQO7CCfTQniS3QlvGt6piPeKY0NalT0oior7IWBu7kuOLcDKb4hl8CLszEomITpkdgtJuYWkTSvpoHzgUOcxs7cR71vGhHQl6qEIc7FPqiIYB9n0azp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 10:58:33.3335 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8dd7f1f9-a62c-4033-5a09-08d635b1d00d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2546 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 Reviewed-by: Maxime Ripard --- 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 19 10:57:45 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: 10649005 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 530CC15E2 for ; Fri, 19 Oct 2018 10:58:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FB9928938 for ; Fri, 19 Oct 2018 10:58:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33C1E289D2; Fri, 19 Oct 2018 10:58:42 +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 06BE028938 for ; Fri, 19 Oct 2018 10:58:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E66B6E354; Fri, 19 Oct 2018 10:58:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::626]) by gabe.freedesktop.org (Postfix) with ESMTPS id 492046E343 for ; Fri, 19 Oct 2018 10:58:36 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Fri, 19 Oct 2018 10:58:33 +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, maxime.ripard@bootlin.com, 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 v5 2/9] drm/fourcc: Add char_per_block, block_w and block_h in drm_format_info Date: Fri, 19 Oct 2018 11:57:45 +0100 Message-Id: <20181019105752.17741-3-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> References: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO2P265CA0387.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::15) To AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 73f6e4e3-0da2-4dae-04c7-08d635b1d09a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2546; X-Microsoft-Exchange-Diagnostics: 1;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u3Vm81XVyM9TcoAkFkUZe87UXXkgF7fIqunRRSGY9by6G5Vx7nj52BDu1nWi3jCcxymnE8I375tc1Ko8VDQCsXQx/K5WKvD+iswuSrxc2MNAG6MyiA5bwaiRm1OvmO6tLXVO0cgrvS4Wna+97GTMJu0BKbcKelHUrf0ywpGAREIbIHvyRblLaOq1dnMIKFDT+elqpxMFAfURBZtYLmdsUl0ehZPVgXdFOep2tPEHaOmff7DsxWIdliNMUbzRlbFuq7ukolJfGhPkJztiPTLl8HxAx61myOidawvR+g89rNVnoQLYAt0FrArc1NPGYiMok=; 4:QaRUajJzGDy/roKPnOdzdYZoy5je4eU+9+Sj7tAr0KihrvOcwH/dP8e4l4Vqi5Ka8zSRhoHau3YC3v1vk0JAAICHq6eeMBg/hR7KlGoHEr4UzG2Zh+wDbral0DvE1NDZH+c8GkyeD+ak8VpEYf6gmKE0CqOjrFkXzNHrOvJT9ODscG1m5gHsQRXEYzYlfvESK8c5kRQ91U3au71SU+UHFBxz/TuRBf0Fg6qPBAtLtD+JcUAmVGC0yRHNJBBdQeDJ5se6/deH4USPSfRKSwdW4ZIdMUlmSw4KEzU4nkvcJgcSQpO/flT4xV+ZMBeQ0lpk 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)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM5PR0802MB2546; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2546; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(136003)(346002)(396003)(199004)(189003)(6636002)(11346002)(4744004)(105586002)(81156014)(81166006)(50226002)(106356001)(4326008)(97736004)(3846002)(476003)(25786009)(6116002)(16586007)(8676002)(53936002)(50466002)(486006)(1076002)(8936002)(316002)(2616005)(956004)(16526019)(48376002)(36756003)(26005)(478600001)(6486002)(386003)(7696005)(186003)(52116002)(51416003)(68736007)(446003)(5660300001)(305945005)(72206003)(76176011)(7736002)(2906002)(86362001)(575784001)(66066001)(47776003)(6666004)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2546; 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; AM5PR0802MB2546; 23:Kdqot0+bFc1kLBHoWnA36GeXV2/ev3f2r+/Rn0/?= vb01RhBBTm0Ln6QJZDY7eC6pWrz3h7CYriVM4LRuOr8WuIpJm4v7cEQv9cKL5OTV5lDWhjKwTtpO5jgztL5ga6eFB91p/XZAMixkPJkdyjHH9utsxv2qAHInOTUt5Prx0kptX/HVrekQ55QVM3vX++kND2D9aEaIZZVazPn6Do8kArhzyBU9lftiqro8AJZtKsFwbPb6GIGZ53PAdbFQOPvA7CK3enEq+ODtfMau+l0bZiFFghKlyFpLEpqCrrAbVjJh20lCVS8UooIhUovyBqCaSaxx3CkSQBhZe+BSN3Hh+7fe3kzZ8UCYbLTpx0X/VngpoVo5ReLmM382AjdWNlKshhqGAf6Qy2t2WEsV/9K+IJyoY0HHfcsu0lqE05C4bdYcs7v+LszfrzzOVRtn60F4QM6crk999jKbxB3PpGoVIODT0AlO0PYviOU14MhfiLKB7HnFI2+JQQSLsZbMYnE3o096f75t3W7rbiO3XjW38CQyAJrLp+9kqXeJ7vp9pqDMuZRWPAEfe0ewxh6lyuYadGfMVRPJ3sS94kehEQqgn2CbT1CoMdZl3p8vu+VeHhPhkVWTLf5SlBQBi8Q5uA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546; 6:jbSoQ/KIr4aGE/J4coi3TxEdeC3QDJ1RQNrWwqiy3kHD9ToyeLo5cms6Bc6nXUi6mZcW9JWT74o2RLNb54lhOTWeP04g/npp+Rw8pLlj40VKX1Fi0QnhVF27yxYsw45J5j+xJUTuN2Cb2PBUxoxsg31Cn39+2sWY1lX9LiTcqwjZJAhgNEbA218mIFjihyP0TgExFmVv/y/H0TsGZeDOr5L5/pNMVlBkH2+AW30vuN+1OnihhNcxvkjTsg92KhBYkLCaCtvRbffg+TgYwEvRXgy/51W5t08e0yqIl52NuvmfOmkDPOIQgPWZNDYftemXa4L4RjeR1ta1mlIhQ6s4C3cx5fCJzh3cZlKp1XxWFmxZf1WylrBme3XDLWLRzYG5yEG4XRIn0KZ5H1oVpLkk2+14MGY8vmt1x75io4ZyB86gzK7rT0d2tCZuyCvYkoPTWrALZ6RWnCYjE+0L+Cbn5Q==; 5:wiXVdHjPVWI7muykdGR55O/G5g00OXdvWgb7rO9sVkyVHKxi+0MBgjekt3x9OSHccSODjDLJtR2EnipH07ZLcRcwQb/1eT0dUWUd3AW7gMiBWfgtblie2KYwRN5qZTxSfAbnuLwrloJ4LSyofd3Piz58tf5LiRaxrjDkQpVuMfw=; 7:Xx8MoTJ4aHnDZP4AWgHG0zq/aZm2kQEqMrcysuZjFoT80AmivHmChxNKGdO9hhsiEsCoMDAgsFGSAoAZCBQmbUt8uSaNkw13zcFMuHK9YqtFOUusdRqN5kE4cCFAwUtX5T3GfSJbhQSirGhdvf3lstOvSGQGBrMYHJ3XlU+BfWhyCci78Mcgzi4YAzIs68AIgPnuEHZyHhdyGq3FUs3UdFV1JXru3uvwO7yZMuLgUikskZiVWolQRXFtlFp4bHAl SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 10:58:33.7867 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 73f6e4e3-0da2-4dae-04c7-08d635b1d09a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2546 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 Reviewed-by: Brian Starkey --- 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 19 10:57:46 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: 10649011 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 3B3D915E2 for ; Fri, 19 Oct 2018 10:58:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2979D28A68 for ; Fri, 19 Oct 2018 10:58:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D34328A7F; Fri, 19 Oct 2018 10:58:53 +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 B1CE928A68 for ; Fri, 19 Oct 2018 10:58:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3F0BA6E357; Fri, 19 Oct 2018 10:58:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::626]) by gabe.freedesktop.org (Postfix) with ESMTPS id D7A546E343 for ; Fri, 19 Oct 2018 10:58:36 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Fri, 19 Oct 2018 10:58: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, maxime.ripard@bootlin.com, 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 v5 3/9] drm/fourcc: Add fourcc for Mali linear tiled formats Date: Fri, 19 Oct 2018 11:57:46 +0100 Message-Id: <20181019105752.17741-4-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> References: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO2P265CA0387.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::15) To AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 480b1f17-f367-49b7-28f9-08d635b1d0df X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2546; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 3:M8R7doRPvJNTgU9ddc7FrkW5zqleussS5lFXjrQCsy4ZWPpO/rJ/0XoDj81K7h06j/bhf5vZJFToMYIvikyyvLtWGM9iAc2tb/Ggdxh01JKoxEWpG70hKenbHMKUDUEH9s5jLOGvCSoP6v8mZxIOtXbS2UevsALkgerhnJH2w8UD8Utef5drX1esuVTipegVc9/AFwl1Mu/ISUUQP67XIcQ7qRtLbRIgsYQplAcQhOcaNBEfGAZoZxROfakZkfiH; 25:D7c40N4qB6jhlsnF2jR9RkF39/YnQ0vsQBCON80ciCxgi0mHLhKU+nA6VPv9tp3bN/bB8LvUUAkpp38OqJhKD9WMmMrUiW2h5CY9VrkGxkhUzRX+eBUZDD/81S7ekwOHH+0vVVCo/+AaRULUy9mLwofE7CbOvux1hrt6ETVubu2KbNQJB6Gim8lQF2GpsihvxkjG26ESvzzNletuP0DAlP5WCxkVDZBLKnghjLnLixSOkrfTFMPQrHMOdcu5m4s/M3/z1K4rXNodYrVp0pwy4u6GYdP8+q0ePdMNE/fduUmII5EajFnasJW9+WcbKC4czrSOd2vC0ZbObCT9gdQKAw==; 31:ixoTP4l5791ZSMZIaQYJYdm7NwZd27E0tsxWvCzzalw57lYawJZCEhWm1cC0b3b53Gmurb0MulVTO2JvuVldP+hFFGzfaHKMp8cYrExoO2ogq0u5PG+K4If8sbQPbKdxsDoPfxVCVj7rPuedg5VzCROIyYk7m2Wh2xnB5cQk4IOk0uaj/4wJW54jon6i8GM2HSVmAjdFacWcN3GRM6XBAJnNPQAuPoo7Q4T/DcoXtmc= X-MS-TrafficTypeDiagnostic: AM5PR0802MB2546: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 20:1Bf4Sqwl7fXyLSckxNKejiQxbhulswz6TTCHSUb2Uf/tkssWFmnAdaiWG0qV5ct7q6pz5U3TSZbNJeqyZEw1Kt8sedCNyJE2aAUJ3HOr2QIueuc6XLq/EMB5NtY3APwEaNSEQfBTTiGoDm17Bb7TGuDQ1+mnsF6UEe5OepC5bGdEbQL1AvTB9e/u18O7aXzRqc7It8F4ln7R4ixGnXO4q5QmVofB+MB//l7QEXCZVxkmi8auRrYHdBr/4m7UmX2hU269ouDxCWFqTDOOuBcD/pmmpFyeKLZMF08gxp4OsTwt/Y3IxIOJ4/G9Y5DfnMPCwidiWEg4FABSqXnQe4ceBlwEUvBRZrPxuW87leTG//+FihVirEfO2xeXW45ux92CC7lT3SwyKqa+W+F9sSFEr1Y+TI3YDdY3MPybytmtYzQ=; 4:LRQCutuoXGJLYdJwvJg1T2V37N4VB5UU/XXbZ44UELr7E7pMieCJDoXevNWKUfPQSNgzBxafTRgp4toNnueLNMXVyo8vxz/ZkdSSjcOQAPOsQqczheOtR5GRlUvENWWurRNo6CLcHzSfkloWi9NWXv1TO3Angcw/EYAzGwvhxQWyGeV0ZP4cMbryYH5HL6BmiBFIgb2xCBOoCrpy8obmER7YBa3AAY/zqUdCjLwWCan3KS+7pD78/A0ZUSVl5FoMDSVjDwAFHLfFgCKAonWvN/dSye2sc2Z6nQ/ORxpb4zj297DqiDMI+VghBTNgoRV+ 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)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM5PR0802MB2546; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2546; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(136003)(346002)(396003)(199004)(189003)(6636002)(11346002)(105586002)(81156014)(81166006)(50226002)(106356001)(4326008)(97736004)(3846002)(476003)(25786009)(6116002)(16586007)(8676002)(53936002)(50466002)(486006)(1076002)(8936002)(316002)(2616005)(956004)(16526019)(48376002)(36756003)(26005)(478600001)(6486002)(386003)(7696005)(186003)(52116002)(51416003)(68736007)(446003)(5660300001)(305945005)(72206003)(76176011)(7736002)(2906002)(86362001)(575784001)(66066001)(47776003)(6666004)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2546; 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; AM5PR0802MB2546; 23:W6t3NXKYgD4ntpE50lov2iycO+cN7TsU4bil/ku?= NroVzX5CAIT1bUPOb+57QNwOWm15QfQnhElUpzrv2CoZ8wb2+Li04RMQ+xmdpapDERhPEKzTeLGQMnWPhqgzascHm73EcO9F+dnj/zmrMwycK95S096uASDiMEKJQ7L2JqMhZAxZK7Ioh4HLBWMjZW4LYGbdte10dGbYsAuc7vPyXELj/LgXyt2cp+5ewyXse/hEo1ebXfi4gylA5f7IHsF4mQSnPq0AQne0VunVNWrijGFIqsFGahvZ31q3qO6YRErcWXet8xTKXBJYqb9FxoXxbFwp2YIKWZemYjjdYn1vHIAWSr2a5+ymwpMo1xRLqlOHC1l5ofYQAn6xuWJj/1nOlyHTiDwJG0MfUaYry9xcI8/DmULxzLiG13r3u9I1gUAfznQpjD5AMtnBVVbe/jN5GuRfPSOakm/WvlaZJugHnxsVq4/Je/XPoAvHibty53I0bjOJOjIL3kDbkIS8N/Sy+uFp8oL8lgzsH06nUO22dO4pyshHJgFqeZQSQkJElkLoJVaV7LNbJ55qpc38IQl50BNQbA8+Sw3JKfR8WBUNYOnkQo/8zsQD0WLrHX4lIK6+xLAzUtoNLBIazl1Ht1wtYqUN+UPS0aDFMXQ2ZN44BTH1hde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hz6cPcrev8fqcj5oQP+PtE9M7qBrJ0oL97qWR9gii0hwQzLbZvkOTTLArqE5Ywd/gmNLeuACP5GQPlprLygZysCAcqxH4DJWDUU+HyBEDHPDURTr5lUARn9fwOJGNB3ORep/kNnqycDDfJAq8DfRcGrSwKtRhUh5lhRxvjqymx6ben4RNp7O1/VwemryLKP+KdNfUH88fgCXRFwNU1TA3At2GJoDtiSAWZ4KX5UVqjyKDFxCGJr82wvsrzrhYa16pKcqE6tIdtgfFRoXuFdXfPw+ej5uAk0vBHBRHOIMyaPvw8DeHRQsqvqKuEWaxXhg2ZRMZvhi6FBSW+RN3TwW9pmfwESsoUs2c4MDecvbO928i7547aerLIyktp1EwIp/AKFlpQxsf941g==; 5:8xvjQlzinqc8fiB2S2AXNXBrPLJoOHPiBmgLT//nHhlWtxjPm4Kc/4q1MOd235S4Iy+u4HA+WiJqcQ+3gX2cwTVpnIJmyoYGO4pigE1YgE6U9BMCzdhzSPn5Y2QY34tErUw6vFzKnQl7QbmgHRT9xccJZQmf6r6kDbhlChb0ksA=; 7:SckPpm3l7iYg8PxujkBwYl1XQjlLEoeuBOITyoj3BxbEaULqKN2g0Jl/KDPVBAzv8fz+Jr4gyvsKs3CUp1ucMekF5gmr04LdCLWOJLfoCuj6TuSZzc99xynHwoc+10h8Yk7oyA8L9elrTLMVt4MKHHWmfx3Bl7i3Wuw43qa64og8wLPwHseURiZYTEYCMsKV+Oyd6ZURVB9lfqFDE69vstjNlq9dCP6ex6RTzn5BRUFDragJFGo7lKV9Ht3odsAq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 10:58:34.6929 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 480b1f17-f367-49b7-28f9-08d635b1d0df X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2546 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 Reviewed-by: Brian Starkey --- 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 19 10:57:47 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: 10649015 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 E237D112B for ; Fri, 19 Oct 2018 10:59:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0F8B28A68 for ; Fri, 19 Oct 2018 10:59:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C497628A7F; Fri, 19 Oct 2018 10:59:08 +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 5830428A68 for ; Fri, 19 Oct 2018 10:59:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E38546E35D; Fri, 19 Oct 2018 10:58:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::626]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F59E6E343 for ; Fri, 19 Oct 2018 10:58:37 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Fri, 19 Oct 2018 10:58:35 +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, maxime.ripard@bootlin.com, 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 v5 4/9] drm: mali-dp: Enable Mali-DP tiled buffer formats Date: Fri, 19 Oct 2018 11:57:47 +0100 Message-Id: <20181019105752.17741-5-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> References: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO2P265CA0387.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::15) To AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 909329d7-fd92-4a16-9b43-08d635b1d132 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2546; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 3:mCBIi0Hlp0g0BsAvnpzZ6Wq7a8yNLHNY/4pRqr9P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qC2dTNFzJJWw30Z2rgxDvkFoROeD1ix6SPftNo4gMVgMw7VBG/8H9g7QpVjqsStaVzHSzSUBNcrdKVsTUb9n2jm9Sm1Gq+GBQsjER/0z/WjCnZDDBtZ3q1IGt9L6XzzqLJ78LHarWnDAi+qmO1yyBZlidEaSfztPn855SWxjaELYsdCAKOyeWons8zJT1M3fjKPgSIE/IFko3HnF1c++ooV7c3yYYTTU/BFIejKJ+2jms5E4HYy7VVw7PcQ=; 4:F/qXNUzfnJe9MTxViTxdF1S5votSK9si6UrFMy/+Ah5lw6+Xt8WZrdwTwgQDMXd4y0gxgKvpdVtnubGmC6X6hgNkE0ZlJEn4k1WqHGN4D87hbJKWrqJzVFADlWAJw//70rAgjKshpKYyrrewdUX6OnZx1Y+ufeVoZHMWDpBorsBgb9QHaqfhfAzRInTXACc5McuCBKS5FVKGAkyGjqtWkPlicwMNmHXqrhedbwEJt7ri6MfDn2Pp/F/70p5in+wLZ8STg2ppgJ9ckrD2YWImj7XXzibK61W8iztpWxJIsiPhGw8grrQ5pICbI8okB2hv 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)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM5PR0802MB2546; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2546; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(136003)(346002)(396003)(199004)(189003)(6636002)(11346002)(105586002)(81156014)(81166006)(50226002)(106356001)(4326008)(97736004)(3846002)(476003)(25786009)(6116002)(16586007)(8676002)(53936002)(50466002)(486006)(1076002)(8936002)(316002)(2616005)(956004)(16526019)(48376002)(36756003)(26005)(478600001)(45080400002)(6486002)(386003)(7696005)(186003)(52116002)(51416003)(68736007)(446003)(5660300001)(305945005)(72206003)(76176011)(7736002)(2906002)(86362001)(575784001)(66066001)(47776003)(6666004)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2546; 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; AM5PR0802MB2546; 23:cMTiN/+i+b2PdFCcLC5jMdsy0l0RTr33hSfQ0qs?= Vj39aaX3TrgU6mOUPzHBqZMCtmQweB1xMEDmlh9Hdhi5FRYrG8LmQl8t2bQmzd/TaIw5Pux9Lv7OhUlCW6kI1KM4WpZyiF0kAHJqtJmR5ljlg4f88caD1DmZrT06pDMoTStax7A0FJInxw8BsZL/oHJgBZv/AWs4iebCnFUs9UgrP/rk5fYB2uyjZSzNt+YcJjDccF5LQxWbLIUS5RT1hGhyQckgIQocK6G+OSC4rPQz8evFQhcy0zVIrQ9yMa7wsi3QINeXSD0NfzJbP2+JDdHFctPzRPHBxY/9iCFcht9Bqe1/DLoOaYYzTTj7xrVCZDqDnjzShTX0rp4fKP+Ukq3V8L6kWZKdoolUt5v7aCaVRCBieg13dNmS0Lip33wV8L5OvuvH1cyfRmVmXGacY3M2OgcZF5gDNx6uf870jhTi+YNnbkyTXCQaO7xOP4r1wyBBPCvZQNrfhbu7mKFHVZanbyCxvaefppNz71SM9E2h3uZAZHISNNzTV1vnpuaRm2bxS6J7sIEz9Gl3nZG4JmjDsiDE7b0rRZ+gzEZWBNaevj1TaedhHBIuYka+D0FOPR2T8pTpMwzw2H9v2qCVouyDvvB1YKblrfL/FD/xad9O8GVLdNNsRjW1v49ZMqA7rKOPDPMhcTBskV+R8Bg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lNfxz7nH1dLLTRorkCFBExY2HiyzrnJ3o9eXlSQ484kP+pijFFmF5GULSQI0yT9Zs78Kx0ryQF6kfIBopPwJO1Tw2gS1z7uFlEM5stt3D5HrIjhu11qEEG3EDWUwBqKrGK8k0+U9Pm5x74EW15K1G+Z8l+j0fxu/sngxsNwnYD36+Ot0AZ8EhSxVv8mSKoeQk0VMCc8AIKCTZHP3GKGIvJk4ahNzsKJJU81mc8nXozQZCM497uwN6XmCD5vkQ90N7BTnEABWGcv4DZ+C/iPz7sbpV1qFqFoK6HOGgl+xzrHrQz5xZw9g+2R/HDd2GKriYYsIF2aNoKmxAYs2yP2ah//wkyK7aPtvGF2kcAyhKo/b6ebBB66CLbbdFOUPOyPIQpaQpwyTnQA==; 5:5yp5f90GHZ0awq2KrIDR5TnnnMyPOf6SV7RjQ1x6CG3ACZ0XmLLVYrKS0AtfXZJWJ5VwGFjr6VrGQosyKrLekpMiWID7kkWDMyyzW9x4Ee8wnSvcg49voXph89K4b/lJcyKdvQC51EA9QomTOR5uxuxvW1RuUuhcvnZlqovRmZo=; 7:SlkhM/jK6ZKxNNx0Jq+PKWrYXibGBLJ2NXOaIR16oA6WMpHI8hbvVD4JxIOT/R6NDvbk5/OVeJ5Thx7J7n3y69FSHIzq3WAdZLkobbiZZtdFG+x4TromQdxRqyrOJKe957vN6oEDkuLb/a/j2V/DbiKu4EavrYaSOzK1b96v2lWdbQzntrDi1eL22w3dYLhQ7xqUKKub+bmBfP5dZ5r2el0wzahkJ+bDlHL7UOUs8fRh7UF73ylb4s7mePkEy4pz SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 10:58:35.2398 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 909329d7-fd92-4a16-9b43-08d635b1d132 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2546 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 --- 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 19 10:57:48 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: 10649019 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 BE443112B for ; Fri, 19 Oct 2018 10:59:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB68928A68 for ; Fri, 19 Oct 2018 10:59:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EC5D28A7F; Fri, 19 Oct 2018 10:59:24 +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 4BECE28A68 for ; Fri, 19 Oct 2018 10:59:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 53C816E39A; Fri, 19 Oct 2018 10:58:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::626]) by gabe.freedesktop.org (Postfix) with ESMTPS id 68D626E357 for ; Fri, 19 Oct 2018 10:58:38 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Fri, 19 Oct 2018 10:58:35 +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, maxime.ripard@bootlin.com, 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 v5 5/9] drm: Extend framebuffer_check to handle formats with cpp/char_per_block 0 Date: Fri, 19 Oct 2018 11:57:48 +0100 Message-Id: <20181019105752.17741-6-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> References: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO2P265CA0387.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::15) To AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 86fce3c2-e9ce-45ee-5d1f-08d635b1d175 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2546; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 3:aJr198YvQosYcCsmZ+GbHTj/iFxgryI8ZUX7OMMb8i9nU5+TskHo8fi8txGyiAEP6J/I263XFgTg1zqIp6tKOEat2Dq4jlr5HLzRXLxVaWd4hpfZ5cwy2URLhfD2mcBBxNtu2KzZ2BSMEBib4tE7FFS+RHsTk8sFSlknj7ZUR2VnHXFEV7RhAJrGYTtGMmZFrkDMe+h9SqTpwD+GAjva+PLtP2rf4N43S7ESdUtHgeAFQ0uBAo72GjV5iIb3izYO; 25:elmrqBLqoKg2DiSo086ODR9JOTewFica4RC03YSwMO9Ll1cQimjLqH3PTVD0ZK2F6qLh84wNHzb3pqXtSQT+Tj3MMwBDsyE42OqCpHMMnHAZXrOCrhpgXsxf/Ldvu4JFo/i192bAHrTySxV3iArtz0n3ygKYenU9bhp7ZaHr4jSPxbSCGzs746b+JPja0uhTyz1RUSlGwcwf3CJH7wYV/tLNt+9+UH6YTA6aF4o7uj7tvwFQuSeMk0g5T8Rp3Vv/MYw7Ylxu9k8ZAFAkZ8A5HhOgaDFBJxSMwdHXO/hn4iuA+CqE0b8W3LMsDxYAkKyicbCSHnVMQB3frElw24QhRnZv0ecNGiQCoHxNOhCfqVs=; 31:Q9LFleXpiYu5gy4ZDZu90cOnlz2QMF42gvjOebeEcTBijcW0efhvIJ4hMmJ5Z5CKbzroVKJHu2yGRiJJ9CDGbD1Dhy/mkO49ftiBarw5OFI+z93vfPb7iq40Oaxfx9vkMf2OqbIDZ56nl8Om/vdaY4WGMdLGm22WQLhoGFSwFbTVhPV09jxjeXOp+ZKs2/RLyue12kP51ikA5BjyM7ygIO2z6YL8+vQ/pKI7rJNl30I= X-MS-TrafficTypeDiagnostic: AM5PR0802MB2546: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 20:E9DJfKmdV/CygR9bX+wl/SvAWejh97zOAoxA0d7aUYYDegIIHYbFl+NYjMg08tzJlYjkENp8oIgdUOycEAqxsG2WHcpwsOH7VGHsfjbr41An0U59HMWxGhoGv1WhF0L1SQ8aTR22U75nv+JzHFU9QkzWIQPyzLSrDDUpsAvDcN3eiexgcNj4dX0x7OWM+sp7LUoXQRNF4HzpxPjywcq5kJqClxqM9rxO+5mfasvOO8bRnyFKbPD06Z47sjWsfNVBojnUKHhZIpp9tRMV9SbZnopyIKanbUx/FBsMJZzdUfhZkFD7cWDGBZcrEkGY/DT5GM0k2T3x1iM/Jyz4slN0/xwb5f00ud5Ir2aKadijr+bEybfiuXrKI/AFCmbf4sXNNT9sba2mpvwrfCCP2FtlihvXjvQkeKSn7S7oGHz4FGY=; 4:OQFAbCUcB8ZH4YS+MBCdUk6f7shlSgeD18Nhx4BUQHj3nLoieE1sobSsL8Itil8U5FykYaKh9cVlYDTU+O6l6HJovuBmZLEqAV3kRQMq5fvVoFo0pt27WDZsK0VWCyRpxzhyz9KomWM31bE6wxokOfFZcb4U0AReCb8ZlylBytnYDRjt0U56fFadUsTuTsw/u05kC8jsvsTvRPTft4vUI1N0NClDreSjpx0tlTJWDo+oNquymTO3/V55FTEFmadOjld85iChw+n39q7bzcrc30jkvA/OyjDPdta83+2X4Tcm1q8tSbF0fk2EHGbpCcfc 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)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM5PR0802MB2546; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2546; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(136003)(346002)(396003)(199004)(189003)(6636002)(11346002)(105586002)(81156014)(81166006)(14444005)(5024004)(50226002)(6306002)(106356001)(4326008)(97736004)(3846002)(476003)(25786009)(6116002)(16586007)(8676002)(53936002)(50466002)(486006)(1076002)(8936002)(316002)(2616005)(956004)(966005)(16526019)(48376002)(36756003)(26005)(478600001)(6486002)(386003)(7696005)(186003)(52116002)(51416003)(68736007)(446003)(5660300001)(305945005)(72206003)(76176011)(7736002)(2906002)(86362001)(575784001)(66066001)(47776003)(6666004)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2546; 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; AM5PR0802MB2546; 23:5gVaV9B067SWkg0P+AgDFgjn4xZWERrPrdXm8zt?= 82Aw6382KNtXATmPjwcuLnQESMoPBicv0e0/w1BnY3pQhsGfTSKuDKrg9nzyOuOgQ7X6zgGzHkSy9FapExvX0z0OhBiNdPGdbfeVp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M+PY2TNR1PaRUXoEo76BsTR4xW9+F5VZhz94OPFduUGnl6nxETIRD6cQ7YAtw0watVjHtwYz++PB5vhM4nsk2W4efhIS1Yk=; 7:XkVRSH6smZuCVWJAQktRgYV+S+H9sB1gZx5ycSohrBkN+DitpMoX591whX6Lyvj0iqQOLT6+BPuYZsD2y4wvUhTZHDB4RXxt0jbygjiqm5IQsSbt/4k4EuD7N3NFcKoWr4A6mpnczPGimBB8F+lHT16P7sPyf6dtQmKqDY9oUTDlds3Jl6tJi1K6pQjkf3duqAjPgQSk/MCtoYT44gzQKAxMa9CeatDi/y5WNrvmXZs+Jus/ulbbxziXg1pzLtIp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 10:58:35.6773 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86fce3c2-e9ce-45ee-5d1f-08d635b1d175 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2546 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 19 10:57:49 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: 10649013 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 129D5112B for ; Fri, 19 Oct 2018 10:59:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F397628A68 for ; Fri, 19 Oct 2018 10:58:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E70E728A7F; Fri, 19 Oct 2018 10:58:59 +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 09AD828A68 for ; Fri, 19 Oct 2018 10:58:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A71CF6E35A; Fri, 19 Oct 2018 10:58:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::626]) by gabe.freedesktop.org (Postfix) with ESMTPS id 033FC6E358 for ; Fri, 19 Oct 2018 10:58:39 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Fri, 19 Oct 2018 10:58:36 +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, maxime.ripard@bootlin.com, 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 v5 6/9] drm/fourcc: Add AFBC yuv fourccs for Mali Date: Fri, 19 Oct 2018 11:57:49 +0100 Message-Id: <20181019105752.17741-7-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> References: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO2P265CA0387.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::15) To AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76894361-faa1-45f4-bc99-08d635b1d1b5 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2546; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 3:8HtZ740EWkxuNS9lhJnXG2YwCLcIjd1qYPPMHvsf/Vy+U/lwUMo4MeepCrXm6ShEueHk0WKMG9buzuohYvm4Z06OPso5pgLmKQs+DNhWI51QgmG+mR59R4adL4AtDXGTV1+kKnJnR9M9PAeMbLL6KsC97xI/NJLATbiGcRY+JNngNVaW1SY8mN3KBIwJIkg6O5r5F7VZ3/YW7OYBZmccvd1xusXqeVUZD5pStWUcTvivZSvFpA2MpOhUZoAlMKoX; 25:3d9PHVtbWuZSszEtseUHLJdeLcxvAMy/pIFVklUvhtBQPZ0P9PQIFtv8ecH/DAI2DW5fRs3C0G2sUIiFPN+UzFEpVz8+0pd/PREwnWKhU2gxUhMrHTb7EIOfl+AFR+IOBki6ORF3DIyj3llrbg2HtrKJCBd2HFOOyrxYHxuJNwXIb0Hwf44BX9GOdxbKPWRPpQmbIBt0cjl5jBEsbdGmDKtAIH3ISZ4qL3rm3l0d1v99dNxjftXhu774b3GStNvSRos5U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D50t2n2ZdO6A0xseEaan2gZAnJhel59CpVotUeYxUZoJgOQHv9LRSPNHuuP2qiYRtX0qk8AITrWx9gOaVdyGAkt/quEMgJ6415xSDDh1nsTlx8vCCFp/ISVOrBWCTrJ6FnNjyliSY+b3L5570JOF24lw2r3wtb5xVWugGYUUlP27E9/VUe+g8qU+Q== X-Microsoft-Antispam-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)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM5PR0802MB2546; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2546; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(136003)(346002)(396003)(199004)(189003)(6636002)(11346002)(4744004)(105586002)(81156014)(81166006)(14444005)(50226002)(6306002)(106356001)(4326008)(97736004)(3846002)(476003)(25786009)(6116002)(16586007)(8676002)(53936002)(50466002)(486006)(1076002)(8936002)(316002)(2616005)(956004)(966005)(16526019)(48376002)(36756003)(26005)(478600001)(6486002)(386003)(7696005)(186003)(52116002)(51416003)(68736007)(446003)(5660300001)(305945005)(72206003)(76176011)(7736002)(2906002)(86362001)(575784001)(66066001)(47776003)(6666004)(921003)(21314002)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2546; 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; AM5P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7La7elGJnodlGKymZcfMeU2Zw4FQrYk4LuI6XEwYayBLo5CO1xNm+L43SIYzsej3EOoiZ3sLLHKsiCnYg==; 5:jKYTFX2q2qsT9PBVGfKs3f4jRYRscEzIN9OBcgjRjTFFoUKtkoyc4LmC8/6wtlnd7jdQ/n1zeH8oJhsEnRdR1tZ1YOXCkcvVaPUQbhmsLAXpy+wdDAnBkYHwb7PqLxSunIuevyhn0NsMyvBexO4ozO6ubiFLax6f3PE1prp+PmE=; 7:vnbSio+mL+PiOXxpoPHKp+EivoJMGtzyDEHMWqTsqy+gNsyzQDGVL9jz4Lmku+9L97DO7DkRlVs7+CySnlNkT29kjBL2vNF2tvES+CZWPqPSkQW/c8K3wmGzjBc5CRlSzjy5Sz/dz/JevxK1o00bbmVm/+ZXrSGu261n+FaZTbVkdP67w/BW29PD4cDlqpZRlXtqhJFkwSYhDr6A66duM1sWxPRLAPSqDhW433E/PiTHqLk8+J+lpTiW4D1eepdG SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 10:58:36.1148 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76894361-faa1-45f4-bc99-08d635b1d1b5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2546 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 19 10:57:50 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: 10649007 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 D395C15E2 for ; Fri, 19 Oct 2018 10:58:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C021428A68 for ; Fri, 19 Oct 2018 10:58:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B406F28A7E; Fri, 19 Oct 2018 10:58:46 +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 088E028A0E for ; Fri, 19 Oct 2018 10:58:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2435D6E343; Fri, 19 Oct 2018 10:58:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::626]) by gabe.freedesktop.org (Postfix) with ESMTPS id 951916E357 for ; Fri, 19 Oct 2018 10:58:39 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Fri, 19 Oct 2018 10:58:36 +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, maxime.ripard@bootlin.com, 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 v5 7/9] drm/afbc: Add AFBC modifier usage documentation Date: Fri, 19 Oct 2018 11:57:50 +0100 Message-Id: <20181019105752.17741-8-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> References: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO2P265CA0387.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::15) To AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6dc511b9-cbdb-4c69-e0cf-08d635b1d1fa X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2546; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 3:oKlti94bg6GXEUaZB86ZLItXLFELJ57T8tlGmTcWCAxVXZxdHFISPVKmfd4h+AmpsJfBUpYuy5U0JKglBh05iYs0PLQzYnNQ8bALyCoiHiC8bIu5R/vWpyO3CmTpeXvxLJJt8Fqr3WscuW8ZgthZ/xiktQTbj/7OPEcjuZS92oYFwuB44Qha3dC+g9VwxefeDZZsCmfPVTlEjOs3r+Ax+Aami/qBgFcZMeQM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Qx/SPuo2i1gJxbKKMfn29KrV4u5+hv2fVcL58QIrYVK2bGoc=; 4:49tCWb0BLqz+1dyK4MJ+ajYe0XYdRijn0pl6wqztEKZ6gg6Ow6A6/f1iarONQgojlH9p3MY7lbeLbkBaPWajE/YL8P6nH0lt5zm/zjwwaBO/MUehQ7Z1RW//IVCvyJ2ilfEaIkNjnlAns/2cqOxlLfPi902DNMa6IWQnKpcQ4/m4V63mT+Zm9bDGVlrP8m5HPqTiIabiyCtIRwmxC7M58lnaqq3hKKk5LMW1FU9OPuVULI0AXINzmgPAlJqy75gAftK4bERo2ioLsY0z6TIaua4XDDX9u9Bt0xMiZMs4zjoHiBgiifkJPvkkbposxvo4 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)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM5PR0802MB2546; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2546; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(136003)(346002)(396003)(199004)(189003)(6636002)(11346002)(105586002)(81156014)(81166006)(14444005)(50226002)(106356001)(4326008)(97736004)(3846002)(476003)(25786009)(6116002)(16586007)(8676002)(53936002)(50466002)(486006)(1076002)(8936002)(316002)(2616005)(956004)(16526019)(48376002)(36756003)(26005)(478600001)(6486002)(386003)(7696005)(186003)(52116002)(51416003)(68736007)(446003)(5660300001)(305945005)(72206003)(76176011)(7736002)(2906002)(86362001)(66066001)(47776003)(6666004)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2546; 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; AM5PR0802MB2546; 23:C6vd823TBlvEPTHvsmtvxi7RmxLQMtpyz4KWKpe?= y1U911fCOGruq/T188I7nT9/w4bpqyRagk2bysSpjk+MAMjjjCvB64g3oTu6IL1gOoAwnzyfQj1/F3SRpUqUywc/UTBNREKgdpbegOx0UpcqIktW7e0BCS24iMCoucYr2LCiugoULGE3S0BhYGZUv8QZ1/bs61veSTlYDR7WIcKQcSbNd4efSRIJb0p8KKfCGeg/N/b80KSeqTWGm+E8kNCsRYZlwIF0XEVmuEKKyOR2ZH2WpuHEOir87ldiRV0fEpWiNwNyKQVIcs3UA1x0ghMb1VmOfmv/GJBOOOqkdGf6hU7pzV8frorj6YMfnOUn+EGOrZKkBTZn+MBzb6vZZKRJhDe8viJCIX4xDRufDCnvVohHDUENHHu/5rD10+cv+U9AsfGrOELaGdSF1jpzZ1qULWIPTg7DGG0x4DrRcZeWBZApaHtVBzwIr100S9ILHKE8G7hMxq+Jme3YJFCjCOYAU5Dh7McUiRSz03Bkus97uOwHDfYuiJHBI6KBb5HtI+gJsj84HUoSLim8Dgyx+RiiHbXpL9Q09eDiI1/tuHkNvZdeRVHG4I+BGhbB5tptbu5xBCS74pjgPQu9fDqrHYyO/sjOrQc6IUzeNi64zKI3Tvn1XXovh3avK7422VBfBESNDiCEwWhKhEnKTEvrOF/ry8aOut/v978gG8sTtorEG/ent/P7q7YFmyIe1f1BF0ZPxthERpfsRHTwGQjEBDMDNdtCB6iapS94udYhZXKY/dAoPypPIYpaZiUpW6po8IFolch1ZRblSbY+2Zs5knAh/IvvfrgjcW50tbDH7ijZJa1nAGwnsC1t6TdsrU2DIuiEb9jfgqIH3heWBiFAN0Y69wY9ldzRfD2m6ntivB0ePo4FIjiRw5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xKCI2UaKgFAXd8wh3dZPwcm97VZQAmy4nx7EzPLeops/t+A/FPZL8FWllFlNZTtteL9flZl2OV/dQbtgA5kIKuGlKM4Z92E34lIZ8rASp3qip0/O8RsodjtvMEKj5VTSneiXjt7+FWXvOtOuHIg==; 5:oCpEePqL93iMp6kAUtSakd+rDcqZXY/OOmwvtfR6gqVldeEskMicMgZCi/QSoZIa1NgCOfOM3Y3+//TEHzRH57EAJtEmlGnFhHzaL9yG2+rsCXkeMY2pZCcs8j+SIlxKRB2F6ewAffqBGFb02Kprs08jSo+4J/xQfMDkZPs7l6s=; 7:jqbtOJvSiBcFgh2XumUSzBsS8eT/JyE8N6u5PbdKQkckwErlRcT0Mu4fdfPCbE4qEAA5PHAGXTv91lsF0jvA4TmtVgWCSlO9G7IyctmWdJSc0f/u4dL/f1QPdsGaMwJYqmKUxjNy0RCOLKgyqyaGuO7PMf1NmeMd/WwZC+BFdXkkYsRMzlIUrLX/URUNzQ+WYP5E58gcqkyPXAJSL1OzxTap4m6NUHWqKewPc+5MHx1lAJq0Qd7f4vffbiGt/5Ms SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 10:58:36.5679 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6dc511b9-cbdb-4c69-e0cf-08d635b1d1fa X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2546 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 19 10:57:51 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: 10649009 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 34735112B for ; Fri, 19 Oct 2018 10:58:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2366428A68 for ; Fri, 19 Oct 2018 10:58:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1771F28A7F; Fri, 19 Oct 2018 10:58:49 +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 AB75228A68 for ; Fri, 19 Oct 2018 10:58:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 420546E358; Fri, 19 Oct 2018 10:58:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::626]) by gabe.freedesktop.org (Postfix) with ESMTPS id 30FD36E358 for ; Fri, 19 Oct 2018 10:58:40 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Fri, 19 Oct 2018 10:58:37 +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, maxime.ripard@bootlin.com, 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 v5 8/9] drm/selftest: Refactor test-drm_plane_helper Date: Fri, 19 Oct 2018 11:57:51 +0100 Message-Id: <20181019105752.17741-9-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> References: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO2P265CA0387.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::15) To AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 677a1020-22d1-41b7-a2b8-08d635b1d23d X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2546; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 3:5BnoiI+1lBTtWwTZj0z1QvfIKKBSGG558cmvzQ+0p7lr0T3E+qgVmdlN8KNalvfdd0vl6QxWzfD7piVhq8KWXBCQMm3DxpRPwBscA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+fTYE+FcbE+3pNSMm9dAqh6MrI3FKsp0t9IKjK4tivhQqsL56+02T4WUaukHK7O4T2mevbwaW1hycQi4c5SzB6HE4hsb/zt10JaEpTOWRdZbBWVpPCQqBtM+N/QxjwKnIRRrgjb9HB44hYPIsu4AENhayRBdeEL0FCbN0cjmxzPkwTuoThf2nG3Km+k7E5xB2coWs=; 4:DaU0wDTK+CDkAngxhIiwjawL1DNSk2k4OES6LAXzYo+HzJMmBYyyEIpnoggHjZXE0GjzAos37IrvzHc9qYWhCOimV4TYBS+oMF79PLh+BxrxyB1LVE1AazgvQ4J7NxG+J+6h2l2AgE5V8B5UZB7Qg0j7SNi1BpBGF/NAYkn1RD/QAwygzB/Bsz52AAdBIzetxKm4XvFGLwuTOHj8FmHgVxdNxZ0MLK05ZVqWxwrqH9amQDHQMpksLtUnhqZVJUHpAYsfqVpq4ZbiOhVnqL65heCa1Gww7GM2A3uqEV7y0brGp1epuAly0DSwVRoSFohT 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)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM5PR0802MB2546; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2546; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(136003)(346002)(396003)(199004)(189003)(6636002)(11346002)(105586002)(81156014)(81166006)(50226002)(106356001)(4326008)(97736004)(3846002)(476003)(25786009)(6116002)(16586007)(8676002)(53936002)(50466002)(486006)(1076002)(8936002)(316002)(2616005)(956004)(16526019)(48376002)(36756003)(26005)(478600001)(6486002)(386003)(7696005)(186003)(52116002)(51416003)(68736007)(446003)(5660300001)(305945005)(72206003)(76176011)(7736002)(2906002)(86362001)(66066001)(47776003)(6666004)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2546; 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; AM5PR0802MB2546; 23:mBDWivVEEutLngRqLvEsJcBZTkwpxARF2V8h1oM?= MPmiG5Jhpo0owKKyGYqrIyvu9NzEkkwKv0xLowQ8hI7LrT5RWUCvaUU6zNp9sd9ES+QPgvAO50QKz3/4B9/ZOuacgWFu8YyoxTP9KX6E+vCLohILwSNuOXrNWUg2DvVxjn9z4D/0jbR1trkR7TeaB4G1bjAUkE34WYWB0jdU2oEAaem4kJoOwKW65lsRzQOVRzY+XxOPvtGvAj3Li0GiAF2bHprfeuB1T9ri8lruk67IBhxOrf+2qNjhlhEgccn1EyYDqMJjuU/h1HSbrNu9eJc1GQU3QeBcEIL1da5bfRPM3v9SOP07WyrG/mKL6G9Y6n9Ln84OeaRxDC6uf4ugXit2Rz0O0aw9Z7iVPsL77SKzNVFQbvpRDclS8V508N8qb7yPD4p1KBJ13CnLEvLGH5/+2EfvVxGRCEitiRl9HYaB+gS7R+xXis7qlafJdCF8ypZZYaI7cuJd6vFkAxcoWlAN+syspDtlAwHXl3pPXPgUEKivpVlRdmvJ1E8mVqjlTGrLAcZBAXyQhmw5y7HRxHQs7I0IyuUmy4WxeedYITW3BzLCeJAr6JJkuOaHw6Ot/cYIiEDCmQ472c/ncH1ZS0i1M2MU/L4RXO2zhNvLUaddBZfzaGNDpxbSA2av1h/jBShRmbwJ05jZOdKT3YpcpYc+1FPnVOCVpuvb9e/62b7aWOwW/gPu/8fbSXXeGcz7yLUhcIvu5tjqV7MNYHY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yqIzR+6/xdshAmtFkoPjvPZVNK0oF9vr1OZbpbMT2px/9Y/Pk/wQ3XAbA2OohRG7Nn2C9WElReXU91ENY+X3Eg49OmTZ8Is1ST3P/qHOhIauM1tbfydsNIyWpFmVXRYpYrG+NgniW4AZjcRQnW/Xw5MFLG2zAqMN1Ph/vIPwifWKkwwiCHsRyDqbbq8bE2/oDhGh0oN56EtAcrx4ymIOP58dvpQEyBIcocunlQuCpjSrFgLHLOKZ7Wpi/5HplPa5bz3/3vpgEWQdwSOhZ0PRDorFo62A==; 5:unvI1fTjKv3b+snhWGPyuQmqBzqqFDKOPvs0sbZCgYBcbGx9dTRJaQvwBIdptYe9Z/e42IAcA4Ud/s0xXeHW/50qg6JO2F0Gljq5eQW2yc0sMwrgk0GWjiNDv/c2EJem1V9ZLC5u/047eu9FRlrolveEFIuVe88mF007bU3MbyM=; 7:7dAbHUiVWBcts9RdVXhDpEjTYshSXryMqO96oXTrXKXWuxeoM0wDr+6QMBLKSm9iMeWIobBUZX9SOZbcEHqIf1f0tNKKhqxMhesUZ1jpO4SaWYVmTxcffvIG+bmcgI8nywOyOR/ezLOVKDk7VhI8smfQvZyMWaTQFf4/7M1bim/nGTXbkwJ5eK0AoQycWHCorEc7veHbVR1V5m90NBhnoRMWe1+gl1HvgPjF3Hl0zUqi6fc8O8pn6RUettGyB7II SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 10:58:37.0054 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 677a1020-22d1-41b7-a2b8-08d635b1d23d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2546 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 The idea is to split test implementations in different compilation units, but have one single place where we define the list of tests, in this case(drm_modeset_selftests.h). Signed-off-by: Alexandru Gheorghe Reviewed-by: Daniel Vetter --- ...er_selftests.h => drm_modeset_selftests.h} | 0 .../drm/selftests/test-drm_modeset_common.c | 11 ++++++++++- .../drm/selftests/test-drm_modeset_common.h | 2 +- .../gpu/drm/selftests/test-drm_plane_helper.c | 19 +------------------ 4 files changed, 12 insertions(+), 20 deletions(-) rename drivers/gpu/drm/selftests/{drm_plane_helper_selftests.h => drm_modeset_selftests.h} (100%) diff --git a/drivers/gpu/drm/selftests/drm_plane_helper_selftests.h b/drivers/gpu/drm/selftests/drm_modeset_selftests.h similarity index 100% rename from drivers/gpu/drm/selftests/drm_plane_helper_selftests.h rename to drivers/gpu/drm/selftests/drm_modeset_selftests.h diff --git a/drivers/gpu/drm/selftests/test-drm_modeset_common.c b/drivers/gpu/drm/selftests/test-drm_modeset_common.c index fad5209043f1..2a7f93774006 100644 --- a/drivers/gpu/drm/selftests/test-drm_modeset_common.c +++ b/drivers/gpu/drm/selftests/test-drm_modeset_common.c @@ -7,9 +7,18 @@ #include "test-drm_modeset_common.h" +#define TESTS "drm_modeset_selftests.h" +#include "drm_selftest.h" + +#include "drm_selftest.c" + static int __init test_drm_modeset_init(void) { - return test_drm_plane_helper(); + int err; + + err = run_selftests(selftests, ARRAY_SIZE(selftests), NULL); + + return err > 0 ? 0 : err; } static void __exit test_drm_modeset_exit(void) diff --git a/drivers/gpu/drm/selftests/test-drm_modeset_common.h b/drivers/gpu/drm/selftests/test-drm_modeset_common.h index bdeba264661f..b0065a2eb067 100644 --- a/drivers/gpu/drm/selftests/test-drm_modeset_common.h +++ b/drivers/gpu/drm/selftests/test-drm_modeset_common.h @@ -13,6 +13,6 @@ #define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n") -int test_drm_plane_helper(void); +int igt_check_plane_state(void *ignored); #endif diff --git a/drivers/gpu/drm/selftests/test-drm_plane_helper.c b/drivers/gpu/drm/selftests/test-drm_plane_helper.c index 0dad2f812a27..0a9553f51796 100644 --- a/drivers/gpu/drm/selftests/test-drm_plane_helper.c +++ b/drivers/gpu/drm/selftests/test-drm_plane_helper.c @@ -11,9 +11,6 @@ #include "test-drm_modeset_common.h" -#define TESTS "drm_plane_helper_selftests.h" -#include "drm_selftest.h" - static void set_src(struct drm_plane_state *plane_state, unsigned src_x, unsigned src_y, unsigned src_w, unsigned src_h) @@ -76,7 +73,7 @@ static bool check_crtc_eq(struct drm_plane_state *plane_state, return true; } -static int igt_check_plane_state(void *ignored) +int igt_check_plane_state(void *ignored) { int ret; @@ -220,17 +217,3 @@ static int igt_check_plane_state(void *ignored) return 0; } - -#include "drm_selftest.c" - -/** - * test_drm_plane_helper - Run drm plane helper selftests. - */ -int test_drm_plane_helper(void) -{ - int err; - - err = run_selftests(selftests, ARRAY_SIZE(selftests), NULL); - - return err > 0 ? 0 : err; -} From patchwork Fri Oct 19 10:57: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: 10649017 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 AA873112B for ; Fri, 19 Oct 2018 10:59:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 981CA28A68 for ; Fri, 19 Oct 2018 10:59:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AE8828A7F; Fri, 19 Oct 2018 10:59:15 +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 AC38428A68 for ; Fri, 19 Oct 2018 10:59:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6AA426E376; Fri, 19 Oct 2018 10:58:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::626]) by gabe.freedesktop.org (Postfix) with ESMTPS id E8C936E343 for ; Fri, 19 Oct 2018 10:58:40 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Fri, 19 Oct 2018 10:58:37 +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, maxime.ripard@bootlin.com, 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 v5 9/9] drm/selftests: Add tests for drm_format_info* helpers Date: Fri, 19 Oct 2018 11:57:52 +0100 Message-Id: <20181019105752.17741-10-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> References: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO2P265CA0387.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::15) To AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 26ad4c28-2f94-4b0f-c6bd-08d635b1d282 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2546; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 3:1uko2L9DIit0juvSDJ8/jHKbNojZG6NwWomP7MRI4JNI6uKj9ab4GodUzv41mp5RUD53ue1G/8UrdsrubNfcCccqAULrhmGexFIgcu8EwbHa4BrpRt3jkBG1sW5ek4JwXqZtFGi3qbFQaZISnNNXisPgs+A70aI0fX5YOQzmfZlKRVXOFFHlSgmBJISFsLV8j9NIdwHVTtcFedxnpLHk2u+n4kmfJHaurxAh15Hq0o0nO2lYlKAVChj+WBVps/RQ; 25:dbpdVm1e3DOi/TPpvufBNYXVd/KlMqZR7MudeK25f90aSO44RZFB2j9MSca25PYKLF/hrBud8hNBH+K3+aZGAXK9hknvM0LvppdRgFSJpsRKIfwpA3FVRVAF10t+DPq92RagNCo47154vevqHqvfAvd6BiNAnI5kuKhiBP2+aUHX/rv0vPDi9eDYHu8xohRyy0hX7udx8vn79HBZxPSsSiSDDWFElXvL/Kcnl28rgEZh+x+a8qGiHeJVIx9MjakW2m1KHAj5p4wnQF8JZhS/cVgD9oa1ou5OZdpbbXntilF3Chm/UHuDYPsXlPArhMCq5nJihLqf/nCqb7vLDLpTow==; 31:mffPWtoP9h0E9fTRFa1+8XBFOVLqGqGJzmtF+xpNApTKyuiNqTj38PP4l14+JpYGRp9gKm0MFG9doOjiruX+c8UpPK5Q/faLNU2mfRSQpBW9q1T3Vs1D4BnDKFgobt/yFGf42cJFDgASGqv+t9t5hsy9zmIypq4xAJ0obqCkmBxp0XSXgBvAsm21Yp3EflkbuG/Lr2MGomBmc2qRfyFblRhGffddN81Y4KzvhB1CaBQ= X-MS-TrafficTypeDiagnostic: AM5PR0802MB2546: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 20:9/QYZ3eSzoWemSOf2oAJlmo4zMjZJGwQX1f/YDTZqTHUZMaB0gcqQFACa1kfp6BCm3W16qJgRU2DrXmH6xr1liivWefatpPioRTepeGfCsk+T7irwvwya7UGD0tzRSFBYfmqVE5st2PkAo3qsc3zS1hwC5Dw/es3G4JtsdQIid0UrCZu3zbP6sJX9bq8z5yfTzU3E0yOtlud2tqmN9m9cApvUgCozcDcMdLxcKTm/dJwW1QLDvKDbodRK1btVFgdYlBsE/FujsDEQcNOD+eVqQY3dAHlGPsgPJk0K2XOPuOGska7cSSGVy6DgpkSr9kAoO41zJywQohwrYvxWj3za36A6NUxot+Ona9vW/1m+j9vwdQF4mXxJfp69FMXzSHvGiUkeVUAAyADsoQUf+T3PWWHOCVnTEsIg96hUxn94j0=; 4:tq5NB90I5c/wqhJ29L8sxceWRMMVmZot2E7IV57qyqr0Epq4XbWBt348XpaKoI3ktElC2FWlf8x20WPSWIVfTJoyJkde0jLQ9K2ar0vkFpVcM/49L2yhXfSJjGapzJkKfphPzJPYLPctvhLSk6mrlt9l2totSPbNQ+yeC5fOmuzuk3ch5sg4jIxYzz7JjTyMxKNBLhe4cSYmVPryfJMynpy3fai+fsMPRvD2zGTbFMR9+oLvQneOuspNksWAFfUJMZ/+0PFuihsozxnE7pPwhy+DG+FMlZPf4icvi88GbdN9Yber/n5LOY2wlZHVEmEP 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)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM5PR0802MB2546; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2546; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(136003)(346002)(396003)(199004)(189003)(6636002)(11346002)(4744004)(105586002)(81156014)(81166006)(14444005)(50226002)(106356001)(4326008)(97736004)(3846002)(476003)(25786009)(6116002)(16586007)(8676002)(53936002)(50466002)(486006)(1076002)(8936002)(316002)(2616005)(956004)(16526019)(48376002)(36756003)(26005)(478600001)(6486002)(386003)(7696005)(186003)(52116002)(51416003)(68736007)(446003)(5660300001)(305945005)(72206003)(76176011)(7736002)(2906002)(86362001)(575784001)(66066001)(47776003)(6666004)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2546; 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; AM5PR0802MB2546; 23:Oteek0ajaS1jJPfniB6sAT1R+/SJ0+7VbsQtvpg?= MM8sy101oAa8I/RXpPTq9ZyKml2kq3Z4vicnARit5JmF6EmOaFeEC3h092jkQuT0SFdeh2DVGlcovzNw9k+lVICG+k7FplPN51xLNs8IwKRxVlkT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5txsHoDNp5hx+foYntspdz0tkUKyH4/YsKisQJny526Wuqo=; 7:MZksB1cDPrRJvL56PRgGgJdgIBU9c9fEjm+GSLREWyhsT2Q9d+3HUX36NdWN3UySkFZDb96DA+KPtvLjE+HF3dNccGuSwxvPHY5ousVUjak2nAa0PxUhYjCwmF+hUoAJvoDDTZDBV0eVXIKUalWc9u+jBAuK24cFYm/qW8tpo7jiIp8Eq1rDSNk/guVVP/jitbucVjQe8plauSKb3MR8xLiFuFowBAIbHQBthPXJcoILquT9LC3h+Qzw7e5j3yYH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 10:58:37.4429 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 26ad4c28-2f94-4b0f-c6bd-08d635b1d282 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2546 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 Reviewed-by: Daniel Vetter --- drivers/gpu/drm/selftests/Makefile | 3 +- .../gpu/drm/selftests/drm_modeset_selftests.h | 3 + drivers/gpu/drm/selftests/test-drm_format.c | 290 ++++++++++++++++++ .../drm/selftests/test-drm_modeset_common.h | 3 + 4 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/selftests/test-drm_format.c diff --git a/drivers/gpu/drm/selftests/Makefile b/drivers/gpu/drm/selftests/Makefile index 7e6581921da0..07b4f88b422a 100644 --- a/drivers/gpu/drm/selftests/Makefile +++ b/drivers/gpu/drm/selftests/Makefile @@ -1,3 +1,4 @@ -test-drm_modeset-y := test-drm_modeset_common.o test-drm_plane_helper.o +test-drm_modeset-y := test-drm_modeset_common.o test-drm_plane_helper.o \ + test-drm_format.o obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_modeset.o diff --git a/drivers/gpu/drm/selftests/drm_modeset_selftests.h b/drivers/gpu/drm/selftests/drm_modeset_selftests.h index 9771290ed228..4e203ac8c134 100644 --- a/drivers/gpu/drm/selftests/drm_modeset_selftests.h +++ b/drivers/gpu/drm/selftests/drm_modeset_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_format.c b/drivers/gpu/drm/selftests/test-drm_format.c new file mode 100644 index 000000000000..5abfd5e28d7d --- /dev/null +++ b/drivers/gpu/drm/selftests/test-drm_format.c @@ -0,0 +1,290 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Test cases for the drm_format functions + */ + +#define pr_fmt(fmt) "drm_format: " fmt + +#include +#include + +#include + +#include "test-drm_modeset_common.h" + +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; +} + +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; +} + +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; +} diff --git a/drivers/gpu/drm/selftests/test-drm_modeset_common.h b/drivers/gpu/drm/selftests/test-drm_modeset_common.h index b0065a2eb067..592a6581b189 100644 --- a/drivers/gpu/drm/selftests/test-drm_modeset_common.h +++ b/drivers/gpu/drm/selftests/test-drm_modeset_common.h @@ -14,5 +14,8 @@ #define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n") int igt_check_plane_state(void *ignored); +int igt_check_drm_format_block_width(void *ignored); +int igt_check_drm_format_block_height(void *ignored); +int igt_check_drm_format_min_pitch(void *ignored); #endif