[PATCH v2 1/6] drm/plane: Make format_mod_supported truly optional

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Dec 23 15:03:19 UTC 2021


On Thu, Dec 23, 2021 at 01:42:32PM +0000, Simon Ser wrote:
> On Thursday, December 23rd, 2021 at 12:56, Ville Syrjälä <ville.syrjala at linux.intel.com> wrote:
> 
> > > -	/* If we can't determine support, just bail */
> > > -	if (!plane->funcs->format_mod_supported)
> > > -		goto done;
> > > -
> > >  	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,
> > > +			if (!plane->funcs->format_mod_supported ||
> > > +			    plane->funcs->format_mod_supported(plane,
> > >  							       plane->format_types[j],
> > >  							       plane->modifiers[i])) {
> >
> > So instead of skipping the whole loop you just skip doing anything
> > inside the loop? Can't see how that achieves anything at all.
> 
> No, the check is skipped when the function isn't populated by the driver.

Ah right. So we advertise all modifiers in that case. Looks like
drm_plane_check_pixel_format() does support that model, so seems OK.

Another related thing that might be worth checking is whether
drivers generally do anything to validate the modifiers in
the addfb2 ioctl. Looks like i915 and amdgpu are the only ones
to use drm_any_plane_has_format() for that, so all the other
drivers must either be checking it manually (or they're just
potentially broken when handed unexpected modifiers by evil
userspace).

-- 
Ville Syrjälä
Intel


More information about the dri-devel mailing list