diff options
author | Simon Rettberg | 2020-09-17 15:17:01 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-09-17 15:17:01 +0200 |
commit | 2901482b60f53ba9846db779601297838ad9f622 (patch) | |
tree | ce76febf8c2cf3b229a9fc3280cc0f0605d63cb4 /src/xx.cpp | |
parent | Add more debug info (diff) | |
download | beamergui-2901482b60f53ba9846db779601297838ad9f622.tar.gz beamergui-2901482b60f53ba9846db779601297838ad9f622.tar.xz beamergui-2901482b60f53ba9846db779601297838ad9f622.zip |
Force-Add resolutions when using --resolutions option
If the user explicitly passes desired resolutions on the command line,
assume they know what they're doing, and go ahead and force things the
way they were requested.
Also add more debug spam to relevant code, so we can track down
where/why things fail.
Diffstat (limited to 'src/xx.cpp')
-rw-r--r-- | src/xx.cpp | 43 |
1 files changed, 35 insertions, 8 deletions
@@ -267,6 +267,7 @@ void ScreenSetup::initModes() if (!a->getOutputModeForResolution(info->output, mode->width, mode->height).isEmpty()) continue; XRRAddOutputMode(a->_display, info->id, mode->id); + qDebug() << "Adding mode" << mode->width << 'x' << mode->height << "to" << info->outputName; } } #undef RES @@ -274,6 +275,7 @@ void ScreenSetup::initModes() for (auto res : wanted) { unsigned int x = res & 0xffff; unsigned int y = res >> 16; + qDebug() << "Creating missing wanted resolution of" << x << "x" << y; createMode(x, y, 60, QString::asprintf("%ux%u", x, y)); } if (!wanted.isEmpty()) { // Modes were added, update for final loop below @@ -282,7 +284,8 @@ void ScreenSetup::initModes() // Finally copy all those the projector supports to other outputs for (auto key : a->_outputMap.keys()) { OutputInfo *oi = a->_outputMap[key]; - if (oi->outputType == Projector::Yes) { + if (oi->outputType == Projector::Yes && oi->output->npreferred > 0) { // Only if has edid + qDebug() << "Copying" << oi->output->nmode << "modes to all from" << oi->outputName; a->copyModesToAll(key, oi->output->nmode); } } @@ -497,7 +500,10 @@ bool ScreenSetup::createMode(unsigned int resX, unsigned int resY, float refresh } RRMode xid = XRRCreateMode(a->_display, DefaultRootWindow(a->_display), &m); - qDebug() << "Return value of create was" << xid; + if (xid <= 0) { + qDebug() << "Return value of create mode was" << xid << "(" << resX << 'x' << resY << ")"; + return false; + } // Immediately add to all screens for (OutputInfo *info : a->_outputMap) { XRRAddOutputMode(a->_display, info->id, xid); @@ -591,21 +597,42 @@ ConfigBackup ScreenSetup::setCustom(const QList<QPair<QSize, QList<QString>>> &l retval = createCrtcBackup(); auto screenSize = getTotalSizeHorz(sizes); if (screenSize.isEmpty()) - return retval; - int x = 0; + return retval; + // Make sure desired resolutions exist on outputs + bool reload = false; + for (auto e : list) { + if (e.second.isEmpty()) + continue; + const QSize &res = e.first; + for (auto outputName : e.second) { + for (auto oi : a->_outputMap) { + if (oi->outputName != outputName) + continue; + // Now add resolution if not found + if (a->addResolutionToOutput(oi, res)) { + reload = true; + } + } + } + } + if (reload) { + updateScreenResources(); + } + int x = 0; for (auto e : list) { if (e.second.isEmpty()) continue; const QSize &res = e.first; unsigned int w = 0; + // Find according output, apply resolution for (auto outputName : e.second) { for (auto oi : a->_outputMap) { if (oi->outputName != outputName) continue; - auto *mode = a->setOutputResolution(cmd, oi, x, 0, res); - if (mode != nullptr && mode->width > w) { - w = mode->width; - } + auto *mode = a->setOutputResolution(cmd, oi, x, 0, res); + if (mode != nullptr && mode->width > w) { + w = mode->width; + } } } x += w; |