All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] drm/plane: Add documentation about software color conversion.
@ 2023-08-25 14:04 Jocelyn Falempe
  2023-08-25 14:14 ` Maxime Ripard
                   ` (3 more replies)
  0 siblings, 4 replies; 26+ messages in thread
From: Jocelyn Falempe @ 2023-08-25 14:04 UTC (permalink / raw)
  To: tzimmermann, airlied, maarten.lankhorst, mripard, daniel,
	ppaalanen, javierm, contact
  Cc: Jocelyn Falempe, dri-devel

After discussions on IRC, the consensus is that the DRM drivers should
avoid software color conversion, and only advertise the formats supported
by hardware.
Update the doc accordingly so that the rule and exceptions are clear for
everyone.

Acked-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
---
 drivers/gpu/drm/drm_plane.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 24e7998d1731..d05642033202 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -140,6 +140,30 @@
  *     DRM_FORMAT_MOD_LINEAR. Before linux kernel release v5.1 there have been
  *     various bugs in this area with inconsistencies between the capability
  *     flag and per-plane properties.
+ *
+ *     All drivers should support XRGB8888, even if the hardware cannot support
+ *     it. This has become the de-facto standard and a lot of user-space assume
+ *     it will be present. If XRGB8888 is not natively supported, then it
+ *     shouldn't be the default for preferred depth or fbdev emulation.
+ *
+ *     DRM drivers should not do software color conversion, and
+ *     only advertise the formats they support in hardware. This is for
+ *     performance reason, and to avoid multiple conversions in userspace and
+ *     kernel space. KMS page flips are generally expected to be very cheap
+ *     operations.
+ *
+ *     But there are two exceptions only for dumb buffers:
+ *     * To support XRGB8888 if it's not supported by the hardware.
+ *     * Any driver is free to modify its internal representation of the format,
+ *       as long as it doesn't alter the visible content in any way, and doesn't
+ *       modify the user-provided buffer. An example would be to drop the
+ *       padding component from a format to save some memory bandwidth.
+ *     On most hardware, VRAM read access are slow, so when doing the software
+ *     conversion, the dumb buffer should be allocated in system RAM in order to
+ *     have decent performance.
+ *     Extra care should be taken when doing software conversion with
+ *     DRM_CAP_DUMB_PREFER_SHADOW, there are more detailed explanations here:
+ *     https://lore.kernel.org/dri-devel/20230818162415.2185f8e3@eldfell/
  */
 
 static unsigned int drm_num_planes(struct drm_device *dev)

base-commit: 82d750e9d2f5d0594c8f7057ce59127e701af781
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2023-09-13 17:02 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-25 14:04 [PATCH v3] drm/plane: Add documentation about software color conversion Jocelyn Falempe
2023-08-25 14:14 ` Maxime Ripard
2023-08-25 14:25 ` Javier Martinez Canillas
2023-08-28  7:35 ` Pekka Paalanen
2023-09-08  9:21 ` Thomas Zimmermann
2023-09-08 10:58   ` Maxime Ripard
2023-09-08 13:22     ` Thomas Zimmermann
2023-09-08 13:27       ` Simon Ser
2023-09-08 13:46       ` Javier Martinez Canillas
2023-09-08 14:06         ` Jocelyn Falempe
2023-09-08 14:13           ` Thomas Zimmermann
2023-09-08 14:09         ` Thomas Zimmermann
2023-09-08 11:16   ` Pekka Paalanen
2023-09-08 13:56     ` Thomas Zimmermann
2023-09-08 14:41       ` Pekka Paalanen
2023-09-08 15:10         ` Thomas Zimmermann
2023-09-11  8:38           ` Pekka Paalanen
2023-09-11 10:18             ` Thomas Zimmermann
2023-09-12 15:57             ` Michel Dänzer
2023-09-13  8:14               ` Jocelyn Falempe
2023-09-13 17:02                 ` Michel Dänzer
2023-09-08 14:48       ` Jocelyn Falempe
2023-09-08 15:37         ` Thomas Zimmermann
2023-09-11 10:05           ` Jocelyn Falempe
2023-09-11 10:44             ` Thomas Zimmermann
2023-09-11 11:14           ` Maxime Ripard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.