From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 Received: by atuin.qyliss.net (Postfix, from userid 496) id 5174A579E8; Tue, 22 Mar 2022 20:05:53 +0000 (UTC) Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 15B375791E; Tue, 22 Mar 2022 20:05:28 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id 0095A57901; Tue, 22 Mar 2022 20:05:24 +0000 (UTC) Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by atuin.qyliss.net (Postfix) with ESMTPS id 283A5578F9 for ; Tue, 22 Mar 2022 20:05:22 +0000 (UTC) Received: by mail-lj1-x22a.google.com with SMTP id g24so24264928lja.7 for ; Tue, 22 Mar 2022 13:05:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=RJSiqjJTotAcLyvqtc9G8OIzHnpcdMqWOQZi80HbZR8=; b=WXCzp0DHjWsGTkfq+DFS8c3cKaY9iSybjDZeGSphZi+VED0zBuPm+wWo2+mE9KQnd+ uDU6b0xatZcKaYwYAxoRY6YBR806K6GefY7SsF1VMkZl/68q2MF6uvrC6fYj8BYXuiAO J2n5NKs9NgNui55dI3XJ56kWgSEjff+i9GBz+VHrDgucXGgj7r4Vpigtdewnjy2fa1dg rmo4MvZchCQGFADKCmiGqcatZNVmXhHfLhVdJtuFSkRZogE/yvcPsRKO51smzkhu52n7 MR0xTP5yiB/7t8AFdBLD0xijdgjLiuXXbKxzwuPemHBBUEsV9f1qM9C2eOMMyguhGm/T SbXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=RJSiqjJTotAcLyvqtc9G8OIzHnpcdMqWOQZi80HbZR8=; b=wXPZEn6LSz16U2nvNrCylrdpzLi8YFVDA0GF+TrtXhFuim9Nm+ZOl/tYS8/GmhTOaz yVzCawK78F3B6CUtFNQVfj1e485TVj6ljK5BeNrMpzeUl+Q3V0JURPyMmnhzTPuKEcfw B/OSODE3QN4vTkNVoY5Zwv6vAf2sOyqGaYDSUZdFp/43oyMiqnis/k0H/+WyPw+MI9yl 06Q4df61GHWFJTv89N130x2mE5l2qBtcnljNhcQJMNOAy86vWGf9qPOVTBv4XdNOn+5m b7nmHiNbymeCRyrQkrMWw78UO+T8I0hq10k37EGOkwhzhnlxjw9RMiycc34/UCXpOHa9 CQPg== X-Gm-Message-State: AOAM530fkxjx06Bh0cgO89/pw1zTgixx25stWFkgnDyZ79pGpjPugOoG nyiQszDOMsHqamHyFNUlFUMZbH0q5/xExy3D3a8= X-Google-Smtp-Source: ABdhPJzKEqmEy4r/4rehwCFs/hclkcF0T9bIgSqMzUhx5zjrYJYKeGLxB4aZ2zqHbWDcs1GM08/DFNsVLTQKg7kXVKg= X-Received: by 2002:a05:651c:207:b0:244:c87a:1763 with SMTP id y7-20020a05651c020700b00244c87a1763mr20389531ljn.421.1647979518634; Tue, 22 Mar 2022 13:05:18 -0700 (PDT) MIME-Version: 1.0 References: <87o871tqqu.fsf@alyssa.is> <87bl2sp3p3.fsf@alyssa.is> <20220315140604.ta433j557jsoknkv@eve> <20220315202339.6bqrzsf4yjkggbup@eve> <20220321160534.w4oifq3cdygrobrm@eve> <20220322111639.pvr5gxz6zmeu5oua@eve> In-Reply-To: <20220322111639.pvr5gxz6zmeu5oua@eve> From: Thomas Leonard Date: Tue, 22 Mar 2022 20:05:06 +0000 Message-ID: Subject: Re: Using virtio-gpu instead of virtwl To: Alyssa Ross Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: T7ZQQO7VJINVTZCYTYW4DYH6U2IID4EF X-Message-ID-Hash: T7ZQQO7VJINVTZCYTYW4DYH6U2IID4EF X-MailFrom: talex5@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-discuss.spectrum-os.org-0; header-match-discuss.spectrum-os.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: discuss@spectrum-os.org X-Mailman-Version: 3.3.5 Precedence: list List-Id: General high-level discussion about Spectrum Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, 22 Mar 2022 at 11:16, Alyssa Ross wrote: > > On Tue, Mar 22, 2022 at 11:08:15AM +0000, Thomas Leonard wrote: > > On Mon, 21 Mar 2022 at 16:05, Alyssa Ross wrote: > > > > > > On Mon, Mar 21, 2022 at 12:10:43PM +0000, Thomas Leonard wrote: > > > > Looking at the Linux virtio_gpu driver, it seems that using context= s > > > > requires virgl: > > > > > > > > static int virtio_gpu_context_init_ioctl(struct drm_device *dev, vo= id > > > > *data, struct drm_file *file) > > > > { > > > > ... > > > > if (!vgdev->has_context_init || !vgdev->has_virgl_3d) > > > > return -EINVAL; > > > > > > > > https://github.com/torvalds/linux/blob/f443e374ae131c168a065ea1748f= eac6b2e76613/drivers/gpu/drm/virtio/virtgpu_ioctl.c#L732 > > > > > > > > I think perhaps that crosvm is compiled without the "virgl_renderer= " > > > > feature (it's not in the default set), and this is causing it to cr= ash > > > > because that's also "self.default_component". I don't know how to > > > > compile crosvm with virgl enabled, though. > > > > > > It wasn't easy, but I got it to build[1]. I hope that helps. It add= s > > > both virgl_renderer and virgl_renderer_next. I think virgl_renderer > > > is on by default with --gpu, and virgl_renderer_next is used with the > > > --gpu-render-server argument. Hopefully at least one of those does t= he > > > right thing =E2=80=94 let me know! > > > > > > [1]: https://github.com/NixOS/nixpkgs/pull/165128 > > > > Thanks, that is very helpful! > > > > I gave it a try, and it got a little further. But now, doing `modprobe > > virtio_gpu` in the VM crashes crosvm with: > > > > Stack trace of thread 2: > > #0 0x00007fa5fd0915f6 abort (libc.so.6 + 0x265f6) > > #1 0x00007fa5fcfc6bfd get_dlopen_handle.part.0 (libepoxy.so.0 + 0xc7bf= d) > > #2 0x00007fa5fcfc7366 epoxy_egl_dlsym (libepoxy.so.0 + 0xc8366) [...] > > > > It looks like it should be printing a message to stderr before calling > > abort, but I don't see it > > (https://github.com/anholt/libepoxy/blob/1.5.9/src/dispatch_common.c#L3= 15). > > Did you try --disable-sandbox, like I suggested in my other mail? > The sandbox blocks writing error messages, and is something I frequently > trip over when trying to use crosvm. It's not very easy because --disable-sandbox seems to conflict with --shared-dir, which I use for lots of things. But I've now compiled a Linux kernel with "DRM_VIRTIO_GPU =3D yes" so I don't need the shared /nix to get the kernel module. With that, running with --disabled-sandbox seems to initialise the card successfully! I see: [ 1.447535] [drm] Host memory window: 0x200000000 +0x200000000 [ 1.447821] [drm] features: +virgl -edid +resource_blob +host_visible [ 1.447821] [drm] features: +context_init [ 1.449292] [drm] number of scanouts: 1 [ 1.449495] [drm] number of cap sets: 4 [DEBUG:rutabaga_gfx/src/virgl_renderer.rs:113] gl_version 32 - es profile enabled [ 1.473662] [drm] cap set 0: id 1, max-version 1, max-size 308 [ 1.474027] [drm] cap set 1: id 2, max-version 2, max-size 764 [ 1.474386] [drm] cap set 2: id 4, max-version 0, max-size 0 [ 1.474702] [drm] cap set 3: id 5, max-version 0, max-size 16 [ 1.475158] [drm] Initialized virtio_gpu 0.1.0 0 for virtio6 on minor 0 [ 1.480946] virtio_gpu virtio6: [drm] drm_plane_enable_fb_damage_clips() not called [ 1.484018] Console: switching to colour frame buffer device 160x64 [ 1.487021] virtio_gpu virtio6: [drm] fb0: virtio_gpudrmfb frame buffer device Without --disabled-sandbox, it crashes after the "number of cap sets: 4" li= ne. -- talex5 (GitHub/Twitter) http://roscidus.com/blog/