Turnstone Operating System
Loading...
Searching...
No Matches
virgl.h File Reference

Virgl header file. More...

#include <types.h>
#include <memory.h>
#include <cpu/sync.h>
#include <driver/video_virtio_cross_constants.h>

Classes

union  virgl_color_t
 
struct  virgl_box_t
 
struct  virgl_cmd_clear_t
 
struct  virgl_cmd_clear_texture_t
 
struct  virgl_obj_surface_t
 
struct  virgl_obj_framebuffer_state_t
 
struct  virgl_copy_region_t
 
struct  virgl_stream_output_t
 
struct  virgl_shader_t
 
struct  virgl_link_shader_t
 
struct  virgl_shader_buffer_element_t
 
struct  virgl_shader_buffer_t
 
struct  virgl_shader_image_t
 
struct  virgl_shader_images_t
 
struct  virgl_sampler_view_t
 
struct  virgl_sampler_views_t
 
struct  virgl_draw_info_t
 
struct  virgl_res_iw_t
 
struct  virgl_vertex_element_t
 
struct  virgl_vertex_t
 
struct  virgl_depth_state_t
 
struct  virgl_stencil_state_t
 
struct  virgl_alpha_state_t
 
struct  virgl_depth_stencil_alpha_state_t
 
struct  virgl_rt_blend_state_t
 
struct  virgl_blend_state_t
 
struct  virgl_rasterizer_state_t
 
struct  virgl_viewport_state_t
 
struct  virgl_vertex_buffer_t
 

Macros

#define ___VIRGL_H   0
 
#define VIRGL_RSTR(...)   #__VA_ARGS__
 
#define VIRGL_CMD(cmd, obj, len)   ((cmd) | ((obj) << 8) | ((len) << 16))
 
#define VIRGL_CMD_MAX_DWORDS   ((VIRTIO_GPU_QUEUE_ITEM_SIZE - VIRTIO_GPU_CMD_SUBMIT_3D_HEADER_SIZE) / sizeof(uint32_t))
 
#define VIRGL_CMD_CLEAR_CCMD_PAYLOAD_SIZE   (sizeof(virgl_cmd_clear_t) / sizeof(uint32_t))
 
#define VIRGL_CMD_CLEAR_TEXTURE_CCMD_PAYLOAD_SIZE   (12)
 
#define VIRGL_OBJ_SURFACE_TEXTURE_LAYERS(fl, ll)   (((ll) << 16) | (fl))
 
#define VIRGL_OBJ_SURFACE_CCMD_PAYLOAD_SIZE   (sizeof(virgl_obj_surface_t) / sizeof(uint32_t))
 
#define VIRGL_OBJ_FRAMEBUFFER_MAX_CBUFS   8
 
#define VIRGL_OBJ_FRAMEBUFFER_STATE_CCMD_PAYLOAD_SIZE(nr_cbufs)   (2 + (nr_cbufs))
 
#define VIRGL_COPY_REGION_CCMD_PAYLOAD_SIZE   (sizeof(virgl_copy_region_t) / sizeof(uint32_t))
 
#define VIRGL_SHADER_MAX_SO_OUTPUT_BUFFERS   4
 
#define VIRGL_SHADER_MAX_SO_OUTPUTS   64
 
#define VIRGL_ENCODE_SO_DECLARATION_RAW(register_index, start_component, num_components, output_buffer, dst_offset, stream)    (((register_index) << 0) | ((start_component) << 8) | ((num_components) << 16) | ((output_buffer) << 24) | ((dst_offset) << 28) | ((stream) << 31))
 
#define VIRGL_ENCODE_SO_DECLARATION(so)    VIRGL_ENCODE_SO_DECLARATION_RAW(so.register_index, so.start_component, so.num_components, so.output_buffer, so.dst_offset, so.stream)
 
#define VIRGL_OBJECT_SHADER_OFFSET_VAL(x)   (((x) & 0x7fffffff) << 0)
 
#define VIRGL_OBJECT_SHADER_OFFSET_CONT   (0x1u << 31)
 
#define VIRGL_LINK_SHADER_CCMD_PAYLOAD_SIZE   (6)
 
#define VIRGL_SET_UNIFORM_BUFFER_CCMD_PAYLOAD_SIZE   (5)
 
#define VIRGL_SHADER_BUFFER_MAX_ELEMENTS   16
 
#define VIRGL_SET_SHADER_BUFFERS_CCMD_PAYLOAD_SIZE(num_elements)   (2 + (num_elements * 3))
 
#define VIRGL_SHADER_IMAGE_MAX_IMAGES   16
 
#define VIRGL_SET_SHADER_IMAGES_CCMD_PAYLOAD_SIZE(num_elements)   (2 + (num_elements * 5))
 
#define VIRGL_SAMPLER_VIEW_OBJECT_ENCODE_SWIZZLE(r, g, b, a)   (((r) << 0) | ((g) << 3) | ((b) << 6) | ((a) << 9))
 
