drm/exynos: fimd: clear channel before enabling iommu
Subsystems (3)
Inki Dae
maintainerPATCH v2 1/1 drm/exynos: fimd: clear channel before enabling iommu
From: Akshu Agrawal <[email protected]>
If any fimd channel was already active, initializing iommu will result in a PAGE FAULT (e.e. u-boot could have turned on the display and not disabled it before the kernel starts). This patch checks if any channel is active before initializing iommu and disables it.
Changelog v2:
- consider SoC without SHADOWCON register
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 70 +++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 20 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +50 -20
@@ -143,6 +143,48 @@ static inline struct fimd_driver_data *drm_fimd_get_driver_data(return (struct fimd_driver_data *)of_id->data; } +static void fimd_wait_for_vblank (struct exynos_drm_manager *mgr) +{ +struct fimd_context *ctx = mgr->ctx; + +if (ctx->suspended) +return ; + +atomic_set (&ctx->wait_vsync_event,1 ); + +/* +* wait for FIMD to signal VSYNC interrupt or return after +* timeout which is set to 50ms (refresh rate of 20). +*/ +if (!wait_event_timeout (ctx->wait_vsync_queue, + !atomic_read (&ctx->wait_vsync_event), +HZ /20 )) +DRM_DEBUG_KMS ("vblank wait timed out.\n" ); +} + + +static void fimd_clear_channel (struct exynos_drm_manager *mgr) +{ +struct fimd_context *ctx = mgr->ctx; +int win, ch_enabled =0 ; + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +/* Check if any channel is enabled. */ +for (win =0 ; win <WINDOWS_NR ; win++) { +u32 val =readl (ctx->regs +SHADOWCON ); +if (val &SHADOWCON_CHx_ENABLE (win)) { + val &= ~SHADOWCON_CHx_ENABLE (win); +writel (val, ctx->regs +SHADOWCON ); + ch_enabled =1 ; + } + } + +/* Wait for vsync, as disable channel takes effect at next vsync */ +if (ch_enabled) +fimd_wait_for_vblank (mgr); +} +static int fimd_mgr_initialize (struct exynos_drm_manager *mgr,struct drm_device *drm_dev,int pipe) {
@@ -169,8 +211,15 @@ static int fimd_mgr_initialize(struct exynos_drm_manager *mgr, drm_dev->vblank_disable_allowed = true;/* attach this sub driver to iommu mapping if supported. */ -if (is_drm_iommu_supported (ctx->drm_dev)) +if (is_drm_iommu_supported (ctx->drm_dev)) { +/* +* If any channel is already active, iommu will throw +* a PAGE FAULT when enabled. So clear any channel if enabled. +*/ +if (ctx->driver_data->has_shadowcon) +fimd_clear_channel (mgr);drm_iommu_attach_device (ctx->drm_dev, ctx->dev); + }return 0 ; }
@@ -324,25 +373,6 @@ static void fimd_disable_vblank(struct exynos_drm_manager *mgr) } } -static void fimd_wait_for_vblank (struct exynos_drm_manager *mgr) -{ -struct fimd_context *ctx = mgr->ctx; - -if (ctx->suspended) -return ; - -atomic_set (&ctx->wait_vsync_event,1 ); - -/* -* wait for FIMD to signal VSYNC interrupt or return after -* timeout which is set to 50ms (refresh rate of 20). -*/ -if (!wait_event_timeout (ctx->wait_vsync_queue, - !atomic_read (&ctx->wait_vsync_event), -HZ /20 )) -DRM_DEBUG_KMS ("vblank wait timed out.\n" ); -} -static void fimd_win_mode_set (struct exynos_drm_manager *mgr,struct exynos_drm_overlay *overlay) {
Signature · 1 line
1.7.9.5
Quoted 26 lines · Inki Dae
From: Akshu Agrawal <[email protected]>
If any fimd channel was already active, initializing iommu will result in a PAGE FAULT (e.e. u-boot could have turned on the display and not disabled it before the kernel starts). This patch checks if any channel is active before initializing iommu and disables it.
Changelog v2:
- consider SoC without SHADOWCON registerSigned-off-by Akshu Agrawal <[email protected]>Signed-off-by Prathyush K <[email protected]>Signed-off-by Inki Dae <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 70 +++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 20 deletions(-)drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0@@ -143,6 +143,48 @@ static inline struct fimd_driver_data *drm_fimd_get_driver_data( return (struct fimd_driver_data *)of_id->data;
drivers/gpu/drm/exynos/exynos_drm_fimd.c static inline struct fimd_driver_data · line 154
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +7
-0} +static void fimd_wait_for_vblank (struct exynos_drm_manager *mgr) +{ +struct fimd_context *ctx = mgr->ctx; + +if (ctx->suspended) +return ; +
Hi Inki,
I think you need this to guarantee that the irq is actually enabled:
drm_vblank_get(ctx->drm_dev, ctx->pipe);
+ atomic_set(&ctx->wait_vsync_event, 1);
drivers/gpu/drm/exynos/exynos_drm_fimd.c static inline struct fimd_driver_data *drm_fimd_get_driver_data(
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +9
-0+ +/* +* wait for FIMD to signal VSYNC interrupt or return after +* timeout which is set to 50ms (refresh rate of 20). +*/ +if (!wait_event_timeout (ctx->wait_vsync_queue, + !atomic_read (&ctx->wait_vsync_event), +HZ /20 )) +DRM_DEBUG_KMS ("vblank wait timed out.\n" );
drm_vblank_put(ctx->drm_dev, ctx->pipe);
Quoted 40 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +29
-1+} + + +static void fimd_clear_channel (struct exynos_drm_manager *mgr) +{ +struct fimd_context *ctx = mgr->ctx; +int win, ch_enabled =0 ; + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +/* Check if any channel is enabled. */ +for (win =0 ; win <WINDOWS_NR ; win++) { +u32 val =readl (ctx->regs +SHADOWCON ); +if (val &SHADOWCON_CHx_ENABLE (win)) { + val &= ~SHADOWCON_CHx_ENABLE (win); +writel (val, ctx->regs +SHADOWCON ); + ch_enabled =1 ; + } + } + +/* Wait for vsync, as disable channel takes effect at next vsync */ +if (ch_enabled) +fimd_wait_for_vblank (mgr); +} +static int fimd_mgr_initialize (struct exynos_drm_manager *mgr,struct drm_device *drm_dev,int pipe) {@@ -169,8 +211,15 @@ static int fimd_mgr_initialize(struct exynos_drm_manager *mgr, drm_dev->vblank_disable_allowed = true;/* attach this sub driver to iommu mapping if supported. */ -if (is_drm_iommu_supported (ctx->drm_dev)) +if (is_drm_iommu_supported (ctx->drm_dev)) { +/* +* If any channel is already active, iommu will throw +* a PAGE FAULT when enabled. So clear any channel if enabled.
drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_mgr_initialize(struct exynos_drm_manager *mgr, · line 220
Quoted 3 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +3
-0+*/ +if (ctx->driver_data->has_shadowcon) +fimd_clear_channel (mgr);
We already disable all overlays at the end of fimd_probe() by calling fimd_clear_win().
Perhaps all that was missing was just waiting until the next vblank to ensure that these clears have all completed?
Best Regards,
-Daniel
drm_iommu_attach_device(ctx->drm_dev, ctx->dev);
Quoted 34 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-19+ }return 0 ; }@@ -324,25 +373,6 @@ static void fimd_disable_vblank(struct exynos_drm_manager *mgr) } } -static void fimd_wait_for_vblank (struct exynos_drm_manager *mgr) -{ -struct fimd_context *ctx = mgr->ctx; - -if (ctx->suspended) -return ; - -atomic_set (&ctx->wait_vsync_event,1 ); - -/* -* wait for FIMD to signal VSYNC interrupt or return after -* timeout which is set to 50ms (refresh rate of 20). -*/ -if (!wait_event_timeout (ctx->wait_vsync_queue, - !atomic_read (&ctx->wait_vsync_event), -HZ /20 )) -DRM_DEBUG_KMS ("vblank wait timed out.\n" ); -} -static void fimd_win_mode_set (struct exynos_drm_manager *mgr,struct exynos_drm_overlay *overlay){
--
1.7.9.5
Quoted 5 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Inki Dae
maintainerHi Daniel,
Please use only text format. :)
Quoted 44 lines
From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Kurtz
Sent: Wednesday, April 30, 2014 1:57 PM
To: Inki Dae
Cc: David Airlie; dri-devel; Akshu Agrawal; Prathyush K
Subject: Re: [PATCH v2] drm/exynos: fimd: clear channel before enabling iommuOn Tue, Apr 29, 2014 at 9:38 AM, Inki Dae <[email protected]> wrote:
From: Akshu Agrawal <[email protected]>If any fimd channel was already active, initializing iommu will result in a PAGE FAULT (e.e. u-boot could have turned on the display and not disabled it before the kernel starts). This patch checks if any channel is active before initializing iommu and disables it.
Changelog v2:
- consider SoC without SHADOWCON registerSigned-off-by Akshu Agrawal <[email protected]>Signed-off-by Prathyush K <[email protected]>Signed-off-by Inki Dae <[email protected]>---
drivers/gpu/drm/exynos/exynos_drm_fimd.c| 70 +++++++++++++++++++++---------1 file changed, 50 insertions(+), 20 deletions(-)drivers/gpu/drm/exynos/exynos_drm_fimd.c +7
-0@@ -143,6 +143,48 @@ static inline struct fimd_driver_data *drm_fimd_get_driver_data(return (struct fimd_driver_data *)of_id->data; } +static void fimd_wait_for_vblank (struct exynos_drm_manager *mgr) +{ +struct fimd_context *ctx = mgr->ctx; + +if (ctx->suspended) +return ; + Hi Inki,
Quoted 2 lines
I think you need this to guarantee that the irq is actually enabled:
Right, it needs to make sure that the irq is enabled.
Quoted 56 lines
drm_vblank_get(ctx->drm_dev, ctx->pipe);drivers/gpu/drm/exynos/exynos_drm_fimd.c +10
-0+atomic_set (&ctx->wait_vsync_event,1 ); + +/* +* wait for FIMD to signal VSYNC interrupt or return after +* timeout which is set to 50ms (refresh rate of 20). +*/ +if (!wait_event_timeout (ctx->wait_vsync_queue, + !atomic_read (&ctx->wait_vsync_event), +HZ /20 )) +DRM_DEBUG_KMS ("vblank wait timed out.\n" );drm_vblank_put(ctx->drm_dev, ctx->pipe);drivers/gpu/drm/exynos/exynos_drm_fimd.c +25
-0+} + + +static void fimd_clear_channel (struct exynos_drm_manager *mgr) +{ +struct fimd_context *ctx = mgr->ctx; +int win, ch_enabled =0 ; + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +/* Check if any channel is enabled. */ +for (win =0 ; win <WINDOWS_NR ; win++) { +u32 val =readl (ctx->regs +SHADOWCON ); +if (val &SHADOWCON_CHx_ENABLE (win)) { + val &= ~SHADOWCON_CHx_ENABLE (win); +writel (val, ctx->regs +SHADOWCON ); + ch_enabled =1 ; + } + } + +/* Wait for vsync, as disable channel takes effect at next vsync */ +if (ch_enabled) +fimd_wait_for_vblank (mgr); +} +static int fimd_mgr_initialize(struct
exynos_drm_manager*mgr,
structdrm_device*drm_dev, int pipe)
{drivers/gpu/drm/exynos/exynos_drm_fimd.c +7
-1@@ -169,8 +211,15 @@ static int fimd_mgr_initialize(struct exynos_drm_manager *mgr, drm_dev->vblank_disable_allowed = true;/* attach this sub driver to iommu mapping if supported. */ -if (is_drm_iommu_supported (ctx->drm_dev)) +if (is_drm_iommu_supported (ctx->drm_dev)) { +/* +* If any channel is already active, iommu will throw +* a PAGE FAULT when enabled. So clear any channel if enabled. +*/ +if (ctx->driver_data->has_shadowcon) +fimd_clear_channel (mgr);
Quoted 3 lines
We already disable all overlays at the end of
fimd_probe()by callingfimd_clear_win().
Perhaps all that was missing was just waiting until the next vblank to ensure that these clears have all completed?
No, fimd_mgr_initialize() will be called at load() so the iommu unit for fimd ip will be tried to be enabled prior to fimd_clear_channel() call - before all dma channels are disabled. In this case, page fault could be incurred if fimd ip was already on by bootloader.
Thanks,
Inki Dae
Quoted 41 lines
Best Regards,
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-1-Daniel drm_iommu_attach_device (ctx->drm_dev, ctx->dev); + }return 0 ;}
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-20@@ -324,25 +373,6 @@ static void fimd_disable_vblank(struct exynos_drm_manager *mgr) } } -static void fimd_wait_for_vblank (struct exynos_drm_manager *mgr) -{ -struct fimd_context *ctx = mgr->ctx; - -if (ctx->suspended) -return ; - -atomic_set (&ctx->wait_vsync_event,1 ); - -/* -* wait for FIMD to signal VSYNC interrupt or return after -* timeout which is set to 50ms (refresh rate of 20). -*/ -if (!wait_event_timeout (ctx->wait_vsync_queue, - !atomic_read (&ctx->wait_vsync_event), -HZ /20 )) -DRM_DEBUG_KMS ("vblank wait timed out.\n" ); -} -static void fimd_win_mode_set (struct exynos_drm_manager *mgr,struct exynos_drm_overlay *overlay) { --1.7.9.5
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 111 lines · Inki Dae
Hi Daniel,
Please use only text format. :)
Quoted 44 lines
From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Kurtz
Sent: Wednesday, April 30, 2014 1:57 PM
To: Inki Dae
Cc: David Airlie; dri-devel; Akshu Agrawal; Prathyush K
Subject: Re: [PATCH v2] drm/exynos: fimd: clear channel before enabling iommuOn Tue, Apr 29, 2014 at 9:38 AM, Inki Dae <[email protected]> wrote:
From: Akshu Agrawal <[email protected]>If any fimd channel was already active, initializing iommu will result in a PAGE FAULT (e.e. u-boot could have turned on the display and not disabled it before the kernel starts). This patch checks if any channel is active before initializing iommu and disables it.
Changelog v2:
- consider SoC without SHADOWCON registerSigned-off-by Akshu Agrawal <[email protected]>Signed-off-by Prathyush K <[email protected]>Signed-off-by Inki Dae <[email protected]>---
drivers/gpu/drm/exynos/exynos_drm_fimd.c| 70 +++++++++++++++++++++---------1 file changed, 50 insertions(+), 20 deletions(-)drivers/gpu/drm/exynos/exynos_drm_fimd.c +7
-0@@ -143,6 +143,48 @@ static inline struct fimd_driver_data *drm_fimd_get_driver_data(return (struct fimd_driver_data *)of_id->data; } +static void fimd_wait_for_vblank (struct exynos_drm_manager *mgr) +{ +struct fimd_context *ctx = mgr->ctx; + +if (ctx->suspended) +return ; + Hi Inki,Quoted 2 lines
I think you need this to guarantee that the irq is actually enabled:
Right, it needs to make sure that the irq is enabled.
Quoted 56 lines
drm_vblank_get(ctx->drm_dev, ctx->pipe);drivers/gpu/drm/exynos/exynos_drm_fimd.c +35
-0+atomic_set (&ctx->wait_vsync_event,1 ); + +/* +* wait for FIMD to signal VSYNC interrupt or return after +* timeout which is set to 50ms (refresh rate of 20). +*/ +if (!wait_event_timeout (ctx->wait_vsync_queue, + !atomic_read (&ctx->wait_vsync_event), +HZ /20 )) +DRM_DEBUG_KMS ("vblank wait timed out.\n" );drm_vblank_put (ctx->drm_dev, ctx->pipe); +} + + +static void fimd_clear_channel (struct exynos_drm_manager *mgr) +{ +struct fimd_context *ctx = mgr->ctx; +int win, ch_enabled =0 ; + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +/* Check if any channel is enabled. */ +for (win =0 ; win <WINDOWS_NR ; win++) { +u32 val =readl (ctx->regs +SHADOWCON ); +if (val &SHADOWCON_CHx_ENABLE (win)) { + val &= ~SHADOWCON_CHx_ENABLE (win); +writel (val, ctx->regs +SHADOWCON ); + ch_enabled =1 ; + } + } + +/* Wait for vsync, as disable channel takes effect at next vsync */ +if (ch_enabled) +fimd_wait_for_vblank (mgr); +} +static int fimd_mgr_initialize(struct
exynos_drm_manager*mgr,
structdrm_device*drm_dev, int pipe)
{drivers/gpu/drm/exynos/exynos_drm_fimd.c +7
-1@@ -169,8 +211,15 @@ static int fimd_mgr_initialize(struct exynos_drm_manager *mgr, drm_dev->vblank_disable_allowed = true;/* attach this sub driver to iommu mapping if supported. */ -if (is_drm_iommu_supported (ctx->drm_dev)) +if (is_drm_iommu_supported (ctx->drm_dev)) { +/* +* If any channel is already active, iommu will throw +* a PAGE FAULT when enabled. So clear any channel if enabled. +*/ +if (ctx->driver_data->has_shadowcon) +fimd_clear_channel (mgr);
Quoted 5 lines
Quoted 3 lines
We already disable all overlays at the end of
fimd_probe()by callingfimd_clear_win().
Perhaps all that was missing was just waiting until the next vblank to ensure that these clears have all completed?No,
fimd_mgr_initialize()will be called atload()so the iommu unit for fimd ip will be tried to be enabled prior tofimd_clear_channel()call - before all dma channels are disabled. In this case, page fault could be incurred if fimd ip was already on by bootloader.
Right. So, I suggest moving drm_iommu_attach_device() from mgr_initialize to fimd_probe(), after clearing the windows and waiting for vblank.
Quoted 47 lines
Thanks,
Inki DaeQuoted 41 lines
Best Regards,
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-1-Daniel drm_iommu_attach_device (ctx->drm_dev, ctx->dev); + }return 0 ;}
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-20@@ -324,25 +373,6 @@ static void fimd_disable_vblank(struct exynos_drm_manager *mgr) } } -static void fimd_wait_for_vblank (struct exynos_drm_manager *mgr) -{ -struct fimd_context *ctx = mgr->ctx; - -if (ctx->suspended) -return ; - -atomic_set (&ctx->wait_vsync_event,1 ); - -/* -* wait for FIMD to signal VSYNC interrupt or return after -* timeout which is set to 50ms (refresh rate of 20). -*/ -if (!wait_event_timeout (ctx->wait_vsync_queue, - !atomic_read (&ctx->wait_vsync_event), -HZ /20 )) -DRM_DEBUG_KMS ("vblank wait timed out.\n" ); -} -static void fimd_win_mode_set (struct exynos_drm_manager *mgr,struct exynos_drm_overlay *overlay) { --1.7.9.5
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Inki Dae
maintainerQuoted 132 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Kurtz
Sent: Wednesday, April 30, 2014 3:21 PM
To: Inki Dae
Cc: David Airlie; dri-devel; Akshu Agrawal; Prathyush K
Subject: Re: [PATCH v2] drm/exynos: fimd: clear channel before enabling iommuQuoted 31 lines · Inki Dae
Hi Daniel,
Please use only text format. :)
Quoted 26 lines
From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Kurtz
Sent: Wednesday, April 30, 2014 1:57 PM
To: Inki Dae
Cc: David Airlie; dri-devel; Akshu Agrawal; Prathyush K
Subject: Re: [PATCH v2] drm/exynos: fimd: clear channel before enabling iommuOn Tue, Apr 29, 2014 at 9:38 AM, Inki Dae <[email protected]> wrote:
From: Akshu Agrawal <[email protected]>If any fimd channel was already active, initializing iommu will result in a PAGE FAULT (e.e. u-boot could have turned on the display and not disabled it before the kernel starts). This patch checks if any channel is active before initializing iommu and disables it.
Changelog v2:
- consider SoC without SHADOWCON registerSigned-off-by Akshu Agrawal <[email protected]>Signed-off-by Prathyush K <[email protected]>Signed-off-by Inki Dae <[email protected]>---
drivers/gpu/drm/exynos/exynos_drm_fimd.c| 70 +++++++++++++++++++++---------
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static inline struct fimd_driver_data
Quoted 8 lines
1 file changed, 50 insertions(+), 20 deletions(-)drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0@@ -143,6 +143,48 @@ static inline struct fimd_driver_data*drm_fimd_get_driver_data(
Quoted 44 lines
Quoted 11 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +6
-0return (struct fimd_driver_data *)of_id->data; } +static void fimd_wait_for_vblank (struct exynos_drm_manager *mgr) { +struct fimd_context *ctx = mgr->ctx; + +if (ctx->suspended) +return ; + Hi Inki,Quoted 2 lines
I think you need this to guarantee that the irq is actually enabled:
Right, it needs to make sure that the irq is enabled.
Quoted 27 lines
drm_vblank_get(ctx->drm_dev, ctx->pipe);drivers/gpu/drm/exynos/exynos_drm_fimd.c +22
-0+atomic_set (&ctx->wait_vsync_event,1 ); + +/* +* wait for FIMD to signal VSYNC interrupt or return after +* timeout which is set to 50ms (refresh rate of 20). +*/ +if (!wait_event_timeout (ctx->wait_vsync_queue, + !atomic_read (&ctx->wait_vsync_event), +HZ /20 )) +DRM_DEBUG_KMS ("vblank wait timed out.\n" );drm_vblank_put (ctx->drm_dev, ctx->pipe); +} + + +static void fimd_clear_channel (struct exynos_drm_manager *mgr) { +struct fimd_context *ctx = mgr->ctx; +int win, ch_enabled =0 ; + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +/* Check if any channel is enabled. */ +for (win =0 ; win <WINDOWS_NR ; win++) { +u32 val =readl (ctx->regs +SHADOWCON );Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static inline struct fimd_driver_data *drm_fimd_get_driver_data(
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8
-0+if (val &SHADOWCON_CHx_ENABLE (win)) { + val &= ~SHADOWCON_CHx_ENABLE (win); +writel (val, ctx->regs +SHADOWCON ); + ch_enabled =1 ; + } + } + +/* Wait for vsync, as disable channel takes effect at next vsync */
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +3
-0+if (ch_enabled) +fimd_wait_for_vblank (mgr); } +static int fimd_mgr_initialize(struct
exynos_drm_manager*mgr,
structdrm_device*drm_dev, int pipe) { @@
-169,8 +211,15 @@ static int fimd_mgr_initialize(struct
exynos_drm_manager*mgr,Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_mgr_initialize(struct exynos_drm_manager *mgr,
Quoted 8 lines
drm_dev->vblank_disable_allowed = true; /* attach this sub driver to iommu mapping if supported. */drivers/gpu/drm/exynos/exynos_drm_fimd.c +4
-1-if (is_drm_iommu_supported (ctx->drm_dev)) +if (is_drm_iommu_supported (ctx->drm_dev)) { +/* +* If any channel is already active, iommu will throw +* a PAGE FAULT when enabled. So clear any channel if enabled.
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +3
-0+*/ +if (ctx->driver_data->has_shadowcon) +fimd_clear_channel (mgr);We already disable all overlays at the end of
fimd_probe()by calling
fimd_clear_win().Quoted 1 line
Quoted 1 line
Perhaps all that was missing was just waiting until the next vblank to
ensure that these clears have all completed?
Quoted 2 lines
Quoted 1 line
Quoted 8 lines
Quoted 1 line
No,
fimd_mgr_initialize()will be called atload()so the iommu unit forfimd ip will be tried to be enabled prior to
fimd_clear_channel()call - before all dma channels are disabled. In this case, page fault could be incurred if fimd ip was already on by bootloader.Right. So, I suggest moving
drm_iommu_attach_device()frommgr_initializetofimd_probe(), after clearing the windows and waiting for vblank.
It seems more clear. I tried to take care of patch already posted so I didn't consider a better way . :)
Thanks,
Inki Dae
Quoted 46 lines
Quoted 7 lines
Thanks,
Inki DaeQuoted 3 lines
Best Regards,
-DanielQuoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_disable_vblank(struct
Quoted 6 lines
drm_iommu_attach_device(ctx->drm_dev, ctx->dev);+ }
return 0; }drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0@@ -324,25 +373,6 @@ static void fimd_disable_vblank(struct
exynos_drm_manager*mgr)Quoted 32 lines
Quoted 30 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-19} } -static void fimd_wait_for_vblank(struct exynos_drm_manager *mgr) -{ -struct fimd_context *ctx = mgr->ctx; - -if (ctx->suspended) -return ; - -atomic_set (&ctx->wait_vsync_event,1 ); - -/* -* wait for FIMD to signal VSYNC interrupt or return after -* timeout which is set to 50ms (refresh rate of 20). -*/ -if (!wait_event_timeout (ctx->wait_vsync_queue, - !atomic_read (&ctx->wait_vsync_event), -HZ /20 )) -DRM_DEBUG_KMS ("vblank wait timed out.\n" ); -} -static void fimd_win_mode_set (struct exynos_drm_manager *mgr,struct exynos_drm_overlay *overlay) { --1.7.9.5
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Inki Dae
maintainerQuoted 132 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Kurtz
Sent: Wednesday, April 30, 2014 3:21 PM
To: Inki Dae
Cc: David Airlie; dri-devel; Akshu Agrawal; Prathyush K
Subject: Re: [PATCH v2] drm/exynos: fimd: clear channel before enabling iommuQuoted 31 lines · Inki Dae
Hi Daniel,
Please use only text format. :)
Quoted 26 lines
From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Kurtz
Sent: Wednesday, April 30, 2014 1:57 PM
To: Inki Dae
Cc: David Airlie; dri-devel; Akshu Agrawal; Prathyush K
Subject: Re: [PATCH v2] drm/exynos: fimd: clear channel before enabling iommuOn Tue, Apr 29, 2014 at 9:38 AM, Inki Dae <[email protected]> wrote:
From: Akshu Agrawal <[email protected]>If any fimd channel was already active, initializing iommu will result in a PAGE FAULT (e.e. u-boot could have turned on the display and not disabled it before the kernel starts). This patch checks if any channel is active before initializing iommu and disables it.
Changelog v2:
- consider SoC without SHADOWCON registerSigned-off-by Akshu Agrawal <[email protected]>Signed-off-by Prathyush K <[email protected]>Signed-off-by Inki Dae <[email protected]>---
drivers/gpu/drm/exynos/exynos_drm_fimd.c| 70 +++++++++++++++++++++---------
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static inline struct fimd_driver_data
Quoted 8 lines
1 file changed, 50 insertions(+), 20 deletions(-)drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0@@ -143,6 +143,48 @@ static inline struct fimd_driver_data*drm_fimd_get_driver_data(
Quoted 44 lines
Quoted 11 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +6
-0return (struct fimd_driver_data *)of_id->data; } +static void fimd_wait_for_vblank (struct exynos_drm_manager *mgr) { +struct fimd_context *ctx = mgr->ctx; + +if (ctx->suspended) +return ; + Hi Inki,Quoted 2 lines
I think you need this to guarantee that the irq is actually enabled:
Right, it needs to make sure that the irq is enabled.
Quoted 27 lines
drm_vblank_get(ctx->drm_dev, ctx->pipe);drivers/gpu/drm/exynos/exynos_drm_fimd.c +22
-0+atomic_set (&ctx->wait_vsync_event,1 ); + +/* +* wait for FIMD to signal VSYNC interrupt or return after +* timeout which is set to 50ms (refresh rate of 20). +*/ +if (!wait_event_timeout (ctx->wait_vsync_queue, + !atomic_read (&ctx->wait_vsync_event), +HZ /20 )) +DRM_DEBUG_KMS ("vblank wait timed out.\n" );drm_vblank_put (ctx->drm_dev, ctx->pipe); +} + + +static void fimd_clear_channel (struct exynos_drm_manager *mgr) { +struct fimd_context *ctx = mgr->ctx; +int win, ch_enabled =0 ; + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +/* Check if any channel is enabled. */ +for (win =0 ; win <WINDOWS_NR ; win++) { +u32 val =readl (ctx->regs +SHADOWCON );Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static inline struct fimd_driver_data *drm_fimd_get_driver_data(
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8
-0+if (val &SHADOWCON_CHx_ENABLE (win)) { + val &= ~SHADOWCON_CHx_ENABLE (win); +writel (val, ctx->regs +SHADOWCON ); + ch_enabled =1 ; + } + } + +/* Wait for vsync, as disable channel takes effect at next vsync */
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +3
-0+if (ch_enabled) +fimd_wait_for_vblank (mgr); } +static int fimd_mgr_initialize(struct
exynos_drm_manager*mgr,
structdrm_device*drm_dev, int pipe) { @@
-169,8 +211,15 @@ static int fimd_mgr_initialize(struct
exynos_drm_manager*mgr,Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_mgr_initialize(struct exynos_drm_manager *mgr,
Quoted 8 lines
drm_dev->vblank_disable_allowed = true; /* attach this sub driver to iommu mapping if supported. */drivers/gpu/drm/exynos/exynos_drm_fimd.c +4
-1-if (is_drm_iommu_supported (ctx->drm_dev)) +if (is_drm_iommu_supported (ctx->drm_dev)) { +/* +* If any channel is already active, iommu will throw +* a PAGE FAULT when enabled. So clear any channel if enabled.
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +3
-0+*/ +if (ctx->driver_data->has_shadowcon) +fimd_clear_channel (mgr);We already disable all overlays at the end of
fimd_probe()by calling
fimd_clear_win().Quoted 1 line
Quoted 1 line
Perhaps all that was missing was just waiting until the next vblank to
ensure that these clears have all completed?
Quoted 2 lines
Quoted 1 line
Quoted 8 lines
Quoted 1 line
No,
fimd_mgr_initialize()will be called atload()so the iommu unit forfimd ip will be tried to be enabled prior to
fimd_clear_channel()call - before all dma channels are disabled. In this case, page fault could be incurred if fimd ip was already on by bootloader.Right. So, I suggest moving
drm_iommu_attach_device()frommgr_initializetofimd_probe(), after clearing the windows and waiting for vblank.
Again,
Good idea but it doesn't consider drm_device object that it needs to check if iommu is supported or not - if iommu is not supported, drm_iommu_attach_device() shouldn't be called. At probe(), we couldn't get drm_device object. Anyway, there may be another better way.
Thanks,
Inki Dae
Quoted 46 lines
Quoted 7 lines
Thanks,
Inki DaeQuoted 3 lines
Best Regards,
-DanielQuoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_disable_vblank(struct
Quoted 6 lines
drm_iommu_attach_device(ctx->drm_dev, ctx->dev);+ }
return 0; }drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0@@ -324,25 +373,6 @@ static void fimd_disable_vblank(struct
exynos_drm_manager*mgr)Quoted 32 lines
Quoted 30 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-19} } -static void fimd_wait_for_vblank(struct exynos_drm_manager *mgr) -{ -struct fimd_context *ctx = mgr->ctx; - -if (ctx->suspended) -return ; - -atomic_set (&ctx->wait_vsync_event,1 ); - -/* -* wait for FIMD to signal VSYNC interrupt or return after -* timeout which is set to 50ms (refresh rate of 20). -*/ -if (!wait_event_timeout (ctx->wait_vsync_queue, - !atomic_read (&ctx->wait_vsync_event), -HZ /20 )) -DRM_DEBUG_KMS ("vblank wait timed out.\n" ); -} -static void fimd_win_mode_set (struct exynos_drm_manager *mgr,struct exynos_drm_overlay *overlay) { --1.7.9.5
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel