drm/i915: prepare scaler for YCBCR420 modeset
authorShashank Sharma <shashank.sharma@intel.com>
Fri, 21 Jul 2017 15:25:05 +0000 (20:55 +0530)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 27 Jul 2017 07:38:55 +0000 (09:38 +0200)
To get a YCBCR420 output from intel platforms, we need one
scaler to scale down YCBCR444 samples to YCBCR420 samples.

This patch:
- Does scaler allocation for HDMI ycbcr420 outputs.
- Programs PIPE_MISC register for ycbcr420 output.

V2: rebase
V3: rebase
V4: rebase
V5: addressed review comments from Ander:
    - No need to check both scaler_user && hdmi_output.
      Check for scaler_user is enough.
V6: rebase
V7: Do not create a new scaler user, use existing pipe scaler user.
V8: rebase
V9: Addressed review comments from Ville:
    - Remove leftover comment for HDMI scaler user.
    - Remove unnecessary blank line.
    - Make scaler alocation failure a DEBUG log instead of ERROR.
    Added r-b from Ville
V10: Update commit message as per latest code (Imre)
     Added r-b from Imre

Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Ander Conselvan De Oliveira <conselvan2@gmail.com>
Cc: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1500650709-14447-3-git-send-email-shashank.sharma@intel.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_hdmi.c
drivers/gpu/drm/i915/intel_panel.c

index 6908d3b4218a3a0a15be02e6cdd9588ff3223152..77d811993423b111a6189c0440fb4c68911d22d1 100644 (file)
@@ -4487,6 +4487,9 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
         */
        need_scaling = src_w != dst_w || src_h != dst_h;
 
+       if (crtc_state->ycbcr420 && scaler_user == SKL_CRTC_INDEX)
+               need_scaling = true;
+
        /*
         * Scaling/fitting not supported in IF-ID mode in GEN9+
         * TODO: Interlace fetch mode doesn't support YUV420 planar formats.
index 0b63b9fcbcc10a900b68058d0b60f0dad4f60a05..b62bd8251c2a84a8d8ae487808c278cc8618a8e1 100644 (file)
@@ -1354,6 +1354,8 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
                           struct intel_crtc_state *config,
                           int *clock_12bpc, int *clock_8bpc)
 {
+       struct intel_crtc *intel_crtc = to_intel_crtc(config->base.crtc);
+
        if (!connector->ycbcr_420_allowed) {
                DRM_ERROR("Platform doesn't support YCBCR420 output\n");
                return false;
@@ -1364,6 +1366,16 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
        *clock_12bpc /= 2;
        *clock_8bpc /= 2;
        config->ycbcr420 = true;
+
+       /* YCBCR 420 output conversion needs a scaler */
+       if (skl_update_scaler_crtc(config)) {
+               DRM_DEBUG_KMS("Scaler allocation for output failed\n");
+               return false;
+       }
+
+       intel_pch_panel_fitting(intel_crtc, config,
+                               DRM_MODE_SCALE_FULLSCREEN);
+
        return true;
 }
 
index 96c2cbd81869e7e55dedc8ce09f53938466bee70..fd2e0815f06a99eb9190629d56293f72d3fe2890 100644 (file)
@@ -110,7 +110,8 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc,
 
        /* Native modes don't need fitting */
        if (adjusted_mode->crtc_hdisplay == pipe_config->pipe_src_w &&
-           adjusted_mode->crtc_vdisplay == pipe_config->pipe_src_h)
+           adjusted_mode->crtc_vdisplay == pipe_config->pipe_src_h &&
+           !pipe_config->ycbcr420)
                goto done;
 
        switch (fitting_mode) {