dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/3] Expose modifiers/formats supported by async flips
@ 2025-02-19  9:17 Arun R Murthy
  2025-02-19  9:17 ` [PATCH v6 1/3] drm/plane: Add new plane property IN_FORMATS_ASYNC Arun R Murthy
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Arun R Murthy @ 2025-02-19  9:17 UTC (permalink / raw)
  To: dri-devel, intel-gfx, intel-xe
  Cc: chaitanya.kumar.borah, Arun R Murthy, Naveen Kumar,
	Sebastian Brzezinka

All of the formats/modifiers supported by the plane during synchronous
flips are nor supported by asynchronous flips. The formats/modifiers
exposed to user by IN_FORMATS exposes all formats/modifiers supported by
plane and this list varies for async flips. If the async flip supported
formats/modifiers are exposed to the user, user based on this list can
take decision to proceed or not and avoid flip failures during async
flips.
Discussion around this can be located @
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29618#note_2487123
Userspace implementation for IN_FORMARTS_ASYNC under review @
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4063

TODO: Upon merge of the patch related to async flip
https://patchwork.freedesktop.org/patch/626849/?series=139807&rev=6
the patch 5 in this series will have to make use of the new function
pointer can_async_flip().

v3: Add new plane->funcs format_mod_supported_async (Ville)

Arun R Murthy (3):
  drm/plane: Add new plane property IN_FORMATS_ASYNC
  drm/plane: Expose function to create format/modifier blob
  drm/i915/display: Populate list of async supported formats/modifiers

 drivers/gpu/drm/drm_mode_config.c             |  7 +++
 drivers/gpu/drm/drm_plane.c                   | 50 ++++++++++++------
 .../drm/i915/display/skl_universal_plane.c    | 51 +++++++++++++++++++
 include/drm/drm_mode_config.h                 |  6 +++
 include/drm/drm_plane.h                       |  4 ++
 5 files changed, 103 insertions(+), 15 deletions(-)

--
2.25.1

---
Arun R Murthy (5):
      drm/plane: Add new plane property IN_FORMATS_ASYNC
      drm/plane: Expose function to create format/modifier blob
      drm/plane: Function to check async supported modifier/format
      drm/i915/display: Populate list of async supported formats/modifiers
      drm/i915/display: Add function for format_mod_supported_async

 drivers/gpu/drm/drm_mode_config.c                  |   7 ++
 drivers/gpu/drm/drm_plane.c                        |  72 +++++++++----
 drivers/gpu/drm/i915/display/skl_universal_plane.c | 113 ++++++++++++++++++---
 include/drm/drm_mode_config.h                      |   6 ++
 include/drm/drm_plane.h                            |  24 +++++
 5 files changed, 188 insertions(+), 34 deletions(-)
---
base-commit: 08bd590935a5258ffd79355c59adffd72fb2c642
change-id: 20250102-asyn-bf76730501cc

Best regards,
--
Arun R Murthy <arun.r.murthy@intel.com>

---
Changes in v6:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v5: https://lore.kernel.org/r/20250218-asyn-v5-0-7ac5ac4abd4a@intel.com

---
Arun R Murthy (3):
      drm/plane: Add new plane property IN_FORMATS_ASYNC
      drm/plane: modify create_in_formats to accommodate async
      drm/i915/display: Add i915 hook for format_mod_supported_async

 drivers/gpu/drm/drm_mode_config.c                  |  7 +++
 drivers/gpu/drm/drm_plane.c                        | 53 +++++++++++++++-----
 drivers/gpu/drm/i915/display/skl_universal_plane.c | 56 ++++++++++++++++------
 include/drm/drm_mode_config.h                      |  6 +++
 include/drm/drm_plane.h                            | 17 +++++++
 5 files changed, 112 insertions(+), 27 deletions(-)
---
base-commit: bc7a84cbc968ce97e581e9e3c2d26fb0ac106482
change-id: 20250102-asyn-bf76730501cc

Best regards,
-- 
Arun R Murthy <arun.r.murthy@intel.com>


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

* [PATCH v6 1/3] drm/plane: Add new plane property IN_FORMATS_ASYNC
  2025-02-19  9:17 [PATCH v6 0/3] Expose modifiers/formats supported by async flips Arun R Murthy
@ 2025-02-19  9:17 ` Arun R Murthy
  2025-02-19 18:54   ` Ville Syrjälä
  2025-02-19  9:17 ` [PATCH v6 2/3] drm/plane: modify create_in_formats to accommodate async Arun R Murthy
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Arun R Murthy @ 2025-02-19  9:17 UTC (permalink / raw)
  To: dri-devel, intel-gfx, intel-xe
  Cc: chaitanya.kumar.borah, Arun R Murthy, Naveen Kumar

There exists a property IN_FORMATS which exposes the plane supported
modifiers/formats to the user. In some platforms when asynchronous flip
are used all of modifiers/formats mentioned in IN_FORMATS are not
supported. This patch adds a new plane property IN_FORMATS_ASYNC to
expose the async flip supported modifiers/formats so that user can use
this information ahead and do flip with unsupported
formats/modifiers. This will save flip failures.
Add a new function pointer similar to format_mod_supported specifically
for asynchronous flip.

v2: Remove async variable from drm_plane (Ville)
v3: Add new function pointer for async (Ville)
v5: Typo corrected in commit message & some correction in the kernel
documentation. (Chaitanya)

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Tested-by: Naveen Kumar <naveen1.kumar@intel.com>
---
 drivers/gpu/drm/drm_mode_config.c |  7 +++++++
 drivers/gpu/drm/drm_plane.c       |  8 ++++++++
 include/drm/drm_mode_config.h     |  6 ++++++
 include/drm/drm_plane.h           | 17 +++++++++++++++++
 4 files changed, 38 insertions(+)

diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
index 8642a2fb25a90116dab975aa0ab6b51deafb4b96..dbbef20753f834a85ae9ded748cff2b3f0e85043 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -388,6 +388,13 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.size_hints_property = prop;
 
+	prop = drm_property_create(dev,
+				   DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_BLOB,
+				   "IN_FORMATS_ASYNC", 0);
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.async_modifiers_property = prop;
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index a28b22fdd7a41aca82d097d42237851da9a0a79b..fe181c1002171acc68d3054c2d178f9b9f501fe2 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -141,6 +141,14 @@
  *     various bugs in this area with inconsistencies between the capability
  *     flag and per-plane properties.
  *
