summaryrefslogtreecommitdiff
path: root/hw/kdrive/src
diff options
context:
space:
mode:
Diffstat (limited to 'hw/kdrive/src')
-rw-r--r--hw/kdrive/src/Makefile.am30
-rw-r--r--hw/kdrive/src/fourcc.h134
-rw-r--r--hw/kdrive/src/kaa.c1136
-rw-r--r--hw/kdrive/src/kaa.h111
-rw-r--r--hw/kdrive/src/kaapict.c720
-rw-r--r--hw/kdrive/src/kasync.c335
-rw-r--r--hw/kdrive/src/kcmap.c297
-rw-r--r--hw/kdrive/src/kcolor.c884
-rw-r--r--hw/kdrive/src/kcurscol.c96
-rw-r--r--hw/kdrive/src/kdrive.c1513
-rw-r--r--hw/kdrive/src/kdrive.h913
-rw-r--r--hw/kdrive/src/kinfo.c147
-rw-r--r--hw/kdrive/src/kinput.c1679
-rw-r--r--hw/kdrive/src/kkeymap.c238
-rw-r--r--hw/kdrive/src/kkeymap.h58
-rw-r--r--hw/kdrive/src/kloadmap.c203
-rw-r--r--hw/kdrive/src/kmap.c181
-rw-r--r--hw/kdrive/src/kmode.c402
-rw-r--r--hw/kdrive/src/knoop.c257
-rw-r--r--hw/kdrive/src/koffscreen.c373
-rw-r--r--hw/kdrive/src/kpict.c83
-rw-r--r--hw/kdrive/src/kshadow.c85
-rw-r--r--hw/kdrive/src/ktest.c79
-rw-r--r--hw/kdrive/src/kxv.c1921
-rw-r--r--hw/kdrive/src/kxv.h315
-rw-r--r--hw/kdrive/src/vga.c331
-rw-r--r--hw/kdrive/src/vga.h147
27 files changed, 0 insertions, 12668 deletions
diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am
deleted file mode 100644
index 07c388d29..000000000
--- a/hw/kdrive/src/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-INCLUDES = \
- @KDRIVE_INCS@ \
- @XSERVER_CFLAGS@
-
-noinst_LIBRARIES = libkdrive.a
-
-libkdrive_a_SOURCES = \
- fourcc.h \
- kaa.c \
- kaa.h \
- kaapict.c \
- kasync.c \
- kcmap.c \
- kcurscol.c \
- kdrive.c \
- kdrive.h \
- kinfo.c \
- kinput.c \
- kkeymap.h \
- kmap.c \
- kmode.c \
- knoop.c \
- koffscreen.c \
- kpict.c \
- kshadow.c \
- ktest.c \
- kxv.c \
- kxv.h \
- vga.c \
- vga.h
diff --git a/hw/kdrive/src/fourcc.h b/hw/kdrive/src/fourcc.h
deleted file mode 100644
index b19f5decc..000000000
--- a/hw/kdrive/src/fourcc.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/fourcc.h,v 1.4 2003/04/23 21:51:24 tsi Exp $ */
-
-/*
- 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 \
- }
-
-#endif /* _XF86_FOURCC_H_ */
diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c
deleted file mode 100644
index 6fa1d7ed0..000000000
--- a/hw/kdrive/src/kaa.c
+++ /dev/null
@@ -1,1136 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/kaa.c,v 1.4 2001/06/04 09:45:41 keithp Exp $
- *
- * Copyright © 2001 Keith Packard
- *
- * Partly based on code that is Copyright © 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "kaa.h"
-#include "fontstruct.h"
-#include "dixfontstr.h"
-
-#define DEBUG_MIGRATE 0
-#define DEBUG_PIXMAP 0
-#if DEBUG_MIGRATE
-#define DBG_MIGRATE(a) ErrorF a
-#else
-#define DBG_MIGRATE(a)
-#endif
-#if DEBUG_PIXMAP
-#define DBG_PIXMAP(a) ErrorF a
-#else
-#define DBG_PIXMAP(a)
-#endif
-
-int kaaGeneration;
-int kaaScreenPrivateIndex;
-int kaaPixmapPrivateIndex;
-
-#define KAA_PIXMAP_SCORE_MOVE_IN 10
-#define KAA_PIXMAP_SCORE_MAX 20
-#define KAA_PIXMAP_SCORE_MOVE_OUT -10
-#define KAA_PIXMAP_SCORE_MIN -20
-#define KAA_PIXMAP_SCORE_PINNED 1000
-#define KAA_PIXMAP_SCORE_INIT 1001
-
-void
-kaaDrawableDirty (DrawablePtr pDrawable)
-{
- PixmapPtr pPixmap;
- KaaPixmapPrivPtr pKaaPixmap;
-
- if (pDrawable->type == DRAWABLE_WINDOW)
- pPixmap = (*pDrawable->pScreen->GetWindowPixmap)((WindowPtr) pDrawable);
- else
- pPixmap = (PixmapPtr)pDrawable;
-
- pKaaPixmap = KaaGetPixmapPriv(pPixmap);
- if (pKaaPixmap != NULL)
- pKaaPixmap->dirty = TRUE;
-}
-
-static void
-kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area)
-{
- PixmapPtr pPixmap = area->privData;
- KaaPixmapPriv(pPixmap);
- int dst_pitch, src_pitch, bytes;
- unsigned char *dst, *src;
- int i;
-
- DBG_MIGRATE (("Save 0x%08x (0x%x) (%dx%d)\n",
- pPixmap->drawable.id,
- KaaGetPixmapPriv(pPixmap)->area ?
- KaaGetPixmapPriv(pPixmap)->area->offset : -1,
- pPixmap->drawable.width,
- pPixmap->drawable.height));
-
- src_pitch = pPixmap->devKind;
- dst_pitch = pKaaPixmap->devKind;
-
- src = pPixmap->devPrivate.ptr;
- dst = pKaaPixmap->devPrivate.ptr;
-
- pPixmap->devKind = dst_pitch;
- pPixmap->devPrivate.ptr = dst;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pKaaPixmap->area = NULL;
-
-#if 0
- if (!pKaaPixmap->dirty)
- return;
-#endif
-
- KdCheckSync (pPixmap->drawable.pScreen);
-
- bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
-
- i = pPixmap->drawable.height;
- while (i--) {
- memcpy (dst, src, bytes);
- dst += dst_pitch;
- src += src_pitch;
- }
-}
-
-static int
-kaaLog2(int val)
-{
- int bits;
-
- if (!val)
- return 0;
- for (bits = 0; val != 0; bits++)
- val >>= 1;
- return bits - 1;
-}
-
-static Bool
-kaaPixmapAllocArea (PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- KaaScreenPriv (pScreen);
- KaaPixmapPriv (pPixmap);
- KdScreenPriv (pScreen);
- int bpp = pPixmap->drawable.bitsPerPixel;
- CARD16 h = pPixmap->drawable.height;
- CARD16 w = pPixmap->drawable.width;
- int pitch;
-
- if (pKaaScr->info->flags & KAA_OFFSCREEN_ALIGN_POT && w != 1)
- w = 1 << (kaaLog2(w - 1) + 1);
- pitch = (w * bpp / 8 + pKaaScr->info->offscreenPitch - 1) &
- ~(pKaaScr->info->offscreenPitch - 1);
-
- pKaaPixmap->devKind = pPixmap->devKind;
- pKaaPixmap->devPrivate = pPixmap->devPrivate;
- pKaaPixmap->area = KdOffscreenAlloc (pScreen, pitch * h,
- pKaaScr->info->offscreenByteAlign,
- FALSE,
- kaaPixmapSave, (pointer) pPixmap);
- if (!pKaaPixmap->area)
- return FALSE;
-
- DBG_PIXMAP(("++ 0x%08x (0x%x) (%dx%d)\n",
- pPixmap->drawable.id,
- KaaGetPixmapPriv(pPixmap)->area ?
- KaaGetPixmapPriv(pPixmap)->area->offset : -1,
- pPixmap->drawable.width,
- pPixmap->drawable.height));
- pPixmap->devKind = pitch;
- pPixmap->devPrivate.ptr = (pointer) ((CARD8 *) pScreenPriv->screen->memory_base + pKaaPixmap->area->offset);
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- return TRUE;
-}
-
-void
-kaaMoveInPixmap (PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- KaaScreenPriv (pScreen);
- KaaPixmapPriv (pPixmap);
- int dst_pitch, src_pitch, bytes;
- unsigned char *dst, *src;
- int i;
-
- DBG_MIGRATE (("-> 0x%08x (0x%x) (%dx%d)\n",
- pPixmap->drawable.id,
- KaaGetPixmapPriv(pPixmap)->area ?
- KaaGetPixmapPriv(pPixmap)->area->offset : -1,
- pPixmap->drawable.width,
- pPixmap->drawable.height));
-
- src = pPixmap->devPrivate.ptr;
- src_pitch = pPixmap->devKind;
-
- if (!kaaPixmapAllocArea (pPixmap))
- return;
-
- pKaaPixmap->dirty = FALSE;
-
- if (pKaaScr->info->UploadToScreen)
- {
- if (pKaaScr->info->UploadToScreen(pPixmap, src, src_pitch))
- return;
- }
-
- dst = pPixmap->devPrivate.ptr;
- dst_pitch = pPixmap->devKind;
-
- bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
-
- KdCheckSync (pPixmap->drawable.pScreen);
-
- i = pPixmap->drawable.height;
- while (i--) {
- memcpy (dst, src, bytes);
- dst += dst_pitch;
- src += src_pitch;
- }
-}
-
-static void
-kaaMoveOutPixmap (PixmapPtr pPixmap)
-{
- KaaPixmapPriv (pPixmap);
- KdOffscreenArea *area = pKaaPixmap->area;
-
- DBG_MIGRATE (("<- 0x%08x (0x%x) (%dx%d)\n",
- pPixmap->drawable.id,
- KaaGetPixmapPriv(pPixmap)->area ?
- KaaGetPixmapPriv(pPixmap)->area->offset : -1,
- pPixmap->drawable.width,
- pPixmap->drawable.height));
- if (area)
- {
- kaaPixmapSave (pPixmap->drawable.pScreen, area);
- KdOffscreenFree (pPixmap->drawable.pScreen, area);
- }
-}
-
-void
-kaaPixmapUseScreen (PixmapPtr pPixmap)
-{
- KaaPixmapPriv (pPixmap);
-
- if (pKaaPixmap->score == KAA_PIXMAP_SCORE_PINNED)
- return;
-
- if (pKaaPixmap->score == KAA_PIXMAP_SCORE_INIT) {
- kaaMoveInPixmap(pPixmap);
- pKaaPixmap->score = 0;
- }
-
- if (pKaaPixmap->score < KAA_PIXMAP_SCORE_MAX)
- {
- pKaaPixmap->score++;
- if (!kaaPixmapIsOffscreen(pPixmap) &&
- pKaaPixmap->score >= KAA_PIXMAP_SCORE_MOVE_IN)
- kaaMoveInPixmap (pPixmap);
- }
- KdOffscreenMarkUsed (pPixmap);
-}
-
-void
-kaaPixmapUseMemory (PixmapPtr pPixmap)
-{
- KaaPixmapPriv (pPixmap);
-
- if (pKaaPixmap->score == KAA_PIXMAP_SCORE_PINNED)
- return;
-
- if (pKaaPixmap->score == KAA_PIXMAP_SCORE_INIT)
- pKaaPixmap->score = 0;
-
- if (pKaaPixmap->score > KAA_PIXMAP_SCORE_MIN)
- {
- pKaaPixmap->score--;
- if (pKaaPixmap->area &&
- pKaaPixmap->score <= KAA_PIXMAP_SCORE_MOVE_OUT)
- kaaMoveOutPixmap (pPixmap);
- }
-}
-
-static Bool
-kaaDestroyPixmap (PixmapPtr pPixmap)
-{
- if (pPixmap->refcnt == 1)
- {
- KaaPixmapPriv (pPixmap);
- if (pKaaPixmap->area)
- {
- DBG_PIXMAP(("-- 0x%08x (0x%x) (%dx%d)\n",
- pPixmap->drawable.id,
- KaaGetPixmapPriv(pPixmap)->area->offset,
- pPixmap->drawable.width,
- pPixmap->drawable.height));
- /* Free the offscreen area */
- KdOffscreenFree (pPixmap->drawable.pScreen, pKaaPixmap->area);
- pPixmap->devPrivate = pKaaPixmap->devPrivate;
- pPixmap->devKind = pKaaPixmap->devKind;
- }
- }
- return fbDestroyPixmap (pPixmap);
-}
-
-static PixmapPtr
-kaaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
-{
- PixmapPtr pPixmap;
- KaaPixmapPrivPtr pKaaPixmap;
- int bpp;
-
- bpp = BitsPerPixel (depth);
- if (bpp == 32 && depth == 24)
- {
- int fb;
- KdScreenPriv (pScreen);
-
- for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
- if (pScreenPriv->screen->fb[fb].depth == 24)
- {
- bpp = pScreenPriv->screen->fb[fb].bitsPerPixel;
- break;
- }
- }
-
- pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp);
- if (!pPixmap)
- return NULL;
- pKaaPixmap = KaaGetPixmapPriv(pPixmap);
- if (!w || !h)
- pKaaPixmap->score = KAA_PIXMAP_SCORE_PINNED;
- else
- pKaaPixmap->score = KAA_PIXMAP_SCORE_INIT;
-
- pKaaPixmap->area = NULL;
- pKaaPixmap->dirty = FALSE;
-
- return pPixmap;
-}
-
-Bool
-kaaPixmapIsOffscreen(PixmapPtr p)
-{
- ScreenPtr pScreen = p->drawable.pScreen;
- KdScreenPriv(pScreen);
-
- return ((unsigned long) ((CARD8 *) p->devPrivate.ptr -
- (CARD8 *) pScreenPriv->screen->memory_base) <
- pScreenPriv->screen->memory_size);
-}
-
-PixmapPtr
-kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
-{
- PixmapPtr pPixmap;
- int x, y;
-
- if (pDrawable->type == DRAWABLE_WINDOW) {
- pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
-#ifdef COMPOSITE
- x = -pPixmap->screen_x;
- y = -pPixmap->screen_y;
-#else
- x = 0;
- y = 0;
-#endif
- }
- else
- {
- pPixmap = (PixmapPtr) pDrawable;
- x = 0;
- y = 0;
- }
- *xp = x;
- *yp = y;
- if (kaaPixmapIsOffscreen (pPixmap))
- return pPixmap;
- else
- return NULL;
-}
-
-Bool
-kaaDrawableIsOffscreen (DrawablePtr pDrawable)
-{
- PixmapPtr pPixmap;
- if (pDrawable->type == DRAWABLE_WINDOW)
- pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
- else
- pPixmap = (PixmapPtr) pDrawable;
- return kaaPixmapIsOffscreen (pPixmap);
-}
-
-#if 0
-static void
-kaaFillTiled(int dst_x,
- int dst_y,
- int width,
- int height,
- int src_x,
- int src_y,
- int src_width,
- int src_height,
- void (*Copy) (int srcX,
- int srcY,
- int dstX,
- int dstY,
- int width,
- int height))
-{
- modulus (src_x, src_width, src_x);
- modulus (src_y, src_height, src_y);
-
- while (height)
- {
- int dst_x_tmp = dst_x;
- int src_x_tmp = src_x;
- int width_tmp = width;
- int height_left = src_height - src_y;
- int height_this = min (height, height_left);
-
- while (width_tmp)
- {
- int width_left = src_width - src_x_tmp;
- int width_this = min (width_tmp, width_left);
-
- (*Copy) (src_x_tmp, src_y,
- dst_x_tmp, dst_y,
- width_this, height_this);
-
- width_tmp -= width_this;
- dst_x_tmp += width_this;
- }
- height -= height_this;
- dst_y += height_this;
- src_y = 0;
- }
-}
-#endif
-
-static void
-kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- ScreenPtr pScreen = pDrawable->pScreen;
- KdScreenPriv (pScreen);
- KaaScreenPriv (pScreen);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- PixmapPtr pPixmap;
- BoxPtr pextent, pbox;
- int nbox;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1;
- int partX1, partX2;
- int off_x, off_y;
-
- if (!pScreenPriv->enabled ||
- pGC->fillStyle != FillSolid ||
- !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) ||
- !(*pKaaScr->info->PrepareSolid) (pPixmap,
- pGC->alu,
- pGC->planemask,
- pGC->fgPixel))
- {
- KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
- return;
- }
-
- pextent = REGION_EXTENTS(pGC->pScreen, pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
- while (n--)
- {
- fullX1 = ppt->x;
- fullY1 = ppt->y;
- fullX2 = fullX1 + (int) *pwidth;
- ppt++;
- pwidth++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
-
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- nbox = REGION_NUM_RECTS (pClip);
- if (nbox == 1)
- {
- (*pKaaScr->info->Solid) (fullX1 + off_x, fullY1 + off_y,
- fullX2 + off_x, fullY1 + 1 + off_y);
- }
- else
- {
- pbox = REGION_RECTS(pClip);
- while(nbox--)
- {
- if (pbox->y1 <= fullY1 && fullY1 < pbox->y2)
- {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- if (partX2 > partX1)
- (*pKaaScr->info->Solid) (partX1 + off_x, fullY1 + off_y,
- partX2 + off_x, fullY1 + 1 + off_y);
- }
- pbox++;
- }
- }
- }
- (*pKaaScr->info->DoneSolid) ();
- kaaDrawableDirty (pDrawable);
- KdMarkSync(pDrawable->pScreen);
-}
-
-void
-kaaCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- KdScreenPriv (pDstDrawable->pScreen);
- KaaScreenPriv (pDstDrawable->pScreen);
- PixmapPtr pSrcPixmap, pDstPixmap;
- int src_off_x, src_off_y;
- int dst_off_x, dst_off_y;
-
- /* Migrate pixmaps to same place as destination */
- if (pScreenPriv->enabled && pSrcDrawable->type == DRAWABLE_PIXMAP) {
- if (kaaDrawableIsOffscreen (pDstDrawable))
- kaaPixmapUseScreen ((PixmapPtr) pSrcDrawable);
- else
- kaaPixmapUseMemory ((PixmapPtr) pSrcDrawable);
- }
-
- if (pScreenPriv->enabled &&
- (pSrcPixmap = kaaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) &&
- (pDstPixmap = kaaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) &&
- (*pKaaScr->info->PrepareCopy) (pSrcPixmap,
- pDstPixmap,
- dx,
- dy,
- pGC ? pGC->alu : GXcopy,
- pGC ? pGC->planemask : FB_ALLONES))
- {
- while (nbox--)
- {
- (*pKaaScr->info->Copy) (pbox->x1 + dx + src_off_x,
- pbox->y1 + dy + src_off_y,
- pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
- pbox++;
- }
- (*pKaaScr->info->DoneCopy) ();
- KdMarkSync(pDstDrawable->pScreen);
- }
- else
- {
- KdCheckSync (pDstDrawable->pScreen);
- fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC,
- pbox, nbox, dx, dy, reverse, upsidedown,
- bitplane, closure);
- }
- kaaDrawableDirty (pDstDrawable);
-}
-
-static RegionPtr
-kaaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx, int dsty)
-{
- return fbDoCopy (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, kaaCopyNtoN, 0, 0);
-}
-
-static void
-kaaPolyFillRect(DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect)
-{
- KdScreenPriv (pDrawable->pScreen);
- KaaScreenPriv (pDrawable->pScreen);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- PixmapPtr pPixmap;
- register BoxPtr pbox;
- BoxPtr pextent;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1, fullY2;
- int partX1, partX2, partY1, partY2;
- int xoff, yoff;
- int xorg, yorg;
- int n;
-
- if (!pScreenPriv->enabled ||
- pGC->fillStyle != FillSolid ||
- !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) ||
- !(*pKaaScr->info->PrepareSolid) (pPixmap,
- pGC->alu,
- pGC->planemask,
- pGC->fgPixel))
- {
- KdCheckPolyFillRect (pDrawable, pGC, nrect, prect);
- return;
- }
-
- xorg = pDrawable->x;
- yorg = pDrawable->y;
-
- pextent = REGION_EXTENTS(pGC->pScreen, pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
- while (nrect--)
- {
- fullX1 = prect->x + xorg;
- fullY1 = prect->y + yorg;
- fullX2 = fullX1 + (int) prect->width;
- fullY2 = fullY1 + (int) prect->height;
- prect++;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
-
- if (fullY1 < extentY1)
- fullY1 = extentY1;
-
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullY2 > extentY2)
- fullY2 = extentY2;
-
- if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
- continue;
- n = REGION_NUM_RECTS (pClip);
- if (n == 1)
- {
- (*pKaaScr->info->Solid) (fullX1 + xoff, fullY1 + yoff,
- fullX2 + xoff, fullY2 + yoff);
- }
- else
- {
- pbox = REGION_RECTS(pClip);
- /*
- * clip the rectangle to each box in the clip region
- * this is logically equivalent to calling Intersect()
- */
- while(n--)
- {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partY1 = pbox->y1;
- if (partY1 < fullY1)
- partY1 = fullY1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- partY2 = pbox->y2;
- if (partY2 > fullY2)
- partY2 = fullY2;
-
- pbox++;
-
- if (partX1 < partX2 && partY1 < partY2)
- (*pKaaScr->info->Solid) (partX1 + xoff, partY1 + yoff,
- partX2 + xoff, partY2 + yoff);
- }
- }
- }
- (*pKaaScr->info->DoneSolid) ();
- kaaDrawableDirty (pDrawable);
- KdMarkSync(pDrawable->pScreen);
-}
-
-static void
-kaaSolidBoxClipped (DrawablePtr pDrawable,
- RegionPtr pClip,
- FbBits pm,
- FbBits fg,
- int x1,
- int y1,
- int x2,
- int y2)
-{
- KdScreenPriv (pDrawable->pScreen);
- KaaScreenPriv (pDrawable->pScreen);
- PixmapPtr pPixmap;
- BoxPtr pbox;
- int nbox;
- int xoff, yoff;
- int partX1, partX2, partY1, partY2;
-
- if (!pScreenPriv->enabled ||
- !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) ||
- !(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg))
- {
- KdCheckSync (pDrawable->pScreen);
- fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel);
- fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2,
- fbAnd (GXcopy, fg, pm),
- fbXor (GXcopy, fg, pm));
- kaaDrawableDirty (pDrawable);
- return;
- }
- for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);
- nbox--;
- pbox++)
- {
- partX1 = pbox->x1;
- if (partX1 < x1)
- partX1 = x1;
-
- partX2 = pbox->x2;
- if (partX2 > x2)
- partX2 = x2;
-
- if (partX2 <= partX1)
- continue;
-
- partY1 = pbox->y1;
- if (partY1 < y1)
- partY1 = y1;
-
- partY2 = pbox->y2;
- if (partY2 > y2)
- partY2 = y2;
-
- if (partY2 <= partY1)
- continue;
-
- (*pKaaScr->info->Solid) (partX1 + xoff, partY1 + yoff,
- partX2 + xoff, partY2 + yoff);
- }
- (*pKaaScr->info->DoneSolid) ();
- kaaDrawableDirty (pDrawable);
- KdMarkSync(pDrawable->pScreen);
-}
-
-static void
-kaaImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase)
-{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- CharInfoPtr *ppci;
- CharInfoPtr pci;
- unsigned char *pglyph; /* pointer bits in glyph */
- int gWidth, gHeight; /* width and height of glyph */
- FbStride gStride; /* stride of glyph */
- Bool opaque;
- int n;
- int gx, gy;
- void (*glyph) (FbBits *,
- FbStride,
- int,
- FbStip *,
- FbBits,
- int,
- int);
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbBits depthMask;
-
- depthMask = FbFullMask(pDrawable->depth);
- if ((pGC->planemask & depthMask) != depthMask)
- {
- KdCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase);
- return;
- }
- glyph = 0;
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- switch (dstBpp) {
- case 8: glyph = fbGlyph8; break;
- case 16: glyph = fbGlyph16; break;
- case 24: glyph = fbGlyph24; break;
- case 32: glyph = fbGlyph32; break;
- }
-
- x += pDrawable->x;
- y += pDrawable->y;
-
- if (TERMINALFONT (pGC->font) && !glyph)
- {
- opaque = TRUE;
- }
- else
- {
- int xBack, widthBack;
- int yBack, heightBack;
-
- ppci = ppciInit;
- n = nglyph;
- widthBack = 0;
- while (n--)
- widthBack += (*ppci++)->metrics.characterWidth;
-
- xBack = x;
- if (widthBack < 0)
- {
- xBack += widthBack;
- widthBack = -widthBack;
- }
- yBack = y - FONTASCENT(pGC->font);
- heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- kaaSolidBoxClipped (pDrawable,
- fbGetCompositeClip(pGC),
- pGC->planemask,
- pGC->bgPixel,
- xBack,
- yBack,
- xBack + widthBack,
- yBack + heightBack);
- opaque = FALSE;
- }
-
- KdCheckSync (pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
-
- ppci = ppciInit;
- while (nglyph--)
- {
- pci = *ppci++;
- pglyph = FONTGLYPHBITS(pglyphBase, pci);
- gWidth = GLYPHWIDTHPIXELS(pci);
- gHeight = GLYPHHEIGHTPIXELS(pci);
- if (gWidth && gHeight)
- {
- gx = x + pci->metrics.leftSideBearing;
- gy = y - pci->metrics.ascent;
- if (glyph && gWidth <= sizeof (FbStip) * 8 &&
- fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
- {
- (*glyph) (dst + (gy + dstYoff) * dstStride,
- dstStride,
- dstBpp,
- (FbStip *) pglyph,
- pPriv->fg,
- gx + dstXoff,
- gHeight);
- }
- else
- {
- gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
- fbPutXYImage (pDrawable,
- fbGetCompositeClip(pGC),
- pPriv->fg,
- pPriv->bg,
- pPriv->pm,
- GXcopy,
- opaque,
-
- gx,
- gy,
- gWidth, gHeight,
-
- (FbStip *) pglyph,
- gStride,
- 0);
- }
- }
- x += pci->metrics.characterWidth;
- }
-}
-
-static const GCOps kaaOps = {
- kaaFillSpans,
- KdCheckSetSpans,
- KdCheckPutImage,
- kaaCopyArea,
- KdCheckCopyPlane,
- KdCheckPolyPoint,
- KdCheckPolylines,
- KdCheckPolySegment,
- miPolyRectangle,
- KdCheckPolyArc,
- miFillPolygon,
- kaaPolyFillRect,
- miPolyFillArc,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- kaaImageGlyphBlt,
- KdCheckPolyGlyphBlt,
- KdCheckPushPixels,
-#ifdef NEED_LINEHELPER
- ,NULL
-#endif
-};
-
-static void
-kaaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
-{
- fbValidateGC (pGC, changes, pDrawable);
-
- if (kaaDrawableIsOffscreen (pDrawable))
- pGC->ops = (GCOps *) &kaaOps;
- else
- pGC->ops = (GCOps *) &kdAsyncPixmapGCOps;
-}
-
-GCFuncs kaaGCFuncs = {
- kaaValidateGC,
- miChangeGC,
- miCopyGC,
- miDestroyGC,
- miChangeClip,
- miDestroyClip,
- miCopyClip
-};
-
-static int
-kaaCreateGC (GCPtr pGC)
-{
- if (!fbCreateGC (pGC))
- return FALSE;
-
- pGC->funcs = &kaaGCFuncs;
-
- return TRUE;
-}
-
-
-static void
-kaaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- RegionRec rgnDst;
- int dx, dy;
- PixmapPtr pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
-
- REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0);
-
- REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
-#ifdef COMPOSITE
- if (pPixmap->screen_x || pPixmap->screen_y)
- REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst,
- -pPixmap->screen_x, -pPixmap->screen_y);
-#endif
-
- fbCopyRegion (&pPixmap->drawable, &pPixmap->drawable,
- 0,
- &rgnDst, dx, dy, kaaCopyNtoN, 0, 0);
-
- REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
-}
-
-static void
-kaaFillRegionSolid (DrawablePtr pDrawable,
- RegionPtr pRegion,
- Pixel pixel)
-{
- KdScreenPriv(pDrawable->pScreen);
- KaaScreenPriv(pDrawable->pScreen);
- PixmapPtr pPixmap;
- int xoff, yoff;
-
- if (pScreenPriv->enabled &&
- (pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) &&
- (*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel))
- {
- int nbox = REGION_NUM_RECTS (pRegion);
- BoxPtr pBox = REGION_RECTS (pRegion);
-
- while (nbox--)
- {
- (*pKaaScr->info->Solid) (pBox->x1 + xoff, pBox->y1 + yoff,
- pBox->x2 + xoff, pBox->y2 + yoff);
- pBox++;
- }
- (*pKaaScr->info->DoneSolid) ();
- KdMarkSync(pDrawable->pScreen);
- }
- else
- {
- KdCheckSync (pDrawable->pScreen);
- fbFillRegionSolid (pDrawable, pRegion, 0,
- fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
- }
- kaaDrawableDirty (pDrawable);
-}
-
-#if 0
-static void
-kaaFillRegionTiled (DrawablePtr pDrawable,
- RegionPtr pRegion,
- Pixmap pTile)
-{
- else
- {
- KdCheckSync
-}
-#endif
-
-static void
-kaaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
-{
-
- if (!REGION_NUM_RECTS(pRegion))
- return;
- switch (what) {
- case PW_BACKGROUND:
- switch (pWin->backgroundState) {
- case None:
- return;
- case ParentRelative:
- do {
- pWin = pWin->parent;
- } while (pWin->backgroundState == ParentRelative);
- (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
- what);
- return;
- case BackgroundPixel:
- kaaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->background.pixel);
- return;
-#if 0
- case BackgroundPixmap:
- kaaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin->background.pixmap);
- return;
-#endif
- }
- break;
- case PW_BORDER:
- if (pWin->borderIsPixel)
- {
- kaaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->border.pixel);
- return;
- }
-#if 0
- else
- {
- kaaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin->border.pixmap);
- return;
- }
-#endif
- break;
- }
- KdCheckPaintWindow (pWin, pRegion, what);
-}
-
-Bool
-kaaDrawInit (ScreenPtr pScreen,
- KaaScreenInfoPtr pScreenInfo)
-{
- KaaScreenPrivPtr pKaaScr;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
-#ifdef RENDER
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-#endif
-
- if (kaaGeneration != serverGeneration)
- {
- kaaScreenPrivateIndex = AllocateScreenPrivateIndex();
- kaaPixmapPrivateIndex = AllocatePixmapPrivateIndex();
- kaaGeneration = serverGeneration;
- }
-
- pKaaScr = xalloc (sizeof (KaaScreenPrivRec));
-
- if (!pKaaScr)
- return FALSE;
-
- pKaaScr->info = pScreenInfo;
-
- pScreen->devPrivates[kaaScreenPrivateIndex].ptr = (pointer) pKaaScr;
-
- /*
- * Hook up asynchronous drawing
- */
- KdScreenInitAsync (pScreen);
- /*
- * Replace various fb screen functions
- */
- pScreen->CreateGC = kaaCreateGC;
- pScreen->CopyWindow = kaaCopyWindow;
- pScreen->PaintWindowBackground = kaaPaintWindow;
- pScreen->PaintWindowBorder = kaaPaintWindow;
-#ifdef RENDER
- if (ps) {
- ps->Composite = kaaComposite;
- ps->RasterizeTrapezoid = kaaRasterizeTrapezoid;
- }
-#endif
-
- /*
- * Hookup offscreen pixmaps
- */
- if ((pKaaScr->info->flags & KAA_OFFSCREEN_PIXMAPS) &&
- screen->off_screen_base < screen->memory_size)
- {
- if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex,
- sizeof (KaaPixmapPrivRec)))
- return FALSE;
- pScreen->CreatePixmap = kaaCreatePixmap;
- pScreen->DestroyPixmap = kaaDestroyPixmap;
- }
- else
- {
- if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, 0))
- return FALSE;
- }
-
- return TRUE;
-}
-
-void
-kaaDrawFini (ScreenPtr pScreen)
-{
- KaaScreenPriv(pScreen);
-
- xfree (pKaaScr);
-}
diff --git a/hw/kdrive/src/kaa.h b/hw/kdrive/src/kaa.h
deleted file mode 100644
index 27f991742..000000000
--- a/hw/kdrive/src/kaa.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * $RCSId: $
- *
- * Copyright © 2001 Keith Packard
- *
- * Partly based on code that is Copyright © 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 _KAA_H_
-#define _KAA_H_
-
-#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr)(s)->devPrivates[kaaScreenPrivateIndex].ptr)
-#define KaaScreenPriv(s) KaaScreenPrivPtr pKaaScr = KaaGetScreenPriv(s)
-
-#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr)(p)->devPrivates[kaaPixmapPrivateIndex].ptr)
-#define KaaSetPixmapPriv(p,a) ((p)->devPrivates[kaaPixmapPrivateIndex].ptr = (pointer) (a))
-#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p)
-
-typedef struct {
- KaaScreenInfoPtr info;
-} KaaScreenPrivRec, *KaaScreenPrivPtr;
-
-typedef struct {
- KdOffscreenArea *area;
- int score;
- int devKind;
- DevUnion devPrivate;
- Bool dirty;
-} KaaPixmapPrivRec, *KaaPixmapPrivPtr;
-
-extern int kaaScreenPrivateIndex;
-extern int kaaPixmapPrivateIndex;
-
-
-void
-kaaPixmapUseScreen (PixmapPtr pPixmap);
-
-void
-kaaPixmapUseMemory (PixmapPtr pPixmap);
-
-void
-kaaDrawableDirty(DrawablePtr pDrawable);
-
-Bool
-kaaDrawableIsOffscreen (DrawablePtr pDrawable);
-
-Bool
-kaaPixmapIsOffscreen(PixmapPtr p);
-
-PixmapPtr
-kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
-
-void
-kaaMoveInPixmap (PixmapPtr pPixmap);
-
-void
-kaaCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
-
-void
-kaaComposite(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void
-kaaRasterizeTrapezoid(PicturePtr pPict,
- xTrapezoid *trap,
- int xoff,
- int yoff);
-
-void
-kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets,
- float x_offset, float y_offset);
-
-#endif /* _KAA_H_ */
diff --git a/hw/kdrive/src/kaapict.c b/hw/kdrive/src/kaapict.c
deleted file mode 100644
index 1e4d2ef61..000000000
--- a/hw/kdrive/src/kaapict.c
+++ /dev/null
@@ -1,720 +0,0 @@
-/*
- * $RCSId$
- *
- * Copyright © 2001 Keith Packard
- *
- * Partly based on code that is Copyright © 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "kaa.h"
-
-#ifdef RENDER
-#include "mipict.h"
-
-#define KAA_DEBUG_FALLBACKS 0
-
-#if KAA_DEBUG_FALLBACKS
-static void kaaCompositeFallbackPictDesc(PicturePtr pict, char *string, int n)
-{
- char format[20];
- char size[20];
- char loc;
- int temp;
-
- if (!pict) {
- snprintf(string, n, "None");
- return;
- }
-
- switch (pict->format)
- {
- case PICT_a8r8g8b8:
- snprintf(format, 20, "ARGB8888");
- break;
- case PICT_r5g6b5:
- snprintf(format, 20, "RGB565 ");
- break;
- case PICT_x1r5g5b5:
- snprintf(format, 20, "RGB555 ");
- break;
- case PICT_a8:
- snprintf(format, 20, "A8 ");
- break;
- case PICT_a1:
- snprintf(format, 20, "A1 ");
- break;
- default:
- snprintf(format, 20, "0x%x", (int)pict->format);
- break;
- }
-
- loc = kaaGetOffscreenPixmap(pict->pDrawable, &temp, &temp) ? 's' : 'm';
-
- snprintf(size, 20, "%dx%d%s", pict->pDrawable->width,
- pict->pDrawable->height, pict->repeat ?
- " R" : "");
-
- snprintf(string, n, "0x%lx:%c fmt %s (%s)", (long)pict, loc, format, size);
-}
-
-static void
-kaaPrintCompositeFallback(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst)
-{
- char sop[20];
- char srcdesc[40], maskdesc[40], dstdesc[40];
-
- switch(op)
- {
- case PictOpSrc:
- sprintf(sop, "Src");
- break;
- case PictOpOver:
- sprintf(sop, "Over");
- break;
- default:
- sprintf(sop, "0x%x", (int)op);
- break;
- }
-
- kaaCompositeFallbackPictDesc(pSrc, srcdesc, 40);
- kaaCompositeFallbackPictDesc(pMask, maskdesc, 40);
- kaaCompositeFallbackPictDesc(pDst, dstdesc, 40);
-
- ErrorF("Composite fallback: op %s, \n"
- " src %s, \n"
- " mask %s, \n"
- " dst %s, \n",
- sop, srcdesc, maskdesc, dstdesc);
-}
-
-static void
-kaaPrintTrapezoidFallback(PicturePtr pDst)
-{
- char dstdesc[40];
-
- kaaCompositeFallbackPictDesc(pDst, dstdesc, 40);
-
- ErrorF("Trapezoid fallback: dst %s, %c/%s\n",
- dstdesc,
- (pDst->polyMode == PolyModePrecise) ? 'p' : 'i',
- (pDst->polyEdge == PolyEdgeSharp) ? "a" : "aa");
-}
-#endif
-
-static Bool
-kaaGetPixelFromRGBA(CARD32 *pixel,
- CARD16 red,
- CARD16 green,
- CARD16 blue,
- CARD16 alpha,
- CARD32 format)
-{
- int rbits, bbits, gbits, abits;
- int rshift, bshift, gshift, ashift;
-
- *pixel = 0;
-
- if (!PICT_FORMAT_COLOR(format))
- return FALSE;
-
- rbits = PICT_FORMAT_R(format);
- gbits = PICT_FORMAT_G(format);
- bbits = PICT_FORMAT_B(format);
- abits = PICT_FORMAT_A(format);
-
- if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
- bshift = 0;
- gshift = bbits;
- rshift = gshift + gbits;
- ashift = rshift + rbits;
- } else { /* PICT_TYPE_ABGR */
- rshift = 0;
- gshift = rbits;
- bshift = gshift + gbits;
- ashift = bshift + bbits;
- }
-
- *pixel |= ( blue >> (16 - bbits)) << bshift;
- *pixel |= ( red >> (16 - rbits)) << rshift;
- *pixel |= (green >> (16 - gbits)) << gshift;
- *pixel |= (alpha >> (16 - abits)) << ashift;
-
- return TRUE;
-}
-
-
-static Bool
-kaaGetRGBAFromPixel(CARD32 pixel,
- CARD16 *red,
- CARD16 *green,
- CARD16 *blue,
- CARD16 *alpha,
- CARD32 format)
-{
- int rbits, bbits, gbits, abits;
- int rshift, bshift, gshift, ashift;
-
- if (!PICT_FORMAT_COLOR(format))
- return FALSE;
-
- rbits = PICT_FORMAT_R(format);
- gbits = PICT_FORMAT_G(format);
- bbits = PICT_FORMAT_B(format);
- abits = PICT_FORMAT_A(format);
-
- if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
- bshift = 0;
- gshift = bbits;
- rshift = gshift + gbits;
- ashift = rshift + rbits;
- } else { /* PICT_TYPE_ABGR */
- rshift = 0;
- gshift = rbits;
- bshift = gshift + gbits;
- ashift = bshift + bbits;
- }
-
- *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
- while (rbits < 16) {
- *red |= *red >> rbits;
- rbits <<= 1;
- }
-
- *green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits);
- while (gbits < 16) {
- *green |= *green >> gbits;
- gbits <<= 1;
- }
-
- *blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits);
- while (bbits < 16) {
- *blue |= *blue >> bbits;
- bbits <<= 1;
- }
-
- if (abits) {
- *alpha = ((pixel >> ashift ) & ((1 << abits) - 1)) << (16 - abits);
- while (abits < 16) {
- *alpha |= *alpha >> abits;
- abits <<= 1;
- }
- } else
- *alpha = 0xffff;
-
- return TRUE;
-}
-
-static int
-kaaTryDriverSolidFill(PicturePtr pSrc,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- KaaScreenPriv (pDst->pDrawable->pScreen);
- RegionRec region;
- BoxPtr pbox;
- int nbox;
- int dst_off_x, dst_off_y;
- PixmapPtr pSrcPix, pDstPix;
- CARD32 pixel;
- CARD16 red, green, blue, alpha;
-
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
-
- if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
- xSrc, ySrc, 0, 0, xDst, yDst,
- width, height))
- return 1;
-
- if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseMemory ((PixmapPtr) pSrc->pDrawable);
- if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable);
-
- pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
- if (!pDstPix) {
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return 0;
- }
-
- if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
- pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap)(
- (WindowPtr) (pSrc->pDrawable));
- else
- pSrcPix = (PixmapPtr) (pSrc->pDrawable);
-
- /* If source is offscreen, we need to sync the accelerator
- * before accessing it. We'd prefer for it to be in memory.
- */
- if (kaaPixmapIsOffscreen(pSrcPix)) {
- KdCheckSync(pDst->pDrawable->pScreen);
- }
-
- pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr);
- if (!kaaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha,
- pSrc->format))
- {
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return -1;
- }
- kaaGetPixelFromRGBA(&pixel, red, green, blue, alpha,
- pDst->format);
-
- if (!(*pKaaScr->info->PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel))
- {
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return -1;
- }
-
- nbox = REGION_NUM_RECTS(&region);
- pbox = REGION_RECTS(&region);
- while (nbox--)
- {
- (*pKaaScr->info->Solid) (pbox->x1 + dst_off_x,
- pbox->y1 + dst_off_y,
- pbox->x2 + dst_off_x,
- pbox->y2 + dst_off_y);
- pbox++;
- }
-
- (*pKaaScr->info->DoneSolid) ();
- KdMarkSync(pDst->pDrawable->pScreen);
- kaaDrawableDirty (pDst->pDrawable);
-
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return 1;
-}
-
-static int
-kaaTryDriverBlend(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- KaaScreenPriv (pDst->pDrawable->pScreen);
- RegionRec region;
- BoxPtr pbox;
- int nbox;
- int src_off_x, src_off_y, dst_off_x, dst_off_y;
- PixmapPtr pSrcPix, pDstPix;
- struct _Pixmap srcScratch;
-
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
-
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
-
- if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
- xSrc, ySrc, 0, 0, xDst, yDst,
- width, height))
- return 1;
-
-
- if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseScreen ((PixmapPtr) pSrc->pDrawable);
- if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable);
-
- pSrcPix = kaaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
- pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
-
- if (!pDstPix) {
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return 0;
- }
-
- if (!pSrcPix && pKaaScr->info->UploadToScratch) {
- if ((*pKaaScr->info->UploadToScratch) ((PixmapPtr) pSrc->pDrawable,
- &srcScratch))
- pSrcPix = &srcScratch;
- }
-
- if (!pSrcPix) {
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return 0;
- }
-
- if (!(*pKaaScr->info->PrepareBlend) (op, pSrc, pDst, pSrcPix,
- pDstPix))
- {
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return -1;
- }
-
- nbox = REGION_NUM_RECTS(&region);
- pbox = REGION_RECTS(&region);
-
- xSrc -= xDst;
- ySrc -= yDst;
-
- while (nbox--)
- {
- (*pKaaScr->info->Blend) (pbox->x1 + xSrc + src_off_x,
- pbox->y1 + ySrc + src_off_y,
- pbox->x1 + dst_off_x,
- pbox->y1 + dst_off_y,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
- pbox++;
- }
-
- (*pKaaScr->info->DoneBlend) ();
- KdMarkSync(pDst->pDrawable->pScreen);
- kaaDrawableDirty (pDst->pDrawable);
-
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return 1;
-}
-
-static int
-kaaTryDriverComposite(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- KaaScreenPriv (pDst->pDrawable->pScreen);
- RegionRec region;
- BoxPtr pbox;
- int nbox;
- int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
- PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
- struct _Pixmap scratch;
-
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
-
- if (pMask) {
- xMask += pMask->pDrawable->x;
- yMask += pMask->pDrawable->y;
- }
-
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height))
- return 1;
-
- if (pKaaScr->info->CheckComposite &&
- !(*pKaaScr->info->CheckComposite) (op, pSrc, pMask, pDst))
- {
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return -1;
- }
-
- if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseScreen ((PixmapPtr) pSrc->pDrawable);
- if (pMask && pMask->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseScreen ((PixmapPtr) pMask->pDrawable);
- if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable);
-
- pSrcPix = kaaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
- if (pMask)
- pMaskPix = kaaGetOffscreenPixmap (pMask->pDrawable, &mask_off_x,
- &mask_off_y);
- pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
-
- if (!pDstPix) {
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return 0;
- }
-
- if (!pSrcPix && (!pMask || pMaskPix) && pKaaScr->info->UploadToScratch) {
- if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
- pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap) (
- (WindowPtr) pSrc->pDrawable);
- else
- pSrcPix = (PixmapPtr) pSrc->pDrawable;
- if ((*pKaaScr->info->UploadToScratch) (pSrcPix, &scratch))
- pSrcPix = &scratch;
- } else if (pSrcPix && pMask && !pMaskPix && pKaaScr->info->UploadToScratch) {
- if (pMask->pDrawable->type == DRAWABLE_WINDOW)
- pMaskPix = (*pMask->pDrawable->pScreen->GetWindowPixmap) (
- (WindowPtr) pMask->pDrawable);
- else
- pMaskPix = (PixmapPtr) pMask->pDrawable;
- if ((*pKaaScr->info->UploadToScratch) (pMaskPix, &scratch))
- pMaskPix = &scratch;
- }
-
- if (!pSrcPix || (pMask && !pMaskPix)) {
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return 0;
- }
-
- if (!(*pKaaScr->info->PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix,
- pMaskPix, pDstPix))
- {
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return -1;
- }
-
- nbox = REGION_NUM_RECTS(&region);
- pbox = REGION_RECTS(&region);
-
- xMask -= xDst;
- yMask -= yDst;
-
- xSrc -= xDst;
- ySrc -= yDst;
-
- while (nbox--)
- {
- (*pKaaScr->info->Composite) (pbox->x1 + xSrc + src_off_x,
- pbox->y1 + ySrc + src_off_y,
- pbox->x1 + xMask + mask_off_x,
- pbox->y1 + yMask + mask_off_y,
- pbox->x1 + dst_off_x,
- pbox->y1 + dst_off_y,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
- pbox++;
- }
-
- (*pKaaScr->info->DoneComposite) ();
- KdMarkSync(pDst->pDrawable->pScreen);
- kaaDrawableDirty (pDst->pDrawable);
-
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return 1;
-}
-
-
-void
-kaaComposite(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- KdScreenPriv (pDst->pDrawable->pScreen);
- KaaScreenPriv (pDst->pDrawable->pScreen);
- int ret = -1;
-
- if (!pMask)
- {
- if (op == PictOpSrc)
- {
- if (pScreenPriv->enabled && pSrc->pDrawable->width == 1 &&
- pSrc->pDrawable->height == 1 && pSrc->repeat)
- {
- ret = kaaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst,
- width, height);
- if (ret == 1)
- return;
- }
- else if (!pSrc->repeat && !pSrc->transform &&
- pSrc->format == pDst->format)
- {
- RegionRec region;
-
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst,
- yDst, width, height))
- return;
-
-
- kaaCopyNtoN (pSrc->pDrawable, pDst->pDrawable, 0,
- REGION_RECTS(&region), REGION_NUM_RECTS(&region),
- xSrc - xDst, ySrc - yDst,
- FALSE, FALSE, 0, 0);
- return;
- }
- }
-
- if (pScreenPriv->enabled && pKaaScr->info->PrepareBlend &&
- !pSrc->alphaMap && !pDst->alphaMap)
- {
- ret = kaaTryDriverBlend(op, pSrc, pDst, xSrc, ySrc, xDst, yDst,
- width, height);
- if (ret == 1)
- return;
- }
- }
-
- if (pScreenPriv->enabled && pKaaScr->info->PrepareComposite &&
- !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
- {
- ret = kaaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask,
- yMask, xDst, yDst, width, height);
- if (ret == 1)
- return;
- }
-
- if (ret != 0) {
- /* failure to accelerate was not due to pixmaps being in the wrong
- * locations.
- */
- if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseMemory ((PixmapPtr) pSrc->pDrawable);
- if (pMask && pMask->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseMemory ((PixmapPtr) pMask->pDrawable);
- if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
- kaaPixmapUseMemory ((PixmapPtr) pDst->pDrawable);
- }
-
-#if KAA_DEBUG_FALLBACKS
- kaaPrintCompositeFallback (op, pSrc, pMask, pDst);
-#endif
-
- KdCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc,
- xMask, yMask, xDst, yDst, width, height);
-}
-#endif
-
-static xFixed
-miLineFixedX (xLineFixed *l, xFixed y, Bool ceil)
-{
- xFixed dx = l->p2.x - l->p1.x;
- xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
- xFixed dy = l->p2.y - l->p1.y;
- if (ceil)
- ex += (dy - 1);
- return l->p1.x + (xFixed) (ex / dy);
-}
-
-/* Need to decide just how much to trim, to maintain translation independence
- * when converted to floating point.
- */
-#define XFIXED_TO_FLOAT(x) (((float)((x) & 0xffffff00)) / 65536.0)
-
-/* This is just to allow us to work on the hardware side of the problem while
- * waiting for cairo to get a new tesselator. We may not be able to support
- * RasterizeTrapezoid at all due to the abutting edges requirement, but it might
- * be technically legal if we widened the trap by some epsilon, so that alpha
- * values at abutting edges were a little too big and capped at one, rather than
- * a little too small and looked bad.
- */
-void kaaRasterizeTrapezoid(PicturePtr pDst,
- xTrapezoid *trap,
- int xoff,
- int yoff)
-{
- KdScreenPriv (pDst->pDrawable->pScreen);
- KaaScreenPriv (pDst->pDrawable->pScreen);
- KaaTrapezoid ktrap;
- PixmapPtr pPix;
- xFixed x1, x2;
-
- if (!pScreenPriv->enabled ||
- !pKaaScr->info->PrepareTrapezoids ||
- pDst->pDrawable->type != DRAWABLE_PIXMAP ||
- pDst->alphaMap || pDst->format != PICT_a8)
- {
- KdCheckRasterizeTrapezoid (pDst, trap, xoff, yoff);
-#if KAA_DEBUG_FALLBACKS
- kaaPrintTrapezoidFallback (pDst);
-#endif
- return;
- }
- pPix = (PixmapPtr)pDst->pDrawable;
-
- kaaPixmapUseScreen (pPix);
-
- if (!kaaPixmapIsOffscreen (pPix) ||
- !(*pKaaScr->info->PrepareTrapezoids) (pDst, pPix))
- {
-#if KAA_DEBUG_FALLBACKS
- kaaPrintTrapezoidFallback (pDst);
-#endif
- KdCheckRasterizeTrapezoid (pDst, trap, xoff, yoff);
- return;
- }
-
- ktrap.ty = XFIXED_TO_FLOAT(trap->top) + yoff;
- x1 = miLineFixedX (&trap->left, trap->top, FALSE);
- x2 = miLineFixedX (&trap->right, trap->top, TRUE);
- ktrap.tl = XFIXED_TO_FLOAT(x1) + xoff;
- ktrap.tr = XFIXED_TO_FLOAT(x2) + xoff;
- ktrap.by = XFIXED_TO_FLOAT(trap->bottom) + yoff;
- x1 = miLineFixedX (&trap->left, trap->bottom, FALSE);
- x2 = miLineFixedX (&trap->right, trap->bottom, TRUE);
- ktrap.bl = XFIXED_TO_FLOAT(x1) + xoff;
- ktrap.br = XFIXED_TO_FLOAT(x2) + xoff;
-
- (*pKaaScr->info->Trapezoids) (&ktrap, 1);
- (*pKaaScr->info->DoneTrapezoids) ();
-}
-
-void
-kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets,
- float x_offset, float y_offset)
-{
- int i = 0;
- float x, y, x_count, y_count;
-
- x_count = (1 << (grid_order / 2)) + 1;
- y_count = (1 << (grid_order / 2)) - 1;
-
- x_offset += 1.0 / x_count / 2.0;
- y_offset += 1.0 / y_count / 2.0;
-
- for (x = 0; x < x_count; x++) {
- for (y = 0; y < y_count; y++) {
- x_offsets[i] = x / x_count + x_offset;
- y_offsets[i] = y / y_count + y_offset;
- i++;
- }
- }
-}
-
diff --git a/hw/kdrive/src/kasync.c b/hw/kdrive/src/kasync.c
deleted file mode 100644
index 4cb1e3b6b..000000000
--- a/hw/kdrive/src/kasync.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Id: kasync.c,v 1.3 1999/11/24 04:29:28 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kasync.c,v 1.8 2001/03/30 02:15:19 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "kaa.h"
-
-/*
- * These functions wrap the low-level fb rendering functions and
- * synchronize framebuffer/accelerated drawing by stalling until
- * the accelerator is idle
- */
-
-void
-KdCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- KdCheckSync (pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbFillSpans (pDrawable, pGC, nspans, ppt, pwidth, fSorted);
-}
-
-void
-KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
- DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
-{
- KdCheckSync (pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbSetSpans (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
-}
-
-void
-KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
- int x, int y, int w, int h, int leftPad, int format,
- char *bits)
-{
- KdCheckSync (pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits);
-}
-
-RegionPtr
-KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty)
-{
- KdCheckSync (pSrc->pScreen);
- kaaDrawableDirty (pDst);
- return fbCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
-}
-
-RegionPtr
-KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty,
- unsigned long bitPlane)
-{
- KdCheckSync (pSrc->pScreen);
- kaaDrawableDirty (pDst);
- return fbCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty,
- bitPlane);
-}
-
-void
-KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
- DDXPointPtr pptInit)
-{
- KdCheckSync (pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbPolyPoint (pDrawable, pGC, mode, npt, pptInit);
-}
-
-void
-KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr ppt)
-{
-
- if (pGC->lineWidth == 0) {
- KdCheckSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- }
- kaaDrawableDirty (pDrawable);
- fbPolyLine (pDrawable, pGC, mode, npt, ppt);
-}
-
-void
-KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
- int nsegInit, xSegment *pSegInit)
-{
- if (pGC->lineWidth == 0) {
- KdCheckSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- }
- kaaDrawableDirty (pDrawable);
- fbPolySegment (pDrawable, pGC, nsegInit, pSegInit);
-}
-
-void
-KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC,
- int nrects, xRectangle *prect)
-{
- if (pGC->lineWidth == 0) {
- KdCheckSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- }
- fbPolyRectangle (pDrawable, pGC, nrects, prect);
-}
-
-void
-KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *pArcs)
-{
- if (pGC->lineWidth == 0)
- {
- KdCheckSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbPolyArc (pDrawable, pGC, narcs, pArcs);
- }
- else
- miPolyArc (pDrawable, pGC, narcs, pArcs);
-}
-
-#if 0
-void
-KdCheckFillPolygon (DrawablePtr pDrawable, GCPtr pGC,
- int shape, int mode, int count, DDXPointPtr pPts)
-{
- KdCheckSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbFillPolygon (pDrawable, pGC, mode, count, pPts);
-}
-#endif
-
-void
-KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrect, xRectangle *prect)
-{
- KdCheckSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbPolyFillRect (pDrawable, pGC, nrect, prect);
-}
-
-void
-KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *pArcs)
-{
- KdCheckSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbPolyFillArc (pDrawable, pGC, narcs, pArcs);
-}
-
-void
-KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
-{
- KdCheckSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-}
-
-void
-KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
-{
- KdCheckSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-}
-
-void
-KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w, int h, int x, int y)
-{
- KdCheckSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbPushPixels (pGC, pBitmap, pDrawable, w, h, x, y);
-}
-
-void
-KdCheckGetImage (DrawablePtr pDrawable,
- int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask,
- char *d)
-{
- KdCheckSync(pDrawable->pScreen);
- fbGetImage (pDrawable, x, y, w, h, format, planeMask, d);
-}
-
-void
-KdCheckGetSpans (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pdstStart)
-{
- KdCheckSync(pDrawable->pScreen);
- fbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
-}
-
-void
-KdCheckSaveAreas (PixmapPtr pPixmap,
- RegionPtr prgnSave,
- int xorg,
- int yorg,
- WindowPtr pWin)
-{
- KdCheckSync(pWin->drawable.pScreen);
- kaaDrawableDirty (&pPixmap->drawable);
- fbSaveAreas (pPixmap, prgnSave, xorg, yorg, pWin);
-}
-
-void
-KdCheckRestoreAreas (PixmapPtr pPixmap,
- RegionPtr prgnSave,
- int xorg,
- int yorg,
- WindowPtr pWin)
-{
- KdCheckSync(pWin->drawable.pScreen);
- kaaDrawableDirty ((DrawablePtr)pWin);
- fbRestoreAreas (pPixmap, prgnSave, xorg, yorg, pWin);
-}
-
-void
-KdCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what)
-{
- KdCheckSync (pWin->drawable.pScreen);
- kaaDrawableDirty ((DrawablePtr)pWin);
- fbPaintWindow (pWin, pRegion, what);
-}
-
-void
-KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- KdCheckSync (pWin->drawable.pScreen);
- kaaDrawableDirty ((DrawablePtr)pWin);
- fbCopyWindow (pWin, ptOldOrg, prgnSrc);
-}
-
-#if KD_MAX_FB > 1
-void
-KdCheckPaintKey(DrawablePtr pDrawable,
- RegionPtr pRegion,
- CARD32 pixel,
- int layer)
-{
- KdCheckSync (pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbOverlayPaintKey (pDrawable, pRegion, pixel, layer);
-}
-
-void
-KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- KdCheckSync (pWin->drawable.pScreen);
- kaaDrawableDirty ((DrawablePtr)pWin);
- fbOverlayCopyWindow (pWin, ptOldOrg, prgnSrc);
-}
-#endif
-
-void
-KdScreenInitAsync (ScreenPtr pScreen)
-{
- pScreen->GetImage = KdCheckGetImage;
- pScreen->GetSpans = KdCheckGetSpans;
- pScreen->PaintWindowBackground = KdCheckPaintWindow;
- pScreen->PaintWindowBorder = KdCheckPaintWindow;
- pScreen->CopyWindow = KdCheckCopyWindow;
-
-#ifndef FB_OLD_SCREEN
- pScreen->BackingStoreFuncs.SaveAreas = KdCheckSaveAreas;
- pScreen->BackingStoreFuncs.RestoreAreas = KdCheckRestoreAreas;
-#else
- pScreenPriv->BackingStoreFuncs.SaveAreas = KdCheckSaveAreas;
- pScreenPriv->BackingStoreFuncs.RestoreAreas = KdCheckRestoreAreas;
-#endif
-#ifdef RENDER
- KdPictureInitAsync (pScreen);
-#endif
-}
-
-/*
- * Only need to stall for copyarea/copyplane
- */
-const GCOps kdAsyncPixmapGCOps = {
- fbFillSpans,
- fbSetSpans,
- fbPutImage,
- KdCheckCopyArea,
- KdCheckCopyPlane,
- fbPolyPoint,
- fbPolyLine,
- fbPolySegment,
- fbPolyRectangle,
- fbPolyArc,
- fbFillPolygon,
- fbPolyFillRect,
- fbPolyFillArc,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- fbImageGlyphBlt,
- fbPolyGlyphBlt,
- fbPushPixels
-#ifdef NEED_LINEHELPER
- ,NULL
-#endif
-};
diff --git a/hw/kdrive/src/kcmap.c b/hw/kdrive/src/kcmap.c
deleted file mode 100644
index 855dc6f02..000000000
--- a/hw/kdrive/src/kcmap.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Id: kcmap.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kcmap.c,v 1.4 2000/05/24 23:57:56 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-/*
- * Put the entire colormap into the DAC
- */
-
-void
-KdSetColormap (ScreenPtr pScreen, int fb)
-{
- KdScreenPriv(pScreen);
- ColormapPtr pCmap = pScreenPriv->pInstalledmap[fb];
- Pixel pixels[KD_MAX_PSEUDO_SIZE];
- xrgb colors[KD_MAX_PSEUDO_SIZE];
- xColorItem defs[KD_MAX_PSEUDO_SIZE];
- int i;
-
- if (!pScreenPriv->card->cfuncs->putColors)
- return;
- if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (!pCmap)
- return;
-
- /*
- * Make DIX convert pixels into RGB values -- this handles
- * true/direct as well as pseudo/static visuals
- */
-
- for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
- pixels[i] = i;
-
- QueryColors (pCmap, (1 << pScreenPriv->screen->fb[fb].depth), pixels, colors);
-
- for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
- {
- defs[i].pixel = i;
- defs[i].red = colors[i].red;
- defs[i].green = colors[i].green;
- defs[i].blue = colors[i].blue;
- defs[i].flags = DoRed|DoGreen|DoBlue;
- }
-
- (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb,
- (1 << pScreenPriv->screen->fb[fb].depth),
- defs);
-
- /* recolor hardware cursor */
- if (pScreenPriv->card->cfuncs->recolorCursor)
- (*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, 0, 0);
-}
-
-/*
- * When the hardware is enabled, save the hardware colors and store
- * the current colormap
- */
-void
-KdEnableColormap (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- int i;
- int fb;
- Bool done = FALSE;
-
- if (!pScreenPriv->card->cfuncs->putColors)
- return;
- for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
- {
- if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH && !done)
- {
- for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
- pScreenPriv->systemPalette[i].pixel = i;
- (*pScreenPriv->card->cfuncs->getColors) (pScreen, fb,
- (1 << pScreenPriv->screen->fb[fb].depth),
- pScreenPriv->systemPalette);
- done = TRUE;
- }
- KdSetColormap (pScreen, fb);
- }
-}
-
-void
-KdDisableColormap (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- int fb;
-
- if (!pScreenPriv->card->cfuncs->putColors)
- return;
- for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
- {
- if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH)
- {
- (*pScreenPriv->card->cfuncs->putColors) (pScreen, fb,
- (1 << pScreenPriv->screen->fb[fb].depth),
- pScreenPriv->systemPalette);
- break;
- }
- }
-}
-
-static int
-KdColormapFb (ColormapPtr pCmap)
-{
- ScreenPtr pScreen = pCmap->pScreen;
- KdScreenPriv (pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- int d;
- DepthPtr depth;
- int v;
- VisualID vid = pCmap->pVisual->vid;
- int fb;
-
- if (screen->fb[1].depth)
- {
- for (d = 0; d < pScreen->numDepths; d++)
- {
- depth = &pScreen->allowedDepths[d];
- for (v = 0; v < depth->numVids; v++)
- {
- if (depth->vids[v] == vid)
- {
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- {
- if (depth->depth == screen->fb[fb].depth)
- return fb;
- }
- }
- }
- }
- }
- return 0;
-}
-
-/*
- * KdInstallColormap
- *
- * This function is called when the server receives a request to install a
- * colormap or when the server needs to install one on its own, like when
- * there's no window manager running and the user has moved the pointer over
- * an X client window. It needs to build an identity Windows palette for the
- * colormap and realize it into the Windows system palette.
- */
-void
-KdInstallColormap (ColormapPtr pCmap)
-{
- KdScreenPriv(pCmap->pScreen);
- int fb = KdColormapFb (pCmap);
-
- if (pCmap == pScreenPriv->pInstalledmap[fb])
- return;
-
- /* Tell X clients that the installed colormap is going away. */
- if (pScreenPriv->pInstalledmap[fb])
- WalkTree(pScreenPriv->pInstalledmap[fb]->pScreen, TellLostMap,
- (pointer) &(pScreenPriv->pInstalledmap[fb]->mid));
-
- /* Take note of the new installed colorscreen-> */
- pScreenPriv->pInstalledmap[fb] = pCmap;
-
- KdSetColormap (pCmap->pScreen, fb);
-
- /* Tell X clients of the new colormap */
- WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &(pCmap->mid));
-}
-
-/*
- * KdUninstallColormap
- *
- * This function uninstalls a colormap by either installing
- * the default X colormap or erasing the installed colormap pointer.
- * The default X colormap itself cannot be uninstalled.
- */
-void
-KdUninstallColormap (ColormapPtr pCmap)
-{
- KdScreenPriv(pCmap->pScreen);
- int fb = KdColormapFb (pCmap);
- Colormap defMapID;
- ColormapPtr defMap;
-
- /* ignore if not installed */
- if (pCmap != pScreenPriv->pInstalledmap[fb])
- return;
-
- /* ignore attempts to uninstall default colormap */
- defMapID = pCmap->pScreen->defColormap;
- if ((Colormap) pCmap->mid == defMapID)
- return;
-
- /* install default if on same fb */
- defMap = (ColormapPtr) LookupIDByType(defMapID, RT_COLORMAP);
- if (defMap && KdColormapFb (defMap) == fb)
- (*pCmap->pScreen->InstallColormap)(defMap);
- else
- {
- /* uninstall and clear colormap pointer */
- WalkTree(pCmap->pScreen, TellLostMap,
- (pointer) &(pCmap->mid));
- pScreenPriv->pInstalledmap[fb] = 0;
- }
-}
-
-int
-KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps)
-{
- KdScreenPriv(pScreen);
- int fb;
- int n = 0;
-
- for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
- {
- if (pScreenPriv->pInstalledmap[fb])
- {
- *pCmaps++ = pScreenPriv->pInstalledmap[fb]->mid;
- n++;
- }
- }
- return n;
-}
-
-/*
- * KdStoreColors
- *
- * This function is called whenever the server receives a request to store
- * color values into one or more entries in the currently installed X
- * colormap; it can be either the default colormap or a private colorscreen->
- */
-void
-KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pCmap->pScreen);
- VisualPtr pVisual;
- xColorItem expanddefs[KD_MAX_PSEUDO_SIZE];
- int fb = KdColormapFb (pCmap);
-
- if (pCmap != pScreenPriv->pInstalledmap[fb])
- return;
-
- if (!pScreenPriv->card->cfuncs->putColors)
- return;
-
- if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- /* Check for DirectColor or TrueColor being simulated on a PseudoColor device. */
- pVisual = pCmap->pVisual;
- if ((pVisual->class | DynamicClass) == DirectColor)
- {
- /*
- * Expand DirectColor or TrueColor color values into a PseudoColor
- * format. Defer to the Color Framebuffer (CFB) code to do that.
- */
- ndef = fbExpandDirectColors(pCmap, ndef, pdefs, expanddefs);
- pdefs = expanddefs;
- }
-
- (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb, ndef, pdefs);
-
- /* recolor hardware cursor */
- if (pScreenPriv->card->cfuncs->recolorCursor)
- (*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, ndef, pdefs);
-}
diff --git a/hw/kdrive/src/kcolor.c b/hw/kdrive/src/kcolor.c
deleted file mode 100644
index bfff3a52c..000000000
--- a/hw/kdrive/src/kcolor.c
+++ /dev/null
@@ -1,884 +0,0 @@
-/*
- * Id: kcolor.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kcolor.c,v 1.2 1999/12/30 03:03:05 robin Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include <stdio.h>
-#include "os.h"
-#include "opaque.h"
-#include <X11/keysym.h>
-
-unsigned char
-KdToLower (unsigned char a)
-{
- if ((a >= XK_A) && (a <= XK_Z))
- return a + (XK_a - XK_A);
- else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis))
- return a + (XK_agrave - XK_Agrave);
- else if ((a >= XK_Ooblique) && (a <= XK_Thorn))
- return a + (XK_oslash - XK_Ooblique);
- else
- return a;
-}
-
-int
-KdStrCaseCmp (const unsigned char *s1, const unsigned char *s2, int l2)
-{
- unsigned char c1, c2;
-
- for (;;)
- {
- c1 = KdToLower (*s1++);
- if (l2 == 0)
- c2 = '\0';
- else
- c2 = KdToLower (*s2++);
- if (!c1 || !c2)
- break;
- if (c1 != c2)
- break;
- l2--;
- }
- return c2 - c1;
-}
-
-typedef struct _kdNamedColor {
- unsigned short red;
- unsigned short green;
- unsigned short blue;
- const unsigned char *name;
-} KdNamedColor;
-
-#define C 0x101
-
-const KdNamedColor KdColors[] = {
- { 240*C, 248*C, 255*C, "alice blue" },
- { 240*C, 248*C, 255*C, "AliceBlue" },
- { 250*C, 235*C, 215*C, "antique white" },
- { 250*C, 235*C, 215*C, "AntiqueWhite" },
- { 255*C, 239*C, 219*C, "AntiqueWhite1" },
- { 238*C, 223*C, 204*C, "AntiqueWhite2" },
- { 205*C, 192*C, 176*C, "AntiqueWhite3" },
- { 139*C, 131*C, 120*C, "AntiqueWhite4" },
- { 127*C, 255*C, 212*C, "aquamarine" },
- { 127*C, 255*C, 212*C, "aquamarine1" },
- { 118*C, 238*C, 198*C, "aquamarine2" },
- { 102*C, 205*C, 170*C, "aquamarine3" },
- { 69*C, 139*C, 116*C, "aquamarine4" },
- { 240*C, 255*C, 255*C, "azure" },
- { 240*C, 255*C, 255*C, "azure1" },
- { 224*C, 238*C, 238*C, "azure2" },
- { 193*C, 205*C, 205*C, "azure3" },
- { 131*C, 139*C, 139*C, "azure4" },
- { 245*C, 245*C, 220*C, "beige" },
- { 255*C, 228*C, 196*C, "bisque" },
- { 255*C, 228*C, 196*C, "bisque1" },
- { 238*C, 213*C, 183*C, "bisque2" },
- { 205*C, 183*C, 158*C, "bisque3" },
- { 139*C, 125*C, 107*C, "bisque4" },
- { 0*C, 0*C, 0*C, "black" },
- { 255*C, 235*C, 205*C, "blanched almond" },
- { 255*C, 235*C, 205*C, "BlanchedAlmond" },
- { 0*C, 0*C, 255*C, "blue" },
- { 138*C, 43*C, 226*C, "blue violet" },
- { 0*C, 0*C, 255*C, "blue1" },
- { 0*C, 0*C, 238*C, "blue2" },
- { 0*C, 0*C, 205*C, "blue3" },
- { 0*C, 0*C, 139*C, "blue4" },
- { 138*C, 43*C, 226*C, "BlueViolet" },
- { 165*C, 42*C, 42*C, "brown" },
- { 255*C, 64*C, 64*C, "brown1" },
- { 238*C, 59*C, 59*C, "brown2" },
- { 205*C, 51*C, 51*C, "brown3" },
- { 139*C, 35*C, 35*C, "brown4" },
- { 222*C, 184*C, 135*C, "burlywood" },
- { 255*C, 211*C, 155*C, "burlywood1" },
- { 238*C, 197*C, 145*C, "burlywood2" },
- { 205*C, 170*C, 125*C, "burlywood3" },
- { 139*C, 115*C, 85*C, "burlywood4" },
- { 95*C, 158*C, 160*C, "cadet blue" },
- { 95*C, 158*C, 160*C, "CadetBlue" },
- { 152*C, 245*C, 255*C, "CadetBlue1" },
- { 142*C, 229*C, 238*C, "CadetBlue2" },
- { 122*C, 197*C, 205*C, "CadetBlue3" },
- { 83*C, 134*C, 139*C, "CadetBlue4" },
- { 127*C, 255*C, 0*C, "chartreuse" },
- { 127*C, 255*C, 0*C, "chartreuse1" },
- { 118*C, 238*C, 0*C, "chartreuse2" },
- { 102*C, 205*C, 0*C, "chartreuse3" },
- { 69*C, 139*C, 0*C, "chartreuse4" },
- { 210*C, 105*C, 30*C, "chocolate" },
- { 255*C, 127*C, 36*C, "chocolate1" },
- { 238*C, 118*C, 33*C, "chocolate2" },
- { 205*C, 102*C, 29*C, "chocolate3" },
- { 139*C, 69*C, 19*C, "chocolate4" },
- { 255*C, 127*C, 80*C, "coral" },
- { 255*C, 114*C, 86*C, "coral1" },
- { 238*C, 106*C, 80*C, "coral2" },
- { 205*C, 91*C, 69*C, "coral3" },
- { 139*C, 62*C, 47*C, "coral4" },
- { 100*C, 149*C, 237*C, "cornflower blue" },
- { 100*C, 149*C, 237*C, "CornflowerBlue" },
- { 255*C, 248*C, 220*C, "cornsilk" },
- { 255*C, 248*C, 220*C, "cornsilk1" },
- { 238*C, 232*C, 205*C, "cornsilk2" },
- { 205*C, 200*C, 177*C, "cornsilk3" },
- { 139*C, 136*C, 120*C, "cornsilk4" },
- { 0*C, 255*C, 255*C, "cyan" },
- { 0*C, 255*C, 255*C, "cyan1" },
- { 0*C, 238*C, 238*C, "cyan2" },
- { 0*C, 205*C, 205*C, "cyan3" },
- { 0*C, 139*C, 139*C, "cyan4" },
- { 0*C, 0*C, 139*C, "dark blue" },
- { 0*C, 139*C, 139*C, "dark cyan" },
- { 184*C, 134*C, 11*C, "dark goldenrod" },
- { 169*C, 169*C, 169*C, "dark gray" },
- { 0*C, 100*C, 0*C, "dark green" },
- { 169*C, 169*C, 169*C, "dark grey" },
- { 189*C, 183*C, 107*C, "dark khaki" },
- { 139*C, 0*C, 139*C, "dark magenta" },
- { 85*C, 107*C, 47*C, "dark olive green" },
- { 255*C, 140*C, 0*C, "dark orange" },
- { 153*C, 50*C, 204*C, "dark orchid" },
- { 139*C, 0*C, 0*C, "dark red" },
- { 233*C, 150*C, 122*C, "dark salmon" },
- { 143*C, 188*C, 143*C, "dark sea green" },
- { 72*C, 61*C, 139*C, "dark slate blue" },
- { 47*C, 79*C, 79*C, "dark slate gray" },
- { 47*C, 79*C, 79*C, "dark slate grey" },
- { 0*C, 206*C, 209*C, "dark turquoise" },
- { 148*C, 0*C, 211*C, "dark violet" },
- { 0*C, 0*C, 139*C, "DarkBlue" },
- { 0*C, 139*C, 139*C, "DarkCyan" },
- { 184*C, 134*C, 11*C, "DarkGoldenrod" },
- { 255*C, 185*C, 15*C, "DarkGoldenrod1" },
- { 238*C, 173*C, 14*C, "DarkGoldenrod2" },
- { 205*C, 149*C, 12*C, "DarkGoldenrod3" },
- { 139*C, 101*C, 8*C, "DarkGoldenrod4" },
- { 169*C, 169*C, 169*C, "DarkGray" },
- { 0*C, 100*C, 0*C, "DarkGreen" },
- { 169*C, 169*C, 169*C, "DarkGrey" },
- { 189*C, 183*C, 107*C, "DarkKhaki" },
- { 139*C, 0*C, 139*C, "DarkMagenta" },
- { 85*C, 107*C, 47*C, "DarkOliveGreen" },
- { 202*C, 255*C, 112*C, "DarkOliveGreen1" },
- { 188*C, 238*C, 104*C, "DarkOliveGreen2" },
- { 162*C, 205*C, 90*C, "DarkOliveGreen3" },
- { 110*C, 139*C, 61*C, "DarkOliveGreen4" },
- { 255*C, 140*C, 0*C, "DarkOrange" },
- { 255*C, 127*C, 0*C, "DarkOrange1" },
- { 238*C, 118*C, 0*C, "DarkOrange2" },
- { 205*C, 102*C, 0*C, "DarkOrange3" },
- { 139*C, 69*C, 0*C, "DarkOrange4" },
- { 153*C, 50*C, 204*C, "DarkOrchid" },
- { 191*C, 62*C, 255*C, "DarkOrchid1" },
- { 178*C, 58*C, 238*C, "DarkOrchid2" },
- { 154*C, 50*C, 205*C, "DarkOrchid3" },
- { 104*C, 34*C, 139*C, "DarkOrchid4" },
- { 139*C, 0*C, 0*C, "DarkRed" },
- { 233*C, 150*C, 122*C, "DarkSalmon" },
- { 143*C, 188*C, 143*C, "DarkSeaGreen" },
- { 193*C, 255*C, 193*C, "DarkSeaGreen1" },
- { 180*C, 238*C, 180*C, "DarkSeaGreen2" },
- { 155*C, 205*C, 155*C, "DarkSeaGreen3" },
- { 105*C, 139*C, 105*C, "DarkSeaGreen4" },
- { 72*C, 61*C, 139*C, "DarkSlateBlue" },
- { 47*C, 79*C, 79*C, "DarkSlateGray" },
- { 151*C, 255*C, 255*C, "DarkSlateGray1" },
- { 141*C, 238*C, 238*C, "DarkSlateGray2" },
- { 121*C, 205*C, 205*C, "DarkSlateGray3" },
- { 82*C, 139*C, 139*C, "DarkSlateGray4" },
- { 47*C, 79*C, 79*C, "DarkSlateGrey" },
- { 0*C, 206*C, 209*C, "DarkTurquoise" },
- { 148*C, 0*C, 211*C, "DarkViolet" },
- { 255*C, 20*C, 147*C, "deep pink" },
- { 0*C, 191*C, 255*C, "deep sky blue" },
- { 255*C, 20*C, 147*C, "DeepPink" },
- { 255*C, 20*C, 147*C, "DeepPink1" },
- { 238*C, 18*C, 137*C, "DeepPink2" },
- { 205*C, 16*C, 118*C, "DeepPink3" },
- { 139*C, 10*C, 80*C, "DeepPink4" },
- { 0*C, 191*C, 255*C, "DeepSkyBlue" },
- { 0*C, 191*C, 255*C, "DeepSkyBlue1" },
- { 0*C, 178*C, 238*C, "DeepSkyBlue2" },
- { 0*C, 154*C, 205*C, "DeepSkyBlue3" },
- { 0*C, 104*C, 139*C, "DeepSkyBlue4" },
- { 105*C, 105*C, 105*C, "dim gray" },
- { 105*C, 105*C, 105*C, "dim grey" },
- { 105*C, 105*C, 105*C, "DimGray" },
- { 105*C, 105*C, 105*C, "DimGrey" },
- { 30*C, 144*C, 255*C, "dodger blue" },
- { 30*C, 144*C, 255*C, "DodgerBlue" },
- { 30*C, 144*C, 255*C, "DodgerBlue1" },
- { 28*C, 134*C, 238*C, "DodgerBlue2" },
- { 24*C, 116*C, 205*C, "DodgerBlue3" },
- { 16*C, 78*C, 139*C, "DodgerBlue4" },
- { 178*C, 34*C, 34*C, "firebrick" },
- { 255*C, 48*C, 48*C, "firebrick1" },
- { 238*C, 44*C, 44*C, "firebrick2" },
- { 205*C, 38*C, 38*C, "firebrick3" },
- { 139*C, 26*C, 26*C, "firebrick4" },
- { 255*C, 250*C, 240*C, "floral white" },
- { 255*C, 250*C, 240*C, "FloralWhite" },
- { 34*C, 139*C, 34*C, "forest green" },
- { 34*C, 139*C, 34*C, "ForestGreen" },
- { 220*C, 220*C, 220*C, "gainsboro" },
- { 248*C, 248*C, 255*C, "ghost white" },
- { 248*C, 248*C, 255*C, "GhostWhite" },
- { 255*C, 215*C, 0*C, "gold" },
- { 255*C, 215*C, 0*C, "gold1" },
- { 238*C, 201*C, 0*C, "gold2" },
- { 205*C, 173*C, 0*C, "gold3" },
- { 139*C, 117*C, 0*C, "gold4" },
- { 218*C, 165*C, 32*C, "goldenrod" },
- { 255*C, 193*C, 37*C, "goldenrod1" },
- { 238*C, 180*C, 34*C, "goldenrod2" },
- { 205*C, 155*C, 29*C, "goldenrod3" },
- { 139*C, 105*C, 20*C, "goldenrod4" },
- { 190*C, 190*C, 190*C, "gray" },
- { 0*C, 0*C, 0*C, "gray0" },
- { 3*C, 3*C, 3*C, "gray1" },
- { 26*C, 26*C, 26*C, "gray10" },
- { 255*C, 255*C, 255*C, "gray100" },
- { 28*C, 28*C, 28*C, "gray11" },
- { 31*C, 31*C, 31*C, "gray12" },
- { 33*C, 33*C, 33*C, "gray13" },
- { 36*C, 36*C, 36*C, "gray14" },
- { 38*C, 38*C, 38*C, "gray15" },
- { 41*C, 41*C, 41*C, "gray16" },
- { 43*C, 43*C, 43*C, "gray17" },
- { 46*C, 46*C, 46*C, "gray18" },
- { 48*C, 48*C, 48*C, "gray19" },
- { 5*C, 5*C, 5*C, "gray2" },
- { 51*C, 51*C, 51*C, "gray20" },
- { 54*C, 54*C, 54*C, "gray21" },
- { 56*C, 56*C, 56*C, "gray22" },
- { 59*C, 59*C, 59*C, "gray23" },
- { 61*C, 61*C, 61*C, "gray24" },
- { 64*C, 64*C, 64*C, "gray25" },
- { 66*C, 66*C, 66*C, "gray26" },
- { 69*C, 69*C, 69*C, "gray27" },
- { 71*C, 71*C, 71*C, "gray28" },
- { 74*C, 74*C, 74*C, "gray29" },
- { 8*C, 8*C, 8*C, "gray3" },
- { 77*C, 77*C, 77*C, "gray30" },
- { 79*C, 79*C, 79*C, "gray31" },
- { 82*C, 82*C, 82*C, "gray32" },
- { 84*C, 84*C, 84*C, "gray33" },
- { 87*C, 87*C, 87*C, "gray34" },
- { 89*C, 89*C, 89*C, "gray35" },
- { 92*C, 92*C, 92*C, "gray36" },
- { 94*C, 94*C, 94*C, "gray37" },
- { 97*C, 97*C, 97*C, "gray38" },
- { 99*C, 99*C, 99*C, "gray39" },
- { 10*C, 10*C, 10*C, "gray4" },
- { 102*C, 102*C, 102*C, "gray40" },
- { 105*C, 105*C, 105*C, "gray41" },
- { 107*C, 107*C, 107*C, "gray42" },
- { 110*C, 110*C, 110*C, "gray43" },
- { 112*C, 112*C, 112*C, "gray44" },
- { 115*C, 115*C, 115*C, "gray45" },
- { 117*C, 117*C, 117*C, "gray46" },
- { 120*C, 120*C, 120*C, "gray47" },
- { 122*C, 122*C, 122*C, "gray48" },
- { 125*C, 125*C, 125*C, "gray49" },
- { 13*C, 13*C, 13*C, "gray5" },
- { 127*C, 127*C, 127*C, "gray50" },
- { 130*C, 130*C, 130*C, "gray51" },
- { 133*C, 133*C, 133*C, "gray52" },
- { 135*C, 135*C, 135*C, "gray53" },
- { 138*C, 138*C, 138*C, "gray54" },
- { 140*C, 140*C, 140*C, "gray55" },
- { 143*C, 143*C, 143*C, "gray56" },
- { 145*C, 145*C, 145*C, "gray57" },
- { 148*C, 148*C, 148*C, "gray58" },
- { 150*C, 150*C, 150*C, "gray59" },
- { 15*C, 15*C, 15*C, "gray6" },
- { 153*C, 153*C, 153*C, "gray60" },
- { 156*C, 156*C, 156*C, "gray61" },
- { 158*C, 158*C, 158*C, "gray62" },
- { 161*C, 161*C, 161*C, "gray63" },
- { 163*C, 163*C, 163*C, "gray64" },
- { 166*C, 166*C, 166*C, "gray65" },
- { 168*C, 168*C, 168*C, "gray66" },
- { 171*C, 171*C, 171*C, "gray67" },
- { 173*C, 173*C, 173*C, "gray68" },
- { 176*C, 176*C, 176*C, "gray69" },
- { 18*C, 18*C, 18*C, "gray7" },
- { 179*C, 179*C, 179*C, "gray70" },
- { 181*C, 181*C, 181*C, "gray71" },
- { 184*C, 184*C, 184*C, "gray72" },
- { 186*C, 186*C, 186*C, "gray73" },
- { 189*C, 189*C, 189*C, "gray74" },
- { 191*C, 191*C, 191*C, "gray75" },
- { 194*C, 194*C, 194*C, "gray76" },
- { 196*C, 196*C, 196*C, "gray77" },
- { 199*C, 199*C, 199*C, "gray78" },
- { 201*C, 201*C, 201*C, "gray79" },
- { 20*C, 20*C, 20*C, "gray8" },
- { 204*C, 204*C, 204*C, "gray80" },
- { 207*C, 207*C, 207*C, "gray81" },
- { 209*C, 209*C, 209*C, "gray82" },
- { 212*C, 212*C, 212*C, "gray83" },
- { 214*C, 214*C, 214*C, "gray84" },
- { 217*C, 217*C, 217*C, "gray85" },
- { 219*C, 219*C, 219*C, "gray86" },
- { 222*C, 222*C, 222*C, "gray87" },
- { 224*C, 224*C, 224*C, "gray88" },
- { 227*C, 227*C, 227*C, "gray89" },
- { 23*C, 23*C, 23*C, "gray9" },
- { 229*C, 229*C, 229*C, "gray90" },
- { 232*C, 232*C, 232*C, "gray91" },
- { 235*C, 235*C, 235*C, "gray92" },
- { 237*C, 237*C, 237*C, "gray93" },
- { 240*C, 240*C, 240*C, "gray94" },
- { 242*C, 242*C, 242*C, "gray95" },
- { 245*C, 245*C, 245*C, "gray96" },
- { 247*C, 247*C, 247*C, "gray97" },
- { 250*C, 250*C, 250*C, "gray98" },
- { 252*C, 252*C, 252*C, "gray99" },
- { 0*C, 255*C, 0*C, "green" },
- { 173*C, 255*C, 47*C, "green yellow" },
- { 0*C, 255*C, 0*C, "green1" },
- { 0*C, 238*C, 0*C, "green2" },
- { 0*C, 205*C, 0*C, "green3" },
- { 0*C, 139*C, 0*C, "green4" },
- { 173*C, 255*C, 47*C, "GreenYellow" },
- { 190*C, 190*C, 190*C, "grey" },
- { 0*C, 0*C, 0*C, "grey0" },
- { 3*C, 3*C, 3*C, "grey1" },
- { 26*C, 26*C, 26*C, "grey10" },
- { 255*C, 255*C, 255*C, "grey100" },
- { 28*C, 28*C, 28*C, "grey11" },
- { 31*C, 31*C, 31*C, "grey12" },
- { 33*C, 33*C, 33*C, "grey13" },
- { 36*C, 36*C, 36*C, "grey14" },
- { 38*C, 38*C, 38*C, "grey15" },
- { 41*C, 41*C, 41*C, "grey16" },
- { 43*C, 43*C, 43*C, "grey17" },
- { 46*C, 46*C, 46*C, "grey18" },
- { 48*C, 48*C, 48*C, "grey19" },
- { 5*C, 5*C, 5*C, "grey2" },
- { 51*C, 51*C, 51*C, "grey20" },
- { 54*C, 54*C, 54*C, "grey21" },
- { 56*C, 56*C, 56*C, "grey22" },
- { 59*C, 59*C, 59*C, "grey23" },
- { 61*C, 61*C, 61*C, "grey24" },
- { 64*C, 64*C, 64*C, "grey25" },
- { 66*C, 66*C, 66*C, "grey26" },
- { 69*C, 69*C, 69*C, "grey27" },
- { 71*C, 71*C, 71*C, "grey28" },
- { 74*C, 74*C, 74*C, "grey29" },
- { 8*C, 8*C, 8*C, "grey3" },
- { 77*C, 77*C, 77*C, "grey30" },
- { 79*C, 79*C, 79*C, "grey31" },
- { 82*C, 82*C, 82*C, "grey32" },
- { 84*C, 84*C, 84*C, "grey33" },
- { 87*C, 87*C, 87*C, "grey34" },
- { 89*C, 89*C, 89*C, "grey35" },
- { 92*C, 92*C, 92*C, "grey36" },
- { 94*C, 94*C, 94*C, "grey37" },
- { 97*C, 97*C, 97*C, "grey38" },
- { 99*C, 99*C, 99*C, "grey39" },
- { 10*C, 10*C, 10*C, "grey4" },
- { 102*C, 102*C, 102*C, "grey40" },
- { 105*C, 105*C, 105*C, "grey41" },
- { 107*C, 107*C, 107*C, "grey42" },
- { 110*C, 110*C, 110*C, "grey43" },
- { 112*C, 112*C, 112*C, "grey44" },
- { 115*C, 115*C, 115*C, "grey45" },
- { 117*C, 117*C, 117*C, "grey46" },
- { 120*C, 120*C, 120*C, "grey47" },
- { 122*C, 122*C, 122*C, "grey48" },
- { 125*C, 125*C, 125*C, "grey49" },
- { 13*C, 13*C, 13*C, "grey5" },
- { 127*C, 127*C, 127*C, "grey50" },
- { 130*C, 130*C, 130*C, "grey51" },
- { 133*C, 133*C, 133*C, "grey52" },
- { 135*C, 135*C, 135*C, "grey53" },
- { 138*C, 138*C, 138*C, "grey54" },
- { 140*C, 140*C, 140*C, "grey55" },
- { 143*C, 143*C, 143*C, "grey56" },
- { 145*C, 145*C, 145*C, "grey57" },
- { 148*C, 148*C, 148*C, "grey58" },
- { 150*C, 150*C, 150*C, "grey59" },
- { 15*C, 15*C, 15*C, "grey6" },
- { 153*C, 153*C, 153*C, "grey60" },
- { 156*C, 156*C, 156*C, "grey61" },
- { 158*C, 158*C, 158*C, "grey62" },
- { 161*C, 161*C, 161*C, "grey63" },
- { 163*C, 163*C, 163*C, "grey64" },
- { 166*C, 166*C, 166*C, "grey65" },
- { 168*C, 168*C, 168*C, "grey66" },
- { 171*C, 171*C, 171*C, "grey67" },
- { 173*C, 173*C, 173*C, "grey68" },
- { 176*C, 176*C, 176*C, "grey69" },
- { 18*C, 18*C, 18*C, "grey7" },
- { 179*C, 179*C, 179*C, "grey70" },
- { 181*C, 181*C, 181*C, "grey71" },
- { 184*C, 184*C, 184*C, "grey72" },
- { 186*C, 186*C, 186*C, "grey73" },
- { 189*C, 189*C, 189*C, "grey74" },
- { 191*C, 191*C, 191*C, "grey75" },
- { 194*C, 194*C, 194*C, "grey76" },
- { 196*C, 196*C, 196*C, "grey77" },
- { 199*C, 199*C, 199*C, "grey78" },
- { 201*C, 201*C, 201*C, "grey79" },
- { 20*C, 20*C, 20*C, "grey8" },
- { 204*C, 204*C, 204*C, "grey80" },
- { 207*C, 207*C, 207*C, "grey81" },
- { 209*C, 209*C, 209*C, "grey82" },
- { 212*C, 212*C, 212*C, "grey83" },
- { 214*C, 214*C, 214*C, "grey84" },
- { 217*C, 217*C, 217*C, "grey85" },
- { 219*C, 219*C, 219*C, "grey86" },
- { 222*C, 222*C, 222*C, "grey87" },
- { 224*C, 224*C, 224*C, "grey88" },
- { 227*C, 227*C, 227*C, "grey89" },
- { 23*C, 23*C, 23*C, "grey9" },
- { 229*C, 229*C, 229*C, "grey90" },
- { 232*C, 232*C, 232*C, "grey91" },
- { 235*C, 235*C, 235*C, "grey92" },
- { 237*C, 237*C, 237*C, "grey93" },
- { 240*C, 240*C, 240*C, "grey94" },
- { 242*C, 242*C, 242*C, "grey95" },
- { 245*C, 245*C, 245*C, "grey96" },
- { 247*C, 247*C, 247*C, "grey97" },
- { 250*C, 250*C, 250*C, "grey98" },
- { 252*C, 252*C, 252*C, "grey99" },
- { 240*C, 255*C, 240*C, "honeydew" },
- { 240*C, 255*C, 240*C, "honeydew1" },
- { 224*C, 238*C, 224*C, "honeydew2" },
- { 193*C, 205*C, 193*C, "honeydew3" },
- { 131*C, 139*C, 131*C, "honeydew4" },
- { 255*C, 105*C, 180*C, "hot pink" },
- { 255*C, 105*C, 180*C, "HotPink" },
- { 255*C, 110*C, 180*C, "HotPink1" },
- { 238*C, 106*C, 167*C, "HotPink2" },
- { 205*C, 96*C, 144*C, "HotPink3" },
- { 139*C, 58*C, 98*C, "HotPink4" },
- { 205*C, 92*C, 92*C, "indian red" },
- { 205*C, 92*C, 92*C, "IndianRed" },
- { 255*C, 106*C, 106*C, "IndianRed1" },
- { 238*C, 99*C, 99*C, "IndianRed2" },
- { 205*C, 85*C, 85*C, "IndianRed3" },
- { 139*C, 58*C, 58*C, "IndianRed4" },
- { 255*C, 255*C, 240*C, "ivory" },
- { 255*C, 255*C, 240*C, "ivory1" },
- { 238*C, 238*C, 224*C, "ivory2" },
- { 205*C, 205*C, 193*C, "ivory3" },
- { 139*C, 139*C, 131*C, "ivory4" },
- { 240*C, 230*C, 140*C, "khaki" },
- { 255*C, 246*C, 143*C, "khaki1" },
- { 238*C, 230*C, 133*C, "khaki2" },
- { 205*C, 198*C, 115*C, "khaki3" },
- { 139*C, 134*C, 78*C, "khaki4" },
- { 230*C, 230*C, 250*C, "lavender" },
- { 255*C, 240*C, 245*C, "lavender blush" },
- { 255*C, 240*C, 245*C, "LavenderBlush" },
- { 255*C, 240*C, 245*C, "LavenderBlush1" },
- { 238*C, 224*C, 229*C, "LavenderBlush2" },
- { 205*C, 193*C, 197*C, "LavenderBlush3" },
- { 139*C, 131*C, 134*C, "LavenderBlush4" },
- { 124*C, 252*C, 0*C, "lawn green" },
- { 124*C, 252*C, 0*C, "LawnGreen" },
- { 255*C, 250*C, 205*C, "lemon chiffon" },
- { 255*C, 250*C, 205*C, "LemonChiffon" },
- { 255*C, 250*C, 205*C, "LemonChiffon1" },
- { 238*C, 233*C, 191*C, "LemonChiffon2" },
- { 205*C, 201*C, 165*C, "LemonChiffon3" },
- { 139*C, 137*C, 112*C, "LemonChiffon4" },
- { 173*C, 216*C, 230*C, "light blue" },
- { 240*C, 128*C, 128*C, "light coral" },
- { 224*C, 255*C, 255*C, "light cyan" },
- { 238*C, 221*C, 130*C, "light goldenrod" },
- { 250*C, 250*C, 210*C, "light goldenrod yellow" },
- { 211*C, 211*C, 211*C, "light gray" },
- { 144*C, 238*C, 144*C, "light green" },
- { 211*C, 211*C, 211*C, "light grey" },
- { 255*C, 182*C, 193*C, "light pink" },
- { 255*C, 160*C, 122*C, "light salmon" },
- { 32*C, 178*C, 170*C, "light sea green" },
- { 135*C, 206*C, 250*C, "light sky blue" },
- { 132*C, 112*C, 255*C, "light slate blue" },
- { 119*C, 136*C, 153*C, "light slate gray" },
- { 119*C, 136*C, 153*C, "light slate grey" },
- { 176*C, 196*C, 222*C, "light steel blue" },
- { 255*C, 255*C, 224*C, "light yellow" },
- { 173*C, 216*C, 230*C, "LightBlue" },
- { 191*C, 239*C, 255*C, "LightBlue1" },
- { 178*C, 223*C, 238*C, "LightBlue2" },
- { 154*C, 192*C, 205*C, "LightBlue3" },
- { 104*C, 131*C, 139*C, "LightBlue4" },
- { 240*C, 128*C, 128*C, "LightCoral" },
- { 224*C, 255*C, 255*C, "LightCyan" },
- { 224*C, 255*C, 255*C, "LightCyan1" },
- { 209*C, 238*C, 238*C, "LightCyan2" },
- { 180*C, 205*C, 205*C, "LightCyan3" },
- { 122*C, 139*C, 139*C, "LightCyan4" },
- { 238*C, 221*C, 130*C, "LightGoldenrod" },
- { 255*C, 236*C, 139*C, "LightGoldenrod1" },
- { 238*C, 220*C, 130*C, "LightGoldenrod2" },
- { 205*C, 190*C, 112*C, "LightGoldenrod3" },
- { 139*C, 129*C, 76*C, "LightGoldenrod4" },
- { 250*C, 250*C, 210*C, "LightGoldenrodYellow" },
- { 211*C, 211*C, 211*C, "LightGray" },
- { 144*C, 238*C, 144*C, "LightGreen" },
- { 211*C, 211*C, 211*C, "LightGrey" },
- { 255*C, 182*C, 193*C, "LightPink" },
- { 255*C, 174*C, 185*C, "LightPink1" },
- { 238*C, 162*C, 173*C, "LightPink2" },
- { 205*C, 140*C, 149*C, "LightPink3" },
- { 139*C, 95*C, 101*C, "LightPink4" },
- { 255*C, 160*C, 122*C, "LightSalmon" },
- { 255*C, 160*C, 122*C, "LightSalmon1" },
- { 238*C, 149*C, 114*C, "LightSalmon2" },
- { 205*C, 129*C, 98*C, "LightSalmon3" },
- { 139*C, 87*C, 66*C, "LightSalmon4" },
- { 32*C, 178*C, 170*C, "LightSeaGreen" },
- { 135*C, 206*C, 250*C, "LightSkyBlue" },
- { 176*C, 226*C, 255*C, "LightSkyBlue1" },
- { 164*C, 211*C, 238*C, "LightSkyBlue2" },
- { 141*C, 182*C, 205*C, "LightSkyBlue3" },
- { 96*C, 123*C, 139*C, "LightSkyBlue4" },
- { 132*C, 112*C, 255*C, "LightSlateBlue" },
- { 119*C, 136*C, 153*C, "LightSlateGray" },
- { 119*C, 136*C, 153*C, "LightSlateGrey" },
- { 176*C, 196*C, 222*C, "LightSteelBlue" },
- { 202*C, 225*C, 255*C, "LightSteelBlue1" },
- { 188*C, 210*C, 238*C, "LightSteelBlue2" },
- { 162*C, 181*C, 205*C, "LightSteelBlue3" },
- { 110*C, 123*C, 139*C, "LightSteelBlue4" },
- { 255*C, 255*C, 224*C, "LightYellow" },
- { 255*C, 255*C, 224*C, "LightYellow1" },
- { 238*C, 238*C, 209*C, "LightYellow2" },
- { 205*C, 205*C, 180*C, "LightYellow3" },
- { 139*C, 139*C, 122*C, "LightYellow4" },
- { 50*C, 205*C, 50*C, "lime green" },
- { 50*C, 205*C, 50*C, "LimeGreen" },
- { 250*C, 240*C, 230*C, "linen" },
- { 255*C, 0*C, 255*C, "magenta" },
- { 255*C, 0*C, 255*C, "magenta1" },
- { 238*C, 0*C, 238*C, "magenta2" },
- { 205*C, 0*C, 205*C, "magenta3" },
- { 139*C, 0*C, 139*C, "magenta4" },
- { 176*C, 48*C, 96*C, "maroon" },
- { 255*C, 52*C, 179*C, "maroon1" },
- { 238*C, 48*C, 167*C, "maroon2" },
- { 205*C, 41*C, 144*C, "maroon3" },
- { 139*C, 28*C, 98*C, "maroon4" },
- { 102*C, 205*C, 170*C, "medium aquamarine" },
- { 0*C, 0*C, 205*C, "medium blue" },
- { 186*C, 85*C, 211*C, "medium orchid" },
- { 147*C, 112*C, 219*C, "medium purple" },
- { 60*C, 179*C, 113*C, "medium sea green" },
- { 123*C, 104*C, 238*C, "medium slate blue" },
- { 0*C, 250*C, 154*C, "medium spring green" },
- { 72*C, 209*C, 204*C, "medium turquoise" },
- { 199*C, 21*C, 133*C, "medium violet red" },
- { 102*C, 205*C, 170*C, "MediumAquamarine" },
- { 0*C, 0*C, 205*C, "MediumBlue" },
- { 186*C, 85*C, 211*C, "MediumOrchid" },
- { 224*C, 102*C, 255*C, "MediumOrchid1" },
- { 209*C, 95*C, 238*C, "MediumOrchid2" },
- { 180*C, 82*C, 205*C, "MediumOrchid3" },
- { 122*C, 55*C, 139*C, "MediumOrchid4" },
- { 147*C, 112*C, 219*C, "MediumPurple" },
- { 171*C, 130*C, 255*C, "MediumPurple1" },
- { 159*C, 121*C, 238*C, "MediumPurple2" },
- { 137*C, 104*C, 205*C, "MediumPurple3" },
- { 93*C, 71*C, 139*C, "MediumPurple4" },
- { 60*C, 179*C, 113*C, "MediumSeaGreen" },
- { 123*C, 104*C, 238*C, "MediumSlateBlue" },
- { 0*C, 250*C, 154*C, "MediumSpringGreen" },
- { 72*C, 209*C, 204*C, "MediumTurquoise" },
- { 199*C, 21*C, 133*C, "MediumVioletRed" },
- { 25*C, 25*C, 112*C, "midnight blue" },
- { 25*C, 25*C, 112*C, "MidnightBlue" },
- { 245*C, 255*C, 250*C, "mint cream" },
- { 245*C, 255*C, 250*C, "MintCream" },
- { 255*C, 228*C, 225*C, "misty rose" },
- { 255*C, 228*C, 225*C, "MistyRose" },
- { 255*C, 228*C, 225*C, "MistyRose1" },
- { 238*C, 213*C, 210*C, "MistyRose2" },
- { 205*C, 183*C, 181*C, "MistyRose3" },
- { 139*C, 125*C, 123*C, "MistyRose4" },
- { 255*C, 228*C, 181*C, "moccasin" },
- { 255*C, 222*C, 173*C, "navajo white" },
- { 255*C, 222*C, 173*C, "NavajoWhite" },
- { 255*C, 222*C, 173*C, "NavajoWhite1" },
- { 238*C, 207*C, 161*C, "NavajoWhite2" },
- { 205*C, 179*C, 139*C, "NavajoWhite3" },
- { 139*C, 121*C, 94*C, "NavajoWhite4" },
- { 0*C, 0*C, 128*C, "navy" },
- { 0*C, 0*C, 128*C, "navy blue" },
- { 0*C, 0*C, 128*C, "NavyBlue" },
- { 253*C, 245*C, 230*C, "old lace" },
- { 253*C, 245*C, 230*C, "OldLace" },
- { 107*C, 142*C, 35*C, "olive drab" },
- { 107*C, 142*C, 35*C, "OliveDrab" },
- { 192*C, 255*C, 62*C, "OliveDrab1" },
- { 179*C, 238*C, 58*C, "OliveDrab2" },
- { 154*C, 205*C, 50*C, "OliveDrab3" },
- { 105*C, 139*C, 34*C, "OliveDrab4" },
- { 255*C, 165*C, 0*C, "orange" },
- { 255*C, 69*C, 0*C, "orange red" },
- { 255*C, 165*C, 0*C, "orange1" },
- { 238*C, 154*C, 0*C, "orange2" },
- { 205*C, 133*C, 0*C, "orange3" },
- { 139*C, 90*C, 0*C, "orange4" },
- { 255*C, 69*C, 0*C, "OrangeRed" },
- { 255*C, 69*C, 0*C, "OrangeRed1" },
- { 238*C, 64*C, 0*C, "OrangeRed2" },
- { 205*C, 55*C, 0*C, "OrangeRed3" },
- { 139*C, 37*C, 0*C, "OrangeRed4" },
- { 218*C, 112*C, 214*C, "orchid" },
- { 255*C, 131*C, 250*C, "orchid1" },
- { 238*C, 122*C, 233*C, "orchid2" },
- { 205*C, 105*C, 201*C, "orchid3" },
- { 139*C, 71*C, 137*C, "orchid4" },
- { 238*C, 232*C, 170*C, "pale goldenrod" },
- { 152*C, 251*C, 152*C, "pale green" },
- { 175*C, 238*C, 238*C, "pale turquoise" },
- { 219*C, 112*C, 147*C, "pale violet red" },
- { 238*C, 232*C, 170*C, "PaleGoldenrod" },
- { 152*C, 251*C, 152*C, "PaleGreen" },
- { 154*C, 255*C, 154*C, "PaleGreen1" },
- { 144*C, 238*C, 144*C, "PaleGreen2" },
- { 124*C, 205*C, 124*C, "PaleGreen3" },
- { 84*C, 139*C, 84*C, "PaleGreen4" },
- { 175*C, 238*C, 238*C, "PaleTurquoise" },
- { 187*C, 255*C, 255*C, "PaleTurquoise1" },
- { 174*C, 238*C, 238*C, "PaleTurquoise2" },
- { 150*C, 205*C, 205*C, "PaleTurquoise3" },
- { 102*C, 139*C, 139*C, "PaleTurquoise4" },
- { 219*C, 112*C, 147*C, "PaleVioletRed" },
- { 255*C, 130*C, 171*C, "PaleVioletRed1" },
- { 238*C, 121*C, 159*C, "PaleVioletRed2" },
- { 205*C, 104*C, 137*C, "PaleVioletRed3" },
- { 139*C, 71*C, 93*C, "PaleVioletRed4" },
- { 255*C, 239*C, 213*C, "papaya whip" },
- { 255*C, 239*C, 213*C, "PapayaWhip" },
- { 255*C, 218*C, 185*C, "peach puff" },
- { 255*C, 218*C, 185*C, "PeachPuff" },
- { 255*C, 218*C, 185*C, "PeachPuff1" },
- { 238*C, 203*C, 173*C, "PeachPuff2" },
- { 205*C, 175*C, 149*C, "PeachPuff3" },
- { 139*C, 119*C, 101*C, "PeachPuff4" },
- { 205*C, 133*C, 63*C, "peru" },
- { 255*C, 192*C, 203*C, "pink" },
- { 255*C, 181*C, 197*C, "pink1" },
- { 238*C, 169*C, 184*C, "pink2" },
- { 205*C, 145*C, 158*C, "pink3" },
- { 139*C, 99*C, 108*C, "pink4" },
- { 221*C, 160*C, 221*C, "plum" },
- { 255*C, 187*C, 255*C, "plum1" },
- { 238*C, 174*C, 238*C, "plum2" },
- { 205*C, 150*C, 205*C, "plum3" },
- { 139*C, 102*C, 139*C, "plum4" },
- { 176*C, 224*C, 230*C, "powder blue" },
- { 176*C, 224*C, 230*C, "PowderBlue" },
- { 160*C, 32*C, 240*C, "purple" },
- { 155*C, 48*C, 255*C, "purple1" },
- { 145*C, 44*C, 238*C, "purple2" },
- { 125*C, 38*C, 205*C, "purple3" },
- { 85*C, 26*C, 139*C, "purple4" },
- { 255*C, 0*C, 0*C, "red" },
- { 255*C, 0*C, 0*C, "red1" },
- { 238*C, 0*C, 0*C, "red2" },
- { 205*C, 0*C, 0*C, "red3" },
- { 139*C, 0*C, 0*C, "red4" },
- { 188*C, 143*C, 143*C, "rosy brown" },
- { 188*C, 143*C, 143*C, "RosyBrown" },
- { 255*C, 193*C, 193*C, "RosyBrown1" },
- { 238*C, 180*C, 180*C, "RosyBrown2" },
- { 205*C, 155*C, 155*C, "RosyBrown3" },
- { 139*C, 105*C, 105*C, "RosyBrown4" },
- { 65*C, 105*C, 225*C, "royal blue" },
- { 65*C, 105*C, 225*C, "RoyalBlue" },
- { 72*C, 118*C, 255*C, "RoyalBlue1" },
- { 67*C, 110*C, 238*C, "RoyalBlue2" },
- { 58*C, 95*C, 205*C, "RoyalBlue3" },
- { 39*C, 64*C, 139*C, "RoyalBlue4" },
- { 139*C, 69*C, 19*C, "saddle brown" },
- { 139*C, 69*C, 19*C, "SaddleBrown" },
- { 250*C, 128*C, 114*C, "salmon" },
- { 255*C, 140*C, 105*C, "salmon1" },
- { 238*C, 130*C, 98*C, "salmon2" },
- { 205*C, 112*C, 84*C, "salmon3" },
- { 139*C, 76*C, 57*C, "salmon4" },
- { 244*C, 164*C, 96*C, "sandy brown" },
- { 244*C, 164*C, 96*C, "SandyBrown" },
- { 46*C, 139*C, 87*C, "sea green" },
- { 46*C, 139*C, 87*C, "SeaGreen" },
- { 84*C, 255*C, 159*C, "SeaGreen1" },
- { 78*C, 238*C, 148*C, "SeaGreen2" },
- { 67*C, 205*C, 128*C, "SeaGreen3" },
- { 46*C, 139*C, 87*C, "SeaGreen4" },
- { 255*C, 245*C, 238*C, "seashell" },
- { 255*C, 245*C, 238*C, "seashell1" },
- { 238*C, 229*C, 222*C, "seashell2" },
- { 205*C, 197*C, 191*C, "seashell3" },
- { 139*C, 134*C, 130*C, "seashell4" },
- { 160*C, 82*C, 45*C, "sienna" },
- { 255*C, 130*C, 71*C, "sienna1" },
- { 238*C, 121*C, 66*C, "sienna2" },
- { 205*C, 104*C, 57*C, "sienna3" },
- { 139*C, 71*C, 38*C, "sienna4" },
- { 135*C, 206*C, 235*C, "sky blue" },
- { 135*C, 206*C, 235*C, "SkyBlue" },
- { 135*C, 206*C, 255*C, "SkyBlue1" },
- { 126*C, 192*C, 238*C, "SkyBlue2" },
- { 108*C, 166*C, 205*C, "SkyBlue3" },
- { 74*C, 112*C, 139*C, "SkyBlue4" },
- { 106*C, 90*C, 205*C, "slate blue" },
- { 112*C, 128*C, 144*C, "slate gray" },
- { 112*C, 128*C, 144*C, "slate grey" },
- { 106*C, 90*C, 205*C, "SlateBlue" },
- { 131*C, 111*C, 255*C, "SlateBlue1" },
- { 122*C, 103*C, 238*C, "SlateBlue2" },
- { 105*C, 89*C, 205*C, "SlateBlue3" },
- { 71*C, 60*C, 139*C, "SlateBlue4" },
- { 112*C, 128*C, 144*C, "SlateGray" },
- { 198*C, 226*C, 255*C, "SlateGray1" },
- { 185*C, 211*C, 238*C, "SlateGray2" },
- { 159*C, 182*C, 205*C, "SlateGray3" },
- { 108*C, 123*C, 139*C, "SlateGray4" },
- { 112*C, 128*C, 144*C, "SlateGrey" },
- { 255*C, 250*C, 250*C, "snow" },
- { 255*C, 250*C, 250*C, "snow1" },
- { 238*C, 233*C, 233*C, "snow2" },
- { 205*C, 201*C, 201*C, "snow3" },
- { 139*C, 137*C, 137*C, "snow4" },
- { 0*C, 255*C, 127*C, "spring green" },
- { 0*C, 255*C, 127*C, "SpringGreen" },
- { 0*C, 255*C, 127*C, "SpringGreen1" },
- { 0*C, 238*C, 118*C, "SpringGreen2" },
- { 0*C, 205*C, 102*C, "SpringGreen3" },
- { 0*C, 139*C, 69*C, "SpringGreen4" },
- { 70*C, 130*C, 180*C, "steel blue" },
- { 70*C, 130*C, 180*C, "SteelBlue" },
- { 99*C, 184*C, 255*C, "SteelBlue1" },
- { 92*C, 172*C, 238*C, "SteelBlue2" },
- { 79*C, 148*C, 205*C, "SteelBlue3" },
- { 54*C, 100*C, 139*C, "SteelBlue4" },
- { 210*C, 180*C, 140*C, "tan" },
- { 255*C, 165*C, 79*C, "tan1" },
- { 238*C, 154*C, 73*C, "tan2" },
- { 205*C, 133*C, 63*C, "tan3" },
- { 139*C, 90*C, 43*C, "tan4" },
- { 216*C, 191*C, 216*C, "thistle" },
- { 255*C, 225*C, 255*C, "thistle1" },
- { 238*C, 210*C, 238*C, "thistle2" },
- { 205*C, 181*C, 205*C, "thistle3" },
- { 139*C, 123*C, 139*C, "thistle4" },
- { 255*C, 99*C, 71*C, "tomato" },
- { 255*C, 99*C, 71*C, "tomato1" },
- { 238*C, 92*C, 66*C, "tomato2" },
- { 205*C, 79*C, 57*C, "tomato3" },
- { 139*C, 54*C, 38*C, "tomato4" },
- { 64*C, 224*C, 208*C, "turquoise" },
- { 0*C, 245*C, 255*C, "turquoise1" },
- { 0*C, 229*C, 238*C, "turquoise2" },
- { 0*C, 197*C, 205*C, "turquoise3" },
- { 0*C, 134*C, 139*C, "turquoise4" },
- { 238*C, 130*C, 238*C, "violet" },
- { 208*C, 32*C, 144*C, "violet red" },
- { 208*C, 32*C, 144*C, "VioletRed" },
- { 255*C, 62*C, 150*C, "VioletRed1" },
- { 238*C, 58*C, 140*C, "VioletRed2" },
- { 205*C, 50*C, 120*C, "VioletRed3" },
- { 139*C, 34*C, 82*C, "VioletRed4" },
- { 245*C, 222*C, 179*C, "wheat" },
- { 255*C, 231*C, 186*C, "wheat1" },
- { 238*C, 216*C, 174*C, "wheat2" },
- { 205*C, 186*C, 150*C, "wheat3" },
- { 139*C, 126*C, 102*C, "wheat4" },
- { 255*C, 255*C, 255*C, "white" },
- { 245*C, 245*C, 245*C, "white smoke" },
- { 245*C, 245*C, 245*C, "WhiteSmoke" },
- { 255*C, 255*C, 0*C, "yellow" },
- { 154*C, 205*C, 50*C, "yellow green" },
- { 255*C, 255*C, 0*C, "yellow1" },
- { 238*C, 238*C, 0*C, "yellow2" },
- { 205*C, 205*C, 0*C, "yellow3" },
- { 139*C, 139*C, 0*C, "yellow4" },
- { 154*C, 205*C, 50*C, "YellowGreen" }
-};
-
-#undef C
-
-#define NUM_KD_COLORS (sizeof (KdColors) / sizeof (KdColors[0]))
-
-Bool
-OsInitColors()
-{
- return TRUE;
-}
-
-Bool
-OsLookupColor(int screen,
- char *s_name,
- unsigned int len,
- unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue)
-{
- const KdNamedColor *c;
- unsigned char *name = (unsigned char *) s_name;
- int low, mid, high;
- int r;
-
- low = 0;
- high = NUM_KD_COLORS;
- while (high - low > 0)
- {
- mid = (low + high) / 2;
- c = &KdColors[mid];
- r = KdStrCaseCmp (c->name, name, len);
- if (r == 0)
- {
- *pred = c->red;
- *pgreen = c->green;
- *pblue = c->blue;
- return TRUE;
- }
- if (r < 0)
- {
- if (high == mid)
- break;
- high = mid;
- }
- else
- {
- if (low == mid)
- break;
- low = mid;
- }
- }
- return FALSE;
-}
diff --git a/hw/kdrive/src/kcurscol.c b/hw/kdrive/src/kcurscol.c
deleted file mode 100644
index 50edf1735..000000000
--- a/hw/kdrive/src/kcurscol.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/kcurscol.c,v 1.4 2000/05/11 18:14:13 tsi Exp $
- *
- * Copyright © 1999 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "cursorstr.h"
-
-static int
-KdComputeCmapShift (unsigned long mask)
-{
- int shift;
- unsigned long bit;
-
- shift = 16;
- bit = 0x80000000;
- while (!(mask & bit))
- {
- shift--;
- bit >>= 1;
- }
- return shift;
-}
-
-#define Shift(v,d) ((d) < 0 ? ((v) >> (-d)) : ((v) << (d)))
-
-void
-KdAllocateCursorPixels (ScreenPtr pScreen,
- int fb,
- CursorPtr pCursor,
- Pixel *source,
- Pixel *mask)
-{
- xColorItem sourceColor, maskColor;
- int r, g, b;
- KdScreenPriv(pScreen);
-
- if (pScreenPriv->screen->fb[fb].redMask)
- {
-
- r = KdComputeCmapShift (pScreenPriv->screen->fb[fb].redMask);
- g = KdComputeCmapShift (pScreenPriv->screen->fb[fb].greenMask);
- b = KdComputeCmapShift (pScreenPriv->screen->fb[fb].blueMask);
- *source = ((Shift(pCursor->foreRed,r) & pScreenPriv->screen->fb[fb].redMask) |
- (Shift(pCursor->foreGreen,g) & pScreenPriv->screen->fb[fb].greenMask) |
- (Shift(pCursor->foreBlue,b) & pScreenPriv->screen->fb[fb].blueMask));
- *mask = ((Shift(pCursor->backRed,r) & pScreenPriv->screen->fb[fb].redMask) |
- (Shift(pCursor->backGreen,g) & pScreenPriv->screen->fb[fb].greenMask) |
- (Shift(pCursor->backBlue,b) & pScreenPriv->screen->fb[fb].blueMask));
- }
- else
- {
- /*
- * Set these to an invalid pixel value so that
- * when the store colors comes through, the cursor
- * won't get recolored
- */
- *source = ~0;
- *mask = ~0;
-
- sourceColor.red = pCursor->foreRed;
- sourceColor.green = pCursor->foreGreen;
- sourceColor.blue = pCursor->foreBlue;
- FakeAllocColor(pScreenPriv->pInstalledmap[fb], &sourceColor);
- maskColor.red = pCursor->backRed;
- maskColor.green = pCursor->backGreen;
- maskColor.blue = pCursor->backBlue;
- FakeAllocColor(pScreenPriv->pInstalledmap[fb], &maskColor);
- FakeFreeColor(pScreenPriv->pInstalledmap[fb], sourceColor.pixel);
- FakeFreeColor(pScreenPriv->pInstalledmap[fb], maskColor.pixel);
- *source = sourceColor.pixel;
- *mask = maskColor.pixel;
- }
-}
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
deleted file mode 100644
index b27a6403d..000000000
--- a/hw/kdrive/src/kdrive.c
+++ /dev/null
@@ -1,1513 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.29 2002/10/31 18:29:50 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#ifdef PSEUDO8
-#include "pseudo8/pseudo8.h"
-#endif
-#include <mivalidate.h>
-#include <dixstruct.h>
-#ifdef RANDR
-#include <randrstr.h>
-#endif
-
-#ifdef XV
-#include "kxv.h"
-#endif
-
-#ifdef DPMSExtension
-#include "dpmsproc.h"
-#endif
-
-typedef struct _kdDepths {
- CARD8 depth;
- CARD8 bpp;
-} KdDepths;
-
-KdDepths kdDepths[] = {
- { 1, 1 },
- { 4, 4 },
- { 8, 8 },
- { 15, 16 },
- { 16, 16 },
- { 24, 32 },
- { 32, 32 }
-};
-
-#define NUM_KD_DEPTHS (sizeof (kdDepths) / sizeof (kdDepths[0]))
-
-int kdScreenPrivateIndex;
-unsigned long kdGeneration;
-
-Bool kdVideoTest;
-unsigned long kdVideoTestTime;
-Bool kdEmulateMiddleButton;
-Bool kdRawPointerCoordinates;
-Bool kdDisableZaphod;
-Bool kdDontZap;
-Bool kdEnabled;
-int kdSubpixelOrder;
-int kdVirtualTerminal = -1;
-Bool kdSwitchPending;
-char *kdSwitchCmd;
-DDXPointRec kdOrigin;
-
-/*
- * Carry arguments from InitOutput through driver initialization
- * to KdScreenInit
- */
-
-KdOsFuncs *kdOsFuncs;
-extern WindowPtr *WindowTable;
-
-void
-KdSetRootClip (ScreenPtr pScreen, BOOL enable)
-{
-#ifndef FB_OLD_SCREEN
- WindowPtr pWin = WindowTable[pScreen->myNum];
- WindowPtr pChild;
- Bool WasViewable;
- Bool anyMarked = FALSE;
- RegionPtr pOldClip = 0, bsExposed;
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
- WindowPtr pLayerWin;
- BoxRec box;
-
- if (!pWin)
- return;
- WasViewable = (Bool)(pWin->viewable);
- if (WasViewable)
- {
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- (void) (*pScreen->MarkOverlappedWindows)(pChild,
- pChild,
- &pLayerWin);
- }
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- if (pWin->valdata)
- {
- if (HasBorder (pWin))
- {
- RegionPtr borderVisible;
-
- borderVisible = REGION_CREATE(pScreen, NullBox, 1);
- REGION_SUBTRACT(pScreen, borderVisible,
- &pWin->borderClip, &pWin->winSize);
- pWin->valdata->before.borderVisible = borderVisible;
- }
- pWin->valdata->before.resized = TRUE;
- }
- }
-
- if (enable)
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
- pWin->drawable.width = pScreen->width;
- pWin->drawable.height = pScreen->height;
- REGION_INIT (pScreen, &pWin->winSize, &box, 1);
- REGION_INIT (pScreen, &pWin->borderSize, &box, 1);
- REGION_RESET(pScreen, &pWin->borderClip, &box);
- REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
- }
- else
- {
- REGION_EMPTY(pScreen, &pWin->borderClip);
- REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
- }
-
- ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
-
- if (WasViewable)
- {
- if (pWin->backStorage)
- {
- pOldClip = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, pOldClip, &pWin->clipList);
- }
-
- if (pWin->firstChild)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
- pWin->firstChild,
- (WindowPtr *)NULL);
- }
- else
- {
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- }
-
-#ifdef DO_SAVE_UNDERS
- if (DO_SAVE_UNDERS(pWin))
- {
- dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin);
- }
-#endif /* DO_SAVE_UNDERS */
-
- if (anyMarked)
- (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
- }
-
- if (pWin->backStorage &&
- ((pWin->backingStore == Always) || WasViewable))
- {
- if (!WasViewable)
- pOldClip = &pWin->clipList; /* a convenient empty region */
- bsExposed = (*pScreen->TranslateBackingStore)
- (pWin, 0, 0, pOldClip,
- pWin->drawable.x, pWin->drawable.y);
- if (WasViewable)
- REGION_DESTROY(pScreen, pOldClip);
- if (bsExposed)
- {
- RegionPtr valExposed = NullRegion;
-
- if (pWin->valdata)
- valExposed = &pWin->valdata->after.exposed;
- (*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
- if (valExposed)
- REGION_EMPTY(pScreen, valExposed);
- REGION_DESTROY(pScreen, bsExposed);
- }
- }
- if (WasViewable)
- {
- if (anyMarked)
- (*pScreen->HandleExposures)(pWin);
-#ifdef DO_SAVE_UNDERS
- if (dosave)
- (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin);
-#endif /* DO_SAVE_UNDERS */
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
- }
- if (pWin->realized)
- WindowsRestructured ();
-#endif /* !FB_OLD_SCREEN */
-}
-
-void
-KdDisableScreen (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
-
- if (!pScreenPriv->enabled)
- return;
- KdCheckSync (pScreen);
- if (!pScreenPriv->closed)
- KdSetRootClip (pScreen, FALSE);
- KdDisableColormap (pScreen);
- KdOffscreenSwapOut (pScreen);
- if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->disableAccel)
- (*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
- if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->disableCursor)
- (*pScreenPriv->card->cfuncs->disableCursor) (pScreen);
- if (pScreenPriv->card->cfuncs->dpms)
- (*pScreenPriv->card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
- pScreenPriv->enabled = FALSE;
- if(pScreenPriv->card->cfuncs->disable)
- (*pScreenPriv->card->cfuncs->disable) (pScreen);
-}
-
-static void
-KdDoSwitchCmd (char *reason)
-{
- if (kdSwitchCmd)
- {
- char *command = xalloc (strlen (kdSwitchCmd) +
- 1 +
- strlen (reason) +
- 1);
- if (!command)
- return;
- strcpy (command, kdSwitchCmd);
- strcat (command, " ");
- strcat (command, reason);
- system (command);
- xfree (command);
- }
-}
-
-void
-KdSuspend (void)
-{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (kdEnabled)
- {
- for (card = kdCardInfo; card; card = card->next)
- {
- for (screen = card->screenList; screen; screen = screen->next)
- if (screen->mynum == card->selected && screen->pScreen)
- KdDisableScreen (screen->pScreen);
- if (card->driver)
- (*card->cfuncs->restore) (card);
- }
- KdDisableInput ();
- KdDoSwitchCmd ("suspend");
- }
-}
-
-void
-KdDisableScreens (void)
-{
- KdSuspend ();
- if (kdEnabled)
- {
- (*kdOsFuncs->Disable) ();
- kdEnabled = FALSE;
- }
-}
-
-Bool
-KdEnableScreen (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
-
- if (pScreenPriv->enabled)
- return TRUE;
- if(pScreenPriv->card->cfuncs->enable)
- if (!(*pScreenPriv->card->cfuncs->enable) (pScreen))
- return FALSE;
- pScreenPriv->enabled = TRUE;
- pScreenPriv->dpmsState = KD_DPMS_NORMAL;
- pScreenPriv->card->selected = pScreenPriv->screen->mynum;
- KdOffscreenSwapIn (pScreen);
- if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->enableCursor)
- (*pScreenPriv->card->cfuncs->enableCursor) (pScreen);
- if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->enableAccel)
- (*pScreenPriv->card->cfuncs->enableAccel) (pScreen);
- KdEnableColormap (pScreen);
- KdSetRootClip (pScreen, TRUE);
- if (pScreenPriv->card->cfuncs->dpms)
- (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
- return TRUE;
-}
-
-void
-KdResume (void)
-{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (kdEnabled)
- {
- KdDoSwitchCmd ("resume");
- for (card = kdCardInfo; card; card = card->next)
- {
- if(card->cfuncs->preserve)
- (*card->cfuncs->preserve) (card);
- for (screen = card->screenList; screen; screen = screen->next)
- if (screen->mynum == card->selected && screen->pScreen)
- KdEnableScreen (screen->pScreen);
- }
- KdEnableInput ();
- KdReleaseAllKeys ();
- }
-}
-
-void
-KdEnableScreens (void)
-{
- if (!kdEnabled)
- {
- kdEnabled = TRUE;
- (*kdOsFuncs->Enable) ();
- }
- KdResume ();
-}
-
-void
-KdProcessSwitch (void)
-{
- if (kdEnabled)
- KdDisableScreens ();
- else
- KdEnableScreens ();
-}
-
-void
-AbortDDX(void)
-{
- KdDisableScreens ();
- if (kdOsFuncs)
- {
- if (kdEnabled)
- (*kdOsFuncs->Disable) ();
- (*kdOsFuncs->Fini) ();
- KdDoSwitchCmd ("stop");
- }
-}
-
-void
-ddxGiveUp ()
-{
- AbortDDX ();
-}
-
-Bool kdDumbDriver;
-Bool kdSoftCursor;
-
-static char *
-KdParseFindNext (char *cur, char *delim, char *save, char *last)
-{
- while (*cur && !strchr (delim, *cur))
- {
- *save++ = *cur++;
- }
- *save = 0;
- *last = *cur;
- if (*cur)
- cur++;
- return cur;
-}
-
-Rotation
-KdAddRotation (Rotation a, Rotation b)
-{
- Rotation rotate = (a & RR_Rotate_All) * (b & RR_Rotate_All);
- Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
-
- if (rotate > RR_Rotate_270)
- rotate /= (RR_Rotate_270 * RR_Rotate_90);
- return reflect | rotate;
-}
-
-Rotation
-KdSubRotation (Rotation a, Rotation b)
-{
- Rotation rotate = (a & RR_Rotate_All) * 16 / (b & RR_Rotate_All);
- Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
-
- if (rotate > RR_Rotate_270)
- rotate /= (RR_Rotate_270 * RR_Rotate_90);
- return reflect | rotate;
-}
-
-void
-KdParseScreen (KdScreenInfo *screen,
- char *arg)
-{
- char delim;
- char save[1024];
- int fb;
- int i;
- int pixels, mm;
-
- screen->dumb = kdDumbDriver;
- screen->softCursor = kdSoftCursor;
- screen->origin = kdOrigin;
- screen->randr = RR_Rotate_0;
- screen->width = 0;
- screen->height = 0;
- screen->width_mm = 0;
- screen->height_mm = 0;
- screen->subpixel_order = kdSubpixelOrder;
- screen->rate = 0;
- for (fb = 0; fb < KD_MAX_FB; fb++)
- screen->fb[fb].depth = 0;
- if (!arg)
- return;
- if (strlen (arg) >= sizeof (save))
- return;
-
- for (i = 0; i < 2; i++)
- {
- arg = KdParseFindNext (arg, "x/@XY", save, &delim);
- if (!save[0])
- return;
-
- pixels = atoi(save);
- mm = 0;
-
- if (delim == '/')
- {
- arg = KdParseFindNext (arg, "x@XY", save, &delim);
- if (!save[0])
- return;
- mm = atoi(save);
- }
-
- if (i == 0)
- {
- screen->width = pixels;
- screen->width_mm = mm;
- }
- else
- {
- screen->height = pixels;
- screen->height_mm = mm;
- }
- if (delim != 'x' && delim != '@' && delim != 'X' && delim != 'Y')
- return;
- }
-
- kdOrigin.x += screen->width;
- kdOrigin.y = 0;
- kdDumbDriver = FALSE;
- kdSoftCursor = FALSE;
- kdSubpixelOrder = SubPixelUnknown;
-
- if (delim == '@')
- {
- arg = KdParseFindNext (arg, "xXY", save, &delim);
- if (save[0])
- {
- int rotate = atoi (save);
- if (rotate < 45)
- screen->randr = RR_Rotate_0;
- else if (rotate < 135)
- screen->randr = RR_Rotate_90;
- else if (rotate < 225)
- screen->randr = RR_Rotate_180;
- else if (rotate < 315)
- screen->randr = RR_Rotate_270;
- else
- screen->randr = RR_Rotate_0;
- }
- }
- if (delim == 'X')
- {
- arg = KdParseFindNext (arg, "xY", save, &delim);
- screen->randr |= RR_Reflect_X;
- }
-
- if (delim == 'Y')
- {
- arg = KdParseFindNext (arg, "xY", save, &delim);
- screen->randr |= RR_Reflect_Y;
- }
-
- fb = 0;
- while (fb < KD_MAX_FB)
- {
- arg = KdParseFindNext (arg, "x/,", save, &delim);
- if (!save[0])
- break;
- screen->fb[fb].depth = atoi(save);
- if (delim == '/')
- {
- arg = KdParseFindNext (arg, "x,", save, &delim);
- if (!save[0])
- break;
- screen->fb[fb].bitsPerPixel = atoi (save);
- }
- else
- screen->fb[fb].bitsPerPixel = 0;
- if (delim != ',')
- break;
- fb++;
- }
-
- if (delim == 'x')
- {
- arg = KdParseFindNext (arg, "x", save, &delim);
- if (save[0])
- screen->rate = atoi(save);
- }
-}
-
-/*
- * Mouse argument syntax:
- *
- * device,protocol,options...
- *
- * Options are any of:
- * 1-5 n button mouse
- * 2button emulate middle button
- * {NMO} Reorder buttons
- */
-
-char *
-KdSaveString (char *str)
-{
- char *n = (char *) xalloc (strlen (str) + 1);
-
- if (!n)
- return 0;
- strcpy (n, str);
- return n;
-}
-
-/*
- * Parse mouse information. Syntax:
- *
- * <device>,<nbutton>,<protocol>{,<option>}...
- *
- * options: {nmo} pointer mapping (e.g. {321})
- * 2button emulate middle button
- * 3button dont emulate middle button
- */
-
-void
-KdParseMouse (char *arg)
-{
- char save[1024];
- char delim;
- KdMouseInfo *mi;
- int i;
-
- mi = KdMouseInfoAdd ();
- if (!mi)
- return;
- mi->name = 0;
- mi->prot = 0;
- mi->emulateMiddleButton = kdEmulateMiddleButton;
- mi->transformCoordinates = !kdRawPointerCoordinates;
- mi->nbutton = 3;
- for (i = 0; i < KD_MAX_BUTTON; i++)
- mi->map[i] = i + 1;
-
- if (!arg)
- return;
- if (strlen (arg) >= sizeof (save))
- return;
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (!save[0])
- return;
- mi->name = KdSaveString (save);
- if (delim != ',')
- return;
-
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (!save[0])
- return;
-
- if ('1' <= save[0] && save[0] <= '0' + KD_MAX_BUTTON && save[1] == '\0')
- {
- mi->nbutton = save[0] - '0';
- if (mi->nbutton > KD_MAX_BUTTON)
- {
- UseMsg ();
- return;
- }
- }
-
- if (!delim != ',')
- return;
-
- arg = KdParseFindNext (arg, ",", save, &delim);
-
- if (save[0])
- mi->prot = KdSaveString (save);
-
- while (delim == ',')
- {
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (save[0] == '{')
- {
- char *s = save + 1;
- i = 0;
- while (*s && *s != '}')
- {
- if ('1' <= *s && *s <= '0' + mi->nbutton)
- mi->map[i] = *s - '0';
- else
- UseMsg ();
- s++;
- }
- }
- else if (!strcmp (save, "2button"))
- mi->emulateMiddleButton = TRUE;
- else if (!strcmp (save, "3button"))
- mi->emulateMiddleButton = FALSE;
- else if (!strcmp (save, "rawcoord"))
- mi->transformCoordinates = FALSE;
- else if (!strcmp (save, "transform"))
- mi->transformCoordinates = TRUE;
- else
- UseMsg ();
- }
-}
-
-void
-KdParseRgba (char *rgba)
-{
- if (!strcmp (rgba, "rgb"))
- kdSubpixelOrder = SubPixelHorizontalRGB;
- else if (!strcmp (rgba, "bgr"))
- kdSubpixelOrder = SubPixelHorizontalBGR;
- else if (!strcmp (rgba, "vrgb"))
- kdSubpixelOrder = SubPixelVerticalRGB;
- else if (!strcmp (rgba, "vbgr"))
- kdSubpixelOrder = SubPixelVerticalBGR;
- else if (!strcmp (rgba, "none"))
- kdSubpixelOrder = SubPixelNone;
- else
- kdSubpixelOrder = SubPixelUnknown;
-}
-
-void
-KdUseMsg (void)
-{
- ErrorF("\nTinyX Device Dependent Usage:\n");
- ErrorF("-card pcmcia Use PCMCIA card as additional screen\n");
- ErrorF("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM][@ROTATION][X][Y][xDEPTH/BPP{,DEPTH/BPP}[xFREQ]] Specify screen characteristics\n");
- ErrorF("-rgba rgb/bgr/vrgb/vbgr/none Specify subpixel ordering for LCD panels\n");
- ErrorF("-zaphod Disable cursor screen switching\n");
- ErrorF("-2button Emulate 3 button mouse\n");
- ErrorF("-3button Disable 3 button mouse emulation\n");
- ErrorF("-rawcoord Don't transform pointer coordinates on rotation\n");
- ErrorF("-dumb Disable hardware acceleration\n");
- ErrorF("-softCursor Force software cursor\n");
- ErrorF("-videoTest Start the server, pause momentarily and exit\n");
- ErrorF("-origin X,Y Locates the next screen in the the virtual screen (Xinerama)\n");
- ErrorF("-mouse path[,n] Filename of mouse device, n is number of buttons\n");
- ErrorF("-switchCmd Command to execute on vt switch\n");
- ErrorF("-nozap Don't terminate server on Ctrl+Alt+Backspace\n");
- ErrorF("vtxx Use virtual terminal xx instead of the next available\n");
-#ifdef PSEUDO8
- p8UseMsg ();
-#endif
-}
-
-int
-KdProcessArgument (int argc, char **argv, int i)
-{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (!strcmp (argv[i], "-card"))
- {
- if ((i+1) < argc)
- InitCard (argv[i+1]);
- else
- UseMsg ();
- return 2;
- }
- if (!strcmp (argv[i], "-screen"))
- {
- if ((i+1) < argc)
- {
- card = KdCardInfoLast ();
- if (!card)
- {
- InitCard (0);
- card = KdCardInfoLast ();
- }
- if (card) {
- screen = KdScreenInfoAdd (card);
- KdParseScreen (screen, argv[i+1]);
- } else
- ErrorF("No matching card found!\n");
- }
- else
- UseMsg ();
- return 2;
- }
- if (!strcmp (argv[i], "-zaphod"))
- {
- kdDisableZaphod = TRUE;
- return 1;
- }
- if (!strcmp (argv[i], "-nozap"))
- {
- kdDontZap = TRUE;
- return 1;
- }
- if (!strcmp (argv[i], "-3button"))
- {
- kdEmulateMiddleButton = FALSE;
- return 1;
- }
- if (!strcmp (argv[i], "-2button"))
- {
- kdEmulateMiddleButton = TRUE;
- return 1;
- }
- if (!strcmp (argv[i], "-rawcoord"))
- {
- kdRawPointerCoordinates = 1;
- return 1;
- }
- if (!strcmp (argv[i], "-dumb"))
- {
- kdDumbDriver = TRUE;
- return 1;
- }
- if (!strcmp (argv[i], "-softCursor"))
- {
- kdSoftCursor = TRUE;
- return 1;
- }
- if (!strcmp (argv[i], "-videoTest"))
- {
- kdVideoTest = TRUE;
- return 1;
- }
- if (!strcmp (argv[i], "-origin"))
- {
- if ((i+1) < argc)
- {
- char *x = argv[i+1];
- char *y = strchr (x, ',');
- if (x)
- kdOrigin.x = atoi (x);
- else
- kdOrigin.x = 0;
- if (y)
- kdOrigin.y = atoi(y+1);
- else
- kdOrigin.y = 0;
- }
- else
- UseMsg ();
- return 2;
- }
- if (!strcmp (argv[i], "-mouse"))
- {
- if ((i+1) < argc)
- KdParseMouse (argv[i+1]);
- else
- UseMsg ();
- return 2;
- }
- if (!strcmp (argv[i], "-rgba"))
- {
- if ((i+1) < argc)
- KdParseRgba (argv[i+1]);
- else
- UseMsg ();
- return 2;
- }
- if (!strcmp (argv[i], "-switchCmd"))
- {
- if ((i+1) < argc)
- kdSwitchCmd = argv[i+1];
- else
- UseMsg ();
- return 2;
- }
- if (!strncmp (argv[i], "vt", 2) &&
- sscanf (argv[i], "vt%2d", &kdVirtualTerminal) == 1)
- {
- return 1;
- }
-#ifdef PSEUDO8
- return p8ProcessArgument (argc, argv, i);
-#else
- return 0;
-#endif
-}
-
-/*
- * These are getting tossed in here until I can think of where
- * they really belong
- */
-
-void
-KdOsInit (KdOsFuncs *pOsFuncs)
-{
- kdOsFuncs = pOsFuncs;
- if (pOsFuncs)
- {
- if (serverGeneration == 1)
- {
- KdDoSwitchCmd ("start");
- (*pOsFuncs->Init) ();
- }
- }
-}
-
-Bool
-KdAllocatePrivates (ScreenPtr pScreen)
-{
- KdPrivScreenPtr pScreenPriv;
-
- if (kdGeneration != serverGeneration)
- {
- kdScreenPrivateIndex = AllocateScreenPrivateIndex();
- kdGeneration = serverGeneration;
- }
- pScreenPriv = (KdPrivScreenPtr) xalloc(sizeof (*pScreenPriv));
- if (!pScreenPriv)
- return FALSE;
- memset (pScreenPriv, '\0', sizeof (KdPrivScreenRec));
- KdSetScreenPriv (pScreen, pScreenPriv);
- return TRUE;
-}
-
-Bool
-KdCreateScreenResources (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- Bool ret;
-
- pScreen->CreateScreenResources = pScreenPriv->CreateScreenResources;
- if(pScreen->CreateScreenResources)
- ret = (*pScreen->CreateScreenResources) (pScreen);
- else
- ret= -1;
- pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources;
- pScreen->CreateScreenResources = KdCreateScreenResources;
- if (ret && card->cfuncs->createRes)
- ret = (*card->cfuncs->createRes) (pScreen);
- return ret;
-}
-
-Bool
-KdCloseScreen (int index, ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = pScreenPriv->card;
- Bool ret;
-
- pScreenPriv->closed = TRUE;
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
- if(pScreen->CloseScreen)
- ret = (*pScreen->CloseScreen) (index, pScreen);
- else
- ret = TRUE;
-
- if (screen->off_screen_base < screen->memory_size)
- KdOffscreenFini (pScreen);
-
- if (pScreenPriv->dpmsState != KD_DPMS_NORMAL)
- (*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
-
- if (screen->mynum == card->selected)
- KdDisableScreen (pScreen);
-
- /*
- * Restore video hardware when last screen is closed
- */
- if (screen == card->screenList)
- {
- if (kdEnabled && card->cfuncs->restore)
- (*card->cfuncs->restore) (card);
- }
-
- if (!pScreenPriv->screen->dumb && card->cfuncs->finiAccel)
- (*card->cfuncs->finiAccel) (pScreen);
-
- if (!pScreenPriv->screen->softCursor && card->cfuncs->finiCursor)
- (*card->cfuncs->finiCursor) (pScreen);
-
- if(card->cfuncs->scrfini)
- (*card->cfuncs->scrfini) (screen);
-
- /*
- * Clean up card when last screen is closed, DIX closes them in
- * reverse order, thus we check for when the first in the list is closed
- */
- if (screen == card->screenList)
- {
- if(card->cfuncs->cardfini)
- (*card->cfuncs->cardfini) (card);
- /*
- * Clean up OS when last card is closed
- */
- if (card == kdCardInfo)
- {
- if (kdEnabled)
- {
- kdEnabled = FALSE;
- if(kdOsFuncs->Disable)
- (*kdOsFuncs->Disable) ();
- }
- }
- }
-
- pScreenPriv->screen->pScreen = 0;
-
- xfree ((pointer) pScreenPriv);
- return ret;
-}
-
-Bool
-KdSaveScreen (ScreenPtr pScreen, int on)
-{
- KdScreenPriv(pScreen);
- int dpmsState;
-
- if (!pScreenPriv->card->cfuncs->dpms)
- return FALSE;
-
- dpmsState = pScreenPriv->dpmsState;
- switch (on) {
- case SCREEN_SAVER_OFF:
- dpmsState = KD_DPMS_NORMAL;
- break;
- case SCREEN_SAVER_ON:
- if (dpmsState == KD_DPMS_NORMAL)
- dpmsState = KD_DPMS_NORMAL+1;
- break;
- case SCREEN_SAVER_CYCLE:
- if (dpmsState < KD_DPMS_MAX)
- dpmsState++;
- break;
- case SCREEN_SAVER_FORCER:
- break;
- }
- if (dpmsState != pScreenPriv->dpmsState)
- {
- if (pScreenPriv->enabled)
- (*pScreenPriv->card->cfuncs->dpms) (pScreen, dpmsState);
- pScreenPriv->dpmsState = dpmsState;
- }
- return TRUE;
-}
-
-static Bool
-KdCreateWindow (WindowPtr pWin)
-{
-#ifndef PHOENIX
- if (!pWin->parent)
- {
- KdScreenPriv(pWin->drawable.pScreen);
-
- if (!pScreenPriv->enabled)
- {
- REGION_EMPTY (pWin->drawable.pScreen, &pWin->borderClip);
- REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
- }
- }
-#endif
- return fbCreateWindow (pWin);
-}
-
-void
-KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- int subpixel_order = screen->subpixel_order;
- Rotation subpixel_dir;
- int i;
-
- static struct {
- int subpixel_order;
- Rotation direction;
- } orders[] = {
- { SubPixelHorizontalRGB, RR_Rotate_0 },
- { SubPixelHorizontalBGR, RR_Rotate_180 },
- { SubPixelVerticalRGB, RR_Rotate_270 },
- { SubPixelVerticalBGR, RR_Rotate_90 },
- };
-
- static struct {
- int bit;
- int normal;
- int reflect;
- } reflects[] = {
- { RR_Reflect_X, SubPixelHorizontalRGB, SubPixelHorizontalBGR },
- { RR_Reflect_X, SubPixelHorizontalBGR, SubPixelHorizontalRGB },
- { RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalBGR },
- { RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalRGB },
- };
-
- /* map subpixel to direction */
- for (i = 0; i < 4; i++)
- if (orders[i].subpixel_order == subpixel_order)
- break;
- if (i < 4)
- {
- subpixel_dir = KdAddRotation (randr & RR_Rotate_All, orders[i].direction);
-
- /* map back to subpixel order */
- for (i = 0; i < 4; i++)
- if (orders[i].direction & subpixel_dir)
- {
- subpixel_order = orders[i].subpixel_order;
- break;
- }
- /* reflect */
- for (i = 0; i < 4; i++)
- if ((randr & reflects[i].bit) &&
- reflects[i].normal == subpixel_order)
- {
- subpixel_order = reflects[i].reflect;
- break;
- }
- }
- PictureSetSubpixelOrder (pScreen, subpixel_order);
-}
-
-/* Pass through AddScreen, which doesn't take any closure */
-static KdScreenInfo *kdCurrentScreen;
-
-Bool
-KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
-{
- KdScreenInfo *screen = kdCurrentScreen;
- KdCardInfo *card = screen->card;
- KdPrivScreenPtr pScreenPriv;
- int fb;
- /*
- * note that screen->fb is set up for the nominal orientation
- * of the screen; that means if randr is rotated, the values
- * there should reflect a rotated frame buffer (or shadow).
- */
- Bool rotated = (screen->randr & (RR_Rotate_90|RR_Rotate_270)) != 0;
- int width, height, *width_mmp, *height_mmp;
-
- KdAllocatePrivates (pScreen);
-
- pScreenPriv = KdGetScreenPriv(pScreen);
-
- if (!rotated)
- {
- width = screen->width;
- height = screen->height;
- width_mmp = &screen->width_mm;
- height_mmp = &screen->height_mm;
- }
- else
- {
- width = screen->height;
- height = screen->width;
- width_mmp = &screen->height_mm;
- height_mmp = &screen->width_mm;
- }
- screen->pScreen = pScreen;
- pScreenPriv->screen = screen;
- pScreenPriv->card = card;
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- pScreenPriv->bytesPerPixel[fb] = screen->fb[fb].bitsPerPixel >> 3;
- pScreenPriv->dpmsState = KD_DPMS_NORMAL;
-#ifdef PANORAMIX
- dixScreenOrigins[pScreen->myNum] = screen->origin;
-#endif
-
- if (!monitorResolution)
- monitorResolution = 75;
- /*
- * This is done in this order so that backing store wraps
- * our GC functions; fbFinishScreenInit initializes MI
- * backing store
- */
- if (!fbSetupScreen (pScreen,
- screen->fb[0].frameBuffer,
- width, height,
- monitorResolution, monitorResolution,
- screen->fb[0].pixelStride,
- screen->fb[0].bitsPerPixel))
- {
- return FALSE;
- }
-
- /*
- * Set colormap functions
- */
- pScreen->InstallColormap = KdInstallColormap;
- pScreen->UninstallColormap = KdUninstallColormap;
- pScreen->ListInstalledColormaps = KdListInstalledColormaps;
- pScreen->StoreColors = KdStoreColors;
-
- pScreen->SaveScreen = KdSaveScreen;
- pScreen->CreateWindow = KdCreateWindow;
-
-#ifdef FB_OLD_SCREEN
- pScreenPriv->BackingStoreFuncs.SaveAreas = fbSaveAreas;
- pScreenPriv->BackingStoreFuncs.RestoreAreas = fbSaveAreas;
- pScreenPriv->BackingStoreFuncs.SetClipmaskRgn = 0;
- pScreenPriv->BackingStoreFuncs.GetImagePixmap = 0;
- pScreenPriv->BackingStoreFuncs.GetSpansPixmap = 0;
-#endif
-
-#if KD_MAX_FB > 1
- if (screen->fb[1].depth)
- {
- if (!fbOverlayFinishScreenInit (pScreen,
- screen->fb[0].frameBuffer,
- screen->fb[1].frameBuffer,
- width, height,
- monitorResolution, monitorResolution,
- screen->fb[0].pixelStride,
- screen->fb[1].pixelStride,
- screen->fb[0].bitsPerPixel,
- screen->fb[1].bitsPerPixel,
- screen->fb[0].depth,
- screen->fb[1].depth))
- {
- return FALSE;
- }
- }
- else
-#endif
- {
- if (!fbFinishScreenInit (pScreen,
- screen->fb[0].frameBuffer,
- width, height,
- monitorResolution, monitorResolution,
- screen->fb[0].pixelStride,
- screen->fb[0].bitsPerPixel))
- {
- return FALSE;
- }
- }
-
- /*
- * Fix screen sizes; for some reason mi takes dpi instead of mm.
- * Rounding errors are annoying
- */
- if (*width_mmp)
- pScreen->mmWidth = *width_mmp;
- else
- *width_mmp = pScreen->mmWidth;
- if (*height_mmp)
- pScreen->mmHeight = *height_mmp;
- else
- *height_mmp = pScreen->mmHeight;
-
- /*
- * Plug in our own block/wakeup handlers.
- * miScreenInit installs NoopDDA in both places
- */
- pScreen->BlockHandler = KdBlockHandler;
- pScreen->WakeupHandler = KdWakeupHandler;
-
-#ifdef RENDER
- if (!fbPictureInit (pScreen, 0, 0))
- return FALSE;
-#endif
- if (card->cfuncs->initScreen)
- if (!(*card->cfuncs->initScreen) (pScreen))
- return FALSE;
-
- if (!screen->dumb && card->cfuncs->initAccel)
- if (!(*card->cfuncs->initAccel) (pScreen))
- screen->dumb = TRUE;
-
- if (screen->off_screen_base < screen->memory_size)
- KdOffscreenInit (pScreen);
-
-#ifdef PSEUDO8
- (void) p8Init (pScreen, PSEUDO8_USE_DEFAULT);
-#endif
-
- if (card->cfuncs->finishInitScreen)
- if (!(*card->cfuncs->finishInitScreen) (pScreen))
- return FALSE;
-
-#if 0
- fbInitValidateTree (pScreen);
-#endif
-
-#if 0
- pScreen->backingStoreSupport = Always;
-#ifdef FB_OLD_SCREEN
- miInitializeBackingStore (pScreen, &pScreenPriv->BackingStoreFuncs);
-#else
- miInitializeBackingStore (pScreen);
-#endif
-#endif
-
-
- /*
- * Wrap CloseScreen, the order now is:
- * KdCloseScreen
- * miBSCloseScreen
- * fbCloseScreen
- */
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = KdCloseScreen;
-
- pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources;
- pScreen->CreateScreenResources = KdCreateScreenResources;
-
- if (screen->softCursor ||
- !card->cfuncs->initCursor ||
- !(*card->cfuncs->initCursor) (pScreen))
- {
- /* Use MI for cursor display and event queueing. */
- screen->softCursor = TRUE;
- miDCInitialize(pScreen, &kdPointerScreenFuncs);
- }
-
-
- if (!fbCreateDefColormap (pScreen))
- {
- return FALSE;
- }
-
- KdSetSubpixelOrder (pScreen, screen->randr);
-
- /*
- * Enable the hardware
- */
- if (!kdEnabled)
- {
- kdEnabled = TRUE;
- if(kdOsFuncs->Enable)
- (*kdOsFuncs->Enable) ();
- }
-
- if (screen->mynum == card->selected)
- {
- if(card->cfuncs->preserve)
- (*card->cfuncs->preserve) (card);
- if(card->cfuncs->enable)
- if (!(*card->cfuncs->enable) (pScreen))
- return FALSE;
- pScreenPriv->enabled = TRUE;
- if (!screen->softCursor && card->cfuncs->enableCursor)
- (*card->cfuncs->enableCursor) (pScreen);
- KdEnableColormap (pScreen);
- if (!screen->dumb && card->cfuncs->enableAccel)
- (*card->cfuncs->enableAccel) (pScreen);
- }
-
- return TRUE;
-}
-
-void
-KdInitScreen (ScreenInfo *pScreenInfo,
- KdScreenInfo *screen,
- int argc,
- char **argv)
-{
- KdCardInfo *card = screen->card;
-
- (*card->cfuncs->scrinit) (screen);
-
- if (!card->cfuncs->initAccel)
- screen->dumb = TRUE;
- if (!card->cfuncs->initCursor)
- screen->softCursor = TRUE;
-}
-
-static Bool
-KdSetPixmapFormats (ScreenInfo *pScreenInfo)
-{
- CARD8 depthToBpp[33]; /* depth -> bpp map */
- KdCardInfo *card;
- KdScreenInfo *screen;
- int i;
- int bpp;
- int fb;
- PixmapFormatRec *format;
-
- for (i = 1; i <= 32; i++)
- depthToBpp[i] = 0;
-
- /*
- * Generate mappings between bitsPerPixel and depth,
- * also ensure that all screens comply with protocol
- * restrictions on equivalent formats for the same
- * depth on different screens
- */
- for (card = kdCardInfo; card; card = card->next)
- {
- for (screen = card->screenList; screen; screen = screen->next)
- {
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- {
- bpp = screen->fb[fb].bitsPerPixel;
- if (bpp == 24)
- bpp = 32;
- if (!depthToBpp[screen->fb[fb].depth])
- depthToBpp[screen->fb[fb].depth] = bpp;
- else if (depthToBpp[screen->fb[fb].depth] != bpp)
- return FALSE;
- }
- }
- }
-
- /*
- * Fill in additional formats
- */
- for (i = 0; i < NUM_KD_DEPTHS; i++)
- if (!depthToBpp[kdDepths[i].depth])
- depthToBpp[kdDepths[i].depth] = kdDepths[i].bpp;
-
- pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
- pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
- pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
- pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
-
- pScreenInfo->numPixmapFormats = 0;
-
- for (i = 1; i <= 32; i++)
- {
- if (depthToBpp[i])
- {
- format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
- format->depth = i;
- format->bitsPerPixel = depthToBpp[i];
- format->scanlinePad = BITMAP_SCANLINE_PAD;
- }
- }
-
- return TRUE;
-}
-
-static void
-KdAddScreen (ScreenInfo *pScreenInfo,
- KdScreenInfo *screen,
- int argc,
- char **argv)
-{
- int i;
- /*
- * Fill in fb visual type masks for this screen
- */
- for (i = 0; i < pScreenInfo->numPixmapFormats; i++)
- {
- unsigned long visuals;
- Pixel rm, gm, bm;
- int fb;
-
- visuals = 0;
- rm = gm = bm = 0;
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- {
- if (pScreenInfo->formats[i].depth == screen->fb[fb].depth)
- {
- visuals = screen->fb[fb].visuals;
- rm = screen->fb[fb].redMask;
- gm = screen->fb[fb].greenMask;
- bm = screen->fb[fb].blueMask;
- break;
- }
- }
- fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
- visuals,
- 8,
- rm, gm, bm);
- }
-
- kdCurrentScreen = screen;
-
- AddScreen (KdScreenInit, argc, argv);
-}
-
-#if 0 /* This function is not used currently */
-
-int
-KdDepthToFb (ScreenPtr pScreen, int depth)
-{
- KdScreenPriv(pScreen);
- int fb;
-
- for (fb = 0; fb <= KD_MAX_FB && pScreenPriv->screen->fb[fb].frameBuffer; fb++)
- if (pScreenPriv->screen->fb[fb].depth == depth)
- return fb;
-}
-
-#endif
-
-void
-KdInitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv)
-{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (!kdCardInfo)
- {
- InitCard (0);
- if (!(card = KdCardInfoLast ()))
- FatalError("No matching cards found!\n");
- screen = KdScreenInfoAdd (card);
- KdParseScreen (screen, 0);
- }
- /*
- * Initialize all of the screens for all of the cards
- */
- for (card = kdCardInfo; card; card = card->next)
- {
- int ret=1;
- if(card->cfuncs->cardinit)
- ret=(*card->cfuncs->cardinit) (card);
- if (ret)
- {
- for (screen = card->screenList; screen; screen = screen->next)
- KdInitScreen (pScreenInfo, screen, argc, argv);
- }
- }
-
- /*
- * Merge the various pixmap formats together, this can fail
- * when two screens share depth but not bitsPerPixel
- */
- if (!KdSetPixmapFormats (pScreenInfo))
- return;
-
- /*
- * Add all of the screens
- */
- for (card = kdCardInfo; card; card = card->next)
- for (screen = card->screenList; screen; screen = screen->next)
- KdAddScreen (pScreenInfo, screen, argc, argv);
-}
-
-#ifdef XTESTEXT1
-void
-XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey)
- int dev_type;
- int keycode;
- int keystate;
- int mousex;
- int mousey;
-{
-}
-
-void
-XTestGetPointerPos(fmousex, fmousey)
- short *fmousex, *fmousey;
-{
-}
-
-void
-XTestJumpPointer(jx, jy, dev_type)
- int jx;
- int jy;
- int dev_type;
-{
-}
-#endif
-
-#ifdef DPMSExtension
-void
-DPMSSet(int level)
-{
-}
-
-int
-DPMSGet (int *level)
-{
- return -1;
-}
-
-Bool
-DPMSSupported (void)
-{
- return FALSE;
-}
-#endif
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
deleted file mode 100644
index 5289ae0bd..000000000
--- a/hw/kdrive/src/kdrive.h
+++ /dev/null
@@ -1,913 +0,0 @@
-/*
- * Id: kdrive.h,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.29 2002/11/13 16:37:39 keithp Exp $ */
-
-#ifndef _KDRIVE_H_
-#define _KDRIVE_H_
-
-#include <stdio.h>
-#include <X11/X.h>
-#define NEED_EVENTS
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "servermd.h"
-#include "mibstore.h"
-#include "colormapst.h"
-#include "gcstruct.h"
-#include "input.h"
-#include "mipointer.h"
-#include "mi.h"
-#include "dix.h"
-#include "fb.h"
-#include "fboverlay.h"
-#include "shadow.h"
-#include "randrstr.h"
-
-extern WindowPtr *WindowTable;
-
-#define KD_DPMS_NORMAL 0
-#define KD_DPMS_STANDBY 1
-#define KD_DPMS_SUSPEND 2
-#define KD_DPMS_POWERDOWN 3
-#define KD_DPMS_MAX KD_DPMS_POWERDOWN
-
-#ifndef KD_MAX_FB
-#define KD_MAX_FB FB_OVERLAY_MAX
-#endif
-
-#ifndef KD_MAX_CARD_ADDRESS
-#define KD_MAX_CARD_ADDRESS 8
-#endif
-
-/*
- * Configuration information per video card
- */
-
-typedef struct _KdCardAttr {
- CARD32 io;
- CARD32 address[KD_MAX_CARD_ADDRESS];
- int naddr;
-
- /* PCI bus info */
- CARD16 vendorID;
- CARD16 deviceID;
- CARD8 domain;
- CARD8 bus;
- CARD8 slot;
- CARD8 func;
-} KdCardAttr;
-
-typedef struct _KdCardInfo {
- struct _KdCardFuncs *cfuncs;
- void *closure;
- KdCardAttr attr;
- void *driver;
- struct _KdScreenInfo *screenList;
- int selected;
- struct _KdCardInfo *next;
- Bool needSync;
-} KdCardInfo;
-
-extern KdCardInfo *kdCardInfo;
-
-/*
- * Configuration information per X screen
- */
-typedef struct _KdFrameBuffer {
- CARD8 *frameBuffer;
- int depth;
- int bitsPerPixel;
- int pixelStride;
- int byteStride;
- Bool shadow;
- unsigned long visuals;
- Pixel redMask, greenMask, blueMask;
- void *closure;
-} KdFrameBuffer;
-
-typedef struct _KdOffscreenArea KdOffscreenArea;
-
-typedef void (*KdOffscreenSaveProc) (ScreenPtr pScreen, KdOffscreenArea *area);
-
-typedef enum _KdOffscreenState {
- KdOffscreenAvail,
- KdOffscreenRemovable,
- KdOffscreenLocked,
-} KdOffscreenState;
-
-struct _KdOffscreenArea {
- int offset;
- int save_offset;
- int size;
- int score;
- pointer privData;
-
- KdOffscreenSaveProc save;
-
- KdOffscreenState state;
-
- KdOffscreenArea *next;
-};
-
-#define RR_Rotate_All (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
-#define RR_Reflect_All (RR_Reflect_X|RR_Reflect_Y)
-
-typedef struct _KdScreenInfo {
- struct _KdScreenInfo *next;
- KdCardInfo *card;
- ScreenPtr pScreen;
- void *driver;
- Rotation randr; /* rotation and reflection */
- int width;
- int height;
- int rate;
- int width_mm;
- int height_mm;
- int subpixel_order;
- Bool dumb;
- Bool softCursor;
- int mynum;
- DDXPointRec origin;
- KdFrameBuffer fb[KD_MAX_FB];
- CARD8 *memory_base;
- unsigned long memory_size;
- unsigned long off_screen_base;
-} KdScreenInfo;
-
-typedef struct _KdCardFuncs {
- Bool (*cardinit) (KdCardInfo *); /* detect and map device */
- Bool (*scrinit) (KdScreenInfo *);/* initialize screen information */
- Bool (*initScreen) (ScreenPtr); /* initialize ScreenRec */
- Bool (*finishInitScreen) (ScreenPtr pScreen);
- Bool (*createRes) (ScreenPtr); /* create screen resources */
- void (*preserve) (KdCardInfo *); /* save graphics card state */
- Bool (*enable) (ScreenPtr); /* set up for rendering */
- Bool (*dpms) (ScreenPtr, int); /* set DPMS screen saver */
- void (*disable) (ScreenPtr); /* turn off rendering */
- void (*restore) (KdCardInfo *); /* restore graphics card state */
- void (*scrfini) (KdScreenInfo *);/* close down screen */
- void (*cardfini) (KdCardInfo *); /* close down */
-
- Bool (*initCursor) (ScreenPtr); /* detect and map cursor */
- void (*enableCursor) (ScreenPtr); /* enable cursor */
- void (*disableCursor) (ScreenPtr); /* disable cursor */
- void (*finiCursor) (ScreenPtr); /* close down */
- void (*recolorCursor) (ScreenPtr, int, xColorItem *);
-
- Bool (*initAccel) (ScreenPtr);
- void (*enableAccel) (ScreenPtr);
- void (*syncAccel) (ScreenPtr);
- void (*disableAccel) (ScreenPtr);
- void (*finiAccel) (ScreenPtr);
-
- void (*getColors) (ScreenPtr, int, int, xColorItem *);
- void (*putColors) (ScreenPtr, int, int, xColorItem *);
-
-} KdCardFuncs;
-
-#define KD_MAX_PSEUDO_DEPTH 8
-#define KD_MAX_PSEUDO_SIZE (1 << KD_MAX_PSEUDO_DEPTH)
-
-typedef struct {
- KdScreenInfo *screen;
- KdCardInfo *card;
-
- Bool enabled;
- Bool closed;
- int bytesPerPixel[KD_MAX_FB];
-
- int dpmsState;
-
- KdOffscreenArea *off_screen_areas;
-
- ColormapPtr pInstalledmap[KD_MAX_FB]; /* current colormap */
- xColorItem systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors */
-
- CreateScreenResourcesProcPtr CreateScreenResources;
- CloseScreenProcPtr CloseScreen;
-#ifdef FB_OLD_SCREEN
- miBSFuncRec BackingStoreFuncs;
-#endif
-} KdPrivScreenRec, *KdPrivScreenPtr;
-
-typedef enum _kdMouseState {
- start,
- button_1_pend,
- button_1_down,
- button_2_down,
- button_3_pend,
- button_3_down,
- synth_2_down_13,
- synth_2_down_3,
- synth_2_down_1,
- num_input_states
-} KdMouseState;
-
-#define KD_MAX_BUTTON 7
-
-typedef struct _KdMouseInfo {
- struct _KdMouseInfo *next;
- void *driver;
- void *closure;
- char *name;
- char *prot;
- char map[KD_MAX_BUTTON];
- int nbutton;
- Bool emulateMiddleButton;
- unsigned long emulationTimeout;
- Bool timeoutPending;
- KdMouseState mouseState;
- Bool eventHeld;
- xEvent heldEvent;
- unsigned char buttonState;
- int emulationDx, emulationDy;
- int inputType;
- Bool transformCoordinates;
-} KdMouseInfo;
-
-extern KdMouseInfo *kdMouseInfo;
-
-extern int KdCurScreen;
-
-KdMouseInfo *KdMouseInfoAdd (void);
-void KdMouseInfoDispose (KdMouseInfo *mi);
-void KdParseMouse (char *);
-
-typedef struct _KdMouseFuncs {
- Bool (*Init) (void);
- void (*Fini) (void);
-} KdMouseFuncs;
-
-typedef struct _KdKeyboardFuncs {
- void (*Load) (void);
- int (*Init) (void);
- void (*Leds) (int);
- void (*Bell) (int, int, int);
- void (*Fini) (void);
- int LockLed;
-} KdKeyboardFuncs;
-
-typedef struct _KdOsFuncs {
- int (*Init) (void);
- void (*Enable) (void);
- Bool (*SpecialKey) (KeySym);
- void (*Disable) (void);
- void (*Fini) (void);
- void (*pollEvents) (void);
-} KdOsFuncs;
-
-typedef enum _KdSyncPolarity {
- KdSyncNegative, KdSyncPositive
-} KdSyncPolarity;
-
-typedef struct _KdMonitorTiming {
- /* label */
- int horizontal;
- int vertical;
- int rate;
- /* pixel clock */
- int clock; /* in KHz */
- /* horizontal timing */
- int hfp; /* front porch */
- int hbp; /* back porch */
- int hblank; /* blanking */
- KdSyncPolarity hpol; /* polarity */
- /* vertical timing */
- int vfp; /* front porch */
- int vbp; /* back porch */
- int vblank; /* blanking */
- KdSyncPolarity vpol; /* polarity */
-} KdMonitorTiming;
-
-extern const KdMonitorTiming kdMonitorTimings[];
-extern const int kdNumMonitorTimings;
-
-typedef struct _KdMouseMatrix {
- int matrix[2][3];
-} KdMouseMatrix;
-
-typedef struct _KaaTrapezoid {
- float tl, tr, ty;
- float bl, br, by;
-} KaaTrapezoid;
-
-typedef struct _KaaScreenInfo {
- Bool (*PrepareSolid) (PixmapPtr pPixmap,
- int alu,
- Pixel planemask,
- Pixel fg);
- void (*Solid) (int x1, int y1, int x2, int y2);
- void (*DoneSolid) (void);
-
- Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
- PixmapPtr pDstPixmap,
- Bool upsidedown,
- Bool reverse,
- int alu,
- Pixel planemask);
- void (*Copy) (int srcX,
- int srcY,
- int dstX,
- int dstY,
- int width,
- int height);
- void (*DoneCopy) (void);
-
- int offscreenByteAlign;
- int offscreenPitch;
- int flags;
-
- Bool (*PrepareBlend) (int op,
- PicturePtr pSrcPicture,
- PicturePtr pDstPicture,
- PixmapPtr pSrc,
- PixmapPtr pDst);
- void (*Blend) (int srcX,
- int srcY,
- int dstX,
- int dstY,
- int width,
- int height);
- void (*DoneBlend) (void);
-
- Bool (*CheckComposite) (int op,
- PicturePtr pSrcPicture,
- PicturePtr pMaskPicture,
- PicturePtr pDstPicture);
- Bool (*PrepareComposite) (int op,
- PicturePtr pSrcPicture,
- PicturePtr pMaskPicture,
- PicturePtr pDstPicture,
- PixmapPtr pSrc,
- PixmapPtr pMask,
- PixmapPtr pDst);
- void (*Composite) (int srcX,
- int srcY,
- int maskX,
- int maskY,
- int dstX,
- int dstY,
- int width,
- int height);
- void (*DoneComposite) (void);
-
- Bool (*PrepareTrapezoids) (PicturePtr pDstPicture,
- PixmapPtr pDst);
- void (*Trapezoids) (KaaTrapezoid *traps,
- int ntraps);
- void (*DoneTrapezoids) (void);
-
- Bool (*UploadToScreen) (PixmapPtr pDst,
- char *src,
- int src_pitch);
- Bool (*UploadToScratch) (PixmapPtr pSrc,
- PixmapPtr pDst);
-} KaaScreenInfoRec, *KaaScreenInfoPtr;
-
-#define KAA_OFFSCREEN_PIXMAPS (1 << 0)
-#define KAA_OFFSCREEN_ALIGN_POT (1 << 1)
-
-/*
- * This is the only completely portable way to
- * compute this info.
- */
-
-#ifndef BitsPerPixel
-#define BitsPerPixel(d) (\
- PixmapWidthPaddingInfo[d].notPower2 ? \
- (PixmapWidthPaddingInfo[d].bytesPerPixel * 8) : \
- ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
- (PixmapWidthPaddingInfo[d].padRoundUp+1)))
-#endif
-
-extern int kdScreenPrivateIndex;
-extern unsigned long kdGeneration;
-extern Bool kdEnabled;
-extern Bool kdSwitchPending;
-extern Bool kdEmulateMiddleButton;
-extern Bool kdDisableZaphod;
-extern Bool kdDontZap;
-extern int kdVirtualTerminal;
-extern char *kdSwitchCmd;
-extern KdOsFuncs *kdOsFuncs;
-
-#define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \
- (pScreen)->devPrivates[kdScreenPrivateIndex].ptr)
-#define KdSetScreenPriv(pScreen,v) ((pScreen)->devPrivates[kdScreenPrivateIndex].ptr = \
- (pointer) v)
-#define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen)
-
-#define KdCheckSync(s) { \
- KdScreenPriv(s); \
- KdCardInfo *card = pScreenPriv->card; \
- if (card->needSync) { \
- card->needSync = FALSE; \
- (*card->cfuncs->syncAccel) (s); \
- } \
-}
-
-#define KdMarkSync(s) (KdGetScreenPriv(s)->card->needSync = TRUE)
-
-/* kaa.c */
-Bool
-kaaDrawInit (ScreenPtr pScreen,
- KaaScreenInfoPtr pScreenInfo);
-
-void
-kaaDrawFini (ScreenPtr pScreen);
-
-void
-kaaWrapGC (GCPtr pGC);
-
-void
-kaaUnwrapGC (GCPtr pGC);
-
-/* kasync.c */
-void
-KdCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
- DDXPointPtr ppt, int *pwidth, int fSorted);
-
-void
-KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
- DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
-
-void
-KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
- int x, int y, int w, int h, int leftPad, int format,
- char *bits);
-
-RegionPtr
-KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty);
-
-RegionPtr
-KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty,
- unsigned long bitPlane);
-
-void
-KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
- DDXPointPtr pptInit);
-
-void
-KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr ppt);
-
-void
-KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
- int nsegInit, xSegment *pSegInit);
-
-void
-KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC,
- int nrects, xRectangle *prect);
-
-void
-KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *pArcs);
-
-#define KdCheckFillPolygon miFillPolygon
-
-void
-KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrect, xRectangle *prect);
-
-void
-KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *pArcs);
-
-void
-KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase);
-
-void
-KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase);
-
-void
-KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w, int h, int x, int y);
-
-void
-KdCheckGetImage (DrawablePtr pDrawable,
- int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask,
- char *d);
-
-void
-KdCheckGetSpans (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pdstStart);
-
-void
-KdCheckSaveAreas (PixmapPtr pPixmap,
- RegionPtr prgnSave,
- int xorg,
- int yorg,
- WindowPtr pWin);
-
-void
-KdCheckRestoreAreas (PixmapPtr pPixmap,
- RegionPtr prgnSave,
- int xorg,
- int yorg,
- WindowPtr pWin);
-
-void
-KdCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what);
-
-void
-KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-
-void
-KdCheckPaintKey(DrawablePtr pDrawable,
- RegionPtr pRegion,
- CARD32 pixel,
- int layer);
-
-void
-KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-
-void
-KdScreenInitAsync (ScreenPtr pScreen);
-
-extern const GCOps kdAsyncPixmapGCOps;
-
-/* knoop.c */
-extern GCOps kdNoopOps;
-
-/* kcmap.c */
-void
-KdSetColormap (ScreenPtr pScreen, int fb);
-
-void
-KdEnableColormap (ScreenPtr pScreen);
-
-void
-KdDisableColormap (ScreenPtr pScreen);
-
-void
-KdInstallColormap (ColormapPtr pCmap);
-
-void
-KdUninstallColormap (ColormapPtr pCmap);
-
-int
-KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps);
-
-void
-KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs);
-
-/* kcurscol.c */
-void
-KdAllocateCursorPixels (ScreenPtr pScreen,
- int fb,
- CursorPtr pCursor,
- Pixel *source,
- Pixel *mask);
-
-/* kdrive.c */
-extern miPointerScreenFuncRec kdPointerScreenFuncs;
-
-void
-KdSetRootClip (ScreenPtr pScreen, BOOL enable);
-
-void
-KdDisableScreen (ScreenPtr pScreen);
-
-void
-KdDisableScreens (void);
-
-Bool
-KdEnableScreen (ScreenPtr pScreen);
-
-void
-KdEnableScreens (void);
-
-void
-KdSuspend (void);
-
-void
-KdResume (void);
-
-void
-KdProcessSwitch (void);
-
-Rotation
-KdAddRotation (Rotation a, Rotation b);
-
-Rotation
-KdSubRotation (Rotation a, Rotation b);
-
-void
-KdParseScreen (KdScreenInfo *screen,
- char *arg);
-
-char *
-KdSaveString (char *str);
-
-void
-KdParseMouse (char *arg);
-
-void
-KdParseRgba (char *rgba);
-
-void
-KdUseMsg (void);
-
-int
-KdProcessArgument (int argc, char **argv, int i);
-
-void
-KdOsInit (KdOsFuncs *pOsFuncs);
-
-Bool
-KdAllocatePrivates (ScreenPtr pScreen);
-
-Bool
-KdCreateScreenResources (ScreenPtr pScreen);
-
-Bool
-KdCloseScreen (int index, ScreenPtr pScreen);
-
-Bool
-KdSaveScreen (ScreenPtr pScreen, int on);
-
-Bool
-KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv);
-
-void
-KdInitScreen (ScreenInfo *pScreenInfo,
- KdScreenInfo *screen,
- int argc,
- char **argv);
-
-void
-KdInitCard (ScreenInfo *pScreenInfo,
- KdCardInfo *card,
- int argc,
- char **argv);
-
-void
-KdInitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv);
-
-void
-KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr);
-
-/* kinfo.c */
-KdCardInfo *
-KdCardInfoAdd (KdCardFuncs *funcs,
- KdCardAttr *attr,
- void *closure);
-
-KdCardInfo *
-KdCardInfoLast (void);
-
-void
-KdCardInfoDispose (KdCardInfo *ci);
-
-KdScreenInfo *
-KdScreenInfoAdd (KdCardInfo *ci);
-
-void
-KdScreenInfoDispose (KdScreenInfo *si);
-
-
-/* kinput.c */
-void
-KdInitInput(KdMouseFuncs *, KdKeyboardFuncs *);
-
-void
-KdAddMouseDriver(KdMouseFuncs *);
-
-int
-KdAllocInputType (void);
-
-Bool
-KdRegisterFd (int type, int fd, void (*read) (int fd, void *closure), void *closure);
-
-void
-KdRegisterFdEnableDisable (int fd,
- int (*enable) (int fd, void *closure),
- void (*disable) (int fd, void *closure));
-
-void
-KdUnregisterFds (int type, Bool do_close);
-
-void
-KdEnqueueKeyboardEvent(unsigned char scan_code,
- unsigned char is_up);
-
-#define KD_BUTTON_1 0x01
-#define KD_BUTTON_2 0x02
-#define KD_BUTTON_3 0x04
-#define KD_BUTTON_4 0x08
-#define KD_BUTTON_5 0x10
-#define KD_MOUSE_DELTA 0x80000000
-
-void
-KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int x, int y);
-
-void
-KdEnqueueMotionEvent (KdMouseInfo *mi, int x, int y);
-
-void
-KdReleaseAllKeys (void);
-
-void
-KdSetLed (int led, Bool on);
-
-void
-KdSetMouseMatrix (KdMouseMatrix *matrix);
-
-void
-KdComputeMouseMatrix (KdMouseMatrix *matrix, Rotation randr, int width, int height);
-
-void
-KdBlockHandler (int screen,
- pointer blockData,
- pointer timeout,
- pointer readmask);
-
-void
-KdWakeupHandler (int screen,
- pointer data,
- unsigned long result,
- pointer readmask);
-
-void
-KdDisableInput (void);
-
-void
-KdEnableInput (void);
-
-void
-ProcessInputEvents (void);
-
-extern KdMouseFuncs LinuxMouseFuncs;
-extern KdMouseFuncs LinuxEvdevFuncs;
-extern KdMouseFuncs Ps2MouseFuncs;
-extern KdMouseFuncs BusMouseFuncs;
-extern KdMouseFuncs MsMouseFuncs;
-#ifdef TOUCHSCREEN
-extern KdMouseFuncs TsFuncs;
-#endif
-extern KdKeyboardFuncs LinuxKeyboardFuncs;
-extern KdOsFuncs LinuxFuncs;
-
-extern KdMouseFuncs VxWorksMouseFuncs;
-extern KdKeyboardFuncs VxWorksKeyboardFuncs;
-extern KdOsFuncs VxWorksFuncs;
-
-/* kmap.c */
-
-#define KD_MAPPED_MODE_REGISTERS 0
-#define KD_MAPPED_MODE_FRAMEBUFFER 1
-
-void *
-KdMapDevice (CARD32 addr, CARD32 size);
-
-void
-KdUnmapDevice (void *addr, CARD32 size);
-
-void
-KdSetMappedMode (CARD32 addr, CARD32 size, int mode);
-
-void
-KdResetMappedMode (CARD32 addr, CARD32 size, int mode);
-
-/* kmode.c */
-const KdMonitorTiming *
-KdFindMode (KdScreenInfo *screen,
- Bool (*supported) (KdScreenInfo *,
- const KdMonitorTiming *));
-
-Bool
-KdTuneMode (KdScreenInfo *screen,
- Bool (*usable) (KdScreenInfo *),
- Bool (*supported) (KdScreenInfo *,
- const KdMonitorTiming *));
-
-#ifdef RANDR
-Bool
-KdRandRGetInfo (ScreenPtr pScreen,
- int randr,
- Bool (*supported) (ScreenPtr pScreen,
- const KdMonitorTiming *));
-
-const KdMonitorTiming *
-KdRandRGetTiming (ScreenPtr pScreen,
- Bool (*supported) (ScreenPtr pScreen,
- const KdMonitorTiming *),
- int rate,
- RRScreenSizePtr pSize);
-#endif
-
-/* kpict.c */
-void
-KdPictureInitAsync (ScreenPtr pScreen);
-
-#ifdef RENDER
-void
-KdCheckComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void
-KdCheckRasterizeTrapezoid(PicturePtr pMask,
- xTrapezoid *trap,
- int x_off,
- int y_off);
-#endif
-
-/* kshadow.c */
-Bool
-KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate);
-
-void
-KdShadowFbFree (KdScreenInfo *screen, int fb);
-
-Bool
-KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window);
-
-void
-KdShadowUnset (ScreenPtr pScreen);
-
-/* ktest.c */
-Bool
-KdFrameBufferValid (CARD8 *base, int size);
-
-int
-KdFrameBufferSize (CARD8 *base, int max);
-
-/* koffscreen.c */
-
-Bool
-KdOffscreenInit (ScreenPtr pScreen);
-
-KdOffscreenArea *
-KdOffscreenAlloc (ScreenPtr pScreen, int size, int align,
- Bool locked,
- KdOffscreenSaveProc save,
- pointer privData);
-
-KdOffscreenArea *
-KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area);
-
-void
-KdOffscreenMarkUsed (PixmapPtr pPixmap);
-
-void
-KdOffscreenSwapOut (ScreenPtr pScreen);
-
-void
-KdOffscreenSwapIn (ScreenPtr pScreen);
-
-void
-KdOffscreenFini (ScreenPtr pScreen);
-
-/* function prototypes to be implemented by the drivers */
-void
-InitCard (char *name);
-
-#endif /* _KDRIVE_H_ */
diff --git a/hw/kdrive/src/kinfo.c b/hw/kdrive/src/kinfo.c
deleted file mode 100644
index 883f7e56c..000000000
--- a/hw/kdrive/src/kinfo.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Id: kinfo.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kinfo.c,v 1.2 2000/02/23 20:29:53 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-KdCardInfo *kdCardInfo;
-
-KdCardInfo *
-KdCardInfoAdd (KdCardFuncs *funcs,
- KdCardAttr *attr,
- void *closure)
-{
- KdCardInfo *ci, **prev;
-
- ci = (KdCardInfo *) xalloc (sizeof (KdCardInfo));
- if (!ci)
- return 0;
- bzero (ci, sizeof (KdCardInfo));
- for (prev = &kdCardInfo; *prev; prev = &(*prev)->next);
- *prev = ci;
- ci->cfuncs = funcs;
- ci->attr = *attr;
- ci->closure = closure;
- ci->screenList = 0;
- ci->selected = 0;
- ci->next = 0;
- return ci;
-}
-
-KdCardInfo *
-KdCardInfoLast (void)
-{
- KdCardInfo *ci;
-
- if (!kdCardInfo)
- return 0;
- for (ci = kdCardInfo; ci->next; ci = ci->next);
- return ci;
-}
-
-void
-KdCardInfoDispose (KdCardInfo *ci)
-{
- KdCardInfo **prev;
-
- for (prev = &kdCardInfo; *prev; prev = &(*prev)->next)
- if (*prev == ci)
- {
- *prev = ci->next;
- xfree (ci);
- break;
- }
-}
-
-KdScreenInfo *
-KdScreenInfoAdd (KdCardInfo *ci)
-{
- KdScreenInfo *si, **prev;
- int n;
-
- si = (KdScreenInfo *) xalloc (sizeof (KdScreenInfo));
- if (!si)
- return 0;
- bzero (si, sizeof (KdScreenInfo));
- for (prev = &ci->screenList, n = 0; *prev; prev = &(*prev)->next, n++);
- *prev = si;
- si->next = 0;
- si->card = ci;
- si->mynum = n;
- return si;
-}
-
-void
-KdScreenInfoDispose (KdScreenInfo *si)
-{
- KdCardInfo *ci = si->card;
- KdScreenInfo **prev;
-
- for (prev = &ci->screenList; *prev; prev = &(*prev)->next)
- if (*prev == si)
- {
- *prev = si->next;
- xfree (si);
- if (!ci->screenList)
- KdCardInfoDispose (ci);
- break;
- }
-}
-
-KdMouseInfo *kdMouseInfo;
-
-KdMouseInfo *
-KdMouseInfoAdd (void)
-{
- KdMouseInfo *mi, **prev;
-
- mi = (KdMouseInfo *) xalloc (sizeof (KdMouseInfo));
- if (!mi)
- return 0;
- bzero (mi, sizeof (KdMouseInfo));
- for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next);
- *prev = mi;
- return mi;
-}
-
-void
-KdMouseInfoDispose (KdMouseInfo *mi)
-{
- KdMouseInfo **prev;
-
- for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next)
- if (*prev == mi)
- {
- *prev = mi->next;
- if (mi->name)
- xfree (mi->name);
- if (mi->prot)
- xfree (mi->prot);
- xfree (mi);
- break;
- }
-}
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
deleted file mode 100644
index 1fc6e71d1..000000000
--- a/hw/kdrive/src/kinput.c
+++ /dev/null
@@ -1,1679 +0,0 @@
-/*
- * Id: kinput.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kinput.c,v 1.30 2002/11/13 16:37:39 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "inputstr.h"
-
-#define XK_PUBLISHING
-#include <X11/keysym.h>
-#if HAVE_X11_XF86KEYSYM_H
-#include <X11/XF86keysym.h>
-#endif
-#include "kkeymap.h"
-#include <signal.h>
-#include <stdio.h>
-
-#ifdef XKB
-#define XKB_IN_SERVER
-#include <X11/extensions/XKBsrv.h>
-#endif
-
-static DeviceIntPtr pKdKeyboard, pKdPointer;
-
-#define MAX_MOUSE_DRIVERS 4
-
-static KdMouseFuncs *kdMouseFuncs[MAX_MOUSE_DRIVERS];
-static int kdNMouseFuncs;
-static KdKeyboardFuncs *kdKeyboardFuncs;
-static int kdBellPitch;
-static int kdBellDuration;
-static int kdLeds;
-static Bool kdInputEnabled;
-static Bool kdOffScreen;
-static unsigned long kdOffScreenTime;
-static KdMouseMatrix kdMouseMatrix = {
- { { 1, 0, 0 },
- { 0, 1, 0 } }
-};
-
-int kdMouseButtonCount;
-int kdMinScanCode;
-int kdMaxScanCode;
-int kdMinKeyCode;
-int kdMaxKeyCode;
-int kdKeymapWidth = KD_MAX_WIDTH;
-KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
-CARD8 kdModMap[MAP_LENGTH];
-KeySymsRec kdKeySyms;
-
-
-void
-KdResetInputMachine (void);
-
-#define KD_KEY_COUNT 248
-
-CARD8 kdKeyState[KD_KEY_COUNT/8];
-
-#define IsKeyDown(key) ((kdKeyState[(key) >> 3] >> ((key) & 7)) & 1)
-
-#define KD_MAX_INPUT_FDS 8
-
-typedef struct _kdInputFd {
- int type;
- int fd;
- void (*read) (int fd, void *closure);
- int (*enable) (int fd, void *closure);
- void (*disable) (int fd, void *closure);
- void *closure;
-} KdInputFd;
-
-KdInputFd kdInputFds[KD_MAX_INPUT_FDS];
-int kdNumInputFds;
-int kdInputTypeSequence;
-
-static void
-KdSigio (int sig)
-{
- int i;
-
- for (i = 0; i < kdNumInputFds; i++)
- (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
-}
-
-static void
-KdBlockSigio (void)
-{
- sigset_t set;
-
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_BLOCK, &set, 0);
-}
-
-static void
-KdUnblockSigio (void)
-{
- sigset_t set;
-
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_UNBLOCK, &set, 0);
-}
-
-#undef VERIFY_SIGIO
-#ifdef VERIFY_SIGIO
-
-void
-KdAssertSigioBlocked (char *where)
-{
- sigset_t set, old;
-
- sigemptyset (&set);
- sigprocmask (SIG_BLOCK, &set, &old);
- if (!sigismember (&old, SIGIO))
- ErrorF ("SIGIO not blocked at %s\n", where);
-}
-
-#else
-
-#define KdAssertSigioBlocked(s)
-
-#endif
-
-static int kdnFds;
-
-#ifdef FNONBLOCK
-#define NOBLOCK FNONBLOCK
-#else
-#define NOBLOCK FNDELAY
-#endif
-
-static void
-KdNonBlockFd (int fd)
-{
- int flags;
- flags = fcntl (fd, F_GETFL);
- flags |= FASYNC|NOBLOCK;
- fcntl (fd, F_SETFL, flags);
-}
-
-static void
-KdAddFd (int fd)
-{
- struct sigaction act;
- sigset_t set;
-
- kdnFds++;
- fcntl (fd, F_SETOWN, getpid());
- KdNonBlockFd (fd);
- AddEnabledDevice (fd);
- memset (&act, '\0', sizeof act);
- act.sa_handler = KdSigio;
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGIO);
- sigaddset (&act.sa_mask, SIGALRM);
- sigaddset (&act.sa_mask, SIGVTALRM);
- sigaction (SIGIO, &act, 0);
- sigemptyset (&set);
- sigprocmask (SIG_SETMASK, &set, 0);
-}
-
-static void
-KdRemoveFd (int fd)
-{
- struct sigaction act;
- int flags;
-
- kdnFds--;
- RemoveEnabledDevice (fd);
- flags = fcntl (fd, F_GETFL);
- flags &= ~(FASYNC|NOBLOCK);
- fcntl (fd, F_SETFL, flags);
- if (kdnFds == 0)
- {
- memset (&act, '\0', sizeof act);
- act.sa_handler = SIG_IGN;
- sigemptyset (&act.sa_mask);
- sigaction (SIGIO, &act, 0);
- }
-}
-
-int
-KdAllocInputType (void)
-{
- return ++kdInputTypeSequence;
-}
-
-Bool
-KdRegisterFd (int type, int fd, void (*read) (int fd, void *closure), void *closure)
-{
- if (kdNumInputFds == KD_MAX_INPUT_FDS)
- return FALSE;
- kdInputFds[kdNumInputFds].type = type;
- kdInputFds[kdNumInputFds].fd = fd;
- kdInputFds[kdNumInputFds].read = read;
- kdInputFds[kdNumInputFds].enable = 0;
- kdInputFds[kdNumInputFds].disable = 0;
- kdInputFds[kdNumInputFds].closure = closure;
- ++kdNumInputFds;
- if (kdInputEnabled)
- KdAddFd (fd);
- return TRUE;
-}
-
-void
-KdRegisterFdEnableDisable (int fd,
- int (*enable) (int fd, void *closure),
- void (*disable) (int fd, void *closure))
-{
- int i;
-
- for (i = 0; i < kdNumInputFds; i++)
- if (kdInputFds[i].fd == fd)
- {
- kdInputFds[i].enable = enable;
- kdInputFds[i].disable = disable;
- break;
- }
-}
-
-void
-KdUnregisterFds (int type, Bool do_close)
-{
- int i, j;
-
- for (i = 0; i < kdNumInputFds;)
- {
- if (kdInputFds[i].type == type)
- {
- if (kdInputEnabled)
- KdRemoveFd (kdInputFds[i].fd);
- if (do_close)
- close (kdInputFds[i].fd);
- --kdNumInputFds;
- for (j = i; j < kdNumInputFds; j++)
- kdInputFds[j] = kdInputFds[j+1];
- }
- else
- i++;
- }
-}
-
-void
-KdDisableInput (void)
-{
- int i;
-
- KdBlockSigio ();
-
- for (i = 0; i < kdNumInputFds; i++)
- {
- KdRemoveFd (kdInputFds[i].fd);
- if (kdInputFds[i].disable)
- (*kdInputFds[i].disable) (kdInputFds[i].fd, kdInputFds[i].closure);
- }
- kdInputEnabled = FALSE;
-}
-
-void
-KdEnableInput (void)
-{
- xEvent xE;
- int i;
-
- kdInputEnabled = TRUE;
- for (i = 0; i < kdNumInputFds; i++)
- {
- KdNonBlockFd (kdInputFds[i].fd);
- if (kdInputFds[i].enable)
- kdInputFds[i].fd = (*kdInputFds[i].enable) (kdInputFds[i].fd, kdInputFds[i].closure);
- KdAddFd (kdInputFds[i].fd);
- }
-
- /* reset screen saver */
- xE.u.keyButtonPointer.time = GetTimeInMillis ();
- NoticeEventTime (&xE);
-
- KdUnblockSigio ();
-}
-
-static int
-KdMouseProc(DeviceIntPtr pDevice, int onoff)
-{
- BYTE map[KD_MAX_BUTTON];
- DevicePtr pDev = (DevicePtr)pDevice;
- int i;
-
- if (!pDev)
- return BadImplementation;
-
- switch (onoff)
- {
- case DEVICE_INIT:
- for (i = 1; i <= kdMouseButtonCount; i++)
- map[i] = i;
- InitPointerDeviceStruct(pDev, map, kdMouseButtonCount,
- miPointerGetMotionEvents,
- (PtrCtrlProcPtr)NoopDDA,
- miPointerGetMotionBufferSize());
- break;
-
- case DEVICE_ON:
- pDev->on = TRUE;
- pKdPointer = pDevice;
- for (i = 0; i < kdNMouseFuncs; i++)
- (*kdMouseFuncs[i]->Init)();
- break;
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- if (pDev->on)
- {
- pDev->on = FALSE;
- pKdPointer = 0;
- for (i = 0; i < kdNMouseFuncs; i++)
- (*kdMouseFuncs[i]->Fini) ();
- }
- break;
- }
- return Success;
-}
-
-Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
-{
- return TRUE;
-}
-
-static void
-KdBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something)
-{
- if (kdInputEnabled)
- (*kdKeyboardFuncs->Bell) (volume, kdBellPitch, kdBellDuration);
-}
-
-
-static void
-KdSetLeds (void)
-{
- if (kdInputEnabled)
- (*kdKeyboardFuncs->Leds) (kdLeds);
-}
-
-void
-KdSetLed (int led, Bool on)
-{
- NoteLedState (pKdKeyboard, led, on);
- kdLeds = pKdKeyboard->kbdfeed->ctrl.leds;
- KdSetLeds ();
-}
-
-void
-KdSetMouseMatrix (KdMouseMatrix *matrix)
-{
- kdMouseMatrix = *matrix;
-}
-
-void
-KdComputeMouseMatrix (KdMouseMatrix *m, Rotation randr, int width, int height)
-{
- int x_dir = 1, y_dir = 1;
- int i, j;
- int size[2];
-
- size[0] = width; size[1] = height;
- if (randr & RR_Reflect_X)
- x_dir = -1;
- if (randr & RR_Reflect_Y)
- y_dir = -1;
- switch (randr & (RR_Rotate_All)) {
- case RR_Rotate_0:
- m->matrix[0][0] = x_dir; m->matrix[0][1] = 0;
- m->matrix[1][0] = 0; m->matrix[1][1] = y_dir;
- break;
- case RR_Rotate_90:
- m->matrix[0][0] = 0; m->matrix[0][1] = -x_dir;
- m->matrix[1][0] = y_dir; m->matrix[1][1] = 0;
- break;
- case RR_Rotate_180:
- m->matrix[0][0] = -x_dir; m->matrix[0][1] = 0;
- m->matrix[1][0] = 0; m->matrix[1][1] = -y_dir;
- break;
- case RR_Rotate_270:
- m->matrix[0][0] = 0; m->matrix[0][1] = x_dir;
- m->matrix[1][0] = -y_dir; m->matrix[1][1] = 0;
- break;
- }
- for (i = 0; i < 2; i++)
- {
- m->matrix[i][2] = 0;
- for (j = 0 ; j < 2; j++)
- if (m->matrix[i][j] < 0)
- m->matrix[i][2] = size[j] - 1;
- }
-}
-
-static void
-KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
-{
- kdLeds = ctrl->leds;
- kdBellPitch = ctrl->bell_pitch;
- kdBellDuration = ctrl->bell_duration;
- KdSetLeds ();
-}
-
-static int
-KdKeybdProc(DeviceIntPtr pDevice, int onoff)
-{
- Bool ret;
- DevicePtr pDev = (DevicePtr)pDevice;
-#ifdef XKB
- XkbComponentNamesRec names;
-#endif
-
- if (!pDev)
- return BadImplementation;
-
- switch (onoff)
- {
- case DEVICE_INIT:
- if (pDev != LookupKeyboardDevice())
- {
- return !Success;
- }
-#ifndef XKB
- ret = InitKeyboardDeviceStruct(pDev,
- &kdKeySyms,
- kdModMap,
- KdBell, KdKbdCtrl);
-#else
- memset(&names, 0, sizeof(XkbComponentNamesRec));
-
- if (XkbInitialMap)
- names.keymap = XkbInitialMap;
-
- XkbSetRulesDflts ("base", "pc101", "us", NULL, NULL);
- ret = XkbInitKeyboardDeviceStruct (pDev,
- &names,
- &kdKeySyms,
- kdModMap,
- KdBell, KdKbdCtrl);
-#endif
- if (!ret)
- return BadImplementation;
- break;
- case DEVICE_ON:
- pDev->on = TRUE;
- pKdKeyboard = pDevice;
- if (kdKeyboardFuncs)
- (*kdKeyboardFuncs->Init) ();
- break;
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- pKdKeyboard = 0;
- if (pDev->on)
- {
- pDev->on = FALSE;
- if (kdKeyboardFuncs)
- (*kdKeyboardFuncs->Fini) ();
- }
- break;
- }
- return Success;
-}
-
-extern KeybdCtrl defaultKeyboardControl;
-
-static void
-KdInitAutoRepeats (void)
-{
- int key_code;
- unsigned char mask;
- int i;
- unsigned char *repeats;
-
- repeats = defaultKeyboardControl.autoRepeats;
- memset (repeats, '\0', 32);
- for (key_code = KD_MIN_KEYCODE; key_code <= KD_MAX_KEYCODE; key_code++)
- {
- if (!kdModMap[key_code])
- {
- i = key_code >> 3;
- mask = 1 << (key_code & 7);
- repeats[i] |= mask;
- }
- }
-}
-
-const KdKeySymModsRec kdKeySymMods[] = {
- { XK_Control_L, ControlMask },
- { XK_Control_R, ControlMask },
- { XK_Shift_L, ShiftMask },
- { XK_Shift_R, ShiftMask },
- { XK_Caps_Lock, LockMask },
- { XK_Shift_Lock, LockMask },
- { XK_Alt_L, Mod1Mask },
- { XK_Alt_R, Mod1Mask },
- { XK_Meta_L, Mod1Mask },
- { XK_Meta_R, Mod1Mask },
- { XK_Num_Lock, Mod2Mask },
- { XK_Super_L, Mod3Mask },
- { XK_Super_R, Mod3Mask },
- { XK_Hyper_L, Mod3Mask },
- { XK_Hyper_R, Mod3Mask },
- { XK_Mode_switch, Mod4Mask },
-#ifdef TOUCHSCREEN
- /* PDA specific hacks */
-#ifdef XF86XK_Start
- { XF86XK_Start, ControlMask },
-#endif
- { XK_Menu, ShiftMask },
- { XK_telephone, Mod1Mask },
-#ifdef XF86XK_AudioRecord
- { XF86XK_AudioRecord, Mod2Mask },
-#endif
-#ifdef XF86XK_Calendar
- { XF86XK_Calendar, Mod3Mask }
-#endif
-#endif
-};
-
-#define NUM_SYM_MODS (sizeof(kdKeySymMods) / sizeof(kdKeySymMods[0]))
-
-static void
-KdInitModMap (void)
-{
- int key_code;
- int row;
- int width;
- KeySym *syms;
- int i;
-
- width = kdKeySyms.mapWidth;
- for (key_code = kdMinKeyCode; key_code <= kdMaxKeyCode; key_code++)
- {
- kdModMap[key_code] = 0;
- syms = kdKeymap + (key_code - kdMinKeyCode) * width;
- for (row = 0; row < width; row++, syms++)
- {
- for (i = 0; i < NUM_SYM_MODS; i++)
- {
- if (*syms == kdKeySymMods[i].modsym)
- kdModMap[key_code] |= kdKeySymMods[i].modbit;
- }
- }
- }
-}
-
-void
-KdAddMouseDriver(KdMouseFuncs *pMouseFuncs)
-{
- if (kdNMouseFuncs < MAX_MOUSE_DRIVERS)
- kdMouseFuncs[kdNMouseFuncs++] = pMouseFuncs;
-}
-
-void
-KdInitInput(KdMouseFuncs *pMouseFuncs,
- KdKeyboardFuncs *pKeyboardFuncs)
-{
- DeviceIntPtr pKeyboard, pPointer;
- KdMouseInfo *mi;
-
- if (!kdMouseInfo)
- KdParseMouse (0);
- kdMouseButtonCount = 0;
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->nbutton > kdMouseButtonCount)
- kdMouseButtonCount = mi->nbutton;
- }
-
- kdNMouseFuncs = 0;
- KdAddMouseDriver (pMouseFuncs);
- kdKeyboardFuncs = pKeyboardFuncs;
- memset (kdKeyState, '\0', sizeof (kdKeyState));
- if (kdKeyboardFuncs)
- (*kdKeyboardFuncs->Load) ();
- kdMinKeyCode = kdMinScanCode + KD_KEY_OFFSET;
- kdMaxKeyCode = kdMaxScanCode + KD_KEY_OFFSET;
- kdKeySyms.map = kdKeymap;
- kdKeySyms.minKeyCode = kdMinKeyCode;
- kdKeySyms.maxKeyCode = kdMaxKeyCode;
- kdKeySyms.mapWidth = kdKeymapWidth;
- kdLeds = 0;
- kdBellPitch = 1000;
- kdBellDuration = 200;
- kdInputEnabled = TRUE;
- KdInitModMap ();
- KdInitAutoRepeats ();
- KdResetInputMachine ();
- pPointer = AddInputDevice(KdMouseProc, TRUE);
- pKeyboard = AddInputDevice(KdKeybdProc, TRUE);
- RegisterPointerDevice(pPointer);
- RegisterKeyboardDevice(pKeyboard);
- miRegisterPointerDevice(screenInfo.screens[0], pPointer);
- mieqInit(&pKeyboard->public, &pPointer->public);
-#ifdef XINPUT
- {
- static long zero1, zero2;
-
- //SetExtInputCheck (&zero1, &zero2);
- ErrorF("Extended Input Devices not yet supported. Impelement it at line %d in %s\n",
- __LINE__, __FILE__);
- }
-#endif
-}
-
-/*
- * Middle button emulation state machine
- *
- * Possible transitions:
- * Button 1 press v1
- * Button 1 release ^1
- * Button 2 press v2
- * Button 2 release ^2
- * Button 3 press v3
- * Button 3 release ^3
- * Button other press vo
- * Button other release ^o
- * Mouse motion <>
- * Keyboard event k
- * timeout ...
- * outside box <->
- *
- * States:
- * start
- * button_1_pend
- * button_1_down
- * button_2_down
- * button_3_pend
- * button_3_down
- * synthetic_2_down_13
- * synthetic_2_down_3
- * synthetic_2_down_1
- *
- * Transition diagram
- *
- * start
- * v1 -> (hold) (settimeout) button_1_pend
- * ^1 -> (deliver) start
- * v2 -> (deliver) button_2_down
- * ^2 -> (deliever) start
- * v3 -> (hold) (settimeout) button_3_pend
- * ^3 -> (deliver) start
- * vo -> (deliver) start
- * ^o -> (deliver) start
- * <> -> (deliver) start
- * k -> (deliver) start
- *
- * button_1_pend (button 1 is down, timeout pending)
- * ^1 -> (release) (deliver) start
- * v2 -> (release) (deliver) button_1_down
- * ^2 -> (release) (deliver) button_1_down
- * v3 -> (cleartimeout) (generate v2) synthetic_2_down_13
- * ^3 -> (release) (deliver) button_1_down
- * vo -> (release) (deliver) button_1_down
- * ^o -> (release) (deliver) button_1_down
- * <-> -> (release) (deliver) button_1_down
- * <> -> (deliver) button_1_pend
- * k -> (release) (deliver) button_1_down
- * ... -> (release) button_1_down
- *
- * button_1_down (button 1 is down)
- * ^1 -> (deliver) start
- * v2 -> (deliver) button_1_down
- * ^2 -> (deliver) button_1_down
- * v3 -> (deliver) button_1_down
- * ^3 -> (deliver) button_1_down
- * vo -> (deliver) button_1_down
- * ^o -> (deliver) button_1_down
- * <> -> (deliver) button_1_down
- * k -> (deliver) button_1_down
- *
- * button_2_down (button 2 is down)
- * v1 -> (deliver) button_2_down
- * ^1 -> (deliver) button_2_down
- * ^2 -> (deliver) start
- * v3 -> (deliver) button_2_down
- * ^3 -> (deliver) button_2_down
- * vo -> (deliver) button_2_down
- * ^o -> (deliver) button_2_down
- * <> -> (deliver) button_2_down
- * k -> (deliver) button_2_down
- *
- * button_3_pend (button 3 is down, timeout pending)
- * v1 -> (generate v2) synthetic_2_down
- * ^1 -> (release) (deliver) button_3_down
- * v2 -> (release) (deliver) button_3_down
- * ^2 -> (release) (deliver) button_3_down
- * ^3 -> (release) (deliver) start
- * vo -> (release) (deliver) button_3_down
- * ^o -> (release) (deliver) button_3_down
- * <-> -> (release) (deliver) button_3_down
- * <> -> (deliver) button_3_pend
- * k -> (release) (deliver) button_3_down
- * ... -> (release) button_3_down
- *
- * button_3_down (button 3 is down)
- * v1 -> (deliver) button_3_down
- * ^1 -> (deliver) button_3_down
- * v2 -> (deliver) button_3_down
- * ^2 -> (deliver) button_3_down
- * ^3 -> (deliver) start
- * vo -> (deliver) button_3_down
- * ^o -> (deliver) button_3_down
- * <> -> (deliver) button_3_down
- * k -> (deliver) button_3_down
- *
- * synthetic_2_down_13 (button 1 and 3 are down)
- * ^1 -> (generate ^2) synthetic_2_down_3
- * v2 -> synthetic_2_down_13
- * ^2 -> synthetic_2_down_13
- * ^3 -> (generate ^2) synthetic_2_down_1
- * vo -> (deliver) synthetic_2_down_13
- * ^o -> (deliver) synthetic_2_down_13
- * <> -> (deliver) synthetic_2_down_13
- * k -> (deliver) synthetic_2_down_13
- *
- * synthetic_2_down_3 (button 3 is down)
- * v1 -> (deliver) synthetic_2_down_3
- * ^1 -> (deliver) synthetic_2_down_3
- * v2 -> synthetic_2_down_3
- * ^2 -> synthetic_2_down_3
- * ^3 -> start
- * vo -> (deliver) synthetic_2_down_3
- * ^o -> (deliver) synthetic_2_down_3
- * <> -> (deliver) synthetic_2_down_3
- * k -> (deliver) synthetic_2_down_3
- *
- * synthetic_2_down_1 (button 1 is down)
- * ^1 -> start
- * v2 -> synthetic_2_down_1
- * ^2 -> synthetic_2_down_1
- * v3 -> (deliver) synthetic_2_down_1
- * ^3 -> (deliver) synthetic_2_down_1
- * vo -> (deliver) synthetic_2_down_1
- * ^o -> (deliver) synthetic_2_down_1
- * <> -> (deliver) synthetic_2_down_1
- * k -> (deliver) synthetic_2_down_1
- */
-
-typedef enum _inputClass {
- down_1, up_1,
- down_2, up_2,
- down_3, up_3,
- down_o, up_o,
- motion, outside_box,
- keyboard, timeout,
- num_input_class
-} KdInputClass;
-
-typedef enum _inputAction {
- noop,
- hold,
- setto,
- deliver,
- release,
- clearto,
- gen_down_2,
- gen_up_2
-} KdInputAction;
-
-#define MAX_ACTIONS 2
-
-typedef struct _inputTransition {
- KdInputAction actions[MAX_ACTIONS];
- KdMouseState nextState;
-} KdInputTransition;
-
-KdInputTransition kdInputMachine[num_input_states][num_input_class] = {
- /* start */
- {
- { { hold, setto }, button_1_pend }, /* v1 */
- { { deliver, noop }, start }, /* ^1 */
- { { deliver, noop }, button_2_down }, /* v2 */
- { { deliver, noop }, start }, /* ^2 */
- { { hold, setto }, button_3_pend }, /* v3 */
- { { deliver, noop }, start }, /* ^3 */
- { { deliver, noop }, start }, /* vo */
- { { deliver, noop }, start }, /* ^o */
- { { deliver, noop }, start }, /* <> */
- { { deliver, noop }, start }, /* <-> */
- { { noop, noop }, start }, /* k */
- { { noop, noop }, start }, /* ... */
- },
- /* button_1_pend */
- {
- { { noop, noop }, button_1_pend }, /* v1 */
- { { release, deliver }, start }, /* ^1 */
- { { release, deliver }, button_1_down }, /* v2 */
- { { release, deliver }, button_1_down }, /* ^2 */
- { { clearto, gen_down_2 }, synth_2_down_13 }, /* v3 */
- { { release, deliver }, button_1_down }, /* ^3 */
- { { release, deliver }, button_1_down }, /* vo */
- { { release, deliver }, button_1_down }, /* ^o */
- { { deliver, noop }, button_1_pend }, /* <> */
- { { release, deliver }, button_1_down }, /* <-> */
- { { noop, noop }, button_1_down }, /* k */
- { { release, noop }, button_1_down }, /* ... */
- },
- /* button_1_down */
- {
- { { noop, noop }, button_1_down }, /* v1 */
- { { deliver, noop }, start }, /* ^1 */
- { { deliver, noop }, button_1_down }, /* v2 */
- { { deliver, noop }, button_1_down }, /* ^2 */
- { { deliver, noop }, button_1_down }, /* v3 */
- { { deliver, noop }, button_1_down }, /* ^3 */
- { { deliver, noop }, button_1_down }, /* vo */
- { { deliver, noop }, button_1_down }, /* ^o */
- { { deliver, noop }, button_1_down }, /* <> */
- { { deliver, noop }, button_1_down }, /* <-> */
- { { noop, noop }, button_1_down }, /* k */
- { { noop, noop }, button_1_down }, /* ... */
- },
- /* button_2_down */
- {
- { { deliver, noop }, button_2_down }, /* v1 */
- { { deliver, noop }, button_2_down }, /* ^1 */
- { { noop, noop }, button_2_down }, /* v2 */
- { { deliver, noop }, start }, /* ^2 */
- { { deliver, noop }, button_2_down }, /* v3 */
- { { deliver, noop }, button_2_down }, /* ^3 */
- { { deliver, noop }, button_2_down }, /* vo */
- { { deliver, noop }, button_2_down }, /* ^o */
- { { deliver, noop }, button_2_down }, /* <> */
- { { deliver, noop }, button_2_down }, /* <-> */
- { { noop, noop }, button_2_down }, /* k */
- { { noop, noop }, button_2_down }, /* ... */
- },
- /* button_3_pend */
- {
- { { clearto, gen_down_2 }, synth_2_down_13 }, /* v1 */
- { { release, deliver }, button_3_down }, /* ^1 */
- { { release, deliver }, button_3_down }, /* v2 */
- { { release, deliver }, button_3_down }, /* ^2 */
- { { release, deliver }, button_3_down }, /* v3 */
- { { release, deliver }, start }, /* ^3 */
- { { release, deliver }, button_3_down }, /* vo */
- { { release, deliver }, button_3_down }, /* ^o */
- { { deliver, noop }, button_3_pend }, /* <> */
- { { release, deliver }, button_3_down }, /* <-> */
- { { release, noop }, button_3_down }, /* k */
- { { release, noop }, button_3_down }, /* ... */
- },
- /* button_3_down */
- {
- { { deliver, noop }, button_3_down }, /* v1 */
- { { deliver, noop }, button_3_down }, /* ^1 */
- { { deliver, noop }, button_3_down }, /* v2 */
- { { deliver, noop }, button_3_down }, /* ^2 */
- { { noop, noop }, button_3_down }, /* v3 */
- { { deliver, noop }, start }, /* ^3 */
- { { deliver, noop }, button_3_down }, /* vo */
- { { deliver, noop }, button_3_down }, /* ^o */
- { { deliver, noop }, button_3_down }, /* <> */
- { { deliver, noop }, button_3_down }, /* <-> */
- { { noop, noop }, button_3_down }, /* k */
- { { noop, noop }, button_3_down }, /* ... */
- },
- /* synthetic_2_down_13 */
- {
- { { noop, noop }, synth_2_down_13 }, /* v1 */
- { { gen_up_2, noop }, synth_2_down_3 }, /* ^1 */
- { { noop, noop }, synth_2_down_13 }, /* v2 */
- { { noop, noop }, synth_2_down_13 }, /* ^2 */
- { { noop, noop }, synth_2_down_13 }, /* v3 */
- { { gen_up_2, noop }, synth_2_down_1 }, /* ^3 */
- { { deliver, noop }, synth_2_down_13 }, /* vo */
- { { deliver, noop }, synth_2_down_13 }, /* ^o */
- { { deliver, noop }, synth_2_down_13 }, /* <> */
- { { deliver, noop }, synth_2_down_13 }, /* <-> */
- { { noop, noop }, synth_2_down_13 }, /* k */
- { { noop, noop }, synth_2_down_13 }, /* ... */
- },
- /* synthetic_2_down_3 */
- {
- { { deliver, noop }, synth_2_down_3 }, /* v1 */
- { { deliver, noop }, synth_2_down_3 }, /* ^1 */
- { { deliver, noop }, synth_2_down_3 }, /* v2 */
- { { deliver, noop }, synth_2_down_3 }, /* ^2 */
- { { noop, noop }, synth_2_down_3 }, /* v3 */
- { { noop, noop }, start }, /* ^3 */
- { { deliver, noop }, synth_2_down_3 }, /* vo */
- { { deliver, noop }, synth_2_down_3 }, /* ^o */
- { { deliver, noop }, synth_2_down_3 }, /* <> */
- { { deliver, noop }, synth_2_down_3 }, /* <-> */
- { { noop, noop }, synth_2_down_3 }, /* k */
- { { noop, noop }, synth_2_down_3 }, /* ... */
- },
- /* synthetic_2_down_1 */
- {
- { { noop, noop }, synth_2_down_1 }, /* v1 */
- { { noop, noop }, start }, /* ^1 */
- { { deliver, noop }, synth_2_down_1 }, /* v2 */
- { { deliver, noop }, synth_2_down_1 }, /* ^2 */
- { { deliver, noop }, synth_2_down_1 }, /* v3 */
- { { deliver, noop }, synth_2_down_1 }, /* ^3 */
- { { deliver, noop }, synth_2_down_1 }, /* vo */
- { { deliver, noop }, synth_2_down_1 }, /* ^o */
- { { deliver, noop }, synth_2_down_1 }, /* <> */
- { { deliver, noop }, synth_2_down_1 }, /* <-> */
- { { noop, noop }, synth_2_down_1 }, /* k */
- { { noop, noop }, synth_2_down_1 }, /* ... */
- },
-};
-
-#define EMULATION_WINDOW 10
-#define EMULATION_TIMEOUT 100
-
-#define EventX(e) ((e)->u.keyButtonPointer.rootX)
-#define EventY(e) ((e)->u.keyButtonPointer.rootY)
-
-static int
-KdInsideEmulationWindow (KdMouseInfo *mi, xEvent *ev)
-{
- if (ev->u.keyButtonPointer.pad1)
- {
- mi->emulationDx += EventX(ev);
- mi->emulationDy += EventY(ev);
- }
- else
- {
- mi->emulationDx = EventX(&mi->heldEvent) - EventX(ev);
- mi->emulationDy = EventY(&mi->heldEvent) - EventY(ev);
- }
- return (abs (mi->emulationDx) < EMULATION_WINDOW &&
- abs (mi->emulationDy) < EMULATION_WINDOW);
-}
-
-static KdInputClass
-KdClassifyInput (KdMouseInfo *mi, xEvent *ev)
-{
- switch (ev->u.u.type) {
- case ButtonPress:
- switch (ev->u.u.detail) {
- case 1: return down_1;
- case 2: return down_2;
- case 3: return down_3;
- default: return down_o;
- }
- break;
- case ButtonRelease:
- switch (ev->u.u.detail) {
- case 1: return up_1;
- case 2: return up_2;
- case 3: return up_3;
- default: return up_o;
- }
- break;
- case MotionNotify:
- if (mi->eventHeld && !KdInsideEmulationWindow(mi, ev))
- return outside_box;
- else
- return motion;
- default:
- return keyboard;
- }
- return keyboard;
-}
-
-#ifndef NDEBUG
-char *kdStateNames[] = {
- "start",
- "button_1_pend",
- "button_1_down",
- "button_2_down",
- "button_3_pend",
- "button_3_down",
- "synth_2_down_13",
- "synth_2_down_3",
- "synthetic_2_down_1",
- "num_input_states"
-};
-
-char *kdClassNames[] = {
- "down_1", "up_1",
- "down_2", "up_2",
- "down_3", "up_3",
- "motion", "ouside_box",
- "keyboard", "timeout",
- "num_input_class"
-};
-
-char *kdActionNames[] = {
- "noop",
- "hold",
- "setto",
- "deliver",
- "release",
- "clearto",
- "gen_down_2",
- "gen_up_2",
-};
-#endif
-
-static void
-KdQueueEvent (xEvent *ev)
-{
- KdAssertSigioBlocked ("KdQueueEvent");
- if (ev->u.u.type == MotionNotify)
- {
- if (ev->u.keyButtonPointer.pad1)
- {
- ev->u.keyButtonPointer.pad1 = 0;
- miPointerDeltaCursor (ev->u.keyButtonPointer.rootX,
- ev->u.keyButtonPointer.rootY,
- ev->u.keyButtonPointer.time);
- }
- else
- {
- miPointerAbsoluteCursor(ev->u.keyButtonPointer.rootX,
- ev->u.keyButtonPointer.rootY,
- ev->u.keyButtonPointer.time);
- }
- }
- else
- {
- mieqEnqueue (ev);
- }
-}
-
-static void
-KdRunMouseMachine (KdMouseInfo *mi, KdInputClass c, xEvent *ev)
-{
- KdInputTransition *t;
- int a;
-
- t = &kdInputMachine[mi->mouseState][c];
- for (a = 0; a < MAX_ACTIONS; a++)
- {
- switch (t->actions[a]) {
- case noop:
- break;
- case hold:
- mi->eventHeld = TRUE;
- mi->emulationDx = 0;
- mi->emulationDy = 0;
- mi->heldEvent = *ev;
- break;
- case setto:
- mi->emulationTimeout = GetTimeInMillis () + EMULATION_TIMEOUT;
- mi->timeoutPending = TRUE;
- break;
- case deliver:
- KdQueueEvent (ev);
- break;
- case release:
- mi->eventHeld = FALSE;
- mi->timeoutPending = FALSE;
- KdQueueEvent (&mi->heldEvent);
- break;
- case clearto:
- mi->timeoutPending = FALSE;
- break;
- case gen_down_2:
- ev->u.u.detail = 2;
- mi->eventHeld = FALSE;
- KdQueueEvent (ev);
- break;
- case gen_up_2:
- ev->u.u.detail = 2;
- KdQueueEvent (ev);
- break;
- }
- }
- mi->mouseState = t->nextState;
-}
-
-void
-KdResetInputMachine (void)
-{
- KdMouseInfo *mi;
-
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- mi->mouseState = start;
- mi->eventHeld = FALSE;
- }
-}
-
-static void
-KdHandleMouseEvent (KdMouseInfo *mi, xEvent *ev)
-{
- if (mi->emulateMiddleButton)
- KdRunMouseMachine (mi, KdClassifyInput (mi, ev), ev);
- else
- KdQueueEvent (ev);
-}
-
-static void
-KdReceiveTimeout (KdMouseInfo *mi)
-{
- KdRunMouseMachine (mi, timeout, 0);
-}
-
-#define KILL_SEQUENCE ((1L << KK_CONTROL)|(1L << KK_ALT)|(1L << KK_F8)|(1L << KK_F10))
-#define SPECIAL_SEQUENCE ((1L << KK_CONTROL) | (1L << KK_ALT))
-#define SETKILLKEY(b) (KdSpecialKeys |= (1L << (b)))
-#define CLEARKILLKEY(b) (KdSpecialKeys &= ~(1L << (b)))
-#define KEYMAP (pKdKeyboard->key->curKeySyms)
-#define KEYCOL1(k) (KEYMAP.map[((k)-kdMinKeyCode)*KEYMAP.mapWidth])
-
-CARD32 KdSpecialKeys = 0;
-
-extern char dispatchException;
-
-/*
- * kdCheckTermination
- *
- * This function checks for the key sequence that terminates the server. When
- * detected, it sets the dispatchException flag and returns. The key sequence
- * is:
- * Control-Alt
- * It's assumed that the server will be waken up by the caller when this
- * function returns.
- */
-
-extern int nClients;
-
-static void
-KdCheckSpecialKeys(xEvent *xE)
-{
- KeySym sym = KEYCOL1(xE->u.u.detail);
-
- if (!pKdKeyboard) return;
-
- /*
- * Ignore key releases
- */
-
- if (xE->u.u.type == KeyRelease) return;
-
-#ifdef XIPAQ
- /*
- * Check for buttons 1, 2 and 3 on the iPAQ
- */
- if (sym == XK_Pointer_Button1 && kdMouseInfo) {
- KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_1, 0, 0);
- return;
- }
- if (sym == XK_Pointer_Button2 && kdMouseInfo) {
- KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_2, 0, 0);
- return;
- }
- if (sym == XK_Pointer_Button3 && kdMouseInfo) {
- KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_3, 0, 0);
- return;
- }
-#endif
-
- /*
- * Check for control/alt pressed
- */
- if ((pKdKeyboard->key->state & (ControlMask|Mod1Mask)) !=
- (ControlMask|Mod1Mask))
- return;
-
-
- /*
- * Let OS function see keysym first
- */
-
- if (kdOsFuncs->SpecialKey)
- if ((*kdOsFuncs->SpecialKey) (sym))
- return;
-
- /*
- * Now check for backspace or delete; these signal the
- * X server to terminate
- */
- switch (sym) {
- case XK_BackSpace:
- case XK_Delete:
- case XK_KP_Delete:
- /*
- * Set the dispatch exception flag so the server will terminate the
- * next time through the dispatch loop.
- */
- if (kdDontZap == FALSE)
- dispatchException |= DE_TERMINATE;
- break;
- }
-}
-
-/*
- * kdEnqueueKeyboardEvent
- *
- * This function converts hardware keyboard event information into an X event
- * and enqueues it using MI. It wakes up the server before returning so that
- * the event will be processed normally.
- *
- */
-
-static void
-KdHandleKeyboardEvent (xEvent *ev)
-{
- int key = ev->u.u.detail;
- int byte;
- CARD8 bit;
- KdMouseInfo *mi;
-
- byte = key >> 3;
- bit = 1 << (key & 7);
- switch (ev->u.u.type) {
- case KeyPress:
- kdKeyState[byte] |= bit;
- break;
- case KeyRelease:
- kdKeyState[byte] &= ~bit;
- break;
- }
- for (mi = kdMouseInfo; mi; mi = mi->next)
- KdRunMouseMachine (mi, keyboard, 0);
- KdQueueEvent (ev);
-}
-
-void
-KdReleaseAllKeys (void)
-{
- xEvent xE;
- int key;
-
- KdBlockSigio ();
- for (key = 0; key < KD_KEY_COUNT; key++)
- if (IsKeyDown(key))
- {
- xE.u.keyButtonPointer.time = GetTimeInMillis();
- xE.u.u.type = KeyRelease;
- xE.u.u.detail = key;
- KdHandleKeyboardEvent (&xE);
- }
- KdUnblockSigio ();
-}
-
-static void
-KdCheckLock (void)
-{
- KeyClassPtr keyc = pKdKeyboard->key;
- Bool isSet, shouldBeSet;
-
- if (kdKeyboardFuncs->LockLed)
- {
- isSet = (kdLeds & (1 << (kdKeyboardFuncs->LockLed-1))) != 0;
- shouldBeSet = (keyc->state & LockMask) != 0;
- if (isSet != shouldBeSet)
- {
- KdSetLed (kdKeyboardFuncs->LockLed, shouldBeSet);
- }
- }
-}
-
-void
-KdEnqueueKeyboardEvent(unsigned char scan_code,
- unsigned char is_up)
-{
- unsigned char key_code;
- xEvent xE;
- KeyClassPtr keyc;
-
- if (!pKdKeyboard)
- return;
- keyc = pKdKeyboard->key;
-
- xE.u.keyButtonPointer.time = GetTimeInMillis();
-
- if (kdMinScanCode <= scan_code && scan_code <= kdMaxScanCode)
- {
- key_code = scan_code + KD_MIN_KEYCODE - kdMinScanCode;
-
- /*
- * Set up this event -- the type may be modified below
- */
- if (is_up)
- xE.u.u.type = KeyRelease;
- else
- xE.u.u.type = KeyPress;
- xE.u.u.detail = key_code;
-
- switch (KEYCOL1(key_code))
- {
- case XK_Num_Lock:
- case XK_Scroll_Lock:
- case XK_Shift_Lock:
- case XK_Caps_Lock:
- if (xE.u.u.type == KeyRelease)
- return;
- if (IsKeyDown (key_code))
- xE.u.u.type = KeyRelease;
- else
- xE.u.u.type = KeyPress;
- }
-
- /*
- * Check pressed keys which are already down
- */
- if (IsKeyDown (key_code) && xE.u.u.type == KeyPress)
- {
- KeybdCtrl *ctrl = &pKdKeyboard->kbdfeed->ctrl;
-
- /*
- * Check auto repeat
- */
- if (!ctrl->autoRepeat || keyc->modifierMap[key_code] ||
- !(ctrl->autoRepeats[key_code >> 3] & (1 << (key_code & 7))))
- {
- return;
- }
- /*
- * X delivers press/release even for autorepeat
- */
- xE.u.u.type = KeyRelease;
- KdHandleKeyboardEvent (&xE);
- xE.u.u.type = KeyPress;
- }
- /*
- * Check released keys which are already up
- */
- else if (!IsKeyDown (key_code) && xE.u.u.type == KeyRelease)
- {
- return;
- }
- KdCheckSpecialKeys (&xE);
- KdHandleKeyboardEvent (&xE);
- }
-}
-
-#define SetButton(mi, b, v, s) \
-{\
- xE.u.u.detail = mi->map[b]; \
- xE.u.u.type = v; \
- KdHandleMouseEvent (mi, &xE); \
-}
-
-#define Press(mi, b) SetButton(mi, b, ButtonPress, "Down")
-#define Release(mi, b) SetButton(mi, b, ButtonRelease, "Up")
-
-/*
- * kdEnqueueMouseEvent
- *
- * This function converts hardware mouse event information into X event
- * information. A mouse movement event is passed off to MI to generate
- * a MotionNotify event, if appropriate. Button events are created and
- * passed off to MI for enqueueing.
- */
-
-static void
-KdMouseAccelerate (DeviceIntPtr device, int *dx, int *dy)
-{
- PtrCtrl *pCtrl = &device->ptrfeed->ctrl;
- double speed = sqrt (*dx * *dx + *dy * *dy);
- double accel;
- double m;
-
- /*
- * Ok, so we want it moving num/den times faster at threshold*2
- *
- * accel = m *threshold + b
- * 1 = m * 0 + b -> b = 1
- *
- * num/den = m * (threshold * 2) + 1
- *
- * num / den - 1 = m * threshold * 2
- * (num / den - 1) / threshold * 2 = m
- */
- m = (((double) pCtrl->num / (double) pCtrl->den - 1.0) /
- ((double) pCtrl->threshold * 2.0));
- accel = m * speed + 1;
- *dx = accel * *dx;
- *dy = accel * *dy;
-}
-
-void
-KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int rx, int ry)
-{
- CARD32 ms;
- xEvent xE;
- unsigned char buttons;
- int x, y;
- int (*matrix)[3] = kdMouseMatrix.matrix;
- unsigned long button;
- int n;
-
- if (!pKdPointer)
- return;
-
- ms = GetTimeInMillis();
-
- if (flags & KD_MOUSE_DELTA)
- {
- if (mi->transformCoordinates)
- {
- x = matrix[0][0] * rx + matrix[0][1] * ry;
- y = matrix[1][0] * rx + matrix[1][1] * ry;
- }
- else
- {
- x = rx;
- y = ry;
- }
- KdMouseAccelerate (pKdPointer, &x, &y);
- xE.u.keyButtonPointer.pad1 = 1;
- }
- else
- {
- if (mi->transformCoordinates)
- {
- x = matrix[0][0] * rx + matrix[0][1] * ry + matrix[0][2];
- y = matrix[1][0] * rx + matrix[1][1] * ry + matrix[1][2];
- }
- else
- {
- x = rx;
- y = ry;
- }
- xE.u.keyButtonPointer.pad1 = 0;
- }
- xE.u.keyButtonPointer.time = ms;
- xE.u.keyButtonPointer.rootX = x;
- xE.u.keyButtonPointer.rootY = y;
-
- xE.u.u.type = MotionNotify;
- xE.u.u.detail = 0;
- KdHandleMouseEvent (mi, &xE);
-
- buttons = flags;
-
- for (button = KD_BUTTON_1, n = 0; button <= KD_BUTTON_5; button <<= 1, n++)
- {
- if ((mi->buttonState & button) ^ (buttons & button))
- {
- if (buttons & button)
- {
- Press(mi, n);
- }
- else
- {
- Release(mi, n);
- }
- }
- }
- mi->buttonState = buttons;
-}
-
-void
-KdEnqueueMotionEvent (KdMouseInfo *mi, int x, int y)
-{
- xEvent xE;
- CARD32 ms;
-
- ms = GetTimeInMillis();
-
- xE.u.u.type = MotionNotify;
- xE.u.keyButtonPointer.time = ms;
- xE.u.keyButtonPointer.rootX = x;
- xE.u.keyButtonPointer.rootY = y;
-
- KdHandleMouseEvent (mi, &xE);
-}
-
-void
-KdBlockHandler (int screen,
- pointer blockData,
- pointer timeout,
- pointer readmask)
-{
- KdMouseInfo *mi;
- int myTimeout=0;
-
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->timeoutPending)
- {
- int ms;
-
- ms = mi->emulationTimeout - GetTimeInMillis ();
- if (ms < 1)
- ms = 1;
- if(ms<myTimeout || myTimeout==0)
- myTimeout=ms;
- }
- }
- /* if we need to poll for events, do that */
- if(kdOsFuncs->pollEvents)
- {
- (*kdOsFuncs->pollEvents)();
- myTimeout=20;
- }
- if(myTimeout>0)
- AdjustWaitForDelay (timeout, myTimeout);
-}
-
-void
-KdWakeupHandler (int screen,
- pointer data,
- unsigned long lresult,
- pointer readmask)
-{
- int result = (int) lresult;
- fd_set *pReadmask = (fd_set *) readmask;
- int i;
- KdMouseInfo *mi;
-
- if (kdInputEnabled && result > 0)
- {
- for (i = 0; i < kdNumInputFds; i++)
- if (FD_ISSET (kdInputFds[i].fd, pReadmask))
- {
- KdBlockSigio ();
- (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
- KdUnblockSigio ();
- }
- }
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->timeoutPending)
- {
- if ((long) (GetTimeInMillis () - mi->emulationTimeout) >= 0)
- {
- mi->timeoutPending = FALSE;
- KdBlockSigio ();
- KdReceiveTimeout (mi);
- KdUnblockSigio ();
- }
- }
- }
- if (kdSwitchPending)
- KdProcessSwitch ();
-}
-
-#define KdScreenOrigin(pScreen) (&(KdGetScreenPriv(pScreen)->screen->origin))
-
-static Bool
-KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
-{
- ScreenPtr pScreen = *ppScreen;
- ScreenPtr pNewScreen;
- int n;
- int dx, dy;
- int best_x, best_y;
- int n_best_x, n_best_y;
- CARD32 ms;
-
- if (kdDisableZaphod || screenInfo.numScreens <= 1)
- return FALSE;
-
- if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height)
- return FALSE;
-
- ms = GetTimeInMillis ();
- if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
- return FALSE;
- kdOffScreen = TRUE;
- kdOffScreenTime = ms;
- n_best_x = -1;
- best_x = 32767;
- n_best_y = -1;
- best_y = 32767;
- for (n = 0; n < screenInfo.numScreens; n++)
- {
- pNewScreen = screenInfo.screens[n];
- if (pNewScreen == pScreen)
- continue;
- dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
- dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
- if (*x < 0)
- {
- if (dx <= 0 && -dx < best_x)
- {
- best_x = -dx;
- n_best_x = n;
- }
- }
- else if (*x >= pScreen->width)
- {
- if (dx >= 0 && dx < best_x)
- {
- best_x = dx;
- n_best_x = n;
- }
- }
- if (*y < 0)
- {
- if (dy <= 0 && -dy < best_y)
- {
- best_y = -dy;
- n_best_y = n;
- }
- }
- else if (*y >= pScreen->height)
- {
- if (dy >= 0 && dy < best_y)
- {
- best_y = dy;
- n_best_y = n;
- }
- }
- }
- if (best_y < best_x)
- n_best_x = n_best_y;
- if (n_best_x == -1)
- return FALSE;
- pNewScreen = screenInfo.screens[n_best_x];
-
- if (*x < 0)
- *x += pNewScreen->width;
- if (*y < 0)
- *y += pNewScreen->height;
-
- if (*x >= pScreen->width)
- *x -= pScreen->width;
- if (*y >= pScreen->height)
- *y -= pScreen->height;
-
- *ppScreen = pNewScreen;
- return TRUE;
-}
-
-static void
-KdCrossScreen(ScreenPtr pScreen, Bool entering)
-{
-#ifndef XIPAQ
- if (entering)
- KdEnableScreen (pScreen);
- else
- KdDisableScreen (pScreen);
-#endif
-}
-
-int KdCurScreen; /* current event screen */
-
-static void
-KdWarpCursor (ScreenPtr pScreen, int x, int y)
-{
- KdBlockSigio ();
- KdCurScreen = pScreen->myNum;
- miPointerWarpCursor (pScreen, x, y);
- KdUnblockSigio ();
-}
-
-miPointerScreenFuncRec kdPointerScreenFuncs =
-{
- KdCursorOffScreen,
- KdCrossScreen,
- KdWarpCursor
-};
-
-void
-ProcessInputEvents ()
-{
- mieqProcessInputEvents();
- miPointerUpdate();
- if (kdSwitchPending)
- KdProcessSwitch ();
- KdCheckLock ();
-}
diff --git a/hw/kdrive/src/kkeymap.c b/hw/kdrive/src/kkeymap.c
deleted file mode 100644
index bfab84038..000000000
--- a/hw/kdrive/src/kkeymap.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Id: kkeymap.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kkeymap.c,v 1.1 1999/11/19 13:53:49 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include <X11/keysym.h>
-#include "kkeymap.h"
-
-/*
- * Map scan codes (both regular and synthesized from extended keys)
- * to X keysyms
- */
-
-KeySym kdKeymap[(MAX_SCANCODE - MIN_SCANCODE + 1) * MAX_WIDTH] = {
-/* These are directly mapped from DOS scanset 0 */
-/* 1 8 */ XK_Escape, NoSymbol,
-/* 2 9 */ XK_1, XK_exclam,
-/* 3 10 */ XK_2, XK_at,
-/* 4 11 */ XK_3, XK_numbersign,
-/* 5 12 */ XK_4, XK_dollar,
-/* 6 13 */ XK_5, XK_percent,
-/* 7 14 */ XK_6, XK_asciicircum,
-/* 8 15 */ XK_7, XK_ampersand,
-/* 9 16 */ XK_8, XK_asterisk,
-/* 10 17 */ XK_9, XK_parenleft,
-/* 11 18 */ XK_0, XK_parenright,
-/* 12 19 */ XK_minus, XK_underscore,
-/* 13 20 */ XK_equal, XK_plus,
-/* 14 21 */ XK_BackSpace, NoSymbol,
-/* 15 22 */ XK_Tab, NoSymbol,
-/* 16 23 */ XK_Q, NoSymbol,
-/* 17 24 */ XK_W, NoSymbol,
-/* 18 25 */ XK_E, NoSymbol,
-/* 19 26 */ XK_R, NoSymbol,
-/* 20 27 */ XK_T, NoSymbol,
-/* 21 28 */ XK_Y, NoSymbol,
-/* 22 29 */ XK_U, NoSymbol,
-/* 23 30 */ XK_I, NoSymbol,
-/* 24 31 */ XK_O, NoSymbol,
-/* 25 32 */ XK_P, NoSymbol,
-/* 26 33 */ XK_bracketleft, XK_braceleft,
-/* 27 34 */ XK_bracketright, XK_braceright,
-/* 28 35 */ XK_Return, NoSymbol,
-/* 29 36 */ XK_Control_L, NoSymbol,
-/* 30 37 */ XK_A, NoSymbol,
-/* 31 38 */ XK_S, NoSymbol,
-/* 32 39 */ XK_D, NoSymbol,
-/* 33 40 */ XK_F, NoSymbol,
-/* 34 41 */ XK_G, NoSymbol,
-/* 35 42 */ XK_H, NoSymbol,
-/* 36 43 */ XK_J, NoSymbol,
-/* 37 44 */ XK_K, NoSymbol,
-/* 38 45 */ XK_L, NoSymbol,
-/* 39 46 */ XK_semicolon, XK_colon,
-/* 40 47 */ XK_apostrophe, XK_quotedbl,
-/* 41 48 */ XK_grave, XK_asciitilde,
-/* 42 49 */ XK_Shift_L, NoSymbol,
-/* 43 50 */ XK_backslash, XK_bar,
-/* 44 51 */ XK_Z, NoSymbol,
-/* 45 52 */ XK_X, NoSymbol,
-/* 46 53 */ XK_C, NoSymbol,
-/* 47 54 */ XK_V, NoSymbol,
-/* 48 55 */ XK_B, NoSymbol,
-/* 49 56 */ XK_N, NoSymbol,
-/* 50 57 */ XK_M, NoSymbol,
-/* 51 58 */ XK_comma, XK_less,
-/* 52 59 */ XK_period, XK_greater,
-/* 53 60 */ XK_slash, XK_question,
-/* 54 61 */ XK_Shift_R, NoSymbol,
-/* 55 62 */ XK_KP_Multiply, NoSymbol,
-/* 56 63 */ XK_Alt_L, XK_Meta_L,
-/* 57 64 */ XK_space, NoSymbol,
-/* 58 65 */ XK_Caps_Lock, NoSymbol,
-/* 59 66 */ XK_F1, NoSymbol,
-/* 60 67 */ XK_F2, NoSymbol,
-/* 61 68 */ XK_F3, NoSymbol,
-/* 62 69 */ XK_F4, NoSymbol,
-/* 63 70 */ XK_F5, NoSymbol,
-/* 64 71 */ XK_F6, NoSymbol,
-/* 65 72 */ XK_F7, NoSymbol,
-/* 66 73 */ XK_F8, NoSymbol,
-/* 67 74 */ XK_F9, NoSymbol,
-/* 68 75 */ XK_F10, NoSymbol,
-/* 69 76 */ XK_Break, XK_Pause,
-/* 70 77 */ XK_Scroll_Lock, NoSymbol,
-/* 71 78 */ XK_KP_Home, XK_KP_7,
-/* 72 79 */ XK_KP_Up, XK_KP_8,
-/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
-/* 74 81 */ XK_KP_Subtract, NoSymbol,
-/* 75 82 */ XK_KP_Left, XK_KP_4,
-/* 76 83 */ XK_KP_5, NoSymbol,
-/* 77 84 */ XK_KP_Right, XK_KP_6,
-/* 78 85 */ XK_KP_Add, NoSymbol,
-/* 79 86 */ XK_KP_End, XK_KP_1,
-/* 80 87 */ XK_KP_Down, XK_KP_2,
-/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
-/* 82 89 */ XK_KP_Insert, XK_KP_0,
-/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
-/* 84 91 */ NoSymbol, NoSymbol,
-/* 85 92 */ NoSymbol, NoSymbol,
-/* 86 93 */ NoSymbol, NoSymbol,
-/* 87 94 */ XK_F11, NoSymbol,
-/* 88 95 */ XK_F12, NoSymbol,
-
-/* These are remapped from the extended set (using ExtendMap) */
-
-/* 89 96 */ XK_Control_R, NoSymbol,
-/* 90 97 */ XK_KP_Enter, NoSymbol,
-/* 91 98 */ XK_KP_Divide, NoSymbol,
-/* 92 99 */ XK_Sys_Req, XK_Print,
-/* 93 100 */ XK_Alt_R, XK_Meta_R,
-/* 94 101 */ XK_Num_Lock, NoSymbol,
-/* 95 102 */ XK_Home, NoSymbol,
-/* 96 103 */ XK_Up, NoSymbol,
-/* 97 104 */ XK_Page_Up, NoSymbol,
-/* 98 105 */ XK_Left, NoSymbol,
-/* 99 106 */ XK_Right, NoSymbol,
-/* 100 107 */ XK_End, NoSymbol,
-/* 101 108 */ XK_Down, NoSymbol,
-/* 102 109 */ XK_Page_Down, NoSymbol,
-/* 103 110 */ XK_Insert, NoSymbol,
-/* 104 111 */ XK_Delete, NoSymbol,
-/* 105 112 */ XK_Super_L, NoSymbol,
-/* 106 113 */ XK_Super_R, NoSymbol,
-/* 107 114 */ XK_Menu, NoSymbol,
-/* 108 115 */ NoSymbol, NoSymbol,
-/* 109 116 */ NoSymbol, NoSymbol,
-/* 110 117 */ NoSymbol, NoSymbol,
-/* 111 118 */ NoSymbol, NoSymbol,
-/* 112 119 */ NoSymbol, NoSymbol,
-;
-
-/*
- * Map extended keys to additional scancodes
- */
-KdExtendMap kdExtendMap[] = {
- 0x1d, 89, /* Control_R */
- 0x1c, 90, /* KP_Enter */
- 0x35, 91, /* KP_Divide */
- 0x37, 92, /* Sys_Req */
- 0x38, 93, /* Alt_R */
- 0x45, 94, /* Num_Lock */
- 0x47, 95, /* Home */
- 0x48, 96, /* Up */
- 0x49, 97, /* Page_Up */
- 0x4b, 98, /* Left */
- 0x4d, 99, /* Right */
- 0x4f, 100, /* End */
- 0x50, 101, /* Down */
- 0x51, 102, /* Page_Down */
- 0x52, 103, /* Insert */
- 0x53, 104, /* Delete */
- 0x5b, 105, /* Super_L (Windows_L) */
- 0x5c, 106, /* Super_R (Windows_R) */
- 0x5d, 107, /* Menu */
- 0x46, 69, /* Break (with control pressed) */
-};
-
-#define NUM_EXTEND (sizeof (kdExtendMap)/ sizeof (kdExtendMap[0]))
-
-int kdNumExtend = NUM_EXTEND;
-
-/*
- * Map keys on Japanese keyboard far from zero back to reasonable values
- */
-KdExtendMap kdJapanMap[] = {
- 0x70, 108, /* next to Alt key */
- 0x73, 109, /* dash/vbar */
- 0x79, 110, /* right of space bar */
- 0x7b, 111, /* left of space bar */
- 0x7d, 112, /* Yen */
-};
-
-#define NUM_JAPAN (sizeof (kdJapanMap)/sizeof (kdJapanMap[0]))
-
-int kdNumJapan = NUM_JAPAN;
-
-/*
- * List of locking key codes
- */
-
-CARD8 kdLockMap[] = {
- 65,
- 101,
- 77,
-};
-
-#define NUM_LOCK (sizeof (kdLockMap) / sizeof (kdLockMap[0]))
-
-int kdNumLock = NUM_LOCK;
-
-/*
- * Map containing list of keys which the X server makes locking when
- * the KEYMAP_LOCKING_ALTGR flag is set in CEKeymapFlags
- */
-
-CARD8 kdOptionalLockMap[] = {
- 100,
-};
-
-#define NUM_OPTIONAL_LOCK (sizeof (kdOptionalLockMap) / sizeof (kdOptionalLockMap[0]))
-
-int kdNumOptionalLock = NUM_OPTIONAL_LOCK;
-
-CARD8 kdModMap[MAP_LENGTH];
-
-unsigned long kdKeymapFlags = 0;
-
-KeySymsRec kdKeySyms = {
- kdKeymap,
- MIN_KEYCODE,
- MAX_KEYCODE,
- 2
-};
diff --git a/hw/kdrive/src/kkeymap.h b/hw/kdrive/src/kkeymap.h
deleted file mode 100644
index ccc5e86f8..000000000
--- a/hw/kdrive/src/kkeymap.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Id: kkeymap.h,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kkeymap.h,v 1.1 1999/11/19 13:53:50 hohndel Exp $ */
-/*
- * All global variables and functions pertaining to keyboard key mapping
- * live in this header file.
- */
-
-#ifndef _KKEYMAP_H
-#define _KKEYMAP_H
-
-/* Offset of MIN_SCANCODE to 8 (X minimum scancode value) */
-#define KD_KEY_OFFSET (8 - kdMinScanCode)
-
-#define KD_MIN_KEYCODE 8
-#define KD_MAX_KEYCODE 254
-#define KD_MAX_WIDTH 4
-#define KD_MAX_LENGTH (KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1)
-
-extern int kdMinScanCode;
-extern int kdMaxScanCode;
-extern int kdMinKeyCode;
-extern int kdMaxKeyCode;
-extern int kdKeymapWidth;
-
-extern KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
-
-extern CARD8 kdModMap[MAP_LENGTH];
-
-extern KeySymsRec kdKeySyms;
-
-typedef struct {
- KeySym modsym;
- int modbit;
-} KdKeySymModsRec;
-
-#endif /* _KKEYMAP_H */
diff --git a/hw/kdrive/src/kloadmap.c b/hw/kdrive/src/kloadmap.c
deleted file mode 100644
index 17ec880dd..000000000
--- a/hw/kdrive/src/kloadmap.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Id: kloadmap.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kloadmap.c,v 1.1 1999/11/19 13:53:50 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "kkeymap.h"
-
-#ifdef WINDOWS
-#define KM_BUF 1024
-#define KM_EOF -1
-
-typedef struct _km_file {
- HANDLE handle;
- char buf[KM_BUF];
- char *bufptr;
- DWORD remain;
-} km_file;
-
-int
-km_fill (km_file *kf)
-{
- BOOL r;
-
- NCD_DEBUG ((DEBUG_INIT, "km_fill"));
- r = ReadFile (kf->handle, kf->buf, KM_BUF,
- &kf->remain, NULL);
- NCD_DEBUG ((DEBUG_INIT, "Got %d", kf->remain));
- if (!r || !kf->remain)
- return KM_EOF;
- kf->bufptr = kf->buf;
- --kf->remain;
- return *kf->bufptr++;
-}
-
-#define km_getchar(kf) ((kf)->remain-- ? *kf->bufptr++ : km_fill (kf))
-#else
-#define km_getchar(kf) getc(kf)
-#endif
-
-BOOL
-km_word (km_file *kf, char *buf, int len)
-{
- int c;
-
- for (;;)
- {
- switch (c = km_getchar (kf)) {
- case KM_EOF:
- return FALSE;
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- continue;
- }
- break;
- }
- len--;
- while (len--)
- {
- *buf++ = c;
- switch (c = km_getchar (kf)) {
- case KM_EOF:
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- *buf++ = '\0';
- return TRUE;
- }
- }
- return FALSE;
-}
-
-BOOL
-km_int (km_file *kf, int *r)
-{
- char word[64];
-
- if (km_word (kf, word, sizeof (word)))
- {
- *r = strtol (word, NULL, 0);
- return TRUE;
- }
- return FALSE;
-}
-
-WCHAR *winKbdExtensions[] = {
- L".xku",
- L".xkb"
-};
-
-#define NUM_KBD_EXTENSIONS (sizeof (winKbdExtensions) / sizeof (winKbdExtensions[0]))
-
-BOOL
-winLoadKeymap (void)
-{
- WCHAR file[32 + KL_NAMELENGTH];
- WCHAR name[KL_NAMELENGTH];
- HKL layout;
- km_file kf;
- int width;
- BOOL ret;
- KeySym *m;
- int scancode;
- int w;
- int e;
-
- layout = GetKeyboardLayout (0);
- /*
- * Pre-build 46 versions of ThinSTAR software return 0
- * for all layouts
- */
- if (!layout)
- return FALSE;
- NCD_DEBUG ((DEBUG_INIT, "Keyboard layout 0x%x", layout));
- for (e = 0; e < NUM_KBD_EXTENSIONS; e++)
- {
- wstrcpy (file, L"\\Storage Card\\");
- wsprintf (name, TEXT("%08x"), layout);
- wstrcat (file, name);
- wstrcat (file, winKbdExtensions[e]);
- NCD_DEBUG ((DEBUG_INIT, "Loading keymap from %S", file));
- kf.handle = CreateFile (file,
- GENERIC_READ,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- if (kf.handle != INVALID_HANDLE_VALUE)
- break;
- }
- if (kf.handle == INVALID_HANDLE_VALUE)
- {
- NCD_DEBUG ((DEBUG_INIT, "No such file"));
- return FALSE;
- }
- ret = FALSE;
- kf.remain = 0;
- /*
- * Keymap format:
- *
- * flags (optional)
- * width
- * keycode -> keysym array (num_keycodes * width)
- */
- if (!km_int (&kf, &width))
- goto bail1;
- if (width & KEYMAP_FLAGS)
- {
- CEKeymapFlags = (unsigned long) width;
- if (!km_int (&kf, &width))
- goto bail1;
- }
- else
- CEKeymapFlags = 0;
- if (width > MAX_WIDTH)
- goto bail1;
- NCD_DEBUG ((DEBUG_INIT, "Keymap width %d flags 0x%x",
- width, CEKeymapFlags));
- m = CEKeymap;
- for (scancode = MIN_SCANCODE; scancode <= MAX_SCANCODE; scancode++)
- {
- for (w = 0; w < width; w++)
- {
- if (!km_int (&kf, m))
- break;
- m++;
- }
- if (w != width)
- break;
- }
- CEKeySyms.mapWidth = width;
- ret = TRUE;
-bail1:
- CloseHandle (kf.handle);
- return ret;
-}
diff --git a/hw/kdrive/src/kmap.c b/hw/kdrive/src/kmap.c
deleted file mode 100644
index bd506996b..000000000
--- a/hw/kdrive/src/kmap.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Id: kmap.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kmap.c,v 1.10 2001/07/24 21:26:17 keithp Exp $ */
-
-#include <config.h>
-#include "kdrive.h"
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#ifdef HAVE_ASM_MTRR_H
-#include <asm/mtrr.h>
-#endif
-
-#include <sys/ioctl.h>
-
-void *
-KdMapDevice (CARD32 addr, CARD32 size)
-{
-#ifdef WINDOWS
- void *a;
- void *d;
-
- d = VirtualAlloc (NULL, size, MEM_RESERVE, PAGE_NOACCESS);
- if (!d)
- return NULL;
- DRAW_DEBUG ((DEBUG_S3INIT, "Virtual address of 0x%x is 0x%x", addr, d));
- a = VirtualCopyAddr (addr);
- DRAW_DEBUG ((DEBUG_S3INIT, "Translated address is 0x%x", a));
- if (!VirtualCopy (d, a, size,
- PAGE_READWRITE|PAGE_NOCACHE|PAGE_PHYSICAL))
- {
- DRAW_DEBUG ((DEBUG_FAILURE, "VirtualCopy failed %d",
- GetLastError ()));
- return NULL;
- }
- DRAW_DEBUG ((DEBUG_S3INIT, "Device mapped successfully"));
- return d;
-#endif
-#ifdef linux
- void *a;
- int fd;
-
-#ifdef __arm__
- fd = open ("/dev/mem", O_RDWR|O_SYNC);
-#else
- fd = open ("/dev/mem", O_RDWR);
-#endif
- if (fd < 0)
- FatalError ("KdMapDevice: failed to open /dev/mem (%s)\n",
- strerror (errno));
-
- a = mmap ((caddr_t) 0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, addr);
- close (fd);
- if ((long) a == -1)
- FatalError ("KdMapDevice: failed to map frame buffer (%s)\n",
- strerror (errno));
- return a;
-#endif
-#ifdef VXWORKS
- return (void *) addr;
-#endif
-}
-
-void
-KdUnmapDevice (void *addr, CARD32 size)
-{
-#ifdef WINDOWS
- VirtualFree (addr, size, MEM_DECOMMIT);
- VirtualFree (addr, 0, MEM_RELEASE);
-#endif
-#ifdef linux
- munmap (addr, size);
-#endif
-#ifdef VXWORKS
- ;
-#endif
-}
-
-#ifdef HAVE_ASM_MTRR_H
-static int mtrr;
-#endif
-
-void
-KdSetMappedMode (CARD32 addr, CARD32 size, int mode)
-{
-#ifdef HAVE_ASM_MTRR_H
- struct mtrr_sentry sentry;
- unsigned long base, bound;
- unsigned int type = MTRR_TYPE_WRBACK;
-
- if (addr < 0x100000)
- return;
- if (!mtrr)
- mtrr = open ("/proc/mtrr", 2);
- if (mtrr > 0)
- {
- unsigned long nsize;
- base = addr & ~((1<<22)-1);
- bound = ((addr + size) + ((1<<22) - 1)) & ~((1<<22) - 1);
- nsize = 1;
- while (nsize < (bound - base))
- nsize <<= 1;
- switch (mode) {
- case KD_MAPPED_MODE_REGISTERS:
- type = MTRR_TYPE_UNCACHABLE;
- break;
- case KD_MAPPED_MODE_FRAMEBUFFER:
- type = MTRR_TYPE_WRCOMB;
- break;
- }
- sentry.base = base;
- sentry.size = nsize;
- sentry.type = type;
-
- if (ioctl (mtrr, MTRRIOC_ADD_ENTRY, &sentry) < 0)
- ErrorF ("MTRRIOC_ADD_ENTRY failed 0x%x 0x%x %d (errno %d)\n",
- base, bound - base, type, errno);
- }
-#endif
-}
-
-void
-KdResetMappedMode (CARD32 addr, CARD32 size, int mode)
-{
-#ifdef HAVE_ASM_MTRR_H
- struct mtrr_sentry sentry;
- unsigned long base, bound;
- unsigned int type = MTRR_TYPE_WRBACK;
-
- if (addr < 0x100000)
- return;
- if (!mtrr)
- mtrr = open ("/proc/mtrr", 2);
- if (mtrr > 0)
- {
- unsigned long nsize;
- base = addr & ~((1<<22)-1);
- bound = ((addr + size) + ((1<<22) - 1)) & ~((1<<22) - 1);
- nsize = 1;
- while (nsize < (bound - base))
- nsize <<= 1;
- switch (mode) {
- case KD_MAPPED_MODE_REGISTERS:
- type = MTRR_TYPE_UNCACHABLE;
- break;
- case KD_MAPPED_MODE_FRAMEBUFFER:
- type = MTRR_TYPE_WRCOMB;
- break;
- }
- sentry.base = base;
- sentry.size = nsize;
- sentry.type = type;
-
- if (ioctl (mtrr, MTRRIOC_DEL_ENTRY, &sentry) < 0)
- ErrorF ("MTRRIOC_DEL_ENTRY failed 0x%x 0x%x %d (errno %d)\n",
- base, bound - base, type, errno);
- }
-#endif
-}
diff --git a/hw/kdrive/src/kmode.c b/hw/kdrive/src/kmode.c
deleted file mode 100644
index e79f5ff62..000000000
--- a/hw/kdrive/src/kmode.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/kmode.c,v 1.7 2002/10/14 18:01:40 keithp Exp $
- *
- * Copyright 1999 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-const KdMonitorTiming kdMonitorTimings[] = {
- /* H V Hz KHz */
- /* FP BP BLANK POLARITY */
-
- /* IPAQ modeline:
- *
- * Modeline "320x240" 5.7222 320 337 340 352 240 241 244 254"
- */
- { 320, 240, 64, 16256,
- 17, 12, 32, KdSyncNegative,
- 1, 11, 14, KdSyncNegative,
- },
-
- /* Other VESA modes */
- { 640, 350, 85, 31500, /* VESA */
- 32, 96, 192, KdSyncPositive, /* 26.413 */
- 32, 60, 95, KdSyncNegative, /* 59.354 */
- },
- { 640, 400, 60, 31500, /* VESA */
- 32, 96, 192, KdSyncNegative, /* 26.413 */
- 1, 41, 45, KdSyncPositive, /* 59.354 */
- },
- { 720, 400, 85, 35500, /* VESA */
- 36, 108, 216, KdSyncNegative, /* 37.927 */
- 1, 42, 46, KdSyncPositive, /* 85.039 */
- },
-
-
- /* Modeline "720x576" 29.000 720 736 800 880 576 577 580 625 */
- {
- 720, 576, 52, 32954, /* PAL Video */
- 16, 80, 160, KdSyncPositive, /* 32.954 */
- 1, 45, 49, KdSyncPositive, /* 52.727 */
- },
-
- /* 640x480 modes */
- { 640, 480, 85, 36000, /* VESA */
- 56, 80, 192, KdSyncNegative, /* 43.269 */
- 1, 25, 29, KdSyncNegative, /* 85.008 */
- },
- { 640, 480, 75, 31500, /* VESA */
- 16, 120, 200, KdSyncNegative, /* 37.500 */
- 1, 16, 20, KdSyncNegative, /* 75.000 */
- },
- { 640, 480, 72, 31500, /* VESA */
- 16, 120, 176, KdSyncNegative, /* 37.861 */
- 1, 20, 24, KdSyncNegative, /* 72.809 */
- },
- { 640, 480, 60, 25175, /* VESA */
- 16, 48, 160, KdSyncNegative, /* 31.469 */
- 10, 33, 45, KdSyncNegative, /* 59.940 */
- },
-
- /* 800x600 modes */
- { 800, 600, 85, 56250, /* VESA */
- 32, 152, 248, KdSyncPositive, /* 53.674 */
- 1, 27, 31, KdSyncPositive, /* 85.061 */
- },
- { 800, 600, 75, 49500, /* VESA */
- 16, 160, 256, KdSyncPositive, /* 46.875 */
- 1, 21, 25, KdSyncPositive, /* 75.000 */
- },
- /* DEFAULT */
-#define MONITOR_TIMING_DEFAULT 9
- { 800, 600, 72, 50000, /* VESA */
- 56, 64, 240, KdSyncPositive, /* 48.077 */
- 37, 23, 66, KdSyncPositive, /* 72.188 */
- },
- { 800, 600, 60, 40000, /* VESA */
- 40, 88, 256, KdSyncPositive, /* 37.879 */
- 1, 23, 28, KdSyncPositive, /* 60.317 */
- },
- { 800, 600, 56, 36000, /* VESA */
- 24, 128, 224, KdSyncPositive, /* 35.156 */
- 1, 22, 25, KdSyncPositive, /* 56.250 */
- },
-
- /* 1024x768 modes */
- { 1024, 768, 85, 94500, /* VESA */
- 48, 208, 352, KdSyncPositive, /* 68.677 */
- 1, 36, 40, KdSyncPositive, /* 84.997 */
- },
- { 1024, 768, 75, 78750, /* VESA */
- 16, 176, 288, KdSyncPositive, /* 60.023 */
- 1, 28, 32, KdSyncPositive, /* 75.029 */
- },
- { 1024, 768, 70, 75000, /* VESA */
- 24, 144, 304, KdSyncNegative, /* 56.476 */
- 3, 29, 38, KdSyncNegative, /* 70.069 */
- },
- { 1024, 768, 60, 65000, /* VESA */
- 24, 160, 320, KdSyncNegative, /* 48.363 */
- 3, 29, 38, KdSyncNegative, /* 60.004 */
- },
-
- /* 1152x864 mode */
- { 1152, 864, 75, 108000, /* VESA */
- 64, 256, 448, KdSyncPositive, /* 67.500 */
- 1, 32, 36, KdSyncPositive, /* 75.000 */
- },
-
- /* 1152x900 modes */
- { 1152, 900, 85, 122500, /* ADDED */
- 48, 208, 384, KdSyncPositive, /* 79.753 */
- 1, 32, 38, KdSyncPositive, /* 85.024 */
- },
- { 1152, 900, 75, 108250, /* ADDED */
- 32, 208, 384, KdSyncPositive, /* 70.475 */
- 1, 32, 38, KdSyncPositive, /* 75.133 */
- },
- { 1152, 900, 70, 100250, /* ADDED */
- 32, 208, 384, KdSyncPositive, /* 65.267 */
- 2, 32, 38, KdSyncPositive, /* 69.581 */
- },
- { 1152, 900, 66, 95000, /* ADDED */
- 32, 208, 384, KdSyncPositive, /* 61.849 */
- 1, 32, 38, KdSyncPositive, /* 65.937 */
- },
-
- /* 1280x854 modes */
- { 1280, 854, 103, 12500, /* ADDED */
- 56, 16, 128, KdSyncPositive, /* 102.554 */
- 1, 216, 12, KdSyncPositive,
- },
-
- /* 1280x960 modes */
- { 1280, 960, 85, 148500, /* VESA */
- 64, 224, 448, KdSyncPositive, /* 85.938 */
- 1, 47, 51, KdSyncPositive, /* 85.002 */
- },
- { 1280, 960, 60, 108000, /* VESA */
- 96, 312, 520, KdSyncPositive, /* 60.000 */
- 1, 36, 40, KdSyncPositive, /* 60.000 */
- },
-
- /* 1280x1024 modes */
- { 1280, 1024, 85, 157500, /* VESA */
- 64, 224, 448, KdSyncPositive, /* 91.146 */
- 1, 44, 48, KdSyncPositive, /* 85.024 */
- },
- { 1280, 1024, 75, 135000, /* VESA */
- 16, 248, 408, KdSyncPositive, /* 79.976 */
- 1, 38, 42, KdSyncPositive, /* 75.025 */
- },
- { 1280, 1024, 60, 108000, /* VESA */
- 48, 248, 408, KdSyncPositive, /* 63.981 */
- 1, 38, 42, KdSyncPositive, /* 60.020 */
- },
-
- /* 1600x1200 modes */
- { 1600, 1200, 85, 229500, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 106.250 */
- 1, 46, 50, KdSyncPositive, /* 85.000 */
- },
- { 1600, 1200, 75, 202500, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 93.750 */
- 1, 46, 50, KdSyncPositive, /* 75.000 */
- },
- { 1600, 1200, 70, 189000, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 87.500 */
- 1, 46, 50, KdSyncPositive, /* 70.000 */
- },
- { 1600, 1200, 65, 175500, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 81.250 */
- 1, 46, 50, KdSyncPositive, /* 65.000 */
- },
- { 1600, 1200, 60, 162000, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 75.000 */
- 1, 46, 50, KdSyncPositive, /* 60.000 */
- },
-
- /* 1792x1344 modes */
- { 1792, 1344, 85, 301500, /* ADDED */
- 96, 352, 672, KdSyncNegative, /* 122.362 */
- 1, 92, 96, KdSyncPositive, /* 84.974 */
- },
- { 1792, 1344, 75, 261000, /* VESA */
- 96, 352, 664, KdSyncNegative, /* 106.270 */
- 1, 69, 73, KdSyncPositive, /* 74.997 */
- },
- { 1792, 1344, 60, 204750, /* VESA */
- 128, 328, 656, KdSyncNegative, /* 83.640 */
- 1, 46, 50, KdSyncPositive, /* 60.000 */
- },
-
-#if 0
- { 1800, 1012, 75 },
- { 1906, 1072, 68 },
-#endif
-
- /* 1856x1392 modes */
- { 1856, 1392, 85, 330500, /* ADDED */
- 160, 352, 736, KdSyncNegative, /* 127.508 */
- 1, 104, 108, KdSyncPositive, /* 85.001 */
- },
- { 1856, 1392, 75, 288000, /* VESA */
- 128, 352, 704, KdSyncNegative, /* 112.500 */
- 1, 104, 108, KdSyncPositive, /* 75.000 */
- },
- { 1856, 1392, 60, 218250, /* VESA */
- 96, 352, 672, KdSyncNegative, /* 86.333 */
- 1, 43, 47, KdSyncPositive, /* 59.995 */
- },
-
- /* 1920x1440 modes */
- { 1920, 1440, 85, 341750, /* ADDED */
- 160, 352, 760, KdSyncNegative, /* 127.512 */
- 1, 56, 60, KdSyncPositive, /* 85.012 */
- },
- { 1920, 1440, 75, 297000, /* VESA */
- 144, 352, 720, KdSyncNegative, /* 112.500 */
- 1, 56, 60, KdSyncPositive, /* 75.000 */
- },
- { 1920, 1440, 60, 234000, /* VESA */
- 128, 244, 680, KdSyncNegative, /* 90.000 */
- 1, 56, 60, KdSyncPositive, /* 60.000 */
- },
-};
-
-#define NUM_MONITOR_TIMINGS (sizeof kdMonitorTimings/sizeof kdMonitorTimings[0])
-
-const int kdNumMonitorTimings = NUM_MONITOR_TIMINGS;
-
-const KdMonitorTiming *
-KdFindMode (KdScreenInfo *screen,
- Bool (*supported) (KdScreenInfo *,
- const KdMonitorTiming *))
-{
- int i;
- const KdMonitorTiming *t;
-
- for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
- {
- if ((*supported) (screen, t) &&
- t->horizontal == screen->width &&
- t->vertical == screen->height &&
- (!screen->rate || t->rate <= screen->rate))
- {
- return t;
- }
- }
- ErrorF("Warning: mode not found, using default\n");
- return &kdMonitorTimings[MONITOR_TIMING_DEFAULT];
-}
-
-static const KdMonitorTiming *
-kdFindPrevSize (const KdMonitorTiming *old)
-{
- const KdMonitorTiming *new, *prev;
-
- if (old == kdMonitorTimings)
- return 0;
- new = old;
- /*
- * Search for the previous size
- */
- while (new != kdMonitorTimings)
- {
- new--;
- if (new->horizontal != old->horizontal &&
- new->vertical != old->vertical)
- {
- break;
- }
- }
- /*
- * Match the refresh rate (<=)
- */
- while (new != kdMonitorTimings)
- {
- prev = new - 1;
- if (prev->horizontal == new->horizontal &&
- prev->vertical == new->vertical &&
- prev->rate > old->rate)
- {
- break;
- }
- new--;
- }
- return new;
-}
-
-Bool
-KdTuneMode (KdScreenInfo *screen,
- Bool (*usable) (KdScreenInfo *),
- Bool (*supported) (KdScreenInfo *,
- const KdMonitorTiming *))
-{
- const KdMonitorTiming *t;
-
- while (!(*usable) (screen))
- {
- /*
- * Fix requested depth and geometry until it works
- */
- if (screen->fb[1].depth)
- screen->fb[1].depth = 0;
- else if (screen->fb[0].depth > 16)
- screen->fb[0].depth = 16;
- else if (screen->fb[0].depth > 8)
- screen->fb[0].depth = 8;
- else
- {
- t = kdFindPrevSize (KdFindMode (screen, supported));
- if (!t)
- return FALSE;
- screen->width = t->horizontal;
- screen->height = t->vertical;
- screen->rate = t->rate;
- }
- }
- return TRUE;
-}
-
-#ifdef RANDR
-Bool
-KdRandRGetInfo (ScreenPtr pScreen,
- int randr,
- Bool (*supported) (ScreenPtr pScreen,
- const KdMonitorTiming *))
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- int i;
- const KdMonitorTiming *t;
-
- for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
- {
- if ((*supported) (pScreen, t))
- {
- RRScreenSizePtr pSize;
-
- pSize = RRRegisterSize (pScreen,
- t->horizontal,
- t->vertical,
- screen->width_mm,
- screen->height_mm);
- if (!pSize)
- return FALSE;
- if (!RRRegisterRate (pScreen, pSize, t->rate))
- return FALSE;
- if (t->horizontal == screen->width &&
- t->vertical == screen->height &&
- t->rate == screen->rate)
- RRSetCurrentConfig (pScreen, randr, t->rate, pSize);
- }
- }
-
- return TRUE;
-}
-
-const KdMonitorTiming *
-KdRandRGetTiming (ScreenPtr pScreen,
- Bool (*supported) (ScreenPtr pScreen,
- const KdMonitorTiming *),
- int rate,
- RRScreenSizePtr pSize)
-{
- int i;
- const KdMonitorTiming *t;
-
- for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
- {
- if (t->horizontal == pSize->width &&
- t->vertical == pSize->height &&
- t->rate == rate &&
- (*supported) (pScreen, t))
- return t;
- }
- return 0;
-}
-#endif
diff --git a/hw/kdrive/src/knoop.c b/hw/kdrive/src/knoop.c
deleted file mode 100644
index f3eee0f36..000000000
--- a/hw/kdrive/src/knoop.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Id: knoop.c,v 1.2 1999/11/02 06:16:28 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/knoop.c,v 1.1 1999/11/19 13:53:50 hohndel Exp $ */
-
-/*
- * GC ops that don't do anything
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include <gcstruct.h>
-
-typedef void (* typeFillSpans)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nInit*/,
- DDXPointPtr /*pptInit*/,
- int * /*pwidthInit*/,
- int /*fSorted*/
-);
-
-typedef void (* typeSetSpans)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- char * /*psrc*/,
- DDXPointPtr /*ppt*/,
- int * /*pwidth*/,
- int /*nspans*/,
- int /*fSorted*/
-);
-
-typedef void (* typePutImage)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*depth*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/,
- int /*leftPad*/,
- int /*format*/,
- char * /*pBits*/
-);
-
-typedef RegionPtr (* typeCopyArea)(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*w*/,
- int /*h*/,
- int /*dstx*/,
- int /*dsty*/
-);
-
-typedef RegionPtr (* typeCopyPlane)(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/,
- unsigned long /*bitPlane*/
-);
-typedef void (* typePolyPoint)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/
-);
-
-typedef void (* typePolylines)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/
-);
-
-typedef void (* typePolySegment)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nseg*/,
- xSegment * /*pSegs*/
-);
-
-typedef void (* typePolyRectangle)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nrects*/,
- xRectangle * /*pRects*/
-);
-
-typedef void (* typePolyArc)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
-
-typedef void (* typeFillPolygon)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*shape*/,
- int /*mode*/,
- int /*count*/,
- DDXPointPtr /*pPts*/
-);
-
-typedef void (* typePolyFillRect)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nrectFill*/,
- xRectangle * /*prectInit*/
-);
-
-typedef void (* typePolyFillArc)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
-
-typedef int (* typePolyText8)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- char * /*chars*/
-);
-
-typedef int (* typePolyText16)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- unsigned short * /*chars*/
-);
-
-typedef void (* typeImageText8)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- char * /*chars*/
-);
-
-typedef void (* typeImageText16)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- unsigned short * /*chars*/
-);
-
-typedef void (* typeImageGlyphBlt)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-);
-
-typedef void (* typePolyGlyphBlt)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-);
-
-typedef void (* typePushPixels)(
- GCPtr /*pGC*/,
- PixmapPtr /*pBitMap*/,
- DrawablePtr /*pDst*/,
- int /*w*/,
- int /*h*/,
- int /*x*/,
- int /*y*/
-);
-
-static RegionPtr
-KdNoopCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx, int dsty)
-{
- return NullRegion;
-}
-
-static RegionPtr
-KdNoopCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long bitPlane)
-{
- return NullRegion;
-}
-
-GCOps kdNoopOps = {
- (typeFillSpans) NoopDDA, /* fill spans */
- (typeSetSpans) NoopDDA, /* set spans */
- (typePutImage) NoopDDA, /* put image */
- KdNoopCopyArea, /* copy area */
- KdNoopCopyPlane, /* copy plane */
- (typePolyPoint) NoopDDA, /* poly point */
- (typePolylines) NoopDDA, /* poly lines */
- (typePolySegment) NoopDDA, /* poly segment */
- (typePolyRectangle) NoopDDA, /* poly rectangle */
- (typePolyArc) NoopDDA, /* poly arc */
- (typeFillPolygon) NoopDDA, /* fill polygon */
- (typePolyFillRect) NoopDDA, /* poly fillrect */
- (typePolyFillArc) NoopDDA, /* poly fillarc */
- (typePolyText8) NoopDDA, /* text 8 */
- (typePolyText16) NoopDDA, /* text 16 */
- (typeImageText8) NoopDDA, /* itext 8 */
- (typeImageText16) NoopDDA, /* itext 16 */
- (typePolyGlyphBlt) NoopDDA, /* glyph blt */
- (typeImageGlyphBlt) NoopDDA, /* iglyph blt */
- (typePushPixels) NoopDDA, /* push pixels */
-#ifdef NEED_LINEHELPER
- (typeLineHelper) NULL,
-#endif
-};
diff --git a/hw/kdrive/src/koffscreen.c b/hw/kdrive/src/koffscreen.c
deleted file mode 100644
index ef42ebbe8..000000000
--- a/hw/kdrive/src/koffscreen.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Anders Carlsson
- *
- * 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 Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include "kaa.h"
-
-#define DEBUG_OFFSCREEN 0
-#if DEBUG_OFFSCREEN
-#define DBG_OFFSCREEN(a) ErrorF a
-#else
-#define DBG_OFFSCREEN(a)
-#endif
-
-#if DEBUG_OFFSCREEN
-static void
-KdOffscreenValidate (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- KdOffscreenArea *prev = 0, *area;
-
- assert (pScreenPriv->screen->off_screen_areas->area.offset == 0);
- for (area = pScreenPriv->off_screen_areas; area; area = area->next)
- {
- if (prev)
- assert (prev->area.offset + prev->area.size == area->area.offset);
-
- prev = area;
- }
- assert (prev->area.offset + prev->area.size == pScreenPriv->screen->memory_size);
-}
-#else
-#define KdOffscreenValidate(s)
-#endif
-
-static KdOffscreenArea *
-KdOffscreenKickOut (ScreenPtr pScreen, KdOffscreenArea *area)
-{
- if (area->save)
- (*area->save) (pScreen, area);
- return KdOffscreenFree (pScreen, area);
-}
-
-KdOffscreenArea *
-KdOffscreenAlloc (ScreenPtr pScreen, int size, int align,
- Bool locked,
- KdOffscreenSaveProc save,
- pointer privData)
-{
- KdOffscreenArea *area, *begin, *best;
- KdScreenPriv (pScreen);
- int tmp, real_size = 0, best_score;
-
- KdOffscreenValidate (pScreen);
- if (!align)
- align = 1;
-
- if (!size)
- {
- DBG_OFFSCREEN (("Alloc 0x%x -> EMPTY\n", size));
- return NULL;
- }
-
- /* throw out requests that cannot fit */
- if (size > (pScreenPriv->screen->memory_size - pScreenPriv->screen->off_screen_base))
- {
- DBG_OFFSCREEN (("Alloc 0x%x -> TOBIG\n", size));
- return NULL;
- }
-
- /* Try to find a free space that'll fit. */
- for (area = pScreenPriv->off_screen_areas; area; area = area->next)
- {
- /* skip allocated areas */
- if (area->state != KdOffscreenAvail)
- continue;
-
- /* adjust size to match alignment requirement */
- real_size = size;
- tmp = area->offset % align;
- if (tmp)
- real_size += (align - tmp);
-
- /* does it fit? */
- if (real_size <= area->size)
- break;
- }
-
- if (!area)
- {
- /*
- * Kick out existing users to make space.
- *
- * First, locate a region which can hold the desired object.
- */
-
- /* prev points at the first object to boot */
- best = NULL;
- best_score = MAXINT;
- for (begin = pScreenPriv->off_screen_areas; begin != NULL;
- begin = begin->next)
- {
- int avail, score;
- KdOffscreenArea *scan;
-
- if (begin->state == KdOffscreenLocked)
- continue;
-
- /* adjust size to match alignment requirement */
- real_size = size;
- tmp = begin->offset % align;
- if (tmp)
- real_size += (align - tmp);
-
- avail = 0;
- score = 0;
- /* now see if we can make room here, and how "costly" it'll be. */
- for (scan = begin; scan != NULL; scan = scan->next)
- {
- if (scan->state == KdOffscreenLocked) {
- /* Can't make room here, start after this locked area. */
- begin = scan->next;
- break;
- }
- /* Score should only be non-zero for KdOffscreenRemovable */
- score += scan->score;
- avail += scan->size;
- if (avail >= real_size)
- break;
- }
- /* Is it the best option we've found so far? */
- if (avail >= real_size && score < best_score) {
- best = begin;
- best_score = score;
- }
- }
- area = best;
- if (!area)
- {
- DBG_OFFSCREEN (("Alloc 0x%x -> NOSPACE\n", size));
- /* Could not allocate memory */
- KdOffscreenValidate (pScreen);
- return NULL;
- }
-
- /* adjust size to match alignment requirement */
- real_size = size;
- tmp = begin->offset % align;
- if (tmp)
- real_size += (align - tmp);
-
- /*
- * Kick out first area if in use
- */
- if (area->state != KdOffscreenAvail)
- area = KdOffscreenKickOut (pScreen, area);
- /*
- * Now get the system to merge the other needed areas together
- */
- while (area->size < real_size)
- {
- assert (area->next && area->next->state == KdOffscreenRemovable);
- (void) KdOffscreenKickOut (pScreen, area->next);
- }
- }
-
- /* save extra space in new area */
- if (real_size < area->size)
- {
- KdOffscreenArea *new_area = xalloc (sizeof (KdOffscreenArea));
- if (!new_area)
- return NULL;
- new_area->offset = area->offset + real_size;
- new_area->size = area->size - real_size;
- new_area->state = KdOffscreenAvail;
- new_area->save = 0;
- new_area->score = 0;
- new_area->next = area->next;
- area->next = new_area;
- area->size = real_size;
- }
- /*
- * Mark this area as in use
- */
- if (locked)
- area->state = KdOffscreenLocked;
- else
- area->state = KdOffscreenRemovable;
- area->privData = privData;
- area->save = save;
- area->score = 0;
-
- area->save_offset = area->offset;
- area->offset = (area->offset + align - 1) & ~(align - 1);
-
- KdOffscreenValidate (pScreen);
-
- DBG_OFFSCREEN (("Alloc 0x%x -> 0x%x\n", size, area->offset));
- return area;
-}
-
-void
-KdOffscreenSwapOut (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
-
- KdOffscreenValidate (pScreen);
- /* loop until a single free area spans the space */
- for (;;)
- {
- KdOffscreenArea *area = pScreenPriv->off_screen_areas;
-
- if (!area)
- break;
- if (area->state == KdOffscreenAvail)
- {
- area = area->next;
- if (!area)
- break;
- }
- assert (area->state != KdOffscreenAvail);
- (void) KdOffscreenKickOut (pScreen, area);
- KdOffscreenValidate (pScreen);
- }
- KdOffscreenValidate (pScreen);
- KdOffscreenFini (pScreen);
-}
-
-void
-KdOffscreenSwapIn (ScreenPtr pScreen)
-{
- KdOffscreenInit (pScreen);
-}
-
-/* merge the next free area into this one */
-static void
-KdOffscreenMerge (KdOffscreenArea *area)
-{
- KdOffscreenArea *next = area->next;
-
- /* account for space */
- area->size += next->size;
- /* frob pointer */
- area->next = next->next;
- xfree (next);
-}
-
-KdOffscreenArea *
-KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area)
-{
- KdScreenPriv(pScreen);
- KdOffscreenArea *next = area->next;
- KdOffscreenArea *prev;
-
- DBG_OFFSCREEN (("Free 0x%x -> 0x%x\n", area->size, area->offset));
- KdOffscreenValidate (pScreen);
-
- area->state = KdOffscreenAvail;
- area->save = 0;
- area->offset = area->save_offset;
- area->score = 0;
-
- /*
- * Find previous area
- */
- if (area == pScreenPriv->off_screen_areas)
- prev = 0;
- else
- for (prev = pScreenPriv->off_screen_areas; prev; prev = prev->next)
- if (prev->next == area)
- break;
-
- /* link with next area if free */
- if (next && next->state == KdOffscreenAvail)
- KdOffscreenMerge (area);
-
- /* link with prev area if free */
- if (prev && prev->state == KdOffscreenAvail)
- {
- area = prev;
- KdOffscreenMerge (area);
- }
-
- KdOffscreenValidate (pScreen);
- return area;
-}
-
-void
-KdOffscreenMarkUsed (PixmapPtr pPixmap)
-{
- KaaPixmapPriv (pPixmap);
- KdScreenPriv (pPixmap->drawable.pScreen);
- static int iter = 0;
-
- if (!pKaaPixmap->area)
- return;
-
- /* The numbers here are arbitrary. We may want to tune these. */
- pKaaPixmap->area->score += 100;
- if (++iter == 10) {
- KdOffscreenArea *area;
- for (area = pScreenPriv->off_screen_areas; area != NULL;
- area = area->next)
- {
- if (area->state == KdOffscreenRemovable)
- area->score = (area->score * 7) / 8;
- }
- }
-}
-
-Bool
-KdOffscreenInit (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- KdOffscreenArea *area;
-
- /* Allocate a big free area */
- area = xalloc (sizeof (KdOffscreenArea));
-
- if (!area)
- return FALSE;
-
- area->state = KdOffscreenAvail;
- area->offset = pScreenPriv->screen->off_screen_base;
- area->size = pScreenPriv->screen->memory_size - area->offset;
- area->save = 0;
- area->next = NULL;
- area->score = 0;
-
- /* Add it to the free areas */
- pScreenPriv->off_screen_areas = area;
-
- KdOffscreenValidate (pScreen);
-
- return TRUE;
-}
-
-void
-KdOffscreenFini (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- KdOffscreenArea *area;
-
- /* just free all of the area records */
- while ((area = pScreenPriv->off_screen_areas))
- {
- pScreenPriv->off_screen_areas = area->next;
- xfree (area);
- }
-}
diff --git a/hw/kdrive/src/kpict.c b/hw/kdrive/src/kpict.c
deleted file mode 100644
index e42ae427b..000000000
--- a/hw/kdrive/src/kpict.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * $RCSId: $
- *
- * Copyright © 1999 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-#include <picturestr.h>
-#include <mipict.h>
-#include <fbpict.h>
-#include "kaa.h"
-
-void
-KdCheckComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- KdCheckSync (pDst->pDrawable->pScreen);
- kaaDrawableDirty (pDst->pDrawable);
- fbComposite (op,
- pSrc,
- pMask,
- pDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height);
-}
-
-void
-KdCheckRasterizeTrapezoid(PicturePtr pMask,
- xTrapezoid *trap,
- int x_off,
- int y_off)
-{
- KdCheckSync (pMask->pDrawable->pScreen);
- kaaDrawableDirty (pMask->pDrawable);
- fbRasterizeTrapezoid (pMask, trap, x_off, y_off);
-}
-
-void
-KdPictureInitAsync (ScreenPtr pScreen)
-{
- PictureScreenPtr ps;
-
- ps = GetPictureScreen(pScreen);
- ps->Composite = KdCheckComposite;
- ps->RasterizeTrapezoid = KdCheckRasterizeTrapezoid;
-}
diff --git a/hw/kdrive/src/kshadow.c b/hw/kdrive/src/kshadow.c
deleted file mode 100644
index 285adf1d2..000000000
--- a/hw/kdrive/src/kshadow.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * $RCSId: $
- *
- * Copyright © 1999 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-Bool
-KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate)
-{
- int paddedWidth;
- void *buf;
- int width = rotate ? screen->height : screen->width;
- int height = rotate ? screen->width : screen->height;
- int bpp = screen->fb[fb].bitsPerPixel;
-
- /* use fb computation for width */
- paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
- buf = xalloc (paddedWidth * height);
- if (!buf)
- return FALSE;
- if (screen->fb[fb].shadow)
- xfree (screen->fb[fb].frameBuffer);
- screen->fb[fb].shadow = TRUE;
- screen->fb[fb].frameBuffer = buf;
- screen->fb[fb].byteStride = paddedWidth;
- screen->fb[fb].pixelStride = paddedWidth * 8 / bpp;
- return TRUE;
-}
-
-void
-KdShadowFbFree (KdScreenInfo *screen, int fb)
-{
- if (screen->fb[fb].shadow)
- {
- xfree (screen->fb[fb].frameBuffer);
- screen->fb[fb].frameBuffer = 0;
- screen->fb[fb].shadow = FALSE;
- }
-}
-
-Bool
-KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- int fb;
-
- shadowUnset (pScreen);
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- {
- if (screen->fb[fb].shadow)
- return shadowSet (pScreen, (*pScreen->GetScreenPixmap) (pScreen),
- update, window, randr, 0);
- }
- return TRUE;
-}
-
-void
-KdShadowUnset (ScreenPtr pScreen)
-{
- shadowUnset (pScreen);
-}
diff --git a/hw/kdrive/src/ktest.c b/hw/kdrive/src/ktest.c
deleted file mode 100644
index 3fe3739a5..000000000
--- a/hw/kdrive/src/ktest.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Id: ktest.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/ktest.c,v 1.1 1999/11/19 13:53:50 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-
-static CARD8 memoryPatterns[] = { 0xff, 0x00, 0x5a, 0xa5, 0xaa, 0x55 };
-
-#define NUM_PATTERNS (sizeof (memoryPatterns) / sizeof (memoryPatterns[0]))
-
-Bool
-KdFrameBufferValid (CARD8 *base, int size)
-{
- volatile CARD8 *b = (volatile CARD8 *) base;
- CARD8 save, test, compare;
- int i, j;
-
- b = base + (size - 1);
- save = *b;
-
- for (i = 0; i < NUM_PATTERNS; i++)
- {
- test = memoryPatterns[i];
- *b = test;
- for (j = 0; j < 1000; j++)
- {
- compare = *b;
- if (compare != test)
- return FALSE;
- }
- }
- *b = save;
- return TRUE;
-}
-
-int
-KdFrameBufferSize (CARD8 *base, int max)
-{
- int min, cur;
-
- min = 0;
- while (min + 1 < max)
- {
- cur = (max + min) / 2;
- if (KdFrameBufferValid (base, cur))
- min = cur;
- else
- max = cur;
- }
- if (KdFrameBufferValid (base, max))
- return max;
- else
- return min;
-}
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
deleted file mode 100644
index c66bf589b..000000000
--- a/hw/kdrive/src/kxv.c
+++ /dev/null
@@ -1,1921 +0,0 @@
-/*
-
- XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
- Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
-
- Copyright (C) 2000, 2001 - Nokia Home Communications
- Copyright (C) 1998, 1999 - 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, 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 Software 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
-MERCHANTABILITY, 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 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.
-
-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.
-
-*/
-
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kxv.c,v 1.3 2001/08/09 09:08:54 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "kdrive.h"
-
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "mivalidate.h"
-#include "validate.h"
-#include "resource.h"
-#include "gcstruct.h"
-#include "dixstruct.h"
-
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvproto.h>
-
-#include "kxv.h"
-#include "fourcc.h"
-
-
-/* XvScreenRec fields */
-
-static Bool KdXVCloseScreen(int, ScreenPtr);
-static int KdXVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
-
-/* XvAdaptorRec fields */
-
-static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*);
-static int KdXVFreePort(XvPortPtr);
-static int KdXVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int KdXVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int KdXVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int KdXVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int KdXVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
-static int KdXVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
-static int KdXVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
-static int KdXVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
- CARD16, CARD16,CARD16, CARD16,
- unsigned int*, unsigned int*);
-static int KdXVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16,
- XvImagePtr, unsigned char*, Bool,
- CARD16, CARD16);
-static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
- CARD16*, CARD16*, int*, int*);
-
-
-/* ScreenRec fields */
-
-static Bool KdXVCreateWindow(WindowPtr pWin);
-static Bool KdXVDestroyWindow(WindowPtr pWin);
-static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
-static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
-
-/* misc */
-static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr*, int);
-
-
-int KdXVWindowIndex = -1;
-int KdXvScreenIndex = -1;
-static unsigned long KdXVGeneration = 0;
-static unsigned long PortResource = 0;
-
-int (*XvGetScreenIndexProc)(void) = XvGetScreenIndex;
-unsigned long (*XvGetRTPortProc)(void) = XvGetRTPort;
-int (*XvScreenInitProc)(ScreenPtr) = XvScreenInit;
-
-#define GET_XV_SCREEN(pScreen) \
- ((XvScreenPtr)((pScreen)->devPrivates[KdXvScreenIndex].ptr))
-
-#define GET_KDXV_SCREEN(pScreen) \
- ((KdXVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
-
-#define GET_KDXV_WINDOW(pWin) \
- ((KdXVWindowPtr)((pWin)->devPrivates[KdXVWindowIndex].ptr))
-
-static KdXVInitGenericAdaptorPtr *GenDrivers = NULL;
-static int NumGenDrivers = 0;
-
-int
-KdXVRegisterGenericAdaptorDriver(
- KdXVInitGenericAdaptorPtr InitFunc
-){
- KdXVInitGenericAdaptorPtr *newdrivers;
-
-/* fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */
-
- newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) *
- (1 + NumGenDrivers));
- if (!newdrivers)
- return 0;
- GenDrivers = newdrivers;
-
- GenDrivers[NumGenDrivers++] = InitFunc;
-
- return 1;
-}
-
-int
-KdXVListGenericAdaptors(
- KdScreenInfo * screen,
- KdVideoAdaptorPtr **adaptors
-){
- int i,j,n,num;
- KdVideoAdaptorPtr *DrivAdap,*new;
-
- num = 0;
- *adaptors = NULL;
- for (i = 0; i < NumGenDrivers; i++) {
- n = GenDrivers[i](screen,&DrivAdap);
- if (0 == n)
- continue;
- new = xrealloc(*adaptors, sizeof(KdVideoAdaptorPtr) * (num+n));
- if (NULL == new)
- continue;
- *adaptors = new;
- for (j = 0; j < n; j++, num++)
- (*adaptors)[num] = DrivAdap[j];
- }
- return num;
-}
-
-KdVideoAdaptorPtr
-KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen)
-{
- return xcalloc(1, sizeof(KdVideoAdaptorRec));
-}
-
-void
-KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr)
-{
- xfree(ptr);
-}
-
-
-Bool
-KdXVScreenInit(
- ScreenPtr pScreen,
- KdVideoAdaptorPtr *adaptors,
- int num
-){
- KdXVScreenPtr ScreenPriv;
- XvScreenPtr pxvs;
-
-/* fprintf(stderr,"KdXVScreenInit initializing %d adaptors\n",num); */
-
- if(KdXVGeneration != serverGeneration) {
- if((KdXVWindowIndex = AllocateWindowPrivateIndex()) < 0)
- return FALSE;
- KdXVGeneration = serverGeneration;
- }
-
- if(!AllocateWindowPrivate(pScreen,KdXVWindowIndex,0))
- return FALSE;
-
- if(!XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc)
- return FALSE;
-
- if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
-
- KdXvScreenIndex = (*XvGetScreenIndexProc)();
- PortResource = (*XvGetRTPortProc)();
-
- pxvs = GET_XV_SCREEN(pScreen);
-
-
- /* Anyone initializing the Xv layer must provide these two.
- The Xv di layer calls them without even checking if they exist! */
-
- pxvs->ddCloseScreen = KdXVCloseScreen;
- pxvs->ddQueryAdaptors = KdXVQueryAdaptors;
-
- /* The Xv di layer provides us with a private hook so that we don't
- have to allocate our own screen private. They also provide
- a CloseScreen hook so that we don't have to wrap it. I'm not
- sure that I appreciate that. */
-
- ScreenPriv = xalloc(sizeof(KdXVScreenRec));
- pxvs->devPriv.ptr = (pointer)ScreenPriv;
-
- if(!ScreenPriv) return FALSE;
-
-
- ScreenPriv->CreateWindow = pScreen->CreateWindow;
- ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
- ScreenPriv->WindowExposures = pScreen->WindowExposures;
- ScreenPriv->ClipNotify = pScreen->ClipNotify;
-
-/* fprintf(stderr,"XV: Wrapping screen funcs\n"); */
-
- pScreen->CreateWindow = KdXVCreateWindow;
- pScreen->DestroyWindow = KdXVDestroyWindow;
- pScreen->WindowExposures = KdXVWindowExposures;
- pScreen->ClipNotify = KdXVClipNotify;
-
- if(!KdXVInitAdaptors(pScreen, adaptors, num))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
-{
- int i;
-
- if(pAdaptor->name)
- xfree(pAdaptor->name);
-
- if(pAdaptor->pEncodings) {
- XvEncodingPtr pEncode = pAdaptor->pEncodings;
-
- for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) {
- if(pEncode->name) xfree(pEncode->name);
- }
- xfree(pAdaptor->pEncodings);
- }
-
- if(pAdaptor->pFormats)
- xfree(pAdaptor->pFormats);
-
- if(pAdaptor->pPorts) {
- XvPortPtr pPort = pAdaptor->pPorts;
- XvPortRecPrivatePtr pPriv;
-
- for(i = 0; i < pAdaptor->nPorts; i++, pPort++) {
- pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
- if(pPriv) {
- if(pPriv->clientClip)
- REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip);
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
- REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip);
- xfree(pPriv);
- }
- }
- xfree(pAdaptor->pPorts);
- }
-
- if(pAdaptor->nAttributes) {
- XvAttributePtr pAttribute = pAdaptor->pAttributes;
-
- for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) {
- if(pAttribute->name) xfree(pAttribute->name);
- }
-
- xfree(pAdaptor->pAttributes);
- }
-
- if(pAdaptor->nImages)
- xfree(pAdaptor->pImages);
-
- if(pAdaptor->devPriv.ptr)
- xfree(pAdaptor->devPriv.ptr);
-}
-
-static Bool
-KdXVInitAdaptors(
- ScreenPtr pScreen,
- KdVideoAdaptorPtr *infoPtr,
- int number
-) {
- KdScreenPriv(pScreen);
- KdScreenInfo * screen = pScreenPriv->screen;
-
- XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
- KdVideoAdaptorPtr adaptorPtr;
- XvAdaptorPtr pAdaptor, pa;
- XvAdaptorRecPrivatePtr adaptorPriv;
- int na, numAdaptor;
- XvPortRecPrivatePtr portPriv;
- XvPortPtr pPort, pp;
- int numPort;
- KdAttributePtr attributePtr;
- XvAttributePtr pAttribute, pat;
- KdVideoFormatPtr formatPtr;
- XvFormatPtr pFormat, pf;
- int numFormat, totFormat;
- KdVideoEncodingPtr encodingPtr;
- XvEncodingPtr pEncode, pe;
- KdImagePtr imagePtr;
- XvImagePtr pImage, pi;
- int numVisuals;
- VisualPtr pVisual;
- int i;
-
- pxvs->nAdaptors = 0;
- pxvs->pAdaptors = NULL;
-
- if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec))))
- return FALSE;
-
- for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
- adaptorPtr = infoPtr[na];
-
- if(!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
- !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize)
- continue;
-
- /* client libs expect at least one encoding */
- if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings)
- continue;
-
- pa->type = adaptorPtr->type;
-
- if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo)
- pa->type &= ~XvVideoMask;
-
- if(!adaptorPtr->PutStill && !adaptorPtr->GetStill)
- pa->type &= ~XvStillMask;
-
- if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes)
- pa->type &= ~XvImageMask;
-
- if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage &&
- !adaptorPtr->PutStill)
- pa->type &= ~XvInputMask;
-
- if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill)
- pa->type &= ~XvOutputMask;
-
- if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask)))
- continue;
- if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask)))
- continue;
-
- pa->pScreen = pScreen;
- pa->ddAllocatePort = KdXVAllocatePort;
- pa->ddFreePort = KdXVFreePort;
- pa->ddPutVideo = KdXVPutVideo;
- pa->ddPutStill = KdXVPutStill;
- pa->ddGetVideo = KdXVGetVideo;
- pa->ddGetStill = KdXVGetStill;
- pa->ddStopVideo = KdXVStopVideo;
- pa->ddPutImage = KdXVPutImage;
- pa->ddSetPortAttribute = KdXVSetPortAttribute;
- pa->ddGetPortAttribute = KdXVGetPortAttribute;
- pa->ddQueryBestSize = KdXVQueryBestSize;
- pa->ddQueryImageAttributes = KdXVQueryImageAttributes;
- if((pa->name = xalloc(strlen(adaptorPtr->name) + 1)))
- strcpy(pa->name, adaptorPtr->name);
-
- if(adaptorPtr->nEncodings &&
- (pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
-
- for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
- i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++)
- {
- pe->id = encodingPtr->id;
- pe->pScreen = pScreen;
- if((pe->name = xalloc(strlen(encodingPtr->name) + 1)))
- strcpy(pe->name, encodingPtr->name);
- pe->width = encodingPtr->width;
- pe->height = encodingPtr->height;
- pe->rate.numerator = encodingPtr->rate.numerator;
- pe->rate.denominator = encodingPtr->rate.denominator;
- }
- pa->nEncodings = adaptorPtr->nEncodings;
- pa->pEncodings = pEncode;
- }
-
- if(adaptorPtr->nImages &&
- (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
-
- for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
- i < adaptorPtr->nImages; i++, pi++, imagePtr++)
- {
- pi->id = imagePtr->id;
- pi->type = imagePtr->type;
- pi->byte_order = imagePtr->byte_order;
- memcpy(pi->guid, imagePtr->guid, 16);
- pi->bits_per_pixel = imagePtr->bits_per_pixel;
- pi->format = imagePtr->format;
- pi->num_planes = imagePtr->num_planes;
- pi->depth = imagePtr->depth;
- pi->red_mask = imagePtr->red_mask;
- pi->green_mask = imagePtr->green_mask;
- pi->blue_mask = imagePtr->blue_mask;
- pi->y_sample_bits = imagePtr->y_sample_bits;
- pi->u_sample_bits = imagePtr->u_sample_bits;
- pi->v_sample_bits = imagePtr->v_sample_bits;
- pi->horz_y_period = imagePtr->horz_y_period;
- pi->horz_u_period = imagePtr->horz_u_period;
- pi->horz_v_period = imagePtr->horz_v_period;
- pi->vert_y_period = imagePtr->vert_y_period;
- pi->vert_u_period = imagePtr->vert_u_period;
- pi->vert_v_period = imagePtr->vert_v_period;
- memcpy(pi->component_order, imagePtr->component_order, 32);
- pi->scanline_order = imagePtr->scanline_order;
- }
- pa->nImages = adaptorPtr->nImages;
- pa->pImages = pImage;
- }
-
- if(adaptorPtr->nAttributes &&
- (pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
- {
- for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0;
- i < adaptorPtr->nAttributes; pat++, i++, attributePtr++)
- {
- pat->flags = attributePtr->flags;
- pat->min_value = attributePtr->min_value;
- pat->max_value = attributePtr->max_value;
- if((pat->name = xalloc(strlen(attributePtr->name) + 1)))
- strcpy(pat->name, attributePtr->name);
- }
- pa->nAttributes = adaptorPtr->nAttributes;
- pa->pAttributes = pAttribute;
- }
-
-
- totFormat = adaptorPtr->nFormats;
-
- if(!(pFormat = xcalloc(totFormat, sizeof(XvFormatRec)))) {
- KdXVFreeAdaptor(pa);
- continue;
- }
- for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats;
- i < adaptorPtr->nFormats; i++, formatPtr++)
- {
- numVisuals = pScreen->numVisuals;
- pVisual = pScreen->visuals;
-
- while(numVisuals--) {
- if((pVisual->class == formatPtr->class) &&
- (pVisual->nplanes == formatPtr->depth)) {
-
- if(numFormat >= totFormat) {
- void *moreSpace;
- totFormat *= 2;
- moreSpace = xrealloc(pFormat,
- totFormat * sizeof(XvFormatRec));
- if(!moreSpace) break;
- pFormat = moreSpace;
- pf = pFormat + numFormat;
- }
-
- pf->visual = pVisual->vid;
- pf->depth = formatPtr->depth;
-
- pf++;
- numFormat++;
- }
- pVisual++;
- }
- }
- pa->nFormats = numFormat;
- pa->pFormats = pFormat;
- if(!numFormat) {
- KdXVFreeAdaptor(pa);
- continue;
- }
-
- if(!(adaptorPriv = xcalloc(1, sizeof(XvAdaptorRecPrivate)))) {
- KdXVFreeAdaptor(pa);
- continue;
- }
-
- adaptorPriv->flags = adaptorPtr->flags;
- adaptorPriv->PutVideo = adaptorPtr->PutVideo;
- adaptorPriv->PutStill = adaptorPtr->PutStill;
- adaptorPriv->GetVideo = adaptorPtr->GetVideo;
- adaptorPriv->GetStill = adaptorPtr->GetStill;
- adaptorPriv->StopVideo = adaptorPtr->StopVideo;
- adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute;
- adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute;
- adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize;
- adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes;
- adaptorPriv->PutImage = adaptorPtr->PutImage;
- adaptorPriv->ReputImage = adaptorPtr->ReputImage;
-
- pa->devPriv.ptr = (pointer)adaptorPriv;
-
- if(!(pPort = xcalloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
- KdXVFreeAdaptor(pa);
- continue;
- }
- for(pp = pPort, i = 0, numPort = 0;
- i < adaptorPtr->nPorts; i++) {
-
- if(!(pp->id = FakeClientID(0)))
- continue;
-
- if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate))))
- continue;
-
- if(!AddResource(pp->id, PortResource, pp)) {
- xfree(portPriv);
- continue;
- }
-
- pp->pAdaptor = pa;
- pp->pNotify = (XvPortNotifyPtr)NULL;
- pp->pDraw = (DrawablePtr)NULL;
- pp->client = (ClientPtr)NULL;
- pp->grab.client = (ClientPtr)NULL;
- pp->time = currentTime;
- pp->devPriv.ptr = portPriv;
-
- portPriv->screen = screen;
- portPriv->AdaptorRec = adaptorPriv;
- portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr;
-
- pp++;
- numPort++;
- }
- pa->nPorts = numPort;
- pa->pPorts = pPort;
- if(!numPort) {
- KdXVFreeAdaptor(pa);
- continue;
- }
-
- pa->base_id = pPort->id;
-
- pa++;
- numAdaptor++;
- }
-
- if(numAdaptor) {
- pxvs->nAdaptors = numAdaptor;
- pxvs->pAdaptors = pAdaptor;
- } else {
- xfree(pAdaptor);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Video should be clipped to the intersection of the window cliplist
- and the client cliplist specified in the GC for which the video was
- initialized. When we need to reclip a window, the GC that started
- the video may not even be around anymore. That's why we save the
- client clip from the GC when the video is initialized. We then
- use KdXVUpdateCompositeClip to calculate the new composite clip
- when we need it. This is different from what DEC did. They saved
- the GC and used it's clip list when they needed to reclip the window,
- even if the client clip was different from the one the video was
- initialized with. If the original GC was destroyed, they had to stop
- the video. I like the new method better (MArk).
-
- This function only works for windows. Will need to rewrite when
- (if) we support pixmap rendering.
-*/
-
-static void
-KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
-{
- RegionPtr pregWin, pCompositeClip;
- WindowPtr pWin;
- Bool freeCompClip = FALSE;
-
- if(portPriv->pCompositeClip)
- return;
-
- pWin = (WindowPtr)portPriv->pDraw;
-
- /* get window clip list */
- if(portPriv->subWindowMode == IncludeInferiors) {
- pregWin = NotClippedByChildren(pWin);
- freeCompClip = TRUE;
- } else
- pregWin = &pWin->clipList;
-
- if(!portPriv->clientClip) {
- portPriv->pCompositeClip = pregWin;
- portPriv->FreeCompositeClip = freeCompClip;
- return;
- }
-
- pCompositeClip = REGION_CREATE(pWin->pScreen, NullBox, 1);
- REGION_COPY(pWin->pScreen, pCompositeClip, portPriv->clientClip);
- REGION_TRANSLATE(pWin->pScreen, pCompositeClip,
- portPriv->pDraw->x + portPriv->clipOrg.x,
- portPriv->pDraw->y + portPriv->clipOrg.y);
- REGION_INTERSECT(pWin->pScreen, pCompositeClip, pregWin, pCompositeClip);
-
- portPriv->pCompositeClip = pCompositeClip;
- portPriv->FreeCompositeClip = TRUE;
-
- if(freeCompClip) {
- REGION_DESTROY(pWin->pScreen, pregWin);
- }
-}
-
-/* Save the current clientClip and update the CompositeClip whenever
- we have a fresh GC */
-
-static void
-KdXVCopyClip(
- XvPortRecPrivatePtr portPriv,
- GCPtr pGC
-){
- /* copy the new clip if it exists */
- if((pGC->clientClipType == CT_REGION) && pGC->clientClip) {
- if(!portPriv->clientClip)
- portPriv->clientClip = REGION_CREATE(pGC->pScreen, NullBox, 1);
- /* Note: this is in window coordinates */
- REGION_COPY(pGC->pScreen, portPriv->clientClip, pGC->clientClip);
- } else if(portPriv->clientClip) { /* free the old clientClip */
- REGION_DESTROY(pGC->pScreen, portPriv->clientClip);
- portPriv->clientClip = NULL;
- }
-
- /* get rid of the old clip list */
- if(portPriv->pCompositeClip && portPriv->FreeCompositeClip) {
- REGION_DESTROY(pWin->pScreen, portPriv->pCompositeClip);
- }
-
- portPriv->clipOrg = pGC->clipOrg;
- portPriv->pCompositeClip = pGC->pCompositeClip;
- portPriv->FreeCompositeClip = FALSE;
- portPriv->subWindowMode = pGC->subWindowMode;
-}
-
-static int
-KdXVRegetVideo(XvPortRecPrivatePtr portPriv)
-{
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- KdXVUpdateCompositeClip(portPriv);
-
- /* translate the video region to the screen */
- WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
- WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
- WinBox.x2 = WinBox.x1 + portPriv->drw_w;
- WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
- /* clip to the window composite clip */
- REGION_INIT(portPriv->pDraw->pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(portPriv->pDraw->pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
- /* that's all if it's totally obscured */
- if(!REGION_NOTEMPTY(portPriv->pDraw->pScreen, &ClipRegion)) {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->screen, portPriv->pDraw,
- portPriv->vid_x, portPriv->vid_y,
- WinBox.x1, WinBox.y1,
- portPriv->vid_w, portPriv->vid_h,
- portPriv->drw_w, portPriv->drw_h,
- &ClipRegion, portPriv->DevPriv.ptr);
-
- if(ret == Success)
- portPriv->isOn = XV_ON;
-
-CLIP_VIDEO_BAILOUT:
-
- if((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- REGION_UNINIT(portPriv->pDraw->pScreen, &WinRegion);
- REGION_UNINIT(portPriv->pDraw->pScreen, &ClipRegion);
-
- return ret;
-}
-
-
-static int
-KdXVReputVideo(XvPortRecPrivatePtr portPriv)
-{
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- ScreenPtr pScreen = portPriv->pDraw->pScreen;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen=pScreenPriv->screen;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- KdXVUpdateCompositeClip(portPriv);
-
- /* translate the video region to the screen */
- WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
- WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
- WinBox.x2 = WinBox.x1 + portPriv->drw_w;
- WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
- /* clip to the window composite clip */
- REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
- /* clip and translate to the viewport */
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = 0;
- VPBox.y1 = 0;
- VPBox.x2 = screen->width;
- VPBox.y2 = screen->height;
-
- REGION_INIT(pScreen, &VPReg, &VPBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
- REGION_UNINIT(pScreen, &VPReg);
- }
-
- /* that's all if it's totally obscured */
- if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
-
- /* bailout if we have to clip but the hardware doesn't support it */
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = REGION_RECTS(&ClipRegion);
- if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->screen, portPriv->pDraw,
- portPriv->vid_x, portPriv->vid_y,
- WinBox.x1, WinBox.y1,
- portPriv->vid_w, portPriv->vid_h,
- portPriv->drw_w, portPriv->drw_h,
- &ClipRegion, portPriv->DevPriv.ptr);
-
- if(ret == Success) portPriv->isOn = XV_ON;
-
-CLIP_VIDEO_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- REGION_UNINIT(pScreen, &WinRegion);
- REGION_UNINIT(pScreen, &ClipRegion);
-
- return ret;
-}
-
-static int
-KdXVReputImage(XvPortRecPrivatePtr portPriv)
-{
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- ScreenPtr pScreen = portPriv->pDraw->pScreen;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen=pScreenPriv->screen;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- KdXVUpdateCompositeClip(portPriv);
-
- /* translate the video region to the screen */
- WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
- WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
- WinBox.x2 = WinBox.x1 + portPriv->drw_w;
- WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
- /* clip to the window composite clip */
- REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
- /* clip and translate to the viewport */
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = 0;
- VPBox.y1 = 0;
- VPBox.x2 = screen->width;
- VPBox.y2 = screen->height;
-
- REGION_INIT(pScreen, &VPReg, &VPBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
- REGION_UNINIT(pScreen, &VPReg);
- }
-
- /* that's all if it's totally obscured */
- if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
-
- /* bailout if we have to clip but the hardware doesn't support it */
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = REGION_RECTS(&ClipRegion);
- if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->screen, portPriv->pDraw,
- WinBox.x1, WinBox.y1,
- &ClipRegion, portPriv->DevPriv.ptr);
-
- portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF;
-
-CLIP_VIDEO_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- REGION_UNINIT(pScreen, &WinRegion);
- REGION_UNINIT(pScreen, &ClipRegion);
-
- return ret;
-}
-
-
-static int
-KdXVReputAllVideo(WindowPtr pWin, pointer data)
-{
- KdXVWindowPtr WinPriv;
-
- if (pWin->drawable.type != DRAWABLE_WINDOW)
- return WT_DONTWALKCHILDREN;
-
- WinPriv = GET_KDXV_WINDOW(pWin);
-
- while(WinPriv) {
- if(WinPriv->PortRec->type == XvInputMask)
- KdXVReputVideo(WinPriv->PortRec);
- else
- KdXVRegetVideo(WinPriv->PortRec);
- WinPriv = WinPriv->next;
- }
-
- return WT_WALKCHILDREN;
-}
-
-static int
-KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
-{
- KdXVWindowPtr winPriv, PrivRoot;
-
- winPriv = PrivRoot = GET_KDXV_WINDOW(pWin);
-
- /* Enlist our port in the window private */
- while(winPriv) {
- if(winPriv->PortRec == portPriv) /* we're already listed */
- break;
- winPriv = winPriv->next;
- }
-
- if(!winPriv) {
- winPriv = xalloc(sizeof(KdXVWindowRec));
- if(!winPriv) return BadAlloc;
- winPriv->PortRec = portPriv;
- winPriv->next = PrivRoot;
- pWin->devPrivates[KdXVWindowIndex].ptr = (pointer)winPriv;
- }
- return Success;
-}
-
-
-static void
-KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
-{
- KdXVWindowPtr winPriv, prevPriv = NULL;
-
- winPriv = GET_KDXV_WINDOW(pWin);
-
- while(winPriv) {
- if(winPriv->PortRec == portPriv) {
- if(prevPriv)
- prevPriv->next = winPriv->next;
- else
- pWin->devPrivates[KdXVWindowIndex].ptr =
- (pointer)winPriv->next;
- xfree(winPriv);
- break;
- }
- prevPriv = winPriv;
- winPriv = winPriv->next;
- }
- portPriv->pDraw = NULL;
-}
-
-/**** ScreenRec fields ****/
-
-
-static Bool
-KdXVCreateWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- int ret;
-
- pScreen->CreateWindow = ScreenPriv->CreateWindow;
- ret = (*pScreen->CreateWindow)(pWin);
- pScreen->CreateWindow = KdXVCreateWindow;
-
- if(ret) pWin->devPrivates[KdXVWindowIndex].ptr = NULL;
-
- return ret;
-}
-
-
-static Bool
-KdXVDestroyWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- KdXVWindowPtr tmp, WinPriv = GET_KDXV_WINDOW(pWin);
- int ret;
-
- while(WinPriv) {
- XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
-
- if(pPriv->isOn > XV_OFF) {
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->screen, pPriv->DevPriv.ptr, TRUE);
- pPriv->isOn = XV_OFF;
- }
-
- pPriv->pDraw = NULL;
- tmp = WinPriv;
- WinPriv = WinPriv->next;
- xfree(tmp);
- }
-
- pWin->devPrivates[KdXVWindowIndex].ptr = NULL;
-
- pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
- ret = (*pScreen->DestroyWindow)(pWin);
- pScreen->DestroyWindow = KdXVDestroyWindow;
-
- return ret;
-}
-
-
-static void
-KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin);
- KdXVWindowPtr pPrev;
- XvPortRecPrivatePtr pPriv;
- Bool AreasExposed;
-
- AreasExposed = (WinPriv && reg1 && REGION_NOTEMPTY(pScreen, reg1));
-
- pScreen->WindowExposures = ScreenPriv->WindowExposures;
- (*pScreen->WindowExposures)(pWin, reg1, reg2);
- pScreen->WindowExposures = KdXVWindowExposures;
-
- /* filter out XClearWindow/Area */
- if (!pWin->valdata) return;
-
- pPrev = NULL;
-
- while(WinPriv) {
- pPriv = WinPriv->PortRec;
-
- /* Reput anyone with a reput function */
-
- switch(pPriv->type) {
- case XvInputMask:
- KdXVReputVideo(pPriv);
- break;
- case XvOutputMask:
- KdXVRegetVideo(pPriv);
- break;
- default: /* overlaid still/image*/
- if (pPriv->AdaptorRec->ReputImage)
- KdXVReputImage(pPriv);
- else if(AreasExposed) {
- KdXVWindowPtr tmp;
-
- if (pPriv->isOn == XV_ON) {
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->screen, pPriv->DevPriv.ptr, FALSE);
- pPriv->isOn = XV_PENDING;
- }
- pPriv->pDraw = NULL;
-
- if(!pPrev)
- pWin->devPrivates[KdXVWindowIndex].ptr =
- (pointer)(WinPriv->next);
- else
- pPrev->next = WinPriv->next;
- tmp = WinPriv;
- WinPriv = WinPriv->next;
- xfree(tmp);
- continue;
- }
- break;
- }
- pPrev = WinPriv;
- WinPriv = WinPriv->next;
- }
-}
-
-
-static void
-KdXVClipNotify(WindowPtr pWin, int dx, int dy)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin);
- KdXVWindowPtr tmp, pPrev = NULL;
- XvPortRecPrivatePtr pPriv;
- Bool visible = (pWin->visibility == VisibilityUnobscured) ||
- (pWin->visibility == VisibilityPartiallyObscured);
-
- while(WinPriv) {
- pPriv = WinPriv->PortRec;
-
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
- REGION_DESTROY(pScreen, pPriv->pCompositeClip);
-
- pPriv->pCompositeClip = NULL;
-
- /* Stop everything except images, but stop them too if the
- window isn't visible. But we only remove the images. */
-
- if(pPriv->type || !visible) {
- if(pPriv->isOn == XV_ON) {
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->screen, pPriv->DevPriv.ptr, FALSE);
- pPriv->isOn = XV_PENDING;
- }
-
- if(!pPriv->type) { /* overlaid still/image */
- pPriv->pDraw = NULL;
-
- if(!pPrev)
- pWin->devPrivates[KdXVWindowIndex].ptr =
- (pointer)(WinPriv->next);
- else
- pPrev->next = WinPriv->next;
- tmp = WinPriv;
- WinPriv = WinPriv->next;
- xfree(tmp);
- continue;
- }
- }
-
- pPrev = WinPriv;
- WinPriv = WinPriv->next;
- }
-
- if(ScreenPriv->ClipNotify) {
- pScreen->ClipNotify = ScreenPriv->ClipNotify;
- (*pScreen->ClipNotify)(pWin, dx, dy);
- pScreen->ClipNotify = KdXVClipNotify;
- }
-}
-
-
-
-/**** Required XvScreenRec fields ****/
-
-static Bool
-KdXVCloseScreen(int i, ScreenPtr pScreen)
-{
- XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- XvAdaptorPtr pa;
- int c;
-
- if(!ScreenPriv) return TRUE;
-
- pScreen->CreateWindow = ScreenPriv->CreateWindow;
- pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
- pScreen->WindowExposures = ScreenPriv->WindowExposures;
- pScreen->ClipNotify = ScreenPriv->ClipNotify;
-
-/* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */
-
- for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
- KdXVFreeAdaptor(pa);
- }
-
- if(pxvs->pAdaptors)
- xfree(pxvs->pAdaptors);
-
- xfree(ScreenPriv);
-
-
- return TRUE;
-}
-
-
-static int
-KdXVQueryAdaptors(
- ScreenPtr pScreen,
- XvAdaptorPtr *p_pAdaptors,
- int *p_nAdaptors
-){
- XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
-
- *p_nAdaptors = pxvs->nAdaptors;
- *p_pAdaptors = pxvs->pAdaptors;
-
- return (Success);
-}
-
-static Bool
-KdXVRunning (ScreenPtr pScreen)
-{
- return (KdXVGeneration == serverGeneration &&
- GET_XV_SCREEN(pScreen) != 0);
-}
-
-Bool
-KdXVEnable(ScreenPtr pScreen)
-{
- if (!KdXVRunning (pScreen))
- return TRUE;
-
- WalkTree(pScreen, KdXVReputAllVideo, 0);
-
- return TRUE;
-}
-
-void
-KdXVDisable(ScreenPtr pScreen)
-{
- XvScreenPtr pxvs;
- KdXVScreenPtr ScreenPriv;
- XvAdaptorPtr pAdaptor;
- XvPortPtr pPort;
- XvPortRecPrivatePtr pPriv;
- int i, j;
-
- if (!KdXVRunning (pScreen))
- return;
-
- pxvs = GET_XV_SCREEN(pScreen);
- ScreenPriv = GET_KDXV_SCREEN(pScreen);
-
- for(i = 0; i < pxvs->nAdaptors; i++) {
- pAdaptor = &pxvs->pAdaptors[i];
- for(j = 0; j < pAdaptor->nPorts; j++) {
- pPort = &pAdaptor->pPorts[j];
- pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
- if(pPriv->isOn > XV_OFF) {
-
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->screen, pPriv->DevPriv.ptr, TRUE);
- pPriv->isOn = XV_OFF;
-
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
- REGION_DESTROY(pScreen, pPriv->pCompositeClip);
-
- pPriv->pCompositeClip = NULL;
-
- if(!pPriv->type && pPriv->pDraw) { /* still */
- KdXVRemovePortFromWindow((WindowPtr)pPriv->pDraw, pPriv);
- }
- }
- }
- }
-}
-
-/**** XvAdaptorRec fields ****/
-
-static int
-KdXVAllocatePort(
- unsigned long port,
- XvPortPtr pPort,
- XvPortPtr *ppPort
-){
- *ppPort = pPort;
- return Success;
-}
-
-static int
-KdXVFreePort(XvPortPtr pPort)
-{
- return Success;
-}
-
-static int
-KdXVPutVideo(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- KdScreenPriv(portPriv->screen->pScreen);
- int result;
-
- /* No dumping video to pixmaps... For now anyhow */
- if(pDraw->type != DRAWABLE_WINDOW) {
- pPort->pDraw = (DrawablePtr)NULL;
- return BadAlloc;
- }
-
- /* If we are changing windows, unregister our port in the old window */
- if(portPriv->pDraw && (portPriv->pDraw != pDraw))
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
-
- /* Register our port with the new window */
- result = KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- if(result != Success) return result;
-
- portPriv->pDraw = pDraw;
- portPriv->type = XvInputMask;
-
- /* save a copy of these parameters */
- portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
- portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
-
- /* make sure we have the most recent copy of the clientClip */
- KdXVCopyClip(portPriv, pGC);
-
- /* To indicate to the DI layer that we were successful */
- pPort->pDraw = pDraw;
-
- if (!pScreenPriv->enabled) return Success;
-
- return(KdXVReputVideo(portPriv));
-}
-
-static int
-KdXVPutStill(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- ScreenPtr pScreen = pDraw->pScreen;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen=pScreenPriv->screen;
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- if (!pScreenPriv->enabled) return Success;
-
- WinBox.x1 = pDraw->x + drw_x;
- WinBox.y1 = pDraw->y + drw_y;
- WinBox.x2 = WinBox.x1 + drw_w;
- WinBox.y2 = WinBox.y1 + drw_h;
-
- REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
-
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = 0;
- VPBox.y1 = 0;
- VPBox.x2 = screen->width;
- VPBox.y2 = screen->height;
-
- REGION_INIT(pScreen, &VPReg, &VPBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
- REGION_UNINIT(pScreen, &VPReg);
- }
-
- if(portPriv->pDraw) {
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
- }
-
- if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
- clippedAway = TRUE;
- goto PUT_STILL_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = REGION_RECTS(&ClipRegion);
- if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto PUT_STILL_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->PutStill)(portPriv->screen, pDraw,
- vid_x, vid_y, WinBox.x1, WinBox.y1,
- vid_w, vid_h, drw_w, drw_h,
- &ClipRegion, portPriv->DevPriv.ptr);
-
- if((ret == Success) &&
- (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) {
-
- KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- portPriv->isOn = XV_ON;
- portPriv->pDraw = pDraw;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
- portPriv->type = 0; /* no mask means it's transient and should
- not be reput once it's removed */
- pPort->pDraw = pDraw; /* make sure we can get stop requests */
- }
-
-PUT_STILL_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- REGION_UNINIT(pScreen, &WinRegion);
- REGION_UNINIT(pScreen, &ClipRegion);
-
- return ret;
-}
-
-static int
-KdXVGetVideo(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- int result;
- KdScreenPriv(portPriv->screen->pScreen);
-
- /* No pixmaps... For now anyhow */
- if(pDraw->type != DRAWABLE_WINDOW) {
- pPort->pDraw = (DrawablePtr)NULL;
- return BadAlloc;
- }
-
- /* If we are changing windows, unregister our port in the old window */
- if(portPriv->pDraw && (portPriv->pDraw != pDraw))
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
-
- /* Register our port with the new window */
- result = KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- if(result != Success) return result;
-
- portPriv->pDraw = pDraw;
- portPriv->type = XvOutputMask;
-
- /* save a copy of these parameters */
- portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
- portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
-
- /* make sure we have the most recent copy of the clientClip */
- KdXVCopyClip(portPriv, pGC);
-
- /* To indicate to the DI layer that we were successful */
- pPort->pDraw = pDraw;
-
- if(!pScreenPriv->enabled) return Success;
-
- return(KdXVRegetVideo(portPriv));
-}
-
-static int
-KdXVGetStill(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- ScreenPtr pScreen = pDraw->pScreen;
- KdScreenPriv(pScreen);
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- if(!pScreenPriv->enabled) return Success;
-
- WinBox.x1 = pDraw->x + drw_x;
- WinBox.y1 = pDraw->y + drw_y;
- WinBox.x2 = WinBox.x1 + drw_w;
- WinBox.y2 = WinBox.y1 + drw_h;
-
- REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
-
- if(portPriv->pDraw) {
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
- }
-
- if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
- clippedAway = TRUE;
- goto GET_STILL_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->GetStill)(portPriv->screen, pDraw,
- vid_x, vid_y, WinBox.x1, WinBox.y1,
- vid_w, vid_h, drw_w, drw_h,
- &ClipRegion, portPriv->DevPriv.ptr);
-
-GET_STILL_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- REGION_UNINIT(pScreen, &WinRegion);
- REGION_UNINIT(pScreen, &ClipRegion);
-
- return ret;
-}
-
-
-
-static int
-KdXVStopVideo(
- ClientPtr client,
- XvPortPtr pPort,
- DrawablePtr pDraw
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- KdScreenPriv(portPriv->screen->pScreen);
-
- if(pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- KdXVRemovePortFromWindow((WindowPtr)pDraw, portPriv);
-
- if(!pScreenPriv->enabled) return Success;
-
- /* Must free resources. */
-
- if(portPriv->isOn > XV_OFF) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, TRUE);
- portPriv->isOn = XV_OFF;
- }
-
- return Success;
-}
-
-static int
-KdXVSetPortAttribute(
- ClientPtr client,
- XvPortPtr pPort,
- Atom attribute,
- INT32 value
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen,
- attribute, value, portPriv->DevPriv.ptr));
-}
-
-
-static int
-KdXVGetPortAttribute(
- ClientPtr client,
- XvPortPtr pPort,
- Atom attribute,
- INT32 *p_value
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen,
- attribute, (int *) p_value, portPriv->DevPriv.ptr));
-}
-
-
-
-static int
-KdXVQueryBestSize(
- ClientPtr client,
- XvPortPtr pPort,
- CARD8 motion,
- CARD16 vid_w, CARD16 vid_h,
- CARD16 drw_w, CARD16 drw_h,
- unsigned int *p_w, unsigned int *p_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen,
- (Bool)motion, vid_w, vid_h, drw_w, drw_h,
- p_w, p_h, portPriv->DevPriv.ptr);
-
- return Success;
-}
-
-
-static int
-KdXVPutImage(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 src_x, INT16 src_y,
- CARD16 src_w, CARD16 src_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h,
- XvImagePtr format,
- unsigned char* data,
- Bool sync,
- CARD16 width, CARD16 height
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- ScreenPtr pScreen = pDraw->pScreen;
- KdScreenPriv(pScreen);
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- if(!pScreenPriv->enabled) return Success;
-
- WinBox.x1 = pDraw->x + drw_x;
- WinBox.y1 = pDraw->y + drw_y;
- WinBox.x2 = WinBox.x1 + drw_w;
- WinBox.y2 = WinBox.y1 + drw_h;
-
- REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
-
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = 0;
- VPBox.y1 = 0;
- VPBox.x2 = pScreen->width;
- VPBox.y2 = pScreen->height;
-
- REGION_INIT(pScreen, &VPReg, &VPBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
- REGION_UNINIT(pScreen, &VPReg);
- }
-
- if(portPriv->pDraw) {
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
- }
-
- if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
- clippedAway = TRUE;
- goto PUT_IMAGE_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = REGION_RECTS(&ClipRegion);
- if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto PUT_IMAGE_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->PutImage)(portPriv->screen, pDraw,
- src_x, src_y, WinBox.x1, WinBox.y1,
- src_w, src_h, drw_w, drw_h, format->id, data, width, height,
- sync, &ClipRegion, portPriv->DevPriv.ptr);
-
- if((ret == Success) &&
- (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
-
- KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- portPriv->isOn = XV_ON;
- portPriv->pDraw = pDraw;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
- portPriv->type = 0; /* no mask means it's transient and should
- not be reput once it's removed */
- pPort->pDraw = pDraw; /* make sure we can get stop requests */
- }
-
-PUT_IMAGE_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- REGION_UNINIT(pScreen, &WinRegion);
- REGION_UNINIT(pScreen, &ClipRegion);
-
- return ret;
-}
-
-
-static int
-KdXVQueryImageAttributes(
- ClientPtr client,
- XvPortPtr pPort,
- XvImagePtr format,
- CARD16 *width,
- CARD16 *height,
- int *pitches,
- int *offsets
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen,
- format->id, width, height, pitches, offsets);
-}
-
-
-/**************** Offscreen surface stuff *******************/
-
-typedef struct {
- KdOffscreenImagePtr images;
- int num;
-} OffscreenImageRec;
-
-static OffscreenImageRec OffscreenImages[MAXSCREENS];
-static Bool offscreenInited = FALSE;
-
-Bool
-KdXVRegisterOffscreenImages(
- ScreenPtr pScreen,
- KdOffscreenImagePtr images,
- int num
-){
- if(!offscreenInited) {
- bzero(OffscreenImages, sizeof(OffscreenImages[MAXSCREENS]));
- offscreenInited = TRUE;
- }
-
- OffscreenImages[pScreen->myNum].num = num;
- OffscreenImages[pScreen->myNum].images = images;
-
- return TRUE;
-}
-
-KdOffscreenImagePtr
-KdXVQueryOffscreenImages(
- ScreenPtr pScreen,
- int *num
-){
- if(!offscreenInited) {
- *num = 0;
- return NULL;
- }
-
- *num = OffscreenImages[pScreen->myNum].num;
- return OffscreenImages[pScreen->myNum].images;
-}
-
-/**************** Common video manipulation functions *******************/
-
-void
-KdXVCopyPackedData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
- int srcPitch, int dstPitch, int srcW, int srcH, int top, int left,
- int h, int w)
-{
- int srcDown = srcPitch, srcRight = 2, srcNext;
- int p;
-
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- srcDown = srcPitch;
- srcRight = 2;
- break;
- case RR_Rotate_90:
- src += (srcH - 1) * 2;
- srcDown = -2;
- srcRight = srcPitch;
- break;
- case RR_Rotate_180:
- src += srcPitch * (srcH - 1) + (srcW - 1) * 2;
- srcDown = -srcPitch;
- srcRight = -2;
- break;
- case RR_Rotate_270:
- src += srcPitch * (srcW - 1);
- srcDown = 2;
- srcRight = -srcPitch;
- break;
- }
-
- src = src + top * srcDown + left * srcRight;
-
- w >>= 1;
- srcRight >>= 1;
- srcNext = srcRight >> 1;
- while (h--) {
- CARD16 *s = (CARD16 *)src;
- CARD32 *d = (CARD32 *)dst;
- p = w;
- while (p--) {
- *d++ = s[0] | (s[srcNext] << 16);
- s += srcRight;
- }
- src += srcPitch;
- dst += dstPitch;
- }
-}
-
-void
-KdXVCopyPlanarData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
- int srcPitch, int srcPitch2, int dstPitch, int srcW, int srcH, int height,
- int top, int left, int h, int w, int id)
-{
- int i, j;
- CARD8 *src1, *src2, *src3, *dst1;
- int srcDown = srcPitch, srcDown2 = srcPitch2;
- int srcRight = 2, srcRight2 = 1, srcNext = 1;
-
- /* compute source data pointers */
- src1 = src;
- src2 = src1 + height * srcPitch;
- src3 = src2 + (height >> 1) * srcPitch2;
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- srcDown = srcPitch;
- srcDown2 = srcPitch2;
- srcRight = 2;
- srcRight2 = 1;
- srcNext = 1;
- break;
- case RR_Rotate_90:
- src1 = src1 + srcH - 1;
- src2 = src2 + (srcH >> 1) - 1;
- src3 = src3 + (srcH >> 1) - 1;
- srcDown = -1;
- srcDown2 = -1;
- srcRight = srcPitch * 2;
- srcRight2 = srcPitch2;
- srcNext = srcPitch;
- break;
- case RR_Rotate_180:
- src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1);
- src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
- src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
- srcDown = -srcPitch;
- srcDown2 = -srcPitch2;
- srcRight = -2;
- srcRight2 = -1;
- srcNext = -1;
- break;
- case RR_Rotate_270:
- src1 = src1 + srcPitch * (srcW - 1);
- src2 = src2 + srcPitch2 * ((srcW >> 1) - 1);
- src3 = src3 + srcPitch2 * ((srcW >> 1) - 1);
- srcDown = 1;
- srcDown2 = 1;
- srcRight = -srcPitch * 2;
- srcRight2 = -srcPitch2;
- srcNext = -srcPitch;
- break;
- }
-
- /* adjust for origin */
- src1 += top * srcDown + left * srcNext;
- src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
- src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
-
- if (id == FOURCC_I420) {
- CARD8 *srct = src2;
- src2 = src3;
- src3 = srct;
- }
-
- dst1 = dst;
-
- w >>= 1;
- for (j = 0; j < h; j++) {
- CARD32 *dst = (CARD32 *)dst1;
- CARD8 *s1l = src1;
- CARD8 *s1r = src1 + srcNext;
- CARD8 *s2 = src2;
- CARD8 *s3 = src3;
-
- for (i = 0; i < w; i++) {
- *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24);
- s1l += srcRight;
- s1r += srcRight;
- s2 += srcRight2;
- s3 += srcRight2;
- }
- src1 += srcDown;
- dst1 += dstPitch;
- if (j & 1) {
- src2 += srcDown2;
- src3 += srcDown2;
- }
- }
-}
diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h
deleted file mode 100644
index 28fc3c4ed..000000000
--- a/hw/kdrive/src/kxv.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
-
- XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
- Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
-
- Copyright (C) 2000, 2001 - Nokia Home Communications
- Copyright (C) 1998, 1999 - 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, 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 Software 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
-MERCHANTABILITY, 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 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.
-
-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.
-
-*/
-
-/* $RCSId: xc/programs/Xserver/hw/kdrive/kxv.h,v 1.1 2001/03/30 02:18:41 keithp Exp $ */
-
-#ifndef _XVDIX_H_
-#define _XVDIX_H_
-
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "mivalidate.h"
-#include "validate.h"
-#include "resource.h"
-#include "gcstruct.h"
-#include "dixstruct.h"
-
-#include "../../Xext/xvdix.h"
-
-#define VIDEO_NO_CLIPPING 0x00000001
-#define VIDEO_INVERT_CLIPLIST 0x00000002
-#define VIDEO_OVERLAID_IMAGES 0x00000004
-#define VIDEO_OVERLAID_STILLS 0x00000008
-#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
-
-typedef struct {
- int id;
- int type;
- int byte_order;
- unsigned char guid[16];
- int bits_per_pixel;
- int format;
- int num_planes;
-
- /* for RGB formats only */
- int depth;
- unsigned int red_mask;
- unsigned int green_mask;
- unsigned int blue_mask;
-
- /* for YUV formats only */
- unsigned int y_sample_bits;
- unsigned int u_sample_bits;
- unsigned int v_sample_bits;
- unsigned int horz_y_period;
- unsigned int horz_u_period;
- unsigned int horz_v_period;
- unsigned int vert_y_period;
- unsigned int vert_u_period;
- unsigned int vert_v_period;
- char component_order[32];
- int scanline_order;
-} KdImageRec, *KdImagePtr;
-
-
-typedef struct {
- KdScreenInfo * screen;
- int id;
- unsigned short width, height;
- int *pitches; /* bytes */
- int *offsets; /* in bytes from start of framebuffer */
- DevUnion devPrivate;
-} KdSurfaceRec, *KdSurfacePtr;
-
-
-typedef int (* PutVideoFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data );
-typedef int (* PutStillFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data );
-typedef int (* GetVideoFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data );
-typedef int (* GetStillFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data );
-typedef void (* StopVideoFuncPtr)(KdScreenInfo * screen, pointer data, Bool Exit);
-typedef int (* SetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
- int value, pointer data);
-typedef int (* GetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
- int *value, pointer data);
-typedef void (* QueryBestSizeFuncPtr)(KdScreenInfo * screen, Bool motion,
- short vid_w, short vid_h, short drw_w, short drw_h,
- unsigned int *p_w, unsigned int *p_h, pointer data);
-typedef int (* PutImageFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short src_x, short src_y, short drw_x, short drw_y,
- short src_w, short src_h, short drw_w, short drw_h,
- int image, unsigned char* buf, short width, short height, Bool Sync,
- RegionPtr clipBoxes, pointer data );
-typedef int (* ReputImageFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short drw_x, short drw_y,
- RegionPtr clipBoxes, pointer data );
-typedef int (*QueryImageAttributesFuncPtr)(KdScreenInfo * screen,
- int image, unsigned short *width, unsigned short *height,
- int *pitches, int *offsets);
-
-typedef enum {
- XV_OFF,
- XV_PENDING,
- XV_ON
-} XvStatus;
-
-/*** this is what the driver needs to fill out ***/
-
-typedef struct {
- int id;
- char *name;
- unsigned short width, height;
- XvRationalRec rate;
-} KdVideoEncodingRec, *KdVideoEncodingPtr;
-
-typedef struct {
- char depth;
- short class;
-} KdVideoFormatRec, *KdVideoFormatPtr;
-
-typedef struct {
- int flags;
- int min_value;
- int max_value;
- char *name;
-} KdAttributeRec, *KdAttributePtr;
-
-typedef struct {
- unsigned int type;
- int flags;
- char *name;
- int nEncodings;
- KdVideoEncodingPtr pEncodings;
- int nFormats;
- KdVideoFormatPtr pFormats;
- int nPorts;
- DevUnion *pPortPrivates;
- int nAttributes;
- KdAttributePtr pAttributes;
- int nImages;
- KdImagePtr pImages;
- PutVideoFuncPtr PutVideo;
- PutStillFuncPtr PutStill;
- GetVideoFuncPtr GetVideo;
- GetStillFuncPtr GetStill;
- StopVideoFuncPtr StopVideo;
- SetPortAttributeFuncPtr SetPortAttribute;
- GetPortAttributeFuncPtr GetPortAttribute;
- QueryBestSizeFuncPtr QueryBestSize;
- PutImageFuncPtr PutImage;
- ReputImageFuncPtr ReputImage;
- QueryImageAttributesFuncPtr QueryImageAttributes;
-} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
-
-typedef struct {
- KdImagePtr image;
- int flags;
- int (*alloc_surface)(KdScreenInfo * screen,
- int id,
- unsigned short width,
- unsigned short height,
- KdSurfacePtr surface);
- int (*free_surface)(KdSurfacePtr surface);
- int (*display) (KdSurfacePtr surface,
- short vid_x, short vid_y,
- short drw_x, short drw_y,
- short vid_w, short vid_h,
- short drw_w, short drw_h,
- RegionPtr clipBoxes);
- int (*stop) (KdSurfacePtr surface);
- int (*getAttribute) (KdScreenInfo * screen, Atom attr, INT32 *value);
- int (*setAttribute) (KdScreenInfo * screen, Atom attr, INT32 value);
- int max_width;
- int max_height;
- int num_attributes;
- KdAttributePtr attributes;
-} KdOffscreenImageRec, *KdOffscreenImagePtr;
-
-Bool
-KdXVScreenInit(
- ScreenPtr pScreen,
- KdVideoAdaptorPtr *Adaptors,
- int num
-);
-
-typedef int (* KdXVInitGenericAdaptorPtr)(KdScreenInfo * screen,
- KdVideoAdaptorPtr **Adaptors);
-
-int
-KdXVRegisterGenericAdaptorDriver(
- KdXVInitGenericAdaptorPtr InitFunc
-);
-
-int
-KdXVListGenericAdaptors(
- KdScreenInfo * screen,
- KdVideoAdaptorPtr **Adaptors
-);
-
-Bool
-KdXVRegisterOffscreenImages(
- ScreenPtr pScreen,
- KdOffscreenImagePtr images,
- int num
-);
-
-KdOffscreenImagePtr
-KdXVQueryOffscreenImages(
- ScreenPtr pScreen,
- int *num
-);
-
-void
-KdXVCopyPackedData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
- int srcPitch, int dstPitch, int srcW, int srcH, int top, int left,
- int h, int w);
-
-void
-KdXVCopyPlanarData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
- int srcPitch, int srcPitch2, int dstPitch, int srcW, int srcH, int height,
- int top, int left, int h, int w, int id);
-
-KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen);
-
-void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr);
-
-/* Must be called from KdCardInfo functions, can be called without Xv enabled */
-Bool KdXVEnable(ScreenPtr);
-void KdXVDisable(ScreenPtr);
-
-/*** These are DDX layer privates ***/
-
-
-typedef struct {
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- ClipNotifyProcPtr ClipNotify;
- WindowExposuresProcPtr WindowExposures;
-} KdXVScreenRec, *KdXVScreenPtr;
-
-typedef struct {
- int flags;
- PutVideoFuncPtr PutVideo;
- PutStillFuncPtr PutStill;
- GetVideoFuncPtr GetVideo;
- GetStillFuncPtr GetStill;
- StopVideoFuncPtr StopVideo;
- SetPortAttributeFuncPtr SetPortAttribute;
- GetPortAttributeFuncPtr GetPortAttribute;
- QueryBestSizeFuncPtr QueryBestSize;
- PutImageFuncPtr PutImage;
- ReputImageFuncPtr ReputImage;
- QueryImageAttributesFuncPtr QueryImageAttributes;
-} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
-
-typedef struct {
- KdScreenInfo * screen;
- DrawablePtr pDraw;
- unsigned char type;
- unsigned int subWindowMode;
- DDXPointRec clipOrg;
- RegionPtr clientClip;
- RegionPtr pCompositeClip;
- Bool FreeCompositeClip;
- XvAdaptorRecPrivatePtr AdaptorRec;
- XvStatus isOn;
- Bool moved;
- int vid_x, vid_y, vid_w, vid_h;
- int drw_x, drw_y, drw_w, drw_h;
- DevUnion DevPriv;
-} XvPortRecPrivate, *XvPortRecPrivatePtr;
-
-typedef struct _KdXVWindowRec{
- XvPortRecPrivatePtr PortRec;
- struct _KdXVWindowRec *next;
-} KdXVWindowRec, *KdXVWindowPtr;
-
-#endif /* _XVDIX_H_ */
-
diff --git a/hw/kdrive/src/vga.c b/hw/kdrive/src/vga.c
deleted file mode 100644
index 3e7a43ee9..000000000
--- a/hw/kdrive/src/vga.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Id: vga.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/vga.c,v 1.2 1999/12/30 03:03:07 robin Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "vga.h"
-#include <stdio.h>
-
-#ifdef linux
-#ifdef __i386__
-#define extern static
-#include <sys/io.h>
-#undef extern
-
-#define _VgaInb(r) inb(r)
-#define _VgaOutb(v,r) outb(v,r)
-#else
-#define _VgaInb(r) 0
-#define _VgaOutb(v,r)
-#endif
-
-#define _VgaByteAddr(a) ((VGAVOL8 *) (a))
-#define _VgaBytePort(a) (a)
-#endif
-
-#ifdef VXWORKS
-#define _VgaInb(r) 0
-#define _VgaOutb(v,r) 0
-
-#define _VgaByteAddr(a) ((VGAVOL8 *) ((VGA32) (a) ^ 3))
-#define _VgaBytePort(a) 0
-
-#undef stderr
-#define stderr stdout
-
-#endif
-
-#undef VGA_DEBUG_REGISTERS
-#ifdef VGA_DEBUG_REGISTERS
-#define VGA_DEBUG(a) fprintf a
-#else
-#define VGA_DEBUG(a)
-#endif
-
-VGA8
-VgaInb (VGA16 r)
-{
- return _VgaInb(r);
-}
-
-void
-VgaOutb (VGA8 v, VGA16 r)
-{
- _VgaOutb (v,r);
-}
-
-VGA8
-VgaReadMemb (VGA32 addr)
-{
- return *_VgaByteAddr(addr);
-}
-
-void
-VgaWriteMemb (VGA8 v, VGA32 addr)
-{
- *_VgaByteAddr(addr) = v;
-}
-
-VGA8
-VgaFetch (VgaCard *card, VGA16 reg)
-{
- VgaMap map;
- VGA8 value = 0;
-
- (*card->map) (card, reg, &map, VGAFALSE);
- switch (map.access) {
- case VgaAccessMem:
- value = VgaReadMemb (map.port);
- VGA_DEBUG ((stderr, "%08x -> %2x\n", map.port, value));
- break;
- case VgaAccessIo:
- value = _VgaInb (map.port);
- VGA_DEBUG ((stderr, "%4x -> %2x\n", map.port, value));
- break;
- case VgaAccessIndMem:
- VgaWriteMemb (map.index, map.port + map.addr);
- value = VgaReadMemb (map.port + map.value);
- VGA_DEBUG ((stderr, "%4x/%2x -> %2x\n", map.port, map.index, value));
- break;
- case VgaAccessIndIo:
- _VgaOutb (map.index, map.port + map.addr);
- value = _VgaInb (map.port + map.value);
- VGA_DEBUG ((stderr, "%4x/%2x -> %2x\n", map.port, map.index, value));
- break;
- case VgaAccessDone:
- value = map.value;
- VGA_DEBUG ((stderr, "direct %4x -> %2x\n", reg, value));
- break;
- }
- return value;
-}
-
-void
-VgaStore (VgaCard *card, VGA16 reg, VGA8 value)
-{
- VgaMap map;
-
- map.value = value;
- (*card->map) (card, reg, &map, VGATRUE);
- switch (map.access) {
- case VgaAccessMem:
- VGA_DEBUG ((stderr, "%8x <- %2x\n", map.port, value));
- VgaWriteMemb (map.value, map.port);
- break;
- case VgaAccessIo:
- VGA_DEBUG ((stderr, "%4x <- %2x\n", map.port, value));
- _VgaOutb (value, map.port);
- break;
- case VgaAccessIndMem:
- VgaWriteMemb (map.index, map.port + map.addr);
- VgaWriteMemb (value, map.port + map.value);
- VGA_DEBUG ((stderr, "%4x/%2x <- %2x\n", map.port, map.index, value));
- break;
- case VgaAccessIndIo:
- VGA_DEBUG ((stderr, "%4x/%2x <- %2x\n", map.port, map.index, value));
- _VgaOutb (map.index, map.port + map.addr);
- _VgaOutb (value, map.port + map.value);
- break;
- case VgaAccessDone:
- VGA_DEBUG ((stderr, "direct %4x <- %2x\n", reg, value));
- break;
- }
-}
-
-void
-VgaPreserve (VgaCard *card)
-{
- VgaSave *s;
- VGA16 id;
-
- for (s = card->saves; s->first != VGA_REG_NONE; s++)
- {
- for (id = s->first; id <= s->last; id++)
- {
- card->values[id].cur = VgaFetch (card, id);
- card->values[id].save = card->values[id].cur;
- card->values[id].flags = VGA_VALUE_VALID | VGA_VALUE_SAVED;
- }
- }
-}
-
-void
-VgaRestore (VgaCard *card)
-{
- VgaSave *s;
- VGA16 id;
-
- for (s = card->saves; s->first != VGA_REG_NONE; s++)
- {
- for (id = s->first; id <= s->last; id++)
- {
- if (card->values[id].flags & VGA_VALUE_SAVED)
- {
- VgaStore (card, id, card->values[id].save);
- card->values[id].cur = card->values[id].save;
- }
- }
- }
-}
-
-void
-VgaFinish (VgaCard *card)
-{
- VGA16 id;
-
- for (id = 0; id < card->max; id++)
- card->values[id].flags = 0;
-}
-
-void
-VgaInvalidate (VgaCard *card)
-{
- VGA16 id;
-
- for (id = 0; id < card->max; id++)
- card->values[id].flags &= ~VGA_VALUE_VALID;
-}
-
-
-static void
-_VgaSync (VgaCard *card, VGA16 id)
-{
- if (!(card->values[id].flags & VGA_VALUE_VALID))
- {
- card->values[id].cur = VgaFetch (card, id);
- card->values[id].flags |= VGA_VALUE_VALID;
- }
-}
-
-void
-VgaSet (VgaCard *card, VgaReg *reg, VGA32 value)
-{
- VGA8 v, mask, new;
-
- while (reg->len)
- {
- if (reg->id != VGA_REG_NONE)
- {
- _VgaSync (card, reg->id);
- mask = ((1 << reg->len) - 1);
- new = value & mask;
- mask <<= reg->base;
- new <<= reg->base;
- v = card->values[reg->id].cur;
- v = (v & ~mask) | new;
- card->values[reg->id].cur = v;
- card->values[reg->id].flags |= VGA_VALUE_MODIFIED|VGA_VALUE_DIRTY;
- }
- value >>= reg->len;
- reg++;
- }
-}
-
-void
-VgaFlushReg (VgaCard *card, VgaReg *reg)
-{
- while (reg->len)
- {
- if (reg->id != VGA_REG_NONE)
- {
- if (card->values[reg->id].flags & VGA_VALUE_DIRTY)
- {
- VgaStore (card, reg->id, card->values[reg->id].cur);
- card->values[reg->id].flags &= ~VGA_VALUE_DIRTY;
- }
- }
- reg++;
- }
-
-}
-
-void
-VgaSetImm (VgaCard *card, VgaReg *reg, VGA32 value)
-{
- VgaSet (card, reg, value);
- VgaFlushReg (card, reg);
-}
-
-VGA32
-VgaGet (VgaCard *card, VgaReg *reg)
-{
- VGA32 value, offset, v;
- VGA8 mask;
-
- value = 0;
- offset = 0;
- while (reg->len)
- {
- if (reg->id != VGA_REG_NONE)
- {
- _VgaSync (card, reg->id);
- mask = ((1 << reg->len) - 1);
- v = (card->values[reg->id].cur >> reg->base) & mask;
- value |= (v << offset);
- }
- offset += reg->len;
- reg++;
- }
- return value;
-}
-
-VGA32
-VgaGetImm (VgaCard *card, VgaReg *reg)
-{
- VgaReg *r = reg;
-
- while (r->len)
- {
- if (r->id != VGA_REG_NONE)
- card->values[r->id].flags &= ~VGA_VALUE_VALID;
- r++;
- }
- return VgaGet (card, reg);
-}
-
-void
-VgaFlush (VgaCard *card)
-{
- VGA16 id;
-
- for (id = 0; id < card->max; id++)
- {
- if (card->values[id].flags & VGA_VALUE_DIRTY)
- {
- VgaStore (card, id, card->values[id].cur);
- card->values[id].flags &= ~VGA_VALUE_DIRTY;
- }
- }
-}
-
-void
-VgaFill (VgaCard *card, VGA16 low, VGA16 high)
-{
- VGA16 id;
-
- for (id = low; id < high; id++)
- _VgaSync (card, id);
-}
diff --git a/hw/kdrive/src/vga.h b/hw/kdrive/src/vga.h
deleted file mode 100644
index 5d7e77307..000000000
--- a/hw/kdrive/src/vga.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Id: vga.h,v 1.1 1999/11/02 03:54:46 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/vga.h,v 1.2 1999/12/30 03:03:07 robin Exp $ */
-
-#ifndef _VGA_H_
-#define _VGA_H_
-
-typedef unsigned long VGA32;
-typedef unsigned short VGA16;
-typedef unsigned char VGA8;
-typedef int VGABOOL;
-typedef volatile VGA8 VGAVOL8;
-
-#define VGATRUE 1
-#define VGAFALSE 0
-
-typedef struct _vgaReg {
- VGA16 id;
- VGA8 base;
- VGA8 len;
-} VgaReg;
-
-#define VGA_REG_NONE 0xffff
-#define VGA_REG_END VGA_REG_NONE, 0, 0
-
-typedef struct _vgaValue {
- VGA8 save;
- VGA8 cur;
- VGA16 flags;
-} VgaValue;
-
-#define VGA_VALUE_VALID 1 /* value ever fetched */
-#define VGA_VALUE_MODIFIED 2 /* value ever changed */
-#define VGA_VALUE_DIRTY 4 /* value needs syncing */
-#define VGA_VALUE_SAVED 8 /* value preserved */
-
-typedef enum _vgaAccess {
- VgaAccessMem, VgaAccessIo, VgaAccessIndMem, VgaAccessIndIo,
- VgaAccessDone
-} VgaAccess;
-
-typedef struct _vgaMap {
- VgaAccess access;
- VGA32 port;
- VGA8 addr; /* for Ind access; addr offset from port */
- VGA8 value; /* for Ind access; value offset from port */
- VGA8 index; /* for Ind access; index value */
-} VgaMap;
-
-#define VGA_UNLOCK_FIXED 1 /* dont save current value */
-#define VGA_UNLOCK_LOCK 2 /* execute only on relock */
-#define VGA_UNLOCK_UNLOCK 4 /* execute only on unlock */
-
-typedef struct _vgaSave {
- VGA16 first;
- VGA16 last;
-} VgaSave;
-
-#define VGA_SAVE_END VGA_REG_NONE, VGA_REG_NONE
-
-typedef struct _vgaCard {
- void (*map) (struct _vgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write);
- void *closure;
- int max;
- VgaValue *values;
- VgaSave *saves;
-} VgaCard;
-
-VGA8
-VgaInb (VGA16 r);
-
-void
-VgaOutb (VGA8 v, VGA16 r);
-
-VGA8
-VgaReadMemb (VGA32 addr);
-
-void
-VgaWriteMemb (VGA8 v, VGA32 addr);
-
-void
-VgaSetImm (VgaCard *card, VgaReg *reg, VGA32 value);
-
-VGA32
-VgaGetImm (VgaCard *card, VgaReg *reg);
-
-void
-VgaSet (VgaCard *card, VgaReg *reg, VGA32 value);
-
-VGA32
-VgaGet (VgaCard *card, VgaReg *reg);
-
-void
-VgaFlush (VgaCard *card);
-
-void
-VgaFill (VgaCard *card, VGA16 low, VGA16 high);
-
-void
-VgaPreserve (VgaCard *card);
-
-void
-VgaInvalidate (VgaCard *card);
-
-void
-VgaRestore (VgaCard *card);
-
-void
-VgaFinish (VgaCard *card);
-
-void
-VgaFlushReg (VgaCard *card, VgaReg *reg);
-
-VGA8
-VgaFetch (VgaCard *card, VGA16 id);
-
-void
-VgaStore (VgaCard *card, VGA16 id, VGA8 value);
-
-VGA8
-_VgaFetchInd (VGA16 port, VGA8 reg);
-
-void
-_VgaStoreInd (VGA16 port, VGA8 reg, VGA8 value);
-
-#endif /* _VGA_H_ */