Re: [PATCH 4/7] drm/i915: Move infoframe vfuncs into intel_digital_port

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

 



Reviewed-by: Shashank Sharma

Regards
Shashank
On 6/13/2016 5:55 PM, Ville Syrjälä wrote:
On Mon, Jun 13, 2016 at 03:47:13PM +0530, Sharma, Shashank wrote:
Regards
Shashank

On 6/3/2016 1:25 AM, ville.syrjala@xxxxxxxxxxxxxxx wrote:
From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

DP ports will also want to utilize the video DIP for SDP transmission.
So let's move the vfuncs into the dig_port.

Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
---
   drivers/gpu/drm/i915/intel_ddi.c  | 20 ++++++------
   drivers/gpu/drm/i915/intel_drv.h  | 16 +++++-----
   drivers/gpu/drm/i915/intel_hdmi.c | 64 ++++++++++++++++++++-------------------
   3 files changed, 52 insertions(+), 48 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 6ff2a7b97ca6..3a882a979e5d 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1628,11 +1628,12 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
   		if (port != PORT_A || INTEL_INFO(dev_priv)->gen >= 9)
   			intel_dp_stop_link_train(intel_dp);
   	} else if (type == INTEL_OUTPUT_HDMI) {
-		struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
+		struct intel_digital_port *intel_dig_port =
+			enc_to_dig_port(encoder);

-		intel_hdmi->set_infoframes(encoder,
-					   crtc->config->has_infoframe,
-					   &crtc->config->base.adjusted_mode);
+		intel_dig_port->set_infoframes(encoder,
+					       crtc->config->has_infoframe,
+
We have kept this call still inside if (type == HDMI); now when the aim
is to make it common for all DDI interfaces, do we need this check ?
					       &crtc->config->base.adjusted_mode);

This is a purely mechanical change. No change in behaviour.

   	}
   }

@@ -1662,9 +1663,10 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
   		intel_wait_ddi_buf_idle(dev_priv, port);

   	if (type == INTEL_OUTPUT_HDMI) {
-		struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
+		struct intel_digital_port *intel_dig_port =
+			enc_to_dig_port(encoder);

-		intel_hdmi->set_infoframes(encoder, false, NULL);
+		intel_dig_port->set_infoframes(encoder, false, NULL);
Same as above.
   	}

   	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
@@ -2155,7 +2157,7 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
   	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
   	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
   	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
-	struct intel_hdmi *intel_hdmi;
+	struct intel_digital_port *intel_dig_port;
   	u32 temp, flags = 0;

   	/* XXX: DSI transcoder paranoia */
