From nobody Mon Feb 9 23:02:05 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=1618902685; cv=none; d=zohomail.com; s=zohoarc; b=lgID6Tz459Vviv5HzvyEvMd+ihCED12e9v8EK+lG50/QDzf70XDrAF1Vz1TAQbKJK8pAB8pbOCHXoH3YgyZ71jJFBc/HvPQDIpOPvrApGvDleu94XqeqFfCjb1D9aTPPhLLvxBe7HfTAqWuaK0gdfeVowt89ptGfyeKRNeN0kBQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618902685; 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=N3F2m7YRp4IFlHq5Jwbi0QESdjijoNiKk9l/Qv2z6Wc=; b=EO4YvfafIAT+aziFZvAVxXtORLm9+NZ4An5NuCjstnisiGS7s1lnn9KnXGpe6nvfI+pLg63k0HLfghodDvswS8O98SBmHCPJoCC8Az9cCpugAYIJbj4kxQni2X7AgURVZnYymIIJXQmueDSImIpaKlFA1M+Fm4jH2qJjBwoua1o= 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 1618902685382618.99168173738; Tue, 20 Apr 2021 00:11:25 -0700 (PDT) Received: from localhost ([::1]:48680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYkXc-0003mA-9M for importer@patchew.org; Tue, 20 Apr 2021 03:11:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYkSN-0003SU-CJ for qemu-devel@nongnu.org; Tue, 20 Apr 2021 03:05:59 -0400 Received: from mga17.intel.com ([192.55.52.151]:17751) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYkSL-0002hb-5D for qemu-devel@nongnu.org; Tue, 20 Apr 2021 03:05:59 -0400 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 00:05:37 -0700 Received: from vkasired-desk2.fm.intel.com ([10.105.128.127]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 00:05:37 -0700 IronPort-SDR: gkJ6uS54Wtuhs4Vmo0JzJ1IA+Pd+IKpi+8RLPOhfUR69gAk6terKSh5BmmeNRwx1GnKWwqI9Cu NRFWPoj2COcg== X-IronPort-AV: E=McAfee;i="6200,9189,9959"; a="175563732" X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="175563732" IronPort-SDR: HCes4WB4NR4y0Yb0QpNTKOVlvrJLnx2LXgqqYiilWC5BAhQyFSM4CCtP8N3E6zt0d1wt7cGVDW LRmyLui5epMA== X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="420293146" From: Vivek Kasireddy To: qemu-devel@nongnu.org Subject: [PATCH v2 10/12] virtio-gpu: Factor out update scanout Date: Mon, 19 Apr 2021 23:53:45 -0700 Message-Id: <20210420065347.2685768-11-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210420065347.2685768-1-vivek.kasireddy@intel.com> References: <20210420065347.2685768-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=192.55.52.151; envelope-from=vivek.kasireddy@intel.com; helo=mga17.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, 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 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. 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 511addf811..0b432feb00 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -601,6 +601,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, @@ -608,7 +630,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 @@ -668,17 +689,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.26.2