media/omx-plugin/include/gb/hardware/hardware.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /*
michael@0 2 * Copyright (C) 2008 The Android Open Source Project
michael@0 3 *
michael@0 4 * Licensed under the Apache License, Version 2.0 (the "License");
michael@0 5 * you may not use this file except in compliance with the License.
michael@0 6 * You may obtain a copy of the License at
michael@0 7 *
michael@0 8 * http://www.apache.org/licenses/LICENSE-2.0
michael@0 9 *
michael@0 10 * Unless required by applicable law or agreed to in writing, software
michael@0 11 * distributed under the License is distributed on an "AS IS" BASIS,
michael@0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
michael@0 13 * See the License for the specific language governing permissions and
michael@0 14 * limitations under the License.
michael@0 15 */
michael@0 16
michael@0 17 #ifndef ANDROID_INCLUDE_HARDWARE_HARDWARE_H
michael@0 18 #define ANDROID_INCLUDE_HARDWARE_HARDWARE_H
michael@0 19
michael@0 20 #include <stdint.h>
michael@0 21 #include <sys/cdefs.h>
michael@0 22
michael@0 23 #include <cutils/native_handle.h>
michael@0 24
michael@0 25 __BEGIN_DECLS
michael@0 26
michael@0 27 /*
michael@0 28 * Value for the hw_module_t.tag field
michael@0 29 */
michael@0 30
michael@0 31 #define MAKE_TAG_CONSTANT(A,B,C,D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
michael@0 32
michael@0 33 #define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')
michael@0 34 #define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')
michael@0 35
michael@0 36 struct hw_module_t;
michael@0 37 struct hw_module_methods_t;
michael@0 38 struct hw_device_t;
michael@0 39
michael@0 40 /**
michael@0 41 * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
michael@0 42 * and the fields of this data structure must begin with hw_module_t
michael@0 43 * followed by module specific information.
michael@0 44 */
michael@0 45 typedef struct hw_module_t {
michael@0 46 /** tag must be initialized to HARDWARE_MODULE_TAG */
michael@0 47 uint32_t tag;
michael@0 48
michael@0 49 /** major version number for the module */
michael@0 50 uint16_t version_major;
michael@0 51
michael@0 52 /** minor version number of the module */
michael@0 53 uint16_t version_minor;
michael@0 54
michael@0 55 /** Identifier of module */
michael@0 56 const char *id;
michael@0 57
michael@0 58 /** Name of this module */
michael@0 59 const char *name;
michael@0 60
michael@0 61 /** Author/owner/implementor of the module */
michael@0 62 const char *author;
michael@0 63
michael@0 64 /** Modules methods */
michael@0 65 struct hw_module_methods_t* methods;
michael@0 66
michael@0 67 /** module's dso */
michael@0 68 void* dso;
michael@0 69
michael@0 70 /** padding to 128 bytes, reserved for future use */
michael@0 71 uint32_t reserved[32-7];
michael@0 72
michael@0 73 } hw_module_t;
michael@0 74
michael@0 75 typedef struct hw_module_methods_t {
michael@0 76 /** Open a specific device */
michael@0 77 int (*open)(const struct hw_module_t* module, const char* id,
michael@0 78 struct hw_device_t** device);
michael@0 79
michael@0 80 } hw_module_methods_t;
michael@0 81
michael@0 82 /**
michael@0 83 * Every device data structure must begin with hw_device_t
michael@0 84 * followed by module specific public methods and attributes.
michael@0 85 */
michael@0 86 typedef struct hw_device_t {
michael@0 87 /** tag must be initialized to HARDWARE_DEVICE_TAG */
michael@0 88 uint32_t tag;
michael@0 89
michael@0 90 /** version number for hw_device_t */
michael@0 91 uint32_t version;
michael@0 92
michael@0 93 /** reference to the module this device belongs to */
michael@0 94 struct hw_module_t* module;
michael@0 95
michael@0 96 /** padding reserved for future use */
michael@0 97 uint32_t reserved[12];
michael@0 98
michael@0 99 /** Close this device */
michael@0 100 int (*close)(struct hw_device_t* device);
michael@0 101
michael@0 102 } hw_device_t;
michael@0 103
michael@0 104 /**
michael@0 105 * Name of the hal_module_info
michael@0 106 */
michael@0 107 #define HAL_MODULE_INFO_SYM HMI
michael@0 108
michael@0 109 /**
michael@0 110 * Name of the hal_module_info as a string
michael@0 111 */
michael@0 112 #define HAL_MODULE_INFO_SYM_AS_STR "HMI"
michael@0 113
michael@0 114 /**
michael@0 115 * Get the module info associated with a module by id.
michael@0 116 * @return: 0 == success, <0 == error and *pHmi == NULL
michael@0 117 */
michael@0 118 int hw_get_module(const char *id, const struct hw_module_t **module);
michael@0 119
michael@0 120
michael@0 121 /**
michael@0 122 * pixel format definitions
michael@0 123 */
michael@0 124
michael@0 125 enum {
michael@0 126 HAL_PIXEL_FORMAT_RGBA_8888 = 1,
michael@0 127 HAL_PIXEL_FORMAT_RGBX_8888 = 2,
michael@0 128 HAL_PIXEL_FORMAT_RGB_888 = 3,
michael@0 129 HAL_PIXEL_FORMAT_RGB_565 = 4,
michael@0 130 HAL_PIXEL_FORMAT_BGRA_8888 = 5,
michael@0 131 HAL_PIXEL_FORMAT_RGBA_5551 = 6,
michael@0 132 HAL_PIXEL_FORMAT_RGBA_4444 = 7,
michael@0 133
michael@0 134 /* 0x8 - 0xFF range unavailable */
michael@0 135
michael@0 136 /*
michael@0 137 * 0x100 - 0x1FF
michael@0 138 *
michael@0 139 * This range is reserved for pixel formats that are specific to the HAL
michael@0 140 * implementation. Implementations can use any value in this range to
michael@0 141 * communicate video pixel formats between their HAL modules. These formats
michael@0 142 * must not have an alpha channel. Additionally, an EGLimage created from a
michael@0 143 * gralloc buffer of one of these formats must be supported for use with the
michael@0 144 * GL_OES_EGL_image_external OpenGL ES extension.
michael@0 145 */
michael@0 146
michael@0 147 /*
michael@0 148 * Android YUV format:
michael@0 149 *
michael@0 150 * This format is exposed outside of the HAL to software
michael@0 151 * decoders and applications.
michael@0 152 * EGLImageKHR must support it in conjunction with the
michael@0 153 * OES_EGL_image_external extension.
michael@0 154 *
michael@0 155 * YV12 is 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
michael@0 156 * by (W/2) x (H/2) Cr and Cb planes.
michael@0 157 *
michael@0 158 * This format assumes
michael@0 159 * - an even width
michael@0 160 * - an even height
michael@0 161 * - a horizontal stride multiple of 16 pixels
michael@0 162 * - a vertical stride equal to the height
michael@0 163 *
michael@0 164 * y_size = stride * height
michael@0 165 * c_size = ALIGN(stride/2, 16) * height/2
michael@0 166 * size = y_size + c_size * 2
michael@0 167 * cr_offset = y_size
michael@0 168 * cb_offset = y_size + c_size
michael@0 169 *
michael@0 170 */
michael@0 171 HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar
michael@0 172
michael@0 173
michael@0 174
michael@0 175 /* Legacy formats (deprecated), used by ImageFormat.java */
michael@0 176 HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16
michael@0 177 HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21
michael@0 178 HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2
michael@0 179 };
michael@0 180
michael@0 181
michael@0 182 /**
michael@0 183 * Transformation definitions
michael@0 184 *
michael@0 185 * IMPORTANT NOTE:
michael@0 186 * HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}.
michael@0 187 *
michael@0 188 */
michael@0 189
michael@0 190 enum {
michael@0 191 /* flip source image horizontally (around the vertical axis) */
michael@0 192 HAL_TRANSFORM_FLIP_H = 0x01,
michael@0 193 /* flip source image vertically (around the horizontal axis)*/
michael@0 194 HAL_TRANSFORM_FLIP_V = 0x02,
michael@0 195 /* rotate source image 90 degrees clockwise */
michael@0 196 HAL_TRANSFORM_ROT_90 = 0x04,
michael@0 197 /* rotate source image 180 degrees */
michael@0 198 HAL_TRANSFORM_ROT_180 = 0x03,
michael@0 199 /* rotate source image 270 degrees clockwise */
michael@0 200 HAL_TRANSFORM_ROT_270 = 0x07,
michael@0 201 };
michael@0 202
michael@0 203 __END_DECLS
michael@0 204
michael@0 205 #endif /* ANDROID_INCLUDE_HARDWARE_HARDWARE_H */

mercurial