public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND v9 0/2] drm/atomic: Ease async flip restrictions
@ 2024-11-01 18:23 André Almeida
  2024-11-01 18:23 ` [PATCH RESEND v9 1/2] drm/atomic: Let drivers decide which planes to async flip André Almeida
  2024-11-01 18:23 ` [PATCH RESEND v9 2/2] drm/amdgpu: Enable async flip on overlay planes André Almeida
  0 siblings, 2 replies; 11+ messages in thread
From: André Almeida @ 2024-11-01 18:23 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
	Alex Deucher, Christian König, Xinhui Pan, dmitry.baryshkov,
	Simon Ser, joshua, Xaver Hugl, Daniel Stone, ville.syrjala
  Cc: kernel-dev, dri-devel, linux-kernel, amd-gfx, André Almeida

Hi,

As per my previous patchsets, the goal of this work is to find a nice way to
allow amdgpu to perform async page flips in the overlay plane as well, not
only on the primary one. Currently, when using the atomic uAPI, this is the only
type of plane allowed to do async flips, and every driver accepts it.

In my last version, I had created a static field `bool async_flip` for
drm_planes. When creating new planes, drivers could tell if such plane was
allowed or not to do async flips. This would be latter checked on the atomic
uAPI whenever the DRM_MODE_PAGE_FLIP_ASYNC was present.

However, Dmitry Baryshkov raised a valid point about getting confused with the 
existing atomic_async_check() code, giving that is a function to do basically
what I want: to let drivers tell DRM whether a giving plane can do async flips
or not. It turns out atomic_async_check() is implemented by drivers to deal with
the legacy cursor update, so it's not wired with the atomic uAPI because is
something that precedes such API.

So my new proposal is to just reuse this same function in the atomic uAPI path.
The plane restrictions defined at atomic_async_check() should work in this
codepath as well. And I will be able to allow overlays planes by modifying
amdgpu_dm_plane_atomic_async_check(), and anyone else have a proper place to
play with async plane restrictions as well.

One note is that currently we always allow async flips for primary planes,
regardless of the drivers, but not every atomic_async_check() implementation
allows primary planes (because they were writing targeting cursor planes
anyway...). To avoid regressions, my patch only calls atomic_async_check() for
non primary planes, and always allows primary ones.

Thoughts?

Changelog
 v8: https://lore.kernel.org/lkml/20240806135300.114469-1-andrealmeid@igalia.com/
 - Rebased on top of 6.12-rc1 (drm/drm-next)

Changelog
 v7: https://lore.kernel.org/dri-devel/20240618030024.500532-1-andrealmeid@igalia.com/
 - Complete rewrite

---
Changes in v10:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v9: https://lore.kernel.org/r/20241002-tonyk-async_flip-v9-0-453b1b8977bd@igalia.com

---
André Almeida (2):
      drm/atomic: Let drivers decide which planes to async flip
      drm/amdgpu: Enable async flip on overlay planes

 .../drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c    |  3 +-
 drivers/gpu/drm/drm_atomic_uapi.c                  | 39 ++++++++++++++++------
 2 files changed, 30 insertions(+), 12 deletions(-)
---
base-commit: 81983758430957d9a5cb3333fe324fd70cf63e7e
change-id: 20241002-tonyk-async_flip-828cfe9cf3ca

Best regards,
-- 
André Almeida <andrealmeid@igalia.com>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH RESEND v9 1/2] drm/atomic: Let drivers decide which planes to async flip
  2024-11-01 18:23 [PATCH RESEND v9 0/2] drm/atomic: Ease async flip restrictions André Almeida
@ 2024-11-01 18:23 ` André Almeida
  2024-11-03  4:10   ` Dmitry Baryshkov
  2024-11-03  6:36   ` Christopher Snowhill
  2024-11-01 18:23 ` [PATCH RESEND v9 2/2] drm/amdgpu: Enable async flip on overlay planes André Almeida
  1 sibling, 2 replies; 11+ messages in thread
