Skip to content

Commit 4f55aa8

Browse files
committed
Merge tag 'fbdev-for-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev
Pull fbdev updates from Helge Deller: - Allow console fonts up to 64x128 pixels (Samuel Thibault) - Prevent division-by-zero in fb monitor code (Roman Smirnov) - Drop Renesas ARM platforms from Mobile LCDC framebuffer driver (Geert Uytterhoeven) - Various code cleanups in viafb, uveafb and mb862xxfb drivers by Aleksandr Burakov, Li Zhijian and Michael Ellerman * tag 'fbdev-for-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: fbdev: panel-tpo-td043mtea1: Convert sprintf() to sysfs_emit() fbmon: prevent division by zero in fb_videomode_from_videomode() fbcon: Increase maximum font width x height to 64 x 128 fbdev: viafb: fix typo in hw_bitblt_1 and hw_bitblt_2 fbdev: mb862xxfb: Fix defined but not used error fbdev: uvesafb: Convert sprintf/snprintf to sysfs_emit fbdev: Restrict FB_SH_MOBILE_LCDC to SuperH
2 parents 4073195 + 763865f commit 4f55aa8

File tree

18 files changed

+110
-70
lines changed

18 files changed

+110
-70
lines changed

drivers/firmware/efi/earlycon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static int __init efi_earlycon_setup(struct earlycon_device *device,
252252
if (si->lfb_depth != 32)
253253
return -ENODEV;
254254

255-
font = get_default_font(xres, yres, -1, -1);
255+
font = get_default_font(xres, yres, NULL, NULL);
256256
if (!font)
257257
return -ENODEV;
258258

drivers/video/fbdev/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,7 @@ config FB_FSL_DIU
15231523
config FB_SH_MOBILE_LCDC
15241524
tristate "SuperH Mobile LCDC framebuffer support"
15251525
depends on FB && HAVE_CLK && HAS_IOMEM
1526-
depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
1526+
depends on SUPERH || COMPILE_TEST
15271527
depends on FB_DEVICE
15281528
select FB_BACKLIGHT
15291529
select FB_DEFERRED_IO

drivers/video/fbdev/arkfb.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,13 @@ static int arkfb_set_par(struct fb_info *info)
622622
info->tileops = NULL;
623623

624624
/* in 4bpp supports 8p wide tiles only, any tiles otherwise */
625-
info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0);
626-
info->pixmap.blit_y = ~(u32)0;
625+
if (bpp == 4) {
626+
bitmap_zero(info->pixmap.blit_x, FB_MAX_BLIT_WIDTH);
627+
set_bit(8 - 1, info->pixmap.blit_x);
628+
} else {
629+
bitmap_fill(info->pixmap.blit_x, FB_MAX_BLIT_WIDTH);
630+
}
631+
bitmap_fill(info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT);
627632

628633
offset_value = (info->var.xres_virtual * bpp) / 64;
629634
screen_size = info->var.yres_virtual * info->fix.line_length;
@@ -635,8 +640,10 @@ static int arkfb_set_par(struct fb_info *info)
635640
info->tileops = &arkfb_tile_ops;
636641

637642
/* supports 8x16 tiles only */
638-
info->pixmap.blit_x = 1 << (8 - 1);
639-
info->pixmap.blit_y = 1 << (16 - 1);
643+
bitmap_zero(info->pixmap.blit_x, FB_MAX_BLIT_WIDTH);
644+
set_bit(8 - 1, info->pixmap.blit_x);
645+
bitmap_zero(info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT);
646+
set_bit(16 - 1, info->pixmap.blit_y);
640647

641648
offset_value = info->var.xres_virtual / 16;
642649
screen_size = (info->var.xres_virtual * info->var.yres_virtual) / 64;

drivers/video/fbdev/core/fbcon.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,12 +2479,12 @@ static int fbcon_set_font(struct vc_data *vc, const struct console_font *font,
24792479
h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres))
24802480
return -EINVAL;
24812481

2482-
if (font->width > 32 || font->height > 32)
2482+
if (font->width > FB_MAX_BLIT_WIDTH || font->height > FB_MAX_BLIT_HEIGHT)
24832483
return -EINVAL;
24842484

24852485
/* Make sure drawing engine can handle the font */
2486-
if (!(info->pixmap.blit_x & BIT(font->width - 1)) ||
2487-
!(info->pixmap.blit_y & BIT(font->height - 1)))
2486+
if (!test_bit(font->width - 1, info->pixmap.blit_x) ||
2487+
!test_bit(font->height - 1, info->pixmap.blit_y))
24882488
return -EINVAL;
24892489

