use mesa import wrappers, bug 4468

This commit is contained in:
Brian Paul
2005-09-16 18:14:24 +00:00
parent 3cc67cb8cd
commit aa2069586d
20 changed files with 45 additions and 29 deletions

View File

@@ -259,6 +259,19 @@ _mesa_bzero( void *dst, size_t n )
#endif #endif
} }
/** Wrapper around either memcmp() or xf86memcmp() */
int
_mesa_memcmp( const void *s1, const void *s2, size_t n )
{
#if defined(XFree86LOADER) && defined(IN_MODULE)
return xf86memcmp( s1, s2, n );
#elif defined(SUNOS4)
return memcmp( (char *) s1, (char *) s2, (int) n );
#else
return memcmp(s1, s2, n);
#endif
}
/*@}*/ /*@}*/

View File

@@ -613,6 +613,8 @@ _mesa_memset16( unsigned short *dst, unsigned short val, size_t n );
extern void extern void
_mesa_bzero( void *dst, size_t n ); _mesa_bzero( void *dst, size_t n );
extern int
_mesa_memcmp( const void *s1, const void *s2, size_t n );
extern double extern double
_mesa_sin(double a); _mesa_sin(double a);

View File

@@ -474,7 +474,7 @@ fxt1_choose (GLfloat vec[][MAX_COMP], GLint nv,
} hist[N_TEXELS]; } hist[N_TEXELS];
GLint lenh = 0; GLint lenh = 0;
memset(hist, 0, sizeof(hist)); _mesa_memset(hist, 0, sizeof(hist));
for (k = 0; k < n; k++) { for (k = 0; k < n; k++) {
GLint l; GLint l;
@@ -1268,7 +1268,7 @@ fxt1_quantize (GLuint *cc, const GLubyte *lines[], GLint comps)
if (comps == 3) { if (comps == 3) {
/* make the whole block opaque */ /* make the whole block opaque */
memset(input, -1, sizeof(input)); _mesa_memset(input, -1, sizeof(input));
} }
/* 8 texels each line */ /* 8 texels each line */

View File

@@ -480,7 +480,7 @@ emit_op(struct texenv_fragment_program *p,
GLuint nr = p->program->Base.NumInstructions++; GLuint nr = p->program->Base.NumInstructions++;
struct fp_instruction *inst = &p->program->Instructions[nr]; struct fp_instruction *inst = &p->program->Instructions[nr];
memset(inst, 0, sizeof(*inst)); _mesa_memset(inst, 0, sizeof(*inst));
inst->Opcode = op; inst->Opcode = op;
emit_arg( &inst->SrcReg[0], src0 ); emit_arg( &inst->SrcReg[0], src0 );
@@ -792,7 +792,7 @@ static struct ureg emit_combine( struct texenv_fragment_program *p,
emit_arith( p, FP_OPCODE_MAD, tmp0, WRITEMASK_XYZW, 0, emit_arith( p, FP_OPCODE_MAD, tmp0, WRITEMASK_XYZW, 0,
two, src[0], neg1); two, src[0], neg1);
if (memcmp(&src[0], &src[1], sizeof(struct ureg)) == 0) if (_mesa_memcmp(&src[0], &src[1], sizeof(struct ureg)) == 0)
tmp1 = tmp0; tmp1 = tmp0;
else else
emit_arith( p, FP_OPCODE_MAD, tmp1, WRITEMASK_XYZW, 0, emit_arith( p, FP_OPCODE_MAD, tmp1, WRITEMASK_XYZW, 0,
@@ -1039,7 +1039,7 @@ static void create_new_program(struct state_key *key, GLcontext *ctx,
emit_arith( &p, FP_OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef ); emit_arith( &p, FP_OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef );
emit_arith( &p, FP_OPCODE_MOV, out, WRITEMASK_W, 0, cf, undef, undef ); emit_arith( &p, FP_OPCODE_MOV, out, WRITEMASK_W, 0, cf, undef, undef );
} }
else if (memcmp(&cf, &out, sizeof(cf)) != 0) { else if (_mesa_memcmp(&cf, &out, sizeof(cf)) != 0) {
/* Will wind up in here if no texture enabled or a couple of /* Will wind up in here if no texture enabled or a couple of
* other scenarios (GL_REPLACE for instance). * other scenarios (GL_REPLACE for instance).
*/ */
@@ -1093,7 +1093,7 @@ static void *search_cache( struct texenvprog_cache *cache,
struct texenvprog_cache *c; struct texenvprog_cache *c;
for (c = cache; c; c = c->next) { for (c = cache; c; c = c->next) {
if (c->hash == hash && memcmp(c->key, key, keysize) == 0) if (c->hash == hash && _mesa_memcmp(c->key, key, keysize) == 0)
return c->data; return c->data;
} }

View File

@@ -246,7 +246,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
/* Always need the base level image */ /* Always need the base level image */
if (!t->Image[0][baseLevel]) { if (!t->Image[0][baseLevel]) {
char s[100]; char s[100];
sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL", _mesa_sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL",
(void *) t, t->Name, baseLevel); (void *) t, t->Name, baseLevel);
incomplete(t, s); incomplete(t, s);
t->Complete = GL_FALSE; t->Complete = GL_FALSE;

View File

@@ -804,8 +804,8 @@ _math_matrix_rotate( GLmatrix *mat,
GLfloat m[16]; GLfloat m[16];
GLboolean optimized; GLboolean optimized;
s = (GLfloat) sin( angle * DEG2RAD ); s = (GLfloat) _mesa_sin( angle * DEG2RAD );
c = (GLfloat) cos( angle * DEG2RAD ); c = (GLfloat) _mesa_cos( angle * DEG2RAD );
MEMCPY(m, Identity, sizeof(GLfloat)*16); MEMCPY(m, Identity, sizeof(GLfloat)*16);
optimized = GL_FALSE; optimized = GL_FALSE;

View File

@@ -560,7 +560,7 @@ var_cache_find (struct var_cache *va, GLubyte * name)
/*struct var_cache *first = va;*/ /*struct var_cache *first = va;*/
while (va) { while (va) {
if (!strcmp ( (const char*) name, (const char*) va->name)) { if (!_mesa_strcmp ( (const char*) name, (const char*) va->name)) {
if (va->type == vt_alias) if (va->type == vt_alias)
return va->alias_binding; return va->alias_binding;
return va; return va;

View File

@@ -1588,7 +1588,7 @@ PrintSrcReg(const struct fragment_program *program,
} }
if (src->File == PROGRAM_NAMED_PARAM) { if (src->File == PROGRAM_NAMED_PARAM) {
if (program->Parameters->Parameters[src->Index].Type == CONSTANT) { if (program->Parameters->Parameters[src->Index].Type == CONSTANT) {
printf("{%g, %g, %g, %g}", _mesa_printf("{%g, %g, %g, %g}",
program->Parameters->ParameterValues[src->Index][0], program->Parameters->ParameterValues[src->Index][0],
program->Parameters->ParameterValues[src->Index][1], program->Parameters->ParameterValues[src->Index][1],
program->Parameters->ParameterValues[src->Index][2], program->Parameters->ParameterValues[src->Index][2],
@@ -1597,7 +1597,7 @@ PrintSrcReg(const struct fragment_program *program,
else { else {
ASSERT(program->Parameters->Parameters[src->Index].Type ASSERT(program->Parameters->Parameters[src->Index].Type
== NAMED_PARAMETER); == NAMED_PARAMETER);
printf("%s", program->Parameters->Parameters[src->Index].Name); _mesa_printf("%s", program->Parameters->Parameters[src->Index].Name);
} }
} }
else if (src->File == PROGRAM_OUTPUT) { else if (src->File == PROGRAM_OUTPUT) {

View File

@@ -1304,7 +1304,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
for (i = 0; i < ctx->Const.MaxVertexProgramAttribs; i++) { for (i = 0; i < ctx->Const.MaxVertexProgramAttribs; i++) {
const char *name = _mesa_nv_vertex_input_register_name(i); const char *name = _mesa_nv_vertex_input_register_name(i);
char number[10]; char number[10];
sprintf(number, "%d", i); _mesa_sprintf(number, "%d", i);
if (_mesa_strncmp(reg + 2, name, 4) == 0 || if (_mesa_strncmp(reg + 2, name, 4) == 0 ||
_mesa_strncmp(reg + 2, number, _mesa_strlen(number)) == 0) { _mesa_strncmp(reg + 2, number, _mesa_strlen(number)) == 0) {
COPY_4V(v, ctx->VertexProgram.Inputs[i]); COPY_4V(v, ctx->VertexProgram.Inputs[i]);

View File

@@ -635,7 +635,7 @@ int slang_info_log_error (slang_info_log *log, const char *msg, ...)
char buf[1024]; char buf[1024];
va_start (va, msg); va_start (va, msg);
vsprintf (buf, msg, va); _mesa_sprintf (buf, msg, va);
if (slang_info_log_message (log, "error", buf)) if (slang_info_log_message (log, "error", buf))
return 1; return 1;
slang_info_log_memory (log); slang_info_log_memory (log);
@@ -649,7 +649,7 @@ int slang_info_log_warning (slang_info_log *log, const char *msg, ...)
char buf[1024]; char buf[1024];
va_start (va, msg); va_start (va, msg);
vsprintf (buf, msg, va); _mesa_sprintf (buf, msg, va);
if (slang_info_log_message (log, "warning", buf)) if (slang_info_log_message (log, "warning", buf))
return 1; return 1;
slang_info_log_memory (log); slang_info_log_memory (log);

View File

@@ -169,7 +169,7 @@ static void dump (const slang_assembly_file *file)
char filename[256]; char filename[256];
counter++; counter++;
sprintf (filename, "~mesa-slang-assembly-dump-(%u).txt", counter); _mesa_sprintf (filename, "~mesa-slang-assembly-dump-(%u).txt", counter);
f = fopen (filename, "w"); f = fopen (filename, "w");
if (f == NULL) if (f == NULL)
return; return;

View File

@@ -1034,8 +1034,8 @@ execute_program( GLcontext *ctx,
{ {
GLfloat a[4], result[4]; GLfloat a[4], result[4];
fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
result[0] = (GLfloat)cos(a[0]); result[0] = (GLfloat)_mesa_cos(a[0]);
result[1] = (GLfloat)sin(a[0]); result[1] = (GLfloat)_mesa_sin(a[0]);
result[2] = 0.0; /* undefined! */ result[2] = 0.0; /* undefined! */
result[3] = 0.0; /* undefined! */ result[3] = 0.0; /* undefined! */
store_vector4( inst, machine, result ); store_vector4( inst, machine, result );

View File

@@ -73,7 +73,7 @@ _tnl_CreateContext( GLcontext *ctx )
return GL_FALSE; return GL_FALSE;
} }
if (getenv("MESA_CODEGEN")) if (_mesa_getenv("MESA_CODEGEN"))
tnl->AllowCodegen = GL_TRUE; tnl->AllowCodegen = GL_TRUE;
/* Initialize the VB. /* Initialize the VB.

View File

@@ -1031,7 +1031,7 @@ static void compile_vertex_program( struct vertex_program *program,
/* Initialize cp. Note that ctx and VB aren't used in compilation /* Initialize cp. Note that ctx and VB aren't used in compilation
* so we don't have to worry about statechanges: * so we don't have to worry about statechanges:
*/ */
memset(&cp, 0, sizeof(cp)); _mesa_memset(&cp, 0, sizeof(cp));
cp.csr = p->instructions; cp.csr = p->instructions;
/* Compile instructions: /* Compile instructions:

View File

@@ -1181,7 +1181,7 @@ _tnl_sse_codegen_vertex_program(struct tnl_compiled_program *p)
{ {
struct compilation cp; struct compilation cp;
memset(&cp, 0, sizeof(cp)); _mesa_memset(&cp, 0, sizeof(cp));
cp.p = p; cp.p = p;
cp.have_sse2 = 1; cp.have_sse2 = 1;

View File

@@ -637,7 +637,7 @@ void _tnl_generate_sse_emit( GLcontext *ctx )
return; return;
} }
memset(&p, 0, sizeof(p)); _mesa_memset(&p, 0, sizeof(p));
p.ctx = ctx; p.ctx = ctx;
p.inputs_safe = 0; /* for now */ p.inputs_safe = 0; /* for now */

View File

@@ -1406,7 +1406,7 @@ static void *search_cache( struct tnl_cache *cache,
struct tnl_cache *c; struct tnl_cache *c;
for (c = cache; c; c = c->next) { for (c = cache; c; c = c->next) {
if (c->hash == hash && memcmp(c->key, key, keysize) == 0) if (c->hash == hash && _mesa_memcmp(c->key, key, keysize) == 0)
return c->data; return c->data;
} }

View File

@@ -943,7 +943,7 @@ void _tnl_vtx_init( GLcontext *ctx )
_mesa_install_exec_vtxfmt( ctx, &tnl->exec_vtxfmt ); _mesa_install_exec_vtxfmt( ctx, &tnl->exec_vtxfmt );
memcpy( tnl->vtx.tabfv, choose, sizeof(choose) ); _mesa_memcpy( tnl->vtx.tabfv, choose, sizeof(choose) );
for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++)
tnl->vtx.attrsz[i] = 0; tnl->vtx.attrsz[i] = 0;

View File

@@ -90,7 +90,7 @@ EXTERN( _tnl_x86_choose_fv );
insert_at_head( &CACHE, dfn ); \ insert_at_head( &CACHE, dfn ); \
dfn->key = KEY; \ dfn->key = KEY; \
dfn->code = ALIGN_MALLOC( end - start, 16 ); \ dfn->code = ALIGN_MALLOC( end - start, 16 ); \
memcpy (dfn->code, start, end - start) _mesa_memcpy (dfn->code, start, end - start)
@@ -277,7 +277,7 @@ do { \
const char *end = WARP##_end; \ const char *end = WARP##_end; \
int offset = 0; \ int offset = 0; \
code = ALIGN_MALLOC( end - start, 16 ); \ code = ALIGN_MALLOC( end - start, 16 ); \
memcpy (code, start, end - start); \ _mesa_memcpy (code, start, end - start); \
FIXUP(code, 0, 0, (int)&(TNL_CONTEXT(ctx)->vtx.tabfv[ATTR][SIZE-1]));\ FIXUP(code, 0, 0, (int)&(TNL_CONTEXT(ctx)->vtx.tabfv[ATTR][SIZE-1]));\
*(void **)&vfmt->FUNC = code; \ *(void **)&vfmt->FUNC = code; \
} while (0) } while (0)
@@ -351,7 +351,7 @@ void _tnl_x86choosers( tnl_attrfv_func (*choose)[4],
const char *end = _tnl_x86_choose_fv_end; const char *end = _tnl_x86_choose_fv_end;
int offset = 0; int offset = 0;
code = ALIGN_MALLOC( end - start, 16 ); code = ALIGN_MALLOC( end - start, 16 );
memcpy (code, start, end - start); _mesa_memcpy (code, start, end - start);
FIXUP(code, 0, 0, attr); FIXUP(code, 0, 0, attr);
FIXUP(code, 0, 1, size + 1); FIXUP(code, 0, 1, size + 1);
FIXUPREL(code, 0, 2, do_choose); FIXUPREL(code, 0, 2, do_choose);

View File

@@ -1,5 +1,6 @@
#if defined(USE_X86_ASM) #if defined(USE_X86_ASM)
#include "imports.h"
#include "x86sse.h" #include "x86sse.h"
#define DISASSEM 0 #define DISASSEM 0
@@ -970,13 +971,13 @@ struct x86_reg x86_fn_arg( struct x86_function *p,
void x86_init_func( struct x86_function *p ) void x86_init_func( struct x86_function *p )
{ {
p->store = malloc(1024); p->store = _mesa_malloc(1024);
p->csr = p->store; p->csr = p->store;
} }
void x86_release_func( struct x86_function *p ) void x86_release_func( struct x86_function *p )
{ {
free(p->store); _mesa_free(p->store);
} }