@@ -2194,9 +2196,9 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
   	switch (temp & TRANS_DDI_MODE_SELECT_MASK) {
   	case TRANS_DDI_MODE_SELECT_HDMI:
	case TRANS_DDI_MODE_SELECT_DP here: ?
   		pipe_config->has_hdmi_sink = true;
-		intel_hdmi = enc_to_intel_hdmi(&encoder->base);
+		intel_dig_port = enc_to_dig_port(&encoder->base);

-		if (intel_hdmi->infoframe_enabled(&encoder->base, pipe_config))
+		if (intel_dig_port->infoframe_enabled(&encoder->base, pipe_config))
   			pipe_config->has_infoframe = true;
   		/* fall through */
   	case TRANS_DDI_MODE_SELECT_DVI:
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index ebe7b3427e2e..a607799b7776 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -790,14 +790,6 @@ struct intel_hdmi {
   	bool rgb_quant_range_selectable;
   	enum hdmi_picture_aspect aspect_ratio;
   	struct intel_connector *attached_connector;
-	void (*write_infoframe)(struct drm_encoder *encoder,
-				enum hdmi_infoframe_type type,
-				const void *frame, ssize_t len);
-	void (*set_infoframes)(struct drm_encoder *encoder,
-			       bool enable,
-			       const struct drm_display_mode *adjusted_mode);
-	bool (*infoframe_enabled)(struct drm_encoder *encoder,
-				  const struct intel_crtc_state *pipe_config);
   };

   struct intel_dp_mst_encoder;
@@ -907,6 +899,14 @@ struct intel_digital_port {
   	uint8_t max_lanes;
   	/* for communication with audio component; protected by av_mutex */
   	const struct drm_connector *audio_connector;
+	void (*write_infoframe)(struct drm_encoder *encoder,
+				enum hdmi_infoframe_type type,
+				const void *frame, ssize_t len);
+	void (*set_infoframes)(struct drm_encoder *encoder,
+			       bool enable,
+			       const struct drm_display_mode *adjusted_mode);
+	bool (*infoframe_enabled)(struct drm_encoder *encoder,
+				  const struct intel_crtc_state *pipe_config);
   };

   struct intel_dp_mst_encoder {
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 067b10a7cb04..319f5013923c 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -427,7 +427,7 @@ static bool hsw_infoframe_enabled(struct drm_encoder *encoder,
   static void intel_write_infoframe(struct drm_encoder *encoder,
   				  union hdmi_infoframe *frame)
   {
-	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
+	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
   	uint8_t buffer[VIDEO_DIP_DATA_SIZE];
   	ssize_t len;

@@ -443,7 +443,7 @@ static void intel_write_infoframe(struct drm_encoder *encoder,
   	buffer[3] = 0;
   	len++;

-	intel_hdmi->write_infoframe(encoder, frame->any.type, buffer, len);
+	intel_dig_port->write_infoframe(encoder, frame->any.type, buffer, len);
   }

   static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
@@ -930,6 +930,7 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,
   				  struct intel_crtc_state *pipe_config)
   {
   	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
+	struct intel_digital_port *intel_dig_port = hdmi_to_dig_port(intel_hdmi);
   	struct drm_device *dev = encoder->base.dev;
   	struct drm_i915_private *dev_priv = dev->dev_private;
   	u32 tmp, flags = 0;
@@ -950,7 +951,7 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,
   	if (tmp & HDMI_MODE_SELECT_HDMI)
   		pipe_config->has_hdmi_sink = true;

-	if (intel_hdmi->infoframe_enabled(&encoder->base, pipe_config))
+	if (intel_dig_port->infoframe_enabled(&encoder->base, pipe_config))
   		pipe_config->has_infoframe = true;

   	if (tmp & SDVO_AUDIO_ENABLE)
@@ -1117,6 +1118,8 @@ static void intel_disable_hdmi(struct intel_encoder *encoder)
   	struct drm_device *dev = encoder->base.dev;
   	struct drm_i915_private *dev_priv = dev->dev_private;
   	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
+	struct intel_digital_port *intel_dig_port =
+		hdmi_to_dig_port(intel_hdmi);
   	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
   	u32 temp;

@@ -1159,7 +1162,7 @@ static void intel_disable_hdmi(struct intel_encoder *encoder)
   		intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, true);
   	}

-	intel_hdmi->set_infoframes(&encoder->base, false, NULL);
+	intel_dig_port->set_infoframes(&encoder->base, false, NULL);

I guess there is a separate patch where you are adding the code which
uses these functions for DP, and will going further in this series.
- Shashank
   	intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
   }
@@ -1658,21 +1661,21 @@ done:

   static void intel_hdmi_pre_enable(struct intel_encoder *encoder)
   {
-	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
+	struct intel_digital_port *intel_dig_port =
+		enc_to_dig_port(&encoder->base);
   	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
   	const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;

   	intel_hdmi_prepare(encoder);

-	intel_hdmi->set_infoframes(&encoder->base,
-				   intel_crtc->config->has_infoframe,
-				   adjusted_mode);
+	intel_dig_port->set_infoframes(&encoder->base,
+				       intel_crtc->config->has_infoframe,
+				       adjusted_mode);
   }

   static void vlv_hdmi_pre_enable(struct intel_encoder *encoder)
   {
   	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
-	struct intel_hdmi *intel_hdmi = &dport->hdmi;
   	struct drm_device *dev = encoder->base.dev;
   	struct drm_i915_private *dev_priv = dev->dev_private;
   	struct intel_crtc *intel_crtc =
@@ -1685,9 +1688,9 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder)
   	vlv_set_phy_signal_level(encoder, 0x2b245f5f, 0x00002000, 0x5578b83a,
   				 0x2b247878);

-	intel_hdmi->set_infoframes(&encoder->base,
-				   intel_crtc->config->has_infoframe,
-				   adjusted_mode);
+	dport->set_infoframes(&encoder->base,
+			      intel_crtc->config->has_infoframe,
+			      adjusted_mode);

   	g4x_enable_hdmi(encoder);

@@ -1735,7 +1738,6 @@ static void chv_hdmi_post_disable(struct intel_encoder *encoder)
   static void chv_hdmi_pre_enable(struct intel_encoder *encoder)
   {
   	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
-	struct intel_hdmi *intel_hdmi = &dport->hdmi;
   	struct drm_device *dev = encoder->base.dev;
   	struct drm_i915_private *dev_priv = dev->dev_private;
   	struct intel_crtc *intel_crtc =
@@ -1748,9 +1750,9 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder)
   	/* Use 800mV-0dB */
   	chv_set_phy_signal_level(encoder, 128, 102, false);

-	intel_hdmi->set_infoframes(&encoder->base,
-				   intel_crtc->config->has_infoframe,
-				   adjusted_mode);
+	dport->set_infoframes(&encoder->base,
+			      intel_crtc->config->has_infoframe,
+			      adjusted_mode);

   	g4x_enable_hdmi(encoder);

@@ -1882,25 +1884,25 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
   	}

   	if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) {
-		intel_hdmi->write_infoframe = vlv_write_infoframe;
-		intel_hdmi->set_infoframes = vlv_set_infoframes;
-		intel_hdmi->infoframe_enabled = vlv_infoframe_enabled;
+		intel_dig_port->write_infoframe = vlv_write_infoframe;
+		intel_dig_port->set_infoframes = vlv_set_infoframes;
+		intel_dig_port->infoframe_enabled = vlv_infoframe_enabled;
   	} else if (IS_G4X(dev)) {
-		intel_hdmi->write_infoframe = g4x_write_infoframe;
-		intel_hdmi->set_infoframes = g4x_set_infoframes;
-		intel_hdmi->infoframe_enabled = g4x_infoframe_enabled;
+		intel_dig_port->write_infoframe = g4x_write_infoframe;
+		intel_dig_port->set_infoframes = g4x_set_infoframes;
+		intel_dig_port->infoframe_enabled = g4x_infoframe_enabled;
   	} else if (HAS_DDI(dev)) {
-		intel_hdmi->write_infoframe = hsw_write_infoframe;
-		intel_hdmi->set_infoframes = hsw_set_infoframes;
-		intel_hdmi->infoframe_enabled = hsw_infoframe_enabled;
+		intel_dig_port->write_infoframe = hsw_write_infoframe;
+		intel_dig_port->set_infoframes = hsw_set_infoframes;
+		intel_dig_port->infoframe_enabled = hsw_infoframe_enabled;
   	} else if (HAS_PCH_IBX(dev)) {
-		intel_hdmi->write_infoframe = ibx_write_infoframe;
-		intel_hdmi->set_infoframes = ibx_set_infoframes;
-		intel_hdmi->infoframe_enabled = ibx_infoframe_enabled;
+		intel_dig_port->write_infoframe = ibx_write_infoframe;
+		intel_dig_port->set_infoframes = ibx_set_infoframes;
+		intel_dig_port->infoframe_enabled = ibx_infoframe_enabled;
   	} else {
-		intel_hdmi->write_infoframe = cpt_write_infoframe;
-		intel_hdmi->set_infoframes = cpt_set_infoframes;
-		intel_hdmi->infoframe_enabled = cpt_infoframe_enabled;
+		intel_dig_port->write_infoframe = cpt_write_infoframe;
+		intel_dig_port->set_infoframes = cpt_set_infoframes;
+		intel_dig_port->infoframe_enabled = cpt_infoframe_enabled;
   	}

   	if (HAS_DDI(dev))


_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux