From patchwork Mon Oct 29 17:14:32 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: 10659813 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 2A1C51734 for ; Mon, 29 Oct 2018 17:14:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2003629D7C for ; Mon, 29 Oct 2018 17:14:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 136A229D7F; Mon, 29 Oct 2018 17:14:40 +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=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 566EF29D7C for ; Mon, 29 Oct 2018 17:14:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B8EE36E049; Mon, 29 Oct 2018 17:14:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0077.outbound.protection.outlook.com [104.47.2.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9AD506E049 for ; Mon, 29 Oct 2018 17:14:34 +0000 (UTC) Received: from DB6PR0802MB2551.eurprd08.prod.outlook.com (10.172.251.149) by DB6PR0802MB2613.eurprd08.prod.outlook.com (10.172.252.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.25; Mon, 29 Oct 2018 17:14:32 +0000 Received: from DB6PR0802MB2551.eurprd08.prod.outlook.com ([fe80::19ca:93bb:bc0:985a]) by DB6PR0802MB2551.eurprd08.prod.outlook.com ([fe80::19ca:93bb:bc0:985a%7]) with mapi id 15.20.1273.027; Mon, 29 Oct 2018 17:14:32 +0000 From: Alexandru-Cosmin Gheorghe To: "seanpaul@chromium.org" , "airlied@linux.ie" , "dri-devel@lists.freedesktop.org" , Liviu Dudau , Brian Starkey , "malidp@foss.arm.com" , "maxime.ripard@bootlin.com" , "maarten.lankhorst@linux.intel.com" , Ayan Halder , "daniel.vetter@ffwll.ch" , Raymond Smith , David Garbett , Lisa Wu , Matt Szczesiak , Charles Xu , "james qian wang (Arm Technology China)" Subject: [PATCH v6 0/9] Add method to describe tile/bit_level_packed formats Thread-Topic: [PATCH v6 0/9] Add method to describe tile/bit_level_packed formats Thread-Index: AQHUb6rb0QeCOtR6U0eQdoRppZR6jg== Date: Mon, 29 Oct 2018 17:14:32 +0000 Message-ID: <20181029171419.4512-1-alexandru-cosmin.gheorghe@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0032.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:61::20) To DB6PR0802MB2551.eurprd08.prod.outlook.com (2603:10a6:4:a1::21) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [217.140.106.54] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0802MB2613; 6:gGLXTZRD7wtay5CuET86gvRHkGJa6GlpGeEODDqMGdqM4HvbJyaPAicoicADcN/zv1pid7M4oEQr9Elv5/pIK44s23As7ERuxZPYQs+ufY/kmk6YqdFrQYP952OWJvXA6oAeOGZ8O4WF26NuNWzr3Z2z6eHwdo5yqCCYo3W6i/5HgNR9pwBN33/zRLbG0ot2cebxC50adQUodyB4P1rFQfDQAq/y+hZ6y49AeNCx+RnzBf7SHxPihWG1T9Wf+IEFi3Q0Gy9F7NRcbtLrBEQITuFVoSq8HFcsv+Tl6JKUPpJDHhIS31PXtOlwJuPTYjlMjZkSfUDiuw0YKjezRo1hTZdYP0S6O6cB9jOqRSGpEd7rNVd1J2i+o/b2FMMWUdz2DAY2VQd0hXzapeIJOwFI7m2+hEdCEiPlTipNE3oU8uQ7wJQBbk5I2nDfDDZsiKbuTsGziKFJnYu2woxFlW6m/A==; 5:jKdJOEycAm0/W8lZ5ihVLOWN89WaLpN9DlmceWSIN2yOLhXtmOWqlMX8idkgkRDJhHO7Kfr7+tXuH2ZPupNEp1LUA4GTR1oPpGtE3+jbQ1JxXwWx4V+H7NnhtO3ve4YG+vMkRL1//wigVcSG/DPcOTXN2qxa3OFlnkiCnjjU0j8=; 7:bVbr4LirN5WTeSvOyiXndf7KAYrNQCCxhVDVj3/ilmqDKMwIeXO921kXa/uz3z1M6sSpc/hGPFfy2WrLtSKzuKwcYGDf3yuvgu2CI2thnBWWv6XgsS3FxqPCz9VMXV5raZesUeeFwWy3kXA5Kxf+Ew== x-ms-office365-filtering-correlation-id: 979f29bf-55cd-4f9a-14ee-08d63dc1fdd0 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0802MB2613; x-ms-traffictypediagnostic: DB6PR0802MB2613: nodisclaimer: True 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)(3231382)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:DB6PR0802MB2613; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0802MB2613; x-forefront-prvs: 084080FC15 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(346002)(396003)(39860400002)(376002)(366004)(199004)(189003)(86362001)(8676002)(6512007)(6436002)(25786009)(186003)(106356001)(105586002)(5660300001)(6636002)(81166006)(36756003)(81156014)(110136005)(71200400001)(71190400001)(486006)(53936002)(6306002)(54906003)(316002)(2616005)(2900100001)(476003)(305945005)(4326008)(7736002)(2201001)(8936002)(66066001)(5250100002)(966005)(478600001)(68736007)(2501003)(26005)(6506007)(386003)(99286004)(256004)(102836004)(72206003)(97736004)(6486002)(14454004)(6116002)(52116002)(2906002)(3846002)(1076002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0802MB2613; H:DB6PR0802MB2551.eurprd08.prod.outlook.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-antispam-message-info: ByqX9fhE7k6RrIAC8/MgLk+YF7FGFHAokCszWpnkaTiRON8p/EAFyIQIEYCYqv8myX4tvu333/EWVUZ0tssItvpAnOlsu6XOj06iTy/i7edNVQJglbYTI5aNGJF92ObyDgMaM5n1ouA9dNsgxVpnPC2FFenCynw4S1oNm0T84zCl2B81AXA++VoK0rmtoUPT/vXcADyU5qsT+hS3lZPVltuhUm3vARYdcVT9QzLM0hiRrKFZhEsMXsdKmg8cyAm5SiZeH9uOX4dk/QK5L+27ty4sf/VGdhbyzM2Awd9pBT+YrWygPU63aEHqW+JB7eboKaqGOnhXT0fRoXYrkumwwdcu3i4FSI6tPUm+r0DDPq8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 979f29bf-55cd-4f9a-14ee-08d63dc1fdd0 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Oct 2018 17:14:32.1453 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2613 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 , Alexandru-Cosmin Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Changes since v5: - Added selftests for drm_internal_framebuffer_create - Added a macro to export internal function only when DRM_DEBUG_SELFTEST is enabled, suggested by Daniel Vetter, here [5]. - Cosmetic fixes suggested by Brian Starkey. - Rebased against drm-misc-next 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 [5] https://www.spinics.net/lists/dri-devel/msg193422.html v5: https://www.spinics.net/lists/dri-devel/msg193384.html Alexandru Gheorghe (7): 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/selftests: Add tests for drm_format_info* helpers drm: Add macro to export functions only when CONFIG_DRM_DEBUG_SELFTEST is enabled drm/selftests: Add tests for drm_internal_framebuffer_create 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 | 28 +- drivers/gpu/drm/drm_fb_cma_helper.c | 20 +- drivers/gpu/drm/drm_fb_helper.c | 6 + drivers/gpu/drm/drm_fourcc.c | 87 +++++ drivers/gpu/drm/drm_framebuffer.c | 13 +- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 2 +- drivers/gpu/drm/selftests/Makefile | 3 +- .../gpu/drm/selftests/drm_modeset_selftests.h | 4 + drivers/gpu/drm/selftests/test-drm_format.c | 290 +++++++++++++++ .../gpu/drm/selftests/test-drm_framebuffer.c | 344 ++++++++++++++++++ .../drm/selftests/test-drm_modeset_common.h | 4 + include/drm/drmP.h | 6 + include/drm/drm_fourcc.h | 61 +++- include/uapi/drm/drm_fourcc.h | 31 ++ 18 files changed, 1132 insertions(+), 16 deletions(-) create mode 100644 Documentation/gpu/afbc.rst create mode 100644 drivers/gpu/drm/selftests/test-drm_format.c create mode 100644 drivers/gpu/drm/selftests/test-drm_framebuffer.c