[PATCH xserver V2] use xcb struct in render

Jaya Tiwari tiwari.jaya18 at gmail.com
Mon Jan 12 09:52:38 PST 2015


Replacing manually written proto headers for render extension with xcb
generated structs
Have changed simple requests without list/switch and replies

Signed-off-by: Jaya Tiwari <tiwari.jaya18 at gmail.com>
---
 render/render.c | 153 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 77 insertions(+), 76 deletions(-)

diff --git a/render/render.c b/render/render.c
index 723f380..65f51d3 100644
--- a/render/render.c
+++ b/render/render.c
@@ -41,6 +41,7 @@
 #include "servermd.h"
 #include <X11/extensions/render.h>
 #include <X11/extensions/renderproto.h>
+#include <xcb/render.h>
 #include "picturestr.h"
 #include "glyphstr.h"
 #include <X11/Xfuncproto.h>
@@ -654,9 +655,9 @@ ProcRenderFreePicture(ClientPtr client)
 {
     PicturePtr pPicture;
 
-    REQUEST(xRenderFreePictureReq);
+    REQUEST(xcb_render_free_picture_request_t);
 
-    REQUEST_SIZE_MATCH(xRenderFreePictureReq);
+    REQUEST_SIZE_MATCH(xcb_render_free_picture_request_t);
 
     VERIFY_PICTURE(pPicture, stuff->picture, client, DixDestroyAccess);
     FreeResource(stuff->picture, RT_NONE);
@@ -682,9 +683,9 @@ ProcRenderComposite(ClientPtr client)
 {
     PicturePtr pSrc, pMask, pDst;
 
-    REQUEST(xRenderCompositeReq);
+    REQUEST(xcb_render_composite_request_t);
 
-    REQUEST_SIZE_MATCH(xRenderCompositeReq);
+    REQUEST_SIZE_MATCH(xcb_render_composite_request_t);
     if (!PictOpValid(stuff->op)) {
         client->errorValue = stuff->op;
         return BadValue;
@@ -709,11 +710,11 @@ ProcRenderComposite(ClientPtr client)
                      pSrc,
                      pMask,
                      pDst,
-                     stuff->xSrc,
-                     stuff->ySrc,
-                     stuff->xMask,
-                     stuff->yMask,
-                     stuff->xDst, stuff->yDst, stuff->width, stuff->height);
+                     stuff->src_x,
+                     stuff->src_y,
+                     stuff->mask_x,
+                     stuff->mask_y,
+                     stuff->dst_x, stuff->dst_y, stuff->width, stuff->height);
     return Success;
 }
 
@@ -904,9 +905,9 @@ ProcRenderCreateGlyphSet(ClientPtr client)
     PictFormatPtr format;
     int rc, f;
 
-    REQUEST(xRenderCreateGlyphSetReq);
+    REQUEST(xcb_render_create_glyph_set_request_t);
 
-    REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq);
+    REQUEST_SIZE_MATCH(xcb_render_create_glyph_set_request_t);
 
     LEGAL_NEW_RESOURCE(stuff->gsid, client);
     rc = dixLookupResourceByType((void **) &format, stuff->format,
@@ -954,9 +955,9 @@ ProcRenderReferenceGlyphSet(ClientPtr client)
     GlyphSetPtr glyphSet;
     int rc;
 
-    REQUEST(xRenderReferenceGlyphSetReq);
+    REQUEST(xcb_render_reference_glyph_set_request_t);
 
-    REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq);
+    REQUEST_SIZE_MATCH(xcb_render_reference_glyph_set_request_t);
 
     LEGAL_NEW_RESOURCE(stuff->gsid, client);
 
@@ -981,9 +982,9 @@ ProcRenderFreeGlyphSet(ClientPtr client)
     GlyphSetPtr glyphSet;
     int rc;
 
-    REQUEST(xRenderFreeGlyphSetReq);
+    REQUEST(xcb_render_free_glyph_set_request_t);
 
