Wed Jan 4 15:56:18 2012 UTC ()
use WSFONT_GLYPH()


(macallan)
diff -r1.25 -r1.26 src/sys/dev/pci/r128fb.c
diff -r1.49 -r1.50 src/sys/dev/pci/radeonfb.c

cvs diff -r1.25 -r1.26 src/sys/dev/pci/r128fb.c (expand / switch to unified diff)

--- src/sys/dev/pci/r128fb.c 2012/01/04 08:38:20 1.25
+++ src/sys/dev/pci/r128fb.c 2012/01/04 15:56:18 1.26
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: r128fb.c,v 1.25 2012/01/04 08:38:20 macallan Exp $ */ 1/* $NetBSD: r128fb.c,v 1.26 2012/01/04 15:56:18 macallan Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2007 Michael Lorenz 4 * Copyright (c) 2007 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28/* 28/*
29 * A console driver for ATI Rage 128 graphics controllers 29 * A console driver for ATI Rage 128 graphics controllers
30 * tested on macppc only so far 30 * tested on macppc only so far
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.25 2012/01/04 08:38:20 macallan Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.26 2012/01/04 15:56:18 macallan Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/malloc.h> 40#include <sys/malloc.h>
41#include <sys/lwp.h> 41#include <sys/lwp.h>
42#include <sys/kauth.h> 42#include <sys/kauth.h>
43 43
44#include <dev/videomode/videomode.h> 44#include <dev/videomode/videomode.h>
45 45
46#include <dev/pci/pcivar.h> 46#include <dev/pci/pcivar.h>
47#include <dev/pci/pcireg.h> 47#include <dev/pci/pcireg.h>
@@ -815,50 +815,48 @@ r128fb_cursor(void *cookie, int on, int  @@ -815,50 +815,48 @@ r128fb_cursor(void *cookie, int on, int
815 } 815 }
816 816
817} 817}
818 818
819static void 819static void
820r128fb_putchar(void *cookie, int row, int col, u_int c, long attr) 820r128fb_putchar(void *cookie, int row, int col, u_int c, long attr)
821{ 821{
822 struct rasops_info *ri = cookie; 822 struct rasops_info *ri = cookie;
823 struct wsdisplay_font *font = PICK_FONT(ri, c); 823 struct wsdisplay_font *font = PICK_FONT(ri, c);
824 struct vcons_screen *scr = ri->ri_hw; 824 struct vcons_screen *scr = ri->ri_hw;
825 struct r128fb_softc *sc = scr->scr_cookie; 825 struct r128fb_softc *sc = scr->scr_cookie;
826 void *data; 826 void *data;
827 uint32_t fg, bg; 827 uint32_t fg, bg;
828 int uc, i; 828 int i, x, y, wi, he, offset;
829 int x, y, wi, he, offset; 
830 829
831 if (sc->sc_mode != WSDISPLAYIO_MODE_EMUL)  830 if (sc->sc_mode != WSDISPLAYIO_MODE_EMUL)
832 return; 831 return;
833 832
834 if (!CHAR_IN_FONT(c, font)) 833 if (!CHAR_IN_FONT(c, font))
835 return; 834 return;
836 835
837 wi = font->fontwidth; 836 wi = font->fontwidth;
838 he = font->fontheight; 837 he = font->fontheight;
839 838
840 bg = ri->ri_devcmap[(attr >> 16) & 0xf]; 839 bg = ri->ri_devcmap[(attr >> 16) & 0xf];
841 fg = ri->ri_devcmap[(attr >> 24) & 0xf]; 840 fg = ri->ri_devcmap[(attr >> 24) & 0xf];
842 x = ri->ri_xorigin + col * wi; 841 x = ri->ri_xorigin + col * wi;
843 y = ri->ri_yorigin + row * he; 842 y = ri->ri_yorigin + row * he;
844 843
845 if (c == 0x20) { 844 if (c == 0x20) {
846 r128fb_rectfill(sc, x, y, wi, he, bg); 845 r128fb_rectfill(sc, x, y, wi, he, bg);
847 return; 846 return;
848 } 847 }
849 848
850 uc = c - font->firstchar; 849 data = WSFONT_GLYPH(c, font);
851 data = (uint8_t *)font->data + uc * ri->ri_fontscale; 
852 850
853 r128fb_wait(sc, 8); 851 r128fb_wait(sc, 8);
854 852
855 bus_space_write_4(sc->sc_memt, sc->sc_regh,  853 bus_space_write_4(sc->sc_memt, sc->sc_regh,
856 R128_DP_GUI_MASTER_CNTL, 854 R128_DP_GUI_MASTER_CNTL,
857 R128_GMC_BRUSH_SOLID_COLOR | 855 R128_GMC_BRUSH_SOLID_COLOR |
858 R128_GMC_SRC_DATATYPE_MONO_FG_BG | 856 R128_GMC_SRC_DATATYPE_MONO_FG_BG |
859 R128_ROP3_S | 857 R128_ROP3_S |
860 R128_DP_SRC_SOURCE_HOST_DATA | 858 R128_DP_SRC_SOURCE_HOST_DATA |
861 R128_GMC_DST_CLIPPING | 859 R128_GMC_DST_CLIPPING |
862 sc->sc_master_cntl); 860 sc->sc_master_cntl);
863 861
864 bus_space_write_4(sc->sc_memt, sc->sc_regh,  862 bus_space_write_4(sc->sc_memt, sc->sc_regh,
@@ -916,49 +914,48 @@ r128fb_putchar(void *cookie, int row, in @@ -916,49 +914,48 @@ r128fb_putchar(void *cookie, int row, in
916 break; 914 break;
917 } 915 }
918 } 916 }
919} 917}
920 918
921static void 919static void
922r128fb_putchar_aa(void *cookie, int row, int col, u_int c, long attr) 920r128fb_putchar_aa(void *cookie, int row, int col, u_int c, long attr)
923{ 921{
924 struct rasops_info *ri = cookie; 922 struct rasops_info *ri = cookie;
925 struct wsdisplay_font *font = PICK_FONT(ri, c); 923 struct wsdisplay_font *font = PICK_FONT(ri, c);
926 struct vcons_screen *scr = ri->ri_hw; 924 struct vcons_screen *scr = ri->ri_hw;
927 struct r128fb_softc *sc = scr->scr_cookie; 925 struct r128fb_softc *sc = scr->scr_cookie;
928 uint32_t bg, latch = 0, bg8, fg8, pixel; 926 uint32_t bg, latch = 0, bg8, fg8, pixel;
929 int uc, i, x, y, wi, he, r, g, b, aval; 927 int i, x, y, wi, he, r, g, b, aval;
930 int r1, g1, b1, r0, g0, b0, fgo, bgo; 928 int r1, g1, b1, r0, g0, b0, fgo, bgo;
931 uint8_t *data8; 929 uint8_t *data8;
932 930
933 if (sc->sc_mode != WSDISPLAYIO_MODE_EMUL)  931 if (sc->sc_mode != WSDISPLAYIO_MODE_EMUL)
934 return; 932 return;
935 933
936 if (!CHAR_IN_FONT(c, font)) 934 if (!CHAR_IN_FONT(c, font))
937 return; 935 return;
938 936
939 wi = font->fontwidth; 937 wi = font->fontwidth;
940 he = font->fontheight; 938 he = font->fontheight;
941 939
942 bg = ri->ri_devcmap[(attr >> 16) & 0xf]; 940 bg = ri->ri_devcmap[(attr >> 16) & 0xf];
943 x = ri->ri_xorigin + col * wi; 941 x = ri->ri_xorigin + col * wi;
944 y = ri->ri_yorigin + row * he; 942 y = ri->ri_yorigin + row * he;
945 if (c == 0x20) { 943 if (c == 0x20) {
946 r128fb_rectfill(sc, x, y, wi, he, bg); 944 r128fb_rectfill(sc, x, y, wi, he, bg);
947 return; 945 return;
948 } 946 }
949 947
950 uc = c - font->firstchar; 948 data8 = WSFONT_GLYPH(c, font);
951 data8 = (uint8_t *)font->data + uc * ri->ri_fontscale; 
952 949
953 r128fb_wait(sc, 5); 950 r128fb_wait(sc, 5);
954 bus_space_write_4(sc->sc_memt, sc->sc_regh,  951 bus_space_write_4(sc->sc_memt, sc->sc_regh,
955 R128_DP_GUI_MASTER_CNTL, 952 R128_DP_GUI_MASTER_CNTL,
956 R128_GMC_BRUSH_SOLID_COLOR | 953 R128_GMC_BRUSH_SOLID_COLOR |
957 R128_GMC_SRC_DATATYPE_COLOR | 954 R128_GMC_SRC_DATATYPE_COLOR |
958 R128_ROP3_S | 955 R128_ROP3_S |
959 R128_DP_SRC_SOURCE_HOST_DATA | 956 R128_DP_SRC_SOURCE_HOST_DATA |
960 sc->sc_master_cntl); 957 sc->sc_master_cntl);
961 958
962 bus_space_write_4(sc->sc_memt, sc->sc_regh,  959 bus_space_write_4(sc->sc_memt, sc->sc_regh,
963 R128_DP_CNTL,  960 R128_DP_CNTL,
964 R128_DST_Y_TOP_TO_BOTTOM |  961 R128_DST_Y_TOP_TO_BOTTOM |

cvs diff -r1.49 -r1.50 src/sys/dev/pci/radeonfb.c (expand / switch to unified diff)

--- src/sys/dev/pci/radeonfb.c 2012/01/03 00:25:49 1.49
+++ src/sys/dev/pci/radeonfb.c 2012/01/04 15:56:18 1.50
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: radeonfb.c,v 1.49 2012/01/03 00:25:49 macallan Exp $ */ 1/* $NetBSD: radeonfb.c,v 1.50 2012/01/04 15:56:18 macallan Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006 Itronix Inc. 4 * Copyright (c) 2006 Itronix Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Garrett D'Amore for Itronix Inc. 7 * Written by Garrett D'Amore for Itronix Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -60,27 +60,27 @@ @@ -60,27 +60,27 @@
60 * portions of the Software. 60 * portions of the Software.
61 * 61 *
62 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 62 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
63 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 63 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
64 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 64 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
65 * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR 65 * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
66 * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 66 * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
67 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 67 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
68 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 68 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
69 * DEALINGS IN THE SOFTWARE. 69 * DEALINGS IN THE SOFTWARE.
70 */ 70 */
71 71
72#include <sys/cdefs.h> 72#include <sys/cdefs.h>
73__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.49 2012/01/03 00:25:49 macallan Exp $"); 73__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.50 2012/01/04 15:56:18 macallan Exp $");
74 74
75#include <sys/param.h> 75#include <sys/param.h>
76#include <sys/systm.h> 76#include <sys/systm.h>
77#include <sys/device.h> 77#include <sys/device.h>
78#include <sys/malloc.h> 78#include <sys/malloc.h>
79#include <sys/bus.h> 79#include <sys/bus.h>
80#include <sys/kernel.h> 80#include <sys/kernel.h>
81#include <sys/lwp.h> 81#include <sys/lwp.h>
82#include <sys/kauth.h> 82#include <sys/kauth.h>
83 83
84#include <dev/wscons/wsdisplayvar.h> 84#include <dev/wscons/wsdisplayvar.h>
85#include <dev/wscons/wsconsio.h> 85#include <dev/wscons/wsconsio.h>
86#include <dev/wsfont/wsfont.h> 86#include <dev/wsfont/wsfont.h>
@@ -2422,27 +2422,27 @@ radeonfb_putchar(void *cookie, int row,  @@ -2422,27 +2422,27 @@ radeonfb_putchar(void *cookie, int row,
2422 w = font->fontwidth; 2422 w = font->fontwidth;
2423 h = font->fontheight; 2423 h = font->fontheight;
2424 2424
2425 bg = ri->ri_devcmap[(attr >> 16) & 0xf]; 2425 bg = ri->ri_devcmap[(attr >> 16) & 0xf];
2426 fg = ri->ri_devcmap[(attr >> 24) & 0xf]; 2426 fg = ri->ri_devcmap[(attr >> 24) & 0xf];
2427 2427
2428 xd = ri->ri_xorigin + col * w; 2428 xd = ri->ri_xorigin + col * w;
2429 yd = ri->ri_yorigin + row * h; 2429 yd = ri->ri_yorigin + row * h;
2430 2430
2431 if (c == 0x20) { 2431 if (c == 0x20) {
2432 radeonfb_rectfill(dp, xd, yd, w, h, bg); 2432 radeonfb_rectfill(dp, xd, yd, w, h, bg);
2433 return; 2433 return;
2434 } 2434 }
2435 data = (uint8_t *)font->data + (c - font->firstchar) * ri->ri_fontscale; 2435 data = WSFONT_GLYPH(c, font);
2436 2436
2437 gmc = dp->rd_format << RADEON_GMC_DST_DATATYPE_SHIFT; 2437 gmc = dp->rd_format << RADEON_GMC_DST_DATATYPE_SHIFT;
2438 2438
2439 radeonfb_wait_fifo(sc, 9); 2439 radeonfb_wait_fifo(sc, 9);
2440  2440
2441 PUT32(sc, RADEON_DP_GUI_MASTER_CNTL, 2441 PUT32(sc, RADEON_DP_GUI_MASTER_CNTL,
2442 RADEON_GMC_BRUSH_NONE | 2442 RADEON_GMC_BRUSH_NONE |
2443 RADEON_GMC_SRC_DATATYPE_MONO_FG_BG | 2443 RADEON_GMC_SRC_DATATYPE_MONO_FG_BG |
2444 RADEON_GMC_DST_CLIPPING | 2444 RADEON_GMC_DST_CLIPPING |
2445 RADEON_ROP3_S | 2445 RADEON_ROP3_S |
2446 RADEON_DP_SRC_SOURCE_HOST_DATA | 2446 RADEON_DP_SRC_SOURCE_HOST_DATA |
2447 RADEON_GMC_CLR_CMP_CNTL_DIS | 2447 RADEON_GMC_CLR_CMP_CNTL_DIS |
2448 RADEON_GMC_WR_MSK_DIS | 2448 RADEON_GMC_WR_MSK_DIS |
@@ -2511,27 +2511,27 @@ radeonfb_putchar_aa32(void *cookie, int  @@ -2511,27 +2511,27 @@ radeonfb_putchar_aa32(void *cookie, int
2511 w = font->fontwidth; 2511 w = font->fontwidth;
2512 h = font->fontheight; 2512 h = font->fontheight;
2513 2513
2514 bg = ri->ri_devcmap[(attr >> 16) & 0xf]; 2514 bg = ri->ri_devcmap[(attr >> 16) & 0xf];
2515 fg = ri->ri_devcmap[(attr >> 24) & 0xf]; 2515 fg = ri->ri_devcmap[(attr >> 24) & 0xf];
2516 2516
2517 xd = ri->ri_xorigin + col * w; 2517 xd = ri->ri_xorigin + col * w;
2518 yd = ri->ri_yorigin + row * h; 2518 yd = ri->ri_yorigin + row * h;
2519 2519
2520 if (c == 0x20) { 2520 if (c == 0x20) {
2521 radeonfb_rectfill(dp, xd, yd, w, h, bg); 2521 radeonfb_rectfill(dp, xd, yd, w, h, bg);
2522 return; 2522 return;
2523 } 2523 }
2524 data = (uint8_t *)font->data + (c - font->firstchar) * ri->ri_fontscale; 2524 data = WSFONT_GLYPH(c, font);
2525 2525
2526 gmc = dp->rd_format << RADEON_GMC_DST_DATATYPE_SHIFT; 2526 gmc = dp->rd_format << RADEON_GMC_DST_DATATYPE_SHIFT;
2527 2527
2528 radeonfb_wait_fifo(sc, 5); 2528 radeonfb_wait_fifo(sc, 5);
2529  2529
2530 PUT32(sc, RADEON_DP_GUI_MASTER_CNTL, 2530 PUT32(sc, RADEON_DP_GUI_MASTER_CNTL,
2531 RADEON_GMC_BRUSH_NONE | 2531 RADEON_GMC_BRUSH_NONE |
2532 RADEON_GMC_SRC_DATATYPE_COLOR | 2532 RADEON_GMC_SRC_DATATYPE_COLOR |
2533 RADEON_ROP3_S | 2533 RADEON_ROP3_S |
2534 RADEON_DP_SRC_SOURCE_HOST_DATA | 2534 RADEON_DP_SRC_SOURCE_HOST_DATA |
2535 RADEON_GMC_CLR_CMP_CNTL_DIS | 2535 RADEON_GMC_CLR_CMP_CNTL_DIS |
2536 RADEON_GMC_WR_MSK_DIS | 2536 RADEON_GMC_WR_MSK_DIS |
2537 gmc); 2537 gmc);