From nobody Mon Feb 9 15:46:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1621384860; cv=none; d=zohomail.com; s=zohoarc; b=fyp5D2NynutSjpF5pMCnczGen++7P3bsg1aPsGpi1jQJpXQ9pMs/hFvVM0AgsECTHJsBD1IoyCck8ISqLZO8k4DbJjR6flEU+jyxeVSWP8lap+0vgSdtBVrAyLN1Yp8MeyM5rlaG30GEj/xpjG+4pP4gPZfPtvLKbT2rEw1yHLM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621384860; h=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=ytigoouCUG1UnuMd9jNct1VSfvbP4cTeWb7ZE+e83ek=; b=XlVpA7wcS1fOjAKCIFxjE7I/tlrz+/Sxr3xr9f3G0hJ4s8c50xklfAbD2sXO+m++3Pr2qzcVkeTV/scsitN89+PWU4BI26F1de2DnnwnXCP7sD5uR9GmCkFptNtkabm+yX8OiW9PWZsPDIOGzjSPysJ/8p0k1lyNOsev77IDMTc= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1621384860051566.8179280440966; Tue, 18 May 2021 17:41:00 -0700 (PDT) Received: from localhost ([::1]:54938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljAGd-00079N-V3 for importer@patchew.org; Tue, 18 May 2021 20:40:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljA3R-0003Na-5U for qemu-devel@nongnu.org; Tue, 18 May 2021 20:27:17 -0400 Received: from mga09.intel.com ([134.134.136.24]:43019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljA3P-0006XW-9j for qemu-devel@nongnu.org; Tue, 18 May 2021 20:27:16 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2021 17:26:42 -0700 Received: from vkasired-desk2.fm.intel.com ([10.105.128.127]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2021 17:26:42 -0700 IronPort-SDR: g9pNHzR3r+hvexQ9Vx16u7KVYC0+CnH9OKl7563VXYRay76/6dHN/THqDHtzDuvptIRM+gZYeg uamDhJGaXO3A== X-IronPort-AV: E=McAfee;i="6200,9189,9988"; a="200902447" X-IronPort-AV: E=Sophos;i="5.82,310,1613462400"; d="scan'208";a="200902447" IronPort-SDR: ofw5QzudYbtJHJM2TetsparwtDl1DYzTpu0imZCs8L+DZlZlmFvMJ+uPs40DZ2HNh3xyjVrPU+ 9jNVnvDMarOw== X-IronPort-AV: E=Sophos;i="5.82,310,1613462400"; d="scan'208";a="394177389" From: Vivek Kasireddy To: qemu-devel@nongnu.org Subject: [PATCH v5 11/13] virtio-gpu: Factor out update scanout Date: Tue, 18 May 2021 17:14:12 -0700 Message-Id: <20210519001414.786439-12-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210519001414.786439-1-vivek.kasireddy@intel.com> References: <20210519001414.786439-1-vivek.kasireddy@intel.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=134.134.136.24; envelope-from=vivek.kasireddy@intel.com; helo=mga09.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, 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: Vivek Kasireddy , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Creating a small helper function for updating the scanout will be useful in the next patch where this needs to be done early in do_set_scanout before returning. Cc: Gerd Hoffmann Signed-off-by: Vivek Kasireddy --- hw/display/virtio-gpu.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index e35c59f74f..9118924018 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -558,6 +558,28 @@ static void virtio_unref_resource(pixman_image_t *imag= e, void *data) pixman_image_unref(data); } =20 +static void virtio_gpu_update_scanout(VirtIOGPU *g, + uint32_t scanout_id, + struct virtio_gpu_simple_resource *r= es, + struct virtio_gpu_rect *r) +{ + struct virtio_gpu_simple_resource *ores; + struct virtio_gpu_scanout *scanout; + + scanout =3D &g->parent_obj.scanout[scanout_id]; + ores =3D virtio_gpu_find_resource(g, scanout->resource_id); + if (ores) { + ores->scanout_bitmask &=3D ~(1 << scanout_id); + } + + res->scanout_bitmask |=3D (1 << scanout_id); + scanout->resource_id =3D res->resource_id; + scanout->x =3D r->x; + scanout->y =3D r->y; + scanout->width =3D r->width; + scanout->height =3D r->height; +} + static void virtio_gpu_do_set_scanout(VirtIOGPU *g, uint32_t scanout_id, struct virtio_gpu_framebuffer *fb, @@ -565,7 +587,6 @@ static void virtio_gpu_do_set_scanout(VirtIOGPU *g, struct virtio_gpu_rect *r, uint32_t *error) { - struct virtio_gpu_simple_resource *ores; struct virtio_gpu_scanout *scanout; uint8_t *data; =20 @@ -625,17 +646,7 @@ static void virtio_gpu_do_set_scanout(VirtIOGPU *g, scanout->ds); } =20 - ores =3D virtio_gpu_find_resource(g, scanout->resource_id); - if (ores) { - ores->scanout_bitmask &=3D ~(1 << scanout_id); - } - - res->scanout_bitmask |=3D (1 << scanout_id); - scanout->resource_id =3D res->resource_id; - scanout->x =3D r->x; - scanout->y =3D r->y; - scanout->width =3D r->width; - scanout->height =3D r->height; + virtio_gpu_update_scanout(g, scanout_id, res, r); } =20 static void virtio_gpu_set_scanout(VirtIOGPU *g, --=20 2.30.2