Message ID | 20240119181235.255060-1-andrealmeid@igalia.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-31463-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp1186291dyb; Fri, 19 Jan 2024 10:13:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHllWUtvs5wrseTUhBNY2ZfTqGwa3rUrnVZQipHw9Wwnspj8cicvTEMlB30D9nfqyPU4qyB X-Received: by 2002:a05:6808:99a:b0:3bc:29da:fc11 with SMTP id a26-20020a056808099a00b003bc29dafc11mr124181oic.60.1705688019081; Fri, 19 Jan 2024 10:13:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705688019; cv=pass; d=google.com; s=arc-20160816; b=lIBLxrffqZBmN5yKv9SO1BYv3SpwdfsruJs7lEI8MCjw56sGIl3chcV+iFS5MlfVrn 83Bnir95ADTNEFybZjS7OPcilw5ye9Ok/CkDp1yVLgnoEheRFjsNzCAf+zxsXkxc6YG0 GeYvzzpxhs/rXN9CNEUCx5MG7INEGCXA8K1JLC4ylzk1ypvk/6+OJkUESEXfRqDT7kyz kDKtgF2v4nYaHBlk58FsoeJUVDq14AHi5GbKKhofHCG7u9GauDJn20mPQmvcqFBpnwln MuavzO0dvE0EOEpmi91nVOFWwPD6qrsVxggBp2Scs5zf6AhwAssowIFErp8lDfsFaL9O g/jA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=snS3sepdCs4f30m6IiSQJtRwuG+MKNNfpUzB7tS2E6E=; fh=njd2ecPfO+MOSUbjxezZy5Zaoa3J5aSXR1p04i4lAW0=; b=Q5fvMwLxOv4BdtejX0PX41ewiJp7E0mIX/mEAk8AI4835Iyerga/ZX4Pow3ZOG/+9B u4UjxtwNr5rZCuCy75WP8RsGqP9082BZLnjeN8p/g1iHQ4tPZaE874JmKlwMyi7k8/Kv UD7LK69UtueQHu7qxrTE3vp2QTYEBJh7DG+gmQjz+y6OG7232RQk7XxlhsZB4Pj9T4PW R+Q6Ycta/D4iwlITUrnMLUlVCWSLvkID1+Ntn0n0X8e9LNcter1b/8zf/5q+J5tpbihw Bof8eGSbdhdmqcxnKXsyvWMBmXPWxxSbHMgh5guWKo6NGRzuC3SyM/GeL7AiUtyGueLf oUUg== ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=Rn4mlrLK; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-31463-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31463-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o13-20020a05622a008d00b0042a159bf807si5040287qtw.446.2024.01.19.10.13.38 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 10:13:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31463-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=Rn4mlrLK; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-31463-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31463-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 049B61C249CD for <ouuuleilei@gmail.com>; Fri, 19 Jan 2024 18:13:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8246D56761; Fri, 19 Jan 2024 18:13:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="Rn4mlrLK" Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E937B3C6B9 for <linux-kernel@vger.kernel.org>; Fri, 19 Jan 2024 18:12:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705687981; cv=none; b=p1ePCLgnvuP2Qs4zqHeg9poBadjDJpK9O0eJDaYnNfwpRQ15GE5JYw+JvS4a5GiFGkLDx0+03TeX/klHaUeuWyVmdiHOoJ04BBkOS9ceWBgQ+rpIFq7k3AuOGR4eONrb5IjCfqCirxKfcGQsuGIDgyAlc1/dO0rhnSFxwjD0t/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705687981; c=relaxed/simple; bh=qhvEmmdHG6XJFlP+++1jTmWjYBCnRGIB+7vVpzhQfvE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=r58nrXz3eSTVHXuykdShp0MVsaioVHFgIr67zbJzHEXGxQXd+Wr63L8s6TNui4Y7gxGOZzDgA7zazquoWOaqV/y9cLocQ5kQ7FVzYEmAm489yoHe+A2ShoF4yJX//jfqs2838eJhDM1vqol6Y35h1x/DKO8BymiUKU4tjBPERXs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=Rn4mlrLK; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com 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: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: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=snS3sepdCs4f30m6IiSQJtRwuG+MKNNfpUzB7tS2E6E=; b=Rn4mlrLKo/ZYehkmOop33PLDPN UhTix9wtq+KOdPY1ltIEEzTRN2i445FkNqJPbe65lzVHlkVGXy6yw4F0/hvfuJ1ystQ20uGwNJmw3 iOQDBpmvBIdEpz8zjLdnXEjxY1JbZNJCxvJwBEwDNA5J2iV0WzV9/AB5OrvJb5p5w4zdjxL1GM2ck ZTl//TlPnWoKFvaRyU4gVNhK/6Cvvqdb4srxuaJTfU6Ll62vr34UItsdYpXiRwgf5F0UvvCKs+1/4 oLkLiuQliar5aRo015hSSNukTtY/q+BJAcHe29J2kbzUgGRwar2/dp2uXBLg3WSraSSlcxBEPPyLp 9OkZLP8A==; Received: from [177.45.63.147] (helo=steammachine.lan) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1rQtMD-00873a-BS; Fri, 19 Jan 2024 19:12:45 +0100 From: =?utf-8?q?Andr=C3=A9_Almeida?= <andrealmeid@igalia.com> 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 <contact@emersion.fr>, Pekka Paalanen <ppaalanen@gmail.com>, daniel@ffwll.ch, Daniel Stone <daniel@fooishbar.org>, =?utf-8?b?J01hcmVrIE9sxaHDoWsn?= <maraeo@gmail.com>, Dave Airlie <airlied@gmail.com>, ville.syrjala@linux.intel.com, Xaver Hugl <xaver.hugl@gmail.com>, Joshua Ashton <joshua@froggi.es>, =?utf-8?q?Michel_D=C3=A4nzer?= <michel.daenzer@mailbox.org>, =?utf-8?q?Andr?= =?utf-8?q?=C3=A9_Almeida?= <andrealmeid@igalia.com> Subject: [PATCH v2 0/2] drm/atomic: Allow drivers to write their own plane check for async Date: Fri, 19 Jan 2024 15:12:33 -0300 Message-ID: <20240119181235.255060-1-andrealmeid@igalia.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788543520250863898 X-GMAIL-MSGID: 1788543520250863898 |
Series |
drm/atomic: Allow drivers to write their own plane check for async
|
|
Message
André Almeida
Jan. 19, 2024, 6:12 p.m. UTC
Hi, AMD hardware can do more on the async flip path than just the primary plane, so to lift up the current restrictions, this patchset allows drivers to write their own check for planes for async flips. For now this patchset only allow for async commits with IN_FENCE_ID and FB_DAMAGE_CLIPS. Userspace can query if a driver supports this with TEST_ONLY commits. I will left overlay planes for a next iteration. Changes from v1: - Drop overlay planes option for now v1: https://lore.kernel.org/dri-devel/20240116045159.1015510-1-andrealmeid@igalia.com/ André André Almeida (2): drm/atomic: Allow drivers to write their own plane check for async flips drm/amdgpu: Implement check_async_props for planes .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 29 +++++++++ drivers/gpu/drm/drm_atomic_uapi.c | 62 ++++++++++++++----- include/drm/drm_atomic_uapi.h | 12 ++++ include/drm/drm_plane.h | 5 ++ 4 files changed, 91 insertions(+), 17 deletions(-)
Comments
On 2024-01-19 13:25, Ville Syrjälä wrote: > On Fri, Jan 19, 2024 at 03:12:35PM -0300, André Almeida wrote: >> AMD GPUs can do async flips with changes on more properties than just >> the FB ID, so implement a custom check_async_props for AMD planes. >> >> Allow amdgpu to do async flips with IN_FENCE_ID and FB_DAMAGE_CLIPS >> properties. For userspace to check if a driver support this two >> properties, the strategy for now is to use TEST_ONLY commits. >> >> Signed-off-by: André Almeida <andrealmeid@igalia.com> >> --- >> v2: Drop overlay plane option for now >> >> .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 29 +++++++++++++++++++ >> 1 file changed, 29 insertions(+) >> >> 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 116121e647ca..7afe8c1b62d4 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 >> @@ -25,6 +25,7 @@ >> */ >> >> #include <drm/drm_atomic_helper.h> >> +#include <drm/drm_atomic_uapi.h> >> #include <drm/drm_blend.h> >> #include <drm/drm_gem_atomic_helper.h> >> #include <drm/drm_plane_helper.h> >> @@ -1430,6 +1431,33 @@ static void amdgpu_dm_plane_drm_plane_destroy_state(struct drm_plane *plane, >> drm_atomic_helper_plane_destroy_state(plane, state); >> } >> >> +static int amdgpu_dm_plane_check_async_props(struct drm_property *prop, >> + struct drm_plane *plane, >> + struct drm_plane_state *plane_state, >> + struct drm_mode_object *obj, >> + u64 prop_value, u64 old_val) >> +{ >> + struct drm_mode_config *config = &plane->dev->mode_config; >> + int ret; >> + >> + if (prop != config->prop_fb_id && >> + prop != config->prop_in_fence_fd && > > IN_FENCE should just be allowed always. > >> + prop != config->prop_fb_damage_clips) { > > This seems a bit dubious to me. How is amdgpu using the damage > information during async flips? Yeah, I'm also not sure this is right. Has anyone tested this with a PSR SU panel? Harry > >> + ret = drm_atomic_plane_get_property(plane, plane_state, >> + prop, &old_val); >> + return drm_atomic_check_prop_changes(ret, old_val, prop_value, prop); >> + } >> + >> + if (plane_state->plane->type != DRM_PLANE_TYPE_PRIMARY) { >> + drm_dbg_atomic(prop->dev, >> + "[OBJECT:%d] Only primary planes can be changed during async flip\n", >> + obj->id); >> + return -EINVAL; >> + } >> + >> + return 0; >> +} >> + >> static const struct drm_plane_funcs dm_plane_funcs = { >> .update_plane = drm_atomic_helper_update_plane, >> .disable_plane = drm_atomic_helper_disable_plane, >> @@ -1438,6 +1466,7 @@ static const struct drm_plane_funcs dm_plane_funcs = { >> .atomic_duplicate_state = amdgpu_dm_plane_drm_plane_duplicate_state, >> .atomic_destroy_state = amdgpu_dm_plane_drm_plane_destroy_state, >> .format_mod_supported = amdgpu_dm_plane_format_mod_supported, >> + .check_async_props = amdgpu_dm_plane_check_async_props, >> }; >> >> int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, >> -- >> 2.43.0 >
On 2024-01-23 13:02, Xaver Hugl wrote: > Am Mo., 22. Jan. 2024 um 16:50 Uhr schrieb Harry Wentland > <harry.wentland@amd.com>: >> >> >> >> On 2024-01-19 13:25, Ville Syrjälä wrote: >>> On Fri, Jan 19, 2024 at 03:12:35PM -0300, André Almeida wrote: >>>> AMD GPUs can do async flips with changes on more properties than just >>>> the FB ID, so implement a custom check_async_props for AMD planes. >>>> >>>> Allow amdgpu to do async flips with IN_FENCE_ID and FB_DAMAGE_CLIPS >>>> properties. For userspace to check if a driver support this two >>>> properties, the strategy for now is to use TEST_ONLY commits. >>>> >>>> Signed-off-by: André Almeida <andrealmeid@igalia.com> >>>> --- >>>> v2: Drop overlay plane option for now >>>> >>>> .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 29 +++++++++++++++++++ >>>> 1 file changed, 29 insertions(+) >>>> >>>> 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 116121e647ca..7afe8c1b62d4 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 >>>> @@ -25,6 +25,7 @@ >>>> */ >>>> >>>> #include <drm/drm_atomic_helper.h> >>>> +#include <drm/drm_atomic_uapi.h> >>>> #include <drm/drm_blend.h> >>>> #include <drm/drm_gem_atomic_helper.h> >>>> #include <drm/drm_plane_helper.h> >>>> @@ -1430,6 +1431,33 @@ static void amdgpu_dm_plane_drm_plane_destroy_state(struct drm_plane *plane, >>>> drm_atomic_helper_plane_destroy_state(plane, state); >>>> } >>>> >>>> +static int amdgpu_dm_plane_check_async_props(struct drm_property *prop, >>>> + struct drm_plane *plane, >>>> + struct drm_plane_state *plane_state, >>>> + struct drm_mode_object *obj, >>>> + u64 prop_value, u64 old_val) >>>> +{ >>>> + struct drm_mode_config *config = &plane->dev->mode_config; >>>> + int ret; >>>> + >>>> + if (prop != config->prop_fb_id && >>>> + prop != config->prop_in_fence_fd && >>> >>> IN_FENCE should just be allowed always. >>> >>>> + prop != config->prop_fb_damage_clips) { >>> >>> This seems a bit dubious to me. How is amdgpu using the damage >>> information during async flips? >> >> Yeah, I'm also not sure this is right. Has anyone tested this >> with a PSR SU panel? >> >> Harry > > I attempted to, but according to > /sys/kernel/debug/dri/1/eDP-1/psr_state, PSR never kicks in on my > laptop at all. The only reason I wanted this property though is to > reduce the number of special cases for async pageflips compositors > have to implement; as it's not necessary for any functionality I think > it's also fine to leave it out. > Yeah, PSR panels aren't super common. PSR SU (Selective Update) panels even less so. I'd prefer to keep the damage clips out of async for now unless we can actually test it with a PSR SU panel. Harry >>>> + ret = drm_atomic_plane_get_property(plane, plane_state, >>>> + prop, &old_val); >>>> + return drm_atomic_check_prop_changes(ret, old_val, prop_value, prop); >>>> + } >>>> + >>>> + if (plane_state->plane->type != DRM_PLANE_TYPE_PRIMARY) { >>>> + drm_dbg_atomic(prop->dev, >>>> + "[OBJECT:%d] Only primary planes can be changed during async flip\n", >>>> + obj->id); >>>> + return -EINVAL; >>>> + } >>>> + >>>> + return 0; >>>> +} >>>> + >>>> static const struct drm_plane_funcs dm_plane_funcs = { >>>> .update_plane = drm_atomic_helper_update_plane, >>>> .disable_plane = drm_atomic_helper_disable_plane, >>>> @@ -1438,6 +1466,7 @@ static const struct drm_plane_funcs dm_plane_funcs = { >>>> .atomic_duplicate_state = amdgpu_dm_plane_drm_plane_duplicate_state, >>>> .atomic_destroy_state = amdgpu_dm_plane_drm_plane_destroy_state, >>>> .format_mod_supported = amdgpu_dm_plane_format_mod_supported, >>>> + .check_async_props = amdgpu_dm_plane_check_async_props, >>>> }; >>>> >>>> int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, >>>> -- >>>> 2.43.0 >>>