media/omx-plugin/include/ics/system/graphics.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /*
michael@0 2 * Copyright (C) 2011 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 SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H
michael@0 18 #define SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H
michael@0 19
michael@0 20 #ifdef __cplusplus
michael@0 21 extern "C" {
michael@0 22 #endif
michael@0 23
michael@0 24 /*
michael@0 25 * If the HAL needs to create service threads to handle graphics related
michael@0 26 * tasks, these threads need to run at HAL_PRIORITY_URGENT_DISPLAY priority
michael@0 27 * if they can block the main rendering thread in any way.
michael@0 28 *
michael@0 29 * the priority of the current thread can be set with:
michael@0 30 *
michael@0 31 * #include <sys/resource.h>
michael@0 32 * setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY);
michael@0 33 *
michael@0 34 */
michael@0 35
michael@0 36 #define HAL_PRIORITY_URGENT_DISPLAY (-8)
michael@0 37
michael@0 38 /**
michael@0 39 * pixel format definitions
michael@0 40 */
michael@0 41
michael@0 42 enum {
michael@0 43 HAL_PIXEL_FORMAT_RGBA_8888 = 1,
michael@0 44 HAL_PIXEL_FORMAT_RGBX_8888 = 2,
michael@0 45 HAL_PIXEL_FORMAT_RGB_888 = 3,
michael@0 46 HAL_PIXEL_FORMAT_RGB_565 = 4,
michael@0 47 HAL_PIXEL_FORMAT_BGRA_8888 = 5,
michael@0 48 HAL_PIXEL_FORMAT_RGBA_5551 = 6,
michael@0 49 HAL_PIXEL_FORMAT_RGBA_4444 = 7,
michael@0 50
michael@0 51 /* 0x8 - 0xFF range unavailable */
michael@0 52
michael@0 53 /*
michael@0 54 * 0x100 - 0x1FF
michael@0 55 *
michael@0 56 * This range is reserved for pixel formats that are specific to the HAL
michael@0 57 * implementation. Implementations can use any value in this range to
michael@0 58 * communicate video pixel formats between their HAL modules. These formats
michael@0 59 * must not have an alpha channel. Additionally, an EGLimage created from a
michael@0 60 * gralloc buffer of one of these formats must be supported for use with the
michael@0 61 * GL_OES_EGL_image_external OpenGL ES extension.
michael@0 62 */
michael@0 63
michael@0 64 /*
michael@0 65 * Android YUV format:
michael@0 66 *
michael@0 67 * This format is exposed outside of the HAL to software decoders and
michael@0 68 * applications. EGLImageKHR must support it in conjunction with the
michael@0 69 * OES_EGL_image_external extension.
michael@0 70 *
michael@0 71 * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
michael@0 72 * by (W/2) x (H/2) Cr and Cb planes.
michael@0 73 *
michael@0 74 * This format assumes
michael@0 75 * - an even width
michael@0 76 * - an even height
michael@0 77 * - a horizontal stride multiple of 16 pixels
michael@0 78 * - a vertical stride equal to the height
michael@0 79 *
michael@0 80 * y_size = stride * height
michael@0 81 * c_size = ALIGN(stride/2, 16) * height/2
michael@0 82 * size = y_size + c_size * 2
michael@0 83 * cr_offset = y_size
michael@0 84 * cb_offset = y_size + c_size
michael@0 85 *
michael@0 86 */
michael@0 87 HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar
michael@0 88
michael@0 89
michael@0 90
michael@0 91 /* Legacy formats (deprecated), used by ImageFormat.java */
michael@0 92 HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16
michael@0 93 HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21
michael@0 94 HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2
michael@0 95 };
michael@0 96
michael@0 97
michael@0 98 /**
michael@0 99 * Transformation definitions
michael@0 100 *
michael@0 101 * IMPORTANT NOTE:
michael@0 102 * HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}.
michael@0 103 *
michael@0 104 */
michael@0 105
michael@0 106 enum {
michael@0 107 /* flip source image horizontally (around the vertical axis) */
michael@0 108 HAL_TRANSFORM_FLIP_H = 0x01,
michael@0 109 /* flip source image vertically (around the horizontal axis)*/
michael@0 110 HAL_TRANSFORM_FLIP_V = 0x02,
michael@0 111 /* rotate source image 90 degrees clockwise */
michael@0 112 HAL_TRANSFORM_ROT_90 = 0x04,
michael@0 113 /* rotate source image 180 degrees */
michael@0 114 HAL_TRANSFORM_ROT_180 = 0x03,
michael@0 115 /* rotate source image 270 degrees clockwise */
michael@0 116 HAL_TRANSFORM_ROT_270 = 0x07,
michael@0 117 };
michael@0 118
michael@0 119 #ifdef __cplusplus
michael@0 120 }
michael@0 121 #endif
michael@0 122
michael@0 123 #endif /* SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H */

mercurial