#define VIRGL_OBJ_SAMPLER_VIEW_CCMD_PAYLOAD_SIZE   6
 
#define VIRGL_SAMPLER_VIEWS_MAX_VIEWS   16
 
#define VIRGL_SET_SAMPLER_VIEWS_CCMD_PAYLOAD_SIZE(num_views)   (2 + (num_views))
 
#define VIRGL_DRAW_CCMD_PAYLOAD_SIZE   (12)
 
#define VIRGL_CREATE_VERTEX_ELEMENTS_CCMD_PAYLOAD_SIZE(num_elements)   (1 + (num_elements * 4))
 
#define VIRGL_OBJ_DSA_SIZE   5
 
#define VIRGL_OBJ_DSA_S0_DEPTH_ENABLE(x)   (((x) & 0x1) << 0)
 
#define VIRGL_OBJ_DSA_S0_DEPTH_WRITEMASK(x)   (((x) & 0x1) << 1)
 
#define VIRGL_OBJ_DSA_S0_DEPTH_FUNC(x)   (((x) & 0x7) << 2)
 
#define VIRGL_OBJ_DSA_S0_ALPHA_ENABLED(x)   (((x) & 0x1) << 8)
 
#define VIRGL_OBJ_DSA_S0_ALPHA_FUNC(x)   (((x) & 0x7) << 9)
 
#define VIRGL_OBJ_DSA_S1_STENCIL_ENABLED(x)   (((x) & 0x1) << 0)
 
#define VIRGL_OBJ_DSA_S1_STENCIL_FUNC(x)   (((x) & 0x7) << 1)
 
#define VIRGL_OBJ_DSA_S1_STENCIL_FAIL_OP(x)   (((x) & 0x7) << 4)
 
#define VIRGL_OBJ_DSA_S1_STENCIL_ZPASS_OP(x)   (((x) & 0x7) << 7)
 
#define VIRGL_OBJ_DSA_S1_STENCIL_ZFAIL_OP(x)   (((x) & 0x7) << 10)
 
#define VIRGL_OBJ_DSA_S1_STENCIL_VALUEMASK(x)   (((x) & 0xff) << 13)
 
#define VIRGL_OBJ_DSA_S1_STENCIL_WRITEMASK(x)   (((x) & 0xff) << 21)
 
#define VIRGL_BLEND_STATE_MAX_RT   8
 
#define VIRGL_OBJ_BLEND_SIZE   (VIRGL_BLEND_STATE_MAX_RT + 3)
 
#define VIRGL_OBJ_BLEND_S0_INDEPENDENT_BLEND_ENABLE(x)   ((x) & 0x1 << 0)
 
#define VIRGL_OBJ_BLEND_S0_LOGICOP_ENABLE(x)   (((x) & 0x1) << 1)
 
#define VIRGL_OBJ_BLEND_S0_DITHER(x)   (((x) & 0x1) << 2)
 
#define VIRGL_OBJ_BLEND_S0_ALPHA_TO_COVERAGE(x)   (((x) & 0x1) << 3)
 
#define VIRGL_OBJ_BLEND_S0_ALPHA_TO_ONE(x)   (((x) & 0x1) << 4)
 
#define VIRGL_OBJ_BLEND_S1_LOGICOP_FUNC(x)   (((x) & 0xf) << 0)
 
#define VIRGL_OBJ_BLEND_S2(cbuf)   (4 + (cbuf))
 
#define VIRGL_OBJ_BLEND_S2_RT_BLEND_ENABLE(x)   (((x) & 0x1) << 0)
 
#define VIRGL_OBJ_BLEND_S2_RT_RGB_FUNC(x)   (((x) & 0x7) << 1)
 
#define VIRGL_OBJ_BLEND_S2_RT_RGB_SRC_FACTOR(x)   (((x) & 0x1f) << 4)
 
#define VIRGL_OBJ_BLEND_S2_RT_RGB_DST_FACTOR(x)   (((x) & 0x1f) << 9)
 
#define VIRGL_OBJ_BLEND_S2_RT_ALPHA_FUNC(x)   (((x) & 0x7) << 14)
 
#define VIRGL_OBJ_BLEND_S2_RT_ALPHA_SRC_FACTOR(x)   (((x) & 0x1f) << 17)
 
#define VIRGL_OBJ_BLEND_S2_RT_ALPHA_DST_FACTOR(x)   (((x) & 0x1f) << 22)
 
#define VIRGL_OBJ_BLEND_S2_RT_COLORMASK(x)   (((x) & 0xf) << 27)
 
#define VIRGL_MAX_CLIP_PLANES   8
 
#define VIRGL_OBJ_RS_SIZE   9
 
#define VIRGL_OBJ_RS_S0_FLATSHADE(x)   (((x) & 0x1) << 0)
 
