]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/vesadrm: Prepare color management for palette-based framebuffers
authorThomas Zimmermann <tzimmermann@suse.de>
Mon, 14 Jul 2025 15:13:08 +0000 (17:13 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Tue, 26 Aug 2025 07:54:19 +0000 (09:54 +0200)
Distiguish between component-based formats and 'the rest' in vesadrm's
color management. Scanout buffers with component-based format allow
for gamma correction. Palette-based formats (i.e., 'the rest') require
palette setup.

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

index 9596322c232bdeb568dc4dd7945657710ae20b02..b6e5ed1863f9dc341b9b97f476ea0b65b1aee411 100644 (file)
@@ -223,15 +223,22 @@ static void vesadrm_crtc_helper_atomic_flush(struct drm_crtc *crtc,
         * plane's color format.
         */
        if (crtc_state->enable && crtc_state->color_mgmt_changed) {
-               if (sysfb_crtc_state->format == sysfb->fb_format) {
-                       if (crtc_state->gamma_lut)
-                               vesadrm_load_gamma_lut(vesa,
-                                                      sysfb_crtc_state->format,
-                                                      crtc_state->gamma_lut->data);
-                       else
+               switch (sysfb->fb_format->format) {
+               /*
+                * Component formats
+                */
+               default:
+                       if (sysfb_crtc_state->format == sysfb->fb_format) {
+                               if (crtc_state->gamma_lut)
+                                       vesadrm_load_gamma_lut(vesa,
+                                                              sysfb_crtc_state->format,
+                                                              crtc_state->gamma_lut->data);
+                               else
+                                       vesadrm_fill_gamma_lut(vesa, sysfb_crtc_state->format);
+                       } else {
                                vesadrm_fill_gamma_lut(vesa, sysfb_crtc_state->format);
-               } else {
-                       vesadrm_fill_gamma_lut(vesa, sysfb_crtc_state->format);
+                       }
+                       break;
                }
        }
 }