#include "ac_nir_to_llvm.h"
#include "ac_gpu_info.h"
#include "ac_surface.h"
-#include "radv_debug.h"
#include "radv_descriptor_set.h"
#include <llvm-c/TargetMachine.h>
#include "wsi_common.h"
+#define ATI_VENDOR_ID 0x1002
+
#define MAX_VBS 32
#define MAX_VERTEX_ATTRIBS 32
#define MAX_RTS 8
#define MAX_SAMPLES_LOG2 4
#define NUM_META_FS_KEYS 13
#define RADV_MAX_DRM_DEVICES 8
+#define MAX_VIEWS 8
#define NUM_DEPTH_CLEAR_PIPELINES 3
memcpy((dest), (src), (count) * sizeof(*(src))); \
})
-#define zero(x) (memset(&(x), 0, sizeof(x)))
-
/* Whenever we generate an error, pass it through this function. Useful for
* debugging, where we can break on it. Only call at error site, not when
* propagating errors. Might be useful to plug in a stack trace here.
bool has_rbplus; /* if RB+ register exist */
bool rbplus_allowed; /* if RB+ is allowed */
+ bool has_clear_state;
+
+ /* This is the drivers on-disk cache used as a fallback as opposed to
+ * the pipeline cache defined by apps.
+ */
+ struct disk_cache * disk_cache;
};
struct radv_instance {
const unsigned char *sha1);
struct radv_shader_variant *
-radv_pipeline_cache_insert_shader(struct radv_pipeline_cache *cache,
+radv_pipeline_cache_insert_shader(struct radv_device *device,
+ struct radv_pipeline_cache *cache,
const unsigned char *sha1,
struct radv_shader_variant *variant,
const void *code, unsigned code_size);
-void radv_shader_variant_destroy(struct radv_device *device,
- struct radv_shader_variant *variant);
-
struct radv_meta_state {
VkAllocationCallbacks alloc;
*/
struct {
VkRenderPass render_pass[NUM_META_FS_KEYS];
- struct radv_pipeline *color_pipelines[NUM_META_FS_KEYS];
+ VkPipeline color_pipelines[NUM_META_FS_KEYS];
VkRenderPass depthstencil_rp;
- struct radv_pipeline *depth_only_pipeline[NUM_DEPTH_CLEAR_PIPELINES];
- struct radv_pipeline *stencil_only_pipeline[NUM_DEPTH_CLEAR_PIPELINES];
- struct radv_pipeline *depthstencil_pipeline[NUM_DEPTH_CLEAR_PIPELINES];
+ VkPipeline depth_only_pipeline[NUM_DEPTH_CLEAR_PIPELINES];
+ VkPipeline stencil_only_pipeline[NUM_DEPTH_CLEAR_PIPELINES];
+ VkPipeline depthstencil_pipeline[NUM_DEPTH_CLEAR_PIPELINES];
} clear[1 + MAX_SAMPLES_LOG2];
VkPipelineLayout clear_color_p_layout;
VkPipeline pipeline;
} itob;
struct {
- VkRenderPass render_pass;
VkPipelineLayout img_p_layout;
VkDescriptorSetLayout img_ds_layout;
VkPipeline pipeline;
struct radeon_winsys_bo *tess_factor_ring_bo;
struct radeon_winsys_bo *tess_offchip_ring_bo;
struct radeon_winsys_cs *initial_preamble_cs;
+ struct radeon_winsys_cs *initial_full_flush_preamble_cs;
struct radeon_winsys_cs *continue_preamble_cs;
};
struct radv_queue *queues[RADV_MAX_QUEUE_FAMILIES];
int queue_count[RADV_MAX_QUEUE_FAMILIES];
struct radeon_winsys_cs *empty_cs[RADV_MAX_QUEUE_FAMILIES];
- struct radeon_winsys_cs *flush_cs[RADV_MAX_QUEUE_FAMILIES];
- struct radeon_winsys_cs *flush_shader_cs[RADV_MAX_QUEUE_FAMILIES];
- uint64_t debug_flags;
bool llvm_supports_spill;
bool has_distributed_tess;
uint32_t fmask_mrt_offset_counter;
struct list_head shader_slabs;
mtx_t shader_slab_mutex;
+
+ /* For detecting VM faults reported by dmesg. */
+ uint64_t dmesg_timestamp;
};
struct radv_device_memory {
VkDeviceSize offset;
};
+struct radv_viewport_state {
+ uint32_t count;
+ VkViewport viewports[MAX_VIEWPORTS];
+};
+
+struct radv_scissor_state {
+ uint32_t count;
+ VkRect2D scissors[MAX_SCISSORS];
+};
+
struct radv_dynamic_state {
- struct {
- uint32_t count;
- VkViewport viewports[MAX_VIEWPORTS];
- } viewport;
+ struct radv_viewport_state viewport;
- struct {
- uint32_t count;
- VkRect2D scissors[MAX_SCISSORS];
- } scissor;
+ struct radv_scissor_state scissor;
float line_width;
extern const struct radv_dynamic_state default_dynamic_state;
-void radv_dynamic_state_copy(struct radv_dynamic_state *dest,
- const struct radv_dynamic_state *src,
- uint32_t copy_mask);
+const char *
+radv_get_debug_option_name(int id);
+
+const char *
+radv_get_perftest_option_name(int id);
+
/**
* Attachment state when recording a renderpass instance.
*
*/
struct radv_attachment_state {
VkImageAspectFlags pending_clear_aspects;
+ uint32_t cleared_views;
VkClearValue clear_value;
VkImageLayout current_layout;
};
struct radv_cmd_state {
- uint32_t vb_dirty;
+ bool vb_dirty;
radv_cmd_dirty_mask_t dirty;
bool push_descriptors_dirty;
+ bool predicating;
struct radv_pipeline * pipeline;
struct radv_pipeline * emitted_pipeline;
struct radv_attachment_state * attachments;
VkRect2D render_area;
uint32_t index_type;
- uint64_t index_va;
uint32_t max_index_count;
+ uint64_t index_va;
int32_t last_primitive_reset_en;
uint32_t last_primitive_reset_index;
enum radv_cmd_flush_bits flush_bits;
uint32_t descriptors_dirty;
uint32_t trace_id;
uint32_t last_ia_multi_vgt_param;
- bool predicating;
};
struct radv_cmd_pool {
bool tess_rings_needed;
bool sample_positions_needed;
- bool record_fail;
+ VkResult record_result;
int ring_offsets_idx; /* just used for verification */
uint32_t gfx9_fence_offset;
uint64_t *map;
};
-struct nir_shader;
-
-struct radv_shader_module {
- struct nir_shader * nir;
- unsigned char sha1[20];
- uint32_t size;
- char data[0];
-};
-
+struct radv_shader_module;
struct ac_shader_variant_key;
+#define RADV_HASH_SHADER_IS_GEOM_COPY_SHADER (1 << 0)
+#define RADV_HASH_SHADER_SISCHED (1 << 1)
+#define RADV_HASH_SHADER_UNSAFE_MATH (1 << 2)
void
radv_hash_shader(unsigned char *hash, struct radv_shader_module *module,
const char *entrypoint,
const VkSpecializationInfo *spec_info,
const struct radv_pipeline_layout *layout,
const struct ac_shader_variant_key *key,
- uint32_t is_geom_copy_shader);
+ uint32_t flags);
static inline gl_shader_stage
vk_to_mesa_shader_stage(VkShaderStageFlagBits vk_stage)
stage = __builtin_ffs(__tmp) - 1, __tmp; \
__tmp &= ~(1 << (stage)))
-
-struct radv_shader_slab {
- struct list_head slabs;
- struct list_head shaders;
- struct radeon_winsys_bo *bo;
- uint64_t size;
- char *ptr;
-};
-
-struct radv_shader_variant {
- uint32_t ref_count;
-
- struct radeon_winsys_bo *bo;
- uint64_t bo_offset;
- struct ac_shader_config config;
- struct ac_shader_variant_info info;
- unsigned rsrc1;
- unsigned rsrc2;
- uint32_t code_size;
-
- struct list_head slab_list;
-};
-
-
-void *radv_alloc_shader_memory(struct radv_device *device,
- struct radv_shader_variant *shader);
-
-void radv_destroy_shader_slabs(struct radv_device *device);
-
struct radv_depth_stencil_state {
uint32_t db_depth_control;
uint32_t db_stencil_control;
struct radv_raster_state {
uint32_t pa_cl_clip_cntl;
uint32_t spi_interp_control;
- uint32_t pa_su_point_size;
- uint32_t pa_su_point_minmax;
- uint32_t pa_su_line_cntl;
uint32_t pa_su_vtx_cntl;
uint32_t pa_su_sc_mode_cntl;
};
uint32_t tf_param;
};
+struct radv_vertex_elements_info {
+ uint32_t rsrc_word3[MAX_VERTEX_ATTRIBS];
+ uint32_t format_size[MAX_VERTEX_ATTRIBS];
+ uint32_t binding[MAX_VERTEX_ATTRIBS];
+ uint32_t offset[MAX_VERTEX_ATTRIBS];
+ uint32_t count;
+};
+
+#define SI_GS_PER_ES 128
+
struct radv_pipeline {
struct radv_device * device;
uint32_t dynamic_state_mask;
struct radv_shader_variant *gs_copy_shader;
VkShaderStageFlags active_stages;
- uint32_t va_rsrc_word3[MAX_VERTEX_ATTRIBS];
- uint32_t va_format_size[MAX_VERTEX_ATTRIBS];
- uint32_t va_binding[MAX_VERTEX_ATTRIBS];
- uint32_t va_offset[MAX_VERTEX_ATTRIBS];
- uint32_t num_vertex_attribs;
+ struct radv_vertex_elements_info vertex_elements;
+
uint32_t binding_stride[MAX_VBS];
union {
uint32_t vgt_gs_mode;
bool vgt_primitiveid_en;
bool prim_restart_enable;
+ bool partial_es_wave;
+ uint8_t primgroup_size;
unsigned esgs_ring_size;
unsigned gsvs_ring_size;
uint32_t ps_input_cntl[32];
uint32_t pa_cl_vs_out_cntl;
uint32_t vgt_shader_stages_en;
uint32_t vtx_base_sgpr;
+ uint32_t base_ia_multi_vgt_param;
+ bool wd_switch_on_eop;
+ bool ia_switch_on_eoi;
+ bool partial_vs_wave;
uint8_t vtx_emit_num;
+ uint32_t vtx_reuse_depth;
struct radv_prim_vertex_count prim_vertex_count;
bool can_use_guardband;
} graphics;
return pipeline->shaders[MESA_SHADER_TESS_EVAL] ? true : false;
}
-uint32_t radv_shader_stage_to_user_data_0(gl_shader_stage stage, bool has_gs, bool has_tess);
struct ac_userdata_info *radv_lookup_user_sgpr(struct radv_pipeline *pipeline,
gl_shader_stage stage,
int idx);
uint32_t custom_blend_mode;
};
-VkResult
-radv_pipeline_init(struct radv_pipeline *pipeline, struct radv_device *device,
- struct radv_pipeline_cache *cache,
- const VkGraphicsPipelineCreateInfo *pCreateInfo,
- const struct radv_graphics_pipeline_create_info *extra,
- const VkAllocationCallbacks *alloc);
-
VkResult
radv_graphics_pipeline_create(VkDevice device,
VkPipelineCache cache,
uint32_t clear_vals[2],
VkClearColorValue *value);
bool radv_is_colorbuffer_format_supported(VkFormat format, bool *blendable);
+bool radv_dcc_formats_compatible(VkFormat format1,
+ VkFormat format2);
struct radv_fmask_info {
uint64_t offset;
*/
VkFormat vk_format;
VkImageAspectFlags aspects;
- struct ac_surf_info info;
VkImageUsageFlags usage; /**< Superset of VkImageCreateInfo::usage. */
+ struct ac_surf_info info;
VkImageTiling tiling; /** VkImageCreateInfo::tiling */
VkImageCreateFlags flags; /** VkImageCreateInfo::flags */
VkDeviceSize size;
uint32_t alignment;
- bool exclusive;
unsigned queue_family_mask;
-
+ bool exclusive;
bool shareable;
/* Set when bound */
VkDeviceSize offset;
uint32_t dcc_offset;
uint32_t htile_offset;
+ bool tc_compatible_htile;
struct radeon_surf surface;
struct radv_fmask_info fmask;
VkImageLayout layout,
unsigned queue_mask);
+static inline bool
+radv_vi_dcc_enabled(const struct radv_image *image, unsigned level)
+{
+ return image->surface.dcc_size && level < image->surface.num_dcc_levels;
+}
+
+static inline bool
+radv_htile_enabled(const struct radv_image *image, unsigned level)
+{
+ return image->surface.htile_size && level == 0;
+}
unsigned radv_image_queue_family_mask(const struct radv_image *image, uint32_t family, uint32_t queue_family);
};
void radv_buffer_view_init(struct radv_buffer_view *view,
struct radv_device *device,
- const VkBufferViewCreateInfo* pCreateInfo,
- struct radv_cmd_buffer *cmd_buffer);
+ const VkBufferViewCreateInfo* pCreateInfo);
static inline struct VkExtent3D
radv_sanitize_image_extent(const VkImageType imageType,
bool has_resolve;
struct radv_subpass_barrier start_barrier;
+
+ uint32_t view_mask;
};
struct radv_render_pass_attachment {
VkAttachmentLoadOp stencil_load_op;
VkImageLayout initial_layout;
VkImageLayout final_layout;
+ uint32_t view_mask;
};
struct radv_render_pass {