pub struct BufferCollectionConstraints {
pub usage: BufferUsage,
pub min_buffer_count_for_camping: u32,
pub min_buffer_count_for_dedicated_slack: u32,
pub min_buffer_count_for_shared_slack: u32,
pub min_buffer_count: u32,
pub max_buffer_count: u32,
pub has_buffer_memory_constraints: bool,
pub buffer_memory_constraints: BufferMemoryConstraints,
pub image_format_constraints_count: u32,
pub image_format_constraints: [ImageFormatConstraints; 32],
}
Expand description
Constraints on BufferCollection parameters. These constraints can be specified per-participant. The sysmem service implements aggregation of constraints from multiple participants.
This type is deprecated for new code, but is still used by some camera code.
Fields§
§usage: BufferUsage
The usage is only meant as a hint to help sysmem choose a more optimal PixelFormat or similar when multiple compatible options exist.
When aggregating BufferCollectionConstraints, these values bitwise-OR.
At least one usage bit must be specified unless the whole BufferCollectionConstraints is logically null due to !has_constraints.
min_buffer_count_for_camping: u32
Per-participant number of buffers that the participant may concurrently hold for its exclusive use for a non-transient period of time (camp on).
For example, a video decoder would specify (at least) the maximum number of reference frames + 1 frame currently being decoded into.
A participant must not camp on more buffers than specified here (except very transiently) else processing may get stuck.
When aggregating BufferCollectionConstraints, these values add.
In testing scenarios, camping on more buffers than this for any significant duration may (ideally will) be flagged as a failure. In testing scenarios, the participant may not be provided with more buffers than this concurrently.
min_buffer_count_for_dedicated_slack: u32
Per-participant minimum number of buffers that are needed for slack reasons, for better overlap of processing / better performance.
When aggregating BufferCollectionConstraints, these values add.
A participant should typically specify 0 or 1 here - typically 0 is appropriate if min_buffer_count_for_camping is already enough to keep the participant busy 100% of the time when the participant is slightly behind, while 1 can be appropriate if 1 more buffer than strictly needed for min-camping reasons gives enough slack to stay busy 100% of the time (when slightly behind, vs. lower % without the extra buffer).
In testing scenarios, this field may be forced to 0, and all participants are expected to continue to work without getting stuck. If a buffer is needed for forward progress reasons, that buffer should be accounted for in min_buffer_count_for_camping.
Similar to min_buffer_count_for_dedicated_slack, except when aggregating these values max (instead of add). The value here is not shared with any participant’s min_buffer_count_for_dedicated_slack.
A participant can specify > 0 here if a participant would like to ensure there’s some slack overall, but doesn’t need that slack to be dedicated.
The choice whether to use min_buffer_count_for_dedicated_slack or min_buffer_count_for_shared_slack (or both) will typically be about the degree to which the extra slack improves performance.
In testing scenarios, this field may be forced to 0, and all participants are expected to continue to work without getting stuck. If a buffer is needed for forward progress reasons, that buffer should be accounted for in min_buffer_count_for_camping.
min_buffer_count: u32
A particularly-picky participant may unfortunately need to demand a tight range of buffer_count, or even a specific buffer_count. This field should remain 0 unless a participant really must set this field to constrain the overall BufferCollectionInfo_2.buffer_count. Any such participant should still fill out the min_buffer_count_for_* fields above.
max_buffer_count: u32
0 is treated as 0xFFFFFFFF.
has_buffer_memory_constraints: bool
Constraints on BufferCollectionSettings.buffer_settings.
A participant that intends to specify image_format_constraints_count > 1 will typically specify the minimum buffer size implicitly via image_format_constraints, and possibly specify only the max buffer size via buffer_memory_constraints.
buffer_memory_constraints: BufferMemoryConstraints
§image_format_constraints_count: u32
Optional constraints on the image format parameters of an image stored in a buffer of the BufferCollection. This includes pixel format and image layout. These constraints are per-pixel-format, so more than one is permitted. Entries in the list must have unique pixel_formats.
When aggregating, only pixel formats that are specified by all participants with non-zero image_format_constraints_count (and non-Null) BufferCollectionConstraints) are retained.
image_format_constraints: [ImageFormatConstraints; 32]
Trait Implementations§
Source§impl Clone for BufferCollectionConstraints
impl Clone for BufferCollectionConstraints
Source§fn clone(&self) -> BufferCollectionConstraints
fn clone(&self) -> BufferCollectionConstraints
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BufferCollectionConstraints
impl Debug for BufferCollectionConstraints
Source§impl<D: ResourceDialect> Decode<BufferCollectionConstraints, D> for BufferCollectionConstraints
impl<D: ResourceDialect> Decode<BufferCollectionConstraints, D> for BufferCollectionConstraints
Source§impl<D: ResourceDialect> Encode<BufferCollectionConstraints, D> for &BufferCollectionConstraints
impl<D: ResourceDialect> Encode<BufferCollectionConstraints, D> for &BufferCollectionConstraints
Source§impl<D: ResourceDialect, T0: Encode<BufferUsage, D>, T1: Encode<u32, D>, T2: Encode<u32, D>, T3: Encode<u32, D>, T4: Encode<u32, D>, T5: Encode<u32, D>, T6: Encode<bool, D>, T7: Encode<BufferMemoryConstraints, D>, T8: Encode<u32, D>, T9: Encode<Array<ImageFormatConstraints, 32>, D>> Encode<BufferCollectionConstraints, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
impl<D: ResourceDialect, T0: Encode<BufferUsage, D>, T1: Encode<u32, D>, T2: Encode<u32, D>, T3: Encode<u32, D>, T4: Encode<u32, D>, T5: Encode<u32, D>, T6: Encode<bool, D>, T7: Encode<BufferMemoryConstraints, D>, T8: Encode<u32, D>, T9: Encode<Array<ImageFormatConstraints, 32>, D>> Encode<BufferCollectionConstraints, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
Source§impl Hash for BufferCollectionConstraints
impl Hash for BufferCollectionConstraints
Source§impl Ord for BufferCollectionConstraints
impl Ord for BufferCollectionConstraints
Source§fn cmp(&self, other: &BufferCollectionConstraints) -> Ordering
fn cmp(&self, other: &BufferCollectionConstraints) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for BufferCollectionConstraints
impl PartialOrd for BufferCollectionConstraints
Source§impl TypeMarker for BufferCollectionConstraints
impl TypeMarker for BufferCollectionConstraints
Source§type Owned = BufferCollectionConstraints
type Owned = BufferCollectionConstraints
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 BufferCollectionConstraints
impl ValueTypeMarker for BufferCollectionConstraints
Source§type Borrowed<'a> = &'a BufferCollectionConstraints
type Borrowed<'a> = &'a BufferCollectionConstraints
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read moreimpl Copy for BufferCollectionConstraints
impl Eq for BufferCollectionConstraints
impl Persistable for BufferCollectionConstraints
impl StructuralPartialEq for BufferCollectionConstraints
Auto Trait Implementations§
impl Freeze for BufferCollectionConstraints
impl RefUnwindSafe for BufferCollectionConstraints
impl Send for BufferCollectionConstraints
impl Sync for BufferCollectionConstraints
impl Unpin for BufferCollectionConstraints
impl UnwindSafe for BufferCollectionConstraints
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
)