Nouveau Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Nouveau] [PATCH 0/9] drm: convert to using is_hdmi and has_audio from display info
@ 2022-09-01 12:47 Jani Nikula
  2022-09-01 12:47 ` [Nouveau] [PATCH 2/9] drm/nouveau: " Jani Nikula
  0 siblings, 1 reply; 3+ messages in thread
From: Jani Nikula @ 2022-09-01 12:47 UTC (permalink / raw)
  To: dri-devel
  Cc: Heiko Stübner, Jani Nikula, nouveau, intel-gfx, Pan, Xinhui,
	Seung-Woo Kim, Sandy Huang, amd-gfx, Russell King, Inki Dae,
	Alex Deucher, Kyungmin Park, Thierry Reding, Laurent Pinchart,
	linux-tegra, Alain Volmat, Christian König, Ben Skeggs

The low-hanging fruit of the drm todo item "Replace
drm_detect_hdmi_monitor() with drm_display_info.is_hdmi", with has_audio
changes on top.

I'm afraid not all of these have been even build tested, let alone
actually tested.


BR,
Jani.


Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: Heiko Stübner <heiko@sntech.de>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: Heiko Stübner <heiko@sntech.de>
Cc: Alain Volmat <alain.volmat@foss.st.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-tegra@vger.kernel.org
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: nouveau@lists.freedesktop.org

Jani Nikula (9):
  drm/edid: parse display info has_audio similar to is_hdmi
  drm/nouveau: convert to using is_hdmi and has_audio from display info
  drm/radeon: convert to using is_hdmi and has_audio from display info
  drm/tegra: convert to using is_hdmi from display info
  drm/exynos: convert to using is_hdmi from display info
  drm/i2c/tda998x: convert to using has_audio from display_info
  drm/sti/sti_hdmi: convert to using is_hdmi from display info
  drm/rockchip: cdn-dp: call drm_connector_update_edid_property()
    unconditionally
  drm/rockchip: convert to using has_audio from display_info

 drivers/gpu/drm/drm_edid.c                  |  6 ++++++
 drivers/gpu/drm/exynos/exynos_hdmi.c        |  5 +++--
 drivers/gpu/drm/i2c/tda998x_drv.c           |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c     |  8 ++++----
 drivers/gpu/drm/nouveau/dispnv50/head.c     |  8 +-------
 drivers/gpu/drm/nouveau/nouveau_connector.c |  2 +-
 drivers/gpu/drm/radeon/atombios_encoders.c  | 10 +++++-----
 drivers/gpu/drm/radeon/evergreen_hdmi.c     |  5 ++---
 drivers/gpu/drm/radeon/radeon_audio.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 ++--
 drivers/gpu/drm/rockchip/cdn-dp-core.c      |  7 +++----
 drivers/gpu/drm/rockchip/inno_hdmi.c        |  3 ++-
 drivers/gpu/drm/sti/sti_hdmi.c              | 11 ++++++-----
 drivers/gpu/drm/sti/sti_hdmi.h              |  2 --
 drivers/gpu/drm/tegra/hdmi.c                |  9 +--------
 include/drm/drm_connector.h                 |  8 ++++++++
 18 files changed, 55 insertions(+), 55 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Nouveau] [PATCH 2/9] drm/nouveau: convert to using is_hdmi and has_audio from display info
  2022-09-01 12:47 [Nouveau] [PATCH 0/9] drm: convert to using is_hdmi and has_audio from display info Jani Nikula
@ 2022-09-01 12:47 ` Jani Nikula
  2022-09-01 20:16   ` Lyude Paul
  0 siblings, 1 reply; 3+ messages in thread
From: Jani Nikula @ 2022-09-01 12:47 UTC (permalink / raw)
  To: dri-devel; +Cc: Jani Nikula, nouveau, intel-gfx, Laurent Pinchart, Ben Skeggs

Prefer the parsed results for is_hdmi and has_audio in display info over
calling drm_detect_hdmi_monitor() and drm_detect_monitor_audio(),
respectively.

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c     | 8 ++++----
 drivers/gpu/drm/nouveau/dispnv50/head.c     | 8 +-------
 drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +-
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 33c97d510999..d0d9494b729c 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -769,7 +769,7 @@ nv50_audio_enable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc,
 				     (0x0100 << nv_crtc->index),
 	};
 
-	if (!drm_detect_monitor_audio(nv_connector->edid))
+	if (!nv_connector->base.display_info.has_audio)
 		return;
 
 	mutex_lock(&drm->audio.lock);
@@ -839,7 +839,7 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc,
 	int ret;
 	int size;
 
-	if (!drm_detect_hdmi_monitor(nv_connector->edid))
+	if (!nv_connector->base.display_info.is_hdmi)
 		return;
 
 	hdmi = &nv_connector->base.display_info.hdmi;
@@ -1705,7 +1705,7 @@ nv50_sor_atomic_enable(struct drm_encoder *encoder, struct drm_atomic_state *sta
 
 	if ((disp->disp->object.oclass == GT214_DISP ||
 	     disp->disp->object.oclass >= GF110_DISP) &&
-	    drm_detect_monitor_audio(nv_connector->edid))
+	    nv_connector->base.display_info.has_audio)
 		hda = true;
 	nv50_outp_acquire(nv_encoder, hda);
 
@@ -1721,7 +1721,7 @@ nv50_sor_atomic_enable(struct drm_encoder *encoder, struct drm_atomic_state *sta
 			 */
 			if (mode->clock >= 165000 &&
 			    nv_encoder->dcb->duallink_possible &&
-			    !drm_detect_hdmi_monitor(nv_connector->edid))
+			    !nv_connector->base.display_info.is_hdmi)
 				proto = NV507D_SOR_SET_CONTROL_PROTOCOL_DUAL_TMDS;
 		} else {
 			proto = NV507D_SOR_SET_CONTROL_PROTOCOL_SINGLE_TMDS_B;
diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c
index c3c57be54e1c..8b5bc834f1b3 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
@@ -127,14 +127,8 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh,
 	struct drm_display_mode *omode = &asyh->state.adjusted_mode;
 	struct drm_display_mode *umode = &asyh->state.mode;
 	int mode = asyc->scaler.mode;
-	struct edid *edid;
 	int umode_vdisplay, omode_hdisplay, omode_vdisplay;
 
-	if (connector->edid_blob_ptr)
-		edid = (struct edid *)connector->edid_blob_ptr->data;
-	else
-		edid = NULL;
-
 	if (!asyc->scaler.full) {
 		if (mode == DRM_MODE_SCALE_NONE)
 			omode = umode;
@@ -162,7 +156,7 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh,
 	 */
 	if ((asyc->scaler.underscan.mode == UNDERSCAN_ON ||
 	    (asyc->scaler.underscan.mode == UNDERSCAN_AUTO &&
-	     drm_detect_hdmi_monitor(edid)))) {
+	     connector->display_info.is_hdmi))) {
 		u32 bX = asyc->scaler.underscan.hborder;
 		u32 bY = asyc->scaler.underscan.vborder;
 		u32 r = (asyh->view.oH << 19) / asyh->view.oW;
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 1991bbb1d05c..2ef5fb8df4ed 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1012,7 +1012,7 @@ get_tmds_link_bandwidth(struct drm_connector *connector)
 	unsigned duallink_scale =
 		nouveau_duallink && nv_encoder->dcb->duallink_possible ? 2 : 1;
 
-	if (drm_detect_hdmi_monitor(nv_connector->edid)) {
+	if (nv_connector->base.display_info.is_hdmi) {
 		info = &nv_connector->base.display_info;
 		duallink_scale = 1;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Nouveau] [PATCH 2/9] drm/nouveau: convert to using is_hdmi and has_audio from display info
  2022-09-01 12:47 ` [Nouveau] [PATCH 2/9] drm/nouveau: " Jani Nikula
