summaryrefslogtreecommitdiff
path: root/src/cairo-xcb-connection-render.c
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2010-12-04 16:36:28 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-12-25 09:50:34 +0000
commit109fcb39502239ff87c70cc99f2baea6e46b36a5 (patch)
tree1763e250a56c4ed126b4be27ff65c81c43568be8 /src/cairo-xcb-connection-render.c
parentcf0a4ed862d93b7e6d7d26942cfe98a50beccd4c (diff)
downloadcairo-109fcb39502239ff87c70cc99f2baea6e46b36a5.tar.gz
XCB: Stop taking the xcb socket
This makes the xcb backend use the auto-generated xcb API instead of hand-writing each request. This should also improve parallelism with non-cairo threads that use the same xcb connection. Big thanks to Andrea Canciani for taking a look at this and finding lots of good improvements (especially finding xcb_send_request was great). cairo-perf-trace and cairo-perf-diff-files between master (6732dbf2992891be4b1f08b14a5c449fd08b637c) and this change: $ ./cairo-perf-diff-files ../master_perf ../xcb_no_socket_perf old: master_perf new: xcb_no_socket_perf Speedups ======== xcb-rgba evolution-0 23558.86 (23558.86 0.00%) -> 19338.78 (19338.78 0.00%): 1.22x speedup ▎ xcb-rgba poppler-bug-12266-0 98.43 (98.43 0.00%) -> 82.36 (82.36 0.00%): 1.20x speedup ▎ xcb-rgba gnome-terminal-vim-0 5518.08 (5518.08 0.00%) -> 4905.92 (4905.92 0.00%): 1.12x speedup ▏ xcb-rgba gnome-terminal-20090601-0 45648.46 (45648.46 0.00%) -> 41231.25 (41231.25 0.00%): 1.11x speedup ▏ xcb-rgba evolution-20090607-0 71643.69 (71643.69 0.00%) -> 66314.95 (66314.95 0.00%): 1.08x speedup ▏ xcb-rgba poppler-0 3501.69 (3501.69 0.00%) -> 3322.26 (3322.26 0.00%): 1.05x speedup Slowdowns ========= xcb-rgba gnome-system-monitor-0 7500.01 (7500.01 0.00%) -> 7923.70 (7923.70 0.00%): 1.06x slowdown xcb-rgba swfdec-youtube-full-0 26409.89 (26409.89 0.00%) -> 28430.76 (28430.76 0.00%): 1.08x slowdown ▏ xcb-rgba gnome-system-monitor-20090821-0 34801.61 (34801.61 0.00%) -> 37891.14 (37891.14 0.00%): 1.09x slowdown Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src/cairo-xcb-connection-render.c')
-rw-r--r--src/cairo-xcb-connection-render.c716
1 files changed, 41 insertions, 675 deletions
diff --git a/src/cairo-xcb-connection-render.c b/src/cairo-xcb-connection-render.c
index 63eb59df5..b44e3631f 100644
--- a/src/cairo-xcb-connection-render.c
+++ b/src/cairo-xcb-connection-render.c
@@ -35,9 +35,6 @@
#include <xcb/xcbext.h>
-#define X_RenderSpans 99
-#define XLIB_COORD_MAX 32767
-
void
_cairo_xcb_connection_render_create_picture (cairo_xcb_connection_t *connection,
xcb_render_picture_t picture,
@@ -46,34 +43,8 @@ _cairo_xcb_connection_render_create_picture (cairo_xcb_connection_t *connection
uint32_t value_mask,
uint32_t *value_list)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t picture;
- uint32_t drawable;
- uint32_t format;
- uint32_t mask;
- } req;
- struct iovec vec[2];
- int len = _cairo_popcount (value_mask) * 4;
-
- COMPILE_TIME_ASSERT (sizeof (req) == 20);
-
- req.major = connection->render->major_opcode;
- req.minor = 4;
- req.length = (sizeof (req) + len) >> 2;
- req.picture = picture;
- req.drawable = drawable;
- req.format = format;
- req.mask = value_mask;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
- vec[1].iov_base = value_list;
- vec[1].iov_len = len;
-
- _cairo_xcb_connection_write (connection, vec, 1 + (len != 0));
+ xcb_render_create_picture (connection->xcb_connection, picture, drawable,
+ format, value_mask, value_list);
}
void
@@ -82,30 +53,8 @@ _cairo_xcb_connection_render_change_picture (cairo_xcb_connection_t *connect
uint32_t value_mask,
uint32_t *value_list)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t picture;
- uint32_t mask;
- } req;
- struct iovec vec[2];
- int len = _cairo_popcount (value_mask) * 4;
-
- COMPILE_TIME_ASSERT (sizeof (req) == 12);
-
- req.major = connection->render->major_opcode;
- req.minor = 5;
- req.length = (sizeof (req) + len) >> 2;
- req.picture = picture;
- req.mask = value_mask;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
- vec[1].iov_base = value_list;
- vec[1].iov_len = len;
-
- _cairo_xcb_connection_write (connection, vec, 2);
+ xcb_render_change_picture (connection->xcb_connection, picture,
+ value_mask, value_list);
}
void
@@ -116,58 +65,16 @@ _cairo_xcb_connection_render_set_picture_clip_rectangles (cairo_xcb_connection_t
uint32_t rectangles_len,
xcb_rectangle_t *rectangles)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t picture;
- uint16_t x;
- uint16_t y;
- } req;
- struct iovec vec[2];
- int len = sizeof (xcb_rectangle_t) * rectangles_len;
-
- COMPILE_TIME_ASSERT (sizeof (req) == 12);
- assert ((len + sizeof (req)) >> 2 < connection->root->maximum_request_length);
-
- req.major = connection->render->major_opcode;
- req.minor = 6;
- req.length = (sizeof (req) + len) >> 2;
- req.picture = picture;
- req.x = clip_x_origin;
- req.y = clip_y_origin;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
- vec[1].iov_base = rectangles;
- vec[1].iov_len = len;
-
- _cairo_xcb_connection_write (connection, vec, 2);
+ xcb_render_set_picture_clip_rectangles (connection->xcb_connection, picture,
+ clip_x_origin, clip_y_origin,
+ rectangles_len, rectangles);
}
void
_cairo_xcb_connection_render_free_picture (cairo_xcb_connection_t *connection,
xcb_render_picture_t picture)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t picture;
- } req;
- struct iovec vec[1];
-
- COMPILE_TIME_ASSERT (sizeof (req) == 8);
-
- req.major = connection->render->major_opcode;
- req.minor = 7;
- req.length = sizeof (req) >> 2;
- req.picture = picture;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
-
- _cairo_xcb_connection_write (connection, vec, 1);
+ xcb_render_free_picture (connection->xcb_connection, picture);
_cairo_xcb_connection_put_xid (connection, picture);
}
@@ -186,49 +93,8 @@ _cairo_xcb_connection_render_composite (cairo_xcb_connection_t *connection,
uint16_t width,
uint16_t height)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint8_t op;
- uint8_t pad1;
- uint16_t pad2;
- uint32_t src;
- uint32_t mask;
- uint32_t dst;
- int16_t src_x;
- int16_t src_y;
- int16_t mask_x;
- int16_t mask_y;
- int16_t dst_x;
- int16_t dst_y;
- uint16_t width;
- uint16_t height;
- } req;
- struct iovec vec[1];
-
- COMPILE_TIME_ASSERT (sizeof (req) == 36);
-
- req.major = connection->render->major_opcode;
- req.minor = 8;
- req.length = sizeof (req) >> 2;
- req.op = op;
- req.src = src;
- req.mask = mask;
- req.dst = dst;
- req.src_x = src_x;
- req.src_y = src_y;
- req.mask_x = mask_x;
- req.mask_y = mask_y;
- req.dst_x = dst_x;
- req.dst_y = dst_y;
- req.width = width;
- req.height = height;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
-
- _cairo_xcb_connection_write (connection, vec, 1);
+ xcb_render_composite (connection->xcb_connection, op, src, mask, dst,
+ src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height);
}
void
@@ -242,56 +108,8 @@ _cairo_xcb_connection_render_trapezoids (cairo_xcb_connection_t *connection,
uint32_t traps_len,
xcb_render_trapezoid_t *traps)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint8_t op;
- uint8_t pad1;
- uint16_t pad2;
- uint32_t src;
- uint32_t dst;
- uint32_t mask_format;
- int16_t src_x;
- int16_t src_y;
- } req;
- struct iovec vec[3];
- uint32_t prefix[2];
- uint32_t len = (sizeof (req) + traps_len * sizeof (xcb_render_trapezoid_t)) >> 2;
-
- COMPILE_TIME_ASSERT (sizeof (req) == 24);
-
- req.major = connection->render->major_opcode;
- req.minor = 10;
- req.length = 0;
- req.op = op;
- req.src = src;
- req.dst = dst;
- req.mask_format = mask_format;
- req.src_x = src_x;
- req.src_y = src_y;
-
- if (len < connection->root->maximum_request_length) {
- req.length = len;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
- vec[1].iov_base = traps;
- vec[1].iov_len = traps_len * sizeof (xcb_render_trapezoid_t);
-
- _cairo_xcb_connection_write (connection, vec, 2);
- } else {
- prefix[0] = *(uint32_t *) &req;
- prefix[1] = len + 1;
- vec[0].iov_base = prefix;
- vec[0].iov_len = sizeof (prefix);
- vec[1].iov_base = (uint32_t *) &req + 1;
- vec[1].iov_len = sizeof (req) - 4;
- vec[2].iov_base = traps;
- vec[2].iov_len = traps_len * sizeof (xcb_render_trapezoid_t);
-
- _cairo_xcb_connection_write (connection, vec, 3);
- }
+ xcb_render_trapezoids (connection->xcb_connection, op, src, dst,
+ mask_format, src_x, src_y, traps_len, traps);
}
void
@@ -305,6 +123,10 @@ _cairo_xcb_connection_render_spans (cairo_xcb_connection_t *connection,
uint32_t num_spans,
uint16_t *spans)
{
+ ASSERT_NOT_REACHED;
+#if 0
+#define X_RenderSpans 99
+
struct {
uint8_t major;
uint8_t minor;
@@ -360,6 +182,7 @@ _cairo_xcb_connection_render_spans (cairo_xcb_connection_t *connection,
_cairo_xcb_connection_write (connection, vec, 3);
}
+#endif
}
void
@@ -367,52 +190,14 @@ _cairo_xcb_connection_render_create_glyph_set (cairo_xcb_connection_t *connectio
xcb_render_glyphset_t id,
xcb_render_pictformat_t format)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t gsid;
- uint32_t format;
- } req;
- struct iovec vec[1];
-
- COMPILE_TIME_ASSERT (sizeof (req) == 12);
-
- req.major = connection->render->major_opcode;
- req.minor = 17;
- req.length = sizeof (req) >> 2;
- req.gsid = id;
- req.format = format;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
-
- _cairo_xcb_connection_write (connection, vec, 1);
+ xcb_render_create_glyph_set (connection->xcb_connection, id, format);
}
void
_cairo_xcb_connection_render_free_glyph_set (cairo_xcb_connection_t *connection,
xcb_render_glyphset_t glyphset)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t gsid;
- } req;
- struct iovec vec[1];
-
- COMPILE_TIME_ASSERT (sizeof (req) == 8);
-
- req.major = connection->render->major_opcode;
- req.minor = 19;
- req.length = sizeof (req) >> 2;
- req.gsid = glyphset;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
-
- _cairo_xcb_connection_write (connection, vec, 1);
+ xcb_render_free_glyph_set (connection->xcb_connection, glyphset);
_cairo_xcb_connection_put_xid (connection, glyphset);
}
@@ -425,57 +210,8 @@ _cairo_xcb_connection_render_add_glyphs (cairo_xcb_connection_t *con
uint32_t data_len,
uint8_t *data)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t gsid;
- uint32_t num_glyphs;
- } req;
- struct iovec vec[5];
- uint32_t prefix[2];
- uint32_t len = (sizeof (req) + num_glyphs * (sizeof (uint32_t) + sizeof (xcb_render_glyphinfo_t)) + data_len) >> 2;
- int cnt;
-
- COMPILE_TIME_ASSERT (sizeof (req) == 12);
-
- req.major = connection->render->major_opcode;
- req.minor = 20;
- req.length = 0;
- req.gsid = glyphset;
- req.num_glyphs = num_glyphs;
-
- if (len < connection->root->maximum_request_length) {
- req.length = len;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
-
- cnt = 1;
- } else {
- prefix[0] = *(uint32_t *) &req;
- prefix[1] = len + 1;
- vec[0].iov_base = prefix;
- vec[0].iov_len = sizeof (prefix);
- vec[1].iov_base = (uint32_t *) &req + 1;
- vec[1].iov_len = sizeof (req) - 4;
-
- cnt = 2;
- }
-
- vec[cnt].iov_base = glyphs_id;
- vec[cnt].iov_len = num_glyphs * sizeof (uint32_t);
- cnt++;
-
- vec[cnt].iov_base = glyphs;
- vec[cnt].iov_len = num_glyphs * sizeof (xcb_render_glyphinfo_t);
- cnt++;
-
- vec[cnt].iov_base = data;
- vec[cnt].iov_len = data_len;
- cnt++;
-
- _cairo_xcb_connection_write (connection, vec, cnt);
+ xcb_render_add_glyphs (connection->xcb_connection, glyphset, num_glyphs,
+ glyphs_id, glyphs, data_len, data);
}
void
@@ -484,28 +220,7 @@ _cairo_xcb_connection_render_free_glyphs (cairo_xcb_connection_t *connec
uint32_t num_glyphs,
xcb_render_glyph_t *glyphs)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t gsid;
- } req;
- struct iovec vec[2];
-
- COMPILE_TIME_ASSERT (sizeof (req) == 8);
- assert ( (sizeof (req) + num_glyphs * sizeof (uint32_t)) >> 2 < connection->root->maximum_request_length);
-
- req.major = connection->render->major_opcode;
- req.minor = 22;
- req.length = (sizeof (req) + num_glyphs * sizeof (uint32_t)) >> 2;
- req.gsid = glyphset;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
- vec[1].iov_base = glyphs;
- vec[1].iov_len = num_glyphs * sizeof (uint32_t);
-
- _cairo_xcb_connection_write (connection, vec, 2);
+ xcb_render_free_glyphs (connection->xcb_connection, glyphset, num_glyphs, glyphs);
}
void
@@ -520,61 +235,8 @@ _cairo_xcb_connection_render_composite_glyphs_8 (cairo_xcb_connection_t *
uint32_t glyphcmds_len,
uint8_t *glyphcmds)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint8_t op;
- uint8_t pad1;
- uint16_t pad2;
- uint32_t src;
- uint32_t dst;
- uint32_t mask_format;
- uint32_t glyphset;
- int16_t src_x;
- int16_t src_y;
- } req;
- struct iovec vec[3];
- uint32_t prefix[2];
- int len;
-
- COMPILE_TIME_ASSERT (sizeof (req) == 28);
-
- req.major = connection->render->major_opcode;
- req.minor = 23;
- req.length = 0;
- req.op = op;
- req.src = src;
- req.dst = dst;
- req.mask_format = mask_format;
- req.glyphset = glyphset;
- req.src_x = src_x;
- req.src_y = src_y;
-
- len = (sizeof (req) + glyphcmds_len) >> 2;
- if (len < connection->root->maximum_request_length) {
- req.length = len;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
-
- len = 1;
- } else {
- prefix[0] = *(uint32_t *) &req;
- prefix[1] = len + 1;
- vec[0].iov_base = prefix;
- vec[0].iov_len = sizeof (prefix);
- vec[1].iov_base = (uint32_t *) &req + 1;
- vec[1].iov_len = sizeof (req) - 4;
-
- len = 2;
- }
-
- vec[len].iov_base = glyphcmds;
- vec[len].iov_len = glyphcmds_len;
- len++;
-
- _cairo_xcb_connection_write (connection, vec, len);
+ xcb_render_composite_glyphs_8 (connection->xcb_connection, op, src, dst, mask_format,
+ glyphset, src_x, src_y, glyphcmds_len, glyphcmds);
}
void
@@ -589,61 +251,8 @@ _cairo_xcb_connection_render_composite_glyphs_16 (cairo_xcb_connection_t
uint32_t glyphcmds_len,
uint8_t *glyphcmds)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint8_t op;
- uint8_t pad1;
- uint16_t pad2;
- uint32_t src;
- uint32_t dst;
- uint32_t mask_format;
- uint32_t glyphset;
- int16_t src_x;
- int16_t src_y;
- } req;
- struct iovec vec[3];
- uint32_t prefix[2];
- int len;
-
- COMPILE_TIME_ASSERT (sizeof (req) == 28);
-
- req.major = connection->render->major_opcode;
- req.minor = 24;
- req.length = 0;
- req.op = op;
- req.src = src;
- req.dst = dst;
- req.mask_format = mask_format;
- req.glyphset = glyphset;
- req.src_x = src_x;
- req.src_y = src_y;
-
- len = (sizeof (req) + glyphcmds_len) >> 2;
- if (len < connection->root->maximum_request_length) {
- req.length = len;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
-
- len = 1;
- } else {
- prefix[0] = *(uint32_t *) &req;
- prefix[1] = len + 1;
- vec[0].iov_base = prefix;
- vec[0].iov_len = sizeof (prefix);
- vec[1].iov_base = (uint32_t *) &req + 1;
- vec[1].iov_len = sizeof (req) - 4;
-
- len = 2;
- }
-
- vec[len].iov_base = glyphcmds;
- vec[len].iov_len = glyphcmds_len;
- len++;
-
- _cairo_xcb_connection_write (connection, vec, len);
+ xcb_render_composite_glyphs_16 (connection->xcb_connection, op, src, dst, mask_format,
+ glyphset, src_x, src_y, glyphcmds_len, glyphcmds);
}
void
@@ -658,61 +267,8 @@ _cairo_xcb_connection_render_composite_glyphs_32 (cairo_xcb_connection_t
uint32_t glyphcmds_len,
uint8_t *glyphcmds)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint8_t op;
- uint8_t pad1;
- uint16_t pad2;
- uint32_t src;
- uint32_t dst;
- uint32_t mask_format;
- uint32_t glyphset;
- int16_t src_x;
- int16_t src_y;
- } req;
- struct iovec vec[2];
- uint32_t prefix[2];
- int len;
-
- COMPILE_TIME_ASSERT (sizeof (req) == 28);
-
- req.major = connection->render->major_opcode;
- req.minor = 25;
- req.length = 0;
- req.op = op;
- req.src = src;
- req.dst = dst;
- req.mask_format = mask_format;
- req.glyphset = glyphset;
- req.src_x = src_x;
- req.src_y = src_y;
-
- len = (sizeof (req) + glyphcmds_len) >> 2;
- if (len < connection->root->maximum_request_length) {
- req.length = len;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
-
- len = 1;
- } else {
- prefix[0] = *(uint32_t *) &req;
- prefix[1] = len + 1;
- vec[0].iov_base = prefix;
- vec[0].iov_len = sizeof (prefix);
- vec[1].iov_base = (uint32_t *) &req + 1;
- vec[1].iov_len = sizeof (req) - 4;
-
- len = 2;
- }
-
- vec[len].iov_base = glyphcmds;
- vec[len].iov_len = glyphcmds_len;
- len++;
-
- _cairo_xcb_connection_write (connection, vec, len);
+ xcb_render_composite_glyphs_32 (connection->xcb_connection, op, src, dst, mask_format,
+ glyphset, src_x, src_y, glyphcmds_len, glyphcmds);
}
void
@@ -723,52 +279,8 @@ _cairo_xcb_connection_render_fill_rectangles (cairo_xcb_connection_t *conne
uint32_t num_rects,
xcb_rectangle_t *rects)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint8_t op;
- uint8_t pad1;
- uint16_t pad2;
- uint32_t dst;
- xcb_render_color_t color;
- } req;
- struct iovec vec[3];
- uint32_t prefix[2];
- uint32_t len;
-
- COMPILE_TIME_ASSERT (sizeof (req) == 20);
-
- req.major = connection->render->major_opcode;
- req.minor = 26;
- req.op = op;
- req.dst = dst;
- req.color = color;
-
- len = (sizeof (req) + num_rects * sizeof (xcb_rectangle_t)) >> 2;
- if (len < connection->root->maximum_request_length) {
- req.length = len;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
-
- len = 1;
- } else {
- prefix[0] = *(uint32_t *) &req;
- prefix[1] = len + 1;
- vec[0].iov_base = prefix;
- vec[0].iov_len = sizeof (prefix);
- vec[1].iov_base = (uint32_t *) &req + 1;
- vec[1].iov_len = sizeof (req) - 4;
-
- len = 2;
- }
-
- vec[len].iov_base = rects;
- vec[len].iov_len = num_rects * sizeof (xcb_rectangle_t);
- len++;
-
- _cairo_xcb_connection_write (connection, vec, len);
+ xcb_render_fill_rectangles (connection->xcb_connection, op, dst, color,
+ num_rects, rects);
}
void
@@ -776,25 +288,7 @@ _cairo_xcb_connection_render_set_picture_transform (cairo_xcb_connection_t
xcb_render_picture_t picture,
xcb_render_transform_t *transform)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t picture;
- } req;
- struct iovec vec[2];
-
- req.major = connection->render->major_opcode;
- req.minor = 28;
- req.length = (sizeof (req) + sizeof (xcb_render_transform_t)) >> 2;
- req.picture = picture;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
- vec[1].iov_base = transform;
- vec[1].iov_len = sizeof (xcb_render_transform_t);
-
- _cairo_xcb_connection_write (connection, vec, 2);
+ xcb_render_set_picture_transform (connection->xcb_connection, picture, *transform);
}
void
@@ -803,30 +297,8 @@ _cairo_xcb_connection_render_set_picture_filter (cairo_xcb_connection_t
uint16_t filter_len,
char *filter)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t picture;
- uint16_t nbytes;
- uint16_t pad;
- } req;
- struct iovec vec[2];
-
- req.nbytes = filter_len;
- filter_len = (filter_len + 3) & ~3;
-
- req.major = connection->render->major_opcode;
- req.minor = 30;
- req.length = (sizeof (req) + filter_len) >> 2;
- req.picture = picture;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
- vec[1].iov_base = filter;
- vec[1].iov_len = filter_len;
-
- _cairo_xcb_connection_write (connection, vec, 2);
+ xcb_render_set_picture_filter (connection->xcb_connection, picture,
+ filter_len, filter, 0, NULL);
}
void
@@ -834,27 +306,7 @@ _cairo_xcb_connection_render_create_solid_fill (cairo_xcb_connection_t *conn
xcb_render_picture_t picture,
xcb_render_color_t color)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t picture;
- xcb_render_color_t color;
- } req;
- struct iovec vec[1];
-
- COMPILE_TIME_ASSERT (sizeof (req) == 16);
-
- req.major = connection->render->major_opcode;
- req.minor = 33;
- req.length = sizeof (req) >> 2;
- req.picture = picture;
- req.color = color;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
-
- _cairo_xcb_connection_write (connection, vec, 1);
+ xcb_render_create_solid_fill (connection->xcb_connection, picture, color);
}
void
@@ -866,35 +318,8 @@ _cairo_xcb_connection_render_create_linear_gradient (cairo_xcb_connection_t
xcb_render_fixed_t *stops,
xcb_render_color_t *colors)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t picture;
- xcb_render_pointfix_t p1, p2;
- uint32_t num_stops;
- } req;
- struct iovec vec[3];
-
- COMPILE_TIME_ASSERT (sizeof (req) == 28);
- assert((sizeof (req) + num_stops * (sizeof (xcb_render_fixed_t) + sizeof (xcb_render_color_t))) >> 2 < connection->root->maximum_request_length);
-
- req.major = connection->render->major_opcode;
- req.minor = 34;
- req.length = (sizeof (req) + num_stops * (sizeof (xcb_render_fixed_t) + sizeof (xcb_render_color_t))) >> 2;
- req.picture = picture;
- req.p1 = p1;
- req.p2 = p2;
- req.num_stops = num_stops;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
- vec[1].iov_base = stops;
- vec[1].iov_len = num_stops * sizeof (xcb_render_fixed_t);
- vec[2].iov_base = colors;
- vec[2].iov_len = num_stops * sizeof (xcb_render_color_t);
-
- _cairo_xcb_connection_write (connection, vec, 3);
+ xcb_render_create_linear_gradient (connection->xcb_connection, picture,
+ p1, p2, num_stops, stops, colors);
}
void
@@ -908,40 +333,9 @@ _cairo_xcb_connection_render_create_radial_gradient (cairo_xcb_connection_t
xcb_render_fixed_t *stops,
xcb_render_color_t *colors)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t picture;
- xcb_render_pointfix_t inner;
- xcb_render_pointfix_t outer;
- xcb_render_fixed_t inner_radius;
- xcb_render_fixed_t outer_radius;
- uint32_t num_stops;
- } req;
- struct iovec vec[3];
-
- COMPILE_TIME_ASSERT (sizeof (req) == 36);
- assert((sizeof (req) + num_stops * (sizeof (xcb_render_fixed_t) + sizeof (xcb_render_color_t))) >> 2 < connection->root->maximum_request_length);
-
- req.major = connection->render->major_opcode;
- req.minor = 35;
- req.length = (sizeof (req) + num_stops * (sizeof (xcb_render_fixed_t) + sizeof (xcb_render_color_t))) >> 2;
- req.picture = picture;
- req.inner = inner;
- req.outer = outer;
- req.inner_radius = inner_radius;
- req.outer_radius = outer_radius;
- req.num_stops = num_stops;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
- vec[1].iov_base = stops;
- vec[1].iov_len = num_stops * sizeof (xcb_render_fixed_t);
- vec[2].iov_base = colors;
- vec[2].iov_len = num_stops * sizeof (xcb_render_color_t);
-
- _cairo_xcb_connection_write (connection, vec, 3);
+ xcb_render_create_radial_gradient (connection->xcb_connection, picture,
+ inner, outer, inner_radius, outer_radius,
+ num_stops, stops, colors);
}
void
@@ -953,34 +347,6 @@ _cairo_xcb_connection_render_create_conical_gradient (cairo_xcb_connection_t
xcb_render_fixed_t *stops,
xcb_render_color_t *colors)
{
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint32_t picture;
- xcb_render_pointfix_t center;
- xcb_render_fixed_t angle;
- uint32_t num_stops;
- } req;
- struct iovec vec[3];
-
- COMPILE_TIME_ASSERT (sizeof (req) == 24);
- assert((sizeof (req) + num_stops * (sizeof (xcb_render_fixed_t) + sizeof (xcb_render_color_t))) >> 2 < connection->root->maximum_request_length);
-
- req.major = connection->render->major_opcode;
- req.minor = 36;
- req.length = (sizeof (req) + num_stops * (sizeof (xcb_render_fixed_t) + sizeof (xcb_render_color_t))) >> 2;
- req.picture = picture;
- req.center = center;
- req.angle = angle;
- req.num_stops = num_stops;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
- vec[1].iov_base = stops;
- vec[1].iov_len = num_stops * sizeof (xcb_render_fixed_t);
- vec[2].iov_base = colors;
- vec[2].iov_len = num_stops * sizeof (xcb_render_color_t);
-
- _cairo_xcb_connection_write (connection, vec, 3);
+ xcb_render_create_conical_gradient (connection->xcb_connection, picture,
+ center, angle, num_stops, stops, colors);
}