Unverified Commit 86a6a340 authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'uli42-pr/fix_#293' into 3.6.x

parents 083051f6 3790a28f
...@@ -3741,6 +3741,27 @@ int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, in ...@@ -3741,6 +3741,27 @@ int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, in
return r; return r;
} }
/*
Destroy an output after removing it from any crtc that might reference it
*/
void nxagentDropOutput(RROutputPtr o) {
RRCrtcPtr c = o->crtc;
if (c) {
for (int i = 0; i < c->numOutputs; i++) {
if (c->outputs[i] == o) {
#ifdef DEBUG
fprintf(stderr, "nxagentDropOutput: output [%s] is in use by crtc [%p], removing it from there\n", o->name, c);
#endif
RRCrtcSet(c, NULL, 0, 0, RR_Rotate_0, 0, NULL);
}
}
}
#ifdef DEBUG
fprintf(stderr, "nxagentDropOutput: destroying output [%s]\n", o->name);
#endif
RROutputDestroy(o);
}
int nxagentAdjustRandRXinerama(ScreenPtr pScreen) int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
{ {
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
...@@ -3791,7 +3812,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) ...@@ -3791,7 +3812,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
*/ */
if (number == 0) { if (number == 0) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: faking xinerama\n" ); fprintf(stderr, "nxagentAdjustRandRXinerama: faking xinerama\n");
#endif #endif
number = 1; number = 1;
...@@ -3858,6 +3879,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) ...@@ -3858,6 +3879,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: destroying crtc\n"); fprintf(stderr, "nxagentAdjustRandRXinerama: destroying crtc\n");
#endif #endif
/* first reset the crtc to free possible outputs, then destroy the crtc */
RRCrtcSet(pScrPriv->crtcs[pScrPriv->numCrtcs - 1], NULL, 0, 0, RR_Rotate_0, 0, NULL);
RRCrtcDestroy(pScrPriv->crtcs[pScrPriv->numCrtcs - 1]); RRCrtcDestroy(pScrPriv->crtcs[pScrPriv->numCrtcs - 1]);
} }
else else
...@@ -3886,22 +3909,13 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) ...@@ -3886,22 +3909,13 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
} }
/* delete superfluous non-NX outputs */ /* delete superfluous non-NX outputs */
for (i = pScrPriv->numOutputs - 1; i >= 0; i--) { for (i = pScrPriv->numOutputs - 1; i >= 0; i--)
if (strncmp(pScrPriv->outputs[i]->name, "NX", 2)) { if (strncmp(pScrPriv->outputs[i]->name, "NX", 2))
#ifdef DEBUG nxagentDropOutput(pScrPriv->outputs[i]);
fprintf(stderr, "nxagentAdjustRandRXinerama: destroying output [%s]\n", pScrPriv->outputs[i]->name);
#endif
RROutputDestroy(pScrPriv->outputs[i]);
}
}
/* at this stage only NX outputs are left - we delete the superfluous ones */ /* at this stage only NX outputs are left - we delete the superfluous ones */
for (i = pScrPriv->numOutputs - 1; i >= number; i--) { for (i = pScrPriv->numOutputs - 1; i >= number; i--)
#ifdef DEBUG nxagentDropOutput(pScrPriv->outputs[i]);
fprintf(stderr, "nxagentAdjustRandRXinerama: destroying nx output [%s]\n", pScrPriv->outputs[i]->name);
#endif
RROutputDestroy(pScrPriv->outputs[i]);
}
/* add and init outputs */ /* add and init outputs */
for (i = 0; i < number; i++) { for (i = 0; i < number; i++) {
...@@ -3920,7 +3934,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) ...@@ -3920,7 +3934,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
output = pScrPriv->outputs[i]; output = pScrPriv->outputs[i];
} }
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: adjusting output [%s]\n", pScrPriv->outputs[i]->name); fprintf(stderr, "nxagentAdjustRandRXinerama: adjusting output [%s]\n", pScrPriv->outputs[i]->name);
#endif #endif
RROutputSetCrtcs(output, &(pScrPriv->crtcs[i]), 1); RROutputSetCrtcs(output, &(pScrPriv->crtcs[i]), 1);
/* FIXME: Isn't there a function for setting this? */ /* FIXME: Isn't there a function for setting this? */
...@@ -3931,7 +3945,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) ...@@ -3931,7 +3945,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
RROutputSetPhysicalSize(output, 0, 0); RROutputSetPhysicalSize(output, 0, 0);
} }
for (i = 0; i < pScrPriv->numOutputs; i++ ) { for (i = 0; i < pScrPriv->numOutputs; i++) {
Bool disable_output = FALSE; Bool disable_output = FALSE;
RRModePtr mymode, prevmode; RRModePtr mymode, prevmode;
int new_x, new_y; int new_x, new_y;
...@@ -4075,7 +4089,6 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) ...@@ -4075,7 +4089,6 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
/* throw away the mode if otherwise unused. We do not need it /* throw away the mode if otherwise unused. We do not need it
anymore. We call FreeResource() to ensure the system will not anymore. We call FreeResource() to ensure the system will not
try to free it again on shutdown */ try to free it again on shutdown */
if (prevmode && prevmode->refcnt == 1) { if (prevmode && prevmode->refcnt == 1) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: destroying prevmode [%s]\n", prevmode->name); fprintf(stderr, "nxagentAdjustRandRXinerama: destroying prevmode [%s]\n", prevmode->name);
......
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