Skip to contentSkip to conversation

drm/i915: Set mode->crtc_clock during hardware state readout

PATCH In review Matt Roper 3 participants 4 messages Oct 6, 2015 – Oct 7, 2015

Subsystems (2)
lore
Share & tools
lore

Matt Roper

author
#0 lore raw

PATCH 1/1 drm/i915: Set mode->crtc_clock during hardware state readout

intel_mode_from_pipe_config() fills in a mode structure from the CRTC state that was read out of the hardware, but does not set the .crtc_clock field (it only sets the .clock). This causes the subsequent call to drm_calc_timestamping_constants() to complain with messages like "*ERROR* crtc 21: Can't calculate constants, dotclock = 0!" Ensuring .crtc_clock is set as well eliminates this error.

---
 drivers/gpu/drm/i915/intel_display.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_display.c +1 -0
index bbeb6d3..4e481e3 100644
@@ -7752,6 +7752,7 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode,
 	mode->type = DRM_MODE_TYPE_DRIVER;
 
 	mode->clock = pipe_config->base.adjusted_mode.crtc_clock;
+	mode->crtc_clock = pipe_config->base.adjusted_mode.crtc_clock;
 	mode->flags |= pipe_config->base.adjusted_mode.flags;
 
 	mode->hsync = drm_mode_hsync(mode);
Signature · 6 lines
2.1.4

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

intel_mode_from_pipe_config() fills in a mode structure from the CRTC state that was read out of the hardware, but does not set the .crtc_clock field (it only sets the .clock). This causes the subsequent call to drm_calc_timestamping_constants() to complain with messages like "*ERROR* crtc 21: Can't calculate constants, dotclock = 0!" Ensuring .crtc_clock is set as well eliminates this error.

---
 drivers/gpu/drm/i915/intel_display.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_display.c +0 -0
index bbeb6d3..4e481e3 100644

drivers/gpu/drm/i915/intel_display.c void intel_mode_from_pipe_config(struct drm_display_mode *mode, · line 7755

Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +1 -0
@@ -7752,6 +7752,7 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode,
 	mode->type = DRM_MODE_TYPE_DRIVER;
 
 	mode->clock = pipe_config->base.adjusted_mode.crtc_clock;
+	mode->crtc_clock = pipe_config->base.adjusted_mode.crtc_clock;

You should never look at crtc_clock unless you're looking at the adjusted mode. Are you actually seeing these errors with the current code? They should have been fixed by:

7f4c62840cc4 drm/i915: Assign hwmode after encoder state readout 0f64614dde17 drm/i915: Fix clock readout when pipes are enabled w/o ports

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
 	mode->flags |= pipe_config->base.adjusted_mode.flags;
 
 	mode->hsync = drm_mode_hsync(mode);
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
In reply to Matt Roper
Quoted 8 lines · Matt Roper

intel_mode_from_pipe_config() fills in a mode structure from the CRTC state that was read out of the hardware, but does not set the .crtc_clock field (it only sets the .clock). This causes the subsequent call to drm_calc_timestamping_constants() to complain with messages like "*ERROR* crtc 21: Can't calculate constants, dotclock = 0!" Ensuring .crtc_clock is set as well eliminates this error.

Is this fixing the bug Paulo reported? Why is he not on CC? Why is there no citation of the commit which broke this?
-Daniel

Quoted 23 lines
---
 drivers/gpu/drm/i915/intel_display.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_display.c +1 -0
index bbeb6d3..4e481e3 100644
@@ -7752,6 +7752,7 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode,
 	mode->type = DRM_MODE_TYPE_DRIVER;
 
 	mode->clock = pipe_config->base.adjusted_mode.crtc_clock;
+	mode->crtc_clock = pipe_config->base.adjusted_mode.crtc_clock;
 	mode->flags |= pipe_config->base.adjusted_mode.flags;
 
 	mode->hsync = drm_mode_hsync(mode);
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#3 lore raw
Quoted 8 lines · Daniel Vetter
Quoted 7 lines · Matt Roper

intel_mode_from_pipe_config() fills in a mode structure from the CRTC state that was read out of the hardware, but does not set the .crtc_clock field (it only sets the .clock). This causes the subsequent call to drm_calc_timestamping_constants() to complain with messages like "*ERROR* crtc 21: Can't calculate constants, dotclock = 0!" Ensuring .crtc_clock is set as well eliminates this error.

Quoted 5 lines
Quoted 1 line

Is this fixing the bug Paulo reported? Why is he not on CC? Why is there no citation of the commit which broke this?
-Daniel

This isn't related to the watermark issue he reported, so no (unless this is a different issue he brought up elsewhere that I haven't seen).

Ville already pointed out that this might already be fixed properly on nightly; I think I might have got my trees mixed up while building, so this might not be necessary at all (I'll need to double check today). But my original thinking (possibly wrong) was that this was just something we never initialized from day 1, so there was no specific commit to cite.

Anyway, I think you can probably disregard this patch for now.

Matt

Quoted 29 lines
Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_display.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_display.c +1 -0
index bbeb6d3..4e481e3 100644
@@ -7752,6 +7752,7 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode,
 	mode->type = DRM_MODE_TYPE_DRIVER;
 
 	mode->clock = pipe_config->base.adjusted_mode.crtc_clock;
+	mode->crtc_clock = pipe_config->base.adjusted_mode.crtc_clock;
 	mode->flags |= pipe_config->base.adjusted_mode.flags;
 
 	mode->hsync = drm_mode_hsync(mode);
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 9 lines
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx