[Mesa-dev] [PATCH 1/4] radeonsi: set drirc compiler options before calling common screen init

Nicolai Hähnle nhaehnle at gmail.com
Thu Aug 3 13:44:38 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Also, access the options directly, allowing us to get rid of the
PIPE_SCREEN_xxx flags.
---
 src/gallium/drivers/r600/r600_pipe.c          |  2 +-
 src/gallium/drivers/radeon/r600_pipe_common.c |  9 ++-------
 src/gallium/drivers/radeon/r600_pipe_common.h |  2 +-
 src/gallium/drivers/radeonsi/si_pipe.c        | 14 ++++++++++----
 4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 9263659be32..023f1b4bd14 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -651,7 +651,7 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws,
 	rscreen->b.b.get_shader_param = r600_get_shader_param;
 	rscreen->b.b.resource_create = r600_resource_create;
 
-	if (!r600_common_screen_init(&rscreen->b, ws, config->flags)) {
+	if (!r600_common_screen_init(&rscreen->b, ws)) {
 		FREE(rscreen);
 		return NULL;
 	}
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index e9402f89137..1342092fec5 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -1335,7 +1335,7 @@ struct pipe_resource *r600_resource_create_common(struct pipe_screen *screen,
 }
 
 bool r600_common_screen_init(struct r600_common_screen *rscreen,
-			     struct radeon_winsys *ws, unsigned flags)
+			     struct radeon_winsys *ws)
 {
 	char family_name[32] = {}, llvm_string[32] = {}, kernel_version[128] = {};
 	struct utsname uname_data;
@@ -1392,15 +1392,10 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
 
 	rscreen->family = rscreen->info.family;
 	rscreen->chip_class = rscreen->info.chip_class;
-	rscreen->debug_flags = debug_get_flags_option("R600_DEBUG", common_debug_options, 0);
+	rscreen->debug_flags |= debug_get_flags_option("R600_DEBUG", common_debug_options, 0);
 	rscreen->has_rbplus = false;
 	rscreen->rbplus_allowed = false;
 
-	/* Set the flag in debug_flags, so that the shader cache takes it
-	 * into account. */
-	if (flags & PIPE_SCREEN_ENABLE_CORRECT_TGSI_DERIVATIVES_AFTER_KILL)
-		rscreen->debug_flags |= DBG_FS_CORRECT_DERIVS_AFTER_KILL;
-
 	r600_disk_cache_create(rscreen);
 
 	slab_create_parent(&rscreen->pool_transfers, sizeof(struct r600_transfer), 64);
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index b391cbb82a6..faa5608adf0 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -747,7 +747,7 @@ void r600_draw_rectangle(struct blitter_context *blitter,
 			 enum blitter_attrib_type type,
 			 const union pipe_color_union *attrib);
 bool r600_common_screen_init(struct r600_common_screen *rscreen,
-			     struct radeon_winsys *ws, unsigned flags);
+			     struct radeon_winsys *ws);
 void r600_destroy_common_screen(struct r600_common_screen *rscreen);
 void r600_preflush_suspend_features(struct r600_common_context *ctx);
 void r600_postflush_resume_features(struct r600_common_context *ctx);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index b32a77dcc46..395853c7d9f 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -987,16 +987,22 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws,
 
 	si_init_screen_state_functions(sscreen);
 
-	if (!r600_common_screen_init(&sscreen->b, ws, config->flags) ||
+	/* Set these flags in debug_flags early, so that the shader cache takes
+	 * them into account.
+	 */
+	if (driQueryOptionb(config->options,
+			    "glsl_correct_derivatives_after_discard"))
+		sscreen->b.debug_flags |= DBG_FS_CORRECT_DERIVS_AFTER_KILL;
+	if (driQueryOptionb(config->options, "radeonsi_enable_sisched"))
+		sscreen->b.debug_flags |= DBG_SI_SCHED;
+
+	if (!r600_common_screen_init(&sscreen->b, ws) ||
 	    !si_init_gs_info(sscreen) ||
 	    !si_init_shader_cache(sscreen)) {
 		FREE(sscreen);
 		return NULL;
 	}
 
-	if (driQueryOptionb(config->options, "radeonsi_enable_sisched"))
-		sscreen->b.debug_flags |= DBG_SI_SCHED;
-
 	/* Only enable as many threads as we have target machines, but at most
 	 * the number of CPUs - 1 if there is more than one.
 	 */
-- 
2.11.0



More information about the mesa-dev mailing list