Closed Bug 594921 Opened 14 years ago Closed 13 years ago

Have cairo_xlib_surface support "simple self-copies" for Pixmap drawables that it doesn't own, and allow clients to "take" an owned Pixmap from a cairo_xlib_surface

Categories

(Core :: Graphics, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: cjones, Unassigned)

Details

My use case is the following

 - have a "content process" that paints web content into X surfaces (through Gecko's layers system)
 - have a "compositor process" that composites X surfaces (layers) painted by the content process and renders to screen
 - the content process paints into "back surfaces", and the compositor process composites "front surfaces".  (Each layer has a front and back surface.)
 - when the content process pushes a back-->front surface update to the compositor process, one of the following may happen in the compositor process
   (1) back/front surfaces are swapped
   (2) updated region is copied from back-->front

Re: the first part of this bug, for scrolling performance, our layers system relies on the content process being able to do simple self-copies of its back surface.  According to http://hg.mozilla.org/mozilla-central/annotate/9c5a7e114cda/gfx/thebes/gfxXlibSurface.cpp#l200 (bug 579736), which I admittedly don't understand well, cairo_xlib_surface will only do this for surfaces it creates itself (that it knows are Pixmaps).

Re: the second part of this bug, our IPC system maintains a strong single-owner model for "shared" surfaces.  Only one or the other process, not both, can read/write/destroy a surface at any given time.  We use OS-level mechanisms to make this work and enforce the ownership model for shared-memory image surfaces (POSIX and SysV shm).  This model allows us to transfer ownership of surfaces back and forth between content/compositor process.  We would like to fit Xlib surfaces into this model as well.  This entails being able to destroy an Xlib surface in a different process than the one that created it.

There are various workarounds and hacks we can employ in Gecko, but ideally I think we'd want new cairo APIs like

  /* cairo_xlib_surface can treat |pixmap| as if it were created with cairo_surface_create_similar() */
  cairo_surface_t* cairo_xlib_surface_create_for_pixmap(Display *dpy,
                                                        Pixmap pixmap,
                                                        Screen *screen,
                                                        XRenderPictFormat* format,
                                                        int width,
                                                        int height);
  /* True if the Drawable underlying this cairo_xlib_surface will be destroyed along with the cairo_xlib_surface. */
  cairo_bool_t cairo_xlib_surface_owns_drawable(void);
  /* Precondition: cairo_xlib_surface_owns_drawable() is True.  Transfers ownership of the underlying Drawable to the caller. */
  Drawable cairo_xlib_surface_take_drawable(void);

Thoughts?
Chris, I don't think we still want this, so I'm going to resolve incomplete. Please reopen if I'm wrong.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INCOMPLETE
We still want this for mulitprocess/x11/cairo/no-GL configurations, but the odds of gecko supporting that in an important product are slim and approaching none.
You need to log in before you can comment on or make changes to this bug.