From f2a79670aec3aba59fe51923c65de943381eb3a9 Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Tue, 14 Sep 2021 02:04:02 +0000 Subject: [PATCH] intel_extreme: Fixed virtualscreen setup, ticket #17261 --- .../accelerants/intel_extreme/Pipes.cpp | 12 ++++----- .../accelerants/intel_extreme/Ports.cpp | 27 ++++++++++--------- .../accelerants/intel_extreme/mode.cpp | 15 +++++++---- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/add-ons/accelerants/intel_extreme/Pipes.cpp b/src/add-ons/accelerants/intel_extreme/Pipes.cpp index a98a007125..abf7043de4 100644 --- a/src/add-ons/accelerants/intel_extreme/Pipes.cpp +++ b/src/add-ons/accelerants/intel_extreme/Pipes.cpp @@ -162,8 +162,8 @@ Pipe::_ConfigureTranscoder(display_mode* target) // XXX: Is it ok to do these on non-digital? write32(INTEL_TRANSCODER_A_POS + fPipeOffset, 0); write32(INTEL_TRANSCODER_A_IMAGE_SIZE + fPipeOffset, - ((uint32)(target->virtual_width - 1) << 16) - | ((uint32)target->virtual_height - 1)); + ((uint32)(target->timing.h_display - 1) << 16) + | ((uint32)target->timing.v_display - 1)); #endif } @@ -192,8 +192,8 @@ Pipe::ConfigureScalePos(display_mode* target) // The only thing that really matters: set the image size and let the // panel fitter or the transcoder worry about the rest write32(INTEL_DISPLAY_A_PIPE_SIZE + fPipeOffset, - ((uint32)(target->virtual_width - 1) << 16) - | ((uint32)target->virtual_height - 1)); + ((uint32)(target->timing.h_display - 1) << 16) + | ((uint32)target->timing.v_display - 1)); // Set the plane size as well while we're at it (this is independant, we // could have a larger plane and scroll through it). @@ -203,8 +203,8 @@ Pipe::ConfigureScalePos(display_mode* target) // well. Note that the height and width are swapped when compared to // the other registers. write32(INTEL_DISPLAY_A_IMAGE_SIZE + fPipeOffset, - ((uint32)(target->virtual_height - 1) << 16) - | ((uint32)target->virtual_width - 1)); + ((uint32)(target->timing.h_display - 1) << 16) + | ((uint32)target->timing.v_display - 1)); } } diff --git a/src/add-ons/accelerants/intel_extreme/Ports.cpp b/src/add-ons/accelerants/intel_extreme/Ports.cpp index b666e9bcc1..9447ae73f1 100644 --- a/src/add-ons/accelerants/intel_extreme/Ports.cpp +++ b/src/add-ons/accelerants/intel_extreme/Ports.cpp @@ -352,8 +352,8 @@ status_t AnalogPort::SetDisplayMode(display_mode* target, uint32 colorMode) { CALLED(); - TRACE("%s: %s %dx%d\n", __func__, PortName(), target->virtual_width, - target->virtual_height); + TRACE("%s: %s %dx%d\n", __func__, PortName(), target->timing.h_display, + target->timing.v_display); if (fPipe == NULL) { ERROR("%s: Setting display mode without assigned pipe!\n", __func__); @@ -531,7 +531,7 @@ LVDSPort::SetDisplayMode(display_mode* target, uint32 colorMode) } TRACE("%s: %s-%d %dx%d\n", __func__, PortName(), PortIndex(), - target->virtual_width, target->virtual_height); + target->timing.h_display, target->timing.v_display); if (fPipe == NULL) { ERROR("%s: Setting display mode without assigned pipe!\n", __func__); @@ -572,17 +572,20 @@ LVDSPort::SetDisplayMode(display_mode* target, uint32 colorMode) // Set vbios hardware panel mode as base hardwareTarget = gInfo->shared_info->panel_mode; - if (hardwareTarget.virtual_width == target->virtual_width - && hardwareTarget.virtual_height == target->virtual_height) { + if (hardwareTarget.timing.h_display == target->timing.h_display + && hardwareTarget.timing.v_display == target->timing.v_display) { // 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 TRACE("%s: hardware mode will actually be %dx%d\n", __func__, - hardwareTarget.virtual_width, hardwareTarget.virtual_height); + hardwareTarget.timing.h_display, hardwareTarget.timing.v_display); hardwareTarget.space = target->space; + // retain requested virtual size + hardwareTarget.virtual_width = target->virtual_width; + hardwareTarget.virtual_height = target->virtual_height; // FIXME we should also get the refresh frequency from the target // mode, and then "sanitize" the resulting mode we made up. @@ -785,8 +788,8 @@ status_t DigitalPort::SetDisplayMode(display_mode* target, uint32 colorMode) { CALLED(); - TRACE("%s: %s %dx%d\n", __func__, PortName(), target->virtual_width, - target->virtual_height); + TRACE("%s: %s %dx%d\n", __func__, PortName(), target->timing.h_display, + target->timing.v_display); if (fPipe == NULL) { ERROR("%s: Setting display mode without assigned pipe!\n", __func__); @@ -1125,8 +1128,8 @@ status_t DisplayPort::SetDisplayMode(display_mode* target, uint32 colorMode) { CALLED(); - TRACE("%s: %s %dx%d\n", __func__, PortName(), target->virtual_width, - target->virtual_height); + TRACE("%s: %s %dx%d\n", __func__, PortName(), target->timing.h_display, + target->timing.v_display); if (fPipe == NULL) { ERROR("%s: Setting display mode without assigned pipe!\n", __func__); @@ -1331,8 +1334,8 @@ status_t DigitalDisplayInterface::SetDisplayMode(display_mode* target, uint32 colorMode) { CALLED(); - TRACE("%s: %s %dx%d\n", __func__, PortName(), target->virtual_width, - target->virtual_height); + TRACE("%s: %s %dx%d\n", __func__, PortName(), target->timing.h_display, + target->timing.v_display); if (fPipe == NULL) { ERROR("%s: Setting display mode without assigned pipe!\n", __func__); diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index cf9dba3dfc..3c5c051073 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -152,9 +152,9 @@ limit_modes_for_gen3_lvds(display_mode* mode) // display. // FIXME do this only for that display. The whole display mode logic // needs to be adjusted to know which display we're talking about. - if (gInfo->shared_info->panel_mode.virtual_width < mode->virtual_width) + if (gInfo->shared_info->panel_mode.timing.h_display < mode->timing.h_display) return false; - if (gInfo->shared_info->panel_mode.virtual_height < mode->virtual_height) + if (gInfo->shared_info->panel_mode.timing.v_display < mode->timing.v_display) return false; return true; @@ -269,18 +269,23 @@ intel_propose_display_mode(display_mode* target, const display_mode* low, // TODO: Only sanitize_display_mode should be used. However, at the moment // the mode constraints are not optimal and do not work for all // configurations. + uint32 VirtualWidth = target->virtual_width; + uint32 VirtualHeight = target->virtual_height; for (uint32 i = 0; i < gInfo->shared_info->mode_count; i++) { display_mode *mode = &gInfo->mode_list[i]; // TODO: improve this, ie. adapt pixel clock to allowed values!!! - if (target->virtual_width != mode->virtual_width - || target->virtual_height != mode->virtual_height + if (target->timing.h_display != mode->timing.h_display + || target->timing.v_display != mode->timing.v_display || target->space != mode->space) { continue; } *target = *mode; + // retain requested virtual size + target->virtual_width = VirtualWidth; + target->virtual_height = VirtualHeight; return B_OK; } @@ -298,7 +303,7 @@ intel_set_display_mode(display_mode* mode) return B_BAD_VALUE; TRACE("%s(%" B_PRIu16 "x%" B_PRIu16 ")\n", __func__, - mode->virtual_width, mode->virtual_height); + mode->timing.h_display, mode->timing.v_display); display_mode target = *mode;