From nobody Mon Feb 9 17:06:27 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=1620723176; cv=none; d=zohomail.com; s=zohoarc; b=SoKLwlPjlTbohDFcDLRSJkt3KqMZGDV4zpWBQVHg7pi8dz9eZ2TB9JH1AAQK9zEdX4AthQslgOwq84rY2gn7825hTh7eytyPqzzTnm5Ea0dHk06bH6+EQqIvlkmv0hQShj5uOde84Zi3KkVVf3zr6lrJ9Ey5hXmh8o0Ts+sAMs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620723176; 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=g6AWWThE88TV4KVTXfaFTy9Kn9uZpg10Imc2KJ4Wykw=; b=UuH1Gask0kMFDKxewwC2fRoDDfQlhMSKQnVRN6M/n2lYoopKfVXurjEktAvHtb/GOL7tMUIgdARmTZ4hjWgmuSBrcoeHHY35bpcrt7E79DirteDG4Or9d243lCQRuZcukDEqQBFiiopHU7p8Rygx8gh3bHiql9wc/vLNiPepQaU= 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 1620723176360948.7639140007713; Tue, 11 May 2021 01:52:56 -0700 (PDT) Received: from localhost ([::1]:34688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgO8N-0000La-5w for importer@patchew.org; Tue, 11 May 2021 04:52:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgNdt-00086D-9u for qemu-devel@nongnu.org; Tue, 11 May 2021 04:21:25 -0400 Received: from mga17.intel.com ([192.55.52.151]:32223) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgNdm-0004ul-HH for qemu-devel@nongnu.org; Tue, 11 May 2021 04:21:24 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2021 01:20:49 -0700 Received: from vkasired-desk2.fm.intel.com ([10.105.128.127]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2021 01:20:49 -0700 IronPort-SDR: mLnWeMOHUHk8metnA56VEm9GfuGmmgOmsu3ErqJ8/ajUyhR9in81eK9w8M8FeW/ERV3q/ps6ug HkYn82PrjzcA== X-IronPort-AV: E=McAfee;i="6200,9189,9980"; a="179649392" X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="179649392" IronPort-SDR: gDyZNHvPJFKnUGdxn3V6IZfCdAPjBxo8LIhqacmle/JJN7rjRqDZYOKKw+Dan5V4INw9O+esgy q0ucMeDOieJw== X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="536892206" From: Vivek Kasireddy To: qemu-devel@nongnu.org Subject: [PATCH v3 11/20] virtio-gpu: Factor out update scanout Date: Tue, 11 May 2021 01:08:09 -0700 Message-Id: <20210511080818.366985-12-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210511080818.366985-1-vivek.kasireddy@intel.com> References: <20210511080818.366985-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 , 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 1b6e586f94..f96f7590b1 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