Commit fdf1b6b7 authored by Thomas Zimmermann's avatar Thomas Zimmermann
Browse files

fbcon: Streamline setting rotated/unrotated bitops



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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://lore.kernel.org/r/20250909124616.143365-6-tzimmermann@suse.de
parent 217cb07b
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -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);
}
+21 −0
Original line number Diff line number Diff line
@@ -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;
+1 −7
Original line number Diff line number Diff line
@@ -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 */
+1 −1
Original line number Diff line number Diff line
@@ -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;
}
+1 −1
Original line number Diff line number Diff line
@@ -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;
}
Loading