#define VIRGL_OBJ_RS_S0_DEPTH_CLIP(x)   (((x) & 0x1) << 1)
 
#define VIRGL_OBJ_RS_S0_CLIP_HALFZ(x)   (((x) & 0x1) << 2)
 
#define VIRGL_OBJ_RS_S0_RASTERIZER_DISCARD(x)   (((x) & 0x1) << 3)
 
#define VIRGL_OBJ_RS_S0_FLATSHADE_FIRST(x)   (((x) & 0x1) << 4)
 
#define VIRGL_OBJ_RS_S0_LIGHT_TWOSIZE(x)   (((x) & 0x1) << 5)
 
#define VIRGL_OBJ_RS_S0_SPRITE_COORD_MODE(x)   (((x) & 0x1) << 6)
 
#define VIRGL_OBJ_RS_S0_POINT_QUAD_RASTERIZATION(x)   (((x) & 0x1) << 7)
 
#define VIRGL_OBJ_RS_S0_CULL_FACE(x)   (((x) & 0x3) << 8)
 
#define VIRGL_OBJ_RS_S0_FILL_FRONT(x)   (((x) & 0x3) << 10)
 
#define VIRGL_OBJ_RS_S0_FILL_BACK(x)   (((x) & 0x3) << 12)
 
#define VIRGL_OBJ_RS_S0_SCISSOR(x)   (((x) & 0x1) << 14)
 
#define VIRGL_OBJ_RS_S0_FRONT_CCW(x)   (((x) & 0x1) << 15)
 
#define VIRGL_OBJ_RS_S0_CLAMP_VERTEX_COLOR(x)   (((x) & 0x1) << 16)
 
#define VIRGL_OBJ_RS_S0_CLAMP_FRAGMENT_COLOR(x)   (((x) & 0x1) << 17)
 
#define VIRGL_OBJ_RS_S0_OFFSET_LINE(x)   (((x) & 0x1) << 18)
 
#define VIRGL_OBJ_RS_S0_OFFSET_POINT(x)   (((x) & 0x1) << 19)
 
#define VIRGL_OBJ_RS_S0_OFFSET_TRI(x)   (((x) & 0x1) << 20)
 
#define VIRGL_OBJ_RS_S0_POLY_SMOOTH(x)   (((x) & 0x1) << 21)
 
#define VIRGL_OBJ_RS_S0_POLY_STIPPLE_ENABLE(x)   (((x) & 0x1) << 22)
 
#define VIRGL_OBJ_RS_S0_POINT_SMOOTH(x)   (((x) & 0x1) << 23)
 
#define VIRGL_OBJ_RS_S0_POINT_SIZE_PER_VERTEX(x)   (((x) & 0x1) << 24)
 
#define VIRGL_OBJ_RS_S0_MULTISAMPLE(x)   (((x) & 0x1) << 25)
 
#define VIRGL_OBJ_RS_S0_LINE_SMOOTH(x)   (((x) & 0x1) << 26)
 
#define VIRGL_OBJ_RS_S0_LINE_STIPPLE_ENABLE(x)   (((x) & 0x1) << 27)
 
#define VIRGL_OBJ_RS_S0_LINE_LAST_PIXEL(x)   (((x) & 0x1) << 28)
 
#define VIRGL_OBJ_RS_S0_HALF_PIXEL_CENTER(x)   (((x) & 0x1) << 29)
 
#define VIRGL_OBJ_RS_S0_BOTTOM_EDGE_RULE(x)   (((x) & 0x1) << 30)
 
#define VIRGL_OBJ_RS_S0_FORCE_PERSAMPLE_INTERP(x)   (((x) & 0x1) << 31)
 
#define VIRGL_OBJ_RS_S3_LINE_STIPPLE_PATTERN(x)   (((x) & 0xffff) << 0)
 
#define VIRGL_OBJ_RS_S3_LINE_STIPPLE_FACTOR(x)   (((x) & 0xff) << 16)
 
#define VIRGL_OBJ_RS_S3_CLIP_PLANE_ENABLE(x)   (((x) & 0xff) << 24)
 
#define VIRGL_SET_VIEWPORT_STATE_CCMD_PAYLOAD_SIZE(num_viewports)   ((6 * num_viewports) + 1)
 
#define VIRGL_MAX_VERTEX_BUFFERS   16
 
#define VIRGL_SET_VERTEX_BUFFERS_CCMD_PAYLOAD_SIZE(num_buffers)   ((num_buffers * 3))
 

Typedefs

typedef enum virgl_format_t virgl_format_t
 
typedef enum virgl_object_type_t virgl_object_type_t
 
typedef enum virgl_context_cmd_t virgl_context_cmd_t
 
typedef enum virgl_texture_target_t virgl_texture_target_t
 
typedef enum virgl_bind_t virgl_bind_t
 
typedef union virgl_color_t virgl_color_t
 
typedef struct virgl_box_t virgl_box_t
 
