All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Noralf Trønnes" <noralf@tronnes.org>
To: Stefan Agner <stefan@agner.ch>
Cc: Alison Wang <alison.wang@nxp.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 03/20] drm/fsl-dcu: Use drm_fbdev_generic_setup()
Date: Fri, 28 Sep 2018 16:57:38 +0200	[thread overview]
Message-ID: <db63a87e-bdb7-ee9e-3dd2-4036c1e6f33c@tronnes.org> (raw)
In-Reply-To: <548537bf83d09753dfe7c5da24ff10b9@agner.ch>


Den 28.09.2018 16.11, skrev Stefan Agner:
> On 27.09.2018 23:23, Noralf Trønnes wrote:
>> Den 27.09.2018 23.08, skrev Stefan Agner:
>>> On 08.09.2018 15:46, Noralf Trønnes wrote:
>>>> The CMA helper is already using the drm_fb_helper_generic_probe part of
>>>> the generic fbdev emulation. This patch makes full use of the generic
>>>> fbdev emulation by using its drm_client callbacks. This means that
>>>> drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
>>>> now handled by the emulation code. Additionally fbdev unregister happens
>>>> automatically on drm_dev_unregister().
>>>>
>>>> The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
>>>> driver. This is done to highlight the fact that fbdev emulation is an
>>>> internal client that makes use of the driver, it is not part of the
>>>> driver as such. If fbdev setup fails, an error is printed, but the driver
>>>> succeeds probing.
>>> I think the last sentence is currently not implemented, I think it will
>>> silently succeed probing. Can we add something like this, similar to
>>> tinydrm-core.c?
>>>
>>> 	if (ret)
>>> 		DRM_ERROR("Failed to initialize fbdev: %d\n", ret);
>> It was implemented in the first patch in the series, now applied:
>>
>> drm/fb-helper: Improve error reporting in setup
>> https://cgit.freedesktop.org/drm/drm-misc/commit/?id=6129369a96183f28c7912dfd37cb5869433aa904
> That patch adds error reporting for drm_fb_helper_fbdev_setup().
>
> But you are using drm_fbdev_generic_setup() here...

Yep, this is the callchain:

drm_fbdev_generic_setup()
   -> drm_fbdev_client_hotplug()
     -> drm_fb_helper_fbdev_setup()

The benefit of having setup in the hotplug callback is that now fbdev is
supported in the case where there are no connectors at driver load.

Noralf.

