On HiDPI screen, the default font might be too small, so if no
scaling is specified, try to upscale reasonably.
The auto scaling is computed for each display.
Signed-off-by: Jocelyn Falempe <[email protected]>
---
drivers/gpu/drm/clients/drm_log.c | 36 ++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/clients/drm_log.c b/drivers/gpu/drm/
clients/drm_log.c
index 4654091fe11a..7a0db2690b55 100644
--- a/drivers/gpu/drm/clients/drm_log.c
+++ b/drivers/gpu/drm/clients/drm_log.c
@@ -25,9 +25,9 @@ MODULE_AUTHOR("Jocelyn Falempe");
MODULE_DESCRIPTION("DRM boot logger");
MODULE_LICENSE("GPL");
-static unsigned int scale = 1;
+static unsigned int scale = 0;
module_param(scale, uint, 0444);
-MODULE_PARM_DESC(scale, "Integer scaling factor for drm_log, default
is 1");
+MODULE_PARM_DESC(scale, "Integer scaling factor for drm_log, default
is 0 (auto)");
/**
* DOC: overview
@@ -42,6 +42,7 @@ struct drm_log_scanout {
const struct font_desc *font;
u32 rows;
u32 columns;
+ u32 scale;
u32 scaled_font_h;
u32 scaled_font_w;
u32 line;
@@ -72,17 +73,17 @@ static struct drm_log *console_to_drm_log(struct
console *con)
static void drm_log_blit(struct iosys_map *dst, unsigned int dst_pitch,
const u8 *src, unsigned int src_pitch,
- u32 height, u32 width, u32 px_width, u32 color)
+ u32 height, u32 width, u32 blit_scale, u32 px_width, u32
color)
{
switch (px_width) {
case 2:
- drm_draw_blit16(dst, dst_pitch, src, src_pitch, height,
width, scale, color);
+ drm_draw_blit16(dst, dst_pitch, src, src_pitch, height,
width, blit_scale, color);
break;
case 3:
- drm_draw_blit24(dst, dst_pitch, src, src_pitch, height,
width, scale, color);
+ drm_draw_blit24(dst, dst_pitch, src, src_pitch, height,
width, blit_scale, color);
break;
case 4:
- drm_draw_blit32(dst, dst_pitch, src, src_pitch, height,
width, scale, color);
+ drm_draw_blit32(dst, dst_pitch, src, src_pitch, height,
width, blit_scale, color);
break;
default:
WARN_ONCE(1, "Can't blit with pixel width %d\n", px_width);
@@ -122,7 +123,7 @@ static void drm_log_draw_line(struct
drm_log_scanout *scanout, const char *s,
if (src)
drm_log_blit(&map, fb->pitches[0], src, font_pitch,
scanout->scaled_font_h, scanout->scaled_font_w,
- px_width, color);
+ scanout->scale, px_width, color);
iosys_map_incr(&map, scanout->scaled_font_w * px_width);
}
@@ -206,6 +207,15 @@ static u32 drm_log_find_usable_format(struct
drm_plane *plane)
return DRM_FORMAT_INVALID;
}
+/* Find the biggest integer scaling to get about 120x50 chars on the
screen */