From 41fea4472dec859ddec76bdfa7108ebec71de1e3 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 21 Mar 2014 19:36:05 +0100 Subject: xserver fontconfig libX11 libXext libxcb mesa git update 21 Mar 2014 xserver commit 4fb31e4824d46edc80bb49b4065152899faa5ac6 libxcb commit cb686b576739deea00180c54697c8b62b8419ae0 libX11 commit 8be4610939b833587954957f5963eb4191b43d19 libXext commit 11aad96bd689d54156064d2e81213dc827a689d1 fontconfig commit 5478192f379d784b421329e4bf72cc780818e467 mesa commit 8d8d0cb09eb8735a04fc36cc4d0e2dc9f9d460eb --- xorg-server/glamor/glamor_fill.c | 74 +++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 31 deletions(-) (limited to 'xorg-server/glamor/glamor_fill.c') diff --git a/xorg-server/glamor/glamor_fill.c b/xorg-server/glamor/glamor_fill.c index dda55eace..7461b62fa 100644 --- a/xorg-server/glamor/glamor_fill.c +++ b/xorg-server/glamor/glamor_fill.c @@ -27,10 +27,14 @@ #include "glamor_priv.h" -/** @file glamor_fillspans.c +/** @file glamor_fill.c * * GC fill implementation, based loosely on fb_fill.c */ + +/** + * Fills the given rectangle of a drawable with the GC's fill style. + */ Bool glamor_fill(DrawablePtr drawable, GCPtr gc, int x, int y, int width, int height, Bool fallback) @@ -108,13 +112,12 @@ glamor_fill(DrawablePtr drawable, x = 0; y = 0; } - if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) { - if (glamor_prepare_access_gc(gc)) { - fbFill(drawable, gc, x, y, width, height); - glamor_finish_access_gc(gc); - } - glamor_finish_access(drawable, GLAMOR_ACCESS_RW); + if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) && + glamor_prepare_access_gc(gc)) { + fbFill(drawable, gc, x, y, width, height); } + glamor_finish_access_gc(gc); + glamor_finish_access(drawable); if (sub_pixmap != NULL) { if (gc->fillStyle != FillSolid) { @@ -162,7 +165,7 @@ glamor_init_solid_shader(ScreenPtr screen) glBindAttribLocation(glamor_priv->solid_prog, GLAMOR_VERTEX_POS, "v_position"); - glamor_link_glsl_prog(glamor_priv->solid_prog); + glamor_link_glsl_prog(screen, glamor_priv->solid_prog, "solid"); glamor_priv->solid_color_uniform_location = glGetUniformLocation(glamor_priv->solid_prog, "color"); @@ -187,9 +190,9 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color) glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); GLfloat xscale, yscale; - float vertices[32]; - float *pvertices = vertices; - int valid_nbox = ARRAY_SIZE(vertices); + float stack_vertices[32]; + float *vertices = stack_vertices; + int valid_nbox = ARRAY_SIZE(stack_vertices) / (4 * 2); glamor_set_destination_pixmap_priv_nc(pixmap_priv); @@ -200,20 +203,18 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color) pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale); - if (_X_UNLIKELY(nbox * 4 * 2 > ARRAY_SIZE(vertices))) { - int allocated_box; + if (nbox > valid_nbox) { + int allocated_nbox; + float *new_vertices; - if (nbox * 6 > GLAMOR_COMPOSITE_VBO_VERT_CNT) { - allocated_box = GLAMOR_COMPOSITE_VBO_VERT_CNT / 6; - } + if (nbox > GLAMOR_COMPOSITE_VBO_VERT_CNT / 6) + allocated_nbox = GLAMOR_COMPOSITE_VBO_VERT_CNT / 6; else - allocated_box = nbox; - pvertices = malloc(allocated_box * 4 * 2 * sizeof(float)); - if (pvertices) - valid_nbox = allocated_box; - else { - pvertices = vertices; - valid_nbox = ARRAY_SIZE(vertices) / (4 * 2); + allocated_nbox = nbox; + new_vertices = malloc(allocated_nbox * 4 * 2 * sizeof(float)); + if (new_vertices) { + vertices = new_vertices; + valid_nbox = allocated_nbox; } } @@ -221,22 +222,22 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color) glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, - GL_FALSE, 2 * sizeof(float), pvertices); + GL_FALSE, 2 * sizeof(float), vertices); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); while (nbox) { int box_cnt, i; - float *valid_vertices; + float *next_box; - valid_vertices = pvertices; + next_box = vertices; box_cnt = nbox > valid_nbox ? valid_nbox : nbox; for (i = 0; i < box_cnt; i++) { glamor_set_normalize_vcoords(pixmap_priv, xscale, yscale, box[i].x1, box[i].y1, box[i].x2, box[i].y2, glamor_priv->yInverted, - valid_vertices); - valid_vertices += 4 * 2; + next_box); + next_box += 4 * 2; } if (box_cnt == 1) glDrawArrays(GL_TRIANGLE_FAN, 0, box_cnt * 4); @@ -253,16 +254,21 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color) box += box_cnt; } - if (pvertices != vertices) - free(pvertices); + if (vertices != stack_vertices) + free(vertices); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - glUseProgram(0); glamor_put_context(glamor_priv); glamor_priv->state = RENDER_STATE; glamor_priv->render_idle_cnt = 0; } +/** + * Fills the given rectangles of pixmap with an X pixel value. + * + * This is a helper used by other code after clipping and translation + * of coordinates to a glamor backing pixmap. + */ Bool glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, unsigned long fg_pixel) @@ -310,6 +316,12 @@ glamor_solid_boxes(PixmapPtr pixmap, return TRUE; } +/** + * Fills a rectangle of a pixmap with an X pixel value. + * + * This is a helper used by other glamor code mostly for clearing of + * buffers to 0. + */ Bool glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height, unsigned char alu, unsigned long planemask, unsigned long fg_pixel) -- cgit v1.2.3