mesa: Changes to 'upstream-experimental'
Rebased ref, commits from common ancestor:
commit 7cfd42cefe1949af51ecced9891f415eca2c0e66
Author: Dave Airlie <airlied@redhat.com>
Date: Fri Sep 14 10:13:01 2012 +1000
mesa/glsl: rename preprocess to glcpp_preprocess
This symbol with dricore escapes into the namespace, its too generic,
we should prefix it with something just to be nice.
Should be applied to stable + 9.0
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 88b0790b1ae8864d4ec6196b3939498bbffdbb5f)
diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c
index e461a65..35db470 100644
--- a/src/glsl/glcpp/glcpp.c
+++ b/src/glsl/glcpp/glcpp.c
@@ -111,7 +111,7 @@ main (int argc, char *argv[])
if (shader == NULL)
return 1;
- ret = preprocess(ctx, &shader, &info_log, NULL, API_OPENGL);
+ ret = glcpp_preprocess(ctx, &shader, &info_log, NULL, API_OPENGL);
printf("%s", shader);
fprintf(stderr, "%s", info_log);
diff --git a/src/glsl/glcpp/glcpp.h b/src/glsl/glcpp/glcpp.h
index a13ade6..a459289 100644
--- a/src/glsl/glcpp/glcpp.h
+++ b/src/glsl/glcpp/glcpp.h
@@ -196,7 +196,7 @@ void
glcpp_parser_destroy (glcpp_parser_t *parser);
int
-preprocess(void *ralloc_ctx, const char **shader, char **info_log,
+glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log,
const struct gl_extensions *extensions, int api);
/* Functions for writing to the info log */
diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c
index 9170d14..11b2941 100644
--- a/src/glsl/glcpp/pp.c
+++ b/src/glsl/glcpp/pp.c
@@ -150,7 +150,7 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader)
}
int
-preprocess(void *ralloc_ctx, const char **shader, char **info_log,
+glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log,
const struct gl_extensions *extensions, int api)
{
int errors;
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index fc08ee2..c8c40ab 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -296,7 +296,7 @@ _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target);
extern "C" {
#endif
-extern int preprocess(void *ctx, const char **shader, char **info_log,
+extern int glcpp_preprocess(void *ctx, const char **shader, char **info_log,
const struct gl_extensions *extensions, int api);
extern void _mesa_destroy_shader_compiler(void);
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index 64c2496..04143ad 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -144,7 +144,7 @@ compile_shader(struct gl_context *ctx, struct gl_shader *shader)
new(shader) _mesa_glsl_parse_state(ctx, shader->Type, shader);
const char *source = shader->Source;
- state->error = preprocess(state, &source, &state->info_log,
+ state->error = glcpp_preprocess(state, &source, &state->info_log,
state->extensions, ctx->API) != 0;
if (!state->error) {
diff --git a/src/glsl/test_optpass.cpp b/src/glsl/test_optpass.cpp
index 31f65c3..5ed1170 100644
--- a/src/glsl/test_optpass.cpp
+++ b/src/glsl/test_optpass.cpp
@@ -216,7 +216,7 @@ int test_optpass(int argc, char **argv)
} else {
shader->Source = input.c_str();
const char *source = shader->Source;
- state->error = preprocess(state, &source, &state->info_log,
+ state->error = glcpp_preprocess(state, &source, &state->info_log,
state->extensions, ctx->API) != 0;
if (!state->error) {
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index d675da2..c9c6db1 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -3060,7 +3060,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader)
return;
}
- state->error = preprocess(state, &source, &state->info_log,
+ state->error = glcpp_preprocess(state, &source, &state->info_log,
&ctx->Extensions, ctx->API);
if (ctx->Shader.Flags & GLSL_DUMP) {
commit 8f7990c5f2ca25e42c7fefff6312bee2ff77e134
Author: Dave Airlie <airlied@gmail.com>
Date: Fri Sep 14 19:59:54 2012 +1000
glcpp: fix abuse of yylex
So glcpp tried to workaround yylex its own way, but failed,
do it properly.
This fixes another crash found after fixing the first crash.
this is a candidate for 9.0 and stable branches
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 53d46bc787318ccf9911fdd1d5fe99ee4db7f41a)
diff --git a/src/glsl/glcpp/Makefile.am b/src/glsl/glcpp/Makefile.am
index 7a95b68..87affce 100644
--- a/src/glsl/glcpp/Makefile.am
+++ b/src/glsl/glcpp/Makefile.am
@@ -31,7 +31,7 @@ AM_CFLAGS = \
$(LIBRARY_DEFINES) \
$(API_DEFINES)
-AM_YFLAGS = -v -d
+AM_YFLAGS = -v -d -p "glcpp_parser_"
AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
noinst_LTLIBRARIES = libglcpp.la
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index bf6f3ad..fb9bc58 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -133,8 +133,6 @@ _glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc,
static void
_glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc);
-#define yylex glcpp_parser_lex
-
static int
glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser);
@@ -1197,12 +1195,6 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
return parser;
}
-int
-glcpp_parser_parse (glcpp_parser_t *parser)
-{
- return yyparse (parser);
-}
-
void
glcpp_parser_destroy (glcpp_parser_t *parser)
{
commit a834381506d5be80251953666198fc3b9bc4b731
Author: Dave Airlie <airlied@redhat.com>
Date: Fri Sep 14 10:05:53 2012 +1000
mesa: use a prefix for the program lex
This avoids us making a global yylex symbol which will interfere will
all sorts of apps.
with libdricore which can't do symbol visibility currently we pollute
the namespace with this.
This is a candidate for 9.0 & stable branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit cc943c8470b38a1f13d2493f293a153f75754caa)
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 57325af..8e4530d 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -73,7 +73,7 @@ main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py m
program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
$(MKDIR_P) program
- $(AM_V_GEN) $(YACC) -v -d --output=program/program_parse.tab.c $<
+ $(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d --output=program/program_parse.tab.c $<
program/lex.yy.c: program/program_lexer.l
$(MKDIR_P) program
diff --git a/src/mesa/program/program_lexer.l b/src/mesa/program/program_lexer.l
index 0a50dab..0947bb0 100644
--- a/src/mesa/program/program_lexer.l
+++ b/src/mesa/program/program_lexer.l
@@ -165,6 +165,7 @@ szf [HR]?
cc C?
sat (_SAT)?
+%option prefix="_mesa_program_"
%option bison-bridge bison-locations reentrant noyywrap
%%
commit fafaf56479d41e87bb0003a55d30dca1825bc1ca
Author: Mike Frysinger <vapier@gentoo.org>
Date: Tue Sep 11 01:57:25 2012 -0400
mklib: clean up abi flags for x86 targets
The current code is duplicated in two places and relies on `uname` to
detect the flags. This is no good for cross-compiling, and the current
logic uses -m64 for the x32 ABI which breaks things.
Unify the code in one place, avoid `uname` completely, and add support
for the new x32 ABI.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
diff --git a/bin/mklib b/bin/mklib
index 9bac29e..086b268 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -319,6 +319,25 @@ case $ARCH in
fi
fi
+ # Check if objects are 32-bit and we're running in 64-bit
+ # environment. If so, pass -m32 flag to linker.
+ add_abi_flag_to_opts() {
+ case $(file $1) in
+ *32-bit*x86-64*)
+ # x86_64 x32 ABI.
+ OPTS="-mx32 ${OPTS}"
+ ;;
+ *64-bit*x86-64*)
+ # x86_64 64-bit ABI.
+ OPTS="-m64 ${OPTS}"
+ ;;
+ *32-bit*Intel*)
+ # x86 32-bit ABI.
+ OPTS="-m32 ${OPTS}"
+ ;;
+ esac
+ }
+
if [ $NOPREFIX = 1 ] ; then
# No "lib" or ".so" part
echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}
@@ -330,15 +349,8 @@ case $ARCH in
;;
esac
- # Check if objects are 32-bit and we're running in 64-bit
- # environment. If so, pass -m32 flag to linker.
- set ${OBJECTS}
- ABI32=`file $1 | grep 32-bit`
- ARM=`file $1 | grep ARM`
- # Do not add "-m32" option for arm.
- if [ -z "$ARM" -a "${ABI32}" -a `uname -m` = "x86_64" ] ; then
- OPTS="-m32 ${OPTS}"
- fi
+ # Check to see if we are building for a different ABI.
+ add_abi_flag_to_opts ${OBJECTS}
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
@@ -389,15 +401,9 @@ case $ARCH in
# exptmp is removed below
fi
- # Check if objects are 32-bit and we're running in 64-bit
- # environment. If so, pass -m32 flag to linker.
- set ${OBJECTS}
- ABI32=`file $1 | grep 32-bit`
- ARM=`file $1 | grep ARM`
- # Do not add "-m32" option for arm.
- if [ -z "$ARM" -a "${ABI32}" -a `uname -m` = "x86_64" ] ; then
- OPTS="-m32 ${OPTS}"
- fi
+ # Check to see if we are building for a different ABI.
+ add_abi_flag_to_opts ${OBJECTS}
+
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
fi
commit f94b6d706ff4340277b9c68d2bc51602792c5739
Author: Alex Deucher <alexander.deucher@amd.com>
Date: Thu Sep 13 17:25:42 2012 -0400
r600g: reduce quant mode on evergreen+
Seems to have an affect on the allowable range of
values. Set evergreen+ to 1/256 to match 6xx/7xx.
fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=54877
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit b33d7eaa5e77b5367584fe183c46f8c3d9a06760)
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index bda8ed5..ee47976 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -921,7 +921,7 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx,
} else {
r600_pipe_state_add_reg(rstate, R_028C08_PA_SU_VTX_CNTL,
S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules) |
- S_028C08_QUANT_MODE(V_028C08_X_1_4096TH));
+ S_028C08_QUANT_MODE(V_028C08_X_1_256TH));
}
r600_pipe_state_add_reg(rstate, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, fui(state->offset_clamp));
r600_pipe_state_add_reg(rstate, R_028814_PA_SU_SC_MODE_CNTL,
commit a5a86652f17c5bc249a55b558310947a76de3d33
Author: Kenneth Graunke <kenneth@whitecape.org>
Date: Tue Sep 11 22:14:59 2012 -0700
i965: Fix out-of-order sampler unit usage in ARB fragment programs.
ARB fragment programs use texture unit numbers directly, unlike GLSL
which has an extra indirection. If a fragment program only uses one
texture assigned to GL_TEXTURE1, SamplersUsed will only contain a single
bit, which would make us only upload a single surface/sampler state
entry. However, it needs to be the second entry.
Using _mesa_fls() instead of _mesa_bitcount() solves this. For ARB
programs, this makes num_samplers the ID of the highest texture unit
used. Since GLSL uses consecutive integers assigned by the linker,
_mesa_fls() should give the same result as _mesa_bitcount()..
Fixes a regression since 85e8e9e000732908b259a7e2cbc1724a1be2d447,
which caused GPU hangs in ETQW (and probably others), as well as
breaking piglit test fp-fragment-position.
v2: Add a comment, as suggested by Matt.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54098
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54179
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: meng <mengmeng.meng@intel.com>
(cherry picked from commit 28f4be9eb91b12a2c6b1db6660cca71a98c486ec)
diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index 610ef34..e51381b 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -341,7 +341,10 @@ brw_upload_samplers(struct brw_context *brw)
GLbitfield SamplersUsed = vs->SamplersUsed | fs->SamplersUsed;
- brw->sampler.count = _mesa_bitcount(SamplersUsed);
+ /* ARB programs use the texture unit number as the sampler index, so we
+ * need to find the highest unit used. A bit-count will not work.
+ */
+ brw->sampler.count = _mesa_fls(SamplersUsed);
if (brw->sampler.count == 0)
return;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index eefa427..582e239 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1250,7 +1250,7 @@ brw_update_texture_surfaces(struct brw_context *brw)
struct gl_program *vs = (struct gl_program *) brw->vertex_program;
struct gl_program *fs = (struct gl_program *) brw->fragment_program;
- unsigned num_samplers = _mesa_bitcount(vs->SamplersUsed | fs->SamplersUsed);
+ unsigned num_samplers = _mesa_fls(vs->SamplersUsed | fs->SamplersUsed);
for (unsigned s = 0; s < num_samplers; s++) {
brw->vs.surf_offset[SURF_INDEX_VS_TEXTURE(s)] = 0;
commit 66e8f863d34fc8b8f7602c45bb3230fe663d4eb0
Author: Kenneth Graunke <kenneth@whitecape.org>
Date: Tue Sep 11 22:14:58 2012 -0700
mesa: Add a _mesa_fls() function to find the last bit set in a word.
ffs() finds the least significant bit set; _mesa_fls() finds the /most/
significant bit.
v2: Make it an inline function in imports.h, per Brian's suggestion.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 0fc163408e6b9521d545daba19f70631011d5752)
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 73913b5..551aea7 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -587,6 +587,28 @@ extern unsigned int
_mesa_bitcount_64(uint64_t n);
#endif
+/**
+ * Find the last (most significant) bit set in a word.
+ *
+ * Essentially ffs() in the reverse direction.
+ */
+static inline unsigned int
+_mesa_fls(unsigned int n)
+{
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304)
+ return n == 0 ? 0 : 32 - __builtin_clz(n);
+#else
+ unsigned int v = 1;
+
+ if (n == 0)
+ return 0;
+
+ while (n >>= 1)
+ v++;
+
+ return v;
+#endif
+}
extern GLhalfARB
_mesa_float_to_half(float f);
Reply to: