]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Pass connector state to pfit calculations
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 22 Apr 2020 16:19:16 +0000 (19:19 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 24 Apr 2020 14:33:35 +0000 (17:33 +0300)
Pass the entire connector state to intel_{gmch,pch}_panel_fitting().
For now we just need to get at .scaling_mode but in the future we'll
want access to the margin properties as well.

v2: Deal with intel_dp_ycbcr420_config()

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200422161917.17389-5-ville.syrjala@linux.intel.com
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
drivers/gpu/drm/i915/display/icl_dsi.c
drivers/gpu/drm/i915/display/intel_dp.c
drivers/gpu/drm/i915/display/intel_hdmi.c
drivers/gpu/drm/i915/display/intel_lvds.c
drivers/gpu/drm/i915/display/intel_panel.c
drivers/gpu/drm/i915/display/intel_panel.h
drivers/gpu/drm/i915/display/vlv_dsi.c

index fb9291de55d0c82241d735bb91fa4175468751b6..6650590f18fd9564fdf931a6a7d59efc8c2ce75b 100644 (file)
@@ -1532,7 +1532,7 @@ static int gen11_dsi_compute_config(struct intel_encoder *encoder,
 
        pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
        intel_fixed_panel_mode(fixed_mode, adjusted_mode);
-       intel_pch_panel_fitting(pipe_config, conn_state->scaling_mode);
+       intel_pch_panel_fitting(pipe_config, conn_state);
 
        adjusted_mode->flags = 0;
 
index b9a760012b3fa0cf00e32093a938dcddd63821d7..7c4c9a4f423872f4da0daf2c0564ee983e35ee6b 100644 (file)
@@ -2339,9 +2339,10 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
 
 static int
 intel_dp_ycbcr420_config(struct intel_dp *intel_dp,
-                        struct drm_connector *connector,
-                        struct intel_crtc_state *crtc_state)
+                        struct intel_crtc_state *crtc_state,
+                        const struct drm_connector_state *conn_state)
 {
+       struct drm_connector *connector = conn_state->connector;
        const struct drm_display_info *info = &connector->display_info;
        const struct drm_display_mode *adjusted_mode =
                &crtc_state->hw.adjusted_mode;
@@ -2353,7 +2354,7 @@ intel_dp_ycbcr420_config(struct intel_dp *intel_dp,
 
        crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR420;
 
-       intel_pch_panel_fitting(crtc_state, DRM_MODE_SCALE_FULLSCREEN);
+       intel_pch_panel_fitting(crtc_state, conn_state);
 
        return 0;
 }
@@ -2549,8 +2550,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
        if (lspcon->active)
                lspcon_ycbcr420_config(&intel_connector->base, pipe_config);
        else
-               ret = intel_dp_ycbcr420_config(intel_dp, &intel_connector->base,
-                                              pipe_config);
+               ret = intel_dp_ycbcr420_config(intel_dp, pipe_config,
+                                              conn_state);
        if (ret)
                return ret;
 
@@ -2567,11 +2568,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,
                                       adjusted_mode);
 
                if (HAS_GMCH(dev_priv))
-                       intel_gmch_panel_fitting(pipe_config,
-                                                conn_state->scaling_mode);
+                       intel_gmch_panel_fitting(pipe_config, conn_state);
                else
-                       intel_pch_panel_fitting(pipe_config,
-                                               conn_state->scaling_mode);
+                       intel_pch_panel_fitting(pipe_config, conn_state);
        }
 
        if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
index 275a676c7b08d55af1dbb2afbdd4bd8ec25ff837..0edbdd39f4628a324d7587015cd1071ce5da8ddd 100644 (file)
@@ -2322,9 +2322,10 @@ static bool hdmi_deep_color_possible(const struct intel_crtc_state *crtc_state,
 }
 
 static bool
-intel_hdmi_ycbcr420_config(struct drm_connector *connector,
-                          struct intel_crtc_state *config)
+intel_hdmi_ycbcr420_config(struct intel_crtc_state *crtc_state,
+                          const struct drm_connector_state *conn_state)
 {
+       struct drm_connector *connector = conn_state->connector;
        struct drm_i915_private *i915 = to_i915(connector->dev);
 
        if (!connector->ycbcr_420_allowed) {
@@ -2333,9 +2334,9 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
                return false;
        }
 
-       config->output_format = INTEL_OUTPUT_FORMAT_YCBCR420;
+       crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR420;
 
-       intel_pch_panel_fitting(config, DRM_MODE_SCALE_FULLSCREEN);
+       intel_pch_panel_fitting(crtc_state, conn_state);
 
        return true;
 }
