randr: Hook up the new RandR 1.4 functionality

This bumps the supported RandR protocol version and adds the dispatch
hooks needed to call the new functions

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
This commit is contained in:
Keith Packard 2010-12-03 13:04:37 -08:00
parent 82612045e1
commit afb6ebf1d5
3 changed files with 139 additions and 1 deletions

View File

@ -65,7 +65,7 @@
/* RandR */
#define SERVER_RANDR_MAJOR_VERSION 1
#define SERVER_RANDR_MINOR_VERSION 3
#define SERVER_RANDR_MINOR_VERSION 4
/* Record */
#define SERVER_RECORD_MAJOR_VERSION 1

View File

@ -224,5 +224,11 @@ int (*ProcRandrVector[RRNumberRequests])(ClientPtr) = {
ProcRRSetPanning, /* 29 */
ProcRRSetOutputPrimary, /* 30 */
ProcRRGetOutputPrimary, /* 31 */
/* V1.4 additions */
ProcRRQueryScanoutPixmaps, /* 32 */
ProcRRCreateScanoutPixmap, /* 33 */
ProcRRSetCrtcSpriteTransform,/* 34 */
ProcRRGetCrtcSpriteTransform,/* 35 */
ProcRRSetCrtcConfigs, /* 36 */
};

View File

@ -461,6 +461,132 @@ SProcRRGetOutputPrimary (ClientPtr client)
return ProcRandrVector[stuff->randrReqType](client);
}
static int
SProcRRQueryScanoutPixmaps (ClientPtr client)
{
int n;
REQUEST(xRRQueryScanoutPixmapsReq);
REQUEST_SIZE_MATCH(xRRQueryScanoutPixmapsReq);
swaps(&stuff->length, n);
swapl(&stuff->drawable, n);
return ProcRandrVector[stuff->randrReqType](client);
}
static int
SProcRRCreateScanoutPixmap (ClientPtr client)
{
int n;
REQUEST(xRRCreateScanoutPixmapReq);
REQUEST_SIZE_MATCH(xRRCreateScanoutPixmapReq);
swaps(&stuff->length, n);
swapl(&stuff->pid, n);
swapl(&stuff->drawable, n);
swaps(&stuff->width, n);
swaps(&stuff->height, n);
swapl(&stuff->format, n);
swaps(&stuff->rotations, n);
return ProcRandrVector[stuff->randrReqType](client);
}
static void
swap_transform(xRenderTransform *t)
{
int n;
swapl(&t->matrix11, n);
swapl(&t->matrix12, n);
swapl(&t->matrix13, n);
swapl(&t->matrix21, n);
swapl(&t->matrix22, n);
swapl(&t->matrix23, n);
swapl(&t->matrix31, n);
swapl(&t->matrix32, n);
swapl(&t->matrix33, n);
}
static int
SProcRRSetCrtcSpriteTransform (ClientPtr client)
{
int n;
REQUEST(xRRSetCrtcSpriteTransformReq);
REQUEST_SIZE_MATCH(xRRSetCrtcSpriteTransformReq);
swaps(&stuff->length, n);
swapl(&stuff->crtc, n);
swap_transform(&stuff->positionTransform);
swap_transform(&stuff->imageTransform);
return ProcRandrVector[stuff->randrReqType](client);
}
static int
SProcRRGetCrtcSpriteTransform (ClientPtr client)
{
int n;
REQUEST(xRRGetCrtcSpriteTransformReq);
REQUEST_SIZE_MATCH(xRRGetCrtcSpriteTransformReq);
swaps(&stuff->length, n);
swapl(&stuff->crtc, n);
return ProcRandrVector[stuff->randrReqType](client);
}
static int
SProcRRSetCrtcConfigs (ClientPtr client)
{
int n;
REQUEST(xRRSetCrtcConfigsReq);
int c;
int extra_len;
int num_configs;
int num_output_ids;
xRRCrtcConfig *x_configs;
REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigsReq);
swaps(&stuff->length, n);
swapl(&stuff->drawable, n);
swaps(&stuff->screenPixmapWidth, n);
swaps(&stuff->screenPixmapHeight, n);
swaps(&stuff->screenWidth, n);
swaps(&stuff->screenHeight, n);
swapl(&stuff->widthInMillimeters, n);
swapl(&stuff->heightInMillimeters, n);
swaps(&stuff->nConfigs, n);
extra_len = client->req_len - bytes_to_int32(sizeof(xRRSetCrtcConfigsReq));
num_configs = stuff->nConfigs;
/* Check request length against number of configs specified */
if (num_configs * (sizeof (xRRCrtcConfig) >> 2) > extra_len)
return BadLength;
x_configs = (xRRCrtcConfig *) (stuff + 1);
for (c = 0; c < num_configs; c++) {
swapl(&x_configs->crtc, n);
swaps(&x_configs->x, n);
swaps(&x_configs->y, n);
swapl(&x_configs->mode, n);
swaps(&x_configs->rotation, n);
swaps(&x_configs->nOutput, n);
swap_transform(&x_configs->spritePositionTransform);
swap_transform(&x_configs->spriteImageTransform);
swapl(&x_configs->pixmap, n);
swaps(&x_configs->xPixmap, n);
swaps(&x_configs->yPixmap, n);
x_configs++;
}
/* Let the other dispatch function deal with verifying that
* the right number of output ids are present, just
* swap whatever is here
*/
num_output_ids = extra_len - (num_configs * (sizeof (xRRCrtcConfig)) >> 2);
SwapLongs((CARD32 *) x_configs, num_output_ids);
return ProcRandrVector[stuff->randrReqType](client);
}
int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
SProcRRQueryVersion, /* 0 */
/* we skip 1 to make old clients fail pretty immediately */
@ -499,5 +625,11 @@ int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
SProcRRSetPanning, /* 29 */
SProcRRSetOutputPrimary, /* 30 */
SProcRRGetOutputPrimary, /* 31 */
/* V1.4 additions */
SProcRRQueryScanoutPixmaps, /* 32 */
SProcRRCreateScanoutPixmap, /* 33 */
SProcRRSetCrtcSpriteTransform,/* 34 */
SProcRRGetCrtcSpriteTransform,/* 35 */
SProcRRSetCrtcConfigs, /* 36 */
};