24902490
/* Make sure driver can handle the font length */
@@ -3050,8 +3050,8 @@ void fbcon_get_requirement(struct fb_info *info,
30503050
vc = vc_cons[i].d;
30513051
if (vc && vc->vc_mode == KD_TEXT &&
30523052
info->node == con2fb_map[i]) {
3053-
caps->x |= 1 << (vc->vc_font.width - 1);
3054-
caps->y |= 1 << (vc->vc_font.height - 1);
3053+
set_bit(vc->vc_font.width - 1, caps->x);
3054+
set_bit(vc->vc_font.height - 1, caps->y);
30553055
charcnt = vc->vc_font.charcount;
30563056
if (caps->len < charcnt)
30573057
caps->len = charcnt;
@@ -3062,8 +3062,10 @@ void fbcon_get_requirement(struct fb_info *info,
30623062

30633063
if (vc && vc->vc_mode == KD_TEXT &&
30643064
info->node == con2fb_map[fg_console]) {
3065-
caps->x = 1 << (vc->vc_font.width - 1);
3066-
caps->y = 1 << (vc->vc_font.height - 1);
3065+
bitmap_zero(caps->x, FB_MAX_BLIT_WIDTH);
3066+
set_bit(vc->vc_font.width - 1, caps->x);
3067+
bitmap_zero(caps->y, FB_MAX_BLIT_HEIGHT);
3068+
set_bit(vc->vc_font.height - 1, caps->y);
30673069
caps->len = vc->vc_font.charcount;
30683070
}
30693071
}

drivers/video/fbdev/core/fbmem.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var,
212212
fbcon_get_requirement(info, &caps);
213213
info->fbops->fb_get_caps(info, &fbcaps, var);
214214

215-
if (((fbcaps.x ^ caps.x) & caps.x) ||
216-
((fbcaps.y ^ caps.y) & caps.y) ||
215+
if (!bitmap_subset(caps.x, fbcaps.x, FB_MAX_BLIT_WIDTH) ||
216+
!bitmap_subset(caps.y, fbcaps.y, FB_MAX_BLIT_HEIGHT) ||
217217
(fbcaps.len < caps.len))
218218
err = -EINVAL;
219219

@@ -420,11 +420,11 @@ static int do_register_framebuffer(struct fb_info *fb_info)
420420
}
421421
fb_info->pixmap.offset = 0;
422422

423-
if (!fb_info->pixmap.blit_x)
424-
fb_info->pixmap.blit_x = ~(u32)0;
423+
if (bitmap_empty(fb_info->pixmap.blit_x, FB_MAX_BLIT_WIDTH))
424+
bitmap_fill(fb_info->pixmap.blit_x, FB_MAX_BLIT_WIDTH);
425425

426-
if (!fb_info->pixmap.blit_y)
427-
fb_info->pixmap.blit_y = ~(u32)0;
426+
if (bitmap_empty(fb_info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT))
427+
bitmap_fill(fb_info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT);
428428

429429
if (!fb_info->modelist.prev || !fb_info->modelist.next)
430430
INIT_LIST_HEAD(&fb_info->modelist);

drivers/video/fbdev/core/fbmon.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,7 @@ int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, struct fb_inf
13111311
int fb_videomode_from_videomode(const struct videomode *vm,
13121312
struct fb_videomode *fbmode)
13131313
{
1314-
unsigned int htotal, vtotal;
1314+
unsigned int htotal, vtotal, total;
13151315

13161316
fbmode->xres = vm->hactive;
13171317
fbmode->left_margin = vm->hback_porch;
@@ -1344,8 +1344,9 @@ int fb_videomode_from_videomode(const struct videomode *vm,
13441344
vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch +
13451345
vm->vsync_len;
13461346
/* prevent division by zero */
1347-
if (htotal && vtotal) {
1348-
fbmode->refresh = vm->pixelclock / (htotal * vtotal);
1347+
total = htotal * vtotal;
1348+
if (total) {
1349+
fbmode->refresh = vm->pixelclock / total;
13491350
/* a mode must have htotal and vtotal != 0 or it is invalid */
13501351
} else {
13511352
fbmode->refresh = 0;

drivers/video/fbdev/core/svgalib.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,19 @@ void svga_get_caps(struct fb_info *info, struct fb_blit_caps *caps,
354354
{
355355
if (var->bits_per_pixel == 0) {
356356
/* can only support 256 8x16 bitmap */
357-
caps->x = 1 << (8 - 1);
358-
caps->y = 1 << (16 - 1);
357+
bitmap_zero(caps->x, FB_MAX_BLIT_WIDTH);
358+
set_bit(8 - 1, caps->x);
359+
bitmap_zero(caps->y, FB_MAX_BLIT_HEIGHT);
360+
set_bit(16 - 1, caps->y);
359361
caps->len = 256;
360362
} else {
361-
caps->x = (var->bits_per_pixel == 4) ? 1 << (8 - 1) : ~(u32)0;
362-
caps->y = ~(u32)0;
363+
if (var->bits_per_pixel == 4) {
364+
bitmap_zero(caps->x, FB_MAX_BLIT_WIDTH);
365+
set_bit(8 - 1, caps->x);
366+
} else {
367+
bitmap_fill(caps->x, FB_MAX_BLIT_WIDTH);
368+
}
369+
bitmap_fill(caps->y, FB_MAX_BLIT_HEIGHT);
363370
caps->len = ~(u32)0;
364371
}
365372
}

drivers/video/fbdev/mb862xx/mb862xxfbdrv.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@
3232
#define CARMINE_MEM_SIZE 0x8000000
3333
#define DRV_NAME "mb862xxfb"
3434

35-
#if defined(CONFIG_SOCRATES)
36-
static struct mb862xx_gc_mode socrates_gc_mode = {
37-
/* Mode for Prime View PM070WL4 TFT LCD Panel */
38-
{ "800x480", 45, 800, 480, 40000, 86, 42, 33, 10, 128, 2, 0, 0, 0 },
39-
/* 16 bits/pixel, 16MB, 133MHz, SDRAM memory mode value */
40-
16, 0x1000000, GC_CCF_COT_133, 0x4157ba63
41-
};
42-
#endif
43-
4435
/* Helpers */
4536
static inline int h_total(struct fb_var_screeninfo *var)
4637
{
@@ -666,6 +657,15 @@ static int mb862xx_gdc_init(struct mb862xxfb_par *par)
666657
return 0;
667658
}
668659

660+
#if defined(CONFIG_SOCRATES)
661+
static struct mb862xx_gc_mode socrates_gc_mode = {
662+
/* Mode for Prime View PM070WL4 TFT LCD Panel */
663+
{ "800x480", 45, 800, 480, 40000, 86, 42, 33, 10, 128, 2, 0, 0, 0 },
664+
/* 16 bits/pixel, 16MB, 133MHz, SDRAM memory mode value */
665+
16, 0x1000000, GC_CCF_COT_133, 0x4157ba63
666+
};
667+
#endif
668+
669669
static int of_platform_mb862xx_probe(struct platform_device *ofdev)
670670
{
671671
struct device_node *np = ofdev->dev.of_node;

drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,17 +225,12 @@ static ssize_t tpo_td043_gamma_show(struct device *dev,
225225
{
226226
struct panel_drv_data *ddata = dev_get_drvdata(dev);
227227
ssize_t len = 0;
228-
int ret;
229228
int i;
230229

231-
for (i = 0; i < ARRAY_SIZE(ddata->gamma); i++) {
232-
ret = snprintf(buf + len, PAGE_SIZE - len, "%u ",
233-
ddata->gamma[i]);
234-
if (ret < 0)
235-
return ret;
236-
len += ret;
237-
}
238-
buf[len - 1] = '\n';
230+
for (i = 0; i < ARRAY_SIZE(ddata->gamma); i++)
231+
len += sysfs_emit_at(buf, len, "%u ", ddata->gamma[i]);
232+
if (len)
233+
buf[len - 1] = '\n';
239234

240235
return len;
241236
}

drivers/video/fbdev/s3fb.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,13 @@ static int s3fb_set_par(struct fb_info *info)
617617
info->tileops = NULL;
618618

619619
/* in 4bpp supports 8p wide tiles only, any tiles otherwise */
620-
info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0);
621-
info->pixmap.blit_y = ~(u32)0;
620+
if (bpp == 4) {
621+
bitmap_zero(info->pixmap.blit_x, FB_MAX_BLIT_WIDTH);
622+
set_bit(8 - 1, info->pixmap.blit_x);
623+
} else {
624+
bitmap_fill(info->pixmap.blit_x, FB_MAX_BLIT_WIDTH);
625+
}
626+
bitmap_fill(info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT);
622627

623628
offset_value = (info->var.xres_virtual * bpp) / 64;
624629
screen_size = info->var.yres_virtual * info->fix.line_length;
@@ -630,8 +635,10 @@ static int s3fb_set_par(struct fb_info *info)
630635
info->tileops = fasttext ? &s3fb_fast_tile_ops : &s3fb_tile_ops;
631636

632637
/* supports 8x16 tiles only */
633-
info->pixmap.blit_x = 1 << (8 - 1);
634-
info->pixmap.blit_y = 1 << (16 - 1);
638+
bitmap_zero(info->pixmap.blit_x, FB_MAX_BLIT_WIDTH);
639+
set_bit(8 - 1, info->pixmap.blit_x);
640+
bitmap_zero(info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT);
641+
set_bit(16 - 1, info->pixmap.blit_y);
635642

636643
offset_value = info->var.xres_virtual / 16;
637644
screen_size = (info->var.xres_virtual * info->var.yres_virtual) / 64;

0 commit comments

Comments
 (0)