@@ -89,7 +89,18 @@ static void evdi_crtc_atomic_flush(
8989 (crtc_state->mode_changed || evdi_painter_needs_full_modeset(evdi->painter));
9090 bool notify_dpms = crtc_state->active_changed || evdi_painter_needs_full_modeset(evdi->painter);
9191
92- evdi_color_transform_update(&evdi->color, crtc_state);
92+ /*
93+ * Colour is applied only on GRABPIX of dirty rects. When the compositor
94+ * changes GAMMA_LUT/CTM without repainting, force a full-frame dirty so
95+ * DisplayLinkManager re-grabs and the new transform is visible.
96+ */
97+ if (evdi_color_transform_update(&evdi->color, crtc_state)) {
98+ struct drm_clip_rect full =
99+ evdi_painter_framebuffer_size(evdi->painter);
100+
101+ if (full.x2 > full.x1 && full.y2 > full.y1)
102+ evdi_painter_mark_dirty(evdi, &full);
103+ }
93104
94105 if (notify_mode_changed)
95106 evdi_painter_mode_changed_notify(evdi, &crtc_state->adjusted_mode);
@@ -508,14 +519,23 @@ static int evdi_crtc_init(struct drm_device *dev)
508519 drm_crtc_helper_add(crtc, &evdi_helper_funcs);
509520
510521 /*
511- * evdi has no hardware gamma/CTM block to program; the properties
512- * registered here are applied in software to the raw framebuffer
513- * bytes in evdi_painter.c's copy_primary_pixels()/_on_xe(), since
514- * that's the only place the driver has direct access to pixel data
515- * before it's handed to userspace.
522+ * Software colour management (see evdi_color.c). Which properties are
523+ * advertised is selected by the color_props module parameter so a
524+ * compositor can be steered to GAMMA_LUT or CTM for testing.
516525 */
517- drm_mode_crtc_set_gamma_size(crtc, EVDI_GAMMA_LUT_SIZE);
518- drm_crtc_enable_color_mgmt(crtc, 0, true, EVDI_GAMMA_LUT_SIZE);
526+ {
527+ const bool has_gamma = evdi_color_props_has_gamma();
528+ const bool has_ctm = evdi_color_props_has_ctm();
529+ const uint gamma_size = has_gamma ? EVDI_GAMMA_LUT_SIZE : 0;
530+
531+ if (has_gamma)
532+ drm_mode_crtc_set_gamma_size(crtc, EVDI_GAMMA_LUT_SIZE);
533+ if (has_gamma || has_ctm)
534+ drm_crtc_enable_color_mgmt(crtc, 0, has_ctm, gamma_size);
535+ EVDI_INFO("color_props=%s (gamma=%d ctm=%d)\n",
536+ evdi_color_props ? evdi_color_props : "both",
537+ has_gamma, has_ctm);
538+ }
519539
520540 return 0;
521541}
0 commit comments