From: André Almeida @ 2024-11-01 18:23 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
	Alex Deucher, Christian König, Xinhui Pan, dmitry.baryshkov,
	Simon Ser, joshua, Xaver Hugl, Daniel Stone, ville.syrjala
  Cc: kernel-dev, dri-devel, linux-kernel, amd-gfx, André Almeida

Currently, DRM atomic uAPI allows only primary planes to be flipped
asynchronously. However, each driver might be able to perform async
flips in other different plane types. To enable drivers to set their own
restrictions on which type of plane they can or cannot flip, use the
existing atomic_async_check() from struct drm_plane_helper_funcs to
enhance this flexibility, thus allowing different plane types to be able
to do async flips as well.

In order to prevent regressions and such, we keep the current policy: we
skip the driver check for the primary plane, because it is always
allowed to do async flips on it.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
Changes from v8:
- Rebased on top of 6.12-rc1
---
 drivers/gpu/drm/drm_atomic_uapi.c | 39 +++++++++++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 370dc676e3aa543c9827b50df20df78f02b738c9..a0120df4b63e6b3419b53eb3d3673882559501c6 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -27,8 +27,9 @@
  * Daniel Vetter <daniel.vetter@ffwll.ch>
  */
 
-#include <drm/drm_atomic_uapi.h>
 #include <drm/drm_atomic.h>
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_atomic_uapi.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_print.h>
 #include <drm/drm_drv.h>
@@ -1063,6 +1064,7 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
 		struct drm_plane *plane = obj_to_plane(obj);
 		struct drm_plane_state *plane_state;
 		struct drm_mode_config *config = &plane->dev->mode_config;
+		const struct drm_plane_helper_funcs *plane_funcs = plane->helper_private;
 
 		plane_state = drm_atomic_get_plane_state(state, plane);
 		if (IS_ERR(plane_state)) {
@@ -1070,15 +1072,32 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
 			break;
 		}
 
-		if (async_flip &&
-		    (plane_state->plane->type != DRM_PLANE_TYPE_PRIMARY ||
-		     (prop != config->prop_fb_id &&
-		      prop != config->prop_in_fence_fd &&
-		      prop != config->prop_fb_damage_clips))) {
-			ret = drm_atomic_plane_get_property(plane, plane_state,
-							    prop, &old_val);
-			ret = drm_atomic_check_prop_changes(ret, old_val, prop_value, prop);
-			break;
+		if (async_flip) {
+			/* check if the prop does a nop change */
+			if ((plane_state->plane->type != DRM_PLANE_TYPE_PRIMARY) ||
+			    (prop != config->prop_fb_id &&
+			     prop != config->prop_in_fence_fd &&
+			     prop != config->prop_fb_damage_clips)) {
+				ret = drm_atomic_plane_get_property(plane, plane_state,
+								    prop, &old_val);
+				ret = drm_atomic_check_prop_changes(ret, old_val, prop_value, prop);
+				break;
+			}
+
+			/* ask the driver if this non-primary plane is supported */
+			if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
+				ret = -EINVAL;
+
+				if (plane_funcs && plane_funcs->atomic_async_check)
+					ret = plane_funcs->atomic_async_check(plane, state);
+
+				if (ret) {
+					drm_dbg_atomic(prop->dev,
+						       "[PLANE:%d] does not support async flips\n",
+						       obj->id);
+					break;
+				}
+			}
 		}
 
 		ret = drm_atomic_plane_set_property(plane,

-- 
2.47.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH RESEND v9 2/2] drm/amdgpu: Enable async flip on overlay planes
  2024-11-01 18:23 [PATCH RESEND v9 0/2] drm/atomic: Ease async flip restrictions André Almeida
  2024-11-01 18:23 ` [PATCH RESEND v9 1/2] drm/atomic: Let drivers decide which planes to async flip André Almeida
@ 2024-11-01 18:23 ` André Almeida
  2024-11-11 21:10   ` Harry Wentland
  1 sibling, 1 reply; 11+ messages in thread
From: André Almeida @ 2024-11-01 18:23 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
	Alex Deucher, Christian König, Xinhui Pan, dmitry.baryshkov,
	Simon Ser, joshua, Xaver Hugl, Daniel Stone, ville.syrjala
  Cc: kernel-dev, dri-devel, linux-kernel, amd-gfx, André Almeida

amdgpu can handle async flips on overlay planes, so allow it for atomic
async checks.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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 495e3cd70426db0182cb2811bc6d5d09f52f8a4b..4c6aed5ca777d76245f5f2865046f0f598be342a 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
@@ -1266,8 +1266,7 @@ static int amdgpu_dm_plane_atomic_async_check(struct drm_plane *plane,
 	struct drm_plane_state *new_plane_state;
 	struct dm_crtc_state *dm_new_crtc_state;
 
-	/* Only support async updates on cursor planes. */
-	if (plane->type != DRM_PLANE_TYPE_CURSOR)
+	if (plane->type != DRM_PLANE_TYPE_CURSOR && plane->type != DRM_PLANE_TYPE_OVERLAY)
 		return -EINVAL;
 
 	new_plane_state = drm_atomic_get_new_plane_state(state, plane);

-- 
2.47.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND v9 1/2] drm/atomic: Let drivers decide which planes to async flip
  2024-11-01 18:23 ` [PATCH RESEND v9 1/2] drm/atomic: Let drivers decide which planes to async flip André Almeida
@ 2024-11-03  4:10   ` Dmitry Baryshkov
  2024-11-03  6:36   ` Christopher Snowhill
  1 sibling, 0 replies; 11+ messages in thread
From: Dmitry Baryshkov @ 2024-11-03  4:10 UTC (permalink / raw)
  To: André Almeida
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
	Alex Deucher, Christian König, Xinhui Pan, Simon Ser, joshua,
	Xaver Hugl, Daniel Stone, ville.syrjala, kernel-dev, dri-devel,
	linux-kernel, amd-gfx

On Fri, Nov 01, 2024 at 03:23:47PM -0300, André Almeida wrote:
> Currently, DRM atomic uAPI allows only primary planes to be flipped
> asynchronously. However, each driver might be able to perform async
> flips in other different plane types. To enable drivers to set their own
> restrictions on which type of plane they can or cannot flip, use the
> existing atomic_async_check() from struct drm_plane_helper_funcs to
> enhance this flexibility, thus allowing different plane types to be able
> to do async flips as well.
> 
> In order to prevent regressions and such, we keep the current policy: we
> skip the driver check for the primary plane, because it is always
> allowed to do async flips on it.
> 
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> ---
> Changes from v8:
> - Rebased on top of 6.12-rc1
> ---
>  drivers/gpu/drm/drm_atomic_uapi.c | 39 +++++++++++++++++++++++++++++----------
>  1 file changed, 29 insertions(+), 10 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND v9 1/2] drm/atomic: Let drivers decide which planes to async flip
  2024-11-01 18:23 ` [PATCH RESEND v9 1/2] drm/atomic: Let drivers decide which planes to async flip André Almeida
  2024-11-03  4:10   ` Dmitry Baryshkov
@ 2024-11-03  6:36   ` Christopher Snowhill
  2024-11-04 20:52     ` André Almeida
  1 sibling, 1 reply; 11+ messages in thread
From: Christopher Snowhill @ 2024-11-03  6:36 UTC (permalink / raw)
  To: André Almeida, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Harry Wentland,
	Leo Li, Rodrigo Siqueira, Alex Deucher, Christian König,
	Xinhui Pan, dmitry.baryshkov, Simon Ser, joshua, Xaver Hugl,
	Daniel Stone, ville.syrjala
  Cc: kernel-dev, dri-devel, linux-kernel, amd-gfx

