mirror-linux/Documentation/gpu
Thomas Zimmermann fb24aaf541 drm/dumb-buffers: Provide helper to set pitch and size
Add drm_modes_size_dumb(), a helper to calculate the dumb-buffer
scanline pitch and allocation size. Implementations of struct
drm_driver.dumb_create can call the new helper for their size
computations.

There is currently quite a bit of code duplication among DRM's
memory managers. Each calculates scanline pitch and buffer size
from the given arguments, but the implementations are inconsistent
in how they treat alignment and format support. Later patches will
unify this code on top of drm_mode_size_dumb() as much as possible.

drm_mode_size_dumb() uses existing 4CC format helpers to interpret
the given color mode. This makes the dumb-buffer interface behave
similar the kernel's video= parameter. Current per-driver implementations
again likely have subtle differences or bugs in how they support color
modes.

The dumb-buffer UAPI is only specified for known color modes. These
values describe linear, single-plane RGB color formats or legacy index
formats. Other values should not be specified. But some user space
still does. So for unknown color modes, there are a number of known
exceptions for which drm_mode_size_dumb() calculates the pitch from
the bpp value, as before. All other values work the same but print
an error.

v6:
- document additional use cases for DUMB_CREATE2 in TODO list (Tomi)
- fix typos in documentation (Tomi)
v5:
- check for overflows with check_mul_overflow() (Tomi)
v4:
- use %u conversion specifier (Geert)
- list DRM_FORMAT_Dn in UAPI docs (Geert)
- avoid dmesg spamming with drm_warn_once() (Sima)
- add more information about bpp special case (Sima)
- clarify parameters for hardware alignment
- add a TODO item for DUMB_CREATE2
v3:
- document the UAPI semantics
- compute scanline pitch from for unknown color modes (Andy, Tomi)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://lore.kernel.org/r/20250821081918.79786-3-tzimmermann@suse.de
2025-09-29 13:57:43 +02:00
..
amdgpu docs: gpu: amdgpu: Fix spelling in amdgpu documentation 2025-08-27 13:57:48 -04:00
bridge
dp-mst
imagination drm/imagination: Numerous documentation fixes. 2023-11-28 18:56:03 +01:00
nova Documentation: gpu: nova-core: Document basics of the Falcon 2025-07-09 00:19:17 +02:00
rfc drm/gpusvm, drm/pagemap: Move migration functionality to drm_pagemap 2025-06-26 18:00:07 +02:00
xe drm/xe/doc: Document device wedged and runtime survivability 2025-08-26 10:11:34 -04:00
afbc.rst
automated_testing.rst drm/ci: enable lockdep detection 2025-03-12 08:16:31 +05:30
backlight.rst
driver-uapi.rst drm: Add UAPI for the Asahi driver 2025-04-08 17:15:57 -04:00
drivers.rst Nova changes for v6.15 2025-03-13 06:03:55 +10:00
drm-client.rst drm/client: Move client event handlers to drm_client_event.c 2024-10-18 09:23:03 +02:00
drm-compute.rst kernel/cgroup: Add "dmem" memory accounting cgroup 2025-01-06 17:24:38 +01:00
drm-internals.rst drm/doc: Document KUnit expectations 2025-02-26 16:04:15 +01:00
drm-kms-helpers.rst drm/display: hdmi: Create documentation section 2025-03-14 09:21:03 +01:00
drm-kms.rst drm/panic: Add a drm panic handler 2024-04-15 16:12:49 +02:00
drm-mm.rst Documentation/gpu: VM_BIND locking document 2023-11-29 20:54:43 +01:00
drm-uapi.rst drm: Add a vendor-specific recovery method to drm device wedged uevent 2025-08-26 10:11:34 -04:00
drm-usage-stats.rst Documentation/gpu: Clarify format of driver-specific fidnfo keys 2025-02-07 15:22:46 +01:00
drm-vm-bind-async.rst
drm-vm-bind-locking.rst Documentation/gpu: VM_BIND locking document 2023-11-29 20:54:43 +01:00
i915.rst drm/i915/flipq: Provide the nuts and bolts code for flip queue 2025-06-27 15:54:43 +03:00
implementation_guidelines.rst Documentation/gpu: VM_BIND locking document 2023-11-29 20:54:43 +01:00
index.rst drm/doc: Include new drm-compute documentation 2025-01-15 09:45:54 +01:00
introduction.rst MAINATINERS: update drm maintainer contacts 2024-09-03 20:07:57 +02:00
kms-properties.csv drm/connector: hdmi: Add Broadcast RGB property 2024-05-28 10:24:37 +02:00
komeda-kms.rst Documentation/gpu: Fix typo in Documentation/gpu/komeda-kms.rst 2024-09-05 14:33:06 -06:00
mcde.rst
meson.rst
msm-crash-dump.rst
msm-preemption.rst Documentation: document adreno preemption 2024-10-04 08:47:29 -07:00
nouveau.rst Documentation: nouveau: Update GSP message queue kernel-doc reference 2025-06-13 16:46:35 +02:00
panfrost.rst drm/panfrost: Replace fdinfo's profiling debugfs knob with sysfs 2024-03-11 13:27:10 +01:00
panthor.rst Documentation/gpu: Add fdinfo meanings of panthor-*-memory tags 2025-02-07 15:23:39 +01:00
pl111.rst
tegra.rst
todo.rst drm/dumb-buffers: Provide helper to set pitch and size 2025-09-29 13:57:43 +02:00
tve200.rst
v3d.rst
vc4.rst
vga-switcheroo.rst
vgaarbiter.rst Documentation: vgaarbiter: Fix grammar 2025-03-19 15:11:49 +01:00
vkms.rst drm/vkms: Add how to run the Kunit tests 2025-05-28 16:19:14 +02:00
xen-front.rst
zynqmp.rst drm: xlnx: zynqmp_dpsub: Fix kernel doc 2025-01-16 12:45:16 +01:00