* [PATCH] drm/exynos: init vblank with real number of crtcs
@ 2014-09-19 12:57 Andrzej Hajda
2014-09-19 15:31 ` Daniel Vetter
2014-10-07 12:27 ` Andrzej Hajda
0 siblings, 2 replies; 5+ messages in thread
From: Andrzej Hajda @ 2014-09-19 12:57 UTC (permalink / raw)
To: Inki Dae
Cc: Andrzej Hajda, Joonyoung Shim, Seung-Woo Kim, Kyungmin Park,
David Airlie, Kukjin Kim, open list:DRM DRIVERS FOR E...,
moderated list:ARM/S5P EXYNOS AR...,
open list, drake, daniel, m.szyprowski
Initialization of vblank with MAX_CRTC caused attempts
to disabling vblanks for non-existing crtcs in case
drm used fewer crtcs. The patch fixes it.
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
drivers/gpu/drm/exynos/exynos_drm_drv.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 9b00e4e..dc4affd 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -94,10 +94,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
/* init kms poll for handling hpd */
drm_kms_helper_poll_init(dev);
- ret = drm_vblank_init(dev, MAX_CRTC);
- if (ret)
- goto err_mode_config_cleanup;
-
/* setup possible_clones. */
exynos_drm_encoder_setup(dev);
@@ -106,22 +102,26 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
/* Try to bind all sub drivers. */
ret = component_bind_all(dev->dev, dev);
if (ret)
- goto err_cleanup_vblank;
+ goto err_mode_config_cleanup;
+
+ ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
+ if (ret)
+ goto err_unbind_all;
/* Probe non kms sub drivers and virtual display driver. */
ret = exynos_drm_device_subdrv_probe(dev);
if (ret)
- goto err_unbind_all;
+ goto err_cleanup_vblank;
/* force connectors detection */
drm_helper_hpd_irq_event(dev);
return 0;
-err_unbind_all:
- component_unbind_all(dev->dev, dev);
err_cleanup_vblank:
drm_vblank_cleanup(dev);
+err_unbind_all:
+ component_unbind_all(dev->dev, dev);
err_mode_config_cleanup:
drm_mode_config_cleanup(dev);
drm_release_iommu_mapping(dev);
@@ -138,8 +138,8 @@ static int exynos_drm_unload(struct drm_device *dev)
exynos_drm_fbdev_fini(dev);
drm_kms_helper_poll_fini(dev);
- component_unbind_all(dev->dev, dev);
drm_vblank_cleanup(dev);
+ component_unbind_all(dev->dev, dev);
drm_mode_config_cleanup(dev);
drm_release_iommu_mapping(dev);
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/exynos: init vblank with real number of crtcs
2014-09-19 12:57 [PATCH] drm/exynos: init vblank with real number of crtcs Andrzej Hajda
@ 2014-09-19 15:31 ` Daniel Vetter
2014-10-07 12:27 ` Andrzej Hajda
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2014-09-19 15:31 UTC (permalink / raw)
To: Andrzej Hajda
Cc: Inki Dae, Joonyoung Shim, Seung-Woo Kim, Kyungmin Park,
David Airlie, Kukjin Kim, open list:DRM DRIVERS FOR E...,
moderated list:ARM/S5P EXYNOS AR...,
open list, drake, daniel, m.szyprowski
On Fri, Sep 19, 2014 at 02:57:20PM +0200, Andrzej Hajda wrote:
> Initialization of vblank with MAX_CRTC caused attempts
> to disabling vblanks for non-existing crtcs in case
> drm used fewer crtcs. The patch fixes it.
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
> drivers/gpu/drm/exynos/exynos_drm_drv.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 9b00e4e..dc4affd 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -94,10 +94,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
> /* init kms poll for handling hpd */
> drm_kms_helper_poll_init(dev);
>
> - ret = drm_vblank_init(dev, MAX_CRTC);
> - if (ret)
> - goto err_mode_config_cleanup;
> -
> /* setup possible_clones. */
> exynos_drm_encoder_setup(dev);
>
> @@ -106,22 +102,26 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
> /* Try to bind all sub drivers. */
> ret = component_bind_all(dev->dev, dev);
> if (ret)
> - goto err_cleanup_vblank;
> + goto err_mode_config_cleanup;
> +
> + ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
Hm, I wonder whether we should have a drm_mode_vblank_init which dtrt here
for kms drivers? Suggestions for a better name welcome ;-)
-Daniel
> + if (ret)
> + goto err_unbind_all;
>
> /* Probe non kms sub drivers and virtual display driver. */
> ret = exynos_drm_device_subdrv_probe(dev);
> if (ret)
> - goto err_unbind_all;
> + goto err_cleanup_vblank;
>
> /* force connectors detection */
> drm_helper_hpd_irq_event(dev);
>
> return 0;
>
> -err_unbind_all:
> - component_unbind_all(dev->dev, dev);
> err_cleanup_vblank:
> drm_vblank_cleanup(dev);
> +err_unbind_all:
> + component_unbind_all(dev->dev, dev);
> err_mode_config_cleanup:
> drm_mode_config_cleanup(dev);
> drm_release_iommu_mapping(dev);
> @@ -138,8 +138,8 @@ static int exynos_drm_unload(struct drm_device *dev)
> exynos_drm_fbdev_fini(dev);
> drm_kms_helper_poll_fini(dev);
>
> - component_unbind_all(dev->dev, dev);
> drm_vblank_cleanup(dev);
> + component_unbind_all(dev->dev, dev);
> drm_mode_config_cleanup(dev);
> drm_release_iommu_mapping(dev);
>
> --
> 1.9.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/exynos: init vblank with real number of crtcs
2014-09-19 12:57 [PATCH] drm/exynos: init vblank with real number of crtcs Andrzej Hajda
2014-09-19 15:31 ` Daniel Vetter
@ 2014-10-07 12:27 ` Andrzej Hajda
2014-10-07 15:28 ` Inki Dae
1 sibling, 1 reply; 5+ messages in thread
From: Andrzej Hajda @ 2014-10-07 12:27 UTC (permalink / raw)
To: Inki Dae
Cc: Joonyoung Shim, Seung-Woo Kim, Kyungmin Park, David Airlie,
Kukjin Kim, open list:DRM DRIVERS FOR E...,
moderated list:ARM/S5P EXYNOS AR...,
open list, drake, daniel, m.szyprowski
Hi Inki,
Gently ping.
Andrzej
On 09/19/2014 02:57 PM, Andrzej Hajda wrote:
> Initialization of vblank with MAX_CRTC caused attempts
> to disabling vblanks for non-existing crtcs in case
> drm used fewer crtcs. The patch fixes it.
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
> drivers/gpu/drm/exynos/exynos_drm_drv.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 9b00e4e..dc4affd 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -94,10 +94,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
> /* init kms poll for handling hpd */
> drm_kms_helper_poll_init(dev);
>
> - ret = drm_vblank_init(dev, MAX_CRTC);
> - if (ret)
> - goto err_mode_config_cleanup;
> -
> /* setup possible_clones. */
> exynos_drm_encoder_setup(dev);
>
> @@ -106,22 +102,26 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
> /* Try to bind all sub drivers. */
> ret = component_bind_all(dev->dev, dev);
> if (ret)
> - goto err_cleanup_vblank;
> + goto err_mode_config_cleanup;
> +
> + ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
> + if (ret)
> + goto err_unbind_all;
>
> /* Probe non kms sub drivers and virtual display driver. */
> ret = exynos_drm_device_subdrv_probe(dev);
> if (ret)
> - goto err_unbind_all;
> + goto err_cleanup_vblank;
>
> /* force connectors detection */
> drm_helper_hpd_irq_event(dev);
>
> return 0;
>
> -err_unbind_all:
> - component_unbind_all(dev->dev, dev);
> err_cleanup_vblank:
> drm_vblank_cleanup(dev);
> +err_unbind_all:
> + component_unbind_all(dev->dev, dev);
> err_mode_config_cleanup:
> drm_mode_config_cleanup(dev);
> drm_release_iommu_mapping(dev);
> @@ -138,8 +138,8 @@ static int exynos_drm_unload(struct drm_device *dev)
> exynos_drm_fbdev_fini(dev);
> drm_kms_helper_poll_fini(dev);
>
> - component_unbind_all(dev->dev, dev);
> drm_vblank_cleanup(dev);
> + component_unbind_all(dev->dev, dev);
> drm_mode_config_cleanup(dev);
> drm_release_iommu_mapping(dev);
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/exynos: init vblank with real number of crtcs
2014-10-07 12:27 ` Andrzej Hajda
@ 2014-10-07 15:28 ` Inki Dae
2014-10-08 1:33 ` Inki Dae
0 siblings, 1 reply; 5+ messages in thread
From: Inki Dae @ 2014-10-07 15:28 UTC (permalink / raw)
To: Andrzej Hajda
Cc: Joonyoung Shim, Seung-Woo Kim, Kyungmin Park, David Airlie,
Kukjin Kim, open list:DRM DRIVERS FOR E...,
moderated list:ARM/S5P EXYNOS AR...,
open list, drake, daniel, m.szyprowski
Sorry for late.
On 2014년 10월 07일 21:27, Andrzej Hajda wrote:
> Hi Inki,
>
> Gently ping.
>
> Andrzej
>
>
> On 09/19/2014 02:57 PM, Andrzej Hajda wrote:
>> Initialization of vblank with MAX_CRTC caused attempts
>> to disabling vblanks for non-existing crtcs in case
>> drm used fewer crtcs. The patch fixes it.
Nice catch~ This patch also resolves unbind issue. When exynos driver is
unbound, disable_vblank callback is called as dev->num_crtcs so if the
number of probed crtc drivers is different from the one of enabled crtc
drivers then it could attempt to disabling vblank for non-existing crtc,
which in turn, null pointer access occurs.
Thanks,
Inki Dae
>>
>> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
>> ---
>> drivers/gpu/drm/exynos/exynos_drm_drv.c | 18 +++++++++---------
>> 1 file changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>> index 9b00e4e..dc4affd 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>> @@ -94,10 +94,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
>> /* init kms poll for handling hpd */
>> drm_kms_helper_poll_init(dev);
>>
>> - ret = drm_vblank_init(dev, MAX_CRTC);
>> - if (ret)
>> - goto err_mode_config_cleanup;
>> -
>> /* setup possible_clones. */
>> exynos_drm_encoder_setup(dev);
>>
>> @@ -106,22 +102,26 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
>> /* Try to bind all sub drivers. */
>> ret = component_bind_all(dev->dev, dev);
>> if (ret)
>> - goto err_cleanup_vblank;
>> + goto err_mode_config_cleanup;
>> +
>> + ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
>> + if (ret)
>> + goto err_unbind_all;
>>
>> /* Probe non kms sub drivers and virtual display driver. */
>> ret = exynos_drm_device_subdrv_probe(dev);
>> if (ret)
>> - goto err_unbind_all;
>> + goto err_cleanup_vblank;
>>
>> /* force connectors detection */
>> drm_helper_hpd_irq_event(dev);
>>
>> return 0;
>>
>> -err_unbind_all:
>> - component_unbind_all(dev->dev, dev);
>> err_cleanup_vblank:
>> drm_vblank_cleanup(dev);
>> +err_unbind_all:
>> + component_unbind_all(dev->dev, dev);
>> err_mode_config_cleanup:
>> drm_mode_config_cleanup(dev);
>> drm_release_iommu_mapping(dev);
>> @@ -138,8 +138,8 @@ static int exynos_drm_unload(struct drm_device *dev)
>> exynos_drm_fbdev_fini(dev);
>> drm_kms_helper_poll_fini(dev);
>>
>> - component_unbind_all(dev->dev, dev);
>> drm_vblank_cleanup(dev);
>> + component_unbind_all(dev->dev, dev);
>> drm_mode_config_cleanup(dev);
>> drm_release_iommu_mapping(dev);
>>
>>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/exynos: init vblank with real number of crtcs
2014-10-07 15:28 ` Inki Dae
@ 2014-10-08 1:33 ` Inki Dae
0 siblings, 0 replies; 5+ messages in thread
From: Inki Dae @ 2014-10-08 1:33 UTC (permalink / raw)
To: Andrzej Hajda
Cc: Joonyoung Shim, Seung-Woo Kim, Kyungmin Park, David Airlie,
Kukjin Kim, open list:DRM DRIVERS FOR E...,
moderated list:ARM/S5P EXYNOS AR...,
open list, drake, daniel, m.szyprowski
On 2014년 10월 08일 00:28, Inki Dae wrote:
>
> Sorry for late.
>
> On 2014년 10월 07일 21:27, Andrzej Hajda wrote:
>> Hi Inki,
>>
>> Gently ping.
>>
>> Andrzej
>>
>>
>> On 09/19/2014 02:57 PM, Andrzej Hajda wrote:
>>> Initialization of vblank with MAX_CRTC caused attempts
>>> to disabling vblanks for non-existing crtcs in case
>>> drm used fewer crtcs. The patch fixes it.
>
> Nice catch~ This patch also resolves unbind issue. When exynos driver is
> unbound, disable_vblank callback is called as dev->num_crtcs so if the
> number of probed crtc drivers is different from the one of enabled crtc
Oops, s/the one of enabled crtc drivers/MAX_CRTC
> drivers then it could attempt to disabling vblank for non-existing crtc,
> which in turn, null pointer access occurs.
>
> Thanks,
> Inki Dae
>
>>>
>>> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
>>> ---
>>> drivers/gpu/drm/exynos/exynos_drm_drv.c | 18 +++++++++---------
>>> 1 file changed, 9 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>>> index 9b00e4e..dc4affd 100644
>>> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>>> @@ -94,10 +94,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
>>> /* init kms poll for handling hpd */
>>> drm_kms_helper_poll_init(dev);
>>>
>>> - ret = drm_vblank_init(dev, MAX_CRTC);
>>> - if (ret)
>>> - goto err_mode_config_cleanup;
>>> -
>>> /* setup possible_clones. */
>>> exynos_drm_encoder_setup(dev);
>>>
>>> @@ -106,22 +102,26 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
>>> /* Try to bind all sub drivers. */
>>> ret = component_bind_all(dev->dev, dev);
>>> if (ret)
>>> - goto err_cleanup_vblank;
>>> + goto err_mode_config_cleanup;
>>> +
>>> + ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
>>> + if (ret)
>>> + goto err_unbind_all;
>>>
>>> /* Probe non kms sub drivers and virtual display driver. */
>>> ret = exynos_drm_device_subdrv_probe(dev);
>>> if (ret)
>>> - goto err_unbind_all;
>>> + goto err_cleanup_vblank;
>>>
>>> /* force connectors detection */
>>> drm_helper_hpd_irq_event(dev);
>>>
>>> return 0;
>>>
>>> -err_unbind_all:
>>> - component_unbind_all(dev->dev, dev);
>>> err_cleanup_vblank:
>>> drm_vblank_cleanup(dev);
>>> +err_unbind_all:
>>> + component_unbind_all(dev->dev, dev);
>>> err_mode_config_cleanup:
>>> drm_mode_config_cleanup(dev);
>>> drm_release_iommu_mapping(dev);
>>> @@ -138,8 +138,8 @@ static int exynos_drm_unload(struct drm_device *dev)
>>> exynos_drm_fbdev_fini(dev);
>>> drm_kms_helper_poll_fini(dev);
>>>
>>> - component_unbind_all(dev->dev, dev);
>>> drm_vblank_cleanup(dev);
>>> + component_unbind_all(dev->dev, dev);
>>> drm_mode_config_cleanup(dev);
>>> drm_release_iommu_mapping(dev);
>>>
>>>
>>
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-10-08 1:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-19 12:57 [PATCH] drm/exynos: init vblank with real number of crtcs Andrzej Hajda
2014-09-19 15:31 ` Daniel Vetter
2014-10-07 12:27 ` Andrzej Hajda
2014-10-07 15:28 ` Inki Dae
2014-10-08 1:33 ` Inki Dae
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).