Commit 05e361e5 authored by Roman Gilg's avatar Roman Gilg
Browse files

fix(randr): make sure crtc exists

When an output gets enabled we directly want to set the logical size. But at
this point because of the order of calls in XRandRConfig the crtc is not yet
set on the output.

To fix this in a quick way just provide the free crtc as an argument. Long-term
change the order of calls.
parent 50969ab6
......@@ -559,7 +559,7 @@ bool XRandRConfig::enableOutput(const OutputPtr &kscreenOutput) const
XRandROutput *xOutput = output(kscreenOutput->id());
const int modeId = kscreenOutput->currentMode() ? kscreenOutput->currentModeId().toInt() :
xOutput->updateLogicalSize(kscreenOutput, freeCrtc);
qCDebug(KSCREEN_XRANDR) << "RRSetCrtcConfig (enable output)" << "\n"
<< "\tOutput:" << kscreenOutput->id() << "(" << kscreenOutput->name()
......@@ -363,8 +363,14 @@ QSizeF XRandROutput::logicalSize() const
return QSizeF(width, height);
void XRandROutput::updateLogicalSize(const KScreen::OutputPtr &output)
void XRandROutput::updateLogicalSize(const KScreen::OutputPtr &output, XRandRCrtc *crtc)
if (!crtc) {
// TODO: This is a workaround for now when updateLogicalSize is called on enabling the
// output. At this point m_crtc is not yet set. Change the order in the future so
// that the additional argument is not necessary anymore.
crtc = m_crtc;
const QSizeF logicalSize = output->explicitLogicalSize();
xcb_render_transform_t transform = unityTransform();
......@@ -384,7 +390,7 @@ void XRandROutput::updateLogicalSize(const KScreen::OutputPtr &output)
QByteArray filterName(isScaling(transform) ? "bilinear" : "nearest");
auto cookie = xcb_randr_set_crtc_transform_checked(XCB::connection(),
0, nullptr);
......@@ -75,7 +75,7 @@ public:
KScreen::OutputPtr toKScreenOutput() const;
void updateLogicalSize(const KScreen::OutputPtr &output);
void updateLogicalSize(const KScreen::OutputPtr &output, XRandRCrtc *crtc = nullptr);
void init();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment