dri: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
d03d79f96b
commit
165eb1be2b
|
|
@ -81,22 +81,15 @@ ProcXF86DRIQueryVersion(register ClientPtr client)
|
||||||
REQUEST_HEAD_STRUCT(xXF86DRIQueryVersionReq);
|
REQUEST_HEAD_STRUCT(xXF86DRIQueryVersionReq);
|
||||||
|
|
||||||
xXF86DRIQueryVersionReply rep = {
|
xXF86DRIQueryVersionReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.majorVersion = SERVER_XF86DRI_MAJOR_VERSION,
|
.majorVersion = SERVER_XF86DRI_MAJOR_VERSION,
|
||||||
.minorVersion = SERVER_XF86DRI_MINOR_VERSION,
|
.minorVersion = SERVER_XF86DRI_MINOR_VERSION,
|
||||||
.patchVersion = SERVER_XF86DRI_PATCH_VERSION
|
.patchVersion = SERVER_XF86DRI_PATCH_VERSION
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(majorVersion);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD16(minorVersion);
|
||||||
swapl(&rep.length);
|
REPLY_FIELD_CARD32(patchVersion);
|
||||||
swaps(&rep.majorVersion);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swaps(&rep.minorVersion);
|
|
||||||
swapl(&rep.patchVersion);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -121,20 +114,10 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
|
||||||
isCapable = 0;
|
isCapable = 0;
|
||||||
|
|
||||||
xXF86DRIQueryDirectRenderingCapableReply rep = {
|
xXF86DRIQueryDirectRenderingCapableReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.isCapable = isCapable
|
.isCapable = isCapable
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client,
|
|
||||||
sizeof(xXF86DRIQueryDirectRenderingCapableReply),
|
|
||||||
&rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -160,8 +143,6 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
|
||||||
busIdStringLength = strlen(busIdString);
|
busIdStringLength = strlen(busIdString);
|
||||||
|
|
||||||
xXF86DRIOpenConnectionReply rep = {
|
xXF86DRIOpenConnectionReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
|
.length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
|
||||||
SIZEOF(xGenericReply) +
|
SIZEOF(xGenericReply) +
|
||||||
pad_to_int32(busIdStringLength)),
|
pad_to_int32(busIdStringLength)),
|
||||||
|
|
@ -173,9 +154,7 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
|
REPLY_SEND_EXTRA(busIdString, busIdStringLength);
|
||||||
if (busIdStringLength)
|
|
||||||
WriteToClient(client, busIdStringLength, busIdString);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -185,8 +164,6 @@ ProcXF86DRIAuthConnection(register ClientPtr client)
|
||||||
REQUEST_HEAD_STRUCT(xXF86DRIAuthConnectionReq);
|
REQUEST_HEAD_STRUCT(xXF86DRIAuthConnectionReq);
|
||||||
|
|
||||||
xXF86DRIAuthConnectionReply rep = {
|
xXF86DRIAuthConnectionReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.authenticated = 1
|
.authenticated = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -199,8 +176,8 @@ ProcXF86DRIAuthConnection(register ClientPtr client)
|
||||||
ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
|
ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
|
||||||
rep.authenticated = 0;
|
rep.authenticated = 0;
|
||||||
}
|
}
|
||||||
WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), &rep);
|
|
||||||
return Success;
|
REPLY_SEND_RET_SUCCESS();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -223,10 +200,7 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST_HEAD_STRUCT(xXF86DRIGetClientDriverNameReq);
|
REQUEST_HEAD_STRUCT(xXF86DRIGetClientDriverNameReq);
|
||||||
|
|
||||||
xXF86DRIGetClientDriverNameReply rep = {
|
xXF86DRIGetClientDriverNameReply rep = { 0 };
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
|
||||||
char *clientDriverName;
|
char *clientDriverName;
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
|
|
@ -246,9 +220,7 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
|
||||||
SIZEOF(xGenericReply) +
|
SIZEOF(xGenericReply) +
|
||||||
pad_to_int32(rep.clientDriverNameLength));
|
pad_to_int32(rep.clientDriverNameLength));
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xXF86DRIGetClientDriverNameReply), &rep);
|
REPLY_SEND_EXTRA(clientDriverName, rep.clientDriverNameLength);
|
||||||
if (rep.clientDriverNameLength)
|
|
||||||
WriteToClient(client, rep.clientDriverNameLength, clientDriverName);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -257,10 +229,7 @@ ProcXF86DRICreateContext(register ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST_HEAD_STRUCT(xXF86DRICreateContextReq);
|
REQUEST_HEAD_STRUCT(xXF86DRICreateContextReq);
|
||||||
|
|
||||||
xXF86DRICreateContextReply rep = {
|
xXF86DRICreateContextReply rep = { 0 };
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
|
|
@ -276,8 +245,7 @@ ProcXF86DRICreateContext(register ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xXF86DRICreateContextReply), &rep);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -302,10 +270,7 @@ ProcXF86DRICreateDrawable(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST_HEAD_STRUCT(xXF86DRICreateDrawableReq);
|
REQUEST_HEAD_STRUCT(xXF86DRICreateDrawableReq);
|
||||||
|
|
||||||
xXF86DRICreateDrawableReply rep = {
|
xXF86DRICreateDrawableReply rep = { 0 };
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
|
||||||
DrawablePtr pDrawable;
|
DrawablePtr pDrawable;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|
@ -324,8 +289,7 @@ ProcXF86DRICreateDrawable(ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), &rep);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -359,10 +323,7 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST_HEAD_STRUCT(xXF86DRIGetDrawableInfoReq);
|
REQUEST_HEAD_STRUCT(xXF86DRIGetDrawableInfoReq);
|
||||||
|
|
||||||
xXF86DRIGetDrawableInfoReply rep = {
|
xXF86DRIGetDrawableInfoReply rep = { 0 };
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
|
||||||
DrawablePtr pDrawable;
|
DrawablePtr pDrawable;
|
||||||
int X, Y, W, H;
|
int X, Y, W, H;
|
||||||
drm_clip_rect_t *pClipRects;
|
drm_clip_rect_t *pClipRects;
|
||||||
|
|
@ -399,14 +360,10 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
rep.drawableY = Y;
|
rep.drawableY = Y;
|
||||||
rep.drawableWidth = W;
|
rep.drawableWidth = W;
|
||||||
rep.drawableHeight = H;
|
rep.drawableHeight = H;
|
||||||
rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) - SIZEOF(xGenericReply));
|
|
||||||
|
|
||||||
rep.backX = backX;
|
rep.backX = backX;
|
||||||
rep.backY = backY;
|
rep.backY = backY;
|
||||||
|
|
||||||
if (rep.numBackClipRects)
|
|
||||||
rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects;
|
|
||||||
|
|
||||||
drm_clip_rect_t pClippedRects[rep.numClipRects];
|
drm_clip_rect_t pClippedRects[rep.numClipRects];
|
||||||
|
|
||||||
if (rep.numClipRects) {
|
if (rep.numClipRects) {
|
||||||
|
|
@ -428,27 +385,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rep.numClipRects = j;
|
rep.numClipRects = j;
|
||||||
rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects;
|
|
||||||
}
|
|
||||||
|
|
||||||
rep.length = bytes_to_int32(rep.length);
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), &rep);
|
|
||||||
|
|
||||||
if (rep.numClipRects) {
|
|
||||||
WriteToClient(client,
|
|
||||||
sizeof(drm_clip_rect_t) * rep.numClipRects,
|
|
||||||
pClippedRects);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rep.numBackClipRects) {
|
|
||||||
WriteToClient(client,
|
|
||||||
sizeof(drm_clip_rect_t) * rep.numBackClipRects,
|
|
||||||
pBackClipRects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
REPLY_SEND_EXTRA_2(pClippedRects, sizeof(drm_clip_rect_t) * rep.numClipRects,
|
||||||
|
pBackClipRects, sizeof(drm_clip_rect_t) * rep.numBackClipRects);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -457,12 +398,9 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST_HEAD_STRUCT(xXF86DRIGetDeviceInfoReq);
|
REQUEST_HEAD_STRUCT(xXF86DRIGetDeviceInfoReq);
|
||||||
|
|
||||||
xXF86DRIGetDeviceInfoReply rep = {
|
xXF86DRIGetDeviceInfoReply rep = { 0 };
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
|
||||||
drm_handle_t hFrameBuffer;
|
drm_handle_t hFrameBuffer;
|
||||||
void *pDevPrivate;
|
void *pDevPrivate = NULL;
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
|
|
@ -483,16 +421,7 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
|
||||||
rep.hFrameBufferHigh = (CARD32) (hFrameBuffer >> 32);
|
rep.hFrameBufferHigh = (CARD32) (hFrameBuffer >> 32);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (rep.devPrivateSize) {
|
REPLY_SEND_EXTRA(pDevPrivate, rep.devPrivateSize);
|
||||||
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
|
|
||||||
SIZEOF(xGenericReply) +
|
|
||||||
pad_to_int32(rep.devPrivateSize));
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), &rep);
|
|
||||||
if (rep.length) {
|
|
||||||
WriteToClient(client, rep.devPrivateSize, pDevPrivate);
|
|
||||||
}
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue