Skip to content
Snippets Groups Projects
Select Git revision
  • 7888fc0b3d07151ddefe8e388c557554c3679745
  • master default
  • virtio-camera
  • venus
  • venus-rebased
  • virgl-blob-fixes
  • staging
  • stable-6.1
  • stable-6.0
  • stable-6.0-staging
  • stable-5.0
  • stable-4.2
  • stable-4.1
  • stable-4.0
  • stable-3.1
  • stable-3.0
  • stable-2.12
  • stable-2.11
  • stable-2.10
  • stable-2.9
  • stable-2.8
  • v7.1.0-rc2
  • v7.1.0-rc1
  • v7.1.0-rc0
  • v7.0.0
  • v7.0.0-rc4
  • v7.0.0-rc3
  • v7.0.0-rc2
  • v7.0.0-rc1
  • v7.0.0-rc0
  • v6.1.1
  • v6.2.0
  • v6.2.0-rc4
  • v6.2.0-rc3
  • v6.2.0-rc2
  • v6.2.0-rc1
  • v6.2.0-rc0
  • v6.0.1
  • v6.1.0
  • v6.1.0-rc4
  • v6.1.0-rc3
41 results

virtio-camera.h

Blame
  • virtio-camera.h 1.41 KiB
    /*
     * Virtio Camera Device
     *
     * Copyright © 2022 Collabora, Ltd.
     *
     * This work is licensed under the terms of the GNU GPL, version 2.
     * See the COPYING file in the top-level directory.
     */
    
    #ifndef QEMU_VIRTIO_CAMERA_H
    #define QEMU_VIRTIO_CAMERA_H
    
    #include "qemu/queue.h"
    #include "qemu/uuid.h"
    #include "hw/virtio/virtio.h"
    #include "qom/object.h"
    
    #include "standard-headers/linux/virtio_camera.h"
    
    #define TYPE_VIRTIO_CAMERA "virtio-camera-device"
    OBJECT_DECLARE_SIMPLE_TYPE(VirtIOCamera, VIRTIO_CAMERA)
    
    #define VIRTIO_CAMERA_GET_PARENT_CLASS(obj) \
            OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_CAMERA)
    
    #define VIRTIO_CAMERA_NUM_V4L2_BUFFERS  3
    
    struct virtio_camera_v4l2 {
        void *buffer_data[VIRTIO_CAMERA_NUM_V4L2_BUFFERS];
        size_t buffer_size[VIRTIO_CAMERA_NUM_V4L2_BUFFERS];
        unsigned int queue_buffer_index;
        char *dev_path;
        int fd;
    };
    
    struct virtio_camera_mem_buffer {
        QTAILQ_ENTRY(virtio_camera_mem_buffer) node;
        QTAILQ_ENTRY(virtio_camera_mem_buffer) capture_node;
        QemuUUID uuid;
        VirtQueueElement *capture_elem;
        unsigned int num_entries;
        struct iovec iov[];
    };
    
    struct VirtIOCamera {
        VirtIODevice parent_obj;
        VirtQueue *ctrl_vq;
        struct virtio_camera_v4l2 v4l2;
        struct virtio_camera_config config;
        QTAILQ_HEAD(, virtio_camera_mem_buffer) buflist;
        QTAILQ_HEAD(, virtio_camera_mem_buffer) capturelist;
        uint64_t mem_buf_uuid;
        bool streaming;
    };
    
    #endif