VirtualBox

Changeset 67857 in vbox


Ignore:
Timestamp:
Jul 7, 2017 3:01:51 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116813
Message:

VGA: Who will blink first?

Location:
trunk/src/VBox/Devices/Graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r67795 r67857  
    55
    66/*
    7  * Copyright (C) 2006-2016 Oracle Corporation
     7 * Copyright (C) 2006-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    17791779};
    17801780
     1781static const uint8_t empty_glyph[32 * 4] = { 0 };
     1782
    17811783/*
    17821784 * Text mode update
    17831785 * Missing:
    17841786 * - underline
    1785  * - flashing
    17861787 */
    17871788static int vga_draw_text(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty,
     
    17991800    vga_draw_glyph8_func *vga_draw_glyph8;
    18001801    vga_draw_glyph9_func *vga_draw_glyph9;
     1802    uint64_t time_ns;
     1803    bool blink_on, chr_blink_flip, cur_blink_flip;
     1804    bool blink_enabled, blink_do_redraw;
    18011805
    18021806    full_update |= update_palette16(pThis);
     
    18241828        full_update = true;
    18251829    }
    1826     full_update |= update_basic_params(pThis);
     1830    full_update |= update_basic_params(pThis) | 1;  //@TODO! do not commit!!
    18271831
    18281832    line_offset = pThis->line_offset;
     
    19041908    cx_min_upd = width;
    19051909
     1910    /* Figure out if we're in the visible period of the blink cycle. */
     1911    time_ns  = PDMDevHlpTMTimeVirtGetNano(VGASTATE2DEVINS(pThis));
     1912    blink_on = (time_ns % VGA_BLINK_PERIOD_FULL) < VGA_BLINK_PERIOD_ON;
     1913    chr_blink_flip = false;
     1914    cur_blink_flip = false;
     1915    if (pThis->last_chr_blink != blink_on)
     1916    {
     1917        /* Currently cursor and characters blink at the same rate, but they might not. */
     1918        pThis->last_chr_blink = blink_on;
     1919        pThis->last_cur_blink = blink_on;
     1920        chr_blink_flip = true;
     1921        cur_blink_flip = true;
     1922    }
     1923    blink_enabled = !!(pThis->ar[0x10] & 0x08); /* Attribute controller blink enable. */
     1924
    19061925    for(cy = 0; cy < (height - dscan); cy = cy + (1 << dscan)) {
    19071926        d1 = dest;
     
    19111930        for(cx = 0; cx < width; cx++) {
    19121931            ch_attr = *(uint16_t *)src;
    1913             if (full_update || ch_attr != (int)*ch_attr_ptr || src == cursor_ptr) {
     1932            /* Figure out if character needs redrawing due to blink state change. */
     1933            blink_do_redraw = blink_enabled && chr_blink_flip && (ch_attr & 0x80);
     1934            if (full_update || ch_attr != (int)*ch_attr_ptr || blink_do_redraw || (src == cursor_ptr && cur_blink_flip)) {
    19141935                if (cx < cx_min)
    19151936                    cx_min = cx;
     
    19291950                bgcol = palette[cattr >> 4];
    19301951                fgcol = palette[cattr & 0x0f];
     1952
     1953                if (blink_enabled && (cattr & 0x80))
     1954                {
     1955                    bgcol = palette[(cattr >> 4) & 7];
     1956                    if (!blink_on)
     1957                        font_ptr = empty_glyph;
     1958                }
     1959
    19311960                if (cw != 9) {
    19321961                    if (pThis->fRenderVRAM)
     
    19441973                    !(pThis->cr[0x0a] & 0x20)) {
    19451974                    int line_start, line_last, h;
    1946                     uint64_t time_ns;
    19471975
    19481976                    /* draw the cursor if within the visible period */
    1949                     time_ns = PDMDevHlpTMTimeVirtGetNano(VGASTATE2DEVINS(pThis));
    1950                     if (time_ns % VGA_BLINK_PERIOD_FULL < VGA_BLINK_PERIOD_ON) {
     1977                    if (blink_on) {
    19511978                        line_start = pThis->cr[0x0a] & 0x1f;
    19521979                        line_last = pThis->cr[0x0b] & 0x1f;
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r67766 r67857  
    264264    uint32_t last_scr_width, last_scr_height; /* in pixels */
    265265    uint32_t last_bpp;
    266     uint8_t cursor_start, cursor_end, padding3[2];
     266    uint8_t cursor_start, cursor_end;
     267    bool last_cur_blink, last_chr_blink;
    267268    uint32_t cursor_offset;
    268269    /* hardware mouse cursor support */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette