Lines Matching +full:dac +full:- +full:mode +full:- +full:mask
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
59 * palette array for 8-bit indexed colors. In this case, cmap does store
108 if (strcasecmp(res->name, cmp) == 0) in vbe_resolution_compare()
110 if (res->alias != NULL && strcasecmp(res->alias, cmp) == 0) in vbe_resolution_compare()
132 *width = res->width; in vbe_get_max_resolution()
133 *height = res->height; in vbe_get_max_resolution()
243 return ((vbe->Capabilities & VBE_CAP_NONVGA) == 0); in vbe_is_vga()
246 /* Actually assuming mode 3. */
248 bios_set_text_mode(int mode) in bios_set_text_mode() argument
252 if (vbe->Capabilities & VBE_CAP_DAC8) { in bios_set_text_mode()
256 * The mode change should reset the palette format to in bios_set_text_mode()
257 * 6 bits, but apparently some systems do fail with 8-bit in bios_set_text_mode()
258 * palette, so we switch to 6-bit here. in bios_set_text_mode()
266 v86.eax = mode; /* set VGA text mode */ in bios_set_text_mode()
273 gfx_state.tg_mode = mode; in bios_set_text_mode()
278 gfx_state.tg_fb.fb_mask_red = (1 << palette_format) - 1 << 16; in bios_set_text_mode()
279 gfx_state.tg_fb.fb_mask_green = (1 << palette_format) - 1 << 8; in bios_set_text_mode()
280 gfx_state.tg_fb.fb_mask_blue = (1 << palette_format) - 1 << 0; in bios_set_text_mode()
285 /* Function 00h - Return VBE Controller Information */
301 memcpy(rvbe->VbeSignature, "VBE2", 4); in biosvbe_info()
314 if (memcmp(rvbe->VbeSignature, "VESA", 4) != 0) { in biosvbe_info()
324 /* Function 01h - Return VBE Mode Information */
326 biosvbe_get_mode_info(int mode, struct modeinfoblock *mi) in biosvbe_get_mode_info() argument
338 v86.ecx = mode; in biosvbe_get_mode_info()
352 /* Function 02h - Set VBE Mode */
354 biosvbe_set_mode(int mode, struct crtciinfoblock *ci) in biosvbe_set_mode() argument
358 if (vbe->Capabilities & VBE_CAP_DAC8) { in biosvbe_set_mode()
362 * The mode change should reset the palette format to in biosvbe_set_mode()
363 * 6 bits, but apparently some systems do fail with 8-bit in biosvbe_set_mode()
364 * palette, so we switch to 6-bit here. in biosvbe_set_mode()
373 v86.ebx = mode | 0x4000; /* set linear FB bit */ in biosvbe_set_mode()
378 if (vbe->Capabilities & VBE_CAP_DAC8) { in biosvbe_set_mode()
381 /* Switch to 8-bits per primary color. */ in biosvbe_set_mode()
390 /* Function 03h - Get VBE Mode */
392 biosvbe_get_mode(int *mode) in biosvbe_get_mode() argument
398 *mode = v86.ebx & 0x3fff; /* Bits 0-13 */ in biosvbe_get_mode()
402 /* Function 08h - Set/Get DAC Palette Format */
415 /* Function 09h - Set/Get Palette Data */
417 biosvbe_palette_data(int mode, int reg, struct paletteentry *pe) in biosvbe_palette_data() argument
422 v86.ebx = mode; in biosvbe_palette_data()
432 * Function 15h BL=00h - Report VBE/DDC Capabilities
453 /* Function 11h BL=01h - Flat Panel status */
467 /* Function 15h BL=01h - Read EDID */
486 if ((mi->ModeAttributes & 0x01) == 0) in vbe_mode_is_supported()
487 return (0); /* mode not supported by hardware */ in vbe_mode_is_supported()
488 if ((mi->ModeAttributes & 0x08) == 0) in vbe_mode_is_supported()
490 if ((mi->ModeAttributes & 0x10) == 0) in vbe_mode_is_supported()
491 return (0); /* text mode */ in vbe_mode_is_supported()
492 if (mi->NumberOfPlanes != 1) in vbe_mode_is_supported()
493 return (0); /* planar mode not supported */ in vbe_mode_is_supported()
494 if (mi->MemoryModel != 0x04 /* Packed pixel */ && in vbe_mode_is_supported()
495 mi->MemoryModel != 0x06 /* Direct Color */) in vbe_mode_is_supported()
514 int mode; in mode_set() local
516 if (strcmp(ev->ev_name, "screen.textmode") == 0) { in mode_set()
536 } else if (strcmp(ev->ev_name, "vbe_max_resolution") == 0) { in mode_set()
543 mode = vbe_default_mode(); in mode_set()
544 if (gfx_state.tg_mode != mode) { in mode_set()
547 vbe_set_mode(mode); in mode_set()
564 /* First set FB for text mode. */ in vbe_init()
599 * Copy mode list. We must do this because some systems do in vbe_init()
602 p = ml = vbe_farptr(vbe->VideoModePtr); in vbe_init()
606 vbe_mode_list_size = (uintptr_t)p - (uintptr_t)ml; in vbe_init()
620 vbe->VideoModePtr = 0; in vbe_init()
635 int mode, ret; in vbe_set_palette() local
637 if (!vbe_check() || (vbe->Capabilities & VBE_CAP_DAC8) == 0) in vbe_set_palette()
644 pe.Blue = entry->Blue; in vbe_set_palette()
645 pe.Green = entry->Green; in vbe_set_palette()
646 pe.Red = entry->Red; in vbe_set_palette()
647 pe.Reserved = entry->Reserved; in vbe_set_palette()
649 if (vbe->Capabilities & VBE_CAP_SNOW) in vbe_set_palette()
650 mode = 0x80; in vbe_set_palette()
652 mode = 0; in vbe_set_palette()
654 ret = biosvbe_palette_data(mode, slot, &pe); in vbe_set_palette()
676 printf("mode 0x%x invalid\n", modenum); in vbe_set_mode()
681 printf("mode 0x%x not supported\n", modenum); in vbe_set_mode()
700 printf("mode 0x%x could not be set\n", modenum); in vbe_set_mode()
731 #define COLOR_MASK(size, pos) (((1 << size) - 1) << pos) in vbe_set_mode()
736 } else if (vbe->VbeVersion >= 0x300) { in vbe_set_mode()
755 if (vbe->VbeVersion >= 0x300) in vbe_set_mode()
767 * Verify existence of mode number or find mode by
775 uint16_t mode; in vbe_find_mode_xydm() local
782 if (m != -1) in vbe_find_mode_xydm()
784 else if (depth == -1) in vbe_find_mode_xydm()
792 mode = vbe_mode_list[idx]; in vbe_find_mode_xydm()
793 if (mode == 0xffff) in vbe_find_mode_xydm()
796 if (biosvbe_get_mode_info(mode, &mi) != VBE_SUCCESS) { in vbe_find_mode_xydm()
804 if (m != -1) { in vbe_find_mode_xydm()
805 if (m == mode) in vbe_find_mode_xydm()
806 return (mode); in vbe_find_mode_xydm()
814 return (mode); in vbe_find_mode_xydm()
816 if (depth != -1) in vbe_find_mode_xydm()
819 i -= 8; in vbe_find_mode_xydm()
833 return (vbe_find_mode_xydm(x, y, depth, -1)); in vbe_find_mode()
840 mi->XResolution, mi->YResolution, mi->BitsPerPixel); in vbe_dump_mode()
871 if (edidp->header.version != 1) in vbe_get_edid()
897 *pwidth = fp_info->HSize; in vbe_get_flatpanel()
898 *pheight = fp_info->VSize; in vbe_get_flatpanel()
928 if (vbep->OemStringPtr != 0) in vbe_print_vbe_info()
929 oemstring = vbe_farptr(vbep->OemStringPtr); in vbe_print_vbe_info()
931 if (vbep->OemVendorNamePtr != 0) in vbe_print_vbe_info()
932 oemvendor = vbe_farptr(vbep->OemVendorNamePtr); in vbe_print_vbe_info()
934 if (vbep->OemProductNamePtr != 0) in vbe_print_vbe_info()
935 oemproductname = vbe_farptr(vbep->OemProductNamePtr); in vbe_print_vbe_info()
937 if (vbep->OemProductRevPtr != 0) in vbe_print_vbe_info()
938 oemproductrev = vbe_farptr(vbep->OemProductRevPtr); in vbe_print_vbe_info()
940 printf("VESA VBE Version %d.%d\n%s\n", vbep->VbeVersion >> 8, in vbe_print_vbe_info()
941 vbep->VbeVersion & 0xF, oemstring); in vbe_print_vbe_info()
943 if (vbep->OemSoftwareRev != 0) { in vbe_print_vbe_info()
945 vbep->OemSoftwareRev >> 8, vbep->OemSoftwareRev & 0xF, in vbe_print_vbe_info()
948 vbe_print_memory(vbep->TotalMemory << 16); in vbe_print_vbe_info()
949 printf("Number of Image Pages: %d\n", vbe_mode->LinNumberOfImagePages); in vbe_print_vbe_info()
952 /* List available modes, filter by depth. If depth is -1, list all. */
957 uint16_t mode; in vbe_modelist() local
981 printf(" %dx%d", rp->width, rp->height); in vbe_modelist()
996 memcpy(vbe->VbeSignature, "VBE2", 4); in vbe_modelist()
999 if (memcmp(vbe->VbeSignature, "VESA", 4) != 0) in vbe_modelist()
1007 mode = vbe_mode_list[idx]; in vbe_modelist()
1008 if (mode == 0xffff) in vbe_modelist()
1011 if (biosvbe_get_mode_info(mode, &mi) != VBE_SUCCESS) in vbe_modelist()
1019 if (depth != -1 && mi.BitsPerPixel != depth) in vbe_modelist()
1027 vbe_dump_mode(mode, &mi); in vbe_modelist()
1040 int nc, mode, i, rc; in vbe_print_mode() local
1050 if (biosvbe_get_mode(&mode) != VBE_SUCCESS) { in vbe_print_mode()
1051 printf("Error getting current VBE mode\n"); in vbe_print_mode()
1055 if (biosvbe_get_mode_info(mode, vbe_mode) != VBE_SUCCESS || in vbe_print_mode()
1057 printf("VBE mode (0x%x) is not framebuffer mode\n", mode); in vbe_print_mode()
1061 printf("\nCurrent VBE mode: "); in vbe_print_mode()
1062 vbe_dump_mode(mode, vbe_mode); in vbe_print_mode()
1075 if (vbe_mode->MemoryModel == 0x6) { in vbe_print_mode()
1076 printf(" color mask: R=%08x, G=%08x, B=%08x\n", in vbe_print_mode()
1084 ffs(gfx_state.tg_fb.fb_mask_red) - 1, in vbe_print_mode()
1086 ffs(gfx_state.tg_fb.fb_mask_green) - 1, in vbe_print_mode()
1088 ffs(gfx_state.tg_fb.fb_mask_blue) - 1, cmap[i]); in vbe_print_mode()
1096 mode = 1; /* get DAC palette width */ in vbe_print_mode()
1097 rc = biosvbe_palette_format(&mode); in vbe_print_mode()
1101 printf(" palette format: %x bits per primary\n", mode); in vbe_print_mode()
1116 * Try EDID preferred mode, if EDID or the suggested mode is not available,
1131 modenum = vbe_find_mode_xydm(width, height, -1, -1); in vbe_default_mode()
1138 rp->width, rp->height, -1, -1); in vbe_default_mode()
1147 modenum = vbe_find_mode_xydm(width, height, -1, -1); in vbe_default_mode()
1150 /* Still no mode? Fall back to default. */ in vbe_default_mode()
1156 COMMAND_SET(vbe, "vbe", "vesa framebuffer mode management", command_vesa);
1162 int modenum = -1, n; in command_vesa()
1171 n = -1; in command_vesa()
1194 if (argc > 3 || strcmp(argv[2], "-v") != 0) in command_vesa()
1223 "%s: no suitable VBE mode number found", argv[0]); in command_vesa()
1237 "mode should be an integer"); in command_vesa()
1250 "%s: mode %s not supported by firmware\n", in command_vesa()
1265 "%s: mode %s is not framebuffer mode\n", argv[0], argv[2]); in command_vesa()
1272 "set <display or VBE mode number>", argv[0]); in command_vesa()