@@ -2466,7 +2467,7 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
                pipe_config->pixel_multiplier = 2;
 
        if (drm_mode_is_420_only(&connector->display_info, adjusted_mode)) {
-               if (!intel_hdmi_ycbcr420_config(connector, pipe_config)) {
+               if (!intel_hdmi_ycbcr420_config(pipe_config, conn_state)) {
                        drm_err(&dev_priv->drm,
                                "Can't support YCBCR420 output\n");
                        return -EINVAL;
index 276db41b95efc35d297f54fa853b654a6131def8..ae658d9354b73df07e0f44592acda398fcfc4835 100644 (file)
@@ -439,12 +439,9 @@ static int intel_lvds_compute_config(struct intel_encoder *intel_encoder,
        if (HAS_PCH_SPLIT(dev_priv)) {
                pipe_config->has_pch_encoder = true;
 
-               intel_pch_panel_fitting(pipe_config,
-                                       conn_state->scaling_mode);
+               intel_pch_panel_fitting(pipe_config, conn_state);
        } else {
-               intel_gmch_panel_fitting(pipe_config,
-                                        conn_state->scaling_mode);
-
+               intel_gmch_panel_fitting(pipe_config, conn_state);
        }
 
        /*
index 3ea1704277a83e7b8b718ea51fa2bb7616f26729..b4bb1cfc54a9cf1b90c508ce51d5269f90b52805 100644 (file)
@@ -178,7 +178,7 @@ intel_panel_vbt_fixed_mode(struct intel_connector *connector)
 /* adjusted_mode has been preset to be the panel's fixed mode */
 void
 intel_pch_panel_fitting(struct intel_crtc_state *crtc_state,
-                       int fitting_mode)
+                       const struct drm_connector_state *conn_state)
 {
        const struct drm_display_mode *adjusted_mode =
                &crtc_state->hw.adjusted_mode;
@@ -190,7 +190,7 @@ intel_pch_panel_fitting(struct intel_crtc_state *crtc_state,
            crtc_state->output_format != INTEL_OUTPUT_FORMAT_YCBCR420)
                return;
 
-       switch (fitting_mode) {
+       switch (conn_state->scaling_mode) {
        case DRM_MODE_SCALE_CENTER:
                width = crtc_state->pipe_src_w;
                height = crtc_state->pipe_src_h;
@@ -227,6 +227,10 @@ intel_pch_panel_fitting(struct intel_crtc_state *crtc_state,
                }
                break;
 
+       case DRM_MODE_SCALE_NONE:
+               WARN_ON(adjusted_mode->crtc_hdisplay != crtc_state->pipe_src_w);
+               WARN_ON(adjusted_mode->crtc_vdisplay != crtc_state->pipe_src_h);
+               /* fall through */
        case DRM_MODE_SCALE_FULLSCREEN:
                x = y = 0;
                width = adjusted_mode->crtc_hdisplay;
@@ -234,7 +238,7 @@ intel_pch_panel_fitting(struct intel_crtc_state *crtc_state,
                break;
 
        default:
-               MISSING_CASE(fitting_mode);
+               MISSING_CASE(conn_state->scaling_mode);
                return;
        }
 
@@ -378,7 +382,7 @@ static void i9xx_scale_aspect(struct intel_crtc_state *crtc_state,
 }
 
 void intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state,
-                             int fitting_mode)
+                             const struct drm_connector_state *conn_state)
 {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
@@ -390,7 +394,7 @@ void intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state,
            adjusted_mode->crtc_vdisplay == crtc_state->pipe_src_h)
                goto out;
 
-       switch (fitting_mode) {
+       switch (conn_state->scaling_mode) {
        case DRM_MODE_SCALE_CENTER:
                /*
                 * For centered modes, we have to calculate border widths &
@@ -426,8 +430,7 @@ void intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state,
                }
                break;
        default:
-               drm_WARN(&dev_priv->drm, 1, "bad panel fit mode: %d\n",
-                        fitting_mode);
+               MISSING_CASE(conn_state->scaling_mode);
                return;
        }
 
index 92dcb773763c17d87e1397e6dd7ca8b56b4dc45d..a26db895038ecb0705d4d55cf44f9af8f40b62f7 100644 (file)
@@ -26,9 +26,9 @@ void intel_panel_fini(struct intel_panel *panel);
 void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
                            struct drm_display_mode *adjusted_mode);
 void intel_pch_panel_fitting(struct intel_crtc_state *crtc_state,
-                            int fitting_mode);
+                            const struct drm_connector_state *conn_state);
 void intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state,
-                             int fitting_mode);
+                             const struct drm_connector_state *conn_state);
 void intel_panel_set_backlight_acpi(const struct drm_connector_state *conn_state,
                                    u32 level, u32 max);
 int intel_panel_setup_backlight(struct drm_connector *connector,
index fe7c9d3ec41847baeb15f5fd6ad54af4a7351484..9c9ea89d21079c5e99604f8799d51f82b4b61c7e 100644 (file)
@@ -278,11 +278,9 @@ static int intel_dsi_compute_config(struct intel_encoder *encoder,
                intel_fixed_panel_mode(fixed_mode, adjusted_mode);
 
                if (HAS_GMCH(dev_priv))
-                       intel_gmch_panel_fitting(pipe_config,
-                                                conn_state->scaling_mode);
+                       intel_gmch_panel_fitting(pipe_config, conn_state);
                else
-                       intel_pch_panel_fitting(pipe_config,
-                                               conn_state->scaling_mode);
+                       intel_pch_panel_fitting(pipe_config, conn_state);
        }
 
        if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)