pub trait Device {
    // Required methods
    fn process_cmd(
        &mut self,
        cmd: VideoCmd,
        wait_ctx: &WaitContext<Token>,
    ) -> (VideoCmdResponseType, Option<(u32, Vec<VideoEvtResponseType>)>);
    fn process_event(
        &mut self,
        desc_map: &mut AsyncCmdDescMap,
        stream_id: u32,
        wait_ctx: &WaitContext<Token>,
    ) -> Option<Vec<VideoEvtResponseType>>;
    // Provided method
    fn process_buffer_barrier(
        &mut self,
        _stream_id: u32,
        _wait_ctx: &WaitContext<Token>,
    ) -> Option<Vec<VideoEvtResponseType>> { ... }
}Required Methods§
sourcefn process_cmd(
    &mut self,
    cmd: VideoCmd,
    wait_ctx: &WaitContext<Token>,
) -> (VideoCmdResponseType, Option<(u32, Vec<VideoEvtResponseType>)>)
 
fn process_cmd( &mut self, cmd: VideoCmd, wait_ctx: &WaitContext<Token>, ) -> (VideoCmdResponseType, Option<(u32, Vec<VideoEvtResponseType>)>)
Processes a virtio-video command.
If the command expects a synchronous response, it returns a response as
VideoCmdResponseType::Sync. Otherwise, it returns a name of the descriptor chain that
will be used when a response is prepared. Implementations of this method is passed a
WaitContext object which can be used to add or remove descriptors to wait on. It is
expected that only Token::Event items would be added. When a Token::Event event arrives,
process_event() will be invoked.
TODO(b/149720783): Make this an async function.
sourcefn process_event(
    &mut self,
    desc_map: &mut AsyncCmdDescMap,
    stream_id: u32,
    wait_ctx: &WaitContext<Token>,
) -> Option<Vec<VideoEvtResponseType>>
 
fn process_event( &mut self, desc_map: &mut AsyncCmdDescMap, stream_id: u32, wait_ctx: &WaitContext<Token>, ) -> Option<Vec<VideoEvtResponseType>>
Processes an available Token::Event event and returns a list of VideoEvtResponseType
responses. It returns None if an invalid event comes.
For responses to be sent via command queue, the return type is
VideoEvtResponseType::AsyncCmd. For responses to be sent via event queue, the return
type is VideoEvtResponseType::Event.
TODO(b/149720783): Make this an async function.
Provided Methods§
sourcefn process_buffer_barrier(
    &mut self,
    _stream_id: u32,
    _wait_ctx: &WaitContext<Token>,
) -> Option<Vec<VideoEvtResponseType>>
 
fn process_buffer_barrier( &mut self, _stream_id: u32, _wait_ctx: &WaitContext<Token>, ) -> Option<Vec<VideoEvtResponseType>>
Processes a Token::BufferBarrier event and returns a list of VideoEvtResponseType
responses. Only needs to be implemented for devices that adds Token::BufferBarrier tokens
to the wait context.