xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/panfrost/pan_fence.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright (c) 2022 Amazon.com, Inc. or its affiliates.
3  * Copyright 2018-2019 Alyssa Rosenzweig
4  * Copyright 2018-2019 Collabora, Ltd.
5  * All Rights Reserved.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a
8  * copy of this software and associated documentation files (the
9  * "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sub license, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to
13  * the following conditions:
14  *
15  * The above copyright notice and this permission notice (including the
16  * next paragraph) shall be included in all copies or substantial portions
17  * of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
23  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26  */
27 
28 #include "pipe/p_state.h"
29 
30 struct panfrost_context;
31 
32 struct pipe_fence_handle {
33    struct pipe_reference reference;
34    uint32_t syncobj;
35    bool signaled;
36 };
37 
38 void panfrost_fence_reference(struct pipe_screen *pscreen,
39                               struct pipe_fence_handle **ptr,
40                               struct pipe_fence_handle *fence);
41 
42 bool panfrost_fence_finish(struct pipe_screen *pscreen,
43                            struct pipe_context *ctx,
44                            struct pipe_fence_handle *fence, uint64_t timeout);
45 
46 int panfrost_fence_get_fd(struct pipe_screen *screen,
47                           struct pipe_fence_handle *f);
48 
49 struct pipe_fence_handle *panfrost_fence_from_fd(struct panfrost_context *ctx,
50                                                  int fd,
51                                                  enum pipe_fd_type type);
52 
53 struct pipe_fence_handle *panfrost_fence_create(struct panfrost_context *ctx);
54