From patchwork Tue Apr 9 10:04:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13622101 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F0260CD1284 for ; Tue, 9 Apr 2024 10:04:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2C0AA10F3D2; Tue, 9 Apr 2024 10:04:44 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="TTF9k+Cq"; dkim-atps=neutral Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by gabe.freedesktop.org (Postfix) with ESMTPS id 82507112C22 for ; Tue, 9 Apr 2024 10:04:41 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 1F9BCC000A; Tue, 9 Apr 2024 10:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712657079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KeTCbI41YllG2juL/zynve9f30ih0GcjJDj1DkPkKmI=; b=TTF9k+CqN6Ksz6VxHxTbdOKvgJf5L0YdBPnhe6wIzd7Q4XuP/W/S991M4aMsLkFvgjquRf xChLrPFym6WV+JiMhfGdSnjY0wLl8XpXiJZSo0P5gXb5OgTflnSWxwUuwZA4Oj1GpMk/65 mDwNBrIjbkg8YlWZpTzMMByLLPYqi6nLSve0AuKH6IC80zQyQadEYAI2yxhY++pX+Qv+SG K4fd8KAiqNOaPrj6EqNHFlu5cerJzTDEDI+GqqDeRxsHfhOYy+5PUTL7lB41PzeEd+Bseu 19WUY6Zter37MgVAu8nrXwboKwgVZONxffiaTPOGK/4xUJxWA/2Z3VlhUOgXFA== From: Louis Chauvet Date: Tue, 09 Apr 2024 12:04:05 +0200 Subject: [PATCH 1/3] drm: drm_blend.c: Add precision in drm_rotation_simplify kernel doc MIME-Version: 1.0 Message-Id: <20240409-google-drm-doc-v1-1-033d55cc8250@bootlin.com> References: <20240409-google-drm-doc-v1-0-033d55cc8250@bootlin.com> In-Reply-To: <20240409-google-drm-doc-v1-0-033d55cc8250@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, seanpaul@google.com, marcheu@google.com, nicolejadeyee@google.com, pekka.paalanen@collabora.com, thomas.petazzoni@bootlin.com, Louis Chauvet X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1106; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=GnEAU3vkYSsIbjMvOqh2HX/HLaX5yQhIo1CxMvrQ8M8=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmFRK0T5sJ/qV58pufJn0nYKqJDIF72xUObkmnx 5IR9gxtloiJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZhUStAAKCRAgrS7GWxAs 4gbwEACFy6mN8LWaWNWfdR8fwy8cEvq+0zsS5jMExYL3bX2x+ZmAeyeGZ7XgiKzsyfqW9I+prA/ SxCwXidtl0btXPXW9rjBAoIUgCG6pGEn/5PDMXe1ThdrGvhYUiKVcFfP+GoZwqmGm2TdUlfqt5+ vOjGi4D+4mK9KmHXECS8gpl3KCP8zvdlr5WV0kRuWaXKWnNEO2hz31X+rp0c0XXxdd12gsAqocm k1m6kgxr3YWv4Utvyw2aKRftQBi16DEiaiAeO2qQ2ALqBRsOvQvcq/9preliWBbLx9RbOIxoL1P dzW+KLOunArMPjHq7W1AGHsrSjjMeaPL4TYr8UtPYNMAH4lKRH5MmwuxHsh0+bLonWBwe6IX92L V0ipY/5MjeRlcQfKCtLyVNfWblEeqAMs+9H5k2uwORjMnYOuOWa08kvtApV5hQ17DfrKBYHGOSb P8WML+UbgtF8RBRqd53HgSj+gD6uZoCDtYpZsRKcpTbcAiYDZOfYurNw8TRdWR51fmM+gheTfaL ePSitse5QkWlodA+6XFpsNCJymekxkYR6gCvwRILVhUv8Xpi4h95yGsWyzkKWfPTsehcr/sfsze Crzn0TmG526BDYUTpJe394pJg8ponoPrsoO/p1MTm706m1fK8ZB/1u5GWpDnPipa2nMsx5SE+CY r+xhRl/TZjAFH2w== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As the function uses non-trivial bit operations, add a little paragraph to describe what is the expected behavior. Signed-off-by: Louis Chauvet Reviewed-by: Bagas Sanjaya --- drivers/gpu/drm/drm_blend.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c index 6e74de833466..8d4b317eb9d7 100644 --- a/drivers/gpu/drm/drm_blend.c +++ b/drivers/gpu/drm/drm_blend.c @@ -321,6 +321,11 @@ EXPORT_SYMBOL(drm_plane_create_rotation_property); * transforms the hardware supports, this function may not * be able to produce a supported transform, so the caller should * check the result afterwards. + * + * If the rotation is not fully supported, this function will add a rotation of 180 + * (ROTATE_90 would become ROTATE_270) and add a reflection on X and Y. + * The resulting transformation is the same (REFLECT_X | REFLECT_Y | ROTATE_180 + * is a no-op), but some unsupported flags are removed. */ unsigned int drm_rotation_simplify(unsigned int rotation, unsigned int supported_rotations) From patchwork Tue Apr 9 10:04:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13622104 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A06AC67861 for ; Tue, 9 Apr 2024 10:04:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 14D31112C47; Tue, 9 Apr 2024 10:04:54 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="ZRrq0sSa"; dkim-atps=neutral Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by gabe.freedesktop.org (Postfix) with ESMTPS id E6B2C112C3D for ; Tue, 9 Apr 2024 10:04:41 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id CD693C0008; Tue, 9 Apr 2024 10:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712657080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fmoK2saX48Z7BaAk8XIAqhHfqZyQB83Bo3eVwyIjC00=; b=ZRrq0sSas7zBBUrm6THO4/o98Kj6Gv2TR+QnfXpJTXGYUWcrMouQNkQtPKPxwIzTPMagpG HMgSs9dF5X2LWM1PuPA2YsPAtEnBZ+mieM6h6lMYRJc3fWiyUzgDPLibijEZ6LUlFIC1FI Rafq5ztB80pWPA9g4UPYXnaYJwMsKfz/3d5XychhhgyDVKh95nGibDpxDhaO67sG8Efm3R DdelqAoryNQG0W5MXAn35vwseu7pUMmHOJGjeA+vkGVgX3K1n0ITBltJfC+vSw5vdQFjKD Zwg79FZUS4oNGivgLrc2H6eacSFzIItmQ0iZCxONp1AhJTRUNlyvPJ0Z4vDY5w== From: Louis Chauvet Date: Tue, 09 Apr 2024 12:04:06 +0200 Subject: [PATCH 2/3] drm: drm_blend.c: Improve drm_plane_create_rotation_property kernel doc MIME-Version: 1.0 Message-Id: <20240409-google-drm-doc-v1-2-033d55cc8250@bootlin.com> References: <20240409-google-drm-doc-v1-0-033d55cc8250@bootlin.com> In-Reply-To: <20240409-google-drm-doc-v1-0-033d55cc8250@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, seanpaul@google.com, marcheu@google.com, nicolejadeyee@google.com, pekka.paalanen@collabora.com, thomas.petazzoni@bootlin.com, Louis Chauvet X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2944; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=p9nxB4AmLrlY4zWIcrP/uy/FSacfcNG8RxwAEAEEXDI=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmFRK1GE/Zfoq0FQBmC5eluz1pdZw5EyewevzkT 8ImCpzVqgmJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZhUStQAKCRAgrS7GWxAs 4i6JD/4yVdG5z/8ZTrn1U4lG/4s67XBOGXJgD80d/hDeXG1bt7N01LbtWsJ8vnory9361X7Mz7S iiPZ7kqzQMOv40mTNt6FUUWTuGT4qAaLPGWEbiJCAt15ppISdB+dey28Lealqv3PfGYcBrIM8Fv OgrJILVs3WCiYKWz1DmzTEVfZv6C6fkbqSYqoe9Cx0/Hyhrmk09CBBZgNldQ1W6sabfesMvlMbz bo7ZMJA3ej/XZxnksHu0ykTg57iwl9ddUtQE3OZ5gv9sfCfvKfGDj4tUL+/Yx4K05rcU7kfnP/g P98hTuIJqS6g7758fJweQzXhzAa2vKvl5A96V49VwRQG1Zt4cxJHlFCquTct48/XKi3nirl8Xss SCxCzOUePtI9Sn+j89pBjjXwL5QEV7VJMt7zTJr1DBMn8rUx9XaQw9Gc6tWAFsoKlKJyCb9hDff Xzv77Nkld/hUvny38BL+aqeQnfoD+kIlSbsdH8EXfHPL/tGqtT8fSdDwuUQqsIuY/RAqwmqYZMt ZzVPWQd0StIm4nIuE52f3g68L86eG9eOsW8x3l4hNqbDhY2he9198/8B9t7VkWjK8YhrGE5b7CA xQGzpPRJX12xTPCcPcTCO1U9lp2Jk+hFKAgJjsAh99jGe6L1N1bcmcn7b0mZ+j9Nebe0YIKOKA1 M/9rVWEgL5U7hjA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The expected behavior of the rotation property was not very clear. Add more examples to explain what is the expected result. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/drm_blend.c | 52 +++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c index 8d4b317eb9d7..6fbb8730d8b0 100644 --- a/drivers/gpu/drm/drm_blend.c +++ b/drivers/gpu/drm/drm_blend.c @@ -104,6 +104,9 @@ * Without this property the rectangle is only scaled, but not rotated or * reflected. * + * See drm_plane_create_rotation_property() for details about the expected rotation and + * reflection behavior. + * * Possbile values: * * "rotate-": @@ -114,18 +117,6 @@ * Signals that the contents of a drm plane is reflected along the * axis, in the same way as mirroring. * - * reflect-x:: - * - * |o | | o| - * | | -> | | - * | v| |v | - * - * reflect-y:: - * - * |o | | ^| - * | | -> | | - * | v| |o | - * * zpos: * Z position is set up with drm_plane_create_zpos_immutable_property() and * drm_plane_create_zpos_property(). It controls the visibility of overlapping @@ -266,8 +257,41 @@ EXPORT_SYMBOL(drm_plane_create_alpha_property); * * Rotation is the specified amount in degrees in counter clockwise direction, * the X and Y axis are within the source rectangle, i.e. the X/Y axis before - * rotation. After reflection, the rotation is applied to the image sampled from - * the source rectangle, before scaling it to fit the destination rectangle. + * rotation. + * + * Here are some examples of rotation and reflections: + * + * |o +| REFLECT_X |+ o| + * | | ========> | | + * | | | | + * + * |o | REFLECT_Y |+ | + * | | ========> | | + * |+ | |o | + * + * |o +| ROTATE_90 |+ | + * | | ========> | | + * | | |o | + * + * |o | ROTATE_180 | +| + * | | ========> | | + * |+ | | o| + * + * |o | ROTATE_270 |+ o| + * | | ========> | | + * |+ | | | + * + * Rotation and reflection can be combined to handle more situations. In this condition, the + * reflection is applied first and the rotation in second. + * + * For example the expected result for DRM_MODE_ROTATE_90 | DRM_MODE_REFLECT_X is: + * + * |o +| REFLECT_X |+ o| ROTATE_90 |o | + * | | ========> | | ========> | | + * | | | | |+ | + * + * It is not possible to pass multiple rotation at the same time. (i.e ROTATE_90 | ROTATE_180 is + * not the same as ROTATE_270 and is not accepted). */ int drm_plane_create_rotation_property(struct drm_plane *plane, unsigned int rotation, From patchwork Tue Apr 9 10:04:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13622103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5A1DC67861 for ; Tue, 9 Apr 2024 10:04:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF894112C3D; Tue, 9 Apr 2024 10:04:45 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="QJc24gR+"; dkim-atps=neutral Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by gabe.freedesktop.org (Postfix) with ESMTPS id AA98F112C47 for ; Tue, 9 Apr 2024 10:04:42 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 95F33C0011; Tue, 9 Apr 2024 10:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712657081; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VaOfMtUooEBbcTUX3ySQvIrI0XekY4PkXHzJqdiW8Do=; b=QJc24gR+EXPcui/smHnpzu+Iyl0fuhh4pXJnOtuggGfG9A8hmU6oIIUMFDk+AM7gqRCVOe moo86y2k7ZTh6yHYSGXG6xew/rlTlEisKSupG68sd8dVYxDjrXVdEsxWgx8PCdy0HDzp8S aJaJL+zrJ76sZBor5k3l0+/Z6ahq7l+yBKcKGY/GHksEAaebdtuBtFN+tdV/hsAgAll8h5 PECQCJjSoxj0wUowUdY+VstshOb+ZSFvw5YqriQYCP/vIdxqupAnmE07NPvtfEwWCkwBZN qg4M05eQ2Xk2Y6QN3dFkhDJAtuOd4E07KFvjo7U0OFmeKylztBHmUmdhjaakzA== From: Louis Chauvet Date: Tue, 09 Apr 2024 12:04:07 +0200 Subject: [PATCH 3/3] drm/fourcc: Add documentation around drm_format_info MIME-Version: 1.0 Message-Id: <20240409-google-drm-doc-v1-3-033d55cc8250@bootlin.com> References: <20240409-google-drm-doc-v1-0-033d55cc8250@bootlin.com> In-Reply-To: <20240409-google-drm-doc-v1-0-033d55cc8250@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, seanpaul@google.com, marcheu@google.com, nicolejadeyee@google.com, pekka.paalanen@collabora.com, thomas.petazzoni@bootlin.com, Louis Chauvet X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3487; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=p9bWfzVhPSbxnan4gt/J8np1umoCeXuce2K3EFa4g9o=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmFRK1SSdf8m+PrFjNQ3393GV2MGNqtQp/i5TiL IsTjcumGhaJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZhUStQAKCRAgrS7GWxAs 4msAEACt6PBybYnO/0WibFTqCZSNQrho5XGmeeAUcpdpp9btXh0I2bQxxAqFRZgJG9iEnEJF2mo oePi6L0iTBRMesI/C/EP/XQbz+zD9lQhcxirWahCwz4yzDIJzkilX7WQ6Gd4yeBr1hQt0McLZvp AyXdUUrAMBMhu2hug+k205Q5+AdpIWF+zqaspIPSTarIgVoZc+oYo9e5mt3fkvUKr4ZYybFUIRh L+XQ9zd6Gdkx1QwLhnDNEu+OKv6YeITTQaqjld/Cz3ooXGBvd7e7D8sOTVENbDV49QODwjElgHh n95tUFT2Gzk1F5Tkmomd6pC+L+cv1Y/eJFLMGkaPhUImP/GvtlRfmUS0DpsSdULJvx8m5qpkDZo Pe6te1cbxdbGrH5A11iKW4t3Ckkr3wEYJOULKi2nXNWbQii+CbGX+TE+jAHNRrxE0/drcJOa4X6 XLestlDulUHC2Zon0gw86eVhVtdODOQVQoDV//J2sIxoGEB1Rf2F9UMqv6dosrBA1puYjukI77v Y4V2JLU58fV0Ph06I9PGN8nAlUFM0h1tZbGUFXRIah7C3wjFIpq84ea8KMTLoyEB3yiBZsuHu08 t/IKIoQ2Fb1q2Wo1w/EERvSIx5xzxbKfmqX4x4ABmbw1lETyMUUCT8QjvAScJuk6959UYdr4UB1 HqKRZRmEfQTNkGQ== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Let's provide more details about the drm_format_info structure because its content may not be straightforward for someone not used to video formats and drm internals. Signed-off-by: Louis Chauvet --- include/drm/drm_fourcc.h | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index ccf91daa4307..66cc30e28f79 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h @@ -58,6 +58,44 @@ struct drm_mode_fb_cmd2; /** * struct drm_format_info - information about a DRM format + * + * A drm_format_info describes how planes and pixels are stored in memory. + * + * Some format like YUV can have multiple planes, counted in @num_planes. It + * means that a full pixel can be stored in multiple non-continuous buffers. + * For example, NV12 is a YUV format using two planes: one for the Y values and + * one for the UV values. + * + * On each plane, the "pixel" unit can be different in case of subsampling. For + * example with the NV12 format, a pixel in the UV plane is used for four pixels + * in the Y plane. + * The fields @hsub and @vsub are the relation between the size of the main + * plane and the size of the subsampled planes in pixels: + * plane[0] width = hsub * plane[1] width + * plane[0] height = vsub * plane[1] height + * + * In some formats, pixels are not independent in memory. It can be a packed + * representation to store more pixels per byte (for example P030 uses 4 bytes + * for three 10 bit pixels). It can also be used to represent tiled formats, + * where a continuous buffer in memory can represent a rectangle of pixels (for + * example, in DRM_FORMAT_Y0L0, a buffer of 8 bytes represents a 2x2 pixel + * region of the picture). + * The field @char_per_block is the size of a block on a specific plane, in + * bytes. + * The fields @block_w and @block_h are the size of a block in pixels. + * + * The older format representation (which only uses @cpp, kept for historical + * reasons because there are a lot of places in drivers where it's used) is + * assuming that a block is always 1x1 pixel. + * + * To keep the compatibility with older format representations and treat block + * and non-block formats in the same way one should use: + * - @char_per_block to access the size of a block on a specific plane, in + * bytes. + * - drm_format_info_block_width() to access the width of a block of a + * specific plane, in pixels. + * - drm_format_info_block_height() to access the height of a block of a + * specific plane, in pixels. */ struct drm_format_info { /** @format: 4CC format identifier (DRM_FORMAT_*) */ @@ -97,13 +135,6 @@ struct drm_format_info { * formats for which the memory needed for a single pixel is not * byte aligned. * - * @cpp has been kept for 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