lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8734l26g66.fsf@intel.com>
Date: Fri, 11 Oct 2024 14:18:57 +0300
From: Jani Nikula <jani.nikula@...ux.intel.com>
To: Jocelyn Falempe <jfalempe@...hat.com>, Maarten Lankhorst
 <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
 Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
 Daniel Vetter <daniel@...ll.ch>, John Ogness <john.ogness@...utronix.de>,
 Javier Martinez Canillas <javierm@...hat.com>, "Guilherme G . Piccoli"
 <gpiccoli@...lia.com>, bluescreen_avenger@...izon.net, Caleb Connolly
 <caleb.connolly@...aro.org>, dri-devel@...ts.freedesktop.org,
 linux-kernel@...r.kernel.org
Cc: Jocelyn Falempe <jfalempe@...hat.com>
Subject: Re: [PATCH v4 7/7] drm/log: Add integer scaling support

On Fri, 11 Oct 2024, Jocelyn Falempe <jfalempe@...hat.com> wrote:
> Add a module parameter, to increase the font size for HiDPI screen.
> Even with CONFIG_FONT_TER16x32, it can still be a bit small to read.
> In this case, adding drm_log.scale=2 to your kernel command line will
> double the character size.
>
> Signed-off-by: Jocelyn Falempe <jfalempe@...hat.com>
> ---
>  drivers/gpu/drm/drm_log.c | 27 ++++++++++++++++++---------
>  1 file changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_log.c b/drivers/gpu/drm/drm_log.c
> index 07d151300146..e44c10819bd0 100644
> --- a/drivers/gpu/drm/drm_log.c
> +++ b/drivers/gpu/drm/drm_log.c
> @@ -25,6 +25,10 @@ MODULE_AUTHOR("Jocelyn Falempe");
>  MODULE_DESCRIPTION("DRM boot logger");
>  MODULE_LICENSE("GPL");
>  
> +static uint scale = 1;

Drive-by nit, please use regular types instead of sysv "uint".

BR,
Jani.

> +module_param(scale, uint, 0444);
> +MODULE_PARM_DESC(scale, "Integer scaling factor for drm_log, default is 1");
> +
>  /**
>   * DOC: overview
>   *
> @@ -38,6 +42,8 @@ struct drm_log_scanout {
>  	const struct font_desc *font;
>  	u32 rows;
>  	u32 columns;
> +	u32 scaled_font_h;
> +	u32 scaled_font_w;
>  	u32 line;
>  	u32 format;
>  	u32 px_width;
> @@ -67,7 +73,7 @@ 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 scale, u32 px_width, u32 color)
> +			 u32 height, u32 width, u32 px_width, u32 color)
>  {
>  	switch (px_width) {
>  	case 2:
> @@ -87,7 +93,7 @@ static void drm_log_blit(struct iosys_map *dst, unsigned int dst_pitch,
>  static void drm_log_clear_line(struct drm_log_scanout *scanout, u32 line)
>  {
>  	struct drm_framebuffer *fb = scanout->buffer->fb;
> -	unsigned long height = scanout->font->height;
> +	unsigned long height = scanout->scaled_font_h;
>  	struct iosys_map map;
>  	struct drm_rect r = DRM_RECT_INIT(0, line * height, fb->width, height);
>  
> @@ -107,8 +113,8 @@ static void drm_log_draw_line(struct drm_log_scanout *scanout, const char *s,
>  	size_t font_pitch = DIV_ROUND_UP(font->width, 8);
>  	const u8 *src;
>  	u32 px_width = fb->format->cpp[0];
> -	struct drm_rect r = DRM_RECT_INIT(0, scanout->line * font->height,
> -					  fb->width, (scanout->line + 1) * font->height);
> +	struct drm_rect r = DRM_RECT_INIT(0, scanout->line * scanout->scaled_font_h,
> +					  fb->width, (scanout->line + 1) * scanout->scaled_font_h);
>  	u32 i;
>  
>  	if (drm_client_buffer_vmap_local(scanout->buffer, &map))
> @@ -118,9 +124,10 @@ static void drm_log_draw_line(struct drm_log_scanout *scanout, const char *s,
>  	for (i = 0; i < len && i < scanout->columns; i++) {
>  		u32 color = (i < prefix_len) ? scanout->prefix_color : scanout->front_color;
>  		src = drm_draw_get_char_bitmap(font, s[i], font_pitch);
> -		drm_log_blit(&map, fb->pitches[0], src, font_pitch, font->height, font->width,
> -			     1, px_width, color);
> -		iosys_map_incr(&map, font->width * px_width);
> +		drm_log_blit(&map, fb->pitches[0], src, font_pitch,
> +			     scanout->scaled_font_h, scanout->scaled_font_w,
> +			     px_width, color);
> +		iosys_map_incr(&map, scanout->scaled_font_w * px_width);
>  	}
>  
>  	scanout->line++;
> @@ -205,8 +212,10 @@ static int drm_log_setup_modeset(struct drm_client_dev *client,
>  		return -ENOMEM;
>  	}
>  	mode_set->fb = scanout->buffer->fb;
> -	scanout->rows = height / scanout->font->height;
> -	scanout->columns = width / scanout->font->width;
> +	scanout->scaled_font_h = scanout->font->height * scale;
> +	scanout->scaled_font_w = scanout->font->width * scale;
> +	scanout->rows = height / scanout->scaled_font_h;
> +	scanout->columns = width / scanout->scaled_font_w;
>  	scanout->front_color = drm_draw_color_from_xrgb8888(0xffffff, format);
>  	scanout->prefix_color = drm_draw_color_from_xrgb8888(0x4e9a06, format);
>  	return 0;

-- 
Jani Nikula, Intel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