diff options
-rw-r--r-- | xc/lib/Xmuu/Xmuu-def.cpp | 20 | ||||
-rw-r--r-- | xc/programs/Xserver/Xext/xvmcext.h | 109 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/darwin/bundle/quartzCursor.h | 15 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/darwin/darwinClut8.h | 1 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/vfb/windef.h | 227 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/vfb/windows.h | 152 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h | 198 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h | 14 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c | 247 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.h | 8 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c | 582 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/xwin/winkeybd.c | 465 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/xwin/winmouse.c | 78 |
13 files changed, 2116 insertions, 0 deletions
diff --git a/xc/lib/Xmuu/Xmuu-def.cpp b/xc/lib/Xmuu/Xmuu-def.cpp new file mode 100644 index 000000000..607e5402f --- /dev/null +++ b/xc/lib/Xmuu/Xmuu-def.cpp @@ -0,0 +1,20 @@ +LIBRARY libXmuu +VERSION LIBRARY_VERSION +EXPORTS + + XmuClientWindow + XmuCursorNameToIndex + XmuPrintDefaultErrorMessage + XmuSimpleErrorHandler + XmuGetHostname + XmuCompareISOLatin1 + XmuCopyISOLatin1Lowered + XmuCopyISOLatin1Uppered + XmuNCopyISOLatin1Lowered + XmuNCopyISOLatin1Uppered + XmuSnprintf + _cygwin_dll_entry@12 + _cygwin_noncygwin_dll_entry@12 + dll_main@12 + +/* $XFree86: xc/lib/Xmuu/Xmuu-def.cpp,v 1.1 2001/04/18 17:14:00 dawes Exp $ */ diff --git a/xc/programs/Xserver/Xext/xvmcext.h b/xc/programs/Xserver/Xext/xvmcext.h new file mode 100644 index 000000000..b18a75511 --- /dev/null +++ b/xc/programs/Xserver/Xext/xvmcext.h @@ -0,0 +1,109 @@ +/* $XFree86: xc/programs/Xserver/Xext/xvmcext.h,v 1.1 2001/04/07 11:04:21 alanh Exp $ */ + +#ifndef _XVMC_H +#define _XVMC_H +#include "Xv.h" +#include "xvdix.h" + +typedef struct { + int num_xvimages; + int *xvimage_ids; +} XvMCImageIDList; + +typedef struct { + int surface_type_id; + int chroma_format; + int color_description; + unsigned short max_width; + unsigned short max_height; + unsigned short subpicture_max_width; + unsigned short subpicture_max_height; + int mc_type; + int flags; + XvMCImageIDList *compatible_subpictures; +} XvMCSurfaceInfoRec, *XvMCSurfaceInfoPtr; + +typedef struct { + XID context_id; + ScreenPtr pScreen; + int adapt_num; + int surface_type_id; + unsigned short width; + unsigned short height; + CARD32 flags; + int refcnt; + pointer port_priv; + pointer driver_priv; +} XvMCContextRec, *XvMCContextPtr; + +typedef struct { + XID surface_id; + int surface_type_id; + XvMCContextPtr context; + pointer driver_priv; +} XvMCSurfaceRec, *XvMCSurfacePtr; + + +typedef struct { + XID subpicture_id; + int xvimage_id; + unsigned short width; + unsigned short height; + int num_palette_entries; + int entry_bytes; + char component_order[4]; + XvMCContextPtr context; + pointer driver_priv; +} XvMCSubpictureRec, *XvMCSubpicturePtr; + +typedef int (*XvMCCreateContextProcPtr) ( + XvPortPtr port, + XvMCContextPtr context, + int *num_priv, + CARD32 **priv +); + +typedef void (*XvMCDestroyContextProcPtr) ( + XvMCContextPtr context +); + +typedef int (*XvMCCreateSurfaceProcPtr) ( + XvMCSurfacePtr surface, + int *num_priv, + CARD32 **priv +); + +typedef void (*XvMCDestroySurfaceProcPtr) ( + XvMCSurfacePtr surface +); + +typedef int (*XvMCCreateSubpictureProcPtr) ( + XvMCSubpicturePtr subpicture, + int *num_priv, + CARD32 **priv +); + +typedef void (*XvMCDestroySubpictureProcPtr) ( + XvMCSubpicturePtr subpicture +); + + +typedef struct { + XvAdaptorPtr xv_adaptor; + int num_surfaces; + XvMCSurfaceInfoPtr *surfaces; + int num_subpictures; + XvImagePtr *subpictures; + XvMCCreateContextProcPtr CreateContext; + XvMCDestroyContextProcPtr DestroyContext; + XvMCCreateSurfaceProcPtr CreateSurface; + XvMCDestroySurfaceProcPtr DestroySurface; + XvMCCreateSubpictureProcPtr CreateSubpicture; + XvMCDestroySubpictureProcPtr DestroySubpicture; +} XvMCAdaptorRec, *XvMCAdaptorPtr; + +void XvMCExtensionInit(void); + +int XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr adapt); + +#endif /* _XVMC_H */ diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.h b/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.h new file mode 100644 index 000000000..997e26176 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.h @@ -0,0 +1,15 @@ +/* + * quartzCursor.h + * + * Quartz hardware cursor + */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzCursor.h,v 1.1 2001/04/11 08:34:18 torrey Exp $ */ + +#ifndef QUARTZCURSOR_H +#define QUARTZCURSOR_H + +Bool QuartzInitCursor(ScreenPtr pScreen); +void QuartzSuspendXCursor(ScreenPtr pScreen); +void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y); + +#endif diff --git a/xc/programs/Xserver/hw/darwin/darwinClut8.h b/xc/programs/Xserver/hw/darwin/darwinClut8.h new file mode 100644 index 000000000..5ee8fa73e --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/darwinClut8.h @@ -0,0 +1 @@ +/*
* Darwin default 8-bit Colormap for StaticColor
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/darwinClut8.h,v 1.1 2001/04/12 20:09:53 torrey Exp $ */
#ifndef _DARWIN_CLUT8_
#define _DARWIN_CLUT8_
static xColorItem darwinClut8[] = {
{ 0, 0x0000, 0x0000, 0x0000, 0, 0 },
{ 1, 0xffff, 0xffff, 0xcccc, 0, 0 },
{ 2, 0xffff, 0xffff, 0x9999, 0, 0 },
{ 3, 0xffff, 0xffff, 0x6666, 0, 0 },
{ 4, 0xffff, 0xffff, 0x3333, 0, 0 },
{ 5, 0xffff, 0xffff, 0x0000, 0, 0 },
{ 6, 0xffff, 0xcccc, 0xffff, 0, 0 },
{ 7, 0xffff, 0xcccc, 0xcccc, 0, 0 },
{ 8, 0xffff, 0xcccc, 0x9999, 0, 0 },
{ 9, 0xffff, 0xcccc, 0x6666, 0, 0 },
{ 10, 0xffff, 0xcccc, 0x3333, 0, 0 },
{ 11, 0xffff, 0xcccc, 0x0000, 0, 0 },
{ 12, 0xffff, 0x9999, 0xffff, 0, 0 },
{ 13, 0xffff, 0x9999, 0xcccc, 0, 0 },
{ 14, 0xffff, 0x9999, 0x9999, 0, 0 },
{ 15, 0xffff, 0x9999, 0x6666, 0, 0 },
{ 16, 0xffff, 0x9999, 0x3333, 0, 0 },
{ 17, 0xffff, 0x9999, 0x0000, 0, 0 },
{ 18, 0xffff, 0x6666, 0xffff, 0, 0 },
{ 19, 0xffff, 0x6666, 0xcccc, 0, 0 },
{ 20, 0xffff, 0x6666, 0x9999, 0, 0 },
{ 21, 0xffff, 0x6666, 0x6666, 0, 0 },
{ 22, 0xffff, 0x6666, 0x3333, 0, 0 },
{ 23, 0xffff, 0x6666, 0x0000, 0, 0 },
{ 24, 0xffff, 0x3333, 0xffff, 0, 0 },
{ 25, 0xffff, 0x3333, 0xcccc, 0, 0 },
{ 26, 0xffff, 0x3333, 0x9999, 0, 0 },
{ 27, 0xffff, 0x3333, 0x6666, 0, 0 },
{ 28, 0xffff, 0x3333, 0x3333, 0, 0 },
{ 29, 0xffff, 0x3333, 0x0000, 0, 0 },
{ 30, 0xffff, 0x0000, 0xffff, 0, 0 },
{ 31, 0xffff, 0x0000, 0xcccc, 0, 0 },
{ 32, 0xffff, 0x0000, 0x9999, 0, 0 },
{ 33, 0xffff, 0x0000, 0x6666, 0, 0 },
{ 34, 0xffff, 0x0000, 0x3333, 0, 0 },
{ 35, 0xffff, 0x0000, 0x0000, 0, 0 },
{ 36, 0xcccc, 0xffff, 0xffff, 0, 0 },
{ 37, 0xcccc, 0xffff, 0xcccc, 0, 0 },
{ 38, 0xcccc, 0xffff, 0x9999, 0, 0 },
{ 39, 0xcccc, 0xffff, 0x6666, 0, 0 },
{ 40, 0xcccc, 0xffff, 0x3333, 0, 0 },
{ 41, 0xcccc, 0xffff, 0x0000, 0, 0 },
{ 42, 0xcccc, 0xcccc, 0xffff, 0, 0 },
{ 43, 0xcccc, 0xcccc, 0xcccc, 0, 0 },
{ 44, 0xcccc, 0xcccc, 0x9999, 0, 0 },
{ 45, 0xcccc, 0xcccc, 0x6666, 0, 0 },
{ 46, 0xcccc, 0xcccc, 0x3333, 0, 0 },
{ 47, 0xcccc, 0xcccc, 0x0000, 0, 0 },
{ 48, 0xcccc, 0x9999, 0xffff, 0, 0 },
{ 49, 0xcccc, 0x9999, 0xcccc, 0, 0 },
{ 50, 0xcccc, 0x9999, 0x9999, 0, 0 },
{ 51, 0xcccc, 0x9999, 0x6666, 0, 0 },
{ 52, 0xcccc, 0x9999, 0x3333, 0, 0 },
{ 53, 0xcccc, 0x9999, 0x0000, 0, 0 },
{ 54, 0xcccc, 0x6666, 0xffff, 0, 0 },
{ 55, 0xcccc, 0x6666, 0xcccc, 0, 0 },
{ 56, 0xcccc, 0x6666, 0x9999, 0, 0 },
{ 57, 0xcccc, 0x6666, 0x6666, 0, 0 },
{ 58, 0xcccc, 0x6666, 0x3333, 0, 0 },
{ 59, 0xcccc, 0x6666, 0x0000, 0, 0 },
{ 60, 0xcccc, 0x3333, 0xffff, 0, 0 },
{ 61, 0xcccc, 0x3333, 0xcccc, 0, 0 },
{ 62, 0xcccc, 0x3333, 0x9999, 0, 0 },
{ 63, 0xcccc, 0x3333, 0x6666, 0, 0 },
{ 64, 0xcccc, 0x3333, 0x3333, 0, 0 },
{ 65, 0xcccc, 0x3333, 0x0000, 0, 0 },
{ 66, 0xcccc, 0x0000, 0xffff, 0, 0 },
{ 67, 0xcccc, 0x0000, 0xcccc, 0, 0 },
{ 68, 0xcccc, 0x0000, 0x9999, 0, 0 },
{ 69, 0xcccc, 0x0000, 0x6666, 0, 0 },
{ 70, 0xcccc, 0x0000, 0x3333, 0, 0 },
{ 71, 0xcccc, 0x0000, 0x0000, 0, 0 },
{ 72, 0x9999, 0xffff, 0xffff, 0, 0 },
{ 73, 0x9999, 0xffff, 0xcccc, 0, 0 },
{ 74, 0x9999, 0xffff, 0x9999, 0, 0 },
{ 75, 0x9999, 0xffff, 0x6666, 0, 0 },
{ 76, 0x9999, 0xffff, 0x3333, 0, 0 },
{ 77, 0x9999, 0xffff, 0x0000, 0, 0 },
{ 78, 0x9999, 0xcccc, 0xffff, 0, 0 },
{ 79, 0x9999, 0xcccc, 0xcccc, 0, 0 },
{ 80, 0x9999, 0xcccc, 0x9999, 0, 0 },
{ 81, 0x9999, 0xcccc, 0x6666, 0, 0 },
{ 82, 0x9999, 0xcccc, 0x3333, 0, 0 },
{ 83, 0x9999, 0xcccc, 0x0000, 0, 0 },
{ 84, 0x9999, 0x9999, 0xffff, 0, 0 },
{ 85, 0x9999, 0x9999, 0xcccc, 0, 0 },
{ 86, 0x9999, 0x9999, 0x9999, 0, 0 },
{ 87, 0x9999, 0x9999, 0x6666, 0, 0 },
{ 88, 0x9999, 0x9999, 0x3333, 0, 0 },
{ 89, 0x9999, 0x9999, 0x0000, 0, 0 },
{ 90, 0x9999, 0x6666, 0xffff, 0, 0 },
{ 91, 0x9999, 0x6666, 0xcccc, 0, 0 },
{ 92, 0x9999, 0x6666, 0x9999, 0, 0 },
{ 93, 0x9999, 0x6666, 0x6666, 0, 0 },
{ 94, 0x9999, 0x6666, 0x3333, 0, 0 },
{ 95, 0x9999, 0x6666, 0x0000, 0, 0 },
{ 96, 0x9999, 0x3333, 0xffff, 0, 0 },
{ 97, 0x9999, 0x3333, 0xcccc, 0, 0 },
{ 98, 0x9999, 0x3333, 0x9999, 0, 0 },
{ 99, 0x9999, 0x3333, 0x6666, 0, 0 },
{ 100, 0x9999, 0x3333, 0x3333, 0, 0 },
{ 101, 0x9999, 0x3333, 0x0000, 0, 0 },
{ 102, 0x9999, 0x0000, 0xffff, 0, 0 },
{ 103, 0x9999, 0x0000, 0xcccc, 0, 0 },
{ 104, 0x9999, 0x0000, 0x9999, 0, 0 },
{ 105, 0x9999, 0x0000, 0x6666, 0, 0 },
{ 106, 0x9999, 0x0000, 0x3333, 0, 0 },
{ 107, 0x9999, 0x0000, 0x0000, 0, 0 },
{ 108, 0x6666, 0xffff, 0xffff, 0, 0 },
{ 109, 0x6666, 0xffff, 0xcccc, 0, 0 },
{ 110, 0x6666, 0xffff, 0x9999, 0, 0 },
{ 111, 0x6666, 0xffff, 0x6666, 0, 0 },
{ 112, 0x6666, 0xffff, 0x3333, 0, 0 },
{ 113, 0x6666, 0xffff, 0x0000, 0, 0 },
{ 114, 0x6666, 0xcccc, 0xffff, 0, 0 },
{ 115, 0x6666, 0xcccc, 0xcccc, 0, 0 },
{ 116, 0x6666, 0xcccc, 0x9999, 0, 0 },
{ 117, 0x6666, 0xcccc, 0x6666, 0, 0 },
{ 118, 0x6666, 0xcccc, 0x3333, 0, 0 },
{ 119, 0x6666, 0xcccc, 0x0000, 0, 0 },
{ 120, 0x6666, 0x9999, 0xffff, 0, 0 },
{ 121, 0x6666, 0x9999, 0xcccc, 0, 0 },
{ 122, 0x6666, 0x9999, 0x9999, 0, 0 },
{ 123, 0x6666, 0x9999, 0x6666, 0, 0 },
{ 124, 0x6666, 0x9999, 0x3333, 0, 0 },
{ 125, 0x6666, 0x9999, 0x0000, 0, 0 },
{ 126, 0x6666, 0x6666, 0xffff, 0, 0 },
{ 127, 0x6666, 0x6666, 0xcccc, 0, 0 },
{ 128, 0x6666, 0x6666, 0x9999, 0, 0 },
{ 129, 0x6666, 0x6666, 0x6666, 0, 0 },
{ 130, 0x6666, 0x6666, 0x3333, 0, 0 },
{ 131, 0x6666, 0x6666, 0x0000, 0, 0 },
{ 132, 0x6666, 0x3333, 0xffff, 0, 0 },
{ 133, 0x6666, 0x3333, 0xcccc, 0, 0 },
{ 134, 0x6666, 0x3333, 0x9999, 0, 0 },
{ 135, 0x6666, 0x3333, 0x6666, 0, 0 },
{ 136, 0x6666, 0x3333, 0x3333, 0, 0 },
{ 137, 0x6666, 0x3333, 0x0000, 0, 0 },
{ 138, 0x6666, 0x0000, 0xffff, 0, 0 },
{ 139, 0x6666, 0x0000, 0xcccc, 0, 0 },
{ 140, 0x6666, 0x0000, 0x9999, 0, 0 },
{ 141, 0x6666, 0x0000, 0x6666, 0, 0 },
{ 142, 0x6666, 0x0000, 0x3333, 0, 0 },
{ 143, 0x6666, 0x0000, 0x0000, 0, 0 },
{ 144, 0x3333, 0xffff, 0xffff, 0, 0 },
{ 145, 0x3333, 0xffff, 0xcccc, 0, 0 },
{ 146, 0x3333, 0xffff, 0x9999, 0, 0 },
{ 147, 0x3333, 0xffff, 0x6666, 0, 0 },
{ 148, 0x3333, 0xffff, 0x3333, 0, 0 },
{ 149, 0x3333, 0xffff, 0x0000, 0, 0 },
{ 150, 0x3333, 0xcccc, 0xffff, 0, 0 },
{ 151, 0x3333, 0xcccc, 0xcccc, 0, 0 },
{ 152, 0x3333, 0xcccc, 0x9999, 0, 0 },
{ 153, 0x3333, 0xcccc, 0x6666, 0, 0 },
{ 154, 0x3333, 0xcccc, 0x3333, 0, 0 },
{ 155, 0x3333, 0xcccc, 0x0000, 0, 0 },
{ 156, 0x3333, 0x9999, 0xffff, 0, 0 },
{ 157, 0x3333, 0x9999, 0xcccc, 0, 0 },
{ 158, 0x3333, 0x9999, 0x9999, 0, 0 },
{ 159, 0x3333, 0x9999, 0x6666, 0, 0 },
{ 160, 0x3333, 0x9999, 0x3333, 0, 0 },
{ 161, 0x3333, 0x9999, 0x0000, 0, 0 },
{ 162, 0x3333, 0x6666, 0xffff, 0, 0 },
{ 163, 0x3333, 0x6666, 0xcccc, 0, 0 },
{ 164, 0x3333, 0x6666, 0x9999, 0, 0 },
{ 165, 0x3333, 0x6666, 0x6666, 0, 0 },
{ 166, 0x3333, 0x6666, 0x3333, 0, 0 },
{ 167, 0x3333, 0x6666, 0x0000, 0, 0 },
{ 168, 0x3333, 0x3333, 0xffff, 0, 0 },
{ 169, 0x3333, 0x3333, 0xcccc, 0, 0 },
{ 170, 0x3333, 0x3333, 0x9999, 0, 0 },
{ 171, 0x3333, 0x3333, 0x6666, 0, 0 },
{ 172, 0x3333, 0x3333, 0x3333, 0, 0 },
{ 173, 0x3333, 0x3333, 0x0000, 0, 0 },
{ 174, 0x3333, 0x0000, 0xffff, 0, 0 },
{ 175, 0x3333, 0x0000, 0xcccc, 0, 0 },
{ 176, 0x3333, 0x0000, 0x9999, 0, 0 },
{ 177, 0x3333, 0x0000, 0x6666, 0, 0 },
{ 178, 0x3333, 0x0000, 0x3333, 0, 0 },
{ 179, 0x3333, 0x0000, 0x0000, 0, 0 },
{ 180, 0x0000, 0xffff, 0xffff, 0, 0 },
{ 181, 0x0000, 0xffff, 0xcccc, 0, 0 },
{ 182, 0x0000, 0xffff, 0x9999, 0, 0 },
{ 183, 0x0000, 0xffff, 0x6666, 0, 0 },
{ 184, 0x0000, 0xffff, 0x3333, 0, 0 },
{ 185, 0x0000, 0xffff, 0x0000, 0, 0 },
{ 186, 0x0000, 0xcccc, 0xffff, 0, 0 },
{ 187, 0x0000, 0xcccc, 0xcccc, 0, 0 },
{ 188, 0x0000, 0xcccc, 0x9999, 0, 0 },
{ 189, 0x0000, 0xcccc, 0x6666, 0, 0 },
{ 190, 0x0000, 0xcccc, 0x3333, 0, 0 },
{ 191, 0x0000, 0xcccc, 0x0000, 0, 0 },
{ 192, 0x0000, 0x9999, 0xffff, 0, 0 },
{ 193, 0x0000, 0x9999, 0xcccc, 0, 0 },
{ 194, 0x0000, 0x9999, 0x9999, 0, 0 },
{ 195, 0x0000, 0x9999, 0x6666, 0, 0 },
{ 196, 0x0000, 0x9999, 0x3333, 0, 0 },
{ 197, 0x0000, 0x9999, 0x0000, 0, 0 },
{ 198, 0x0000, 0x6666, 0xffff, 0, 0 },
{ 199, 0x0000, 0x6666, 0xcccc, 0, 0 },
{ 200, 0x0000, 0x6666, 0x9999, 0, 0 },
{ 201, 0x0000, 0x6666, 0x6666, 0, 0 },
{ 202, 0x0000, 0x6666, 0x3333, 0, 0 },
{ 203, 0x0000, 0x6666, 0x0000, 0, 0 },
{ 204, 0x0000, 0x3333, 0xffff, 0, 0 },
{ 205, 0x0000, 0x3333, 0xcccc, 0, 0 },
{ 206, 0x0000, 0x3333, 0x9999, 0, 0 },
{ 207, 0x0000, 0x3333, 0x6666, 0, 0 },
{ 208, 0x0000, 0x3333, 0x3333, 0, 0 },
{ 209, 0x0000, 0x3333, 0x0000, 0, 0 },
{ 210, 0x0000, 0x0000, 0xffff, 0, 0 },
{ 211, 0x0000, 0x0000, 0xcccc, 0, 0 },
{ 212, 0x0000, 0x0000, 0x9999, 0, 0 },
{ 213, 0x0000, 0x0000, 0x6666, 0, 0 },
{ 214, 0x0000, 0x0000, 0x3333, 0, 0 },
{ 215, 0xeeee, 0x0000, 0x0000, 0, 0 },
{ 216, 0xdddd, 0x0000, 0x0000, 0, 0 },
{ 217, 0xbbbb, 0x0000, 0x0000, 0, 0 },
{ 218, 0xaaaa, 0x0000, 0x0000, 0, 0 },
{ 219, 0x8888, 0x0000, 0x0000, 0, 0 },
{ 220, 0x7777, 0x0000, 0x0000, 0, 0 },
{ 221, 0x5555, 0x0000, 0x0000, 0, 0 },
{ 222, 0x4444, 0x0000, 0x0000, 0, 0 },
{ 223, 0x2222, 0x0000, 0x0000, 0, 0 },
{ 224, 0x1111, 0x0000, 0x0000, 0, 0 },
{ 225, 0x0000, 0xeeee, 0x0000, 0, 0 },
{ 226, 0x0000, 0xdddd, 0x0000, 0, 0 },
{ 227, 0x0000, 0xbbbb, 0x0000, 0, 0 },
{ 228, 0x0000, 0xaaaa, 0x0000, 0, 0 },
{ 229, 0x0000, 0x8888, 0x0000, 0, 0 },
{ 230, 0x0000, 0x7777, 0x0000, 0, 0 },
{ 231, 0x0000, 0x5555, 0x0000, 0, 0 },
{ 232, 0x0000, 0x4444, 0x0000, 0, 0 },
{ 233, 0x0000, 0x2222, 0x0000, 0, 0 },
{ 234, 0x0000, 0x1111, 0x0000, 0, 0 },
{ 235, 0x0000, 0x0000, 0xeeee, 0, 0 },
{ 236, 0x0000, 0x0000, 0xdddd, 0, 0 },
{ 237, 0x0000, 0x0000, 0xbbbb, 0, 0 },
{ 238, 0x0000, 0x0000, 0xaaaa, 0, 0 },
{ 239, 0x0000, 0x0000, 0x8888, 0, 0 },
{ 240, 0x0000, 0x0000, 0x7777, 0, 0 },
{ 241, 0x0000, 0x0000, 0x5555, 0, 0 },
{ 242, 0x0000, 0x0000, 0x4444, 0, 0 },
{ 243, 0x0000, 0x0000, 0x2222, 0, 0 },
{ 244, 0x0000, 0x0000, 0x1111, 0, 0 },
{ 245, 0xeeee, 0xeeee, 0xeeee, 0, 0 },
{ 246, 0xdddd, 0xdddd, 0xdddd, 0, 0 },
{ 247, 0xbbbb, 0xbbbb, 0xbbbb, 0, 0 },
{ 248, 0xaaaa, 0xaaaa, 0xaaaa, 0, 0 },
{ 249, 0x8888, 0x8888, 0x8888, 0, 0 },
{ 250, 0x7777, 0x7777, 0x7777, 0, 0 },
{ 251, 0x5555, 0x5555, 0x5555, 0, 0 },
{ 252, 0x4444, 0x4444, 0x4444, 0, 0 },
{ 253, 0x2222, 0x2222, 0x2222, 0, 0 },
{ 254, 0x1111, 0x1111, 0x1111, 0, 0 },
{ 255, 0xffff, 0xffff, 0xffff, 0, 0 }
};
#endif /* _DARWIN_CLUT8_ */
\ No newline at end of file diff --git a/xc/programs/Xserver/hw/vfb/windef.h b/xc/programs/Xserver/hw/vfb/windef.h new file mode 100644 index 000000000..eb1b39cf3 --- /dev/null +++ b/xc/programs/Xserver/hw/vfb/windef.h @@ -0,0 +1,227 @@ +/* $XFree86: xc/programs/Xserver/hw/vfb/windef.h,v 1.2 2001/04/27 12:58:28 dawes Exp $ */ + +#ifndef _WINDEF_H +#define _WINDEF_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WINVER +#define WINVER 0x0400 +#endif +#ifndef _WIN32_WINNT +#define _WIN32_WINNT WINVER +#endif +#ifndef WIN32 +#define WIN32 +#endif +#ifndef _WIN32 +#define _WIN32 +#endif +#define FAR +#define far +#define NEAR +#define near +#ifndef CONST +#define CONST const +#endif +#undef MAX_PATH +#define MAX_PATH 260 + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void*)0) +#endif +#endif +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE 1 +#endif +#define IN +#define OUT +#ifndef OPTIONAL +#define OPTIONAL +#endif + +#ifdef __GNUC__ +#define PACKED __attribute__((packed)) +#ifndef _stdcall +#define _stdcall __attribute__((stdcall)) +#endif +#ifndef __stdcall +#define __stdcall __attribute__((stdcall)) +#endif +#ifndef _cdecl +#define _cdecl __attribute__((cdecl)) +#endif +#ifndef __cdecl +#define __cdecl __attribute__((cdecl)) +#endif +#ifndef __declspec +#define __declspec(e) __attribute__((e)) +#endif +#ifndef _declspec +#define _declspec(e) __attribute__((e)) +#endif +#else +#define PACKED +#define _cdecl +#define __cdecl +#endif + +#undef pascal +#undef _pascal +#undef __pascal +#define pascal __stdcall +#define _pascal __stdcall +#define __pascal __stdcall +#define PASCAL _pascal +#define CDECL _cdecl +#define STDCALL __stdcall +#define WINAPI __stdcall +#define WINAPIV __cdecl +#define APIENTRY __stdcall +#define CALLBACK __stdcall +#define APIPRIVATE __stdcall + +#define DECLSPEC_IMPORT __declspec(dllimport) +#define DECLSPEC_EXPORT __declspec(dllexport) +#define DECLSPEC_NORETURN __declspec(noreturn) +#define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8))) +#define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16))) +#define LOWORD(l) ((WORD)((DWORD)(l))) +#define HIWORD(l) ((WORD)(((DWORD)(l)>>16)&0xFFFF)) +#define LOBYTE(w) ((BYTE)(w)) +#define HIBYTE(w) ((BYTE)(((WORD)(w)>>8)&0xFF)) + +#ifndef _export +#define _export +#endif +#ifndef __export +#define __export +#endif + +#ifndef NOMINMAX +#ifndef max +#define max(a,b) ((a)>(b)?(a):(b)) +#endif +#ifndef min +#define min(a,b) ((a)<(b)?(a):(b)) +#endif +#endif + +#define UNREFERENCED_PARAMETER(P) {(P)=(P);} +#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);} +#define DBG_UNREFERENCED_PARAMETER(P) +#define DBG_UNREFERENCED_LOCAL_VARIABLE(L) + +typedef unsigned long DWORD; +typedef int WINBOOL,*PWINBOOL,*LPWINBOOL; +/* FIXME: Is there a good solution to this? */ +#ifndef __OBJC__ +typedef WINBOOL BOOL; +#else +#define BOOL WINBOOL +#endif +typedef unsigned char BYTE; +typedef BOOL *PBOOL, *LPBOOL; +typedef unsigned short WORD; +typedef float FLOAT; +typedef FLOAT *PFLOAT; +typedef BYTE *PBYTE,*LPBYTE; +typedef int *PINT,*LPINT; +typedef WORD *PWORD,*LPWORD; +typedef long *LPLONG; +typedef DWORD *PDWORD,*LPDWORD; +typedef void *PVOID,*LPVOID; +typedef CONST void *PCVOID,*LPCVOID; +typedef int INT; +typedef unsigned int UINT,*PUINT,*LPUINT; + +#include <winnt.h> + +typedef UINT WPARAM; +typedef LONG LPARAM; +typedef LONG LRESULT; +#ifndef _HRESULT_DEFINED +typedef LONG HRESULT; +#define _HRESULT_DEFINED +#endif +typedef WORD ATOM; +typedef HANDLE HGLOBAL; +typedef HANDLE HLOCAL; +typedef HANDLE GLOBALHANDLE; +typedef HANDLE LOCALHANDLE; +typedef void *HGDIOBJ; +DECLARE_HANDLE(HACCEL); +DECLARE_HANDLE(HBITMAP); +DECLARE_HANDLE(HBRUSH); +DECLARE_HANDLE(HCOLORSPACE); +DECLARE_HANDLE(HDC); +DECLARE_HANDLE(HGLRC); +DECLARE_HANDLE(HDESK); +DECLARE_HANDLE(HENHMETAFILE); +DECLARE_HANDLE(HFONT); +DECLARE_HANDLE(HICON); +DECLARE_HANDLE(HKEY); +/* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */ +/* #if (WINVER >= 0x0500) */ +DECLARE_HANDLE(HMONITOR); +DECLARE_HANDLE(HTERMINAL); +DECLARE_HANDLE(HWINEVENTHOOK); +/* #endif */ +typedef HKEY *PHKEY; +DECLARE_HANDLE(HMENU); +DECLARE_HANDLE(HMETAFILE); +DECLARE_HANDLE(HINSTANCE); +typedef HINSTANCE HMODULE; +DECLARE_HANDLE(HPALETTE); +DECLARE_HANDLE(HPEN); +DECLARE_HANDLE(HRGN); +DECLARE_HANDLE(HRSRC); +DECLARE_HANDLE(HSTR); +DECLARE_HANDLE(HTASK); +DECLARE_HANDLE(HWND); +DECLARE_HANDLE(HWINSTA); +DECLARE_HANDLE(HKL); +typedef int HFILE; +typedef HICON HCURSOR; +typedef DWORD COLORREF; +typedef int (WINAPI *FARPROC)(); +typedef int (WINAPI *NEARPROC)(); +typedef int (WINAPI *PROC)(); +typedef struct tagRECT { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECT,*PRECT,*LPRECT; +typedef const RECT *LPCRECT; +typedef struct tagRECTL { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECTL,*PRECTL,*LPRECTL; +typedef const RECTL *LPCRECTL; +typedef struct tagPOINT { + LONG x; + LONG y; +} POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL; +typedef struct tagSIZE { + LONG cx; + LONG cy; +} SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL; +typedef struct tagPOINTS { + SHORT x; + SHORT y; +} POINTS,*PPOINTS,*LPPOINTS; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/xc/programs/Xserver/hw/vfb/windows.h b/xc/programs/Xserver/hw/vfb/windows.h new file mode 100644 index 000000000..33c4db61a --- /dev/null +++ b/xc/programs/Xserver/hw/vfb/windows.h @@ -0,0 +1,152 @@ +/* $XFree86: xc/programs/Xserver/hw/vfb/windows.h,v 1.2 2001/04/27 12:58:28 dawes Exp $ */ +/* + windows.h - main header file for the Win32 API + + Written by Anders Norlander <anorland@hem2.passagen.se> + + This file is part of a free library for the Win32 API. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +*/ +#ifndef _WINDOWS_H +#define _WINDOWS_H +/* translate GCC target defines to MS equivalents. Keep this synchronized + with winnt.h. */ +#if defined(__i686__) && !defined(_M_IX86) +#define _M_IX86 600 +#elif defined(__i586__) && !defined(_M_IX86) +#define _M_IX86 500 +#elif defined(__i486__) && !defined(_M_IX86) +#define _M_IX86 400 +#elif defined(__i386__) && !defined(_M_IX86) +#define _M_IX86 300 +#endif +#if defined(_M_IX86) && !defined(_X86_) +#define _X86_ +#elif defined(_M_ALPHA) && !defined(_ALPHA_) +#define _ALPHA_ +#elif defined(_M_PPC) && !defined(_PPC_) +#define _PPC_ +#elif defined(_M_MRX000) && !defined(_MIPS_) +#define _MIPS_ +#elif defined(_M_M68K) && !defined(_68K_) +#define _68K_ +#endif + +#ifdef RC_INVOKED +/* winresrc.h includes the necessary headers */ +#include <winresrc.h> +#else + +#ifdef __GNUC__ +#ifndef NONAMELESSUNION +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define _ANONYMOUS_UNION +#define _ANONYMOUS_STRUCT +#else +#if defined(__cplusplus) +#define _ANONYMOUS_UNION +#endif +#endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */ +#endif /* NONAMELESSUNION */ +#endif /* __GNUC__ */ + +#ifndef _ANONYMOUS_UNION +#define _UNION_NAME(x) x +#define DUMMYUNIONNAME u +#define DUMMYUNIONNAME2 u2 +#define DUMMYUNIONNAME3 u3 +#define DUMMYUNIONNAME4 u4 +#define DUMMYUNIONNAME5 u5 +#define DUMMYUNIONNAME6 u6 +#define DUMMYUNIONNAME7 u7 +#define DUMMYUNIONNAME8 u8 +#else +#define _UNION_NAME(x) +#define DUMMYUNIONNAME +#define DUMMYUNIONNAME2 +#define DUMMYUNIONNAME3 +#define DUMMYUNIONNAME4 +#define DUMMYUNIONNAME5 +#define DUMMYUNIONNAME6 +#define DUMMYUNIONNAME7 +#define DUMMYUNIONNAME8 +#endif +#ifndef _ANONYMOUS_STRUCT +#define _STRUCT_NAME(x) x +#define DUMMYSTRUCTNAME s +#define DUMMYSTRUCTNAME2 s2 +#define DUMMYSTRUCTNAME3 s3 +#else +#define _STRUCT_NAME(x) +#define DUMMYSTRUCTNAME +#define DUMMYSTRUCTNAME2 +#define DUMMYSTRUCTNAME3 +#endif + +#ifndef NO_STRICT +#ifndef STRICT +#define STRICT 1 +#endif +#endif + +#include <stdarg.h> +#include "windef.h" +#include <wincon.h> +#include <basetyps.h> +#include <excpt.h> +#include <winbase.h> +#ifndef _WINGDI_H +#include <wingdi.h> +#endif +#ifndef _WINUSER_H +#include <winuser.h> +#endif +#ifndef _WINNLS_H +#include <winnls.h> +#endif +#ifndef _WINVER_H +#include <winver.h> +#endif +#ifndef _WINNETWK_H +#include <winnetwk.h> +#endif +#ifndef _WINREG_H +#include <winreg.h> +#endif +#ifndef _WINSVC_H +#include <winsvc.h> +#endif + +#ifndef WIN32_LEAN_AND_MEAN +#include <commdlg.h> +#include <cderr.h> +#include <dde.h> +#include <ddeml.h> +#include <dlgs.h> +#include <lzexpand.h> +#include <mmsystem.h> +#include <nb30.h> +#include <rpc.h> +#include <shellapi.h> +#include <winperf.h> +#include <winspool.h> +#if defined(Win32_Winsock) || !(defined(__INSIDE_CYGWIN__) || defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(_UWIN)) +#include <winsock.h> +#endif +#endif /* WIN32_LEAN_AND_MEAN */ + +#endif /* RC_INVOKED */ + +#ifdef __OBJC__ +/* FIXME: Not undefining BOOL here causes all BOOLs to be WINBOOL (int), + but undefining it causes trouble as well if a file is included after + windows.h +*/ +#undef BOOL +#endif + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h new file mode 100644 index 000000000..c3a968b8c --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h @@ -0,0 +1,198 @@ +/* + * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * + * 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 Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE 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. + * + * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk + * Mike Chapman <mike@paranoia.com>, + * Juanjo Santamarta <santamarta@ctv.es>, + * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * David Thomas <davtom@dream.org.uk>. + * Xavier Ducoin <x.ducoin@lectra.com> + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h,v 1.1 2001/04/19 12:45:22 alanh Exp $ */ + +/* 3C4 */ +#define BankReg 0x06 +#define ExtGraphicControl 0x06 +#define ClockReg 0x07 +#define CPUThreshold 0x08 +#define CRTThreshold 0x09 +#define CRTCOff 0x0A +#define DualBanks 0x0B +#define MMIOEnable 0x0B +#define RAMSize 0x0C +#define Mode64 0x0C +#define ExtConfStatus1 0x0E +#define ExtHoznOver 0x12 +#define ClockBase 0x13 +#define LinearAdd0 0x20 +#define LinearAdd1 0x21 +#define GraphEng 0x27 +#define MemClock0 0x28 +#define MemClock1 0x29 +#define XR2A 0x2A +#define XR2B 0x2B +#define TurboQueueBase 0x2C +#define FBSize 0x2F +#define ExtMiscCont5 0x34 +#define ExtMiscCont9 0x3C + +/* 3x4 */ +#define Offset 0x13 + +#define read_xr(num,var) do {outb(0x3c4, num);var=inb(0x3c5);} while (0) + +/* Definitions for the SIS engine communication. */ + +extern int sis2Reg32MMIO[]; +#define BR(x) sis2Reg32MMIO[x] + +#define sisLEFT2RIGHT 0x00010000 +#define sisRIGHT2LEFT 0x00000000 +#define sisTOP2BOTTOM 0x00020000 +#define sisBOTTOM2TOP 0x00000000 + +#define sisSRCSYSTEM 0x00000010 +#define sisSRCVIDEO 0x00000000 + +#define sisNOMERGECLIP 0x04000000 + +#define sisCMDBLT 0x00000000 +#define sisCMDCOLEXP 0x00000001 +#define sisCMDLINE 0x00000004 +#define sisCMDENHCOLEXP 0x00000002 + +#define sisTRANSPARENT 0x00100000 + +#define sisCLIPINTRN 0x00000000 +#define sisCLIPEXTRN 0x04000000 +#define sisCLIPENABL 0x00040000 + +#define sisPATFG 0x00000000 +#define sisPATREG 0x00000040 +#define sisPATMASK 0x00000080 + +/* Macros to do useful things with the SIS BitBLT engine */ + +/* + bit 31 2D engine: 1 is idle, + bit 30 3D engine: 1 is idle, + bit 29 Command queue: 1 is empty +*/ +#define sisBLTSync \ + while((*(volatile unsigned short *)(pSiS->IOBase + BR(16)+2) & \ + 0xE000) != 0xE000){} + +#define sisBLTWAIT \ + if (!pSiS->TurboQueue) {\ + while(!(*(volatile unsigned short *)(pSiS->IOBase + BR(16)+2) & \ + (0x8000))){}} + +#define sisSETPATMASKREG()\ + ((unsigned char *)(pSiS->IOBase + BR(11))) + +#define sisSETPATREG()\ + ((unsigned char *)(pSiS->IOBase + BR(17))) + +#define sisSETCMD(op) \ + *(volatile unsigned long *)(pSiS->IOBase + BR(15) ) = op + +#define sisSETROP(op) \ + pSiS->ROPReg = (op<<8) + +#define sisROP pSiS->ROPReg + +#define sisSETSRCADDR(srcAddr) \ + *(volatile unsigned long *)(pSiS->IOBase + BR(0)) = srcAddr + +#define sisSETDSTADDR(dstAddr) \ + *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = dstAddr + +#define sisSETPITCH(srcPitch,dstPitch) \ + *(volatile unsigned short *)(pSiS->IOBase + BR(1)) = (srcPitch); \ + *(volatile unsigned short *)(pSiS->IOBase + BR(5)) = (dstPitch) + +#define sisSETHEIGHTWIDTH(Height,Width)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(6)) = (((Height)&0xFFFF)<<16) | ((Width)&0xFFFF) + +#define sisSETDSTHEIGHT(Height)\ + *(volatile unsigned short *)(pSiS->IOBase + BR(5)+2) = (Height) + + +#define sisSETSRCXSRCY(X,Y)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(2)) = (((X)&0xFFFF)<<16)| \ + ((Y)&0xFFFF) + +#define sisSETDSTXDSTY(X,Y)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(3)) = (((X)&0xFFFF)<<16)| \ + ((Y)&0xFFFF) + +#define sisSETCLIPTOP(x,y)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(13)) = (((y)&0xFFFF)<<16)| \ + ((x)&0xFFFF) + +#define sisSETCLIPBOTTOM(x,y)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(14)) = (((y)&0xFFFF)<<16)| \ + ((x)&0xFFFF) + + +#define sisSETBGCOLOR(bgColor)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(10)) = (bgColor) + +#define sisSETFGCOLOR(fgColor)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(9)) = (fgColor) + + +#define sisSETPATBGCOLOR(bgColor)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(8)) = (bgColor) + +#define sisSETPATFGCOLOR(fgColor)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(7)) = (fgColor) + + +#define sisEnableCRT1HWCursor()\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8500) |= 0x40000000; +#define sisDisableCRT1HWCursor()\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8500) &= 0xBFFFFFFF; + +#define sisSetCRT1CursorBGColor(color)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8504) = (color); +#define sisSetCRT1CursorFGColor(color)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8508) = (color); + +#define sisSetCRT1CursorPositionX(x,preset)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x850C) = (x) | ((preset) << 16); +#define sisSetCRT1CursorPositionY(y,preset)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8510) = (y) | ((preset) << 16); + +#define sisEnableCRT2HWCursor()\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8520) |= 0x40000000; +#define sisDisableCRT2HWCursor()\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8520) &= 0xBFFFFFFF; + +#define sisSetCRT2CursorBGColor(color)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8524) = (color); +#define sisSetCRT2CursorFGColor(color)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8528) = (color); + +#define sisSetCRT2CursorPositionX(x,preset)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x852C) = (x) | ((preset) << 16); +#define sisSetCRT2CursorPositionY(y,preset)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8530) = (y) | ((preset) << 16); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h new file mode 100644 index 000000000..0faf237bd --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h @@ -0,0 +1,14 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h,v 1.2 2001/04/19 14:11:37 alanh Exp $ */ +int compute_vclk(int Clock, int *out_n, int *out_dn, int *out_div, + int *out_sbit, int *out_scale); +void SISDACPreInit(ScrnInfoPtr pScrn); +unsigned int SiSddc1Read(ScrnInfoPtr pScrn); +void SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, + LOCO *colors, VisualPtr pVisual); +void SiSCalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, + unsigned int *vclk); + +void SiSIODump(ScrnInfoPtr pScrn); +int SiSMemBandWidth(ScrnInfoPtr pScrn); +int SiSMclk(SISPtr pSiS); + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c new file mode 100644 index 000000000..de5bda5ae --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c @@ -0,0 +1,247 @@ +/* + * Copyright (c) 1999, The XFree86 Project Inc. + * based on code written by Mark Vojkovich <markv@valinux.com> + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c,v 1.2 2001/04/19 14:11:37 alanh Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "sis.h" +#include "servermd.h" + +#include "sis_shadow.h" + +void +SISRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SISPtr pSiS = SISPTR(pScrn); + int width, height, Bpp, FBPitch; + unsigned char *src, *dst; + + Bpp = pScrn->bitsPerPixel >> 3; + FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel); + + while(num--) { + width = (pbox->x2 - pbox->x1) * Bpp; + height = pbox->y2 - pbox->y1; + src = pSiS->ShadowPtr + (pbox->y1 * pSiS->ShadowPitch) + + (pbox->x1 * Bpp); + dst = pSiS->FbBase + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); + + while(height--) { + memcpy(dst, src, width); + dst += FBPitch; + src += pSiS->ShadowPitch; + } + + pbox++; + } +} + +void +SISPointerMoved(int index, int x, int y) +{ + ScrnInfoPtr pScrn = xf86Screens[index]; + SISPtr pSiS = SISPTR(pScrn); + int newX, newY; + + if(pSiS->Rotate == 1) { + newX = pScrn->pScreen->height - y - 1; + newY = x; + } else { + newX = y; + newY = pScrn->pScreen->width - x - 1; + } + + (*pSiS->PointerMoved)(index, newX, newY); +} + +void +SISRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SISPtr pSiS = SISPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD8 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pSiS->Rotate * pSiS->ShadowPitch; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~3; + y2 = (pbox->y2 + 3) & ~3; + height = (y2 - y1) >> 2; /* in dwords */ + + if(pSiS->Rotate == 1) { + dstPtr = pSiS->FbBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = pSiS->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = pSiS->FbBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = pSiS->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + *(dst++) = src[0] | (src[srcPitch] << 8) | + (src[srcPitch * 2] << 16) | + (src[srcPitch * 3] << 24); + src += srcPitch * 4; + } + srcPtr += pSiS->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + + +void +SISRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SISPtr pSiS = SISPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD16 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pSiS->Rotate * pSiS->ShadowPitch >> 1; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~1; + y2 = (pbox->y2 + 1) & ~1; + height = (y2 - y1) >> 1; /* in dwords */ + + if(pSiS->Rotate == 1) { + dstPtr = (CARD16*)pSiS->FbBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = (CARD16*)pSiS->ShadowPtr + + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD16*)pSiS->FbBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = (CARD16*)pSiS->ShadowPtr + + (y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + *(dst++) = src[0] | (src[srcPitch] << 16); + src += srcPitch * 2; + } + srcPtr += pSiS->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + + +/* this one could be faster */ +void +SISRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SISPtr pSiS = SISPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD8 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = BitmapBytePad(pScrn->displayWidth * 24); + srcPitch = -pSiS->Rotate * pSiS->ShadowPitch; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~3; + y2 = (pbox->y2 + 3) & ~3; + height = (y2 - y1) >> 2; /* blocks of 3 dwords */ + + if(pSiS->Rotate == 1) { + dstPtr = pSiS->FbBase + + (pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3); + srcPtr = pSiS->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3); + } else { + dstPtr = pSiS->FbBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + (y1 * 3); + srcPtr = pSiS->ShadowPtr + (y1 * srcPitch) + (pbox->x2 * 3) - 3; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + dst[0] = src[0] | (src[1] << 8) | (src[2] << 16) | + (src[srcPitch] << 24); + dst[1] = src[srcPitch + 1] | (src[srcPitch + 2] << 8) | + (src[srcPitch * 2] << 16) | + (src[(srcPitch * 2) + 1] << 24); + dst[2] = src[(srcPitch * 2) + 2] | (src[srcPitch * 3] << 8) | + (src[(srcPitch * 3) + 1] << 16) | + (src[(srcPitch * 3) + 2] << 24); + dst += 3; + src += srcPitch * 4; + } + srcPtr += pSiS->Rotate * 3; + dstPtr += dstPitch; + } + + pbox++; + } +} + +void +SISRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SISPtr pSiS = SISPTR(pScrn); + int count, width, height, dstPitch, srcPitch; + CARD32 *dstPtr, *srcPtr, *src, *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pSiS->Rotate * pSiS->ShadowPitch >> 2; + + while(num--) { + width = pbox->x2 - pbox->x1; + height = pbox->y2 - pbox->y1; + + if(pSiS->Rotate == 1) { + dstPtr = (CARD32*)pSiS->FbBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2; + srcPtr = (CARD32*)pSiS->ShadowPtr + + ((1 - pbox->y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD32*)pSiS->FbBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1; + srcPtr = (CARD32*)pSiS->ShadowPtr + + (pbox->y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = dstPtr; + count = height; + while(count--) { + *(dst++) = *src; + src += srcPitch; + } + srcPtr += pSiS->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.h new file mode 100644 index 000000000..b44922131 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.h @@ -0,0 +1,8 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.h,v 1.2 2001/04/19 14:11:37 alanh Exp $ */ + +void SISPointerMoved(int index, int x, int y); +void SISRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SISRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SISRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SISRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SISRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c b/xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c new file mode 100644 index 000000000..b1d24471c --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c @@ -0,0 +1,582 @@ +/* + * SBUS and OpenPROM access functions. + * + * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com) + * + * 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 + * JAKUB JELINEK 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. + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c,v 1.1 2001/04/20 17:02:43 tsi Exp $ */ + +#include <fcntl.h> +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <sys/ioctl.h> +#include <sys/mman.h> +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +#include "xf86sbusBus.h" +#include "xf86Sbus.h" + +static int promFd = -1; +static int promRootNode, promCurrentNode; +static int promOpenCount = 0; +static int promP1275 = -1; +#define MAX_PROP 128 +#define MAX_VAL (4096-128-4) +static struct openpromio *promOpio; + +static int +promGetSibling(int node) +{ + promOpio->oprom_size = sizeof(int); + + if (node == -1) return 0; + *(int *)promOpio->oprom_array = node; + if (ioctl(promFd, OPROMNEXT, promOpio) < 0) + return 0; + promCurrentNode = *(int *)promOpio->oprom_array; + return *(int *)promOpio->oprom_array; +} + +static int +promGetChild(int node) +{ + promOpio->oprom_size = sizeof(int); + + if (!node || node == -1) return 0; + *(int *)promOpio->oprom_array = node; + if (ioctl(promFd, OPROMCHILD, promOpio) < 0) + return 0; + promCurrentNode = *(int *)promOpio->oprom_array; + return *(int *)promOpio->oprom_array; +} + +static char * +promGetProperty(const char *prop, int *lenp) +{ + promOpio->oprom_size = MAX_VAL; + + strcpy(promOpio->oprom_array, prop); + if (ioctl(promFd, OPROMGETPROP, promOpio) < 0) + return 0; + if (lenp) *lenp = promOpio->oprom_size; + return promOpio->oprom_array; +} + +static int +promGetBool(const char *prop) +{ + promOpio->oprom_size = 0; + + *(int *)promOpio->oprom_array = 0; + for (;;) { + promOpio->oprom_size = MAX_PROP; + if (ioctl(promFd, OPROMNXTPROP, promOpio) < 0) + return 0; + if (!promOpio->oprom_size) + return 0; + if (!strcmp(promOpio->oprom_array, prop)) + return 1; + } +} + +enum { + PROM_NODE_PCI = 16, + PROM_NODE_EBUS = 8, + PROM_NODE_SBUS = 4, + PROM_NODE_PREF = 2, + PROM_NODE_SIBLING = 1 +}; + +static int +promSetNode(sbusPromNodePtr pnode) +{ + int node; + + if (!pnode->node || pnode->node == -1) + return -1; + if (pnode->cookie[0] & PROM_NODE_SIBLING) + node = promGetSibling(pnode->cookie[1]); + else + node = promGetChild(pnode->cookie[1]); + if (pnode->node != node) + return -1; + return 0; +} + +static void +promIsP1275(void) +{ + FILE *f; + char buffer[1024]; + + if (promP1275 != -1) + return; + promP1275 = 0; + f = fopen("/proc/cpuinfo","r"); + if (!f) return; + while (fgets(buffer, 1024, f) != NULL) + if (!strncmp (buffer, "type", 4) && strstr (buffer, "sun4u")) { + promP1275 = 1; + break; + } + fclose(f); +} + +void +sparcPromClose(void) +{ + if (promOpenCount > 1) { + promOpenCount--; + return; + } + if (promFd != -1) { + close(promFd); + promFd = -1; + } + if (promOpio) { + xfree(promOpio); + promOpio = NULL; + } + promOpenCount = 0; +} + +int +sparcPromInit(void) +{ + if (promOpenCount) { + promOpenCount++; + return 0; + } + promFd = open("/dev/openprom", O_RDONLY, 0); + if (promFd == -1) + return -1; + promOpio = (struct openpromio *)xalloc(4096); + if (!promOpio) { + sparcPromClose(); + return -1; + } + promRootNode = promGetSibling(0); + if (!promRootNode) { + sparcPromClose(); + return -1; + } + promIsP1275(); + promOpenCount++; + + return 0; +} + +char * +sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp) +{ + if (promSetNode(pnode)) + return NULL; + return promGetProperty(prop, lenp); +} + +int +sparcPromGetBool(sbusPromNodePtr pnode, const char *prop) +{ + if (promSetNode(pnode)) + return 0; + return promGetBool(prop); +} + +static sbusDevicePtr *devicePtrs; + +static void promWalk(int node, int oldnode, int flags) +{ + int nextnode; + int len, sbus = (flags & PROM_NODE_SBUS); + char *prop = promGetProperty("device_type", &len); + int devId, i, j; + sbusPromNode pNode, pNode2; + + while (prop) { + if (len <= 0 || strcmp(prop, "display")) + break; + prop = promGetProperty("name", &len); + if (!prop || len <= 0) + break; + while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',') prop++; + if (!sbus && strcmp(prop, "ffb") && strcmp(prop, "afb") && + strcmp(prop, "cgfourteen")) + break; + /* + * All /SUNW,ffb outside of SBUS tree come before all + * /SUNW,afb outside of SBUS tree in Linux. + */ + if (!sbus && !strcmp(prop, "afb")) + flags |= PROM_NODE_PREF; + for (i = 0; sbusDeviceTable[i].devId; i++) + if (!strcmp(prop, sbusDeviceTable[i].promName)) + break; + devId = sbusDeviceTable[i].devId; + if (! devId) + break; + for (i = 0; i < 32; i++) { + if (! devicePtrs[i] || devicePtrs[i]->devId != devId) + continue; + if (devicePtrs[i]->node.node) { + if ((devicePtrs[i]->node.cookie[0] & ~PROM_NODE_SIBLING) <= + (flags & ~PROM_NODE_SIBLING)) + continue; + for (j = i + 1, pNode = devicePtrs[i]->node; j < 32; j++) { + if (! devicePtrs[j] || devicePtrs[j]->devId != devId) + continue; + pNode2 = devicePtrs[j]->node; + devicePtrs[j]->node = pNode; + pNode = pNode2; + } + } + devicePtrs[i]->node.node = node; + devicePtrs[i]->node.cookie[0] = flags; + devicePtrs[i]->node.cookie[1] = oldnode; + break; + } + break; + } + prop = promGetProperty("name", &len); + if (prop && len > 0) { + if (!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) + sbus = PROM_NODE_SBUS; + } + nextnode = promGetChild(node); + if (nextnode) + promWalk(nextnode, node, sbus); + nextnode = promGetSibling(node); + if (nextnode) + promWalk(nextnode, node, PROM_NODE_SIBLING|sbus); +} + +void +sparcPromAssignNodes(void) +{ + sbusDevicePtr psdp, *psdpp; + int n, holes = 0, i, j; + FILE *f; + + devicePtrs = xnfcalloc(sizeof(sbusDevicePtr), 32); + for (psdpp = xf86SbusInfo, psdp = *psdpp, n = 0; psdp; psdp = *++psdpp, n++) { + if (psdp->fbNum != n) + holes = 1; + devicePtrs[psdp->fbNum] = psdp; + } + if (holes && (f = fopen("/proc/fb", "r")) != NULL) { + /* We could not open one of fb devices, check /proc/fb to see what + * were the types of the cards missed. */ + char buffer[64]; + int fbNum, devId; + static struct { + int devId; + char *prefix; + } procFbPrefixes[] = { + { SBUS_DEVICE_BW2, "BWtwo" }, + { SBUS_DEVICE_CG14, "CGfourteen" }, + { SBUS_DEVICE_CG6, "CGsix" }, + { SBUS_DEVICE_CG3, "CGthree" }, + { SBUS_DEVICE_FFB, "Creator" }, + { SBUS_DEVICE_FFB, "Elite 3D" }, + { SBUS_DEVICE_LEO, "Leo" }, + { SBUS_DEVICE_TCX, "TCX" }, + { 0, NULL }, + }; + + while (fscanf(f, "%d %63s\n", &fbNum, buffer) == 2) { + for (i = 0; procFbPrefixes[i].devId; i++) + if (! strncmp(procFbPrefixes[i].prefix, buffer, + strlen(procFbPrefixes[i].prefix))) + break; + devId = procFbPrefixes[i].devId; + if (! devId) continue; + if (devicePtrs[fbNum]) { + if (devicePtrs[fbNum]->devId != devId) + xf86ErrorF("Inconsistent /proc/fb with FBIOGATTR\n"); + } else if (!devicePtrs[fbNum]) { + devicePtrs[fbNum] = psdp = xnfcalloc(sizeof (sbusDevice), 1); + psdp->devId = devId; + psdp->fbNum = fbNum; + psdp->fd = -2; + } + } + fclose(f); + } + promGetSibling(0); + promWalk(promRootNode, 0, 2); + for (i = 0, j = 0; i < 32; i++) + if (devicePtrs[i] && devicePtrs[i]->fbNum == -1) + j++; + xf86SbusInfo = xnfrealloc(xf86SbusInfo, sizeof(psdp) * (n + j + 1)); + for (i = 0, psdpp = xf86SbusInfo; i < 32; i++) + if (devicePtrs[i]) { + if (devicePtrs[i]->fbNum == -1) { + memmove(psdpp + 1, psdpp, sizeof(psdpp) * (n + 1)); + *psdpp = devicePtrs[i]; + } else + n--; + } + xfree(devicePtrs); +} + +static char * +promGetReg(int type) +{ + char *prop; + int len; + static char regstr[40]; + + regstr[0] = 0; + prop = promGetProperty("reg", &len); + if (prop && len >= 4) { + unsigned int *reg = (unsigned int *)prop; + if (!promP1275 || (type == PROM_NODE_SBUS) || (type == PROM_NODE_EBUS)) + sprintf (regstr, "@%x,%x", reg[0], reg[1]); + else if (type == PROM_NODE_PCI) { + if ((reg[0] >> 8) & 7) + sprintf (regstr, "@%x,%x", (reg[0] >> 11) & 0x1f, (reg[0] >> 8) & 7); + else + sprintf (regstr, "@%x", (reg[0] >> 11) & 0x1f); + } else if (len == 4) + sprintf (regstr, "@%x", reg[0]); + else { + unsigned int regs[2]; + + /* Things get more complicated on UPA. If upa-portid exists, + then address is @upa-portid,second-int-in-reg, otherwise + it is @first-int-in-reg/16,second-int-in-reg (well, probably + upa-portid always exists, but just to be safe). */ + memcpy (regs, reg, sizeof(regs)); + prop = promGetProperty("upa-portid", &len); + if (prop && len == 4) { + reg = (unsigned int *)prop; + sprintf (regstr, "@%x,%x", reg[0], regs[1]); + } else + sprintf (regstr, "@%x,%x", regs[0] >> 4, regs[1]); + } + } + return regstr; +} + +static int +promWalk2(char *path, int parent, int node, int searchNode, int type) +{ + int nextnode; + int len, ntype = type; + char *prop, *p; + + prop = promGetProperty("name", &len); + *path = '/'; + if (!prop || len <= 0) + return 0; + if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type) + ntype = PROM_NODE_SBUS; + else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI) + ntype = PROM_NODE_EBUS; + else if (!strcmp(prop, "pci") && !type) + ntype = PROM_NODE_PCI; + strcpy (path + 1, prop); + p = promGetReg(type); + if (*p) + strcat (path, p); + if (node == searchNode) + return 1; + nextnode = promGetChild(node); + if (nextnode && promWalk2(strchr (path, 0), node, nextnode, searchNode, ntype)) + return 1; + nextnode = promGetSibling(node); + if (nextnode && promWalk2(path, parent, nextnode, searchNode, type)) + return 1; + return 0; +} + +char * +sparcPromNode2Pathname(sbusPromNodePtr pnode) +{ + char *ret; + + if (!pnode->node) return NULL; + ret = xalloc(4096); + if (!ret) return NULL; + if (promWalk2(ret, promRootNode, promGetChild(promRootNode), pnode->node, 0)) + return ret; + xfree(ret); + return NULL; +} + +static int +promWalk3(char *name, char *regstr, int parent, int type) +{ + int len, node, ret; + char *prop, *p; + + for (;;) { + prop = promGetProperty("name", &len); + if (!prop || len <= 0) + return 0; + if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type) + type = PROM_NODE_SBUS; + else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI) + type = PROM_NODE_EBUS; + else if (!strcmp(prop, "pci") && !type) + type = PROM_NODE_PCI; + for (node = promGetChild(parent); node; node = promGetSibling(node)) { + prop = promGetProperty("name", &len); + if (!prop || len <= 0) + continue; + if (*name && strcmp(name, prop)) + continue; + if (*regstr) { + p = promGetReg(type); + if (! *p || strcmp(p + 1, regstr)) + continue; + } + break; + } + if (!node) { + for (node = promGetChild(parent); node; node = promGetSibling(node)) { + ret = promWalk3(name, regstr, node, type); + if (ret) return ret; + } + return 0; + } + name = strchr(regstr, 0) + 1; + if (! *name) + return node; + p = strchr(name, '/'); + if (p) + *p = 0; + else + p = strchr(name, 0); + regstr = strchr(name, '@'); + if (regstr) + *regstr++ = 0; + else + regstr = p; + if (name == regstr) + return 0; + parent = node; + } +} + +int +sparcPromPathname2Node(const char *pathName) +{ + int i; + char *name, *regstr, *p; + + i = strlen(pathName); + name = xalloc(i + 2); + if (! name) return 0; + strcpy (name, pathName); + name [i + 1] = 0; + if (name[0] != '/') + return 0; + p = strchr(name + 1, '/'); + if (p) + *p = 0; + else + p = strchr(name, 0); + regstr = strchr(name, '@'); + if (regstr) + *regstr++ = 0; + else + regstr = p; + if (name + 1 == regstr) + return 0; + promGetSibling(0); + i = promWalk3(name + 1, regstr, promRootNode, 0); + xfree(name); + return i; +} + +pointer +xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size) +{ + pointer ret; + + if (psdp->fd == -1) { + psdp->fd = open(psdp->device, O_RDWR); + if (psdp->fd == -1) + return NULL; + } else if (psdp->fd < 0) + return NULL; + + ret = (pointer) mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, + psdp->fd, offset); + if (ret == (pointer) -1) { + ret = (pointer) mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, + psdp->fd, offset); + } + if (ret == (pointer) -1) + return NULL; + + return ret; +} + +void +xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size) +{ + munmap (addr, size); +} + +/* Tell OS that we are driving the HW cursor ourselves. */ +void +xf86SbusHideOsHwCursor(sbusDevicePtr psdp) +{ + struct fbcursor fbcursor; + unsigned char zeros[8]; + + memset(&fbcursor, 0, sizeof(fbcursor)); + memset(&zeros, 0, sizeof(zeros)); + fbcursor.cmap.count = 2; + fbcursor.cmap.red = zeros; + fbcursor.cmap.green = zeros; + fbcursor.cmap.blue = zeros; + fbcursor.image = (char *)zeros; + fbcursor.mask = (char *)zeros; + fbcursor.size.x = 32; + fbcursor.size.y = 1; + fbcursor.set = FB_CUR_SETALL; + ioctl(psdp->fd, FBIOSCURSOR, &fbcursor); +} + +/* Set HW cursor colormap. */ +void +xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg) +{ + struct fbcursor fbcursor; + unsigned char red[2], green[2], blue[2]; + + memset(&fbcursor, 0, sizeof(fbcursor)); + red[0] = bg >> 16; + green[0] = bg >> 8; + blue[0] = bg; + red[1] = fg >> 16; + green[1] = fg >> 8; + blue[1] = fg; + fbcursor.cmap.count = 2; + fbcursor.cmap.red = red; + fbcursor.cmap.green = green; + fbcursor.cmap.blue = blue; + fbcursor.set = FB_CUR_SETCMAP; + ioctl(psdp->fd, FBIOSCURSOR, &fbcursor); +} diff --git a/xc/programs/Xserver/hw/xwin/winkeybd.c b/xc/programs/Xserver/hw/xwin/winkeybd.c new file mode 100644 index 000000000..5df741748 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winkeybd.c @@ -0,0 +1,465 @@ +/* + *Copyright (C) 1994-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. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winkeybd.c,v 1.1 2001/04/18 17:14:06 dawes Exp $ */ + +#include "win.h" + +/* + * Include the standard XFree86 ASCII keymap. + * + * This header declares a static KeySym array called 'map'. + */ +#include "../xfree86/common/xf86Keymap.h" + +/* + * Translate a Windows WM_[SYS]KEY(UP/DOWN) message + * into an ASCII scan code. + * + * We do this ourselves, rather than letting Windows handle it, + * because Windows tends to munge the handling of special keys, + * like AltGr on European keyboards. + */ +void +winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode) +{ + /* Handle non-extended keys first, to setup a default scancode */ + switch (wParam) + { + case VK_PAUSE: + /* Windows give Pause the same scan code as NumLock */ + *piScanCode = KEY_Pause + MIN_KEYCODE; + break; + + default: + *piScanCode = LOBYTE (HIWORD (lParam)) + MIN_KEYCODE; + break; + } + + /* + Handle extended keys that weren't handled correctly as + non-extended keys. + */ + if (HIWORD (lParam) & KF_EXTENDED) + { + switch (wParam) + { + case VK_MENU: + /* Windows gives Alt_R the same scan code as Alt_L */ + *piScanCode = KEY_AltLang + MIN_KEYCODE; + break; + + case VK_CONTROL: + /* Windows gives Ctrl_R the same scan code as Ctrl_L */ + *piScanCode = KEY_RCtrl + MIN_KEYCODE; + break; + + case VK_SHIFT: + /* Windows gives Shift_R the same scan code as Shift_R */ + *piScanCode = KEY_ShiftR + MIN_KEYCODE; + break; + + case VK_INSERT: + /* Windows gives Insert the same scan code as KP_Insert */ + *piScanCode = KEY_Insert + MIN_KEYCODE; + break; + + case VK_DELETE: + /* Windows gives Delete the same scan code as KP_Delete */ + *piScanCode = KEY_Delete + MIN_KEYCODE; + break; + + case VK_HOME: + /* Windows gives Home the same scan code as KP_Home */ + *piScanCode = KEY_Home + MIN_KEYCODE; + break; + + case VK_END: + /* Windows gives End the same scan code as KP_End */ + *piScanCode = KEY_End + MIN_KEYCODE; + break; + + case VK_PRIOR: + /* Windows give Prior the same scan code as KP_Prior */ + *piScanCode = KEY_PgUp + MIN_KEYCODE; + break; + + case VK_NEXT: + /* Windows gives Next the same scan code as KP_Next */ + *piScanCode = KEY_PgDown + MIN_KEYCODE; + break; + + case VK_RIGHT: + /* Windows gives Right the same scan code as KP_Right */ + *piScanCode = KEY_Right + MIN_KEYCODE; + break; + + case VK_LEFT: + /* Windows gives Left the same scan code as KP_Left */ + *piScanCode = KEY_Left + MIN_KEYCODE; + break; + + case VK_UP: + /* Windows gives Up the same scan code as KP_Up */ + *piScanCode = KEY_Up + MIN_KEYCODE; + break; + + case VK_DOWN: + /* Windows gives Down the same scan code as KP_Down */ + *piScanCode = KEY_Down + MIN_KEYCODE; + break; + + case VK_RETURN: + /* Windows gives KP_Enter a messed up scan code (BackSpace?) */ + *piScanCode = KEY_KP_Enter + MIN_KEYCODE; + break; + + case VK_DIVIDE: + /* Windows gives KP_Divide a totallly messed up scan code */ + *piScanCode = KEY_KP_Divide + MIN_KEYCODE; + break; + + case VK_CANCEL: + /* Windows gives Ctrl + Pause/Break the incorrect scan code */ + *piScanCode = KEY_Break + MIN_KEYCODE; + break; + + case VK_SNAPSHOT: + /* Windows gives Print the wrong scan code */ + *piScanCode = KEY_Print + MIN_KEYCODE; + break; + } + } +} + +/* + * We call this function from winKeybdProc when we are + * initializing the keyboard. + */ +void +winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap) +{ + int i; + KeySym *pKeySym = map; + + /* MAP_LENGTH is defined in Xserver/include/input.h to be 256 */ + for (i = 0; i < MAP_LENGTH; i++) + { + pModMap[i] = NoSymbol; /* make sure it is restored */ + } + + /* Loop through all valid entries in the key symbol table */ + for (i = MIN_KEYCODE; + i < (MIN_KEYCODE + NUM_KEYCODES); + i++, pKeySym += GLYPHS_PER_KEY) + { + switch(*pKeySym) + { + case XK_Shift_L: + case XK_Shift_R: + pModMap[i] = ShiftMask; + break; + + case XK_Control_L: + case XK_Control_R: + pModMap[i] = ControlMask; + break; + + case XK_Caps_Lock: + pModMap[i] = LockMask; + break; + + case XK_Alt_L: + case XK_Alt_R: + pModMap[i] = AltMask; + break; + + case XK_Num_Lock: + pModMap[i] = NumLockMask; + break; + + case XK_Scroll_Lock: + pModMap[i] = ScrollLockMask; + break; + + /* Hirigana/Katakana toggle */ + case XK_Kana_Lock: + case XK_Kana_Shift: + pModMap[i] = KanaMask; + break; + + /* alternate toggle for multinational support */ + case XK_Mode_switch: + pModMap[i] = AltLangMask; + break; + } + } + + pKeySyms->map = (KeySym*)map; + pKeySyms->mapWidth = GLYPHS_PER_KEY; + pKeySyms->minKeyCode = MIN_KEYCODE; + pKeySyms->maxKeyCode = MAX_KEYCODE; +} + +/* Ring the keyboard bell (system speaker on PCs) */ +void +winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt, + pointer pCtrl, int iClass) +{ + +} + +/* Change some keyboard configuration parameters */ +void +winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl) +{ + +} + +/* + * See Porting Layer Definition - p. 18 + * winKeybdProc is known as a DeviceProc. + */ +int +winKeybdProc (DeviceIntPtr pDeviceInt, int iState) +{ + KeySymsRec keySyms; + CARD8 modMap[MAP_LENGTH]; + DevicePtr pDevice = (DevicePtr) pDeviceInt; + + switch (iState) + { + case DEVICE_INIT: + winGetKeyMappings (&keySyms, modMap); + InitKeyboardDeviceStruct (pDevice, + &keySyms, + modMap, + winKeybdBell, + winKeybdCtrl); + break; + case DEVICE_ON: + pDevice->on = TRUE; + break; + + case DEVICE_CLOSE: + case DEVICE_OFF: + pDevice->on = FALSE; + break; + } + + return Success; +} + +/* + * Detect current mode key states upon server startup. + * + * Simulate a press and release of any key that is currently + * toggled. + */ +void +winInitializeModeKeyStates (void) +{ + xEvent xCurrentEvent; + + /* Restore NumLock */ + if (GetKeyState (VK_NUMLOCK) & 0x0001) + { + xCurrentEvent.u.u.detail = KEY_NumLock + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Restore CapsLock */ + if (GetKeyState (VK_CAPITAL) & 0x0001) + { + xCurrentEvent.u.u.detail = KEY_CapsLock + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Restore ScrollLock */ + if (GetKeyState (VK_SCROLL) & 0x0001) + { + xCurrentEvent.u.u.detail = KEY_ScrollLock + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Restore KanaLock */ + if (GetKeyState (VK_KANA) & 0x0001) + { + xCurrentEvent.u.u.detail = KEY_HKTG + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } +} + +/* + We have to store the last state of each mode + key before we lose the keyboard focus. +*/ +void +winStoreModeKeyStates (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* Initialize all mode key states to off */ + pScreenPriv->dwModeKeyStates = 0x0L; + + pScreenPriv->dwModeKeyStates |= + (GetKeyState (VK_NUMLOCK) & 0x0001) << NumLockMapIndex; + + pScreenPriv->dwModeKeyStates |= + (GetKeyState (VK_SCROLL) & 0x0001) << ScrollLockMapIndex; + + pScreenPriv->dwModeKeyStates |= + (GetKeyState (VK_CAPITAL) & 0x0001) << LockMapIndex; + + pScreenPriv->dwModeKeyStates |= + (GetKeyState (VK_KANA) & 0x0001) << KanaMapIndex; +} + +/* + Upon regaining the keyboard focus we must + resynchronize our internal mode key states + with the actual state of the keys. +*/ +void +winRestoreModeKeyStates (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + xEvent xCurrentEvent; + ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); + + /* Has the key state changed? */ + if (WIN_XOR(pScreenPriv->dwModeKeyStates & NumLockMask, + GetKeyState (VK_NUMLOCK) & 0x0001)) + { + xCurrentEvent.u.u.detail = KEY_NumLock + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Has the key state changed? */ + if (WIN_XOR(pScreenPriv->dwModeKeyStates & LockMask, + GetKeyState (VK_CAPITAL) & 0x0001)) + { + xCurrentEvent.u.u.detail = KEY_CapsLock + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Has the key state changed? */ + if (WIN_XOR(pScreenPriv->dwModeKeyStates & ScrollLockMask, + GetKeyState (VK_SCROLL) & 0x0001)) + { + xCurrentEvent.u.u.detail = KEY_ScrollLock + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Has the key state changed? */ + if (WIN_XOR(pScreenPriv->dwModeKeyStates & KanaMask, + GetKeyState (VK_KANA) & 0x0001)) + { + xCurrentEvent.u.u.detail = KEY_HKTG + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } +} + + + diff --git a/xc/programs/Xserver/hw/xwin/winmouse.c b/xc/programs/Xserver/hw/xwin/winmouse.c new file mode 100644 index 000000000..a75e3bb5e --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winmouse.c @@ -0,0 +1,78 @@ +/* + *Copyright (C) 1994-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. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winmouse.c,v 1.1 2001/04/18 17:14:06 dawes Exp $ */ + +#include "win.h" + +void +winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl) +{ + +} + +/* See Porting Layer Definition - p. 18 + * This is known as a DeviceProc + */ +int +winMouseProc (DeviceIntPtr pDeviceInt, int iState) +{ + CARD8 map[6]; + DevicePtr pDevice = (DevicePtr) pDeviceInt; + + switch (iState) + { + case DEVICE_INIT: + map[1] = 1; + map[2] = 2; + map[3] = 3; + map[4] = 4; + map[5] = 5; + InitPointerDeviceStruct (pDevice, + map, + 5, /* Buttons 4 and 5 are mouse wheel events */ + miPointerGetMotionEvents, + winMouseCtrl, + miPointerGetMotionBufferSize ()); + break; + + case DEVICE_ON: + pDevice->on = TRUE; + break; + + case DEVICE_CLOSE: + case DEVICE_OFF: + pDevice->on = FALSE; + break; + } + return Success; +} |