drm/i915: Add CRTC output format YCBCR 4:4:4
authorShashank Sharma <shashank.sharma@intel.com>
Fri, 12 Oct 2018 06:23:09 +0000 (11:53 +0530)
committerJani Nikula <jani.nikula@intel.com>
Mon, 15 Oct 2018 13:01:50 +0000 (16:01 +0300)
This patch adds support for YCBCR 4:4:4 CRTC output format.
To do this, this patch extends the existing YCBCR 4:2:0
framework by:
- Adding new parameter in for YCBCR 4:4:4 enum crtc_iutput_format.
- Adding case for YCBCR 4:4:4 in while setting AVI infoframes.
- Adding necessary checks in modeset sequence.

V3: Added this patch in the series
V4: Added r-b from Maarten (for v3)
    Addressed review comment from Ville:
    Do not use (config->output_format > CRTC_OUTPUT_RGB)
V5: Rebase
V6: Rebase and small change, to accommodate changes in patch 2
V7: Fixed checkpatch alignment warnings
V8: Rebase
V9: Rebase
V10: Rebase
V11: Addressed review comment from Ville
     Missing output_format_str[INTEL_OUTPUT_FORMAT_YCBCR444]
     Added Ville's R-B.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1539325394-20788-3-git-send-email-shashank.sharma@intel.com
drivers/gpu/drm/i915/intel_color.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_hdmi.c

index bf9d8f69720cc2a6e8ed54a7aba3bee8c2d32e6c..5127da286a2b4f61ca5a32ce00220e01a9397f93 100644 (file)
@@ -149,7 +149,8 @@ static void ilk_load_csc_matrix(struct drm_crtc_state *crtc_state)
        if (INTEL_GEN(dev_priv) >= 8 || IS_HASWELL(dev_priv))
                limited_color_range = intel_crtc_state->limited_color_range;
 
-       if (intel_crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) {
+       if (intel_crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 ||
+           intel_crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR444) {
                ilk_load_ycbcr_conversion_matrix(intel_crtc);
                return;
        } else if (crtc_state->ctm) {
index b5c5dbb159b3184cfb4102862e0d5a8fe40acf43..3317c6c4645283e06bbe6cb63b9904d0c99523e7 100644 (file)
@@ -6591,8 +6591,9 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
                return -EINVAL;
        }
 
-       if (pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 &&
-           pipe_config->base.ctm) {
+       if ((pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 ||
+            pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR444) &&
+            pipe_config->base.ctm) {
                /*
                 * There is only one pipe CSC unit per pipe, and we need that
                 * for output conversion from RGB->YCBCR. So if CTM is already
@@ -7812,6 +7813,8 @@ static void intel_get_crtc_ycbcr_config(struct intel_crtc *crtc,
                                        output = INTEL_OUTPUT_FORMAT_INVALID;
                                else
                                        output = INTEL_OUTPUT_FORMAT_YCBCR420;
+                       } else {
+                               output = INTEL_OUTPUT_FORMAT_YCBCR444;
                        }
                }
        }
@@ -8453,11 +8456,13 @@ static void haswell_set_pipemisc(const struct intel_crtc_state *crtc_state)
                if (crtc_state->dither)
                        val |= PIPEMISC_DITHER_ENABLE | PIPEMISC_DITHER_TYPE_SP;
 
-               if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) {
+               if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 ||
+                   crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR444)
                        val |= PIPEMISC_OUTPUT_COLORSPACE_YUV;
+
+               if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420)
                        val |= PIPEMISC_YUV420_ENABLE |
                                PIPEMISC_YUV420_MODE_FULL_BLEND;
-               }
 
                I915_WRITE(PIPEMISC(intel_crtc->pipe), val);
        }
@@ -10940,6 +10945,7 @@ static const char * const output_format_str[] = {
        [INTEL_OUTPUT_FORMAT_INVALID] = "Invalid",
        [INTEL_OUTPUT_FORMAT_RGB] = "RGB",
        [INTEL_OUTPUT_FORMAT_YCBCR420] = "YCBCR4:2:0",
+       [INTEL_OUTPUT_FORMAT_YCBCR444] = "YCBCR4:4:4",
 };
 
 static const char *output_formats(enum intel_output_format format)
index 01530fa1dce2d14276c4601ea9af579de10d1a25..3d2330277285fc9038971c74fa2b891c3d77bda9 100644 (file)
@@ -716,6 +716,7 @@ enum intel_output_format {
        INTEL_OUTPUT_FORMAT_INVALID,
        INTEL_OUTPUT_FORMAT_RGB,
        INTEL_OUTPUT_FORMAT_YCBCR420,
+       INTEL_OUTPUT_FORMAT_YCBCR444,
 };
 
 struct intel_crtc_state {
index 33e1a9a6123a49f23c13657f0d147d54eaab088c..e2cc5edaeedd57e5f7ad58d4c99d3199ceaf7ae4 100644 (file)
@@ -480,6 +480,8 @@ static void intel_hdmi_set_avi_infoframe(struct intel_encoder *encoder,
 
        if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420)
                frame.avi.colorspace = HDMI_COLORSPACE_YUV420;
+       else if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR444)
+               frame.avi.colorspace = HDMI_COLORSPACE_YUV444;
        else
                frame.avi.colorspace = HDMI_COLORSPACE_RGB;