static void dd_screen_get_device_uuid(struct pipe_screen *_screen, char *uuid) { struct pipe_screen *screen = dd_screen(_screen)->screen; screen->get_device_uuid(screen, uuid); }
static struct disk_cache * dd_screen_get_disk_shader_cache(struct pipe_screen *_screen) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->get_disk_shader_cache(screen); }
static uint64_t dd_screen_get_timestamp(struct pipe_screen *_screen) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->get_timestamp(screen); }
static void dd_screen_query_memory_info(struct pipe_screen *_screen, struct pipe_memory_info *info) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->query_memory_info(screen, info); }
static const char * dd_screen_get_name(struct pipe_screen *_screen) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->get_name(screen); }
static void dd_after_draw(struct dd_context *dctx, struct dd_call *call) { struct dd_screen *dscreen = dd_screen(dctx->base.screen); if (dctx->num_draw_calls >= dscreen->skip_count) { switch (dscreen->mode) { case DD_DETECT_HANGS: if (!dscreen->no_flush && dd_flush_and_check_hang(dctx, NULL, 0)) { dd_dump_call(dctx, call, PIPE_DEBUG_DEVICE_IS_HUNG); /* Terminate the process to prevent future hangs. */ dd_kill_process(); } break; case DD_DUMP_ALL_CALLS: dd_dump_call(dctx, call, 0); break; default: assert(0); } } ++dctx->num_draw_calls; if (dscreen->skip_count && dctx->num_draw_calls % 10000 == 0) fprintf(stderr, "Gallium debugger reached %u draw calls.\n", dctx->num_draw_calls); }
static const char * dd_screen_get_device_vendor(struct pipe_screen *_screen) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->get_device_vendor(screen); }
static bool dd_flush_and_check_hang(struct dd_context *dctx, struct pipe_fence_handle **flush_fence, unsigned flush_flags) { struct pipe_fence_handle *fence = NULL; struct pipe_context *pipe = dctx->pipe; struct pipe_screen *screen = pipe->screen; uint64_t timeout_ms = dd_screen(dctx->base.screen)->timeout_ms; bool idle; assert(timeout_ms > 0); pipe->flush(pipe, &fence, flush_flags); if (flush_fence) screen->fence_reference(screen, flush_fence, fence); if (!fence) return false; idle = screen->fence_finish(screen, fence, timeout_ms * 1000000); screen->fence_reference(screen, &fence, NULL); if (!idle) fprintf(stderr, "dd: GPU hang detected!\n"); return !idle; }
static int dd_screen_get_shader_param(struct pipe_screen *_screen, unsigned shader, enum pipe_shader_cap param) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->get_shader_param(screen, shader, param); }
static boolean dd_screen_can_create_resource(struct pipe_screen *_screen, const struct pipe_resource *templat) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->can_create_resource(screen, templat); }
static void dd_screen_memobj_destroy(struct pipe_screen *_screen, struct pipe_memory_object *memobj) { struct pipe_screen *screen = dd_screen(_screen)->screen; screen->memobj_destroy(screen, memobj); }
static float dd_screen_get_paramf(struct pipe_screen *_screen, enum pipe_capf param) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->get_paramf(screen, param); }
static void dd_screen_resource_destroy(struct pipe_screen *_screen, struct pipe_resource *res) { struct pipe_screen *screen = dd_screen(_screen)->screen; screen->resource_destroy(screen, res); }
static struct pipe_memory_object * dd_screen_memobj_create_from_handle(struct pipe_screen *_screen, struct winsys_handle *handle, bool dedicated) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->memobj_create_from_handle(screen, handle, dedicated); }
static void dd_screen_fence_reference(struct pipe_screen *_screen, struct pipe_fence_handle **pdst, struct pipe_fence_handle *src) { struct pipe_screen *screen = dd_screen(_screen)->screen; screen->fence_reference(screen, pdst, src); }
static bool dd_screen_check_resource_capability(struct pipe_screen *_screen, struct pipe_resource *resource, unsigned bind) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->check_resource_capability(screen, resource, bind); }
static boolean dd_screen_resource_get_handle(struct pipe_screen *_screen, struct pipe_resource *resource, struct winsys_handle *handle) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->resource_get_handle(screen, resource, handle); }
static int dd_screen_get_driver_query_group_info(struct pipe_screen *_screen, unsigned index, struct pipe_driver_query_group_info *info) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->get_driver_query_group_info(screen, index, info); }
static void dd_screen_destroy(struct pipe_screen *_screen) { struct dd_screen *dscreen = dd_screen(_screen); struct pipe_screen *screen = dscreen->screen; screen->destroy(screen); FREE(dscreen); }
static boolean dd_screen_fence_finish(struct pipe_screen *_screen, struct pipe_fence_handle *fence, uint64_t timeout) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->fence_finish(screen, fence, timeout); }
static const void * dd_screen_get_compiler_options(struct pipe_screen *_screen, enum pipe_shader_ir ir, enum pipe_shader_type shader) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->get_compiler_options(screen, ir, shader); }
static int dd_screen_get_compute_param(struct pipe_screen *_screen, enum pipe_shader_ir ir_type, enum pipe_compute_cap param, void *ret) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->get_compute_param(screen, ir_type, param, ret); }
static boolean dd_screen_fence_finish(struct pipe_screen *_screen, struct pipe_context *_ctx, struct pipe_fence_handle *fence, uint64_t timeout) { struct pipe_screen *screen = dd_screen(_screen)->screen; struct pipe_context *ctx = _ctx ? dd_context(_ctx)->pipe : NULL; return screen->fence_finish(screen, ctx, fence, timeout); }
static void dd_before_draw(struct dd_context *dctx) { struct dd_screen *dscreen = dd_screen(dctx->base.screen); if (dscreen->mode == DD_DETECT_HANGS && !dscreen->no_flush && dctx->num_draw_calls >= dscreen->skip_count) dd_flush_and_handle_hang(dctx, NULL, 0, "GPU hang most likely caused by internal " "driver commands"); }
static struct pipe_context * dd_screen_context_create(struct pipe_screen *_screen, void *priv, unsigned flags) { struct dd_screen *dscreen = dd_screen(_screen); struct pipe_screen *screen = dscreen->screen; flags |= PIPE_CONTEXT_DEBUG; return dd_context_create(dscreen, screen->context_create(screen, priv, flags)); }
static boolean dd_screen_is_format_supported(struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, unsigned tex_usage) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->is_format_supported(screen, format, target, sample_count, tex_usage); }
static void dd_screen_flush_frontbuffer(struct pipe_screen *_screen, struct pipe_resource *resource, unsigned level, unsigned layer, void *context_private, struct pipe_box *sub_box) { struct pipe_screen *screen = dd_screen(_screen)->screen; screen->flush_frontbuffer(screen, resource, level, layer, context_private, sub_box); }
static boolean dd_screen_resource_get_handle(struct pipe_screen *_screen, struct pipe_context *_pipe, struct pipe_resource *resource, struct winsys_handle *handle, unsigned usage) { struct pipe_screen *screen = dd_screen(_screen)->screen; struct pipe_context *pipe = _pipe ? dd_context(_pipe)->pipe : NULL; return screen->resource_get_handle(screen, pipe, resource, handle, usage); }
static struct pipe_resource * dd_screen_resource_create(struct pipe_screen *_screen, const struct pipe_resource *templat) { struct pipe_screen *screen = dd_screen(_screen)->screen; struct pipe_resource *res = screen->resource_create(screen, templat); if (!res) return NULL; res->screen = _screen; return res; }
static void dd_context_destroy(struct pipe_context *_pipe) { struct dd_context *dctx = dd_context(_pipe); struct pipe_context *pipe = dctx->pipe; if (dctx->thread) { mtx_lock(&dctx->mutex); dctx->kill_thread = 1; mtx_unlock(&dctx->mutex); thrd_join(dctx->thread, NULL); mtx_destroy(&dctx->mutex); assert(!dctx->records); } if (dctx->fence) { pipe->transfer_unmap(pipe, dctx->fence_transfer); pipe_resource_reference(&dctx->fence, NULL); } if (pipe->set_log_context) { pipe->set_log_context(pipe, NULL); if (dd_screen(dctx->base.screen)->mode == DD_DUMP_ALL_CALLS) { FILE *f = dd_get_file_stream(dd_screen(dctx->base.screen), 0); if (f) { fprintf(f, "Remainder of driver log:\n\n"); } u_log_new_page_print(&dctx->log, f); fclose(f); } } u_log_context_destroy(&dctx->log); pipe->destroy(pipe); FREE(dctx); }