* [PATCH v2 1/2] drm/fourcc: Add missing half-float formats
2025-06-25 17:37 [PATCH v2 0/2] drm/fourcc: Add additional float formats Rob Clark
@ 2025-06-25 17:37 ` Rob Clark
2025-06-25 17:37 ` [PATCH v2 2/2] drm/fourcc: Add 32b float formats Rob Clark
2025-06-26 22:47 ` [PATCH v2 0/2] drm/fourcc: Add additional " Dmitry Baryshkov
2 siblings, 0 replies; 4+ messages in thread
From: Rob Clark @ 2025-06-25 17:37 UTC (permalink / raw)
To: dri-devel
Cc: freedreno, linux-arm-msm, Simona Vetter, Daniel Stone, Rob Clark,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, open list
Not something that is likely to be scanned out, but GPUs usually support
half-float formats with 1, 2, or possibly 3 components, and it is useful
to be able to import/export them with a valid fourcc, and/or use gbm to
create them.
These correspond to PIPE_FORMAT_{R16,R16G16,R16G16B16}_FLOAT in mesa.
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Acked-by: Simona Vetter <simona@ffwll.ch>
Acked-by: Daniel Stone <daniels@collabora.com>
---
include/uapi/drm/drm_fourcc.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index e41a3cec6a9e..3560ca1ffb8b 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -218,7 +218,7 @@ extern "C" {
#define DRM_FORMAT_ABGR16161616 fourcc_code('A', 'B', '4', '8') /* [63:0] A:B:G:R 16:16:16:16 little endian */
/*
- * Floating point 64bpp RGB
+ * Half-Floating point - 16b/component
* IEEE 754-2008 binary16 half-precision float
* [15:0] sign:exponent:mantissa 1:5:10
*/
@@ -228,6 +228,10 @@ extern "C" {
#define DRM_FORMAT_ARGB16161616F fourcc_code('A', 'R', '4', 'H') /* [63:0] A:R:G:B 16:16:16:16 little endian */
#define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H') /* [63:0] A:B:G:R 16:16:16:16 little endian */
+#define DRM_FORMAT_R16F fourcc_code('R', ' ', ' ', 'H') /* [15:0] R 16 little endian */
+#define DRM_FORMAT_GR1616F fourcc_code('G', 'R', ' ', 'H') /* [31:0] G:R 16:16 little endian */
+#define DRM_FORMAT_BGR161616F fourcc_code('B', 'G', 'R', 'H') /* [47:0] B:G:R 16:16:16 little endian */
+
/*
* RGBA format with 10-bit components packed in 64-bit per pixel, with 6 bits
* of unused padding per component:
--
2.49.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v2 2/2] drm/fourcc: Add 32b float formats
2025-06-25 17:37 [PATCH v2 0/2] drm/fourcc: Add additional float formats Rob Clark
2025-06-25 17:37 ` [PATCH v2 1/2] drm/fourcc: Add missing half-float formats Rob Clark
@ 2025-06-25 17:37 ` Rob Clark
2025-06-26 22:47 ` [PATCH v2 0/2] drm/fourcc: Add additional " Dmitry Baryshkov
2 siblings, 0 replies; 4+ messages in thread
From: Rob Clark @ 2025-06-25 17:37 UTC (permalink / raw)
To: dri-devel
Cc: freedreno, linux-arm-msm, Simona Vetter, Daniel Stone, Rob Clark,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, open list
Add 1, 2, 3, and 4 component 32b float formats, so that buffers with
these formats can be imported/exported with fourcc+modifier, and/or
created by gbm.
These correspond to PIPE_FORMAT_{R32,R32G32,R32G32B32,R32G32B32A32}_FLOAT
in mesa.
v2: Fix comment describing float32 layout [Sima]
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Acked-by: Simona Vetter <simona@ffwll.ch>
Acked-by: Daniel Stone <daniels@collabora.com>
---
include/uapi/drm/drm_fourcc.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 3560ca1ffb8b..6a3f1b32cb30 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -232,6 +232,16 @@ extern "C" {
#define DRM_FORMAT_GR1616F fourcc_code('G', 'R', ' ', 'H') /* [31:0] G:R 16:16 little endian */
#define DRM_FORMAT_BGR161616F fourcc_code('B', 'G', 'R', 'H') /* [47:0] B:G:R 16:16:16 little endian */
+/*
+ * Floating point - 32b/component
+ * IEEE 754-2008 binary32 float
+ * [31:0] sign:exponent:mantissa 1:8:23
+ */
+#define DRM_FORMAT_R32F fourcc_code('R', ' ', ' ', 'F') /* [31:0] R 32 little endian */
+#define DRM_FORMAT_GR3232F fourcc_code('G', 'R', ' ', 'F') /* [63:0] R:G 32:32 little endian */
+#define DRM_FORMAT_BGR323232F fourcc_code('B', 'G', 'R', 'F') /* [95:0] R:G:B 32:32:32 little endian */
+#define DRM_FORMAT_ABGR32323232F fourcc_code('A', 'B', '8', 'F') /* [127:0] R:G:B:A 32:32:32:32 little endian */
+
/*
* RGBA format with 10-bit components packed in 64-bit per pixel, with 6 bits
* of unused padding per component:
--
2.49.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2 0/2] drm/fourcc: Add additional float formats
2025-06-25 17:37 [PATCH v2 0/2] drm/fourcc: Add additional float formats Rob Clark
2025-06-25 17:37 ` [PATCH v2 1/2] drm/fourcc: Add missing half-float formats Rob Clark
2025-06-25 17:37 ` [PATCH v2 2/2] drm/fourcc: Add 32b float formats Rob Clark
@ 2025-06-26 22:47 ` Dmitry Baryshkov
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2025-06-26 22:47 UTC (permalink / raw)
To: dri-devel, Rob Clark
Cc: freedreno, linux-arm-msm, Simona Vetter, Daniel Stone,
David Airlie, linux-kernel, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann
On Wed, 25 Jun 2025 10:37:09 -0700, Rob Clark wrote:
> GPUs support 1/2/3/4 component f16 and f32 formats. Define the missing
> fourcc's needed to import/export these formats, and/or create with gbm.
>
> Rob Clark (2):
> drm/fourcc: Add missing half-float formats
> drm/fourcc: Add 32b float formats
>
> [...]
Applied to drm-misc-next, thanks!
[1/2] drm/fourcc: Add missing half-float formats
commit: e04c3521df073b688b9e9e2213cd3c588e3b6e68
[2/2] drm/fourcc: Add 32b float formats
commit: 3529cb5ab16b4f1f8bbc31dc39a1076a94bd1e38
Best regards,
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread