From patchwork Sun Nov 19 10:56:57 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: 13460380 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 ED0CEC5AD4C for ; Sun, 19 Nov 2023 10:57:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E2C4E10E1C2; Sun, 19 Nov 2023 10:57:23 +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 DCD1110E1C2 for ; Sun, 19 Nov 2023 10:57:21 +0000 (UTC) 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-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vwKTxIgr09omGUBF1m9vDxqCyG9hQEMime1yIZzuygQ=; b=THsNqgPy9xry+OvLdK6mqD7TFKZtbc/4nfKgD+hQKnuI+GxbZu2o9iAN38TEeIsg/MlJCs 7lBT8Eww3RjP05rkyd4WyBG3KL/GVrgc1ERPIllSY9XbcONaHK3ZWhb+CnET9TzeUSCf8A fHXp3YgdRCVM2B3UVRSbN5m0iUE+Ys4= 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-360-pTgiEiNHMFSv0qJKsqGf8Q-1; Sun, 19 Nov 2023 05:57:17 -0500 X-MC-Unique: pTgiEiNHMFSv0qJKsqGf8Q-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-40855a91314so5200195e9.1 for ; Sun, 19 Nov 2023 02:57:17 -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=RYj/PKJsK1jqBaD4vxcWUNWiocfTeNj4zoU7cwqXLx/uFAuDirq4vqTgT+Us+G4J4S lPJKaiWa3qDAwbz+2ZOzqH2akzwsWWiMWM7Y0FBMoO6SKTf6DqR9zfiDvTUlhW9/ca4I SMOM6senFhTjcbvNTZ4X80IfqMbxwFmiaKyRb/ymN1/vp5BnGsv8oHCwHHlzTtLvbX2R zReoSj/i0c01+9u0xS4fejU28ep+g9qcX/o4fxSInHQgihepT8O7Ben7j69djGdxEYAj ivyzJAXOZrWbfsdGKNuJosUpYsj/e3k0DoG9L/1j+oqdUf72u+Tx7jxGbUrPWi4rQByb 6XUQ== X-Gm-Message-State: AOJu0YzmHRKlVth6/7jKMP3TzsZNxJlAahxWyYCFvgbFrhrEXiXqzt5t X2Q5GfJWCLXDBI+s9Hs5gXb94oYGyQ8Ki3Ak7C3NdHW36xVZdg3Y4RskbcaBCghAk8sLvhMRAhi zNRQxvX/lPHvr5YseAoLBqdtKzV3W X-Received: by 2002:a05:600c:a48:b0:401:b425:2414 with SMTP id c8-20020a05600c0a4800b00401b4252414mr8849686wmq.18.1700391436491; 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 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 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 , Sima Vetter , Bilal Elmoussaoui , Javier Martinez Canillas , Maxime Ripard , stable@vger.kernel.org, Thomas Zimmermann , 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 Reviewed-by: Thomas Zimmermann --- (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_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 Sun Nov 19 10:56:58 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: 13460381 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 0FE9DC5ACB3 for ; Sun, 19 Nov 2023 10:57:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9194F10E1C4; Sun, 19 Nov 2023 10:57:24 +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 5964F10E1C8 for ; Sun, 19 Nov 2023 10:57:22 +0000 (UTC) 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-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wduLhA1JfH2JIibNOg1UP/hJXljazR5AfhyG/qLMjyE=; b=hvmVN1OHls9SEnZel4MbaZYpaZvNid0kWl3Z3MXLW61Y7136947HsOBMpVyuZ9yzGZvfqZ 9nGsy9ZLPdnYfltqaCy/5PUUX1HnfkLAkuGWLwa24/Z8SxcgoIqfe3ztSGZHP5eLp1tmuU 0GRVrHcxIFHR7jq1FwhwO89eVFgPgmY= 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-610-L5WEznYrPl2n2snDFnWwyw-1; Sun, 19 Nov 2023 05:57:19 -0500 X-MC-Unique: L5WEznYrPl2n2snDFnWwyw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-40839252e81so6402745e9.3 for ; Sun, 19 Nov 2023 02:57:19 -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=BKG2m7dSKAMiUxFW8IwL+Nn0Fh9LGGfw8eT8R/lscN9EXXurWzDM3N4wlUfJ4unxlQ jEQZV5wqYEoJBtBnqhgjAVjouRolBc48iaatyQmPZxA4Jvd7VO9njxKNJ8E5eGLrlYg1 vpEx+TC+mj8e3dkdKfS6pe5wtMJ/BQWBt2y0sSwLJVLFrZu2KI3umc+C/lufGnfIZWvP UWCbdglDmbzV9oyJ+kycek+M/u6FONv52OSkOVbzIh7Dm2snnhS6h66yaMq9Glwuycay FvHOVUFNewkYjWv8Uvx7HCESx3RvWwgFq0orVhDYelS0HjhA9SfJbjK+lqb7HpY6s65h N6EA== X-Gm-Message-State: AOJu0YxmgLoB5A8SqqEK1iXMpNz6Ofu72YovRxlV9eZevdO7oqk8/2qD 5wZh1F1tY9lOCPKJOLKlkSvz0qg25o4BJUNMsx+qIYCSJ2Ock5dTPCobd0ZPH6XGGkC1a4Krl8Z Iw73jUqRNWOeKMERqByVDW/uhkCxM X-Received: by 2002:a05:600c:5254:b0:408:40e2:773b with SMTP id fc20-20020a05600c525400b0040840e2773bmr3874940wmb.34.1700391438610; 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 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 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 , Sima Vetter , Bilal Elmoussaoui , Javier Martinez Canillas , Maxime Ripard , Gurchetan Singh , stable@vger.kernel.org, Thomas Zimmermann , 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 Reviewed-by: Thomas Zimmermann --- (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/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 Sun Nov 19 10:56:59 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: 13460382 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 4F8F4C5ACB3 for ; Sun, 19 Nov 2023 10:57:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E898710E1C8; Sun, 19 Nov 2023 10:57:29 +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 A59E710E1C2 for ; Sun, 19 Nov 2023 10:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700391442; 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=6wH8NdnscsW10bLIOLUB7ubQDTo0O64XVfw9Xt/3TIE=; b=BtuU92XhAS7fIWBqNzqlLjS16ICio85B94wt87qhlElJbA7EsLSFBqG5frQsRw67QqW7yj /RWPWXBQlZlFPCLYSRltoT0cdnOFTxHh9grT8ory2K1J8rLrAX55vqEtEqkuPvPe42LYqn Cb2ZQiGF4FZ0LRT8Hk5hxyQpuoaTMIU= 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-678-QdYfL20pObWE54hefdXrkQ-1; Sun, 19 Nov 2023 05:57:21 -0500 X-MC-Unique: QdYfL20pObWE54hefdXrkQ-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-32f8371247fso1860570f8f.2 for ; Sun, 19 Nov 2023 02:57:21 -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=n/E1IimD8GpaZ6SyX6cW8uIl585DUt03SIj930MHSZsnr+rGzQyMrllel8DlKs4SIG xFY+zLRFQ81Nc7t7tyRfqBbHJouG+roV9tbbveTta+XyLrXYZ+Pr/+KVgzapJFpkUcVg hC8Gu+IjkCZKdZ096Nr3SJRlOWRGfxS2DrK8IF1LJLQH+W1T1JsbQNLr0rXsTmoaEr2B gS3edBawk5XAU80G/XMNJQ0dQlJW8fgeveoXWkenvs4dd9nCAXIBA8kjoQFMN3vjwZi3 z0bLtJLPfzHXiLy0C0ir6wHeZIB+sh4Vi6Q3RNtssuGiHtIiLidp/FkStrE8KCKE7euf MR6g== X-Gm-Message-State: AOJu0Yw3vyJdK06wXYA9JbruQfDixQPdHG/wprthnRQBjGbq/ktoJb0S 4S9y/CrSyTYd1RPwH4F1q3fH/FmEivjfb8qqABpvDSDmrCO5cpOLtoefMCCSzfsrYRFchCMiWkI ysfZOAPx7fJkVzF90GoLPy96v/quO X-Received: by 2002:adf:f78e:0:b0:32d:a430:beb with SMTP id q14-20020adff78e000000b0032da4300bebmr2829968wrp.39.1700391440201; 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 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 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 , Sima Vetter , Bilal Elmoussaoui , Javier Martinez Canillas , Maxime Ripard , VMware Graphics Reviewers , dri-devel@lists.freedesktop.org, Thomas Zimmermann , 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 Reviewed-by: Thomas Zimmermann --- (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/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 Sun Nov 19 10:57:00 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: 13460384 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 0EFF8C5AD4C for ; Sun, 19 Nov 2023 10:57:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 72F8A10E1C5; Sun, 19 Nov 2023 10:57:38 +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 D2EA910E1C5 for ; Sun, 19 Nov 2023 10:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700391447; 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=272K2eB9MyeGkXnHsQZRLNPPDUgj78GVefhevePLWuQ=; b=iERufLQQ8tSyrFpjvJtZu8Oqe7/snmQM3MC84kJXC+36wo8Bp4fo8a0Tf1WaqblVG1l9mi HthLKosicOAQkt7L8jZ7x4brI0lxM7UM2HHjyQE8NydFaGqnKnDK6pnmJ5Cnh6zkcDXI/T lIN4TWeM3vc2NwHVZb+ps9zFHXFQUG0= 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-643-A2sUUkJKPyOnY-mUqb-KKQ-1; Sun, 19 Nov 2023 05:57:23 -0500 X-MC-Unique: A2sUUkJKPyOnY-mUqb-KKQ-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-408f9e9e9b0so7877665e9.2 for ; Sun, 19 Nov 2023 02:57:23 -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=dzgQ3ra0Eg5ndPyhTif6FFTsOQACRpOZNp4Y9UjDbLcEjN1KUXY4c+xDVqFlF5excW CrAt4KhgslDbZS3XZ1Vjqq2LyXt8qWwzd/mPQG8crYk8XVKJSRSaQWxDcuFq3Rbq1RvR ibyFnadOQnGopYpyfiZpfW4PBG+WFo1d6/8CnP1O+HfKq5KsmTM9um0ew1sqlg9YTKNv BU0zc+6nz1UQxfcJOr22bfEhcaUfbxlTVsop8QqanwuJiREmnGFt4mmhDetxDJ6w9WF5 AIb5WkTzQtoCi1m2E0bnpmE0idee9rvdRvniV8Dx37/6/5KVTOvyk8iZZlx8IeEHt0mF qZGA== X-Gm-Message-State: AOJu0YzLahUli0atFHYmtFSx5i76OklKAKObTrRfZixuQ87XsocY10Kf mt8DbC/FJ+ZHwvka7iCS0ShdF33UooiHec8hw3kf/roA2MeoMN5a4EM0ZfiPdae3f4ZUVnWbYQX YWlUOUf3379iDMs/FTnIaGbUetA4b X-Received: by 2002:a05:600c:3c8f:b0:40a:3e13:22aa with SMTP id bg15-20020a05600c3c8f00b0040a3e1322aamr3943997wmb.7.1700391442424; 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 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 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 , Sima Vetter , Bilal Elmoussaoui , Javier Martinez Canillas , Maxime Ripard , dri-devel@lists.freedesktop.org, Thomas Zimmermann , 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 Reviewed-by: Thomas Zimmermann --- 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 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 mentioned 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. + * + * That is because drivers with a per-plane upload target, expect the backing + * storage buffer to not change for a given plane. If the upload buffer changes + * 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 the 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_buffers_with_damage.txt + * https://emersion.fr/blog/2019/intro-to-damage-tracking/ */ /** From patchwork Sun Nov 19 10:57:01 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: 13460383 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 B9856C5ACB3 for ; Sun, 19 Nov 2023 10:57:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E148910E1CA; Sun, 19 Nov 2023 10:57:30 +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 2338C10E1C8 for ; Sun, 19 Nov 2023 10:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700391447; 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=paKcR4aagnq4OR4cFFNyGyCczT8YfM2615gwz6U/Ifs=; b=eqqagPN1rqWAkzWwuneyLotHOQKZqRjtxFx6swn9AcqY2YGELwlqqr/WZRtyJL6BFrMql0 3CbwZk8VWMnIN/K6gaQNIBpSx9hM/FMe493gjzG8jw+C3Kxm8gWUkDpFzZc8++aTsDgGhy rwgEO581W9T4TdQhOSrACC2uTnL5DIE= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-68-7YWHVxt3OeCypjWhHNGhjA-1; Sun, 19 Nov 2023 05:57:26 -0500 X-MC-Unique: 7YWHVxt3OeCypjWhHNGhjA-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40853e14f16so6119275e9.1 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=Durb6TGCAi1O2UBIzhkNKk98/mtz62D0bqFRjLan8VpAJjGdi3VYmL718hcQ0TVp84 QjQoJnTjLAXh3iCrfW3xZGVcwHSvxwVtZQRG4RzBZ4tFe/DBsoPCZJRcSuVEFJPq+2yZ 8QsOVQBFxulPMKwO6KxVe46K7d7YFt1j+57v3Cr+qgFFZ7mMnI5uG7cfk+8pfShvAPve Xp9R0FCmU7z+Dy1CzvHMRaPWW/UDqesNfaJO0CyNkwHaSkIrLTNH/8KjDtQ5bA7EFFV9 0Y3uGb7odj5H12PQUxmplBw+ZmVjzwW9VFPQNgvGKfT28kLgjSLNsMS0VMujU3oq1bH0 d6bQ== X-Gm-Message-State: AOJu0YzRc+4S6n13wbQ8jNAfcewZuJhimwfneN5TE6TyY/KWbma6XVsP XNvNjUR1p1OJoTQuAeTv6EoGSI6+1cbFPHjoS1sayxfOiZ0sSOgO3Rhi60i8nVUdHVHsrOnTT15 JVkGBS91S9qK+iuiu6iC5uhv7LuWnNv74KZuS X-Received: by 2002:adf:e58b:0:b0:32d:b051:9a27 with SMTP id l11-20020adfe58b000000b0032db0519a27mr2879796wrm.20.1700391444493; 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 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 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 , Sima Vetter , Bilal Elmoussaoui , linux-doc@vger.kernel.org, Javier Martinez Canillas , Maxime Ripard , dri-devel@lists.freedesktop.org, Thomas Zimmermann , 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 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 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 ===========