xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/asahi/agx_fence.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2022 Amazon.com, Inc. or its affiliates.
3  * Copyright 2018-2019 Alyssa Rosenzweig
4  * Copyright 2018-2019 Collabora, Ltd.
5  * SPDX-License-Identifier: MIT
6  */
7 
8 #pragma once
9 
10 #include "pipe/p_state.h"
11 
12 struct agx_context;
13 
14 struct pipe_fence_handle {
15    struct pipe_reference reference;
16    uint32_t syncobj;
17    bool signaled;
18 };
19 
20 void agx_fence_reference(struct pipe_screen *pscreen,
21                          struct pipe_fence_handle **ptr,
22                          struct pipe_fence_handle *fence);
23 
24 bool agx_fence_finish(struct pipe_screen *pscreen, struct pipe_context *ctx,
25                       struct pipe_fence_handle *fence, uint64_t timeout);
26 
27 int agx_fence_get_fd(struct pipe_screen *screen, struct pipe_fence_handle *f);
28 
29 struct pipe_fence_handle *agx_fence_from_fd(struct agx_context *ctx, int fd,
30                                             enum pipe_fd_type type);
31 
32 struct pipe_fence_handle *agx_fence_create(struct agx_context *ctx);
33 
34 void agx_create_fence_fd(struct pipe_context *pctx,
35                          struct pipe_fence_handle **pfence, int fd,
36                          enum pipe_fd_type type);
37 
38 void agx_fence_server_sync(struct pipe_context *pctx,
39                            struct pipe_fence_handle *f);
40