[PATCH] Adds MIT-SHM AttachFd and CreateSegment requests

Adam Jackson ajax at nwnk.net
Thu Oct 31 22:47:36 CET 2013


On Thu, 2013-10-31 at 13:12 -0700, Keith Packard wrote:
> Passes shared memory segments by file descriptor, AttachFd passes from
> client to server, CreateSegment passes from server to client.

I was hoping for a patch to shmproto.txt, but there isn't one, le sigh.
We should really fix the MIT-SHM docs, Jon's reverse-engineered spec pdf
is full of enough handwave to be embarassing for us.

Failing that: I'm just a little cautious of calling this 1.2 without
some escape hatch for a 1.3.  ShmQueryVersion currently has a bool for
shm pixmaps precisely because they might not be supported.  Supposing
someone comes up with a comparable API for, say, win32, they'd be a bit
stuck, since the 1.3 idea of "pass a file descriptor" might not be a
thing the OS provides.  Even if we don't cotton to non-unix
environments, we might find that one or the other is just too wacky to
try to support in the future.

So maybe something like:

---
#define ShmCapCreatePixmaps (1<<0)
#define ShmCapAttachFd      (1<<1)
#define ShmCapCreateSegment (1<<2)

#define X_ShmQueryCapabilities 8

typedef struct _ShmQueryCapabilities {
    CARD8 reqType;
    CARD8 shmReqType;
    CARD16 length;
} xShmQueryCapabilitiesReq;
#define sz_xShmQueryCapabilitiesReq 4

typedef struct {
    CARD8 type;
    CARD8 pad0;
    CARD16 sequenceNumber;
    CARD32 length;
    CARD32 caps0;
    CARD32 caps1;
    CARD32 caps2;
    CARD32 caps3;
    CARD32 caps4;
    CARD32 caps5;
} xShmQueryCapabilitiesReply;
#define sz_xShmQueryCapabilitiesReply 32
---

Where the cap bits start filling in from caps0.

Other than that:

Reviewed-by: Adam Jackson <ajax at redhat.com>

- ajax



More information about the xorg-devel mailing list