From nobody Tue Feb 10 20:28:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615543950; cv=none; d=zohomail.com; s=zohoarc; b=BOUbAIVjuMVqRrNnTVlnT33PoMduj/PpsLSP0bjgm3WluIqg6YHDI9LkCsMSAKooI0GgRxmAlTimYEgkJI6yzP4sJMxcqNHdZ6572ceMbtQ2e1r0cCI7G3ZXUqyl0X+zgvmnIaCYjr+wqhK4FmDE0m1BbEom+hZdPFP6FvRwcnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615543950; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=29uN9b+TR+Ruixt9pZtraK6VYZFptSAxO2ZoujOTlps=; b=PJqgS8TLnS6mu1nbwBNGpbPThQ9zsElt5m9OMdyCzRkB/UpfdhgiwccNb/iOE24Xh/tjD/zmwSN6n/YBv9IsLEbOSjQTA/Qq/FxdOHajy7kFssbcjTw6iyP4duuif9UdUQ6nlVqNGSXvyIhWSrjSNBMS83cpzUQgqxw5znZZYw4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615543950930997.4343202946787; Fri, 12 Mar 2021 02:12:30 -0800 (PST) Received: from localhost ([::1]:54894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKemT-00057t-Pz for importer@patchew.org; Fri, 12 Mar 2021 05:12:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKees-0001y6-JU for qemu-devel@nongnu.org; Fri, 12 Mar 2021 05:04:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60239) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lKeeq-0003pI-Qm for qemu-devel@nongnu.org; Fri, 12 Mar 2021 05:04:38 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-271--sNotPwCOPmCavaSvDuFMw-1; Fri, 12 Mar 2021 05:04:34 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B08319200C0 for ; Fri, 12 Mar 2021 10:04:33 +0000 (UTC) Received: from localhost (unknown [10.36.110.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E8DF5C1C5; Fri, 12 Mar 2021 10:04:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615543476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=29uN9b+TR+Ruixt9pZtraK6VYZFptSAxO2ZoujOTlps=; b=YNaeS1apmZVlOrFfPERBBP3QfBvkY570DQVDd7jprqEGotHyP2HwDYtkLtykzgcqrCChWc o9cay8D9gPURyXXo4qSAQbmSGi+BAD8PQF5c42n7b/OdNRGlSD6dpDQPm6zsGwuaFt4mma 0KJLYmfQq8QLl7OQ4Cla2oAg1XECO+o= X-MC-Unique: -sNotPwCOPmCavaSvDuFMw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 18/27] vhost-user-gpu: add vg_send_dmabuf_update() Date: Fri, 12 Mar 2021 14:00:59 +0400 Message-Id: <20210312100108.2706195-19-marcandre.lureau@redhat.com> In-Reply-To: <20210312100108.2706195-1-marcandre.lureau@redhat.com> References: <20210312100108.2706195-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" 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=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- contrib/vhost-user-gpu/vugpu.h | 6 +++++ contrib/vhost-user-gpu/vhost-user-gpu.c | 32 +++++++++++++++---------- contrib/vhost-user-gpu/virgl.c | 11 +-------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/contrib/vhost-user-gpu/vugpu.h b/contrib/vhost-user-gpu/vugpu.h index 759de56502..f2e80d255d 100644 --- a/contrib/vhost-user-gpu/vugpu.h +++ b/contrib/vhost-user-gpu/vugpu.h @@ -188,5 +188,11 @@ void vg_send_dmabuf_scanout(VuGpu *g, int fd_drm_fourcc, uint32_t fd_flags, int fd); +void vg_send_dmabuf_update(VuGpu *g, + uint32_t scanout_id, + uint32_t x, + uint32_t y, + uint32_t width, + uint32_t height); =20 #endif diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-g= pu/vhost-user-gpu.c index 8c3ee8aad8..fc8e62f20e 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -618,6 +618,25 @@ vg_send_dmabuf_scanout(VuGpu *g, vg_send_msg(g, &msg, fd); } =20 +void +vg_send_dmabuf_update(VuGpu *g, + uint32_t scanout_id, + uint32_t x, + uint32_t y, + uint32_t width, + uint32_t height) +{ + VhostUserGpuMsg msg =3D { + .request =3D VHOST_USER_GPU_DMABUF_UPDATE, + .size =3D sizeof(VhostUserGpuUpdate), + .payload.update.scanout_id =3D scanout_id, + .payload.update.x =3D x, + .payload.update.y =3D y, + .payload.update.width =3D width, + .payload.update.height =3D height + }; + vg_send_msg(g, &msg, -1); +} =20 static void vg_set_scanout(VuGpu *g, @@ -765,18 +784,7 @@ vg_resource_flush(VuGpu *g, size_t height =3D extents->y2 - extents->y1; =20 if (vugbm_buffer_can_get_dmabuf_fd(&res->buffer)) { - VhostUserGpuMsg vmsg =3D { - .request =3D VHOST_USER_GPU_DMABUF_UPDATE, - .size =3D sizeof(VhostUserGpuUpdate), - .payload.update =3D (VhostUserGpuUpdate) { - .scanout_id =3D i, - .x =3D extents->x1, - .y =3D extents->y1, - .width =3D width, - .height =3D height, - } - }; - vg_send_msg(g, &vmsg, -1); + vg_send_dmabuf_update(g, i, extents->x1, extents->y1, width, h= eight); vg_wait_ok(g); } else { size_t bpp =3D diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c index 0c7f118556..b17cf22986 100644 --- a/contrib/vhost-user-gpu/virgl.c +++ b/contrib/vhost-user-gpu/virgl.c @@ -370,16 +370,7 @@ virgl_cmd_resource_flush(VuGpu *g, if (g->scanout[i].resource_id !=3D rf.resource_id) { continue; } - VhostUserGpuMsg msg =3D { - .request =3D VHOST_USER_GPU_DMABUF_UPDATE, - .size =3D sizeof(VhostUserGpuUpdate), - .payload.update.scanout_id =3D i, - .payload.update.x =3D rf.r.x, - .payload.update.y =3D rf.r.y, - .payload.update.width =3D rf.r.width, - .payload.update.height =3D rf.r.height - }; - vg_send_msg(g, &msg, -1); + vg_send_dmabuf_update(g, i, rf.r.x, rf.r.y, rf.r.width, rf.r.heigh= t); vg_wait_ok(g); } } --=20 2.29.0