radv: enable TC-compat HTILE for 16-bit depth surfaces on GFX8
[mesa.git] / src / amd / vulkan / radv_private.h
index 335c8417e77134567c1c7b1f8372bd489036f6e7..ce2e487bdb5b61e8d36f3720d1a6b8f27bfbd1ab 100644 (file)
@@ -87,7 +87,9 @@ typedef uint32_t xcb_window_t;
 #define MAX_DISCARD_RECTANGLES 4
 #define MAX_PUSH_CONSTANTS_SIZE 128
 #define MAX_PUSH_DESCRIPTORS 32
-#define MAX_DYNAMIC_BUFFERS 16
+#define MAX_DYNAMIC_UNIFORM_BUFFERS 16
+#define MAX_DYNAMIC_STORAGE_BUFFERS 8
+#define MAX_DYNAMIC_BUFFERS (MAX_DYNAMIC_UNIFORM_BUFFERS + MAX_DYNAMIC_STORAGE_BUFFERS)
 #define MAX_SAMPLES_LOG2 4
 #define NUM_META_FS_KEYS 13
 #define RADV_MAX_DRM_DEVICES 8
@@ -95,6 +97,12 @@ typedef uint32_t xcb_window_t;
 
 #define NUM_DEPTH_CLEAR_PIPELINES 3
 
+/*
+ * This is the point we switch from using CP to compute shader
+ * for certain buffer operations.
+ */
+#define RADV_BUFFER_OPS_CS_THRESHOLD 4096
+
 enum radv_mem_heap {
        RADV_MEM_HEAP_VRAM,
        RADV_MEM_HEAP_VRAM_CPU_ACCESS,
@@ -255,7 +263,11 @@ void radv_loge_v(const char *format, va_list va);
                return;                                 \
        } while (0)
 
-void *radv_lookup_entrypoint(const char *name);
+void *radv_lookup_entrypoint_unchecked(const char *name);
+void *radv_lookup_entrypoint_checked(const char *name,
+                                    uint32_t core_version,
+                                    const struct radv_instance_extension_table *instance,
+                                    const struct radv_device_extension_table *device);
 
 struct radv_physical_device {
        VK_LOADER_DATA                              _loader_data;
@@ -303,6 +315,8 @@ struct radv_instance {
        uint64_t perftest_flags;
 
        struct vk_debug_report_instance             debug_report_callbacks;
+
+       struct radv_instance_extension_table enabled_extensions;
 };
 
 VkResult radv_init_wsi(struct radv_physical_device *physical_device);
@@ -559,6 +573,7 @@ struct radv_queue {
        enum radeon_ctx_priority                     priority;
        uint32_t queue_family_index;
        int queue_idx;
+       VkDeviceQueueCreateFlags flags;
 
        uint32_t scratch_size;
        uint32_t compute_scratch_size;
@@ -572,8 +587,7 @@ struct radv_queue {
        struct radeon_winsys_bo *compute_scratch_bo;
        struct radeon_winsys_bo *esgs_ring_bo;
        struct radeon_winsys_bo *gsvs_ring_bo;
-       struct radeon_winsys_bo *tess_factor_ring_bo;
-       struct radeon_winsys_bo *tess_offchip_ring_bo;
+       struct radeon_winsys_bo *tess_rings_bo;
        struct radeon_winsys_cs *initial_preamble_cs;
        struct radeon_winsys_cs *initial_full_flush_preamble_cs;
        struct radeon_winsys_cs *continue_preamble_cs;
@@ -639,6 +653,8 @@ struct radv_device {
 
        /* For detecting VM faults reported by dmesg. */
        uint64_t dmesg_timestamp;
+
+       struct radv_device_extension_table enabled_extensions;
 };
 
 struct radv_device_memory {
@@ -729,7 +745,6 @@ struct radv_descriptor_update_template {
 };
 
 struct radv_buffer {
-       struct radv_device *                          device;
        VkDeviceSize                                 size;
 
        VkBufferUsageFlags                           usage;
@@ -997,6 +1012,11 @@ struct radv_cmd_buffer {
        uint32_t gfx9_fence_offset;
        struct radeon_winsys_bo *gfx9_fence_bo;
        uint32_t gfx9_fence_idx;
+
+       /**
+        * Whether a query pool has been resetted and we have to flush caches.
+        */
+       bool pending_reset_query;
 };
 
 struct radv_image;
@@ -1187,7 +1207,6 @@ struct radv_pipeline {
 
        struct radv_pipeline_layout *                 layout;
 
-       bool                                         needs_data_cache;
        bool                                         need_indirect_descriptor_sets;
        struct radv_shader_variant *                 shaders[MESA_SHADER_STAGES];
        struct radv_shader_variant *gs_copy_shader;
@@ -1230,9 +1249,9 @@ static inline bool radv_pipeline_has_tess(const struct radv_pipeline *pipeline)
        return pipeline->shaders[MESA_SHADER_TESS_CTRL] ? true : false;
 }
 
-struct ac_userdata_info *radv_lookup_user_sgpr(struct radv_pipeline *pipeline,
-                                              gl_shader_stage stage,
-                                              int idx);
+struct radv_userdata_info *radv_lookup_user_sgpr(struct radv_pipeline *pipeline,
+                                                gl_shader_stage stage,
+                                                int idx);
 
 struct radv_shader_variant *radv_get_vertex_shader(struct radv_pipeline *pipeline);
 
@@ -1595,6 +1614,7 @@ struct radv_query_pool {
        struct radeon_winsys_bo *bo;
        uint32_t stride;
        uint32_t availability_offset;
+       uint64_t size;
        char *ptr;
        VkQueryType type;
        uint32_t pipeline_stats_mask;
@@ -1657,6 +1677,32 @@ struct radv_fence {
        uint32_t temp_syncobj;
 };
 
+/* radv_nir_to_llvm.c */
+struct radv_shader_variant_info;
+struct radv_nir_compiler_options;
+
+void radv_compile_gs_copy_shader(LLVMTargetMachineRef tm,
+                                struct nir_shader *geom_shader,
+                                struct ac_shader_binary *binary,
+                                struct ac_shader_config *config,
+                                struct radv_shader_variant_info *shader_info,
+                                const struct radv_nir_compiler_options *option);
+
+void radv_compile_nir_shader(LLVMTargetMachineRef tm,
+                            struct ac_shader_binary *binary,
+                            struct ac_shader_config *config,
+                            struct radv_shader_variant_info *shader_info,
+                            struct nir_shader *const *nir,
+                            int nir_count,
+                            const struct radv_nir_compiler_options *options);
+
+/* radv_shader_info.h */
+struct radv_shader_info;
+
+void radv_nir_shader_info_pass(const struct nir_shader *nir,
+                              const struct radv_nir_compiler_options *options,
+                              struct radv_shader_info *info);
+
 struct radeon_winsys_sem;
 
 #define RADV_DEFINE_HANDLE_CASTS(__radv_type, __VkType)                \