Use C99 designated initializers in Xephyr Replies
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
parent
e4e827ec36
commit
14501fd33e
|
@ -517,18 +517,19 @@ EphyrMirrorHostVisuals(ScreenPtr a_screen)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIQueryVersion(register ClientPtr client)
|
ProcXF86DRIQueryVersion(register ClientPtr client)
|
||||||
{
|
{
|
||||||
xXF86DRIQueryVersionReply rep;
|
xXF86DRIQueryVersionReply rep = {
|
||||||
|
.type = X_Reply,
|
||||||
|
.sequenceNumber = client->sequence,
|
||||||
|
.length = 0,
|
||||||
|
.majorVersion = SERVER_XF86DRI_MAJOR_VERSION,
|
||||||
|
.minorVersion = SERVER_XF86DRI_MINOR_VERSION,
|
||||||
|
.patchVersion = SERVER_XF86DRI_PATCH_VERSION
|
||||||
|
};
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
|
REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
|
||||||
|
|
||||||
EPHYR_LOG("enter\n");
|
EPHYR_LOG("enter\n");
|
||||||
|
|
||||||
rep.type = X_Reply;
|
|
||||||
rep.length = 0;
|
|
||||||
rep.sequenceNumber = client->sequence;
|
|
||||||
rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION;
|
|
||||||
rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION;
|
|
||||||
rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION;
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
@ -556,17 +557,19 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
rep.type = X_Reply;
|
|
||||||
rep.length = 0;
|
|
||||||
rep.sequenceNumber = client->sequence;
|
|
||||||
|
|
||||||
if (!ephyrDRIQueryDirectRenderingCapable(stuff->screen, &isCapable)) {
|
if (!ephyrDRIQueryDirectRenderingCapable(stuff->screen, &isCapable)) {
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
rep.isCapable = isCapable;
|
|
||||||
|
|
||||||
if (!LocalClient(client) || client->swapped)
|
if (!LocalClient(client) || client->swapped)
|
||||||
rep.isCapable = 0;
|
isCapable = 0;
|
||||||
|
|
||||||
|
rep = (xXF86DRIQueryDirectRenderingCapableReply) {
|
||||||
|
.type = X_Reply,
|
||||||
|
.sequenceNumber = client->sequence,
|
||||||
|
.length = 0,
|
||||||
|
.isCapable = isCapable
|
||||||
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
|
@ -604,20 +607,20 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
|
||||||
if (busIdString)
|
if (busIdString)
|
||||||
busIdStringLength = strlen(busIdString);
|
busIdStringLength = strlen(busIdString);
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep = (xXF86DRIOpenConnectionReply) {
|
||||||
rep.sequenceNumber = client->sequence;
|
.type = X_Reply,
|
||||||
rep.busIdStringLength = busIdStringLength;
|
.sequenceNumber = client->sequence,
|
||||||
rep.length =
|
.length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
|
||||||
bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
|
SIZEOF(xGenericReply) +
|
||||||
SIZEOF(xGenericReply) +
|
pad_to_int32(busIdStringLength)),
|
||||||
pad_to_int32(busIdStringLength));
|
.hSAREALow = (CARD32) (hSAREA & 0xffffffff),
|
||||||
|
|
||||||
rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff);
|
|
||||||
#if defined(LONG64) && !defined(__linux__)
|
#if defined(LONG64) && !defined(__linux__)
|
||||||
rep.hSAREAHigh = (CARD32) (hSAREA >> 32);
|
.hSAREAHigh = (CARD32) (hSAREA >> 32),
|
||||||
#else
|
#else
|
||||||
rep.hSAREAHigh = 0;
|
.hSAREAHigh = 0,
|
||||||
#endif
|
#endif
|
||||||
|
.busIdStringLength = busIdStringLength
|
||||||
|
};
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
|
WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
|
||||||
if (busIdStringLength)
|
if (busIdStringLength)
|
||||||
|
@ -641,10 +644,12 @@ ProcXF86DRIAuthConnection(register ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep = (xXF86DRIAuthConnectionReply) {
|
||||||
rep.length = 0;
|
.type = X_Reply,
|
||||||
rep.sequenceNumber = client->sequence;
|
.sequenceNumber = client->sequence,
|
||||||
rep.authenticated = 1;
|
.length = 0,
|
||||||
|
.authenticated = 1
|
||||||
|
};
|
||||||
|
|
||||||
if (!ephyrDRIAuthConnection(stuff->screen, stuff->magic)) {
|
if (!ephyrDRIAuthConnection(stuff->screen, stuff->magic)) {
|
||||||
ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
|
ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
|
||||||
|
@ -677,7 +682,11 @@ ProcXF86DRICloseConnection(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIGetClientDriverName(register ClientPtr client)
|
ProcXF86DRIGetClientDriverName(register ClientPtr client)
|
||||||
{
|
{
|
||||||
xXF86DRIGetClientDriverNameReply rep;
|
xXF86DRIGetClientDriverNameReply rep = {
|
||||||
|
.type = X_Reply,
|
||||||
|
.sequenceNumber = client->sequence,
|
||||||
|
.clientDriverNameLength = 0
|
||||||
|
};
|
||||||
char *clientDriverName;
|
char *clientDriverName;
|
||||||
|
|
||||||
REQUEST(xXF86DRIGetClientDriverNameReq);
|
REQUEST(xXF86DRIGetClientDriverNameReq);
|
||||||
|
@ -694,10 +703,6 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
|
||||||
(int *) &rep.ddxDriverMinorVersion,
|
(int *) &rep.ddxDriverMinorVersion,
|
||||||
(int *) &rep.ddxDriverPatchVersion,
|
(int *) &rep.ddxDriverPatchVersion,
|
||||||
&clientDriverName);
|
&clientDriverName);
|
||||||
|
|
||||||
rep.type = X_Reply;
|
|
||||||
rep.sequenceNumber = client->sequence;
|
|
||||||
rep.clientDriverNameLength = 0;
|
|
||||||
if (clientDriverName)
|
if (clientDriverName)
|
||||||
rep.clientDriverNameLength = strlen(clientDriverName);
|
rep.clientDriverNameLength = strlen(clientDriverName);
|
||||||
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) -
|
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) -
|
||||||
|
@ -714,7 +719,11 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRICreateContext(register ClientPtr client)
|
ProcXF86DRICreateContext(register ClientPtr client)
|
||||||
{
|
{
|
||||||
xXF86DRICreateContextReply rep;
|
xXF86DRICreateContextReply rep = {
|
||||||
|
.type = X_Reply,
|
||||||
|
.sequenceNumber = client->sequence,
|
||||||
|
.length = 0
|
||||||
|
};
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VisualPtr visual;
|
VisualPtr visual;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -729,10 +738,6 @@ ProcXF86DRICreateContext(register ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
rep.type = X_Reply;
|
|
||||||
rep.length = 0;
|
|
||||||
rep.sequenceNumber = client->sequence;
|
|
||||||
|
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
visual = pScreen->visuals;
|
visual = pScreen->visuals;
|
||||||
|
|
||||||
|
@ -917,7 +922,11 @@ destroyHostPeerWindow(const WindowPtr a_win)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRICreateDrawable(ClientPtr client)
|
ProcXF86DRICreateDrawable(ClientPtr client)
|
||||||
{
|
{
|
||||||
xXF86DRICreateDrawableReply rep;
|
xXF86DRICreateDrawableReply rep = {
|
||||||
|
.type = X_Reply,
|
||||||
|
.sequenceNumber = client->sequence,
|
||||||
|
.length = 0
|
||||||
|
};
|
||||||
DrawablePtr drawable = NULL;
|
DrawablePtr drawable = NULL;
|
||||||
WindowPtr window = NULL;
|
WindowPtr window = NULL;
|
||||||
EphyrWindowPair *pair = NULL;
|
EphyrWindowPair *pair = NULL;
|
||||||
|
@ -933,10 +942,6 @@ ProcXF86DRICreateDrawable(ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
rep.type = X_Reply;
|
|
||||||
rep.length = 0;
|
|
||||||
rep.sequenceNumber = client->sequence;
|
|
||||||
|
|
||||||
rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
|
rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
|
||||||
DixReadAccess);
|
DixReadAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
@ -1025,7 +1030,11 @@ ProcXF86DRIDestroyDrawable(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
{
|
{
|
||||||
xXF86DRIGetDrawableInfoReply rep;
|
xXF86DRIGetDrawableInfoReply rep = {
|
||||||
|
.type = X_Reply,
|
||||||
|
.sequenceNumber = client->sequence,
|
||||||
|
.length = 0
|
||||||
|
};
|
||||||
DrawablePtr drawable;
|
DrawablePtr drawable;
|
||||||
WindowPtr window = NULL;
|
WindowPtr window = NULL;
|
||||||
EphyrWindowPair *pair = NULL;
|
EphyrWindowPair *pair = NULL;
|
||||||
|
@ -1037,16 +1046,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
|
REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
|
||||||
|
|
||||||
EPHYR_LOG("enter\n");
|
EPHYR_LOG("enter\n");
|
||||||
memset(&rep, 0, sizeof(rep));
|
|
||||||
if (stuff->screen >= screenInfo.numScreens) {
|
if (stuff->screen >= screenInfo.numScreens) {
|
||||||
client->errorValue = stuff->screen;
|
client->errorValue = stuff->screen;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
rep.type = X_Reply;
|
|
||||||
rep.length = 0;
|
|
||||||
rep.sequenceNumber = client->sequence;
|
|
||||||
|
|
||||||
rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
|
rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
|
||||||
DixReadAccess);
|
DixReadAccess);
|
||||||
if (rc != Success || !drawable) {
|
if (rc != Success || !drawable) {
|
||||||
|
@ -1161,7 +1165,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcXF86DRIGetDeviceInfo(register ClientPtr client)
|
ProcXF86DRIGetDeviceInfo(register ClientPtr client)
|
||||||
{
|
{
|
||||||
xXF86DRIGetDeviceInfoReply rep;
|
xXF86DRIGetDeviceInfoReply rep = {
|
||||||
|
.type = X_Reply,
|
||||||
|
.sequenceNumber = client->sequence,
|
||||||
|
.length = 0
|
||||||
|
};
|
||||||
drm_handle_t hFrameBuffer;
|
drm_handle_t hFrameBuffer;
|
||||||
void *pDevPrivate;
|
void *pDevPrivate;
|
||||||
|
|
||||||
|
@ -1174,10 +1182,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
rep.type = X_Reply;
|
|
||||||
rep.length = 0;
|
|
||||||
rep.sequenceNumber = client->sequence;
|
|
||||||
|
|
||||||
if (!ephyrDRIGetDeviceInfo(stuff->screen,
|
if (!ephyrDRIGetDeviceInfo(stuff->screen,
|
||||||
&hFrameBuffer,
|
&hFrameBuffer,
|
||||||
(int *) &rep.framebufferOrigin,
|
(int *) &rep.framebufferOrigin,
|
||||||
|
@ -1194,7 +1198,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
|
||||||
rep.hFrameBufferHigh = 0;
|
rep.hFrameBufferHigh = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rep.length = 0;
|
|
||||||
if (rep.devPrivateSize) {
|
if (rep.devPrivateSize) {
|
||||||
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
|
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
|
||||||
SIZEOF(xGenericReply) +
|
SIZEOF(xGenericReply) +
|
||||||
|
|
|
@ -159,11 +159,13 @@ ephyrGLXQueryVersion(__GLXclientState * a_cl, GLbyte * a_pc)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
EPHYR_LOG("major:%d, minor:%d\n", major, minor);
|
EPHYR_LOG("major:%d, minor:%d\n", major, minor);
|
||||||
reply.majorVersion = major;
|
reply = (xGLXQueryVersionReply) {
|
||||||
reply.minorVersion = minor;
|
.type = X_Reply,
|
||||||
reply.length = 0;
|
.sequenceNumber = client->sequence,
|
||||||
reply.type = X_Reply;
|
.length = 0,
|
||||||
reply.sequenceNumber = client->sequence;
|
.majorVersion = major,
|
||||||
|
.minorVersion = minor
|
||||||
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
__glXSwapQueryVersionReply(client, &reply);
|
__glXSwapQueryVersionReply(client, &reply);
|
||||||
|
@ -215,11 +217,13 @@ ephyrGLXGetVisualConfigsReal(__GLXclientState * a_cl,
|
||||||
}
|
}
|
||||||
EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props);
|
EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props);
|
||||||
|
|
||||||
reply.numVisuals = num_visuals;
|
reply = (xGLXGetVisualConfigsReply) {
|
||||||
reply.numProps = num_props;
|
.type = X_Reply,
|
||||||
reply.length = (num_visuals * __GLX_SIZE_CARD32 * num_props) >> 2;
|
.sequenceNumber = client->sequence,
|
||||||
reply.type = X_Reply;
|
.length = (num_visuals * __GLX_SIZE_CARD32 * num_props) >> 2,
|
||||||
reply.sequenceNumber = client->sequence;
|
.numVisuals = num_visuals,
|
||||||
|
.numProps = num_props
|
||||||
|
};
|
||||||
|
|
||||||
if (a_do_swap) {
|
if (a_do_swap) {
|
||||||
__GLX_SWAP_SHORT(&reply.sequenceNumber);
|
__GLX_SWAP_SHORT(&reply.sequenceNumber);
|
||||||
|
@ -269,11 +273,13 @@ ephyrGLXGetFBConfigsSGIXReal(__GLXclientState * a_cl,
|
||||||
}
|
}
|
||||||
EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props);
|
EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props);
|
||||||
|
|
||||||
reply.numVisuals = num_visuals;
|
reply = (xGLXGetVisualConfigsReply) {
|
||||||
reply.numProps = num_props;
|
.type = X_Reply,
|
||||||
reply.length = props_buf_size >> 2;
|
.sequenceNumber = client->sequence,
|
||||||
reply.type = X_Reply;
|
.length = props_buf_size >> 2,
|
||||||
reply.sequenceNumber = client->sequence;
|
.numVisuals = num_visuals,
|
||||||
|
.numProps = num_props
|
||||||
|
};
|
||||||
|
|
||||||
if (a_do_swap) {
|
if (a_do_swap) {
|
||||||
__GLX_SWAP_SHORT(&reply.sequenceNumber);
|
__GLX_SWAP_SHORT(&reply.sequenceNumber);
|
||||||
|
@ -364,10 +370,13 @@ ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc)
|
||||||
}
|
}
|
||||||
EPHYR_LOG("string: %s\n", server_string);
|
EPHYR_LOG("string: %s\n", server_string);
|
||||||
length = strlen(server_string) + 1;
|
length = strlen(server_string) + 1;
|
||||||
reply.type = X_Reply;
|
reply = (xGLXQueryServerStringReply) {
|
||||||
reply.sequenceNumber = client->sequence;
|
.type = X_Reply,
|
||||||
reply.length = __GLX_PAD(length) >> 2;
|
.sequenceNumber = client->sequence,
|
||||||
reply.n = length;
|
.length = __GLX_PAD(length) >> 2,
|
||||||
|
.n = length
|
||||||
|
};
|
||||||
|
|
||||||
buf = calloc(reply.length << 2, 1);
|
buf = calloc(reply.length << 2, 1);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
EPHYR_LOG_ERROR("failed to allocate string\n;");
|
EPHYR_LOG_ERROR("failed to allocate string\n;");
|
||||||
|
@ -522,7 +531,6 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
|
||||||
EPHYR_RETURN_VAL_IF_FAIL(drawable->pScreen, BadValue);
|
EPHYR_RETURN_VAL_IF_FAIL(drawable->pScreen, BadValue);
|
||||||
EPHYR_LOG("screen nummber requested:%d\n", drawable->pScreen->myNum);
|
EPHYR_LOG("screen nummber requested:%d\n", drawable->pScreen->myNum);
|
||||||
|
|
||||||
memset(&reply, 0, sizeof(reply));
|
|
||||||
if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawable->pScreen->myNum),
|
if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawable->pScreen->myNum),
|
||||||
req->context,
|
req->context,
|
||||||
req->oldContextTag,
|
req->oldContextTag,
|
||||||
|
@ -530,10 +538,12 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
|
||||||
EPHYR_LOG_ERROR("ephyrHostGLXMakeCurrent() failed\n");
|
EPHYR_LOG_ERROR("ephyrHostGLXMakeCurrent() failed\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
reply.length = 0;
|
reply = (xGLXMakeCurrentReply) {
|
||||||
reply.type = X_Reply;
|
.type = X_Reply,
|
||||||
reply.sequenceNumber = a_cl->client->sequence;
|
.sequenceNumber = a_cl->client->sequence,
|
||||||
reply.contextTag = contextTag;
|
.length = 0,
|
||||||
|
.contextTag = contextTag
|
||||||
|
};
|
||||||
if (a_do_swap) {
|
if (a_do_swap) {
|
||||||
__GLX_DECLARE_SWAP_VARIABLES;
|
__GLX_DECLARE_SWAP_VARIABLES;
|
||||||
__GLX_SWAP_SHORT(&reply.sequenceNumber);
|
__GLX_SWAP_SHORT(&reply.sequenceNumber);
|
||||||
|
@ -683,15 +693,17 @@ ephyrGLXIsDirectReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
|
||||||
|
|
||||||
EPHYR_LOG("enter\n");
|
EPHYR_LOG("enter\n");
|
||||||
|
|
||||||
memset(&reply, 0, sizeof(reply));
|
|
||||||
if (!ephyrHostIsContextDirect(req->context, (int *) &is_direct)) {
|
if (!ephyrHostIsContextDirect(req->context, (int *) &is_direct)) {
|
||||||
EPHYR_LOG_ERROR("ephyrHostIsContextDirect() failed\n");
|
EPHYR_LOG_ERROR("ephyrHostIsContextDirect() failed\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
reply.isDirect = is_direct;
|
reply = (xGLXIsDirectReply) {
|
||||||
reply.length = 0;
|
.type = X_Reply,
|
||||||
reply.type = X_Reply;
|
.sequenceNumber = client->sequence,
|
||||||
reply.sequenceNumber = client->sequence;
|
.length = 0,
|
||||||
|
.isDirect = is_direct
|
||||||
|
};
|
||||||
|
|
||||||
WriteToClient(client, sz_xGLXIsDirectReply, &reply);
|
WriteToClient(client, sz_xGLXIsDirectReply, &reply);
|
||||||
res = Success;
|
res = Success;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue