On Sun, May 15, 2005 at 04:42:34AM +0300, Paavo Hartikainen wrote: > Few days ago I finally managed to get DVB-C tuner with on-board MPEG-2 > decoding. Installed PCI board on PowerMacintosh 7500 (PowerPC 604e) > and it has worked smoothly from the beginning. Except for one small > detail: OSD colours (of VDR) were wrong. But wait... I saw exactly > the same thing with DXR3 > (<URL:http://www.linuxtv.org/mailinglists/vdr/2004/07-2004/msg00475.html>). > > I assume that byte order conversion had got implemented in kernel DXR3 > driver and code in VDR DXR3 plugin needed removing. At this point I > looked at source code of "dvb_ttpci" kernel driver. > > Colour space conversion happens at > "linux-2.6.11.7/drivers/media/dvb/ttpci/av7110_hw.c", beginning from > line 952, function OSDSetPalette(): > > --- > blend = (color & 0xF0000000) >> 4; > yuv = blend ? RGB2YUV(color & 0xFF, (color >> 8) & 0xFF, > (color >> 16) & 0xFF) | blend : 0; > --- > > Now, inserting this byte order conversion before colour space > conversion fixed OSD colours for me: > > --- > color = ((color & 0xFF) << 24) | ((color & 0xFF00) << 8) | > ((color & 0xFF0000) >> 8) | ((color & 0xFF000000) >> 24); > --- > > It supposedly breaks OSD for hardware of opposite byte order, so some > kind of byte order detection logic around it. I do not know how that > is supposed to be done in kernel code. (you would use: #inlude <asm/byteorder.h> ... color= cpu_to_le32(color) or cpu_to_le32s(color); ) I believe that is a vdr bug. Vdr swaps the byteorder for __BIG_ENDIAN in dvbosd.c:cDvbOsd::Flush(). I don't know why. It's not necessary, just use CPU byte order verywhere. Johannes