aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/kdrive/ephyr/ephyrdriext.c')
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrdriext.c146
1 files changed, 75 insertions, 71 deletions
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
index 28486f516..a42be07d5 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
@@ -517,18 +517,19 @@ EphyrMirrorHostVisuals(ScreenPtr a_screen)
static int
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);
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) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -536,7 +537,7 @@ ProcXF86DRIQueryVersion(register ClientPtr client)
swaps(&rep.minorVersion);
swapl(&rep.patchVersion);
}
- WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), &rep);
EPHYR_LOG("leave\n");
return Success;
}
@@ -556,17 +557,19 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
if (!ephyrDRIQueryDirectRenderingCapable(stuff->screen, &isCapable)) {
return BadValue;
}
- rep.isCapable = isCapable;
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) {
swaps(&rep.sequenceNumber);
@@ -574,7 +577,7 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
}
WriteToClient(client, sizeof(xXF86DRIQueryDirectRenderingCapableReply),
- (char *) &rep);
+ &rep);
EPHYR_LOG("leave\n");
return Success;
@@ -586,6 +589,7 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
xXF86DRIOpenConnectionReply rep;
drm_handle_t hSAREA;
char *busIdString = NULL;
+ CARD32 busIdStringLength = 0;
REQUEST(xXF86DRIOpenConnectionReq);
REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
@@ -600,26 +604,27 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.busIdStringLength = 0;
if (busIdString)
- rep.busIdStringLength = strlen(busIdString);
- rep.length =
- bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
- SIZEOF(xGenericReply) +
- pad_to_int32(rep.busIdStringLength));
-
- rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff);
+ busIdStringLength = strlen(busIdString);
+
+ rep = (xXF86DRIOpenConnectionReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
+ SIZEOF(xGenericReply) +
+ pad_to_int32(busIdStringLength)),
+ .hSAREALow = (CARD32) (hSAREA & 0xffffffff),
#if defined(LONG64) && !defined(__linux__)
- rep.hSAREAHigh = (CARD32) (hSAREA >> 32);
+ .hSAREAHigh = (CARD32) (hSAREA >> 32),
#else
- rep.hSAREAHigh = 0;
+ .hSAREAHigh = 0,
#endif
+ .busIdStringLength = busIdStringLength
+ };
- WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *) &rep);
- if (rep.busIdStringLength)
- WriteToClient(client, rep.busIdStringLength, busIdString);
+ WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
+ if (busIdStringLength)
+ WriteToClient(client, busIdStringLength, busIdString);
free(busIdString);
EPHYR_LOG("leave\n");
return Success;
@@ -639,16 +644,18 @@ ProcXF86DRIAuthConnection(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.authenticated = 1;
+ rep = (xXF86DRIAuthConnectionReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .authenticated = 1
+ };
if (!ephyrDRIAuthConnection(stuff->screen, stuff->magic)) {
ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
rep.authenticated = 0;
}
- WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), &rep);
EPHYR_LOG("leave\n");
return Success;
}
@@ -675,7 +682,11 @@ ProcXF86DRICloseConnection(register ClientPtr client)
static int
ProcXF86DRIGetClientDriverName(register ClientPtr client)
{
- xXF86DRIGetClientDriverNameReply rep;
+ xXF86DRIGetClientDriverNameReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .clientDriverNameLength = 0
+ };
char *clientDriverName;
REQUEST(xXF86DRIGetClientDriverNameReq);
@@ -692,18 +703,13 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
(int *) &rep.ddxDriverMinorVersion,
(int *) &rep.ddxDriverPatchVersion,
&clientDriverName);
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.clientDriverNameLength = 0;
if (clientDriverName)
rep.clientDriverNameLength = strlen(clientDriverName);
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) -
SIZEOF(xGenericReply) +
pad_to_int32(rep.clientDriverNameLength));
- WriteToClient(client,
- sizeof(xXF86DRIGetClientDriverNameReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRIGetClientDriverNameReply), &rep);
if (rep.clientDriverNameLength)
WriteToClient(client, rep.clientDriverNameLength, clientDriverName);
EPHYR_LOG("leave\n");
@@ -713,7 +719,11 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
static int
ProcXF86DRICreateContext(register ClientPtr client)
{
- xXF86DRICreateContextReply rep;
+ xXF86DRICreateContextReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
ScreenPtr pScreen;
VisualPtr visual;
int i = 0;
@@ -728,10 +738,6 @@ ProcXF86DRICreateContext(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
pScreen = screenInfo.screens[stuff->screen];
visual = pScreen->visuals;
@@ -752,7 +758,7 @@ ProcXF86DRICreateContext(register ClientPtr client)
return BadValue;
}
- WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRICreateContextReply), &rep);
EPHYR_LOG("leave\n");
return Success;
}
@@ -916,7 +922,11 @@ destroyHostPeerWindow(const WindowPtr a_win)
static int
ProcXF86DRICreateDrawable(ClientPtr client)
{
- xXF86DRICreateDrawableReply rep;
+ xXF86DRICreateDrawableReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
DrawablePtr drawable = NULL;
WindowPtr window = NULL;
EphyrWindowPair *pair = NULL;
@@ -932,10 +942,6 @@ ProcXF86DRICreateDrawable(ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success)
@@ -974,7 +980,7 @@ ProcXF86DRICreateDrawable(ClientPtr client)
EPHYR_LOG("paired window '%p' with remote '%d'\n", window, remote_win);
}
- WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), &rep);
EPHYR_LOG("leave\n");
return Success;
}
@@ -1024,7 +1030,11 @@ ProcXF86DRIDestroyDrawable(register ClientPtr client)
static int
ProcXF86DRIGetDrawableInfo(register ClientPtr client)
{
- xXF86DRIGetDrawableInfoReply rep;
+ xXF86DRIGetDrawableInfoReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
DrawablePtr drawable;
WindowPtr window = NULL;
EphyrWindowPair *pair = NULL;
@@ -1036,16 +1046,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
EPHYR_LOG("enter\n");
- memset(&rep, 0, sizeof(rep));
if (stuff->screen >= screenInfo.numScreens) {
client->errorValue = stuff->screen;
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success || !drawable) {
@@ -1136,18 +1141,18 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
rep.length = bytes_to_int32(rep.length);
- WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), &rep);
if (rep.numClipRects) {
WriteToClient(client,
sizeof(drm_clip_rect_t) * rep.numClipRects,
- (char *) clipRects);
+ clipRects);
}
if (rep.numBackClipRects) {
WriteToClient(client,
sizeof(drm_clip_rect_t) * rep.numBackClipRects,
- (char *) backClipRects);
+ backClipRects);
}
free(clipRects);
clipRects = NULL;
@@ -1160,7 +1165,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
static int
ProcXF86DRIGetDeviceInfo(register ClientPtr client)
{
- xXF86DRIGetDeviceInfoReply rep;
+ xXF86DRIGetDeviceInfoReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
drm_handle_t hFrameBuffer;
void *pDevPrivate;
@@ -1173,10 +1182,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
if (!ephyrDRIGetDeviceInfo(stuff->screen,
&hFrameBuffer,
(int *) &rep.framebufferOrigin,
@@ -1193,16 +1198,15 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
rep.hFrameBufferHigh = 0;
#endif
- rep.length = 0;
if (rep.devPrivateSize) {
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
SIZEOF(xGenericReply) +
pad_to_int32(rep.devPrivateSize));
}
- WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), &rep);
if (rep.length) {
- WriteToClient(client, rep.devPrivateSize, (char *) pDevPrivate);
+ WriteToClient(client, rep.devPrivateSize, pDevPrivate);
}
EPHYR_LOG("leave\n");
return Success;