hello,ask about openGL,X,device drivers, questions

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
yestalk
Posts: 5
Joined: Mon May 04, 2009 2:24 am

hello,ask about openGL,X,device drivers, questions

Post by yestalk »

i have read that OpenGL is a collection of draw functions
------- if card vender implemented OpenGL,the driver they offered have all the OpenGL functions,some of those fnctions can accelerate by hardware.

on linux the X window System is an userspace program which means it is not a device driver

and,in the linux kernel view,treat all the device as "file" or "file can mounted"
------- mount
------- read
------- write
------- ioctrl
------- remove

the X System can build on OpenGL
------- does this means OpenGL functions are userspace API
------- and the task of videoCard driver of Linux system is convert all the OpenGL APIs to linux drivers read,write,ioctrl ,and introducing device special meaning of code to read,write,ioctrl implemention?

------- and X system cooperate with several deive such like usb(when plug,there have graphic notifications),mouse,keyboard,gameConsole
------- ------- so what does the kernel do with those device?
------- ------- i am confuse with the X and the kernel functions,dose the are two systems control some devices respectively?

thanks very much for details.
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: hello,ask about openGL,X,device drivers, questions

Post by DeletedAccount »

Hi,
Absolute rubbish , do your reading first .


Regards
Shrek
yestalk
Posts: 5
Joined: Mon May 04, 2009 2:24 am

Re: hello,ask about openGL,X,device drivers, questions

Post by yestalk »

yes, but can't understand very much.
yestalk
Posts: 5
Joined: Mon May 04, 2009 2:24 am

Re: hello,ask about openGL,X,device drivers, questions

Post by yestalk »

does some can answer more front way?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: hello,ask about openGL,X,device drivers, questions

Post by JamesM »

Hi,

One of the numerous flaws in your logic is that a userspace program cannot also have a driver component. X.org does have a driver component, and it is this that communicates with the card. How X communicates with the driver is implementation dependent.

As Shrek said - do your reading first.

Cheers,

James
yestalk
Posts: 5
Joined: Mon May 04, 2009 2:24 am

Re: hello,ask about openGL,X,device drivers, questions

Post by yestalk »

at least give me some thing to read, do you mean read the source code?

you know a lot of book start with "hello world" or "not hello world"... i definitely read a lot,but alway block at some place. and can't find what i want to know more clear.

------- and the task of videoCard driver of Linux system is convert all the OpenGL APIs to linux drivers read,write,ioctrl ,and introducing device special meaning of code to the implemention of read,write,ioctrl ?

----so i don't know if i have right expression in english above,and i can ask other way:
--------------does the driver of graphic card implement the OpenGL API or read,write,ioctrl or both of them?
----------------------------whether the implemention of OpenGL API invoke the (read ,write of card driver) or the card dirver's read() write() invoke the OpenGL API? does they invoke each other both to let things more interesting?

i have wake c knowledge, but as programer,i do think that "userspace program can also have a driver component",but i think that those component would like to talk with the hard device that must also be the kernel's component,write according to kernel's specification.
that means ,with out X, we can also draw some thing on the screen, and receive the mouse event(may be not event)...

X just a request/response framework, to know how to implment a simple gui system well easy porting the gui system's features to the X features.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: hello,ask about openGL,X,device drivers, questions

Post by JamesM »

yestalk wrote:but i think that those component would like to talk with the hard device that must also be the kernel's component,write according to kernel's specification.
that means ,with out X, we can also draw some thing on the screen, and receive the mouse event(may be not event)...
There again, you're making a false assumption. The linux kernel has a framebuffer driver. It has no acceleration, no nothing. The X server provides the drivers for hardware-accelerated graphics. Thus, you can draw to the screen without X, but it won't be anywhere near as fast.
skyking
Member
Member
Posts: 174
Joined: Sun Jan 06, 2008 8:41 am

Re: hello,ask about openGL,X,device drivers, questions

Post by skyking »

JamesM wrote:
yestalk wrote:but i think that those component would like to talk with the hard device that must also be the kernel's component,write according to kernel's specification.
that means ,with out X, we can also draw some thing on the screen, and receive the mouse event(may be not event)...
There again, you're making a false assumption. The linux kernel has a framebuffer driver. It has no acceleration, no nothing. The X server provides the drivers for hardware-accelerated graphics. Thus, you can draw to the screen without X, but it won't be anywhere near as fast.
No, what X can do in user space anyone can do (as long as they can run as the same user) unless I've missed something fundamental.

Unless things has changed a user process cannot do direct I/O writes, but has to go vi the kernel to perform these (probably via a kernel module that provides the required interface).
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: hello,ask about openGL,X,device drivers, questions

Post by JamesM »

skyking wrote:
JamesM wrote:
yestalk wrote:but i think that those component would like to talk with the hard device that must also be the kernel's component,write according to kernel's specification.
that means ,with out X, we can also draw some thing on the screen, and receive the mouse event(may be not event)...
There again, you're making a false assumption. The linux kernel has a framebuffer driver. It has no acceleration, no nothing. The X server provides the drivers for hardware-accelerated graphics. Thus, you can draw to the screen without X, but it won't be anywhere near as fast.
No, what X can do in user space anyone can do (as long as they can run as the same user) unless I've missed something fundamental.

