]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.34/drm-auto-set-allow_fb_modifiers-when-given-modifiers.patch
Linux 4.19.34
[thirdparty/kernel/stable-queue.git] / releases / 4.19.34 / drm-auto-set-allow_fb_modifiers-when-given-modifiers.patch
1 From 057e0ce959410357e62fc0b5ce47e07b4d427154 Mon Sep 17 00:00:00 2001
2 From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
3 Date: Fri, 4 Jan 2019 09:56:10 +0100
4 Subject: drm: Auto-set allow_fb_modifiers when given modifiers at plane init
5
6 [ Upstream commit 890880ddfdbe256083170866e49c87618b706ac7 ]
7
8 When drivers pass non-empty lists of modifiers for initializing their
9 planes, we can infer that they allow framebuffer modifiers and set the
10 driver's allow_fb_modifiers mode config element.
11
12 In case the allow_fb_modifiers element was not set (some drivers tend
13 to set them after registering planes), the modifiers will still be
14 registered but won't be available to userspace unless the flag is set
15 later. However in that case, the IN_FORMATS blob won't be created.
16
17 In order to avoid this case and generally reduce the trouble associated
18 with the flag, always set allow_fb_modifiers when a non-empty list of
19 format modifiers is passed at plane init.
20
21 Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
22 Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
23 Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
24 Link: https://patchwork.freedesktop.org/patch/msgid/20190104085610.5829-1-paul.kocialkowski@bootlin.com
25 Signed-off-by: Sasha Levin <sashal@kernel.org>
26 ---
27 drivers/gpu/drm/drm_plane.c | 3 +++
28 1 file changed, 3 insertions(+)
29
30 diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
31 index 6153cbda239f..d36b1be632d9 100644
32 --- a/drivers/gpu/drm/drm_plane.c
33 +++ b/drivers/gpu/drm/drm_plane.c
34 @@ -211,6 +211,9 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
35 format_modifier_count++;
36 }
37
38 + if (format_modifier_count)
39 + config->allow_fb_modifiers = true;
40 +
41 plane->modifier_count = format_modifier_count;
42 plane->modifiers = kmalloc_array(format_modifier_count,
43 sizeof(format_modifiers[0]),
44 --
45 2.19.1
46