1 /*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 
17 #pragma once
18 
19 #include <cstdint>
20 
21 #ifdef _MSC_VER
22 # ifdef BUILDING_EMUGL_COMMON_SHARED
23 #  define EMUGL_COMMON_API __declspec(dllexport)
24 # else
25 #  define EMUGL_COMMON_API __declspec(dllimport)
26 #endif
27 #else
28 # define EMUGL_COMMON_API
29 #endif
30 
31 // Goldfish sync device
32 typedef uint64_t (*emugl_sync_create_timeline_t)();
33 typedef int (*emugl_sync_create_fence_t)(uint64_t timeline, uint32_t pt);
34 typedef void (*emugl_sync_timeline_inc_t)(uint64_t timeline, uint32_t howmuch);
35 typedef void (*emugl_sync_destroy_timeline_t)(uint64_t timeline);
36 
37 typedef void (*emugl_sync_trigger_wait_t)(uint64_t glsync, uint64_t thread, uint64_t timeline);
38 typedef void (*emugl_sync_register_trigger_wait_t)(emugl_sync_trigger_wait_t trigger_fn);
39 
40 typedef bool (*emugl_sync_device_exists_t)();
41 
42 namespace emugl {
43 
44 EMUGL_COMMON_API extern emugl_sync_create_timeline_t emugl_sync_create_timeline;
45 EMUGL_COMMON_API extern emugl_sync_create_fence_t emugl_sync_create_fence;
46 EMUGL_COMMON_API extern emugl_sync_timeline_inc_t emugl_sync_timeline_inc;
47 EMUGL_COMMON_API extern emugl_sync_destroy_timeline_t emugl_sync_destroy_timeline;
48 EMUGL_COMMON_API extern emugl_sync_register_trigger_wait_t emugl_sync_register_trigger_wait;
49 EMUGL_COMMON_API extern emugl_sync_device_exists_t emugl_sync_device_exists;
50 
51 EMUGL_COMMON_API void set_emugl_sync_create_timeline(emugl_sync_create_timeline_t);
52 EMUGL_COMMON_API void set_emugl_sync_create_fence(emugl_sync_create_fence_t);
53 EMUGL_COMMON_API void set_emugl_sync_timeline_inc(emugl_sync_timeline_inc_t);
54 EMUGL_COMMON_API void set_emugl_sync_destroy_timeline(emugl_sync_destroy_timeline_t);
55 EMUGL_COMMON_API void set_emugl_sync_register_trigger_wait(emugl_sync_register_trigger_wait_t trigger_fn);
56 EMUGL_COMMON_API void set_emugl_sync_device_exists(emugl_sync_device_exists_t);
57 
58 }  // namespace emugl
59