Skip to main content

StreamProcessorParticipateInBufferAllocationRequest

Struct StreamProcessorParticipateInBufferAllocationRequest 

Source
pub struct StreamProcessorParticipateInBufferAllocationRequest {
    pub port: Option<Port>,
    pub buffer_constraints_version_ordinal: Option<u64>,
    pub sysmem2_token: Option<ClientEnd<BufferCollectionTokenMarker>>,
    pub buffer_lifetime_ordinal: Option<u64>,
    pub allow_single_buffer: Option<bool>,
    /* private fields */
}

Fields§

§port: Option<Port>

Which port (input or output) the buffer(s) are for.

Must be set.

§buffer_constraints_version_ordinal: Option<u64>

For input, this field must be set to 1, at least for now.

For output, this field must set to the latest known (to the client) buffer_constraints_version_ordinal value from the server. If the value is less than the latest buffer_constraints_version_ordinal created by the server which had action_reqiured true, then the server will set generic sysmem constraints (just min_buffer_count 1) and otherwise ignore this message. This is intended to allow allocation to succeed (to allow simpler client error handling for some clients); in this case a new buffer_constraints_version_ordinal will reach the client and the client can catch up to the latest.

If this value is a future value, the server will drop the sysmem2_token which will cause allocation failure.

Must be set.

§sysmem2_token: Option<ClientEnd<BufferCollectionTokenMarker>>

This sysmem token is used by the server to inform sysmem directly of any applicable buffer constraints. These constraints are allowed to (and in some cases must) depend on how this StreamProcessor instance was created. For example, secure_input_mode/secure_output_mode during StreamProcessor creation causes the server to set secure_required for input/output respectively (as specified by Port.INPUT or Port.OUTPUT respectively).

Must be set.

§buffer_lifetime_ordinal: Option<u64>

If set, and there’s been at least one AddBuffer previously sent with this buffer_lifetime_ordinal on the same StreamProcessor instance which hasn’t yet been removed server-side, the new buffer(s) will be allocated with identical SingleBufferSettings, or fail allocation. If any of the conditions in this paragraph aren’t met, the effect is the same as if this field is not set.

If this field is not set, the sysmem constraints set by the server will be suitable for a buffer of a new buffer_lifetime_ordinal, and the new buffer’s SingleBufferSettings might not match any previous buffer’s SingleBufferSettings.

If the server has a current stream and port indicates the output port, the constraints set will allow the stream to be correctly processed across the switch to new buffer_lifetime_ordinal (assuming the client is using a new buffer_lifetime_ordinal and adds the new buffer(s) subsequently etc). If port indicates the input port, the constraints set will be generic for the input port regardless of any current stream.

If this mechanism isn’t used, the client must still ensure that all AddBuffer with a given StreamProcessor instance, port, and buffer_lifetime_ordinal have identical SingleBufferSettings. One way to do this is to allocate all the buffers of a buffer_lifetime_ordinal under a single sysmem buffer collection. Another way is for the client to tell sysmem directly that a new buffer collection must match the SingleBufferSettings of a prior collection using [fuchsia.sysmem2/BufferCollectionConstraints.must_match_vmo] client-side.

It’s not recommended for a client to attempt to force a new collecton’s SingleBufferSettings to match an old collection’s SingleBufferSettings without sysmem’s help and without StreamProcessor’s help via this field, because sysmem intentionally allows clients participating in the same collection to be using different versions of the sysmem interfaces, so the client may not have enough information to successfully force the SingleBufferSettings to match without using must_match_vmo, for example if the client is unaware of a new SingleBufferSettings field (or similar). The most common StreamProcessor server implementation (CodecImpl) will handle this field using must_match_vmo on behalf of the client as long as there’s still at least one buffer of the buffer_lifetime_ordinal active in the server. The ability to dynamically add more buffers to an existing sysmem collection may be added to sysmem at some point; that would give the client another way to ensure identical SingleBufferSettings within a buffer_lifetime_ordinal, but only if/when all sysmem collection participants indicate support for a dynamic sysmem buffer collection.

