pub struct BufferMemoryConstraints {
pub min_size_bytes: Option<u64>,
pub max_size_bytes: Option<u64>,
pub physically_contiguous_required: Option<bool>,
pub secure_required: Option<bool>,
pub cpu_domain_supported: Option<bool>,
pub ram_domain_supported: Option<bool>,
pub inaccessible_domain_supported: Option<bool>,
pub permitted_heaps: Option<Vec<Heap>>,
/* private fields */
}
Fields§
§min_size_bytes: Option<u64>
un-set is treated as 1
max_size_bytes: Option<u64>
un-set is treated as 0xFFFFFFFFFFFFFFFF.
physically_contiguous_required: Option<bool>
When false, physical pages of a buffer VMO can be non-contiguous. When true, physical pages of a buffer VMO must be sequentially contiguous. A client that doesn’t require physically contiguous VMOs must still accept physically contiguous VMOs or “physical” VMOs.
secure_required: Option<bool>
If true, the participant requires secure memory.
When aggregating BufferCollectionConstraints
, these values boolean-OR.
cpu_domain_supported: Option<bool>
When true (or when BufferMemoryConstraints
is not present), the
participant is ok with sysmem selecting the CPU domain.
If the CPU domain is selected, participants must ensure the CPU can read or write data to the buffer without cache operations outside of the participant.
In other words, if a producer participant DMAs data directly to RAM on a non-cache-coherent architecture such as arm, the producer must ensure the CPU cache is clean wrt. the buffer before the DMA write, and invalidate the CPU cache after the DMA write and before indicating that the buffer is ready to any other participant. If a consumer participant DMAs data directly from RAM on a non-cache-coherent architecture such as arm, the consumer must flush the CPU cache wrt the buffer before the DMA read.
CPU-only participants that don’t do any DMA can just write and read the buffers (when they should) without needing to do any CPU cache ops.
ram_domain_supported: Option<bool>
When true, the participant is ok with sysmem selecting the RAM domain.
If the RAM domain is selected, producer data must be available in RAM (with CPU cache state such that the RAM data won’t get corrupted by a dirty CPU cache line writing incorrect data to RAM), and a consumer reading using the CPU must invalidate CPU cache before reading (the producer doesn’t guarantee zero stale “clean” cache lines).
In other words, if a producer participant uses the CPU to write data on a non-cache-coherent architecture such as arm, the producer must flush the data to RAM before indicating to another participant that the buffer is ready. If a consumer participant uses the CPU to read data on a non-cache-coherent architecture such as arm, the participant must invalidate (typically flush+invalidate with knowledge that no cache lines are dirty) the CPU cache before reading the buffer.
RAM-only participants that don’t do any CPU accesses to a buffer can just do DMA to/from the buffers (when they should) without needing to do any CPU cache ops.
inaccessible_domain_supported: Option<bool>
When true, the participant is ok with sysmem selecting the INACCESSIBLE domain.
If the INACCESSIBLE domain is selected, CPU reads and writes of the data are prevented. Attempts to read/write the data with the CPU may result in UB and/or process termination.
If the INACCESSIBLE domain is selected, participants must only operate on the data using DMAs performed by HW, or platform-specific DMA-like requests to a secure environment (which will do the needed CPU cache ops similar to how a RAM domain participant would operate).
Secure heaps only support INACCESSIBLE domain, and will fail allocation
if any participant with BufferUsage
other than NONE_USAGE
does not
set inaccessible_domain_supported to true.
When the INACCESSIBLE domain is selected, participants (outside of secure/DRM environments) should not attempt to map buffers, and should not attempt to perform any CPU cache ops. In this respect, this domain is similar to RAM domain with all participants only doing DMA and no participant(s) doing CPU accesses.
permitted_heaps: Option<Vec<Heap>>
Which heaps are acceptable to the participant. Participants that don’t
care which heap memory is allocated on should leave this field un-set. A
secure heap is only selected if all participants explicitly indicate
that the secure heap is acceptable via heap_permitted
, or specify
NONE_USAGE
.
Trait Implementations§
Source§impl Clone for BufferMemoryConstraints
impl Clone for BufferMemoryConstraints
Source§fn clone(&self) -> BufferMemoryConstraints
fn clone(&self) -> BufferMemoryConstraints
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BufferMemoryConstraints
impl Debug for BufferMemoryConstraints
Source§impl<D: ResourceDialect> Decode<BufferMemoryConstraints, D> for BufferMemoryConstraints
impl<D: ResourceDialect> Decode<BufferMemoryConstraints, D> for BufferMemoryConstraints
Source§impl Default for BufferMemoryConstraints
impl Default for BufferMemoryConstraints
Source§fn default() -> BufferMemoryConstraints
fn default() -> BufferMemoryConstraints
Source§impl<D: ResourceDialect> Encode<BufferMemoryConstraints, D> for &BufferMemoryConstraints
impl<D: ResourceDialect> Encode<BufferMemoryConstraints, D> for &BufferMemoryConstraints
Source§impl PartialEq for BufferMemoryConstraints
impl PartialEq for BufferMemoryConstraints
Source§impl TypeMarker for BufferMemoryConstraints
impl TypeMarker for BufferMemoryConstraints
Source§type Owned = BufferMemoryConstraints
type Owned = BufferMemoryConstraints
Source§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
Source§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align
.§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned
to a single memcpy. Read more§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned
to a single memcpy.Source§impl ValueTypeMarker for BufferMemoryConstraints
impl ValueTypeMarker for BufferMemoryConstraints
Source§type Borrowed<'a> = &'a BufferMemoryConstraints
type Borrowed<'a> = &'a BufferMemoryConstraints
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read moreimpl Persistable for BufferMemoryConstraints
impl StructuralPartialEq for BufferMemoryConstraints
Auto Trait Implementations§
impl Freeze for BufferMemoryConstraints
impl RefUnwindSafe for BufferMemoryConstraints
impl Send for BufferMemoryConstraints
impl Sync for BufferMemoryConstraints
impl Unpin for BufferMemoryConstraints
impl UnwindSafe for BufferMemoryConstraints
Blanket Implementations§
§impl<T> Body for Twhere
T: Persistable,
impl<T> Body for Twhere
T: Persistable,
§type MarkerAtTopLevel = T
type MarkerAtTopLevel = T
§type MarkerInResultUnion = T
type MarkerInResultUnion = T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)