Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp642057rdh; Thu, 23 Nov 2023 14:13:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGXEDDk6WqrbgRHKKxSzNoM8tX+v4nuP6D4D6RGwC2TG92vmW8IUqW4+8sUy0pq0hDLutL1 X-Received: by 2002:a05:6a20:9382:b0:18b:962c:1ead with SMTP id x2-20020a056a20938200b0018b962c1eadmr1023982pzh.3.1700777624235; Thu, 23 Nov 2023 14:13:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700777624; cv=none; d=google.com; s=arc-20160816; b=WVLnXLweFFHuWsdLIcaknb1vO6X73QSYcmez86Fp7L8jKKNWVePva3FpCwaV2ZCLTf 8GD+nHR7d4CfQMziUYh+0G9oYnGEwhWzi9z7ZOesqv3DR0lBAD3g+JYOQuRKvKMrCe4c O7Bvtk9tffHF7DZCtAaks9qvD/VvBSrWgoF22a9GXm8JqFR3dm09Cq54KMnz67Z74jgK PK0fGaZV5JdWNr0Q1bMgVCHeLk3/iHNdgTZ9n+koV72odr7RgZu153jytBtY39oVZm5u e6V3Z3eUKCiIrGBJUXT6zSadyU8Abkr1+NuSwrM7eU0D6qjoS7vJQrMQ0bhWPpxxWuVR 03tg== 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=BMSDWzklTKYX0k//1UvbJiLR3VQJPVSpH9qxFC3znV0=; fh=pCO3BsbNfO9rHsTbBFEsxETynqgWPIFqgdC783cf90Q=; b=REZCnNaRMbhi6UMuJjrfSnOXgk4o8sd+mSW4ucrylRW99yZA6pOfPgaKYPyffU28ek oft0OWA0jU9AEaTyrmamMnoo9uAd8ApEiXq8LHTubbOMBciVlqB47qJ7JNjQiHHuqV/3 IpEkEQksxkPSE/jsh6PXaROIoIKJz9psmsH+gZyS7EeWgNO4f8/7i9CKf1YUWkct4qyg vA6bZcaXmSIZS9AYIz5avRYUyinpZe19P4a+ysscwd9abRDV+12tqRibaDXJyUhFIsdh WOEfVD1r6oyU92kLnH2xkaWkLrQ9e7M3w9Hm0d3k/KURwZ6o6/tLdyXtjlxgD+GkPTth /LnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VVpRFeNr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id l12-20020a056a00140c00b006b261e83225si1999928pfu.310.2023.11.23.14.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 14:13:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VVpRFeNr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id A115180628F4; Thu, 23 Nov 2023 14:13:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229918AbjKWWNR (ORCPT + 99 others); Thu, 23 Nov 2023 17:13:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjKWWNQ (ORCPT ); Thu, 23 Nov 2023 17:13:16 -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 4437910C9 for ; Thu, 23 Nov 2023 14:13:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700777601; 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=BMSDWzklTKYX0k//1UvbJiLR3VQJPVSpH9qxFC3znV0=; b=VVpRFeNrfiZyV3S9w27Q93x1UWr8OCKz6L92NCySUxYfM0/qPfm3cpOaMMP1VakAAmygkS khHPg3fnaehGxtmgytvkBCCZ8sFHS8MkQ+I+aXOdeMb/jUh5zIqsQvXw0xS5eCSDaJV+m9 PJCtYMUgJwae+3cYevCL93rmh1w28J0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-368-bL6lW-4HNXygtTLd9RWoJA-1; Thu, 23 Nov 2023 17:13:20 -0500 X-MC-Unique: bL6lW-4HNXygtTLd9RWoJA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-40b3487fa9eso7584655e9.2 for ; Thu, 23 Nov 2023 14:13:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700777598; x=1701382398; 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=BMSDWzklTKYX0k//1UvbJiLR3VQJPVSpH9qxFC3znV0=; b=SQQSd6MqeXxjdejezqkfuncmBTXtMPUxxQpzWevPUoHeoTVwQUtQaJ8pQR8qBVLjVY VLnNZhQupwKKMytWo/LxmXE38W1hGywvla+vSTVjJQKgrNKCNtq+75L6kC9D6ibqlXli /WvzZGWxE2mTK4bUMEN91uE1vFEV3zrPZieCnZ68H1JtdDr2zG/A7QzAmnzBLTrJIfpV s80/HGHmyPBBsLFioL93LKM39t2vh6W2Avl5HO+5FBQtoEH88x0Q+9M2ugPjU6gjwz9v xNymx0hD1KfaSqDxLHkPA0ivLFlPGVKFEIsnPwPRgrh+PenOwXQXnjBmoLAnpcDmwyVn DdVw== X-Gm-Message-State: AOJu0YxU1JhikI0crdy6zzOBi9hv5fvzqaH3qi5GEralDILUHO0BJgwz qZm1ONNtA/jq8H3U7ucRqG4lUkMhZb8LwW4yDqw01CYUErEBJfjOfOUwCXsAkUmibopDqYf+Atd y3lkFWctjC/+t0X9gUmq6CSPpREWw9mIWSoAL9OiiA8ZZJYo+En7xTlXv7wae1FKOlp8JGDiXd6 sbM67q3d8= X-Received: by 2002:adf:f24e:0:b0:332:e5e4:35a0 with SMTP id b14-20020adff24e000000b00332e5e435a0mr514665wrp.51.1700777597873; Thu, 23 Nov 2023 14:13:17 -0800 (PST) X-Received: by 2002:adf:f24e:0:b0:332:e5e4:35a0 with SMTP id b14-20020adff24e000000b00332e5e435a0mr514631wrp.51.1700777597458; Thu, 23 Nov 2023 14:13:17 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id v19-20020adfd053000000b0032f79e55eb8sm2641676wrh.16.2023.11.23.14.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 14:13:17 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Maxime Ripard , Zack Rusin , Thomas Zimmermann , Pekka Paalanen , Bilal Elmoussaoui , Simon Ser , Erico Nunes , Sima Vetter , Javier Martinez Canillas , Chia-I Wu , Daniel Vetter , David Airlie , David Airlie , Gerd Hoffmann , Gurchetan Singh , Jonathan Corbet , Maarten Lankhorst , VMware Graphics Reviewers , dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH v4 0/5] drm: Allow the damage helpers to handle buffer damage Date: Thu, 23 Nov 2023 23:12:59 +0100 Message-ID: <20231123221315.3579454-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 pete.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 (pete.vger.email [0.0.0.0]); Thu, 23 Nov 2023 14:13:38 -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 v4 that addresses issues pointed out by Sima Vetter in v3: https://lists.freedesktop.org/archives/dri-devel/2023-November/431409.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 v4: - Refer in ignore_damage_clips kernel-doc to "Damage Tracking Properties" KMS documentation section (Sima Vetter). - Add another paragraph to "Damage Tracking Properties" section to mention the fields that drivers with per-buffer upload target should check to set drm_plane_state.ignore_damage_clips (Sima Vetter). - Reference the &drm_plane_state.ignore_damage_clips and the damage helpers in the buffer damage TODO entry (Sima Vetter). 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/drm-kms.rst | 2 ++ Documentation/gpu/todo.rst | 23 ++++++++++++++++++++ drivers/gpu/drm/drm_damage_helper.c | 3 ++- drivers/gpu/drm/drm_plane.c | 30 ++++++++++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_plane.c | 10 +++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 11 ++++++++++ include/drm/drm_plane.h | 10 +++++++++ 7 files changed, 88 insertions(+), 1 deletion(-) -- 2.41.0