All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Wentland <harry.wentland@amd.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"André Almeida" <andrealmeid@igalia.com>
Cc: kernel-dev@igalia.com, "'Marek Olšák'" <maraeo@gmail.com>,
	"Michel Dänzer" <michel.daenzer@mailbox.org>,
	"Xaver Hugl" <xaver.hugl@gmail.com>,
	amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	"Pekka Paalanen" <ppaalanen@gmail.com>,
	dri-devel@lists.freedesktop.org, daniel@ffwll.ch,
	alexander.deucher@amd.com, "Dave Airlie" <airlied@gmail.com>,
	christian.koenig@amd.com, "Joshua Ashton" <joshua@froggi.es>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: Implement check_async_props for planes
Date: Mon, 22 Jan 2024 10:50:48 -0500	[thread overview]
Message-ID: <ca1faaec-461b-401c-a86a-e0929d282b51@amd.com> (raw)
In-Reply-To: <Zaq-r7UZpEy7_Rrn@intel.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

> 
>> +		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
> 

WARNING: multiple messages have this Message-ID (diff)
From: Harry Wentland <harry.wentland@amd.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"André Almeida" <andrealmeid@igalia.com>
Cc: daniel@ffwll.ch, "'Marek Olšák'" <maraeo@gmail.com>,
	"Michel Dänzer" <michel.daenzer@mailbox.org>,
	linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	"Xaver Hugl" <xaver.hugl@gmail.com>,
	"Pekka Paalanen" <ppaalanen@gmail.com>,
	dri-devel@lists.freedesktop.org, kernel-dev@igalia.com,
	alexander.deucher@amd.com, "Dave Airlie" <airlied@gmail.com>,
	christian.koenig@amd.com, "Joshua Ashton" <joshua@froggi.es>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: Implement check_async_props for planes
Date: Mon, 22 Jan 2024 10:50:48 -0500	[thread overview]
Message-ID: <ca1faaec-461b-401c-a86a-e0929d282b51@amd.com> (raw)
In-Reply-To: <Zaq-r7UZpEy7_Rrn@intel.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

> 
>> +		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
> 

  reply	other threads:[~2024-01-22 15:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 18:12 [PATCH v2 0/2] drm/atomic: Allow drivers to write their own plane check for async André Almeida
2024-01-19 18:12 ` André Almeida
2024-01-19 18:12 ` André Almeida
2024-01-19 18:12 ` [PATCH v2 1/2] drm/atomic: Allow drivers to write their own plane check for async flips André Almeida
2024-01-19 18:12   ` André Almeida
2024-01-19 18:12   ` André Almeida
2024-01-19 18:12 ` [PATCH v2 2/2] drm/amdgpu: Implement check_async_props for planes André Almeida
2024-01-19 18:12   ` André Almeida
2024-01-19 18:12   ` André Almeida
2024-01-19 18:25   ` Ville Syrjälä
2024-01-19 18:25     ` Ville Syrjälä
2024-01-19 18:25     ` Ville Syrjälä
2024-01-22 15:50     ` Harry Wentland [this message]
2024-01-22 15:50       ` Harry Wentland
2024-01-23 18:02       ` Xaver Hugl
2024-01-23 18:02         ` Xaver Hugl
2024-01-23 18:02         ` Xaver Hugl
2024-01-23 20:32         ` Harry Wentland
2024-01-23 20:32           ` Harry Wentland
2024-01-23 20:32           ` Harry Wentland
2024-01-24 14:14     ` André Almeida
2024-01-24 14:14       ` André Almeida
2024-01-24 14:14       ` André Almeida
2024-01-25 10:32       ` Ville Syrjälä
2024-01-25 10:32         ` Ville Syrjälä
2024-01-25 10:32         ` Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca1faaec-461b-401c-a86a-e0929d282b51@amd.com \
    --to=harry.wentland@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andrealmeid@igalia.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=joshua@froggi.es \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maraeo@gmail.com \
    --cc=michel.daenzer@mailbox.org \
    --cc=ppaalanen@gmail.com \
    --cc=ville.syrjala@linux.intel.com \
    --cc=xaver.hugl@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.