[Intel-gfx] [PATCH 6/6] drm/i915: Register color correction capabilities

Daniel Stone daniel at fooishbar.org
Fri Dec 18 08:54:00 PST 2015


Hi,

On 17 December 2015 at 18:57, Lionel Landwerlin
<lionel.g.landwerlin at intel.com> wrote:
>  void intel_crtc_attach_color_properties(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       struct drm_mode_config *config = &dev->mode_config;
> +       struct drm_mode_object *mode_obj = &crtc->base;
> +
> +       /*
> +       * Register:
> +       * =========
> +       * Gamma correction as palette_after_ctm property
> +       * Degamma correction as palette_before_ctm property
> +       *
> +       * Load:
> +       * =====
> +       * no. of coefficients supported on this platform for gamma
> +       * and degamma with the query properties. A user
> +       * space agent should read these query property, and prepare
> +       * the color correction values accordingly. Its expected from the
> +       * driver to load the right number of coefficients during the init
> +       * phase.
> +       */
> +       if (config->cm_coeff_after_ctm_property) {
> +               drm_object_attach_property(mode_obj,
> +                       config->cm_coeff_after_ctm_property,
> +               INTEL_INFO(dev)->num_samples_after_ctm);
> +               DRM_DEBUG_DRIVER("Gamma query property initialized\n");
> +       }
> +
> +       if (config->cm_coeff_before_ctm_property) {
> +               drm_object_attach_property(mode_obj,
> +                       config->cm_coeff_before_ctm_property,
> +               INTEL_INFO(dev)->num_samples_before_ctm);
> +               DRM_DEBUG_DRIVER("Degamma query property initialized\n");
> +       }
> +
> +       /* Gamma correction */
> +       if (config->cm_palette_after_ctm_property) {
> +               drm_object_attach_property(mode_obj,
> +                       config->cm_palette_after_ctm_property, 0);
> +               DRM_DEBUG_DRIVER("gamma property attached to CRTC\n");
> +       }
> +
> +       /* Degamma correction */
> +       if (config->cm_palette_before_ctm_property) {
> +               drm_object_attach_property(mode_obj,
> +                       config->cm_palette_before_ctm_property, 0);
> +               DRM_DEBUG_DRIVER("degamma property attached to CRTC\n");
> +       }
> +
> +       /* CSC */
> +       if (config->cm_ctm_property) {
> +               drm_object_attach_property(mode_obj,
> +                       config->cm_ctm_property, 0);
> +               DRM_DEBUG_DRIVER("CSC property attached to CRTC\n");
> +       }
>  }
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index b9eb507..7cf56cb 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -14264,6 +14264,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
>         intel_crtc->cursor_size = ~0;
>
>         intel_crtc->wm.cxsr_allowed = true;
> +       intel_crtc_attach_color_properties(&intel_crtc->base);

NAK. These properties must not be registered unless they actually
support colour management (i.e., are CHV/BDW). You can also drop the
debug prints about attaching properties to the CRTC.

Cheers,
Daniel


More information about the Intel-gfx mailing list