From nobody Thu Nov 28 07:45:37 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=1693828437; cv=none; d=zohomail.com; s=zohoarc; b=n5YcIhl65ua6lUbIiNmEVIYtg7uAVOe4oRr2I6PYu5K6vnOJuRoxv3UVs0IhkGL4dm9+sYDAuXgAxdY4+jXlWchIGdUnfJEtXiraVHy6tzq4a77iYx1iFlT5RMMaXhWRDzrwSzLaB2B7/tVGSkQEFORmnpjdfBgPG/mX4k1W4BI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828437; 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=uPGziKzGBPsTm6kXFIORJt+KfCslq6m16s757uhh9hk=; b=iQp2GM5ryR2cSjJLS8ct78fQxbLGj+k0xeHIfgCYkSZHxwzpSOeOzWclIQrGS0Shhc/DlhCZq7w6Z6lVJmmn/BKkoNUO20MdmYTxv9t0zrnIRatBI4ZNM7h6A0J/Ke692+v2cPcHl+z8p3kvVS7Y63htmhEwv2MN+NlIbL6Bs5k= 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 1693828437182995.161796664123; Mon, 4 Sep 2023 04:53:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd88h-00021B-DE; Mon, 04 Sep 2023 07:53: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 1qd88d-0001za-PL for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:03 -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 1qd88b-0008F0-J5 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:03 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-131-EOMZ7R5JNIamXeo4PwRKJA-1; Mon, 04 Sep 2023 07:52:58 -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 A1CC33C02B81 for ; Mon, 4 Sep 2023 11:52:58 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1EFE568FF; Mon, 4 Sep 2023 11:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828380; 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=uPGziKzGBPsTm6kXFIORJt+KfCslq6m16s757uhh9hk=; b=OGLEdgVU+yTcVUjAUjH0T6KEdGHApoXIXRWS9vfnn6+7HJbQFfdtkMp11Q0x47ord6DKmV n0v+qMlEsHFrjjcTdPEhRW7wQ/jCte41ZhHHW3EKFhUsvctn0EtUHA1/1PLQTTD+ayT3OV dFwQ2eyBlyqvF1pcpsfwkGeHfC2DE/s= X-MC-Unique: EOMZ7R5JNIamXeo4PwRKJA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 01/52] ui: remove qemu_pixman_color() helper Date: Mon, 4 Sep 2023 15:51:58 +0400 Message-ID: <20230904115251.4161397-2-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828437957100002 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 Message-Id: <20230830093843.3531473-2-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828452; cv=none; d=zohomail.com; s=zohoarc; b=fM9CpqG2fWFM8KQcmRdlq3oUxZne/njevtzF0Xp/HQJ3LePLDFaLQmF3hxXZLEXFaLF/wxHjFFuoC/oWp/K9q5dh4XE59SvaV3sHqUUucM6n+8mo49YOl3urNFYq0syuF0LrZt5SJF96eri6rS73sK+oV36AMN56fneZ2bhq7Ak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828452; 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=mZmlW9hJ/7D2KKU2XyQ0kDpIQW9MfFQ0M9cPZmHrh+0=; b=PJ4iDQ5gFYk2/SzTF13p6WN2aX9Y5TJbcouySC4oH5css4BtQIoxKFqAjjoSx0GlXiBhtFReOK0IYH2tyE3lvebvYjnHYwZBHpeCb5kn7+sCJ3qRsk7PkD0au47rTq5ev5y6tUtjWDrNB0SLMFXNA5KtzajVlEQpKNAIbP1bwhU= 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 1693828452980137.89581884169718; Mon, 4 Sep 2023 04:54:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd88n-00023l-1B; Mon, 04 Sep 2023 07:53: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 1qd88g-00020z-TU for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:07 -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 1qd88e-0008Fb-R7 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:06 -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-110-y_4e652nNxaiZVs2ZK7OGg-1; Mon, 04 Sep 2023 07:53:02 -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 48963823D5E for ; Mon, 4 Sep 2023 11:53:02 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B048200A4B6; Mon, 4 Sep 2023 11:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828384; 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=mZmlW9hJ/7D2KKU2XyQ0kDpIQW9MfFQ0M9cPZmHrh+0=; b=AJWmVVijM5AvZq8ZBBhtv5y/lzn0ijnIFYUZlfGkYS2Qpbx53QVGxfZK1Xr9aNRKHRKgGs 48eX2s+pxzMgwnNXcAzlnDuMxiXqzRCAMLERicg8TqJAPuTEXjiMBUU9SPYjVvkuyOTjuo gracDn1hoIIY+j6Aep6rHaZSuS1nXKo= X-MC-Unique: y_4e652nNxaiZVs2ZK7OGg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 02/52] ui: remove qemu_pixman_linebuf_copy() Date: Mon, 4 Sep 2023 15:51:59 +0400 Message-ID: <20230904115251.4161397-3-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828454937100003 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 Message-Id: <20230830093843.3531473-3-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828546; cv=none; d=zohomail.com; s=zohoarc; b=doYQnLrrYN9Foapbdi5YwPWGMECLVXB603mI1vFr0f+39t3jlaSt3zxvoL9Emy6CIty7BcH4zXIwYiu1JI6PQEIiEPnPngh1P4ilIszv1i+RNmp4p+7TQ1D2rjUU6E4pjGj2uo0/rVEtPMuAKgSzU6aNInwS70ZcnhvB4k7YrH8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828546; 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=y1MGrArPqzHA8EdRM0SFKnq0sku8Y9CAUZaaK9jJl0Y=; b=LUc+wK+rn9O7tV252gthdK+SubiWsYzeiZJDD5nfh7qInbhz+Qe7ccKxOCIqhYP6PraEM6ADuxEtiHpxSs2dqmL+Zu4LLlm+wrSU14S4WKakAjnoSBhCiO6n5zfl19pUWqsXcK7hQA7na0BY96kGz/WBPBReNxfCLKrtGYMWJto= 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 16938285461151010.7552864028688; Mon, 4 Sep 2023 04:55:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd88p-00025i-97; Mon, 04 Sep 2023 07:53:15 -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 1qd88l-00022s-Uu for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53: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 1qd88j-0008G7-1T for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:11 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-HW2Z4IpFN2GH1Sn-mk1MBg-1; Mon, 04 Sep 2023 07:53:07 -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 B59FA3C02B88 for ; Mon, 4 Sep 2023 11:53:06 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20379140E963; Mon, 4 Sep 2023 11:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828388; 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=y1MGrArPqzHA8EdRM0SFKnq0sku8Y9CAUZaaK9jJl0Y=; b=eHaNU0zpPE/vzQO6h3k7reAVNlodjh192qsEvOiGNijwLXxOroTwRRgZrOOw8q+GK7b/fb ODU24FyGTgtzM06ldLKBUuNHmZXONWYL+XL3SNYNsl5ugL/uQgpAlElHGPsJOR4gtnNFS8 DV4SKX/SwR494j1MdmV2VptfLS0K4DY= X-MC-Unique: HW2Z4IpFN2GH1Sn-mk1MBg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 03/52] ui/qmp: move screendump to ui-qmp-cmds.c Date: Mon, 4 Sep 2023 15:52:00 +0400 Message-ID: <20230904115251.4161397-4-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828546487100001 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 Message-Id: <20230830093843.3531473-4-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828439; cv=none; d=zohomail.com; s=zohoarc; b=h+1K4uneewaqLI6o0F9X8ZNdFIK2EbeXvc/MIZ82ruySWHQtyjH/1rNM5stnuj9K30q6DE0Bt2ckin+igojy1gfWX9yzCS+jbsfVbCZvv0oq4YRYA9D9wwtWx/zzpMdYXKWyYNwx8HNBU0ZIjG/hBwosoCbTU1Sfy5aeTzP2Aa8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828439; 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=DQ2utPPwFS2/4p5GZB12jdeq7xHGReWfKcgs+mpegXk=; b=BV9o6n6Ant20SuJyvFUnbnKvJpiPz4QJ4+gjRMrW78rUkj2etCmgmsXgveU/eRjm+x93EsW1bxV0uHvP7LF1o6jAlbKOGdvRV6i+owf+J0Vb2e6vEd4p5XPiY1dXqU+P4TIVUDoj9j7LNbcboLEzyCFN7PQnUtP93zDDvFUC/tE= 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 1693828439114431.99499237542045; Mon, 4 Sep 2023 04:53:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd88q-000268-Oj; Mon, 04 Sep 2023 07:53: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 1qd88p-00025k-Gk for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:15 -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 1qd88n-0008I7-D4 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:15 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-53-WkCSAZFzPSOUyTCju-j54Q-1; Mon, 04 Sep 2023 07:53:11 -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 E5CB63810D23 for ; Mon, 4 Sep 2023 11:53:10 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDB5F40C206F; Mon, 4 Sep 2023 11:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828392; 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=DQ2utPPwFS2/4p5GZB12jdeq7xHGReWfKcgs+mpegXk=; b=HjRme4oDGGdkmx67+sxBspCwbQOHkuQ3oCdniCa51Ptzan3CAmKDOLdAYaEfOE1i/z81S1 S24VKcbkFExrrH+OmsLbLOM8HuoCqUuHYswpv31w+ntYhFUZU4WzH0UEmzb4PVXak3d3yh ZbXAr6FnGO6Hq/GtUhKGdVC4s6liX6Q= X-MC-Unique: WkCSAZFzPSOUyTCju-j54Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 04/52] ui/vc: replace vc_chr_write() with generic qemu_chr_write() Date: Mon, 4 Sep 2023 15:52:01 +0400 Message-ID: <20230904115251.4161397-5-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828441337100011 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 Message-Id: <20230830093843.3531473-5-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828693; cv=none; d=zohomail.com; s=zohoarc; b=dxlwcnNp+kRjjlyELsaBW9UhcwxHQiGtU0DBq9HQYrJKmLcqai/XF7rSNUB/L5zKgM9aFl5FvMSyLaSX1KvVw+/kvsszvzTPCbbkGnZEARQLAjUANaFskhZ9wfOZ0AOq88PYjnO5dvgMMyimQBmJiVCDZLU10ZEKvBFZ8xTXf30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828693; 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=TXGp0QMTholmKSO/2mYb8qpO/fURuGBPc+i0AzL2vXE=; b=M4WbfUJ4AJibnvTcFTvLjxsPxTqR7uPM/O7DYfj86BreM4CefkBh1hjp5BObQ3cfAdTFeZIm8SdYordMXMfyCUwnOqykdhvhOPOgvHCKbUuVFUHvp1Etz0C1GGqw4WNiQI8clxNpxTj5mgu8LX4+pHhy503JyK0vZ27M0ZXwVtg= 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 169382869358873.19645151919508; Mon, 4 Sep 2023 04:58:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd88v-00026m-CX; Mon, 04 Sep 2023 07:53: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 1qd88t-00026a-Py for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:19 -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 1qd88r-0008Is-Gi for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:19 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-65-xNpIGQXGO2KU5j8YTwlSuQ-1; Mon, 04 Sep 2023 07:53: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 2E8EA3810D23 for ; Mon, 4 Sep 2023 11:53:15 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A625493114; Mon, 4 Sep 2023 11:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828396; 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=TXGp0QMTholmKSO/2mYb8qpO/fURuGBPc+i0AzL2vXE=; b=iin1+SSRMzgeuMqnRUaXgwrb+6g/S9IaQlkWt/wf1rp3K6rc6kHm8K46nX1RlHs497/3UR 94zRrCYR28tyNngGQ26kT15XdDbb9unUzlJr9IDg8kIu/vPqNRMZ6LBmAGljrNCIsVseMW 2MeH3W3Oh/GYO9nquJceTxgV9HvrU78= X-MC-Unique: xNpIGQXGO2KU5j8YTwlSuQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 05/52] ui/vc: drop have_text Date: Mon, 4 Sep 2023 15:52:02 +0400 Message-ID: <20230904115251.4161397-6-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828694020100002 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 Message-Id: <20230830093843.3531473-6-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828506; cv=none; d=zohomail.com; s=zohoarc; b=Xy1tnE6BrfkX3AclYCZeWNzwZhA8wa33zVR0IHb575IbDM9ERMqxFnttIDVd+vpEF9T93exVNmAxY4SMdr/YzNlHLZ4XJ/aDN6hd2l3kQ5R+WsD0/Ts0+dopISjsp4LwIlhqi+M7YzSRt8ZOPAuTNB7cZM0WQx+6f4/8e7zjS4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828506; 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=QIdSJ5rroo5IqOjA5fWj+tdgB6g3pollPahLxT09zLg=; b=KcNEis4M6UiB4fiZ8YmcV6EKJzinIbgP6BOcvMQ7zqVsOqYwCG3iMnZA9uuXYceQZXMI3eSEMmq+XGhhoCRolGD0gDdAhhANJ+oXd7ZrHQ4IiVTc7LS1oJIVJA7r7ryQ4PgCflOBO60uclRk7KIxWtxsnoR0jRDgU36XlNTSvuE= 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 1693828506818389.34063779897895; Mon, 4 Sep 2023 04:55:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd88x-00027I-Uw; Mon, 04 Sep 2023 07:53: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 1qd88x-000275-Dz for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53: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 1qd88v-0008Jn-Bh for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:23 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-573-E3K67XrbP9e10vUpskNBzw-1; Mon, 04 Sep 2023 07:53: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 231EB380671E for ; Mon, 4 Sep 2023 11:53:19 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40650568FF; Mon, 4 Sep 2023 11:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828400; 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=QIdSJ5rroo5IqOjA5fWj+tdgB6g3pollPahLxT09zLg=; b=giqxeBNdOg/y8ts4C0iS29E89AHpHSK6L5CDL2xkLwL+y1vCvfvS6WZEC/UxEiEyp3vMf7 PEJ/jfjWPfPizshB6j00goP4/PiVoHv3xBiA4OaGhkyV2jxEa8VBUvRCH8zlqNE2nxs/SC VTyP6PNOaLd4JQnLnMphrAxInR00lN8= X-MC-Unique: E3K67XrbP9e10vUpskNBzw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 06/52] ui/console: console_select() regardless of have_gfx Date: Mon, 4 Sep 2023 15:52:03 +0400 Message-ID: <20230904115251.4161397-7-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828508355100011 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 Message-Id: <20230830093843.3531473-7-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829592; cv=none; d=zohomail.com; s=zohoarc; b=XP+I0A7QF5WZ9aH29VqgHHUsE1i/CygyA1uOMHcsQJXFBgsoDc2qXBShoa/3681hOYyknHc59J3WhoL+g6beDoXI5MH45dJpvmidcyGhAJNrYWPhK15YNSNAkX76n3M7eKYtlexGl/N5/MSjkVSWbh3XRxAfYynXmW6ZfNmJUMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829592; 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=ZULp9uURUYZ5vuQM7Zdzo/UPLgc6jaoFcYBHycmZZWM=; b=DdGe6X6pLG8lfSQQgbeNmyo1TAvMChD9uWtYMqghrAQMLWRW0qTSs+MJVy9m9Y3/5j4emyB7QBK8zZsW7vhcYvCtpFCgv2Wftm4hd/CplNFOABFjbvAsa9nY6zzoNhqXuoVOgbc3g6n0IhaL2jn+AYy9getW2cwCLtFFLDSIoCk= 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 1693829592093530.0676166504079; Mon, 4 Sep 2023 05:13:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd895-00028W-Ex; Mon, 04 Sep 2023 07:53: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 1qd893-00027k-VQ for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:29 -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 1qd88y-0008KP-Uu for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:29 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-434-v4q_fTjCNxaFzYiE6ovBzg-1; Mon, 04 Sep 2023 07:53:22 -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 A7E82380671E for ; Mon, 4 Sep 2023 11:53:22 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B38640C206F; Mon, 4 Sep 2023 11:53:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828404; 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=ZULp9uURUYZ5vuQM7Zdzo/UPLgc6jaoFcYBHycmZZWM=; b=VSlWmIC0I+Huxy3wftbOU2mNfM9ty3TD6ympz4c3rai+uWUsRiAaWvVaFdauAi03xLnKyT 0mKYjdRA+deAm/NzYyXwiIP2csyra9COdZVmq7kBOh+iMe+SfoKXBpBKX0WrAuyMWIa7VK FJryshxOrE2GLHkPyMt5b6QTmHLlJrQ= X-MC-Unique: v4q_fTjCNxaFzYiE6ovBzg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 07/52] ui/console: call dpy_gfx_update() regardless of have_gfx Date: Mon, 4 Sep 2023 15:52:04 +0400 Message-ID: <20230904115251.4161397-8-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829593343100007 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 Message-Id: <20230830093843.3531473-8-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828520; cv=none; d=zohomail.com; s=zohoarc; b=HOgR+bPtimglNwCL9TXVrcKXH5HfOd3+Rcxy9iBZE9PQ2miu+bEFIWGcqLi69CWABxY/sq9EOWf2rtfjpkJM++TC66RCaGvzmFZeV5uuMi38bWknNI+ZNW8nqE+dgEULJucjjaQSXVfBqcmr7l0hSVTTlugS4rAUi0Zyr86K3I8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828520; 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=M7pr8wNWnVKyqTb6/FonS0/BUyVU5gQwWEUhaT0ftwU=; b=oDL2+p5IJqtcWKXKJIpmWj8Odbw3OnLBNmXPRT+JzUeicU9M8NBi8UMkPnH3jj+mi8zoVSMv/RjEdNejbez8NnJZUxvnqFT+HDGxJyYnXWw/9mOY1VRNkAL6jobC/RtWP2cxS1PnXMg2usnSYrSsvHDzNlX3vFzeZwnP1z8NTyg= 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 1693828520042492.8373777771411; Mon, 4 Sep 2023 04:55:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd897-00028k-Io; Mon, 04 Sep 2023 07:53: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 1qd896-00028Z-6j for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:32 -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 1qd894-0008LC-5N for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:31 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-101-GFWz9JSaOHeZCFAxNB68-w-1; Mon, 04 Sep 2023 07:53:27 -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 05BB01C29799 for ; Mon, 4 Sep 2023 11:53:27 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1514B568FF; Mon, 4 Sep 2023 11:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828408; 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=M7pr8wNWnVKyqTb6/FonS0/BUyVU5gQwWEUhaT0ftwU=; b=PbT2H7UiNRgx23rC/1+c/PcCGunHZFNAOsgdGAnG5474r5KDQIFz5MEyCk7JTd0fKdxHws c4lqon+Y28Hcokqk2NmacozEl/ZBl8cxHfb+3FgUfXI5DbTasb/tjleApht6iZTVS1Jpnb TPsktsAwB4PZkKVkKERs/dZvdpa/pkk= X-MC-Unique: GFWz9JSaOHeZCFAxNB68-w-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 08/52] ui/console: drop have_gfx Date: Mon, 4 Sep 2023 15:52:05 +0400 Message-ID: <20230904115251.4161397-9-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828521124100003 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 Message-Id: <20230830093843.3531473-9-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693828456107945.6443416386517; Mon, 4 Sep 2023 04:54:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd89B-00029P-0S; Mon, 04 Sep 2023 07:53:37 -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 1qd899-000296-Ib for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53: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 1qd897-0008MS-A8 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:35 -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-616-rzOc2DiJMEGESEmVEPDjnA-1; Mon, 04 Sep 2023 07:53:31 -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 DF219805F6F for ; Mon, 4 Sep 2023 11:53:30 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCD251121314; Mon, 4 Sep 2023 11:53:29 +0000 (UTC) X-MC-Unique: rzOc2DiJMEGESEmVEPDjnA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 09/52] ui/console: get the DisplayState from new_console() Date: Mon, 4 Sep 2023 15:52:06 +0400 Message-ID: <20230904115251.4161397-10-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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-ZM-MESSAGEID: 1693828457003100001 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 Message-Id: <20230830093843.3531473-10-marcandre.lureau@redhat.com> --- ui/console.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/ui/console.c b/ui/console.c index fc1836782d..24cfd31ad6 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,9 @@ static void text_console_update(void *opaque, console= _ch_t *chardata) } } =20 -static QemuConsole *new_console(DisplayState *ds, console_type_t console_t= ype, - uint32_t head) +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 +2049,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 +2079,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 +2088,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 +2397,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 +2405,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 +2473,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 +2488,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 Thu Nov 28 07:45:37 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=1693828443; cv=none; d=zohomail.com; s=zohoarc; b=iDcxk8oLybjOT0eQ5G1YofgPLrgS72rFkPjaz7p+dlBCg1LTE0GOrpWGZ1RTA40ZgfSW8PXhlWMtIgJWO1Knt/7oE5vLYdHUasIg/mMPOuwXmnrLu4hlFqHTDyHbIReCSvGO4j2odw3ZWFt2BLIvEcp3mdjwrAWtnikVYJtPKjc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828443; 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=gIEZHfvahFDbThR9870uAOdZkH0HK+pieVj1bVBGNhw=; b=XIQYnspEov/ux6CBOn3JcZl3BJPgD/nY2vvcwpw3giasxrOI0nZGOEtzoVXk7Pjy1VNZ7ufVVWyiM+hSOcNFSYmOAbaU7t/ZtT13+p2Z6Jz5qTmrr+Fgowee715epv22MCPF2Cm36RphWVHyOP4ZgV3yiLBfbYgPwXJdWd5iQWk= 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 1693828443917657.3535721048222; Mon, 4 Sep 2023 04:54:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd89F-00029y-8k; Mon, 04 Sep 2023 07:53: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 1qd89D-00029o-2U for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:39 -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 1qd89B-0008N0-2z for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:38 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-562-lpZz-r0MPS6pR3yUDbteVA-1; Mon, 04 Sep 2023 07:53:35 -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 EE055380671E for ; Mon, 4 Sep 2023 11:53:34 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26C851121314; Mon, 4 Sep 2023 11:53:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828416; 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=gIEZHfvahFDbThR9870uAOdZkH0HK+pieVj1bVBGNhw=; b=HPrmN74QM71+XJV2LzBLXc/sGvZRRju70oV20H+qOGtdK/erh7WLGgwqBU66GGRD/mXWGe OKh3byZYEynmBywjfAZvcgVEQDRAW7No5y9/p91guKDB8tW/gpcFtNLnwIWuP91krRo3QG /bXLWXtp77IfgDRf6Ag0st+K3oZxab0= X-MC-Unique: lpZz-r0MPS6pR3yUDbteVA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 10/52] ui/console: new_console() cannot fail Date: Mon, 4 Sep 2023 15:52:07 +0400 Message-ID: <20230904115251.4161397-11-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828445902100001 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 Message-Id: <20230830093843.3531473-11-marcandre.lureau@redhat.com> --- ui/console.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ui/console.c b/ui/console.c index 24cfd31ad6..ddec68feb7 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2480,11 +2480,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 Thu Nov 28 07:45:37 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=1693828499; cv=none; d=zohomail.com; s=zohoarc; b=Jc5iT+ybyskdC9EeEwzRMRMEs8FCVVpB0XEEs02Jma5Atp6KLyVsGwoJbSj8TmFJeCcKnjSqL0e2Jw5JatStaMlznjvXm1ys4LEe+wx1fQkBEmlTDe7DKcqv/X3Q2/Y9pRxMbH2dvsEg32w6jSNxWSvqAEtk+K7GcU7tWeVOQJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828499; 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=PIM4bXtfRRcXHtGvpLshhPO4qR4AGmolh5l5cNhGWGU=; b=Q3TwGsJ5QAMyrCYyLe1ifqFRJJDEmdEqRmFr8kGLt/CPP2NHBofe1U/fnrnsy08v/dAdOJpBu3I79IC6qYy1J8OQs7GVV/8q4vnIlZi1nbU3ONEPQy5Qpxxp4RJ/qupr8yvXZbZpsxcsrYSFZMcyk7xw+/Ft8C2P70Z2ypNOEd0= 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 1693828499202903.0605384905947; Mon, 4 Sep 2023 04:54:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd89W-0002BC-Qw; Mon, 04 Sep 2023 07:53: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 1qd89H-0002AK-QE for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:47 -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 1qd89F-0008NH-Gd for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:43 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-622-8lvkc-7POXuOP02L30Ztdw-1; Mon, 04 Sep 2023 07:53:38 -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 45D8A3810D2B for ; Mon, 4 Sep 2023 11:53:38 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 733F7400F5F; Mon, 4 Sep 2023 11:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828420; 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=PIM4bXtfRRcXHtGvpLshhPO4qR4AGmolh5l5cNhGWGU=; b=SnLvac6INna8k4h1feVs1RIr9cbLuur2DiK0eBeGq+q07nQQfTB8WnuQY7IIyhhNqq6xQn cqUykA1TWE+Bg+t6tk8JoYFxEv6VIkl1XhkuLU1a3N3ZJtPdbQSSiYi767TTJVUbQHHhHc EMGAhZ/dYtbZLffKs5RvECmIWo2SUik= X-MC-Unique: 8lvkc-7POXuOP02L30Ztdw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 11/52] ui/vc: VC always has a DisplayState now Date: Mon, 4 Sep 2023 15:52:08 +0400 Message-ID: <20230904115251.4161397-12-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828501019100011 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-12-marcandre.lureau@redhat.com> --- ui/console.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ui/console.c b/ui/console.c index ddec68feb7..f97db295f6 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 Thu Nov 28 07:45:37 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=1693828931; cv=none; d=zohomail.com; s=zohoarc; b=I6ayiLszcPVurBGSOnxa6N/dsvPzv8iT/AgDytTd/G7Vrem2tWI2cvZbmydQysgitny8MEqF2IwEEIJCt9/6NzQEn9dAdJ75aeAwwEEuFFk/x8OgjSccefnWN/sn8k7uoNSmWkFy+gBZON+sf8+YWehECEOM3HLpBAX2x7JfNLQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828931; 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=OE2QfD0+p6HBsyh9FgwdjbegWpKUN+NVz4Cnz2phTSE=; b=G70uKGc2B5Z4BEIEWHAVL5Ua+o6afRYnOAeNLmPUoRMSTeRecfebz201MOkUT/QGxGeGsX7TfU49W7BUVlMlsJNNKZMHnW4NHS3EvMiW312h15gnohCXeglqnIxcWHmUiyR2M3AcLoOS4XLOHOC659vhsgBSvUB5BGoaEFBT+VU= 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 1693828931740592.1039867716756; Mon, 4 Sep 2023 05:02:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd89Y-0002TU-HP; Mon, 04 Sep 2023 07:54: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 1qd89N-0002Ae-CH for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:52 -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 1qd89I-0008Na-ID for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:47 -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-63-a_CjjKZkPsmEMHNwoLl1bQ-1; Mon, 04 Sep 2023 07:53:42 -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 075C7101A529 for ; Mon, 4 Sep 2023 11:53:42 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 570F41121314; Mon, 4 Sep 2023 11:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828424; 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=OE2QfD0+p6HBsyh9FgwdjbegWpKUN+NVz4Cnz2phTSE=; b=TyibEy/GlV4BtMkvIrx7VNXsQGyNbOJARn6UAWgiX2wsg6OnBw1eqDBv3p6O6ir6K1Zab/ Hn91R1vNq6SoTESijE+b46hdbc4C+BGsFFAIGjWuH/5XBalLso2cT31ZeEFFosExb0BWUD AIhgOXgItA9Redwkv2z0iAeY4kBlPjo= X-MC-Unique: a_CjjKZkPsmEMHNwoLl1bQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 12/52] ui/vc: move VCChardev declaration at the top Date: Mon, 4 Sep 2023 15:52:09 +0400 Message-ID: <20230904115251.4161397-13-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828932495100003 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 Message-Id: <20230830093843.3531473-13-marcandre.lureau@redhat.com> --- ui/console.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/console.c b/ui/console.c index f97db295f6..5c8e3ad1df 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 Thu Nov 28 07:45:37 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=1693828626; cv=none; d=zohomail.com; s=zohoarc; b=GR9jRW4jDeSbYDjWaSdhzdGMX2PxT2Iz3Rj1kcmlK4q00c1kRtx+Y4UcMBrM48WYzfqNMbKJfpIRci23ByYSewGGqUSaKZ7pwDCaGTEh89cr6nvACcLv5rcpd8Q9vCKUHZrIaKGDu5FeZUI89/C4z3TzLwlPMuAeNyiKzEdQuns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828626; 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=/32oFS7TQEmf4bW88aD4JYqrEDtlekpiFzmkgf6R/9s=; b=SVBr7uArlQFPDRkeJhbpfitIKJMzwPBVBdvMlYU2vK/cIN4RMKZkBrgdZDi0gwHlq/+w5chythfvoiXDgiYyIdBRdGYlkR8VfRaKlHmhjbYRs4Dvb4np773ccNOAZPeA3coGPKo0zdc2nwXoupHdUhYo/1wHPcH9GQ1+o5pBH1o= 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 1693828626199575.352293420041; Mon, 4 Sep 2023 04:57:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd89a-0002gt-Gx; Mon, 04 Sep 2023 07:54:02 -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 1qd89T-0002Aw-3U for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53: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 1qd89N-0008Nv-5g for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:51 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-599-vziKJJXaPBOPSu5PJYQidA-1; Mon, 04 Sep 2023 07:53:46 -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 086EA1C29799 for ; Mon, 4 Sep 2023 11:53:46 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id C568D2026D4B; Mon, 4 Sep 2023 11:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828427; 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=/32oFS7TQEmf4bW88aD4JYqrEDtlekpiFzmkgf6R/9s=; b=JlOUbV5YqQi8Fj8u+A+JMKHQiTzYQQxInfG0zdCXrAnSVk5MeTBEmYxVlTmcHxsIMWGlCc qSMaSHo3cYHninFw0vIn88O43CjhXq4UdtmcYGLmBAYWCLY5i7LdAbeR2KntHyZ1YcvqvF cDFWfSztbZiCO+J1sPmA/TQxz1ecrUo= X-MC-Unique: vziKJJXaPBOPSu5PJYQidA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 13/52] ui/vc: replace variable with static text attributes default Date: Mon, 4 Sep 2023 15:52:10 +0400 Message-ID: <20230904115251.4161397-14-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828628142100015 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-14-marcandre.lureau@redhat.com> --- ui/console.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/ui/console.c b/ui/console.c index 5c8e3ad1df..d1855f3fcf 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 @@ -2419,16 +2423,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) { @@ -2438,7 +2434,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 Thu Nov 28 07:45:37 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=1693829420; cv=none; d=zohomail.com; s=zohoarc; b=JAEqOf3+qnUkn808IIbOpfCBhpso4nQoSL14Kh7R+QPO9roZvhPXBQO2g5P58MSgqkUKA0EW98IBRSolqgU1WSMVCTHTkRQjnBiwENmMlDxNK4sP+94u/4wEjJSDoq5p7uZDYDdv66OVvoPwjYrDEoSR6b0rjLQwOLSSjmn8Ag0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829420; 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=96Uyc1t2XsaTuT7+HdEGqagaVU5D7+hfz4wBBG5J9wo=; b=aWPWGlj8ekgnc/e9jNWLuXWs6ynNAIh1ue/bUF2yTs7vtmfpKJ/h3xIjvZ0AW3Kduq5GpDVGweV7GO6y6yZuD0A/sGI4fFrmJe+hUY4dJIL48TJKrnzcaPjAvZZ2bnameMKuTcofBgVqvwErhWaFngjNZIjmvC4z9okh3SL1LrM= 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 1693829420356813.434529362148; Mon, 4 Sep 2023 05:10:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd89Z-0002dC-Tt; Mon, 04 Sep 2023 07:54: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 1qd89W-0002PJ-8p for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:59 -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 1qd89S-0008OH-NV for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:53:57 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-657-24vfBL_YO2S76j1sBYJMqA-1; Mon, 04 Sep 2023 07:53:50 -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 421ED3810D23 for ; Mon, 4 Sep 2023 11:53:50 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13D0C400F5A; Mon, 4 Sep 2023 11:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828431; 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=96Uyc1t2XsaTuT7+HdEGqagaVU5D7+hfz4wBBG5J9wo=; b=ZrSTHvL68+UesajD9/s2GmwAryXlMIa3ZQq+HAG9Mz3+WTtiictYwwcN1OOIHZc5KIzucg QTVo5I6Kfi7/varTs7Cwc8RjQKBMw6WiWD3krg+BMEDqRZI8Y/2QYSzFwrYQZt3ncAtgMY 05AtRQcUjVYqLahDsBJm/K/h+Q6K0F0= X-MC-Unique: 24vfBL_YO2S76j1sBYJMqA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 14/52] ui/vc: fold text_update_xy() Date: Mon, 4 Sep 2023 15:52:11 +0400 Message-ID: <20230904115251.4161397-15-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829421023100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-15-marcandre.lureau@redhat.com> --- ui/console.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ui/console.c b/ui/console.c index d1855f3fcf..405aedfcbd 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 Thu Nov 28 07:45:37 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=1693828498; cv=none; d=zohomail.com; s=zohoarc; b=WUlJpY5L9Qg2ah74v8xf8BWRpq93YXvQ/rMjDFq8+Q6phTPJ2lkzqZAYPOLl6z1A5jzzyDl44/7wn+BsNy0+LPlIwfnwZBy9m1fmsFoe15xAdZh0to3++eEHCdLEBoaIOvRgCWn79OARePatpkcXLR6VwIzLXkyDOPFbjw+qZoM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828498; 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=67R2icKCU8YB0ua7cyVSlvlDLBodUe6L8J6s+JEpyy0=; b=a1Hwpg4nB5tj403Y8XgHGzKWQFhw5t5tjQI32FsATcRtZSwEoZY2lySdC1hSRbOjASrFIm6kfpkx8d9RwCS/g08FYB7mMJfqPpZSVxbAPIUW9n8767vmXB8iMrJOxjtzKHJEkWd9eQmfm/GuDriRwpYMhd21kAcWEYSVwGc/pHo= 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 1693828498878422.5414756942123; Mon, 4 Sep 2023 04:54:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd89c-0002r1-WD; Mon, 04 Sep 2023 07:54:05 -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 1qd89Z-0002bY-JT for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:01 -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 1qd89V-0008Ot-V8 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:00 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-453-RtBo4lVQNfGMfJRXm5P_MA-1; Mon, 04 Sep 2023 07:53: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 1FE763C01E02 for ; Mon, 4 Sep 2023 11:53:54 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D61F40C84A6; Mon, 4 Sep 2023 11:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828435; 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=67R2icKCU8YB0ua7cyVSlvlDLBodUe6L8J6s+JEpyy0=; b=ae/68eVWK1FqUZtjJTW7p9z+DE1C6Qh6Uq+Ir7VAwRH9Pzd0F8JOPFhh4ROHXxF0F/IfZz F03kgtZUNIu0TKstl4Rz3XitK6McHXP26Fbe/JZHiQgFIPDXVgY49OUl4/InTrn5PX0og/ AXk/tXFl2X8pOlNzh+sZpVNUXoy9qlM= X-MC-Unique: RtBo4lVQNfGMfJRXm5P_MA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 15/52] ui/vc: pass VCCharDev to VC-specific functions Date: Mon, 4 Sep 2023 15:52:12 +0400 Message-ID: <20230904115251.4161397-16-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828500114100003 From: Marc-Andr=C3=A9 Lureau Even though they actually use more of QemuConsole at this point, it makes it clearer those functions are only used from the chardev implementation. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-16-marcandre.lureau@redhat.com> --- ui/console.c | 70 +++++++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/ui/console.c b/ui/console.c index 405aedfcbd..f9ed012e1c 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 Thu Nov 28 07:45:37 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=1693828756; cv=none; d=zohomail.com; s=zohoarc; b=IJd4KHVVuYRNLTu5cM/R446460tPzx7tobPx7MeevK3L88cghhmDqqelaykGB5ykriOuD3tXOWFyUiFXA39PVRwQfyi3hKfeJm2jPLj8NPs8mCpzHK6Ku9m7+qwCA8MC3IMprlqwUg++M97bP3BFtAzEOS0cNHZMlxCtgC2+1O8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828756; 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=vTBrJC8D1PkYdpQFXHid33Rd32afenRNUdHCc6ngp/Q=; b=SDaVEddjzhDLgNmZd/U39zqTbOWqeZ1nsVBifyHn4LdyrGpKYFg9uplhK/YnEe2LRKbYs6lFh5npB7dEKUUP2qS45pAzrXKkaUvtZziOm3T5hhHEdVPJgdBYLzH5KPwU7oBhaPEhkyEhMvXiC0xTl2vAwhVFlEDRxITFyYod06A= 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 1693828756404642.0292372135032; Mon, 4 Sep 2023 04:59:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd89g-00030B-Mj; Mon, 04 Sep 2023 07:54:08 -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 1qd89d-0002uQ-Sh for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:06 -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 1qd89a-0008Pd-8l for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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-679-D-1tpXzVPTejyKhFwgVgyg-1; Mon, 04 Sep 2023 07:53:58 -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 442C98008A4 for ; Mon, 4 Sep 2023 11:53:58 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBD88493110; Mon, 4 Sep 2023 11:53:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828439; 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=vTBrJC8D1PkYdpQFXHid33Rd32afenRNUdHCc6ngp/Q=; b=MPjENGfNhvRWrh7SIpjEtGGePwBv+zHSsRmdnS3nJJMAEBsSKeaPpKn9HGbxg47T23+5bf YutUDOq770HGh4K/0ESE9+5ALMeb2XvllziztJ689aTdQ5dskwvhz2oBtN3SDgvuGZxf3t ZZfMcmfDEXOjsNSC+bUoRFKUdXU17Do= X-MC-Unique: D-1tpXzVPTejyKhFwgVgyg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 16/52] ui/vc: move VCCharDev specific fields out of QemuConsole Date: Mon, 4 Sep 2023 15:52:13 +0400 Message-ID: <20230904115251.4161397-17-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828757704100006 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-17-marcandre.lureau@redhat.com> --- ui/console.c | 147 +++++++++++++++++++++++++-------------------------- 1 file changed, 73 insertions(+), 74 deletions(-) diff --git a/ui/console.c b/ui/console.c index f9ed012e1c..1336a1be6c 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); @@ -2427,17 +2426,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 Thu Nov 28 07:45:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169382850506486.7503150842407; Mon, 4 Sep 2023 04:55:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd89k-0003Ba-6W; Mon, 04 Sep 2023 07:54: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 1qd89e-0002ur-KK for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:06 -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 1qd89c-0008Q0-CW for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:06 -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-630-xVk3INznOQO5FFsByIbNaA-1; Mon, 04 Sep 2023 07:54:01 -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 75FBF8008A4 for ; Mon, 4 Sep 2023 11:54:01 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9B9940561C3; Mon, 4 Sep 2023 11:54:00 +0000 (UTC) X-MC-Unique: xVk3INznOQO5FFsByIbNaA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 17/52] ui/console: use OBJECT_DEFINE_TYPE for QemuConsole Date: Mon, 4 Sep 2023 15:52:14 +0400 Message-ID: <20230904115251.4161397-18-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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-ZM-MESSAGEID: 1693828506878100007 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 Message-Id: <20230830093843.3531473-18-marcandre.lureau@redhat.com> --- ui/console.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/ui/console.c b/ui/console.c index 1336a1be6c..14fb38c661 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; @@ -1313,6 +1315,21 @@ static QemuConsole *new_console(console_type_t conso= le_type, uint32_t head) 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) @@ -2646,13 +2663,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); @@ -2678,10 +2688,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 Thu Nov 28 07:45:37 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=1693828507; cv=none; d=zohomail.com; s=zohoarc; b=AU8sH7z9WzjcrxU4l3mnivM3qTDIPXg3b9yuExpV4NRmNjAmy/6vLCjeZXD13/WJud+KSE5kfgjA04W1Ryt/OSfpHl/lTwigfSaziXzlwISB/o+AEHydY5Au1Jc/ze8iGFHnX+cl9IOfKZWhiqHrAwo+hyiL7dCpoAVENiJsgHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828507; 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=TB0O1dRHTMx2WuGanxMBCP0v8ue79JTrzZpX+r3PJmg=; b=K1WaK9SAhkl7bYpsQXPawskz1HhUtmO9VxnnfOE61OEPZ9fH2Nl8KDP6LDSrrZFaGPryuC06F9yxm7Hg+gBKdFoC0XmmoFSEA1SLsC9wstOSyXsPZi94+W/XotF814K2YCkzF5s2r+oGbJKgdred0AFxx05C7BDxsLEGQ0n7RRY= 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 169382850787683.11631613359543; Mon, 4 Sep 2023 04:55:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd89y-0003NK-IC; Mon, 04 Sep 2023 07:54: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 1qd89k-0003D6-9v for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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 1qd89h-0008RJ-Uv for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:12 -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-413-3wutt9YBNdq5JkD1X1iQ4g-1; Mon, 04 Sep 2023 07:54: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 CEB2784AF9D for ; Mon, 4 Sep 2023 11:54:05 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E3B640C206F; Mon, 4 Sep 2023 11:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828449; 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=TB0O1dRHTMx2WuGanxMBCP0v8ue79JTrzZpX+r3PJmg=; b=cwvcJJ91hfbsF+aXC0Ou5+rVMvW4xA3Zl42md+WOYhvx8rPfcuJhUUQFTmrC4O+KnnMWQX GAI4t1IL8rLZVnIhlqzWQbCF69+rj37jgnpFRQODxi2iVlYxbhmztJwXq9eWhb/qWIQ4pO 8YtmRLpeYci5zFrKmFREM/b9ISOE+5Q= X-MC-Unique: 3wutt9YBNdq5JkD1X1iQ4g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 18/52] ui/console: change new_console() to use object initialization Date: Mon, 4 Sep 2023 15:52:15 +0400 Message-ID: <20230904115251.4161397-19-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828509074100014 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 Message-Id: <20230830093843.3531473-19-marcandre.lureau@redhat.com> --- ui/console.c | 92 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 36 deletions(-) diff --git a/ui/console.c b/ui/console.c index 14fb38c661..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,39 +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. @@ -1293,41 +1279,75 @@ static QemuConsole *new_console(console_type_t cons= ole_type, uint32_t head) * 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 Thu Nov 28 07:45:37 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=1693828504; cv=none; d=zohomail.com; s=zohoarc; b=BTzaVWEOLOEivel1pJmvKhzQFLKR0mIa9t7v4Ttqp6Q0DJjK0uS6fFRkr+SU8Fv7dCYKBGQamcAEbK+m5pNVA/kvmJ06bgci7mZS2l5e32CZZN+CvQb/eF7AIDHU+oyZrlSHzdKgyN2ZLN8qYmL66NxhXmiXi1/3nsk/3h9SujU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828504; 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=AmY070B/n2DOto2tRIvH64si/eJQ3LRxeV69qiBlBAE=; b=ac/FTanHaWNu1KzTFWotUy/4Ux+P073wjp4UTFOD5dVO4dSHE/J10GGzfRYGNVq3r/2/vlktsp5rPysFOOJMjtUShI6bZzChDURZ/u52F1YalSo0YSPrkJ5sy4ySdwA+oF7ijcpOQeTaXFGiL8UIXxLjTnz6QU7Mk+bRTlJXnJo= 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 1693828504020122.38790114652693; Mon, 4 Sep 2023 04:55:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AJ-00047j-7Z; Mon, 04 Sep 2023 07:54: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 1qd89n-0003P5-BG for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:19 -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 1qd89j-0008RV-Nm for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:15 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-299-z0hhG3kTNhuHcVb7uFUoeg-1; Mon, 04 Sep 2023 07:54:09 -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 7ED2F1C2979A for ; Mon, 4 Sep 2023 11:54:09 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61E5B400F5F; Mon, 4 Sep 2023 11:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828451; 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=AmY070B/n2DOto2tRIvH64si/eJQ3LRxeV69qiBlBAE=; b=Pko+nmZRWWrnSq7wpe0D03tT3PexyUXUUL1Wx5ZCsjhulQ6qdUsmMkVv8/GqJRqm/pjDJ7 ZYVk98Hu1kzwWrI2i2z+KAVUhzZU/JVOx9A7D1wyy1Q2zhsZFGK0fX1JrJmOC7u9Tbc+AK DjRM57EEgsvB+s1lhT0SRBkVLkknznA= X-MC-Unique: z0hhG3kTNhuHcVb7uFUoeg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 19/52] ui/console: introduce different console objects Date: Mon, 4 Sep 2023 15:52:16 +0400 Message-ID: <20230904115251.4161397-20-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828505013100003 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 Message-Id: <20230830093843.3531473-20-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828498; cv=none; d=zohomail.com; s=zohoarc; b=UmNx/nYU4hSAT2AYG8+fkn4iwTr9cnXW/rhqfBz4vhemR/K7nPK8fc+eIZ+BLyXtIPu3L2C1n7nE4s8VJ99dR94Lt+/KTGjYZENWlURnYyMLqtfRcRXIg/q9wrYrI3RjcjoEhtzoyQddFujk05IfXXZ8xceliGT8Rg4wkGCZ01w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828498; 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=5hRDAfmk3NJflNLFML/RaKbqS0nIVKE/TBiTSoxHrVI=; b=S7u0IK7PI5z6Q3KkZuUlvh9FTcPSaL0QlS3iUcnRa3hZCW7juaABOEYaQP1puFFrHJsiJp7xyAU1rAur/wFJX29uZk/bEhIXPU1LdJQvyVDw8/TUY39JAyTlMwTc/ibDooxi9xK4jyPhhacBTR/J5THSH/o3QDvBfGNDao8zr8s= 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 1693828498316204.5302022895312; Mon, 4 Sep 2023 04:54:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AF-0003uM-BB; Mon, 04 Sep 2023 07:54:45 -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 1qd89q-0003Q3-Ki for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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 1qd89o-0008U1-75 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:18 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-456-s6ukda_nOfKHNXqW0BoETQ-1; Mon, 04 Sep 2023 07:54:14 -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 C8AD929DD98D for ; Mon, 4 Sep 2023 11:54:13 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 817B5C124A; Mon, 4 Sep 2023 11:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828455; 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=5hRDAfmk3NJflNLFML/RaKbqS0nIVKE/TBiTSoxHrVI=; b=fos7DQf6cRn0ZsLzJrkTaHSDAjGzLuSWe8B0qhFq3ptSNQwxgVHKKrBC3k72V/PclGYIOP slrAKe2kvLSHEFrzAXOfISH+nSzbIOLZCcMLpVJFgAaILgjNSLVMhbvktCplAjTiLqc9k/ 3yEbQwTK0ORq/9BwceNsSEclJ4KtcC4= X-MC-Unique: s6ukda_nOfKHNXqW0BoETQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 20/52] ui/console: instantiate a specific console type Date: Mon, 4 Sep 2023 15:52:17 +0400 Message-ID: <20230904115251.4161397-21-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828499272100001 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 Message-Id: <20230830093843.3531473-21-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828863; cv=none; d=zohomail.com; s=zohoarc; b=TNV0XeVlYotuH3HJR3q/fTiXIDA6/lINQJ3q6qXNYNtN6rSyiHLBHaSbl2fe5yIeuavLtSRu7j0ZXyyKx2SfWl3pFw0zujj3faJhjLI8cyxnxSp1i2xUc7lEAkvMj9LUlnIUylczEhVmkDYsGHH7x+NHPJkJrF+NpizN6gIPzFU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828863; 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=32tRFRNvqpEJxCD+paAVvnT45LuqWDgt2Wm+WG8loTk=; b=LTMNztjbds4fa3b7pvvTr1PWh/BETVHOll2JZ9scSb5fbA+7xv2GeBXWF/Os4kdKiOhBPaoGgIqX0uam7o2NXzSdzSJkLxUk3GVGDRhHfWUFOh9ShzkmIft5kiiL+m4X5JFu8MtK06uXIjIs2VrIoSXvGK7SrlsPnAet2/iZrw4= 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 169382886377998.20451676047992; Mon, 4 Sep 2023 05:01:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AP-0004bW-JJ; Mon, 04 Sep 2023 07:54: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 1qd89x-0003kR-Fe for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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 1qd89s-0008V9-2s for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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-508-7yGiUav5OWeOG0gnZZWBOw-1; Mon, 04 Sep 2023 07:54:18 -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 B0882803F3A for ; Mon, 4 Sep 2023 11:54:17 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2357140E963; Mon, 4 Sep 2023 11:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828459; 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=32tRFRNvqpEJxCD+paAVvnT45LuqWDgt2Wm+WG8loTk=; b=Hs9DJxpFLK8ikdQtQcEPU9ApW0YdGlEakLSjSUQJLHp1Rg5im5W7rxntxjZYjhWDRjDQQj ErVRH2jtJW6cfomK6FnpQCj11sNdCr3VGGmiWJSiD6WfqyJtRtzO8Fgoc55G1shx1bcVmC IqLsToq54K3UZl5buMQCpDCqWXGuevo= X-MC-Unique: 7yGiUav5OWeOG0gnZZWBOw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 21/52] ui/console: register the console from qemu_console_init() Date: Mon, 4 Sep 2023 15:52:18 +0400 Message-ID: <20230904115251.4161397-22-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828864632100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-22-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828626; cv=none; d=zohomail.com; s=zohoarc; b=SVUK03BiWNhW7hMRS/x85zHgV163MlQCR5uJeLUPZfVqNtNs5Lv2L62BaICPlb3N0+8I/nxREm9K1ErhfNb1jytv5ytdSB9vkc1cNlvLIGG/pDSfPWaJ8AVvN3V0htQzf3xts2mCriiPRUp8bpyVYIxLyzOfJ7ReHceJGUNI7+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828626; 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=7NUYymtfm45Q9J6UHwQZHTSqfBewE0YOcr1sRCaqdAg=; b=IN2K8ZvwboZ1DVp3HlgughpWvASigTqCAiW2iWZD9iJuUhts62QXJe0DpmTxc+3lTDgasyU1OyLorFUrBhwJ+Pel0f5+Bp9+F9OtBKg/0l/VllF+7dA7nB2pHIMVd1M+8sJ/q6Wme9O51xAs1SBYb4haZzVBYdwo/lfut1WZ+7A= 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 1693828626314447.0996510728497; Mon, 4 Sep 2023 04:57:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AO-0004UZ-BC; Mon, 04 Sep 2023 07:54: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 1qd8A0-0003ng-67 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:32 -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 1qd89x-0008W9-0C for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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-67-HdRwvCCiOjuHPtLym7Q9DQ-1; Mon, 04 Sep 2023 07:54: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 3BF86811C32 for ; Mon, 4 Sep 2023 11:54:21 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7929E2013570; Mon, 4 Sep 2023 11:54:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828462; 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=7NUYymtfm45Q9J6UHwQZHTSqfBewE0YOcr1sRCaqdAg=; b=d6Sp9DQ993UEgzKsssWTfiLV1EPzyhYepXDoPZR8+/W80XZz4DUlYIT8EbdC9xy/9a7ukk csMgAV9Ta9ZWWUxXlDyG9Ov3g48rBdmd83IxH+wXYjA1Gb2R3et6Pp+iUXaymW6WthEys5 z7v8sot+51MguMQuLkCAKVyv4l481FU= X-MC-Unique: HdRwvCCiOjuHPtLym7Q9DQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 22/52] ui/console: remove new_console() Date: Mon, 4 Sep 2023 15:52:19 +0400 Message-ID: <20230904115251.4161397-23-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828627596100009 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 Message-Id: <20230830093843.3531473-23-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829184; cv=none; d=zohomail.com; s=zohoarc; b=faw6BM8E5ggXShjoQqBizn+X/kw4OREawvxfidB5fqS1xd2c59OwAFH2TBqJuDPr6f+jwXpKbXHe2x4sUn+EnsD1b3wnXkRfUpQk46lGp/ba6DSbv5KiIUDDvhS9RvoyE+d9lXqBTn9rXrsp8E7dJVZL3rsFsAx4Jtqvp7Q8uwg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829184; 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=OYWivQodz9oOc8FPiAywMl7fSdj6TctG1wxHmDNiPhE=; b=UxUlykPvYgFYYWM9mzQshgZ+NX7xt3DO75LriwPRJuU24FUGJuNRM39o8Uv810NCU0qRZlCx+BN20uIJoZpI3bsqtxAAVTTdPHFTNFl/d4s+y0dY+15tygoR9DkWNPbg8SR6ci+ATrCsmsJegk4GayqLAG01tEpQ0sB6pX1EzdE= 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 1693829184805983.4131847129956; Mon, 4 Sep 2023 05:06:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AO-0004XN-UC; Mon, 04 Sep 2023 07:54: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 1qd8A2-0003nv-1o for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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 1qd89y-00007f-RS for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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-101-xxfHVQPaPxKChuw3Yf_WbQ-1; Mon, 04 Sep 2023 07:54:25 -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 CB5A283FC20 for ; Mon, 4 Sep 2023 11:54:24 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD63121D4F3D; Mon, 4 Sep 2023 11:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828466; 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=OYWivQodz9oOc8FPiAywMl7fSdj6TctG1wxHmDNiPhE=; b=D4DBJID0s+Nvlf3HrAxAu4Odqn04c0hWcsq0xY+EhGFkye0FD1wHF5ofI2xC2NcVNFmRkb K5jnnsELP9Hq9TToUyEdHqQolOdvFK0roadwFBsxta7Z6OlrG64qbgvsg6cZur8djPTEGC jZ4ejHOKwrPN4WOdKh/WsqBO/BRyKlw= X-MC-Unique: xxfHVQPaPxKChuw3Yf_WbQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 23/52] ui/console: specialize console_lookup_unused() Date: Mon, 4 Sep 2023 15:52:20 +0400 Message-ID: <20230904115251.4161397-24-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829186876100007 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 Message-Id: <20230830093843.3531473-24-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829353; cv=none; d=zohomail.com; s=zohoarc; b=bUITGWD4mztC0+OE1PVpk8RIwuCFwHvyywwYB5/zqk2SkQs/xyuck/SlMLSG8o1Xlj4q7CeLxhcDRc0/xI7U+0QxlB7NW2CKpBQXMs3Ues7H7FwttZphwdl3NVqcnOVjoPZwsdU5tJlwqSwNUNhvwvfaZcQ0ZnSmZNX/rz7NsPc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829353; 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=9QEJZ7aYxBSrhLO+Wk8OqF7VX4dGJ5R9QxOGauuwGfg=; b=Pa8bM/PpGFDlbzWpuMkzsal6cc4XaNSheM/JyXU8O3R+AygkYKrniryYuoyWzB3u1TQI6/Lm+7YUb9fyAIJmtsy91PExDDkw7bmiXxmzDgXrH1aBEq2hDt4MrEuTNNilWo5186ldfOj+h24f3liLscMXxCkqdqTLf8y86fZQeys= 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 1693829353942585.5292902136088; Mon, 4 Sep 2023 05:09:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AQ-0004es-4Z; Mon, 04 Sep 2023 07:54: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 1qd8A5-0003rC-E3 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:34 -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 1qd8A3-00008x-Bw for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:33 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-381-hJbC2PHsM_eYjNGL3D0Kfg-1; Mon, 04 Sep 2023 07:54: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 045B61C29799 for ; Mon, 4 Sep 2023 11:54:29 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3490340C6F4E; Mon, 4 Sep 2023 11:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828470; 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=9QEJZ7aYxBSrhLO+Wk8OqF7VX4dGJ5R9QxOGauuwGfg=; b=M0iud6aSm7Bs3gDrcHfPxk5sayohv6pTQKuubE/VRAyHisgNt03804FAmDq4dpidugkEmO ouk3M9/cZOkZydfXztN52L7BazHX8AY3OzaGkV7TT9utI4CNbC7pJ8QGfZUa2QlC7TeZdu vs+/r9zrIsLoDyEaIKPgG4ljoUkaPuc= X-MC-Unique: hJbC2PHsM_eYjNGL3D0Kfg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 24/52] ui/console: update the head from unused QemuConsole Date: Mon, 4 Sep 2023 15:52:21 +0400 Message-ID: <20230904115251.4161397-25-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829354708100005 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 Message-Id: <20230830093843.3531473-25-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829506; cv=none; d=zohomail.com; s=zohoarc; b=jHxs9Ca3cNpH0VXzfOKjiBRqxcCybLl+SpL1WWVCio5XkeD3VwpqxEaP0J9iXKihX6IvBNWInxm0cOoT4pUzI1c2aF7GaLiE6DwDWxVbe99WtiNMaZRJ2PuPcUrD5VAoawGelukja45OtvHjl1wNY8EjB3CAEELOQV7alwTcaRA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829506; 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=UPvuZR19Ihxm0EeQ6XlDAJ/30KEcKDm1YnEzHyINBQo=; b=LFpo0LCYcFcc/nWWwHz1ZEKIVnKx2eHXs7IS5zZVu7QgImhWOcdXNRK/fB23rGrAJbuhvjzuWkeaWp6I/1SicEyqocBeI01wpgJYxSl1K9GgzoU3ZyWVDI54oy4e67UUEl5lv3Mtvg8S8JsiXfmfwch4+94PqItrc27+/NqX/r0= 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 169382950687539.172251498483774; Mon, 4 Sep 2023 05:11:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AT-0005Mk-OC; Mon, 04 Sep 2023 07:54: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 1qd8AH-0004Er-OI for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:47 -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 1qd8A7-0000Aa-Bx for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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-588-XqrHCe6CPKO82VhRHy5Qjg-1; Mon, 04 Sep 2023 07:54:32 -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 46F241817904 for ; Mon, 4 Sep 2023 11:54:32 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E8DF2026D68; Mon, 4 Sep 2023 11:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828473; 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=UPvuZR19Ihxm0EeQ6XlDAJ/30KEcKDm1YnEzHyINBQo=; b=TQfJvCHMATt41D+k9VhGhebC0KgJBBwUvg49RUdbcpE2v2HEiMreU5Y4x+QrjeLTAvmZvk DqBRlvHzCxM/Bd9c7z+W65YRfUzhabMZda+uQu5Sund0EsWu1Th4oPBGvgQhTen3pxPWlH 4EXsfgz2GzXjj/41g3d/ohTvxNvjpug= X-MC-Unique: XqrHCe6CPKO82VhRHy5Qjg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 25/52] ui/console: allocate ui_timer in QemuConsole Date: Mon, 4 Sep 2023 15:52:22 +0400 Message-ID: <20230904115251.4161397-26-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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, 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: 1693829509482100002 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 Message-Id: <20230830093843.3531473-26-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829351; cv=none; d=zohomail.com; s=zohoarc; b=Y4V3aHiuBoi9yrQ78/KKh3LLJciWZ8fHJHg3n1DpKM13e1ZN8gqc0XEM3A3TNzJ1BCO5RovTX6CLf6DbZ8y/RWCftpkNh9/8TVAvnJFQuFisvVnVDxqVeesvLOHKJn7glqIMP1InNL+Y9bjttnNt0ukXO1IBdnGOHXGFQK7VJ6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829351; 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=iPLuBL3BHHlM/Kh/sWS9DYrcuY++Ag95owsA4R/NVcw=; b=IFGsD1IDqG8BaZwd2WfAL6Y+JZYXGGNPiBnQyrFBB2U61fwbehqRG9wGkFgNDQIgObIuI5yTxE9GND2GSPkREcovoMlCKGDW7dHY4xNFChB1cP1Q/mPGA3vu+hAn8nzaM0aipUCfsdBxQTosbi9g0+oV4kxy3913IV0dCk0Un8Y= 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 1693829351177423.8908160842725; Mon, 4 Sep 2023 05:09:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AR-0004pM-9j; Mon, 04 Sep 2023 07:54: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 1qd8AC-0003tO-Id for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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 1qd8AA-0000Cl-Cu for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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-338-17M7xqr5N-uE48JAnZIBAg-1; Mon, 04 Sep 2023 07:54:36 -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 19195823D5E for ; Mon, 4 Sep 2023 11:54:36 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 402792026D4B; Mon, 4 Sep 2023 11:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828477; 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=iPLuBL3BHHlM/Kh/sWS9DYrcuY++Ag95owsA4R/NVcw=; b=TTzn7XRiKBqjvCvQKb1WlnQRfkwt3DEQLk2gkn3tMZxcfQYDbYBKTNiZjJjQKrWKrwRyt3 +SnE5tvC7h2GhS3J35CZy0Lhu2qOnwYTxRw4QQLoyGg3QNTXiu2oqMaxo8O0O00oFNvpdp z3x7dycbLvJrpWwVAuZPTQv420gTxy0= X-MC-Unique: 17M7xqr5N-uE48JAnZIBAg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 26/52] ui/vc: move cursor_timer initialization to QemuTextConsole class Date: Mon, 4 Sep 2023 15:52:23 +0400 Message-ID: <20230904115251.4161397-27-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829353183100003 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 Message-Id: <20230830093843.3531473-27-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828930; cv=none; d=zohomail.com; s=zohoarc; b=neMvV2puAbOuJi4X6YCVGKzIFT0ImHPnIOjSdEpQ6ooi/q5kAbN5ho3iPf09KpoXlIqgt/GSf3UOuZQ4+R22/G3E/P3Yxclkp/fgK6zsXMnpVFiPfdc1xhFCyxkWax4xtnEoJifGcH+NJ3thHysppKoaK9REH3rJEypI2OI13xE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828930; 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=HOYpE+noM/yV0AMGkiWw9ecMSijQWwW9jy8obaGd97c=; b=GOVHJNz5OhAMfpqlEMSXVk7MufNK8aCv7R1N0Tcg+m28PNEh7ZrBx3urKIvQgpHrS0CwjoJ/XeoDRPJ6hUj5CZDGdZoCnETkQi3SsJM9mhDZHDutmyhiLqF9JjY4kuZPvdZAmqM/rNNHPtWlGEblpiy7NMP59JLwBr0BkCb124U= 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 1693828930686440.55499283193524; Mon, 4 Sep 2023 05:02:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AP-0004cp-Ow; Mon, 04 Sep 2023 07:54: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 1qd8AI-0004Fm-AF for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:47 -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 1qd8AG-0000Gm-5S for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:46 -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-434-OQwecwt6N36LbOsxmcC_tg-1; Mon, 04 Sep 2023 07:54:40 -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 2772A10264F3 for ; Mon, 4 Sep 2023 11:54:40 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63EDA40C206F; Mon, 4 Sep 2023 11:54:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828483; 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=HOYpE+noM/yV0AMGkiWw9ecMSijQWwW9jy8obaGd97c=; b=bOIlP6lTtvIzh4ab/7thRGoPXX05ufizjFbCvZvy0MVNzu8to48iINv1Rf9fgOHcWv5Ol+ KK2N2ZGyvfZ4PFeRw742NNJM2eNZ9zyA0NitnWY0woqqaf7OMS2CZAHvEJRSj/WMDo5R7O A8DmXIAyq206+jKCEymGQYFFqSn7OsA= X-MC-Unique: OQwecwt6N36LbOsxmcC_tg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 27/52] ui/console: free more QemuConsole resources Date: Mon, 4 Sep 2023 15:52:24 +0400 Message-ID: <20230904115251.4161397-28-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828951150100001 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 Message-Id: <20230830093843.3531473-28-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828867; cv=none; d=zohomail.com; s=zohoarc; b=YteLAcU4RsoQmeOz0T+hURAwlfJ6/cXNglPaQZLLCZlZ/5AE82f2WDGBOVodaHfGbvvTL9ELD/jzjZ5x+l18Qcl/zfEb4lkYp3q7BlXKGc4cO4HJjfVnnyWtLsp6vcn0kDTcRz7MdfaplfJ4Z/YsKb2RgwrxU/eHZ/9qYKcxNHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828867; 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=Y6wwnPZZJQ4gfCAMJ0lW4JSTVJuLwQHSYqyf0Q1vzN4=; b=f2qYhYFf7C6OxUAVTHMi7xXqUumpvyVrc92O1x2PWSeB2DUwX+MmBQFNGR+ixOheiSuaHkT0ZvkyUq2GeuedK+vNL550qYPuMnvu2AvPecfQuMsABU9fUtqR5HupHVbhKfMqQDndhcVJSBDJEdqSrB7Mgi+USd0+R/ZGi2aNAoY= 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 1693828867271844.8222147051588; Mon, 4 Sep 2023 05:01:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AQ-0004kP-Tc; Mon, 04 Sep 2023 07:54: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 1qd8AL-0004Nr-Kz for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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 1qd8AI-0000IC-MN for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:49 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-546-REepFEZeM0eEjMLBsKzORg-1; Mon, 04 Sep 2023 07:54:44 -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 6C5B92999B38 for ; Mon, 4 Sep 2023 11:54:44 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A798140E963; Mon, 4 Sep 2023 11:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828486; 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=Y6wwnPZZJQ4gfCAMJ0lW4JSTVJuLwQHSYqyf0Q1vzN4=; b=e3CmhYeJWN8/0DPsv+Yd207Rnjw8+9Gjb1MbWQ0CODrsrSbT/a1dXC9+r5VbyBXu3hy23k Hxvp1w/mVgKbiqaYBteliIVbYEJGYIfsdr/pSNH88kAD3UutKW/79TocMjLrlOstrzoWCL r/isJpIytksFRxUSDCtCcThcl040AZU= X-MC-Unique: REepFEZeM0eEjMLBsKzORg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 28/52] ui/vc: move text fields to QemuTextConsole Date: Mon, 4 Sep 2023 15:52:25 +0400 Message-ID: <20230904115251.4161397-29-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828867610100002 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 Message-Id: <20230830093843.3531473-29-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828633; cv=none; d=zohomail.com; s=zohoarc; b=iDvgrtfjv/nWOJBm3NUjnGO0CaCdv/TlfQn/p2pC+DrtF+oXHzJ3+pZRt5QoU5K8qQGkKCK7FF4fK3Igu7WUNZ2DswxF/4Xq6nTu5R/0riSkv9BaLSmY22BnlaEzxthr+m6RJLngzQY+hBza4MjpBbKySgvvGLTDyb+sw/RzwKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828633; 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=WSlonkVQyb/g/APCHZ3FvJpzoXXO0zfvYBTUWJHBU+s=; b=C3jRz0pHtMCmLcPa4i2gJWPu84jH3gJn9N6q8UshstskV1I/YOuNgoOep8vVcCPrdUCCgNvBGXkN3qB6f8z38lKVWmgVyo4M7AznlVDLs1+gprx9vE1hEHMyZ+q5cxG/O6r7X6KMBZlhqa/oOD+/vaokx7hpuupJQ8refZorxlc= 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 1693828633261513.9187260281634; Mon, 4 Sep 2023 04:57:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AS-00050c-0q; Mon, 04 Sep 2023 07:54: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 1qd8AO-0004XG-O3 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:52 -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 1qd8AM-0000J3-5d for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:52 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-651-aCQ_9PeNPDaq5SI8VqB_DA-1; Mon, 04 Sep 2023 07:54:48 -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 0B1583810D2F for ; Mon, 4 Sep 2023 11:54:48 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8F9540C206F; Mon, 4 Sep 2023 11:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828489; 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=WSlonkVQyb/g/APCHZ3FvJpzoXXO0zfvYBTUWJHBU+s=; b=FbyEhpekU7UrIOKfoFUSC5ElG6Wpmk3mBMiBf5KBkblyRWzwwxFaEd/JpugXwRcwCZpTbr s3zre+plodkLZgF6H0563I6T/xaAlz5WotNJQBQw0LxDRUsHZ0C/aw+Kis2R83DakNTBpA HkTim2ksvuNBn/BK30v2SopCq888czU= X-MC-Unique: aCQ_9PeNPDaq5SI8VqB_DA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 29/52] ui/console: move graphic fields to QemuGraphicConsole Date: Mon, 4 Sep 2023 15:52:26 +0400 Message-ID: <20230904115251.4161397-30-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828635325100003 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 Message-Id: <20230830093843.3531473-30-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829137; cv=none; d=zohomail.com; s=zohoarc; b=RHcHwDrkMs8M9dgHpAtayZNUPh9II1h4zxt2WRiy2ayYKQtEU2gGX/DwA5KxLGvaXe3PVXycsp8Xfg0qp/9s3JCQrxqrLqSg3BpnMUabmY6uEa4nrcNn1JnKvQwFGkF9FmHRL28wclI4T3ScV1ViBCDmcGBn/aHG0OeY/wlPTf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829137; 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=4ol6elF5+UsrqDnlvwI56kD0rEpwXoF+E6uIro3ZY9A=; b=fi/dTf4kCL4t1t8NX19sEK87LlOGdqzW2nNBiVeSZqSL4QLx6sTbN1rI8xlVt99WnyUQ146o/DCjUIv4j6xKJhhr+gRvudtgIDocEy0NfW+QgbwtBWs7AnYy/qDEAKyape5TlWBH2wm4wC5Y6r1gi/FC3c7Ks0VTAl6f5W0yY0Q= 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 1693829137267274.04916803818946; Mon, 4 Sep 2023 05:05:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AV-0005Yl-7A; Mon, 04 Sep 2023 07:54: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 1qd8AS-0005Dh-W4 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54: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 1qd8AQ-0000L2-Ku for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:56 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-623-yUFivt5fPEWTxB-D_gsrmw-1; Mon, 04 Sep 2023 07:54:52 -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 854E03C01B90 for ; Mon, 4 Sep 2023 11:54:52 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D3B140C6F4E; Mon, 4 Sep 2023 11:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828494; 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=4ol6elF5+UsrqDnlvwI56kD0rEpwXoF+E6uIro3ZY9A=; b=e4xc5TH2H30NvUi3DdvHyGn7AR5jt3xGIpUR2LnlJyuTi7pS4S5PP35sfHE+eUzwBI3FYt LksxOYrawhRmo93JJKCGTWfnX1kqZ89jlz1fIqD2PvvSx3Jivoh71CWXuZ8Yb4hys9NdO2 a0Ex3n9AwLaKofqnBIni9fO/e8VRJ/o= X-MC-Unique: yUFivt5fPEWTxB-D_gsrmw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 30/52] ui/vc: fold text_console_do_init() in vc_chr_open() Date: Mon, 4 Sep 2023 15:52:27 +0400 Message-ID: <20230904115251.4161397-31-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829138730100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230830093843.3531473-31-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829020; cv=none; d=zohomail.com; s=zohoarc; b=K3rnmZSfc7uBpUkToqODvfkV21yrV/6s6spUD7hUStnF/hb+plrng/nbtAWztCS/DAUhHInwJfhREzEuB3ItoShZgV5q1mim4Ey7qIRJV86BxbV9YfE/KRW084SW1NzunCTiYhao+rda0t/MOk3MJ9YHumCuKRdfHX2kCtED3kg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829020; 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=oFQ0KWzPVQZfSv1/4EvjQpexOYJPeODMQsywT4DFGeg=; b=EDmxtaxLYqaI4YSeThymtcgJ67Ljw7h2ZYpELIIRddhmdeNkIl62bOu/V+GVw21IAVHzMbyR6zgwsp042vBwa89JDCg3reNaGJHQcIX1J7gxLT6j/uGH9U5bYFVh/stFORnuLshblJDQPGPlXmBGDRMsWKFN1++Ws2pykniy5G8= 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 1693829019949561.9571046925076; Mon, 4 Sep 2023 05:03:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AY-0006Bm-Is; Mon, 04 Sep 2023 07:55:02 -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 1qd8AW-0005xe-V9 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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 1qd8AU-0000LX-LP for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:00 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-609-tdYQXmTvPUy7Gpej3NttXw-1; Mon, 04 Sep 2023 07:54:56 -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 126BD1C2979A for ; Mon, 4 Sep 2023 11:54:56 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FF6A2026D4B; Mon, 4 Sep 2023 11:54:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828497; 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=oFQ0KWzPVQZfSv1/4EvjQpexOYJPeODMQsywT4DFGeg=; b=eXvtqukkHCGOEOGvKNddBLJRbeIdOV0rZLmiK614oRciGzIs2p75Myxqv31TPMgGmE6Sc+ h29kHXkhc3YKuoeZ9hoCabCRt8rXXDvFh+eYvrhij4tL3wHF7pWYHSb6hNsnY3Q7Owcxpz lebam1qUwIvRGhQghf74h3Jp4ZMwTLc= X-MC-Unique: tdYQXmTvPUy7Gpej3NttXw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 31/52] ui/vc: move some text console initialization to qom handlers Date: Mon, 4 Sep 2023 15:52:28 +0400 Message-ID: <20230904115251.4161397-32-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829048802100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-32-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829275; cv=none; d=zohomail.com; s=zohoarc; b=kgQstmkqLrZQ+51WFLQjCRZAqP2j3gJ9pgkXVanhxLp+1S/ByBwEJnM22scVtqhobyAqlZVJq/Ufrmct3ILcRuwbbvnC8GHHNAQ1mVIXJgeWch1LgQVpF5HG2oL7QObmhy5eqS2niHG6k3oDWl3cjTuYcx+Cq4YV1Ipe4FZWMnU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829275; 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=2Ne/7j6le0wzOyvB/VuAUFxnOQk1uvQsIvzJaRXinX0=; b=PNVGfYBTOGs59mnNSi/J1l7IrU3ezUnHjTjkIKhMKqCgjqk3eqQkR4p5ApZI/eaJwWEa6aIVv/4CzcdzJ/ugiODgKoa2UNwQ2T+h18OIPEnWrXgNAOlGONjubhCRForcXJok5Jg5mz3G3h94y9w1yMJpL4K1cTuWxZq9ZB5gOvg= 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 1693829275483112.77763969607474; Mon, 4 Sep 2023 05:07:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8At-00072B-RX; Mon, 04 Sep 2023 07:55:27 -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 1qd8Ab-0006Ve-3h for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:07 -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 1qd8AY-0000MN-RE for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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-607-B7N-ndzVPC2aep4YgqlVXA-1; Mon, 04 Sep 2023 07:55:00 -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 5CDA9803F3A for ; Mon, 4 Sep 2023 11:55:00 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5BD68400F5A; Mon, 4 Sep 2023 11:54:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828502; 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=2Ne/7j6le0wzOyvB/VuAUFxnOQk1uvQsIvzJaRXinX0=; b=YTuvrqu8s8ndFXZ1MmakoDn8/ewgXahgDOnLd/9vyrm4WvyigZQmBmMUNT8q0M6kUfXIBU /KYVWwfn2gAUDzDvFTcth7tKwaU8fnwGEP09yZf2/hjAhJ4DM0UR6GLX+30sWrXVjdDhYa e6BWvVBQnjCyEsA56Q4hyd30TE4Rr9w= X-MC-Unique: B7N-ndzVPC2aep4YgqlVXA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 32/52] ui/console: simplify getting active_console size Date: Mon, 4 Sep 2023 15:52:29 +0400 Message-ID: <20230904115251.4161397-33-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829276238100005 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 Message-Id: <20230830093843.3531473-33-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829100; cv=none; d=zohomail.com; s=zohoarc; b=U0W9x//6YLui10TWbPz9YpzKV34ldOmmZ6p9h/O1lzsDKFIMHM3X6HDBbl5PuaIGp1zBydpBr6owxuXVIhiPVJA6DXMF3FLcueMFHVb60mppKkXUoV26RFuJL7T2sp4335SpNdALAALw1a2caoebLJFu/TuAPLYdXsk+Ktu34S8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829100; 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=XUz5LIlrpmlm/3ukp2eWAxrg7lMtd/aX1XpFWZr4JgE=; b=fhkcc87fFbfACtw+y6h+JxvGW0YWcnE+USOzETIDTjjsYH0/Dvo3FdrpMycOuaPpx+2FUD9+IsWZHabqrJdZzbblG5BzkzlJ84HM61PINmB/HSTHD4alyTHlAIOcKIrj9IDak0YGtTCGEKMIxAamCEg4gXN8HQ6ZANONLF+m6zo= 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 169382910051450.018027568485195; Mon, 4 Sep 2023 05:05:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8B3-0007Co-1n; Mon, 04 Sep 2023 07:55: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 1qd8Ah-0006tC-25 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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 1qd8Ac-0000XY-T0 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:08 -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-195-zJJwVuwON4a1xjvVhha8AQ-1; Mon, 04 Sep 2023 07:55:04 -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 4F252800C78 for ; Mon, 4 Sep 2023 11:55:04 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FADC1121314; Mon, 4 Sep 2023 11:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828506; 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=XUz5LIlrpmlm/3ukp2eWAxrg7lMtd/aX1XpFWZr4JgE=; b=XUgEXbch4Vyv+NY4/YacCbnnlcFGV8Y9SjT9glTCXyglE44XH+Vxtj1WBjzc5nmEOR3yA5 d3KGHjcZqSP0n6p9d5fyKJrmzLGWlCcul8+MU2q1hu9HtDkMxuEWMshN+oZBt6H0DHeZGJ ounIno7JrbzO+ScDisCrlFOuSx+H7AY= X-MC-Unique: zJJwVuwON4a1xjvVhha8AQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 33/52] ui/console: remove need for g_width/g_height Date: Mon, 4 Sep 2023 15:52:30 +0400 Message-ID: <20230904115251.4161397-34-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829102124100003 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-34-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829420; cv=none; d=zohomail.com; s=zohoarc; b=M5+ZH18+MmIjrQDrPfustOGm9nreuQtdscI4iljiPe1/uQerW1Z8uGADhP7RN+/ulpmlgcOfHMZgJq52pf63MwoXj87F0yFutltN0xEu7qdfU8u62Th1FG5+haRhA+nPOibn8Ox5ODvU4BuGOml0q7uUJRDFbWMP5xtV5ZTx5d0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829420; 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=b2rNjEp/JzIVt97SxAZIimLer1BY0QFgisrshHK2Peg=; b=Ve+LgMQBnl6UdX1vP8UjD5yXTCpbqINlrZOFQUfJAXchXa2nF23a3fIYCtxLSpmVpUUyhw0WBEhQtSkib0yzDO+ibhSfGmkm7pmm2DaoFoqtQnxrho0pGAIWOsxPIMA2hDleVGErycxF4xUd3PPsRc2n7FNUhqHMjnct+QUdQ/E= 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 1693829420240869.0239821694265; Mon, 4 Sep 2023 05:10:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8B8-0007hz-L8; Mon, 04 Sep 2023 07:55: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 1qd8Ai-0006tp-UL for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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 1qd8Ag-0000YH-RJ for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:12 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-311-n28heJ7API2nCMLXz0yP_w-1; Mon, 04 Sep 2023 07:55:07 -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 6AA0F3810D2B for ; Mon, 4 Sep 2023 11:55:07 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id A12B440C84A6; Mon, 4 Sep 2023 11:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828509; 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=b2rNjEp/JzIVt97SxAZIimLer1BY0QFgisrshHK2Peg=; b=CjXKEcsVWStr/+1ZKvVnKshdvqviGqz3lfY3pnIXTJF9dv0RcuQhP7i/feIPfqAbIKsoCH aigANfuW/prZCbZTiG+5CV8vYs8Yyxa1q+ffRJtfKpJ3ponWU181SHyoDlKauJKRpPLVPd V1RmWYGA2PdK3JjtNUCmUlwOBO2KD30= X-MC-Unique: n28heJ7API2nCMLXz0yP_w-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 34/52] ui/vc: use common text console surface creation Date: Mon, 4 Sep 2023 15:52:31 +0400 Message-ID: <20230904115251.4161397-35-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829421408100004 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-35-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693829126795594.185116699121; Mon, 4 Sep 2023 05:05:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8B3-0007Dh-E1; Mon, 04 Sep 2023 07:55: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 1qd8Ao-0006zo-RT for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:20 -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 1qd8Am-0000ac-LP for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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-222-X1iKg2zhOamO9OG2Db_3gA-1; Mon, 04 Sep 2023 07:55:12 -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 BFA8910264C1 for ; Mon, 4 Sep 2023 11:55:11 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC01A493114; Mon, 4 Sep 2023 11:55:10 +0000 (UTC) X-MC-Unique: X1iKg2zhOamO9OG2Db_3gA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 35/52] ui/console: declare console types in console.h Date: Mon, 4 Sep 2023 15:52:32 +0400 Message-ID: <20230904115251.4161397-36-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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-ZM-MESSAGEID: 1693829128756100001 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 Message-Id: <20230830093843.3531473-36-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829179; cv=none; d=zohomail.com; s=zohoarc; b=EaEWI3iKAX1qSGHrM20Y+nH9vEGKhhOou3jr1h0rZOUK0RarbwXoL8KQ2syg3F3LV4nWygxZUaAMafXtLMdsMdjr5PLf6qqJoxuqnyyRWNpJX79+uQpMdQtEEFBj743RGaAzIr2ATAikGKM1V9e0J0ZzNoZbbys4HyH/BsT5peU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829179; 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=FoZDucxUzmuuiWyI7LBgyTcst1NkbW7tCqS4oAXyq8g=; b=W16Slc1fkaQcl5FyTfsAYAqX8vu8AjMCOfAAtWrFzvfAG50qh3XBHMY95vHuGVWI9cYqQjeNtfHbzIuQ1W8w0SczYMPSGoGzG2kWo85/Z58LgCDsAcRaLOoNj83FafxdJ7xhXQHvVenYkHcVVBiBUXz6N7vBXKBvdS8RjHY1PbY= 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 1693829179098640.403657992634; Mon, 4 Sep 2023 05:06:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8BE-000866-6A; Mon, 04 Sep 2023 07:55: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 1qd8Aq-00072A-QB for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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 1qd8Ao-0000bW-6f for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:20 -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-335-16BZt6mXP8uYeTklDpBguw-1; Mon, 04 Sep 2023 07:55:16 -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 B323810264C1 for ; Mon, 4 Sep 2023 11:55:15 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A92D2026D4B; Mon, 4 Sep 2023 11:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828517; 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=FoZDucxUzmuuiWyI7LBgyTcst1NkbW7tCqS4oAXyq8g=; b=GGY0Glg4ivFDM7jQYOxg24XvKkx3M5qUY7e3fCtH92yyMLNz8GyJ/PzEcgEhtLUKLWR14O qdEaAHSTW5bnfddpjMRyOD6/7UmriEY+sIVSX/FelQ7oyjmlnwAI4pJ4rWK3S0k1KaBMin BTbIux200ley/a+1GSl2cb9puD8AYyM= X-MC-Unique: 16BZt6mXP8uYeTklDpBguw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 36/52] ui/console: use QEMU_PIXMAN_COLOR helpers Date: Mon, 4 Sep 2023 15:52:33 +0400 Message-ID: <20230904115251.4161397-37-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829180811100003 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 Message-Id: <20230830093843.3531473-37-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693828770; cv=none; d=zohomail.com; s=zohoarc; b=bOn4dLTh1H/UxscYUXUevr5keZDnmtbe3MdbHt4JJ7dkR9lhORtZ5sIfYkOVPjEyRYIt8T6BLue+0yEFSzS+1Cojluc6Oq0uBkWQBssBElE3mAJ5FTGehuuKsvexmA37QFmZJkQILk23ltm9eyLX2Pg/tIU5nZ+ucmR6nB3JSEU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828770; 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=l4PK8BQ+1DCqciH7hpenAmD1DXvcbABEEaYzHETY/AU=; b=epBprnO/ZnzATKhM+FEQN7PqMkStn1H7afteBoF87efC9Th1EpDR5YcNdQjO0OGttmuYQSBZdzEv3PvKERef8DoPp3VP1dSAS+xTMm9FwQD/C/mPumEDvLzy5y0DGigOKQBVvbc443igMcfVgEVmCWjNeL0a7KDbRdLd6UPLNME= 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 1693828770614820.9673629483981; Mon, 4 Sep 2023 04:59:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8B7-0007Za-Eg; Mon, 04 Sep 2023 07:55:37 -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 1qd8Ax-00079C-6j for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:28 -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 1qd8Av-0000d4-2I for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:26 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-47-3KobwjplOwWoE4OZRLnIWw-1; Mon, 04 Sep 2023 07:55:21 -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 D0C53380671E for ; Mon, 4 Sep 2023 11:55:20 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA1E12026D4B; Mon, 4 Sep 2023 11:55:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828524; 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=l4PK8BQ+1DCqciH7hpenAmD1DXvcbABEEaYzHETY/AU=; b=G7iNMWqxh9JIE70yhRqq/Pjgj6hgIrdRROeGOmUThnaPI/GHHQTR34m78SnYEBY1cavoga ILGaCNT0N/D26sQlccaSvOW1glbKBEasSdyHQkWuifTh9rZxQkPYMsv8Iopir1aV/GcTqY M3vfV81gYDOfNp883yjHzAF02wCjVBA= X-MC-Unique: 3KobwjplOwWoE4OZRLnIWw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 37/52] ui/console: rename vga_ functions with qemu_console_ Date: Mon, 4 Sep 2023 15:52:34 +0400 Message-ID: <20230904115251.4161397-38-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828771280100001 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 Message-Id: <20230830093843.3531473-38-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829144; cv=none; d=zohomail.com; s=zohoarc; b=I5dkBG55tCNrLHQGz8F1LP6Y0WGEnu+fqHk8H5yhzBy4ATSsj0q0DnjSE3yelqtZptPKtAO+yoWizIuSgf0OrOe5UQhdR06MC1D2BWAOWyESyiPd1T1aebcBmb/2OI9UuULDAlk9HdVUcafLcnXkZQ5WHgDAHGOCIcNu9mroyIw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829144; 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=EmFenIM6fiAIHCfc6XVEryrdi9dLy3h1rbHdrUpWTCY=; b=Du4c64oILh3/NVintyLqJU8Ik1Ww8tL3Xb8Hs/rk0Gcq2YrtglKoKxCYgNQjIKChqzQnvcI8aJ6K7GX3MROxKUQZAULPeo/XBMwJ/KrXpbwROJaEKBbUXUUE1SS9WiffdNZ7yoWGJQZLXq146lIm1aQZU5Ggif4meuZqVyEyV1Y= 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 1693829144080786.2198215357795; Mon, 4 Sep 2023 05:05:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8BR-0000Yl-A4; Mon, 04 Sep 2023 07:55:57 -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 1qd8Az-0007Cf-90 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:29 -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 1qd8Aw-0000dF-S3 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:28 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-440-Cvl8aw57PpiyiI-DxmNFmg-1; Mon, 04 Sep 2023 07:55:25 -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 C0269380671E for ; Mon, 4 Sep 2023 11:55:24 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BD4A1121314; Mon, 4 Sep 2023 11:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828526; 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=EmFenIM6fiAIHCfc6XVEryrdi9dLy3h1rbHdrUpWTCY=; b=ds6JlHhO4gs2JEdCc0EjTVoqqIs2QzsmAXZtNtuWh6IsOnbNamDUJlfm7yipJFNg5ePIUr K3uLRtUax5n52kGtXEWcn4v5r+sDk2c1nlx2G4mtDDeQZqEo6tunLYFbDfroP6F8jkFEJu En1wIee9pf9DpOWK/LJ2KJia0X1gECM= X-MC-Unique: Cvl8aw57PpiyiI-DxmNFmg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 38/52] ui/console: assert(surface) where appropriate Date: Mon, 4 Sep 2023 15:52:35 +0400 Message-ID: <20230904115251.4161397-39-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829154398100001 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 Message-Id: <20230830093843.3531473-39-marcandre.lureau@redhat.com> --- 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 Thu Nov 28 07:45:37 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=1693829039; cv=none; d=zohomail.com; s=zohoarc; b=GTRAeebIoJZ8JP5SejQoJH0IBTd78rqBbYkaNObD8B4pXqj26JtYRXd0BaAr1YZvKI8puq9rYlJZLJFgxsLD7AqpspGAKt6zuoGtx5s3EgbDQRzppHWAKi3QHsHCmk9SnpY4PNLSW42umW8XYF3E8g7gtMxD2C/Nvd/WmfoswZs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829039; 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=BoDQPAN4tJ7/28gB3i6yQWU40/5WGmppXYhWDlLtj8c=; b=FoUl+J6tlsC27PbKgaA5E0nag3rQWJtwzk0JBWYnDtyYGIpDyJpFdTfP5oO8c77LnTHJ5uiDNVdSxdJfMc++aKMbDOYsco0ioQaZzKl+bTdxVHzsaqVkhdQjsOZ0BjhCKBspNh/+b1nb8ArpqXVLYZyGTA1WO/aRmJBEjQFz/b4= 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 169382903917131.927808164677003; Mon, 4 Sep 2023 05:03:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8B9-00082q-QH; Mon, 04 Sep 2023 07:55: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 1qd8B5-0007R5-Jl for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:36 -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 1qd8B2-0000ec-Hh for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:34 -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-319-7Mn17-4UNM6acXAhlj7Xng-1; Mon, 04 Sep 2023 07:55:29 -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 64C2A800C78 for ; Mon, 4 Sep 2023 11:55:29 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 929E040C206F; Mon, 4 Sep 2023 11:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828530; 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=BoDQPAN4tJ7/28gB3i6yQWU40/5WGmppXYhWDlLtj8c=; b=B8FBE8njo93lGYjDJ2Ib/gTz+VB1q6R48rxYQw2dE8of7r96E7U+In9AQwBe3hz4/ux9/4 eHHHNNhdZXDN5cmuWrQiacVovWqkj84NfGpy6M+SoaD/NWZA6AkBwWmCZFt8wQYlmyeNDH v0o8x8VJCV/DbZCh6zSYq2UUNLy3IWQ= X-MC-Unique: 7Mn17-4UNM6acXAhlj7Xng-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 39/52] ui/console: fold text_console_update_cursor_timer Date: Mon, 4 Sep 2023 15:52:36 +0400 Message-ID: <20230904115251.4161397-40-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829039694100001 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 Message-Id: <20230830093843.3531473-40-marcandre.lureau@redhat.com> --- ui/console.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ui/console.c b/ui/console.c index 04ec2d2488..0a48ce9159 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 Thu Nov 28 07:45:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693829010738178.99742906290066; Mon, 4 Sep 2023 05:03:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8BP-0000VG-5K; Mon, 04 Sep 2023 07:55: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 1qd8B6-0007XA-K0 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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 1qd8B4-0000fe-Cd for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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-516-bHROCRF9NTaw-V1XJ_AkOg-1; Mon, 04 Sep 2023 07:55:32 -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 68AA810264C1 for ; Mon, 4 Sep 2023 11:55:32 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB2AC1182EB; Mon, 4 Sep 2023 11:55:31 +0000 (UTC) X-MC-Unique: bHROCRF9NTaw-V1XJ_AkOg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 40/52] ui/vc: skip text console resize when possible Date: Mon, 4 Sep 2023 15:52:37 +0400 Message-ID: <20230904115251.4161397-41-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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-ZM-MESSAGEID: 1693829040398100005 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 Message-Id: <20230830093843.3531473-41-marcandre.lureau@redhat.com> --- ui/console.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/console.c b/ui/console.c index 0a48ce9159..4ee3b77568 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 Thu Nov 28 07:45:37 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=1693828794; cv=none; d=zohomail.com; s=zohoarc; b=ZWQCc3PR/4R66P3UejY6tNCXbFQMhI6YrDcVadK6DZi+FTEWmC8Y9OvseV0qQJUEERXzC4BtyBevyoeAUT8qP05wSBc6qTgk1yFk2ZBP7ZJ5MJ3os7V+iBxaSZe3BuJzbUKwJEu8HlXmOCWql6EnHli1DDnXc+KNWposxb5LxRE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828794; 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=LxMIBQi7PlqW3/xdFHAfeW/CZD2xQBgZSMYVWBTn90A=; b=N7c6TkoLmHCwxBUU7z6M9iWTawR+EuaaQ2SH5USBLeQbS1RqPJa2lCB8po430C9dIkFdAR1K7XhGwZMYT2oSjcjonBFYM/3N2lsm9ciKkPu2+mSj1TvbkyJSXiV50OvhOmF1l5Cnr+S+5ywg7TbEgxbghFYZ5UORCQu4mrc97xU= 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 1693828794141739.6042659966988; Mon, 4 Sep 2023 04:59:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8BR-0000ZY-Ag; Mon, 04 Sep 2023 07:55:57 -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 1qd8BA-0008Eu-OS for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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 1qd8B8-0000jG-FX for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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-526-sEfLxxIuPL-HAh7-n9c4QA-1; Mon, 04 Sep 2023 07:55:36 -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 217D9803E2E for ; Mon, 4 Sep 2023 11:55:36 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77E6D493114; Mon, 4 Sep 2023 11:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828537; 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=LxMIBQi7PlqW3/xdFHAfeW/CZD2xQBgZSMYVWBTn90A=; b=i9rqGr6rvAq4d9f/G0BYlapk93Nj7mMYUZBmwD45WB1b+rOc/AB/+8lVqqIlHXgD7fDUmt oihQBgPJJQ7V8DJ7mYu7j52Qeo+KFKcHv2KNzY3oKp81JCtbQuI92aN71+PdhpLFwIL8Bd kEdd/Q72sWY0uOEtcA29uNpchDdmdcg= X-MC-Unique: sEfLxxIuPL-HAh7-n9c4QA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 41/52] ui/console: minor stylistic changes Date: Mon, 4 Sep 2023 15:52:38 +0400 Message-ID: <20230904115251.4161397-42-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828794622100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-42-marcandre.lureau@redhat.com> --- ui/console.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ui/console.c b/ui/console.c index 4ee3b77568..b1d375ecb4 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 Thu Nov 28 07:45:37 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=1693828650; cv=none; d=zohomail.com; s=zohoarc; b=fJKhYZWz+WJKK8vPHbng1T5XNt712zSyMs2lLQZEx3fNsevaSoAJw5IIXVgMzUj/DnUCS75yesC2ypF30nUBkkJC8gxBcI0FpS8taDe6EOJ+wqOPoLMEKBkSirhCEBElPzVUxnsBIXBOLg59U5kIEofxTnv4/vV2/hjHj1ikAi4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828650; 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=Tw8Jfq1yleSfAzzkeHw+4IZ6jVaWLy6lodD1vq/fnME=; b=XrLImbrg4s2imRgbbctXZUOotF6LwlGI6pClRajfL5KKzkf906+EHMKcR0c6cK/9U8FYz0zRfleROBnSeAg3xlo+wofM3Pns8t6OInbfm2Qs+1Cvn/+0m0i3C7DQw+HT0+Ajr/OJ8A0NV+Hi4sYZ0pPaP2jgsX9cPi13m+V1wfM= 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 1693828650459325.23326716069903; Mon, 4 Sep 2023 04:57:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8BW-0000kx-1G; Mon, 04 Sep 2023 07:56:02 -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 1qd8BF-0000QQ-Po for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:48 -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 1qd8BC-0000lG-K6 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:45 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-147-IOcxeru7NQ6bItJIa5yuUA-1; Mon, 04 Sep 2023 07:55:40 -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 0086F380671E for ; Mon, 4 Sep 2023 11:55:40 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3350E40C206F; Mon, 4 Sep 2023 11:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828541; 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=Tw8Jfq1yleSfAzzkeHw+4IZ6jVaWLy6lodD1vq/fnME=; b=UzPF8lK6ReyYtWEzc2GpTMpaQzZWB8VxVPCriIL0LStH8+SUlk7RQMbsm3O/Su7KO2vbbS x6HO6kJ2UyEMIjkr7XKAAXsW08F1O37fBrymC1sACyoHBJVt8tvy7IT49ouuHg5S8r89r5 4QDyPLSDCcrMmV3/nylz8fnXpxkHLQE= X-MC-Unique: IOcxeru7NQ6bItJIa5yuUA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 42/52] ui/vc: move text console invalidate in helper Date: Mon, 4 Sep 2023 15:52:39 +0400 Message-ID: <20230904115251.4161397-43-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828652615100003 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 Message-Id: <20230830093843.3531473-43-marcandre.lureau@redhat.com> --- 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 b1d375ecb4..ba9da8c1b3 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 Thu Nov 28 07:45:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693829591884101.35486758131469; Mon, 4 Sep 2023 05:13:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8BT-0000gC-HS; Mon, 04 Sep 2023 07:55: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 1qd8BI-0000Te-DE for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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 1qd8BF-0000mP-Mu for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:47 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-315-UATYqAN3OpmGo9KOEBmkgg-1; Mon, 04 Sep 2023 07:55:44 -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 B28FC3C0BE24 for ; Mon, 4 Sep 2023 11:55:43 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id BEB472026D4B; Mon, 4 Sep 2023 11:55:42 +0000 (UTC) X-MC-Unique: UATYqAN3OpmGo9KOEBmkgg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Eric Blake , Markus Armbruster , Gerd Hoffmann Subject: [PULL 43/52] ui/vc: do not parse VC-specific options in Spice and GTK Date: Mon, 4 Sep 2023 15:52:40 +0400 Message-ID: <20230904115251.4161397-44-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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-ZM-MESSAGEID: 1693829593293100005 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 Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-44-marcandre.lureau@redhat.com> --- 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..c1bab7b855 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 the VNC or SDL graphical +# display backend is active. They are ignored with the GTK, Spice, VNC +# and D-Bus display backends. +# # 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 ba9da8c1b3..e2b0b9ce06 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 Thu Nov 28 07:45:37 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=1693828626; cv=none; d=zohomail.com; s=zohoarc; b=aZnFczgYk4u3Mq4W/bkED6Yv75tYpYb17Ej2uhg3IaZqiRLrGF13Qe0a3ix3PPsEZKwxC5IpbxIShH6dRWd3L7shZ+bkDCbNIhBY/Q5j24Mgdsy3ljIeduywGAu3A9NKjYhKLYcOA1kI+QiSiKIhQ44XG71Ir7DQb/thZSlziMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828626; 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=jwisok89V+z6ZrudsYeGkn84x6t1e0ASdik0dInwXEg=; b=a9kRXmn09taF4KAKRmDSpeMLZ8dICmJI3ta6yevQczW4s+ScZi5hBdIYOCzXmKdPUMCVAlAwaxm/NuEgtPhlBnKnNMmT9da8ljg3BcNsnjhWIfKtZcECDnKJX+7jOUDCCWu2OOky8+7RpYjPOgBr2Tz31r9VTKnMmB9s4zFllSo= 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 1693828626009365.2174384576949; Mon, 4 Sep 2023 04:57:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8BX-0000nh-NP; Mon, 04 Sep 2023 07:56: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 1qd8BL-0000U9-VY for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:52 -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 1qd8BJ-0000nm-KE for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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-651-CfvFrV1vOrihkURvo0_bJQ-1; Mon, 04 Sep 2023 07:55:47 -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 860A51817909 for ; Mon, 4 Sep 2023 11:55:47 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82E13493110; Mon, 4 Sep 2023 11:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828549; 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=jwisok89V+z6ZrudsYeGkn84x6t1e0ASdik0dInwXEg=; b=OP17o875bps6mfUb6TNuSutwtg7KGHukxRhCmLPdzRn8vlh6x2CieUPn/SZGayfdZmcOcZ xv32q3nSI2q4hS1gnKAe52J5Xsl9K3OvqygSJOKkWky9sZmjE7/E/jrJaiF6FnqcjVNRlj 0CQf6kkIqC5/3pTQI+fbPKDlZoZCj7E= X-MC-Unique: CfvFrV1vOrihkURvo0_bJQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 44/52] ui/vc: change the argument for QemuTextConsole Date: Mon, 4 Sep 2023 15:52:41 +0400 Message-ID: <20230904115251.4161397-45-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828626615100001 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 Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-45-marcandre.lureau@redhat.com> --- include/ui/console.h | 6 +++--- ui/console.c | 14 ++++++-------- ui/gtk.c | 2 +- ui/sdl2-input.c | 7 ++++--- ui/sdl2.c | 5 ++--- 5 files changed, 16 insertions(+), 18 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 e2b0b9ce06..e4d61794bb 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..a318cc5867 100644 --- a/ui/sdl2-input.c +++ b/ui/sdl2-input.c @@ -43,15 +43,16 @@ void sdl2_process_key(struct sdl2_console *scon, ev->type =3D=3D SDL_KEYDOWN ? "down" : "up"); qkbd_state_key_event(scon->kbd, qcode, ev->type =3D=3D SDL_KEYDOWN); =20 - if (!qemu_console_is_graphic(con)) { + if (QEMU_IS_TEXT_CONSOLE(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 Thu Nov 28 07:45:37 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=1693829588; cv=none; d=zohomail.com; s=zohoarc; b=BCVws1gWBBxw5eYSmA6VYzanvFERJ0L4P3FWW3ZSOqirUPnc/OGa2vpgOhcdWyN9cBDqk1JPcDaphpOFnh5NpWIXSPMCcd/AtKccIxgCeLZ7dWx7eCUyAKn/Mn1xUsXqqVqOFzeRPH49+MsEo3u3+aQiXUSoYmU98rBOchWjHYw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829588; 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=4tZfSsnhfezWbR25O9bGbK3oCf6AjZ5e+y9iHI+/Jts=; b=UrqYSOYzpknKpyELx4id8uU5jrVM280Hn3H2H2FZ/AZugGtPK2gvdk0x/rnv1mQtZ8WqoIMKpwA1NddH5166p7FrRoWwaKyiIOKlw9S9U0Xev4jmvI1/vWyBlolJ8Jzd2z07GHSfJ4rNPVmxrlONaqOb2R0sOcvdSaLsTuOcvSY= 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 1693829588448997.9944406858579; Mon, 4 Sep 2023 05:13:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8BZ-0000pn-Go; Mon, 04 Sep 2023 07:56:05 -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 1qd8BQ-0000ZA-8W for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55: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 1qd8BO-0000oP-1a for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:55:55 -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-rYUzNEOlPr-rtncGciB39A-1; Mon, 04 Sep 2023 07:55:51 -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 7981184AF9D; Mon, 4 Sep 2023 11:55:51 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E186493110; Mon, 4 Sep 2023 11:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828553; 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=4tZfSsnhfezWbR25O9bGbK3oCf6AjZ5e+y9iHI+/Jts=; b=S374vXqeh41dRfqu100DJdgn6n9uKLMXR5gmhJFjsNGytyNtsT256Hn9Z+giBn9TP18JLz lVQ607IV3nhlbsw8hklTVJZD2A+/nZoZr0IBB9ttkNkfMmaghweAm8a2NCVK5hWCa36xG5 2K5N678PnfaAR3Dp9onPAn44fMDNmX4= X-MC-Unique: rYUzNEOlPr-rtncGciB39A-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 45/52] ui/spice-display: Avoid dynamic stack allocation Date: Mon, 4 Sep 2023 15:52:42 +0400 Message-ID: <20230904115251.4161397-46-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829588851100001 From: Peter Maydell Use an autofree heap allocation instead of a variable-length array on the stack in qemu_spice_create_update(). The codebase has very few VLAs, and if we can get rid of them all we can make the compiler error on new additions. This is a defensive measure against security bugs where an on-stack dynamic allocation isn't correctly size-checked (e.g. CVE-2021-3527). Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230818151057.1541189-2-peter.maydell@linaro.org> --- ui/spice-display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/spice-display.c b/ui/spice-display.c index 3f3f8013d8..0e2fbfb17c 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -189,7 +189,7 @@ static void qemu_spice_create_update(SimpleSpiceDisplay= *ssd) { static const int blksize =3D 32; int blocks =3D DIV_ROUND_UP(surface_width(ssd->ds), blksize); - int dirty_top[blocks]; + g_autofree int *dirty_top =3D NULL; int y, yoff1, yoff2, x, xoff, blk, bw; int bpp =3D surface_bytes_per_pixel(ssd->ds); uint8_t *guest, *mirror; @@ -198,6 +198,7 @@ static void qemu_spice_create_update(SimpleSpiceDisplay= *ssd) return; }; =20 + dirty_top =3D g_new(int, blocks); for (blk =3D 0; blk < blocks; blk++) { dirty_top[blk] =3D -1; } --=20 2.41.0 From nobody Thu Nov 28 07:45:37 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=1693829049; cv=none; d=zohomail.com; s=zohoarc; b=JZTOEmB5Jpu6mtCYLAqGGLlbocy/EFK2+S7oKFfXq8nb3PEhXq1xdXNNSoZSZBQMu0N169+yBtKknt/AhYdo9xh0WOT3WCWLmP4cSXZqwZMLQWirypG0W07y7rSw3Y6iFmrVon2i8hCbGxiYdOyHcCcZpZLWRGX4KDyuETod15w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829049; 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=tjGC2ML3L2cd08LhzVrXNPJbEDWvTfhWKeJntBP1e6U=; b=Zj97ApMUcoz0++Lt1GsKAE6rfV/AaKL9o++X4TsecQWrmU5CWR71mk5jZ6isELBkJrHVI5J/eZuXDseGlSM1blzNOgmG4zyZW/n03yEeLwaIPWVBWuYx14vf36RxPmEI4nEWUijoD2ddkTZqJM0dFWV56V0DIMdPyGKR5ZaPdnE= 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 1693829049582960.7397897372157; Mon, 4 Sep 2023 05:04:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8Bb-0000sh-Be; Mon, 04 Sep 2023 07:56: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 1qd8BZ-0000ph-8T for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56: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 1qd8BX-0000qq-2Z for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56: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-88-NbbM8DGbNgu22cgBSfmu8Q-1; Mon, 04 Sep 2023 07:56:01 -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 0427410264C1; Mon, 4 Sep 2023 11:56:01 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 318AA2013570; Mon, 4 Sep 2023 11:55:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828562; 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=tjGC2ML3L2cd08LhzVrXNPJbEDWvTfhWKeJntBP1e6U=; b=BtSFcIkV6D72tnZuWGhrHHEAFRAHIxiaTVVntT7DCzdczvhKezbMditRjiyd/iR36crUtK JQdVA+w8Rkmk0rb2EThcWkblLWSbiNUOQSJPBx//qTG/p6b8Ssyb1wo4dK56yKoBBzkjJN A8g70T13C10DAJhRj+ulWixaUJmK0JM= X-MC-Unique: NbbM8DGbNgu22cgBSfmu8Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, Peter Maydell , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 46/52] ui/vnc-enc-hextile: Use static rather than dynamic length stack array Date: Mon, 4 Sep 2023 15:52:43 +0400 Message-ID: <20230904115251.4161397-47-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829050619100003 From: Peter Maydell In the send_hextile_tile_* function we create a variable length array data[]. In fact we know that the client_pf.bytes_per_pixel is at most 4 (enforced by set_pixel_format()), so we can make the array a compile-time fixed length of 1536 bytes. The codebase has very few VLAs, and if we can get rid of them all we can make the compiler error on new additions. This is a defensive measure against security bugs where an on-stack dynamic allocation isn't correctly size-checked (e.g. CVE-2021-3527). Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 [ Marc-Andr=C3=A9 - rename BPP to MAX_BYTES_PER_PIXEL ] Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230818151057.1541189-3-peter.maydell@linaro.org> --- ui/vnc-enc-hextile-template.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/vnc-enc-hextile-template.h b/ui/vnc-enc-hextile-template.h index 0c56262aff..8ee92086ac 100644 --- a/ui/vnc-enc-hextile-template.h +++ b/ui/vnc-enc-hextile-template.h @@ -7,6 +7,8 @@ #define NAME BPP #endif =20 +#define MAX_BYTES_PER_PIXEL 4 + static void CONCAT(send_hextile_tile_, NAME)(VncState *vs, int x, int y, int w, int h, void *last_bg_, @@ -25,10 +27,13 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *= vs, int bg_count =3D 0; int fg_count =3D 0; int flags =3D 0; - uint8_t data[(vs->client_pf.bytes_per_pixel + 2) * 16 * 16]; + uint8_t data[(MAX_BYTES_PER_PIXEL + 2) * 16 * 16]; int n_data =3D 0; int n_subtiles =3D 0; =20 + /* Enforced by set_pixel_format() */ + assert(vs->client_pf.bytes_per_pixel <=3D MAX_BYTES_PER_PIXEL); + for (j =3D 0; j < h; j++) { for (i =3D 0; i < w; i++) { switch (n_colors) { @@ -205,6 +210,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *= vs, } } =20 +#undef MAX_BYTES_PER_PIXEL #undef NAME #undef pixel_t #undef CONCAT_I --=20 2.41.0 From nobody Thu Nov 28 07:45:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693828627863378.0330751724355; Mon, 4 Sep 2023 04:57:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8Bf-0000yI-VU; Mon, 04 Sep 2023 07:56: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 1qd8Bd-0000vt-Ub for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56:10 -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 1qd8Bb-0000sE-IY for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56:09 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-266-pR113HOoPLmulbZKm60KnQ-1; Mon, 04 Sep 2023 07:56:05 -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 459752999B2D; Mon, 4 Sep 2023 11:56:05 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30BB4493110; Mon, 4 Sep 2023 11:56:03 +0000 (UTC) X-MC-Unique: pR113HOoPLmulbZKm60KnQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 47/52] ui/vnc-enc-tight: Avoid dynamic stack allocation Date: Mon, 4 Sep 2023 15:52:44 +0400 Message-ID: <20230904115251.4161397-48-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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-ZM-MESSAGEID: 1693828628680100017 From: Philippe Mathieu-Daud=C3=A9 Use autofree heap allocation instead of variable-length array on the stack. The codebase has very few VLAs, and if we can get rid of them all we can make the compiler error on new additions. This is a defensive measure against security bugs where an on-stack dynamic allocation isn't correctly size-checked (e.g. CVE-2021-3527). Signed-off-by: Philippe Mathieu-Daud=C3=A9 [PMM: expanded commit message] Signed-off-by: Peter Maydell Reviewed-by: Francisco Iglesias Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230818151057.1541189-4-peter.maydell@linaro.org> --- ui/vnc-enc-tight.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c index ee853dcfcb..41f559eb83 100644 --- a/ui/vnc-enc-tight.c +++ b/ui/vnc-enc-tight.c @@ -1097,13 +1097,13 @@ static int send_palette_rect(VncState *vs, int x, i= nt y, switch (vs->client_pf.bytes_per_pixel) { case 4: { - size_t old_offset, offset; - uint32_t header[palette_size(palette)]; + size_t old_offset, offset, palette_sz =3D palette_size(palette); + g_autofree uint32_t *header =3D g_new(uint32_t, palette_sz); struct palette_cb_priv priv =3D { vs, (uint8_t *)header }; =20 old_offset =3D vs->output.offset; palette_iter(palette, write_palette, &priv); - vnc_write(vs, header, sizeof(header)); + vnc_write(vs, header, palette_sz * sizeof(uint32_t)); =20 if (vs->tight->pixel24) { tight_pack24(vs, vs->output.buffer + old_offset, colors, &offs= et); @@ -1115,11 +1115,12 @@ static int send_palette_rect(VncState *vs, int x, i= nt y, } case 2: { - uint16_t header[palette_size(palette)]; + size_t palette_sz =3D palette_size(palette); + g_autofree uint16_t *header =3D g_new(uint16_t, palette_sz); struct palette_cb_priv priv =3D { vs, (uint8_t *)header }; =20 palette_iter(palette, write_palette, &priv); - vnc_write(vs, header, sizeof(header)); + vnc_write(vs, header, palette_sz * sizeof(uint16_t)); tight_encode_indexed_rect16(vs->tight->tight.buffer, w * h, palett= e); break; } --=20 2.41.0 From nobody Thu Nov 28 07:45:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693829094890855.4805659437089; Mon, 4 Sep 2023 05:04:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8Bj-00015p-Pp; Mon, 04 Sep 2023 07:56:15 -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 1qd8Bh-00010e-F8 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56: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 1qd8Bf-0000tE-9V for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56: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-644-sykZmR_JPgmJJLG6MptiEQ-1; Mon, 04 Sep 2023 07:56:09 -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 391391817905 for ; Mon, 4 Sep 2023 11:56:09 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 563B9400F5A; Mon, 4 Sep 2023 11:56:07 +0000 (UTC) X-MC-Unique: sykZmR_JPgmJJLG6MptiEQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, Bilal Elmoussaoui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 48/52] ui/dbus: Properly dispose touch/mouse dbus objects Date: Mon, 4 Sep 2023 15:52:45 +0400 Message-ID: <20230904115251.4161397-49-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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-ZM-MESSAGEID: 1693829096083100002 From: Bilal Elmoussaoui Fixes: 142ca628a7 ("ui: add a D-Bus display backend") Fixes: de9f844ce2 ("ui/dbus: Expose a touch device interface") Signed-off-by: Bilal Elmoussaoui Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230901124507.94087-1-belmouss@redhat.com> --- ui/dbus-console.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/dbus-console.c b/ui/dbus-console.c index e19774f985..36f7349585 100644 --- a/ui/dbus-console.c +++ b/ui/dbus-console.c @@ -150,6 +150,8 @@ dbus_display_console_dispose(GObject *object) DBusDisplayConsole *ddc =3D DBUS_DISPLAY_CONSOLE(object); =20 unregister_displaychangelistener(&ddc->dcl); + g_clear_object(&ddc->iface_touch); + g_clear_object(&ddc->iface_mouse); g_clear_object(&ddc->iface_kbd); g_clear_object(&ddc->iface); g_clear_pointer(&ddc->listeners, g_hash_table_unref); --=20 2.41.0 From nobody Thu Nov 28 07:45:37 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=1693829184; cv=none; d=zohomail.com; s=zohoarc; b=UWNoxsl7mVzIKx7pSGAdvqec6TZ4xybspCEFi/r5rlcTucjdOtjf3ehhmr3XrtSwE+VaNkyrZxlpaBcnCeKEGXNTV0Z5BwhTfCG9PV9CeSvwx2YzYd2nEKl5m0Zr34Qptsu8oAROdGLADgX9F6vNXsq5/AbLvpAOP4Ye9IvIdAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829184; 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=AhtXdRNeiJoLLsMz2vDYsiZmmU2kQifZxRBQRz5M77o=; b=JIbPFVolEc7c8YxQxwnWVSz5REeRZP27oONg8eOQGmsCfctUAlAKYkkQPMl1+fMQGp3eWdTZGsU6JbTcZVU9G5ZZyrrjTmtiXhEFNC4w6ZwqYKyLxQMNqfXYVHwPzB4IlqD5qxgh2H5KqsE+/qg/AdB3Len2jfePsPFogjju5zE= 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 1693829184811283.3683876504026; Mon, 4 Sep 2023 05:06:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8Bo-0001EQ-Nl; Mon, 04 Sep 2023 07:56:20 -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 1qd8Bm-0001A5-RF for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56:18 -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 1qd8Bi-0000vD-Pz for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56:18 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-99-4aPPfu9kM4ykZ7w2ZR299g-1; Mon, 04 Sep 2023 07:56:12 -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 8996A2999B26 for ; Mon, 4 Sep 2023 11:56:12 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7B1640C206F; Mon, 4 Sep 2023 11:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828574; 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=AhtXdRNeiJoLLsMz2vDYsiZmmU2kQifZxRBQRz5M77o=; b=DcJHVEkvgZoKP5IxRMPW2487B6ep2ZahOvIz8FvNB6J3syYMC+NzqGishAAx/SYct2Nl95 J3WklCnz+TIf/RGoUaV6VlRCOL4AaI+ZGVyp9Gh9XEyOeeUWPqCthIc9acHy8M8ZF4Zna3 taM1ZxWyKjZUB6zg5qlmnSTT985zo7Q= X-MC-Unique: 4aPPfu9kM4ykZ7w2ZR299g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, Bilal Elmoussaoui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 49/52] ui/dbus: implement damage regions for GL Date: Mon, 4 Sep 2023 15:52:46 +0400 Message-ID: <20230904115251.4161397-50-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829185721100002 From: Bilal Elmoussaoui Currently, when using `-display dbus,gl=3Don` all updates to the client become "full scanout" updates, meaning there is no way for the client to limit damage regions to the display server. Instead of using an "update count", this patch tracks the damage region and propagates it to the client. This was less of an issue when clients were using GtkGLArea for rendering, as you'd be doing full-surface redraw. To be efficient, the client needs both a DMA-BUF and the damage region to be updated. Co-authored-by: Christian Hergert Signed-off-by: Bilal Elmoussaoui Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230814125802.102160-1-belmouss@redhat.com> --- ui/dbus-listener.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 30917271ab..36548a7f52 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -26,6 +26,9 @@ #include "qapi/error.h" #include "sysemu/sysemu.h" #include "dbus.h" +#ifdef CONFIG_OPENGL +#include +#endif #ifdef G_OS_UNIX #include #endif @@ -59,12 +62,15 @@ struct _DBusDisplayListener { =20 QemuDBusDisplay1Listener *proxy; =20 +#ifdef CONFIG_OPENGL + /* Keep track of the damage region */ + pixman_region32_t gl_damage; +#endif + DisplayChangeListener dcl; DisplaySurface *ds; enum share_kind ds_share; =20 - int gl_updates; - bool ds_mapped; bool can_share_map; =20 @@ -539,11 +545,16 @@ static void dbus_gl_refresh(DisplayChangeListener *dc= l) return; } =20 - if (ddl->gl_updates) { - dbus_call_update_gl(dcl, 0, 0, - surface_width(ddl->ds), surface_height(ddl->ds= )); - ddl->gl_updates =3D 0; + int n_rects =3D pixman_region32_n_rects(&ddl->gl_damage); + + for (int i =3D 0; i < n_rects; i++) { + pixman_box32_t *box; + box =3D pixman_region32_rectangles(&ddl->gl_damage, NULL) + i; + /* TODO: Add a UpdateList call to send multiple updates at once */ + dbus_call_update_gl(dcl, box->x1, box->y1, + box->x2 - box->x1, box->y2 - box->y1); } + pixman_region32_clear(&ddl->gl_damage); } #endif /* OPENGL */ =20 @@ -558,7 +569,10 @@ static void dbus_gl_gfx_update(DisplayChangeListener *= dcl, { DBusDisplayListener *ddl =3D container_of(dcl, DBusDisplayListener, dc= l); =20 - ddl->gl_updates++; + pixman_region32_t rect_region; + pixman_region32_init_rect(&rect_region, x, y, w, h); + pixman_region32_union(&ddl->gl_damage, &ddl->gl_damage, &rect_region); + pixman_region32_fini(&rect_region); } #endif =20 @@ -738,6 +752,7 @@ dbus_display_listener_dispose(GObject *object) g_clear_object(&ddl->d3d11_proxy); g_clear_pointer(&ddl->peer_process, CloseHandle); #ifdef CONFIG_OPENGL + pixman_region32_fini(&ddl->gl_damage); egl_fb_destroy(&ddl->fb); #endif #endif @@ -772,6 +787,9 @@ dbus_display_listener_class_init(DBusDisplayListenerCla= ss *klass) static void dbus_display_listener_init(DBusDisplayListener *ddl) { +#ifdef CONFIG_OPENGL + pixman_region32_init(&ddl->gl_damage); +#endif } =20 const char * --=20 2.41.0 From nobody Thu Nov 28 07:45:37 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=1693829319; cv=none; d=zohomail.com; s=zohoarc; b=VIa/Q+1wDMmoafAm1Qc5uLnbUy35jnIYY1yUKDcwNWufFswm5++g0NmVN5i1g3CrZXmym3UiqDCekF9ODYhTwqmo0TgyQqTQ8+oDYErJ9SGSMdUdzm7+Jf2WVyWjhN163xumLo1shmKSnvkPJNx4yNY5DlnRh9e8we+SFZ6jpzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693829319; 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=ZSqUYwaW5065Yca/fSouV8kPEZ/gVgMxFwvOit9bqlM=; b=l5AxIUf4bX49CKshK+ETtJUKkbkhuUFux6Zviw5PeRdVzDDTiiRWQeRSqzWNNXkjnUjCVC/fF50CkalR7utItDB6CSvUuDgxSqDZfI2O6MGUhHO5r4PYsdrAYXrET6hp+soQ9YJLFYlfXHsp00bv7QEQksl37UpeeFBj3etCiCI= 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 1693829319667954.6584791600267; Mon, 4 Sep 2023 05:08:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8CA-0001Pz-LO; Mon, 04 Sep 2023 07:56: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 1qd8Bq-0001Hj-Mp for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56:25 -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 1qd8Bo-00010F-0Z for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56: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-199-A5bE_0ckO8umSGBkwrF92A-1; Mon, 04 Sep 2023 07:56: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 7F9191817909; Mon, 4 Sep 2023 11:56:17 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FE5A1182D4; Mon, 4 Sep 2023 11:56:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828579; 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=ZSqUYwaW5065Yca/fSouV8kPEZ/gVgMxFwvOit9bqlM=; b=YUPGqymxMLDK+pN3isYJoNd28ZnjyRrw70aDVnGDYEtMhm1KHBjXKjFcd848zidPasUHvi UVcPLrf8aOVOHzhYo7mcqR2TzidXt2J4b5BjyPdqvh3la95i/1Gh9rgKo0MFKVFjM5s+C7 BIf6W9DA59u7RKysmebjGuM14K7Slj0= X-MC-Unique: A5bE_0ckO8umSGBkwrF92A-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, Guoyi Tu , dengpengcheng , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 50/52] ui/vdagent: call vdagent_disconnect() when agent connection is lost Date: Mon, 4 Sep 2023 15:52:47 +0400 Message-ID: <20230904115251.4161397-51-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693829320419100001 From: Guoyi Tu when the agent connection is lost, the input handler of the mouse doesn't deactivate, which results in unresponsive mouse events in VNC windows. To fix this issue, call vdagent_disconnect() to reset the state each time the frontend disconncect Signed-off-by: Guoyi Tu Signed-off-by: dengpengcheng Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <71fd5a58fd09f10cdb35f167b2edb5669300116e.1692281173.git.tugy@c= hinatelecom.cn> --- ui/vdagent.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/vdagent.c b/ui/vdagent.c index 8a651492f0..4b9a1fb7c5 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -870,8 +870,11 @@ static void vdagent_disconnect(VDAgentChardev *vd) =20 static void vdagent_chr_set_fe_open(struct Chardev *chr, int fe_open) { + VDAgentChardev *vd =3D QEMU_VDAGENT_CHARDEV(chr); + if (!fe_open) { trace_vdagent_close(); + vdagent_disconnect(vd); /* To reset_serial, we CLOSED our side. Make sure the other end kn= ows we * are ready again. */ qemu_chr_be_event(chr, CHR_EVENT_OPENED); --=20 2.41.0 From nobody Thu Nov 28 07:45:37 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=1693828828; cv=none; d=zohomail.com; s=zohoarc; b=k0DEkZAYcQ2SQreXPycPfAU5mhvOxZsMc5ySjd6iHqooj7qHSlu/Mry5SB+2YBYK7biQ6+c31hmqDQTdoYH6ciHR9KE+6KKrlJbX2RVecAX8vnZFzNoLcB70z+E2KuKUtkwU9gHWuIwbP2bO3j/04lE6HTtXqKVUBCUH+g9+IwA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828828; 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=u9qzmsX2T96slRBtx7orvO5yh2WcU4rUq1DSMp/9kbQ=; b=Tp+GzXKCGtCAEoPyJM0flLLDJhHO1FC0IcO7uzTjGQ3sX6YzK+z/2e6srHcADCvngPc02rl/gz5la6eCgZDO/tkMPYzvSmhm+Jx+3m20wlJ4DKFGO2iOj6ZPfgnF0MdzaXU8z/802DMhBRCtGmvgjcmhDe/9j8XDCpcM3A7Kjp0= 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 1693828828622755.6594385867708; Mon, 4 Sep 2023 05:00:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8CB-0001XQ-Ob; Mon, 04 Sep 2023 07:56: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 1qd8Bx-0001MV-5R for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56: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 1qd8Bt-00013v-R9 for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56:27 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-44-wJxSZSs2MiqcK57oSyB7gQ-1; Mon, 04 Sep 2023 07:56:21 -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 737AB1C2979A; Mon, 4 Sep 2023 11:56:21 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6DD9568FF; Mon, 4 Sep 2023 11:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828585; 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=u9qzmsX2T96slRBtx7orvO5yh2WcU4rUq1DSMp/9kbQ=; b=Q307iDhlT46w8e89nvBvczrNd/DliaBCwrBvuOzfMi3/fRBMnVe+3/eHxwfzW1i+7HHYPN B4j76vKYxzR4YQ0t7rmav37p0ezlol3VUDr6oEzWAvoGZ+Z6t3PQ3f9itQUc06RRnIpSeh /UXt3LMTdkqJ8JnekZenye7k3L1F86w= X-MC-Unique: wJxSZSs2MiqcK57oSyB7gQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, Guoyi Tu , dengpengcheng , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 51/52] ui/vdagent: Unregister input handler of mouse during finalization Date: Mon, 4 Sep 2023 15:52:48 +0400 Message-ID: <20230904115251.4161397-52-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-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: 1693828830335100001 From: Guoyi Tu Input handler resource should be released when VDAgentChardev object finalize Signed-off-by: Guoyi Tu Signed-off-by: dengpengcheng Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: --- ui/vdagent.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/vdagent.c b/ui/vdagent.c index 4b9a1fb7c5..00d36a8677 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -926,6 +926,9 @@ static void vdagent_chr_fini(Object *obj) =20 migrate_del_blocker(vd->migration_blocker); vdagent_disconnect(vd); + if (vd->mouse_hs) { + qemu_input_handler_unregister(vd->mouse_hs); + } buffer_free(&vd->outbuf); error_free(vd->migration_blocker); } --=20 2.41.0 From nobody Thu Nov 28 07:45:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693828756414562.2669099683525; Mon, 4 Sep 2023 04:59:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8CD-0001cH-Qw; Mon, 04 Sep 2023 07:56: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 1qd8Bx-0001Me-LW for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56: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 1qd8Bv-000142-HI for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:56:29 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [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-68-OxotyrIJP8u7enRm_qYQHg-1; Mon, 04 Sep 2023 07:56:25 -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 639173C0C491; Mon, 4 Sep 2023 11:56:25 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A3D6200A4B6; Mon, 4 Sep 2023 11:56:23 +0000 (UTC) X-MC-Unique: OxotyrIJP8u7enRm_qYQHg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, Dmitry Frolov , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 52/52] ui/gtk: fix leaks found wtih fuzzing Date: Mon, 4 Sep 2023 15:52:49 +0400 Message-ID: <20230904115251.4161397-53-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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-ZM-MESSAGEID: 1693828756751100001 Content-Type: text/plain; charset="utf-8" From: Dmitry Frolov It is true, that there is no problem during runtime from the first sight, because the memory is lost just before qemu exits. Nevertheless, this change is necessary, because AddressSanitizer is not able to recognize this situation and produces crash-report (which is false-positive in fact). Lots of False-Positive warnings are davaluing problems, found with fuzzing, and thus the whole methodology of dynamic analysis. This patch eliminates such False-Positive reports, and makes every problem, found with fuzzing, more valuable. Fixes: 060ab76356 ("gtk: don't exit early in case gtk init fails") Signed-off-by: Dmitry Frolov Reviewed-by: Michael Tokarev Message-Id: <20230825115818.1091936-1-frolov@swemel.ru> --- ui/gtk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index c34c133550..a14d56168d 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2359,7 +2359,7 @@ static void gtk_display_init(DisplayState *ds, Displa= yOptions *opts) { VirtualConsole *vc; =20 - GtkDisplayState *s =3D g_malloc0(sizeof(*s)); + GtkDisplayState *s; GdkDisplay *window_display; GtkIconTheme *theme; char *dir; @@ -2369,6 +2369,7 @@ static void gtk_display_init(DisplayState *ds, Displa= yOptions *opts) exit(1); } assert(opts->type =3D=3D DISPLAY_TYPE_GTK); + s =3D g_malloc0(sizeof(*s)); s->opts =3D opts; =20 theme =3D gtk_icon_theme_get_default(); --=20 2.41.0