-    REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
+    REQUEST_SIZE_MATCH(xcb_render_free_glyph_set_request_t);
     rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
                                  GlyphSetType, client, DixDestroyAccess);
     if (rc != Success) {
@@ -1459,7 +1460,7 @@ static CARD32 orderedDither[DITHER_DIM][DITHER_DIM] = {
 static int
 ProcRenderCreateCursor(ClientPtr client)
 {
-    REQUEST(xRenderCreateCursorReq);
+    REQUEST(xcb_render_create_cursor_request_t);
     PicturePtr pSrc;
     ScreenPtr pScreen;
     unsigned short width, height;
@@ -1474,10 +1475,10 @@ ProcRenderCreateCursor(ClientPtr client)
     CARD32 twocolor[3];
     int rc, ncolor;
 
-    REQUEST_SIZE_MATCH(xRenderCreateCursorReq);
+    REQUEST_SIZE_MATCH(xcb_render_create_cursor_request_t);
     LEGAL_NEW_RESOURCE(stuff->cid, client);
 
-    VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_PICTURE(pSrc, stuff->source, client, DixReadAccess);
     if (!pSrc->pDrawable)
         return BadDrawable;
     pScreen = pSrc->pDrawable->pScreen;
@@ -1648,10 +1649,10 @@ ProcRenderCreateCursor(ClientPtr client)
 static int
 ProcRenderSetPictureTransform(ClientPtr client)
 {
-    REQUEST(xRenderSetPictureTransformReq);
+    REQUEST(xcb_render_set_picture_transform_request_t);
     PicturePtr pPicture;
 
-    REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
+    REQUEST_SIZE_MATCH(xcb_render_set_picture_transform_request_t);
     VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
     return SetPictureTransform(pPicture, (PictTransform *) &stuff->transform);
 }
@@ -1847,21 +1848,21 @@ ProcRenderCreateSolidFill(ClientPtr client)
     PicturePtr pPicture;
     int error = 0;
 
-    REQUEST(xRenderCreateSolidFillReq);
+    REQUEST(xcb_render_create_solid_fill_request_t);
 
-    REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
+    REQUEST_AT_LEAST_SIZE(xcb_render_create_solid_fill_request_t);
 
-    LEGAL_NEW_RESOURCE(stuff->pid, client);
+    LEGAL_NEW_RESOURCE(stuff->picture, client);
 
-    pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error);
+    pPicture = CreateSolidPicture(stuff->picture, &stuff->color, &error);
     if (!pPicture)
         return error;
     /* security creation/labeling check */
-    error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
+    error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->picture, PictureType,
                      pPicture, RT_NONE, NULL, DixCreateAccess);
     if (error != Success)
         return error;
-    if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
+    if (!AddResource(stuff->picture, PictureType, (void *) pPicture))
         return BadAlloc;
     return Success;
 }
@@ -2069,31 +2070,31 @@ SProcRenderSetPictureClipRectangles(ClientPtr client)
 static int
 SProcRenderFreePicture(ClientPtr client)
 {
-    REQUEST(xRenderFreePictureReq);
-    REQUEST_SIZE_MATCH(xRenderFreePictureReq);
+    REQUEST(xcb_render_free_picture_request_t);
+    REQUEST_AT_LEAST_SIZE(xcb_render_free_picture_request_t);
     swaps(&stuff->length);
     swapl(&stuff->picture);
-    return (*ProcRenderVector[stuff->renderReqType]) (client);
+    return (*ProcRenderVector[stuff->minor_opcode]) (client);
 }
 
 static int
 SProcRenderComposite(ClientPtr client)
 {
-    REQUEST(xRenderCompositeReq);
-    REQUEST_SIZE_MATCH(xRenderCompositeReq);
+    REQUEST(xcb_render_composite_request_t);
+    REQUEST_SIZE_MATCH(xcb_render_composite_request_t);
     swaps(&stuff->length);
     swapl(&stuff->src);
     swapl(&stuff->mask);
     swapl(&stuff->dst);
-    swaps(&stuff->xSrc);
-    swaps(&stuff->ySrc);
-    swaps(&stuff->xMask);
-    swaps(&stuff->yMask);
-    swaps(&stuff->xDst);
-    swaps(&stuff->yDst);
+    swaps(&stuff->src_x);
+    swaps(&stuff->src_y);
+    swaps(&stuff->mask_x);
+    swaps(&stuff->mask_y);
+    swaps(&stuff->dst_x);
+    swaps(&stuff->dst_y);
     swaps(&stuff->width);
     swaps(&stuff->height);
-    return (*ProcRenderVector[stuff->renderReqType]) (client);
+    return (*ProcRenderVector[stuff->minor_opcode]) (client);
 }
 
 static int
