RE: [PATCHv2 2/3] drm/plane: Expose function to create format/modifier blob

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > On Mon, Nov 18, 2024 at 01:23:14PM +0530, Arun R Murthy wrote:
> > > Expose drm plane function to create formats/modifiers blob. This
> > > function can be used to expose list of supported formats/modifiers
> > > for sync/async flips.
> > >
> > > Signed-off-by: Arun R Murthy <arun.r.murthy@xxxxxxxxx>
> > > ---
> > >  drivers/gpu/drm/drm_plane.c | 44 ++++++++++++++++++++++++-------------
> > >  include/drm/drm_plane.h     |  4 ++++
> > >  2 files changed, 33 insertions(+), 15 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_plane.c
> > > b/drivers/gpu/drm/drm_plane.c index 416818e54ccf..4f35eec2b777
> > > 100644
> > > --- a/drivers/gpu/drm/drm_plane.c
> > > +++ b/drivers/gpu/drm/drm_plane.c
> > > @@ -191,7 +191,10 @@ 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)
> > > +int drm_plane_create_format_blob(struct drm_device *dev,
> > > +				 struct drm_plane *plane, u64 *modifiers,
> > > +				 unsigned int modifier_count, u32 *formats,
> > > +				 unsigned int format_count, bool is_async)
> > >  {
> > >  	const struct drm_mode_config *config = &dev->mode_config;
> > >  	struct drm_property_blob *blob;
> > > @@ -200,14 +203,14 @@ static int create_in_format_blob(struct
> > > drm_device
> > *dev, struct drm_plane *plane
> > >  	struct drm_format_modifier_blob *blob_data;
> > >  	unsigned int i, j;
> > >
> > > -	formats_size = sizeof(__u32) * plane->format_count;
> > > +	formats_size = sizeof(__u32) * format_count;
> > >  	if (WARN_ON(!formats_size)) {
> > >  		/* 0 formats are never expected */
> > >  		return 0;
> > >  	}
> > >
> > >  	modifiers_size =
> > > -		sizeof(struct drm_format_modifier) * plane->modifier_count;
> > > +		sizeof(struct drm_format_modifier) * modifier_count;
> > >
> > >  	blob_size = sizeof(struct drm_format_modifier_blob);
> > >  	/* Modifiers offset is a pointer to a struct with a 64 bit field
> > > so it @@ -223,37 +226,45 @@ static int create_in_format_blob(struct
> > > drm_device *dev, struct drm_plane *plane
> > >
> > >  	blob_data = blob->data;
> > >  	blob_data->version = FORMAT_BLOB_CURRENT;
> > > -	blob_data->count_formats = plane->format_count;
> > > +	blob_data->count_formats = format_count;
> > >  	blob_data->formats_offset = sizeof(struct drm_format_modifier_blob);
> > > -	blob_data->count_modifiers = plane->modifier_count;
> > > +	blob_data->count_modifiers = modifier_count;
> > >
> > >  	blob_data->modifiers_offset =
> > >  		ALIGN(blob_data->formats_offset + formats_size, 8);
> > >
> > > -	memcpy(formats_ptr(blob_data), plane->format_types, formats_size);
> > > +	memcpy(formats_ptr(blob_data), formats, formats_size);
> > >
> > >  	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 ||
> > > +	for (i = 0; i < modifier_count; i++) {
> > > +		for (j = 0; j < format_count; j++) {
> > > +			if (is_async ||
> >
> > I asked for a format_mod_supported_async(). This is not that.
> >
format_mod_supported() is the existing function pointer and while calling this in universal_plane_init() we don't have any flag to differentiate between sync and async for differentiating the calls. Also this maynot be required at universal_plane_init as only RGB formats are supported under async_flip. Only plane we need is to check if the modifier is supported or not and that can be handled in the present format_mod_supported().
This can be achieved by
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -2479,6 +2479,10 @@ static bool tgl_plane_format_mod_supported(struct drm_plane *_plane,
 {
        struct intel_plane *plane = to_intel_plane(_plane);

+       /* handle check for async flips */
+       if (plane->crtc->state->async_flip)
+               return plane->can_async_flip(modifier);
+
        if (!intel_fb_plane_supports_modifier(plane, modifier))
                return false;
Dependency: https://patchwork.freedesktop.org/patch/626849/?series=139807&rev=4

This part can be taken out of this series as this series is focused on exposing the supported formats/modifiers to user by the property IN_FORMATS_ASYNC.

Thanks and Regards,
Arun R Murthy
--------------------




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux