From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388377; cv=none; d=zohomail.com; s=zohoarc; b=mN5re6hwSUaMFGMKhPYPCWjgEPg7+iMEk1jjXOWXpM5r4LciGkdtwkOLGSJd88nPQr1N/eLOrdTU+IGv4J+X14876e8Yr+qKcwDKTNzPLop7ESNcYzUyK4mtdNyxm/+4cm5KE+fna7H0vDbE5LOaxVtLxLzSQ6T7vd7NQ2VIkug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388377; 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=8JgoV9DyBC4I5as6d16nfE36whQc6bRk+BIaAlgOP6A=; b=QXYNC1pS/x/oeM8n5Iu5bRXcdEoqBGRtYu6ycADi6lLHSiAbAoqAY1B7lrZLsjjynCY0LOBuFgo4uHQn7xtvkHdZzSafrJr2QJEdexPTrSMxN1E5qabZXz/fz21E3WencK+Bz3Rm8adgQuDqbQx70K9pfyuxe5wifpLUOD2jj0c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388377881311.9061112364775; Wed, 30 Aug 2023 02:39:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHf8-0007Fc-3L; Wed, 30 Aug 2023 05:38:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHf6-0007FM-Uz for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:38:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHf4-0000pm-B7 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:38:56 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-645-seTbFyxOMv-QUDUur7z4wQ-1; Wed, 30 Aug 2023 05:38:52 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE44D101A53C for ; Wed, 30 Aug 2023 09:38:51 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01A7E403168; Wed, 30 Aug 2023 09:38:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388333; 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=8JgoV9DyBC4I5as6d16nfE36whQc6bRk+BIaAlgOP6A=; b=aPZaIvtGjJ5Y0s16RDFZcm0dLFeWTA0RwwDYT3xCcjJTKyo6Kr9Dr0xQa7ccGJuzx9DOBk eybg5/MlEwZa9g9jQwdJzrRwtRMhJdAe7I5ajV9lVw/wteot2RN8dcVF5pVYqu1ihuQZOW fIn8ukpZ+HNRY6PLK29CGAhdUlVLn44= X-MC-Unique: seTbFyxOMv-QUDUur7z4wQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 01/67] ui: remove qemu_pixman_color() helper Date: Wed, 30 Aug 2023 13:37:35 +0400 Message-ID: <20230830093843.3531473-2-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388379034100003 From: Marc-Andr=C3=A9 Lureau Usage removed in commit e27bd65a72d ("console: switch color_table_rgb to pi= xman_color_t") Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/ui/qemu-pixman.h | 1 - ui/qemu-pixman.c | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h index 0c775604d1..fd78d17124 100644 --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@ -78,7 +78,6 @@ pixman_image_t *qemu_pixman_mirror_create(pixman_format_c= ode_t format, pixman_image_t *image); void qemu_pixman_image_unref(pixman_image_t *image); =20 -pixman_color_t qemu_pixman_color(PixelFormat *pf, uint32_t color); pixman_image_t *qemu_pixman_glyph_from_vgafont(int height, const uint8_t *= font, unsigned int ch); void qemu_pixman_glyph_render(pixman_image_t *glyph, diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c index e4f024a85e..c5053cd326 100644 --- a/ui/qemu-pixman.c +++ b/ui/qemu-pixman.c @@ -226,17 +226,6 @@ void qemu_pixman_image_unref(pixman_image_t *image) pixman_image_unref(image); } =20 -pixman_color_t qemu_pixman_color(PixelFormat *pf, uint32_t color) -{ - pixman_color_t c; - - c.red =3D ((color & pf->rmask) >> pf->rshift) << (16 - pf->rbits); - c.green =3D ((color & pf->gmask) >> pf->gshift) << (16 - pf->gbits); - c.blue =3D ((color & pf->bmask) >> pf->bshift) << (16 - pf->bbits); - c.alpha =3D ((color & pf->amask) >> pf->ashift) << (16 - pf->abits); - return c; -} - pixman_image_t *qemu_pixman_glyph_from_vgafont(int height, const uint8_t *= font, unsigned int ch) { --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388367; cv=none; d=zohomail.com; s=zohoarc; b=BrHJIDnCtc0uayfvQ/vi7A1pyydh8IhZZplqi5PDQXgbIvRxmdEzy0satTKPSD1Enm3Fu8jHgrnxEhFokWvo5xORpBgGUBpRwK32bdYQoIlbRtI+PCuW9OIhiZFwbdpjcsqVAOrVq2RJkK01+uSeq4fNmywlLsZVTFBwzpXKRv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388367; 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=Gh2udv7f3z4GM5pcT/1Ns4j3PLWwCim7+/8rj7t05/o=; b=UDUWY86xSF4O6u/WvHEhcc2HQRV0VU8SVS/VofhcYHBbtZk/roanqNsEypEFJF69ZJL+7P5UhRghB0RGxm3Hn/sPVFPrusVfMhnwDrBOs3VHzDGbEkucBiaHkoTzgUQLZ3c4G/MdN2FC8VBkCP8TthQBTmNmqxnIbv8grVnOyXE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388367406225.32513522236604; Wed, 30 Aug 2023 02:39:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfB-0007Gl-Kq; Wed, 30 Aug 2023 05:39:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfA-0007Fu-8g for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHf8-0000q7-4j for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:00 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-333-Eczibkq3Mza_awWcgV4iBw-1; Wed, 30 Aug 2023 05:38:55 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8F2A33C100BC for ; Wed, 30 Aug 2023 09:38:55 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6FEF112131B; Wed, 30 Aug 2023 09:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388337; 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=Gh2udv7f3z4GM5pcT/1Ns4j3PLWwCim7+/8rj7t05/o=; b=NEf8RWbfYvrXVde9MFKK36lXQKikUvH8RMUVxeoxPbnIKmWEtdGsveGgSt+NZM2OGdkklt 6O8zdYUyvXuSvk6telbwpsTtp5YFEaGiqAJUNt4g8ZPlA9HEhrjieVDgPiFgpTF7M2UJyP bZcxNd/pwYwrKAW3xuyeMi15mIh66FE= X-MC-Unique: Eczibkq3Mza_awWcgV4iBw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 02/67] ui: remove qemu_pixman_linebuf_copy() Date: Wed, 30 Aug 2023 13:37:36 +0400 Message-ID: <20230830093843.3531473-3-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388370261100007 From: Marc-Andr=C3=A9 Lureau Since commit 43c7d8bd449 ("console: add qemu_pixman_linebuf_copy"), it seems it was never used. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- include/ui/qemu-pixman.h | 2 -- ui/qemu-pixman.c | 8 -------- 2 files changed, 10 deletions(-) diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h index fd78d17124..ce4518e4de 100644 --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@ -72,8 +72,6 @@ pixman_image_t *qemu_pixman_linebuf_create(pixman_format_= code_t format, int width); void qemu_pixman_linebuf_fill(pixman_image_t *linebuf, pixman_image_t *fb, int width, int x, int y); -void qemu_pixman_linebuf_copy(pixman_image_t *fb, int width, int x, int y, - pixman_image_t *linebuf); pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format, pixman_image_t *image); void qemu_pixman_image_unref(pixman_image_t *image); diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c index c5053cd326..be00a96340 100644 --- a/ui/qemu-pixman.c +++ b/ui/qemu-pixman.c @@ -200,14 +200,6 @@ void qemu_pixman_linebuf_fill(pixman_image_t *linebuf,= pixman_image_t *fb, x, y, 0, 0, 0, 0, width, 1); } =20 -/* copy linebuf to framebuffer */ -void qemu_pixman_linebuf_copy(pixman_image_t *fb, int width, int x, int y, - pixman_image_t *linebuf) -{ - pixman_image_composite(PIXMAN_OP_SRC, linebuf, NULL, fb, - 0, 0, 0, 0, x, y, width, 1); -} - pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format, pixman_image_t *image) { --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388433; cv=none; d=zohomail.com; s=zohoarc; b=Yr/VuLsmjty+Gd/odayr7Mc5qRJLUfkrVVTzE5hptBgLZcBnhblmUGxsqI7/usasli63piMYW03iORDSrbXBmFHF3Ao1nOztsAfIddZDlJS/AiuxdP93gftiELT7UqcqKVvcjfdpiqSn/sXQ5xDQLEs7/Il/9jhbiGG4WdckXlo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388433; 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=AuVuMGJsiYmwbdBBI6wvk9ev6QPZ1q/xOR0O8MFCN0U=; b=Bvtf2f03ySah/vqTA/OaZIceJiKOGxB0chCw9ubet0hssQYP4onz+9LWb7ZpfkFPavJLyUcT9zv+v2Zk9doG4UeFnsWPWbqU31mxY7izMKkUmRP4n6nU30zNNT/dpMNmDCK1fmxL5JysXLWhg1y1ue+2IJtcGZzHWBZQXSk4rbk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388433275621.3978215668976; Wed, 30 Aug 2023 02:40:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfG-0007Ha-9L; Wed, 30 Aug 2023 05:39:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfF-0007HB-46 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfC-0000qW-Bl for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:04 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-632-sFhYuKj3Nxaec0av0lae-A-1; Wed, 30 Aug 2023 05:39:00 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A61CB185A793 for ; Wed, 30 Aug 2023 09:38:59 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3807063F6C; Wed, 30 Aug 2023 09:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388341; 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=AuVuMGJsiYmwbdBBI6wvk9ev6QPZ1q/xOR0O8MFCN0U=; b=YJG3uUX7rSJLdq9f14xlOJWUbVTEO0kz/yZVKVqC34CpahgH0xoBw0bjunbYiAgorQzUn/ 6YkCOF7E2bouilvh+TQJtKe/9R3dBu0P9/Qnp5CqQJcpkUXzKzvLuRo4gpK52eLSfAJp5h 8gwG0vXoL6ULUQINriWiWhhSRLa/3eQ= X-MC-Unique: sFhYuKj3Nxaec0av0lae-A-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 03/67] ui/qmp: move screendump to ui-qmp-cmds.c Date: Wed, 30 Aug 2023 13:37:37 +0400 Message-ID: <20230830093843.3531473-4-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388435384100007 From: Marc-Andr=C3=A9 Lureau console.c unit is over-crowded. This code is specific to the handling of the QMP screendump command, so move it in ui-qmp-cmds. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- include/ui/console.h | 1 + ui/console.c | 212 ++++--------------------------------------- ui/ui-qmp-cmds.c | 187 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 205 insertions(+), 195 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 3e8b22d6c6..1b08b0f8ad 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -504,6 +504,7 @@ void qemu_console_set_window_id(QemuConsole *con, int w= indow_id); void console_select(unsigned int index); void qemu_console_resize(QemuConsole *con, int width, int height); DisplaySurface *qemu_console_surface(QemuConsole *con); +void coroutine_fn qemu_console_co_wait_update(QemuConsole *con); =20 /* console-gl.c */ #ifdef CONFIG_OPENGL diff --git a/ui/console.c b/ui/console.c index 8da2170a7e..9c17024dbc 100644 --- a/ui/console.c +++ b/ui/console.c @@ -28,8 +28,8 @@ #include "qapi/error.h" #include "qapi/qapi-commands-ui.h" #include "qemu/coroutine.h" -#include "qemu/error-report.h" #include "qemu/fifo8.h" +#include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/option.h" @@ -37,11 +37,7 @@ #include "chardev/char.h" #include "trace.h" #include "exec/memory.h" -#include "io/channel-file.h" #include "qom/object.h" -#ifdef CONFIG_PNG -#include -#endif =20 #define DEFAULT_BACKSCROLL 512 #define CONSOLE_CURSOR_PERIOD 500 @@ -239,6 +235,22 @@ void graphic_hw_update(QemuConsole *con) } } =20 +static void graphic_hw_update_bh(void *con) +{ + graphic_hw_update(con); +} + +void qemu_console_co_wait_update(QemuConsole *con) +{ + if (qemu_co_queue_empty(&con->dump_queue)) { + /* Defer the update, it will restart the pending coroutines */ + aio_bh_schedule_oneshot(qemu_get_aio_context(), + graphic_hw_update_bh, con); + } + qemu_co_queue_wait(&con->dump_queue, NULL); + +} + static void graphic_hw_gl_unblock_timer(void *opaque) { warn_report("console: no gl-unblock within one second"); @@ -292,196 +304,6 @@ void graphic_hw_invalidate(QemuConsole *con) } } =20 -#ifdef CONFIG_PNG -/** - * png_save: Take a screenshot as PNG - * - * Saves screendump as a PNG file - * - * Returns true for success or false for error. - * - * @fd: File descriptor for PNG file. - * @image: Image data in pixman format. - * @errp: Pointer to an error. - */ -static bool png_save(int fd, pixman_image_t *image, Error **errp) -{ - int width =3D pixman_image_get_width(image); - int height =3D pixman_image_get_height(image); - png_struct *png_ptr; - png_info *info_ptr; - g_autoptr(pixman_image_t) linebuf =3D - qemu_pixman_linebuf_create(PIXMAN_BE_r8g8b8, width); - uint8_t *buf =3D (uint8_t *)pixman_image_get_data(linebuf); - FILE *f =3D fdopen(fd, "wb"); - int y; - if (!f) { - error_setg_errno(errp, errno, - "Failed to create file from file descriptor"); - return false; - } - - png_ptr =3D png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, - NULL, NULL); - if (!png_ptr) { - error_setg(errp, "PNG creation failed. Unable to write struct"); - fclose(f); - return false; - } - - info_ptr =3D png_create_info_struct(png_ptr); - - if (!info_ptr) { - error_setg(errp, "PNG creation failed. Unable to write info"); - fclose(f); - png_destroy_write_struct(&png_ptr, &info_ptr); - return false; - } - - png_init_io(png_ptr, f); - - png_set_IHDR(png_ptr, info_ptr, width, height, 8, - PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - - png_write_info(png_ptr, info_ptr); - - for (y =3D 0; y < height; ++y) { - qemu_pixman_linebuf_fill(linebuf, image, width, 0, y); - png_write_row(png_ptr, buf); - } - - png_write_end(png_ptr, NULL); - - png_destroy_write_struct(&png_ptr, &info_ptr); - - if (fclose(f) !=3D 0) { - error_setg_errno(errp, errno, - "PNG creation failed. Unable to close file"); - return false; - } - - return true; -} - -#else /* no png support */ - -static bool png_save(int fd, pixman_image_t *image, Error **errp) -{ - error_setg(errp, "Enable PNG support with libpng for screendump"); - return false; -} - -#endif /* CONFIG_PNG */ - -static bool ppm_save(int fd, pixman_image_t *image, Error **errp) -{ - int width =3D pixman_image_get_width(image); - int height =3D pixman_image_get_height(image); - g_autoptr(Object) ioc =3D OBJECT(qio_channel_file_new_fd(fd)); - g_autofree char *header =3D NULL; - g_autoptr(pixman_image_t) linebuf =3D NULL; - int y; - - trace_ppm_save(fd, image); - - header =3D g_strdup_printf("P6\n%d %d\n%d\n", width, height, 255); - if (qio_channel_write_all(QIO_CHANNEL(ioc), - header, strlen(header), errp) < 0) { - return false; - } - - linebuf =3D qemu_pixman_linebuf_create(PIXMAN_BE_r8g8b8, width); - for (y =3D 0; y < height; y++) { - qemu_pixman_linebuf_fill(linebuf, image, width, 0, y); - if (qio_channel_write_all(QIO_CHANNEL(ioc), - (char *)pixman_image_get_data(linebuf), - pixman_image_get_stride(linebuf), errp) = < 0) { - return false; - } - } - - return true; -} - -static void graphic_hw_update_bh(void *con) -{ - graphic_hw_update(con); -} - -/* Safety: coroutine-only, concurrent-coroutine safe, main thread only */ -void coroutine_fn -qmp_screendump(const char *filename, const char *device, - bool has_head, int64_t head, - bool has_format, ImageFormat format, Error **errp) -{ - g_autoptr(pixman_image_t) image =3D NULL; - QemuConsole *con; - DisplaySurface *surface; - int fd; - - if (device) { - con =3D qemu_console_lookup_by_device_name(device, has_head ? head= : 0, - errp); - if (!con) { - return; - } - } else { - if (has_head) { - error_setg(errp, "'head' must be specified together with 'devi= ce'"); - return; - } - con =3D qemu_console_lookup_by_index(0); - if (!con) { - error_setg(errp, "There is no console to take a screendump fro= m"); - return; - } - } - - if (qemu_co_queue_empty(&con->dump_queue)) { - /* Defer the update, it will restart the pending coroutines */ - aio_bh_schedule_oneshot(qemu_get_aio_context(), - graphic_hw_update_bh, con); - } - qemu_co_queue_wait(&con->dump_queue, NULL); - - /* - * All pending coroutines are woken up, while the BQL is held. No - * further graphic update are possible until it is released. Take - * an image ref before that. - */ - surface =3D qemu_console_surface(con); - if (!surface) { - error_setg(errp, "no surface"); - return; - } - image =3D pixman_image_ref(surface->image); - - fd =3D qemu_open_old(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY= , 0666); - if (fd =3D=3D -1) { - error_setg(errp, "failed to open file '%s': %s", filename, - strerror(errno)); - return; - } - - /* - * The image content could potentially be updated as the coroutine - * yields and releases the BQL. It could produce corrupted dump, but - * it should be otherwise safe. - */ - if (has_format && format =3D=3D IMAGE_FORMAT_PNG) { - /* PNG format specified for screendump */ - if (!png_save(fd, image, errp)) { - qemu_unlink(filename); - } - } else { - /* PPM format specified/default for screendump */ - if (!ppm_save(fd, image, errp)) { - qemu_unlink(filename); - } - } -} - void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata) { if (!con) { diff --git a/ui/ui-qmp-cmds.c b/ui/ui-qmp-cmds.c index a37a7024f3..debc07d678 100644 --- a/ui/ui-qmp-cmds.c +++ b/ui/ui-qmp-cmds.c @@ -14,13 +14,20 @@ */ =20 #include "qemu/osdep.h" + +#include "io/channel-file.h" #include "monitor/qmp-helpers.h" #include "qapi/qapi-commands-ui.h" #include "qapi/qmp/qerror.h" +#include "qemu/coroutine.h" #include "qemu/cutils.h" +#include "trace.h" #include "ui/console.h" #include "ui/dbus-display.h" #include "ui/qemu-spice.h" +#ifdef CONFIG_PNG +#include +#endif =20 void qmp_set_password(SetPasswordOptions *opts, Error **errp) { @@ -204,3 +211,183 @@ void qmp_client_migrate_info(const char *protocol, co= nst char *hostname, =20 error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "'spice'"); } + +#ifdef CONFIG_PNG +/** + * png_save: Take a screenshot as PNG + * + * Saves screendump as a PNG file + * + * Returns true for success or false for error. + * + * @fd: File descriptor for PNG file. + * @image: Image data in pixman format. + * @errp: Pointer to an error. + */ +static bool png_save(int fd, pixman_image_t *image, Error **errp) +{ + int width =3D pixman_image_get_width(image); + int height =3D pixman_image_get_height(image); + png_struct *png_ptr; + png_info *info_ptr; + g_autoptr(pixman_image_t) linebuf =3D + qemu_pixman_linebuf_create(PIXMAN_BE_r8g8b8, width); + uint8_t *buf =3D (uint8_t *)pixman_image_get_data(linebuf); + FILE *f =3D fdopen(fd, "wb"); + int y; + if (!f) { + error_setg_errno(errp, errno, + "Failed to create file from file descriptor"); + return false; + } + + png_ptr =3D png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, + NULL, NULL); + if (!png_ptr) { + error_setg(errp, "PNG creation failed. Unable to write struct"); + fclose(f); + return false; + } + + info_ptr =3D png_create_info_struct(png_ptr); + + if (!info_ptr) { + error_setg(errp, "PNG creation failed. Unable to write info"); + fclose(f); + png_destroy_write_struct(&png_ptr, &info_ptr); + return false; + } + + png_init_io(png_ptr, f); + + png_set_IHDR(png_ptr, info_ptr, width, height, 8, + PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + png_write_info(png_ptr, info_ptr); + + for (y =3D 0; y < height; ++y) { + qemu_pixman_linebuf_fill(linebuf, image, width, 0, y); + png_write_row(png_ptr, buf); + } + + png_write_end(png_ptr, NULL); + + png_destroy_write_struct(&png_ptr, &info_ptr); + + if (fclose(f) !=3D 0) { + error_setg_errno(errp, errno, + "PNG creation failed. Unable to close file"); + return false; + } + + return true; +} + +#else /* no png support */ + +static bool png_save(int fd, pixman_image_t *image, Error **errp) +{ + error_setg(errp, "Enable PNG support with libpng for screendump"); + return false; +} + +#endif /* CONFIG_PNG */ + +static bool ppm_save(int fd, pixman_image_t *image, Error **errp) +{ + int width =3D pixman_image_get_width(image); + int height =3D pixman_image_get_height(image); + g_autoptr(Object) ioc =3D OBJECT(qio_channel_file_new_fd(fd)); + g_autofree char *header =3D NULL; + g_autoptr(pixman_image_t) linebuf =3D NULL; + int y; + + trace_ppm_save(fd, image); + + header =3D g_strdup_printf("P6\n%d %d\n%d\n", width, height, 255); + if (qio_channel_write_all(QIO_CHANNEL(ioc), + header, strlen(header), errp) < 0) { + return false; + } + + linebuf =3D qemu_pixman_linebuf_create(PIXMAN_BE_r8g8b8, width); + for (y =3D 0; y < height; y++) { + qemu_pixman_linebuf_fill(linebuf, image, width, 0, y); + if (qio_channel_write_all(QIO_CHANNEL(ioc), + (char *)pixman_image_get_data(linebuf), + pixman_image_get_stride(linebuf), errp) = < 0) { + return false; + } + } + + return true; +} + +/* Safety: coroutine-only, concurrent-coroutine safe, main thread only */ +void coroutine_fn +qmp_screendump(const char *filename, const char *device, + bool has_head, int64_t head, + bool has_format, ImageFormat format, Error **errp) +{ + g_autoptr(pixman_image_t) image =3D NULL; + QemuConsole *con; + DisplaySurface *surface; + int fd; + + if (device) { + con =3D qemu_console_lookup_by_device_name(device, has_head ? head= : 0, + errp); + if (!con) { + return; + } + } else { + if (has_head) { + error_setg(errp, "'head' must be specified together with 'devi= ce'"); + return; + } + con =3D qemu_console_lookup_by_index(0); + if (!con) { + error_setg(errp, "There is no console to take a screendump fro= m"); + return; + } + } + + qemu_console_co_wait_update(con); + + /* + * All pending coroutines are woken up, while the BQL is held. No + * further graphic update are possible until it is released. Take + * an image ref before that. + */ + surface =3D qemu_console_surface(con); + if (!surface) { + error_setg(errp, "no surface"); + return; + } + image =3D pixman_image_ref(surface->image); + + fd =3D qemu_open_old(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY= , 0666); + if (fd =3D=3D -1) { + error_setg(errp, "failed to open file '%s': %s", filename, + strerror(errno)); + return; + } + + /* + * The image content could potentially be updated as the coroutine + * yields and releases the BQL. It could produce corrupted dump, but + * it should be otherwise safe. + */ + if (has_format && format =3D=3D IMAGE_FORMAT_PNG) { + /* PNG format specified for screendump */ + if (!png_save(fd, image, errp)) { + qemu_unlink(filename); + } + } else { + /* PPM format specified/default for screendump */ + if (!ppm_save(fd, image, errp)) { + qemu_unlink(filename); + } + } +} --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388390; cv=none; d=zohomail.com; s=zohoarc; b=g2uIHwjFnbfc7sONti2DICEfBLkdngFyfAlnqgY9cuzIdt0YwzqLhK7EZhEJ4RpROnT2GGUhPH6znVESx0PYSpmi5G/Xf6bJ/zWsNX7RUq/4g9lv7/RhYjOGds8wYs5sTflFDqQXxBV0nyC+n77g+vyS1HjO+ewMhhka9QRNu5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388390; 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=uHy1kHmOF5Lkkp1zdJ3XjJ3OaoX5I+fnT8YalX7qmj0=; b=eNdFZf0JnEA96V7JLM3wBIsHfQVx2xsEArK5QsNzm3rORsWBt9itWtNYi/CiuPsEjTQKlveCI5GHWlxHmwS6Hc+LR8SFAB904mMHfvIDupRN3TrKQgoiuvOMPuT1QoUbtbF9GHfdWwMk7SEpZkfyOKRwjsr763aEVyU3flD3tYI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388390723972.4637718020712; Wed, 30 Aug 2023 02:39:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfJ-0007Hy-HI; Wed, 30 Aug 2023 05:39:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfI-0007Hg-9T for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfG-0000qu-8C for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:08 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-688-68Yqe5J9PvWyYR-LgfK0UA-1; Wed, 30 Aug 2023 05:39:04 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AF25A1C0758C for ; Wed, 30 Aug 2023 09:39:03 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98FBB492C13; Wed, 30 Aug 2023 09:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388345; 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=uHy1kHmOF5Lkkp1zdJ3XjJ3OaoX5I+fnT8YalX7qmj0=; b=Q5isDBlbWCPIqo1q4SxIMQl7HG1kr5+vxRdlo9Y3myXaZbbAx36bHUajsShSC15LAu4w+i UPZCkACEFcVzXHGfLlEzd4zVPpJP4rdOjtty3n5gZYajioxHSq7fgqcqZ/qpaAkcEpN2Oj K0Mq7Z/cH/fPNAEydx1+F2i6AKsgoE0= X-MC-Unique: 68Yqe5J9PvWyYR-LgfK0UA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 04/67] ui/vc: replace vc_chr_write() with generic qemu_chr_write() Date: Wed, 30 Aug 2023 13:37:38 +0400 Message-ID: <20230830093843.3531473-5-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388392366100001 From: Marc-Andr=C3=A9 Lureau We shouldn't call the callback directly, but use the chardev API, unless there is a clear reason. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- ui/console.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/console.c b/ui/console.c index 9c17024dbc..a448e4d283 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1169,13 +1169,13 @@ void kbd_put_keysym_console(QemuConsole *s, int key= sym) *q++ =3D '['; *q++ =3D keysym & 0xff; } else if (s->echo && (keysym =3D=3D '\r' || keysym =3D=3D '\n')) { - vc_chr_write(s->chr, (const uint8_t *) "\r", 1); + qemu_chr_write(s->chr, (uint8_t *)"\r", 1, true); *q++ =3D '\n'; } else { *q++ =3D keysym; } if (s->echo) { - vc_chr_write(s->chr, buf, q - buf); + qemu_chr_write(s->chr, buf, q - buf, true); } num_free =3D fifo8_num_free(&s->out_fifo); fifo8_push_all(&s->out_fifo, buf, MIN(num_free, q - buf)); @@ -2474,7 +2474,7 @@ static void text_console_do_init(Chardev *chr, Displa= yState *ds) =20 s->t_attrib.bgcol =3D QEMU_COLOR_BLUE; msg =3D g_strdup_printf("%s console\r\n", chr->label); - vc_chr_write(chr, (uint8_t *)msg, strlen(msg)); + qemu_chr_write(chr, (uint8_t *)msg, strlen(msg), true); g_free(msg); s->t_attrib =3D s->t_attrib_default; } --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388416; cv=none; d=zohomail.com; s=zohoarc; b=fVNBJLLUUwSt3LoTcn2AKZ5PHWc3ZeaCBrcDqaFX+UX49GPXzwpp0InVw6/8wLp+ZdIGVVBzMPxb1cqClyb1Hv/+vyiUkwflMMMFoyFO/P125ag54ozDk29dCYw1/Rjt3A8mxaJTzIaqdPvcVOqQgVkyP+YVPxTPRQ2xgDcYKfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388416; 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=kREA1uDLF535/rflSilnavzXlFr0WslJU8Ryzc8+m3M=; b=j1Xjf52eUoWr0ZP4Ts3H9L+xEsnxDYJcH3Y1qIKS5Js5v17qeelnzaeGrBq4CkLXa+e2k1H6G/prH2XDFvmVBm4qCcXzJU62wPngaAPmXnisCyywDwaqJLcPwZiPVf0/BLhnUhpg2w+e5XRo5F4+m6f7t3qUj7Gu7k+n5qKLrfA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388416840742.5576903858446; Wed, 30 Aug 2023 02:40:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfN-0007IK-4t; Wed, 30 Aug 2023 05:39:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfM-0007IB-96 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfK-0000rW-2F for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:12 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-m6_4XNmiNImPtgIbnAYNWQ-1; Wed, 30 Aug 2023 05:39:07 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 76F803811F26 for ; Wed, 30 Aug 2023 09:39:07 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EBEC2026D35; Wed, 30 Aug 2023 09:39:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388349; 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=kREA1uDLF535/rflSilnavzXlFr0WslJU8Ryzc8+m3M=; b=DTMPi+ZDc987Wt8Nf/XyduBFSIr41aVA58GfNLvwxPSfuzsrDVdVWw2HdDWS/Om8Zd2G1m 7G1YTv8vWRN8NRQK8gTkaGmY/aupnCM2A/zG1DmYkh7grcYoXnvRIpwHfPsPl5LYkO/jgf Tq+bebHZ2Zu5pHxGsR1uaBJf9eNT12Y= X-MC-Unique: m6_4XNmiNImPtgIbnAYNWQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 05/67] ui/vc: drop have_text Date: Wed, 30 Aug 2023 13:37:39 +0400 Message-ID: <20230830093843.3531473-6-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388417095100009 From: Marc-Andr=C3=A9 Lureau If there are no "text" listener, the callback will simply be ignored. The rest of text handling can be done cheaply. This allows to remove some dependency on DisplayState from VC implementation. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 42 +++++++++++++----------------------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/ui/console.c b/ui/console.c index a448e4d283..bec2d1a40a 100644 --- a/ui/console.c +++ b/ui/console.c @@ -133,7 +133,6 @@ struct DisplayState { uint64_t update_interval; bool refreshing; bool have_gfx; - bool have_text; =20 QLIST_HEAD(, DisplayChangeListener) listeners; }; @@ -185,7 +184,6 @@ static void gui_setup_refresh(DisplayState *ds) DisplayChangeListener *dcl; bool need_timer =3D false; bool have_gfx =3D false; - bool have_text =3D false; =20 QLIST_FOREACH(dcl, &ds->listeners, next) { if (dcl->ops->dpy_refresh !=3D NULL) { @@ -194,9 +192,6 @@ static void gui_setup_refresh(DisplayState *ds) if (dcl->ops->dpy_gfx_update !=3D NULL) { have_gfx =3D true; } - if (dcl->ops->dpy_text_update !=3D NULL) { - have_text =3D true; - } } =20 if (need_timer && ds->gui_timer =3D=3D NULL) { @@ -209,7 +204,6 @@ static void gui_setup_refresh(DisplayState *ds) } =20 ds->have_gfx =3D have_gfx; - ds->have_text =3D have_text; } =20 void graphic_hw_update_done(QemuConsole *con) @@ -456,9 +450,7 @@ static void update_xy(QemuConsole *s, int x, int y) TextCell *c; int y1, y2; =20 - if (s->ds->have_text) { - text_update_xy(s, x, y); - } + text_update_xy(s, x, y); =20 y1 =3D (s->y_base + y) % s->total_height; y2 =3D y1 - s->y_displayed; @@ -482,9 +474,7 @@ static void console_show_cursor(QemuConsole *s, int sho= w) int y, y1; int x =3D s->x; =20 - if (s->ds->have_text) { - s->cursor_invalidate =3D 1; - } + s->cursor_invalidate =3D 1; =20 if (x >=3D s->width) { x =3D s->width - 1; @@ -513,13 +503,11 @@ static void console_refresh(QemuConsole *s) TextCell *c; int x, y, y1; =20 - if (s->ds->have_text) { - s->text_x[0] =3D 0; - s->text_y[0] =3D 0; - s->text_x[1] =3D s->width - 1; - s->text_y[1] =3D s->height - 1; - s->cursor_invalidate =3D 1; - } + s->text_x[0] =3D 0; + s->text_y[0] =3D 0; + s->text_x[1] =3D s->width - 1; + s->text_y[1] =3D s->height - 1; + s->cursor_invalidate =3D 1; =20 vga_fill_rect(s, 0, 0, surface_width(surface), surface_height(surface), color_table_rgb[0][QEMU_COLOR_BLACK]); @@ -594,12 +582,10 @@ static void console_put_lf(QemuConsole *s) c++; } if (s->y_displayed =3D=3D s->y_base) { - if (s->ds->have_text) { - s->text_x[0] =3D 0; - s->text_y[0] =3D 0; - s->text_x[1] =3D s->width - 1; - s->text_y[1] =3D s->height - 1; - } + s->text_x[0] =3D 0; + s->text_y[0] =3D 0; + s->text_x[1] =3D s->width - 1; + s->text_y[1] =3D s->height - 1; =20 vga_bitblt(s, 0, FONT_HEIGHT, 0, 0, s->width * FONT_WIDTH, @@ -1069,9 +1055,7 @@ void console_select(unsigned int index) displaychangelistener_display_console(dcl, s, NULL); } } - if (ds->have_text) { - dpy_text_resize(s, s->width, s->height); - } + dpy_text_resize(s, s->width, s->height); text_console_update_cursor(NULL); } } @@ -1239,7 +1223,7 @@ static void text_console_invalidate(void *opaque) { QemuConsole *s =3D (QemuConsole *) opaque; =20 - if (s->ds->have_text && s->console_type =3D=3D TEXT_CONSOLE) { + if (s->console_type =3D=3D TEXT_CONSOLE) { text_console_resize(s); } console_refresh(s); --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388432; cv=none; d=zohomail.com; s=zohoarc; b=HaRaLTc5CNiWwJiTaRQVtLkT3F4HKJEnpCBF6UlJW36DEDWvvwlh/3TYK+4ueE8A0odH2w+aTWN0vMz+oBFGSNk15r8pkhNy8ttlGa9PRuPPMLvtVUKXyp9KWvS36sdN5LamDnjm4RAIqkzJWAvoX5Cp5BSSE3il+uJIaCSd1A4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388432; 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=KA9NJQsp+fVWXqLqtRuq/dcV4t81Mp+eSHyizE2FTm0=; b=D7blhfCj/YpeTUdodckQka+cEC8Ark+GHfktka1fMsO7MLqomI5DvgnFzWOv2auVm7IfNjGV3/Sfr8eli21zxyVARtUhdbWOT1WyxpTGFfvvHJzrksfDPIfBAnwy6c7QUigUK837P4hR/DQIUGz4sOL6kTFQVcMbt2u4BPSXpfc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388432765537.775582604308; Wed, 30 Aug 2023 02:40:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfQ-0007S4-Km; Wed, 30 Aug 2023 05:39:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfP-0007Ig-DW for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfN-0000sB-Cn for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:15 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-154-2QZvUGqFPLa2P5qyQBVtow-1; Wed, 30 Aug 2023 05:39:11 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EE6498022E4 for ; Wed, 30 Aug 2023 09:39:10 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AE30401E63; Wed, 30 Aug 2023 09:39:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388352; 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=KA9NJQsp+fVWXqLqtRuq/dcV4t81Mp+eSHyizE2FTm0=; b=hjfVhtHu200AZO4pQch83Efj52G6y7ZVwX5tx2LT/MIHyQNhnCjthB3D4Q5lrz4kOg5sIc Rs5/ieJqQTOeZ9JZK2AKJtnL9VjRUvEG3PRxlhUfoMtayn+Q1lx3Xccz3jOI7UxKyL8Z3C y766zgAVfLAC0xNtqVPZceJ6iE137Uo= X-MC-Unique: 2QZvUGqFPLa2P5qyQBVtow-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 06/67] ui/console: console_select() regardless of have_gfx Date: Wed, 30 Aug 2023 13:37:40 +0400 Message-ID: <20230830093843.3531473-7-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388434558100005 From: Marc-Andr=C3=A9 Lureau Even if we don't have a gfx listener, we should call displaychangelistener_display_console() which handle that case correctly. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ui/console.c b/ui/console.c index bec2d1a40a..14717a6f4d 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1047,13 +1047,11 @@ void console_select(unsigned int index) DisplayState *ds =3D s->ds; =20 active_console =3D s; - if (ds->have_gfx) { - QLIST_FOREACH(dcl, &ds->listeners, next) { - if (dcl->con !=3D NULL) { - continue; - } - displaychangelistener_display_console(dcl, s, NULL); + QLIST_FOREACH (dcl, &ds->listeners, next) { + if (dcl->con !=3D NULL) { + continue; } + displaychangelistener_display_console(dcl, s, NULL); } dpy_text_resize(s, s->width, s->height); text_console_update_cursor(NULL); --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388414; cv=none; d=zohomail.com; s=zohoarc; b=IC7T+NMBfca3Ms8zhQuA29qItlC1Kv9V1DrUOP6h0rkUJwyuLsfv0RkjlXmW95/7yTo3tV5z/FfQDtTySiZl0f0dQ4qdSo15K3+wP5mruDLYmTvSSXl0kgDCWfXhsuvVo5IdKIMHyIR3IyWdzRmd8aSL8SnWIIRjmwjCA91X78Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388414; 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=FZSp7auxlWGvr9TYNAeLVMxJiG2pnfk9RKkvbjZ29xE=; b=lqVpLJTSRK8Zq6TxyccKgCDH9o2TrXo0b+hY2R6PnzF2h84zj5cHMk5bPar1t7wfZZ2od/evcNWlub6JH8lIl+u46S4VLCuSQ4Qmm07XYi/ZRzpruaABsO70V1BftGnWobh+ZmXuKD2BL785/sbzSJCw2nYfi1wRJ5VOwT/1niA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388414332489.28750203898585; Wed, 30 Aug 2023 02:40:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfV-0007c1-Dx; Wed, 30 Aug 2023 05:39:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfT-0007bI-Lj for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfR-0000se-Kh for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:19 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-306-B3PpmN51OLC9bCb9KKTMFg-1; Wed, 30 Aug 2023 05:39:15 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 09EC13811F26 for ; Wed, 30 Aug 2023 09:39:15 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4196401E63; Wed, 30 Aug 2023 09:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388357; 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=FZSp7auxlWGvr9TYNAeLVMxJiG2pnfk9RKkvbjZ29xE=; b=en80Eb1nmWFE85KCeT5XjkLfMQTYD0cw9P0CzcudgI09Jo0pclvN3rOcJr3ix0dtPDYzRk 1Q/a4k0g81b64G5Rc6H0dEr5qOZ2pxCF1MAz2hyiUXz8veGosk2+G8kyAX4Qeu5lI8Lf8m RlF2/bOe8yjLYtIn2d7GdQ45gR1iOoU= X-MC-Unique: B3PpmN51OLC9bCb9KKTMFg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 07/67] ui/console: call dpy_gfx_update() regardless of have_gfx Date: Wed, 30 Aug 2023 13:37:41 +0400 Message-ID: <20230830093843.3531473-8-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388416490100005 From: Marc-Andr=C3=A9 Lureau The function will handle the case when no listeners are gfx, without extra meaningful cost. This allows to get rid of DisplayState dependency in VC implementation. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/console.c b/ui/console.c index 14717a6f4d..2bc4c153de 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1087,7 +1087,7 @@ static int vc_chr_write(Chardev *chr, const uint8_t *= buf, int len) console_putchar(s, buf[i]); } console_show_cursor(s, 1); - if (s->ds->have_gfx && s->update_x0 < s->update_x1) { + if (s->update_x0 < s->update_x1) { dpy_gfx_update(s, s->update_x0, s->update_y0, s->update_x1 - s->update_x0, s->update_y1 - s->update_y0); --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388449; cv=none; d=zohomail.com; s=zohoarc; b=H/bD2S79sKHNAxrHfC62kQAH9w5H5hJDkWGgjzmDyXDTC731HQannLQu/2WXB93z5QgnqVgGur3jJCnsXByGaDUd3JOTSXXQZcx4k4wu65sdU+WMSsAB+lc83JcjujWnObTQKcMULOref2yt/z6SyT+DWqN8zKl5dJOKuF1WEcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388449; 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=Avo/WTpAgL1HtCoKdLnm5T94AvJcI/HDn98A+Dq86fE=; b=SWJqNUqTlUphZmSCRgdr4ztY7/9aWpkjeBFmak/BWYmvQVD5Ss+UO4+HuB+GLiEikv7STUyj+rK0KNyVmUTQeuJvh6lWcR0cwkzzaAyh/9xzUq3FggEtVdDfkDLAZAOv7ZuWGX6wjfXcWvo0/tIoeJ9EHlhdMhT3P+RK1mi9U9I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388449056437.2793458292134; Wed, 30 Aug 2023 02:40:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfZ-0007ci-VT; Wed, 30 Aug 2023 05:39:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfX-0007cY-Nw for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfV-0000t7-MJ for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:23 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-340-G8Y6zlwjMl-z86_eSzZlhw-1; Wed, 30 Aug 2023 05:39:19 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B041185A78B for ; Wed, 30 Aug 2023 09:39:19 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id E410E6B2AC; Wed, 30 Aug 2023 09:39:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388361; 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=Avo/WTpAgL1HtCoKdLnm5T94AvJcI/HDn98A+Dq86fE=; b=e3j3iKN/U6KDsrupwCtb8VEv5S1s1jmWAo5mCpwGf4FLOvtxIvMcniw44OTwp+OEOvleFG 92ljxj5c6y7TVP/WqVvM1T0p8irf7sBbp+ZLvgUAooLVKeyZQ26+Bc/MkgZTs8mxEuC6kX AZrDurZcRubRFWsuPxGo4OuGWEjXpxg= X-MC-Unique: G8Y6zlwjMl-z86_eSzZlhw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 08/67] ui/console: drop have_gfx Date: Wed, 30 Aug 2023 13:37:42 +0400 Message-ID: <20230830093843.3531473-9-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388451210100003 From: Marc-Andr=C3=A9 Lureau All usages have been removed. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/ui/console.c b/ui/console.c index 2bc4c153de..fc1836782d 100644 --- a/ui/console.c +++ b/ui/console.c @@ -132,7 +132,6 @@ struct DisplayState { uint64_t last_update; uint64_t update_interval; bool refreshing; - bool have_gfx; =20 QLIST_HEAD(, DisplayChangeListener) listeners; }; @@ -183,15 +182,11 @@ static void gui_setup_refresh(DisplayState *ds) { DisplayChangeListener *dcl; bool need_timer =3D false; - bool have_gfx =3D false; =20 QLIST_FOREACH(dcl, &ds->listeners, next) { if (dcl->ops->dpy_refresh !=3D NULL) { need_timer =3D true; } - if (dcl->ops->dpy_gfx_update !=3D NULL) { - have_gfx =3D true; - } } =20 if (need_timer && ds->gui_timer =3D=3D NULL) { @@ -202,8 +197,6 @@ static void gui_setup_refresh(DisplayState *ds) timer_free(ds->gui_timer); ds->gui_timer =3D NULL; } - - ds->have_gfx =3D have_gfx; } =20 void graphic_hw_update_done(QemuConsole *con) --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388425; cv=none; d=zohomail.com; s=zohoarc; b=jGR9hexkUCa2e7hSwnlLnULxsJdvoyb0t2+uo+fMejMHvDpVvnaOGhfxlsKtO0JF7yE58aOc9KFwW70nKH4F3aLvHCIjDHy+uRtOazBgmY48JoJMTGEow2B8h5MMW8xpn6cQV8MpguTyxvOoKQ7bcDPYhic1/ntN/zAz9prA6Bc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388425; 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=IP2KlXkL9S9hKgfR0NcUmYvurDGjQqMWtSz/HTRbsmQ=; b=iovErGMZrvF1g+tHcOmWlW6BhRiEpCsKz+Nu5hRntyRgpt5DjYCU6Zrbbi1p483JNS+4EIUF4ZzRR8KH7yKDLay4rc41Nu7U0eqlDyuDk12Z7gI/M8iiO3oUx40geDm6ztzXUVvr2pwI+wA9dA4WSjwkPCm0VWMXdByldEMLo34= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388425061420.3204035334727; Wed, 30 Aug 2023 02:40:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfc-0007jz-NE; Wed, 30 Aug 2023 05:39:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfb-0007iq-Nw for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfZ-0000tY-3e for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:27 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-492-d1C8c9p3PS6v2FtcrOZsxA-1; Wed, 30 Aug 2023 05:39:22 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 541AE101A528 for ; Wed, 30 Aug 2023 09:39:22 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AD67140E96E; Wed, 30 Aug 2023 09:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388364; 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=IP2KlXkL9S9hKgfR0NcUmYvurDGjQqMWtSz/HTRbsmQ=; b=LAxeqdbI1PFIFOR976TkWJCJlhJXtPFoDnSeINowr0IgXHbS1suxsiigUUri2iEnZiPNbd lwTvQeXOMK3/SWkuaSZf7Dw8aXNaj7Mr6AM1B4POIZqsoa7kPp2Mo/NeteJ5mJ0PaOPMg9 HzdjKtdi8HOu7X3f6+aZsi6WKoxoFX0= X-MC-Unique: d1C8c9p3PS6v2FtcrOZsxA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 09/67] ui/console: get the DisplayState from new_console() Date: Wed, 30 Aug 2023 13:37:43 +0400 Message-ID: <20230830093843.3531473-10-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388426580100004 From: Marc-Andr=C3=A9 Lureau There is no obvious reason to defer text console initialization. We can simply take the global display state in new_console(). This simplify somewhat the code to allow moving the VC to a separate unit. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/ui/console.c b/ui/console.c index fc1836782d..ba79c735b7 100644 --- a/ui/console.c +++ b/ui/console.c @@ -143,7 +143,7 @@ static QTAILQ_HEAD(, QemuConsole) consoles =3D static bool cursor_visible_phase; static QEMUTimer *cursor_timer; =20 -static void text_console_do_init(Chardev *chr, DisplayState *ds); +static void text_console_do_init(Chardev *chr); static void dpy_refresh(DisplayState *s); static DisplayState *get_alloc_displaystate(void); static void text_console_update_cursor_timer(void); @@ -1249,9 +1249,10 @@ static void text_console_update(void *opaque, consol= e_ch_t *chardata) } } =20 -static QemuConsole *new_console(DisplayState *ds, console_type_t console_t= ype, +static QemuConsole *new_console(console_type_t console_type, uint32_t head) { + DisplayState *ds =3D get_alloc_displaystate(); Object *obj; QemuConsole *s; int i; @@ -2049,13 +2050,7 @@ DisplayState *init_displaystate(void) gchar *name; QemuConsole *con; =20 - get_alloc_displaystate(); QTAILQ_FOREACH(con, &consoles, next) { - if (con->console_type !=3D GRAPHIC_CONSOLE && - con->ds =3D=3D NULL) { - text_console_do_init(con->chr, display_state); - } - /* Hook up into the qom tree here (not in new_console()), once * all QemuConsoles are created and the order / numbering * doesn't change any more */ @@ -2085,10 +2080,8 @@ QemuConsole *graphic_console_init(DeviceState *dev, = uint32_t head, int width =3D 640; int height =3D 480; QemuConsole *s; - DisplayState *ds; DisplaySurface *surface; =20 - ds =3D get_alloc_displaystate(); s =3D qemu_console_lookup_unused(); if (s) { trace_console_gfx_reuse(s->index); @@ -2096,7 +2089,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, u= int32_t head, height =3D qemu_console_get_height(s, 0); } else { trace_console_gfx_new(); - s =3D new_console(ds, GRAPHIC_CONSOLE, head); + s =3D new_console(GRAPHIC_CONSOLE, head); s->ui_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, dpy_set_ui_info_timer, s); } @@ -2405,7 +2398,7 @@ static const GraphicHwOps text_console_ops =3D { .text_update =3D text_console_update, }; =20 -static void text_console_do_init(Chardev *chr, DisplayState *ds) +static void text_console_do_init(Chardev *chr) { VCChardev *drv =3D VC_CHARDEV(chr); QemuConsole *s =3D drv->console; @@ -2413,7 +2406,6 @@ static void text_console_do_init(Chardev *chr, Displa= yState *ds) int g_height =3D 24 * FONT_HEIGHT; =20 fifo8_create(&s->out_fifo, 16); - s->ds =3D ds; =20 s->y_displayed =3D 0; s->y_base =3D 0; @@ -2482,9 +2474,9 @@ static void vc_chr_open(Chardev *chr, =20 trace_console_txt_new(width, height); if (width =3D=3D 0 || height =3D=3D 0) { - s =3D new_console(NULL, TEXT_CONSOLE, 0); + s =3D new_console(TEXT_CONSOLE, 0); } else { - s =3D new_console(NULL, TEXT_CONSOLE_FIXED_SIZE, 0); + s =3D new_console(TEXT_CONSOLE_FIXED_SIZE, 0); s->scanout.kind =3D SCANOUT_SURFACE; s->surface =3D qemu_create_displaysurface(width, height); } @@ -2497,9 +2489,7 @@ static void vc_chr_open(Chardev *chr, s->chr =3D chr; drv->console =3D s; =20 - if (display_state) { - text_console_do_init(chr, display_state); - } + text_console_do_init(chr); =20 /* console/chardev init sometimes completes elsewhere in a 2nd * stage, so defer OPENED events until they are fully initialized --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388398; cv=none; d=zohomail.com; s=zohoarc; b=V0m+5ohbCA7pK7jETzqqA5sycSFhBE/qcuh9oev54+ywvJMAW5lYA1Ek+I7cbaJ7YMPiV5s5l+5Iiy3B16rgZKJHlUPoXcT+7Lf3KmJPls3Uu0jhGJWbx3pHWvEjSb9QSrFvDA2GUNPd8f2osNcR/Wr2OgfL0X1xCB7odr0dQSY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388398; 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=KLkr1VS/YzTqxZ/eKaGLXibius6Hi2eg2GHZccbwvR0=; b=auLcA30iiyD/U8dQgJX4kFi0+l2tmd0EcBcJPXSAZc3+OPMiyy9d+t89+Ow7chzLr7Zk+paUHa6Gu/WREHgghbC0yFJBEFZB8fp6JM2pQPCDo4ehZ22UCi4mDyyJJdqyQDUxZCFeJPu2oAxQn/nD0Hnn7GjmIYPl1M0k+M27zIY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169338839802750.126651002887; Wed, 30 Aug 2023 02:39:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfi-0007lI-QH; Wed, 30 Aug 2023 05:39:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfh-0007kj-7v for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHff-0000uO-7m for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:33 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-435-ig2jt6eDPL-xw8U2KseZcw-1; Wed, 30 Aug 2023 05:39:26 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 560CD101A52E for ; Wed, 30 Aug 2023 09:39:26 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2EC740C6F4C; Wed, 30 Aug 2023 09:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388370; 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=KLkr1VS/YzTqxZ/eKaGLXibius6Hi2eg2GHZccbwvR0=; b=AuAS6oVU8JhcCNRl1xmzltSzcPsCxqsCwr5u1ODcfpO9kAtF8yIIA+SiIeAqRFLRroDLYo B9xwbdZAeKBvQi5F1qvqU/a5IEc7PRl0iOvlFJ9SAHOTCcWCcvVVs5ScrbSFU5suBm992p PQUm7qpa94rNO+trZ+QB649v4YXInCQ= X-MC-Unique: ig2jt6eDPL-xw8U2KseZcw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 10/67] ui/console: new_console() cannot fail Date: Wed, 30 Aug 2023 13:37:44 +0400 Message-ID: <20230830093843.3531473-11-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388399106100003 From: Marc-Andr=C3=A9 Lureau There is no code path that could allow a NULL return there. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ui/console.c b/ui/console.c index ba79c735b7..8c4626f255 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2481,11 +2481,6 @@ static void vc_chr_open(Chardev *chr, s->surface =3D qemu_create_displaysurface(width, height); } =20 - if (!s) { - error_setg(errp, "cannot create text console"); - return; - } - s->chr =3D chr; drv->console =3D s; =20 --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388499; cv=none; d=zohomail.com; s=zohoarc; b=HD8DKwp7ys0aDXsWbdBpzBzCcmr+QzCbwp5N5c6yEblCaJlwYDHIkVq1dWDORII97Mp5oOKwAVCBQZrCnWp4AixcvKq1rHWsRpYICwHF+EFlNrJ93AzCjUVHC3XfW1WXPzGPpAPKRiAJ3MIOu+2lIOcCxG7EAzJTXRJYRnvGx6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388499; 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=h7qVZD5qmCYDfaPQlR8eC0IFmTZYZpUmKqQ10XxvCUI=; b=gPlW0YZ5aSrj/or7p892L/RGFwTmgM6QcWH4EWGUip8SRgla57t+deAgHK8nwi05qUTn2XF6oXb1RDqgktLsdcjCNxUm2dzN+0PBF4hu/MGUDKKsbaabWDwG+K/kXjX3gkxAgkhpY6Ww/D+MDxxwo0cLzy6IZRGzZqZtVXtNjsU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388499573968.0578778872317; Wed, 30 Aug 2023 02:41:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfo-0008LK-De; Wed, 30 Aug 2023 05:39:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfm-00088j-Qm for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfk-0000vF-Mx for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:38 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-278-sEdWMa7OOgKOShgPIWIrig-1; Wed, 30 Aug 2023 05:39:30 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7BC4429ABA19 for ; Wed, 30 Aug 2023 09:39:30 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 946A740C2063; Wed, 30 Aug 2023 09:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388376; 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=h7qVZD5qmCYDfaPQlR8eC0IFmTZYZpUmKqQ10XxvCUI=; b=YqQNoJ/WYexv234hh/h0FvtYcZchkfST2O2bvmUNurWa60sAtTWIo09gqWoQne9RROuFm5 OLLvgCynEBgl88ScmADxIlJ2Z6p5eefzxXb/K1hHa51JWYrjdmCa1kAuIPKC1xLnpX7i0i YVnI++n1pA0gWoxEUOmOxS4p0nWAT78= X-MC-Unique: sEdWMa7OOgKOShgPIWIrig-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 11/67] ui/vc: VC always has a DisplayState now Date: Wed, 30 Aug 2023 13:37:45 +0400 Message-ID: <20230830093843.3531473-12-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388501495100003 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ui/console.c b/ui/console.c index 8c4626f255..2b8022dfbe 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1067,10 +1067,6 @@ static int vc_chr_write(Chardev *chr, const uint8_t = *buf, int len) QemuConsole *s =3D drv->console; int i; =20 - if (!s->ds) { - return 0; - } - s->update_x0 =3D s->width * FONT_WIDTH; s->update_y0 =3D s->height * FONT_HEIGHT; s->update_x1 =3D 0; --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388404; cv=none; d=zohomail.com; s=zohoarc; b=MaFRU785/zjLuksnLulS87xxrL1jY0jSlTPkdB+vdOODkIBdsaUwflxSeP+wG1eQs6/ogs5NYXm81Btc4dsqhsM2vVgBTQx+4+HlVXkB+Y6YsB4MyK8Ox+Soho8/5MqVjm4B/n61h2i07uMgS5scQfRMU2UfJdma40GOBi5OlNc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388404; 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=Dxl7snnGZGMI0siKBjSjh/r1e9ZJf70sE4JhIabOoy4=; b=bmnGDyUesGd4FOSyWZL5pnsQIZl7FZ+ySJzy2pupZNpGRk6pMu1jEFz05i0/6hyW8quphqm8Fq361Va7hRERHHNEVqqxoGtFH/hJ4Wff+7Wo8GdSelnD3DFi5uTmloIfeXQNFooaFr4BIG9Bdibr4EMvJz+CiJPOsp9U2tsztgc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388404624559.0835777031692; Wed, 30 Aug 2023 02:40:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfq-0000EY-HO; Wed, 30 Aug 2023 05:39:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfo-0008ME-Ei for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfk-0000vL-V7 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:40 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-442-doCF8FpVOv-9EtZ-b1GHFQ-1; Wed, 30 Aug 2023 05:39:34 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 69F28802C1E for ; Wed, 30 Aug 2023 09:39:34 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47A4E6B292; Wed, 30 Aug 2023 09:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388376; 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=Dxl7snnGZGMI0siKBjSjh/r1e9ZJf70sE4JhIabOoy4=; b=cj4/qbewKPih2SBNakVbcXopiIk40HM6lTIco49PI4vtxfOa5j9jqIFltD+mfIjKKds9bG BxHEPSjx2UcjNZPVxwQfZbVk5w1zjdCEQUfhlBCIJw6Wd8t00F4zin4pZR7FIGvK/eldvG JCoDwxDZs/dtHCAbVXQEuB9SQXvpwEo= X-MC-Unique: doCF8FpVOv-9EtZ-b1GHFQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 12/67] ui/vc: move VCChardev declaration at the top Date: Wed, 30 Aug 2023 13:37:46 +0400 Message-ID: <20230830093843.3531473-13-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388405027100001 From: Marc-Andr=C3=A9 Lureau To allow easier refactoring in following patches. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/console.c b/ui/console.c index 2b8022dfbe..ad6fbb1d0f 100644 --- a/ui/console.c +++ b/ui/console.c @@ -127,6 +127,12 @@ struct QemuConsole { QTAILQ_ENTRY(QemuConsole) next; }; =20 +struct VCChardev { + Chardev parent; + QemuConsole *console; +}; +typedef struct VCChardev VCChardev; + struct DisplayState { QEMUTimer *gui_timer; uint64_t last_update; @@ -1051,12 +1057,6 @@ void console_select(unsigned int index) } } =20 -struct VCChardev { - Chardev parent; - QemuConsole *console; -}; -typedef struct VCChardev VCChardev; - #define TYPE_CHARDEV_VC "chardev-vc" DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV, TYPE_CHARDEV_VC) --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388610; cv=none; d=zohomail.com; s=zohoarc; b=WkzXIjGl6yHmKD3/R7UF/K1zicedxmK8QaBsIakCnCL3eMKnV2vE4bG7Rwzfr/RhtQ1r3fuXhn5RUUzdDh1XdyMlx/GSj151cCl+UVC5l2LvCntFfLo4eoXKsgVtPawDLjzJs6hW0PBSJue0MRwo/eh2zX6k+HuA2O87RBWDFUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388610; 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=9gGBUJQAEAeDOXk/LGLCQBThWm8q5fCylLrzfvlCm68=; b=GJHMmL+sjsc6lKzWxX+w4kUXbtQ2O+NkiiG5WM2qDZvE4PBEw5obGfiIm07F8DMe40ntN5lP4YYMEJeY/WXvwqIfCd3/7zlCv90Ji8Gf+wNq4cNwpjjI/0thNWiQn5oFvc/rfOFE4joQKmJADhoc173gu1ZqoFzRXX+7ODUEn0E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388610162461.7339518877716; Wed, 30 Aug 2023 02:43:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfs-0000P2-9f; Wed, 30 Aug 2023 05:39:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfr-0000KB-A7 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfo-0000vt-Qj for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:43 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-533-fsvvgIe4NOWaP1y3RoMbOA-1; Wed, 30 Aug 2023 05:39:38 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DCF2A85CCE0 for ; Wed, 30 Aug 2023 09:39:37 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 113DF2026D3E; Wed, 30 Aug 2023 09:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388380; 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=9gGBUJQAEAeDOXk/LGLCQBThWm8q5fCylLrzfvlCm68=; b=KYG/5z8jOCi9MbAL/1nYZeGCszq24zC2BUORKtkqT5LZWgirBiV+Mb8NuMl2ag2iOCKaWk AlqT4ZHOayWVpTnIzCWqLW7L42DXSQWhk+M8G4xg15Y/kCMgyxdNZhvjDO1wOsQUe/9EvA Ry3clp9yme7lVbQ+uidQJuc/p4WF8l4= X-MC-Unique: fsvvgIe4NOWaP1y3RoMbOA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 13/67] ui/vc: replace variable with static text attributes default Date: Wed, 30 Aug 2023 13:37:47 +0400 Message-ID: <20230830093843.3531473-14-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388611254100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/ui/console.c b/ui/console.c index ad6fbb1d0f..9d8406f2a2 100644 --- a/ui/console.c +++ b/ui/console.c @@ -52,6 +52,11 @@ typedef struct TextAttributes { uint8_t unvisible:1; } TextAttributes; =20 +#define TEXT_ATTRIBUTES_DEFAULT ((TextAttributes) { \ + .fgcol =3D QEMU_COLOR_WHITE, \ + .bgcol =3D QEMU_COLOR_BLACK \ +}) + typedef struct TextCell { uint8_t ch; TextAttributes t_attrib; @@ -104,7 +109,6 @@ struct QemuConsole { int x_saved, y_saved; int y_displayed; int y_base; - TextAttributes t_attrib_default; /* default text attributes */ TextAttributes t_attrib; /* currently active text attributes */ TextCell *cells; int text_x[2], text_y[2], cursor_invalidate; @@ -413,7 +417,7 @@ static void text_console_resize(QemuConsole *s) } for(x =3D w1; x < s->width; x++) { c->ch =3D ' '; - c->t_attrib =3D s->t_attrib_default; + c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; c++; } } @@ -486,7 +490,7 @@ static void console_show_cursor(QemuConsole *s, int sho= w) if (y < s->height) { c =3D &s->cells[y1 * s->width + x]; if (show && cursor_visible_phase) { - TextAttributes t_attrib =3D s->t_attrib_default; + TextAttributes t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; t_attrib.invers =3D !(t_attrib.invers); /* invert fg and bg */ vga_putcharxy(s, x, y, c->ch, &t_attrib); } else { @@ -577,7 +581,7 @@ static void console_put_lf(QemuConsole *s) c =3D &s->cells[y1 * s->width]; for(x =3D 0; x < s->width; x++) { c->ch =3D ' '; - c->t_attrib =3D s->t_attrib_default; + c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; c++; } if (s->y_displayed =3D=3D s->y_base) { @@ -591,7 +595,7 @@ static void console_put_lf(QemuConsole *s) (s->height - 1) * FONT_HEIGHT); vga_fill_rect(s, 0, (s->height - 1) * FONT_HEIGHT, s->width * FONT_WIDTH, FONT_HEIGHT, - color_table_rgb[0][s->t_attrib_default.bgcol]); + color_table_rgb[0][TEXT_ATTRIBUTES_DEFAULT.bgcol= ]); s->update_x0 =3D 0; s->update_y0 =3D 0; s->update_x1 =3D s->width * FONT_WIDTH; @@ -611,7 +615,7 @@ static void console_handle_escape(QemuConsole *s) for (i=3D0; inb_esc_params; i++) { switch (s->esc_params[i]) { case 0: /* reset all console attributes to default */ - s->t_attrib =3D s->t_attrib_default; + s->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; break; case 1: s->t_attrib.bold =3D 1; @@ -705,7 +709,7 @@ static void console_clear_xy(QemuConsole *s, int x, int= y) } TextCell *c =3D &s->cells[y1 * s->width + x]; c->ch =3D ' '; - c->t_attrib =3D s->t_attrib_default; + c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; update_xy(s, x, y); } =20 @@ -2420,16 +2424,8 @@ static void text_console_do_init(Chardev *chr) s->hw_ops =3D &text_console_ops; s->hw =3D s; =20 - /* Set text attribute defaults */ - s->t_attrib_default.bold =3D 0; - s->t_attrib_default.uline =3D 0; - s->t_attrib_default.blink =3D 0; - s->t_attrib_default.invers =3D 0; - s->t_attrib_default.unvisible =3D 0; - s->t_attrib_default.fgcol =3D QEMU_COLOR_WHITE; - s->t_attrib_default.bgcol =3D QEMU_COLOR_BLACK; /* set current text attributes to default */ - s->t_attrib =3D s->t_attrib_default; + s->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; text_console_resize(s); =20 if (chr->label) { @@ -2439,7 +2435,7 @@ static void text_console_do_init(Chardev *chr) msg =3D g_strdup_printf("%s console\r\n", chr->label); qemu_chr_write(chr, (uint8_t *)msg, strlen(msg), true); g_free(msg); - s->t_attrib =3D s->t_attrib_default; + s->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; } =20 qemu_chr_be_event(chr, CHR_EVENT_OPENED); --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388436; cv=none; d=zohomail.com; s=zohoarc; b=Sm2kB7wdBxkzAavZw83wMemMV9XZ7Yod5pDzEvw2KlzpcXXvNL+bWq4xxTa9NnOj+sBmf58p8o25ueWQhEvrt59Do4CMdmo7SV4VA2oYKl18zo72ou7Jmp7h2+X39wrqaR8II1dNS4udeZG0XKfQBwiGDJFe/PMGaTQCcJ1K7gE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388436; 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=B/A86wN6jUWQT2dTeQySpY1x5RY5PvXUtGRSuxTl7c8=; b=mWjRKa44vcIfp/12/jRGT6HUowZ/FeMGmtic45bnTo4w0Pd+aXCEX8lt4GnuN8p+Zmo1/XkT9NFzA9vbcQBRqkKzWTJlZBVyBlh0KNwPQjp/ctaN0jjH17n+EkxNzptJNtgGL/rp9k+RldLSGhh2nP/JiWSWFZnFS1NM0oLWQ+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388436737295.3374729414685; Wed, 30 Aug 2023 02:40:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHfw-0000fe-BM; Wed, 30 Aug 2023 05:39:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfu-0000TZ-R6 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfs-0000xj-On for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:46 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-345-Y4W4aKeuOOe4w-7CwYmXPQ-1; Wed, 30 Aug 2023 05:39:42 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2AA4729ABA28 for ; Wed, 30 Aug 2023 09:39:42 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D27B63F6C; Wed, 30 Aug 2023 09:39:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388384; 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=B/A86wN6jUWQT2dTeQySpY1x5RY5PvXUtGRSuxTl7c8=; b=c8Jfv7sz/fA7uGhovS6kGRmVmGhFgYBjY3oVcoyzWbDtZ8ccXNj72dZmbNR+egy3J21Qzw 2YYPsY2wBqulFbCkdOUPgqpzbT8rEIkopAHxJz9ccGPe4Ne08O2+qtJJ7YlGUmgfi49H32 i2JLQknvxJ5/NAwZjhAMhwspPTv0U7Q= X-MC-Unique: Y4W4aKeuOOe4w-7CwYmXPQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 14/67] ui/vc: fold text_update_xy() Date: Wed, 30 Aug 2023 13:37:48 +0400 Message-ID: <20230830093843.3531473-15-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388438609100003 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ui/console.c b/ui/console.c index 9d8406f2a2..e96f154cc0 100644 --- a/ui/console.c +++ b/ui/console.c @@ -425,14 +425,6 @@ static void text_console_resize(QemuConsole *s) s->cells =3D cells; } =20 -static inline void text_update_xy(QemuConsole *s, int x, int y) -{ - s->text_x[0] =3D MIN(s->text_x[0], x); - s->text_x[1] =3D MAX(s->text_x[1], x); - s->text_y[0] =3D MIN(s->text_y[0], y); - s->text_y[1] =3D MAX(s->text_y[1], y); -} - static void invalidate_xy(QemuConsole *s, int x, int y) { if (!qemu_console_is_visible(s)) { @@ -453,7 +445,10 @@ static void update_xy(QemuConsole *s, int x, int y) TextCell *c; int y1, y2; =20 - text_update_xy(s, x, y); + s->text_x[0] =3D MIN(s->text_x[0], x); + s->text_x[1] =3D MAX(s->text_x[1], x); + s->text_y[0] =3D MIN(s->text_y[0], y); + s->text_y[1] =3D MAX(s->text_y[1], y); =20 y1 =3D (s->y_base + y) % s->total_height; y2 =3D y1 - s->y_displayed; --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388414; cv=none; d=zohomail.com; s=zohoarc; b=RvRZE1AMOE9pYXRACnblKrpc8NVNTSBHXXek/5fwEKNwddzsgu1tANZd76AUeaOgzcyhnx9UkyjQkgt2RxpOKizOvX71koDEd6kzBDvuckBJ/Ae/ql1FsTxX29KiYi865uPub/eJyaNbDD71NN3lioAA0earYcMmhlsrwEET9t0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388414; 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=v2Z3EAY8z3vZk+UhDtIEjjSiO4BLPpQw6MSWMoCKqDg=; b=iXTPMZMEXu5zur7s/MN+MNQKdP/JUz0NNTfRVJ3FcKi7ykg1cueo+gth2v8UNigdBlg+Hv7iZ05+4mud3wNWeZhm+O7uCENTCvHIoW0Hmt5P2SuiAwwlanMZ9gsIm81QZJl/f8p8IzGGsWtMHfpXeIRysK1i3l1S131nZqILuek= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169338841414554.528332996409176; Wed, 30 Aug 2023 02:40:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHg0-0001Fr-W6; Wed, 30 Aug 2023 05:39:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfz-00013m-39 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHfw-0000yH-Gl for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:50 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-426-8cX3gsHRNWqZ7TtV0BfiVw-1; Wed, 30 Aug 2023 05:39:46 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4CD278022E4 for ; Wed, 30 Aug 2023 09:39:46 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DEC01121315; Wed, 30 Aug 2023 09:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388388; 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=v2Z3EAY8z3vZk+UhDtIEjjSiO4BLPpQw6MSWMoCKqDg=; b=DkrLR3EYPABwf3HipFGUZT+tYTpjW3Ih/+LLUGZGs7oCIXESwo6YMszwC0Dd/IBUnB+1rx 20b7Qk6Noop7nyOoNBBNbXRqoazPBQ8XttAssMz2xvtJFZsvkjdKfD6CmahJdabzB+r/e9 4YP1o/Mr5+o/JUlHBLwd+iO5/UeUqZs= X-MC-Unique: 8cX3gsHRNWqZ7TtV0BfiVw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 15/67] ui/vc: pass VCCharDev to VC-specific functions Date: Wed, 30 Aug 2023 13:37:49 +0400 Message-ID: <20230830093843.3531473-16-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388415144100001 From: Marc-Andr=C3=A9 Lureau Even though the actually use more QemuConsole at this point, it makes it clear those functions are only used from the chardev implementation. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 70 +++++++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/ui/console.c b/ui/console.c index e96f154cc0..8fe39aa5e3 100644 --- a/ui/console.c +++ b/ui/console.c @@ -440,8 +440,9 @@ static void invalidate_xy(QemuConsole *s, int x, int y) s->update_y1 =3D (y + 1) * FONT_HEIGHT; } =20 -static void update_xy(QemuConsole *s, int x, int y) +static void vc_update_xy(VCChardev *vc, int x, int y) { + QemuConsole *s =3D vc->console; TextCell *c; int y1, y2; =20 @@ -555,8 +556,9 @@ static void console_scroll(QemuConsole *s, int ydelta) console_refresh(s); } =20 -static void console_put_lf(QemuConsole *s) +static void vc_put_lf(VCChardev *vc) { + QemuConsole *s =3D vc->console; TextCell *c; int x, y1; =20 @@ -603,8 +605,9 @@ static void console_put_lf(QemuConsole *s) * NOTE: I know this code is not very efficient (checking every color for = it * self) but it is more readable and better maintainable. */ -static void console_handle_escape(QemuConsole *s) +static void vc_handle_escape(VCChardev *vc) { + QemuConsole *s =3D vc->console; int i; =20 for (i=3D0; inb_esc_params; i++) { @@ -696,8 +699,9 @@ static void console_handle_escape(QemuConsole *s) } } =20 -static void console_clear_xy(QemuConsole *s, int x, int y) +static void vc_clear_xy(VCChardev *vc, int x, int y) { + QemuConsole *s =3D vc->console; int y1 =3D (s->y_base + y) % s->total_height; if (x >=3D s->width) { x =3D s->width - 1; @@ -705,37 +709,40 @@ static void console_clear_xy(QemuConsole *s, int x, i= nt y) TextCell *c =3D &s->cells[y1 * s->width + x]; c->ch =3D ' '; c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; - update_xy(s, x, y); + vc_update_xy(vc, x, y); } =20 -static void console_put_one(QemuConsole *s, int ch) +static void vc_put_one(VCChardev *vc, int ch) { + QemuConsole *s =3D vc->console; TextCell *c; int y1; if (s->x >=3D s->width) { /* line wrap */ s->x =3D 0; - console_put_lf(s); + vc_put_lf(vc); } y1 =3D (s->y_base + s->y) % s->total_height; c =3D &s->cells[y1 * s->width + s->x]; c->ch =3D ch; c->t_attrib =3D s->t_attrib; - update_xy(s, s->x, s->y); + vc_update_xy(vc, s->x, s->y); s->x++; } =20 -static void console_respond_str(QemuConsole *s, const char *buf) +static void vc_respond_str(VCChardev *vc, const char *buf) { while (*buf) { - console_put_one(s, *buf); + vc_put_one(vc, *buf); buf++; } } =20 /* set cursor, checking bounds */ -static void set_cursor(QemuConsole *s, int x, int y) +static void vc_set_cursor(VCChardev *vc, int x, int y) { + QemuConsole *s =3D vc->console; + if (x < 0) { x =3D 0; } @@ -753,8 +760,9 @@ static void set_cursor(QemuConsole *s, int x, int y) s->y =3D y; } =20 -static void console_putchar(QemuConsole *s, int ch) +static void vc_putchar(VCChardev *vc, int ch) { + QemuConsole *s =3D vc->console; int i; int x, y; char response[40]; @@ -766,7 +774,7 @@ static void console_putchar(QemuConsole *s, int ch) s->x =3D 0; break; case '\n': /* newline */ - console_put_lf(s); + vc_put_lf(vc); break; case '\b': /* backspace */ if (s->x > 0) @@ -775,7 +783,7 @@ static void console_putchar(QemuConsole *s, int ch) case '\t': /* tabspace */ if (s->x + (8 - (s->x % 8)) > s->width) { s->x =3D 0; - console_put_lf(s); + vc_put_lf(vc); } else { s->x =3D s->x + (8 - (s->x % 8)); } @@ -793,7 +801,7 @@ static void console_putchar(QemuConsole *s, int ch) s->state =3D TTY_STATE_ESC; break; default: - console_put_one(s, ch); + vc_put_one(vc, ch); break; } break; @@ -831,37 +839,37 @@ static void console_putchar(QemuConsole *s, int ch) if (s->esc_params[0] =3D=3D 0) { s->esc_params[0] =3D 1; } - set_cursor(s, s->x, s->y - s->esc_params[0]); + vc_set_cursor(vc, s->x, s->y - s->esc_params[0]); break; case 'B': /* move cursor down */ if (s->esc_params[0] =3D=3D 0) { s->esc_params[0] =3D 1; } - set_cursor(s, s->x, s->y + s->esc_params[0]); + vc_set_cursor(vc, s->x, s->y + s->esc_params[0]); break; case 'C': /* move cursor right */ if (s->esc_params[0] =3D=3D 0) { s->esc_params[0] =3D 1; } - set_cursor(s, s->x + s->esc_params[0], s->y); + vc_set_cursor(vc, s->x + s->esc_params[0], s->y); break; case 'D': /* move cursor left */ if (s->esc_params[0] =3D=3D 0) { s->esc_params[0] =3D 1; } - set_cursor(s, s->x - s->esc_params[0], s->y); + vc_set_cursor(vc, s->x - s->esc_params[0], s->y); break; case 'G': /* move cursor to column */ - set_cursor(s, s->esc_params[0] - 1, s->y); + vc_set_cursor(vc, s->esc_params[0] - 1, s->y); break; case 'f': case 'H': /* move cursor to row, column */ - set_cursor(s, s->esc_params[1] - 1, s->esc_params[0] - 1); + vc_set_cursor(vc, s->esc_params[1] - 1, s->esc_params[0] -= 1); break; case 'J': switch (s->esc_params[0]) { @@ -872,7 +880,7 @@ static void console_putchar(QemuConsole *s, int ch) if (y =3D=3D s->y && x < s->x) { continue; } - console_clear_xy(s, x, y); + vc_clear_xy(vc, x, y); } } break; @@ -883,7 +891,7 @@ static void console_putchar(QemuConsole *s, int ch) if (y =3D=3D s->y && x > s->x) { break; } - console_clear_xy(s, x, y); + vc_clear_xy(vc, x, y); } } break; @@ -891,7 +899,7 @@ static void console_putchar(QemuConsole *s, int ch) /* clear entire screen */ for (y =3D 0; y <=3D s->height; y++) { for (x =3D 0; x < s->width; x++) { - console_clear_xy(s, x, y); + vc_clear_xy(vc, x, y); } } break; @@ -902,38 +910,38 @@ static void console_putchar(QemuConsole *s, int ch) case 0: /* clear to eol */ for(x =3D s->x; x < s->width; x++) { - console_clear_xy(s, x, s->y); + vc_clear_xy(vc, x, s->y); } break; case 1: /* clear from beginning of line */ for (x =3D 0; x <=3D s->x && x < s->width; x++) { - console_clear_xy(s, x, s->y); + vc_clear_xy(vc, x, s->y); } break; case 2: /* clear entire line */ for(x =3D 0; x < s->width; x++) { - console_clear_xy(s, x, s->y); + vc_clear_xy(vc, x, s->y); } break; } break; case 'm': - console_handle_escape(s); + vc_handle_escape(vc); break; case 'n': switch (s->esc_params[0]) { case 5: /* report console status (always succeed)*/ - console_respond_str(s, "\033[0n"); + vc_respond_str(vc, "\033[0n"); break; case 6: /* report cursor position */ sprintf(response, "\033[%d;%dR", (s->y_base + s->y) % s->total_height + 1, s->x + 1); - console_respond_str(s, response); + vc_respond_str(vc, response); break; } break; @@ -1072,7 +1080,7 @@ static int vc_chr_write(Chardev *chr, const uint8_t *= buf, int len) s->update_y1 =3D 0; console_show_cursor(s, 0); for(i =3D 0; i < len; i++) { - console_putchar(s, buf[i]); + vc_putchar(drv, buf[i]); } console_show_cursor(s, 1); if (s->update_x0 < s->update_x1) { --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388426; cv=none; d=zohomail.com; s=zohoarc; b=XNEh93yPHQ+sapM3YbUV2kWiHF8LD/DPabnMzRNk7ysy+fA/aX0cQHus7MFZ5b9+IV0p0auSHaQAObgVDzCTi/uSMBXKEp3JTF6JM/s22LHhQ8e61/mtNSXcdhJsJ33J4ssK5DWebX4yCTNhADEsp5YWOfpmMgOVdTgGiCexHYo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388426; 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=EIie1hpxepfdzgYXnssJ1FtdBJvj090cN1kuFa3cINw=; b=NRBVYx36TcQV8V0e/9Vzkj4eVlplDAa/boIRjPu5Y9BtBSoPLWAE+zZtlP+7bbCNXQTKQSy00e/rQo02moeQuuU+gMikgb3zhtR3BfOWaloCK7epykWWMadLkVhWnCuH0oOpS2LRI/ng7xFIUy1hc1Z/NUr8m1jg1H3RTq0lUkI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388426571830.6275028585449; Wed, 30 Aug 2023 02:40:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHg6-0001Tx-KR; Wed, 30 Aug 2023 05:39:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHg4-0001JS-7d for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHg1-0000yg-Oa for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:39:56 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-176-OfOivLzAME20tDy3hSUTXA-1; Wed, 30 Aug 2023 05:39:51 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EB2058030A9 for ; Wed, 30 Aug 2023 09:39:50 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id B448E6466B; Wed, 30 Aug 2023 09:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388393; 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=EIie1hpxepfdzgYXnssJ1FtdBJvj090cN1kuFa3cINw=; b=POiUu9xJE9+4XrkEpuR2YSF5CeKJXuHcAlgUQN/5kAlDe1IOqPzPQyECFdAWVdgFIEyc33 ltsXxcB2pbJkB4U/tmcFDJVU3lAXF3nUEn8mzgqx0TMWaj9t/drcG1JKfEyJepYC4WTywv 5Z3dPhZqD8vYDFT6tOzrqoOgNl+x/60= X-MC-Unique: OfOivLzAME20tDy3hSUTXA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 16/67] ui/vc: move VCCharDev specific fields out of QemuConsole Date: Wed, 30 Aug 2023 13:37:50 +0400 Message-ID: <20230830093843.3531473-17-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388427166100009 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 147 +++++++++++++++++++++++++-------------------------- 1 file changed, 73 insertions(+), 74 deletions(-) diff --git a/ui/console.c b/ui/console.c index 8fe39aa5e3..b9b545fa3d 100644 --- a/ui/console.c +++ b/ui/console.c @@ -106,10 +106,8 @@ struct QemuConsole { int total_height; int backscroll_height; int x, y; - int x_saved, y_saved; int y_displayed; int y_base; - TextAttributes t_attrib; /* currently active text attributes */ TextCell *cells; int text_x[2], text_y[2], cursor_invalidate; int echo; @@ -119,10 +117,6 @@ struct QemuConsole { int update_x1; int update_y1; =20 - enum TTYState state; - int esc_params[MAX_ESC_PARAMS]; - int nb_esc_params; - Chardev *chr; /* fifo for key pressed */ Fifo8 out_fifo; @@ -134,6 +128,12 @@ struct QemuConsole { struct VCChardev { Chardev parent; QemuConsole *console; + + enum TTYState state; + int esc_params[MAX_ESC_PARAMS]; + int nb_esc_params; + TextAttributes t_attrib; /* currently active text attributes */ + int x_saved, y_saved; }; typedef struct VCChardev VCChardev; =20 @@ -607,93 +607,92 @@ static void vc_put_lf(VCChardev *vc) */ static void vc_handle_escape(VCChardev *vc) { - QemuConsole *s =3D vc->console; int i; =20 - for (i=3D0; inb_esc_params; i++) { - switch (s->esc_params[i]) { + for (i =3D 0; i < vc->nb_esc_params; i++) { + switch (vc->esc_params[i]) { case 0: /* reset all console attributes to default */ - s->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; + vc->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; break; case 1: - s->t_attrib.bold =3D 1; + vc->t_attrib.bold =3D 1; break; case 4: - s->t_attrib.uline =3D 1; + vc->t_attrib.uline =3D 1; break; case 5: - s->t_attrib.blink =3D 1; + vc->t_attrib.blink =3D 1; break; case 7: - s->t_attrib.invers =3D 1; + vc->t_attrib.invers =3D 1; break; case 8: - s->t_attrib.unvisible =3D 1; + vc->t_attrib.unvisible =3D 1; break; case 22: - s->t_attrib.bold =3D 0; + vc->t_attrib.bold =3D 0; break; case 24: - s->t_attrib.uline =3D 0; + vc->t_attrib.uline =3D 0; break; case 25: - s->t_attrib.blink =3D 0; + vc->t_attrib.blink =3D 0; break; case 27: - s->t_attrib.invers =3D 0; + vc->t_attrib.invers =3D 0; break; case 28: - s->t_attrib.unvisible =3D 0; + vc->t_attrib.unvisible =3D 0; break; /* set foreground color */ case 30: - s->t_attrib.fgcol =3D QEMU_COLOR_BLACK; + vc->t_attrib.fgcol =3D QEMU_COLOR_BLACK; break; case 31: - s->t_attrib.fgcol =3D QEMU_COLOR_RED; + vc->t_attrib.fgcol =3D QEMU_COLOR_RED; break; case 32: - s->t_attrib.fgcol =3D QEMU_COLOR_GREEN; + vc->t_attrib.fgcol =3D QEMU_COLOR_GREEN; break; case 33: - s->t_attrib.fgcol =3D QEMU_COLOR_YELLOW; + vc->t_attrib.fgcol =3D QEMU_COLOR_YELLOW; break; case 34: - s->t_attrib.fgcol =3D QEMU_COLOR_BLUE; + vc->t_attrib.fgcol =3D QEMU_COLOR_BLUE; break; case 35: - s->t_attrib.fgcol =3D QEMU_COLOR_MAGENTA; + vc->t_attrib.fgcol =3D QEMU_COLOR_MAGENTA; break; case 36: - s->t_attrib.fgcol =3D QEMU_COLOR_CYAN; + vc->t_attrib.fgcol =3D QEMU_COLOR_CYAN; break; case 37: - s->t_attrib.fgcol =3D QEMU_COLOR_WHITE; + vc->t_attrib.fgcol =3D QEMU_COLOR_WHITE; break; /* set background color */ case 40: - s->t_attrib.bgcol =3D QEMU_COLOR_BLACK; + vc->t_attrib.bgcol =3D QEMU_COLOR_BLACK; break; case 41: - s->t_attrib.bgcol =3D QEMU_COLOR_RED; + vc->t_attrib.bgcol =3D QEMU_COLOR_RED; break; case 42: - s->t_attrib.bgcol =3D QEMU_COLOR_GREEN; + vc->t_attrib.bgcol =3D QEMU_COLOR_GREEN; break; case 43: - s->t_attrib.bgcol =3D QEMU_COLOR_YELLOW; + vc->t_attrib.bgcol =3D QEMU_COLOR_YELLOW; break; case 44: - s->t_attrib.bgcol =3D QEMU_COLOR_BLUE; + vc->t_attrib.bgcol =3D QEMU_COLOR_BLUE; break; case 45: - s->t_attrib.bgcol =3D QEMU_COLOR_MAGENTA; + vc->t_attrib.bgcol =3D QEMU_COLOR_MAGENTA; break; case 46: - s->t_attrib.bgcol =3D QEMU_COLOR_CYAN; + vc->t_attrib.bgcol =3D QEMU_COLOR_CYAN; break; case 47: - s->t_attrib.bgcol =3D QEMU_COLOR_WHITE; + vc->t_attrib.bgcol =3D QEMU_COLOR_WHITE; break; } } @@ -725,7 +724,7 @@ static void vc_put_one(VCChardev *vc, int ch) y1 =3D (s->y_base + s->y) % s->total_height; c =3D &s->cells[y1 * s->width + s->x]; c->ch =3D ch; - c->t_attrib =3D s->t_attrib; + c->t_attrib =3D vc->t_attrib; vc_update_xy(vc, s->x, s->y); s->x++; } @@ -767,7 +766,7 @@ static void vc_putchar(VCChardev *vc, int ch) int x, y; char response[40]; =20 - switch(s->state) { + switch(vc->state) { case TTY_STATE_NORM: switch(ch) { case '\r': /* carriage return */ @@ -798,7 +797,7 @@ static void vc_putchar(VCChardev *vc, int ch) /* SO (shift out), character set 1 (ignored) */ break; case 27: /* esc (introducing an escape sequence) */ - s->state =3D TTY_STATE_ESC; + vc->state =3D TTY_STATE_ESC; break; default: vc_put_one(vc, ch); @@ -808,71 +807,71 @@ static void vc_putchar(VCChardev *vc, int ch) case TTY_STATE_ESC: /* check if it is a terminal escape sequence */ if (ch =3D=3D '[') { for(i=3D0;iesc_params[i] =3D 0; - s->nb_esc_params =3D 0; - s->state =3D TTY_STATE_CSI; + vc->esc_params[i] =3D 0; + vc->nb_esc_params =3D 0; + vc->state =3D TTY_STATE_CSI; } else { - s->state =3D TTY_STATE_NORM; + vc->state =3D TTY_STATE_NORM; } break; case TTY_STATE_CSI: /* handle escape sequence parameters */ if (ch >=3D '0' && ch <=3D '9') { - if (s->nb_esc_params < MAX_ESC_PARAMS) { - int *param =3D &s->esc_params[s->nb_esc_params]; + if (vc->nb_esc_params < MAX_ESC_PARAMS) { + int *param =3D &vc->esc_params[vc->nb_esc_params]; int digit =3D (ch - '0'); =20 *param =3D (*param <=3D (INT_MAX - digit) / 10) ? *param * 10 + digit : INT_MAX; } } else { - if (s->nb_esc_params < MAX_ESC_PARAMS) - s->nb_esc_params++; + if (vc->nb_esc_params < MAX_ESC_PARAMS) + vc->nb_esc_params++; if (ch =3D=3D ';' || ch =3D=3D '?') { break; } - trace_console_putchar_csi(s->esc_params[0], s->esc_params[1], - ch, s->nb_esc_params); - s->state =3D TTY_STATE_NORM; + trace_console_putchar_csi(vc->esc_params[0], vc->esc_params[1], + ch, vc->nb_esc_params); + vc->state =3D TTY_STATE_NORM; switch(ch) { case 'A': /* move cursor up */ - if (s->esc_params[0] =3D=3D 0) { - s->esc_params[0] =3D 1; + if (vc->esc_params[0] =3D=3D 0) { + vc->esc_params[0] =3D 1; } - vc_set_cursor(vc, s->x, s->y - s->esc_params[0]); + vc_set_cursor(vc, s->x, s->y - vc->esc_params[0]); break; case 'B': /* move cursor down */ - if (s->esc_params[0] =3D=3D 0) { - s->esc_params[0] =3D 1; + if (vc->esc_params[0] =3D=3D 0) { + vc->esc_params[0] =3D 1; } - vc_set_cursor(vc, s->x, s->y + s->esc_params[0]); + vc_set_cursor(vc, s->x, s->y + vc->esc_params[0]); break; case 'C': /* move cursor right */ - if (s->esc_params[0] =3D=3D 0) { - s->esc_params[0] =3D 1; + if (vc->esc_params[0] =3D=3D 0) { + vc->esc_params[0] =3D 1; } - vc_set_cursor(vc, s->x + s->esc_params[0], s->y); + vc_set_cursor(vc, s->x + vc->esc_params[0], s->y); break; case 'D': /* move cursor left */ - if (s->esc_params[0] =3D=3D 0) { - s->esc_params[0] =3D 1; + if (vc->esc_params[0] =3D=3D 0) { + vc->esc_params[0] =3D 1; } - vc_set_cursor(vc, s->x - s->esc_params[0], s->y); + vc_set_cursor(vc, s->x - vc->esc_params[0], s->y); break; case 'G': /* move cursor to column */ - vc_set_cursor(vc, s->esc_params[0] - 1, s->y); + vc_set_cursor(vc, vc->esc_params[0] - 1, s->y); break; case 'f': case 'H': /* move cursor to row, column */ - vc_set_cursor(vc, s->esc_params[1] - 1, s->esc_params[0] -= 1); + vc_set_cursor(vc, vc->esc_params[1] - 1, vc->esc_params[0]= - 1); break; case 'J': - switch (s->esc_params[0]) { + switch (vc->esc_params[0]) { case 0: /* clear to end of screen */ for (y =3D s->y; y < s->height; y++) { @@ -906,7 +905,7 @@ static void vc_putchar(VCChardev *vc, int ch) } break; case 'K': - switch (s->esc_params[0]) { + switch (vc->esc_params[0]) { case 0: /* clear to eol */ for(x =3D s->x; x < s->width; x++) { @@ -931,7 +930,7 @@ static void vc_putchar(VCChardev *vc, int ch) vc_handle_escape(vc); break; case 'n': - switch (s->esc_params[0]) { + switch (vc->esc_params[0]) { case 5: /* report console status (always succeed)*/ vc_respond_str(vc, "\033[0n"); @@ -947,13 +946,13 @@ static void vc_putchar(VCChardev *vc, int ch) break; case 's': /* save cursor position */ - s->x_saved =3D s->x; - s->y_saved =3D s->y; + vc->x_saved =3D s->x; + vc->y_saved =3D s->y; break; case 'u': /* restore cursor position */ - s->x =3D s->x_saved; - s->y =3D s->y_saved; + s->x =3D vc->x_saved; + s->y =3D vc->y_saved; break; default: trace_console_putchar_unhandled(ch); @@ -2428,17 +2427,17 @@ static void text_console_do_init(Chardev *chr) s->hw =3D s; =20 /* set current text attributes to default */ - s->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; + drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; text_console_resize(s); =20 if (chr->label) { char *msg; =20 - s->t_attrib.bgcol =3D QEMU_COLOR_BLUE; + drv->t_attrib.bgcol =3D QEMU_COLOR_BLUE; msg =3D g_strdup_printf("%s console\r\n", chr->label); qemu_chr_write(chr, (uint8_t *)msg, strlen(msg), true); g_free(msg); - s->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; + drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; } =20 qemu_chr_be_event(chr, CHR_EVENT_OPENED); --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388588; cv=none; d=zohomail.com; s=zohoarc; b=KxXu0xnX8T/Z8waaRs8RAsXD9HpdhlLA8iAjuLZ29rs2MpYojZ7rc3xA0KGdSrJHqu1CVJmWIoR4n0CVY8xpNKYYGFEYgv1nwA5RP6qzgYAWmBXXZJ8eL3Lpwb7sMjcV50xz9TE3hZ4iCbyCvYt54Yh2u3YRhSQ3TPGs3+VxeSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388588; 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=8fRM25l9RmgUDSi1sOeWrUKzYOQlHUkeJlYn7juQyPs=; b=m620iIJGug4MKQmtHbtoFlPzfZ7roHy5BU7HWsILIB2piO4LyAStSj+RupJuMjGtnnDUgOyfpi6Jo+XSAzTyFPrijJuF7bTrRTxSgZhQuU/SSdMtC7wPX/UwaFYwO1srtSxp3yfh4RdqhS9pNvR/565gPsWdHfBRoZjui+cJR5I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388588906740.2703677966866; Wed, 30 Aug 2023 02:43:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgH-00024G-Ul; Wed, 30 Aug 2023 05:40:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgA-0001yw-0o for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHg6-0000zK-Ld for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:01 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-657-5L0QODj3OOyjAL3dhiD8wg-1; Wed, 30 Aug 2023 05:39:54 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5E149185A791 for ; Wed, 30 Aug 2023 09:39:54 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DAC740C2063; Wed, 30 Aug 2023 09:39:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388398; 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=8fRM25l9RmgUDSi1sOeWrUKzYOQlHUkeJlYn7juQyPs=; b=cSeukjP8olFbg3NSfrEovf6fDEZEQHXyg4UxnDYDiasl18RdA8dKmu2YJKsWMPUJ2DwGij 4tDxkwpVrHV4rMS+XoxnVF6fbsCLozuOQ//PKtlwfZ7Lz3EhZSV2HRnwyXzkTBDezKYOQ6 apZGqE9AB4izn9H4D3YwYPPplzGYRuE= X-MC-Unique: 5L0QODj3OOyjAL3dhiD8wg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 17/67] ui/console: use OBJECT_DEFINE_TYPE for QemuConsole Date: Wed, 30 Aug 2023 13:37:51 +0400 Message-ID: <20230830093843.3531473-18-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388589588100007 From: Marc-Andr=C3=A9 Lureau The following patch will move some object initialization to the corresponding handlers. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/ui/console.c b/ui/console.c index b9b545fa3d..7d0bb819ac 100644 --- a/ui/console.c +++ b/ui/console.c @@ -125,6 +125,8 @@ struct QemuConsole { QTAILQ_ENTRY(QemuConsole) next; }; =20 +OBJECT_DEFINE_TYPE(QemuConsole, qemu_console, QEMU_CONSOLE, OBJECT) + struct VCChardev { Chardev parent; QemuConsole *console; @@ -1314,6 +1316,21 @@ static QemuConsole *new_console(console_type_t conso= le_type, return s; } =20 +static void +qemu_console_finalize(Object *obj) +{ +} + +static void +qemu_console_class_init(ObjectClass *oc, void *data) +{ +} + +static void +qemu_console_init(Object *obj) +{ +} + #ifdef WIN32 void qemu_displaysurface_win32_set_handle(DisplaySurface *surface, HANDLE h, uint32_t offset) @@ -2647,13 +2664,6 @@ void qemu_chr_parse_vc(QemuOpts *opts, ChardevBacken= d *backend, Error **errp) } } =20 -static const TypeInfo qemu_console_info =3D { - .name =3D TYPE_QEMU_CONSOLE, - .parent =3D TYPE_OBJECT, - .instance_size =3D sizeof(QemuConsole), - .class_size =3D sizeof(QemuConsoleClass), -}; - static void char_vc_class_init(ObjectClass *oc, void *data) { ChardevClass *cc =3D CHARDEV_CLASS(oc); @@ -2679,10 +2689,3 @@ void qemu_console_early_init(void) type_register(&char_vc_type_info); } } - -static void register_types(void) -{ - type_register_static(&qemu_console_info); -} - -type_init(register_types); --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388564; cv=none; d=zohomail.com; s=zohoarc; b=Ano8Shzm/uqckG7DpVg0qhzgN3dKS+BRXztxXFY78+tK7SmBEzGoVIloDCJ8CpPJYrYy+R4DlRWg7IX0uCW8WecCpWPjApUBxDroASaT62zhkpUWICVkw1FCBjHZDncS15oVYtMqiTCd+XDcQek4/W2JdCIERWOIR+p423/NpAI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388564; 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=XFnOdNYuiv69WO1ry6iYZlboB+aJKY5lwScUXpmbQ2Q=; b=ckh7WdYzQITN3syCOrQ5pU5lm8QZqZO3j+FlnYfHfC4dhxVPN9UfgjK9U9mgewNNb6Qg0P+oO0Zt7/APi3IXn6J1P6f9guZ+EjYYvy/903/ubofczRuTArejUF4vFxa79rcx2s6c6pJeVZsa8ATsOHArhSSLvOyag+NounUWWOs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388564671387.4784607590368; Wed, 30 Aug 2023 02:42:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgO-0002Ao-Ie; Wed, 30 Aug 2023 05:40:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgB-00021w-PL for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHg9-0000zd-4L for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:03 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-15-wOuSYbXcMXibzy8mcuuICw-1; Wed, 30 Aug 2023 05:39:58 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B3053C100B6 for ; Wed, 30 Aug 2023 09:39:58 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D950C15BAE; Wed, 30 Aug 2023 09:39:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388400; 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=XFnOdNYuiv69WO1ry6iYZlboB+aJKY5lwScUXpmbQ2Q=; b=Zd20JXdqLOgdnI215INvsm7F2r7WAbBN8p66JqwZQAqeu68HAL33Ci8ORJ2jbBIxreDm07 ka/aXzlezRD6ghEIWMyb9rz8+AExLL/YpusjyQPYrqou4p3SygDBzXPlmrqEuJ5GtLgQPF hmtpev5cIqpclYSkzD9RZ1K2E2NXuMI= X-MC-Unique: wOuSYbXcMXibzy8mcuuICw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 18/67] ui/console: change new_console() to use object initialization Date: Wed, 30 Aug 2023 13:37:52 +0400 Message-ID: <20230830093843.3531473-19-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388566231100001 From: Marc-Andr=C3=A9 Lureau Object construction should be done in respective object instance and class handlers. Introduce qemu_console_register() to split out the registration logic. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 93 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 37 deletions(-) diff --git a/ui/console.c b/ui/console.c index 7d0bb819ac..bdecfe7306 100644 --- a/ui/console.c +++ b/ui/console.c @@ -27,6 +27,7 @@ #include "hw/qdev-core.h" #include "qapi/error.h" #include "qapi/qapi-commands-ui.h" +#include "qapi/visitor.h" #include "qemu/coroutine.h" #include "qemu/fifo8.h" #include "qemu/error-report.h" @@ -1253,40 +1254,24 @@ static void text_console_update(void *opaque, conso= le_ch_t *chardata) } } =20 -static QemuConsole *new_console(console_type_t console_type, - uint32_t head) +static void +qemu_console_register(QemuConsole *c, console_type_t console_type) { - DisplayState *ds =3D get_alloc_displaystate(); - Object *obj; - QemuConsole *s; int i; =20 - obj =3D object_new(TYPE_QEMU_CONSOLE); - s =3D QEMU_CONSOLE(obj); - qemu_co_queue_init(&s->dump_queue); - s->head =3D head; - object_property_add_link(obj, "device", TYPE_DEVICE, - (Object **)&s->device, - object_property_allow_set_link, - OBJ_PROP_LINK_STRONG); - object_property_add_uint32_ptr(obj, "head", &s->head, - OBJ_PROP_FLAG_READ); - if (!active_console || ((active_console->console_type !=3D GRAPHIC_CON= SOLE) && - (console_type =3D=3D GRAPHIC_CONSOLE))) { - active_console =3D s; + (console_type =3D=3D GRAPHIC_CONSOLE))) { + active_console =3D c; } - s->ds =3D ds; - s->console_type =3D console_type; - s->window_id =3D -1; + c->console_type =3D console_type; =20 if (QTAILQ_EMPTY(&consoles)) { - s->index =3D 0; - QTAILQ_INSERT_TAIL(&consoles, s, next); + c->index =3D 0; + QTAILQ_INSERT_TAIL(&consoles, c, next); } else if (console_type !=3D GRAPHIC_CONSOLE || phase_check(PHASE_MACH= INE_READY)) { QemuConsole *last =3D QTAILQ_LAST(&consoles); - s->index =3D last->index + 1; - QTAILQ_INSERT_TAIL(&consoles, s, next); + c->index =3D last->index + 1; + QTAILQ_INSERT_TAIL(&consoles, c, next); } else { /* * HACK: Put graphical consoles before text consoles. @@ -1294,41 +1279,75 @@ static QemuConsole *new_console(console_type_t cons= ole_type, * Only do that for coldplugged devices. After initial device * initialization we will not renumber the consoles any more. */ - QemuConsole *c =3D QTAILQ_FIRST(&consoles); + QemuConsole *it =3D QTAILQ_FIRST(&consoles); =20 - while (QTAILQ_NEXT(c, next) !=3D NULL && - c->console_type =3D=3D GRAPHIC_CONSOLE) { - c =3D QTAILQ_NEXT(c, next); + while (QTAILQ_NEXT(it, next) !=3D NULL && + it->console_type =3D=3D GRAPHIC_CONSOLE) { + it =3D QTAILQ_NEXT(it, next); } - if (c->console_type =3D=3D GRAPHIC_CONSOLE) { + if (it->console_type =3D=3D GRAPHIC_CONSOLE) { /* have no text consoles */ - s->index =3D c->index + 1; - QTAILQ_INSERT_AFTER(&consoles, c, s, next); + c->index =3D it->index + 1; + QTAILQ_INSERT_AFTER(&consoles, it, c, next); } else { - s->index =3D c->index; - QTAILQ_INSERT_BEFORE(c, s, next); + c->index =3D it->index; + QTAILQ_INSERT_BEFORE(it, c, next); /* renumber text consoles */ - for (i =3D s->index + 1; c !=3D NULL; c =3D QTAILQ_NEXT(c, nex= t), i++) { - c->index =3D i; + for (i =3D c->index + 1; it !=3D NULL; it =3D QTAILQ_NEXT(it, = next), i++) { + it->index =3D i; } } } - return s; } =20 static void qemu_console_finalize(Object *obj) { + /* TODO: should unregister from consoles and free itself */ +} + +static void +qemu_console_prop_get_head(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + QemuConsole *c =3D QEMU_CONSOLE(obj); + + visit_type_uint32(v, name, &c->head, errp); } =20 static void qemu_console_class_init(ObjectClass *oc, void *data) { + object_class_property_add_link(oc, "device", TYPE_DEVICE, + offsetof(QemuConsole, device), + object_property_allow_set_link, + OBJ_PROP_LINK_STRONG); + object_class_property_add(oc, "head", "uint32", + qemu_console_prop_get_head, + NULL, NULL, NULL); } =20 static void qemu_console_init(Object *obj) { + QemuConsole *c =3D QEMU_CONSOLE(obj); + DisplayState *ds =3D get_alloc_displaystate(); + + qemu_co_queue_init(&c->dump_queue); + c->ds =3D ds; + c->window_id =3D -1; +} + +static QemuConsole *new_console(console_type_t console_type, + uint32_t head) +{ + QemuConsole *c =3D QEMU_CONSOLE(object_new(TYPE_QEMU_CONSOLE)); + + c->head =3D head; + /* TODO: move to console_init() once there is a type hierarchy */ + qemu_console_register(c, console_type); + + return c; } =20 #ifdef WIN32 --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388497; cv=none; d=zohomail.com; s=zohoarc; b=ILbbN6qwPKs2FSmK6GNyyD6aRh3tZSYmGdQwg6OGXzIIevk/rcHS2A2sfuRHNf4kKuktOMlRoLkvgVHbF8Vw+s79ckIqOojoAxp9gxOsDVp9uIqjAvwtr3LXynmVzY+el62TSA04N0YceINAAbUh9UlUkGzHE+UEDUQNUeRMl+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388497; 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=3zoYg89OwJfG0NluN1/bV+0j5aS05WZHXFM7pIMf1rE=; b=h3p3l8sLSk+5AKbmCKFR3zD2Z3vWHGactXuPwXKdE6qzDt8rsyyFDlM7dRHu/6wy/ZGeEKqY1W6IF8sCP0PTCR+SqDmgdoFC+F9K1K90jBzKxiVJMtgTeaNvVfljAapU6x5tozaSwtmnEG3w7r6Odjo7dTaMV/HLsLIUFIOE1Qc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388497975588.7941612414701; Wed, 30 Aug 2023 02:41:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgQ-0002Ow-Vt; Wed, 30 Aug 2023 05:40:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgE-00024r-Od for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgC-00018y-Di for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:06 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-63-cTVQl1VaPpuEhtUwi2ZkLw-1; Wed, 30 Aug 2023 05:40:01 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 97EEA29ABA1C for ; Wed, 30 Aug 2023 09:40:01 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id E75D6492C13; Wed, 30 Aug 2023 09:40:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388403; 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=3zoYg89OwJfG0NluN1/bV+0j5aS05WZHXFM7pIMf1rE=; b=embzbSHJV84/AS54PeCDrvqv5iBeTuTaE66o5m4W+mTLz/nRxiMA4xF8WvtNvz+W1Jr6TE E/QN1I2jl6jry3n9jH0608qXjPvaEVZE+KItg6CLy1xrGiZOXNQ+gtvoV/xTnOSSNhdvpr fJ4TEVX+y01hdFpOkFr0yTHXK4c/LzQ= X-MC-Unique: cTVQl1VaPpuEhtUwi2ZkLw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 19/67] ui/console: introduce different console objects Date: Wed, 30 Aug 2023 13:37:53 +0400 Message-ID: <20230830093843.3531473-20-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388498970100002 From: Marc-Andr=C3=A9 Lureau Boilerplate code to introduce different object types for the different console types. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/ui/console.c b/ui/console.c index bdecfe7306..4ca5064cc9 100644 --- a/ui/console.c +++ b/ui/console.c @@ -128,6 +128,45 @@ struct QemuConsole { =20 OBJECT_DEFINE_TYPE(QemuConsole, qemu_console, QEMU_CONSOLE, OBJECT) =20 +typedef struct QemuGraphicConsole { + QemuConsole parent; +} QemuGraphicConsole; + +typedef QemuConsoleClass QemuGraphicConsoleClass; + +#define TYPE_QEMU_GRAPHIC_CONSOLE "qemu-graphic-console" +OBJECT_DECLARE_SIMPLE_TYPE(QemuGraphicConsole, QEMU_GRAPHIC_CONSOLE) +OBJECT_DEFINE_TYPE(QemuGraphicConsole, qemu_graphic_console, QEMU_GRAPHIC_= CONSOLE, QEMU_CONSOLE) + +#define QEMU_IS_GRAPHIC_CONSOLE(c) \ + object_dynamic_cast(OBJECT(c), TYPE_QEMU_GRAPHIC_CONSOLE) + +typedef struct QemuTextConsole { + QemuConsole parent; +} QemuTextConsole; + +typedef QemuConsoleClass QemuTextConsoleClass; + +#define TYPE_QEMU_TEXT_CONSOLE "qemu-text-console" +OBJECT_DECLARE_SIMPLE_TYPE(QemuTextConsole, QEMU_TEXT_CONSOLE) +OBJECT_DEFINE_TYPE(QemuTextConsole, qemu_text_console, QEMU_TEXT_CONSOLE, = QEMU_CONSOLE) + +#define QEMU_IS_TEXT_CONSOLE(c) \ + object_dynamic_cast(OBJECT(c), TYPE_QEMU_TEXT_CONSOLE) + +typedef struct QemuFixedTextConsole { + QemuTextConsole parent; +} QemuFixedTextConsole; + +typedef QemuTextConsoleClass QemuFixedTextConsoleClass; + +#define TYPE_QEMU_FIXED_TEXT_CONSOLE "qemu-fixed-text-console" +OBJECT_DECLARE_SIMPLE_TYPE(QemuFixedTextConsole, QEMU_FIXED_TEXT_CONSOLE) +OBJECT_DEFINE_TYPE(QemuFixedTextConsole, qemu_fixed_text_console, QEMU_FIX= ED_TEXT_CONSOLE, QEMU_TEXT_CONSOLE) + +#define QEMU_IS_FIXED_TEXT_CONSOLE(c) \ + object_dynamic_cast(OBJECT(c), TYPE_QEMU_FIXED_TEXT_CONSOLE) + struct VCChardev { Chardev parent; QemuConsole *console; @@ -1338,6 +1377,51 @@ qemu_console_init(Object *obj) c->window_id =3D -1; } =20 +static void +qemu_graphic_console_finalize(Object *obj) +{ +} + +static void +qemu_graphic_console_class_init(ObjectClass *oc, void *data) +{ +} + +static void +qemu_graphic_console_init(Object *obj) +{ +} + +static void +qemu_text_console_finalize(Object *obj) +{ +} + +static void +qemu_text_console_class_init(ObjectClass *oc, void *data) +{ +} + +static void +qemu_text_console_init(Object *obj) +{ +} + +static void +qemu_fixed_text_console_finalize(Object *obj) +{ +} + +static void +qemu_fixed_text_console_class_init(ObjectClass *oc, void *data) +{ +} + +static void +qemu_fixed_text_console_init(Object *obj) +{ +} + static QemuConsole *new_console(console_type_t console_type, uint32_t head) { --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388426; cv=none; d=zohomail.com; s=zohoarc; b=FXiwod4bCRG2uXf6sEL+2ZMq79b3xe/CU2jaHl5gf/ZzJ8SvR28zNcGsduxuJ/c03IbID418CUAXavkAjBlHdkw+imIAC7Y/5i8W6Eh0R6NDHvcymP+Vjq6X4f07s9oXUYAO3X0o34KdHa41iVHzlPmIimzAjwjqmiPBu+3jfr0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388426; 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=aBsAFU5yizKx7iU38IygwtEbtVoJN5CJaxMzU8Gi3T0=; b=F1CcAVCNOhc6fXwfJ8/5dP7NESddD6pVpYaWAtpeluU/O5qavyloMapJwcDCF4JIiiBy0BgksaSMtb39Wywd2FW/l4du5h80yj2qJUjlisQOY87F1nhL5ca9D9VFKn+OXUVYH0+AJ6kIzmVGOpr8WYMvragckuBywcUlFrhXilA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388425978194.76554921969796; Wed, 30 Aug 2023 02:40:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgT-0002l9-9T; Wed, 30 Aug 2023 05:40:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgJ-00028p-I8 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgH-0001EB-5h for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:11 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-602-pQsmxPTIOumLzG1q0v2jDg-1; Wed, 30 Aug 2023 05:40:06 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F31380CD88 for ; Wed, 30 Aug 2023 09:40:06 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B00240C2063; Wed, 30 Aug 2023 09:40:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388408; 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=aBsAFU5yizKx7iU38IygwtEbtVoJN5CJaxMzU8Gi3T0=; b=aM1dtPzWEhqpAruqJNCjoGA6EfGeABVTqxe3UD9A0E1boLKn0of5UeBsH9P5R+ZDYdMqDp q1nYtaHo79X8smiGlp8IkhzbgKELcL3KjteapMxLMf0mIyiNVt8mBZAUlHm7fHAGa1Q2+Z QXbyZCW/3ch/Jl4iesFhn5T6Cnpbpqo= X-MC-Unique: pQsmxPTIOumLzG1q0v2jDg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 20/67] ui/console: instantiate a specific console type Date: Wed, 30 Aug 2023 13:37:54 +0400 Message-ID: <20230830093843.3531473-21-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388426514100003 From: Marc-Andr=C3=A9 Lureau This will allow to move code/data to the specific console types. Replace console_type_t with object type check. QemuConsole can be abstract. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 47 +++++++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/ui/console.c b/ui/console.c index 4ca5064cc9..dd8e8db525 100644 --- a/ui/console.c +++ b/ui/console.c @@ -71,17 +71,10 @@ enum TTYState { TTY_STATE_CSI, }; =20 -typedef enum { - GRAPHIC_CONSOLE, - TEXT_CONSOLE, - TEXT_CONSOLE_FIXED_SIZE -} console_type_t; - struct QemuConsole { Object parent; =20 int index; - console_type_t console_type; DisplayState *ds; DisplaySurface *surface; DisplayScanout scanout; @@ -126,7 +119,7 @@ struct QemuConsole { QTAILQ_ENTRY(QemuConsole) next; }; =20 -OBJECT_DEFINE_TYPE(QemuConsole, qemu_console, QEMU_CONSOLE, OBJECT) +OBJECT_DEFINE_ABSTRACT_TYPE(QemuConsole, qemu_console, QEMU_CONSOLE, OBJEC= T) =20 typedef struct QemuGraphicConsole { QemuConsole parent; @@ -1156,7 +1149,7 @@ void kbd_put_keysym_console(QemuConsole *s, int keysy= m) int c; uint32_t num_free; =20 - if (!s || (s->console_type =3D=3D GRAPHIC_CONSOLE)) + if (!s || QEMU_IS_GRAPHIC_CONSOLE(s)) return; =20 switch(keysym) { @@ -1258,7 +1251,7 @@ static void text_console_invalidate(void *opaque) { QemuConsole *s =3D (QemuConsole *) opaque; =20 - if (s->console_type =3D=3D TEXT_CONSOLE) { + if (QEMU_IS_TEXT_CONSOLE(s) && !QEMU_IS_FIXED_TEXT_CONSOLE(s)) { text_console_resize(s); } console_refresh(s); @@ -1294,20 +1287,19 @@ static void text_console_update(void *opaque, conso= le_ch_t *chardata) } =20 static void -qemu_console_register(QemuConsole *c, console_type_t console_type) +qemu_console_register(QemuConsole *c) { int i; =20 - if (!active_console || ((active_console->console_type !=3D GRAPHIC_CON= SOLE) && - (console_type =3D=3D GRAPHIC_CONSOLE))) { + if (!active_console || (!QEMU_IS_GRAPHIC_CONSOLE(active_console) && + QEMU_IS_GRAPHIC_CONSOLE(c))) { active_console =3D c; } - c->console_type =3D console_type; =20 if (QTAILQ_EMPTY(&consoles)) { c->index =3D 0; QTAILQ_INSERT_TAIL(&consoles, c, next); - } else if (console_type !=3D GRAPHIC_CONSOLE || phase_check(PHASE_MACH= INE_READY)) { + } else if (!QEMU_IS_GRAPHIC_CONSOLE(c) || phase_check(PHASE_MACHINE_RE= ADY)) { QemuConsole *last =3D QTAILQ_LAST(&consoles); c->index =3D last->index + 1; QTAILQ_INSERT_TAIL(&consoles, c, next); @@ -1320,11 +1312,10 @@ qemu_console_register(QemuConsole *c, console_type_= t console_type) */ QemuConsole *it =3D QTAILQ_FIRST(&consoles); =20 - while (QTAILQ_NEXT(it, next) !=3D NULL && - it->console_type =3D=3D GRAPHIC_CONSOLE) { + while (QTAILQ_NEXT(it, next) !=3D NULL && QEMU_IS_GRAPHIC_CONSOLE(= it)) { it =3D QTAILQ_NEXT(it, next); } - if (it->console_type =3D=3D GRAPHIC_CONSOLE) { + if (QEMU_IS_GRAPHIC_CONSOLE(it)) { /* have no text consoles */ c->index =3D it->index + 1; QTAILQ_INSERT_AFTER(&consoles, it, c, next); @@ -1422,14 +1413,14 @@ qemu_fixed_text_console_init(Object *obj) { } =20 -static QemuConsole *new_console(console_type_t console_type, +static QemuConsole *new_console(const char *typename, uint32_t head) { - QemuConsole *c =3D QEMU_CONSOLE(object_new(TYPE_QEMU_CONSOLE)); + QemuConsole *c =3D QEMU_CONSOLE(object_new(typename)); =20 c->head =3D head; /* TODO: move to console_init() once there is a type hierarchy */ - qemu_console_register(c, console_type); + qemu_console_register(c); =20 return c; } @@ -2211,7 +2202,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, u= int32_t head, height =3D qemu_console_get_height(s, 0); } else { trace_console_gfx_new(); - s =3D new_console(GRAPHIC_CONSOLE, head); + s =3D new_console(TYPE_QEMU_GRAPHIC_CONSOLE, head); s->ui_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, dpy_set_ui_info_timer, s); } @@ -2345,7 +2336,7 @@ bool qemu_console_is_graphic(QemuConsole *con) if (con =3D=3D NULL) { con =3D active_console; } - return con && (con->console_type =3D=3D GRAPHIC_CONSOLE); + return con && QEMU_IS_GRAPHIC_CONSOLE(con); } =20 bool qemu_console_is_fixedsize(QemuConsole *con) @@ -2353,7 +2344,7 @@ bool qemu_console_is_fixedsize(QemuConsole *con) if (con =3D=3D NULL) { con =3D active_console; } - return con && (con->console_type !=3D TEXT_CONSOLE); + return con && (QEMU_IS_GRAPHIC_CONSOLE(con) || QEMU_IS_FIXED_TEXT_CONS= OLE(con)); } =20 bool qemu_console_is_gl_blocked(QemuConsole *con) @@ -2389,7 +2380,7 @@ bool qemu_console_is_multihead(DeviceState *dev) =20 char *qemu_console_get_label(QemuConsole *con) { - if (con->console_type =3D=3D GRAPHIC_CONSOLE) { + if (QEMU_IS_GRAPHIC_CONSOLE(con)) { if (con->device) { DeviceState *dev; bool multihead; @@ -2588,9 +2579,9 @@ static void vc_chr_open(Chardev *chr, =20 trace_console_txt_new(width, height); if (width =3D=3D 0 || height =3D=3D 0) { - s =3D new_console(TEXT_CONSOLE, 0); + s =3D new_console(TYPE_QEMU_TEXT_CONSOLE, 0); } else { - s =3D new_console(TEXT_CONSOLE_FIXED_SIZE, 0); + s =3D new_console(TYPE_QEMU_FIXED_TEXT_CONSOLE, 0); s->scanout.kind =3D SCANOUT_SURFACE; s->surface =3D qemu_create_displaysurface(width, height); } @@ -2610,7 +2601,7 @@ void qemu_console_resize(QemuConsole *s, int width, i= nt height) { DisplaySurface *surface =3D qemu_console_surface(s); =20 - assert(s->console_type =3D=3D GRAPHIC_CONSOLE); + assert(QEMU_IS_GRAPHIC_CONSOLE(s)); =20 if ((s->scanout.kind !=3D SCANOUT_SURFACE || (surface && surface->flags & QEMU_ALLOCATED_FLAG)) && --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388588; cv=none; d=zohomail.com; s=zohoarc; b=Ia0iFQOetAfJ7fYt9VCZyLdXSyIt1mqp70Eps+rW3o0VFEtZXwPHotLCoAUXCnvwVj0+b2jpuEttaaOQctNYDu0tdlN4radro1pYcM8gFfBTeIySxW5Nr3JvscMOcpaHaK8mcLfcQzvqRnGzC+3H6IWk3jQgr23UaSIyIzPbGOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388588; 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=AKF+GA0EJq/HVYpB+7hO5jCiU+FrMKbnfZ1BWuiFK60=; b=a+UnQEt8AlS2DT4G+NozDf1VlT5udQ/JXlJFjh5H2v7j8Pu24PHjyh0iE+MnFqNPZZRQJLcuEakKSGiZi2iOROZOa3PetnCZTWbHLqB23CO433zz1fh1oTq/iO2RF7GFGv5Pb6iYjKQ+rz169mJMC2KSDK3Vj8GkbZFTKqBTdP0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388588628300.46123080048903; Wed, 30 Aug 2023 02:43:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgR-0002Yy-VF; Wed, 30 Aug 2023 05:40:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgP-0002KT-14 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgL-0001G7-B2 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:15 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-260-b3oVrEoOPyipqJ8j5ds-WQ-1; Wed, 30 Aug 2023 05:40:10 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B9AFB185A78F for ; Wed, 30 Aug 2023 09:40:09 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id E2CA1492C13; Wed, 30 Aug 2023 09:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388412; 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=AKF+GA0EJq/HVYpB+7hO5jCiU+FrMKbnfZ1BWuiFK60=; b=a2vGoEW5uxf3B17afxPbC3mxCxwjY2MMqoe87NFnF/XJMau3Jr5t42upuxApIei79oqsog +eUoSqbETaKL86C+0OGhcgQqt84gTkY6oZRc6nFz0+kGOwnuEOjdrk1NR02E7ulLuv5tC5 Kjp2veDSc8uZI4Z+vIXUTlPQsTwLYTQ= X-MC-Unique: b3oVrEoOPyipqJ8j5ds-WQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 21/67] ui/console: register the console from qemu_console_init() Date: Wed, 30 Aug 2023 13:37:55 +0400 Message-ID: <20230830093843.3531473-22-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388589105100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ui/console.c b/ui/console.c index dd8e8db525..02a24eaf5d 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1366,6 +1366,7 @@ qemu_console_init(Object *obj) qemu_co_queue_init(&c->dump_queue); c->ds =3D ds; c->window_id =3D -1; + qemu_console_register(c); } =20 static void @@ -1419,8 +1420,6 @@ static QemuConsole *new_console(const char *typename, QemuConsole *c =3D QEMU_CONSOLE(object_new(typename)); =20 c->head =3D head; - /* TODO: move to console_init() once there is a type hierarchy */ - qemu_console_register(c); =20 return c; } --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388532; cv=none; d=zohomail.com; s=zohoarc; b=PGn9O+KU4ofUWKdCZZ8f98m0/ZYdNciN+sxXHMXRsNMcmJzMYjzoMH3x0FNkAeeunXXQhU1OmzZ5BR37WrUonzd+h4IzzCZ+OdLzKtmjyL7+0ykc9ZiqJq3mqVpvmLmpYFwIiRLLbz3ouv2b2qadIXIGmSc7d3AlsgM4Vbdf2WI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388532; 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=jNukM4kC5+isisYiLdiV9eVZ7kfQmbo7DtK8Pk7+pbA=; b=bUelcVeQwU9hBpgqXShNsY1C3Py3LNx60oH2xft85Sic8FIvzdE/2o3P4zMBymi/IE5ofHh/wuMlXsP1vlmf8so92hobS/PYGdaU82Q3odbYuy6KbobJ5eWWQbOqNRGOyi2kdRA711DzTb+BfgqMEPK/HlM5kb089eHvxA7cpDs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169338853274519.997892491607672; Wed, 30 Aug 2023 02:42:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgU-0002ui-5P; Wed, 30 Aug 2023 05:40:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgR-0002PQ-1O for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgO-0001Gj-Hd for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:18 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-474-IhQWqd7EP6msJZNVEa9I6A-1; Wed, 30 Aug 2023 05:40:13 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 95E06185A791 for ; Wed, 30 Aug 2023 09:40:13 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D515140E96E; Wed, 30 Aug 2023 09:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388415; 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=jNukM4kC5+isisYiLdiV9eVZ7kfQmbo7DtK8Pk7+pbA=; b=Qd0JcFz6hogtbtcYo11p/1nuu2yXNjLdqmWs6ndgavSzwXTh7TwdjXQ3RFqnCtXazwoZKh bpPMgE2alqqnTCRq33OyWVGvce5t+jLms2gxy0MTbyrLT37Do8tlQ90YLaRR300e8PyfHY zh3y355DM2D6in1tpQhFll+xvLvuL48= X-MC-Unique: IhQWqd7EP6msJZNVEa9I6A-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 22/67] ui/console: remove new_console() Date: Wed, 30 Aug 2023 13:37:56 +0400 Message-ID: <20230830093843.3531473-23-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388537064100001 From: Marc-Andr=C3=A9 Lureau The constructor helper isn't of much used now. "head" is only specified for graphic console (and default to 0), and we are going to move it to QemuGraphicConsole next. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/ui/console.c b/ui/console.c index 02a24eaf5d..e0e4f980d7 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1414,16 +1414,6 @@ qemu_fixed_text_console_init(Object *obj) { } =20 -static QemuConsole *new_console(const char *typename, - uint32_t head) -{ - QemuConsole *c =3D QEMU_CONSOLE(object_new(typename)); - - c->head =3D head; - - return c; -} - #ifdef WIN32 void qemu_displaysurface_win32_set_handle(DisplaySurface *surface, HANDLE h, uint32_t offset) @@ -2163,7 +2153,7 @@ DisplayState *init_displaystate(void) QemuConsole *con; =20 QTAILQ_FOREACH(con, &consoles, next) { - /* Hook up into the qom tree here (not in new_console()), once + /* Hook up into the qom tree here (not in object_new()), once * all QemuConsoles are created and the order / numbering * doesn't change any more */ name =3D g_strdup_printf("console[%d]", con->index); @@ -2201,7 +2191,8 @@ QemuConsole *graphic_console_init(DeviceState *dev, u= int32_t head, height =3D qemu_console_get_height(s, 0); } else { trace_console_gfx_new(); - s =3D new_console(TYPE_QEMU_GRAPHIC_CONSOLE, head); + s =3D (QemuConsole *)object_new(TYPE_QEMU_GRAPHIC_CONSOLE); + s->head =3D head; s->ui_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, dpy_set_ui_info_timer, s); } @@ -2578,9 +2569,9 @@ static void vc_chr_open(Chardev *chr, =20 trace_console_txt_new(width, height); if (width =3D=3D 0 || height =3D=3D 0) { - s =3D new_console(TYPE_QEMU_TEXT_CONSOLE, 0); + s =3D (QemuConsole *)object_new(TYPE_QEMU_TEXT_CONSOLE); } else { - s =3D new_console(TYPE_QEMU_FIXED_TEXT_CONSOLE, 0); + s =3D (QemuConsole *)object_new(TYPE_QEMU_FIXED_TEXT_CONSOLE); s->scanout.kind =3D SCANOUT_SURFACE; s->surface =3D qemu_create_displaysurface(width, height); } --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388638; cv=none; d=zohomail.com; s=zohoarc; b=RuZLjv0ChWuLYuLEh131HyoLUOWnx6PGEUC2Ie9HOkPRvPvxiK4sQASr/lAWdOTT4zhrS86lfS4LRwIOD++5YCOdoT4+2z2z1FNNE7ZNsCQW+YRAw02wGw5owZpN+mTboy6gk9G9Ijo3c7AAozs6h5PM1Rb3Xj+avPDRCpY02p4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388638; 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=2GP6O6o4+gPJ3XyQDd7O4dkYgiHE9UWFU5cb/THrjas=; b=I6fQqg6/DELWHW88qy5MDJIps/DMtIP4G6eHAVrgnhdm6rlcWgYtEFZc78Pemk/dRHFcAqe5Px7c08WOLiq/M7t7M4ALHsDgOHmysT1lHeLPoKXg1WEyiuFISpw3AX1QVmYlQXAAzLo3L/ayS0skzjaeCiWkad6eQdv38EUOIZs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388638309862.7229097461675; Wed, 30 Aug 2023 02:43:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgV-00039k-UA; Wed, 30 Aug 2023 05:40:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgU-00031e-SS for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgR-0001HO-OD for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:22 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-64-HRm-LVlVM5imNAggX8xjtw-1; Wed, 30 Aug 2023 05:40:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4A41D1C07595 for ; Wed, 30 Aug 2023 09:40:17 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63AEF6466B; Wed, 30 Aug 2023 09:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388419; 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=2GP6O6o4+gPJ3XyQDd7O4dkYgiHE9UWFU5cb/THrjas=; b=CLXXWkAqC2/N5waUYKqOrjBVA4DwG3Ks7dpT/xSoexRxyoZlrqgCL8CklvcsvZp7dV8way OpFMWjMm/yptHIB63Tgu7nFqv5XWRxHPnK4dHjdR1782EwMP4CZIG+YFGkz6U1zfn5Pl6F LbyFRR4IAKxAEBPOp6I3jB8Gb2fg6A8= X-MC-Unique: HRm-LVlVM5imNAggX8xjtw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 23/67] ui/console: specialize console_lookup_unused() Date: Wed, 30 Aug 2023 13:37:57 +0400 Message-ID: <20230830093843.3531473-24-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388639449100001 From: Marc-Andr=C3=A9 Lureau graphics_console_init() is expected to return a graphic console. The function doesn't need to be exported. We are going to specialize further QemuGraphicConsole & QemuTextConsole. The two will not be interchangeable anymore. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- include/ui/console.h | 1 - ui/console.c | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 1b08b0f8ad..465f0f93a0 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -484,7 +484,6 @@ QemuConsole *qemu_console_lookup_by_index(unsigned int = index); QemuConsole *qemu_console_lookup_by_device(DeviceState *dev, uint32_t head= ); QemuConsole *qemu_console_lookup_by_device_name(const char *device_id, uint32_t head, Error **err= p); -QemuConsole *qemu_console_lookup_unused(void); QEMUCursor *qemu_console_get_cursor(QemuConsole *con); bool qemu_console_is_visible(QemuConsole *con); bool qemu_console_is_graphic(QemuConsole *con); diff --git a/ui/console.c b/ui/console.c index e0e4f980d7..08bed58b80 100644 --- a/ui/console.c +++ b/ui/console.c @@ -196,6 +196,7 @@ static void text_console_update_cursor(void *opaque); static bool displaychangelistener_has_dmabuf(DisplayChangeListener *dcl); static bool console_compatible_with(QemuConsole *con, DisplayChangeListener *dcl, Error **er= rp); +static QemuConsole *qemu_graphic_console_lookup_unused(void); =20 static void gui_update(void *opaque) { @@ -2184,7 +2185,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, u= int32_t head, QemuConsole *s; DisplaySurface *surface; =20 - s =3D qemu_console_lookup_unused(); + s =3D qemu_graphic_console_lookup_unused(); if (s) { trace_console_gfx_reuse(s->index); width =3D qemu_console_get_width(s, 0); @@ -2289,13 +2290,13 @@ QemuConsole *qemu_console_lookup_by_device_name(con= st char *device_id, return con; } =20 -QemuConsole *qemu_console_lookup_unused(void) +static QemuConsole *qemu_graphic_console_lookup_unused(void) { QemuConsole *con; Object *obj; =20 QTAILQ_FOREACH(con, &consoles, next) { - if (con->hw_ops !=3D &unused_ops) { + if (!QEMU_IS_GRAPHIC_CONSOLE(con) || con->hw_ops !=3D &unused_ops)= { continue; } obj =3D object_property_get_link(OBJECT(con), --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388591; cv=none; d=zohomail.com; s=zohoarc; b=fUnKSViZ20ZjGBig1vbuzyw4+o341rO/vZAm+vWNPXO81v4fNUM8EwcGaiJWklh0CV6MESBj0Xqzh8n7SA1rsrjPWG/6be5onjUVsgYmf/WCdl6X9uSaP00Gn5jkZOPZPKzBMxiAykPeBaA5h4TUpOpqt8ekcGmHFMt3cpYv/cU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388591; 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=wIrK7LuSPOnZFF5+VRMkHtc4amrP3wwzjj+LlwqTb7A=; b=dCFACbDVR5UrKiWs8c7hco7a0OB1NhO5Y+p79HJQpWTG6uyOMx/0PTMuJszUFCru4p//BQRsDUaKnc+gFTiKha7j1mg9h/t7xCQvPL2JBxdSuxyZZP63yfg3shxS4YhsygzTBzE70Z6mlABZrsRsLtrJjO5L9lLdTfTztfER+lo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388591660851.5829260951891; Wed, 30 Aug 2023 02:43:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgc-000465-HW; Wed, 30 Aug 2023 05:40:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgZ-0003eO-FJ for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgX-0001IC-Aj for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:27 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-352-e5g7TYAzO4mT1SPuvE6w_g-1; Wed, 30 Aug 2023 05:40:21 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 280D329ABA19 for ; Wed, 30 Aug 2023 09:40:21 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57D9E2166B25; Wed, 30 Aug 2023 09:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388424; 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=wIrK7LuSPOnZFF5+VRMkHtc4amrP3wwzjj+LlwqTb7A=; b=AwkGOLBMuXbunUA0ETwi2Ts1uIC3M5/Y5aMZVNXVXJM2dNAli4naB4O5lgDEltOoFuUHBR 1O8AfB9ZFujQhc/hFGXh8pAJfZjMKjfFiR5OAj/1TcOztUJZGx/sYh2led5OkCOEzoa7pl F4PJ77pfjyDOn+A7GyXpcS++f8xapxE= X-MC-Unique: e5g7TYAzO4mT1SPuvE6w_g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 24/67] ui/console: update the head from unused QemuConsole Date: Wed, 30 Aug 2023 13:37:58 +0400 Message-ID: <20230830093843.3531473-25-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388593629100019 From: Marc-Andr=C3=A9 Lureau When recycling unused QemuConsole, we should still set the associated head number for correct information and lookups. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/console.c b/ui/console.c index 08bed58b80..a9a922b6e3 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2193,10 +2193,10 @@ QemuConsole *graphic_console_init(DeviceState *dev,= uint32_t head, } else { trace_console_gfx_new(); s =3D (QemuConsole *)object_new(TYPE_QEMU_GRAPHIC_CONSOLE); - s->head =3D head; s->ui_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, dpy_set_ui_info_timer, s); } + s->head =3D head; graphic_console_set_hwops(s, hw_ops, opaque); if (dev) { object_property_set_link(OBJECT(s), "device", OBJECT(dev), --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388594; cv=none; d=zohomail.com; s=zohoarc; b=TzmF27rUKaVl+RaFa7ugOjG9Qy9MB7lPzuO08E53MsZ45Nc3eWMUDdyabgeOB3fiaM5d4cZJ503PdV/h9vOx6A9f9iFrvBnjpMW1xBnGU8Od0g122IMsgKCB2sx0dVV6Trb6M8JRbbrtV9E8HyC/euMXhjfhQ2SijD4tz4dvxdQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388594; 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=ESvNM7heA+chmmL/gplxFmmKr3XxI9TnVw/Fc2rxKHQ=; b=N3f7uIcf6qsSASuXvyUoRsIpxqp3KX5yHaZXDOEQNQzZ9FWHk5KiwVCMhI23K2yPiES7JR+GRP0CWUjppity9t0yHQGqtvOAnSMKWjU5DjvhLVJeLVujubG2sfruG5X5+ZA8oR6ydevahtV13BkVXK9OXv267k10xmqokRvTpC0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388594601780.4894435101457; Wed, 30 Aug 2023 02:43:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgf-0004TR-4x; Wed, 30 Aug 2023 05:40:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgc-00044Q-7V for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgZ-0001J9-W0 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:29 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-391-yDT0ZI4mOZeSVL4r-nOFaw-1; Wed, 30 Aug 2023 05:40:25 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 14E1F80027F for ; Wed, 30 Aug 2023 09:40:25 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 473E8140E96F; Wed, 30 Aug 2023 09:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388427; 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=ESvNM7heA+chmmL/gplxFmmKr3XxI9TnVw/Fc2rxKHQ=; b=d3DbWd9yW/4wfS80QlEKi3VoGQVhzvsTPZY37KEIMF0vRUZ6I2jxsxHlQd/iO6S3Yv4j9N McDvNdilEpkuzUrRgp6X7p6axVcnOfw2b+KyBmK8lo88OmahqHdLevWP+pi+sSvgZp5eA/ YSosYTpf+uOiACqwHG3WY+43XA0XcEc= X-MC-Unique: yDT0ZI4mOZeSVL4r-nOFaw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 25/67] ui/console: allocate ui_timer in QemuConsole Date: Wed, 30 Aug 2023 13:37:59 +0400 Message-ID: <20230830093843.3531473-26-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388595127100021 From: Marc-Andr=C3=A9 Lureau Although at this point only QemuGraphicConsole have hw_ops that implements ui_info() callback, it makes sense to keep the code in the base QemuConsole, to simplify conditions for the caller. As of now, the code didn't reach a NULL timer because dpy_set_ui_info() checks if dpy_ui_info_supported() (hw_ops->ui_info !=3D NULL), which is false for text_console_ops. This is a bit fragile, let simply allocate and free the timer in the base class. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/console.c b/ui/console.c index a9a922b6e3..8c4a2c83fa 100644 --- a/ui/console.c +++ b/ui/console.c @@ -197,6 +197,7 @@ static bool displaychangelistener_has_dmabuf(DisplayCha= ngeListener *dcl); static bool console_compatible_with(QemuConsole *con, DisplayChangeListener *dcl, Error **er= rp); static QemuConsole *qemu_graphic_console_lookup_unused(void); +static void dpy_set_ui_info_timer(void *opaque); =20 static void gui_update(void *opaque) { @@ -1334,6 +1335,9 @@ qemu_console_register(QemuConsole *c) static void qemu_console_finalize(Object *obj) { + QemuConsole *c =3D QEMU_CONSOLE(obj); + + g_clear_pointer(&c->ui_timer, timer_free); /* TODO: should unregister from consoles and free itself */ } =20 @@ -1367,6 +1371,8 @@ qemu_console_init(Object *obj) qemu_co_queue_init(&c->dump_queue); c->ds =3D ds; c->window_id =3D -1; + c->ui_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, + dpy_set_ui_info_timer, c); qemu_console_register(c); } =20 @@ -2193,8 +2199,6 @@ QemuConsole *graphic_console_init(DeviceState *dev, u= int32_t head, } else { trace_console_gfx_new(); s =3D (QemuConsole *)object_new(TYPE_QEMU_GRAPHIC_CONSOLE); - s->ui_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, - dpy_set_ui_info_timer, s); } s->head =3D head; graphic_console_set_hwops(s, hw_ops, opaque); --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388778; cv=none; d=zohomail.com; s=zohoarc; b=SdZz9Yij1fWKU3PTiF+//hvBAkzDmGyo+8kfNwKbH5uJJDdhYihHjbCla1Nc17jtHpBPpKLef9FMWtOwTwAoZ2UDl+GMyNMh/QCeN7cVy8DI5qPUm79Y5niUZDc+whoPqj8K3P0KQif6QQEqUnNofA9KjqXuyXEvd/TP3U9Wvqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388778; 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=VFT3XJhJf5kLf+c2f60i7BSjb1iWkSM119UEWY/PfOs=; b=h9Qf4Zpy0agNYjR6em6kIxTt8GZZml0Eoum0z1L5GCFXU1G4G4M7qDmxY44NpjhNGycmLXuA2Hx40KTYrx8Rqt43/S2iQJHDGp1PiHc9vi1uvABM2PG98vp/rpPjWg0bOmbb5cW4BxB1A7U4Ey1ni4rkFVqYiyGWi2LwNWL7ePY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388778398391.68397880541806; Wed, 30 Aug 2023 02:46:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgg-0004kD-Oa; Wed, 30 Aug 2023 05:40:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgf-0004To-6J for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgd-0001Kg-1c for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:32 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-606-sbykND2kPdqmfnHQsXa3Mw-1; Wed, 30 Aug 2023 05:40:29 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BB2293C0DDC7 for ; Wed, 30 Aug 2023 09:40:28 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id EECE440C6F4C; Wed, 30 Aug 2023 09:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388430; 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=VFT3XJhJf5kLf+c2f60i7BSjb1iWkSM119UEWY/PfOs=; b=BRJxRPxVaqMLrlWzye8go3T7FOCzSneyuFVSMoS3DqC0npr1WE4AjprX2b4foZzn6nRP6N WZyqS8R+wnvANxWlzVeNtse6VTNtO8o29m5i1XZax6uHcYu4EB451j9hzRhQdhGObgTKwD 3idkq6bCELFMrn9tXNlWMt2+LxVnSUQ= X-MC-Unique: sbykND2kPdqmfnHQsXa3Mw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 26/67] ui/vc: move cursor_timer initialization to QemuTextConsole class Date: Wed, 30 Aug 2023 13:38:00 +0400 Message-ID: <20230830093843.3531473-27-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388780319100018 From: Marc-Andr=C3=A9 Lureau The timer is only relevant when a text console exists. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/console.c b/ui/console.c index 8c4a2c83fa..ffa68c3a22 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1399,6 +1399,10 @@ qemu_text_console_finalize(Object *obj) static void qemu_text_console_class_init(ObjectClass *oc, void *data) { + if (!cursor_timer) { + cursor_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, + text_console_update_cursor, NULL); + } } =20 static void @@ -2144,8 +2148,6 @@ static DisplayState *get_alloc_displaystate(void) { if (!display_state) { display_state =3D g_new0(DisplayState, 1); - cursor_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, - text_console_update_cursor, NULL); } return display_state; } --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388503; cv=none; d=zohomail.com; s=zohoarc; b=GB/R0JaeSmJZ+D6dHlfaRrrQGdzk/Jzy3gmthg9/5yxEWJoorYu+ly6nVBY/RNIDLteaT4giiXrpwJpdE+g+VJxPWajEmBRJPWGSvSVFlPg/6WQsdUpvvrWs61lbNdlCMiHhfmKCv26nlaUsRVH2BEKoQ9l9ThdiSgsvTHpZcPg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388503; 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=SbYEocUpjzEc/EtSyE4NLqsTxQQ+J/ZflliA0P3ZaEU=; b=HpAjWeNF4AKdzgTK+eyUtoGoSZtgz+WuHDKi1g9U1viKUWe//r52vKIFS1xMH4GgGFUUrjvQlwR0MSMihrXU2Kh3A8c93Us7VIXtUpwSvHWxL314MySo8hnTvXW4yubUZJ00/ImirlO/WubgqvDUHKJINEAZFyqmUgEfmiXsD00= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388503957857.5437511542951; Wed, 30 Aug 2023 02:41:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgk-0005HR-6v; Wed, 30 Aug 2023 05:40:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgi-00056r-Di for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgg-0001No-57 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:36 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-208-CHXNVy9gNAiuMzLyYs41Jw-1; Wed, 30 Aug 2023 05:40:32 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E6AA429ABA1B for ; Wed, 30 Aug 2023 09:40:31 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49C9E492C13; Wed, 30 Aug 2023 09:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388433; 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=SbYEocUpjzEc/EtSyE4NLqsTxQQ+J/ZflliA0P3ZaEU=; b=GzlgPOh4rORpjeDC4ngE0RHYkaFwY7DkvQnyLgXfHXQMiZTXF0EQ6kEefctsA6uES83P32 JaREHzPA0lHS1xhFvMPNwHmRB3FWiiEMZOwMNNsiejjy1OtJtQ+WzUHgEFvuwJDX0RZWA2 bPzEFl92M3gF5wc4iGIdJqTkOgXKoDY= X-MC-Unique: CHXNVy9gNAiuMzLyYs41Jw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 27/67] ui/console: free more QemuConsole resources Date: Wed, 30 Aug 2023 13:38:01 +0400 Message-ID: <20230830093843.3531473-28-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388505535100003 From: Marc-Andr=C3=A9 Lureau This code path is probably not executed at this point, since console aren't being released. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/console.c b/ui/console.c index ffa68c3a22..3cd4c74eec 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1337,8 +1337,11 @@ qemu_console_finalize(Object *obj) { QemuConsole *c =3D QEMU_CONSOLE(obj); =20 + /* TODO: check this code path, and unregister from consoles */ + g_clear_pointer(&c->device, object_unref); + g_clear_pointer(&c->surface, qemu_free_displaysurface); + g_clear_pointer(&c->gl_unblock_timer, timer_free); g_clear_pointer(&c->ui_timer, timer_free); - /* TODO: should unregister from consoles and free itself */ } =20 static void --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388558; cv=none; d=zohomail.com; s=zohoarc; b=D4ea3rrmHJwS9HqnQ9Xckjw0Qb4YfzhH2NZMs2DNabdEp1bS2Z9i3rnDqNv7ZEBSqW+xuJYre87SKnEUHPsiJR4PtQ0mKJwH3JpHQbPkO53NFEckr5absgBmzWxXM2z3ABYnxqiUcbIlc+kJ8a4br51UN9+bPLPE+dP8mX0N8Hc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388558; 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=SaKBjPJnrV9/x8xzAwwWIKPGAixzlK115cJfMe0Jq50=; b=SAmwNNawSJnQRTyF+t3rwNRkPVvh8w5AeUBuzYCRRro0mg/Q7571Bqzfg+TOQ8fHlQwqETtCH3waWYZ4KpKgHU+A4Yo3tAEvtzBCpjkfR81fl1Vft1jqthI2dyF7j99eEpH7XlM8D90RjrL3VTGfpuH15WmjTzL42KV5DjddZBE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388558385320.4855522505328; Wed, 30 Aug 2023 02:42:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgp-0005ig-CS; Wed, 30 Aug 2023 05:40:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgn-0005aO-Sp for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgk-0001PB-VE for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:41 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-690-Z3dYz2TPNZCVGkfvylHx8A-1; Wed, 30 Aug 2023 05:40:36 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C97F3C0DDD3 for ; Wed, 30 Aug 2023 09:40:36 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5BDA140E96E; Wed, 30 Aug 2023 09:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388438; 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=SaKBjPJnrV9/x8xzAwwWIKPGAixzlK115cJfMe0Jq50=; b=U3yloorZWx0b0KCajlwYstNYiEkFVxMhdcJR5Xe3/xOr5pUAKc5qyTDX9uEWTNbteg7q+q bA6BjJFhdVPNLbcb2HsUwCYJKou2+KAiKlzDiH80YChDe/935EgKYe9aVZpX2W08WBdvIf 6Prq3k8svqlKaCdc7QoH3A2Axd10KFk= X-MC-Unique: Z3dYz2TPNZCVGkfvylHx8A-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 28/67] ui/vc: move text fields to QemuTextConsole Date: Wed, 30 Aug 2023 13:38:02 +0400 Message-ID: <20230830093843.3531473-29-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388559365100005 From: Marc-Andr=C3=A9 Lureau Now we can instantiate the specific console with its own fields. Pass the most appropriate type to the various functions, and cast up to QEMU_CONSOLE as necessary. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 177 ++++++++++++++++++++++++++------------------------- 1 file changed, 91 insertions(+), 86 deletions(-) diff --git a/ui/console.c b/ui/console.c index 3cd4c74eec..335d7ba841 100644 --- a/ui/console.c +++ b/ui/console.c @@ -94,26 +94,6 @@ struct QemuConsole { const GraphicHwOps *hw_ops; void *hw; =20 - /* Text console state */ - int width; - int height; - int total_height; - int backscroll_height; - int x, y; - int y_displayed; - int y_base; - TextCell *cells; - int text_x[2], text_y[2], cursor_invalidate; - int echo; - - int update_x0; - int update_y0; - int update_x1; - int update_y1; - - Chardev *chr; - /* fifo for key pressed */ - Fifo8 out_fifo; CoQueue dump_queue; =20 QTAILQ_ENTRY(QemuConsole) next; @@ -136,6 +116,26 @@ OBJECT_DEFINE_TYPE(QemuGraphicConsole, qemu_graphic_co= nsole, QEMU_GRAPHIC_CONSOL =20 typedef struct QemuTextConsole { QemuConsole parent; + + int width; + int height; + int total_height; + int backscroll_height; + int x, y; + int y_displayed; + int y_base; + TextCell *cells; + int text_x[2], text_y[2], cursor_invalidate; + int echo; + + int update_x0; + int update_y0; + int update_x1; + int update_y1; + + Chardev *chr; + /* fifo for key pressed */ + Fifo8 out_fifo; } QemuTextConsole; =20 typedef QemuConsoleClass QemuTextConsoleClass; @@ -162,7 +162,7 @@ OBJECT_DEFINE_TYPE(QemuFixedTextConsole, qemu_fixed_tex= t_console, QEMU_FIXED_TEX =20 struct VCChardev { Chardev parent; - QemuConsole *console; + QemuTextConsole *console; =20 enum TTYState state; int esc_params[MAX_ESC_PARAMS]; @@ -428,43 +428,44 @@ static void vga_putcharxy(QemuConsole *s, int x, int = y, int ch, &fgcol, &bgcol, x, y, FONT_WIDTH, FONT_HEIGHT= ); } =20 -static void text_console_resize(QemuConsole *s) +static void text_console_resize(QemuTextConsole *t) { + QemuConsole *s =3D QEMU_CONSOLE(t); TextCell *cells, *c, *c1; int w1, x, y, last_width; =20 assert(s->scanout.kind =3D=3D SCANOUT_SURFACE); =20 - last_width =3D s->width; - s->width =3D surface_width(s->surface) / FONT_WIDTH; - s->height =3D surface_height(s->surface) / FONT_HEIGHT; + last_width =3D t->width; + t->width =3D surface_width(s->surface) / FONT_WIDTH; + t->height =3D surface_height(s->surface) / FONT_HEIGHT; =20 w1 =3D last_width; - if (s->width < w1) - w1 =3D s->width; + if (t->width < w1) + w1 =3D t->width; =20 - cells =3D g_new(TextCell, s->width * s->total_height + 1); - for(y =3D 0; y < s->total_height; y++) { - c =3D &cells[y * s->width]; + cells =3D g_new(TextCell, t->width * t->total_height + 1); + for(y =3D 0; y < t->total_height; y++) { + c =3D &cells[y * t->width]; if (w1 > 0) { - c1 =3D &s->cells[y * last_width]; + c1 =3D &t->cells[y * last_width]; for(x =3D 0; x < w1; x++) { *c++ =3D *c1++; } } - for(x =3D w1; x < s->width; x++) { + for(x =3D w1; x < t->width; x++) { c->ch =3D ' '; c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; c++; } } - g_free(s->cells); - s->cells =3D cells; + g_free(t->cells); + t->cells =3D cells; } =20 -static void invalidate_xy(QemuConsole *s, int x, int y) +static void invalidate_xy(QemuTextConsole *s, int x, int y) { - if (!qemu_console_is_visible(s)) { + if (!qemu_console_is_visible(QEMU_CONSOLE(s))) { return; } if (s->update_x0 > x * FONT_WIDTH) @@ -479,7 +480,7 @@ static void invalidate_xy(QemuConsole *s, int x, int y) =20 static void vc_update_xy(VCChardev *vc, int x, int y) { - QemuConsole *s =3D vc->console; + QemuTextConsole *s =3D vc->console; TextCell *c; int y1, y2; =20 @@ -498,13 +499,13 @@ static void vc_update_xy(VCChardev *vc, int x, int y) x =3D s->width - 1; } c =3D &s->cells[y1 * s->width + x]; - vga_putcharxy(s, x, y2, c->ch, + vga_putcharxy(QEMU_CONSOLE(s), x, y2, c->ch, &(c->t_attrib)); invalidate_xy(s, x, y2); } } =20 -static void console_show_cursor(QemuConsole *s, int show) +static void console_show_cursor(QemuTextConsole *s, int show) { TextCell *c; int y, y1; @@ -525,17 +526,17 @@ static void console_show_cursor(QemuConsole *s, int s= how) if (show && cursor_visible_phase) { TextAttributes t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; t_attrib.invers =3D !(t_attrib.invers); /* invert fg and bg */ - vga_putcharxy(s, x, y, c->ch, &t_attrib); + vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, &t_attrib); } else { - vga_putcharxy(s, x, y, c->ch, &(c->t_attrib)); + vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, &(c->t_attrib)); } invalidate_xy(s, x, y); } } =20 -static void console_refresh(QemuConsole *s) +static void console_refresh(QemuTextConsole *s) { - DisplaySurface *surface =3D qemu_console_surface(s); + DisplaySurface *surface =3D qemu_console_surface(QEMU_CONSOLE(s)); TextCell *c; int x, y, y1; =20 @@ -545,13 +546,13 @@ static void console_refresh(QemuConsole *s) s->text_y[1] =3D s->height - 1; s->cursor_invalidate =3D 1; =20 - vga_fill_rect(s, 0, 0, surface_width(surface), surface_height(surface), + vga_fill_rect(QEMU_CONSOLE(s), 0, 0, surface_width(surface), surface_h= eight(surface), color_table_rgb[0][QEMU_COLOR_BLACK]); y1 =3D s->y_displayed; for (y =3D 0; y < s->height; y++) { c =3D s->cells + y1 * s->width; for (x =3D 0; x < s->width; x++) { - vga_putcharxy(s, x, y, c->ch, + vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, &(c->t_attrib)); c++; } @@ -560,11 +561,11 @@ static void console_refresh(QemuConsole *s) } } console_show_cursor(s, 1); - dpy_gfx_update(s, 0, 0, + dpy_gfx_update(QEMU_CONSOLE(s), 0, 0, surface_width(surface), surface_height(surface)); } =20 -static void console_scroll(QemuConsole *s, int ydelta) +static void console_scroll(QemuTextConsole *s, int ydelta) { int i, y1; =20 @@ -595,7 +596,7 @@ static void console_scroll(QemuConsole *s, int ydelta) =20 static void vc_put_lf(VCChardev *vc) { - QemuConsole *s =3D vc->console; + QemuTextConsole *s =3D vc->console; TextCell *c; int x, y1; =20 @@ -624,10 +625,10 @@ static void vc_put_lf(VCChardev *vc) s->text_x[1] =3D s->width - 1; s->text_y[1] =3D s->height - 1; =20 - vga_bitblt(s, 0, FONT_HEIGHT, 0, 0, + vga_bitblt(QEMU_CONSOLE(s), 0, FONT_HEIGHT, 0, 0, s->width * FONT_WIDTH, (s->height - 1) * FONT_HEIGHT); - vga_fill_rect(s, 0, (s->height - 1) * FONT_HEIGHT, + vga_fill_rect(QEMU_CONSOLE(s), 0, (s->height - 1) * FONT_HEIGH= T, s->width * FONT_WIDTH, FONT_HEIGHT, color_table_rgb[0][TEXT_ATTRIBUTES_DEFAULT.bgcol= ]); s->update_x0 =3D 0; @@ -737,7 +738,7 @@ static void vc_handle_escape(VCChardev *vc) =20 static void vc_clear_xy(VCChardev *vc, int x, int y) { - QemuConsole *s =3D vc->console; + QemuTextConsole *s =3D vc->console; int y1 =3D (s->y_base + y) % s->total_height; if (x >=3D s->width) { x =3D s->width - 1; @@ -750,7 +751,7 @@ static void vc_clear_xy(VCChardev *vc, int x, int y) =20 static void vc_put_one(VCChardev *vc, int ch) { - QemuConsole *s =3D vc->console; + QemuTextConsole *s =3D vc->console; TextCell *c; int y1; if (s->x >=3D s->width) { @@ -777,7 +778,7 @@ static void vc_respond_str(VCChardev *vc, const char *b= uf) /* set cursor, checking bounds */ static void vc_set_cursor(VCChardev *vc, int x, int y) { - QemuConsole *s =3D vc->console; + QemuTextConsole *s =3D vc->console; =20 if (x < 0) { x =3D 0; @@ -798,7 +799,7 @@ static void vc_set_cursor(VCChardev *vc, int x, int y) =20 static void vc_putchar(VCChardev *vc, int ch) { - QemuConsole *s =3D vc->console; + QemuTextConsole *s =3D vc->console; int i; int x, y; char response[40]; @@ -1095,8 +1096,11 @@ void console_select(unsigned int index) } displaychangelistener_display_console(dcl, s, NULL); } - dpy_text_resize(s, s->width, s->height); - text_console_update_cursor(NULL); + + if (QEMU_IS_TEXT_CONSOLE(s)) { + dpy_text_resize(s, QEMU_TEXT_CONSOLE(s)->width, QEMU_TEXT_CONS= OLE(s)->height); + text_console_update_cursor(NULL); + } } } =20 @@ -1107,7 +1111,7 @@ DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV, static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len) { VCChardev *drv =3D VC_CHARDEV(chr); - QemuConsole *s =3D drv->console; + QemuTextConsole *s =3D drv->console; int i; =20 s->update_x0 =3D s->width * FONT_WIDTH; @@ -1120,14 +1124,14 @@ static int vc_chr_write(Chardev *chr, const uint8_t= *buf, int len) } console_show_cursor(s, 1); if (s->update_x0 < s->update_x1) { - dpy_gfx_update(s, s->update_x0, s->update_y0, + dpy_gfx_update(QEMU_CONSOLE(s), s->update_x0, s->update_y0, s->update_x1 - s->update_x0, s->update_y1 - s->update_y0); } return len; } =20 -static void kbd_send_chars(QemuConsole *s) +static void kbd_send_chars(QemuTextConsole *s) { uint32_t len, avail; =20 @@ -1145,13 +1149,14 @@ static void kbd_send_chars(QemuConsole *s) } =20 /* called when an ascii key is pressed */ -void kbd_put_keysym_console(QemuConsole *s, int keysym) +void kbd_put_keysym_console(QemuConsole *con, int keysym) { + QemuTextConsole *s =3D (QemuTextConsole *)object_dynamic_cast(OBJECT(c= on), TYPE_QEMU_TEXT_CONSOLE); uint8_t buf[16], *q; int c; uint32_t num_free; =20 - if (!s || QEMU_IS_GRAPHIC_CONSOLE(s)) + if (!s) return; =20 switch(keysym) { @@ -1251,17 +1256,17 @@ void kbd_put_keysym(int keysym) =20 static void text_console_invalidate(void *opaque) { - QemuConsole *s =3D (QemuConsole *) opaque; + QemuTextConsole *s =3D QEMU_TEXT_CONSOLE(opaque); =20 - if (QEMU_IS_TEXT_CONSOLE(s) && !QEMU_IS_FIXED_TEXT_CONSOLE(s)) { - text_console_resize(s); + if (!QEMU_IS_FIXED_TEXT_CONSOLE(s)) { + text_console_resize(QEMU_TEXT_CONSOLE(s)); } console_refresh(s); } =20 static void text_console_update(void *opaque, console_ch_t *chardata) { - QemuConsole *s =3D (QemuConsole *) opaque; + QemuTextConsole *s =3D QEMU_TEXT_CONSOLE(opaque); int i, j, src; =20 if (s->text_x[0] <=3D s->text_x[1]) { @@ -1275,7 +1280,7 @@ static void text_console_update(void *opaque, console= _ch_t *chardata) s->cells[src].t_attrib.bgcol, s->cells[src].t_attrib.bold)); } - dpy_text_update(s, s->text_x[0], s->text_y[0], + dpy_text_update(QEMU_CONSOLE(s), s->text_x[0], s->text_y[0], s->text_x[1] - s->text_x[0], i - s->text_y[0]); s->text_x[0] =3D s->width; s->text_y[0] =3D s->height; @@ -1283,7 +1288,7 @@ static void text_console_update(void *opaque, console= _ch_t *chardata) s->text_y[1] =3D 0; } if (s->cursor_invalidate) { - dpy_text_cursor(s, s->x, s->y); + dpy_text_cursor(QEMU_CONSOLE(s), s->x, s->y); s->cursor_invalidate =3D 0; } } @@ -2399,12 +2404,14 @@ char *qemu_console_get_label(QemuConsole *con) } } return g_strdup("VGA"); - } else { - if (con->chr && con->chr->label) { - return g_strdup(con->chr->label); + } else if (QEMU_IS_TEXT_CONSOLE(con)) { + QemuTextConsole *c =3D QEMU_TEXT_CONSOLE(con); + if (c->chr && c->chr->label) { + return g_strdup(c->chr->label); } - return g_strdup_printf("vc%d", con->index); } + + return g_strdup_printf("vc%d", con->index); } =20 int qemu_console_get_index(QemuConsole *con) @@ -2466,17 +2473,15 @@ int qemu_console_get_height(QemuConsole *con, int f= allback) static void vc_chr_accept_input(Chardev *chr) { VCChardev *drv =3D VC_CHARDEV(chr); - QemuConsole *s =3D drv->console; =20 - kbd_send_chars(s); + kbd_send_chars(drv->console); } =20 static void vc_chr_set_echo(Chardev *chr, bool echo) { VCChardev *drv =3D VC_CHARDEV(chr); - QemuConsole *s =3D drv->console; =20 - s->echo =3D echo; + drv->console->echo =3D echo; } =20 static void text_console_update_cursor_timer(void) @@ -2514,7 +2519,7 @@ static const GraphicHwOps text_console_ops =3D { static void text_console_do_init(Chardev *chr) { VCChardev *drv =3D VC_CHARDEV(chr); - QemuConsole *s =3D drv->console; + QemuTextConsole *s =3D drv->console; int g_width =3D 80 * FONT_WIDTH; int g_height =3D 24 * FONT_HEIGHT; =20 @@ -2525,17 +2530,17 @@ static void text_console_do_init(Chardev *chr) s->total_height =3D DEFAULT_BACKSCROLL; s->x =3D 0; s->y =3D 0; - if (s->scanout.kind !=3D SCANOUT_SURFACE) { + if (QEMU_CONSOLE(s)->scanout.kind !=3D SCANOUT_SURFACE) { if (active_console && active_console->scanout.kind =3D=3D SCANOUT_= SURFACE) { g_width =3D qemu_console_get_width(active_console, g_width); g_height =3D qemu_console_get_height(active_console, g_height); } - s->surface =3D qemu_create_displaysurface(g_width, g_height); - s->scanout.kind =3D SCANOUT_SURFACE; + QEMU_CONSOLE(s)->surface =3D qemu_create_displaysurface(g_width, g= _height); + QEMU_CONSOLE(s)->scanout.kind =3D SCANOUT_SURFACE; } =20 - s->hw_ops =3D &text_console_ops; - s->hw =3D s; + QEMU_CONSOLE(s)->hw_ops =3D &text_console_ops; + QEMU_CONSOLE(s)->hw =3D s; =20 /* set current text attributes to default */ drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; @@ -2561,7 +2566,7 @@ static void vc_chr_open(Chardev *chr, { ChardevVC *vc =3D backend->u.vc.data; VCChardev *drv =3D VC_CHARDEV(chr); - QemuConsole *s; + QemuTextConsole *s; unsigned width =3D 0; unsigned height =3D 0; =20 @@ -2579,11 +2584,11 @@ static void vc_chr_open(Chardev *chr, =20 trace_console_txt_new(width, height); if (width =3D=3D 0 || height =3D=3D 0) { - s =3D (QemuConsole *)object_new(TYPE_QEMU_TEXT_CONSOLE); + s =3D QEMU_TEXT_CONSOLE(object_new(TYPE_QEMU_TEXT_CONSOLE)); } else { - s =3D (QemuConsole *)object_new(TYPE_QEMU_FIXED_TEXT_CONSOLE); - s->scanout.kind =3D SCANOUT_SURFACE; - s->surface =3D qemu_create_displaysurface(width, height); + s =3D QEMU_TEXT_CONSOLE(object_new(TYPE_QEMU_FIXED_TEXT_CONSOLE)); + QEMU_CONSOLE(s)->scanout.kind =3D SCANOUT_SURFACE; + QEMU_CONSOLE(s)->surface =3D qemu_create_displaysurface(width, hei= ght); } =20 s->chr =3D chr; --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388640; cv=none; d=zohomail.com; s=zohoarc; b=gNJznO1Kc4tGnXfPSxAXWW41JLhkPSbVndRkbyOtn01oxbhLkdnnWPXg2VSPvw+7TA0CZB3AX3glvRbdWEMNTJbJLkibG2VaFL8jCPZHamLAfU8UblRKWadQIxEmsJ/uwSEiZwSaJcSvQPUdmhtxs/Jsv35n++0UyOaJRQ9iHIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388640; 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=bTIAERmf90t9c38wK8ugcx/KLvMKafmcJfQQG87nHDw=; b=bvD5u0ColWoPjnlYYeqOzJhnDRAGo3C5rfM1eG2oD6is0VjDxLZVvF+yf8aOKoegZpXQc/t57knZ/WG1wLUNn9PLyB/KwTQ6TCIFFaewWThrYvNOt9Wx2l0mrb6QQ/jcpplQ3zUTdT8Gek7+LvLViTPrP/qFYUpjNM0ToRFprsY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388640715646.4959535243579; Wed, 30 Aug 2023 02:44:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgs-00066q-L0; Wed, 30 Aug 2023 05:40:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgr-0005yx-8k for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgo-0001Qr-Nj for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:45 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-84-upsoCY2GMiCIbyU3sSit2Q-1; Wed, 30 Aug 2023 05:40:40 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5E1828028B2 for ; Wed, 30 Aug 2023 09:40:40 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53DC02166B25; Wed, 30 Aug 2023 09:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388442; 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=bTIAERmf90t9c38wK8ugcx/KLvMKafmcJfQQG87nHDw=; b=OPq6VvpnXqcmaa+tl27W33CgsWm7hB46iDYnPk4SSaLoJfINjfkG6tyJrn+KmmUuKhB9jF +kTD68KSZL5TuFOXJ6dHiN4PCO5sJWuTkyKtR6Dd5S4BMLLKz1NIlbGfO8bScRLs3ZSdii X9V9CxQFPyMvK6ZZ42j//dwFLFs0zPM= X-MC-Unique: upsoCY2GMiCIbyU3sSit2Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 29/67] ui/console: move graphic fields to QemuGraphicConsole Date: Wed, 30 Aug 2023 13:38:03 +0400 Message-ID: <20230830093843.3531473-30-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388641413100005 From: Marc-Andr=C3=A9 Lureau Move fields specific to graphic console to the console subclass. qemu_console_get_head() is adapated to accomodate QemuTextConsole, and always returns 0. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 110 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 64 insertions(+), 46 deletions(-) diff --git a/ui/console.c b/ui/console.c index 335d7ba841..9d884ba02f 100644 --- a/ui/console.c +++ b/ui/console.c @@ -83,17 +83,10 @@ struct QemuConsole { int gl_block; QEMUTimer *gl_unblock_timer; int window_id; - - /* Graphic console state. */ - Object *device; - uint32_t head; QemuUIInfo ui_info; QEMUTimer *ui_timer; - QEMUCursor *cursor; - int cursor_x, cursor_y, cursor_on; const GraphicHwOps *hw_ops; void *hw; - CoQueue dump_queue; =20 QTAILQ_ENTRY(QemuConsole) next; @@ -103,6 +96,12 @@ OBJECT_DEFINE_ABSTRACT_TYPE(QemuConsole, qemu_console, = QEMU_CONSOLE, OBJECT) =20 typedef struct QemuGraphicConsole { QemuConsole parent; + + Object *device; + uint32_t head; + + QEMUCursor *cursor; + int cursor_x, cursor_y, cursor_on; } QemuGraphicConsole; =20 typedef QemuConsoleClass QemuGraphicConsoleClass; @@ -1343,31 +1342,14 @@ qemu_console_finalize(Object *obj) QemuConsole *c =3D QEMU_CONSOLE(obj); =20 /* TODO: check this code path, and unregister from consoles */ - g_clear_pointer(&c->device, object_unref); g_clear_pointer(&c->surface, qemu_free_displaysurface); g_clear_pointer(&c->gl_unblock_timer, timer_free); g_clear_pointer(&c->ui_timer, timer_free); } =20 -static void -qemu_console_prop_get_head(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - QemuConsole *c =3D QEMU_CONSOLE(obj); - - visit_type_uint32(v, name, &c->head, errp); -} - static void qemu_console_class_init(ObjectClass *oc, void *data) { - object_class_property_add_link(oc, "device", TYPE_DEVICE, - offsetof(QemuConsole, device), - object_property_allow_set_link, - OBJ_PROP_LINK_STRONG); - object_class_property_add(oc, "head", "uint32", - qemu_console_prop_get_head, - NULL, NULL, NULL); } =20 static void @@ -1387,11 +1369,30 @@ qemu_console_init(Object *obj) static void qemu_graphic_console_finalize(Object *obj) { + QemuGraphicConsole *c =3D QEMU_GRAPHIC_CONSOLE(obj); + + g_clear_pointer(&c->device, object_unref); +} + +static void +qemu_graphic_console_prop_get_head(Object *obj, Visitor *v, const char *na= me, + void *opaque, Error **errp) +{ + QemuGraphicConsole *c =3D QEMU_GRAPHIC_CONSOLE(obj); + + visit_type_uint32(v, name, &c->head, errp); } =20 static void qemu_graphic_console_class_init(ObjectClass *oc, void *data) { + object_class_property_add_link(oc, "device", TYPE_DEVICE, + offsetof(QemuGraphicConsole, device), + object_property_allow_set_link, + OBJ_PROP_LINK_STRONG); + object_class_property_add(oc, "head", "uint32", + qemu_graphic_console_prop_get_head, + NULL, NULL, NULL); } =20 static void @@ -1676,6 +1677,16 @@ void qemu_console_set_display_gl_ctx(QemuConsole *co= n, DisplayGLCtx *gl) con->gl =3D gl; } =20 +static void +dcl_set_graphic_cursor(DisplayChangeListener *dcl, QemuGraphicConsole *con) +{ + if (con && con->cursor && dcl->ops->dpy_cursor_define) { + dcl->ops->dpy_cursor_define(dcl, con->cursor); + } + if (con && dcl->ops->dpy_mouse_set) { + dcl->ops->dpy_mouse_set(dcl, con->cursor_x, con->cursor_y, con->cu= rsor_on); + } +} void register_displaychangelistener(DisplayChangeListener *dcl) { QemuConsole *con; @@ -1693,11 +1704,8 @@ void register_displaychangelistener(DisplayChangeLis= tener *dcl) con =3D active_console; } displaychangelistener_display_console(dcl, con, dcl->con ? &error_fata= l : NULL); - if (con && con->cursor && dcl->ops->dpy_cursor_define) { - dcl->ops->dpy_cursor_define(dcl, con->cursor); - } - if (con && dcl->ops->dpy_mouse_set) { - dcl->ops->dpy_mouse_set(dcl, con->cursor_x, con->cursor_y, con->cu= rsor_on); + if (QEMU_IS_GRAPHIC_CONSOLE(con)) { + dcl_set_graphic_cursor(dcl, QEMU_GRAPHIC_CONSOLE(con)); } text_console_update_cursor(NULL); } @@ -1728,8 +1736,9 @@ void unregister_displaychangelistener(DisplayChangeLi= stener *dcl) static void dpy_set_ui_info_timer(void *opaque) { QemuConsole *con =3D opaque; + uint32_t head =3D qemu_console_get_head(con); =20 - con->hw_ops->ui_info(con->hw, con->head, &con->ui_info); + con->hw_ops->ui_info(con->hw, head, &con->ui_info); } =20 bool dpy_ui_info_supported(QemuConsole *con) @@ -1939,19 +1948,20 @@ void dpy_text_resize(QemuConsole *con, int w, int h) } } =20 -void dpy_mouse_set(QemuConsole *con, int x, int y, int on) +void dpy_mouse_set(QemuConsole *c, int x, int y, int on) { - DisplayState *s =3D con->ds; + QemuGraphicConsole *con =3D QEMU_GRAPHIC_CONSOLE(c); + DisplayState *s =3D c->ds; DisplayChangeListener *dcl; =20 con->cursor_x =3D x; con->cursor_y =3D y; con->cursor_on =3D on; - if (!qemu_console_is_visible(con)) { + if (!qemu_console_is_visible(c)) { return; } QLIST_FOREACH(dcl, &s->listeners, next) { - if (con !=3D (dcl->con ? dcl->con : active_console)) { + if (c !=3D (dcl->con ? dcl->con : active_console)) { continue; } if (dcl->ops->dpy_mouse_set) { @@ -1960,18 +1970,19 @@ void dpy_mouse_set(QemuConsole *con, int x, int y, = int on) } } =20 -void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor) +void dpy_cursor_define(QemuConsole *c, QEMUCursor *cursor) { - DisplayState *s =3D con->ds; + QemuGraphicConsole *con =3D QEMU_GRAPHIC_CONSOLE(c); + DisplayState *s =3D c->ds; DisplayChangeListener *dcl; =20 cursor_unref(con->cursor); con->cursor =3D cursor_ref(cursor); - if (!qemu_console_is_visible(con)) { + if (!qemu_console_is_visible(c)) { return; } QLIST_FOREACH(dcl, &s->listeners, next) { - if (con !=3D (dcl->con ? dcl->con : active_console)) { + if (c !=3D (dcl->con ? dcl->con : active_console)) { continue; } if (dcl->ops->dpy_cursor_define) { @@ -2210,7 +2221,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, u= int32_t head, trace_console_gfx_new(); s =3D (QemuConsole *)object_new(TYPE_QEMU_GRAPHIC_CONSOLE); } - s->head =3D head; + QEMU_GRAPHIC_CONSOLE(s)->head =3D head; graphic_console_set_hwops(s, hw_ops, opaque); if (dev) { object_property_set_link(OBJECT(s), "device", OBJECT(dev), @@ -2328,7 +2339,7 @@ QEMUCursor *qemu_console_get_cursor(QemuConsole *con) if (con =3D=3D NULL) { con =3D active_console; } - return con ? con->cursor : NULL; + return QEMU_IS_GRAPHIC_CONSOLE(con) ? QEMU_GRAPHIC_CONSOLE(con)->curso= r : NULL; } =20 bool qemu_console_is_visible(QemuConsole *con) @@ -2386,21 +2397,22 @@ bool qemu_console_is_multihead(DeviceState *dev) char *qemu_console_get_label(QemuConsole *con) { if (QEMU_IS_GRAPHIC_CONSOLE(con)) { - if (con->device) { + QemuGraphicConsole *c =3D QEMU_GRAPHIC_CONSOLE(con); + if (c->device) { DeviceState *dev; bool multihead; =20 - dev =3D DEVICE(con->device); + dev =3D DEVICE(c->device); multihead =3D qemu_console_is_multihead(dev); if (multihead) { return g_strdup_printf("%s.%d", dev->id ? dev->id : - object_get_typename(con->device), - con->head); + object_get_typename(c->device), + c->head); } else { return g_strdup_printf("%s", dev->id ? dev->id : - object_get_typename(con->device)); + object_get_typename(c->device)); } } return g_strdup("VGA"); @@ -2427,7 +2439,13 @@ uint32_t qemu_console_get_head(QemuConsole *con) if (con =3D=3D NULL) { con =3D active_console; } - return con ? con->head : -1; + if (con =3D=3D NULL) { + return -1; + } + if (QEMU_IS_GRAPHIC_CONSOLE(con)) { + return QEMU_GRAPHIC_CONSOLE(con)->head; + } + return 0; } =20 int qemu_console_get_width(QemuConsole *con, int fallback) --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388461; cv=none; d=zohomail.com; s=zohoarc; b=INR8roWt355OW3ksDa2cuh+h3RJQ5Stm0Itp/jw3GD8iUndBwakZTWe4xuN/iX7acw4IMfFTZ/La60/fVYMdS3jEh17o78OeP9n8s2COKCGq8sWRMUK/INJGFx36MjlAHi8C/f3PIryljKVzENjvkpmhkNzwqW3RKGXrx8ed3DM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388461; 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=GGdpQ45dpsnTLUE7/iN3xi5K8N7i0y22IQsayhCD/mc=; b=nB0iS64pVozt5fvCRdHj4BAPnSXr9SzuuwJLu1kNn8w/VIU4m/zJm6Y1FGLMFDoFMY5gLLOpj9E55vk9YkfbrtY0saDagfUVdnUfQz/VaDZkPFS8w16/Pa77PbVCtyRKHjDfYvGfHuIbEjXZLop1mYhoXiBj2V1duqi/nz/cWGg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388461876426.1887372837614; Wed, 30 Aug 2023 02:41:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgw-0006Gg-UU; Wed, 30 Aug 2023 05:40:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgu-0006EB-T2 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgs-0001RJ-JB for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:48 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-610-Z8Djof9UM92_kKvMIqlHvg-1; Wed, 30 Aug 2023 05:40:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 74B33185A791 for ; Wed, 30 Aug 2023 09:40:44 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A0246466B; Wed, 30 Aug 2023 09:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388446; 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=GGdpQ45dpsnTLUE7/iN3xi5K8N7i0y22IQsayhCD/mc=; b=J+zZv66RBd2WXtFpOQUZhVXNeM/F97WIIJCJkY5EY7Gd2Bnl8giV2v9M0GhsohqZ8SNATA Ly65ciZcoRckn+7cEsho2HFwcmUHaDd3zl+BQuhiza3FlNgJjS9c3AJoXf9fu8wCpNrJL+ Q4mrgN+yrKYcjEUvH8JmCU0fJv5XVXg= X-MC-Unique: Z8Djof9UM92_kKvMIqlHvg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 30/67] ui/vc: fold text_console_do_init() in vc_chr_open() Date: Wed, 30 Aug 2023 13:38:04 +0400 Message-ID: <20230830093843.3531473-31-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388463336100003 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/console.c | 80 ++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 49 deletions(-) diff --git a/ui/console.c b/ui/console.c index 9d884ba02f..22505d093f 100644 --- a/ui/console.c +++ b/ui/console.c @@ -187,7 +187,6 @@ static QTAILQ_HEAD(, QemuConsole) consoles =3D static bool cursor_visible_phase; static QEMUTimer *cursor_timer; =20 -static void text_console_do_init(Chardev *chr); static void dpy_refresh(DisplayState *s); static DisplayState *get_alloc_displaystate(void); static void text_console_update_cursor_timer(void); @@ -2534,49 +2533,6 @@ static const GraphicHwOps text_console_ops =3D { .text_update =3D text_console_update, }; =20 -static void text_console_do_init(Chardev *chr) -{ - VCChardev *drv =3D VC_CHARDEV(chr); - QemuTextConsole *s =3D drv->console; - int g_width =3D 80 * FONT_WIDTH; - int g_height =3D 24 * FONT_HEIGHT; - - fifo8_create(&s->out_fifo, 16); - - s->y_displayed =3D 0; - s->y_base =3D 0; - s->total_height =3D DEFAULT_BACKSCROLL; - s->x =3D 0; - s->y =3D 0; - if (QEMU_CONSOLE(s)->scanout.kind !=3D SCANOUT_SURFACE) { - if (active_console && active_console->scanout.kind =3D=3D SCANOUT_= SURFACE) { - g_width =3D qemu_console_get_width(active_console, g_width); - g_height =3D qemu_console_get_height(active_console, g_height); - } - QEMU_CONSOLE(s)->surface =3D qemu_create_displaysurface(g_width, g= _height); - QEMU_CONSOLE(s)->scanout.kind =3D SCANOUT_SURFACE; - } - - QEMU_CONSOLE(s)->hw_ops =3D &text_console_ops; - QEMU_CONSOLE(s)->hw =3D s; - - /* set current text attributes to default */ - drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; - text_console_resize(s); - - if (chr->label) { - char *msg; - - drv->t_attrib.bgcol =3D QEMU_COLOR_BLUE; - msg =3D g_strdup_printf("%s console\r\n", chr->label); - qemu_chr_write(chr, (uint8_t *)msg, strlen(msg), true); - g_free(msg); - drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; - } - - qemu_chr_be_event(chr, CHR_EVENT_OPENED); -} - static void vc_chr_open(Chardev *chr, ChardevBackend *backend, bool *be_opened, @@ -2587,6 +2543,8 @@ static void vc_chr_open(Chardev *chr, QemuTextConsole *s; unsigned width =3D 0; unsigned height =3D 0; + int g_width =3D 80 * FONT_WIDTH; + int g_height =3D 24 * FONT_HEIGHT; =20 if (vc->has_width) { width =3D vc->width; @@ -2612,12 +2570,36 @@ static void vc_chr_open(Chardev *chr, s->chr =3D chr; drv->console =3D s; =20 - text_console_do_init(chr); + fifo8_create(&s->out_fifo, 16); =20 - /* console/chardev init sometimes completes elsewhere in a 2nd - * stage, so defer OPENED events until they are fully initialized - */ - *be_opened =3D false; + s->total_height =3D DEFAULT_BACKSCROLL; + if (QEMU_CONSOLE(s)->scanout.kind !=3D SCANOUT_SURFACE) { + if (active_console && active_console->scanout.kind =3D=3D SCANOUT_= SURFACE) { + g_width =3D qemu_console_get_width(active_console, g_width); + g_height =3D qemu_console_get_height(active_console, g_height); + } + QEMU_CONSOLE(s)->surface =3D qemu_create_displaysurface(g_width, g= _height); + QEMU_CONSOLE(s)->scanout.kind =3D SCANOUT_SURFACE; + } + + QEMU_CONSOLE(s)->hw_ops =3D &text_console_ops; + QEMU_CONSOLE(s)->hw =3D s; + + /* set current text attributes to default */ + drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; + text_console_resize(s); + + if (chr->label) { + char *msg; + + drv->t_attrib.bgcol =3D QEMU_COLOR_BLUE; + msg =3D g_strdup_printf("%s console\r\n", chr->label); + qemu_chr_write(chr, (uint8_t *)msg, strlen(msg), true); + g_free(msg); + drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; + } + + *be_opened =3D true; } =20 void qemu_console_resize(QemuConsole *s, int width, int height) --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388494; cv=none; d=zohomail.com; s=zohoarc; b=D6iUyaoNierbU7ln58Bw0iKcmDE53RMZdh2Q6CwkiI+/wy9OHEWEx0aklAYa4bFoZnBbudhgAyL5A65K7GPlFMDHWZQgnuiEAY6eBhsGA7dqFuj1LryonkMsLwVGh3osDEOt/qUkAdrkd/6EMw+YhvwKNvEFrdZ6Usx8B4CPmhk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388494; 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=eAWXro9PmmZC4Ed5JqhuIeH+6qdeKJI2x23+xCgSDpQ=; b=HKDW9tR7hOpIDD3vcvALi4MQyK5fucYjEDi+YS560qVkhmX+4o0iyCBvRneu8OH5cbTTGxCWd3ozn/UxLLKa96eI+qKBd4HIrf2hjrcaFwlVbiEq5ckAzAagJkar2Fk43mNQxIz7ENA4IQyZUIBSaE5AI7P9TUV1t8TFcQ5WrZo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388494559740.6316569480603; Wed, 30 Aug 2023 02:41:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHgz-0006Un-Cs; Wed, 30 Aug 2023 05:40:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgx-0006Kz-VL for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHgv-0001Rl-PW for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:51 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-622-yjBLsFBwNT6ur0be4_55OQ-1; Wed, 30 Aug 2023 05:40:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7A535101CC60 for ; Wed, 30 Aug 2023 09:40:47 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3B571121315; Wed, 30 Aug 2023 09:40:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388449; 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=eAWXro9PmmZC4Ed5JqhuIeH+6qdeKJI2x23+xCgSDpQ=; b=gJJB9dO9R5uJ3LTlbJG2v8d5esZqbNZ/hfKJeAtGv5tRay4wA7r+RskzqbRO7RCGLWCE6H v8nyaehlgNEZz3vD13ft7mgucNHNyxTMTRl2FkK7GIYgNnvQbQkZcjkB7nnIJvr+GDxoD9 IQXLDci9sefrcOcu4KdfHEJAewrFqU4= X-MC-Unique: yjBLsFBwNT6ur0be4_55OQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 31/67] ui/vc: move some text console initialization to qom handlers Date: Wed, 30 Aug 2023 13:38:05 +0400 Message-ID: <20230830093843.3531473-32-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388495844100006 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ui/console.c b/ui/console.c index 22505d093f..5d521ba79d 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1413,9 +1413,20 @@ qemu_text_console_class_init(ObjectClass *oc, void *= data) } } =20 +static const GraphicHwOps text_console_ops =3D { + .invalidate =3D text_console_invalidate, + .text_update =3D text_console_update, +}; + static void qemu_text_console_init(Object *obj) { + QemuTextConsole *c =3D QEMU_TEXT_CONSOLE(obj); + + fifo8_create(&c->out_fifo, 16); + c->total_height =3D DEFAULT_BACKSCROLL; + QEMU_CONSOLE(c)->hw_ops =3D &text_console_ops; + QEMU_CONSOLE(c)->hw =3D c; } =20 static void @@ -2528,11 +2539,6 @@ static void text_console_update_cursor(void *opaque) } } =20 -static const GraphicHwOps text_console_ops =3D { - .invalidate =3D text_console_invalidate, - .text_update =3D text_console_update, -}; - static void vc_chr_open(Chardev *chr, ChardevBackend *backend, bool *be_opened, @@ -2570,9 +2576,6 @@ static void vc_chr_open(Chardev *chr, s->chr =3D chr; drv->console =3D s; =20 - fifo8_create(&s->out_fifo, 16); - - s->total_height =3D DEFAULT_BACKSCROLL; if (QEMU_CONSOLE(s)->scanout.kind !=3D SCANOUT_SURFACE) { if (active_console && active_console->scanout.kind =3D=3D SCANOUT_= SURFACE) { g_width =3D qemu_console_get_width(active_console, g_width); @@ -2582,9 +2585,6 @@ static void vc_chr_open(Chardev *chr, QEMU_CONSOLE(s)->scanout.kind =3D SCANOUT_SURFACE; } =20 - QEMU_CONSOLE(s)->hw_ops =3D &text_console_ops; - QEMU_CONSOLE(s)->hw =3D s; - /* set current text attributes to default */ drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; text_console_resize(s); --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388578; cv=none; d=zohomail.com; s=zohoarc; b=QlejZ5AmAqB3q1AyoQobnW5itgesdD258BGftEbdON4QB5e9posbCbMn6sH1NgoGAywNQWzyw+YsjAmMgYkDnBCidY1Dc7dibWaHyABhpLsSPpSl/ldufL89J1HimsZWbM4IBRRjvFd4wj4G9l8zFmlWk0mlELmIHMOH0nasd1g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388578; 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=jqoNmmwvJrcqWZe6bUUYwxxSPy3GM6fZAB35IIPP85c=; b=H+vtjmtKvKMkpV02gLd4RwkbBsmojqdMcDp9T8jCz6yq/LkL3OT8SeXDDsvyUr+L6CvLXV+AAn7ZikVXaFYkIcg8gUaWB1jiRDt6QM9+1Io9lYXg6zUnUhMYqw4+eO4cDPHRNQi/D4KcUxptlERED2T8yid6fDY1lHkVKYTI1UM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16933885787511016.8526823177586; Wed, 30 Aug 2023 02:42:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHh5-0007K2-1s; Wed, 30 Aug 2023 05:40:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHh3-00078L-Tr for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHh0-0001SD-MN for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:40:57 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-621-T_aOzbxwNyqW96XgK1VjAg-1; Wed, 30 Aug 2023 05:40:52 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C7601858290 for ; Wed, 30 Aug 2023 09:40:51 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A5A3140E96E; Wed, 30 Aug 2023 09:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388453; 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=jqoNmmwvJrcqWZe6bUUYwxxSPy3GM6fZAB35IIPP85c=; b=KTOiFCQ/A0Gl8XEey4PHeHC+n94mW1EdZy2MSdebA7dJax6CyjXkIjk/Gn0I77nsg5g6tg oNNAAWdOL+h2bKB3I0qXPTWderlQr/tTVPM1w2ogshv6GHEYv1lJBSUJnK2sGWPguazcK7 U4ZPG4PDXefU2nzzOr0u67BvMHaz+hc= X-MC-Unique: T_aOzbxwNyqW96XgK1VjAg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 32/67] ui/console: simplify getting active_console size Date: Wed, 30 Aug 2023 13:38:06 +0400 Message-ID: <20230830093843.3531473-33-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388580904100003 From: Marc-Andr=C3=A9 Lureau We can get the active console dimension regardless of its kind, by simply giving NULL as argument. It will fallback with the given value when the dimensions aren't known. This will also allow to move the code in a separate unit more easily. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ui/console.c b/ui/console.c index 5d521ba79d..70e11f924d 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2577,10 +2577,8 @@ static void vc_chr_open(Chardev *chr, drv->console =3D s; =20 if (QEMU_CONSOLE(s)->scanout.kind !=3D SCANOUT_SURFACE) { - if (active_console && active_console->scanout.kind =3D=3D SCANOUT_= SURFACE) { - g_width =3D qemu_console_get_width(active_console, g_width); - g_height =3D qemu_console_get_height(active_console, g_height); - } + g_width =3D qemu_console_get_width(NULL, g_width); + g_height =3D qemu_console_get_height(NULL, g_height); QEMU_CONSOLE(s)->surface =3D qemu_create_displaysurface(g_width, g= _height); QEMU_CONSOLE(s)->scanout.kind =3D SCANOUT_SURFACE; } --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388494; cv=none; d=zohomail.com; s=zohoarc; b=T+z+t8JNqFh4lbwEME5dtGdoe8UCYbalvVzAZD2OX+BPlcCEHEYG9RF9M7dxV9DNNQFdjpJKMeOahfOLVof1LH3zaFYQoRqS7W2CTuo9Zkf54hvimikDcJ7je5q5RvQW5zHR3KvDH+/ZJKdFeJdO/TGJx3H0ZOh6K7aV9YVa1S4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388494; 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=ErAXRv5qAwhdlrPh4QLGVNxP8Web3NSz0vi9kAWkZFI=; b=RI8iDsnvNs8BggbaHgjAbaQn6yJcBKdeM1AVWntQQPqTNm7ul8JXk0/OppPiHnPs7gkTAjv+VbmOrSSlnYORpXsmCwTa9TGjwU3W0E0WpTsy65uph+PVH7E7re9EUDsUJ1SUh6HinVwWVqR47Q0qvoUbNag+suxQ9FO99eQKlkI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388494155183.91982247439762; Wed, 30 Aug 2023 02:41:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHh9-000889-TM; Wed, 30 Aug 2023 05:41:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHh9-0007v1-4f for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHh6-0001So-UX for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:02 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-lrpWZjvoMhO047HhR7qiTg-1; Wed, 30 Aug 2023 05:40:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 581B48022E4 for ; Wed, 30 Aug 2023 09:40:56 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C153C15BAE; Wed, 30 Aug 2023 09:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388460; 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=ErAXRv5qAwhdlrPh4QLGVNxP8Web3NSz0vi9kAWkZFI=; b=cSWCkHQkta/lhRPrsW9eoldyJqI+J9cOjeCaJ8ms8NCBIO7KLoEjNHyaPC2ssv2MRPt8SG EP2EswtBy0o6qvsTyyKQEG99SSYrTYOTRQGV26GVBStxm8/vLDTgpJvAUJzA3zNdx6JLAv RLz+MHHd5Do+bVc0xpXDFzt2lpoYsY8= X-MC-Unique: lrpWZjvoMhO047HhR7qiTg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 33/67] ui/console: remove need for g_width/g_height Date: Wed, 30 Aug 2023 13:38:07 +0400 Message-ID: <20230830093843.3531473-34-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388495837100005 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ui/console.c b/ui/console.c index 70e11f924d..a3fd1c5059 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2549,8 +2549,6 @@ static void vc_chr_open(Chardev *chr, QemuTextConsole *s; unsigned width =3D 0; unsigned height =3D 0; - int g_width =3D 80 * FONT_WIDTH; - int g_height =3D 24 * FONT_HEIGHT; =20 if (vc->has_width) { width =3D vc->width; @@ -2567,6 +2565,8 @@ static void vc_chr_open(Chardev *chr, trace_console_txt_new(width, height); if (width =3D=3D 0 || height =3D=3D 0) { s =3D QEMU_TEXT_CONSOLE(object_new(TYPE_QEMU_TEXT_CONSOLE)); + width =3D qemu_console_get_width(NULL, 80 * FONT_WIDTH); + height =3D qemu_console_get_height(NULL, 24 * FONT_HEIGHT); } else { s =3D QEMU_TEXT_CONSOLE(object_new(TYPE_QEMU_FIXED_TEXT_CONSOLE)); QEMU_CONSOLE(s)->scanout.kind =3D SCANOUT_SURFACE; @@ -2577,9 +2577,7 @@ static void vc_chr_open(Chardev *chr, drv->console =3D s; =20 if (QEMU_CONSOLE(s)->scanout.kind !=3D SCANOUT_SURFACE) { - g_width =3D qemu_console_get_width(NULL, g_width); - g_height =3D qemu_console_get_height(NULL, g_height); - QEMU_CONSOLE(s)->surface =3D qemu_create_displaysurface(g_width, g= _height); + QEMU_CONSOLE(s)->surface =3D qemu_create_displaysurface(width, hei= ght); QEMU_CONSOLE(s)->scanout.kind =3D SCANOUT_SURFACE; } =20 --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388574; cv=none; d=zohomail.com; s=zohoarc; b=Pw+xOlTBvHuV8rb5JlRGkXMlwzRgBqO2AgUC7vDTYMc5/9q1k+Anghf1nLj9/WLbt+zC8NEu9UonpZVpShdZlynbckDmymNOLrQzPzMsB+l/JfHNF6LepWn2j0Akg/XU0Wgv2RydeNXVFuHfzme7srUlK7OEkwsoSXHCIdEc6pM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388574; 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=kzr4shcfZcvNMra7y8KJaZPnm7re14zzMHs4XPlzg8M=; b=fWKr7LknrohzmCVnXrcq/Vy5saE/SvDdFGstC+UjBfr7apRyggSCdnA4NbvmDjAcnjlqX8yrzIaQgExzBvM7BmmkakRs4Hu0Ne/fI+fgPL1aPeGgWIUJztfp2r55Bkr9cGiLCx6I5kPopk6lL4aS3Uf3Vta4tOjCObBfptzBpV0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388574852303.76179768383304; Wed, 30 Aug 2023 02:42:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHhD-0008UN-T6; Wed, 30 Aug 2023 05:41:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhB-0008Ls-O1 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHh9-0001T2-D6 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:05 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-614-MU8M17cBP1yODoJVxv2ztg-1; Wed, 30 Aug 2023 05:41:01 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EC02485CCE2 for ; Wed, 30 Aug 2023 09:41:00 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1641E2026D38; Wed, 30 Aug 2023 09:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388462; 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=kzr4shcfZcvNMra7y8KJaZPnm7re14zzMHs4XPlzg8M=; b=Tjbm08d/1yT+SC71tQrrfKju2yhxuTyMffaR7t4an/m++aDeR9jYzFIFugYhUdEZiOKq3l yrf7ZvfMhbLcDF+ZddldrJ6YF9vhsDkG6aha2Q6LeMsKNVuQxYxyAANvZKve4B+LTpjtVw PWIho7QGRMOc4LASjOW3/tnorr+KmJM= X-MC-Unique: MU8M17cBP1yODoJVxv2ztg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 34/67] ui/vc: use common text console surface creation Date: Wed, 30 Aug 2023 13:38:08 +0400 Message-ID: <20230830093843.3531473-35-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388575506100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ui/console.c b/ui/console.c index a3fd1c5059..3d884956b7 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2569,18 +2569,13 @@ static void vc_chr_open(Chardev *chr, height =3D qemu_console_get_height(NULL, 24 * FONT_HEIGHT); } else { s =3D QEMU_TEXT_CONSOLE(object_new(TYPE_QEMU_FIXED_TEXT_CONSOLE)); - QEMU_CONSOLE(s)->scanout.kind =3D SCANOUT_SURFACE; - QEMU_CONSOLE(s)->surface =3D qemu_create_displaysurface(width, hei= ght); } =20 + dpy_gfx_replace_surface(QEMU_CONSOLE(s), qemu_create_displaysurface(wi= dth, height)); + s->chr =3D chr; drv->console =3D s; =20 - if (QEMU_CONSOLE(s)->scanout.kind !=3D SCANOUT_SURFACE) { - QEMU_CONSOLE(s)->surface =3D qemu_create_displaysurface(width, hei= ght); - QEMU_CONSOLE(s)->scanout.kind =3D SCANOUT_SURFACE; - } - /* set current text attributes to default */ drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; text_console_resize(s); --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388602; cv=none; d=zohomail.com; s=zohoarc; b=Jm1wN3CvRl3q4EccLr6akb8FTAIkslLbG9bIQtMLhc+3XAcfxducMb5xkB7+RtukL7kERgetKvNqQHVBypzqrLMxKxZAdvU9UZtWz+cyiJBCgAUR6XRjnsAbmb6v7JaPqqdx3NaqbsI1+EpIcov4ZWLlBk7W7LzPto7Cz/qIJRg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388602; 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=6X7vAMagRhJo2WUw26kDDjrIxpoTT6nK6oaTa2aRhs4=; b=mCAsft/+KSZigsuM1mjHPFA/TZ6ileHiwWXF67LKSeMSrfniOhkpWvzvp4X7VK1t+CrSYIcoJacrzAxNvYatn1nA3M8mkLjuXX8Aju7AhhfeObH/ekB0YakLKuh604xTJLYtvGsYnrnOY8/tFvAcPGci8llt0StV1aZdESww40U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388602739400.12129042486526; Wed, 30 Aug 2023 02:43:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHhH-0000Jx-Gk; Wed, 30 Aug 2023 05:41:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhF-0008VP-LA for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhD-0001Tf-H2 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:09 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-450-1hiqTk1NOy2qzgskJEKmcQ-1; Wed, 30 Aug 2023 05:41:05 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 051B98022E4 for ; Wed, 30 Aug 2023 09:41:05 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF6E1140E96E; Wed, 30 Aug 2023 09:41:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388467; 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=6X7vAMagRhJo2WUw26kDDjrIxpoTT6nK6oaTa2aRhs4=; b=E4iKNzbqLU+qh16NgBDLO55NlKzdd+xpHjwG0g9FboEwsBYNGFSgTZhqN6NhSyzk5C+j3T TVHoiOe/0+gWAckwcNtzwR/Mm5l+wfQ/5LHbKYobEy3dyyWFAXEPl92cUglO+EsVQEuvAY mXYpxxg92Pm8yBxdbJEAw8pF5zizz3E= X-MC-Unique: 1hiqTk1NOy2qzgskJEKmcQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 35/67] ui/console: declare console types in console.h Date: Wed, 30 Aug 2023 13:38:09 +0400 Message-ID: <20230830093843.3531473-36-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388603124100001 From: Marc-Andr=C3=A9 Lureau We are going to split the console.c unit next, and implement separately. But we need to check the underlying type in various places. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- include/ui/console.h | 25 +++++++++++++++++++++---- ui/console.c | 15 --------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 465f0f93a0..0f7f50deaf 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -12,6 +12,27 @@ # include "ui/shader.h" #endif =20 +#define TYPE_QEMU_CONSOLE "qemu-console" +OBJECT_DECLARE_TYPE(QemuConsole, QemuConsoleClass, QEMU_CONSOLE) + +#define TYPE_QEMU_GRAPHIC_CONSOLE "qemu-graphic-console" +OBJECT_DECLARE_SIMPLE_TYPE(QemuGraphicConsole, QEMU_GRAPHIC_CONSOLE) + +#define TYPE_QEMU_TEXT_CONSOLE "qemu-text-console" +OBJECT_DECLARE_SIMPLE_TYPE(QemuTextConsole, QEMU_TEXT_CONSOLE) + +#define TYPE_QEMU_FIXED_TEXT_CONSOLE "qemu-fixed-text-console" +OBJECT_DECLARE_SIMPLE_TYPE(QemuFixedTextConsole, QEMU_FIXED_TEXT_CONSOLE) + +#define QEMU_IS_GRAPHIC_CONSOLE(c) \ + object_dynamic_cast(OBJECT(c), TYPE_QEMU_GRAPHIC_CONSOLE) + +#define QEMU_IS_TEXT_CONSOLE(c) \ + object_dynamic_cast(OBJECT(c), TYPE_QEMU_TEXT_CONSOLE) + +#define QEMU_IS_FIXED_TEXT_CONSOLE(c) \ + object_dynamic_cast(OBJECT(c), TYPE_QEMU_FIXED_TEXT_CONSOLE) + /* keyboard/mouse support */ =20 #define MOUSE_EVENT_LBUTTON 0x01 @@ -112,10 +133,6 @@ void console_handle_touch_event(QemuConsole *con, Error **errp); /* consoles */ =20 -#define TYPE_QEMU_CONSOLE "qemu-console" -OBJECT_DECLARE_TYPE(QemuConsole, QemuConsoleClass, QEMU_CONSOLE) - - struct QemuConsoleClass { ObjectClass parent_class; }; diff --git a/ui/console.c b/ui/console.c index 3d884956b7..ed9e7137b8 100644 --- a/ui/console.c +++ b/ui/console.c @@ -106,13 +106,8 @@ typedef struct QemuGraphicConsole { =20 typedef QemuConsoleClass QemuGraphicConsoleClass; =20 -#define TYPE_QEMU_GRAPHIC_CONSOLE "qemu-graphic-console" -OBJECT_DECLARE_SIMPLE_TYPE(QemuGraphicConsole, QEMU_GRAPHIC_CONSOLE) OBJECT_DEFINE_TYPE(QemuGraphicConsole, qemu_graphic_console, QEMU_GRAPHIC_= CONSOLE, QEMU_CONSOLE) =20 -#define QEMU_IS_GRAPHIC_CONSOLE(c) \ - object_dynamic_cast(OBJECT(c), TYPE_QEMU_GRAPHIC_CONSOLE) - typedef struct QemuTextConsole { QemuConsole parent; =20 @@ -139,26 +134,16 @@ typedef struct QemuTextConsole { =20 typedef QemuConsoleClass QemuTextConsoleClass; =20 -#define TYPE_QEMU_TEXT_CONSOLE "qemu-text-console" -OBJECT_DECLARE_SIMPLE_TYPE(QemuTextConsole, QEMU_TEXT_CONSOLE) OBJECT_DEFINE_TYPE(QemuTextConsole, qemu_text_console, QEMU_TEXT_CONSOLE, = QEMU_CONSOLE) =20 -#define QEMU_IS_TEXT_CONSOLE(c) \ - object_dynamic_cast(OBJECT(c), TYPE_QEMU_TEXT_CONSOLE) - typedef struct QemuFixedTextConsole { QemuTextConsole parent; } QemuFixedTextConsole; =20 typedef QemuTextConsoleClass QemuFixedTextConsoleClass; =20 -#define TYPE_QEMU_FIXED_TEXT_CONSOLE "qemu-fixed-text-console" -OBJECT_DECLARE_SIMPLE_TYPE(QemuFixedTextConsole, QEMU_FIXED_TEXT_CONSOLE) OBJECT_DEFINE_TYPE(QemuFixedTextConsole, qemu_fixed_text_console, QEMU_FIX= ED_TEXT_CONSOLE, QEMU_TEXT_CONSOLE) =20 -#define QEMU_IS_FIXED_TEXT_CONSOLE(c) \ - object_dynamic_cast(OBJECT(c), TYPE_QEMU_FIXED_TEXT_CONSOLE) - struct VCChardev { Chardev parent; QemuTextConsole *console; --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388683; cv=none; d=zohomail.com; s=zohoarc; b=AEWYcEz4Cq6Q+kaS22xFklv/dmrsNndRc/hDTfpLd766UoiWObJH1S2ifZlV/GdW3rSs7uwAtLd0j7BbmEWhs5ECBQuy0EAy37AoEZdnF86S5trWSj66dojwuBNGFdA+XnV0TAKWj5LeNH56dsd0MtAkdeJF2+GBPQeer1MlyFg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388683; 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=bcP8Jbb6P94GlnsCHtBb+7ml3WM/0XgijhwvUrfnjbE=; b=O6BhuYEKATQpJlsVXr9t9+ApwGPSdO6d1PwzUcFVR4zAsLOEYKGzHmyz8WJImYV+DdzBBxXWuwOk+EjiYKaxcd1MoRk9vE9ytgRMdBC91okEDmXY4OegozuSgqcDQu6p0y5XMrehgQcDpfq+HycN2PllKGF+plhXrnzDAgjW7JM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16933886836061007.1148849270804; Wed, 30 Aug 2023 02:44:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHhb-0000go-TL; Wed, 30 Aug 2023 05:41:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhK-0000TD-5L for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhH-0001Tu-Mf for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:13 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-38-E8X14ua8OiK8rJKi7CIhUg-1; Wed, 30 Aug 2023 05:41:09 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 26F9F806007 for ; Wed, 30 Aug 2023 09:41:09 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 041B9C15BAE; Wed, 30 Aug 2023 09:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388471; 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=bcP8Jbb6P94GlnsCHtBb+7ml3WM/0XgijhwvUrfnjbE=; b=DQmErIqpVOyWMBjcb0qshTS+xn5nI16ht/de9rDvmvwpt4/GbLm6I53tfDWn5DsoAp4LKg 8d7nNuGaNI/QLSeuenNYozeREHcDs7Ta2FK0Jqk89/5haTPmKcthCqvsZkP229Daqr0t6C zZwvxnWFY83M3mxmhik8FB3ru8/74C0= X-MC-Unique: E8X14ua8OiK8rJKi7CIhUg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 36/67] ui/console: use QEMU_PIXMAN_COLOR helpers Date: Wed, 30 Aug 2023 13:38:10 +0400 Message-ID: <20230830093843.3531473-37-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388684622100009 From: Marc-Andr=C3=A9 Lureau QEMU_RGB macro is actually defining a pixman color. Make this explicit in the macro name. Move it to qemu-pixman.h so it can be used elsewhere, as done in the following patch. Finally, define QEMU_PIXMAN_COLOR_{BLACK,GRAY}, to avoid need to look up the VGA color table from the QemuConsole placeholder surface rendering. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/ui/qemu-pixman.h | 6 ++++++ ui/console.c | 39 ++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h index ce4518e4de..51f8709327 100644 --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@ -47,6 +47,12 @@ # define PIXMAN_LE_x8r8g8b8 PIXMAN_x8r8g8b8 #endif =20 +#define QEMU_PIXMAN_COLOR(r, g, b) = \ + { .red =3D r << 8, .green =3D g << 8, .blue =3D b << 8, .alpha =3D 0xf= fff } + +#define QEMU_PIXMAN_COLOR_BLACK QEMU_PIXMAN_COLOR(0x00, 0x00, 0x00) +#define QEMU_PIXMAN_COLOR_GRAY QEMU_PIXMAN_COLOR(0xaa, 0xaa, 0xaa) + /* -------------------------------------------------------------------- */ =20 typedef struct PixelFormat { diff --git a/ui/console.c b/ui/console.c index ed9e7137b8..88e37eaff3 100644 --- a/ui/console.c +++ b/ui/console.c @@ -363,29 +363,26 @@ static void vga_bitblt(QemuConsole *con, =20 #include "vgafont.h" =20 -#define QEMU_RGB(r, g, b) \ - { .red =3D r << 8, .green =3D g << 8, .blue =3D b << 8, .alpha =3D 0xf= fff } - static const pixman_color_t color_table_rgb[2][8] =3D { { /* dark */ - [QEMU_COLOR_BLACK] =3D QEMU_RGB(0x00, 0x00, 0x00), /* black */ - [QEMU_COLOR_BLUE] =3D QEMU_RGB(0x00, 0x00, 0xaa), /* blue */ - [QEMU_COLOR_GREEN] =3D QEMU_RGB(0x00, 0xaa, 0x00), /* green */ - [QEMU_COLOR_CYAN] =3D QEMU_RGB(0x00, 0xaa, 0xaa), /* cyan */ - [QEMU_COLOR_RED] =3D QEMU_RGB(0xaa, 0x00, 0x00), /* red */ - [QEMU_COLOR_MAGENTA] =3D QEMU_RGB(0xaa, 0x00, 0xaa), /* magenta */ - [QEMU_COLOR_YELLOW] =3D QEMU_RGB(0xaa, 0xaa, 0x00), /* yellow */ - [QEMU_COLOR_WHITE] =3D QEMU_RGB(0xaa, 0xaa, 0xaa), /* white */ + [QEMU_COLOR_BLACK] =3D QEMU_PIXMAN_COLOR_BLACK, + [QEMU_COLOR_BLUE] =3D QEMU_PIXMAN_COLOR(0x00, 0x00, 0xaa), /* = blue */ + [QEMU_COLOR_GREEN] =3D QEMU_PIXMAN_COLOR(0x00, 0xaa, 0x00), /* = green */ + [QEMU_COLOR_CYAN] =3D QEMU_PIXMAN_COLOR(0x00, 0xaa, 0xaa), /* = cyan */ + [QEMU_COLOR_RED] =3D QEMU_PIXMAN_COLOR(0xaa, 0x00, 0x00), /* = red */ + [QEMU_COLOR_MAGENTA] =3D QEMU_PIXMAN_COLOR(0xaa, 0x00, 0xaa), /* = magenta */ + [QEMU_COLOR_YELLOW] =3D QEMU_PIXMAN_COLOR(0xaa, 0xaa, 0x00), /* = yellow */ + [QEMU_COLOR_WHITE] =3D QEMU_PIXMAN_COLOR_GRAY, }, { /* bright */ - [QEMU_COLOR_BLACK] =3D QEMU_RGB(0x00, 0x00, 0x00), /* black */ - [QEMU_COLOR_BLUE] =3D QEMU_RGB(0x00, 0x00, 0xff), /* blue */ - [QEMU_COLOR_GREEN] =3D QEMU_RGB(0x00, 0xff, 0x00), /* green */ - [QEMU_COLOR_CYAN] =3D QEMU_RGB(0x00, 0xff, 0xff), /* cyan */ - [QEMU_COLOR_RED] =3D QEMU_RGB(0xff, 0x00, 0x00), /* red */ - [QEMU_COLOR_MAGENTA] =3D QEMU_RGB(0xff, 0x00, 0xff), /* magenta */ - [QEMU_COLOR_YELLOW] =3D QEMU_RGB(0xff, 0xff, 0x00), /* yellow */ - [QEMU_COLOR_WHITE] =3D QEMU_RGB(0xff, 0xff, 0xff), /* white */ + [QEMU_COLOR_BLACK] =3D QEMU_PIXMAN_COLOR_BLACK, + [QEMU_COLOR_BLUE] =3D QEMU_PIXMAN_COLOR(0x00, 0x00, 0xff), /* = blue */ + [QEMU_COLOR_GREEN] =3D QEMU_PIXMAN_COLOR(0x00, 0xff, 0x00), /* = green */ + [QEMU_COLOR_CYAN] =3D QEMU_PIXMAN_COLOR(0x00, 0xff, 0xff), /* = cyan */ + [QEMU_COLOR_RED] =3D QEMU_PIXMAN_COLOR(0xff, 0x00, 0x00), /* = red */ + [QEMU_COLOR_MAGENTA] =3D QEMU_PIXMAN_COLOR(0xff, 0x00, 0xff), /* = magenta */ + [QEMU_COLOR_YELLOW] =3D QEMU_PIXMAN_COLOR(0xff, 0xff, 0x00), /* = yellow */ + [QEMU_COLOR_WHITE] =3D QEMU_PIXMAN_COLOR(0xff, 0xff, 0xff), /* = white */ } }; =20 @@ -1520,8 +1517,8 @@ DisplaySurface *qemu_create_placeholder_surface(int w= , int h, const char *msg) { DisplaySurface *surface =3D qemu_create_displaysurface(w, h); - pixman_color_t bg =3D color_table_rgb[0][QEMU_COLOR_BLACK]; - pixman_color_t fg =3D color_table_rgb[0][QEMU_COLOR_WHITE]; + pixman_color_t bg =3D QEMU_PIXMAN_COLOR_BLACK; + pixman_color_t fg =3D QEMU_PIXMAN_COLOR_GRAY; pixman_image_t *glyph; int len, x, y, i; =20 --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388589; cv=none; d=zohomail.com; s=zohoarc; b=dJ8+9mDCfI65lcY8Ye3dJwKjx+lS/PfwskXuBMsQP7cy3xETRbh8Mv8B1I8Ek1RryQ+JeUQomiWpNgsjKjndAJ02Q0jUTs9y2l5pb2ZOQuyXGZZ15iC5VWBrTkOlTSRNKhjSSFWUbvHUMleLSFMtZsSscwy+KL0YLUHNs/GZTp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388589; 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=6coQ7IvZaowR/dWM1Wvgr1P4b5njKJ7ETe+ZrBULxCo=; b=HECvr8bkyF5CXqAcxTwhKyEqmXpKQlGDeREvyOHu4AJWWubmtdnwC7Oo3joYKuztpSJqW6pRh/X49DWxd4t80SYE0A2BgnWmRhDmZEUrRVLcPcaJUHnDiXttKwneBnC6Tw1+FZ7C9yGGo3FvBBYDo+oM/GOuJx1USTUXC89nTGo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16933885890504.980118094739851; Wed, 30 Aug 2023 02:43:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHhf-0001E1-Je; Wed, 30 Aug 2023 05:41:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhO-0000WK-AR for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhL-0001UC-LS for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:17 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-581-zxfcMAHJPQCqU1IKTP_J8Q-1; Wed, 30 Aug 2023 05:41:13 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 25842101A52E for ; Wed, 30 Aug 2023 09:41:13 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA4492026D38; Wed, 30 Aug 2023 09:41:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388475; 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=6coQ7IvZaowR/dWM1Wvgr1P4b5njKJ7ETe+ZrBULxCo=; b=MiNendOVqvl8CeD8fZiTBl6MDjA59fLwZWzAfEZ0ZvEo/q9AY47tAb7rA8q/1LcQZ7AWHm PL2+6vU3FPA0SoXtsH3mebOE4acgyD5dotXmvvOe1p7vjS129esuCd4ue3OBTv1PXbRLRE wcfSuq/QYKEzF/IpWahEDwif5qC8/80= X-MC-Unique: zxfcMAHJPQCqU1IKTP_J8Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 37/67] =?UTF-8?q?ui/console:=20rename=20vga=5F=20functions?= =?UTF-8?q?=20=E2=86=92=20qemu=5Fconsole=5F?= Date: Wed, 30 Aug 2023 13:38:11 +0400 Message-ID: <20230830093843.3531473-38-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388591070100009 From: Marc-Andr=C3=A9 Lureau They are not specific to VGA. Let's use the object type name as prefix instead, to avoid confusion. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- ui/console.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/ui/console.c b/ui/console.c index 88e37eaff3..a157a5b31c 100644 --- a/ui/console.c +++ b/ui/console.c @@ -331,9 +331,8 @@ void graphic_hw_text_update(QemuConsole *con, console_c= h_t *chardata) } } =20 -static void vga_fill_rect(QemuConsole *con, - int posx, int posy, int width, int height, - pixman_color_t color) +static void qemu_console_fill_rect(QemuConsole *con, int posx, int posy, + int width, int height, pixman_color_t c= olor) { DisplaySurface *surface =3D qemu_console_surface(con); pixman_rectangle16_t rect =3D { @@ -345,8 +344,8 @@ static void vga_fill_rect(QemuConsole *con, } =20 /* copy from (xs, ys) to (xd, yd) a rectangle of size (w, h) */ -static void vga_bitblt(QemuConsole *con, - int xs, int ys, int xd, int yd, int w, int h) +static void qemu_console_bitblt(QemuConsole *con, + int xs, int ys, int xd, int yd, int w, int= h) { DisplaySurface *surface =3D qemu_console_surface(con); =20 @@ -526,8 +525,8 @@ static void console_refresh(QemuTextConsole *s) s->text_y[1] =3D s->height - 1; s->cursor_invalidate =3D 1; =20 - vga_fill_rect(QEMU_CONSOLE(s), 0, 0, surface_width(surface), surface_h= eight(surface), - color_table_rgb[0][QEMU_COLOR_BLACK]); + qemu_console_fill_rect(QEMU_CONSOLE(s), 0, 0, surface_width(surface), = surface_height(surface), + color_table_rgb[0][QEMU_COLOR_BLACK]); y1 =3D s->y_displayed; for (y =3D 0; y < s->height; y++) { c =3D s->cells + y1 * s->width; @@ -605,12 +604,12 @@ static void vc_put_lf(VCChardev *vc) s->text_x[1] =3D s->width - 1; s->text_y[1] =3D s->height - 1; =20 - vga_bitblt(QEMU_CONSOLE(s), 0, FONT_HEIGHT, 0, 0, - s->width * FONT_WIDTH, - (s->height - 1) * FONT_HEIGHT); - vga_fill_rect(QEMU_CONSOLE(s), 0, (s->height - 1) * FONT_HEIGH= T, - s->width * FONT_WIDTH, FONT_HEIGHT, - color_table_rgb[0][TEXT_ATTRIBUTES_DEFAULT.bgcol= ]); + qemu_console_bitblt(QEMU_CONSOLE(s), 0, FONT_HEIGHT, 0, 0, + s->width * FONT_WIDTH, + (s->height - 1) * FONT_HEIGHT); + qemu_console_fill_rect(QEMU_CONSOLE(s), 0, (s->height - 1) * F= ONT_HEIGHT, + s->width * FONT_WIDTH, FONT_HEIGHT, + color_table_rgb[0][TEXT_ATTRIBUTES_DEFA= ULT.bgcol]); s->update_x0 =3D 0; s->update_y0 =3D 0; s->update_x1 =3D s->width * FONT_WIDTH; --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388605; cv=none; d=zohomail.com; s=zohoarc; b=ZCCJ9KexL8IOizAHj2Nd6K7YOsryCYJCtgeBIdHc2e6AZbknsM48KttE5eluf4Dr0Nghk7gnZ7m2VYU8QIBQ6jEtG1OzanM6in4KXY14+UboCSBF9wcQsnqyqTru+q3qvgFAeVEjb9cLFhSb7hrjMljxnMdeWA3dCBGFnO1+9Go= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388605; 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=QVnS0EtapTH/3lcUCUDGkP3QaR3h2B9ItQsiV66v4xQ=; b=YupQJsGA/Kr6umPqUmDQwKZ9FlwZiB2vfY1vpusoQeeTo5r392fvQUdlqRRroqa+JTeTmqcBlrCRnn1rR0Qnx7KcbBkOq25fLkLGJyZBm5fXj1NaLFAqFBd3gNuVsgzMQdNinsKel6z0twsSNGCXH9r2ClGlDg9Hf3WSJmv07tU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388605926649.0418632720271; Wed, 30 Aug 2023 02:43:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHhc-0000kc-6G; Wed, 30 Aug 2023 05:41:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhS-0000ZX-2F for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhP-0001UX-Vn for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:21 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-53-TH1aMSjAMdCaNTkCdd_tOQ-1; Wed, 30 Aug 2023 05:41:17 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6449A805951 for ; Wed, 30 Aug 2023 09:41:17 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 654AA140E96F; Wed, 30 Aug 2023 09:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388479; 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=QVnS0EtapTH/3lcUCUDGkP3QaR3h2B9ItQsiV66v4xQ=; b=SfraYs7XNsFQhcPl/fcLcJzuMwTNWY5HUUZYO9ErpCSHb8Ljlimkdh15sQo/dHyY3s/mKu kx0UWhhpBRfQB33aFY35v7YJmsJzoFsFh2QE/SmsID8l7zQjgdQ7BMLDo/s3yKnOFQCHer fejZkUXPS3FEhMNBc9wVUs2uofZMyqA= X-MC-Unique: TH1aMSjAMdCaNTkCdd_tOQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 38/67] ui/console: assert(surface) where appropriate Date: Wed, 30 Aug 2023 13:38:12 +0400 Message-ID: <20230830093843.3531473-39-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388607710100007 From: Marc-Andr=C3=A9 Lureau The QemuTextConsole code paths assume a surface is being used as scanout, let's make this more explicit. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/console.c b/ui/console.c index a157a5b31c..04ec2d2488 100644 --- a/ui/console.c +++ b/ui/console.c @@ -339,6 +339,7 @@ static void qemu_console_fill_rect(QemuConsole *con, in= t posx, int posy, .x =3D posx, .y =3D posy, .width =3D width, .height =3D height }; =20 + assert(surface); pixman_image_fill_rectangles(PIXMAN_OP_SRC, surface->image, &color, 1, &rect); } @@ -349,6 +350,7 @@ static void qemu_console_bitblt(QemuConsole *con, { DisplaySurface *surface =3D qemu_console_surface(con); =20 + assert(surface); pixman_image_composite(PIXMAN_OP_SRC, surface->image, NULL, surface->image, xs, ys, 0, 0, xd, yd, w, h); @@ -392,6 +394,7 @@ static void vga_putcharxy(QemuConsole *s, int x, int y,= int ch, DisplaySurface *surface =3D qemu_console_surface(s); pixman_color_t fgcol, bgcol; =20 + assert(surface); if (t_attrib->invers) { bgcol =3D color_table_rgb[t_attrib->bold][t_attrib->fgcol]; fgcol =3D color_table_rgb[t_attrib->bold][t_attrib->bgcol]; @@ -519,6 +522,7 @@ static void console_refresh(QemuTextConsole *s) TextCell *c; int x, y, y1; =20 + assert(surface); s->text_x[0] =3D 0; s->text_y[0] =3D 0; s->text_x[1] =3D s->width - 1; --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388596; cv=none; d=zohomail.com; s=zohoarc; b=aDVJaacbWVg4QdLa0/aH0JbldqpN02Ai7ekGuaUrqHAC2pmxakzkvkTXb2Tq9KwCbDCWmEfKH3+jIMLSDeOcPtqZaEZhhqr37JFOIEVjKPMLtXurC/psuyIlZUhWDAOtaqtKAS+3Scgghd0JEtP7uPh6xFjSXyvWErCwam20CGg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388596; 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=o5XDk4/Edr6CXpXgef09NrC49TzD0NVUaltlO+MRugY=; b=O9jxUHPxR9dcSyP6qCMdkGIgs7ZUzgyRTcuDBC32ZXruYjhoMmJ3ScyN9Zeaz6tszdadPAFoOcWrWHFuW2ZG/6mwq4c1y6fctuHrIEcKJLhFITnyn2kyc2beLsGStPr2fMfDtXzu+FQCoPDHO97x2l8CbdpBa8Q2novuhGaeotI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388596125762.3508053729755; Wed, 30 Aug 2023 02:43:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHhd-0000r1-27; Wed, 30 Aug 2023 05:41:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhV-0000dd-Oc for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhT-0001Uw-Kk for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:25 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-371-08rjyZCBN4ixG7bewZATCw-1; Wed, 30 Aug 2023 05:41:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 309643C0E445 for ; Wed, 30 Aug 2023 09:41:21 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A4BA40C6F4F; Wed, 30 Aug 2023 09:41:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388482; 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=o5XDk4/Edr6CXpXgef09NrC49TzD0NVUaltlO+MRugY=; b=Uoq95kcyAcngPg1gZkUwa2LtGuvwh4Cqm37zDNYiL733KHWNc6ZPfXVmyRj7UbLZ2f6zEx JtAa9zwaFX3lLkymwgaMY04tlYvjj6jhf7mssyeqNTful0zir3TITljzWZnu3wm6cFwkXP u3AdZwtXUPJSxfiPvh9Xd3WxyvW2OSM= X-MC-Unique: 08rjyZCBN4ixG7bewZATCw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 39/67] ui/console: fold text_console_update_cursor_timer Date: Wed, 30 Aug 2023 13:38:13 +0400 Message-ID: <20230830093843.3531473-40-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388597262100025 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- ui/console.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ui/console.c b/ui/console.c index 04ec2d2488..c31368667d 100644 --- a/ui/console.c +++ b/ui/console.c @@ -174,7 +174,6 @@ static QEMUTimer *cursor_timer; =20 static void dpy_refresh(DisplayState *s); static DisplayState *get_alloc_displaystate(void); -static void text_console_update_cursor_timer(void); static void text_console_update_cursor(void *opaque); static bool displaychangelistener_has_dmabuf(DisplayChangeListener *dcl); static bool console_compatible_with(QemuConsole *con, @@ -2497,12 +2496,6 @@ static void vc_chr_set_echo(Chardev *chr, bool echo) drv->console->echo =3D echo; } =20 -static void text_console_update_cursor_timer(void) -{ - timer_mod(cursor_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - + CONSOLE_CURSOR_PERIOD / 2); -} - static void text_console_update_cursor(void *opaque) { QemuConsole *s; @@ -2520,7 +2513,8 @@ static void text_console_update_cursor(void *opaque) } =20 if (count) { - text_console_update_cursor_timer(); + timer_mod(cursor_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + + CONSOLE_CURSOR_PERIOD / 2); } } =20 --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388726; cv=none; d=zohomail.com; s=zohoarc; b=jJs0IN1eWnmdo1YzALZUnNWajvCIwOTXGO8p69atmi/QzaIFNd4s8NtM29H3iTbc9LE7qxLhHaaAnPnblN47Ucz8m9oqicvKOndZqT/4xb6iPNsg7YiinLlTE7Hw2DgH+wYt8ptOPfNBt+Agp9nl1ebUB2dXDMve8SonfrDnTCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388726; 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=Fjju3gR+TF3VzUQ77+/5nlp49TSlgQ3IisjTpRbw9JI=; b=A7+N9lUi7RB1xMTxsLKTFZhHNJgH850UWxwBz8BdLckn1IEvnWo0gQ+sRbS2tVncjKrpNt4VOxFDQ5GSCnL5l5w0VKN/srGkzLZWb86B/DDDyRM9mGRIfpuS4c+hDmIZcwIG2M+TyR8Bze0o9aOcHkBJA5otvmrhhLdNweG2x3U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388726152667.2471983151925; Wed, 30 Aug 2023 02:45:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHhc-0000oe-Ok; Wed, 30 Aug 2023 05:41:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhb-0000eb-80 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhY-0001VI-Ll for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:30 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-39-qKJymTkGPI-OG0e0rthQVg-1; Wed, 30 Aug 2023 05:41:26 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B5D5385CCE2 for ; Wed, 30 Aug 2023 09:41:25 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF108492C14; Wed, 30 Aug 2023 09:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388487; 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=Fjju3gR+TF3VzUQ77+/5nlp49TSlgQ3IisjTpRbw9JI=; b=CfrdtBH1b6aKqrcghpcz1JiJYBsOizaPvzWgp6Wy8knpWSNpr9MG5wV4S4rTK0oonbbB1k M/TbcMXHzkAchmmLygSviQ2wc2Lr9ZGvjKxe4rm/2ql5ceE3J+8NdugPMblBd6FePoPxbh GzsbnigNzzvH+GNg71IF58J3HORQIig= X-MC-Unique: qKJymTkGPI-OG0e0rthQVg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 40/67] ui/vc: skip text console resize when possible Date: Wed, 30 Aug 2023 13:38:14 +0400 Message-ID: <20230830093843.3531473-41-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388727924100001 From: Marc-Andr=C3=A9 Lureau This function is called on invalidate, on each cursor blink. Avoid the extra copy when the console size didn't change. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/console.c b/ui/console.c index c31368667d..6163f73640 100644 --- a/ui/console.c +++ b/ui/console.c @@ -413,13 +413,19 @@ static void text_console_resize(QemuTextConsole *t) { QemuConsole *s =3D QEMU_CONSOLE(t); TextCell *cells, *c, *c1; - int w1, x, y, last_width; + int w1, x, y, last_width, w, h; =20 assert(s->scanout.kind =3D=3D SCANOUT_SURFACE); =20 + w =3D surface_width(s->surface) / FONT_WIDTH; + h =3D surface_height(s->surface) / FONT_HEIGHT; + if (w =3D=3D t->width && h =3D=3D t->height) { + return; + } + last_width =3D t->width; - t->width =3D surface_width(s->surface) / FONT_WIDTH; - t->height =3D surface_height(s->surface) / FONT_HEIGHT; + t->width =3D w; + t->height =3D h; =20 w1 =3D last_width; if (t->width < w1) --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388509; cv=none; d=zohomail.com; s=zohoarc; b=Mwnm7TsQLw6IvOqZ6swM/mYYwILPuFEvpYADZXPwkqlkycL1OOBToccKTpCqF/IrJloXcm8saqB6FFtf0bOL9zgjxrfasCWYlO1bFVyBLbknv62M/fXHDlCvyMMmhvxZbbn/gB4tcJRKLs5XMnkVHMa4Al5bQgZZhka4YyStI4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388509; 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=MeAtBaeZvvoUx6k/kWXrNCl2tjDhYRUvHEfjBzceWgI=; b=Q6QvVyjUvtpvk1YhyXBl4R0evSuoItpbgcr3wyHxOrI5/9oar894Ths1sXOBqJjdBTVZjOh2nwAZoyanhSEyhPIE3Mu0XiHRgOYwlEub/tvDStg/2VmHx/06RtyPTPoGxmFeu72/O6rFHy7FzHYhcpP9KOXCHtNMx1OPnvoaQaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388509208833.3469040418676; Wed, 30 Aug 2023 02:41:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHhf-0001IG-TI; Wed, 30 Aug 2023 05:41:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhe-00010D-9Q for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhc-0001Vn-2T for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:33 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-316-EaR-I6CDNkKlbWk0Dr3Y7g-1; Wed, 30 Aug 2023 05:41:30 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B4B243813F3C for ; Wed, 30 Aug 2023 09:41:29 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 601EF40C6F4C; Wed, 30 Aug 2023 09:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388491; 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=MeAtBaeZvvoUx6k/kWXrNCl2tjDhYRUvHEfjBzceWgI=; b=HArWMRoTuOKkeAFQvHtChRFtJhTg3jkAmWIUduEY7UdoDUKVZ3k2CEdoXJBm5qYnUYf3eD koxDXKqmhacOfs7NFGLvz9DRWxUVD2ttpP6HrPL0OsPV1y3HwT0HvfTbsgMZJIm2AtOSbr H5CLNSy58cU9iCIUbvQIrw8+Lxs3V/0= X-MC-Unique: EaR-I6CDNkKlbWk0Dr3Y7g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 41/67] ui/console: minor stylistic changes Date: Wed, 30 Aug 2023 13:38:15 +0400 Message-ID: <20230830093843.3531473-42-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388510901100003 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ui/console.c b/ui/console.c index 6163f73640..c0b60284b2 100644 --- a/ui/console.c +++ b/ui/console.c @@ -427,20 +427,18 @@ static void text_console_resize(QemuTextConsole *t) t->width =3D w; t->height =3D h; =20 - w1 =3D last_width; - if (t->width < w1) - w1 =3D t->width; + w1 =3D MIN(t->width, last_width); =20 cells =3D g_new(TextCell, t->width * t->total_height + 1); - for(y =3D 0; y < t->total_height; y++) { + for (y =3D 0; y < t->total_height; y++) { c =3D &cells[y * t->width]; if (w1 > 0) { c1 =3D &t->cells[y * last_width]; - for(x =3D 0; x < w1; x++) { + for (x =3D 0; x < w1; x++) { *c++ =3D *c1++; } } - for(x =3D w1; x < t->width; x++) { + for (x =3D w1; x < t->width; x++) { c->ch =3D ' '; c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; c++; --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388558; cv=none; d=zohomail.com; s=zohoarc; b=Hgqzh+LYYERPie9reK0D0XbChJaseFcSb+RjQ8ZQ2fLH8HFLC+oRbKr8ZO7NmZorBFnTn6gX3CnVEa5Tkok2JTxR55UNwcJWH/fOOVfBH6qRHi11yrVxvsl3ZsLDxWh65oSbEMxV7VyozAIAgS4uXn4oAR/QSdVAaVZoOQbDFuQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388558; 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=jbZPdl4MmnEdz3jiVMYa04OYEqlEPn9Irk3oQRO3GDo=; b=MeDof13gYrLQXOqJfcmUHGC6i4iCrtGcIx4OTuuRdheUUPHbjV+fJpiIuAx7HENjLLZIWj4zhjoiFx3paKPQ3vTolaLO2LfRERiahqy9UNCIAbYODL1pmeQU+Yzzk4DnToNzREUPdaWhkXWzXeIT3q6dEQ4aYh1WP/NVpdsjnSI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388558567414.92387378852095; Wed, 30 Aug 2023 02:42:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHhj-0001xo-R2; Wed, 30 Aug 2023 05:41:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhi-0001q2-MW for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhg-0001WT-EH for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:38 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-645-JaUoprGFOFSNtI0wmSQbew-1; Wed, 30 Aug 2023 05:41:34 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0B89185CCE0 for ; Wed, 30 Aug 2023 09:41:34 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19B8E6466B; Wed, 30 Aug 2023 09:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388495; 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=jbZPdl4MmnEdz3jiVMYa04OYEqlEPn9Irk3oQRO3GDo=; b=D/aeaYKHMk2f4/t73KroS4jLGSqeiy/+21jLT4ngJMOcI5RcdWoW4ttnXUgTuSAVKeVQpj 9owsWIaPkl6StCGz3LqdF0nFnloBWwq06B3ZM45GlKdsiUzFFyuLm9nZxD8NiVulrtpFVO IKjbnW+VDEJ7iFRd043G2qM4HMtxb8k= X-MC-Unique: JaUoprGFOFSNtI0wmSQbew-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 42/67] ui/vc: move text console invalidate in helper Date: Wed, 30 Aug 2023 13:38:16 +0400 Message-ID: <20230830093843.3531473-43-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388558982100003 From: Marc-Andr=C3=A9 Lureau This will allow to split the VC code in a separate unit more easily. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- include/ui/console.h | 1 + ui/console.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 0f7f50deaf..91d8bbc9dc 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -521,6 +521,7 @@ void console_select(unsigned int index); void qemu_console_resize(QemuConsole *con, int width, int height); DisplaySurface *qemu_console_surface(QemuConsole *con); void coroutine_fn qemu_console_co_wait_update(QemuConsole *con); +int qemu_invalidate_text_consoles(void); =20 /* console-gl.c */ #ifdef CONFIG_OPENGL diff --git a/ui/console.c b/ui/console.c index c0b60284b2..7be2d4eef3 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2500,13 +2500,11 @@ static void vc_chr_set_echo(Chardev *chr, bool echo) drv->console->echo =3D echo; } =20 -static void text_console_update_cursor(void *opaque) +int qemu_invalidate_text_consoles(void) { QemuConsole *s; int count =3D 0; =20 - cursor_visible_phase =3D !cursor_visible_phase; - QTAILQ_FOREACH(s, &consoles, next) { if (qemu_console_is_graphic(s) || !qemu_console_is_visible(s)) { @@ -2516,7 +2514,14 @@ static void text_console_update_cursor(void *opaque) graphic_hw_invalidate(s); } =20 - if (count) { + return count; +} + +static void text_console_update_cursor(void *opaque) +{ + cursor_visible_phase =3D !cursor_visible_phase; + + if (qemu_invalidate_text_consoles()) { timer_mod(cursor_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + CONSOLE_CURSOR_PERIOD / 2); } --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388711; cv=none; d=zohomail.com; s=zohoarc; b=HHRHM5QV8kx2N9Cb9gfNcpWKWUw7RFmu3cnYLOIhiVF2nyXYQM0W50m5hgf2j1wWPy1NEmROdmrodU+Yd/lpXE9QfZA4/m1q+TWsG0jP1AkxgE75oF5lxC9w3sR4on8nvDlL6ZEhEj+46wa+ok58TME/RblaQRk8MnYdTJn3NEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388711; 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=i/q4fKSOhyZCL2FrkGOjnzDqZRW/4aoqTcGzWnJ3CVU=; b=bYEns6HwKcsTB/9EH2He4hD6HtNPMGJw1Ll0ItY/YbJ9vD/j40zh6zEdCotbPnrxm2ekedHv1O89szTbgncMd1mt+EDrbdSN4k95yEkJPL0Q3fWrzGOmQP1WcUIZfnJPJBs1aANDfqM73mR/njGjGru8Re+ZvipO5lRe+1TjZWg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388711826206.75281021149283; Wed, 30 Aug 2023 02:45:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHhx-0002p9-1y; Wed, 30 Aug 2023 05:41:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhn-0002aP-JW for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhl-0001XC-5m for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:43 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-65-X-Ec5l0FMOGD5fnpVoGWSg-1; Wed, 30 Aug 2023 05:41:38 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 53C2D8022E4 for ; Wed, 30 Aug 2023 09:41:38 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C249140E96E; Wed, 30 Aug 2023 09:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388500; 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=i/q4fKSOhyZCL2FrkGOjnzDqZRW/4aoqTcGzWnJ3CVU=; b=gnqoOm9wcHWlS3TA9Wq5FrwfCjy23WJKfhLFRWTHSc+Tnn7buRvnYBF8++uRxugM1MpX4g mPTwnuPX6G4wxa3rNa/g/CGYaUMFc0f8hd6s9q9joIGEWeDb+S9249dQTZo096vPki9L3J GrCG9bSviu5+bCNlrUE7vQUPLccmOPA= X-MC-Unique: X-Ec5l0FMOGD5fnpVoGWSg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Eric Blake , Markus Armbruster Subject: [PATCH 43/67] ui/vc: do not parse VC-specific options in Spice and GTK Date: Wed, 30 Aug 2023 13:38:17 +0400 Message-ID: <20230830093843.3531473-44-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388713880100001 From: Marc-Andr=C3=A9 Lureau In commit 6f974c843c ("gtk: overwrite the console.c char driver"), I shared the VC console parse handler with GTK. And later on in commit d8aec9d9 ("display: add -display spice-app launching a Spice client"), I also used it to handle spice-app VC. This is not necessary, the VC console options (width/height/cols/rows) are specific, and unused by tty-level GTK/Spice VC. This is not a breaking change, as those options are still being parsed by QAPI ChardevVC. Adjust the documentation about it. Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/char.json | 4 ++++ include/chardev/char.h | 3 --- ui/console.c | 4 ++-- ui/gtk.c | 1 - ui/spice-app.c | 7 ++++++- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/qapi/char.json b/qapi/char.json index 52aaff25eb..7e23fe3180 100644 --- a/qapi/char.json +++ b/qapi/char.json @@ -390,6 +390,10 @@ # # @rows: console height, in chars # +# Note: the options are only effective when using the built-in QEMU graphi= cal VC +# (with the SDL display). When the VC is handled by the display backend (w= ith +# GTK/VTE, Spice or D-Bus), they are simply ignored. +# # Since: 1.5 ## { 'struct': 'ChardevVC', diff --git a/include/chardev/char.h b/include/chardev/char.h index 44cd82e405..01df55f9e8 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -320,7 +320,4 @@ GSource *qemu_chr_timeout_add_ms(Chardev *chr, guint ms, void suspend_mux_open(void); void resume_mux_open(void); =20 -/* console.c */ -void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, Error **er= rp); - #endif diff --git a/ui/console.c b/ui/console.c index 7be2d4eef3..9fccecafd7 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2708,7 +2708,7 @@ void qemu_display_help(void) } } =20 -void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, Error **er= rp) +static void vc_chr_parse(QemuOpts *opts, ChardevBackend *backend, Error **= errp) { int val; ChardevVC *vc; @@ -2746,7 +2746,7 @@ static void char_vc_class_init(ObjectClass *oc, void = *data) { ChardevClass *cc =3D CHARDEV_CLASS(oc); =20 - cc->parse =3D qemu_chr_parse_vc; + cc->parse =3D vc_chr_parse; cc->open =3D vc_chr_open; cc->chr_write =3D vc_chr_write; cc->chr_accept_input =3D vc_chr_accept_input; diff --git a/ui/gtk.c b/ui/gtk.c index 8ba41c8f13..ef98bb0648 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1860,7 +1860,6 @@ static void char_gd_vc_class_init(ObjectClass *oc, vo= id *data) { ChardevClass *cc =3D CHARDEV_CLASS(oc); =20 - cc->parse =3D qemu_chr_parse_vc; cc->open =3D gd_vc_open; cc->chr_write =3D gd_vc_chr_write; cc->chr_accept_input =3D gd_vc_chr_accept_input; diff --git a/ui/spice-app.c b/ui/spice-app.c index ad7f0551ad..405fb7f9f5 100644 --- a/ui/spice-app.c +++ b/ui/spice-app.c @@ -96,6 +96,11 @@ static void vc_chr_set_echo(Chardev *chr, bool echo) /* TODO: set echo for frontends QMP and qtest */ } =20 +static void vc_chr_parse(QemuOpts *opts, ChardevBackend *backend, Error **= errp) +{ + /* fqdn is dealt with in vc_chr_open() */ +} + static void char_vc_class_init(ObjectClass *oc, void *data) { VCChardevClass *vc =3D CHARDEV_VC_CLASS(oc); @@ -103,7 +108,7 @@ static void char_vc_class_init(ObjectClass *oc, void *d= ata) =20 vc->parent_open =3D cc->open; =20 - cc->parse =3D qemu_chr_parse_vc; + cc->parse =3D vc_chr_parse; cc->open =3D vc_chr_open; cc->chr_set_echo =3D vc_chr_set_echo; } --=20 2.41.0 From nobody Tue May 14 20:26:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693389024; cv=none; d=zohomail.com; s=zohoarc; b=T7V39v/Wpekyb2MZfhltdSn+zepi92eoxBW/FD0Gl/kw4aqMRXH1pQLcIXJYprXrQQALNhSRiGy8EGnokgLSwxUUl70p9bdmNuLazW97/dvSs50j6TNz/4cS3lZbcEDppFTbkX/9P2ob0g4ECWEULXoX+tS6DCdaioEcZz/b88c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693389024; 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=GlhsUu8MLYDQ0zR+ycTEozW/BwEPc8R8qs1to4igIEA=; b=UBb/wVnG+0KSQ5fcb3l98V86wv25hLy0U2wx6MlffWTLt+vVtjPCFdF5iE4qz5sSycSVxFaLbDCWVxoDhAbVlruifPJp6UMEVvOuEvvKBDxDBY7+SqPgHgNT1SU03N4s/Ro5FFe2aBEjQO3o8iAP65INUx2ydodpj3da21JbV70= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693389024102209.97758957704502; Wed, 30 Aug 2023 02:50:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHia-0003dN-0H; Wed, 30 Aug 2023 05:42:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhv-0002p3-CD for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHht-0001Zf-3n for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:51 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-17-rAaGs8GHObKzn2ULBBBpzg-1; Wed, 30 Aug 2023 05:41:42 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 38F8C1C0758C for ; Wed, 30 Aug 2023 09:41:42 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CAB2140E96E; Wed, 30 Aug 2023 09:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388507; 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=GlhsUu8MLYDQ0zR+ycTEozW/BwEPc8R8qs1to4igIEA=; b=QubD7zajaFylSEZtw2bkSSqcOkoEOSsVpS9XtFZsdldyf2r2bSQXmHEmvp5uAUeOSE6JrO yXsWURdxOnDgJC5z+R00bZEo8UUqgvO8Aa2BSeG1HLakwWTKL7EGprQT7gP4m6fG9gdGXG TlRoepd3dbP08LAS+VWwsxoSgT0MX+o= X-MC-Unique: rAaGs8GHObKzn2ULBBBpzg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 44/67] ui/vc: change the argument for QemuTextConsole Date: Wed, 30 Aug 2023 13:38:18 +0400 Message-ID: <20230830093843.3531473-45-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693389024322100009 From: Marc-Andr=C3=A9 Lureau Those functions are specifc to text/vc console, make that explicit from the argument type. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/console.h | 6 +++--- ui/console.c | 14 ++++++-------- ui/gtk.c | 2 +- ui/sdl2-input.c | 5 +++-- ui/sdl2.c | 5 ++--- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 91d8bbc9dc..1ccd432b4d 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -112,9 +112,9 @@ bool qemu_mouse_set(int index, Error **errp); #define QEMU_KEY_CTRL_PAGEUP 0xe406 #define QEMU_KEY_CTRL_PAGEDOWN 0xe407 =20 -void kbd_put_keysym_console(QemuConsole *s, int keysym); -bool kbd_put_qcode_console(QemuConsole *s, int qcode, bool ctrl); -void kbd_put_string_console(QemuConsole *s, const char *str, int len); +void kbd_put_keysym_console(QemuTextConsole *s, int keysym); +bool kbd_put_qcode_console(QemuTextConsole *s, int qcode, bool ctrl); +void kbd_put_string_console(QemuTextConsole *s, const char *str, int len); void kbd_put_keysym(int keysym); =20 /* Touch devices */ diff --git a/ui/console.c b/ui/console.c index 9fccecafd7..a98adbb1b2 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1135,16 +1135,12 @@ static void kbd_send_chars(QemuTextConsole *s) } =20 /* called when an ascii key is pressed */ -void kbd_put_keysym_console(QemuConsole *con, int keysym) +void kbd_put_keysym_console(QemuTextConsole *s, int keysym) { - QemuTextConsole *s =3D (QemuTextConsole *)object_dynamic_cast(OBJECT(c= on), TYPE_QEMU_TEXT_CONSOLE); uint8_t buf[16], *q; int c; uint32_t num_free; =20 - if (!s) - return; - switch(keysym) { case QEMU_KEY_CTRL_UP: console_scroll(s, -1); @@ -1214,7 +1210,7 @@ static const int ctrl_qcode_to_keysym[Q_KEY_CODE__MAX= ] =3D { [Q_KEY_CODE_PGDN] =3D QEMU_KEY_CTRL_PAGEDOWN, }; =20 -bool kbd_put_qcode_console(QemuConsole *s, int qcode, bool ctrl) +bool kbd_put_qcode_console(QemuTextConsole *s, int qcode, bool ctrl) { int keysym; =20 @@ -1226,7 +1222,7 @@ bool kbd_put_qcode_console(QemuConsole *s, int qcode,= bool ctrl) return true; } =20 -void kbd_put_string_console(QemuConsole *s, const char *str, int len) +void kbd_put_string_console(QemuTextConsole *s, const char *str, int len) { int i; =20 @@ -1237,7 +1233,9 @@ void kbd_put_string_console(QemuConsole *s, const cha= r *str, int len) =20 void kbd_put_keysym(int keysym) { - kbd_put_keysym_console(active_console, keysym); + if (QEMU_IS_TEXT_CONSOLE(active_console)) { + kbd_put_keysym_console(QEMU_TEXT_CONSOLE(active_console), keysym); + } } =20 static void text_console_invalidate(void *opaque) diff --git a/ui/gtk.c b/ui/gtk.c index ef98bb0648..c34c133550 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1187,7 +1187,7 @@ static gboolean gd_text_key_down(GtkWidget *widget, GdkEventKey *key, void *opaque) { VirtualConsole *vc =3D opaque; - QemuConsole *con =3D vc->gfx.dcl.con; + QemuTextConsole *con =3D QEMU_TEXT_CONSOLE(vc->gfx.dcl.con); =20 if (key->keyval =3D=3D GDK_KEY_Delete) { kbd_put_qcode_console(con, Q_KEY_CODE_DELETE, false); diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c index f068382209..efc0e76e8c 100644 --- a/ui/sdl2-input.c +++ b/ui/sdl2-input.c @@ -44,14 +44,15 @@ void sdl2_process_key(struct sdl2_console *scon, qkbd_state_key_event(scon->kbd, qcode, ev->type =3D=3D SDL_KEYDOWN); =20 if (!qemu_console_is_graphic(con)) { + QemuTextConsole *s =3D QEMU_TEXT_CONSOLE(con); bool ctrl =3D qkbd_state_modifier_get(scon->kbd, QKBD_MOD_CTRL); if (ev->type =3D=3D SDL_KEYDOWN) { switch (qcode) { case Q_KEY_CODE_RET: - kbd_put_keysym_console(con, '\n'); + kbd_put_keysym_console(s, '\n'); break; default: - kbd_put_qcode_console(con, qcode, ctrl); + kbd_put_qcode_console(s, qcode, ctrl); break; } } diff --git a/ui/sdl2.c b/ui/sdl2.c index 0d91b555e3..16b515fcf9 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -483,10 +483,9 @@ static void handle_textinput(SDL_Event *ev) return; } =20 - if (qemu_console_is_graphic(con)) { - return; + if (QEMU_IS_TEXT_CONSOLE(con)) { + kbd_put_string_console(QEMU_TEXT_CONSOLE(con), ev->text.text, strl= en(ev->text.text)); } - kbd_put_string_console(con, ev->text.text, strlen(ev->text.text)); } =20 static void handle_mousemotion(SDL_Event *ev) --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388681; cv=none; d=zohomail.com; s=zohoarc; b=dQUItYPktpKX7SeGsN7Ioib3qtPEUbOwwRIgS9zDbHg+3P337p0r9gtaoKEaBEmQB0XWhE816HqYFRDtPOsUsgoflSO5kSSjJpaDoDR2E2MzVOP+N4k4Gg8tlYYFDEamkboCbGlvBTXlC2tSOiQZOaMDewMX4torvbKHSrmac/w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388681; 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=FvWBz8ymIlcEXvsKjmGH/T9Wzir9baPJ0Nx1p0n7/5k=; b=GBtPWvzasoD8Co5NNvXo/oOoYA7XIHaP0uSUlvO07yD1WWA1s0u5XG4qvPARxnWiNk9anOOWDbxYlVYjVllFaxLDq6SaXw+nxER6qUOvn+FPxcm4DpExeZiFop73RykESuUCGF//49DHKdL2hrU9k88pcgdtYnHWqXZfCu+ZCiU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388681941994.3882650378697; Wed, 30 Aug 2023 02:44:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHiF-0003Bs-Cr; Wed, 30 Aug 2023 05:42:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhx-0002tv-UJ for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhv-0001a1-H3 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:53 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-245-NTi3Ma0zPvGpcZjetUrSAw-1; Wed, 30 Aug 2023 05:41:46 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0FBBF1C075AB; Wed, 30 Aug 2023 09:41:46 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7E4E6B2AF; Wed, 30 Aug 2023 09:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388510; 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=FvWBz8ymIlcEXvsKjmGH/T9Wzir9baPJ0Nx1p0n7/5k=; b=Xp6BBGfe9zYRvtYcrgrpjTvxYHzi3zDq5zbBYOl9uzjHr/yCQ4fRjQz85GV3/jD1iZAiEs Mbij283ROInG2ikC9/1X3p6YU9Mx6rdyBeFZRNRcoDTUG0sv+rKZ3+ty0OstjjAG5x/Xf+ SxUi5j0cciZmTfCiFVirzYbMS/dUGmc= X-MC-Unique: NTi3Ma0zPvGpcZjetUrSAw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Akihiko Odaki Subject: [PATCH 45/67] ui/vc: remove kby_put_keysym() and update function calls Date: Wed, 30 Aug 2023 13:38:19 +0400 Message-ID: <20230830093843.3531473-46-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388684042100007 From: Marc-Andr=C3=A9 Lureau The function calls to `kbd_put_keysym` have been updated to now call `kbd_put_keysym_console` with a NULL console parameter. Like most console functions, NULL argument is now for the active console. This will allow to rename the text console functions in a consistent manner. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki --- include/ui/console.h | 1 - ui/console.c | 14 ++++++------ ui/curses.c | 2 +- ui/vnc.c | 54 ++++++++++++++++++++++---------------------- ui/cocoa.m | 2 +- 5 files changed, 36 insertions(+), 37 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 1ccd432b4d..9c362f0e87 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -115,7 +115,6 @@ bool qemu_mouse_set(int index, Error **errp); void kbd_put_keysym_console(QemuTextConsole *s, int keysym); bool kbd_put_qcode_console(QemuTextConsole *s, int qcode, bool ctrl); void kbd_put_string_console(QemuTextConsole *s, const char *str, int len); -void kbd_put_keysym(int keysym); =20 /* Touch devices */ typedef struct touch_slot { diff --git a/ui/console.c b/ui/console.c index a98adbb1b2..6068e02928 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1141,6 +1141,13 @@ void kbd_put_keysym_console(QemuTextConsole *s, int = keysym) int c; uint32_t num_free; =20 + if (!s) { + if (!QEMU_IS_TEXT_CONSOLE(active_console)) { + return; + } + s =3D QEMU_TEXT_CONSOLE(active_console); + } + switch(keysym) { case QEMU_KEY_CTRL_UP: console_scroll(s, -1); @@ -1231,13 +1238,6 @@ void kbd_put_string_console(QemuTextConsole *s, cons= t char *str, int len) } } =20 -void kbd_put_keysym(int keysym) -{ - if (QEMU_IS_TEXT_CONSOLE(active_console)) { - kbd_put_keysym_console(QEMU_TEXT_CONSOLE(active_console), keysym); - } -} - static void text_console_invalidate(void *opaque) { QemuTextConsole *s =3D QEMU_TEXT_CONSOLE(opaque); diff --git a/ui/curses.c b/ui/curses.c index de962faa7c..4ddbbae7cd 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -400,7 +400,7 @@ static void curses_refresh(DisplayChangeListener *dcl) if (keysym =3D=3D -1) keysym =3D chr; =20 - kbd_put_keysym(keysym); + kbd_put_keysym_console(NULL, keysym); } } } diff --git a/ui/vnc.c b/ui/vnc.c index 92964dcc0c..1fa4456744 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1945,88 +1945,88 @@ static void do_key_event(VncState *vs, int down, in= t keycode, int sym) case 0xb8: /* Right ALT */ break; case 0xc8: - kbd_put_keysym(QEMU_KEY_UP); + kbd_put_keysym_console(NULL, QEMU_KEY_UP); break; case 0xd0: - kbd_put_keysym(QEMU_KEY_DOWN); + kbd_put_keysym_console(NULL, QEMU_KEY_DOWN); break; case 0xcb: - kbd_put_keysym(QEMU_KEY_LEFT); + kbd_put_keysym_console(NULL, QEMU_KEY_LEFT); break; case 0xcd: - kbd_put_keysym(QEMU_KEY_RIGHT); + kbd_put_keysym_console(NULL, QEMU_KEY_RIGHT); break; case 0xd3: - kbd_put_keysym(QEMU_KEY_DELETE); + kbd_put_keysym_console(NULL, QEMU_KEY_DELETE); break; case 0xc7: - kbd_put_keysym(QEMU_KEY_HOME); + kbd_put_keysym_console(NULL, QEMU_KEY_HOME); break; case 0xcf: - kbd_put_keysym(QEMU_KEY_END); + kbd_put_keysym_console(NULL, QEMU_KEY_END); break; case 0xc9: - kbd_put_keysym(QEMU_KEY_PAGEUP); + kbd_put_keysym_console(NULL, QEMU_KEY_PAGEUP); break; case 0xd1: - kbd_put_keysym(QEMU_KEY_PAGEDOWN); + kbd_put_keysym_console(NULL, QEMU_KEY_PAGEDOWN); break; =20 case 0x47: - kbd_put_keysym(numlock ? '7' : QEMU_KEY_HOME); + kbd_put_keysym_console(NULL, numlock ? '7' : QEMU_KEY_HOME= ); break; case 0x48: - kbd_put_keysym(numlock ? '8' : QEMU_KEY_UP); + kbd_put_keysym_console(NULL, numlock ? '8' : QEMU_KEY_UP); break; case 0x49: - kbd_put_keysym(numlock ? '9' : QEMU_KEY_PAGEUP); + kbd_put_keysym_console(NULL, numlock ? '9' : QEMU_KEY_PAGE= UP); break; case 0x4b: - kbd_put_keysym(numlock ? '4' : QEMU_KEY_LEFT); + kbd_put_keysym_console(NULL, numlock ? '4' : QEMU_KEY_LEFT= ); break; case 0x4c: - kbd_put_keysym('5'); + kbd_put_keysym_console(NULL, '5'); break; case 0x4d: - kbd_put_keysym(numlock ? '6' : QEMU_KEY_RIGHT); + kbd_put_keysym_console(NULL, numlock ? '6' : QEMU_KEY_RIGH= T); break; case 0x4f: - kbd_put_keysym(numlock ? '1' : QEMU_KEY_END); + kbd_put_keysym_console(NULL, numlock ? '1' : QEMU_KEY_END); break; case 0x50: - kbd_put_keysym(numlock ? '2' : QEMU_KEY_DOWN); + kbd_put_keysym_console(NULL, numlock ? '2' : QEMU_KEY_DOWN= ); break; case 0x51: - kbd_put_keysym(numlock ? '3' : QEMU_KEY_PAGEDOWN); + kbd_put_keysym_console(NULL, numlock ? '3' : QEMU_KEY_PAGE= DOWN); break; case 0x52: - kbd_put_keysym('0'); + kbd_put_keysym_console(NULL, '0'); break; case 0x53: - kbd_put_keysym(numlock ? '.' : QEMU_KEY_DELETE); + kbd_put_keysym_console(NULL, numlock ? '.' : QEMU_KEY_DELE= TE); break; =20 case 0xb5: - kbd_put_keysym('/'); + kbd_put_keysym_console(NULL, '/'); break; case 0x37: - kbd_put_keysym('*'); + kbd_put_keysym_console(NULL, '*'); break; case 0x4a: - kbd_put_keysym('-'); + kbd_put_keysym_console(NULL, '-'); break; case 0x4e: - kbd_put_keysym('+'); + kbd_put_keysym_console(NULL, '+'); break; case 0x9c: - kbd_put_keysym('\n'); + kbd_put_keysym_console(NULL, '\n'); break; =20 default: if (control) { - kbd_put_keysym(sym & 0x1f); + kbd_put_keysym_console(NULL, sym & 0x1f); } else { - kbd_put_keysym(sym); + kbd_put_keysym_console(NULL, sym); } break; } diff --git a/ui/cocoa.m b/ui/cocoa.m index 0c2153d17c..9eb4da7713 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -784,7 +784,7 @@ - (void) handleMonitorInput:(NSEvent *)event } =20 if (keysym) { - kbd_put_keysym(keysym); + kbd_put_keysym_console(NULL, keysym); } } =20 --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388684; cv=none; d=zohomail.com; s=zohoarc; b=LPQDz65UI4g0Q4/U2D2786C1pDyN7klMVUzaRolW1YOlUehHGiiJzquASwajuEizrGKYkdI298gC72WBIXsvnVDk/TyXC4pPzuRo0iZQSivZMzxAJLeuRaNmvVbraO/kdVL3ih4ejjAFLfzbORi21o1xliIt4Cjom+3g5AvsMl0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388684; 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=PMuhCYiXXvTYykBMjB0zeYuuuwzA5lt5GT18QI3YAPE=; b=NXfTGUBvS2xjq6Mww/ctDIcXkYvBgkXVpPFT2u/0D3FBhyUGg67YyDFFXfnuwm9z4aL8GEeRn64jhZU8d9kVFOZHVPdEy5eANl0k/IYMsko2PqworbYrL8t4SZhqdeSFtyXDTU6bEUuhN45jJIyFXOMr31kZPiizYaDvjVbEP8A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388684639688.8629773589423; Wed, 30 Aug 2023 02:44:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHiL-0003I3-2O; Wed, 30 Aug 2023 05:42:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHi0-00031F-Ng for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHhy-0001aH-6s for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:56 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-586-ztkdM9lPMjuJACj9_j8xbQ-1; Wed, 30 Aug 2023 05:41:50 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EEA1585CCE1; Wed, 30 Aug 2023 09:41:49 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3701492C13; Wed, 30 Aug 2023 09:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388513; 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=PMuhCYiXXvTYykBMjB0zeYuuuwzA5lt5GT18QI3YAPE=; b=Ohmn4w3RK84VXCrUPGGlOY6CyiGc7xbfikvv2eY05LEc4xTZPyHvrTHtGfrG7hSZ6xUzOR 10jE5U3r4rI9Tioj2IlTCVNbqTseM/Da9Hkvx+c/vJlVFxYK/VDYdQmvZ5XwDhj4RiuYdy j1JZWIAAaLc9LpGRSj/v+zbA/J3G6lo= X-MC-Unique: ztkdM9lPMjuJACj9_j8xbQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Akihiko Odaki Subject: [PATCH 46/67] =?UTF-8?q?ui/vc:=20rename=20kbd=5Fput=20=E2=86=92?= =?UTF-8?q?=20qemu=5Ftext=5Fconsole=20functions?= Date: Wed, 30 Aug 2023 13:38:20 +0400 Message-ID: <20230830093843.3531473-47-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388686030100015 From: Marc-Andr=C3=A9 Lureau They are QemuTextConsole functions, let's make it clear. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- include/ui/console.h | 6 ++--- ui/console.c | 10 ++++---- ui/curses.c | 2 +- ui/gtk.c | 6 ++--- ui/sdl2-input.c | 4 ++-- ui/sdl2.c | 2 +- ui/vnc.c | 54 ++++++++++++++++++++++---------------------- ui/cocoa.m | 2 +- 8 files changed, 43 insertions(+), 43 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 9c362f0e87..26d63d17a2 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -112,9 +112,9 @@ bool qemu_mouse_set(int index, Error **errp); #define QEMU_KEY_CTRL_PAGEUP 0xe406 #define QEMU_KEY_CTRL_PAGEDOWN 0xe407 =20 -void kbd_put_keysym_console(QemuTextConsole *s, int keysym); -bool kbd_put_qcode_console(QemuTextConsole *s, int qcode, bool ctrl); -void kbd_put_string_console(QemuTextConsole *s, const char *str, int len); +void qemu_text_console_put_keysym(QemuTextConsole *s, int keysym); +bool qemu_text_console_put_qcode(QemuTextConsole *s, int qcode, bool ctrl); +void qemu_text_console_put_string(QemuTextConsole *s, const char *str, int= len); =20 /* Touch devices */ typedef struct touch_slot { diff --git a/ui/console.c b/ui/console.c index 6068e02928..b8ffad30d3 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1135,7 +1135,7 @@ static void kbd_send_chars(QemuTextConsole *s) } =20 /* called when an ascii key is pressed */ -void kbd_put_keysym_console(QemuTextConsole *s, int keysym) +void qemu_text_console_put_keysym(QemuTextConsole *s, int keysym) { uint8_t buf[16], *q; int c; @@ -1217,7 +1217,7 @@ static const int ctrl_qcode_to_keysym[Q_KEY_CODE__MAX= ] =3D { [Q_KEY_CODE_PGDN] =3D QEMU_KEY_CTRL_PAGEDOWN, }; =20 -bool kbd_put_qcode_console(QemuTextConsole *s, int qcode, bool ctrl) +bool qemu_text_console_put_qcode(QemuTextConsole *s, int qcode, bool ctrl) { int keysym; =20 @@ -1225,16 +1225,16 @@ bool kbd_put_qcode_console(QemuTextConsole *s, int = qcode, bool ctrl) if (keysym =3D=3D 0) { return false; } - kbd_put_keysym_console(s, keysym); + qemu_text_console_put_keysym(s, keysym); return true; } =20 -void kbd_put_string_console(QemuTextConsole *s, const char *str, int len) +void qemu_text_console_put_string(QemuTextConsole *s, const char *str, int= len) { int i; =20 for (i =3D 0; i < len && str[i]; i++) { - kbd_put_keysym_console(s, str[i]); + qemu_text_console_put_keysym(s, str[i]); } } =20 diff --git a/ui/curses.c b/ui/curses.c index 4ddbbae7cd..8bde8c5cf7 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -400,7 +400,7 @@ static void curses_refresh(DisplayChangeListener *dcl) if (keysym =3D=3D -1) keysym =3D chr; =20 - kbd_put_keysym_console(NULL, keysym); + qemu_text_console_put_keysym(NULL, keysym); } } } diff --git a/ui/gtk.c b/ui/gtk.c index c34c133550..fab6d6581d 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1190,12 +1190,12 @@ static gboolean gd_text_key_down(GtkWidget *widget, QemuTextConsole *con =3D QEMU_TEXT_CONSOLE(vc->gfx.dcl.con); =20 if (key->keyval =3D=3D GDK_KEY_Delete) { - kbd_put_qcode_console(con, Q_KEY_CODE_DELETE, false); + qemu_text_console_put_qcode(con, Q_KEY_CODE_DELETE, false); } else if (key->length) { - kbd_put_string_console(con, key->string, key->length); + qemu_text_console_put_string(con, key->string, key->length); } else { int qcode =3D gd_map_keycode(gd_get_keycode(key)); - kbd_put_qcode_console(con, qcode, false); + qemu_text_console_put_qcode(con, qcode, false); } return TRUE; } diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c index efc0e76e8c..d4a25b6573 100644 --- a/ui/sdl2-input.c +++ b/ui/sdl2-input.c @@ -49,10 +49,10 @@ void sdl2_process_key(struct sdl2_console *scon, if (ev->type =3D=3D SDL_KEYDOWN) { switch (qcode) { case Q_KEY_CODE_RET: - kbd_put_keysym_console(s, '\n'); + qemu_text_console_put_keysym(s, '\n'); break; default: - kbd_put_qcode_console(s, qcode, ctrl); + qemu_text_console_put_qcode(s, qcode, ctrl); break; } } diff --git a/ui/sdl2.c b/ui/sdl2.c index 16b515fcf9..ed21045172 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -484,7 +484,7 @@ static void handle_textinput(SDL_Event *ev) } =20 if (QEMU_IS_TEXT_CONSOLE(con)) { - kbd_put_string_console(QEMU_TEXT_CONSOLE(con), ev->text.text, strl= en(ev->text.text)); + qemu_text_console_put_string(QEMU_TEXT_CONSOLE(con), ev->text.text= , strlen(ev->text.text)); } } =20 diff --git a/ui/vnc.c b/ui/vnc.c index 1fa4456744..22894b7b1f 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1945,88 +1945,88 @@ static void do_key_event(VncState *vs, int down, in= t keycode, int sym) case 0xb8: /* Right ALT */ break; case 0xc8: - kbd_put_keysym_console(NULL, QEMU_KEY_UP); + qemu_text_console_put_keysym(NULL, QEMU_KEY_UP); break; case 0xd0: - kbd_put_keysym_console(NULL, QEMU_KEY_DOWN); + qemu_text_console_put_keysym(NULL, QEMU_KEY_DOWN); break; case 0xcb: - kbd_put_keysym_console(NULL, QEMU_KEY_LEFT); + qemu_text_console_put_keysym(NULL, QEMU_KEY_LEFT); break; case 0xcd: - kbd_put_keysym_console(NULL, QEMU_KEY_RIGHT); + qemu_text_console_put_keysym(NULL, QEMU_KEY_RIGHT); break; case 0xd3: - kbd_put_keysym_console(NULL, QEMU_KEY_DELETE); + qemu_text_console_put_keysym(NULL, QEMU_KEY_DELETE); break; case 0xc7: - kbd_put_keysym_console(NULL, QEMU_KEY_HOME); + qemu_text_console_put_keysym(NULL, QEMU_KEY_HOME); break; case 0xcf: - kbd_put_keysym_console(NULL, QEMU_KEY_END); + qemu_text_console_put_keysym(NULL, QEMU_KEY_END); break; case 0xc9: - kbd_put_keysym_console(NULL, QEMU_KEY_PAGEUP); + qemu_text_console_put_keysym(NULL, QEMU_KEY_PAGEUP); break; case 0xd1: - kbd_put_keysym_console(NULL, QEMU_KEY_PAGEDOWN); + qemu_text_console_put_keysym(NULL, QEMU_KEY_PAGEDOWN); break; =20 case 0x47: - kbd_put_keysym_console(NULL, numlock ? '7' : QEMU_KEY_HOME= ); + qemu_text_console_put_keysym(NULL, numlock ? '7' : QEMU_KE= Y_HOME); break; case 0x48: - kbd_put_keysym_console(NULL, numlock ? '8' : QEMU_KEY_UP); + qemu_text_console_put_keysym(NULL, numlock ? '8' : QEMU_KE= Y_UP); break; case 0x49: - kbd_put_keysym_console(NULL, numlock ? '9' : QEMU_KEY_PAGE= UP); + qemu_text_console_put_keysym(NULL, numlock ? '9' : QEMU_KE= Y_PAGEUP); break; case 0x4b: - kbd_put_keysym_console(NULL, numlock ? '4' : QEMU_KEY_LEFT= ); + qemu_text_console_put_keysym(NULL, numlock ? '4' : QEMU_KE= Y_LEFT); break; case 0x4c: - kbd_put_keysym_console(NULL, '5'); + qemu_text_console_put_keysym(NULL, '5'); break; case 0x4d: - kbd_put_keysym_console(NULL, numlock ? '6' : QEMU_KEY_RIGH= T); + qemu_text_console_put_keysym(NULL, numlock ? '6' : QEMU_KE= Y_RIGHT); break; case 0x4f: - kbd_put_keysym_console(NULL, numlock ? '1' : QEMU_KEY_END); + qemu_text_console_put_keysym(NULL, numlock ? '1' : QEMU_KE= Y_END); break; case 0x50: - kbd_put_keysym_console(NULL, numlock ? '2' : QEMU_KEY_DOWN= ); + qemu_text_console_put_keysym(NULL, numlock ? '2' : QEMU_KE= Y_DOWN); break; case 0x51: - kbd_put_keysym_console(NULL, numlock ? '3' : QEMU_KEY_PAGE= DOWN); + qemu_text_console_put_keysym(NULL, numlock ? '3' : QEMU_KE= Y_PAGEDOWN); break; case 0x52: - kbd_put_keysym_console(NULL, '0'); + qemu_text_console_put_keysym(NULL, '0'); break; case 0x53: - kbd_put_keysym_console(NULL, numlock ? '.' : QEMU_KEY_DELE= TE); + qemu_text_console_put_keysym(NULL, numlock ? '.' : QEMU_KE= Y_DELETE); break; =20 case 0xb5: - kbd_put_keysym_console(NULL, '/'); + qemu_text_console_put_keysym(NULL, '/'); break; case 0x37: - kbd_put_keysym_console(NULL, '*'); + qemu_text_console_put_keysym(NULL, '*'); break; case 0x4a: - kbd_put_keysym_console(NULL, '-'); + qemu_text_console_put_keysym(NULL, '-'); break; case 0x4e: - kbd_put_keysym_console(NULL, '+'); + qemu_text_console_put_keysym(NULL, '+'); break; case 0x9c: - kbd_put_keysym_console(NULL, '\n'); + qemu_text_console_put_keysym(NULL, '\n'); break; =20 default: if (control) { - kbd_put_keysym_console(NULL, sym & 0x1f); + qemu_text_console_put_keysym(NULL, sym & 0x1f); } else { - kbd_put_keysym_console(NULL, sym); + qemu_text_console_put_keysym(NULL, sym); } break; } diff --git a/ui/cocoa.m b/ui/cocoa.m index 9eb4da7713..8b97319587 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -784,7 +784,7 @@ - (void) handleMonitorInput:(NSEvent *)event } =20 if (keysym) { - kbd_put_keysym_console(NULL, keysym); + qemu_text_console_keysym(NULL, keysym); } } =20 --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388777; cv=none; d=zohomail.com; s=zohoarc; b=EwLn0QDSZRZKqyVkhggsBHT4o5JGQij6hO9tAWL6xT2apCmFK1lS7E5oFfHcEesocW8k8CLUSK6OYnhLhuet9o08Mbm7LCeG1wLlX6nY/OHH+6BeDqbpna5xotQNnFhn5hJCuNJWSTQxq3//bX3NtVyRYlbxRkjpWz4Q1YtAf/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388777; 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=dKrVBMfCgWFranMMsANCSZJNFwUSMYb8NFZAxknsgR0=; b=LdLtn0wZ4J1qunILXCHY7SzSdGsIoh7QciYjpgtE/axvGPLMc4/lv0E3ZxczPRaNfX7/tm0/F985HAhBbgLBe6KhNtd5+mAnuv4qwmbah9Dnh0Gk9R6JFwASZepb0FErhfGsXpcdHBrP5Atf65y1Ljo9z5NFB8AWNhBwU30iQ/0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388777222854.3043880305175; Wed, 30 Aug 2023 02:46:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHib-0003oz-CM; Wed, 30 Aug 2023 05:42:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiE-0003HA-47 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHi0-0001aO-8r for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:41:58 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-479-BmxKKk-5Py2QzmX23J4Bkg-1; Wed, 30 Aug 2023 05:41:54 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D15BA8022E4 for ; Wed, 30 Aug 2023 09:41:53 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id E10DA6466B; Wed, 30 Aug 2023 09:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388515; 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=dKrVBMfCgWFranMMsANCSZJNFwUSMYb8NFZAxknsgR0=; b=G632nS+bY3cg5Wgb0nfyVm6mmi13ZOnXM8jOsLhHdlIxQYqF9duib2lQpSY2BAdkklgP9j poMRpq93jzqXnItl++SjPVTCf8YafqvJcP2S4fq60B1hrUyut4CgXH44tvGe59KSJM+/ge tzY18sidYUlrPIFiv4HVHR5MVOJKR9A= X-MC-Unique: BmxKKk-5Py2QzmX23J4Bkg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 47/67] ui/console: remove redundant format field Date: Wed, 30 Aug 2023 13:38:21 +0400 Message-ID: <20230830093843.3531473-48-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388778225100001 From: Marc-Andr=C3=A9 Lureau It's already part of PIXMAN image. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- include/ui/console.h | 15 +++++++-------- ui/console-gl.c | 2 +- ui/console.c | 4 +--- ui/gtk.c | 2 +- ui/spice-display.c | 2 +- ui/vnc.c | 2 +- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 26d63d17a2..93bb03a9e2 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -152,7 +152,6 @@ typedef struct ScanoutTexture { } ScanoutTexture; =20 typedef struct DisplaySurface { - pixman_format_code_t format; pixman_image_t *image; uint8_t flags; #ifdef CONFIG_OPENGL @@ -436,23 +435,23 @@ static inline int surface_height(DisplaySurface *s) return pixman_image_get_height(s->image); } =20 +static inline pixman_format_code_t surface_format(DisplaySurface *s) +{ + return pixman_image_get_format(s->image); +} + static inline int surface_bits_per_pixel(DisplaySurface *s) { - int bits =3D PIXMAN_FORMAT_BPP(s->format); + int bits =3D PIXMAN_FORMAT_BPP(surface_format(s)); return bits; } =20 static inline int surface_bytes_per_pixel(DisplaySurface *s) { - int bits =3D PIXMAN_FORMAT_BPP(s->format); + int bits =3D PIXMAN_FORMAT_BPP(surface_format(s)); return DIV_ROUND_UP(bits, 8); } =20 -static inline pixman_format_code_t surface_format(DisplaySurface *s) -{ - return s->format; -} - typedef uint32_t console_ch_t; =20 static inline void console_write_ch(console_ch_t *dest, uint32_t ch) diff --git a/ui/console-gl.c b/ui/console-gl.c index 8e3c9a3c8c..103b954017 100644 --- a/ui/console-gl.c +++ b/ui/console-gl.c @@ -53,7 +53,7 @@ void surface_gl_create_texture(QemuGLShader *gls, return; } =20 - switch (surface->format) { + switch (surface_format(surface)) { case PIXMAN_BE_b8g8r8x8: case PIXMAN_BE_b8g8r8a8: surface->glformat =3D GL_BGRA_EXT; diff --git a/ui/console.c b/ui/console.c index b8ffad30d3..f7bc27f596 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1493,8 +1493,7 @@ DisplaySurface *qemu_create_displaysurface_from(int w= idth, int height, DisplaySurface *surface =3D g_new0(DisplaySurface, 1); =20 trace_displaysurface_create_from(surface, width, height, format); - surface->format =3D format; - surface->image =3D pixman_image_create_bits(surface->format, + surface->image =3D pixman_image_create_bits(format, width, height, (void *)data, linesize); assert(surface->image !=3D NULL); @@ -1511,7 +1510,6 @@ DisplaySurface *qemu_create_displaysurface_pixman(pix= man_image_t *image) DisplaySurface *surface =3D g_new0(DisplaySurface, 1); =20 trace_displaysurface_create_pixman(surface); - surface->format =3D pixman_image_get_format(image); surface->image =3D pixman_image_ref(image); =20 return surface; diff --git a/ui/gtk.c b/ui/gtk.c index fab6d6581d..7b9e005bf8 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -514,7 +514,7 @@ static void gd_switch(DisplayChangeListener *dcl, } vc->gfx.ds =3D surface; =20 - if (surface->format =3D=3D PIXMAN_x8r8g8b8) { + if (surface_format(surface) =3D=3D PIXMAN_x8r8g8b8) { /* * PIXMAN_x8r8g8b8 =3D=3D CAIRO_FORMAT_RGB24 * diff --git a/ui/spice-display.c b/ui/spice-display.c index 3f3f8013d8..d977ab139d 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -436,7 +436,7 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, } if (ssd->ds) { ssd->surface =3D pixman_image_ref(ssd->ds->image); - ssd->mirror =3D qemu_pixman_mirror_create(ssd->ds->format, + ssd->mirror =3D qemu_pixman_mirror_create(surface_format(ssd->ds), ssd->ds->image); qemu_spice_create_host_primary(ssd); } diff --git a/ui/vnc.c b/ui/vnc.c index 22894b7b1f..6fd86996a5 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -833,7 +833,7 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl, /* guest surface */ qemu_pixman_image_unref(vd->guest.fb); vd->guest.fb =3D pixman_image_ref(surface->image); - vd->guest.format =3D surface->format; + vd->guest.format =3D surface_format(surface); =20 =20 if (pageflip) { --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388964; cv=none; d=zohomail.com; s=zohoarc; b=KcgTF0BeCVAsTnWGNUTljnrIUmmZIVVpxgKorfQqCeqls/TICXYzbpHmVSd1d2yKiOIl1d4zJa3J0IfB01XdiDUyhhaa/fk2rzD67axNa7B8liexEMVWknKBmf6vlFE5wqb0Ko6DVXAekciuSM9JBi5fhrww0YRKWwaDCXkWShU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388964; 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=u0n3cYiLlbTRydon3bLKBopMnuRSzBrD2Oc1gfFzsuE=; b=bqSN2djYtWpBKiptpK24C9n/mNV0EjuqNdp+6mTJF20znP6kxkJAuXDwvGc0GOJSVS8BHtDv8yPReRRLc+nM3rjQBs4cWUrxoR/Wre/Wa/XqM0sTk4+LSBiwHuuIJYLmd64A/XavsrKUTte+Qiv7f4BiwtLRiYs15ID4Svwoq5A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388964824921.60563461088; Wed, 30 Aug 2023 02:49:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHig-00047c-HX; Wed, 30 Aug 2023 05:42:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiG-0003Jm-6c for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiB-0001ad-DT for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:11 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-618-Z-b3d4HPPU6ncuUI1Sd8pg-1; Wed, 30 Aug 2023 05:41:58 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4CD59185A791 for ; Wed, 30 Aug 2023 09:41:58 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3929D401E63; Wed, 30 Aug 2023 09:41:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388520; 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=u0n3cYiLlbTRydon3bLKBopMnuRSzBrD2Oc1gfFzsuE=; b=OrqZGH1Tr1gSFwfmQnHrRzB+hYeu+vv0zf0DwFn0TqGJGjO6AdzfdSyirM6f5nY9ExHg9T /2qOTasg9js2lZxLK68pxSo1E/Xr3o78cVPHLzmm5CZXXxevnP7KLHtWsyKsl96B8ibeTt OfsbyLAUc4o3y/bsyuKsvr3T29ifI3c= X-MC-Unique: Z-b3d4HPPU6ncuUI1Sd8pg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 48/67] ui/vc: preliminary QemuTextConsole changes before split Date: Wed, 30 Aug 2023 13:38:22 +0400 Message-ID: <20230830093843.3531473-49-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388965211100001 From: Marc-Andr=C3=A9 Lureau Those changes will help to split console.c unit in the following commit. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 52 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/ui/console.c b/ui/console.c index f7bc27f596..c2c1f22979 100644 --- a/ui/console.c +++ b/ui/console.c @@ -174,7 +174,7 @@ static QEMUTimer *cursor_timer; =20 static void dpy_refresh(DisplayState *s); static DisplayState *get_alloc_displaystate(void); -static void text_console_update_cursor(void *opaque); +static void qemu_text_console_update_cursor(void *opaque); static bool displaychangelistener_has_dmabuf(DisplayChangeListener *dcl); static bool console_compatible_with(QemuConsole *con, DisplayChangeListener *dcl, Error **er= rp); @@ -1065,6 +1065,13 @@ static void displaychangelistener_display_console(Di= splayChangeListener *dcl, } } =20 +static void +qemu_text_console_select(QemuTextConsole *c) +{ + dpy_text_resize(QEMU_CONSOLE(c), c->width, c->height); + qemu_text_console_update_cursor(NULL); +} + void console_select(unsigned int index) { DisplayChangeListener *dcl; @@ -1084,8 +1091,7 @@ void console_select(unsigned int index) } =20 if (QEMU_IS_TEXT_CONSOLE(s)) { - dpy_text_resize(s, QEMU_TEXT_CONSOLE(s)->width, QEMU_TEXT_CONS= OLE(s)->height); - text_console_update_cursor(NULL); + qemu_text_console_select(QEMU_TEXT_CONSOLE(s)); } } } @@ -1135,19 +1141,12 @@ static void kbd_send_chars(QemuTextConsole *s) } =20 /* called when an ascii key is pressed */ -void qemu_text_console_put_keysym(QemuTextConsole *s, int keysym) +static void qemu_text_console_handle_keysym(QemuTextConsole *s, int keysym) { uint8_t buf[16], *q; int c; uint32_t num_free; =20 - if (!s) { - if (!QEMU_IS_TEXT_CONSOLE(active_console)) { - return; - } - s =3D QEMU_TEXT_CONSOLE(active_console); - } - switch(keysym) { case QEMU_KEY_CTRL_UP: console_scroll(s, -1); @@ -1192,6 +1191,18 @@ void qemu_text_console_put_keysym(QemuTextConsole *s= , int keysym) } } =20 +void qemu_text_console_put_keysym(QemuTextConsole *s, int keysym) +{ + if (!s) { + if (!QEMU_IS_TEXT_CONSOLE(active_console)) { + return; + } + s =3D QEMU_TEXT_CONSOLE(active_console); + } + + qemu_text_console_handle_keysym(s, keysym); +} + static const int qcode_to_keysym[Q_KEY_CODE__MAX] =3D { [Q_KEY_CODE_UP] =3D QEMU_KEY_UP, [Q_KEY_CODE_DOWN] =3D QEMU_KEY_DOWN, @@ -1395,7 +1406,7 @@ qemu_text_console_class_init(ObjectClass *oc, void *d= ata) { if (!cursor_timer) { cursor_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, - text_console_update_cursor, NULL); + qemu_text_console_update_cursor, NULL); } } =20 @@ -1701,7 +1712,7 @@ void register_displaychangelistener(DisplayChangeList= ener *dcl) if (QEMU_IS_GRAPHIC_CONSOLE(con)) { dcl_set_graphic_cursor(dcl, QEMU_GRAPHIC_CONSOLE(con)); } - text_console_update_cursor(NULL); + qemu_text_console_update_cursor(NULL); } =20 void update_displaychangelistener(DisplayChangeListener *dcl, @@ -2388,6 +2399,13 @@ bool qemu_console_is_multihead(DeviceState *dev) return false; } =20 + +static const char * +qemu_text_console_get_label(QemuTextConsole *c) +{ + return c->chr ? c->chr->label : NULL; +} + char *qemu_console_get_label(QemuConsole *con) { if (QEMU_IS_GRAPHIC_CONSOLE(con)) { @@ -2411,9 +2429,9 @@ char *qemu_console_get_label(QemuConsole *con) } return g_strdup("VGA"); } else if (QEMU_IS_TEXT_CONSOLE(con)) { - QemuTextConsole *c =3D QEMU_TEXT_CONSOLE(con); - if (c->chr && c->chr->label) { - return g_strdup(c->chr->label); + const char *label =3D qemu_text_console_get_label(QEMU_TEXT_CONSOL= E(con)); + if (label) { + return g_strdup(label); } } =20 @@ -2513,7 +2531,7 @@ int qemu_invalidate_text_consoles(void) return count; } =20 -static void text_console_update_cursor(void *opaque) +static void qemu_text_console_update_cursor(void *opaque) { cursor_visible_phase =3D !cursor_visible_phase; =20 --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388778; cv=none; d=zohomail.com; s=zohoarc; b=RUM74d7NwzZdl7xelVsO2rKfQPjGtsAfn0RX6YzkVfZ+bx7MIWfP38bIWFWS0HJN4bLtWPgPl67G0LnAY1KuMddAMGcXIchEdE1TetvOgD4gD88pvW1Ds6OKuvrIQGC/ZnlEXL9Rei53AeL2MjE3G5b3dAWpaHcY0ztcYvIVJ2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388778; 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=aVOlm4sfmuvF2Uco7bSQtWnuyoS1vRtCOi/gM5auzXc=; b=Ks648B3r9rRVWkZKAK8UbVkcSsywsc4f3ypLoUBOVNiXst9Jj4ZI8GgZG3b6bqSRsNK5eZi9iIIlF2k8/neci2s6ziK4JR3togYUiMZkfaw8o8bvakfN9z+dACDYIhNN1Jc/SYWNONQBHul1AJsAqdo26jiODqLaqVs/pUkPssY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388778306243.54442023111778; Wed, 30 Aug 2023 02:46:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHiv-0004pq-GT; Wed, 30 Aug 2023 05:42:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiO-0003SU-Jg for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiD-0001bN-S0 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:14 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-679-SrEVMWX-OQmmbyEJTdjReQ-1; Wed, 30 Aug 2023 05:42:03 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2FE4F800CAB for ; Wed, 30 Aug 2023 09:42:03 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0D936B2AD; Wed, 30 Aug 2023 09:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388525; 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=aVOlm4sfmuvF2Uco7bSQtWnuyoS1vRtCOi/gM5auzXc=; b=NeoR60b1udH67wTaN0NhvYUi68R3kESlC0CjJivDDmoc32GTczIk8eOpVoCX6sTWGeUkui R3MOomASxMWGO04OGo7qzR8tFqOQ0otmQ91zXdEQ/yBv5W65bPqeOyf6J4JIoNPxNjlEZF mjlf416DSrXQPvkMOKMZw8ShbanCXnk= X-MC-Unique: SrEVMWX-OQmmbyEJTdjReQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 49/67] ui/vc: split off the VC part from console.c Date: Wed, 30 Aug 2023 13:38:23 +0400 Message-ID: <20230830093843.3531473-50-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388780310100017 From: Marc-Andr=C3=A9 Lureau Move common declarations to console-priv.h, and add a new unit console-vc.c which will handle VC/chardev rendering, when pixman is available. (if necessary, the move could be done chunk by chunks) Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/console-priv.h | 43 ++ ui/console-vc.c | 1079 ++++++++++++++++++++++++++++++++++++++++++++ ui/console.c | 1096 +-------------------------------------------- ui/meson.build | 1 + 4 files changed, 1126 insertions(+), 1093 deletions(-) create mode 100644 ui/console-priv.h create mode 100644 ui/console-vc.c diff --git a/ui/console-priv.h b/ui/console-priv.h new file mode 100644 index 0000000000..88569ed2cc --- /dev/null +++ b/ui/console-priv.h @@ -0,0 +1,43 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * QEMU UI Console + */ +#ifndef CONSOLE_PRIV_H +#define CONSOLE_PRIV_H + +#include "ui/console.h" +#include "qemu/coroutine.h" +#include "qemu/timer.h" + +#include "vgafont.h" + +#define FONT_HEIGHT 16 +#define FONT_WIDTH 8 + +struct QemuConsole { + Object parent; + + int index; + DisplayState *ds; + DisplaySurface *surface; + DisplayScanout scanout; + int dcls; + DisplayGLCtx *gl; + int gl_block; + QEMUTimer *gl_unblock_timer; + int window_id; + QemuUIInfo ui_info; + QEMUTimer *ui_timer; + const GraphicHwOps *hw_ops; + void *hw; + CoQueue dump_queue; + + QTAILQ_ENTRY(QemuConsole) next; +}; + +void qemu_text_console_select(QemuTextConsole *c); +const char * qemu_text_console_get_label(QemuTextConsole *c); +void qemu_text_console_update_cursor(void); +void qemu_text_console_handle_keysym(QemuTextConsole *s, int keysym); + +#endif diff --git a/ui/console-vc.c b/ui/console-vc.c new file mode 100644 index 0000000000..656f099556 --- /dev/null +++ b/ui/console-vc.c @@ -0,0 +1,1079 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * QEMU VC + */ +#include "qemu/osdep.h" + +#include "chardev/char.h" +#include "qapi/error.h" +#include "qemu/fifo8.h" +#include "qemu/option.h" +#include "ui/console.h" + +#include "trace.h" +#include "console-priv.h" + +#define DEFAULT_BACKSCROLL 512 +#define CONSOLE_CURSOR_PERIOD 500 + +typedef struct TextAttributes { + uint8_t fgcol:4; + uint8_t bgcol:4; + uint8_t bold:1; + uint8_t uline:1; + uint8_t blink:1; + uint8_t invers:1; + uint8_t unvisible:1; +} TextAttributes; + +#define TEXT_ATTRIBUTES_DEFAULT ((TextAttributes) { \ + .fgcol =3D QEMU_COLOR_WHITE, \ + .bgcol =3D QEMU_COLOR_BLACK \ +}) + +typedef struct TextCell { + uint8_t ch; + TextAttributes t_attrib; +} TextCell; + +#define MAX_ESC_PARAMS 3 + +enum TTYState { + TTY_STATE_NORM, + TTY_STATE_ESC, + TTY_STATE_CSI, +}; + +typedef struct QemuTextConsole { + QemuConsole parent; + + int width; + int height; + int total_height; + int backscroll_height; + int x, y; + int y_displayed; + int y_base; + TextCell *cells; + int text_x[2], text_y[2], cursor_invalidate; + int echo; + + int update_x0; + int update_y0; + int update_x1; + int update_y1; + + Chardev *chr; + /* fifo for key pressed */ + Fifo8 out_fifo; +} QemuTextConsole; + +typedef QemuConsoleClass QemuTextConsoleClass; + +OBJECT_DEFINE_TYPE(QemuTextConsole, qemu_text_console, QEMU_TEXT_CONSOLE, = QEMU_CONSOLE) + +typedef struct QemuFixedTextConsole { + QemuTextConsole parent; +} QemuFixedTextConsole; + +typedef QemuTextConsoleClass QemuFixedTextConsoleClass; + +OBJECT_DEFINE_TYPE(QemuFixedTextConsole, qemu_fixed_text_console, QEMU_FIX= ED_TEXT_CONSOLE, QEMU_TEXT_CONSOLE) + +struct VCChardev { + Chardev parent; + QemuTextConsole *console; + + enum TTYState state; + int esc_params[MAX_ESC_PARAMS]; + int nb_esc_params; + TextAttributes t_attrib; /* currently active text attributes */ + int x_saved, y_saved; +}; +typedef struct VCChardev VCChardev; + +static const pixman_color_t color_table_rgb[2][8] =3D { + { /* dark */ + [QEMU_COLOR_BLACK] =3D QEMU_PIXMAN_COLOR_BLACK, + [QEMU_COLOR_BLUE] =3D QEMU_PIXMAN_COLOR(0x00, 0x00, 0xaa), /* = blue */ + [QEMU_COLOR_GREEN] =3D QEMU_PIXMAN_COLOR(0x00, 0xaa, 0x00), /* = green */ + [QEMU_COLOR_CYAN] =3D QEMU_PIXMAN_COLOR(0x00, 0xaa, 0xaa), /* = cyan */ + [QEMU_COLOR_RED] =3D QEMU_PIXMAN_COLOR(0xaa, 0x00, 0x00), /* = red */ + [QEMU_COLOR_MAGENTA] =3D QEMU_PIXMAN_COLOR(0xaa, 0x00, 0xaa), /* = magenta */ + [QEMU_COLOR_YELLOW] =3D QEMU_PIXMAN_COLOR(0xaa, 0xaa, 0x00), /* = yellow */ + [QEMU_COLOR_WHITE] =3D QEMU_PIXMAN_COLOR_GRAY, + }, + { /* bright */ + [QEMU_COLOR_BLACK] =3D QEMU_PIXMAN_COLOR_BLACK, + [QEMU_COLOR_BLUE] =3D QEMU_PIXMAN_COLOR(0x00, 0x00, 0xff), /* = blue */ + [QEMU_COLOR_GREEN] =3D QEMU_PIXMAN_COLOR(0x00, 0xff, 0x00), /* = green */ + [QEMU_COLOR_CYAN] =3D QEMU_PIXMAN_COLOR(0x00, 0xff, 0xff), /* = cyan */ + [QEMU_COLOR_RED] =3D QEMU_PIXMAN_COLOR(0xff, 0x00, 0x00), /* = red */ + [QEMU_COLOR_MAGENTA] =3D QEMU_PIXMAN_COLOR(0xff, 0x00, 0xff), /* = magenta */ + [QEMU_COLOR_YELLOW] =3D QEMU_PIXMAN_COLOR(0xff, 0xff, 0x00), /* = yellow */ + [QEMU_COLOR_WHITE] =3D QEMU_PIXMAN_COLOR(0xff, 0xff, 0xff), /* = white */ + } +}; + +static bool cursor_visible_phase; +static QEMUTimer *cursor_timer; + +const char * +qemu_text_console_get_label(QemuTextConsole *c) +{ + return c->chr ? c->chr->label : NULL; +} + +static void qemu_console_fill_rect(QemuConsole *con, int posx, int posy, + int width, int height, pixman_color_t c= olor) +{ + DisplaySurface *surface =3D qemu_console_surface(con); + pixman_rectangle16_t rect =3D { + .x =3D posx, .y =3D posy, .width =3D width, .height =3D height + }; + + assert(surface); + pixman_image_fill_rectangles(PIXMAN_OP_SRC, surface->image, + &color, 1, &rect); +} + +/* copy from (xs, ys) to (xd, yd) a rectangle of size (w, h) */ +static void qemu_console_bitblt(QemuConsole *con, + int xs, int ys, int xd, int yd, int w, int= h) +{ + DisplaySurface *surface =3D qemu_console_surface(con); + + assert(surface); + pixman_image_composite(PIXMAN_OP_SRC, + surface->image, NULL, surface->image, + xs, ys, 0, 0, xd, yd, w, h); +} + +static void vga_putcharxy(QemuConsole *s, int x, int y, int ch, + TextAttributes *t_attrib) +{ + static pixman_image_t *glyphs[256]; + DisplaySurface *surface =3D qemu_console_surface(s); + pixman_color_t fgcol, bgcol; + + assert(surface); + if (t_attrib->invers) { + bgcol =3D color_table_rgb[t_attrib->bold][t_attrib->fgcol]; + fgcol =3D color_table_rgb[t_attrib->bold][t_attrib->bgcol]; + } else { + fgcol =3D color_table_rgb[t_attrib->bold][t_attrib->fgcol]; + bgcol =3D color_table_rgb[t_attrib->bold][t_attrib->bgcol]; + } + + if (!glyphs[ch]) { + glyphs[ch] =3D qemu_pixman_glyph_from_vgafont(FONT_HEIGHT, vgafont= 16, ch); + } + qemu_pixman_glyph_render(glyphs[ch], surface->image, + &fgcol, &bgcol, x, y, FONT_WIDTH, FONT_HEIGHT= ); +} + +static void invalidate_xy(QemuTextConsole *s, int x, int y) +{ + if (!qemu_console_is_visible(QEMU_CONSOLE(s))) { + return; + } + if (s->update_x0 > x * FONT_WIDTH) + s->update_x0 =3D x * FONT_WIDTH; + if (s->update_y0 > y * FONT_HEIGHT) + s->update_y0 =3D y * FONT_HEIGHT; + if (s->update_x1 < (x + 1) * FONT_WIDTH) + s->update_x1 =3D (x + 1) * FONT_WIDTH; + if (s->update_y1 < (y + 1) * FONT_HEIGHT) + s->update_y1 =3D (y + 1) * FONT_HEIGHT; +} + +static void console_show_cursor(QemuTextConsole *s, int show) +{ + TextCell *c; + int y, y1; + int x =3D s->x; + + s->cursor_invalidate =3D 1; + + if (x >=3D s->width) { + x =3D s->width - 1; + } + y1 =3D (s->y_base + s->y) % s->total_height; + y =3D y1 - s->y_displayed; + if (y < 0) { + y +=3D s->total_height; + } + if (y < s->height) { + c =3D &s->cells[y1 * s->width + x]; + if (show && cursor_visible_phase) { + TextAttributes t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; + t_attrib.invers =3D !(t_attrib.invers); /* invert fg and bg */ + vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, &t_attrib); + } else { + vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, &(c->t_attrib)); + } + invalidate_xy(s, x, y); + } +} + +static void console_refresh(QemuTextConsole *s) +{ + DisplaySurface *surface =3D qemu_console_surface(QEMU_CONSOLE(s)); + TextCell *c; + int x, y, y1; + + assert(surface); + s->text_x[0] =3D 0; + s->text_y[0] =3D 0; + s->text_x[1] =3D s->width - 1; + s->text_y[1] =3D s->height - 1; + s->cursor_invalidate =3D 1; + + qemu_console_fill_rect(QEMU_CONSOLE(s), 0, 0, surface_width(surface), = surface_height(surface), + color_table_rgb[0][QEMU_COLOR_BLACK]); + y1 =3D s->y_displayed; + for (y =3D 0; y < s->height; y++) { + c =3D s->cells + y1 * s->width; + for (x =3D 0; x < s->width; x++) { + vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, + &(c->t_attrib)); + c++; + } + if (++y1 =3D=3D s->total_height) { + y1 =3D 0; + } + } + console_show_cursor(s, 1); + dpy_gfx_update(QEMU_CONSOLE(s), 0, 0, + surface_width(surface), surface_height(surface)); +} + +static void console_scroll(QemuTextConsole *s, int ydelta) +{ + int i, y1; + + if (ydelta > 0) { + for(i =3D 0; i < ydelta; i++) { + if (s->y_displayed =3D=3D s->y_base) + break; + if (++s->y_displayed =3D=3D s->total_height) + s->y_displayed =3D 0; + } + } else { + ydelta =3D -ydelta; + i =3D s->backscroll_height; + if (i > s->total_height - s->height) + i =3D s->total_height - s->height; + y1 =3D s->y_base - i; + if (y1 < 0) + y1 +=3D s->total_height; + for(i =3D 0; i < ydelta; i++) { + if (s->y_displayed =3D=3D y1) + break; + if (--s->y_displayed < 0) + s->y_displayed =3D s->total_height - 1; + } + } + console_refresh(s); +} + +static void kbd_send_chars(QemuTextConsole *s) +{ + uint32_t len, avail; + + len =3D qemu_chr_be_can_write(s->chr); + avail =3D fifo8_num_used(&s->out_fifo); + while (len > 0 && avail > 0) { + const uint8_t *buf; + uint32_t size; + + buf =3D fifo8_pop_buf(&s->out_fifo, MIN(len, avail), &size); + qemu_chr_be_write(s->chr, buf, size); + len =3D qemu_chr_be_can_write(s->chr); + avail -=3D size; + } +} + +/* called when an ascii key is pressed */ +void qemu_text_console_handle_keysym(QemuTextConsole *s, int keysym) +{ + uint8_t buf[16], *q; + int c; + uint32_t num_free; + + switch(keysym) { + case QEMU_KEY_CTRL_UP: + console_scroll(s, -1); + break; + case QEMU_KEY_CTRL_DOWN: + console_scroll(s, 1); + break; + case QEMU_KEY_CTRL_PAGEUP: + console_scroll(s, -10); + break; + case QEMU_KEY_CTRL_PAGEDOWN: + console_scroll(s, 10); + break; + default: + /* convert the QEMU keysym to VT100 key string */ + q =3D buf; + if (keysym >=3D 0xe100 && keysym <=3D 0xe11f) { + *q++ =3D '\033'; + *q++ =3D '['; + c =3D keysym - 0xe100; + if (c >=3D 10) + *q++ =3D '0' + (c / 10); + *q++ =3D '0' + (c % 10); + *q++ =3D '~'; + } else if (keysym >=3D 0xe120 && keysym <=3D 0xe17f) { + *q++ =3D '\033'; + *q++ =3D '['; + *q++ =3D keysym & 0xff; + } else if (s->echo && (keysym =3D=3D '\r' || keysym =3D=3D '\n')) { + qemu_chr_write(s->chr, (uint8_t *)"\r", 1, true); + *q++ =3D '\n'; + } else { + *q++ =3D keysym; + } + if (s->echo) { + qemu_chr_write(s->chr, buf, q - buf, true); + } + num_free =3D fifo8_num_free(&s->out_fifo); + fifo8_push_all(&s->out_fifo, buf, MIN(num_free, q - buf)); + kbd_send_chars(s); + break; + } +} + +static void text_console_update(void *opaque, console_ch_t *chardata) +{ + QemuTextConsole *s =3D QEMU_TEXT_CONSOLE(opaque); + int i, j, src; + + if (s->text_x[0] <=3D s->text_x[1]) { + src =3D (s->y_base + s->text_y[0]) * s->width; + chardata +=3D s->text_y[0] * s->width; + for (i =3D s->text_y[0]; i <=3D s->text_y[1]; i ++) + for (j =3D 0; j < s->width; j++, src++) { + console_write_ch(chardata ++, + ATTR2CHTYPE(s->cells[src].ch, + s->cells[src].t_attrib.fgcol, + s->cells[src].t_attrib.bgcol, + s->cells[src].t_attrib.bold)); + } + dpy_text_update(QEMU_CONSOLE(s), s->text_x[0], s->text_y[0], + s->text_x[1] - s->text_x[0], i - s->text_y[0]); + s->text_x[0] =3D s->width; + s->text_y[0] =3D s->height; + s->text_x[1] =3D 0; + s->text_y[1] =3D 0; + } + if (s->cursor_invalidate) { + dpy_text_cursor(QEMU_CONSOLE(s), s->x, s->y); + s->cursor_invalidate =3D 0; + } +} + +static void text_console_resize(QemuTextConsole *t) +{ + QemuConsole *s =3D QEMU_CONSOLE(t); + TextCell *cells, *c, *c1; + int w1, x, y, last_width, w, h; + + assert(s->scanout.kind =3D=3D SCANOUT_SURFACE); + + w =3D surface_width(s->surface) / FONT_WIDTH; + h =3D surface_height(s->surface) / FONT_HEIGHT; + if (w =3D=3D t->width && h =3D=3D t->height) { + return; + } + + last_width =3D t->width; + t->width =3D w; + t->height =3D h; + + w1 =3D MIN(t->width, last_width); + + cells =3D g_new(TextCell, t->width * t->total_height + 1); + for (y =3D 0; y < t->total_height; y++) { + c =3D &cells[y * t->width]; + if (w1 > 0) { + c1 =3D &t->cells[y * last_width]; + for (x =3D 0; x < w1; x++) { + *c++ =3D *c1++; + } + } + for (x =3D w1; x < t->width; x++) { + c->ch =3D ' '; + c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; + c++; + } + } + g_free(t->cells); + t->cells =3D cells; +} + +static void vc_put_lf(VCChardev *vc) +{ + QemuTextConsole *s =3D vc->console; + TextCell *c; + int x, y1; + + s->y++; + if (s->y >=3D s->height) { + s->y =3D s->height - 1; + + if (s->y_displayed =3D=3D s->y_base) { + if (++s->y_displayed =3D=3D s->total_height) + s->y_displayed =3D 0; + } + if (++s->y_base =3D=3D s->total_height) + s->y_base =3D 0; + if (s->backscroll_height < s->total_height) + s->backscroll_height++; + y1 =3D (s->y_base + s->height - 1) % s->total_height; + c =3D &s->cells[y1 * s->width]; + for(x =3D 0; x < s->width; x++) { + c->ch =3D ' '; + c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; + c++; + } + if (s->y_displayed =3D=3D s->y_base) { + s->text_x[0] =3D 0; + s->text_y[0] =3D 0; + s->text_x[1] =3D s->width - 1; + s->text_y[1] =3D s->height - 1; + + qemu_console_bitblt(QEMU_CONSOLE(s), 0, FONT_HEIGHT, 0, 0, + s->width * FONT_WIDTH, + (s->height - 1) * FONT_HEIGHT); + qemu_console_fill_rect(QEMU_CONSOLE(s), 0, (s->height - 1) * F= ONT_HEIGHT, + s->width * FONT_WIDTH, FONT_HEIGHT, + color_table_rgb[0][TEXT_ATTRIBUTES_DEFA= ULT.bgcol]); + s->update_x0 =3D 0; + s->update_y0 =3D 0; + s->update_x1 =3D s->width * FONT_WIDTH; + s->update_y1 =3D s->height * FONT_HEIGHT; + } + } +} + +/* Set console attributes depending on the current escape codes. + * NOTE: I know this code is not very efficient (checking every color for = it + * self) but it is more readable and better maintainable. + */ +static void vc_handle_escape(VCChardev *vc) +{ + int i; + + for (i =3D 0; i < vc->nb_esc_params; i++) { + switch (vc->esc_params[i]) { + case 0: /* reset all console attributes to default */ + vc->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; + break; + case 1: + vc->t_attrib.bold =3D 1; + break; + case 4: + vc->t_attrib.uline =3D 1; + break; + case 5: + vc->t_attrib.blink =3D 1; + break; + case 7: + vc->t_attrib.invers =3D 1; + break; + case 8: + vc->t_attrib.unvisible =3D 1; + break; + case 22: + vc->t_attrib.bold =3D 0; + break; + case 24: + vc->t_attrib.uline =3D 0; + break; + case 25: + vc->t_attrib.blink =3D 0; + break; + case 27: + vc->t_attrib.invers =3D 0; + break; + case 28: + vc->t_attrib.unvisible =3D 0; + break; + /* set foreground color */ + case 30: + vc->t_attrib.fgcol =3D QEMU_COLOR_BLACK; + break; + case 31: + vc->t_attrib.fgcol =3D QEMU_COLOR_RED; + break; + case 32: + vc->t_attrib.fgcol =3D QEMU_COLOR_GREEN; + break; + case 33: + vc->t_attrib.fgcol =3D QEMU_COLOR_YELLOW; + break; + case 34: + vc->t_attrib.fgcol =3D QEMU_COLOR_BLUE; + break; + case 35: + vc->t_attrib.fgcol =3D QEMU_COLOR_MAGENTA; + break; + case 36: + vc->t_attrib.fgcol =3D QEMU_COLOR_CYAN; + break; + case 37: + vc->t_attrib.fgcol =3D QEMU_COLOR_WHITE; + break; + /* set background color */ + case 40: + vc->t_attrib.bgcol =3D QEMU_COLOR_BLACK; + break; + case 41: + vc->t_attrib.bgcol =3D QEMU_COLOR_RED; + break; + case 42: + vc->t_attrib.bgcol =3D QEMU_COLOR_GREEN; + break; + case 43: + vc->t_attrib.bgcol =3D QEMU_COLOR_YELLOW; + break; + case 44: + vc->t_attrib.bgcol =3D QEMU_COLOR_BLUE; + break; + case 45: + vc->t_attrib.bgcol =3D QEMU_COLOR_MAGENTA; + break; + case 46: + vc->t_attrib.bgcol =3D QEMU_COLOR_CYAN; + break; + case 47: + vc->t_attrib.bgcol =3D QEMU_COLOR_WHITE; + break; + } + } +} + +static void vc_update_xy(VCChardev *vc, int x, int y) +{ + QemuTextConsole *s =3D vc->console; + TextCell *c; + int y1, y2; + + s->text_x[0] =3D MIN(s->text_x[0], x); + s->text_x[1] =3D MAX(s->text_x[1], x); + s->text_y[0] =3D MIN(s->text_y[0], y); + s->text_y[1] =3D MAX(s->text_y[1], y); + + y1 =3D (s->y_base + y) % s->total_height; + y2 =3D y1 - s->y_displayed; + if (y2 < 0) { + y2 +=3D s->total_height; + } + if (y2 < s->height) { + if (x >=3D s->width) { + x =3D s->width - 1; + } + c =3D &s->cells[y1 * s->width + x]; + vga_putcharxy(QEMU_CONSOLE(s), x, y2, c->ch, + &(c->t_attrib)); + invalidate_xy(s, x, y2); + } +} + +static void vc_clear_xy(VCChardev *vc, int x, int y) +{ + QemuTextConsole *s =3D vc->console; + int y1 =3D (s->y_base + y) % s->total_height; + if (x >=3D s->width) { + x =3D s->width - 1; + } + TextCell *c =3D &s->cells[y1 * s->width + x]; + c->ch =3D ' '; + c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; + vc_update_xy(vc, x, y); +} + +static void vc_put_one(VCChardev *vc, int ch) +{ + QemuTextConsole *s =3D vc->console; + TextCell *c; + int y1; + if (s->x >=3D s->width) { + /* line wrap */ + s->x =3D 0; + vc_put_lf(vc); + } + y1 =3D (s->y_base + s->y) % s->total_height; + c =3D &s->cells[y1 * s->width + s->x]; + c->ch =3D ch; + c->t_attrib =3D vc->t_attrib; + vc_update_xy(vc, s->x, s->y); + s->x++; +} + +static void vc_respond_str(VCChardev *vc, const char *buf) +{ + while (*buf) { + vc_put_one(vc, *buf); + buf++; + } +} + +/* set cursor, checking bounds */ +static void vc_set_cursor(VCChardev *vc, int x, int y) +{ + QemuTextConsole *s =3D vc->console; + + if (x < 0) { + x =3D 0; + } + if (y < 0) { + y =3D 0; + } + if (y >=3D s->height) { + y =3D s->height - 1; + } + if (x >=3D s->width) { + x =3D s->width - 1; + } + + s->x =3D x; + s->y =3D y; +} + +static void vc_putchar(VCChardev *vc, int ch) +{ + QemuTextConsole *s =3D vc->console; + int i; + int x, y; + char response[40]; + + switch(vc->state) { + case TTY_STATE_NORM: + switch(ch) { + case '\r': /* carriage return */ + s->x =3D 0; + break; + case '\n': /* newline */ + vc_put_lf(vc); + break; + case '\b': /* backspace */ + if (s->x > 0) + s->x--; + break; + case '\t': /* tabspace */ + if (s->x + (8 - (s->x % 8)) > s->width) { + s->x =3D 0; + vc_put_lf(vc); + } else { + s->x =3D s->x + (8 - (s->x % 8)); + } + break; + case '\a': /* alert aka. bell */ + /* TODO: has to be implemented */ + break; + case 14: + /* SI (shift in), character set 0 (ignored) */ + break; + case 15: + /* SO (shift out), character set 1 (ignored) */ + break; + case 27: /* esc (introducing an escape sequence) */ + vc->state =3D TTY_STATE_ESC; + break; + default: + vc_put_one(vc, ch); + break; + } + break; + case TTY_STATE_ESC: /* check if it is a terminal escape sequence */ + if (ch =3D=3D '[') { + for(i=3D0;iesc_params[i] =3D 0; + vc->nb_esc_params =3D 0; + vc->state =3D TTY_STATE_CSI; + } else { + vc->state =3D TTY_STATE_NORM; + } + break; + case TTY_STATE_CSI: /* handle escape sequence parameters */ + if (ch >=3D '0' && ch <=3D '9') { + if (vc->nb_esc_params < MAX_ESC_PARAMS) { + int *param =3D &vc->esc_params[vc->nb_esc_params]; + int digit =3D (ch - '0'); + + *param =3D (*param <=3D (INT_MAX - digit) / 10) ? + *param * 10 + digit : INT_MAX; + } + } else { + if (vc->nb_esc_params < MAX_ESC_PARAMS) + vc->nb_esc_params++; + if (ch =3D=3D ';' || ch =3D=3D '?') { + break; + } + trace_console_putchar_csi(vc->esc_params[0], vc->esc_params[1], + ch, vc->nb_esc_params); + vc->state =3D TTY_STATE_NORM; + switch(ch) { + case 'A': + /* move cursor up */ + if (vc->esc_params[0] =3D=3D 0) { + vc->esc_params[0] =3D 1; + } + vc_set_cursor(vc, s->x, s->y - vc->esc_params[0]); + break; + case 'B': + /* move cursor down */ + if (vc->esc_params[0] =3D=3D 0) { + vc->esc_params[0] =3D 1; + } + vc_set_cursor(vc, s->x, s->y + vc->esc_params[0]); + break; + case 'C': + /* move cursor right */ + if (vc->esc_params[0] =3D=3D 0) { + vc->esc_params[0] =3D 1; + } + vc_set_cursor(vc, s->x + vc->esc_params[0], s->y); + break; + case 'D': + /* move cursor left */ + if (vc->esc_params[0] =3D=3D 0) { + vc->esc_params[0] =3D 1; + } + vc_set_cursor(vc, s->x - vc->esc_params[0], s->y); + break; + case 'G': + /* move cursor to column */ + vc_set_cursor(vc, vc->esc_params[0] - 1, s->y); + break; + case 'f': + case 'H': + /* move cursor to row, column */ + vc_set_cursor(vc, vc->esc_params[1] - 1, vc->esc_params[0]= - 1); + break; + case 'J': + switch (vc->esc_params[0]) { + case 0: + /* clear to end of screen */ + for (y =3D s->y; y < s->height; y++) { + for (x =3D 0; x < s->width; x++) { + if (y =3D=3D s->y && x < s->x) { + continue; + } + vc_clear_xy(vc, x, y); + } + } + break; + case 1: + /* clear from beginning of screen */ + for (y =3D 0; y <=3D s->y; y++) { + for (x =3D 0; x < s->width; x++) { + if (y =3D=3D s->y && x > s->x) { + break; + } + vc_clear_xy(vc, x, y); + } + } + break; + case 2: + /* clear entire screen */ + for (y =3D 0; y <=3D s->height; y++) { + for (x =3D 0; x < s->width; x++) { + vc_clear_xy(vc, x, y); + } + } + break; + } + break; + case 'K': + switch (vc->esc_params[0]) { + case 0: + /* clear to eol */ + for(x =3D s->x; x < s->width; x++) { + vc_clear_xy(vc, x, s->y); + } + break; + case 1: + /* clear from beginning of line */ + for (x =3D 0; x <=3D s->x && x < s->width; x++) { + vc_clear_xy(vc, x, s->y); + } + break; + case 2: + /* clear entire line */ + for(x =3D 0; x < s->width; x++) { + vc_clear_xy(vc, x, s->y); + } + break; + } + break; + case 'm': + vc_handle_escape(vc); + break; + case 'n': + switch (vc->esc_params[0]) { + case 5: + /* report console status (always succeed)*/ + vc_respond_str(vc, "\033[0n"); + break; + case 6: + /* report cursor position */ + sprintf(response, "\033[%d;%dR", + (s->y_base + s->y) % s->total_height + 1, + s->x + 1); + vc_respond_str(vc, response); + break; + } + break; + case 's': + /* save cursor position */ + vc->x_saved =3D s->x; + vc->y_saved =3D s->y; + break; + case 'u': + /* restore cursor position */ + s->x =3D vc->x_saved; + s->y =3D vc->y_saved; + break; + default: + trace_console_putchar_unhandled(ch); + break; + } + break; + } + } +} + +#define TYPE_CHARDEV_VC "chardev-vc" +DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV, + TYPE_CHARDEV_VC) + +static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len) +{ + VCChardev *drv =3D VC_CHARDEV(chr); + QemuTextConsole *s =3D drv->console; + int i; + + s->update_x0 =3D s->width * FONT_WIDTH; + s->update_y0 =3D s->height * FONT_HEIGHT; + s->update_x1 =3D 0; + s->update_y1 =3D 0; + console_show_cursor(s, 0); + for(i =3D 0; i < len; i++) { + vc_putchar(drv, buf[i]); + } + console_show_cursor(s, 1); + if (s->update_x0 < s->update_x1) { + dpy_gfx_update(QEMU_CONSOLE(s), s->update_x0, s->update_y0, + s->update_x1 - s->update_x0, + s->update_y1 - s->update_y0); + } + return len; +} + +void qemu_text_console_update_cursor(void) +{ + cursor_visible_phase =3D !cursor_visible_phase; + + if (qemu_invalidate_text_consoles()) { + timer_mod(cursor_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + + CONSOLE_CURSOR_PERIOD / 2); + } +} + +static void +cursor_timer_cb(void *opaque) +{ + qemu_text_console_update_cursor(); +} + +static void text_console_invalidate(void *opaque) +{ + QemuTextConsole *s =3D QEMU_TEXT_CONSOLE(opaque); + + if (!QEMU_IS_FIXED_TEXT_CONSOLE(s)) { + text_console_resize(QEMU_TEXT_CONSOLE(s)); + } + console_refresh(s); +} + +static void +qemu_text_console_finalize(Object *obj) +{ +} + +static void +qemu_text_console_class_init(ObjectClass *oc, void *data) +{ + if (!cursor_timer) { + cursor_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, cursor_timer_cb= , NULL); + } +} + +static const GraphicHwOps text_console_ops =3D { + .invalidate =3D text_console_invalidate, + .text_update =3D text_console_update, +}; + +static void +qemu_text_console_init(Object *obj) +{ + QemuTextConsole *c =3D QEMU_TEXT_CONSOLE(obj); + + fifo8_create(&c->out_fifo, 16); + c->total_height =3D DEFAULT_BACKSCROLL; + QEMU_CONSOLE(c)->hw_ops =3D &text_console_ops; + QEMU_CONSOLE(c)->hw =3D c; +} + +static void +qemu_fixed_text_console_finalize(Object *obj) +{ +} + +static void +qemu_fixed_text_console_class_init(ObjectClass *oc, void *data) +{ +} + +static void +qemu_fixed_text_console_init(Object *obj) +{ +} + +static void vc_chr_accept_input(Chardev *chr) +{ + VCChardev *drv =3D VC_CHARDEV(chr); + + kbd_send_chars(drv->console); +} + +static void vc_chr_set_echo(Chardev *chr, bool echo) +{ + VCChardev *drv =3D VC_CHARDEV(chr); + + drv->console->echo =3D echo; +} + +void qemu_text_console_select(QemuTextConsole *c) +{ + dpy_text_resize(QEMU_CONSOLE(c), c->width, c->height); + qemu_text_console_update_cursor(); +} + +static void vc_chr_open(Chardev *chr, + ChardevBackend *backend, + bool *be_opened, + Error **errp) +{ + ChardevVC *vc =3D backend->u.vc.data; + VCChardev *drv =3D VC_CHARDEV(chr); + QemuTextConsole *s; + unsigned width =3D 0; + unsigned height =3D 0; + + if (vc->has_width) { + width =3D vc->width; + } else if (vc->has_cols) { + width =3D vc->cols * FONT_WIDTH; + } + + if (vc->has_height) { + height =3D vc->height; + } else if (vc->has_rows) { + height =3D vc->rows * FONT_HEIGHT; + } + + trace_console_txt_new(width, height); + if (width =3D=3D 0 || height =3D=3D 0) { + s =3D QEMU_TEXT_CONSOLE(object_new(TYPE_QEMU_TEXT_CONSOLE)); + width =3D qemu_console_get_width(NULL, 80 * FONT_WIDTH); + height =3D qemu_console_get_height(NULL, 24 * FONT_HEIGHT); + } else { + s =3D QEMU_TEXT_CONSOLE(object_new(TYPE_QEMU_FIXED_TEXT_CONSOLE)); + } + + dpy_gfx_replace_surface(QEMU_CONSOLE(s), qemu_create_displaysurface(wi= dth, height)); + + s->chr =3D chr; + drv->console =3D s; + + /* set current text attributes to default */ + drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; + text_console_resize(s); + + if (chr->label) { + char *msg; + + drv->t_attrib.bgcol =3D QEMU_COLOR_BLUE; + msg =3D g_strdup_printf("%s console\r\n", chr->label); + qemu_chr_write(chr, (uint8_t *)msg, strlen(msg), true); + g_free(msg); + drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; + } + + *be_opened =3D true; +} + +static void vc_chr_parse(QemuOpts *opts, ChardevBackend *backend, Error **= errp) +{ + int val; + ChardevVC *vc; + + backend->type =3D CHARDEV_BACKEND_KIND_VC; + vc =3D backend->u.vc.data =3D g_new0(ChardevVC, 1); + qemu_chr_parse_common(opts, qapi_ChardevVC_base(vc)); + + val =3D qemu_opt_get_number(opts, "width", 0); + if (val !=3D 0) { + vc->has_width =3D true; + vc->width =3D val; + } + + val =3D qemu_opt_get_number(opts, "height", 0); + if (val !=3D 0) { + vc->has_height =3D true; + vc->height =3D val; + } + + val =3D qemu_opt_get_number(opts, "cols", 0); + if (val !=3D 0) { + vc->has_cols =3D true; + vc->cols =3D val; + } + + val =3D qemu_opt_get_number(opts, "rows", 0); + if (val !=3D 0) { + vc->has_rows =3D true; + vc->rows =3D val; + } +} + +static void char_vc_class_init(ObjectClass *oc, void *data) +{ + ChardevClass *cc =3D CHARDEV_CLASS(oc); + + cc->parse =3D vc_chr_parse; + cc->open =3D vc_chr_open; + cc->chr_write =3D vc_chr_write; + cc->chr_accept_input =3D vc_chr_accept_input; + cc->chr_set_echo =3D vc_chr_set_echo; +} + +static const TypeInfo char_vc_type_info =3D { + .name =3D TYPE_CHARDEV_VC, + .parent =3D TYPE_CHARDEV, + .instance_size =3D sizeof(VCChardev), + .class_init =3D char_vc_class_init, +}; + +void qemu_console_early_init(void) +{ + /* set the default vc driver */ + if (!object_class_by_name(TYPE_CHARDEV_VC)) { + type_register(&char_vc_type_info); + } +} diff --git a/ui/console.c b/ui/console.c index c2c1f22979..da341f08da 100644 --- a/ui/console.c +++ b/ui/console.c @@ -29,68 +29,16 @@ #include "qapi/qapi-commands-ui.h" #include "qapi/visitor.h" #include "qemu/coroutine.h" -#include "qemu/fifo8.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/option.h" -#include "qemu/timer.h" #include "chardev/char.h" #include "trace.h" #include "exec/memory.h" #include "qom/object.h" =20 -#define DEFAULT_BACKSCROLL 512 -#define CONSOLE_CURSOR_PERIOD 500 - -typedef struct TextAttributes { - uint8_t fgcol:4; - uint8_t bgcol:4; - uint8_t bold:1; - uint8_t uline:1; - uint8_t blink:1; - uint8_t invers:1; - uint8_t unvisible:1; -} TextAttributes; - -#define TEXT_ATTRIBUTES_DEFAULT ((TextAttributes) { \ - .fgcol =3D QEMU_COLOR_WHITE, \ - .bgcol =3D QEMU_COLOR_BLACK \ -}) - -typedef struct TextCell { - uint8_t ch; - TextAttributes t_attrib; -} TextCell; - -#define MAX_ESC_PARAMS 3 - -enum TTYState { - TTY_STATE_NORM, - TTY_STATE_ESC, - TTY_STATE_CSI, -}; - -struct QemuConsole { - Object parent; - - int index; - DisplayState *ds; - DisplaySurface *surface; - DisplayScanout scanout; - int dcls; - DisplayGLCtx *gl; - int gl_block; - QEMUTimer *gl_unblock_timer; - int window_id; - QemuUIInfo ui_info; - QEMUTimer *ui_timer; - const GraphicHwOps *hw_ops; - void *hw; - CoQueue dump_queue; - - QTAILQ_ENTRY(QemuConsole) next; -}; +#include "console-priv.h" =20 OBJECT_DEFINE_ABSTRACT_TYPE(QemuConsole, qemu_console, QEMU_CONSOLE, OBJEC= T) =20 @@ -108,54 +56,6 @@ typedef QemuConsoleClass QemuGraphicConsoleClass; =20 OBJECT_DEFINE_TYPE(QemuGraphicConsole, qemu_graphic_console, QEMU_GRAPHIC_= CONSOLE, QEMU_CONSOLE) =20 -typedef struct QemuTextConsole { - QemuConsole parent; - - int width; - int height; - int total_height; - int backscroll_height; - int x, y; - int y_displayed; - int y_base; - TextCell *cells; - int text_x[2], text_y[2], cursor_invalidate; - int echo; - - int update_x0; - int update_y0; - int update_x1; - int update_y1; - - Chardev *chr; - /* fifo for key pressed */ - Fifo8 out_fifo; -} QemuTextConsole; - -typedef QemuConsoleClass QemuTextConsoleClass; - -OBJECT_DEFINE_TYPE(QemuTextConsole, qemu_text_console, QEMU_TEXT_CONSOLE, = QEMU_CONSOLE) - -typedef struct QemuFixedTextConsole { - QemuTextConsole parent; -} QemuFixedTextConsole; - -typedef QemuTextConsoleClass QemuFixedTextConsoleClass; - -OBJECT_DEFINE_TYPE(QemuFixedTextConsole, qemu_fixed_text_console, QEMU_FIX= ED_TEXT_CONSOLE, QEMU_TEXT_CONSOLE) - -struct VCChardev { - Chardev parent; - QemuTextConsole *console; - - enum TTYState state; - int esc_params[MAX_ESC_PARAMS]; - int nb_esc_params; - TextAttributes t_attrib; /* currently active text attributes */ - int x_saved, y_saved; -}; -typedef struct VCChardev VCChardev; - struct DisplayState { QEMUTimer *gui_timer; uint64_t last_update; @@ -169,12 +69,9 @@ static DisplayState *display_state; static QemuConsole *active_console; static QTAILQ_HEAD(, QemuConsole) consoles =3D QTAILQ_HEAD_INITIALIZER(consoles); -static bool cursor_visible_phase; -static QEMUTimer *cursor_timer; =20 static void dpy_refresh(DisplayState *s); static DisplayState *get_alloc_displaystate(void); -static void qemu_text_console_update_cursor(void *opaque); static bool displaychangelistener_has_dmabuf(DisplayChangeListener *dcl); static bool console_compatible_with(QemuConsole *con, DisplayChangeListener *dcl, Error **er= rp); @@ -330,663 +227,6 @@ void graphic_hw_text_update(QemuConsole *con, console= _ch_t *chardata) } } =20 -static void qemu_console_fill_rect(QemuConsole *con, int posx, int posy, - int width, int height, pixman_color_t c= olor) -{ - DisplaySurface *surface =3D qemu_console_surface(con); - pixman_rectangle16_t rect =3D { - .x =3D posx, .y =3D posy, .width =3D width, .height =3D height - }; - - assert(surface); - pixman_image_fill_rectangles(PIXMAN_OP_SRC, surface->image, - &color, 1, &rect); -} - -/* copy from (xs, ys) to (xd, yd) a rectangle of size (w, h) */ -static void qemu_console_bitblt(QemuConsole *con, - int xs, int ys, int xd, int yd, int w, int= h) -{ - DisplaySurface *surface =3D qemu_console_surface(con); - - assert(surface); - pixman_image_composite(PIXMAN_OP_SRC, - surface->image, NULL, surface->image, - xs, ys, 0, 0, xd, yd, w, h); -} - -/***********************************************************/ -/* basic char display */ - -#define FONT_HEIGHT 16 -#define FONT_WIDTH 8 - -#include "vgafont.h" - -static const pixman_color_t color_table_rgb[2][8] =3D { - { /* dark */ - [QEMU_COLOR_BLACK] =3D QEMU_PIXMAN_COLOR_BLACK, - [QEMU_COLOR_BLUE] =3D QEMU_PIXMAN_COLOR(0x00, 0x00, 0xaa), /* = blue */ - [QEMU_COLOR_GREEN] =3D QEMU_PIXMAN_COLOR(0x00, 0xaa, 0x00), /* = green */ - [QEMU_COLOR_CYAN] =3D QEMU_PIXMAN_COLOR(0x00, 0xaa, 0xaa), /* = cyan */ - [QEMU_COLOR_RED] =3D QEMU_PIXMAN_COLOR(0xaa, 0x00, 0x00), /* = red */ - [QEMU_COLOR_MAGENTA] =3D QEMU_PIXMAN_COLOR(0xaa, 0x00, 0xaa), /* = magenta */ - [QEMU_COLOR_YELLOW] =3D QEMU_PIXMAN_COLOR(0xaa, 0xaa, 0x00), /* = yellow */ - [QEMU_COLOR_WHITE] =3D QEMU_PIXMAN_COLOR_GRAY, - }, - { /* bright */ - [QEMU_COLOR_BLACK] =3D QEMU_PIXMAN_COLOR_BLACK, - [QEMU_COLOR_BLUE] =3D QEMU_PIXMAN_COLOR(0x00, 0x00, 0xff), /* = blue */ - [QEMU_COLOR_GREEN] =3D QEMU_PIXMAN_COLOR(0x00, 0xff, 0x00), /* = green */ - [QEMU_COLOR_CYAN] =3D QEMU_PIXMAN_COLOR(0x00, 0xff, 0xff), /* = cyan */ - [QEMU_COLOR_RED] =3D QEMU_PIXMAN_COLOR(0xff, 0x00, 0x00), /* = red */ - [QEMU_COLOR_MAGENTA] =3D QEMU_PIXMAN_COLOR(0xff, 0x00, 0xff), /* = magenta */ - [QEMU_COLOR_YELLOW] =3D QEMU_PIXMAN_COLOR(0xff, 0xff, 0x00), /* = yellow */ - [QEMU_COLOR_WHITE] =3D QEMU_PIXMAN_COLOR(0xff, 0xff, 0xff), /* = white */ - } -}; - -static void vga_putcharxy(QemuConsole *s, int x, int y, int ch, - TextAttributes *t_attrib) -{ - static pixman_image_t *glyphs[256]; - DisplaySurface *surface =3D qemu_console_surface(s); - pixman_color_t fgcol, bgcol; - - assert(surface); - if (t_attrib->invers) { - bgcol =3D color_table_rgb[t_attrib->bold][t_attrib->fgcol]; - fgcol =3D color_table_rgb[t_attrib->bold][t_attrib->bgcol]; - } else { - fgcol =3D color_table_rgb[t_attrib->bold][t_attrib->fgcol]; - bgcol =3D color_table_rgb[t_attrib->bold][t_attrib->bgcol]; - } - - if (!glyphs[ch]) { - glyphs[ch] =3D qemu_pixman_glyph_from_vgafont(FONT_HEIGHT, vgafont= 16, ch); - } - qemu_pixman_glyph_render(glyphs[ch], surface->image, - &fgcol, &bgcol, x, y, FONT_WIDTH, FONT_HEIGHT= ); -} - -static void text_console_resize(QemuTextConsole *t) -{ - QemuConsole *s =3D QEMU_CONSOLE(t); - TextCell *cells, *c, *c1; - int w1, x, y, last_width, w, h; - - assert(s->scanout.kind =3D=3D SCANOUT_SURFACE); - - w =3D surface_width(s->surface) / FONT_WIDTH; - h =3D surface_height(s->surface) / FONT_HEIGHT; - if (w =3D=3D t->width && h =3D=3D t->height) { - return; - } - - last_width =3D t->width; - t->width =3D w; - t->height =3D h; - - w1 =3D MIN(t->width, last_width); - - cells =3D g_new(TextCell, t->width * t->total_height + 1); - for (y =3D 0; y < t->total_height; y++) { - c =3D &cells[y * t->width]; - if (w1 > 0) { - c1 =3D &t->cells[y * last_width]; - for (x =3D 0; x < w1; x++) { - *c++ =3D *c1++; - } - } - for (x =3D w1; x < t->width; x++) { - c->ch =3D ' '; - c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; - c++; - } - } - g_free(t->cells); - t->cells =3D cells; -} - -static void invalidate_xy(QemuTextConsole *s, int x, int y) -{ - if (!qemu_console_is_visible(QEMU_CONSOLE(s))) { - return; - } - if (s->update_x0 > x * FONT_WIDTH) - s->update_x0 =3D x * FONT_WIDTH; - if (s->update_y0 > y * FONT_HEIGHT) - s->update_y0 =3D y * FONT_HEIGHT; - if (s->update_x1 < (x + 1) * FONT_WIDTH) - s->update_x1 =3D (x + 1) * FONT_WIDTH; - if (s->update_y1 < (y + 1) * FONT_HEIGHT) - s->update_y1 =3D (y + 1) * FONT_HEIGHT; -} - -static void vc_update_xy(VCChardev *vc, int x, int y) -{ - QemuTextConsole *s =3D vc->console; - TextCell *c; - int y1, y2; - - s->text_x[0] =3D MIN(s->text_x[0], x); - s->text_x[1] =3D MAX(s->text_x[1], x); - s->text_y[0] =3D MIN(s->text_y[0], y); - s->text_y[1] =3D MAX(s->text_y[1], y); - - y1 =3D (s->y_base + y) % s->total_height; - y2 =3D y1 - s->y_displayed; - if (y2 < 0) { - y2 +=3D s->total_height; - } - if (y2 < s->height) { - if (x >=3D s->width) { - x =3D s->width - 1; - } - c =3D &s->cells[y1 * s->width + x]; - vga_putcharxy(QEMU_CONSOLE(s), x, y2, c->ch, - &(c->t_attrib)); - invalidate_xy(s, x, y2); - } -} - -static void console_show_cursor(QemuTextConsole *s, int show) -{ - TextCell *c; - int y, y1; - int x =3D s->x; - - s->cursor_invalidate =3D 1; - - if (x >=3D s->width) { - x =3D s->width - 1; - } - y1 =3D (s->y_base + s->y) % s->total_height; - y =3D y1 - s->y_displayed; - if (y < 0) { - y +=3D s->total_height; - } - if (y < s->height) { - c =3D &s->cells[y1 * s->width + x]; - if (show && cursor_visible_phase) { - TextAttributes t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; - t_attrib.invers =3D !(t_attrib.invers); /* invert fg and bg */ - vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, &t_attrib); - } else { - vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, &(c->t_attrib)); - } - invalidate_xy(s, x, y); - } -} - -static void console_refresh(QemuTextConsole *s) -{ - DisplaySurface *surface =3D qemu_console_surface(QEMU_CONSOLE(s)); - TextCell *c; - int x, y, y1; - - assert(surface); - s->text_x[0] =3D 0; - s->text_y[0] =3D 0; - s->text_x[1] =3D s->width - 1; - s->text_y[1] =3D s->height - 1; - s->cursor_invalidate =3D 1; - - qemu_console_fill_rect(QEMU_CONSOLE(s), 0, 0, surface_width(surface), = surface_height(surface), - color_table_rgb[0][QEMU_COLOR_BLACK]); - y1 =3D s->y_displayed; - for (y =3D 0; y < s->height; y++) { - c =3D s->cells + y1 * s->width; - for (x =3D 0; x < s->width; x++) { - vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, - &(c->t_attrib)); - c++; - } - if (++y1 =3D=3D s->total_height) { - y1 =3D 0; - } - } - console_show_cursor(s, 1); - dpy_gfx_update(QEMU_CONSOLE(s), 0, 0, - surface_width(surface), surface_height(surface)); -} - -static void console_scroll(QemuTextConsole *s, int ydelta) -{ - int i, y1; - - if (ydelta > 0) { - for(i =3D 0; i < ydelta; i++) { - if (s->y_displayed =3D=3D s->y_base) - break; - if (++s->y_displayed =3D=3D s->total_height) - s->y_displayed =3D 0; - } - } else { - ydelta =3D -ydelta; - i =3D s->backscroll_height; - if (i > s->total_height - s->height) - i =3D s->total_height - s->height; - y1 =3D s->y_base - i; - if (y1 < 0) - y1 +=3D s->total_height; - for(i =3D 0; i < ydelta; i++) { - if (s->y_displayed =3D=3D y1) - break; - if (--s->y_displayed < 0) - s->y_displayed =3D s->total_height - 1; - } - } - console_refresh(s); -} - -static void vc_put_lf(VCChardev *vc) -{ - QemuTextConsole *s =3D vc->console; - TextCell *c; - int x, y1; - - s->y++; - if (s->y >=3D s->height) { - s->y =3D s->height - 1; - - if (s->y_displayed =3D=3D s->y_base) { - if (++s->y_displayed =3D=3D s->total_height) - s->y_displayed =3D 0; - } - if (++s->y_base =3D=3D s->total_height) - s->y_base =3D 0; - if (s->backscroll_height < s->total_height) - s->backscroll_height++; - y1 =3D (s->y_base + s->height - 1) % s->total_height; - c =3D &s->cells[y1 * s->width]; - for(x =3D 0; x < s->width; x++) { - c->ch =3D ' '; - c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; - c++; - } - if (s->y_displayed =3D=3D s->y_base) { - s->text_x[0] =3D 0; - s->text_y[0] =3D 0; - s->text_x[1] =3D s->width - 1; - s->text_y[1] =3D s->height - 1; - - qemu_console_bitblt(QEMU_CONSOLE(s), 0, FONT_HEIGHT, 0, 0, - s->width * FONT_WIDTH, - (s->height - 1) * FONT_HEIGHT); - qemu_console_fill_rect(QEMU_CONSOLE(s), 0, (s->height - 1) * F= ONT_HEIGHT, - s->width * FONT_WIDTH, FONT_HEIGHT, - color_table_rgb[0][TEXT_ATTRIBUTES_DEFA= ULT.bgcol]); - s->update_x0 =3D 0; - s->update_y0 =3D 0; - s->update_x1 =3D s->width * FONT_WIDTH; - s->update_y1 =3D s->height * FONT_HEIGHT; - } - } -} - -/* Set console attributes depending on the current escape codes. - * NOTE: I know this code is not very efficient (checking every color for = it - * self) but it is more readable and better maintainable. - */ -static void vc_handle_escape(VCChardev *vc) -{ - int i; - - for (i =3D 0; i < vc->nb_esc_params; i++) { - switch (vc->esc_params[i]) { - case 0: /* reset all console attributes to default */ - vc->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; - break; - case 1: - vc->t_attrib.bold =3D 1; - break; - case 4: - vc->t_attrib.uline =3D 1; - break; - case 5: - vc->t_attrib.blink =3D 1; - break; - case 7: - vc->t_attrib.invers =3D 1; - break; - case 8: - vc->t_attrib.unvisible =3D 1; - break; - case 22: - vc->t_attrib.bold =3D 0; - break; - case 24: - vc->t_attrib.uline =3D 0; - break; - case 25: - vc->t_attrib.blink =3D 0; - break; - case 27: - vc->t_attrib.invers =3D 0; - break; - case 28: - vc->t_attrib.unvisible =3D 0; - break; - /* set foreground color */ - case 30: - vc->t_attrib.fgcol =3D QEMU_COLOR_BLACK; - break; - case 31: - vc->t_attrib.fgcol =3D QEMU_COLOR_RED; - break; - case 32: - vc->t_attrib.fgcol =3D QEMU_COLOR_GREEN; - break; - case 33: - vc->t_attrib.fgcol =3D QEMU_COLOR_YELLOW; - break; - case 34: - vc->t_attrib.fgcol =3D QEMU_COLOR_BLUE; - break; - case 35: - vc->t_attrib.fgcol =3D QEMU_COLOR_MAGENTA; - break; - case 36: - vc->t_attrib.fgcol =3D QEMU_COLOR_CYAN; - break; - case 37: - vc->t_attrib.fgcol =3D QEMU_COLOR_WHITE; - break; - /* set background color */ - case 40: - vc->t_attrib.bgcol =3D QEMU_COLOR_BLACK; - break; - case 41: - vc->t_attrib.bgcol =3D QEMU_COLOR_RED; - break; - case 42: - vc->t_attrib.bgcol =3D QEMU_COLOR_GREEN; - break; - case 43: - vc->t_attrib.bgcol =3D QEMU_COLOR_YELLOW; - break; - case 44: - vc->t_attrib.bgcol =3D QEMU_COLOR_BLUE; - break; - case 45: - vc->t_attrib.bgcol =3D QEMU_COLOR_MAGENTA; - break; - case 46: - vc->t_attrib.bgcol =3D QEMU_COLOR_CYAN; - break; - case 47: - vc->t_attrib.bgcol =3D QEMU_COLOR_WHITE; - break; - } - } -} - -static void vc_clear_xy(VCChardev *vc, int x, int y) -{ - QemuTextConsole *s =3D vc->console; - int y1 =3D (s->y_base + y) % s->total_height; - if (x >=3D s->width) { - x =3D s->width - 1; - } - TextCell *c =3D &s->cells[y1 * s->width + x]; - c->ch =3D ' '; - c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; - vc_update_xy(vc, x, y); -} - -static void vc_put_one(VCChardev *vc, int ch) -{ - QemuTextConsole *s =3D vc->console; - TextCell *c; - int y1; - if (s->x >=3D s->width) { - /* line wrap */ - s->x =3D 0; - vc_put_lf(vc); - } - y1 =3D (s->y_base + s->y) % s->total_height; - c =3D &s->cells[y1 * s->width + s->x]; - c->ch =3D ch; - c->t_attrib =3D vc->t_attrib; - vc_update_xy(vc, s->x, s->y); - s->x++; -} - -static void vc_respond_str(VCChardev *vc, const char *buf) -{ - while (*buf) { - vc_put_one(vc, *buf); - buf++; - } -} - -/* set cursor, checking bounds */ -static void vc_set_cursor(VCChardev *vc, int x, int y) -{ - QemuTextConsole *s =3D vc->console; - - if (x < 0) { - x =3D 0; - } - if (y < 0) { - y =3D 0; - } - if (y >=3D s->height) { - y =3D s->height - 1; - } - if (x >=3D s->width) { - x =3D s->width - 1; - } - - s->x =3D x; - s->y =3D y; -} - -static void vc_putchar(VCChardev *vc, int ch) -{ - QemuTextConsole *s =3D vc->console; - int i; - int x, y; - char response[40]; - - switch(vc->state) { - case TTY_STATE_NORM: - switch(ch) { - case '\r': /* carriage return */ - s->x =3D 0; - break; - case '\n': /* newline */ - vc_put_lf(vc); - break; - case '\b': /* backspace */ - if (s->x > 0) - s->x--; - break; - case '\t': /* tabspace */ - if (s->x + (8 - (s->x % 8)) > s->width) { - s->x =3D 0; - vc_put_lf(vc); - } else { - s->x =3D s->x + (8 - (s->x % 8)); - } - break; - case '\a': /* alert aka. bell */ - /* TODO: has to be implemented */ - break; - case 14: - /* SI (shift in), character set 0 (ignored) */ - break; - case 15: - /* SO (shift out), character set 1 (ignored) */ - break; - case 27: /* esc (introducing an escape sequence) */ - vc->state =3D TTY_STATE_ESC; - break; - default: - vc_put_one(vc, ch); - break; - } - break; - case TTY_STATE_ESC: /* check if it is a terminal escape sequence */ - if (ch =3D=3D '[') { - for(i=3D0;iesc_params[i] =3D 0; - vc->nb_esc_params =3D 0; - vc->state =3D TTY_STATE_CSI; - } else { - vc->state =3D TTY_STATE_NORM; - } - break; - case TTY_STATE_CSI: /* handle escape sequence parameters */ - if (ch >=3D '0' && ch <=3D '9') { - if (vc->nb_esc_params < MAX_ESC_PARAMS) { - int *param =3D &vc->esc_params[vc->nb_esc_params]; - int digit =3D (ch - '0'); - - *param =3D (*param <=3D (INT_MAX - digit) / 10) ? - *param * 10 + digit : INT_MAX; - } - } else { - if (vc->nb_esc_params < MAX_ESC_PARAMS) - vc->nb_esc_params++; - if (ch =3D=3D ';' || ch =3D=3D '?') { - break; - } - trace_console_putchar_csi(vc->esc_params[0], vc->esc_params[1], - ch, vc->nb_esc_params); - vc->state =3D TTY_STATE_NORM; - switch(ch) { - case 'A': - /* move cursor up */ - if (vc->esc_params[0] =3D=3D 0) { - vc->esc_params[0] =3D 1; - } - vc_set_cursor(vc, s->x, s->y - vc->esc_params[0]); - break; - case 'B': - /* move cursor down */ - if (vc->esc_params[0] =3D=3D 0) { - vc->esc_params[0] =3D 1; - } - vc_set_cursor(vc, s->x, s->y + vc->esc_params[0]); - break; - case 'C': - /* move cursor right */ - if (vc->esc_params[0] =3D=3D 0) { - vc->esc_params[0] =3D 1; - } - vc_set_cursor(vc, s->x + vc->esc_params[0], s->y); - break; - case 'D': - /* move cursor left */ - if (vc->esc_params[0] =3D=3D 0) { - vc->esc_params[0] =3D 1; - } - vc_set_cursor(vc, s->x - vc->esc_params[0], s->y); - break; - case 'G': - /* move cursor to column */ - vc_set_cursor(vc, vc->esc_params[0] - 1, s->y); - break; - case 'f': - case 'H': - /* move cursor to row, column */ - vc_set_cursor(vc, vc->esc_params[1] - 1, vc->esc_params[0]= - 1); - break; - case 'J': - switch (vc->esc_params[0]) { - case 0: - /* clear to end of screen */ - for (y =3D s->y; y < s->height; y++) { - for (x =3D 0; x < s->width; x++) { - if (y =3D=3D s->y && x < s->x) { - continue; - } - vc_clear_xy(vc, x, y); - } - } - break; - case 1: - /* clear from beginning of screen */ - for (y =3D 0; y <=3D s->y; y++) { - for (x =3D 0; x < s->width; x++) { - if (y =3D=3D s->y && x > s->x) { - break; - } - vc_clear_xy(vc, x, y); - } - } - break; - case 2: - /* clear entire screen */ - for (y =3D 0; y <=3D s->height; y++) { - for (x =3D 0; x < s->width; x++) { - vc_clear_xy(vc, x, y); - } - } - break; - } - break; - case 'K': - switch (vc->esc_params[0]) { - case 0: - /* clear to eol */ - for(x =3D s->x; x < s->width; x++) { - vc_clear_xy(vc, x, s->y); - } - break; - case 1: - /* clear from beginning of line */ - for (x =3D 0; x <=3D s->x && x < s->width; x++) { - vc_clear_xy(vc, x, s->y); - } - break; - case 2: - /* clear entire line */ - for(x =3D 0; x < s->width; x++) { - vc_clear_xy(vc, x, s->y); - } - break; - } - break; - case 'm': - vc_handle_escape(vc); - break; - case 'n': - switch (vc->esc_params[0]) { - case 5: - /* report console status (always succeed)*/ - vc_respond_str(vc, "\033[0n"); - break; - case 6: - /* report cursor position */ - sprintf(response, "\033[%d;%dR", - (s->y_base + s->y) % s->total_height + 1, - s->x + 1); - vc_respond_str(vc, response); - break; - } - break; - case 's': - /* save cursor position */ - vc->x_saved =3D s->x; - vc->y_saved =3D s->y; - break; - case 'u': - /* restore cursor position */ - s->x =3D vc->x_saved; - s->y =3D vc->y_saved; - break; - default: - trace_console_putchar_unhandled(ch); - break; - } - break; - } - } -} - static void displaychangelistener_gfx_switch(DisplayChangeListener *dcl, struct DisplaySurface *new_su= rface, bool update) @@ -1065,13 +305,6 @@ static void displaychangelistener_display_console(Dis= playChangeListener *dcl, } } =20 -static void -qemu_text_console_select(QemuTextConsole *c) -{ - dpy_text_resize(QEMU_CONSOLE(c), c->width, c->height); - qemu_text_console_update_cursor(NULL); -} - void console_select(unsigned int index) { DisplayChangeListener *dcl; @@ -1096,101 +329,6 @@ void console_select(unsigned int index) } } =20 -#define TYPE_CHARDEV_VC "chardev-vc" -DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV, - TYPE_CHARDEV_VC) - -static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len) -{ - VCChardev *drv =3D VC_CHARDEV(chr); - QemuTextConsole *s =3D drv->console; - int i; - - s->update_x0 =3D s->width * FONT_WIDTH; - s->update_y0 =3D s->height * FONT_HEIGHT; - s->update_x1 =3D 0; - s->update_y1 =3D 0; - console_show_cursor(s, 0); - for(i =3D 0; i < len; i++) { - vc_putchar(drv, buf[i]); - } - console_show_cursor(s, 1); - if (s->update_x0 < s->update_x1) { - dpy_gfx_update(QEMU_CONSOLE(s), s->update_x0, s->update_y0, - s->update_x1 - s->update_x0, - s->update_y1 - s->update_y0); - } - return len; -} - -static void kbd_send_chars(QemuTextConsole *s) -{ - uint32_t len, avail; - - len =3D qemu_chr_be_can_write(s->chr); - avail =3D fifo8_num_used(&s->out_fifo); - while (len > 0 && avail > 0) { - const uint8_t *buf; - uint32_t size; - - buf =3D fifo8_pop_buf(&s->out_fifo, MIN(len, avail), &size); - qemu_chr_be_write(s->chr, buf, size); - len =3D qemu_chr_be_can_write(s->chr); - avail -=3D size; - } -} - -/* called when an ascii key is pressed */ -static void qemu_text_console_handle_keysym(QemuTextConsole *s, int keysym) -{ - uint8_t buf[16], *q; - int c; - uint32_t num_free; - - switch(keysym) { - case QEMU_KEY_CTRL_UP: - console_scroll(s, -1); - break; - case QEMU_KEY_CTRL_DOWN: - console_scroll(s, 1); - break; - case QEMU_KEY_CTRL_PAGEUP: - console_scroll(s, -10); - break; - case QEMU_KEY_CTRL_PAGEDOWN: - console_scroll(s, 10); - break; - default: - /* convert the QEMU keysym to VT100 key string */ - q =3D buf; - if (keysym >=3D 0xe100 && keysym <=3D 0xe11f) { - *q++ =3D '\033'; - *q++ =3D '['; - c =3D keysym - 0xe100; - if (c >=3D 10) - *q++ =3D '0' + (c / 10); - *q++ =3D '0' + (c % 10); - *q++ =3D '~'; - } else if (keysym >=3D 0xe120 && keysym <=3D 0xe17f) { - *q++ =3D '\033'; - *q++ =3D '['; - *q++ =3D keysym & 0xff; - } else if (s->echo && (keysym =3D=3D '\r' || keysym =3D=3D '\n')) { - qemu_chr_write(s->chr, (uint8_t *)"\r", 1, true); - *q++ =3D '\n'; - } else { - *q++ =3D keysym; - } - if (s->echo) { - qemu_chr_write(s->chr, buf, q - buf, true); - } - num_free =3D fifo8_num_free(&s->out_fifo); - fifo8_push_all(&s->out_fifo, buf, MIN(num_free, q - buf)); - kbd_send_chars(s); - break; - } -} - void qemu_text_console_put_keysym(QemuTextConsole *s, int keysym) { if (!s) { @@ -1249,45 +387,6 @@ void qemu_text_console_put_string(QemuTextConsole *s,= const char *str, int len) } } =20 -static void text_console_invalidate(void *opaque) -{ - QemuTextConsole *s =3D QEMU_TEXT_CONSOLE(opaque); - - if (!QEMU_IS_FIXED_TEXT_CONSOLE(s)) { - text_console_resize(QEMU_TEXT_CONSOLE(s)); - } - console_refresh(s); -} - -static void text_console_update(void *opaque, console_ch_t *chardata) -{ - QemuTextConsole *s =3D QEMU_TEXT_CONSOLE(opaque); - int i, j, src; - - if (s->text_x[0] <=3D s->text_x[1]) { - src =3D (s->y_base + s->text_y[0]) * s->width; - chardata +=3D s->text_y[0] * s->width; - for (i =3D s->text_y[0]; i <=3D s->text_y[1]; i ++) - for (j =3D 0; j < s->width; j++, src++) { - console_write_ch(chardata ++, - ATTR2CHTYPE(s->cells[src].ch, - s->cells[src].t_attrib.fgcol, - s->cells[src].t_attrib.bgcol, - s->cells[src].t_attrib.bold)); - } - dpy_text_update(QEMU_CONSOLE(s), s->text_x[0], s->text_y[0], - s->text_x[1] - s->text_x[0], i - s->text_y[0]); - s->text_x[0] =3D s->width; - s->text_y[0] =3D s->height; - s->text_x[1] =3D 0; - s->text_y[1] =3D 0; - } - if (s->cursor_invalidate) { - dpy_text_cursor(QEMU_CONSOLE(s), s->x, s->y); - s->cursor_invalidate =3D 0; - } -} - static void qemu_console_register(QemuConsole *c) { @@ -1396,51 +495,6 @@ qemu_graphic_console_init(Object *obj) { } =20 -static void -qemu_text_console_finalize(Object *obj) -{ -} - -static void -qemu_text_console_class_init(ObjectClass *oc, void *data) -{ - if (!cursor_timer) { - cursor_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, - qemu_text_console_update_cursor, NULL); - } -} - -static const GraphicHwOps text_console_ops =3D { - .invalidate =3D text_console_invalidate, - .text_update =3D text_console_update, -}; - -static void -qemu_text_console_init(Object *obj) -{ - QemuTextConsole *c =3D QEMU_TEXT_CONSOLE(obj); - - fifo8_create(&c->out_fifo, 16); - c->total_height =3D DEFAULT_BACKSCROLL; - QEMU_CONSOLE(c)->hw_ops =3D &text_console_ops; - QEMU_CONSOLE(c)->hw =3D c; -} - -static void -qemu_fixed_text_console_finalize(Object *obj) -{ -} - -static void -qemu_fixed_text_console_class_init(ObjectClass *oc, void *data) -{ -} - -static void -qemu_fixed_text_console_init(Object *obj) -{ -} - #ifdef WIN32 void qemu_displaysurface_win32_set_handle(DisplaySurface *surface, HANDLE h, uint32_t offset) @@ -1692,6 +746,7 @@ dcl_set_graphic_cursor(DisplayChangeListener *dcl, Qem= uGraphicConsole *con) dcl->ops->dpy_mouse_set(dcl, con->cursor_x, con->cursor_y, con->cu= rsor_on); } } + void register_displaychangelistener(DisplayChangeListener *dcl) { QemuConsole *con; @@ -1712,7 +767,7 @@ void register_displaychangelistener(DisplayChangeListe= ner *dcl) if (QEMU_IS_GRAPHIC_CONSOLE(con)) { dcl_set_graphic_cursor(dcl, QEMU_GRAPHIC_CONSOLE(con)); } - qemu_text_console_update_cursor(NULL); + qemu_text_console_update_cursor(); } =20 void update_displaychangelistener(DisplayChangeListener *dcl, @@ -2399,13 +1454,6 @@ bool qemu_console_is_multihead(DeviceState *dev) return false; } =20 - -static const char * -qemu_text_console_get_label(QemuTextConsole *c) -{ - return c->chr ? c->chr->label : NULL; -} - char *qemu_console_get_label(QemuConsole *con) { if (QEMU_IS_GRAPHIC_CONSOLE(con)) { @@ -2500,20 +1548,6 @@ int qemu_console_get_height(QemuConsole *con, int fa= llback) } } =20 -static void vc_chr_accept_input(Chardev *chr) -{ - VCChardev *drv =3D VC_CHARDEV(chr); - - kbd_send_chars(drv->console); -} - -static void vc_chr_set_echo(Chardev *chr, bool echo) -{ - VCChardev *drv =3D VC_CHARDEV(chr); - - drv->console->echo =3D echo; -} - int qemu_invalidate_text_consoles(void) { QemuConsole *s; @@ -2531,70 +1565,6 @@ int qemu_invalidate_text_consoles(void) return count; } =20 -static void qemu_text_console_update_cursor(void *opaque) -{ - cursor_visible_phase =3D !cursor_visible_phase; - - if (qemu_invalidate_text_consoles()) { - timer_mod(cursor_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - + CONSOLE_CURSOR_PERIOD / 2); - } -} - -static void vc_chr_open(Chardev *chr, - ChardevBackend *backend, - bool *be_opened, - Error **errp) -{ - ChardevVC *vc =3D backend->u.vc.data; - VCChardev *drv =3D VC_CHARDEV(chr); - QemuTextConsole *s; - unsigned width =3D 0; - unsigned height =3D 0; - - if (vc->has_width) { - width =3D vc->width; - } else if (vc->has_cols) { - width =3D vc->cols * FONT_WIDTH; - } - - if (vc->has_height) { - height =3D vc->height; - } else if (vc->has_rows) { - height =3D vc->rows * FONT_HEIGHT; - } - - trace_console_txt_new(width, height); - if (width =3D=3D 0 || height =3D=3D 0) { - s =3D QEMU_TEXT_CONSOLE(object_new(TYPE_QEMU_TEXT_CONSOLE)); - width =3D qemu_console_get_width(NULL, 80 * FONT_WIDTH); - height =3D qemu_console_get_height(NULL, 24 * FONT_HEIGHT); - } else { - s =3D QEMU_TEXT_CONSOLE(object_new(TYPE_QEMU_FIXED_TEXT_CONSOLE)); - } - - dpy_gfx_replace_surface(QEMU_CONSOLE(s), qemu_create_displaysurface(wi= dth, height)); - - s->chr =3D chr; - drv->console =3D s; - - /* set current text attributes to default */ - drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; - text_console_resize(s); - - if (chr->label) { - char *msg; - - drv->t_attrib.bgcol =3D QEMU_COLOR_BLUE; - msg =3D g_strdup_printf("%s console\r\n", chr->label); - qemu_chr_write(chr, (uint8_t *)msg, strlen(msg), true); - g_free(msg); - drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; - } - - *be_opened =3D true; -} - void qemu_console_resize(QemuConsole *s, int width, int height) { DisplaySurface *surface =3D qemu_console_surface(s); @@ -2721,63 +1691,3 @@ void qemu_display_help(void) } } } - -static void vc_chr_parse(QemuOpts *opts, ChardevBackend *backend, Error **= errp) -{ - int val; - ChardevVC *vc; - - backend->type =3D CHARDEV_BACKEND_KIND_VC; - vc =3D backend->u.vc.data =3D g_new0(ChardevVC, 1); - qemu_chr_parse_common(opts, qapi_ChardevVC_base(vc)); - - val =3D qemu_opt_get_number(opts, "width", 0); - if (val !=3D 0) { - vc->has_width =3D true; - vc->width =3D val; - } - - val =3D qemu_opt_get_number(opts, "height", 0); - if (val !=3D 0) { - vc->has_height =3D true; - vc->height =3D val; - } - - val =3D qemu_opt_get_number(opts, "cols", 0); - if (val !=3D 0) { - vc->has_cols =3D true; - vc->cols =3D val; - } - - val =3D qemu_opt_get_number(opts, "rows", 0); - if (val !=3D 0) { - vc->has_rows =3D true; - vc->rows =3D val; - } -} - -static void char_vc_class_init(ObjectClass *oc, void *data) -{ - ChardevClass *cc =3D CHARDEV_CLASS(oc); - - cc->parse =3D vc_chr_parse; - cc->open =3D vc_chr_open; - cc->chr_write =3D vc_chr_write; - cc->chr_accept_input =3D vc_chr_accept_input; - cc->chr_set_echo =3D vc_chr_set_echo; -} - -static const TypeInfo char_vc_type_info =3D { - .name =3D TYPE_CHARDEV_VC, - .parent =3D TYPE_CHARDEV, - .instance_size =3D sizeof(VCChardev), - .class_init =3D char_vc_class_init, -}; - -void qemu_console_early_init(void) -{ - /* set the default vc driver */ - if (!object_class_by_name(TYPE_CHARDEV_VC)) { - type_register(&char_vc_type_info); - } -} diff --git a/ui/meson.build b/ui/meson.build index d81609fb0e..0a1e8272a3 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -6,6 +6,7 @@ system_ss.add(png) system_ss.add(files( 'clipboard.c', 'console.c', + 'console-vc.c', 'cursor.c', 'input-keymap.c', 'input-legacy.c', --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388591; cv=none; d=zohomail.com; s=zohoarc; b=Uw/xFiE2SGkIN/0XatD0C1NzZeqQ49UXZDidpBM7dap0qTFecqiugXNfOjF4HdQbbELDNBTIADdmebnA1cVGY/PGeDLlQVsDSslE9kRxLS3PwiFmblcjUz1VUJ1tWY5980o0q4gVz8YbYRrYWgyd0ekkMrMnk39JT+U5t2tTJgM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388591; 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=P67kcosaq4zcHr3lfyY3dcUWB8pT+SGgL20mBx0oT6o=; b=Tfnf4/P8CCzeHBYgAKrIw5AZfm33uZK/Aosc9fioT4a3cbrRbq1gaGu4a3rLzHu7iP3y9ltbWHEMJD2JvbgYCKZmi99jZ9/P/7qMBg+D4hhvmzjOta2Z8dyIMud9JhWkAx9Ov3UFZDiY5QnHuIUtHD2QK/J7NoACeFTuWjwjA4k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388591118682.1149339874487; Wed, 30 Aug 2023 02:43:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHiw-0004v2-5Y; Wed, 30 Aug 2023 05:42:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiO-0003Se-M0 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiE-0001cM-1u for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:14 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-543-vGOHtR7WOjmWQxW72scitw-1; Wed, 30 Aug 2023 05:42:08 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B304E2999B29 for ; Wed, 30 Aug 2023 09:42:07 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B2482166B25; Wed, 30 Aug 2023 09:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388529; 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=P67kcosaq4zcHr3lfyY3dcUWB8pT+SGgL20mBx0oT6o=; b=iUb6l+vri2xFuEoVuLx/YNiQtSBlWR8MGkdZypL2W8S/zdcYTMmXZEwCG/PEksCZcOWsOX CDIddN8EQphHVq53II0VaQmLLosSfOFaPvF2uNU0Bv8aV7irKcs3adZ6Z+vFFvCY9taKxX pEr0DBXA4fUClmGEVqTFvyEWjoGngps= X-MC-Unique: vGOHtR7WOjmWQxW72scitw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 50/67] ui/console: move DisplaySurface to its own header Date: Wed, 30 Aug 2023 13:38:24 +0400 Message-ID: <20230830093843.3531473-51-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388593178100013 From: Marc-Andr=C3=A9 Lureau Mostly for readability reasons. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/console.h | 84 +--------------------------------------- include/ui/surface.h | 91 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 83 deletions(-) create mode 100644 include/ui/surface.h diff --git a/include/ui/console.h b/include/ui/console.h index 93bb03a9e2..79e4702912 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -6,11 +6,7 @@ #include "qemu/notify.h" #include "qapi/qapi-types-ui.h" #include "ui/input.h" - -#ifdef CONFIG_OPENGL -# include -# include "ui/shader.h" -#endif +#include "ui/surface.h" =20 #define TYPE_QEMU_CONSOLE "qemu-console" OBJECT_DECLARE_TYPE(QemuConsole, QemuConsoleClass, QEMU_CONSOLE) @@ -136,9 +132,6 @@ struct QemuConsoleClass { ObjectClass parent_class; }; =20 -#define QEMU_ALLOCATED_FLAG 0x01 -#define QEMU_PLACEHOLDER_FLAG 0x02 - typedef struct ScanoutTexture { uint32_t backing_id; bool backing_y_0_top; @@ -151,20 +144,6 @@ typedef struct ScanoutTexture { void *d3d_tex2d; } ScanoutTexture; =20 -typedef struct DisplaySurface { - pixman_image_t *image; - uint8_t flags; -#ifdef CONFIG_OPENGL - GLenum glformat; - GLenum gltype; - GLuint texture; -#endif -#ifdef WIN32 - HANDLE handle; - uint32_t handle_offset; -#endif -} DisplaySurface; - typedef struct QemuUIInfo { /* physical dimension */ uint16_t width_mm; @@ -344,30 +323,6 @@ struct DisplayGLCtx { }; =20 DisplayState *init_displaystate(void); -DisplaySurface *qemu_create_displaysurface_from(int width, int height, - pixman_format_code_t forma= t, - int linesize, uint8_t *dat= a); -DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image); -DisplaySurface *qemu_create_placeholder_surface(int w, int h, - const char *msg); -#ifdef WIN32 -void qemu_displaysurface_win32_set_handle(DisplaySurface *surface, - HANDLE h, uint32_t offset); -#endif -PixelFormat qemu_default_pixelformat(int bpp); - -DisplaySurface *qemu_create_displaysurface(int width, int height); -void qemu_free_displaysurface(DisplaySurface *surface); - -static inline int is_buffer_shared(DisplaySurface *surface) -{ - return !(surface->flags & QEMU_ALLOCATED_FLAG); -} - -static inline int is_placeholder(DisplaySurface *surface) -{ - return surface->flags & QEMU_PLACEHOLDER_FLAG; -} =20 void register_displaychangelistener(DisplayChangeListener *dcl); void update_displaychangelistener(DisplayChangeListener *dcl, @@ -415,43 +370,6 @@ int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLCo= ntext ctx); =20 bool console_has_gl(QemuConsole *con); =20 -static inline int surface_stride(DisplaySurface *s) -{ - return pixman_image_get_stride(s->image); -} - -static inline void *surface_data(DisplaySurface *s) -{ - return pixman_image_get_data(s->image); -} - -static inline int surface_width(DisplaySurface *s) -{ - return pixman_image_get_width(s->image); -} - -static inline int surface_height(DisplaySurface *s) -{ - return pixman_image_get_height(s->image); -} - -static inline pixman_format_code_t surface_format(DisplaySurface *s) -{ - return pixman_image_get_format(s->image); -} - -static inline int surface_bits_per_pixel(DisplaySurface *s) -{ - int bits =3D PIXMAN_FORMAT_BPP(surface_format(s)); - return bits; -} - -static inline int surface_bytes_per_pixel(DisplaySurface *s) -{ - int bits =3D PIXMAN_FORMAT_BPP(surface_format(s)); - return DIV_ROUND_UP(bits, 8); -} - typedef uint32_t console_ch_t; =20 static inline void console_write_ch(console_ch_t *dest, uint32_t ch) diff --git a/include/ui/surface.h b/include/ui/surface.h new file mode 100644 index 0000000000..37725a303e --- /dev/null +++ b/include/ui/surface.h @@ -0,0 +1,91 @@ +#ifndef SURFACE_H +#define SURFACE_H + +#include "ui/qemu-pixman.h" + +#ifdef CONFIG_OPENGL +# include +# include "ui/shader.h" +#endif + +#define QEMU_ALLOCATED_FLAG 0x01 +#define QEMU_PLACEHOLDER_FLAG 0x02 + +typedef struct DisplaySurface { + pixman_image_t *image; + uint8_t flags; +#ifdef CONFIG_OPENGL + GLenum glformat; + GLenum gltype; + GLuint texture; +#endif +#ifdef WIN32 + HANDLE handle; + uint32_t handle_offset; +#endif +} DisplaySurface; + +PixelFormat qemu_default_pixelformat(int bpp); + +DisplaySurface *qemu_create_displaysurface_from(int width, int height, + pixman_format_code_t forma= t, + int linesize, uint8_t *dat= a); +DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image); +DisplaySurface *qemu_create_placeholder_surface(int w, int h, + const char *msg); +#ifdef WIN32 +void qemu_displaysurface_win32_set_handle(DisplaySurface *surface, + HANDLE h, uint32_t offset); +#endif + +DisplaySurface *qemu_create_displaysurface(int width, int height); +void qemu_free_displaysurface(DisplaySurface *surface); + +static inline int is_buffer_shared(DisplaySurface *surface) +{ + return !(surface->flags & QEMU_ALLOCATED_FLAG); +} + +static inline int is_placeholder(DisplaySurface *surface) +{ + return surface->flags & QEMU_PLACEHOLDER_FLAG; +} + +static inline int surface_stride(DisplaySurface *s) +{ + return pixman_image_get_stride(s->image); +} + +static inline void *surface_data(DisplaySurface *s) +{ + return pixman_image_get_data(s->image); +} + +static inline int surface_width(DisplaySurface *s) +{ + return pixman_image_get_width(s->image); +} + +static inline int surface_height(DisplaySurface *s) +{ + return pixman_image_get_height(s->image); +} + +static inline pixman_format_code_t surface_format(DisplaySurface *s) +{ + return pixman_image_get_format(s->image); +} + +static inline int surface_bits_per_pixel(DisplaySurface *s) +{ + int bits =3D PIXMAN_FORMAT_BPP(surface_format(s)); + return bits; +} + +static inline int surface_bytes_per_pixel(DisplaySurface *s) +{ + int bits =3D PIXMAN_FORMAT_BPP(surface_format(s)); + return DIV_ROUND_UP(bits, 8); +} + +#endif --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388947; cv=none; d=zohomail.com; s=zohoarc; b=UVk1TIdyK11LKfsMbo327eMRehRTOQWqlcPkyyHGOCeK1IB8MI9wbIslY6/Sqm5/9fqUQiolpkFLByX9xqW/0Y5z8FXv1SJe9FCflmaxFQIpJRFVjLr323idu4D/Vgm9VjpkEb8xOnKEJKqknBJ17QN6qd+MHpOM0N48Qb78kqQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388947; 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=3uBLZSLVSTuRtrzYfTYy2+csCZWtH8neKKBdq6qx4iQ=; b=ccX0WyQ4YZOI7oLmjDgo4luvtTZsa2brDB99xMTkU/GkvE0MUGMOKHcykKeyGQq3axBL4qfXpCO0XTVntBlzAoQImGkE/9akSdhm6Drt+gpGr16nFJlu9MeqQRCwMpL2Pxp2eYzqDGajC5jFj0iAd+B+gxtBcvroUGureXZaiuc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388947800691.7209122931291; Wed, 30 Aug 2023 02:49:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHiv-0004m2-1a; Wed, 30 Aug 2023 05:42:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiS-0003ZZ-HM for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiI-0001dv-Uw for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:22 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-PM-neeCyOTeE9WpSjoYNDg-1; Wed, 30 Aug 2023 05:42:12 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C0AC7857A84; Wed, 30 Aug 2023 09:42:11 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9B01140E96E; Wed, 30 Aug 2023 09:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388533; 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=3uBLZSLVSTuRtrzYfTYy2+csCZWtH8neKKBdq6qx4iQ=; b=jKm3uUPpCsyZO7Pi/Y99i8gQz5JP1JET0m02ydBYB0YAhvt4CWYdkRQC5ggJZ5aHCAcQNO 5wY+7U09SVwLdepk1VZxSewyIpnGoqtWA6PLm1rc23Nw+z9dsfiwj4dAGNWCl2cIzDb5ac C1ibMy9aHvNQAs2PphG2HFanOSdjx1Y= X-MC-Unique: PM-neeCyOTeE9WpSjoYNDg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 51/67] build-sys: add optional "pixman" feature Date: Wed, 30 Aug 2023 13:38:25 +0400 Message-ID: <20230830093843.3531473-52-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388948035100001 From: Marc-Andr=C3=A9 Lureau Set CONFIG_PIXMAN accordinly. Signed-off-by: Marc-Andr=C3=A9 Lureau --- meson.build | 6 ++++-- Kconfig.host | 3 +++ meson_options.txt | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 98e68ef0b1..3bd7046099 100644 --- a/meson.build +++ b/meson.build @@ -836,8 +836,8 @@ if 'ust' in get_option('trace_backends') method: 'pkg-config') endif pixman =3D not_found -if have_system or have_tools - pixman =3D dependency('pixman-1', required: have_system, version:'>=3D0.= 21.8', +if not get_option('pixman').auto() or have_system or have_tools + pixman =3D dependency('pixman-1', required: get_option('pixman'), versio= n:'>=3D0.21.8', method: 'pkg-config') endif zlib =3D dependency('zlib', required: true) @@ -2126,6 +2126,7 @@ config_host_data.set('CONFIG_SECCOMP', seccomp.found(= )) if seccomp.found() config_host_data.set('CONFIG_SECCOMP_SYSRAWRC', seccomp_has_sysrawrc) endif +config_host_data.set('CONFIG_PIXMAN', pixman.found()) config_host_data.set('CONFIG_SNAPPY', snappy.found()) config_host_data.set('CONFIG_TPM', have_tpm) config_host_data.set('CONFIG_TSAN', get_option('tsan')) @@ -2833,6 +2834,7 @@ have_ivshmem =3D config_host_data.get('CONFIG_EVENTFD= ') host_kconfig =3D \ (get_option('fuzzing') ? ['CONFIG_FUZZ=3Dy'] : []) + \ (have_tpm ? ['CONFIG_TPM=3Dy'] : []) + \ + (pixman.found() ? ['CONFIG_PIXMAN=3Dy'] : []) + \ (spice.found() ? ['CONFIG_SPICE=3Dy'] : []) + \ (have_ivshmem ? ['CONFIG_IVSHMEM=3Dy'] : []) + \ (opengl.found() ? ['CONFIG_OPENGL=3Dy'] : []) + \ diff --git a/Kconfig.host b/Kconfig.host index d763d89269..b6ac2b9316 100644 --- a/Kconfig.host +++ b/Kconfig.host @@ -11,6 +11,9 @@ config OPENGL config X11 bool =20 +config PIXMAN + bool + config SPICE bool =20 diff --git a/meson_options.txt b/meson_options.txt index aaea5ddd77..89654fd77d 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -216,6 +216,8 @@ option('l2tpv3', type : 'feature', value : 'auto', description: 'l2tpv3 network backend support') option('netmap', type : 'feature', value : 'auto', description: 'netmap network backend support') +option('pixman', type : 'feature', value : 'auto', + description: 'pixman support') option('slirp', type: 'feature', value: 'auto', description: 'libslirp user mode network backend support') option('vde', type : 'feature', value : 'auto', --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388672; cv=none; d=zohomail.com; s=zohoarc; b=jG5IQ2Q2S/aI9DgZQya9SxB+Q9hfbDwIVDR2ES2K8G36300hU7JwXBWSu6DdDmker417CWfZaCkWuaNi5FKn8hf7qyrEG4ry+yL23BweiqZXXENpHofsL3CJ2Skcl/3IJSooAlTUH+PzCEjfd/TvBR8H2FBPuMEfkKWuXk/Mn/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388672; 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=36GFC5TPI0ds1WvEYMWYwriEYzeCfd3nV9CShiKZNcI=; b=E3CmzmWsPYChpr5rvbhHtv9oM/6aLrqQJiQynwqjop1KR+hoYUlqXdbOrKAeUUEqyrK3CK8CwXvstgMXieb7HnOO4Hp3DCXSyXI4k4uDbqWg0Q+Wfcs16em+BabOKl0qGXRtkIZW0XAOntRhv7uTe4iRSexiNExf90zYdZocHtI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388672211544.6648846683466; Wed, 30 Aug 2023 02:44:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHix-00051H-4n; Wed, 30 Aug 2023 05:42:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiT-0003aL-Mj for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiO-0001gF-Q7 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:24 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-433-O9ixrTk9PLCYyn93fi8IxA-1; Wed, 30 Aug 2023 05:42:16 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 59870803E2E for ; Wed, 30 Aug 2023 09:42:16 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23371C15BAE; Wed, 30 Aug 2023 09:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388538; 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=36GFC5TPI0ds1WvEYMWYwriEYzeCfd3nV9CShiKZNcI=; b=aZEgziG75F9NTHymDqgIIMD3PJaJx1pUP0CzbSjS9w8cav9Qmcl0cW5SEvl6ONgTybJuGC dGninDiNEkybSyyZBH46x0XTHsXrZPeqIJQ+Lu+mbk/lV4wlWU1hcXEqIazlJOVALTFNqz p5puV7yccw08lb+YOmrWRXfIAVsT18I= X-MC-Unique: O9ixrTk9PLCYyn93fi8IxA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 52/67] ui: compile out some qemu-pixman functions when !PIXMAN Date: Wed, 30 Aug 2023 13:38:26 +0400 Message-ID: <20230830093843.3531473-53-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388673721100010 From: Marc-Andr=C3=A9 Lureau Those functions require the PIXMAN library. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/qemu-pixman.h | 7 +++++-- ui/qemu-pixman.c | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h index 51f8709327..c5a0911cc7 100644 --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@ -70,17 +70,17 @@ pixman_format_code_t qemu_default_pixman_format(int bpp= , bool native_endian); pixman_format_code_t qemu_drm_format_to_pixman(uint32_t drm_format); uint32_t qemu_pixman_to_drm_format(pixman_format_code_t pixman); int qemu_pixman_get_type(int rshift, int gshift, int bshift); -pixman_format_code_t qemu_pixman_get_format(PixelFormat *pf); bool qemu_pixman_check_format(DisplayChangeListener *dcl, pixman_format_code_t format); =20 +#ifdef CONFIG_PIXMAN +pixman_format_code_t qemu_pixman_get_format(PixelFormat *pf); pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format, int width); void qemu_pixman_linebuf_fill(pixman_image_t *linebuf, pixman_image_t *fb, int width, int x, int y); pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format, pixman_image_t *image); -void qemu_pixman_image_unref(pixman_image_t *image); =20 pixman_image_t *qemu_pixman_glyph_from_vgafont(int height, const uint8_t *= font, unsigned int ch); @@ -89,6 +89,9 @@ void qemu_pixman_glyph_render(pixman_image_t *glyph, pixman_color_t *fgcol, pixman_color_t *bgcol, int x, int y, int cw, int ch); +#endif + +void qemu_pixman_image_unref(pixman_image_t *image); =20 G_DEFINE_AUTOPTR_CLEANUP_FUNC(pixman_image_t, qemu_pixman_image_unref) =20 diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c index be00a96340..4272a43744 100644 --- a/ui/qemu-pixman.c +++ b/ui/qemu-pixman.c @@ -143,6 +143,7 @@ int qemu_pixman_get_type(int rshift, int gshift, int bs= hift) return type; } =20 +#ifdef CONFIG_PIXMAN pixman_format_code_t qemu_pixman_get_format(PixelFormat *pf) { pixman_format_code_t format; @@ -156,6 +157,7 @@ pixman_format_code_t qemu_pixman_get_format(PixelFormat= *pf) } return format; } +#endif =20 /* * Return true for known-good pixman conversions. @@ -184,6 +186,7 @@ bool qemu_pixman_check_format(DisplayChangeListener *dc= l, } } =20 +#ifdef CONFIG_PIXMAN pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format, int width) { @@ -209,6 +212,7 @@ pixman_image_t *qemu_pixman_mirror_create(pixman_format= _code_t format, NULL, pixman_image_get_stride(image)); } +#endif =20 void qemu_pixman_image_unref(pixman_image_t *image) { @@ -218,6 +222,7 @@ void qemu_pixman_image_unref(pixman_image_t *image) pixman_image_unref(image); } =20 +#ifdef CONFIG_PIXMAN pixman_image_t *qemu_pixman_glyph_from_vgafont(int height, const uint8_t *= font, unsigned int ch) { @@ -260,3 +265,4 @@ void qemu_pixman_glyph_render(pixman_image_t *glyph, pixman_image_unref(ifg); pixman_image_unref(ibg); } +#endif /* CONFIG_PIXMAN */ --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388777; cv=none; d=zohomail.com; s=zohoarc; b=eEXZguPRiB2xd4d57Fl6yFHODDOzvSb6M+JHwelrsXnxRvpaVJDfNGapTShJGeOEmx02YGU3LEszTVeAsbmTiRs8jVAcsPVEbPJEb4N/e+ulal8kill5dY56Ve+dACLB5llAry5HQz7D/QbJR7O2gUZjytgMFiDder1CD9Wq9GE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388777; 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=WQae6YZWZquYjdjql9P0b0vhegCU4iorHjDj1iKlBU8=; b=fKd1AgGvTyHc5U3BjCFk3cCRkT25x4ZwNUe2IDDPpFBEXoKTpWYfTHsnxPy5EyZfdvtUNsrkrawHA/SS8d4y5YUHlCsYzqP+PHdkHGlKwG+3VdE6xj4ZklRPBpqjvjIncL2xFdiKZUK1VvQWqC6o3ruZ6qE1AO7RPfI2T4Ds8hI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388777756417.75419874560885; Wed, 30 Aug 2023 02:46:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHix-000577-N0; Wed, 30 Aug 2023 05:42:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiX-0003di-IW for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiS-0001gg-9I for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:28 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-498-osopQbWXNfq28GiHSuhh0A-1; Wed, 30 Aug 2023 05:42:20 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2DC86803F3A for ; Wed, 30 Aug 2023 09:42:20 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15B94140E96E; Wed, 30 Aug 2023 09:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388542; 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=WQae6YZWZquYjdjql9P0b0vhegCU4iorHjDj1iKlBU8=; b=JDuWXoV765eG0HbGVyGDIC9O8HSltd+wye2BJLMWwGb9/WuEI5kyeo2OW7a0mxWQHQeUNy LCgiZsWDo8+XFGquUFSL1ZlysMcAeKtN4A/wBvbaMbX4hfmXW6nNlTnOZhuCyT4PFJOTho UgUeZ0s1+sJyKVjYIVg98yoR1VNFXU8= X-MC-Unique: osopQbWXNfq28GiHSuhh0A-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 53/67] ui: add pixman-compat.h Date: Wed, 30 Aug 2023 13:38:27 +0400 Message-ID: <20230830093843.3531473-54-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388779562100013 From: Marc-Andr=C3=A9 Lureau This is a tiny subset of PIXMAN API that is used pervasively in QEMU codebase to manage images and identify the underlying format. It doesn't seems worth to wrap this in a QEMU-specific API. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/pixman-compat.h | 190 +++++++++++++++++++++++++++++++++++++ include/ui/qemu-pixman.h | 4 + 2 files changed, 194 insertions(+) create mode 100644 include/ui/pixman-compat.h diff --git a/include/ui/pixman-compat.h b/include/ui/pixman-compat.h new file mode 100644 index 0000000000..e511c8b946 --- /dev/null +++ b/include/ui/pixman-compat.h @@ -0,0 +1,190 @@ +/* + * SPDX-License-Identifier: MIT + * + * Tiny subset of PIXMAN API commonly used by QEMU. + * + * Copyright 1987, 1988, 1989, 1998 The Open Group + * Copyright 1987, 1988, 1989 Digital Equipment Corporation + * Copyright 1999, 2004, 2008 Keith Packard + * Copyright 2000 SuSE, Inc. + * Copyright 2000 Keith Packard, member of The XFree86 Project, Inc. + * Copyright 2004, 2005, 2007, 2008, 2009, 2010 Red Hat, Inc. + * Copyright 2004 Nicholas Miell + * Copyright 2005 Lars Knoll & Zack Rusin, Trolltech + * Copyright 2005 Trolltech AS + * Copyright 2007 Luca Barbato + * Copyright 2008 Aaron Plattner, NVIDIA Corporation + * Copyright 2008 Rodrigo Kumpera + * Copyright 2008 Andr=C3=A9 Tupinamb=C3=A1 + * Copyright 2008 Mozilla Corporation + * Copyright 2008 Frederic Plourde + * Copyright 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright 2009, 2010 Nokia Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software= "), + * to deal in the Software without restriction, including without limitati= on + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the ne= xt + * paragraph) shall be included in all copies or substantial portions of t= he + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef PIXMAN_COMPAT_H +#define PIXMAN_COMPAT_H + +#define PIXMAN_TYPE_OTHER 0 +#define PIXMAN_TYPE_ARGB 2 +#define PIXMAN_TYPE_ABGR 3 +#define PIXMAN_TYPE_BGRA 8 +#define PIXMAN_TYPE_RGBA 9 + +#define PIXMAN_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | \ + ((type) << 16) | \ + ((a) << 12) | \ + ((r) << 8) | \ + ((g) << 4) | \ + ((b))) + +#define PIXMAN_FORMAT_RESHIFT(val, ofs, num) \ + (((val >> (ofs)) & ((1 << (num)) - 1)) << ((val >> 22) & 3)) + +#define PIXMAN_FORMAT_BPP(f) PIXMAN_FORMAT_RESHIFT(f, 24, 8) +#define PIXMAN_FORMAT_TYPE(f) (((f) >> 16) & 0x3f) +#define PIXMAN_FORMAT_A(f) PIXMAN_FORMAT_RESHIFT(f, 12, 4) +#define PIXMAN_FORMAT_R(f) PIXMAN_FORMAT_RESHIFT(f, 8, 4) +#define PIXMAN_FORMAT_G(f) PIXMAN_FORMAT_RESHIFT(f, 4, 4) +#define PIXMAN_FORMAT_B(f) PIXMAN_FORMAT_RESHIFT(f, 0, 4) +#define PIXMAN_FORMAT_DEPTH(f) (PIXMAN_FORMAT_A(f) + \ + PIXMAN_FORMAT_R(f) + \ + PIXMAN_FORMAT_G(f) + \ + PIXMAN_FORMAT_B(f)) + +typedef enum { + /* 32bpp formats */ + PIXMAN_a8r8g8b8 =3D PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8), + PIXMAN_x8r8g8b8 =3D PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8), + PIXMAN_a8b8g8r8 =3D PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8), + PIXMAN_x8b8g8r8 =3D PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8), + PIXMAN_b8g8r8a8 =3D PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,8,8,8,8), + PIXMAN_b8g8r8x8 =3D PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8), + PIXMAN_r8g8b8a8 =3D PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,8,8,8,8), + PIXMAN_r8g8b8x8 =3D PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,0,8,8,8), + /* 24bpp formats */ + PIXMAN_r8g8b8 =3D PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB,0,8,8,8), + PIXMAN_b8g8r8 =3D PIXMAN_FORMAT(24,PIXMAN_TYPE_ABGR,0,8,8,8), + /* 16bpp formats */ + PIXMAN_r5g6b5 =3D PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,6,5), + PIXMAN_a1r5g5b5 =3D PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,1,5,5,5), + PIXMAN_x1r5g5b5 =3D PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,5,5), +} pixman_format_code_t; + +typedef struct pixman_image pixman_image_t; + +typedef void (* pixman_image_destroy_func_t)(pixman_image_t *image, void *= data); + +struct pixman_image { + int ref_count; + pixman_format_code_t format; + int width; + int height; + int stride; + uint8_t *data; + pixman_image_destroy_func_t destroy_func; + void *destroy_data; +}; + +typedef struct pixman_color { + uint16_t red; + uint16_t green; + uint16_t blue; + uint16_t alpha; +} pixman_color_t; + +static inline pixman_image_t *pixman_image_create_bits(pixman_format_code_= t format, + int width, + int height, + uint32_t *bits, + int rowstride_bytes) +{ + pixman_image_t *i =3D g_new0(pixman_image_t, 1); + + i->width =3D width; + i->height =3D height; + i->stride =3D rowstride_bytes ?: width * DIV_ROUND_UP(PIXMAN_FORMAT_BP= P(format), 8); + i->format =3D format; + i->data =3D bits ?: g_malloc0(rowstride_bytes * height); + i->ref_count =3D 1; + + return i; +} + +static inline pixman_image_t *pixman_image_ref(pixman_image_t *i) +{ + i->ref_count++; + return i; +} + +static inline bool pixman_image_unref(pixman_image_t *i) +{ + i->ref_count--; + + if (i->ref_count =3D=3D 0) { + if (i->destroy_func) { + i->destroy_func (i, i->destroy_data); + g_free(i->data); + g_free(i); + } + + return true; + } + + return false; +} + +static inline void pixman_image_set_destroy_function(pixman_image_t *i, + pixman_image_destroy_= func_t func, + void *data) + +{ + i->destroy_func =3D func; + i->destroy_data =3D data; +} + +static inline uint8_t* pixman_image_get_data(pixman_image_t *i) +{ + return i->data; +} + +static inline int pixman_image_get_height(pixman_image_t *i) +{ + return i->height; +} + +static inline int pixman_image_get_width(pixman_image_t *i) +{ + return i->width; +} + +static inline int pixman_image_get_stride(pixman_image_t *i) +{ + return i->stride; +} + +static inline pixman_format_code_t pixman_image_get_format(pixman_image_t = *i) +{ + return i->format; +} + +#endif /* PIXMAN_COMPAT_H */ diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h index c5a0911cc7..9c693df8dd 100644 --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@ -6,11 +6,15 @@ #ifndef QEMU_PIXMAN_H #define QEMU_PIXMAN_H =20 +#ifdef CONFIG_PIXMAN /* pixman-0.16.0 headers have a redundant declaration */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wredundant-decls" #include #pragma GCC diagnostic pop +#else +#include "pixman-compat.h" +#endif =20 /* * pixman image formats are defined to be native endian, --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693389024; cv=none; d=zohomail.com; s=zohoarc; b=nBIRET3oO1R42k7A5zii+iItyjbZkOMOZXRfHQ+LozaJnRR9qbZbVDLPnFauyY186DHgbjEgp61s+5tj2l2mtGsWOCgZpD8gQ1McJAE24sKHXpiHVeclnSEYNBMPIfQQAQ/6XISqsvjrJb9SkRiLM7rbV+DVQBQbKrvRYWPDriE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693389024; 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=ROrHXpEO3Zu08wBSpmJok6KEwDh9xXGjqpAm9j0eWMA=; b=RtR+6ONozOwdYl85JLHCK4yJM1Uzkn61TYPh53HHlChET1ElrJMS+fddNyzDsBMSPuzcGa78wa7Oyvhq7TYzRf5M3gRFZZ33DknEi4GS2J5f7hjJuXnS1lu6jFQ6Ki61yJMkE/M8q9PLKnAo5tPeSaR/pj404cH9NYBmeJU6vQg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693389024880928.172049018001; Wed, 30 Aug 2023 02:50:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHiy-0005Iv-CY; Wed, 30 Aug 2023 05:42:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiZ-0003hv-Hr for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiV-0001iw-Cw for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:30 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-uD11gYBBNHGq96dsw1mESg-1; Wed, 30 Aug 2023 05:42:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EAF5D3C100B5 for ; Wed, 30 Aug 2023 09:42:23 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 391E963F6C; Wed, 30 Aug 2023 09:42:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388545; 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=ROrHXpEO3Zu08wBSpmJok6KEwDh9xXGjqpAm9j0eWMA=; b=d+lvqsr8T946Xlh4B71DDKT1ww4dwTNBZ8XKJLRYrIw2mfIVDuiuDkmUR42v4RweGyTkog PNumNdwhmPd2CVxehAmC6DkwwS8RejxyzxQeGk8PDLtyQc1WQd6CavNMJMM/p6sQDOOyND iMEBlPrjWWW28gTyOzmwMmsAVjgTi6c= X-MC-Unique: uD11gYBBNHGq96dsw1mESg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 54/67] ui/vc: console-vc requires PIXMAN Date: Wed, 30 Aug 2023 13:38:28 +0400 Message-ID: <20230830093843.3531473-55-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693389026289100015 From: Marc-Andr=C3=A9 Lureau Add stubs for the fallback paths. Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/console-vc-stubs.c | 59 +++++++++++++++++++++++++++++++++++++++++++ ui/meson.build | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 ui/console-vc-stubs.c diff --git a/ui/console-vc-stubs.c b/ui/console-vc-stubs.c new file mode 100644 index 0000000000..76ea880d27 --- /dev/null +++ b/ui/console-vc-stubs.c @@ -0,0 +1,59 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * QEMU VC stubs + */ +#include "qemu/osdep.h" + +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "qemu/option.h" +#include "chardev/char.h" +#include "ui/console-priv.h" + +void qemu_text_console_select(QemuTextConsole *c) +{ +} + +const char * qemu_text_console_get_label(QemuTextConsole *c) +{ + return NULL; +} + +void qemu_text_console_update_cursor(void) +{ +} + +void qemu_text_console_handle_keysym(QemuTextConsole *s, int keysym) +{ +} + +#define TYPE_CHARDEV_VC "chardev-vc" + +static void vc_chr_parse(QemuOpts *opts, ChardevBackend *backend, Error **= errp) +{ + const char *id =3D qemu_opts_id(opts); + + warn_report("%s: this is a dummy VC driver. " + "Use '-nographic' or a different chardev.", id); +} + +static void char_vc_class_init(ObjectClass *oc, void *data) +{ + ChardevClass *cc =3D CHARDEV_CLASS(oc); + + cc->parse =3D vc_chr_parse; +} + +static const TypeInfo char_vc_type_info =3D { + .name =3D TYPE_CHARDEV_VC, + .parent =3D TYPE_CHARDEV, + .class_init =3D char_vc_class_init, +}; + +void qemu_console_early_init(void) +{ + /* set the default vc driver */ + if (!object_class_by_name(TYPE_CHARDEV_VC)) { + type_register(&char_vc_type_info); + } +} diff --git a/ui/meson.build b/ui/meson.build index 0a1e8272a3..3085e10a72 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -6,7 +6,6 @@ system_ss.add(png) system_ss.add(files( 'clipboard.c', 'console.c', - 'console-vc.c', 'cursor.c', 'input-keymap.c', 'input-legacy.c', @@ -19,6 +18,7 @@ system_ss.add(files( 'ui-qmp-cmds.c', 'util.c', )) +system_ss.add(when: pixman, if_true: files('console-vc.c'), if_false: file= s('console-vc-stubs.c')) if dbus_display system_ss.add(files('dbus-module.c')) endif --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388778; cv=none; d=zohomail.com; s=zohoarc; b=CkfpOQ/lurd9dyysSPbaPidF8O28efkU9A6uO/+1t7PonDKyH0N44JcKLEx2rQZdktgVGEqbxdhmJRUuJPEiTbowtgkqcDjifLOPoEYPFXevXFA+z4VTn+YD1LSui+k7MsoxfhaVp0NIXBRtZzq9p+yWxEEkXRMD01kJ6cy6mII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388778; 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=chWSO6X8vyK4o0XUVN0AJ+0L1O/tB3GJG5P1z2/f7Qs=; b=YFA+EUlAb60GzUjiEoIw4ZukIGulxF+OfJqT+C1tCMsY03J9QiYpHGzxcdMx5/dIsWPsQo1Zrd3OFhH7SwtMek/t7JC+sLvW12Mw8435VOEdWTl27xT7xJp/Yw2GDDnL6dDUI4iyTYUQKrwk6HAZML1faXBZneS/uod6aEAT8tQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388778343632.4416206264815; Wed, 30 Aug 2023 02:46:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHih-0004EV-Bp; Wed, 30 Aug 2023 05:42:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHib-0003vA-Pz for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiZ-0001ku-8g for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:33 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-690-l_-YZW8FObykq8eBPPNV0A-1; Wed, 30 Aug 2023 05:42:27 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D1581C07822; Wed, 30 Aug 2023 09:42:27 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAD2B40C6F4C; Wed, 30 Aug 2023 09:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388549; 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=chWSO6X8vyK4o0XUVN0AJ+0L1O/tB3GJG5P1z2/f7Qs=; b=HzrgT7OWzQnpzwSFBXp93MuTN9L78zmkpe9FgSz/nu2S8WLjiidVg+HD9trbzezqx3Gur+ yLM66U3UIorK7V1R94YAmVveEDl/uZEtDgQ/cBz7QOO3bWUsYXUuCbuExxruIYJeicL1Xh EFJWGPpAVf8NlRdA5QlF7eZ0fXEqv8U= X-MC-Unique: l_-YZW8FObykq8eBPPNV0A-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Dr. David Alan Gilbert" , Eric Blake , Markus Armbruster Subject: [PATCH 55/67] qmp/hmp: disable screendump if PIXMAN is missing Date: Wed, 30 Aug 2023 13:38:29 +0400 Message-ID: <20230830093843.3531473-56-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388780480100027 From: Marc-Andr=C3=A9 Lureau The command requires color conversion and line-by-line feeding. We could have a simple fallback for simple formats though. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- qapi/ui.json | 3 ++- ui/ui-hmp-cmds.c | 2 ++ ui/ui-qmp-cmds.c | 2 ++ hmp-commands.hx | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/qapi/ui.json b/qapi/ui.json index 006616aa77..e74cc3efb6 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -200,7 +200,8 @@ { 'command': 'screendump', 'data': {'filename': 'str', '*device': 'str', '*head': 'int', '*format': 'ImageFormat'}, - 'coroutine': true } + 'coroutine': true, + 'if': 'CONFIG_PIXMAN' } =20 ## # =3D=3D Spice diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c index c671389473..26c8ced1f2 100644 --- a/ui/ui-hmp-cmds.c +++ b/ui/ui-hmp-cmds.c @@ -437,6 +437,7 @@ void sendkey_completion(ReadLineState *rs, int nb_args,= const char *str) } } =20 +#ifdef CONFIG_PIXMAN void coroutine_fn hmp_screendump(Monitor *mon, const QDict *qdict) { @@ -458,6 +459,7 @@ hmp_screendump(Monitor *mon, const QDict *qdict) end: hmp_handle_error(mon, err); } +#endif =20 void hmp_client_migrate_info(Monitor *mon, const QDict *qdict) { diff --git a/ui/ui-qmp-cmds.c b/ui/ui-qmp-cmds.c index debc07d678..d772e1cb7f 100644 --- a/ui/ui-qmp-cmds.c +++ b/ui/ui-qmp-cmds.c @@ -212,6 +212,7 @@ void qmp_client_migrate_info(const char *protocol, cons= t char *hostname, error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "'spice'"); } =20 +#ifdef CONFIG_PIXMAN #ifdef CONFIG_PNG /** * png_save: Take a screenshot as PNG @@ -391,3 +392,4 @@ qmp_screendump(const char *filename, const char *device, } } } +#endif /* CONFIG_PIXMAN */ diff --git a/hmp-commands.hx b/hmp-commands.hx index 2cbd0f77a0..bfb2e2d5e2 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -252,6 +252,7 @@ SRST =20 ERST =20 +#ifdef CONFIG_PIXMAN { .name =3D "screendump", .args_type =3D "filename:F,format:-fs,device:s?,head:i?", @@ -267,6 +268,7 @@ SRST ``screendump`` *filename* Save screen into PPM image *filename*. ERST +#endif =20 { .name =3D "logfile", --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693389022; cv=none; d=zohomail.com; s=zohoarc; b=NIL1OqRsv714yJU7rJoVS4WH9OKBvGGNfFn/I6jt700qGXANuM1RLSSCyRDcTy79151qKUFSrXWDxSSRF0XC768crl77Jbkz3m/19tQ4xwK2rdbw9tKL3QSVAfPAU+Jvjt95JSPiSHS909/lbQZSGlaAsSbsvJWCcvwxwrNrY+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693389022; 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=eQHmC7587AX8nFVPxeECguZ4m8Q/iR2kxUKQWtBNVXY=; b=O32Ifj1Ncdgpx3SyhE7SiXXzDZZcwREJm8saZRltHGs/jWKyX5Y1T6mB/N+5NZlOwibtiv0cEH4osXXwTChX2SrfdxhWdJeBWBOYY6POInFghRcFUks9qORdsryRFFeS/3M+wReHen8hAi9+tTJWw932Uf8a6BR8Cr9iQTZGC7A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693389021994372.1718207257619; Wed, 30 Aug 2023 02:50:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHiu-0004ko-SH; Wed, 30 Aug 2023 05:42:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHie-00042E-IL for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHic-0001pn-9t for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:36 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-207-8WG8XbY7MGS3gSP5JoUx2Q-1; Wed, 30 Aug 2023 05:42:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 45F3980602D for ; Wed, 30 Aug 2023 09:42:31 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66EA063F6C; Wed, 30 Aug 2023 09:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388553; 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=eQHmC7587AX8nFVPxeECguZ4m8Q/iR2kxUKQWtBNVXY=; b=iyv0eR3uvoXCFTKVgmAEIqXXcNykh8s2lGGEg27phXG62uQPDlc9N3GpAF9uqcws7skYcN T0wjB+DQABncKUZ4PfGkBtlfcoTn5numjIb15dRgGDFuOyjG7J7NZfEXPU5jiO8j5V+2ea QKI7kTSqEvx8VH+14kBx8CFJN0o34Jw= X-MC-Unique: 8WG8XbY7MGS3gSP5JoUx2Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" Subject: [PATCH 56/67] virtio-gpu: replace PIXMAN for region/rect test Date: Wed, 30 Aug 2023 13:38:30 +0400 Message-ID: <20230830093843.3531473-57-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693389024234100005 From: Marc-Andr=C3=A9 Lureau Use a simpler implementation for rectangle geometry & intersect, drop the need for (more complex) PIXMAN functions. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/rect.h | 55 +++++++++++++++++++++++++++++++++++++++++ hw/display/virtio-gpu.c | 30 +++++++++------------- 2 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 include/ui/rect.h diff --git a/include/ui/rect.h b/include/ui/rect.h new file mode 100644 index 0000000000..63edf7a39d --- /dev/null +++ b/include/ui/rect.h @@ -0,0 +1,55 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef QEMU_RECT_H +#define QEMU_RECT_H + +#include +#include + +typedef struct QemuRect { + int16_t x; + int16_t y; + uint16_t width; + uint16_t height; +} QemuRect; + +static inline void qemu_rect_init(QemuRect* rect, int16_t x, int16_t y, ui= nt16_t width, uint16_t height) +{ + rect->x =3D x; + rect->y =3D x; + rect->width =3D width; + rect->height =3D height; +} + +static inline void qemu_rect_translate(QemuRect* rect, int16_t dx, int16_t= dy) +{ + rect->x +=3D dx; + rect->y +=3D dy; +} + +static inline bool qemu_rect_intersect(const QemuRect* a, const QemuRect* = b, QemuRect *res) +{ + int16_t x1, x2, y1, y2; + + x1 =3D MAX(a->x, b->x); + y1 =3D MAX(a->y, b->y); + x2 =3D MIN(a->x + a->width, b->x + b->width); + y2 =3D MIN(a->y + a->height, b->y + b->height); + + if (x1 >=3D x2 || y1 >=3D y2) { + if (res) { + qemu_rect_init(res, 0, 0, 0, 0); + } + + return false; + } + + if (res) { + qemu_rect_init(res, x1, y1, x2 - x1, y2 - y1); + } + + return true; +} + +#endif diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index bbd5c6561a..e77187a610 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -16,6 +16,7 @@ #include "qemu/iov.h" #include "sysemu/cpus.h" #include "ui/console.h" +#include "ui/rect.h" #include "trace.h" #include "sysemu/dma.h" #include "sysemu/sysemu.h" @@ -507,7 +508,7 @@ static void virtio_gpu_resource_flush(VirtIOGPU *g, struct virtio_gpu_simple_resource *res; struct virtio_gpu_resource_flush rf; struct virtio_gpu_scanout *scanout; - pixman_region16_t flush_region; + QemuRect flush_rect; bool within_bounds =3D false; bool update_submitted =3D false; int i; @@ -569,34 +570,25 @@ static void virtio_gpu_resource_flush(VirtIOGPU *g, return; } =20 - pixman_region_init_rect(&flush_region, - rf.r.x, rf.r.y, rf.r.width, rf.r.height); + qemu_rect_init(&flush_rect, rf.r.x, rf.r.y, rf.r.width, rf.r.height); for (i =3D 0; i < g->parent_obj.conf.max_outputs; i++) { - pixman_region16_t region, finalregion; - pixman_box16_t *extents; + QemuRect rect; =20 if (!(res->scanout_bitmask & (1 << i))) { continue; } scanout =3D &g->parent_obj.scanout[i]; =20 - pixman_region_init(&finalregion); - pixman_region_init_rect(®ion, scanout->x, scanout->y, - scanout->width, scanout->height); + qemu_rect_init(&rect, scanout->x, scanout->y, + scanout->width, scanout->height); =20 - pixman_region_intersect(&finalregion, &flush_region, ®ion); - pixman_region_translate(&finalregion, -scanout->x, -scanout->y); - extents =3D pixman_region_extents(&finalregion); /* work out the area we need to update for each console */ - dpy_gfx_update(g->parent_obj.scanout[i].con, - extents->x1, extents->y1, - extents->x2 - extents->x1, - extents->y2 - extents->y1); - - pixman_region_fini(®ion); - pixman_region_fini(&finalregion); + if (qemu_rect_intersect(&flush_rect, &rect, &rect)) { + qemu_rect_translate(&rect, -scanout->x, -scanout->y); + dpy_gfx_update(g->parent_obj.scanout[i].con, + rect.x, rect.y, rect.width, rect.height); + } } - pixman_region_fini(&flush_region); } =20 static void virtio_unref_resource(pixman_image_t *image, void *data) --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388625; cv=none; d=zohomail.com; s=zohoarc; b=ESThnIJA28o7Vqzow/xPlV82a7TmAB/AcSm8/ulrscu3P+5ziTnOj5ARJ8T3OfILEXCBLB3ijkvqfpDFCfJlhUVkejj5hBzMPfN49BULjLJ055tWcmZm8CxNHWs/PeT4ssrsKPvDQzuzGwlD2IuVw3KdzPOqrPRi0pp2AMPWKZs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388625; 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=JoJiUGX2xC5n/WefUe/Eu2Goyhe7yivU/6JiEjJmGiA=; b=D3v0R80Nb9ZBe7GXUiS2YgK6L5Su9inLKmC3HJsluLBg02E8EviAHVgfEqq+xcdiyCIOCYcSuCRgcv4MmMyQv+5i+q5g4c5pf1VgNDvB86XAakf2qVxX70JGYunFuMOt4YOR+zHA0bllSLjpXy1XlRQMo/2hWEtAQKIo1GDl65s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388625914388.1101102180793; Wed, 30 Aug 2023 02:43:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHiw-0004w3-7Q; Wed, 30 Aug 2023 05:42:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHih-0004Ku-K5 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHif-0001r0-F1 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:39 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-377-8a_5_PDUMUy9_Uh6epc3dQ-1; Wed, 30 Aug 2023 05:42:35 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B70C18030AC for ; Wed, 30 Aug 2023 09:42:34 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1695240C6F4C; Wed, 30 Aug 2023 09:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388556; 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=JoJiUGX2xC5n/WefUe/Eu2Goyhe7yivU/6JiEjJmGiA=; b=Zv5xBnshDZhiN2zrQMg910gzRqzi22moDdQjlMgo6dxbuE7+cG/pH0BP7jBoNywNg1uOza neBjKpQzrMEm+xHR6QD8pg34bAR0L4Fit4g2fZHg1C0qBnILHB8eYInoy3d/EDma+yIvHE Yo5mQsI4Npge75587rAmjFbT8E5KcUw= X-MC-Unique: 8a_5_PDUMUy9_Uh6epc3dQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 57/67] ui/console: when PIXMAN is unavailable, don't draw placeholder msg Date: Wed, 30 Aug 2023 13:38:31 +0400 Message-ID: <20230830093843.3531473-58-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388627779100003 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/console.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/console.c b/ui/console.c index da341f08da..c4cd70318e 100644 --- a/ui/console.c +++ b/ui/console.c @@ -584,6 +584,7 @@ DisplaySurface *qemu_create_placeholder_surface(int w, = int h, const char *msg) { DisplaySurface *surface =3D qemu_create_displaysurface(w, h); +#ifdef CONFIG_PIXMAN pixman_color_t bg =3D QEMU_PIXMAN_COLOR_BLACK; pixman_color_t fg =3D QEMU_PIXMAN_COLOR_GRAY; pixman_image_t *glyph; @@ -598,6 +599,7 @@ DisplaySurface *qemu_create_placeholder_surface(int w, = int h, x+i, y, FONT_WIDTH, FONT_HEIGHT); qemu_pixman_image_unref(glyph); } +#endif surface->flags |=3D QEMU_PLACEHOLDER_FLAG; return surface; } --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693389023; cv=none; d=zohomail.com; s=zohoarc; b=foMBlMtWK8W0Ym6Plfsf90lyhAE4dX0MDe7SQ8XXlDHQS4Jso1vm18TeWpOQHctPVfOH7KP84EeEEMumXSL5YydKHaqBG9cztV4ufcvmbi8eePOzOZSEV2jj6ROO1mj2k+D3Q/krj9fgFOsWxdasFyV+H6yfZMYYbYYVVPRbx0w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693389023; 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=R7Rjbj3yIYsj6ikmcMsRx0VpZzmrPwjP7vaF2CrAvNs=; b=b//wzRn5VZIdolI7h5DCVfyxqywJ/KP7DUAMEoNynwMWyKR7nPtt+zyJvhkdto3FhheSL6U0zvbhsciQLBnhOkO12p6m8KDnczG0eOrvuYF5w6l/P6piVCMuCEZNTWGh1rRtjapFALQN1t8kjKVZewV0ktgLiC86L6leJCv07y0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693389023211166.21850870844503; Wed, 30 Aug 2023 02:50:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHiy-0005P8-ML; Wed, 30 Aug 2023 05:42:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHim-0004YR-QO for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHik-0001sw-8I for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:44 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-312-uOSGiX2XNQuBr8lxNxH-rA-1; Wed, 30 Aug 2023 05:42:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C096803F3A for ; Wed, 30 Aug 2023 09:42:38 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97B4E6B2AC; Wed, 30 Aug 2023 09:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388561; 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=R7Rjbj3yIYsj6ikmcMsRx0VpZzmrPwjP7vaF2CrAvNs=; b=jVwi6S4UpKfCsuIfJxBCTsAhhQGYuBG8ve9ShlvQlYMH199h3vYEnOfE+SCD2L51wEB/0M vT3gGleKcyE9h/o7hQBQJepfeJ8ibLN0w2Kv9NPssXr/+fyHT4wHo0LOXJz9Ww0sdM3eMJ +mUFEIxYQ2ScGSlzA3MY7l7Z2UJhsO4= X-MC-Unique: uOSGiX2XNQuBr8lxNxH-rA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" Subject: [PATCH 58/67] vhost-user-gpu: skip VHOST_USER_GPU_UPDATE when !PIXMAN Date: Wed, 30 Aug 2023 13:38:32 +0400 Message-ID: <20230830093843.3531473-59-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693389023535100003 From: Marc-Andr=C3=A9 Lureau This simply means that 2d drawing updates won't be handled, but 3d should work. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/display/vhost-user-gpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index e8ee03094e..f57c893970 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -292,6 +292,7 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUse= rGpuMsg *msg) dpy_gl_update(con, m->x, m->y, m->width, m->height); break; } +#ifdef CONFIG_PIXMAN case VHOST_USER_GPU_UPDATE: { VhostUserGpuUpdate *m =3D &msg->payload.update; =20 @@ -319,6 +320,7 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUse= rGpuMsg *msg) } break; } +#endif default: g_warning("unhandled message %d %d", msg->request, msg->size); } --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388631; cv=none; d=zohomail.com; s=zohoarc; b=iCsaiSUcVDI923phU0GzuySap8FIJZATslF0IDYMvmCAgp5yeiuZaL4chVF/u78Vu4x2obOMiJ5tOSLt2gL463vPSH6GUnsjZByCPIhChcCRtk3tqVkQvbb448KVr+xE+SO4A+Zmi3N8z1d5ALKO5wsZTrs6RqWR0T6CrwqRxCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388631; 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=4SZ/OasRCxgbsCQYI36rdtboQkh+0BPjMMpQl7MHELU=; b=hupf81eOarRHBT9FE9/OlgfT1B+zirQFUCKx6ng0N3yBozeGlreaPem27jnq+iIWLNU+1yFANlJI5RXrua+a/rllYNTKa9Od7oT+nNGmKD8wL0EhZrwfjDgQghc6LY+Nfu/zCjwK3HJQ9J8goDvxsLunAbPj8J9HvN9L4ETOrvA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16933886311881011.6768909401803; Wed, 30 Aug 2023 02:43:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHj0-0005hj-8c; Wed, 30 Aug 2023 05:42:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHir-0004Zy-0u for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHio-0001vB-Ul for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:48 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-367-CxG68KVvPMSLkFog5MXbjA-1; Wed, 30 Aug 2023 05:42:44 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BBBAE2999B3B for ; Wed, 30 Aug 2023 09:42:41 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F1F440C2063; Wed, 30 Aug 2023 09:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388566; 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=4SZ/OasRCxgbsCQYI36rdtboQkh+0BPjMMpQl7MHELU=; b=AHOWfcGGKbxW3HJIN0DR7jkpDz9qyUqPtCY8p9VGuXzX7KNnF89OxUa8km9EmUR8oYY60y 6HnN/8zPsUJrBUN1k7V5c9+fb4PkiK+jFjeXyPEcUm5gYB8cMGeQs6vp7HAexL5Py6K90F Y7w0kukDCzM3VJVYzk/lxVeH8xEuDP8= X-MC-Unique: CxG68KVvPMSLkFog5MXbjA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 59/67] ui/gl: opengl doesn't require PIXMAN Date: Wed, 30 Aug 2023 13:38:33 +0400 Message-ID: <20230830093843.3531473-60-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388633398100001 From: Marc-Andr=C3=A9 Lureau The QEMU fallback covers the requirements. We still need the flags of header inclusion with CONFIG_PIXMAN. Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/meson.build b/ui/meson.build index 3085e10a72..7c99613950 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -60,8 +60,8 @@ endif system_ss.add(opengl) if opengl.found() opengl_ss =3D ss.source_set() - opengl_ss.add(gbm) - opengl_ss.add(when: [opengl, pixman], + opengl_ss.add(gbm, pixman) + opengl_ss.add(when: [opengl], if_true: files('shader.c', 'console-gl.c', 'egl-helpers.c',= 'egl-context.c')) ui_modules +=3D {'opengl' : opengl_ss} endif --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388669; cv=none; d=zohomail.com; s=zohoarc; b=ZRmrk2/H3e4fUL5Nl4xh4uw5mWGHnKGAeOdoGqFZPdcltrZebHx8S+Y/dS86nBPWdea8n+sviWzxlFm9DMh89oVxFiuqQEqClyLmbRajMTGoNbELetKwyDwC3TeOq6oK98//89VVij2NwjHlBqMa9iejN9vlo4rA2aEOLD75a+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388669; 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=AMMRaerQlihVOw3Lu4fXWsKdhjcg7w4aRDw0yDXhlU0=; b=P3Pd2Je3dKDh4yCBicw1GlzkuPsDEQno5640aLBs0kjxUu5OJxL2Ijryy/4uOC68NkNXEqqJ+8fHvFpGSf33xtHtSpwOLMq3gsgKyXLhnqmhKU85M/pPlTCilIMGsJzP+0LNkP48t6NMOQDmhPNAiveaCNEBVI5tCyFVXRrMJss= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388669887707.775764463942; Wed, 30 Aug 2023 02:44:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHj3-00066S-1j; Wed, 30 Aug 2023 05:43:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHit-0004jZ-H4 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHir-0001x3-DW for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:51 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-180-CxyZdY85OGi7LkY4aKLjTQ-1; Wed, 30 Aug 2023 05:42:45 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 58E4F2999B2E; Wed, 30 Aug 2023 09:42:45 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A3FFC15BAE; Wed, 30 Aug 2023 09:42:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388568; 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=AMMRaerQlihVOw3Lu4fXWsKdhjcg7w4aRDw0yDXhlU0=; b=LSXoUg8XDYQaiowsAvRvGRG6zHMKhjKOAc98y58cFpl+klGSOO9Uzip8eM3qvJ8Dg/zIhv hGWGep3uVoPo6xAu7+OZUbwk5jxCrdQamA7tVaG3RUyUmkINamAIp6czg+KMhJD/JCRpfb f92lEMRSxklMbS7KcAnSspgKqSWp4kQ= X-MC-Unique: CxyZdY85OGi7LkY4aKLjTQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 60/67] ui/vnc: VNC requires PIXMAN Date: Wed, 30 Aug 2023 13:38:34 +0400 Message-ID: <20230830093843.3531473-61-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388671855100006 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- meson.build | 5 ++++- ui/meson.build | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 3bd7046099..ceafbc5b73 100644 --- a/meson.build +++ b/meson.build @@ -1549,7 +1549,10 @@ endif vnc =3D not_found jpeg =3D not_found sasl =3D not_found -if get_option('vnc').allowed() and have_system +if get_option('vnc') \ + .disable_auto_if(not pixman.found()) \ + .require(pixman.found()) \ + .allowed() and have_system vnc =3D declare_dependency() # dummy dependency jpeg =3D dependency('libjpeg', required: get_option('vnc_jpeg'), method: 'pkg-config') diff --git a/ui/meson.build b/ui/meson.build index 7c99613950..b3525ef064 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -46,8 +46,8 @@ vnc_ss.add(files( )) vnc_ss.add(zlib, jpeg, gnutls) vnc_ss.add(when: sasl, if_true: files('vnc-auth-sasl.c')) -system_ss.add_all(when: vnc, if_true: vnc_ss) -system_ss.add(when: vnc, if_false: files('vnc-stubs.c')) +system_ss.add_all(when: [vnc, pixman], if_true: vnc_ss) +system_ss.add(when: [vnc, pixman], if_false: files('vnc-stubs.c')) =20 ui_modules =3D {} =20 --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388778; cv=none; d=zohomail.com; s=zohoarc; b=YzDScTRhD3aMIYI0HUTLFiI6lKvWOsXEWQxr1eTpGqnAl5m2q/xCUOQF6ewcFW9yKvlfxFxnyM/LBdZamDSAIPNCxTa9O6wqa/WDLNRizpT5Boi/yyM1Bo3dTno3yl83zG8ShQRypFEvTm5B6+V66ee2WBk3zFiTLkKMzr8YChw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388778; 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=gk8mJory9ih5aPHKAa+vPL/OPoDz+HNqeQTFiLqmu4I=; b=Q0aiv94UkUkBouSfVAMLPfdT955uCd7WFP36uDW3XWs8jPJwgEzg+GTAvM/83omDZyqyQqwd2PHrfjbWFepMM3Fg9/MjAKSGzRRxNz1UClQ5YE7QdTCwcRHxYSIinHjQWc4Qke4LKms3A4CUakAacaJO+1kPLoR8cMrE2qKYesA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388778861230.82897562358028; Wed, 30 Aug 2023 02:46:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHj3-0006AH-Iv; Wed, 30 Aug 2023 05:43:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiw-0004wX-8S for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiu-0001zC-2h for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:53 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-400-4fC4c8S5OKOIPdUJrHCl7g-1; Wed, 30 Aug 2023 05:42:49 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 95E05802C1E for ; Wed, 30 Aug 2023 09:42:49 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24E82492C13; Wed, 30 Aug 2023 09:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388571; 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=gk8mJory9ih5aPHKAa+vPL/OPoDz+HNqeQTFiLqmu4I=; b=IBTAy8ONFWS0nbhpcYgVW5P8uusUbWTAnvpCAJxaJo4d2oAjTYM/DyBg8tmiXTFdSj8s2p 4DM1r2Ex5ZkklqaauK48BEH3kr8cCINfRF0XwpBZb9xGgzEO4psAUYrz/5Pz/PXoaseIFK AESBKT0oPzc8z0Z5PkylwHjnt0QIdzk= X-MC-Unique: 4fC4c8S5OKOIPdUJrHCl7g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini Subject: [PATCH 61/67] ui/spice: SPICE/QXL requires PIXMAN Date: Wed, 30 Aug 2023 13:38:35 +0400 Message-ID: <20230830093843.3531473-62-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388779533100011 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/display/Kconfig | 2 +- ui/meson.build | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/display/Kconfig b/hw/display/Kconfig index 7b3da68d1c..4d8b0cec40 100644 --- a/hw/display/Kconfig +++ b/hw/display/Kconfig @@ -93,7 +93,7 @@ config VGA =20 config QXL bool - depends on SPICE && PCI + depends on SPICE && PCI && PIXMAN select VGA =20 config VIRTIO_GPU diff --git a/ui/meson.build b/ui/meson.build index b3525ef064..08d845d43a 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -133,7 +133,7 @@ if sdl.found() ui_modules +=3D {'sdl' : sdl_ss} endif =20 -if spice.found() +if spice.found() and pixman.found() spice_core_ss =3D ss.source_set() spice_core_ss.add(spice, pixman, files( 'spice-core.c', @@ -141,12 +141,12 @@ if spice.found() 'spice-display.c' )) ui_modules +=3D {'spice-core' : spice_core_ss} -endif =20 -if spice.found() and gio.found() - spice_ss =3D ss.source_set() - spice_ss.add(spice, gio, pixman, files('spice-app.c')) - ui_modules +=3D {'spice-app': spice_ss} + if gio.found() + spice_ss =3D ss.source_set() + spice_ss.add(spice, gio, pixman, files('spice-app.c')) + ui_modules +=3D {'spice-app': spice_ss} + endif endif =20 keymaps =3D [ --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388682; cv=none; d=zohomail.com; s=zohoarc; b=H6urgfUeNuiHM1zCc9Fsaq8i4dEnp+uuulA2561aQcY8ORl2oRC9IK/oOCPm4STB++pl7os0bLWDaRPrevShxxGybR9YkvTxIP8+JsqLmaTZ7GjPde+4bbPj7mMa5f1iOgRxJFq2NDRptEeQ9hqV05Wr/AYJRW3CRqilDSqoIM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388682; 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=1Bsb4hXRmf96angNLdHZdl44fis5oiPsOGPmqN49LKg=; b=nwj9X+BFqXLVc8CJ1URtvLn06alAXCh6PTE2uAUo+6yZCGK7CCQrRy0Vw7Q52ZzHCK4DkkTCcy60hu+h5oyAHJo7V1iOcThGoHf9G76grI0FsISzT7O9npL38itxMAnZZCkWJK6uNQ0rYqDQLvkezYvY+t7oZO3TMowmfqFmGis= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169338868229081.30423033976695; Wed, 30 Aug 2023 02:44:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHj2-000630-CP; Wed, 30 Aug 2023 05:43:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHj0-0005o8-V7 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHiy-0001zq-Np for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:42:58 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-343-LxjJ1EC3NpKOXdmYN6kDjw-1; Wed, 30 Aug 2023 05:42:53 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 59544858EED for ; Wed, 30 Aug 2023 09:42:53 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B0B2401E63; Wed, 30 Aug 2023 09:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388576; 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=1Bsb4hXRmf96angNLdHZdl44fis5oiPsOGPmqN49LKg=; b=jVoDfzimVBOi7RcSKQBsI0A4vCYqFfnIIgnLschEoJRWQ5Pay0AeGRypEnsBPcduXhX7Dw awtvYneE7UMZIaIFRj6U7IdFfIlRaxeJXQKS8x8ZimrdFSvKD917IvuXENb4tM4QZ3IOw+ JGHMxNwv+AHVrWwFEYxZvGbTzPJPT8E= X-MC-Unique: LxjJ1EC3NpKOXdmYN6kDjw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 62/67] ui/gtk: -display gtk requires PIXMAN Date: Wed, 30 Aug 2023 13:38:36 +0400 Message-ID: <20230830093843.3531473-63-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388683717100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/meson.build b/ui/meson.build index 08d845d43a..40dff7b3e0 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -105,7 +105,7 @@ if dbus_display ui_modules +=3D {'dbus' : dbus_ss} endif =20 -if gtk.found() +if gtk.found() and pixman.found() system_ss.add(when: 'CONFIG_WIN32', if_true: files('win32-kbd-hook.c')) =20 gtk_ss =3D ss.source_set() --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693389006; cv=none; d=zohomail.com; s=zohoarc; b=YIJ589qNkIQI62ynKwrxolM8Ib5Qow5M7y94rc0rRk9RO00Uo5e9LL1uV9zTo6DYXApNLW27BEUOtx3I/0j1Ho6IOxs8PIF9dHXLGizMH3R56yBq7inPZrydSIh7UfmSG+EvVhgk1FBk+hsVxl+0e0qRewuye48EyO7OCzndQLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693389006; 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=tRrDCxUd6Z8r8T/BzOI7Pbglh7Lm9c8FNfmbB1n3zyI=; b=kH6jwXrZUUwd+7+EqJ856lnYti2TMj2TAnb8/mfSci6+ZPyUkFNHILkXrnnCbd/947bfXW9uJDytWkLxxh7+7A3sW7UOC5jNAfjeljm+QQYQUPeVnr8gpxabSCevifxsYEX8OXisliHawuci+8IpoPXtqVNdSoULVmmL8+/LtTw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693389006663331.8118721846986; Wed, 30 Aug 2023 02:50:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHj8-0006Lk-GE; Wed, 30 Aug 2023 05:43:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHj3-0006Ak-IT for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:43:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHj1-00020l-24 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:43:01 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-YszIj7liP0Gql2WB5FW6NA-1; Wed, 30 Aug 2023 05:42:57 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED28A806007 for ; Wed, 30 Aug 2023 09:42:56 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A38E401E63; Wed, 30 Aug 2023 09:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388578; 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=tRrDCxUd6Z8r8T/BzOI7Pbglh7Lm9c8FNfmbB1n3zyI=; b=ati+t1c/DW34K3oRG+a3mmqZEo+jxNnAOT7dpkuiVbk5KpwSZhCh1VUXg6Rkzx1njD9Jvv 9Au4YtnQq9GyF3zgVPgPIrcKc+WaEtikXVIx0ppL3zzac8HGC+QupM9+5PzOYHYNbo1LYo eruW/Yisrb9asHRAxcnLA6b7M+m5DY0= X-MC-Unique: YszIj7liP0Gql2WB5FW6NA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 63/67] ui/dbus: do not require PIXMAN Date: Wed, 30 Aug 2023 13:38:37 +0400 Message-ID: <20230830093843.3531473-64-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693389007952100003 From: Marc-Andr=C3=A9 Lureau Implement a fallback path for region 2D update. Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/dbus-listener.c | 62 ++++++++++++++++++++++++++++++---------------- ui/meson.build | 2 +- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 30917271ab..f773c40685 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -562,13 +562,51 @@ static void dbus_gl_gfx_update(DisplayChangeListener = *dcl, } #endif =20 +static void dbus_gfx_update_sub(DBusDisplayListener *ddl, + int x, int y, int w, int h) +{ + pixman_image_t *img; + size_t stride; + GVariant *v_data; + + /* make a copy, since gvariant only handles linear data */ + stride =3D w * DIV_ROUND_UP(PIXMAN_FORMAT_BPP(surface_format(ddl->ds))= , 8); + img =3D pixman_image_create_bits(surface_format(ddl->ds), + w, h, NULL, stride); +#ifdef CONFIG_PIXMAN + pixman_image_composite(PIXMAN_OP_SRC, ddl->ds->image, NULL, img, + x, y, 0, 0, 0, 0, w, h); +#else + { + uint8_t *src =3D pixman_image_get_data(ddl->ds->image); + uint8_t *dst =3D pixman_image_get_data(img); + int bp =3D PIXMAN_FORMAT_BPP(surface_format(ddl->ds)) / 8; + int hh; + + for (hh =3D 0; hh < h; hh++) { + memcpy(&dst[stride * hh], &src[surface_stride(ddl->ds) * (hh += y) + x * bp], stride); + } + } +#endif + v_data =3D g_variant_new_from_data( + G_VARIANT_TYPE("ay"), + pixman_image_get_data(img), + pixman_image_get_stride(img) * h, + TRUE, + (GDestroyNotify)pixman_image_unref, + img); + qemu_dbus_display1_listener_call_update(ddl->proxy, + x, y, w, h, pixman_image_get_stride(img), pixman_image_get_format(= img), + v_data, + G_DBUS_CALL_FLAGS_NONE, + DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL); +} + static void dbus_gfx_update(DisplayChangeListener *dcl, int x, int y, int w, int h) { DBusDisplayListener *ddl =3D container_of(dcl, DBusDisplayListener, dc= l); - pixman_image_t *img; GVariant *v_data; - size_t stride; =20 assert(ddl->ds); =20 @@ -605,25 +643,7 @@ static void dbus_gfx_update(DisplayChangeListener *dcl, return; } =20 - /* make a copy, since gvariant only handles linear data */ - stride =3D w * DIV_ROUND_UP(PIXMAN_FORMAT_BPP(surface_format(ddl->ds))= , 8); - img =3D pixman_image_create_bits(surface_format(ddl->ds), - w, h, NULL, stride); - pixman_image_composite(PIXMAN_OP_SRC, ddl->ds->image, NULL, img, - x, y, 0, 0, 0, 0, w, h); - - v_data =3D g_variant_new_from_data( - G_VARIANT_TYPE("ay"), - pixman_image_get_data(img), - pixman_image_get_stride(img) * h, - TRUE, - (GDestroyNotify)pixman_image_unref, - img); - qemu_dbus_display1_listener_call_update(ddl->proxy, - x, y, w, h, pixman_image_get_stride(img), pixman_image_get_format(= img), - v_data, - G_DBUS_CALL_FLAGS_NONE, - DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL); + dbus_gfx_update_sub(ddl, x, y, w, h); } =20 #ifdef CONFIG_OPENGL diff --git a/ui/meson.build b/ui/meson.build index 40dff7b3e0..dec2d471cc 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -93,7 +93,7 @@ if dbus_display '--generate-c-code', '@BASENAME@= ']) dbus_display1_lib =3D static_library('dbus-display1', dbus_display1, dep= endencies: gio) dbus_display1_dep =3D declare_dependency(link_with: dbus_display1_lib, i= nclude_directories: include_directories('.')) - dbus_ss.add(when: [gio, pixman, dbus_display1_dep], + dbus_ss.add(when: [gio, dbus_display1_dep], if_true: [files( 'dbus-chardev.c', 'dbus-clipboard.c', --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388706; cv=none; d=zohomail.com; s=zohoarc; b=GE/aAOhHkkAbVj0BibpfCD1KyJ5KksmwG9OYmNTx0U0tefDEkW0q6FmgUkOEf5mZPJpDhFv8aagvH+Xre6EmzQAlr8/SDm4ToficG6Jh3uYPIhzFORB67bx4UlRLUZ/vJPFSBP0Av8Gv3KZt1HJq8YjpBO1aw8KTaC6G6+ug6ws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388706; 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=UYesKtA6jfy2sWtJA6CnyeGVhZOa1Dz1Cc7bonagla0=; b=SBMWu8lnbv/9Q+hCEyJNKc9gxzxsQHej59gjy7Su6qM3Sv516ua5JU1dG1LxtwzKABOC/EkjFARcaYPEs2/OJKK4cnVdIeDMKjFa10uFjZmnqdfWWqpMUaTHXNvehjv5NzS0zwjLA96ERhzs3wQ57MVZVO1xVOJAUS8EQoGDsdI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388706484759.5675647120123; Wed, 30 Aug 2023 02:45:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHjE-0007tH-UD; Wed, 30 Aug 2023 05:43:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHjD-0007cY-4n for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:43:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHj9-000237-65 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:43:10 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-161-uW9BwA9lP4KZj7wpw2uwBQ-1; Wed, 30 Aug 2023 05:43:01 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B32B7101A53C; Wed, 30 Aug 2023 09:43:00 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA0F640C6F4C; Wed, 30 Aug 2023 09:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388584; 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=UYesKtA6jfy2sWtJA6CnyeGVhZOa1Dz1Cc7bonagla0=; b=DK3u+jXrFmey/JLJoUzmRlT8Drkdzuv9jVDQSFA1e1nxe/0wDIsJnLNGN6W32zfYx88m/l KMoAvDZZkMKzxFe0tvcLWA5HDtu4zUA5146cTWNfz9bP1tygy/NHRL0Q5FSt9LXe5e6bX3 TTjp0V9H8HehO5a5ujFa//2RBqwycbs= X-MC-Unique: uW9BwA9lP4KZj7wpw2uwBQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Peter Maydell , qemu-arm@nongnu.org (open list:ARM TCG CPUs) Subject: [PATCH 64/67] arm/kconfig: XLNX_ZYNQMP_ARM depends on PIXMAN Date: Wed, 30 Aug 2023 13:38:38 +0400 Message-ID: <20230830093843.3531473-65-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388707844100001 From: Marc-Andr=C3=A9 Lureau The Display Port has some strong PIXMAN dependency. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 7e68348440..7ea956b286 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -451,7 +451,7 @@ config STM32F405_SOC config XLNX_ZYNQMP_ARM bool default y - depends on TCG && AARCH64 + depends on TCG && AARCH64 && PIXMAN select AHCI select ARM_GIC select CADENCE --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388776; cv=none; d=zohomail.com; s=zohoarc; b=hnSJEFpUkdELX9bCVpGJxQu0joCu5aKwJc3ubi2PhGFvswtLENwk6cJTWgT0qhmsi+Nh4gFKuPNqfTc1JdTSnFn+6aKqfeqEDAROAzharn+Da/419gvJ29fzm77JA4Dgb1gJ0RFqz8/BiVF1oWGiint0NXQMsd8pbMb1GO11l/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388776; 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=9bDzHmGv9X4GnRDreCiN5NxDpHzlwJDB1QUhkHJTirQ=; b=IQkBjuv0u77mk2l/7/Y12EyCiQGOgN9dDmSa4vKFnLGSngfJtr8znW5fmg1TadQv2c1D0jHRue6LUGD2hRleNYmCXc/bzZNItbCAUQZpmg53vd8kf1OFAmPRO8jrc7FqE7uZnu3txjTi1pXh/2wrAJeKCiFo7MnCjh0zER+LGbs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388776763677.3781949341915; Wed, 30 Aug 2023 02:46:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHjE-0007nl-Dh; Wed, 30 Aug 2023 05:43:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHjB-0007LH-8x for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:43:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHj9-00023H-35 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:43:08 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-664-7D5FkN1uMk2WvlTKwnCulw-1; Wed, 30 Aug 2023 05:43:04 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3583C3C100B0 for ; Wed, 30 Aug 2023 09:43:04 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C2C3C15BAE; Wed, 30 Aug 2023 09:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388586; 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=9bDzHmGv9X4GnRDreCiN5NxDpHzlwJDB1QUhkHJTirQ=; b=BdL+okN5s8Vv72d+uIv7bXEgvD1YgwPTILmE2bfACmt4sByl8UOUNDYPeMoyzr6WFzymBI VW8Ck9IW8Sy8UuFmJzHoMAq9Ppnu7Dxn0JZd0WkUd40bEdhdj9IkhU3srLsT5ITtE8K2Uh B5ONBMbXA83LhtyT2rL0+9FW6a565ds= X-MC-Unique: 7D5FkN1uMk2WvlTKwnCulw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini Subject: [PATCH 65/67] ppc/kconfig: make SAM460EX depend on PPC & PIXMAN Date: Wed, 30 Aug 2023 13:38:39 +0400 Message-ID: <20230830093843.3531473-66-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388778475100007 From: Marc-Andr=C3=A9 Lureau SM501 is going to depend on PIXMAN next. Signed-off-by: Marc-Andr=C3=A9 Lureau --- configs/devices/ppc-softmmu/default.mak | 2 +- hw/ppc/Kconfig | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/devices/ppc-softmmu/default.mak b/configs/devices/ppc-= softmmu/default.mak index a887f5438b..603ed701ed 100644 --- a/configs/devices/ppc-softmmu/default.mak +++ b/configs/devices/ppc-softmmu/default.mak @@ -8,7 +8,7 @@ CONFIG_PPC440=3Dy CONFIG_VIRTEX=3Dy =20 # For Sam460ex -CONFIG_SAM460EX=3Dy +#CONFIG_SAM460EX=3Dn =20 # For Macs CONFIG_MAC_OLDWORLD=3Dy diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig index 5dfbf47ef5..86d3f5cfca 100644 --- a/hw/ppc/Kconfig +++ b/hw/ppc/Kconfig @@ -58,6 +58,8 @@ config PPC4XX =20 config SAM460EX bool + default y + depends on PPC && PIXMAN select PFLASH_CFI01 select IDE_SII3112 select M41T80 --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388650; cv=none; d=zohomail.com; s=zohoarc; b=an4HTh9Ppn8WggpTU3/7tzHAS16Zwj/hwmHasMQu8oY4ywfWsA1Sn1381Mt2fG0dAodluh3JUXNMtngUF8Xbihylnc3q1YZZQeODATR4GaZOyZiOJ+offlOzGkoxNNgU6BDqVxBrwhyGtijgp6Wx/57eIE0y/Rn3fzCE2tQVhAo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388650; 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=OpdAaWr8I1RPVmbiyqT0UhUib/hO8by7jv8r9xmcyl4=; b=a95gXQ1lqN8WSgTq5HJMvQ/9AQ4YjhIJDB5a8muYVpFCrjmLmAiOhndwcNGg8SHmTUOz0rPg2YsmHnqvpRPPDz/4q9TrJbGV+ulszv5VKdbDocy9kOG/7Ar7aZrDH/pawrdTI1OEQEFm6CxknaI4EImbd9NWTORUJdfcq354VBA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388650869826.6128749455588; Wed, 30 Aug 2023 02:44:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHjG-000854-87; Wed, 30 Aug 2023 05:43:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHjF-0007wp-CJ for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:43:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHjD-00026s-15 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:43:13 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-650-XoFi3m4ePISPjw9D-jE0Rg-1; Wed, 30 Aug 2023 05:43:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 25CE1805F5B; Wed, 30 Aug 2023 09:43:08 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AD6B40C6F4C; Wed, 30 Aug 2023 09:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388590; 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=OpdAaWr8I1RPVmbiyqT0UhUib/hO8by7jv8r9xmcyl4=; b=f70/HlZQkHlzId32oejMeuBW138D8HdFbWZ3yBaiiNqolU5PpBrTcIaWuj0BlQymunl2Me 4k3W8G2AuiFks7LMo24OHBrRb+HQuZ8jrF7kPmzBtvIuOFqvaLxdCTO2sSkpZ20cKCEf+f fNAbFsQTCjddC2VwCFYcOXX9OfIWJkw= X-MC-Unique: XoFi3m4ePISPjw9D-jE0Rg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Yoshinori Sato Subject: [PATCH 66/67] sh4/kconfig: make R2D depend on SH4 & PIXMAN Date: Wed, 30 Aug 2023 13:38:40 +0400 Message-ID: <20230830093843.3531473-67-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388652620100003 From: Marc-Andr=C3=A9 Lureau SM501 is going to depend on PIXMAN next. Signed-off-by: Marc-Andr=C3=A9 Lureau --- configs/devices/sh4-softmmu/default.mak | 2 +- hw/sh4/Kconfig | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/devices/sh4-softmmu/default.mak b/configs/devices/sh4-= softmmu/default.mak index 565e8b0b5d..5a78b83044 100644 --- a/configs/devices/sh4-softmmu/default.mak +++ b/configs/devices/sh4-softmmu/default.mak @@ -7,5 +7,5 @@ =20 # Boards: # -CONFIG_R2D=3Dy +#CONFIG_R2D=3Dn CONFIG_SHIX=3Dy diff --git a/hw/sh4/Kconfig b/hw/sh4/Kconfig index ab733a3f76..aa2dff348d 100644 --- a/hw/sh4/Kconfig +++ b/hw/sh4/Kconfig @@ -1,5 +1,7 @@ config R2D bool + default y + depends on SH4 && PIXMAN imply PCI_DEVICES imply TEST_DEVICES imply RTL8139_PCI --=20 2.41.0 From nobody Tue May 14 20:26:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693388657; cv=none; d=zohomail.com; s=zohoarc; b=j6KUk4kBQoaPiVXwE3+JGyAvrMc6pj+B3dP92n6PUQ3trVEOpmmUZjQ6L/GLAePtcUz48kTtQvSZOeTlLbrWMc54+7OBHIeGDj9S/IMbCH928d1qtwrl9Ohjv1rcCK1adXPYDp0xqfsPh0Z+Lt/Xc0SKc3g6JgqJTpz9cQtZE90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693388657; 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=QQ399E6l8GcUokUwfdPMoRLOTCKFeeDHbbD6s6slbSs=; b=eSrqiSTZSvYbnT5nfhaTMpefqCH2j8aKrxws6SXyLfPiEqQU3RcoipB1Zs/R7qXGY58JFcOhTz+q8cjIqYmqr090De2kfJA6ZGC14FJw1o26Wsa3gmkuBFYVwQCerWx1cmXGvDYG5V8n13Rn2tRBnhiTtjGyIYci2WFvc2vl61w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693388657306872.6655754584623; Wed, 30 Aug 2023 02:44:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbHjJ-0000IU-Dy; Wed, 30 Aug 2023 05:43:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHjI-000070-M5 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:43:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbHjG-0002A4-Io for qemu-devel@nongnu.org; Wed, 30 Aug 2023 05:43:16 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-671-lEtXauUfP7yrJEo9RcGD0w-1; Wed, 30 Aug 2023 05:43:11 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9A8D285CCE3 for ; Wed, 30 Aug 2023 09:43:11 +0000 (UTC) Received: from localhost (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4C162026D35; Wed, 30 Aug 2023 09:43:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693388593; 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=QQ399E6l8GcUokUwfdPMoRLOTCKFeeDHbbD6s6slbSs=; b=V17Kiiwml97WO+MZev8JWZlfiGG21xnxYGwF27YpLWPYE/IDglm81ZzYwUSNkprk9P4aFK b4xJUr7bMouL3Ia7jhl/OULg2AK4AjtYCC/JxSc/RDDCJwpCT7NRpyhcR3FfkEBUvgVDYC u3Ic9NUpjGw7ikCrLrV/bW6SLW9kJ3A= X-MC-Unique: lEtXauUfP7yrJEo9RcGD0w-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini Subject: [PATCH 67/67] display/kconfig: make SM501 depend on PIXMAN Date: Wed, 30 Aug 2023 13:38:41 +0400 Message-ID: <20230830093843.3531473-68-marcandre.lureau@redhat.com> In-Reply-To: <20230830093843.3531473-1-marcandre.lureau@redhat.com> References: <20230830093843.3531473-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693388657969100002 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/display/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/display/Kconfig b/hw/display/Kconfig index 4d8b0cec40..e8077c16d8 100644 --- a/hw/display/Kconfig +++ b/hw/display/Kconfig @@ -74,6 +74,7 @@ config FRAMEBUFFER =20 config SM501 bool + depends on PIXMAN select I2C select DDC select SERIAL --=20 2.41.0