drm/ofdrm: Support color management
authorThomas Zimmermann <tzimmermann@suse.de>
Tue, 11 Oct 2022 15:07:11 +0000 (17:07 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Fri, 14 Oct 2022 07:50:25 +0000 (09:50 +0200)
commit4bbb9061081c49ded4908c7716a03f7faf4eb65d
tree7d79bc49c316f1ead151fed65b956f7c9d1a288e
parentf496834e167451afc5f0c699ada143a7641b4e85
drm/ofdrm: Support color management

Support the CRTC's color-management property and implement each model's
palette support.

The OF hardware has different methods of setting the palette. The
respective code has been taken from fbdev's offb and refactored into
per-model device functions. The device functions integrate this
functionality into the overall modesetting.

As palette handling is a CRTC property that depends on the primary
plane's color format, the plane's atomic_check helper now updates the
format field in ofdrm's custom CRTC state. The CRTC's atomic_flush
helper updates the palette for the format as needed.

v4:
* use cpu_to_be32() (Geert)
v3:
* lookup CRTC state with drm_atomic_get_new_crtc_state()
* access HW palette with writeb(), writel(), and readl() (Ben)
* declare register values as u32

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221011150712.3928-5-tzimmermann@suse.de
drivers/gpu/drm/tiny/ofdrm.c