Xext: xvmc: 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:
Enrico Weigelt, metux IT consult 2024-07-12 18:33:50 +02:00
parent 9ab956a7ef
commit 18331c6d19

View File

@ -113,14 +113,13 @@ ProcXvMCQueryVersion(ClientPtr client)
REQUEST_HEAD_STRUCT(xvmcQueryVersionReq); REQUEST_HEAD_STRUCT(xvmcQueryVersionReq);
xvmcQueryVersionReply rep = { xvmcQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.major = SERVER_XVMC_MAJOR_VERSION, .major = SERVER_XVMC_MAJOR_VERSION,
.minor = SERVER_XVMC_MINOR_VERSION .minor = SERVER_XVMC_MINOR_VERSION
}; };
WriteToClient(client, sizeof(xvmcQueryVersionReply), &rep); REPLY_FIELD_CARD32(major);
return Success; REPLY_FIELD_CARD32(minor);
REPLY_SEND_RET_SUCCESS();
} }
static int static int
@ -163,19 +162,18 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
info[i].subpicture_max_height = surface->subpicture_max_height; info[i].subpicture_max_height = surface->subpicture_max_height;
info[i].mc_type = surface->mc_type; info[i].mc_type = surface->mc_type;
info[i].flags = surface->flags; info[i].flags = surface->flags;
CLIENT_STRUCT_CARD16_5(&info[i], chroma_format, max_width, max_height,
subpicture_max_width, subpicture_max_height);
CLIENT_STRUCT_CARD32_3(&info[i], surface_type_id, mc_type, flags);
} }
xvmcListSurfaceTypesReply rep = { xvmcListSurfaceTypesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num = num_surfaces, .num = num_surfaces,
.length = bytes_to_int32(sizeof(xvmcSurfaceInfo) * num_surfaces),
}; };
WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep); REPLY_FIELD_CARD32(num);
WriteToClient(client, sizeof(xvmcSurfaceInfo) * num_surfaces, info); REPLY_SEND_EXTRA(info, sizeof(xvmcSurfaceInfo) * num_surfaces);
free(info);
return Success; return Success;
} }
@ -259,20 +257,18 @@ ProcXvMCCreateContext(ClientPtr client)
} }
xvmcCreateContextReply rep = { xvmcCreateContextReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords,
.width_actual = pContext->width, .width_actual = pContext->width,
.height_actual = pContext->height, .height_actual = pContext->height,
.flags_return = pContext->flags .flags_return = pContext->flags
}; };
WriteToClient(client, sizeof(xvmcCreateContextReply), &rep); REPLY_FIELD_CARD16(width_actual);
if (dwords) REPLY_FIELD_CARD16(height_actual);
WriteToClient(client, dwords << 2, data); REPLY_FIELD_CARD32(flags_return);
REPLY_BUF_CARD32(data, dwords);
REPLY_SEND_EXTRA(data, dwords * sizeof(CARD32));
free(data); free(data);
return Success; return Success;
} }
@ -337,15 +333,10 @@ ProcXvMCCreateSurface(ClientPtr client)
return BadAlloc; return BadAlloc;
} }
xvmcCreateSurfaceReply rep = { xvmcCreateSurfaceReply rep = { 0 };
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords
};
WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep); REPLY_BUF_CARD32(data, dwords);
if (dwords) REPLY_SEND_EXTRA(data, dwords * sizeof(CARD32));
WriteToClient(client, dwords << 2, data);
free(data); free(data);
@ -461,9 +452,6 @@ ProcXvMCCreateSubpicture(ClientPtr client)
} }
xvmcCreateSubpictureReply rep = { xvmcCreateSubpictureReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords,
.width_actual = pSubpicture->width, .width_actual = pSubpicture->width,
.height_actual = pSubpicture->height, .height_actual = pSubpicture->height,
.num_palette_entries = pSubpicture->num_palette_entries, .num_palette_entries = pSubpicture->num_palette_entries,
@ -474,9 +462,12 @@ ProcXvMCCreateSubpicture(ClientPtr client)
.component_order[3] = pSubpicture->component_order[3] .component_order[3] = pSubpicture->component_order[3]
}; };
WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep); REPLY_FIELD_CARD16(width_actual);
if (dwords) REPLY_FIELD_CARD16(height_actual);
WriteToClient(client, dwords << 2, data); REPLY_FIELD_CARD16(num_palette_entries);
REPLY_FIELD_CARD16(entry_bytes);
REPLY_BUF_CARD32(data, dwords);
REPLY_SEND_EXTRA(data, dwords * sizeof(CARD32));
free(data); free(data);
@ -587,18 +578,17 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
info[i].vert_v_period = pImage->vert_v_period; info[i].vert_v_period = pImage->vert_v_period;
memcpy(&info[i].comp_order, pImage->component_order, 32); memcpy(&info[i].comp_order, pImage->component_order, 32);
info[i].scanline_order = pImage->scanline_order; info[i].scanline_order = pImage->scanline_order;
CLIENT_STRUCT_CARD32_5(&info[i], id, red_mask, green_mask, blue_mask, y_sample_bits);
CLIENT_STRUCT_CARD32_5(&info[i], u_sample_bits, v_sample_bits, horz_y_period, horz_u_period, horz_v_period);
CLIENT_STRUCT_CARD32_3(&info[i], vert_y_period, vert_u_period, vert_v_period);
} }
xvmcListSubpictureTypesReply rep = { xvmcListSubpictureTypesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num = num, .num = num,
.length = bytes_to_int32(sizeof(info)),
}; };
WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep); REPLY_SEND_EXTRA(info, sizeof(info));
WriteToClient(client, sizeof(info), info);
return Success; return Success;
} }
@ -633,14 +623,11 @@ ProcXvMCGetDRInfo(ClientPtr client)
memcpy(buf+nameLen, pScreenPriv->busID, busIDLen); memcpy(buf+nameLen, pScreenPriv->busID, busIDLen);
xvmcGetDRInfoReply rep = { xvmcGetDRInfoReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.major = pScreenPriv->major, .major = pScreenPriv->major,
.minor = pScreenPriv->minor, .minor = pScreenPriv->minor,
.patchLevel = pScreenPriv->patchLevel, .patchLevel = pScreenPriv->patchLevel,
.nameLen = nameLen, .nameLen = nameLen,
.busIDLen = busIDLen, .busIDLen = busIDLen,
.length = bytes_to_int32(sizeof(buf)),
.isLocal = 1 .isLocal = 1
}; };
@ -670,8 +657,13 @@ ProcXvMCGetDRInfo(ClientPtr client)
} }
#endif /* HAS_XVMCSHM */ #endif /* HAS_XVMCSHM */
WriteToClient(client, sizeof(xvmcGetDRInfoReply), &rep); REPLY_FIELD_CARD32(major);
WriteToClient(client, sizeof(buf), buf); REPLY_FIELD_CARD32(minor);
REPLY_FIELD_CARD32(patchLevel);
REPLY_FIELD_CARD32(nameLen);
REPLY_FIELD_CARD32(busIDLen);
REPLY_FIELD_CARD32(isLocal);
REPLY_SEND_EXTRA(buf, sizeof(buf));
return Success; return Success;
} }