lavapipe: Use generated command queue code

Most of the code that implements entry points for commands doesn't need
to be manually written. So just drop it.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12369>
This commit is contained in:
Tomeu Vizoso 2021-08-13 10:48:20 +02:00 committed by Marge Bot
parent 997a6ca226
commit eb7eccc76f
5 changed files with 1194 additions and 3004 deletions

View File

@ -1,4 +1,2 @@
dEQP-VK.glsl.builtin.precision.pow.highp.vec2,Fail
dEQP-VK.glsl.texture_functions.query.texturequerylod.sampler2d_fixed_fragment,Fail
dEQP-VK.draw.multi_draw.mosaic.indexed_packed.max_draws.standard_stride.10_instances.offset_6,Crash
dEQP-VK.draw.multi_draw.overlapping.indexed_packed.one_draw.standard_stride.no_instances.offset_6,Crash

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,7 @@ typedef uint32_t xcb_window_t;
#include "vk_shader_module.h"
#include "vk_util.h"
#include "vk_format.h"
#include "vk_cmd_queue.h"
#include "wsi_common.h"
@ -597,8 +598,7 @@ struct lvp_cmd_buffer {
struct lvp_cmd_pool * pool;
struct list_head pool_link;
struct list_head cmds;
struct list_head *last_emit;
struct vk_cmd_queue queue;
uint8_t push_constants[MAX_PUSH_CONSTANTS_SIZE];
};
@ -653,358 +653,11 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_fence, base, VkFence, VK_OBJECT_TYPE_FENCE);
VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_semaphore, base, VkSemaphore,
VK_OBJECT_TYPE_SEMAPHORE);
/* in same order and buffer building commands in spec. */
enum lvp_cmds {
LVP_CMD_BIND_PIPELINE,
LVP_CMD_SET_VIEWPORT,
LVP_CMD_SET_SCISSOR,
LVP_CMD_SET_LINE_WIDTH,
LVP_CMD_SET_DEPTH_BIAS,
LVP_CMD_SET_BLEND_CONSTANTS,
LVP_CMD_SET_DEPTH_BOUNDS,
LVP_CMD_SET_STENCIL_COMPARE_MASK,
LVP_CMD_SET_STENCIL_WRITE_MASK,
LVP_CMD_SET_STENCIL_REFERENCE,
LVP_CMD_BIND_DESCRIPTOR_SETS,
LVP_CMD_BIND_INDEX_BUFFER,
LVP_CMD_BIND_VERTEX_BUFFERS,
LVP_CMD_DRAW,
LVP_CMD_DRAW_INDEXED,
LVP_CMD_DRAW_INDIRECT,
LVP_CMD_DRAW_INDEXED_INDIRECT,
LVP_CMD_DISPATCH,
LVP_CMD_DISPATCH_INDIRECT,
LVP_CMD_COPY_BUFFER,
LVP_CMD_COPY_IMAGE,
LVP_CMD_BLIT_IMAGE,
LVP_CMD_COPY_BUFFER_TO_IMAGE,
LVP_CMD_COPY_IMAGE_TO_BUFFER,
LVP_CMD_UPDATE_BUFFER,
LVP_CMD_FILL_BUFFER,
LVP_CMD_CLEAR_COLOR_IMAGE,
LVP_CMD_CLEAR_DEPTH_STENCIL_IMAGE,
LVP_CMD_CLEAR_ATTACHMENTS,
LVP_CMD_RESOLVE_IMAGE,
LVP_CMD_SET_EVENT,
LVP_CMD_RESET_EVENT,
LVP_CMD_WAIT_EVENTS,
LVP_CMD_PIPELINE_BARRIER,
LVP_CMD_BEGIN_QUERY,
LVP_CMD_END_QUERY,
LVP_CMD_RESET_QUERY_POOL,
LVP_CMD_WRITE_TIMESTAMP,
LVP_CMD_COPY_QUERY_POOL_RESULTS,
LVP_CMD_PUSH_CONSTANTS,
LVP_CMD_BEGIN_RENDER_PASS,
LVP_CMD_NEXT_SUBPASS,
LVP_CMD_END_RENDER_PASS,
LVP_CMD_EXECUTE_COMMANDS,
LVP_CMD_DRAW_INDIRECT_COUNT,
LVP_CMD_DRAW_INDEXED_INDIRECT_COUNT,
LVP_CMD_PUSH_DESCRIPTOR_SET,
LVP_CMD_BIND_TRANSFORM_FEEDBACK_BUFFERS,
LVP_CMD_BEGIN_TRANSFORM_FEEDBACK,
LVP_CMD_END_TRANSFORM_FEEDBACK,
LVP_CMD_DRAW_INDIRECT_BYTE_COUNT,
LVP_CMD_BEGIN_CONDITIONAL_RENDERING,
LVP_CMD_END_CONDITIONAL_RENDERING,
LVP_CMD_SET_VERTEX_INPUT,
LVP_CMD_SET_CULL_MODE,
LVP_CMD_SET_FRONT_FACE,
LVP_CMD_SET_PRIMITIVE_TOPOLOGY,
LVP_CMD_SET_DEPTH_TEST_ENABLE,
LVP_CMD_SET_DEPTH_WRITE_ENABLE,
LVP_CMD_SET_DEPTH_COMPARE_OP,
LVP_CMD_SET_DEPTH_BOUNDS_TEST_ENABLE,
LVP_CMD_SET_STENCIL_TEST_ENABLE,
LVP_CMD_SET_STENCIL_OP,
LVP_CMD_SET_LINE_STIPPLE,
LVP_CMD_SET_DEPTH_BIAS_ENABLE,
LVP_CMD_SET_LOGIC_OP,
LVP_CMD_SET_PATCH_CONTROL_POINTS,
LVP_CMD_SET_PRIMITIVE_RESTART_ENABLE,
LVP_CMD_SET_RASTERIZER_DISCARD_ENABLE,
LVP_CMD_SET_COLOR_WRITE_ENABLE,
};
struct lvp_cmd_bind_pipeline {
VkPipelineBindPoint bind_point;
struct lvp_pipeline *pipeline;
};
struct lvp_cmd_set_viewport {
uint32_t first_viewport;
uint32_t viewport_count;
VkViewport viewports[16];
};
struct lvp_cmd_set_scissor {
uint32_t first_scissor;
uint32_t scissor_count;
VkRect2D scissors[16];
};
struct lvp_cmd_set_line_width {
float line_width;
};
struct lvp_cmd_set_depth_bias {
float constant_factor;
float clamp;
float slope_factor;
};
struct lvp_cmd_set_blend_constants {
float blend_constants[4];
};
struct lvp_cmd_set_depth_bounds {
float min_depth;
float max_depth;
};
struct lvp_cmd_set_stencil_vals {
VkStencilFaceFlags face_mask;
uint32_t value;
};
struct lvp_cmd_bind_descriptor_sets {
VkPipelineBindPoint bind_point;
struct lvp_descriptor_set_layout *set_layout[MAX_SETS];
uint32_t first;
uint32_t count;
struct lvp_descriptor_set **sets;
uint32_t dynamic_offset_count;
const uint32_t *dynamic_offsets;
};
struct lvp_cmd_bind_index_buffer {
const struct lvp_buffer *buffer;
VkDeviceSize offset;
VkIndexType index_type;
};
struct lvp_cmd_bind_vertex_buffers {
uint32_t first;
uint32_t binding_count;
struct lvp_buffer **buffers;
const VkDeviceSize *offsets;
const VkDeviceSize *sizes;
const VkDeviceSize *strides;
};
struct lvp_cmd_draw {
uint32_t instance_count;
uint32_t first_instance;
uint32_t draw_count;
struct pipe_draw_start_count_bias draws[0];
};
struct lvp_cmd_draw_indexed {
uint32_t instance_count;
uint32_t first_instance;
bool calc_start;
uint32_t draw_count;
bool vertex_offset_changes;
struct pipe_draw_start_count_bias draws[0];
};
struct lvp_cmd_draw_indirect {
VkDeviceSize offset;
struct lvp_buffer *buffer;
uint32_t draw_count;
uint32_t stride;
};
struct lvp_cmd_dispatch {
uint32_t x;
uint32_t y;
uint32_t z;
uint32_t base_x;
uint32_t base_y;
uint32_t base_z;
};
struct lvp_cmd_dispatch_indirect {
const struct lvp_buffer *buffer;
VkDeviceSize offset;
};
struct lvp_cmd_copy_buffer {
struct lvp_buffer *src;
struct lvp_buffer *dst;
uint32_t region_count;
const VkBufferCopy *regions;
};
struct lvp_cmd_copy_image {
struct lvp_image *src;
struct lvp_image *dst;
VkImageLayout src_layout;
VkImageLayout dst_layout;
uint32_t region_count;
const VkImageCopy *regions;
};
struct lvp_cmd_blit_image {
struct lvp_image *src;
struct lvp_image *dst;
VkImageLayout src_layout;
VkImageLayout dst_layout;
uint32_t region_count;
const VkImageBlit *regions;
VkFilter filter;
};
struct lvp_cmd_copy_buffer_to_image {
struct lvp_buffer *src;
struct lvp_image *dst;
VkImageLayout dst_layout;
uint32_t region_count;
const VkBufferImageCopy *regions;
};
struct lvp_cmd_copy_image_to_buffer {
struct lvp_image *src;
struct lvp_buffer *dst;
VkImageLayout src_layout;
uint32_t region_count;
const VkBufferImageCopy *regions;
};
struct lvp_cmd_update_buffer {
struct lvp_buffer *buffer;
VkDeviceSize offset;
VkDeviceSize data_size;
char data[0];
};
struct lvp_cmd_fill_buffer {
struct lvp_buffer *buffer;
VkDeviceSize offset;
VkDeviceSize fill_size;
uint32_t data;
};
struct lvp_cmd_clear_color_image {
struct lvp_image *image;
VkImageLayout layout;
VkClearColorValue clear_val;
uint32_t range_count;
VkImageSubresourceRange *ranges;
};
struct lvp_cmd_clear_ds_image {
struct lvp_image *image;
VkImageLayout layout;
VkClearDepthStencilValue clear_val;
uint32_t range_count;
VkImageSubresourceRange *ranges;
};
struct lvp_cmd_clear_attachments {
uint32_t attachment_count;
VkClearAttachment *attachments;
uint32_t rect_count;
VkClearRect *rects;
};
struct lvp_cmd_resolve_image {
struct lvp_image *src;
struct lvp_image *dst;
VkImageLayout src_layout;
VkImageLayout dst_layout;
uint32_t region_count;
VkImageResolve *regions;
};
struct lvp_cmd_event_set {
struct lvp_event *event;
bool value;
bool flush;
};
struct lvp_cmd_wait_events {
uint32_t event_count;
struct lvp_event **events;
VkPipelineStageFlags src_stage_mask;
VkPipelineStageFlags dst_stage_mask;
uint32_t memory_barrier_count;
VkMemoryBarrier *memory_barriers;
uint32_t buffer_memory_barrier_count;
VkBufferMemoryBarrier *buffer_memory_barriers;
uint32_t image_memory_barrier_count;
VkImageMemoryBarrier *image_memory_barriers;
};
struct lvp_cmd_pipeline_barrier {
VkPipelineStageFlags src_stage_mask;
VkPipelineStageFlags dst_stage_mask;
bool by_region;
uint32_t memory_barrier_count;
VkMemoryBarrier *memory_barriers;
uint32_t buffer_memory_barrier_count;
VkBufferMemoryBarrier *buffer_memory_barriers;
uint32_t image_memory_barrier_count;
VkImageMemoryBarrier *image_memory_barriers;
};
struct lvp_cmd_query_cmd {
struct lvp_query_pool *pool;
uint32_t query;
uint32_t index;
bool precise;
bool flush;
};
struct lvp_cmd_copy_query_pool_results {
struct lvp_query_pool *pool;
uint32_t first_query;
uint32_t query_count;
struct lvp_buffer *dst;
VkDeviceSize dst_offset;
VkDeviceSize stride;
VkQueryResultFlags flags;
};
struct lvp_cmd_push_constants {
VkShaderStageFlags stage;
uint32_t offset;
uint32_t size;
uint32_t val[1];
};
struct lvp_attachment_state {
VkImageAspectFlags pending_clear_aspects;
VkClearValue clear_value;
};
struct lvp_cmd_begin_render_pass {
struct lvp_framebuffer *framebuffer;
struct lvp_render_pass *render_pass;
VkRect2D render_area;
struct lvp_attachment_state *attachments;
struct lvp_image_view **imageless_views;
};
struct lvp_cmd_next_subpass {
VkSubpassContents contents;
};
struct lvp_cmd_execute_commands {
uint32_t command_buffer_count;
struct lvp_cmd_buffer *cmd_buffers[0];
};
struct lvp_cmd_draw_indirect_count {
VkDeviceSize offset;
struct lvp_buffer *buffer;
VkDeviceSize count_buffer_offset;
struct lvp_buffer *count_buffer;
uint32_t max_draw_count;
uint32_t stride;
};
struct lvp_write_descriptor {
uint32_t dst_binding;
uint32_t dst_array_element;
@ -1021,187 +674,6 @@ struct lvp_cmd_push_descriptor_set {
union lvp_descriptor_info *infos;
};
struct lvp_cmd_bind_transform_feedback_buffers {
uint32_t first_binding;
uint32_t binding_count;
struct lvp_buffer **buffers;
VkDeviceSize *offsets;
VkDeviceSize *sizes;
};
struct lvp_cmd_begin_transform_feedback {
uint32_t first_counter_buffer;
uint32_t counter_buffer_count;
struct lvp_buffer **counter_buffers;
VkDeviceSize *counter_buffer_offsets;
};
struct lvp_cmd_end_transform_feedback {
uint32_t first_counter_buffer;
uint32_t counter_buffer_count;
struct lvp_buffer **counter_buffers;
VkDeviceSize *counter_buffer_offsets;
};
struct lvp_cmd_draw_indirect_byte_count {
uint32_t instance_count;
uint32_t first_instance;
struct lvp_buffer *counter_buffer;
VkDeviceSize counter_buffer_offset;
uint32_t counter_offset;
uint32_t vertex_stride;
};
struct lvp_cmd_begin_conditional_rendering {
struct lvp_buffer *buffer;
VkDeviceSize offset;
bool inverted;
};
struct lvp_cmd_set_vertex_input {
uint32_t binding_count;
uint32_t attr_count;
uint8_t data[0];
//VkVertexInputBindingDescription2EXT bindings[binding_count];
//VkVertexInputAttributeDescription2EXT attrs[attr_count];
};
struct lvp_cmd_set_cull_mode {
VkCullModeFlags cull_mode;
};
struct lvp_cmd_set_front_face {
VkFrontFace front_face;
};
struct lvp_cmd_set_primitive_topology {
VkPrimitiveTopology prim;
};
struct lvp_cmd_set_depth_test_enable {
VkBool32 depth_test_enable;
};
struct lvp_cmd_set_depth_write_enable {
VkBool32 depth_write_enable;
};
struct lvp_cmd_set_depth_bounds_test_enable {
VkBool32 depth_bounds_test_enable;
};
struct lvp_cmd_set_depth_compare_op {
VkCompareOp depth_op;
};
struct lvp_cmd_set_stencil_test_enable {
VkBool32 stencil_test_enable;
};
struct lvp_cmd_set_stencil_op {
VkStencilFaceFlags face_mask;
VkStencilOp fail_op;
VkStencilOp pass_op;
VkStencilOp depth_fail_op;
VkCompareOp compare_op;
};
struct lvp_cmd_set_line_stipple {
uint32_t line_stipple_factor;
uint16_t line_stipple_pattern;
};
struct lvp_cmd_set_depth_bias_enable {
bool enable;
};
struct lvp_cmd_set_logic_op {
VkLogicOp op;
};
struct lvp_cmd_set_patch_control_points {
uint32_t vertices_per_patch;
};
struct lvp_cmd_set_primitive_restart_enable {
bool enable;
};
struct lvp_cmd_set_rasterizer_discard_enable {
bool enable;
};
struct lvp_cmd_set_color_write_enable {
uint8_t disable_mask; //PIPE_MAX_COLOR_BUFS is max attachment count
};
struct lvp_cmd_buffer_entry {
struct list_head cmd_link;
uint32_t cmd_type;
union {
struct lvp_cmd_bind_pipeline pipeline;
struct lvp_cmd_set_viewport set_viewport;
struct lvp_cmd_set_scissor set_scissor;
struct lvp_cmd_set_line_width set_line_width;
struct lvp_cmd_set_depth_bias set_depth_bias;
struct lvp_cmd_set_blend_constants set_blend_constants;
struct lvp_cmd_set_depth_bounds set_depth_bounds;
struct lvp_cmd_set_stencil_vals stencil_vals;
struct lvp_cmd_bind_descriptor_sets descriptor_sets;
struct lvp_cmd_bind_vertex_buffers vertex_buffers;
struct lvp_cmd_bind_index_buffer index_buffer;
struct lvp_cmd_draw draw;
struct lvp_cmd_draw_indexed draw_indexed;
struct lvp_cmd_draw_indirect draw_indirect;
struct lvp_cmd_dispatch dispatch;
struct lvp_cmd_dispatch_indirect dispatch_indirect;
struct lvp_cmd_copy_buffer copy_buffer;
struct lvp_cmd_copy_image copy_image;
struct lvp_cmd_blit_image blit_image;
struct lvp_cmd_copy_buffer_to_image buffer_to_img;
struct lvp_cmd_copy_image_to_buffer img_to_buffer;
struct lvp_cmd_update_buffer update_buffer;
struct lvp_cmd_fill_buffer fill_buffer;
struct lvp_cmd_clear_color_image clear_color_image;
struct lvp_cmd_clear_ds_image clear_ds_image;
struct lvp_cmd_clear_attachments clear_attachments;
struct lvp_cmd_resolve_image resolve_image;
struct lvp_cmd_event_set event_set;
struct lvp_cmd_wait_events wait_events;
struct lvp_cmd_pipeline_barrier pipeline_barrier;
struct lvp_cmd_query_cmd query;
struct lvp_cmd_copy_query_pool_results copy_query_pool_results;
struct lvp_cmd_push_constants push_constants;
struct lvp_cmd_begin_render_pass begin_render_pass;
struct lvp_cmd_next_subpass next_subpass;
struct lvp_cmd_execute_commands execute_commands;
struct lvp_cmd_draw_indirect_count draw_indirect_count;
struct lvp_cmd_push_descriptor_set push_descriptor_set;
struct lvp_cmd_bind_transform_feedback_buffers bind_transform_feedback_buffers;
struct lvp_cmd_begin_transform_feedback begin_transform_feedback;
struct lvp_cmd_end_transform_feedback end_transform_feedback;
struct lvp_cmd_draw_indirect_byte_count draw_indirect_byte_count;
struct lvp_cmd_begin_conditional_rendering begin_conditional_rendering;
struct lvp_cmd_set_vertex_input set_vertex_input;
struct lvp_cmd_set_cull_mode set_cull_mode;
struct lvp_cmd_set_front_face set_front_face;
struct lvp_cmd_set_primitive_topology set_primitive_topology;
struct lvp_cmd_set_depth_test_enable set_depth_test_enable;
struct lvp_cmd_set_depth_write_enable set_depth_write_enable;
struct lvp_cmd_set_depth_compare_op set_depth_compare_op;
struct lvp_cmd_set_depth_bounds_test_enable set_depth_bounds_test_enable;
struct lvp_cmd_set_stencil_test_enable set_stencil_test_enable;
struct lvp_cmd_set_stencil_op set_stencil_op;
struct lvp_cmd_set_line_stipple set_line_stipple;
struct lvp_cmd_set_depth_bias_enable set_depth_bias_enable;
struct lvp_cmd_set_logic_op set_logic_op;
struct lvp_cmd_set_patch_control_points set_patch_control_points;
struct lvp_cmd_set_primitive_restart_enable set_primitive_restart_enable;
struct lvp_cmd_set_rasterizer_discard_enable set_rasterizer_discard_enable;
struct lvp_cmd_set_color_write_enable set_color_write_enable;
} u;
};
VkResult lvp_execute_cmds(struct lvp_device *device,
struct lvp_queue *queue,
struct lvp_cmd_buffer *cmd_buffer);

View File

@ -10,6 +10,17 @@ lvp_entrypoints = custom_target(
depend_files : vk_entrypoints_gen_depend_files,
)
lvp_commands = custom_target(
'lvp_commands',
input : [vk_commands_gen, vk_api_xml],
output : ['lvp_commands.c'],
command : [
prog_python, '@INPUT0@', '--xml', '@INPUT1@',
'--out-c', '@OUTPUT0@', '--prefix', 'lvp',
],
depend_files : vk_commands_gen_depend_files,
)
liblvp_files = files(
'lvp_device.c',
'lvp_cmd_buffer.c',
@ -52,7 +63,7 @@ endif
liblavapipe_st = static_library(
'lavapipe_st',
[liblvp_files, lvp_entrypoints, sha1_h],
[liblvp_files, lvp_entrypoints, lvp_commands, sha1_h],
link_with : [ libvulkan_wsi ],
c_args : [ lvp_flags ],
gnu_symbol_visibility : 'hidden',