From nobody Thu Nov 28 09:45:25 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