Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+110 -70
+1 -1
drivers/firmware/efi/earlycon.c
··· 252 252 if (si->lfb_depth != 32) 253 253 return -ENODEV; 254 254 255 - font = get_default_font(xres, yres, -1, -1); 255 + font = get_default_font(xres, yres, NULL, NULL); 256 256 if (!font) 257 257 return -ENODEV; 258 258
+1 -1
drivers/video/fbdev/Kconfig
··· 1523 1523 config FB_SH_MOBILE_LCDC 1524 1524 tristate "SuperH Mobile LCDC framebuffer support" 1525 1525 depends on FB && HAVE_CLK && HAS_IOMEM 1526 - depends on SUPERH || ARCH_RENESAS || COMPILE_TEST 1526 + depends on SUPERH || COMPILE_TEST 1527 1527 depends on FB_DEVICE 1528 1528 select FB_BACKLIGHT 1529 1529 select FB_DEFERRED_IO
+11 -4
drivers/video/fbdev/arkfb.c
··· 622 622 info->tileops = NULL; 623 623 624 624 /* 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); 627 632 628 633 offset_value = (info->var.xres_virtual * bpp) / 64; 629 634 screen_size = info->var.yres_virtual * info->fix.line_length; ··· 640 635 info->tileops = &arkfb_tile_ops; 641 636 642 637 /* supports 8x16 tiles only */ 643 - info->pixmap.blit_x = 1 << (8 - 1); 644 - 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); 645 642 646 643 offset_value = info->var.xres_virtual / 16; 647 644 screen_size = (info->var.xres_virtual * info->var.yres_virtual) / 64;
+9 -7
drivers/video/fbdev/core/fbcon.c
··· 2479 2479 h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres)) 2480 2480 return -EINVAL; 2481 2481 2482 - if (font->width > 32 || font->height > 32) 2482 + if (font->width > FB_MAX_BLIT_WIDTH || font->height > FB_MAX_BLIT_HEIGHT) 2483 2483 return -EINVAL; 2484 2484 2485 2485 /* 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)) 2488 2488 return -EINVAL; 2489 2489 2490 2490 /* Make sure driver can handle the font length */ ··· 3050 3050 vc = vc_cons[i].d; 3051 3051 if (vc && vc->vc_mode == KD_TEXT && 3052 3052 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); 3055 3055 charcnt = vc->vc_font.charcount; 3056 3056 if (caps->len < charcnt) 3057 3057 caps->len = charcnt; ··· 3062 3062 3063 3063 if (vc && vc->vc_mode == KD_TEXT && 3064 3064 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); 3067 3069 caps->len = vc->vc_font.charcount; 3068 3070 } 3069 3071 }
+6 -6
drivers/video/fbdev/core/fbmem.c
··· 212 212 fbcon_get_requirement(info, &caps); 213 213 info->fbops->fb_get_caps(info, &fbcaps, var); 214 214 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) || 217 217 (fbcaps.len < caps.len)) 218 218 err = -EINVAL; 219 219 ··· 420 420 } 421 421 fb_info->pixmap.offset = 0; 422 422 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); 425 425 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); 428 428 429 429 if (!fb_info->modelist.prev || !fb_info->modelist.next) 430 430 INIT_LIST_HEAD(&fb_info->modelist);
+4 -3
drivers/video/fbdev/core/fbmon.c
··· 1311 1311 int fb_videomode_from_videomode(const struct videomode *vm, 1312 1312 struct fb_videomode *fbmode) 1313 1313 { 1314 - unsigned int htotal, vtotal; 1314 + unsigned int htotal, vtotal, total; 1315 1315 1316 1316 fbmode->xres = vm->hactive; 1317 1317 fbmode->left_margin = vm->hback_porch; ··· 1344 1344 vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch + 1345 1345 vm->vsync_len; 1346 1346 /* 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; 1349 1350 /* a mode must have htotal and vtotal != 0 or it is invalid */ 1350 1351 } else { 1351 1352 fbmode->refresh = 0;
+11 -4
drivers/video/fbdev/core/svgalib.c
··· 354 354 { 355 355 if (var->bits_per_pixel == 0) { 356 356 /* 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); 359 361 caps->len = 256; 360 362 } 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); 363 370 caps->len = ~(u32)0; 364 371 } 365 372 }
+9 -9
drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
··· 32 32 #define CARMINE_MEM_SIZE 0x8000000 33 33 #define DRV_NAME "mb862xxfb" 34 34 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 - 44 35 /* Helpers */ 45 36 static inline int h_total(struct fb_var_screeninfo *var) 46 37 { ··· 656 665 outreg(host, GC_IMASK, GC_INT_EN); 657 666 return 0; 658 667 } 668 + 669 + #if defined(CONFIG_SOCRATES) 670 + static struct mb862xx_gc_mode socrates_gc_mode = { 671 + /* Mode for Prime View PM070WL4 TFT LCD Panel */ 672 + { "800x480", 45, 800, 480, 40000, 86, 42, 33, 10, 128, 2, 0, 0, 0 }, 673 + /* 16 bits/pixel, 16MB, 133MHz, SDRAM memory mode value */ 674 + 16, 0x1000000, GC_CCF_COT_133, 0x4157ba63 675 + }; 676 + #endif 659 677 660 678 static int of_platform_mb862xx_probe(struct platform_device *ofdev) 661 679 {
+4 -9
drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c
··· 225 225 { 226 226 struct panel_drv_data *ddata = dev_get_drvdata(dev); 227 227 ssize_t len = 0; 228 - int ret; 229 228 int i; 230 229 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'; 239 234 240 235 return len; 241 236 }
+11 -4
drivers/video/fbdev/s3fb.c
··· 617 617 info->tileops = NULL; 618 618 619 619 /* 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); 622 627 623 628 offset_value = (info->var.xres_virtual * bpp) / 64; 624 629 screen_size = info->var.yres_virtual * info->fix.line_length; ··· 635 630 info->tileops = fasttext ? &s3fb_fast_tile_ops : &s3fb_tile_ops; 636 631 637 632 /* supports 8x16 tiles only */ 638 - info->pixmap.blit_x = 1 << (8 - 1); 639 - info->pixmap.blit_y = 1 << (16 - 1); 633 + bitmap_zero(info->pixmap.blit_x, FB_MAX_BLIT_WIDTH); 634 + set_bit(8 - 1, info->pixmap.blit_x); 635 + bitmap_zero(info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT); 636 + set_bit(16 - 1, info->pixmap.blit_y); 640 637 641 638 offset_value = info->var.xres_virtual / 16; 642 639 screen_size = (info->var.xres_virtual * info->var.yres_virtual) / 64;
+1 -1
drivers/video/fbdev/uvesafb.c
··· 1546 1546 struct fb_info *info = dev_get_drvdata(dev); 1547 1547 struct uvesafb_par *par = info->par; 1548 1548 1549 - return snprintf(buf, PAGE_SIZE, "%.4x\n", par->vbe_ib.vbe_version); 1549 + return sysfs_emit(buf, "%.4x\n", par->vbe_ib.vbe_version); 1550 1550 } 1551 1551 1552 1552 static DEVICE_ATTR(vbe_version, S_IRUGO, uvesafb_show_vbe_ver, NULL);
+5 -1
drivers/video/fbdev/vga16fb.c
··· 1353 1353 info->var = vga16fb_defined; 1354 1354 info->fix = vga16fb_fix; 1355 1355 /* supports rectangles with widths of multiples of 8 */ 1356 - info->pixmap.blit_x = 1 << 7 | 1 << 15 | 1 << 23 | 1 << 31; 1356 + bitmap_zero(info->pixmap.blit_x, FB_MAX_BLIT_WIDTH); 1357 + set_bit(8 - 1, info->pixmap.blit_x); 1358 + set_bit(16 - 1, info->pixmap.blit_x); 1359 + set_bit(24 - 1, info->pixmap.blit_x); 1360 + set_bit(32 - 1, info->pixmap.blit_x); 1357 1361 info->flags = FBINFO_HWACCEL_YPAN; 1358 1362 1359 1363 i = (info->var.bits_per_pixel == 8) ? 256 : 16;
+2 -2
drivers/video/fbdev/via/accel.c
··· 115 115 116 116 if (op != VIA_BITBLT_FILL) { 117 117 tmp = src_mem ? 0 : src_addr; 118 - if (dst_addr & 0xE0000007) { 118 + if (tmp & 0xE0000007) { 119 119 printk(KERN_WARNING "hw_bitblt_1: Unsupported source " 120 120 "address %X\n", tmp); 121 121 return -EINVAL; ··· 260 260 writel(tmp, engine + 0x18); 261 261 262 262 tmp = src_mem ? 0 : src_addr; 263 - if (dst_addr & 0xE0000007) { 263 + if (tmp & 0xE0000007) { 264 264 printk(KERN_WARNING "hw_bitblt_2: Unsupported source " 265 265 "address %X\n", tmp); 266 266 return -EINVAL;
+11 -4
drivers/video/fbdev/vt8623fb.c
··· 390 390 info->tileops = NULL; 391 391 392 392 /* in 4bpp supports 8p wide tiles only, any tiles otherwise */ 393 - info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0); 394 - info->pixmap.blit_y = ~(u32)0; 393 + if (bpp == 4) { 394 + bitmap_zero(info->pixmap.blit_x, FB_MAX_BLIT_WIDTH); 395 + set_bit(8 - 1, info->pixmap.blit_x); 396 + } else { 397 + bitmap_fill(info->pixmap.blit_x, FB_MAX_BLIT_WIDTH); 398 + } 399 + bitmap_fill(info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT); 395 400 396 401 offset_value = (info->var.xres_virtual * bpp) / 64; 397 402 fetch_value = ((info->var.xres * bpp) / 128) + 4; ··· 413 408 info->tileops = &vt8623fb_tile_ops; 414 409 415 410 /* supports 8x16 tiles only */ 416 - info->pixmap.blit_x = 1 << (8 - 1); 417 - info->pixmap.blit_y = 1 << (16 - 1); 411 + bitmap_zero(info->pixmap.blit_x, FB_MAX_BLIT_WIDTH); 412 + set_bit(8 - 1, info->pixmap.blit_x); 413 + bitmap_zero(info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT); 414 + set_bit(16 - 1, info->pixmap.blit_y); 418 415 419 416 offset_value = info->var.xres_virtual / 16; 420 417 fetch_value = (info->var.xres / 8) + 8;
+1 -1
drivers/video/sticore.c
··· 529 529 if (fbfont_name && strlen(fbfont_name)) 530 530 fbfont = find_font(fbfont_name); 531 531 if (!fbfont) 532 - fbfont = get_default_font(1024,768, ~(u32)0, ~(u32)0); 532 + fbfont = get_default_font(1024, 768, NULL, NULL); 533 533 if (!fbfont) 534 534 return NULL; 535 535
+12 -6
include/linux/fb.h
··· 145 145 void *data; 146 146 }; 147 147 148 + /* Enough for the VT console needs, see its max_font_width/height */ 149 + #define FB_MAX_BLIT_WIDTH 64 150 + #define FB_MAX_BLIT_HEIGHT 128 151 + 148 152 struct fb_blit_caps { 149 - u32 x; 150 - u32 y; 153 + DECLARE_BITMAP(x, FB_MAX_BLIT_WIDTH); 154 + DECLARE_BITMAP(y, FB_MAX_BLIT_HEIGHT); 151 155 u32 len; 152 156 u32 flags; 153 157 }; ··· 198 194 u32 scan_align; /* alignment per scanline */ 199 195 u32 access_align; /* alignment per read/write (bits) */ 200 196 u32 flags; /* see FB_PIXMAP_* */ 201 - u32 blit_x; /* supported bit block dimensions (1-32)*/ 202 - u32 blit_y; /* Format: blit_x = 1 << (width - 1) */ 203 - /* blit_y = 1 << (height - 1) */ 204 - /* if 0, will be set to 0xffffffff (all)*/ 197 + /* supported bit block dimensions */ 198 + /* Format: test_bit(width - 1, blit_x) */ 199 + /* test_bit(height - 1, blit_y) */ 200 + /* if zero, will be set to full (all) */ 201 + DECLARE_BITMAP(blit_x, FB_MAX_BLIT_WIDTH); 202 + DECLARE_BITMAP(blit_y, FB_MAX_BLIT_HEIGHT); 205 203 /* access methods */ 206 204 void (*writeio)(struct fb_info *info, void __iomem *dst, void *src, unsigned int size); 207 205 void (*readio) (struct fb_info *info, void *dst, void __iomem *src, unsigned int size);
+2 -1
include/linux/font.h
··· 57 57 /* Get the default font for a specific screen size */ 58 58 59 59 extern const struct font_desc *get_default_font(int xres, int yres, 60 - u32 font_w, u32 font_h); 60 + unsigned long *font_w, 61 + unsigned long *font_h); 61 62 62 63 /* Max. length for the name of a predefined font */ 63 64 #define MAX_FONT_NAME 32
+9 -6
lib/fonts/fonts.c
··· 96 96 * get_default_font - get default font 97 97 * @xres: screen size of X 98 98 * @yres: screen size of Y 99 - * @font_w: bit array of supported widths (1 - 32) 100 - * @font_h: bit array of supported heights (1 - 32) 99 + * @font_w: bit array of supported widths (1 - FB_MAX_BLIT_WIDTH) 100 + * @font_h: bit array of supported heights (1 - FB_MAX_BLIT_HEIGHT) 101 101 * 102 102 * Get the default font for a specified screen size. 103 103 * Dimensions are in pixels. 104 + * 105 + * font_w or font_h being NULL means all values are supported. 104 106 * 105 107 * Returns %NULL if no font is found, or a pointer to the 106 108 * chosen font. 107 109 * 108 110 */ 109 - const struct font_desc *get_default_font(int xres, int yres, u32 font_w, 110 - u32 font_h) 111 + const struct font_desc *get_default_font(int xres, int yres, 112 + unsigned long *font_w, 113 + unsigned long *font_h) 111 114 { 112 115 int i, c, cc, res; 113 116 const struct font_desc *f, *g; ··· 138 135 if (res > 20) 139 136 c += 20 - res; 140 137 141 - if ((font_w & (1U << (f->width - 1))) && 142 - (font_h & (1U << (f->height - 1)))) 138 + if ((!font_w || test_bit(f->width - 1, font_w)) && 139 + (!font_h || test_bit(f->height - 1, font_h))) 143 140 c += 1000; 144 141 145 142 if (c > cc) {