[PATCH v3 09/11] drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini()

Noralf Trønnes noralf at tronnes.org
Thu Sep 27 12:23:54 UTC 2018


Den 26.09.2018 22.26, skrev Stefan Agner:
> On 08.12.2017 20:37, Noralf Trønnes wrote:
>> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
>> the fact that drm_device holds a pointer to the drm_fb_helper structure.
>> This means that the driver doesn't have to keep track of that.
>> Also use the drm_fb_helper functions directly.
>> Remove console.h inclusion which was forgotten when converting to the
>> suspend/resume helpers.
> Just realized this never made it upstream. I guess its still valid and
> could be applied?

It has been superseeded by this patch:

[03/20] drm/fsl-dcu: Use drm_fbdev_generic_setup()
https://patchwork.freedesktop.org/patch/247865/

Noralf.

> --
> Stefan
>
>> Cc: Stefan Agner <stefan at agner.ch>
>> Cc: Alison Wang <alison.wang at freescale.com>
>> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
>> ---
>>   drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 ++++++--------------------
>>   drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h |  1 -
>>   2 files changed, 6 insertions(+), 21 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..e487a2002783 100644
>> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>> @@ -11,7 +11,6 @@
>>   
>>   #include <linux/clk.h>
>>   #include <linux/clk-provider.h>
>> -#include <linux/console.h>
>>   #include <linux/io.h>
>>   #include <linux/mfd/syscon.h>
>>   #include <linux/mm.h>
>> @@ -25,6 +24,7 @@
>>   #include <drm/drmP.h>
>>   #include <drm/drm_atomic_helper.h>
>>   #include <drm/drm_crtc_helper.h>
>> +#include <drm/drm_fb_helper.h>
>>   #include <drm/drm_fb_cma_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_modeset_helper.h>
>> @@ -89,19 +89,15 @@ 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;
>> +	ret = drm_fb_cma_fbdev_init(dev, legacyfb_depth, 1);
>> +	if (ret)
>>   		goto done;
>> -	}
>>   
>>   	return 0;
>>   done:
>>   	drm_kms_helper_poll_fini(dev);
>>   
>> -	if (fsl_dev->fbdev)
>> -		drm_fbdev_cma_fini(fsl_dev->fbdev);
>> +	drm_fb_cma_fbdev_fini(dev);
>>   
>>   	drm_mode_config_cleanup(dev);
>>   	drm_irq_uninstall(dev);
>> @@ -112,13 +108,10 @@ 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_fb_cma_fbdev_fini(dev);
>>   
>>   	drm_mode_config_cleanup(dev);
>>   	drm_irq_uninstall(dev);
>> @@ -147,19 +140,12 @@ 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,
>> +	.lastclose		= drm_fb_helper_lastclose,
>>   	.load			= fsl_dcu_load,
>>   	.unload			= fsl_dcu_unload,
>>   	.irq_handler		= fsl_dcu_drm_irq,
>> 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;



More information about the dri-devel mailing list