typedef enum virgl_clear_flags_t virgl_clear_flags_t
 
typedef struct virgl_cmd_clear_t virgl_cmd_clear_t
 
typedef struct virgl_cmd_clear_texture_t virgl_cmd_clear_texture_t
 
typedef struct virgl_obj_surface_t virgl_obj_surface_t
 
typedef struct virgl_obj_framebuffer_state_t virgl_obj_framebuffer_state_t
 
typedef struct virgl_copy_region_t virgl_copy_region_t
 
typedef enum virgl_shader_type_t virgl_shader_type_t
 
typedef struct virgl_stream_output_t virgl_stream_output_t
 
typedef struct virgl_shader_t virgl_shader_t
 
typedef struct virgl_link_shader_t virgl_link_shader_t
 
typedef struct virgl_shader_buffer_element_t virgl_shader_buffer_element_t
 
typedef struct virgl_shader_buffer_t virgl_shader_buffer_t
 
typedef enum virgl_access_type_t virgl_access_type_t
 
typedef struct virgl_shader_image_t virgl_shader_image_t
 
typedef struct virgl_shader_images_t virgl_shader_images_t
 
typedef struct virgl_sampler_view_t virgl_sampler_view_t
 
typedef struct virgl_sampler_views_t virgl_sampler_views_t
 
typedef enum virgl_prim_type_t virgl_prim_type_t
 
typedef struct virgl_draw_info_t virgl_draw_info_t
 
typedef enum virgl_resource_usage_t virgl_resource_usage_t
 
typedef struct virgl_res_iw_t virgl_res_iw_t
 
typedef struct virgl_vertex_element_t virgl_vertex_element_t
 
typedef struct virgl_vertex_t virgl_vertex_t
 
typedef enum virgl_logicop_t virgl_logicop_t
 
typedef enum virgl_mask_t virgl_mask_t
 
typedef enum virgl_compare_func_t virgl_compare_func_t
 
typedef enum virgl_stencil_op_t virgl_stencil_op_t
 
typedef struct virgl_depth_state_t virgl_depth_state_t
 
typedef struct virgl_stencil_state_t virgl_stencil_state_t
 
typedef struct virgl_alpha_state_t virgl_alpha_state_t
 
typedef struct virgl_depth_stencil_alpha_state_t virgl_depth_stencil_alpha_state_t
 
typedef enum virgl_blend_factor_t virgl_blend_factor_t
 
typedef enum virgl_blend_func_t virgl_blend_func_t
 
typedef struct virgl_rt_blend_state_t virgl_rt_blend_state_t
 
typedef struct virgl_blend_state_t virgl_blend_state_t
 
typedef enum virgl_polygon_mode_t virgl_polygon_mode_t
 
typedef enum virgl_face_t virgl_face_t
 
typedef struct virgl_rasterizer_state_t virgl_rasterizer_state_t
 
typedef struct virgl_viewport_state_t virgl_viewport_state_t
 
typedef struct virgl_vertex_buffer_t virgl_vertex_buffer_t
 
typedef struct virgl_cmd_t virgl_cmd_t
 
typedef struct virgl_renderer_t virgl_renderer_t
 
typedef uint8_t *(* virgl_get_buffer_f) (uint32_t queue_no, uint16_t *desc_index)
 
typedef int8_t(* virgl_send_cmd_f) (uint32_t queue_no, lock_t **lock, uint32_t fence_id, virgl_cmd_t *cmd)
 

Enumerations

enum  virgl_format_t {
  VIRGL_FORMAT_B8G8R8A8_UNORM = 1 , VIRGL_FORMAT_B8G8R8X8_UNORM = 2 , VIRGL_FORMAT_A8R8G8B8_UNORM = 3 , VIRGL_FORMAT_X8R8G8B8_UNORM = 4 ,
  VIRGL_FORMAT_R32G32B32A32_FLOAT = 31 , VIRGL_FORMAT_R32G32B32A32_UNORM = 35 , VIRGL_FORMAT_R8_UNORM = 64 , VIRGL_FORMAT_R8G8B8A8_UNORM = 67 ,
  VIRGL_FORMAT_X8B8G8R8_UNORM = 68 , VIRGL_FORMAT_A8B8G8R8_UNORM = 121 , VIRGL_FORMAT_R8G8B8X8_UNORM = 134
}
 
enum  virgl_object_type_t {
  VIRGL_OBJECT_NULL , VIRGL_OBJECT_BLEND , VIRGL_OBJECT_RASTERIZER , VIRGL_OBJECT_DSA ,
  VIRGL_OBJECT_SHADER , VIRGL_OBJECT_VERTEX_ELEMENTS , VIRGL_OBJECT_SAMPLER_VIEW , VIRGL_OBJECT_SAMPLER_STATE ,
  VIRGL_OBJECT_SURFACE , VIRGL_OBJECT_QUERY , VIRGL_OBJECT_STREAMOUT_TARGET , VIRGL_OBJECT_MSAA_SURFACE ,
  VIRGL_MAX_OBJECTS
}
 
enum  virgl_context_cmd_t {
  VIRGL_CCMD_NOP = 0 , VIRGL_CCMD_CREATE_OBJECT = 1 , VIRGL_CCMD_BIND_OBJECT , VIRGL_CCMD_DESTROY_OBJECT ,
  VIRGL_CCMD_SET_VIEWPORT_STATE , VIRGL_CCMD_SET_FRAMEBUFFER_STATE , VIRGL_CCMD_SET_VERTEX_BUFFERS , VIRGL_CCMD_CLEAR ,
  VIRGL_CCMD_DRAW_VBO , VIRGL_CCMD_RESOURCE_INLINE_WRITE , VIRGL_CCMD_SET_SAMPLER_VIEWS , VIRGL_CCMD_SET_INDEX_BUFFER ,
  VIRGL_CCMD_SET_CONSTANT_BUFFER , VIRGL_CCMD_SET_STENCIL_REF , VIRGL_CCMD_SET_BLEND_COLOR , VIRGL_CCMD_SET_SCISSOR_STATE ,
  VIRGL_CCMD_BLIT , VIRGL_CCMD_RESOURCE_COPY_REGION , VIRGL_CCMD_BIND_SAMPLER_STATES , VIRGL_CCMD_BEGIN_QUERY ,
  VIRGL_CCMD_END_QUERY , VIRGL_CCMD_GET_QUERY_RESULT , VIRGL_CCMD_SET_POLYGON_STIPPLE , VIRGL_CCMD_SET_CLIP_STATE ,
  VIRGL_CCMD_SET_SAMPLE_MASK , VIRGL_CCMD_SET_STREAMOUT_TARGETS , VIRGL_CCMD_SET_RENDER_CONDITION , VIRGL_CCMD_SET_UNIFORM_BUFFER ,
  VIRGL_CCMD_SET_SUB_CTX , VIRGL_CCMD_CREATE_SUB_CTX , VIRGL_CCMD_DESTROY_SUB_CTX , VIRGL_CCMD_BIND_SHADER ,
  VIRGL_CCMD_SET_TESS_STATE , VIRGL_CCMD_SET_MIN_SAMPLES , VIRGL_CCMD_SET_SHADER_BUFFERS , VIRGL_CCMD_SET_SHADER_IMAGES ,
  VIRGL_CCMD_MEMORY_BARRIER , VIRGL_CCMD_LAUNCH_GRID , VIRGL_CCMD_SET_FRAMEBUFFER_STATE_NO_ATTACH , VIRGL_CCMD_TEXTURE_BARRIER ,
  VIRGL_CCMD_SET_ATOMIC_BUFFERS , VIRGL_CCMD_SET_DEBUG_FLAGS , VIRGL_CCMD_GET_QUERY_RESULT_QBO , VIRGL_CCMD_TRANSFER3D ,
  VIRGL_CCMD_END_TRANSFERS , VIRGL_CCMD_COPY_TRANSFER3D , VIRGL_CCMD_SET_TWEAKS , VIRGL_CCMD_CLEAR_TEXTURE ,
  VIRGL_CCMD_PIPE_RESOURCE_CREATE , VIRGL_CCMD_PIPE_RESOURCE_SET_TYPE , VIRGL_CCMD_GET_MEMORY_INFO , VIRGL_CCMD_SEND_STRING_MARKER ,
  VIRGL_CCMD_LINK_SHADER , VIRGL_CCMD_CREATE_VIDEO_CODEC , VIRGL_CCMD_DESTROY_VIDEO_CODEC , VIRGL_CCMD_CREATE_VIDEO_BUFFER ,
  VIRGL_CCMD_DESTROY_VIDEO_BUFFER , VIRGL_CCMD_BEGIN_FRAME , VIRGL_CCMD_DECODE_MACROBLOCK , VIRGL_CCMD_DECODE_BITSTREAM ,
  VIRGL_CCMD_ENCODE_BITSTREAM , VIRGL_CCMD_END_FRAME , VIRGL_CCMD_CLEAR_SURFACE , VIRGL_MAX_COMMANDS
}
 
enum  virgl_texture_target_t {
  VIRGL_TEXTURE_TARGET_BUFFER = 0 , VIRGL_TEXTURE_TARGET_1D , VIRGL_TEXTURE_TARGET_2D , VIRGL_TEXTURE_TARGET_3D ,
  VIRGL_TEXTURE_TARGET_CUBE , VIRGL_TEXTURE_TARGET_RECT , VIRGL_TEXTURE_TARGET_1D_ARRAY , VIRGL_TEXTURE_TARGET_2D_ARRAY ,
  VIRGL_TEXTURE_TARGET_CUBE_ARRAY , VIRGL_TEXTURE_TARGET_2D_MSAA , VIRGL_TEXTURE_TARGET_2D_MSAA_ARRAY , VIRGL_TEXTURE_TARGET_3D_MSAA ,
  VIRGL_TEXTURE_TARGET_MAX
}
 