On Fri Nov 1, 2024 at 11:23 AM PDT, André Almeida wrote:
> Currently, DRM atomic uAPI allows only primary planes to be flipped
> asynchronously. However, each driver might be able to perform async
> flips in other different plane types. To enable drivers to set their own
> restrictions on which type of plane they can or cannot flip, use the
> existing atomic_async_check() from struct drm_plane_helper_funcs to
> enhance this flexibility, thus allowing different plane types to be able
> to do async flips as well.
>
> In order to prevent regressions and such, we keep the current policy: we
> skip the driver check for the primary plane, because it is always
> allowed to do async flips on it.
>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>

Should I do a R-b too? The changes looked sound enough for me to feel
like testing it as well. Tested Borderlands Game of the Year Enhanced on
my RX 7700 XT at maximum settings at 1080p165, and the tearing support in
labwc allowed it to reach over 700fps. No problems from the hardware
cursor.

Tested-by: Christopher Snowhill <chris@kode54.net>

> ---
> Changes from v8:
> - Rebased on top of 6.12-rc1
> ---
>  drivers/gpu/drm/drm_atomic_uapi.c | 39 +++++++++++++++++++++++++++++----------
>  1 file changed, 29 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 370dc676e3aa543c9827b50df20df78f02b738c9..a0120df4b63e6b3419b53eb3d3673882559501c6 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -27,8 +27,9 @@
>   * Daniel Vetter <daniel.vetter@ffwll.ch>
>   */
>  
> -#include <drm/drm_atomic_uapi.h>
>  #include <drm/drm_atomic.h>
> +#include <drm/drm_atomic_helper.h>
> +#include <drm/drm_atomic_uapi.h>
>  #include <drm/drm_framebuffer.h>
>  #include <drm/drm_print.h>
>  #include <drm/drm_drv.h>
> @@ -1063,6 +1064,7 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
>  		struct drm_plane *plane = obj_to_plane(obj);
>  		struct drm_plane_state *plane_state;
>  		struct drm_mode_config *config = &plane->dev->mode_config;
> +		const struct drm_plane_helper_funcs *plane_funcs = plane->helper_private;
>  
>  		plane_state = drm_atomic_get_plane_state(state, plane);
>  		if (IS_ERR(plane_state)) {
> @@ -1070,15 +1072,32 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
>  			break;
>  		}
>  
> -		if (async_flip &&
> -		    (plane_state->plane->type != DRM_PLANE_TYPE_PRIMARY ||
> -		     (prop != config->prop_fb_id &&
> -		      prop != config->prop_in_fence_fd &&
> -		      prop != config->prop_fb_damage_clips))) {
> -			ret = drm_atomic_plane_get_property(plane, plane_state,
> -							    prop, &old_val);
> -			ret = drm_atomic_check_prop_changes(ret, old_val, prop_value, prop);
> -			break;
> +		if (async_flip) {
> +			/* check if the prop does a nop change */
> +			if ((plane_state->plane->type != DRM_PLANE_TYPE_PRIMARY) ||
> +			    (prop != config->prop_fb_id &&
> +			     prop != config->prop_in_fence_fd &&
> +			     prop != config->prop_fb_damage_clips)) {
> +				ret = drm_atomic_plane_get_property(plane, plane_state,
> +								    prop, &old_val);
> +				ret = drm_atomic_check_prop_changes(ret, old_val, prop_value, prop);
> +				break;
> +			}
> +
> +			/* ask the driver if this non-primary plane is supported */
> +			if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
> +				ret = -EINVAL;
> +
> +				if (plane_funcs && plane_funcs->atomic_async_check)
> +					ret = plane_funcs->atomic_async_check(plane, state);
> +
> +				if (ret) {
> +					drm_dbg_atomic(prop->dev,
> +						       "[PLANE:%d] does not support async flips\n",
> +						       obj->id);
> +					break;
> +				}
> +			}
>  		}
>  
>  		ret = drm_atomic_plane_set_property(plane,


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND v9 1/2] drm/atomic: Let drivers decide which planes to async flip
  2024-11-03  6:36   ` Christopher Snowhill
@ 2024-11-04 20:52     ` André Almeida
  2024-11-05 10:15       ` Christopher Snowhill
  0 siblings, 1 reply; 11+ messages in thread
From: André Almeida @ 2024-11-04 20:52 UTC (permalink / raw)
  To: Christopher Snowhill
  Cc: kernel-dev, Simon Ser, Thomas Zimmermann, joshua, ville.syrjala,
	Daniel Stone, Xaver Hugl, Harry Wentland, Simona Vetter,
	Alex Deucher, Maarten Lankhorst, Maxime Ripard, dri-devel,
	linux-kernel, amd-gfx, Leo Li, Christian König, David Airlie,
	Rodrigo Siqueira, Xinhui Pan, dmitry.baryshkov

Hi Christopher,

Em 03/11/2024 03:36, Christopher Snowhill escreveu:
> On Fri Nov 1, 2024 at 11:23 AM PDT, André Almeida wrote:
>> Currently, DRM atomic uAPI allows only primary planes to be flipped
>> asynchronously. However, each driver might be able to perform async
>> flips in other different plane types. To enable drivers to set their own
>> restrictions on which type of plane they can or cannot flip, use the
>> existing atomic_async_check() from struct drm_plane_helper_funcs to
>> enhance this flexibility, thus allowing different plane types to be able
>> to do async flips as well.
>>
>> In order to prevent regressions and such, we keep the current policy: we
>> skip the driver check for the primary plane, because it is always
>> allowed to do async flips on it.
>>
>> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> 
> Should I do a R-b too? 

If you can review the code, it's always really appreciated.

> The changes looked sound enough for me to feel
> like testing it as well. Tested Borderlands Game of the Year Enhanced on
> my RX 7700 XT at maximum settings at 1080p165, and the tearing support in
> labwc allowed it to reach over 700fps. No problems from the hardware
> cursor.

Thanks for testing and reporting!

> 
> Tested-by: Christopher Snowhill <chris@kode54.net>
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND v9 1/2] drm/atomic: Let drivers decide which planes to async flip
  2024-11-04 20:52     ` André Almeida
