* [PATCH v6 0/8] drm: Support per-plane async flip configuration
@ 2024-06-14 15:35 André Almeida
2024-06-14 15:35 ` [PATCH v6 1/8] drm/atomic: Allow userspace to use explicit sync with atomic async flips André Almeida
` (8 more replies)
0 siblings, 9 replies; 15+ messages in thread
From: André Almeida @ 2024-06-14 15:35 UTC (permalink / raw)
To: dri-devel, amd-gfx, linux-kernel, linux-arm-kernel, nouveau,
intel-gfx
Cc: Alexandre Belloni, 'Marek Olšák',
Claudiu Beznea, André Almeida, Sam Ravnborg, ville.syrjala,
Karol Herbst, Michel Dänzer, Dave Airlie, Daniel Stone,
kernel-dev, Lyude Paul, Thomas Zimmermann, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, Boris Brezillon, Simon Ser, Xaver Hugl, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
AMD hardware can do async flips with overlay planes, but currently there's no
easy way to enable that in DRM. To solve that, this patchset creates a new
drm_plane field, bool async_flip, that allows drivers to choose which plane can
or cannot do async flips. This is latter used on drm_atomic_set_property when
users want to do async flips.
Patch 1 allows async commits with IN_FENCE_ID in any driver.
Patches 2 to 7 have no function change. As per current code, every driver that
allows async page flips using the atomic API, allows doing it only in the
primary plane. Those patches then enable it for every driver.
Patch 8 finally enables async flip on overlay planes for amdgpu.
Changes from v5:
- Instead of enabling plane->async_flip in the common code, move it to driver
code.
- Enable primary plane async flip on every driver
https://lore.kernel.org/dri-devel/20240612193713.167448-1-andrealmeid@igalia.com/
André Almeida (8):
drm/atomic: Allow userspace to use explicit sync with atomic async
flips
drm: Support per-plane async flip configuration
drm/amdgpu: Enable async flips on the primary plane
drm: atmel-hlcdc: Enable async flips on the primary plane
drm/i915: Enable async flips on the primary plane
drm/nouveau: Enable async flips on the primary plane
drm/vc4: Enable async flips on the primary plane
drm/amdgpu: Make it possible to async flip overlay planes
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 2 ++
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 3 +++
drivers/gpu/drm/drm_atomic_uapi.c | 8 +++++---
drivers/gpu/drm/i915/display/i9xx_plane.c | 3 +++
drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++++
drivers/gpu/drm/nouveau/dispnv50/wndw.c | 4 ++++
drivers/gpu/drm/vc4/vc4_plane.c | 4 +++-
include/drm/drm_plane.h | 5 +++++
8 files changed, 29 insertions(+), 4 deletions(-)
--
2.45.2
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v6 1/8] drm/atomic: Allow userspace to use explicit sync with atomic async flips
2024-06-14 15:35 [PATCH v6 0/8] drm: Support per-plane async flip configuration André Almeida
@ 2024-06-14 15:35 ` André Almeida
2024-06-14 15:35 ` [PATCH v6 2/8] drm: Support per-plane async flip configuration André Almeida
` (7 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: André Almeida @ 2024-06-14 15:35 UTC (permalink / raw)
To: dri-devel, amd-gfx, linux-kernel, linux-arm-kernel, nouveau,
intel-gfx
Cc: Alexandre Belloni, 'Marek Olšák',
Claudiu Beznea, André Almeida, Sam Ravnborg, ville.syrjala,
Karol Herbst, Michel Dänzer, Dave Airlie, Daniel Stone,
kernel-dev, Lyude Paul, Thomas Zimmermann, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, Boris Brezillon, Simon Ser, Xaver Hugl, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
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 <andrealmeid@igalia.com>
---
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 22bbb2d83e30..2e1d9391febe 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -1070,7 +1070,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);
--
2.45.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 2/8] drm: Support per-plane async flip configuration
2024-06-14 15:35 [PATCH v6 0/8] drm: Support per-plane async flip configuration André Almeida
2024-06-14 15:35 ` [PATCH v6 1/8] drm/atomic: Allow userspace to use explicit sync with atomic async flips André Almeida
@ 2024-06-14 15:35 ` André Almeida
2024-06-14 17:32 ` Dmitry Baryshkov
2024-06-14 15:35 ` [PATCH v6 3/8] drm/amdgpu: Enable async flips on the primary plane André Almeida
` (6 subsequent siblings)
8 siblings, 1 reply; 15+ messages in thread
From: André Almeida @ 2024-06-14 15:35 UTC (permalink / raw)
To: dri-devel, amd-gfx, linux-kernel, linux-arm-kernel, nouveau,
intel-gfx
Cc: Alexandre Belloni, 'Marek Olšák',
Claudiu Beznea, André Almeida, Sam Ravnborg, ville.syrjala,
Karol Herbst, Michel Dänzer, Dave Airlie, Daniel Stone,
kernel-dev, Lyude Paul, Thomas Zimmermann, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, Boris Brezillon, Simon Ser, Xaver Hugl, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
Drivers have different capabilities on what plane types they can or
cannot perform async flips. Create a plane::async_flip field so each
driver can choose which planes they allow doing async flips.
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
drivers/gpu/drm/drm_atomic_uapi.c | 4 ++--
include/drm/drm_plane.h | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 2e1d9391febe..ed1af3455477 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -1079,9 +1079,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->async_flip) {
drm_dbg_atomic(prop->dev,
- "[OBJECT:%d] Only primary planes can be changed during async flip\n",
+ "[PLANE:%d] does not support async flips\n",
obj->id);
ret = -EINVAL;
break;
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 9507542121fa..0bebc72af5c3 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -786,6 +786,11 @@ struct drm_plane {
* @kmsg_panic: Used to register a panic notifier for this plane
*/
struct kmsg_dumper kmsg_panic;
+
+ /**
+ * @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)
--
2.45.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 3/8] drm/amdgpu: Enable async flips on the primary plane
2024-06-14 15:35 [PATCH v6 0/8] drm: Support per-plane async flip configuration André Almeida
2024-06-14 15:35 ` [PATCH v6 1/8] drm/atomic: Allow userspace to use explicit sync with atomic async flips André Almeida
2024-06-14 15:35 ` [PATCH v6 2/8] drm: Support per-plane async flip configuration André Almeida
@ 2024-06-14 15:35 ` André Almeida
2024-06-14 15:35 ` [PATCH v6 4/8] drm: atmel-hlcdc: " André Almeida
` (5 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: André Almeida @ 2024-06-14 15:35 UTC (permalink / raw)
To: dri-devel, amd-gfx, linux-kernel, linux-arm-kernel, nouveau,
intel-gfx
Cc: Alexandre Belloni, 'Marek Olšák',
Claudiu Beznea, André Almeida, Sam Ravnborg, ville.syrjala,
Karol Herbst, Michel Dänzer, Dave Airlie, Daniel Stone,
kernel-dev, Lyude Paul, Thomas Zimmermann, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, Boris Brezillon, Simon Ser, Xaver Hugl, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
This driver can perfom async flips on primary planes, so enable it.
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
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..0c126c5609d3 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
@@ -1705,6 +1705,7 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
drm_plane_create_zpos_immutable_property(plane, 0);
+ plane->async_flip = true;
} 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);
--
2.45.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 4/8] drm: atmel-hlcdc: Enable async flips on the primary plane
2024-06-14 15:35 [PATCH v6 0/8] drm: Support per-plane async flip configuration André Almeida
` (2 preceding siblings ...)
2024-06-14 15:35 ` [PATCH v6 3/8] drm/amdgpu: Enable async flips on the primary plane André Almeida
@ 2024-06-14 15:35 ` André Almeida
2024-06-14 15:35 ` [PATCH v6 5/8] drm/i915: " André Almeida
` (4 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: André Almeida @ 2024-06-14 15:35 UTC (permalink / raw)
To: dri-devel, amd-gfx, linux-kernel, linux-arm-kernel, nouveau,
intel-gfx
Cc: Alexandre Belloni, 'Marek Olšák',
Claudiu Beznea, André Almeida, Sam Ravnborg, ville.syrjala,
Karol Herbst, Michel Dänzer, Dave Airlie, Daniel Stone,
kernel-dev, Lyude Paul, Thomas Zimmermann, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, Boris Brezillon, Simon Ser, Xaver Hugl, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
This driver can perfom async flips on primary planes, so enable it.
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 4a7ba0918eca..22b8a5c888ef 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -1227,6 +1227,9 @@ static int atmel_hlcdc_plane_create(struct drm_device *dev,
if (ret)
return ret;
+ if (type == DRM_PLANE_TYPE_PRIMARY)
+ plane->base.async_flip = true;
+
drm_plane_helper_add(&plane->base,
&atmel_hlcdc_layer_plane_helper_funcs);
--
2.45.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 5/8] drm/i915: Enable async flips on the primary plane
2024-06-14 15:35 [PATCH v6 0/8] drm: Support per-plane async flip configuration André Almeida
` (3 preceding siblings ...)
2024-06-14 15:35 ` [PATCH v6 4/8] drm: atmel-hlcdc: " André Almeida
@ 2024-06-14 15:35 ` André Almeida
2024-06-14 19:00 ` Rodrigo Vivi
2024-06-14 15:35 ` [PATCH v6 6/8] drm/nouveau: " André Almeida
` (3 subsequent siblings)
8 siblings, 1 reply; 15+ messages in thread
From: André Almeida @ 2024-06-14 15:35 UTC (permalink / raw)
To: dri-devel, amd-gfx, linux-kernel, linux-arm-kernel, nouveau,
intel-gfx
Cc: Alexandre Belloni, 'Marek Olšák',
Claudiu Beznea, André Almeida, Sam Ravnborg, ville.syrjala,
Karol Herbst, Michel Dänzer, Dave Airlie, Daniel Stone,
kernel-dev, Lyude Paul, Thomas Zimmermann, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, Boris Brezillon, Simon Ser, Xaver Hugl, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
This driver can perfom async flips on primary planes, so enable it.
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
drivers/gpu/drm/i915/display/i9xx_plane.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/i9xx_plane.c b/drivers/gpu/drm/i915/display/i9xx_plane.c
index 0279c8aabdd1..0142beef20dc 100644
--- a/drivers/gpu/drm/i915/display/i9xx_plane.c
+++ b/drivers/gpu/drm/i915/display/i9xx_plane.c
@@ -931,6 +931,9 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
intel_plane_helper_add(plane);
+ if (plane->async_flip)
+ plane->base.async_flip = true;
+
return plane;
fail:
--
2.45.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 6/8] drm/nouveau: Enable async flips on the primary plane
2024-06-14 15:35 [PATCH v6 0/8] drm: Support per-plane async flip configuration André Almeida
` (4 preceding siblings ...)
2024-06-14 15:35 ` [PATCH v6 5/8] drm/i915: " André Almeida
@ 2024-06-14 15:35 ` André Almeida
2024-06-14 15:35 ` [PATCH v6 7/8] drm/vc4: " André Almeida
` (2 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: André Almeida @ 2024-06-14 15:35 UTC (permalink / raw)
To: dri-devel, amd-gfx, linux-kernel, linux-arm-kernel, nouveau,
intel-gfx
Cc: Alexandre Belloni, 'Marek Olšák',
Claudiu Beznea, André Almeida, Sam Ravnborg, ville.syrjala,
Karol Herbst, Michel Dänzer, Dave Airlie, Daniel Stone,
kernel-dev, Lyude Paul, Thomas Zimmermann, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, Boris Brezillon, Simon Ser, Xaver Hugl, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
This driver can perfom async flips on primary planes, so enable it.
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++++
drivers/gpu/drm/nouveau/dispnv50/wndw.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 4310ad71870b..fd06d46d49ec 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1285,6 +1285,7 @@ int
nv04_crtc_create(struct drm_device *dev, int crtc_num)
{
struct nouveau_display *disp = nouveau_display(dev);
+ struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_crtc *nv_crtc;
struct drm_plane *primary;
int ret;
@@ -1338,6 +1339,9 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num)
if (ret)
return ret;
+ if (drm->client.device.info.chipset >= 0x11)
+ primary->async_flip = true;
+
return nvif_head_vblank_event_ctor(&nv_crtc->head, "kmsVbl", nv04_crtc_vblank_handler,
false, &nv_crtc->vblank);
}
diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.c b/drivers/gpu/drm/nouveau/dispnv50/wndw.c
index 7a2cceaee6e9..55db0fdf61e7 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/wndw.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.c
@@ -763,6 +763,10 @@ nv50_wndw_new_(const struct nv50_wndw_func *func, struct drm_device *dev,
return ret;
}
+ if (type == DRM_PLANE_TYPE_PRIMARY &&
+ drm->client.device.info.chipset >= 0x11)
+ wndw->plane.async_flip = true;
+
return 0;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 7/8] drm/vc4: Enable async flips on the primary plane
2024-06-14 15:35 [PATCH v6 0/8] drm: Support per-plane async flip configuration André Almeida
` (5 preceding siblings ...)
2024-06-14 15:35 ` [PATCH v6 6/8] drm/nouveau: " André Almeida
@ 2024-06-14 15:35 ` André Almeida
2024-06-14 15:35 ` [PATCH v6 8/8] drm/amdgpu: Make it possible to async flip overlay planes André Almeida
2024-06-14 17:32 ` [PATCH v6 0/8] drm: Support per-plane async flip configuration Dmitry Baryshkov
8 siblings, 0 replies; 15+ messages in thread
From: André Almeida @ 2024-06-14 15:35 UTC (permalink / raw)
To: dri-devel, amd-gfx, linux-kernel, linux-arm-kernel, nouveau,
intel-gfx
Cc: Alexandre Belloni, 'Marek Olšák',
Claudiu Beznea, André Almeida, Sam Ravnborg, ville.syrjala,
Karol Herbst, Michel Dänzer, Dave Airlie, Daniel Stone,
kernel-dev, Lyude Paul, Thomas Zimmermann, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, Boris Brezillon, Simon Ser, Xaver Hugl, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
This driver can perfom async flips on primary planes, so enable it.
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
drivers/gpu/drm/vc4/vc4_plane.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 07caf2a47c6c..e3d41da14e6f 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -1672,8 +1672,10 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev,
DRM_COLOR_YCBCR_BT709,
DRM_COLOR_YCBCR_LIMITED_RANGE);
- if (type == DRM_PLANE_TYPE_PRIMARY)
+ if (type == DRM_PLANE_TYPE_PRIMARY) {
drm_plane_create_zpos_immutable_property(plane, 0);
+ plane->async_flip = true;
+ }
return plane;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 8/8] drm/amdgpu: Make it possible to async flip overlay planes
2024-06-14 15:35 [PATCH v6 0/8] drm: Support per-plane async flip configuration André Almeida
` (6 preceding siblings ...)
2024-06-14 15:35 ` [PATCH v6 7/8] drm/vc4: " André Almeida
@ 2024-06-14 15:35 ` André Almeida
2024-06-14 17:32 ` [PATCH v6 0/8] drm: Support per-plane async flip configuration Dmitry Baryshkov
8 siblings, 0 replies; 15+ messages in thread
From: André Almeida @ 2024-06-14 15:35 UTC (permalink / raw)
To: dri-devel, amd-gfx, linux-kernel, linux-arm-kernel, nouveau,
intel-gfx
Cc: Alexandre Belloni, 'Marek Olšák',
Claudiu Beznea, André Almeida, Sam Ravnborg, ville.syrjala,
Karol Herbst, Michel Dänzer, Dave Airlie, Daniel Stone,
kernel-dev, Lyude Paul, Thomas Zimmermann, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, Boris Brezillon, Simon Ser, Xaver Hugl, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
amdgpu can handle async flips on overlay planes, so mark it as true
during the plane initialization.
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
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 0c126c5609d3..7d508d816f0d 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
@@ -1709,6 +1709,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);
}
--
2.45.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v6 2/8] drm: Support per-plane async flip configuration
2024-06-14 15:35 ` [PATCH v6 2/8] drm: Support per-plane async flip configuration André Almeida
@ 2024-06-14 17:32 ` Dmitry Baryshkov
2024-06-14 19:45 ` André Almeida
0 siblings, 1 reply; 15+ messages in thread
From: Dmitry Baryshkov @ 2024-06-14 17:32 UTC (permalink / raw)
To: André Almeida
Cc: Alexandre Belloni, 'Marek Olšák', nouveau,
dri-devel, Xaver Hugl, Daniel Stone, Claudiu Beznea, Sam Ravnborg,
ville.syrjala, Karol Herbst, Michel Dänzer, Dave Airlie,
amd-gfx, Lyude Paul, kernel-dev, intel-gfx, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, linux-arm-kernel, Thomas Zimmermann,
Boris Brezillon, Simon Ser, linux-kernel, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
On Fri, Jun 14, 2024 at 12:35:29PM GMT, André Almeida wrote:
> Drivers have different capabilities on what plane types they can or
> cannot perform async flips. Create a plane::async_flip field so each
> driver can choose which planes they allow doing async flips.
>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> ---
> drivers/gpu/drm/drm_atomic_uapi.c | 4 ++--
> include/drm/drm_plane.h | 5 +++++
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 2e1d9391febe..ed1af3455477 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -1079,9 +1079,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->async_flip) {
So, after this patch async flips becomes disabled until the driver
enables that manually. Whether that's desired or not is a separate
topic, but this definitely should be explicitly mentioned in the commit
message.
> drm_dbg_atomic(prop->dev,
> - "[OBJECT:%d] Only primary planes can be changed during async flip\n",
> + "[PLANE:%d] does not support async flips\n",
> obj->id);
> ret = -EINVAL;
> break;
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index 9507542121fa..0bebc72af5c3 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -786,6 +786,11 @@ struct drm_plane {
> * @kmsg_panic: Used to register a panic notifier for this plane
> */
> struct kmsg_dumper kmsg_panic;
> +
> + /**
> + * @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)
> --
> 2.45.2
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 0/8] drm: Support per-plane async flip configuration
2024-06-14 15:35 [PATCH v6 0/8] drm: Support per-plane async flip configuration André Almeida
` (7 preceding siblings ...)
2024-06-14 15:35 ` [PATCH v6 8/8] drm/amdgpu: Make it possible to async flip overlay planes André Almeida
@ 2024-06-14 17:32 ` Dmitry Baryshkov
2024-06-14 19:37 ` André Almeida
8 siblings, 1 reply; 15+ messages in thread
From: Dmitry Baryshkov @ 2024-06-14 17:32 UTC (permalink / raw)
To: André Almeida
Cc: Alexandre Belloni, 'Marek Olšák', nouveau,
dri-devel, Xaver Hugl, Daniel Stone, Claudiu Beznea, Sam Ravnborg,
ville.syrjala, Karol Herbst, Michel Dänzer, Dave Airlie,
amd-gfx, Lyude Paul, kernel-dev, intel-gfx, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, linux-arm-kernel, Thomas Zimmermann,
Boris Brezillon, Simon Ser, linux-kernel, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
On Fri, Jun 14, 2024 at 12:35:27PM GMT, André Almeida wrote:
> AMD hardware can do async flips with overlay planes, but currently there's no
> easy way to enable that in DRM. To solve that, this patchset creates a new
> drm_plane field, bool async_flip, that allows drivers to choose which plane can
> or cannot do async flips. This is latter used on drm_atomic_set_property when
> users want to do async flips.
>
> Patch 1 allows async commits with IN_FENCE_ID in any driver.
>
> Patches 2 to 7 have no function change. As per current code, every driver that
> allows async page flips using the atomic API, allows doing it only in the
> primary plane. Those patches then enable it for every driver.
>
> Patch 8 finally enables async flip on overlay planes for amdgpu.
>
> Changes from v5:
> - Instead of enabling plane->async_flip in the common code, move it to driver
> code.
> - Enable primary plane async flip on every driver
> https://lore.kernel.org/dri-devel/20240612193713.167448-1-andrealmeid@igalia.com/
>
> André Almeida (8):
> drm/atomic: Allow userspace to use explicit sync with atomic async
> flips
> drm: Support per-plane async flip configuration
> drm/amdgpu: Enable async flips on the primary plane
> drm: atmel-hlcdc: Enable async flips on the primary plane
> drm/i915: Enable async flips on the primary plane
> drm/nouveau: Enable async flips on the primary plane
> drm/vc4: Enable async flips on the primary plane
> drm/amdgpu: Make it possible to async flip overlay planes
>
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 2 ++
> drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 3 +++
> drivers/gpu/drm/drm_atomic_uapi.c | 8 +++++---
> drivers/gpu/drm/i915/display/i9xx_plane.c | 3 +++
> drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++++
> drivers/gpu/drm/nouveau/dispnv50/wndw.c | 4 ++++
> drivers/gpu/drm/vc4/vc4_plane.c | 4 +++-
The main question is why only these drivers were updated.
> include/drm/drm_plane.h | 5 +++++
> 8 files changed, 29 insertions(+), 4 deletions(-)
>
> --
> 2.45.2
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 5/8] drm/i915: Enable async flips on the primary plane
2024-06-14 15:35 ` [PATCH v6 5/8] drm/i915: " André Almeida
@ 2024-06-14 19:00 ` Rodrigo Vivi
0 siblings, 0 replies; 15+ messages in thread
From: Rodrigo Vivi @ 2024-06-14 19:00 UTC (permalink / raw)
To: André Almeida, Ville Syrjälä, naveen1.kumar,
vandita.kulkarni
Cc: Alexandre Belloni, 'Marek Olšák', nouveau,
dri-devel, Xaver Hugl, Daniel Stone, Claudiu Beznea, Sam Ravnborg,
ville.syrjala, Karol Herbst, Michel Dänzer, Dave Airlie,
amd-gfx, Lyude Paul, kernel-dev, intel-gfx, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
linux-arm-kernel, Thomas Zimmermann, Boris Brezillon, Simon Ser,
linux-kernel, daniel, alexander.deucher, christian.koenig,
Joshua Ashton
On Fri, Jun 14, 2024 at 12:35:32PM -0300, André Almeida wrote:
> This driver can perfom async flips on primary planes, so enable it.
>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Naveen Kumar <naveen1.kumar@intel.com>
c: Vandita Kulkarni <vandita.kulkarni@intel.com>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> ---
> drivers/gpu/drm/i915/display/i9xx_plane.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/i9xx_plane.c b/drivers/gpu/drm/i915/display/i9xx_plane.c
> index 0279c8aabdd1..0142beef20dc 100644
> --- a/drivers/gpu/drm/i915/display/i9xx_plane.c
> +++ b/drivers/gpu/drm/i915/display/i9xx_plane.c
> @@ -931,6 +931,9 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
>
> intel_plane_helper_add(plane);
>
> + if (plane->async_flip)
> + plane->base.async_flip = true;
I believe this is not enough and besides this we would also need to have
in the:
skl_universal_plane_create[2447] plane->async_flip = skl_plane_async_flip;
at: drivers/gpu/drm/i915/display/skl_universal_plane.c
> +
> return plane;
>
> fail:
> --
> 2.45.2
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 0/8] drm: Support per-plane async flip configuration
2024-06-14 17:32 ` [PATCH v6 0/8] drm: Support per-plane async flip configuration Dmitry Baryshkov
@ 2024-06-14 19:37 ` André Almeida
2024-06-19 11:57 ` Ville Syrjälä
0 siblings, 1 reply; 15+ messages in thread
From: André Almeida @ 2024-06-14 19:37 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Alexandre Belloni, 'Marek Olšák', nouveau,
dri-devel, Xaver Hugl, Daniel Stone, Claudiu Beznea, Sam Ravnborg,
ville.syrjala, Karol Herbst, Michel Dänzer, Dave Airlie,
amd-gfx, Lyude Paul, kernel-dev, intel-gfx, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, linux-arm-kernel, Thomas Zimmermann,
Boris Brezillon, Simon Ser, linux-kernel, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
Hi Dmitry,
Em 14/06/2024 14:32, Dmitry Baryshkov escreveu:
> On Fri, Jun 14, 2024 at 12:35:27PM GMT, André Almeida wrote:
>> AMD hardware can do async flips with overlay planes, but currently there's no
>> easy way to enable that in DRM. To solve that, this patchset creates a new
>> drm_plane field, bool async_flip, that allows drivers to choose which plane can
>> or cannot do async flips. This is latter used on drm_atomic_set_property when
>> users want to do async flips.
>>
>> Patch 1 allows async commits with IN_FENCE_ID in any driver.
>>
>> Patches 2 to 7 have no function change. As per current code, every driver that
>> allows async page flips using the atomic API, allows doing it only in the
>> primary plane. Those patches then enable it for every driver.
>>
>> Patch 8 finally enables async flip on overlay planes for amdgpu.
>>
>> Changes from v5:
>> - Instead of enabling plane->async_flip in the common code, move it to driver
>> code.
>> - Enable primary plane async flip on every driver
>> https://lore.kernel.org/dri-devel/20240612193713.167448-1-andrealmeid@igalia.com/
>>
>> André Almeida (8):
>> drm/atomic: Allow userspace to use explicit sync with atomic async
>> flips
>> drm: Support per-plane async flip configuration
>> drm/amdgpu: Enable async flips on the primary plane
>> drm: atmel-hlcdc: Enable async flips on the primary plane
>> drm/i915: Enable async flips on the primary plane
>> drm/nouveau: Enable async flips on the primary plane
>> drm/vc4: Enable async flips on the primary plane
>> drm/amdgpu: Make it possible to async flip overlay planes
>>
>> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 2 ++
>> drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 3 +++
>> drivers/gpu/drm/drm_atomic_uapi.c | 8 +++++---
>> drivers/gpu/drm/i915/display/i9xx_plane.c | 3 +++
>> drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++++
>> drivers/gpu/drm/nouveau/dispnv50/wndw.c | 4 ++++
>> drivers/gpu/drm/vc4/vc4_plane.c | 4 +++-
>
> The main question is why only these drivers were updated.
>
According to `git grep async_page_flip`, only those drivers supports
async page flip. The only corner case is radeon, that does supports
async but doesn't support planes.
Do you know any other driver that should be updated to?
>> include/drm/drm_plane.h | 5 +++++
>> 8 files changed, 29 insertions(+), 4 deletions(-)
>>
>> --
>> 2.45.2
>>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 2/8] drm: Support per-plane async flip configuration
2024-06-14 17:32 ` Dmitry Baryshkov
@ 2024-06-14 19:45 ` André Almeida
0 siblings, 0 replies; 15+ messages in thread
From: André Almeida @ 2024-06-14 19:45 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Alexandre Belloni, 'Marek Olšák', nouveau,
dri-devel, Xaver Hugl, Daniel Stone, Claudiu Beznea, Sam Ravnborg,
ville.syrjala, Karol Herbst, Michel Dänzer, Dave Airlie,
amd-gfx, Lyude Paul, kernel-dev, intel-gfx, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Pekka Paalanen, Jani Nikula,
Rodrigo Vivi, linux-arm-kernel, Thomas Zimmermann,
Boris Brezillon, Simon Ser, linux-kernel, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
Em 14/06/2024 14:32, Dmitry Baryshkov escreveu:> On Fri, Jun 14, 2024 at
12:35:29PM GMT, André Almeida wrote:
>> Drivers have different capabilities on what plane types they can or
>> cannot perform async flips. Create a plane::async_flip field so each
>> driver can choose which planes they allow doing async flips.
>>
>> Signed-off-by: André Almeida <andrealmeid@igalia.com>
>> ---
>> drivers/gpu/drm/drm_atomic_uapi.c | 4 ++--
>> include/drm/drm_plane.h | 5 +++++
>> 2 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c
b/drivers/gpu/drm/drm_atomic_uapi.c
>> index 2e1d9391febe..ed1af3455477 100644
>> --- a/drivers/gpu/drm/drm_atomic_uapi.c
>> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
>> @@ -1079,9 +1079,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->async_flip) {
>
> So, after this patch async flips becomes disabled until the driver
> enables that manually. Whether that's desired or not is a separate
> topic, but this definitely should be explicitly mentioned in the commit
> message.
>
You are right, I think I should separate this in the last commit, so we
don't have any regression commits. Thanks for the feedback
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 0/8] drm: Support per-plane async flip configuration
2024-06-14 19:37 ` André Almeida
@ 2024-06-19 11:57 ` Ville Syrjälä
0 siblings, 0 replies; 15+ messages in thread
From: Ville Syrjälä @ 2024-06-19 11:57 UTC (permalink / raw)
To: André Almeida
Cc: Alexandre Belloni, 'Marek Olšák', nouveau,
dri-devel, Xaver Hugl, Daniel Stone, Claudiu Beznea, Sam Ravnborg,
Karol Herbst, Michel Dänzer, Dave Airlie, amd-gfx,
Lyude Paul, kernel-dev, intel-gfx, Maarten Lankhorst,
Maxime Ripard, Melissa Wen, Dmitry Baryshkov, Pekka Paalanen,
Jani Nikula, Rodrigo Vivi, linux-arm-kernel, Thomas Zimmermann,
Boris Brezillon, Simon Ser, linux-kernel, daniel,
alexander.deucher, christian.koenig, Joshua Ashton
On Fri, Jun 14, 2024 at 04:37:41PM -0300, André Almeida wrote:
> Hi Dmitry,
>
> Em 14/06/2024 14:32, Dmitry Baryshkov escreveu:
> > On Fri, Jun 14, 2024 at 12:35:27PM GMT, André Almeida wrote:
> >> AMD hardware can do async flips with overlay planes, but currently there's no
> >> easy way to enable that in DRM. To solve that, this patchset creates a new
> >> drm_plane field, bool async_flip, that allows drivers to choose which plane can
> >> or cannot do async flips. This is latter used on drm_atomic_set_property when
> >> users want to do async flips.
> >>
> >> Patch 1 allows async commits with IN_FENCE_ID in any driver.
> >>
> >> Patches 2 to 7 have no function change. As per current code, every driver that
> >> allows async page flips using the atomic API, allows doing it only in the
> >> primary plane. Those patches then enable it for every driver.
> >>
> >> Patch 8 finally enables async flip on overlay planes for amdgpu.
> >>
> >> Changes from v5:
> >> - Instead of enabling plane->async_flip in the common code, move it to driver
> >> code.
> >> - Enable primary plane async flip on every driver
> >> https://lore.kernel.org/dri-devel/20240612193713.167448-1-andrealmeid@igalia.com/
> >>
> >> André Almeida (8):
> >> drm/atomic: Allow userspace to use explicit sync with atomic async
> >> flips
> >> drm: Support per-plane async flip configuration
> >> drm/amdgpu: Enable async flips on the primary plane
> >> drm: atmel-hlcdc: Enable async flips on the primary plane
> >> drm/i915: Enable async flips on the primary plane
> >> drm/nouveau: Enable async flips on the primary plane
> >> drm/vc4: Enable async flips on the primary plane
> >> drm/amdgpu: Make it possible to async flip overlay planes
> >>
> >> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 2 ++
> >> drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 3 +++
> >> drivers/gpu/drm/drm_atomic_uapi.c | 8 +++++---
> >> drivers/gpu/drm/i915/display/i9xx_plane.c | 3 +++
> >> drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++++
> >> drivers/gpu/drm/nouveau/dispnv50/wndw.c | 4 ++++
> >> drivers/gpu/drm/vc4/vc4_plane.c | 4 +++-
> >
> > The main question is why only these drivers were updated.
> >
>
> According to `git grep async_page_flip`, only those drivers supports
> async page flip. The only corner case is radeon, that does supports
> async but doesn't support planes.
The primary plane will alwyas exist (drm_crtc_init() will create
one for the old drivers that don't do it explicitly). So you
should be able to convert radeon as well. And looks like some
pre-dc amdgpu stuff is in a similar situation.
That should presumably allow the old flag to be removed entirely?
Hmm, I suppose drm_getcap() would need a bit of work to eg. go
through all the planes to see if any of them support async flips.
>
> Do you know any other driver that should be updated to?
>
> >> include/drm/drm_plane.h | 5 +++++
> >> 8 files changed, 29 insertions(+), 4 deletions(-)
> >>
> >> --
> >> 2.45.2
> >>
> >
--
Ville Syrjälä
Intel
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2024-06-19 11:57 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-14 15:35 [PATCH v6 0/8] drm: Support per-plane async flip configuration André Almeida
2024-06-14 15:35 ` [PATCH v6 1/8] drm/atomic: Allow userspace to use explicit sync with atomic async flips André Almeida
2024-06-14 15:35 ` [PATCH v6 2/8] drm: Support per-plane async flip configuration André Almeida
2024-06-14 17:32 ` Dmitry Baryshkov
2024-06-14 19:45 ` André Almeida
2024-06-14 15:35 ` [PATCH v6 3/8] drm/amdgpu: Enable async flips on the primary plane André Almeida
2024-06-14 15:35 ` [PATCH v6 4/8] drm: atmel-hlcdc: " André Almeida
2024-06-14 15:35 ` [PATCH v6 5/8] drm/i915: " André Almeida
2024-06-14 19:00 ` Rodrigo Vivi
2024-06-14 15:35 ` [PATCH v6 6/8] drm/nouveau: " André Almeida
2024-06-14 15:35 ` [PATCH v6 7/8] drm/vc4: " André Almeida
2024-06-14 15:35 ` [PATCH v6 8/8] drm/amdgpu: Make it possible to async flip overlay planes André Almeida
2024-06-14 17:32 ` [PATCH v6 0/8] drm: Support per-plane async flip configuration Dmitry Baryshkov
2024-06-14 19:37 ` André Almeida
2024-06-19 11:57 ` Ville Syrjälä
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).