mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jocelyn Falempe <jfalempe@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	John Ogness <john.ogness@linutronix.de>,
	Javier Martinez Canillas <javierm@redhat.com>,
	"Guilherme G . Piccoli" <gpiccoli@igalia.com>,
	bluescreen_avenger@verizon.net,
	Caleb Connolly <caleb.connolly@linaro.org>,
	Petr Mladek <pmladek@suse.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 7/7] drm/log: Add integer scaling support
Date: Tue, 12 Nov 2024 10:51:37 +0100	[thread overview]
Message-ID: <86135b98-40cb-4694-971c-3f09263d4236@redhat.com> (raw)
In-Reply-To: <6a1bc758-e66a-4067-80d3-82fe3ba357e5@suse.de>

On 11/11/2024 14:06, Thomas Zimmermann wrote:
> Hi
> 
> 
> Am 08.11.24 um 09:10 schrieb Jocelyn Falempe:
>> 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.
> 
> Can't we have larger fonts instead?

Yes, that would be nice, but the largest font available currently is 16x32.
Also it's stored as raw bitmap, so bigger fonts will take much more memory.
For the drm_log use case, we don't need pixel-perfect glyph, so integer 
scaling is good enough.

Best regards,

-- 

Jocelyn


> 
> Best regards
> Thomas
> 
>>
>> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
>> ---
>>
>> v5:
>>   * Change scale parameter to unsigned int (Jani Nikula)
>>
>>   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 e6900c6b96436..4dc7be2288ab7 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 unsigned int scale = 1;
>> +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;
>> @@ -66,7 +72,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:
>> @@ -86,7 +92,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);
>> @@ -106,8 +112,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))
>> @@ -117,9 +123,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++;
>> @@ -204,8 +211,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;
> 


      reply	other threads:[~2024-11-12  9:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  8:10 [PATCH v7 0/7] drm/log: Introduce a new boot logger to draw the kmsg on the screen Jocelyn Falempe
2024-11-08  8:10 ` [PATCH v7 1/7] drm/panic: Move drawing functions to drm_draw Jocelyn Falempe
2024-11-11 13:03   ` Thomas Zimmermann
2024-11-08  8:10 ` [PATCH v7 2/7] drm/client: Always select DRM_CLIENT_LIB Jocelyn Falempe
2024-11-08 11:56   ` kernel test robot
2024-11-08  8:10 ` [PATCH v7 3/7] drm/log: Introduce a new boot logger to draw the kmsg on the screen Jocelyn Falempe
2024-11-08 12:27   ` kernel test robot
2024-11-08 13:08   ` kernel test robot
2024-11-08  8:10 ` [PATCH v7 4/7] drm/log: Do not draw if drm_master is taken Jocelyn Falempe
2024-11-08 13:33   ` Thomas Zimmermann
2024-11-08 13:51     ` Jocelyn Falempe
2024-11-08  8:10 ` [PATCH v7 5/7] drm/log: Color the timestamp, to improve readability Jocelyn Falempe
2024-11-08  8:10 ` [PATCH v7 6/7] drm/log: Implement suspend/resume Jocelyn Falempe
2024-11-08  8:10 ` [PATCH v7 7/7] drm/log: Add integer scaling support Jocelyn Falempe
2024-11-11 13:06   ` Thomas Zimmermann
2024-11-12  9:51     ` Jocelyn Falempe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86135b98-40cb-4694-971c-3f09263d4236@redhat.com \
    --to=jfalempe@redhat.com \
    --cc=airlied@gmail.com \
    --cc=bluescreen_avenger@verizon.net \
    --cc=caleb.connolly@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gpiccoli@igalia.com \
    --cc=javierm@redhat.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=pmladek@suse.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®