Am 09.05.25 um 10:23 schrieb Thomas Zimmermann:
We have a number of drivers that offer simple gamma correction and
palette modes. Depending on their hardware, the drivers process the
provided data in similar ways. Unify the functionality in several
DRM color-management helpers and update the drivers. The new helpers
can load provided data or generate default data to load.

With the drivers; ast, mgag200 ofdrm and vesadrm; gamma ramps are
always 8 bit wide. For 24-bit color depth, 8-bit gamma ramps are being
loaded to hardware as provided. For lower color depths the hardware
often requires the gamma ramp to be reduced to the number of bits
per pixel component, which the new helpers can do automatically. The
exception is ast's hardware, which always uses 8-bit gamma ramps.

The default gamma ramp uses a factor of 1.0 (as has been the case in
existing the per-driver implementations). A later update could change
this to the common value of 2.2 or a system-specific value.

That might not be such a great idea. See https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&highlight_names=&date=2025-05-12&show_html=true


Helpers for palettes either load an 8-bit palette or generate a default
palette with increasing luminance. The goal for the default is to keep
the display content visible with black at index 0. A later update could
possibly load a system-specific default palette.

Thomas Zimmermann (5):
   drm: Add helpers for programming hardware gamma LUTs
   drm/ast: Use helpers for programming gamma ramps and palettes
   drm/mgag200: Use helpers for programming gamma ramps
   drm/ofdrm: Use helpers for programming gamma ramps
   drm/vesadrm: Use helpers for programming gamma ramps

  drivers/gpu/drm/ast/ast_mode.c           |  69 +++++---
  drivers/gpu/drm/drm_color_mgmt.c         | 206 +++++++++++++++++++++++
  drivers/gpu/drm/mgag200/mgag200_drv.h    |   4 +-
  drivers/gpu/drm/mgag200/mgag200_g200er.c |   4 +-
  drivers/gpu/drm/mgag200/mgag200_g200ev.c |   4 +-
  drivers/gpu/drm/mgag200/mgag200_g200se.c |   4 +-
  drivers/gpu/drm/mgag200/mgag200_mode.c   |  78 ++++-----
  drivers/gpu/drm/sysfb/ofdrm.c            |  78 ++++-----
  drivers/gpu/drm/sysfb/vesadrm.c          | 100 ++++-------
  include/drm/drm_color_mgmt.h             |  27 +++
  10 files changed, 380 insertions(+), 194 deletions(-)


base-commit: 842c3c276c106040f9b96d72b9df35ed6aed9ae9

--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

Reply via email to