summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r600/r600_pipe.c35
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.c24
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.h2
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c26
4 files changed, 30 insertions, 57 deletions
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 7df89f6a36c..07f6c1ce566 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -520,19 +520,11 @@ static void r600_destroy_screen(struct pipe_screen* pscreen)
if (!radeon_winsys_unref(rscreen->b.ws))
return;
- r600_common_screen_cleanup(&rscreen->b);
-
if (rscreen->global_pool) {
compute_memory_pool_delete(rscreen->global_pool);
}
- if (rscreen->b.trace_bo) {
- rscreen->b.ws->buffer_unmap(rscreen->b.trace_bo->cs_buf);
- pipe_resource_reference((struct pipe_resource**)&rscreen->b.trace_bo, NULL);
- }
-
- rscreen->b.ws->destroy(rscreen->b.ws);
- FREE(rscreen);
+ r600_destroy_common_screen(&rscreen->b);
}
static struct pipe_resource *r600_resource_create(struct pipe_screen *screen,
@@ -553,18 +545,11 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
return NULL;
}
- ws->query_info(ws, &rscreen->b.info);
-
/* Set functions first. */
rscreen->b.b.context_create = r600_create_context;
rscreen->b.b.destroy = r600_destroy_screen;
rscreen->b.b.get_param = r600_get_param;
rscreen->b.b.get_shader_param = r600_get_shader_param;
- if (rscreen->b.info.chip_class >= EVERGREEN) {
- rscreen->b.b.is_format_supported = evergreen_is_format_supported;
- } else {
- rscreen->b.b.is_format_supported = r600_is_format_supported;
- }
rscreen->b.b.resource_create = r600_resource_create;
if (!r600_common_screen_init(&rscreen->b, ws)) {
@@ -572,6 +557,12 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
return NULL;
}
+ if (rscreen->b.info.chip_class >= EVERGREEN) {
+ rscreen->b.b.is_format_supported = evergreen_is_format_supported;
+ } else {
+ rscreen->b.b.is_format_supported = r600_is_format_supported;
+ }
+
rscreen->b.debug_flags |= debug_get_flags_option("R600_DEBUG", r600_debug_options, 0);
if (debug_get_bool_option("R600_DEBUG_COMPUTE", FALSE))
rscreen->b.debug_flags |= DBG_COMPUTE;
@@ -634,18 +625,6 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
rscreen->global_pool = compute_memory_pool_new(rscreen);
- rscreen->b.cs_count = 0;
- if (rscreen->b.info.drm_minor >= 28 && (rscreen->b.debug_flags & DBG_TRACE_CS)) {
- rscreen->b.trace_bo = (struct r600_resource*)pipe_buffer_create(&rscreen->b.b,
- PIPE_BIND_CUSTOM,
- PIPE_USAGE_STAGING,
- 4096);
- if (rscreen->b.trace_bo) {
- rscreen->b.trace_ptr = rscreen->b.ws->buffer_map(rscreen->b.trace_bo->cs_buf, NULL,
- PIPE_TRANSFER_UNSYNCHRONIZED);
- }
- }
-
/* Create the auxiliary context. This must be done last. */
rscreen->b.aux_context = rscreen->b.b.context_create(&rscreen->b.b, NULL);
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 7640d6f24af..f40adf23565 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -619,17 +619,35 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
if (!r600_init_tiling(rscreen)) {
return false;
}
-
util_format_s3tc_init();
-
pipe_mutex_init(rscreen->aux_context_lock);
+
+ if (rscreen->info.drm_minor >= 28 && (rscreen->debug_flags & DBG_TRACE_CS)) {
+ rscreen->trace_bo = (struct r600_resource*)pipe_buffer_create(&rscreen->b,
+ PIPE_BIND_CUSTOM,
+ PIPE_USAGE_STAGING,
+ 4096);
+ if (rscreen->trace_bo) {
+ rscreen->trace_ptr = rscreen->ws->buffer_map(rscreen->trace_bo->cs_buf, NULL,
+ PIPE_TRANSFER_UNSYNCHRONIZED);
+ }
+ }
+
return true;
}
-void r600_common_screen_cleanup(struct r600_common_screen *rscreen)
+void r600_destroy_common_screen(struct r600_common_screen *rscreen)
{
pipe_mutex_destroy(rscreen->aux_context_lock);
rscreen->aux_context->destroy(rscreen->aux_context);
+
+ if (rscreen->trace_bo) {
+ rscreen->ws->buffer_unmap(rscreen->trace_bo->cs_buf);
+ pipe_resource_reference((struct pipe_resource**)&rscreen->trace_bo, NULL);
+ }
+
+ rscreen->ws->destroy(rscreen->ws);
+ FREE(rscreen);
}
static unsigned tgsi_get_processor_type(const struct tgsi_token *tokens)
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index 48f2be5f65d..16a9c768dd3 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -328,7 +328,7 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
/* r600_common_pipe.c */
bool r600_common_screen_init(struct r600_common_screen *rscreen,
struct radeon_winsys *ws);
-void r600_common_screen_cleanup(struct r600_common_screen *rscreen);
+void r600_destroy_common_screen(struct r600_common_screen *rscreen);
bool r600_common_context_init(struct r600_common_context *rctx,
struct r600_common_screen *rscreen);
void r600_common_context_cleanup(struct r600_common_context *rctx);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 941e6dec488..79a99f14fe7 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -418,17 +418,7 @@ static void si_destroy_screen(struct pipe_screen* pscreen)
if (!radeon_winsys_unref(sscreen->b.ws))
return;
- r600_common_screen_cleanup(&sscreen->b);
-
-#if SI_TRACE_CS
- if (sscreen->b.trace_bo) {
- sscreen->ws->buffer_unmap(sscreen->b.trace_bo->cs_buf);
- pipe_resource_reference((struct pipe_resource**)&sscreen->b.trace_bo, NULL);
- }
-#endif
-
- sscreen->b.ws->destroy(sscreen->b.ws);
- FREE(sscreen);
+ r600_destroy_common_screen(&sscreen->b);
}
struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
@@ -456,20 +446,6 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
if (debug_get_bool_option("RADEON_DUMP_SHADERS", FALSE))
sscreen->b.debug_flags |= DBG_FS | DBG_VS | DBG_GS | DBG_PS | DBG_CS;
-#if SI_TRACE_CS
- sscreen->b.cs_count = 0;
- if (sscreen->info.drm_minor >= 28) {
- sscreen->b.trace_bo = (struct r600_resource*)pipe_buffer_create(&sscreen->screen,
- PIPE_BIND_CUSTOM,
- PIPE_USAGE_STAGING,
- 4096);
- if (sscreen->b.trace_bo) {
- sscreen->b.trace_ptr = sscreen->ws->buffer_map(sscreen->b.trace_bo->cs_buf, NULL,
- PIPE_TRANSFER_UNSYNCHRONIZED);
- }
- }
-#endif
-
/* Create the auxiliary context. This must be done last. */
sscreen->b.aux_context = sscreen->b.b.context_create(&sscreen->b.b, NULL);