1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _LINUX_FACEAUTH_H
20 #define _LINUX_FACEAUTH_H
21 #include <linux/types.h>
22 #include <linux/ioctl.h>
23 #include <linux/time.h>
24 #define FACEAUTH_RESULT_SUCCESS 0
25 #define FACEAUTH_RESULT_FAILURE 1
26 #define FACEAUTH_ERROR_NO_ERROR 0
27 #define FACEAUTH_MAX_TASKS 32
28 #define FACEAUTH_DEBUG_REGISTER_COUNT 24
29 #define FACEAUTH_BUFFER_TAG_LENGTH 16
30 #define FACEAUTH_BUFFER_LIST_LENGTH 32
31 struct faceauth_init_data {
32   __u64 features;
33 } __attribute__((packed));
34 #define FACEAUTH_MAX_CACHE_FLUSH_SIZE 20
35 #define FACEAUTH_AUX_DATA_SIZE 32
36 struct faceauth_start_data {
37   __u8 profile_id;
38   __u8 operation;
39   __u32 input_time_ms;
40   __u64 image_dot_left_fd;
41   __u64 image_dot_right_fd;
42   __u64 image_flood_fd;
43   __u64 image_flood_right_fd;
44   __u64 calibration_fd;
45   __u64 deferred_autocal_fd;
46   __u32 image_dot_left_size;
47   __u32 image_dot_right_size;
48   __u32 image_flood_size;
49   __u32 image_flood_right_size;
50   __u32 calibration_size;
51   __u32 deferred_autocal_size;
52   __s16 cache_flush_indexes[FACEAUTH_MAX_CACHE_FLUSH_SIZE];
53   __u32 cache_flush_size;
54   __u8 result;
55   union {
56     __u32 citadel_output3;
57     __u32 lockout_event;
58   };
59   __u32 angles;
60   __s32 error_code;
61   __u32 ab_exception_number;
62   __u32 fw_version;
63   __u8 * citadel_token;
64   __u32 citadel_token_size;
65   __u32 citadel_input;
66   __u32 citadel_input2;
67   __u32 citadel_output1;
68   __u32 citadel_output2;
69   __u32 aux_data[FACEAUTH_AUX_DATA_SIZE];
70 } __attribute__((packed));
71 struct faceauth_debug_data {
72   __u64 buffer_fd;
73   union {
74     __u8 * debug_buffer;
75     __u8 * print_buffer;
76   };
77   union {
78     __u32 debug_buffer_size;
79     __u32 print_buffer_size;
80   };
81   __u32 flags;
82 } __attribute__((packed));
83 struct faceauth_workload_control {
84   __u32 workload_state;
85   __u32 run_count;
86   __u32 run_time_ms;
87   __u32 run_time_us;
88   __u32 status;
89 } __attribute__((packed));
90 struct faceauth_debug_register {
91   __u64 address;
92   __u64 value;
93 } __attribute__((packed));
94 enum faceauth_buffer_type {
95   OUTPUT_NONE,
96   OUTPUT_DEPTH_EMBEDDING,
97   OUTPUT_FACENET_EMBEDDING,
98   OUTPUT_QUANTIZED_EMBEDDINGS,
99   OUTPUT_BINARY_BLOB,
100   OUTPUT_8BIT_GRAYSCALE_320x320,
101   OUTPUT_16BIT_GRAYSCALE_128x128,
102   OUTPUT_16BIT_GRAYSCALE_480x640,
103   OUTPUT_8BITRGB_128x128,
104   OUTPUT_FACE_BUF,
105   OUTPUT_NUM_FACES,
106   OUTPUT_INTMAX = 0xffffffff,
107 };
108 struct faceauth_buffer_descriptor {
109   __u32 offset_to_buffer;
110   __u32 size;
111   __u32 type;
112   char buffer_tag[FACEAUTH_BUFFER_TAG_LENGTH];
113 } __attribute__((packed));
114 struct faceauth_buffer_list {
115   __u32 buffer_base;
116   __u32 buffer_count;
117   struct faceauth_buffer_descriptor buffers[FACEAUTH_BUFFER_LIST_LENGTH];
118 } __attribute__((packed));
119 #define SHA1SUM_LEN 20
120 struct faceauth_model_version_list {
121   __u8 fssd_version[SHA1SUM_LEN];
122   __u8 facenet_version[SHA1SUM_LEN];
123   __u8 gazenet_version[SHA1SUM_LEN];
124   __u8 skin_version[SHA1SUM_LEN];
125   __u8 ultradepth_version[SHA1SUM_LEN];
126   __u8 depthid_version[SHA1SUM_LEN];
127 } __attribute__((packed));
128 struct faceauth_airbrush_state {
129   __u32 faceauth_version;
130   __s32 error_code;
131   __u32 internal_state_size;
132   __u32 command;
133   __s32 rightbox_x1;
134   __s32 rightbox_y1;
135   __s32 rightbox_x2;
136   __s32 rightbox_y2;
137   __s32 leftbox_x1;
138   __s32 leftbox_y1;
139   __s32 leftbox_x2;
140   __s32 leftbox_y2;
141   __u32 num_tasks;
142   __u32 register_list_length;
143   __u32 saved_register_count;
144   struct faceauth_workload_control control_list[FACEAUTH_MAX_TASKS];
145   struct faceauth_debug_register debug_registers[FACEAUTH_DEBUG_REGISTER_COUNT];
146   struct faceauth_buffer_list output_buffers;
147   __u32 flags;
148   __u32 command_id;
149   __u64 citadel_input_data;
150   __u64 feature_bypass_flags;
151   __u32 embedding_version;
152   __u32 input_time_ms;
153   struct faceauth_model_version_list model_versions;
154 } __attribute__((packed));
155 struct faceauth_debug_image {
156   __u32 offset_to_image;
157   __u32 image_size;
158 };
159 struct faceauth_debug_entry {
160   struct timeval timestamp;
161   uint32_t status;
162   uint32_t ab_exception_number;
163   uint32_t fault_address;
164   uint32_t ab_link_reg;
165   struct faceauth_debug_image left_dot;
166   struct faceauth_debug_image right_dot;
167   struct faceauth_debug_image left_flood;
168   struct faceauth_debug_image right_flood;
169   struct faceauth_debug_image calibration;
170   struct faceauth_airbrush_state ab_state;
171 } __attribute__((packed));
172 #define FACEAUTH_DEV_IOC_INIT _IOR('f', 1, struct faceauth_init_data)
173 #define FACEAUTH_DEV_IOC_START _IOWR('f', 2, struct faceauth_start_data)
174 #define FACEAUTH_DEV_IOC_CLEANUP _IO('f', 4)
175 #define FACEAUTH_DEV_IOC_DEBUG _IOR('f', 5, struct faceauth_debug_data)
176 #define FACEAUTH_DEV_IOC_DEBUG_DATA _IOR('f', 6, struct faceauth_debug_data)
177 #define FACEAUTH_GET_DEBUG_DATA_FROM_FIFO (0)
178 #define FACEAUTH_GET_DEBUG_DATA_MOST_RECENT (1)
179 #define FACEAUTH_GET_DEBUG_DATA_FROM_AB_DRAM (2)
180 #define FACEAUTH_DEBUG_DATA_PAYLOAD_SIZE (2 * 1024 * 1024)
181 #endif
182