enum  virgl_bind_t {
  VIRGL_BIND_DEPTH_STENCIL = (1 << 0) , VIRGL_BIND_RENDER_TARGET = (1 << 1) , VIRGL_BIND_BLENDABLE = (1 << 2) , VIRGL_BIND_SAMPLER_VIEW = (1 << 3) ,
  VIRGL_BIND_VERTEX_BUFFER = (1 << 4) , VIRGL_BIND_INDEX_BUFFER = (1 << 5) , VIRGL_BIND_CONSTANT_BUFFER = (1 << 6) , VIRGL_BIND_DISPLAY_TARGET = (1 << 8) ,
  VIRGL_BIND_TRANSFER_WRITE = (1 << 9) , VIRGL_BIND_TRANSFER_READ = (1 << 10) , VIRGL_BIND_STREAM_OUTPUT = (1 << 11) , VIRGL_BIND_SCANOUT = (1 << 14) ,
  VIRGL_BIND_SHARED = (1 << 15) , VIRGL_BIND_CURSOR = (1 << 16) , VIRGL_BIND_CUSTOM = (1 << 17) , VIRGL_BIND_GLOBAL = (1 << 18) ,
  VIRGL_BIND_SHADER_RESOURCE = (1 << 19) , VIRGL_BIND_COMPUTE_RESOURCE = (1 << 20) , VIRGL_BIND_COMMAND_ARGS_BUFFER = (1 << 21) , VIRGL_BIND_LINEAR = (1 << 21) ,
  VIRGL_BIND_QUERY_BUFFER = (1 << 22)
}
 
enum  virgl_clear_flags_t {
  VIRGL_CLEAR_FLAG_CLEAR_DEPTH = (1 << 0) , VIRGL_CLEAR_FLAG_CLEAR_STENCIL = (1 << 1) , VIRGL_CLEAR_FLAG_CLEAR_COLOR0 = (1 << 2) , VIRGL_CLEAR_FLAG_CLEAR_COLOR1 = (1 << 3) ,
  VIRGL_CLEAR_FLAG_CLEAR_COLOR2 = (1 << 4) , VIRGL_CLEAR_FLAG_CLEAR_COLOR3 = (1 << 5) , VIRGL_CLEAR_FLAG_CLEAR_COLOR4 = (1 << 6) , VIRGL_CLEAR_FLAG_CLEAR_COLOR5 = (1 << 7) ,
  VIRGL_CLEAR_FLAG_CLEAR_COLOR6 = (1 << 8) , VIRGL_CLEAR_FLAG_CLEAR_COLOR7 = (1 << 9) , VIRGL_CLEAR_FLAG_CLEAR_ALL_COLORS , VIRGL_CLEAR_FLAG_CLEAR_DEPTH_STENCIL = (VIRGL_CLEAR_FLAG_CLEAR_DEPTH | VIRGL_CLEAR_FLAG_CLEAR_STENCIL)
}
 
enum  virgl_shader_type_t {
  VIRGL_SHADER_TYPE_VERTEX , VIRGL_SHADER_TYPE_FRAGMENT , VIRGL_SHADER_TYPE_GEOMETRY , VIRGL_SHADER_TYPE_TESS_CTRL ,
  VIRGL_SHADER_TYPE_TESS_EVAL , VIRGL_SHADER_TYPE_COMPUTE , VIRGL_SHADER_TYPE_TYPES , VIRGL_SHADER_TYPE_INVALID
}
 
enum  virgl_access_type_t { VIRGL_ACCESS_TYPE_READ = 1 , VIRGL_ACCESS_TYPE_WRITE = 2 , VIRGL_ACCESS_TYPE_READ_WRITE = 3 }
 
enum  virgl_prim_type_t {
  VIRGL_PRIM_POINTS , VIRGL_PRIM_LINES , VIRGL_PRIM_LINE_LOOP , VIRGL_PRIM_LINE_STRIP ,
  VIRGL_PRIM_TRIANGLES , VIRGL_PRIM_TRIANGLE_STRIP , VIRGL_PRIM_TRIANGLE_FAN , VIRGL_PRIM_QUADS ,
  VIRGL_PRIM_QUAD_STRIP , VIRGL_PRIM_POLYGON , VIRGL_PRIM_LINES_ADJACENCY , VIRGL_PRIM_LINE_STRIP_ADJACENCY ,
  VIRGL_PRIM_TRIANGLES_ADJACENCY , VIRGL_PRIM_TRIANGLE_STRIP_ADJACENCY , VIRGL_PRIM_PATCHES
}
 
