linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antonino Daplas <adaplas@pol.net>
To: Michael Kaufmann <kaufmann@sohard.de>
Cc: Linux Fbdev development list <linux-fbdev-devel@lists.sourceforge.net>
Subject: Re: Mirrored Display?
Date: 16 Dec 2002 01:57:52 +0500	[thread overview]
Message-ID: <1039985803.1080.119.camel@localhost.localdomain> (raw)
In-Reply-To: <200212151603.30592.kaufmann@sohard.de>

On Sun, 2002-12-15 at 22:03, Michael Kaufmann wrote:
> On Saturday 14 December 2002 23:29, you wrote:
> > On Fri, 2002-12-13 at 23:33, Michael Kaufmann wrote:
> > > Hello,
> > >
> > > i would like to use a mono LCD with a framebuffer driver.
> > >
> > > I've modified existing drivers, and after a lot of work i now have a
> > > clear picture on my display. Unfortunately, the complete picture is
> > > mirrored. The Bootlogo is top/right instead of top/left and the ascii
> > > output starts from right to left.
> > >
> > > Where is the right place to modify this behaviour?
> > > I'm also looking for a possibility to rotate the picture.
> > > Because my videocontroller can emulate 15 grayscales, i'm useing 4bpp.
> > >
> > > It would be very nice, if someone can guide me in the right direction.
> >
> > Are you using fbcon-cfb4.c to draw the characters?  Is the whole display
> > mirrored, including individual characters?  If you run an fb-based app
> > (like fbtest for instance), is the display also mirrored?
> 
> Yes,  i'm using fbon-cfb4.c. The console is on my display, i see the boot logo 
> and the kernel messages in the display mirrored. I never used fbtest. By the 
> way, where can i find fbtest? But i already startet nanox/microwindows on top 
Check one of the links in www.linux-fbdev.org.

> of the fb, and the picture is also mirrored.  
> 
Ouch, your user apps are also mirrored :-(

> > If it's the whole display, maybe your hardware supports mirroring (some
> > hardware with video overlay need this to support YUV formats that are
> > either vertically or horizontally mirrored).  Maybe it has something
> > like that.  Otherwise, it will be difficult to correct this without
> > rewriting practically everything.
> 
> No, i don't think so. It is a simple video controller. Nevertheless, i have 
> just looked in the datasheet, and do not found such a feature. 
> 
> I don't think that this is a bug or something like this in the framebuffer. 
> Because everthing works like i exect it, but i have to mirror the picture.
No, I never said this was a bug.  Mirroring is a hardware feature
occasionally useful such as for mirrored mpegs.  

> I have also measured with a scope all signals to the display, and the 
> generated output looks like i expect it. The datastream starts with the first 
> pixel (in the picture top/left) and continues with the second pixel (on the 
> right of the first pixel) and so on.
> But my display is mapping this datastream from the right to the left.
This is the problem.  You are writing each byte in the correct location
in the framebuffer, but somehow it gets shown in the "mirrored" location
of your display.

> Please take a look on the attached picture, i think it explains the behaviour.
> I can reproduce it without Linux with a simple monitor programm
> 
> At the moment i have two explanations:
> 1) I have a display witch must be accessed unusual, and the LINUX FB doesn't
>     support this kind of access (not yet).
> 2) There is a hardware problem with the signals to the display (changed 
>    signals like frame-pulse, and line-pulse, or something like this.
> 
> I don't think that it is a hardware problem, but i will check the connection 
> again. Is there really no way in the framebuffer to mirror and/or rotate the 
> picture data?
> When i have to fix it in software, what kind of code do i have to rewrite? 

Fixing the console is feasible enough though it entails a lot of work.
You have to rewrite all the functions in fbcon-cfb4.c so you go
"right->left" instead of "left->right".  Do the same thing to
fbcon_show_logo() in fbcon.c, and fb_read/fb_write in fbmem.c.

Fixing user apps, that's the tough part. The framebuffer API is not
something like XAA which has specific hooks for filling, copying,
expanding, etc an area of pixels to the framebuffer.  All the
framebuffer API provides are two ways to access the graphics memory
(similar to a watered-down version of X's DGA):

1. The standard file read/file write which will be intercepted by
fb_read and fb_write; and

2. mmap 

Of the 2, mmap is usually chosen by user apps because it's simple and
fast.  The disadvantage is that your driver has no control on what will
get displayed, and there is no feasible solution to this, except to
disable mmap by setting fb_fix_screeninfo.smem_len to zero. Hopefully,
if mmap is not possible, they will fall back to using file read and file
write.

User apps will always assume that the first pixel written to the
framebuffer will appear as the first pixel of the first scanline of your
display.  Meaning, for apps that will always use mmap, you have to
rewrite them so they raster "right->left" instead of "left->right".

If you think about it, a hardware solution seems to be more feasible.

Tony




-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/

  reply	other threads:[~2002-12-15 18:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-13 18:33 Mirrored Display? Michael Kaufmann
2002-12-15  0:29 ` Antonino Daplas
2002-12-15 17:03   ` Michael Kaufmann
2002-12-15 20:57     ` Antonino Daplas [this message]
2002-12-16  0:40       ` Michel Dänzer
2002-12-20 19:49 ` James Simmons
2002-12-23 13:04   ` Michael Kaufmann
2002-12-29 15:59     ` Antonino Daplas
2003-01-07 21:18       ` James Simmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1039985803.1080.119.camel@localhost.localdomain \
    --to=adaplas@pol.net \
    --cc=kaufmann@sohard.de \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).