[Mesa-dev] [PATCH shader-db] Set more env-var's in run.c
Kenneth Graunke
kenneth at whitecape.org
Tue Dec 1 23:06:17 PST 2015
On Tuesday, December 01, 2015 07:40:54 PM Rob Clark wrote:
> Simplify the instructions a bit by setting all the potentially needed
> environment variables in run.c itself.
>
> Made very trivially more complex by the fact that all of the gallium
> drivers are using u_debug stuff, so one env var contains potentially
> multiple flags. We don't want to clobber any other flags that are set
> so we simply append.
> ---
> README | 4 ++--
> run.c | 22 ++++++++++++++++++++--
> 2 files changed, 22 insertions(+), 4 deletions(-)
>
> diff --git a/README b/README
> index 5477bf5..06294c9 100644
> --- a/README
> +++ b/README
> @@ -37,7 +37,7 @@ to run.
>
> === Running shaders ===
>
> -ST_DEBUG=precompile R600_DEBUG=ps,vs,gs,precompile ./run shaders -1 2> new-run
> +./run shaders -1 2> new-run
>
> Note that a debug mesa build required (ie. --enable-debug)
>
> @@ -50,7 +50,7 @@ Note that a debug mesa build required (ie. --enable-debug)
>
> === Running shaders ===
>
> -FD_MESA_DEBUG=shaderdb ST_DEBUG=precompile ./run -1 shaders 2> new-run
> +./run -1 shaders 2> new-run
>
> Note that a debug mesa build required (ie. --enable-debug)
>
> diff --git a/run.c b/run.c
> index 73e468d..82d8c91 100644
> --- a/run.c
> +++ b/run.c
> @@ -23,13 +23,15 @@
> * DEALINGS IN THE SOFTWARE.
> */
>
> +/* for memmem(). The man page doesn't say __USE_GNU... */
> +/* also for asprintf() */
> +#define _GNU_SOURCE
> +
> #include <time.h>
> #include <stdio.h>
> #include <fcntl.h>
> #include <assert.h>
> #include <signal.h>
> -/* for memmem(). The man page doesn't say __USE_GNU... */
> -#define __USE_GNU
> #include <string.h>
> #include <stdlib.h>
> #include <unistd.h>
> @@ -292,6 +294,19 @@ void print_usage(const char *prog_name)
> prog_name);
> }
>
> +static void addenv(const char *name, const char *value)
> +{
> + const char *orig = getenv(name);
> + if (orig) {
> + char *newval;
> + asprintf(&newval, "%s,%s", orig, value);
> + setenv(name, newval, 1);
> + free(newval);
> + } else {
> + setenv(name, value, 1);
> + }
> +}
> +
> int
> main(int argc, char **argv)
> {
> @@ -340,6 +355,9 @@ main(int argc, char **argv)
>
> setenv("allow_glsl_extension_directive_midshader", "true", 1);
> setenv("shader_precompile", "true", 1);
> + addenv("ST_DEBUG", "precompile");
> + addenv("R600_DEBUG", "ps,vs,gs,precompile");
> + addenv("FD_MESA_DEBUG", "shaderdb");
>
> const char *client_extensions = eglQueryString(EGL_NO_DISPLAY,
> EGL_EXTENSIONS);
>
Thanks, Rob, this is definitely nicer :)
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151201/d93aa124/attachment.sig>
More information about the mesa-dev
mailing list