feat(x11): migrate to pure Xlibre + dwm/dmenu/st stack, fix fcitx5-t9 bottom bar, PM8909 PON shutdown, and remove Wayland

This commit is contained in:
Luxferre
2026-10-20 21:15:16 +03:00
parent ad012360c3
commit 7bab7b7a11
422 changed files with 63226 additions and 2342 deletions
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef XPRINTF_H
#define XPRINTF_H
#include <stdio.h>
#include <stdarg.h>
#include <X11/Xfuncproto.h>
#include "os.h"
#ifndef _X_RESTRICT_KYWD
#if defined(restrict) /* assume autoconf set it correctly */ || \
(defined(__STDC__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */
#define _X_RESTRICT_KYWD restrict
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
#define _X_RESTRICT_KYWD __restrict__
#else
#define _X_RESTRICT_KYWD
#endif
#endif
/*
* These functions provide a portable implementation of the common (but not
* yet universal) asprintf & vasprintf routines to allocate a buffer big
* enough to sprintf the arguments to. The XNF variants terminate the server
* if the allocation fails.
* The buffer allocated is returned in the pointer provided in the first
* argument. The return value is the size of the allocated buffer, or -1
* on failure.
*/
extern _X_EXPORT int /* deprecated */
XNFasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, ...)
_X_ATTRIBUTE_PRINTF(2, 3);
extern _X_EXPORT int
XNFvasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, va_list va)
_X_ATTRIBUTE_VPRINTF(2, 0);
#endif /* XPRINTF_H */
@@ -0,0 +1,82 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef CALLBACK_H
#define CALLBACK_H
#include <X11/X.h> /* for GContext, Mask */
#include <X11/Xdefs.h> /* for Bool */
#include <X11/Xproto.h>
#include <X11/Xfuncproto.h>
/*
* callback manager stuff
*/
typedef struct _CallbackList *CallbackListPtr;
typedef void (*CallbackProcPtr) (CallbackListPtr *, void *, void *);
extern _X_EXPORT Bool AddCallback(CallbackListPtr *pcbl,
CallbackProcPtr callback,
void *data);
extern _X_EXPORT Bool DeleteCallback(CallbackListPtr *pcbl,
CallbackProcPtr callback,
void *data);
extern _X_EXPORT void _CallCallbacks(CallbackListPtr *pcbl,
void *call_data);
static inline void
CallCallbacks(CallbackListPtr *pcbl, void *call_data)
{
if (!pcbl || !*pcbl)
return;
_CallCallbacks(pcbl, call_data);
}
#endif /* CALLBACK_H */
@@ -0,0 +1,58 @@
/*
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
*/
#ifndef CMAP_H
#define CMAP_H 1
#include <X11/Xproto.h>
#include "screenint.h"
#include "window.h"
#define DynamicClass 1
typedef CARD32 Pixel;
#endif /* CMAP_H */
@@ -0,0 +1,59 @@
/*
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
*/
#ifndef CMAPSTRUCT_H
#define CMAPSTRUCT_H 1
#include <X11/Xdefs.h>
/* LOCO -- a local color for a PseudoColor cell. DirectColor maps always
* use the first value (called red) in the structure. What channel they
* are really talking about depends on which map they are in. */
typedef struct {
unsigned short red, green, blue;
} LOCO;
#endif /* COLORMAP_H */
+724
View File
@@ -0,0 +1,724 @@
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Thomas Roell not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Thomas Roell makes no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
*/
/*
* Copyright (c) 1994-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifndef _COMPILER_H
#define _COMPILER_H
#ifndef _X_EXPORT
#include <X11/Xfuncproto.h>
#endif
#include "xlibre_membarrier.h" /* backwards compat, remove in ABI-26 */
#if defined(__alpha__)
# if defined(__linux__)
/* for Linux on Alpha, we use the LIBC _inx/_outx routines */
/* note that the appropriate setup via "ioperm" needs to be done */
/* *before* any inx/outx is done. */
_X_EXPORT void _outb(unsigned char val, unsigned long port);
_X_EXPORT void _outw(unsigned short val, unsigned long port);
_X_EXPORT void _outl(unsigned int val, unsigned long port);
_X_EXPORT unsigned int _inb(unsigned long port);
_X_EXPORT unsigned int _inw(unsigned long port);
_X_EXPORT unsigned int _inl(unsigned long port);
static inline void
outb(unsigned long port, unsigned char val)
{
_outb(val, port);
}
static inline void
outw(unsigned long port, unsigned short val)
{
_outw(val, port);
}
static inline void
outl(unsigned long port, unsigned int val)
{
_outl(val, port);
}
static inline unsigned int
inb(unsigned long port)
{
return _inb(port);
}
static inline unsigned int
inw(unsigned long port)
{
return _inw(port);
}
static inline unsigned int
inl(unsigned long port)
{
return _inl(port);
}
# elif (defined(__FreeBSD__) || defined(__OpenBSD__))
/* for FreeBSD and OpenBSD on Alpha, we use the libio (resp. libalpha) */
/* inx/outx routines */
/* note that the appropriate setup via "ioperm" needs to be done */
/* *before* any inx/outx is done. */
_X_EXPORT void outb(unsigned int port, unsigned char val);
_X_EXPORT void outw(unsigned int port, unsigned short val);
_X_EXPORT void outl(unsigned int port, unsigned int val);
_X_EXPORT unsigned char inb(unsigned int port);
_X_EXPORT unsigned short inw(unsigned int port);
_X_EXPORT unsigned int inl(unsigned int port);
# elif defined(__NetBSD__)
# include <machine/pio.h>
# endif /* various OS'es on __alpha__ */
static inline int MMIO_IN8(void *Base, unsigned long Offset) {
xlibre_mem_barrier_read();
return *(CARD8 *) ((unsigned long) Base + (Offset));
}
static inline int MMIO_IN16(void *Base, unsigned long Offset) {
xlibre_mem_barrier_read();
return *(CARD16 *) ((unsigned long) Base + (Offset));
}
static inline int MMIO_IN32(void *Base, unsigned long Offset) {
xlibre_mem_barrier_read();
return *(CARD32 *) ((unsigned long) Base + (Offset));
}
static inline void MMIO_OUT8(void *Base, unsigned long Offset, int Value) {
xlibre_mem_barrier_write();
*(CARD8 *) ((unsigned long) Base + (Offset)) = Value;
}
static inline void MMIO_OUT16(void *Base, unsigned long Offset, int Value) {
xlibre_mem_barrier_write();
*(CARD16 *) ((unsigned long) Base + (Offset)) = Value;
}
static inline void MMIO_OUT32(void *Base, unsigned long Offset, int Value) {
xlibre_mem_barrier_write();
*(CARD32 *) ((unsigned long) Base + (Offset)) = Value;
}
_X_EXPORT void xf86SlowBCopyFromBus(unsigned char *src, unsigned char *dst, int count);
_X_EXPORT void xf86SlowBCopyToBus(unsigned char *src, unsigned char *dst, int count);
static inline void slowbcopy_tobus(unsigned char *src, unsigned char *dst, int count) {
xf86SlowBCopyToBus(src, dst, count);
}
static inline void slowbcopy_frombus(unsigned char *src, unsigned char *dst, int count) {
xf86SlowBCopyFromBus(src, dst, count);
}
#elif defined(__amd64__) || defined(__i386__) || defined(__ia64__)
#include <inttypes.h>
static inline void
outb(unsigned short port, unsigned char val)
{
__asm__ __volatile__("outb %0,%1"::"a"(val), "d"(port));
}
static inline void
outw(unsigned short port, unsigned short val)
{
__asm__ __volatile__("outw %0,%1"::"a"(val), "d"(port));
}
static inline void
outl(unsigned short port, unsigned int val)
{
__asm__ __volatile__("outl %0,%1"::"a"(val), "d"(port));
}
static inline unsigned int
inb(unsigned short port)
{
unsigned char ret;
__asm__ __volatile__("inb %1,%0":"=a"(ret):"d"(port));
return ret;
}
static inline unsigned int
inw(unsigned short port)
{
unsigned short ret;
__asm__ __volatile__("inw %1,%0":"=a"(ret):"d"(port));
return ret;
}
static inline unsigned int
inl(unsigned short port)
{
unsigned int ret;
__asm__ __volatile__("inl %1,%0":"=a"(ret):"d"(port));
return ret;
}
#elif defined(__sparc__)
#define __XLIBRE_SPARC_ASI_PRIMAY_LE 0x88 /* just for readability */
static inline void
outb(unsigned long port, unsigned char val)
{
__asm__ __volatile__("stba %0, [%1] %2": /* No outputs */
:"r"(val), "r"(port), "i"(__XLIBRE_SPARC_ASI_PRIMAY_LE));
__asm__ __volatile__ (".word 0x8143e00a" : : : "memory");
}
static inline void
outw(unsigned long port, unsigned short val)
{
__asm__ __volatile__("stha %0, [%1] %2": /* No outputs */
:"r"(val), "r"(port), "i"(__XLIBRE_SPARC_ASI_PRIMAY_LE));
__asm__ __volatile__ (".word 0x8143e00a" : : : "memory");
}
static inline void
outl(unsigned long port, unsigned int val)
{
__asm__ __volatile__("sta %0, [%1] %2": /* No outputs */
:"r"(val), "r"(port), "i"(__XLIBRE_SPARC_ASI_PRIMAY_LE));
__asm__ __volatile__ (".word 0x8143e00a" : : : "memory");
}
static inline unsigned int
inb(unsigned long port)
{
unsigned int ret;
__asm__ __volatile__("lduba [%1] %2, %0":"=r"(ret)
:"r"(port), "i"(__XLIBRE_SPARC_ASI_PRIMAY_LE));
return ret;
}
static inline unsigned int
inw(unsigned long port)
{
unsigned int ret;
__asm__ __volatile__("lduha [%1] %2, %0":"=r"(ret)
:"r"(port), "i"(__XLIBRE_SPARC_ASI_PRIMAY_LE));
return ret;
}
static inline unsigned int
inl(unsigned long port)
{
unsigned int ret;
__asm__ __volatile__("lda [%1] %2, %0":"=r"(ret)
:"r"(port), "i"(__XLIBRE_SPARC_ASI_PRIMAY_LE));
return ret;
}
static inline unsigned char
xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
{
unsigned long addr = ((unsigned long) base) + offset;
unsigned char ret;
__asm__ __volatile__("lduba [%1] %2, %0":"=r"(ret)
:"r"(addr), "i"(__XLIBRE_SPARC_ASI_PRIMAY_LE));
return ret;
}
static inline unsigned short
xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset)
{
unsigned long addr = ((unsigned long) base) + offset;
unsigned short ret;
__asm__ __volatile__("lduh [%1], %0":"=r"(ret)
:"r"(addr));
return ret;
}
static inline unsigned short
xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset)
{
unsigned long addr = ((unsigned long) base) + offset;
unsigned short ret;
__asm__ __volatile__("lduha [%1] %2, %0":"=r"(ret)
:"r"(addr), "i"(__XLIBRE_SPARC_ASI_PRIMAY_LE));
return ret;
}
static inline unsigned int
xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
{
unsigned long addr = ((unsigned long) base) + offset;
unsigned int ret;
__asm__ __volatile__("ld [%1], %0":"=r"(ret)
:"r"(addr));
return ret;
}
static inline unsigned int
xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset)
{
unsigned long addr = ((unsigned long) base) + offset;
unsigned int ret;
__asm__ __volatile__("lda [%1] %2, %0":"=r"(ret)
:"r"(addr), "i"(__XLIBRE_SPARC_ASI_PRIMAY_LE));
return ret;
}
static inline void
xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
const unsigned int val)
{
unsigned long addr = ((unsigned long) base) + offset;
__asm__ __volatile__("stba %0, [%1] %2": /* No outputs */
:"r"(val), "r"(addr), "i"(__XLIBRE_SPARC_ASI_PRIMAY_LE));
__asm__ __volatile__ (".word 0x8143e00a" : : : "memory");
}
static inline void
xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset,
const unsigned int val)
{
unsigned long addr = ((unsigned long) base) + offset;
__asm__ __volatile__("sth %0, [%1]": /* No outputs */
:"r"(val), "r"(addr));
__asm__ __volatile__ (".word 0x8143e00a" : : : "memory");
}
static inline void
xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset,
const unsigned int val)
{
unsigned long addr = ((unsigned long) base) + offset;
__asm__ __volatile__("stha %0, [%1] %2": /* No outputs */
:"r"(val), "r"(addr), "i"(__XLIBRE_SPARC_ASI_PRIMAY_LE));
__asm__ __volatile__ (".word 0x8143e00a" : : : "memory");
}
static inline void
xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
const unsigned int val)
{
unsigned long addr = ((unsigned long) base) + offset;
__asm__ __volatile__("st %0, [%1]": /* No outputs */
:"r"(val), "r"(addr));
__asm__ __volatile__ (".word 0x8143e00a" : : : "memory");
}
static inline void
xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
const unsigned int val)
{
unsigned long addr = ((unsigned long) base) + offset;
__asm__ __volatile__("sta %0, [%1] %2": /* No outputs */
:"r"(val), "r"(addr), "i"(__XLIBRE_SPARC_ASI_PRIMAY_LE));
__asm__ __volatile__ (".word 0x8143e00a" : : : "memory");
}
#undef __XLIBRE_SPARC_ASI_PRIMAY_LE
#elif defined(__arm32__) && !defined(__linux__)
extern _X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */
static inline void
outb(unsigned long port, unsigned char val)
{
*(volatile unsigned char *) (((unsigned long) (port)) + IOPortBase) =
val;
}
static inline void
outw(unsigned long port, unsigned short val)
{
*(volatile unsigned short *) (((unsigned long) (port)) + IOPortBase) =
val;
}
static inline void
outl(unsigned long port, unsigned int val)
{
*(volatile unsigned int *) (((unsigned long) (port)) + IOPortBase) =
val;
}
static inline unsigned int
inb(unsigned long port)
{
return *(volatile unsigned char *) (((unsigned long) (port)) +
IOPortBase);
}
static inline unsigned int
inw(unsigned long port)
{
return *(volatile unsigned short *) (((unsigned long) (port)) +
IOPortBase);
}
static inline unsigned int
inl(unsigned long port)
{
return *(volatile unsigned int *) (((unsigned long) (port)) +
IOPortBase);
}
#elif defined(__mips__)
# if defined(__mips64)
# define __XLIBRE_MIPS_PORT_TYPE unsigned long
# define __XLIBRE_MIPS_PORT_ADDR(port) (((unsigned long)(port)) + IOPortBase)
# else
# define __XLIBRE_MIPS_PORT_TYPE unsigned short
# define __XLIBRE_MIPS_PORT_ADDR(port) (((unsigned short)(port)) + IOPortBase)
# endif
extern _X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */
static inline void outb(__XLIBRE_MIPS_PORT_TYPE port, unsigned char val) {
*(volatile unsigned char *)(__XLIBRE_MIPS_PORT_ADDR(port)) = val;
}
static inline void outw(__XLIBRE_MIPS_PORT_TYPE port, unsigned short val) {
*(volatile unsigned short *)(__XLIBRE_MIPS_PORT_ADDR(port)) = val;
}
static inline void outl(__XLIBRE_MIPS_PORT_TYPE port, unsigned int val) {
*(volatile unsigned int *)(__XLIBRE_MIPS_PORT_ADDR(port)) = val;
}
static inline unsigned int inb(__XLIBRE_MIPS_PORT_TYPE port) {
return *(volatile unsigned char *)(__XLIBRE_MIPS_PORT_ADDR(port));
}
static inline unsigned int inw(__XLIBRE_MIPS_PORT_TYPE port) {
return *(volatile unsigned short *)(__XLIBRE_MIPS_PORT_ADDR(port));
}
static inline unsigned int inl(__XLIBRE_MIPS_PORT_TYPE port) {
return *(volatile unsigned int *)(__XLIBRE_MIPS_PORT_ADDR(port));
}
# undef __XLIBRE_MIPS_PORT_TYPE
# undef __XLIBRE_MIPS_PORT_ADDR
# ifdef __linux__ /* don't mess with other OSs */
# if X_BYTE_ORDER == X_BIG_ENDIAN
static inline unsigned int
xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
{
unsigned long addr = ((unsigned long) base) + offset;
unsigned int ret;
__asm__ __volatile__("lw %0, 0(%1)":"=r"(ret)
:"r"(addr));
return ret;
}
static inline void
xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
const unsigned int val)
{
unsigned long addr = ((unsigned long) base) + offset;
__asm__ __volatile__("sw %0, 0(%1)": /* No outputs */
:"r"(val), "r"(addr));
}
# endif /* X_BYTE_ORDER == X_BIG_ENDIAN */
# endif /* __linux__ */
#elif defined(__powerpc__)
#include <sys/mman.h>
extern _X_EXPORT void *ioBase;
static inline unsigned char
xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
{
register unsigned char val;
__asm__ __volatile__("lbzx %0,%1,%2\n\t" "eieio":"=r"(val)
:"b"(base), "r"(offset),
"m"(*((volatile unsigned char *) base + offset)));
return val;
}
static inline unsigned short
xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset)
{
register unsigned short val;
__asm__ __volatile__("lhzx %0,%1,%2\n\t" "eieio":"=r"(val)
:"b"(base), "r"(offset),
"m"(*((volatile unsigned char *) base + offset)));
return val;
}
static inline unsigned short
xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset)
{
register unsigned short val;
__asm__ __volatile__("lhbrx %0,%1,%2\n\t" "eieio":"=r"(val)
:"b"(base), "r"(offset),
"m"(*((volatile unsigned char *) base + offset)));
return val;
}
static inline unsigned int
xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
{
register unsigned int val;
__asm__ __volatile__("lwzx %0,%1,%2\n\t" "eieio":"=r"(val)
:"b"(base), "r"(offset),
"m"(*((volatile unsigned char *) base + offset)));
return val;
}
static inline unsigned int
xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset)
{
register unsigned int val;
__asm__ __volatile__("lwbrx %0,%1,%2\n\t" "eieio":"=r"(val)
:"b"(base), "r"(offset),
"m"(*((volatile unsigned char *) base + offset)));
return val;
}
static inline void
xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
const unsigned char val)
{
__asm__
__volatile__("stbx %1,%2,%3\n\t":"=m"
(*((volatile unsigned char *) base + offset))
:"r"(val), "b"(base), "r"(offset));
xlibre_mem_barrier_write();
}
static inline void
xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset,
const unsigned short val)
{
__asm__
__volatile__("sthbrx %1,%2,%3\n\t":"=m"
(*((volatile unsigned char *) base + offset))
:"r"(val), "b"(base), "r"(offset));
xlibre_mem_barrier_write();
}
static inline void
xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset,
const unsigned short val)
{
__asm__
__volatile__("sthx %1,%2,%3\n\t":"=m"
(*((volatile unsigned char *) base + offset))
:"r"(val), "b"(base), "r"(offset));
xlibre_mem_barrier_write();
}
static inline void
xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
const unsigned int val)
{
__asm__
__volatile__("stwbrx %1,%2,%3\n\t":"=m"
(*((volatile unsigned char *) base + offset))
:"r"(val), "b"(base), "r"(offset));
xlibre_mem_barrier_write();
}
static inline void
xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
const unsigned int val)
{
__asm__
__volatile__("stwx %1,%2,%3\n\t":"=m"
(*((volatile unsigned char *) base + offset))
:"r"(val), "b"(base), "r"(offset));
xlibre_mem_barrier_write();
}
static inline void
outb(unsigned short port, unsigned char value)
{
if (ioBase == MAP_FAILED)
return;
xf86WriteMmio8(ioBase, port, value);
}
static inline void
outw(unsigned short port, unsigned short value)
{
if (ioBase == MAP_FAILED)
return;
xf86WriteMmio16Le(ioBase, port, value);
}
static inline void
outl(unsigned short port, unsigned int value)
{
if (ioBase == MAP_FAILED)
return;
xf86WriteMmio32Le(ioBase, port, value);
}
static inline unsigned int
inb(unsigned short port)
{
if (ioBase == MAP_FAILED)
return 0;
return xf86ReadMmio8(ioBase, port);
}
static inline unsigned int
inw(unsigned short port)
{
if (ioBase == MAP_FAILED)
return 0;
return xf86ReadMmio16Le(ioBase, port);
}
static inline unsigned int
inl(unsigned short port)
{
if (ioBase == MAP_FAILED)
return 0;
return xf86ReadMmio32Le(ioBase, port);
}
#endif /* arch madness */
/* drivers that want to prevent automatic byteswapping by MMIO_()* macros
on PPC and SPARC should set these */
#if !defined(MMIO_IS_BE) && \
(defined(SPARC_MMIO_IS_BE) || defined(PPC_MMIO_IS_BE))
#define MMIO_IS_BE
#endif
#ifdef __alpha__
#elif defined(__powerpc__) || defined(__sparc__)
/*
* we provide byteswapping and no byteswapping functions here
* with byteswapping as default,
* drivers that don't need byteswapping should define MMIO_IS_BE
*/
#define MMIO_IN8(base, offset) xf86ReadMmio8((base), (offset))
#define MMIO_OUT8(base, offset, val) \
xf86WriteMmio8((base), (offset), (CARD8)(val))
#if defined(MMIO_IS_BE) /* No byteswapping */
#define MMIO_IN16(base, offset) xf86ReadMmio16Be((base), (offset))
#define MMIO_IN32(base, offset) xf86ReadMmio32Be((base), (offset))
#define MMIO_OUT16(base, offset, val) \
xf86WriteMmio16Be((base), (offset), (CARD16)(val))
#define MMIO_OUT32(base, offset, val) \
xf86WriteMmio32Be((base), (offset), (CARD32)(val))
#else /* byteswapping is the default */
#define MMIO_IN16(base, offset) xf86ReadMmio16Le((base), (offset))
#define MMIO_IN32(base, offset) xf86ReadMmio32Le((base), (offset))
#define MMIO_OUT16(base, offset, val) \
xf86WriteMmio16Le((base), (offset), (CARD16)(val))
#define MMIO_OUT32(base, offset, val) \
xf86WriteMmio32Le((base), (offset), (CARD32)(val))
#endif
#else /* !__alpha__ && !__powerpc__ && !__sparc__ */
#define MMIO_IN8(base, offset) \
*(volatile CARD8 *)(((CARD8*)(base)) + (offset))
#define MMIO_IN16(base, offset) \
*(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset))
#define MMIO_IN32(base, offset) \
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
#define MMIO_OUT8(base, offset, val) \
*(volatile CARD8 *)(((CARD8*)(base)) + (offset)) = (val)
#define MMIO_OUT16(base, offset, val) \
*(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
#define MMIO_OUT32(base, offset, val) \
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
#endif /* __alpha__ */
/*
* With Intel, the version in os-support/misc/SlowBcopy.s is used.
* This avoids port I/O during the copy (which causes problems with
* some hardware).
*/
#ifndef __alpha__
#define slowbcopy_tobus(src,dst,count) xf86SlowBcopy((src),(dst),(count))
#define slowbcopy_frombus(src,dst,count) xf86SlowBcopy((src),(dst),(count))
#endif /* __alpha__ */
#endif /* _COMPILER_H */
@@ -0,0 +1,37 @@
/*
* Copyright © 2009 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef _COMPOSITEEXT_H_
#define _COMPOSITEEXT_H_
#include "misc.h"
#include "scrnintstr.h"
extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen,
VisualID * vids,
int nVisuals);
extern _X_EXPORT Bool compIsAlternateVisual(ScreenPtr pScreen, XID visual);
extern _X_EXPORT RESTYPE CompositeClientWindowType;
#endif /* _COMPOSITEEXT_H_ */
+71
View File
@@ -0,0 +1,71 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef CURSOR_H
#define CURSOR_H
#include "misc.h"
#include "screenint.h"
#include "window.h"
#include "privates.h"
#define NullCursor ((CursorPtr)NULL)
/* Provide support for alpha composited cursors */
#define ARGB_CURSOR
typedef struct _Cursor *CursorPtr;
// FUN FACT: If you typedef a pointer type, like the `CursorPtr` above
// then `const CursorPtr` or `CursorPtr const` actually means `struct _Cursor *const`, a constant pointer
// which is probably not what you want(a pointer to constant).
// Maybe better just keep the `*` around, or you have to typedef a separate constPtr type.
typedef struct _Cursor const *ConstCursorPtr;
typedef struct _CursorMetric *CursorMetricPtr;
extern _X_EXPORT int FreeCursor(void *pCurs,
XID cid);
#endif /* CURSOR_H */
@@ -0,0 +1,90 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef CURSORSTRUCT_H
#define CURSORSTRUCT_H
#include "cursor.h"
#include "privates.h"
/*
* device-independent cursor storage
*/
/*
* source and mask point directly to the bits, which are in the server-defined
* bitmap format.
*/
typedef struct _CursorBits {
unsigned char *source; /* points to bits */
unsigned char *mask; /* points to bits */
Bool emptyMask; /* all zeros mask */
unsigned short width, height, xhot, yhot; /* metrics */
int refcnt; /* can be shared */
PrivateRec *devPrivates; /* set by pScr->RealizeCursor */
CARD32 *argb; /* full-color alpha blended */
} CursorBits, *CursorBitsPtr;
typedef struct _Cursor {
CursorBitsPtr bits;
unsigned short foreRed, foreGreen, foreBlue; /* device-independent color */
unsigned short backRed, backGreen, backBlue; /* device-independent color */
int refcnt;
PrivateRec *devPrivates; /* set by pScr->RealizeCursor */
XID id;
CARD32 serialNumber;
Atom name;
} CursorRec;
typedef struct _CursorMetric {
unsigned short width, height, xhot, yhot;
} CursorMetricRec;
typedef struct {
int x, y;
ScreenPtr pScreen;
} HotSpot;
#endif /* CURSORSTRUCT_H */
+127
View File
@@ -0,0 +1,127 @@
/*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _DAMAGE_H_
#define _DAMAGE_H_
#include <X11/Xfuncproto.h>
typedef struct _damage *DamagePtr;
typedef enum _damageReportLevel {
DamageReportRawRegion,
DamageReportDeltaRegion,
DamageReportBoundingBox,
DamageReportNonEmpty,
DamageReportNone
} DamageReportLevel;
typedef void (*DamageReportFunc) (DamagePtr pDamage, RegionPtr pRegion,
void *closure);
typedef void (*DamageDestroyFunc) (DamagePtr pDamage, void *closure);
typedef void (*DamageScreenCreateFunc) (DamagePtr);
typedef void (*DamageScreenRegisterFunc) (DrawablePtr, DamagePtr);
typedef void (*DamageScreenUnregisterFunc) (DrawablePtr, DamagePtr);
typedef void (*DamageScreenDestroyFunc) (DamagePtr);
/* @public
*
* @brief Driver callbacks for getting notified on several damage calls
*
* The pointer to this struct can be obtained via DamageGetScreenFuncs().
* Drivers can inject themselves here, in order to get notified on
* DamageCreate(), DamageRegister(), DamageUnregister(), DamageDestroy().
*
* The fields may be assigned to NULL, if no action at all is wanted.
* (by default assigned to default implementations)
*
* This should ONLY be touched by video drivers, nobody else.
*
* So far the only one using it is the proprietary NVidia driver.
*/
typedef struct _damageScreenFuncs {
DamageScreenCreateFunc Create;
DamageScreenRegisterFunc Register;
DamageScreenUnregisterFunc Unregister;
DamageScreenDestroyFunc Destroy;
} DamageScreenFuncsRec, *DamageScreenFuncsPtr;
extern _X_EXPORT void miDamageCreate(DamagePtr);
extern _X_EXPORT void miDamageRegister(DrawablePtr, DamagePtr);
extern _X_EXPORT void miDamageUnregister(DrawablePtr, DamagePtr);
extern _X_EXPORT void miDamageDestroy(DamagePtr);
extern _X_EXPORT Bool
DamageSetup(ScreenPtr pScreen);
extern _X_EXPORT DamagePtr
DamageCreate(DamageReportFunc damageReport,
DamageDestroyFunc damageDestroy,
DamageReportLevel damageLevel,
Bool isInternal, ScreenPtr pScreen, void *closure);
extern _X_EXPORT void
DamageDrawInternal(ScreenPtr pScreen, Bool enable);
extern _X_EXPORT void
DamageRegister(DrawablePtr pDrawable, DamagePtr pDamage);
extern _X_EXPORT void
DamageUnregister(DamagePtr pDamage);
extern _X_EXPORT void
DamageDestroy(DamagePtr pDamage);
extern _X_EXPORT Bool
DamageSubtract(DamagePtr pDamage, const RegionPtr pRegion);
extern _X_EXPORT void
DamageEmpty(DamagePtr pDamage);
extern _X_EXPORT RegionPtr
DamageRegion(DamagePtr pDamage);
extern _X_EXPORT RegionPtr
DamagePendingRegion(DamagePtr pDamage);
/* In case of rendering, call this before the submitting the commands. */
extern _X_EXPORT void
DamageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion);
/* Call this directly after the rendering operation has been submitted. */
extern _X_EXPORT void
DamageRegionProcessPending(DrawablePtr pDrawable);
/* Call this when you create a new Damage and you wish to send an initial damage message (to it). */
extern _X_EXPORT void
DamageReportDamage(DamagePtr pDamage, RegionPtr pDamageRegion);
/* Avoid using this call, it only exists for API compatibility. */
extern _X_EXPORT void
DamageDamageRegion(DrawablePtr pDrawable, const RegionPtr pRegion);
extern _X_EXPORT void
DamageSetReportAfterOp(DamagePtr pDamage, Bool reportAfter);
extern _X_EXPORT DamageScreenFuncsPtr DamageGetScreenFuncs(ScreenPtr);
#endif /* _DAMAGE_H_ */
@@ -0,0 +1,110 @@
/*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _DAMAGESTR_H_
#define _DAMAGESTR_H_
#include "damage.h"
#include "gcstruct.h"
#include "privates.h"
#include "picturestr.h"
typedef struct _damage {
DamagePtr pNext;
DamagePtr pNextWin;
/*
* Drawable on which this damage was inserted. Used to re-derive the list head at removal time
* to avoid caching a pointer into a realloc()able privates array.
*/
DrawablePtr pListDrawable;
RegionRec damage;
DamageReportLevel damageLevel;
Bool isInternal;
void *closure;
Bool isWindow;
DrawablePtr pDrawable;
DamageReportFunc damageReport;
DamageDestroyFunc damageDestroy;
Bool reportAfter;
RegionRec pendingDamage; /* will be flushed post submission at the latest */
ScreenPtr pScreen;
} DamageRec;
typedef struct _damageScrPriv {
int internalLevel;
/*
* For DDXen which don't provide GetScreenPixmap, this provides
* a place to hook damage for windows on the screen
*/
DamagePtr pScreenDamage;
CopyWindowProcPtr CopyWindow;
void *_dummy1; // required in place of a removed field for ABI compatibility
CreateGCProcPtr CreateGC;
void *_dummy2; // required in place of a removed field for ABI compatibility
SetWindowPixmapProcPtr SetWindowPixmap;
void *_dummy3; // required in place of a removed field for ABI compatibility
CompositeProcPtr Composite;
GlyphsProcPtr Glyphs;
AddTrapsProcPtr AddTraps;
/* Table of wrappable function pointers */
DamageScreenFuncsRec funcs;
} DamageScrPrivRec, *DamageScrPrivPtr;
typedef struct _damageGCPriv {
const GCOps *ops;
const GCFuncs *funcs;
} DamageGCPrivRec, *DamageGCPrivPtr;
/* XXX should move these into damage.c, damageScrPrivateIndex is static */
#define damageGetScrPriv(pScr) ((DamageScrPrivPtr) \
dixLookupPrivate(&(pScr)->devPrivates, damageScrPrivateKey))
#define damageScrPriv(pScr) \
DamageScrPrivPtr pScrPriv = damageGetScrPriv((pScr))
#define damageGetPixPriv(pPix) \
dixLookupPrivate(&(pPix)->devPrivates, damagePixPrivateKey)
#define damgeSetPixPriv(pPix,v) \
dixSetPrivate(&(pPix)->devPrivates, damagePixPrivateKey, (v))
#define damagePixPriv(pPix) \
DamagePtr pDamage = damageGetPixPriv((pPix))
#define damageGetGCPriv(pGC) \
dixLookupPrivate(&(pGC)->devPrivates, damageGCPrivateKey)
#define damageGCPriv(pGC) \
DamageGCPrivPtr pGCPriv = damageGetGCPriv((pGC))
#define damageGetWinPriv(pWin) \
((DamagePtr)dixLookupPrivate(&(pWin)->devPrivates, damageWinPrivateKey))
#define damageSetWinPriv(pWin,d) \
dixSetPrivate(&(pWin)->devPrivates, damageWinPrivateKey, d)
#endif /* _DAMAGESTR_H_ */
@@ -0,0 +1,99 @@
#ifndef _DISMODEPROC_H_
#define _DISMODEPROC_H_
#include "scrnintstr.h"
#define MAXCLOCKS 128
/* These are possible return values for xf86CheckMode() and ValidMode() */
typedef enum {
MODE_OK = 0, /* Mode OK */
MODE_HSYNC, /* hsync out of range */
MODE_VSYNC, /* vsync out of range */
MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
MODE_BAD_WIDTH, /* requires an unsupported linepitch */
MODE_NOMODE, /* no mode with a matching name */
MODE_NO_INTERLACE, /* interlaced mode not supported */
MODE_NO_DBLESCAN, /* doublescan mode not supported */
MODE_NO_VSCAN, /* multiscan mode not supported */
MODE_MEM, /* insufficient video memory */
MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
MODE_MEM_VIRT, /* insufficient video memory given virtual size */
MODE_NOCLOCK, /* no fixed clock available */
MODE_CLOCK_HIGH, /* clock required is too high */
MODE_CLOCK_LOW, /* clock required is too low */
MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
MODE_BAD_HVALUE, /* horizontal timing was out of range */
MODE_BAD_VVALUE, /* vertical timing was out of range */
MODE_BAD_VSCAN, /* VScan value out of range */
MODE_HSYNC_NARROW, /* horizontal sync too narrow */
MODE_HSYNC_WIDE, /* horizontal sync too wide */
MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
MODE_HBLANK_WIDE, /* horizontal blanking too wide */
MODE_VSYNC_NARROW, /* vertical sync too narrow */
MODE_VSYNC_WIDE, /* vertical sync too wide */
MODE_VBLANK_NARROW, /* vertical blanking too narrow */
MODE_VBLANK_WIDE, /* vertical blanking too wide */
MODE_PANEL, /* exceeds panel dimensions */
MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
MODE_ONE_WIDTH, /* only one width is supported */
MODE_ONE_HEIGHT, /* only one height is supported */
MODE_ONE_SIZE, /* only one resolution is supported */
MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
MODE_BANDWIDTH, /* mode requires too much memory bandwidth */
MODE_DUPLICATE, /* mode is duplicated */
MODE_BAD = -2, /* unspecified reason */
MODE_ERROR = -1 /* error condition */
} ModeStatus;
/* Video mode */
typedef struct _DisplayModeRec {
struct _DisplayModeRec *prev;
struct _DisplayModeRec *next;
const char *name; /* identifier for the mode */
ModeStatus status;
int type;
/* These are the values that the user sees/provides */
int Clock; /* pixel clock freq (kHz) */
int HDisplay; /* horizontal timing */
int HSyncStart;
int HSyncEnd;
int HTotal;
int HSkew;
int VDisplay; /* vertical timing */
int VSyncStart;
int VSyncEnd;
int VTotal;
int VScan;
int Flags;
/* These are the values the hardware uses */
int ClockIndex;
int SynthClock; /* Actual clock freq to
* be programmed (kHz) */
int CrtcHDisplay;
int CrtcHBlankStart;
int CrtcHSyncStart;
int CrtcHSyncEnd;
int CrtcHBlankEnd;
int CrtcHTotal;
int CrtcHSkew;
int CrtcVDisplay;
int CrtcVBlankStart;
int CrtcVSyncStart;
int CrtcVSyncEnd;
int CrtcVBlankEnd;
int CrtcVTotal;
Bool CrtcHAdjusted;
Bool CrtcVAdjusted;
int PrivSize;
INT32 *Private;
int PrivFlags;
float HSync, VRefresh;
} DisplayModeRec, *DisplayModePtr;
#endif
+229
View File
@@ -0,0 +1,229 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef DIX_H
#define DIX_H
#include <X11/extensions/XI.h>
#include "xlibre_ptrtypes.h"
#include "callback.h"
#include "gc.h"
#include "window.h"
#include "input.h"
#include "cursor.h"
#include "events.h"
#define EARLIER -1
#define SAMETIME 0
#define LATER 1
#define REQUEST(type) \
type * stuff = (type *)client->requestBuffer;
/* Some platforms provide ARRAY_SIZE from a system header (e.g. illumos/Solaris
* <sys/sysmacros.h>); don't redefine it there (-Werror). */
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0]))
#endif
#define REQUEST_SIZE_MATCH(req) \
do { \
if ((sizeof(req) >> 2) != client->req_len) \
return(BadLength); \
} while (0)
#define REQUEST_AT_LEAST_SIZE(req) \
do { \
if ((sizeof(req) >> 2) > client->req_len) \
return(BadLength); \
} while (0)
#define REQUEST_AT_LEAST_EXTRA_SIZE(req, extra) \
do { \
if (((sizeof(req) + ((uint64_t) (extra))) >> 2) > client->req_len) \
return(BadLength); \
} while (0)
#define REQUEST_FIXED_SIZE(req, n) \
do { \
if ((((sizeof(req)) >> 2) > client->req_len) || \
(((n) >> 2) >= client->req_len) || \
((((uint64_t) sizeof(req) + (n) + 3) >> 2) != (uint64_t) client->req_len)) \
return(BadLength); \
} while (0)
typedef struct _TimeStamp *TimeStampPtr;
extern _X_EXPORT ClientPtr clients[];
extern _X_EXPORT ClientPtr serverClient;
extern _X_EXPORT int currentMaxClients;
typedef struct _TimeStamp {
CARD32 months; /* really ~49.7 days */
CARD32 milliseconds;
} TimeStamp;
/* dispatch.c */
extern _X_EXPORT void UpdateCurrentTime(void);
extern _X_EXPORT void UpdateCurrentTimeIf(void);
/*
* @brief dereference a pixmap and destroy it when not used anymore
*
* Despite the name, this function unref's the pixmap, and only destroys it when
* the pixmap isn't used anymore. (perhaps it should be renamed to dixUnrefPixmap())
*
* Note: it's also used as resource destructor callback, hence that strange args.
* (not actually finest art, but for now a good compromise, since it's already
* existing and exported, thus can easily be used by drivers, w/o breaking compat)
*
* @param pPixmap pointer to pixmap (PixmapPtr) that should be unref'ed
* @param unused ignored, only for matching the resource destructor prototype
*/
_X_EXPORT int dixDestroyPixmap(void *pPixmap, XID unused);
/* dixutils.c */
extern _X_EXPORT int dixLookupWindow(WindowPtr *result,
XID id,
ClientPtr client, Mask access_mode);
extern _X_EXPORT int dixLookupDrawable(DrawablePtr *result,
XID id,
ClientPtr client,
Mask type_mask, Mask access_mode);
extern _X_EXPORT int dixLookupFontable(FontPtr *result,
XID id,
ClientPtr client, Mask access_mode);
extern _X_EXPORT void NoopDDA(void);
typedef void (*ServerBlockHandlerProcPtr) (void *blockData,
void *timeout);
typedef void (*ServerWakeupHandlerProcPtr) (void *blockData,
int result);
extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers(ServerBlockHandlerProcPtr blockHandler,
ServerWakeupHandlerProcPtr wakeupHandler,
void *blockData);
extern _X_EXPORT void RemoveBlockAndWakeupHandlers(ServerBlockHandlerProcPtr blockHandler,
ServerWakeupHandlerProcPtr wakeupHandler,
void *blockData);
extern _X_EXPORT Bool QueueWorkProc(Bool (*function)(ClientPtr clientUnused,
void *closure),
ClientPtr client,
void *closure);
/* atom.c */
extern _X_EXPORT Atom MakeAtom(const char * /*string */ ,
unsigned /*len */ ,
Bool /*makeit */ );
extern _X_EXPORT Bool ValidAtom(Atom /*atom */ );
extern _X_EXPORT const char *NameForAtom(Atom /*atom */ );
/* events.c */
extern _X_EXPORT void
WriteEventsToClient(ClientPtr /*pClient */ ,
int /*count */ ,
xEventPtr /*events */ );
/*
* ServerGrabCallback stuff
*/
extern _X_EXPORT CallbackListPtr ServerGrabCallback;
typedef enum { SERVER_GRABBED, SERVER_UNGRABBED,
CLIENT_PERVIOUS, CLIENT_IMPERVIOUS
} ServerGrabState;
typedef struct {
ClientPtr client;
ServerGrabState grabstate;
} ServerGrabInfoRec;
/*
* EventCallback stuff
*/
extern _X_EXPORT CallbackListPtr EventCallback;
typedef struct {
ClientPtr client;
xEventPtr events;
int count;
} EventInfoRec;
typedef struct {
InternalEvent *event;
DeviceIntPtr device;
} DeviceEventInfoRec;
extern _X_EXPORT void *lastGLContext;
/**
* @brief get display string for given screen
*
* Entry point for drivers/modules that really need to know what
* display ID we're running on (eg. xrdp).
*
* @param pScreen pointer to ScreenRec to query.
* @return pointer to string, valid as long as the pScreen is, owned by DIX.
*/
_X_EXPORT const char *dixGetDisplayName(ScreenPtr *pScreen);
#endif /* DIX_H */
@@ -0,0 +1,54 @@
/***********************************************************
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************/
#ifndef DIX_ACCESS_H
#define DIX_ACCESS_H
/* These are the access modes that can be passed in the last parameter
* to several of the dix lookup functions. They were originally part
* of the Security extension, now used by XACE.
*
* You can or these values together to indicate multiple modes
* simultaneously.
*/
#define DixUnknownAccess 0 /* don't know intentions */
#define DixReadAccess (1<<0) /* inspecting the object */
#define DixWriteAccess (1<<1) /* changing the object */
#define DixDestroyAccess (1<<2) /* destroying the object */
#define DixCreateAccess (1<<3) /* creating the object */
#define DixGetAttrAccess (1<<4) /* get object attributes */
#define DixSetAttrAccess (1<<5) /* set object attributes */
#define DixListPropAccess (1<<6) /* list properties of object */
#define DixGetPropAccess (1<<7) /* get properties of object */
#define DixSetPropAccess (1<<8) /* set properties of object */
#define DixGetFocusAccess (1<<9) /* get focus of object */
#define DixSetFocusAccess (1<<10) /* set focus of object */
#define DixListAccess (1<<11) /* list objects */
#define DixAddAccess (1<<12) /* add object */
#define DixRemoveAccess (1<<13) /* remove object */
#define DixHideAccess (1<<14) /* hide object */
#define DixShowAccess (1<<15) /* show object */
#define DixBlendAccess (1<<16) /* mix contents of objects */
#define DixGrabAccess (1<<17) /* exclusive access to object */
#define DixFreezeAccess (1<<18) /* freeze status of object */
#define DixForceAccess (1<<19) /* force status of object */
#define DixInstallAccess (1<<20) /* install object */
#define DixUninstallAccess (1<<21) /* uninstall object */
#define DixSendAccess (1<<22) /* send to object */
#define DixReceiveAccess (1<<23) /* receive from object */
#define DixUseAccess (1<<24) /* use object */
#define DixManageAccess (1<<25) /* manage object */
#define DixDebugAccess (1<<26) /* debug object */
#define DixBellAccess (1<<27) /* audible sound */
#define DixPostAccess (1<<28) /* post or follow-up call */
#endif /* DIX_ACCESS_H */
@@ -0,0 +1,93 @@
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef DIXFONT_H
#define DIXFONT_H 1
#include "xlibre_ptrtypes.h"
#include "dix.h"
#include <X11/fonts/font.h>
#include <X11/fonts/fontstruct.h>
extern _X_EXPORT Bool SetDefaultFont(const char * /*defaultfontname */ );
extern _X_EXPORT int OpenFont(ClientPtr /*client */ ,
XID /*fid */ ,
Mask /*flags */ ,
unsigned /*lenfname */ ,
const char * /*pfontname */ );
extern _X_EXPORT int CloseFont(void *pfont,
XID fid);
extern _X_EXPORT int ListFonts(ClientPtr /*client */ ,
unsigned char * /*pattern */ ,
unsigned int /*length */ ,
unsigned int /*max_names */ );
extern _X_EXPORT int PolyText(ClientPtr /*client */ ,
DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ ,
unsigned char * /*pElt */ ,
unsigned char * /*endReq */ ,
int /*xorg */ ,
int /*yorg */ ,
int /*reqType */ ,
XID /*did */ );
extern _X_EXPORT int ImageText(ClientPtr /*client */ ,
DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ ,
int /*nChars */ ,
unsigned char * /*data */ ,
int /*xorg */ ,
int /*yorg */ ,
int /*reqType */ ,
XID /*did */ );
extern _X_EXPORT int SetFontPath(ClientPtr /*client */ ,
int /*npaths */ ,
unsigned char * /*paths */ );
extern _X_EXPORT int SetDefaultFontPath(const char * /*path */ );
extern _X_EXPORT void DeleteClientFontStuff(ClientPtr /*client */ );
/* Quartz support on Mac OS X pulls in the QuickDraw
framework whose InitFonts function conflicts here. */
#ifdef __APPLE__
#define InitFonts Darwin_X_InitFonts
#endif
extern _X_EXPORT void InitFonts(void);
extern _X_EXPORT void FreeFonts(void);
extern _X_EXPORT void GetGlyphs(FontPtr /*font */ ,
unsigned long /*count */ ,
unsigned char * /*chars */ ,
FontEncoding /*fontEncoding */ ,
unsigned long * /*glyphcount */ ,
CharInfoPtr * /*glyphs */ );
#endif /* DIXFONT_H */
@@ -0,0 +1,70 @@
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef DIXFONTSTRUCT_H
#define DIXFONTSTRUCT_H
#include "servermd.h"
#include "dixfont.h"
#include <X11/fonts/fontstruct.h>
#include <X11/Xproto.h> /* for xQueryFontReply */
#define FONTCHARSET(font) (font)
#define FONTMAXBOUNDS(font,field) (font)->info.maxbounds.field
#define FONTMINBOUNDS(font,field) (font)->info.minbounds.field
#define TERMINALFONT(font) (font)->info.terminalFont
#define FONTASCENT(font) (font)->info.fontAscent
#define FONTDESCENT(font) (font)->info.fontDescent
#define FONTGLYPHS(font) 0
#define FONTCONSTMETRICS(font) (font)->info.constantMetrics
#define FONTCONSTWIDTH(font) (font)->info.constantWidth
#define FONTALLEXIST(font) (font)->info.allExist
#define FONTFIRSTCOL(font) (font)->info.firstCol
#define FONTLASTCOL(font) (font)->info.lastCol
#define FONTFIRSTROW(font) (font)->info.firstRow
#define FONTLASTROW(font) (font)->info.lastRow
#define FONTDEFAULTCH(font) (font)->info.defaultCh
#define FONTINKMIN(font) (&((font)->info.ink_minbounds))
#define FONTINKMAX(font) (&((font)->info.ink_maxbounds))
#define FONTPROPS(font) (font)->info.props
#define FONTGLYPHBITS(base,pci) ((unsigned char *) (pci)->bits)
#define FONTINFONPROPS(font) (font)->info.nprops
/* some things haven't changed names, but we'll be careful anyway */
#define FONTREFCNT(font) (font)->refcnt
/*
* for linear char sets
*/
#define N1dChars(pfont) (FONTLASTCOL((pfont)) - FONTFIRSTCOL((pfont)) + 1)
/*
* for 2D char sets
*/
#define N2dChars(pfont) (N1dChars((pfont)) * \
(FONTLASTROW((pfont)) - FONTFIRSTROW((pfont)) + 1))
#define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES((pci))+3) & ~0x3)
#endif /* DIXFONTSTRUCT_H */
@@ -0,0 +1,123 @@
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef DIXSTRUCT_H
#define DIXSTRUCT_H
#include <X11/Xmd.h>
#include "xlibre_ptrtypes.h"
#include "callback.h"
#include "dix.h"
#include "resource.h"
#include "cursor.h"
#include "gc.h"
#include "pixmap.h"
#include "privates.h"
/*
* direct-mapped hash table, used by resource manager to store
* translation from client ids to server addresses.
*/
extern _X_EXPORT CallbackListPtr ClientStateCallback;
typedef struct {
ClientPtr client;
xConnSetupPrefix *prefix;
xConnSetup *setup;
} NewClientInfoRec;
typedef void (*ReplySwapPtr) (ClientPtr /* pClient */ ,
int /* size */ ,
void * /* pbuf */ );
typedef enum { ClientStateInitial,
ClientStateRunning,
ClientStateRetained,
ClientStateGone
} ClientState;
struct _Client {
void *requestBuffer;
void *osPrivate; /* for OS layer, including scheduler */
struct xorg_list ready; /* List of clients ready to run */
struct xorg_list output_pending; /* List of clients with output queued */
Mask clientAsMask;
unsigned short index;
unsigned char majorOp, minorOp;
unsigned int swapped:1;
unsigned int local:1;
unsigned int big_requests:1; /* supports large requests */
unsigned int clientGone:1;
unsigned int closeDownMode:2;
unsigned int clientState:2;
signed char smart_priority;
short noClientException; /* this client died or needs to be killed */
int priority;
ReplySwapPtr pSwapReplyFunc;
XID errorValue;
int sequence;
int ignoreCount; /* count for Attend/IgnoreClient */
int __dummy0; /* used to be numSave */
void *__dummy1; /* used to be saveSet */
int (**requestVector) (ClientPtr /* pClient */ );
CARD32 req_len; /* length of current request */
unsigned int replyBytesRemaining;
PrivateRec *devPrivates;
unsigned short mapNotifyMask;
unsigned short newKeyboardNotifyMask;
unsigned char xkbClientFlags;
KeyCode minKC, maxKC;
int smart_start_tick;
int smart_stop_tick;
DeviceIntPtr clientPtr;
struct _ClientId *clientIds;
int req_fds;
/* driver should never ever touch anything beyond here */
struct xorg_list saveSets;
};
extern _X_EXPORT TimeStamp currentTime;
extern _X_EXPORT int
CompareTimeStamps(TimeStamp /*a */ ,
TimeStamp /*b */ );
extern _X_EXPORT TimeStamp
ClientTimeToServerTime(CARD32 /*c */ );
/* proc vectors */
extern _X_EXPORT int (*ProcVector[256]) (ClientPtr /*client */ );
extern _X_EXPORT int (*SwappedProcVector[256]) (ClientPtr /*client */ );
/* fixme: still needed by (public) dix.h */
extern ReplySwapPtr ReplySwapVector[256];
#endif /* DIXSTRUCT_H */
+336
View File
@@ -0,0 +1,336 @@
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Jens Owen <jens@tungstengraphics.com>
*
*/
#ifndef _DRI_H_
#define _DRI_H_
#include <pciaccess.h>
#include "scrnintstr.h"
#include "xf86dri.h"
/* Prototypes for DRI functions */
typedef int DRISyncType;
#define DRI_NO_SYNC 0
#define DRI_2D_SYNC 1
#define DRI_3D_SYNC 2
typedef int DRIContextType;
typedef struct _DRIContextPrivRec DRIContextPrivRec, *DRIContextPrivPtr;
typedef enum _DRIContextFlags {
DRI_CONTEXT_2DONLY = 0x01,
DRI_CONTEXT_PRESERVED = 0x02,
DRI_CONTEXT_RESERVED = 0x04 /* DRI Only -- no kernel equivalent */
} DRIContextFlags;
#define DRI_NO_CONTEXT 0
#define DRI_2D_CONTEXT 1
#define DRI_3D_CONTEXT 2
typedef int DRISwapMethod;
#define DRI_HIDE_X_CONTEXT 0
#define DRI_SERVER_SWAP 1
#define DRI_KERNEL_SWAP 2
typedef int DRIWindowRequests;
#define DRI_NO_WINDOWS 0
#define DRI_3D_WINDOWS_ONLY 1
#define DRI_ALL_WINDOWS 2
typedef void (*ClipNotifyPtr) (WindowPtr, int, int);
typedef void (*AdjustFramePtr) (ScrnInfoPtr pScrn, int x, int y);
/*
* These functions can be wrapped by the DRI. Each of these have
* generic default funcs (initialized in DRICreateInfoRec) and can be
* overridden by the driver in its [driver]DRIScreenInit function.
*/
typedef struct {
ScreenWakeupHandlerProcPtr WakeupHandler;
ScreenBlockHandlerProcPtr BlockHandler;
WindowExposuresProcPtr WindowExposures;
CopyWindowProcPtr CopyWindow;
ClipNotifyProcPtr ClipNotify;
AdjustFramePtr AdjustFrame;
} DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
/*
* Prior to Xorg 6.8.99.8, the DRIInfoRec structure was implicitly versioned
* by the XF86DRI_*_VERSION defines in xf86dristr.h. These numbers were also
* being used to version the XFree86-DRI protocol. Bugs #3066 and #3163
* showed that this was inadequate. The DRIInfoRec structure is now versioned
* by the DRIINFO_*_VERSION defines in this file. - ajax, 2005-05-18.
*
* Revision history:
* 4.1.0 and earlier: DRIQueryVersion returns XF86DRI_*_VERSION.
* 4.2.0: DRIQueryVersion begins returning DRIINFO_*_VERSION.
* 5.0.0: frameBufferPhysicalAddress changed from CARD32 to pointer.
*/
#define DRIINFO_MAJOR_VERSION 5
#define DRIINFO_MINOR_VERSION 4
#define DRIINFO_PATCH_VERSION 0
typedef unsigned long long (*DRITexOffsetStartProcPtr) (PixmapPtr pPix);
typedef void (*DRITexOffsetFinishProcPtr) (PixmapPtr pPix);
typedef struct {
/* driver call back functions
*
* New fields should be added at the end for backwards compatibility.
* Bump the DRIINFO patch number to indicate bugfixes.
* Bump the DRIINFO minor number to indicate new fields.
* Bump the DRIINFO major number to indicate binary-incompatible changes.
*/
Bool (*CreateContext) (ScreenPtr pScreen,
VisualPtr visual,
drm_context_t hHWContext,
void *pVisualConfigPriv, DRIContextType context);
void (*DestroyContext) (ScreenPtr pScreen,
drm_context_t hHWContext, DRIContextType context);
void (*SwapContext) (ScreenPtr pScreen,
DRISyncType syncType,
DRIContextType readContextType,
void *readContextStore,
DRIContextType writeContextType,
void *writeContextStore);
void (*InitBuffers) (WindowPtr pWin, RegionPtr prgn, CARD32 indx);
void (*MoveBuffers) (WindowPtr pWin, xPoint ptOldOrg, RegionPtr prgnSrc, CARD32 indx);
void (*TransitionTo3d) (ScreenPtr pScreen);
void (*TransitionTo2d) (ScreenPtr pScreen);
void (*SetDrawableIndex) (WindowPtr pWin, CARD32 indx);
Bool (*OpenFullScreen) (ScreenPtr pScreen);
Bool (*CloseFullScreen) (ScreenPtr pScreen);
/* wrapped functions */
DRIWrappedFuncsRec wrap;
/* device info */
char *drmDriverName;
char *clientDriverName;
char *busIdString;
int ddxDriverMajorVersion;
int ddxDriverMinorVersion;
int ddxDriverPatchVersion;
void *frameBufferPhysicalAddress;
long frameBufferSize;
long frameBufferStride;
long SAREASize;
int maxDrawableTableEntry;
int ddxDrawableTableEntry;
long contextSize;
DRISwapMethod driverSwapMethod;
DRIWindowRequests bufferRequests;
int devPrivateSize;
void *devPrivate;
Bool createDummyCtx;
Bool createDummyCtxPriv;
/* New with DRI version 4.1.0 */
void (*TransitionSingleToMulti3D) (ScreenPtr pScreen);
void (*TransitionMultiToSingle3D) (ScreenPtr pScreen);
/* New with DRI version 5.1.0 */
void (*ClipNotify) (ScreenPtr pScreen, WindowPtr *ppWin, int num);
/* New with DRI version 5.2.0 */
Bool allocSarea;
Bool keepFDOpen;
/* New with DRI version 5.3.0 */
DRITexOffsetStartProcPtr texOffsetStart;
DRITexOffsetFinishProcPtr texOffsetFinish;
/* New with DRI version 5.4.0 */
int dontMapFrameBuffer;
drm_handle_t hFrameBuffer; /* Handle to framebuffer, either
* mapped by DDX driver or DRI */
} DRIInfoRec, *DRIInfoPtr;
extern _X_EXPORT Bool DRIOpenDRMMaster(ScrnInfoPtr pScrn,
unsigned long sAreaSize,
const char *busID,
const char *drmDriverName);
extern _X_EXPORT Bool DRIScreenInit(ScreenPtr pScreen,
DRIInfoPtr pDRIInfo, int *pDRMFD);
extern _X_EXPORT void DRICloseScreen(ScreenPtr pScreen);
extern _X_EXPORT void DRIReset(void);
extern _X_EXPORT Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen,
Bool *isCapable);
extern _X_EXPORT Bool DRIOpenConnection(ScreenPtr pScreen,
drm_handle_t * hSAREA,
char **busIdString);
extern _X_EXPORT Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic);
extern _X_EXPORT Bool DRICloseConnection(ScreenPtr pScreen);
extern _X_EXPORT Bool DRIGetClientDriverName(ScreenPtr pScreen,
int *ddxDriverMajorVersion,
int *ddxDriverMinorVersion,
int *ddxDriverPatchVersion,
char **clientDriverName);
extern _X_EXPORT Bool DRICreateContext(ScreenPtr pScreen,
VisualPtr visual,
XID context, drm_context_t * pHWContext);
extern _X_EXPORT Bool DRIDestroyContext(ScreenPtr pScreen, XID context);
extern _X_EXPORT Bool DRIContextPrivDelete(void *pResource, XID id);
extern _X_EXPORT Bool DRICreateDrawable(ScreenPtr pScreen,
ClientPtr client,
DrawablePtr pDrawable,
drm_drawable_t * hHWDrawable);
extern _X_EXPORT Bool DRIDestroyDrawable(ScreenPtr pScreen,
ClientPtr client,
DrawablePtr pDrawable);
extern _X_EXPORT Bool DRIDrawablePrivDelete(void *pResource, XID id);
extern _X_EXPORT Bool DRIGetDrawableInfo(ScreenPtr pScreen,
DrawablePtr pDrawable,
unsigned int *indx,
unsigned int *stamp,
int *X,
int *Y,
int *W,
int *H,
int *numClipRects,
drm_clip_rect_t ** pClipRects,
int *backX,
int *backY,
int *numBackClipRects,
drm_clip_rect_t ** pBackClipRects);
extern _X_EXPORT Bool DRIGetDeviceInfo(ScreenPtr pScreen,
drm_handle_t * hFrameBuffer,
int *fbOrigin,
int *fbSize,
int *fbStride,
int *devPrivateSize, void **pDevPrivate);
extern _X_EXPORT DRIInfoPtr DRICreateInfoRec(void);
extern _X_EXPORT void DRIDestroyInfoRec(DRIInfoPtr DRIInfo);
extern _X_EXPORT Bool DRIFinishScreenInit(ScreenPtr pScreen);
extern _X_EXPORT void DRIWakeupHandler(void *wakeupData, int result);
extern _X_EXPORT void DRIBlockHandler(void *blockData, void *timeout);
extern _X_EXPORT void DRIDoWakeupHandler(ScreenPtr pScreen, int result);
extern _X_EXPORT void DRIDoBlockHandler(ScreenPtr pScreen, void *timeout);
extern _X_EXPORT void DRISwapContext(int drmFD, void *oldctx, void *newctx);
extern _X_EXPORT void *DRIGetContextStore(DRIContextPrivPtr context);
extern _X_EXPORT void DRIWindowExposures(WindowPtr pWin, RegionPtr prgn);
extern _X_EXPORT void DRICopyWindow(WindowPtr pWin,
xPoint ptOldOrg, RegionPtr prgnSrc);
extern _X_EXPORT void DRIClipNotify(WindowPtr pWin, int dx, int dy);
extern _X_EXPORT CARD32 DRIGetDrawableIndex(WindowPtr pWin);
extern _X_EXPORT void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg);
extern _X_EXPORT void DRILock(ScreenPtr pScreen, int flags);
extern _X_EXPORT void DRIUnlock(ScreenPtr pScreen);
extern _X_EXPORT DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen);
extern _X_EXPORT void *DRIGetSAREAPrivate(ScreenPtr pScreen);
extern _X_EXPORT unsigned int DRIGetDrawableStamp(ScreenPtr pScreen,
CARD32 drawable_index);
extern _X_EXPORT DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen,
drm_context_t *
pHWContext,
DRIContextFlags flags);
extern _X_EXPORT DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr
pScreen,
drm_context_t
hHWContext,
DRIContextFlags
flags);
extern _X_EXPORT Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv);
extern _X_EXPORT drm_context_t DRIGetContext(ScreenPtr pScreen);
extern _X_EXPORT void DRIQueryVersion(int *majorVersion,
int *minorVersion, int *patchVersion);
extern _X_EXPORT void DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
extern _X_EXPORT void DRIMoveBuffersHelper(ScreenPtr pScreen,
int dx,
int dy,
int *xdir, int *ydir, RegionPtr reg);
extern _X_EXPORT int DRIMasterFD(ScrnInfoPtr pScrn);
extern _X_EXPORT void *DRIMasterSareaPointer(ScrnInfoPtr pScrn);
extern _X_EXPORT drm_handle_t DRIMasterSareaHandle(ScrnInfoPtr pScrn);
extern _X_EXPORT void DRIGetTexOffsetFuncs(ScreenPtr pScreen,
DRITexOffsetStartProcPtr *
texOffsetStartFunc,
DRITexOffsetFinishProcPtr *
texOffsetFinishFunc);
#endif
+361
View File
@@ -0,0 +1,361 @@
/*
* Copyright © 2007 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Soft-
* ware"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, provided that the above copyright
* notice(s) and this permission notice appear in all copies of the Soft-
* ware and that both the above copyright notice(s) and this permission
* notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
* MANCE OF THIS SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder shall
* not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization of
* the copyright holder.
*
* Authors:
* Kristian Høgsberg (krh@redhat.com)
*/
#ifndef _DRI2_H_
#define _DRI2_H_
#include <X11/extensions/dri2tokens.h>
#include "dix.h"
/* Version 2 structure (with format at the end) */
typedef struct {
unsigned int attachment;
unsigned int name;
unsigned int pitch;
unsigned int cpp;
unsigned int flags;
unsigned int format;
void *driverPrivate;
} DRI2BufferRec, *DRI2BufferPtr;
typedef DRI2BufferRec DRI2Buffer2Rec, *DRI2Buffer2Ptr;
typedef void (*DRI2SwapEventPtr) (ClientPtr client, void *data, int type,
CARD64 ust, CARD64 msc, CARD32 sbc);
typedef DRI2BufferPtr(*DRI2CreateBuffersProcPtr) (DrawablePtr pDraw,
unsigned int *attachments,
int count);
typedef void (*DRI2DestroyBuffersProcPtr) (DrawablePtr pDraw,
DRI2BufferPtr buffers, int count);
typedef void (*DRI2CopyRegionProcPtr) (DrawablePtr pDraw,
RegionPtr pRegion,
DRI2BufferPtr pDestBuffer,
DRI2BufferPtr pSrcBuffer);
typedef void (*DRI2WaitProcPtr) (WindowPtr pWin, unsigned int sequence);
typedef int (*DRI2AuthMagicProcPtr) (int fd, uint32_t magic);
typedef int (*DRI2AuthMagic2ProcPtr) (ScreenPtr pScreen, uint32_t magic);
/**
* Schedule a buffer swap
*
* This callback is used to support glXSwapBuffers and the OML_sync_control
* extension (see it for a description of the params).
*
* Drivers should queue an event for the frame count that satisfies the
* parameters passed in. If the event is in the future (i.e. the conditions
* aren't currently satisfied), the server may block the client at the next
* GLX request using DRI2WaitSwap. When the event arrives, drivers should call
* \c DRI2SwapComplete, which will handle waking the client and returning
* the appropriate data.
*
* The DDX is responsible for doing a flip, exchange, or blit of the swap
* when the corresponding event arrives. The \c DRI2CanFlip and
* \c DRI2CanExchange functions can be used as helpers for this purpose.
*
* \param client client pointer (used for block/unblock)
* \param pDraw drawable whose count we want
* \param pDestBuffer current front buffer
* \param pSrcBuffer current back buffer
* \param target_msc frame count to wait for
* \param divisor divisor for condition equation
* \param remainder remainder for division equation
* \param func function to call when the swap completes
* \param data data for the callback \p func.
*/
typedef int (*DRI2ScheduleSwapProcPtr) (ClientPtr client,
DrawablePtr pDraw,
DRI2BufferPtr pDestBuffer,
DRI2BufferPtr pSrcBuffer,
CARD64 * target_msc,
CARD64 divisor,
CARD64 remainder,
DRI2SwapEventPtr func, void *data);
typedef DRI2BufferPtr(*DRI2CreateBufferProcPtr) (DrawablePtr pDraw,
unsigned int attachment,
unsigned int format);
typedef void (*DRI2DestroyBufferProcPtr) (DrawablePtr pDraw,
DRI2BufferPtr buffer);
/**
* Notifies driver when DRI2GetBuffers reuses a dri2 buffer.
*
* Driver may rename the dri2 buffer in this notify if it is required.
*
* \param pDraw drawable whose count we want
* \param buffer buffer that will be returned to client
*/
typedef void (*DRI2ReuseBufferNotifyProcPtr) (DrawablePtr pDraw,
DRI2BufferPtr buffer);
/**
* Get current media stamp counter values
*
* This callback is used to support the SGI_video_sync and OML_sync_control
* extensions.
*
* Drivers should return the current frame counter and the timestamp from
* when the returned frame count was last incremented.
*
* The count should correspond to the screen where the drawable is currently
* visible. If the drawable isn't visible (e.g. redirected), the server
* should return BadDrawable to the client, pending GLX spec updates to
* define this behavior.
*
* \param pDraw drawable whose count we want
* \param ust timestamp from when the count was last incremented.
* \param mst current frame count
*/
typedef int (*DRI2GetMSCProcPtr) (DrawablePtr pDraw, CARD64 * ust,
CARD64 * msc);
/**
* Schedule a frame count related wait
*
* This callback is used to support the SGI_video_sync and OML_sync_control
* extensions. See those specifications for details on how to handle
* the divisor and remainder parameters.
*
* Drivers should queue an event for the frame count that satisfies the
* parameters passed in. If the event is in the future (i.e. the conditions
* aren't currently satisfied), the driver should block the client using
* \c DRI2BlockClient. When the event arrives, drivers should call
* \c DRI2WaitMSCComplete, which will handle waking the client and returning
* the appropriate data.
*
* \param client client pointer (used for block/unblock)
* \param pDraw drawable whose count we want
* \param target_msc frame count to wait for
* \param divisor divisor for condition equation
* \param remainder remainder for division equation
*/
typedef int (*DRI2ScheduleWaitMSCProcPtr) (ClientPtr client,
DrawablePtr pDraw,
CARD64 target_msc,
CARD64 divisor, CARD64 remainder);
typedef void (*DRI2InvalidateProcPtr) (DrawablePtr pDraw, void *data, XID id);
/**
* DRI2 calls this hook when ever swap_limit is going to be changed. Default
* implementation for the hook only accepts one as swap_limit. If driver can
* support other swap_limits it has to implement supported limits with this
* callback.
*
* \param pDraw drawable whose swap_limit is going to be changed
* \param swap_limit new swap_limit that going to be set
* \return TRUE if limit is support, FALSE if not.
*/
typedef Bool (*DRI2SwapLimitValidateProcPtr) (DrawablePtr pDraw,
int swap_limit);
typedef DRI2BufferPtr(*DRI2CreateBuffer2ProcPtr) (ScreenPtr pScreen,
DrawablePtr pDraw,
unsigned int attachment,
unsigned int format);
typedef void (*DRI2DestroyBuffer2ProcPtr) (ScreenPtr pScreen, DrawablePtr pDraw,
DRI2BufferPtr buffer);
typedef void (*DRI2CopyRegion2ProcPtr) (ScreenPtr pScreen, DrawablePtr pDraw,
RegionPtr pRegion,
DRI2BufferPtr pDestBuffer,
DRI2BufferPtr pSrcBuffer);
/**
* \brief Get the value of a parameter.
*
* The parameter's \a value is looked up on the screen associated with
* \a pDrawable.
*
* \return \c Success or error code.
*/
typedef int (*DRI2GetParamProcPtr) (ClientPtr client,
DrawablePtr pDrawable,
CARD64 param,
BOOL *is_param_recognized,
CARD64 *value);
/**
* Version of the DRI2InfoRec structure defined in this header
*/
#define DRI2INFOREC_VERSION 9
typedef struct {
unsigned int version; /**< Version of this struct */
int fd;
const char *driverName;
const char *deviceName;
DRI2CreateBufferProcPtr CreateBuffer;
DRI2DestroyBufferProcPtr DestroyBuffer;
DRI2CopyRegionProcPtr CopyRegion;
DRI2WaitProcPtr Wait;
/* added in version 4 */
DRI2ScheduleSwapProcPtr ScheduleSwap;
DRI2GetMSCProcPtr GetMSC;
DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
/* number of drivers in the driverNames array */
unsigned int numDrivers;
/* array of driver names, indexed by DRI2Driver* driver types */
/* a name of NULL means that driver is not supported */
const char *const *driverNames;
/* added in version 5 */
DRI2AuthMagicProcPtr AuthMagic;
/* added in version 6 */
DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify;
DRI2SwapLimitValidateProcPtr SwapLimitValidate;
/* added in version 7 */
DRI2GetParamProcPtr GetParam;
/* added in version 8 */
/* AuthMagic callback which passes extra context */
/* If this is NULL the AuthMagic callback is used */
/* If this is non-NULL the AuthMagic callback is ignored */
DRI2AuthMagic2ProcPtr AuthMagic2;
/* added in version 9 */
DRI2CreateBuffer2ProcPtr CreateBuffer2;
DRI2DestroyBuffer2ProcPtr DestroyBuffer2;
DRI2CopyRegion2ProcPtr CopyRegion2;
} DRI2InfoRec, *DRI2InfoPtr;
extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info);
extern _X_EXPORT void DRI2CloseScreen(ScreenPtr pScreen);
extern _X_EXPORT Bool DRI2HasSwapControl(ScreenPtr pScreen);
extern _X_EXPORT Bool DRI2Connect(ClientPtr client, ScreenPtr pScreen,
unsigned int driverType,
int *fd,
const char **driverName,
const char **deviceName);
extern _X_EXPORT Bool DRI2Authenticate(ClientPtr client, ScreenPtr pScreen, uint32_t magic);
extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client,
DrawablePtr pDraw,
XID id,
DRI2InvalidateProcPtr invalidate,
void *priv);
extern _X_EXPORT int DRI2CreateDrawable2(ClientPtr client,
DrawablePtr pDraw,
XID id,
DRI2InvalidateProcPtr invalidate,
void *priv,
XID *dri2_id_out);
extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffers(DrawablePtr pDraw,
int *width,
int *height,
unsigned int *attachments,
int count, int *out_count);
extern _X_EXPORT int DRI2CopyRegion(DrawablePtr pDraw,
RegionPtr pRegion,
unsigned int dest, unsigned int src);
/**
* Determine the major and minor version of the DRI2 extension.
*
* Provides a mechanism to other modules (e.g., 2D drivers) to determine the
* version of the DRI2 extension. While it is possible to peek directly at
* the \c XF86ModuleData from a layered module, such a module will fail to
* load (due to an unresolved symbol) if the DRI2 extension is not loaded.
*
* \param major Location to store the major version of the DRI2 extension
* \param minor Location to store the minor version of the DRI2 extension
*
* \note
* This interface was added some time after the initial release of the DRI2
* module. Layered modules that wish to use this interface must first test
* its existence by calling \c xf86LoaderCheckSymbol.
*/
extern _X_EXPORT void DRI2Version(int *major, int *minor);
extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffersWithFormat(DrawablePtr pDraw,
int *width,
int *height,
unsigned int
*attachments,
int count,
int *out_count);
extern _X_EXPORT void DRI2SwapInterval(DrawablePtr pDrawable, int interval);
extern _X_EXPORT Bool DRI2SwapLimit(DrawablePtr pDraw, int swap_limit);
extern _X_EXPORT int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDrawable,
CARD64 target_msc, CARD64 divisor,
CARD64 remainder, CARD64 * swap_target,
DRI2SwapEventPtr func, void *data);
extern _X_EXPORT Bool DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable);
extern _X_EXPORT int DRI2GetMSC(DrawablePtr pDrawable, CARD64 * ust,
CARD64 * msc, CARD64 * sbc);
extern _X_EXPORT int DRI2WaitMSC(ClientPtr client, DrawablePtr pDrawable,
CARD64 target_msc, CARD64 divisor,
CARD64 remainder);
extern _X_EXPORT int ProcDRI2WaitMSCReply(ClientPtr client, CARD64 ust,
CARD64 msc, CARD64 sbc);
extern _X_EXPORT int DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw,
CARD64 target_sbc);
extern _X_EXPORT Bool DRI2ThrottleClient(ClientPtr client, DrawablePtr pDraw);
extern _X_EXPORT Bool DRI2CanFlip(DrawablePtr pDraw);
extern _X_EXPORT Bool DRI2CanExchange(DrawablePtr pDraw);
/* Note: use *only* for MSC related waits */
extern _X_EXPORT void DRI2BlockClient(ClientPtr client, DrawablePtr pDraw);
extern _X_EXPORT void DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw,
int frame, unsigned int tv_sec,
unsigned int tv_usec, int type,
DRI2SwapEventPtr swap_complete,
void *swap_data);
extern _X_EXPORT void DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw,
int frame, unsigned int tv_sec,
unsigned int tv_usec);
extern _X_EXPORT int DRI2GetParam(ClientPtr client,
DrawablePtr pDrawable,
CARD64 param,
BOOL *is_param_recognized,
CARD64 *value);
extern _X_EXPORT DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest);
#endif
+131
View File
@@ -0,0 +1,131 @@
/*
* Copyright © 2013 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _DRI3_H_
#define _DRI3_H_
#include <X11/extensions/dri3proto.h>
#include <randrstr.h>
#define DRI3_SCREEN_INFO_VERSION 4
struct dri3_syncobj
{
XID id;
ScreenPtr screen;
uint32_t refcount;
void (*free)(struct dri3_syncobj *syncobj);
Bool (*has_fence)(struct dri3_syncobj *syncobj, uint64_t point);
Bool (*is_signaled)(struct dri3_syncobj *syncobj, uint64_t point);
int (*export_fence)(struct dri3_syncobj *syncobj, uint64_t point);
void (*import_fence)(struct dri3_syncobj *syncobj, uint64_t point, int fd);
void (*signal)(struct dri3_syncobj *syncobj, uint64_t point);
void (*submitted_eventfd)(struct dri3_syncobj *syncobj, uint64_t point, int efd);
void (*signaled_eventfd)(struct dri3_syncobj *syncobj, uint64_t point, int efd);
};
typedef int (*dri3_open_proc)(ScreenPtr screen,
RRProviderPtr provider,
int *fd);
typedef int (*dri3_open_client_proc)(ClientPtr client,
ScreenPtr screen,
RRProviderPtr provider,
int *fd);
typedef PixmapPtr (*dri3_pixmap_from_fd_proc) (ScreenPtr screen,
int fd,
CARD16 width,
CARD16 height,
CARD16 stride,
CARD8 depth,
CARD8 bpp);
typedef PixmapPtr (*dri3_pixmap_from_fds_proc) (ScreenPtr screen,
CARD8 num_fds,
const int *fds,
CARD16 width,
CARD16 height,
const CARD32 *strides,
const CARD32 *offsets,
CARD8 depth,
CARD8 bpp,
CARD64 modifier);
typedef int (*dri3_fd_from_pixmap_proc) (ScreenPtr screen,
PixmapPtr pixmap,
CARD16 *stride,
CARD32 *size);
typedef int (*dri3_fds_from_pixmap_proc) (ScreenPtr screen,
PixmapPtr pixmap,
int *fds,
uint32_t *strides,
uint32_t *offsets,
uint64_t *modifier);
typedef int (*dri3_get_formats_proc) (ScreenPtr screen,
CARD32 *num_formats,
CARD32 **formats);
typedef int (*dri3_get_modifiers_proc) (ScreenPtr screen,
uint32_t format,
uint32_t *num_modifiers,
uint64_t **modifiers);
typedef int (*dri3_get_drawable_modifiers_proc) (DrawablePtr draw,
uint32_t format,
uint32_t *num_modifiers,
uint64_t **modifiers);
typedef struct dri3_syncobj *(*dri3_import_syncobj_proc) (ClientPtr client,
ScreenPtr screen,
XID id,
int fd);
typedef struct dri3_screen_info {
uint32_t version;
dri3_open_proc open;
dri3_pixmap_from_fd_proc pixmap_from_fd;
dri3_fd_from_pixmap_proc fd_from_pixmap;
/* Version 1 */
dri3_open_client_proc open_client;
/* Version 2 */
dri3_pixmap_from_fds_proc pixmap_from_fds;
dri3_fds_from_pixmap_proc fds_from_pixmap;
dri3_get_formats_proc get_formats;
dri3_get_modifiers_proc get_modifiers;
dri3_get_drawable_modifiers_proc get_drawable_modifiers;
/* Version 4 */
dri3_import_syncobj_proc import_syncobj;
} dri3_screen_info_rec, *dri3_screen_info_ptr;
extern _X_EXPORT Bool
dri3_screen_init(ScreenPtr screen, const dri3_screen_info_rec *info);
#endif /* _DRI3_H_ */
@@ -0,0 +1,122 @@
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Jens Owen <jens@tungstengraphics.com>
*
*/
#ifndef DRI_STRUCT_H
#define DRI_STRUCT_H
#include "dri.h"
#include "sarea.h"
#include "xf86drm.h"
#include "xf86Crtc.h"
#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey))
#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
dixLookupPrivate(&(pPix)->devPrivates, DRIWindowPrivKey))
typedef struct _DRIDrawablePrivRec {
drm_drawable_t hwDrawable;
int drawableIndex;
ScreenPtr pScreen;
int refCount;
int nrects;
} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
struct _DRIContextPrivRec {
drm_context_t hwContext;
ScreenPtr pScreen;
Bool valid3D;
DRIContextFlags flags;
void **pContextStore;
};
#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
dixLookupPrivate(&screenInfo.screens[(screenIndex)]->devPrivates, \
DRIScreenPrivKey))
#define DRI_ENT_PRIV(pScrn) \
((DRIEntPrivIndex < 0) ? \
NULL: \
((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \
DRIEntPrivIndex)->ptr)))
typedef struct _DRIScreenPrivRec {
Bool directRenderingSupport;
int drmFD; /* File descriptor for /dev/video/? */
drm_handle_t hSAREA; /* Handle to SAREA, for mapping */
XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */
drm_context_t myContext; /* DDX Driver's context */
DRIContextPrivPtr myContextPriv; /* Pointer to server's private area */
DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */
void **hiddenContextStore; /* hidden X context */
void **partial3DContextStore; /* partial 3D context */
DRIInfoPtr pDriverInfo;
int nrWindows;
int nrWindowsVisible;
int nrWalked;
drm_clip_rect_t private_buffer_rect; /* management of private buffers */
DrawablePtr fullscreen; /* pointer to fullscreen drawable */
drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
DRIWrappedFuncsRec wrap;
void *_dummy1; // required in place of a removed field for ABI compatibility
DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */
Bool createDummyCtx;
Bool createDummyCtxPriv;
Bool grabbedDRILock;
Bool drmSIGIOHandlerInstalled;
Bool wrapped;
Bool windowsTouched;
int lockRefCount;
drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */
XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */
int *pLockRefCount;
int *pLockingContext;
xf86_crtc_notify_proc_ptr xf86_crtc_notify;
} DRIScreenPrivRec, *DRIScreenPrivPtr;
typedef struct _DRIEntPrivRec {
int drmFD;
Bool drmOpened;
Bool sAreaGrabbed;
drm_handle_t hLSAREA;
XF86DRILSAREAPtr pLSAREA;
unsigned long sAreaSize;
int lockRefCount;
int lockingContext;
ScreenPtr resOwner;
Bool keepFDOpen;
int refCount;
} DRIEntPrivRec, *DRIEntPrivPtr;
#endif /* DRI_STRUCT_H */
+269
View File
@@ -0,0 +1,269 @@
/*
* edid.h: defines to parse an EDID block
*
* This file contains all information to interpret a standard EDIC block
* transmitted by a display device via DDC (Display Data Channel). So far
* there is no information to deal with optional EDID blocks.
* DDC is a Trademark of VESA (Video Electronics Standard Association).
*
* Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
*/
#ifndef _EDID_H_
#define _EDID_H_
#include <stdbool.h>
#include <stdint.h>
#include <X11/Xmd.h>
#include <X11/Xfuncproto.h>
#define STD_TIMINGS 8
#define DET_TIMINGS 4
/* input type */
#define DIGITAL(x) (x)
/* Msc stuff EDID Ver > 1.1 */
#define PREFERRED_TIMING_MODE(x) ((x) & 0x2)
#define GTF_SUPPORTED(x) ((x) & 0x1)
struct vendor {
char name[4];
int prod_id;
unsigned int serial;
int week;
int year;
};
struct edid_version {
int version;
int revision;
};
struct disp_features {
unsigned int input_type:1;
unsigned int input_voltage:2;
unsigned int input_setup:1;
unsigned int input_sync:5;
unsigned int input_dfp:1;
unsigned int input_bpc:3;
unsigned int input_interface:4;
/* 15 bit hole */
int hsize;
int vsize;
float gamma;
unsigned int dpms:3;
unsigned int display_type:2;
unsigned int msc:3;
float redx;
float redy;
float greenx;
float greeny;
float bluex;
float bluey;
float whitex;
float whitey;
};
struct established_timings {
uint8_t t1;
uint8_t t2;
uint8_t t_manu;
};
struct std_timings {
int hsize;
int vsize;
int refresh;
CARD16 id;
};
struct detailed_timings {
int clock;
int h_active;
int h_blanking;
int v_active;
int v_blanking;
int h_sync_off;
int h_sync_width;
int v_sync_off;
int v_sync_width;
int h_size;
int v_size;
int h_border;
int v_border;
unsigned int interlaced:1;
unsigned int stereo:2;
unsigned int sync:2;
unsigned int misc:2;
unsigned int stereo_1:1;
};
#define DT 0
#define DS_SERIAL 0xFF
#define DS_ASCII_STR 0xFE
#define DS_NAME 0xFC
#define DS_RANGES 0xFD
#define DS_WHITE_P 0xFB
#define DS_STD_TIMINGS 0xFA
#define DS_CMD 0xF9
#define DS_CVT 0xF8
#define DS_EST_III 0xF7
#define DS_DUMMY 0x10
#define DS_UNKOWN 0x100 /* type is an int */
#define DS_VENDOR 0x101
#define DS_VENDOR_MAX 0x110
/*
* Display range limit Descriptor of EDID version1, reversion 4
*/
typedef enum {
DR_DEFAULT_GTF,
DR_LIMITS_ONLY,
DR_SECONDARY_GTF,
DR_CVT_SUPPORTED = 4,
} DR_timing_flags;
struct monitor_ranges {
int min_v;
int max_v;
int min_h;
int max_h;
int max_clock; /* in mhz */
int gtf_2nd_f;
int gtf_2nd_c;
int gtf_2nd_m;
int gtf_2nd_k;
int gtf_2nd_j;
int max_clock_khz;
int maxwidth; /* in pixels */
char supported_aspect;
char preferred_aspect;
char supported_blanking;
char supported_scaling;
int preferred_refresh; /* in hz */
DR_timing_flags display_range_timing_flags;
};
struct whitePoints {
int index;
float white_x;
float white_y;
float white_gamma;
};
struct cvt_timings {
int width;
int height;
int rate;
int rates;
};
/*
* Be careful when adding new sections; this structure can't grow, it's
* embedded in the middle of xf86Monitor which is ABI. Sizes below are
* in bytes, for ILP32 systems. If all else fails just copy the section
* literally like serial and friends.
*/
struct detailed_monitor_section {
int type;
union {
struct detailed_timings d_timings; /* 56 */
uint8_t serial[13];
uint8_t ascii_data[13];
uint8_t name[13];
struct monitor_ranges ranges; /* 60 */
struct std_timings std_t[5]; /* 80 */
struct whitePoints wp[2]; /* 32 */
/* color management data */
struct cvt_timings cvt[4]; /* 64 */
uint8_t est_iii[6]; /* 6 */
} section; /* max: 80 */
};
/* flags */
#define MONITOR_EDID_COMPLETE_RAWDATA 0x01
/* old, don't use */
#define EDID_COMPLETE_RAWDATA 0x01
/**
* @brief The monitor_hdr_data hdr metadata struct
* This struct mirrors Table 92 - HDR Static Metadata Data Block (HDR SMDB) structure
*/
struct monitor_hdr_data {
bool hdr_valid : 1; /* static metadata v1 found, doesn't mean all fields are set */
bool colorimetry_valid : 1; /* if colorimetry tag found */
bool tf_traditional_sdr : 1,
tf_traditional_hdr : 1,
tf_pq : 1,
tf_hlg : 1,
tf_4 : 1,
tf_5 : 1;
unsigned int resv : 2; /* reserved bits */
float desired_content_min_luminance; /* in cd/m2, can be 0 */
float desired_content_max_luminance; /* in cd/m2, can be 0 */
float desired_content_max_frame_avg_luminance; /* in cd/m2, if unset 0 */
bool sm_static_metadata_type1 : 1;
unsigned int sm_1_7 : 7; /* reserved bits */
int reserved_1[4]; /* for future */
unsigned int colorimetry_profiles : 16;
int reserved_2[4]; /* for future */
};
#define CTA_HDR_SMDB_TF_SDR 1
#define CTA_HDR_SMDB_TF_HDR 2
#define CTA_HDR_SMDB_TF_ST2084 4
#define CTA_HDR_SMDB_TF_HLG 8
#define CTA_HDR_SMDB_SM_TYPE1 1
/* these constants are from Colorimetry Data Block (CDB) byte 3 and 4, converted into natural representation (big endian) uint16 */
#define is_CTA_CDB_BT2020_RGB(x) (((x) & 0x8000) == 0x8000)
#define is_CTA_CDB_BT2020_YCC(x) (((x) & 0x4000) == 0x4000)
#define is_CTA_CDB_BT2020_cYCC(x) (((x) & 0x2000) == 0x2000)
#define is_CTA_CDB_opRGB(x) (((x) & 0x1000) == 0x1000)
#define is_CTA_CDB_opYCC601(x) (((x) & 0x0800) == 0x0800)
#define is_CTA_CDB_sYCC601(x) (((x) & 0x0400) == 0x0400)
#define is_CTA_CDB_xvYCC709(x) (((x) & 0x0200) == 0x0200)
#define is_CTA_CDB_xvYCC601(x) (((x) & 0x0100) == 0x0100)
#define is_CTA_CDB_ST2113RGB(x) (((x) & 0x0080) == 0x0080)
#define is_CTA_CDB_iCtCp(x) (((x) & 0x0040) == 0x0040)
/*
* For DisplayID devices, only the scrnIndex, flags, and rawData fields
* are meaningful. For EDID, they all are.
*/
typedef struct {
int scrnIndex;
struct vendor vendor;
struct edid_version ver;
struct disp_features features;
struct established_timings timings1;
struct std_timings timings2[8];
struct detailed_monitor_section det_mon[4];
unsigned long flags;
int no_sections;
uint8_t *rawData;
struct monitor_hdr_data hdr;
} xf86Monitor, *xf86MonPtr;
extern _X_EXPORT xf86MonPtr ConfiguredMonitor;
/*
* check whether monitor supports Generalized Timing Formula
*
* @param monitor the monitor information structure to check
* @return true if GTF is supported by the monitor
*/
_X_EXPORT bool xf86Monitor_gtf_supported(xf86MonPtr monitor);
#endif /* _EDID_H_ */
+43
View File
@@ -0,0 +1,43 @@
/*
* Copyright © 2009 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#ifndef EVENTS_H
#define EVENTS_H
typedef struct _DeviceEvent DeviceEvent;
typedef struct _DeviceChangedEvent DeviceChangedEvent;
typedef struct _TouchOwnershipEvent TouchOwnershipEvent;
typedef struct _BarrierEvent BarrierEvent;
typedef struct _GestureEvent GestureEvent;
#ifdef XFreeXDGA
typedef struct _DGAEvent DGAEvent;
#endif
typedef struct _RawDeviceEvent RawDeviceEvent;
#ifdef XQUARTZ
typedef struct _XQuartzEvent XQuartzEvent;
#endif
typedef union _InternalEvent InternalEvent;
#endif
+811
View File
@@ -0,0 +1,811 @@
/*
*
* Copyright (C) 2000 Keith Packard
* 2004 Eric Anholt
* 2005 Zack Rusin
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of copyright holders not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Copyright holders make no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
/** @file
* This is the header containing the public API of EXA for exa drivers.
*/
#ifndef EXA_H
#define EXA_H
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "windowstr.h"
#include "gcstruct.h"
#include "picturestr.h"
#include "fb.h"
#define EXA_VERSION_MAJOR 2
#define EXA_VERSION_MINOR 6
#define EXA_VERSION_RELEASE 0
typedef struct _ExaOffscreenArea ExaOffscreenArea;
typedef void (*ExaOffscreenSaveProc) (ScreenPtr pScreen,
ExaOffscreenArea * area);
typedef enum _ExaOffscreenState {
ExaOffscreenAvail,
ExaOffscreenRemovable,
ExaOffscreenLocked
} ExaOffscreenState;
struct _ExaOffscreenArea {
int base_offset; /* allocation base */
int offset; /* aligned offset */
int size; /* total allocation size */
unsigned last_use;
void *privData;
ExaOffscreenSaveProc save;
ExaOffscreenState state;
ExaOffscreenArea *next;
unsigned eviction_cost;
ExaOffscreenArea *prev; /* Double-linked list for defragmentation */
int align; /* required alignment */
};
/**
* The ExaDriver structure is allocated through exaDriverAlloc(), and then
* fllled in by drivers.
*/
typedef struct _ExaDriver {
/**
* exa_major and exa_minor should be set by the driver to the version of
* EXA which the driver was compiled for (or configures itself at runtime
* to support). This allows EXA to extend the structure for new features
* without breaking ABI for drivers compiled against older versions.
*/
int exa_major, exa_minor;
/**
* memoryBase is the address of the beginning of framebuffer memory.
* The visible screen should be within memoryBase to memoryBase +
* memorySize.
*/
CARD8 *memoryBase;
/**
* offScreenBase is the offset from memoryBase of the beginning of the area
* to be managed by EXA's linear offscreen memory manager.
*
* In XFree86 DDX drivers, this is probably:
* (pScrn->displayWidth * cpp * pScrn->virtualY)
*/
unsigned long offScreenBase;
/**
* memorySize is the length (in bytes) of framebuffer memory beginning
* from memoryBase.
*
* The offscreen memory manager will manage the area beginning at
* (memoryBase + offScreenBase), with a length of (memorySize -
* offScreenBase)
*
* In XFree86 DDX drivers, this is probably (pScrn->videoRam * 1024)
*/
unsigned long memorySize;
/**
* pixmapOffsetAlign is the byte alignment necessary for pixmap offsets
* within framebuffer.
*
* Hardware typically has a required alignment of offsets, which may or may
* not be a power of two. EXA will ensure that pixmaps managed by the
* offscreen memory manager meet this alignment requirement.
*/
int pixmapOffsetAlign;
/**
* pixmapPitchAlign is the byte alignment necessary for pixmap pitches
* within the framebuffer.
*
* Hardware typically has a required alignment of pitches for acceleration.
* For 3D hardware, Composite acceleration often requires that source and
* mask pixmaps (textures) have a power-of-two pitch, which can be demanded
* using EXA_OFFSCREEN_ALIGN_POT. These pitch requirements only apply to
* pixmaps managed by the offscreen memory manager. Thus, it is up to the
* driver to ensure that the visible screen has an appropriate pitch for
* acceleration.
*/
int pixmapPitchAlign;
/**
* The flags field is bitfield of boolean values controlling EXA's behavior.
*
* The flags include EXA_OFFSCREEN_PIXMAPS, EXA_OFFSCREEN_ALIGN_POT, and
* EXA_TWO_BITBLT_DIRECTIONS.
*/
int flags;
/** @{ */
/**
* maxX controls the X coordinate limitation for rendering from the card.
* The driver should never receive a request for rendering beyond maxX
* in the X direction from the origin of a pixmap.
*/
int maxX;
/**
* maxY controls the Y coordinate limitation for rendering from the card.
* The driver should never receive a request for rendering beyond maxY
* in the Y direction from the origin of a pixmap.
*/
int maxY;
/** @} */
/* private */
ExaOffscreenArea *offScreenAreas;
Bool needsSync;
int lastMarker;
/** @name Solid
* @{
*/
/**
* PrepareSolid() sets up the driver for doing a solid fill.
* @param pPixmap Destination pixmap
* @param alu raster operation
* @param planemask write mask for the fill
* @param fg "foreground" color for the fill
*
* This call should set up the driver for doing a series of solid fills
* through the Solid() call. The alu raster op is one of the GX*
* graphics functions listed in X.h, and typically maps to a similar
* single-byte "ROP" setting in all hardware. The planemask controls
* which bits of the destination should be affected, and will only represent
* the bits up to the depth of pPixmap. The fg is the pixel value of the
* foreground color referred to in ROP descriptions.
*
* Note that many drivers will need to store some of the data in the driver
* private record, for sending to the hardware with each drawing command.
*
* The PrepareSolid() call is required of all drivers, but it may fail for any
* reason. Failure results in a fallback to software rendering.
*/
Bool (*PrepareSolid) (PixmapPtr pPixmap,
int alu, Pixel planemask, Pixel fg);
/**
* Solid() performs a solid fill set up in the last PrepareSolid() call.
*
* @param pPixmap destination pixmap
* @param x1 left coordinate
* @param y1 top coordinate
* @param x2 right coordinate
* @param y2 bottom coordinate
*
* Performs the fill set up by the last PrepareSolid() call, covering the
* area from (x1,y1) to (x2,y2) in pPixmap. Note that the coordinates are
* in the coordinate space of the destination pixmap, so the driver will
* need to set up the hardware's offset and pitch for the destination
* coordinates according to the pixmap's offset and pitch within
* framebuffer. This likely means using exaGetPixmapOffset() and
* exaGetPixmapPitch().
*
* This call is required if PrepareSolid() ever succeeds.
*/
void (*Solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2);
/**
* DoneSolid() finishes a set of solid fills.
*
* @param pPixmap destination pixmap.
*
* The DoneSolid() call is called at the end of a series of consecutive
* Solid() calls following a successful PrepareSolid(). This allows drivers
* to finish up emitting drawing commands that were buffered, or clean up
* state from PrepareSolid().
*
* This call is required if PrepareSolid() ever succeeds.
*/
void (*DoneSolid) (PixmapPtr pPixmap);
/** @} */
/** @name Copy
* @{
*/
/**
* PrepareCopy() sets up the driver for doing a copy within video
* memory.
*
* @param pSrcPixmap source pixmap
* @param pDstPixmap destination pixmap
* @param dx X copy direction
* @param dy Y copy direction
* @param alu raster operation
* @param planemask write mask for the fill
*
* This call should set up the driver for doing a series of copies from the
* the pSrcPixmap to the pDstPixmap. The dx flag will be positive if the
* hardware should do the copy from the left to the right, and dy will be
* positive if the copy should be done from the top to the bottom. This
* is to deal with self-overlapping copies when pSrcPixmap == pDstPixmap.
* If your hardware can only support blits that are (left to right, top to
* bottom) or (right to left, bottom to top), then you should set
* #EXA_TWO_BITBLT_DIRECTIONS, and EXA will break down Copy operations to
* ones that meet those requirements. The alu raster op is one of the GX*
* graphics functions listed in X.h, and typically maps to a similar
* single-byte "ROP" setting in all hardware. The planemask controls which
* bits of the destination should be affected, and will only represent the
* bits up to the depth of pPixmap.
*
* Note that many drivers will need to store some of the data in the driver
* private record, for sending to the hardware with each drawing command.
*
* The PrepareCopy() call is required of all drivers, but it may fail for any
* reason. Failure results in a fallback to software rendering.
*/
Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
PixmapPtr pDstPixmap,
int dx, int dy, int alu, Pixel planemask);
/**
* Copy() performs a copy set up in the last PrepareCopy call.
*
* @param pDstPixmap destination pixmap
* @param srcX source X coordinate
* @param srcY source Y coordinate
* @param dstX destination X coordinate
* @param dstY destination Y coordinate
* @param width width of the rectangle to be copied
* @param height height of the rectangle to be copied.
*
* Performs the copy set up by the last PrepareCopy() call, copying the
* rectangle from (srcX, srcY) to (srcX + width, srcY + width) in the source
* pixmap to the same-sized rectangle at (dstX, dstY) in the destination
* pixmap. Those rectangles may overlap in memory, if
* pSrcPixmap == pDstPixmap. Note that this call does not receive the
* pSrcPixmap as an argument -- if it's needed in this function, it should
* be stored in the driver private during PrepareCopy(). As with Solid(),
* the coordinates are in the coordinate space of each pixmap, so the driver
* will need to set up source and destination pitches and offsets from those
* pixmaps, probably using exaGetPixmapOffset() and exaGetPixmapPitch().
*
* This call is required if PrepareCopy ever succeeds.
*/
void (*Copy) (PixmapPtr pDstPixmap,
int srcX,
int srcY, int dstX, int dstY, int width, int height);
/**
* DoneCopy() finishes a set of copies.
*
* @param pPixmap destination pixmap.
*
* The DoneCopy() call is called at the end of a series of consecutive
* Copy() calls following a successful PrepareCopy(). This allows drivers
* to finish up emitting drawing commands that were buffered, or clean up
* state from PrepareCopy().
*
* This call is required if PrepareCopy() ever succeeds.
*/
void (*DoneCopy) (PixmapPtr pDstPixmap);
/** @} */
/** @name Composite
* @{
*/
/**
* CheckComposite() checks to see if a composite operation could be
* accelerated.
*
* @param op Render operation
* @param pSrcPicture source Picture
* @param pMaskPicture mask picture
* @param pDstPicture destination Picture
*
* The CheckComposite() call checks if the driver could handle acceleration
* of op with the given source, mask, and destination pictures. This allows
* drivers to check source and destination formats, supported operations,
* transformations, and component alpha state, and send operations it can't
* support to software rendering early on. This avoids costly pixmap
* migration to the wrong places when the driver can't accelerate
* operations. Note that because migration hasn't happened, the driver
* can't know during CheckComposite() what the offsets and pitches of the
* pixmaps are going to be.
*
* See PrepareComposite() for more details on likely issues that drivers
* will have in accelerating Composite operations.
*
* The CheckComposite() call is recommended if PrepareComposite() is
* implemented, but is not required.
*/
Bool (*CheckComposite) (int op,
PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture);
/**
* PrepareComposite() sets up the driver for doing a Composite operation
* described in the Render extension protocol spec.
*
* @param op Render operation
* @param pSrcPicture source Picture
* @param pMaskPicture mask picture
* @param pDstPicture destination Picture
* @param pSrc source pixmap
* @param pMask mask pixmap
* @param pDst destination pixmap
*
* This call should set up the driver for doing a series of Composite
* operations, as described in the Render protocol spec, with the given
* pSrcPicture, pMaskPicture, and pDstPicture. The pSrc, pMask, and
* pDst are the pixmaps containing the pixel data, and should be used for
* setting the offset and pitch used for the coordinate spaces for each of
* the Pictures.
*
* Notes on interpreting Picture structures:
* - The Picture structures will always have a valid pDrawable.
* - The Picture structures will never have alphaMap set.
* - The mask Picture (and therefore pMask) may be NULL, in which case the
* operation is simply src OP dst instead of src IN mask OP dst, and
* mask coordinates should be ignored.
* - pMarkPicture may have componentAlpha set, which greatly changes
* the behavior of the Composite operation. componentAlpha has no effect
* when set on pSrcPicture or pDstPicture.
* - The source and mask Pictures may have a transformation set
* (Picture->transform != NULL), which means that the source coordinates
* should be transformed by that transformation, resulting in scaling,
* rotation, etc. The PictureTransformPoint() call can transform
* coordinates for you. Transforms have no effect on Pictures when used
* as a destination.
* - The source and mask pictures may have a filter set. PictFilterNearest
* and PictFilterBilinear are defined in the Render protocol, but others
* may be encountered, and must be handled correctly (usually by
* PrepareComposite failing, and falling back to software). Filters have
* no effect on Pictures when used as a destination.
* - The source and mask Pictures may have repeating set, which must be
* respected. Many chipsets will be unable to support repeating on
* pixmaps that have a width or height that is not a power of two.
*
* If your hardware can't support source pictures (textures) with
* non-power-of-two pitches, you should set #EXA_OFFSCREEN_ALIGN_POT.
*
* Note that many drivers will need to store some of the data in the driver
* private record, for sending to the hardware with each drawing command.
*
* The PrepareComposite() call is not required. However, it is highly
* recommended for performance of antialiased font rendering and performance
* of cairo applications. Failure results in a fallback to software
* rendering.
*/
Bool (*PrepareComposite) (int op,
PicturePtr pSrcPicture,
PicturePtr pMaskPicture,
PicturePtr pDstPicture,
PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst);
/**
* Composite() performs a Composite operation set up in the last
* PrepareComposite() call.
*
* @param pDstPixmap destination pixmap
* @param srcX source X coordinate
* @param srcY source Y coordinate
* @param maskX source X coordinate
* @param maskY source Y coordinate
* @param dstX destination X coordinate
* @param dstY destination Y coordinate
* @param width destination rectangle width
* @param height destination rectangle height
*
* Performs the Composite operation set up by the last PrepareComposite()
* call, to the rectangle from (dstX, dstY) to (dstX + width, dstY + height)
* in the destination Pixmap. Note that if a transformation was set on
* the source or mask Pictures, the source rectangles may not be the same
* size as the destination rectangles and filtering. Getting the coordinate
* transformation right at the subpixel level can be tricky, and rendercheck
* can test this for you.
*
* This call is required if PrepareComposite() ever succeeds.
*/
void (*Composite) (PixmapPtr pDst,
int srcX,
int srcY,
int maskX,
int maskY, int dstX, int dstY, int width, int height);
/**
* DoneComposite() finishes a set of Composite operations.
*
* @param pPixmap destination pixmap.
*
* The DoneComposite() call is called at the end of a series of consecutive
* Composite() calls following a successful PrepareComposite(). This allows
* drivers to finish up emitting drawing commands that were buffered, or
* clean up state from PrepareComposite().
*
* This call is required if PrepareComposite() ever succeeds.
*/
void (*DoneComposite) (PixmapPtr pDst);
/** @} */
/**
* UploadToScreen() loads a rectangle of data from src into pDst.
*
* @param pDst destination pixmap
* @param x destination X coordinate.
* @param y destination Y coordinate
* @param width width of the rectangle to be copied
* @param height height of the rectangle to be copied
* @param src pointer to the beginning of the source data
* @param src_pitch pitch (in bytes) of the lines of source data.
*
* UploadToScreen() copies data in system memory beginning at src (with
* pitch src_pitch) into the destination pixmap from (x, y) to
* (x + width, y + height). This is typically done with hostdata uploads,
* where the CPU sets up a blit command on the hardware with instructions
* that the blit data will be fed through some sort of aperture on the card.
*
* If UploadToScreen() is performed asynchronously, it is up to the driver
* to call exaMarkSync(). This is in contrast to most other acceleration
* calls in EXA.
*
* UploadToScreen() can aid in pixmap migration, but is most important for
* the performance of exaGlyphs() (antialiased font drawing) by allowing
* pipelining of data uploads, avoiding a sync of the card after each glyph.
*
* @return TRUE if the driver successfully uploaded the data. FALSE
* indicates that EXA should fall back to doing the upload in software.
*
* UploadToScreen() is not required, but is recommended if Composite
* acceleration is supported.
*/
Bool (*UploadToScreen) (PixmapPtr pDst,
int x,
int y, int w, int h, char *src, int src_pitch);
/**
* UploadToScratch() is no longer used and will be removed next time the EXA
* major version needs to be bumped.
*/
Bool (*UploadToScratch) (PixmapPtr pSrc, PixmapPtr pDst);
/**
* DownloadFromScreen() loads a rectangle of data from pSrc into dst
*
* @param pSrc source pixmap
* @param x source X coordinate.
* @param y source Y coordinate
* @param width width of the rectangle to be copied
* @param height height of the rectangle to be copied
* @param dst pointer to the beginning of the destination data
* @param dst_pitch pitch (in bytes) of the lines of destination data.
*
* DownloadFromScreen() copies data from offscreen memory in pSrc from
* (x, y) to (x + width, y + height), to system memory starting at
* dst (with pitch dst_pitch). This would usually be done
* using scatter-gather DMA, supported by a DRM call, or by blitting to AGP
* and then synchronously reading from AGP. Because the implementation
* might be synchronous, EXA leaves it up to the driver to call
* exaMarkSync() if DownloadFromScreen() was asynchronous. This is in
* contrast to most other acceleration calls in EXA.
*
* DownloadFromScreen() can aid in the largest bottleneck in pixmap
* migration, which is the read from framebuffer when evicting pixmaps from
* framebuffer memory. Thus, it is highly recommended, even though
* implementations are typically complicated.
*
* @return TRUE if the driver successfully downloaded the data. FALSE
* indicates that EXA should fall back to doing the download in software.
*
* DownloadFromScreen() is not required, but is highly recommended.
*/
Bool (*DownloadFromScreen) (PixmapPtr pSrc,
int x, int y,
int w, int h, char *dst, int dst_pitch);
/**
* MarkSync() requests that the driver mark a synchronization point,
* returning an driver-defined integer marker which could be requested for
* synchronization to later in WaitMarker(). This might be used in the
* future to avoid waiting for full hardware stalls before accessing pixmap
* data with the CPU, but is not important in the current incarnation of
* EXA.
*
* Note that drivers should call exaMarkSync() when they have done some
* acceleration, rather than their own MarkSync() handler, as otherwise EXA
* will be unaware of the driver's acceleration and not sync to it during
* fallbacks.
*
* MarkSync() is optional.
*/
int (*MarkSync) (ScreenPtr pScreen);
/**
* WaitMarker() waits for all rendering before the given marker to have
* completed. If the driver does not implement MarkSync(), marker is
* meaningless, and all rendering by the hardware should be completed before
* WaitMarker() returns.
*
* Note that drivers should call exaWaitSync() to wait for all acceleration
* to finish, as otherwise EXA will be unaware of the driver having
* synchronized, resulting in excessive WaitMarker() calls.
*
* WaitMarker() is required of all drivers.
*/
void (*WaitMarker) (ScreenPtr pScreen, int marker);
/** @{ */
/**
* PrepareAccess() is called before CPU access to an offscreen pixmap.
*
* @param pPix the pixmap being accessed
* @param index the index of the pixmap being accessed.
*
* PrepareAccess() will be called before CPU access to an offscreen pixmap.
* This can be used to set up hardware surfaces for byteswapping or
* untiling, or to adjust the pixmap's devPrivate.ptr for the purpose of
* making CPU access use a different aperture.
*
* The index is one of #EXA_PREPARE_DEST, #EXA_PREPARE_SRC,
* #EXA_PREPARE_MASK, #EXA_PREPARE_AUX_DEST, #EXA_PREPARE_AUX_SRC, or
* #EXA_PREPARE_AUX_MASK. Since only up to #EXA_NUM_PREPARE_INDICES pixmaps
* will have PrepareAccess() called on them per operation, drivers can have
* a small, statically-allocated space to maintain state for PrepareAccess()
* and FinishAccess() in. Note that PrepareAccess() is only called once per
* pixmap and operation, regardless of whether the pixmap is used as a
* destination and/or source, and the index may not reflect the usage.
*
* PrepareAccess() may fail. An example might be the case of hardware that
* can set up 1 or 2 surfaces for CPU access, but not 3. If PrepareAccess()
* fails, EXA will migrate the pixmap to system memory.
* DownloadFromScreen() must be implemented and must not fail if a driver
* wishes to fail in PrepareAccess(). PrepareAccess() must not fail when
* pPix is the visible screen, because the visible screen can not be
* migrated.
*
* @return TRUE if PrepareAccess() successfully prepared the pixmap for CPU
* drawing.
* @return FALSE if PrepareAccess() is unsuccessful and EXA should use
* DownloadFromScreen() to mitigate the pixmap out.
*/
Bool (*PrepareAccess) (PixmapPtr pPix, int index);
/**
* FinishAccess() is called after CPU access to an offscreen pixmap.
*
* @param pPix the pixmap being accessed
* @param index the index of the pixmap being accessed.
*
* FinishAccess() will be called after finishing CPU access of an offscreen
* pixmap set up by PrepareAccess(). Note that the FinishAccess() will not be
* called if PrepareAccess() failed and the pixmap was migrated out.
*/
void (*FinishAccess) (PixmapPtr pPix, int index);
/**
* PixmapIsOffscreen() is an optional driver replacement to
* exaPixmapHasGpuCopy(). Set to NULL if you want the standard behaviour
* of exaPixmapHasGpuCopy().
*
* @param pPix the pixmap
* @return TRUE if the given drawable is in framebuffer memory.
*
* exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen
* memory, meaning that acceleration could probably be done to it, and that it
* will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
* with the CPU.
*
*
*/
Bool (*PixmapIsOffscreen) (PixmapPtr pPix);
/** @name PrepareAccess() and FinishAccess() indices
* @{
*/
/**
* EXA_PREPARE_DEST is the index for a pixmap that may be drawn to or
* read from.
*/
#define EXA_PREPARE_DEST 0
/**
* EXA_PREPARE_SRC is the index for a pixmap that may be read from
*/
#define EXA_PREPARE_SRC 1
/**
* EXA_PREPARE_SRC is the index for a second pixmap that may be read
* from.
*/
#define EXA_PREPARE_MASK 2
/**
* EXA_PREPARE_AUX* are additional indices for other purposes, e.g.
* separate alpha maps with Composite operations.
*/
#define EXA_PREPARE_AUX_DEST 3
#define EXA_PREPARE_AUX_SRC 4
#define EXA_PREPARE_AUX_MASK 5
#define EXA_NUM_PREPARE_INDICES 6
/** @} */
/**
* maxPitchPixels controls the pitch limitation for rendering from
* the card.
* The driver should never receive a request for rendering a pixmap
* that has a pitch (in pixels) beyond maxPitchPixels.
*
* Setting this field is optional -- if your hardware doesn't have
* a pitch limitation in pixels, don't set this. If neither this value
* nor maxPitchBytes is set, then maxPitchPixels is set to maxX.
* If set, it must not be smaller than maxX.
*
* @sa maxPitchBytes
*/
int maxPitchPixels;
/**
* maxPitchBytes controls the pitch limitation for rendering from
* the card.
* The driver should never receive a request for rendering a pixmap
* that has a pitch (in bytes) beyond maxPitchBytes.
*
* Setting this field is optional -- if your hardware doesn't have
* a pitch limitation in bytes, don't set this.
* If set, it must not be smaller than maxX * 4.
* There's no default value for maxPitchBytes.
*
* @sa maxPitchPixels
*/
int maxPitchBytes;
/* Hooks to allow driver to its own pixmap memory management */
void *(*CreatePixmap) (ScreenPtr pScreen, int size, int align);
void (*DestroyPixmap) (ScreenPtr pScreen, void *driverPriv);
/**
* Returning a pixmap with non-NULL devPrivate.ptr implies a pixmap which is
* not offscreen, which will never be accelerated and Prepare/FinishAccess won't
* be called.
*/
Bool (*ModifyPixmapHeader) (PixmapPtr pPixmap, int width, int height,
int depth, int bitsPerPixel, int devKind,
void *pPixData);
/* hooks for drivers with tiling support:
* driver MUST fill out new_fb_pitch with valid pitch of pixmap
*/
void *(*CreatePixmap2) (ScreenPtr pScreen, int width, int height,
int depth, int usage_hint, int bitsPerPixel,
int *new_fb_pitch);
/** @} */
Bool (*SharePixmapBacking)(PixmapPtr pPixmap, ScreenPtr secondary, void **handle_p);
Bool (*SetSharedPixmapBacking)(PixmapPtr pPixmap, void *handle);
} ExaDriverRec, *ExaDriverPtr;
/** @name EXA driver flags
* @{
*/
/**
* EXA_OFFSCREEN_PIXMAPS indicates to EXA that the driver can support
* offscreen pixmaps.
*/
#define EXA_OFFSCREEN_PIXMAPS (1 << 0)
/**
* EXA_OFFSCREEN_ALIGN_POT indicates to EXA that the driver needs pixmaps
* to have a power-of-two pitch.
*/
#define EXA_OFFSCREEN_ALIGN_POT (1 << 1)
/**
* EXA_TWO_BITBLT_DIRECTIONS indicates to EXA that the driver can only
* support copies that are (left-to-right, top-to-bottom) or
* (right-to-left, bottom-to-top).
*/
#define EXA_TWO_BITBLT_DIRECTIONS (1 << 2)
/**
* EXA_HANDLES_PIXMAPS indicates to EXA that the driver can handle
* all pixmap addressing and migration.
*/
#define EXA_HANDLES_PIXMAPS (1 << 3)
/**
* EXA_SUPPORTS_PREPARE_AUX indicates to EXA that the driver can handle the
* EXA_PREPARE_AUX* indices in the Prepare/FinishAccess hooks. If there are no
* such hooks, this flag has no effect.
*/
#define EXA_SUPPORTS_PREPARE_AUX (1 << 4)
/**
* EXA_SUPPORTS_OFFSCREEN_OVERLAPS indicates to EXA that the driver Copy hooks
* can handle the source and destination occupying overlapping offscreen memory
* areas. This allows the offscreen memory defragmentation code to defragment
* areas where the defragmented position overlaps the fragmented position.
*
* Typically this is supported by traditional 2D engines but not by 3D engines.
*/
#define EXA_SUPPORTS_OFFSCREEN_OVERLAPS (1 << 5)
/**
* EXA_MIXED_PIXMAPS will hide unacceleratable pixmaps from drivers and manage the
* problem known software fallbacks like trapezoids. This only migrates pixmaps one way
* into a driver pixmap and then pins it.
*/
#define EXA_MIXED_PIXMAPS (1 << 6)
/** @} */
/* in exa.c */
extern _X_EXPORT ExaDriverPtr exaDriverAlloc(void);
extern _X_EXPORT Bool
exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo);
extern _X_EXPORT void
exaDriverFini(ScreenPtr pScreen);
extern _X_EXPORT void
exaMarkSync(ScreenPtr pScreen);
extern _X_EXPORT void
exaWaitSync(ScreenPtr pScreen);
extern _X_EXPORT unsigned long
exaGetPixmapOffset(PixmapPtr pPix);
extern _X_EXPORT unsigned long
exaGetPixmapPitch(PixmapPtr pPix);
extern _X_EXPORT void *exaGetPixmapDriverPrivate(PixmapPtr p);
/* in exa_offscreen.c */
extern _X_EXPORT ExaOffscreenArea *exaOffscreenAlloc(ScreenPtr pScreen,
int size, int align,
Bool locked,
ExaOffscreenSaveProc save,
void *privData);
extern _X_EXPORT ExaOffscreenArea *exaOffscreenFree(ScreenPtr pScreen,
ExaOffscreenArea * area);
extern _X_EXPORT void
exaEnableDisableFBAccess(ScreenPtr pScreen, Bool enable);
extern _X_EXPORT Bool
exaDrawableIsOffscreen(DrawablePtr pDrawable);
/* in exa.c */
extern _X_EXPORT void
exaMoveInPixmap(PixmapPtr pPixmap);
/* in exa_unaccel.c */
extern _X_EXPORT CARD32
exaGetPixmapFirstPixel(PixmapPtr pPixmap);
/**
* Returns TRUE if the given planemask covers all the significant bits in the
* pixel values for pDrawable.
*/
#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
(((_pm) & FbFullMask((_pDrawable)->depth)) == \
FbFullMask((_pDrawable)->depth))
#endif /* EXA_H */
+125
View File
@@ -0,0 +1,125 @@
/************************************************************
Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of the above listed
copyright holder(s) not be used in advertising or publicity pertaining
to distribution of the software without specific, written prior
permission.
THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
/********************************************************************
* Interface of 'exevents.c'
*/
#ifndef EXEVENTS_H
#define EXEVENTS_H
#include <X11/extensions/XIproto.h>
#include "inputstr.h"
/***************************************************************
* Interface available to drivers *
***************************************************************/
/**
* Scroll flags for ::SetScrollValuator.
*/
enum ScrollFlags {
SCROLL_FLAG_NONE = 0,
/**
* Do not emulate legacy button events for valuator events on this axis.
*/
SCROLL_FLAG_DONT_EMULATE = (1 << 1),
/**
* This axis is the preferred axis for valuator emulation for this axis'
* scroll type.
*/
SCROLL_FLAG_PREFERRED = (1 << 2)
};
extern _X_EXPORT int InitProximityClassDeviceStruct(DeviceIntPtr /* dev */ );
extern _X_EXPORT Bool InitValuatorAxisStruct(DeviceIntPtr /* dev */ ,
int /* axnum */ ,
Atom /* label */ ,
int /* minval */ ,
int /* maxval */ ,
int /* resolution */ ,
int /* min_res */ ,
int /* max_res */ ,
int /* mode */ );
extern _X_EXPORT Bool SetScrollValuator(DeviceIntPtr /* dev */ ,
int /* axnum */ ,
enum ScrollType /* type */ ,
double /* increment */ ,
int /* flags */ );
extern _X_EXPORT int XIDeleteDeviceProperty(DeviceIntPtr /* device */ ,
Atom /* property */ ,
Bool /* fromClient */
);
extern _X_EXPORT int XIChangeDeviceProperty(DeviceIntPtr /* dev */ ,
Atom /* property */ ,
Atom /* type */ ,
int /* format */ ,
int /* mode */ ,
unsigned long /* len */ ,
const void * /* value */ ,
Bool /* sendevent */
);
extern _X_EXPORT int XIGetDeviceProperty(DeviceIntPtr /* dev */ ,
Atom /* property */ ,
XIPropertyValuePtr * /* value */
);
extern _X_EXPORT int XISetDevicePropertyDeletable(DeviceIntPtr /* dev */ ,
Atom /* property */ ,
Bool /* deletable */
);
extern _X_EXPORT long XIRegisterPropertyHandler(DeviceIntPtr dev,
int (*SetProperty) (DeviceIntPtr
dev,
Atom
property,
XIPropertyValuePtr
prop,
BOOL
checkonly),
int (*GetProperty) (DeviceIntPtr
dev,
Atom
property),
int (*DeleteProperty)
(DeviceIntPtr dev,
Atom property)
);
extern _X_EXPORT Atom XIGetKnownProperty(const char *name);
extern _X_EXPORT DeviceIntPtr XIGetDevice(xEvent *ev);
/****************************************************************************
* End of driver interface *
****************************************************************************/
#endif /* EXEVENTS_H */
@@ -0,0 +1,104 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifndef EXTENSION_H
#define EXTENSION_H
#include <X11/Xfuncproto.h>
#include "xlibre_ptrtypes.h"
#include "dixstruct.h"
typedef void (*InitExtension) (void);
typedef struct {
InitExtension initFunc;
const char *name;
Bool *disablePtr;
} ExtensionModule;
extern _X_EXPORT unsigned short StandardMinorOpcode(ClientPtr /*client */ );
extern _X_EXPORT Bool EnableDisableExtension(const char *name, Bool enable);
extern _X_EXPORT void EnableDisableExtensionError(const char *name,
Bool enable);
extern _X_EXPORT void InitExtensions(int argc, char **argv);
extern _X_EXPORT void CloseDownExtensions(void);
extern _X_EXPORT void LoadExtensionList(const ExtensionModule ext[],
int listSize, Bool external);
#endif /* EXTENSION_H */
@@ -0,0 +1,68 @@
/************************************************************
Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of the above listed
copyright holder(s) not be used in advertising or publicity pertaining
to distribution of the software without specific, written prior
permission.
THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
/*
* Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
* NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the XFree86 Project shall not
* be used in advertising or otherwise to promote the sale, use or other dealings
* in this Software without prior written authorization from the XFree86 Project.
*/
#ifndef EXTINIT_H
#define EXTINIT_H
#include "extnsionst.h"
/* required by: libglx */
extern _X_EXPORT Bool noCompositeExtension;
/* required by: several video drivers (eg. vmware, sis and nvidia proprietary) */
#ifdef XINERAMA
extern _X_EXPORT Bool noPanoramiXExtension;
#endif /* XINERAMA */
#if defined(XV)
extern _X_EXPORT Bool noXvExtension;
#endif
#endif
@@ -0,0 +1,98 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef EXTENSIONSTRUCT_H
#define EXTENSIONSTRUCT_H
#include "xlibre_ptrtypes.h"
#include "extension.h"
#include "privates.h"
typedef struct _ExtensionEntry {
int index;
void (*CloseDown) ( /* called at server shutdown */
struct _ExtensionEntry * /* extension */ );
const char *name; /* extension name */
int base; /* base request number */
int eventBase;
int eventLast;
int errorBase;
int errorLast;
void *extPrivate;
unsigned short (*MinorOpcode) ( /* called for errors */
ClientPtr /* client */ );
PrivateRec *devPrivates;
} ExtensionEntry;
/*
* The arguments may be different for extension event swapping functions.
* Deal with this by casting when initializing the event's EventSwapVector[]
* entries.
*/
typedef void (*EventSwapPtr) (xEvent *, xEvent *);
extern _X_EXPORT EventSwapPtr EventSwapVector[128];
extern _X_EXPORT void
NotImplemented( /* FIXME: this may move to another file... */
xEvent *, xEvent *) _X_NORETURN;
extern _X_EXPORT ExtensionEntry *
AddExtension(const char * /*name */ ,
int /*NumEvents */ ,
int /*NumErrors */ ,
int (* /*MainProc */ )(ClientPtr /*client */ ),
int (* /*SwappedMainProc */ )(ClientPtr /*client */ ),
void (* /*CloseDownProc */ )(ExtensionEntry * /*extension */ ),
unsigned short (* /*MinorOpcodeProc */ )(ClientPtr /*client */ )
);
extern _X_EXPORT ExtensionEntry *
CheckExtension(const char *extname);
extern _X_EXPORT ExtensionEntry *
GetExtensionEntry(int major);
#endif /* EXTENSIONSTRUCT_H */
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,56 @@
#ifndef _FBDEVHW_H_
#define _FBDEVHW_H_
#include "xf86str.h"
#define FBDEVHW_PACKED_PIXELS 0 /* Packed Pixels */
#define FBDEVHW_INTERLEAVED_PLANES 2 /* Interleaved planes */
#define FBDEVHW_TEXT 3 /* Text/attributes */
#define FBDEVHW_VGA_PLANES 4 /* EGA/VGA planes */
extern _X_EXPORT Bool fbdevHWProbe(struct pci_device *pPci, const char *device,
char **namep);
extern _X_EXPORT Bool fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device *pPci,
const char *device);
extern _X_EXPORT char *fbdevHWGetName(ScrnInfoPtr pScrn);
extern _X_EXPORT int fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp);
extern _X_EXPORT int fbdevHWGetLineLength(ScrnInfoPtr pScrn);
extern _X_EXPORT int fbdevHWGetType(ScrnInfoPtr pScrn);
extern _X_EXPORT int fbdevHWGetVidmem(ScrnInfoPtr pScrn);
extern _X_EXPORT void *fbdevHWMapVidmem(ScrnInfoPtr pScrn);
extern _X_EXPORT int fbdevHWLinearOffset(ScrnInfoPtr pScrn);
extern _X_EXPORT Bool fbdevHWUnmapVidmem(ScrnInfoPtr pScrn);
extern _X_EXPORT void *fbdevHWMapMMIO(ScrnInfoPtr pScrn);
extern _X_EXPORT Bool fbdevHWUnmapMMIO(ScrnInfoPtr pScrn);
extern _X_EXPORT void fbdevHWSetVideoModes(ScrnInfoPtr pScrn);
extern _X_EXPORT void fbdevHWUseBuildinMode(ScrnInfoPtr pScrn);
extern _X_EXPORT Bool fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
extern _X_EXPORT void fbdevHWSave(ScrnInfoPtr pScrn);
extern _X_EXPORT void fbdevHWRestore(ScrnInfoPtr pScrn);
extern _X_EXPORT void fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors,
int *indices, LOCO * colors,
VisualPtr pVisual);
extern _X_EXPORT ModeStatus fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode,
Bool verbose, int flags);
extern _X_EXPORT Bool fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
extern _X_EXPORT void fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
extern _X_EXPORT Bool fbdevHWEnterVT(ScrnInfoPtr pScrn);
extern _X_EXPORT void fbdevHWLeaveVT(ScrnInfoPtr pScrn);
extern _X_EXPORT void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags);
extern _X_EXPORT Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode);
extern _X_EXPORT xf86SwitchModeProc *fbdevHWSwitchModeWeak(void);
extern _X_EXPORT xf86AdjustFrameProc *fbdevHWAdjustFrameWeak(void);
extern _X_EXPORT xf86LeaveVTProc *fbdevHWLeaveVTWeak(void);
extern _X_EXPORT xf86ValidModeProc *fbdevHWValidModeWeak(void);
extern _X_EXPORT xf86DPMSSetProc *fbdevHWDPMSSetWeak(void);
extern _X_EXPORT xf86LoadPaletteProc *fbdevHWLoadPaletteWeak(void);
#endif
@@ -0,0 +1,76 @@
/*
*
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Keith Packard, SuSE, Inc.
*/
#ifndef _FBOVERLAY_H_
#define _FBOVERLAY_H_
#include "privates.h"
extern _X_EXPORT DevPrivateKey fbOverlayGetScreenPrivateKey(void);
#ifndef FB_OVERLAY_MAX
#define FB_OVERLAY_MAX 2
#endif
typedef void (*fbOverlayPaintKeyProc) (DrawablePtr, RegionPtr, CARD32, int);
typedef struct _fbOverlayLayer {
union {
struct {
void *pbits;
int width;
int depth;
} init;
struct {
PixmapPtr pixmap;
RegionRec region;
} run;
} u;
CARD32 key; /* special pixel value */
} FbOverlayLayer;
typedef struct _fbOverlayScrPriv {
int nlayers;
fbOverlayPaintKeyProc PaintKey;
miCopyProc CopyWindow;
FbOverlayLayer layer[FB_OVERLAY_MAX];
} FbOverlayScrPrivRec, *FbOverlayScrPrivPtr;
#define fbOverlayGetScrPriv(s) \
dixLookupPrivate(&(s)->devPrivates, fbOverlayGetScreenPrivateKey())
extern _X_EXPORT Bool
fbOverlayFinishScreenInit(ScreenPtr pScreen,
void *pbits1,
void *pbits2,
int xsize,
int ysize,
int dpix,
int dpiy,
int width1,
int width2,
int bpp1, int bpp2, int depth1, int depth2);
#endif /* _FBOVERLAY_H_ */
+45
View File
@@ -0,0 +1,45 @@
/*
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _FBPICT_H_
#define _FBPICT_H_
#include "fb.h"
/* fbpict.c */
extern _X_EXPORT void
fbComposite(CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
/* fbtrap.c */
extern _X_EXPORT void
fbAddTraps(PicturePtr pPicture,
INT16 xOff, INT16 yOff, int ntrap, xTrap * traps);
#endif /* _FBPICT_H_ */
+129
View File
@@ -0,0 +1,129 @@
/*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _FBROP_H_
#define _FBROP_H_
#include <X11/Xfuncproto.h>
typedef struct _mergeRopBits {
FbBits ca1, cx1, ca2, cx2;
} FbMergeRopRec, *FbMergeRopPtr;
extern _X_EXPORT const FbMergeRopRec FbMergeRopBits[16];
#define FbDeclareMergeRop() FbBits _ca1, _cx1, _ca2, _cx2;
#define FbDeclarePrebuiltMergeRop() FbBits _cca, _ccx;
#define FbInitializeMergeRop(alu,pm) {\
const FbMergeRopRec *_bits; \
_bits = &FbMergeRopBits[(alu)]; \
_ca1 = _bits->ca1 & (pm); \
_cx1 = _bits->cx1 | ~(pm); \
_ca2 = _bits->ca2 & (pm); \
_cx2 = _bits->cx2 & (pm); \
}
#define FbDestInvarientRop(alu,pm) ((pm) == FB_ALLONES && \
(((alu) >> 1 & 5) == ((alu) & 5)))
#define FbDestInvarientMergeRop() (_ca1 == 0 && _cx1 == 0)
/* AND has higher precedence than XOR */
#define FbDoMergeRop(src, dst) \
(((dst) & (((src) & _ca1) ^ _cx1)) ^ (((src) & _ca2) ^ _cx2))
#define FbDoDestInvarientMergeRop(src) (((src) & _ca2) ^ _cx2)
#define FbDoMaskMergeRop(src, dst, mask) \
(((dst) & ((((src) & _ca1) ^ _cx1) | ~(mask))) ^ ((((src) & _ca2) ^ _cx2) & (mask)))
#define FbDoLeftMaskByteMergeRop(dst, src, lb, l) { \
FbBits __xor = ((src) & _ca2) ^ _cx2; \
FbDoLeftMaskByteRRop((dst),(lb),(l),((src) & _ca1) ^ _cx1,__xor); \
}
#define FbDoRightMaskByteMergeRop(dst, src, rb, r) { \
FbBits __xor = ((src) & _ca2) ^ _cx2; \
FbDoRightMaskByteRRop((dst),(rb),(r),((src) & _ca1) ^ _cx1,__xor); \
}
#define FbDoRRop(dst, and, xor) (((dst) & (and)) ^ (xor))
#define FbDoMaskRRop(dst, and, xor, mask) \
(((dst) & ((and) | ~(mask))) ^ ((xor) & (mask)))
/*
* Take a single bit (0 or 1) and generate a full mask
*/
#define fbFillFromBit(b,t) (~((t) ((b) & 1)-1))
#define fbXorT(rop,fg,pm,t) ((((fg) & fbFillFromBit((rop) >> 1,t)) | \
(~(fg) & fbFillFromBit((rop) >> 3,t))) & (pm))
#define fbAndT(rop,fg,pm,t) ((((fg) & fbFillFromBit ((rop) ^ ((rop)>>1),t)) | \
(~(fg) & fbFillFromBit(((rop)>>2) ^ ((rop)>>3),t))) | \
~(pm))
#define fbXor(rop,fg,pm) fbXorT((rop),(fg),(pm),FbBits)
#define fbAnd(rop,fg,pm) fbAndT((rop),(fg),(pm),FbBits)
#define fbXorStip(rop,fg,pm) fbXorT((rop),(fg),(pm),FbStip)
#define fbAndStip(rop,fg,pm) fbAndT((rop),(fg),(pm),FbStip)
/*
* Stippling operations;
*/
#define FbStippleRRop(dst, b, fa, fx, ba, bx) \
(FbDoRRop((dst), (fa), (fx)) & (b)) | (FbDoRRop((dst), (ba), (bx)) & ~(b))
#define FbStippleRRopMask(dst, b, fa, fx, ba, bx, m) \
(FbDoMaskRRop((dst), (fa), (fx), (m)) & (b)) | (FbDoMaskRRop((dst), (ba), (bx), (m)) & ~(b))
#define FbDoLeftMaskByteStippleRRop(dst, b, fa, fx, ba, bx, lb, l) { \
FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \
FbDoLeftMaskByteRRop((dst), (lb), (l), ((fa) & (b)) | ((ba) & ~(b)), __xor); \
}
#define FbDoRightMaskByteStippleRRop(dst, b, fa, fx, ba, bx, rb, r) { \
FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \
FbDoRightMaskByteRRop((dst), (rb), (r), ((fa) & (b)) | ((ba) & ~(b)), __xor); \
}
#define FbOpaqueStipple(b, fg, bg) (((fg) & (b)) | ((bg) & ~(b)))
/*
* Compute rop for using tile code for 1-bit dest stipples; modifies
* existing rop to flip depending on pixel values
*/
#define FbStipple1RopPick(alu,b) (((alu) >> (2 - (((b) & 1) << 1))) & 3)
#define FbOpaqueStipple1Rop(alu,fg,bg) (FbStipple1RopPick((alu),(fg)) | \
(FbStipple1RopPick((alu),(bg)) << 2))
#define FbStipple1Rop(alu,fg) (FbStipple1RopPick((alu),(fg)) | 4)
#endif
@@ -0,0 +1,15 @@
/* SPDX-License-Identifier: X11 OR MIT OR AGPL-3.0-or-later
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*
* @brief: defines needed for SetNotifyFd() as well as ospoll
*/
#ifndef _XSERVER_INCLUDE_FDNOTIFY_H
#define _XSERVER_INCLUDE_FDNOTIFY_H
#define X_NOTIFY_NONE 0x0
#define X_NOTIFY_READ 0x1
#define X_NOTIFY_WRITE 0x2
#define X_NOTIFY_ERROR 0x4 /* don't need to select for, always reported */
#endif /* _XSERVER_INCLUDE_FDNOTIFY_H */
+218
View File
@@ -0,0 +1,218 @@
/*
* Copyright (c) 2000-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
This header file contains listings of STANDARD guids for video formats.
Please do not place non-registered, or incomplete entries in this file.
A list of some popular fourcc's are at: http://www.webartz.com/fourcc/
For an explanation of fourcc <-> guid mappings see RFC2361.
*/
#ifndef _XF86_FOURCC_H_
#define _XF86_FOURCC_H_ 1
#define FOURCC_YUY2 0x32595559
#define XVIMAGE_YUY2 \
{ \
FOURCC_YUY2, \
XvYUV, \
LSBFirst, \
{'Y','U','Y','2', \
0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
16, \
XvPacked, \
1, \
0, 0, 0, 0, \
8, 8, 8, \
1, 2, 2, \
1, 1, 1, \
{'Y','U','Y','V', \
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
XvTopToBottom \
}
#define FOURCC_YV12 0x32315659
#define XVIMAGE_YV12 \
{ \
FOURCC_YV12, \
XvYUV, \
LSBFirst, \
{'Y','V','1','2', \
0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
12, \
XvPlanar, \
3, \
0, 0, 0, 0, \
8, 8, 8, \
1, 2, 2, \
1, 2, 2, \
{'Y','V','U', \
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
XvTopToBottom \
}
#define FOURCC_I420 0x30323449
#define XVIMAGE_I420 \
{ \
FOURCC_I420, \
XvYUV, \
LSBFirst, \
{'I','4','2','0', \
0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
12, \
XvPlanar, \
3, \
0, 0, 0, 0, \
8, 8, 8, \
1, 2, 2, \
1, 2, 2, \
{'Y','U','V', \
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
XvTopToBottom \
}
#define FOURCC_UYVY 0x59565955
#define XVIMAGE_UYVY \
{ \
FOURCC_UYVY, \
XvYUV, \
LSBFirst, \
{'U','Y','V','Y', \
0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
16, \
XvPacked, \
1, \
0, 0, 0, 0, \
8, 8, 8, \
1, 2, 2, \
1, 1, 1, \
{'U','Y','V','Y', \
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
XvTopToBottom \
}
#define FOURCC_IA44 0x34344149
#define XVIMAGE_IA44 \
{ \
FOURCC_IA44, \
XvYUV, \
LSBFirst, \
{'I','A','4','4', \
0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
8, \
XvPacked, \
1, \
0, 0, 0, 0, \
8, 8, 8, \
1, 1, 1, \
1, 1, 1, \
{'A','I', \
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
XvTopToBottom \
}
#define FOURCC_AI44 0x34344941
#define XVIMAGE_AI44 \
{ \
FOURCC_AI44, \
XvYUV, \
LSBFirst, \
{'A','I','4','4', \
0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
8, \
XvPacked, \
1, \
0, 0, 0, 0, \
8, 8, 8, \
1, 1, 1, \
1, 1, 1, \
{'I','A', \
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
XvTopToBottom \
}
#define FOURCC_NV12 0x3231564e
#define XVIMAGE_NV12 \
{ \
FOURCC_NV12, \
XvYUV, \
LSBFirst, \
{'N','V','1','2', \
0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
12, \
XvPlanar, \
2, \
0, 0, 0, 0, \
8, 8, 8, \
1, 2, 2, \
1, 2, 2, \
{'Y','U','V', \
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
XvTopToBottom \
}
#define FOURCC_RGBA32 0x41424752
#define XVIMAGE_RGB32 \
{ \
FOURCC_RGBA32, \
XvRGB, \
LSBFirst, \
{'R','A','2','4', \
0x00, 0x00, 0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
32, \
XvPacked, \
1, \
32, 0xff0000, 0xff00, 0xff, \
0, 0, 0, \
0, 0, 0, \
0, 0, 0, \
{0,0,0,0, \
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
0 \
}
#define FOURCC_RGB565 0x36314752
#define XVIMAGE_RGB565 \
{ \
FOURCC_RGB565, \
XvRGB, \
LSBFirst, \
{'R','G','1','6', \
0x00, 0x00, 0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
16, \
XvPacked, \
1, \
16, 0xf800, 0x7e0, 0x1f, \
0, 0, 0, \
0, 0, 0, \
0, 0, 0, \
{0,0,0,0, \
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
0 \
}
#endif /* _XF86_FOURCC_H_ */
+96
View File
@@ -0,0 +1,96 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef GC_H
#define GC_H
#include <X11/X.h> /* for GContext, Mask */
#include <X11/Xdefs.h> /* for Bool */
#include <X11/Xproto.h>
#include "screenint.h" /* for ScreenPtr */
#include "pixmap.h" /* for DrawablePtr */
/* clientClipType field in GC */
#define CT_NONE 0
#define CT_PIXMAP 1
#define CT_REGION 2
#define CT_UNSORTED 6
#define CT_YSORTED 10
#define CT_YXSORTED 14
#define CT_YXBANDED 18
#define GC_CHANGE_SERIAL_BIT (((unsigned long)1)<<31)
#define DRAWABLE_SERIAL_BITS (~(GC_CHANGE_SERIAL_BIT))
#define MAX_SERIAL_NUM (1L<<28)
#define NEXT_SERIAL_NUMBER ((++globalSerialNumber) > MAX_SERIAL_NUM ? \
(globalSerialNumber = 1): globalSerialNumber)
typedef struct _GCInterest *GCInterestPtr;
typedef struct _GC *GCPtr;
typedef struct _GCOps *GCOpsPtr;
extern _X_EXPORT void ValidateGC(DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ );
typedef union {
CARD32 val;
void *ptr;
} ChangeGCVal, *ChangeGCValPtr;
extern _X_EXPORT int ChangeGC(ClientPtr /*client */ ,
GCPtr /*pGC */ ,
BITS32 /*mask */ ,
ChangeGCValPtr /*pCGCV */ );
extern _X_EXPORT GCPtr GetScratchGC(unsigned /*depth */ ,
ScreenPtr /*pScreen */ );
extern _X_EXPORT void FreeScratchGC(GCPtr /*pGC */ );
#endif /* GC_H */
+286
View File
@@ -0,0 +1,286 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef GCSTRUCT_H
#define GCSTRUCT_H
#include <X11/Xprotostr.h>
#include "gc.h"
#include "pixmap.h"
#include "regionstr.h"
#include "screenint.h"
#include "privates.h"
#ifndef _XTYPEDEF_CHARINFOPTR
typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */
#define _XTYPEDEF_CHARINFOPTR
#endif
/*
* functions which modify the state of the GC
*/
typedef struct _GCFuncs {
void (*ValidateGC) (GCPtr /*pGC */ ,
unsigned long /*stateChanges */ ,
DrawablePtr /*pDrawable */ );
void (*ChangeGC) (GCPtr /*pGC */ ,
unsigned long /*mask */ );
void (*CopyGC) (GCPtr /*pGCSrc */ ,
unsigned long /*mask */ ,
GCPtr /*pGCDst */ );
void (*DestroyGC) (GCPtr /*pGC */ );
void (*ChangeClip) (GCPtr pGC,
int type,
void *pvalue,
int nrects);
void (*DestroyClip) (GCPtr /*pGC */ );
void (*CopyClip) (GCPtr /*pgcDst */ ,
GCPtr /*pgcSrc */ );
} GCFuncs;
/*
* graphics operations invoked through a GC
*/
typedef struct _GCOps {
void (*FillSpans) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*nInit */ ,
DDXPointPtr /*pptInit */ ,
int * /*pwidthInit */ ,
int /*fSorted */ );
void (*SetSpans) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
char * /*psrc */ ,
DDXPointPtr /*ppt */ ,
int * /*pwidth */ ,
int /*nspans */ ,
int /*fSorted */ );
void (*PutImage) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*depth */ ,
int /*x */ ,
int /*y */ ,
int /*w */ ,
int /*h */ ,
int /*leftPad */ ,
int /*format */ ,
char * /*pBits */ );
RegionPtr (*CopyArea) (DrawablePtr /*pSrc */ ,
DrawablePtr /*pDst */ ,
GCPtr /*pGC */ ,
int /*srcx */ ,
int /*srcy */ ,
int /*w */ ,
int /*h */ ,
int /*dstx */ ,
int /*dsty */ );
RegionPtr (*CopyPlane) (DrawablePtr /*pSrcDrawable */ ,
DrawablePtr /*pDstDrawable */ ,
GCPtr /*pGC */ ,
int /*srcx */ ,
int /*srcy */ ,
int /*width */ ,
int /*height */ ,
int /*dstx */ ,
int /*dsty */ ,
unsigned long /*bitPlane */ );
void (*PolyPoint) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*mode */ ,
int /*npt */ ,
DDXPointPtr /*pptInit */ );
void (*Polylines) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*mode */ ,
int /*npt */ ,
DDXPointPtr /*pptInit */ );
void (*PolySegment) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*nseg */ ,
xSegment * /*pSegs */ );
void (*PolyRectangle) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*nrects */ ,
xRectangle * /*pRects */ );
void (*PolyArc) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*narcs */ ,
xArc * /*parcs */ );
void (*FillPolygon) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*shape */ ,
int /*mode */ ,
int /*count */ ,
DDXPointPtr /*pPts */ );
void (*PolyFillRect) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*nrectFill */ ,
xRectangle * /*prectInit */ );
void (*PolyFillArc) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*narcs */ ,
xArc * /*parcs */ );
int (*PolyText8) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*x */ ,
int /*y */ ,
int /*count */ ,
char * /*chars */ );
int (*PolyText16) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*x */ ,
int /*y */ ,
int /*count */ ,
unsigned short * /*chars */ );
void (*ImageText8) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*x */ ,
int /*y */ ,
int /*count */ ,
char * /*chars */ );
void (*ImageText16) (DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*x */ ,
int /*y */ ,
int /*count */ ,
unsigned short * /*chars */ );
void (*ImageGlyphBlt) (DrawablePtr pDrawable,
GCPtr pGC,
int x,
int y,
unsigned int nglyph,
CharInfoPtr *ppci,
void *pglyphBase);
void (*PolyGlyphBlt) (DrawablePtr pDrawable,
GCPtr pGC,
int x,
int y,
unsigned int nglyph,
CharInfoPtr *ppci,
void *pglyphBase);
void (*PushPixels) (GCPtr /*pGC */ ,
PixmapPtr /*pBitMap */ ,
DrawablePtr /*pDst */ ,
int /*w */ ,
int /*h */ ,
int /*x */ ,
int /*y */ );
} GCOps;
/* there is padding in the bit fields because the Sun compiler doesn't
* force alignment to 32-bit boundaries. losers.
*/
typedef struct _GC {
ScreenPtr pScreen;
unsigned char depth;
unsigned char alu;
unsigned short lineWidth;
unsigned short dashOffset;
unsigned short numInDashList;
unsigned char *dash;
unsigned int lineStyle:2;
unsigned int capStyle:2;
unsigned int joinStyle:2;
unsigned int fillStyle:2;
unsigned int fillRule:1;
unsigned int arcMode:1;
unsigned int subWindowMode:1;
unsigned int graphicsExposures:1;
unsigned int miTranslate:1; /* should mi things translate? */
unsigned int tileIsPixel:1; /* tile is solid pixel */
unsigned int fExpose:1; /* Call exposure handling */
unsigned int freeCompClip:1; /* Free composite clip */
unsigned int scratch_inuse:1; /* is this GC in a pool for reuse? */
unsigned int unused:15; /* see comment above */
unsigned int planemask;
unsigned int fgPixel;
unsigned int bgPixel;
/*
* alas -- both tile and stipple must be here as they
* are independently specifiable
*/
PixUnion tile;
PixmapPtr stipple;
xPoint patOrg; /* origin for (tile, stipple) */
xPoint clipOrg;
struct _Font *font;
RegionPtr clientClip;
unsigned int stateChanges; /* masked with GC_<kind> */
unsigned int serialNumber;
const GCFuncs *funcs;
const GCOps *ops;
PrivateRec *devPrivates;
RegionPtr pCompositeClip;
} GCRec;
#endif /* GCSTRUCT_H */
+427
View File
@@ -0,0 +1,427 @@
/*
* Copyright © 2008 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* Authors:
* Eric Anholt <eric@anholt.net>
* Zhigang Gong <zhigang.gong@linux.intel.com>
*
*/
#ifndef GLAMOR_H
#define GLAMOR_H
#include <scrnintstr.h>
#include <pixmapstr.h>
#include <gcstruct.h>
#include <picturestr.h>
#include <fb.h>
#ifdef GLAMOR_FOR_XORG
#include <xf86xv.h>
#endif
struct glamor_context;
struct gbm_bo;
struct gbm_device;
/*
* glamor_pixmap_type : glamor pixmap's type.
* @MEMORY: pixmap is in memory.
* @TEXTURE_DRM: pixmap is in a texture created from a DRM buffer.
* @SEPARATE_TEXTURE: The texture is created from a DRM buffer, but
* the format is incompatible, so this type of pixmap
* will never fallback to DDX layer.
* @DRM_ONLY: pixmap is in a external DRM buffer.
* @TEXTURE_ONLY: pixmap is in an internal texture.
*/
typedef enum glamor_pixmap_type {
GLAMOR_MEMORY = 0, /* Newly calloc()ed pixmaps are memory. */
GLAMOR_TEXTURE_DRM,
GLAMOR_DRM_ONLY,
GLAMOR_TEXTURE_ONLY,
} glamor_pixmap_type_t;
typedef Bool (*GetDrawableModifiersFuncPtr) (DrawablePtr draw,
uint32_t format,
uint32_t *num_modifiers,
uint64_t **modifiers);
#define GLAMOR_EGL_EXTERNAL_BUFFER 3
#define GLAMOR_USE_EGL_SCREEN (1 << 0)
#define GLAMOR_NO_DRI3 (1 << 1)
#define GLAMOR_NO_RENDER_ACCEL (1 << 2)
#define GLAMOR_VALID_FLAGS (GLAMOR_USE_EGL_SCREEN \
| GLAMOR_NO_DRI3 \
| GLAMOR_NO_RENDER_ACCEL)
/* until we need geometry shaders GL3.1 should suffice. */
#define GLAMOR_GL_CORE_VER_MAJOR 3
#define GLAMOR_GL_CORE_VER_MINOR 1
/* @glamor_init: Initialize glamor internal data structure.
*
* @screen: Current screen pointer.
* @flags: Please refer the flags description above.
*
* @GLAMOR_USE_EGL_SCREEN:
* If you are using EGL layer, then please set this bit
* on, otherwise, clear it.
*
* @GLAMOR_NO_DRI3
* Disable the built-in DRI3 support
*
* This function initializes necessary internal data structure
* for glamor. And before calling into this function, the OpenGL
* environment should be ready. Should be called before any real
* glamor rendering or texture allocation functions. And should
* be called after the DDX's screen initialization or at the last
* step of the DDX's screen initialization.
*/
extern _X_EXPORT Bool glamor_init(ScreenPtr screen, unsigned int flags);
extern _X_EXPORT void glamor_fini(ScreenPtr screen);
/* Returns is the initialized gl context is gles
* Must not be called before glamor_init
*/
extern _X_EXPORT Bool glamor_is_gles(ScreenPtr screen);
/* This function is used to free the glamor private screen's
* resources. If the DDX driver is not set GLAMOR_USE_SCREEN,
* then, DDX need to call this function at proper stage, if
* it is the xorg DDX driver,then it should be called at free
* screen stage not the close screen stage. The reason is after
* call to this function, the xorg DDX may need to destroy the
* screen pixmap which must be a glamor pixmap and requires
* the internal data structure still exist at that time.
* Otherwise, the glamor internal structure will not be freed.*/
extern _X_EXPORT uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap);
extern _X_EXPORT void glamor_clear_pixmap(PixmapPtr pixmap);
extern _X_EXPORT void glamor_block_handler(ScreenPtr screen);
extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h,
int depth, unsigned int usage);
/* needed by Xrdp module */
#define GLAMOR_CREATE_PIXMAP_CPU 0x100
#define GLAMOR_CREATE_PIXMAP_FIXUP 0x101
#define GLAMOR_CREATE_FBO_NO_FBO 0x103
#define GLAMOR_CREATE_NO_LARGE 0x105
#define GLAMOR_CREATE_PIXMAP_NO_TEXTURE 0x106
#define GLAMOR_CREATE_FORMAT_CBCR 0x107
/* @glamor_egl_exchange_buffers: Exchange the underlying buffers(KHR image,fbo).
*
* @front: front pixmap.
* @back: back pixmap.
*
* Used by the DRI2 page flip. This function will exchange the KHR images and
* fbos of the two pixmaps.
* */
extern _X_EXPORT void glamor_egl_exchange_buffers(PixmapPtr front,
PixmapPtr back);
extern _X_EXPORT struct gbm_device *glamor_egl_get_gbm_device(ScreenPtr screen);
/* @glamor_supports_pixmap_import_export: Returns whether
* glamor_fds_from_pixmap(), glamor_name_from_pixmap(), and
* glamor_pixmap_from_fds() are supported.
*
* @screen: Current screen pointer.
*
* To have DRI3 support enabled, glamor and glamor_egl need to be
* initialized. glamor also has to be compiled with gbm support.
*
* The EGL layer needs to have the following extensions working:
*
* .EGL_KHR_surfaceless_context
* */
extern _X_EXPORT Bool glamor_supports_pixmap_import_export(ScreenPtr screen);
/* @glamor_fds_from_pixmap: Get a dma-buf fd from a pixmap.
*
* @screen: Current screen pointer.
* @pixmap: The pixmap from which we want the fd.
* @fds, @strides, @offsets: Pointers to fill info of each plane.
* @modifier: Pointer to fill the modifier of the buffer.
*
* the pixmap and the buffer associated by the fds will share the same
* content. The caller is responsible to close the returned file descriptors.
* Returns the number of planes, -1 on error.
*
* Currently just exported for Xrdp's virtual driver - real HW drivers
* usually shouldn't need this.
* */
_X_EXPORT int glamor_fds_from_pixmap(ScreenPtr screen,
PixmapPtr pixmap,
int *fds,
uint32_t *strides,
uint32_t *offsets,
uint64_t *modifier);
/* @glamor_fd_from_pixmap: Get a dma-buf fd from a pixmap.
*
* @screen: Current screen pointer.
* @pixmap: The pixmap from which we want the fd.
* @stride, @size: Pointers to fill the stride and size of the
* buffer associated to the fd.
*
* the pixmap and the buffer associated by the fd will share the same
* content.
* Returns the fd on success, -1 on error.
* */
extern _X_EXPORT int glamor_fd_from_pixmap(ScreenPtr screen,
PixmapPtr pixmap,
CARD16 *stride, CARD32 *size);
/* @glamor_shareable_fd_from_pixmap: Get a dma-buf fd suitable for sharing
* with other GPUs from a pixmap.
*
* @screen: Current screen pointer.
* @pixmap: The pixmap from which we want the fd.
* @stride, @size: Pointers to fill the stride and size of the
* buffer associated to the fd.
*
* The returned fd will point to a buffer which is suitable for sharing
* across GPUs (not using GPU specific tiling).
* The pixmap and the buffer associated by the fd will share the same
* content.
* The pixmap's stride may be modified by this function.
* Returns the fd on success, -1 on error.
* */
extern _X_EXPORT int glamor_shareable_fd_from_pixmap(ScreenPtr screen,
PixmapPtr pixmap,
CARD16 *stride,
CARD32 *size);
/**
* @glamor_name_from_pixmap: Gets a gem name from a pixmap.
*
* @pixmap: The pixmap from which we want the gem name.
*
* the pixmap and the buffer associated by the gem name will share the
* same content. This function can be used by the DDX to support DRI2,
* and needs the same set of buffer export GL extensions as DRI3
* support.
*
* Returns the name on success, -1 on error.
* */
extern _X_EXPORT int glamor_name_from_pixmap(PixmapPtr pixmap,
CARD16 *stride, CARD32 *size);
/* @glamor_gbm_bo_from_pixmap: Get a GBM bo from a pixmap.
*
* @screen: Current screen pointer.
* @pixmap: The pixmap from which we want the fd.
* @stride, @size: Pointers to fill the stride and size of the
* buffer associated to the fd.
*
* the pixmap and the buffer represented by the gbm_bo will share the same
* content.
*
* Returns the gbm_bo on success, NULL on error.
* */
extern _X_EXPORT struct gbm_bo *glamor_gbm_bo_from_pixmap(ScreenPtr screen,
PixmapPtr pixmap);
/* @glamor_pixmap_from_fds: Creates a pixmap to wrap a dma-buf fds.
*
* @screen: Current screen pointer.
* @num_fds: Number of fds to import
* @fds: The dma-buf fds to import.
* @width: The width of the buffers.
* @height: The height of the buffers.
* @stride: The stride of the buffers.
* @depth: The depth of the buffers.
* @bpp: The bpp of the buffers.
* @modifier: The modifier of the buffers.
*
* Returns a valid pixmap if the import succeeded, else NULL.
*
* Currently just exported for Xrdp's virtual driver - real HW drivers
* usually shouldn't need this.
* */
_X_EXPORT PixmapPtr glamor_pixmap_from_fds(ScreenPtr screen,
CARD8 num_fds,
const int *fds,
CARD16 width,
CARD16 height,
const CARD32 *strides,
const CARD32 *offsets,
CARD8 depth,
CARD8 bpp,
uint64_t modifier);
/* @glamor_pixmap_from_fd: Creates a pixmap to wrap a dma-buf fd.
*
* @screen: Current screen pointer.
* @fd: The dma-buf fd to import.
* @width: The width of the buffer.
* @height: The height of the buffer.
* @stride: The stride of the buffer.
* @depth: The depth of the buffer.
* @bpp: The bpp of the buffer.
*
* Returns a valid pixmap if the import succeeded, else NULL.
* */
extern _X_EXPORT PixmapPtr glamor_pixmap_from_fd(ScreenPtr screen,
int fd,
CARD16 width,
CARD16 height,
CARD16 stride,
CARD8 depth,
CARD8 bpp);
/* @glamor_back_pixmap_from_fd: Backs an existing pixmap with a dma-buf fd.
*
* @pixmap: Pixmap to change backing for
* @fd: The dma-buf fd to import.
* @width: The width of the buffer.
* @height: The height of the buffer.
* @stride: The stride of the buffer.
* @depth: The depth of the buffer.
* @bpp: The number of bpp of the buffer.
*
* Returns TRUE if successful, FALSE on failure.
* */
extern _X_EXPORT Bool glamor_back_pixmap_from_fd(PixmapPtr pixmap,
int fd,
CARD16 width,
CARD16 height,
CARD16 stride,
CARD8 depth,
CARD8 bpp);
/* for xorgrdp */
_X_EXPORT Bool glamor_get_formats(ScreenPtr screen,
CARD32 *num_formats,
CARD32 **formats);
/* for xorgrdp */
_X_EXPORT Bool glamor_get_modifiers(ScreenPtr screen,
uint32_t format,
uint32_t *num_modifiers,
uint64_t **modifiers);
/* for xorgrdp */
_X_EXPORT Bool glamor_get_drawable_modifiers(DrawablePtr draw,
uint32_t format,
uint32_t *num_modifiers,
uint64_t **modifiers);
extern _X_EXPORT void glamor_set_drawable_modifiers_func(ScreenPtr screen,
GetDrawableModifiersFuncPtr func);
#define GLAMOR_EGL_MODULE_NAME "glamoregl"
/* @glamor_egl_init: Initialize EGL environment.
*
* @scrn: Current screen info pointer.
* @fd: Current drm fd.
*
* This function creates and initializes EGL contexts.
* Should be called from DDX's preInit function.
* Return TRUE if success, otherwise return FALSE.
* */
extern _X_EXPORT Bool glamor_egl_init(ScrnInfoPtr scrn, int fd);
enum {
GLAMOR_EGL_CAP_NONE = 0,
GLAMOR_EGL_CAP_DRI3 = 1 << 0,
GLAMOR_EGL_CAP_DRI3_IMPORT = 1 << 1,
GLAMOR_EGL_CAP_DRI3_EXPORT = 1 << 2,
GLAMOR_EGL_CAP_DRI3_SYNCOBJ = 1 << 3,
GLAMOR_EGL_CAP_TEXTURE_GBM_BO = 1 << 4,
};
#define GLAMOR_EGL_DEFAULT_CAPS (GLAMOR_EGL_CAP_DRI3 | GLAMOR_EGL_CAP_DRI3_IMPORT | GLAMOR_EGL_CAP_DRI3_EXPORT | GLAMOR_EGL_CAP_TEXTURE_GBM_BO)
/* @glamor_egl_init2: Initialize EGL environment.
*
* @scrn: Current screen info pointer.
* @fd: Current drm fd.
* @caps: Some capabilities that glamor can have
*
* This function creates and initializes EGL contexts.
* Should be called from DDX's preInit function.
* Return TRUE if success, otherwise return FALSE.
*
* Unlike glamor_egl_init, this function returns true
* even if some capabilities are missing.
*
* If caps is not NULL, it is set to a bitmask
* describing what glamor capabilites are available.
* */
extern _X_EXPORT Bool glamor_egl_init2(ScrnInfoPtr scrn, int fd, int *caps, int flags);
extern _X_EXPORT Bool glamor_egl_init_textured_pixmap(ScreenPtr screen);
/*
* @glamor_egl_create_textured_pixmap: Try to create a textured pixmap from
* a BO handle.
*
* @pixmap: The pixmap need to be processed.
* @handle: The BO's handle attached to this pixmap at DDX layer.
* @stride: Stride in bytes for this pixmap.
*
* This function try to create a texture from the handle and attach
* the texture to the pixmap , thus glamor can render to this pixmap
* as well. Return true if successful, otherwise return FALSE.
*/
extern _X_EXPORT Bool glamor_egl_create_textured_pixmap(PixmapPtr pixmap,
int handle, int stride);
/*
* @glamor_egl_create_textured_pixmap_from_bo: Try to create a textured pixmap
* from a gbm_bo.
*
* @pixmap: The pixmap need to be processed.
* @bo: a pointer on a gbm_bo structure attached to this pixmap at DDX layer.
*
* This function is similar to glamor_egl_create_textured_pixmap.
*/
extern _X_EXPORT Bool
glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap,
struct gbm_bo *bo,
Bool used_modifiers);
extern _X_EXPORT const char *glamor_egl_get_driver_name(ScreenPtr screen);
extern _X_EXPORT int glamor_create_gc(GCPtr gc);
extern _X_EXPORT void glamor_validate_gc(GCPtr gc, unsigned long changes,
DrawablePtr drawable);
#define HAS_GLAMOR_DESTROY_GC 1
extern _X_EXPORT void glamor_finish(ScreenPtr screen);
#define HAS_GLAMOR_TEXT 1
#ifdef GLAMOR_FOR_XORG
extern _X_EXPORT XF86VideoAdaptorPtr glamor_xv_init(ScreenPtr pScreen,
int num_texture_ports);
#endif
#endif /* GLAMOR_H */
@@ -0,0 +1,13 @@
#ifndef _XSERV_GLOBAL_H_
#define _XSERV_GLOBAL_H_
#include <X11/Xdefs.h>
#include <X11/Xfuncproto.h>
/* Global X server variables that are visible to mi, dix, os, and ddx */
extern _X_EXPORT const char *defaultFontPath;
extern _X_EXPORT int monitorResolution;
extern _X_EXPORT int defaultColorVisualClass;
#endif /* !_XSERV_GLOBAL_H_ */
@@ -0,0 +1,320 @@
/*
* Copyright (c) 2016, NVIDIA CORPORATION.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and/or associated documentation files (the
* "Materials"), to deal in the Materials without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Materials, and to
* permit persons to whom the Materials are furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* unaltered in all copies or substantial portions of the Materials.
* Any additions, deletions, or changes to the original source files
* must be clearly indicated in accompanying documentation.
*
* If only executable code is distributed, then the accompanying
* documentation must state that "this software is based in part on the
* work of the Khronos Group."
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/**
* \file
*
* Defines the interface between the libglvnd server module and a vendor
* library.
*
* Each screen may have one vendor library assigned to it. The GLVND module
* will examine each GLX request to determine which screen it goes to, and then
* it will forward that request to whichever vendor is assigned to that screen.
*
* Each vendor library is represented by an opaque __GLXServerVendor handle.
* Display drivers are responsible for creating handles for its GLX
* implementations, and assigning those handles to each screen.
*
* The GLVND module keeps a list of callbacks, which are called from
* InitExtensions. Drivers should use that callback to assign a vendor
* handle to whichever screens they support.
*
* Additional notes about dispatching:
* - If a request has one or more GLXContextTag values, then the dispatch stub
* must ensure that all of the tags belong to the vendor that it forwards the
* request to. Otherwise, if a vendor library tries to look up the private
* data for the tag, it could get the data from another vendor and crash.
* - Following from the last point, if a request takes a GLXContextTag value,
* then the dispatch stub should use the tag to select a vendor. If the
* request takes two or more tags, then the vendor must ensure that they all
* map to the same vendor.
*/
#ifndef GLXVENDORABI_H
#define GLXVENDORABI_H
#include "xlibre_ptrtypes.h"
#include <scrnintstr.h>
#include <extnsionst.h>
#include <GL/glxproto.h>
/*!
* Current version of the ABI.
*
* This version number contains a major number in the high-order 16 bits, and
* a minor version number in the low-order 16 bits.
*
* The major version number is incremented when an interface change will break
* backwards compatibility with existing vendor libraries. The minor version
* number is incremented when there's a change but existing vendor libraries
* will still work.
*/
#define GLXSERVER_VENDOR_ABI_MAJOR_VERSION 0
#define GLXSERVER_VENDOR_ABI_MINOR_VERSION 1
#if defined(__cplusplus)
extern "C" {
#endif
/**
* An opaque pointer representing a vendor library.
*/
typedef struct GlxServerVendorRec GlxServerVendor;
typedef int (* GlxServerDispatchProc) (ClientPtr client);
typedef struct GlxServerImportsRec GlxServerImports;
/**
* Functions exported by libglvnd to the vendor library.
*/
typedef struct GlxServerExportsRec {
int majorVersion;
int minorVersion;
/**
* This callback is called during each server generation when the GLX
* extension is initialized.
*
* Drivers may create a __GLXServerVendor handle at any time, but may only
* assign a vendor to a screen from this callback.
*
* The callback is called with the ExtensionEntry pointer for the GLX
* extension.
*/
CallbackListPtr *extensionInitCallback;
/**
* Allocates and zeroes a __GLXserverImports structure.
*
* Future versions of the GLVND interface may add optional members to the
* end of the __GLXserverImports struct. Letting the GLVND layer allocate
* the __GLXserverImports struct allows backward compatibility with
* existing drivers.
*/
GlxServerImports * (* allocateServerImports) (void);
/**
* Frees a __GLXserverImports structure that was allocated with
* \c allocateServerImports.
*/
void (* freeServerImports) (GlxServerImports *imports);
/**
* Creates a new vendor library handle.
*/
GlxServerVendor * (* createVendor) (const GlxServerImports *imports);
/**
* Destroys a vendor library handle.
*
* This function may not be called while the vendor handle is assigned to a
* screen, but it may be called from the __GLXserverImports::extensionCloseDown
* callback.
*/
void (* destroyVendor) (GlxServerVendor *vendor);
/**
* Sets the vendor library to use for a screen.
*
* This function should be called from the screen's CreateScreenResources
* callback.
*/
Bool (* setScreenVendor) (ScreenPtr screen, GlxServerVendor *vendor);
/**
* Adds an entry to the XID map.
*
* This mapping is used to dispatch requests based on an XID.
*
* Client-generated XID's (contexts, drawables, etc) must be added to the
* map by the dispatch stub.
*
* XID's that are generated in the server should be added by the vendor
* library.
*
* Vendor libraries are responsible for keeping track of any additional
* data they need for the XID's.
*
* Note that adding GLXFBConfig ID's appears to be unnecessary -- every GLX
* request I can find that takes a GLXFBConfig also takes a screen number.
*
* \param id The XID to add to the map. The XID must not already be in the
* map.
* \param vendor The vendor library to associate with \p id.
* \return True on success, or False on failure.
*/
Bool (* addXIDMap) (XID id, GlxServerVendor *vendor);
/**
* Returns the vendor and data for an XID, as added with \c addXIDMap.
*
* If \p id wasn't added with \c addXIDMap (for example, if it's a regular
* X window), then libglvnd will try to look it up as a drawable and return
* the vendor for whatever screen it's on.
*
* \param id The XID to look up.
* \return The vendor that owns the XID, or \c NULL if no matching vendor
* was found.
*/
GlxServerVendor * (* getXIDMap) (XID id);
/**
* Removes an entry from the XID map.
*/
void (* removeXIDMap) (XID id);
/**
* Looks up a context tag.
*
* Context tags are created and managed by libglvnd to ensure that they're
* unique between vendors.
*
* \param client The client connection.
* \param tag The context tag.
* \return The vendor that owns the context tag, or \c NULL if the context
* tag is invalid.
*/
GlxServerVendor * (* getContextTag)(ClientPtr client, GLXContextTag tag);
/**
* Assigns a pointer to vendor-private data for a context tag.
*
* Since the tag values are assigned by GLVND, vendors can use this
* function to store any private data they need for a context tag.
*
* \param client The client connection.
* \param tag The context tag.
* \param data An arbitrary pointer value.
*/
Bool (* setContextTagPrivate)(ClientPtr client, GLXContextTag tag, void *data);
/**
* Returns the private data pointer that was assigned from
* setContextTagPrivate.
*
* This function is safe to use in __GLXserverImports::makeCurrent to look
* up the old context private pointer.
*
* However, this function is not safe to use from a ClientStateCallback,
* because GLVND may have already deleted the tag by that point.
*/
void * (* getContextTagPrivate)(ClientPtr client, GLXContextTag tag);
GlxServerVendor * (* getVendorForScreen) (ClientPtr client, ScreenPtr screen);
/**
* Forwards a request to a vendor library.
*
* \param vendor The vendor to send the request to.
* \param client The client.
*/
int (* forwardRequest) (GlxServerVendor *vendor, ClientPtr client);
/**
* Sets the vendor library to use for a screen for a specific client.
*
* This function changes which vendor should handle GLX requests for a
* screen. Unlike \c setScreenVendor, this function can be called at any
* time, and only applies to requests from a single client.
*
* This function is available in GLXVND version 0.1 or later.
*/
Bool (* setClientScreenVendor) (ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor);
} GlxServerExports;
extern _X_EXPORT const GlxServerExports glxServer;
/**
* Functions exported by the vendor library to libglvnd.
*/
struct GlxServerImportsRec {
/**
* Called on a server reset.
*
* This is called from the extension's CloseDown callback.
*
* Note that this is called after freeing all of GLVND's per-screen data,
* so the callback may destroy any vendor handles.
*
* If the server is exiting, then GLVND will free any remaining vendor
* handles after calling the extensionCloseDown callbacks.
*/
void (* extensionCloseDown) (const ExtensionEntry *extEntry);
/**
* Handles a GLX request.
*/
int (* handleRequest) (ClientPtr client);
/**
* Returns a dispatch function for a request.
*
* \param minorOpcode The minor opcode of the request.
* \param vendorCode The vendor opcode, if \p minorOpcode
* is \c X_GLXVendorPrivate or \c X_GLXVendorPrivateWithReply.
* \return A dispatch function, or NULL if the vendor doesn't support this
* request.
*/
GlxServerDispatchProc (* getDispatchAddress) (CARD8 minorOpcode, CARD32 vendorCode);
/**
* Handles a MakeCurrent request.
*
* This function is called to handle any MakeCurrent request. The vendor
* library should deal with changing the current context. After the vendor
* returns GLVND will send the reply.
*
* In addition, GLVND will call this function with any current contexts
* when a client disconnects.
*
* To ensure that context tags are unique, libglvnd will select a context
* tag and pass it to the vendor library.
*
* The vendor can use \c __GLXserverExports::getContextTagPrivate to look
* up the private data pointer for \p oldContextTag.
*
* Likewise, the vendor can use \c __GLXserverExports::setContextTagPrivate
* to assign a private data pointer to \p newContextTag.
*/
int (* makeCurrent) (ClientPtr client,
GLXContextTag oldContextTag,
XID drawable,
XID readdrawable,
XID context,
GLXContextTag newContextTag);
};
#if defined(__cplusplus)
}
#endif
#endif // GLXVENDORABI_H
@@ -0,0 +1,62 @@
/*
*
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Keith Packard, SuSE, Inc.
*/
#ifndef _GLYPHSTR_H_
#define _GLYPHSTR_H_
#include <X11/extensions/renderproto.h>
#include "picture.h"
#include "screenint.h"
#define GlyphFormat1 0
#define GlyphFormat4 1
#define GlyphFormat8 2
#define GlyphFormat16 3
#define GlyphFormat32 4
#define GlyphFormatNum 5
typedef struct _Glyph {
CARD32 refcnt;
PrivateRec *devPrivates;
unsigned char sha1[20];
CARD32 size; /* info + bitmap */
xGlyphInfo info;
/* per-screen pixmaps follow */
} GlyphRec, *GlyphPtr;
typedef struct _GlyphList {
INT16 xOff;
INT16 yOff;
CARD8 len;
PictFormatPtr format;
} GlyphListRec, *GlyphListPtr;
#define GLYPH_HAS_GLYPH_PICTURE_ACCESSOR 1 /* used for api compat */
extern _X_EXPORT PicturePtr
GetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen);
extern _X_EXPORT void
SetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen, PicturePtr picture);
#endif /* _GLYPHSTR_H_ */
@@ -0,0 +1,6 @@
#ifndef __I2C_DEF_H__
#define __I2C_DEF_H__
#include "xf86i2c.h"
#endif
+581
View File
@@ -0,0 +1,581 @@
/************************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
#ifndef INPUT_H
#define INPUT_H
#include "xlibre_ptrtypes.h"
#include "misc.h"
#include "screenint.h"
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include <stdint.h>
#include "window.h" /* for WindowPtr */
#include "xkbrules.h"
#include "events.h"
#include "list.h"
#include "os.h"
#include <X11/extensions/XI2.h>
#define DEFAULT_KEYBOARD_CLICK 0
#define DEFAULT_BELL 50
#define DEFAULT_BELL_PITCH 400
#define DEFAULT_BELL_DURATION 100
#define DEFAULT_AUTOREPEAT TRUE
#define DEFAULT_AUTOREPEATS {\
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
#define DEFAULT_LEDS 0x0 /* all off */
#define DEFAULT_LEDS_MASK 0xffffffff /* 32 */
#define DEFAULT_INT_RESOLUTION 1000
#define DEFAULT_INT_MIN_VALUE 0
#define DEFAULT_INT_MAX_VALUE 100
#define DEFAULT_INT_DISPLAYED 0
#define DEFAULT_PTR_NUMERATOR 2
#define DEFAULT_PTR_DENOMINATOR 1
#define DEFAULT_PTR_THRESHOLD 4
#define DEVICE_INIT 0
#define DEVICE_ON 1
#define DEVICE_OFF 2
#define DEVICE_CLOSE 3
#define DEVICE_ABORT 4
#define POINTER_RELATIVE (1 << 1)
#define POINTER_ABSOLUTE (1 << 2)
#define POINTER_ACCELERATE (1 << 3)
#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
#define POINTER_NORAW (1 << 5) /* Don't generate RawEvents */
#define POINTER_EMULATED (1 << 6) /* Event was emulated from another event */
#define POINTER_DESKTOP (1 << 7) /* Data in desktop coordinates */
#define POINTER_RAWONLY (1 << 8) /* Only generate RawEvents */
/* GetTouchEvent flags */
#define TOUCH_ACCEPT (1 << 0)
#define TOUCH_REJECT (1 << 1)
#define TOUCH_PENDING_END (1 << 2)
#define TOUCH_CLIENT_ID (1 << 3) /* touch ID is the client-visible id */
#define TOUCH_REPLAYING (1 << 4) /* event is being replayed */
#define TOUCH_POINTER_EMULATED (1 << 5) /* touch event may be pointer emulated */
#define TOUCH_END (1 << 6) /* really end this touch now */
/* GetGestureEvent flags */
#define GESTURE_CANCELLED (1 << 0)
/*int constants for pointer acceleration schemes*/
#define PtrAccelNoOp 0
#define PtrAccelPredictable 1
#define PtrAccelLightweight 2
#define PtrAccelDefault PtrAccelPredictable
#define MAX_VALUATORS 36
/* Maximum number of valuators, divided by six, rounded up, to get number
* of events. */
#define MAX_VALUATOR_EVENTS 6
#define MAX_BUTTONS 256 /* completely arbitrarily chosen */
#define NO_AXIS_LIMITS -1
#define MAP_LENGTH MAX_BUTTONS
#define DOWN_LENGTH (MAX_BUTTONS/8) /* 256/8 => number of bytes to hold 256 bits */
#define NullGrab ((GrabPtr)NULL)
#define PointerRootWin ((WindowPtr)PointerRoot)
#define NoneWin ((WindowPtr)None)
#define NullDevice ((DevicePtr)NULL)
#ifndef FollowKeyboard
#define FollowKeyboard 3
#endif
#ifndef FollowKeyboardWin
#define FollowKeyboardWin ((WindowPtr) FollowKeyboard)
#endif
#ifndef RevertToFollowKeyboard
#define RevertToFollowKeyboard 3
#endif
enum InputLevel {
CORE = 1,
XI = 2,
XI2 = 3,
};
typedef unsigned long Leds;
typedef struct _OtherClients *OtherClientsPtr;
typedef struct _InputClients *InputClientsPtr;
typedef struct _ValuatorClassRec *ValuatorClassPtr;
typedef struct _ClassesRec *ClassesPtr;
typedef struct _SpriteRec *SpritePtr;
typedef struct _TouchClassRec *TouchClassPtr;
typedef struct _GestureClassRec *GestureClassPtr;
typedef struct _TouchPointInfo *TouchPointInfoPtr;
typedef struct _GestureInfo *GestureInfoPtr;
typedef struct _DDXTouchPointInfo *DDXTouchPointInfoPtr;
typedef union _GrabMask GrabMask;
typedef struct _ValuatorMask ValuatorMask;
/* The DIX stores incoming input events in this list */
extern InternalEvent *InputEventList;
typedef int (*DeviceProc) (DeviceIntPtr /*device */ ,
int /*what */ );
typedef void (*ProcessInputProc) (InternalEvent * /*event */ ,
DeviceIntPtr /*device */ );
typedef Bool (*DeviceHandleProc) (DeviceIntPtr /*device */ ,
void * /*data */
);
typedef void (*DeviceUnwrapProc) (DeviceIntPtr /*device */ ,
DeviceHandleProc /*proc */ ,
void * /*data */
);
/* pointer acceleration handling */
typedef void (*PointerAccelSchemeProc) (DeviceIntPtr /*device */ ,
ValuatorMask * /*valuators */ ,
CARD32 /*evtime */ );
typedef void (*DeviceCallbackProc) (DeviceIntPtr /*pDev */ );
struct _ValuatorAccelerationRec;
typedef Bool (*PointerAccelSchemeInitProc) (DeviceIntPtr /*dev */ ,
struct _ValuatorAccelerationRec *
/*protoScheme */ );
typedef void (*DeviceSendEventsProc) (DeviceIntPtr /*dev */ ,
int /* event type */ ,
int /* detail, buttons or keycode */ ,
int /* flags */ ,
const ValuatorMask * /* valuators */ );
typedef struct _DeviceRec {
void *devicePrivate;
ProcessInputProc processInputProc; /* current */
ProcessInputProc realInputProc; /* deliver */
ProcessInputProc enqueueInputProc; /* enqueue */
Bool on; /* used by DDX to keep state */
} DeviceRec, *DevicePtr;
typedef struct {
int click, bell, bell_pitch, bell_duration;
Bool autoRepeat;
unsigned char autoRepeats[32];
Leds leds;
unsigned char id;
} KeybdCtrl;
typedef struct {
KeySym *map;
KeyCode minKeyCode, maxKeyCode;
int mapWidth;
} KeySymsRec, *KeySymsPtr;
typedef struct {
int num, den, threshold;
unsigned char id;
} PtrCtrl;
typedef struct {
int resolution, min_value, max_value;
int integer_displayed;
unsigned char id;
} IntegerCtrl;
typedef struct {
int max_symbols, num_symbols_supported;
int num_symbols_displayed;
KeySym *symbols_supported;
KeySym *symbols_displayed;
unsigned char id;
} StringCtrl;
typedef struct {
int percent, pitch, duration;
unsigned char id;
} BellCtrl;
typedef struct {
Leds led_values;
Mask led_mask;
unsigned char id;
} LedCtrl;
extern _X_EXPORT KeybdCtrl defaultKeyboardControl;
extern _X_EXPORT PtrCtrl defaultPointerControl;
typedef struct _InputOption InputOption;
typedef struct _XI2Mask XI2Mask;
typedef struct _InputAttributes {
char *product;
char *vendor;
char *device;
char *pnp_id;
char *usb_id;
char **tags; /* null-terminated */
uint32_t flags;
} InputAttributes;
#define ATTR_KEYBOARD (1<<0)
#define ATTR_POINTER (1<<1)
#define ATTR_JOYSTICK (1<<2)
#define ATTR_TABLET (1<<3)
#define ATTR_TOUCHPAD (1<<4)
#define ATTR_TOUCHSCREEN (1<<5)
#define ATTR_KEY (1<<6)
#define ATTR_TABLET_PAD (1<<7)
/* Key/Button has been run through all input processing and events sent to clients. */
#define KEY_PROCESSED 1
#define BUTTON_PROCESSED 1
/* Key/Button has not been fully processed, no events have been sent. */
#define KEY_POSTED 2
#define BUTTON_POSTED 2
extern _X_EXPORT void set_key_down(DeviceIntPtr pDev, int key_code, int type);
extern _X_EXPORT void set_key_up(DeviceIntPtr pDev, int key_code, int type);
extern _X_EXPORT int key_is_down(DeviceIntPtr pDev, int key_code, int type);
extern _X_EXPORT void set_button_down(DeviceIntPtr pDev, int button, int type);
extern _X_EXPORT void set_button_up(DeviceIntPtr pDev, int button, int type);
extern _X_EXPORT int button_is_down(DeviceIntPtr pDev, int button, int type);
extern _X_EXPORT DeviceIntPtr AddInputDevice(ClientPtr /*client */ ,
DeviceProc /*deviceProc */ ,
Bool /*autoStart */ );
extern _X_EXPORT Bool EnableDevice(DeviceIntPtr /*device */ ,
BOOL /* sendevent */ );
extern _X_EXPORT Bool ActivateDevice(DeviceIntPtr /*device */ ,
BOOL /* sendevent */ );
extern _X_EXPORT Bool DisableDevice(DeviceIntPtr /*device */ ,
BOOL /* sendevent */ );
extern _X_EXPORT int RemoveDevice(DeviceIntPtr /*dev */ ,
BOOL /* sendevent */ );
extern _X_EXPORT int NumMotionEvents(void);
extern _X_EXPORT int dixLookupDevice(DeviceIntPtr * /* dev */ ,
int /* id */ ,
ClientPtr /* client */ ,
Mask /* access_mode */ );
extern _X_EXPORT void QueryMinMaxKeyCodes(KeyCode * /*minCode */ ,
KeyCode * /*maxCode */ );
extern _X_EXPORT Bool InitButtonClassDeviceStruct(DeviceIntPtr /*device */ ,
int /*numButtons */ ,
Atom * /* labels */ ,
CARD8 * /*map */ );
extern _X_EXPORT Bool InitValuatorClassDeviceStruct(DeviceIntPtr /*device */ ,
int /*numAxes */ ,
Atom * /* labels */ ,
int /*numMotionEvents */ ,
int /*mode */ );
extern _X_EXPORT Bool InitPointerAccelerationScheme(DeviceIntPtr /*dev */ ,
int /*scheme */ );
extern _X_EXPORT Bool InitFocusClassDeviceStruct(DeviceIntPtr /*device */ );
extern _X_EXPORT Bool InitTouchClassDeviceStruct(DeviceIntPtr /*device */ ,
unsigned int /*max_touches */ ,
unsigned int /*mode */ ,
unsigned int /*numAxes */ );
extern _X_EXPORT Bool InitGestureClassDeviceStruct(DeviceIntPtr device,
unsigned int max_touches);
typedef void (*BellProcPtr) (int percent,
DeviceIntPtr device,
void *ctrl,
int feedbackClass);
typedef void (*KbdCtrlProcPtr) (DeviceIntPtr /*device */ ,
KeybdCtrl * /*ctrl */ );
typedef void (*PtrCtrlProcPtr) (DeviceIntPtr /*device */ ,
PtrCtrl * /*ctrl */ );
extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct(DeviceIntPtr /*device */
,
PtrCtrlProcPtr
/*controlProc */ );
typedef void (*StringCtrlProcPtr) (DeviceIntPtr /*device */ ,
StringCtrl * /*ctrl */ );
extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct(DeviceIntPtr
/*device */ ,
StringCtrlProcPtr
/*controlProc */ ,
int /*max_symbols */ ,
int
/*num_symbols_supported */
,
KeySym * /*symbols */
);
typedef void (*BellCtrlProcPtr) (DeviceIntPtr /*device */ ,
BellCtrl * /*ctrl */ );
extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct(DeviceIntPtr /*device */
,
BellProcPtr
/*bellProc */ ,
BellCtrlProcPtr
/*controlProc */ );
typedef void (*LedCtrlProcPtr) (DeviceIntPtr /*device */ ,
LedCtrl * /*ctrl */ );
extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct(DeviceIntPtr /*device */
,
LedCtrlProcPtr
/*controlProc */ );
typedef void (*IntegerCtrlProcPtr) (DeviceIntPtr /*device */ ,
IntegerCtrl * /*ctrl */ );
extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct(DeviceIntPtr
/*device */ ,
IntegerCtrlProcPtr
/*controlProc */ );
extern _X_EXPORT Bool InitPointerDeviceStruct(DevicePtr /*device */ ,
CARD8 * /*map */ ,
int /*numButtons */ ,
Atom * /* btn_labels */ ,
PtrCtrlProcPtr /*controlProc */ ,
int /*numMotionEvents */ ,
int /*numAxes */ ,
Atom * /* axes_labels */ );
extern _X_EXPORT Bool InitKeyboardDeviceStruct(DeviceIntPtr /*device */ ,
XkbRMLVOSet * /*rmlvo */ ,
BellProcPtr /*bellProc */ ,
KbdCtrlProcPtr /*controlProc */
);
extern _X_EXPORT Bool InitKeyboardDeviceStructFromString(DeviceIntPtr dev,
const char *keymap,
int keymap_length,
BellProcPtr bell_func,
KbdCtrlProcPtr ctrl_func);
extern _X_EXPORT void ProcessInputEvents(void);
extern _X_EXPORT void InitInput(int /*argc */ ,
char ** /*argv */ );
extern _X_EXPORT void CloseInput(void);
extern _X_EXPORT int GetMaximumEventsNum(void);
extern _X_EXPORT InternalEvent *InitEventList(int num_events);
extern _X_EXPORT void FreeEventList(InternalEvent *list, int num_events);
extern _X_EXPORT int GetPointerEvents(InternalEvent *events,
DeviceIntPtr pDev,
int type,
int buttons,
int flags, const ValuatorMask *mask);
extern _X_EXPORT void QueuePointerEvents(DeviceIntPtr pDev,
int type,
int buttons,
int flags, const ValuatorMask *mask);
extern _X_EXPORT int GetKeyboardEvents(InternalEvent *events,
DeviceIntPtr pDev,
int type,
int key_code);
extern _X_EXPORT void QueueKeyboardEvents(DeviceIntPtr pDev,
int type,
int key_code);
extern _X_EXPORT int GetProximityEvents(InternalEvent *events,
DeviceIntPtr pDev,
int type, const ValuatorMask *mask);
extern _X_EXPORT void QueueProximityEvents(DeviceIntPtr pDev,
int type, const ValuatorMask *mask);
extern _X_EXPORT int GetMotionHistorySize(void);
extern _X_EXPORT void AllocateMotionHistory(DeviceIntPtr pDev);
extern _X_EXPORT int GetMotionHistory(DeviceIntPtr pDev,
xTimecoord ** buff,
unsigned long start,
unsigned long stop,
ScreenPtr pScreen, BOOL core);
extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
extern _X_EXPORT DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
extern _X_EXPORT int AllocDevicePair(ClientPtr client,
const char *name,
DeviceIntPtr *ptr,
DeviceIntPtr *keybd,
DeviceProc ptr_proc,
DeviceProc keybd_proc, Bool master);
/* Helper functions. */
extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
KeyCode **modkeymap,
int *max_keys_per_mod);
enum TouchListenerState {
TOUCH_LISTENER_AWAITING_BEGIN = 0, /**< Waiting for a TouchBegin event */
TOUCH_LISTENER_AWAITING_OWNER, /**< Waiting for a TouchOwnership event */
TOUCH_LISTENER_EARLY_ACCEPT, /**< Waiting for ownership, has already
accepted */
TOUCH_LISTENER_IS_OWNER, /**< Is the current owner, hasn't
accepted */
TOUCH_LISTENER_HAS_ACCEPTED, /**< Is the current owner, has accepted */
TOUCH_LISTENER_HAS_END, /**< Has already received the end event */
};
enum TouchListenerType {
TOUCH_LISTENER_GRAB,
TOUCH_LISTENER_POINTER_GRAB,
TOUCH_LISTENER_REGULAR,
TOUCH_LISTENER_POINTER_REGULAR,
};
enum GestureListenerType {
GESTURE_LISTENER_GRAB,
GESTURE_LISTENER_NONGESTURE_GRAB,
GESTURE_LISTENER_REGULAR
};
extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *
attrs);
extern _X_EXPORT void FreeInputAttributes(InputAttributes * attrs);
/* Implemented by the DDX. */
extern _X_EXPORT int NewInputDeviceRequest(InputOption *options,
InputAttributes * attrs,
DeviceIntPtr *dev);
extern _X_EXPORT void DeleteInputDeviceRequest(DeviceIntPtr dev);
extern _X_EXPORT void RemoveInputDeviceTraces(const char *config_info);
extern _X_EXPORT void DDXRingBell(int volume, int pitch, int duration);
extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators);
extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask);
extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask,
int first_valuator,
int num_valuators,
const int *valuators);
extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask, int valuator,
int data);
extern _X_EXPORT void valuator_mask_set_double(ValuatorMask *mask, int valuator,
double data);
extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask);
extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask);
extern _X_EXPORT int valuator_mask_isset(const ValuatorMask *mask, int bit);
extern _X_EXPORT void valuator_mask_unset(ValuatorMask *mask, int bit);
extern _X_EXPORT int valuator_mask_num_valuators(const ValuatorMask *mask);
extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest,
const ValuatorMask *src);
extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum);
extern _X_EXPORT double valuator_mask_get_double(const ValuatorMask *mask,
int valnum);
extern _X_EXPORT Bool valuator_mask_fetch(const ValuatorMask *mask,
int valnum, int *val);
extern _X_EXPORT Bool valuator_mask_fetch_double(const ValuatorMask *mask,
int valnum, double *val);
extern _X_EXPORT Bool valuator_mask_has_unaccelerated(const ValuatorMask *mask);
extern _X_EXPORT void valuator_mask_set_unaccelerated(ValuatorMask *mask,
int valuator,
double accel,
double unaccel);
extern _X_EXPORT void valuator_mask_set_absolute_unaccelerated(ValuatorMask *mask,
int valuator,
int absolute,
double unaccel);
extern _X_EXPORT double valuator_mask_get_accelerated(const ValuatorMask *mask,
int valuator);
extern _X_EXPORT double valuator_mask_get_unaccelerated(const ValuatorMask *mask,
int valuator);
extern _X_EXPORT Bool valuator_mask_fetch_unaccelerated(const ValuatorMask *mask,
int valuator,
double *accel,
double *unaccel);
/* InputOption handling interface */
extern _X_EXPORT InputOption *input_option_new(InputOption *list,
const char *key,
const char *value);
extern _X_EXPORT void input_option_free_list(InputOption **opt);
extern _X_EXPORT InputOption *input_option_free_element(InputOption *opt,
const char *key);
extern _X_EXPORT InputOption *input_option_find(InputOption *list,
const char *key);
extern _X_EXPORT const char *input_option_get_key(const InputOption *opt);
extern _X_EXPORT const char *input_option_get_value(const InputOption *opt);
extern _X_EXPORT void input_option_set_key(InputOption *opt, const char *key);
extern _X_EXPORT void input_option_set_value(InputOption *opt,
const char *value);
extern _X_EXPORT void input_lock(void);
extern _X_EXPORT void input_unlock(void);
extern _X_EXPORT void input_force_unlock(void);
extern _X_EXPORT int in_input_thread(void);
extern _X_EXPORT Bool InputThreadEnable;
#endif /* INPUT_H */
+672
View File
@@ -0,0 +1,672 @@
/************************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
#ifndef INPUTSTRUCT_H
#define INPUTSTRUCT_H
#include <X11/extensions/XI2proto.h>
#include <pixman.h>
#include "input.h"
#include "window.h"
#include "dixstruct.h"
#include "cursorstr.h"
#include "privates.h"
#define BitIsOn(ptr, bit) (!!(((const BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))))
#define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
#define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))
#define EMASKSIZE (MAXDEVICES + 2)
/* This is the last XI2 event supported by the server. If you add
* events to the protocol, the server will not support these events until
* this number here is bumped.
*/
#define XI2LASTEVENT XI_GestureSwipeEnd
#define XI2MASKSIZE ((XI2LASTEVENT >> 3) + 1) /* no of bytes for masks */
/**
* Scroll types for ::SetScrollValuator and the scroll type in the
* ::ScrollInfoPtr.
*/
enum ScrollType {
SCROLL_TYPE_NONE = 0, /**< Not a scrolling valuator */
SCROLL_TYPE_VERTICAL = 8,
SCROLL_TYPE_HORIZONTAL = 9,
};
/**
* This struct stores the core event mask for each client except the client
* that created the window.
*
* Each window that has events selected from other clients has at least one of
* these masks. If multiple clients selected for events on the same window,
* these masks are in a linked list.
*
* The event mask for the client that created the window is stored in
* win->eventMask instead.
*
* The resource id is simply a fake client ID to associate this mask with a
* client.
*
* Kludge: OtherClients and InputClients must be compatible, see code.
*/
typedef struct _OtherClients {
OtherClientsPtr next; /**< Pointer to the next mask */
XID resource; /**< id for putting into resource manager */
Mask mask; /**< Core event mask */
} OtherClients;
/**
* This struct stores the XI event mask for each client.
*
* Each window that has events selected has at least one of these masks. If
* multiple client selected for events on the same window, these masks are in
* a linked list.
*/
typedef struct _InputClients {
InputClientsPtr next; /**< Pointer to the next mask */
XID resource; /**< id for putting into resource manager */
Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */
/** XI2 event masks. One per device, each bit is a mask of (1 << type) */
struct _XI2Mask *xi2mask;
} InputClients;
/**
* Combined XI event masks from all devices.
*
* This is the XI equivalent of the deliverableEvents, eventMask and
* dontPropagate mask of the WindowRec (or WindowOptRec).
*
* A window that has an XI client selecting for events has exactly one
* OtherInputMasks struct and exactly one InputClients struct hanging off
* inputClients. Each further client appends to the inputClients list.
* Each Mask field is per-device, with the device id as the index.
* Exception: for non-device events (Presence events), the MAXDEVICES
* deviceid is used.
*/
typedef struct _OtherInputMasks {
/**
* Bitwise OR of all masks by all clients and the window's parent's masks.
*/
Mask deliverableEvents[EMASKSIZE];
/**
* Bitwise OR of all masks by all clients on this window.
*/
Mask inputEvents[EMASKSIZE];
/** The do-not-propagate masks for each device. */
Mask dontPropagateMask[EMASKSIZE];
/** The clients that selected for events */
InputClientsPtr inputClients;
/* XI2 event masks. One per device, each bit is a mask of (1 << type) */
struct _XI2Mask *xi2mask;
} OtherInputMasks;
/*
* The following structure gets used for both active and passive grabs. For
* active grabs some of the fields (e.g. modifiers) are not used. However,
* that is not much waste since there aren't many active grabs (one per
* keyboard/pointer device) going at once in the server.
*/
typedef struct _DetailRec { /* Grab details may be bit masks */
unsigned int exact;
Mask *pMask;
} DetailRec;
union _GrabMask {
Mask core;
Mask xi;
struct _XI2Mask *xi2mask;
};
/**
* Central struct for device grabs.
* The same struct is used for both core grabs and device grabs, with
* different fields being set.
* If the grab is a core grab (GrabPointer/GrabKeyboard), then the eventMask
* is a combination of standard event masks (i.e. PointerMotionMask |
* ButtonPressMask).
* If the grab is a device grab (GrabDevice), then the eventMask is a
* combination of event masks for a given XI event type (see SetEventInfo).
*
* If the grab is a result of a ButtonPress, then eventMask is the core mask
* and deviceMask is set to the XI event mask for the grab.
*/
typedef struct _GrabRec {
GrabPtr next; /* for chain of passive grabs */
XID resource;
DeviceIntPtr device;
WindowPtr window;
unsigned ownerEvents:1;
unsigned keyboardMode:1;
unsigned pointerMode:1;
enum InputLevel grabtype;
CARD8 type; /* event type for passive grabs, 0 for active grabs */
DetailRec modifiersDetail;
DeviceIntPtr modifierDevice;
DetailRec detail; /* key or button */
WindowPtr confineTo; /* always NULL for keyboards */
CursorPtr cursor; /* always NULL for keyboards */
Mask eventMask;
Mask deviceMask;
/* XI2 event masks. One per device, each bit is a mask of (1 << type) */
struct _XI2Mask *xi2mask;
} GrabRec;
/**
* Sprite information for a device.
*/
typedef struct _SpriteRec {
CursorPtr current;
BoxRec hotLimits; /* logical constraints of hot spot */
Bool confined; /* confined to screen */
RegionPtr hotShape; /* additional logical shape constraint */
BoxRec physLimits; /* physical constraints of hot spot */
WindowPtr win; /* window of logical position */
HotSpot hot; /* logical pointer position */
HotSpot hotPhys; /* physical pointer position */
#ifdef XINERAMA
ScreenPtr screen; /* all others are in Screen 0 coordinates */
RegionRec Reg1; /* Region 1 for confining motion */
RegionRec Reg2; /* Region 2 for confining virtual motion */
WindowPtr windows[MAXSCREENS];
WindowPtr confineWin; /* confine window */
#endif /* XINERAMA */
/* The window trace information is used at dix/events.c to avoid having
* to compute all the windows between the root and the current pointer
* window each time a button or key goes down. The grabs on each of those
* windows must be checked.
* spriteTraces should only be used at dix/events.c! */
WindowPtr *spriteTrace;
int spriteTraceSize;
int spriteTraceGood;
/* Due to delays between event generation and event processing, it is
* possible that the pointer has crossed screen boundaries between the
* time in which it begins generating events and the time when
* those events are processed.
*
* pEnqueueScreen: screen the pointer was on when the event was generated
* pDequeueScreen: screen the pointer was on when the event is processed
*/
ScreenPtr pEnqueueScreen;
ScreenPtr pDequeueScreen;
} SpriteRec;
typedef struct _KeyClassRec {
int sourceid;
CARD8 down[DOWN_LENGTH];
CARD8 postdown[DOWN_LENGTH];
int modifierKeyCount[8];
struct _XkbSrvInfo *xkbInfo;
} KeyClassRec, *KeyClassPtr;
typedef struct _ScrollInfo {
enum ScrollType type;
double increment;
int flags;
} ScrollInfo, *ScrollInfoPtr;
typedef struct _AxisInfo {
int resolution;
int min_resolution;
int max_resolution;
int min_value;
int max_value;
Atom label;
CARD8 mode;
ScrollInfo scroll;
} AxisInfo, *AxisInfoPtr;
typedef struct _ValuatorAccelerationRec {
int number;
PointerAccelSchemeProc AccelSchemeProc;
void *accelData; /* at disposal of AccelScheme */
PointerAccelSchemeInitProc AccelInitProc;
DeviceCallbackProc AccelCleanupProc;
} ValuatorAccelerationRec, *ValuatorAccelerationPtr;
typedef struct _ValuatorClassRec {
int sourceid;
int numMotionEvents;
int first_motion;
int last_motion;
void *motion; /* motion history buffer. Different layout
for MDs and SDs! */
WindowPtr motionHintWindow;
AxisInfoPtr axes;
unsigned short numAxes;
double *axisVal; /* always absolute, but device-coord system */
ValuatorAccelerationRec accelScheme;
int h_scroll_axis; /* horiz smooth-scrolling axis */
int v_scroll_axis; /* vert smooth-scrolling axis */
} ValuatorClassRec;
typedef struct _TouchListener {
XID listener; /* grabs/event selection IDs receiving
* events for this touch */
int resource_type; /* listener's resource type */
enum TouchListenerType type;
enum TouchListenerState state;
enum InputLevel level; /* matters only for emulating touches */
WindowPtr window;
GrabPtr grab;
} TouchListener;
typedef struct _TouchPointInfo {
uint32_t client_id; /* touch ID as seen in client events */
int sourceid; /* Source device's ID for this touchpoint */
Bool active; /* whether or not the touch is active */
Bool pending_finish; /* true if the touch is physically inactive
* but still owned by a grab */
SpriteRec sprite; /* window trace for delivery */
ValuatorMask *valuators; /* last recorded axis values */
TouchListener *listeners; /* set of listeners */
int num_listeners;
int num_grabs; /* number of open grabs on this touch
* which have not accepted or rejected */
Bool emulate_pointer;
DeviceEvent *history; /* History of events on this touchpoint */
size_t history_elements; /* Number of current elements in history */
size_t history_size; /* Size of history in elements */
} TouchPointInfoRec;
typedef struct _TouchClassRec {
int sourceid;
TouchPointInfoPtr touches;
unsigned short num_touches; /* number of allocated touches */
unsigned short max_touches; /* maximum number of touches, may be 0 */
CARD8 mode; /* ::XIDirectTouch, XIDependentTouch */
/* for pointer-emulation */
CARD8 buttonsDown; /* number of buttons down */
unsigned short state; /* logical button state */
Mask motionMask;
} TouchClassRec;
typedef struct _GestureListener {
XID listener; /* grabs/event selection IDs receiving
* events for this gesture */
int resource_type; /* listener's resource type */
enum GestureListenerType type;
WindowPtr window;
GrabPtr grab;
} GestureListener;
typedef struct _GestureInfo {
int sourceid; /* Source device's ID for this gesture */
Bool active; /* whether or not the gesture is active */
uint8_t type; /* Gesture type: either ET_GesturePinchBegin or
ET_GestureSwipeBegin. Valid if active == TRUE */
int num_touches; /* The number of touches in the gesture */
SpriteRec sprite; /* window trace for delivery */
GestureListener listener; /* the listener that will receive events */
Bool has_listener; /* true if listener has been setup already */
} GestureInfoRec;
typedef struct _GestureClassRec {
int sourceid;
GestureInfoRec gesture;
unsigned short max_touches; /* maximum number of touches, may be 0 */
} GestureClassRec;
typedef struct _ButtonClassRec {
int sourceid;
CARD8 numButtons;
CARD8 buttonsDown; /* number of buttons currently down
This counts logical buttons, not
physical ones, i.e if some buttons
are mapped to 0, they're not counted
here */
unsigned short state;
Mask motionMask;
CARD8 down[DOWN_LENGTH];
CARD8 postdown[DOWN_LENGTH];
CARD8 map[MAP_LENGTH];
union _XkbAction *xkb_acts;
Atom labels[MAX_BUTTONS];
} ButtonClassRec, *ButtonClassPtr;
typedef struct _FocusClassRec {
int sourceid;
WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */
int revert;
TimeStamp time;
WindowPtr *trace;
int traceSize;
int traceGood;
} FocusClassRec, *FocusClassPtr;
typedef struct _ProximityClassRec {
int sourceid;
char in_proximity;
} ProximityClassRec, *ProximityClassPtr;
typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr;
typedef struct _StringFeedbackClassRec *StringFeedbackPtr;
typedef struct _BellFeedbackClassRec *BellFeedbackPtr;
typedef struct _LedFeedbackClassRec *LedFeedbackPtr;
typedef struct _KbdFeedbackClassRec {
BellProcPtr BellProc;
KbdCtrlProcPtr CtrlProc;
KeybdCtrl ctrl;
KbdFeedbackPtr next;
struct _XkbSrvLedInfo *xkb_sli;
} KbdFeedbackClassRec;
typedef struct _PtrFeedbackClassRec {
PtrCtrlProcPtr CtrlProc;
PtrCtrl ctrl;
PtrFeedbackPtr next;
} PtrFeedbackClassRec;
typedef struct _IntegerFeedbackClassRec {
IntegerCtrlProcPtr CtrlProc;
IntegerCtrl ctrl;
IntegerFeedbackPtr next;
} IntegerFeedbackClassRec;
typedef struct _StringFeedbackClassRec {
StringCtrlProcPtr CtrlProc;
StringCtrl ctrl;
StringFeedbackPtr next;
} StringFeedbackClassRec;
typedef struct _BellFeedbackClassRec {
BellProcPtr BellProc;
BellCtrlProcPtr CtrlProc;
BellCtrl ctrl;
BellFeedbackPtr next;
} BellFeedbackClassRec;
typedef struct _LedFeedbackClassRec {
LedCtrlProcPtr CtrlProc;
LedCtrl ctrl;
LedFeedbackPtr next;
struct _XkbSrvLedInfo *xkb_sli;
} LedFeedbackClassRec;
typedef struct _ClassesRec {
KeyClassPtr key;
ValuatorClassPtr valuator;
TouchClassPtr touch;
GestureClassPtr gesture;
ButtonClassPtr button;
FocusClassPtr focus;
ProximityClassPtr proximity;
KbdFeedbackPtr kbdfeed;
PtrFeedbackPtr ptrfeed;
IntegerFeedbackPtr intfeed;
StringFeedbackPtr stringfeed;
BellFeedbackPtr bell;
LedFeedbackPtr leds;
} ClassesRec;
/* Device properties */
typedef struct _XIPropertyValue {
Atom type; /* ignored by server */
short format; /* format of data for swapping - 8,16,32 */
long size; /* size of data in (format/8) bytes */
void *data; /* private to client */
} XIPropertyValueRec;
typedef struct _XIProperty {
struct _XIProperty *next;
Atom propertyName;
BOOL deletable; /* clients can delete this prop? */
XIPropertyValueRec value;
} XIPropertyRec;
typedef XIPropertyRec *XIPropertyPtr;
typedef XIPropertyValueRec *XIPropertyValuePtr;
typedef struct _XIPropertyHandler {
struct _XIPropertyHandler *next;
long id;
int (*SetProperty) (DeviceIntPtr dev,
Atom property, XIPropertyValuePtr prop, BOOL checkonly);
int (*GetProperty) (DeviceIntPtr dev, Atom property);
int (*DeleteProperty) (DeviceIntPtr dev, Atom property);
} XIPropertyHandler, *XIPropertyHandlerPtr;
typedef struct _GrabInfoRec {
TimeStamp grabTime;
Bool fromPassiveGrab; /* true if from passive grab */
Bool implicitGrab; /* implicit from ButtonPress */
GrabPtr unused; /* Kept for ABI stability, remove soon */
GrabPtr grab;
CARD8 activatingKey;
void (*ActivateGrab) (DeviceIntPtr /*device */ ,
GrabPtr /*grab */ ,
TimeStamp /*time */ ,
Bool /*autoGrab */ );
void (*DeactivateGrab) (DeviceIntPtr /*device */ );
struct {
Bool frozen;
int state;
GrabPtr other; /* if other grab has this frozen */
InternalEvent *event; /* saved to be replayed */
} sync;
} GrabInfoRec, *GrabInfoPtr;
typedef struct _SpriteInfoRec {
/* sprite must always point to a valid sprite. For devices sharing the
* sprite, let sprite point to a paired spriteOwner's sprite. */
SpritePtr sprite; /* sprite information */
Bool spriteOwner; /* True if device owns the sprite */
DeviceIntPtr paired; /* The paired device. Keyboard if
spriteOwner is TRUE, otherwise the
pointer that owns the sprite. */
/* keep states for animated cursor */
struct {
CursorPtr pCursor;
ScreenPtr pScreen;
int elt;
} anim;
} SpriteInfoRec, *SpriteInfoPtr;
/* device types */
#define MASTER_POINTER 1
#define MASTER_KEYBOARD 2
#define SLAVE 3
/* special types for GetMaster */
#define MASTER_ATTACHED 4 /* Master for this device */
#define KEYBOARD_OR_FLOAT 5 /* Keyboard master for this device or this device if floating */
#define POINTER_OR_FLOAT 6 /* Pointer master for this device or this device if floating */
typedef struct _DeviceIntRec {
DeviceRec public;
DeviceIntPtr next;
Bool startup; /* true if needs to be turned on at
server initialization time */
DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
used to initialize, turn on, or
turn off the device */
Bool inited; /* TRUE if INIT returns Success */
Bool enabled; /* TRUE if ON returns Success */
Bool coreEvents; /* TRUE if device also sends core */
GrabInfoRec deviceGrab; /* grab on the device */
int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */
Atom xinput_type;
char *name;
int id;
KeyClassPtr key;
ValuatorClassPtr valuator;
TouchClassPtr touch;
GestureClassPtr gesture;
ButtonClassPtr button;
FocusClassPtr focus;
ProximityClassPtr proximity;
KbdFeedbackPtr kbdfeed;
PtrFeedbackPtr ptrfeed;
IntegerFeedbackPtr intfeed;
StringFeedbackPtr stringfeed;
BellFeedbackPtr bell;
LedFeedbackPtr leds;
struct _XkbInterest *xkb_interest;
char *config_info; /* used by the hotplug layer */
ClassesPtr unused_classes; /* for master devices */
int saved_master_id; /* for slaves while grabbed */
PrivateRec *devPrivates;
DeviceUnwrapProc unwrapProc;
SpriteInfoPtr spriteInfo;
DeviceIntPtr master; /* master device */
DeviceIntPtr lastSlave; /* last slave device used */
/* last valuator values recorded, not posted to client;
* for slave devices, valuators is in device coordinates, mapped to the
* desktop
* for master devices, valuators is in desktop coordinates.
* see dix/getevents.c
* remainder supports acceleration
*/
struct {
double valuators[MAX_VALUATORS];
int numValuators;
DeviceIntPtr slave;
ValuatorMask *scroll;
int num_touches; /* size of the touches array */
DDXTouchPointInfoPtr touches;
} last;
/* Input device property handling. */
struct {
XIPropertyPtr properties;
XIPropertyHandlerPtr handlers; /* NULL-terminated */
} properties;
/* coordinate transformation matrix for relative movement. Matrix with
* the translation component dropped */
struct pixman_f_transform relative_transform;
/* scale matrix for absolute devices, this is the combined matrix of
[1/scale] . [transform] . [scale]. See DeviceSetTransform */
struct pixman_f_transform scale_and_transform;
/* XTest related master device id */
int xtest_master_id;
DeviceSendEventsProc sendEventsProc;
struct _SyncCounter *idle_counter;
Bool ignoreXkbActionsBehaviors; /* TRUE if keys don't trigger behaviors and actions */
} DeviceIntRec;
typedef struct {
int numDevices; /* total number of devices */
DeviceIntPtr devices; /* all devices turned on */
DeviceIntPtr off_devices; /* all devices turned off */
DeviceIntPtr keyboard; /* the main one for the server */
DeviceIntPtr pointer;
DeviceIntPtr all_devices;
DeviceIntPtr all_master_devices;
} InputInfo;
extern _X_EXPORT InputInfo inputInfo;
/* for keeping the events for devices grabbed synchronously */
typedef struct _QdEvent *QdEventPtr;
typedef struct _QdEvent {
struct xorg_list next;
DeviceIntPtr device;
ScreenPtr pScreen; /* what screen the pointer was on */
unsigned long months; /* milliseconds is in the event */
InternalEvent *event;
} QdEventRec;
/**
* syncEvents is the global structure for queued events.
*
* Devices can be frozen through GrabModeSync pointer grabs. If this is the
* case, events from these devices are added to "pending" instead of being
* processed normally. When the device is unfrozen, events in "pending" are
* replayed and processed as if they would come from the device directly.
*/
typedef struct _EventSyncInfo {
struct xorg_list pending;
/** The device to replay events for. Only set in AllowEvents(), in which
* case it is set to the device specified in the request. */
DeviceIntPtr replayDev; /* kludgy rock to put flag for */
/**
* The window the events are supposed to be replayed on.
* This window may be set to the grab's window (but only when
* Replay{Pointer|Keyboard} is given in the XAllowEvents()
* request. */
WindowPtr replayWin; /* ComputeFreezes */
/**
* Flag to indicate whether we're in the process of
* replaying events. Only set in ComputeFreezes(). */
Bool playingEvents;
TimeStamp time;
} EventSyncInfoRec, *EventSyncInfoPtr;
extern EventSyncInfoRec syncEvents;
/**
* Given a sprite, returns the window at the bottom of the trace (i.e. the
* furthest window from the root).
*/
static inline WindowPtr
DeepestSpriteWin(SpritePtr sprite)
{
return sprite->spriteTrace[sprite->spriteTraceGood - 1];
}
struct _XI2Mask {
unsigned char **masks; /* event mask in masks[deviceid][event type byte] */
size_t nmasks; /* number of masks */
size_t mask_size; /* size of each mask in bytes */
};
#endif /* INPUTSTRUCT_H */
@@ -0,0 +1,269 @@
/*
* SPDX-License-Identifier: MIT
*
* Copyright © 2015 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef _LIBINPUT_PROPERTIES_H_
#define _LIBINPUT_PROPERTIES_H_
/* Tapping enabled/disabled: BOOL, 1 value */
#define LIBINPUT_PROP_TAP "libinput Tapping Enabled"
/* Tapping default enabled/disabled: BOOL, 1 value, read-only */
#define LIBINPUT_PROP_TAP_DEFAULT "libinput Tapping Enabled Default"
/* Tap drag enabled/disabled: BOOL, 1 value */
#define LIBINPUT_PROP_TAP_DRAG "libinput Tapping Drag Enabled"
/* Tap drag default enabled/disabled: BOOL, 1 value, read-only */
#define LIBINPUT_PROP_TAP_DRAG_DEFAULT "libinput Tapping Drag Enabled Default"
/* Tap drag lock enabled/disabled: BOOL, 1 value */
#define LIBINPUT_PROP_TAP_DRAG_LOCK "libinput Tapping Drag Lock Enabled"
/* Tap drag lock default enabled/disabled: BOOL, 1 value, read-only */
#define LIBINPUT_PROP_TAP_DRAG_LOCK_DEFAULT "libinput Tapping Drag Lock Enabled Default"
/* Tap button order: BOOL, 2 values in order LRM, LMR, only one may be set
at any time */
#define LIBINPUT_PROP_TAP_BUTTONMAP "libinput Tapping Button Mapping Enabled"
/* Tap button default order: BOOL, 2 values in order LRM, LMR, read-only */
#define LIBINPUT_PROP_TAP_BUTTONMAP_DEFAULT "libinput Tapping Button Mapping Default"
/* Clickfinger button order: BOOL, 2 values in order LRM, LMR, only one may be set
at any time */
#define LIBINPUT_PROP_CLICKFINGER_BUTTONMAP "libinput Clickfinger Button Mapping Enabled"
/* Clickfinger button default order: BOOL, 2 values in order LRM, LMR, read-only */
#define LIBINPUT_PROP_CLICKFINGER_BUTTONMAP_DEFAULT "libinput Clickfinger Button Mapping Default"
/* Calibration matrix: FLOAT, 9 values of a 3x3 matrix, in rows */
#define LIBINPUT_PROP_CALIBRATION "libinput Calibration Matrix"
/* Calibration matrix: FLOAT, 9 values of a 3x3 matrix, in rows, read-only*/
#define LIBINPUT_PROP_CALIBRATION_DEFAULT "libinput Calibration Matrix Default"
/* Pointer accel speed: FLOAT, 1 value, 32 bit */
#define LIBINPUT_PROP_ACCEL "libinput Accel Speed"
/* Pointer accel speed: FLOAT, 1 value, 32 bit, read-only*/
#define LIBINPUT_PROP_ACCEL_DEFAULT "libinput Accel Speed Default"
/* Pointer accel profile: BOOL, 3 values in order adaptive, flat, custom
* only one is enabled at a time at max, read-only */
#define LIBINPUT_PROP_ACCEL_PROFILES_AVAILABLE "libinput Accel Profiles Available"
/* Pointer accel profile: BOOL, 3 values in order adaptive, flat, custom
only one is enabled at a time at max, read-only */
#define LIBINPUT_PROP_ACCEL_PROFILE_ENABLED_DEFAULT "libinput Accel Profile Enabled Default"
/* Pointer accel profile: BOOL, 3 values in order adaptive, flat, custom
only one is enabled at a time at max */
#define LIBINPUT_PROP_ACCEL_PROFILE_ENABLED "libinput Accel Profile Enabled"
/* Points for the custom accel profile: FLOAT, N values */
#define LIBINPUT_PROP_ACCEL_CUSTOM_POINTS_FALLBACK "libinput Accel Custom Fallback Points"
/* Steps for the custom accel profile: FLOAT, 1 value */
#define LIBINPUT_PROP_ACCEL_CUSTOM_STEP_FALLBACK "libinput Accel Custom Fallback Step"
/* Points for the custom accel profile: FLOAT, N values */
#define LIBINPUT_PROP_ACCEL_CUSTOM_POINTS_MOTION "libinput Accel Custom Motion Points"
/* Steps for the custom accel profile: FLOAT, 1 value */
#define LIBINPUT_PROP_ACCEL_CUSTOM_STEP_MOTION "libinput Accel Custom Motion Step"
/* Points for the custom accel profile: FLOAT, N values */
#define LIBINPUT_PROP_ACCEL_CUSTOM_POINTS_SCROLL "libinput Accel Custom Scroll Points"
/* Steps for the custom accel profile: FLOAT, 1 value */
#define LIBINPUT_PROP_ACCEL_CUSTOM_STEP_SCROLL "libinput Accel Custom Scroll Step"
/* Natural scrolling: BOOL, 1 value */
#define LIBINPUT_PROP_NATURAL_SCROLL "libinput Natural Scrolling Enabled"
/* Natural scrolling: BOOL, 1 value, read-only */
#define LIBINPUT_PROP_NATURAL_SCROLL_DEFAULT "libinput Natural Scrolling Enabled Default"
/* Send-events mode: BOOL read-only, 2 values in order disabled,
disabled-on-external-mouse */
#define LIBINPUT_PROP_SENDEVENTS_AVAILABLE "libinput Send Events Modes Available"
/* Send-events mode: BOOL, 2 values in order disabled,
disabled-on-external-mouse */
#define LIBINPUT_PROP_SENDEVENTS_ENABLED "libinput Send Events Mode Enabled"
/* Send-events mode: BOOL, 2 values in order disabled,
disabled-on-external-mouse, read-only */
#define LIBINPUT_PROP_SENDEVENTS_ENABLED_DEFAULT "libinput Send Events Mode Enabled Default"
/* Left-handed enabled/disabled: BOOL, 1 value */
#define LIBINPUT_PROP_LEFT_HANDED "libinput Left Handed Enabled"
/* Left-handed enabled/disabled: BOOL, 1 value, read-only */
#define LIBINPUT_PROP_LEFT_HANDED_DEFAULT "libinput Left Handed Enabled Default"
/* Scroll method: BOOL read-only, 3 values in order 2fg, edge, button.
shows available scroll methods */
#define LIBINPUT_PROP_SCROLL_METHODS_AVAILABLE "libinput Scroll Methods Available"
/* Scroll method: BOOL, 3 values in order 2fg, edge, button
only one is enabled at a time at max */
#define LIBINPUT_PROP_SCROLL_METHOD_ENABLED "libinput Scroll Method Enabled"
/* Scroll method: BOOL, 3 values in order 2fg, edge, button
only one is enabled at a time at max, read-only */
#define LIBINPUT_PROP_SCROLL_METHOD_ENABLED_DEFAULT "libinput Scroll Method Enabled Default"
/* Scroll button for button scrolling: 32-bit int, 1 value */
#define LIBINPUT_PROP_SCROLL_BUTTON "libinput Button Scrolling Button"
/* Scroll button for button scrolling: 32-bit int, 1 value, read-only */
#define LIBINPUT_PROP_SCROLL_BUTTON_DEFAULT "libinput Button Scrolling Button Default"
/* Scroll button lock: BOOL, 1 value, TRUE for enabled, FALSE otherwise */
#define LIBINPUT_PROP_SCROLL_BUTTON_LOCK "libinput Button Scrolling Button Lock Enabled"
/* Scroll button lock: BOOL, 1 value, TRUE for enabled, FALSE otherwise, read-only*/
#define LIBINPUT_PROP_SCROLL_BUTTON_LOCK_DEFAULT "libinput Button Scrolling Button Lock Enabled Default"
/* Scroll pixel distance: CARD32, 1 value (with implementation-defined limits) */
#define LIBINPUT_PROP_SCROLL_PIXEL_DISTANCE "libinput Scrolling Pixel Distance"
/* Scroll pixel distance: CARD32, 1 value, read-only */
#define LIBINPUT_PROP_SCROLL_PIXEL_DISTANCE_DEFAULT "libinput Scrolling Pixel Distance Default"
/* Scroll factor: FLOAT, 1 value, 32 bit */
#define LIBINPUT_PROP_SCROLL_FACTOR "libinput Scrolling Factor"
/* Scroll factor: FLOAT, 1 value, 32 bit, read-only */
#define LIBINPUT_PROP_SCROLL_FACTOR_DEFAULT "libinput Scrolling Factor Default"
/* Click method: BOOL read-only, 2 values in order buttonareas, clickfinger
shows available click methods */
#define LIBINPUT_PROP_CLICK_METHODS_AVAILABLE "libinput Click Methods Available"
/* Click method: BOOL, 2 values in order buttonareas, clickfinger
only one enabled at a time at max */
#define LIBINPUT_PROP_CLICK_METHOD_ENABLED "libinput Click Method Enabled"
/* Click method: BOOL, 2 values in order buttonareas, clickfinger
only one enabled at a time at max, read-only */
#define LIBINPUT_PROP_CLICK_METHOD_ENABLED_DEFAULT "libinput Click Method Enabled Default"
/* Middle button emulation: BOOL, 1 value */
#define LIBINPUT_PROP_MIDDLE_EMULATION_ENABLED "libinput Middle Emulation Enabled"
/* Middle button emulation: BOOL, 1 value, read-only */
#define LIBINPUT_PROP_MIDDLE_EMULATION_ENABLED_DEFAULT "libinput Middle Emulation Enabled Default"
/* Disable while typing: BOOL, 1 value */
#define LIBINPUT_PROP_DISABLE_WHILE_TYPING "libinput Disable While Typing Enabled"
/* Disable while typing: BOOL, 1 value, read-only */
#define LIBINPUT_PROP_DISABLE_WHILE_TYPING_DEFAULT "libinput Disable While Typing Enabled Default"
/* Drag lock buttons, either:
CARD8, one value, the meta lock button, or
CARD8, n * 2 values, the drag lock pairs with n being the button and n+1
the target button number */
#define LIBINPUT_PROP_DRAG_LOCK_BUTTONS "libinput Drag Lock Buttons"
/* Horizontal scroll events enabled: BOOL, 1 value (0 or 1).
* If disabled, horizontal scroll events are discarded */
#define LIBINPUT_PROP_HORIZ_SCROLL_ENABLED "libinput Horizontal Scroll Enabled"
/* Number of modes each pad mode group has available: CARD8, one for each
* pad mode group, read-only.
*/
#define LIBINPUT_PROP_TABLET_PAD_MODE_GROUPS_AVAILABLE "libinput Pad Mode Groups Modes Available"
/* Mode each pad mode group is currently in: CARD8, one for each pad mode
* group, read-only.
*/
#define LIBINPUT_PROP_TABLET_PAD_MODE_GROUPS "libinput Pad Mode Groups Modes"
/* The association of each logical button with the pad mode group: INT8,
* one for each logical button. If set to -1 the button cannot be associated
* with a mode group. read-only
*/
#define LIBINPUT_PROP_TABLET_PAD_MODE_GROUP_BUTTONS "libinput Pad Mode Group Buttons"
/* The association of each logical strip with the pad mode group: INT8,
* one for each logical strip. If set to -1 the strip cannot be associated
* with a mode group. read-only
*/
#define LIBINPUT_PROP_TABLET_PAD_MODE_GROUP_STRIPS "libinput Pad Mode Group Strips"
/* The association of each logical ring with the pad mode group: INT8,
* one for each logical ring. If set to -1 the ring cannot be associated
* with a mode group. read-only
*/
#define LIBINPUT_PROP_TABLET_PAD_MODE_GROUP_RINGS "libinput Pad Mode Group Rings"
/* Device rotation: FLOAT, 1 value, 32 bit */
#define LIBINPUT_PROP_ROTATION_ANGLE "libinput Rotation Angle"
/* Device rotation: FLOAT, 1 value, 32 bit, read-only */
#define LIBINPUT_PROP_ROTATION_ANGLE_DEFAULT "libinput Rotation Angle Default"
/* Tablet tool pressure curve: float, 8 values, 32 bit
* Value range is [0.0, 1.0], the values specify the x/y of the four
* control points for a cubic bezier curve.
* Default value: 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
*/
#define LIBINPUT_PROP_TABLET_TOOL_PRESSURECURVE "libinput Tablet Tool Pressurecurve"
/* Tablet tool pressure range: float, 2 values, 32 bit
* Value range is [0.0, 1.0] for min and max physical pressure to map to the logical range
* Default value: 0.0 1.0
*/
#define LIBINPUT_PROP_TABLET_TOOL_PRESSURE_RANGE "libinput Tablet Tool Pressure Range"
/* Tablet tool pressure range: float, 2 values, 32 bit, read-only */
#define LIBINPUT_PROP_TABLET_TOOL_PRESSURE_RANGE_DEFAULT "libinput Tablet Tool Pressure Range Default"
/* Tablet tool area ratio: CARD32, 2 values, w and h */
#define LIBINPUT_PROP_TABLET_TOOL_AREA_RATIO "libinput Tablet Tool Area Ratio"
/* High-resolution wheel scroll events enabled: BOOL, 1 value (0 or 1).
* If disabled, high-resolution wheel scroll events are discarded */
#define LIBINPUT_PROP_HIRES_WHEEL_SCROLL_ENABLED "libinput High Resolution Wheel Scroll Enabled"
/* The tablet tool unique serial number: CARD32, 1 value, constant for the
* lifetime of the device.
*
* If this property exists and is zero, the tool does not have a unique serial
* number.
*/
#define LIBINPUT_PROP_TABLET_TOOL_SERIAL "libinput Tablet Tool Serial"
/* The tablet tool hardware ID: CARD32, 1 value, constant for the lifetime of the device.
*
* This property only exists if the device has a known tool ID.
* See libinput_tablet_tool_get_tool_id() in the libinput documentation for details.
*/
#define LIBINPUT_PROP_TABLET_TOOL_ID "libinput Tablet Tool ID"
#endif /* _LIBINPUT_PROPERTIES_H_ */
+554
View File
@@ -0,0 +1,554 @@
/*
* Copyright © 2010 Intel Corporation
* Copyright © 2010 Francisco Jerez <currojerez@riseup.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*/
#ifndef _XORG_LIST_H_
#define _XORG_LIST_H_
#include <stddef.h> /* offsetof() */
/**
* @file Classic doubly-link circular list implementation.
* For real usage examples of the linked list, see the file test/list.c
*
* Example:
* We need to keep a list of struct foo in the parent struct bar, i.e. what
* we want is something like this.
*
* struct bar {
* ...
* struct foo *list_of_foos; -----> struct foo {}, struct foo {}, struct foo{}
* ...
* }
*
* We need one list head in bar and a list element in all list_of_foos (both are of
* data type 'struct xorg_list').
*
* struct bar {
* ...
* struct xorg_list list_of_foos;
* ...
* }
*
* struct foo {
* ...
* struct xorg_list entry;
* ...
* }
*
* Now we initialize the list head:
*
* struct bar bar;
* ...
* xorg_list_init(&bar.list_of_foos);
*
* Then we create the first element and add it to this list:
*
* struct foo *foo = malloc(...);
* ....
* xorg_list_add(&foo->entry, &bar.list_of_foos);
*
* Repeat the above for each element you want to add to the list. Deleting
* works with the element itself.
* xorg_list_del(&foo->entry);
* free(foo);
*
* Note: calling xorg_list_del(&bar.list_of_foos) will set bar.list_of_foos to an empty
* list again.
*
* Looping through the list requires a 'struct foo' as iterator and the
* name of the field the subnodes use.
*
* struct foo *iterator;
* xorg_list_for_each_entry(iterator, &bar.list_of_foos, entry) {
* if (iterator->something == ...)
* ...
* }
*
* Note: You must not call xorg_list_del() on the iterator if you continue the
* loop. You need to run the safe for-each loop instead:
*
* struct foo *iterator, *next;
* xorg_list_for_each_entry_safe(iterator, next, &bar.list_of_foos, entry) {
* if (...)
* xorg_list_del(&iterator->entry);
* }
*
* WARNING: entries MUST NOT be added to the list twice, otherwise iterating
* will end up in infinite loop.
* WARNING: entries MUST NOT be added to multiple lists - use separate entry
* nodes within the container struct, if it needs to be added to
* several lists at the same time.
*/
/**
* The linkage struct for list nodes. This struct must be part of your
* to-be-linked struct. struct xorg_list is required for both the head of the
* list and for each list node.
*
* Position and name of the struct xorg_list field is irrelevant.
* There are no requirements that elements of a list are of the same type.
* There are no requirements for a list head, any struct xorg_list can be a list
* head.
*/
struct xorg_list {
struct xorg_list *next, *prev;
};
/**
* Initialize the list as an empty list.
*
* Example:
* xorg_list_init(&bar->list_of_foos);
*
* @param list The list to initialize
*/
static inline void
xorg_list_init(struct xorg_list *list)
{
list->next = list->prev = list;
}
static inline void
__xorg_list_autoinit(struct xorg_list *head)
{
if ((!head->prev) && (!head->next))
xorg_list_init(head);
}
static inline void
__xorg_list_add(struct xorg_list *entry,
struct xorg_list *prev, struct xorg_list *next)
{
next->prev = entry;
entry->next = next;
entry->prev = prev;
prev->next = entry;
}
/**
* Insert a new element after the given list head. The new element does not
* need to be initialised as empty list.
* The list changes from:
* head → some element → ...
* to
* head → new element → older element → ...
*
* Example:
* struct foo *newfoo = malloc(...);
* xorg_list_add(&newfoo->entry, &bar->list_of_foos);
*
* @param entry The new element to prepend to the list.
* @param head The existing list.
*/
static inline void
xorg_list_add(struct xorg_list *entry, struct xorg_list *head)
{
__xorg_list_autoinit(head);
__xorg_list_add(entry, head, head->next);
}
/**
* Append a new element to the end of the list given with this list head.
*
* The list changes from:
* head → some element → ... → lastelement
* to
* head → some element → ... → lastelement → new element
*
* Example:
* struct foo *newfoo = malloc(...);
* xorg_list_append(&newfoo->entry, &bar->list_of_foos);
*
* @param entry The new element to append to the list.
* @param head The existing list.
*/
static inline void
xorg_list_append(struct xorg_list *entry, struct xorg_list *head)
{
__xorg_list_autoinit(head);
__xorg_list_add(entry, head->prev, head);
}
static inline void
__xorg_list_del(struct xorg_list *prev, struct xorg_list *next)
{
next->prev = prev;
prev->next = next;
}
/**
* Remove the element from the list it is in. Using this function will reset
* the pointers to/from this element so it is removed from the list. It does
* NOT free the element itself or manipulate it otherwise.
*
* Using xorg_list_del on a pure list head (like in the example at the top of
* this file) will NOT remove the first element from
* the list but rather reset the list as empty list.
*
* Example:
* xorg_list_del(&foo->entry);
*
* @param entry The element to remove.
*/
static inline void
xorg_list_del(struct xorg_list *entry)
{
__xorg_list_autoinit(entry);
__xorg_list_del(entry->prev, entry->next);
xorg_list_init(entry);
}
/**
* Check if the list is empty.
*
* Example:
* xorg_list_is_empty(&bar->list_of_foos);
*
* @return True if the list is empty or False if the list contains one or more
* elements.
*/
static inline int
xorg_list_is_empty(struct xorg_list *head)
{
return ((head->next == NULL) || (head->next == head));
}
/**
* @brief check whether element already is in list
*
* @param entry The element to check for
* @param head The existing list.
* @return zero when entry isn't present in list, otherwise non-zero
*/
static inline int
xorg_list_present(struct xorg_list *entry, struct xorg_list *head)
{
for (struct xorg_list *l=head->next; l && (l != head); l=l->next) {
if (l == entry)
return 1;
}
return 0;
}
/**
* @brief prepend a new element to the end of the list if not existing yet
*
* Same as xorg_list_add(), but protecting against duplicate insertion.
*
* @param entry The new element to append to the list.
* @param head The existing list.
* @return zero if element already in list, otherwise non-zero
*/
static inline int
xorg_list_add_ndup(struct xorg_list *entry, struct xorg_list *head)
{
if (xorg_list_present(entry, head))
return 0;
xorg_list_add(entry, head);
return 1;
}
/**
* @brief append a new element to the end of the list if not existing yet
*
* Same as xorg_list_append(), but protecting against duplicate insertion.
*
* @param entry The new element to append to the list.
* @param head The existing list.
* @return zero if element already in list, otherwise non-zero
*/
static inline int
xorg_list_append_ndup(struct xorg_list *entry, struct xorg_list *head)
{
if (xorg_list_present(entry, head))
return 0;
xorg_list_append(entry, head);
return 1;
}
/**
* Returns a pointer to the container of this list element.
*
* Example:
* struct foo* f;
* f = container_of(&foo->entry, struct foo, entry);
* assert(f == foo);
*
* @param ptr Pointer to the struct xorg_list.
* @param type Data type of the list element.
* @param member Member name of the struct xorg_list field in the list element.
* @return A pointer to the data struct containing the list head.
*/
#ifndef container_of
#define container_of(ptr, type, member) \
(type *)((char *)(ptr) - offsetof(type, member))
#endif
/**
* Alias of container_of
*/
#define xorg_list_entry(ptr, type, member) \
container_of((ptr), type, member)
/**
* Retrieve the first list entry for the given list pointer.
*
* Example:
* struct foo *first;
* first = xorg_list_first_entry(&bar->list_of_foos, struct foo, list_of_foos);
*
* @param ptr The list head
* @param type Data type of the list element to retrieve
* @param member Member name of the struct xorg_list field in the list element.
* @return A pointer to the first list element.
*/
#define xorg_list_first_entry(ptr, type, member) \
xorg_list_entry((ptr)->next, type, member)
/**
* Retrieve the last list entry for the given listpointer.
*
* Example:
* struct foo *first;
* first = xorg_list_last_entry(&bar->list_of_foos, struct foo, list_of_foos);
*
* @param ptr The list head
* @param type Data type of the list element to retrieve
* @param member Member name of the struct xorg_list field in the list element.
* @return A pointer to the last list element.
*/
#define xorg_list_last_entry(ptr, type, member) \
xorg_list_entry((ptr)->prev, type, member)
#define __container_of(ptr, sample, member) \
container_of((ptr), typeof(*(sample)), member)
/**
* Loop through the list given by head and set pos to struct in the list.
*
* Example:
* struct foo *iterator;
* xorg_list_for_each_entry(iterator, &bar->list_of_foos, entry) {
* [modify iterator]
* }
*
* This macro is not safe for node deletion. Use xorg_list_for_each_entry_safe
* instead.
*
* @param pos Iterator variable of the type of the list elements.
* @param head List head
* @param member Member name of the struct xorg_list in the list elements.
*
*/
#define xorg_list_for_each_entry(pos, head, member) \
for ((pos) = NULL, \
(pos) = __container_of((head)->next, (pos), member); \
(((head)->next != NULL) && &(pos)->member != (head)); \
(pos) = __container_of((pos)->member.next, (pos), member))
/**
* Loop through the list, keeping a backup pointer to the element. This
* macro allows for the deletion of a list element while looping through the
* list.
*
* See xorg_list_for_each_entry for more details.
*/
#define xorg_list_for_each_entry_safe(pos, tmp, head, member) \
for ((pos) = NULL, \
(pos) = __container_of((head)->next, (pos), member), \
(tmp) = __container_of((head)->next ? (pos)->member.next : NULL, (pos), member); \
(((head)->next != NULL) && (&(pos)->member != (head))); \
(pos) = (tmp), (tmp) = __container_of((pos)->member.next, (tmp), member))
/* NULL-Terminated List Interface
*
* The interface below does _not_ use the struct xorg_list as described above.
* It is mainly for legacy structures that cannot easily be switched to
* struct xorg_list.
*
* This interface is for structs like
* struct foo {
* [...]
* struct foo *next;
* [...]
* };
*
* The position and field name of "next" are arbitrary.
*/
/**
* Init the element as null-terminated list.
*
* Example:
* struct foo *list = malloc();
* nt_list_init(list, next);
*
* @param list The list element that will be the start of the list
* @param member Member name of the field pointing to next struct
*/
#define nt_list_init(_list, _member) \
(_list)->_member = NULL
/**
* Returns the next element in the list or NULL on termination.
*
* Example:
* struct foo *element = list;
* while ((element = nt_list_next(element, next)) { }
*
* This macro is not safe for node deletion. Use nt_list_for_each_entry_safe
* instead.
*
* @param list The list or current element.
* @param member Member name of the field pointing to next struct.
*/
#define nt_list_next(_list, _member) \
(_list)->_member
/**
* Iterate through each element in the list.
*
* Example:
* struct foo *iterator;
* nt_list_for_each_entry(iterator, list, next) {
* [modify iterator]
* }
*
* @param entry Assigned to the current list element
* @param list The list to iterate through.
* @param member Member name of the field pointing to next struct.
*/
#define nt_list_for_each_entry(_entry, _list, _member) \
for ((_entry) = (_list); (_entry); (_entry) = (_entry)->_member)
/**
* Iterate through each element in the list, keeping a backup pointer to the
* element. This macro allows for the deletion of a list element while
* looping through the list.
*
* See nt_list_for_each_entry for more details.
*
* @param entry Assigned to the current list element
* @param tmp The pointer to the next element
* @param list The list to iterate through.
* @param member Member name of the field pointing to next struct.
*/
#define nt_list_for_each_entry_safe(_entry, _tmp, _list, _member) \
for ((_entry) = (_list), (_tmp) = (_entry) ? (_entry)->_member : NULL;\
(_entry); \
(_entry) = (_tmp), (_tmp) = (_tmp) ? (_tmp)->_member: NULL)
/**
* Append the element to the end of the list. This macro may be used to
* merge two lists.
*
* Example:
* struct foo *elem = malloc(...);
* nt_list_init(elem, next)
* nt_list_append(elem, list, struct foo, next);
*
* Resulting list order:
* list_item_0 -> list_item_1 -> ... -> elem_item_0 -> elem_item_1 ...
*
* @param entry An entry (or list) to append to the list
* @param list The list to append to. This list must be a valid list, not
* NULL.
* @param type The list type
* @param member Member name of the field pointing to next struct
*/
#define nt_list_append(_entry, _list, _type, _member) \
do { \
_type *__iterator = (_list); \
while (__iterator->_member) { __iterator = __iterator->_member;}\
__iterator->_member = (_entry); \
} while (0)
/**
* Insert the element at the next position in the list. This macro may be
* used to insert a list into a list.
*
* struct foo *elem = malloc(...);
* nt_list_init(elem, next)
* nt_list_insert(elem, list, struct foo, next);
*
* Resulting list order:
* list_item_0 -> elem_item_0 -> elem_item_1 ... -> list_item_1 -> ...
*
* @param entry An entry (or list) to append to the list
* @param list The list to insert to. This list must be a valid list, not
* NULL.
* @param type The list type
* @param member Member name of the field pointing to next struct
*/
#define nt_list_insert(_entry, _list, _type, _member) \
do { \
nt_list_append((_list)->_member, (_entry), _type, _member); \
(_list)->_member = (_entry); \
} while (0)
/**
* Delete the entry from the list by iterating through the list and
* removing any reference from the list to the entry.
*
* Example:
* struct foo *elem = <assign to right element>
* nt_list_del(elem, list, struct foo, next);
*
* @param entry The entry to delete from the list. entry is always
* re-initialized as a null-terminated list.
* @param list The list containing the entry, set to the new list without
* the removed entry.
* @param type The list type
* @param member Member name of the field pointing to the next entry
*/
#define nt_list_del(_entry, _list, _type, _member) \
do { \
_type *__e = (_entry); \
if (__e == NULL || (_list) == NULL) break; \
if ((_list) == __e) { \
(_list) = __e->_member; \
} else { \
_type *__prev = (_list); \
while (__prev->_member && __prev->_member != __e) \
__prev = nt_list_next(__prev, _member); \
if (__prev->_member) \
__prev->_member = __e->_member; \
} \
nt_list_init(__e, _member); \
} while(0)
/**
* DO NOT USE THIS.
* This is a remainder of the xfree86 DDX attempt of having a set of generic
* list functions. Unfortunately, the xf86OptionRec uses it and we can't
* easily get rid of it. Do not use for new code.
*/
typedef struct generic_list_rec {
void *next;
} GenericListRec, *GenericListPtr, *glp;
#endif
+300
View File
@@ -0,0 +1,300 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef MI_H
#define MI_H
#include <X11/X.h>
#include <X11/fonts/font.h>
#include "regionstr.h"
#include "validate.h"
#include "window.h"
#include "gc.h"
#include "input.h"
#include "cursor.h"
#include "privates.h"
#include "colormap.h"
#include "events.h"
#define MiBits CARD32
typedef struct _miDash *miDashPtr;
#define EVEN_DASH 0
#define ODD_DASH ~0
/* miarc.c */
extern _X_EXPORT void miPolyArc(DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ ,
int /*narcs */ ,
xArc * /*parcs */
);
/* micopy.c */
#define miGetCompositeClip(pGC) ((pGC)->pCompositeClip)
typedef void (*miCopyProc) (DrawablePtr pSrcDrawable,
DrawablePtr pDstDrawable,
GCPtr pGC,
BoxPtr pDstBox,
int nbox,
int dx,
int dy,
Bool reverse,
Bool upsidedown, Pixel bitplane, void *closure);
extern _X_EXPORT void
miCopyRegion(DrawablePtr pSrcDrawable,
DrawablePtr pDstDrawable,
GCPtr pGC,
RegionPtr pDstRegion,
int dx,
int dy, miCopyProc copyProc, Pixel bitPlane, void *closure);
extern _X_EXPORT RegionPtr
miDoCopy(DrawablePtr pSrcDrawable,
DrawablePtr pDstDrawable,
GCPtr pGC,
int xIn,
int yIn,
int widthSrc,
int heightSrc,
int xOut,
int yOut, miCopyProc copyProc, Pixel bitplane, void *closure);
/* mieq.c */
#ifndef INPUT_H
typedef struct _DeviceRec *DevicePtr;
#endif
/* miexpose.c */
extern _X_EXPORT RegionPtr miHandleExposures(DrawablePtr /*pSrcDrawable */ ,
DrawablePtr /*pDstDrawable */ ,
GCPtr /*pGC */ ,
int /*srcx */ ,
int /*srcy */ ,
int /*width */ ,
int /*height */ ,
int /*dstx */ ,
int /*dsty */
);
extern _X_EXPORT void miClearDrawable(DrawablePtr /*pDraw */ ,
GCPtr /*pGC */
);
/* miglblt.c */
extern _X_EXPORT void miPolyGlyphBlt(DrawablePtr pDrawable,
GCPtr pGC,
int x,
int y,
unsigned int nglyph,
CharInfoPtr *ppci,
void *pglyphBase
);
extern _X_EXPORT void miImageGlyphBlt(DrawablePtr pDrawable,
GCPtr pGC,
int x,
int y,
unsigned int nglyph,
CharInfoPtr *ppci,
void *pglyphBase
);
/* mipoly.c */
extern _X_EXPORT void miFillPolygon(DrawablePtr /*dst */ ,
GCPtr /*pgc */ ,
int /*shape */ ,
int /*mode */ ,
int /*count */ ,
DDXPointPtr /*pPts */
);
/* mipolypnt.c */
extern _X_EXPORT void miPolyPoint(DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*mode */ ,
int /*npt */ ,
xPoint * /*pptInit */
);
/* mipolyrect.c */
extern _X_EXPORT void miPolyRectangle(DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ ,
int /*nrects */ ,
xRectangle * /*pRects */
);
/* mipolyseg.c */
extern _X_EXPORT void miPolySegment(DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ ,
int /*nseg */ ,
xSegment * /*pSegs */
);
/* mipolytext.c */
extern _X_EXPORT int miPolyText8(DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ ,
int /*x */ ,
int /*y */ ,
int /*count */ ,
char * /*chars */
);
extern _X_EXPORT int miPolyText16(DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ ,
int /*x */ ,
int /*y */ ,
int /*count */ ,
unsigned short * /*chars */
);
extern _X_EXPORT void miImageText8(DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ ,
int /*x */ ,
int /*y */ ,
int /*count */ ,
char * /*chars */
);
extern _X_EXPORT void miImageText16(DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ ,
int /*x */ ,
int /*y */ ,
int /*count */ ,
unsigned short * /*chars */
);
/* mipushpxl.c */
extern _X_EXPORT void miPushPixels(GCPtr /*pGC */ ,
PixmapPtr /*pBitMap */ ,
DrawablePtr /*pDrawable */ ,
int /*dx */ ,
int /*dy */ ,
int /*xOrg */ ,
int /*yOrg */
);
/* miscrinit.c */
extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr pPixmap,
int width,
int height,
int depth,
int bitsPerPixel,
int devKind,
void *pPixData
);
extern _X_EXPORT Bool miScreenInit(ScreenPtr pScreen,
void *pbits,
int xsize,
int ysize,
int dpix,
int dpiy,
int width,
int rootDepth,
int numDepths,
DepthPtr depths,
VisualID rootVisual,
int numVisuals,
VisualPtr visuals
);
/* mivaltree.c */
extern _X_EXPORT void miWideLine(DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*mode */ ,
int /*npt */ ,
DDXPointPtr /*pPts */
);
extern _X_EXPORT void miWideDash(DrawablePtr /*pDrawable */ ,
GCPtr /*pGC */ ,
int /*mode */ ,
int /*npt */ ,
DDXPointPtr /*pPts */
);
extern _X_EXPORT void miPolylines(DrawablePtr pDrawable,
GCPtr pGC,
int mode,
int npt,
DDXPointPtr pPts);
/* mizerarc.c */
extern _X_EXPORT void miZeroPolyArc(DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ ,
int /*narcs */ ,
xArc * /*parcs */
);
_X_EXPORT void miZeroLine(DrawablePtr dst, GCPtr gc, int mode, int nptInit, xPoint* pptInit);
_X_EXPORT void miZeroDashLine(DrawablePtr dst, GCPtr pgc, int mode, int nptInit, xPoint *pptInit);
extern _X_EXPORT void miPolyFillArc(DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ ,
int /*narcs */ ,
xArc * /*parcs */
);
#endif /* MI_H */
+43
View File
@@ -0,0 +1,43 @@
#ifndef _MICMAP_H_
#define _MICMAP_H_
#include <X11/X.h>
#include <X11/Xdefs.h>
#include <X11/Xfuncproto.h>
#include "colormap.h"
#include "privates.h"
#include "screenint.h"
extern _X_EXPORT DevPrivateKeyRec micmapScrPrivateKeyRec;
#define micmapScrPrivateKey (&micmapScrPrivateKeyRec)
extern _X_EXPORT int miListInstalledColormaps(ScreenPtr pScreen,
Colormap * pmaps);
extern _X_EXPORT void miInstallColormap(ColormapPtr pmap);
extern _X_EXPORT void miUninstallColormap(ColormapPtr pmap);
extern _X_EXPORT void miResolveColor(unsigned short *, unsigned short *,
unsigned short *, VisualPtr);
extern _X_EXPORT Bool miInitializeColormap(ColormapPtr);
extern _X_EXPORT Bool miCreateDefColormap(ScreenPtr);
extern _X_EXPORT void miClearVisualTypes(void);
extern _X_EXPORT Bool miSetVisualTypes(int, int, int, int);
extern _X_EXPORT Bool miSetPixmapDepths(void);
extern _X_EXPORT Bool miSetVisualTypesAndMasks(int depth, int visuals,
int bitsPerRGB, int preferredCVC,
Pixel redMask, Pixel greenMask,
Pixel blueMask);
extern _X_EXPORT int miGetDefaultVisualMask(int);
extern _X_EXPORT Bool miInitVisuals(VisualPtr *, DepthPtr *, int *, int *,
int *, VisualID *, unsigned long, int, int);
#define MAX_PSEUDO_DEPTH 10
#define StaticColorMask (1 << StaticColor)
#define PseudoColorMask (1 << PseudoColor)
#define TrueColorMask (1 << TrueColor)
#define DirectColorMask (1 << DirectColor)
#endif /* _MICMAP_H_ */
@@ -0,0 +1,47 @@
/*
* Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the XFree86 Project shall
* not be used in advertising or otherwise to promote the sale, use or other
* dealings in this Software without prior written authorization from the
* XFree86 Project.
*
*/
#ifndef _MICOORD_H_
#define _MICOORD_H_ 1
#include "servermd.h"
/* Macros which handle a coordinate in a single register */
#define GetHighWord(x) (((int) (x)) >> 16)
#if IMAGE_BYTE_ORDER == MSBFirst
#define coordToInt(x,y) (((x) << 16) | ((y) & 0xffff))
#define intToX(i) (GetHighWord((i)))
#define intToY(i) ((int) ((short) (i)))
#else
#define coordToInt(x,y) (((y) << 16) | ((x) & 0xffff))
#define intToX(i) ((int) ((short) (i)))
#define intToY(i) (GetHighWord((i)))
#endif
#endif /* _MICOORD_H_ */
+54
View File
@@ -0,0 +1,54 @@
/*
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifndef _MIGC_H
#define _MIGC_H
extern _X_EXPORT void miChangeGC(GCPtr pGC,
unsigned long mask);
extern _X_EXPORT void miDestroyGC(GCPtr pGC);
extern _X_EXPORT void miDestroyClip(GCPtr pGC);
extern _X_EXPORT void miChangeClip(GCPtr pGC,
int type,
void *pvalue,
int nrects);
extern _X_EXPORT void miCopyClip(GCPtr pgcDst,
GCPtr pgcSrc);
extern _X_EXPORT void miCopyGC(GCPtr pGCSrc,
unsigned long changes,
GCPtr pGCDst);
extern _X_EXPORT void miComputeCompositeClip(GCPtr pGC,
DrawablePtr pDrawable);
#endif
+152
View File
@@ -0,0 +1,152 @@
/*
Copyright 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef MILINE_H
#define MILINE_H
#include "screenint.h"
#include "privates.h"
/*
* Public definitions used for configuring basic pixelization aspects
* of the sample implementation line-drawing routines provided in
* {mfb,mi,cfb*} at run-time.
*/
#define XDECREASING 4
#define YDECREASING 2
#define YMAJOR 1
#define OCTANT1 (1 << (YDECREASING))
#define OCTANT2 (1 << (YDECREASING|YMAJOR))
#define OCTANT3 (1 << (XDECREASING|YDECREASING|YMAJOR))
#define OCTANT4 (1 << (XDECREASING|YDECREASING))
#define OCTANT5 (1 << (XDECREASING))
#define OCTANT6 (1 << (XDECREASING|YMAJOR))
#define OCTANT7 (1 << (YMAJOR))
#define OCTANT8 (1 << (0))
/*
* Devices can configure the rendering of routines in mi, mfb, and cfb*
* by specifying a thin line bias to be applied to a particular screen
* using the following function. The bias parameter is an OR'ing of
* the appropriate OCTANT constants defined above to indicate which
* octants to bias a line to prefer an axial step when the Bresenham
* error term is exactly zero. The octants are mapped as follows:
*
* \ | /
* \ 3 | 2 /
* \ | /
* 4 \ | / 1
* \|/
* -----------
* /|\
* 5 / | \ 8
* / | \
* / 6 | 7 \
* / | \
*
* For more information, see "Ambiguities in Incremental Line Rastering,"
* Jack E. Bresenham, IEEE CG&A, May 1987.
*/
extern _X_EXPORT void miSetZeroLineBias(ScreenPtr /* pScreen */ ,
unsigned int /* bias */
);
/*
* Private definitions needed for drawing thin (zero width) lines
* Used by the mi, mfb, and all cfb* components.
*/
#define X_AXIS 0
#define Y_AXIS 1
#define OUT_LEFT 0x08
#define OUT_RIGHT 0x04
#define OUT_ABOVE 0x02
#define OUT_BELOW 0x01
#define OUTCODES(_result, _x, _y, _pbox) \
if ( (_x) < (_pbox)->x1) (_result) |= OUT_LEFT; \
else if ( (_x) >= (_pbox)->x2) (_result) |= OUT_RIGHT; \
if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \
else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW;
#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \
{\
if ((x) < (xmin)) (outcode) |= OUT_LEFT;\
if ((x) > (xmax)) (outcode) |= OUT_RIGHT;\
if ((y) < (ymin)) (outcode) |= OUT_ABOVE;\
if ((y) > (ymax)) (outcode) |= OUT_BELOW;\
}
#define miGetZeroLineBias(_pScreen) ((unsigned long) (unsigned long*)\
dixLookupPrivate(&(_pScreen)->devPrivates, miZeroLineScreenKey))
#define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \
(_octant) = 0; \
(_sx) = (_SX); \
if (((_adx) = (_x2) - (_x1)) < 0) { \
(_adx) = -(_adx); \
((_sx) = -(_sx)); \
(_octant) |= XDECREASING; \
} \
(_sy) = (_SY); \
if (((_ady) = (_y2) - (_y1)) < 0) { \
(_ady) = -(_ady); \
((_sy) = -(_sy)); \
(_octant) |= YDECREASING; \
}
#define SetYMajorOctant(_octant) ((_octant) |= YMAJOR)
#define FIXUP_ERROR(_e, _octant, _bias) \
(_e) -= (((_bias) >> (_octant)) & 1)
extern _X_EXPORT DevPrivateKeyRec miZeroLineScreenKeyRec;
#define miZeroLineScreenKey (&miZeroLineScreenKeyRec)
extern _X_EXPORT int miZeroClipLine(int /*xmin */ ,
int /*ymin */ ,
int /*xmax */ ,
int /*ymax */ ,
int * /*new_x1 */ ,
int * /*new_y1 */ ,
int * /*new_x2 */ ,
int * /*new_y2 */ ,
unsigned int /*adx */ ,
unsigned int /*ady */ ,
int * /*pt1_clipped */ ,
int * /*pt2_clipped */ ,
int /*octant */ ,
unsigned int /*bias */ ,
int /*oc1 */ ,
int /*oc2 */
);
#endif /* MILINE_H */
+124
View File
@@ -0,0 +1,124 @@
/*
*
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Keith Packard, SuSE, Inc.
*/
#ifndef _MIPICT_H_
#define _MIPICT_H_
#include "picturestr.h"
#define MI_MAX_INDEXED 256 /* XXX depth must be <= 8 */
#if MI_MAX_INDEXED <= 256
typedef CARD8 miIndexType;
#endif
typedef struct _miIndexed {
Bool color;
CARD32 rgba[MI_MAX_INDEXED];
miIndexType ent[32768];
} miIndexedRec, *miIndexedPtr;
#define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
(((s) >> 6) & 0x03e0) | \
(((s) >> 9) & 0x7c00))
#define miIndexToEnt15(mif,rgb15) ((mif)->ent[(rgb15)])
#define miIndexToEnt24(mif,rgb24) miIndexToEnt15((mif),miCvtR8G8B8to15((rgb24)))
#define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15((rgb24))])
extern _X_EXPORT int
miCreatePicture(PicturePtr pPicture);
extern _X_EXPORT void
miDestroyPicture(PicturePtr pPicture);
extern _X_EXPORT void
miCompositeSourceValidate(PicturePtr pPicture);
extern _X_EXPORT Bool
miComputeCompositeRegion(RegionPtr pRegion,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
extern _X_EXPORT Bool
miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
extern _X_EXPORT Bool
miRealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph);
extern _X_EXPORT void
miUnrealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph);
extern _X_EXPORT void
miGlyphs(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc,
INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs);
extern _X_EXPORT void
miRenderColorToPixel(PictFormatPtr pPict, xRenderColor * color, CARD32 *pixel);
extern _X_EXPORT void
miRenderPixelToColor(PictFormatPtr pPict, CARD32 pixel, xRenderColor * color);
extern _X_EXPORT Bool
miIsSolidAlpha(PicturePtr pSrc);
extern _X_EXPORT void
miCompositeRects(CARD8 op,
PicturePtr pDst,
xRenderColor * color, int nRect, xRectangle *rects);
extern _X_EXPORT void
miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box);
extern _X_EXPORT void
miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds);
extern _X_EXPORT void
miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds);
extern _X_EXPORT Bool
miInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
extern _X_EXPORT void
miCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
extern _X_EXPORT void
miUpdateIndexed(ScreenPtr pScreen,
PictFormatPtr pFormat, int ndef, xColorItem * pdef);
#endif /* _MIPICT_H_ */
@@ -0,0 +1,129 @@
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef MIPOINTER_H
#define MIPOINTER_H
#include "cursor.h"
#include "input.h"
#include "privates.h"
typedef struct _miPointerSpriteFuncRec {
Bool (*RealizeCursor) (DeviceIntPtr /* pDev */ ,
ScreenPtr /* pScr */ ,
CursorPtr /* pCurs */
);
Bool (*UnrealizeCursor) (DeviceIntPtr /* pDev */ ,
ScreenPtr /* pScr */ ,
CursorPtr /* pCurs */
);
void (*SetCursor) (DeviceIntPtr /* pDev */ ,
ScreenPtr /* pScr */ ,
CursorPtr /* pCurs */ ,
int /* x */ ,
int /* y */
);
void (*MoveCursor) (DeviceIntPtr /* pDev */ ,
ScreenPtr /* pScr */ ,
int /* x */ ,
int /* y */
);
Bool (*DeviceCursorInitialize) (DeviceIntPtr /* pDev */ ,
ScreenPtr /* pScr */
);
void (*DeviceCursorCleanup) (DeviceIntPtr /* pDev */ ,
ScreenPtr /* pScr */
);
} miPointerSpriteFuncRec, *miPointerSpriteFuncPtr;
typedef struct _miPointerScreenFuncRec {
Bool (*CursorOffScreen) (ScreenPtr * /* ppScr */ ,
int * /* px */ ,
int * /* py */
);
void (*CrossScreen) (ScreenPtr /* pScr */ ,
int /* entering */
);
void (*WarpCursor) (DeviceIntPtr /*pDev */ ,
ScreenPtr /* pScr */ ,
int /* x */ ,
int /* y */
);
} miPointerScreenFuncRec, *miPointerScreenFuncPtr;
extern _X_EXPORT Bool miDCInitialize(ScreenPtr /*pScreen */ ,
miPointerScreenFuncPtr /*screenFuncs */
);
extern _X_EXPORT ScreenPtr
miPointerGetScreen(DeviceIntPtr pDev);
/* Returns the current cursor position. */
extern _X_EXPORT void
miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y);
/* Moves the cursor to the specified position. May clip the coordinates:
* x and y are modified in-place. */
extern _X_EXPORT ScreenPtr
miPointerSetPosition(DeviceIntPtr pDev, int mode, double *x, double *y,
int *nevents, InternalEvent *events);
extern _X_EXPORT DevPrivateKeyRec miPointerScreenKeyRec;
#define miPointerScreenKey (&miPointerScreenKeyRec)
/**
* @brief initialize pointer cursor with custom handling
*
* For DDX'es that need their own handling of pointer cursors,
* and can't use the generic "soft cursor" that's created via
* miDCInitialize().
*
* That can be the case on certain video HW with it's own sprite support,
* or on remote display protocols like RDP, where the client get the cursor
* pixmaps sent over the wire and is responsible for painting it on his side.
*
* Overwrites ScreenPtr vectors:
*
* ConstrainCursor, CursorLimits, DisplayCursor, RealizeCursor,
* UnrealizeCursor, SetCursorPosition, RecolorCursor, DeviceCursorCleanup
* DeviceCursorInitialize
*
* Hooks to ScreenPtr vectors: CloseScreen
*
* @param pScreen pointer to ScreenRec the pointer handling applies to
* @param spireFuncs pointer to miPointerSpriteFuncPtr call vectors
* @param screenFuncs pointer to miPointerScreenFuncPtr call vectors
* @param waitForUpdate TRUE if MI shouldn't redraw the pointer immediately,
but wait for somebody else triggering it explicitly
* @return TRUE on success, FALSE usually indicates allocation failure
*/
_X_EXPORT Bool
miPointerInitialize(ScreenPtr pScreen,
miPointerSpriteFuncPtr spriteFuncs,
miPointerScreenFuncPtr screenFuncs,
Bool waitForUpdate);
#endif /* MIPOINTER_H */
@@ -0,0 +1,44 @@
/*
* mipointrst.h
*
*/
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef MIPOINTRST_H
#define MIPOINTRST_H
#include "mipointer.h"
#include "scrnintstr.h"
typedef struct {
miPointerSpriteFuncPtr spriteFuncs; /* sprite-specific methods */
miPointerScreenFuncPtr screenFuncs; /* screen-specific methods */
CloseScreenProcPtr CloseScreen;
Bool waitForUpdate; /* don't move cursor from input thread */
Bool showTransparent; /* show empty cursors */
} miPointerScreenRec, *miPointerScreenPtr;
#endif /* MIPOINTRST_H */
+306
View File
@@ -0,0 +1,306 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
Copyright 1992, 1993 Data General Corporation;
Copyright 1992, 1993 OMRON Corporation
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that the
above copyright notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting documentation, and that
neither the name OMRON or DATA GENERAL be used in advertising or publicity
pertaining to distribution of the software without specific, written prior
permission of the party whose name is to be used. Neither OMRON or
DATA GENERAL make any representation about the suitability of this software
for any purpose. It is provided "as is" without express or implied warranty.
OMRON AND DATA GENERAL EACH DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL OMRON OR DATA GENERAL BE LIABLE FOR ANY SPECIAL, INDIRECT
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.
******************************************************************/
#ifndef MISC_H
#define MISC_H 1
/*
* X internal definitions
*
*/
#include <X11/Xosdefs.h>
#include <X11/Xfuncproto.h>
#include <X11/Xmd.h>
#include <X11/X.h>
#include <X11/Xdefs.h>
#include <stddef.h>
#include <stdint.h>
#include <pthread.h>
#ifndef MAXSCREENS
#define MAXSCREENS 16
#endif
#ifndef MAXGPUSCREENS
#define MAXGPUSCREENS 16
#endif
#define MAXFORMATS 8
#ifndef MAXDEVICES
#define MAXDEVICES 256 /* input devices */
#endif
#define GPU_SCREEN_OFFSET 256
/* 128 event opcodes for core + extension events, excluding GE */
#define MAXEVENTS 128
#define EXTENSION_EVENT_BASE 64
#define EXTENSION_BASE 128
typedef uint32_t ATOM;
/* @brief generic X return code
*
* this type is should be used instead of plain int for all functions
* returning and X error code (that's possibly sent to the client),
* in order to make return value semantics clear to the humen reader.
*
* part of public SDK / driver API.
*/
typedef int XRetCode;
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */
#include <X11/Xfuncs.h> /* for bcopy, bzero, and bcmp */
#define NullBox ((BoxPtr)0)
#undef min
#undef max
/* @deprecated */
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))
/* abs() is a function, not a macro; include the file declaring
* it in case we haven't done that yet.
*/
/* this assumes b > 0 */
#define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b)
/* XXX Not for modules */
#include <limits.h>
#if !defined(MAXSHORT) || !defined(MINSHORT) || \
!defined(MAXINT) || !defined(MININT)
/*
* Some implementations #define these through <math.h>, so preclude
* #include'ing it later.
*/
#include <math.h>
#undef MAXSHORT
#define MAXSHORT SHRT_MAX
#undef MINSHORT
#define MINSHORT SHRT_MIN
#undef MAXINT
#define MAXINT INT_MAX
#undef MININT
#define MININT INT_MIN
#include <assert.h>
#include <ctype.h>
#include <stdio.h> /* for fopen, etc... */
#endif
/**
* Calculate the number of bytes needed to hold bits.
* @param bits The minimum number of bits needed.
* @return The number of bytes needed to hold bits.
*/
static inline int
bits_to_bytes(const int bits)
{
return ((bits + 7) >> 3);
}
/**
* Calculate the number of 4-byte units needed to hold the given number of
* bytes.
* @param bytes The minimum number of bytes needed.
* @return The number of 4-byte units needed to hold bytes.
*/
static inline CARD32
bytes_to_int32(const size_t bytes)
{
return (CARD32)(((bytes) + 3) >> 2);
}
/**
* Calculate the number of bytes (in multiples of 4) needed to hold bytes.
* @param bytes The minimum number of bytes needed.
* @return The closest multiple of 4 that is equal or higher than bytes.
*/
static inline int
pad_to_int32(const int bytes)
{
return (((bytes) + 3) & ~3);
}
/**
* Calculate padding needed to bring the number of bytes to an even
* multiple of 4.
* @param bytes The minimum number of bytes needed.
* @return The bytes of padding needed to arrive at the closest multiple of 4
* that is equal or higher than bytes.
*/
static inline int
padding_for_int32(const int bytes)
{
return ((-bytes) & 3);
}
/* some macros to help swap requests, replies, and events */
#define LengthRestS(stuff) \
((client->req_len << 1) - (sizeof(*(stuff)) >> 1))
#define SwapRestS(stuff) \
SwapShorts((short *)((stuff) + 1), LengthRestS((stuff)))
#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
void __attribute__ ((error("wrong sized variable passed to swap")))
wrong_size(void);
#else
static inline void
wrong_size(void)
{
}
#endif
#if !(defined(__GNUC__))
static inline int
__builtin_constant_p(int x)
{
return 0;
}
#endif
static inline uint64_t
bswap_64(uint64_t x)
{
return (((x & 0xFF00000000000000ull) >> 56) |
((x & 0x00FF000000000000ull) >> 40) |
((x & 0x0000FF0000000000ull) >> 24) |
((x & 0x000000FF00000000ull) >> 8) |
((x & 0x00000000FF000000ull) << 8) |
((x & 0x0000000000FF0000ull) << 24) |
((x & 0x000000000000FF00ull) << 40) |
((x & 0x00000000000000FFull) << 56));
}
#define swapll(x) do { \
if (sizeof(*(x)) != 8) \
wrong_size(); \
*(x) = bswap_64(*(x)); \
} while (0)
static inline uint32_t
bswap_32(uint32_t x)
{
return (((x & 0xFF000000) >> 24) |
((x & 0x00FF0000) >> 8) |
((x & 0x0000FF00) << 8) |
((x & 0x000000FF) << 24));
}
#define swapl(x) do { \
if (sizeof(*(x)) != 4) \
wrong_size(); \
*(x) = bswap_32(*(x)); \
} while (0)
static inline uint16_t
bswap_16(uint16_t x)
{
return (((x & 0xFF00) >> 8) |
((x & 0x00FF) << 8));
}
#define swaps(x) do { \
if (sizeof(*(x)) != 2) \
wrong_size(); \
*(x) = bswap_16(*(x)); \
} while (0)
/* copy 32-bit value from src to dst byteswapping on the way */
#define cpswapl(src, dst) do { \
if (sizeof((src)) != 4 || sizeof((dst)) != 4) \
wrong_size(); \
(dst) = bswap_32((src)); \
} while (0)
/* copy short from src to dst byteswapping on the way */
#define cpswaps(src, dst) do { \
if (sizeof((src)) != 2 || sizeof((dst)) != 2) \
wrong_size(); \
(dst) = bswap_16((src)); \
} while (0)
extern _X_EXPORT void SwapShorts(short *list, unsigned long count);
typedef struct _xPoint *DDXPointPtr;
typedef struct pixman_box16 *BoxPtr;
typedef struct _xEvent *xEventPtr;
typedef struct _xRectangle *xRectanglePtr;
typedef struct _GrabRec *GrabPtr;
typedef unsigned long x_server_generation_t;
extern _X_EXPORT unsigned long globalSerialNumber;
extern _X_EXPORT x_server_generation_t serverGeneration;
#endif /* MISC_H */
@@ -0,0 +1,65 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef MISCSTRUCT_H
#define MISCSTRUCT_H 1
#include "misc.h"
#include <X11/Xprotostr.h>
#include <pixman.h>
typedef xPoint DDXPointRec;
typedef struct pixman_box16 BoxRec;
typedef union _DevUnion {
void *ptr;
long val;
unsigned long uval;
void *(*fptr) (void);
} DevUnion;
#endif /* MISCSTRUCT_H */
@@ -0,0 +1,62 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef MISTRUCT_H
#define MISTRUCT_H
#include "mi.h"
#include "regionstr.h"
/* information about dashes */
typedef struct _miDash {
xPoint pt;
int e1, e2; /* keep these, so we don't have to do it again */
int e; /* bresenham error term for this point on line */
int which;
int newLine; /* 0 if part of same original line as previous dash */
} miDashRec;
#endif /* MISTRUCT_H */
+77
View File
@@ -0,0 +1,77 @@
/*
* Copyright © 2010 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _MISYNC_H_
#define _MISYNC_H_
#include "screenint.h"
typedef struct _SyncObject SyncObject;
typedef struct _SyncFence SyncFence;
typedef struct _SyncTrigger SyncTrigger;
typedef void (*SyncScreenCreateFenceFunc) (ScreenPtr pScreen,
SyncFence * pFence,
Bool initially_triggered);
typedef void (*SyncScreenDestroyFenceFunc) (ScreenPtr pScreen,
SyncFence * pFence);
typedef struct _syncScreenFuncs {
SyncScreenCreateFenceFunc CreateFence;
SyncScreenDestroyFenceFunc DestroyFence;
} SyncScreenFuncsRec, *SyncScreenFuncsPtr;
extern _X_EXPORT void
miSyncScreenCreateFence(ScreenPtr pScreen, SyncFence * pFence,
Bool initially_triggered);
extern _X_EXPORT void
miSyncScreenDestroyFence(ScreenPtr pScreen, SyncFence * pFence);
typedef void (*SyncFenceSetTriggeredFunc) (SyncFence * pFence);
typedef void (*SyncFenceResetFunc) (SyncFence * pFence);
typedef Bool (*SyncFenceCheckTriggeredFunc) (SyncFence * pFence);
typedef void (*SyncFenceAddTriggerFunc) (SyncTrigger * pTrigger);
typedef void (*SyncFenceDeleteTriggerFunc) (SyncTrigger * pTrigger);
typedef struct _syncFenceFuncs {
SyncFenceSetTriggeredFunc SetTriggered;
SyncFenceResetFunc Reset;
SyncFenceCheckTriggeredFunc CheckTriggered;
SyncFenceAddTriggerFunc AddTrigger;
SyncFenceDeleteTriggerFunc DeleteTrigger;
} SyncFenceFuncsRec, *SyncFenceFuncsPtr;
extern _X_EXPORT void
miSyncInitFence(ScreenPtr pScreen, SyncFence * pFence,
Bool initially_triggered);
extern _X_EXPORT void
miSyncDestroyFence(SyncFence * pFence);
extern _X_EXPORT void
miSyncTriggerFence(SyncFence * pFence);
extern _X_EXPORT SyncScreenFuncsPtr miSyncGetScreenFuncs(ScreenPtr pScreen);
extern _X_EXPORT Bool
miSyncSetup(ScreenPtr pScreen);
#endif /* _MISYNC_H_ */
@@ -0,0 +1,48 @@
/*
* Copyright © 2013 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _MISYNCFD_H_
#define _MISYNCFD_H_
#include <X11/Xdefs.h>
#include <X11/Xfuncproto.h>
typedef int (*SyncScreenCreateFenceFromFdFunc) (ScreenPtr screen,
SyncFence *fence,
int fd,
Bool initially_triggered);
typedef int (*SyncScreenGetFenceFdFunc) (ScreenPtr screen,
SyncFence *fence);
#define SYNC_FD_SCREEN_FUNCS_VERSION 1
typedef struct _syncFdScreenFuncs {
int version;
SyncScreenCreateFenceFromFdFunc CreateFenceFromFd;
SyncScreenGetFenceFdFunc GetFenceFd;
} SyncFdScreenFuncsRec, *SyncFdScreenFuncsPtr;
extern _X_EXPORT Bool miSyncFdScreenInit(ScreenPtr pScreen,
const SyncFdScreenFuncsRec *funcs);
#endif /* _MISYNCFD_H_ */
@@ -0,0 +1,31 @@
/*
* Copyright © 2013 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _MISYNCSHM_H_
#define _MISYNCSHM_H_
#include <X11/Xdefs.h>
#include <X11/Xfuncproto.h>
extern _X_EXPORT Bool miSyncShmScreenInit(ScreenPtr pScreen);
#endif /* _MISYNCSHM_H_ */
@@ -0,0 +1,78 @@
/*
* Copyright © 2010 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _MISYNCSTR_H_
#define _MISYNCSTR_H_
#include <stdint.h>
#include "xlibre_ptrtypes.h"
#include "dix.h"
#include "misync.h"
#include "scrnintstr.h"
#include <X11/extensions/syncconst.h>
/* Sync object types */
#define SYNC_COUNTER 0
#define SYNC_FENCE 1
struct _SyncObject {
ClientPtr client; /* Owning client. 0 for system counters */
struct _SyncTriggerList *pTriglist; /* list of triggers */
XID id; /* resource ID */
unsigned char type; /* SYNC_* */
unsigned char initialized; /* FALSE if created but not initialized */
Bool beingDestroyed; /* in process of going away */
};
typedef struct _SyncCounter {
SyncObject sync; /* Common sync object data */
int64_t value; /* counter value */
struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
} SyncCounter;
struct _SyncFence {
SyncObject sync; /* Common sync object data */
ScreenPtr pScreen; /* Screen of this fence object */
SyncFenceFuncsRec funcs; /* Funcs for performing ops on fence */
Bool triggered; /* fence state */
PrivateRec *devPrivates; /* driver-specific per-fence data */
};
struct _SyncTrigger {
SyncObject *pSync;
int64_t wait_value; /* wait value */
unsigned int value_type; /* Absolute or Relative */
unsigned int test_type; /* transition or Comparison type */
int64_t test_value; /* trigger event threshold value */
Bool (*CheckTrigger)(struct _SyncTrigger *pTrigger,
int64_t newval);
void (*TriggerFired)(struct _SyncTrigger *pTrigger);
void (*CounterDestroyed)(struct _SyncTrigger *pTrigger);
};
typedef struct _SyncTriggerList {
SyncTrigger *pTrigger;
struct _SyncTriggerList *next;
} SyncTriggerList;
#endif /* _MISYNCSTR_H_ */
+132
View File
@@ -0,0 +1,132 @@
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
#ifndef XSERVER_MIZERARC_H
#define XSERVER_MIZERARC_H
#include <X11/Xdefs.h>
#include <X11/Xfuncproto.h>
typedef struct {
int x;
int y;
int mask;
} miZeroArcPtRec;
typedef struct {
int x, y, k1, k3, a, b, d, dx, dy;
int alpha, beta;
int xorg, yorg;
int xorgo, yorgo;
int w, h;
int initialMask;
miZeroArcPtRec start, altstart, end, altend;
int firstx, firsty;
int startAngle, endAngle;
} miZeroArcRec;
#define miCanZeroArc(arc) (((arc)->width == (arc)->height) || \
(((arc)->width <= 800) && ((arc)->height <= 800)))
#define MIARCSETUP() \
x = info.x; \
y = info.y; \
k1 = info.k1; \
k3 = info.k3; \
a = info.a; \
b = info.b; \
d = info.d; \
dx = info.dx; \
dy = info.dy
#define MIARCOCTANTSHIFT(clause) \
if (a < 0) \
{ \
if (y == info.h) \
{ \
d = -1; \
a = b = k1 = 0; \
} \
else \
{ \
dx = (k1 << 1) - k3; \
k1 = dx - k1; \
k3 = -k3; \
b = b + a - (k1 >> 1); \
d = b + ((-a) >> 1) - d + (k3 >> 3); \
if (dx < 0) \
a = -((-dx) >> 1) - a; \
else \
a = (dx >> 1) - a; \
dx = 0; \
dy = 1; \
clause \
} \
}
#define MIARCSTEP(move1,move2) \
b -= k1; \
if (d < 0) \
{ \
x += dx; \
y += dy; \
a += k1; \
d += b; \
move1 \
} \
else \
{ \
x++; \
y++; \
a += k3; \
d -= a; \
move2 \
}
#define MIARCCIRCLESTEP(clause) \
b -= k1; \
x++; \
if (d < 0) \
{ \
a += k1; \
d += b; \
} \
else \
{ \
y++; \
a += k3; \
d -= a; \
clause \
}
/* mizerarc.c */
extern _X_EXPORT Bool miZeroArcSetup(xArc * /*arc */ ,
miZeroArcRec * /*info */ ,
Bool /*ok360 */
);
#endif /* XSERVER_MIZERARC_H */
+38
View File
@@ -0,0 +1,38 @@
/*
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifndef OPAQUE_H
#define OPAQUE_H
#include <X11/Xmd.h>
#include "globals.h"
extern _X_EXPORT Bool bgNoneRoot;
#endif /* OPAQUE_H */
@@ -0,0 +1,12 @@
#ifndef OPTIONSTR_H_
#define OPTIONSTR_H_
struct _InputOption {
GenericListRec list;
char *opt_name;
char *opt_val;
int opt_used;
char *opt_comment;
};
#endif /* INPUTSTRUCT_H */
+313
View File
@@ -0,0 +1,313 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef OS_H
#define OS_H
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#ifdef MONOTONIC_CLOCK
#include <time.h>
#endif
#include <X11/Xfuncproto.h>
#include "xlibre_ptrtypes.h"
#include "callback.h"
#include "misc.h"
/*
* @brief macro for specifying non-null arguments
*
* part of public SDK / driver API
*/
#ifndef _X_ATTRIBUTE_NONNULL_ARG
#define _X_ATTRIBUTE_NONNULL_ARG(...) __attribute__((nonnull(__VA_ARGS__)))
#endif
#ifndef _X_ATTRIBUTE_VPRINTF
# if defined(__GNUC__) && (__GNUC__ >= 2) && !defined(__clang__)
# define _X_ATTRIBUTE_VPRINTF(fmt, firstarg) \
__attribute__((__format__(gnu_printf, fmt, firstarg)))
# else
# define _X_ATTRIBUTE_VPRINTF(fmt, firstarg) _X_ATTRIBUTE_PRINTF(fmt,firstarg)
# endif
#endif
#define SCREEN_SAVER_ON 0
#define SCREEN_SAVER_OFF 1
#define SCREEN_SAVER_FORCER 2
#define SCREEN_SAVER_CYCLE 3
#ifndef MAX_REQUEST_SIZE
#define MAX_REQUEST_SIZE 65535
#endif
typedef struct _NewClientRec *NewClientPtr;
#ifndef xnfalloc
#define xnfalloc(size) XNFalloc((unsigned long)(size))
#define xnfcalloc(_num, _size) XNFcallocarray((_num), (_size))
#define xnfrealloc(ptr, size) XNFrealloc((void *)(ptr), (unsigned long)(size))
#define xstrdup(s) Xstrdup((s))
#define xnfstrdup(s) XNFstrdup((s))
#endif
#include <stdio.h>
#include <stdarg.h>
extern _X_EXPORT int ReadFdFromClient(ClientPtr client);
/**
* @brief write @p count bytes from @p buf into the client's output buffer
*
* @deprecated Legacy entry point, kept for ABI compatibility. Drivers and
* external modules should not write to clients directly; this
* remains exported only for existing out-of-tree users. In-tree
* code uses the internal dixWriteToClient() worker instead.
*
* @param who the client to write to
* @param count number of bytes to write
* @param buf data to write
* @return number of bytes buffered, 0 on no-op, -1 on error
*/
extern _X_EXPORT int WriteToClient(ClientPtr /*who */ , int /*count */ ,
const void * /*buf */ );
typedef void (*NotifyFdProcPtr)(int fd, int ready, void *data);
#include "fd_notify.h"
extern _X_EXPORT Bool SetNotifyFd(int fd, NotifyFdProcPtr notify_fd, int mask, void *data);
static inline void RemoveNotifyFd(int fd)
{
(void) SetNotifyFd(fd, NULL, X_NOTIFY_NONE, NULL);
}
extern _X_EXPORT void IgnoreClient(ClientPtr /*client */ );
extern _X_EXPORT void AttendClient(ClientPtr /*client */ );
extern _X_EXPORT CARD32 GetTimeInMillis(void);
extern _X_EXPORT CARD64 GetTimeInMicros(void);
extern _X_EXPORT void AdjustWaitForDelay(void *waitTime, int newdelay);
typedef struct _OsTimerRec *OsTimerPtr;
typedef CARD32 (*OsTimerCallback) (OsTimerPtr timer,
CARD32 time,
void *arg);
#define TimerAbsolute (1<<0)
#define TimerForceOld (1<<1)
extern _X_EXPORT OsTimerPtr TimerSet(OsTimerPtr timer,
int flags,
CARD32 millis,
OsTimerCallback func,
void *arg);
extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */ );
extern _X_EXPORT void TimerFree(OsTimerPtr /* pTimer */ );
extern _X_EXPORT void GiveUp(int /*sig */ );
/*
* This function malloc(3)s buffer, terminating the server if there is not
* enough memory.
*/
extern _X_EXPORT void *
XNFalloc(unsigned long /*amount */ ) __attribute__((returns_nonnull));
/*
* This function calloc(3)s buffer, terminating the server if there is not
* enough memory.
*/
extern _X_EXPORT void *
XNFcalloc(unsigned long /*amount */ ) _X_DEPRECATED;
/*
* This function calloc(3)s buffer, terminating the server if there is not
* enough memory or the arguments overflow when multiplied
*/
extern _X_EXPORT void *
XNFcallocarray(size_t nmemb, size_t size) __attribute__((returns_nonnull));
/*
* This function realloc(3)s passed buffer, terminating the server if there is
* not enough memory.
*/
extern _X_EXPORT void *
XNFrealloc(void * /*ptr */ , unsigned long /*amount */ );
/*
* This function strdup(3)s passed string. The only difference from the library
* function that it is safe to pass NULL, as NULL will be returned.
*/
extern _X_EXPORT char *
Xstrdup(const char *s);
/*
* This function strdup(3)s passed string, terminating the server if there is
* not enough memory. If NULL is passed to this function, NULL is returned.
*/
extern _X_EXPORT char *
XNFstrdup(const char *s);
/* Include new X*asprintf API */
#include "Xprintf.h"
typedef int (*OsSigWrapperPtr) (int /* sig */ );
extern _X_EXPORT OsSigWrapperPtr
OsRegisterSigWrapper(OsSigWrapperPtr newWrap);
extern _X_EXPORT Bool
PrivsElevated(void);
extern _X_EXPORT int
GetClientFd(ClientPtr);
/* stuff for FlushCallback */
extern _X_EXPORT CallbackListPtr FlushCallback;
extern _X_EXPORT int
TimeSinceLastInputEvent(void);
/* Function fallbacks provided by AC_REPLACE_FUNCS in configure.ac */
#ifndef HAVE_REALLOCARRAY
#define reallocarray xreallocarray
extern _X_EXPORT void *
reallocarray(void *optr, size_t nmemb, size_t size);
#endif
#ifndef HAVE_STRLCPY
extern _X_EXPORT size_t
strlcpy(char * _X_RESTRICT_KYWD dst, const char * _X_RESTRICT_KYWD src, size_t siz);
extern _X_EXPORT size_t
strlcat(char * _X_RESTRICT_KYWD dst, const char * _X_RESTRICT_KYWD src, size_t siz);
#endif
#ifndef HAVE_STRNDUP
extern _X_EXPORT char *
strndup(const char *str, size_t n);
#endif
#ifndef HAVE_TIMINGSAFE_MEMCMP
extern _X_EXPORT int
timingsafe_memcmp(const void *b1, const void *b2, size_t len);
#endif
/* Flags for log messages. */
typedef enum {
X_PROBED, /* Value was probed */
X_CONFIG, /* Value was given in the config file */
X_DEFAULT, /* Value is a default */
X_CMDLINE, /* Value was given on the command line */
X_NOTICE, /* Notice */
X_ERROR, /* Error message */
X_WARNING, /* Warning message */
X_INFO, /* Informational message */
X_NONE, /* No prefix */
X_NOT_IMPLEMENTED, /* Not implemented */
X_DEBUG, /* Debug message */
X_UNKNOWN = -1 /* unknown -- this must always be last */
} MessageType;
extern _X_EXPORT void
LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
_X_ATTRIBUTE_PRINTF(3, 0);
extern _X_EXPORT void
LogMessageVerb(MessageType type, int verb, const char *format, ...)
_X_ATTRIBUTE_PRINTF(3, 4);
extern _X_EXPORT void
LogMessage(MessageType type, const char *format, ...)
_X_ATTRIBUTE_PRINTF(2, 3);
extern _X_EXPORT void
LogHdrMessageVerb(MessageType type, int verb,
const char *msg_format, va_list msg_args,
const char *hdr_format, ...)
_X_ATTRIBUTE_PRINTF(3, 0)
_X_ATTRIBUTE_PRINTF(5, 6);
extern _X_EXPORT void
FatalError(const char *f, ...)
_X_ATTRIBUTE_PRINTF(1, 2)
_X_NORETURN;
extern _X_EXPORT void
ErrorF(const char *f, ...)
_X_ATTRIBUTE_PRINTF(1, 2);
extern _X_EXPORT void
xorg_backtrace(void);
/* should not be used anymore, just for backwards compat with drivers */
#define LogVMessageVerbSigSafe(...) LogVMessageVerb(__VA_ARGS__)
#define LogMessageVerbSigSafe(...) LogMessageVerb(__VA_ARGS__)
#define ErrorFSigSafe(...) ErrorF(__VA_ARGS__)
#define VErrorFSigSafe(...) VErrorF(__VA_ARGS__)
#define VErrorF(...) LogVMessageVerb(X_NONE, -1, __VA_ARGS__)
/* only for backwards compat with drivers that haven't kept up yet
(xf86-video-intel)
@todo revise after next stable release
*/
_X_DEPRECATED
static inline int System(const char* cmdline)
{
return system(cmdline);
}
#endif /* OS_H */
+215
View File
@@ -0,0 +1,215 @@
/*
*
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Keith Packard, SuSE, Inc.
*/
#ifndef _PICTURE_H_
#define _PICTURE_H_
#include "privates.h"
#include <pixman.h>
typedef struct _DirectFormat *DirectFormatPtr;
typedef struct _PictFormat *PictFormatPtr;
typedef struct _Picture *PicturePtr;
/*
* While the protocol is generous in format support, the
* sample implementation allows only packed RGB and GBR
* representations for data to simplify software rendering,
*/
#define PICT_FORMAT(bpp,type,a,r,g,b) PIXMAN_FORMAT((bpp), (type), (a), (r), (g), (b))
/*
* gray/color formats use a visual index instead of argb
*/
#define PICT_VISFORMAT(bpp,type,vi) (((bpp) << 24) | \
((type) << 16) | \
((vi)))
#define PICT_FORMAT_BPP(f) PIXMAN_FORMAT_BPP((f))
#define PICT_FORMAT_TYPE(f) PIXMAN_FORMAT_TYPE((f))
#define PICT_FORMAT_A(f) PIXMAN_FORMAT_A((f))
#define PICT_FORMAT_R(f) PIXMAN_FORMAT_R((f))
#define PICT_FORMAT_G(f) PIXMAN_FORMAT_G((f))
#define PICT_FORMAT_B(f) PIXMAN_FORMAT_B((f))
#define PICT_FORMAT_RGB(f) PIXMAN_FORMAT_RGB((f))
#define PICT_FORMAT_VIS(f) PIXMAN_FORMAT_VIS((f))
#define PICT_TYPE_OTHER PIXMAN_TYPE_OTHER
#define PICT_TYPE_A PIXMAN_TYPE_A
#define PICT_TYPE_ARGB PIXMAN_TYPE_ARGB
#define PICT_TYPE_ABGR PIXMAN_TYPE_ABGR
#define PICT_TYPE_COLOR PIXMAN_TYPE_COLOR
#define PICT_TYPE_GRAY PIXMAN_TYPE_GRAY
#define PICT_TYPE_BGRA PIXMAN_TYPE_BGRA
#define PICT_FORMAT_COLOR(f) PIXMAN_FORMAT_COLOR((f))
typedef pixman_format_code_t PictFormatShort;
#define PICT_a2r10g10b10 PIXMAN_a2r10g10b10
#define PICT_x2r10g10b10 PIXMAN_x2r10g10b10
#define PICT_a2b10g10r10 PIXMAN_a2b10g10r10
#define PICT_x2b10g10r10 PIXMAN_x2b10g10r10
#define PICT_a8r8g8b8 PIXMAN_a8r8g8b8
#define PICT_x8r8g8b8 PIXMAN_x8r8g8b8
#define PICT_a8b8g8r8 PIXMAN_a8b8g8r8
#define PICT_x8b8g8r8 PIXMAN_x8b8g8r8
#define PICT_b8g8r8a8 PIXMAN_b8g8r8a8
#define PICT_b8g8r8x8 PIXMAN_b8g8r8x8
#define PICT_r8g8b8 PIXMAN_r8g8b8
#define PICT_b8g8r8 PIXMAN_b8g8r8
#define PICT_r5g6b5 PIXMAN_r5g6b5
#define PICT_b5g6r5 PIXMAN_b5g6r5
#define PICT_a1r5g5b5 PIXMAN_a1r5g5b5
#define PICT_x1r5g5b5 PIXMAN_x1r5g5b5
#define PICT_a1b5g5r5 PIXMAN_a1b5g5r5
#define PICT_x1b5g5r5 PIXMAN_x1b5g5r5
#define PICT_a4r4g4b4 PIXMAN_a4r4g4b4
#define PICT_x4r4g4b4 PIXMAN_x4r4g4b4
#define PICT_a4b4g4r4 PIXMAN_a4b4g4r4
#define PICT_x4b4g4r4 PIXMAN_x4b4g4r4
#define PICT_a8 PIXMAN_a8
#define PICT_r3g3b2 PIXMAN_r3g3b2
#define PICT_b2g3r3 PIXMAN_b2g3r3
#define PICT_a2r2g2b2 PIXMAN_a2r2g2b2
#define PICT_a2b2g2r2 PIXMAN_a2b2g2r2
#define PICT_c8 PIXMAN_c8
#define PICT_g8 PIXMAN_g8
#define PICT_x4a4 PIXMAN_x4a4
#define PICT_x4c4 PIXMAN_x4c4
#define PICT_x4g4 PIXMAN_x4g4
#define PICT_a4 PIXMAN_a4
#define PICT_r1g2b1 PIXMAN_r1g2b1
#define PICT_b1g2r1 PIXMAN_b1g2r1
#define PICT_a1r1g1b1 PIXMAN_a1r1g1b1
#define PICT_a1b1g1r1 PIXMAN_a1b1g1r1
#define PICT_c4 PIXMAN_c4
#define PICT_g4 PIXMAN_g4
#define PICT_a1 PIXMAN_a1
#define PICT_g1 PIXMAN_g1
#define PICT_yuv2 PIXMAN_yuy2
/*
* For dynamic indexed visuals (GrayScale and PseudoColor), these control the
* selection of colors allocated for drawing to Pictures. The default
* policy depends on the size of the colormap:
*
* Size Default Policy
* ----------------------------
* < 64 PolicyMono
* < 256 PolicyGray
* 256 PolicyColor (only on PseudoColor)
*
* The actual allocation code lives in miindex.c, and so is
* ostensibly server dependent, but that code does:
*
* PolicyMono Allocate no additional colors, use black and white
* PolicyGray Allocate 13 gray levels (11 cells used)
* PolicyColor Allocate a 4x4x4 cube and 13 gray levels (71 cells used)
* PolicyAll Allocate as big a cube as possible, fill with gray (all)
*
* Here's a picture to help understand how many colors are
* actually allocated (this is just the gray ramp):
*
* gray level
* all 0000 1555 2aaa 4000 5555 6aaa 8000 9555 aaaa bfff d555 eaaa ffff
* b/w 0000 ffff
* 4x4x4 5555 aaaa
* extra 1555 2aaa 4000 6aaa 8000 9555 bfff d555 eaaa
*
* The default colormap supplies two gray levels (black/white), the
* 4x4x4 cube allocates another two and nine more are allocated to fill
* in the 13 levels. When the 4x4x4 cube is not allocated, a total of
* 11 cells are allocated.
*/
#define PictureCmapPolicyInvalid -1
#define PictureCmapPolicyDefault 0
#define PictureCmapPolicyMono 1
#define PictureCmapPolicyGray 2
#define PictureCmapPolicyColor 3
#define PictureCmapPolicyAll 4
extern int PictureCmapPolicy;
extern int PictureParseCmapPolicy(const char *name);
extern int RenderErrBase;
/* Fixed point updates from Carl Worth, USC, Information Sciences Institute */
typedef pixman_fixed_32_32_t xFixed_32_32;
typedef pixman_fixed_48_16_t xFixed_48_16;
#define MAX_FIXED_48_16 pixman_max_fixed_48_16
#define MIN_FIXED_48_16 pixman_min_fixed_48_16
typedef pixman_fixed_1_31_t xFixed_1_31;
typedef pixman_fixed_1_16_t xFixed_1_16;
typedef pixman_fixed_16_16_t xFixed_16_16;
/*
* An unadorned "xFixed" is the same as xFixed_16_16,
* (since it's quite common in the code)
*/
typedef pixman_fixed_t xFixed;
#define XFIXED_BITS 16
#define xFixedToInt(f) pixman_fixed_to_int((f))
#define IntToxFixed(i) pixman_int_to_fixed((i))
#define xFixedE pixman_fixed_e
#define xFixed1 pixman_fixed_1
#define xFixed1MinusE pixman_fixed_1_minus_e
#define xFixedFrac(f) pixman_fixed_frac((f))
#define xFixedFloor(f) pixman_fixed_floor((f))
#define xFixedCeil(f) pixman_fixed_ceil((f))
#define xFixedFraction(f) pixman_fixed_fraction((f))
#define xFixedMod2(f) pixman_fixed_mod2((f))
/* whether 't' is a well defined not obviously empty trapezoid */
#define xTrapezoidValid(t) ((t)->left.p1.y != (t)->left.p2.y && \
(t)->right.p1.y != (t)->right.p2.y && \
((t)->bottom > (t)->top))
/*
* Standard NTSC luminance conversions:
*
* y = r * 0.299 + g * 0.587 + b * 0.114
*
* Approximate this for a bit more speed:
*
* y = (r * 153 + g * 301 + b * 58) / 512
*
* This gives 17 bits of luminance; to get 15 bits, lop the low two
*/
#define CvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \
(((s) >> 8) & 0xff) * 301 + \
(((s) ) & 0xff) * 58) >> 2)
#endif /* _PICTURE_H_ */
@@ -0,0 +1,534 @@
/*
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Keith Packard, SuSE, Inc.
*/
#ifndef _PICTURESTR_H_
#define _PICTURESTR_H_
#include <X11/extensions/renderproto.h>
#include "scrnintstr.h"
#include "glyphstr.h"
#include "resource.h"
#include "privates.h"
typedef struct _DirectFormat {
CARD16 red, redMask;
CARD16 green, greenMask;
CARD16 blue, blueMask;
CARD16 alpha, alphaMask;
} DirectFormatRec;
typedef struct _IndexFormat {
VisualID vid;
ColormapPtr pColormap;
int nvalues;
xIndexValue *pValues;
void *devPrivate;
} IndexFormatRec;
typedef struct _PictFormat {
CARD32 id;
CARD32 format; /* except bpp */
unsigned char type;
unsigned char depth;
DirectFormatRec direct;
IndexFormatRec index;
} PictFormatRec;
typedef struct pixman_vector PictVector, *PictVectorPtr;
typedef struct pixman_transform PictTransform, *PictTransformPtr;
#define SourcePictTypeSolidFill 0
#define SourcePictTypeLinear 1
#define SourcePictTypeRadial 2
#define SourcePictTypeConical 3
typedef struct _PictSolidFill {
unsigned int type;
CARD32 color;
xRenderColor fullcolor;
} PictSolidFill, *PictSolidFillPtr;
typedef struct _PictGradientStop {
xFixed x;
xRenderColor color;
} PictGradientStop, *PictGradientStopPtr;
typedef struct _PictGradient {
unsigned int type;
int nstops;
PictGradientStopPtr stops;
} PictGradient, *PictGradientPtr;
typedef struct _PictLinearGradient {
unsigned int type;
int nstops;
PictGradientStopPtr stops;
xPointFixed p1;
xPointFixed p2;
} PictLinearGradient, *PictLinearGradientPtr;
typedef struct _PictCircle {
xFixed x;
xFixed y;
xFixed radius;
} PictCircle, *PictCirclePtr;
typedef struct _PictRadialGradient {
unsigned int type;
int nstops;
PictGradientStopPtr stops;
PictCircle c1;
PictCircle c2;
} PictRadialGradient, *PictRadialGradientPtr;
typedef struct _PictConicalGradient {
unsigned int type;
int nstops;
PictGradientStopPtr stops;
xPointFixed center;
xFixed angle;
} PictConicalGradient, *PictConicalGradientPtr;
typedef union _SourcePict {
unsigned int type;
PictSolidFill solidFill;
PictGradient gradient;
PictLinearGradient linear;
PictRadialGradient radial;
PictConicalGradient conical;
} SourcePict, *SourcePictPtr;
typedef struct _Picture {
DrawablePtr pDrawable;
PictFormatPtr pFormat;
pixman_format_code_t format; /* PIXMAN_FORMAT */
int refcnt;
CARD32 id;
unsigned int repeat:1;
unsigned int graphicsExposures:1;
unsigned int subWindowMode:1;
unsigned int polyEdge:1;
unsigned int polyMode:1;
unsigned int freeCompClip:1;
unsigned int componentAlpha:1;
unsigned int repeatType:2;
unsigned int filter:3;
unsigned int stateChanges:CPLastBit;
unsigned int unused:18 - CPLastBit;
PicturePtr pNext; /* chain on same drawable */
PicturePtr alphaMap;
xPoint alphaOrigin;
xPoint clipOrigin;
RegionPtr clientClip;
unsigned long serialNumber;
RegionPtr pCompositeClip;
PrivateRec *devPrivates;
PictTransform *transform;
SourcePictPtr pSourcePict;
xFixed *filter_params;
int filter_nparams;
} PictureRec;
typedef Bool (*PictFilterValidateParamsProcPtr) (ScreenPtr pScreen, int id,
xFixed * params, int nparams,
int *width, int *height);
typedef struct {
char *name;
int id;
PictFilterValidateParamsProcPtr ValidateParams;
int width, height;
} PictFilterRec, *PictFilterPtr;
#define PictFilterNearest 0
#define PictFilterBilinear 1
#define PictFilterFast 2
#define PictFilterGood 3
#define PictFilterBest 4
#define PictFilterConvolution 5
/* if you add an 8th filter, expand the filter bitfield above */
typedef struct {
char *alias;
int alias_id;
int filter_id;
} PictFilterAliasRec, *PictFilterAliasPtr;
typedef int (*CreatePictureProcPtr) (PicturePtr pPicture);
typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture);
typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture,
int clipType, void *value, int n);
typedef void (*DestroyPictureClipProcPtr) (PicturePtr pPicture);
typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture,
PictTransform * transform);
typedef int (*ChangePictureFilterProcPtr) (PicturePtr pPicture,
int filter,
xFixed * params, int nparams);
typedef void (*DestroyPictureFilterProcPtr) (PicturePtr pPicture);
typedef void (*ChangePictureProcPtr) (PicturePtr pPicture, Mask mask);
typedef void (*ValidatePictureProcPtr) (PicturePtr pPicture, Mask mask);
typedef void (*CompositeProcPtr) (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst, CARD16 width, CARD16 height);
typedef void (*GlyphsProcPtr) (CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc,
INT16 ySrc,
int nlists,
GlyphListPtr lists, GlyphPtr * glyphs);
typedef void (*CompositeRectsProcPtr) (CARD8 op,
PicturePtr pDst,
xRenderColor * color,
int nRect, xRectangle *rects);
typedef void (*RasterizeTrapezoidProcPtr) (PicturePtr pMask,
xTrapezoid * trap,
int x_off, int y_off);
typedef void (*TrapezoidsProcPtr) (CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc,
INT16 ySrc, int ntrap, xTrapezoid * traps);
typedef void (*TrianglesProcPtr) (CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc,
INT16 ySrc, int ntri, xTriangle * tris);
typedef void (*TriStripProcPtr) (CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc,
INT16 ySrc, int npoint, xPointFixed * points);
typedef void (*TriFanProcPtr) (CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc,
INT16 ySrc, int npoint, xPointFixed * points);
typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat);
typedef void (*CloseIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat);
typedef void (*UpdateIndexedProcPtr) (ScreenPtr pScreen,
PictFormatPtr pFormat,
int ndef, xColorItem * pdef);
typedef void (*AddTrapsProcPtr) (PicturePtr pPicture,
INT16 xOff,
INT16 yOff, int ntrap, xTrap * traps);
typedef void (*AddTrianglesProcPtr) (PicturePtr pPicture,
INT16 xOff,
INT16 yOff, int ntri, xTriangle * tris);
typedef Bool (*RealizeGlyphProcPtr) (ScreenPtr pScreen, GlyphPtr glyph);
typedef void (*UnrealizeGlyphProcPtr) (ScreenPtr pScreen, GlyphPtr glyph);
typedef struct _PictureScreen {
PictFormatPtr formats;
PictFormatPtr fallback;
int nformats;
CreatePictureProcPtr CreatePicture;
DestroyPictureProcPtr DestroyPicture;
ChangePictureClipProcPtr ChangePictureClip;
DestroyPictureClipProcPtr DestroyPictureClip;
ChangePictureProcPtr ChangePicture;
ValidatePictureProcPtr ValidatePicture;
CompositeProcPtr Composite;
GlyphsProcPtr Glyphs; /* unused */
CompositeRectsProcPtr CompositeRects;
void *_dummy1; // required in place of a removed field for ABI compatibility
void *_dummy2; // required in place of a removed field for ABI compatibility
StoreColorsProcPtr StoreColors;
InitIndexedProcPtr InitIndexed;
CloseIndexedProcPtr CloseIndexed;
UpdateIndexedProcPtr UpdateIndexed;
int subpixel;
PictFilterPtr filters;
int nfilters;
PictFilterAliasPtr filterAliases;
int nfilterAliases;
/**
* Called immediately after a picture's transform is changed through the
* SetPictureTransform request. Not called for source-only pictures.
*/
ChangePictureTransformProcPtr ChangePictureTransform;
/**
* Called immediately after a picture's transform is changed through the
* SetPictureFilter request. Not called for source-only pictures.
*/
ChangePictureFilterProcPtr ChangePictureFilter;
DestroyPictureFilterProcPtr DestroyPictureFilter;
TrapezoidsProcPtr Trapezoids;
TrianglesProcPtr Triangles;
RasterizeTrapezoidProcPtr RasterizeTrapezoid;
AddTrianglesProcPtr AddTriangles;
AddTrapsProcPtr AddTraps;
RealizeGlyphProcPtr RealizeGlyph;
UnrealizeGlyphProcPtr UnrealizeGlyph;
#define PICTURE_SCREEN_VERSION 2
TriStripProcPtr TriStrip;
TriFanProcPtr TriFan;
} PictureScreenRec, *PictureScreenPtr;
extern _X_EXPORT DevPrivateKeyRec PictureScreenPrivateKeyRec;
extern _X_EXPORT DevPrivateKeyRec PictureWindowPrivateKeyRec;
#define GetPictureScreen(s) ((PictureScreenPtr)dixLookupPrivate(&(s)->devPrivates, &PictureScreenPrivateKeyRec))
#define GetPictureScreenIfSet(s) (dixPrivateKeyRegistered(&PictureScreenPrivateKeyRec) ? GetPictureScreen((s)) : NULL)
#define SetPictureScreen(s,p) dixSetPrivate(&(s)->devPrivates, &PictureScreenPrivateKeyRec, (p))
#define GetPictureWindow(w) ((PicturePtr)dixLookupPrivate(&(w)->devPrivates, &PictureWindowPrivateKeyRec))
#define SetPictureWindow(w,p) dixSetPrivate(&(w)->devPrivates, &PictureWindowPrivateKeyRec, (p))
extern _X_EXPORT PictFormatPtr
PictureWindowFormat(WindowPtr pWindow);
extern _X_EXPORT Bool
PictureSetSubpixelOrder(ScreenPtr pScreen, int subpixel);
extern _X_EXPORT int
PictureGetSubpixelOrder(ScreenPtr pScreen);
extern _X_EXPORT PictFormatPtr
PictureMatchVisual(ScreenPtr pScreen, int depth, VisualPtr pVisual);
extern _X_EXPORT PictFormatPtr
PictureMatchFormat(ScreenPtr pScreen, int depth, CARD32 format);
extern _X_EXPORT Bool
PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
extern _X_EXPORT int
PictureGetFilterId(const char *filter, int len, Bool makeit);
extern _X_EXPORT char *PictureGetFilterName(int id);
extern _X_EXPORT int
PictureAddFilter(ScreenPtr pScreen,
const char *filter,
PictFilterValidateParamsProcPtr ValidateParams,
int width, int height);
extern _X_EXPORT Bool
PictureSetFilterAlias(ScreenPtr pScreen, const char *filter, const char *alias);
extern _X_EXPORT Bool
PictureSetDefaultFilters(ScreenPtr pScreen);
extern _X_EXPORT void
PictureResetFilters(ScreenPtr pScreen);
extern _X_EXPORT PictFilterPtr
PictureFindFilter(ScreenPtr pScreen, char *name, int len);
extern _X_EXPORT int
SetPicturePictFilter(PicturePtr pPicture, PictFilterPtr pFilter,
xFixed * params, int nparams);
extern _X_EXPORT int
SetPictureFilter(PicturePtr pPicture, char *name, int len,
xFixed * params, int nparams);
extern _X_EXPORT Bool
PictureFinishInit(void);
extern _X_EXPORT PicturePtr
CreatePicture(Picture pid,
DrawablePtr pDrawable,
PictFormatPtr pFormat,
Mask mask, XID *list, ClientPtr client, int *error);
extern _X_EXPORT int
ChangePicture(PicturePtr pPicture,
Mask vmask, XID *vlist, DevUnion *ulist, ClientPtr client);
extern _X_EXPORT int
SetPictureClipRects(PicturePtr pPicture,
int xOrigin, int yOrigin, int nRect, xRectangle *rects);
extern _X_EXPORT int
SetPictureClipRegion(PicturePtr pPicture,
int xOrigin, int yOrigin, RegionPtr pRegion);
extern _X_EXPORT int
SetPictureTransform(PicturePtr pPicture, PictTransform * transform);
extern _X_EXPORT void
ValidatePicture(PicturePtr pPicture);
extern _X_EXPORT int
FreePicture(void *pPicture, XID pid);
extern _X_EXPORT void
CompositePicture(CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
extern _X_EXPORT void
CompositeGlyphs(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc,
INT16 ySrc, int nlist, GlyphListPtr lists, GlyphPtr * glyphs);
extern _X_EXPORT void
CompositeRects(CARD8 op,
PicturePtr pDst,
xRenderColor * color, int nRect, xRectangle *rects);
extern _X_EXPORT void
CompositeTrapezoids(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps);
extern _X_EXPORT void
CompositeTriangles(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc,
INT16 ySrc, int ntriangles, xTriangle * triangles);
extern _X_EXPORT void
CompositeTriStrip(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
extern _X_EXPORT void
CompositeTriFan(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
extern _X_EXPORT void
AddTraps(PicturePtr pPicture,
INT16 xOff, INT16 yOff, int ntraps, xTrap * traps);
extern _X_EXPORT PicturePtr
CreateSolidPicture(Picture pid, xRenderColor * color, int *error);
extern _X_EXPORT PicturePtr
CreateLinearGradientPicture(Picture pid,
xPointFixed * p1,
xPointFixed * p2,
int nStops,
xFixed * stops, xRenderColor * colors, int *error);
extern _X_EXPORT PicturePtr
CreateRadialGradientPicture(Picture pid,
xPointFixed * inner,
xPointFixed * outer,
xFixed innerRadius,
xFixed outerRadius,
int nStops,
xFixed * stops, xRenderColor * colors, int *error);
extern _X_EXPORT PicturePtr
CreateConicalGradientPicture(Picture pid,
xPointFixed * center,
xFixed angle,
int nStops,
xFixed * stops, xRenderColor * colors, int *error);
/*
* matrix.c
*/
extern _X_EXPORT void
PictTransform_from_xRenderTransform(PictTransformPtr pict,
xRenderTransform * render);
extern _X_EXPORT void
xRenderTransform_from_PictTransform(xRenderTransform * render,
PictTransformPtr pict);
extern _X_EXPORT Bool
PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector);
extern _X_EXPORT Bool
PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector);
#endif /* _PICTURESTR_H_ */
+140
View File
@@ -0,0 +1,140 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef PIXMAP_H
#define PIXMAP_H
#include "misc.h"
#include "screenint.h"
#include "regionstr.h"
#include <X11/extensions/randr.h>
/* types for Drawable */
#define DRAWABLE_WINDOW 0
#define DRAWABLE_PIXMAP 1
#define UNDRAWABLE_WINDOW 2
/* corresponding type masks for dixLookupDrawable() */
#define M_DRAWABLE_WINDOW (1<<0)
#define M_DRAWABLE_PIXMAP (1<<1)
#define M_UNDRAWABLE_WINDOW (1<<2)
#define M_ANY (-1)
#define M_WINDOW (M_DRAWABLE_WINDOW|M_UNDRAWABLE_WINDOW)
#define M_DRAWABLE (M_DRAWABLE_WINDOW|M_DRAWABLE_PIXMAP)
#define M_UNDRAWABLE (M_UNDRAWABLE_WINDOW)
/* flags to PaintWindow() */
#define PW_BACKGROUND 0
#define PW_BORDER 1
#define NullPixmap ((PixmapPtr)0)
typedef struct _Drawable *DrawablePtr;
typedef struct _Pixmap *PixmapPtr;
typedef struct _PixmapDirtyUpdate *PixmapDirtyUpdatePtr;
typedef union _PixUnion {
PixmapPtr pixmap;
unsigned long pixel;
} PixUnion;
#define SamePixUnion(a,b,isPixel)\
((isPixel) ? (a).pixel == (b).pixel : (a).pixmap == (b).pixmap)
#define EqualPixUnion(as, a, bs, b) \
((as) == (bs) && (SamePixUnion ((a), (b), (as))))
#define OnScreenDrawable(type) \
((type) == DRAWABLE_WINDOW)
#define WindowDrawable(type) \
(((type) == DRAWABLE_WINDOW) || ((type) == UNDRAWABLE_WINDOW))
extern _X_EXPORT PixmapPtr GetScratchPixmapHeader(ScreenPtr pScreen,
int width,
int height,
int depth,
int bitsPerPixel,
int devKind,
void *pPixData);
extern _X_EXPORT void FreeScratchPixmapHeader(PixmapPtr /*pPixmap */ );
extern _X_EXPORT Bool PixmapScreenInit(ScreenPtr /*pScreen */ );
extern _X_EXPORT PixmapPtr AllocatePixmap(ScreenPtr /*pScreen */ ,
int /*pixDataSize */ );
extern _X_EXPORT void FreePixmap(PixmapPtr /*pPixmap */ );
extern _X_EXPORT PixmapPtr
PixmapShareToSecondary(PixmapPtr pixmap, ScreenPtr secondary);
extern _X_EXPORT void
PixmapUnshareSecondaryPixmap(PixmapPtr secondary_pixmap);
#define HAS_DIRTYTRACKING_ROTATION 1
#define HAS_DIRTYTRACKING_DRAWABLE_SRC 1
extern _X_EXPORT Bool
PixmapStartDirtyTracking(DrawablePtr src,
PixmapPtr slave_dst,
int x, int y, int dst_x, int dst_y,
Rotation rotation);
extern _X_EXPORT Bool
PixmapStopDirtyTracking(DrawablePtr src, PixmapPtr slave_dst);
/* helper function, drivers can do this themselves if they can do it more
efficiently */
extern _X_EXPORT Bool
PixmapSyncDirtyHelper(PixmapDirtyUpdatePtr dirty);
extern _X_EXPORT void
PixmapDirtyCopyArea(PixmapPtr dst, DrawablePtr src,
int x, int y, int dst_x, int dst_y,
RegionPtr dirty_region);
#endif /* PIXMAP_H */
@@ -0,0 +1,110 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef PIXMAPSTRUCT_H
#define PIXMAPSTRUCT_H
#include "pixmap.h"
#include "screenint.h"
#include "regionstr.h"
#include "privates.h"
#include "damage.h"
#include <X11/extensions/randr.h>
#include "picturestr.h"
typedef struct _Drawable {
unsigned char type; /* DRAWABLE_<type> */
unsigned char class; /* specific to type */
unsigned char depth;
unsigned char bitsPerPixel;
XID id; /* resource id */
short x; /* window: screen absolute, pixmap: 0 */
short y; /* window: screen absolute, pixmap: 0 */
unsigned short width;
unsigned short height;
ScreenPtr pScreen;
unsigned long serialNumber;
} DrawableRec;
/*
* PIXMAP -- device dependent
*/
typedef struct _Pixmap {
DrawableRec drawable;
PrivateRec *devPrivates;
int refcnt;
int devKind; /* This is the pitch of the pixmap, typically width*bpp/8. */
DevUnion devPrivate; /* When !NULL, devPrivate.ptr points to the raw pixel data. */
short screen_x;
short screen_y;
unsigned usage_hint; /* see CREATE_PIXMAP_USAGE_* */
PixmapPtr primary_pixmap; /* pointer to primary copy of pixmap for pixmap sharing */
} PixmapRec;
typedef struct _PixmapDirtyUpdate {
DrawablePtr src; /* Root window / shared pixmap */
PixmapPtr secondary_dst; /* Shared / scanout pixmap */
int x, y;
DamagePtr damage;
struct xorg_list ent;
int dst_x, dst_y;
Rotation rotation;
PictTransform transform;
struct pixman_f_transform f_transform, f_inverse;
} PixmapDirtyUpdateRec;
static inline void
PixmapRegionInit(RegionPtr region, PixmapPtr pixmap)
{
BoxRec box = {
.x2 = (int16_t)pixmap->drawable.width,
.y2 = (int16_t)pixmap->drawable.height,
};
RegionInit(region, &box, 1);
}
#endif /* PIXMAPSTRUCT_H */
+162
View File
@@ -0,0 +1,162 @@
/*
* Copyright © 2013 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _PRESENT_H_
#define _PRESENT_H_
#include <X11/Xfuncproto.h>
#include <X11/Xmd.h>
#include <X11/extensions/presentproto.h>
#include "randrstr.h"
typedef enum {
PRESENT_FLIP_REASON_UNKNOWN,
PRESENT_FLIP_REASON_BUFFER_FORMAT,
/* Don't add new flip reasons after the TearFree ones, since it's expected
* that the TearFree reasons are the highest ones in order to allow doing
* `reason >= PRESENT_FLIP_REASON_DRIVER_TEARFREE` to check if a reason is
* PRESENT_FLIP_REASON_DRIVER_TEARFREE{_FLIPPING}.
*/
PRESENT_FLIP_REASON_DRIVER_TEARFREE,
PRESENT_FLIP_REASON_DRIVER_TEARFREE_FLIPPING
} PresentFlipReason;
typedef struct present_vblank present_vblank_rec, *present_vblank_ptr;
/* Return the current CRTC for 'window'.
*/
typedef RRCrtcPtr (*present_get_crtc_ptr) (WindowPtr window);
/* Return the current ust/msc for 'crtc'
*/
typedef int (*present_get_ust_msc_ptr) (RRCrtcPtr crtc, uint64_t *ust, uint64_t *msc);
typedef int (*present_wnmd_get_ust_msc_ptr) (WindowPtr window, uint64_t *ust, uint64_t *msc);
/* Queue callback on 'crtc' for time 'msc'. Call present_event_notify with 'event_id'
* at or after 'msc'. Return false if it didn't happen (which might occur if 'crtc'
* is not currently generating vblanks).
*/
typedef Bool (*present_queue_vblank_ptr) (RRCrtcPtr crtc,
uint64_t event_id,
uint64_t msc);
typedef Bool (*present_wnmd_queue_vblank_ptr) (WindowPtr window,
RRCrtcPtr crtc,
uint64_t event_id,
uint64_t msc);
/* Abort pending vblank. The extension is no longer interested in
* 'event_id' which was to be notified at 'msc'. If possible, the
* driver is free to de-queue the notification.
*/
typedef void (*present_abort_vblank_ptr) (RRCrtcPtr crtc, uint64_t event_id, uint64_t msc);
typedef void (*present_wnmd_abort_vblank_ptr) (WindowPtr window,
RRCrtcPtr crtc,
uint64_t event_id,
uint64_t msc);
/* Flush pending drawing on 'window' to the hardware.
*/
typedef void (*present_flush_ptr) (WindowPtr window);
/* Check if 'pixmap' is suitable for flipping to 'window'.
*/
typedef Bool (*present_check_flip_ptr) (RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, Bool sync_flip);
/* Same as 'check_flip' but it can return a 'reason' why the flip would fail.
*/
typedef Bool (*present_check_flip2_ptr) (RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, Bool sync_flip, PresentFlipReason *reason);
/* Flip pixmap, return false if it didn't happen.
*
* 'crtc' is to be used for any necessary synchronization.
*
* 'sync_flip' requests that the flip be performed at the next
* vertical blank interval to avoid tearing artifacts. If false, the
* flip should be performed as soon as possible.
*
* present_event_notify should be called with 'event_id' when the flip
* occurs
*/
typedef Bool (*present_flip_ptr) (RRCrtcPtr crtc,
uint64_t event_id,
uint64_t target_msc,
PixmapPtr pixmap,
Bool sync_flip);
/* Flip pixmap for window, return false if it didn't happen.
*
* Like present_flip_ptr, additionally with:
*
* 'window' used for synchronization.
*
*/
typedef Bool (*present_wnmd_flip_ptr) (WindowPtr window,
RRCrtcPtr crtc,
uint64_t event_id,
uint64_t target_msc,
PixmapPtr pixmap,
Bool sync_flip,
RegionPtr damage);
/* "unflip" back to the regular screen scanout buffer
*
* present_event_notify should be called with 'event_id' when the unflip occurs.
*/
typedef void (*present_unflip_ptr) (ScreenPtr screen,
uint64_t event_id);
/* Doing flips has been discontinued.
*
* Inform driver for potential cleanup on its side.
*/
typedef void (*present_wnmd_flips_stop_ptr) (WindowPtr window);
#define PRESENT_SCREEN_INFO_VERSION 1
typedef struct present_screen_info {
uint32_t version;
present_get_crtc_ptr get_crtc;
present_get_ust_msc_ptr get_ust_msc;
present_queue_vblank_ptr queue_vblank;
present_abort_vblank_ptr abort_vblank;
present_flush_ptr flush;
uint32_t capabilities;
present_check_flip_ptr check_flip;
present_flip_ptr flip;
present_unflip_ptr unflip;
present_check_flip2_ptr check_flip2;
} present_screen_info_rec, *present_screen_info_ptr;
/*
* Called when 'event_id' occurs. 'ust' and 'msc' indicate when the
* event actually happened
*/
extern _X_EXPORT void
present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc);
extern _X_EXPORT Bool
present_screen_init(ScreenPtr screen, present_screen_info_ptr info);
#endif /* _PRESENT_H_ */
+378
View File
@@ -0,0 +1,378 @@
/***********************************************************
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************/
#ifndef PRIVATES_H
#define PRIVATES_H 1
#include <X11/Xdefs.h>
#include <X11/Xosdefs.h>
#include <X11/Xfuncproto.h>
#include <assert.h>
#include "misc.h"
/*****************************************************************
* STUFF FOR PRIVATES
*****************************************************************/
typedef struct _Private PrivateRec, *PrivatePtr;
/* WARNING: the values, as well as the total number are part of public ABI.
Adding a new one will lead to increased size as well as different field
offsets within ScreenRec.
*/
typedef enum {
/* XSELinux uses the same private keys for numerous objects
This black magic - keys of this type have very special handling:
their corresponding space is allocated at the top of the private
areas, in *several* object types (see xselinux_private[] array),
and xselinux uses the same keys for all object types
*/
PRIVATE_XSELINUX,
/* Otherwise, you get a private in just the requested structure
*/
/* These can have objects created before all of the keys are registered */
PRIVATE_SCREEN,
PRIVATE_EXTENSION,
PRIVATE_COLORMAP,
PRIVATE_DEVICE,
/* These cannot have any objects before all relevant keys are registered */
PRIVATE_CLIENT,
PRIVATE_PROPERTY,
PRIVATE_SELECTION,
PRIVATE_WINDOW,
PRIVATE_PIXMAP,
PRIVATE_GC,
PRIVATE_CURSOR,
PRIVATE_CURSOR_BITS,
/* extension privates */
PRIVATE_GLYPH,
PRIVATE_GLYPHSET,
PRIVATE_PICTURE,
PRIVATE_SYNC_FENCE,
/* last private type */
PRIVATE_LAST,
} DevPrivateType;
typedef struct _DevPrivateKeyRec {
int offset;
int size;
Bool initialized;
Bool allocated;
DevPrivateType type;
struct _DevPrivateKeyRec *next;
} DevPrivateKeyRec, *DevPrivateKey;
typedef struct _DevPrivateSetRec {
DevPrivateKey key;
unsigned offset;
int created;
int allocated;
} DevPrivateSetRec, *DevPrivateSetPtr;
typedef struct _DevScreenPrivateKeyRec {
DevPrivateKeyRec screenKey;
} DevScreenPrivateKeyRec, *DevScreenPrivateKeyPtr;
/*
* Let drivers know how to initialize private keys
*/
#define HAS_DEVPRIVATEKEYREC 1
#define HAS_DIXREGISTERPRIVATEKEY 1
/*
* @brief Register a new private index for the private type.
*
* This initializes the specified key and optionally requests pre-allocated
* private space for your driver/module. If you request no extra space, you
* may set and get a single pointer value using this private key. Otherwise,
* you can get the address of the extra space and store whatever data you like
* there.
*
* Maybe called multiple times on the same key, but the size and type must
* match or the server will abort.
*
* Note: this may move around the private storage area to different address,
* thus any pointers taken by GetPrivateAddr() et al have to be considered
* invalid after calling this function.
*
* @param key pointer to key (will be written to)
* @param type the object type the key is used for
* @param size size of the storage reserved for that key (zero => void*)
* @return FALSE if it fails to allocate memory during its operation.
*/
_X_EXPORT Bool dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size);
/*
* Check whether a private key has been registered
*/
static inline Bool
dixPrivateKeyRegistered(DevPrivateKey key)
{
return key->initialized;
}
/*
* Get the address of the private storage.
*
* For keys with pre-defined storage, this gets the base of that storage
* Otherwise, it returns the place where the private pointer is stored.
*/
static inline void *
dixGetPrivateAddr(PrivatePtr *privates, const DevPrivateKey key)
{
assert(key->initialized);
return (char *) (*privates) + key->offset;
}
/*
* Fetch a private pointer stored in the object
*
* Returns the pointer stored with dixSetPrivate.
* This must only be used with keys that have
* no pre-defined storage
*/
static inline void *
dixGetPrivate(PrivatePtr *privates, const DevPrivateKey key)
{
assert(key->size == 0);
return *(void **) dixGetPrivateAddr(privates, key);
}
/*
* Associate 'val' with 'key' in 'privates' so that later calls to
* dixLookupPrivate(privates, key) will return 'val'.
*/
static inline void
dixSetPrivate(PrivatePtr *privates, const DevPrivateKey key, void *val)
{
assert(key->size == 0);
*(void **) dixGetPrivateAddr(privates, key) = val;
}
#include "dix.h"
#include "resource.h"
/*
* Lookup a pointer to the private record.
*
* For privates with defined storage, return the address of the
* storage. For privates without defined storage, return the pointer
* contents
*/
static inline void *
dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key)
{
if (key->size)
return dixGetPrivateAddr(privates, key);
else
return dixGetPrivate(privates, key);
}
/*
* Look up the address of the pointer to the storage
*
* This returns the place where the private pointer is stored,
* which is only valid for privates without predefined storage.
*/
static inline void **
dixLookupPrivateAddr(PrivatePtr *privates, const DevPrivateKey key)
{
assert(key->size == 0);
return (void **) dixGetPrivateAddr(privates, key);
}
extern _X_EXPORT Bool
dixRegisterScreenPrivateKey(DevScreenPrivateKeyPtr key, ScreenPtr pScreen,
DevPrivateType type, unsigned size);
extern _X_EXPORT DevPrivateKey
_dixGetScreenPrivateKey(const DevScreenPrivateKeyPtr key, ScreenPtr pScreen);
static inline void *
dixGetScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKeyPtr key,
ScreenPtr pScreen)
{
return dixGetPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen));
}
static inline void *
dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKeyPtr key,
ScreenPtr pScreen)
{
return dixGetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
}
static inline void
dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKeyPtr key,
ScreenPtr pScreen, void *val)
{
dixSetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen), val);
}
static inline void *
dixLookupScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKeyPtr key,
ScreenPtr pScreen)
{
return dixLookupPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
}
static inline void **
dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKeyPtr key,
ScreenPtr pScreen)
{
return dixLookupPrivateAddr(privates,
_dixGetScreenPrivateKey(key, pScreen));
}
/*
* These functions relate to allocations related to a specific screen;
* space will only be available for objects allocated for use on that
* screen. As such, only objects which are related directly to a specific
* screen are candidates for allocation this way, this includes
* windows, pixmaps, gcs, pictures and colormaps. This key is
* used just like any other key using dixGetPrivate and friends.
*
* This is distinctly different from the ScreenPrivateKeys above which
* allocate space in global objects like cursor bits for a specific
* screen, allowing multiple screen-related chunks of storage in a
* single global object.
*/
#define HAVE_SCREEN_SPECIFIC_PRIVATE_KEYS 1
extern _X_EXPORT Bool
dixRegisterScreenSpecificPrivateKey(ScreenPtr pScreen, DevPrivateKey key,
DevPrivateType type, unsigned size);
/* Clean up screen-specific privates before CloseScreen */
extern void
dixFreeScreenSpecificPrivates(ScreenPtr pScreen);
/* Initialize screen-specific privates in AddScreen */
extern void
dixInitScreenSpecificPrivates(ScreenPtr pScreen);
/* is this private created - so hotplug can avoid crashing */
Bool dixPrivatesCreated(DevPrivateType type);
extern _X_EXPORT void *
_dixAllocateScreenObjectWithPrivates(ScreenPtr pScreen,
unsigned size,
unsigned offset,
DevPrivateType type);
#define dixAllocateScreenObjectWithPrivates(s, t, type) _dixAllocateScreenObjectWithPrivates((s), sizeof(t), offsetof(t, devPrivates), (type))
extern _X_EXPORT int
dixScreenSpecificPrivatesSize(ScreenPtr pScreen, DevPrivateType type);
extern _X_EXPORT void
_dixInitScreenPrivates(ScreenPtr pScreen, PrivatePtr *privates, void *addr, DevPrivateType type);
#define dixInitScreenPrivates(s, o, v, type) _dixInitScreenPrivates((s), &(o)->devPrivates, (v), (type));
/*
* Allocates private data separately from main object.
*
* For objects created during server initialization, this allows those
* privates to be re-allocated as new private keys are registered.
*
* This includes screens, the serverClient, default colormaps and
* extensions entries.
*/
extern _X_EXPORT Bool
dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type);
/*
* Frees separately allocated private data
*/
extern _X_EXPORT void
dixFreePrivates(PrivatePtr privates, DevPrivateType type);
/*
* Initialize privates by zeroing them
*/
extern _X_EXPORT void
_dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type);
#define dixInitPrivates(o, v, type) _dixInitPrivates(&(o)->devPrivates, (v), (type));
/*
* Clean up privates
*/
extern _X_EXPORT void
_dixFiniPrivates(PrivatePtr privates, DevPrivateType type);
#define dixFiniPrivates(o,t) _dixFiniPrivates((o)->devPrivates,(t))
/*
* Allocates private data at object creation time. Required
* for almost all objects, except for the list described
* above for dixAllocatePrivates.
*/
extern _X_EXPORT void *_dixAllocateObjectWithPrivates(unsigned size,
unsigned clear,
unsigned offset,
DevPrivateType type);
#define dixAllocateObjectWithPrivates(t, type) (t *) _dixAllocateObjectWithPrivates(sizeof(t), sizeof(t), offsetof(t, devPrivates), (type))
extern _X_EXPORT void
_dixFreeObjectWithPrivates(void *object, PrivatePtr privates,
DevPrivateType type);
#define dixFreeObjectWithPrivates(o,t) _dixFreeObjectWithPrivates((o), (o)->devPrivates, (t))
/*
* Return size of privates for the specified type
*/
extern _X_EXPORT int
dixPrivatesSize(DevPrivateType type);
/*
* Dump out private stats to ErrorF
*/
extern void
dixPrivateUsage(void);
/*
* Resets the privates subsystem. dixResetPrivates is called from the main loop
* before each server generation. This function must only be called by main().
*/
extern _X_EXPORT void
dixResetPrivates(void);
/*
* Looks up the offset where the devPrivates field is located.
*
* Returns -1 if the specified resource has no dev privates.
* The position of the devPrivates field varies by structure
* and calling code might only know the resource type, not the
* structure definition.
*/
extern _X_EXPORT int
dixLookupPrivateOffset(RESTYPE type);
/*
* Convenience macro for adding an offset to an object pointer
* when making a call to one of the devPrivates functions
*/
#define DEVPRIV_AT(ptr, offset) ((PrivatePtr *)((char *)(ptr) + (offset)))
#endif /* PRIVATES_H */
@@ -0,0 +1,63 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef PROPERTY_H
#define PROPERTY_H
#include "xlibre_ptrtypes.h"
#include "window.h"
extern _X_EXPORT int dixChangeWindowProperty(ClientPtr pClient,
WindowPtr pWin,
Atom property,
Atom type,
int format,
int mode,
unsigned long len,
const void *value,
Bool sendevent);
#endif /* PROPERTY_H */
@@ -0,0 +1,91 @@
/*
*
* Copyright © 2006-2011 Simon Thum simon dot thum at gmx dot de
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef POINTERVELOCITY_H
#define POINTERVELOCITY_H
#include <input.h>
/* constants for acceleration profiles */
#define AccelProfileNone -1
#define AccelProfileClassic 0
#define AccelProfileDeviceSpecific 1
#define AccelProfilePolynomial 2
#define AccelProfileSmoothLinear 3
#define AccelProfileSimple 4
#define AccelProfilePower 5
#define AccelProfileLinear 6
#define AccelProfileSmoothLimited 7
#define AccelProfileLAST AccelProfileSmoothLimited
/* fwd */
struct _DeviceVelocityRec;
/**
* profile
* returns actual acceleration depending on velocity, acceleration control,...
*/
typedef double (*PointerAccelerationProfileFunc)
(DeviceIntPtr dev, struct _DeviceVelocityRec * vel,
double velocity, double threshold, double accelCoeff);
typedef struct _MotionTracker MotionTracker, *MotionTrackerPtr;
/**
* Contains all data needed to implement mouse ballistics
*/
typedef struct _DeviceVelocityRec {
MotionTrackerPtr tracker;
int num_tracker;
int cur_tracker; /* current index */
double velocity; /* velocity as guessed by algorithm */
double last_velocity; /* previous velocity estimate */
double last_dx; /* last time-difference */
double last_dy; /* phase of last/current estimate */
double corr_mul; /* config: multiply this into velocity */
double const_acceleration; /* config: (recipr.) const deceleration */
double min_acceleration; /* config: minimum acceleration */
short reset_time; /* config: reset non-visible state after # ms */
short use_softening; /* config: use softening of mouse values */
double max_rel_diff; /* config: max. relative difference */
double max_diff; /* config: max. difference */
int initial_range; /* config: max. offset used as initial velocity */
Bool average_accel; /* config: average acceleration over velocity */
PointerAccelerationProfileFunc Profile;
PointerAccelerationProfileFunc deviceSpecificProfile;
void *profile_private; /* extended data, see SetAccelerationProfile() */
struct { /* to be able to query this information */
int profile_number;
} statistics;
} DeviceVelocityRec, *DeviceVelocityPtr;
extern _X_EXPORT DeviceVelocityPtr
GetDevicePredictableAccelData(DeviceIntPtr dev);
extern _X_EXPORT void
SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
PointerAccelerationProfileFunc profile);
#endif /* POINTERVELOCITY_H */
+830
View File
@@ -0,0 +1,830 @@
/*
* Copyright © 2000 Compaq Computer Corporation
* Copyright © 2002 Hewlett-Packard Company
* Copyright © 2006 Intel Corporation
* Copyright © 2008 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
* Author: Jim Gettys, Hewlett-Packard Company, Inc.
* Keith Packard, Intel Corporation
*/
#ifndef _RANDRSTR_H_
#define _RANDRSTR_H_
#include <X11/X.h>
#include <X11/Xproto.h>
#include "xlibre_ptrtypes.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "resource.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "extnsionst.h"
#include "servermd.h"
#include "rrtransform.h"
#include <X11/extensions/randr.h>
#include <X11/extensions/randrproto.h>
#include <X11/extensions/render.h> /* we share subpixel order information */
#include "picturestr.h"
#include <X11/Xfuncproto.h>
/* required for ABI compatibility for now */
#define RANDR_10_INTERFACE 1
#define RANDR_12_INTERFACE 1
#define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */
#define RANDR_GET_CRTC_INTERFACE 1
#define RANDR_INTERFACE_VERSION 0x0104
typedef XID RRMode;
typedef XID RROutput;
typedef XID RRCrtc;
typedef XID RRProvider;
typedef XID RRLease;
/*
* Modeline for a monitor. Name follows directly after this struct
*/
#define RRModeName(pMode) ((char *) ((pMode) + 1))
typedef struct _rrMode RRModeRec, *RRModePtr;
typedef struct _rrPropertyValue RRPropertyValueRec, *RRPropertyValuePtr;
typedef struct _rrProperty RRPropertyRec, *RRPropertyPtr;
typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
typedef struct _rrOutput RROutputRec, *RROutputPtr;
typedef struct _rrProvider RRProviderRec, *RRProviderPtr;
typedef struct _rrMonitor RRMonitorRec, *RRMonitorPtr;
typedef struct _rrLease RRLeaseRec, *RRLeasePtr;
struct _rrMode {
int refcnt;
xRRModeInfo mode;
char *name;
ScreenPtr userScreen;
};
struct _rrPropertyValue {
Atom type; /* ignored by server */
short format; /* format of data for swapping - 8,16,32 */
long size; /* size of data in (format/8) bytes */
void *data; /* private to client */
};
struct _rrProperty {
RRPropertyPtr next;
ATOM propertyName;
Bool is_pending;
Bool range;
Bool immutable;
int num_valid;
INT32 *valid_values;
RRPropertyValueRec current, pending;
};
struct _rrCrtc {
RRCrtc id;
ScreenPtr pScreen;
RRModePtr mode;
int x, y;
Rotation rotation;
Rotation rotations;
Bool changed;
int numOutputs;
RROutputPtr *outputs;
int gammaSize;
CARD16 *gammaRed;
CARD16 *gammaBlue;
CARD16 *gammaGreen;
void *devPrivate;
Bool transforms;
RRTransformRec client_pending_transform;
RRTransformRec client_current_transform;
PictTransform transform;
struct pixman_f_transform f_transform;
struct pixman_f_transform f_inverse;
PixmapPtr scanout_pixmap;
PixmapPtr scanout_pixmap_back;
};
struct _rrOutput {
RROutput id;
ScreenPtr pScreen;
char *name;
int nameLength;
CARD8 connection;
CARD8 subpixelOrder;
int mmWidth;
int mmHeight;
RRCrtcPtr crtc;
int numCrtcs;
RRCrtcPtr *crtcs;
int numClones;
RROutputPtr *clones;
int numModes;
int numPreferred;
RRModePtr *modes;
int numUserModes;
RRModePtr *userModes;
Bool changed;
Bool nonDesktop;
RRPropertyPtr properties;
Bool pendingProperties;
void *devPrivate;
};
struct _rrProvider {
RRProvider id;
ScreenPtr pScreen;
uint32_t capabilities;
char *name;
int nameLength;
RRPropertyPtr properties;
Bool pendingProperties;
Bool changed;
struct _rrProvider *offload_sink;
struct _rrProvider *output_source;
};
typedef struct _rrMonitorGeometry {
BoxRec box;
CARD32 mmWidth;
CARD32 mmHeight;
} RRMonitorGeometryRec, *RRMonitorGeometryPtr;
struct _rrMonitor {
Atom name;
ScreenPtr pScreen;
int numOutputs;
RROutput *outputs;
Bool primary;
Bool automatic;
RRMonitorGeometryRec geometry;
};
typedef enum _rrLeaseState { RRLeaseCreating, RRLeaseRunning, RRLeaseTerminating } RRLeaseState;
struct _rrLease {
struct xorg_list list;
ScreenPtr screen;
RRLease id;
RRLeaseState state;
void *devPrivate;
int numCrtcs;
RRCrtcPtr *crtcs;
int numOutputs;
RROutputPtr *outputs;
};
typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
CARD16 width,
CARD16 height,
CARD32 mmWidth, CARD32 mmHeight);
typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
RRCrtcPtr crtc,
RRModePtr mode,
int x,
int y,
Rotation rotation,
int numOutputs, RROutputPtr * outputs);
typedef void (*RRCrtcGetProcPtr) (ScreenPtr pScreen,
RRCrtcPtr crtc,
xRRGetCrtcInfoReply *rep);
typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc);
typedef Bool (*RRCrtcGetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc);
typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen,
RROutputPtr output,
Atom property,
RRPropertyValuePtr value);
typedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen,
RROutputPtr output,
RRModePtr mode);
typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen, RRModePtr mode);
#if RANDR_13_INTERFACE
typedef Bool (*RROutputGetPropertyProcPtr) (ScreenPtr pScreen,
RROutputPtr output, Atom property);
typedef Bool (*RRGetPanningProcPtr) (ScreenPtr pScrn,
RRCrtcPtr crtc,
BoxPtr totalArea,
BoxPtr trackingArea, INT16 *border);
typedef Bool (*RRSetPanningProcPtr) (ScreenPtr pScrn,
RRCrtcPtr crtc,
BoxPtr totalArea,
BoxPtr trackingArea, INT16 *border);
#endif /* RANDR_13_INTERFACE */
typedef Bool (*RRProviderGetPropertyProcPtr) (ScreenPtr pScreen,
RRProviderPtr provider, Atom property);
typedef Bool (*RRProviderSetPropertyProcPtr) (ScreenPtr pScreen,
RRProviderPtr provider,
Atom property,
RRPropertyValuePtr value);
typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation * rotations);
typedef Bool (*RRCloseScreenProcPtr) (ScreenPtr pScreen);
typedef Bool (*RRProviderSetOutputSourceProcPtr)(ScreenPtr pScreen,
RRProviderPtr provider,
RRProviderPtr output_source);
typedef Bool (*RRProviderSetOffloadSinkProcPtr)(ScreenPtr pScreen,
RRProviderPtr provider,
RRProviderPtr offload_sink);
typedef void (*RRProviderDestroyProcPtr)(ScreenPtr pScreen,
RRProviderPtr provider);
/* Additions for 1.6 */
typedef int (*RRCreateLeaseProcPtr)(ScreenPtr screen,
RRLeasePtr lease,
int *fd);
typedef void (*RRTerminateLeaseProcPtr)(ScreenPtr screen,
RRLeasePtr lease);
typedef int (*RRRequestLeaseProcPtr)(ClientPtr client,
ScreenPtr screen,
RRLeasePtr lease);
typedef void (*RRGetLeaseProcPtr)(ClientPtr client,
ScreenPtr screen,
RRLeasePtr *lease,
int *fd);
/* These are for 1.0 compatibility */
typedef struct _rrRefresh {
CARD16 rate;
RRModePtr mode;
} RRScreenRate, *RRScreenRatePtr;
typedef struct _rrScreenSize {
int id;
short width, height;
short mmWidth, mmHeight;
int nRates;
RRScreenRatePtr pRates;
} RRScreenSize, *RRScreenSizePtr;
typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
Rotation rotation,
int rate, RRScreenSizePtr pSize);
typedef Bool (*RRCrtcSetScanoutPixmapProcPtr)(RRCrtcPtr crtc, PixmapPtr pixmap);
typedef Bool (*RRStartFlippingPixmapTrackingProcPtr)(RRCrtcPtr, DrawablePtr,
PixmapPtr, PixmapPtr,
int x, int y,
int dst_x, int dst_y,
Rotation rotation);
typedef Bool (*RREnableSharedPixmapFlippingProcPtr)(RRCrtcPtr,
PixmapPtr front,
PixmapPtr back);
typedef void (*RRDisableSharedPixmapFlippingProcPtr)(RRCrtcPtr);
typedef struct _rrScrPriv {
/*
* 'public' part of the structure; DDXen fill this in
* as they initialize
*/
RRSetConfigProcPtr rrSetConfig;
RRGetInfoProcPtr rrGetInfo;
RRScreenSetSizeProcPtr rrScreenSetSize;
RRCrtcSetProcPtr rrCrtcSet;
RRCrtcSetGammaProcPtr rrCrtcSetGamma;
RRCrtcGetGammaProcPtr rrCrtcGetGamma;
RROutputSetPropertyProcPtr rrOutputSetProperty;
RROutputValidateModeProcPtr rrOutputValidateMode;
RRModeDestroyProcPtr rrModeDestroy;
#if RANDR_13_INTERFACE
RROutputGetPropertyProcPtr rrOutputGetProperty;
RRGetPanningProcPtr rrGetPanning;
RRSetPanningProcPtr rrSetPanning;
#endif
/* TODO #if RANDR_15_INTERFACE */
RRCrtcSetScanoutPixmapProcPtr rrCrtcSetScanoutPixmap;
RRStartFlippingPixmapTrackingProcPtr rrStartFlippingPixmapTracking;
RREnableSharedPixmapFlippingProcPtr rrEnableSharedPixmapFlipping;
RRDisableSharedPixmapFlippingProcPtr rrDisableSharedPixmapFlipping;
RRProviderSetOutputSourceProcPtr rrProviderSetOutputSource;
RRProviderSetOffloadSinkProcPtr rrProviderSetOffloadSink;
RRProviderGetPropertyProcPtr rrProviderGetProperty;
RRProviderSetPropertyProcPtr rrProviderSetProperty;
RRCreateLeaseProcPtr rrCreateLease;
RRTerminateLeaseProcPtr rrTerminateLease;
/*
* Private part of the structure; not considered part of the ABI
*/
TimeStamp lastSetTime; /* last changed by client */
TimeStamp lastConfigTime; /* possible configs changed */
RRCloseScreenProcPtr CloseScreen;
Bool changed; /* some config changed */
Bool configChanged; /* configuration changed */
Bool layoutChanged; /* screen layout changed */
Bool resourcesChanged; /* screen resources change */
Bool leasesChanged; /* leases change */
CARD16 minWidth, minHeight;
CARD16 maxWidth, maxHeight;
CARD16 width, height; /* last known screen size */
CARD16 mmWidth, mmHeight; /* last known screen size */
int numOutputs;
RROutputPtr *outputs;
RROutputPtr primaryOutput;
int numCrtcs;
RRCrtcPtr *crtcs;
/* Last known pointer position */
RRCrtcPtr pointerCrtc;
/*
* Configuration information
*/
Rotation rotations;
CARD16 reqWidth, reqHeight;
int nSizes;
RRScreenSizePtr pSizes;
Rotation rotation;
int rate;
int size;
Bool discontiguous;
RRProviderPtr provider;
RRProviderDestroyProcPtr rrProviderDestroy;
int numMonitors;
RRMonitorPtr *monitors;
struct xorg_list leases;
RRRequestLeaseProcPtr rrRequestLease;
RRGetLeaseProcPtr rrGetLease;
RRCrtcGetProcPtr rrCrtcGet;
} rrScrPrivRec, *rrScrPrivPtr;
extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
#define rrPrivKey (&rrPrivKeyRec)
#define rrGetScrPriv(pScr) ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey))
#define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv((pScr))
#define SetRRScreen(s,p) dixSetPrivate(&(s)->devPrivates, rrPrivKey, (p))
/*
* each window has a list of clients requesting
* RRNotify events. Each client has a resource
* for each window it selects RRNotify input for,
* this resource is used to delete the RRNotifyRec
* entry from the per-window queue.
*/
typedef struct _RREvent *RREventPtr;
typedef struct _RREvent {
RREventPtr next;
ClientPtr client;
WindowPtr window;
XID clientResource;
int mask;
} RREventRec;
typedef struct _RRTimes {
TimeStamp setTime;
TimeStamp configTime;
} RRTimesRec, *RRTimesPtr;
typedef struct _RRClient {
int major_version;
int minor_version;
/* RRTimesRec times[0]; */
} RRClientRec, *RRClientPtr;
/*
* Set the range of sizes for the screen
*/
extern _X_EXPORT void
RRScreenSetSizeRange(ScreenPtr pScreen,
CARD16 minWidth,
CARD16 minHeight, CARD16 maxWidth, CARD16 maxHeight);
/* rrscreen.c */
/*
* Notify the extension that the screen size has been changed.
* The driver is responsible for calling this whenever it has changed
* the size of the screen
*/
extern _X_EXPORT void
RRScreenSizeNotify(ScreenPtr pScreen);
/*
* Request that the screen be resized
*/
extern _X_EXPORT Bool
RRScreenSizeSet(ScreenPtr pScreen,
CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight);
/*
* Send ConfigureNotify event to root window when 'something' happens
*/
extern _X_EXPORT void
RRSendConfigNotify(ScreenPtr pScreen);
/* randr.c */
/* set a screen change on the primary screen */
extern _X_EXPORT void
RRSetChanged(ScreenPtr pScreen);
/*
* Send all pending events
*/
extern _X_EXPORT void
RRTellChanged(ScreenPtr pScreen);
/*
* Poll the driver for changed information
*/
extern _X_EXPORT Bool
RRGetInfo(ScreenPtr pScreen, Bool force_query);
extern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen);
extern _X_EXPORT RROutputPtr RRFirstOutput(ScreenPtr pScreen);
/*
* This is the old interface, deprecated but left
* around for compatibility
*/
/*
* Then, register the specific size with the screen
*/
extern _X_EXPORT RRScreenSizePtr
RRRegisterSize(ScreenPtr pScreen,
short width, short height, short mmWidth, short mmHeight);
extern _X_EXPORT Bool
RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate);
/*
* Finally, set the current configuration of the screen
*/
extern _X_EXPORT void
RRSetCurrentConfig(ScreenPtr pScreen,
Rotation rotation, int rate, RRScreenSizePtr pSize);
/* rrcrtc.c */
/*
* Create a CRTC
*/
extern _X_EXPORT RRCrtcPtr RRCrtcCreate(ScreenPtr pScreen, void *devPrivate);
/*
* Set the allowed rotations on a CRTC
*/
extern _X_EXPORT void
RRCrtcSetRotations(RRCrtcPtr crtc, Rotation rotations);
/*
* Notify the extension that the Crtc has been reconfigured,
* the driver calls this whenever it has updated the mode
*/
extern _X_EXPORT Bool
RRCrtcNotify(RRCrtcPtr crtc,
RRModePtr mode,
int x,
int y,
Rotation rotation,
RRTransformPtr transform, int numOutputs, RROutputPtr * outputs);
/*
* Request that the Crtc be reconfigured
*/
extern _X_EXPORT Bool
RRCrtcSet(RRCrtcPtr crtc,
RRModePtr mode,
int x,
int y, Rotation rotation, int numOutput, RROutputPtr * outputs);
/*
* Request that the Crtc gamma be changed
*/
extern _X_EXPORT Bool
RRCrtcGammaSet(RRCrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue);
/*
* Set the size of the gamma table at server startup time
*/
extern _X_EXPORT Bool
RRCrtcGammaSetSize(RRCrtcPtr crtc, int size);
/* rrmode.c */
/*
* Find, and if necessary, create a mode
*/
extern _X_EXPORT RRModePtr RRModeGet(xRRModeInfo * modeInfo, const char *name);
/*
* Destroy a mode.
*/
extern _X_EXPORT void
RRModeDestroy(RRModePtr mode);
/* rroutput.c */
/*
* Notify the output of some change. configChanged indicates whether
* any external configuration (mode list, clones, connected status)
* has changed, or whether the change was strictly internal
* (which crtc is in use)
*/
extern _X_EXPORT void
RROutputChanged(RROutputPtr output, Bool configChanged);
/*
* Create an output
*/
extern _X_EXPORT RROutputPtr
RROutputCreate(ScreenPtr pScreen,
const char *name, int nameLength, void *devPrivate);
/*
* Notify extension that output parameters have been changed
*/
extern _X_EXPORT Bool
RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones);
extern _X_EXPORT Bool
RROutputSetModes(RROutputPtr output,
RRModePtr * modes, int numModes, int numPreferred);
extern _X_EXPORT Bool
RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs);
extern _X_EXPORT Bool
RROutputSetConnection(RROutputPtr output, CARD8 connection);
extern _X_EXPORT Bool
RROutputSetPhysicalSize(RROutputPtr output, int mmWidth, int mmHeight);
extern _X_EXPORT void
RROutputDestroy(RROutputPtr output);
extern _X_EXPORT void
RRDeleteOutputProperty(RROutputPtr output, Atom property);
extern _X_EXPORT Bool
RRPostPendingProperties(RROutputPtr output);
extern _X_EXPORT int
RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
int format, int mode, unsigned long len,
const void *value, Bool sendevent, Bool pending);
extern _X_EXPORT int
RRConfigureOutputProperty(RROutputPtr output, Atom property,
Bool pending, Bool range, Bool immutable,
int num_values, const INT32 *values);
/* rrprovider.c */
#define PRIME_SYNC_PROP "PRIME Synchronization"
/* *just* for backwards compat with legacy proprietary NVidia driver */
extern _X_EXPORT RESTYPE RRCrtcType; /* X resource type: Randr CRTC */
extern _X_EXPORT RESTYPE RRModeType; /* X resource type: Randr MODE */
extern _X_EXPORT RESTYPE RROutputType; /* X resource type: Randr OUTPUT */
/*
* Set non-desktop property on given output. This flag should be TRUE on
* outputs where usual desktops shouldn't expand onto (eg. head displays,
* additional display bars in various handhelds, etc)
*/
_X_EXPORT /* just for Nvidia legacy */
Bool RROutputSetNonDesktop(RROutputPtr output, Bool non_desktop);
/*
* Return the area of the frame buffer scanned out by the crtc,
* taking into account the current mode and rotation
*
* @param crtc the CRTC to query
* @param width return buffer for width value
* @param height return buffer for height value
*/
_X_EXPORT /* just for Nvidia legacy */
void RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
/*
* Retrieve CRTCs current transform
*
* @param crtc the CRTC to query
* @return pointer to CRTCs current transform
*/
_X_EXPORT /* just for Nvidia legacy */
RRTransformPtr RRCrtcGetTransform(RRCrtcPtr crtc);
/*
* Detach and free a scanout pixmap
*
* @param crtc the CRTC to act on
*/
_X_EXPORT /* just for Nvidia legacy */
void RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc);
/*
* Create / allocate new provider structure
*
* @param pScreen the screen the provider belongs to
* @param name name of the provider (counted string)
* @param nameLen size of the provider name
* @return new provider structure, or NULL on failure
*/
_X_EXPORT /* just for Nvidia legacy */
RRProviderPtr RRProviderCreate(ScreenPtr pScreen, const char *name,
int nameLen);
/*
* Set provider capabilities field
*
* @param provider the provider whose capabilities are to be set
* @param capabilities the new capabilities
*/
_X_EXPORT /* just for Nvidia legacy */
void RRProviderSetCapabilities(RRProviderPtr provider, uint32_t capabilities);
/*
* Check whether client is operating on recent enough protocol version
* to know about refresh rates. This has influence on reply packet formats
*
* @param pClient the client to check
* @return TRUE if client using recent enough protocol version
*/
_X_EXPORT /* just for Nvidia legacy */
Bool RRClientKnowsRates(ClientPtr pClient);
/*
* Set filter on transform structure
*/
_X_EXPORT /* just for Nvidia legacy */
Bool RRTransformSetFilter(RRTransformPtr dst, PictFilterPtr filter,
xFixed *params, int nparams, int width, int height);
/*
* Set whether transforms are allowed on a CRTC
*
* @param crtc the CRTC to set the flag on
* @param transforms TRUE if transforms are allowed
*/
_X_EXPORT /* just for Nvidia legacy */
void RRCrtcSetTransformSupport(RRCrtcPtr crtc, Bool transforms);
/*
* Set subpixel order on given output
*
* @param output the output to set subpixel order on
* @param order subpixel order value to set
*/
_X_EXPORT /* just for Nvidia legacy */
void RROutputSetSubpixelOrder(RROutputPtr output, int order);
/*
* Retrieve output property value
*
* @param output the output to query
* @param property Atom ID of the property to retrieve
* @param pending retrieve pending instead of current value
* @return pointer to property value or NULL (if not found)
*/
_X_EXPORT /* just for Nvidia legacy */
RRPropertyValuePtr RRGetOutputProperty(RROutputPtr output, Atom property, Bool pending);
#endif /* _RANDRSTR_H_ */
/*
randr extension implementation structure
Query state:
ProcRRGetScreenInfo/ProcRRGetScreenResources
RRGetInfo
• Request configuration from driver, either 1.0 or 1.2 style
• These functions only record state changes, all
other actions are pended until RRTellChanged is called
->rrGetInfo
1.0:
RRRegisterSize
RRRegisterRate
RRSetCurrentConfig
1.2:
RRScreenSetSizeRange
RROutputSetCrtcs
RRModeGet
RROutputSetModes
RROutputSetConnection
RROutputSetSubpixelOrder
RROutputSetClones
RRCrtcNotify
• Must delay scanning configuration until after ->rrGetInfo returns
because some drivers will call SetCurrentConfig in the middle
of the ->rrGetInfo operation.
1.0:
• Scan old configuration, mirror to new structures
RRScanOldConfig
RRCrtcCreate
RROutputCreate
RROutputSetCrtcs
RROutputSetConnection
RROutputSetSubpixelOrder
RROldModeAdd • This adds modes one-at-a-time
RRModeGet
RRCrtcNotify
• send events, reset pointer if necessary
RRTellChanged
WalkTree (sending events)
• when layout has changed:
RRPointerScreenConfigured
RRSendConfigNotify
Asynchronous state setting (1.2 only)
When setting state asynchronously, the driver invokes the
->rrGetInfo function and then calls RRTellChanged to flush
the changes to the clients and reset pointer if necessary
Set state
ProcRRSetScreenConfig
RRCrtcSet
1.2:
->rrCrtcSet
RRCrtcNotify
1.0:
->rrSetConfig
RRCrtcNotify
RRTellChanged
*/
+52
View File
@@ -0,0 +1,52 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef REGION_H
#define REGION_H
#include "regionstr.h"
#endif /* REGION_H */
@@ -0,0 +1,367 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef REGIONSTRUCT_H
#define REGIONSTRUCT_H
typedef struct pixman_region16 RegionRec, *RegionPtr;
#include "miscstruct.h"
/* Return values from RectIn() */
#define rgnOUT 0
#define rgnIN 1
#define rgnPART 2
#define NullRegion ((RegionPtr)0)
/*
* clip region
*/
typedef struct pixman_region16_data RegDataRec, *RegDataPtr;
extern _X_EXPORT BoxRec RegionEmptyBox;
extern _X_EXPORT RegDataRec RegionEmptyData;
extern _X_EXPORT RegDataRec RegionBrokenData;
static inline Bool
RegionNil(RegionPtr reg)
{
return ((reg)->data && !(reg)->data->numRects);
}
/* not a region */
static inline Bool
RegionNar(RegionPtr reg)
{
return ((reg)->data == &RegionBrokenData);
}
static inline int
RegionNumRects(RegionPtr reg)
{
return (int)(reg->data ? reg->data->numRects : 1);
}
static inline int
RegionSize(RegionPtr reg)
{
return (int)(reg->data ? reg->data->size : 0);
}
static inline BoxPtr
RegionRects(RegionPtr reg)
{
return ((reg)->data ? (BoxPtr) ((reg)->data + 1) : &(reg)->extents);
}
static inline BoxPtr
RegionBoxptr(RegionPtr reg)
{
return ((BoxPtr) ((reg)->data + 1));
}
static inline BoxPtr
RegionBox(RegionPtr reg, int i)
{
return (&RegionBoxptr(reg)[i]);
}
static inline BoxPtr
RegionTop(RegionPtr reg)
{
return RegionBox(reg, (int)reg->data->numRects);
}
static inline BoxPtr
RegionEnd(RegionPtr reg)
{
return RegionBox(reg, (int)reg->data->numRects - 1);
}
static inline size_t
RegionSizeof(size_t n)
{
if (n < ((INT_MAX - sizeof(RegDataRec)) / sizeof(BoxRec)))
return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)));
else
return 0;
}
static inline void
RegionInit(RegionPtr _pReg, BoxPtr _rect, size_t _size)
{
if ((_rect) != NULL) {
(_pReg)->extents = *(_rect);
(_pReg)->data = (RegDataPtr) NULL;
}
else {
size_t rgnSize;
(_pReg)->extents = RegionEmptyBox;
if (((_size) > 1) && ((rgnSize = RegionSizeof(_size)) > 0) &&
(((_pReg)->data = (RegDataPtr) calloc(1, rgnSize)) != NULL)) {
(_pReg)->data->size = (long)(_size);
(_pReg)->data->numRects = 0;
}
else
(_pReg)->data = &RegionEmptyData;
}
}
static inline Bool
RegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes)
{
return pixman_region_init_rects(pReg, boxes, nBoxes);
}
static inline void
RegionUninit(RegionPtr _pReg)
{
if ((_pReg)->data && (_pReg)->data->size) {
if ((_pReg)->data != &RegionEmptyData)
free((_pReg)->data);
(_pReg)->data = NULL;
}
}
static inline void
RegionReset(RegionPtr _pReg, BoxPtr _pBox)
{
(_pReg)->extents = *(_pBox);
RegionUninit(_pReg);
(_pReg)->data = (RegDataPtr) NULL;
}
static inline Bool
RegionNotEmpty(RegionPtr _pReg)
{
return !RegionNil(_pReg);
}
static inline Bool
RegionBroken(RegionPtr _pReg)
{
return RegionNar(_pReg);
}
static inline void
RegionEmpty(RegionPtr _pReg)
{
RegionUninit(_pReg);
(_pReg)->extents.x2 = (_pReg)->extents.x1;
(_pReg)->extents.y2 = (_pReg)->extents.y1;
(_pReg)->data = &RegionEmptyData;
}
static inline BoxPtr
RegionExtents(RegionPtr _pReg)
{
return (&(_pReg)->extents);
}
static inline void
RegionNull(RegionPtr _pReg)
{
(_pReg)->extents = RegionEmptyBox;
(_pReg)->data = &RegionEmptyData;
}
extern _X_EXPORT void InitRegions(void);
extern _X_EXPORT RegionPtr RegionCreate(BoxPtr /*rect */ ,
int /*size */ );
extern _X_EXPORT void RegionDestroy(RegionPtr /*pReg */ );
extern _X_EXPORT RegionPtr RegionDuplicate(RegionPtr /* pOld */);
static inline Bool
RegionCopy(RegionPtr dst, RegionPtr src)
{
return pixman_region_copy(dst, src);
}
static inline Bool
RegionIntersect(RegionPtr newReg, /* destination Region */
RegionPtr reg1, RegionPtr reg2 /* source regions */
)
{
return pixman_region_intersect(newReg, reg1, reg2);
}
static inline Bool
RegionUnion(RegionPtr newReg, /* destination Region */
RegionPtr reg1, RegionPtr reg2 /* source regions */
)
{
return pixman_region_union(newReg, reg1, reg2);
}
extern _X_EXPORT Bool RegionAppend(RegionPtr /*dstrgn */ ,
RegionPtr /*rgn */ );
extern _X_EXPORT Bool RegionValidate(RegionPtr /*badreg */ ,
Bool * /*pOverlap */ );
extern _X_EXPORT RegionPtr RegionFromRects(int /*nrects */ ,
xRectanglePtr /*prect */ ,
int /*ctype */ );
/*-
*-----------------------------------------------------------------------
* Subtract --
* Subtract regS from regM and leave the result in regD.
* S stands for subtrahend, M for minuend and D for difference.
*
* Results:
* TRUE if successful.
*
* Side Effects:
* regD is overwritten.
*
*-----------------------------------------------------------------------
*/
static inline Bool
RegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
{
return pixman_region_subtract(regD, regM, regS);
}
/*-
*-----------------------------------------------------------------------
* Inverse --
* Take a region and a box and return a region that is everything
* in the box but not in the region. The careful reader will note
* that this is the same as subtracting the region from the box...
*
* Results:
* TRUE.
*
* Side Effects:
* newReg is overwritten.
*
*-----------------------------------------------------------------------
*/
static inline Bool
RegionInverse(RegionPtr newReg, /* Destination region */
RegionPtr reg1, /* Region to invert */
BoxPtr invRect /* Bounding box for inversion */
)
{
return pixman_region_inverse(newReg, reg1, invRect);
}
static inline int
RegionContainsRect(RegionPtr region, BoxPtr prect)
{
return pixman_region_contains_rectangle(region, prect);
}
/* TranslateRegion(pReg, x, y)
translates in place
*/
static inline void
RegionTranslate(RegionPtr pReg, int x, int y)
{
pixman_region_translate(pReg, x, y);
}
extern _X_EXPORT Bool RegionBreak(RegionPtr /*pReg */ );
static inline Bool
RegionContainsPoint(RegionPtr pReg, int x, int y, BoxPtr box /* "return" value */
)
{
return pixman_region_contains_point(pReg, x, y, box);
}
static inline Bool
RegionEqual(RegionPtr reg1, RegionPtr reg2)
{
return pixman_region_equal(reg1, reg2);
}
extern _X_EXPORT Bool RegionRectAlloc(RegionPtr /*pRgn */ ,
int /*n */
);
#ifdef DEBUG
extern _X_EXPORT Bool RegionIsValid(RegionPtr /*prgn */
);
#endif
extern _X_EXPORT void RegionPrint(RegionPtr /*pReg */ );
#define INCLUDE_LEGACY_REGION_DEFINES
#ifdef INCLUDE_LEGACY_REGION_DEFINES
#define REGION_NIL RegionNil
#define REGION_NUM_RECTS RegionNumRects
#define REGION_RECTS RegionRects
#define REGION_CREATE(pScreen, r, s) RegionCreate((r),(s))
#define REGION_COPY(pScreen, d, r) RegionCopy((d), (r))
#define REGION_DESTROY(pScreen, r) RegionDestroy((r))
#define REGION_INTERSECT(pScreen, res, r1, r2) RegionIntersect((res), (r1), (r2))
#define REGION_UNION(pScreen, res, r1, r2) RegionUnion((res), (r1), (r2))
#define REGION_SUBTRACT(pScreen, res, r1, r2) RegionSubtract((res), (r1), (r2))
#define REGION_TRANSLATE(pScreen, r, x, y) RegionTranslate((r), (x), (y))
#define RECT_IN_REGION(pScreen, r, b) RegionContainsRect((r), (b))
#define REGION_EQUAL(pScreen, r1, r2) RegionEqual((r1), (r2))
#define RECTS_TO_REGION(pScreen, n, r, c) RegionFromRects((n), (r), (c))
#define REGION_INIT(pScreen, r, b, s) RegionInit((r), (b), (s))
#define REGION_UNINIT(pScreen, r) RegionUninit((r))
#define REGION_RESET(pScreen, r, b) RegionReset((r), (b))
#define REGION_NOTEMPTY(pScreen, r) RegionNotEmpty((r))
#define REGION_EMPTY(pScreen, r) RegionEmpty((r))
#define REGION_EXTENTS(pScreen, r) RegionExtents((r))
#define REGION_NULL(pScreen, r) RegionNull((r))
#endif /* INCLUDE_LEGACY_REGION_DEFINES */
#endif /* REGIONSTRUCT_H */
+248
View File
@@ -0,0 +1,248 @@
/***********************************************************
Copyright 1987, 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef RESOURCE_H
#define RESOURCE_H 1
#include "xlibre_ptrtypes.h"
#include "callback.h"
#include "misc.h"
#include "dixaccess.h"
/*****************************************************************
* STUFF FOR RESOURCES
*****************************************************************/
/* classes for Resource routines */
typedef uint32_t RESTYPE;
#define RC_VANILLA ((RESTYPE)0)
#define RC_CACHED ((RESTYPE)1<<31)
#define RC_DRAWABLE ((RESTYPE)1<<30)
/* Use class RC_NEVERRETAIN for resources that should not be retained
* regardless of the close down mode when the client dies. (A client's
* event selections on objects that it doesn't own are good candidates.)
* Extensions can use this too!
*/
#define RC_NEVERRETAIN ((RESTYPE)1<<29)
#define RC_LASTPREDEF RC_NEVERRETAIN
#define RC_ANY (~(RESTYPE)0)
/* types for Resource routines */
// prevent namespace clash with Windows
#define X11_RESTYPE_NONE ((RESTYPE)0)
#define X11_RESTYPE_WINDOW ((RESTYPE)1|RC_DRAWABLE)
#define X11_RESTYPE_PIXMAP ((RESTYPE)2|RC_DRAWABLE)
#define X11_RESTYPE_GC ((RESTYPE)3)
#define X11_RESTYPE_FONT ((RESTYPE)4)
#define X11_RESTYPE_CURSOR ((RESTYPE)5)
#define X11_RESTYPE_COLORMAP ((RESTYPE)6)
#define X11_RESTYPE_CMAPENTRY ((RESTYPE)7)
#define X11_RESTYPE_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN)
#define X11_RESTYPE_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN)
#define X11_RESTYPE_LASTPREDEF ((RESTYPE)9)
#define RT_WINDOW X11_RESTYPE_WINDOW
#define RT_PIXMAP X11_RESTYPE_PIXMAP
#define RT_GC X11_RESTYPE_GC
#undef RT_FONT
#undef RT_CURSOR
#define RT_FONT X11_RESTYPE_FONT
#define RT_CURSOR X11_RESTYPE_CURSOR
#define RT_COLORMAP X11_RESTYPE_COLORMAP
#define RT_CMAPENTRY X11_RESTYPE_CMAPENTRY
#define RT_OTHERCLIENT X11_RESTYPE_OTHERCLIENT
#define RT_PASSIVEGRAB X11_RESTYPE_PASSIVEGRAB
#define RT_LASTPREDEF X11_RESTYPE_LASTPREDEF
#define RT_NONE X11_RESTYPE_NONE
extern _X_EXPORT unsigned int ResourceClientBits(void);
#define BAD_RESOURCE 0xe0000000
typedef int (*DeleteType) (void *value,
XID id);
typedef void (*FindResType) (void *value,
XID id,
void *cdata);
typedef void (*FindAllRes) (void *value,
XID id,
RESTYPE type,
void *cdata);
typedef Bool (*FindComplexResType) (void *value,
XID id,
void *cdata);
/* Structure for estimating resource memory usage. Memory usage
* consists of space allocated for the resource itself and of
* references to other resources. Currently the most important use for
* this structure is to estimate pixmap usage of different resources
* more accurately. */
typedef struct {
/* Size of resource itself. Zero if not implemented. */
unsigned long resourceSize;
/* Size attributed to pixmap references from the resource. */
unsigned long pixmapRefSize;
/* Number of references to this resource; typically 1 */
unsigned long refCnt;
} ResourceSizeRec, *ResourceSizePtr;
typedef void (*SizeType)(void *value,
XID id,
ResourceSizePtr size);
extern _X_EXPORT RESTYPE CreateNewResourceType(DeleteType deleteFunc,
const char *name);
typedef void (*FindTypeSubResources)(void *value,
FindAllRes func,
void *cdata);
extern _X_EXPORT SizeType GetResourceTypeSizeFunc(
RESTYPE /*type*/);
extern _X_EXPORT void SetResourceTypeFindSubResFunc(
RESTYPE /*type*/, FindTypeSubResources /*findFunc*/);
extern _X_EXPORT void SetResourceTypeSizeFunc(
RESTYPE /*type*/, SizeType /*sizeFunc*/);
extern _X_EXPORT void SetResourceTypeErrorValue(
RESTYPE /*type*/, int /*errorValue*/);
extern _X_EXPORT RESTYPE CreateNewResourceClass(void);
extern _X_EXPORT Bool InitClientResources(ClientPtr /*client */ );
extern _X_EXPORT XID FakeClientID(int /*client */ );
/* Quartz support on Mac OS X uses the CarbonCore
framework whose AddResource function conflicts here. */
#ifdef __APPLE__
#define AddResource Darwin_X_AddResource
#endif
extern _X_EXPORT Bool AddResource(XID id,
RESTYPE type,
void *value);
extern _X_EXPORT void FreeResource(XID /*id */ ,
RESTYPE /*skipDeleteFuncType */ );
extern _X_EXPORT void FreeResourceByType(XID /*id */ ,
RESTYPE /*type */ ,
Bool /*skipFree */ );
extern _X_EXPORT Bool ChangeResourceValue(XID id,
RESTYPE rtype,
void *value);
extern _X_EXPORT void FindClientResourcesByType(ClientPtr client,
RESTYPE type,
FindResType func,
void *cdata);
extern _X_EXPORT void FindAllClientResources(ClientPtr client,
FindAllRes func,
void *cdata);
/** @brief Iterate through all subresources of a resource.
@note The XID argument provided to the FindAllRes function
may be 0 for subresources that don't have an XID */
extern _X_EXPORT void FindSubResources(void *resource,
RESTYPE type,
FindAllRes func,
void *cdata);
extern _X_EXPORT void FreeClientNeverRetainResources(ClientPtr /*client */ );
extern _X_EXPORT void FreeClientResources(ClientPtr /*client */ );
extern _X_EXPORT void FreeAllResources(void);
extern _X_EXPORT Bool LegalNewID(XID /*id */ ,
ClientPtr /*client */ );
extern _X_EXPORT void *LookupClientResourceComplex(ClientPtr client,
RESTYPE type,
FindComplexResType func,
void *cdata);
extern _X_EXPORT int dixLookupResourceByType(void **result,
XID id,
RESTYPE rtype,
ClientPtr client,
Mask access_mode);
extern _X_EXPORT int dixLookupResourceByClass(void **result,
XID id,
RESTYPE rclass,
ClientPtr client,
Mask access_mode);
extern _X_EXPORT RESTYPE lastResourceType;
extern _X_EXPORT RESTYPE TypeMask;
/*
* @brief allocate a XID (resource ID) for the server itself
*
* This is mostly for resource types that don't have their own API yet
* The XID is allocated within server's ID space and then can be used
* for registering a resource with it (@see AddResource())
*
* @obsoletes FakeClientID
* @return XID the newly allocated XID
*/
_X_EXPORT XID dixAllocServerXID(void);
#endif /* RESOURCE_H */
+52
View File
@@ -0,0 +1,52 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef RGB_H
#define RGB_H
typedef struct _RGB {
unsigned short red, green, blue;
} RGB;
#endif /* RGB_H */
@@ -0,0 +1,61 @@
/*
* Copyright © 2007 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _RRTRANSFORM_H_
#define _RRTRANSFORM_H_
#include <X11/extensions/randr.h>
#include "picturestr.h"
typedef struct _rrTransform RRTransformRec, *RRTransformPtr;
struct _rrTransform {
PictTransform transform;
struct pixman_f_transform f_transform;
struct pixman_f_transform f_inverse;
PictFilterPtr filter;
xFixed *params;
int nparams;
int width;
int height;
};
/*
* Compute the complete transformation matrix including
* client-specified transform, rotation/reflection values and the crtc
* offset.
*
* Return TRUE if the resulting transform is not a simple translation.
*/
extern _X_EXPORT Bool
RRTransformCompute(int x,
int y,
int width,
int height,
Rotation rotation,
RRTransformPtr rr_transform,
PictTransformPtr transform,
struct pixman_f_transform *f_transform,
struct pixman_f_transform *f_inverse);
#endif /* _RRTRANSFORM_H_ */
+96
View File
@@ -0,0 +1,96 @@
/**
* \file sarea.h
* SAREA definitions.
*
* \author Kevin E. Martin <kevin@precisioninsight.com>
* \author Jens Owen <jens@tungstengraphics.com>
* \author Rickard E. (Rik) Faith <faith@valinux.com>
*/
/*
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _SAREA_H_
#define _SAREA_H_
#include "xf86drm.h"
/* SAREA area needs to be at least a page */
#if defined(__alpha__)
#define SAREA_MAX 0x2000
#elif defined(__ia64__)
#define SAREA_MAX 0x10000 /* 64kB */
#else
/* Intel 830M driver needs at least 8k SAREA */
#define SAREA_MAX 0x2000
#endif
#define SAREA_MAX_DRAWABLES 256
#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000
/**
* SAREA per drawable information.
*
* \sa _XF86DRISAREA.
*/
typedef struct _XF86DRISAREADrawable {
unsigned int stamp;
unsigned int flags;
} XF86DRISAREADrawableRec, *XF86DRISAREADrawablePtr;
/**
* SAREA frame information.
*
* \sa _XF86DRISAREA.
*/
typedef struct _XF86DRISAREAFrame {
unsigned int x;
unsigned int y;
unsigned int width;
unsigned int height;
unsigned int fullscreen;
} XF86DRISAREAFrameRec, *XF86DRISAREAFramePtr;
/**
* SAREA definition.
*/
typedef struct _XF86DRISAREA {
/** first thing is always the DRM locking structure */
drmLock lock;
/** \todo Use readers/writer lock for drawable_lock */
drmLock drawable_lock;
XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES];
XF86DRISAREAFrameRec frame;
drm_context_t dummy_context;
} XF86DRISAREARec, *XF86DRISAREAPtr;
typedef struct _XF86DRILSAREA {
drmLock lock;
drmLock otherLocks[31];
} XF86DRILSAREARec, *XF86DRILSAREAPtr;
#endif
@@ -0,0 +1,62 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef SCREENINT_H
#define SCREENINT_H
#include "misc.h"
typedef struct _PixmapFormat *PixmapFormatPtr;
typedef struct _Visual *VisualPtr;
typedef struct _Depth *DepthPtr;
typedef struct _Screen *ScreenPtr;
extern _X_EXPORT void AttachOutputGPU(ScreenPtr pScreen, ScreenPtr newScreen);
extern _X_EXPORT void DetachOutputGPU(ScreenPtr output);
typedef struct _ColormapRec *ColormapPtr;
#endif /* SCREENINT_H */
@@ -0,0 +1,741 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef SCREENINTSTRUCT_H
#define SCREENINTSTRUCT_H
#include "xlibre_ptrtypes.h"
#include "screenint.h"
#include "regionstr.h"
#include "colormap.h"
#include "cursor.h"
#include "validate.h"
#include <X11/Xproto.h>
#include "dix.h"
#include "privates.h"
#include <X11/extensions/randr.h>
typedef struct _PixmapFormat {
unsigned char depth;
unsigned char bitsPerPixel;
unsigned char scanlinePad;
} PixmapFormatRec;
typedef struct _Visual {
VisualID vid;
short class;
short bitsPerRGBValue;
short ColormapEntries;
short nplanes; /* = log2 (ColormapEntries). This does not
* imply that the screen has this many planes.
* it may have more or fewer */
unsigned long redMask, greenMask, blueMask;
int offsetRed, offsetGreen, offsetBlue;
} VisualRec;
typedef struct _Depth {
unsigned char depth;
short numVids;
VisualID *vids; /* block of visual ids for this depth */
} DepthRec;
typedef struct _ScreenSaverStuff {
WindowPtr pWindow;
XID wid;
char blanked;
Bool (*ExternalScreenSaver) (ScreenPtr /*pScreen */ ,
int /*xstate */ ,
Bool /*force */ );
} ScreenSaverStuffRec, *ScreenSaverStuffPtr;
typedef enum {
WINDOW_VRR_DISABLED = 0,
WINDOW_VRR_ENABLED,
} WindowVRRMode;
/*
* There is a typedef for each screen function pointer so that code that
* needs to declare a screen function pointer (e.g. in a screen private
* or as a local variable) can easily do so and retain full type checking.
*/
typedef Bool (*CloseScreenProcPtr) (ScreenPtr /*pScreen */ );
typedef void (*QueryBestSizeProcPtr) (int /*class */ ,
unsigned short * /*pwidth */ ,
unsigned short * /*pheight */ ,
ScreenPtr /*pScreen */ );
typedef Bool (*SaveScreenProcPtr) (ScreenPtr /*pScreen */ ,
int /*on */ );
typedef void (*GetImageProcPtr) (DrawablePtr /*pDrawable */ ,
int /*sx */ ,
int /*sy */ ,
int /*w */ ,
int /*h */ ,
unsigned int /*format */ ,
unsigned long /*planeMask */ ,
char * /*pdstLine */ );
typedef void (*GetSpansProcPtr) (DrawablePtr /*pDrawable */ ,
int /*wMax */ ,
DDXPointPtr /*ppt */ ,
int * /*pwidth */ ,
int /*nspans */ ,
char * /*pdstStart */ );
typedef void (*SourceValidateProcPtr) (DrawablePtr /*pDrawable */ ,
int /*x */ ,
int /*y */ ,
int /*width */ ,
int /*height */ ,
unsigned int /*subWindowMode */ );
typedef Bool (*CreateWindowProcPtr) (WindowPtr /*pWindow */ );
typedef Bool (*DestroyWindowProcPtr) (WindowPtr /*pWindow */ );
typedef Bool (*PositionWindowProcPtr) (WindowPtr /*pWindow */ ,
int /*x */ ,
int /*y */ );
typedef Bool (*ChangeWindowAttributesProcPtr) (WindowPtr /*pWindow */ ,
unsigned long /*mask */ );
typedef Bool (*RealizeWindowProcPtr) (WindowPtr /*pWindow */ );
typedef Bool (*UnrealizeWindowProcPtr) (WindowPtr /*pWindow */ );
typedef void (*RestackWindowProcPtr) (WindowPtr /*pWindow */ ,
WindowPtr /*pOldNextSib */ );
typedef int (*ValidateTreeProcPtr) (WindowPtr /*pParent */ ,
WindowPtr /*pChild */ ,
VTKind /*kind */ );
typedef void (*PostValidateTreeProcPtr) (WindowPtr /*pParent */ ,
WindowPtr /*pChild */ ,
VTKind /*kind */ );
typedef void (*WindowExposuresProcPtr) (WindowPtr /*pWindow */ ,
RegionPtr /*prgn */);
typedef void (*PaintWindowProcPtr) (WindowPtr /*pWindow*/,
RegionPtr /*pRegion*/,
int /*what*/);
typedef void (*CopyWindowProcPtr) (WindowPtr /*pWindow */ ,
xPoint /*ptOldOrg */ ,
RegionPtr /*prgnSrc */ );
typedef void (*ClearToBackgroundProcPtr) (WindowPtr /*pWindow */ ,
int /*x */ ,
int /*y */ ,
int /*w */ ,
int /*h */ ,
Bool /*generateExposures */ );
typedef void (*ClipNotifyProcPtr) (WindowPtr /*pWindow */ ,
int /*dx */ ,
int /*dy */ );
typedef void (*SetWindowVRRModeProcPtr) (WindowPtr pWindow, WindowVRRMode mode);
/* pixmap will exist only for the duration of the current rendering operation */
#define CREATE_PIXMAP_USAGE_SCRATCH 1
/* pixmap will be the backing pixmap for a redirected window */
#define CREATE_PIXMAP_USAGE_BACKING_PIXMAP 2
/* pixmap will contain a glyph */
#define CREATE_PIXMAP_USAGE_GLYPH_PICTURE 3
/* pixmap will be shared */
#define CREATE_PIXMAP_USAGE_SHARED 4
typedef PixmapPtr (*CreatePixmapProcPtr) (ScreenPtr /*pScreen */ ,
int /*width */ ,
int /*height */ ,
int /*depth */ ,
unsigned /*usage_hint */ );
typedef Bool (*DestroyPixmapProcPtr) (PixmapPtr /*pPixmap */ );
typedef Bool (*RealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
FontPtr /*pFont */ );
typedef Bool (*UnrealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
FontPtr /*pFont */ );
typedef void (*ConstrainCursorProcPtr) (DeviceIntPtr /*pDev */ ,
ScreenPtr /*pScreen */ ,
BoxPtr /*pBox */ );
typedef void (*CursorLimitsProcPtr) (DeviceIntPtr /* pDev */ ,
ScreenPtr /*pScreen */ ,
CursorPtr /*pCursor */ ,
BoxPtr /*pHotBox */ ,
BoxPtr /*pTopLeftBox */ );
typedef Bool (*DisplayCursorProcPtr) (DeviceIntPtr /* pDev */ ,
ScreenPtr /*pScreen */ ,
CursorPtr /*pCursor */ );
typedef Bool (*RealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
ScreenPtr /*pScreen */ ,
CursorPtr /*pCursor */ );
typedef Bool (*UnrealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
ScreenPtr /*pScreen */ ,
CursorPtr /*pCursor */ );
typedef void (*RecolorCursorProcPtr) (DeviceIntPtr /* pDev */ ,
ScreenPtr /*pScreen */ ,
CursorPtr /*pCursor */ ,
Bool /*displayed */ );
typedef Bool (*SetCursorPositionProcPtr) (DeviceIntPtr /* pDev */ ,
ScreenPtr /*pScreen */ ,
int /*x */ ,
int /*y */ ,
Bool /*generateEvent */ );
typedef void (*CursorWarpedToProcPtr) (DeviceIntPtr /* pDev */ ,
ScreenPtr /*pScreen */ ,
ClientPtr /*pClient */ ,
WindowPtr /*pWindow */ ,
SpritePtr /*pSprite */ ,
int /*x */ ,
int /*y */ );
typedef void (*CursorConfinedToProcPtr) (DeviceIntPtr /* pDev */ ,
ScreenPtr /*pScreen */ ,
WindowPtr /*pWindow */ );
typedef Bool (*CreateGCProcPtr) (GCPtr /*pGC */ );
typedef Bool (*CreateColormapProcPtr) (ColormapPtr /*pColormap */ );
typedef void (*DestroyColormapProcPtr) (ColormapPtr /*pColormap */ );
typedef void (*InstallColormapProcPtr) (ColormapPtr /*pColormap */ );
typedef void (*UninstallColormapProcPtr) (ColormapPtr /*pColormap */ );
typedef int (*ListInstalledColormapsProcPtr) (ScreenPtr /*pScreen */ ,
XID * /*pmaps */ );
typedef void (*StoreColorsProcPtr) (ColormapPtr /*pColormap */ ,
int /*ndef */ ,
xColorItem * /*pdef */ );
typedef void (*ResolveColorProcPtr) (unsigned short * /*pred */ ,
unsigned short * /*pgreen */ ,
unsigned short * /*pblue */ ,
VisualPtr /*pVisual */ );
typedef RegionPtr (*BitmapToRegionProcPtr) (PixmapPtr /*pPix */ );
typedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr pScreen,
void *timeout);
/* result has three possible values:
* < 0 - error
* = 0 - timeout
* > 0 - activity
*/
typedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr pScreen,
int result);
typedef Bool (*CreateScreenResourcesProcPtr) (ScreenPtr /*pScreen */ );
typedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr pPixmap,
int width,
int height,
int depth,
int bitsPerPixel,
int devKind,
void *pPixData);
typedef PixmapPtr (*GetWindowPixmapProcPtr) (WindowPtr /*pWin */ );
typedef void (*SetWindowPixmapProcPtr) (WindowPtr /*pWin */ ,
PixmapPtr /*pPix */ );
typedef PixmapPtr (*GetScreenPixmapProcPtr) (ScreenPtr /*pScreen */ );
typedef void (*SetScreenPixmapProcPtr) (PixmapPtr /*pPix */ );
typedef void (*MarkWindowProcPtr) (WindowPtr /*pWin */ );
typedef Bool (*MarkOverlappedWindowsProcPtr) (WindowPtr /*parent */ ,
WindowPtr /*firstChild */ ,
WindowPtr * /*pLayerWin */ );
typedef int (*ConfigNotifyProcPtr) (WindowPtr /*pWin */ ,
int /*x */ ,
int /*y */ ,
int /*w */ ,
int /*h */ ,
int /*bw */ ,
WindowPtr /*pSib */ );
typedef void (*MoveWindowProcPtr) (WindowPtr /*pWin */ ,
int /*x */ ,
int /*y */ ,
WindowPtr /*pSib */ ,
VTKind /*kind */ );
typedef void (*ResizeWindowProcPtr) (WindowPtr /*pWin */ ,
int /*x */ ,
int /*y */ ,
unsigned int /*w */ ,
unsigned int /*h */ ,
WindowPtr /*pSib */
);
typedef WindowPtr (*GetLayerWindowProcPtr) (WindowPtr /*pWin */
);
typedef void (*HandleExposuresProcPtr) (WindowPtr /*pWin */ );
typedef void (*ReparentWindowProcPtr) (WindowPtr /*pWin */ ,
WindowPtr /*pPriorParent */ );
typedef void (*SetShapeProcPtr) (WindowPtr /*pWin */ ,
int /* kind */ );
typedef void (*ChangeBorderWidthProcPtr) (WindowPtr /*pWin */ ,
unsigned int /*width */ );
typedef void (*MarkUnrealizedWindowProcPtr) (WindowPtr /*pChild */ ,
WindowPtr /*pWin */ ,
Bool /*fromConfigure */ );
typedef Bool (*DeviceCursorInitializeProcPtr) (DeviceIntPtr /* pDev */ ,
ScreenPtr /* pScreen */ );
typedef void (*DeviceCursorCleanupProcPtr) (DeviceIntPtr /* pDev */ ,
ScreenPtr /* pScreen */ );
typedef void (*ConstrainCursorHarderProcPtr) (DeviceIntPtr, ScreenPtr, int,
int *, int *);
typedef Bool (*SharePixmapBackingProcPtr)(PixmapPtr, ScreenPtr, void **);
typedef Bool (*SetSharedPixmapBackingProcPtr)(PixmapPtr, void *);
#define HAS_SYNC_SHARED_PIXMAP 1
/* The SyncSharedPixmap hook has two purposes:
*
* 1. If the primary driver has it, the secondary driver can use it to
* synchronize the shared pixmap contents with the screen pixmap.
* 2. If the secondary driver has it, the primary driver can expect the secondary
* driver to call the primary screen's SyncSharedPixmap hook, so the primary
* driver doesn't have to synchronize the shared pixmap contents itself,
* e.g. from the BlockHandler.
*
* A driver must only set the hook if it handles both cases correctly.
*
* The argument is the secondary screen's pixmap_dirty_list entry, the hook is
* responsible for finding the corresponding entry in the primary screen's
* pixmap_dirty_list.
*/
typedef void (*SyncSharedPixmapProcPtr)(PixmapDirtyUpdatePtr);
typedef Bool (*StartPixmapTrackingProcPtr)(DrawablePtr, PixmapPtr,
int x, int y,
int dst_x, int dst_y,
Rotation rotation);
typedef Bool (*PresentSharedPixmapProcPtr)(PixmapPtr);
typedef Bool (*RequestSharedPixmapNotifyDamageProcPtr)(PixmapPtr);
typedef Bool (*StopPixmapTrackingProcPtr)(DrawablePtr, PixmapPtr);
typedef Bool (*StopFlippingPixmapTrackingProcPtr)(DrawablePtr,
PixmapPtr, PixmapPtr);
typedef Bool (*SharedPixmapNotifyDamageProcPtr)(PixmapPtr);
typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool);
typedef WindowPtr (*XYToWindowProcPtr)(ScreenPtr pScreen,
SpritePtr pSprite, int x, int y);
typedef int (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32);
typedef void (*DPMSProcPtr)(ScreenPtr pScreen, int level);
/* Wrapping Screen procedures
There are a few modules in the X server which dynamically add and
remove themselves from various screen procedure call chains.
For example, the BlockHandler is dynamically modified by:
* xf86Rotate
* miSprite
* composite
* render (for animated cursors)
Correctly manipulating this chain is complicated by the fact that
the chain is constructed through a sequence of screen private
structures, each holding the next screen->proc pointer.
To add a module to a screen->proc chain is fairly simple; just save
the current screen->proc value in the module screen private
and store the module's function in the screen->proc location.
Removing a screen proc is a bit trickier. It seems like all you
need to do is set the screen->proc pointer back to the value saved
in your screen private. However, if some other module has come
along and wrapped on top of you, then the right place to store the
previous screen->proc value is actually in the wrapping module's
screen private structure(!). Of course, you have no idea what
other module may have wrapped on top, nor could you poke inside
its screen private in any case.
To make this work, we restrict the unwrapping process to happen
during the invocation of the screen proc itself, and then we
require the screen proc to take some care when manipulating the
screen proc functions pointers.
The requirements are:
1) The screen proc must set the screen->proc pointer back to the
value saved in its screen private before calling outside its
module.
2a) If the screen proc wants to be remove itself from the chain,
it must not manipulate screen->proc pointer again before
returning.
2b) If the screen proc wants to remain in the chain, it must:
2b.1) Re-fetch the screen->proc pointer and store that in
its screen private. This ensures that any changes
to the chain will be preserved.
2b.2) Set screen->proc back to itself
One key requirement here is that these steps must wrap not just
any invocation of the nested screen->proc value, but must nest
essentially any calls outside the current module. This ensures
that other modules can reliably manipulate screen->proc wrapping
using these same rules.
For example, the animated cursor code in render has two macros,
Wrap and Unwrap.
#define Unwrap(as,s,elt) ((s)->elt = (as)->elt)
Unwrap takes the screen private (as), the screen (s) and the
member name (elt), and restores screen->proc to that saved in the
screen private.
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
Wrap takes the screen private (as), the screen (s), the member
name (elt) and the wrapping function (func). It saves the
current screen->proc value in the screen private, and then sets the
screen->proc to the local wrapping function.
Within each of these functions, there's a pretty simple pattern:
Unwrap(as, pScreen, UnrealizeCursor);
// Do local stuff, including possibly calling down through
// pScreen->UnrealizeCursor
Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor);
The wrapping block handler is a bit different; it does the Unwrap,
the local operations, and then only re-Wraps if the hook is still
required. Unwrap occurs at the top of each function, just after
entry, and Wrap occurs at the bottom of each function, just
before returning.
DestroyWindow() should NOT be wrapped anymore
use dixScreenHookWindowDestroy() instead.
*/
typedef struct _Screen {
int myNum; /* index of this instance in Screens[] */
ATOM id;
short x, y, width, height;
short mmWidth, mmHeight;
short numDepths;
unsigned char rootDepth;
DepthPtr allowedDepths;
unsigned long rootVisual;
unsigned long defColormap;
short minInstalledCmaps, maxInstalledCmaps;
char backingStoreSupport, saveUnderSupport;
unsigned long whitePixel, blackPixel;
GCPtr GCperDepth[MAXFORMATS + 1];
/* next field is a stipple to use as default in a GC. we don't build
* default tiles of all depths because they are likely to be of a color
* different from the default fg pixel, so we don't win anything by
* building a standard one.
*/
PixmapPtr defaultStipple;
void *devPrivate;
short numVisuals;
VisualPtr visuals;
WindowPtr root;
ScreenSaverStuffRec screensaver;
DevPrivateSetRec screenSpecificPrivates[PRIVATE_LAST];
/* Random screen procedures */
CloseScreenProcPtr CloseScreen;
QueryBestSizeProcPtr QueryBestSize;
SaveScreenProcPtr SaveScreen;
GetImageProcPtr GetImage;
GetSpansProcPtr GetSpans;
SourceValidateProcPtr SourceValidate;
/* Window Procedures */
CreateWindowProcPtr CreateWindow;
DestroyWindowProcPtr DestroyWindow;
PositionWindowProcPtr PositionWindow;
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
ValidateTreeProcPtr ValidateTree;
PostValidateTreeProcPtr PostValidateTree;
WindowExposuresProcPtr WindowExposures;
CopyWindowProcPtr CopyWindow;
ClearToBackgroundProcPtr ClearToBackground;
ClipNotifyProcPtr ClipNotify;
RestackWindowProcPtr RestackWindow;
PaintWindowProcPtr PaintWindow;
/* Pixmap procedures */
CreatePixmapProcPtr CreatePixmap;
DestroyPixmapProcPtr DestroyPixmap;
/* Font procedures */
RealizeFontProcPtr RealizeFont;
UnrealizeFontProcPtr UnrealizeFont;
/* Cursor Procedures */
ConstrainCursorProcPtr ConstrainCursor;
ConstrainCursorHarderProcPtr ConstrainCursorHarder;
CursorLimitsProcPtr CursorLimits;
DisplayCursorProcPtr DisplayCursor;
RealizeCursorProcPtr RealizeCursor;
UnrealizeCursorProcPtr UnrealizeCursor;
RecolorCursorProcPtr RecolorCursor;
SetCursorPositionProcPtr SetCursorPosition;
CursorWarpedToProcPtr CursorWarpedTo;
CursorConfinedToProcPtr CursorConfinedTo;
/* GC procedures */
CreateGCProcPtr CreateGC;
/* Colormap procedures */
CreateColormapProcPtr CreateColormap;
DestroyColormapProcPtr DestroyColormap;
InstallColormapProcPtr InstallColormap;
UninstallColormapProcPtr UninstallColormap;
ListInstalledColormapsProcPtr ListInstalledColormaps;
StoreColorsProcPtr StoreColors;
ResolveColorProcPtr ResolveColor;
/* Region procedures */
BitmapToRegionProcPtr BitmapToRegion;
/* os layer procedures */
ScreenBlockHandlerProcPtr BlockHandler;
ScreenWakeupHandlerProcPtr WakeupHandler;
/* anybody can get a piece of this array */
PrivateRec *devPrivates;
CreateScreenResourcesProcPtr CreateScreenResources;
ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
GetWindowPixmapProcPtr GetWindowPixmap;
SetWindowPixmapProcPtr SetWindowPixmap;
GetScreenPixmapProcPtr GetScreenPixmap;
SetScreenPixmapProcPtr SetScreenPixmap;
NameWindowPixmapProcPtr NameWindowPixmap;
#ifdef CONFIG_LEGACY_NVIDIA_PADDING
/* This field is used by the 470 and 390 proprietary nvidia DDX driver, and should always be NULL */
void* reserved_for_nvidia_470_and_390;
#endif
unsigned int totalPixmapSize;
MarkWindowProcPtr MarkWindow;
MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
ConfigNotifyProcPtr ConfigNotify;
MoveWindowProcPtr MoveWindow;
ResizeWindowProcPtr ResizeWindow;
GetLayerWindowProcPtr GetLayerWindow;
HandleExposuresProcPtr HandleExposures;
ReparentWindowProcPtr ReparentWindow;
SetShapeProcPtr SetShape;
ChangeBorderWidthProcPtr ChangeBorderWidth;
MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
/* Device cursor procedures */
DeviceCursorInitializeProcPtr DeviceCursorInitialize;
DeviceCursorCleanupProcPtr DeviceCursorCleanup;
/* set it in driver side if X server can copy the framebuffer content.
* Meant to be used together with '-background none' option, avoiding
* malicious users to steal framebuffer's content if that would be the
* default */
Bool canDoBGNoneRoot;
Bool isGPU;
/* Info on this screen's secondarys (if any) */
struct xorg_list secondary_list;
struct xorg_list secondary_head;
int output_secondarys;
/* Info for when this screen is a secondary */
ScreenPtr current_primary;
Bool is_output_secondary;
Bool is_offload_secondary;
SharePixmapBackingProcPtr SharePixmapBacking;
SetSharedPixmapBackingProcPtr SetSharedPixmapBacking;
StartPixmapTrackingProcPtr StartPixmapTracking;
StopPixmapTrackingProcPtr StopPixmapTracking;
SyncSharedPixmapProcPtr SyncSharedPixmap;
SharedPixmapNotifyDamageProcPtr SharedPixmapNotifyDamage;
RequestSharedPixmapNotifyDamageProcPtr RequestSharedPixmapNotifyDamage;
PresentSharedPixmapProcPtr PresentSharedPixmap;
StopFlippingPixmapTrackingProcPtr StopFlippingPixmapTracking;
struct xorg_list pixmap_dirty_list;
ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap;
XYToWindowProcPtr XYToWindow;
DPMSProcPtr DPMS;
/* ===== below here is PRIVATE ==== drivers MUST NEVER touch it ===== */
/* additional window destructors (replaces wrapping DestroyWindow).
should NOT be touched outside of DIX core */
CallbackListPtr hookWindowDestroy;
/* additional window position notify hooks (replaces wrapping PositionWindow)
should NOT be touched outside of DIX core */
CallbackListPtr hookWindowPosition;
/* additional screen close notify hooks (replaces wrapping CloseScreen)
should NOT be touched outside of DIX core */
CallbackListPtr hookClose;
/* additional pixmap destroy notify hooks (replaces wrapping DestroyPixmap)
should NOT be touched outside of DIX core */
CallbackListPtr hookPixmapDestroy;
/* hooks run right after SUCCESSFUL CreateScreenResources
should NOT be touched outside of DIX core */
CallbackListPtr hookPostCreateResources;
SetWindowVRRModeProcPtr SetWindowVRRMode;
/* additional screen post-close notify hooks (replaces wrapping CloseScreen)
should NOT be touched outside of DIX core */
CallbackListPtr hookPostClose;
/* xfixes cursor hiding -- this might deserve further optimization */
struct {
DisplayCursorProcPtr DisplayCursor; /* original proc (for wrapping) */
struct _CursorHideCountRec *pCursorHideCounts;
} xfixes;
} ScreenRec;
static inline RegionPtr
BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix)
{
return (*(_pScreen)->BitmapToRegion) (pPix); /* no mi version?! */
}
typedef struct _ScreenInfo {
int imageByteOrder;
int bitmapScanlineUnit;
int bitmapScanlinePad;
int bitmapBitOrder;
int numPixmapFormats;
PixmapFormatRec formats[MAXFORMATS];
int numScreens;
ScreenPtr screens[MAXSCREENS];
int numGPUScreens;
ScreenPtr gpuscreens[MAXGPUSCREENS];
int x; /* origin */
int y; /* origin */
int width; /* total width of all screens together */
int height; /* total height of all screens together */
/* beyond here, NOT part of ABI */
int numRoots; /* client-visible numer, usually equals numScreens, except for Xinerama etc */
} ScreenInfo;
extern _X_EXPORT ScreenInfo screenInfo;
#endif /* SCREENINTSTRUCT_H */
+107
View File
@@ -0,0 +1,107 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef SERVERMD_H
#define SERVERMD_H 1
#include <stddef.h>
#include <X11/Xarch.h> /* for X_LITTLE_ENDIAN/X_BIG_ENDIAN */
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
#define IMAGE_BYTE_ORDER LSBFirst
#define BITMAP_BIT_ORDER LSBFirst
#elif X_BYTE_ORDER == X_BIG_ENDIAN
#define IMAGE_BYTE_ORDER MSBFirst
#define BITMAP_BIT_ORDER MSBFirst
#else
#error "Too weird to live."
#endif
#define BITMAP_SCANLINE_PAD 32
#define LOG2_BITMAP_PAD 5
#define LOG2_BYTES_PER_SCANLINE_PAD 2
#include <X11/Xfuncproto.h>
/*
* This returns the number of padding units, for depth d and width w.
* For bitmaps this can be calculated with the macros above.
* Other depths require either grovelling over the formats field of the
* screenInfo or hardwired constants.
*/
typedef struct _PaddingInfo {
int padRoundUp; /* pixels per pad unit - 1 */
int padPixelsLog2; /* log 2 (pixels per pad unit) */
int padBytesLog2; /* log 2 (bytes per pad unit) */
int notPower2; /* bitsPerPixel not a power of 2 */
int bytesPerPixel; /* only set when notPower2 is TRUE */
int bitsPerPixel; /* bits per pixel */
} PaddingInfo;
extern _X_EXPORT PaddingInfo PixmapWidthPaddingInfo[];
/* The only portable way to get the bpp from the depth is to look it up */
#define BitsPerPixel(d) (PixmapWidthPaddingInfo[d].bitsPerPixel)
#define PixmapWidthInPadUnits(w, d) \
(PixmapWidthPaddingInfo[d].notPower2 ? \
(((int)(w) * PixmapWidthPaddingInfo[d].bytesPerPixel + \
PixmapWidthPaddingInfo[d].bytesPerPixel) >> \
PixmapWidthPaddingInfo[d].padBytesLog2) : \
((int)((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \
PixmapWidthPaddingInfo[d].padPixelsLog2))
/*
* Return the number of bytes to which a scanline of the given
* depth and width will be padded.
*/
#define PixmapBytePad(w, d) \
(PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2)
static inline size_t BitmapBytePad(size_t w) {
return ((((w) + BITMAP_SCANLINE_PAD - 1) >> LOG2_BITMAP_PAD) << LOG2_BYTES_PER_SCANLINE_PAD);
}
#endif /* SERVERMD_H */
+155
View File
@@ -0,0 +1,155 @@
/*
*
* Copyright © 2000 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _SHADOW_H_
#define _SHADOW_H_
#include "scrnintstr.h"
#include "picturestr.h"
#include "damage.h"
#include "damagestr.h"
typedef struct _shadowBuf *shadowBufPtr;
typedef void (*ShadowUpdateProc) (ScreenPtr pScreen, shadowBufPtr pBuf);
#define SHADOW_WINDOW_RELOCATE 1
#define SHADOW_WINDOW_READ 2
#define SHADOW_WINDOW_WRITE 4
typedef void *(*ShadowWindowProc) (ScreenPtr pScreen,
CARD32 row,
CARD32 offset,
int mode, CARD32 *size, void *closure);
typedef struct _shadowBuf {
DamagePtr pDamage;
ShadowUpdateProc update;
ShadowWindowProc window;
PixmapPtr pPixmap;
void *closure;
int randr;
/* screen wrappers */
GetImageProcPtr GetImage;
void *_dummy1; // required in place of a removed field for ABI compatibility
ScreenBlockHandlerProcPtr BlockHandler;
} shadowBufRec;
/* Match defines from randr extension */
#define SHADOW_ROTATE_0 1
#define SHADOW_ROTATE_90 2
#define SHADOW_ROTATE_180 4
#define SHADOW_ROTATE_270 8
#define SHADOW_ROTATE_ALL (SHADOW_ROTATE_0|SHADOW_ROTATE_90|\
SHADOW_ROTATE_180|SHADOW_ROTATE_270)
#define SHADOW_REFLECT_X 16
#define SHADOW_REFLECT_Y 32
#define SHADOW_REFLECT_ALL (SHADOW_REFLECT_X|SHADOW_REFLECT_Y)
extern _X_EXPORT Bool
shadowSetup(ScreenPtr pScreen);
extern _X_EXPORT Bool
shadowAdd(ScreenPtr pScreen,
PixmapPtr pPixmap,
ShadowUpdateProc update,
ShadowWindowProc window, int randr, void *closure);
extern _X_EXPORT void
shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap);
extern _X_EXPORT void
shadowUpdateAfb4(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateAfb8(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateIplan2p4(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateIplan2p8(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdatePlanar4(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdatePlanar4x8(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotatePacked(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate8_90(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate16_90(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate16_90YX(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate32_90(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate8_180(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate16_180(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate32_180(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate8_270(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate16_270(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate16_270YX(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate32_270(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate8(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate16(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdateRotate32(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
shadowUpdate32to24(ScreenPtr pScreen, shadowBufPtr pBuf);
typedef void (*shadowUpdateProc) (ScreenPtr, shadowBufPtr);
#endif /* _SHADOW_H_ */
@@ -0,0 +1,39 @@
#ifndef _SHADOWFB_H
#define _SHADOWFB_H
#include "xf86str.h"
/*
* User defined callback function. Passed a pointer to the ScrnInfo struct,
* the number of dirty rectangles, and a pointer to the first dirty rectangle
* in the array.
*/
typedef void (*RefreshAreaFuncPtr) (ScrnInfoPtr, int, BoxPtr);
/*
* ShadowFBInit initializes the shadowfb subsystem. refreshArea is a pointer
* to a user supplied callback function. This function will be called after
* any operation that modifies the framebuffer. The newly dirtied rectangles
* are passed to the callback.
*
* Returns FALSE in the event of an error.
*/
extern _X_EXPORT Bool
ShadowFBInit(ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea);
/*
* ShadowFBInit2 is a more featureful refinement of the original shadowfb.
* ShadowFBInit2 allows you to specify two callbacks, one to be called
* immediately before an operation that modifies the framebuffer, and another
* to be called immediately after.
*
* Returns FALSE in the event of an error
*/
extern _X_EXPORT Bool
ShadowFBInit2(ScreenPtr pScreen,
RefreshAreaFuncPtr preRefreshArea,
RefreshAreaFuncPtr postRefreshArea);
#endif /* _SHADOWFB_H */
+76
View File
@@ -0,0 +1,76 @@
/*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _SHMINT_H_
#define _SHMINT_H_
#include <X11/Xmd.h>
#include <X11/extensions/shmproto.h>
#include "screenint.h"
#include "pixmap.h"
#include "gc.h"
#define XSHM_PUT_IMAGE_ARGS \
DrawablePtr /* dst */, \
GCPtr /* pGC */, \
int /* depth */, \
unsigned int /* format */, \
int /* w */, \
int /* h */, \
int /* sx */, \
int /* sy */, \
int /* sw */, \
int /* sh */, \
int /* dx */, \
int /* dy */, \
char * /* data */
#define XSHM_CREATE_PIXMAP_ARGS \
ScreenPtr /* pScreen */, \
int /* width */, \
int /* height */, \
int /* depth */, \
char * /* addr */
typedef struct _ShmFuncs {
PixmapPtr (*CreatePixmap) (XSHM_CREATE_PIXMAP_ARGS);
void (*PutImage) (XSHM_PUT_IMAGE_ARGS);
} ShmFuncs, *ShmFuncsPtr;
#if XTRANS_SEND_FDS
#define SHM_FD_PASSING 1
#endif
#ifdef SHM_FD_PASSING
#define SHMDESC_IS_FD(shmdesc) ((shmdesc)->is_fd)
#else
#define SHMDESC_IS_FD(shmdesc) (0)
#endif
_X_EXPORT void ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
_X_EXPORT void ShmRegisterFbFuncs(ScreenPtr pScreen);
extern _X_EXPORT int ShmCompletionCode;
extern _X_EXPORT int BadShmSegCode;
#endif /* _SHMINT_H_ */
@@ -0,0 +1,49 @@
/*
* Copyright © 2010 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _SYNCSDK_H_
#define _SYNCSDK_H_
#include "misync.h"
extern _X_EXPORT int
SyncVerifyFence(SyncFence ** ppFence, XID fid, ClientPtr client, Mask mode);
extern _X_EXPORT SyncObject*
SyncCreate(ClientPtr client, XID id, unsigned char type);
#define VERIFY_SYNC_FENCE(pFence, fid, client, mode) \
do { \
int rc; \
rc = SyncVerifyFence(&(pFence), (fid), (client), (mode)); \
if (Success != rc) return rc; \
} while (0)
#define VERIFY_SYNC_FENCE_OR_NONE(pFence, fid, client, mode) \
do { \
(pFence) = 0; \
if (None != (fid)) \
VERIFY_SYNC_FENCE((pFence), (fid), (client), (mode)); \
} while (0)
#endif /* _SYNCSDK_H_ */
@@ -0,0 +1,40 @@
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef VALIDATE_H
#define VALIDATE_H
#include "miscstruct.h"
#include "regionstr.h"
typedef enum { VTOther, VTStack, VTMove, VTUnmap, VTMap, VTBroken } VTKind;
/* union _MiValidate is now device dependent; see mivalidate.h for an example */
typedef union _MiValidate *ValidatePtr;
#define UnmapValData ((ValidatePtr)1)
#endif /* VALIDATE_H */
+217
View File
@@ -0,0 +1,217 @@
/*
* Copyright (c) 1997,1998 The XFree86 Project, Inc.
*
* Loosely based on code bearing the following copyright:
*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
* Author: Dirk Hohndel
*/
#ifndef _VGAHW_H
#define _VGAHW_H
#include <X11/X.h>
#include "misc.h"
#include "input.h"
#include "scrnintstr.h"
#include "xf86str.h"
#include "xf86Pci.h"
#include "xf86DDC.h"
#include "globals.h"
#include <X11/extensions/dpmsconst.h>
extern _X_EXPORT int vgaHWGetIndex(void);
/*
* access macro
*/
#define VGAHWPTR(p) ((vgaHWPtr)((p)->privates[vgaHWGetIndex()].ptr))
/* Standard VGA registers */
#define VGA_ATTR_INDEX 0x3C0
#define VGA_ATTR_DATA_W 0x3C0
#define VGA_ATTR_DATA_R 0x3C1
#define VGA_IN_STAT_0 0x3C2 /* read */
#define VGA_MISC_OUT_W 0x3C2 /* write */
#define VGA_ENABLE 0x3C3
#define VGA_SEQ_INDEX 0x3C4
#define VGA_SEQ_DATA 0x3C5
#define VGA_DAC_MASK 0x3C6
#define VGA_DAC_READ_ADDR 0x3C7
#define VGA_DAC_WRITE_ADDR 0x3C8
#define VGA_DAC_DATA 0x3C9
#define VGA_FEATURE_R 0x3CA /* read */
#define VGA_MISC_OUT_R 0x3CC /* read */
#define VGA_GRAPH_INDEX 0x3CE
#define VGA_GRAPH_DATA 0x3CF
#define VGA_IOBASE_MONO 0x3B0
#define VGA_IOBASE_COLOR 0x3D0
#define VGA_CRTC_INDEX_OFFSET 0x04
#define VGA_CRTC_DATA_OFFSET 0x05
#define VGA_IN_STAT_1_OFFSET 0x0A /* read */
#define VGA_FEATURE_W_OFFSET 0x0A /* write */
/* default number of VGA registers stored internally */
#define VGA_NUM_CRTC 25
#define VGA_NUM_SEQ 5
#define VGA_NUM_GFX 9
#define VGA_NUM_ATTR 21
/* Flags for vgaHWSave() and vgaHWRestore() */
#define VGA_SR_MODE 0x01
#define VGA_SR_FONTS 0x02
#define VGA_SR_CMAP 0x04
#define VGA_SR_ALL (VGA_SR_MODE | VGA_SR_FONTS | VGA_SR_CMAP)
/* Defaults for the VGA memory window */
#define VGA_DEFAULT_PHYS_ADDR 0xA0000
#define VGA_DEFAULT_MEM_SIZE (64 * 1024)
/*
* vgaRegRec contains settings of standard VGA registers.
*/
typedef struct {
unsigned char MiscOutReg; /* */
unsigned char *CRTC; /* Crtc Controller */
unsigned char *Sequencer; /* Video Sequencer */
unsigned char *Graphics; /* Video Graphics */
unsigned char *Attribute; /* Video Attribute */
unsigned char DAC[768]; /* Internal Colorlookuptable */
unsigned char numCRTC; /* number of CRTC registers, def=VGA_NUM_CRTC */
unsigned char numSequencer; /* number of seq registers, def=VGA_NUM_SEQ */
unsigned char numGraphics; /* number of gfx registers, def=VGA_NUM_GFX */
unsigned char numAttribute; /* number of attr registers, def=VGA_NUM_ATTR */
} vgaRegRec, *vgaRegPtr;
typedef struct _vgaHWRec *vgaHWPtr;
typedef void (*vgaHWWriteIndexProcPtr) (vgaHWPtr hwp, CARD8 indx, CARD8 value);
typedef CARD8 (*vgaHWReadIndexProcPtr) (vgaHWPtr hwp, CARD8 indx);
typedef void (*vgaHWWriteProcPtr) (vgaHWPtr hwp, CARD8 value);
typedef CARD8 (*vgaHWReadProcPtr) (vgaHWPtr hwp);
typedef void (*vgaHWMiscProcPtr) (vgaHWPtr hwp);
/*
* vgaHWRec contains per-screen information required by the vgahw module.
*
* Note, the palette referred to by the paletteEnabled, enablePalette and
* disablePalette is the 16-entry (+overscan) EGA-compatible palette accessed
* via the first 17 attribute registers and not the main 8-bit palette.
*/
typedef struct _vgaHWRec {
void *Base; /* Address of "VGA" memory */
int MapSize; /* Size of "VGA" memory */
unsigned long MapPhys; /* phys location of VGA mem */
int IOBase; /* I/O Base address */
CARD8 *MMIOBase; /* Pointer to MMIO start */
int MMIOOffset; /* base + offset + vgareg
= mmioreg */
void *FontInfo1; /* save area for fonts in
plane 2 */
void *FontInfo2; /* save area for fonts in
plane 3 */
void *TextInfo; /* save area for text */
vgaRegRec SavedReg; /* saved registers */
vgaRegRec ModeReg; /* register settings for
current mode */
Bool ShowOverscan;
Bool paletteEnabled;
Bool cmapSaved;
ScrnInfoPtr pScrn;
vgaHWWriteIndexProcPtr writeCrtc;
vgaHWReadIndexProcPtr readCrtc;
vgaHWWriteIndexProcPtr writeGr;
vgaHWReadIndexProcPtr readGr;
vgaHWReadProcPtr readST00;
vgaHWReadProcPtr readST01;
vgaHWReadProcPtr readFCR;
vgaHWWriteProcPtr writeFCR;
vgaHWWriteIndexProcPtr writeAttr;
vgaHWReadIndexProcPtr readAttr;
vgaHWWriteIndexProcPtr writeSeq;
vgaHWReadIndexProcPtr readSeq;
vgaHWWriteProcPtr writeMiscOut;
vgaHWReadProcPtr readMiscOut;
vgaHWMiscProcPtr enablePalette;
vgaHWMiscProcPtr disablePalette;
vgaHWWriteProcPtr writeDacMask;
vgaHWReadProcPtr readDacMask;
vgaHWWriteProcPtr writeDacWriteAddr;
vgaHWWriteProcPtr writeDacReadAddr;
vgaHWWriteProcPtr writeDacData;
vgaHWReadProcPtr readDacData;
void *ddc;
struct pci_io_handle *io;
vgaHWReadProcPtr readEnable;
vgaHWWriteProcPtr writeEnable;
struct pci_device *dev;
} vgaHWRec;
/* Some macros that VGA drivers can use in their ChipProbe() function */
#define OVERSCAN 0x11 /* Index of OverScan register */
/* Flags that define how overscan correction should take place */
#define KGA_FIX_OVERSCAN 1 /* overcan correction required */
#define KGA_ENABLE_ON_ZERO 2 /* if possible enable display at beginning */
/* of next scanline/frame */
#define KGA_BE_TOT_DEC 4 /* always fix problem by setting blank end */
/* to total - 1 */
#define BIT_PLANE 3 /* Which plane we write to in mono mode */
#define BITS_PER_GUN 6
#define COLORMAP_SIZE 256
#define DACDelay(hw) \
do { \
(hw)->readST01((hw)); \
(hw)->readST01((hw)); \
} while (0)
/* Function Prototypes */
/* vgaHW.c */
extern _X_EXPORT void vgaHWSetStdFuncs(vgaHWPtr hwp);
extern _X_EXPORT void vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset);
extern _X_EXPORT void vgaHWProtect(ScrnInfoPtr pScrn, Bool on);
extern _X_EXPORT Bool vgaHWSaveScreen(ScreenPtr pScreen, int mode);
extern _X_EXPORT void vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on);
extern _X_EXPORT void vgaHWSeqReset(vgaHWPtr hwp, Bool start);
_X_EXPORT void vgaHWRestoreFonts(ScrnInfoPtr pScrnInfo, vgaRegPtr restore);
_X_EXPORT void vgaHWRestore(ScrnInfoPtr pScrnInfo, vgaRegPtr restore, int flags);
_X_EXPORT void vgaHWSaveFonts(ScrnInfoPtr pScrnInfo, vgaRegPtr save);
_X_EXPORT void vgaHWSave(ScrnInfoPtr pScrnInfo, vgaRegPtr save, int flags);
extern _X_EXPORT Bool vgaHWInit(ScrnInfoPtr scrnp, DisplayModePtr mode);
extern _X_EXPORT Bool vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src);
extern _X_EXPORT Bool vgaHWGetHWRec(ScrnInfoPtr scrp);
extern _X_EXPORT void vgaHWFreeHWRec(ScrnInfoPtr scrp);
extern _X_EXPORT Bool vgaHWMapMem(ScrnInfoPtr scrp);
extern _X_EXPORT void vgaHWUnmapMem(ScrnInfoPtr scrp);
extern _X_EXPORT void vgaHWGetIOBase(vgaHWPtr hwp);
extern _X_EXPORT void vgaHWLock(vgaHWPtr hwp);
extern _X_EXPORT void vgaHWUnlock(vgaHWPtr hwp);
extern _X_EXPORT void vgaHWEnable(vgaHWPtr hwp);
extern _X_EXPORT void vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode,
int flags);
extern _X_EXPORT Bool vgaHWHandleColormaps(ScreenPtr pScreen);
extern _X_EXPORT void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed);
extern _X_EXPORT CARD32 vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp,
int nBits, unsigned int Flags);
extern _X_EXPORT CARD32 vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp,
int nBits, unsigned int Flags);
extern _X_EXPORT Bool vgaHWAllocDefaultRegs(vgaRegPtr regp);
extern _X_EXPORT DDC1SetSpeedProc vgaHWddc1SetSpeedWeak(void);
extern _X_EXPORT void xf86GetClocks(ScrnInfoPtr pScrn, int num,
Bool (*ClockFunc) (ScrnInfoPtr, int),
void (*ProtectRegs) (ScrnInfoPtr, Bool),
void (*BlankScreen) (ScrnInfoPtr, Bool),
unsigned long vertsyncreg, int maskval,
int knownclkindex, int knownclkvalue);
#endif /* _VGAHW_H */
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2016, NVIDIA CORPORATION.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and/or associated documentation files (the
* "Materials"), to deal in the Materials without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Materials, and to
* permit persons to whom the Materials are furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* unaltered in all copies or substantial portions of the Materials.
* Any additions, deletions, or changes to the original source files
* must be clearly indicated in accompanying documentation.
*
* If only executable code is distributed, then the accompanying
* documentation must state that "this software is based in part on the
* work of the Khronos Group."
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
#ifndef VNDSERVER_H
#define VNDSERVER_H
#include <dix-config.h>
#include "glxvndabi.h"
#define GLXContextID CARD32
#define GLXDrawable CARD32
_X_EXPORT const GlxServerExports *glvndGetExports(void);
#endif // VNDSERVER_H
@@ -0,0 +1,125 @@
#ifndef XSERVER_WFBRENAME_H
#define XSERVER_WFBRENAME_H
#define fbAddTraps wfbAddTraps
#define fbAddTriangles wfbAddTriangles
#define fbAllocatePrivates wfbAllocatePrivates
#define fbArc16 wfbArc16
#define fbArc32 wfbArc32
#define fbArc8 wfbArc8
#define fbBlt wfbBlt
#define fbBltOne wfbBltOne
#define fbBltPlane wfbBltPlane
#define fbBltStip wfbBltStip
#define fbBres wfbBres
#define fbBresDash wfbBresDash
#define fbBresDash16 wfbBresDash16
#define fbBresDash32 wfbBresDash32
#define fbBresDash8 wfbBresDash8
#define fbBresFill wfbBresFill
#define fbBresFillDash wfbBresFillDash
#define fbBresSolid wfbBresSolid
#define fbBresSolid16 wfbBresSolid16
#define fbBresSolid32 wfbBresSolid32
#define fbBresSolid8 wfbBresSolid8
#define fbChangeWindowAttributes wfbChangeWindowAttributes
#define fbClearVisualTypes wfbClearVisualTypes
#define fbCloseScreen wfbCloseScreen
#define fbComposite wfbComposite
#define fbCopy1toN wfbCopy1toN
#define fbCopyArea wfbCopyArea
#define fbCopyNto1 wfbCopyNto1
#define fbCopyNtoN wfbCopyNtoN
#define fbCopyPlane wfbCopyPlane
#define fbCopyRegion wfbCopyRegion
#define fbCopyWindow wfbCopyWindow
#define fbCopyWindowProc wfbCopyWindowProc
#define fbCreateDefColormap wfbCreateDefColormap
#define fbCreateGC wfbCreateGC
#define fbCreatePixmap wfbCreatePixmap
#define fbCreateWindow wfbCreateWindow
#define fbDestroyGlyphCache wfbDestroyGlyphCache
#define fbDestroyPixmap wfbDestroyPixmap
#define fbDestroyWindow wfbDestroyWindow
#define fbDoCopy wfbDoCopy
#define fbDots wfbDots
#define fbDots16 wfbDots16
#define fbDots32 wfbDots32
#define fbDots8 wfbDots8
#define fbEvenTile wfbEvenTile
#define fbExpandDirectColors wfbExpandDirectColors
#define fbFill wfbFill
#define fbFillRegionSolid wfbFillRegionSolid
#define fbFillSpans wfbFillSpans
#define fbFixCoordModePrevious wfbFixCoordModePrevious
#define fbGCFuncs wfbGCFuncs
#define fbGCOps wfbGCOps
#define fbGetGCPrivateKey wfbGetGCPrivateKey
#define fbGetImage wfbGetImage
#define fbGetScreenPrivateKey wfbGetScreenPrivateKey
#define fbGetSpans wfbGetSpans
#define _fbGetWindowPixmap _wfbGetWindowPixmap
#define fbGlyph16 wfbGlyph16
#define fbGlyph32 wfbGlyph32
#define fbGlyph8 wfbGlyph8
#define fbImageGlyphBlt wfbImageGlyphBlt
#define fbIn wfbIn
#define fbInitializeColormap wfbInitializeColormap
#define fbInitVisuals wfbInitVisuals
#define fbListInstalledColormaps wfbListInstalledColormaps
#define FbMergeRopBits wFbMergeRopBits
#define fbOddTile wfbOddTile
#define fbOver wfbOver
#define fbOverlayFinishScreenInit wfbOverlayFinishScreenInit
#define fbOverlayGeneration wfbOverlayGeneration
#define fbOverlayGetScreenPrivateKey wfbOverlayGetScreenPrivateKey
#define fbPadPixmap wfbPadPixmap
#define fbPictureInit wfbPictureInit
#define fbPixmapToRegion wfbPixmapToRegion
#define fbPolyArc wfbPolyArc
#define fbPolyFillRect wfbPolyFillRect
#define fbPolyGlyphBlt wfbPolyGlyphBlt
#define fbPolyLine wfbPolyLine
#define fbPolyline16 wfbPolyline16
#define fbPolyline32 wfbPolyline32
#define fbPolyline8 wfbPolyline8
#define fbPolyPoint wfbPolyPoint
#define fbPolySegment wfbPolySegment
#define fbPolySegment16 wfbPolySegment16
#define fbPolySegment32 wfbPolySegment32
#define fbPolySegment8 wfbPolySegment8
#define fbPositionWindow wfbPositionWindow
#define fbPushFill wfbPushFill
#define fbPushImage wfbPushImage
#define fbPushPattern wfbPushPattern
#define fbPushPixels wfbPushPixels
#define fbPutImage wfbPutImage
#define fbPutXYImage wfbPutXYImage
#define fbPutZImage wfbPutZImage
#define fbQueryBestSize wfbQueryBestSize
#define fbRasterizeTrapezoid wfbRasterizeTrapezoid
#define fbRealizeFont wfbRealizeFont
#define fbReplicatePixel wfbReplicatePixel
#define fbResolveColor wfbResolveColor
#define fbScreenPrivateKeyRec wfbScreenPrivateKeyRec
#define fbSegment wfbSegment
#define fbSelectBres wfbSelectBres
#define fbSetSpans wfbSetSpans
#define fbSetupScreen wfbSetupScreen
#define fbSetVisualTypes wfbSetVisualTypes
#define fbSetVisualTypesAndMasks wfbSetVisualTypesAndMasks
#define _fbSetWindowPixmap _wfbSetWindowPixmap
#define fbSolid wfbSolid
#define fbSolidBoxClipped wfbSolidBoxClipped
#define fbTile wfbTile
#define fbTrapezoids wfbTrapezoids
#define fbTriangles wfbTriangles
#define fbUninstallColormap wfbUninstallColormap
#define fbUnrealizeWindow wfbUnrealizeWindow
#define fbUnrealizeFont wfbUnrealizeFont
#define fbValidateGC wfbValidateGC
#define fbWinPrivateKeyRec wfbWinPrivateKeyRec
#define free_pixman_pict wfb_free_pixman_pict
#define image_from_pict wfb_image_from_pict
#endif /* XSERVER_WFBRENAME_H */
+217
View File
@@ -0,0 +1,217 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef WINDOW_H
#define WINDOW_H
#include <X11/Xproto.h>
#include "xlibre_ptrtypes.h"
#include "misc.h"
#include "regionstr.h"
#include "screenint.h"
#define TOTALLY_OBSCURED 0
#define UNOBSCURED 1
#define OBSCURED 2
#define VisibilityNotViewable 3
/* return values for tree-walking callback procedures */
#define WT_STOPWALKING 0
#define WT_WALKCHILDREN 1
#define WT_DONTWALKCHILDREN 2
#define WT_NOMATCH 3
#define NullWindow ((WindowPtr) 0)
/* Forward declaration, we can't include input.h here */
struct _Cursor;
typedef struct _BackingStore *BackingStorePtr;
typedef struct _Property *PropertyPtr;
enum RootClipMode {
ROOT_CLIP_NONE = 0, /**< resize the root window to 0x0 */
ROOT_CLIP_FULL = 1, /**< resize the root window to fit screen */
ROOT_CLIP_INPUT_ONLY = 2, /**< as above, but no rendering to screen */
};
typedef int (*VisitWindowProcPtr) (WindowPtr pWin,
void *data);
extern _X_EXPORT int TraverseTree(WindowPtr pWin,
VisitWindowProcPtr func,
void *data);
extern _X_EXPORT int WalkTree(ScreenPtr pScreen,
VisitWindowProcPtr func,
void *data);
extern _X_EXPORT Bool CreateRootWindow(ScreenPtr /*pScreen */ );
extern _X_EXPORT void InitRootWindow(WindowPtr /*pWin */ );
typedef WindowPtr (*RealChildHeadProc) (WindowPtr pWin);
extern _X_EXPORT void RegisterRealChildHeadProc(RealChildHeadProc proc);
extern _X_EXPORT WindowPtr RealChildHead(WindowPtr /*pWin */ );
extern _X_EXPORT int DeleteWindow(void *pWin,
XID wid);
extern _X_EXPORT int DestroySubwindows(WindowPtr /*pWin */ ,
ClientPtr /*client */ );
/* Quartz support on Mac OS X uses the HIToolbox
framework whose ChangeWindowAttributes function conflicts here. */
#ifdef __APPLE__
#define ChangeWindowAttributes Darwin_X_ChangeWindowAttributes
#endif
extern _X_EXPORT int ChangeWindowAttributes(WindowPtr /*pWin */ ,
Mask /*vmask */ ,
XID * /*vlist */ ,
ClientPtr /*client */ );
extern _X_EXPORT int ChangeWindowDeviceCursor(WindowPtr /*pWin */ ,
DeviceIntPtr /*pDev */ ,
struct _Cursor * /*pCursor */ );
extern _X_EXPORT struct _Cursor *WindowGetDeviceCursor(WindowPtr /*pWin */ ,
DeviceIntPtr
/*pDev */ );
/* Quartz support on Mac OS X uses the HIToolbox
framework whose GetWindowAttributes function conflicts here. */
#ifdef __APPLE__
#define GetWindowAttributes(w,c,x) Darwin_X_GetWindowAttributes((w),(c),(x))
extern void Darwin_X_GetWindowAttributes(
#else
extern _X_EXPORT void GetWindowAttributes(
#endif
WindowPtr /*pWin */ ,
ClientPtr /*client */ ,
xGetWindowAttributesReply *
/* wa */ );
extern _X_EXPORT void GravityTranslate(int /*x */ ,
int /*y */ ,
int /*oldx */ ,
int /*oldy */ ,
int /*dw */ ,
int /*dh */ ,
unsigned /*gravity */ ,
int * /*destx */ ,
int * /*desty */ );
extern _X_EXPORT int ConfigureWindow(WindowPtr /*pWin */ ,
Mask /*mask */ ,
XID * /*vlist */ ,
ClientPtr /*client */ );
extern _X_EXPORT int CirculateWindow(WindowPtr /*pParent */ ,
int /*direction */ ,
ClientPtr /*client */ );
extern _X_EXPORT int ReparentWindow(WindowPtr /*pWin */ ,
WindowPtr /*pParent */ ,
int /*x */ ,
int /*y */ ,
ClientPtr /*client */ );
extern _X_EXPORT int MapWindow(WindowPtr /*pWin */ ,
ClientPtr /*client */ );
extern _X_EXPORT void MapSubwindows(WindowPtr /*pParent */ ,
ClientPtr /*client */ );
extern _X_EXPORT int UnmapWindow(WindowPtr /*pWin */ ,
Bool /*fromConfigure */ );
extern _X_EXPORT void UnmapSubwindows(WindowPtr /*pWin */ );
extern _X_EXPORT void HandleSaveSet(ClientPtr /*client */ );
extern _X_EXPORT Bool PointInWindowIsVisible(WindowPtr /*pWin */ ,
int /*x */ ,
int /*y */ );
extern _X_EXPORT RegionPtr NotClippedByChildren(WindowPtr /*pWin */ );
extern _X_EXPORT void SendVisibilityNotify(WindowPtr /*pWin */ );
extern _X_EXPORT int dixSaveScreens(ClientPtr client, int on, int mode);
extern _X_EXPORT int SaveScreens(int on, int mode);
extern _X_EXPORT WindowPtr FindWindowWithOptional(WindowPtr /*w */ );
extern _X_EXPORT void CheckWindowOptionalNeed(WindowPtr /*w */ );
extern _X_EXPORT WindowPtr MoveWindowInStack(WindowPtr /*pWin */ ,
WindowPtr /*pNextSib */ );
extern _X_EXPORT void SetWinSize(WindowPtr /*pWin */ );
extern _X_EXPORT void SetBorderSize(WindowPtr /*pWin */ );
extern _X_EXPORT void ResizeChildrenWinSize(WindowPtr /*pWin */ ,
int /*dx */ ,
int /*dy */ ,
int /*dw */ ,
int /*dh */ );
extern _X_EXPORT void SendShapeNotify(WindowPtr /* pWin */ ,
int /* which */);
extern _X_EXPORT RegionPtr CreateBoundingShape(WindowPtr /* pWin */ );
extern _X_EXPORT RegionPtr CreateClipShape(WindowPtr /* pWin */ );
extern _X_EXPORT void SetRootClip(ScreenPtr pScreen, int enable);
extern _X_EXPORT VisualPtr WindowGetVisual(WindowPtr /*pWin*/);
#endif /* WINDOW_H */
@@ -0,0 +1,175 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef WINDOWSTRUCT_H
#define WINDOWSTRUCT_H
#include "xlibre_ptrtypes.h"
#include "window.h"
#include "pixmapstr.h"
#include "regionstr.h"
#include "cursor.h"
#include "property.h"
#include "resource.h" /* for ROOT_WINDOW_ID_BASE */
#include "dix.h"
#include "privates.h"
#include "miscstruct.h"
#include <X11/Xprotostr.h>
#include "opaque.h"
/* used as NULL-terminated list */
typedef struct _DevCursorNode {
CursorPtr cursor;
DeviceIntPtr dev;
struct _DevCursorNode *next;
} DevCursNodeRec, *DevCursNodePtr, *DevCursorList;
typedef struct _WindowOpt {
CursorPtr cursor; /* default: window.cursorNone */
VisualID visual; /* default: same as parent */
Colormap colormap; /* default: same as parent */
Mask dontPropagateMask; /* default: window.dontPropagate */
Mask otherEventMasks; /* default: 0 */
struct _OtherClients *otherClients; /* default: NULL */
struct _GrabRec *passiveGrabs; /* default: NULL */
CARD32 backingBitPlanes; /* default: ~0L */
CARD32 backingPixel; /* default: 0 */
RegionPtr boundingShape; /* default: NULL */
RegionPtr clipShape; /* default: NULL */
RegionPtr inputShape; /* default: NULL */
struct _OtherInputMasks *inputMasks; /* default: NULL */
DevCursorList deviceCursors; /* default: NULL */
} WindowOptRec, *WindowOptPtr;
#define BackgroundPixel 2L
#define BackgroundPixmap 3L
/*
* The redirectDraw field can have one of three values:
*
* RedirectDrawNone
* A normal window; painted into the same pixmap as the parent
* and clipping parent and siblings to its geometry. These
* windows get a clip list equal to the intersection of their
* geometry with the parent geometry, minus the geometry
* of overlapping None and Clipped siblings.
* RedirectDrawAutomatic
* A redirected window which clips parent and sibling drawing.
* Contents for these windows are manage inside the server.
* These windows get an internal clip list equal to their
* geometry.
* RedirectDrawManual
* A redirected window which does not clip parent and sibling
* drawing; the window must be represented within the parent
* geometry by the client performing the redirection management.
* Contents for these windows are managed outside the server.
* These windows get an internal clip list equal to their
* geometry.
*/
#define RedirectDrawNone 0
#define RedirectDrawAutomatic 1
#define RedirectDrawManual 2
struct _Window {
DrawableRec drawable;
PrivateRec *devPrivates;
WindowPtr parent; /* ancestor chain */
WindowPtr nextSib; /* next lower sibling */
WindowPtr prevSib; /* next higher sibling */
WindowPtr firstChild; /* top-most child */
WindowPtr lastChild; /* bottom-most child */
RegionRec clipList; /* clipping rectangle for output */
RegionRec borderClip; /* NotClippedByChildren + border */
union _MiValidate *valdata;
RegionRec winSize;
RegionRec borderSize;
xPoint origin; /* position relative to parent */
unsigned short borderWidth;
unsigned short deliverableEvents; /* all masks from all clients */
Mask eventMask; /* mask from the creating client */
PixUnion background;
PixUnion border;
WindowOptPtr optional;
unsigned backgroundState:2; /* None, Relative, Pixel, Pixmap */
unsigned borderIsPixel:1;
unsigned cursorIsNone:1; /* else real cursor (might inherit) */
unsigned backingStore:2;
unsigned saveUnder:1;
unsigned bitGravity:4;
unsigned winGravity:4;
unsigned overrideRedirect:1;
unsigned visibility:2;
unsigned mapped:1;
unsigned realized:1; /* ancestors are all mapped */
unsigned viewable:1; /* realized && InputOutput */
unsigned dontPropagate:3; /* index into DontPropagateMasks */
unsigned redirectDraw:2; /* COMPOSITE rendering redirect */
unsigned forcedBG:1; /* must have an opaque background */
unsigned unhittable:1; /* doesn't hit-test, for rootless */
unsigned damagedDescendants:1; /* some descendants are damaged */
unsigned inhibitBGPaint:1; /* paint the background? */
PropertyPtr properties; /* default: NULL */
};
extern _X_EXPORT Mask DontPropagateMasks[];
#define wBorderWidth(w) ((int) (w)->borderWidth)
static inline PropertyPtr wUserProps(WindowPtr pWin) { return pWin->properties; }
/* true when w needs a border drawn. */
#define HasBorder(w) ((w)->borderWidth || wClipShape((w)))
#define SCREEN_IS_BLANKED 0
#define SCREEN_ISNT_SAVED 1
#define SCREEN_IS_TILED 2
#define SCREEN_IS_BLACK 3
#endif /* WINDOWSTRUCT_H */
+268
View File
@@ -0,0 +1,268 @@
#ifndef _XAAROP_H
#define _XAAROP_H
#define ROP_DST 0x00000001
#define ROP_SRC 0x00000002
#define ROP_PAT 0x00000004
#define ROP_0 0x00
#define ROP_DPSoon 0x01
#define ROP_DPSona 0x02
#define ROP_PSon 0x03
#define ROP_SDPona 0x04
#define ROP_DPon 0x05
#define ROP_PDSxnon 0x06
#define ROP_PDSaon 0x07
#define ROP_SDPnaa 0x08
#define ROP_PDSxon 0x09
#define ROP_DPna 0x0A
#define ROP_PSDnaon 0x0B
#define ROP_SPna 0x0C
#define ROP_PDSnaon 0x0D
#define ROP_PDSonon 0x0E
#define ROP_Pn 0x0F
#define ROP_PDSona 0x10
#define ROP_DSon 0x11
#define ROP_SDPxnon 0x12
#define ROP_SDPaon 0x13
#define ROP_DPSxnon 0x14
#define ROP_DPSaon 0x15
#define ROP_PSDPSanaxx 0x16
#define ROP_SSPxDSxaxn 0x17
#define ROP_SPxPDxa 0x18
#define ROP_SDPSanaxn 0x19
#define ROP_PDSPaox 0x1A
#define ROP_SDPSxaxn 0x1B
#define ROP_PSDPaox 0x1C
#define ROP_DSPDxaxn 0x1D
#define ROP_PDSox 0x1E
#define ROP_PDSoan 0x1F
#define ROP_DPSnaa 0x20
#define ROP_SDPxon 0x21
#define ROP_DSna 0x22
#define ROP_SPDnaon 0x23
#define ROP_SPxDSxa 0x24
#define ROP_PDSPanaxn 0x25
#define ROP_SDPSaox 0x26
#define ROP_SDPSxnox 0x27
#define ROP_DPSxa 0x28
#define ROP_PSDPSaoxxn 0x29
#define ROP_DPSana 0x2A
#define ROP_SSPxPDxaxn 0x2B
#define ROP_SPDSoax 0x2C
#define ROP_PSDnox 0x2D
#define ROP_PSDPxox 0x2E
#define ROP_PSDnoan 0x2F
#define ROP_PSna 0x30
#define ROP_SDPnaon 0x31
#define ROP_SDPSoox 0x32
#define ROP_Sn 0x33
#define ROP_SPDSaox 0x34
#define ROP_SPDSxnox 0x35
#define ROP_SDPox 0x36
#define ROP_SDPoan 0x37
#define ROP_PSDPoax 0x38
#define ROP_SPDnox 0x39
#define ROP_SPDSxox 0x3A
#define ROP_SPDnoan 0x3B
#define ROP_PSx 0x3C
#define ROP_SPDSonox 0x3D
#define ROP_SPDSnaox 0x3E
#define ROP_PSan 0x3F
#define ROP_PSDnaa 0x40
#define ROP_DPSxon 0x41
#define ROP_SDxPDxa 0x42
#define ROP_SPDSanaxn 0x43
#define ROP_SDna 0x44
#define ROP_DPSnaon 0x45
#define ROP_DSPDaox 0x46
#define ROP_PSDPxaxn 0x47
#define ROP_SDPxa 0x48
#define ROP_PDSPDaoxxn 0x49
#define ROP_DPSDoax 0x4A
#define ROP_PDSnox 0x4B
#define ROP_SDPana 0x4C
#define ROP_SSPxDSxoxn 0x4D
#define ROP_PDSPxox 0x4E
#define ROP_PDSnoan 0x4F
#define ROP_PDna 0x50
#define ROP_DSPnaon 0x51
#define ROP_DPSDaox 0x52
#define ROP_SPDSxaxn 0x53
#define ROP_DPSonon 0x54
#define ROP_Dn 0x55
#define ROP_DPSox 0x56
#define ROP_DPSoan 0x57
#define ROP_PDSPoax 0x58
#define ROP_DPSnox 0x59
#define ROP_DPx 0x5A
#define ROP_DPSDonox 0x5B
#define ROP_DPSDxox 0x5C
#define ROP_DPSnoan 0x5D
#define ROP_DPSDnaox 0x5E
#define ROP_DPan 0x5F
#define ROP_PDSxa 0x60
#define ROP_DSPDSaoxxn 0x61
#define ROP_DSPDoax 0x62
#define ROP_SDPnox 0x63
#define ROP_SDPSoax 0x64
#define ROP_DSPnox 0x65
#define ROP_DSx 0x66
#define ROP_SDPSonox 0x67
#define ROP_DSPDSonoxxn 0x68
#define ROP_PDSxxn 0x69
#define ROP_DPSax 0x6A
#define ROP_PSDPSoaxxn 0x6B
#define ROP_SDPax 0x6C
#define ROP_PDSPDoaxxn 0x6D
#define ROP_SDPSnoax 0x6E
#define ROP_PDSxnan 0x6F
#define ROP_PDSana 0x70
#define ROP_SSDxPDxaxn 0x71
#define ROP_SDPSxox 0x72
#define ROP_SDPnoan 0x73
#define ROP_DSPDxox 0x74
#define ROP_DSPnoan 0x75
#define ROP_SDPSnaox 0x76
#define ROP_DSan 0x77
#define ROP_PDSax 0x78
#define ROP_DSPDSoaxxn 0x79
#define ROP_DPSDnoax 0x7A
#define ROP_SDPxnan 0x7B
#define ROP_SPDSnoax 0x7C
#define ROP_DPSxnan 0x7D
#define ROP_SPxDSxo 0x7E
#define ROP_DPSaan 0x7F
#define ROP_DPSaa 0x80
#define ROP_SPxDSxon 0x81
#define ROP_DPSxna 0x82
#define ROP_SPDSnoaxn 0x83
#define ROP_SDPxna 0x84
#define ROP_PDSPnoaxn 0x85
#define ROP_DSPDSoaxx 0x86
#define ROP_PDSaxn 0x87
#define ROP_DSa 0x88
#define ROP_SDPSnaoxn 0x89
#define ROP_DSPnoa 0x8A
#define ROP_DSPDxoxn 0x8B
#define ROP_SDPnoa 0x8C
#define ROP_SDPSxoxn 0x8D
#define ROP_SSDxPDxax 0x8E
#define ROP_PDSanan 0x8F
#define ROP_PDSxna 0x90
#define ROP_SDPSnoaxn 0x91
#define ROP_DPSDPoaxx 0x92
#define ROP_SPDaxn 0x93
#define ROP_PSDPSoaxx 0x94
#define ROP_DPSaxn 0x95
#define ROP_DPSxx 0x96
#define ROP_PSDPSonoxx 0x97
#define ROP_SDPSonoxn 0x98
#define ROP_DSxn 0x99
#define ROP_DPSnax 0x9A
#define ROP_SDPSoaxn 0x9B
#define ROP_SPDnax 0x9C
#define ROP_DSPDoaxn 0x9D
#define ROP_DSPDSaoxx 0x9E
#define ROP_PDSxan 0x9F
#define ROP_DPa 0xA0
#define ROP_PDSPnaoxn 0xA1
#define ROP_DPSnoa 0xA2
#define ROP_DPSDxoxn 0xA3
#define ROP_PDSPonoxn 0xA4
#define ROP_PDxn 0xA5
#define ROP_DSPnax 0xA6
#define ROP_PDSPoaxn 0xA7
#define ROP_DPSoa 0xA8
#define ROP_DPSoxn 0xA9
#define ROP_D 0xAA
#define ROP_DPSono 0xAB
#define ROP_SPDSxax 0xAC
#define ROP_DPSDaoxn 0xAD
#define ROP_DSPnao 0xAE
#define ROP_DPno 0xAF
#define ROP_PDSnoa 0xB0
#define ROP_PDSPxoxn 0xB1
#define ROP_SSPxDSxox 0xB2
#define ROP_SDPanan 0xB3
#define ROP_PSDnax 0xB4
#define ROP_DPSDoaxn 0xB5
#define ROP_DPSDPaoxx 0xB6
#define ROP_SDPxan 0xB7
#define ROP_PSDPxax 0xB8
#define ROP_DSPDaoxn 0xB9
#define ROP_DPSnao 0xBA
#define ROP_DSno 0xBB
#define ROP_SPDSanax 0xBC
#define ROP_SDxPDxan 0xBD
#define ROP_DPSxo 0xBE
#define ROP_DPSano 0xBF
#define ROP_Psa 0xC0
#define ROP_SPDSnaoxn 0xC1
#define ROP_SPDSonoxn 0xC2
#define ROP_PSxn 0xC3
#define ROP_SPDnoa 0xC4
#define ROP_SPDSxoxn 0xC5
#define ROP_SDPnax 0xC6
#define ROP_PSDPoaxn 0xC7
#define ROP_SDPoa 0xC8
#define ROP_SPDoxn 0xC9
#define ROP_DPSDxax 0xCA
#define ROP_SPDSaoxn 0xCB
#define ROP_S 0xCC
#define ROP_SDPono 0xCD
#define ROP_SDPnao 0xCE
#define ROP_SPno 0xCF
#define ROP_PSDnoa 0xD0
#define ROP_PSDPxoxn 0xD1
#define ROP_PDSnax 0xD2
#define ROP_SPDSoaxn 0xD3
#define ROP_SSPxPDxax 0xD4
#define ROP_DPSanan 0xD5
#define ROP_PSDPSaoxx 0xD6
#define ROP_DPSxan 0xD7
#define ROP_PDSPxax 0xD8
#define ROP_SDPSaoxn 0xD9
#define ROP_DPSDanax 0xDA
#define ROP_SPxDSxan 0xDB
#define ROP_SPDnao 0xDC
#define ROP_SDno 0xDD
#define ROP_SDPxo 0xDE
#define ROP_SDPano 0xDF
#define ROP_PDSoa 0xE0
#define ROP_PDSoxn 0xE1
#define ROP_DSPDxax 0xE2
#define ROP_PSDPaoxn 0xE3
#define ROP_SDPSxax 0xE4
#define ROP_PDSPaoxn 0xE5
#define ROP_SDPSanax 0xE6
#define ROP_SPxPDxan 0xE7
#define ROP_SSPxDSxax 0xE8
#define ROP_DSPDSanaxxn 0xE9
#define ROP_DPSao 0xEA
#define ROP_DPSxno 0xEB
#define ROP_SDPao 0xEC
#define ROP_SDPxno 0xED
#define ROP_DSo 0xEE
#define ROP_SDPnoo 0xEF
#define ROP_P 0xF0
#define ROP_PDSono 0xF1
#define ROP_PDSnao 0xF2
#define ROP_PSno 0xF3
#define ROP_PSDnao 0xF4
#define ROP_PDno 0xF5
#define ROP_PDSxo 0xF6
#define ROP_PDSano 0xF7
#define ROP_PDSao 0xF8
#define ROP_PDSxno 0xF9
#define ROP_DPo 0xFA
#define ROP_DPSnoo 0xFB
#define ROP_PSo 0xFC
#define ROP_PSDnoo 0xFD
#define ROP_DPSoo 0xFE
#define ROP_1 0xFF
#define NO_SRC_ROP(rop) \
(((rop) == GXnoop) || ((rop) == GXset) || ((rop) == GXclear) || ((rop) == GXinvert))
#endif /* _XAAROP_H */
+284
View File
@@ -0,0 +1,284 @@
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains declarations for public XFree86 functions and variables,
* and definitions of public macros.
*
* "public" means available to video drivers.
*/
#ifndef _XF86_H
#define _XF86_H
#include "xlibre_ptrtypes.h"
#include "xf86str.h"
#include "xf86Opt.h"
#include <X11/Xfuncproto.h>
#include <stdarg.h>
#include <X11/extensions/randr.h>
/* General parameters */
extern _X_EXPORT Bool xorgHWAccess;
extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec;
#define xf86ScreenKey (&xf86ScreenKeyRec)
extern _X_EXPORT ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
extern _X_EXPORT const unsigned char byte_reversed[256];
#define XF86SCRNINFO(p) xf86ScreenToScrn((p))
/* Compatibility functions for pre-input-thread drivers */
static inline _X_DEPRECATED int xf86BlockSIGIO(void) { input_lock(); return 0; }
static inline _X_DEPRECATED void xf86UnblockSIGIO(_X_UNUSED int wasset) { input_unlock(); }
/* PCI related */
#ifdef XSERVER_LIBPCIACCESS
#include <pciaccess.h>
extern _X_EXPORT Bool xf86CheckPciSlot(const struct pci_device *);
extern _X_EXPORT int xf86ClaimPciSlot(struct pci_device *, DriverPtr drvp,
int chipset, GDevPtr dev, Bool active);
extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *, GDevPtr dev);
extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus,
int *device, int *func);
extern _X_EXPORT Bool xf86IsPrimaryPci(struct pci_device *pPci);
extern _X_EXPORT Bool xf86CheckPciMemBase(struct pci_device *pPci,
memType base);
extern _X_EXPORT struct pci_device *xf86GetPciInfoForEntity(int entityIndex);
extern _X_EXPORT int xf86MatchPciInstances(const char *driverName,
int vendorID, SymTabPtr chipsets,
PciChipsets * PCIchipsets,
GDevPtr * devList, int numDevs,
DriverPtr drvp, int **foundEntities);
extern _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn,
int scrnFlag, int entityIndex,
PciChipsets * p_chip,
void *dummy, EntityProc init,
EntityProc enter,
EntityProc leave,
void *private);
#endif
/* xf86Bus.c */
extern _X_EXPORT int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev,
Bool active);
extern _X_EXPORT int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev,
Bool active);
extern _X_EXPORT void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
extern _X_EXPORT void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn,
int entityIndex,
int instance);
extern _X_EXPORT int xf86GetNumEntityInstances(int entityIndex);
extern _X_EXPORT GDevPtr xf86GetDevFromEntity(int entityIndex, int instance);
extern _X_EXPORT EntityInfoPtr xf86GetEntityInfo(int entityIndex);
#define xf86SetLastScrnFlag(e, s) do { } while (0)
extern _X_EXPORT Bool xf86IsEntityShared(int entityIndex);
extern _X_EXPORT void xf86SetEntityShared(int entityIndex);
extern _X_EXPORT Bool xf86IsEntitySharable(int entityIndex);
extern _X_EXPORT void xf86SetEntitySharable(int entityIndex);
extern _X_EXPORT Bool xf86IsPrimInitDone(int entityIndex);
extern _X_EXPORT void xf86SetPrimInitDone(int entityIndex);
extern _X_EXPORT void xf86ClearPrimInitDone(int entityIndex);
extern _X_EXPORT int xf86AllocateEntityPrivateIndex(void);
extern _X_EXPORT DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex);
/* xf86Configure.c */
extern _X_EXPORT GDevPtr xf86AddBusDeviceToConfigure(const char *driver,
BusType bus, void *busData,
int chipset);
/* xf86Cursor.c */
extern _X_EXPORT void xf86SetViewport(ScreenPtr pScreen, int x, int y);
extern _X_EXPORT Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode);
extern _X_EXPORT void *xf86GetPointerScreenFuncs(void);
extern _X_EXPORT void xf86ReconfigureLayout(void);
/* xf86DPMS.c */
extern _X_EXPORT Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set,
int flags);
/* xf86DGA.c */
#ifdef XFreeXDGA
extern _X_EXPORT Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs,
DGAModePtr modes, int num);
extern _X_EXPORT Bool DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes,
int num);
extern _X_EXPORT xf86SetDGAModeProc xf86SetDGAMode;
#endif
/* xf86Events.c */
typedef struct _InputInfoRec *InputInfoPtr;
extern _X_EXPORT void SetTimeSinceLastInputEvent(void);
extern _X_EXPORT void *xf86AddGeneralHandler(int fd, InputHandlerProc proc,
void *data);
extern _X_EXPORT int xf86RemoveGeneralHandler(void *handler);
/* xf86Helper.c */
extern _X_EXPORT void xf86AddDriver(DriverPtr driver, void *module,
int flags);
extern _X_EXPORT ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags);
extern _X_EXPORT int xf86AllocateScrnInfoPrivateIndex(void);
extern _X_EXPORT Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp,
int fbbpp, int depth24flags);
extern _X_EXPORT void xf86PrintDepthBpp(ScrnInfoPtr scrp);
extern _X_EXPORT Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask);
extern _X_EXPORT Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual);
extern _X_EXPORT Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma);
extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen);
extern _X_EXPORT void xf86EnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable);
extern _X_EXPORT void
xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
const char *format, va_list args)
_X_ATTRIBUTE_PRINTF(4, 0);
extern _X_EXPORT void
xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
const char *format, ...)
_X_ATTRIBUTE_PRINTF(4, 5);
extern _X_EXPORT void
xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
_X_ATTRIBUTE_PRINTF(3, 4);
extern _X_EXPORT void
xf86ErrorFVerb(int verb, const char *format, ...)
_X_ATTRIBUTE_PRINTF(2, 3);
extern _X_EXPORT void
xf86ErrorF(const char *format, ...)
_X_ATTRIBUTE_PRINTF(1, 2);
extern _X_EXPORT const char *
xf86TokenToString(SymTabPtr table, int token);
extern _X_EXPORT int
xf86StringToToken(SymTabPtr table, const char *string);
extern _X_EXPORT void
xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
extern _X_EXPORT void
xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips);
extern _X_EXPORT int
xf86MatchDevice(const char *drivername, GDevPtr ** driversectlist);
extern _X_EXPORT const char *
xf86GetVisualName(int visual);
extern _X_EXPORT int
xf86GetVerbosity(void);
extern _X_EXPORT Gamma
xf86GetGamma(void);
extern _X_EXPORT Bool
xf86ServerIsExiting(void);
extern _X_EXPORT Bool
xf86ServerIsOnlyDetecting(void);
extern _X_EXPORT Bool
xf86GetAllowMouseOpenFail(void);
extern _X_EXPORT CARD32
xorgGetVersion(void);
extern _X_EXPORT CARD32
xf86GetModuleVersion(void *module);
extern _X_EXPORT void *
xf86LoadDrvSubModule(DriverPtr drv, const char *name);
extern _X_EXPORT void *
xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name);
extern _X_EXPORT void *
xf86LoadOneModule(const char *name, void *optlist);
extern _X_EXPORT void
xf86UnloadSubModule(void *mod);
extern _X_EXPORT Bool
xf86LoaderCheckSymbol(const char *name);
extern _X_EXPORT void
xf86SetBackingStore(ScreenPtr pScreen);
extern _X_EXPORT void
xf86SetSilkenMouse(ScreenPtr pScreen);
extern _X_EXPORT ScrnInfoPtr
xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
int entityIndex, EntityProc init,
EntityProc enter, EntityProc leave, void *private);
extern _X_EXPORT Bool
xf86IsUnblank(int mode);
/* xf86Init.c */
extern _X_EXPORT PixmapFormatPtr
xf86GetPixFormat(ScrnInfoPtr pScrn, int depth);
extern _X_EXPORT int
xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth);
/* xf86Mode.c */
extern _X_EXPORT ModeStatus
xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor);
extern _X_EXPORT int
xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
const char **modeNames, ClockRangePtr clockRanges,
int *linePitches, int minPitch, int maxPitch,
int minHeight, int maxHeight, int pitchInc,
int virtualX, int virtualY, int apertureSize,
LookupModeFlags strategy);
extern _X_EXPORT void
xf86DeleteMode(DisplayModePtr * modeList, DisplayModePtr mode);
extern _X_EXPORT void
xf86PruneDriverModes(ScrnInfoPtr scrp);
extern _X_EXPORT void
xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
extern _X_EXPORT void
xf86PrintModes(ScrnInfoPtr scrp);
/* xf86Option.c */
extern _X_EXPORT void
xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts);
/* convert ScreenPtr to ScrnInfoPtr */
extern _X_EXPORT ScrnInfoPtr xf86ScreenToScrn(ScreenPtr pScreen);
/* convert ScrnInfoPtr to ScreenPtr */
extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn);
#define XF86_HAS_SCRN_CONV 1 /* define for drivers to use in api compat */
#define XF86_SCRN_INTERFACE 1 /* define for drivers to use in api compat */
/* flags passed to xf86 allocate screen */
#define XF86_ALLOCATE_GPU_SCREEN 1
/* only for backwards (source) compatibility */
#define xf86MsgVerb LogMessageVerb
#define xf86Msg(type, ...) LogMessageVerb((type), 1, __VA_ARGS__)
/*
* retrieve file descriptor to opened console device.
* only for some legacy keyboard drivers (xf86-input-keyboard)
*/
_X_EXPORT int xf86GetConsoleFd(void);
#endif /* _XF86_H */
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,98 @@
#ifndef _XF86CURSOR_H
#define _XF86CURSOR_H
#include "xf86str.h"
#include "mipointer.h"
typedef struct _xf86CursorInfoRec {
ScrnInfoPtr pScrn;
int Flags;
int MaxWidth;
int MaxHeight;
void (*SetCursorColors) (ScrnInfoPtr pScrn, int bg, int fg);
void (*SetCursorPosition) (ScrnInfoPtr pScrn, int x, int y);
void (*LoadCursorImage) (ScrnInfoPtr pScrn, unsigned char *bits);
Bool (*LoadCursorImageCheck) (ScrnInfoPtr pScrn, unsigned char *bits);
void (*HideCursor) (ScrnInfoPtr pScrn);
void (*ShowCursor) (ScrnInfoPtr pScrn);
Bool (*ShowCursorCheck) (ScrnInfoPtr pScrn);
unsigned char *(*RealizeCursor) (struct _xf86CursorInfoRec *, CursorPtr);
Bool (*UseHWCursor) (ScreenPtr, CursorPtr);
Bool (*UseHWCursorARGB) (ScreenPtr, CursorPtr);
void (*LoadCursorARGB) (ScrnInfoPtr, CursorPtr);
Bool (*LoadCursorARGBCheck) (ScrnInfoPtr, CursorPtr);
} xf86CursorInfoRec, *xf86CursorInfoPtr;
static inline Bool
xf86DriverHasLoadCursorImage(xf86CursorInfoPtr infoPtr)
{
return infoPtr->LoadCursorImageCheck || infoPtr->LoadCursorImage;
}
static inline Bool
xf86DriverLoadCursorImage(xf86CursorInfoPtr infoPtr, unsigned char *bits)
{
if(infoPtr->LoadCursorImageCheck)
return infoPtr->LoadCursorImageCheck(infoPtr->pScrn, bits);
infoPtr->LoadCursorImage(infoPtr->pScrn, bits);
return TRUE;
}
static inline Bool
xf86DriverHasShowCursor(xf86CursorInfoPtr infoPtr)
{
return infoPtr->ShowCursorCheck || infoPtr->ShowCursor;
}
static inline Bool
xf86DriverShowCursor(xf86CursorInfoPtr infoPtr)
{
if(infoPtr->ShowCursorCheck)
return infoPtr->ShowCursorCheck(infoPtr->pScrn);
infoPtr->ShowCursor(infoPtr->pScrn);
return TRUE;
}
static inline Bool
xf86DriverHasLoadCursorARGB(xf86CursorInfoPtr infoPtr)
{
return infoPtr->LoadCursorARGBCheck || infoPtr->LoadCursorARGB;
}
static inline Bool
xf86DriverLoadCursorARGB(xf86CursorInfoPtr infoPtr, CursorPtr pCursor)
{
if(infoPtr->LoadCursorARGBCheck)
return infoPtr->LoadCursorARGBCheck(infoPtr->pScrn, pCursor);
infoPtr->LoadCursorARGB(infoPtr->pScrn, pCursor);
return TRUE;
}
extern _X_EXPORT Bool xf86InitCursor(ScreenPtr pScreen,
xf86CursorInfoPtr infoPtr);
extern _X_EXPORT xf86CursorInfoPtr xf86CreateCursorInfoRec(void);
extern _X_EXPORT void xf86DestroyCursorInfoRec(xf86CursorInfoPtr);
extern _X_EXPORT void xf86CursorResetCursor(ScreenPtr pScreen);
extern _X_EXPORT void xf86ForceHWCursor(ScreenPtr pScreen, Bool on);
extern _X_EXPORT CursorPtr xf86CurrentCursor(ScreenPtr pScreen);
#define HARDWARE_CURSOR_INVERT_MASK 0x00000001
#define HARDWARE_CURSOR_AND_SOURCE_WITH_MASK 0x00000002
#define HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK 0x00000004
#define HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED 0x00000008
#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 0x00000010
#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 0x00000020
#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 0x00000040
#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 0x00000080
#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 0x00000100
#define HARDWARE_CURSOR_TRUECOLOR_AT_8BPP 0x00000200
#define HARDWARE_CURSOR_BIT_ORDER_MSBFIRST 0x00000400
#define HARDWARE_CURSOR_NIBBLE_SWAPPED 0x00000800
#define HARDWARE_CURSOR_SHOW_TRANSPARENT 0x00001000
#define HARDWARE_CURSOR_UPDATE_UNHIDDEN 0x00002000
#define HARDWARE_CURSOR_ARGB 0x00004000
#endif /* _XF86CURSOR_H */
@@ -0,0 +1,66 @@
/* xf86DDC.h
*
* This file contains all information to interpret a standard EDIC block
* transmitted by a display device via DDC (Display Data Channel). So far
* there is no information to deal with optional EDID blocks.
* DDC is a Trademark of VESA (Video Electronics Standard Association).
*
* Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
*/
#ifndef XF86_DDC_H
#define XF86_DDC_H
#include "edid.h"
#include "xf86i2c.h"
#include "xf86str.h"
/* speed up / slow down */
typedef enum {
DDC_SLOW,
DDC_FAST
} xf86ddcSpeed;
typedef void (*DDC1SetSpeedProc) (ScrnInfoPtr, xf86ddcSpeed);
extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC1(ScrnInfoPtr pScrn,
DDC1SetSpeedProc DDC1SetSpeed,
unsigned
int (*DDC1Read) (ScrnInfoPtr)
);
extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus);
extern _X_EXPORT xf86MonPtr xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool);
extern _X_EXPORT xf86MonPtr xf86PrintEDID(xf86MonPtr monPtr);
extern _X_EXPORT xf86MonPtr xf86InterpretEDID(int screenIndex, uint8_t * block);
extern _X_EXPORT xf86MonPtr xf86InterpretEEDID(int screenIndex, uint8_t * block);
extern _X_EXPORT Bool xf86SetDDCproperties(ScrnInfoPtr pScreen, xf86MonPtr DDC);
/**
* @brief xf86DoInterpretHDRMetadata fill hdr structure using raw edid data
* This function is necessary because xf86InterpretEDID have no indication if this whole EDID or not
* @param monPtr
* @return true if colorimetry & hdr static metadata is found
*/
_X_EXPORT bool xf86DoInterpretHDRMetadata(xf86MonPtr monPtr);
/*
* parse EDID block and return a newly allocated xf86Monitor
*
* the data block will be copied into the structure (actually right after the struct)
* and thus automatically be freed when the returned struct is freed.
*
* @param screenIndex index of the screen, will be recorded in the xf86Monitor
* @param block the EDID block to parse
* @param size size of the EDID block (128 or larger for extended types)
* @return newly allocated xf86MonRec or NULL on failure
*/
_X_EXPORT xf86MonPtr xf86ParseEDID(ScrnInfoPtr pScreen, uint8_t *block, size_t size);
#endif
@@ -0,0 +1,117 @@
/*
* Copyright © 2006 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Authors:
* Eric Anholt <eric@anholt.net>
*
*/
#ifndef _XF86MODES_H_
#define _XF86MODES_H_
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include "xf86.h"
#include "xorgVersion.h"
#include "edid.h"
#include "xf86Parser.h"
extern _X_EXPORT double xf86ModeHSync(const DisplayModeRec * mode);
extern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec * mode);
extern _X_EXPORT unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth);
extern _X_EXPORT int
xf86ModeWidth(const DisplayModeRec * mode, Rotation rotation);
extern _X_EXPORT int
xf86ModeHeight(const DisplayModeRec * mode, Rotation rotation);
extern _X_EXPORT DisplayModePtr xf86DuplicateMode(const DisplayModeRec * pMode);
extern _X_EXPORT DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn,
DisplayModePtr modeList);
extern _X_EXPORT void xf86SetModeDefaultName(DisplayModePtr mode);
extern _X_EXPORT void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
extern _X_EXPORT Bool xf86ModesEqual(const DisplayModeRec * pMode1,
const DisplayModeRec * pMode2);
extern _X_EXPORT void xf86PrintModeline(int scrnIndex, DisplayModePtr mode);
extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes,
DisplayModePtr new);
extern _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay,
float VRefresh, Bool Reduced,
Bool Interlaced);
extern _X_EXPORT DisplayModePtr xf86GTFMode(int h_pixels, int v_lines,
float freq, int interlaced,
int margins);
extern _X_EXPORT Bool
xf86ModeIsReduced(const DisplayModeRec * mode);
extern _X_EXPORT void
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, int flags);
extern _X_EXPORT void
xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int *min, int *max, int n_ranges);
extern _X_EXPORT void
xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int maxX, int maxY, int maxPitch);
extern _X_EXPORT void
xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, MonPtr mon);
extern _X_EXPORT void
xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
unsigned int bandwidth, int depth);
extern _X_EXPORT void
xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList);
extern _X_EXPORT void
xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr * modeList,
Bool verbose);
extern _X_EXPORT DisplayModePtr xf86PruneDuplicateModes(DisplayModePtr modes);
extern _X_EXPORT void
xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
extern _X_EXPORT DisplayModePtr
xf86GetMonitorModes(ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
extern _X_EXPORT DisplayModePtr xf86GetDefaultModes(void);
extern _X_EXPORT void
xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec *mode);
extern _X_EXPORT void
xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC);
#endif /* _XF86MODES_H_ */
@@ -0,0 +1,240 @@
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains the parts of the loader interface that are visible
* to modules. This is the only loader-related header that modules should
* include.
*
* It should include a bare minimum of other headers.
*
* Longer term, the module/loader code should probably live directly under
* Xserver/.
*
* XXX This file arguably belongs in xfree86/loader/.
*/
#ifndef _XF86MODULE_H
#define _XF86MODULE_H
#include <X11/Xfuncproto.h>
#include <X11/Xdefs.h>
#include <X11/Xmd.h>
#ifndef NULL
#define NULL ((void *)0)
#endif
#define DEFAULT_LIST ((char *)-1)
/* Built-in ABI classes. These definitions must not be changed. */
#define ABI_CLASS_NONE NULL
#define ABI_CLASS_ANSIC "X.Org ANSI C Emulation"
#define ABI_CLASS_VIDEODRV "X.Org Video Driver"
#define ABI_CLASS_XINPUT "X.Org XInput driver"
#define ABI_CLASS_EXTENSION "X.Org Server Extension"
#define ABI_MINOR_MASK 0x0000FFFF
#define ABI_MAJOR_MASK 0xFFFF0000
#define GET_ABI_MINOR(v) ((v) & ABI_MINOR_MASK)
#define GET_ABI_MAJOR(v) (((v) & ABI_MAJOR_MASK) >> 16)
#define SET_ABI_VERSION(maj, min) \
((((maj) << 16) & ABI_MAJOR_MASK) | ((min) & ABI_MINOR_MASK))
/*
* ABI versions. Each version has a major and minor revision. Modules
* using lower minor revisions must work with servers of a higher minor
* revision. There is no compatibility between different major revisions.
* Whenever the ABI_ANSIC_VERSION is changed, the others must also be
* changed. The minor revision mask is 0x0000FFFF and the major revision
* mask is 0xFFFF0000.
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(1, 4)
/* XXX This is a compile-time option that changes abi XXX */
/* TODO: Remove this toggle in 26.0 */
#ifdef CONFIG_LEGACY_NVIDIA_PADDING
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(28, 1)
#else
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(28, 0)
#endif
#define ABI_XINPUT_VERSION SET_ABI_VERSION(26, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(11, 0)
/* hack to get both modern and ancient nvidia DDX drivers to work at the same time */
#define ABI_NVIDIA_VERSION SET_ABI_VERSION(25, 2)
#define MODINFOSTRING1 0xef23fdc5
#define MODINFOSTRING2 0x10dc023a
#ifndef MODULEVENDORSTRING
#define MODULEVENDORSTRING "X.Org Foundation"
#endif
/* Error return codes for errmaj */
typedef enum {
LDR_NOERROR = 0,
LDR_NOMEM, /* memory allocation failed */
LDR_NOENT, /* Module file does not exist */
LDR_NOLOAD, /* type specific loader failed */
LDR_ONCEONLY, /* Module should only be loaded once (not an error) */
LDR_MISMATCH, /* the module didn't match the spec'd requirements */
LDR_BADUSAGE, /* LoadModule is called with bad arguments */
LDR_INVALID, /* The module doesn't have a valid ModuleData object */
LDR_BADOS, /* The module doesn't support the OS */
LDR_MODSPECIFIC /* A module-specific error in the SetupProc */
} LoaderErrorCode;
/*
* Some common module classes. The moduleclass can be used to identify
* that modules loaded are of the correct type. This is a finer
* classification than the ABI classes even though the default set of
* classes have the same names. For example, not all modules that require
* the video driver ABI are themselves video drivers.
*/
#define MOD_CLASS_NONE NULL
#define MOD_CLASS_VIDEODRV "X.Org Video Driver"
#define MOD_CLASS_XINPUT "X.Org XInput Driver"
#define MOD_CLASS_EXTENSION "X.Org Server Extension"
/* This structure is expected to be returned by the initfunc */
typedef struct {
const char *modname; /* name of module, e.g. "foo" */
const char *vendor; /* vendor specific string */
CARD32 _modinfo1_; /* constant MODINFOSTRING1/2 to find */
CARD32 _modinfo2_; /* infoarea with a binary editor or sign tool */
CARD32 xf86version; /* contains XF86_VERSION_CURRENT */
CARD8 majorversion; /* module-specific major version */
CARD8 minorversion; /* module-specific minor version */
CARD16 patchlevel; /* module-specific patch level */
const char *abiclass; /* ABI class that the module uses */
CARD32 abiversion; /* ABI version */
const char *moduleclass; /* module class description */
CARD32 checksum[4]; /* contains a digital signature of the */
/* version info structure */
} XF86ModuleVersionInfo;
/*
* This structure can be used to callers of LoadModule and LoadSubModule to
* specify version and/or ABI requirements.
*/
typedef struct {
CARD8 majorversion; /* module-specific major version */
CARD8 minorversion; /* module-specific minor version */
CARD16 patchlevel; /* module-specific patch level */
const char *abiclass; /* ABI class that the module uses */
CARD32 abiversion; /* ABI version */
const char *moduleclass; /* module class */
} XF86ModReqInfo;
#define MODULE_VERSION_NUMERIC(maj, min, patch) \
((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | ((patch) & 0xFFFF))
/* Prototypes for Loader functions that are exported to modules */
extern _X_EXPORT void *LoadSubModule(void *, const char *, const char **,
const char **, void *,
const XF86ModReqInfo *, int *, int *);
extern _X_EXPORT void *LoaderSymbol(const char *);
extern _X_EXPORT void *LoaderSymbolFromModule(void *, const char *);
extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int);
/* deprecated, only kept for backwards compat w/ proprietary NVidia driver */
extern _X_EXPORT Bool LoaderShouldIgnoreABI(void) _X_DEPRECATED;
extern _X_EXPORT int LoaderGetABIVersion(const char *abiclass) _X_DEPRECATED;
typedef void *(*ModuleSetupProc) (void *, void *, int *, int *);
typedef void (*ModuleTearDownProc) (void *);
#define MODULESETUPPROTO(func) void *(func)(void *, void *, int*, int*)
/*
* Module information header. Every loadable module needs to export a symbol
* of that type, so the loader can call into the module for initialization.
* The symbol must be named <modulename> + "ModuleData".
*/
typedef struct {
/* must point to structure with version information */
XF86ModuleVersionInfo *vers;
/* called on module load (if not null) */
ModuleSetupProc setup;
/* called on module teardown with setup()'s result as parameter (if not null) */
ModuleTearDownProc teardown;
} XF86ModuleData;
/*
* declare module version info structure for an input driver module
*/
#define XF86_MODULE_VERSION_INPUT(_name, _major, _minor, _patchlevel) \
static XF86ModuleVersionInfo modVersion = { \
.modname = (_name), \
.vendor = MODULEVENDORSTRING, \
._modinfo1_ = MODINFOSTRING1, \
._modinfo2_ = MODINFOSTRING2, \
.xf86version = XORG_VERSION_CURRENT, \
.majorversion = (_major), \
.minorversion = (_minor), \
.patchlevel = (_patchlevel), \
.abiclass = ABI_CLASS_XINPUT, \
.abiversion = ABI_XINPUT_VERSION, \
.moduleclass = MOD_CLASS_XINPUT, \
};
/*
* declare module version info structure for an video driver module
*/
#define XF86_MODULE_VERSION_VIDEO(_name, _major, _minor, _patchlevel) \
static XF86ModuleVersionInfo modVersion = { \
.modname = (_name), \
.vendor = MODULEVENDORSTRING, \
._modinfo1_ = MODINFOSTRING1, \
._modinfo2_ = MODINFOSTRING2, \
.xf86version = XORG_VERSION_CURRENT, \
.majorversion = (_major), \
.minorversion = (_minor), \
.patchlevel = (_patchlevel), \
.abiclass = ABI_CLASS_VIDEODRV, \
.abiversion = ABI_VIDEODRV_VERSION, \
.moduleclass = MOD_CLASS_VIDEODRV, \
};
#define XF86_MODULE_DATA_INPUT(_modname, _setup, _teardown, _name, _major, _minor, _patchlevel) \
XF86_MODULE_VERSION_INPUT(_name, _major, _minor, _patchlevel) \
_X_EXPORT XF86ModuleData _modname##ModuleData = { \
.vers = &modVersion, \
.setup = _setup, \
.teardown = _teardown, \
};
#define XF86_MODULE_DATA_VIDEO(_modname, _setup, _teardown, _name, _major, _minor, _patchlevel) \
XF86_MODULE_VERSION_VIDEO(_name, _major, _minor, _patchlevel) \
_X_EXPORT XF86ModuleData _modname##ModuleData = { \
.vers = &modVersion, \
.setup = _setup, \
.teardown = _teardown, \
};
#endif /* _XF86MODULE_H */
+145
View File
@@ -0,0 +1,145 @@
/*
* Copyright (c) 1998-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/* Option handling things that ModuleSetup procs can use */
#ifndef _XF86_OPT_H_
#define _XF86_OPT_H_
#include <X11/Xdefs.h>
#include <X11/Xfuncproto.h>
#include "xf86Optionstr.h"
typedef struct {
double freq;
int units;
} OptFrequency;
typedef union {
unsigned long num;
const char *str;
double realnum;
Bool boolean;
OptFrequency freq;
} ValueUnion;
typedef enum {
OPTV_NONE = 0,
OPTV_INTEGER,
OPTV_STRING, /* a non-empty string */
OPTV_ANYSTR, /* Any string, including an empty one */
OPTV_REAL,
OPTV_BOOLEAN,
OPTV_PERCENT,
OPTV_FREQ
} OptionValueType;
typedef enum {
OPTUNITS_HZ = 1,
OPTUNITS_KHZ,
OPTUNITS_MHZ
} OptFreqUnits;
typedef struct {
int token;
const char *name;
OptionValueType type;
ValueUnion value;
Bool found;
} OptionInfoRec, *OptionInfoPtr;
extern _X_EXPORT int xf86SetIntOption(XF86OptionPtr optlist, const char *name,
int deflt);
extern _X_EXPORT double xf86SetRealOption(XF86OptionPtr optlist,
const char *name, double deflt);
extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name,
const char *deflt);
extern _X_EXPORT int xf86SetBoolOption(XF86OptionPtr list, const char *name,
int deflt);
extern _X_EXPORT double xf86SetPercentOption(XF86OptionPtr list,
const char *name, double deflt);
extern _X_EXPORT int xf86CheckIntOption(XF86OptionPtr optlist, const char *name,
int deflt);
extern _X_EXPORT char *xf86CheckStrOption(XF86OptionPtr optlist,
const char *name, const char *deflt);
extern _X_EXPORT int xf86CheckBoolOption(XF86OptionPtr list, const char *name,
int deflt);
extern _X_EXPORT double xf86CheckPercentOption(XF86OptionPtr list,
const char *name, double deflt);
extern _X_EXPORT XF86OptionPtr xf86AddNewOption(XF86OptionPtr head,
const char *name,
const char *val);
extern _X_EXPORT XF86OptionPtr xf86NextOption(XF86OptionPtr list);
extern _X_EXPORT XF86OptionPtr xf86OptionListCreate(const char **options,
int count, int used);
extern _X_EXPORT XF86OptionPtr xf86OptionListMerge(XF86OptionPtr head,
XF86OptionPtr tail);
extern _X_EXPORT XF86OptionPtr xf86OptionListDuplicate(XF86OptionPtr list);
extern _X_EXPORT void xf86OptionListFree(XF86OptionPtr opt);
extern _X_EXPORT char *xf86OptionName(XF86OptionPtr opt);
extern _X_EXPORT char *xf86OptionValue(XF86OptionPtr opt);
extern _X_EXPORT XF86OptionPtr xf86FindOption(XF86OptionPtr options,
const char *name);
extern _X_EXPORT const char *xf86FindOptionValue(XF86OptionPtr options,
const char *name);
extern _X_EXPORT void xf86MarkOptionUsedByName(XF86OptionPtr options,
const char *name);
extern _X_EXPORT void xf86ShowUnusedOptions(int scrnIndex,
XF86OptionPtr options);
extern _X_EXPORT void xf86ProcessOptions(int scrnIndex, XF86OptionPtr options,
OptionInfoPtr optinfo);
extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec * table,
int token);
extern _X_EXPORT const char *xf86TokenToOptName(const OptionInfoRec * table,
int token);
extern _X_EXPORT Bool xf86IsOptionSet(const OptionInfoRec * table, int token);
extern _X_EXPORT const char *xf86GetOptValString(const OptionInfoRec * table,
int token);
extern _X_EXPORT Bool xf86GetOptValInteger(const OptionInfoRec * table,
int token, int *value);
extern _X_EXPORT Bool xf86GetOptValULong(const OptionInfoRec * table, int token,
unsigned long *value);
extern _X_EXPORT Bool xf86GetOptValFreq(const OptionInfoRec * table, int token,
OptFreqUnits expectedUnits,
double *value);
extern _X_EXPORT Bool xf86GetOptValBool(const OptionInfoRec * table, int token,
Bool *value);
extern _X_EXPORT Bool xf86ReturnOptValBool(const OptionInfoRec * table,
int token, Bool def);
extern _X_EXPORT int xf86NameCmp(const char *s1, const char *s2);
extern _X_EXPORT char *xf86NormalizeName(const char *s);
extern _X_EXPORT XF86OptionPtr xf86ReplaceIntOption(XF86OptionPtr optlist,
const char *name,
const int val);
extern _X_EXPORT XF86OptionPtr xf86ReplaceBoolOption(XF86OptionPtr optlist,
const char *name,
const Bool val);
extern _X_EXPORT XF86OptionPtr xf86ReplaceStrOption(XF86OptionPtr optlist,
const char *name,
const char *val);
#endif

Some files were not shown because too many files have changed in this diff Show More