1 /* 2 * Copyright © 2021 Raspberry Pi Ltd 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_cmd_buffer_attachment_state *attachments, 142 const struct v3dv_subpass *subpass, 143 uint8_t *max_bpp, bool *msaa); 144 145 #ifdef DEBUG 146 void 147 v3dX(device_check_prepacked_sizes)(void); 148 #endif 149 150 /* Used at v3dv_format */ 151 const struct v3dv_format * 152 v3dX(get_format)(VkFormat); 153 154 void 155 v3dX(get_internal_type_bpp_for_output_format)(uint32_t format, 156 uint32_t *type, 157 uint32_t *bpp); 158 159 bool 160 v3dX(format_supports_tlb_resolve)(const struct v3dv_format *format); 161 162 bool 163 v3dX(format_supports_blending)(const struct v3dv_format *format); 164 165 bool 166 v3dX(tfu_supports_tex_format)(uint32_t tex_format); 167 168 /* Used at v3dv_image */ 169 170 void 171 v3dX(pack_texture_shader_state)(struct v3dv_device *device, 172 struct v3dv_image_view *iview); 173 174 void 175 v3dX(pack_texture_shader_state_from_buffer_view)(struct v3dv_device *device, 176 struct v3dv_buffer_view *buffer_view); 177 178 /* Used at v3dv_meta_* */ 179 180 uint32_t 181 v3dX(zs_buffer_from_aspect_bits)(VkImageAspectFlags aspects); 182 183 uint8_t 184 v3dX(get_internal_depth_type)(VkFormat format); 185 186 struct v3dv_meta_framebuffer; 187 188 void 189 v3dX(meta_emit_copy_image_to_buffer_rcl)(struct v3dv_job *job, 190 struct v3dv_buffer *buffer, 191 struct v3dv_image *image, 192 struct v3dv_meta_framebuffer *framebuffer, 193 const VkBufferImageCopy2 *region); 194 195 void 196 v3dX(meta_emit_resolve_image_rcl)(struct v3dv_job *job, 197 struct v3dv_image *dst, 198 struct v3dv_image *src, 199 struct v3dv_meta_framebuffer *framebuffer, 200 const VkImageResolve2 *region); 201 202 void 203 v3dX(meta_emit_copy_buffer)(struct v3dv_job *job, 204 struct v3dv_bo *dst, 205 struct v3dv_bo *src, 206 uint32_t dst_offset, 207 uint32_t src_offset, 208 struct v3dv_meta_framebuffer *framebuffer, 209 uint32_t format, 210 uint32_t item_size); 211 212 void 213 v3dX(meta_emit_copy_buffer_rcl)(struct v3dv_job *job, 214 struct v3dv_bo *dst, 215 struct v3dv_bo *src, 216 uint32_t dst_offset, 217 uint32_t src_offset, 218 struct v3dv_meta_framebuffer *framebuffer, 219 uint32_t format, 220 uint32_t item_size); 221 222 void 223 v3dX(meta_emit_copy_image_rcl)(struct v3dv_job *job, 224 struct v3dv_image *dst, 225 struct v3dv_image *src, 226 struct v3dv_meta_framebuffer *framebuffer, 227 const VkImageCopy2 *region); 228 229 void 230 v3dX(meta_emit_tfu_job)(struct v3dv_cmd_buffer *cmd_buffer, 231 uint32_t dst_bo_handle, 232 uint32_t dst_offset, 233 enum v3d_tiling_mode dst_tiling, 234 uint32_t dst_padded_height_or_stride, 235 uint32_t dst_cpp, 236 uint32_t src_bo_handle, 237 uint32_t src_offset, 238 enum v3d_tiling_mode src_tiling, 239 uint32_t src_padded_height_or_stride, 240 uint32_t src_cpp, 241 uint32_t width, 242 uint32_t height, 243 const struct v3dv_format *format); 244 245 void 246 v3dX(meta_emit_clear_image_rcl)(struct v3dv_job *job, 247 struct v3dv_image *image, 248 struct v3dv_meta_framebuffer *framebuffer, 249 const union v3dv_clear_value *clear_value, 250 VkImageAspectFlags aspects, 251 uint32_t min_layer, 252 uint32_t max_layer, 253 uint32_t level); 254 255 void 256 v3dX(meta_emit_fill_buffer_rcl)(struct v3dv_job *job, 257 struct v3dv_bo *bo, 258 uint32_t offset, 259 struct v3dv_meta_framebuffer *framebuffer, 260 uint32_t data); 261 262 void 263 v3dX(meta_emit_copy_buffer_to_image_rcl)(struct v3dv_job *job, 264 struct v3dv_image *image, 265 struct v3dv_buffer *buffer, 266 struct v3dv_meta_framebuffer *framebuffer, 267 const VkBufferImageCopy2 *region); 268 269 void 270 v3dX(get_internal_type_bpp_for_image_aspects)(VkFormat vk_format, 271 VkImageAspectFlags aspect_mask, 272 uint32_t *internal_type, 273 uint32_t *internal_bpp); 274 275 struct v3dv_job * 276 v3dX(meta_copy_buffer)(struct v3dv_cmd_buffer *cmd_buffer, 277 struct v3dv_bo *dst, 278 uint32_t dst_offset, 279 struct v3dv_bo *src, 280 uint32_t src_offset, 281 const VkBufferCopy2 *region); 282 283 void 284 v3dX(meta_fill_buffer)(struct v3dv_cmd_buffer *cmd_buffer, 285 struct v3dv_bo *bo, 286 uint32_t offset, 287 uint32_t size, 288 uint32_t data); 289 290 void 291 v3dX(meta_framebuffer_init)(struct v3dv_meta_framebuffer *fb, 292 VkFormat vk_format, 293 uint32_t internal_type, 294 const struct v3dv_frame_tiling *tiling); 295 296 /* Used at v3dv_pipeline */ 297 void 298 v3dX(pipeline_pack_state)(struct v3dv_pipeline *pipeline, 299 const VkPipelineColorBlendStateCreateInfo *cb_info, 300 const VkPipelineDepthStencilStateCreateInfo *ds_info, 301 const VkPipelineRasterizationStateCreateInfo *rs_info, 302 const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *pv_info, 303 const VkPipelineRasterizationLineStateCreateInfoEXT *ls_info, 304 const VkPipelineMultisampleStateCreateInfo *ms_info); 305 void 306 v3dX(pipeline_pack_compile_state)(struct v3dv_pipeline *pipeline, 307 const VkPipelineVertexInputStateCreateInfo *vi_info, 308 const VkPipelineVertexInputDivisorStateCreateInfoEXT *vd_info); 309 /* Used at v3dv_queue */ 310 void 311 v3dX(job_emit_noop)(struct v3dv_job *job); 312 313 /* Used at v3dv_descriptor_set, and other descriptor set utils */ 314 uint32_t v3dX(descriptor_bo_size)(VkDescriptorType type); 315 316 uint32_t v3dX(max_descriptor_bo_size)(void); 317 318 uint32_t v3dX(combined_image_sampler_texture_state_offset)(void); 319 320 uint32_t v3dX(combined_image_sampler_sampler_state_offset)(void); 321