On 2018-06-01 06:03 PM, sunpeng.li at amd.com wrote: > From: "Leo (Sunpeng) Li" <sunpeng.li at amd.com> > > And destroy them on the CRTC destroy hook. > > When initializing color management properties on the private > drmmode_crtc, we want to: > > 1. Obtain its degamma and regamma LUT sizes > 2. Default its color transform matrix (CTM) to identity > 3. Program hardware with default color management values (SRGB for > de/regamma, identity for CTM) > > It's possible that cm initialization fails due to memory error or DRM > error. In which case, DDX support for color management will be disabled > on this CRTC. > > Signed-off-by: Leo (Sunpeng) Li <sunpeng.li at amd.com> > > [...] > > + drmModeFreeObjectProperties(drm_props); > + > + if (!drmmode_crtc_cm_enabled(drmmode_crtc)) { > + xf86DrvMsg(crtc->scrn->scrnIndex, X_INFO, > + "CRTC%d does not support non-legacy color management.\n", > + drmmode_get_crtc_id(crtc)); > + drmmode_crtc->degamma_lut_size = 0; > + drmmode_crtc->gamma_lut_size = 0; drmmode_crtc_cm_enabled returning FALSE means these are already both 0. > + xf86DrvMsg(crtc->scrn->scrnIndex, X_INFO, > + "CRTC%d supports non-legacy color management.\n", > + drmmode_get_crtc_id(crtc)); Is this log message really needed? For every CRTC? :) This can easily be determined by checking for the existence of the properties with xrandr. > + /* Push properties to reset properties currently in hardware */ > + for (i = 0; i < CM_NUM_PROPS; i++) { > + if (i == CM_DEGAMMA_LUT_SIZE || i == CM_GAMMA_LUT_SIZE) > + continue; This loop and the drmmode_output_set_property change in patch 5 could be simplified by putting CM_(DE)GAMMA_LUT_SIZE at the end of the enum definition and using the first of them as the sentinel instead of CM_NUM_PROPS. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer