---------------------------------------------------------------------------

               VIA Integration Graphic Chip Console Framebuffer Driver
      Copyright 2003-2006 VIA Technologies, Inc. All Rights Reserved.

---------------------------------------------------------------------------
Platform

The console framebuffer driver is for Graphics chips of
VIA UniChrome Family (CLE266, KM400, KN400, KM800, KN800, PM800, PN800, CN400, CN700, CX700).

---------------------------------------------------------------------------
Driver features

    Device: CRT, TV
    Support Mode: CRT:  640x480(60,75,85,100,120Hz), 720x480(60Hz),
                        720x576(60Hz), 800x600(60,75,85,100,120Hz),
                        848x480(60Hz), 856x480(60Hz), 1024x512(60Hz),
                        1024x768(60,75,85,100Hz), 1152x864(75Hz),
                        1280x768(60Hz), 1280x960(60Hz), 1280x1024(60,75,85Hz),
                        1440x1050(60Hz), 1600x1200(60,75Hz),
                        1280x720(60Hz), 1920x1080(60Hz), 1400x1050(60Hz), 800x480(60Hz)
                  TV:   VT1622, VT1622A, VT1623 (640x480, 800x600, 1024x768, 720x480, 720x576, 848x480)
                        VT1625  (640x480, 800x600, 1024x768, 720x480, 720x576, 1280x720(HDTV), 1920x1080(HDTV))
                        IntegratedTV (640x480, 800x600, 1024x768, 720x480, 720x576, 1280x720(HDTV), 1920x1080(HDTV))

    color depth : 8 bpp, 16 bpp, 32 bpp
    TV encoder : VIA VT1622, VT1622A, VT1623, VT1625, IntegratedTV
    TV output : VT1622 (Composite, S-Video, Composite+S-Video, YCBCR)
                VT1622A ,VT1623 (Composite, S-Video, Composite+S-Video, RGB, YCBCR)
                VT1625 (Composite, S-Video, Composite+S-Video, RGB, YCBCR)
                IntegratedTV (Composite, S-Video, RGB, YCBCR)
    TV type : 	VT1622 (NTSC, PAL, 480P, 576P)
                VT1622A ,VT1623 (NTSC, PAL, 480P, 576P)
                VT1625 (NTSC, PAL, 480P, 576P, 720P, 1080I)
                IntegratedTV (NTSC, PAL, 480P, 576P, 720P, 1080I)
    
    Support TV overscan display
    Support 2D hardware accelerator for kernel 2.6.

---------------------------------------------------------------------------
Building viafb as a module for Linux kernel 2.4

    Make sure you have the kernel sources installed in /usr/src/. For example, if your kernel version is 2.4.18-3, then there would be /usr/src/linux-2.4.18-3 in your system.
    Copy viafb to any directory, and then following below steps:
    Step 1: change to viafb directory
            # cd viafb/
    Step 2: Clear all object file.
            # make clean
    Step 3: Make source code
            # make
              Note that if no any error, this step will be produced an object file "viafb.o".
    Step 4: Install viafb.o framebuffer driver
            # make install

---------------------------------------------------------------------------
Using the viafb module. (for Linux kernel 2.4)

    Start viafb with default settings,
        #modprobe viafb

    Start viafb with with user options,
        #modprobe viafb mode=800x600 bpp=16 refresh=60 TV_ON=1 tv_system=1 tv_level=1 tv_out_signal=4 mode1=1024x768 bpp1=16 refresh1=60 SAMM_ON=1

        mode :
            640x480    (default)
            720x480
            800x600
            1024x768
            ......

        bpp :
            8, 16, 32  (default : 32)

        refresh :
            60, 75, 85, 100, 120 (default : 60)
            
        CRT_ON: 
            0 : CRT disable
            1 : CRT enable  (default)     

        TV_ON :
            0 : TV disable  (default)
            1 : TV enable
        
        tv_system :
            0 : none
            1 : NTSC  (default)
            2 : PAL
            4 : 480P
            8 : 576P
           16 : 720P
           32 : 1080I

        tv_level :
            VT1622, VT1622A, VT1623
                0 : underscan (default)
                1 : fitscan (close to fit Industry TV Screen)
                2 : overscan
            Other TV Encoders
                0 : underscan (default)
                1 : overscan
                
        tv_out_signal:
            1: Composite
            2: S-Video            
            4: RGB
            8: YCBCR (or component)
           16: Composite+S-Video (default)
           32: RGB+Composite
           64: YCBCR+Composite
           
        tv_dedotcrawl:
            0: Disable DeDotCrawl Function (default)
            1: Enable DeFotCrawl Function
               Note that the DeDotCrawl work under NTSC and composite outputting condition, other
               conditions don't support this function.
               
        tv_ffilter:  To set TV Flicker Filter level
            0 ~ 2  : VT1622, VT1622A, VT1623
            0 ~ 3  : VT1625
            0 ~ 1  : IntegratedTV

        tv_brightness:
            0 ~ 255   : To set TV output brightness
            
        tv_contrast:
            0 ~ 255   : To set TV output contrast
            
        tv_saturation:
            0 ~ 65535 : To set TV output saturation
            
        tv_tint:
            0 ~ 2047  : To set TV output tint
            Note:  Different TV encoder have different default values of TV color features
            including brightness, contrast, saturation, and tint.            
        
        DVI_ON: 
            0 : DVI disable
            1 : DVI enable  (default)     

        LCD_ON :
            0 : LCD disable (default)
            1 : LCD enable
            
        lcd_dsp_method:
            0 : expandsion  (default)    
            1 : centering
        
        lcd_panel_id:
            0 : Resolution: 640x480,   Channel: single, Dithering: Enable
            1 : Resolution: 800x600,   Channel: single, Dithering: Enable
            2 : Resolution: 1024x768,  Channel: single, Dithering: Enable   (default)   
            3 : Resolution: 1280x768,  Channel: single, Dithering: Enable
            4 : Resolution: 1280x1024, Channel: dual,   Dithering: Enable
            5 : Resolution: 1400x1050, Channel: dual,   Dithering: Enable
            6 : Resolution: 1600x1200, Channel: dual,   Dithering: Enable            
            9 : Resolution: 1024x768,  Channel: dual,   Dithering: Enable
            10: Resolution: 1024x768,  Channel: single, Dithering: Disable
            11: Resolution: 1024x768,  Channel: dual,   Dithering: Disable
            12: Resolution: 1280x768,  Channel: single, Dithering: Disable
            13: Resolution: 1280x1024, Channel: dual,   Dithering: Disable
            14: Resolution: 1400x1050, Channel: dual,   Dithering: Disable
            15: Resolution: 1600x1200, Channel: dual,   Dithering: Disable

        accel: (only for kernel 2.6)
            0 : No 2D Hardware Acceleration  (default)
            1 : 2D Hardware Acceleration

        SAMM_ON:
            0 : SAMM_ON disable (default)
            1 : SAMM_ON enable

        mode1 :(secondary display device)
            640x480    (default)
            720x480
            800x600
            1024x768
            ......
	
        bpp1 :(secondary display device)
            8, 16, 32  (default : 32)

        refresh1 :(secondary display device)
            60, 75, 85, 100, 120 (default : 60)

        active_dev:
            This option is used to specify active devices. (CRT, TV, DVI, LCD, CRT+TV, CRT+LCD, CRT+DVI,...)
            In SAMM case, the previous of active_dev is primary device, and the following is secondary device.
            For example:
            To enable one device, such as TV only, we should use:
                modprobe viafb active_dev=TV ...

            To enable two devices, such as CRT+TV:
                For simultaneous case, we can use:
                    modprobe viafb active_dev=CRT+TV ...
                    OR
                    modprobe viafb active_dev=TV+CRT ...
                    
                For SAMM case:
                    If CRT is primary and TV is secondary, we should use:
                        modprobe viafb active_dev=CRT+TV SAMM_ON=1 ...
                    If TV is primary and CRT is secondary, we should use:
                        modprobe viafb active_dev=TV+CRT SAMM_ON=1 ...
                    
    Note :
        1. If TV is enabled, the refresh rate will be bound to TV type (NTSC:60Hz, PAL:50Hz).
        2. CRT may not display properly for simultaneous CRT & TV display at
           the "640x480" PAL mode with TV overscan enabled.
        3. When SAMM is enable, mode and mode1,bpp and bpp1,refresh and refresh1 can be different.

---------------------------------------------------------------------------
Configure viafb options with "fbset" tool

    "fbset" is an inbox utility of Linux.

    1. Inquire current viafb information, type,
           # fbset -i

    2. Set various resolutions and refresh rates,
           # fbset <resolution-vertical_sync>
       example,
           # fbset "1024x768-75"
       or
           # fbset -g 1024 768 1024 768 32

       Check the file "/etc/fb.modes" to find display modes available.

    3. Set the color depth,
           # fbset -depth <value>
       example,
           # fbset -depth 16

---------------------------------------------------------------------------
Building viafb as a module for Linux kernel 2.6

    If you have kernel source installed, and hasn't built it, please do the fllowing prepare work, or else, you can skip below procedures.

             # cd /usr/src/
             # ln -s /usr/src/linux-2.6.xx-x linux
             # cd linux
             # cp /boot/config-2.6.xx-x   .config
             # make modules_prepare

    If you have not installed kernel source, you can use object files shipped by your vender. First, make sure you have the kernel object files installed. 
    For FedoraCore serials, they may be 
            /lib/modules/2.6.xx-x/build/
    For SuSE serials, they may be 
            /usr/src/linux-2.6.xx-x-obj/i386/default/
    The directory 2.6.xx-x is depend on your kernel version, i386 maybe changed for your arch. If you installed this file, please do the fllowing prepare work.

            # cd /usr/src/
    For FedoraCore:
            # ln -s /lib/modules/2.6.xx-x/build  linux
    For SuSE:
            # ln -s /usr/src/linux-2.6.xx-x-obj/i386/default  linux

    As prepare work done, you can build viafb.
    Please copy viafb to any directory, and fllowing below steps:
    
    Step 1: change to viafb directory
            # cd viafb/
    Step 2: Clear all object file.
            # make clean
    Step 3: Make source code
            # make
              Note that if no any error, this step will be produced an object file "viafb.ko".
    Step 4: Install viafb.ko framebuffer driver
            # make install


---------------------------------------------------------------------------
Using the viafb module. (for Linux kernel 2.6, but NOT for FC2)
    It is just like in kernel 2.4    


---------------------------------------------------------------------------
Using the viafb module. (for Fedora Core 2)

    Using viafb.ko in Fedora Core 2, you need another kernel module, fbcon.ko(framebuffer console module). To build this module, please see next section.
    Modprobing viafb will not change the display mode until you modprobe fbcon.
    You can see the related steps below.

    Step 1: Start viafb with default settings.
            # modprobe viafb
              Note that you can see the other options from "Using the viafb module. (for Linux kernel 2.4)" section.
    Step 2: Modprope fbcon.
            # modprobe fbcon


---------------------------------------------------------------------------
Building fbcon.ko for Fedore Core 2 (kernel 2.6.5-1.358)

Building fbcon console module.
    Step 1: Install kernel source, you can find it on install CD-3.
            # rpm -ivh kernel-source-2.6.5-1.358.i386.rpm
    Step 2: Change to folder /usr/src/linux-2.6.5-1.358
            # cd /usr/src/inux-2.6.5-1.358
    Step 3: Configuring the kernel module
            # make menuconfig
    Step 4: Select fbcon item to module.
            -> Device Drivers-> Graphics support-> Console display driver support-> <M> Framebuffer Console support
    Step 5: Save the current setting and quit.
    Step 6: Make fbcon module.
            # make modules SUBDIRS=./drivers/video/console
              Note that if no any error, this step will be produced "fbcon.ko" in /usr/src/linux-2.6./drivers/video/console folder.
    Step 7: Copy fbcon.ko to lib folder.
            # cp /usr/src/linux-2.6./drivers/video/console/fbcon.ko  /lib/modules/2.6./kernel/drivers/video/


---------------------------------------------------------------------------
Building viafb as a built-in driver on FC3/4

    Built-in driver will be load at kernel booting, and you can parse argument
to viafb driver through kernel parameters.
    Step 1: Get kernel source and put them under /usr/src/linux
    Step 2: Copy FBDev to proper location.
            # cp -a FBDev /usr/src/linux/drivers/video/via
    Step 3: Replace Makefile
            # cd /usr/src/linux/drivers/video/via
            # mv -f Makefile_26.kernel Makefile
    Step 4: Modify Makefile and Kconfig under /usr/src/linux/drivers/video: add line "obj-$(CONFIG_FB_VIA)              += via/" to proper position of Makefile; add below lines to Kconfig (FC4)
  config FB_VIA
        tristate "via acceleration"
        depends on FB && PCI
        select FB_CFB_FILLRECT
        select FB_CFB_COPYAREA
        select FB_CFB_IMAGEBLIT
        select FB_SOFT_CURSOR
        help
          This is the frame buffer device driver for VIA

or add below lines to Kconfig (FC3)
  config FB_VIA
        tristate "via acceleration"
        depends on FB && PCI
        select FB_MODE_HELPERS
        help
          This is the frame buffer device driver for VIA
     
    Step 5: Select device drivers
            # make menuconfig
                Enable Device Drivers -> Graphics support -> via acceleration
                Disable VESA driver at Drivers -> Graphics support -> VESA VGA graphics  
    Step 6: Make kernel imgae
            # make
            # mv arch/i386/boot/bzImage /boot/
    Step 7: Test and using built-in viafb driver
            Modify /boot/grub/menu.lst,let bzImage be the boot image.
Parameters can be parsed to viafb through kernel parameters:
video=viafb:<options>, for example video=viafb:mode=800x600. You can see the other options from "Using the viafb module. (for Linux kernel 2.4)" section.

