[Intel-gfx] [PATCH 10/12] drm/i915/bios: start using the intel_bios_encoder_data directly
Lucas De Marchi
lucas.demarchi at intel.com
Mon Mar 15 17:41:18 UTC 2021
On Wed, Feb 17, 2021 at 07:03:40PM +0200, Jani Nikula wrote:
>Start using struct intel_bios_encoder_data directly. We'll start
>sanitizing the child device data directly as well, instead of the cached
>data in ddi_port_info[]. The one downside here is having to store a
>non-const pointer back to intel_bios_encoder_data.
>
>Eventually we'll be able to have a direct pointer from encoder to
>intel_bios_encoder_data, removing the need to go through the
>ddi_port_info[] array altogether. And we'll be able to remove the cached
>data in ddi_port_info[].
>
>Cc: Lucas De Marchi <lucas.demarchi at intel.com>
>Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
>Signed-off-by: Jani Nikula <jani.nikula at intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>
Lucas De Marchi
>---
> drivers/gpu/drm/i915/display/intel_bios.c | 37 +++++++++--------------
> drivers/gpu/drm/i915/display/intel_bios.h | 10 ++++--
> drivers/gpu/drm/i915/display/intel_ddi.c | 15 +++++++--
> drivers/gpu/drm/i915/i915_drv.h | 4 +--
> 4 files changed, 35 insertions(+), 31 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
>index 47e9c609f82a..d26304ebc6b9 100644
>--- a/drivers/gpu/drm/i915/display/intel_bios.c
>+++ b/drivers/gpu/drm/i915/display/intel_bios.c
>@@ -1529,6 +1529,8 @@ static void sanitize_ddc_pin(struct drm_i915_private *i915,
>
> p = get_port_by_ddc_pin(i915, info->alternate_ddc_pin);
> if (p != PORT_NONE) {
>+ struct child_device_config *child;
>+
> drm_dbg_kms(&i915->drm,
> "port %c trying to use the same DDC pin (0x%x) as port %c, "
> "disabling port %c DVI/HDMI support\n",
>@@ -1548,9 +1550,11 @@ static void sanitize_ddc_pin(struct drm_i915_private *i915,
> * we must pick port E :(
> */
> info = &i915->vbt.ddi_port_info[p];
>+ child = &info->devdata->child;
>+
>+ child->device_type &= ~DEVICE_TYPE_TMDS_DVI_SIGNALING;
>+ child->device_type |= DEVICE_TYPE_NOT_HDMI_OUTPUT;
>
>- info->supports_dvi = false;
>- info->supports_hdmi = false;
> info->alternate_ddc_pin = 0;
> }
> }
>@@ -1783,20 +1787,20 @@ static void sanitize_device_type(struct intel_bios_encoder_data *devdata,
> devdata->child.device_type |= DEVICE_TYPE_NOT_HDMI_OUTPUT;
> }
>
>-static bool
>+bool
> intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata)
> {
> return devdata->child.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
> }
>
>-static bool
>+bool
> intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata)
> {
> return intel_bios_encoder_supports_dvi(devdata) &&
> (devdata->child.device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0;
> }
>
>-static bool
>+bool
> intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata)
> {
> return devdata->child.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
>@@ -1838,8 +1842,6 @@ static void parse_ddi_port(struct drm_i915_private *i915,
> is_hdmi = intel_bios_encoder_supports_hdmi(devdata);
> is_edp = intel_bios_encoder_supports_edp(devdata);
>
>- info->supports_dvi = is_dvi;
>- info->supports_hdmi = is_hdmi;
> info->supports_dp = is_dp;
> info->supports_edp = is_edp;
>
>@@ -2901,21 +2903,6 @@ int intel_bios_alternate_ddc_pin(struct intel_encoder *encoder)
> return i915->vbt.ddi_port_info[encoder->port].alternate_ddc_pin;
> }
>
>-bool intel_bios_port_supports_dvi(struct drm_i915_private *i915, enum port port)
>-{
>- return i915->vbt.ddi_port_info[port].supports_dvi;
>-}
>-
>-bool intel_bios_port_supports_hdmi(struct drm_i915_private *i915, enum port port)
>-{
>- return i915->vbt.ddi_port_info[port].supports_hdmi;
>-}
>-
>-bool intel_bios_port_supports_dp(struct drm_i915_private *i915, enum port port)
>-{
>- return i915->vbt.ddi_port_info[port].supports_dp;
>-}
>-
> bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915,
> enum port port)
> {
>@@ -2926,3 +2913,9 @@ bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port)
> {
> return i915->vbt.ddi_port_info[port].supports_tbt;
> }
>+
>+const struct intel_bios_encoder_data *
>+intel_bios_encoder_data_lookup(struct drm_i915_private *i915, enum port port)
>+{
>+ return i915->vbt.ddi_port_info[port].devdata;
>+}
>diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h
>index 6591cf7758f2..18b5c2976bd4 100644
>--- a/drivers/gpu/drm/i915/display/intel_bios.h
>+++ b/drivers/gpu/drm/i915/display/intel_bios.h
>@@ -254,10 +254,14 @@ int intel_bios_dp_boost_level(struct intel_encoder *encoder);
> int intel_bios_hdmi_boost_level(struct intel_encoder *encoder);
> int intel_bios_dp_max_link_rate(struct intel_encoder *encoder);
> int intel_bios_alternate_ddc_pin(struct intel_encoder *encoder);
>-bool intel_bios_port_supports_dvi(struct drm_i915_private *i915, enum port port);
>-bool intel_bios_port_supports_hdmi(struct drm_i915_private *i915, enum port port);
>-bool intel_bios_port_supports_dp(struct drm_i915_private *i915, enum port port);
> bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915, enum port port);
> bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port);
>
>+const struct intel_bios_encoder_data *
>+intel_bios_encoder_data_lookup(struct drm_i915_private *i915, enum port port);
>+
>+bool intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata);
>+bool intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata);
>+bool intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata);
>+
> #endif /* _INTEL_BIOS_H_ */
>diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
>index eeae78097a20..1a2f7725f8ec 100644
>--- a/drivers/gpu/drm/i915/display/intel_ddi.c
>+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
>@@ -3973,6 +3973,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
> {
> struct intel_digital_port *dig_port;
> struct intel_encoder *encoder;
>+ const struct intel_bios_encoder_data *devdata;
> bool init_hdmi, init_dp;
> enum phy phy = intel_port_to_phy(dev_priv, port);
>
>@@ -3988,9 +3989,17 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
> return;
> }
>
>- init_hdmi = intel_bios_port_supports_dvi(dev_priv, port) ||
>- intel_bios_port_supports_hdmi(dev_priv, port);
>- init_dp = intel_bios_port_supports_dp(dev_priv, port);
>+ devdata = intel_bios_encoder_data_lookup(dev_priv, port);
>+ if (!devdata) {
>+ drm_dbg_kms(&dev_priv->drm,
>+ "VBT says port %c is not present\n",
>+ port_name(port));
>+ return;
>+ }
>+
>+ init_hdmi = intel_bios_encoder_supports_dvi(devdata) ||
>+ intel_bios_encoder_supports_hdmi(devdata);
>+ init_dp = intel_bios_encoder_supports_dp(devdata);
>
> if (intel_bios_is_lspcon_present(dev_priv, port)) {
> /*
>diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>index e2c5ba61b370..57712a617839 100644
>--- a/drivers/gpu/drm/i915/i915_drv.h
>+++ b/drivers/gpu/drm/i915/i915_drv.h
>@@ -584,7 +584,7 @@ i915_fence_timeout(const struct drm_i915_private *i915)
>
> struct ddi_vbt_port_info {
> /* Non-NULL if port present. */
>- const struct intel_bios_encoder_data *devdata;
>+ struct intel_bios_encoder_data *devdata;
>
> int max_tmds_clock;
>
>@@ -592,8 +592,6 @@ struct ddi_vbt_port_info {
> u8 hdmi_level_shift;
> u8 hdmi_level_shift_set:1;
>
>- u8 supports_dvi:1;
>- u8 supports_hdmi:1;
> u8 supports_dp:1;
> u8 supports_edp:1;
> u8 supports_typec_usb:1;
>--
>2.20.1
>
>_______________________________________________
>Intel-gfx mailing list
>Intel-gfx at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/intel-gfx
More information about the Intel-gfx
mailing list