diff options
Diffstat (limited to 'src/gallium/auxiliary/driver_noop/noop_pipe.c')
-rw-r--r-- | src/gallium/auxiliary/driver_noop/noop_pipe.c | 103 |
1 files changed, 96 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/driver_noop/noop_pipe.c b/src/gallium/auxiliary/driver_noop/noop_pipe.c index 6cb17d7dc5e..1e657144c6e 100644 --- a/src/gallium/auxiliary/driver_noop/noop_pipe.c +++ b/src/gallium/auxiliary/driver_noop/noop_pipe.c @@ -29,6 +29,7 @@ #include "util/u_memory.h" #include "util/u_inlines.h" #include "util/format/u_format.h" +#include "util/u_helpers.h" #include "util/u_upload_mgr.h" #include "util/u_threaded_context.h" #include "noop_public.h" @@ -119,7 +120,7 @@ static struct pipe_resource *noop_resource_create(struct pipe_screen *screen, FREE(nresource); return NULL; } - threaded_resource_init(&nresource->b.b); + threaded_resource_init(&nresource->b.b, false); return &nresource->b.b; } @@ -268,7 +269,7 @@ static void noop_texture_subdata(struct pipe_context *pipe, const struct pipe_box *box, const void *data, unsigned stride, - unsigned layer_stride) + uintptr_t layer_stride) { } @@ -456,9 +457,11 @@ static struct pipe_context *noop_create_context(struct pipe_screen *screen, threaded_context_create(ctx, &((struct noop_pipe_screen*)screen)->pool_transfers, noop_replace_buffer_storage, - noop_create_fence, - noop_is_resource_busy, - false, NULL); + &(struct threaded_context_options) { + .create_fence = noop_create_fence, + .is_resource_busy = noop_is_resource_busy, + }, + NULL); if (tc && tc != ctx) threaded_context_init_bytes_mapped_limit((struct threaded_context *)tc, 4); @@ -474,7 +477,7 @@ static void noop_flush_frontbuffer(struct pipe_screen *_screen, struct pipe_context *ctx, struct pipe_resource *resource, unsigned level, unsigned layer, - void *context_private, struct pipe_box *box) + void *context_private, unsigned nboxes, struct pipe_box *box) { } @@ -613,6 +616,17 @@ static bool noop_check_resource_capability(struct pipe_screen *screen, return true; } +static void noop_create_fence_win32(struct pipe_screen *screen, + struct pipe_fence_handle **fence, + void *handle, + const void *name, + enum pipe_fd_type type) +{ + struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen *)screen; + struct pipe_screen *oscreen = noop_screen->oscreen; + oscreen->create_fence_win32(oscreen, fence, handle, name, type); +} + static void noop_set_max_shader_compiler_threads(struct pipe_screen *screen, unsigned max_threads) { @@ -620,7 +634,7 @@ static void noop_set_max_shader_compiler_threads(struct pipe_screen *screen, static bool noop_is_parallel_shader_compilation_finished(struct pipe_screen *screen, void *shader, - unsigned shader_type) + enum pipe_shader_type shader_type) { return true; } @@ -661,6 +675,36 @@ static void noop_get_device_uuid(struct pipe_screen *screen, char *uuid) oscreen->get_device_uuid(oscreen, uuid); } +static void noop_get_device_luid(struct pipe_screen *screen, char *luid) +{ + struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; + struct pipe_screen *oscreen = noop_screen->oscreen; + + oscreen->get_device_luid(oscreen, luid); +} + +static uint32_t noop_get_device_node_mask(struct pipe_screen *screen) +{ + struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; + struct pipe_screen *oscreen = noop_screen->oscreen; + + return oscreen->get_device_node_mask(oscreen); +} + +static int noop_get_sparse_texture_virtual_page_size(struct pipe_screen *screen, + enum pipe_texture_target target, + bool multi_sample, + enum pipe_format format, + unsigned offset, unsigned size, + int *x, int *y, int *z) +{ + struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; + struct pipe_screen *oscreen = noop_screen->oscreen; + + return oscreen->get_sparse_texture_virtual_page_size(screen, target, multi_sample, + format, offset, size, x, y, z); +} + static void noop_query_dmabuf_modifiers(struct pipe_screen *screen, enum pipe_format format, int max, uint64_t *modifiers, @@ -673,6 +717,41 @@ static void noop_query_dmabuf_modifiers(struct pipe_screen *screen, external_only, count); } +static struct pipe_vertex_state * +noop_create_vertex_state(struct pipe_screen *screen, + struct pipe_vertex_buffer *buffer, + const struct pipe_vertex_element *elements, + unsigned num_elements, + struct pipe_resource *indexbuf, + uint32_t full_velem_mask) +{ + struct pipe_vertex_state *state = CALLOC_STRUCT(pipe_vertex_state); + + if (!state) + return NULL; + + util_init_pipe_vertex_state(screen, buffer, elements, num_elements, indexbuf, + full_velem_mask, state); + return state; +} + +static void noop_vertex_state_destroy(struct pipe_screen *screen, + struct pipe_vertex_state *state) +{ + pipe_vertex_buffer_unreference(&state->input.vbuffer); + pipe_resource_reference(&state->input.indexbuf, NULL); + FREE(state); +} + +static void noop_set_fence_timeline_value(struct pipe_screen *screen, + struct pipe_fence_handle *fence, + uint64_t value) +{ + struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen *)screen; + struct pipe_screen *oscreen = noop_screen->oscreen; + oscreen->set_fence_timeline_value(oscreen, fence, value); +} + struct pipe_screen *noop_screen_create(struct pipe_screen *oscreen) { struct noop_pipe_screen *noop_screen; @@ -713,6 +792,8 @@ struct pipe_screen *noop_screen_create(struct pipe_screen *oscreen) screen->get_disk_shader_cache = noop_get_disk_shader_cache; screen->get_compiler_options = noop_get_compiler_options; screen->finalize_nir = noop_finalize_nir; + if (screen->create_fence_win32) + screen->create_fence_win32 = noop_create_fence_win32; screen->check_resource_capability = noop_check_resource_capability; screen->set_max_shader_compiler_threads = noop_set_max_shader_compiler_threads; screen->is_parallel_shader_compilation_finished = noop_is_parallel_shader_compilation_finished; @@ -720,8 +801,16 @@ struct pipe_screen *noop_screen_create(struct pipe_screen *oscreen) screen->get_dmabuf_modifier_planes = noop_get_dmabuf_modifier_planes; screen->get_driver_uuid = noop_get_driver_uuid; screen->get_device_uuid = noop_get_device_uuid; + screen->get_device_luid = noop_get_device_luid; + screen->get_device_node_mask = noop_get_device_node_mask; screen->query_dmabuf_modifiers = noop_query_dmabuf_modifiers; screen->resource_create_with_modifiers = noop_resource_create_with_modifiers; + screen->create_vertex_state = noop_create_vertex_state; + screen->vertex_state_destroy = noop_vertex_state_destroy; + if (oscreen->get_sparse_texture_virtual_page_size) + screen->get_sparse_texture_virtual_page_size = noop_get_sparse_texture_virtual_page_size; + if (oscreen->set_fence_timeline_value) + screen->set_fence_timeline_value = noop_set_fence_timeline_value; slab_create_parent(&noop_screen->pool_transfers, sizeof(struct pipe_transfer), 64); |