@ 2024-11-05 10:15       ` Christopher Snowhill
  2024-11-05 10:51         ` Dmitry Baryshkov
  0 siblings, 1 reply; 11+ messages in thread
From: Christopher Snowhill @ 2024-11-05 10:15 UTC (permalink / raw)
  To: André Almeida
  Cc: kernel-dev, Simon Ser, Thomas Zimmermann, joshua, ville.syrjala,
	Daniel Stone, Xaver Hugl, Harry Wentland, Simona Vetter,
	Alex Deucher, Maarten Lankhorst, Maxime Ripard, dri-devel,
	linux-kernel, amd-gfx, Leo Li, Christian König, David Airlie,
	Rodrigo Siqueira, Xinhui Pan, dmitry.baryshkov

On Mon Nov 4, 2024 at 12:52 PM PST, André Almeida wrote:
> Hi Christopher,
>
> Em 03/11/2024 03:36, Christopher Snowhill escreveu:
> > On Fri Nov 1, 2024 at 11:23 AM PDT, André Almeida wrote:
> >> Currently, DRM atomic uAPI allows only primary planes to be flipped
> >> asynchronously. However, each driver might be able to perform async
> >> flips in other different plane types. To enable drivers to set their own
> >> restrictions on which type of plane they can or cannot flip, use the
> >> existing atomic_async_check() from struct drm_plane_helper_funcs to
> >> enhance this flexibility, thus allowing different plane types to be able
> >> to do async flips as well.
> >>
> >> In order to prevent regressions and such, we keep the current policy: we
> >> skip the driver check for the primary plane, because it is always
> >> allowed to do async flips on it.
> >>
> >> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> > 
> > Should I do a R-b too? 
>
> If you can review the code, it's always really appreciated.

I mean, I did review your changes, they looked good to me. I just didn't
know the protocol for reporting review in addition to testing.