enum  virgl_resource_usage_t {
  VIRGL_RESOURCE_USAGE_DEFAULT , VIRGL_RESOURCE_USAGE_IMMUTABLE , VIRGL_RESOURCE_USAGE_DYNAMIC , VIRGL_RESOURCE_USAGE_STREAM ,
  VIRGL_RESOURCE_USAGE_STAGING
}
 
enum  virgl_logicop_t {
  VIRGL_LOGICOP_CLEAR , VIRGL_LOGICOP_NOR , VIRGL_LOGICOP_AND_INVERTED , VIRGL_LOGICOP_COPY_INVERTED ,
  VIRGL_LOGICOP_AND_REVERSE , VIRGL_LOGICOP_INVERT , VIRGL_LOGICOP_XOR , VIRGL_LOGICOP_NAND ,
  VIRGL_LOGICOP_AND , VIRGL_LOGICOP_EQUIV , VIRGL_LOGICOP_NOOP , VIRGL_LOGICOP_OR_INVERTED ,
  VIRGL_LOGICOP_COPY , VIRGL_LOGICOP_OR_REVERSE , VIRGL_LOGICOP_OR , VIRGL_LOGICOP_SET
}
 
enum  virgl_mask_t {
  VIRGL_MASK_R = 0x1 , VIRGL_MASK_G = 0x2 , VIRGL_MASK_B = 0x4 , VIRGL_MASK_A = 0x8 ,
  VIRGL_MASK_RGBA = 0xf , VIRGL_MASK_Z = 0x10 , VIRGL_MASK_S = 0x20 , VIRGL_MASK_ZS = 0x30 ,
  VIRGL_MASK_RGBAZS = (VIRGL_MASK_RGBA | VIRGL_MASK_ZS)
}
 
enum  virgl_compare_func_t {
  VIRGL_FUNC_NEVER , VIRGL_FUNC_LESS , VIRGL_FUNC_EQUAL , VIRGL_FUNC_LEQUAL ,
  VIRGL_FUNC_GREATER , VIRGL_FUNC_NOTEQUAL , VIRGL_FUNC_GEQUAL , VIRGL_FUNC_ALWAYS
}
 
enum  virgl_stencil_op_t {
  VIRGL_STENCIL_OP_KEEP , VIRGL_STENCIL_OP_ZERO , VIRGL_STENCIL_OP_REPLACE , VIRGL_STENCIL_OP_INCR ,
  VIRGL_STENCIL_OP_DECR , VIRGL_STENCIL_OP_INCR_WRAP , VIRGL_STENCIL_OP_DECR_WRAP , VIRGL_STENCIL_OP_INVERT
}
 
enum  virgl_blend_factor_t {
  VIRGL_BLEND_FACTOR_ONE = 1 , VIRGL_BLEND_FACTOR_SRC_COLOR , VIRGL_BLEND_FACTOR_SRC_ALPHA , VIRGL_BLEND_FACTOR_DST_ALPHA ,
  VIRGL_BLEND_FACTOR_DST_COLOR , VIRGL_BLEND_FACTOR_SRC_ALPHA_SATURATE , VIRGL_BLEND_FACTOR_CONST_COLOR , VIRGL_BLEND_FACTOR_CONST_ALPHA ,
  VIRGL_BLEND_FACTOR_SRC1_COLOR , VIRGL_BLEND_FACTOR_SRC1_ALPHA , VIRGL_BLEND_FACTOR_ZERO = 0x11 , VIRGL_BLEND_FACTOR_INV_SRC_COLOR ,
  VIRGL_BLEND_FACTOR_INV_SRC_ALPHA , VIRGL_BLEND_FACTOR_INV_DST_ALPHA , VIRGL_BLEND_FACTOR_INV_DST_COLOR , VIRGL_BLEND_FACTOR_INV_CONST_COLOR = 0x17 ,
  VIRGL_BLEND_FACTOR_INV_CONST_ALPHA , VIRGL_BLEND_FACTOR_INV_SRC1_COLOR , VIRGL_BLEND_FACTOR_INV_SRC1_ALPHA
}
 
enum  virgl_blend_func_t {
  VIRGL_BLEND_ADD , VIRGL_BLEND_SUBTRACT , VIRGL_BLEND_REVERSE_SUBTRACT , VIRGL_BLEND_MIN ,
  VIRGL_BLEND_MAX
}
 
enum  virgl_polygon_mode_t { VIRGL_POLYGON_MODE_FILL , VIRGL_POLYGON_MODE_LINE , VIRGL_POLYGON_MODE_POINT }
 
enum  virgl_face_t { VIRGL_FACE_NONE = 0 , VIRGL_FACE_FRONT = 1 , VIRGL_FACE_BACK = 2 , VIRGL_FACE_FRONT_AND_BACK = (VIRGL_FACE_FRONT | VIRGL_FACE_BACK) }
 

