Path: blob/21.2-virgl/src/gallium/drivers/llvmpipe/lp_fence.h
4570 views
/**************************************************************************1*2* Copyright 2009 VMware, Inc.3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/262728#ifndef LP_FENCE_H29#define LP_FENCE_H303132#include "os/os_thread.h"33#include "pipe/p_state.h"34#include "util/u_inlines.h"353637struct pipe_screen;383940struct lp_fence41{42struct pipe_reference reference;43unsigned id;4445mtx_t mutex;46cnd_t signalled;4748boolean issued;49unsigned rank;50unsigned count;51};525354struct lp_fence *55lp_fence_create(unsigned rank);565758void59lp_fence_signal(struct lp_fence *fence);6061boolean62lp_fence_signalled(struct lp_fence *fence);6364void65lp_fence_wait(struct lp_fence *fence);6667boolean68lp_fence_timedwait(struct lp_fence *fence, uint64_t timeout);6970void71llvmpipe_init_screen_fence_funcs(struct pipe_screen *screen);727374void75lp_fence_destroy(struct lp_fence *fence);7677static inline void78lp_fence_reference(struct lp_fence **ptr,79struct lp_fence *f)80{81struct lp_fence *old = *ptr;8283if (pipe_reference(&old->reference, &f->reference)) {84lp_fence_destroy(old);85}8687*ptr = f;88}8990static inline boolean91lp_fence_issued(const struct lp_fence *fence)92{93return fence->issued;94}959697#endif /* LP_FENCE_H */9899100