mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 14:41:27 +00:00
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>
This commit is contained in:
parent
fa0a6024da
commit
d65d65b175
1 changed files with 13 additions and 7 deletions
|
@ -1073,11 +1073,13 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
|
||||||
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
|
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
|
||||||
struct radeon_encoder *radeon_encoder;
|
struct radeon_encoder *radeon_encoder;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
u32 src_v = 1, dst_v = 1;
|
||||||
|
u32 src_h = 1, dst_h = 1;
|
||||||
|
|
||||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
|
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
|
||||||
radeon_encoder = to_radeon_encoder(encoder);
|
|
||||||
if (encoder->crtc != crtc)
|
if (encoder->crtc != crtc)
|
||||||
continue;
|
continue;
|
||||||
|
radeon_encoder = to_radeon_encoder(encoder);
|
||||||
if (first) {
|
if (first) {
|
||||||
/* set scaling */
|
/* set scaling */
|
||||||
if (radeon_encoder->rmx_type == RMX_OFF)
|
if (radeon_encoder->rmx_type == RMX_OFF)
|
||||||
|
@ -1087,6 +1089,10 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
|
||||||
radeon_crtc->rmx_type = radeon_encoder->rmx_type;
|
radeon_crtc->rmx_type = radeon_encoder->rmx_type;
|
||||||
else
|
else
|
||||||
radeon_crtc->rmx_type = RMX_OFF;
|
radeon_crtc->rmx_type = RMX_OFF;
|
||||||
|
src_v = crtc->mode.vdisplay;
|
||||||
|
dst_v = radeon_crtc->native_mode.vdisplay;
|
||||||
|
src_h = crtc->mode.hdisplay;
|
||||||
|
dst_h = radeon_crtc->native_mode.vdisplay;
|
||||||
/* copy native mode */
|
/* copy native mode */
|
||||||
memcpy(&radeon_crtc->native_mode,
|
memcpy(&radeon_crtc->native_mode,
|
||||||
&radeon_encoder->native_mode,
|
&radeon_encoder->native_mode,
|
||||||
|
@ -1096,22 +1102,22 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
|
||||||
if (radeon_crtc->rmx_type != radeon_encoder->rmx_type) {
|
if (radeon_crtc->rmx_type != radeon_encoder->rmx_type) {
|
||||||
/* WARNING: Right now this can't happen but
|
/* WARNING: Right now this can't happen but
|
||||||
* in the future we need to check that scaling
|
* in the future we need to check that scaling
|
||||||
* are consistent accross different encoder
|
* are consistent across different encoder
|
||||||
* (ie all encoder can work with the same
|
* (ie all encoder can work with the same
|
||||||
* scaling).
|
* scaling).
|
||||||
*/
|
*/
|
||||||
DRM_ERROR("Scaling not consistent accross encoder.\n");
|
DRM_ERROR("Scaling not consistent across encoder.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (radeon_crtc->rmx_type != RMX_OFF) {
|
if (radeon_crtc->rmx_type != RMX_OFF) {
|
||||||
fixed20_12 a, b;
|
fixed20_12 a, b;
|
||||||
a.full = dfixed_const(crtc->mode.vdisplay);
|
a.full = dfixed_const(src_v);
|
||||||
b.full = dfixed_const(radeon_crtc->native_mode.hdisplay);
|
b.full = dfixed_const(dst_v);
|
||||||
radeon_crtc->vsc.full = dfixed_div(a, b);
|
radeon_crtc->vsc.full = dfixed_div(a, b);
|
||||||
a.full = dfixed_const(crtc->mode.hdisplay);
|
a.full = dfixed_const(src_h);
|
||||||
b.full = dfixed_const(radeon_crtc->native_mode.vdisplay);
|
b.full = dfixed_const(dst_h);
|
||||||
radeon_crtc->hsc.full = dfixed_div(a, b);
|
radeon_crtc->hsc.full = dfixed_div(a, b);
|
||||||
} else {
|
} else {
|
||||||
radeon_crtc->vsc.full = dfixed_const(1);
|
radeon_crtc->vsc.full = dfixed_const(1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue