2002-11-28 04:26:07

by Antonino A. Daplas

[permalink] [raw]
Subject: [PATCH] FBDev: vga16fb port

Attached is a patch against 2.5.49 + James Simmons' latest fbdev.diff.

Added support for logo drawing.
Fixed vga16fb_imageblit() limitation of 8-pixel wide bitmap blitting
only.

Tony



Attachments:
vga16fb.diff (6.00 kB)

2002-12-02 20:24:17

by James Simmons

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port


> Attached is a patch against 2.5.49 + James Simmons' latest fbdev.diff.
>
> Added support for logo drawing.
> Fixed vga16fb_imageblit() limitation of 8-pixel wide bitmap blitting
> only.

Applied and tested :-=) The only weird thing is it drew the logo twice
when I don't have a SMP laptop. It works other than that.

P.S
Things I like to get done for the vga16fb driver.

1) Its own read and write functions to fake a linear framebuffer.
2) The ability to go back to vga text mode on close of /dev/fb.
Yes fbdev/fbcon supports that now.


2002-12-03 09:22:29

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Tue, 2002-12-03 at 01:31, James Simmons wrote:
>
> > Attached is a patch against 2.5.49 + James Simmons' latest fbdev.diff.
> >
> > Added support for logo drawing.
> > Fixed vga16fb_imageblit() limitation of 8-pixel wide bitmap blitting
> > only.
>
> Applied and tested :-=) The only weird thing is it drew the logo twice
> when I don't have a SMP laptop. It works other than that.
>
Should be expected if the fbcon_show_logo() patch did not take. I'm
resubmitting another patch in one of my replies.

> P.S
> Things I like to get done for the vga16fb driver.
>
> 1) Its own read and write functions to fake a linear framebuffer.
Should be doable with fb_write and fb_read, but with mmap, the app still
needs to know the VGA format.

> 2) The ability to go back to vga text mode on close of /dev/fb.
> Yes fbdev/fbcon supports that now.

I'll take a stab at writing VGA save/restore routines which hopefully is
generic enough to be used by various hardware. No promises though, VGA
programming gives me a headache :(

Tony

2002-12-03 15:06:33

by Alan

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Tue, 2002-12-03 at 12:22, Antonino Daplas wrote:
> > Things I like to get done for the vga16fb driver.
> >
> > 1) Its own read and write functions to fake a linear framebuffer.
> Should be doable with fb_write and fb_read, but with mmap, the app still
> needs to know the VGA format.

I question whether thats something that belongs anywhere near the
kernel. Ben Pfaff wrote a fine library for vga16 hackery (BOGL) and it
combines very nicely with the fb driver.

> > 2) The ability to go back to vga text mode on close of /dev/fb.
> > Yes fbdev/fbcon supports that now.
>
> I'll take a stab at writing VGA save/restore routines which hopefully is
> generic enough to be used by various hardware. No promises though, VGA
> programming gives me a headache :(

You can pull the code out of the old svgalib library. Since its not
doing any card specific stuff the generic vga->text restore ought to do
the right thing.


2002-12-03 17:51:35

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Tue, 2002-12-03 at 20:47, Alan Cox wrote:
> On Tue, 2002-12-03 at 12:22, Antonino Daplas wrote:
> > > Things I like to get done for the vga16fb driver.
> > >
> > > 1) Its own read and write functions to fake a linear framebuffer.
> > Should be doable with fb_write and fb_read, but with mmap, the app still
> > needs to know the VGA format.
>
> I question whether thats something that belongs anywhere near the
> kernel. Ben Pfaff wrote a fine library for vga16 hackery (BOGL) and it
> combines very nicely with the fb driver.
I kinda agree with this. Most fb apps use mmap to access the
framebuffer, so it's almost impossible to fake a linear framebuffer from
a planar one.

