Skip to contentSkip to conversation

drm/i915/sdvo: Shut up state checker with hdmi cards on gen3

PATCH In review Daniel Vetter 3 participants 5 messages Jul 25, 2017 – Jul 26, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/sdvo: Shut up state checker with hdmi cards on gen3

The hdmi bits simply don't exist, so nerf them. I think audio doesn't work on gen3 at all, and for the limited color range we should probably use the colorimetry sdvo paramater instead of the bit in the port.

But fixing sdvo isn't my goal, I just want to get the backtrace out of the way, and this takes care of that.

Still, while at it fix the missing read-out of the gen4 audio bit, maybe that part even works ...

---
 drivers/gpu/drm/i915/intel_sdvo.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_sdvo.c +10 -0
index bea8152ae859..0403e30dfabc 100644
@@ -1113,6 +1113,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
 				      struct intel_crtc_state *pipe_config,
 				      struct drm_connector_state *conn_state)
 {
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
 	struct intel_sdvo_connector_state *intel_sdvo_state =
 		to_intel_sdvo_connector_state(conn_state);
@@ -1174,6 +1175,12 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
 			pipe_config->limited_color_range = true;
 	}
 
+	/* gen3 doesn't do the hdmi bits in the SDVO register */
+	if (INTEL_GEN(dev_priv) < 4) {
+		pipe_config->limited_color_range = false;
+		pipe_config->has_audio = false;
+	}
+
 	/* Clock computation needs to happen after pixel multiplier. */
 	if (intel_sdvo->is_tv)
 		i9xx_adjust_sdvo_tv_clock(pipe_config);
@@ -1480,6 +1487,9 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
 	if (sdvox & HDMI_COLOR_RANGE_16_235)
 		pipe_config->limited_color_range = true;
 
+	if (sdvox & SDVO_AUDIO_ENABLE)
+		pipe_config->has_audio = true;
+
 	if (intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_ENCODE,
 				 &val, 1)) {
 		if (val == SDVO_ENCODE_HDMI)
Signature · 6 lines
2.13.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for drm/i915/sdvo: Shut up state checker with hdmi cards on gen3

== Series Details ==

== Series Details ==

Series: drm/i915/sdvo: Shut up state checker with hdmi cards on gen3
URL : https://patchwork.freedesktop.org/series/27860/
State : failure

== Summary ==

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/compile.h
  CHK     kernel/config_data.h
  CC [M]  drivers/gpu/drm/i915/intel_hangcheck.o

In file included from drivers/gpu/drm/i915/intel_hangcheck.c:485:0:
drivers/gpu/drm/i915/selftests/intel_hangcheck.c: In function ‘igt_render_engine_reset_fallback’:
drivers/gpu/drm/i915/selftests/intel_hangcheck.c:845:3: error: too few arguments to function ‘i915_reset’
i915_reset(i915);
^~~~~~~~~~
In file included from drivers/gpu/drm/i915/intel_hangcheck.c:25:0:
drivers/gpu/drm/i915/i915_drv.h:3115:13: note: declared here
extern void i915_reset(struct drm_i915_private *i915, unsigned int flags);

             ^~~~~~~~~~

scripts/Makefile.build:302: recipe for target 'drivers/gpu/drm/i915/intel_hangcheck.o' failed make[4]: *** [drivers/gpu/drm/i915/intel_hangcheck.o] Error 1 scripts/Makefile.build:561: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:561: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:561: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1019: recipe for target 'drivers' failed
make: *** [drivers] Error 2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Daniel Vetter

Quoting Daniel Vetter (2017-07-25 14:48:41)

Quoted 29 lines

The hdmi bits simply don't exist, so nerf them. I think audio doesn't work on gen3 at all, and for the limited color range we should probably use the colorimetry sdvo paramater instead of the bit in the port.

But fixing sdvo isn't my goal, I just want to get the backtrace out of the way, and this takes care of that.

Still, while at it fix the missing read-out of the gen4 audio bit, maybe that part even works ...

---
 drivers/gpu/drm/i915/intel_sdvo.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_sdvo.c +1 -0
index bea8152ae859..0403e30dfabc 100644
@@ -1113,6 +1113,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
                                      struct intel_crtc_state *pipe_config,
                                      struct drm_connector_state *conn_state)
 {
+       struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
        struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
        struct intel_sdvo_connector_state *intel_sdvo_state =
                to_intel_sdvo_connector_state(conn_state);

drivers/gpu/drm/i915/intel_sdvo.c static bool intel_sdvo_compute_config(struct intel_encoder *encoder, · line 1182

Quoted 8 lines
drivers/gpu/drm/i915/intel_sdvo.c +5 -0
@@ -1174,6 +1175,12 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
                        pipe_config->limited_color_range = true;
        }
 
+       /* gen3 doesn't do the hdmi bits in the SDVO register */
+       if (INTEL_GEN(dev_priv) < 4) {
+               pipe_config->limited_color_range = false;
+               pipe_config->has_audio = false;
+       }

So historically, this would be

	if (!intel_sdvo->is_hdmi) {
		pipe_config->limited_color_range = false;
		pipe_config->has_audio = false;
	}

Currently we set

	pipe_config->has_audio =
		intel_sdvo_state->base.force_audio == HDMI_AUDIO_ON ||
		(intel_sdvo_state->base.force_audio == HDMI_AUDIO_AUTO && intel_sdvo->has_hdmi_audio))

