Skip to content

Commit 9cd5cc9

Browse files
armurthysurajk8
authored andcommitted
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 <[email protected]> Acked-by: Xaver Hugl <[email protected]> Acked-by: Harry Wentland <[email protected]> Reviewed-by: Chaitanya Kumar Borah <[email protected]> Reviewed-by: Ville Syrjälä <[email protected]> Tested-by: Naveen Kumar <[email protected]> Signed-off-by: Suraj Kandpal <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 91bdccf commit 9cd5cc9

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

drivers/gpu/drm/drm_mode_config.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,13 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
381381
return -ENOMEM;
382382
dev->mode_config.modifiers_property = prop;
383383

384+
prop = drm_property_create(dev,
385+
DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_BLOB,
386+
"IN_FORMATS_ASYNC", 0);
387+
if (!prop)
388+
return -ENOMEM;
389+
dev->mode_config.async_modifiers_property = prop;
390+
384391
prop = drm_property_create(dev,
385392
DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_BLOB,
386393
"SIZE_HINTS", 0);

drivers/gpu/drm/drm_plane.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@
141141
* various bugs in this area with inconsistencies between the capability
142142
* flag and per-plane properties.
143143
*
144+
* IN_FORMATS_ASYNC:
145+
* Blob property which contains the set of buffer format and modifier
146+
* pairs supported by this plane for asynchronous flips. The blob is a struct
147+
* drm_format_modifier_blob. Userspace cannot change this property. This is an
148+
* optional property and if not present then user should expect a failure in
149+
* atomic ioctl when the modifier/format is not supported by that plane under
150+
* asynchronous flip.
151+
*
144152
* SIZE_HINTS:
145153
* Blob property which contains the set of recommended plane size
146154
* which can used for simple "cursor like" use cases (eg. no scaling).

include/drm/drm_mode_config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,12 @@ struct drm_mode_config {
936936
*/
937937
struct drm_property *modifiers_property;
938938

939+
/**
940+
* @async_modifiers_property: Plane property to list support modifier/format
941+
* combination for asynchronous flips.
942+
*/
943+
struct drm_property *async_modifiers_property;
944+
939945
/**
940946
* @size_hints_property: Plane SIZE_HINTS property.
941947
*/

include/drm/drm_plane.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,23 @@ struct drm_plane_funcs {
549549
*/
550550
bool (*format_mod_supported)(struct drm_plane *plane, uint32_t format,
551551
uint64_t modifier);
552+
/**
553+
* @format_mod_supported_async:
554+
*
555+
* This optional hook is used for the DRM to determine if for
556+
* asynchronous flip the given format/modifier combination is valid for
557+
* the plane. This allows the DRM to generate the correct format
558+
* bitmask (which formats apply to which modifier), and to validate
559+
* modifiers at atomic_check time.
560+
*
561+
* Returns:
562+
*
563+
* True if the given modifier is valid for that format on the plane.
564+
* False otherwise.
565+
*/
566+
bool (*format_mod_supported_async)(struct drm_plane *plane,
567+
u32 format, u64 modifier);
568+
552569
};
553570

554571
/**

0 commit comments

Comments
 (0)