[igt-dev] [PATCH i-g-t v2] lib: Don't call igt_require_fb_modifiers() when no modifier

Ville Syrjälä ville.syrjala at linux.intel.com
Mon Oct 15 13:52:47 UTC 2018


On Sat, Oct 13, 2018 at 01:04:08PM +0100, Daniel Stone wrote:
> Hi Deepak,
> 
> On Fri, 12 Oct 2018 at 16:24, <sunpeng.li at amd.com> wrote:
> > * In create_fb() calls to kms_addfb(), remove the modifier flag iff the
> >   driver doesn't support modifiers and the modifer is 0
> 
> I know this wasn't your idea and you were just following the
> suggestion - but 0 _is_ a valid modifier with a very specific meaning,
> which is to always interpret the buffer as linear, no matter what.
> 
> DRM_FORMAT_MOD_INVALID is a non-zero value, and should be passed
> anywhere that modifiers are not supported or their use is not wanted.
> 
> > @@ -1678,7 +1682,8 @@ int __kms_addfb(int fd, uint32_t handle,
> >         struct drm_mode_fb_cmd2 f;
> >         int ret, i;
> >
> > -       igt_require_fb_modifiers(fd);
> > +       if (modifier || flags & DRM_MODE_FB_MODIFIERS)
> 
> So I would suggest changing this test to modifier !=
> DRM_FORMAT_MOD_INVALID, and passing INVALID rather than 0 where
> required.

If we start using DRM_FORMAT_MOD_INVALID then I suppose we should
drop the flags parameter entirely as it'll become redundant.

In the current scheme I think it would suffice to just
'if (flags & MOD) igt_require_mods()'. I don't think we need to
protect against someone passing in a non-linear modifier without
the flag. That would just be a bug (or even a feature perhaps)
in the test.

-- 
Ville Syrjälä
Intel


More information about the igt-dev mailing list