All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fbcon: Increase maximum font width x height to 64 x 64
@ 2024-03-12 21:39 Samuel Thibault
  2024-03-13 16:45 ` Luca Ceresoli
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Thibault @ 2024-03-12 21:39 UTC (permalink / raw)
  To: Daniel Vetter, Helge Deller, Alexey Gladkov, Jiry Slaby
  Cc: linux-fbdev, dri-devel, linux-kernel

This remains relatively simple by just enlarging integers.

It wouldn't be that simple to get to the console's 64x128 maximum, as it would
require 128b integers.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Index: linux-6.4/drivers/video/fbdev/core/fbcon.c
===================================================================
--- linux-6.4.orig/drivers/video/fbdev/core/fbcon.c
+++ linux-6.4/drivers/video/fbdev/core/fbcon.c
@@ -101,6 +101,9 @@ enum {
 	FBCON_LOGO_DONTSHOW	= -3	/* do not show the logo */
 };
 
+#define FBCON_MAX_FONT_WIDTH	(sizeof(((struct fb_pixmap *) 0)->blit_x) * 8)
+#define FBCON_MAX_FONT_HEIGHT	(sizeof(((struct fb_pixmap *) 0)->blit_y) * 8)
+
 static struct fbcon_display fb_display[MAX_NR_CONSOLES];
 
 struct fb_info *fbcon_registered_fb[FB_MAX];
@@ -2485,12 +2488,12 @@ static int fbcon_set_font(struct vc_data
 	    h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres))
 		return -EINVAL;
 
-	if (font->width > 32 || font->height > 32)
+	if (font->width > FBCON_MAX_FONT_WIDTH || font->height > FBCON_MAX_FONT_HEIGHT)
 		return -EINVAL;
 
 	/* Make sure drawing engine can handle the font */
-	if (!(info->pixmap.blit_x & BIT(font->width - 1)) ||
-	    !(info->pixmap.blit_y & BIT(font->height - 1)))
+	if (!(info->pixmap.blit_x & BIT_ULL(font->width - 1)) ||
+	    !(info->pixmap.blit_y & BIT_ULL(font->height - 1)))
 		return -EINVAL;
 
 	/* Make sure driver can handle the font length */
@@ -3084,8 +3087,8 @@ void fbcon_get_requirement(struct fb_inf
 			vc = vc_cons[i].d;
 			if (vc && vc->vc_mode == KD_TEXT &&
 			    info->node == con2fb_map[i]) {
-				caps->x |= 1 << (vc->vc_font.width - 1);
-				caps->y |= 1 << (vc->vc_font.height - 1);
+				caps->x |= 1ULL << (vc->vc_font.width - 1);
+				caps->y |= 1ULL << (vc->vc_font.height - 1);
 				charcnt = vc->vc_font.charcount;
 				if (caps->len < charcnt)
 					caps->len = charcnt;
@@ -3096,8 +3099,8 @@ void fbcon_get_requirement(struct fb_inf
 
 		if (vc && vc->vc_mode == KD_TEXT &&
 		    info->node == con2fb_map[fg_console]) {
-			caps->x = 1 << (vc->vc_font.width - 1);
-			caps->y = 1 << (vc->vc_font.height - 1);
+			caps->x = 1ULL << (vc->vc_font.width - 1);
+			caps->y = 1ULL << (vc->vc_font.height - 1);
 			caps->len = vc->vc_font.charcount;
 		}
 	}
Index: linux-6.4/include/linux/fb.h
===================================================================
--- linux-6.4.orig/include/linux/fb.h
+++ linux-6.4/include/linux/fb.h
@@ -143,8 +143,8 @@ struct fb_event {
 };
 
 struct fb_blit_caps {
-	u32 x;
-	u32 y;
+	u64 x;
+	u64 y;
 	u32 len;
 	u32 flags;
 };
@@ -191,10 +191,10 @@ struct fb_pixmap {
 	u32 scan_align;		/* alignment per scanline		*/
 	u32 access_align;	/* alignment per read/write (bits)	*/
 	u32 flags;		/* see FB_PIXMAP_*			*/
-	u32 blit_x;             /* supported bit block dimensions (1-32)*/
-	u32 blit_y;             /* Format: blit_x = 1 << (width - 1)    */
+	u64 blit_x;             /* supported bit block dimensions (1-64)*/
+	u64 blit_y;             /* Format: blit_x = 1 << (width - 1)    */
 	                        /*         blit_y = 1 << (height - 1)   */
-	                        /* if 0, will be set to 0xffffffff (all)*/
+	                        /* if 0, will be set to ~0ull (all)     */
 	/* access methods */
 	void (*writeio)(struct fb_info *info, void __iomem *dst, void *src, unsigned int size);
 	void (*readio) (struct fb_info *info, void *dst, void __iomem *src, unsigned int size);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fbcon: Increase maximum font width x height to 64 x 64
  2024-03-12 21:39 [PATCH] fbcon: Increase maximum font width x height to 64 x 64 Samuel Thibault
@ 2024-03-13 16:45 ` Luca Ceresoli
  2024-03-13 16:55   ` Samuel Thibault
  2024-03-13 17:06   ` Samuel Thibault
  0 siblings, 2 replies; 7+ messages in thread
