tc: don't sync on internal UNSYNCHRONIZED texture_map calls
this can be used for expert-mode optimizations in the frontend when textures are explicitly created for this usage Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36634>
This commit is contained in:
committed by
Marge Bot
parent
1a4bfb1fcd
commit
e4e806503f
@@ -2835,21 +2835,28 @@ tc_texture_map(struct pipe_context *_pipe,
|
||||
struct threaded_context *tc = threaded_context(_pipe);
|
||||
struct threaded_resource *tres = threaded_resource(resource);
|
||||
struct pipe_context *pipe = tc->pipe;
|
||||
bool is_internal_unsynchronized = usage & PIPE_MAP_UNSYNCHRONIZED &&
|
||||
resource->flags & PIPE_RESOURCE_FLAG_MAP_UNSYNCHRONIZED;
|
||||
|
||||
if (tc->options.parse_renderpass_info && TC_RENDERPASS_INFO_HAS_WORK(tc->renderpass_info_recording->data32[0]))
|
||||
tc_check_fb_access(tc, NULL, resource);
|
||||
|
||||
tc_sync_msg(tc, "texture");
|
||||
tc_set_driver_thread(tc);
|
||||
/* block all unsync texture subdata during map */
|
||||
tc_set_resource_batch_usage_persistent(tc, resource, true);
|
||||
/* this can only be hit for internal use */
|
||||
if (is_internal_unsynchronized) {
|
||||
usage |= TC_TRANSFER_MAP_THREADED_UNSYNC;
|
||||
} else {
|
||||
tc_sync_msg(tc, "texture");
|
||||
tc_set_driver_thread(tc);
|
||||
/* block all unsync texture subdata during map */
|
||||
tc_set_resource_batch_usage_persistent(tc, resource, true);
|
||||
}
|
||||
|
||||
tc->bytes_mapped_estimate += box->width;
|
||||
|
||||
void *ret = pipe->texture_map(pipe, tres->latest ? tres->latest : resource,
|
||||
level, usage, box, transfer);
|
||||
|
||||
if (!(usage & TC_TRANSFER_MAP_THREADED_UNSYNC))
|
||||
if (is_internal_unsynchronized && !(usage & TC_TRANSFER_MAP_THREADED_UNSYNC))
|
||||
tc_clear_driver_thread(tc);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -518,7 +518,8 @@ enum pipe_flush_flags
|
||||
#define PIPE_RESOURCE_FLAG_UNMAPPABLE (1 << 8) /* implies staging transfers due to VK interop */
|
||||
#define PIPE_RESOURCE_FLAG_FIXED_ADDRESS (1 << 9) /* virtual memory address never changes */
|
||||
#define PIPE_RESOURCE_FLAG_FRONTEND_VM (1 << 10) /* the frontend assigns addresses */
|
||||
#define PIPE_RESOURCE_FLAG_DRV_PRIV (1 << 11) /* driver/winsys private */
|
||||
#define PIPE_RESOURCE_FLAG_MAP_UNSYNCHRONIZED (1 << 11) /* the texture can be mapped UNSYNCHRONIZED */
|
||||
#define PIPE_RESOURCE_FLAG_DRV_PRIV (1 << 12) /* driver/winsys private */
|
||||
#define PIPE_RESOURCE_FLAG_FRONTEND_PRIV (1 << 24) /* gallium frontend private */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user