test.h revision b56909629ae9b9a9ed45df3335e389e417569aa7
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, 60f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland C = 1 + test(19) + test2[21], 61f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland D = 1 ? 1 : 2 62f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} onehere; 63f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 64f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandinline std::string to_string(T value) { return to_string(static_cast<E>(value)); } 65f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 66f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandconst res_t RESULT_ACCESS_DENIED = ~2 | -1; 67f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandconst res_t RESULT_INVALID_PARAMETER = 54; 68f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 69f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#ifdef __cplusplus 70f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandextern "C" { 71f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#endif 72f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 73f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandstatic void fun1() { } 74f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 75f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandnamespace MyNamespace { 76f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland static void fun2() { } 77f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} 78f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 79f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#ifdef __cplusplus 80f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} 81f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#endif 82f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 83f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandstatic void fun3() { test; } 84f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandstatic void fun4() { test; } 85f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 86f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#undef ONE 87f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 88f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/*****************************************************************************/ 89f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef void (*no_arg_fun)(void); 90f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 91f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef int (*other_fun)(int j); 92f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 93f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef void (*alarm_cb)(void *data); 94f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 95f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef void (*special_types)(const native_handle_t* a, int b); 96f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 97f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef foo_t bar_t; 98f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 99f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandstruct baz_t; 100f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 101f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef pthread_t (* fun_with_funs)(void (*my_fun)(void *), void* arg); 102f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 103f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandint (*global_fun_1)(struct framebuffer_device_t* dev, int enable); 104f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandint (*global_fun_2)(struct framebuffer_device_t* dev, int enable); 105f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 106f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef struct framebuffer_device_t { 107f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /** 108f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * Common methods of the framebuffer device. 109f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland */ 110f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland struct hw_device_t common; 111f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 112f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland typedef enum another_here { 113f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland A = 3 | 4, 114f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland B, 115f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland C = 4 116f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland } another_here; 117f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 118f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* anon struct */ 119f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland struct { 120f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland float b; 121f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland }; 122f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 123f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland struct not_type_defd { 124f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland double latitude[]; 125f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland double halfLongitude; 126f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland }; 127f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 128b56909629ae9b9a9ed45df3335e389e417569aa7Steven Moreland char here; 129b56909629ae9b9a9ed45df3335e389e417569aa7Steven Moreland 130f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* flags describing some attributes of the framebuffer */ 131f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland const uint32_t flags; 132f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 133f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* dimensions of the framebuffer in pixels */ 134f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland const uint32_t width; 135f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland const uint32_t height; 136f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 137f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* frambuffer stride in pixels */ 138f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland const int stride; 139f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 140f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* framebuffer pixel format */ 141f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland const int format; 142f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 143f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* resolution of the framebuffer's display panel in pixel per inch*/ 144f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland const float xdpi; 145f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland const float ydpi; 146f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 147f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* framebuffer's display panel refresh rate in frames per second */ 148f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland const float fps; 149f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 150f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* min swap interval supported by this framebuffer */ 151f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland const int minSwapInterval; 152f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 153f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* max swap interval supported by this framebuffer */ 154f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland const int maxSwapInterval; 155f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 156f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* Number of framebuffers supported*/ 157f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland const int numFramebuffers; 158f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 159f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int reserved[7]; 160f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 161f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* 162f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * requests a specific swap-interval (same definition than EGL) 163f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * 164f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * Returns 0 on success or -errno on error. 165f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland */ 166f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int (*setSwapInterval)(struct framebuffer_device_t* window, 167f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int interval); 168f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 169f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* 170f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * This hook is OPTIONAL. 171f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * 172f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * It is non NULL If the framebuffer driver supports "update-on-demand" 173f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * and the given rectangle is the area of the screen that gets 174f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * updated during (*post)(). 175f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * 176f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * This is useful on devices that are able to DMA only a portion of 177f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * the screen to the display panel, upon demand -- as opposed to 178f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * constantly refreshing the panel 60 times per second, for instance. 179f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * 180f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * Only the area defined by this rectangle is guaranteed to be valid, that 181f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * is, the driver is not allowed to post anything outside of this 182f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * rectangle. 183f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * 184f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * The rectangle evaluated during (*post)() and specifies which area 185f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * of the buffer passed in (*post)() shall to be posted. 186f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * 187f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * return -EINVAL if width or height <=0, or if left or top < 0 188f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland */ 189f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int (*setUpdateRect)(struct framebuffer_device_t* window, 190f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int left, int top, int width, int height); 191f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 192f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* 193f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * Post <buffer> to the display (display it on the screen) 194f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * The buffer must have been allocated with the 195f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * GRALLOC_USAGE_HW_FB usage flag. 196f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * buffer must be the same width and height as the display and must NOT 197f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * be locked. 198f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * 199f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * The buffer is shown during the next VSYNC. 200f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * 201f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * If the same buffer is posted again (possibly after some other buffer), 202f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * post() will block until the the first post is completed. 203f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * 204f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * Internally, post() is expected to lock the buffer so that a 205f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * subsequent call to gralloc_module_t::(*lock)() with USAGE_RENDER or 206f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * USAGE_*_WRITE will block until it is safe; that is typically once this 207f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * buffer is shown and another buffer has been posted. 208f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * 209f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * Returns 0 on success or -errno on error. 210f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland */ 211f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int (*post)(struct framebuffer_device_t* dev, buffer_handle_t buffer); 212f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 213f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 214f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* 215f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * The (*compositionComplete)() method must be called after the 216f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * compositor has finished issuing GL commands for client buffers. 217f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland */ 218f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 219f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int (*compositionComplete)(struct framebuffer_device_t* dev); 220f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 221f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* 222f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * This hook is OPTIONAL. 223f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * 224f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * If non NULL it will be caused by SurfaceFlinger on dumpsys 225f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland */ 226f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland void (*dump)(struct framebuffer_device_t* dev, char *buff, int buff_len); 227f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 228f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /* 229f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * (*enableScreen)() is used to either blank (enable=0) or 230f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * unblank (enable=1) the screen this framebuffer is attached to. 231f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * 232f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * Returns 0 on success or -errno on error. 233f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland */ 234f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int (*enableScreen)(struct framebuffer_device_t* dev, int enable); 235f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 236f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland void* reserved_proc[6]; 237f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 238f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} framebuffer_device_t; 239f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 240f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef int context_hub_callback(uint32_t hub_id, const struct hub_message_t *rxed_msg, void *cookie); 241f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 242f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef struct my_other_t { 243f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 244f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int (*store_meta_data_in_buffers)(struct camera_device *, int enable); 245f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 246f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland typedef void (*scan_result_callback)(bt_bdaddr_t* bda, int rssi, vector<uint8_t> adv_data); 247f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 248f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland pthread_t (* gps_create_thread)(const char* name, void (*start)(void *), void* arg); 249f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 250f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int (*p1)(struct framebuffer_device_t* dev); 251f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 252f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland void (*p2)(struct framebuffer_device_t* dev, char *buff, int buff_len); 253f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 254f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int (*p3)(struct framebuffer_device_t* dev, int enable); 255f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 256f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 257f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int (*get_supported_activities_list)(struct activity_recognition_module* module, 258f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland char const* const* *activity_list); 259f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 260f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int (*read_energy_info)(); 261f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland void (*reserved_procs[16 - 4])(void); 262f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 263f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} my_other_t; 264f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 265f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#define another 4 266f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 267f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef struct { 268f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland /** set to sizeof(GpsCallbacks_v1) */ 269f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland size_t size; 270f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland gps_location_callback location_cb; 271f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland gps_status_callback status_cb; 272f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland gps_sv_status_callback sv_status_cb; 273f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland gps_nmea_callback nmea_cb; 274f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland gps_set_capabilities set_capabilities_cb; 275f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland gps_acquire_wakelock acquire_wakelock_cb; 276f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland gps_release_wakelock release_wakelock_cb; 277f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland gps_create_thread create_thread_cb; 278f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland gps_request_utc_time request_utc_time_cb; 279f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} __attribute__((packed)) GpsCallbacks_v1; 280f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 281f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef struct one_name { 282f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland float a; 283f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} another_name; 284f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 285f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef struct this_t { 286f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland int hello; 287f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} this_t; 288f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 289f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandtypedef union that_t { 290f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland float a; 291f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland float c; 292f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} that_t; 293f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 294f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/** 295f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland * return the frame size (number of bytes per sample) of an output stream. 296f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland */ 297f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandstatic inline size_t audio_stream_out_frame_size(const struct audio_stream_out *s) 298f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland{ 299f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland size_t chan_samp_sz; 300f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland audio_format_t format = s->common.get_format(&s->common); 301f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 302f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland if (audio_has_proportional_frames(format)) { 303f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland chan_samp_sz = audio_bytes_per_sample(format); 304f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland return audio_channel_count_from_out_mask(s->common.get_channels(&s->common)) * chan_samp_sz; 305f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland } 306f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 307f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland return sizeof(int8_t); 308f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland} 309f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 310f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland/* effective and commanding */ 311f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Morelandenum effect_command_e { 312f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_INIT, // initialize effect engine 313f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_SET_CONFIG, // configure effect engine (see effect_config_t) 314f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_RESET, // reset effect engine 315f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_ENABLE, // enable effect process 316f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_DISABLE, // disable effect process 317f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_SET_PARAM, // set parameter immediately (see effect_param_t) 318f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_SET_PARAM_DEFERRED, // set parameter deferred 319f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_SET_PARAM_COMMIT, // commit previous set parameter deferred 320f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_GET_PARAM, // get parameter 321f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_SET_DEVICE, // set audio device (see audio.h, audio_devices_t) 322f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_SET_VOLUME, // set volume 323f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_SET_AUDIO_MODE, // set the audio mode (normal, ring, ...) 324f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_SET_CONFIG_REVERSE, // configure effect engine reverse stream(see effect_config_t) 325f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_SET_INPUT_DEVICE, // set capture device (see audio.h, audio_devices_t) 326f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_GET_CONFIG, // read effect engine configuration 327f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_GET_CONFIG_REVERSE, // read configure effect engine reverse stream configuration 328f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS,// get all supported configurations for a feature. 329f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_GET_FEATURE_CONFIG, // get current feature configuration 330f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_SET_FEATURE_CONFIG, // set current feature configuration 331f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_SET_AUDIO_SOURCE, // set the audio source (see audio.h, audio_source_t) 332f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_OFFLOAD, // set if effect thread is an offload one, 333f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland // send the ioHandle of the effect thread 334f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland EFFECT_CMD_FIRST_PROPRIETARY = 0x10000 // first proprietary command code 335f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland}; 336f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 337f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland__END_DECLS 338f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland 339f1a35f7d73f38e0d30d7a4343e33c3f4777cf87eSteven Moreland#endif