Changeset f4f866c in mainline for uspace/srv/hid/fb/fb.c


Ignore:
Timestamp:
2010-04-23T21:42:26Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6c39a907
Parents:
38aaacc2 (diff), 80badbe (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/fb/fb.c

    r38aaacc2 rf4f866c  
    5959#include <stdio.h>
    6060#include <byteorder.h>
     61#include <io/screenbuffer.h>
    6162
    6263#include "font-8x16.h"
    6364#include "fb.h"
    6465#include "main.h"
    65 #include "../console/screenbuffer.h"
    6666#include "ppm.h"
    6767
     
    7272#define DEFAULT_FGCOLOR  0x000000
    7373
    74 #define GLYPH_UNAVAIL    '?'
    75 
    76 #define MAX_ANIM_LEN     8
    77 #define MAX_ANIMATIONS   4
    78 #define MAX_PIXMAPS      256  /**< Maximum number of saved pixmaps */
    79 #define MAX_VIEWPORTS    128  /**< Viewport is a rectangular area on the screen */
     74#define GLYPH_UNAVAIL  '?'
     75
     76#define MAX_ANIM_LEN    8
     77#define MAX_ANIMATIONS  4
     78#define MAX_PIXMAPS     256  /**< Maximum number of saved pixmaps */
     79#define MAX_VIEWPORTS   128  /**< Viewport is a rectangular area on the screen */
    8080
    8181/** Function to render a pixel from a RGB value. */
     
    956956        bb_cell_t *bbp;
    957957        attrs_t *a;
    958         attr_rgb_t rgb;
    959958       
    960959        for (j = 0; j < h; j++) {
     
    966965                       
    967966                        a = &data[j * w + i].attrs;
     967                       
     968                        attr_rgb_t rgb;
     969                        rgb.fg_color = 0;
     970                        rgb.bg_color = 0;
    968971                        rgb_from_attr(&rgb, a);
    969972                       
     
    15111514                rgb->bg_color = color_table[COLOR_WHITE];
    15121515                break;
     1516        case STYLE_INVERTED:
     1517                rgb->fg_color = color_table[COLOR_WHITE];
     1518                rgb->bg_color = color_table[COLOR_BLACK];
     1519                break;
     1520        case STYLE_SELECTED:
     1521                rgb->fg_color = color_table[COLOR_WHITE];
     1522                rgb->bg_color = color_table[COLOR_RED];
     1523                break;
    15131524        default:
    15141525                return EINVAL;
    15151526        }
    1516 
     1527       
    15171528        return EOK;
    15181529}
     
    17561767        async_set_client_connection(fb_client_connection);
    17571768       
    1758         void *fb_ph_addr = (void *) sysinfo_value("fb.address.physical");
    1759         unsigned int fb_offset = sysinfo_value("fb.offset");
    1760         unsigned int fb_width = sysinfo_value("fb.width");
    1761         unsigned int fb_height = sysinfo_value("fb.height");
    1762         unsigned int fb_scanline = sysinfo_value("fb.scanline");
    1763         unsigned int fb_visual = sysinfo_value("fb.visual");
    1764 
    1765         unsigned int fbsize = fb_scanline * fb_height;
     1769        sysarg_t fb_ph_addr;
     1770        if (sysinfo_get_value("fb.address.physical", &fb_ph_addr) != EOK)
     1771                return -1;
     1772       
     1773        sysarg_t fb_offset;
     1774        if (sysinfo_get_value("fb.offset", &fb_offset) != EOK)
     1775                fb_offset = 0;
     1776       
     1777        sysarg_t fb_width;
     1778        if (sysinfo_get_value("fb.width", &fb_width) != EOK)
     1779                return -1;
     1780       
     1781        sysarg_t fb_height;
     1782        if (sysinfo_get_value("fb.height", &fb_height) != EOK)
     1783                return -1;
     1784       
     1785        sysarg_t fb_scanline;
     1786        if (sysinfo_get_value("fb.scanline", &fb_scanline) != EOK)
     1787                return -1;
     1788       
     1789        sysarg_t fb_visual;
     1790        if (sysinfo_get_value("fb.visual", &fb_visual) != EOK)
     1791                return -1;
     1792       
     1793        sysarg_t fbsize = fb_scanline * fb_height;
    17661794        void *fb_addr = as_get_mappable_page(fbsize);
    1767 
    1768         if (physmem_map(fb_ph_addr + fb_offset, fb_addr,
     1795       
     1796        if (physmem_map((void *) fb_ph_addr + fb_offset, fb_addr,
    17691797            ALIGN_UP(fbsize, PAGE_SIZE) >> PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE) != 0)
    17701798                return -1;
    1771 
     1799       
    17721800        if (screen_init(fb_addr, fb_width, fb_height, fb_scanline, fb_visual))
    17731801                return 0;
    1774 
     1802       
    17751803        return -1;
    17761804}
Note: See TracChangeset for help on using the changeset viewer.