How Compiz gets Pixmap data?

Asked by Alfred Chen

Recently I am studying window manager like compiz and I am quite new in this area.
Does anyone know how compiz gets the pixmap data generated by XServer? They should be two different process(Compiz, Xorg), so only some kind of IPC can achieve that, right? Does that use shared memory?
Thanks!!
Alfred

Question information

Language:
English Edit question
Status:
Solved
For:
Compiz Edit question
Assignee:
No assignee Edit question
Solved by:
Micheal Hsu
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Micheal Hsu (mkhu) said :
#1

I'm not aware that compiz has ever "gets pixmap data." in its code.

 if you really want to "get the pixmap data generated by XServer", you can use core protocol requests GetImage (which use XYPixmap or ZPixmap format) and some shm magic (from MIT-SHM extension). it's much simpler if you use cairo and gdk for that task.

Pixmaps and Windows xids are just resource handles that server passes to clients to reference resources created by X server. most of the time, there's no need to get the pixmap or window data from server side to client for further processing, except that you're writing a screenshot program or something like recordmydesktop.

XComposite extension is used to get an off-screen pixmap of a window. compiz use opengl GLX_EXT_texture_from_pixmap extension to bind this pixmap to an opengl texture. this is how the compiz window effects works.

understanding modern X compositing window managers can be perplexing for the uninitiated.
if you want to understand how compiz works, i suggest you start with two simple programs
1. twm
the venerable X window manager. it's not a compositing manager. it's mainly comforms to Inter-Client Communication Conventions Manual (ICCCM). the code is quite simple and you can get a general idea of how a X window manager works.
e.g. how window decorations is created .etc.

2. xcompmgr
the simple demo X compositing manager. you'll come across some compositing manager concepts. client-side, server-side shadows, .etc. most importantly, it's a demo for the XComposite extension.

modern X window managers is a hybrid combination of a compositing manager and a traditional window manager.
compiz is unique in that it delegates its window decoration functionality to a separate program called decorator.

Revision history for this message
Alfred Chen (adios737) said :
#2

Thanks for your detailed answer! A follow-up question: so can I say X server is the one who did the actual window compositing, and compiz is just the one with window metadata and send compositing instructions to X server?
Alfred

Revision history for this message
Alfred Chen (adios737) said :
#3

another follow-up questions is posted above.

Revision history for this message
Micheal Hsu (mkhu) said :
#4

x server manages your graphics and input devices. it receives requests from client applications and do the actual hard work. it also sends device or window events to the interested clients. (note for DRI clients, clients doesn't need to issue requests to draw
on the window, it can draws directly into the server-allocated buffer).

in X, the window is a X server concept, so X server must keep track of its size, location, visual and other infomation. a compositor
also needs to be aware of the window attributes in order to composite all the windows onto the screen and keep those data sync-ed with the server states.
you see, there's a data duplication and synchronization problem here. we can just combine the X server and compositor into one.
this is actually one of the things Wayland is doing.
(you can take a look at http://wayland.freedesktop.org/architecture.html
it talks about Wayland (the candidate for an overhaul of the X stuff). but it also gives a clear illustration of the traditional X.)

Revision history for this message
Alfred Chen (adios737) said :
#5

Thanks Hu Kang, that solved my question.

Revision history for this message
Alfred Chen (adios737) said :
#6

What about Mir in Ubuntu? I notice that it is a replacement for X window system. So will it use IPC to transfer Pixmap data between application and Mir?
Thank you!

Revision history for this message
Best Micheal Hsu (mkhu) said :
#7

I think this section is for Q&A. if you have other questions irrelevant to compiz, we can discuss them in email.

Revision history for this message
Alfred Chen (adios737) said :
#8

Thanks Hu Kang, that solved my question.

Revision history for this message
Alfred Chen (adios737) said :
#9

So I can reach you from this email address?

On Wed, Jul 31, 2013 at 9:26 PM, Hu Kang <
<email address hidden>> wrote:

> Your question #233210 on Compiz changed:
> https://answers.launchpad.net/compiz/+question/233210
>
> Status: Open => Answered
>
> Hu Kang proposed the following answer:
> I think this section is for Q&A. if you have other questions irrelevant
> to compiz, we can discuss them in email.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/compiz/+question/233210/+confirm?answer_id=6
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/compiz/+question/233210
>
> You received this question notification because you asked the question.
>

--
Kind regards,
Qi Chen
PhD Student,
Department of Electrical Engineering and Computer Science,
University of Michigan - Ann Arbor, 48105
Tel: 1-734-834-2916
Alt. Email: <email address hidden>
Homepage: www.eecs.umich.edu/~alfchen

Revision history for this message
Micheal Hsu (mkhu) said :
#10

i'll send you an email

Revision history for this message
Alfred Chen (adios737) said :
#11

Thank you so much!!!