For output, setting this field is strongly recommended if a client is adding additional output buffers to an existing buffer_lifetime_ordinal using a new/different sysmem buffer collection, and setting this field is recommended for all output buffer allocations.

For input, if a client is using the same StreamProcessor instance for this message and AddBuffer (which is itself recommended when feasible), use of this field is recommended for those input buffers.

If set, this value must match the buffer_lifetime_ordinal later sent in AddBuffer.

Clients should set this when feasible; see above.

§allow_single_buffer: Option<bool>

If set to true, the server will leave all buffer_count_* fields un-set when sending SetConstraints to sysmem, and will set min_buffer_count to 1.

If un-set or set to false, the server will fill out buffer count fields when sending SetConstraints to sysmem based on the current value of buffer_count_for_server_current, without any extra slack. The client can add slack as desired via its own retained token.

Regardless of whether this field is set to true, it’s up to the client to AddBuffer at least buffer_count_for_server_current buffers so that processing can make progress.

Trait Implementations§

Source§

impl Debug for StreamProcessorParticipateInBufferAllocationRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Decode<StreamProcessorParticipateInBufferAllocationRequest, DefaultFuchsiaResourceDialect> for StreamProcessorParticipateInBufferAllocationRequest

Source§

fn new_empty() -> Self

Creates a valid instance of Self. The specific value does not matter, since it will be overwritten by decode.
Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, DefaultFuchsiaResourceDialect>, offset: usize, depth: Depth, ) -> Result<()>

Decodes an object of type T from the decoder’s buffers into self. Read more
Source§

impl Default for StreamProcessorParticipateInBufferAllocationRequest

Source§

fn default() -> StreamProcessorParticipateInBufferAllocationRequest

Returns the “default value” for a type. Read more
Source§

impl Encode<StreamProcessorParticipateInBufferAllocationRequest, DefaultFuchsiaResourceDialect> for &mut StreamProcessorParticipateInBufferAllocationRequest

Source§

unsafe fn encode( self, encoder: &mut Encoder<'_, DefaultFuchsiaResourceDialect>, offset: usize, depth: Depth, ) -> Result<()>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl PartialEq for StreamProcessorParticipateInBufferAllocationRequest

Source§

fn eq( &self, other: &StreamProcessorParticipateInBufferAllocationRequest, ) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ResourceTypeMarker for StreamProcessorParticipateInBufferAllocationRequest

Source§

type Borrowed<'a> = &'a mut StreamProcessorParticipateInBufferAllocationRequest

The Rust type to use for encoding. This is a particular Encode<Self> type cheaply obtainable from &mut Self::Owned. There are three cases: Read more
Source§

fn take_or_borrow<'a>( value: &'a mut <Self as TypeMarker>::Owned, ) -> Self::Borrowed<'a>

Cheaply converts from &mut Self::Owned to Self::Borrowed. For HandleBased types this is “take” (it returns an owned handle and replaces value with Handle::invalid), and for all other types it is “borrow” (just converts from one reference to another).
Source§

impl TypeMarker for StreamProcessorParticipateInBufferAllocationRequest

Source§

type Owned = StreamProcessorParticipateInBufferAllocationRequest

The owned Rust type which this FIDL type decodes into.
Source§

fn inline_align(_context: Context) -> usize

Returns the minimum required alignment of the inline portion of the encoded object. It must be a (nonzero) power of two.
Source§

fn inline_size(_context: Context) -> usize

Returns the size of the inline portion of the encoded object, including padding for alignment. Must be a multiple of inline_align.
Source§

fn encode_is_copy() -> bool

Returns true if the memory layout of 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
Source§

fn decode_is_copy() -> bool

Returns true if the memory layout of 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 Standalone<DefaultFuchsiaResourceDialect> for StreamProcessorParticipateInBufferAllocationRequest

Source§

impl StructuralPartialEq for StreamProcessorParticipateInBufferAllocationRequest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.