Functions

 _Static_assert (sizeof(virgl_color_t)==16, "virgl_color_t size is not 16 bytes")
 
 _Static_assert (sizeof(virgl_cmd_clear_t)==32, "virgl_cmd_clear_t size is not 24 bytes")
 
 _Static_assert (sizeof(virgl_cmd_clear_texture_t)==12 *sizeof(uint32_t), "virgl_cmd_clear_texture_t size is not 48 bytes")
 
 _Static_assert (sizeof(virgl_obj_surface_t)==5 *sizeof(uint32_t), "virgl_obj_surface_t size is not 20 bytes")
 
 _Static_assert (sizeof(virgl_copy_region_t)==13 *sizeof(uint32_t), "virgl_copy_region_t size is not 52 bytes")
 
 _Static_assert (sizeof(virgl_vertex_t)==8 *sizeof(float32_t), "virgl_vertex_t size is not 32 bytes")
 
virgl_renderer_tvirgl_renderer_create (memory_heap_t *heap, uint32_t context_id, uint16_t queue_no, lock_t **lock, uint64_t *fence_id, virgl_get_buffer_f get_buffer, virgl_send_cmd_f send_cmd)
 
uint32_t virgl_renderer_get_next_resource_id (virgl_renderer_t *renderer)
 
memory_heap_tvirgl_renderer_get_heap (virgl_renderer_t *renderer)
 
virgl_cmd_tvirgl_renderer_get_cmd (virgl_renderer_t *renderer)
 
uint32_t virgl_cmd_get_context_id (virgl_cmd_t *cmd)
 
uint32_t virgl_cmd_get_size (virgl_cmd_t *cmd)
 
uint8_tvirgl_cmd_get_offset_and_desc_index (virgl_cmd_t *cmd, uint16_t *desc_index)
 
int8_t virgl_cmd_flush_commands (virgl_cmd_t *cmd)
 
int8_t virgl_encode_clear (virgl_cmd_t *cmd, virgl_cmd_clear_t *clear)
 
int8_t virgl_encode_clear_texture (virgl_cmd_t *cmd, virgl_cmd_clear_texture_t *clear_texture)
 
int8_t virgl_encode_surface (virgl_cmd_t *cmd, virgl_obj_surface_t *surface, boolean_t is_texture)
 
int8_t virgl_encode_framebuffer_state (virgl_cmd_t *cmd, virgl_obj_framebuffer_state_t *fb_state)
 
int8_t virgl_encode_copy_region (virgl_cmd_t *cmd, virgl_copy_region_t *copy_region)
 
int8_t virgl_encode_shader (virgl_cmd_t *cmd, virgl_shader_t *shader)
 
int8_t virgl_encode_bind_shader (virgl_cmd_t *cmd, uint32_t handle, uint32_t type)
 
int8_t virgl_encode_link_shader (virgl_cmd_t *cmd, virgl_link_shader_t *link_shader)
 
int8_t virgl_encode_set_uniform_buffer (virgl_cmd_t *cmd, uint32_t shader, uint32_t index, uint32_t offset, uint32_t length, uint32_t res)
 
int8_t virgl_encode_set_shader_buffers (virgl_cmd_t *cmd, virgl_shader_buffer_t *shader_buffer)
 
int8_t virgl_encode_set_shader_images (virgl_cmd_t *cmd, virgl_shader_images_t *shader_images)
 
int8_t virgl_encode_sampler_view (virgl_cmd_t *cmd, virgl_sampler_view_t *sampler_view, boolean_t is_texture)
 
int8_t virgl_encode_sampler_views (virgl_cmd_t *cmd, virgl_sampler_views_t *sample_views)
 
int8_t virgl_encode_draw_vbo (virgl_cmd_t *cmd, virgl_draw_info_t *draw_info)
 
int8_t virgl_encode_inline_write (virgl_cmd_t *cmd, virgl_res_iw_t *res_iw, const void *data)
 
int8_t virgl_encode_bind_object (virgl_cmd_t *cmd, virgl_object_type_t object_type, uint32_t object_id)
 
int8_t virgl_encode_create_vertex_elements (virgl_cmd_t *cmd, uint32_t handle, uint32_t num_elements, const virgl_vertex_element_t *element)
 
int8_t virgl_encode_blend_state (virgl_cmd_t *cmd, uint32_t handle, virgl_blend_state_t *blend_state)
 
int8_t virgl_encode_dsa_state (virgl_cmd_t *cmd, uint32_t handle, virgl_depth_stencil_alpha_state_t *dsa_state)
 
int8_t virgl_encode_rasterizer_state (virgl_cmd_t *cmd, uint32_t handle, virgl_rasterizer_state_t *rasterizer_state)
 
int8_t virgl_encode_set_viewport_states (virgl_cmd_t *cmd, int32_t start_slot, int num_viewports, const virgl_viewport_state_t *states)
 
int8_t virgl_encode_set_vertex_buffers (virgl_cmd_t *cmd, virgl_vertex_buffer_t *buffers)
 

Detailed Description

Virgl header file.

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.