@@ -2200,33 +2201,33 @@ SProcRenderTransform(ClientPtr client)
 static int
 SProcRenderCreateGlyphSet(ClientPtr client)
 {
-    REQUEST(xRenderCreateGlyphSetReq);
-    REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq);
+    REQUEST(xcb_render_create_glyph_set_request_t);
+    REQUEST_AT_LEAST_SIZE(xcb_render_create_glyph_set_request_t);
     swaps(&stuff->length);
     swapl(&stuff->gsid);
     swapl(&stuff->format);
-    return (*ProcRenderVector[stuff->renderReqType]) (client);
+    return (*ProcRenderVector[stuff->minor_opcode]) (client);
 }
 
 static int
 SProcRenderReferenceGlyphSet(ClientPtr client)
 {
-    REQUEST(xRenderReferenceGlyphSetReq);
-    REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq);
+    REQUEST(xcb_render_reference_glyph_set_request_t);
+    REQUEST_AT_LEAST_SIZE(xcb_render_reference_glyph_set_request_t);
     swaps(&stuff->length);
     swapl(&stuff->gsid);
     swapl(&stuff->existing);
-    return (*ProcRenderVector[stuff->renderReqType]) (client);
+    return (*ProcRenderVector[stuff->minor_opcode]) (client);
 }
 
 static int
 SProcRenderFreeGlyphSet(ClientPtr client)
 {
-    REQUEST(xRenderFreeGlyphSetReq);
-    REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
+    REQUEST(xcb_render_free_glyph_set_request_t);
+    REQUEST_AT_LEAST_SIZE(xcb_render_free_glyph_set_request_t);
     swaps(&stuff->length);
     swapl(&stuff->glyphset);
-    return (*ProcRenderVector[stuff->renderReqType]) (client);
+    return (*ProcRenderVector[stuff->minor_opcode]) (client);
 }
 
 static int
@@ -2371,22 +2372,22 @@ SProcRenderFillRectangles(ClientPtr client)
 static int
 SProcRenderCreateCursor(ClientPtr client)
 {
-    REQUEST(xRenderCreateCursorReq);
-    REQUEST_SIZE_MATCH(xRenderCreateCursorReq);
+    REQUEST(xcb_render_create_cursor_request_t);
+    REQUEST_SIZE_MATCH(xcb_render_create_cursor_request_t);
 
     swaps(&stuff->length);
     swapl(&stuff->cid);
-    swapl(&stuff->src);
+    swapl(&stuff->source);
     swaps(&stuff->x);
     swaps(&stuff->y);
-    return (*ProcRenderVector[stuff->renderReqType]) (client);
+    return (*ProcRenderVector[stuff->minor_opcode]) (client);
 }
 
 static int
 SProcRenderSetPictureTransform(ClientPtr client)
 {
-    REQUEST(xRenderSetPictureTransformReq);
-    REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
+    REQUEST(xcb_render_set_picture_transform_request_t);
+    REQUEST_SIZE_MATCH(xcb_render_set_picture_transform_request_t);
 
     swaps(&stuff->length);
     swapl(&stuff->picture);
@@ -2399,7 +2400,7 @@ SProcRenderSetPictureTransform(ClientPtr client)
     swapl(&stuff->transform.matrix31);
     swapl(&stuff->transform.matrix32);
     swapl(&stuff->transform.matrix33);
-    return (*ProcRenderVector[stuff->renderReqType]) (client);
+    return (*ProcRenderVector[stuff->minor_opcode]) (client);
 }
 
 static int
@@ -2454,16 +2455,16 @@ SProcRenderAddTraps(ClientPtr client)
 static int
 SProcRenderCreateSolidFill(ClientPtr client)
 {
-    REQUEST(xRenderCreateSolidFillReq);
-    REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
+    REQUEST(xcb_render_create_solid_fill_request_t);
+    REQUEST_AT_LEAST_SIZE(xcb_render_create_solid_fill_request_t);
 
     swaps(&stuff->length);
-    swapl(&stuff->pid);
+    swapl(&stuff->picture);
     swaps(&stuff->color.alpha);
     swaps(&stuff->color.red);
     swaps(&stuff->color.green);
     swaps(&stuff->color.blue);
-    return (*ProcRenderVector[stuff->renderReqType]) (client);
+    return (*ProcRenderVector[stuff->minor_opcode]) (client);
 }
 
 static void
