1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef __eglplatform_shim_h_
6#define __eglplatform_shim_h_
7
8#include <stdbool.h>
9#include <stdint.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#define SHIM_EXPORT __attribute__((visibility("default")))
16
17// Simple integral native window identifier.
18// NB: Unlike EGLNativeWindowType, this will be shipped between processes.
19typedef int ShimNativeWindowId;
20#define SHIM_NO_WINDOW_ID ((ShimNativeWindowId)0)
21
22// Opaque versions of EGL types (as used by ozone).
23typedef intptr_t ShimEGLNativeDisplayType;
24typedef intptr_t ShimEGLNativeWindowType;
25
26// QueryString targets
27#define SHIM_EGL_LIBRARY 0x1001
28#define SHIM_GLES_LIBRARY 0x1002
29
30// CreateWindow / QueryWindow attributes
31#define SHIM_WINDOW_WIDTH 0x0001
32#define SHIM_WINDOW_HEIGHT 0x0002
33
34// Query global implementation information.
35SHIM_EXPORT const char* ShimQueryString(int name);
36
37// Init/terminate library.
38SHIM_EXPORT bool ShimInitialize(void);
39SHIM_EXPORT bool ShimTerminate(void);
40
41// Create window handle & query window properties (called from browser process).
42SHIM_EXPORT ShimNativeWindowId ShimCreateWindow(void);
43SHIM_EXPORT bool ShimQueryWindow(ShimNativeWindowId window_id,
44                                 int attribute,
45                                 int* value);
46SHIM_EXPORT bool ShimDestroyWindow(ShimNativeWindowId window_id);
47
48// Manage actual EGL platform objects (called from GPU process).
49SHIM_EXPORT ShimEGLNativeDisplayType ShimGetNativeDisplay(void);
50SHIM_EXPORT ShimEGLNativeWindowType
51    ShimGetNativeWindow(ShimNativeWindowId native_window_id);
52SHIM_EXPORT bool ShimReleaseNativeWindow(ShimEGLNativeWindowType native_window);
53
54#ifdef __cplusplus
55}
56#endif
57
58#endif /* __eglplatform_shim_h */
59