]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - 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
CommitLineData
ba172962
SL
1From 057e0ce959410357e62fc0b5ce47e07b4d427154 Mon Sep 17 00:00:00 2001
2From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
3Date: Fri, 4 Jan 2019 09:56:10 +0100
4Subject: drm: Auto-set allow_fb_modifiers when given modifiers at plane init
5
6[ Upstream commit 890880ddfdbe256083170866e49c87618b706ac7 ]
7
8When drivers pass non-empty lists of modifiers for initializing their
9planes, we can infer that they allow framebuffer modifiers and set the
10driver's allow_fb_modifiers mode config element.
11
12In case the allow_fb_modifiers element was not set (some drivers tend
13to set them after registering planes), the modifiers will still be
14registered but won't be available to userspace unless the flag is set
15later. However in that case, the IN_FORMATS blob won't be created.
16
17In order to avoid this case and generally reduce the trouble associated
18with the flag, always set allow_fb_modifiers when a non-empty list of
19format modifiers is passed at plane init.
20
21Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
22Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
23Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
24Link: https://patchwork.freedesktop.org/patch/msgid/20190104085610.5829-1-paul.kocialkowski@bootlin.com
25Signed-off-by: Sasha Levin <sashal@kernel.org>
26---
27 drivers/gpu/drm/drm_plane.c | 3 +++
28 1 file changed, 3 insertions(+)
29
30diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
31index 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--
452.19.1
46