Re: [PATCH] drm/radeon: Replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi

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

 



On Wed, Jun 15, 2022 at 8:33 AM hongao <hongao@xxxxxxxxxxxxx> wrote:
>
> Replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi for more
> efficiency
>
> Tested on "Oland [Radeon HD 8570 / R7 240/340 OEM]" & "Caicos [R5 230]"

Can you verify that drm_display_info.is_hdmi has been populated when
all of these functions are called?

Alex

>
> Signed-off-by: hongao <hongao@xxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/radeon/atombios_encoders.c |  6 +++---
>  drivers/gpu/drm/radeon/radeon_connectors.c | 12 ++++++------
>  drivers/gpu/drm/radeon/radeon_display.c    |  2 +-
>  drivers/gpu/drm/radeon/radeon_encoders.c   |  4 ++--
>  4 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
> index 70bd84b7ef2b..393d471ba396 100644
> --- a/drivers/gpu/drm/radeon/atombios_encoders.c
> +++ b/drivers/gpu/drm/radeon/atombios_encoders.c
> @@ -714,7 +714,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder)
>                         if (radeon_connector->use_digital &&
>                             (radeon_connector->audio == RADEON_AUDIO_ENABLE))
>                                 return ATOM_ENCODER_MODE_HDMI;
> -                       else if (drm_detect_hdmi_monitor(radeon_connector_edid(connector)) &&
> +                       else if (connector->display_info.is_hdmi &&
>                                  (radeon_connector->audio == RADEON_AUDIO_AUTO))
>                                 return ATOM_ENCODER_MODE_HDMI;
>                         else if (radeon_connector->use_digital)
> @@ -733,7 +733,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder)
>                 if (radeon_audio != 0) {
>                         if (radeon_connector->audio == RADEON_AUDIO_ENABLE)
>                                 return ATOM_ENCODER_MODE_HDMI;
> -                       else if (drm_detect_hdmi_monitor(radeon_connector_edid(connector)) &&
> +                       else if (connector->display_info.is_hdmi &&
>                                  (radeon_connector->audio == RADEON_AUDIO_AUTO))
>                                 return ATOM_ENCODER_MODE_HDMI;
>                         else
> @@ -757,7 +757,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder)
>                 } else if (radeon_audio != 0) {
>                         if (radeon_connector->audio == RADEON_AUDIO_ENABLE)
>                                 return ATOM_ENCODER_MODE_HDMI;
> -                       else if (drm_detect_hdmi_monitor(radeon_connector_edid(connector)) &&
> +                       else if (connector->display_info.is_hdmi &&
>                                  (radeon_connector->audio == RADEON_AUDIO_AUTO))
>                                 return ATOM_ENCODER_MODE_HDMI;
>                         else
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
> index 58db79921cd3..2fbec7bdd56b 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -130,7 +130,7 @@ int radeon_get_monitor_bpc(struct drm_connector *connector)
>         case DRM_MODE_CONNECTOR_DVII:
>         case DRM_MODE_CONNECTOR_HDMIB:
>                 if (radeon_connector->use_digital) {
> -                       if (drm_detect_hdmi_monitor(radeon_connector_edid(connector))) {
> +                       if (connector->display_info.is_hdmi) {
>                                 if (connector->display_info.bpc)
>                                         bpc = connector->display_info.bpc;
>                         }
> @@ -138,7 +138,7 @@ int radeon_get_monitor_bpc(struct drm_connector *connector)
>                 break;
>         case DRM_MODE_CONNECTOR_DVID:
>         case DRM_MODE_CONNECTOR_HDMIA:
> -               if (drm_detect_hdmi_monitor(radeon_connector_edid(connector))) {
> +               if (connector->display_info.is_hdmi) {
>                         if (connector->display_info.bpc)
>                                 bpc = connector->display_info.bpc;
>                 }
> @@ -147,7 +147,7 @@ int radeon_get_monitor_bpc(struct drm_connector *connector)
>                 dig_connector = radeon_connector->con_priv;
>                 if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
>                     (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) ||
> -                   drm_detect_hdmi_monitor(radeon_connector_edid(connector))) {
> +                   connector->display_info.is_hdmi) {
>                         if (connector->display_info.bpc)
>                                 bpc = connector->display_info.bpc;
>                 }
> @@ -171,7 +171,7 @@ int radeon_get_monitor_bpc(struct drm_connector *connector)
>                 break;
>         }
>
> -       if (drm_detect_hdmi_monitor(radeon_connector_edid(connector))) {
> +       if (connector->display_info.is_hdmi) {
>                 /* hdmi deep color only implemented on DCE4+ */
>                 if ((bpc > 8) && !ASIC_IS_DCE4(rdev)) {
>                         DRM_DEBUG("%s: HDMI deep color %d bpc unsupported. Using 8 bpc.\n",
> @@ -1500,7 +1500,7 @@ static enum drm_mode_status radeon_dvi_mode_valid(struct drm_connector *connecto
>                     (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) ||
>                     (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B))
>                         return MODE_OK;
> -               else if (ASIC_IS_DCE6(rdev) && drm_detect_hdmi_monitor(radeon_connector_edid(connector))) {
> +               else if (ASIC_IS_DCE6(rdev) && connector->display_info.is_hdmi) {
>                         /* HDMI 1.3+ supports max clock of 340 Mhz */
>                         if (mode->clock > 340000)
>                                 return MODE_CLOCK_HIGH;
> @@ -1808,7 +1808,7 @@ static enum drm_mode_status radeon_dp_mode_valid(struct drm_connector *connector
>                     (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) {
>                         return radeon_dp_mode_valid_helper(connector, mode);
>                 } else {
> -                       if (ASIC_IS_DCE6(rdev) && drm_detect_hdmi_monitor(radeon_connector_edid(connector))) {
> +                       if (ASIC_IS_DCE6(rdev) && connector->display_info.is_hdmi) {
>                                 /* HDMI 1.3+ supports max clock of 340 Mhz */
>                                 if (mode->clock > 340000)
>                                         return MODE_CLOCK_HIGH;
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 57ff2b723c87..c7a1e3af55cf 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1728,7 +1728,7 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
>                             (!(mode->flags & DRM_MODE_FLAG_INTERLACE)) &&
>                             ((radeon_encoder->underscan_type == UNDERSCAN_ON) ||
>                              ((radeon_encoder->underscan_type == UNDERSCAN_AUTO) &&
> -                             drm_detect_hdmi_monitor(radeon_connector_edid(connector)) &&
> +                             connector->display_info.is_hdmi &&
>                               is_hdtv_mode(mode)))) {
>                                 if (radeon_encoder->underscan_hborder != 0)
>                                         radeon_crtc->h_border = radeon_encoder->underscan_hborder;
> diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
> index 46549d5179ee..b999464f213a 100644
> --- a/drivers/gpu/drm/radeon/radeon_encoders.c
> +++ b/drivers/gpu/drm/radeon/radeon_encoders.c
> @@ -383,7 +383,7 @@ bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder,
>         case DRM_MODE_CONNECTOR_HDMIB:
>                 if (radeon_connector->use_digital) {
>                         /* HDMI 1.3 supports up to 340 Mhz over single link */
> -                       if (ASIC_IS_DCE6(rdev) && drm_detect_hdmi_monitor(radeon_connector_edid(connector))) {
> +                       if (ASIC_IS_DCE6(rdev) && connector->display_info.is_hdmi) {
>                                 if (pixel_clock > 340000)
>                                         return true;
>                                 else
> @@ -408,7 +408,7 @@ bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder,
>                         return false;
>                 else {
>                         /* HDMI 1.3 supports up to 340 Mhz over single link */
> -                       if (ASIC_IS_DCE6(rdev) && drm_detect_hdmi_monitor(radeon_connector_edid(connector))) {
> +                       if (ASIC_IS_DCE6(rdev) && connector->display_info.is_hdmi) {
>                                 if (pixel_clock > 340000)
>                                         return true;
>                                 else
> --
> 2.20.1
>
>
>
>



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux