From patchwork Fri Oct 19 10:57:43 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: 10649001 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 46468112B for ; Fri, 19 Oct 2018 10:58:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 330EF28938 for ; Fri, 19 Oct 2018 10:58:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25E82289CF; Fri, 19 Oct 2018 10:58:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E839A28938 for ; Fri, 19 Oct 2018 10:58:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F1306E340; Fri, 19 Oct 2018 10:58:32 +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-he1eur04on0624.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::624]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7CE836E340 for ; Fri, 19 Oct 2018 10:58:30 +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:27 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, 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 0/9] Add method to describe tile/bit_level_packed formats Date: Fri, 19 Oct 2018 11:57:43 +0100 Message-Id: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 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: dc7d767f-8615-445e-3431-08d635b1cc9b 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:QjOur1ncwUyUJmka38mlSoiphuk2ANwttRkFIUGmJmSCUi5PRf52dDoD0dT2SQgFAtCorrXOYDwjgcRLOB8Fz8frX5rAoko+Q0CnMJo9ssKi6W6K5CtBXvOQfj/SzKmONd7HI8Ggu02VMlLLZHVCFffbxDTWCzzJzPar7zvJydt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z8EBTZRGya4/2okoRxtIguVSklO1dvQIouoErZPvf5lFcszTqMXd6/jickeLwSIvYfqGMZ3oK3ynWu6NI6LWrTlBU3nlGE2IGrQLCuRlrx3sgFAw=; 4:kco0U+96iH9bz5rvJn9L8l7YAMdVI1eymObKMBa5M5zXDMVG/tNwXo/+1KUDkQfzqyfsGLQcKX52eTWmGsP0d2sWOZ8HaPf2HvgUOOb/NZjQSueVWiIG0RmiqFgmuphVn2aviAItntKq80OO6u/oNjfgHCN5CyN4KgxOsH6hAzdO1BUREdKcu3b+8yd43hc+PTrh1A3xp5XTDqAg5TmbXpLvMNPNdw4KiFik+6nvQEUBwgAKMsz+wL9bXRBPbpGv4jcZhoQc3tPWHzifb82EFrkJWEz/rp8wf53iQYfEVmcUinDGEJ6oGMGFJ8jv10nd X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(217544274631240); 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)(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)(5660300001)(305945005)(72206003)(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:4VewEpzEr9gmNTgjQqggxoJwvzdCZnwU7/VI0ju?= y3vdeQ6zwqAXO2a7qF6yLV81AnDyfMiTWiXdgp2kqBZ7AAK2FTpsgk8jJii3fUjsmkym8I8QWGXuX3R1/BMDMB7wTdZpieS/KynVUq+9aBduykUjrUNmIY2Q2Yn6vOsfjt+JhhoB4zlkTyWyHHM7h1+GYuYJVqvHSPNOHp1f1bCZKIX6JJsc5dz70v+PBatIZ0RQzD65zIdnnPOEcxy9g2rrugMynDMMrHY6M2+6RmaWheHD43+mXbL5HxUand97iKOfx7T26PY9aBhxP9X0Tigsi41KvWlI/QhNsSb+F7xYe4372Lt+F6iwIrgwnU9YxxaCGzSfjZTFVtLHo72Hgh6RB1nTupak0OVKg4iy1cd1KYEyCIaWK2DoWO/hbWNhhT3BVI84QMPDM6jG0WFBDDOlye8uUC2rdOz+TTa7XlbZQeK9JG/sR1iIM8yc5MlFDcPPBoYkHQAY5T3qVdwZ0o5FIi8RDvyCAlGLy1pWMsyKJIXfaa41bBVMGKq3S0DqCar+MWR0PTObR1YiO/sKFj4JAIYPruhoPyyPnARhj/c0DtSYFxpcR3cBr1lZ+TRSxeGZnCANsjfI8UbnOdF6UwJ4JpLYuaPVQ5Txet6FZpqLHRFGOrpTOFW8gWqeKhjxiOrzfHIBDyKFKAX/HVFXVrH5T1B80G0vMZ4C9OCSx0bonvrlTZIbJW9F21PP+UxQw5ceF7LRigqMQGGB6/0Cf3+smR+pD8/erDIcgDeYldbrFLT/BqlB5+920OU4XAvIavJ1IGPfaXbSNdvu/usG9xhyWYFO+TGfYkv/J2fZXkuFm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UfkWWvcj8JCTRvR6H14GJaQTAoYLojOfgDBbLKdA1xEUkc0YNM9eMmloK7tF8PjaXnHXZjNprTWwjDB1iCsviIXq0jiiecCPrbx5adMdbdilaeYxrQwA8h8ORLhHeU132+uZ6vha1g8VlEgrbCtW2pA5YeKRtHxPNS1LqNOjNPn+80369ULP+J6p9in+Xg==; 5:JcBk0UXZgmUWqDVWsai0b57sIuAwE3U6MsOF78C5lD3nWtsRluoBK/AkSWIq/7R+V+aeG0JVoBoMPj3hZt/Rc6HVlrl8/gtP/MSi4OsZpZ2c/Uxb5UWjaX1aG9iGKlhlhLIzsaL6MBtBBYy7vLNOVtDQBHt+ivrQU4CxyAl+d1E=; 7:U1kh6l7YlQzg5SuMJxcQhh96lDYW5TZtXts4gwyqMDid02GZhcKRbub568AkpestorpErUAbLHjc/Q1KucIdbV03YxM3jxifIjM1isuoGBFIC+4oaxomlFucRaG2kHbn/XqeJ8UBiZqu62UKA8J7p/vO7KCD1QM5L2d2LtwUu2QmGUX4yLqRuY77g9H9IEQJpAWK2J1nCOWoHuXwsdHs1FqccMZz0Tj6X/KUf1cpTSNkVD5gvvbZYtgQI7RBQIdC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 10:58:27.5523 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc7d767f-8615-445e-3431-08d635b1cc9b 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 Changes since v4: - Rebased selftests on latest drm-misc-next Changes since v3: - added an utility function that computes the minimum pitch. - switched drm_format_info to in-line member documentation. - Cleanup/Improved the kernel doc. - Added selftests for: drm_format_info* helpers. There has been some discussion about extending drm core to handle linear tile formats, in the series sent by me here [1] and how to handle formats that are intended to be used just with modifiers(particularly AFBC modifiers) on Brian series [2] and on IRC here [3] and [4]. Hence, this big-merged series: Patch 1: Just a preparation patch that converts the drm_format_info kerneldoc to in-line documentation. Patches 2-4: handle tiled formats both in core and in malidp driver, this is done by extending drm_format_info with three new fields char_per_block, block_w, block_h and consistently handle in the generic code paths, both linear tiled formats and normal formats. What's different from [1] is the interpretation of pitch for tile formats which has been kept to be the same as for the other formats: pitch = average_chars_per_pixel * width. Patches 5-7: Introduce the YUV AFBC formats, the only thing noteworthy here is that cpp/char_per_block are set to 0 for formats where it's mandatory to be used together with a non-linear modifier and then that is used to bypass pitch check in framebuffer_check for formats that have cpp/char_per_block set to 0. Patches 8-9: A small fix for test-drm-helper module and adds self tests for drm_format_info* helpers. For the other touched functions we need a bit more infrastructure to be able to unittest/selftest them, since they need a stub drm_device and drm_file. As a side note, igt master branch doesn't seem to be using test-drm-helper.ko, so I just tested by loading/unloading the module manually. [1] https://lists.freedesktop.org/archives/dri-devel/2018-September/188245.html [2] https://lists.freedesktop.org/archives/dri-devel/2018-September/189620.html [3] https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&highlight_names=&date=2018-09-13&show_html=true [4] https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&highlight_names=&date=2018-09-14&show_html=true Alexandru Gheorghe (7): drm: fourcc: Convert drm_format_info kerneldoc to in-line member documentation drm/fourcc: Add char_per_block, block_w and block_h in drm_format_info drm/fourcc: Add fourcc for Mali linear tiled formats drm: mali-dp: Enable Mali-DP tiled buffer formats drm: Extend framebuffer_check to handle formats with cpp/char_per_block 0 drm/selftest: Refactor test-drm_plane_helper drm/selftests: Add tests for drm_format_info* helpers Brian Starkey (2): drm/fourcc: Add AFBC yuv fourccs for Mali drm/afbc: Add AFBC modifier usage documentation Documentation/gpu/afbc.rst | 233 ++++++++++++++ Documentation/gpu/drivers.rst | 1 + MAINTAINERS | 1 + drivers/gpu/drm/arm/malidp_hw.c | 14 +- drivers/gpu/drm/arm/malidp_planes.c | 23 +- drivers/gpu/drm/drm_fb_cma_helper.c | 21 +- drivers/gpu/drm/drm_fb_helper.c | 6 + drivers/gpu/drm/drm_fourcc.c | 87 ++++++ drivers/gpu/drm/drm_framebuffer.c | 11 +- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 2 +- drivers/gpu/drm/selftests/Makefile | 3 +- ...er_selftests.h => drm_modeset_selftests.h} | 3 + drivers/gpu/drm/selftests/test-drm_format.c | 290 ++++++++++++++++++ .../drm/selftests/test-drm_modeset_common.c | 11 +- .../drm/selftests/test-drm_modeset_common.h | 5 +- .../gpu/drm/selftests/test-drm_plane_helper.c | 19 +- include/drm/drm_fourcc.h | 89 +++++- include/uapi/drm/drm_fourcc.h | 31 ++ 18 files changed, 806 insertions(+), 44 deletions(-) create mode 100644 Documentation/gpu/afbc.rst rename drivers/gpu/drm/selftests/{drm_plane_helper_selftests.h => drm_modeset_selftests.h} (61%) create mode 100644 drivers/gpu/drm/selftests/test-drm_format.c