1 /*
2  * Copyright © 2021 Raspberry Pi
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 /* This file generates the per-v3d-version function prototypes.  It must only
25  * be included from v3dv_private.h.
26  */
27 
28 #ifndef V3DV_PRIVATE_H
29 #error This file is included by means other than v3dv_private.h
30 #endif
31 
32 /* Used at v3dv_cmd_buffer */
33 void
34 v3dX(job_emit_binning_flush)(struct v3dv_job *job);
35 
36 void
37 v3dX(cmd_buffer_emit_color_write_mask)(struct v3dv_cmd_buffer *cmd_buffer);
38 
39 void
40 v3dX(cmd_buffer_end_render_pass_secondary)(struct v3dv_cmd_buffer *cmd_buffer);
41 
42 void
43 v3dX(job_emit_clip_window)(struct v3dv_job *job, const VkRect2D *rect);
44 
45 void
46 v3dX(cmd_buffer_emit_render_pass_rcl)(struct v3dv_cmd_buffer *cmd_buffer);
47 
48 void
49 v3dX(cmd_buffer_emit_viewport)(struct v3dv_cmd_buffer *cmd_buffer);
50 
51 void
52 v3dX(cmd_buffer_emit_stencil)(struct v3dv_cmd_buffer *cmd_buffer);
53 
54 void
55 v3dX(cmd_buffer_emit_depth_bias)(struct v3dv_cmd_buffer *cmd_buffer);
56 
57 void
58 v3dX(cmd_buffer_emit_line_width)(struct v3dv_cmd_buffer *cmd_buffer);
59 
60 void
61 v3dX(cmd_buffer_emit_sample_state)(struct v3dv_cmd_buffer *cmd_buffer);
62 
63 void
64 v3dX(cmd_buffer_emit_blend)(struct v3dv_cmd_buffer *cmd_buffer);
65 
66 void
67 v3dX(cmd_buffer_emit_varyings_state)(struct v3dv_cmd_buffer *cmd_buffer);
68 
69 void
70 v3dX(cmd_buffer_emit_configuration_bits)(struct v3dv_cmd_buffer *cmd_buffer);
71 
72 void
73 v3dX(job_emit_binning_prolog)(struct v3dv_job *job,
74                               const struct v3dv_frame_tiling *tiling,
75                               uint32_t layers);
76 
77 void
78 v3dX(cmd_buffer_execute_inside_pass)(struct v3dv_cmd_buffer *primary,
79                                      uint32_t cmd_buffer_count,
80                                      const VkCommandBuffer *cmd_buffers);
81 
82 void
83 v3dX(cmd_buffer_emit_occlusion_query)(struct v3dv_cmd_buffer *cmd_buffer);
84 
85 void
86 v3dX(cmd_buffer_emit_gl_shader_state)(struct v3dv_cmd_buffer *cmd_buffer);
87 
88 
89 void
90 v3dX(cmd_buffer_emit_draw)(struct v3dv_cmd_buffer *cmd_buffer,
91                            struct v3dv_draw_info *info);
92 
93 
94 void
95 v3dX(cmd_buffer_emit_index_buffer)(struct v3dv_cmd_buffer *cmd_buffer);
96 
97 void
98 v3dX(cmd_buffer_emit_draw_indexed)(struct v3dv_cmd_buffer *cmd_buffer,
99                                    uint32_t indexCount,
100                                    uint32_t instanceCount,
101                                    uint32_t firstIndex,
102                                    int32_t vertexOffset,
103                                    uint32_t firstInstance);
104 
105 void
106 v3dX(cmd_buffer_emit_draw_indirect)(struct v3dv_cmd_buffer *cmd_buffer,
107                                     struct v3dv_buffer *buffer,
108                                     VkDeviceSize offset,
109                                     uint32_t drawCount,
110                                     uint32_t stride);
111 
112 void
113 v3dX(cmd_buffer_emit_indexed_indirect)(struct v3dv_cmd_buffer *cmd_buffer,
114                                        struct v3dv_buffer *buffer,
115                                        VkDeviceSize offset,
116                                        uint32_t drawCount,
117                                        uint32_t stride);
118 
119 void
120 v3dX(get_hw_clear_color)(const VkClearColorValue *color,
121                          uint32_t internal_type,
122                          uint32_t internal_size,
123                          uint32_t *hw_color);
124 
125 void
126 v3dX(cmd_buffer_render_pass_setup_render_target)(struct v3dv_cmd_buffer *cmd_buffer,
127                                                  int rt,
128                                                  uint32_t *rt_bpp,
129                                                  uint32_t *rt_type,
130                                                  uint32_t *rt_clamp);
131 
132 /* Used at v3dv_device */
133 
134 void
135 v3dX(pack_sampler_state)(struct v3dv_sampler *sampler,
136                          const VkSamplerCreateInfo *pCreateInfo,
137                          const VkSamplerCustomBorderColorCreateInfoEXT *bc_info);
138 
139 void
140 v3dX(framebuffer_compute_internal_bpp_msaa)(const struct v3dv_framebuffer *framebuffer,
141                                             const struct v3dv_subpass *subpass,
142                                             uint8_t *max_bpp, bool *msaa);
143 
144 #ifdef DEBUG
145 void
146 v3dX(device_check_prepacked_sizes)(void);
147 #endif
148 
149 /* Used at v3dv_format */
150 const struct v3dv_format *
151 v3dX(get_format)(VkFormat);
152 
153 void
154 v3dX(get_internal_type_bpp_for_output_format)(uint32_t format,
155                                               uint32_t *type,
156                                               uint32_t *bpp);
157 
158 bool
159 v3dX(format_supports_tlb_resolve)(const struct v3dv_format *format);
160 
161 bool
162 v3dX(format_supports_blending)(const struct v3dv_format *format);
163 
164 bool
165 v3dX(tfu_supports_tex_format)(uint32_t tex_format);
166 
167 /* Used at v3dv_image */
168 
169 void
170 v3dX(pack_texture_shader_state)(struct v3dv_device *device,
171                                 struct v3dv_image_view *iview);
172 
173 void
174 v3dX(pack_texture_shader_state_from_buffer_view)(struct v3dv_device *device,
175                                                  struct v3dv_buffer_view *buffer_view);
176 
177 /* Used at v3dv_meta_* */
178 
179 uint32_t
180 v3dX(zs_buffer_from_aspect_bits)(VkImageAspectFlags aspects);
181 
182 uint8_t
183 v3dX(get_internal_depth_type)(VkFormat format);
184 
185 struct v3dv_meta_framebuffer;
186 
187 void
188 v3dX(meta_emit_copy_image_to_buffer_rcl)(struct v3dv_job *job,
189                                          struct v3dv_buffer *buffer,
190                                          struct v3dv_image *image,
191                                          struct v3dv_meta_framebuffer *framebuffer,
192                                          const VkBufferImageCopy2KHR *region);
193 
194 void
195 v3dX(meta_emit_resolve_image_rcl)(struct v3dv_job *job,
196                                   struct v3dv_image *dst,
197                                   struct v3dv_image *src,
198                                   struct v3dv_meta_framebuffer *framebuffer,
199                                   const VkImageResolve2KHR *region);
200 
201 void
202 v3dX(meta_emit_copy_buffer)(struct v3dv_job *job,
203                             struct v3dv_bo *dst,
204                             struct v3dv_bo *src,
205                             uint32_t dst_offset,
206                             uint32_t src_offset,
207                             struct v3dv_meta_framebuffer *framebuffer,
208                             uint32_t format,
209                             uint32_t item_size);
210 
211 void
212 v3dX(meta_emit_copy_buffer_rcl)(struct v3dv_job *job,
213                                 struct v3dv_bo *dst,
214                                 struct v3dv_bo *src,
215                                 uint32_t dst_offset,
216                                 uint32_t src_offset,
217                                 struct v3dv_meta_framebuffer *framebuffer,
218                                 uint32_t format,
219                                 uint32_t item_size);
220 
221 void
222 v3dX(meta_emit_copy_image_rcl)(struct v3dv_job *job,
223                                struct v3dv_image *dst,
224                                struct v3dv_image *src,
225                                struct v3dv_meta_framebuffer *framebuffer,
226                                const VkImageCopy2KHR *region);
227 
228 void
229 v3dX(meta_emit_tfu_job)(struct v3dv_cmd_buffer *cmd_buffer,
230                         struct v3dv_image *dst,
231                         uint32_t dst_mip_level,
232                         uint32_t dst_layer,
233                         struct v3dv_image *src,
234                         uint32_t src_mip_level,
235                         uint32_t src_layer,
236                         uint32_t width,
237                         uint32_t height,
238                         const struct v3dv_format *format);
239 
240 void
241 v3dX(meta_emit_clear_image_rcl)(struct v3dv_job *job,
242                                 struct v3dv_image *image,
243                                 struct v3dv_meta_framebuffer *framebuffer,
244                                 const union v3dv_clear_value *clear_value,
245                                 VkImageAspectFlags aspects,
246                                 uint32_t min_layer,
247                                 uint32_t max_layer,
248                                 uint32_t level);
249 
250 void
251 v3dX(meta_emit_fill_buffer_rcl)(struct v3dv_job *job,
252                                 struct v3dv_bo *bo,
253                                 uint32_t offset,
254                                 struct v3dv_meta_framebuffer *framebuffer,
255                                 uint32_t data);
256 
257 void
258 v3dX(meta_emit_copy_buffer_to_image_rcl)(struct v3dv_job *job,
259                                          struct v3dv_image *image,
260                                          struct v3dv_buffer *buffer,
261                                          struct v3dv_meta_framebuffer *framebuffer,
262                                          const VkBufferImageCopy2KHR *region);
263 
264 void
265 v3dX(get_internal_type_bpp_for_image_aspects)(VkFormat vk_format,
266                                               VkImageAspectFlags aspect_mask,
267                                               uint32_t *internal_type,
268                                               uint32_t *internal_bpp);
269 
270 struct v3dv_job *
271 v3dX(meta_copy_buffer)(struct v3dv_cmd_buffer *cmd_buffer,
272                        struct v3dv_bo *dst,
273                        uint32_t dst_offset,
274                        struct v3dv_bo *src,
275                        uint32_t src_offset,
276                        const VkBufferCopy2KHR *region);
277 
278 void
279 v3dX(meta_fill_buffer)(struct v3dv_cmd_buffer *cmd_buffer,
280                        struct v3dv_bo *bo,
281                        uint32_t offset,
282                        uint32_t size,
283                        uint32_t data);
284 
285 void
286 v3dX(meta_framebuffer_init)(struct v3dv_meta_framebuffer *fb,
287                             VkFormat vk_format,
288                             uint32_t internal_type,
289                             const struct v3dv_frame_tiling *tiling);
290 
291 /* Used at v3dv_pipeline */
292 void
293 v3dX(pipeline_pack_state)(struct v3dv_pipeline *pipeline,
294                           const VkPipelineColorBlendStateCreateInfo *cb_info,
295                           const VkPipelineDepthStencilStateCreateInfo *ds_info,
296                           const VkPipelineRasterizationStateCreateInfo *rs_info,
297                           const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *pv_info,
298                           const VkPipelineMultisampleStateCreateInfo *ms_info);
299 void
300 v3dX(pipeline_pack_compile_state)(struct v3dv_pipeline *pipeline,
301                                   const VkPipelineVertexInputStateCreateInfo *vi_info,
302                                   const VkPipelineVertexInputDivisorStateCreateInfoEXT *vd_info);
303 /* Used at v3dv_queue */
304 void
305 v3dX(job_emit_noop)(struct v3dv_job *job);
306 
307 /* Used at v3dv_descriptor_set, and other descriptor set utils */
308 uint32_t v3dX(descriptor_bo_size)(VkDescriptorType type);
309 
310 uint32_t v3dX(max_descriptor_bo_size)(void);
311 
312 uint32_t v3dX(combined_image_sampler_texture_state_offset)(void);
313 
314 uint32_t v3dX(combined_image_sampler_sampler_state_offset)(void);
315