and, with a slight paraphrase,

	pipe_config->limited_color_range = pipe_config->has_hdmi_sink;

So, both of these should only be set if we have hdmi features which gen3 will not. So I think the consistent fix is

        switch (intel_sdvo_state->base.force_audio) {
        case HDMI_AUDIO_ON:
                pipe_config->has_audio = intel_sdvo->is_hdmi;
                break;
        case HDMI_AUDIO_AUTO:
                pipe_config->has_audio = intel_sdvo->has_hdmi_audio;
                break;
        case HDMI_AUDIO_OFF:
        case HDMI_AUDIO_OFF_DVI:
                pipe_config->has_audio = false;
                break;
        }

Though I'm not sure what the actual subtlety of OFF_DVI is.

drivers/gpu/drm/i915/intel_sdvo.c static void intel_sdvo_get_config(struct intel_encoder *encoder, · line 1491

Quoted 10 lines
drivers/gpu/drm/i915/intel_sdvo.c +3 -0
+
        /* Clock computation needs to happen after pixel multiplier. */
        if (intel_sdvo->is_tv)
                i9xx_adjust_sdvo_tv_clock(pipe_config);
@@ -1480,6 +1487,9 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
        if (sdvox & HDMI_COLOR_RANGE_16_235)
                pipe_config->limited_color_range = true;
 
+       if (sdvox & SDVO_AUDIO_ENABLE)
+               pipe_config->has_audio = true;

This seems to be its own little fix that looks correct. -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 72 lines · Chris Wilson

Quoting Daniel Vetter (2017-07-25 14:48:41)

Quoted 29 lines

The hdmi bits simply don't exist, so nerf them. I think audio doesn't work on gen3 at all, and for the limited color range we should probably use the colorimetry sdvo paramater instead of the bit in the port.

But fixing sdvo isn't my goal, I just want to get the backtrace out of the way, and this takes care of that.

Still, while at it fix the missing read-out of the gen4 audio bit, maybe that part even works ...

---
 drivers/gpu/drm/i915/intel_sdvo.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_sdvo.c +1 -0
index bea8152ae859..0403e30dfabc 100644
@@ -1113,6 +1113,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
                                      struct intel_crtc_state *pipe_config,
                                      struct drm_connector_state *conn_state)
 {
+       struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
        struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
        struct intel_sdvo_connector_state *intel_sdvo_state =
                to_intel_sdvo_connector_state(conn_state);

drivers/gpu/drm/i915/intel_sdvo.c static bool intel_sdvo_compute_config(struct intel_encoder *encoder, · line 1182

Quoted 8 lines
drivers/gpu/drm/i915/intel_sdvo.c +5 -0
@@ -1174,6 +1175,12 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
                        pipe_config->limited_color_range = true;
        }
 
+       /* gen3 doesn't do the hdmi bits in the SDVO register */
+       if (INTEL_GEN(dev_priv) < 4) {
+               pipe_config->limited_color_range = false;
+               pipe_config->has_audio = false;
+       }

So historically, this would be

        if (!intel_sdvo->is_hdmi) {
                pipe_config->limited_color_range = false;
                pipe_config->has_audio = false;
        }

Currently we set

        pipe_config->has_audio =
                intel_sdvo_state->base.force_audio == HDMI_AUDIO_ON ||
                (intel_sdvo_state->base.force_audio == HDMI_AUDIO_AUTO && intel_sdvo->has_hdmi_audio))

and, with a slight paraphrase,

        pipe_config->limited_color_range = pipe_config->has_hdmi_sink;

So, both of these should only be set if we have hdmi features which gen3 will not. So I think the consistent fix is

        switch (intel_sdvo_state->base.force_audio) {
        case HDMI_AUDIO_ON:
                pipe_config->has_audio = intel_sdvo->is_hdmi;
                break;
        case HDMI_AUDIO_AUTO:
                pipe_config->has_audio = intel_sdvo->has_hdmi_audio;
                break;
        case HDMI_AUDIO_OFF:
        case HDMI_AUDIO_OFF_DVI:
                pipe_config->has_audio = false;
                break;
        }
Quoted 1 line

Though I'm not sure what the actual subtlety of OFF_DVI is.

is_hdmi is set when the SDVO transcoder supports hdmi. And you can plug a hdmi sdvo chip into a gen3 box, which is why this blows up here. I guess I could try to limit that, that should take care of things complete. Together with making sure we don't set any of the hdmi state bits if the is_hdmi is false (which I hope we already do). -Daniel

Quoted 14 lines

drivers/gpu/drm/i915/intel_sdvo.c static void intel_sdvo_get_config(struct intel_encoder *encoder, · line 1491

Quoted 11 lines
drivers/gpu/drm/i915/intel_sdvo.c +3 -0
+
        /* Clock computation needs to happen after pixel multiplier. */
        if (intel_sdvo->is_tv)
                i9xx_adjust_sdvo_tv_clock(pipe_config);
@@ -1480,6 +1487,9 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
        if (sdvox & HDMI_COLOR_RANGE_16_235)
                pipe_config->limited_color_range = true;
 
+       if (sdvox & SDVO_AUDIO_ENABLE)
+               pipe_config->has_audio = true;

This seems to be its own little fix that looks correct. -Chris

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Quoting Daniel Vetter (2017-07-26 18:52:06)

Quoted 73 lines · Chris Wilson
Quoted 72 lines

Quoting Daniel Vetter (2017-07-25 14:48:41)

Quoted 29 lines

The hdmi bits simply don't exist, so nerf them. I think audio doesn't work on gen3 at all, and for the limited color range we should probably use the colorimetry sdvo paramater instead of the bit in the port.

But fixing sdvo isn't my goal, I just want to get the backtrace out of the way, and this takes care of that.

Still, while at it fix the missing read-out of the gen4 audio bit, maybe that part even works ...

---
 drivers/gpu/drm/i915/intel_sdvo.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_sdvo.c +1 -0
index bea8152ae859..0403e30dfabc 100644
@@ -1113,6 +1113,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
                                      struct intel_crtc_state *pipe_config,
                                      struct drm_connector_state *conn_state)
 {
+       struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
        struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
        struct intel_sdvo_connector_state *intel_sdvo_state =
                to_intel_sdvo_connector_state(conn_state);

drivers/gpu/drm/i915/intel_sdvo.c static bool intel_sdvo_compute_config(struct intel_encoder *encoder, · line 1182

Quoted 8 lines
drivers/gpu/drm/i915/intel_sdvo.c +5 -0
@@ -1174,6 +1175,12 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
                        pipe_config->limited_color_range = true;
        }
 
+       /* gen3 doesn't do the hdmi bits in the SDVO register */
+       if (INTEL_GEN(dev_priv) < 4) {
+               pipe_config->limited_color_range = false;
+               pipe_config->has_audio = false;
+       }

So historically, this would be

        if (!intel_sdvo->is_hdmi) {
                pipe_config->limited_color_range = false;
                pipe_config->has_audio = false;
        }

Currently we set

        pipe_config->has_audio =
                intel_sdvo_state->base.force_audio == HDMI_AUDIO_ON ||
                (intel_sdvo_state->base.force_audio == HDMI_AUDIO_AUTO && intel_sdvo->has_hdmi_audio))

and, with a slight paraphrase,

        pipe_config->limited_color_range = pipe_config->has_hdmi_sink;

So, both of these should only be set if we have hdmi features which gen3 will not. So I think the consistent fix is

        switch (intel_sdvo_state->base.force_audio) {
        case HDMI_AUDIO_ON:
                pipe_config->has_audio = intel_sdvo->is_hdmi;
                break;
        case HDMI_AUDIO_AUTO:
                pipe_config->has_audio = intel_sdvo->has_hdmi_audio;
                break;
        case HDMI_AUDIO_OFF:
        case HDMI_AUDIO_OFF_DVI:
                pipe_config->has_audio = false;
                break;
        }
Quoted 7 lines
Quoted 1 line

Though I'm not sure what the actual subtlety of OFF_DVI is.

is_hdmi is set when the SDVO transcoder supports hdmi. And you can plug a hdmi sdvo chip into a gen3 box, which is why this blows up here. I guess I could try to limit that, that should take care of things complete. Together with making sure we don't set any of the hdmi state bits if the is_hdmi is false (which I hope we already do).

Hmm, I was assuming that the is_hdmi query returned false for gen3. I think having this flow from HDMI state is nicer (and so fixing up the query), and then something like

drivers/gpu/drm/i915/intel_sdvo.c +3 -1
index e58a47db9a9d..3883cc6834a0 100644
@@ -1349,8 +1349,10 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder,
        else
                sdvox |= SDVO_PIPE_SEL(crtc->pipe);
 
-       if (crtc_state->has_audio)
+       if (crtc_state->has_audio) {
+               WARN_ON_ONCE(INTEL_GEN(dev_priv) < 4);
                sdvox |= SDVO_AUDIO_ENABLE;
+       }
 
        if (INTEL_GEN(dev_priv) >= 4) {
                /* done in crtc_mode_set as the dpll_md reg must be written early */

to document that this bit didn't exist before.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx