I am sponsoring the following fast-track on behalf of
Jan Setje-Eilers with a time-out of 01/22/2010.
The project desires minor binding.

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


Bitmapped Console    PSARC/2009/415

1) Summary

     The Bitmapped Console brings Support for higher resolutions and color
     depth than the current VGA 640x480 16-color console on x86
     systems. The initial delivery will support x86 systems using
     traditional BIOS and VESA option ROMs. EFI systems, once supported
     will leverage this work to enable their frame buffer consoles.

2) Technical Details

     The following applies when a graphics card / frame buffer is being used
     as a physical or virtual console. This project does not change the
     behavior of serial consoles.

   2.0) Overview

     The loader (GRUB) automatically chooses an appropriate video mode
     by intersecting available VESA modes with EDID reported display
     capabilities and activates it. Any failure to obtain EDID or make
     VESA calls will leave the system in VGA text mode which the OS
     will use as it did previously.

     Then it loads the OS as before and hands a description of the
     mode to the OS via the vbe members of the multiboot info
     structure. The early boot_console code which is used
     pre-consconfig for console messages as well as early kmdb
     interaction uses that description to map the described frame
     buffer region and uses it as a bitmapped console device. At
     consconfig gfx_private (which this project makes vgatext a
     consumer of) takes over this role and the coherent console (tem)
     is used to display the console on this frame buffer.

     Side note: vgatext does not gain any specific vesa support, so it
     is not being re-named. It simply passes down tem IOCTLs and
     gfx_private will act appropriately.

     During a typical non-interactive boot the current "happy face"
     soothing image gains higher resolution and color depth typically
     16-bit, often at a native panel resolution, a significant
     improvement over 640x480 at 4-bit.

     Any of the following events will stop the animation, clear the
     screen and display the text that would otherwise have been on the
     console at that point:

        Entering kmdb by any means: mdb -K, panic, F1-a

        Booting -kd skips graphics entirely as immediate interaction
        is required.

        sulogin running on console

        Any key-press post kbtrans attach (prior to which only kmdb
        can be interacted with).

        The console login prompt is displayed and X is not expected to
         start. This is determined by: svc:/system/console-login:default
         being on-line while any service svc:/application/graphical-login
         is disabled or in maintenance. If a graphical-login is enabled
         a couple seconds is allowed for X to start and take over the
         console frame buffer, then another reset to text mode is
         attempted. This simply fails if X owns the console device at
         that point, but catches configurations that run graphical-login
         services without running X on console such as sunray servers.


   2.1) Mode setting by GRUB

     The GRUB splashimage command recognizes png files and will select
     an appropriate mode based on the cards advertised VESA modes and
     the display capabilities derived from the displays EDID. While
     the splashimage command can precede the rest of the script comprising
     the menu entry, the actual mode setting is deferred until the rest of
     the other commands have succeeded (which means that at least a bootable
     kernel has been loaded).

   2.2) Graphical boot

     During graphical boot /boot/solaris/boot-images/boot.png is
     displayed as the background. To indicate progress
     /boot/solaris/boot-images/stepN.png where N=0 to 14 are used
     to display an alpha blended animation. Fewer than 15 images
     may be provided.

     This animation is displayed until either a key is pressed to
     switch to text, or X takes over the console. If gdm is not
     enabled, console login triggers a switch to text.

     Lastly boot/solaris/images/shutdown.png is displayed during
     shutdown. This can be disabled by setting load_shutdown_image on
     the system/console-status service to false.

     PNG was chosen based both on being a technically appropriate
     format as well as it's attempt to avoid the licensing quagmire
     that has plagued other formats. The png parsing code is based on
     pnglite v. 0.1.17 which is covered by OSR 12682.

   2.3) Console text mode

     Console text mode will continue to default to 80 columns by 24
     rows, but becomes configurable via the screen-#columns and
     screen-#rows properties (as seen in OBP). This uses the existing
     algorithms in tem that will pick an appropriately sized font and
     make a best effort at achieving the desired rows and columns.

     For example, the following properties which can be specified on the
     kernel command line would enable the graphical display and attempt
     to allocate a console terminal of 100 columns by 60 rows:

         console=graphics,screen-#columns=100,screen-#rows=60

   2.4) Resetting frame buffer state on exit from X

    On exit X will generally attempt to restore the mode the card was
    in before it started. While some native drivers do restore enough
    state to reset a VESA mode properly, a number do not.

    Since it is impractical to test and fix every native driver on all
    cards, a method for explicitly setting the VESA mode at OS run-time
    is used. Setting the mode requires execution of a call into the
    VESA BIOS supplied by the card. This is achieved via vbiosd, a
    daemon that provides userland x86 realmode emulation. This daemon
    is a derivative work based on uvesafb::v86d, covered by OSR 12387.

    While the mode is set by vbiosd in userland, the state continues to
    be tracked by the KD_TEXT/KD_GRAPHICS states in the gfx_private
    lower-layer of the kernel driver. Mode changes happen in
    gfx_private and invoke vbiosd via a door.

    If X does not exit cleanly, the native driver can leave the card
    in an unknown state. This project does not change that behavior.

    vbiosd is managed by svc:/system/vbios. While it is only required
    when X is running, an effort must be made to keep the console in
    a sane state when X is started by something other than smf, such as
    say running Xorg manually, so the vbios service is always started.

   2.5) Resetting frame buffer state on fast reboot

    Since the boot loader does not run during fast reboot, the kernel
    needs to ensure that the graphics card is in a sane state. This is
    achieved by setting the appropriate mode early on while the system
    can still make BIOS calls.

   2.6) Resetting frame buffer state on suspend/resume

   Since userland must be running for vbiosd to reset the mode, the
   mode can not be reset directly as part of the resume entries. Rather
   another thread in the daemon, is invoked that is pause()d with a SIGTHAW
   handler that will send a KD_RESUME ioctl to the console device when
   invoked, which in turn invokes the vbiosd door thread to set the proper
   VESA mode.

3) Interfaces

  3.1) Committed interfaces

   The possible states of the console property:

         text            text output in either VGA text mode or VESA
                         graphics mode depending on the mode set by
                         the booter or system capabilities.

         force-text      text output in VGA text mode regardless of the
                         mode set by the booter

         graphics        if the booter sets a VESA graphics mode, the
                         graphical boot images are loaded and displayed
                         if not the system will default to text output
                         in VGA text mode

         ttya/ttyb       serial output (not impacted by this work)

     In case of error the system will fall back to VGA text mode, but
     the value of the console property is not re-written.

     force-text exists to allow for continued compatibility with
     external screen readers and the like.

   Console terminal sizing properties:

        screen-#columns
        screen-#rows


   Additional Solaris VISUAL I/O control operation, commited in line
   with the previous vis_ interfaces which were made stable in
   PSARC/2003/432:

   VIS_CONSCLEAR this ioctl() takes a struct vis_consclear which
   defines the background color to be used to clear the screen.

        struct vis_consclear {
                unsigned char   bg_color; /* Background color */
        };

  3.2) Project private interfaces

   The following previously defined members of the multiboot_info
   structure are now used to pass pointers to structures describing
   the VESA implementation of the system. While they are derived
   from an external standard, their use here is project private:

         unsigned long vbe_control_info;
         unsigned long vbe_mode_info;
         unsigned short vbe_mode;
         unsigned short vbe_interface_seg;
         unsigned short vbe_interface_off;
         unsigned short vbe_interface_len;

     They point to the following structures which are defined by the
     VESA spec:

         struct VbeInfoBlock {
                 uint8_t         VbeSignature[4];
                 uint16_t        VbeVersion;
                 uint32_t        OemStringPtr;
                 uint32_t        Capabilities;
                 uint32_t        ModeListPtr;
                 uint16_t        TotalMemory;
                 uint16_t        OemSoftwareRev;
                 uint32_t        OemVendorNamePtr;
                 uint32_t        OemProductNamePtr;
                 uint32_t        OemProductRevPtr;
                 uint8_t         Reserved[222];
                 uint8_t         OemData[256];
         } __attribute__((packed));

         struct ModeInfoBlock {
                 uint16_t        ModeAttributes;
                 uint8_t         WinAAttributes;
                 uint8_t         WinBAttributes;
                 uint16_t        WinGranularity;
                 uint16_t        WinSize;
                 uint16_t        WinASegment;
                 uint16_t        WinBSegment;
                 uint32_t        WinFuncPtr;
                 uint16_t        BytesPerScanLine;

                 /* >= 1.2 */
                 uint16_t        XResolution;
                 uint16_t        YResolution;
                 uint8_t         XCharSize;
                 uint8_t         YCharSize;
                 uint8_t         NumberOfPlanes;
                 uint8_t         BitsPerPixel;
                 uint8_t         NumberOfBanks;
                 uint8_t         MemoryModel;
                 uint8_t         BankSize;
                 uint8_t         NumberOfImagePages;
                 uint8_t         Reserved1;

                 /* direct color */
                 uint8_t         RedMaskSize;
                 uint8_t         RedFieldPosition;
                 uint8_t         GreenMaskSize;
                 uint8_t         GreenFieldPosition;
                 uint8_t         BlueMaskSize;
                 uint8_t         BlueFieldPosition;
                 uint8_t         RsvdMaskSize;
                 uint8_t         RsvdFieldPosition;
                 uint8_t         DirectColorModeInfo;

                 /* >= 2.0 */
                 uint32_t        PhysBasePtr;
                 uint8_t         Reserved2[6];

                 /* >= 3.0 */
                 uint16_t        LinBytesPerScanLine;
                 uint8_t         BnkNumberOfImagePages;
                 uint8_t         LinNumberOfImagePages;
                 uint8_t         LinRedMaskSize;
                 uint8_t         LinRedFieldPosition;
                 uint8_t         LinGreenMaskSize;
                 uint8_t         LinGreenFieldPosition;
                 uint8_t         LinBlueMaskSize;
                 uint8_t         LinBlueFieldPosition;
                 uint8_t         LinRsvdMaskSize;
                 uint8_t         LinRsvdFieldPosition;
                 uint32_t        MaxPixelClock;
                 uint8_t         Reserved3[189];
         } __attribute__((packed));


  3.3) Uncommitted interfaces

   Service fmri and binary for the daemon. The service does
   not currently expose any properties.

         vbiosd: svc:/system/vbios

        usr/sbin/vbiosd


