drm/i915/sdvo: Robustify the dtd<->drm_mode conversions
Subsystems (2)
PATCH 1/2 drm/i915/sdvo: Robustify the dtd<->drm_mode conversions
We've failed to properly clear out the flags when converting a dtd to a drm mode. For more paranoia just memset the entire structure (and drop the now redundant clears).
Also since
commit 135c81b8c3c9a70d7b55758c9c2a247a4abb7b64
Author: Daniel Vetter <[email protected]> Date: Sun Jul 21 21:37:09 2013 +0200
drm/i915: clean up crtc timings computation
we don't update the crtc timings any more properly, so do that again.
v2: Remove more redundant clearing, spotted by Ville.
v3: Actually make it compile. Oops.
v4: Use a temporary structure to fill in the mode and copy it over with drm_mode_copy. This will ensure we don't clobber the mode list or id. Suggested by Ville.
--- drivers/gpu/drm/i915/intel_sdvo.c | 65 ++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 29 deletions(-)
drivers/gpu/drm/i915/intel_sdvo.c +36 -29
@@ -788,6 +788,8 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,uint16_t h_sync_offset, v_sync_offset;int mode_clock; +memset (dtd,0 ,sizeof (*dtd)); + width = mode->hdisplay; height = mode->vdisplay;
@@ -830,48 +832,53 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,if (mode->flags &DRM_MODE_FLAG_PVSYNC ) dtd->part2.dtd_flags |=DTD_FLAG_VSYNC_POSITIVE ; - dtd->part2.sdvo_flags =0 ; dtd->part2.v_sync_off_high = v_sync_offset &0xc0 ; - dtd->part2.reserved =0 ; } -static void intel_sdvo_get_mode_from_dtd (struct drm_display_mode * mode, +static void intel_sdvo_get_mode_from_dtd (struct drm_display_mode *pmode,const struct intel_sdvo_dtd *dtd) { - mode->hdisplay = dtd->part1.h_active; - mode->hdisplay += ((dtd->part1.h_high >>4 ) &0x0f ) <<8 ; - mode->hsync_start = mode->hdisplay + dtd->part2.h_sync_off; - mode->hsync_start += (dtd->part2.sync_off_width_high &0xc0 ) <<2 ; - mode->hsync_end = mode->hsync_start + dtd->part2.h_sync_width; - mode->hsync_end += (dtd->part2.sync_off_width_high &0x30 ) <<4 ; - mode->htotal = mode->hdisplay + dtd->part1.h_blank; - mode->htotal += (dtd->part1.h_high &0xf ) <<8 ; - - mode->vdisplay = dtd->part1.v_active; - mode->vdisplay += ((dtd->part1.v_high >>4 ) &0x0f ) <<8 ; - mode->vsync_start = mode->vdisplay; - mode->vsync_start += (dtd->part2.v_sync_off_width >>4 ) &0xf ; - mode->vsync_start += (dtd->part2.sync_off_width_high &0x0c ) <<2 ; - mode->vsync_start += dtd->part2.v_sync_off_high &0xc0 ; - mode->vsync_end = mode->vsync_start + +struct drm_display_mode mode; + +memset (&mode,0 ,sizeof (mode)); + + mode.hdisplay = dtd->part1.h_active; + mode.hdisplay += ((dtd->part1.h_high >>4 ) &0x0f ) <<8 ; + mode.hsync_start = mode.hdisplay + dtd->part2.h_sync_off; + mode.hsync_start += (dtd->part2.sync_off_width_high &0xc0 ) <<2 ; + mode.hsync_end = mode.hsync_start + dtd->part2.h_sync_width; + mode.hsync_end += (dtd->part2.sync_off_width_high &0x30 ) <<4 ; + mode.htotal = mode.hdisplay + dtd->part1.h_blank; + mode.htotal += (dtd->part1.h_high &0xf ) <<8 ; + + mode.vdisplay = dtd->part1.v_active; + mode.vdisplay += ((dtd->part1.v_high >>4 ) &0x0f ) <<8 ; + mode.vsync_start = mode.vdisplay; + mode.vsync_start += (dtd->part2.v_sync_off_width >>4 ) &0xf ; + mode.vsync_start += (dtd->part2.sync_off_width_high &0x0c ) <<2 ; + mode.vsync_start += dtd->part2.v_sync_off_high &0xc0 ; + mode.vsync_end = mode.vsync_start + (dtd->part2.v_sync_off_width &0xf ); - mode->vsync_end += (dtd->part2.sync_off_width_high &0x3 ) <<4 ; - mode->vtotal = mode->vdisplay + dtd->part1.v_blank; - mode->vtotal += (dtd->part1.v_high &0xf ) <<8 ; + mode.vsync_end += (dtd->part2.sync_off_width_high &0x3 ) <<4 ; + mode.vtotal = mode.vdisplay + dtd->part1.v_blank; + mode.vtotal += (dtd->part1.v_high &0xf ) <<8 ; - mode->clock = dtd->part1.clock *10 ; + mode.clock = dtd->part1.clock *10 ; - mode->flags &= ~(DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_PVSYNC );if (dtd->part2.dtd_flags &DTD_FLAG_INTERLACE ) - mode->flags |=DRM_MODE_FLAG_INTERLACE ; + mode.flags |=DRM_MODE_FLAG_INTERLACE ;if (dtd->part2.dtd_flags &DTD_FLAG_HSYNC_POSITIVE ) - mode->flags |=DRM_MODE_FLAG_PHSYNC ; + mode.flags |=DRM_MODE_FLAG_PHSYNC ;else - mode->flags |=DRM_MODE_FLAG_NHSYNC ; + mode.flags |=DRM_MODE_FLAG_NHSYNC ;if (dtd->part2.dtd_flags &DTD_FLAG_VSYNC_POSITIVE ) - mode->flags |=DRM_MODE_FLAG_PVSYNC ; + mode.flags |=DRM_MODE_FLAG_PVSYNC ;else - mode->flags |=DRM_MODE_FLAG_NVSYNC ; + mode.flags |=DRM_MODE_FLAG_NVSYNC ; + +drm_mode_set_crtcinfo (&mode,0 ); + +drm_mode_copy (pmode, &mode); }static bool intel_sdvo_check_supp_encode (struct intel_sdvo *intel_sdvo)
Signature · 6 lines
1.8.4.rc3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 drm/i915/dvo: set crtc timings again for panel fixed modes
Yet another regression due to
commit 135c81b8c3c9a70d7b55758c9c2a247a4abb7b64
Author: Daniel Vetter <[email protected]> Date: Sun Jul 21 21:37:09 2013 +0200
drm/i915: clean up crtc timings computation
I'm starting to wonder whether this was worth it ...
v2: Actually make it compile.
--- drivers/gpu/drm/i915/intel_dvo.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_dvo.c +2 -0
@@ -263,6 +263,8 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,C (vtotal);C (clock);#undef C + +drm_mode_set_crtcinfo (adjusted_mode,0 ); }if (intel_dvo->dev.dev_ops->mode_fixup)
Signature · 6 lines
1.8.4.rc3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915/dvo: set crtc timings again for panel fixed modes
Quoted 8 lines · Daniel Vetter
Yet another regression due to
commit
135c81b8c3c9a70d7b55758c9c2a247a4abb7b64Author: Daniel Vetter <[email protected]> Date: Sun Jul 21 21:37:09 2013 +0200drm/i915: clean up crtc timings computation
Quoted 7 lines
I'm starting to wonder whether this was worth it ...
v2: Actually make it compile.
Cc Jesse Barnes <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Merged both with Ville's irc-r-b and a small bikeshed for patch 1. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch