drm/sysfb: vesadrm: Add gamma correction
authorThomas Zimmermann <tzimmermann@suse.de>
Tue, 1 Apr 2025 09:37:21 +0000 (11:37 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Mon, 7 Apr 2025 09:02:07 +0000 (11:02 +0200)
commit814d270b31d27b6ea4f722b8ae2db9802fe332ff
treed47dd60dc865a9ec5cb4a73eadd01df1d3a1e520
parent9d0de9e8b7087745e63eef7bee298e103da4f590
drm/sysfb: vesadrm: Add gamma correction

Add palette support and export GAMMA properties via sysfs. User-space
compositors can use this interface for programming gamma ramps or night
mode.

Vesadrm supports palette updates via VGA DAC registers or VESA palette
calls. Up to 256 palette entries are available. Userspace always supplies
gamma ramps of 256 entries. If the native color format does not match
this because pixel component have less then 8 bits, vesadrm interpolates
among the palette entries.

The code uses CamelCase style in a few places to match the VESA manuals.

v3:
- fix coding style
v2:
- use CONFIG_X86_32 instead of __i386__ (checkpatch)
- protect struct vesadrm.pmi with CONFIG_X86_32

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://lore.kernel.org/r/20250401094056.32904-19-tzimmermann@suse.de
drivers/gpu/drm/sysfb/vesadrm.c
include/linux/screen_info.h