>
> > > 2) The ability to go back to vga text mode on close of /dev/fb.
> > > Yes fbdev/fbcon supports that now.
> >
> > I'll take a stab at writing VGA save/restore routines which hopefully is
> > generic enough to be used by various hardware. No promises though, VGA
> > programming gives me a headache :(
>
> You can pull the code out of the old svgalib library. Since its not
> doing any card specific stuff the generic vga->text restore ought to do
> the right thing.
>
Thanks for the info. I think I'll review this one to see what I missed.

Tony



2002-12-03 17:48:34

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Tue, 2002-12-03 at 01:31, James Simmons wrote:
James,

> 2) The ability to go back to vga text mode on close of /dev/fb.
> Yes fbdev/fbcon supports that now.
>

Here's a preliminary and highly unpolished patch for saving and
restoring the initial vga state. The module allows saving/restoring of
specific hardware states (vga fonts/character maps, color map, and/or
video mode) by specifying different flags. Most hardware probably will
just need restoring of the initial video mode though. Hopefully, it
should be generic enough to complement device specific state save and
restore routines.

For testing purposes, I also patched vga16fb.c to use the module during
fb_open and fb_release. Try loading vga16fb, and when opened, the video
mode will change. On close, the state of vgacon should be restored. I
have tested this with two different VGA cards, and both seems to work
quite well. However, color map and character map state restores are still untested.

Note that the module still makes assumptions that may not be necessarily
correct for all hardware (ie vga base is at 0xa0000). Secondly, there's
no check if the card is in VGA mode, EGA mode, or graphics mode. Please
review.

Tony


Attachments:
vgastate.diff (18.98 kB)

2002-12-03 21:03:00

by James Simmons

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port


> I question whether thats something that belongs anywhere near the
> kernel. Ben Pfaff wrote a fine library for vga16 hackery (BOGL) and it
> combines very nicely with the fb driver.

Out of curiousity where is this library.

2002-12-03 21:01:31

by James Simmons

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port


> > I question whether thats something that belongs anywhere near the
> > kernel. Ben Pfaff wrote a fine library for vga16 hackery (BOGL) and it
> > combines very nicely with the fb driver.
> I kinda agree with this. Most fb apps use mmap to access the
> framebuffer, so it's almost impossible to fake a linear framebuffer from
> a planar one.

Okay. Then that idea is scrapped.


2002-12-04 03:12:13

by Tomas Szepe

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

>
> > I question whether thats something that belongs anywhere near the
> > kernel. Ben Pfaff wrote a fine library for vga16 hackery (BOGL) and it
> > combines very nicely with the fb driver.
>
> Out of curiousity where is this library.

http://packages.qa.debian.org/b/bogl.html
http://http.us.debian.org/debian/pool/main/b/bogl/bogl_0.1.10-3.tar.gz

--
Tomas Szepe <[email protected]>

2002-12-04 07:25:47

