diff mbox series

[v2,02/19] fbcon: Move fbcon_bmove(_rec) functions

Message ID 20220208210824.2238981-3-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show
Series fbcon patches, take two | expand

Commit Message

Daniel Vetter Feb. 8, 2022, 9:08 p.m. UTC
Avoids two forward declarations, and more importantly, matches what
I've done in my fbcon scrolling restore patches - so I need this to
avoid a bunch of conflicts in rebasing since we ended up merging
Helge's series instead.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Du Cheng <ducheng2@gmail.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Claudio Suarez <cssk@net-c.es>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/video/fbdev/core/fbcon.c | 134 +++++++++++++++----------------
 1 file changed, 65 insertions(+), 69 deletions(-)

Comments

Javier Martinez Canillas Feb. 8, 2022, 11:06 p.m. UTC | #1
On 2/8/22 22:08, Daniel Vetter wrote:
> Avoids two forward declarations, and more importantly, matches what
> I've done in my fbcon scrolling restore patches - so I need this to
> avoid a bunch of conflicts in rebasing since we ended up merging
> Helge's series instead.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Best regards,
Thomas Zimmermann Feb. 10, 2022, 11:17 a.m. UTC | #2
Am 08.02.22 um 22:08 schrieb Daniel Vetter:
> Avoids two forward declarations, and more importantly, matches what
> I've done in my fbcon scrolling restore patches - so I need this to
> avoid a bunch of conflicts in rebasing since we ended up merging
> Helge's series instead.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Helge Deller <deller@gmx.de>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Du Cheng <ducheng2@gmail.com>
> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Cc: Claudio Suarez <cssk@net-c.es>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

> ---
>   drivers/video/fbdev/core/fbcon.c | 134 +++++++++++++++----------------
>   1 file changed, 65 insertions(+), 69 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 235eaab37d84..e925bb608e25 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -164,15 +164,11 @@ static int fbcon_cursor_noblink;
>    */
>   
>   static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
> -static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
> -			int height, int width);
>   static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
>   
>   /*
>    *  Internal routines
>    */
> -static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
> -			    int dy, int dx, int height, int width, u_int y_break);
>   static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
>   			   int unit);
>   static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
> @@ -1667,6 +1663,71 @@ static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p,
>   	}
>   }
>   
> +static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
> +			    int dy, int dx, int height, int width, u_int y_break)
> +{
> +	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
> +	struct fbcon_ops *ops = info->fbcon_par;
> +	u_int b;
> +
> +	if (sy < y_break && sy + height > y_break) {
> +		b = y_break - sy;
> +		if (dy < sy) {	/* Avoid trashing self */
> +			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
> +					y_break);
> +			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
> +					height - b, width, y_break);
> +		} else {
> +			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
> +					height - b, width, y_break);
> +			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
> +					y_break);
> +		}
> +		return;
> +	}
> +
> +	if (dy < y_break && dy + height > y_break) {
> +		b = y_break - dy;
> +		if (dy < sy) {	/* Avoid trashing self */
> +			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
> +					y_break);
> +			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
> +					height - b, width, y_break);
> +		} else {
> +			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
> +					height - b, width, y_break);
> +			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
> +					y_break);
> +		}
> +		return;
> +	}
> +	ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
> +		   height, width);
> +}
> +
> +static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
> +			int height, int width)
> +{
> +	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
> +	struct fbcon_display *p = &fb_display[vc->vc_num];
> +
> +	if (fbcon_is_inactive(vc, info))
> +		return;
> +
> +	if (!width || !height)
> +		return;
> +
> +	/*  Split blits that cross physical y_wrap case.
> +	 *  Pathological case involves 4 blits, better to use recursive
> +	 *  code rather than unrolled case
> +	 *
> +	 *  Recursive invocations don't need to erase the cursor over and
> +	 *  over again, so we use fbcon_bmove_rec()
> +	 */
> +	fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width,
> +			p->vrows - p->yscroll);
> +}
> +
>   static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
>   		enum con_scroll dir, unsigned int count)
>   {
> @@ -1867,71 +1928,6 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
>   }
>   
>   
> -static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
> -			int height, int width)
> -{
> -	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
> -	struct fbcon_display *p = &fb_display[vc->vc_num];
> -
> -	if (fbcon_is_inactive(vc, info))
> -		return;
> -
> -	if (!width || !height)
> -		return;
> -
> -	/*  Split blits that cross physical y_wrap case.
> -	 *  Pathological case involves 4 blits, better to use recursive
> -	 *  code rather than unrolled case
> -	 *
> -	 *  Recursive invocations don't need to erase the cursor over and
> -	 *  over again, so we use fbcon_bmove_rec()
> -	 */
> -	fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width,
> -			p->vrows - p->yscroll);
> -}
> -
> -static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
> -			    int dy, int dx, int height, int width, u_int y_break)
> -{
> -	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
> -	struct fbcon_ops *ops = info->fbcon_par;
> -	u_int b;
> -
> -	if (sy < y_break && sy + height > y_break) {
> -		b = y_break - sy;
> -		if (dy < sy) {	/* Avoid trashing self */
> -			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
> -					y_break);
> -			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
> -					height - b, width, y_break);
> -		} else {
> -			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
> -					height - b, width, y_break);
> -			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
> -					y_break);
> -		}
> -		return;
> -	}
> -
> -	if (dy < y_break && dy + height > y_break) {
> -		b = y_break - dy;
> -		if (dy < sy) {	/* Avoid trashing self */
> -			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
> -					y_break);
> -			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
> -					height - b, width, y_break);
> -		} else {
> -			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
> -					height - b, width, y_break);
> -			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
> -					y_break);
> -		}
> -		return;
> -	}
> -	ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
> -		   height, width);
> -}
> -
>   static void updatescrollmode_accel(struct fbcon_display *p,
>   					struct fb_info *info,
>   					struct vc_data *vc)
diff mbox series

