65fea56f17cd614bc8908264df980a62e1931468vboxsync/*
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Copyright © 2003 Keith Packard
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Permission to use, copy, modify, distribute, and sell this software and its
65fea56f17cd614bc8908264df980a62e1931468vboxsync * documentation for any purpose is hereby granted without fee, provided that
65fea56f17cd614bc8908264df980a62e1931468vboxsync * the above copyright notice appear in all copies and that both that
65fea56f17cd614bc8908264df980a62e1931468vboxsync * copyright notice and this permission notice appear in supporting
65fea56f17cd614bc8908264df980a62e1931468vboxsync * documentation, and that the name of Keith Packard not be used in
65fea56f17cd614bc8908264df980a62e1931468vboxsync * advertising or publicity pertaining to distribution of the software without
65fea56f17cd614bc8908264df980a62e1931468vboxsync * specific, written prior permission. Keith Packard makes no
65fea56f17cd614bc8908264df980a62e1931468vboxsync * representations about the suitability of this software for any purpose. It
65fea56f17cd614bc8908264df980a62e1931468vboxsync * is provided "as is" without express or implied warranty.
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
65fea56f17cd614bc8908264df980a62e1931468vboxsync * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
65fea56f17cd614bc8908264df980a62e1931468vboxsync * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
65fea56f17cd614bc8908264df980a62e1931468vboxsync * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
65fea56f17cd614bc8908264df980a62e1931468vboxsync * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
65fea56f17cd614bc8908264df980a62e1931468vboxsync * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
65fea56f17cd614bc8908264df980a62e1931468vboxsync * PERFORMANCE OF THIS SOFTWARE.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#ifndef _SHMINT_H_
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define _SHMINT_H_
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include <X11/extensions/shmproto.h>
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include "screenint.h"
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include "pixmap.h"
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include "gc.h"
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define XSHM_PUT_IMAGE_ARGS \
65fea56f17cd614bc8908264df980a62e1931468vboxsync DrawablePtr /* dst */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync GCPtr /* pGC */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /* depth */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync unsigned int /* format */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /* w */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /* h */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /* sx */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /* sy */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /* sw */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /* sh */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /* dx */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /* dy */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync char * /* data */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define XSHM_CREATE_PIXMAP_ARGS \
65fea56f17cd614bc8908264df980a62e1931468vboxsync ScreenPtr /* pScreen */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /* width */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /* height */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /* depth */, \
65fea56f17cd614bc8908264df980a62e1931468vboxsync char * /* addr */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct _ShmFuncs {
65fea56f17cd614bc8908264df980a62e1931468vboxsync PixmapPtr (*CreatePixmap) (XSHM_CREATE_PIXMAP_ARGS);
65fea56f17cd614bc8908264df980a62e1931468vboxsync void (*PutImage) (XSHM_PUT_IMAGE_ARGS);
65fea56f17cd614bc8908264df980a62e1931468vboxsync} ShmFuncs, *ShmFuncsPtr;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#if XTRANS_SEND_FDS
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define SHM_FD_PASSING 1
65fea56f17cd614bc8908264df980a62e1931468vboxsync#endif
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct _ShmDesc {
65fea56f17cd614bc8908264df980a62e1931468vboxsync struct _ShmDesc *next;
65fea56f17cd614bc8908264df980a62e1931468vboxsync int shmid;
65fea56f17cd614bc8908264df980a62e1931468vboxsync int refcnt;
65fea56f17cd614bc8908264df980a62e1931468vboxsync char *addr;
65fea56f17cd614bc8908264df980a62e1931468vboxsync Bool writable;
65fea56f17cd614bc8908264df980a62e1931468vboxsync unsigned long size;
65fea56f17cd614bc8908264df980a62e1931468vboxsync#ifdef SHM_FD_PASSING
65fea56f17cd614bc8908264df980a62e1931468vboxsync Bool is_fd;
65fea56f17cd614bc8908264df980a62e1931468vboxsync struct busfault *busfault;
65fea56f17cd614bc8908264df980a62e1931468vboxsync XID resource;
65fea56f17cd614bc8908264df980a62e1931468vboxsync#endif
65fea56f17cd614bc8908264df980a62e1931468vboxsync} ShmDescRec, *ShmDescPtr;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#ifdef SHM_FD_PASSING
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define SHMDESC_IS_FD(shmdesc) ((shmdesc)->is_fd)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#else
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define SHMDESC_IS_FD(shmdesc) (0)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#endif
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT void
65fea56f17cd614bc8908264df980a62e1931468vboxsync ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT void
65fea56f17cd614bc8908264df980a62e1931468vboxsync ShmRegisterFbFuncs(ScreenPtr pScreen);
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT RESTYPE ShmSegType;
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT int ShmCompletionCode;
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT int BadShmSegCode;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#endif /* _SHMINT_H_ */