+ * IN_FORMATS_ASYNC:
+ *     Blob property which contains the set of buffer format and modifier
+ *     pairs supported by this plane for asynchronous flips. The blob is a struct
+ *     drm_format_modifier_blob. Userspace cannot change this property. This is an
+ *     optional property and if not present then user should expect a failure in
+ *     atomic ioctl when the modifier/format is not supported by that plane under
+ *     asynchronous flip.
+ *
  * SIZE_HINTS:
  *     Blob property which contains the set of recommended plane size
  *     which can used for simple "cursor like" use cases (eg. no scaling).
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 271765e2e9f2da62aaf0d258828ef4196e14822e..0c116d6dfd277262b1a4c0f097fce2d719f43844 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -936,6 +936,12 @@ struct drm_mode_config {
 	 */
 	struct drm_property *modifiers_property;
 
+	/**
+	 * @async_modifiers_property: Plane property to list support modifier/format
+	 * combination for asynchronous flips.
+	 */
+	struct drm_property *async_modifiers_property;
+
 	/**
 	 * @size_hints_property: Plane SIZE_HINTS property.
 	 */
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index dd718c62ac31bf16606f3ee9f025a5b171cd1e67..4393a0e9edf91ccfd78ef62b168b9313187c1a81 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -549,6 +549,23 @@ struct drm_plane_funcs {
 	 */
 	bool (*format_mod_supported)(struct drm_plane *plane, uint32_t format,
 				     uint64_t modifier);
+	/**
+	 * @format_mod_supported_async:
+	 *
+	 * This optional hook is used for the DRM to determine if for
+	 * asynchronous flip the given format/modifier combination is valid for
+	 * the plane. This allows the DRM to generate the correct format
+	 * bitmask (which formats apply to which modifier), and to validate
+	 * modifiers at atomic_check time.
+	 *
+	 * Returns:
+	 *
+	 * True if the given modifier is valid for that format on the plane.
+	 * False otherwise.
+	 */
+	bool (*format_mod_supported_async)(struct drm_plane *plane,
+					   uint32_t format, uint64_t modifier);
+
 };
 
 /**

-- 
2.25.1


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

* [PATCH v6 2/3] drm/plane: modify create_in_formats to accommodate async
  2025-02-19  9:17 [PATCH v6 0/3] Expose modifiers/formats supported by async flips Arun R Murthy
  2025-02-19  9:17 ` [PATCH v6 1/3] drm/plane: Add new plane property IN_FORMATS_ASYNC Arun R Murthy
@ 2025-02-19  9:17 ` Arun R Murthy
  2025-02-19 18:53   ` Ville Syrjälä
  2025-03-12  5:48   ` Borah, Chaitanya Kumar
  2025-02-19  9:17 ` [PATCH v6 3/3] drm/i915/display: Add i915 hook for format_mod_supported_async Arun R Murthy
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 11+ messages in thread
From: Arun R Murthy @ 2025-02-19  9:17 UTC (permalink / raw)
  To: dri-devel, intel-gfx, intel-xe
  Cc: chaitanya.kumar.borah, Arun R Murthy, Naveen Kumar

create_in_formats creates the list of supported format/modifiers for
synchronous flips, modify the same function so as to take the
format_mod_supported as argument and create list of format/modifier for
async as well.

v5: create_in_formats can return -ve value in failure case, correct the
if condition to check the creation of blob <Chaitanya>
Dont add the modifier for which none of the formats is not supported.
v6: Remove the code for masking the unsupported modifiers as UMD can
leave with it. (Naveen/Chaitanya)

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
Tested-by: Naveen Kumar <naveen1.kumar@intel.com>
---
 drivers/gpu/drm/drm_plane.c | 45 +++++++++++++++++++++++++++++++++------------
 1 file changed, 33 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index fe181c1002171acc68d3054c2d178f9b9f501fe2..fc26ef8a6cab346c9491495b57f88f1eb205d22c 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -193,9 +193,12 @@ modifiers_ptr(struct drm_format_modifier_blob *blob)
 	return (struct drm_format_modifier *)(((char *)blob) + blob->modifiers_offset);
 }
 
-static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane)
+static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane,
+				 bool (*format_mod_supported)
+						(struct drm_plane *plane,
+						 uint32_t format,
+						 uint64_t modifier))
 {
-	const struct drm_mode_config *config = &dev->mode_config;
 	struct drm_property_blob *blob;
 	struct drm_format_modifier *mod;
 	size_t blob_size, formats_size, modifiers_size;
@@ -237,13 +240,17 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 	mod = modifiers_ptr(blob_data);
 	for (i = 0; i < plane->modifier_count; i++) {
 		for (j = 0; j < plane->format_count; j++) {
-			if (!plane->funcs->format_mod_supported ||
-			    plane->funcs->format_mod_supported(plane,
-							       plane->format_types[j],
-							       plane->modifiers[i])) {
+			if (!format_mod_supported || format_mod_supported
+							(plane,
+							 plane->format_types[j],
+							 plane->modifiers[i])) {
 				mod->formats |= 1ULL << j;
 			}
 		}
+		if (!mod->formats) {
+			blob_data->count_modifiers--;
+			continue;
+		}
 
 		mod->modifier = plane->modifiers[i];
 		mod->offset = 0;
@@ -251,10 +258,7 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 		mod++;
 	}
 
-	drm_object_attach_property(&plane->base, config->modifiers_property,
-				   blob->base.id);
-
-	return 0;
+	return blob->base.id;
 }
 
 /**
@@ -371,6 +375,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 	};
 	unsigned int format_modifier_count = 0;
 	int ret;
+	int blob_id;
 
 	/* plane index is used with 32bit bitmasks */
 	if (WARN_ON(config->num_total_plane >= 32))
@@ -477,8 +482,24 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 		drm_plane_create_hotspot_properties(plane);
 	}
 
-	if (format_modifier_count)
-		create_in_format_blob(dev, plane);
+	if (format_modifier_count) {
+		blob_id = create_in_format_blob(dev, plane,
+						plane->funcs->format_mod_supported);
+		if (blob_id > 0)
+			drm_object_attach_property(&plane->base,
+						   config->modifiers_property,
+						   blob_id);
+	}
+
+	if (plane->funcs->format_mod_supported_async) {
+		blob_id = create_in_format_blob(dev, plane,
+						plane->funcs->format_mod_supported_async);
+		if (blob_id > 0)
+			drm_object_attach_property(&plane->base,
+						   config->async_modifiers_property,
+						   blob_id);
+	}
+
 
 	return 0;
 }

-- 
2.25.1


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

* [PATCH v6 3/3] drm/i915/display: Add i915 hook for format_mod_supported_async
  2025-02-19  9:17 [PATCH v6 0/3] Expose modifiers/formats supported by async flips Arun R Murthy
  2025-02-19  9:17 ` [PATCH v6 1/3] drm/plane: Add new plane property IN_FORMATS_ASYNC Arun R Murthy
  2025-02-19  9:17 ` [PATCH v6 2/3] drm/plane: modify create_in_formats to accommodate async Arun R Murthy
