Re: [PATCH 3/3] drm/i915: Nuke intel_bios_is_port_dp_dual_mode()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Ville Syrjala (2023-05-09 13:02:06)
>From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>
>Now that we have encoder->devdata everwhere we don't need
>the intel_bios_is_port_dp_dual_mode() wrapper any more.
>
>And while at it let's include it in the child device log
>dump as well since the logic in there is a bit more complex
>than just DP&&HDMI.
>
>Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

As far as the refactors go, they look good to me:

Acked-by: Gustavo Sousa <gustavo.sousa@xxxxxxxxx>

Regarding devdata being everywhere, I did grep for places where
drm_encoder_init() is called to see if we populate devdata. If I did my
homework correctly, it looks like we don't in some places. However I
guess devdata should be available in the contexts where
intel_bios_encoder_supports_dp_dual_mode() is called. I defer to a more
experienced reviewer for this part :-)

--
Gustavo Sousa

>---
> drivers/gpu/drm/i915/display/intel_bios.c | 14 +++-----------
> drivers/gpu/drm/i915/display/intel_bios.h |  2 +-
> drivers/gpu/drm/i915/display/intel_hdmi.c |  6 +++---
> 3 files changed, 7 insertions(+), 15 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
>index ac0fc1993376..64eb11a45265 100644
>--- a/drivers/gpu/drm/i915/display/intel_bios.c
>+++ b/drivers/gpu/drm/i915/display/intel_bios.c
>@@ -2677,8 +2677,9 @@ static void print_ddi_port(const struct intel_bios_encoder_data *devdata,
>        supports_tbt = intel_bios_encoder_supports_tbt(devdata);
> 
>        drm_dbg_kms(&i915->drm,
>-              "Port %c VBT info: CRT:%d DVI:%d HDMI:%d DP:%d eDP:%d DSI:%d LSPCON:%d USB-Type-C:%d TBT:%d DSC:%d\n",
>+              "Port %c VBT info: CRT:%d DVI:%d HDMI:%d DP:%d eDP:%d DSI:%d DP++:%d LSPCON:%d USB-Type-C:%d TBT:%d DSC:%d\n",
>                    port_name(port), is_crt, is_dvi, is_hdmi, is_dp, is_edp, is_dsi,
>+              intel_bios_encoder_supports_dp_dual_mode(devdata),
>                    intel_bios_encoder_is_lspcon(devdata),
>                    supports_typec_usb, supports_tbt,
>                    devdata->dsc != NULL);
>@@ -3426,7 +3427,7 @@ bool intel_bios_is_port_present(struct drm_i915_private *i915, enum port port)
>        return false;
> }
> 
>-static bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_encoder_data *devdata)
>+bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_encoder_data *devdata)
> {
>        const struct child_device_config *child = &devdata->child;
> 
>@@ -3445,15 +3446,6 @@ static bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_enc
>        return false;
> }
> 
>-bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *i915,
>-                               enum port port)
>-{
>-  const struct intel_bios_encoder_data *devdata =
>-          intel_bios_encoder_data_lookup(i915, port);
>-
>-  return devdata && intel_bios_encoder_supports_dp_dual_mode(devdata);
>-}
>-
> /**
>  * intel_bios_is_dsi_present - is DSI present in VBT
>  * @i915:      i915 device instance
>diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h
>index 8a0730c9b48c..45fae97d9719 100644
>--- a/drivers/gpu/drm/i915/display/intel_bios.h
>+++ b/drivers/gpu/drm/i915/display/intel_bios.h
>@@ -247,7 +247,6 @@ bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv);
> bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin);
> bool intel_bios_is_port_present(struct drm_i915_private *dev_priv, enum port port);
> bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
>-bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum port port);
> bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port);
> bool intel_bios_get_dsc_params(struct intel_encoder *encoder,
>                               struct intel_crtc_state *crtc_state,
>@@ -264,6 +263,7 @@ bool intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdat
> bool intel_bios_encoder_supports_edp(const struct intel_bios_encoder_data *devdata);
> bool intel_bios_encoder_supports_typec_usb(const struct intel_bios_encoder_data *devdata);
> bool intel_bios_encoder_supports_tbt(const struct intel_bios_encoder_data *devdata);
>+bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_encoder_data *devdata);
> bool intel_bios_encoder_is_lspcon(const struct intel_bios_encoder_data *devdata);
> bool intel_bios_encoder_lane_reversal(const struct intel_bios_encoder_data *devdata);
> bool intel_bios_encoder_hpd_invert(const struct intel_bios_encoder_data *devdata);
>diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
>index 61a2b63ab4d2..c2464f98c76e 100644
>--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
>+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
>@@ -2400,7 +2400,7 @@ intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector)
> {
>        struct drm_i915_private *dev_priv = to_i915(connector->dev);
>        struct intel_hdmi *hdmi = intel_attached_hdmi(to_intel_connector(connector));
>-  enum port port = hdmi_to_dig_port(hdmi)->base.port;
>+  struct intel_encoder *encoder = &hdmi_to_dig_port(hdmi)->base;
>        struct i2c_adapter *adapter =
>                intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus);
>        enum drm_dp_dual_mode_type type = drm_dp_dual_mode_detect(&dev_priv->drm, adapter);
>@@ -2416,7 +2416,7 @@ intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector)
>         */
>        if (type == DRM_DP_DUAL_MODE_UNKNOWN) {
>                if (!connector->force &&
>-              intel_bios_is_port_dp_dual_mode(dev_priv, port)) {
>+              intel_bios_encoder_supports_dp_dual_mode(encoder->devdata)) {
>                        drm_dbg_kms(&dev_priv->drm,
>                                    "Assuming DP dual mode adaptor presence based on VBT\n");
>                        type = DRM_DP_DUAL_MODE_TYPE1_DVI;
>@@ -2439,7 +2439,7 @@ intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector)
> 
>        /* Older VBTs are often buggy and can't be trusted :( Play it safe. */
>        if ((DISPLAY_VER(dev_priv) >= 8 || IS_HASWELL(dev_priv)) &&
>-      !intel_bios_is_port_dp_dual_mode(dev_priv, port)) {
>+      !intel_bios_encoder_supports_dp_dual_mode(encoder->devdata)) {
>                drm_dbg_kms(&dev_priv->drm,
>                            "Ignoring DP dual mode adaptor max TMDS clock for native HDMI port\n");
>                hdmi->dp_dual_mode.max_tmds_clock = 0;
>-- 
>2.39.2
>




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux