Re: XShmPixmap for GdkPixmap



On Wed, 2007-05-23 at 14:40 -0400, Owen Taylor wrote:
> On Wed, 2007-05-23 at 12:20 -0400, Tristan Van Berkom wrote:
> 
> > I'm currently considering a hack where I will simply do:
> >      - load pixbuf
> >      - put the pixbuf in a GdkImage (GdkImage already uses XShmPixmap)
> >      - use gdk_pixmap_foreign_new() on _gdk_x11_image_get_shm_pixmap()
> > 
> > When it struck me, would it not be a good thing if all GdkPixmaps used
> > XShmPixmap where possible ? (i.e. server extention available && running
> > locally)
> 
> No:
> 

Thanks for enlightening me owen...

>  A) Shared memory is a limited resource, though less so these days
>     (Solaris used to have really low per-process and system limits)
>  B) There is a lot of overhead setting up a shared memory segment 

I wasnt aware of this point...

>  C) Many, many pixmaps are created temporarily for only a few
>     drawing operations.

In light of B, obviously a bad idea to make all GdkPixmaps XShmPixmap...

>  D) Shared pixmaps can't be put into video card memory, so drawing
>     to them is never accelerated.
>  E) If you use shmpixmaps *shared*, the synchronization can be more
>     costly then the performance gain.
> 
> It would probably make sense to have a way of creating a GdkImage /
> GdkPixmap pair as a might-fail operation; it's particularly useful
> for fetching data *from* the server, for one thing, and sometimes
> you have a good reason for wanting to keep a pixmap out of video
> memory.
> 
> Probably should even be cross-platform since the same thing makes
> sense on Windows.

Something like this ?

GdkPixmap *
gdk_pixmap_new_shared (GdkDrawable *drawable,
			gint         width,
			gint         height,
			gint         depth,
			GdkImage   **image_ret)

This way one could be specific about when using an XShmPixmap
suits thier need, which is good enough for me.

Cheers,
                -Tristan





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]