@ 2025-02-19  9:17 ` Arun R Murthy
  2025-02-19 19:08   ` Ville Syrjälä
  2025-02-19 13:53 ` [PATCH v6 0/3] Expose modifiers/formats supported by async flips Simona Vetter
  2025-02-19 22:33 ` Ville Syrjälä
  4 siblings, 1 reply; 11+ messages in thread
From: Arun R Murthy @ 2025-02-19  9:17 UTC (permalink / raw)
  To: dri-devel, intel-gfx, intel-xe
  Cc: chaitanya.kumar.borah, Arun R Murthy, Sebastian Brzezinka,
	Naveen Kumar

Hook up the newly added plane function pointer
format_mod_supported_async to populate the modifiers/formats supported
by asynchronous flips.

v5: Correct the if condition for modifier support check (Chaitanya)
v6: Replace uint32_t/uint64_t with u32/u64 (Jani)

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Reviewed-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Tested-by: Naveen Kumar <naveen1.kumar@intel.com>
---
 drivers/gpu/drm/i915/display/skl_universal_plane.c | 56 ++++++++++++++++------
 1 file changed, 41 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index cd9762947f1de227a3abbcd61b7c7b0c9848e439..f8baeb012f5e2423204f3f5ad7ce466666e04def 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -509,6 +509,33 @@ skl_plane_max_stride(struct intel_plane *plane,
 				modifier, rotation,
 				max_pixels, max_bytes);
 }
+static bool intel_plane_async_formats(struct intel_plane *plane, u32 format)
+{
+	switch (format) {
+	case DRM_FORMAT_RGB565:
+	case DRM_FORMAT_XRGB8888:
+	case DRM_FORMAT_XBGR8888:
+	case DRM_FORMAT_ARGB8888:
+	case DRM_FORMAT_ABGR8888:
+	case DRM_FORMAT_XRGB2101010:
+	case DRM_FORMAT_XBGR2101010:
+	case DRM_FORMAT_XRGB16161616F:
+	case DRM_FORMAT_XBGR16161616F:
+		return true;
+	default:
+		return false;
+	}
+}
+
+static bool intel_plane_format_mod_supported_async(struct drm_plane *plane,
+						   u32 format,
+						   u64 modifier)
+{
+	if (!intel_plane_can_async_flip(to_intel_plane(plane), modifier))
+		return false;
+
+	return intel_plane_async_formats(to_intel_plane(plane), format);
+}
 
 static bool tgl_plane_can_async_flip(u64 modifier)
 {
@@ -2616,30 +2643,29 @@ static bool tgl_plane_format_mod_supported(struct drm_plane *_plane,
 	}
 }
 
+#define INTEL_PLANE_FUNCS \
+	.update_plane = drm_atomic_helper_update_plane, \
+	.disable_plane = drm_atomic_helper_disable_plane, \
+	.destroy = intel_plane_destroy, \
+	.atomic_duplicate_state = intel_plane_duplicate_state, \
+	.atomic_destroy_state = intel_plane_destroy_state, \
+	.format_mod_supported_async = intel_plane_format_mod_supported_async
+
 static const struct drm_plane_funcs skl_plane_funcs = {
-	.update_plane = drm_atomic_helper_update_plane,
-	.disable_plane = drm_atomic_helper_disable_plane,
-	.destroy = intel_plane_destroy,
-	.atomic_duplicate_state = intel_plane_duplicate_state,
-	.atomic_destroy_state = intel_plane_destroy_state,
+	INTEL_PLANE_FUNCS,
+
 	.format_mod_supported = skl_plane_format_mod_supported,
 };
 
 static const struct drm_plane_funcs icl_plane_funcs = {
-	.update_plane = drm_atomic_helper_update_plane,
-	.disable_plane = drm_atomic_helper_disable_plane,
-	.destroy = intel_plane_destroy,
-	.atomic_duplicate_state = intel_plane_duplicate_state,
-	.atomic_destroy_state = intel_plane_destroy_state,
+	INTEL_PLANE_FUNCS,
+
 	.format_mod_supported = icl_plane_format_mod_supported,
 };
 
 static const struct drm_plane_funcs tgl_plane_funcs = {
-	.update_plane = drm_atomic_helper_update_plane,
-	.disable_plane = drm_atomic_helper_disable_plane,
-	.destroy = intel_plane_destroy,
-	.atomic_duplicate_state = intel_plane_duplicate_state,
-	.atomic_destroy_state = intel_plane_destroy_state,
+	INTEL_PLANE_FUNCS,
+
 	.format_mod_supported = tgl_plane_format_mod_supported,
 };
 

-- 
2.25.1


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

* Re: [PATCH v6 0/3] Expose modifiers/formats supported by async flips
  2025-02-19  9:17 [PATCH v6 0/3] Expose modifiers/formats supported by async flips Arun R Murthy
                   ` (2 preceding siblings ...)
  2025-02-19  9:17 ` [PATCH v6 3/3] drm/i915/display: Add i915 hook for format_mod_supported_async Arun R Murthy
@ 2025-02-19 13:53 ` Simona Vetter
  2025-02-19 22:33 ` Ville Syrjälä
  4 siblings, 0 replies; 11+ messages in thread
From: Simona Vetter @ 2025-02-19 13:53 UTC (permalink / raw)
  To: Arun R Murthy
  Cc: dri-devel, intel-gfx, intel-xe, chaitanya.kumar.borah,
	Naveen Kumar, Sebastian Brzezinka

On Wed, Feb 19, 2025 at 02:47:22PM +0530, Arun R Murthy wrote:
> All of the formats/modifiers supported by the plane during synchronous
> flips are nor supported by asynchronous flips. The formats/modifiers
> exposed to user by IN_FORMATS exposes all formats/modifiers supported by
> plane and this list varies for async flips. If the async flip supported
> formats/modifiers are exposed to the user, user based on this list can
> take decision to proceed or not and avoid flip failures during async
> flips.
> Discussion around this can be located @
> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29618#note_2487123
> Userspace implementation for IN_FORMARTS_ASYNC under review @
> https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4063
> 
> TODO: Upon merge of the patch related to async flip
> https://patchwork.freedesktop.org/patch/626849/?series=139807&rev=6
> the patch 5 in this series will have to make use of the new function
> pointer can_async_flip().
> 
> v3: Add new plane->funcs format_mod_supported_async (Ville)
> 
> Arun R Murthy (3):
>   drm/plane: Add new plane property IN_FORMATS_ASYNC
>   drm/plane: Expose function to create format/modifier blob
>   drm/i915/display: Populate list of async supported formats/modifiers

