blob: 3ed450b77db34c8c50838f7e7710da8fc10f56b3 [file] [log] [blame]
Chia-I Wubdf4c562014-08-07 06:36:33 +08001/*
2 * XGL
3 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
Chia-I Wu44e42362014-09-02 08:32:09 +080023 *
24 * Authors:
25 * Chia-I Wu <olv@lunarg.com>
Chia-I Wubdf4c562014-08-07 06:36:33 +080026 */
27
28#ifndef FENCE_H
29#define FENCE_H
30
31#include "intel.h"
32#include "obj.h"
33
Chia-I Wu046a7a92015-02-17 14:29:01 -070034struct intel_bo;
Chia-I Wubdf4c562014-08-07 06:36:33 +080035struct intel_dev;
Chia-I Wu1db76e02014-09-15 14:21:14 +080036struct intel_wsi_x11;
Chia-I Wubdf4c562014-08-07 06:36:33 +080037
38struct intel_fence {
39 struct intel_obj obj;
40
Chia-I Wu046a7a92015-02-17 14:29:01 -070041 struct intel_bo *seqno_bo;
Chia-I Wu1db76e02014-09-15 14:21:14 +080042
43#ifdef ENABLE_WSI_X11
44 struct intel_wsi_x11 *x11;
Chia-I Wu7fbe2ab2014-11-07 13:26:45 +080045 struct intel_wsi_x11_window *x11_win;
Chia-I Wu1db76e02014-09-15 14:21:14 +080046 uint32_t x11_serial;
47#endif
Chia-I Wubdf4c562014-08-07 06:36:33 +080048};
49
50static inline struct intel_fence *intel_fence(XGL_FENCE fence)
51{
52 return (struct intel_fence *) fence;
53}
54
55static inline struct intel_fence *intel_fence_from_obj(struct intel_obj *obj)
56{
57 return (struct intel_fence *) obj;
58}
59
60XGL_RESULT intel_fence_create(struct intel_dev *dev,
61 const XGL_FENCE_CREATE_INFO *info,
62 struct intel_fence **fence_ret);
63void intel_fence_destroy(struct intel_fence *fence);
64
Chia-I Wubdf4c562014-08-07 06:36:33 +080065XGL_RESULT intel_fence_wait(struct intel_fence *fence, int64_t timeout_ns);
66
Chia-I Wu046a7a92015-02-17 14:29:01 -070067void intel_fence_set_seqno(struct intel_fence *fence,
68 struct intel_bo *seqno_bo);
Chia-I Wu1db76e02014-09-15 14:21:14 +080069
Chia-I Wu046a7a92015-02-17 14:29:01 -070070void intel_fence_set_x11(struct intel_fence *fence,
71 struct intel_wsi_x11 *x11,
72 struct intel_wsi_x11_window *win,
Chia-I Wubda4f622015-02-25 15:06:15 -070073 uint32_t serial,
74 struct intel_bo *seqno_bo);
Chia-I Wu1db76e02014-09-15 14:21:14 +080075
Chia-I Wubdf4c562014-08-07 06:36:33 +080076#endif /* FENCE_H */