Imported Upstream version 0.1.0+git20131207+e452e83
[deb_libhybris.git] / hybris / include / hybris / surface_flinger / surface_flinger_compatibility_layer.h
1 /*
2 * Copyright (C) 2013 Canonical Ltd
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 * Authored by: Thomas Voss <thomas.voss@canonical.com>
17 */
18
19 #ifndef SURFACE_FLINGER_COMPATIBILITY_LAYER_H_
20 #define SURFACE_FLINGER_COMPATIBILITY_LAYER_H_
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 #include <EGL/egl.h>
27 #include <EGL/eglext.h>
28
29 struct SfClient;
30 struct SfSurface;
31
32 enum
33 {
34 SURFACE_FLINGER_DEFAULT_DISPLAY_ID = 0
35 };
36
37 void sf_blank(size_t display_id);
38 void sf_unblank(size_t display_id);
39
40 size_t sf_get_display_width(size_t display_id);
41 size_t sf_get_display_height(size_t display_id);
42
43 // The egl_support parameter disables the use of EGL inside the
44 // library. sf_client_create() enables the use of EGL by default. When
45 // disabled, the functions sf_client_get_egl_display(),
46 // sf_client_get_egl_config(), sf_surface_get_egl_surface(),
47 // sf_surface_make_current() and the create_egl_window_surface feature are
48 // not supported anymore.
49 struct SfClient* sf_client_create_full(int egl_support);
50 struct SfClient* sf_client_create();
51
52 EGLDisplay sf_client_get_egl_display(struct SfClient* display);
53 EGLConfig sf_client_get_egl_config(struct SfClient* client);
54 void sf_client_begin_transaction(struct SfClient*);
55 void sf_client_end_transaction(struct SfClient*);
56
57 typedef struct
58 {
59 int x;
60 int y;
61 int w;
62 int h;
63 int format;
64 int layer;
65 float alpha;
66 int create_egl_window_surface;
67 const char* name;
68 } SfSurfaceCreationParameters;
69
70 struct SfSurface* sf_surface_create(struct SfClient* client,
71 SfSurfaceCreationParameters* params);
72 EGLSurface sf_surface_get_egl_surface(struct SfSurface*);
73 EGLNativeWindowType sf_surface_get_egl_native_window(struct SfSurface*);
74 void sf_surface_make_current(struct SfSurface* surface);
75
76 void sf_surface_move_to(struct SfSurface* surface, int x, int y);
77 void sf_surface_set_size(struct SfSurface* surface, int w, int h);
78 void sf_surface_set_layer(struct SfSurface* surface, int layer);
79 void sf_surface_set_alpha(struct SfSurface* surface, float alpha);
80
81 #ifdef __cplusplus
82 }
83 #endif
84
85 #endif // SURFACE_FLINGER_COMPATIBILITY_LAYER_H_