intel_extreme: fix panel fitting code

This could also help with VGA output, a logic error in the pipe code
would lead to never configuring the pipe resolution. May help with VGA
output on SandyBridge and IvyBridge (but I get DPMS off on my laptop for
now, so I think something isn't quite right yet).
This commit is contained in:
Adrien Destugues 2020-03-08 15:58:40 +01:00
parent 168aff90a7
commit 23be24d2d2
2 changed files with 21 additions and 15 deletions

View File

@ -184,17 +184,18 @@ Pipe::ConfigureTimings(display_mode* target, bool hardware)
{
CALLED();
TRACE("%s: fPipeOffset: 0x%" B_PRIx32"\n", __func__, fPipeOffset);
TRACE("%s(%d): fPipeOffset: 0x%" B_PRIx32"\n", __func__, hardware,
fPipeOffset);
if (target == NULL) {
ERROR("%s: Invalid display mode!\n", __func__);
return;
}
/* If there is a transcoder, leave the display at its native resolution,
/* If using the transcoder, leave the display at its native resolution,
* and configure only the transcoder (panel fitting will match them
* together). */
if (!fHasTranscoder && hardware)
if (!fHasTranscoder || hardware)
{
// update timing (fPipeOffset bumps the DISPLAY_A to B when needed)
write32(INTEL_DISPLAY_A_HTOTAL + fPipeOffset,

View File

@ -516,16 +516,16 @@ LVDSPort::SetDisplayMode(display_mode* target, uint32 colorMode)
// TODO figure out how it's done (or if we need to configure something at
// all) for other generations
if ((gInfo->shared_info->device_type.Generation() == 4
|| gInfo->shared_info->device_type.Generation() == 3)
if (gInfo->shared_info->device_type.Generation() <= 6
&& gInfo->shared_info->device_type.Generation() >= 3
&& gInfo->shared_info->got_vbt) {
// Set vbios hardware panel mode as base
memcpy(&hardwareTarget, &gInfo->shared_info->panel_mode,
sizeof(display_mode));
hardwareTarget = gInfo->shared_info->panel_mode;
if (hardwareTarget.virtual_width == target->virtual_width
&& hardwareTarget.virtual_height == target->virtual_height) {
// We are setting the native video mode, nothing special to do
TRACE("Setting LVDS to native mode\n");
hardwareTarget = *target;
} else {
// We need to enable the panel fitter
@ -539,6 +539,8 @@ LVDSPort::SetDisplayMode(display_mode* target, uint32 colorMode)
needsScaling = true;
}
} else {
TRACE("Setting LVDS mode without VBT info or on unhandled hardware "
"generation, scaling may not work\n");
// We don't have VBT data, try to set the requested mode directly
// and hope for the best
hardwareTarget = *target;
@ -621,15 +623,18 @@ LVDSPort::SetDisplayMode(display_mode* target, uint32 colorMode)
fPipe->ConfigureTimings(target, !needsScaling);
if (needsScaling) {
// Enable panel fitter in automatic mode. It will figure out
// the scaling ratios automatically.
uint32 panelFitterControl = read32(INTEL_PANEL_FIT_CONTROL);
panelFitterControl |= PANEL_FITTER_ENABLED;
panelFitterControl &= ~(PANEL_FITTER_SCALING_MODE_MASK
| PANEL_FITTER_PIPE_MASK);
panelFitterControl |= PANEL_FITTER_PIPE_B;
if (gInfo->shared_info->device_type.Generation() <= 4) {
// Enable panel fitter in automatic mode. It will figure out
// the scaling ratios automatically.
uint32 panelFitterControl = read32(INTEL_PANEL_FIT_CONTROL);
panelFitterControl |= PANEL_FITTER_ENABLED;
panelFitterControl &= ~(PANEL_FITTER_SCALING_MODE_MASK
| PANEL_FITTER_PIPE_MASK);
panelFitterControl |= PANEL_FITTER_PIPE_B;
// LVDS is always on pipe B.
write32(INTEL_PANEL_FIT_CONTROL, panelFitterControl);
write32(INTEL_PANEL_FIT_CONTROL, panelFitterControl);
}
// TODO do we need to do anything on later generations?
} else {
if (gInfo->shared_info->device_type.Generation() == 4
|| gInfo->shared_info->device_type.Generation() == 3) {