diff options
Diffstat (limited to 'xorg-server/randr')
-rw-r--r-- | xorg-server/randr/rroutput.c | 7 | ||||
-rw-r--r-- | xorg-server/randr/rrscreen.c | 22 | ||||
-rw-r--r-- | xorg-server/randr/rrsdispatch.c | 4 | ||||
-rw-r--r-- | xorg-server/randr/rrxinerama.c | 12 |
4 files changed, 38 insertions, 7 deletions
diff --git a/xorg-server/randr/rroutput.c b/xorg-server/randr/rroutput.c index 13d047b06..5d45bfdc1 100644 --- a/xorg-server/randr/rroutput.c +++ b/xorg-server/randr/rroutput.c @@ -488,6 +488,7 @@ ProcRRGetOutputInfo(ClientPtr client) swapl(&rep.mmHeight); swaps(&rep.nCrtcs); swaps(&rep.nModes); + swaps(&rep.nPreferred); swaps(&rep.nClones); swaps(&rep.nameLength); } @@ -541,7 +542,11 @@ ProcRRSetOutputPrimary(ClientPtr client) if (stuff->output) { VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); - if (output->pScreen != pWin->drawable.pScreen) { + if (!output->pScreen->isGPU && output->pScreen != pWin->drawable.pScreen) { + client->errorValue = stuff->window; + return BadMatch; + } + if (output->pScreen->isGPU && output->pScreen->current_master != pWin->drawable.pScreen) { client->errorValue = stuff->window; return BadMatch; } diff --git a/xorg-server/randr/rrscreen.c b/xorg-server/randr/rrscreen.c index 22a7e984f..cf7369e00 100644 --- a/xorg-server/randr/rrscreen.c +++ b/xorg-server/randr/rrscreen.c @@ -321,8 +321,13 @@ static inline void swap_modeinfos(xRRModeInfo *modeinfos, int i) swapl(&modeinfos[i].modeFlags); } -#define update_arrays(gpuscreen, pScrPriv) do { \ +#define update_arrays(gpuscreen, pScrPriv, primary_crtc, has_primary) do { \ for (j = 0; j < pScrPriv->numCrtcs; j++) { \ + if (has_primary && \ + primary_crtc == pScrPriv->crtcs[j]) { \ + has_primary = 0; \ + continue; \ + }\ crtcs[crtc_count] = pScrPriv->crtcs[j]->id; \ if (client->swapped) \ swapl(&crtcs[crtc_count]); \ @@ -365,9 +370,11 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) unsigned long extraLen; CARD8 *extra; RRCrtc *crtcs; + RRCrtcPtr primary_crtc = NULL; RROutput *outputs; xRRModeInfo *modeinfos; CARD8 *names; + int has_primary = 0; /* we need to iterate all the GPU masters and all their output slaves */ total_crtcs = 0; @@ -425,18 +432,25 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) modeinfos = (xRRModeInfo *)(outputs + total_outputs); names = (CARD8 *)(modeinfos + total_modes); - /* TODO primary */ crtc_count = 0; output_count = 0; mode_count = 0; pScrPriv = rrGetScrPriv(pScreen); - update_arrays(pScreen, pScrPriv); + if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) { + has_primary = 1; + primary_crtc = pScrPriv->primaryOutput->crtc; + crtcs[0] = pScrPriv->primaryOutput->crtc->id; + if (client->swapped) + swapl(&crtcs[0]); + crtc_count = 1; + } + update_arrays(pScreen, pScrPriv, primary_crtc, has_primary); xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) { pScrPriv = rrGetScrPriv(iter); - update_arrays(iter, pScrPriv); + update_arrays(iter, pScrPriv, primary_crtc, has_primary); } assert(bytes_to_int32((char *) names - (char *) extra) == rep.length); diff --git a/xorg-server/randr/rrsdispatch.c b/xorg-server/randr/rrsdispatch.c index 08c3b6abe..47558cf75 100644 --- a/xorg-server/randr/rrsdispatch.c +++ b/xorg-server/randr/rrsdispatch.c @@ -27,6 +27,7 @@ SProcRRQueryVersion(ClientPtr client) { REQUEST(xRRQueryVersionReq); + REQUEST_SIZE_MATCH(xRRQueryVersionReq); swaps(&stuff->length); swapl(&stuff->majorVersion); swapl(&stuff->minorVersion); @@ -38,6 +39,7 @@ SProcRRGetScreenInfo(ClientPtr client) { REQUEST(xRRGetScreenInfoReq); + REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); swaps(&stuff->length); swapl(&stuff->window); return (*ProcRandrVector[stuff->randrReqType]) (client); @@ -69,6 +71,7 @@ SProcRRSelectInput(ClientPtr client) { REQUEST(xRRSelectInputReq); + REQUEST_SIZE_MATCH(xRRSelectInputReq); swaps(&stuff->length); swapl(&stuff->window); swaps(&stuff->enable); @@ -152,6 +155,7 @@ SProcRRConfigureOutputProperty(ClientPtr client) { REQUEST(xRRConfigureOutputPropertyReq); + REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->property); diff --git a/xorg-server/randr/rrxinerama.c b/xorg-server/randr/rrxinerama.c index 9484b01e5..0b9dd8a0e 100644 --- a/xorg-server/randr/rrxinerama.c +++ b/xorg-server/randr/rrxinerama.c @@ -343,15 +343,17 @@ ProcRRXineramaQueryScreens(ClientPtr client) ScreenPtr slave; rrScrPriv(pScreen); int has_primary = 0; + RRCrtcPtr primary_crtc = NULL; if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) { has_primary = 1; + primary_crtc = pScrPriv->primaryOutput->crtc; RRXineramaWriteCrtc(client, pScrPriv->primaryOutput->crtc); } for (i = 0; i < pScrPriv->numCrtcs; i++) { if (has_primary && - pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i]) { + primary_crtc == pScrPriv->crtcs[i]) { has_primary = 0; continue; } @@ -361,8 +363,14 @@ ProcRRXineramaQueryScreens(ClientPtr client) xorg_list_for_each_entry(slave, &pScreen->output_slave_list, output_head) { rrScrPrivPtr pSlavePriv; pSlavePriv = rrGetScrPriv(slave); - for (i = 0; i < pSlavePriv->numCrtcs; i++) + for (i = 0; i < pSlavePriv->numCrtcs; i++) { + if (has_primary && + primary_crtc == pSlavePriv->crtcs[i]) { + has_primary = 0; + continue; + } RRXineramaWriteCrtc(client, pSlavePriv->crtcs[i]); + } } } |