mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 00:24:51 +00:00
4aa99fd1a9
if no new frame is available for capturing Fixes #4078 #4196
This library makes the xHCI device model of Qemu available on Genode and is used as a back end for such for device models in existing VMMs. Additionally a webcam device model attached to the xHCI device is supported. Usage xHCI model ~~~~~~~~~~~~~~~~ The user of this library is required to provide certain back end functionality, namely a Timer_queue to handle timer events and a Pci_device that handles access to the PCI bus (raise interrupts, (un)map DMA memory) within the VMM device model. To use this library the user calls 'Qemu::usb_init' and passes pointers to the back end objects. In addition, a Signal_receiver reference has also to be handed over. It will receive all signals required by this library. 'Qemu::usb_init' returns a pointer to a Controller object. MMIO access must be forwarded to this object when the device model in the VMM wants to access the MMIO regions of the xHCI device. Whenever the VMM requests a device reset the 'Qemu::usb_reset' function has to be called. It will remove and free all attached USB devices and will reset the state of the xHCI device model. After the xHCI device model has been reset 'Qemu::usb_update_devices' needs to be called to reattach USB devices. Timer callbacks that have been registered using the Timer_queue interface have to be executed by calling 'Qemu::usb_timer_callback' when the timer triggers. Usage webcam model attached to the xHCI model ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If the xHCI model is enabled and used, then the webcam device model can be enabled by specifying a XML node in the config ROM: <config ...> ... <webcam width="640" height="480" fps="15" vertical_flip="false" screen_size="false" report="false"/> ... </config> The webcam attributes are optional. The values shown above, are the default ones when a attribute is not specified. When the webcam node is specified, the model will open and will use a Genode capture session to obtain the frames in the rate as specified by the frame per secondes (fps) attribute. The 'vertical_flip' attribute specifies, whether the frames are shown flipped for guests. For Windows guests the value has to be false, for Linux guests true. The format supported by the model is YUV2 or BGR3. If the 'screen_size' is set to true, the webcam model will try to use the screen size as provided by the capture session. If the screen size is invalid (e.g. 0x0), the attribute values of 'width' and 'height' will be used instead. If the 'report' attribute is set, a report will be generated whenever the guests starts/ends capturing and if the capturing format choosen by the guest changes, <capture enabled="..." format="BGR3"/> or <capture enabled="..." format="YUV2"/>