drm/plane: Add new plane property IN_FORMATS_ASYNC

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)
v7: Place IN_FORMATS_ASYNC next to IN_FORMATS (Ville)
v8: replace uint32_t with u32 and uint64_t with u64 (Chaitanya)

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
Acked-by: Xaver Hugl <xaver.hugl@kde.org>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Naveen Kumar <naveen1.kumar@intel.com>
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://lore.kernel.org/r/20250407-asyn-v13-1-b93ef83076c5@intel.com
This commit is contained in:
Arun R Murthy 2025-04-07 11:13:45 +05:30 committed by Suraj Kandpal
parent 91bdccf579
commit 9cd5cc9da7
4 changed files with 38 additions and 0 deletions

View File

@ -381,6 +381,13 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
return -ENOMEM;
dev->mode_config.modifiers_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;
prop = drm_property_create(dev,
DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_BLOB,
"SIZE_HINTS", 0);

View File

@ -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).

View File

@ -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.
*/

View File

@ -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,
u32 format, u64 modifier);
};
/**