drm/radeon/kms: fix legacy LVDS mode computation
Subsystems (2)
PATCH 1/1 drm/radeon/kms: fix legacy LVDS mode computation
From: John Doe <[email protected]>
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
@@ -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
Quoted 5 lines · Jerome Glisse
From: John Doe <[email protected]>
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.
I think I just had the logic reversed previously. Does the attached patch also fix the issue? It should fix the avivo scaling problems that were reported as well.
Alex
Quoted 52 lines
Cc <[email protected]>Signed-off-by Jerome Glisse <[email protected]>---
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
-2@@ -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; } --1.7.0.1
Quoted 5 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
From 8bf37aa599312e0128a223976da1ee08a3b2b573 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Fri, 30 Apr 2010 11:09:14 -0400
Subject: [PATCH] drm/radeon/kms: fix reversed logic in panel scaling setup
legacy chips need the native mode, avivo chips also need to update the h/vdisplay to the scaled mode size. The logic was reversed. Should fix scaled mode setup on avivo and legacy chips.
--- drivers/gpu/drm/radeon/radeon_encoders.c | 2 +- drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 4 ---- 2 files changed, 1 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/radeon_encoders.c +1 -1
@@ -276,7 +276,7 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,struct drm_display_mode *native_mode = &radeon_encoder->native_mode;int mode_id = adjusted_mode->base.id; *adjusted_mode = *native_mode; -if (!ASIC_IS_AVIVO (rdev)) { +if (ASIC_IS_AVIVO (rdev)) { adjusted_mode->hdisplay = mode->hdisplay; adjusted_mode->vdisplay = mode->vdisplay; adjusted_mode->crtc_hdisplay = mode->hdisplay;
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +0 -4
@@ -225,10 +225,6 @@ static bool radeon_legacy_mode_fixup(struct drm_encoder *encoder,struct drm_display_mode *native_mode = &radeon_encoder->native_mode;int mode_id = adjusted_mode->base.id; *adjusted_mode = *native_mode; - adjusted_mode->hdisplay = mode->hdisplay; - adjusted_mode->vdisplay = mode->vdisplay; - adjusted_mode->crtc_hdisplay = mode->hdisplay; - adjusted_mode->crtc_vdisplay = mode->vdisplay; adjusted_mode->base.id = mode_id; }
Signature · 1 line
1.5.6.3
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · Alex Deucher
Quoted 5 lines · Jerome Glisse
From: John Doe <[email protected]>
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.
I think I just had the logic reversed previously. Does the attached patch also fix the issue? It should fix the avivo scaling problems that were reported as well.
Looks like we need a bit more. How about this one?
Alex
Quoted 53 lines
Alex
Quoted 49 lines
Cc <[email protected]>Signed-off-by Jerome Glisse <[email protected]>---
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@@ -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; }
Quoted 9 lines
Quoted 8 lines
--
1.7.0.1_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
From f0016e7459a0b476d18e46cb5289a6fe9df46f2e Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Fri, 30 Apr 2010 12:00:44 -0400
Subject: [PATCH] drm/radeon/kms: fix panel scaling adjusted mode setup
This should duplicate exactly what the ddx does for both legacy and avivo.
--- drivers/gpu/drm/radeon/radeon_encoders.c | 61 ++++++++++++++++++----- drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 12 +---- drivers/gpu/drm/radeon/radeon_mode.h | 2 + 3 files changed, 53 insertions(+), 22 deletions(-)
drivers/gpu/drm/radeon/radeon_encoders.c +49 -12
@@ -254,6 +254,53 @@ radeon_get_atom_connector_priv_from_encoder(struct drm_encoder *encoder)return dig_connector; } +void radeon_panel_mode_fixup (struct drm_encoder *encoder, +struct drm_display_mode *adjusted_mode) +{ +struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder); +struct drm_device *dev = encoder->dev; +struct radeon_device *rdev = dev->dev_private; +struct drm_display_mode *native_mode = &radeon_encoder->native_mode; +unsigned hblank = native_mode->htotal - native_mode->hdisplay; +unsigned vblank = native_mode->vtotal - native_mode->vdisplay; +unsigned hover = native_mode->hsync_start - native_mode->hdisplay; +unsigned vover = native_mode->vsync_start - native_mode->vdisplay; +unsigned hsync_width = native_mode->hsync_end - native_mode->hsync_start; +unsigned vsync_width = native_mode->vsync_end - native_mode->vsync_start; + + adjusted_mode->clock = native_mode->clock; + adjusted_mode->flags = native_mode->flags; + +if (ASIC_IS_AVIVO (rdev)) { + adjusted_mode->hdisplay = native_mode->hdisplay; + adjusted_mode->vdisplay = native_mode->vdisplay; + } + + adjusted_mode->htotal = native_mode->hdisplay + hblank; + adjusted_mode->hsync_start = native_mode->hdisplay + hover; + adjusted_mode->hsync_end = adjusted_mode->hsync_start + hsync_width; + + adjusted_mode->vtotal = native_mode->vdisplay + vblank; + adjusted_mode->vsync_start = native_mode->vdisplay + vover; + adjusted_mode->vsync_end = adjusted_mode->vsync_start + vsync_width; + +drm_mode_set_crtcinfo (adjusted_mode,CRTC_INTERLACE_HALVE_V ); + +if (ASIC_IS_AVIVO (rdev)) { + adjusted_mode->crtc_hdisplay = native_mode->hdisplay; + adjusted_mode->crtc_vdisplay = native_mode->vdisplay; + } + + adjusted_mode->crtc_htotal = adjusted_mode->crtc_hdisplay + hblank; + adjusted_mode->crtc_hsync_start = adjusted_mode->crtc_hdisplay + hover; + adjusted_mode->crtc_hsync_end = adjusted_mode->crtc_hsync_start + hsync_width; + + adjusted_mode->crtc_vtotal = adjusted_mode->crtc_vdisplay + vblank; + adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + vover; + adjusted_mode->crtc_vsync_end = adjusted_mode->crtc_vsync_start + vsync_width; + +} +static bool radeon_atom_mode_fixup (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode)
@@ -272,18 +319,8 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay +2 ;/* get the native mode for LVDS */ -if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT )) { -struct drm_display_mode *native_mode = &radeon_encoder->native_mode; -int mode_id = adjusted_mode->base.id; - *adjusted_mode = *native_mode; -if (!ASIC_IS_AVIVO (rdev)) { - adjusted_mode->hdisplay = mode->hdisplay; - adjusted_mode->vdisplay = mode->vdisplay; - adjusted_mode->crtc_hdisplay = mode->hdisplay; - adjusted_mode->crtc_vdisplay = mode->vdisplay; - } - adjusted_mode->base.id = mode_id; - } +if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT )) +radeon_panel_mode_fixup (encoder, adjusted_mode);/* get the native mode for TV */ if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT )) {
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +2 -10
@@ -221,16 +221,8 @@ static bool radeon_legacy_mode_fixup(struct drm_encoder *encoder,drm_mode_set_crtcinfo (adjusted_mode,0 );/* get the native mode for LVDS */ -if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT )) { -struct drm_display_mode *native_mode = &radeon_encoder->native_mode; -int mode_id = adjusted_mode->base.id; - *adjusted_mode = *native_mode; - adjusted_mode->hdisplay = mode->hdisplay; - adjusted_mode->vdisplay = mode->vdisplay; - adjusted_mode->crtc_hdisplay = mode->hdisplay; - adjusted_mode->crtc_vdisplay = mode->vdisplay; - adjusted_mode->base.id = mode_id; - } +if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT )) +radeon_panel_mode_fixup (encoder, adjusted_mode);return true; }
drivers/gpu/drm/radeon/radeon_mode.h +2 -0
@@ -563,6 +563,8 @@ extern int radeon_static_clocks_init(struct drm_device *dev);bool radeon_crtc_scaling_mode_fixup (struct drm_crtc *crtc,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode); +void radeon_panel_mode_fixup (struct drm_encoder *encoder, +struct drm_display_mode *adjusted_mode);void atom_rv515_force_tv_scaler (struct radeon_device *rdev,struct radeon_crtc *radeon_crtc);/* legacy tv */
Signature · 1 line
1.5.6.3
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Alex Deucher
Quoted 7 lines · Alex Deucher
Quoted 5 lines · Jerome Glisse
From: John Doe <[email protected]>
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.
Quoted 5 lines
Quoted 3 lines
I think I just had the logic reversed previously. Does the attached patch also fix the issue? It should fix the avivo scaling problems that were reported as well.
Looks like we need a bit more. How about this one?
I can confirm that this last one (0001-drm-radeon-kms-fix-panel-scaling-adjusted-mode-setu.patch) fixes both avivo and legacy. Please apply.
Alex
Quoted 66 lines
Alex
Quoted 62 lines
Alex
Quoted 57 lines
Cc <[email protected]>Signed-off-by Jerome Glisse <[email protected]>---
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
-2@@ -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; } --1.7.0.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel