rutabaga_gfx/cross_domain/
cross_domain_protocol.rs1#![allow(dead_code)]
9
10use zerocopy::AsBytes;
11use zerocopy::FromBytes;
12use zerocopy::FromZeroes;
13
14pub const CROSS_DOMAIN_CMD_INIT: u8 = 1;
16pub const CROSS_DOMAIN_CMD_GET_IMAGE_REQUIREMENTS: u8 = 2;
17pub const CROSS_DOMAIN_CMD_POLL: u8 = 3;
18pub const CROSS_DOMAIN_CMD_SEND: u8 = 4;
19pub const CROSS_DOMAIN_CMD_RECEIVE: u8 = 5;
20pub const CROSS_DOMAIN_CMD_READ: u8 = 6;
21pub const CROSS_DOMAIN_CMD_WRITE: u8 = 7;
22
23pub const CROSS_DOMAIN_CHANNEL_TYPE_WAYLAND: u32 = 0x0001;
25pub const CROSS_DOMAIN_CHANNEL_TYPE_CAMERA: u32 = 0x0002;
26
27pub const CROSS_DOMAIN_MAX_IDENTIFIERS: usize = 28;
29
30pub const CROSS_DOMAIN_ID_TYPE_VIRTGPU_BLOB: u32 = 1;
32pub const CROSS_DOMAIN_ID_TYPE_VIRTGPU_SYNC: u32 = 2;
34pub const CROSS_DOMAIN_ID_TYPE_READ_PIPE: u32 = 3;
37pub const CROSS_DOMAIN_ID_TYPE_WRITE_PIPE: u32 = 4;
40
41pub const CROSS_DOMAIN_RING_NONE: u32 = 0xffffffff;
43pub const CROSS_DOMAIN_QUERY_RING: u32 = 0;
45pub const CROSS_DOMAIN_CHANNEL_RING: u32 = 1;
47
48pub const CROSS_DOMAIN_PIPE_READ_START: u32 = 0x80000000;
50
51#[repr(C)]
52#[derive(Copy, Clone, Default, AsBytes, FromZeroes, FromBytes)]
53pub struct CrossDomainCapabilities {
54 pub version: u32,
55 pub supported_channels: u32,
56 pub supports_dmabuf: u32,
57 pub supports_external_gpu_memory: u32,
58}
59
60#[repr(C)]
61#[derive(Copy, Clone, Default, AsBytes, FromZeroes, FromBytes)]
62pub struct CrossDomainImageRequirements {
63 pub strides: [u32; 4],
64 pub offsets: [u32; 4],
65 pub modifier: u64,
66 pub size: u64,
67 pub blob_id: u32,
68 pub map_info: u32,
69 pub memory_idx: i32,
70 pub physical_device_idx: i32,
71}
72
73#[repr(C)]
74#[derive(Copy, Clone, Default, AsBytes, FromZeroes, FromBytes)]
75pub struct CrossDomainHeader {
76 pub cmd: u8,
77 pub ring_idx: u8,
78 pub cmd_size: u16,
79 pub pad: u32,
80}
81
82#[repr(C)]
83#[derive(Copy, Clone, Default, AsBytes, FromZeroes, FromBytes)]
84pub struct CrossDomainInit {
85 pub hdr: CrossDomainHeader,
86 pub query_ring_id: u32,
87 pub channel_ring_id: u32,
88 pub channel_type: u32,
89}
90
91#[repr(C)]
92#[derive(Copy, Clone, Default, AsBytes, FromZeroes, FromBytes)]
93pub struct CrossDomainGetImageRequirements {
94 pub hdr: CrossDomainHeader,
95 pub width: u32,
96 pub height: u32,
97 pub drm_format: u32,
98 pub flags: u32,
99}
100
101#[repr(C)]
102#[derive(Copy, Clone, Default, AsBytes, FromZeroes, FromBytes)]
103pub struct CrossDomainSendReceive {
104 pub hdr: CrossDomainHeader,
105 pub num_identifiers: u32,
106 pub opaque_data_size: u32,
107 pub identifiers: [u32; CROSS_DOMAIN_MAX_IDENTIFIERS],
108 pub identifier_types: [u32; CROSS_DOMAIN_MAX_IDENTIFIERS],
109 pub identifier_sizes: [u32; CROSS_DOMAIN_MAX_IDENTIFIERS],
110 }
112
113#[repr(C)]
114#[derive(Copy, Clone, Default, AsBytes, FromZeroes, FromBytes)]
115pub struct CrossDomainReadWrite {
116 pub hdr: CrossDomainHeader,
117 pub identifier: u32,
118 pub hang_up: u32,
119 pub opaque_data_size: u32,
120 pub pad: u32,
121 }