Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1601912rdb; Sun, 19 Nov 2023 02:57:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IERIuiXyNCQ4dQcGW9Wwsf44OYHvo6bCZphdDR9+NsmbW1k3mDzirPRsBdrgsOOAFfIXw7L X-Received: by 2002:a17:902:bf4c:b0:1cc:4336:8c7b with SMTP id u12-20020a170902bf4c00b001cc43368c7bmr5203383pls.39.1700391472767; Sun, 19 Nov 2023 02:57:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700391472; cv=none; d=google.com; s=arc-20160816; b=RNl5MdvzUHomPdgHFm4AoP7oqvwSFKbADmTPco5zOlRNzmc5Mb0pZ3umoSPOpjEeD9 +PNxATLsWvxz5bhzpsIKIK5qH4Z+ybfiTCSuGGj5WVBPpdyqtqMFkywDUwnBZFk562IB DLvPX9bkFxot6LSN96Vb13Oa+qKW8dyGdFsnPkwA+gp5VqTKEZHRV6Njxp7l/TQs8w2e dzoy4NOE86PJsQEmMdHlupEbdIv2Hfy5Br8YIcjjOpOYrMI5D3qMJ9ohZ7Cpi5XMaTO1 2vuAXn1uQJuysHk5MsIkEjPuzDRAeNwTqNC/C8ghzI9Duz54NwCgy+gYeGW/M5qUNg0t cRig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=GpzYJKfv/0ZtdesZuwEDnk0DKAmF9L/deY6r6V9scok=; fh=FQSvBBfMTvFbI8u3G/LBiugPUJXgbwkMnQYS02tXuXQ=; b=wO1B9kTKqGvqGqMiMPXme9mBNr5ul8fSsSVVw7YSV4an4XQJsqcPKRadTwAUgDij5Y nFX2vv8OiobQwLZPu7hmhbHLjLa0ATk1fc/MqzA0MpaqyWxzcIhTFYB8L8aRHWLaHIg+ PhsXCrjEe7glx//QGiY/Ukt7SKgWtduwV9LGiqwHCvaBkZO3KLZ2N9prbmw1wgmRy1yA b7YBsIdZ+k9xAVqKI6f58Q55e1KGWwaWDlOi8P9+rehSFM+7zH0k2dzSF7QyfdY9odB9 vz5Ia9+Rg5HiYgC5PlQHlILdyghwCvovkiP9MfQwhCrYBLbUnnuA2Gvjv7zxr5XH+cbV HFAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="I8/i4bZ2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id nn17-20020a17090b38d100b0027ff63ac6c6si6358548pjb.28.2023.11.19.02.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 02:57:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="I8/i4bZ2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8F4B38057945; Sun, 19 Nov 2023 02:57:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230104AbjKSK50 (ORCPT + 99 others); Sun, 19 Nov 2023 05:57:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjKSK5Y (ORCPT ); Sun, 19 Nov 2023 05:57:24 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB973E6 for ; Sun, 19 Nov 2023 02:57:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700391437; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GpzYJKfv/0ZtdesZuwEDnk0DKAmF9L/deY6r6V9scok=; b=I8/i4bZ2rJ5jmj8hMtThvj3aTlMuC3Gm2/+0KD7pv4ez7yLuwBFN1kYvA8LG0lqTWq2yEy 70lp4S5wO1Fs1My41FVR4OWQhwtSaWdCIAYqVRxOiROUdUVaUzDxnBgQMcEBk3nt6IhrPd MBaawu1n4CHwEFSA6/RBH8QTT3PEJ5E= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-652-4AUkyP3YOKC17eods3F5Ww-1; Sun, 19 Nov 2023 05:57:16 -0500 X-MC-Unique: 4AUkyP3YOKC17eods3F5Ww-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-408f9e9e9b0so7877495e9.2 for ; Sun, 19 Nov 2023 02:57:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700391434; x=1700996234; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GpzYJKfv/0ZtdesZuwEDnk0DKAmF9L/deY6r6V9scok=; b=jXMUtl9cNQhxBLcqhYpOSb5ruQsQViIHddE3FL+cWvlyTKLGw+L4ayjnXOhzf7u7MO UokSn1OfxLVTO6zlF1r0D2IUUeAx5A/naeGnkyHk4QfknjCqzLJpfetqp7eMMbPAz2Vh RwmErmH+InPPjULjXLPqYBSrwIjUgOWeTOuDL4tsg865kH/CrXeyvPhQi6aP8aCFlAec JmeEfVDRMW+T/GeRZZFRCEm25PKvZjMUyx3Bmaym3k8Sk2pNc9UI3LvIHevbYMVVQFXu CDCNV6WQY2uBtFRXd1iDzofYbmCWBdVF9nro1hYmGoPTSwFt3w5rBs+Z06ay9hDJF/Wy zLHg== X-Gm-Message-State: AOJu0Yz8vavH4/8P4JAseQfrkuTN/xK5w4LBU++dpIahpGRTBWXd7Swe VH2RBVrc1B66VZaOnSq8Z0iJsTI3yeUTLjMuYi//OO4d9+f8J1JIMD3HCXi0VCW7D+EBCTHz6Bv hniK5RFQIKirFGNvxSDDDs9/EIUTR3VigfhA9yr9UYDAP91h9kN9IdGpyITw8UnfWI5z9FfQCcq QkQHzWBRE= X-Received: by 2002:a05:600c:35c7:b0:409:57ec:9d7e with SMTP id r7-20020a05600c35c700b0040957ec9d7emr3646460wmq.21.1700391434352; Sun, 19 Nov 2023 02:57:14 -0800 (PST) X-Received: by 2002:a05:600c:35c7:b0:409:57ec:9d7e with SMTP id r7-20020a05600c35c700b0040957ec9d7emr3646424wmq.21.1700391433813; Sun, 19 Nov 2023 02:57:13 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id d34-20020a05600c4c2200b0040a48430837sm13634419wmp.13.2023.11.19.02.57.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 02:57:13 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Thomas Zimmermann , Maxime Ripard , Pekka Paalanen , Sima Vetter , Erico Nunes , Simon Ser , Bilal Elmoussaoui , Javier Martinez Canillas , Chia-I Wu , Daniel Vetter , David Airlie , David Airlie , Gerd Hoffmann , Gurchetan Singh , Jonathan Corbet , Maarten Lankhorst , VMware Graphics Reviewers , Zack Rusin , dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH v3 0/5] drm: Allow the damage helpers to handle buffer damage Date: Sun, 19 Nov 2023 11:56:56 +0100 Message-ID: <20231119105709.3143489-1-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 19 Nov 2023 02:57:39 -0800 (PST) Hello, This series is to fix an issue that surfaced after damage clipping was enabled for the virtio-gpu by commit 01f05940a9a7 ("drm/virtio: Enable fb damage clips property for the primary plane"). After that change, flickering artifacts was reported to be present with both weston and wlroots wayland compositors when running in a virtual machine. The cause was identified by Sima Vetter, who pointed out that virtio-gpu does per-buffer uploads and for this reason it needs to do a buffer damage handling, instead of frame damage handling. Their suggestion was to extend the damage helpers to cover that case and given that there's isn't a buffer damage accumulation algorithm (e.g: buffer age), just do a full plane update if the framebuffer that is attached to a plane changed since the last plane update (page-flip). It is a v3 that addresses issues pointed out by Thomas Zimmermann and Simon Ser in v2: https://lists.freedesktop.org/archives/dri-devel/2023-November/430896.html Patch #1 adds a ignore_damage_clips field to struct drm_plane_state to be set by drivers that want the damage helpers to ignore the damage clips. Patch #2 fixes the virtio-gpu damage handling logic by asking the damage helper to ignore the damage clips if the framebuffer attached to a plane has changed since the last page-flip. Patch #3 does the same but for the vmwgfx driver that also needs to handle buffer damage and should have the same issue (although I haven't tested it due not having a VMWare setup). Patch #4 adds to the KMS damage tracking kernel-doc some paragraphs about damage tracking types and references to links that explain frame damage vs buffer damage. Finally patch #5 adds an item to the DRM todo, about the need to implement some buffer damage accumulation algorithm instead of just doing full plane updates in this case. Because commit 01f05940a9a7 landed in v6.4, the first 2 patches are marked as Fixes and Cc stable. I've tested this on a VM with weston, was able to reproduce the issue reported and the patches did fix the problem. Best regards, Javier Changes in v3: - Fix typo in the kernel-doc (Simon Ser). - Add a paragraph explaining what the problem in the kernel is and make it clear that the refeference documents are related to how user-space handles this case (Thomas Zimmermann). Changes in v2: - Add a struct drm_plane_state .ignore_damage_clips to set in the plane's .atomic_check, instead of having different helpers (Thomas Zimmermann). - Set struct drm_plane_state .ignore_damage_clips in virtio-gpu plane's .atomic_check instead of using a different helpers (Thomas Zimmermann). - Set struct drm_plane_state .ignore_damage_clips in vmwgfx plane's .atomic_check instead of using a different helpers (Thomas Zimmermann). Javier Martinez Canillas (5): drm: Allow drivers to indicate the damage helpers to ignore damage clips drm/virtio: Disable damage clipping if FB changed since last page-flip drm/vmwgfx: Disable damage clipping if FB changed since last page-flip drm/plane: Extend damage tracking kernel-doc drm/todo: Add entry about implementing buffer age for damage tracking Documentation/gpu/todo.rst | 20 ++++++++++++++++++++ drivers/gpu/drm/drm_damage_helper.c | 3 ++- drivers/gpu/drm/drm_plane.c | 26 ++++++++++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_plane.c | 10 ++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 11 +++++++++++ include/drm/drm_plane.h | 8 ++++++++ 6 files changed, 77 insertions(+), 1 deletion(-) -- 2.41.0