From 8389ba08206ab8ab0ee2a65ffbd8514d5e29a8dc Mon Sep 17 00:00:00 2001 From: kyak Date: Sun, 8 Jan 2012 00:38:24 +0400 Subject: [PATCH] fbterm: incorporate viric's patch for Ben LCD --- fbterm/Makefile | 6 +-- fbterm/patches/001-iconv.patch | 14 +++--- fbterm/patches/002-fbterm-1.7-benlcd.patch | 50 ++++++++++++++++++++++ 3 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 fbterm/patches/002-fbterm-1.7-benlcd.patch diff --git a/fbterm/Makefile b/fbterm/Makefile index 2dde3dd..b6fae17 100644 --- a/fbterm/Makefile +++ b/fbterm/Makefile @@ -5,12 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fbterm -PKG_VERSION:=1.6 +PKG_VERSION:=1.7 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_MD5SUM:=531ea0984836b58fd123e6a97a4228c6 +PKG_MD5SUM:=c36bae75a450df0519b4527cccaf7572 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk diff --git a/fbterm/patches/001-iconv.patch b/fbterm/patches/001-iconv.patch index f530066..28873c6 100644 --- a/fbterm/patches/001-iconv.patch +++ b/fbterm/patches/001-iconv.patch @@ -1,7 +1,6 @@ -diff -ur fbterm-1.6.orig/src/lib/io.cpp fbterm-1.6/src/lib/io.cpp ---- fbterm-1.6.orig/src/lib/io.cpp 2011-01-10 13:13:05.158606303 +0300 -+++ fbterm-1.6/src/lib/io.cpp 2011-01-10 14:06:58.512695530 +0300 -@@ -119,10 +119,10 @@ +--- a/src/lib/io.cpp ++++ b/src/lib/io.cpp +@@ -119,10 +119,10 @@ void IoPipe::setCodec(const s8 *up, cons if (!strcasecmp(up, down)) return; 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 -diff -ur fbterm-1.6.orig/src/lib/io.h fbterm-1.6/src/lib/io.h ---- fbterm-1.6.orig/src/lib/io.h 2011-01-10 13:13:05.158606303 +0300 -+++ fbterm-1.6/src/lib/io.h 2011-01-10 14:08:33.247605712 +0300 +--- a/src/lib/io.h ++++ b/src/lib/io.h @@ -23,6 +23,7 @@ #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 { public: -@@ -47,7 +48,7 @@ +@@ -47,7 +48,7 @@ private: void writeIo(s8 *buf, u32 len); s32 mFd; diff --git a/fbterm/patches/002-fbterm-1.7-benlcd.patch b/fbterm/patches/002-fbterm-1.7-benlcd.patch new file mode 100644 index 0000000..f758718 --- /dev/null +++ b/fbterm/patches/002-fbterm-1.7-benlcd.patch @@ -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) \ + \