From 31b110cf286e5aac6565792dcd362411833acef3 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 10 Sep 2025 12:33:03 +0200 Subject: [PATCH] xfree86: dri: ProcXF86DRIGetDeviceInfo() use x_rpcbuf_t Use x_rpcbuf_t for reply payload assembly and X_SEND_REPLY_WITH_RPCBUF() for sending it all out. Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xfree86/dri/xf86dri.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c index 077e3df80a..d7937aabb4 100644 --- a/hw/xfree86/dri/xf86dri.c +++ b/hw/xfree86/dri/xf86dri.c @@ -421,11 +421,6 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client) static int ProcXF86DRIGetDeviceInfo(register ClientPtr client) { - xXF86DRIGetDeviceInfoReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0 - }; drm_handle_t hFrameBuffer; void *pDevPrivate; @@ -436,6 +431,8 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client) return BadValue; } + xXF86DRIGetDeviceInfoReply rep = { 0 }; + if (!DRIGetDeviceInfo(screenInfo.screens[stuff->screen], &hFrameBuffer, (int *) &rep.framebufferOrigin, @@ -452,16 +449,10 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client) rep.hFrameBufferHigh = 0; #endif - if (rep.devPrivateSize) { - rep.length = X_REPLY_HEADER_UNITS(xXF86DRIGetDeviceInfoReply) - + bytes_to_int32(rep.devPrivateSize); - } + x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE }; + x_rpcbuf_write_CARD8s(&rpcbuf, pDevPrivate, rep.devPrivateSize); - WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), &rep); - if (rep.length) { - WriteToClient(client, rep.devPrivateSize, pDevPrivate); - } - return Success; + return X_SEND_REPLY_WITH_RPCBUF(client, rep, rpcbuf); } static int