diff mbox series

[v2,4/8] drm/fb-helper: Support smem_len in deferred I/O

Message ID 20230320150751.20399-5-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm/fbdev-generic: Mandatory shadow buffering | expand

Commit Message

Thomas Zimmermann March 20, 2023, 3:07 p.m. UTC
The size of the framebuffer can either be stored in screen_info or
smem_len. Take both into account in the deferred I/O code.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_fb_helper.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Javier Martinez Canillas March 20, 2023, 4:31 p.m. UTC | #1
Thomas Zimmermann <tzimmermann@suse.de> writes:

> The size of the framebuffer can either be stored in screen_info or
> smem_len. Take both into account in the deferred I/O code.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Sui Jingfeng March 22, 2023, 7:39 a.m. UTC | #2
Yet, better to clarify which one should be used, not two.

Tested-by: Sui Jingfeng <suijingfeng@loongson.cn>


On 2023/3/20 23:07, Thomas Zimmermann wrote:
> The size of the framebuffer can either be stored in screen_info or
> smem_len. Take both into account in the deferred I/O code.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
>   drivers/gpu/drm/drm_fb_helper.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 7e96ed9efdb5..bb0b25209b3e 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -672,7 +672,7 @@ static void drm_fb_helper_memory_range_to_clip(struct fb_info *info, off_t off,
>   void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist)
>   {
>   	struct drm_fb_helper *helper = info->par;
> -	unsigned long start, end, min_off, max_off;
> +	unsigned long start, end, min_off, max_off, total_size;
>   	struct fb_deferred_io_pageref *pageref;
>   	struct drm_rect damage_area;
>   
> @@ -690,7 +690,11 @@ void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagerefli
>   	 * of the screen and account for non-existing scanlines. Hence,
>   	 * keep the covered memory area within the screen buffer.
>   	 */
> -	max_off = min(max_off, info->screen_size);
> +	if (info->screen_size)
> +		total_size = info->screen_size;
> +	else
> +		total_size = info->fix.smem_len;
> +	max_off = min(max_off, total_size);
>   
>   	if (min_off < max_off) {
>   		drm_fb_helper_memory_range_to_clip(info, min_off, max_off - min_off, &damage_area);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 7e96ed9efdb5..bb0b25209b3e 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -672,7 +672,7 @@  static void drm_fb_helper_memory_range_to_clip(struct fb_info *info, off_t off,
 void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist)
 {
 	struct drm_fb_helper *helper = info->par;
-	unsigned long start, end, min_off, max_off;
+	unsigned long start, end, min_off, max_off, total_size;
 	struct fb_deferred_io_pageref *pageref;
 	struct drm_rect damage_area;
 
@@ -690,7 +690,11 @@  void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagerefli
 	 * of the screen and account for non-existing scanlines. Hence,
 	 * keep the covered memory area within the screen buffer.
 	 */
-	max_off = min(max_off, info->screen_size);
+	if (info->screen_size)
+		total_size = info->screen_size;
+	else
+		total_size = info->fix.smem_len;
+	max_off = min(max_off, total_size);
 
 	if (min_off < max_off) {
 		drm_fb_helper_memory_range_to_clip(info, min_off, max_off - min_off, &damage_area);