diff options
author | Bernhard Rosenkraenzer <br@blankpage.ch> | 2010-04-08 14:20:43 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-04-08 14:34:53 (GMT) |
commit | 670e4fd179027eb13d4fc1558cac6eabade4a4d0 (patch) | |
tree | 76312263fee05331d2fb04e35656a51fe9cddb11 | |
parent | 3b68918cf1754a915b0c399d855f178cb934ad6c (diff) | |
download | Qt-670e4fd179027eb13d4fc1558cac6eabade4a4d0.zip Qt-670e4fd179027eb13d4fc1558cac6eabade4a4d0.tar.gz Qt-670e4fd179027eb13d4fc1558cac6eabade4a4d0.tar.bz2 |
Support 8-Track e-Ink devices
This patch adds support for e-Ink devices based on the 8-Track chipset,
such as the Sony PRS-505.
The 8-Track driver is a Linux framebuffer driver with a few extensions
and a few glitches in information reporting.
Merge-request: 417
Reviewed-by: Tom Cooksey <thomas.cooksey@nokia.com>
-rw-r--r-- | src/gui/embedded/qscreenlinuxfb_qws.cpp | 52 | ||||
-rw-r--r-- | src/gui/embedded/qscreenlinuxfb_qws.h | 1 |
2 files changed, 47 insertions, 6 deletions
diff --git a/src/gui/embedded/qscreenlinuxfb_qws.cpp b/src/gui/embedded/qscreenlinuxfb_qws.cpp index 8a21022..2cdd16f 100644 --- a/src/gui/embedded/qscreenlinuxfb_qws.cpp +++ b/src/gui/embedded/qscreenlinuxfb_qws.cpp @@ -91,6 +91,7 @@ public: int startuph; int startupd; bool blank; + bool is8Track; bool doGraphicsMode; #ifdef QT_QWS_DEPTH_GENERIC @@ -164,6 +165,19 @@ void QLinuxFbScreenPrivate::closeTty() ttyfd = -1; } +static void fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo) +{ + // 8Track e-ink devices (as found in Sony PRS-505) lie + // about their bit depth -- they claim they're 1 bit per + // pixel while the only supported mode is 8 bit per pixel + // grayscale. + // Caused by this, they also miscalculate their line length. + if(!strcmp(finfo.id, "8TRACKFB") && vinfo.bits_per_pixel == 1) { + vinfo.bits_per_pixel = 8; + finfo.line_length = vinfo.xres; + } +} + /*! \internal @@ -306,6 +320,8 @@ bool QLinuxFbScreen::connect(const QString &displaySpec) return false; } + d_ptr->is8Track = !strcmp(finfo.id, "8TRACKFB"); + if (finfo.type == FB_TYPE_VGA_PLANES) { qWarning("VGA16 video mode not supported"); return false; @@ -318,6 +334,8 @@ bool QLinuxFbScreen::connect(const QString &displaySpec) return false; } + fixupScreenInfo(finfo, vinfo); + grayscale = vinfo.grayscale; d = vinfo.bits_per_pixel; if (d == 24) { @@ -664,11 +682,6 @@ bool QLinuxFbScreen::initDevice() vinfo.transp.msb_right); #endif - d_ptr->startupw=vinfo.xres; - d_ptr->startuph=vinfo.yres; - d_ptr->startupd=vinfo.bits_per_pixel; - grayscale = vinfo.grayscale; - if (ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { perror("QLinuxFbScreen::initDevice"); qCritical("Error reading fixed information in card init"); @@ -677,6 +690,13 @@ bool QLinuxFbScreen::initDevice() return true; } + fixupScreenInfo(finfo, vinfo); + + d_ptr->startupw=vinfo.xres; + d_ptr->startuph=vinfo.yres; + d_ptr->startupd=vinfo.bits_per_pixel; + grayscale = vinfo.grayscale; + #ifdef __i386__ // Now init mtrr if(!::getenv("QWS_NOMTRR")) { @@ -1122,6 +1142,7 @@ void QLinuxFbScreen::setMode(int nw,int nh,int nd) qFatal("Error reading fixed information"); } + fixupScreenInfo(finfo, vinfo); disconnect(); connect(d_ptr->displaySpec); exposeRegion(region(), 0); @@ -1200,6 +1221,23 @@ int QLinuxFbScreen::sharedRamSize(void * end) /*! \reimp */ +void QLinuxFbScreen::setDirty(const QRect &) +{ + if(d_ptr->is8Track) { + // e-Ink displays need a trigger to actually show what is + // in their framebuffer memory. The 8-Track driver does this + // by adding custom IOCTLs - FBIO_EINK_DISP_PIC (0x46a2) takes + // an argument specifying whether or not to update the Flash + // memory. + // There doesn't seem to be a way to tell it to just update + // a subset of the screen. + ioctl(d_ptr->fd, 0x46a2, 1); + } +} + +/*! + \reimp +*/ void QLinuxFbScreen::blank(bool on) { if (d_ptr->blank == on) @@ -1315,7 +1353,9 @@ void QLinuxFbScreen::setPixelFormat(struct fb_var_screeninfo info) bool QLinuxFbScreen::useOffscreen() { - if ((mapsize - size) < 16*1024) + // Not done for 8Track because on e-Ink displays, + // everything is offscreen anyway + if (d_ptr->is8Track || ((mapsize - size) < 16*1024)) return false; return true; diff --git a/src/gui/embedded/qscreenlinuxfb_qws.h b/src/gui/embedded/qscreenlinuxfb_qws.h index ac488b7..0854191 100644 --- a/src/gui/embedded/qscreenlinuxfb_qws.h +++ b/src/gui/embedded/qscreenlinuxfb_qws.h @@ -98,6 +98,7 @@ public: virtual uchar * cache(int); virtual void uncache(uchar *); virtual int sharedRamSize(void *); + virtual void setDirty(const QRect&); QLinuxFb_Shared * shared; |