From patchwork Thu Nov 23 22:13: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: 13466780 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 367A3C61DF7 for ; Thu, 23 Nov 2023 22:13:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AECDC10E360; Thu, 23 Nov 2023 22:13:32 +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 29E2210E35C for ; Thu, 23 Nov 2023 22:13:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700777602; 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=NNr7AyogBLBECN5NVEc3sDwHAg2qPYRl5gFzwIza95Q=; b=YAmVHbKorI9mDRXIrlWix/pE1Gc9WU6tWOs/BQBowJnSXKbKova/dZPl6ujhlSoFk7WaLn k3F9Mfm0gbjDqTiYwP2ALLpiO9iZiYv5+/dVHOWsxqMA6Tg33Lkn9jO8hcrgaml8WeEXEC 57iIweGByHodOF5eM2oc5LCMxtXQiKA= 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-628-BUl78-uyPNKTHQzcNKXN8w-1; Thu, 23 Nov 2023 17:13:20 -0500 X-MC-Unique: BUl78-uyPNKTHQzcNKXN8w-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40b349b990fso6275945e9.3 for ; Thu, 23 Nov 2023 14:13:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700777600; x=1701382400; 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=NNr7AyogBLBECN5NVEc3sDwHAg2qPYRl5gFzwIza95Q=; b=a0ogFUfuxVZtHzcGDpSXs3P/sLLrIgY79DpjZDc83GwWlX7aIF/Y+3+TcDnqJkEGr1 AU67ADzQL/BP52cmqqys0GO4ntU4e10K3PFf0gR8a8Beww/RIi34GlGYaSyfjywghdZw e+P0SbwI1UxRW+SRglQ7hyjrndvQLnKJxrUb63JdW0/jq5BoYmsge+8Pv8bA7NueFtlZ rp4TYvrS74DcLqG8EpXc5oQHcIE6XYIEdv9Mu6YZo8OLZ78rJHXDJmsLmT7ixyJGUHo6 m+RSBdPd4Hw/y7+hMgyIMb6Z6vvy37GGw0flKrtCO9pKIoVz1wSo0N5+Bg3G3AoTBr5K lr8Q== X-Gm-Message-State: AOJu0Yx/nMrluLalzL2/VUrWylCZT1CJX3aa3P05K5HeUUqM6XKcVxir IN0oI3Knorea8NfSruXcPG0u8AdsL+12tN6WZycrfeYteXyfnk4XQjsmOQCQtt0plY0qpMiJ5hm qxwOeX5R495K+MiPG6Jc6t76Pgj2X X-Received: by 2002:a05:600c:1c9d:b0:408:434c:dae7 with SMTP id k29-20020a05600c1c9d00b00408434cdae7mr695842wms.2.1700777599762; Thu, 23 Nov 2023 14:13:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGsLgt3C+76rwt6+lTv0sowa6U49h5FFZqfpVdWRCJlUnBufhPrTXVPA1hV/im8nsFEBKfIcQ== X-Received: by 2002:a05:600c:1c9d:b0:408:434c:dae7 with SMTP id k29-20020a05600c1c9d00b00408434cdae7mr695832wms.2.1700777599346; Thu, 23 Nov 2023 14:13:19 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id r7-20020a05600c35c700b0040b30be6244sm3233457wmq.24.2023.11.23.14.13.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 14:13:18 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [PATCH v4 1/5] drm: Allow drivers to indicate the damage helpers to ignore damage clips Date: Thu, 23 Nov 2023 23:13:00 +0100 Message-ID: <20231123221315.3579454-2-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231123221315.3579454-1-javierm@redhat.com> References: <20231123221315.3579454-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 , Jonathan Corbet , Bilal Elmoussaoui , linux-doc@vger.kernel.org, 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 Reviewed-by: Thomas Zimmermann Reviewed-by: Zack Rusin Acked-by: Sima Vetter --- Changes in v4: - Refer in ignore_damage_clips kernel-doc to "Damage Tracking Properties" KMS documentation section (Sima Vetter). 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). Documentation/gpu/drm-kms.rst | 2 ++ drivers/gpu/drm/drm_damage_helper.c | 3 ++- include/drm/drm_plane.h | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst index 270d320407c7..a98a7e04e86f 100644 --- a/Documentation/gpu/drm-kms.rst +++ b/Documentation/gpu/drm-kms.rst @@ -548,6 +548,8 @@ Plane Composition Properties .. kernel-doc:: drivers/gpu/drm/drm_blend.c :doc: overview +.. _damage_tracking_properties: + Damage Tracking Properties -------------------------- 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..fef775200a81 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -190,6 +190,16 @@ 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. + * + * See :ref:`damage_tracking_properties` for more information. + */ + bool ignore_damage_clips; + /** * @src: * From patchwork Thu Nov 23 22:13: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: 13466777 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 322FDC61D85 for ; Thu, 23 Nov 2023 22:13:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 793B110E35E; Thu, 23 Nov 2023 22:13:27 +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 D247C10E35C for ; Thu, 23 Nov 2023 22:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700777604; 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=U3hQPeRRqjnZSS8OWuMWpjh1Oj2NJuDlBMcX3dbEThk=; b=IWrwZAQ3HVB2RnXsLIKnAaoMz1YFK0ckhtsEGGRZYfQRr1gWc58B9g9SIfO/QqfxbN4G6z a9x+5wCCYQd01nvIj9R2QkKxL1ahWyR5N1sS4MThrRRiBo50jxdWMywsLTZF1ru+YWmQTT zrz9yOQNFxVEtC42nLvpIsfk9LKPRLM= 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-626-T399NcBnPCOf-nlayQBdjA-1; Thu, 23 Nov 2023 17:13:22 -0500 X-MC-Unique: T399NcBnPCOf-nlayQBdjA-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40b3519a03aso7573515e9.3 for ; Thu, 23 Nov 2023 14:13:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700777601; x=1701382401; 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=U3hQPeRRqjnZSS8OWuMWpjh1Oj2NJuDlBMcX3dbEThk=; b=mbMebvGwmrsezdPj+hccfFa+C2bYFouVnQ1flI5XCTqJtdRDnoMyk+uM6CO6C7URK6 gq/4YIhjSJkOy0PFdEwGrmzckIPDRIc8UgQ2jCy6LmvSd17lbM4Ep5fd6S4g2uX+amW4 oC0vnYjiC6M69/2cbeK/+dpfvWgHdJknK6slZ54e+Lc1aatCmvQjmnYErlp9tzNtFUCG Zm3GXpCENNy8KEqSywIUqhxxyvh5CqCjylQkymahK39XeKftCAhsE9ksTyPqMGHclEdJ lx4yW1Jo7J/3xctkN+K5kDmDihfiDWC6KHOOGBn2zF2n1Qwrm9PzIQPJM268VM48mN8s v/pQ== X-Gm-Message-State: AOJu0YxY8zZjABFjxST5gKllPBB7Gsr3KPg5vIkcBlSv7slsT/Ge2lJQ OBeUFvpbbfDK4/+ieY3hMV5Bo8SLihb599Lwx9Yl1fJZ9c8TAe9OG+S6Xje1hgtvXQ0HemuXa1H 5KM+ldwtFyQZleHpxS1KT/b9ZtZtl X-Received: by 2002:a05:600c:3507:b0:406:44e6:c00d with SMTP id h7-20020a05600c350700b0040644e6c00dmr662873wmq.2.1700777601608; Thu, 23 Nov 2023 14:13:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IHt+DfJY/Kdak/dZD3b9Ayp5iu9B3rETe6oqsTju4XsMZUCKTzrR+3d7cg40KCVTwvZqoHReg== X-Received: by 2002:a05:600c:3507:b0:406:44e6:c00d with SMTP id h7-20020a05600c350700b0040644e6c00dmr662869wmq.2.1700777601339; Thu, 23 Nov 2023 14:13:21 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id je19-20020a05600c1f9300b004083729fc14sm3839537wmb.20.2023.11.23.14.13.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 14:13:20 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [PATCH v4 2/5] drm/virtio: Disable damage clipping if FB changed since last page-flip Date: Thu, 23 Nov 2023 23:13:01 +0100 Message-ID: <20231123221315.3579454-3-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231123221315.3579454-1-javierm@redhat.com> References: <20231123221315.3579454-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 Reviewed-by: Thomas Zimmermann Reviewed-by: Zack Rusin Acked-by: Sima Vetter --- (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 Thu Nov 23 22:13:02 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: 13466778 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 D23E4C61D85 for ; Thu, 23 Nov 2023 22:13:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1CDB410E35F; Thu, 23 Nov 2023 22:13:32 +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 8F19E10E35F for ; Thu, 23 Nov 2023 22:13:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700777606; 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=eevPmuhRFAgVhLHOGTOOcRfbcoEzUftUVXb0Oh9ok7w=; b=AU64hUrGJHn7S1hu81s6rYo0Gd/4NW3tTnfVo/lPoyC1kuZSHewT/TLo49YPYfVrkhSPkB y2ZW0ZTh+Fspvz52hCE/Z6gx0R09wb1awZX3IpyJW0r4ysH7osmPAkUjuJV4WndWkqjuDn xWrb2ju8by5+VEmfM4poNpiVRauwrnQ= 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-473-hSb5VUsyMpeZ2vhHyDRsvA-1; Thu, 23 Nov 2023 17:13:25 -0500 X-MC-Unique: hSb5VUsyMpeZ2vhHyDRsvA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-40b349b990fso6276125e9.3 for ; Thu, 23 Nov 2023 14:13:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700777604; x=1701382404; 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=eevPmuhRFAgVhLHOGTOOcRfbcoEzUftUVXb0Oh9ok7w=; b=kRZ3X99DoaKpaTaDNbv9Lh9J6BAc8BsmSaaW8+jDgJQku2M9KP47RWT0K/+b0reQ8L Y3XIFAxjMtkFul5TBKyz52rnlxz5EgnI3E5LFbCgnbqr1zF0elL/OuJgDYLj7WmAr3s8 08Aa2TYK52i64nqBd2d+uos5JPZ16JajEdVSIcxi36avTLtQrg5Bn/7eSbAbgmIx7LZF 7uHGxXkOl2uLgXROiv7JhlD318Blx9p7iT4utjcUAb4Q/Ns+7R3zO2RjMoBcRaT8pApc YSiZdyyOtRU5XX3huC7Uq7Dg/4Rq1fVP9J2X/TXK5dKhRN+Cgs85Z+zcoYVGycCBQtWg /fPg== X-Gm-Message-State: AOJu0YxrzZ8Es8gAgXYkfzQ4wGxn0UXU9fU0MBqi5CciinlyS2NzBkJU lyuLs+ZnZFcueFEIoeG+RNQ+UT4ic9nSRRFuP71yXmBkaEk+CVeRBt8B8Cw8Z0bM3Xu6yFUPPwp 8uwFHvHtx9JUG0u2caBN9EmAmLIFV X-Received: by 2002:a05:600c:138e:b0:40b:3605:acda with SMTP id u14-20020a05600c138e00b0040b3605acdamr646906wmf.25.1700777604067; Thu, 23 Nov 2023 14:13:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6aWgfy8x/Q5jWLkQk58MrIjsjFwETk6FGO3Io9BSfMMwRCBkkQZXEsO4x5dsaE1onwWQGvg== X-Received: by 2002:a05:600c:138e:b0:40b:3605:acda with SMTP id u14-20020a05600c138e00b0040b3605acdamr646901wmf.25.1700777603855; Thu, 23 Nov 2023 14:13:23 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id z11-20020a05600c0a0b00b00405c7591b09sm3180629wmp.35.2023.11.23.14.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 14:13:22 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [PATCH v4 3/5] drm/vmwgfx: Disable damage clipping if FB changed since last page-flip Date: Thu, 23 Nov 2023 23:13:02 +0100 Message-ID: <20231123221315.3579454-4-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231123221315.3579454-1-javierm@redhat.com> References: <20231123221315.3579454-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 Reviewed-by: Thomas Zimmermann Reviewed-by: Zack Rusin Acked-by: Sima Vetter --- (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 Thu Nov 23 22:13:03 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: 13466779 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 C0C4CC61DF7 for ; Thu, 23 Nov 2023 22:13:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 71D6810E35C; Thu, 23 Nov 2023 22:13:32 +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 AD27E10E35C for ; Thu, 23 Nov 2023 22:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700777609; 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=dih2whL2MPf6NwDlCWNCaNjlgkoV00h0l9L+4gltDhE=; b=AdN0YetQMTz+ExCc7A1jfCK5xCJJRa7qT64BmzB0+O3Gj1tnZQ2hpBeCiN2/iuCTwxSIgF be9sYRzYnu1sEiB34xLOUh9rXU6N82460SSKkbqiS+Nk8e1pReNdk90a/Z10fxhfJCLl3V dkhDUiOMGSsnOLh4QP4TnC2aHlqFdt4= 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-673-HW8gSO4pOf6x7oSr6vScnA-1; Thu, 23 Nov 2023 17:13:27 -0500 X-MC-Unique: HW8gSO4pOf6x7oSr6vScnA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-40b297925ccso6883235e9.2 for ; Thu, 23 Nov 2023 14:13:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700777606; x=1701382406; 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=dih2whL2MPf6NwDlCWNCaNjlgkoV00h0l9L+4gltDhE=; b=sxBXaU0t5MbfE1lSX9fEp2whyUYTbSAb3fuiMo0wBn+RbapnG/Vfb6ASUtY8bAcJNt wvklYu34+mu8KxEbBT0N1pHCxSiErCSqUfdI9Eh15bgK5cTGYzJ5WCPctqF1PJu+9nG3 P3g7D8wm8Eh5jVX4DDL21x32tF7f7/Zf/nH37+AKYUJzOe/VWtn8Wl/ttmJBxvCLnU1m NO8CGxPzt42ReJv5XWHr7MKGNO556OPHXp8zD5ica1oB3xYgEO0D1kbTIQHWyQyz7bUT k23vclOODY1lh/9c09UozU/QT8Iu+dmGgFo1aCjwSDtlZuUzcU/kHY7Vc9h54/gQufQq FLIQ== X-Gm-Message-State: AOJu0YwRjMxkHndHtDsPhDcH/sBzeUO8kA+NldHqxo26PQ9yyhx2wuRM n13CskUzWRSNNYUTSzjvKEe1xL9DmNhsDFntkrHDHpMNav3G377NOzCvfNtD04hn30bfVkeILZI WH2XYJFVJQzuRryBlPPYLDImHZWSJ X-Received: by 2002:a7b:cc8f:0:b0:40a:6235:e832 with SMTP id p15-20020a7bcc8f000000b0040a6235e832mr646337wma.19.1700777606326; Thu, 23 Nov 2023 14:13:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUS52KyNbklxpPEj23AckZsdZntJX98+LIJ9h/c+7dPvbvw5i7N6FBV/jDsPgq5cqyhTFDUQ== X-Received: by 2002:a7b:cc8f:0:b0:40a:6235:e832 with SMTP id p15-20020a7bcc8f000000b0040a6235e832mr646322wma.19.1700777606063; Thu, 23 Nov 2023 14:13:26 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id t5-20020adff045000000b00332e6a0e9f4sm1363883wro.75.2023.11.23.14.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 14:13:24 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [PATCH v4 4/5] drm/plane: Extend damage tracking kernel-doc Date: Thu, 23 Nov 2023 23:13:03 +0100 Message-ID: <20231123221315.3579454-5-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231123221315.3579454-1-javierm@redhat.com> References: <20231123221315.3579454-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 Reviewed-by: Thomas Zimmermann Reviewed-by: Zack Rusin Acked-by: Sima Vetter --- Changes in v4: - Add another paragraph to "Damage Tracking Properties" section to mention the fields that drivers with per-buffer upload target should check to set drm_plane_state.ignore_damage_clips (Sima Vetter). 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 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 24e7998d1731..662e0ba2707a 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -1442,6 +1442,36 @@ 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, must set + * &drm_plane_state.ignore_damage_clips for drm_atomic_helper_damage_iter_init() + * to know that damage clips should be ignored and return &drm_plane_state.src + * as the damage rectangle, to force a full plane update. + * + * Drivers with a per-buffer upload target could compare the &drm_plane_state.fb + * of the old and new plane states to determine if the framebuffer attached to a + * plane has changed or not since the last plane update. If &drm_plane_state.fb + * has changed, then &drm_plane_state.ignore_damage_clips must be set to true. + * + * 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 Thu Nov 23 22:13:04 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: 13466781 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 B088DC61DF7 for ; Thu, 23 Nov 2023 22:13:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 015E710E361; Thu, 23 Nov 2023 22:13:44 +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 012BA10E35F for ; Thu, 23 Nov 2023 22:13:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700777610; 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=7MuULYoz5ao+rLNA+YbUecP2cAJXv6WyavKrHjMaHS4=; b=Lw069V045Q40ZCCCf0olSpqv/078aPMnmerNylcMSLroA5fjVB1Yv8n3FtHY653WvI+Lhd rVksgz41qNMWKc9Y40PpcIaxHrRv6Zn3xohHB3FLpjMTfqYPHwWfHZNJu/ald3xGJMs0dV 9WZ/Evhp96TssYQsFjFhHGuIi3QT890= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-47-0ZzLWPzVMTGbIPEn8zFcrQ-1; Thu, 23 Nov 2023 17:13:28 -0500 X-MC-Unique: 0ZzLWPzVMTGbIPEn8zFcrQ-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-332e2e0b98bso640084f8f.1 for ; Thu, 23 Nov 2023 14:13:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700777607; x=1701382407; 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=7MuULYoz5ao+rLNA+YbUecP2cAJXv6WyavKrHjMaHS4=; b=iC5uTCKnVlQn6dhG5/e9f5A9wcxXxQ+SeTtwybWgRnYkkA+39R6GLVWnBCHkWlxb5r nRM/gwNb+Ei3S42Cd2BoNxAiloWyJ9DYFC0iHH460A7arlWh8PP4zUvMAx1yBb/ZqixK dEPr7qbcnkO1X7XEdTTu2Hu8sJ2nsWkByL56b0BVuiuZ6C4Z7aqby6g5wRT5zUP3+5qR YMwa4xtMzzK2UkP3GHitKNttJ00ZBcDFW1JZMNNTZ+WEP5yVwkO27mq4Vfe6COrgCplN C3w+LptRDdKqObpy0jMxxe8rcIrhzcWqF+Piiq7Dyq9OO5ebcjplrTw9bHJ8Q4Wjx6Yl NdiQ== X-Gm-Message-State: AOJu0YwgWorvpV/bGNxtEdzW8HpegGbehHWVbMjzoxD7u8ni5UvAu7Cg CXGPtJM/5QPeT1iAqlfMTpbeubK/QrDzEKVPdPK9V9eHlJUKKMXdPH/MTP4iLNwYj3kywLzdq8/ 7T3W4rKHXePyYwX/FKKnVpGJImwUP X-Received: by 2002:a5d:40c8:0:b0:332:e777:a8d4 with SMTP id b8-20020a5d40c8000000b00332e777a8d4mr565983wrq.36.1700777607605; Thu, 23 Nov 2023 14:13:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFbblMAN+hzDoQaplfSW1Ls9XUsnDbl4YuadfKrIq6lj50fMHkQHToWy2rbRvbEJLq7TAFUoA== X-Received: by 2002:a5d:40c8:0:b0:332:e777:a8d4 with SMTP id b8-20020a5d40c8000000b00332e777a8d4mr565964wrq.36.1700777607350; Thu, 23 Nov 2023 14:13:27 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id s7-20020a5d5107000000b00332c6a52040sm2681153wrt.100.2023.11.23.14.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 14:13:27 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [PATCH v4 5/5] drm/todo: Add entry about implementing buffer age for damage tracking Date: Thu, 23 Nov 2023 23:13:04 +0100 Message-ID: <20231123221315.3579454-6-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231123221315.3579454-1-javierm@redhat.com> References: <20231123221315.3579454-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 Reviewed-by: Thomas Zimmermann Reviewed-by: Zack Rusin Acked-by: Sima Vetter --- Changes in v4: - Reference the &drm_plane_state.ignore_damage_clips and the damage helpers in the buffer damage TODO entry (Sima Vetter). Documentation/gpu/todo.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index b62c7fa0c2bc..503d57c75215 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -782,6 +782,29 @@ Contact: Hans de Goede Level: Advanced +Buffer age or other damage accumulation algorithm for buffer damage +=================================================================== + +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. Drivers +set &drm_plane_state.ignore_damage_clips to true as indication to +drm_atomic_helper_damage_iter_init() and drm_atomic_helper_damage_iter_next() +helpers that the damage clips should be ignored. + +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 can +be found in :ref:`damage_tracking_properties`. + +Contact: Javier Martinez Canillas + +Level: Advanced + Outside DRM ===========