1f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/*
2f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * Copyright (C) 2016 The Android Open Source Project
3f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland *
4f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * Licensed under the Apache License, Version 2.0 (the "License");
5f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * you may not use this file except in compliance with the License.
6f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * You may obtain a copy of the License at
7f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland *
8f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland *      http://www.apache.org/licenses/LICENSE-2.0
9f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland *
10f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * Unless required by applicable law or agreed to in writing, software
11f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * distributed under the License is distributed on an "AS IS" BASIS,
12f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * See the License for the specific language governing permissions and
14f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * limitations under the License.
15f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland */
16f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
17f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#ifndef ANDROID_FB_INTERFACE_H
18f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define ANDROID_FB_INTERFACE_H
19f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
20f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
21f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#include <onelib>
22f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#include <there/somelib.h>
23f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#include "mylib.h"
24f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
25f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland__BEGIN_DECLS
26f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
27f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland// comments
28f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
29f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define MY_DEFINE 1 \
30f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland                  + 1
31f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define META(thing1, thing2) thing1 + thing2
32f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define VERSION HARDWARE_MODULE_API_VERSION(0, 1)
33f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define ONE 1 /* got to
34f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland                 get rid of magic numbers */
35f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
36f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/* test */
37f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/** test */
38f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/* test **/
39f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/* test / ** ** / test */
40f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/* test //// ***** test /****/
41f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
42f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define a 1l
43f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define b 1l + 2ll
44f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define c 1ul + 1l
45f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define d 2 + 1l
46f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define e 3 + 1ll
47f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define f 4 + 3ul
48f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define g 1l + 3
49f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define h 32u
50f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define i 64ull
51f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define j 2 + a
52f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define k 1u
53f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define l k + 1l
54f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
55f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/*****************************************************************************/
56f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef enum {
57f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    A = 47,
58f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /* B is a very important value */
59f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    B,
60c38c858f349efd50c5a254df54fd19bf4716a217Steven Moreland#ifdef UNHAPPY
61f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    C = 1 + test(19) + test2[21],
62c38c858f349efd50c5a254df54fd19bf4716a217Steven Moreland#endif
63f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    D = 1 ? 1 : 2
64f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} onehere;
65f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
66f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandinline std::string to_string(T value) { return to_string(static_cast<E>(value)); }
67f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
68f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandconst res_t RESULT_ACCESS_DENIED = ~2 | -1;
69f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandconst res_t RESULT_INVALID_PARAMETER = 54;
70f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
71f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#ifdef __cplusplus
72f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandextern "C" {
73f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#endif
74f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
75f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandstatic void fun1() { }
76f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
7795b46238e9f0420e2e79ce2bda2cabc24aff4769Steven Morelandtypedef int my_int_type;
7895b46238e9f0420e2e79ce2bda2cabc24aff4769Steven Morelandtypedef my_int_type my_type_two;
7995b46238e9f0420e2e79ce2bda2cabc24aff4769Steven Moreland
80f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandnamespace MyNamespace {
817c0a90a2b7050cf9f92c72fe62f757201ad8f41eYifan Hong    static void fun1() { }
82f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    static void fun2() { }
83f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland}
84f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
85f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#ifdef __cplusplus
86f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland}
87f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#endif
88f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
89f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandstatic void fun3() { test; }
90f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandstatic void fun4() { test; }
91f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
92f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#undef ONE
93f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
94f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/*****************************************************************************/
95f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef void (*no_arg_fun)(void);
96f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
97f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef int (*other_fun)(int j);
98f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
99f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef void (*alarm_cb)(void *data);
100f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
101f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef void (*special_types)(const native_handle_t* a, int b);
102f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
103f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef foo_t bar_t;
104f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
105f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandstruct baz_t;
106f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
107f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef pthread_t (* fun_with_funs)(void (*my_fun)(void *), void* arg);
108f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
109f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandint (*global_fun_1)(struct framebuffer_device_t* dev, int enable);
110f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandint (*global_fun_2)(struct framebuffer_device_t* dev, int enable);
111f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
112f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef struct framebuffer_device_t {
113f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /**
114f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * Common methods of the framebuffer device.
115f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     */
116f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    struct hw_device_t common;
117f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
118f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    typedef enum another_here {
119f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland        A = 3 | 4,
120f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland        B,
121f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland        C = 4
122f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    } another_here;
123f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
124f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /* anon struct */
125f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    struct {
126f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland        float b;
127f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    };
128f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
129f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    struct not_type_defd {
130f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland        double latitude[];
131f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland        double halfLongitude;
132f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    };
133f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
134b56909629ae9b9a9ed45df3335e389e417569aa7Steven Moreland    char here;
135b56909629ae9b9a9ed45df3335e389e417569aa7Steven Moreland
136f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /* flags describing some attributes of the framebuffer */
137f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    const uint32_t  flags;
138f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
139f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /* dimensions of the framebuffer in pixels */
140f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    const uint32_t  width;
141f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    const uint32_t  height;
142f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
143f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /* frambuffer stride in pixels */
144f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    const int       stride;
145f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
146f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /* framebuffer pixel format */
14795b46238e9f0420e2e79ce2bda2cabc24aff4769Steven Moreland    const int       format_type;
148f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
149f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /* resolution of the framebuffer's display panel in pixel per inch*/
150f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    const float     xdpi;
151f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    const float     ydpi;
152f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
153f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /* framebuffer's display panel refresh rate in frames per second */
154f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    const float     fps;
155f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
156f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /* min swap interval supported by this framebuffer */
157f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    const int       minSwapInterval;
158f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
159f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /* max swap interval supported by this framebuffer */
160f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    const int       maxSwapInterval;
161f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
162f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /* Number of framebuffers supported*/
163f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    const int       numFramebuffers;
164f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
165f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    int reserved[7];
166f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
167f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /*
168f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * requests a specific swap-interval (same definition than EGL)
169f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *
170f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * Returns 0 on success or -errno on error.
171f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     */
172f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    int (*setSwapInterval)(struct framebuffer_device_t* window,
173f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland            int interval);
174f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
175f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /*
176f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * This hook is OPTIONAL.
177f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *
178f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * It is non NULL If the framebuffer driver supports "update-on-demand"
179f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * and the given rectangle is the area of the screen that gets
180f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * updated during (*post)().
181f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *
182f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * This is useful on devices that are able to DMA only a portion of
183f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * the screen to the display panel, upon demand -- as opposed to
184f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * constantly refreshing the panel 60 times per second, for instance.
185f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *
186f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * Only the area defined by this rectangle is guaranteed to be valid, that
187f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * is, the driver is not allowed to post anything outside of this
188f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * rectangle.
189f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *
190f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * The rectangle evaluated during (*post)() and specifies which area
191f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * of the buffer passed in (*post)() shall to be posted.
192f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *
193f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * return -EINVAL if width or height <=0, or if left or top < 0
194f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     */
195f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    int (*setUpdateRect)(struct framebuffer_device_t* window,
196f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland            int left, int top, int width, int height);
197f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
198f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /*
199f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * Post <buffer> to the display (display it on the screen)
200f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * The buffer must have been allocated with the
201f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *   GRALLOC_USAGE_HW_FB usage flag.
202f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * buffer must be the same width and height as the display and must NOT
203f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * be locked.
204f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *
205f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * The buffer is shown during the next VSYNC.
206f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *
207f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * If the same buffer is posted again (possibly after some other buffer),
208f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * post() will block until the the first post is completed.
209f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *
210f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * Internally, post() is expected to lock the buffer so that a
211f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * subsequent call to gralloc_module_t::(*lock)() with USAGE_RENDER or
212f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * USAGE_*_WRITE will block until it is safe; that is typically once this
213f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * buffer is shown and another buffer has been posted.
214f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *
215f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * Returns 0 on success or -errno on error.
216f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     */
217f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    int (*post)(struct framebuffer_device_t* dev, buffer_handle_t buffer);
218f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
219f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
220f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /*
221f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * The (*compositionComplete)() method must be called after the
222f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * compositor has finished issuing GL commands for client buffers.
223f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     */
224f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
225f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    int (*compositionComplete)(struct framebuffer_device_t* dev);
226f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
227f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /*
228f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * This hook is OPTIONAL.
229f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *
230f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * If non NULL it will be caused by SurfaceFlinger on dumpsys
231f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     */
232f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    void (*dump)(struct framebuffer_device_t* dev, char *buff, int buff_len);
233f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
234f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /*
235f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * (*enableScreen)() is used to either blank (enable=0) or
236f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * unblank (enable=1) the screen this framebuffer is attached to.
237f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     *
238f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     * Returns 0 on success or -errno on error.
239f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland     */
240f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    int (*enableScreen)(struct framebuffer_device_t* dev, int enable);
241f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
242f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    void* reserved_proc[6];
243f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
244f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} framebuffer_device_t;
245f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
246f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef int context_hub_callback(uint32_t hub_id, const struct hub_message_t *rxed_msg, void *cookie);
247f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
248f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef struct my_other_t {
249f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
250ce65189eb8825c7239438e9ff1abb08f65f15bd0Steven Moreland    int a;
251ce65189eb8825c7239438e9ff1abb08f65f15bd0Steven Moreland    int b[];
252ce65189eb8825c7239438e9ff1abb08f65f15bd0Steven Moreland    int c[3];
253ce65189eb8825c7239438e9ff1abb08f65f15bd0Steven Moreland    int d[][];
254ce65189eb8825c7239438e9ff1abb08f65f15bd0Steven Moreland    int e[3][];
255ce65189eb8825c7239438e9ff1abb08f65f15bd0Steven Moreland    int f[3][5];
256ce65189eb8825c7239438e9ff1abb08f65f15bd0Steven Moreland    int g[4+4][6 * 6][];
257ce65189eb8825c7239438e9ff1abb08f65f15bd0Steven Moreland    int h[1][2][][3][4][5][6][7][8];
258ce65189eb8825c7239438e9ff1abb08f65f15bd0Steven Moreland
25905ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    unsigned int i;
26005ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    unsigned int8_t j;
26105ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    unsigned int16_t k;
26205ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    unsigned int32_t l;
26305ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    unsigned int64_t m;
26405ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    unsigned int32_t * n;
26505ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    const unsigned int32_t *** o;
26605ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    unsigned p;
26705ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    short q;
26805ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    long r;
26905ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    unsigned short s;
27005ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    unsigned long t;
27105ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    unsigned char u;
27205ebcf56647d3858f44c809811bdc3753e030176Steven Moreland    char v;
27305ebcf56647d3858f44c809811bdc3753e030176Steven Moreland
274f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    int (*store_meta_data_in_buffers)(struct camera_device *, int enable);
275f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
276f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    typedef void (*scan_result_callback)(bt_bdaddr_t* bda, int rssi, vector<uint8_t> adv_data);
277f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
278f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    pthread_t (* gps_create_thread)(const char* name, void (*start)(void *), void* arg);
279f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
280f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    int (*p1)(struct framebuffer_device_t* dev);
281f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
282f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    void (*p2)(struct framebuffer_device_t* dev, char *buff, int buff_len);
283f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
284ce65189eb8825c7239438e9ff1abb08f65f15bd0Steven Moreland    int (*p3)(struct framebuffer_device_t* dev, int enable[3][4][5]);
285f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
286f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
287f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    int (*get_supported_activities_list)(struct activity_recognition_module* module,
288f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland            char const* const* *activity_list);
289f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
290f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    int (*read_energy_info)();
291f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    void (*reserved_procs[16 - 4])(void);
292f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
293f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} my_other_t;
294f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
295f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define another 4
296f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
297f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef struct {
298f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    /** set to sizeof(GpsCallbacks_v1) */
299f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    size_t      size;
3000cedc19c4f0a6a0362de927eac32445dc10550a8Yifan Hong    myWierdSize mySize;
3010cedc19c4f0a6a0362de927eac32445dc10550a8Yifan Hong    wchar_t     MyWideChar;
3020cedc19c4f0a6a0362de927eac32445dc10550a8Yifan Hong
303f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    gps_location_callback location_cb;
304f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    gps_status_callback status_cb;
305f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    gps_sv_status_callback sv_status_cb;
306f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    gps_nmea_callback nmea_cb;
307f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    gps_set_capabilities set_capabilities_cb;
308f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    gps_acquire_wakelock acquire_wakelock_cb;
309f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    gps_release_wakelock release_wakelock_cb;
310f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    gps_create_thread create_thread_cb;
311f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    gps_request_utc_time request_utc_time_cb;
312f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} __attribute__((packed)) GpsCallbacks_v1;
313f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
314f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef struct one_name {
315f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    float a;
316f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} another_name;
317f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
318f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef struct this_t {
319f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    int hello;
320f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} this_t;
321f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
322f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef union that_t {
323f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    float a;
324f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    float c;
325f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} that_t;
326f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
327f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/**
328f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * return the frame size (number of bytes per sample) of an output stream.
329f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland */
330f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandstatic inline size_t audio_stream_out_frame_size(const struct audio_stream_out *s)
331f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland{
332f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    size_t chan_samp_sz;
333f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    audio_format_t format = s->common.get_format(&s->common);
334f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
335f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    if (audio_has_proportional_frames(format)) {
336f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland        chan_samp_sz = audio_bytes_per_sample(format);
337f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland        return audio_channel_count_from_out_mask(s->common.get_channels(&s->common)) * chan_samp_sz;
338f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    }
339f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
340f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland    return sizeof(int8_t);
341f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland}
342f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
343f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/* effective and commanding */
344f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandenum effect_command_e {
345f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_INIT,                 // initialize effect engine
346f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_SET_CONFIG,           // configure effect engine (see effect_config_t)
347f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_RESET,                // reset effect engine
348f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_ENABLE,               // enable effect process
349f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_DISABLE,              // disable effect process
350f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_SET_PARAM,            // set parameter immediately (see effect_param_t)
351f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_SET_PARAM_DEFERRED,   // set parameter deferred
352f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_SET_PARAM_COMMIT,     // commit previous set parameter deferred
353f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_GET_PARAM,            // get parameter
354f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_SET_DEVICE,           // set audio device (see audio.h, audio_devices_t)
355f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_SET_VOLUME,           // set volume
356f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_SET_AUDIO_MODE,       // set the audio mode (normal, ring, ...)
357f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_SET_CONFIG_REVERSE,   // configure effect engine reverse stream(see effect_config_t)
358f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_SET_INPUT_DEVICE,     // set capture device (see audio.h, audio_devices_t)
359f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_GET_CONFIG,           // read effect engine configuration
360f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_GET_CONFIG_REVERSE,   // read configure effect engine reverse stream configuration
361f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS,// get all supported configurations for a feature.
362f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_GET_FEATURE_CONFIG,   // get current feature configuration
363f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_SET_FEATURE_CONFIG,   // set current feature configuration
364f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_SET_AUDIO_SOURCE,     // set the audio source (see audio.h, audio_source_t)
365f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_OFFLOAD,              // set if effect thread is an offload one,
366f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland                                    // send the ioHandle of the effect thread
367f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland   EFFECT_CMD_FIRST_PROPRIETARY = 0x10000 // first proprietary command code
368f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland};
369f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
370cea7773ec460225308cb3abc185e9787c0bc179cYifan Hong
371cea7773ec460225308cb3abc185e9787c0bc179cYifan Hongnamespace myspace {
372cea7773ec460225308cb3abc185e9787c0bc179cYifan Hongenum class enum_class : int32_t {
373cea7773ec460225308cb3abc185e9787c0bc179cYifan Hong    great,
374cea7773ec460225308cb3abc185e9787c0bc179cYifan Hong};
375cea7773ec460225308cb3abc185e9787c0bc179cYifan Hong} // namespace myspace
376cea7773ec460225308cb3abc185e9787c0bc179cYifan Hong
377cea7773ec460225308cb3abc185e9787c0bc179cYifan Hongenum struct enum_struct {
378cea7773ec460225308cb3abc185e9787c0bc179cYifan Hong    great,
379cea7773ec460225308cb3abc185e9787c0bc179cYifan Hong};
380cea7773ec460225308cb3abc185e9787c0bc179cYifan Hong
381cea7773ec460225308cb3abc185e9787c0bc179cYifan Hong
382f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland__END_DECLS
383f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland
3844200903983e12253942381e2f9331479848c0b94Yifan Hong#endif
385