From nobody Tue Dec 30 13:06:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03E11C07548 for ; Wed, 15 Nov 2023 13:16:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343906AbjKONQG (ORCPT ); Wed, 15 Nov 2023 08:16:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343883AbjKONQC (ORCPT ); Wed, 15 Nov 2023 08:16:02 -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 BCB38121 for ; Wed, 15 Nov 2023 05:15:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700054158; 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: in-reply-to:in-reply-to:references:references; bh=WdkCfOkpqSODFD3esOEEEI4uePJ2ewc8SQpEyHY/6Ls=; b=U6Z/n1p9JiqDC6CIvylOv98blOLZil+5Sn44C/Bc1UnsV6Uv/mvGji5mqDQGzv2m6fbzLS lT8LefOSQ+/GsB++WOMHvDIVtNjNYomAprvbfiaZUD0j7DAOW4fLo+kjEVV0x7J1edAxQk kMsaIaDL1U9DM7PoYyD7blRkr+ZOlMA= 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-186-XOgwZ_QaOJi5G-tYXSK-Nw-1; Wed, 15 Nov 2023 08:15:57 -0500 X-MC-Unique: XOgwZ_QaOJi5G-tYXSK-Nw-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-40a5290e259so20789795e9.2 for ; Wed, 15 Nov 2023 05:15:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700054155; x=1700658955; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WdkCfOkpqSODFD3esOEEEI4uePJ2ewc8SQpEyHY/6Ls=; b=JfuC6tUtB5+C+nrFGFJS0nFApWgv9b7OuJrmIRUQ2Ag8vDgvyMchbvlGsULCVsfQ5L pjq1H+BIQrQ+R2XyKJr0sC5uPl4mwG0LHw1xbwjrzADF49Fo5ZiU2x76QMWSLxVMB5nN qd0gVnuIwuGFx9S8CGZNz3eWXdSle4BSGKZlA7x5vUj5COKxTJacFvT37VHPhhbUpbz/ zMvmSkRRrTWZF8XwO9NN9sRwvK0zIxtd6/VY4ALpNq/IYU3HFtNQG3eZuEgeaOgzRzji Z+9uxdFkm4nwQXfINIym7fuvJi9mgjxNG3KxD1E4kbLd+vJ9vi9SL7YpsVHveXCdlTnA f2tQ== X-Gm-Message-State: AOJu0Yw8hAHlbZ/Vt4jTHxFE85VnOluN/aEZa7bSjsBiwq38Ragbmfzy vuoOM0rJzZoyQOW/SPYwl/WmxXbkmxwJq9LueB1AnuftioEojN+a1uyu6RjHg2yqCzKm0H3uRH9 vKJfWL+U7hnxxgiIAieBbEWIXCu0y09FoyF5bE7H1lZY5s5/0WxakXuAoc26yC+pg9Ywp51n0cT SbxPuC6QY= X-Received: by 2002:a05:600c:1d12:b0:40a:4429:a994 with SMTP id l18-20020a05600c1d1200b0040a4429a994mr9334056wms.28.1700054155096; Wed, 15 Nov 2023 05:15:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGoWZxbtxmm92MRQ4/GXfrWok30Xz8lAdSnCK8MW1HWy9dYer1O9tD6vbzy8D8AMhy89TPi+g== X-Received: by 2002:a05:600c:1d12:b0:40a:4429:a994 with SMTP id l18-20020a05600c1d1200b0040a4429a994mr9334033wms.28.1700054154854; Wed, 15 Nov 2023 05:15:54 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id m16-20020a7bca50000000b0040841e79715sm14706785wml.27.2023.11.15.05.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 05:15:54 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Maxime Ripard , Bilal Elmoussaoui , Simon Ser , Erico Nunes , Pekka Paalanen , Thomas Zimmermann , Sima Vetter , Javier Martinez Canillas , stable@vger.kernel.org, nerdopolis , Daniel Vetter , David Airlie , Gerd Hoffmann , Maarten Lankhorst , dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/5] drm: Allow drivers to indicate the damage helpers to ignore damage clips Date: Wed, 15 Nov 2023 14:15:40 +0100 Message-ID: <20231115131549.2191589-2-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115131549.2191589-1-javierm@redhat.com> References: <20231115131549.2191589-1-javierm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" It allows drivers to set a struct drm_plane_state .ignore_damage_clips in their plane's .atomic_check callback, as an indication to damage helpers such as drm_atomic_helper_damage_iter_init() that the damage clips should be ignored. To be used by drivers that do per-buffer (e.g: virtio-gpu) uploads (rather than per-plane uploads), since these type of drivers need to handle buffer damages instead of frame damages. That way, these drivers could force a full plane update if the framebuffer attached to a plane's state has changed since the last update (page-flip). Fixes: 01f05940a9a7 ("drm/virtio: Enable fb damage clips property for the p= rimary plane") Cc: # v6.4+ Reported-by: nerdopolis Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D218115 Suggested-by: Thomas Zimmermann Signed-off-by: Javier Martinez Canillas Reviewed-by: 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). drivers/gpu/drm/drm_damage_helper.c | 3 ++- include/drm/drm_plane.h | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_damage_helper.c b/drivers/gpu/drm/drm_dama= ge_helper.c index d8b2955e88fd..afb02aae707b 100644 --- a/drivers/gpu/drm/drm_damage_helper.c +++ b/drivers/gpu/drm/drm_damage_helper.c @@ -241,7 +241,8 @@ drm_atomic_helper_damage_iter_init(struct drm_atomic_he= lper_damage_iter *iter, iter->plane_src.x2 =3D (src.x2 >> 16) + !!(src.x2 & 0xFFFF); iter->plane_src.y2 =3D (src.y2 >> 16) + !!(src.y2 & 0xFFFF); =20 - if (!iter->clips || !drm_rect_equals(&state->src, &old_state->src)) { + if (!iter->clips || state->ignore_damage_clips || + !drm_rect_equals(&state->src, &old_state->src)) { iter->clips =3D NULL; iter->num_clips =3D 0; iter->full_update =3D true; diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 79d62856defb..cc2e8fc35fd2 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -190,6 +190,14 @@ struct drm_plane_state { */ struct drm_property_blob *fb_damage_clips; =20 + /** + * @ignore_damage_clips: + * + * Set by drivers to indicate the drm_atomic_helper_damage_iter_init() + * helper that the @fb_damage_clips blob property should be ignored. + */ + bool ignore_damage_clips; + /** * @src: * --=20 2.41.0 From nobody Tue Dec 30 13:06:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87F53C47074 for ; Wed, 15 Nov 2023 13:16:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343915AbjKONQL (ORCPT ); Wed, 15 Nov 2023 08:16:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343852AbjKONQE (ORCPT ); Wed, 15 Nov 2023 08:16:04 -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 42B6A121 for ; Wed, 15 Nov 2023 05:16:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700054160; 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: in-reply-to:in-reply-to:references:references; bh=B8baLtlzsuyZcOKODOHaJ6HAGilgrqHGy9qmPbinQNI=; b=O86MNo8XLmmMSWx7rTO83xbBvLRLPbDHCnqHqvFN/SUx75ZRwMFmX06T4YdBPnRzTI4S+L LqbdyVwtt+Rx0sW6Ohl5GsRKOBAFJbxdGpo5AbbSZI2n0c/eEep5PVUHuhuuFhDT85JJ+W uIlNo8+FAwGtqjYQt9zgbCKakpC/7Ro= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-404-fkBQZ8oZPQq7uZijr4kYDw-1; Wed, 15 Nov 2023 08:15:59 -0500 X-MC-Unique: fkBQZ8oZPQq7uZijr4kYDw-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3314bd215ceso1455734f8f.2 for ; Wed, 15 Nov 2023 05:15:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700054157; x=1700658957; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B8baLtlzsuyZcOKODOHaJ6HAGilgrqHGy9qmPbinQNI=; b=mC9YcX02cLfCw0xyZbwrxEJVu1hNY68fxzHREbZ5xyrzz6ZyNuJtubhpDCipcjwLAs uqqBQJzl0lFXyxSzVXvHdDgRFB62cL8y9zgZS3d31+KnuxT8nM/4Y0iOopsANC/c6wXO tbn82YAmSW61UkE0vv+GY7IT2yg8wXqNG1x5sWA9hjQJ6vhouo8ANRszLytyfWSbK+mv jDJ/NmCHDdn67y2sUFtJK+M4PwdtRR9FOqSJSNMgqr+AfoA6Jo1vsHtTFqM7eoKae7Ka MqjugzCOhQqiYWSrRntg39lva0Bl7KRfCWyMw3Yu66d5svF9wZfo+AWLm5l5MfWk+kpa AuDQ== X-Gm-Message-State: AOJu0YwFBF6bfzJfKNOGSb2hSxA8F/Iy8xJ46J0nOUfnpKcTybdW2N1o ST2WtGDyHEETZtPr8gvOtttz4NmPVzTaQv+u9Bly+NEM1n8i1y48Oo9+1DiPP9VcCei5JNMeUoT Zf3XipzdlVlPZ+hZZt0NRbXq1axM8wvXmiBDyd7kCs6MkT3rqrZdi2herB48hyf34kt23K/Vuir TfQhLntes= X-Received: by 2002:a5d:6d89:0:b0:32f:7b14:89d9 with SMTP id l9-20020a5d6d89000000b0032f7b1489d9mr10958302wrs.9.1700054157156; Wed, 15 Nov 2023 05:15:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDaKwJNBk2fEmPyHouSjZgkvyhlK79vrfYZN/upvL8mRJpAtkAcw0QUDFTOK7GVHFogRFeXg== X-Received: by 2002:a5d:6d89:0:b0:32f:7b14:89d9 with SMTP id l9-20020a5d6d89000000b0032f7b1489d9mr10958258wrs.9.1700054156678; Wed, 15 Nov 2023 05:15:56 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id h15-20020a5d548f000000b0032fbe5b1e45sm10507123wrv.61.2023.11.15.05.15.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 05:15:55 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Maxime Ripard , Bilal Elmoussaoui , Simon Ser , Erico Nunes , Pekka Paalanen , Thomas Zimmermann , Sima Vetter , Javier Martinez Canillas , stable@vger.kernel.org, nerdopolis , Chia-I Wu , Daniel Vetter , David Airlie , Gerd Hoffmann , Gurchetan Singh , Maarten Lankhorst , dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev Subject: [PATCH v2 2/5] drm/virtio: Disable damage clipping if FB changed since last page-flip Date: Wed, 15 Nov 2023 14:15:41 +0100 Message-ID: <20231115131549.2191589-3-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115131549.2191589-1-javierm@redhat.com> References: <20231115131549.2191589-1-javierm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver does per-buffer uploads and needs to force a full plane update if the plane's attached framebuffer has change since the last page-flip. Fixes: 01f05940a9a7 ("drm/virtio: Enable fb damage clips property for the p= rimary plane") Cc: # v6.4+ Reported-by: nerdopolis Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D218115 Suggested-by: Sima Vetter Signed-off-by: Javier Martinez Canillas Reviewed-by: Thomas Zimmermann --- Changes in v2: - Set struct drm_plane_state .ignore_damage_clips in virtio-gpu plane's .atomic_check instead of using a different helpers (Thomas Zimmermann). drivers/gpu/drm/virtio/virtgpu_plane.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virti= o/virtgpu_plane.c index a2e045f3a000..a1ef657eba07 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -79,6 +79,8 @@ static int virtio_gpu_plane_atomic_check(struct drm_plane= *plane, { struct drm_plane_state *new_plane_state =3D drm_atomic_get_new_plane_stat= e(state, plane); + struct drm_plane_state *old_plane_state =3D drm_atomic_get_old_plane_stat= e(state, + plane); bool is_cursor =3D plane->type =3D=3D DRM_PLANE_TYPE_CURSOR; struct drm_crtc_state *crtc_state; int ret; @@ -86,6 +88,14 @@ static int virtio_gpu_plane_atomic_check(struct drm_plan= e *plane, if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc)) return 0; =20 + /* + * Ignore damage clips if the framebuffer attached to the plane's state + * has changed since the last plane update (page-flip). In this case, a + * full plane update should happen because uploads are done per-buffer. + */ + if (old_plane_state->fb !=3D new_plane_state->fb) + new_plane_state->ignore_damage_clips =3D true; + crtc_state =3D drm_atomic_get_crtc_state(state, new_plane_state->crtc); if (IS_ERR(crtc_state)) --=20 2.41.0 From nobody Tue Dec 30 13:06:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F6AFC07548 for ; Wed, 15 Nov 2023 13:16:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343948AbjKONQS (ORCPT ); Wed, 15 Nov 2023 08:16:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343905AbjKONQG (ORCPT ); Wed, 15 Nov 2023 08:16:06 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C1FE11D for ; Wed, 15 Nov 2023 05:16:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700054162; 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: in-reply-to:in-reply-to:references:references; bh=g4aNlMTSkF6Z7WtRPqPRRN4O3d3mqRlG6UdzSZTHX4Q=; b=Zc6r4a5ELkoj29e+7WzDYM4gddcQRuATlVqetDnRFZZgI/Bth/MnbTt1/m1yBM7WvwWkvK FC2244qfuo5bNnNyURSFTE6QC5Q5RA8Lh29GoSDn49ce0nflDFQDBo0JEvivsfms9YVp1a lNYXkpCSaQo4uiylzn8+hwElSjUgmvA= 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-659-rcU_iRgZNAqTnCDQ5ps-Iw-1; Wed, 15 Nov 2023 08:16:01 -0500 X-MC-Unique: rcU_iRgZNAqTnCDQ5ps-Iw-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4084d08235fso43103385e9.3 for ; Wed, 15 Nov 2023 05:16:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700054159; x=1700658959; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g4aNlMTSkF6Z7WtRPqPRRN4O3d3mqRlG6UdzSZTHX4Q=; b=EivhpINEIiqbKLoN4ELOESxhMt5oL62Pb5mzFJZVegJZSHyJWVFw7tUXCZvmbS5QzJ Lq5xfrKKUPT4wu2P9Wm4qnSsIgchaVvkdlb9eooz3D8nDLxeoEj7WqOe+nZHmfWeoIdl r5lYtRjCh8JngDc7IT9SQQI6ZUdK7bLJlPRvvwvRuoYHbgUMeqw9N9zOha6rIBbQvuhb NPkJB0UzeEB5HxERZe3iUmnmXE7A7DxjFUhlzwJzCDkvjUYqOzCaaV4zK49KwIDIy8vn XSq9a9yEgQ1GAL8VJoCA8kqfNA8gCOxrlxjCw/Ljv3dflQlq2ETB9SlTJln3a8vAKi+P U/OA== X-Gm-Message-State: AOJu0YyyiCTOBVa5fd1RGDYI7/px/n5OE3xDrvtHBL/3PvG5iy7JHXFL bdy0KyztV4u51oGa29HFi8kAz3wY5oCxCS40gaMLL7GGvc/akc3A0QS2SdRKoqtsX9WNBDjZAI1 Tv5zcZ0wcSkgdUJz/wX1vbFuDsBjUImldOZYkpr3ERfxCRf32PRSbb1LE+2J/r3l8LxbfSdrndl hYw6gZGLs= X-Received: by 2002:a5d:49c4:0:b0:32d:bc6e:7f0d with SMTP id t4-20020a5d49c4000000b0032dbc6e7f0dmr8014903wrs.18.1700054159384; Wed, 15 Nov 2023 05:15:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqQImNi2W5AgGnJqpoMjjFu3Gcn9f11D4+yPZSZnB8N53BgtMbv3StA4wZdzqIdJ6tBIc4eg== X-Received: by 2002:a5d:49c4:0:b0:32d:bc6e:7f0d with SMTP id t4-20020a5d49c4000000b0032dbc6e7f0dmr8014875wrs.18.1700054159031; Wed, 15 Nov 2023 05:15:59 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id n2-20020a5d4202000000b0032d886039easm10435546wrq.14.2023.11.15.05.15.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 05:15:57 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Maxime Ripard , Bilal Elmoussaoui , Simon Ser , Erico Nunes , Pekka Paalanen , Thomas Zimmermann , Sima Vetter , Javier Martinez Canillas , Daniel Vetter , David Airlie , Maarten Lankhorst , VMware Graphics Reviewers , Zack Rusin , dri-devel@lists.freedesktop.org Subject: [PATCH v2 3/5] drm/vmwgfx: Disable damage clipping if FB changed since last page-flip Date: Wed, 15 Nov 2023 14:15:42 +0100 Message-ID: <20231115131549.2191589-4-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115131549.2191589-1-javierm@redhat.com> References: <20231115131549.2191589-1-javierm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver does per-buffer uploads and needs to force a full plane update if the plane's attached framebuffer has change since the last page-flip. Suggested-by: Sima Vetter Signed-off-by: Javier Martinez Canillas Reviewed-by: Thomas Zimmermann --- Changes in v2: - Set struct drm_plane_state .ignore_damage_clips in vmwgfx plane's .atomic_check instead of using a different helpers (Thomas Zimmermann). drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/v= mwgfx_kms.c index 818b7f109f53..f9364bf222e3 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -837,10 +837,21 @@ int vmw_du_primary_plane_atomic_check(struct drm_plan= e *plane, { struct drm_plane_state *new_state =3D drm_atomic_get_new_plane_state(stat= e, plane); + struct drm_plane_state *old_state =3D drm_atomic_get_old_plane_state(stat= e, + plane); struct drm_crtc_state *crtc_state =3D NULL; struct drm_framebuffer *new_fb =3D new_state->fb; + struct drm_framebuffer *old_fb =3D old_state->fb; int ret; =20 + /* + * Ignore damage clips if the framebuffer attached to the plane's state + * has changed since the last plane update (page-flip). In this case, a + * full plane update should happen because uploads are done per-buffer. + */ + if (old_fb !=3D new_fb) + new_state->ignore_damage_clips =3D true; + if (new_state->crtc) crtc_state =3D drm_atomic_get_new_crtc_state(state, new_state->crtc); --=20 2.41.0 From nobody Tue Dec 30 13:06:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0B72C47072 for ; Wed, 15 Nov 2023 13:16:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343939AbjKONQU (ORCPT ); Wed, 15 Nov 2023 08:16:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343919AbjKONQP (ORCPT ); Wed, 15 Nov 2023 08:16:15 -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 8DDF6130 for ; Wed, 15 Nov 2023 05:16:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700054164; 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: in-reply-to:in-reply-to:references:references; bh=gJqsY2/QsCenwJh5W290HFz55lPASu6G1HsKVTRTOh0=; b=QsOIIPXjEcipN66sXOeLYx+r5AMXp54yxPFDeJjQj/AFNt6OWbZ1R1rwbUVDDI1CJww7+x bVCn9HvbUfpNv+9abZl0WreQaPo9zrJYeWd16hG/CXrTX7izGcCQgczhQok882q5z8bpFO pnEVh97aE7G23Da0xj/ZWxBeOFcvOQg= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-178-Mtn23c1cOL-IJQryoFb6jg-1; Wed, 15 Nov 2023 08:16:03 -0500 X-MC-Unique: Mtn23c1cOL-IJQryoFb6jg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-40839252e81so43567185e9.3 for ; Wed, 15 Nov 2023 05:16:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700054161; x=1700658961; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gJqsY2/QsCenwJh5W290HFz55lPASu6G1HsKVTRTOh0=; b=nR/JxvDLFteIicTQ9wZho4KNh46Z2VorlHX0hiZ/k5rALHla/c4D6njTC97k7E9aOO 2/ZlZnr1u5xreLWs52DUBDiuG1azYXRyjCALIzG3Efr+7v2z7GqnkzOnxl8lOTnp0/jO sH3gv/9siH20oCAiYkgdeg9I4uQAJdBCdVOsFYy5hUjHivLHIuHAeZAKP9EwoCxSkiEb GosTadLn6VftM2opF0w0hCioteRAkSECjlxFPpjNT1W0CHqZ4+QxAEWIkJ1t+oGu4vFr bWW4xhOGM9VW5akd/kH/6W4lMWt+pA36vw0ebpNc6t/MFhRquCEAzuiuKU2qMCRGUt0I LhKQ== X-Gm-Message-State: AOJu0Yz3M249KmvAYVjOYa+wSl3IB7zADAgLhOAD0sny6KQbkY+F8dJ+ iOzpHJMsZDh7i7KWSDHyUi/qJv7NSuujh1dFCoUS4qbGLUyJXgdoNQddwo+cgV6AJGVp5ki9SQ1 /tZn9tv5Tj3D+xzBNsA+lc6QeSwzcfpndJqIaC94ItzOdd094jTZiWqPDaNicUZfGUkO2uf7mH8 YRB+BcuyQ= X-Received: by 2002:a05:600c:4fd2:b0:408:434c:dae7 with SMTP id o18-20020a05600c4fd200b00408434cdae7mr11319529wmq.2.1700054161330; Wed, 15 Nov 2023 05:16:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeDdWdtJ7aB4xucaGXBN4YZIdjMA0MwwhEfRrMy5dCuiFqOT3NDoUGtQljuQes2A4j3nnCww== X-Received: by 2002:a05:600c:4fd2:b0:408:434c:dae7 with SMTP id o18-20020a05600c4fd200b00408434cdae7mr11319502wmq.2.1700054161047; Wed, 15 Nov 2023 05:16:01 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id z10-20020a05600c0a0a00b00405959bbf4fsm15025163wmp.19.2023.11.15.05.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 05:16:00 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Maxime Ripard , Bilal Elmoussaoui , Simon Ser , Erico Nunes , Pekka Paalanen , Thomas Zimmermann , Sima Vetter , Javier Martinez Canillas , Daniel Vetter , David Airlie , Maarten Lankhorst , dri-devel@lists.freedesktop.org Subject: [PATCH v2 4/5] drm/plane: Extend damage tracking kernel-doc Date: Wed, 15 Nov 2023 14:15:43 +0100 Message-ID: <20231115131549.2191589-5-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115131549.2191589-1-javierm@redhat.com> References: <20231115131549.2191589-1-javierm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The "Damage Tracking Properties" section in the documentation doesn't have info about the two type of damage handling: frame damage vs buffer damage. Add it to the section and mention that helpers only support frame damage, and how drivers handling buffer damage can indicate that the damage clips should be ignored. Also add references to further documentation about the two damage types. Suggested-by: Simon Ser Signed-off-by: Javier Martinez Canillas Reviewed-by: Simon Ser Reviewed-by: Thomas Zimmermann --- - Dropped Simon Ser's Reviwed-by tag because the text changed to adapt to the approach Thomas Zimmermann suggested for v2. (no changes since v1) drivers/gpu/drm/drm_plane.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 24e7998d1731..3b1b8bca3065 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -1442,6 +1442,26 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, * Drivers implementing damage can use drm_atomic_helper_damage_iter_init(= ) and * drm_atomic_helper_damage_iter_next() helper iterator function to get da= mage * rectangles clipped to &drm_plane_state.src. + * + * Note that there are two types of damage handling: frame damage and buff= er + * damage. The type of damage handling implemented depends on a driver's u= pload + * target. Drivers implementing a per-plane or per-CRTC upload target need= to + * handle frame damage while drivers implementing a per-buffer upload targ= et + * need to handle buffer damage. + * + * The existing damage helpers only support the frame damage type, there i= s no + * buffer age support or similar damage accumulation algorithm implemented= yet. + * + * Only drivers handling frame damage can use the mentiored damage helpers= to + * iterate over the damaged regions. Drivers that handle buffer damage, ne= ed to + * set &struct drm_plane_state.ignore_damage_clips as an indication to + * drm_atomic_helper_damage_iter_init() that the damage clips should be ig= nored. + * In that case, the returned damage rectangle is the &drm_plane_state.src= since + * a full plane update should happen. + * + * For more information about the two type of damage, see: + * https://registry.khronos.org/EGL/extensions/KHR/EGL_KHR_swap_buffer= s_with_damage.txt + * https://emersion.fr/blog/2019/intro-to-damage-tracking/ */ =20 /** --=20 2.41.0 From nobody Tue Dec 30 13:06:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA00FC07548 for ; Wed, 15 Nov 2023 13:16:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343969AbjKONQX (ORCPT ); Wed, 15 Nov 2023 08:16:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343926AbjKONQP (ORCPT ); Wed, 15 Nov 2023 08:16:15 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C091F189 for ; Wed, 15 Nov 2023 05:16:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700054167; 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: in-reply-to:in-reply-to:references:references; bh=LPNZAc6r0CSSO6lMN8bwDAougMdgFH11dwZvW1JyD1g=; b=UdAR/0iFW/NySxhyhm8uHp+xGalEE8pKj+ty8VpJGl3j3CLO52a+XpLb4gPW+oaiN8x96l iuLdPUBGKs7iDhceWMnzdvCZ10ohrPqO9nUx56MXuqG55ybcktEAbeSzwORozfp5sfb+FE vtXlzbOgsxbfFNrnmnny3VgcIHvMUvE= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-625-5B9X58hIORykrwvdxA0t0Q-1; Wed, 15 Nov 2023 08:16:05 -0500 X-MC-Unique: 5B9X58hIORykrwvdxA0t0Q-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-32f8cb825c5so3204285f8f.2 for ; Wed, 15 Nov 2023 05:16:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700054163; x=1700658963; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LPNZAc6r0CSSO6lMN8bwDAougMdgFH11dwZvW1JyD1g=; b=WXbd/LYEzAegze9YJ8I8jGvnnvKTlS6HcJriqBP1djeQYS+5ccVjunua8FHqMSaZ3c 1IpkPlyJ4qvkNS2FYwif2e2Iisq1WB4/Ol3n4/OMdWBwhDequoCWOQwg/UvOUKbiN7QH eeMqtsQntii2lfV4vfBU5Bo3ReJWcFWdQNXL45AHN2HXZtrPMhfU/KP4iY7rWfKoO4GR g/ZGfeUnxpye7gBm13g33nxvdRRQ7wnB6+bdNsZYht0IClTmAfWLXXkRtYv7uJnggHpm +D7adeq1CLGcVlbHt8wp8EB1tee5n6y1vGpRbWA/OtQ8m9tlatV7UZFvzISs6CrrccaS olKw== X-Gm-Message-State: AOJu0YwQJdM6XxI3QusAwuVyy3PJq7txx2wiGQsv73sALDXPISdq8be+ 7pJNUBZFnmvFXQ3zZ1RrwEwgtk9tZQAdOGGszsLFUCPJXtuARdfmi+a9xTSJzj0jvHHlCQ2hcgX CZv6Uqrzw1yAJkKSAxx7fx8JloSYkc70Wo8MdiCpuCfmPa9z24aNrAKRe1cq2/h5DYpg0VJVAwE MEUOBzitA= X-Received: by 2002:a5d:6b8f:0:b0:331:4e5e:d9e7 with SMTP id n15-20020a5d6b8f000000b003314e5ed9e7mr5201145wrx.34.1700054163387; Wed, 15 Nov 2023 05:16:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IH90wwQXO1DSYdUi0fT0muUxSLgnxdRuPpEfFKAh1lwXIDvxopHNTDogbaEw6FCwpQCc2B74A== X-Received: by 2002:a5d:6b8f:0:b0:331:4e5e:d9e7 with SMTP id n15-20020a5d6b8f000000b003314e5ed9e7mr5201118wrx.34.1700054163127; Wed, 15 Nov 2023 05:16:03 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id b1-20020a5d6341000000b00323293bd023sm10579306wrw.6.2023.11.15.05.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 05:16:02 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Maxime Ripard , Bilal Elmoussaoui , Simon Ser , Erico Nunes , Pekka Paalanen , Thomas Zimmermann , Sima Vetter , Javier Martinez Canillas , Daniel Vetter , David Airlie , Jonathan Corbet , Maarten Lankhorst , dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org Subject: [PATCH v2 5/5] drm/todo: Add entry about implementing buffer age for damage tracking Date: Wed, 15 Nov 2023 14:15:44 +0100 Message-ID: <20231115131549.2191589-6-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115131549.2191589-1-javierm@redhat.com> References: <20231115131549.2191589-1-javierm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Currently, only damage tracking for frame damage is supported. If a driver needs to do buffer damage (e.g: the framebuffer attached to plane's state has changed since the last page-flip), the damage helpers just fallback to a full plane update. Add en entry in the TODO about implementing buffer age or any other damage accumulation algorithm for buffer damage handling. Suggested-by: Simon Ser Signed-off-by: Javier Martinez Canillas Reviewed-by: Simon Ser Reviewed-by: Thomas Zimmermann --- (no changes since v1) Documentation/gpu/todo.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index b62c7fa0c2bc..5c43a958814b 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -782,6 +782,26 @@ Contact: Hans de Goede =20 Level: Advanced =20 +Buffer age or other damage accumulation algorithm for buffer damage handli= ng +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D + +Drivers that do per-buffer uploads, need a buffer damage handling (rather = than +frame damage like drivers that do per-plane or per-CRTC uploads), but ther= e is +no support to get the buffer age or any other damage accumulation algorith= m. + +For this reason, the damage helpers just fallback to a full plane update i= f the +framebuffer attached to a plane has changed since the last page-flip. + +This should be improved to get damage tracking properly working on drivers= that +do per-buffer uploads. + +More information about damage tracking and references to learning material= s in +`Damage Tracking Properties `_ + +Contact: Javier Martinez Canillas + +Level: Advanced + Outside DRM =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 --=20 2.41.0