Unless things has changed a user process cannot do direct I/O writes, but has to go vi the kernel to perform these (probably via a kernel module that provides the required interface).
Exactly, if you'll read my original reply you'll see that I said X.org provides kernel-mode drivers itself. (Most of) the drivers come with X.org and reside in its repository.
skyking
Member
Member
Posts: 174
Joined: Sun Jan 06, 2008 8:41 am

Re: hello,ask about openGL,X,device drivers, questions

Post by skyking »

Well it doesn't look like there is any kernel modules from what I've seen. It more looks like the Xserver uses mmap to get access to the video hw memory, which is quite reasonable since they would not want to need to write and maintain the actual driver in kernel space for all card+kernel combos.
yestalk
Posts: 5
Joined: Mon May 04, 2009 2:24 am

Re: hello,ask about openGL,X,device drivers, questions

Post by yestalk »

well,so card vender's driver would be provided by modules ? just implement those load() remove() read() write() ioctrl() satisfaction?

does that mean X can't not utilize the vender provided "well form linux driver" ? or vedio dirver have another driver interface in kernel ?

without knowledge, i can only try to assumption:

X compliance app............................other user sapce app
....|....window talk.............................|
....|....event talk...............................|
....|................................................|
....|................................................|
X System.........................................|
....|-----another X implemention------>.......|
....| graphic in memory........................|
direct i/o....................................OpenGL APIs :drawline() drawothers() drawothers2()....
....|....................................................................|...............|................|
....|....................................................................|...............|................|
....|....................................................................--------------------------------
....|...................................................................................|
....|...................................................................................|
....|..............................................................linux driver: write() iocrtl() ,read()
....|...................................................................................|
....|...................................................................................i/o
.....----------------------card memory---------------------------------------------
........................................|
........................................|
....................................screen

need experts give judge,or tell some clue to read,thanks.
Last edited by yestalk on Wed May 06, 2009 6:57 am, edited 3 times in total.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: hello,ask about openGL,X,device drivers, questions

Post by Combuster »

yestalk wrote:need experts give judge
Do your homework (and improve your english)
,or tell some clue to read,thanks.
Accelerated Graphic Cards
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
skyking
Member
Member
Posts: 174
Joined: Sun Jan 06, 2008 8:41 am

Re: hello,ask about openGL,X,device drivers, questions

Post by skyking »

yestalk wrote:well,so card vender's driver would be provide by module ?
Can be, but doesn't have to be.
does that mean X can't not utilize the vender provided "well form linux driver" ?
If X couldn't utilize the vendor supplied driver it wouldn't be much point in supplying the module, would it? Of course there have been vendors that got the linux support wrong, but that was probably not the intention.
or vedio dirver have another driver interface in kernel ?
Could also be the case.
X compliance app............................other user sapce app
....|....window talk.............................|
....|....event talk...............................|
....|................................................|
....|................................................|
X System.........................................|
....|-----another X implemention------>.......|
....| graphic in memory........................|
direct i/o....................................OpenGL APIs :drawline() drawothers() drawothers2()....
....|....................................................................| | |
....|....................................................................| | |
....|....................................................................------------------------
....|...................................................................................|
....|...................................................................................|
....|..............................................................linux driver: write() iocrtl() ,read()
....|...................................................................................|
....|...................................................................................i/o
.....----------------------card memory---------------------------
........................................|
........................................|
....................................screen
No, OpenGL API is a set of function called by the client program. Have you even tried to use OpenGL? What happens in the lower layers are by the design of the API quite much up to the implementation, the execution of the OpenGL commands can happen anywhere between (and including) the executable (application), down to the graphics card hardware (and all doesn't have to happen at the same place). Hopefully the graphics appear on the screen in the end...
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: hello,ask about openGL,X,device drivers, questions

Post by JamesM »

skyking wrote:Well it doesn't look like there is any kernel modules from what I've seen. It more looks like the Xserver uses mmap to get access to the video hw memory, which is quite reasonable since they would not want to need to write and maintain the actual driver in kernel space for all card+kernel combos.
Mindlessly hypothesizing, much?
skyking
Member
Member
Posts: 174
Joined: Sun Jan 06, 2008 8:41 am

Re: hello,ask about openGL,X,device drivers, questions

Post by skyking »

JamesM wrote:
skyking wrote:Well it doesn't look like there is any kernel modules from what I've seen. It more looks like the Xserver uses mmap to get access to the video hw memory, which is quite reasonable since they would not want to need to write and maintain the actual driver in kernel space for all card+kernel combos.
Mindlessly hypothesizing, much?
Which of these is a kernel module? I unpacked one and it don't look like a kernel module, it does not contain the init_module function for one thing. The drivers in my installed xserver they look like a shared object, while linux kernel modules does not.
Post Reply