by Sven Luther

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Tue, Dec 03, 2002 at 05:22:35PM +0500, Antonino Daplas wrote:
> > 2) The ability to go back to vga text mode on close of /dev/fb.
> > Yes fbdev/fbcon supports that now.
>
> I'll take a stab at writing VGA save/restore routines which hopefully is
> generic enough to be used by various hardware. No promises though, VGA
> programming gives me a headache :(

BTW, i am writing a fbdev for a card where the docs tell me to disable
vga output before enabling graphical output. Does i need to do this in
the fbdev i write, or is it already handled by the vga layer, or
whatever ?

Friendly,

Sven Luther

2002-12-04 10:10:39

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Wed, 2002-12-04 at 12:32, Sven Luther wrote:
> On Tue, Dec 03, 2002 at 05:22:35PM +0500, Antonino Daplas wrote:
> > > 2) The ability to go back to vga text mode on close of /dev/fb.
> > > Yes fbdev/fbcon supports that now.
> >
> > I'll take a stab at writing VGA save/restore routines which hopefully is
> > generic enough to be used by various hardware. No promises though, VGA
> > programming gives me a headache :(
>
> BTW, i am writing a fbdev for a card where the docs tell me to disable
> vga output before enabling graphical output. Does i need to do this in
> the fbdev i write, or is it already handled by the vga layer, or
> whatever ?

Most cards with a VGA core needs to disable the VGA output before going
to graphics mode. Disabling VGA output is hardware specific, and is
usually automatic when you go to graphics mode.

Because James wrote the fb framework to be very modular, then you must
be careful to save/restore the initial video state when loading or
unloading. Theoretically, a driver should load, but not go to graphics
mode immediately. Only upon a call to xxxfb_set_par() should the driver
do so. Before going to graphics mode, that's were you save the initial
state. Have a reference count or something to keep track of the number
of users, and when this reference count becomes zero, restore the
initial state. You should be able to do this by hooking these routines
in fb_open() and fb_release().

The one I submitted (and a revised one I'm going to submit soon) should
be able to restore the VGA text/graphics mode. Complement this with
your hardware's extended state save and restore routines and you should
be able to load/use/unload your driver repeatedly :-).

Tony

Tony


2002-12-04 10:21:58

by Sven Luther

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Wed, Dec 04, 2002 at 05:08:53PM +0500, Antonino Daplas wrote:
> On Wed, 2002-12-04 at 12:32, Sven Luther wrote:
> > On Tue, Dec 03, 2002 at 05:22:35PM +0500, Antonino Daplas wrote:
> > > > 2) The ability to go back to vga text mode on close of /dev/fb.
> > > > Yes fbdev/fbcon supports that now.
> > >
> > > I'll take a stab at writing VGA save/restore routines which hopefully is
> > > generic enough to be used by various hardware. No promises though, VGA
> > > programming gives me a headache :(
> >
> > BTW, i am writing a fbdev for a card where the docs tell me to disable
> > vga output before enabling graphical output. Does i need to do this in
> > the fbdev i write, or is it already handled by the vga layer, or
> > whatever ?
>
> Most cards with a VGA core needs to disable the VGA output before going
> to graphics mode. Disabling VGA output is hardware specific, and is
> usually automatic when you go to graphics mode.

So there is no common zqy of doing this, my docs say something about a
vga control register zhich is accesses trough the sequencer regs. Does
vgafb (or textmode or whatever) not call this when giving the hand to
the fbdev ?

> Because James wrote the fb framework to be very modular, then you must
> be careful to save/restore the initial video state when loading or
> unloading. Theoretically, a driver should load, but not go to graphics
> mode immediately. Only upon a call to xxxfb_set_par() should the driver
> do so. Before going to graphics mode, that's were you save the initial
> state. Have a reference count or something to keep track of the number
> of users, and when this reference count becomes zero, restore the
> initial state. You should be able to do this by hooking these routines
> in fb_open() and fb_release().

Mmm, what about interaction with X ? X also does a save/restore of the
previous (text) mode, when a X driver is _not_ fbdev aware, it will
save/restore the things twice, right ?

> The one I submitted (and a revised one I'm going to submit soon) should
> be able to restore the VGA text/graphics mode. Complement this with
> your hardware's extended state save and restore routines and you should
> be able to load/use/unload your driver repeatedly :-).

Ok, i will try.

Friendlmy

Sven Luther

2002-12-04 14:30:24

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Wed, 2002-12-04 at 15:28, Sven Luther wrote:
> >
> > Most cards with a VGA core needs to disable the VGA output before going
> > to graphics mode. Disabling VGA output is hardware specific, and is
> > usually automatic when you go to graphics mode.
>
> So there is no common zqy of doing this, my docs say something about a
> vga control register zhich is accesses trough the sequencer regs. Does
> vgafb (or textmode or whatever) not call this when giving the hand to
> the fbdev ?
No, when a video card goes to graphics mode, it's up to the driver to
program the registers. vgacon/vga16fb only touches the standard VGA
registers (crtc[25], attr[21], seq[5], gfx[9], misc[1]). Usage is pretty
much uniform across all hardware. Any registers past those indices are
considered extended registers and usage is hardware specific. In
graphics mode, you will probably use both the standard and the extended
registers, and disabling the VGA mode/enabling graphics mode is most
probably in one of the extended registers.
>
> > Because James wrote the fb framework to be very modular, then you must
> > be careful to save/restore the initial video state when loading or
> > unloading. Theoretically, a driver should load, but not go to graphics
> > mode immediately. Only upon a call to xxxfb_set_par() should the driver
> > do so. Before going to graphics mode, that's were you save the initial
> > state. Have a reference count or something to keep track of the number
> > of users, and when this reference count becomes zero, restore the
> > initial state. You should be able to do this by hooking these routines
> > in fb_open() and fb_release().
>
> Mmm, what about interaction with X ? X also does a save/restore of the
> previous (text) mode, when a X driver is _not_ fbdev aware, it will
> save/restore the things twice, right ?
>
Not twice just the current mode it was in when X launched, although it
always assumes text mode. Same thing for fbdev, it should only restore
the state when reference count becomes zero. If the framebuffer console
is loaded, the reference count will never be zero unless it is
unloaded. If the framebuffer console is not loaded, the only time you
will save and restore the state is when some fb-based application
attempts to open/close /dev/fbx.

> > The one I submitted (and a revised one I'm going to submit soon) should
> > be able to restore the VGA text/graphics mode. Complement this with
> > your hardware's extended state save and restore routines and you should
> > be able to load/use/unload your driver repeatedly :-).
>
> Ok, i will try.

This is optional though. You can still adopt the 2.4 method of always
setting the video mode. Just take note that fbdev can be loaded without
fbcon, and if you get into graphics mode without fbcon, you just messed
up your user's console. I think this can be avoided by munging the
configuration file (ie, always depend on fbcon and make your module
unsafe to unload).

Tony

2002-12-04 16:41:25

by Sven Luther

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Wed, Dec 04, 2002 at 10:27:21PM +0500, Antonino Daplas wrote:
> On Wed, 2002-12-04 at 15:28, Sven Luther wrote:
> > >
> > > Most cards with a VGA core needs to disable the VGA output before going
> > > to graphics mode. Disabling VGA output is hardware specific, and is
> > > usually automatic when you go to graphics mode.
> >
> > So there is no common zqy of doing this, my docs say something about a
> > vga control register zhich is accesses trough the sequencer regs. Does
> > vgafb (or textmode or whatever) not call this when giving the hand to
> > the fbdev ?
> No, when a video card goes to graphics mode, it's up to the driver to
> program the registers. vgacon/vga16fb only touches the standard VGA

So we will have a repeat of the exact same code snipplet in all the
drivers ? I thought the new API was about having all the common code in
common and not duplicated in all the drivers. Could we have at least a
gen_disable_vga function or something such that we could call ?

> registers (crtc[25], attr[21], seq[5], gfx[9], misc[1]). Usage is pretty

Well, i need to disable the vga output in seq[5], more exactly bit 3
called "enable VGA display", need to be reset.

> much uniform across all hardware. Any registers past those indices are
> considered extended registers and usage is hardware specific. In
> graphics mode, you will probably use both the standard and the extended
> registers, and disabling the VGA mode/enabling graphics mode is most
> probably in one of the extended registers.

Err, it is seq[5], called VGAControlRegister, so it is beyond the
standard seq registers (seq[0] to seq[5]), right ?

> > > Because James wrote the fb framework to be very modular, then you must
> > > be careful to save/restore the initial video state when loading or
> > > unloading. Theoretically, a driver should load, but not go to graphics
> > > mode immediately. Only upon a call to xxxfb_set_par() should the driver
> > > do so. Before going to graphics mode, that's were you save the initial
> > > state. Have a reference count or something to keep track of the number
> > > of users, and when this reference count becomes zero, restore the
> > > initial state. You should be able to do this by hooking these routines
> > > in fb_open() and fb_release().
> >
> > Mmm, what about interaction with X ? X also does a save/restore of the
> > previous (text) mode, when a X driver is _not_ fbdev aware, it will
> > save/restore the things twice, right ?
> >
> Not twice just the current mode it was in when X launched, although it
> always assumes text mode. Same thing for fbdev, it should only restore

Well, but fbdev will save its state and X will save it again, so the
saving done in the X driver is not all that important, and i could
ignore it at first if i already have an fbdev.

Does this also apply to vesafb ?

> the state when reference count becomes zero. If the framebuffer console
> is loaded, the reference count will never be zero unless it is
> unloaded. If the framebuffer console is not loaded, the only time you
> will save and restore the state is when some fb-based application
> attempts to open/close /dev/fbx.

Ok, ...

> > > The one I submitted (and a revised one I'm going to submit soon) should
> > > be able to restore the VGA text/graphics mode. Complement this with
> > > your hardware's extended state save and restore routines and you should
> > > be able to load/use/unload your driver repeatedly :-).
> >
> > Ok, i will try.
>
> This is optional though. You can still adopt the 2.4 method of always
> setting the video mode. Just take note that fbdev can be loaded without
> fbcon, and if you get into graphics mode without fbcon, you just messed
> up your user's console. I think this can be avoided by munging the
> configuration file (ie, always depend on fbcon and make your module
> unsafe to unload).

Anyway, i need to play with it some and experiment before i can do more
comments.

Friendly,

Sven Luther

2002-12-04 22:05:34

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Wed, 2002-12-04 at 21:47, Sven Luther wrote:
> > > So there is no common zqy of doing this, my docs say something about a
> > > vga control register zhich is accesses trough the sequencer regs. Does
> > > vgafb (or textmode or whatever) not call this when giving the hand to
> > > the fbdev ?
> > No, when a video card goes to graphics mode, it's up to the driver to
> > program the registers. vgacon/vga16fb only touches the standard VGA
>
> So we will have a repeat of the exact same code snipplet in all the
> drivers ? I thought the new API was about having all the common code in
> common and not duplicated in all the drivers. Could we have at least a
> gen_disable_vga function or something such that we could call ?

Not exactly. Different hardware programs those registers differently.
Ie, vga will probably program the crtc regs for 640x400@60. Your
hardware can probably do better than that. So the code cannot be
shared. However, saving and restoring the standard VGA regs can be
common.

>
> > registers (crtc[25], attr[21], seq[5], gfx[9], misc[1]). Usage is pretty
>
> Well, i need to disable the vga output in seq[5], more exactly bit 3
> called "enable VGA display", need to be reset.
>
[...]
>
> Err, it is seq[5], called VGAControlRegister, so it is beyond the
> standard seq registers (seq[0] to seq[5]), right ?

I meant seq[0] to seq[4] are standard VGA regs. So seq[5] is extended.
It's VGAControlRegister in your hardware, it's not used in mine.

>
[...]
> > > Mmm, what about interaction with X ? X also does a save/restore of the
> > > previous (text) mode, when a X driver is _not_ fbdev aware, it will
> > > save/restore the things twice, right ?
> > >
> > Not twice just the current mode it was in when X launched, although it
> > always assumes text mode. Same thing for fbdev, it should only restore
>
> Well, but fbdev will save its state and X will save it again, so the
> saving done in the X driver is not all that important, and i could
> ignore it at first if i already have an fbdev.

If X is running in native mode then it has to save the register state.
Otherwise you cannot switch to a console. If X is running on top of
fbdev, then state restore/saves are done using fb_set_var and
fb_get_var. The registers are not touched, that's the purpose of fbdev.

If you are running vgacon, fbdev, and native X, then yes, fbdev and X
has to do a save of their initial state.

>
> Does this also apply to vesafb ?
Not too sure about this. vesa requires real-mode initialization. Either
you do this at boot time, or fake a real-mode environment like what X
does.

>
> > the state when reference count becomes zero. If the framebuffer console
> > is loaded, the reference count will never be zero unless it is
> > unloaded. If the framebuffer console is not loaded, the only time you
> > will save and restore the state is when some fb-based application
> > attempts to open/close /dev/fbx.
>
> Ok, ...
>
[...]

Tony

2002-12-04 22:45:27

by James Simmons

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port


> Here's a preliminary and highly unpolished patch for saving and
> restoring the initial vga state.

Totally awesome!!! About a year ago I also manged to do this while working
on the ruby linuxconsole project. I'm glad to see it resurrected again!!!!
Looking at the code I see both of us have the same ideas.

MS: (n) 1. A debilitating and surprisingly widespread affliction that
renders the sufferer barely able to perform the simplest task. 2. A disease.

James Simmons [[email protected]] ____/|
fbdev/console/gfx developer \ o.O|
http://www.linux-fbdev.org =(_)=
http://linuxgfx.sourceforge.net U
http://linuxconsole.sourceforge.net

2002-12-05 17:29:28

by James Simmons

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port


> If X is running in native mode then it has to save the register state.
> Otherwise you cannot switch to a console. If X is running on top of
> fbdev, then state restore/saves are done using fb_set_var and
> fb_get_var. The registers are not touched, that's the purpose of fbdev.
>
> If you are running vgacon, fbdev, and native X, then yes, fbdev and X
> has to do a save of their initial state.

Not really. When X closes /dev/fb then fb_release is called which if the
driver supports it will switch back to text mode. The exception is
firmware based fbdev drivers like vesafb and offb.

> > Does this also apply to vesafb ?
> Not too sure about this. vesa requires real-mode initialization. Either
> you do this at boot time, or fake a real-mode environment like what X
> does.

X has to reset the vidoe hardware back to the state that matches what the
VESA mode was. Other wise it will mess you your system.

P.S

X on VESA fb always foobars my system when I exit X.


2002-12-05 17:56:55

by Sven Luther

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Thu, Dec 05, 2002 at 05:35:56PM +0000, James Simmons wrote:
>
> > If X is running in native mode then it has to save the register state.
> > Otherwise you cannot switch to a console. If X is running on top of
> > fbdev, then state restore/saves are done using fb_set_var and
> > fb_get_var. The registers are not touched, that's the purpose of fbdev.
> >
> > If you are running vgacon, fbdev, and native X, then yes, fbdev and X
> > has to do a save of their initial state.
>
> Not really. When X closes /dev/fb then fb_release is called which if the

That supposes X is fbdev aware (either using the fbdev driver or the
UseFBDev option), right ? What if X knows nothing about fbdev, it will
try restoring stuff as if it was in text mode.

> driver supports it will switch back to text mode. The exception is
> firmware based fbdev drivers like vesafb and offb.
>
> > > Does this also apply to vesafb ?
> > Not too sure about this. vesa requires real-mode initialization. Either
> > you do this at boot time, or fake a real-mode environment like what X
> > does.
>
> X has to reset the vidoe hardware back to the state that matches what the
> VESA mode was. Other wise it will mess you your system.
>
> P.S
>
> X on VESA fb always foobars my system when I exit X.

With which driver ? (i am happily running the vesa X driver on top of
vesafb without problems).

Friendly,

Sven Luther

2002-12-05 20:29:40

by James Simmons

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port


> > Not really. When X closes /dev/fb then fb_release is called which if the
>
> That supposes X is fbdev aware (either using the fbdev driver or the
> UseFBDev option), right ? What if X knows nothing about fbdev, it will
> try restoring stuff as if it was in text mode.

That is what X will try.

> > X on VESA fb always foobars my system when I exit X.
>
> With which driver ? (i am happily running the vesa X driver on top of
> vesafb without problems).

G400 X server 4.0.2 ontop of VESA framebuffer.


2002-12-05 20:38:16

by Sven Luther

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Thu, Dec 05, 2002 at 08:37:08PM +0000, James Simmons wrote:
>
> > > Not really. When X closes /dev/fb then fb_release is called which if the
> >
> > That supposes X is fbdev aware (either using the fbdev driver or the
> > UseFBDev option), right ? What if X knows nothing about fbdev, it will
> > try restoring stuff as if it was in text mode.
>
> That is what X will try.

Mmm, is it enough for X to just save/restore the registers it modifies ?

Also, i suppose if i am comming from fbdev, what X saves or restores
does not really count, since fbdev knows what relevant thing to save.

Still i sense that there may be some issues involved here, especially
if you switch from text mode to fbdev or between fbdevs while not in X.

> > > X on VESA fb always foobars my system when I exit X.
> >
> > With which driver ? (i am happily running the vesa X driver on top of
> > vesafb without problems).
>
> G400 X server 4.0.2 ontop of VESA framebuffer.

And i suppose the VESA driver will work, right ?

Friendly,

Sven Luther

2002-12-05 22:39:00

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

On Fri, 2002-12-06 at 01:44, Sven Luther wrote:
> On Thu, Dec 05, 2002 at 08:37:08PM +0000, James Simmons wrote:
> >
> > > > Not really. When X closes /dev/fb then fb_release is called which if the
> > >
> > > That supposes X is fbdev aware (either using the fbdev driver or the
> > > UseFBDev option), right ? What if X knows nothing about fbdev, it will
> > > try restoring stuff as if it was in text mode.
> >
> > That is what X will try.
>
> Mmm, is it enough for X to just save/restore the registers it modifies ?
>
Life will be easy if native X does that always. However, it does not
always restore all the registers it modifies. Common example, the cursor
registers. If fbdev is also using a hardware cursor, you will see X's
cursor replacing your console's block cursor when switching from X to
the console.

Some ATI cards freezes the system when native X and fbdev are running
concurrently.

James,

Without the set_var hook 2.5 as is in 2.4, this will become more of a
problem. Most drivers in 2.4 refreshes their registers during set_var.

> Also, i suppose if i am comming from fbdev, what X saves or restores
> does not really count, since fbdev knows what relevant thing to save.

Yes, the same thing too if the X driver supports Option "Usefbdev". Instead
of restoring the hardware registers, X (or XFBdev) will call fb_set_var
to restore fbcon's state.

>
> Still i sense that there may be some issues involved here, especially
> if you switch from text mode to fbdev or between fbdevs while not in X.
>

State saves and restores are pertinent only for state changes within a single card.
Ie, the state of the vga core and the graphics state. Thus, this is relevant to
vgacon, vga16fb, the native fbdev driver, and of course X since all can coexist
in one card. I have already run vgacon, vga16fb and native fbdev simultaneously
already. Fortunately, the X driver was nice too, so I was able to run X also.

In multiple fbdev's with each on it's own hardware, this does not matter since
the state of the other hopefully does not affect the other. The only problem I can think
of is that one card is the primary (thus with an active vga core) and the others are
non primary (thus with an inactive vga core). If the non-primary drivers are not
careful, they may attempt to save/restore the VGA state that they have no business of
knowing. There can be several solutions to this:

1. There is probably a flag somewhere that says that the hardware's vga core is
inactive, and if so, do not attempt to save/restore the state..

2. Most hardware with a vga core most probably has the VGA registers memory mapped.
If this is the case, all it needs to do is fill up fb_vgastate.vgabase, and the
save/restore module will instead do mmio instead of pio, leaving the actual VGA registers
untouched.

Tony


2002-12-06 00:43:27

by James Simmons

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port


> > G400 X server 4.0.2 ontop of VESA framebuffer.
>
> And i suppose the VESA driver will work, right ?

I haven't tried it but I assume it does.