From nobody Mon Nov 25 02:56:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1717601411; cv=none; d=zohomail.com; s=zohoarc; b=fRb7EyhZ804xLtIWKO2fvJ7r1a/TraUr2ykEdZb09UNr9ssHdmNHaSr92Z0vp7gx0Dk96xZU33hM+ZUGYe0nkfJAjiTFDUdDf9ZGZKJUsdgAjkEbxprrXVcs1k2U+42YfbWwxU2I7vSERZ311LVDoi80jlM4576+onJR5f+95KI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717601411; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3uSdqS9y8pZdwZwhzYtQ3lJ2peW+WDx3Tf5rEC64RwM=; b=PHUUNC+/uvpJcYzhz2JnqOvQSc9DZemDeDc5Y3aklZr89KivPzEJPURBXAmPvP+GuHVPORcJKHBgRVevOOUEKwfObgYpJHdJteFM9qLGK3vOnQdB3ylyUz6NeS9IGyzhKe4ADTk1TGeejZoe/x//tlDT48R4AT9RjKMv30HgJp8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717601410995349.2399162994184; Wed, 5 Jun 2024 08:30:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEsZY-0000e8-DF; Wed, 05 Jun 2024 11:29:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEsZW-0000dJ-8e for qemu-devel@nongnu.org; Wed, 05 Jun 2024 11:29:06 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sEsZR-0007Wq-KI for qemu-devel@nongnu.org; Wed, 05 Jun 2024 11:29:06 -0400 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2c19bba897bso11206a91.2 for ; Wed, 05 Jun 2024 08:29:00 -0700 (PDT) Received: from localhost ([103.192.227.74]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c284aa3161sm1518335a91.27.2024.06.05.08.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 08:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717601339; x=1718206139; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3uSdqS9y8pZdwZwhzYtQ3lJ2peW+WDx3Tf5rEC64RwM=; b=eUOggr49y5OqexxReIto7Nx16Dh2Awy6Qam8X+i9ZyTXYMX+tQV0fyt7h9R73bVGfI 3oAjXdNyfj6BG5WFEhADlsfsJFO7KSLWMDUb9i4Pq69wOKm51/Po6Dk/cIjYg0zEsTuk LOio3rMr4x1J9m9wzlTNZ+nkU5KXZw1g+cmJWUPVanwoQiO2OZAc0PcvvvS2cae/oSYO jIF0wri2Qihf8enZeib0o6DFaZTos5xyC5QKipNidesn/grE0+gXY9qg01xMC/T9K9wI 2mpbdBriewB/A2wSsWfNajIl8WfBu464FA6GWCKqaLUTkt3SebO3hLq5+TbYEfJWnEN9 gflg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717601339; x=1718206139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3uSdqS9y8pZdwZwhzYtQ3lJ2peW+WDx3Tf5rEC64RwM=; b=Qp/Vl5rHeEVVfm731dJ4WeUxhofWHlKXq0NlLTVK3S8iLmOPJJsuoA432f2Ku36GKA qcbXw656ibZxS0jYZJxmC9ZEqloSHG+3H8PSbiL30XhReH6iSiDEtzTYy/LqXcXRdS44 /1flx665tRbfEzlzflLKwXB6zcIIPIlylDgWNRDC+kA32W7BlyjJ12j/SwXyT6Ei5rVl xCwYLBgkRDqwOfTMXgPUU1bA5VuAhk7Wp+zTr2k3FZ/6EKonpZxcQt/2gHqQnsGf4lFG i8fjSsHcrw4YiYfe+hoM6zuyLH8N4IvIKm6eE9NAKv7TUd+oqIL3zfgfR7PZJBo/YrxJ /LTQ== X-Gm-Message-State: AOJu0YyCcNR72xdhP7Iu42A0MqROkG4cDomltC6Q8OmHSOOSxGrfVcA4 nn+GT/mTsaW86tSKUMb5AwssJcJqIt9ovlsM+pcm3qpaqoT2icVDwk/4opZvevM= X-Google-Smtp-Source: AGHT+IGimj//pRmrNZ48SI3fMsWEwh0xWZG0frDs34EZYEwcvCLgKdeD0hmVbeaD6yLOjxOx1umKuw== X-Received: by 2002:a17:90a:5410:b0:2bd:fa57:b361 with SMTP id 98e67ed59e1d1-2c27db10aecmr2914768a91.11.1717601339276; Wed, 05 Jun 2024 08:28:59 -0700 (PDT) From: Weifeng Liu To: qemu-devel@nongnu.org, Gurchetan Singh , "Michael S. Tsirkin" , Gerd Hoffmann Cc: Weifeng Liu , Antonio Caggiano , Huang Rui , Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 1/3] virtio-gpu: rutabaga: Properly set stride when copying resources Date: Wed, 5 Jun 2024 23:28:28 +0800 Message-ID: <20240605152832.11618-2-weifeng.liu.z@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240605152832.11618-1-weifeng.liu.z@gmail.com> References: <20240605152832.11618-1-weifeng.liu.z@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=weifeng.liu.z@gmail.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1717601412653100001 Content-Type: text/plain; charset="utf-8" The stride is not correctly assigned when copying pixel data, causing images being displayed incomplete when using 2d component of rutabaga. Signed-off-by: Weifeng Liu --- hw/display/virtio-gpu-rutabaga.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/display/virtio-gpu-rutabaga.c b/hw/display/virtio-gpu-rutab= aga.c index 17bf701a21..2ba6869606 100644 --- a/hw/display/virtio-gpu-rutabaga.c +++ b/hw/display/virtio-gpu-rutabaga.c @@ -53,6 +53,7 @@ virtio_gpu_rutabaga_update_cursor(VirtIOGPU *g, struct vi= rtio_gpu_scanout *s, transfer.z =3D 0; transfer.w =3D res->width; transfer.h =3D res->height; + transfer.stride =3D res->width * 4; transfer.d =3D 1; =20 transfer_iovec.iov_base =3D s->current_cursor->data; @@ -273,6 +274,7 @@ rutabaga_cmd_resource_flush(VirtIOGPU *g, struct virtio= _gpu_ctrl_command *cmd) transfer.z =3D 0; transfer.w =3D res->width; transfer.h =3D res->height; + transfer.stride =3D pixman_image_get_stride(res->image); transfer.d =3D 1; =20 transfer_iovec.iov_base =3D pixman_image_get_data(res->image); @@ -382,6 +384,7 @@ rutabaga_cmd_transfer_to_host_2d(VirtIOGPU *g, transfer.z =3D 0; transfer.w =3D t2d.r.width; transfer.h =3D t2d.r.height; + transfer.stride =3D t2d.r.width * 4; transfer.d =3D 1; =20 result =3D rutabaga_resource_transfer_write(vr->rutabaga, 0, t2d.resou= rce_id, --=20 2.45.0 From nobody Mon Nov 25 02:56:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1717601378; cv=none; d=zohomail.com; s=zohoarc; b=lhPoBlGcTdewpoM7blWU/D7R0By3Se0aDr1ATjeA1RlgjH87pJP4U566unA1T2VuMpu6fiAp0DH33pn5PFuj+jstZhn14iZShGgBiuPwE8Cm3oC3aC0ollaBANarH8gNuAMwAxPdiwqNZuKvOB34KCuG5V/gB30yJU6H460EO+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717601378; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=muSU+HuMkQPsObvQhf3lD7P12fVE5VIQ4NmZQsA6m0g=; b=OUhfs0qcVxJqdEbiBHDGvoj2fXj6xmhFKGMf1iqBuSjeHfmdEhoujkyQMiCHG+XIVsd4ceslHLeVc8cf3FK+0sNxKUDGAdApqf5mLe6HCn76R2PEU1iDPFjXMWPS6XoSwC5q5XgJVpykXtBGs4uI1ul0PlMS2Wa5wAKeisaFU1k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717601378578910.334762201618; Wed, 5 Jun 2024 08:29:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEsZb-0000fC-JB; Wed, 05 Jun 2024 11:29:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEsZa-0000eS-Bg for qemu-devel@nongnu.org; Wed, 05 Jun 2024 11:29:10 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sEsZU-0007XJ-KT for qemu-devel@nongnu.org; Wed, 05 Jun 2024 11:29:10 -0400 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2c1a4192d55so1883460a91.2 for ; Wed, 05 Jun 2024 08:29:04 -0700 (PDT) Received: from localhost ([103.192.227.74]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c28063a485sm1623884a91.3.2024.06.05.08.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 08:29:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717601343; x=1718206143; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=muSU+HuMkQPsObvQhf3lD7P12fVE5VIQ4NmZQsA6m0g=; b=HNOCXB6xVxdacRa22KhOY7hG1lpGE+S2Xf/ryk7tbugcUdcy3ZYXdolN1sm3QJ/3U6 /iaD/La3Fxkx/tlftVqYvGr/ugtaMsB3UyjIQLGW8Ft0kLPfcW5XGO84bPVnH7I89m1K Fm2BA/4KsTXv6Cst8NOPlXx0KEFJjS9E4+DdZWNd4Ik8X6l04ZTGNNIYyuhq0oaIoY5R pEVkUrw0Kc7PZeoAKnv0zskVlGNqwwMyVXRVB/V4yWrC6QH7xQN/KGUUfgQR9c8Ob/PC hcVOxfXn+6/9JvyNQm3nkJ4A3vnvoeQQLl6D9RlKjw1Fr0jPmDjYAFXAhq+R4Ht9dLL8 4KWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717601343; x=1718206143; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=muSU+HuMkQPsObvQhf3lD7P12fVE5VIQ4NmZQsA6m0g=; b=w2GOcYCiMWXmpL25lwHdZWMNLP2vGp1XnXzOdm2THP23F4LdWkLNfc3cl2Wn3U4+F/ huB23A+4OiIqAWz0ju3fhTt1Q+HQKRjjK3giKmnglqZZ8kSRK+qou7iT2CBzozdSwqD8 jbUUUlzadOn9SOntDWvU5jFlex3YPfHL4EYQVmq3afa1KCrV6O/qZkI9d2SdE7AiuPJs i7KbyMJ8iso/UiGdqshHKVsfFRdmkLRTh4gEu4EI2bOlfkmqOedQGznF1HCtQRgmWwFl V41PW21d4MYTog5G2KfEjw71HNcBgYqO6o4qMF5PzW/r/ij/zHq3VzF5Lms5WUVJpJ/p B7QQ== X-Gm-Message-State: AOJu0Yw1+U9q28hs57mvoeTZvwjp5nybjsy+7hzPAYjuy6ZAiL2fcO50 b0NIDfrBzC2vplKFj9lkGjbxyRooB0yfUtl44rzqVNEGJAmPqBDvVITPepNNTvY= X-Google-Smtp-Source: AGHT+IH0VUmOcWnQskUVsFXf+siPRGl4HlLJ66Psc34i7l0h1fB2Gl+Kfr7yhHO16R1XzJ4s85HSZg== X-Received: by 2002:a17:90a:ac16:b0:2bf:ac8a:c795 with SMTP id 98e67ed59e1d1-2c27db4a1e3mr3250415a91.34.1717601342914; Wed, 05 Jun 2024 08:29:02 -0700 (PDT) From: Weifeng Liu To: qemu-devel@nongnu.org, Gurchetan Singh , "Michael S. Tsirkin" , Gerd Hoffmann Cc: Weifeng Liu , Antonio Caggiano , Huang Rui , Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 2/3] virtio-gpu: rutabaga: Poll rutabaga upon events Date: Wed, 5 Jun 2024 23:28:29 +0800 Message-ID: <20240605152832.11618-3-weifeng.liu.z@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240605152832.11618-1-weifeng.liu.z@gmail.com> References: <20240605152832.11618-1-weifeng.liu.z@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=weifeng.liu.z@gmail.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1717601380523100001 Content-Type: text/plain; charset="utf-8" To make virglrenderer work properly, we must poll it periodically or when the event fd is readable, but this functionality is absent now. This change registers the event fd as a gsource to the main loop and attaches polling function as callback to the gsource. Signed-off-by: Weifeng Liu --- hw/display/virtio-gpu-rutabaga.c | 97 +++++++++++++++++++++++++++++++- include/hw/virtio/virtio-gpu.h | 1 + 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/hw/display/virtio-gpu-rutabaga.c b/hw/display/virtio-gpu-rutab= aga.c index 2ba6869606..ecb146315a 100644 --- a/hw/display/virtio-gpu-rutabaga.c +++ b/hw/display/virtio-gpu-rutabaga.c @@ -899,6 +899,93 @@ virtio_gpu_rutabaga_aio_cb(void *opaque) g_free(data); } =20 + +static void +virtio_gpu_fence_poll(void *opaque) +{ + VirtIOGPU *g =3D opaque; + VirtIOGPURutabaga *vr =3D VIRTIO_GPU_RUTABAGA(g); + + rutabaga_poll(vr->rutabaga); +} + +typedef void (*vu_watch_cb) (VirtIOGPURutabaga *dev, int condition, void *= data); + +static void +event_poll_cb(VirtIOGPURutabaga *dev, int condition, void *data) +{ + virtio_gpu_fence_poll(data); +} + +typedef struct VrSrc { + GSource parent; + VirtIOGPURutabaga *dev; + GPollFD gfd; +} VrSrc; + +static gboolean +vr_src_prepare(GSource *gsrc, gint *timeout) +{ + g_assert(timeout); + + *timeout =3D -1; + return FALSE; +} + +static gboolean +vr_src_check(GSource *gsrc) +{ + VrSrc *src =3D (VrSrc *)gsrc; + + g_assert(src); + + return src->gfd.revents & src->gfd.events; +} + +static gboolean +vr_src_dispatch(GSource *gsrc, GSourceFunc cb, gpointer data) +{ + VrSrc *src =3D (VrSrc *)gsrc; + + g_assert(src); + + ((vu_watch_cb)cb)(src->dev, src->gfd.revents, data); + + return G_SOURCE_CONTINUE; +} + +static GSourceFuncs vug_src_funcs =3D { + vr_src_prepare, + vr_src_check, + vr_src_dispatch, + NULL +}; + +static GSource * +vr_source_new(VirtIOGPURutabaga *dev, int fd, GIOCondition cond, + vu_watch_cb vu_cb, gpointer data) +{ + GSource *gsrc; + VrSrc *src; + guint id; + + g_assert(fd >=3D 0); + g_assert(vu_cb); + + gsrc =3D g_source_new(&vug_src_funcs, sizeof(VrSrc)); + g_source_set_callback(gsrc, (GSourceFunc)vu_cb, data, NULL); + src =3D (VrSrc *)gsrc; + src->dev =3D dev; + src->gfd.fd =3D fd; + src->gfd.events =3D cond; + + g_source_add_poll(gsrc, &src->gfd); + id =3D g_source_attach(gsrc, g_main_context_get_thread_default()); + g_assert(id); + + return gsrc; +} + static void virtio_gpu_rutabaga_fence_cb(uint64_t user_data, const struct rutabaga_fence *fence) @@ -954,6 +1041,7 @@ virtio_gpu_rutabaga_debug_cb(uint64_t user_data, static bool virtio_gpu_rutabaga_init(VirtIOGPU *g, Error **errp) { int result; + int poll_descriptor; struct rutabaga_builder builder =3D { 0 }; struct rutabaga_channel channel =3D { 0 }; struct rutabaga_channels channels =3D { 0 }; @@ -1031,7 +1119,14 @@ static bool virtio_gpu_rutabaga_init(VirtIOGPU *g, E= rror **errp) error_setg_errno(errp, -result, "Failed to init rutabaga"); return false; } - + result =3D rutabaga_poll_descriptor(vr->rutabaga, &poll_descriptor); + if (result) { + error_setg_errno(errp, -result, "Failed to get rutabaga poll descr= iptor"); + return false; + } + if (poll_descriptor >=3D 0) + vr->poll_event_source =3D vr_source_new(vr, poll_descriptor, G_IO_= IN, + event_poll_cb, g); return true; } =20 diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 7a59379f5a..47a4347a9e 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -261,6 +261,7 @@ struct VirtIOGPURutabaga { char *wsi; bool headless; uint32_t num_capsets; + GSource *poll_event_source; struct rutabaga *rutabaga; }; =20 --=20 2.45.0 From nobody Mon Nov 25 02:56:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1717601406; cv=none; d=zohomail.com; s=zohoarc; b=QXyTVEceNvr6omLOEIyd+UzGhsOGlSQFbxwg+4sJA4LqgWpZfIwtvKXUZM9gG5agZnIpZAd+G4XmWx20paQ/XYxw0YgPCpt+hEfqRPIr2hW0KhDDy60CbWvbgC0QXcwiNBfzYKQvVIIJGwy7ggBtfQ+BrLWg0rFzx2uZvUaoFLo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717601406; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1NL/0bUuZW5NfajYFBq9RShKw+LMyCnZCbT2JXrSd7w=; b=c0wnYX4Cf8y8IsbxQD7JcqR+nSchPNtjV2nMuoR67eWRJMHGQne+gKJlp45tygS3NuFYwmh9Z5v72Hit5Tbhx+/YBNOusCCL4mlat9roYivpERmFg2hGqcRq1jOeHx77p6Umpr4iD33XeEARCR0X3445eNTjq6rPEmB5vFLatTM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17176014068471018.058120830581; Wed, 5 Jun 2024 08:30:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEsZe-0000fo-8z; Wed, 05 Jun 2024 11:29:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEsZb-0000fF-M9 for qemu-devel@nongnu.org; Wed, 05 Jun 2024 11:29:11 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sEsZY-0007Xm-4a for qemu-devel@nongnu.org; Wed, 05 Jun 2024 11:29:11 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6f8ec7e054dso4836541b3a.2 for ; Wed, 05 Jun 2024 08:29:07 -0700 (PDT) Received: from localhost ([103.192.227.74]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702688e7e3dsm5526712b3a.215.2024.06.05.08.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 08:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717601346; x=1718206146; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1NL/0bUuZW5NfajYFBq9RShKw+LMyCnZCbT2JXrSd7w=; b=E8UCBnS7SjS/0N2a7htKeJetxuBOJxIn4Kt4JN+YvaD9iiazii49tOw1+QGXITZWQL iHjgHpQqg/wVV2M4OgdkGVPZcr38zyQ9XCJo5vtVXqjOP+spfbpAuUmATX3EhjAtVbwM MBv+neYLfAKTY5qobjPd8scvg8/2+1/EgWlw04g+mENgY/Kpss0+pswX3LQ3S6gzOeXX kHGF+4HlxZaUi2iYicZqLcHlvY5vo7lbdvp+fqdWRE4izhR1FjU8SNpnZwF4Z3FUcp1j UMW1QRXTnxGOKzfzvKkD15MAZTvdiEfGcJddEHMFLW49cJU6spMWIzqeIBmJX3DV9iTJ cyIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717601346; x=1718206146; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1NL/0bUuZW5NfajYFBq9RShKw+LMyCnZCbT2JXrSd7w=; b=pZMdE4WKwZPRzJhp6Jzajq4B3KLtUD7lmT1Fd/Gjx+r8j37qcd30+TsStHClUgnyVH ODS3wu07uLYqWddVEO17Jlzff9b5KKZ9vs+c18QALWz4v59+XfNnhYCSY5Qd9euuSow/ KxyDh8Ro5U5NUzI6oRG03vAIG9W6xN2yxckd1s649qljd0Y2rG7wQPu+KOEPK0V9AsBQ 8IwGWfMAxQMZYvJ2/zpjSmWKrEcQYEjrWoIre8Ff7D3LTpAqB3iU/oI3rHKRJlAl6/Hg cJO2D9D0W2KWa1qgLnIp1q8I9eLvc/bu+7MlAthECubM261dg0xgFbpdkovYewHO3Ek1 ToPg== X-Gm-Message-State: AOJu0YymQuG3z07t1uNhjJ1UMN3VEIROUEy0QucpFykMM4mpf0l/V/fp 1Ac9Ch5/LF7L+2PaNkJnH5j8PLVQOrIWJH5tY1prNSj+NUQVEEY7CVmKpCX8Gyw= X-Google-Smtp-Source: AGHT+IFPMAW8IAwSm4ZNYG+dmnq5PaDPTtEB06U9CzGhuEHffFjVEp1M85iwVLKuazg0gzBunycnsA== X-Received: by 2002:a05:6a00:2ea9:b0:6f8:c6e4:1829 with SMTP id d2e1a72fcca58-703e5a1bbfdmr3336205b3a.25.1717601346222; Wed, 05 Jun 2024 08:29:06 -0700 (PDT) From: Weifeng Liu To: qemu-devel@nongnu.org, Gurchetan Singh , "Michael S. Tsirkin" , Gerd Hoffmann Cc: Weifeng Liu , Antonio Caggiano , Huang Rui , Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 3/3] virtio-gpu: rutabaga: Add options to enable virgl and venus contexts Date: Wed, 5 Jun 2024 23:28:30 +0800 Message-ID: <20240605152832.11618-4-weifeng.liu.z@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240605152832.11618-1-weifeng.liu.z@gmail.com> References: <20240605152832.11618-1-weifeng.liu.z@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=weifeng.liu.z@gmail.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1717601408626100001 Content-Type: text/plain; charset="utf-8" With this change, people will be able to use parameter like the one below to add start virglrenderer backed virtio-gpu-rutabaga device: -device virtio-vga-rutabaga,venus=3Don,virgl2=3Don,wsi=3Dsurfaceless Performance being suboptimal though, this would be the first step. Signed-off-by: Weifeng Liu --- hw/display/virtio-gpu-rutabaga.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/display/virtio-gpu-rutabaga.c b/hw/display/virtio-gpu-rutab= aga.c index ecb146315a..85bc33af8c 100644 --- a/hw/display/virtio-gpu-rutabaga.c +++ b/hw/display/virtio-gpu-rutabaga.c @@ -1203,6 +1203,10 @@ static Property virtio_gpu_rutabaga_properties[] =3D= { RUTABAGA_CAPSET_GFXSTREAM_GLES, false), DEFINE_PROP_BIT64("x-gfxstream-composer", VirtIOGPURutabaga, capset_ma= sk, RUTABAGA_CAPSET_GFXSTREAM_COMPOSER, false), + DEFINE_PROP_BIT64("venus", VirtIOGPURutabaga, capset_mask, + RUTABAGA_CAPSET_VENUS, false), + DEFINE_PROP_BIT64("virgl2", VirtIOGPURutabaga, capset_mask, + RUTABAGA_CAPSET_VIRGL2, false), DEFINE_PROP_STRING("wayland-socket-path", VirtIOGPURutabaga, wayland_socket_path), DEFINE_PROP_STRING("wsi", VirtIOGPURutabaga, wsi), --=20 2.45.0