1 /****************************************************************************
2 *
3 *    Copyright 2021 Vivante Corporation, Santa Clara, California.
4 *    All Rights Reserved.
5 *
6 *    Permission is hereby granted, free of charge, to any person obtaining
7 *    a copy of this software and associated documentation files (the
8 *    'Software'), to deal in the Software without restriction, including
9 *    without limitation the rights to use, copy, modify, merge, publish,
10 *    distribute, sub license, and/or sell copies of the Software, and to
11 *    permit persons to whom the Software is furnished to do so, subject
12 *    to the following conditions:
13 *
14 *    The above copyright notice and this permission notice (including the
15 *    next paragraph) shall be included in all copies or substantial
16 *    portions of the Software.
17 *
18 *    THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
19 *    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 *    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 *    IN NO EVENT SHALL VIVANTE AND/OR ITS SUPPLIERS BE LIABLE FOR ANY
22 *    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 *    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 *    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 *****************************************************************************/
27 
28 #ifndef __ELM_HEADERS_H__
29 #define __ELM_HEADERS_H__
30 
31 
32 #define ATTR_PACKED __attribute__((packed, aligned(4)))
33 
34 
35 typedef struct {
36     vg_lite_matrix_t          matrix;
37     uint32_t                  reserved;
38     uint32_t                  stop_count;
39     uint32_t                  stop_offset;
40     uint32_t                  color_offset;
41 } el_EVO_GradData;
42 
43 typedef struct {
44     vg_lite_radial_gradient_parameter_t params;
45     vg_lite_radial_gradient_spreadmode_t spread_mode;
46 } el_EVO_RadGradDataExt;
47 
48 struct el_PaintType_t {
49     uint32_t                  paint:28;
50     uint32_t                  flags:1;
51     uint32_t                  is_image:1;
52     uint32_t                  is_pattern:1;
53     uint32_t                  has_pattern:1;
54 };
55 
56 typedef struct ATTR_PACKED {
57     uint32_t                  type;
58     vg_lite_float_t           min_x, min_y, max_x, max_y;
59     uint32_t                  format;
60     uint32_t                  length:31;
61     uint32_t                  arc_flag:1;
62     uint32_t                  offset;
63     vg_lite_matrix_t          matrix;
64     uint32_t                  reserved;
65     uint32_t                  quality;
66     uint32_t                  fill_rule;
67     uint32_t                  blend;
68     union {
69         uint32_t              paint_data;
70         struct el_PaintType_t paint_type;
71     };
72     vg_lite_color_t           color;
73     el_EVO_GradData           grad;
74 } el_EVO_Polygon;
75 
76 typedef struct ATTR_PACKED {
77     uint32_t                  type;
78     uint32_t                  namelength;
79     char                      eboname[76];
80     union {
81         uint32_t              paint_data;
82         struct el_PaintType_t paint_type;
83     };
84     vg_lite_matrix_t          matrix;
85     uint32_t                  width;
86     uint32_t                  height;
87 } el_EVO_Image;
88 
89 typedef struct ATTR_PACKED {
90     union {
91         el_EVO_Polygon        polygon;
92         el_EVO_Image          image;
93     };
94 } el_EVO_Header;
95 
96 typedef struct ATTR_PACKED {
97     uint32_t                  type;
98     uint32_t                  size_font_block;
99     uint32_t                  num_ttf_fonts;
100     uint32_t                  num_vector_fonts;
101     uint32_t                  num_text_fonts;
102     uint32_t                  ttf_fonts_block_offset;
103     uint32_t                  ttf_fonts_block_length;
104     uint32_t                  vector_fonts_block_offset;
105     uint32_t                  vector_fonts_block_length;
106     uint32_t                  text_fonts_block_offset;
107     uint32_t                  text_fonts_block_length;
108     uint32_t                  property_block_offset;
109     uint32_t                  property_block_length;
110 } el_Font_Header;
111 
112 struct el_TextFlags_t {
113     uint32_t                  flags1:1;
114     uint32_t                  text_anchor:2;
115     uint32_t                  flags2:29;
116 };
117 
118 typedef struct ATTR_PACKED {
119     uint32_t                  type;
120     uint32_t                  size_text_block;
121     uint32_t                  tspan_has_dx_dy;
122     float                     x_pos;
123     float                     y_pos;
124     float                     font_size;
125     uint32_t                  font_id;
126     uint32_t                  color;
127     union {
128         uint32_t              flags_data;
129         struct el_TextFlags_t text_flags;
130     };
131     vg_lite_matrix_t          matrix;
132     uint32_t                  reserved;
133     uint16_t                  data_length;
134 } el_Text_Header;
135 
136 typedef struct ATTR_PACKED {
137     uint32_t                  type;
138     uint32_t                  width;
139     uint32_t                  height;
140     uint32_t                  stride;
141     uint32_t                  tiled;
142     uint32_t                  format;
143     uint32_t                  data_offset;
144 } el_EBO_Header;
145 
146 typedef struct ATTR_PACKED {
147     uint32_t                  clut_count;
148     uint32_t                  clut_data_offset;
149 } el_EBO_Palette;
150 
151 typedef struct ATTR_PACKED {
152     uint32_t                  type;
153     vg_lite_matrix_t          matrix;
154     uint32_t                  count;
155 } el_EGO_Header;
156 
157 
158 #endif /* __ELM_HEADERS_H__ */
159