Somewhat orthogonal, but in a different atomic kms discussion the much
bigger question of what are compositors supposed to figure out with
TEST_ONLY and what are they supposed to figure out through special
properties cropped up. Might be really good to document that, so that we
can have some design consistency here.

I think this patch series should also document why we need this and
compositors can't figure this out on their own, ideally by linking/quoting
the relevant discussions in the compositor enabling PR.

Thanks, Sima

> 
>  drivers/gpu/drm/drm_mode_config.c             |  7 +++
>  drivers/gpu/drm/drm_plane.c                   | 50 ++++++++++++------
>  .../drm/i915/display/skl_universal_plane.c    | 51 +++++++++++++++++++
>  include/drm/drm_mode_config.h                 |  6 +++
>  include/drm/drm_plane.h                       |  4 ++
>  5 files changed, 103 insertions(+), 15 deletions(-)
> 
> --
> 2.25.1
> 
> ---
> Arun R Murthy (5):
>       drm/plane: Add new plane property IN_FORMATS_ASYNC
>       drm/plane: Expose function to create format/modifier blob
>       drm/plane: Function to check async supported modifier/format
>       drm/i915/display: Populate list of async supported formats/modifiers
>       drm/i915/display: Add function for format_mod_supported_async
> 
>  drivers/gpu/drm/drm_mode_config.c                  |   7 ++
>  drivers/gpu/drm/drm_plane.c                        |  72 +++++++++----
>  drivers/gpu/drm/i915/display/skl_universal_plane.c | 113 ++++++++++++++++++---
>  include/drm/drm_mode_config.h                      |   6 ++
>  include/drm/drm_plane.h                            |  24 +++++
>  5 files changed, 188 insertions(+), 34 deletions(-)
> ---
> base-commit: 08bd590935a5258ffd79355c59adffd72fb2c642
> change-id: 20250102-asyn-bf76730501cc
> 
> Best regards,
> --
> Arun R Murthy <arun.r.murthy@intel.com>
> 
> ---
> Changes in v6:
> - EDITME: describe what is new in this series revision.
> - EDITME: use bulletpoints and terse descriptions.
> - Link to v5: https://lore.kernel.org/r/20250218-asyn-v5-0-7ac5ac4abd4a@intel.com
> 
> ---
> Arun R Murthy (3):
>       drm/plane: Add new plane property IN_FORMATS_ASYNC
>       drm/plane: modify create_in_formats to accommodate async
>       drm/i915/display: Add i915 hook for format_mod_supported_async
> 
>  drivers/gpu/drm/drm_mode_config.c                  |  7 +++
>  drivers/gpu/drm/drm_plane.c                        | 53 +++++++++++++++-----
>  drivers/gpu/drm/i915/display/skl_universal_plane.c | 56 ++++++++++++++++------
>  include/drm/drm_mode_config.h                      |  6 +++
>  include/drm/drm_plane.h                            | 17 +++++++
>  5 files changed, 112 insertions(+), 27 deletions(-)
> ---
> base-commit: bc7a84cbc968ce97e581e9e3c2d26fb0ac106482
> change-id: 20250102-asyn-bf76730501cc
> 
> Best regards,
> -- 
> Arun R Murthy <arun.r.murthy@intel.com>
> 

-- 
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH v6 2/3] drm/plane: modify create_in_formats to accommodate async
  2025-02-19  9:17 ` [PATCH v6 2/3] drm/plane: modify create_in_formats to accommodate async Arun R Murthy
@ 2025-02-19 18:53   ` Ville Syrjälä
  2025-03-12  5:48   ` Borah, Chaitanya Kumar
  1 sibling, 0 replies; 11+ messages in thread
From: Ville Syrjälä @ 2025-02-19 18:53 UTC (permalink / raw)
  To: Arun R Murthy
  Cc: dri-devel, intel-gfx, intel-xe, chaitanya.kumar.borah,
	Naveen Kumar

On Wed, Feb 19, 2025 at 02:47:24PM +0530, Arun R Murthy wrote:
> create_in_formats creates the list of supported format/modifiers for
> synchronous flips, modify the same function so as to take the
> format_mod_supported as argument and create list of format/modifier for
> async as well.
> 
> v5: create_in_formats can return -ve value in failure case, correct the
> if condition to check the creation of blob <Chaitanya>
> Dont add the modifier for which none of the formats is not supported.
> v6: Remove the code for masking the unsupported modifiers as UMD can
> leave with it. (Naveen/Chaitanya)
> 
> Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
> Tested-by: Naveen Kumar <naveen1.kumar@intel.com>
> ---
>  drivers/gpu/drm/drm_plane.c | 45 +++++++++++++++++++++++++++++++++------------
>  1 file changed, 33 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index fe181c1002171acc68d3054c2d178f9b9f501fe2..fc26ef8a6cab346c9491495b57f88f1eb205d22c 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -193,9 +193,12 @@ modifiers_ptr(struct drm_format_modifier_blob *blob)
>  	return (struct drm_format_modifier *)(((char *)blob) + blob->modifiers_offset);
>  }
>  
> -static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane)
> +static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane,
> +				 bool (*format_mod_supported)
> +						(struct drm_plane *plane,
> +						 uint32_t format,
> +						 uint64_t modifier))
>  {
> -	const struct drm_mode_config *config = &dev->mode_config;
>  	struct drm_property_blob *blob;
>  	struct drm_format_modifier *mod;
>  	size_t blob_size, formats_size, modifiers_size;
> @@ -237,13 +240,17 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
>  	mod = modifiers_ptr(blob_data);
>  	for (i = 0; i < plane->modifier_count; i++) {
>  		for (j = 0; j < plane->format_count; j++) {
> -			if (!plane->funcs->format_mod_supported ||
> -			    plane->funcs->format_mod_supported(plane,
> -							       plane->format_types[j],
> -							       plane->modifiers[i])) {
> +			if (!format_mod_supported || format_mod_supported
> +							(plane,
> +							 plane->format_types[j],
> +							 plane->modifiers[i])) {

Weird line breaks.

>  				mod->formats |= 1ULL << j;
>  			}
>  		}
> +		if (!mod->formats) {
> +			blob_data->count_modifiers--;
> +			continue;
> +		}

I hope no userspace rejects the blob if there
is extra data at the end...

Since this can actually change the behaviour 
I think this one needs to be a separate patch
in case we need a revert later.

>  
>  		mod->modifier = plane->modifiers[i];
>  		mod->offset = 0;
> @@ -251,10 +258,7 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
>  		mod++;
>  	}
>  
> -	drm_object_attach_property(&plane->base, config->modifiers_property,
> -				   blob->base.id);
> -
> -	return 0;
> +	return blob->base.id;

The return type is wrong for this.

I think it'd probably be better to return
struct drm_property_blob* instead so we can
return errors properly as well.

>  }
>  
>  /**
> @@ -371,6 +375,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  	};
>  	unsigned int format_modifier_count = 0;
>  	int ret;
> +	int blob_id;
>  
>  	/* plane index is used with 32bit bitmasks */
>  	if (WARN_ON(config->num_total_plane >= 32))
> @@ -477,8 +482,24 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  		drm_plane_create_hotspot_properties(plane);
>  	}
>  
> -	if (format_modifier_count)
> -		create_in_format_blob(dev, plane);
> +	if (format_modifier_count) {
> +		blob_id = create_in_format_blob(dev, plane,
> +						plane->funcs->format_mod_supported);
> +		if (blob_id > 0)
> +			drm_object_attach_property(&plane->base,
> +						   config->modifiers_property,
> +						   blob_id);
> +	}
> +
> +	if (plane->funcs->format_mod_supported_async) {
> +		blob_id = create_in_format_blob(dev, plane,
> +						plane->funcs->format_mod_supported_async);
> +		if (blob_id > 0)
> +			drm_object_attach_property(&plane->base,
> +						   config->async_modifiers_property,
> +						   blob_id);
> +	}
> +
>  
>  	return 0;
>  }
> 
> -- 
> 2.25.1

-- 
Ville Syrjälä
Intel

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

* Re: [PATCH v6 1/3] drm/plane: Add new plane property IN_FORMATS_ASYNC
  2025-02-19  9:17 ` [PATCH v6 1/3] drm/plane: Add new plane property IN_FORMATS_ASYNC Arun R Murthy
