Path: blob/21.2-virgl/src/gallium/drivers/zink/zink_fence.h
4570 views
/*1* Copyright 2018 Collabora Ltd.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* on the rights to use, copy, modify, merge, publish, distribute, sub7* license, and/or sell copies of the Software, and to permit persons to whom8* the Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL17* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,18* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR19* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE20* USE OR OTHER DEALINGS IN THE SOFTWARE.21*/2223#ifndef ZINK_FENCE_H24#define ZINK_FENCE_H2526#include "util/simple_mtx.h"27#include "util/u_inlines.h"28#include "util/u_queue.h"2930#include <vulkan/vulkan.h>3132struct pipe_context;33struct pipe_screen;34struct zink_batch;35struct zink_batch_state;36struct zink_context;37struct zink_screen;3839struct tc_unflushed_batch_token;4041struct zink_tc_fence {42struct pipe_reference reference;43uint32_t submit_count;44struct util_queue_fence ready;45struct tc_unflushed_batch_token *tc_token;46struct pipe_context *deferred_ctx;47struct zink_fence *fence;48};4950struct zink_fence {51VkFence fence;52uint32_t batch_id;53bool submitted;54bool completed;55};5657static inline struct zink_fence *58zink_fence(void *pfence)59{60return (struct zink_fence *)pfence;61}6263static inline struct zink_tc_fence *64zink_tc_fence(void *pfence)65{66return (struct zink_tc_fence *)pfence;67}6869struct zink_tc_fence *70zink_create_tc_fence(void);7172struct pipe_fence_handle *73zink_create_tc_fence_for_tc(struct pipe_context *pctx, struct tc_unflushed_batch_token *tc_token);7475void76zink_fence_reference(struct zink_screen *screen,77struct zink_tc_fence **ptr,78struct zink_tc_fence *fence);7980void81zink_fence_server_sync(struct pipe_context *pctx, struct pipe_fence_handle *pfence);8283void84zink_screen_fence_init(struct pipe_screen *pscreen);8586bool87zink_vkfence_wait(struct zink_screen *screen, struct zink_fence *fence, uint64_t timeout_ns);8889void90zink_fence_clear_resources(struct zink_screen *screen, struct zink_fence *fence);91#endif929394