>
> > The changes looked sound enough for me to feel
> > like testing it as well. Tested Borderlands Game of the Year Enhanced on
> > my RX 7700 XT at maximum settings at 1080p165, and the tearing support in
> > labwc allowed it to reach over 700fps. No problems from the hardware
> > cursor.
>
> Thanks for testing and reporting!
>
> > 
> > Tested-by: Christopher Snowhill <chris@kode54.net>
> > 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND v9 1/2] drm/atomic: Let drivers decide which planes to async flip
  2024-11-05 10:15       ` Christopher Snowhill
@ 2024-11-05 10:51         ` Dmitry Baryshkov
  2024-11-06  5:04           ` Christopher Snowhill
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Baryshkov @ 2024-11-05 10:51 UTC (permalink / raw)
  To: Christopher Snowhill
  Cc: André Almeida, kernel-dev, Simon Ser, Thomas Zimmermann,
	joshua, ville.syrjala, Daniel Stone, Xaver Hugl, Harry Wentland,
	Simona Vetter, Alex Deucher, Maarten Lankhorst, Maxime Ripard,
	dri-devel, linux-kernel, amd-gfx, Leo Li, Christian König,
	David Airlie, Rodrigo Siqueira, Xinhui Pan

On Tue, 5 Nov 2024 at 10:15, Christopher Snowhill <chris@kode54.net> wrote:
>
> On Mon Nov 4, 2024 at 12:52 PM PST, André Almeida wrote:
> > Hi Christopher,
> >
> > Em 03/11/2024 03:36, Christopher Snowhill escreveu:
> > > On Fri Nov 1, 2024 at 11:23 AM PDT, André Almeida wrote:
> > >> Currently, DRM atomic uAPI allows only primary planes to be flipped
> > >> asynchronously. However, each driver might be able to perform async
> > >> flips in other different plane types. To enable drivers to set their own
> > >> restrictions on which type of plane they can or cannot flip, use the
> > >> existing atomic_async_check() from struct drm_plane_helper_funcs to
> > >> enhance this flexibility, thus allowing different plane types to be able
> > >> to do async flips as well.
> > >>
> > >> In order to prevent regressions and such, we keep the current policy: we
> > >> skip the driver check for the primary plane, because it is always
> > >> allowed to do async flips on it.
> > >>
> > >> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> > >
> > > Should I do a R-b too?
> >
> > If you can review the code, it's always really appreciated.
>
> I mean, I did review your changes, they looked good to me. I just didn't
> know the protocol for reporting review in addition to testing.

Please respond with the R-B tag. Also ideally the Tested-by should
contain the reference to a platform which was used to test it.

>
> >
> > > The changes looked sound enough for me to feel
> > > like testing it as well. Tested Borderlands Game of the Year Enhanced on
> > > my RX 7700 XT at maximum settings at 1080p165, and the tearing support in
> > > labwc allowed it to reach over 700fps. No problems from the hardware
> > > cursor.
> >
> > Thanks for testing and reporting!
> >
> > >
> > > Tested-by: Christopher Snowhill <chris@kode54.net>
> > >
>


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND v9 1/2] drm/atomic: Let drivers decide which planes to async flip
  2024-11-05 10:51         ` Dmitry Baryshkov
@ 2024-11-06  5:04           ` Christopher Snowhill
  0 siblings, 0 replies; 11+ messages in thread
From: Christopher Snowhill @ 2024-11-06  5:04 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: André Almeida, kernel-dev, Simon Ser, Thomas Zimmermann,
	joshua, ville.syrjala, Daniel Stone, Xaver Hugl, Harry Wentland,
	Simona Vetter, Alex Deucher, Maarten Lankhorst, Maxime Ripard,
	dri-devel, linux-kernel, amd-gfx, Leo Li, Christian König,
	David Airlie, Rodrigo Siqueira, Xinhui Pan

On Tue Nov 5, 2024 at 2:51 AM PST, Dmitry Baryshkov wrote:
> On Tue, 5 Nov 2024 at 10:15, Christopher Snowhill <chris@kode54.net> wrote:
> >
> > On Mon Nov 4, 2024 at 12:52 PM PST, André Almeida wrote:
> > > Hi Christopher,
> > >
> > > Em 03/11/2024 03:36, Christopher Snowhill escreveu:
> > > > On Fri Nov 1, 2024 at 11:23 AM PDT, André Almeida wrote:
> > > >> Currently, DRM atomic uAPI allows only primary planes to be flipped
> > > >> asynchronously. However, each driver might be able to perform async
> > > >> flips in other different plane types. To enable drivers to set their own
> > > >> restrictions on which type of plane they can or cannot flip, use the
> > > >> existing atomic_async_check() from struct drm_plane_helper_funcs to
> > > >> enhance this flexibility, thus allowing different plane types to be able
> > > >> to do async flips as well.
> > > >>
> > > >> In order to prevent regressions and such, we keep the current policy: we
> > > >> skip the driver check for the primary plane, because it is always
> > > >> allowed to do async flips on it.
> > > >>
> > > >> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> > > >
> > > > Should I do a R-b too?
> > >
> > > If you can review the code, it's always really appreciated.
> >
> > I mean, I did review your changes, they looked good to me. I just didn't
> > know the protocol for reporting review in addition to testing.
>
> Please respond with the R-B tag. Also ideally the Tested-by should
> contain the reference to a platform which was used to test it.
>
> >
> > >
> > > > The changes looked sound enough for me to feel
> > > > like testing it as well. Tested Borderlands Game of the Year Enhanced on
> > > > my RX 7700 XT at maximum settings at 1080p165, and the tearing support in
> > > > labwc allowed it to reach over 700fps. No problems from the hardware
> > > > cursor.
> > >
> > > Thanks for testing and reporting!
> > >
> > > >
> > > > Tested-by: Christopher Snowhill <chris@kode54.net>
> > > >
> >

Reviewed-by: Christopher Snowhill <chris@kode54.net>
Tested-by: Christopher Snowhill <chris@kode54.net> on Radeon RX 7700 XT
using labwc-git

(I must admit, the documents do not make it clear what format the
Testing-by tag should take, or how to append which hardware it was
tested on, etc.)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND v9 2/2] drm/amdgpu: Enable async flip on overlay planes
  2024-11-01 18:23 ` [PATCH RESEND v9 2/2] drm/amdgpu: Enable async flip on overlay planes André Almeida
@ 2024-11-11 21:10   ` Harry Wentland
  2024-11-12 16:44     ` André Almeida
  0 siblings, 1 reply; 11+ messages in thread
From: Harry Wentland @ 2024-11-11 21:10 UTC (permalink / raw)
  To: André Almeida, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König, Xinhui Pan,
	dmitry.baryshkov, Simon Ser, joshua, Xaver Hugl, Daniel Stone,
	ville.syrjala
  Cc: kernel-dev, dri-devel, linux-kernel, amd-gfx

On 2024-11-01 14:23, André Almeida wrote:
> amdgpu can handle async flips on overlay planes, so allow it for atomic
> async checks.
> 
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> 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 495e3cd70426db0182cb2811bc6d5d09f52f8a4b..4c6aed5ca777d76245f5f2865046f0f598be342a 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
> @@ -1266,8 +1266,7 @@ static int amdgpu_dm_plane_atomic_async_check(struct drm_plane *plane,
>  	struct drm_plane_state *new_plane_state;
>  	struct dm_crtc_state *dm_new_crtc_state;
>  
> -	/* Only support async updates on cursor planes. */
> -	if (plane->type != DRM_PLANE_TYPE_CURSOR)
> +	if (plane->type != DRM_PLANE_TYPE_CURSOR && plane->type != DRM_PLANE_TYPE_OVERLAY)

This wouldn't just be called for flips, though, but could also be
called for updates on a plane, right? Those could cause for problems.

There's also nothing special about OVERLAY vs PRIMARY planes, other
than that amdgpu needs a PRIMARY plane, IIRC. So updates on PRIMARY
planes should also work (or not).

Maybe this should check that we're actually dealing with a simple
flip, i.e., a simple surface address update.

Harry

>  		return -EINVAL;
>  
>  	new_plane_state = drm_atomic_get_new_plane_state(state, plane);
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH RESEND v9 2/2] drm/amdgpu: Enable async flip on overlay planes
  2024-11-11 21:10   ` Harry Wentland
@ 2024-11-12 16:44     ` André Almeida
  0 siblings, 0 replies; 11+ messages in thread