@ 2025-02-19 18:54   ` Ville Syrjälä
  0 siblings, 0 replies; 11+ messages in thread
From: Ville Syrjälä @ 2025-02-19 18:54 UTC (permalink / raw)
  To: Arun R Murthy
  Cc: dri-devel, intel-gfx, intel-xe, chaitanya.kumar.borah,
	Naveen Kumar

On Wed, Feb 19, 2025 at 02:47:23PM +0530, Arun R Murthy wrote:
> There exists a property IN_FORMATS which exposes the plane supported
> modifiers/formats to the user. In some platforms when asynchronous flip
> are used all of modifiers/formats mentioned in IN_FORMATS are not
> supported. This patch adds a new plane property IN_FORMATS_ASYNC to
> expose the async flip supported modifiers/formats so that user can use
> this information ahead and do flip with unsupported
> formats/modifiers. This will save flip failures.
> Add a new function pointer similar to format_mod_supported specifically
> for asynchronous flip.
> 
> v2: Remove async variable from drm_plane (Ville)
> v3: Add new function pointer for async (Ville)
> v5: Typo corrected in commit message & some correction in the kernel
> documentation. (Chaitanya)
> 
> Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
> Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
> Tested-by: Naveen Kumar <naveen1.kumar@intel.com>
> ---
>  drivers/gpu/drm/drm_mode_config.c |  7 +++++++
>  drivers/gpu/drm/drm_plane.c       |  8 ++++++++
>  include/drm/drm_mode_config.h     |  6 ++++++
>  include/drm/drm_plane.h           | 17 +++++++++++++++++
>  4 files changed, 38 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> index 8642a2fb25a90116dab975aa0ab6b51deafb4b96..dbbef20753f834a85ae9ded748cff2b3f0e85043 100644
> --- a/drivers/gpu/drm/drm_mode_config.c
> +++ b/drivers/gpu/drm/drm_mode_config.c
> @@ -388,6 +388,13 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
>  		return -ENOMEM;
>  	dev->mode_config.size_hints_property = prop;
>  
> +	prop = drm_property_create(dev,
> +				   DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_BLOB,
> +				   "IN_FORMATS_ASYNC", 0);
> +	if (!prop)
> +		return -ENOMEM;
> +	dev->mode_config.async_modifiers_property = prop;

Please put it next to the other blob.

> +
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index a28b22fdd7a41aca82d097d42237851da9a0a79b..fe181c1002171acc68d3054c2d178f9b9f501fe2 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -141,6 +141,14 @@
>   *     various bugs in this area with inconsistencies between the capability
>   *     flag and per-plane properties.
>   *
> + * IN_FORMATS_ASYNC:
> + *     Blob property which contains the set of buffer format and modifier
> + *     pairs supported by this plane for asynchronous flips. The blob is a struct
> + *     drm_format_modifier_blob. Userspace cannot change this property. This is an
> + *     optional property and if not present then user should expect a failure in
> + *     atomic ioctl when the modifier/format is not supported by that plane under
> + *     asynchronous flip.
> + *
>   * SIZE_HINTS:
>   *     Blob property which contains the set of recommended plane size
>   *     which can used for simple "cursor like" use cases (eg. no scaling).
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 271765e2e9f2da62aaf0d258828ef4196e14822e..0c116d6dfd277262b1a4c0f097fce2d719f43844 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -936,6 +936,12 @@ struct drm_mode_config {
>  	 */
>  	struct drm_property *modifiers_property;
>  
> +	/**
> +	 * @async_modifiers_property: Plane property to list support modifier/format
> +	 * combination for asynchronous flips.
> +	 */
> +	struct drm_property *async_modifiers_property;
> +
>  	/**
>  	 * @size_hints_property: Plane SIZE_HINTS property.
>  	 */
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index dd718c62ac31bf16606f3ee9f025a5b171cd1e67..4393a0e9edf91ccfd78ef62b168b9313187c1a81 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -549,6 +549,23 @@ struct drm_plane_funcs {
>  	 */
>  	bool (*format_mod_supported)(struct drm_plane *plane, uint32_t format,
>  				     uint64_t modifier);
> +	/**
> +	 * @format_mod_supported_async:
> +	 *
> +	 * This optional hook is used for the DRM to determine if for
> +	 * asynchronous flip the given format/modifier combination is valid for
> +	 * the plane. This allows the DRM to generate the correct format
> +	 * bitmask (which formats apply to which modifier), and to validate
> +	 * modifiers at atomic_check time.
> +	 *
> +	 * Returns:
> +	 *
> +	 * True if the given modifier is valid for that format on the plane.
> +	 * False otherwise.
> +	 */
> +	bool (*format_mod_supported_async)(struct drm_plane *plane,
> +					   uint32_t format, uint64_t modifier);
> +
>  };
>  
>  /**
> 
> -- 
> 2.25.1

-- 
Ville Syrjälä
Intel

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

* Re: [PATCH v6 3/3] drm/i915/display: Add i915 hook for format_mod_supported_async
  2025-02-19  9:17 ` [PATCH v6 3/3] drm/i915/display: Add i915 hook for format_mod_supported_async Arun R Murthy
