libnx  v4.7.0
types.h
Go to the documentation of this file.
1 /**
2  * @file display/types.h
3  * @brief Definitions for Android-related types and enumerations.
4  * @copyright libnx Authors
5  */
6 #pragma once
7 #include "../types.h"
8 
9 // From Android PixelFormat.h & graphics-base-v1.0.h.
10 enum {
11  PIXEL_FORMAT_RGBA_8888 = 1U,
12  PIXEL_FORMAT_RGBX_8888 = 2U,
13  PIXEL_FORMAT_RGB_888 = 3U,
14  PIXEL_FORMAT_RGB_565 = 4U,
15  PIXEL_FORMAT_BGRA_8888 = 5U,
16  PIXEL_FORMAT_RGBA_5551 = 6U,
17  PIXEL_FORMAT_RGBA_4444 = 7U,
18  PIXEL_FORMAT_YCRCB_420_SP = 17U,
19  PIXEL_FORMAT_RAW16 = 32U,
20  PIXEL_FORMAT_BLOB = 33U,
21  PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 34U,
22  PIXEL_FORMAT_YCBCR_420_888 = 35U,
23  PIXEL_FORMAT_Y8 = 0x20203859U,
24  PIXEL_FORMAT_Y16 = 0x20363159U,
25  PIXEL_FORMAT_YV12 = 0x32315659U,
26 };
27 
28 // From Android gralloc.h.
29 enum {
30  /* buffer is never read in software */
31  GRALLOC_USAGE_SW_READ_NEVER = 0x00000000U,
32  /* buffer is rarely read in software */
33  GRALLOC_USAGE_SW_READ_RARELY = 0x00000002U,
34  /* buffer is often read in software */
35  GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003U,
36  /* mask for the software read values */
37  GRALLOC_USAGE_SW_READ_MASK = 0x0000000FU,
38  /* buffer is never written in software */
39  GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000U,
40  /* buffer is rarely written in software */
41  GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020U,
42  /* buffer is often written in software */
43  GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030U,
44  /* mask for the software write values */
45  GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0U,
46  /* buffer will be used as an OpenGL ES texture */
47  GRALLOC_USAGE_HW_TEXTURE = 0x00000100U,
48  /* buffer will be used as an OpenGL ES render target */
49  GRALLOC_USAGE_HW_RENDER = 0x00000200U,
50  /* buffer will be used by the 2D hardware blitter */
51  GRALLOC_USAGE_HW_2D = 0x00000400U,
52  /* buffer will be used by the HWComposer HAL module */
53  GRALLOC_USAGE_HW_COMPOSER = 0x00000800U,
54  /* buffer will be used with the framebuffer device */
55  GRALLOC_USAGE_HW_FB = 0x00001000U,
56  /* buffer should be displayed full-screen on an external display when
57  * possible */
58  GRALLOC_USAGE_EXTERNAL_DISP = 0x00002000U,
59  /* Must have a hardware-protected path to external display sink for
60  * this buffer. If a hardware-protected path is not available, then
61  * either don't composite only this buffer (preferred) to the
62  * external sink, or (less desirable) do not route the entire
63  * composition to the external sink. */
64  GRALLOC_USAGE_PROTECTED = 0x00004000U,
65  /* buffer may be used as a cursor */
66  GRALLOC_USAGE_CURSOR = 0x00008000U,
67  /* buffer will be used with the HW video encoder */
68  GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000U,
69  /* buffer will be written by the HW camera pipeline */
70  GRALLOC_USAGE_HW_CAMERA_WRITE = 0x00020000U,
71  /* buffer will be read by the HW camera pipeline */
72  GRALLOC_USAGE_HW_CAMERA_READ = 0x00040000U,
73  /* buffer will be used as part of zero-shutter-lag queue */
74  GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00060000U,
75  /* mask for the camera access values */
76  GRALLOC_USAGE_HW_CAMERA_MASK = 0x00060000U,
77  /* mask for the software usage bit-mask */
78  GRALLOC_USAGE_HW_MASK = 0x00071F00U,
79  /* buffer will be used as a RenderScript Allocation */
80  GRALLOC_USAGE_RENDERSCRIPT = 0x00100000U,
81 };
82 
83 // From Android window.h.
84 /* attributes queriable with query() */
85 enum {
86  NATIVE_WINDOW_WIDTH = 0,
87  NATIVE_WINDOW_HEIGHT = 1,
88  NATIVE_WINDOW_FORMAT = 2,
89 //...
90 // NATIVE_WINDOW_DEFAULT_WIDTH = 6, //These two return invalid data.
91 // NATIVE_WINDOW_DEFAULT_HEIGHT = 7,
92 };
93 
94 // From Android window.h.
95 /* parameter for NATIVE_WINDOW_[API_][DIS]CONNECT */
96 enum {
97  //...
98  /* Buffers will be queued after being filled using the CPU
99  */
100  NATIVE_WINDOW_API_CPU = 2,
101  //...
102 };
103 
104 // From Android hardware.h.
105 
106 /**
107  * Transformation definitions
108  *
109  * IMPORTANT NOTE:
110  * HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}.
111  *
112  */
113 
114 enum {
115  /* flip source image horizontally (around the vertical axis) */
116  HAL_TRANSFORM_FLIP_H = 0x01,
117  /* flip source image vertically (around the horizontal axis)*/
118  HAL_TRANSFORM_FLIP_V = 0x02,
119  /* rotate source image 90 degrees clockwise */
120  HAL_TRANSFORM_ROT_90 = 0x04,
121  /* rotate source image 180 degrees */
122  HAL_TRANSFORM_ROT_180 = 0x03,
123  /* rotate source image 270 degrees clockwise */
124  HAL_TRANSFORM_ROT_270 = 0x07,
125 };
126 
127 // From Android window.h.
128 /* parameter for NATIVE_WINDOW_SET_BUFFERS_TRANSFORM */
129 enum {
130  /* flip source image horizontally */
131  NATIVE_WINDOW_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H,
132  /* flip source image vertically */
133  NATIVE_WINDOW_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,
134  /* rotate source image 90 degrees clock-wise */
135  NATIVE_WINDOW_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,
136  /* rotate source image 180 degrees */
137  NATIVE_WINDOW_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,
138  /* rotate source image 270 degrees clock-wise */
139  NATIVE_WINDOW_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
140 };
141 
142 // From Android native_handle.h.
143 typedef struct {
144  int version;
145  int num_fds;
146  int num_ints;
147 } NativeHandle;
Definition: types.h:143