[CRT] Update switchres (new PR) (#15526)

* Remove deps/switchres to update it right after

* Squashed 'deps/switchres/' content from commit 4df022c68a

git-subtree-dir: deps/switchres
git-subtree-split: 4df022c68a43b6481e18d5aa8e0ea27481291d1a
This commit is contained in:
Subs 2023-07-28 01:39:39 +02:00 committed by GitHub
parent 05b14ec3e4
commit 62e6439329
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 3 deletions

View File

@ -1048,7 +1048,16 @@ bool xrandr_timing::delete_mode(modeline *mode)
XRROutputInfo *output_info = XRRGetOutputInfo(m_pdisplay, resources, resources->outputs[m_desktop_output]);
XRRCrtcInfo *crtc_info = XRRGetCrtcInfo(m_pdisplay, resources, output_info->crtc);
if (resources->modes[m].id == crtc_info->mode)
log_verbose("XRANDR: <%d> (delete_mode) [WARNING] modeline [%04lx] is currently active\n", m_id, resources->modes[m].id);
{
log_verbose("XRANDR: <%d> (delete_mode) [WARNING] modeline [%04lx] is currently active, restoring desktop mode first\n", m_id, resources->modes[m].id);
modeline desktop_mode = {};
desktop_mode.type |= MODE_DESKTOP;
if (!set_timing(&desktop_mode, 0))
{
log_error("XRANDR: <%d> (delete_mode) [ERROR] Could not restore desktop mode\n", m_id);
return false;
}
}
XRRFreeCrtcInfo(crtc_info);
XRRFreeOutputInfo(output_info);
@ -1178,6 +1187,9 @@ bool xrandr_timing::process_modelist(std::vector<modeline *> modelist)
else if (mode->type & MODE_ADD)
result = add_mode(mode);
else if (mode->type & MODE_UPDATE)
result = update_mode(mode);
if (!result)
{
mode->type |= MODE_ERROR;

View File

@ -647,8 +647,13 @@ int modeline_parse(const char *user_modeline, modeline *mode)
int modeline_to_monitor_range(monitor_range *range, modeline *mode)
{
range->vfreq_min = mode->vfreq - 0.2;
range->vfreq_max = mode->vfreq + 0.2;
// If Vfreq range is empty, create it around the provided vfreq
if (range->vfreq_min == 0.0f) range->vfreq_min = mode->vfreq - 0.2;
if (range->vfreq_max == 0.0f) range->vfreq_max = mode->vfreq + 0.2;
// Make sure the range includes the target vfreq
if (mode->vfreq < range->vfreq_min || mode->vfreq > range->vfreq_max)
return 0;
double line_time = 1 / mode->hfreq;
double pixel_time = line_time / mode->htotal * 1000000;