> --
> Stefan
>
>> Noralf.
>>
>>> --
>>> Stefan
>>>
>>>> Cc: Stefan Agner <stefan@agner.ch>
>>>> Cc: Alison Wang <alison.wang@nxp.com>
>>>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
>>>> ---
>>>>    drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 25 +++----------------------
>>>>    drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h |  1 -
>>>>    2 files changed, 3 insertions(+), 23 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>>>> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>>>> index 80232321a244..15816141e5fb 100644
>>>> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>>>> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>>>> @@ -26,6 +26,7 @@
>>>>    #include <drm/drm_atomic_helper.h>
>>>>    #include <drm/drm_crtc_helper.h>
>>>>    #include <drm/drm_fb_cma_helper.h>
>>>> +#include <drm/drm_fb_helper.h>
>>>>    #include <drm/drm_gem_cma_helper.h>
>>>>    #include <drm/drm_modeset_helper.h>
>>>>    @@ -89,20 +90,11 @@ static int fsl_dcu_load(struct drm_device *dev,
>>>> unsigned long flags)
>>>>    			"Invalid legacyfb_depth.  Defaulting to 24bpp\n");
>>>>    		legacyfb_depth = 24;
>>>>    	}
>>>> -	fsl_dev->fbdev = drm_fbdev_cma_init(dev, legacyfb_depth, 1);
>>>> -	if (IS_ERR(fsl_dev->fbdev)) {
>>>> -		ret = PTR_ERR(fsl_dev->fbdev);
>>>> -		fsl_dev->fbdev = NULL;
>>>> -		goto done;
>>>> -	}
>>>>      	return 0;
>>>>    done:
>>>>    	drm_kms_helper_poll_fini(dev);
>>>>    -	if (fsl_dev->fbdev)
>>>> -		drm_fbdev_cma_fini(fsl_dev->fbdev);
>>>> -
>>>>    	drm_mode_config_cleanup(dev);
>>>>    	drm_irq_uninstall(dev);
>>>>    	dev->dev_private = NULL;
>>>> @@ -112,14 +104,9 @@ static int fsl_dcu_load(struct drm_device *dev,
>>>> unsigned long flags)
>>>>      static void fsl_dcu_unload(struct drm_device *dev)
>>>>    {
>>>> -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
>>>> -
>>>>    	drm_atomic_helper_shutdown(dev);
>>>>    	drm_kms_helper_poll_fini(dev);
>>>>    -	if (fsl_dev->fbdev)
>>>> -		drm_fbdev_cma_fini(fsl_dev->fbdev);
>>>> -
>>>>    	drm_mode_config_cleanup(dev);
>>>>    	drm_irq_uninstall(dev);
>>>>    @@ -147,19 +134,11 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
>>>>    	return IRQ_HANDLED;
>>>>    }
>>>>    -static void fsl_dcu_drm_lastclose(struct drm_device *dev)
>>>> -{
>>>> -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
>>>> -
>>>> -	drm_fbdev_cma_restore_mode(fsl_dev->fbdev);
>>>> -}
>>>> -
>>>>    DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
>>>>      static struct drm_driver fsl_dcu_drm_driver = {
>>>>    	.driver_features	= DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET
>>>>    				| DRIVER_PRIME | DRIVER_ATOMIC,
>>>> -	.lastclose		= fsl_dcu_drm_lastclose,
>>>>    	.load			= fsl_dcu_load,
>>>>    	.unload			= fsl_dcu_unload,
>>>>    	.irq_handler		= fsl_dcu_drm_irq,
>>>> @@ -355,6 +334,8 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
>>>>    	if (ret < 0)
>>>>    		goto unref;
>>>>    +	drm_fbdev_generic_setup(drm, legacyfb_depth);
>>>> +
>>>>    	return 0;
>>>>      unref:
>>>> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
>>>> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
>>>> index 93bfb98012d4..cb87bb74cb87 100644
>>>> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
>>>> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
>>>> @@ -191,7 +191,6 @@ struct fsl_dcu_drm_device {
>>>>    	/*protects hardware register*/
>>>>    	spinlock_t irq_lock;
>>>>    	struct drm_device *drm;
>>>> -	struct drm_fbdev_cma *fbdev;
>>>>    	struct drm_crtc crtc;
>>>>    	struct drm_encoder encoder;
>>>>    	struct fsl_dcu_drm_connector connector;

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-09-28 14:57 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-08 13:46 [PATCH 00/20] drm/cma-helper drivers: Use drm_fbdev_generic_setup() Noralf Trønnes
2018-09-08 13:46 ` [PATCH 01/20] drm/fb-helper: Improve error reporting in setup Noralf Trønnes
2018-09-25  9:46   ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 02/20] drm/arc: Use drm_fbdev_generic_setup() Noralf Trønnes
2018-09-10 12:31   ` Alexey Brodkin
2018-09-10 13:00     ` Noralf Trønnes
2018-09-28  7:34   ` Alexey Brodkin
2018-09-28 10:42     ` Noralf Trønnes
2018-10-01  7:56       ` Alexey Brodkin
2018-10-01 12:05         ` Noralf Trønnes
2018-10-01 12:06           ` Alexey Brodkin
2018-09-08 13:46 ` [PATCH 03/20] drm/fsl-dcu: " Noralf Trønnes
2018-09-27 21:08   ` Stefan Agner
2018-09-27 21:23     ` Noralf Trønnes
2018-09-28 14:11       ` Stefan Agner
2018-09-28 14:57         ` Noralf Trønnes [this message]
2018-09-28 15:00           ` Stefan Agner
2018-09-08 13:46 ` [PATCH 04/20] drm/hisilicon/kirin: " Noralf Trønnes
2018-09-08 13:46 ` [PATCH 05/20] drm/meson: " Noralf Trønnes
2018-09-12  9:48   ` Neil Armstrong
2018-09-12  9:56     ` Maxime Ripard
2018-09-12 10:57       ` Noralf Trønnes
2018-09-12 11:06         ` Noralf Trønnes
2018-09-13 13:21           ` Daniel Vetter
2018-09-13 14:26             ` Neil Armstrong
2018-09-13 14:55               ` Daniel Vetter
2018-09-14  8:23                 ` Neil Armstrong
2018-09-14  8:51                   ` Daniel Vetter
2018-09-14 16:33                   ` Noralf Trønnes
2018-09-17  7:53                     ` Neil Armstrong
2018-10-01 12:27                       ` Neil Armstrong
2018-10-03 19:24   ` Neil Armstrong
2018-10-25 15:09     ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 06/20] drm/mxsfb: " Noralf Trønnes
2018-09-08 13:46 ` [PATCH 07/20] drm/rcar-du: " Noralf Trønnes
2018-09-09 14:00   ` Sam Ravnborg
2018-09-09 14:13   ` Laurent Pinchart
2018-09-10 13:02     ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 08/20] drm/arm/hdlcd: " Noralf Trønnes
2018-09-11 12:17   ` Liviu Dudau
2018-09-11 12:41     ` Noralf Trønnes
2018-09-25  9:47     ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 09/20] drm/arm/mali: " Noralf Trønnes
2018-09-11 12:18   ` Liviu Dudau
2018-09-25  9:47     ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 10/20] drm/atmel-hlcdc: " Noralf Trønnes
2018-09-08 13:46 ` [PATCH 11/20] drm/imx: " Noralf Trønnes
2018-09-14 11:42   ` Philipp Zabel
2018-09-25  9:48     ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 12/20] drm/pl111: " Noralf Trønnes
2018-09-13  0:07   ` Eric Anholt
2018-09-25  9:48     ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 13/20] drm/sti: " Noralf Trønnes
2018-09-10  9:39   ` Benjamin Gaignard
2018-09-25  9:48     ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 14/20] drm/stm: " Noralf Trønnes
2018-09-27 11:45   ` Yannick FERTRE
2018-10-25 15:10     ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 15/20] drm/sun4i: " Noralf Trønnes
2018-09-10  7:28   ` Maxime Ripard
2018-09-10 12:57     ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 16/20] drm/tilcdc: " Noralf Trønnes
2018-09-08 13:46 ` [PATCH 17/20] drm/tve200: " Noralf Trønnes
2018-09-18 22:10   ` Linus Walleij
2018-09-25  9:49     ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 18/20] drm/vc4: " Noralf Trønnes
2018-09-13  0:06   ` Eric Anholt
2018-09-25  9:49     ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 19/20] drm/zte: " Noralf Trønnes
2018-09-10  1:23   ` Shawn Guo
2018-09-25  9:49     ` Noralf Trønnes
2018-09-08 13:46 ` [PATCH 20/20] drm/cma-helper: Remove unused fbdev code Noralf Trønnes
2018-09-09 14:09 ` [PATCH 00/20] drm/cma-helper drivers: Use drm_fbdev_generic_setup() Sam Ravnborg
     [not found] ` <606da8a9-a402-5d2e-1f22-d287982f6abc@tronnes.org>
2018-09-11 11:40   ` Noralf Trønnes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=db63a87e-bdb7-ee9e-3dd2-4036c1e6f33c@tronnes.org \
    --to=noralf@tronnes.org \
    --cc=alison.wang@nxp.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=stefan@agner.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.