diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2010-08-03 19:58:49 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-08-03 20:03:47 -0400 |
commit | d65d65b175a29bd7ea2bb69c046419329c4a5db7 (patch) | |
tree | 459fd50b7e4af59af71e0e93bd602c243209983d /drivers/gpu/drm/radeon/radeon_display.c | |
parent | fa0a6024da61d96a12fab18991b9897292b43253 (diff) |
drm/radeon/kms: fix calculation of h/v scaling factors
Prior to this patch the code was dividing the src_v by the dst_h
and vice versa, rather than src_v/dst_v and src_h/dst_h.
This could lead to problems in the calculation of the display
watermarks.
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_display.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_display.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 283beedc2cbf..12a54145b64a 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -1073,11 +1073,13 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, | |||
1073 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 1073 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
1074 | struct radeon_encoder *radeon_encoder; | 1074 | struct radeon_encoder *radeon_encoder; |
1075 | bool first = true; | 1075 | bool first = true; |
1076 | u32 src_v = 1, dst_v = 1; | ||
1077 | u32 src_h = 1, dst_h = 1; | ||
1076 | 1078 | ||
1077 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | 1079 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { |
1078 | radeon_encoder = to_radeon_encoder(encoder); | ||
1079 | if (encoder->crtc != crtc) | 1080 | if (encoder->crtc != crtc) |
1080 | continue; | 1081 | continue; |
1082 | radeon_encoder = to_radeon_encoder(encoder); | ||
1081 | if (first) { | 1083 | if (first) { |
1082 | /* set scaling */ | 1084 | /* set scaling */ |
1083 | if (radeon_encoder->rmx_type == RMX_OFF) | 1085 | if (radeon_encoder->rmx_type == RMX_OFF) |
@@ -1087,6 +1089,10 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, | |||
1087 | radeon_crtc->rmx_type = radeon_encoder->rmx_type; | 1089 | radeon_crtc->rmx_type = radeon_encoder->rmx_type; |
1088 | else | 1090 | else |
1089 | radeon_crtc->rmx_type = RMX_OFF; | 1091 | radeon_crtc->rmx_type = RMX_OFF; |
1092 | src_v = crtc->mode.vdisplay; | ||
1093 | dst_v = radeon_crtc->native_mode.vdisplay; | ||
1094 | src_h = crtc->mode.hdisplay; | ||
1095 | dst_h = radeon_crtc->native_mode.vdisplay; | ||
1090 | /* copy native mode */ | 1096 | /* copy native mode */ |
1091 | memcpy(&radeon_crtc->native_mode, | 1097 | memcpy(&radeon_crtc->native_mode, |
1092 | &radeon_encoder->native_mode, | 1098 | &radeon_encoder->native_mode, |
@@ -1096,22 +1102,22 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, | |||
1096 | if (radeon_crtc->rmx_type != radeon_encoder->rmx_type) { | 1102 | if (radeon_crtc->rmx_type != radeon_encoder->rmx_type) { |
1097 | /* WARNING: Right now this can't happen but | 1103 | /* WARNING: Right now this can't happen but |
1098 | * in the future we need to check that scaling | 1104 | * in the future we need to check that scaling |
1099 | * are consistent accross different encoder | 1105 | * are consistent across different encoder |
1100 | * (ie all encoder can work with the same | 1106 | * (ie all encoder can work with the same |
1101 | * scaling). | 1107 | * scaling). |
1102 | */ | 1108 | */ |
1103 | DRM_ERROR("Scaling not consistent accross encoder.\n"); | 1109 | DRM_ERROR("Scaling not consistent across encoder.\n"); |
1104 | return false; | 1110 | return false; |
1105 | } | 1111 | } |
1106 | } | 1112 | } |
1107 | } | 1113 | } |
1108 | if (radeon_crtc->rmx_type != RMX_OFF) { | 1114 | if (radeon_crtc->rmx_type != RMX_OFF) { |
1109 | fixed20_12 a, b; | 1115 | fixed20_12 a, b; |
1110 | a.full = dfixed_const(crtc->mode.vdisplay); | 1116 | a.full = dfixed_const(src_v); |
1111 | b.full = dfixed_const(radeon_crtc->native_mode.hdisplay); | 1117 | b.full = dfixed_const(dst_v); |
1112 | radeon_crtc->vsc.full = dfixed_div(a, b); | 1118 | radeon_crtc->vsc.full = dfixed_div(a, b); |
1113 | a.full = dfixed_const(crtc->mode.hdisplay); | 1119 | a.full = dfixed_const(src_h); |
1114 | b.full = dfixed_const(radeon_crtc->native_mode.vdisplay); | 1120 | b.full = dfixed_const(dst_h); |
1115 | radeon_crtc->hsc.full = dfixed_div(a, b); | 1121 | radeon_crtc->hsc.full = dfixed_div(a, b); |
1116 | } else { | 1122 | } else { |
1117 | radeon_crtc->vsc.full = dfixed_const(1); | 1123 | radeon_crtc->vsc.full = dfixed_const(1); |