Skip to contentSkip to conversation

drm/i915/g4x: fix g4x infoframe readout

PATCH In review Jesse Barnes 3 participants 5 messages Nov 20, 2014 – Nov 22, 2014

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

PATCH 1/2 drm/i915/g4x: fix g4x infoframe readout

Need to check the port too.

---
 drivers/gpu/drm/i915/intel_hdmi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdmi.c +5 -1
index f58e883..ec87333 100644
@@ -170,9 +170,13 @@ static bool g4x_infoframe_enabled(struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
 	u32 val = I915_READ(VIDEO_DIP_CTL);
 
-	return val & VIDEO_DIP_ENABLE;
+	if (VIDEO_DIP_PORT(intel_dig_port->port) == (val & VIDEO_DIP_PORT_MASK))
+		return val & VIDEO_DIP_ENABLE;
+
+	return false;
 }
 
 static void ibx_write_infoframe(struct drm_encoder *encoder,
Signature · 6 lines
1.9.1

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

PATCH 2/2 drm/i915/ibx: check port in infoframe_enabled

Just like on g4x we need to check the port enable bit here.

---
 drivers/gpu/drm/i915/intel_hdmi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdmi.c +6 -1
index ec87333..cc48b51 100644
@@ -222,10 +222,15 @@ static bool ibx_infoframe_enabled(struct drm_encoder *encoder)
 	struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
+	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
 	int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
 	u32 val = I915_READ(reg);
+	u32 port = VIDEO_DIP_PORT(intel_dig_port->port);
 
-	return val & VIDEO_DIP_ENABLE;
+	if (port == (val & VIDEO_DIP_PORT_MASK))
+		return val & VIDEO_DIP_ENABLE;
+
+	return false;
 }
 
 static void cpt_write_infoframe(struct drm_encoder *encoder,
Signature · 6 lines
1.9.1

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

Re: [PATCH 2/2] drm/i915/ibx: check port in infoframe_enabled

Quoted 13 lines · Jesse Barnes

Just like on g4x we need to check the port enable bit here.

---
 drivers/gpu/drm/i915/intel_hdmi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
index ec87333..cc48b51 100644
@@ -222,10 +222,15 @@ static bool ibx_infoframe_enabled(struct drm_encoder *encoder)
 	struct drm_device *dev = encoder->dev;

drivers/gpu/drm/i915/intel_hdmi.c static bool ibx_infoframe_enabled(struct drm_encoder *encoder) · line 231

Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +4 -1
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
+	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
 	int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
 	u32 val = I915_READ(reg);
+	u32 port = VIDEO_DIP_PORT(intel_dig_port->port);
 
-	return val & VIDEO_DIP_ENABLE;
+	if (port == (val & VIDEO_DIP_PORT_MASK))
+		return val & VIDEO_DIP_ENABLE;

I think the only thing that can go wrong is us or the bios making a complete mess out of the pipe->port assignment for infoframes here. So I've thought more of

if (val & VIDEO_DIP_ENABLE) {
	WARN_ON(port != (val & VIDEO_DIP_PORT_MASK));
	return true;
}

return false;

I.e. just double-checking that everything is as expected. Otherwise we'd need to collect infoframes from all pipes I think. But since we don't have any code to clean up such a mess I hope it doesn't exist in the real world out there.

Merged the g4x fix to dinq meanwhile.
-Daniel

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]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH 2/2] drm/i915/ibx: check port in infoframe_enabled

Quoted 35 lines · On Thu, 20 Nov 2014 22:57:32 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 19 lines · Jesse Barnes

Just like on g4x we need to check the port enable bit here.

---
 drivers/gpu/drm/i915/intel_hdmi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_hdmi.c index ec87333..cc48b51 100644

drivers/gpu/drm/i915/intel_hdmi.c +1 -0
@@ -222,10 +222,15 @@ static bool ibx_infoframe_enabled(struct
 drm_encoder *encoder) struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crtc *intel_crtc =
 to_intel_crtc(encoder->crtc);
+	struct intel_digital_port *intel_dig_port =

enc_to_dig_port(encoder); int reg = TVIDEO_DIP_CTL(intel_crtc->pipe); u32 val = I915_READ(reg);

drivers/gpu/drm/i915/intel_hdmi.c static bool ibx_infoframe_enabled(struct drm_encoder *encoder) · line 231

Quoted 5 lines
drivers/gpu/drm/i915/intel_hdmi.c +3 -1
+	u32 port = VIDEO_DIP_PORT(intel_dig_port->port);
 
-	return val & VIDEO_DIP_ENABLE;
+	if (port == (val & VIDEO_DIP_PORT_MASK))
+		return val & VIDEO_DIP_ENABLE;

I think the only thing that can go wrong is us or the bios making a complete mess out of the pipe->port assignment for infoframes here. So I've thought more of

if (val & VIDEO_DIP_ENABLE) {
	WARN_ON(port != (val & VIDEO_DIP_PORT_MASK));
	return true;
}
Quoted 6 lines

return false;

I.e. just double-checking that everything is as expected. Otherwise we'd need to collect infoframes from all pipes I think. But since we don't have any code to clean up such a mess I hope it doesn't exist in the real world out there.

So in that case, we'll set the has_infoframes to true even if infoframes are enabled on the wrong port, which means we might skip a mode set later which would clean them up and set the right port...

I like the idea of the WARN though.

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

Tested-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] drm/i915/ibx: check port in

In reply to Jesse Barnes

-------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

PNV                                  367/367              367/367
ILK                                  373/375              373/375
SNB                                  450/450              450/450

IVB -4 502/503 498/503
BYT 289/289 289/289
HSW -3 567/567 564/567
BDW 417/417 417/417
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied

IVB  igt_gem_bad_reloc_negative-reloc-lut      NSPT(3, M21M34M4)PASS(1, M21)      NSPT(2, M21)
IVB  igt_kms_cursor_crc_cursor-64x64-random      PASS(1, M21)      DMESG_WARN(1, M21)PASS(1, M21)
IVB  igt_kms_cursor_crc_cursor-64x64-sliding      PASS(1, M21)      DMESG_WARN(1, M21)PASS(1, M21)
IVB  igt_kms_setmode_invalid-clone-exclusive-crtc      PASS(1, M21)      DMESG_WARN(1, M21)PASS(1, M21)
HSW  igt_gem_bad_reloc_negative-reloc-lut      NSPT(9, M40M20)PASS(1, M20)      NSPT(1, M20)
HSW  igt_kms_rotation_crc_primary-rotation      PASS(10, M20M40)      DMESG_WARN(1, M20)
HSW  igt_pm_rc6_residency_rc6-accuracy      PASS(10, M20M40)      FAIL(1, M20)

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