...
  View open merge request
Commits (29)
......@@ -39,9 +39,9 @@
//
#include "util/u_endian.h"
#if defined(PIPE_ARCH_LITTLE_ENDIAN)
#if UTIL_ARCH_LITTLE_ENDIAN
#define LITTLEENDIAN_CPU
#elif defined(PIPE_ARCH_BIG_ENDIAN)
#elif UTIL_ARCH_BIG_ENDIAN
#define BIGENDIAN_CPU
#endif
......
......@@ -39,9 +39,9 @@
//
#include "util/u_endian.h"
#if defined(PIPE_ARCH_LITTLE_ENDIAN)
#if UTIL_ARCH_LITTLE_ENDIAN
#define LITTLEENDIAN_CPU
#elif defined(PIPE_ARCH_BIG_ENDIAN)
#elif UTIL_ARCH_BIG_ENDIAN
#define BIGENDIAN_CPU
#endif
......
......@@ -40,9 +40,9 @@
//
#include "util/u_endian.h"
#if defined(PIPE_ARCH_LITTLE_ENDIAN)
#if UTIL_ARCH_LITTLE_ENDIAN
#define LITTLEENDIAN_CPU
#elif defined(PIPE_ARCH_BIG_ENDIAN)
#elif UTIL_ARCH_BIG_ENDIAN
#define BIGENDIAN_CPU
#endif
......
......@@ -40,8 +40,6 @@ struct radeon_info;
struct ac_surf_info;
struct radeon_surf;
#define FREE(x) free(x)
enum radeon_bo_domain { /* bitfield */
RADEON_DOMAIN_GTT = 2,
RADEON_DOMAIN_VRAM = 4,
......
......@@ -80,7 +80,7 @@ def print_channels(format, func):
if format.nr_channels() <= 1:
func(format.le_channels, format.le_swizzles)
else:
print('#ifdef PIPE_ARCH_BIG_ENDIAN')
print('#if UTIL_ARCH_BIG_ENDIAN')
func(format.be_channels, format.be_swizzles)
print('#else')
func(format.le_channels, format.le_swizzles)
......
......@@ -37,6 +37,7 @@
#include <unistd.h>
#include "util/u_atomic.h"
#include "util/u_memory.h"
static void radv_amdgpu_winsys_bo_destroy(struct radeon_winsys_bo *_bo);
......@@ -282,7 +283,7 @@ static void radv_amdgpu_winsys_bo_destroy(struct radeon_winsys_bo *_bo)
-align64(bo->size, ws->info.gart_page_size));
amdgpu_va_range_free(bo->va_handle);
FREE(bo);
free(bo);
}
static void radv_amdgpu_add_buffer_to_global_list(struct radv_amdgpu_winsys_bo *bo)
......@@ -418,7 +419,7 @@ error_bo_alloc:
amdgpu_va_range_free(va_handle);
error_va_alloc:
FREE(bo);
free(bo);
return NULL;
}
......@@ -523,7 +524,7 @@ error_va_alloc:
amdgpu_bo_free(buf_handle);
error:
FREE(bo);
free(bo);
return NULL;
}
......@@ -599,7 +600,7 @@ error_query:
amdgpu_bo_free(result.buf_handle);
error:
FREE(bo);
free(bo);
return NULL;
}
......
......@@ -29,6 +29,8 @@
#include <pthread.h>
#include <errno.h>
#include "util/u_memory.h"
#include "ac_debug.h"
#include "radv_radeon_winsys.h"
#include "radv_amdgpu_cs.h"
......@@ -1345,7 +1347,7 @@ static struct radeon_winsys_ctx *radv_amdgpu_ctx_create(struct radeon_winsys *_w
memset(ctx->fence_map, 0, 4096);
return (struct radeon_winsys_ctx *)ctx;
error_create:
FREE(ctx);
free(ctx);
return NULL;
}
......@@ -1354,7 +1356,7 @@ static void radv_amdgpu_ctx_destroy(struct radeon_winsys_ctx *rwctx)
struct radv_amdgpu_ctx *ctx = (struct radv_amdgpu_ctx *)rwctx;
ctx->ws->base.buffer_destroy(ctx->fence_bo);
amdgpu_cs_ctx_free(ctx->ctx);
FREE(ctx);
free(ctx);
}
static bool radv_amdgpu_ctx_wait_idle(struct radeon_winsys_ctx *rwctx,
......@@ -1387,7 +1389,7 @@ static struct radeon_winsys_sem *radv_amdgpu_create_sem(struct radeon_winsys *_w
static void radv_amdgpu_destroy_sem(struct radeon_winsys_sem *_sem)
{
struct amdgpu_cs_fence *sem = (struct amdgpu_cs_fence *)_sem;
FREE(sem);
free(sem);
}
static int radv_amdgpu_signal_sems(struct radv_amdgpu_ctx *ctx,
......
......@@ -158,7 +158,7 @@ static void radv_amdgpu_winsys_destroy(struct radeon_winsys *rws)
AddrDestroy(ws->addrlib);
amdgpu_device_deinitialize(ws->dev);
FREE(rws);
free(rws);
}
struct radeon_winsys *
......
......@@ -69,7 +69,6 @@ if env['msvc']:
# Copy these files to avoid generation object files into src/mesa/program
env.Prepend(CPPPATH = ['#src/mesa/main'])
env.Command('glsl/imports.c', '#src/mesa/main/imports.c', Copy('$TARGET', '$SOURCE'))
env.Command('glsl/extensions_table.c', '#src/mesa/main/extensions_table.c', Copy('$TARGET', '$SOURCE'))
# Copy these files to avoid generation object files into src/mesa/program
env.Prepend(CPPPATH = ['#src/mesa/program'])
......@@ -80,7 +79,6 @@ compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_FILES'])
mesa_objs = env.StaticObject([
'glsl/extensions_table.c',
'glsl/imports.c',
'glsl/symbol_table.c',
'glsl/dummy_errors.c',
])
......
......@@ -33,6 +33,7 @@
#include "glsl_parser_extras.h"
#include "compiler/glsl_types.h"
#include "main/context.h"
#include "util/u_string.h"
#ifdef _MSC_VER
#pragma warning( disable : 4065 ) // switch statement contains 'default' but no 'case' labels
......@@ -74,7 +75,7 @@ static bool match_layout_qualifier(const char *s1, const char *s2,
if (state->es_shader)
return strcmp(s1, s2);
else
return strcasecmp(s1, s2);
return util_strcasecmp(s1, s2);
}
%}
......
......@@ -36,7 +36,6 @@
#include "compiler/nir/nir_builder.h"
#include "compiler/nir/nir_deref.h"
#include "main/errors.h"
#include "main/imports.h"
#include "main/mtypes.h"
#include "main/shaderobj.h"
#include "util/u_math.h"
......
......@@ -86,7 +86,6 @@
#include "util/u_string.h"
#include "util/u_math.h"
#include "main/imports.h"
#include "main/shaderobj.h"
#include "main/enums.h"
#include "main/mtypes.h"
......
......@@ -26,7 +26,6 @@
*/
#include "nir.h"
#include <main/imports.h>
/**
* SSA-based copy propagation
......
......@@ -80,7 +80,7 @@ def print_channels(format, func):
if format.nr_channels() <= 1:
func(format.le_channels, format.le_swizzles)
else:
print('#ifdef PIPE_ARCH_BIG_ENDIAN')
print('#if UTIL_ARCH_BIG_ENDIAN')
func(format.be_channels, format.be_swizzles)
print('#else')
func(format.le_channels, format.le_swizzles)
......
......@@ -861,7 +861,7 @@ static LLVMValueRef
adjust_mask(struct gallivm_state *gallivm,
LLVMValueRef mask)
{
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
LLVMBuilderRef builder = gallivm->builder;
LLVMValueRef vertex_id;
LLVMValueRef clipmask;
......
......@@ -365,7 +365,7 @@ lp_build_rgba8_to_fi32_soa(struct gallivm_state *gallivm,
/* Decode the input vector components */
for (chan = 0; chan < 4; ++chan) {
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
unsigned start = chan*8;
#else
unsigned start = (3-chan)*8;
......@@ -652,7 +652,7 @@ lp_build_fetch_rgba_soa(struct gallivm_state *gallivm,
unsigned blockbits = type.width;
unsigned vec_nr;
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
vec_nr = (format_desc->block.bits - (chan_desc.shift + chan_desc.size)) / type.width;
#else
vec_nr = chan_desc.shift / type.width;
......
......@@ -104,7 +104,7 @@ uyvy_to_yuv_soa(struct gallivm_state *gallivm,
#endif
{
LLVMValueRef shift;
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
shift = LLVMBuildMul(builder, i, lp_build_const_int_vec(gallivm, type, 16), "");
shift = LLVMBuildAdd(builder, shift, lp_build_const_int_vec(gallivm, type, 8), "");
#else
......@@ -114,7 +114,7 @@ uyvy_to_yuv_soa(struct gallivm_state *gallivm,
*y = LLVMBuildLShr(builder, packed, shift, "");
}
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
*u = packed;
*v = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(gallivm, type, 16), "");
#else
......@@ -187,7 +187,7 @@ yuyv_to_yuv_soa(struct gallivm_state *gallivm,
#endif
{
LLVMValueRef shift;
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
shift = LLVMBuildMul(builder, i, lp_build_const_int_vec(gallivm, type, 16), "");
#else
shift = LLVMBuildMul(builder, i, lp_build_const_int_vec(gallivm, type, -16), "");
......@@ -196,7 +196,7 @@ yuyv_to_yuv_soa(struct gallivm_state *gallivm,
*y = LLVMBuildLShr(builder, packed, shift, "");
}
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
*u = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(gallivm, type, 8), "");
*v = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(gallivm, type, 24), "");
#else
......@@ -334,7 +334,7 @@ rgb_to_rgba_aos(struct gallivm_state *gallivm,
* Make a 4 x unorm8 vector
*/
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
r = r;
g = LLVMBuildShl(builder, g, lp_build_const_int_vec(gallivm, type, 8), "");
b = LLVMBuildShl(builder, b, lp_build_const_int_vec(gallivm, type, 16), "");
......
......@@ -141,7 +141,7 @@ lp_build_gather_elem(struct gallivm_state *gallivm,
if (src_width < dst_width) {
res = LLVMBuildZExt(gallivm->builder, res, dst_elem_type, "");
if (vector_justify) {
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
res = LLVMBuildShl(gallivm->builder, res,
LLVMConstInt(dst_elem_type, dst_width - src_width, 0), "");
#endif
......@@ -234,7 +234,7 @@ lp_build_gather_elem_vec(struct gallivm_state *gallivm,
*/
res = LLVMBuildZExt(gallivm->builder, res, dst_elem_type, "");
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
if (vector_justify) {
res = LLVMBuildShl(gallivm->builder, res,
LLVMConstInt(dst_elem_type,
......@@ -553,7 +553,7 @@ lp_build_gather(struct gallivm_state *gallivm,
if (vec_zext) {
res = LLVMBuildZExt(gallivm->builder, res, res_t, "");
if (vector_justify) {
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
unsigned sv = dst_type.width - src_width;
res = LLVMBuildShl(gallivm->builder, res,
lp_build_const_int_vec(gallivm, res_type, sv), "");
......
......@@ -373,7 +373,7 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name,
const unsigned pointer_size = 8 * sizeof(void *);
char layout[512];
util_snprintf(layout, sizeof layout, "%c-p:%u:%u:%u-i64:64:64-a0:0:%u-s0:%u:%u",
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
'e', // little endian
#else
'E', // big endian
......
......@@ -692,7 +692,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
* when not using MCJIT so no instructions are generated which the old JIT
* can't handle. Not entirely sure if we really need to do anything yet.
*/
#if defined(PIPE_ARCH_LITTLE_ENDIAN) && defined(PIPE_ARCH_PPC_64)
#if UTIL_ARCH_LITTLE_ENDIAN && defined(PIPE_ARCH_PPC_64)
/*
* Versions of LLVM prior to 4.0 lacked a table entry for "POWER8NVL",
* resulting in (big-endian) "generic" being returned on
......
......@@ -166,7 +166,7 @@ lp_build_const_pack_shuffle(struct gallivm_state *gallivm, unsigned n)
assert(n <= LP_MAX_VECTOR_LENGTH);
for(i = 0; i < n; ++i)
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
elems[i] = lp_build_const_int32(gallivm, 2*i);
#else
elems[i] = lp_build_const_int32(gallivm, 2*i+1);
......@@ -429,7 +429,7 @@ lp_build_unpack2(struct gallivm_state *gallivm,
msb = lp_build_zero(gallivm, src_type);
/* Interleave bits */
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
*dst_lo = lp_build_interleave2(gallivm, src_type, src, msb, 0);
*dst_hi = lp_build_interleave2(gallivm, src_type, src, msb, 1);
......@@ -483,7 +483,7 @@ lp_build_unpack2_native(struct gallivm_state *gallivm,
msb = lp_build_zero(gallivm, src_type);
/* Interleave bits */
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
if (src_type.length * src_type.width == 256 && util_cpu_caps.has_avx2) {
*dst_lo = lp_build_interleave2_half(gallivm, src_type, src, msb, 0);
*dst_hi = lp_build_interleave2_half(gallivm, src_type, src, msb, 1);
......@@ -606,7 +606,7 @@ lp_build_pack2(struct gallivm_state *gallivm,
} else {
intrinsic = "llvm.ppc.altivec.vpkuwus";
}
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
swap_intrinsic_operands = TRUE;
#endif
}
......@@ -617,7 +617,7 @@ lp_build_pack2(struct gallivm_state *gallivm,
intrinsic = "llvm.x86.sse2.packsswb.128";
} else if (util_cpu_caps.has_altivec) {
intrinsic = "llvm.ppc.altivec.vpkshss";
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
swap_intrinsic_operands = TRUE;
#endif
}
......@@ -626,7 +626,7 @@ lp_build_pack2(struct gallivm_state *gallivm,
intrinsic = "llvm.x86.sse2.packuswb.128";
} else if (util_cpu_caps.has_altivec) {
intrinsic = "llvm.ppc.altivec.vpkshus";
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
swap_intrinsic_operands = TRUE;
#endif
}
......
......@@ -602,7 +602,7 @@ lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld,
r_fpart = LLVMBuildBitCast(builder, r_fpart, u8n_vec_type, "");
for (j = 0; j < u8n.type.length; j += 4) {
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
unsigned subindex = 0;
#else
unsigned subindex = 3;
......
......@@ -222,7 +222,7 @@ lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
* XX XX XX XX if shift right (shift == -1)
*
*/
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
shift = channel == 0 ? 1 : -1;
#else
shift = channel == 0 ? -1 : 1;
......@@ -293,7 +293,7 @@ lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
int shift = shifts[channel][i];
/* See endianness diagram above */
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
shift = -shift;
#endif
......@@ -519,7 +519,7 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
for (chan = 0; chan < 4; ++chan) {
if (swizzles[chan] < 4) {
/* We need to move channel swizzles[chan] into channel chan */
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
if (swizzles[chan] - chan == -shift) {
mask |= ((1ULL << type.width) - 1) << (swizzles[chan] * type.width);
}
......
......@@ -64,7 +64,7 @@ def print_channels(format, func):
if format.nr_channels() <= 1:
func(format.le_channels, format.le_swizzles)
else:
print('#ifdef PIPE_ARCH_BIG_ENDIAN')
print('#if UTIL_ARCH_BIG_ENDIAN')
func(format.be_channels, format.be_swizzles)
print('#else')
func(format.le_channels, format.le_swizzles)
......
......@@ -32,7 +32,7 @@
#ifndef U_PWR8_H_
#define U_PWR8_H_
#if defined(_ARCH_PWR8) && defined(PIPE_ARCH_LITTLE_ENDIAN)
#if defined(_ARCH_PWR8) && UTIL_ARCH_LITTLE_ENDIAN
#define VECTOR_ALIGN_16 __attribute__ ((__aligned__ (16)))
......@@ -53,7 +53,7 @@ vec_set_epi32 (int i3, int i2, int i1, int i0)
{
__m128i_union vdst;
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
vdst.i[0] = i0;
vdst.i[1] = i1;
vdst.i[2] = i2;
......@@ -78,7 +78,7 @@ static inline __m128i
vec_unpacklo_epi32 (__m128i even, __m128i odd)
{
static const __m128i perm_mask =
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
{ 0, 1, 2, 3, 16, 17, 18, 19, 4, 5, 6, 7, 20, 21, 22, 23};
#else
{24, 25, 26, 27, 8, 9, 10, 11, 28, 29, 30, 31, 12, 13, 14, 15};
......@@ -91,7 +91,7 @@ static inline __m128i
vec_unpackhi_epi32 (__m128i even, __m128i odd)
{
static const __m128i perm_mask =
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
{ 8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31};
#else
{16, 17, 18, 19, 0, 1, 2, 3, 20, 21, 22, 23, 4, 5, 6, 7};
......@@ -104,7 +104,7 @@ static inline __m128i
vec_unpacklo_epi64 (__m128i even, __m128i odd)
{
static const __m128i perm_mask =
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
{ 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23};
#else
{24, 25, 26, 27, 28, 29, 30, 31, 8, 9, 10, 11, 12, 13, 14, 15};
......@@ -117,7 +117,7 @@ static inline __m128i
vec_unpackhi_epi64 (__m128i even, __m128i odd)
{
static const __m128i perm_mask =
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
{ 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31};
#else
{16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6, 7};
......@@ -236,7 +236,7 @@ vec_loadu_si128 (const uint32_t* src)
{
__m128i_union vsrc;
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
vsrc.m128ui = *((vector unsigned int *) src);
......@@ -280,7 +280,7 @@ vec_movemask_epi8 (__m128i vsrc)
vtemp.m128i = vec_vgbbd(vsrc);
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
result = vtemp.ub[15] << 8 | vtemp.ub[7];
#else
result = vtemp.ub[0] << 8 | vtemp.ub[8];
......@@ -292,7 +292,7 @@ vec_movemask_epi8 (__m128i vsrc)
static inline __m128i
vec_packs_epi16 (__m128i a, __m128i b)
{
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
return (__m128i) vec_packs ((vector signed short) a,
(vector signed short) b);
#else
......@@ -304,13 +304,13 @@ vec_packs_epi16 (__m128i a, __m128i b)
static inline __m128i
vec_packs_epi32 (__m128i a, __m128i b)
{
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
return (__m128i) vec_packs ((vector signed int) a, (vector signed int) b);
#else
return (__m128i) vec_packs ((vector signed int) b, (vector signed int) a);
#endif
}
#endif /* _ARCH_PWR8 && PIPE_ARCH_LITTLE_ENDIAN */
#endif /* _ARCH_PWR8 && UTIL_ARCH_LITTLE_ENDIAN */
#endif /* U_PWR8_H_ */
......@@ -151,7 +151,7 @@ vl_vlc_fillbits(struct vl_vlc *vlc)
/* enough bytes in buffer, read in a whole dword */
uint64_t value = *(const uint32_t*)vlc->data;
#ifndef PIPE_ARCH_BIG_ENDIAN
#if !UTIL_ARCH_BIG_ENDIAN
value = util_bswap32(value);
#endif
......
......@@ -92,6 +92,7 @@
#include "util/u_inlines.h"
#include "util/u_format.h"
#include "util/u_framebuffer.h"
#include "util/u_memory.h"
#include "util/u_transfer.h"
#include "util/u_upload_mgr.h"
#include "util/u_viewport.h"
......
......@@ -436,7 +436,7 @@ lp_rast_triangle_32_3_4(struct lp_rasterizer_task *task,
#else
#if defined(_ARCH_PWR8) && defined(PIPE_ARCH_LITTLE_ENDIAN)
#if defined(_ARCH_PWR8) && UTIL_ARCH_LITTLE_ENDIAN
#include <altivec.h>
#include "util/u_pwr8.h"
......@@ -556,7 +556,7 @@ lp_rast_triangle_32_3_16(struct lp_rasterizer_task *task,
__m128i vshuf_mask1;
__m128i vshuf_mask2;
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
vshuf_mask0 = (__m128i) vec_splats((unsigned int) 0x03020100);
vshuf_mask1 = (__m128i) vec_splats((unsigned int) 0x07060504);
vshuf_mask2 = (__m128i) vec_splats((unsigned int) 0x0B0A0908);
......@@ -662,7 +662,7 @@ lp_rast_triangle_32_3_16(struct lp_rasterizer_task *task,
lp_rast_triangle_32_3(task, arg2);
}
#endif /* _ARCH_PWR8 && PIPE_ARCH_LITTLE_ENDIAN */
#endif /* _ARCH_PWR8 && UTIL_ARCH_LITTLE_ENDIAN */
void
lp_rast_triangle_32_4_16(struct lp_rasterizer_task *task,
......@@ -687,7 +687,7 @@ lp_rast_triangle_32_3_4(struct lp_rasterizer_task *task,
#if defined PIPE_ARCH_SSE
#define BUILD_MASKS(c, cdiff, dcdx, dcdy, omask, pmask) build_masks_sse((int)c, (int)cdiff, dcdx, dcdy, omask, pmask)
#define BUILD_MASK_LINEAR(c, dcdx, dcdy) build_mask_linear_sse((int)c, dcdx, dcdy)
#elif (defined(_ARCH_PWR8) && defined(PIPE_ARCH_LITTLE_ENDIAN))
#elif (defined(_ARCH_PWR8) && UTIL_ARCH_LITTLE_ENDIAN)
#define BUILD_MASKS(c, cdiff, dcdx, dcdy, omask, pmask) build_masks_ppc((int)c, (int)cdiff, dcdx, dcdy, omask, pmask)
#define BUILD_MASK_LINEAR(c, dcdx, dcdy) build_mask_linear_ppc((int)c, dcdx, dcdy)
#else
......
......@@ -46,7 +46,7 @@
#if defined(PIPE_ARCH_SSE)
#include <emmintrin.h>
#elif defined(_ARCH_PWR8) && defined(PIPE_ARCH_LITTLE_ENDIAN)
#elif defined(_ARCH_PWR8) && UTIL_ARCH_LITTLE_ENDIAN
#include <altivec.h>
#include "util/u_pwr8.h"
#endif
......@@ -489,7 +489,7 @@ do_triangle_ccw(struct lp_setup_context *setup,
eo = _mm_shuffle_epi32(eo, _MM_SHUFFLE(0,0,0,2));
plane[2].eo = (uint32_t)_mm_cvtsi128_si32(eo);
} else
#elif defined(_ARCH_PWR8) && defined(PIPE_ARCH_LITTLE_ENDIAN)
#elif defined(_ARCH_PWR8) && UTIL_ARCH_LITTLE_ENDIAN
/*
* XXX this code is effectively disabled for all practical purposes,
* as the allowed fb size is tiny if FIXED_ORDER is 8.
......@@ -513,7 +513,7 @@ do_triangle_ccw(struct lp_setup_context *setup,
__m128i zero = vec_splats((unsigned char) 0);
PIPE_ALIGN_VAR(16) int32_t temp_vec[4];
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
vshuf_mask.i[0] = 0x07060504;
vshuf_mask.i[1] = 0x0B0A0908;
vshuf_mask.i[2] = 0x03020100;
......
......@@ -1380,7 +1380,7 @@ convert_to_blend_type(struct gallivm_state *gallivm,
for (j = 0; j < src_fmt->nr_channels; ++j) {
unsigned mask = 0;
unsigned sa = src_fmt->channel[j].shift;
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
unsigned from_lsb = j;
#else
unsigned from_lsb = src_fmt->nr_channels - j - 1;
......@@ -1562,7 +1562,7 @@ convert_from_blend_type(struct gallivm_state *gallivm,
for (j = 0; j < src_fmt->nr_channels; ++j) {
unsigned mask = 0;
unsigned sa = src_fmt->channel[j].shift;
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
unsigned from_lsb = j;
#else
unsigned from_lsb = src_fmt->nr_channels - j - 1;
......
......@@ -41,7 +41,7 @@ nv30_fragprog_upload(struct nv30_context *nv30)
if (unlikely(!fp->buffer))
fp->buffer = pipe_buffer_create(pipe->screen, 0, 0, fp->insn_len * 4);
#ifndef PIPE_ARCH_BIG_ENDIAN
#if !UTIL_ARCH_BIG_ENDIAN
pipe_buffer_write(pipe, fp->buffer, 0, fp->insn_len * 4, fp->insn);
#else
{
......
......@@ -192,7 +192,7 @@ nv30_vbo_validate(struct nv30_context *nv30)
if (!nv30->vertex || nv30->draw_flags)
return;
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
if (1) { /* Figure out where the buffers are getting messed up */
#else
if (unlikely(vertex->need_conversion)) {
......
......@@ -33,7 +33,6 @@
#include "main/mtypes.h"
#include "compiler/glsl/glsl_to_nir.h"
#include "compiler/nir_types.h"
#include "main/imports.h"
#include "compiler/nir/nir_builder.h"
#include "util/half_float.h"
#include "util/u_math.h"
......
......@@ -1157,7 +1157,7 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
rs->rs_draw.offset_tri = 0;
rs->rs_draw.offset_clamp = 0;
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
vap_control_status = R300_VC_NO_SWAP;
#else
vap_control_status = R300_VC_32BIT_SWAP;
......
......@@ -118,7 +118,7 @@ enum r600_coherency {
R600_COHERENCY_CB_META,
};
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
#define R600_BIG_ENDIAN 1
#else
#define R600_BIG_ENDIAN 0
......
......@@ -1775,7 +1775,7 @@ void evergreen_do_fast_color_clear(struct r600_common_context *rctx,
int i;
/* This function is broken in BE, so just disable this path for now */
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
return;
#endif
......
......@@ -392,7 +392,7 @@ static void si_do_fast_color_clear(struct si_context *sctx,
int i;
/* This function is broken in BE, so just disable this path for now */
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
return;
#endif
......
......@@ -32,7 +32,7 @@
#include "util/u_idalloc.h"
#include "util/u_threaded_context.h"
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
#define SI_BIG_ENDIAN 1
#else
#define SI_BIG_ENDIAN 0
......@@ -759,7 +759,7 @@ struct si_shader_ctx_state {
*/
union si_vgt_param_key {
struct {
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
unsigned prim:4;
unsigned uses_instancing:1;
unsigned multi_instances_smaller_than_primgroup:1;
......@@ -770,7 +770,7 @@ union si_vgt_param_key {
unsigned tess_uses_prim_id:1;
unsigned uses_gs:1;
unsigned _pad:32 - SI_NUM_VGT_PARAM_KEY_BITS;
#else /* PIPE_ARCH_BIG_ENDIAN */
#else /* UTIL_ARCH_BIG_ENDIAN */
unsigned _pad:32 - SI_NUM_VGT_PARAM_KEY_BITS;
unsigned uses_gs:1;
unsigned tess_uses_prim_id:1;
......@@ -794,13 +794,13 @@ union si_vgt_param_key {
*/
union si_vgt_stages_key {
struct {
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
unsigned tess:1;
unsigned gs:1;
unsigned ngg:1; /* gfx10+ */
unsigned streamout:1; /* only used with NGG */
unsigned _pad:32 - SI_NUM_VGT_STAGES_KEY_BITS;
#else /* PIPE_ARCH_BIG_ENDIAN */
#else /* UTIL_ARCH_BIG_ENDIAN */
unsigned _pad:32 - SI_NUM_VGT_STAGES_KEY_BITS;
unsigned streamout:1;
unsigned ngg:1;
......
......@@ -127,17 +127,17 @@
*/
#include "util/u_endian.h"
#if !defined(PIPE_ARCH_LITTLE_ENDIAN) && !defined(PIPE_ARCH_BIG_ENDIAN)
#if !UTIL_ARCH_LITTLE_ENDIAN && !UTIL_ARCH_BIG_ENDIAN
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) || defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64)
#define PIPE_ARCH_LITTLE_ENDIAN
#define UTIL_ARCH_LITTLE_ENDIAN
#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390)
#define PIPE_ARCH_BIG_ENDIAN
#define UTIL_ARCH_BIG_ENDIAN
#endif
#endif
#if !defined(PIPE_ARCH_LITTLE_ENDIAN) && !defined(PIPE_ARCH_BIG_ENDIAN)
#if !UTIL_ARCH_LITTLE_ENDIAN && !UTIL_ARCH_BIG_ENDIAN
#error Unknown Endianness
#endif
......
......@@ -908,9 +908,9 @@ enum pipe_endian
{
PIPE_ENDIAN_LITTLE = 0,
PIPE_ENDIAN_BIG = 1,
#if defined(PIPE_ARCH_LITTLE_ENDIAN)
#if UTIL_ARCH_LITTLE_ENDIAN
PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_LITTLE
#elif defined(PIPE_ARCH_BIG_ENDIAN)
#elif UTIL_ARCH_BIG_ENDIAN
PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_BIG
#endif
};
......
......@@ -412,7 +412,7 @@ enum pipe_format {
PIPE_FORMAT_COUNT
};
#if defined(PIPE_ARCH_LITTLE_ENDIAN)
#if UTIL_ARCH_LITTLE_ENDIAN
#define PIPE_FORMAT_RGBA8888_UNORM PIPE_FORMAT_R8G8B8A8_UNORM
#define PIPE_FORMAT_RGBX8888_UNORM PIPE_FORMAT_R8G8B8X8_UNORM
#define PIPE_FORMAT_BGRA8888_UNORM PIPE_FORMAT_B8G8R8A8_UNORM
......@@ -449,7 +449,7 @@ enum pipe_format {
#define PIPE_FORMAT_GR1616_UNORM PIPE_FORMAT_G16R16_UNORM
#define PIPE_FORMAT_RG1616_SNORM PIPE_FORMAT_R16G16_SNORM
#define PIPE_FORMAT_GR1616_SNORM PIPE_FORMAT_G16R16_SNORM
#elif defined(PIPE_ARCH_BIG_ENDIAN)
#elif UTIL_ARCH_BIG_ENDIAN
#define PIPE_FORMAT_ABGR8888_UNORM PIPE_FORMAT_R8G8B8A8_UNORM
#define PIPE_FORMAT_XBGR8888_UNORM PIPE_FORMAT_R8G8B8X8_UNORM
#define PIPE_FORMAT_ARGB8888_UNORM PIPE_FORMAT_B8G8R8A8_UNORM
......
......@@ -40,6 +40,8 @@
#include "pipe-loader/pipe_loader.h"
#include "state_tracker/st_context.h"
#include "util/u_memory.h"
GLboolean
dri_create_context(gl_api api, const struct gl_config * visual,
__DRIcontext * cPriv,
......
......@@ -39,9 +39,9 @@
#include <GL/glxproto.h>
#include "xm_api.h"
#include "main/imports.h"
#include "main/errors.h"
#include "util/u_math.h"
#include "util/u_memory.h"
/* An "Atrribs/Attribs" typo was fixed in glxproto.h in Nov 2014.
* This is in case we don't have the updated header.
......
......@@ -66,11 +66,11 @@
#include "util/u_atomic.h"
#include "util/u_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "hud/hud_context.h"
#include "main/errors.h"
#include "main/imports.h"
#include "xm_public.h"
#include <GL/glx.h>
......
......@@ -558,7 +558,7 @@ gen7_set_dp_scratch_message(struct brw_codegen *p,
const struct gen_device_info *devinfo = p->devinfo;
assert(num_regs == 1 || num_regs == 2 || num_regs == 4 ||
(devinfo->gen >= 8 && num_regs == 8));
const unsigned block_size = (devinfo->gen >= 8 ? _mesa_logbase2(num_regs) :
const unsigned block_size = (devinfo->gen >= 8 ? util_logbase2(num_regs) :
num_regs - 1);
brw_set_desc(p, inst, brw_message_desc(
......@@ -3300,7 +3300,7 @@ brw_broadcast(struct brw_codegen *p,
/* Take into account the component size and horizontal stride. */
assert(src.vstride == src.hstride + src.width);
brw_SHL(p, addr, vec1(idx),
brw_imm_ud(_mesa_logbase2(type_sz(src.type)) +
brw_imm_ud(util_logbase2(type_sz(src.type)) +
src.hstride - 1));
/* We can only address up to limit bytes using the indirect
......
......@@ -5904,7 +5904,7 @@ get_fpu_lowered_simd_width(const struct gen_device_info *devinfo,
/* Only power-of-two execution sizes are representable in the instruction
* control fields.
*/
return 1 << _mesa_logbase2(max_width);
return 1 << util_logbase2(max_width);
}
/**
......
......@@ -581,7 +581,7 @@ fs_generator::generate_shuffle(fs_inst *inst,
/* Take into account the component size and horizontal stride. */
assert(src.vstride == src.hstride + src.width);
brw_SHL(p, addr, group_idx,
brw_imm_uw(_mesa_logbase2(type_sz(src.type)) +
brw_imm_uw(util_logbase2(type_sz(src.type)) +
src.hstride - 1));
/* Add on the register start offset */
......
......@@ -77,7 +77,7 @@ brw_alloc_reg_set(struct brw_compiler *compiler, int dispatch_width)
{
const struct gen_device_info *devinfo = compiler->devinfo;
int base_reg_count = BRW_MAX_GRF;
const int index = _mesa_logbase2(dispatch_width / 8);
const int index = util_logbase2(dispatch_width / 8);
if (dispatch_width > 8 && devinfo->gen >= 7) {
/* For IVB+, we don't need the PLN hacks or the even-reg alignment in
......@@ -408,7 +408,7 @@ public:
* for reg_width == 2.
*/
int reg_width = fs->dispatch_width / 8;
rsi = _mesa_logbase2(reg_width);
rsi = util_logbase2(reg_width);
payload_node_count = ALIGN(fs->first_non_payload_grf, reg_width);
/* Get payload IP information */
......
......@@ -298,8 +298,8 @@ subscript(fs_reg reg, brw_reg_type type, unsigned i)
/* The stride is encoded inconsistently for fixed GRF and ARF registers
* as the log2 of the actual vertical and horizontal strides.
*/
const int delta = _mesa_logbase2(type_sz(reg.type)) -
_mesa_logbase2(type_sz(type));
const int delta = util_logbase2(type_sz(reg.type)) -
util_logbase2(type_sz(type));
reg.hstride += (reg.hstride ? delta : 0);
reg.vstride += (reg.vstride ? delta : 0);
......
......@@ -985,7 +985,7 @@ static inline struct brw_reg
spread(struct brw_reg reg, unsigned s)
{
if (s) {
assert(_mesa_is_pow_two(s));
assert(util_is_power_of_two_or_zero(s));
if (reg.hstride)
reg.hstride += cvt(s) - 1;
......
......@@ -2035,8 +2035,7 @@ generate_code(struct brw_codegen *p,
*
* where they pack the four bytes from the low and high four DW.
*/
assert(_mesa_is_pow_two(dst.writemask) &&
dst.writemask != 0);
assert(util_is_power_of_two_nonzero(dst.writemask));
unsigned offset = __builtin_ctz(dst.writemask);
dst.type = BRW_REGISTER_TYPE_UB;
......
......@@ -53,7 +53,7 @@
# endif
#elif defined(USE_X86_64_ASM) && defined(__GNUC__) && defined(GLX_USE_TLS)
# include "entry_x86-64_tls.h"
#elif defined(USE_PPC64LE_ASM) && defined(__GNUC__) && defined(PIPE_ARCH_LITTLE_ENDIAN)
#elif defined(USE_PPC64LE_ASM) && defined(__GNUC__) && UTIL_ARCH_LITTLE_ENDIAN
# ifdef GLX_USE_TLS
# include "entry_ppc64le_tls.h"
# else
......
......@@ -52,8 +52,8 @@ class PrintGlEnums(gl_XML.gl_print_base):
def printRealHeader(self):
print('#include "main/glheader.h"')
print('#include "main/enums.h"')
print('#include "main/imports.h"')
print('#include "main/mtypes.h"')
print('#include "util/u_string.h"')
print('')
print('typedef struct PACKED {')
print(' uint32_t offset;')
......@@ -103,7 +103,7 @@ _mesa_enum_to_string(int nr)
}
else {
/* this is not re-entrant safe, no big deal here */
_mesa_snprintf(token_tmp, sizeof(token_tmp) - 1, "0x%x", nr);
util_snprintf(token_tmp, sizeof(token_tmp) - 1, "0x%x", nr);
token_tmp[sizeof(token_tmp) - 1] = '\\0';
return token_tmp;
}
......
......@@ -89,7 +89,6 @@ header = """/**
#include "main/genmipmap.h"
#include "main/hint.h"
#include "main/histogram.h"
#include "main/imports.h"
#include "main/light.h"
#include "main/lines.h"
#include "main/matrix.h"
......
......@@ -101,6 +101,7 @@ class PrintRemapTable(gl_XML.gl_print_base):
* named function in the specified dispatch table.
*/
""")
print('#include "main/glheader.h"')
return
......
......@@ -43,7 +43,6 @@ LOCAL_C_INCLUDES := \
LOCAL_SRC_FILES := \
main/extensions_table.c \
main/imports.c \
program/symbol_table.c \
program/dummy_errors.c
......@@ -68,7 +67,6 @@ LOCAL_C_INCLUDES := \
LOCAL_SRC_FILES := \
main/extensions_table.c \
main/imports.c \
program/symbol_table.c \
program/dummy_errors.c
......
......@@ -134,8 +134,7 @@ MAIN_FILES = \
main/histogram.h \
main/image.c \
main/image.h \
main/imports.c \
main/imports.h \
main/mesa_private.h \
main/light.c \
main/light.h \
main/lines.c \
......
......@@ -24,7 +24,6 @@
#include "main/glheader.h"
#include "main/imports.h"
#include "main/accum.h"
#include "main/arrayobj.h"
#include "main/context.h"
......
......@@ -33,7 +33,6 @@
#include "main/glheader.h"
#include "main/mtypes.h"
#include "main/imports.h"
#include "main/arbprogram.h"
#include "main/arrayobj.h"
#include "main/blend.h"
......@@ -90,6 +89,8 @@
#include "util/ralloc.h"
#include "compiler/nir/nir.h"
#include "util/u_math.h"
#include "util/u_string.h"
#include "util/u_memory.h"
/** Return offset in bytes of the field within a vertex struct */
#define OFFSET(FIELD) ((void *) offsetof(struct vertex, FIELD))
......@@ -2047,7 +2048,7 @@ init_draw_stencil_pixels(struct gl_context *ctx)
texTarget = "RECT";
else
texTarget = "2D";
_mesa_snprintf(program2, sizeof(program2), program, texTarget);
util_snprintf(program2, sizeof(program2), program, texTarget);
_mesa_GenProgramsARB(1, &drawpix->StencilFP);
_mesa_BindProgramARB(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP);
......@@ -2081,7 +2082,7 @@ init_draw_depth_pixels(struct gl_context *ctx)
texTarget = "RECT";
else
texTarget = "2D";
_mesa_snprintf(program2, sizeof(program2), program, texTarget);
util_snprintf(program2, sizeof(program2), program, texTarget);
_mesa_GenProgramsARB(1, &drawpix->DepthFP);
_mesa_BindProgramARB(GL_FRAGMENT_PROGRAM_ARB, drawpix->DepthFP);
......
......@@ -24,7 +24,6 @@
#include "main/glheader.h"
#include "main/mtypes.h"
#include "main/imports.h"
#include "main/arbprogram.h"
#include "main/arrayobj.h"
#include "main/blend.h"
......@@ -85,7 +84,7 @@ setup_glsl_msaa_blit_scaled_shader(struct gl_context *ctx,
y_scale = samples / x_scale;
/* We expect only power of 2 samples in source multisample buffer. */
assert(samples > 0 && _mesa_is_pow_two(samples));
assert(samples > 0 && util_is_power_of_two_nonzero(samples));
while (samples >> (shader_offset + 1)) {
shader_offset++;
}
......@@ -278,7 +277,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
}
/* We expect only power of 2 samples in source multisample buffer. */
assert(samples > 0 && _mesa_is_pow_two(samples));
assert(samples > 0 && util_is_power_of_two_nonzero(samples));
while (samples >> (shader_offset + 1)) {
shader_offset++;
}
......@@ -482,7 +481,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
* (so the floating point exponent just gets increased), rather than
* doing a naive sum and dividing.
*/
assert(_mesa_is_pow_two(samples));
assert(util_is_power_of_two_or_zero(samples));
/* Fetch each individual sample. */
sample_resolve = rzalloc_size(mem_ctx, 1);
for (i = 0; i < samples; i++) {
......
......@@ -28,7 +28,6 @@
#include "i830_context.h"