linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: Auto-set allow_fb_modifiers when given modifiers at plane init
@ 2019-01-04  8:56 Paul Kocialkowski
  2019-01-07 10:49 ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Kocialkowski @ 2019-01-04  8:56 UTC (permalink / raw)
  To: dri-devel, linux-kernel
  Cc: Maarten Lankhorst, Eric Anholt, Sean Paul, David Airlie,
	Thomas Petazzoni, Daniel Vetter, Paul Kocialkowski

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.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
 drivers/gpu/drm/drm_plane.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 5f650d8fc66b..4cfb56893b7f 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -220,6 +220,9 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
 			format_modifier_count++;
 	}
 
+	if (format_modifier_count)
+		config->allow_fb_modifiers = true;
+
 	plane->modifier_count = format_modifier_count;
 	plane->modifiers = kmalloc_array(format_modifier_count,
 					 sizeof(format_modifiers[0]),
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm: Auto-set allow_fb_modifiers when given modifiers at plane init
  2019-01-04  8:56 [PATCH] drm: Auto-set allow_fb_modifiers when given modifiers at plane init Paul Kocialkowski
@ 2019-01-07 10:49 ` Daniel Vetter
  2019-01-11 15:54   ` Maxime Ripard
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Vetter @ 2019-01-07 10:49 UTC (permalink / raw)
  To: Paul Kocialkowski
  Cc: dri-devel, linux-kernel, Maarten Lankhorst, Eric Anholt,
	Sean Paul, David Airlie, Thomas Petazzoni, Daniel Vetter

On Fri, Jan 04, 2019 at 09:56:10AM +0100, Paul Kocialkowski wrote:
> 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.
> 
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

The automatic primary plane drm_crtc_init() creates doesn't set this, so
looks correct in all cases.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

(boolin.com has a bunch of drm-misc committers, so I'll leave pushing to
them).
-Daniel

> ---
>  drivers/gpu/drm/drm_plane.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 5f650d8fc66b..4cfb56893b7f 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -220,6 +220,9 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
>  			format_modifier_count++;
>  	}
>  
> +	if (format_modifier_count)
> +		config->allow_fb_modifiers = true;
> +
>  	plane->modifier_count = format_modifier_count;
>  	plane->modifiers = kmalloc_array(format_modifier_count,
>  					 sizeof(format_modifiers[0]),
> -- 
> 2.20.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm: Auto-set allow_fb_modifiers when given modifiers at plane init
  2019-01-07 10:49 ` Daniel Vetter
@ 2019-01-11 15:54   ` Maxime Ripard
  0 siblings, 0 replies; 3+ messages in thread
From: Maxime Ripard @ 2019-01-11 15:54 UTC (permalink / raw)
  To: Paul Kocialkowski, dri-devel, linux-kernel, Maarten Lankhorst,
	Eric Anholt, Sean Paul, David Airlie, Thomas Petazzoni

[-- Attachment #1: Type: text/plain, Size: 1293 bytes --]

On Mon, Jan 07, 2019 at 11:49:16AM +0100, Daniel Vetter wrote:
> On Fri, Jan 04, 2019 at 09:56:10AM +0100, Paul Kocialkowski wrote:
> > 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.
> > 
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> 
> The automatic primary plane drm_crtc_init() creates doesn't set this, so
> looks correct in all cases.
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> (boolin.com has a bunch of drm-misc committers, so I'll leave pushing to
> them).

Applied,

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-11 15:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-04  8:56 [PATCH] drm: Auto-set allow_fb_modifiers when given modifiers at plane init Paul Kocialkowski
2019-01-07 10:49 ` Daniel Vetter
2019-01-11 15:54   ` Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).