Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/embedded/qscreenlinuxfb_qws.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    9292    int startupd;
    9393    bool blank;
     94    QLinuxFbScreen::DriverTypes driverType;
    9495
    9596    bool doGraphicsMode;
     
    163164    QT_CLOSE(ttyfd);
    164165    ttyfd = -1;
     166}
     167
     168/*!
     169    \enum QLinuxFbScreen::DriverTypes
     170
     171    This enum describes the driver type.
     172
     173    \value GenericDriver Generic Linux framebuffer driver
     174    \value EInk8Track e-Ink framebuffer driver using the 8Track chipset
     175 */
     176
     177/*!
     178    \fn QLinuxFbScreen::fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo)
     179
     180    Adjust the values returned by the framebuffer driver, to work
     181    around driver bugs or nonstandard behavior in certain drivers.
     182    \a finfo and \a vinfo specify the fixed and variable screen info
     183    returned by the driver.
     184 */
     185void QLinuxFbScreen::fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo)
     186{
     187    // 8Track e-ink devices (as found in Sony PRS-505) lie
     188    // about their bit depth -- they claim they're 1 bit per
     189    // pixel while the only supported mode is 8 bit per pixel
     190    // grayscale.
     191    // Caused by this, they also miscalculate their line length.
     192    if(!strcmp(finfo.id, "8TRACKFB") && vinfo.bits_per_pixel == 1) {
     193        vinfo.bits_per_pixel = 8;
     194        finfo.line_length = vinfo.xres;
     195    }
    165196}
    166197
     
    307338    }
    308339
     340    d_ptr->driverType = strcmp(finfo.id, "8TRACKFB") ? GenericDriver : EInk8Track;
     341
    309342    if (finfo.type == FB_TYPE_VGA_PLANES) {
    310343        qWarning("VGA16 video mode not supported");
     
    318351        return false;
    319352    }
     353
     354    fixupScreenInfo(finfo, vinfo);
    320355
    321356    grayscale = vinfo.grayscale;
     
    665700#endif
    666701
    667     d_ptr->startupw=vinfo.xres;
    668     d_ptr->startuph=vinfo.yres;
    669     d_ptr->startupd=vinfo.bits_per_pixel;
    670     grayscale = vinfo.grayscale;
    671 
    672702    if (ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) {
    673703        perror("QLinuxFbScreen::initDevice");
     
    677707        return true;
    678708    }
     709
     710    fixupScreenInfo(finfo, vinfo);
     711
     712    d_ptr->startupw=vinfo.xres;
     713    d_ptr->startuph=vinfo.yres;
     714    d_ptr->startupd=vinfo.bits_per_pixel;
     715    grayscale = vinfo.grayscale;
    679716
    680717#ifdef __i386__
     
    11231160    }
    11241161
     1162    fixupScreenInfo(finfo, vinfo);
    11251163    disconnect();
    11261164    connect(d_ptr->displaySpec);
     
    12011239    \reimp
    12021240*/
     1241void QLinuxFbScreen::setDirty(const QRect &r)
     1242{
     1243    if(d_ptr->driverType == EInk8Track) {
     1244        // e-Ink displays need a trigger to actually show what is
     1245        // in their framebuffer memory. The 8-Track driver does this
     1246        // by adding custom IOCTLs - FBIO_EINK_DISP_PIC (0x46a2) takes
     1247        // an argument specifying whether or not to flash the screen
     1248        // while updating.
     1249        // There doesn't seem to be a way to tell it to just update
     1250        // a subset of the screen.
     1251        if(r.left() == 0 && r.top() == 0 && r.width() == dw && r.height() == dh)
     1252            ioctl(d_ptr->fd, 0x46a2, 1);
     1253        else
     1254            ioctl(d_ptr->fd, 0x46a2, 0);
     1255    }
     1256}
     1257
     1258/*!
     1259    \reimp
     1260*/
    12031261void QLinuxFbScreen::blank(bool on)
    12041262{
     
    13161374bool QLinuxFbScreen::useOffscreen()
    13171375{
    1318     if ((mapsize - size) < 16*1024)
     1376    // Not done for 8Track because on e-Ink displays,
     1377    // everything is offscreen anyway
     1378    if (d_ptr->driverType == EInk8Track || ((mapsize - size) < 16*1024))
    13191379        return false;
    13201380
Note: See TracChangeset for help on using the changeset viewer.