From: Luca Ceresoli @ 2024-03-13 16:45 UTC (permalink / raw)
  To: Samuel Thibault
  Cc: Daniel Vetter, Helge Deller, Alexey Gladkov, Jiry Slaby,
	linux-fbdev, dri-devel, linux-kernel

Hello Samuel,

On Tue, 12 Mar 2024 22:39:02 +0100
Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:

> This remains relatively simple by just enlarging integers.
> 
> It wouldn't be that simple to get to the console's 64x128 maximum, as it would
> require 128b integers.
> 
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> 
> Index: linux-6.4/drivers/video/fbdev/core/fbcon.c
> ===================================================================

This patch is clearly not formatted according to the standard format
and it does not apply with 'git am'.

Using 'git format-patch' and 'git send-email' is *very* recommended as
it will take care of all the formatting for you. Maintainers and
anybody interested in your patch will be able to apply it easily.

All the info you need are at
https://docs.kernel.org/process/submitting-patches.html

> --- linux-6.4.orig/drivers/video/fbdev/core/fbcon.c
> +++ linux-6.4/drivers/video/fbdev/core/fbcon.c

Apparently you are not using git to track your changes, so I recommend
using it to have all the git utilities available.

Best regards,
Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fbcon: Increase maximum font width x height to 64 x 64
  2024-03-13 16:45 ` Luca Ceresoli
@ 2024-03-13 16:55   ` Samuel Thibault
  2024-03-13 17:06   ` Samuel Thibault
  1 sibling, 0 replies; 7+ messages in thread
From: Samuel Thibault @ 2024-03-13 16:55 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Daniel Vetter, Helge Deller, Alexey Gladkov, Jiry Slaby,
	linux-fbdev, dri-devel, linux-kernel

Luca Ceresoli, le mer. 13 mars 2024 17:45:31 +0100, a ecrit:
> Using 'git format-patch' and 'git send-email' is *very* recommended as
> it will take care of all the formatting for you.

It's quite a pitty that git cannot simply consume the output of diff.

Now I'll have to download 8GB of linux tree only for a simple patch...

Samuel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fbcon: Increase maximum font width x height to 64 x 64
  2024-03-13 16:45 ` Luca Ceresoli
  2024-03-13 16:55   ` Samuel Thibault
@ 2024-03-13 17:06   ` Samuel Thibault
  1 sibling, 0 replies; 7+ messages in thread
From: Samuel Thibault @ 2024-03-13 17:06 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Daniel Vetter, Helge Deller, Alexey Gladkov, Jiry Slaby,
	linux-fbdev, dri-devel, linux-kernel

Luca Ceresoli, le mer. 13 mars 2024 17:45:31 +0100, a ecrit:
> This patch is clearly not formatted according to the standard format
> and it does not apply with 'git am'.

