From nobody Mon Feb 9 21:11:56 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=1620774582; cv=none; d=zohomail.com; s=zohoarc; b=iyPE+Fz5CqrL5oTIxKxReicfIUaXj7h3QXPaYek3qPYnBodNq75shhPisp4jpx8pP2M1fpG+rs/x9DslUMZwRdv6kyX6s5C2EGIs2BH0WUqEhXC7GDvHs0srli4W+0eG8rDuBM3Ylgn69YCb4KgSZUGxrjWAC4a3jR3WSzx9UCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620774582; 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=Bn8H7BJH93jOr0zy8QUPrZvYor7+jRCuDVe9XgS00uz6ajgXJWbkR7Zet4KL1+rJtGrJlEnGAx0cf7tfQjkBsT8OzL+UGeA50e9C+n46GWXQRKe9xLcKj1L+d/0iVqy8XF3P3P8gNNynTfvQizo91h4sSrLY7eRQ6mIHhhDedps= 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 1620774582959871.7697637256731; Tue, 11 May 2021 16:09:42 -0700 (PDT) Received: from localhost ([::1]:42322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgbVS-0000ei-1y for importer@patchew.org; Tue, 11 May 2021 19:09:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgbMU-00084t-Hf for qemu-devel@nongnu.org; Tue, 11 May 2021 19:00:22 -0400 Received: from mga05.intel.com ([192.55.52.43]:2838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgbMI-0006Ez-Lk for qemu-devel@nongnu.org; Tue, 11 May 2021 19:00:22 -0400 Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2021 15:59:44 -0700 Received: from vkasired-desk2.fm.intel.com ([10.105.128.127]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2021 15:59:42 -0700 IronPort-SDR: PIUaBcu/F3GtNeO60dzDPNHjKxnM0LjEesR2sT1MPlfX/C2p+W4fPdUBGlASjpuESkY72N+eiH YlfoIqhmv5KQ== X-IronPort-AV: E=McAfee;i="6200,9189,9981"; a="285065726" X-IronPort-AV: E=Sophos;i="5.82,291,1613462400"; d="scan'208";a="285065726" IronPort-SDR: cYDOYBqBN7fvAErO6QJsuuFDrS5b6bdSmnWJdK3dcIxndo1z/r1SvRwCzf+bfDpzYpVN8Tr9v9 HPUx9ba9sP6Q== X-IronPort-AV: E=Sophos;i="5.82,291,1613462400"; d="scan'208";a="436883324" From: Vivek Kasireddy To: qemu-devel@nongnu.org Subject: [PATCH v4 11/13] virtio-gpu: Factor out update scanout Date: Tue, 11 May 2021 15:47:17 -0700 Message-Id: <20210511224719.387443-12-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210511224719.387443-1-vivek.kasireddy@intel.com> References: <20210511224719.387443-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.43; envelope-from=vivek.kasireddy@intel.com; helo=mga05.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 , 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