aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/kdrive/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-25 20:12:58 +0000
committermarha <marha@users.sourceforge.net>2009-07-25 20:12:58 +0000
commit2553bdd7c359cd87525d367761c86932cec5adff (patch)
treeae71245933c98474a699d3e392de5820879b2018 /xorg-server/hw/kdrive/src
parente2c51f2ee7b0a3ea1a052fc49324057b4a4bbc78 (diff)
parent4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (diff)
downloadvcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.tar.gz
vcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.tar.bz2
vcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.zip
svn merge file:///D:/svnrepos/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/hw/kdrive/src')
-rw-r--r--xorg-server/hw/kdrive/src/Makefile.am16
-rw-r--r--xorg-server/hw/kdrive/src/Makefile.in112
-rw-r--r--xorg-server/hw/kdrive/src/kaa.c1081
-rw-r--r--xorg-server/hw/kdrive/src/kaa.h120
-rw-r--r--xorg-server/hw/kdrive/src/kaapict.c719
-rw-r--r--xorg-server/hw/kdrive/src/kasync.c341
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.c43
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.h287
-rw-r--r--xorg-server/hw/kdrive/src/kinfo.c6
-rw-r--r--xorg-server/hw/kdrive/src/kinput.c64
-rw-r--r--xorg-server/hw/kdrive/src/kmap.c6
-rw-r--r--xorg-server/hw/kdrive/src/knoop.c251
-rw-r--r--xorg-server/hw/kdrive/src/koffscreen.c375
-rw-r--r--xorg-server/hw/kdrive/src/ktest.c76
-rw-r--r--xorg-server/hw/kdrive/src/kxv.c48
-rw-r--r--xorg-server/hw/kdrive/src/kxv.h37
-rw-r--r--xorg-server/hw/kdrive/src/vga.c11
17 files changed, 93 insertions, 3500 deletions
diff --git a/xorg-server/hw/kdrive/src/Makefile.am b/xorg-server/hw/kdrive/src/Makefile.am
index 07ab8c859..792f64a4d 100644
--- a/xorg-server/hw/kdrive/src/Makefile.am
+++ b/xorg-server/hw/kdrive/src/Makefile.am
@@ -12,12 +12,14 @@ KDRIVE_HW_SOURCES = \
vga.h
endif
+if XV
+KDRIVE_XV_SOURCES = \
+ kxv.c \
+ kxv.h
+endif
+
libkdrive_a_SOURCES = \
fourcc.h \
- kaa.c \
- kaa.h \
- kaapict.c \
- kasync.c \
kcmap.c \
kcurscol.c \
kdrive.c \
@@ -27,12 +29,8 @@ libkdrive_a_SOURCES = \
kkeymap.c \
kmap.c \
kmode.c \
- knoop.c \
- koffscreen.c \
kshadow.c \
- ktest.c \
- kxv.c \
- kxv.h \
+ $(KDRIVE_XV_SOURCES) \
$(KDRIVE_HW_SOURCES) \
$(top_srcdir)/mi/miinitext.c
diff --git a/xorg-server/hw/kdrive/src/Makefile.in b/xorg-server/hw/kdrive/src/Makefile.in
index 4938456a5..3d0af42c7 100644
--- a/xorg-server/hw/kdrive/src/Makefile.in
+++ b/xorg-server/hw/kdrive/src/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -43,7 +43,6 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
$(top_builddir)/include/xorg-server.h \
$(top_builddir)/include/dix-config.h \
- $(top_builddir)/include/xgl-config.h \
$(top_builddir)/include/xorg-config.h \
$(top_builddir)/include/xkb-config.h \
$(top_builddir)/include/xwin-config.h \
@@ -53,17 +52,15 @@ LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
libkdrive_a_AR = $(AR) $(ARFLAGS)
libkdrive_a_LIBADD =
-am__libkdrive_a_SOURCES_DIST = fourcc.h kaa.c kaa.h kaapict.c kasync.c \
- kcmap.c kcurscol.c kdrive.c kdrive.h kinfo.c kinput.c \
- kkeymap.c kmap.c kmode.c knoop.c koffscreen.c kshadow.c \
- ktest.c kxv.c kxv.h vga.c vga.h $(top_srcdir)/mi/miinitext.c
-@KDRIVE_HW_TRUE@am__objects_1 = vga.$(OBJEXT)
-am_libkdrive_a_OBJECTS = kaa.$(OBJEXT) kaapict.$(OBJEXT) \
- kasync.$(OBJEXT) kcmap.$(OBJEXT) kcurscol.$(OBJEXT) \
+am__libkdrive_a_SOURCES_DIST = fourcc.h kcmap.c kcurscol.c kdrive.c \
+ kdrive.h kinfo.c kinput.c kkeymap.c kmap.c kmode.c kshadow.c \
+ kxv.c kxv.h vga.c vga.h $(top_srcdir)/mi/miinitext.c
+@XV_TRUE@am__objects_1 = kxv.$(OBJEXT)
+@KDRIVE_HW_TRUE@am__objects_2 = vga.$(OBJEXT)
+am_libkdrive_a_OBJECTS = kcmap.$(OBJEXT) kcurscol.$(OBJEXT) \
kdrive.$(OBJEXT) kinfo.$(OBJEXT) kinput.$(OBJEXT) \
kkeymap.$(OBJEXT) kmap.$(OBJEXT) kmode.$(OBJEXT) \
- knoop.$(OBJEXT) koffscreen.$(OBJEXT) kshadow.$(OBJEXT) \
- ktest.$(OBJEXT) kxv.$(OBJEXT) $(am__objects_1) \
+ kshadow.$(OBJEXT) $(am__objects_1) $(am__objects_2) \
miinitext.$(OBJEXT)
libkdrive_a_OBJECTS = $(am_libkdrive_a_OBJECTS)
libkdrivestubs_a_AR = $(AR) $(ARFLAGS)
@@ -75,9 +72,6 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
@@ -93,8 +87,9 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
-APPDEFAULTDIR = @APPDEFAULTDIR@
APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@
+APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@
APP_MAN_DIR = @APP_MAN_DIR@
APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
AR = @AR@
@@ -115,10 +110,6 @@ CFLAGS = @CFLAGS@
COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
@@ -140,6 +131,7 @@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DOLT_BASH = @DOLT_BASH@
DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
@@ -149,18 +141,15 @@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
DSYMUTIL = @DSYMUTIL@
DTRACE = @DTRACE@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
-FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
-FREETYPE_LIBS = @FREETYPE_LIBS@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GL_CFLAGS = @GL_CFLAGS@
@@ -179,7 +168,7 @@ KDRIVE_LIBS = @KDRIVE_LIBS@
KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
-LAUNCHD = @LAUNCHD@
+LD = @LD@
LDFLAGS = @LDFLAGS@
LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
LEX = @LEX@
@@ -193,7 +182,10 @@ LIBTOOL = @LIBTOOL@
LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LINUXDOC = @LINUXDOC@
+LIPO = @LIPO@
LN_S = @LN_S@
+LTCOMPILE = @LTCOMPILE@
+LTCXXCOMPILE = @LTCXXCOMPILE@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
@@ -205,8 +197,7 @@ MESA_SOURCE = @MESA_SOURCE@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
-MKFONTDIR = @MKFONTDIR@
-MKFONTSCALE = @MKFONTSCALE@
+NM = @NM@
NMEDIT = @NMEDIT@
OBJC = @OBJC@
OBJCCLD = @OBJCCLD@
@@ -215,8 +206,8 @@ OBJCFLAGS = @OBJCFLAGS@
OBJCLINK = @OBJCLINK@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -249,7 +240,6 @@ VENDOR_NAME = @VENDOR_NAME@
VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
VENDOR_RELEASE = @VENDOR_RELEASE@
VERSION = @VERSION@
-X11APP_ARCHS = @X11APP_ARCHS@
X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
XDMCP_CFLAGS = @XDMCP_CFLAGS@
@@ -259,27 +249,12 @@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
XDMX_CFLAGS = @XDMX_CFLAGS@
XDMX_LIBS = @XDMX_LIBS@
XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
-XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
-XEGL_LIBS = @XEGL_LIBS@
-XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
-XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
XEPHYR_INCS = @XEPHYR_INCS@
XEPHYR_LIBS = @XEPHYR_LIBS@
XF86CONFIGFILE = @XF86CONFIGFILE@
-XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
-XF86MISC_LIBS = @XF86MISC_LIBS@
XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
-XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
-XGLMODULES_LIBS = @XGLMODULES_LIBS@
-XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
-XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
-XGLX_LIBS = @XGLX_LIBS@
-XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
-XGL_LIBS = @XGL_LIBS@
-XGL_MODULE_PATH = @XGL_MODULE_PATH@
-XGL_SYS_LIBS = @XGL_SYS_LIBS@
XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
@@ -290,10 +265,6 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
XNEST_LIBS = @XNEST_LIBS@
XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
-XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
-XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
-XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
-XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
XORG_CFLAGS = @XORG_CFLAGS@
XORG_INCS = @XORG_INCS@
XORG_LIBS = @XORG_LIBS@
@@ -302,13 +273,8 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
XORG_OS = @XORG_OS@
XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
XORG_SYS_LIBS = @XORG_SYS_LIBS@
-XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
-XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
-XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
-XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
-XPRINT_CFLAGS = @XPRINT_CFLAGS@
-XPRINT_LIBS = @XPRINT_LIBS@
-XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@
+XPBPROXY_LIBS = @XPBPROXY_LIBS@
XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
XSDL_INCS = @XSDL_INCS@
@@ -341,8 +307,7 @@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -362,7 +327,6 @@ driverdir = @driverdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
extdir = @extdir@
-ft_config = @ft_config@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -372,12 +336,12 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-launchagentsdir = @launchagentsdir@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
logdir = @logdir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
moduledir = @moduledir@
@@ -395,8 +359,6 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-xglmoduledir = @xglmoduledir@
-xpconfigdir = @xpconfigdir@
INCLUDES = \
@KDRIVE_INCS@ \
@KDRIVE_CFLAGS@
@@ -407,12 +369,12 @@ noinst_LIBRARIES = libkdrive.a libkdrivestubs.a
@KDRIVE_HW_TRUE@ vga.c \
@KDRIVE_HW_TRUE@ vga.h
+@XV_TRUE@KDRIVE_XV_SOURCES = \
+@XV_TRUE@ kxv.c \
+@XV_TRUE@ kxv.h
+
libkdrive_a_SOURCES = \
fourcc.h \
- kaa.c \
- kaa.h \
- kaapict.c \
- kasync.c \
kcmap.c \
kcurscol.c \
kdrive.c \
@@ -422,12 +384,8 @@ libkdrive_a_SOURCES = \
kkeymap.c \
kmap.c \
kmode.c \
- knoop.c \
- koffscreen.c \
kshadow.c \
- ktest.c \
- kxv.c \
- kxv.h \
+ $(KDRIVE_XV_SOURCES) \
$(KDRIVE_HW_SOURCES) \
$(top_srcdir)/mi/miinitext.c
@@ -442,8 +400,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -486,9 +444,6 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap_mi.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kaa.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kaapict.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kasync.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kcmap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kcurscol.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kdrive.Po@am__quote@
@@ -497,10 +452,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kkeymap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmode.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/knoop.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/koffscreen.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kshadow.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ktest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kxv.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vga.Po@am__quote@
@@ -565,7 +517,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/xorg-server/hw/kdrive/src/kaa.c b/xorg-server/hw/kdrive/src/kaa.c
deleted file mode 100644
index db09e9dba..000000000
--- a/xorg-server/hw/kdrive/src/kaa.c
+++ /dev/null
@@ -1,1081 +0,0 @@
-/*
- * 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 <kdrive-config.h>
-#endif
-#include "kdrive.h"
-#include "kaa.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
-
-DevPrivateKey kaaScreenPrivateKey = &kaaScreenPrivateKey;
-DevPrivateKey kaaPixmapPrivateKey = &kaaPixmapPrivateKey;
-
-#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
-
- kaaWaitSync (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->pitchAlign - 1) &
- ~(pKaaScr->info->pitchAlign - 1);
-
- pKaaPixmap->devKind = pPixmap->devKind;
- pKaaPixmap->devPrivate = pPixmap->devPrivate;
- pKaaPixmap->area = KdOffscreenAlloc (pScreen, pitch * h,
- pKaaScr->info->offsetAlign,
- 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, (char *) src, src_pitch))
- return;
- }
-
- dst = pPixmap->devPrivate.ptr;
- dst_pitch = pPixmap->devKind;
-
- bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
-
- kaaWaitSync (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, unsigned usage_hint)
-{
- 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, usage_hint);
- 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);
- kaaMarkSync (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) ();
- kaaMarkSync (pDstDrawable->pScreen);
- }
- else
- {
- kaaWaitSync (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);
- kaaMarkSync (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))
- {
- kaaWaitSync (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);
- kaaMarkSync (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;
- }
-
- kaaWaitSync (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,
-};
-
-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) ();
- kaaMarkSync (pDrawable->pScreen);
- }
- else
- {
- kaaWaitSync (pDrawable->pScreen);
- fbFillRegionSolid (pDrawable, pRegion, 0,
- fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
- }
- kaaDrawableDirty (pDrawable);
-}
-
-Bool
-kaaDrawInit (ScreenPtr pScreen,
- KaaScreenInfoPtr pScreenInfo)
-{
- KaaScreenPrivPtr pKaaScr;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
-#ifdef RENDER
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-#endif
-
- pKaaScr = xalloc (sizeof (KaaScreenPrivRec));
-
- if (!pKaaScr)
- return FALSE;
-
- pKaaScr->info = pScreenInfo;
-
- dixSetPrivate(&pScreen->devPrivates, kaaScreenPrivateKey, pKaaScr);
-
- /*
- * Hook up asynchronous drawing
- */
- KdScreenInitAsync (pScreen);
- /*
- * Replace various fb screen functions
- */
- pScreen->CreateGC = kaaCreateGC;
- pScreen->CopyWindow = kaaCopyWindow;
-#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 (!dixRequestPrivate(kaaPixmapPrivateKey, sizeof (KaaPixmapPrivRec)))
- return FALSE;
- pScreen->CreatePixmap = kaaCreatePixmap;
- pScreen->DestroyPixmap = kaaDestroyPixmap;
- }
-
- return TRUE;
-}
-
-void
-kaaDrawFini (ScreenPtr pScreen)
-{
- KaaScreenPriv(pScreen);
-
- xfree (pKaaScr);
-}
-
-void
-kaaMarkSync (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KaaScreenPriv(pScreen);
-
- pScreenPriv->card->needSync = TRUE;
- if (pKaaScr->info->markSync != NULL) {
- pScreenPriv->card->lastMarker = (*pKaaScr->info->markSync) (pScreen);
- }
-}
-
-void
-kaaWaitSync (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KaaScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
-
- if (card->needSync) {
- (*pKaaScr->info->waitMarker) (pScreen, card->lastMarker);
- card->needSync = FALSE;
- }
-}
diff --git a/xorg-server/hw/kdrive/src/kaa.h b/xorg-server/hw/kdrive/src/kaa.h
deleted file mode 100644
index 90b963b10..000000000
--- a/xorg-server/hw/kdrive/src/kaa.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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_
-
-#include "picturestr.h"
-
-#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr) \
- dixLookupPrivate(&(s)->devPrivates, kaaScreenPrivateKey))
-#define KaaScreenPriv(s) KaaScreenPrivPtr pKaaScr = KaaGetScreenPriv(s)
-
-#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr) \
- dixLookupPrivate(&(p)->devPrivates, kaaPixmapPrivateKey))
-#define KaaSetPixmapPriv(p,a) \
- dixSetPrivate(&(p)->devPrivates, kaaPixmapPrivateKey, 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 DevPrivateKey kaaScreenPrivateKey;
-extern DevPrivateKey kaaPixmapPrivateKey;
-
-
-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
-kaaMarkSync (ScreenPtr pScreen);
-
-void
-kaaWaitSync (ScreenPtr 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);
-
-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/xorg-server/hw/kdrive/src/kaapict.c b/xorg-server/hw/kdrive/src/kaapict.c
deleted file mode 100644
index 501b6b9c4..000000000
--- a/xorg-server/hw/kdrive/src/kaapict.c
+++ /dev/null
@@ -1,719 +0,0 @@
-/*
- * 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 <kdrive-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)) {
- kaaWaitSync(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) ();
- kaaMarkSync (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) ();
- kaaMarkSync (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) ();
- kaaMarkSync (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 && pSrc->pDrawable)
- {
- if (op == PictOpSrc)
- {
- if (pScreenPriv->enabled && pSrc->pDrawable && 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 (pSrc->pDrawable && (!pMask || pMask->pDrawable) &&
- 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/xorg-server/hw/kdrive/src/kasync.c b/xorg-server/hw/kdrive/src/kasync.c
deleted file mode 100644
index 5388f217d..000000000
--- a/xorg-server/hw/kdrive/src/kasync.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * 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 <kdrive-config.h>
-#endif
-#include "kdrive.h"
-#include "kaa.h"
-#include "picturestr.h"
-#include "mipict.h"
-#include "fbpict.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)
-{
- kaaWaitSync (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)
-{
- kaaWaitSync (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)
-{
- kaaWaitSync (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)
-{
- kaaWaitSync (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)
-{
- kaaWaitSync (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)
-{
- kaaWaitSync (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) {
- kaaWaitSync(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) {
- kaaWaitSync(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) {
- kaaWaitSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- }
- fbPolyRectangle (pDrawable, pGC, nrects, prect);
-}
-
-void
-KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *pArcs)
-{
- if (pGC->lineWidth == 0)
- {
- kaaWaitSync(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)
-{
- kaaWaitSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbFillPolygon (pDrawable, pGC, mode, count, pPts);
-}
-#endif
-
-void
-KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrect, xRectangle *prect)
-{
- kaaWaitSync(pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbPolyFillRect (pDrawable, pGC, nrect, prect);
-}
-
-void
-KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *pArcs)
-{
- kaaWaitSync(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)
-{
- kaaWaitSync(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)
-{
- kaaWaitSync(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)
-{
- kaaWaitSync(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)
-{
- kaaWaitSync(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)
-{
- kaaWaitSync(pDrawable->pScreen);
- fbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
-}
-
-void
-KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- kaaWaitSync (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)
-{
- kaaWaitSync (pDrawable->pScreen);
- kaaDrawableDirty (pDrawable);
- fbOverlayPaintKey (pDrawable, pRegion, pixel, layer);
-}
-
-void
-KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- kaaWaitSync (pWin->drawable.pScreen);
- kaaDrawableDirty ((DrawablePtr)pWin);
- fbOverlayCopyWindow (pWin, ptOldOrg, prgnSrc);
-}
-#endif
-
-void
-KdScreenInitAsync (ScreenPtr pScreen)
-{
- pScreen->GetImage = KdCheckGetImage;
- pScreen->GetSpans = KdCheckGetSpans;
- pScreen->CopyWindow = KdCheckCopyWindow;
-#ifdef RENDER
- KdPictureInitAsync (pScreen);
-#endif
-}
-
-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)
-{
- kaaWaitSync (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)
-{
- kaaWaitSync (pMask->pDrawable->pScreen);
- kaaDrawableDirty (pMask->pDrawable);
- fbRasterizeTrapezoid (pMask, trap, x_off, y_off);
-}
-
-/*
- * 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
-};
-
-void
-KdPictureInitAsync (ScreenPtr pScreen)
-{
- PictureScreenPtr ps;
-
- ps = GetPictureScreen(pScreen);
- ps->Composite = KdCheckComposite;
- ps->RasterizeTrapezoid = KdCheckRasterizeTrapezoid;
-}
diff --git a/xorg-server/hw/kdrive/src/kdrive.c b/xorg-server/hw/kdrive/src/kdrive.c
index 3e739b8ec..41e0d496d 100644
--- a/xorg-server/hw/kdrive/src/kdrive.c
+++ b/xorg-server/hw/kdrive/src/kdrive.c
@@ -67,7 +67,8 @@ KdDepths kdDepths[] = {
#define KD_DEFAULT_BUTTONS 5
-DevPrivateKey kdScreenPrivateKey = &kdScreenPrivateKey;
+static int kdScreenPrivateKeyIndex;
+DevPrivateKey kdScreenPrivateKey = &kdScreenPrivateKeyIndex;
unsigned long kdGeneration;
Bool kdVideoTest;
@@ -75,7 +76,7 @@ unsigned long kdVideoTestTime;
Bool kdEmulateMiddleButton;
Bool kdRawPointerCoordinates;
Bool kdDisableZaphod;
-Bool kdDontZap;
+Bool kdAllowZap;
Bool kdEnabled;
int kdSubpixelOrder;
int kdVirtualTerminal = -1;
@@ -93,7 +94,6 @@ static Bool kdCaughtSignal = FALSE;
*/
KdOsFuncs *kdOsFuncs;
-extern WindowPtr *WindowTable;
void
KdSetRootClip (ScreenPtr pScreen, BOOL enable)
@@ -103,9 +103,6 @@ KdSetRootClip (ScreenPtr pScreen, BOOL enable)
Bool WasViewable;
Bool anyMarked = FALSE;
RegionPtr pOldClip = 0;
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
WindowPtr pLayerWin;
BoxRec box;
@@ -172,12 +169,6 @@ KdSetRootClip (ScreenPtr pScreen, BOOL enable)
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);
@@ -187,10 +178,6 @@ KdSetRootClip (ScreenPtr pScreen, BOOL enable)
{
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);
}
@@ -208,7 +195,6 @@ KdDisableScreen (ScreenPtr 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)
@@ -285,7 +271,6 @@ KdEnableScreen (ScreenPtr pScreen)
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)
@@ -584,7 +569,7 @@ KdUseMsg (void)
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("-switchCmd Command to execute on vt switch\n");
- ErrorF("-nozap Don't terminate server on Ctrl+Alt+Backspace\n");
+ ErrorF("-zap Terminate server on Ctrl+Alt+Backspace\n");
ErrorF("vtxx Use virtual terminal xx instead of the next available\n");
#ifdef PSEUDO8
p8UseMsg ();
@@ -630,9 +615,9 @@ KdProcessArgument (int argc, char **argv, int i)
kdDisableZaphod = TRUE;
return 1;
}
- if (!strcmp (argv[i], "-nozap"))
+ if (!strcmp (argv[i], "-zap"))
{
- kdDontZap = TRUE;
+ kdAllowZap = TRUE;
return 1;
}
if (!strcmp (argv[i], "-3button"))
@@ -756,10 +741,9 @@ KdAllocatePrivates (ScreenPtr pScreen)
if (kdGeneration != serverGeneration)
kdGeneration = serverGeneration;
- pScreenPriv = (KdPrivScreenPtr) xalloc(sizeof (*pScreenPriv));
+ pScreenPriv = xcalloc(1, sizeof (*pScreenPriv));
if (!pScreenPriv)
return FALSE;
- memset (pScreenPriv, '\0', sizeof (KdPrivScreenRec));
KdSetScreenPriv (pScreen, pScreenPriv);
return TRUE;
}
@@ -798,9 +782,6 @@ KdCloseScreen (int index, ScreenPtr 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);
@@ -1099,9 +1080,6 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
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);
@@ -1395,6 +1373,11 @@ KdInitOutput (ScreenInfo *pScreenInfo,
signal(SIGSEGV, KdBacktrace);
}
+void
+OsVendorFatalError(void)
+{
+}
+
#ifdef DPMSExtension
#ifndef _MSC_VER
int
@@ -1415,7 +1398,5 @@ DPMSSupported (void)
}
#endif
#endif
-
#ifndef _MSC_VER
-void ddxInitGlobals(void) { /* THANK YOU XPRINT */ }
#endif
diff --git a/xorg-server/hw/kdrive/src/kdrive.h b/xorg-server/hw/kdrive/src/kdrive.h
index 4e04b59f7..8e1998ef9 100644
--- a/xorg-server/hw/kdrive/src/kdrive.h
+++ b/xorg-server/hw/kdrive/src/kdrive.h
@@ -43,13 +43,12 @@
#include "fboverlay.h"
#include "shadow.h"
#include "randrstr.h"
+#include "globals.h"
#ifdef XKB
#include <X11/extensions/XKBstr.h>
#endif
-extern WindowPtr *WindowTable;
-
#define KD_DPMS_NORMAL 0
#define KD_DPMS_STANDBY 1
#define KD_DPMS_SUSPEND 2
@@ -114,30 +113,6 @@ typedef struct _KdFrameBuffer {
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)
@@ -205,8 +180,6 @@ typedef struct {
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 */
@@ -401,90 +374,6 @@ typedef struct _KdPointerMatrix {
int matrix[2][3];
} KdPointerMatrix;
-typedef struct _KaaTrapezoid {
- float tl, tr, ty;
- float bl, br, by;
-} KaaTrapezoid;
-
-typedef struct _KaaScreenInfo {
- int offsetAlign;
- int pitchAlign;
- int flags;
-
- int (*markSync) (ScreenPtr pScreen);
- void (*waitMarker) (ScreenPtr pScreen, int marker);
-
- 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);
-
- 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.
@@ -504,7 +393,7 @@ extern Bool kdEnabled;
extern Bool kdSwitchPending;
extern Bool kdEmulateMiddleButton;
extern Bool kdDisableZaphod;
-extern Bool kdDontZap;
+extern Bool kdAllowZap;
extern int kdVirtualTerminal;
extern char *kdSwitchCmd;
extern KdOsFuncs *kdOsFuncs;
@@ -515,119 +404,6 @@ extern KdOsFuncs *kdOsFuncs;
dixSetPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey, v)
#define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen)
-/* 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
-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;
@@ -921,32 +697,6 @@ KdRandRGetTiming (ScreenPtr pScreen,
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);
@@ -960,39 +710,6 @@ KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindow
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);
diff --git a/xorg-server/hw/kdrive/src/kinfo.c b/xorg-server/hw/kdrive/src/kinfo.c
index 2621f10dd..d592e6803 100644
--- a/xorg-server/hw/kdrive/src/kinfo.c
+++ b/xorg-server/hw/kdrive/src/kinfo.c
@@ -34,10 +34,9 @@ KdCardInfoAdd (KdCardFuncs *funcs,
{
KdCardInfo *ci, **prev;
- ci = (KdCardInfo *) xalloc (sizeof (KdCardInfo));
+ ci = xcalloc (1, sizeof (KdCardInfo));
if (!ci)
return 0;
- bzero (ci, sizeof (KdCardInfo));
for (prev = &kdCardInfo; *prev; prev = &(*prev)->next);
*prev = ci;
ci->cfuncs = funcs;
@@ -80,10 +79,9 @@ KdScreenInfoAdd (KdCardInfo *ci)
KdScreenInfo *si, **prev;
int n;
- si = (KdScreenInfo *) xalloc (sizeof (KdScreenInfo));
+ si = xcalloc (1, 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;
diff --git a/xorg-server/hw/kdrive/src/kinput.c b/xorg-server/hw/kdrive/src/kinput.c
index b1b04fa52..cef47c74e 100644
--- a/xorg-server/hw/kdrive/src/kinput.c
+++ b/xorg-server/hw/kdrive/src/kinput.c
@@ -65,7 +65,7 @@ static struct KdConfigDevice *kdConfigPointers = NULL;
static KdKeyboardDriver *kdKeyboardDrivers = NULL;
static KdPointerDriver *kdPointerDrivers = NULL;
-static xEvent *kdEvents = NULL;
+static EventListPtr kdEvents = NULL;
static Bool kdInputEnabled;
static Bool kdOffScreen;
@@ -458,7 +458,6 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
}
InitPointerDeviceStruct(pDev, pi->map, pi->nButtons,
- GetMotionHistory,
(PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), pi->nAxes);
@@ -1038,13 +1037,15 @@ KdAddKeyboard (KdKeyboardInfo *ki)
if (!ki)
return !Success;
- ki->dixdev = AddInputDevice(KdKeyboardProc, TRUE);
+ ki->dixdev = AddInputDevice(serverClient, KdKeyboardProc, TRUE);
if (!ki->dixdev) {
ErrorF("Couldn't register keyboard device %s\n",
ki->name ? ki->name : "(unnamed)");
return !Success;
}
+ ki->dixdev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
+ ki->dixdev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
RegisterOtherDevice(ki->dixdev);
#ifdef DEBUG
@@ -1107,13 +1108,15 @@ KdAddPointer (KdPointerInfo *pi)
pi->mouseState = start;
pi->eventHeld = FALSE;
- pi->dixdev = AddInputDevice(KdPointerProc, TRUE);
+ pi->dixdev = AddInputDevice(serverClient, KdPointerProc, TRUE);
if (!pi->dixdev) {
ErrorF("Couldn't add pointer device %s\n",
pi->name ? pi->name : "(unnamed)");
return BadDevice;
}
+ pi->dixdev->deviceGrab.ActivateGrab = ActivatePointerGrab;
+ pi->dixdev->deviceGrab.DeactivateGrab = DeactivatePointerGrab;
RegisterOtherDevice(pi->dixdev);
for (prev = &kdPointers; *prev; prev = &(*prev)->next);
@@ -1151,12 +1154,10 @@ KdGetOptions (InputOption **options, char *string)
InputOption *newopt = NULL, **tmpo = NULL;
int tam_key = 0;
- newopt = (InputOption *) xalloc(sizeof (InputOption));
+ newopt = xcalloc(1, sizeof (InputOption));
if (!newopt)
return FALSE;
- bzero(newopt, sizeof (InputOption));
-
for (tmpo = options; *tmpo; tmpo = &(*tmpo)->next)
; /* Hello, I'm here */
*tmpo = newopt;
@@ -1414,11 +1415,6 @@ KdInitInput (void)
ErrorF("Failed to add keyboard!\n");
}
- if (!kdEvents)
- kdEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
- if (!kdEvents)
- FatalError("Couldn't allocate event buffer\n");
-
mieqInit();
}
@@ -1767,7 +1763,7 @@ KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b)
return keyboard;
}
-#ifndef NDEBUG
+#ifdef DEBUG
char *kdStateNames[] = {
"start",
"button_1_pend",
@@ -1800,7 +1796,7 @@ char *kdActionNames[] = {
"gen_down_2",
"gen_up_2",
};
-#endif
+#endif /* DEBUG */
static void
KdQueueEvent (DeviceIntPtr pDev, xEvent *ev)
@@ -1952,11 +1948,11 @@ KdCheckSpecialKeys(KdKeyboardInfo *ki, int type, int 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)
+ if (kdAllowZap || party_like_its_1989)
dispatchException |= DE_TERMINATE;
break;
}
@@ -2007,9 +2003,10 @@ KdReleaseAllKeys (void)
key++) {
if (IsKeyDown(ki, key)) {
KdHandleKeyboardEvent(ki, KeyRelease, key);
+ GetEventList(&kdEvents);
nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key);
for (i = 0; i < nEvents; i++)
- KdQueueEvent (ki->dixdev, kdEvents + i);
+ KdQueueEvent (ki->dixdev, (kdEvents + i)->event);
}
}
}
@@ -2071,9 +2068,10 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
KdHandleKeyboardEvent(ki, type, key_code);
}
+ GetEventList(&kdEvents);
nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, type, key_code);
for (i = 0; i < nEvents; i++)
- KdQueueEvent(ki->dixdev, kdEvents + i);
+ KdQueueEvent(ki->dixdev, (kdEvents + i)->event);
}
else {
ErrorF("driver %s wanted to post scancode %d outside of [%d, %d]!\n",
@@ -2134,13 +2132,17 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
if (flags & KD_MOUSE_DELTA)
{
if (x || y || z)
+ {
dixflags = POINTER_RELATIVE | POINTER_ACCELERATE;
- } else if ((pi->dixdev->valuator) && (x != pi->dixdev->valuator->lastx ||
- y != pi->dixdev->valuator->lasty))
- dixflags = POINTER_ABSOLUTE;
-
- if (dixflags)
- _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE);
+ _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE);
+ }
+ } else
+ {
+ dixflags = POINTER_ABSOLUTE;
+ if (x != pi->dixdev->last.valuators[0] ||
+ y != pi->dixdev->last.valuators[1])
+ _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE);
+ }
buttons = flags;
@@ -2175,10 +2177,11 @@ _KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z,
if (!force && KdHandlePointerEvent(pi, type, x, y, z, b, absrel))
return;
- nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, 0, 3,
- valuators);
+ GetEventList(&kdEvents);
+ nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel,
+ 0, 3, valuators);
for (i = 0; i < nEvents; i++)
- KdQueueEvent(pi->dixdev, kdEvents + i);
+ KdQueueEvent(pi->dixdev, (kdEvents + i)->event);
}
void
@@ -2353,11 +2356,11 @@ KdCrossScreen(ScreenPtr pScreen, Bool entering)
int KdCurScreen; /* current event screen */
static void
-KdWarpCursor (ScreenPtr pScreen, int x, int y)
+KdWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
KdBlockSigio ();
KdCurScreen = pScreen->myNum;
- miPointerWarpCursor (pScreen, x, y);
+ miPointerWarpCursor(pDev, pScreen, x, y);
KdUnblockSigio ();
}
@@ -2373,7 +2376,7 @@ void
ProcessInputEvents ()
{
mieqProcessInputEvents();
- miPointerUpdate();
+ miPointerUpdateSprite(inputInfo.pointer);
if (kdSwitchPending)
KdProcessSwitch ();
KdCheckLock ();
@@ -2432,6 +2435,7 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev,
return Success;
case DEVICE_CORE:
+ return BadMatch;
case DEVICE_ENABLE:
return Success;
diff --git a/xorg-server/hw/kdrive/src/kmap.c b/xorg-server/hw/kdrive/src/kmap.c
index 0762e72af..a10c9ec09 100644
--- a/xorg-server/hw/kdrive/src/kmap.c
+++ b/xorg-server/hw/kdrive/src/kmap.c
@@ -82,9 +82,6 @@ KdMapDevice (CARD32 addr, CARD32 size)
strerror (errno));
return a;
#endif
-#ifdef VXWORKS
- return (void *) addr;
-#endif
}
void
@@ -97,9 +94,6 @@ KdUnmapDevice (void *addr, CARD32 size)
#ifdef linux
munmap (addr, size);
#endif
-#ifdef VXWORKS
- ;
-#endif
}
#ifdef HAVE_ASM_MTRR_H
diff --git a/xorg-server/hw/kdrive/src/knoop.c b/xorg-server/hw/kdrive/src/knoop.c
deleted file mode 100644
index a3e9468ed..000000000
--- a/xorg-server/hw/kdrive/src/knoop.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * GC ops that don't do anything
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-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 */
-};
diff --git a/xorg-server/hw/kdrive/src/koffscreen.c b/xorg-server/hw/kdrive/src/koffscreen.c
deleted file mode 100644
index efe03642f..000000000
--- a/xorg-server/hw/kdrive/src/koffscreen.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- * 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 <kdrive-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->offset + prev->size == area->offset);
-
- prev = area;
- }
- assert (prev->offset + prev->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;
- {
- int tmp = area->offset % align;
- if (tmp)
- area->offset += (align - tmp);
- }
-
- 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/xorg-server/hw/kdrive/src/ktest.c b/xorg-server/hw/kdrive/src/ktest.c
deleted file mode 100644
index 150af5639..000000000
--- a/xorg-server/hw/kdrive/src/ktest.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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 <kdrive-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/xorg-server/hw/kdrive/src/kxv.c b/xorg-server/hw/kdrive/src/kxv.c
index 0b8d1c4e0..9a74654af 100644
--- a/xorg-server/hw/kdrive/src/kxv.c
+++ b/xorg-server/hw/kdrive/src/kxv.c
@@ -103,9 +103,10 @@ static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
/* misc */
static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr*, int);
-
-DevPrivateKey KdXVWindowKey = &KdXVWindowKey;
-DevPrivateKey KdXvScreenKey = &KdXvScreenKey;
+static int KdXVWindowKeyIndex;
+DevPrivateKey KdXVWindowKey = &KdXVWindowKeyIndex;
+static int KdXvScreenKeyIndex;
+DevPrivateKey KdXvScreenKey = &KdXvScreenKeyIndex;
static unsigned long KdXVGeneration = 0;
static unsigned long PortResource = 0;
@@ -1728,47 +1729,6 @@ KdXVQueryImageAttributes(
}
-/**************** 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
diff --git a/xorg-server/hw/kdrive/src/kxv.h b/xorg-server/hw/kdrive/src/kxv.h
index 5d1441642..900baefde 100644
--- a/xorg-server/hw/kdrive/src/kxv.h
+++ b/xorg-server/hw/kdrive/src/kxv.h
@@ -186,30 +186,6 @@ typedef struct {
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,
@@ -231,19 +207,6 @@ KdXVListGenericAdaptors(
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,
diff --git a/xorg-server/hw/kdrive/src/vga.c b/xorg-server/hw/kdrive/src/vga.c
index 862f074a2..5a0a9678c 100644
--- a/xorg-server/hw/kdrive/src/vga.c
+++ b/xorg-server/hw/kdrive/src/vga.c
@@ -43,17 +43,6 @@
#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