RandR mode list needs both output and crtc modes.
When an output no longer reports the current mode, it must still be included in the list advertised by the X server. Walk the crtcs to ensure it is included. (cherry picked from 78689d0d6630afcbcd3ce5394d12c2564a489f45 commit)
This commit is contained in:
parent
9e32bf98bc
commit
d742025f43
|
@ -108,12 +108,15 @@ RRModePtr *
|
||||||
RRModesForScreen (ScreenPtr pScreen, int *num_ret)
|
RRModesForScreen (ScreenPtr pScreen, int *num_ret)
|
||||||
{
|
{
|
||||||
rrScrPriv(pScreen);
|
rrScrPriv(pScreen);
|
||||||
int o;
|
int o, c;
|
||||||
RRModePtr *screen_modes;
|
RRModePtr *screen_modes;
|
||||||
int num_screen_modes = 0;
|
int num_screen_modes = 0;
|
||||||
|
|
||||||
screen_modes = xalloc ((num_modes ? num_modes : 1) * sizeof (RRModePtr));
|
screen_modes = xalloc ((num_modes ? num_modes : 1) * sizeof (RRModePtr));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add modes from all outputs
|
||||||
|
*/
|
||||||
for (o = 0; o < pScrPriv->numOutputs; o++)
|
for (o = 0; o < pScrPriv->numOutputs; o++)
|
||||||
{
|
{
|
||||||
RROutputPtr output = pScrPriv->outputs[o];
|
RROutputPtr output = pScrPriv->outputs[o];
|
||||||
|
@ -129,6 +132,24 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret)
|
||||||
screen_modes[num_screen_modes++] = mode;
|
screen_modes[num_screen_modes++] = mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Add modes from all crtcs. The goal is to
|
||||||
|
* make sure all available and active modes
|
||||||
|
* are visible to the client
|
||||||
|
*/
|
||||||
|
for (c = 0; c < pScrPriv->numCrtcs; c++)
|
||||||
|
{
|
||||||
|
RRCrtcPtr crtc = pScrPriv->crtcs[c];
|
||||||
|
RRModePtr mode = crtc->mode;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
if (!mode) continue;
|
||||||
|
for (n = 0; n < num_screen_modes; n++)
|
||||||
|
if (screen_modes[n] == mode)
|
||||||
|
break;
|
||||||
|
if (n == num_screen_modes)
|
||||||
|
screen_modes[num_screen_modes++] = mode;
|
||||||
|
}
|
||||||
*num_ret = num_screen_modes;
|
*num_ret = num_screen_modes;
|
||||||
return screen_modes;
|
return screen_modes;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue