public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* my opinion about VGA devices
@ 2004-10-19 22:10 Tomas Carnecky
  2004-10-20 11:18 ` Oliver Neukum
  2004-10-20 17:27 ` Kendall Bennett
  0 siblings, 2 replies; 15+ messages in thread
From: Tomas Carnecky @ 2004-10-19 22:10 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hi folks,

I've followed the discussion about the console code restructuring and 
framebuffer devices (Generic VESA framebuffer driver and Video card 
BOOT) and I'd like to present here my opinion.

That's how I think the device drivers should look like:

A graphics device driver consists of two parts, a kernel module and a 
user-space library which are together the 'driver'. Only the user-space 
library knows how to operate the device so there is no access to the 
graphics device from the kernel.
The kernel module creates a character device which can be opened by any 
application with the appropriate rights. The kernel module also 
registeres the device to the kernel so the kernel knows which graphics 
cards are present and their basic information (vendor, name etc.).
Since the kernel has no access to the device, no messages or text can be 
displayed from the kernel, which I think is quite bad during 
startup/boot, that's why the kernel module also provides a function for 
displaying text. However, you don't want the kernel to draw text 
messages to the display while you play doom3 :) , that's why this 
drawing can be disabled (by init or somewhere in the early userspace 
initialization).
An application which want's to use the device opens the character device 
and gets the name of the user-space library (user-space driver part) and 
loads it. The library has a set of functions (API) which can be used to 
access the device. BTW, the user-space library API is OpenGL.
How the kernel and user-space driver part communicate is up to them (or 
the programmer). There are no restrictions what to put into user-space 
or kernel-space, may the device driver writer decide this. And there are 
only two interfaces: one in the kernel (text drawing) and one in the 
user-space (OpenGL), nothing between. So the driver can be optimized for 
each specific chip, because each chip is different and is meant to be 
accessed differently.

I don't like the framebuffer devices or even the DRI drivers because:
most applications use a 'high-level' API for rendering (OpenGL). These 
'high-level commands' are translated to 'intermediate commands' 
(framebuffer/DRI ioctl calls etc.) before being send to the card as 
'low-level commands'. Why this intermediate layer?
Even if the high-level and intermediate commands are similar and you 
don't loose much doing the translation (DRI), it is one too much. When 
working with music you try to encode/decode your song as few times as 
possible. because you loose quality each time (and it takes time). The 
same applies to graphics commands, even if you might not loose quality 
(I hope), but it is just unnecessary.

Maybe you have noticed that I haven't used 'VGA' even once, that's 
because I don't think in terms 'VGA device'. I think in terms 'graphics 
device' that's a device which can be used to display 'stuff' on a screen 
and I don't care about how it is done, whether using VGA or the card is 
in 3D mode and is accessed differently (preferably VGA isn't used at all 
for graphics access). The VGA specific problems should be solved on a 
lower level, I have the impression that the VGA peoblems are among the 
biggest in the world when reading this list. By lower level I mean that 
if a driver uses VGA to access the device, it should coordinate with 
other VGA devices using a small block in the kernel but it should not be 
  any major part of the kernel.

I think this would make the suspend/resume/access/switching etc problems 
much easier to solve since the kernel module could tell the library to 
stop drawing/accessing mmap'ed memory etc. (or if the OpenGL rendering 
is done in the kernel module it could just discard the render commands).
Since the user has no direct access to mmap'ed memory and other critical 
sections of the device, the driver can implement proper power managment 
for suspend/resume etc.

Well... that's it.. any comments? I'm sure you have.. :)

-- 
wereHamster a.k.a. Tom Carnecky   Emmen, Switzerland

(GC 3.1) GIT d+ s+: a--- C++ UL++ P L++ E- W++ N++ !o !K  w ?O ?M
           ?V PS PE ?Y PGP t ?5 X R- tv b+ ?DI D+ G++ e-- h! !r !y+

^ permalink raw reply	[flat|nested] 15+ messages in thread
* my opinion about VGA devices
@ 2004-10-19 18:51 Tomas Carnecky
  2004-10-23 16:11 ` Blizbor
  0 siblings, 1 reply; 15+ messages in thread
From: Tomas Carnecky @ 2004-10-19 18:51 UTC (permalink / raw)
  To: linux-kernel

Hi folks,

I've followed the discussion about the console code restructuring and 
framebuffer devices (Generic VESA framebuffer driver and Video card 
BOOT) and I'd like to present here my opinion.

That's how I think the device drivers should look like:

A graphics device driver consists of two parts, a kernel module and a 
user-space library which are together the 'driver'. Only the user-space 
library knows how to operate the device so there is no access to the 
graphics device from the kernel.
The kernel module creates a character device which can be opened by any 
application with the appropriate rights. The kernel module also 
registeres the device to the kernel so the kernel knows which graphics 
cards are present and their basic information (vendor, name etc.).
Since the kernel has no access to the device, no messages or text can be 
displayed from the kernel, which I think is quite bad during 
startup/boot, that's why the kernel module also provides a function for 
displaying text. However, you don't want the kernel to draw text 
messages to the display while you play doom3 :), that's why this drawing 
can be disabled (by init or somewhere in the early userspace 
initialization).
An application which want's to use the device opens the character device 
and gets the name of the user-space library (user-space driver part) and 
loads it. The library has a set of functions (API) which can be used to 
access the device. BTW, the user-space library API is OpenGL.
How the kernel and user-space driver part communicate is up to them (or 
the programmer). There are no restrictions what to put into user-space 
or kernel-space, may the device driver writer decide this. And there are 
only two interfaces: one in the kernel (text drawing) and one in the 
user-space (OpenGL), nothing between. So the driver can be optimized for 
each specific chip, because each chip is different and is meant to be 
accessed differently.

I don't like the framebuffer devices or even the DRI drivers because:
most applications use a 'high-level' API for rendering (OpenGL). These 
'high-level commands' are translated to 'intermediate commands' 
(framebuffer/DRI ioctl calls etc.) before being send to the card as 
'low-level commands'. Why this intermediate layer?
Even if the high-level and intermediate commands are similar and you 
don't loose much doing the translation (DRI), it is one too much. When 
working with music you try to encode/decode your song as few times as 
possible. because you loose quality each time (and it takes time). The 
same applies to graphics commands, even if you might not loose quality 
(I hope), but it is just unnecessary.

Maybe you have noticed that I haven't used 'VGA' even once, that's 
because I don't think in terms 'VGA device'. I think in terms 'graphics 
device' that's a device which can be used to display 'stuff' on a screen 
and I don't care about how it is done, whether using VGA or the card is 
in 3D mode and is accessed differently (preferably VGA isn't used at all 
for graphics access). The VGA specific problems should be solved on a 
lower level, I have the impression that the VGA peoblems are among the 
biggest in the world when reading this list. By lower level I mean that 
if a driver uses VGA to access the device, it should coordinate with 
other VGA devices using a small block in the kernel but it should not be 
  any major part of the kernel.

I think this would make the suspend/resume/access/switching etc problems 
much easier to solve since the kernel module could tell the library to 
stop drawing/accessing mmap'ed memory etc. (or if the OpenGL rendering 
is done in the kernel module it could just discard the render commands).
Since the user has no direct access to mmap'ed memory and other critical 
sections of the device, the driver can implement proper power managment 
for suspend/resume etc.

Well... that's it.. any comments? I'm sure you have.. :)

-- 
wereHamster a.k.a. Tom Carnecky   Emmen, Switzerland

(GC 3.1) GIT d+ s+: a--- C++ UL++ P L++ E- W++ N++ !o !K  w ?O ?M
           ?V PS PE ?Y PGP t ?5 X R- tv b+ ?DI D+ G++ e-- h! !r !y+

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2004-10-23 16:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-19 22:10 my opinion about VGA devices Tomas Carnecky
2004-10-20 11:18 ` Oliver Neukum
2004-10-20 12:31   ` Tomas Carnecky
2004-10-20 12:56     ` Richard B. Johnson
2004-10-20 14:14       ` Tomas Carnecky
2004-10-20 14:34         ` Richard B. Johnson
2004-10-20 15:01           ` Tomas Carnecky
2004-10-20 16:58             ` Matthew Garrett
     [not found]             ` <4178F276.2040501@globalintech.pl>
2004-10-22 11:58               ` Tomas carnecky
2004-10-22 19:13         ` Geert Uytterhoeven
2004-10-20 20:16     ` Oliver Neukum
2004-10-20 17:27 ` Kendall Bennett
2004-10-22  8:29   ` Helge Hafting
  -- strict thread matches above, loose matches on Subject: below --
2004-10-19 18:51 Tomas Carnecky
2004-10-23 16:11 ` Blizbor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox