From patchwork Wed Nov 15 13:15:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 13456672 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0288CC4332F for ; Wed, 15 Nov 2023 13:21:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 43B8710E553; Wed, 15 Nov 2023 13:21:05 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5A8F810E553 for ; Wed, 15 Nov 2023 13:21:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700054462; 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=WdkCfOkpqSODFD3esOEEEI4uePJ2ewc8SQpEyHY/6Ls=; b=D25EPnv3b1m4XevYBBdCnUQG8rhkLCyWYrW0kfrzlwY0W57ZXhhU4X0VBTWvYwNq7teqns 1J9Sd5By+FHY//51lT5e0tHIlDQGGc+2woBDmqjhCQTPZgLM+TpH2QWQ1CeT25ZcqEpixh 8iGnKfyShOnTIQpT11cosBgRjANBxXg= 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-230-TPCH7OKtPxqAo7gVQu2r7w-1; Wed, 15 Nov 2023 08:21:01 -0500 X-MC-Unique: TPCH7OKtPxqAo7gVQu2r7w-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4083a670d25so43526425e9.0 for ; Wed, 15 Nov 2023 05:21:01 -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=GI85sIfH3mkbVKsBW3eUdAxYMHTKxga3S8HBT06Tsl+wWqYmUOx/EiyawiDu4tBsg0 zlxJqIB1vdoN283iTBN17ylDN7PX907Xc2m6/uFsV+FbAPg0N0w6UQdeCHDHrTV46j7A CZGvenSEZWYjYS+F+yH2/F8FZSo4yBWxkSUV031Sr+EC766SQZKJg6mGfF2p8DbS114t 7hbGUtN77i8hf4h7b48YHG5B7u9srH69b2zULAp2QHjHkUb91oBMuEec6FiL5o0TUbXo r7AMkgrUMTvzqCxJNxOzB2gInivADnMlfIxMjXJPAgnO05hakrEXh9/+WyPmqw9okedB xcFw== X-Gm-Message-State: AOJu0YzrDDYqTT1/yQ2fOtdwVUulT8yTvQHlm1CT1HBMKnt0OFRRMzBU jM3p8WPs1HJIA1CtH8SFEY3qpV3MxmvctszZ2peE3zmrohAfRhlBD8X+/Zdemnye9hrhBUYdly3 lldz+fIxekFIh0FLQ6teuXAbjCTKB X-Received: by 2002:a05:600c:1d12:b0:40a:4429:a994 with SMTP id l18-20020a05600c1d1200b0040a4429a994mr9334052wms.28.1700054155057; 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 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, Gerd Hoffmann , nerdopolis , Pekka Paalanen , Bilal Elmoussaoui , Javier Martinez Canillas , Maxime Ripard , stable@vger.kernel.org, Thomas Zimmermann , Sima Vetter , Erico Nunes Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 primary plane") Cc: # v6.4+ Reported-by: nerdopolis Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218115 Suggested-by: Thomas Zimmermann Signed-off-by: Javier Martinez Canillas --- 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_damage_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_helper_damage_iter *iter, iter->plane_src.x2 = (src.x2 >> 16) + !!(src.x2 & 0xFFFF); iter->plane_src.y2 = (src.y2 >> 16) + !!(src.y2 & 0xFFFF); - 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 = NULL; iter->num_clips = 0; iter->full_update = 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; + /** + * @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: * From patchwork Wed Nov 15 13:15:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 13456668 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA92CC47075 for ; Wed, 15 Nov 2023 13:16:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F34D10E0C2; Wed, 15 Nov 2023 13:16:03 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5082710E0C2 for ; Wed, 15 Nov 2023 13:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700054161; 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=B8baLtlzsuyZcOKODOHaJ6HAGilgrqHGy9qmPbinQNI=; b=e+AJkbLQ3quwUJLXKEOnNMNhj3JvkQeZBVkV2RPTv5H7BVRGXibrO9369CGMGq5p8QqjCz i54XTawzEtbRPbe5rnrUedgQnSA3xwHK62JPoMQb0atFFWBM4etaKiIuPCT/AKJYoaTiRA Y0LoRS8wO+EvwA7BmbSXxsqgsggmurA= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-330-w6VQ6QnqOG2Tc9RfAjXEDA-1; Wed, 15 Nov 2023 08:15:58 -0500 X-MC-Unique: w6VQ6QnqOG2Tc9RfAjXEDA-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-32fa25668acso3165361f8f.1 for ; Wed, 15 Nov 2023 05:15:57 -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=f2pucbRdZxnzaDMJa7VNAizYJrGfSVtRSwzSqSDxDXaTICQv9uAvMawR9o3fxbugI7 wbNd6leSZ7DN24mXx/561zaQEcs9mYHaZHdR/0Bd8ZAqfXu2NL4X4Sx/MY7SblYlxCvI AP8Olvh2/Ek6jNiFlFfsF2TDPpyN8MhUtaoxqzbM7ZGOJPF12yxlUmEER9fRIfoe8PE1 vg5yT4WkQSgiXOI5E/dtovq/HJhW/mmz0cHf/EyAAjlaSXTjPOl/D1sCdEEVW01hM2C+ npdMvv4YSTUZz0sxyOWIwdyyhc2ThotwTTucgHnNJG22slTDI6SGUOooDNIQJENh2wLG qayg== X-Gm-Message-State: AOJu0Yx0FXYx3U86nP5pRHN9KKiKVOlpZSpQLtlqavPvb2mhYDZk1Zmb J+mAj/bmvjb/QFcSU68d31niegSD3G27SpRiEWA5z5R76D22KmY+1HxCugN+mp5O3mrQNYKfPrs DiIkFLp2zq0CY7oCSPGC7kxOw58i6 X-Received: by 2002:a5d:6d89:0:b0:32f:7b14:89d9 with SMTP id l9-20020a5d6d89000000b0032f7b1489d9mr10958284wrs.9.1700054157041; 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 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, Gerd Hoffmann , nerdopolis , Pekka Paalanen , Bilal Elmoussaoui , Javier Martinez Canillas , Maxime Ripard , Gurchetan Singh , stable@vger.kernel.org, Thomas Zimmermann , Sima Vetter , David Airlie , virtualization@lists.linux.dev, Erico Nunes Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 primary plane") Cc: # v6.4+ Reported-by: nerdopolis Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218115 Suggested-by: Sima Vetter Signed-off-by: Javier Martinez Canillas --- 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/virtio/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 = drm_atomic_get_new_plane_state(state, plane); + struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state, + plane); bool is_cursor = plane->type == 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_plane *plane, if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc)) return 0; + /* + * 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 != new_plane_state->fb) + new_plane_state->ignore_damage_clips = true; + crtc_state = drm_atomic_get_crtc_state(state, new_plane_state->crtc); if (IS_ERR(crtc_state)) From patchwork Wed Nov 15 13:15:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 13456670 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2DFBC47072 for ; Wed, 15 Nov 2023 13:16:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A419B10E551; Wed, 15 Nov 2023 13:16:09 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id A7CC310E0C2 for ; Wed, 15 Nov 2023 13:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700054161; 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=g4aNlMTSkF6Z7WtRPqPRRN4O3d3mqRlG6UdzSZTHX4Q=; b=BbtUD7Y/cwQRSczCj7nuFnXT0svHi0mxijt4AUpV0DiFRtxTelOIXCRJjsUb0dv3tZQdFZ tHDlLH+UJUbGAJY91G0upzlyOI1408Jj4VXjIFS5Q+HcD+dsG1qSmjToh8fm66a+tm0j6N sOxXb5h44imJX+wTyEsf2vEMj5YTxIg= 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-483-U7v8kAiMOH2vkiiGORmtiw-1; Wed, 15 Nov 2023 08:16:00 -0500 X-MC-Unique: U7v8kAiMOH2vkiiGORmtiw-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-408f9cee5e8so43275585e9.0 for ; Wed, 15 Nov 2023 05:16:00 -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=ig+S+gMfJG0Y+Idujf77x5Ezr+rjabJ1wt8qF9Kptk0RryIIiqkaCEYrb7FnX1uK+7 KBMmjhO9yEkQ7j9dy5jYoE8dFReMGkvy3VUnMsBs+YIgHfplLUEzY57f3hnMd6TE+BVe b4FxpsledYiqLub1nF4CyvnztoQ6dFb8qmGlxc7n21bOa7osMALYmntGy50WbXIi5it5 EJsw5YgGZeLY1qkOYLNxMS8sqIdAKyBu21jxHxjEtNYOITCnXpvMHZCVPC97kfkDy5I7 Zm3yZLkhCZD6jx+VqW25VfqJdpfS6Byne2K0XZL74pGqAMiyvQwcTOgR2CzWizDoaG0A I7dw== X-Gm-Message-State: AOJu0YxPWCDfeCEek1vUW1bEO7LJmt0bXAOhv6Z+9Z5ya6Ny1h18BUzH IhH3nSsmEvVqAkXtm1pguu3cDVJjb+gaff0a+D3oVfULKkJty49gn3mPBeLF6c42nJo0vWu8Fa5 13AcokOH5WiMPfKON9KcHxPxGZmdJ X-Received: by 2002:a5d:49c4:0:b0:32d:bc6e:7f0d with SMTP id t4-20020a5d49c4000000b0032dbc6e7f0dmr8014885wrs.18.1700054159238; 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 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pekka Paalanen , Bilal Elmoussaoui , Javier Martinez Canillas , Maxime Ripard , VMware Graphics Reviewers , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Sima Vetter , Erico Nunes Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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/vmwgfx_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_plane *plane, { struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, plane); + struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state, + plane); struct drm_crtc_state *crtc_state = NULL; struct drm_framebuffer *new_fb = new_state->fb; + struct drm_framebuffer *old_fb = old_state->fb; int ret; + /* + * 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 != new_fb) + new_state->ignore_damage_clips = true; + if (new_state->crtc) crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc); From patchwork Wed Nov 15 13:15:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 13456669 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39631C07548 for ; Wed, 15 Nov 2023 13:16:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 64AE810E0E6; Wed, 15 Nov 2023 13:16:07 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id E76BA10E0E6 for ; Wed, 15 Nov 2023 13:16:04 +0000 (UTC) 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-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gJqsY2/QsCenwJh5W290HFz55lPASu6G1HsKVTRTOh0=; b=iNqUGwk6ovhPI9j3S81idxU3y9mYxur8EyhSiJw7er3PlElH11MJD9a5st3oKN3D/6mlwW uKuOmFyXMTYACTFQ5HmeRKTAsHXBnjJTgInCxMp8Z9lmU6SwSqxe2/5LpWMQAGlku0RnBY nqXiv4Pq2WXp0IN2zo5dykJhKrqi83M= 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-551-E8yKVtlBNpKgnNyIQi6Ajw-1; Wed, 15 Nov 2023 08:16:02 -0500 X-MC-Unique: E8yKVtlBNpKgnNyIQi6Ajw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4083fec2c30so43727955e9.1 for ; Wed, 15 Nov 2023 05:16:02 -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=apPA6nqlBn1J9SdkRLqywdBvyo241Qoqp7gArCBTP67K60e3uSPEr4QlKcmacFDJ1n 2DACF/Sgz0HDRGUQXovzQutj+ZhzsBZoVPykjvLXAOK3r06Gr904tXdBCS62nS1Torgk mbJEpBE6qPdXXCQl1StHYrffyrSTGXm6UP5OUdWS72DcXlK+JlfRMLxD5WtqK9NyxXEL A0aDBQcnYqPvaomLRH5dDaqou7LKY/jsAdYk5KhFI1EFTcMss95FTMHxtIPr5wfqXS2i 2wiwd0Zv6pWR4KoBPzIxBrYiqKvzoF/lRxZa6SSmjdySMRIX115jZJz/cfI+TTXAmEiu CnpA== X-Gm-Message-State: AOJu0Yzup6yKqzvxYRUZ/UVVCspzVuLCE+9YbyIMytgSvzHps1cUCFz9 h+GiCG1Klx8kIyyQm/RVpNXC9iW3cgjLoofmjwnGv20h8mZc+Mo5rHOWAcchf9DA1JMv6nhoEd8 VlNJ/shEdiHtjUpRjK+XyjXodqEez X-Received: by 2002:a05:600c:4fd2:b0:408:434c:dae7 with SMTP id o18-20020a05600c4fd200b00408434cdae7mr11319523wmq.2.1700054161291; 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 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pekka Paalanen , Bilal Elmoussaoui , Javier Martinez Canillas , Maxime Ripard , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Sima Vetter , Erico Nunes Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- - 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 damage * rectangles clipped to &drm_plane_state.src. + * + * Note that there are two types of damage handling: frame damage and buffer + * damage. The type of damage handling implemented depends on a driver's upload + * target. Drivers implementing a per-plane or per-CRTC upload target need to + * handle frame damage while drivers implementing a per-buffer upload target + * need to handle buffer damage. + * + * The existing damage helpers only support the frame damage type, there is 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, need 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 ignored. + * 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_buffers_with_damage.txt + * https://emersion.fr/blog/2019/intro-to-damage-tracking/ */ /** From patchwork Wed Nov 15 13:15:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 13456671 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB24AC07548 for ; Wed, 15 Nov 2023 13:16:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 225F210E554; Wed, 15 Nov 2023 13:16:14 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id B5E5610E0E6 for ; Wed, 15 Nov 2023 13:16:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700054165; 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=LPNZAc6r0CSSO6lMN8bwDAougMdgFH11dwZvW1JyD1g=; b=Qt7njRPfKbr36Z9bQFi6mkCg54Oje1peMIZov8cojk9CJHA7o8oVr/5ra6pZ2fG7FNCj+y Y5Ww49CMxaJgeijnmv/pZeqtGcxtHU5PLp8jf+H3FQIVoPu0QNiUzBSBP2n3WC78KrFr9p Gdyrrh65y0X+ZE9q92JviWEJ6eCOJgI= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-169-56MJ3-m8Mvu-BdNT18EDmA-1; Wed, 15 Nov 2023 08:16:04 -0500 X-MC-Unique: 56MJ3-m8Mvu-BdNT18EDmA-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-32d9751ca2cso3205391f8f.3 for ; Wed, 15 Nov 2023 05:16:04 -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=Bz4GsjF3oGkyxMquRJvpTAaXyPTu3h15bfW+PzORBULdQihLv+PMwb27bVXe/3gGJA +bm/Bw9+lpI90ssQDyEALuQpc5YiFFwaaoHnTmeDBBTROpVoshniNPEnKPkpIQsvIieZ RXZ7URIiQJzVXIkbeJkU8cYQ3TkUcSCahOE4XXQy5urvKWN8OP9+BeQ3//ihNCHETeB0 nKgsgLDVsOJb+5hOLuvguZ7GtZRgXX3d8ujh3k+T5BtEMdixpd7r6NpitdKKITXPhSsn 0bltHhHukj+MEKZy87okkRwNJvuXzEaLHB5RDzP47gd4jMjOUvCsSybmkiD4FIOEUFWf OiSQ== X-Gm-Message-State: AOJu0Ywkxpvmdv911lBlj5aHeUkstXsE8MQhrlSwS8g0RZ0bk5ahWlHS LhUXzcWu2+cpMOiSIJ/8Bm0TYib6RECInEvYVO3achDw2h77QF2SX9BAQLkxl2FzB6s6CtFEr2H PhzfFgdW0ExwcTLrSc/tfVGRCVWNL X-Received: by 2002:a5d:6b8f:0:b0:331:4e5e:d9e7 with SMTP id n15-20020a5d6b8f000000b003314e5ed9e7mr5201126wrx.34.1700054163333; 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 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pekka Paalanen , Jonathan Corbet , Bilal Elmoussaoui , linux-doc@vger.kernel.org, Javier Martinez Canillas , Maxime Ripard , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Sima Vetter , Erico Nunes Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- (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 Level: Advanced +Buffer age or other damage accumulation algorithm for buffer damage handling +============================================================================ + +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 there is +no support to get the buffer age or any other damage accumulation algorithm. + +For this reason, the damage helpers just fallback to a full plane update if 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 materials in +`Damage Tracking Properties `_ + +Contact: Javier Martinez Canillas + +Level: Advanced + Outside DRM ===========