Linked by Thom Holwerda on Sat 28th Jun 2008 22:09 UTC, submitted by diegocg
X11, Window Managers "Maybe I'm just naive, but designing a graphics API such that all image data had to be sent over a socket to another process every time the image needed to be drawn seems like complete idiocy. Unfortunately, that is precisely what the X Window System forces a program to do, and exactly what Cairo does when drawing images in Linux - a full copy of the image data, send to another process, no less, every time it is drawn. One would think there would be some room for improvement. Unsurprisingly, others felt the same way about X, and decided to write an extension, Xlib Shm or XShm for short, that allows images to placed in a shared memory segment from which the X server reads which allows the program to avoid the memory copy. GTK already makes use of the XShm extension, and it seems like a good idea to see if Gecko couldn't do the same."
Thread beginning with comment 320934
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[3]: Exaggerating
by fernandotcl on Wed 2nd Jul 2008 03:58 UTC in reply to "RE[2]: Exaggerating"
Member since:

There's an additional big problem with sockets: Once you send the image to the server, the client can't "share" it, because it's living in the server's address space. So you have a copy of the image on the server AND exactly the same copy of the image on the client. The image is effectively using 2x its size in the memory. The "right fix" for this stupid waste of resources is to free() the image on the client. With shared memory, you can SHARE the image's memory between the client and the process.

The client can't share it? Wtf? Once you send it, it's gone? Have you EVER dealt with sockets at all?

It's not a big deal having it in memory twice. That certainly is not a bottleneck for 99% of all X apps out there nowadays.

The "right fix"... OMG...

Reply Parent Score: 1