#[cfg(feature = "virgl_renderer")]
#[link(name = "virglrenderer")]
extern "C" {}
pub const VIRGL_RENDERER_CALLBACKS_VERSION: u32 = 4;
pub const VIRGL_RENDERER_USE_EGL: u32 = 1;
pub const VIRGL_RENDERER_THREAD_SYNC: u32 = 2;
pub const VIRGL_RENDERER_USE_GLX: u32 = 4;
pub const VIRGL_RENDERER_USE_SURFACELESS: u32 = 8;
pub const VIRGL_RENDERER_USE_GLES: u32 = 16;
pub const VIRGL_RENDERER_USE_EXTERNAL_BLOB: u32 = 32;
pub const VIRGL_RENDERER_VENUS: u32 = 64;
pub const VIRGL_RENDERER_NO_VIRGL: u32 = 128;
pub const VIRGL_RENDERER_ASYNC_FENCE_CB: u32 = 256;
pub const VIRGL_RENDERER_RENDER_SERVER: u32 = 512;
pub const VIRGL_RENDERER_DRM: u32 = 1024;
pub const VIRGL_RENDERER_USE_VIDEO: u32 = 2048;
pub const VIRGL_RENDERER_D3D11_SHARE_TEXTURE: u32 = 4096;
pub const VIRGL_RENDERER_COMPAT_PROFILE: u32 = 8192;
pub const VIRGL_RES_BIND_DEPTH_STENCIL: u32 = 1;
pub const VIRGL_RES_BIND_RENDER_TARGET: u32 = 2;
pub const VIRGL_RES_BIND_SAMPLER_VIEW: u32 = 8;
pub const VIRGL_RES_BIND_VERTEX_BUFFER: u32 = 16;
pub const VIRGL_RES_BIND_INDEX_BUFFER: u32 = 32;
pub const VIRGL_RES_BIND_CONSTANT_BUFFER: u32 = 64;
pub const VIRGL_RES_BIND_STREAM_OUTPUT: u32 = 2048;
pub const VIRGL_RES_BIND_CURSOR: u32 = 65536;
pub const VIRGL_RES_BIND_CUSTOM: u32 = 131072;
pub const VIRGL_RES_BIND_SCANOUT: u32 = 262144;
pub const VIRGL_RES_BIND_SHARED: u32 = 1048576;
pub const VIRGL_RENDERER_RESOURCE_INFO_EXT_VERSION: u32 = 0;
pub const VIRGL_RENDERER_CONTEXT_FLAG_CAPSET_ID_MASK: u32 = 255;
pub const VIRGL_RENDERER_BLOB_MEM_GUEST: u32 = 1;
pub const VIRGL_RENDERER_BLOB_MEM_HOST3D: u32 = 2;
pub const VIRGL_RENDERER_BLOB_MEM_HOST3D_GUEST: u32 = 3;
pub const VIRGL_RENDERER_BLOB_MEM_GUEST_VRAM: u32 = 4;
pub const VIRGL_RENDERER_BLOB_FLAG_USE_MAPPABLE: u32 = 1;
pub const VIRGL_RENDERER_BLOB_FLAG_USE_SHAREABLE: u32 = 2;
pub const VIRGL_RENDERER_BLOB_FLAG_USE_CROSS_DEVICE: u32 = 4;
pub const VIRGL_RENDERER_BLOB_FLAG_USE_DUMB_BUFFER: u32 = 8;
pub const VIRGL_RENDERER_MAP_CACHE_MASK: u32 = 15;
pub const VIRGL_RENDERER_MAP_CACHE_NONE: u32 = 0;
pub const VIRGL_RENDERER_MAP_CACHE_CACHED: u32 = 1;
pub const VIRGL_RENDERER_MAP_CACHE_UNCACHED: u32 = 2;
pub const VIRGL_RENDERER_MAP_CACHE_WC: u32 = 3;
pub const VIRGL_RENDERER_BLOB_FD_TYPE_DMABUF: u32 = 1;
pub const VIRGL_RENDERER_BLOB_FD_TYPE_OPAQUE: u32 = 2;
pub const VIRGL_RENDERER_BLOB_FD_TYPE_SHM: u32 = 3;
pub const VIRGL_RENDERER_FENCE_FLAG_MERGEABLE: u32 = 1;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct virgl_box {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct iovec {
_unused: [u8; 0],
}
pub type virgl_renderer_gl_context = *mut ::std::os::raw::c_void;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct virgl_renderer_gl_ctx_param {
pub version: ::std::os::raw::c_int,
pub shared: bool,
pub major_ver: ::std::os::raw::c_int,
pub minor_ver: ::std::os::raw::c_int,
pub compat_ctx: ::std::os::raw::c_int,
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct virgl_renderer_callbacks {
pub version: ::std::os::raw::c_int,
pub write_fence: ::std::option::Option<
unsafe extern "C" fn(cookie: *mut ::std::os::raw::c_void, fence: u32),
>,
pub create_gl_context: ::std::option::Option<
unsafe extern "C" fn(
cookie: *mut ::std::os::raw::c_void,
scanout_idx: ::std::os::raw::c_int,
param: *mut virgl_renderer_gl_ctx_param,
) -> virgl_renderer_gl_context,
>,
pub destroy_gl_context: ::std::option::Option<
unsafe extern "C" fn(cookie: *mut ::std::os::raw::c_void, ctx: virgl_renderer_gl_context),
>,
pub make_current: ::std::option::Option<
unsafe extern "C" fn(
cookie: *mut ::std::os::raw::c_void,
scanout_idx: ::std::os::raw::c_int,
ctx: virgl_renderer_gl_context,
) -> ::std::os::raw::c_int,
>,
pub get_drm_fd: ::std::option::Option<
unsafe extern "C" fn(cookie: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int,
>,
pub write_context_fence: ::std::option::Option<
unsafe extern "C" fn(
cookie: *mut ::std::os::raw::c_void,
ctx_id: u32,
ring_idx: u32,
fence_id: u64,
),
>,
pub get_server_fd: ::std::option::Option<
unsafe extern "C" fn(
cookie: *mut ::std::os::raw::c_void,
version: u32,
) -> ::std::os::raw::c_int,
>,
pub get_egl_display: ::std::option::Option<
unsafe extern "C" fn(cookie: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void,
>,
}
extern "C" {
pub fn virgl_renderer_init(
cookie: *mut ::std::os::raw::c_void,
flags: ::std::os::raw::c_int,
cb: *mut virgl_renderer_callbacks,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_poll();
}
extern "C" {
pub fn virgl_renderer_get_cursor_data(
resource_id: u32,
width: *mut u32,
height: *mut u32,
) -> *mut ::std::os::raw::c_void;
}
extern "C" {
pub fn virgl_renderer_get_rect(
resource_id: ::std::os::raw::c_int,
iov: *mut iovec,
num_iovs: ::std::os::raw::c_uint,
offset: u32,
x: ::std::os::raw::c_int,
y: ::std::os::raw::c_int,
width: ::std::os::raw::c_int,
height: ::std::os::raw::c_int,
);
}
extern "C" {
pub fn virgl_renderer_get_fd_for_texture(
tex_id: u32,
fd: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_get_fd_for_texture2(
tex_id: u32,
fd: *mut ::std::os::raw::c_int,
stride: *mut ::std::os::raw::c_int,
offset: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
pub const VIRGL_RENDERER_STRUCTURE_TYPE_NONE: virgl_renderer_structure_type_v0 = 0;
pub const VIRGL_RENDERER_STRUCTURE_TYPE_EXPORT_QUERY: virgl_renderer_structure_type_v0 = 1;
pub const VIRGL_RENDERER_STRUCTURE_TYPE_SUPPORTED_STRUCTURES: virgl_renderer_structure_type_v0 = 2;
pub type virgl_renderer_structure_type_v0 = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct virgl_renderer_resource_create_args {
pub handle: u32,
pub target: u32,
pub format: u32,
pub bind: u32,
pub width: u32,
pub height: u32,
pub depth: u32,
pub array_size: u32,
pub last_level: u32,
pub nr_samples: u32,
pub flags: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct virgl_renderer_hdr {
pub stype: u32,
pub stype_version: u32,
pub size: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct virgl_renderer_export_query {
pub hdr: virgl_renderer_hdr,
pub in_resource_id: u32,
pub out_num_fds: u32,
pub in_export_fds: u32,
pub out_fourcc: u32,
pub pad: u32,
pub out_fds: [i32; 4usize],
pub out_strides: [u32; 4usize],
pub out_offsets: [u32; 4usize],
pub out_modifier: u64,
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct virgl_renderer_supported_structures {
pub hdr: virgl_renderer_hdr,
pub in_stype_version: u32,
pub out_supported_structures_mask: u32,
}
pub const VIRGL_LOG_LEVEL_DEBUG: virgl_log_level_flags = 0;
pub const VIRGL_LOG_LEVEL_INFO: virgl_log_level_flags = 1;
pub const VIRGL_LOG_LEVEL_WARNING: virgl_log_level_flags = 2;
pub const VIRGL_LOG_LEVEL_ERROR: virgl_log_level_flags = 3;
pub const VIRGL_LOG_LEVEL_SILENT: virgl_log_level_flags = 4;
pub type virgl_log_level_flags = ::std::os::raw::c_uint;
pub type virgl_free_data_callback_type =
::std::option::Option<unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void)>;
pub type virgl_log_callback_type = ::std::option::Option<
unsafe extern "C" fn(
log_level: virgl_log_level_flags,
message: *const ::std::os::raw::c_char,
user_data: *mut ::std::os::raw::c_void,
),
>;
extern "C" {
pub fn virgl_renderer_resource_create(
args: *mut virgl_renderer_resource_create_args,
iov: *mut iovec,
num_iovs: u32,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_resource_import_eglimage(
args: *mut virgl_renderer_resource_create_args,
image: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_resource_unref(res_handle: u32);
}
extern "C" {
pub fn virgl_renderer_resource_set_priv(res_handle: u32, priv_: *mut ::std::os::raw::c_void);
}
extern "C" {
pub fn virgl_renderer_resource_get_priv(res_handle: u32) -> *mut ::std::os::raw::c_void;
}
extern "C" {
pub fn virgl_renderer_context_create(
handle: u32,
nlen: u32,
name: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_context_destroy(handle: u32);
}
extern "C" {
pub fn virgl_renderer_submit_cmd(
buffer: *mut ::std::os::raw::c_void,
ctx_id: ::std::os::raw::c_int,
ndw: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_transfer_read_iov(
handle: u32,
ctx_id: u32,
level: u32,
stride: u32,
layer_stride: u32,
box_: *mut virgl_box,
offset: u64,
iov: *mut iovec,
iovec_cnt: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_transfer_write_iov(
handle: u32,
ctx_id: u32,
level: ::std::os::raw::c_int,
stride: u32,
layer_stride: u32,
box_: *mut virgl_box,
offset: u64,
iovec: *mut iovec,
iovec_cnt: ::std::os::raw::c_uint,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_get_cap_set(set: u32, max_ver: *mut u32, max_size: *mut u32);
}
extern "C" {
pub fn virgl_renderer_fill_caps(set: u32, version: u32, caps: *mut ::std::os::raw::c_void);
}
extern "C" {
pub fn virgl_renderer_resource_attach_iov(
res_handle: ::std::os::raw::c_int,
iov: *mut iovec,
num_iovs: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_resource_detach_iov(
res_handle: ::std::os::raw::c_int,
iov: *mut *mut iovec,
num_iovs: *mut ::std::os::raw::c_int,
);
}
extern "C" {
pub fn virgl_renderer_create_fence(
client_fence_id: ::std::os::raw::c_int,
ctx_id: u32,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_force_ctx_0();
}
extern "C" {
pub fn virgl_renderer_ctx_attach_resource(
ctx_id: ::std::os::raw::c_int,
res_handle: ::std::os::raw::c_int,
);
}
extern "C" {
pub fn virgl_renderer_ctx_detach_resource(
ctx_id: ::std::os::raw::c_int,
res_handle: ::std::os::raw::c_int,
);
}
extern "C" {
pub fn virgl_set_log_callback(
cb: virgl_log_callback_type,
user_data: *mut ::std::os::raw::c_void,
free_user_data_cb: virgl_free_data_callback_type,
);
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct virgl_renderer_resource_info {
pub handle: u32,
pub virgl_format: u32,
pub width: u32,
pub height: u32,
pub depth: u32,
pub flags: u32,
pub tex_id: u32,
pub stride: u32,
pub drm_fourcc: ::std::os::raw::c_int,
pub fd: ::std::os::raw::c_int,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct virgl_renderer_resource_info_ext {
pub version: ::std::os::raw::c_int,
pub base: virgl_renderer_resource_info,
pub has_dmabuf_export: bool,
pub planes: ::std::os::raw::c_int,
pub modifiers: u64,
pub d3d_tex2d: *mut ::std::os::raw::c_void,
}
impl Default for virgl_renderer_resource_info_ext {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
#[allow(clippy::undocumented_unsafe_blocks)]
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
extern "C" {
pub fn virgl_renderer_resource_get_info(
res_handle: ::std::os::raw::c_int,
info: *mut virgl_renderer_resource_info,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_resource_get_info_ext(
res_handle: ::std::os::raw::c_int,
info: *mut virgl_renderer_resource_info_ext,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_cleanup(cookie: *mut ::std::os::raw::c_void);
}
extern "C" {
pub fn virgl_renderer_reset();
}
extern "C" {
pub fn virgl_renderer_get_poll_fd() -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_execute(
execute_args: *mut ::std::os::raw::c_void,
execute_size: u32,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_context_create_with_flags(
ctx_id: u32,
ctx_flags: u32,
nlen: u32,
name: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct virgl_renderer_resource_create_blob_args {
pub res_handle: u32,
pub ctx_id: u32,
pub blob_mem: u32,
pub blob_flags: u32,
pub blob_id: u64,
pub size: u64,
pub iovecs: *const iovec,
pub num_iovs: u32,
}
impl Default for virgl_renderer_resource_create_blob_args {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
#[allow(clippy::undocumented_unsafe_blocks)]
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
extern "C" {
pub fn virgl_renderer_resource_create_blob(
args: *const virgl_renderer_resource_create_blob_args,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_resource_map(
res_handle: u32,
map: *mut *mut ::std::os::raw::c_void,
out_size: *mut u64,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_resource_unmap(res_handle: u32) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_resource_get_map_info(
res_handle: u32,
map_info: *mut u32,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_resource_export_blob(
res_id: u32,
fd_type: *mut u32,
fd: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct virgl_renderer_resource_import_blob_args {
pub res_handle: u32,
pub blob_mem: u32,
pub fd_type: u32,
pub fd: ::std::os::raw::c_int,
pub size: u64,
}
extern "C" {
pub fn virgl_renderer_resource_import_blob(
args: *const virgl_renderer_resource_import_blob_args,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_context_create_fence(
ctx_id: u32,
flags: u32,
ring_idx: u32,
fence_id: u64,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_export_fence(
client_fence_id: u64,
fd: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_export_signalled_fence() -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_context_poll(ctx_id: u32);
}
extern "C" {
pub fn virgl_renderer_context_get_poll_fd(ctx_id: u32) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn virgl_renderer_submit_cmd2(
buffer: *mut ::std::os::raw::c_void,
ctx_id: ::std::os::raw::c_int,
ndw: ::std::os::raw::c_int,
in_fence_ids: *mut u64,
num_in_fences: u32,
) -> ::std::os::raw::c_int;
}