4) Man page diffs

    visual_io(7I)

498a499,514
 > >      VIS_CONSCLEAR   Clear the screen. The driver is  expected to
 > >                      paint the whole  screen  with the background
 > >                      color   specified   in   the   vis_consclear
 > >                      structure.
 > >
 > >      The argument is a pointer to  a   vis_consclear    structure
 > >      which contains the following fields:
 > >
 > >      struct vis_consclear {
 > >       unsigned char        bg_color;
 > >      };
 > >
 > >      bg_color  specifies the background color to be used to paint
 > >      the screen. Only driver that set mode to VIS_PIXEL with  the
 > >      VIS_DEVINIT ioctl are expected to have to handle this ioctl.
 > >

    eeprom(1m)

109,116c109,120
<          ttyb, and text. In text mode, console output goes to the
<          frame buffer and input comes  from  the  keyboard.  When
<          this  property  is not present, the console device falls
<          back  to  the  device  specified  by  input-device   and
<          output-device.  When neither the console property or the
<          input-device  and  output-device   property   pair   are
<          present,  the  console  defaults to the frame buffer and
<          keyboard.
---
 > >          ttyb, text, graphics and force-text. In text mode, console
 > >          output goes to the frame buffer and input comes from the
 > >          keyboard. A variant of text mode, graphics displays an image
 > >          with an animation until either a key is pressed or console
 > >          interaction is required by console login, sulogin, or kmdb. A
 > >          further variant of text, force-text will avoid using a VGA
 > >          adapter as a bitmapped device setting it to VGA text mode.
 > >          When this property is not present, the console device falls
 > >          back to the device specified by input-device and
 > >          output-device. When neither the console property or the
 > >          input-device and output-device property pair are present, the
 > >          console defaults to the frame buffer and keyboard.
117a122
 > >      screen-#columns screen-#rows
118a124,129
 > >          When screen is set to either graphics or text on a bitmapped
 > >          device, screen-#columns and screen-#rows allow the desired
 > >          number columns and rows of text to be specified. They default
 > >          to 80 and 24 respectively.
 > >

5) References

    VESA BIOS EXTENSION (VBE) Core Functions Standard Version: 3.0
     Please contact the project team for a pointer to a copy.

    pnglite OSR
     https://opensourcereview.central.sun.com/app?action=ViewReq&traq_num=12682

    uvesafb::v86d OSR
     https://opensourcereview.central.sun.com/app?action=ViewReq&traq_num=12387



Reply via email to