Skip to contentSkip to conversation

drm/radeon/kms: fix legacy LVDS mode computation

PATCH New Jerome Glisse 1 participant 1 message Apr 30, 2010

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

PATCH 1/1 drm/radeon/kms: fix legacy LVDS mode computation

Compute downscaled mode timing like DDX does on legacy hw. With this patch it's now possible to use non native laptop panel resolution. Tested on M7 (7500) laptop.

---
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +22 -1
index 2441cca..0d78f5b 100644
@@ -219,6 +219,8 @@ static bool radeon_legacy_mode_fixup(struct drm_encoder *encoder,
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
 	struct drm_device *dev = encoder->dev;
 	struct radeon_device *rdev = dev->dev_private;
+	unsigned hsync_width, vsync_width;
+	unsigned hover, vover, hblank, vblank;
 
 	/* adjust pm to upcoming mode change */
 	radeon_pm_compute_clocks(rdev);
@@ -237,8 +239,27 @@ static bool radeon_legacy_mode_fixup(struct drm_encoder *encoder,
 		adjusted_mode->crtc_hdisplay = mode->hdisplay;
 		adjusted_mode->crtc_vdisplay = mode->vdisplay;
 		adjusted_mode->base.id = mode_id;
+		hblank = native_mode->htotal - native_mode->hdisplay;
+		vblank = native_mode->vtotal - native_mode->vdisplay;
+		hover = native_mode->hsync_start - native_mode->hdisplay;
+		vover = native_mode->vsync_start - native_mode->vdisplay;
+		hsync_width = native_mode->hsync_end - native_mode->hsync_start;
+		vsync_width = native_mode->vsync_end - native_mode->vsync_start;
+		adjusted_mode->crtc_hsync_start = mode->hdisplay + hover;
+		adjusted_mode->crtc_hsync_end = adjusted_mode->crtc_hsync_start + hsync_width;
+		adjusted_mode->crtc_htotal = mode->hdisplay + hblank;
+		adjusted_mode->crtc_vsync_start = mode->vdisplay + vover;
+		adjusted_mode->crtc_vsync_end = adjusted_mode->crtc_vsync_start + vsync_width;
+		adjusted_mode->crtc_vtotal = mode->vdisplay + vblank;
+		adjusted_mode->crtc_hblank_start = mode->hdisplay;
+		adjusted_mode->crtc_vblank_start = mode->vdisplay;
+		adjusted_mode->hsync_start = adjusted_mode->crtc_hsync_start;
+		adjusted_mode->hsync_end = adjusted_mode->crtc_hsync_end;
+		adjusted_mode->htotal = adjusted_mode->crtc_htotal;
+		adjusted_mode->vsync_start = adjusted_mode->crtc_vsync_start;
+		adjusted_mode->vsync_end = adjusted_mode->crtc_vsync_end;
+		adjusted_mode->vtotal = adjusted_mode->crtc_vtotal;
 	}
-
 	return true;
 }
 
Signature · 1 line
1.7.0.1