All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Griffin <peter.griffin@linaro.org>
Cc: marcandre.lureau@redhat.com, stratos-dev@op-lists.linaro.org,
	qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [PATCH 3/8] vhost-user-video: boiler plate code for vhost-user-video device
Date: Tue, 11 Jan 2022 14:58:01 +0000	[thread overview]
Message-ID: <87wnj6b6rp.fsf@linaro.org> (raw)
In-Reply-To: <20211209145601.331477-4-peter.griffin@linaro.org>


Peter Griffin <peter.griffin@linaro.org> writes:

> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
>  hw/display/Kconfig                   |   5 +
>  hw/display/meson.build               |   3 +
>  hw/display/vhost-user-video.c        | 386 +++++++++++++++++++++++++++
>  include/hw/virtio/vhost-user-video.h |  41 +++
>  4 files changed, 435 insertions(+)
>  create mode 100644 hw/display/vhost-user-video.c
>  create mode 100644 include/hw/virtio/vhost-user-video.h
>
> diff --git a/hw/display/Kconfig b/hw/display/Kconfig
> index a2306b67d8..186163b015 100644
> --- a/hw/display/Kconfig
> +++ b/hw/display/Kconfig
> @@ -118,6 +118,11 @@ config VHOST_USER_VGA
>      default y
>      depends on VIRTIO_VGA && VHOST_USER_GPU
>  
> +config VHOST_USER_VIDEO
> +    bool
> +    default y
> +    depends on VIRTIO && VHOST_USER
> +
>  config DPCD
>      bool
>      select AUX
> diff --git a/hw/display/meson.build b/hw/display/meson.build
> index 861c43ff98..48284528cf 100644
> --- a/hw/display/meson.build
> +++ b/hw/display/meson.build
> @@ -37,6 +37,9 @@ softmmu_ss.add(when: 'CONFIG_MACFB', if_true: files('macfb.c'))
>  softmmu_ss.add(when: 'CONFIG_NEXTCUBE', if_true: files('next-fb.c'))
>  
>  specific_ss.add(when: 'CONFIG_VGA', if_true: files('vga.c'))
> +specific_ss.add(when: 'CONFIG_VHOST_USER_VIDEO', if_true: files('vhost-user-video.c'))
> +specific_ss.add(when: ['CONFIG_VHOST_USER_VIDEO', 'CONFIG_VIRTIO_PCI' ],
> +  if_true: files('vhost-user-video-pci.c'))
>  
>  if config_all_devices.has_key('CONFIG_QXL')
>    qxl_ss = ss.source_set()
> diff --git a/hw/display/vhost-user-video.c b/hw/display/vhost-user-video.c
> new file mode 100644
> index 0000000000..506e350365
> --- /dev/null
> +++ b/hw/display/vhost-user-video.c
> @@ -0,0 +1,386 @@
> +/*
> + * Vhost-user VIDEO virtio device
> + *
> + * This is the boilerplate for instantiating a vhost-user device
> + * implementing a virtio-video device.
> + *
> + * The virtio video decoder and encoder devices are virtual devices that
> + * support encoding and decoding respectively.
> + *
> + * The actual back-end for this driver is the vhost-user-video daemon.
> + * The code here just connects up the device in QEMU and allows it to
> + * be instantiated.
> + *
> + * Copyright (c) 2021 Linaro Ltd
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "qapi/error.h"
> +#include "hw/qdev-properties.h"
> +#include "hw/virtio/virtio-bus.h"
> +#include "hw/virtio/vhost-user-video.h"
> +#include "qemu/error-report.h"
> +
> +/* currently there is no VIDEO enc/dec defined in Linux virtio_ids.h */
> +#define VIRTIO_ID_VIDEO_ENC         30
> +#define VIRTIO_ID_VIDEO_DEC         31
> +#define MAX_CAPS_LEN 4096
> +
> +static void vhost_user_video_get_config(VirtIODevice *vdev, uint8_t *config)
> +{
> +    VHostUserVIDEO *video = VHOST_USER_VIDEO(vdev);
> +    struct virtio_video_config *vconfig = (struct virtio_video_config *)config;
> +    int ret;
> +    Error *local_err = NULL;
> +
> +    memset(config, 0, sizeof(struct virtio_video_config));
> +
> +    ret = vhost_dev_get_config(&video->vhost_dev, config,
> +                               sizeof(struct virtio_video_config), &local_err);
> +    if (ret) {
> +        error_report("vhost-user-video: get device config space failed");
> +
> +        /*TODO vhost_dev_get_config() fails so for now lets just set
>  it here */

Is this a lifetime issue? 

Otherwise:

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


  reply	other threads:[~2022-01-11 16:04 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 14:55 [PATCH 0/8] virtio: Add vhost-user based Video decode Peter Griffin
2021-12-09 14:55 ` [PATCH 1/8] vhost-user-video: Add a README.md with cheat sheet of commands Peter Griffin
2022-01-11 14:48   ` Alex Bennée
2022-02-03 10:13     ` Peter Griffin
2021-12-09 14:55 ` [PATCH 2/8] MAINTAINERS: Add virtio-video section Peter Griffin
2022-01-11 14:57   ` Alex Bennée
2021-12-09 14:55 ` [PATCH 3/8] vhost-user-video: boiler plate code for vhost-user-video device Peter Griffin
2022-01-11 14:58   ` Alex Bennée [this message]
2022-02-03 11:14     ` Peter Griffin
2021-12-09 14:55 ` [PATCH 4/8] vhost-user-video: add meson subdir build logic Peter Griffin
2022-01-11 16:03   ` Alex Bennée
2022-02-03 11:31     ` Peter Griffin
2021-12-09 14:55 ` [PATCH 5/8] standard-headers: Add virtio_video.h Peter Griffin
2021-12-10 10:57   ` Michael S. Tsirkin
2021-12-10 13:09     ` Peter Griffin
2021-12-12  9:37       ` Michael S. Tsirkin
2021-12-10 11:02   ` Michael S. Tsirkin
2021-12-10 11:25   ` Peter Maydell
2021-12-10 13:23     ` Peter Griffin
2021-12-09 14:55 ` [PATCH 6/8] virtio_video: Add Fast Walsh-Hadamard Transform format Peter Griffin
2021-12-10 10:58   ` Michael S. Tsirkin
2021-12-10 12:45     ` Peter Griffin
2021-12-09 14:56 ` [PATCH 7/8] hw/display: add vhost-user-video-pci Peter Griffin
2022-01-11 16:11   ` Alex Bennée
2021-12-09 14:56 ` [PATCH 8/8] tools/vhost-user-video: Add initial vhost-user-video vmm Peter Griffin
2022-01-11 16:38   ` Alex Bennée
2022-01-11 15:38 ` [PATCH 0/8] virtio: Add vhost-user based Video decode Michael S. Tsirkin
2022-02-03 12:10   ` Peter Griffin
2022-02-03 13:27     ` Michael S. Tsirkin
2022-01-11 16:24 ` Alex Bennée
2022-02-03 11:43   ` Peter Griffin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnj6b6rp.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.griffin@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stratos-dev@op-lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.