[PATCH v2 04/12] drm/rockchip: vop2: clear afbc en and transform bit for cluster window at linear mode

Andy Yan posted 12 patches 2 years, 1 month ago
There is a newer version of this series
[PATCH v2 04/12] drm/rockchip: vop2: clear afbc en and transform bit for cluster window at linear mode
Posted by Andy Yan 2 years, 1 month ago
From: Andy Yan <andy.yan@rock-chips.com>

The enable bit and transform offset of cluster windows should be
cleared when it work at linear mode, or we may have a iommu fault
issue.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---

(no changes since v1)

 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index 639dfebc6bd1..a019cc9bbd54 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -1312,6 +1312,11 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
 		vop2_win_write(win, VOP2_WIN_AFBC_ROTATE_270, rotate_270);
 		vop2_win_write(win, VOP2_WIN_AFBC_ROTATE_90, rotate_90);
 	} else {
+		if (vop2_cluster_window(win)) {
+			vop2_win_write(win, VOP2_WIN_AFBC_ENABLE, 0);
+			vop2_win_write(win, VOP2_WIN_AFBC_TRANSFORM_OFFSET, 0);
+		}
+
 		vop2_win_write(win, VOP2_WIN_YRGB_VIR, DIV_ROUND_UP(fb->pitches[0], 4));
 	}
 
-- 
2.34.1
Re: [PATCH v2 04/12] drm/rockchip: vop2: clear afbc en and transform bit for cluster window at linear mode
Posted by Heiko Stübner 2 years, 1 month ago
Am Mittwoch, 22. November 2023, 13:54:25 CET schrieb Andy Yan:
> From: Andy Yan <andy.yan@rock-chips.com>
> 
> The enable bit and transform offset of cluster windows should be
> cleared when it work at linear mode, or we may have a iommu fault
> issue.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>

I guess same here?

Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver")
Re: [PATCH v2 04/12] drm/rockchip: vop2: clear afbc en and transform bit for cluster window at linear mode
Posted by Andy Yan 2 years, 1 month ago
Hi Heiko:

On 11/27/23 23:02, Heiko Stübner wrote:
> Am Mittwoch, 22. November 2023, 13:54:25 CET schrieb Andy Yan:
>> From: Andy Yan <andy.yan@rock-chips.com>
>>
>> The enable bit and transform offset of cluster windows should be
>> cleared when it work at linear mode, or we may have a iommu fault
>> issue.
>>
>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> I guess same here?
>
> Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver")


I'm not sure if we need a Fixes tag here,  in fact this issue never happens on

rk3566/8 , because the cluster windows of rk356x only support afbc format,

they don't have a chance to switch between afbc and linear mode.

Of course, the lack support of linear mode of rk356x cluster windows is a thoughtless

of IC design, if it really support both afbc and linear format, we indeed need this fix.

The situation is the same as patch 03/12.

So I hope follow your advice, if it need a Fixes tag here.

>
>
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: [PATCH v2 04/12] drm/rockchip: vop2: clear afbc en and transform bit for cluster window at linear mode
Posted by Heiko Stübner 2 years, 1 month ago
Am Dienstag, 28. November 2023, 09:03:46 CET schrieb Andy Yan:
> Hi Heiko:
> 
> On 11/27/23 23:02, Heiko Stübner wrote:
> > Am Mittwoch, 22. November 2023, 13:54:25 CET schrieb Andy Yan:
> >> From: Andy Yan <andy.yan@rock-chips.com>
> >>
> >> The enable bit and transform offset of cluster windows should be
> >> cleared when it work at linear mode, or we may have a iommu fault
> >> issue.
> >>
> >> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> > I guess same here?
> >
> > Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver")
> 
> 
> I'm not sure if we need a Fixes tag here,  in fact this issue never happens on
> 
> rk3566/8 , because the cluster windows of rk356x only support afbc format,
> 
> they don't have a chance to switch between afbc and linear mode.
> 
> Of course, the lack support of linear mode of rk356x cluster windows is a thoughtless
> 
> of IC design, if it really support both afbc and linear format, we indeed need this fix.
> 
> The situation is the same as patch 03/12.
> 
> So I hope follow your advice, if it need a Fixes tag here.

ah ok, thanks for the explanation. Then I guess we don't need a fixes tag
when the rk3568 is not affected by this.

Same for the other patch. If you're re-sending you could add this information
to the commit message though. (existing support for rk3568 only supports
afbc cluster windows and is therefore not affected)


Thanks
Heiko
Re: [PATCH v2 04/12] drm/rockchip: vop2: clear afbc en and transform bit for cluster window at linear mode
Posted by Andy Yan 2 years, 1 month ago
Hi Heiko:

On 11/28/23 16:30, Heiko Stübner wrote:
> Am Dienstag, 28. November 2023, 09:03:46 CET schrieb Andy Yan:
>> Hi Heiko:
>>
>> On 11/27/23 23:02, Heiko Stübner wrote:
>>> Am Mittwoch, 22. November 2023, 13:54:25 CET schrieb Andy Yan:
>>>> From: Andy Yan <andy.yan@rock-chips.com>
>>>>
>>>> The enable bit and transform offset of cluster windows should be
>>>> cleared when it work at linear mode, or we may have a iommu fault
>>>> issue.
>>>>
>>>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>>> I guess same here?
>>>
>>> Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver")
>>
>> I'm not sure if we need a Fixes tag here,  in fact this issue never happens on
>>
>> rk3566/8 , because the cluster windows of rk356x only support afbc format,
>>
>> they don't have a chance to switch between afbc and linear mode.
>>
>> Of course, the lack support of linear mode of rk356x cluster windows is a thoughtless
>>
>> of IC design, if it really support both afbc and linear format, we indeed need this fix.
>>
>> The situation is the same as patch 03/12.
>>
>> So I hope follow your advice, if it need a Fixes tag here.
> ah ok, thanks for the explanation. Then I guess we don't need a fixes tag
> when the rk3568 is not affected by this.
>
> Same for the other patch. If you're re-sending you could add this information
> to the commit message though. (existing support for rk3568 only supports
> afbc cluster windows and is therefore not affected)


Ok, will done.

>
>
> Thanks
> Heiko
>
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: [PATCH v2 04/12] drm/rockchip: vop2: clear afbc en and transform bit for cluster window at linear mode
Posted by Sascha Hauer 2 years, 1 month ago
On Wed, Nov 22, 2023 at 08:54:25PM +0800, Andy Yan wrote:
> From: Andy Yan <andy.yan@rock-chips.com>
> 
> The enable bit and transform offset of cluster windows should be
> cleared when it work at linear mode, or we may have a iommu fault
> issue.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>

Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>

Sascha

> ---
> 
> (no changes since v1)
> 
>  drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> index 639dfebc6bd1..a019cc9bbd54 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> @@ -1312,6 +1312,11 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
>  		vop2_win_write(win, VOP2_WIN_AFBC_ROTATE_270, rotate_270);
>  		vop2_win_write(win, VOP2_WIN_AFBC_ROTATE_90, rotate_90);
>  	} else {
> +		if (vop2_cluster_window(win)) {
> +			vop2_win_write(win, VOP2_WIN_AFBC_ENABLE, 0);
> +			vop2_win_write(win, VOP2_WIN_AFBC_TRANSFORM_OFFSET, 0);
> +		}
> +
>  		vop2_win_write(win, VOP2_WIN_YRGB_VIR, DIV_ROUND_UP(fb->pitches[0], 4));
>  	}
>  
> -- 
> 2.34.1
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |