From 095ea152b43f996e49f62a0520cdabe43168d56d Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 3 Dec 2025 18:56:01 +0100 Subject: [PATCH] xfree86: dri2: use rpcbuf and sender macros Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xfree86/dri2/dri2ext.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index fe424df3fb..d19211be92 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -209,14 +209,12 @@ send_buffers_reply(ClientPtr client, DrawablePtr pDrawable, } xDRI2GetBuffersReply reply = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = (count - skip) * sizeof(xDRI2Buffer) / 4, .width = width, .height = height, .count = count - skip }; - WriteToClient(client, sizeof(xDRI2GetBuffersReply), &reply); + + x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE }; for (i = 0; i < count; i++) { xDRI2Buffer buffer; @@ -233,9 +231,11 @@ send_buffers_reply(ClientPtr client, DrawablePtr pDrawable, buffer.pitch = buffers[i]->pitch; buffer.cpp = buffers[i]->cpp; buffer.flags = buffers[i]->flags; - WriteToClient(client, sizeof(xDRI2Buffer), &buffer); + + x_rpcbuf_write_binary_pad(&rpcbuf, &buffer, sizeof(xDRI2Buffer)); } - return Success; + + return X_SEND_REPLY_WITH_RPCBUF(client, reply, rpcbuf); } static int @@ -458,17 +458,11 @@ ProcDRI2WaitMSC(ClientPtr client) int ProcDRI2WaitMSCReply(ClientPtr client, CARD64 ust, CARD64 msc, CARD64 sbc) { - xDRI2MSCReply reply = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0 - }; + xDRI2MSCReply reply = { 0 }; load_msc_reply(&reply, ust, msc, sbc); - WriteToClient(client, sizeof(xDRI2MSCReply), &reply); - - return Success; + return X_SEND_REPLY_SIMPLE(client, reply); } static int @@ -515,11 +509,6 @@ static int ProcDRI2GetParam(ClientPtr client) { REQUEST(xDRI2GetParamReq); - xDRI2GetParamReply reply = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0 - }; DrawablePtr pDrawable; CARD64 value; int status; @@ -530,6 +519,8 @@ ProcDRI2GetParam(ClientPtr client) &pDrawable, &status)) return status; + xDRI2GetParamReply reply = { 0 }; + status = DRI2GetParam(client, pDrawable, stuff->param, &reply.is_param_recognized, &value); reply.value_hi = value >> 32; @@ -538,9 +529,7 @@ ProcDRI2GetParam(ClientPtr client) if (status != Success) return status; - WriteToClient(client, sizeof(xDRI2GetParamReply), &reply); - - return status; + return X_SEND_REPLY_SIMPLE(client, reply); } static int