[PATCH 0/4] drm/vkms: speed up composition with a precomputed gamma LUT
From: Oarora Etimis
Date: Sun Nov 08 2026 - 14:33:24 EST
Four patches: a fix so that a frame takes the gamma LUT from the state it
is built from, a table that turns applying it into a lookup, a test, and
the CI entries that can go once the timeouts are gone.
apply_lut() samples the gamma LUT: every channel of every pixel gets a
fixed-point index and an interpolation between two neighbouring entries.
On a 1024x768 mode that is 2.36 million interpolations per frame, and
kms_plane@pixel-format takes 160.1-167.8 s while
pixel-format-source-clamping takes 78.9-83.8 s, over ten runs each. CI
lists both as Timeout in drivers/gpu/drm/ci/xfails/vkms-none-fails.txt.
A channel value is a u16, so a channel has only 65536 possible outputs.
Patch 2 computes them once per LUT change into three tables (384 KiB) and
applies the LUT by indexing them, which leaves the composed output
bit-identical to the interpolated path. The two subtests take 4.87-4.90 s
and 9.70-9.84 s.
Patch 1 is the fix I posted on 22 October
(<20261022215803.621996-1-oaroraetimis@xxxxxxxxx>), and patch 2 builds on
it. Patch 4 removes the two xfail entries and has to be merged with patch
2: on its own the subtests still time out.
The other approach I considered. drm_fixp_msbset() computes fls64() with a
62-step loop; replacing it with fls64() is three lines, needs no memory,
no cache and no lifetime, and returns the same values. In a userspace copy
of the same functions the LUT phase goes from 153.9 ms to 10.5 ms per
frame, ~15x, where the tables give 0.9 ms, ~170x. I have not measured the
subtests with it, so I have no wall clock for it. It is not part of this
series.
---
Oarora Etimis (4):
drm/vkms: use the gamma LUT of the state being composed
drm/vkms: precompute the gamma LUT for every channel value
drm/vkms: add a KUnit test for the precomputed LUT table
drm/ci: drop the kms_plane pixel-format xfails for vkms
drivers/gpu/drm/ci/xfails/vkms-none-fails.txt | 2 -
drivers/gpu/drm/vkms/tests/vkms_color_test.c | 54 +++++++++++++++++++++++++++
drivers/gpu/drm/vkms/vkms_composer.c | 47 ++++++++++++++++++-----
drivers/gpu/drm/vkms/vkms_composer.h | 3 ++
drivers/gpu/drm/vkms/vkms_crtc.c | 24 ++++++++++++
drivers/gpu/drm/vkms/vkms_drv.h | 6 +++
6 files changed, 125 insertions(+), 11 deletions(-)
---
base-commit: 33ed26235db93162935d1719bc6f538c384a2fd8
change-id: 20261108-lut-4fde3dee44ce
Best regards,
--
Oarora Etimis <oaroraetimis@xxxxxxxxx>