@ 2022-09-01 20:16   ` Lyude Paul
  0 siblings, 0 replies; 3+ messages in thread
From: Lyude Paul @ 2022-09-01 20:16 UTC (permalink / raw)
  To: Jani Nikula, dri-devel; +Cc: nouveau, intel-gfx, Laurent Pinchart, Ben Skeggs

Reviewed-by: Lyude Paul <lyude@redhat.com>

Also, went ahead and tested this for you on one of my machines:

Tested-by: Lyude Paul <lyude@redhat.com>

On Thu, 2022-09-01 at 15:47 +0300, Jani Nikula wrote:
> Prefer the parsed results for is_hdmi and has_audio in display info over
> calling drm_detect_hdmi_monitor() and drm_detect_monitor_audio(),
> respectively.
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/nouveau/dispnv50/disp.c     | 8 ++++----
>  drivers/gpu/drm/nouveau/dispnv50/head.c     | 8 +-------
>  drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +-
>  3 files changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index 33c97d510999..d0d9494b729c 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -769,7 +769,7 @@ nv50_audio_enable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc,
>  				     (0x0100 << nv_crtc->index),
>  	};
>  
> -	if (!drm_detect_monitor_audio(nv_connector->edid))
> +	if (!nv_connector->base.display_info.has_audio)
>  		return;
>  
>  	mutex_lock(&drm->audio.lock);
> @@ -839,7 +839,7 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc,
>  	int ret;
>  	int size;
>  
> -	if (!drm_detect_hdmi_monitor(nv_connector->edid))
> +	if (!nv_connector->base.display_info.is_hdmi)
>  		return;
>  
>  	hdmi = &nv_connector->base.display_info.hdmi;
> @@ -1705,7 +1705,7 @@ nv50_sor_atomic_enable(struct drm_encoder *encoder, struct drm_atomic_state *sta
>  
>  	if ((disp->disp->object.oclass == GT214_DISP ||
>  	     disp->disp->object.oclass >= GF110_DISP) &&
> -	    drm_detect_monitor_audio(nv_connector->edid))
> +	    nv_connector->base.display_info.has_audio)
>  		hda = true;
>  	nv50_outp_acquire(nv_encoder, hda);
>  
> @@ -1721,7 +1721,7 @@ nv50_sor_atomic_enable(struct drm_encoder *encoder, struct drm_atomic_state *sta
>  			 */
>  			if (mode->clock >= 165000 &&
>  			    nv_encoder->dcb->duallink_possible &&
> -			    !drm_detect_hdmi_monitor(nv_connector->edid))
> +			    !nv_connector->base.display_info.is_hdmi)
>  				proto = NV507D_SOR_SET_CONTROL_PROTOCOL_DUAL_TMDS;
>  		} else {
>  			proto = NV507D_SOR_SET_CONTROL_PROTOCOL_SINGLE_TMDS_B;
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c
> index c3c57be54e1c..8b5bc834f1b3 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/head.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
> @@ -127,14 +127,8 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh,
>  	struct drm_display_mode *omode = &asyh->state.adjusted_mode;
>  	struct drm_display_mode *umode = &asyh->state.mode;
>  	int mode = asyc->scaler.mode;
> -	struct edid *edid;
>  	int umode_vdisplay, omode_hdisplay, omode_vdisplay;
>  
> -	if (connector->edid_blob_ptr)
> -		edid = (struct edid *)connector->edid_blob_ptr->data;
> -	else
> -		edid = NULL;
> -
>  	if (!asyc->scaler.full) {
>  		if (mode == DRM_MODE_SCALE_NONE)
>  			omode = umode;
> @@ -162,7 +156,7 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh,
>  	 */
>  	if ((asyc->scaler.underscan.mode == UNDERSCAN_ON ||
>  	    (asyc->scaler.underscan.mode == UNDERSCAN_AUTO &&
> -	     drm_detect_hdmi_monitor(edid)))) {
> +	     connector->display_info.is_hdmi))) {
>  		u32 bX = asyc->scaler.underscan.hborder;
>  		u32 bY = asyc->scaler.underscan.vborder;
>  		u32 r = (asyh->view.oH << 19) / asyh->view.oW;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
> index 1991bbb1d05c..2ef5fb8df4ed 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_connector.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
> @@ -1012,7 +1012,7 @@ get_tmds_link_bandwidth(struct drm_connector *connector)
>  	unsigned duallink_scale =
>  		nouveau_duallink && nv_encoder->dcb->duallink_possible ? 2 : 1;
>  
> -	if (drm_detect_hdmi_monitor(nv_connector->edid)) {
> +	if (nv_connector->base.display_info.is_hdmi) {
>  		info = &nv_connector->base.display_info;
>  		duallink_scale = 1;
>  	}

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-01 20:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-01 12:47 [Nouveau] [PATCH 0/9] drm: convert to using is_hdmi and has_audio from display info Jani Nikula
2022-09-01 12:47 ` [Nouveau] [PATCH 2/9] drm/nouveau: " Jani Nikula
2022-09-01 20:16   ` Lyude Paul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox