Commit 421f5857 authored by Łukasz Spintzyk's avatar Łukasz Spintzyk
Browse files

present: get_crtc should not return crtc when its screen does not have present extension

Since crtc can belong to secondary output that may not have present
extension enabled we should fallback to first enabled crtc or fake crtc.

Fix for issue xorg/xserver#1195
parent b88ad0b3
Pipeline #362822 passed with stages
in 5 minutes and 32 seconds
...@@ -59,11 +59,20 @@ present_get_crtc(WindowPtr window) ...@@ -59,11 +59,20 @@ present_get_crtc(WindowPtr window)
{ {
ScreenPtr screen = window->drawable.pScreen; ScreenPtr screen = window->drawable.pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen); present_screen_priv_ptr screen_priv = present_screen_priv(screen);
RRCrtcPtr crtc = NULL;
RROutputPtr firstOutput = NULL;
if (!screen_priv) if (!screen_priv)
return NULL; return NULL;
return screen_priv->get_crtc(screen_priv, window); crtc = screen_priv->get_crtc(screen_priv, window);
if (crtc && !present_screen_priv(crtc->pScreen)) {
crtc = RRFirstEnabledCrtc(screen);
}
if (crtc && !present_screen_priv(crtc->pScreen)) {
crtc = NULL;
}
return crtc;
} }
/* /*
......
...@@ -693,6 +693,33 @@ RRFirstOutput(ScreenPtr pScreen) ...@@ -693,6 +693,33 @@ RRFirstOutput(ScreenPtr pScreen)
return NULL; return NULL;
} }
RRCrtcPtr
RRFirstEnabledCrtc(ScreenPtr pScreen)
{
rrScrPriv(pScreen);
RROutputPtr output;
int i, j;
if (!pScrPriv)
return NULL;
if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc &&
pScrPriv->primaryOutput->pScreen == pScreen)
return pScrPriv->primaryOutput->crtc;
for (i = 0; i < pScrPriv->numCrtcs; i++) {
RRCrtcPtr crtc = pScrPriv->crtcs[i];
for (j = 0; j < pScrPriv->numOutputs; j++) {
output = pScrPriv->outputs[j];
if (output->crtc == crtc && crtc->mode)
return crtc;
}
}
return NULL;
}
CARD16 CARD16
RRVerticalRefresh(xRRModeInfo * mode) RRVerticalRefresh(xRRModeInfo * mode)
{ {
......
...@@ -593,6 +593,8 @@ extern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen); ...@@ -593,6 +593,8 @@ extern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen);
extern _X_EXPORT RROutputPtr RRFirstOutput(ScreenPtr pScreen); extern _X_EXPORT RROutputPtr RRFirstOutput(ScreenPtr pScreen);
extern _X_EXPORT RRCrtcPtr RRFirstEnabledCrtc(ScreenPtr pScreen);
extern _X_EXPORT Bool RROutputSetNonDesktop(RROutputPtr output, Bool non_desktop); extern _X_EXPORT Bool RROutputSetNonDesktop(RROutputPtr output, Bool non_desktop);
extern _X_EXPORT CARD16 extern _X_EXPORT CARD16
......
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