From: André Almeida @ 2024-11-12 16:44 UTC (permalink / raw)
  To: Harry Wentland
  Cc: kernel-dev, Daniel Stone, Xaver Hugl, Christian König,
	David Airlie, Xinhui Pan, joshua, Leo Li, Maxime Ripard,
	Simon Ser, dmitry.baryshkov, Rodrigo Siqueira, Maarten Lankhorst,
	dri-devel, linux-kernel, amd-gfx, ville.syrjala, Alex Deucher,
	Thomas Zimmermann, Simona Vetter

Hi Harry, thanks for the reply!

Em 11/11/2024 18:10, Harry Wentland escreveu:
> On 2024-11-01 14:23, André Almeida wrote:
>> amdgpu can handle async flips on overlay planes, so allow it for atomic
>> async checks.
>>
>> Signed-off-by: André Almeida <andrealmeid@igalia.com>
>> ---
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> 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 495e3cd70426db0182cb2811bc6d5d09f52f8a4b..4c6aed5ca777d76245f5f2865046f0f598be342a 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
>> @@ -1266,8 +1266,7 @@ static int amdgpu_dm_plane_atomic_async_check(struct drm_plane *plane,
>>   	struct drm_plane_state *new_plane_state;
>>   	struct dm_crtc_state *dm_new_crtc_state;
>>   
>> -	/* Only support async updates on cursor planes. */
>> -	if (plane->type != DRM_PLANE_TYPE_CURSOR)
>> +	if (plane->type != DRM_PLANE_TYPE_CURSOR && plane->type != DRM_PLANE_TYPE_OVERLAY)
> 
> This wouldn't just be called for flips, though, but could also be
> called for updates on a plane, right? Those could cause for problems.
> 

I see, I think you are right and can be called from a non-flip commmit.

> There's also nothing special about OVERLAY vs PRIMARY planes, other
> than that amdgpu needs a PRIMARY plane, IIRC. So updates on PRIMARY
> planes should also work (or not).
> 

Right, the PRIMARY plane type is already supported for every DRM driver 
in the API so I didn't explicitly added it here.

> Maybe this should check that we're actually dealing with a simple
> flip, i.e., a simple surface address update.
> 

Right, that makes sense to me, thanks!

> Harry
> 
>>   		return -EINVAL;
>>   
>>   	new_plane_state = drm_atomic_get_new_plane_state(state, plane);
>>
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-11-12 16:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-01 18:23 [PATCH RESEND v9 0/2] drm/atomic: Ease async flip restrictions André Almeida
2024-11-01 18:23 ` [PATCH RESEND v9 1/2] drm/atomic: Let drivers decide which planes to async flip André Almeida
2024-11-03  4:10   ` Dmitry Baryshkov
2024-11-03  6:36   ` Christopher Snowhill
2024-11-04 20:52     ` André Almeida
2024-11-05 10:15       ` Christopher Snowhill
2024-11-05 10:51         ` Dmitry Baryshkov
2024-11-06  5:04           ` Christopher Snowhill
2024-11-01 18:23 ` [PATCH RESEND v9 2/2] drm/amdgpu: Enable async flip on overlay planes André Almeida
2024-11-11 21:10   ` Harry Wentland
2024-11-12 16:44     ` André Almeida

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox