Commit 0cab1159 authored by Paul Kocialkowski's avatar Paul Kocialkowski Committed by Greg Kroah-Hartman

drm: Auto-set allow_fb_modifiers when given modifiers at plane init

[ Upstream commit 890880dd ]

When drivers pass non-empty lists of modifiers for initializing their
planes, we can infer that they allow framebuffer modifiers and set the
driver's allow_fb_modifiers mode config element.

In case the allow_fb_modifiers element was not set (some drivers tend
to set them after registering planes), the modifiers will still be
registered but won't be available to userspace unless the flag is set
later. However in that case, the IN_FORMATS blob won't be created.

In order to avoid this case and generally reduce the trouble associated
with the flag, always set allow_fb_modifiers when a non-empty list of
format modifiers is passed at plane init.
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190104085610.5829-1-paul.kocialkowski@bootlin.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 8fbaad2c
...@@ -203,6 +203,9 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, ...@@ -203,6 +203,9 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
format_modifier_count++; format_modifier_count++;
} }
if (format_modifier_count)
config->allow_fb_modifiers = true;
plane->modifier_count = format_modifier_count; plane->modifier_count = format_modifier_count;
plane->modifiers = kmalloc_array(format_modifier_count, plane->modifiers = kmalloc_array(format_modifier_count,
sizeof(format_modifiers[0]), sizeof(format_modifiers[0]),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment