qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: Gurchetan Singh <gurchetansingh@chromium.org>, qemu-devel@nongnu.org
Cc: kraxel@redhat.com, marcandre.lureau@redhat.com,
	akihiko.odaki@gmail.com, dmitry.osipenko@collabora.com,
	ray.huang@amd.com, alex.bennee@linaro.org, shentey@gmail.com
Subject: Re: [PATCH v2 6/9] gfxstream + rutabaga: add initial support for gfxstream
Date: Tue, 01 Aug 2023 15:11:07 +0000	[thread overview]
Message-ID: <873512bxx0.fsf@alyssa.is> (raw)
In-Reply-To: <20230801011723.627-7-gurchetansingh@chromium.org>

[-- Attachment #1: Type: text/plain, Size: 3003 bytes --]

Gurchetan Singh <gurchetansingh@chromium.org> writes:

> +static int virtio_gpu_rutabaga_init(VirtIOGPU *g, Error **errp)
> +{
> +    int result;
> +    uint64_t capset_mask;
> +    struct rutabaga_channels channels = { 0 };
> +    struct rutabaga_builder builder = { 0 };
> +
> +    VirtIOGPURutabaga *vr = VIRTIO_GPU_RUTABAGA(g);
> +    vr->rutabaga = NULL;
> +
> +    if (!vr->capset_names) {
> +        error_setg(errp, "a capset name from virtio-gpu spec");
> +        return -EINVAL;
> +    }
> +
> +    builder.wsi = RUTABAGA_WSI_SURFACELESS;
> +    /*
> +     * Currently, if WSI is specified, the only valid strings are "surfaceless"
> +     * or "headless".  Surfaceless doesn't create a native window surface, but
> +     * does copy from the render target to the Pixman buffer if a virtio-gpu
> +     * 2D hypercall is issued.  Surfacless is the default.
> +     *
> +     * Headless is like surfaceless, but doesn't copy to the Pixman buffer. The
> +     * use case is automated testing environments where there is no need to view
> +     * results.
> +     *
> +     * In the future, more performant virtio-gpu 2D UI integration may be added.
> +     */
> +    if (vr->wsi) {
> +        if (g_str_equal(vr->wsi, "surfaceless")) {
> +            vr->headless = false;
> +        } else if (g_str_equal(vr->wsi, "headless")) {
> +            vr->headless = true;
> +        } else {
> +            error_setg(errp, "invalid wsi option selected");
> +            return -EINVAL;
> +        }
> +    }
> +
> +    result = rutabaga_calculate_capset_mask(vr->capset_names, &capset_mask);
> +    if (result) {
> +        error_setg(errp, "invalid capset names: %s", vr->capset_names);
> +        return result;
> +    }
> +
> +    builder.fence_cb = virtio_gpu_rutabaga_fence_cb;
> +    builder.debug_cb = virtio_gpu_rutabaga_debug_cb;
> +    builder.capset_mask = capset_mask;
> +
> +    /*
> +     * Using GPOINTER_TO_UINT(g) below causes segfaults.
> +     */
> +    builder.user_data =  (uint64_t)(uintptr_t *)(void *)g;
> +
> +    if (vr->wayland_socket_path) {
> +        if ((builder.capset_mask & (1 << RUTABAGA_CAPSET_CROSS_DOMAIN)) == 0) {
> +            error_setg(errp, "cross-domain required with wayland socket");
> +            return -EINVAL;
> +        }
> +
> +        channels.channels = g_new0(struct rutabaga_channel, 1);
> +        channels.num_channels = 1;
> +        channels.channels[0].channel_name = vr->wayland_socket_path;
> +        channels.channels[0].channel_type = RUTABAGA_CHANNEL_TYPE_WAYLAND;
> +        builder.channels = &channels;
> +    }
> +

Would it be feasible to identify whether Wayland should be used in some
other way, to avoid users having to manually specify the socket path and
allow the standard wl_display_connect() logic to be used?

> +    result = rutabaga_init(&builder, &vr->rutabaga);
> +    if (builder.capset_mask & (1 << RUTABAGA_CAPSET_CROSS_DOMAIN)) {
> +        g_free(channels.channels);
> +    }
> +
> +    return result;
> +}

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2023-08-01 15:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01  1:17 [PATCH v2 0/9] gfxstream + rutabaga_gfx Gurchetan Singh
2023-08-01  1:17 ` [PATCH v2 1/9] virtio: Add shared memory capability Gurchetan Singh
2023-08-01  1:17 ` [PATCH v2 2/9] virtio-gpu: CONTEXT_INIT feature Gurchetan Singh
2023-08-01  1:17 ` [PATCH v2 3/9] virtio-gpu: hostmem Gurchetan Singh
2023-08-01  1:17 ` [PATCH v2 4/9] virtio-gpu: blob prep Gurchetan Singh
2023-08-01  1:17 ` [PATCH v2 5/9] gfxstream + rutabaga prep: added need defintions, fields, and options Gurchetan Singh
2023-08-01  1:17 ` [PATCH v2 6/9] gfxstream + rutabaga: add initial support for gfxstream Gurchetan Singh
2023-08-01 15:11   ` Alyssa Ross [this message]
2023-08-02  6:20   ` Akihiko Odaki
2023-08-01  1:17 ` [PATCH v2 7/9] gfxstream + rutabaga: meson support Gurchetan Singh
2023-08-02  6:21   ` Akihiko Odaki
2023-08-01  1:17 ` [PATCH v2 8/9] gfxstream + rutabaga: enable rutabaga Gurchetan Singh
2023-08-02  6:22   ` Akihiko Odaki
2023-08-01  1:17 ` [PATCH v2 9/9] docs/system: add basic virtio-gpu documentation Gurchetan Singh
2023-08-01 15:04   ` Alyssa Ross
2023-08-02  6:37   ` Akihiko Odaki
2023-08-01 15:00 ` [PATCH v2 0/9] gfxstream + rutabaga_gfx Alyssa Ross
2023-08-02  7:08 ` Akihiko Odaki

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=873512bxx0.fsf@alyssa.is \
    --to=hi@alyssa.is \
    --cc=akihiko.odaki@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=dmitry.osipenko@collabora.com \
    --cc=gurchetansingh@chromium.org \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ray.huang@amd.com \
    --cc=shentey@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).