From patchwork Fri Mar 8 14:55:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 13586906 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 1011AC5475B for ; Fri, 8 Mar 2024 14:56:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 85F611138E5; Fri, 8 Mar 2024 14:56:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="amqk+UvB"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 011381138EA; Fri, 8 Mar 2024 14:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=R+C5C00hqwaItnGEh4nhXpDi1vrMiefpdzqj2L/NgqM=; b=amqk+UvB+WUvrusoCbz188aBRH RjR9wHoPGJhAcrg9Pnq5qBtjfC8jqb2OYMjbwvjNqXMt9a4sh550+IFisn/xBWld9a5ZbkrAsMeRz KQNB/oH97dAnpAuQE9yGwrS5e1zhTPt9KAB/2OXRlLzQrD0orZqJwpldbUIKIvh/Jd8IH0qv4e2oI 3XTH70d/rJspVhNV5YFfRSCLKVgeuWnZeesD2oYD97SCv98PedmlcvvIPcZFRIlHkfx7wrvdDv/rS a9alOKvL0Uqgy88zv1B0ka4cR/BN6QX7wVwYeNt5D1zOoFvjmDXBDIVkGyoj/5MVsyyzgv0cDUXmQ C/3vpw8w==; Received: from [152.249.135.210] (helo=steammachine.lan) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1ribdp-007p93-8a; Fri, 08 Mar 2024 15:56:09 +0100 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: kernel-dev@igalia.com, alexander.deucher@amd.com, christian.koenig@amd.com, Simon Ser , Pekka Paalanen , daniel@ffwll.ch, Daniel Stone , =?utf-8?b?J01hcmVrIE9sxaHDoWsn?= , Dave Airlie , ville.syrjala@linux.intel.com, Xaver Hugl , Joshua Ashton , =?utf-8?q?Michel_D=C3=A4nzer?= , =?utf-8?q?Andr?= =?utf-8?q?=C3=A9_Almeida?= Subject: [RESEND PATCH v4 1/3] drm/atomic: Allow userspace to use explicit sync with atomic async flips Date: Fri, 8 Mar 2024 11:55:51 -0300 Message-ID: <20240308145553.194165-2-andrealmeid@igalia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240308145553.194165-1-andrealmeid@igalia.com> References: <20240308145553.194165-1-andrealmeid@igalia.com> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Allow userspace to use explicit synchronization with atomic async flips. That means that the flip will wait for some hardware fence, and then will flip as soon as possible (async) in regard of the vblank. Signed-off-by: André Almeida --- v4: no changes drivers/gpu/drm/drm_atomic_uapi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index 29d4940188d4..1eecfb9e240d 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -1066,7 +1066,9 @@ int drm_atomic_set_property(struct drm_atomic_state *state, break; } - if (async_flip && prop != config->prop_fb_id) { + if (async_flip && + prop != config->prop_fb_id && + prop != config->prop_in_fence_fd) { ret = drm_atomic_plane_get_property(plane, plane_state, prop, &old_val); ret = drm_atomic_check_prop_changes(ret, old_val, prop_value, prop); From patchwork Fri Mar 8 14:55:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 13586907 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 93004C54E58 for ; Fri, 8 Mar 2024 14:56:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D3A9C1138E6; Fri, 8 Mar 2024 14:56:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="ma7RYtqG"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id EE3371138E4; Fri, 8 Mar 2024 14:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=krDIRYgU1uLFsIvNtqFMjTjuXBLodI3PgcqmjvYIA64=; b=ma7RYtqGTddCWW/HzBOmsnL5Ut cpRud3IdvZ/c3pm3joUw6CwSSPeRodpDnGoKBQbAExK6ObI17EF5vq2qqqgbecfUF8g9mnspAHfsv AEnNry+B+spRFExeOeJ7Feu0pW6Ka7CMDBjuQumO1dHn0bodi43ZgI49zkYZ1iyf9YD+XfuuittVq LI1/4BSoF54VL0KUVUMZ+baz4xTH+8/CxfTLaj7MmV1oigMDTT+UEqAR8QjYkeMkWDl9HI+iv0cfY ZpdyKtnv/weyNo+o6G0ZLuPMbcsWObrzPZK1DrEIt7/LuVWax2a3GySvway+4buP7PHI849iQ3b0H od/OUN9g==; Received: from [152.249.135.210] (helo=steammachine.lan) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1ribdu-007p93-5S; Fri, 08 Mar 2024 15:56:14 +0100 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: kernel-dev@igalia.com, alexander.deucher@amd.com, christian.koenig@amd.com, Simon Ser , Pekka Paalanen , daniel@ffwll.ch, Daniel Stone , =?utf-8?b?J01hcmVrIE9sxaHDoWsn?= , Dave Airlie , ville.syrjala@linux.intel.com, Xaver Hugl , Joshua Ashton , =?utf-8?q?Michel_D=C3=A4nzer?= , =?utf-8?q?Andr?= =?utf-8?q?=C3=A9_Almeida?= Subject: [RESEND PATCH v4 2/3] drm: Allow drivers to choose plane types to async flip Date: Fri, 8 Mar 2024 11:55:52 -0300 Message-ID: <20240308145553.194165-3-andrealmeid@igalia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240308145553.194165-1-andrealmeid@igalia.com> References: <20240308145553.194165-1-andrealmeid@igalia.com> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Different planes may have different capabilities of doing async flips, so create a field to let drivers allow async flip per plane type. Signed-off-by: André Almeida --- v4: new patch drivers/gpu/drm/drm_atomic_uapi.c | 4 ++-- drivers/gpu/drm/drm_plane.c | 3 +++ include/drm/drm_plane.h | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index 1eecfb9e240d..5c66289188be 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -1075,9 +1075,9 @@ int drm_atomic_set_property(struct drm_atomic_state *state, break; } - if (async_flip && plane_state->plane->type != DRM_PLANE_TYPE_PRIMARY) { + if (async_flip && !plane_state->plane->async_flip) { drm_dbg_atomic(prop->dev, - "[OBJECT:%d] Only primary planes can be changed during async flip\n", + "[OBJECT:%d] This type of plane cannot be changed during async flip\n", obj->id); ret = -EINVAL; break; diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 672c655c7a8e..71ada690222a 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -366,6 +366,9 @@ static int __drm_universal_plane_init(struct drm_device *dev, drm_modeset_lock_init(&plane->mutex); + if (type == DRM_PLANE_TYPE_PRIMARY) + plane->async_flip = true; + plane->base.properties = &plane->properties; plane->dev = dev; plane->funcs = funcs; diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 641fe298052d..5e9efb7321ac 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -779,6 +779,11 @@ struct drm_plane { * @hotspot_y_property: property to set mouse hotspot y offset. */ struct drm_property *hotspot_y_property; + + /** + * @async_flip: indicates if a plane can do async flips + */ + bool async_flip; }; #define obj_to_plane(x) container_of(x, struct drm_plane, base) From patchwork Fri Mar 8 14:55:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 13586908 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 D1B0CC5475B for ; Fri, 8 Mar 2024 14:56:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DC9861138E8; Fri, 8 Mar 2024 14:56:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="EzhGPudl"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0046F1138E1; Fri, 8 Mar 2024 14:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=yRF44PAwuObJjETXmhstoHPr/yI6S4jcqxgx+14ydL0=; b=EzhGPudlVcIyYE0mO/lcVrqegM F8nFLKO3qO83O6C/zNC/BB2q4TzqXb5kf+kNT+CdO5/fRtyxL6sfEg2XCz21VVJUnquqldXqqiJb9 EnXVU12DNjwcv8jlFotFRw+IZLh7RPOW1nKl8ROwBGT4pHtjeRYzcp7UmimWfRD6CIIM1CjgfYiT1 4xWSIKCJfKsF3gucCVzoIq6JV8DoO7Jr2+6ww0RGsGJ/qZF3O5TwD/3v+AEZMS9lga4BjM0v5Du/q OUeigFkntJ9NPX82nexlacVgHWbeuldHjWKCI3dIHA750BEtePOAOLdtu/VNjxcCs+SfuKob8eyY0 0Kf/oeng==; Received: from [152.249.135.210] (helo=steammachine.lan) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1ribdz-007p93-2D; Fri, 08 Mar 2024 15:56:19 +0100 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: kernel-dev@igalia.com, alexander.deucher@amd.com, christian.koenig@amd.com, Simon Ser , Pekka Paalanen , daniel@ffwll.ch, Daniel Stone , =?utf-8?b?J01hcmVrIE9sxaHDoWsn?= , Dave Airlie , ville.syrjala@linux.intel.com, Xaver Hugl , Joshua Ashton , =?utf-8?q?Michel_D=C3=A4nzer?= , =?utf-8?q?Andr?= =?utf-8?q?=C3=A9_Almeida?= Subject: [RESEND PATCH v4 3/3] drm/amdgpu: Make it possible to async flip overlay planes Date: Fri, 8 Mar 2024 11:55:53 -0300 Message-ID: <20240308145553.194165-4-andrealmeid@igalia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240308145553.194165-1-andrealmeid@igalia.com> References: <20240308145553.194165-1-andrealmeid@igalia.com> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" amdgpu can handle async flips on overlay planes, so mark it as true during the plane initialization. Signed-off-by: André Almeida --- v4: new patch drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c index 8a4c40b4c27e..dc5392c08a87 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c @@ -1708,6 +1708,7 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, } else if (plane->type == DRM_PLANE_TYPE_OVERLAY) { unsigned int zpos = 1 + drm_plane_index(plane); drm_plane_create_zpos_property(plane, zpos, 1, 254); + plane->async_flip = true; } else if (plane->type == DRM_PLANE_TYPE_CURSOR) { drm_plane_create_zpos_immutable_property(plane, 255); }