diff mbox

[07/36] drm/omap: Init fbdev emulation only when we have displays

Message ID 1480504658-11775-8-git-send-email-tomi.valkeinen@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomi Valkeinen Nov. 30, 2016, 11:17 a.m. UTC
From: Peter Ujfalusi <peter.ujfalusi@ti.com>

Do not try to init the fbdev if either num_crtcs or num_connectors is 0.
In this case we do not have display so the fbdev init would fail anyways.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Daniel Vetter Nov. 30, 2016, 1:46 p.m. UTC | #1
On Wed, Nov 30, 2016 at 01:17:09PM +0200, Tomi Valkeinen wrote:
> From: Peter Ujfalusi <peter.ujfalusi@ti.com>
> 
> Do not try to init the fbdev if either num_crtcs or num_connectors is 0.
> In this case we do not have display so the fbdev init would fail anyways.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> index 8d8ac173f55d..2b045262f8ad 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> @@ -255,6 +255,9 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)
>  	struct drm_fb_helper *helper;
>  	int ret = 0;
>  
> +	if (!priv->num_crtcs || !priv->num_connectors)
> +		return NULL;

Thierry Redding had patches to implement this in a generic fashion in the
fbdev emulation (just wait with fbdev init until the first screen shows
up). Would be great to polish up that work (I've reviewed the original
series already) and land it, instead of driver hacks forever.

https://patchwork.freedesktop.org/patch/91448/

Cheers, Daniel


> +
>  	fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
>  	if (!fbdev)
>  		goto fail;
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Tomi Valkeinen Dec. 9, 2016, 11:13 a.m. UTC | #2
On 30/11/16 15:46, Daniel Vetter wrote:
> On Wed, Nov 30, 2016 at 01:17:09PM +0200, Tomi Valkeinen wrote:
>> From: Peter Ujfalusi <peter.ujfalusi@ti.com>
>>
>> Do not try to init the fbdev if either num_crtcs or num_connectors is 0.
>> In this case we do not have display so the fbdev init would fail anyways.
>>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
>> index 8d8ac173f55d..2b045262f8ad 100644
>> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
>> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
>> @@ -255,6 +255,9 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)
>>  	struct drm_fb_helper *helper;
>>  	int ret = 0;
>>  
>> +	if (!priv->num_crtcs || !priv->num_connectors)
>> +		return NULL;
> 
> Thierry Redding had patches to implement this in a generic fashion in the
> fbdev emulation (just wait with fbdev init until the first screen shows
> up). Would be great to polish up that work (I've reviewed the original
> series already) and land it, instead of driver hacks forever.
> 
> https://patchwork.freedesktop.org/patch/91448/

This is not doing the same thing, or at least the point is not the same.

OMAP DSS has writeback support, which can be used in a plain
memory-to-memory mode (not yet in the mainline, though). The need for
this patch came up when people tried to use WB on boards that don't have
any displays.

So this was not about deferred setup but skipping fbdev totally if we
don't have any display outputs.

 Tomi
Daniel Vetter Dec. 9, 2016, 2:09 p.m. UTC | #3
On Fri, Dec 09, 2016 at 01:13:11PM +0200, Tomi Valkeinen wrote:
> On 30/11/16 15:46, Daniel Vetter wrote:
> > On Wed, Nov 30, 2016 at 01:17:09PM +0200, Tomi Valkeinen wrote:
> >> From: Peter Ujfalusi <peter.ujfalusi@ti.com>
> >>
> >> Do not try to init the fbdev if either num_crtcs or num_connectors is 0.
> >> In this case we do not have display so the fbdev init would fail anyways.
> >>
> >> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> >> ---
> >>  drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +++
> >>  1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> >> index 8d8ac173f55d..2b045262f8ad 100644
> >> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> >> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> >> @@ -255,6 +255,9 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)
> >>  	struct drm_fb_helper *helper;
> >>  	int ret = 0;
> >>  
> >> +	if (!priv->num_crtcs || !priv->num_connectors)
> >> +		return NULL;
> > 
> > Thierry Redding had patches to implement this in a generic fashion in the
> > fbdev emulation (just wait with fbdev init until the first screen shows
> > up). Would be great to polish up that work (I've reviewed the original
> > series already) and land it, instead of driver hacks forever.
> > 
> > https://patchwork.freedesktop.org/patch/91448/
> 
> This is not doing the same thing, or at least the point is not the same.
> 
> OMAP DSS has writeback support, which can be used in a plain
> memory-to-memory mode (not yet in the mainline, though). The need for
> this patch came up when people tried to use WB on boards that don't have
> any displays.
> 
> So this was not about deferred setup but skipping fbdev totally if we
> don't have any display outputs.

ah ok. Would still fix both problems ;-) But I understand that a more
direct solution here makes more sense.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 8d8ac173f55d..2b045262f8ad 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -255,6 +255,9 @@  struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)
 	struct drm_fb_helper *helper;
 	int ret = 0;
 
+	if (!priv->num_crtcs || !priv->num_connectors)
+		return NULL;
+
 	fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
 	if (!fbdev)
 		goto fail;