Compare commits
11 Commits
master
...
submit/ran
Author | SHA1 | Date | |
---|---|---|---|
|
2957bf04fc | ||
|
6b4894aa07 | ||
|
d93d9af35a | ||
|
df85b516c4 | ||
|
e4270e8bcf | ||
|
d0802de141 | ||
|
ca9e23c263 | ||
|
caed2ae6fc | ||
|
1e47daf592 | ||
|
6dd0b813ad | ||
|
c7a1827541 |
|
@ -20,12 +20,16 @@
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
* OF THIS SOFTWARE.
|
* OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include <dix-config.h>
|
||||||
|
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
|
#include "os/bug_priv.h"
|
||||||
|
|
||||||
#include "randrstr_priv.h"
|
#include "randrstr_priv.h"
|
||||||
#include "swaprep.h"
|
#include "swaprep.h"
|
||||||
#include "mipointer.h"
|
#include "mipointer.h"
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
|
||||||
|
|
||||||
RESTYPE RRCrtcType = 0;
|
RESTYPE RRCrtcType = 0;
|
||||||
|
|
||||||
|
@ -181,10 +185,13 @@ RRCrtcNotify(RRCrtcPtr crtc,
|
||||||
crtc->outputs = newoutputs;
|
crtc->outputs = newoutputs;
|
||||||
crtc->numOutputs = numOutputs;
|
crtc->numOutputs = numOutputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy the new list of outputs into the crtc
|
* Copy the new list of outputs into the crtc
|
||||||
*/
|
*/
|
||||||
|
BUG_RETURN_VAL(outputs == NULL, FALSE);
|
||||||
memcpy(crtc->outputs, outputs, numOutputs * sizeof(RROutputPtr));
|
memcpy(crtc->outputs, outputs, numOutputs * sizeof(RROutputPtr));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update remaining crtc fields
|
* Update remaining crtc fields
|
||||||
*/
|
*/
|
||||||
|
@ -735,6 +742,8 @@ RRCrtcSet(RRCrtcPtr crtc,
|
||||||
Bool crtcChanged;
|
Bool crtcChanged;
|
||||||
int o;
|
int o;
|
||||||
|
|
||||||
|
BUG_RETURN_VAL(outputs == NULL, FALSE);
|
||||||
|
|
||||||
rrScrPriv(pScreen);
|
rrScrPriv(pScreen);
|
||||||
|
|
||||||
crtcChanged = FALSE;
|
crtcChanged = FALSE;
|
||||||
|
|
|
@ -119,7 +119,6 @@ RROutputCreate(ScreenPtr pScreen,
|
||||||
Bool
|
Bool
|
||||||
RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones)
|
RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones)
|
||||||
{
|
{
|
||||||
RROutputPtr *newClones;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (numClones == output->numClones) {
|
if (numClones == output->numClones) {
|
||||||
|
@ -129,15 +128,16 @@ RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones)
|
||||||
if (i == numClones)
|
if (i == numClones)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RROutputPtr *newClones = NULL;
|
||||||
if (numClones) {
|
if (numClones) {
|
||||||
newClones = xallocarray(numClones, sizeof(RROutputPtr));
|
newClones = xallocarray(numClones, sizeof(RROutputPtr));
|
||||||
if (!newClones)
|
if (!newClones)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
else
|
|
||||||
newClones = NULL;
|
|
||||||
free(output->clones);
|
|
||||||
memcpy(newClones, clones, numClones * sizeof(RROutputPtr));
|
memcpy(newClones, clones, numClones * sizeof(RROutputPtr));
|
||||||
|
}
|
||||||
|
|
||||||
|
free(output->clones);
|
||||||
output->clones = newClones;
|
output->clones = newClones;
|
||||||
output->numClones = numClones;
|
output->numClones = numClones;
|
||||||
RROutputChanged(output, TRUE);
|
RROutputChanged(output, TRUE);
|
||||||
|
@ -148,7 +148,6 @@ Bool
|
||||||
RROutputSetModes(RROutputPtr output,
|
RROutputSetModes(RROutputPtr output,
|
||||||
RRModePtr * modes, int numModes, int numPreferred)
|
RRModePtr * modes, int numModes, int numPreferred)
|
||||||
{
|
{
|
||||||
RRModePtr *newModes;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (numModes == output->numModes && numPreferred == output->numPreferred) {
|
if (numModes == output->numModes && numPreferred == output->numPreferred) {
|
||||||
|
@ -162,19 +161,19 @@ RROutputSetModes(RROutputPtr output,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RRModePtr *newModes = NULL;
|
||||||
if (numModes) {
|
if (numModes) {
|
||||||
newModes = xallocarray(numModes, sizeof(RRModePtr));
|
newModes = xallocarray(numModes, sizeof(RRModePtr));
|
||||||
if (!newModes)
|
if (!newModes)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
memcpy(newModes, modes, numModes * sizeof(RRModePtr));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
newModes = NULL;
|
|
||||||
if (output->modes) {
|
if (output->modes) {
|
||||||
for (i = 0; i < output->numModes; i++)
|
for (i = 0; i < output->numModes; i++)
|
||||||
RRModeDestroy(output->modes[i]);
|
RRModeDestroy(output->modes[i]);
|
||||||
free(output->modes);
|
free(output->modes);
|
||||||
}
|
}
|
||||||
memcpy(newModes, modes, numModes * sizeof(RRModePtr));
|
|
||||||
output->modes = newModes;
|
output->modes = newModes;
|
||||||
output->numModes = numModes;
|
output->numModes = numModes;
|
||||||
output->numPreferred = numPreferred;
|
output->numPreferred = numPreferred;
|
||||||
|
@ -251,7 +250,6 @@ RROutputDeleteUserMode(RROutputPtr output, RRModePtr mode)
|
||||||
Bool
|
Bool
|
||||||
RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs)
|
RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs)
|
||||||
{
|
{
|
||||||
RRCrtcPtr *newCrtcs;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (numCrtcs == output->numCrtcs) {
|
if (numCrtcs == output->numCrtcs) {
|
||||||
|
@ -261,15 +259,16 @@ RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs)
|
||||||
if (i == numCrtcs)
|
if (i == numCrtcs)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RRCrtcPtr *newCrtcs = NULL;
|
||||||
if (numCrtcs) {
|
if (numCrtcs) {
|
||||||
newCrtcs = xallocarray(numCrtcs, sizeof(RRCrtcPtr));
|
newCrtcs = xallocarray(numCrtcs, sizeof(RRCrtcPtr));
|
||||||
if (!newCrtcs)
|
if (!newCrtcs)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
else
|
|
||||||
newCrtcs = NULL;
|
|
||||||
free(output->crtcs);
|
|
||||||
memcpy(newCrtcs, crtcs, numCrtcs * sizeof(RRCrtcPtr));
|
memcpy(newCrtcs, crtcs, numCrtcs * sizeof(RRCrtcPtr));
|
||||||
|
}
|
||||||
|
|
||||||
|
free(output->crtcs);
|
||||||
output->crtcs = newCrtcs;
|
output->crtcs = newCrtcs;
|
||||||
output->numCrtcs = numCrtcs;
|
output->numCrtcs = numCrtcs;
|
||||||
RROutputChanged(output, TRUE);
|
RROutputChanged(output, TRUE);
|
||||||
|
@ -439,14 +438,12 @@ ProcRRGetOutputInfo(ClientPtr client)
|
||||||
REQUEST(xRRGetOutputInfoReq);
|
REQUEST(xRRGetOutputInfoReq);
|
||||||
xRRGetOutputInfoReply rep;
|
xRRGetOutputInfoReply rep;
|
||||||
RROutputPtr output;
|
RROutputPtr output;
|
||||||
CARD8 *extra;
|
|
||||||
unsigned long extraLen;
|
unsigned long extraLen;
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
rrScrPrivPtr pScrPriv;
|
rrScrPrivPtr pScrPriv;
|
||||||
RRCrtc *crtcs;
|
RRCrtc *crtcs;
|
||||||
RRMode *modes;
|
RRMode *modes;
|
||||||
RROutput *clones;
|
RROutput *clones;
|
||||||
char *name;
|
|
||||||
int i;
|
int i;
|
||||||
Bool leased;
|
Bool leased;
|
||||||
|
|
||||||
|
@ -458,6 +455,8 @@ ProcRRGetOutputInfo(ClientPtr client)
|
||||||
pScreen = output->pScreen;
|
pScreen = output->pScreen;
|
||||||
pScrPriv = rrGetScrPriv(pScreen);
|
pScrPriv = rrGetScrPriv(pScreen);
|
||||||
|
|
||||||
|
CARD8 *extra = NULL;
|
||||||
|
|
||||||
if (leased) {
|
if (leased) {
|
||||||
rep = (xRRGetOutputInfoReply) {
|
rep = (xRRGetOutputInfoReply) {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
|
@ -470,16 +469,14 @@ ProcRRGetOutputInfo(ClientPtr client)
|
||||||
.nameLength = output->nameLength
|
.nameLength = output->nameLength
|
||||||
};
|
};
|
||||||
extraLen = bytes_to_int32(rep.nameLength) << 2;
|
extraLen = bytes_to_int32(rep.nameLength) << 2;
|
||||||
if (extraLen) {
|
if (!extraLen)
|
||||||
|
goto sendout;
|
||||||
|
|
||||||
rep.length += bytes_to_int32(extraLen);
|
rep.length += bytes_to_int32(extraLen);
|
||||||
extra = calloc(1, extraLen);
|
extra = calloc(1, extraLen);
|
||||||
if (!extra)
|
if (!extra)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
memcpy(extra, output->name, output->nameLength);
|
||||||
else
|
|
||||||
extra = NULL;
|
|
||||||
|
|
||||||
name = (char *) extra;
|
|
||||||
} else {
|
} else {
|
||||||
rep = (xRRGetOutputInfoReply) {
|
rep = (xRRGetOutputInfoReply) {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
|
@ -502,25 +499,26 @@ ProcRRGetOutputInfo(ClientPtr client)
|
||||||
output->numModes + output->numUserModes +
|
output->numModes + output->numUserModes +
|
||||||
output->numClones + bytes_to_int32(rep.nameLength)) << 2);
|
output->numClones + bytes_to_int32(rep.nameLength)) << 2);
|
||||||
|
|
||||||
if (extraLen) {
|
if (!extraLen)
|
||||||
|
goto sendout;
|
||||||
|
|
||||||
rep.length += bytes_to_int32(extraLen);
|
rep.length += bytes_to_int32(extraLen);
|
||||||
extra = calloc(1, extraLen);
|
extra = calloc(1, extraLen);
|
||||||
if (!extra)
|
if (!extra)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
|
||||||
else
|
|
||||||
extra = NULL;
|
|
||||||
|
|
||||||
crtcs = (RRCrtc *) extra;
|
crtcs = (RRCrtc *) extra;
|
||||||
modes = (RRMode *) (crtcs + output->numCrtcs);
|
modes = (RRMode *) (crtcs + output->numCrtcs);
|
||||||
clones = (RROutput *) (modes + output->numModes + output->numUserModes);
|
clones = (RROutput *) (modes + output->numModes + output->numUserModes);
|
||||||
name = (char *) (clones + output->numClones);
|
|
||||||
|
memcpy((clones + output->numClones), output->name, output->nameLength);
|
||||||
|
|
||||||
for (i = 0; i < output->numCrtcs; i++) {
|
for (i = 0; i < output->numCrtcs; i++) {
|
||||||
crtcs[i] = output->crtcs[i]->id;
|
crtcs[i] = output->crtcs[i]->id;
|
||||||
if (client->swapped)
|
if (client->swapped)
|
||||||
swapl(&crtcs[i]);
|
swapl(&crtcs[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < output->numModes + output->numUserModes; i++) {
|
for (i = 0; i < output->numModes + output->numUserModes; i++) {
|
||||||
if (i < output->numModes)
|
if (i < output->numModes)
|
||||||
modes[i] = output->modes[i]->mode.id;
|
modes[i] = output->modes[i]->mode.id;
|
||||||
|
@ -535,7 +533,8 @@ ProcRRGetOutputInfo(ClientPtr client)
|
||||||
swapl(&clones[i]);
|
swapl(&clones[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memcpy(name, output->name, output->nameLength);
|
|
||||||
|
sendout:
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
@ -549,11 +548,10 @@ ProcRRGetOutputInfo(ClientPtr client)
|
||||||
swaps(&rep.nClones);
|
swaps(&rep.nClones);
|
||||||
swaps(&rep.nameLength);
|
swaps(&rep.nameLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xRRGetOutputInfoReply), &rep);
|
WriteToClient(client, sizeof(xRRGetOutputInfoReply), &rep);
|
||||||
if (extraLen) {
|
|
||||||
WriteToClient(client, extraLen, extra);
|
WriteToClient(client, extraLen, extra);
|
||||||
free(extra);
|
free(extra);
|
||||||
}
|
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -359,7 +359,6 @@ RRConfigureOutputProperty(RROutputPtr output, Atom property,
|
||||||
{
|
{
|
||||||
RRPropertyPtr prop = RRQueryOutputProperty(output, property);
|
RRPropertyPtr prop = RRQueryOutputProperty(output, property);
|
||||||
Bool add = FALSE;
|
Bool add = FALSE;
|
||||||
INT32 *new_values;
|
|
||||||
|
|
||||||
if (!prop) {
|
if (!prop) {
|
||||||
prop = RRCreateOutputProperty(property);
|
prop = RRCreateOutputProperty(property);
|
||||||
|
@ -379,14 +378,17 @@ RRConfigureOutputProperty(RROutputPtr output, Atom property,
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_values = xallocarray(num_values, sizeof(INT32));
|
INT32 *new_values = NULL;
|
||||||
if (!new_values && num_values) {
|
|
||||||
|
if (num_values) {
|
||||||
|
new_values = calloc(num_values, sizeof(INT32));
|
||||||
|
if (!new_values) {
|
||||||
if (add)
|
if (add)
|
||||||
RRDestroyOutputProperty(prop);
|
RRDestroyOutputProperty(prop);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
if (num_values)
|
|
||||||
memcpy(new_values, values, num_values * sizeof(INT32));
|
memcpy(new_values, values, num_values * sizeof(INT32));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Property moving from pending to non-pending
|
* Property moving from pending to non-pending
|
||||||
|
|
|
@ -327,7 +327,6 @@ RRConfigureProviderProperty(RRProviderPtr provider, Atom property,
|
||||||
{
|
{
|
||||||
RRPropertyPtr prop = RRQueryProviderProperty(provider, property);
|
RRPropertyPtr prop = RRQueryProviderProperty(provider, property);
|
||||||
Bool add = FALSE;
|
Bool add = FALSE;
|
||||||
INT32 *new_values;
|
|
||||||
|
|
||||||
if (!prop) {
|
if (!prop) {
|
||||||
prop = RRCreateProviderProperty(property);
|
prop = RRCreateProviderProperty(property);
|
||||||
|
@ -347,14 +346,16 @@ RRConfigureProviderProperty(RRProviderPtr provider, Atom property,
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_values = xallocarray(num_values, sizeof(INT32));
|
INT32 *new_values = NULL;
|
||||||
if (!new_values && num_values) {
|
if (num_values) {
|
||||||
|
new_values = calloc(num_values, sizeof(INT32));
|
||||||
|
if (!new_values) {
|
||||||
if (add)
|
if (add)
|
||||||
RRDestroyProviderProperty(prop);
|
RRDestroyProviderProperty(prop);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
if (num_values)
|
|
||||||
memcpy(new_values, values, num_values * sizeof(INT32));
|
memcpy(new_values, values, num_values * sizeof(INT32));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Property moving from pending to non-pending
|
* Property moving from pending to non-pending
|
||||||
|
@ -384,7 +385,7 @@ int
|
||||||
ProcRRListProviderProperties(ClientPtr client)
|
ProcRRListProviderProperties(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xRRListProviderPropertiesReq);
|
REQUEST(xRRListProviderPropertiesReq);
|
||||||
Atom *pAtoms = NULL, *temppAtoms;
|
Atom *pAtoms = NULL;
|
||||||
int numProps = 0;
|
int numProps = 0;
|
||||||
RRProviderPtr provider;
|
RRProviderPtr provider;
|
||||||
RRPropertyPtr prop;
|
RRPropertyPtr prop;
|
||||||
|
@ -395,9 +396,20 @@ ProcRRListProviderProperties(ClientPtr client)
|
||||||
|
|
||||||
for (prop = provider->properties; prop; prop = prop->next)
|
for (prop = provider->properties; prop; prop = prop->next)
|
||||||
numProps++;
|
numProps++;
|
||||||
if (numProps)
|
|
||||||
if (!(pAtoms = xallocarray(numProps, sizeof(Atom))))
|
const Bool swapped = client->swapped;
|
||||||
|
|
||||||
|
if (numProps) {
|
||||||
|
if (!(pAtoms = calloc(numProps, sizeof(Atom))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
Atom *temppAtoms = pAtoms;
|
||||||
|
for (prop = provider->properties; prop; prop = prop->next) {
|
||||||
|
*temppAtoms = prop->propertyName;
|
||||||
|
if (swapped)
|
||||||
|
swapl(temppAtoms);
|
||||||
|
temppAtoms++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
xRRListProviderPropertiesReply rep = {
|
xRRListProviderPropertiesReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
|
@ -405,21 +417,16 @@ ProcRRListProviderProperties(ClientPtr client)
|
||||||
.length = bytes_to_int32(numProps * sizeof(Atom)),
|
.length = bytes_to_int32(numProps * sizeof(Atom)),
|
||||||
.nAtoms = numProps
|
.nAtoms = numProps
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
if (swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
swaps(&rep.nAtoms);
|
swaps(&rep.nAtoms);
|
||||||
}
|
}
|
||||||
temppAtoms = pAtoms;
|
|
||||||
for (prop = provider->properties; prop; prop = prop->next)
|
|
||||||
*temppAtoms++ = prop->propertyName;
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xRRListProviderPropertiesReply), (char *) &rep);
|
WriteToClient(client, sizeof(xRRListProviderPropertiesReply), (char *) &rep);
|
||||||
if (numProps) {
|
WriteToClient(client, numProps * sizeof(Atom), pAtoms);
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
|
||||||
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
|
|
||||||
free(pAtoms);
|
free(pAtoms);
|
||||||
}
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,7 +436,6 @@ ProcRRQueryProviderProperty(ClientPtr client)
|
||||||
REQUEST(xRRQueryProviderPropertyReq);
|
REQUEST(xRRQueryProviderPropertyReq);
|
||||||
RRProviderPtr provider;
|
RRProviderPtr provider;
|
||||||
RRPropertyPtr prop;
|
RRPropertyPtr prop;
|
||||||
char *extra = NULL;
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq);
|
REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq);
|
||||||
|
|
||||||
|
@ -439,12 +445,6 @@ ProcRRQueryProviderProperty(ClientPtr client)
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return BadName;
|
return BadName;
|
||||||
|
|
||||||
if (prop->num_valid) {
|
|
||||||
extra = xallocarray(prop->num_valid, sizeof(INT32));
|
|
||||||
if (!extra)
|
|
||||||
return BadAlloc;
|
|
||||||
}
|
|
||||||
|
|
||||||
xRRQueryProviderPropertyReply rep = {
|
xRRQueryProviderPropertyReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
|
@ -459,11 +459,10 @@ ProcRRQueryProviderProperty(ClientPtr client)
|
||||||
}
|
}
|
||||||
WriteToClient(client, sizeof(xRRQueryProviderPropertyReply), (char *) &rep);
|
WriteToClient(client, sizeof(xRRQueryProviderPropertyReply), (char *) &rep);
|
||||||
if (prop->num_valid) {
|
if (prop->num_valid) {
|
||||||
memcpy(extra, prop->valid_values, prop->num_valid * sizeof(INT32));
|
if (client->swapped)
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
CopySwap32Write(client, prop->num_valid * sizeof(INT32), (CARD32*)prop->valid_values);
|
||||||
WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32),
|
else
|
||||||
extra);
|
WriteToClient(client, prop->num_valid * sizeof(INT32), prop->valid_values);
|
||||||
free(extra);
|
|
||||||
}
|
}
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -488,10 +488,6 @@ rrGetScreenResources(ClientPtr client, Bool query)
|
||||||
CARD8 *extra = NULL;
|
CARD8 *extra = NULL;
|
||||||
unsigned long extraLen = 0;
|
unsigned long extraLen = 0;
|
||||||
int i, rc, has_primary = 0;
|
int i, rc, has_primary = 0;
|
||||||
RRCrtc *crtcs;
|
|
||||||
RROutput *outputs;
|
|
||||||
xRRModeInfo *modeinfos;
|
|
||||||
CARD8 *names;
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
|
REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
|
||||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
|
@ -543,20 +539,19 @@ rrGetScreenResources(ClientPtr client, Bool query)
|
||||||
bytes_to_int32(rep.nbytesNames));
|
bytes_to_int32(rep.nbytesNames));
|
||||||
|
|
||||||
extraLen = rep.length << 2;
|
extraLen = rep.length << 2;
|
||||||
if (extraLen) {
|
if (!extraLen)
|
||||||
|
goto finish;
|
||||||
|
|
||||||
extra = calloc(1, extraLen);
|
extra = calloc(1, extraLen);
|
||||||
if (!extra) {
|
if (!extra) {
|
||||||
free(modes);
|
free(modes);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
extra = NULL;
|
|
||||||
|
|
||||||
crtcs = (RRCrtc *) extra;
|
RRCrtc *crtcs = (RRCrtc *) extra;
|
||||||
outputs = (RROutput *) (crtcs + pScrPriv->numCrtcs);
|
RROutput *outputs = (RROutput *) (crtcs + pScrPriv->numCrtcs);
|
||||||
modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs);
|
xRRModeInfo *modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs);
|
||||||
names = (CARD8 *) (modeinfos + num_modes);
|
CARD8* names = (CARD8 *) (modeinfos + num_modes);
|
||||||
|
|
||||||
if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) {
|
if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) {
|
||||||
has_primary = 1;
|
has_primary = 1;
|
||||||
|
@ -604,8 +599,9 @@ rrGetScreenResources(ClientPtr client, Bool query)
|
||||||
memcpy(names, mode->name, mode->mode.nameLength);
|
memcpy(names, mode->name, mode->mode.nameLength);
|
||||||
names += mode->mode.nameLength;
|
names += mode->mode.nameLength;
|
||||||
}
|
}
|
||||||
free(modes);
|
|
||||||
assert(bytes_to_int32((char *) names - (char *) extra) == rep.length);
|
assert(bytes_to_int32((char *) names - (char *) extra) == rep.length);
|
||||||
|
finish:
|
||||||
|
free(modes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
|
@ -777,8 +773,6 @@ ProcRRGetScreenInfo(ClientPtr client)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int i, j;
|
int i, j;
|
||||||
xScreenSizes *size;
|
|
||||||
CARD16 *rates;
|
|
||||||
CARD8 *data8;
|
CARD8 *data8;
|
||||||
Bool has_rate = RRClientKnowsRates(client);
|
Bool has_rate = RRClientKnowsRates(client);
|
||||||
RR10DataPtr pData;
|
RR10DataPtr pData;
|
||||||
|
@ -806,21 +800,20 @@ ProcRRGetScreenInfo(ClientPtr client)
|
||||||
if (has_rate)
|
if (has_rate)
|
||||||
extraLen += rep.nrateEnts * sizeof(CARD16);
|
extraLen += rep.nrateEnts * sizeof(CARD16);
|
||||||
|
|
||||||
if (extraLen) {
|
if (!extraLen)
|
||||||
extra = (CARD8 *) malloc(extraLen);
|
goto finish; // no extra payload
|
||||||
|
|
||||||
|
extra = calloc(1, extraLen);
|
||||||
if (!extra) {
|
if (!extra) {
|
||||||
free(pData);
|
free(pData);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
extra = NULL;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First comes the size information
|
* First comes the size information
|
||||||
*/
|
*/
|
||||||
size = (xScreenSizes *) extra;
|
xScreenSizes *size = (xScreenSizes *) extra;
|
||||||
rates = (CARD16 *) (size + rep.nSizes);
|
CARD16 *rates = (CARD16 *) (size + rep.nSizes);
|
||||||
for (i = 0; i < pData->nsize; i++) {
|
for (i = 0; i < pData->nsize; i++) {
|
||||||
pSize = &pData->sizes[i];
|
pSize = &pData->sizes[i];
|
||||||
size->widthInPixels = pSize->width;
|
size->widthInPixels = pSize->width;
|
||||||
|
@ -849,7 +842,6 @@ ProcRRGetScreenInfo(ClientPtr client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(pData);
|
|
||||||
|
|
||||||
data8 = (CARD8 *) rates;
|
data8 = (CARD8 *) rates;
|
||||||
|
|
||||||
|
@ -857,6 +849,9 @@ ProcRRGetScreenInfo(ClientPtr client)
|
||||||
FatalError("RRGetScreenInfo bad extra len %ld != %ld\n",
|
FatalError("RRGetScreenInfo bad extra len %ld != %ld\n",
|
||||||
(unsigned long) (data8 - (CARD8 *) extra), extraLen);
|
(unsigned long) (data8 - (CARD8 *) extra), extraLen);
|
||||||
rep.length = bytes_to_int32(extraLen);
|
rep.length = bytes_to_int32(extraLen);
|
||||||
|
|
||||||
|
finish:
|
||||||
|
free(pData);
|
||||||
}
|
}
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
|
|
Loading…
Reference in New Issue