@ 2025-02-19 19:08   ` Ville Syrjälä
  0 siblings, 0 replies; 11+ messages in thread
From: Ville Syrjälä @ 2025-02-19 19:08 UTC (permalink / raw)
  To: Arun R Murthy
  Cc: dri-devel, intel-gfx, intel-xe, chaitanya.kumar.borah,
	Sebastian Brzezinka, Naveen Kumar

On Wed, Feb 19, 2025 at 02:47:25PM +0530, Arun R Murthy wrote:
> Hook up the newly added plane function pointer
> format_mod_supported_async to populate the modifiers/formats supported
> by asynchronous flips.
> 
> v5: Correct the if condition for modifier support check (Chaitanya)
> v6: Replace uint32_t/uint64_t with u32/u64 (Jani)
> 
> Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
> Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
> Reviewed-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
> Tested-by: Naveen Kumar <naveen1.kumar@intel.com>
> ---
>  drivers/gpu/drm/i915/display/skl_universal_plane.c | 56 ++++++++++++++++------
>  1 file changed, 41 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> index cd9762947f1de227a3abbcd61b7c7b0c9848e439..f8baeb012f5e2423204f3f5ad7ce466666e04def 100644
> --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> @@ -509,6 +509,33 @@ skl_plane_max_stride(struct intel_plane *plane,
>  				modifier, rotation,
>  				max_pixels, max_bytes);
>  }
> +static bool intel_plane_async_formats(struct intel_plane *plane, u32 format)
> +{
> +	switch (format) {
> +	case DRM_FORMAT_RGB565:
> +	case DRM_FORMAT_XRGB8888:
> +	case DRM_FORMAT_XBGR8888:
> +	case DRM_FORMAT_ARGB8888:
> +	case DRM_FORMAT_ABGR8888:
> +	case DRM_FORMAT_XRGB2101010:
> +	case DRM_FORMAT_XBGR2101010:
> +	case DRM_FORMAT_XRGB16161616F:
> +	case DRM_FORMAT_XBGR16161616F:
> +		return true;
> +	default:
> +		return false;
> +	}
> +}

Why? And anyway, this sort of stuff belongs in a separate patch.

> +
> +static bool intel_plane_format_mod_supported_async(struct drm_plane *plane,
> +						   u32 format,
> +						   u64 modifier)
> +{
> +	if (!intel_plane_can_async_flip(to_intel_plane(plane), modifier))
> +		return false;
> +
> +	return intel_plane_async_formats(to_intel_plane(plane), format);

To preserve the current behavior we want something like:

1. move the planar format check from
   intel_async_flip_check_hw() into
   intel_plane_can_async_flip().

2. implemnt intel_plane_format_mod_supported_async()
   as
{
	if (!plane->format_mod_supported())
		return false;
	
	return intel_plane_can_async_flip();
}

Also all this generic should be put into intel_atomic_plane.c.

>  
>  static bool tgl_plane_can_async_flip(u64 modifier)
>  {
> @@ -2616,30 +2643,29 @@ static bool tgl_plane_format_mod_supported(struct drm_plane *_plane,
>  	}
>  }
>  
> +#define INTEL_PLANE_FUNCS \
> +	.update_plane = drm_atomic_helper_update_plane, \
> +	.disable_plane = drm_atomic_helper_disable_plane, \
> +	.destroy = intel_plane_destroy, \
> +	.atomic_duplicate_state = intel_plane_duplicate_state, \
> +	.atomic_destroy_state = intel_plane_destroy_state, \
> +	.format_mod_supported_async = intel_plane_format_mod_supported_async

This looks unrelated and just adds extra noise to the patch.
Also you are failing to hook this up for pre-skl planes.

> +
>  static const struct drm_plane_funcs skl_plane_funcs = {
> -	.update_plane = drm_atomic_helper_update_plane,
> -	.disable_plane = drm_atomic_helper_disable_plane,
> -	.destroy = intel_plane_destroy,
> -	.atomic_duplicate_state = intel_plane_duplicate_state,
> -	.atomic_destroy_state = intel_plane_destroy_state,
> +	INTEL_PLANE_FUNCS,
> +
>  	.format_mod_supported = skl_plane_format_mod_supported,
>  };
>  
>  static const struct drm_plane_funcs icl_plane_funcs = {
> -	.update_plane = drm_atomic_helper_update_plane,
> -	.disable_plane = drm_atomic_helper_disable_plane,
> -	.destroy = intel_plane_destroy,
> -	.atomic_duplicate_state = intel_plane_duplicate_state,
> -	.atomic_destroy_state = intel_plane_destroy_state,
> +	INTEL_PLANE_FUNCS,
> +
>  	.format_mod_supported = icl_plane_format_mod_supported,
>  };
>  
>  static const struct drm_plane_funcs tgl_plane_funcs = {
> -	.update_plane = drm_atomic_helper_update_plane,
> -	.disable_plane = drm_atomic_helper_disable_plane,
> -	.destroy = intel_plane_destroy,
> -	.atomic_duplicate_state = intel_plane_duplicate_state,
> -	.atomic_destroy_state = intel_plane_destroy_state,
> +	INTEL_PLANE_FUNCS,
> +
>  	.format_mod_supported = tgl_plane_format_mod_supported,
>  };
>  
> 
> -- 
> 2.25.1

-- 
Ville Syrjälä
Intel

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

* Re: [PATCH v6 0/3] Expose modifiers/formats supported by async flips
  2025-02-19  9:17 [PATCH v6 0/3] Expose modifiers/formats supported by async flips Arun R Murthy
                   ` (3 preceding siblings ...)
  2025-02-19 13:53 ` [PATCH v6 0/3] Expose modifiers/formats supported by async flips Simona Vetter
@ 2025-02-19 22:33 ` Ville Syrjälä
  4 siblings, 0 replies; 11+ messages in thread
From: Ville Syrjälä @ 2025-02-19 22:33 UTC (permalink / raw)
  To: Arun R Murthy
  Cc: dri-devel, intel-gfx, intel-xe, chaitanya.kumar.borah,
	Naveen Kumar, Sebastian Brzezinka

On Wed, Feb 19, 2025 at 02:47:22PM +0530, Arun R Murthy wrote:
> All of the formats/modifiers supported by the plane during synchronous
> flips are nor supported by asynchronous flips. The formats/modifiers
> exposed to user by IN_FORMATS exposes all formats/modifiers supported by
> plane and this list varies for async flips. If the async flip supported
> formats/modifiers are exposed to the user, user based on this list can
> take decision to proceed or not and avoid flip failures during async
> flips.
> Discussion around this can be located @
> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29618#note_2487123
> Userspace implementation for IN_FORMARTS_ASYNC under review @
> https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4063

