[PATCH v2] drm/sysfb: Use iosys_map_memset() to clear buffer

Chen-Yu Tsai posted 1 patch 3 weeks, 1 day ago
drivers/gpu/drm/sysfb/drm_sysfb_modeset.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
[PATCH v2] drm/sysfb: Use iosys_map_memset() to clear buffer
Posted by Chen-Yu Tsai 3 weeks, 1 day ago
The atomic disable in drm/sysfb currently clears the buffer using
memset_io(). Since the mapping is provided in a |struct iosys_map|,
it is better to use the related API instead of extracting the vaddr.
This is mentioned as a TODO item.

Switch to iosys_map_memset(), which takes the mapping as well as an
offset into the mapping.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
Changes since v1:
- Rebased onto drm-misc-next
- second patch is gone as it was already implemented
---
 drivers/gpu/drm/sysfb/drm_sysfb_modeset.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c b/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
index b92cc4b7d2ad..13df0925163a 100644
--- a/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
+++ b/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
@@ -375,8 +375,6 @@ void drm_sysfb_plane_helper_atomic_disable(struct drm_plane *plane,
 {
 	struct drm_device *dev = plane->dev;
 	struct drm_sysfb_device *sysfb = to_drm_sysfb_device(dev);
-	struct iosys_map dst = sysfb->fb_addr;
-	void __iomem *dst_vmap = dst.vaddr_iomem; /* TODO: Use mapping abstraction */
 	unsigned int dst_pitch = sysfb->fb_pitch;
 	const struct drm_format_info *dst_format = sysfb->fb_format;
 	struct drm_rect dst_clip;
@@ -396,10 +394,8 @@ void drm_sysfb_plane_helper_atomic_disable(struct drm_plane *plane,
 		return;
 
 	/* Clear buffer to black if disabled */
-	for (i = 0; i < lines; ++i) {
-		memset_io(dst_vmap, 0, dst_size);
-		dst_vmap += dst_pitch;
-	}
+	for (i = 0; i < lines; ++i)
+		iosys_map_memset(&sysfb->fb_addr, dst_pitch * i, 0, dst_size);
 
 	drm_dev_exit(idx);
 }
-- 
2.55.0.970.g62bdec98f9-goog
Re: [PATCH v2] drm/sysfb: Use iosys_map_memset() to clear buffer
Posted by Chen-Yu Tsai 1 week, 4 days ago
On Thu, 03 Sep 2026 16:48:22 +0800, Chen-Yu Tsai wrote:
> The atomic disable in drm/sysfb currently clears the buffer using
> memset_io(). Since the mapping is provided in a |struct iosys_map|,
> it is better to use the related API instead of extracting the vaddr.
> This is mentioned as a TODO item.
> 
> Switch to iosys_map_memset(), which takes the mapping as well as an
> offset into the mapping.
> 
> [...]

Applied to drm-misc-next in drm-misc, thanks!

[1/1] drm/sysfb: Use iosys_map_memset() to clear buffer
      commit: b57c9b345d18d67902625355c45caf322e2ab794

Best regards,
-- 
Chen-Yu Tsai <wenst@chromium.org>
Re: [PATCH v2] drm/sysfb: Use iosys_map_memset() to clear buffer
Posted by Thomas Zimmermann 2 weeks, 2 days ago

Am 03.09.26 um 10:48 schrieb Chen-Yu Tsai:
> The atomic disable in drm/sysfb currently clears the buffer using
> memset_io(). Since the mapping is provided in a |struct iosys_map|,
> it is better to use the related API instead of extracting the vaddr.
> This is mentioned as a TODO item.
>
> Switch to iosys_map_memset(), which takes the mapping as well as an
> offset into the mapping.
>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
> Changes since v1:
> - Rebased onto drm-misc-next
> - second patch is gone as it was already implemented
> ---
>   drivers/gpu/drm/sysfb/drm_sysfb_modeset.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c b/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
> index b92cc4b7d2ad..13df0925163a 100644
> --- a/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
> +++ b/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
> @@ -375,8 +375,6 @@ void drm_sysfb_plane_helper_atomic_disable(struct drm_plane *plane,
>   {
>   	struct drm_device *dev = plane->dev;
>   	struct drm_sysfb_device *sysfb = to_drm_sysfb_device(dev);
> -	struct iosys_map dst = sysfb->fb_addr;
> -	void __iomem *dst_vmap = dst.vaddr_iomem; /* TODO: Use mapping abstraction */
>   	unsigned int dst_pitch = sysfb->fb_pitch;
>   	const struct drm_format_info *dst_format = sysfb->fb_format;
>   	struct drm_rect dst_clip;
> @@ -396,10 +394,8 @@ void drm_sysfb_plane_helper_atomic_disable(struct drm_plane *plane,
>   		return;
>   
>   	/* Clear buffer to black if disabled */
> -	for (i = 0; i < lines; ++i) {
> -		memset_io(dst_vmap, 0, dst_size);
> -		dst_vmap += dst_pitch;
> -	}
> +	for (i = 0; i < lines; ++i)
> +		iosys_map_memset(&sysfb->fb_addr, dst_pitch * i, 0, dst_size);
>   
>   	drm_dev_exit(idx);
>   }

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)