LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-12-2013, 04:04 PM   #16
niagr
LQ Newbie
 
Registered: Jun 2012
Location: Calcutta, India
Distribution: Linux Mint 13, elementaryOS
Posts: 9

Rep: Reputation: Disabled

Thanks for your replies

If I understand correctly, if a window chooses direct rendering, the X server just does not bother itself about rendering that window and the GL implementation makes sure that the graphics card displays the direct-rendered contents of the window in the right area of the screen in the card specific way. The X server does not need to render the whole screen and can skip the parts that are being rendered directly. Is that correct?


Quote:
When running a composited window manager (and the window is redirected), X doesn't handle the display of windows, and the "compositor" has that job. The detail is left up to the compositor, but most compositors use OpenGL themselves, which has an extension "texture_from_pixmap" which allows you to take an X window and make a GL texture from it, allowing you to paint it. Positioning of windows has to be handled by the compositor.
If the window contents are internal to the graphics card, how does the X server pass a pixmap to be converted into the GL texture?
 
Old 04-12-2013, 04:52 PM   #17
_Jasper
LQ Newbie
 
Registered: Apr 2013
Posts: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by niagr View Post
Thanks for your replies
If I understand correctly, if a window chooses direct rendering, the X server just does not bother itself about rendering that window and the GL implementation makes sure that the graphics card displays the direct-rendered contents of the window in the right area of the screen in the card specific way. The X server does not need to render the whole screen and can skip the parts that are being rendered directly. Is that correct?
That's accurate, yes.

Quote:
Originally Posted by niagr View Post
If the window contents are internal to the graphics card, how does the X server pass a pixmap to be converted into the GL texture?
First of all, a Pixmap, as we care about it, is just a handle to some memory somewhere. The Pixmap ID could be "5", and the X server knows that the graphics card has the memory for "Pixmap 5". So, with that out of the way...

The X server doesn't pass any pixmap to anything. I'll try to explain it a bit more clear, as your question doesn't really make sense. The idea here is that a compositing manager will want to render the all of the windows in fancy ways. They can be direct rendering clients or core X clients; it doesn't matter. The first step is that it uses XCompositeNameWindowPixmap to get a Pixmap for the backing store of the window. Again, the window manager doesn't really have anything other than a number.

Now that you have a Pixmap, you can do anything you want with it. You can use XReadImage to get the Pixmap contents (which might indeed require pulling it back from GPU memory), but that's really slow, so it shouldn't do that.

To draw the Pixmap, it could use XCopyArea, as has been done since the beginning of time. However, if the compositing manager uses OpenGL, it can use the OpenGL extension texture_from_pixmap, which takes the Pixmap ID and gives you back a similarly arbitrary Texture ID that you can then pass to OpenGL through glBindTexture.

It's extremely likely that the two will use the exact same backing memory in the GPU card, because it makes sense to. It doesn't have to do any copy. Note that on older systems with indirect rendering, there had to be a copy, since there were no smarts there. AIGLX, as I mentioned in the blog post, was a transitionary hack to run software GL, so that the system could access main memory, and there wouldn't have to be a copy.

Now that we have the DRM infrastructure around, there's no need for any of this.
 
Old 04-12-2013, 05:11 PM   #18
niagr
LQ Newbie
 
Registered: Jun 2012
Location: Calcutta, India
Distribution: Linux Mint 13, elementaryOS
Posts: 9

Rep: Reputation: Disabled
Thank you, that is a wonderful explanation. It's all beginning to make some sense now. I would never have thought that a graphics stack would be so complex. Out of curiosity, how did you come by such detailed knowledge of the stack; I couldn't find such information documented anywhere.
 
Old 04-12-2013, 05:20 PM   #19
_Jasper
LQ Newbie
 
Registered: Apr 2013
Posts: 4

Rep: Reputation: Disabled
I asked the right people at the right time, I know what questions to ask, and I know how to read documentation, sort of. When I was writing an earlier reply, I didn't quite remember what /usr/lib/libdrm_intel.so and /usr/lib/dri/i915.so were specifically, so I asked the right people (the answers are "a useless library that just has some wrappers for ioctls", and "the card-specific mesa implementation", respectively)

I also work on mutter / GNOME Shell, so I'm very familiar with the internals of how a compositing window manager works. I'm still learning new things every day, though -- this is the work of thousands of developers distributed across 30-40 years, so every little tiny eldritch hack and piece of cleverness is stuck with us in history forever, and a man can't expect to learn it in a month.

The good news is that after some basic ideas "snap", you can finally go back to that overly complex documentation that perplexed you when you last read it, and now you understand everything, and now you're starting to pick up all this stuff at a much higher pace.
 
Old 04-12-2013, 05:26 PM   #20
niagr
LQ Newbie
 
Registered: Jun 2012
Location: Calcutta, India
Distribution: Linux Mint 13, elementaryOS
Posts: 9

Rep: Reputation: Disabled
It's very encouraging to see people sharing their knowledge like in this thread. Perhaps when I gain a deeper understanding I'll write some articles to help out other newbies like myself
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The Linux Graphics Driver Stack Remains Insecure LXer Syndicated Linux News 0 02-02-2013 08:03 PM
LXer: Raspberry Pi's Nonchalant Graphics Stack For Linux LXer Syndicated Linux News 0 02-01-2012 05:20 PM
LXer: An Open-Source Mobile Linux Graphics Stack? LXer Syndicated Linux News 0 08-20-2011 07:27 PM
LXer: The Linux graphics stack from X to Wayland LXer Syndicated Linux News 0 03-22-2011 11:21 AM
LXer: Cleaning Up The Linux Graphics Driver Stack LXer Syndicated Linux News 0 02-07-2010 06:21 PM


All times are GMT -5. The time now is 12:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration