diff options
author | Adam Jackson <ajax@redhat.com> | 2013-10-30 09:56:46 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2014-01-27 09:30:47 -0800 |
commit | 82efb90efba685678638f94804d773b59ca1643f (patch) | |
tree | ee5e580cf1fcc72b10c7b57bd1de983c6b1cb5a1 | |
parent | 714926b090344a17a2f7aee9f4bc6aea4e45f48c (diff) |
glamor: Remove copy of sna's compiler.h
Xfuncproto.h has equivalents for these already.
v2: Adjust a couple more likelies after the rebase (anholt)
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | glamor/Makefile.am | 1 | ||||
-rw-r--r-- | glamor/compiler.h | 59 | ||||
-rw-r--r-- | glamor/glamor_compositerects.c | 2 | ||||
-rw-r--r-- | glamor/glamor_fill.c | 4 | ||||
-rw-r--r-- | glamor/glamor_glyphs.c | 8 | ||||
-rw-r--r-- | glamor/glamor_priv.h | 2 | ||||
-rw-r--r-- | glamor/glamor_utils.h | 34 | ||||
-rw-r--r-- | glamor/glapi.h | 6 |
8 files changed, 27 insertions, 89 deletions
diff --git a/glamor/Makefile.am b/glamor/Makefile.am index 2fd521f11..5eefd8e6a 100644 --- a/glamor/Makefile.am +++ b/glamor/Makefile.am @@ -12,7 +12,6 @@ libglamor_la_LDFLAGS = -version-info 0:0:0 libglamor_la_SOURCES = \ compat-api.h \ - compiler.h \ glamor.c \ glamor_copyarea.c \ glamor_copywindow.c \ diff --git a/glamor/compiler.h b/glamor/compiler.h deleted file mode 100644 index 5f2d4eab9..000000000 --- a/glamor/compiler.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2011 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Authors: - * Chris Wilson <chris@chris-wilson.co.uk> - * - * Copied from sna - * - */ - -#ifndef _GLAMOR_COMPILER_H_ -#define _GLAMOR_COMPILER_H_ - -#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) -#define likely(expr) (__builtin_expect (!!(expr), 1)) -#define unlikely(expr) (__builtin_expect (!!(expr), 0)) -#define noinline __attribute__((noinline)) -#define fastcall __attribute__((regparm(3))) -#define must_check __attribute__((warn_unused_result)) -#define constant __attribute__((const)) -#else -#define likely(expr) (expr) -#define unlikely(expr) (expr) -#define noinline -#define fastcall -#define must_check -#define constant -#endif - -#ifdef HAVE_VALGRIND -#define VG(x) x -#else -#define VG(x) -#endif - -#define VG_CLEAR(s) VG(memset(&s, 0, sizeof(s))) - -#define COMPILE_TIME_ASSERT(E) ((void)sizeof(char[1 - 2*!(E)])) - -#endif /* _SNA_COMPILER_H_ */ diff --git a/glamor/glamor_compositerects.c b/glamor/glamor_compositerects.c index a0d59804c..967e22846 100644 --- a/glamor/glamor_compositerects.c +++ b/glamor/glamor_compositerects.c @@ -246,7 +246,7 @@ glamor_composite_rectangles(CARD8 op, goto done; } else { - if (likely(priv->type != GLAMOR_TEXTURE_LARGE)) { + if (_X_LIKELY(priv->type != GLAMOR_TEXTURE_LARGE)) { int error; source = CreateSolidPicture(0, color, &error); diff --git a/glamor/glamor_fill.c b/glamor/glamor_fill.c index 3aef7fcef..d59e6204f 100644 --- a/glamor/glamor_fill.c +++ b/glamor/glamor_fill.c @@ -203,7 +203,7 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color) pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale); - if (unlikely(nbox * 4 * 2 > ARRAY_SIZE(vertices))) { + if (_X_UNLIKELY(nbox * 4 * 2 > ARRAY_SIZE(vertices))) { int allocated_box; if (nbox * 6 > GLAMOR_COMPOSITE_VBO_VERT_CNT) { @@ -220,7 +220,7 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color) } } - if (unlikely(nbox > 1)) + if (_X_UNLIKELY(nbox > 1)) dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, diff --git a/glamor/glamor_glyphs.c b/glamor/glamor_glyphs.c index 1c0f9f50b..3586b33da 100644 --- a/glamor/glamor_glyphs.c +++ b/glamor/glamor_glyphs.c @@ -191,7 +191,7 @@ find_continuous_bits(unsigned int bits, int bits_cnt, unsigned int *pbits_mask) bits_mask = ((1LL << bits_cnt) - 1); - if (unlikely(bits_cnt > 56)) { + if (_X_UNLIKELY(bits_cnt > 56)) { while (bits) { if ((bits & bits_mask) == bits_mask) { *pbits_mask = bits_mask << idx; @@ -751,7 +751,7 @@ glamor_glyphs_intersect(int nlist, GlyphListPtr list, GlyphPtr *glyphs, left_to_right = TRUE; cur_list = list++; - if (unlikely(!first_list)) { + if (_X_UNLIKELY(!first_list)) { pixman_region_init_with_extents(¤t_region, extents); pixman_region_union(&list_region, &list_region, ¤t_region); first = TRUE; @@ -821,7 +821,7 @@ glamor_glyphs_intersect(int nlist, GlyphListPtr list, GlyphPtr *glyphs, } } else { - if (unlikely(!first_list)) { + if (_X_UNLIKELY(!first_list)) { current_box.x1 = x1; current_box.y1 = y1; current_box.x2 = x2; @@ -1709,7 +1709,7 @@ _glamor_glyphs(CARD8 op, format = mask_format->depth << 24 | mask_format->format; fixed_list = calloc(fixed_size, sizeof(*fixed_list)); - if (unlikely(fixed_list == NULL)) + if (_X_UNLIKELY(fixed_list == NULL)) fixed_size = 0; fixed_cnt = glamor_glyphs_intersect(nlist, list, glyphs, format, dst->pDrawable->pScreen, diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index d4f537190..08b6bb095 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -31,8 +31,6 @@ #include "config.h" #endif -#include "compiler.h" - #include <xorg-server.h> #ifndef DEBUG #define NDEBUG diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h index b27c56c04..49d2ff75c 100644 --- a/glamor/glamor_utils.h +++ b/glamor/glamor_utils.h @@ -59,7 +59,7 @@ #define PIXMAP_PRIV_GET_ACTUAL_SIZE(priv, w, h) \ do { \ - if (unlikely(priv->type == GLAMOR_TEXTURE_LARGE)) { \ + if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \ w = priv->large.box.x2 - priv->large.box.x1; \ h = priv->large.box.y2 - priv->large.box.y1; \ } else { \ @@ -80,7 +80,7 @@ #define pixmap_priv_get_fbo_off(_priv_, _xoff_, _yoff_) \ do { \ - if (unlikely(_priv_ && (_priv_)->type == GLAMOR_TEXTURE_LARGE)) { \ + if (_X_UNLIKELY(_priv_ && (_priv_)->type == GLAMOR_TEXTURE_LARGE)) { \ *(_xoff_) = - (_priv_)->large.box.x1; \ *(_yoff_) = - (_priv_)->large.box.y1; \ } else { \ @@ -314,7 +314,7 @@ texcoord, yInverted) \ do { \ (texcoord)[0] = t_from_x_coord_x(xscale, _tx_); \ - if (likely(yInverted)) \ + if (_X_LIKELY(yInverted)) \ (texcoord)[1] = t_from_x_coord_y_inverted(yscale, _ty_);\ else \ (texcoord)[1] = t_from_x_coord_y(yscale, _ty_); \ @@ -337,7 +337,7 @@ tx += fbo_x_off; \ ty += fbo_y_off; \ (texcoord)[0] = t_from_x_coord_x(xscale, tx); \ - if (likely(yInverted)) \ + if (_X_LIKELY(yInverted)) \ (texcoord)[1] = t_from_x_coord_y_inverted(yscale, ty); \ else \ (texcoord)[1] = t_from_x_coord_y(yscale, ty); \ @@ -432,7 +432,7 @@ texcoords, \ stride) \ do { \ - if (likely(priv->type != GLAMOR_TEXTURE_LARGE)) { \ + if (_X_LIKELY(priv->type != GLAMOR_TEXTURE_LARGE)) { \ glamor_set_transformed_normalize_tcoords_ext(priv, matrix, xscale, \ yscale, _x1_, _y1_, \ _x2_, _y2_, yInverted, \ @@ -505,7 +505,7 @@ (vertices)[1 * stride] = _t2_ = t_from_x_coord_x(xscale, tx2); \ (vertices)[2 * stride] = _t2_; \ (vertices)[3 * stride] = _t0_; \ - if (likely(yInverted)) { \ + if (_X_LIKELY(yInverted)) { \ (vertices)[1] = _t1_ = t_from_x_coord_y_inverted(yscale, ty1); \ (vertices)[2 * stride + 1] = _t5_ = t_from_x_coord_y_inverted(yscale, ty2);\ } \ @@ -521,7 +521,7 @@ x1, y1, x2, y2, \ yInverted, vertices, stride) \ do { \ - if (unlikely(priv->type == GLAMOR_TEXTURE_LARGE)) { \ + if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \ float tx1, tx2, ty1, ty2; \ int fbo_x_off, fbo_y_off; \ pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off); \ @@ -551,7 +551,7 @@ _x1_, _y1_, _x2_, _y2_, \ yInverted, vertices, stride)\ do { \ - if (unlikely(priv->type == GLAMOR_TEXTURE_LARGE)) { \ + if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \ float tx1, tx2, ty1, ty2; \ if (repeat_type == RepeatPad) { \ tx1 = _x1_ - priv->large.box.x1; \ @@ -591,7 +591,7 @@ (vertices)[2] = t_from_x_coord_x(xscale, x2); \ (vertices)[6] = (vertices)[2]; \ (vertices)[4] = (vertices)[0]; \ - if (likely(yInverted)) { \ + if (_X_LIKELY(yInverted)) { \ (vertices)[1] = t_from_x_coord_y_inverted(yscale, y1); \ (vertices)[7] = t_from_x_coord_y_inverted(yscale, y2); \ } \ @@ -610,7 +610,7 @@ (vertices)[2] = (x2); \ (vertices)[4] = (vertices)[2]; \ (vertices)[6] = (vertices)[0]; \ - if (likely(yInverted)) { \ + if (_X_LIKELY(yInverted)) { \ (vertices)[1] = (y1); \ (vertices)[5] = (y2); \ } \ @@ -629,7 +629,7 @@ (vertices)[1*stride] = (x2); \ (vertices)[2*stride] = (vertices)[1*stride]; \ (vertices)[3*stride] = (vertices)[0]; \ - if (likely(yInverted)) { \ + if (_X_LIKELY(yInverted)) { \ (vertices)[1] = (y1); \ (vertices)[2*stride + 1] = (y2); \ } \ @@ -645,7 +645,7 @@ yInverted, vertices) \ do { \ (vertices)[0] = v_from_x_coord_x(xscale, x); \ - if (likely(yInverted)) { \ + if (_X_LIKELY(yInverted)) { \ (vertices)[1] = v_from_x_coord_y_inverted(yscale, y); \ } else { \ (vertices)[1] = v_from_x_coord_y(yscale, y); \ @@ -673,7 +673,7 @@ (vertices)[2] = (x2); \ (vertices)[6] = (vertices)[2]; \ (vertices)[4] = (vertices)[0]; \ - if (likely(yInverted)) { \ + if (_X_LIKELY(yInverted)) { \ (vertices)[1] = (y1); \ (vertices)[7] = (y2); \ } \ @@ -699,7 +699,7 @@ x2 + fbo_x_off); \ (vertices)[2 * stride] = _t2_; \ (vertices)[3 * stride] = _t0_; \ - if (likely(yInverted)) { \ + if (_X_LIKELY(yInverted)) { \ (vertices)[1] = _t1_ = v_from_x_coord_y_inverted(yscale, \ y1 + fbo_y_off); \ (vertices)[2 * stride + 1] = _t5_ = \ @@ -742,7 +742,7 @@ (vertices)[2] = v_from_x_coord_x(xscale, x2); \ (vertices)[6] = (vertices)[2]; \ (vertices)[4] = (vertices)[0]; \ - if (likely(yInverted)) { \ + if (_X_LIKELY(yInverted)) { \ (vertices)[1] = v_from_x_coord_y_inverted(yscale, y1); \ (vertices)[7] = v_from_x_coord_y_inverted(yscale, y2); \ } \ @@ -758,7 +758,7 @@ yInverted, pt) \ do { \ (pt)[0] = t_from_x_coord_x(xscale, x); \ - if (likely(yInverted)) { \ + if (_X_LIKELY(yInverted)) { \ (pt)[1] = t_from_x_coord_y_inverted(yscale, y); \ } else { \ (pt)[1] = t_from_x_coord_y(yscale, y); \ @@ -769,7 +769,7 @@ yInverted, c) \ do { \ (c)[0] = (float)x; \ - if (likely(yInverted)) { \ + if (_X_LIKELY(yInverted)) { \ (c)[1] = (float)y; \ } else { \ (c)[1] = (float)height - (float)y; \ diff --git a/glamor/glapi.h b/glamor/glapi.h index 481e4ba84..f61fc84d9 100644 --- a/glamor/glapi.h +++ b/glamor/glapi.h @@ -88,12 +88,12 @@ extern void *_glapi_Context; #ifdef THREADS #define GET_DISPATCH() \ - (likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch()) + (_X_LIKELY(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch()) #define GET_CURRENT_CONTEXT(C) C = (typeof(C)) \ - (likely(_glapi_Context) ? _glapi_Context : _glapi_get_context()) + (_X_LIKELY(_glapi_Context) ? _glapi_Context : _glapi_get_context()) -#define SET_CURRENT_CONTEXT(C) do { if (likely(_glapi_Context)) \ +#define SET_CURRENT_CONTEXT(C) do { if (_X_LIKELY(_glapi_Context)) \ _glapi_Context = (void*)C; \ else \ _glapi_set_context(C); } while(0) |