]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fbcon: Streamline setting rotated/unrotated bitops
authorThomas Zimmermann <tzimmermann@suse.de>
Tue, 9 Sep 2025 12:44:45 +0000 (14:44 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Fri, 19 Sep 2025 08:04:06 +0000 (10:04 +0200)
Support for console rotation is somewhat bolted onto the helper
fbcon_set_bitops() for unrotated displays.

Update fbcon_set_bitops() with a switch statement that picks the
correct settings helper for the current rotation. For unrotated
consoles, set the bitops for in the new helper fbcon_set_bitops_ur().
Rename the other, existing helpers to match the common naming
scheme.

The old helper fbcon_set_rotate() is no longer used.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://lore.kernel.org/r/20250909124616.143365-6-tzimmermann@suse.de
drivers/video/fbdev/core/bitblit.c
drivers/video/fbdev/core/fbcon.c
drivers/video/fbdev/core/fbcon.h
drivers/video/fbdev/core/fbcon_ccw.c
drivers/video/fbdev/core/fbcon_cw.c
drivers/video/fbdev/core/fbcon_rotate.c
drivers/video/fbdev/core/fbcon_rotate.h
drivers/video/fbdev/core/fbcon_ud.c

index 7a68372f0444bbc00d0306a7eb0ef598f43aec58..08cfcd81c6b4d4ad92afec7f36eff8659b0a837a 100644 (file)
@@ -393,10 +393,7 @@ static const struct fbcon_bitops bit_fbcon_bitops = {
        .update_start = bit_update_start,
 };
 
-void fbcon_set_bitops(struct fbcon_par *par)
+void fbcon_set_bitops_ur(struct fbcon_par *par)
 {
        par->bitops = &bit_fbcon_bitops;
-
-       if (par->rotate)
-               fbcon_set_rotate(par);
 }
index 1074dc90ed929a39fc6e6bdac254e44ee9864781..85f63f87d3c155b0f59b056490ea2fb9c81e22b0 100644 (file)
@@ -81,6 +81,7 @@
 #include <asm/irq.h>
 
 #include "fbcon.h"
+#include "fbcon_rotate.h"
 #include "fb_internal.h"
 
 /*
@@ -270,6 +271,26 @@ static void fbcon_rotate_all(struct fb_info *info, u32 rotate)
 }
 #endif /* CONFIG_FRAMEBUFFER_CONSOLE_ROTATION */
 
+static void fbcon_set_bitops(struct fbcon_par *par)
+{
+       switch (par->rotate) {
+       default:
+               fallthrough;
+       case FB_ROTATE_UR:
+               fbcon_set_bitops_ur(par);
+               break;
+       case FB_ROTATE_CW:
+               fbcon_set_bitops_cw(par);
+               break;
+       case FB_ROTATE_UD:
+               fbcon_set_bitops_ud(par);
+               break;
+       case FB_ROTATE_CCW:
+               fbcon_set_bitops_ccw(par);
+               break;
+       }
+}
+
 static int fbcon_get_rotate(struct fb_info *info)
 {
        struct fbcon_par *par = info->fbcon_par;
index 4bff4f5b3ec1a23e7602c47357de92492dabe9e4..44ea4ae4bba0d17034fce3ff52e567144fddf9cf 100644 (file)
@@ -191,7 +191,7 @@ static inline u_short fb_scrollmode(struct fbcon_display *fb)
 #ifdef CONFIG_FB_TILEBLITTING
 extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info);
 #endif
-extern void fbcon_set_bitops(struct fbcon_par *par);
+extern void fbcon_set_bitops_ur(struct fbcon_par *par);
 extern int  soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
 
 #define FBCON_ATTRIBUTE_UNDERLINE 1
@@ -229,10 +229,4 @@ static inline int get_attribute(struct fb_info *info, u16 c)
         (void) (&_r == &_v); \
         (i == FB_ROTATE_UR || i == FB_ROTATE_UD) ? _r : _v; })
 
-#ifdef CONFIG_FRAMEBUFFER_CONSOLE_ROTATION
-extern void fbcon_set_rotate(struct fbcon_par *par);
-#else
-#define fbcon_set_rotate(x) do {} while(0)
-#endif /* CONFIG_FRAMEBUFFER_CONSOLE_ROTATION */
-
 #endif /* _VIDEO_FBCON_H */
index 4721f4b5e29a55677bc4fc27983b8f3586d9bda7..2f394b5a17f79610f18746f45d093ef5ea2775c6 100644 (file)
@@ -400,7 +400,7 @@ static const struct fbcon_bitops ccw_fbcon_bitops = {
        .rotate_font = fbcon_rotate_font,
 };
 
-void fbcon_rotate_ccw(struct fbcon_par *par)
+void fbcon_set_bitops_ccw(struct fbcon_par *par)
 {
        par->bitops = &ccw_fbcon_bitops;
 }
index 2771924d0fb720c4848393405708b96cea28d5f8..3c3ad3471ec4b7092457807d816566559c89e217 100644 (file)
@@ -383,7 +383,7 @@ static const struct fbcon_bitops cw_fbcon_bitops = {
        .rotate_font = fbcon_rotate_font,
 };
 
-void fbcon_rotate_cw(struct fbcon_par *par)
+void fbcon_set_bitops_cw(struct fbcon_par *par)
 {
        par->bitops = &cw_fbcon_bitops;
 }
index 0c7cac71a9c2188bde8c6362438d667ed6816f11..1562a8f20b4f59ce111a0f95dc84658f45306c87 100644 (file)
@@ -92,18 +92,3 @@ int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc)
 finished:
        return err;
 }
-
-void fbcon_set_rotate(struct fbcon_par *par)
-{
-       switch (par->rotate) {
-       case FB_ROTATE_CW:
-               fbcon_rotate_cw(par);
-               break;
-       case FB_ROTATE_UD:
-               fbcon_rotate_ud(par);
-               break;
-       case FB_ROTATE_CCW:
-               fbcon_rotate_ccw(par);
-               break;
-       }
-}
index 784f3231a958f8053c13c99032f7e0233564c128..8cb019e8a9c0f9317a3bfc856fcb7ea6441e5bad 100644 (file)
@@ -92,8 +92,17 @@ static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height)
 
 int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc);
 
-extern void fbcon_rotate_cw(struct fbcon_par *par);
-extern void fbcon_rotate_ud(struct fbcon_par *par);
-extern void fbcon_rotate_ccw(struct fbcon_par *par);
+#if defined(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION)
+void fbcon_set_bitops_cw(struct fbcon_par *par);
+void fbcon_set_bitops_ud(struct fbcon_par *par);
+void fbcon_set_bitops_ccw(struct fbcon_par *par);
+#else
+static inline void fbcon_set_bitops_cw(struct fbcon_par *par)
+{ }
+static inline void fbcon_set_bitops_ud(struct fbcon_par *par)
+{ }
+static inline void fbcon_set_bitops_ccw(struct fbcon_par *par)
+{ }
+#endif
 
 #endif
index 148ca9b539d1901cd2835ec88e4a70cdb2a27db5..6fc30cad5b19b23c9cf479eb98775d7244b57fb7 100644 (file)
@@ -427,7 +427,7 @@ static const struct fbcon_bitops ud_fbcon_bitops = {
        .rotate_font = fbcon_rotate_font,
 };
 
-void fbcon_rotate_ud(struct fbcon_par *par)
+void fbcon_set_bitops_ud(struct fbcon_par *par)
 {
        par->bitops = &ud_fbcon_bitops;
 }