xf86drmMode: set FB_MODIFIERS flag when modifiers are supplied

The kernel will always return EINVAL if modifiers are supplied but
the flag DRM_MODE_FB_MODIFIERS isn't set. That's a pretty nice
footgun.

Be a little more helpful and set the flag if the user has supplied
a modifier array.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
main
Simon Ser 2021-03-05 16:07:58 +01:00
parent a5a400c958
commit b362850689
1 changed files with 3 additions and 1 deletions

View File

@ -289,8 +289,10 @@ drm_public int drmModeAddFB2WithModifiers(int fd, uint32_t width,
memcpy(f.handles, bo_handles, 4 * sizeof(bo_handles[0])); memcpy(f.handles, bo_handles, 4 * sizeof(bo_handles[0]));
memcpy(f.pitches, pitches, 4 * sizeof(pitches[0])); memcpy(f.pitches, pitches, 4 * sizeof(pitches[0]));
memcpy(f.offsets, offsets, 4 * sizeof(offsets[0])); memcpy(f.offsets, offsets, 4 * sizeof(offsets[0]));
if (modifier) if (modifier) {
f.flags |= DRM_MODE_FB_MODIFIERS;
memcpy(f.modifier, modifier, 4 * sizeof(modifier[0])); memcpy(f.modifier, modifier, 4 * sizeof(modifier[0]));
}
if ((ret = DRM_IOCTL(fd, DRM_IOCTL_MODE_ADDFB2, &f))) if ((ret = DRM_IOCTL(fd, DRM_IOCTL_MODE_ADDFB2, &f)))
return ret; return ret;