mirror-linux/Documentation
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
..
ABI Linux 6.17-rc6 2025-09-15 17:51:07 +10:00
PCI selftests: pci_endpoint: Add doorbell test case 2025-07-24 16:51:47 -05:00
RCU rcu: Document concurrent quiescent state reporting for offline CPUs 2025-07-22 17:10:50 +05:30
accel Documentation: accel: amdxdna: Update compiler information 2025-08-21 08:25:31 -07:00
accounting delaytop: enhance error logging and add PSI feature description 2025-08-02 12:01:41 -07:00
admin-guide Mitigate VMSCAPE issue with indirect branch predictor flushes 2025-09-10 20:52:16 -07:00
arch It has been a relatively busy cycle for docs, especially the build system: 2025-07-31 08:36:51 -07:00
block
bpf
cdrom cdrom: Call cdrom_mrw_exit from cdrom_release function 2025-07-22 19:10:17 -06:00
core-api module: Rename EXPORT_SYMBOL_GPL_FOR_MODULES to EXPORT_SYMBOL_FOR_MODULES 2025-08-11 16:16:36 +02:00
cpu-freq
crypto crypto: engine - remove {prepare,unprepare}_crypt_hardware callbacks 2025-07-18 20:52:00 +10:00
dev-tools Networking changes for 6.17. 2025-07-30 08:58:55 -07:00
devicetree dt-bindings: display: imx: add HDMI PAI for i.MX8MP 2025-09-29 09:46:02 +08:00
doc-guide
driver-api cxl for v6.17 2025-08-01 15:47:06 -07:00
edac
fault-injection docs: fault-injection: drop reference to md-faulty 2025-07-24 08:31:46 -06:00
fb
features
filesystems f2fs-for-6.17-rc1 2025-08-04 16:27:21 -07:00
firmware-guide Merge branch 'acpi-misc' 2025-07-22 17:12:57 +02:00
firmware_class
fpga
gpu drm/dumb-buffers: Provide helper to set pitch and size 2025-09-29 13:57:43 +02:00
hid
hwmon hwmon updates for v6.17 2025-07-31 13:34:06 -07:00
i2c
iio docs: iio: add ADXL313 accelerometer 2025-07-14 19:20:50 +01:00
images
infiniband
input Input: Add and document BTN_GRIP* 2025-07-27 01:41:20 -07:00
isdn
kbuild docs: kconfig: add alldefconfig to the all*configs 2025-07-26 15:31:29 +09:00
kernel-hacking
leds
litmus-tests
livepatch
locking
maintainer
mhi
misc-devices
mm Summary of significant series in this pull request: 2025-07-31 14:57:54 -07:00
netlabel
netlink netlink: specs: mptcp: fix if-idx attribute type 2025-09-09 18:39:52 -07:00
networking linux-can-fixes-for-6.17-20250910 2025-09-10 19:29:40 -07:00
nvdimm
nvme docs: nvme: fix grammar in nvme-pci-endpoint-target.rst 2025-07-17 13:38:07 +02:00
pcmcia
peci
power Merge branches 'pm-runtime' and 'pm-powercap' 2025-07-22 18:01:15 +02:00
process Documentation: smooth the text flow in the security bug reporting process 2025-08-17 12:23:30 +02:00
rust
scheduler sched_ext: Changes for v6.17 2025-07-31 16:29:46 -07:00
scsi
security hardening updates for v6.17-rc1 2025-07-28 17:16:12 -07:00
sound ALSA: docs: Add documents for recently changes in snd-usb-audio 2025-08-29 11:17:35 +02:00
sphinx sphinx: kernel_abi: fix performance regression with O=<dir> 2025-07-24 08:36:17 -06:00
sphinx-static
spi
staging
sunrpc/xdr
target
tee
timers
tools tracing tools changes for 6.17: 2025-08-01 10:23:13 -07:00
trace tracing changes for 6.17 2025-08-01 10:29:36 -07:00
translations Summary of significant series in this pull request: 2025-07-31 14:57:54 -07:00
usb It has been a relatively busy cycle for docs, especially the build system: 2025-07-31 08:36:51 -07:00
userspace-api iommufd: Fix spelling errors in iommufd.rst 2025-08-18 11:15:06 -03:00
virt Documentation: KVM: Use unordered list for pre-init VGIC registers 2025-07-29 13:43:50 -04:00
w1
watchdog
wmi
.gitignore
Changes
CodingStyle
Kconfig
Makefile
SubmittingPatches
atomic_bitops.txt
atomic_t.txt
conf.py
docutils.conf
index.rst
memory-barriers.txt
subsystem-apis.rst