@@ -2684,11 +2685,11 @@ PanoramiXRenderSetPictureClipRectangles(ClientPtr client)
 static int
 PanoramiXRenderSetPictureTransform(ClientPtr client)
 {
-    REQUEST(xRenderSetPictureTransformReq);
+    REQUEST(xcb_render_set_picture_transform_request_t);
     int result = Success, j;
     PanoramiXRes *pict;
 
-    REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq);
+    REQUEST_AT_LEAST_SIZE(xcb_render_set_picture_transform_request_t);
 
     VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
 
@@ -2731,9 +2732,9 @@ PanoramiXRenderFreePicture(ClientPtr client)
     PanoramiXRes *pict;
     int result = Success, j;
 
-    REQUEST(xRenderFreePictureReq);
+    REQUEST(xcb_render_free_picture_request_t);
 
-    REQUEST_SIZE_MATCH(xRenderFreePictureReq);
+    REQUEST_SIZE_MATCH(xcb_render_free_picture_request_t);
 
     client->errorValue = stuff->picture;
 
@@ -2757,11 +2758,11 @@ PanoramiXRenderComposite(ClientPtr client)
 {
     PanoramiXRes *src, *msk, *dst;
     int result = Success, j;
-    xRenderCompositeReq orig;
+    xcb_render_composite_request_t orig;
 
-    REQUEST(xRenderCompositeReq);
+    REQUEST(xcb_render_composite_request_t);
 
-    REQUEST_SIZE_MATCH(xRenderCompositeReq);
+    REQUEST_SIZE_MATCH(xcb_render_composite_request_t);
 
     VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
     VERIFY_XIN_ALPHA(msk, stuff->mask, client, DixReadAccess);
@@ -2772,19 +2773,19 @@ PanoramiXRenderComposite(ClientPtr client)
     FOR_NSCREENS_FORWARD(j) {
         stuff->src = src->info[j].id;
         if (src->u.pict.root) {
-            stuff->xSrc = orig.xSrc - screenInfo.screens[j]->x;
-            stuff->ySrc = orig.ySrc - screenInfo.screens[j]->y;
+            stuff->src_x = orig.src_x - screenInfo.screens[j]->x;
+            stuff->src_y = orig.src_y - screenInfo.screens[j]->y;
         }
         stuff->dst = dst->info[j].id;
         if (dst->u.pict.root) {
-            stuff->xDst = orig.xDst - screenInfo.screens[j]->x;
-            stuff->yDst = orig.yDst - screenInfo.screens[j]->y;
+            stuff->dst_x = orig.dst_x - screenInfo.screens[j]->x;
+            stuff->dst_y = orig.dst_y - screenInfo.screens[j]->y;
         }
         if (msk) {
             stuff->mask = msk->info[j].id;
             if (msk->u.pict.root) {
-                stuff->xMask = orig.xMask - screenInfo.screens[j]->x;
-                stuff->yMask = orig.yMask - screenInfo.screens[j]->y;
+                stuff->mask_x = orig.mask_x - screenInfo.screens[j]->x;
+                stuff->mask_y = orig.mask_y - screenInfo.screens[j]->y;
             }
         }
         result = (*PanoramiXSaveRenderVector[X_RenderComposite]) (client);
@@ -3145,21 +3146,21 @@ PanoramiXRenderAddTraps(ClientPtr client)
 static int
 PanoramiXRenderCreateSolidFill(ClientPtr client)
 {
-    REQUEST(xRenderCreateSolidFillReq);
+    REQUEST(xcb_render_create_solid_fill_request_t);
     PanoramiXRes *newPict;
     int result = Success, j;
 
-    REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
+    REQUEST_AT_LEAST_SIZE(xcb_render_create_solid_fill_request_t);
 
     if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
         return BadAlloc;
 
     newPict->type = XRT_PICTURE;
-    panoramix_setup_ids(newPict, client, stuff->pid);
+    panoramix_setup_ids(newPict, client, stuff->picture);
     newPict->u.pict.root = FALSE;
 
     FOR_NSCREENS_BACKWARD(j) {
-        stuff->pid = newPict->info[j].id;
+        stuff->picture = newPict->info[j].id;
         result = (*PanoramiXSaveRenderVector[X_RenderCreateSolidFill]) (client);
         if (result != Success)
             break;
-- 
2.1.3



More information about the xorg-devel mailing list