1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-22 05:44:03 +02:00

fbterm: incorporate viric's patch for Ben LCD

This commit is contained in:
kyak 2012-01-08 00:38:24 +04:00
parent 0e220dd528
commit 8389ba0820
3 changed files with 59 additions and 11 deletions

View File

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=fbterm PKG_NAME:=fbterm
PKG_VERSION:=1.6 PKG_VERSION:=1.7
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).0.tar.gz
PKG_SOURCE_URL:=http://fbterm.googlecode.com/files/ PKG_SOURCE_URL:=http://fbterm.googlecode.com/files/
PKG_MD5SUM:=531ea0984836b58fd123e6a97a4228c6 PKG_MD5SUM:=c36bae75a450df0519b4527cccaf7572
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk include $(INCLUDE_DIR)/nls.mk

View File

@ -1,7 +1,6 @@
diff -ur fbterm-1.6.orig/src/lib/io.cpp fbterm-1.6/src/lib/io.cpp --- a/src/lib/io.cpp
--- fbterm-1.6.orig/src/lib/io.cpp 2011-01-10 13:13:05.158606303 +0300 +++ b/src/lib/io.cpp
+++ fbterm-1.6/src/lib/io.cpp 2011-01-10 14:06:58.512695530 +0300 @@ -119,10 +119,10 @@ void IoPipe::setCodec(const s8 *up, cons
@@ -119,10 +119,10 @@
if (!strcasecmp(up, down)) return; if (!strcasecmp(up, down)) return;
mCodecRead = iconv_open(up, down); mCodecRead = iconv_open(up, down);
@ -14,9 +13,8 @@ diff -ur fbterm-1.6.orig/src/lib/io.cpp fbterm-1.6/src/lib/io.cpp
} }
#define BUF_SIZE 10240 #define BUF_SIZE 10240
diff -ur fbterm-1.6.orig/src/lib/io.h fbterm-1.6/src/lib/io.h --- a/src/lib/io.h
--- fbterm-1.6.orig/src/lib/io.h 2011-01-10 13:13:05.158606303 +0300 +++ b/src/lib/io.h
+++ fbterm-1.6/src/lib/io.h 2011-01-10 14:08:33.247605712 +0300
@@ -23,6 +23,7 @@ @@ -23,6 +23,7 @@
#include "type.h" #include "type.h"
@ -25,7 +23,7 @@ diff -ur fbterm-1.6.orig/src/lib/io.h fbterm-1.6/src/lib/io.h
class IoPipe { class IoPipe {
public: public:
@@ -47,7 +48,7 @@ @@ -47,7 +48,7 @@ private:
void writeIo(s8 *buf, u32 len); void writeIo(s8 *buf, u32 len);
s32 mFd; s32 mFd;

View File

@ -0,0 +1,50 @@
Patch to get the fbterm 1.7 display somewhat better the gliphs on the Ben LCD.
Author: Lluís Batlle i Rossell
diff --git a/src/screen_render.cpp b/src/screen_render.cpp
index e8f39b8..e0f90e9 100644
--- a/src/screen_render.cpp
+++ b/src/screen_render.cpp
@@ -195,7 +195,40 @@ void Screen::draw##bits(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap) \
drawX(15, 5, 5, 5, u16, writew)
drawX(16, 5, 6, 5, u16, writew)
-drawX(32, 8, 8, 8, u32, writel)
+
+void Screen::draw32(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap)
+{
+ /* This code takes into account the Ben Nanonote LCD, that has the distribution:
+ * 0: RR GG BB RR GG BB
+ * 1: GG BB RR GG BB RR
+ * 2: RR GG BB RR GG BB
+ * 3: ...
+ *
+ * We display the odd rows as 50% green in the current pixel, 50% in the next */
+ u8 red, green, blue;
+ u8 pixel;
+ u32 color;
+ u32 *dst = (u32 *)(mVMemBase + y * mBytesPerLine + x * bytes_per_pixel);
+ /* To work with white background, we ensure to paint the first pixel */
+ u8 prevgreen = mPalette[bc].green/2;
+
+ for (; w--; pixmap++, dst++) {
+ u8 newgreen;
+ pixel = *pixmap;
+
+ red = mPalette[bc].red + (((mPalette[fc].red - mPalette[bc].red) * pixel) >> 8);
+ newgreen = mPalette[bc].green + (((mPalette[fc].green - mPalette[bc].green) * pixel) >> 8);
+ blue = mPalette[bc].blue + (((mPalette[fc].blue - mPalette[bc].blue) * pixel) >> 8);
+
+ /* width == 0 is the special case for the last byte, where we paint full green.
+ * That's relevant for white background, like when running 'top'. */
+ green = ((y & 1) == 0 || w == 0) ? newgreen : (newgreen/2 + prevgreen);
+ color = (red << 16) | (green << 8) | (blue);
+ writel(dst, color);
+ prevgreen = newgreen/2;
+ }
+}
+
#define drawXBg(bits, lred, lgreen, lblue, type, fbwrite) \
\