[PATCH] ephyr: Properly implement hardware cursors
Adam Jackson
ajax at redhat.com
Thu Aug 21 12:50:09 PDT 2014
On Thu, 2014-08-21 at 10:07 -0500, Keith Packard wrote:
> Adam Jackson <ajax at redhat.com> writes:
>
> > Technique is basically the same as in Xnest, just create a new cursor on
> > the host server every time. Could be optimized to remember cursors on
> > the host and merely switch among them, if someone's feeling
> > adventurous.
>
> Could I convince you to add a check for ARGB cursor support on the
> target display? That's just a check for Render 0.5 or newer, and then
> falling back to the core cursor path -- DIX already computes a valid
> core cursor for you, so it's pretty easy.
0.5 corresponds to (digs) XFree86 4.2, my goodness. Sure, why not. The
failure mode would be Xephyr crashing so that seems pretty reasonable.
> > +xcb_gcontext_t
> > +hostx_get_cursor_gc(void)
> > +{
> > + uint32_t mask = XCB_GC_FUNCTION |
> > + XCB_GC_PLANE_MASK |
> > + XCB_GC_FOREGROUND |
> > + XCB_GC_BACKGROUND |
> > + XCB_GC_CLIP_MASK;
> > + uint32_t val[] = {
> > + XCB_GX_COPY, /* function */
> > + ~0, /* planemask */
> > + 1L, /* foreground */
> > + 0L, /* background */
> > + None, /* clipmask */
> > + };
> > +
> > + if (HostX.curgc == None) {
> > + xcb_pixmap_t p = xcb_generate_id(HostX.conn);
> > + HostX.curgc = xcb_generate_id(HostX.conn);
> > +
> > + xcb_create_pixmap(HostX.conn, 1, p, HostX.winroot /* XXX */,
> > + 1, 1);
> > + xcb_create_gc(HostX.conn, HostX.curgc, p, mask, val);
> > + xcb_free_pixmap(HostX.conn, p);
> > + }
> > +
> > + return HostX.curgc;
> > +}
>
> Seems like it would be a bunch shorter to just pass in a suitable pixmap
> (which you already have) than create another one here?
True, we do have to create the source/mask pixmaps already. The patch
isn't entirely symmetric though, the ARGB path makes a fresh GC every
time; caching the bitmap gc for the core case was just me mindlessly
copying Xnest. I don't have strong feelings either way I guess, but
probably I should pick one or the other.
> This does point out that the DDX doesn't get to hear about animated
> cursors. We could do this pretty easily; would that be fun here?
Meh. It'd be nice but I'm not desperate for it. The nomad branch
already made a start at that optimization, if we feel like stealing:
http://cgit.freedesktop.org/xorg/xserver/commit/?h=dmx-2&id=1d401db26613ccd24d6f218f459bf824710e7b44
http://cgit.freedesktop.org/xorg/xserver/commit/?h=dmx-2&id=700d5bf74e0264bddb55ab7394ed11e91f5ec891
> In any case, the rest of the code looks like good stuff and is
>
> Reviewed-by: Keith Packard <keithp at keithp.com>
Thanks. There's an issue or two left with it, I'll resend.
- ajax
More information about the xorg-devel
mailing list