diff options
author | Dylan Baker <[email protected]> | 2018-08-21 09:46:46 -0700 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2018-09-07 10:21:26 -0700 |
commit | 8396043f304bb2a752130230055605c5c966e89f (patch) | |
tree | ee2e8a5494b88bff3b5e67ece8ffdba70d12c087 /src/mesa/drivers/x11 | |
parent | 80825abb5d1a7491035880253ffd531c55acae6b (diff) |
Replace uses of _mesa_bitcount with util_bitcount
and _mesa_bitcount_64 with util_bitcount_64. This fixes a build problem
in nir for platforms that don't have popcount or popcountll, such as
32bit msvc.
v2: - Fix additional uses of _mesa_bitcount added after this was
originally written
Acked-by: Eric Engestrom <[email protected]> (v1)
Acked-by: Eric Anholt <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r-- | src/mesa/drivers/x11/Makefile.am | 1 | ||||
-rw-r--r-- | src/mesa/drivers/x11/fakeglx.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/x11/meson.build | 2 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_api.c | 17 |
4 files changed, 15 insertions, 12 deletions
diff --git a/src/mesa/drivers/x11/Makefile.am b/src/mesa/drivers/x11/Makefile.am index c256ce0d34f..3024c549e61 100644 --- a/src/mesa/drivers/x11/Makefile.am +++ b/src/mesa/drivers/x11/Makefile.am @@ -68,6 +68,7 @@ GL_PATCH = 0 lib@GL_LIB@_la_LIBADD = \ $(top_builddir)/src/mesa/libmesa.la \ $(top_builddir)/src/mapi/glapi/libglapi.la \ + $(top_builddir)/src/util/libmesautil.la \ $(SHARED_GLAPI_LIB) \ $(GL_LIB_DEPS) diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index b946521b951..e6d488c4dc3 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -52,6 +52,7 @@ #include "main/version.h" #include "xfonts.h" #include "xmesaP.h" +#include "util/u_math.h" /* This indicates the client-side GLX API and GLX encoder version. */ #define CLIENT_MAJOR_VERSION 1 @@ -510,9 +511,9 @@ get_visual( Display *dpy, int scr, unsigned int depth, int xclass ) * 10 bits per color channel. Mesa's limited to a max of 8 bits/channel. */ if (vis && depth > 24 && (xclass==TrueColor || xclass==DirectColor)) { - if (_mesa_bitcount((GLuint) vis->red_mask ) <= 8 && - _mesa_bitcount((GLuint) vis->green_mask) <= 8 && - _mesa_bitcount((GLuint) vis->blue_mask ) <= 8) { + if (util_bitcount((GLuint) vis->red_mask ) <= 8 && + util_bitcount((GLuint) vis->green_mask) <= 8 && + util_bitcount((GLuint) vis->blue_mask ) <= 8) { return vis; } else { diff --git a/src/mesa/drivers/x11/meson.build b/src/mesa/drivers/x11/meson.build index bb4fda14cb8..cb092d25d6c 100644 --- a/src/mesa/drivers/x11/meson.build +++ b/src/mesa/drivers/x11/meson.build @@ -32,7 +32,7 @@ libgl = shared_library( include_directories : [ inc_include, inc_src, inc_mesa, inc_mapi, inc_gallium, inc_gallium_aux ], - link_with : [libmesa_classic, libglapi_static, gl_link_with], + link_with : [libmesa_classic, libglapi_static, libmesa_util, gl_link_with], dependencies : [dep_x11, dep_xext, dep_xcb, dep_thread], version : '1.6.0', install : true, diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 3d54193580e..cb8b58b8d96 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -84,6 +84,7 @@ #include "tnl/t_pipeline.h" #include "drivers/common/driverfuncs.h" #include "drivers/common/meta.h" +#include "util/u_math.h" /** * Global X driver lock @@ -463,9 +464,9 @@ setup_truecolor(XMesaVisual v, XMesaBuffer buffer, XMesaColormap cmap) 3*16, 11*16, 1*16, 9*16, 15*16, 7*16, 13*16, 5*16, }; - GLint rBits = _mesa_bitcount(rmask); - GLint gBits = _mesa_bitcount(gmask); - GLint bBits = _mesa_bitcount(bmask); + GLint rBits = util_bitcount(rmask); + GLint gBits = util_bitcount(gmask); + GLint bBits = util_bitcount(bmask); GLint maxBits; GLuint i; @@ -828,9 +829,9 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, { const int xclass = v->visualType; if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) { - red_bits = _mesa_bitcount(GET_REDMASK(v)); - green_bits = _mesa_bitcount(GET_GREENMASK(v)); - blue_bits = _mesa_bitcount(GET_BLUEMASK(v)); + red_bits = util_bitcount(GET_REDMASK(v)); + green_bits = util_bitcount(GET_GREENMASK(v)); + blue_bits = util_bitcount(GET_BLUEMASK(v)); } else { /* this is an approximation */ @@ -1095,8 +1096,8 @@ XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p, if (ctx->Extensions.ARB_texture_non_power_of_two) { target = GLX_TEXTURE_2D_EXT; } - else if ( _mesa_bitcount(width) == 1 - && _mesa_bitcount(height) == 1) { + else if ( util_bitcount(width) == 1 + && util_bitcount(height) == 1) { /* power of two size */ if (height == 1) { target = GLX_TEXTURE_1D_EXT; |