For the series:

Tested-by: Dieter Nützel <[email protected]>

on RX580
with UH (even wireframe mode works, now - GREAT!), UV, US, glmark2, Blender 2.79, DiRT Rally, F1 2017 and smoketest --- all I throw at it.

Together with:
[Mesa-dev] [PATCH] ac/nir: call glsl_get_sampler_dim() only once, where possible (v2)

Only hang/crash with kdm (kwin_x11).

[15868.010794] si_shader:1[11314]: segfault at 56380736ff00 ip 00000000fc02a9d7 sp 00000000c2a39e16 error 4 in libc-2.26.so[7f2bc0888000+1b1000] [15886.284911] si_shader:1[11363]: segfault at 55eb639f6840 ip 000000002a5bdb2f sp 0000000084185b19 error 4 in libc-2.26.so[7ff1ea2fc000+1b1000] [15893.520909] si_shader:0[11386]: segfault at 55aac936c5b8 ip 000000002387ffc1 sp 000000001b4ed48c error 4 in libc-2.26.so[7fe738b1a000+1b1000] [16010.416710] plasmashell[13310]: segfault at 5630544ddfe0 ip 000000004cd489a5 sp 00000000ab5ed265 error 4 in libc-2.26.so[7f7104df2000+1b1000]

I tried it with R600_DEBUG=sisched,nir in /etc/environment...
that was too much at this point ;-)

Dieter

Am 24.01.2018 01:4[Mesa-dev] [PATCH 1/3] st/glsl_to_tgsi: move nir detection earlier and set nir options1, schrieb Timothy Arceri:
We move the nir check before the shader cache call so that we can
call a nir based caching function in a following patch.
---
 src/mesa/state_tracker/st_glsl_to_nir.cpp  | 10 ++-------
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 36 +++++++++++++++++++++++-------
 2 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp
b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 21b3640b2c..9e627be6da 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -304,14 +304,8 @@ st_glsl_to_nir(struct st_context *st, struct
gl_program *prog,
                struct gl_shader_program *shader_program,
                gl_shader_stage stage)
 {
-   struct pipe_screen *pscreen = st->pipe->screen;
-   enum pipe_shader_type ptarget = pipe_shader_type_from_mesa(stage);
-   const nir_shader_compiler_options *options;
-
-   assert(pscreen->get_compiler_options);   /* drivers using NIR must
implement this */
-
-   options = (const nir_shader_compiler_options *)
- pscreen->get_compiler_options(pscreen, PIPE_SHADER_IR_NIR, ptarget);
+   const nir_shader_compiler_options *options =
+ st->ctx->Const.ShaderCompilerOptions[prog->info.stage].NirOptions;
    assert(options);

    if (prog->nir)
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index f44f02ad9d..f496bcfe59 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6917,15 +6917,41 @@ extern "C" {
 GLboolean
 st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 {
+   struct pipe_screen *pscreen = ctx->st->pipe->screen;
+
+   bool use_nir = false;
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+      if (prog->_LinkedShaders[i] == NULL)
+         continue;
+
+      gl_shader_stage stage = prog->_LinkedShaders[i]->Stage;
+ enum pipe_shader_type ptarget = pipe_shader_type_from_mesa(stage);
+      enum pipe_shader_ir preferred_ir = (enum pipe_shader_ir)
+         pscreen->get_shader_param(pscreen, ptarget,
+                                   PIPE_SHADER_CAP_PREFERRED_IR);
+      use_nir = preferred_ir == PIPE_SHADER_IR_NIR;
+
+      if (use_nir) {
+         const nir_shader_compiler_options *options;
+
+         /* drivers using NIR must implement this */
+         assert(pscreen->get_compiler_options);
+
+         options = (const nir_shader_compiler_options *)
+            pscreen->get_compiler_options(pscreen,
PIPE_SHADER_IR_NIR, ptarget);
+         assert(options);
+
+         ctx->Const.ShaderCompilerOptions[stage].NirOptions = options;
+      }
+   }
+
    /* Return early if we are loading the shader from on-disk cache */
    if (st_load_tgsi_from_disk_cache(ctx, prog)) {
       return GL_TRUE;
    }

-   struct pipe_screen *pscreen = ctx->st->pipe->screen;
    assert(prog->data->LinkStatus);

-   bool use_nir = false;
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] == NULL)
          continue;
@@ -6945,12 +6971,6 @@ st_link_shader(struct gl_context *ctx, struct
gl_shader_program *prog)
unsigned if_threshold = pscreen->get_shader_param(pscreen, ptarget,

PIPE_SHADER_CAP_LOWER_IF_THRESHOLD);

-      enum pipe_shader_ir preferred_ir = (enum pipe_shader_ir)
-         pscreen->get_shader_param(pscreen, ptarget,
-                                   PIPE_SHADER_CAP_PREFERRED_IR);
-      if (preferred_ir == PIPE_SHADER_IR_NIR)
-         use_nir = true;
-
       /* If there are forms of indirect addressing that the driver
        * cannot handle, perform the lowering pass.
        */
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to