(Note: the failure of application was not related to the formatting at
all, but just a little fuzz for the static word in

static struct fb_info *fbcon_registered_fb[FB_MAX];

that git doesn't seem to be able to just cope with)

Samuel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fbcon: Increase maximum font width x height to 64 x 64
  2024-03-15  9:35 ` Helge Deller
@ 2024-03-16  0:12   ` Samuel Thibault
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Thibault @ 2024-03-16  0:12 UTC (permalink / raw)
  To: Helge Deller
  Cc: linux-kernel, Daniel Vetter, Alexey Gladkov, Jiry Slaby,
	linux-fbdev, dri-devel

Hello,

Helge Deller, le ven. 15 mars 2024 10:35:40 +0100, a ecrit:
> You should have marked this patch with "v2"...

The actual changes were exactly the same.

> On 3/13/24 17:59, Samuel Thibault wrote:
> > This remains relatively simple by just enlarging integers.
> 
> I like the patch, but I still see some u32...
> drivers/video/fbdev/vt8623fb.c:         info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0);
> drivers/video/fbdev/arkfb.c:            info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0);
> drivers/video/fbdev/core/fbmem.c:               fb_info->pixmap.blit_x = ~(u32)0;
> drivers/video/fbdev/s3fb.c:             info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0);

Oops, I missed including these modifications indeed.

> > It wouldn't be that simple to get to the console's 64x128 maximum, as it would
> > require 128b integers.
> 
> How realistic are fonts > 64x64 pixels ?

With 4K displays, 64x128 brings 60x16 text console, which is useful for
people with low vision.

> If they are, using the bitmap_xx functions (include/linux/bitmap.h)
> now instead would be better.

Ok, I have now done this in v2. We'll be able to easily increase the
font size when 8K displays get out :)

Samuel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fbcon: Increase maximum font width x height to 64 x 64
  2024-03-13 16:59 Samuel Thibault
@ 2024-03-15  9:35 ` Helge Deller
  2024-03-16  0:12   ` Samuel Thibault
  0 siblings, 1 reply; 7+ messages in thread
From: Helge Deller @ 2024-03-15  9:35 UTC (permalink / raw)
  To: Samuel Thibault, linux-kernel, Daniel Vetter, Alexey Gladkov, Jiry Slaby
  Cc: linux-fbdev, dri-devel

You should have marked this patch with "v2"...

On 3/13/24 17:59, Samuel Thibault wrote:
> This remains relatively simple by just enlarging integers.

I like the patch, but I still see some u32...
drivers/video/fbdev/vt8623fb.c:         info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0);
drivers/video/fbdev/arkfb.c:            info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0);
drivers/video/fbdev/core/fbmem.c:               fb_info->pixmap.blit_x = ~(u32)0;
drivers/video/fbdev/s3fb.c:             info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0);

And please check blit_y too.

> It wouldn't be that simple to get to the console's 64x128 maximum, as it would
> require 128b integers.

How realistic are fonts > 64x64 pixels ?
If they are, using the bitmap_xx functions (include/linux/bitmap.h)
now instead would be better.

Helge

> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
>   drivers/video/fbdev/core/fbcon.c | 17 ++++++++++-------
>   include/linux/fb.h               | 10 +++++-----
>   2 files changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 46823c2e2ba1..849562f92bd5 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -101,6 +101,9 @@ enum {
>   	FBCON_LOGO_DONTSHOW	= -3	/* do not show the logo */
>   };
>
> +#define FBCON_MAX_FONT_WIDTH	(sizeof(((struct fb_pixmap *) 0)->blit_x) * 8)
> +#define FBCON_MAX_FONT_HEIGHT	(sizeof(((struct fb_pixmap *) 0)->blit_y) * 8)
> +
>   static struct fbcon_display fb_display[MAX_NR_CONSOLES];
>
>   static struct fb_info *fbcon_registered_fb[FB_MAX];
> @@ -2483,12 +2486,12 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
>   	    h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres))
>   		return -EINVAL;
>
> -	if (font->width > 32 || font->height > 32)
> +	if (font->width > FBCON_MAX_FONT_WIDTH || font->height > FBCON_MAX_FONT_HEIGHT)
>   		return -EINVAL;
>
>   	/* Make sure drawing engine can handle the font */
> -	if (!(info->pixmap.blit_x & BIT(font->width - 1)) ||
> -	    !(info->pixmap.blit_y & BIT(font->height - 1)))
> +	if (!(info->pixmap.blit_x & BIT_ULL(font->width - 1)) ||
> +	    !(info->pixmap.blit_y & BIT_ULL(font->height - 1)))
>   		return -EINVAL;
>
>   	/* Make sure driver can handle the font length */
> @@ -3082,8 +3085,8 @@ void fbcon_get_requirement(struct fb_info *info,
>   			vc = vc_cons[i].d;
>   			if (vc && vc->vc_mode == KD_TEXT &&
>   			    info->node == con2fb_map[i]) {
> -				caps->x |= 1 << (vc->vc_font.width - 1);
> -				caps->y |= 1 << (vc->vc_font.height - 1);
> +				caps->x |= 1ULL << (vc->vc_font.width - 1);
> +				caps->y |= 1ULL << (vc->vc_font.height - 1);
>   				charcnt = vc->vc_font.charcount;
>   				if (caps->len < charcnt)
>   					caps->len = charcnt;
> @@ -3094,8 +3097,8 @@ void fbcon_get_requirement(struct fb_info *info,
>
>   		if (vc && vc->vc_mode == KD_TEXT &&
>   		    info->node == con2fb_map[fg_console]) {
> -			caps->x = 1 << (vc->vc_font.width - 1);
> -			caps->y = 1 << (vc->vc_font.height - 1);
> +			caps->x = 1ULL << (vc->vc_font.width - 1);
> +			caps->y = 1ULL << (vc->vc_font.height - 1);
>   			caps->len = vc->vc_font.charcount;
>   		}
>   	}
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index 05dc9624897d..2bac166cd3f2 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -144,8 +144,8 @@ struct fb_event {
>   };
>
>   struct fb_blit_caps {
> -	u32 x;
> -	u32 y;
> +	u64 x;
> +	u64 y;
>   	u32 len;
>   	u32 flags;
>   };
> @@ -192,10 +192,10 @@ struct fb_pixmap {
>   	u32 scan_align;		/* alignment per scanline		*/
>   	u32 access_align;	/* alignment per read/write (bits)	*/
>   	u32 flags;		/* see FB_PIXMAP_*			*/
> -	u32 blit_x;             /* supported bit block dimensions (1-32)*/
> -	u32 blit_y;             /* Format: blit_x = 1 << (width - 1)    */
> +	u64 blit_x;             /* supported bit block dimensions (1-64)*/
> +	u64 blit_y;             /* Format: blit_x = 1 << (width - 1)    */
>   	                        /*         blit_y = 1 << (height - 1)   */
> -	                        /* if 0, will be set to 0xffffffff (all)*/
> +	                        /* if 0, will be set to ~0ull (all)     */
>   	/* access methods */
>   	void (*writeio)(struct fb_info *info, void __iomem *dst, void *src, unsigned int size);
>   	void (*readio) (struct fb_info *info, void *dst, void __iomem *src, unsigned int size);


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] fbcon: Increase maximum font width x height to 64 x 64
@ 2024-03-13 16:59 Samuel Thibault
  2024-03-15  9:35 ` Helge Deller
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Thibault @ 2024-03-13 16:59 UTC (permalink / raw)
  To: linux-kernel, Daniel Vetter, Helge Deller, Alexey Gladkov, Jiry Slaby
  Cc: Samuel Thibault, linux-fbdev, dri-devel

This remains relatively simple by just enlarging integers.

It wouldn't be that simple to get to the console's 64x128 maximum, as it would
require 128b integers.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 drivers/video/fbdev/core/fbcon.c | 17 ++++++++++-------
 include/linux/fb.h               | 10 +++++-----
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 46823c2e2ba1..849562f92bd5 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -101,6 +101,9 @@ enum {
 	FBCON_LOGO_DONTSHOW	= -3	/* do not show the logo */
 };
 
+#define FBCON_MAX_FONT_WIDTH	(sizeof(((struct fb_pixmap *) 0)->blit_x) * 8)
+#define FBCON_MAX_FONT_HEIGHT	(sizeof(((struct fb_pixmap *) 0)->blit_y) * 8)
+
 static struct fbcon_display fb_display[MAX_NR_CONSOLES];
 
 static struct fb_info *fbcon_registered_fb[FB_MAX];
@@ -2483,12 +2486,12 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
 	    h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres))
 		return -EINVAL;
 
-	if (font->width > 32 || font->height > 32)
+	if (font->width > FBCON_MAX_FONT_WIDTH || font->height > FBCON_MAX_FONT_HEIGHT)
 		return -EINVAL;
 
 	/* Make sure drawing engine can handle the font */
-	if (!(info->pixmap.blit_x & BIT(font->width - 1)) ||
-	    !(info->pixmap.blit_y & BIT(font->height - 1)))
+	if (!(info->pixmap.blit_x & BIT_ULL(font->width - 1)) ||
+	    !(info->pixmap.blit_y & BIT_ULL(font->height - 1)))
 		return -EINVAL;
 
 	/* Make sure driver can handle the font length */
@@ -3082,8 +3085,8 @@ void fbcon_get_requirement(struct fb_info *info,
 			vc = vc_cons[i].d;
 			if (vc && vc->vc_mode == KD_TEXT &&
 			    info->node == con2fb_map[i]) {
-				caps->x |= 1 << (vc->vc_font.width - 1);
-				caps->y |= 1 << (vc->vc_font.height - 1);
+				caps->x |= 1ULL << (vc->vc_font.width - 1);
+				caps->y |= 1ULL << (vc->vc_font.height - 1);
 				charcnt = vc->vc_font.charcount;
 				if (caps->len < charcnt)
 					caps->len = charcnt;
@@ -3094,8 +3097,8 @@ void fbcon_get_requirement(struct fb_info *info,
 
 		if (vc && vc->vc_mode == KD_TEXT &&
 		    info->node == con2fb_map[fg_console]) {
-			caps->x = 1 << (vc->vc_font.width - 1);
-			caps->y = 1 << (vc->vc_font.height - 1);
+			caps->x = 1ULL << (vc->vc_font.width - 1);
+			caps->y = 1ULL << (vc->vc_font.height - 1);
 			caps->len = vc->vc_font.charcount;
 		}
 	}
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 05dc9624897d..2bac166cd3f2 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -144,8 +144,8 @@ struct fb_event {
 };
 
 struct fb_blit_caps {
-	u32 x;
-	u32 y;
+	u64 x;
+	u64 y;
 	u32 len;
 	u32 flags;
 };
@@ -192,10 +192,10 @@ struct fb_pixmap {
 	u32 scan_align;		/* alignment per scanline		*/
 	u32 access_align;	/* alignment per read/write (bits)	*/
 	u32 flags;		/* see FB_PIXMAP_*			*/
-	u32 blit_x;             /* supported bit block dimensions (1-32)*/
-	u32 blit_y;             /* Format: blit_x = 1 << (width - 1)    */
+	u64 blit_x;             /* supported bit block dimensions (1-64)*/
+	u64 blit_y;             /* Format: blit_x = 1 << (width - 1)    */
 	                        /*         blit_y = 1 << (height - 1)   */
-	                        /* if 0, will be set to 0xffffffff (all)*/
+	                        /* if 0, will be set to ~0ull (all)     */
 	/* access methods */
 	void (*writeio)(struct fb_info *info, void __iomem *dst, void *src, unsigned int size);
 	void (*readio) (struct fb_info *info, void *dst, void __iomem *src, unsigned int size);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-03-16  0:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12 21:39 [PATCH] fbcon: Increase maximum font width x height to 64 x 64 Samuel Thibault
2024-03-13 16:45 ` Luca Ceresoli
2024-03-13 16:55   ` Samuel Thibault
2024-03-13 17:06   ` Samuel Thibault
2024-03-13 16:59 Samuel Thibault
2024-03-15  9:35 ` Helge Deller
2024-03-16  0:12   ` Samuel Thibault

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.