From nobody Tue Dec 30 07:15:38 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 2BDFAC072A2 for ; Sun, 19 Nov 2023 10:57:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230407AbjKSK53 (ORCPT ); Sun, 19 Nov 2023 05:57:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbjKSK5Y (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 3DB0C12D for ; Sun, 19 Nov 2023 02:57:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700391440; 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=vwKTxIgr09omGUBF1m9vDxqCyG9hQEMime1yIZzuygQ=; b=P7NcHxhQNDMz+CI2Pw8/UlvaUPb3Kj/rDX33ebkCHGBolJjVSiNvjJH6WnJhKbXdZeMyu1 dAK/esyr4ZEMmoB6Fhz+/4sarUGeufApyLTUWk3voFywSK5vL+sveLsyiYXvYaGBRoIW3A XmVrRL4HMFXkjS5GZJbBrB5VYsxA2gQ= 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-654-2Psi8spXN4iwDzE3kskNYg-1; Sun, 19 Nov 2023 05:57:18 -0500 X-MC-Unique: 2Psi8spXN4iwDzE3kskNYg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-40a4c765d3bso5259665e9.0 for ; Sun, 19 Nov 2023 02:57:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700391436; x=1700996236; 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=vwKTxIgr09omGUBF1m9vDxqCyG9hQEMime1yIZzuygQ=; b=W/WextvEb1l+OmTxhsJXj7IeSPZmYtDB5PQOUHKgAbk4QEWRLgRsWxPr7KQHOuT7Vp gcu+AEA3GYUe1ug12XCOaqiA6TUTyxAO9vpU/Y1A1mLUOcl5pB4rFvvO5TA236W/ywke LU9OwAqgouSP3PFH+TtpzI+LaNMft1Dq++WyO6V8gImMBM2XsiEb3197Y8m1PLzXNNbz rBCMEy11GxaQdEbZMCZX4g3yL8B/06JX/U3xvT+x40n74M0l6Z1/r7EDkgh8rFgeU6FJ iSc9O4sHUvnQ3NabwoUAmAINTCezxPTkx0cDiwAtH8l+qkBte0HETe8quVuWfDafj80P aRZA== X-Gm-Message-State: AOJu0Yx3SndItXBO13v4W8IyAOvIfQvRZh8bpC8igdOilxGUQXhCSotL BJ4zLNNFjUDg76XtlafZRHptM8RnbY2eqgoBBMGapnVglxiDEkc/KyKdRvQIEMX5+fr3sWGgY/1 OT7bqNFwJ76du1EcdZLPj6HLVIICZBPYeOnhaUMuBYfRiQTwX2NgJZ0BixNCI7opk9vOVaOhtY8 AEi2Jj79M= X-Received: by 2002:a05:600c:a48:b0:401:b425:2414 with SMTP id c8-20020a05600c0a4800b00401b4252414mr8849702wmq.18.1700391436529; Sun, 19 Nov 2023 02:57:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTr3xemuWiX3MZFy4qGqbNac/hdlijHFi83h7o6vBK3ccLPETc7+WJcogKeoinWFEMLApjFA== X-Received: by 2002:a05:600c:a48:b0:401:b425:2414 with SMTP id c8-20020a05600c0a4800b00401b4252414mr8849674wmq.18.1700391436164; Sun, 19 Nov 2023 02:57:16 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id o2-20020a05600c510200b0040a4835d2b2sm14233407wms.37.2023.11.19.02.57.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 02:57:14 -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 , stable@vger.kernel.org, nerdopolis , Daniel Vetter , David Airlie , Gerd Hoffmann , Maarten Lankhorst , dri-devel@lists.freedesktop.org Subject: [PATCH v3 1/5] drm: Allow drivers to indicate the damage helpers to ignore damage clips Date: Sun, 19 Nov 2023 11:56:57 +0100 Message-ID: <20231119105709.3143489-2-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231119105709.3143489-1-javierm@redhat.com> References: <20231119105709.3143489-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 Reviewed-by: Zack Rusin --- (no changes since v2) 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 07:15:38 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 47360C5AE5B for ; Sun, 19 Nov 2023 10:57:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230468AbjKSK5c (ORCPT ); Sun, 19 Nov 2023 05:57:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbjKSK50 (ORCPT ); Sun, 19 Nov 2023 05:57:26 -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 C7D36C6 for ; Sun, 19 Nov 2023 02:57:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700391441; 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=wduLhA1JfH2JIibNOg1UP/hJXljazR5AfhyG/qLMjyE=; b=R/m4g8Q6Ky1f49aAV1MFbRQGJKisurwHi9YDCzQJk0MI8OjF/72L5KFOZ0p75LBKcvWra2 mge3A/V6wWF4VFnhnMVOZTmRrthOPVMsqsL9HfwtoXgIQOKbf3maoNOIUFj98Rl3P1jicf hGj3dLVuJxc6xrOWQNUU/qDbKQGIK4w= 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-395-9ymYD9FXM76kk8t-nb1n0Q-1; Sun, 19 Nov 2023 05:57:20 -0500 X-MC-Unique: 9ymYD9FXM76kk8t-nb1n0Q-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4090fa518bbso6427565e9.2 for ; Sun, 19 Nov 2023 02:57:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700391438; x=1700996238; 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=wduLhA1JfH2JIibNOg1UP/hJXljazR5AfhyG/qLMjyE=; b=J0dH6WZYHTZvUHTcS7k/But2D3eLfFo+f5oJ3kfbl0F+RX7FK1m7op4KUwsyAmOzZO wAjH3U/IYYm7T0kR8g7tRL/hs2Q72Xybst1Lcq07aAfwBS/3f5BI4F4unGi9aDyUrM91 7UXb6z6UAQDHE7gOwIt0bbtrKgtHSsbDHEFLaQSmzTM8VRiDsXjnaOxX/mcL8UAJBdgM uDxABZRhUHyBZvwQ8hKZwqPEB1XDixJV821sQe9Kv8/oFpV3QjZn77JfnfU1Zk5b89q7 +75TwmW3W6dKv+8/zv0FeFLzoete5hC9iLvMR6pWcT7ttCbQSg/Zs9TpN96kwPSDyad5 R2jw== X-Gm-Message-State: AOJu0YxgkOboWNhX+Ypoeh89TaHNsMAZ/ZCCQ3yZF7rRXWDGtfSUk7Ih EZomU06/MeU9gfTpxL3nMBnQfMz/o7pArkoziPnR3YvzsY8TRcT4Ge0y/c1AcqM8ZPwtkXcErOT Mo+LuAuJYofvOBfIW8bb8C+19wTZXCYFIM0UsYanPYSs2uIflqCX3mPsqFlPqSQY3YT4a4Qnq7W XClHTHgyA= X-Received: by 2002:a05:600c:5254:b0:408:40e2:773b with SMTP id fc20-20020a05600c525400b0040840e2773bmr3874945wmb.34.1700391438651; Sun, 19 Nov 2023 02:57:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGlYVHBUM49anhifPkjs7hxrNsnEGArla3y2Mra38iXhi+oYySY1k50/IKpNWu+heDGdF252Q== X-Received: by 2002:a05:600c:5254:b0:408:40e2:773b with SMTP id fc20-20020a05600c525400b0040840e2773bmr3874914wmb.34.1700391438309; Sun, 19 Nov 2023 02:57:18 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id t13-20020a05600c450d00b004094e565e71sm9510932wmo.23.2023.11.19.02.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 02:57:17 -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 , 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 v3 2/5] drm/virtio: Disable damage clipping if FB changed since last page-flip Date: Sun, 19 Nov 2023 11:56:58 +0100 Message-ID: <20231119105709.3143489-3-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231119105709.3143489-1-javierm@redhat.com> References: <20231119105709.3143489-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 Reviewed-by: Zack Rusin --- (no changes since v2) 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 07:15:38 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 59695C5AD4C for ; Sun, 19 Nov 2023 10:57:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230489AbjKSK5g (ORCPT ); Sun, 19 Nov 2023 05:57:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230368AbjKSK52 (ORCPT ); Sun, 19 Nov 2023 05:57:28 -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 B503AE5 for ; Sun, 19 Nov 2023 02:57:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700391444; 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=6wH8NdnscsW10bLIOLUB7ubQDTo0O64XVfw9Xt/3TIE=; b=fSI6ecqS5+V6/MWjONDg0SzTNTXwG4qdKpMbkHPo1ak9jBaLQClX0uzPUlvWPVlIHli48t An10Y5VHDbaGKD06vrrRRzv6YSYnPfkoyzY/pKdketpM9miAXxHtkFIlqfNUxP6CVhpFIa QNr+0SVGqdP3Fb7wORhQof8BA7q//NE= 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-215-C0IzsknpNIWXX_uTENr_4w-1; Sun, 19 Nov 2023 05:57:22 -0500 X-MC-Unique: C0IzsknpNIWXX_uTENr_4w-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-32d9cd6eb0bso1862972f8f.0 for ; Sun, 19 Nov 2023 02:57:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700391440; x=1700996240; 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=6wH8NdnscsW10bLIOLUB7ubQDTo0O64XVfw9Xt/3TIE=; b=IZ+g6sccgjcVI8nDO2ATvlX/5QjBJoeXApn/5DBQYd6sKTbaydM4HZZjkS0YHryaEk 9yxLt3UsmejTORNYBwsSOCamup8vAqcmNHIadhcJRQmoEhHf0VwEWN8HCl+YDXDvx0E6 IYXmGp6g8MdkzQFhYxt/D8XUgcoXF/lr+qL4n+hHwbiKQMv3D5QcOZGUsed3ABhQNSnD BwIPTqX44VqdlPW/w4mk1dBTfp9dYArDetoW6XdRHEPjyNC6w8sRWWiasysaqIFqrtnt alYyNMRAOVnq1MWn3wKhaNB0W3Cr48cCvONs9oCegTofDWm4JOGnxdAkHc3jH19Ce+o5 D45A== X-Gm-Message-State: AOJu0YwUhbleifPJmHeG07xJmBaiTP78Y/HsiN7BVAT5wKP4/BxyoVQi YNHa+uNEZBmOWQPunNOjl3bmCcyyGwDlyxhJWF9XnZjQMYw/hGK4SexfPxVaGKkzsbD/28KdLUW 69RZCofxCFGJcPcv/8BcA0ugCgZNrzo8QaksWDF3Iu65SEf2oCYHB68T6Bdf1wHniKxrTCpQfCv yxc7BRUos= X-Received: by 2002:adf:f78e:0:b0:32d:a430:beb with SMTP id q14-20020adff78e000000b0032da4300bebmr2829977wrp.39.1700391440297; Sun, 19 Nov 2023 02:57:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IESPRpTD7i8bW20zZ0kQ4KfQTQl0DUNLoPKZy8ul6xpiKdduzWRa53ZcDf8J/6wMLLH73rZlQ== X-Received: by 2002:adf:f78e:0:b0:32d:a430:beb with SMTP id q14-20020adff78e000000b0032da4300bebmr2829957wrp.39.1700391440007; Sun, 19 Nov 2023 02:57:20 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id i3-20020a5d5583000000b0031f82743e25sm7726978wrv.67.2023.11.19.02.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 02:57:19 -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 , Daniel Vetter , David Airlie , Maarten Lankhorst , VMware Graphics Reviewers , Zack Rusin , dri-devel@lists.freedesktop.org Subject: [PATCH v3 3/5] drm/vmwgfx: Disable damage clipping if FB changed since last page-flip Date: Sun, 19 Nov 2023 11:56:59 +0100 Message-ID: <20231119105709.3143489-4-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231119105709.3143489-1-javierm@redhat.com> References: <20231119105709.3143489-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 Reviewed-by: Zack Rusin --- (no changes since v2) 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 07:15:38 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 743D7C072A2 for ; Sun, 19 Nov 2023 10:57:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230501AbjKSK5j (ORCPT ); Sun, 19 Nov 2023 05:57:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230432AbjKSK5a (ORCPT ); Sun, 19 Nov 2023 05:57:30 -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 11B69E6 for ; Sun, 19 Nov 2023 02:57:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700391446; 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=272K2eB9MyeGkXnHsQZRLNPPDUgj78GVefhevePLWuQ=; b=W0viOslMd9bVTgnlZYPSEBJRjRV4VPXvVxQZwK8ma33EELvQs3vnkO3qT5oQNVS6wLGSuD yP6hdJQms4/qQ/ZIJe7z48/1HUX8UCfbJdIwZ7VlHj+RT2J35SQEvPGG8YSSGEeTSY8/wk iAjTVlcEMkGjZIT9kusWyaDxQ1v8OfI= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-101-6UjYQEbmOC-NalJrZc6m7Q-1; Sun, 19 Nov 2023 05:57:24 -0500 X-MC-Unique: 6UjYQEbmOC-NalJrZc6m7Q-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4095fcbba0aso7883165e9.1 for ; Sun, 19 Nov 2023 02:57:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700391442; x=1700996242; 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=272K2eB9MyeGkXnHsQZRLNPPDUgj78GVefhevePLWuQ=; b=oSx9R/CKTQJfgnHqbFuuPEmdVoAn0bfoI2Ac4gZpInLBguGc9Gy2ydsMH8cvxmgZVC iyDcsTQXqNHOe92jmxD1954MyRH6PHBM4XQU1oxpkiw8M+Nn7iimfDifWD0yPIQxRhDG aakST4Pe+gvPXnr614NSPBiYQ/RAzlONOJA/1sbbj70I1ngMZG55awT/5HKUjcZHt8di HDJ02isbJNZDHVqkvL2QU0nc9bo4P/WX0lBQRY30I0DS9VYdQYVpHhaiRMutOMArmTKF T3G9Kydbj4gZ1l2ZHlrcP3Q1IlE4GKKUtXHMzvcWH01oZmb+Tb9JKVVBCMUWfnGg6iUp M0Ag== X-Gm-Message-State: AOJu0YxmqtXYyyEwHse2k+b7fm+ahqfmVUhkly59r9C6p25YIdW/MwKq 0mH0RrsGoO8eOYdQa/Jw4lvBew6wDhEWIiHn+nTRhGiz3qBAjKoFA11lhx7WdmHFR3RXr7mXSse I8GtmPqTGwuJM844Z+6ehhvClP7mYEuNbNpgjIPlqKzUL77kGnmL47N8o3aYAHLD+jx0+TkMIj0 0WSOhun6w= X-Received: by 2002:a05:600c:3c8f:b0:40a:3e13:22aa with SMTP id bg15-20020a05600c3c8f00b0040a3e1322aamr3944008wmb.7.1700391442504; Sun, 19 Nov 2023 02:57:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYUt/8Jcf7ERcy5KXqfH+OtRpcgE15vf7fYhtZFTeCEEm0OJBSqdb3sD/eG2BQK1nsRynYmQ== X-Received: by 2002:a05:600c:3c8f:b0:40a:3e13:22aa with SMTP id bg15-20020a05600c3c8f00b0040a3e1322aamr3943987wmb.7.1700391442133; Sun, 19 Nov 2023 02:57:22 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id p6-20020a05600c358600b0040a45fffd27sm14009431wmq.10.2023.11.19.02.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 02:57:20 -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 , Daniel Vetter , David Airlie , Maarten Lankhorst , dri-devel@lists.freedesktop.org Subject: [PATCH v3 4/5] drm/plane: Extend damage tracking kernel-doc Date: Sun, 19 Nov 2023 11:57:00 +0100 Message-ID: <20231119105709.3143489-5-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231119105709.3143489-1-javierm@redhat.com> References: <20231119105709.3143489-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 Reviewed-by: Zack Rusin --- 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). drivers/gpu/drm/drm_plane.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 24e7998d1731..87edd6c3c5a4 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -1442,6 +1442,32 @@ 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 tar= get + * 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 mentioned 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. + * + * That is because drivers with a per-plane upload target, expect the back= ing + * storage buffer to not change for a given plane. If the upload buffer ch= anges + * between page flips, the new upload buffer has to be updated as a whole= . This + * can be improved in the future if support for frame damage is added to t= he DRM + * damage helpers, similarly to how user-space already handle this case as= it is + * explained in the following documents: + * + * 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 07:15:38 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 672DEC5ACB3 for ; Sun, 19 Nov 2023 10:57:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230478AbjKSK5n (ORCPT ); Sun, 19 Nov 2023 05:57:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbjKSK5c (ORCPT ); Sun, 19 Nov 2023 05:57:32 -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 1610D11D for ; Sun, 19 Nov 2023 02:57:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700391448; 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=paKcR4aagnq4OR4cFFNyGyCczT8YfM2615gwz6U/Ifs=; b=TtQbMRN+jI0GVPqUIBw+chII97xHmIfAeOCqMCvjL43aFp6sKGjm/26wDwMdSgDjU7Pfv3 r6Z63G+RlIp8gJfimIUizZp0qX4y7JmBpjpxKMzGvBUBbUAUKMYGIXNr11roHHu6DAYO7W RyvYtDqsPCrJmcWrSBd3Jb4E3R8KNAI= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-611-kJXZqyjQNBiMontU1rG26Q-1; Sun, 19 Nov 2023 05:57:26 -0500 X-MC-Unique: kJXZqyjQNBiMontU1rG26Q-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-32db6a28e24so1696934f8f.0 for ; Sun, 19 Nov 2023 02:57:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700391444; x=1700996244; 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=paKcR4aagnq4OR4cFFNyGyCczT8YfM2615gwz6U/Ifs=; b=JXFsJDqxIRa/mrc4ij2sHikWWczq5+BbmBcocdReexkz3hgjoxFDzfyDDYJcHD7BF+ ircILGnf1A4TpqUObaMAOpEcLso7B0DbVFXMg6n5kkn+INlA60KRYr3+lCkV1LvHN9Lq cBOGMGwh9DAN6Uk9EenogGKT1pT+s5aWd9OIz372ebuuDvBfFFD1Mqjk2LirM5nEHuGh xsxm36YA7S7pjMbDkM2qHbKuXfUZ+Kyjh1CpXUZtwngSpI/g/hCIcaCty5wYsuy9PJNz X7jsPsDgKS1rz/aG60st+vQCrXai5buHYmMjTmAw23I1gCmehkXSJNXEYu0b2oyhs/ma cQeA== X-Gm-Message-State: AOJu0YzrtNNv3OIvd274/Wf3G4LmH0WCTgh0QPPGErZDG4d1lwQEw/U3 pTKLkAh6w736V/6OaSerXbv7CyS2hFzlS846iMEahPZkadB38jHyai4XfHUJRcsm7W4h9SCDUib WXKmgkZ/SHa/VcapHhZhzQwTswyrF+2SmsOlQ7my9FTmkZUgQcAXtYHvi0bnt4BGeOsDEIo9bu6 AkAu335OA= X-Received: by 2002:adf:e58b:0:b0:32d:b051:9a27 with SMTP id l11-20020adfe58b000000b0032db0519a27mr2879808wrm.20.1700391444542; Sun, 19 Nov 2023 02:57:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IFi7SRJ7y81uoAdnNo/STFG3TuDFoHARhcCF0tpowHTWIp4MigNAbZkJfZ0hoizOoIOzIYjFQ== X-Received: by 2002:adf:e58b:0:b0:32d:b051:9a27 with SMTP id l11-20020adfe58b000000b0032db0519a27mr2879785wrm.20.1700391444248; Sun, 19 Nov 2023 02:57:24 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id dm15-20020a0560000bcf00b0032d81837433sm7796649wrb.30.2023.11.19.02.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 02:57:23 -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 , Daniel Vetter , David Airlie , Jonathan Corbet , Maarten Lankhorst , dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org Subject: [PATCH v3 5/5] drm/todo: Add entry about implementing buffer age for damage tracking Date: Sun, 19 Nov 2023 11:57:01 +0100 Message-ID: <20231119105709.3143489-6-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231119105709.3143489-1-javierm@redhat.com> References: <20231119105709.3143489-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 Reviewed-by: Zack Rusin --- (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