FYI I just cooked up support for xorg/modesetting:
https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1816

-- 
Ville Syrjälä
Intel

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

* RE: [PATCH v6 2/3] drm/plane: modify create_in_formats to accommodate async
  2025-02-19  9:17 ` [PATCH v6 2/3] drm/plane: modify create_in_formats to accommodate async Arun R Murthy
  2025-02-19 18:53   ` Ville Syrjälä
@ 2025-03-12  5:48   ` Borah, Chaitanya Kumar
  2025-03-12  5:51     ` Borah, Chaitanya Kumar
  1 sibling, 1 reply; 11+ messages in thread
From: Borah, Chaitanya Kumar @ 2025-03-12  5:48 UTC (permalink / raw)
  To: Murthy, Arun R, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
  Cc: Kumar, Naveen1



> -----Original Message-----
> From: Murthy, Arun R <arun.r.murthy@intel.com>
> Sent: Wednesday, February 19, 2025 2:47 PM
> To: dri-devel@lists.freedesktop.org; intel-gfx@lists.freedesktop.org; intel-
> xe@lists.freedesktop.org
> Cc: Borah, Chaitanya Kumar <chaitanya.kumar.borah@intel.com>; Murthy,
> Arun R <arun.r.murthy@intel.com>; Kumar, Naveen1
> <naveen1.kumar@intel.com>
> Subject: [PATCH v6 2/3] drm/plane: modify create_in_formats to
> accommodate async
> 
> create_in_formats creates the list of supported format/modifiers for
> synchronous flips, modify the same function so as to take the
> format_mod_supported as argument and create list of format/modifier for
> async as well.
> 
> v5: create_in_formats can return -ve value in failure case, correct the if
> condition to check the creation of blob <Chaitanya> Dont add the modifier for
> which none of the formats is not supported.
> v6: Remove the code for masking the unsupported modifiers as UMD can
> leave with it. (Naveen/Chaitanya)
> 

LGTM

Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>

> Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
> Tested-by: Naveen Kumar <naveen1.kumar@intel.com>
> ---
>  drivers/gpu/drm/drm_plane.c | 45 +++++++++++++++++++++++++++++++++--
> ----------
>  1 file changed, 33 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index
> fe181c1002171acc68d3054c2d178f9b9f501fe2..fc26ef8a6cab346c9491495b57
> f88f1eb205d22c 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -193,9 +193,12 @@ modifiers_ptr(struct drm_format_modifier_blob
> *blob)
>  	return (struct drm_format_modifier *)(((char *)blob) + blob-
> >modifiers_offset);  }
> 
> -static int create_in_format_blob(struct drm_device *dev, struct drm_plane
> *plane)
> +static int create_in_format_blob(struct drm_device *dev, struct drm_plane
> *plane,
> +				 bool (*format_mod_supported)
> +						(struct drm_plane *plane,
> +						 uint32_t format,
> +						 uint64_t modifier))
>  {
> -	const struct drm_mode_config *config = &dev->mode_config;
>  	struct drm_property_blob *blob;
>  	struct drm_format_modifier *mod;
>  	size_t blob_size, formats_size, modifiers_size; @@ -237,13 +240,17
> @@ static int create_in_format_blob(struct drm_device *dev, struct
> drm_plane *plane
>  	mod = modifiers_ptr(blob_data);
>  	for (i = 0; i < plane->modifier_count; i++) {
>  		for (j = 0; j < plane->format_count; j++) {
> -			if (!plane->funcs->format_mod_supported ||
> -			    plane->funcs->format_mod_supported(plane,
> -							       plane-
> >format_types[j],
> -							       plane-
> >modifiers[i])) {
> +			if (!format_mod_supported ||
> format_mod_supported
> +							(plane,
> +							 plane-
> >format_types[j],
> +							 plane->modifiers[i]))
> {
>  				mod->formats |= 1ULL << j;
>  			}
>  		}
> +		if (!mod->formats) {
> +			blob_data->count_modifiers--;
> +			continue;
> +		}
> 
>  		mod->modifier = plane->modifiers[i];
>  		mod->offset = 0;
> @@ -251,10 +258,7 @@ static int create_in_format_blob(struct drm_device
> *dev, struct drm_plane *plane
>  		mod++;
>  	}
> 
> -	drm_object_attach_property(&plane->base, config-
> >modifiers_property,
> -				   blob->base.id);
> -
> -	return 0;
> +	return blob->base.id;
>  }
> 
>  /**
> @@ -371,6 +375,7 @@ static int __drm_universal_plane_init(struct
> drm_device *dev,
>  	};
>  	unsigned int format_modifier_count = 0;
>  	int ret;
> +	int blob_id;
> 
>  	/* plane index is used with 32bit bitmasks */
>  	if (WARN_ON(config->num_total_plane >= 32)) @@ -477,8 +482,24
> @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  		drm_plane_create_hotspot_properties(plane);
>  	}
> 
> -	if (format_modifier_count)
> -		create_in_format_blob(dev, plane);
> +	if (format_modifier_count) {
> +		blob_id = create_in_format_blob(dev, plane,
> +						plane->funcs-
> >format_mod_supported);
> +		if (blob_id > 0)
> +			drm_object_attach_property(&plane->base,
> +						   config->modifiers_property,
> +						   blob_id);
> +	}
> +
> +	if (plane->funcs->format_mod_supported_async) {
> +		blob_id = create_in_format_blob(dev, plane,
> +						plane->funcs-
> >format_mod_supported_async);
> +		if (blob_id > 0)
> +			drm_object_attach_property(&plane->base,
> +						   config-
> >async_modifiers_property,
> +						   blob_id);
> +	}
> +
> 
>  	return 0;
>  }
> 
> --
> 2.25.1


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

* RE: [PATCH v6 2/3] drm/plane: modify create_in_formats to accommodate async
  2025-03-12  5:48   ` Borah, Chaitanya Kumar
@ 2025-03-12  5:51     ` Borah, Chaitanya Kumar
  0 siblings, 0 replies; 11+ messages in thread
From: Borah, Chaitanya Kumar @ 2025-03-12  5:51 UTC (permalink / raw)
  To: Murthy, Arun R, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
  Cc: Kumar, Naveen1



> -----Original Message-----
> From: Borah, Chaitanya Kumar
> Sent: Wednesday, March 12, 2025 11:19 AM
> To: Murthy, Arun R <arun.r.murthy@intel.com>; dri-
> devel@lists.freedesktop.org; intel-gfx@lists.freedesktop.org; intel-
> xe@lists.freedesktop.org
> Cc: Kumar, Naveen1 <Naveen1.Kumar@intel.com>
> Subject: RE: [PATCH v6 2/3] drm/plane: modify create_in_formats to
> accommodate async
> 
> 
> 
> > -----Original Message-----
> > From: Murthy, Arun R <arun.r.murthy@intel.com>
> > Sent: Wednesday, February 19, 2025 2:47 PM
> > To: dri-devel@lists.freedesktop.org; intel-gfx@lists.freedesktop.org;
> > intel- xe@lists.freedesktop.org
> > Cc: Borah, Chaitanya Kumar <chaitanya.kumar.borah@intel.com>; Murthy,
> > Arun R <arun.r.murthy@intel.com>; Kumar, Naveen1
> > <naveen1.kumar@intel.com>
> > Subject: [PATCH v6 2/3] drm/plane: modify create_in_formats to
> > accommodate async
> >
> > create_in_formats creates the list of supported format/modifiers for
> > synchronous flips, modify the same function so as to take the
> > format_mod_supported as argument and create list of format/modifier
> > for async as well.
> >
> > v5: create_in_formats can return -ve value in failure case, correct
> > the if condition to check the creation of blob <Chaitanya> Dont add
> > the modifier for which none of the formats is not supported.
> > v6: Remove the code for masking the unsupported modifiers as UMD can
> > leave with it. (Naveen/Chaitanya)
> >
> 
> LGTM
> 
> Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>

Please ignore this, meant for v7.

Regards

Chaitanya
> 
> > Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
> > Tested-by: Naveen Kumar <naveen1.kumar@intel.com>
> > ---
> >  drivers/gpu/drm/drm_plane.c | 45
> +++++++++++++++++++++++++++++++++--
> > ----------
> >  1 file changed, 33 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > index
> >
> fe181c1002171acc68d3054c2d178f9b9f501fe2..fc26ef8a6cab346c9491495b57
> > f88f1eb205d22c 100644
> > --- a/drivers/gpu/drm/drm_plane.c
> > +++ b/drivers/gpu/drm/drm_plane.c
> > @@ -193,9 +193,12 @@ modifiers_ptr(struct drm_format_modifier_blob
> > *blob)
> >  	return (struct drm_format_modifier *)(((char *)blob) + blob-
> > >modifiers_offset);  }
> >
> > -static int create_in_format_blob(struct drm_device *dev, struct
> > drm_plane
> > *plane)
> > +static int create_in_format_blob(struct drm_device *dev, struct
> > +drm_plane
> > *plane,
> > +				 bool (*format_mod_supported)
> > +						(struct drm_plane *plane,
> > +						 uint32_t format,
> > +						 uint64_t modifier))
> >  {
> > -	const struct drm_mode_config *config = &dev->mode_config;
> >  	struct drm_property_blob *blob;
> >  	struct drm_format_modifier *mod;
> >  	size_t blob_size, formats_size, modifiers_size; @@ -237,13 +240,17
> > @@ static int create_in_format_blob(struct drm_device *dev, struct
> > drm_plane *plane
> >  	mod = modifiers_ptr(blob_data);
> >  	for (i = 0; i < plane->modifier_count; i++) {
> >  		for (j = 0; j < plane->format_count; j++) {
> > -			if (!plane->funcs->format_mod_supported ||
> > -			    plane->funcs->format_mod_supported(plane,
> > -							       plane-
> > >format_types[j],
> > -							       plane-
> > >modifiers[i])) {
> > +			if (!format_mod_supported ||
> > format_mod_supported
> > +							(plane,
> > +							 plane-
> > >format_types[j],
> > +							 plane->modifiers[i]))
> > {
> >  				mod->formats |= 1ULL << j;
> >  			}
> >  		}
> > +		if (!mod->formats) {
> > +			blob_data->count_modifiers--;
> > +			continue;
> > +		}
> >
> >  		mod->modifier = plane->modifiers[i];
> >  		mod->offset = 0;
> > @@ -251,10 +258,7 @@ static int create_in_format_blob(struct
> > drm_device *dev, struct drm_plane *plane
> >  		mod++;
> >  	}
> >
> > -	drm_object_attach_property(&plane->base, config-
> > >modifiers_property,
> > -				   blob->base.id);
> > -
> > -	return 0;
> > +	return blob->base.id;
> >  }
> >
> >  /**
> > @@ -371,6 +375,7 @@ static int __drm_universal_plane_init(struct
> > drm_device *dev,
> >  	};
> >  	unsigned int format_modifier_count = 0;
> >  	int ret;
> > +	int blob_id;
> >
> >  	/* plane index is used with 32bit bitmasks */
> >  	if (WARN_ON(config->num_total_plane >= 32)) @@ -477,8 +482,24
> @@
> > static int __drm_universal_plane_init(struct drm_device *dev,
> >  		drm_plane_create_hotspot_properties(plane);
> >  	}
> >
> > -	if (format_modifier_count)
> > -		create_in_format_blob(dev, plane);
> > +	if (format_modifier_count) {
> > +		blob_id = create_in_format_blob(dev, plane,
> > +						plane->funcs-
> > >format_mod_supported);
> > +		if (blob_id > 0)
> > +			drm_object_attach_property(&plane->base,
> > +						   config->modifiers_property,
> > +						   blob_id);
> > +	}
> > +
> > +	if (plane->funcs->format_mod_supported_async) {
> > +		blob_id = create_in_format_blob(dev, plane,
> > +						plane->funcs-
> > >format_mod_supported_async);
> > +		if (blob_id > 0)
> > +			drm_object_attach_property(&plane->base,
> > +						   config-
> > >async_modifiers_property,
> > +						   blob_id);
> > +	}
> > +
> >
> >  	return 0;
> >  }
> >
> > --
> > 2.25.1


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

end of thread, other threads:[~2025-03-12  5:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-19  9:17 [PATCH v6 0/3] Expose modifiers/formats supported by async flips Arun R Murthy
2025-02-19  9:17 ` [PATCH v6 1/3] drm/plane: Add new plane property IN_FORMATS_ASYNC Arun R Murthy
2025-02-19 18:54   ` Ville Syrjälä
2025-02-19  9:17 ` [PATCH v6 2/3] drm/plane: modify create_in_formats to accommodate async Arun R Murthy
2025-02-19 18:53   ` Ville Syrjälä
2025-03-12  5:48   ` Borah, Chaitanya Kumar
2025-03-12  5:51     ` Borah, Chaitanya Kumar
2025-02-19  9:17 ` [PATCH v6 3/3] drm/i915/display: Add i915 hook for format_mod_supported_async Arun R Murthy
2025-02-19 19:08   ` Ville Syrjälä
2025-02-19 13:53 ` [PATCH v6 0/3] Expose modifiers/formats supported by async flips Simona Vetter
2025-02-19 22:33 ` 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).