Patch

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 235eaab37d84..e925bb608e25 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -164,15 +164,11 @@  static int fbcon_cursor_noblink;
  */
 
 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
-static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
-			int height, int width);
 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
 
 /*
  *  Internal routines
  */
-static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
-			    int dy, int dx, int height, int width, u_int y_break);
 static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
 			   int unit);
 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
@@ -1667,6 +1663,71 @@  static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p,
 	}
 }
 
+static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
+			    int dy, int dx, int height, int width, u_int y_break)
+{
+	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
+	struct fbcon_ops *ops = info->fbcon_par;
+	u_int b;
+
+	if (sy < y_break && sy + height > y_break) {
+		b = y_break - sy;
+		if (dy < sy) {	/* Avoid trashing self */
+			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
+					y_break);
+			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
+					height - b, width, y_break);
+		} else {
+			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
+					height - b, width, y_break);
+			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
+					y_break);
+		}
+		return;
+	}
+
+	if (dy < y_break && dy + height > y_break) {
+		b = y_break - dy;
+		if (dy < sy) {	/* Avoid trashing self */
+			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
+					y_break);
+			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
+					height - b, width, y_break);
+		} else {
+			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
+					height - b, width, y_break);
+			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
+					y_break);
+		}
+		return;
+	}
+	ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
+		   height, width);
+}
+
+static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
+			int height, int width)
+{
+	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
+	struct fbcon_display *p = &fb_display[vc->vc_num];
+
+	if (fbcon_is_inactive(vc, info))
+		return;
+
+	if (!width || !height)
+		return;
+
+	/*  Split blits that cross physical y_wrap case.
+	 *  Pathological case involves 4 blits, better to use recursive
+	 *  code rather than unrolled case
+	 *
+	 *  Recursive invocations don't need to erase the cursor over and
+	 *  over again, so we use fbcon_bmove_rec()
+	 */
+	fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width,
+			p->vrows - p->yscroll);
+}
+
 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
 		enum con_scroll dir, unsigned int count)
 {
@@ -1867,71 +1928,6 @@  static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
 }
 
 
-static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
-			int height, int width)
-{
-	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
-	struct fbcon_display *p = &fb_display[vc->vc_num];
-
-	if (fbcon_is_inactive(vc, info))
-		return;
-
-	if (!width || !height)
-		return;
-
-	/*  Split blits that cross physical y_wrap case.
-	 *  Pathological case involves 4 blits, better to use recursive
-	 *  code rather than unrolled case
-	 *
-	 *  Recursive invocations don't need to erase the cursor over and
-	 *  over again, so we use fbcon_bmove_rec()
-	 */
-	fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width,
-			p->vrows - p->yscroll);
-}
-
-static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
-			    int dy, int dx, int height, int width, u_int y_break)
-{
-	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
-	struct fbcon_ops *ops = info->fbcon_par;
-	u_int b;
-
-	if (sy < y_break && sy + height > y_break) {
-		b = y_break - sy;
-		if (dy < sy) {	/* Avoid trashing self */
-			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
-					y_break);
-			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
-					height - b, width, y_break);
-		} else {
-			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
-					height - b, width, y_break);
-			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
-					y_break);
-		}
-		return;
-	}
-
-	if (dy < y_break && dy + height > y_break) {
-		b = y_break - dy;
-		if (dy < sy) {	/* Avoid trashing self */
-			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
-					y_break);
-			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
-					height - b, width, y_break);
-		} else {
-			fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
-					height - b, width, y_break);
-			fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
-					y_break);
-		}
-		return;
-	}
-	ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
-		   height, width);
-}
-
 static void updatescrollmode_accel(struct fbcon_display *p,
 					struct fb_info *info,
 					struct vc_data *vc)