From owner-freebsd-current@FreeBSD.ORG Thu Jan 8 16:03:21 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E378106566B for ; Thu, 8 Jan 2009 16:03:21 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id DB8958FC3C for ; Thu, 8 Jan 2009 16:03:20 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 08 Jan 2009 16:03:18 -0000 Received: from p54A3E282.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.226.130] by mail.gmx.net (mp006) with SMTP; 08 Jan 2009 17:03:18 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX18uRn4I3douBkhws4Sj+KE81wP2ATRrcqNuWFLUio Z09J9AD8L+ZUOR Message-ID: <496623C5.90400@gmx.de> Date: Thu, 08 Jan 2009 17:03:17 +0100 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: Alexander Best References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.52 Cc: freebsd-current@freebsd.org Subject: Re: mouse cursor corrupts chars under syscons X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jan 2009 16:03:21 -0000 Alexander Best schrieb: > the effect is hard to describe. when moving the cursor over chars you can see > that the edges of certain chars flicker. try running the command below. the > effect should be quite obvious. i'm using an old fashioned crt monitor. the > effect might not be visible on tft displays. > > i have absolutely no idea what's causing this. but here's a wild guess: > > from the effect it looks like the mouse cursor is actually made up of a 32x32 > or 64x64 pixel square. this square contains the white cursor. apart from the > cursor the rest of the square is transparent. it appears the code that > calculates the actual pixel-colour-value between the transparent parts of the > cursor-square and the cars on syscons has a bug in it. > > however that's just a wild guess. Ah! Now I understand what you mean. First I did not see the effect, because I use 80x50 instead of 80x25 and a different font is used there. You see the right border of the "0" flickering when you move the mouse cursor, right? The effect is caused by how video hardware works in textmode and how the mouse cursor magic works. First video hardware in textmode: You see 80x25 chars. The resolution is 720x400 pixels. So every char consists 9x16 pixels. To display a char the video card uses a map with a bitmap for every char. But the bitmap of every char consists only of 16 bytes. So we are missing one bit per line. So there is another trick: Either the 9th column is displayed black (or whatever the background colour is) *or* the 8th column is repeated. What actually happens depends on two registers in the video card, which represent a range. You can set them so that char 213 till 234 (just random example) have their 8th column repeated to the 9th and all others have a black 9th column. Usually "0" is outside of this range, so the 9th column is black. Now how does the mouse cursor magic work: The mouse cursors consists of 2x2 chars. The bitmap for these 4 chars are altered and the codes for the 4 chars are copied to the place where the mouse cursor should appear. Remember: We are in text mode, so you cannot just paint pixels. Everything has to go through the character map. So to make the mouse cursor appear following happens: First the pixel coordinates of the cursor are mapped to the character coordinates. Then the 4 chars there are read and the character maps are copied to the 4 reserved chars. Then the mouse cursor is painted onto these 4 reserved chars. Last the 4 reserved character codes are copied to the screen, so you see the mouse cursor appear. So when you move your mouse onto a "0" you no longer see a "real" 0, but you see another character with the same charmap but the mouse cursor painted on it. Now the 9th column trick: The cursor would have a gap when it is outside the repeat-8th-column range. So the reserved characters are chosen to be in this range, the 8th column is copied and the mouse cursor appears continuous. This is also the reason why the mouse cursor has a "jumping" step when you move it around, just look closely. It is exactly at the right edge of a character. So the 8th column gets copied, but a "0" (and other chars, too) have pixel data in there, which also gets copied and this causes the effect you observe. Long story short: Everything is correct. (: Bonus: You can see the mouse cursor magic at work if you move the reserved character range: Write ABCD on the terminal: echo AB; echo CD Then execute "vidcontrol -M 65". 65 is ASCII A, you can only specify the start of the range. Now you see how the magic works in the four letters ABCD you wrote before. You'll also notice, that the mouse cursor now has a gap, because 65-68 are outside of the repeat-8th-column range. When you now move the mouse over "0" you no longer see the effect you described for the same reason. Use "vidcontrol -M 208" to reset to default. I hope this explanation is helpful for you Christoph