Lines Matching +full:ati +full:- +full:mode

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
85 /* See "16-color Text Extension" Open Firmware document, page 4 */
107 if (chosen == -1)
110 node = -1;
114 if (node == -1)
115 if (OF_getprop(chosen, "stdout-path", buf, sizeof(buf)) > 0)
117 if (node == -1) {
138 struct fb_info *sc = vd->vd_softc;
150 if (sc->fb_flags & FB_FLAG_NOWRITE) {
152 sc->fb_flags &= ~FB_FLAG_NOWRITE;
154 vd->vd_driver->vd_blank(vd, TC_BLACK);
161 fgc = sc->fb_cmap[fg];
162 bgc = sc->fb_cmap[bg];
165 if (((struct ofwfb_softc *)vd->vd_softc)->iso_palette) {
170 line = (sc->fb_stride * y) + x * sc->fb_bpp/8;
171 if (mask == NULL && sc->fb_bpp == 8 && (width % 8 == 0)) {
173 if (((x + width) > vd->vd_width) || ((y + height) >
174 vd->vd_height))
177 for (; height > 0; height--) {
189 * Calculate 2 x 4-chars at a time, and then
202 *(uint32_t *)(sc->fb_vbase + line + c) = ch1.l;
203 *(uint32_t *)(sc->fb_vbase + line + c + 4) =
206 line += sc->fb_stride;
210 l < height && y + l < vw->vw_draw_area.tr_end.tp_row;
213 c < width && x + c < vw->vw_draw_area.tr_end.tp_col;
228 switch(sc->fb_bpp) {
230 *(uint8_t *)(sc->fb_vbase + line + c) =
234 *(uint32_t *)(sc->fb_vbase + line + 4*c)
242 line += sc->fb_stride;
267 vf = vw->vw_font;
269 for (row = area->tr_begin.tp_row; row < area->tr_end.tp_row; ++row) {
270 for (col = area->tr_begin.tp_col; col < area->tr_end.tp_col;
272 x = col * vf->vf_width +
273 vw->vw_draw_area.tr_begin.tp_col;
274 y = row * vf->vf_height +
275 vw->vw_draw_area.tr_begin.tp_row;
277 c = VTBUF_GET_FIELD(&vw->vw_buf, row, col);
280 VTBUF_ISCURSOR(&vw->vw_buf, row, col), &fg, &bg);
283 pattern, NULL, vf->vf_width, vf->vf_height,
289 if (!vd->vd_mshown)
294 drawn_area.tr_begin.tp_col = area->tr_begin.tp_col * vf->vf_width;
295 drawn_area.tr_begin.tp_row = area->tr_begin.tp_row * vf->vf_height;
296 drawn_area.tr_end.tp_col = area->tr_end.tp_col * vf->vf_width;
297 drawn_area.tr_end.tp_row = area->tr_end.tp_row * vf->vf_height;
301 vd->vd_mcursor->map, vd->vd_mcursor->mask,
302 vd->vd_mcursor->width, vd->vd_mcursor->height,
303 vd->vd_mx_drawn + vw->vw_draw_area.tr_begin.tp_col,
304 vd->vd_my_drawn + vw->vw_draw_area.tr_begin.tp_row,
305 vd->vd_mcursor_fg, vd->vd_mcursor_bg);
312 * Decode OpenFirmware/IEEE 1275-1994 "ranges" property
339 if (OF_getencprop(pcinode, "#address-cells", &acells, sizeof(acells)) !=
343 if (OF_getencprop(pcinode, "#size-cells", &scells, sizeof(scells)) !=
347 if (OF_searchencprop(OF_parent(pcinode), "#address-cells",
393 * zero-length property value, the child address space is identical
411 struct ofwfb_softc *sc = vd->vd_softc;
415 sc->fb.fb_cmsize = 16;
417 if (sc->fb.fb_flags & FB_FLAG_NOWRITE)
424 sc->iso_palette = 0;
425 switch (sc->fb.fb_bpp) {
431 vt_config_cons_colors(&sc->fb, COLOR_FORMAT_RGB, 255,
435 err = OF_call_method("color!", sc->sc_handle, 4, 1,
436 (cell_t)((sc->fb.fb_cmap[i] >> 16) & 0xff),
437 (cell_t)((sc->fb.fb_cmap[i] >> 8) & 0xff),
438 (cell_t)((sc->fb.fb_cmap[i] >> 0) & 0xff),
444 sc->iso_palette = 1;
456 * NVidia cards tend to be RGBA32, and ATI cards tend to be ARGB32.
461 if (sc->vendor_id == PCI_VID_NVIDIA)
462 sc->argb = 0;
464 sc->argb = 1;
466 TUNABLE_INT_FETCH("hw.ofwfb.argb32_pixel", &sc->argb);
467 if (sc->endian_flip) {
468 if (sc->argb)
473 if (sc->argb)
478 vt_config_cons_colors(&sc->fb,
483 panic("Unknown color space depth %d", sc->fb.fb_bpp);
504 vd->vd_softc = sc = &ofwfb_conssoftc;
506 node = -1;
508 if (OF_getencprop(chosen, "stdout", &sc->sc_handle,
510 node = OF_instance_to_package(sc->sc_handle);
511 if (node == -1)
512 /* Try "/chosen/stdout-path" now */
513 if (OF_getprop(chosen, "stdout-path", buf, sizeof(buf)) > 0) {
515 if (node != -1)
516 sc->sc_handle = OF_open(buf);
518 if (node == -1) {
524 sc->sc_handle = OF_open("screen");
531 * Retrieve vendor-id from /chosen parent node, usually pointing to
535 if (OF_getencprop(OF_parent(node), "vendor-id", &vendor_id,
537 sc->vendor_id = vendor_id;
540 sc->sc_node = node;
543 * Try to use a 32-bit framebuffer if possible. This may be
544 * unimplemented and fail. That's fine -- it just means we are
547 OF_call_method("set-depth", sc->sc_handle, 1, 1, (cell_t)32, &i);
555 /* Only support 8 and 32-bit framebuffers */
559 sc->fb.fb_bpp = sc->fb.fb_depth = depth;
568 sc->fb.fb_height = height;
569 sc->fb.fb_width = width;
570 sc->fb.fb_stride = stride;
571 sc->fb.fb_size = sc->fb.fb_height * sc->fb.fb_stride;
572 sc->endian_flip = 0;
575 if (OF_hasprop(node, "little-endian")) {
576 sc->sc_memt = &bs_le_tag;
578 sc->endian_flip = 1;
580 } else if (OF_hasprop(node, "big-endian")) {
581 sc->sc_memt = &bs_be_tag;
583 sc->endian_flip = 1;
589 sc->sc_memt = &bs_be_tag;
591 sc->sc_memt = &bs_le_tag;
595 sc->sc_memt = fdtbus_bs_tag;
614 sc->fb.fb_pbase = (vm_paddr_t)user_phys;
615 else if (sc->vendor_id == PCI_VID_ASPEED)
616 sc->fb.fb_pbase = find_pci_host_address(node);
633 sc->fb.fb_pbase = (vm_paddr_t)fb_phys;
649 * parent for the assigned-addresses property.
651 len = OF_getencprop(node, "assigned-addresses",
653 if (len == -1) {
654 len = OF_getencprop(OF_parent(node), "assigned-addresses",
657 if (len == -1)
664 if (pciaddrs[i].size_lo < sc->fb.fb_stride * height)
685 sc->fb.fb_pbase = (vm_paddr_t)fb_phys;
687 /* No ability to interpret assigned-addresses otherwise */
692 if (!sc->fb.fb_pbase)
695 bus_space_map(sc->sc_memt, sc->fb.fb_pbase, sc->fb.fb_size,
697 (bus_space_handle_t *)&sc->fb.fb_vbase);
701 * If we are running on PowerPC in real mode (supported only on AIM
702 * CPUs), the frame buffer may be inaccessible (real mode does not
704 * cache properties (all real mode accesses are assumed cacheable).
708 sc->fb.fb_flags |= FB_FLAG_NOWRITE;