zink: force mesa flush implicit fencing on ANV

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9290>
This commit is contained in:
Mike Blumenkrantz 2020-12-23 11:17:21 -05:00
parent 6fb4e1345d
commit bbfeebabfd
3 changed files with 17 additions and 0 deletions

View File

@ -14,6 +14,8 @@
#include "util/u_debug.h"
#include "util/set.h"
#include "wsi_common.h"
void
zink_reset_batch(struct zink_context *ctx, struct zink_batch *batch)
{
@ -135,6 +137,16 @@ zink_end_batch(struct zink_context *ctx, struct zink_batch *batch)
si.commandBufferCount = 1;
si.pCommandBuffers = &batch->cmdbuf;
struct wsi_memory_signal_submit_info mem_signal = {
.sType = VK_STRUCTURE_TYPE_WSI_MEMORY_SIGNAL_SUBMIT_INFO_MESA,
.pNext = si.pNext,
};
if (batch->flush_res) {
mem_signal.memory = batch->flush_res->mem;
si.pNext = &mem_signal;
}
if (vkQueueSubmit(ctx->queue, 1, &si, batch->fence->fence) != VK_SUCCESS) {
debug_printf("ZINK: vkQueueSubmit() failed\n");
ctx->is_device_lost = true;
@ -144,6 +156,7 @@ zink_end_batch(struct zink_context *ctx, struct zink_batch *batch)
}
}
batch->submitted = true;
batch->flush_res = NULL;
}
/* returns either the compute batch id or 0 (gfx batch id) based on whether a resource

View File

@ -46,6 +46,8 @@ struct zink_batch {
VkCommandPool cmdpool;
VkCommandBuffer cmdbuf;
struct zink_resource *flush_res;
unsigned short descs_used; //number of descriptors currently allocated
struct zink_fence *fence;

View File

@ -1621,6 +1621,8 @@ zink_flush(struct pipe_context *pctx,
zink_resource_image_barrier(ctx, batch,
ctx->fb_state.cbufs[i] ? zink_resource(ctx->fb_state.cbufs[i]->texture) : NULL,
VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, 0, 0);
if (zink_screen(pctx->screen)->needs_mesa_flush_wsi && ctx->fb_state.cbufs[0])
batch->flush_res = zink_resource(ctx->fb_state.cbufs[0]->texture);
}
flush_batch(ctx);