diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-01-29 11:03:59 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-01-29 11:03:59 +0000 |
commit | 577c1a78c1ab321c4df5b5f8b402820e577dc301 (patch) | |
tree | 188bcdd93c705f4c5f18bd57befdd182ca8b8c50 /lib/mesa/src/gallium/auxiliary | |
parent | 8c790d282ea10b253ddcb20649fcdcc54c1a003f (diff) |
Import Mesa 18.3.2
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary')
7 files changed, 63 insertions, 333 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/driver_rbug/README b/lib/mesa/src/gallium/auxiliary/driver_rbug/README index 6db94810f..0edf0ad89 100644 --- a/lib/mesa/src/gallium/auxiliary/driver_rbug/README +++ b/lib/mesa/src/gallium/auxiliary/driver_rbug/README @@ -22,7 +22,7 @@ information is in that directory. Also for a gui see: = Integrating = -You can integrate the rbug pipe driver either inside the gallium frontend or the +You can integrate the rbug pipe driver either inside the state tracker or the target. The procedure on both cases is the same. Let's assume you have a pipe_screen obtained by the usual means (variable and function names are just for illustration purposes): diff --git a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_context.c b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_context.c index b0c283d9b..e1f3c4f28 100644 --- a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_context.c +++ b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_context.c @@ -63,7 +63,7 @@ rbug_draw_block_locked(struct rbug_context *rb_pipe, int flag) } else if ((rb_pipe->draw_rule.blocker & flag) && (rb_pipe->draw_blocker & RBUG_BLOCK_RULE)) { unsigned k; - bool block = false; + boolean block = FALSE; unsigned sh; debug_printf("%s (%p %p) (%p %p) (%p %u) (%p %u)\n", __FUNCTION__, @@ -76,21 +76,21 @@ rbug_draw_block_locked(struct rbug_context *rb_pipe, int flag) for (sh = 0; sh < PIPE_SHADER_TYPES; sh++) { if (rb_pipe->draw_rule.shader[sh] && rb_pipe->draw_rule.shader[sh] == rb_pipe->curr.shader[sh]) - block = true; + block = TRUE; } if (rb_pipe->draw_rule.surf && rb_pipe->draw_rule.surf == rb_pipe->curr.zsbuf) - block = true; + block = TRUE; if (rb_pipe->draw_rule.surf) for (k = 0; k < rb_pipe->curr.nr_cbufs; k++) if (rb_pipe->draw_rule.surf == rb_pipe->curr.cbufs[k]) - block = true; + block = TRUE; if (rb_pipe->draw_rule.texture) { for (sh = 0; sh < ARRAY_SIZE(rb_pipe->curr.num_views); sh++) { for (k = 0; k < rb_pipe->curr.num_views[sh]; k++) { if (rb_pipe->draw_rule.texture == rb_pipe->curr.texs[sh][k]) { - block = true; + block = TRUE; sh = PIPE_SHADER_TYPES; /* to break out of both loops */ break; } @@ -114,19 +114,10 @@ rbug_draw_block_locked(struct rbug_context *rb_pipe, int flag) } static void -rbug_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *_info, - unsigned _drawid_offset, - const struct pipe_draw_indirect_info *_indirect, - const struct pipe_draw_start_count_bias *draws, - unsigned num_draws) +rbug_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; - struct pipe_draw_info info; - - info = *_info; - if(_info->index_size && !_info->has_user_indices) - info.index.resource = rbug_resource_unwrap(_info->index.resource); mtx_lock(&rb_pipe->draw_mutex); rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_BEFORE); @@ -136,7 +127,7 @@ rbug_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *_info, if (!(rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT] && rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT]->disabled) && !(rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY] && rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY]->disabled) && !(rb_pipe->curr.shader[PIPE_SHADER_VERTEX] && rb_pipe->curr.shader[PIPE_SHADER_VERTEX]->disabled)) - pipe->draw_vbo(pipe, &info, _drawid_offset, _indirect, draws, num_draws); + pipe->draw_vbo(pipe, info); mtx_unlock(&rb_pipe->call_mutex); rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_AFTER); @@ -173,13 +164,13 @@ rbug_destroy_query(struct pipe_context *_pipe, mtx_unlock(&rb_pipe->call_mutex); } -static bool +static boolean rbug_begin_query(struct pipe_context *_pipe, struct pipe_query *query) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; - bool ret; + boolean ret; mtx_lock(&rb_pipe->call_mutex); ret = pipe->begin_query(pipe, query); @@ -203,15 +194,15 @@ rbug_end_query(struct pipe_context *_pipe, return ret; } -static bool +static boolean rbug_get_query_result(struct pipe_context *_pipe, struct pipe_query *query, - bool wait, + boolean wait, union pipe_query_result *result) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; - bool ret; + boolean ret; mtx_lock(&rb_pipe->call_mutex); ret = pipe->get_query_result(pipe, @@ -224,7 +215,7 @@ rbug_get_query_result(struct pipe_context *_pipe, } static void -rbug_set_active_query_state(struct pipe_context *_pipe, bool enable) +rbug_set_active_query_state(struct pipe_context *_pipe, boolean enable) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; @@ -494,7 +485,7 @@ rbug_delete_vs_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct rbug_shader *rb_shader = rbug_shader(_vs); - mtx_lock(&rb_pipe->call_mutex); + mtx_unlock(&rb_pipe->call_mutex); rbug_shader_destroy(rb_pipe, rb_shader); mtx_unlock(&rb_pipe->call_mutex); } @@ -606,7 +597,7 @@ rbug_set_blend_color(struct pipe_context *_pipe, static void rbug_set_stencil_ref(struct pipe_context *_pipe, - const struct pipe_stencil_ref stencil_ref) + const struct pipe_stencil_ref *stencil_ref) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; @@ -633,7 +624,7 @@ rbug_set_clip_state(struct pipe_context *_pipe, static void rbug_set_constant_buffer(struct pipe_context *_pipe, enum pipe_shader_type shader, - uint index, bool take_ownership, + uint index, const struct pipe_constant_buffer *_cb) { struct rbug_context *rb_pipe = rbug_context(_pipe); @@ -649,7 +640,7 @@ rbug_set_constant_buffer(struct pipe_context *_pipe, mtx_lock(&rb_pipe->call_mutex); pipe->set_constant_buffer(pipe, shader, - index, take_ownership, + index, _cb ? &cb : NULL); mtx_unlock(&rb_pipe->call_mutex); } @@ -739,8 +730,6 @@ rbug_set_sampler_views(struct pipe_context *_pipe, enum pipe_shader_type shader, unsigned start, unsigned num, - unsigned unbind_num_trailing_slots, - bool take_ownership, struct pipe_sampler_view **_views) { struct rbug_context *rb_pipe = rbug_context(_pipe); @@ -769,8 +758,7 @@ rbug_set_sampler_views(struct pipe_context *_pipe, views = unwrapped_views; } - pipe->set_sampler_views(pipe, shader, start, num, - unbind_num_trailing_slots, take_ownership, views); + pipe->set_sampler_views(pipe, shader, start, num, views); mtx_unlock(&rb_pipe->call_mutex); } @@ -778,8 +766,6 @@ rbug_set_sampler_views(struct pipe_context *_pipe, static void rbug_set_vertex_buffers(struct pipe_context *_pipe, unsigned start_slot, unsigned num_buffers, - unsigned unbind_num_trailing_slots, - bool take_ownership, const struct pipe_vertex_buffer *_buffers) { struct rbug_context *rb_pipe = rbug_context(_pipe); @@ -801,8 +787,8 @@ rbug_set_vertex_buffers(struct pipe_context *_pipe, } pipe->set_vertex_buffers(pipe, start_slot, - num_buffers, unbind_num_trailing_slots, - take_ownership, buffers); + num_buffers, + buffers); mtx_unlock(&rb_pipe->call_mutex); } @@ -930,7 +916,6 @@ rbug_flush_resource(struct pipe_context *_pipe, static void rbug_clear(struct pipe_context *_pipe, unsigned buffers, - const struct pipe_scissor_state *scissor_state, const union pipe_color_union *color, double depth, unsigned stencil) @@ -941,7 +926,6 @@ rbug_clear(struct pipe_context *_pipe, mtx_lock(&rb_pipe->call_mutex); pipe->clear(pipe, buffers, - scissor_state, color, depth, stencil); @@ -1015,31 +999,6 @@ rbug_flush(struct pipe_context *_pipe, mtx_unlock(&rb_pipe->call_mutex); } -static void -rbug_create_fence_fd(struct pipe_context *_pipe, - struct pipe_fence_handle **fence, int fd, - enum pipe_fd_type type) -{ - struct rbug_context *rb_pipe = rbug_context(_pipe); - struct pipe_context *pipe = rb_pipe->pipe; - - mtx_lock(&rb_pipe->call_mutex); - pipe->create_fence_fd(pipe, fence, fd, type); - mtx_unlock(&rb_pipe->call_mutex); -} - -static void -rbug_fence_server_sync(struct pipe_context *_pipe, - struct pipe_fence_handle *fence) -{ - struct rbug_context *rb_pipe = rbug_context(_pipe); - struct pipe_context *pipe = rb_pipe->pipe; - - mtx_lock(&rb_pipe->call_mutex); - pipe->fence_server_sync(pipe, fence); - mtx_unlock(&rb_pipe->call_mutex); -} - static struct pipe_sampler_view * rbug_context_create_sampler_view(struct pipe_context *_pipe, struct pipe_resource *_resource, @@ -1108,7 +1067,7 @@ rbug_context_surface_destroy(struct pipe_context *_pipe, static void * -rbug_context_buffer_map(struct pipe_context *_context, +rbug_context_transfer_map(struct pipe_context *_context, struct pipe_resource *_resource, unsigned level, unsigned usage, @@ -1123,34 +1082,7 @@ rbug_context_buffer_map(struct pipe_context *_context, void *map; mtx_lock(&rb_pipe->call_mutex); - map = context->buffer_map(context, - resource, - level, - usage, - box, &result); - mtx_unlock(&rb_pipe->call_mutex); - - *transfer = rbug_transfer_create(rb_pipe, rb_resource, result); - return *transfer ? map : NULL; -} - -static void * -rbug_context_texture_map(struct pipe_context *_context, - struct pipe_resource *_resource, - unsigned level, - unsigned usage, - const struct pipe_box *box, - struct pipe_transfer **transfer) -{ - struct rbug_context *rb_pipe = rbug_context(_context); - struct rbug_resource *rb_resource = rbug_resource(_resource); - struct pipe_context *context = rb_pipe->pipe; - struct pipe_resource *resource = rb_resource->resource; - struct pipe_transfer *result; - void *map; - - mtx_lock(&rb_pipe->call_mutex); - map = context->texture_map(context, + map = context->transfer_map(context, resource, level, usage, @@ -1180,7 +1112,7 @@ rbug_context_transfer_flush_region(struct pipe_context *_context, static void -rbug_context_buffer_unmap(struct pipe_context *_context, +rbug_context_transfer_unmap(struct pipe_context *_context, struct pipe_transfer *_transfer) { struct rbug_context *rb_pipe = rbug_context(_context); @@ -1189,24 +1121,7 @@ rbug_context_buffer_unmap(struct pipe_context *_context, struct pipe_transfer *transfer = rb_transfer->transfer; mtx_lock(&rb_pipe->call_mutex); - context->buffer_unmap(context, - transfer); - rbug_transfer_destroy(rb_pipe, - rb_transfer); - mtx_unlock(&rb_pipe->call_mutex); -} - -static void -rbug_context_texture_unmap(struct pipe_context *_context, - struct pipe_transfer *_transfer) -{ - struct rbug_context *rb_pipe = rbug_context(_context); - struct rbug_transfer *rb_transfer = rbug_transfer(_transfer); - struct pipe_context *context = rb_pipe->pipe; - struct pipe_transfer *transfer = rb_transfer->transfer; - - mtx_lock(&rb_pipe->call_mutex); - context->texture_unmap(context, + context->transfer_unmap(context, transfer); rbug_transfer_destroy(rb_pipe, rb_transfer); @@ -1258,17 +1173,6 @@ rbug_context_texture_subdata(struct pipe_context *_context, mtx_unlock(&rb_pipe->call_mutex); } -static void -rbug_context_texture_barrier(struct pipe_context *_context, unsigned flags) -{ - struct rbug_context *rb_pipe = rbug_context(_context); - struct pipe_context *context = rb_pipe->pipe; - - mtx_lock(&rb_pipe->call_mutex); - context->texture_barrier(context, - flags); - mtx_unlock(&rb_pipe->call_mutex); -} struct pipe_context * rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) @@ -1343,31 +1247,26 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) rb_pipe->base.set_stream_output_targets = rbug_set_stream_output_targets; rb_pipe->base.resource_copy_region = rbug_resource_copy_region; rb_pipe->base.blit = rbug_blit; + rb_pipe->base.flush_resource = rbug_flush_resource; rb_pipe->base.clear = rbug_clear; rb_pipe->base.clear_render_target = rbug_clear_render_target; rb_pipe->base.clear_depth_stencil = rbug_clear_depth_stencil; rb_pipe->base.flush = rbug_flush; - rb_pipe->base.create_fence_fd = rbug_create_fence_fd; - rb_pipe->base.fence_server_sync = rbug_fence_server_sync; rb_pipe->base.create_sampler_view = rbug_context_create_sampler_view; rb_pipe->base.sampler_view_destroy = rbug_context_sampler_view_destroy; rb_pipe->base.create_surface = rbug_context_create_surface; rb_pipe->base.surface_destroy = rbug_context_surface_destroy; - rb_pipe->base.buffer_map = rbug_context_buffer_map; - rb_pipe->base.buffer_unmap = rbug_context_buffer_unmap; - rb_pipe->base.texture_map = rbug_context_texture_map; - rb_pipe->base.texture_unmap = rbug_context_texture_unmap; + rb_pipe->base.transfer_map = rbug_context_transfer_map; + rb_pipe->base.transfer_unmap = rbug_context_transfer_unmap; rb_pipe->base.transfer_flush_region = rbug_context_transfer_flush_region; rb_pipe->base.buffer_subdata = rbug_context_buffer_subdata; rb_pipe->base.texture_subdata = rbug_context_texture_subdata; - rb_pipe->base.texture_barrier = rbug_context_texture_barrier; - rb_pipe->base.flush_resource = rbug_flush_resource; rb_pipe->pipe = pipe; rbug_screen_add_to_list(rb_screen, contexts, rb_pipe); - if (debug_get_bool_option("GALLIUM_RBUG_START_BLOCKED", false)) { + if (debug_get_bool_option("GALLIUM_RBUG_START_BLOCKED", FALSE)) { rb_pipe->draw_blocked = RBUG_BLOCK_BEFORE; } diff --git a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_core.c b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_core.c index aad4487f4..76394039b 100644 --- a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_core.c +++ b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_core.c @@ -27,7 +27,7 @@ #include "os/os_thread.h" -#include "util/format/u_format.h" +#include "util/u_format.h" #include "util/u_string.h" #include "util/u_inlines.h" #include "util/u_memory.h" @@ -44,15 +44,18 @@ #include <errno.h> -#define U642VOID(x) ((void *)(uintptr_t)(x)) -#define VOID2U64(x) ((uint64_t)(uintptr_t)(x)) +#define U642VOID(x) ((void *)(unsigned long)(x)) +#define VOID2U64(x) ((uint64_t)(unsigned long)(x)) + +#define container_of(ptr, type, field) \ + (type*)((char*)ptr - offsetof(type, field)) struct rbug_rbug { struct rbug_screen *rb_screen; struct rbug_connection *con; thrd_t thread; - bool running; + boolean running; }; int @@ -267,9 +270,9 @@ rbug_texture_read(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_ } tex = tr_tex->resource; - map = pipe_texture_map(context, tex, + map = pipe_transfer_map(context, tex, gptr->level, gptr->face + gptr->zslice, - PIPE_MAP_READ, + PIPE_TRANSFER_READ, gptr->x, gptr->y, gptr->w, gptr->h, &t); rbug_send_texture_read_reply(tr_rbug->con, serial, @@ -283,7 +286,7 @@ rbug_texture_read(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_ t->stride, NULL); - context->texture_unmap(context, t); + context->transfer_unmap(context, t); mtx_unlock(&rb_screen->list_mutex); @@ -574,19 +577,17 @@ rbug_shader_info(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t /* just in case */ assert(sizeof(struct tgsi_token) == 4); - if (tr_shdr->tokens) { - original_len = tgsi_num_tokens(tr_shdr->tokens); - if (tr_shdr->replaced_tokens) - replaced_len = tgsi_num_tokens(tr_shdr->replaced_tokens); - else - replaced_len = 0; + original_len = tgsi_num_tokens(tr_shdr->tokens); + if (tr_shdr->replaced_tokens) + replaced_len = tgsi_num_tokens(tr_shdr->replaced_tokens); + else + replaced_len = 0; - rbug_send_shader_info_reply(tr_rbug->con, serial, - (uint32_t*)tr_shdr->tokens, original_len, - (uint32_t*)tr_shdr->replaced_tokens, replaced_len, - tr_shdr->disabled, - NULL); - } + rbug_send_shader_info_reply(tr_rbug->con, serial, + (uint32_t*)tr_shdr->tokens, original_len, + (uint32_t*)tr_shdr->replaced_tokens, replaced_len, + tr_shdr->disabled, + NULL); mtx_unlock(&rb_context->list_mutex); mtx_unlock(&rb_screen->list_mutex); @@ -712,7 +713,7 @@ err: return -EINVAL; } -static bool +static boolean rbug_header(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) { int ret = 0; @@ -773,7 +774,7 @@ rbug_header(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t seri if (ret) rbug_send_error_reply(tr_rbug->con, serial, ret, NULL); - return true; + return TRUE; } static void @@ -855,7 +856,7 @@ rbug_start(struct rbug_screen *rb_screen) return NULL; tr_rbug->rb_screen = rb_screen; - tr_rbug->running = true; + tr_rbug->running = TRUE; tr_rbug->thread = u_thread_create(rbug_thread, tr_rbug); return tr_rbug; diff --git a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_objects.c b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_objects.c index 09455cf6f..2aa4e123f 100644 --- a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_objects.c +++ b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_objects.c @@ -186,10 +186,7 @@ rbug_transfer_create(struct rbug_context *rb_context, return &rb_transfer->base; error: - if (rb_resource->base.target == PIPE_BUFFER) - rb_context->pipe->buffer_unmap(rb_context->pipe, transfer); - else - rb_context->pipe->texture_unmap(rb_context->pipe, transfer); + rb_context->pipe->transfer_unmap(rb_context->pipe, transfer); return NULL; } @@ -210,8 +207,7 @@ rbug_shader_create(struct rbug_context *rb_context, rb_shader->type = type; rb_shader->shader = result; - if (state->tokens) - rb_shader->tokens = tgsi_dup_tokens(state->tokens); + rb_shader->tokens = tgsi_dup_tokens(state->tokens); /* works on context as well since its just a macro */ rbug_screen_add_to_list(rb_context, shaders, rb_shader); diff --git a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_objects.h b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_objects.h index 1a16eb416..02973e079 100644 --- a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_objects.h +++ b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_objects.h @@ -64,7 +64,7 @@ struct rbug_shader void *replaced_tokens; enum rbug_shader_type type; - bool disabled; + boolean disabled; }; diff --git a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_public.h b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_public.h index d17cf98b8..83f9c94e3 100644 --- a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_public.h +++ b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_public.h @@ -38,7 +38,7 @@ struct pipe_context; struct pipe_screen * rbug_screen_create(struct pipe_screen *screen); -bool +boolean rbug_enabled(void); #ifdef __cplusplus diff --git a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_screen.c b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_screen.c index 9ddb6dfa7..693e7fab9 100644 --- a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_screen.c +++ b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_screen.c @@ -37,7 +37,7 @@ #include "rbug_context.h" #include "rbug_objects.h" -DEBUG_GET_ONCE_BOOL_OPTION(rbug, "GALLIUM_RBUG", false) +DEBUG_GET_ONCE_BOOL_OPTION(rbug, "GALLIUM_RBUG", FALSE) static void rbug_screen_destroy(struct pipe_screen *_screen) @@ -77,16 +77,6 @@ rbug_screen_get_device_vendor(struct pipe_screen *_screen) return screen->get_device_vendor(screen); } -static const void * -rbug_screen_get_compiler_options(struct pipe_screen *_screen, - enum pipe_shader_ir ir, - enum pipe_shader_type shader) -{ - struct pipe_screen *screen = rbug_screen(_screen)->screen; - - return screen->get_compiler_options(screen, ir, shader); -} - static struct disk_cache * rbug_screen_get_disk_shader_cache(struct pipe_screen *_screen) { @@ -129,7 +119,7 @@ rbug_screen_get_paramf(struct pipe_screen *_screen, param); } -static bool +static boolean rbug_screen_is_format_supported(struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, @@ -148,64 +138,6 @@ rbug_screen_is_format_supported(struct pipe_screen *_screen, tex_usage); } -static void -rbug_screen_query_dmabuf_modifiers(struct pipe_screen *_screen, - enum pipe_format format, int max, - uint64_t *modifiers, - unsigned int *external_only, int *count) -{ - struct rbug_screen *rb_screen = rbug_screen(_screen); - struct pipe_screen *screen = rb_screen->screen; - - screen->query_dmabuf_modifiers(screen, - format, - max, - modifiers, - external_only, - count); -} - -static bool -rbug_screen_is_dmabuf_modifier_supported(struct pipe_screen *_screen, - uint64_t modifier, - enum pipe_format format, - bool *external_only) -{ - struct rbug_screen *rb_screen = rbug_screen(_screen); - struct pipe_screen *screen = rb_screen->screen; - - return screen->is_dmabuf_modifier_supported(screen, - modifier, - format, - external_only); -} - -static unsigned int -rbug_screen_get_dmabuf_modifier_planes(struct pipe_screen *_screen, - uint64_t modifier, - enum pipe_format format) -{ - struct rbug_screen *rb_screen = rbug_screen(_screen); - struct pipe_screen *screen = rb_screen->screen; - - return screen->get_dmabuf_modifier_planes(screen, modifier, format); -} - -static int -rbug_screen_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 rbug_screen *rb_screen = rbug_screen(_screen); - struct pipe_screen *screen = rb_screen->screen; - - return screen->get_sparse_texture_virtual_page_size(screen, target, multi_sample, - format, offset, size, x, y, z); -} - static struct pipe_context * rbug_screen_context_create(struct pipe_screen *_screen, void *priv, unsigned flags) @@ -220,17 +152,6 @@ rbug_screen_context_create(struct pipe_screen *_screen, return NULL; } -static bool -rbug_screen_can_create_resource(struct pipe_screen *_screen, - const struct pipe_resource *templat) -{ - struct rbug_screen *rb_screen = rbug_screen(_screen); - struct pipe_screen *screen = rb_screen->screen; - - return screen->can_create_resource(screen, - templat); -} - static struct pipe_resource * rbug_screen_resource_create(struct pipe_screen *_screen, const struct pipe_resource *templat) @@ -248,25 +169,6 @@ rbug_screen_resource_create(struct pipe_screen *_screen, } static struct pipe_resource * -rbug_screen_resource_create_with_modifiers(struct pipe_screen *_screen, - const struct pipe_resource *templat, - const uint64_t *modifiers, int count) -{ - struct rbug_screen *rb_screen = rbug_screen(_screen); - struct pipe_screen *screen = rb_screen->screen; - struct pipe_resource *result; - - result = screen->resource_create_with_modifiers(screen, - templat, - modifiers, - count); - - if (result) - return rbug_resource_create(rb_screen, result); - return NULL; -} - -static struct pipe_resource * rbug_screen_resource_from_handle(struct pipe_screen *_screen, const struct pipe_resource *templ, struct winsys_handle *handle, @@ -296,7 +198,7 @@ rbug_screen_check_resource_capability(struct pipe_screen *_screen, return screen->check_resource_capability(screen, resource, bind); } -static bool +static boolean rbug_screen_resource_get_handle(struct pipe_screen *_screen, struct pipe_context *_pipe, struct pipe_resource *_resource, @@ -313,43 +215,6 @@ rbug_screen_resource_get_handle(struct pipe_screen *_screen, resource, handle, usage); } -static bool -rbug_screen_resource_get_param(struct pipe_screen *_screen, - struct pipe_context *_pipe, - struct pipe_resource *_resource, - unsigned plane, - unsigned layer, - unsigned level, - enum pipe_resource_param param, - unsigned handle_usage, - uint64_t *value) -{ - struct rbug_screen *rb_screen = rbug_screen(_screen); - struct rbug_context *rb_pipe = rbug_context(_pipe); - struct rbug_resource *rb_resource = rbug_resource(_resource); - struct pipe_screen *screen = rb_screen->screen; - struct pipe_resource *resource = rb_resource->resource; - - return screen->resource_get_param(screen, rb_pipe ? rb_pipe->pipe : NULL, - resource, plane, layer, level, param, - handle_usage, value); -} - - -static void -rbug_screen_resource_get_info(struct pipe_screen *_screen, - struct pipe_resource *_resource, - unsigned *stride, - unsigned *offset) -{ - struct rbug_screen *rb_screen = rbug_screen(_screen); - struct rbug_resource *rb_resource = rbug_resource(_resource); - struct pipe_screen *screen = rb_screen->screen; - struct pipe_resource *resource = rb_resource->resource; - - screen->resource_get_info(screen, resource, stride, offset); -} - static void rbug_screen_resource_changed(struct pipe_screen *_screen, struct pipe_resource *_resource) @@ -359,7 +224,8 @@ rbug_screen_resource_changed(struct pipe_screen *_screen, struct pipe_screen *screen = rb_screen->screen; struct pipe_resource *resource = rb_resource->resource; - screen->resource_changed(screen, resource); + if (screen->resource_changed) + screen->resource_changed(screen, resource); } static void @@ -371,7 +237,6 @@ rbug_screen_resource_destroy(struct pipe_screen *screen, static void rbug_screen_flush_frontbuffer(struct pipe_screen *_screen, - struct pipe_context *_ctx, struct pipe_resource *_resource, unsigned level, unsigned layer, void *context_private, struct pipe_box *sub_box) @@ -380,10 +245,8 @@ rbug_screen_flush_frontbuffer(struct pipe_screen *_screen, struct rbug_resource *rb_resource = rbug_resource(_resource); struct pipe_screen *screen = rb_screen->screen; struct pipe_resource *resource = rb_resource->resource; - struct pipe_context *ctx = _ctx ? rbug_context(_ctx)->pipe : NULL; screen->flush_frontbuffer(screen, - ctx, resource, level, layer, context_private, sub_box); @@ -402,7 +265,7 @@ rbug_screen_fence_reference(struct pipe_screen *_screen, fence); } -static bool +static boolean rbug_screen_fence_finish(struct pipe_screen *_screen, struct pipe_context *_ctx, struct pipe_fence_handle *fence, @@ -415,25 +278,7 @@ rbug_screen_fence_finish(struct pipe_screen *_screen, return screen->fence_finish(screen, ctx, fence, timeout); } -static int -rbug_screen_fence_get_fd(struct pipe_screen *_screen, - struct pipe_fence_handle *fence) -{ - struct rbug_screen *rb_screen = rbug_screen(_screen); - struct pipe_screen *screen = rb_screen->screen; - - return screen->fence_get_fd(screen, fence); -} - -static char * -rbug_screen_finalize_nir(struct pipe_screen *_screen, void *nir) -{ - struct pipe_screen *screen = rbug_screen(_screen)->screen; - - return screen->finalize_nir(screen, nir); -} - -bool +boolean rbug_enabled() { return debug_get_option_rbug(); @@ -463,33 +308,22 @@ rbug_screen_create(struct pipe_screen *screen) rb_screen->base.destroy = rbug_screen_destroy; rb_screen->base.get_name = rbug_screen_get_name; rb_screen->base.get_vendor = rbug_screen_get_vendor; - SCR_INIT(get_compiler_options); SCR_INIT(get_disk_shader_cache); rb_screen->base.get_device_vendor = rbug_screen_get_device_vendor; rb_screen->base.get_param = rbug_screen_get_param; rb_screen->base.get_shader_param = rbug_screen_get_shader_param; rb_screen->base.get_paramf = rbug_screen_get_paramf; rb_screen->base.is_format_supported = rbug_screen_is_format_supported; - SCR_INIT(query_dmabuf_modifiers); - SCR_INIT(is_dmabuf_modifier_supported); - SCR_INIT(get_dmabuf_modifier_planes); rb_screen->base.context_create = rbug_screen_context_create; - SCR_INIT(can_create_resource); rb_screen->base.resource_create = rbug_screen_resource_create; - SCR_INIT(resource_create_with_modifiers); rb_screen->base.resource_from_handle = rbug_screen_resource_from_handle; SCR_INIT(check_resource_capability); rb_screen->base.resource_get_handle = rbug_screen_resource_get_handle; - SCR_INIT(resource_get_param); - SCR_INIT(resource_get_info); SCR_INIT(resource_changed); rb_screen->base.resource_destroy = rbug_screen_resource_destroy; rb_screen->base.flush_frontbuffer = rbug_screen_flush_frontbuffer; rb_screen->base.fence_reference = rbug_screen_fence_reference; rb_screen->base.fence_finish = rbug_screen_fence_finish; - rb_screen->base.fence_get_fd = rbug_screen_fence_get_fd; - SCR_INIT(finalize_nir); - SCR_INIT(get_sparse_texture_virtual_page_size); rb_screen->screen = screen; |