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,
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)) {
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;
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);
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)
/* 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);
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)
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);