sync code with last improvements from OpenBSD
This commit is contained in:
commit
88965415ff
26235 changed files with 29195616 additions and 0 deletions
47
driver/xf86-video-apm/src/Makefile.am
Normal file
47
driver/xf86-video-apm/src/Makefile.am
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Copyright 2005 Adam Jackson.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
# license, and/or sell copies of the Software, and to permit persons to whom
|
||||
# the Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice (including the next
|
||||
# paragraph) shall be included in all copies or substantial portions of the
|
||||
# Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
# this is obnoxious:
|
||||
# -module lets us name the module exactly how we want
|
||||
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
|
||||
# _ladir passes a dummy rpath to libtool so the thing will actually link
|
||||
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
|
||||
|
||||
AM_CFLAGS = $(XORG_CFLAGS) $(PCIACCESS_CFLAGS)
|
||||
|
||||
apm_drv_la_LTLIBRARIES = apm_drv.la
|
||||
apm_drv_la_LDFLAGS = -module -avoid-version
|
||||
apm_drv_ladir = @moduledir@/drivers
|
||||
|
||||
apm_drv_la_SOURCES = \
|
||||
compat-api.h \
|
||||
apm_accel.c \
|
||||
apm_cursor.c \
|
||||
apm_dga.c \
|
||||
apm_driver.c \
|
||||
apm.h \
|
||||
apm_i2c.c \
|
||||
apm_regs.h \
|
||||
apm_pcirename.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
apm_funcs.c \
|
||||
apm_video.c
|
672
driver/xf86-video-apm/src/Makefile.in
Normal file
672
driver/xf86-video-apm/src/Makefile.in
Normal file
|
@ -0,0 +1,672 @@
|
|||
# Makefile.in generated by automake 1.12.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
# Copyright 2005 Adam Jackson.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
# license, and/or sell copies of the Software, and to permit persons to whom
|
||||
# the Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice (including the next
|
||||
# paragraph) shall be included in all copies or substantial portions of the
|
||||
# Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# this is obnoxious:
|
||||
# -module lets us name the module exactly how we want
|
||||
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
|
||||
# _ladir passes a dummy rpath to libtool so the thing will actually link
|
||||
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
$(top_srcdir)/depcomp
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(apm_drv_ladir)"
|
||||
LTLIBRARIES = $(apm_drv_la_LTLIBRARIES)
|
||||
apm_drv_la_LIBADD =
|
||||
am_apm_drv_la_OBJECTS = apm_accel.lo apm_cursor.lo apm_dga.lo \
|
||||
apm_driver.lo apm_i2c.lo
|
||||
apm_drv_la_OBJECTS = $(am_apm_drv_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
apm_drv_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(apm_drv_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(apm_drv_la_SOURCES)
|
||||
DIST_SOURCES = $(apm_drv_la_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
|
||||
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
APP_MAN_DIR = @APP_MAN_DIR@
|
||||
APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BASE_CFLAGS = @BASE_CFLAGS@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CHANGELOG_CMD = @CHANGELOG_CMD@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CWARNFLAGS = @CWARNFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
|
||||
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
|
||||
DRIVER_NAME = @DRIVER_NAME@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
FILE_MAN_DIR = @FILE_MAN_DIR@
|
||||
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_CMD = @INSTALL_CMD@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIB_MAN_DIR = @LIB_MAN_DIR@
|
||||
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MAN_SUBSTS = @MAN_SUBSTS@
|
||||
MISC_MAN_DIR = @MISC_MAN_DIR@
|
||||
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
|
||||
PCIACCESS_LIBS = @PCIACCESS_LIBS@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRICT_CFLAGS = @STRICT_CFLAGS@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
XEXT_CFLAGS = @XEXT_CFLAGS@
|
||||
XEXT_LIBS = @XEXT_LIBS@
|
||||
XORG_CFLAGS = @XORG_CFLAGS@
|
||||
XORG_LIBS = @XORG_LIBS@
|
||||
XORG_MAN_PAGE = @XORG_MAN_PAGE@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
moduledir = @moduledir@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AM_CFLAGS = $(XORG_CFLAGS) $(PCIACCESS_CFLAGS)
|
||||
apm_drv_la_LTLIBRARIES = apm_drv.la
|
||||
apm_drv_la_LDFLAGS = -module -avoid-version
|
||||
apm_drv_ladir = @moduledir@/drivers
|
||||
apm_drv_la_SOURCES = \
|
||||
compat-api.h \
|
||||
apm_accel.c \
|
||||
apm_cursor.c \
|
||||
apm_dga.c \
|
||||
apm_driver.c \
|
||||
apm.h \
|
||||
apm_i2c.c \
|
||||
apm_regs.h \
|
||||
apm_pcirename.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
apm_funcs.c \
|
||||
apm_video.c
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign src/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-apm_drv_laLTLIBRARIES: $(apm_drv_la_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(apm_drv_la_LTLIBRARIES)'; test -n "$(apm_drv_ladir)" || list=; \
|
||||
list2=; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
list2="$$list2 $$p"; \
|
||||
else :; fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(apm_drv_ladir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(apm_drv_ladir)" || exit 1; \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(apm_drv_ladir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(apm_drv_ladir)"; \
|
||||
}
|
||||
|
||||
uninstall-apm_drv_laLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(apm_drv_la_LTLIBRARIES)'; test -n "$(apm_drv_ladir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(apm_drv_ladir)/$$f'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(apm_drv_ladir)/$$f"; \
|
||||
done
|
||||
|
||||
clean-apm_drv_laLTLIBRARIES:
|
||||
-test -z "$(apm_drv_la_LTLIBRARIES)" || rm -f $(apm_drv_la_LTLIBRARIES)
|
||||
@list='$(apm_drv_la_LTLIBRARIES)'; \
|
||||
locs=`for p in $$list; do echo $$p; done | \
|
||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
||||
sort -u`; \
|
||||
test -z "$$locs" || { \
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
apm_drv.la: $(apm_drv_la_OBJECTS) $(apm_drv_la_DEPENDENCIES) $(EXTRA_apm_drv_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(apm_drv_la_LINK) -rpath $(apm_drv_ladir) $(apm_drv_la_OBJECTS) $(apm_drv_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apm_accel.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apm_cursor.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apm_dga.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apm_driver.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apm_i2c.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(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; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(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; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(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; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
cscopelist: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(apm_drv_ladir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-apm_drv_laLTLIBRARIES clean-generic clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-apm_drv_laLTLIBRARIES
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-apm_drv_laLTLIBRARIES
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean \
|
||||
clean-apm_drv_laLTLIBRARIES clean-generic clean-libtool \
|
||||
cscopelist ctags distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am \
|
||||
install-apm_drv_laLTLIBRARIES install-data install-data-am \
|
||||
install-dvi install-dvi-am install-exec install-exec-am \
|
||||
install-html install-html-am install-info install-info-am \
|
||||
install-man install-pdf install-pdf-am install-ps \
|
||||
install-ps-am install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-apm_drv_laLTLIBRARIES
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
238
driver/xf86-video-apm/src/apm.h
Normal file
238
driver/xf86-video-apm/src/apm.h
Normal file
|
@ -0,0 +1,238 @@
|
|||
|
||||
#include "apm_pcirename.h"
|
||||
#include <string.h>
|
||||
|
||||
/* All drivers should typically include these */
|
||||
#include "xf86.h"
|
||||
#include "xf86_OSproc.h"
|
||||
|
||||
/* All drivers need this */
|
||||
|
||||
/* Everything using inb/outb, etc needs "compiler.h" */
|
||||
#include "compiler.h"
|
||||
|
||||
/* Drivers that need to access the PCI config space directly need this */
|
||||
#include "xf86Pci.h"
|
||||
|
||||
/* All drivers using the vgahw module need this */
|
||||
#include "vgaHW.h"
|
||||
|
||||
/* All drivers using the mi colormap manipulation need this */
|
||||
#include "micmap.h"
|
||||
|
||||
#include "fb.h"
|
||||
|
||||
/* Drivers using the XAA interface ... */
|
||||
#ifdef HAVE_XAA_H
|
||||
#include "xaa.h"
|
||||
#include "xaalocal.h"
|
||||
#endif
|
||||
#include "xf86Cursor.h"
|
||||
#include "xf86fbman.h"
|
||||
|
||||
/* All drivers initialising the SW cursor need this */
|
||||
#include "mipointer.h"
|
||||
|
||||
/* I2C support */
|
||||
#include "xf86i2c.h"
|
||||
|
||||
/* DDC support */
|
||||
#include "xf86DDC.h"
|
||||
|
||||
#include "xf86xv.h"
|
||||
#include <X11/extensions/Xv.h>
|
||||
|
||||
#include "compat-api.h"
|
||||
#ifdef TRUE
|
||||
#undef TRUE
|
||||
#endif
|
||||
#define TRUE (1)
|
||||
|
||||
#define rdinx(port, ind) (outb((port), (ind)), inb((port) + 1))
|
||||
#define wrinx(port, ind, val) outb((port), (ind)), outb((port) + 1, (val))
|
||||
#define modinx(port, ind, mask, bits) \
|
||||
do { \
|
||||
unsigned char tmp; \
|
||||
tmp = (rdinx((port), (ind)) & ~(mask)) | ((bits) & (mask)); \
|
||||
wrinx((port), (ind), tmp); \
|
||||
} while(0)
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
#define NoSEQRegs 0x20
|
||||
#define NoCRTRegs 0x1F
|
||||
#define NoGRCRegs 0x09
|
||||
#define NoATCRegs 0x15
|
||||
|
||||
enum {
|
||||
XR80, XRC0, XRD0, XRE0, XRE8, XREC, XR140, XR144, XR148, XR14C, NoEXRegs
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
unsigned char SEQ[NoSEQRegs];
|
||||
unsigned char CRT[NoCRTRegs];
|
||||
unsigned char GRC[NoGRCRegs];
|
||||
unsigned char ATC[NoATCRegs];
|
||||
unsigned int EX[NoEXRegs];
|
||||
} ApmRegStr, *ApmRegPtr;
|
||||
|
||||
typedef struct {
|
||||
int displayWidth, displayHeight;
|
||||
int bitsPerPixel, bytesPerScanline;
|
||||
int depth, Scanlines;
|
||||
CARD32 mask32; /* Mask to have 32bit aligned data */
|
||||
unsigned int Setup_DEC;
|
||||
DisplayModePtr pMode;
|
||||
} ApmFBLayout;
|
||||
|
||||
#define APM_CACHE_NUMBER 32
|
||||
|
||||
typedef struct {
|
||||
pciVideoPtr PciInfo;
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
PCITAG PciTag;
|
||||
#endif
|
||||
int scrnIndex;
|
||||
int Chipset;
|
||||
int ChipRev;
|
||||
CARD32 LinAddress;
|
||||
unsigned long LinMapSize;
|
||||
CARD32 FbMapSize;
|
||||
pointer LinMap;
|
||||
pointer FbBase;
|
||||
char *VGAMap;
|
||||
char *MemMap;
|
||||
pointer BltMap;
|
||||
Bool UnlockCalled;
|
||||
unsigned long iobase, xport, xbase;
|
||||
unsigned char savedSR10;
|
||||
CARD8 MiscOut;
|
||||
CARD8 c9, d9, db, Rush;
|
||||
unsigned int saveCmd;
|
||||
pointer FontInfo;
|
||||
Bool hwCursor;
|
||||
ApmRegStr ModeReg, SavedReg;
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
Bool UsePCIRetry; /* Do we use PCI-retry or busy-waiting */
|
||||
Bool NoAccel; /* Do we use XAA acceleration architecture */
|
||||
int MinClock; /* Min ramdac clock */
|
||||
int MaxClock; /* Max ramdac clock */
|
||||
ApmFBLayout CurrentLayout, SavedLayout;
|
||||
EntityInfoPtr pEnt;
|
||||
#ifdef HAVE_XAA_H
|
||||
XAAInfoRecPtr AccelInfoRec, DGAXAAInfo;
|
||||
#endif
|
||||
xf86CursorInfoPtr CursorInfoRec;
|
||||
int DGAactive, numDGAModes;
|
||||
DGAModePtr DGAModes;
|
||||
int BaseCursorAddress,CursorAddress,DisplayedCursorAddress;
|
||||
int OffscreenReserved;
|
||||
int blitxdir, blitydir;
|
||||
Bool apmTransparency, apmClip, ShadowFB, I2C;
|
||||
int rop, Bg8x8, Fg8x8;
|
||||
I2CBusPtr I2CPtr;
|
||||
#ifdef HAVE_XAA_H
|
||||
struct ApmStippleCacheRec {
|
||||
XAACacheInfoRec apmStippleCache;
|
||||
FBAreaPtr area;
|
||||
unsigned int apmStippleCached:1;
|
||||
} apmCache[APM_CACHE_NUMBER];
|
||||
#endif
|
||||
int apmCachePtr;
|
||||
unsigned char regcurr[0x54];
|
||||
ScreenPtr pScreen;
|
||||
int Generation;
|
||||
int apmLock, pixelStride, RushY[7], CopyMode;
|
||||
int PutImageStride;
|
||||
Bool (*DestroyPixmap)(PixmapPtr);
|
||||
PixmapPtr (*CreatePixmap)(ScreenPtr, int, int, int);
|
||||
void (*SetupForSolidFill)(ScrnInfoPtr pScrn, int color, int rop,
|
||||
unsigned int planemask);
|
||||
void (*SubsequentSolidFillRect)(ScrnInfoPtr pScrn, int x, int y,
|
||||
int w, int h);
|
||||
void (*SetupForSolidFill24)(ScrnInfoPtr pScrn, int color, int rop,
|
||||
unsigned int planemask);
|
||||
void (*SubsequentSolidFillRect24)(ScrnInfoPtr pScrn, int x, int y,
|
||||
int w, int h);
|
||||
void (*SetupForScreenToScreenCopy)(ScrnInfoPtr pScrn, int xdir, int ydir,
|
||||
int rop, unsigned int planemask,
|
||||
int transparency_color);
|
||||
void (*SubsequentScreenToScreenCopy)(ScrnInfoPtr pScrn, int x1, int y1,
|
||||
int x2, int y2, int w, int h);
|
||||
void (*SetupForScreenToScreenCopy24)(ScrnInfoPtr pScrn, int xdir, int ydir,
|
||||
int rop, unsigned int planemask,
|
||||
int transparency_color);
|
||||
void (*SubsequentScreenToScreenCopy24)(ScrnInfoPtr pScrn, int x1, int y1,
|
||||
int x2, int y2, int w, int h);
|
||||
int MemClk;
|
||||
unsigned char *ShadowPtr;
|
||||
int ShadowPitch;
|
||||
memType ScratchMem, ScratchMemSize, ScratchMemOffset;
|
||||
memType ScratchMemPtr, ScratchMemEnd;
|
||||
int ScratchMemWidth;
|
||||
CARD32 color;
|
||||
XF86VideoAdaptorPtr adaptor;
|
||||
int timerIsOn;
|
||||
Time offTime;
|
||||
OptionInfoPtr Options;
|
||||
char DPMSMask[4];
|
||||
} ApmRec, *ApmPtr;
|
||||
|
||||
#define curr ((unsigned char *)pApm->regcurr)
|
||||
|
||||
typedef struct {
|
||||
u16 ca;
|
||||
u8 font;
|
||||
u8 pad;
|
||||
} ApmFontBuf;
|
||||
|
||||
typedef struct {
|
||||
u16 ca;
|
||||
u8 font;
|
||||
u8 pad;
|
||||
u16 ca2;
|
||||
u8 font2;
|
||||
u8 pad2;
|
||||
} ApmTextBuf;
|
||||
|
||||
enum ApmChipId {
|
||||
AP6422 = 0x6422,
|
||||
AT24 = 0x6424,
|
||||
AT3D = 0x643D
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
BoxRec box;
|
||||
int num;
|
||||
MoveAreaCallbackProcPtr MoveAreaCallback;
|
||||
RemoveAreaCallbackProcPtr RemoveAreaCallback;
|
||||
void *devPriv;
|
||||
} ApmPixmapRec, *ApmPixmapPtr;
|
||||
|
||||
#define APMDECL(p) ApmPtr pApm = ((ApmPtr)(((ScrnInfoPtr)(p))->driverPrivate))
|
||||
#define APMPTR(p) ((ApmPtr)(((ScrnInfoPtr)(p))->driverPrivate))
|
||||
|
||||
extern int ApmHWCursorInit(ScreenPtr pScreen);
|
||||
extern int ApmDGAInit(ScreenPtr pScreen);
|
||||
extern int ApmAccelInit(ScreenPtr pScreen);
|
||||
extern Bool ApmI2CInit(ScrnInfoPtr pScrn);
|
||||
extern void XFree86RushExtensionInit(ScreenPtr pScreen);
|
||||
extern void ApmInitVideo(ScreenPtr pScreen);
|
||||
extern void ApmInitVideo_IOP(ScreenPtr pScreen);
|
||||
#ifdef HAVE_XAA_H
|
||||
extern void ApmSetupXAAInfo(ApmPtr pApm, XAAInfoRecPtr pXAAinfo);
|
||||
#endif
|
||||
extern Bool ApmSwitchMode(SWITCH_MODE_ARGS_DECL);
|
||||
extern void ApmAdjustFrame(ADJUST_FRAME_ARGS_DECL);
|
||||
extern void ApmHWCursorReserveSpace(ApmPtr pApm);
|
||||
extern void ApmAccelReserveSpace(ApmPtr pApm);
|
||||
|
||||
#ifdef XF86RUSH
|
||||
extern int ApmPixmapIndex;
|
||||
#define APM_GET_PIXMAP_PRIVATE(pix)\
|
||||
((ApmPixmapPtr)(((PixmapPtr)(pix))->devPrivates[ApmPixmapIndex].ptr))
|
||||
#endif
|
||||
|
||||
#include "apm_regs.h"
|
567
driver/xf86-video-apm/src/apm_accel.c
Normal file
567
driver/xf86-video-apm/src/apm_accel.c
Normal file
|
@ -0,0 +1,567 @@
|
|||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "apm.h"
|
||||
#include "miline.h"
|
||||
|
||||
#ifdef HAVE_XAA_H
|
||||
/* Defines */
|
||||
#define MAXLOOP 1000000
|
||||
|
||||
/* Translation from X ROP's to APM ROP's. */
|
||||
static unsigned char apmROP[] = {
|
||||
0,
|
||||
0x88,
|
||||
0x44,
|
||||
0xCC,
|
||||
0x22,
|
||||
0xAA,
|
||||
0x66,
|
||||
0xEE,
|
||||
0x11,
|
||||
0x99,
|
||||
0x55,
|
||||
0xDD,
|
||||
0x33,
|
||||
0xBB,
|
||||
0x77,
|
||||
0xFF
|
||||
};
|
||||
|
||||
|
||||
#include "apm_funcs.c"
|
||||
|
||||
#define PSZ 24
|
||||
#include "apm_funcs.c"
|
||||
|
||||
static void
|
||||
ApmRemoveStipple(FBAreaPtr area)
|
||||
{
|
||||
((struct ApmStippleCacheRec *)area->devPrivate.ptr)->apmStippleCached = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
ApmMoveStipple(FBAreaPtr from, FBAreaPtr to)
|
||||
{
|
||||
struct ApmStippleCacheRec *pApm = (struct ApmStippleCacheRec *)to->devPrivate.ptr;
|
||||
|
||||
pApm->apmStippleCache.x = to->box.x1;
|
||||
pApm->apmStippleCache.y += to->box.y1 - from->box.y1;
|
||||
/* TODO : move data */
|
||||
}
|
||||
|
||||
/*
|
||||
* ApmCacheMonoStipple
|
||||
* because my poor AT3D needs stipples stored linearly in memory.
|
||||
*/
|
||||
static XAACacheInfoPtr
|
||||
ApmCacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
int w = pPix->drawable.width, W = (w + 31) & ~31;
|
||||
int h = pPix->drawable.height;
|
||||
int i, j, dwords, mem, width, funcNo;
|
||||
FBAreaPtr draw;
|
||||
struct ApmStippleCacheRec *pCache;
|
||||
unsigned char *srcPtr;
|
||||
CARD32 *dstPtr;
|
||||
static StippleScanlineProcPtr *StippleTab = NULL;
|
||||
|
||||
if (!StippleTab)
|
||||
StippleTab = XAAGetStippleScanlineFuncMSBFirst();
|
||||
|
||||
for (i = 0; i < APM_CACHE_NUMBER; i++)
|
||||
if ((pApm->apmCache[i].apmStippleCache.serialNumber == pPix->drawable.serialNumber)
|
||||
&& pApm->apmCache[i].apmStippleCached &&
|
||||
(pApm->apmCache[i].apmStippleCache.fg == -1) &&
|
||||
(pApm->apmCache[i].apmStippleCache.bg == -1)) {
|
||||
pApm->apmCache[i].apmStippleCache.trans_color = -1;
|
||||
return &pApm->apmCache[i].apmStippleCache;
|
||||
}
|
||||
if ((i = ++pApm->apmCachePtr) >= APM_CACHE_NUMBER)
|
||||
i = pApm->apmCachePtr = 0;
|
||||
pCache = &pApm->apmCache[i];
|
||||
if (pCache->apmStippleCached) {
|
||||
pCache->apmStippleCached = FALSE;
|
||||
xf86FreeOffscreenArea(pCache->area);
|
||||
}
|
||||
|
||||
draw = xf86AllocateLinearOffscreenArea(pApm->pScreen, (W * h + 7) / 8,
|
||||
(pApm->CurrentLayout.mask32 + 1) << 1,
|
||||
ApmMoveStipple, ApmRemoveStipple, pCache);
|
||||
if (!draw)
|
||||
return NULL; /* Let's hope this will never happen... */
|
||||
|
||||
pCache->area = draw;
|
||||
pCache->apmStippleCache.serialNumber = pPix->drawable.serialNumber;
|
||||
pCache->apmStippleCache.trans_color =
|
||||
pCache->apmStippleCache.bg =
|
||||
pCache->apmStippleCache.fg = -1;
|
||||
pCache->apmStippleCache.orig_w = w;
|
||||
pCache->apmStippleCache.orig_h = h;
|
||||
pCache->apmStippleCache.x = draw->box.x1;
|
||||
pCache->apmStippleCache.y = draw->box.y1 + ((pCache - pApm->apmCache) + 1) * pApm->CurrentLayout.Scanlines;
|
||||
mem = ((draw->box.x2 - draw->box.x1) * (draw->box.y2 - draw->box.y1) *
|
||||
pScrn->bitsPerPixel) / (W * h);
|
||||
width = 2;
|
||||
while (width * width <= mem)
|
||||
width++;
|
||||
width--;
|
||||
pCache->apmStippleCache.w = (width * W + pScrn->bitsPerPixel - 1) /
|
||||
pScrn->bitsPerPixel;
|
||||
pCache->apmStippleCache.h = ((draw->box.x2 - draw->box.x1) *
|
||||
(draw->box.y2 - draw->box.y1)) /
|
||||
pCache->apmStippleCache.w;
|
||||
pCache->apmStippleCached = TRUE;
|
||||
|
||||
if (w < 32) {
|
||||
if (w & (w - 1)) funcNo = 1;
|
||||
else funcNo = 0;
|
||||
} else funcNo = 2;
|
||||
|
||||
dstPtr = ((CARD32 *)pApm->FbBase) + (draw->box.x1 +
|
||||
draw->box.y1*pApm->CurrentLayout.bytesPerScanline) / 4;
|
||||
j = 0;
|
||||
dwords = (pCache->apmStippleCache.w * pScrn->bitsPerPixel) / 32;
|
||||
while (j + h <= pCache->apmStippleCache.h) {
|
||||
srcPtr = (unsigned char *)pPix->devPrivate.ptr;
|
||||
for (i = h; --i >= 0; ) {
|
||||
StippleTab[funcNo](dstPtr, (CARD32 *)srcPtr, 0, w, dwords);
|
||||
srcPtr += pPix->devKind;
|
||||
dstPtr += dwords;
|
||||
}
|
||||
j += h;
|
||||
}
|
||||
srcPtr = (unsigned char *)pPix->devPrivate.ptr;
|
||||
for (i = pCache->apmStippleCache.h - j ; --i >= 0; ) {
|
||||
StippleTab[funcNo](dstPtr, (CARD32 *)srcPtr, 0, w, dwords);
|
||||
srcPtr += pPix->devKind;
|
||||
dstPtr += dwords;
|
||||
}
|
||||
|
||||
return &pCache->apmStippleCache;
|
||||
}
|
||||
|
||||
#if 0
|
||||
extern GCOps XAAPixmapOps;
|
||||
static RegionPtr (*SaveCopyAreaPixmap)(DrawablePtr, DrawablePtr, GC *, int, int, int, int, int, int);
|
||||
|
||||
static RegionPtr
|
||||
ApmCopyAreaPixmap(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC,
|
||||
int srcx, int srcy,
|
||||
int width, int height,
|
||||
int dstx, int dsty )
|
||||
{
|
||||
register int Scanlines;
|
||||
int is;
|
||||
int id;
|
||||
int sx = 0, sy = 0, dx = 0, dy = 0, pitch;
|
||||
RegionPtr pReg;
|
||||
|
||||
if (APMPTR(xf86Screens[(pGC)->pScreen->myNum])->Chipset == AT3D) {
|
||||
Scanlines = APMPTR(xf86Screens[(pGC)->pScreen->myNum])->CurrentLayout.Scanlines;
|
||||
is = (pSrcDrawable->type == DRAWABLE_PIXMAP) ? APM_GET_PIXMAP_PRIVATE(pSrcDrawable)->num : 0;
|
||||
id = (pDstDrawable->type == DRAWABLE_PIXMAP) ? APM_GET_PIXMAP_PRIVATE(pDstDrawable)->num : 0;
|
||||
if (is) {
|
||||
sx = pSrcDrawable->x;
|
||||
sy = pSrcDrawable->y % Scanlines;
|
||||
pitch = 2 * pSrcDrawable->width;
|
||||
pSrcDrawable->x = (sx + ((PixmapPtr)pSrcDrawable)->devKind * sy) % pitch;
|
||||
pSrcDrawable->y = (sx + ((PixmapPtr)pSrcDrawable)->devKind * sy) / pitch;
|
||||
((PixmapPtr)pSrcDrawable)->devKind = pitch;
|
||||
pSrcDrawable->depth = 16;
|
||||
}
|
||||
if (id) {
|
||||
dx = pDstDrawable->x;
|
||||
dy = pDstDrawable->y % Scanlines;
|
||||
pitch = 2 * pDstDrawable->width;
|
||||
pDstDrawable->x = (dx + ((PixmapPtr)pDstDrawable)->devKind * dy) % pitch;
|
||||
pDstDrawable->y = (dx + ((PixmapPtr)pDstDrawable)->devKind * dy) / pitch;
|
||||
((PixmapPtr)pDstDrawable)->devKind = pitch;
|
||||
pDstDrawable->depth = 16;
|
||||
}
|
||||
pReg = (*SaveCopyAreaPixmap)(pSrcDrawable, pDstDrawable, pGC,
|
||||
srcx, srcy % Scanlines,
|
||||
width, height,
|
||||
dstx, dsty % Scanlines);
|
||||
if (is) {
|
||||
pSrcDrawable->x = sx;
|
||||
pSrcDrawable->y = sy + is * Scanlines;
|
||||
}
|
||||
if (id) {
|
||||
pDstDrawable->x = dx;
|
||||
pDstDrawable->y = dy + id * Scanlines;
|
||||
}
|
||||
return pReg;
|
||||
}
|
||||
return (*SaveCopyAreaPixmap)(pSrcDrawable, pDstDrawable, pGC,
|
||||
srcx, srcy,
|
||||
width, height,
|
||||
dstx, dsty);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ApmAccelReserveSpace(ApmPtr pApm)
|
||||
{
|
||||
memType mem, ScratchMemOffset;
|
||||
|
||||
mem = xf86ScreenToScrn(pApm->pScreen)->videoRam << 10;
|
||||
/*
|
||||
* Reserve at least four lines for mono to color expansion
|
||||
*/
|
||||
ScratchMemOffset = ((mem - pApm->OffscreenReserved) /
|
||||
pApm->CurrentLayout.bytesPerScanline - 4) *
|
||||
pApm->CurrentLayout.bytesPerScanline;
|
||||
pApm->ScratchMemSize= mem - ScratchMemOffset - pApm->OffscreenReserved;
|
||||
pApm->ScratchMemPtr = pApm->ScratchMemOffset
|
||||
= (memType)pApm->FbBase + ScratchMemOffset;
|
||||
pApm->ScratchMemEnd = (memType)pApm->FbBase + mem - pApm->OffscreenReserved;
|
||||
}
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
int
|
||||
ApmAccelInit(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
APMDECL(pScrn);
|
||||
XAAInfoRecPtr pXAAinfo;
|
||||
BoxRec AvailFBArea;
|
||||
memType mem, ScratchMemOffset;
|
||||
int i, stat;
|
||||
|
||||
pApm->AccelInfoRec = pXAAinfo = XAACreateInfoRec();
|
||||
if (!pXAAinfo)
|
||||
return FALSE;
|
||||
|
||||
mem = pScrn->videoRam << 10;
|
||||
ScratchMemOffset = pApm->ScratchMemOffset - (memType)pApm->FbBase;
|
||||
switch (pApm->CurrentLayout.bitsPerPixel) {
|
||||
case 8:
|
||||
case 24:
|
||||
pApm->ScratchMemWidth =
|
||||
(mem - ScratchMemOffset - pApm->OffscreenReserved) / 1;
|
||||
pApm->ScratchMem =
|
||||
((ScratchMemOffset & 0xFFF000) << 4) |
|
||||
(ScratchMemOffset & 0xFFF);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
pApm->ScratchMemWidth =
|
||||
(mem - ScratchMemOffset - pApm->OffscreenReserved) / 2;
|
||||
pApm->ScratchMem =
|
||||
((ScratchMemOffset & 0xFFE000) << 3) |
|
||||
((ScratchMemOffset & 0x1FFE) >> 1);
|
||||
break;
|
||||
|
||||
case 32:
|
||||
pApm->ScratchMemWidth =
|
||||
(mem - ScratchMemOffset - pApm->OffscreenReserved) / 4;
|
||||
pApm->ScratchMem =
|
||||
((ScratchMemOffset & 0xFFC000) << 2) |
|
||||
((ScratchMemOffset & 0x3FFC) >> 2);
|
||||
break;
|
||||
}
|
||||
pApm->OffscreenReserved = mem - ScratchMemOffset;
|
||||
|
||||
/*
|
||||
* Abort
|
||||
*/
|
||||
if (pApm->Chipset == AP6422)
|
||||
i = 4;
|
||||
else
|
||||
i = 8;
|
||||
stat = RDXL_M(0x1FC);
|
||||
while ((stat & (STATUS_HOSTBLTBUSY | STATUS_ENGINEBUSY)) ||
|
||||
((stat & STATUS_FIFO) < i)) {
|
||||
WRXB_M(0x1FC, 0);
|
||||
stat = RDXL_M(0x1FC);
|
||||
}
|
||||
|
||||
/* Setup current register values */
|
||||
for (i = 0; i < sizeof(pApm->regcurr) / 4; i++)
|
||||
((CARD32 *)curr)[i] = RDXL(0x30 + 4*i);
|
||||
|
||||
SETCLIP_CTRL(1);
|
||||
SETCLIP_CTRL(0);
|
||||
SETBYTEMASK(0x00);
|
||||
SETBYTEMASK(0xFF);
|
||||
SETROP(ROP_S_xor_D);
|
||||
SETROP(ROP_S);
|
||||
|
||||
#if 0
|
||||
if (XAAPixmapOps.CopyArea != ApmCopyAreaPixmap) {
|
||||
SaveCopyAreaPixmap = XAAPixmapOps.CopyArea;
|
||||
XAAPixmapOps.CopyArea = ApmCopyAreaPixmap;
|
||||
}
|
||||
#endif
|
||||
|
||||
ApmSetupXAAInfo(pApm, pXAAinfo);
|
||||
|
||||
pApm->SetupForSolidFill = ApmSetupForSolidFill;
|
||||
pApm->SubsequentSolidFillRect = ApmSubsequentSolidFillRect;
|
||||
pApm->SetupForSolidFill24 = ApmSetupForSolidFill24;
|
||||
pApm->SubsequentSolidFillRect24 = ApmSubsequentSolidFillRect24;
|
||||
pApm->SetupForScreenToScreenCopy = ApmSetupForScreenToScreenCopy;
|
||||
pApm->SubsequentScreenToScreenCopy = ApmSubsequentScreenToScreenCopy;
|
||||
pApm->SetupForScreenToScreenCopy24 = ApmSetupForScreenToScreenCopy24;
|
||||
pApm->SubsequentScreenToScreenCopy24= ApmSubsequentScreenToScreenCopy24;
|
||||
|
||||
/*
|
||||
* Init Rush extension.
|
||||
* Must be initialized once per generation.
|
||||
*/
|
||||
#ifdef XF86RUSH_EXT
|
||||
if (!pApm->CreatePixmap) {
|
||||
pApm->CreatePixmap = pScreen->CreatePixmap;
|
||||
pApm->DestroyPixmap = pScreen->DestroyPixmap;
|
||||
}
|
||||
XFree86RushExtensionInit(pScreen);
|
||||
#endif
|
||||
|
||||
/* Pixmap cache setup */
|
||||
pXAAinfo->CachePixelGranularity = (pApm->CurrentLayout.mask32 + 1) << 1;
|
||||
AvailFBArea.x1 = 0;
|
||||
AvailFBArea.y1 = 0;
|
||||
AvailFBArea.x2 = pScrn->displayWidth;
|
||||
AvailFBArea.y2 = (pScrn->videoRam * 1024 - pApm->OffscreenReserved) /
|
||||
(pScrn->displayWidth * ((pScrn->bitsPerPixel + 7) >> 3));
|
||||
|
||||
xf86InitFBManager(pScreen, &AvailFBArea);
|
||||
|
||||
bzero(pApm->apmCache, sizeof pApm->apmCache);
|
||||
|
||||
return XAAInit(pScreen, pXAAinfo);
|
||||
}
|
||||
|
||||
void ApmSetupXAAInfo(ApmPtr pApm, XAAInfoRecPtr pXAAinfo)
|
||||
{
|
||||
pApm->CurrentLayout.Setup_DEC = 0;
|
||||
switch(pApm->CurrentLayout.bitsPerPixel)
|
||||
{
|
||||
case 8:
|
||||
pApm->CurrentLayout.Setup_DEC |= DEC_BITDEPTH_8;
|
||||
break;
|
||||
case 16:
|
||||
pApm->CurrentLayout.Setup_DEC |= DEC_BITDEPTH_16;
|
||||
break;
|
||||
case 24:
|
||||
/* Note : in 24 bpp, the accelerator wants linear coordinates */
|
||||
pApm->CurrentLayout.Setup_DEC |= DEC_BITDEPTH_24 | DEC_SOURCE_LINEAR |
|
||||
DEC_DEST_LINEAR;
|
||||
break;
|
||||
case 32:
|
||||
pApm->CurrentLayout.Setup_DEC |= DEC_BITDEPTH_32;
|
||||
break;
|
||||
default:
|
||||
xf86DrvMsg(xf86ScreenToScrn(pApm->pScreen)->scrnIndex, X_WARNING,
|
||||
"Cannot set up drawing engine control for bpp = %d\n",
|
||||
pApm->CurrentLayout.bitsPerPixel);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(pApm->CurrentLayout.displayWidth)
|
||||
{
|
||||
case 640:
|
||||
pApm->CurrentLayout.Setup_DEC |= DEC_WIDTH_640;
|
||||
break;
|
||||
case 800:
|
||||
pApm->CurrentLayout.Setup_DEC |= DEC_WIDTH_800;
|
||||
break;
|
||||
case 1024:
|
||||
pApm->CurrentLayout.Setup_DEC |= DEC_WIDTH_1024;
|
||||
break;
|
||||
case 1152:
|
||||
pApm->CurrentLayout.Setup_DEC |= DEC_WIDTH_1152;
|
||||
break;
|
||||
case 1280:
|
||||
pApm->CurrentLayout.Setup_DEC |= DEC_WIDTH_1280;
|
||||
break;
|
||||
case 1600:
|
||||
pApm->CurrentLayout.Setup_DEC |= DEC_WIDTH_1600;
|
||||
break;
|
||||
default:
|
||||
xf86DrvMsg(xf86ScreenToScrn(pApm->pScreen)->scrnIndex, X_WARNING,
|
||||
"Cannot set up drawing engine control "
|
||||
"for screen width = %d\n", pApm->CurrentLayout.displayWidth);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!pXAAinfo)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Set up the main acceleration flags.
|
||||
*/
|
||||
pXAAinfo->Flags = PIXMAP_CACHE | LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS;
|
||||
pXAAinfo->CacheMonoStipple = ApmCacheMonoStipple;
|
||||
|
||||
if (pApm->CurrentLayout.bitsPerPixel != 24) {
|
||||
#define XAA(s) pXAAinfo->s = Apm##s
|
||||
if (pApm->Chipset < AT24)
|
||||
pXAAinfo->Sync = ApmSync6422;
|
||||
else
|
||||
XAA(Sync);
|
||||
|
||||
/* Accelerated filled rectangles */
|
||||
pXAAinfo->SolidFillFlags = NO_PLANEMASK;
|
||||
XAA(SetupForSolidFill);
|
||||
XAA(SubsequentSolidFillRect);
|
||||
|
||||
/* Accelerated screen to screen color expansion */
|
||||
pXAAinfo->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK;
|
||||
XAA(SetupForScreenToScreenColorExpandFill);
|
||||
XAA(SubsequentScreenToScreenColorExpandFill);
|
||||
|
||||
#if 0
|
||||
The constraints of the transfer range are incompatible with the
|
||||
XAA architecture. I rewrote the XAA functions using ImageWrite
|
||||
/* Accelerated CPU to screen color expansion */
|
||||
if ((pApm->Chipset == AT24 && pApm->ChipRev >= 4) ||
|
||||
pApm->Chipset == AT3D) {
|
||||
pXAAinfo->CPUToScreenColorExpandFillFlags =
|
||||
NO_PLANEMASK | SCANLINE_PAD_DWORD | CPU_TRANSFER_PAD_QWORD
|
||||
| BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING |
|
||||
LEFT_EDGE_CLIPPING_NEGATIVE_X | SYNC_AFTER_COLOR_EXPAND;
|
||||
XAA(SetupForCPUToScreenColorExpandFill);
|
||||
XAA(SubsequentCPUToScreenColorExpandFill);
|
||||
pXAAinfo->ColorExpandBase = pApm->BltMap;
|
||||
pXAAinfo->ColorExpandRange = (pApm->Chipset >= AT3D) ? 32*1024 : 30*1024;
|
||||
}
|
||||
|
||||
/* Accelerated image transfers */
|
||||
pXAAinfo->ImageWriteFlags =
|
||||
LEFT_EDGE_CLIPPING | NO_PLANEMASK |
|
||||
SCANLINE_PAD_DWORD | CPU_TRANSFER_PAD_QWORD |
|
||||
LEFT_EDGE_CLIPPING_NEGATIVE_X |
|
||||
SYNC_AFTER_IMAGE_WRITE;
|
||||
pXAAinfo->ImageWriteBase = pApm->BltMap;
|
||||
pXAAinfo->ImageWriteRange = (pApm->Chipset >= AT3D) ? 32*1024 : 30*1024;
|
||||
XAA(SetupForImageWrite);
|
||||
XAA(SubsequentImageWriteRect);
|
||||
#endif
|
||||
pXAAinfo->WritePixmapFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK |
|
||||
LEFT_EDGE_CLIPPING_NEGATIVE_X;
|
||||
XAA(WritePixmap);
|
||||
pXAAinfo->FillImageWriteRectsFlags =
|
||||
LEFT_EDGE_CLIPPING | NO_PLANEMASK |
|
||||
LEFT_EDGE_CLIPPING_NEGATIVE_X;
|
||||
XAA(FillImageWriteRects);
|
||||
pXAAinfo->WriteBitmapFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK |
|
||||
LEFT_EDGE_CLIPPING_NEGATIVE_X |
|
||||
BIT_ORDER_IN_BYTE_LSBFIRST;
|
||||
XAA(WriteBitmap);
|
||||
pXAAinfo->TEGlyphRendererFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK |
|
||||
LEFT_EDGE_CLIPPING_NEGATIVE_X;
|
||||
XAA(TEGlyphRenderer);
|
||||
|
||||
/* Accelerated screen-screen bitblts */
|
||||
pXAAinfo->ScreenToScreenCopyFlags = NO_PLANEMASK;
|
||||
XAA(SetupForScreenToScreenCopy);
|
||||
XAA(SubsequentScreenToScreenCopy);
|
||||
|
||||
/* Accelerated Line drawing */
|
||||
pXAAinfo->SolidLineFlags = NO_PLANEMASK | HARDWARE_CLIP_LINE;
|
||||
XAA(SetClippingRectangle);
|
||||
pXAAinfo->SolidBresenhamLineErrorTermBits = 15;
|
||||
|
||||
if (pApm->Chipset >= AT24) {
|
||||
XAA(SubsequentSolidBresenhamLine);
|
||||
|
||||
/* Pattern fill */
|
||||
pXAAinfo->Mono8x8PatternFillFlags = NO_PLANEMASK |
|
||||
HARDWARE_PATTERN_PROGRAMMED_BITS |
|
||||
HARDWARE_PATTERN_SCREEN_ORIGIN;
|
||||
XAA(SetupForMono8x8PatternFill);
|
||||
XAA(SubsequentMono8x8PatternFillRect);
|
||||
if (pApm->CurrentLayout.bitsPerPixel == 8) {
|
||||
pXAAinfo->Color8x8PatternFillFlags = NO_PLANEMASK |
|
||||
HARDWARE_PATTERN_SCREEN_ORIGIN;
|
||||
XAA(SetupForColor8x8PatternFill);
|
||||
XAA(SubsequentColor8x8PatternFillRect);
|
||||
}
|
||||
}
|
||||
else
|
||||
pXAAinfo->SubsequentSolidBresenhamLine =
|
||||
ApmSubsequentSolidBresenhamLine6422;
|
||||
#undef XAA
|
||||
}
|
||||
else {
|
||||
#define XAA(s) pXAAinfo->s = Apm##s##24
|
||||
XAA(Sync);
|
||||
|
||||
/* Accelerated filled rectangles */
|
||||
pXAAinfo->SolidFillFlags = NO_PLANEMASK;
|
||||
XAA(SetupForSolidFill);
|
||||
XAA(SubsequentSolidFillRect);
|
||||
|
||||
#if 0
|
||||
/* Accelerated screen to screen color expansion */
|
||||
pXAAinfo->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK;
|
||||
XAA(SetupForScreenToScreenColorExpandFill);
|
||||
XAA(SubsequentScreenToScreenColorExpandFill);
|
||||
|
||||
#if 0
|
||||
The constraints of the transfer range are incompatible with the
|
||||
XAA architecture. I rewrote the XAA functions using ImageWrite
|
||||
/* Accelerated CPU to screen color expansion */
|
||||
if (pApm->Chipset == AT3D && pApm->ChipRev >= 4) {
|
||||
pXAAinfo->CPUToScreenColorExpandFillFlags =
|
||||
NO_PLANEMASK | SCANLINE_PAD_DWORD | CPU_TRANSFER_PAD_QWORD
|
||||
| BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING |
|
||||
LEFT_EDGE_CLIPPING_NEGATIVE_X | SYNC_AFTER_COLOR_EXPAND;
|
||||
XAA(SetupForCPUToScreenColorExpandFill);
|
||||
XAA(SubsequentCPUToScreenColorExpandFill);
|
||||
pXAAinfo->ColorExpandBase = pApm->BltMap;
|
||||
pXAAinfo->ColorExpandRange = 32*1024;
|
||||
}
|
||||
|
||||
/* Accelerated image transfers */
|
||||
pXAAinfo->ImageWriteFlags =
|
||||
LEFT_EDGE_CLIPPING | NO_PLANEMASK |
|
||||
SCANLINE_PAD_DWORD | CPU_TRANSFER_PAD_QWORD |
|
||||
SYNC_AFTER_IMAGE_WRITE;
|
||||
pXAAinfo->ImageWriteBase = pApm->BltMap;
|
||||
pXAAinfo->ImageWriteRange = 32*1024;
|
||||
XAA(SetupForImageWrite);
|
||||
XAA(SubsequentImageWriteRect);
|
||||
#endif
|
||||
pXAAinfo->WritePixmapFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK |
|
||||
LEFT_EDGE_CLIPPING_NEGATIVE_X;
|
||||
XAA(WritePixmap);
|
||||
pXAAinfo->FillImageWriteRectsFlags =
|
||||
LEFT_EDGE_CLIPPING | NO_PLANEMASK |
|
||||
LEFT_EDGE_CLIPPING_NEGATIVE_X;
|
||||
XAA(FillImageWriteRects);
|
||||
pXAAinfo->WriteBitmapFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK |
|
||||
LEFT_EDGE_CLIPPING_NEGATIVE_X |
|
||||
BIT_ORDER_IN_BYTE_LSBFIRST;
|
||||
XAA(WriteBitmap);
|
||||
pXAAinfo->TEGlyphRendererFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK |
|
||||
LEFT_EDGE_CLIPPING_NEGATIVE_X;
|
||||
XAA(TEGlyphRenderer);
|
||||
|
||||
/* Accelerated Line drawing */
|
||||
pXAAinfo->SolidLineFlags = NO_PLANEMASK | HARDWARE_CLIP_LINE;
|
||||
XAA(SubsequentSolidBresenhamLine);
|
||||
XAA(SetClippingRectangle);
|
||||
pXAAinfo->SolidBresenhamLineErrorTermBits = 15;
|
||||
|
||||
/* Pattern fill */
|
||||
pXAAinfo->Mono8x8PatternFillFlags = NO_PLANEMASK | NO_TRANSPARENCY |
|
||||
HARDWARE_PATTERN_PROGRAMMED_BITS |
|
||||
HARDWARE_PATTERN_SCREEN_ORIGIN;
|
||||
XAA(SetupForMono8x8PatternFill);
|
||||
XAA(SubsequentMono8x8PatternFillRect);
|
||||
#endif
|
||||
|
||||
/* Accelerated screen-screen bitblts */
|
||||
pXAAinfo->ScreenToScreenCopyFlags = NO_PLANEMASK | NO_TRANSPARENCY;
|
||||
XAA(SetupForScreenToScreenCopy);
|
||||
XAA(SubsequentScreenToScreenCopy);
|
||||
#undef XAA
|
||||
}
|
||||
}
|
||||
#endif
|
198
driver/xf86-video-apm/src/apm_cursor.c
Normal file
198
driver/xf86-video-apm/src/apm_cursor.c
Normal file
|
@ -0,0 +1,198 @@
|
|||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "misc.h"
|
||||
#include "input.h"
|
||||
#include "cursorstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "servermd.h"
|
||||
#include "windowstr.h"
|
||||
#include "mipointer.h"
|
||||
|
||||
#include "apm.h"
|
||||
|
||||
#define CURSORWIDTH 64
|
||||
#define CURSORHEIGHT 64
|
||||
#define CURSORSIZE (CURSORWIDTH * CURSORHEIGHT / 8)
|
||||
#define CURSORALIGN ((CURSORSIZE + 1023) & ~1023l)
|
||||
|
||||
static void ApmShowCursor(ScrnInfoPtr pScrn);
|
||||
static void ApmHideCursor(ScrnInfoPtr pScrn);
|
||||
static void ApmSetCursorPosition(ScrnInfoPtr pScrn, int x, int y);
|
||||
static void ApmSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg);
|
||||
static void ApmLoadCursorImage(ScrnInfoPtr pScrn, u8* data);
|
||||
static Bool ApmUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs);
|
||||
|
||||
static u8 ConvertTable[256];
|
||||
|
||||
/* Inline functions */
|
||||
static __inline__ void
|
||||
WaitForFifo(ApmPtr pApm, int slots)
|
||||
{
|
||||
if (!pApm->UsePCIRetry) {
|
||||
volatile int i;
|
||||
#define MAXLOOP 1000000
|
||||
|
||||
for(i = 0; i < MAXLOOP; i++) {
|
||||
if ((STATUS() & STATUS_FIFO) >= slots)
|
||||
break;
|
||||
}
|
||||
if (i == MAXLOOP) {
|
||||
unsigned int status = STATUS();
|
||||
|
||||
WRXB(0x1FF, 0);
|
||||
if (!xf86ServerIsExiting())
|
||||
FatalError("Hung in WaitForFifo() (Status = 0x%08X)\n", status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ApmHWCursorReserveSpace(ApmPtr pApm)
|
||||
{
|
||||
pApm->OffscreenReserved += 2 * CURSORALIGN;
|
||||
pApm->DisplayedCursorAddress = pApm->BaseCursorAddress =
|
||||
pApm->CursorAddress = 1024 * xf86ScreenToScrn(pApm->pScreen)->videoRam -
|
||||
pApm->OffscreenReserved;
|
||||
}
|
||||
|
||||
|
||||
int ApmHWCursorInit(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
APMDECL(pScrn);
|
||||
xf86CursorInfoPtr infoPtr;
|
||||
u32 i;
|
||||
|
||||
infoPtr = xf86CreateCursorInfoRec();
|
||||
if (!infoPtr)
|
||||
return FALSE;
|
||||
|
||||
pApm->CursorInfoRec = infoPtr;
|
||||
|
||||
infoPtr->MaxWidth = CURSORWIDTH;
|
||||
infoPtr->MaxHeight = CURSORHEIGHT;
|
||||
|
||||
infoPtr->Flags = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
|
||||
infoPtr->SetCursorColors = ApmSetCursorColors;
|
||||
infoPtr->SetCursorPosition = ApmSetCursorPosition;
|
||||
infoPtr->LoadCursorImage = ApmLoadCursorImage;
|
||||
infoPtr->HideCursor = ApmHideCursor;
|
||||
infoPtr->ShowCursor = ApmShowCursor;
|
||||
infoPtr->UseHWCursor = ApmUseHWCursor;
|
||||
|
||||
/* Set up the convert table for the input cursor data */
|
||||
for (i = 0; i < 256; i++)
|
||||
ConvertTable[i] = ((~i) & 0xAA) | (i & (i >> 1) & 0x55);
|
||||
|
||||
return xf86InitCursor(pScreen, infoPtr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ApmShowCursor(ScrnInfoPtr pScrn)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
|
||||
WaitForFifo(pApm, 2);
|
||||
WRXW(0x144, pApm->CursorAddress >> 10);
|
||||
WRXB(0x140, 1);
|
||||
pApm->DisplayedCursorAddress = pApm->CursorAddress;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ApmHideCursor(ScrnInfoPtr pScrn)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
|
||||
WaitForFifo(pApm, 1);
|
||||
WRXB(0x140, 0);
|
||||
}
|
||||
|
||||
static Bool ApmUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
|
||||
{
|
||||
return APMPTR(xf86ScreenToScrn(pScreen))->CurrentLayout.bitsPerPixel >= 8;
|
||||
}
|
||||
|
||||
static void
|
||||
ApmSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
int xoff, yoff;
|
||||
|
||||
if (x < -CURSORWIDTH || y < -CURSORHEIGHT) {
|
||||
WaitForFifo(pApm, 1);
|
||||
WRXB(0x140, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (x < 0) {
|
||||
xoff = -x;
|
||||
x = 0;
|
||||
}
|
||||
else
|
||||
xoff = 0;
|
||||
if (y < 0) {
|
||||
yoff = -y;
|
||||
y = 0;
|
||||
}
|
||||
else
|
||||
yoff = 0;
|
||||
|
||||
WaitForFifo(pApm, 2);
|
||||
WRXW(0x14C, (yoff << 8) | (xoff & 0xFF));
|
||||
WRXL(0x148, (y << 16) | (x & 0xFFFF));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ApmSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
u16 packedcolfg, packedcolbg;
|
||||
|
||||
if (pApm->CurrentLayout.bitsPerPixel == 8)
|
||||
{
|
||||
WaitForFifo(pApm, 2);
|
||||
WRXB(0x141, fg);
|
||||
WRXB(0x142, bg);
|
||||
}
|
||||
else
|
||||
{
|
||||
packedcolfg =
|
||||
((fg & 0xE00000) >> 16) |
|
||||
((fg & 0x00E000) >> 11) |
|
||||
((fg & 0x0000C0) >> 6);
|
||||
packedcolbg =
|
||||
((bg & 0xE00000) >> 16) |
|
||||
((bg & 0x00E000) >> 11) |
|
||||
((bg & 0x0000C0) >> 6);
|
||||
WaitForFifo(pApm, 2);
|
||||
WRXB(0x141, packedcolfg);
|
||||
WRXB(0x142, packedcolbg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ApmLoadCursorImage(ScrnInfoPtr pScrn, u8* data)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
u32 i;
|
||||
u8 tmp[2 * CURSORSIZE];
|
||||
|
||||
/* Correct input data */
|
||||
for (i = 0; i < sizeof tmp; i++)
|
||||
tmp[i] = ConvertTable[data[i]];
|
||||
/*
|
||||
* To avoid flicker.
|
||||
* Note: 2*pApm->BaseCursorAddress + CURSORALIGN (=1024) < 2^31 all the time.
|
||||
*/
|
||||
pApm->CursorAddress = 2*pApm->BaseCursorAddress + CURSORALIGN - pApm->DisplayedCursorAddress;
|
||||
memcpy((u8*)pApm->FbBase + pApm->CursorAddress, tmp, sizeof tmp);
|
||||
}
|
434
driver/xf86-video-apm/src/apm_dga.c
Normal file
434
driver/xf86-video-apm/src/apm_dga.c
Normal file
|
@ -0,0 +1,434 @@
|
|||
/*
|
||||
* file: apm_dga.c
|
||||
* ported from s3virge, ported from mga
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86_OSproc.h"
|
||||
#include "xf86Pci.h"
|
||||
#include "apm.h"
|
||||
#include "dgaproc.h"
|
||||
|
||||
|
||||
static Bool ApmOpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
|
||||
int *, int *, int *);
|
||||
static Bool ApmSetMode(ScrnInfoPtr, DGAModePtr);
|
||||
static int ApmGetViewport(ScrnInfoPtr);
|
||||
static void ApmSetViewport(ScrnInfoPtr, int, int, int);
|
||||
#ifdef HAVE_XAA_H
|
||||
static void ApmFillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
|
||||
static void ApmBlitRect(ScrnInfoPtr, int, int, int, int, int, int);
|
||||
static void ApmBlitTransRect(ScrnInfoPtr, int, int, int, int, int, int,
|
||||
unsigned long);
|
||||
#endif
|
||||
static void ApmSync(ScrnInfoPtr);
|
||||
|
||||
static
|
||||
DGAFunctionRec ApmDGAFuncs = {
|
||||
ApmOpenFramebuffer,
|
||||
NULL,
|
||||
ApmSetMode,
|
||||
ApmSetViewport,
|
||||
ApmGetViewport,
|
||||
ApmSync,
|
||||
#ifdef HAVE_XAA_H
|
||||
ApmFillRect,
|
||||
ApmBlitRect,
|
||||
ApmBlitTransRect
|
||||
#else
|
||||
NULL, NULL, NULL
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* Placeholder
|
||||
*/
|
||||
void
|
||||
ApmSync(ScrnInfoPtr pScrn)
|
||||
{
|
||||
}
|
||||
|
||||
static __inline__ int FindSmallestPitch(ApmPtr pApm, int Bpp, int width)
|
||||
{
|
||||
if (width <= 640)
|
||||
return 640;
|
||||
else if (width <= 800)
|
||||
return 800;
|
||||
else if (width <= 1024)
|
||||
return 1024;
|
||||
else if (width <= 1152)
|
||||
return 1152;
|
||||
else if (width <= 1280)
|
||||
return 1280;
|
||||
else if (width <= 1600)
|
||||
return 1600;
|
||||
return (width + 7) & ~7;
|
||||
}
|
||||
|
||||
static DGAModePtr
|
||||
ApmSetupDGAMode(ScrnInfoPtr pScrn, DGAModePtr modes, int *num,
|
||||
int bitsPerPixel, int depth, Bool pixmap, int secondPitch,
|
||||
unsigned long red, unsigned long green, unsigned long blue,
|
||||
short visualClass)
|
||||
{
|
||||
DisplayModePtr firstMode, pMode;
|
||||
APMDECL(pScrn);
|
||||
DGAModePtr mode, newmodes;
|
||||
int size, pitch, Bpp = bitsPerPixel >> 3;
|
||||
Bool reduced_pitch = TRUE;
|
||||
|
||||
SECOND_PASS:
|
||||
|
||||
firstMode = NULL;
|
||||
|
||||
for (pMode = pScrn->modes; pMode != firstMode; pMode = pMode->next) {
|
||||
|
||||
if (!firstMode)
|
||||
firstMode = pMode;
|
||||
|
||||
if (reduced_pitch)
|
||||
pitch = FindSmallestPitch(pApm, Bpp, pMode->HDisplay);
|
||||
else
|
||||
pitch = pMode->HDisplay;
|
||||
if (!reduced_pitch && pitch == FindSmallestPitch(pApm, Bpp, pMode->HDisplay))
|
||||
continue;
|
||||
|
||||
size = pitch * Bpp * pMode->VDisplay;
|
||||
|
||||
if((!secondPitch || (pitch != secondPitch)) &&
|
||||
(size <= pScrn->videoRam * 1024 - pApm->OffscreenReserved)) {
|
||||
|
||||
if(secondPitch)
|
||||
pitch = secondPitch;
|
||||
|
||||
if(!(newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec))))
|
||||
break;
|
||||
|
||||
modes = newmodes;
|
||||
mode = modes + *num;
|
||||
|
||||
mode->mode = pMode;
|
||||
mode->flags = DGA_CONCURRENT_ACCESS;
|
||||
|
||||
if(pixmap)
|
||||
mode->flags |= DGA_PIXMAP_AVAILABLE;
|
||||
if(!pApm->NoAccel) {
|
||||
mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
|
||||
if (Bpp != 3)
|
||||
mode->flags |= DGA_BLIT_RECT_TRANS;
|
||||
}
|
||||
if(pMode->Flags & V_DBLSCAN)
|
||||
mode->flags |= DGA_DOUBLESCAN;
|
||||
if(pMode->Flags & V_INTERLACE)
|
||||
mode->flags |= DGA_INTERLACED;
|
||||
mode->byteOrder = pScrn->imageByteOrder;
|
||||
mode->depth = depth;
|
||||
mode->bitsPerPixel = bitsPerPixel;
|
||||
mode->red_mask = red;
|
||||
mode->green_mask = green;
|
||||
mode->blue_mask = blue;
|
||||
mode->visualClass = visualClass;
|
||||
mode->viewportWidth = pMode->HDisplay;
|
||||
mode->viewportHeight = pMode->VDisplay;
|
||||
mode->xViewportStep = (bitsPerPixel == 24) ? 4 : 1;
|
||||
mode->yViewportStep = 1;
|
||||
mode->viewportFlags = DGA_FLIP_RETRACE;
|
||||
mode->offset = 0;
|
||||
mode->address = pApm->FbBase;
|
||||
mode->bytesPerScanline = pitch * Bpp;
|
||||
mode->imageWidth = pitch;
|
||||
mode->imageHeight = (pScrn->videoRam * 1024 -
|
||||
pApm->OffscreenReserved) / mode->bytesPerScanline;
|
||||
mode->pixmapWidth = mode->imageWidth;
|
||||
mode->pixmapHeight = mode->imageHeight;
|
||||
mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
|
||||
/* this might need to get clamped to some maximum */
|
||||
mode->maxViewportY = mode->imageHeight - mode->viewportHeight;
|
||||
|
||||
(*num)++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(secondPitch) {
|
||||
secondPitch = 0;
|
||||
goto SECOND_PASS;
|
||||
}
|
||||
|
||||
if (reduced_pitch) {
|
||||
reduced_pitch = FALSE;
|
||||
goto SECOND_PASS;
|
||||
}
|
||||
|
||||
return modes;
|
||||
}
|
||||
|
||||
Bool
|
||||
ApmDGAInit(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
APMDECL(pScrn);
|
||||
DGAModePtr modes = NULL;
|
||||
int num = 0;
|
||||
|
||||
/* 8 */
|
||||
modes = ApmSetupDGAMode (pScrn, modes, &num, 8, 8,
|
||||
(pScrn->bitsPerPixel != 24),
|
||||
(pScrn->bitsPerPixel != 8) ? 0 : pScrn->displayWidth,
|
||||
0, 0, 0, PseudoColor);
|
||||
|
||||
/* 15 */
|
||||
modes = ApmSetupDGAMode (pScrn, modes, &num, 16, 15,
|
||||
(pScrn->bitsPerPixel != 24),
|
||||
(pScrn->depth != 15) ? 0 : pScrn->displayWidth,
|
||||
0x7C00, 0x03E0, 0x001F, TrueColor);
|
||||
|
||||
modes = ApmSetupDGAMode (pScrn, modes, &num, 16, 15,
|
||||
(pScrn->bitsPerPixel != 24),
|
||||
(pScrn->depth != 15) ? 0 : pScrn->displayWidth,
|
||||
0x7C00, 0x03E0, 0x001F, DirectColor);
|
||||
|
||||
/* 16 */
|
||||
modes = ApmSetupDGAMode (pScrn, modes, &num, 16, 16,
|
||||
(pScrn->bitsPerPixel != 24),
|
||||
(pScrn->depth != 16) ? 0 : pScrn->displayWidth,
|
||||
0xF800, 0x07E0, 0x001F, TrueColor);
|
||||
|
||||
modes = ApmSetupDGAMode (pScrn, modes, &num, 16, 16,
|
||||
(pScrn->bitsPerPixel != 24),
|
||||
(pScrn->depth != 16) ? 0 : pScrn->displayWidth,
|
||||
0xF800, 0x07E0, 0x001F, DirectColor);
|
||||
|
||||
/* 24 */
|
||||
modes = ApmSetupDGAMode (pScrn, modes, &num, 24, 24,
|
||||
(pScrn->bitsPerPixel == 24),
|
||||
(pScrn->bitsPerPixel != 24) ? 0 : pScrn->displayWidth,
|
||||
0xFF0000, 0x00FF00, 0x0000FF, TrueColor);
|
||||
|
||||
modes = ApmSetupDGAMode (pScrn, modes, &num, 24, 24,
|
||||
(pScrn->bitsPerPixel == 24),
|
||||
(pScrn->bitsPerPixel != 24) ? 0 : pScrn->displayWidth,
|
||||
0xFF0000, 0x00FF00, 0x0000FF, DirectColor);
|
||||
|
||||
/* 32 */
|
||||
modes = ApmSetupDGAMode (pScrn, modes, &num, 32, 24,
|
||||
(pScrn->bitsPerPixel != 24),
|
||||
(pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
|
||||
0xFF0000, 0x00FF00, 0x0000FF, TrueColor);
|
||||
|
||||
modes = ApmSetupDGAMode (pScrn, modes, &num, 32, 24,
|
||||
(pScrn->bitsPerPixel != 24),
|
||||
(pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
|
||||
0xFF0000, 0x00FF00, 0x0000FF, DirectColor);
|
||||
|
||||
pApm->numDGAModes = num;
|
||||
pApm->DGAModes = modes;
|
||||
|
||||
return DGAInit(pScreen, &ApmDGAFuncs, modes, num);
|
||||
}
|
||||
|
||||
|
||||
static Bool
|
||||
ApmSetMode(ScrnInfoPtr pScrn, DGAModePtr pMode)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
|
||||
if (!pMode) { /* restore the original mode */
|
||||
if (pApm->DGAactive) {
|
||||
memcpy(&pApm->CurrentLayout, &pApm->SavedLayout,
|
||||
sizeof pApm->CurrentLayout);
|
||||
pApm->DGAactive = FALSE;
|
||||
}
|
||||
|
||||
pScrn->currentMode = pApm->CurrentLayout.pMode;
|
||||
ApmSwitchMode(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode));
|
||||
ApmAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
|
||||
#if 0
|
||||
if (pApm->AccelInfoRec)
|
||||
XAAInit(pScrn->pScreen, pApm->AccelInfoRec);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
if (!pApm->DGAactive) {
|
||||
memcpy(&pApm->SavedLayout, &pApm->CurrentLayout,
|
||||
sizeof pApm->CurrentLayout);
|
||||
pApm->DGAactive = TRUE;
|
||||
}
|
||||
|
||||
pApm->CurrentLayout.displayWidth = pMode->imageWidth;
|
||||
pApm->CurrentLayout.displayHeight = pMode->imageHeight;
|
||||
pApm->CurrentLayout.Scanlines = pMode->imageHeight + 1;
|
||||
pApm->CurrentLayout.depth = pMode->depth;
|
||||
pApm->CurrentLayout.bitsPerPixel = pMode->bitsPerPixel;
|
||||
pApm->CurrentLayout.bytesPerScanline = pMode->bytesPerScanline;
|
||||
pApm->CurrentLayout.pMode = pMode->mode;
|
||||
if (pMode->bitsPerPixel == 24)
|
||||
pApm->CurrentLayout.mask32 = 3;
|
||||
else
|
||||
pApm->CurrentLayout.mask32 = 32 / pMode->bitsPerPixel - 1;
|
||||
|
||||
ApmSwitchMode(SWITCH_MODE_ARGS(pScrn, pMode->mode));
|
||||
#ifdef HAVE_XAA_H
|
||||
ApmSetupXAAInfo(pApm, NULL);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (pApm->DGAXAAInfo)
|
||||
bzero(pApm->DGAXAAInfo, sizeof(*pApm->DGAXAAInfo));
|
||||
else
|
||||
pApm->DGAXAAInfo = XAACreateInfoRec();
|
||||
ApmSetupXAAInfo(pApm, pApm->DGAXAAInfo);
|
||||
/*
|
||||
* Let's hope this won't fail, that is reinitialize XAA for this
|
||||
* setup...
|
||||
*/
|
||||
XAAInit(pScrn->pScreen, pApm->DGAXAAInfo);
|
||||
#endif
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
ApmGetViewport(
|
||||
ScrnInfoPtr pScrn
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ApmSetViewport(
|
||||
ScrnInfoPtr pScrn,
|
||||
int x, int y,
|
||||
int flags
|
||||
)
|
||||
{
|
||||
unsigned char tmp;
|
||||
|
||||
APMDECL(pScrn);
|
||||
|
||||
if (pApm->apmLock) {
|
||||
/*
|
||||
* This is just an attempt, because Daryll is tampering with MY
|
||||
* registers.
|
||||
*/
|
||||
tmp = (RDXB(0xDB) & 0xF4) | 0x0A;
|
||||
WRXB(0xDB, tmp);
|
||||
ApmWriteSeq(0x1B, 0x20);
|
||||
ApmWriteSeq(0x1C, 0x2F);
|
||||
pApm->apmLock = FALSE;
|
||||
}
|
||||
pScrn->AdjustFrame(ADJUST_FRAME_ARGS(pScrn, x, y));
|
||||
if (pApm->VGAMap) {
|
||||
/* Wait until vertical retrace is in progress. */
|
||||
while (APMVGAB(0x3DA) & 0x08);
|
||||
while (!(APMVGAB(0x3DA) & 0x08));
|
||||
}
|
||||
else {
|
||||
/* Wait until vertical retrace is in progress. */
|
||||
while (inb(pApm->iobase + 0x3DA) & 0x08);
|
||||
while (!(inb(pApm->iobase + 0x3DA) & 0x08));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_XAA_H
|
||||
static void
|
||||
ApmFillRect (
|
||||
ScrnInfoPtr pScrn,
|
||||
int x, int y, int w, int h,
|
||||
unsigned long color
|
||||
)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
|
||||
if(pApm->CurrentLayout.depth != 24) {
|
||||
(*pApm->SetupForSolidFill)(pScrn, color, GXcopy, ~0);
|
||||
(*pApm->SubsequentSolidFillRect)(pScrn, x, y, w, h);
|
||||
}
|
||||
else {
|
||||
(*pApm->SetupForSolidFill24)(pScrn, color, GXcopy, ~0);
|
||||
(*pApm->SubsequentSolidFillRect24)(pScrn, x, y, w, h);
|
||||
}
|
||||
SET_SYNC_FLAG(pApm->AccelInfoRec);
|
||||
}
|
||||
|
||||
static void
|
||||
ApmBlitRect(
|
||||
ScrnInfoPtr pScrn,
|
||||
int srcx, int srcy,
|
||||
int w, int h,
|
||||
int dstx, int dsty
|
||||
)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
|
||||
int ydir = (srcy < dsty) ? -1 : 1;
|
||||
|
||||
if(pApm->CurrentLayout.depth != 24) {
|
||||
(*pApm->SetupForScreenToScreenCopy)(
|
||||
pScrn, xdir, ydir, GXcopy, ~0, -1);
|
||||
(*pApm->SubsequentScreenToScreenCopy)(
|
||||
pScrn, srcx, srcy, dstx, dsty, w, h);
|
||||
}
|
||||
else {
|
||||
(*pApm->SetupForScreenToScreenCopy24)(
|
||||
pScrn, xdir, ydir, GXcopy, ~0, -1);
|
||||
(*pApm->SubsequentScreenToScreenCopy24)(
|
||||
pScrn, srcx, srcy, dstx, dsty, w, h);
|
||||
}
|
||||
SET_SYNC_FLAG(pApm->AccelInfoRec);
|
||||
}
|
||||
|
||||
static void
|
||||
ApmBlitTransRect(
|
||||
ScrnInfoPtr pScrn,
|
||||
int srcx, int srcy,
|
||||
int w, int h,
|
||||
int dstx, int dsty,
|
||||
unsigned long color
|
||||
)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
|
||||
if(pApm->AccelInfoRec) {
|
||||
int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
|
||||
int ydir = (srcy < dsty) ? -1 : 1;
|
||||
|
||||
(*pApm->AccelInfoRec->SetupForScreenToScreenCopy)(
|
||||
pScrn, xdir, ydir, GXcopy, ~0, (int)color);
|
||||
(*pApm->AccelInfoRec->SubsequentScreenToScreenCopy)(
|
||||
pScrn, srcx, srcy, dstx, dsty, w, h);
|
||||
SET_SYNC_FLAG(pApm->AccelInfoRec);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static Bool
|
||||
ApmOpenFramebuffer(
|
||||
ScrnInfoPtr pScrn,
|
||||
char **name,
|
||||
unsigned char **mem,
|
||||
int *size,
|
||||
int *offset,
|
||||
int *flags
|
||||
)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
|
||||
*name = NULL; /* no special device */
|
||||
*mem = (unsigned char*)(pApm->LinAddress +
|
||||
0*((char *)pApm->FbBase - (char *)pApm->LinMap));
|
||||
*size = pScrn->videoRam << 10;
|
||||
*offset = 0;
|
||||
*flags = DGA_NEED_ROOT;
|
||||
|
||||
return TRUE;
|
||||
}
|
2164
driver/xf86-video-apm/src/apm_driver.c
Normal file
2164
driver/xf86-video-apm/src/apm_driver.c
Normal file
File diff suppressed because it is too large
Load diff
1536
driver/xf86-video-apm/src/apm_funcs.c
Normal file
1536
driver/xf86-video-apm/src/apm_funcs.c
Normal file
File diff suppressed because it is too large
Load diff
89
driver/xf86-video-apm/src/apm_i2c.c
Normal file
89
driver/xf86-video-apm/src/apm_i2c.c
Normal file
|
@ -0,0 +1,89 @@
|
|||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "apm.h"
|
||||
#include "apm_regs.h"
|
||||
|
||||
/* Inline functions */
|
||||
static __inline__ void
|
||||
WaitForFifo(ApmPtr pApm, int slots)
|
||||
{
|
||||
if (!pApm->UsePCIRetry) {
|
||||
volatile int i;
|
||||
#define MAXLOOP 1000000
|
||||
|
||||
for(i = 0; i < MAXLOOP; i++) {
|
||||
if ((STATUS_IOP() & STATUS_FIFO) >= slots)
|
||||
break;
|
||||
}
|
||||
if (i == MAXLOOP) {
|
||||
unsigned int status = STATUS_IOP();
|
||||
|
||||
WRXB_IOP(0x1FF, 0);
|
||||
FatalError("Hung in WaitForFifo() (Status = 0x%08X)\n", status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ApmI2CPutBits(I2CBusPtr b, int clock, int data)
|
||||
{
|
||||
unsigned int reg;
|
||||
unsigned char lock;
|
||||
ApmPtr pApm = ((ApmPtr)b->DriverPrivate.ptr);
|
||||
|
||||
lock = rdinx(pApm->xport, 0x10);
|
||||
wrinx(pApm->xport, 0x10, 0x12);
|
||||
WaitForFifo(pApm, 2);
|
||||
reg = (RDXB_IOP(0xD0) & 0x07) | 0x60;
|
||||
if(clock) reg |= 0x08;
|
||||
if(data) reg |= 0x10;
|
||||
WRXB_IOP(0xD0, reg);
|
||||
if (lock)
|
||||
wrinx(pApm->xport, 0x10, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
ApmI2CGetBits(I2CBusPtr b, int *clock, int *data)
|
||||
{
|
||||
unsigned int reg;
|
||||
unsigned char lock;
|
||||
ApmPtr pApm = ((ApmPtr)b->DriverPrivate.ptr);
|
||||
unsigned char tmp;
|
||||
|
||||
lock = rdinx(pApm->xport, 0x10);
|
||||
wrinx(pApm->xport, 0x10, 0x12);
|
||||
WaitForFifo(pApm, 2);
|
||||
tmp = RDXB_IOP(0xD0);
|
||||
WRXB_IOP(0xD0, tmp & 0x07);
|
||||
reg = STATUS_IOP();
|
||||
*clock = (reg & STATUS_SCL) != 0;
|
||||
*data = (reg & STATUS_SDA) != 0;
|
||||
if (lock)
|
||||
wrinx(pApm->xport, 0x10, 0);
|
||||
}
|
||||
|
||||
Bool
|
||||
ApmI2CInit(ScrnInfoPtr pScrn)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
I2CBusPtr I2CPtr;
|
||||
|
||||
I2CPtr = xf86CreateI2CBusRec();
|
||||
if(!I2CPtr) return FALSE;
|
||||
|
||||
pApm->I2CPtr = I2CPtr;
|
||||
|
||||
I2CPtr->BusName = "Alliance bus";
|
||||
I2CPtr->scrnIndex = pScrn->scrnIndex;
|
||||
I2CPtr->I2CPutBits = ApmI2CPutBits;
|
||||
I2CPtr->I2CGetBits = ApmI2CGetBits;
|
||||
I2CPtr->DriverPrivate.ptr = pApm;
|
||||
|
||||
if(!xf86I2CBusInit(I2CPtr))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
122
driver/xf86-video-apm/src/apm_pcirename.h
Normal file
122
driver/xf86-video-apm/src/apm_pcirename.h
Normal file
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* Copyright 2007 George Sapountzis
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Macros for porting drivers from legacy xfree86 PCI code to the pciaccess
|
||||
* library. The main purpose being to facilitate source code compatibility.
|
||||
*/
|
||||
|
||||
#ifndef CIRPCIRENAME_H
|
||||
#define CIRPCIRENAME_H
|
||||
|
||||
enum region_type {
|
||||
REGION_MEM,
|
||||
REGION_IO
|
||||
};
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
|
||||
/* pciVideoPtr */
|
||||
#define PCI_DEV_VENDOR_ID(_pcidev) ((_pcidev)->vendor)
|
||||
#define PCI_DEV_DEVICE_ID(_pcidev) ((_pcidev)->chipType)
|
||||
#define PCI_DEV_REVISION(_pcidev) ((_pcidev)->chipRev)
|
||||
|
||||
#define PCI_SUB_VENDOR_ID(_pcidev) ((_pcidev)->subsysVendor)
|
||||
#define PCI_SUB_DEVICE_ID(_pcidev) ((_pcidev)->subsysCard)
|
||||
|
||||
#define PCI_DEV_TAG(_pcidev) pciTag((_pcidev)->bus, \
|
||||
(_pcidev)->device, \
|
||||
(_pcidev)->func)
|
||||
#define PCI_DEV_BUS(_pcidev) ((_pcidev)->bus)
|
||||
#define PCI_DEV_DEV(_pcidev) ((_pcidev)->device)
|
||||
#define PCI_DEV_FUNC(_pcidev) ((_pcidev)->func)
|
||||
|
||||
/* pciConfigPtr */
|
||||
#define PCI_CFG_TAG(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->tag)
|
||||
#define PCI_CFG_BUS(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->busnum)
|
||||
#define PCI_CFG_DEV(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->devnum)
|
||||
#define PCI_CFG_FUNC(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->funcnum)
|
||||
|
||||
/* region addr: xfree86 uses different fields for memory regions and I/O ports */
|
||||
#define PCI_REGION_BASE(_pcidev, _b, _type) \
|
||||
(((_type) == REGION_MEM) ? (_pcidev)->memBase[(_b)] \
|
||||
: (_pcidev)->ioBase[(_b)])
|
||||
|
||||
/* region size: xfree86 uses the log2 of the region size,
|
||||
* but with zero meaning no region, not size of one XXX */
|
||||
#define PCI_REGION_SIZE(_pcidev, _b) \
|
||||
(((_pcidev)->size[(_b)] > 0) ? (1 << (_pcidev)->size[(_b)]) : 0)
|
||||
|
||||
/* read/write PCI configuration space */
|
||||
#define PCI_READ_BYTE(_pcidev, _value_ptr, _offset) \
|
||||
*(_value_ptr) = pciReadByte(PCI_CFG_TAG(_pcidev), (_offset))
|
||||
|
||||
#define PCI_READ_LONG(_pcidev, _value_ptr, _offset) \
|
||||
*(_value_ptr) = pciReadLong(PCI_CFG_TAG(_pcidev), (_offset))
|
||||
|
||||
#define PCI_WRITE_LONG(_pcidev, _value, _offset) \
|
||||
pciWriteLong(PCI_CFG_TAG(_pcidev), (_offset), (_value))
|
||||
|
||||
#else /* XSERVER_LIBPCIACCESS */
|
||||
|
||||
typedef struct pci_device *pciVideoPtr;
|
||||
|
||||
#define PCI_DEV_VENDOR_ID(_pcidev) ((_pcidev)->vendor_id)
|
||||
#define PCI_DEV_DEVICE_ID(_pcidev) ((_pcidev)->device_id)
|
||||
#define PCI_DEV_REVISION(_pcidev) ((_pcidev)->revision)
|
||||
|
||||
#define PCI_SUB_VENDOR_ID(_pcidev) ((_pcidev)->subvendor_id)
|
||||
#define PCI_SUB_DEVICE_ID(_pcidev) ((_pcidev)->subdevice_id)
|
||||
|
||||
/* pci-rework functions take a 'pci_device' parameter instead of a tag */
|
||||
#define PCI_DEV_TAG(_pcidev) (_pcidev)
|
||||
|
||||
/* PCI_DEV macros, typically used in printf's, add domain ? XXX */
|
||||
#define PCI_DEV_BUS(_pcidev) ((_pcidev)->bus)
|
||||
#define PCI_DEV_DEV(_pcidev) ((_pcidev)->dev)
|
||||
#define PCI_DEV_FUNC(_pcidev) ((_pcidev)->func)
|
||||
|
||||
/* pci-rework functions take a 'pci_device' parameter instead of a tag */
|
||||
#define PCI_CFG_TAG(_pcidev) (_pcidev)
|
||||
|
||||
/* PCI_CFG macros, typically used in DRI init, contain the domain */
|
||||
#define PCI_CFG_BUS(_pcidev) (((_pcidev)->domain << 8) | \
|
||||
(_pcidev)->bus)
|
||||
#define PCI_CFG_DEV(_pcidev) ((_pcidev)->dev)
|
||||
#define PCI_CFG_FUNC(_pcidev) ((_pcidev)->func)
|
||||
|
||||
#define PCI_REGION_BASE(_pcidev, _b, _type) ((_pcidev)->regions[(_b)].base_addr)
|
||||
#define PCI_REGION_SIZE(_pcidev, _b) ((_pcidev)->regions[(_b)].size)
|
||||
|
||||
#define PCI_READ_BYTE(_pcidev, _value_ptr, _offset) \
|
||||
pci_device_cfg_read_u8((_pcidev), (_value_ptr), (_offset))
|
||||
|
||||
#define PCI_READ_LONG(_pcidev, _value_ptr, _offset) \
|
||||
pci_device_cfg_read_u32((_pcidev), (_value_ptr), (_offset))
|
||||
|
||||
#define PCI_WRITE_LONG(_pcidev, _value, _offset) \
|
||||
pci_device_cfg_write_u32((_pcidev), (_value), (_offset))
|
||||
|
||||
#endif /* XSERVER_LIBPCIACCESS */
|
||||
|
||||
#endif /* CIRPCIRENAME_H */
|
230
driver/xf86-video-apm/src/apm_regs.h
Normal file
230
driver/xf86-video-apm/src/apm_regs.h
Normal file
|
@ -0,0 +1,230 @@
|
|||
|
||||
|
||||
|
||||
#define curr08 (curr - 0x30)
|
||||
#define curr16 ((CARD16 *)(curr - 0x30))
|
||||
#define curr32 ((CARD32 *)(curr - 0x30))
|
||||
#define check08(addr, val) \
|
||||
((addr) >= 0x80 || (((addr)&0xF8) == 0x48) || curr08[(addr)] != (val))
|
||||
#define check16(addr, val) \
|
||||
((addr) >= 0x80 || (((addr)&0xF8) == 0x48) || curr16[(addr) / 2] != (val)||\
|
||||
((addr) == 0x50 && curr32[0x40 / 4] & DEC_QUICKSTART_ONSOURCE)||\
|
||||
((addr) == 0x52 && curr32[0x40 / 4] & DEC_QUICKSTART_ONSOURCE)||\
|
||||
((addr) == 0x54 && curr32[0x40 / 4] & DEC_QUICKSTART_ONDEST) || \
|
||||
((addr) == 0x56 && curr32[0x40 / 4] & DEC_QUICKSTART_ONDEST) || \
|
||||
((addr) == 0x58 && curr32[0x40 / 4] & DEC_QUICKSTART_ONDIMX))
|
||||
#define check32(addr, val) \
|
||||
((addr) >= 0x80 || (((addr)&0xF8) == 0x48) || curr32[(addr) / 4] != (val)||\
|
||||
((addr) == 0x50 && curr32[0x40 / 4] & DEC_QUICKSTART_ONSOURCE)||\
|
||||
((addr) == 0x54 && curr32[0x40 / 4] & DEC_QUICKSTART_ONDEST) || \
|
||||
((addr) == 0x58 && curr32[0x40 / 4] & DEC_QUICKSTART_ONDIMX) || \
|
||||
((addr) == 0x40 && (val) & DEC_START))
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
/* Memory mapped access to extended registers */
|
||||
#define RDXB_M(addr) (MMIO_IN8 (pApm->MemMap, (addr)))
|
||||
#define RDXW_M(addr) (MMIO_IN16(pApm->MemMap, (addr)))
|
||||
#define RDXL_M(addr) (MMIO_IN32(pApm->MemMap, (addr)))
|
||||
#define WRXB_M(addr,val) do { if (check08((addr), (val))) { \
|
||||
MMIO_OUT8 (pApm->MemMap, (addr), (val)); \
|
||||
/*xf86DrvMsg(xf86ScreenToScrn(pApm->pScreen)->scrnIndex, X_INFO, \
|
||||
"File %s, line %d, %02X <- %02X\n", \
|
||||
__FILE__, __LINE__, (addr), (val) & 255); */\
|
||||
curr08[MIN((addr), 0x80)] = (val); }} while (0)
|
||||
#define WRXW_M(addr,val) do { if (check16((addr), (val))) { \
|
||||
MMIO_OUT16(pApm->MemMap, (addr), (val)); \
|
||||
/*xf86DrvMsg(xf86ScreenToScrn(pApm->pScreen)->scrnIndex, X_INFO, \
|
||||
"File %s, line %d, %02X <- %04X\n", \
|
||||
__FILE__, __LINE__, (addr), (val)&65535); */\
|
||||
curr16[MIN(((addr) / 2), 0x40)] = (val); }} while (0)
|
||||
#define WRXL_M(addr,val) do { if (check32((addr), (val))) { \
|
||||
MMIO_OUT32(pApm->MemMap, (addr), (val)); \
|
||||
/*xf86DrvMsg(xf86ScreenToScrn(pApm->pScreen)->scrnIndex, X_INFO, \
|
||||
"File %s, line %d, %02X <- %08X\n", \
|
||||
__FILE__, __LINE__, (addr), (val)); */\
|
||||
curr32[MIN(((addr) / 4), 0x20)] = (val); }} while (0)
|
||||
|
||||
/* IO port access to extended registers */
|
||||
#define RDXB_IOP(addr) (wrinx(pApm->xport, 0x1D, (addr) >> 2), \
|
||||
inb(pApm->xbase + ((addr) & 3)))
|
||||
#define RDXW_IOP(addr) (wrinx(pApm->xport, 0x1D, (addr) >> 2), \
|
||||
inw(pApm->xbase + ((addr) & 2)))
|
||||
#define RDXL_IOP(addr) (wrinx(pApm->xport, 0x1D, (addr) >> 2), \
|
||||
inl(pApm->xbase))
|
||||
#define WRXB_IOP(addr,val) \
|
||||
do { \
|
||||
if (check08((addr), (val))) { \
|
||||
wrinx(pApm->xport, 0x1D, (addr) >> 2); \
|
||||
outb(pApm->xbase + ((addr) & 3), (val)); \
|
||||
curr08[MIN((addr), 0x80)] = (val); \
|
||||
break; \
|
||||
} \
|
||||
} while (1)
|
||||
#define WRXW_IOP(addr,val) \
|
||||
do { \
|
||||
if (check16((addr), (val))) { \
|
||||
wrinx(pApm->xport, 0x1D, (addr) >> 2); \
|
||||
outw(pApm->xbase + ((addr) & 2), (val)); \
|
||||
curr16[MIN(((addr) / 2), 0x40)] = (val); \
|
||||
break; \
|
||||
} \
|
||||
} while (1)
|
||||
#define WRXL_IOP(addr,val) \
|
||||
do { \
|
||||
if (check32((addr), (val))) { \
|
||||
wrinx(pApm->xport, 0x1D, (addr) >> 2); \
|
||||
outl(pApm->xbase, (val)); \
|
||||
curr32[MIN(((addr) / 4), 0x20)] = (val); \
|
||||
break; \
|
||||
} \
|
||||
} while (1)
|
||||
|
||||
#define WRXL WRXL_M
|
||||
#define WRXW WRXW_M
|
||||
#define WRXB WRXB_M
|
||||
#define RDXL RDXL_M
|
||||
#define RDXW RDXW_M
|
||||
#define RDXB RDXB_M
|
||||
#define UPDATEDEST(x,y) (void)(curr32[0x54 / 4] = ((y) << 16) | ((x) & 0xFFFF))
|
||||
|
||||
/* Memory mapped access to VGA registers */
|
||||
#define APMVGAB(idx) (((volatile unsigned char *)pApm->VGAMap)[idx])
|
||||
#define APMVGAS(idx) (((volatile unsigned short *)pApm->VGAMap)[(idx) >> 1])
|
||||
#define APMVGAW(idx) (((volatile unsigned int *)pApm->VGAMap)[(idx) >> 2])
|
||||
#define ApmWriteCrtc(idx, val) do { APMVGAS(0x3D4) = ((val) << 8) | ((idx) & 0xFF); break; } while(1)
|
||||
#define ApmReadCrtc(idx) ((APMVGAB(0x3D4) = (idx)), APMVGAB(0x3D5))
|
||||
#define ApmWriteGr(idx, val) do { APMVGAS(0x3CE) = ((val) << 8) | ((idx) & 0xFF); break; } while(1)
|
||||
#define ApmReadGr(idx) ((APMVGAB(0x3CE) = (idx)), APMVGAB(0x3CF))
|
||||
#define ApmWriteSeq(idx, val) do { APMVGAB(0x3C4) = (idx); APMVGAB(0x3C5) = (val); break; } while(1)
|
||||
#define ApmReadSeq(idx) ((APMVGAB(0x3C4) = (idx)), APMVGAB(0x3C5))
|
||||
#define ApmWriteAttr(idx, val) do { int tmp = APMVGAB(0x3DA); APMVGAB(0x3C0) = (idx); APMVGAB(0x3C0) = (val); break; } while(1)
|
||||
#define ApmReadAttr(idx) (APMVGAB(0x3DA), (APMVGAB(0x3C0) = (idx)), APMVGAB(0x3C1))
|
||||
#define ApmWriteMiscOut(val) do { APMVGAB(0x3C2) = (val); break; } while(1)
|
||||
#define ApmReadMiscOut() APMVGAB(0x3CC)
|
||||
#define ApmWriteDacMask(val) do { APMVGAB(0x3C6) = (val); break; } while(1)
|
||||
#define ApmReadDacMask() APMVGAB(0x3C6)
|
||||
#define ApmWriteDacReadAddr(val)do { APMVGAB(0x3C7) = (val); break; } while(1)
|
||||
#define ApmWriteDacWriteAddr(val)do{ APMVGAB(0x3C8) = (val); break; } while(1)
|
||||
#define ApmWriteDacData(val) do { APMVGAB(0x3C9) = (val); break; } while(1)
|
||||
#define ApmReadDacData() APMVGAB(0x3C9)
|
||||
|
||||
#define STATUS() (RDXL(0x1FC))
|
||||
#define STATUS_IOP() (RDXL_IOP(0x1FC))
|
||||
#define STATUS_FIFO (0x0F)
|
||||
#define STATUS_HOSTBLTBUSY (1 << 8)
|
||||
#define STATUS_ENGINEBUSY (1 << 10)
|
||||
#define STATUS_SDA (1 << 16)
|
||||
#define STATUS_SCL (1 << 17)
|
||||
|
||||
#define SETFOREGROUNDCOLOR(c) WRXL(0x60,c)
|
||||
#define SETBACKGROUNDCOLOR(c) WRXL(0x64,c)
|
||||
|
||||
#define SETSOURCEX(x) WRXW(0x50, x)
|
||||
#define SETSOURCEY(y) WRXW(0x52, y)
|
||||
#define SETSOURCEXY(x,y) WRXL(0x50, ((y) << 16) | ((x) & 0xFFFF))
|
||||
#define SETSOURCEOFF(o) WRXL(0x50, (o))
|
||||
|
||||
#define SETDESTX(x) WRXW(0x54, x)
|
||||
#define SETDESTY(y) WRXW(0x56, y)
|
||||
#define SETDESTXY(x,y) WRXL(0x54, ((y) << 16) | ((x) & 0xFFFF))
|
||||
#define SETDESTOFF(o) WRXL(0x54, (o))
|
||||
|
||||
#define SETWIDTH(w) WRXW(0x58, w)
|
||||
#define SETHEIGHT(h) WRXW(0x5A, h)
|
||||
#define SETWIDTHHEIGHT(w,h) WRXL(0x58, ((h) << 16) | ((w) & 0xFFFF))
|
||||
|
||||
#define SETOFFSET(o) WRXW(0x5C, (o))
|
||||
#define SETSOURCEOFFSET(o) WRXW(0x5E, (o))
|
||||
|
||||
#define SETBYTEMASK(mask) WRXB(0x47, (mask))
|
||||
|
||||
#define SETPATTERN(p1, p2) do {WRXL(0x48, p1); WRXL(0x4C, p2);} while(0)
|
||||
|
||||
#define SETDDA_AXIALSTEP(step) WRXW(0x70, (step))
|
||||
#define SETDDA_DIAGONALSTEP(step) WRXW(0x72, (step))
|
||||
#define SETDDA_ERRORTERM(eterm) WRXW(0x74, (eterm))
|
||||
#define SETDDA_ADSTEP(s1,s2) WRXL(0x70, ((s2) << 16)|((s1) & 0xFFFF))
|
||||
|
||||
#define SETCLIP_CTRL(ctrl) WRXB(0x30, (ctrl))
|
||||
#define SETCLIP_LEFT(x) WRXW(0x38, (x))
|
||||
#define SETCLIP_TOP(y) WRXW(0x3A, (y))
|
||||
#define SETCLIP_LEFTTOP(x,y) WRXL(0x38, ((y) << 16) | ((x) & 0xFFFF))
|
||||
#define SETCLIP_RIGHT(x) WRXW(0x3C, (x))
|
||||
#define SETCLIP_BOT(y) WRXW(0x3E, (y))
|
||||
#define SETCLIP_RIGHTBOT(x,y) WRXL(0x3C, ((y) << 16) | ((x) & 0xFFFF))
|
||||
|
||||
/* RASTER OPERATION REGISTER */
|
||||
/* P = pattern S = source D = destination */
|
||||
#define SETROP(rop) WRXB(0x46, (rop))
|
||||
#define ROP_P_and_S_and_D 0x80
|
||||
#define ROP_S_xor_D 0x66
|
||||
#define ROP_S 0xCC
|
||||
#define ROP_P 0xF0
|
||||
/* Then there are about 252 more operations ... */
|
||||
|
||||
|
||||
/* DRAWING ENGINE CONTROL REGISTER */
|
||||
#define SETDEC(control) WRXL(0x40, (control))
|
||||
#define DEC_OP_VECT_NOENDP 0x0000000D
|
||||
#define DEC_OP_VECT_ENDP 0x0000000C
|
||||
#define DEC_OP_HOSTBLT_SCREEN2HOST 0x00000009
|
||||
#define DEC_OP_HOSTBLT_HOST2SCREEN 0x00000008
|
||||
#define DEC_OP_STRIP 0x00000004
|
||||
#define DEC_OP_BLT_STRETCH 0x00000003
|
||||
#define DEC_OP_RECT 0x00000002
|
||||
#define DEC_OP_BLT 0x00000001
|
||||
#define DEC_OP_NOOP 0x00000000
|
||||
#define DEC_DIR_X_NEG (1 << 6)
|
||||
#define DEC_DIR_X_POS (0 << 6)
|
||||
#define DEC_DIR_Y_NEG (1 << 7)
|
||||
#define DEC_DIR_Y_POS (0 << 7)
|
||||
#define DEC_MAJORAXIS_X (0 << 8) /* Looks like an error in the docs ...*/
|
||||
#define DEC_MAJORAXIS_Y (1 << 8)
|
||||
#define DEC_SOURCE_LINEAR (1 << 9)
|
||||
#define DEC_SOURCE_XY (0 << 9)
|
||||
#define DEC_SOURCE_CONTIG (1 << 11)
|
||||
#define DEC_SOURCE_RECTANGULAR (0 << 11)
|
||||
#define DEC_SOURCE_MONOCHROME (1 << 12)
|
||||
#define DEC_SOURCE_COLOR (0 << 12)
|
||||
#define DEC_SOURCE_TRANSPARENCY (1 << 13)
|
||||
#define DEC_SOURCE_NO_TRANSPARENCY (0 << 13)
|
||||
#define DEC_BITDEPTH_MASK (7 << 14)
|
||||
#define DEC_BITDEPTH_24 (4 << 14)
|
||||
#define DEC_BITDEPTH_32 (3 << 14)
|
||||
#define DEC_BITDEPTH_16 (2 << 14)
|
||||
#define DEC_BITDEPTH_8 (1 << 14)
|
||||
#define DEC_DEST_LINEAR (1 << 18)
|
||||
#define DEC_DEST_XY (0 << 18)
|
||||
#define DEC_DEST_CONTIG (1 << 19)
|
||||
#define DEC_DEST_RECTANGULAR (0 << 19)
|
||||
#define DEC_DEST_TRANSPARENCY (1 << 20)
|
||||
#define DEC_DEST_NO_TRANSPARENCY (0 << 20)
|
||||
#define DEC_DEST_TRANSP_POLARITY (1 << 21)
|
||||
#define DEC_DEST_TRANSP_POLARITYINV (0 << 21)
|
||||
#define DEC_PATTERN_88_8bCOLOR (3 << 22)
|
||||
#define DEC_PATTERN_88_1bMONO (2 << 22)
|
||||
#define DEC_PATTERN_44_4bDITHER (1 << 22)
|
||||
#define DEC_PATTERN_NONE (0 << 22)
|
||||
#define DEC_WIDTH_MASK (7 << 24)
|
||||
#define DEC_WIDTH_1600 (7 << 24)
|
||||
#define DEC_WIDTH_1280 (6 << 24)
|
||||
#define DEC_WIDTH_1152 (5 << 24)
|
||||
#define DEC_WIDTH_1024 (4 << 24)
|
||||
#define DEC_WIDTH_800 (2 << 24)
|
||||
#define DEC_WIDTH_640 (1 << 24)
|
||||
#define DEC_WIDTH_LINEAR (0 << 24)
|
||||
#define DEC_DEST_UPD_LASTPIX (3 << 27)
|
||||
#define DEC_DEST_UPD_BLCORNER (2 << 27)
|
||||
#define DEC_DEST_UPD_TRCORNER (1 << 27)
|
||||
#define DEC_DEST_UPD_NONE (0 << 27)
|
||||
#define DEC_QUICKSTART_ONDEST (3 << 29)
|
||||
#define DEC_QUICKSTART_ONSOURCE (2 << 29)
|
||||
#define DEC_QUICKSTART_ONDIMX (1 << 29)
|
||||
#define DEC_QUICKSTART_NONE (0 << 29)
|
||||
#define DEC_START (1 << 31)
|
||||
#define DEC_START_NO (0 << 31)
|
||||
|
||||
#define AT3D_SST_STATUS 0x1F4
|
||||
#define SST_BUSY 1
|
949
driver/xf86-video-apm/src/apm_video.c
Normal file
949
driver/xf86-video-apm/src/apm_video.c
Normal file
|
@ -0,0 +1,949 @@
|
|||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#if PSZ != 24
|
||||
#include "dixstruct.h"
|
||||
#include "fourcc.h"
|
||||
|
||||
/*
|
||||
* Ported from mga_video.c by Loïc Grenié
|
||||
*/
|
||||
|
||||
#ifndef OFF_DELAY
|
||||
#define OFF_DELAY 200
|
||||
#endif
|
||||
|
||||
static XF86VideoAdaptorPtr A(SetupImageVideo)(ScreenPtr);
|
||||
|
||||
static void A(StopVideo)(ScrnInfoPtr, pointer, Bool);
|
||||
static int A(SetPortAttribute)(ScrnInfoPtr, Atom, INT32, pointer);
|
||||
static int ApmGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer);
|
||||
static void ApmQueryBestSize(ScrnInfoPtr, Bool, short, short, short,
|
||||
short, unsigned int *, unsigned int *,
|
||||
pointer);
|
||||
static int ApmQueryImageAttributes(ScrnInfoPtr, int,
|
||||
unsigned short *, unsigned short *,
|
||||
int *, int *);
|
||||
#ifndef XV_NEW_REPUT
|
||||
static int A(ReputImage)(ScrnInfoPtr, short, short, RegionPtr, pointer,
|
||||
DrawablePtr);
|
||||
#endif
|
||||
static int A(PutImage)(ScrnInfoPtr, short, short, short, short, short,
|
||||
short, short, short, int, unsigned char*,
|
||||
short, short, Bool, RegionPtr, pointer,
|
||||
DrawablePtr);
|
||||
|
||||
static void A(ResetVideo)(ScrnInfoPtr);
|
||||
static void A(XvMoveCB)(FBAreaPtr, FBAreaPtr);
|
||||
static void A(XvRemoveCB)(FBAreaPtr);
|
||||
|
||||
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
|
||||
|
||||
void A(InitVideo)(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
XF86VideoAdaptorPtr *adaptors, *newAdaptors;
|
||||
XF86VideoAdaptorPtr newAdaptor;
|
||||
APMDECL(pScrn);
|
||||
int num_adaptors;
|
||||
Bool freeAdaptors = FALSE;
|
||||
|
||||
num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
|
||||
|
||||
if (pApm->Chipset >= AT24) {
|
||||
if ((newAdaptor = A(SetupImageVideo)(pScreen))) {
|
||||
|
||||
newAdaptors = malloc((num_adaptors + 1) *
|
||||
sizeof(XF86VideoAdaptorPtr*));
|
||||
if(newAdaptors) {
|
||||
if(num_adaptors)
|
||||
memcpy(newAdaptors, adaptors, num_adaptors *
|
||||
sizeof(XF86VideoAdaptorPtr));
|
||||
newAdaptors[num_adaptors] = newAdaptor;
|
||||
adaptors = newAdaptors;
|
||||
num_adaptors++;
|
||||
freeAdaptors = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(num_adaptors)
|
||||
xf86XVScreenInit(pScreen, adaptors, num_adaptors);
|
||||
|
||||
free(adaptors);
|
||||
}
|
||||
|
||||
#ifndef APM_VIDEO_DEFINES
|
||||
#define APM_VIDEO_DEFINES
|
||||
|
||||
static Atom xvBrightness, xvContrast;
|
||||
|
||||
/* client libraries expect an encoding */
|
||||
static XF86VideoEncodingRec DummyEncoding[1] =
|
||||
{
|
||||
{
|
||||
0,
|
||||
"XV_IMAGE",
|
||||
1024, 1024,
|
||||
{1, 1}
|
||||
}
|
||||
};
|
||||
|
||||
#define NUM_FORMATS 24
|
||||
|
||||
static XF86VideoFormatRec Formats[NUM_FORMATS] =
|
||||
{
|
||||
{ 8, PseudoColor},
|
||||
{15, PseudoColor},
|
||||
{16, PseudoColor},
|
||||
{24, PseudoColor},
|
||||
{32, PseudoColor},
|
||||
{ 8, DirectColor},
|
||||
{15, DirectColor},
|
||||
{16, DirectColor},
|
||||
{24, DirectColor},
|
||||
{32, DirectColor},
|
||||
{ 8, TrueColor},
|
||||
{15, TrueColor},
|
||||
{16, TrueColor},
|
||||
{24, TrueColor},
|
||||
{32, TrueColor}
|
||||
};
|
||||
|
||||
#define NUM_ATTRIBUTES 2
|
||||
|
||||
static XF86AttributeRec Attributes[NUM_ATTRIBUTES] =
|
||||
{
|
||||
{XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
|
||||
{XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}
|
||||
};
|
||||
|
||||
#define NUM_IMAGES 9
|
||||
typedef char c8;
|
||||
|
||||
static XF86ImageRec Images[NUM_IMAGES] =
|
||||
{
|
||||
{
|
||||
0x35315652,
|
||||
XvRGB,
|
||||
LSBFirst,
|
||||
{'R','V','1','5',
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
16,
|
||||
XvPacked,
|
||||
1,
|
||||
15, 0x001F, 0x03E0, 0x7C00,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
{'R','V','B',0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
XvTopToBottom
|
||||
},
|
||||
{
|
||||
0x36315652,
|
||||
XvRGB,
|
||||
LSBFirst,
|
||||
{'R','V','1','6',
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
16,
|
||||
XvPacked,
|
||||
1,
|
||||
16, 0x001F, 0x07E0, 0xF800,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
{'R','V','B',0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
XvTopToBottom
|
||||
},
|
||||
{
|
||||
0x32335652,
|
||||
XvRGB,
|
||||
LSBFirst,
|
||||
{'R','V','3','2',
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
32,
|
||||
XvPacked,
|
||||
1,
|
||||
24, 0x0000FF, 0x00FF00, 0xFF0000,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
{'R','V','B',0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
XvTopToBottom
|
||||
},
|
||||
XVIMAGE_YUY2,
|
||||
{
|
||||
0x59595959,
|
||||
XvYUV,
|
||||
LSBFirst,
|
||||
{0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
8,
|
||||
XvPacked,
|
||||
1,
|
||||
0, 0, 0, 0,
|
||||
8, 0, 0,
|
||||
1, 1, 1,
|
||||
1, 1, 1,
|
||||
{'Y','Y','Y','Y',
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
XvTopToBottom
|
||||
},
|
||||
{
|
||||
0x32315659,
|
||||
XvYUV,
|
||||
LSBFirst,
|
||||
{'Y','V','1','2',
|
||||
0x00,0x00,0x00,0x10,(c8)0x80,0x00,0x00,(c8)0xAA,0x00,0x38,(c8)0x9B,0x71},
|
||||
12,
|
||||
XvPlanar,
|
||||
3,
|
||||
0, 0, 0, 0 ,
|
||||
8, 8, 8,
|
||||
1, 2, 2,
|
||||
1, 2, 2,
|
||||
{'Y','V','U',
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
XvTopToBottom
|
||||
},
|
||||
{
|
||||
0x59565955,
|
||||
XvYUV,
|
||||
LSBFirst,
|
||||
{'U','Y','V','Y',
|
||||
0x00,0x00,0x00,0x10,(c8)0x80,0x00,0x00,(c8)0xAA,0x00,0x38,(c8)0x9B,0x71},
|
||||
16,
|
||||
XvPlanar,
|
||||
1,
|
||||
0, 0, 0, 0,
|
||||
8, 8, 8,
|
||||
1, 2, 2,
|
||||
1, 1, 1,
|
||||
{'U','Y','V','Y',
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
XvTopToBottom
|
||||
},
|
||||
{
|
||||
0x55595659,
|
||||
XvYUV,
|
||||
LSBFirst,
|
||||
{'Y','V','Y','U',
|
||||
0x00,0x00,0x00,0x10,(c8)0x80,0x00,0x00,(c8)0xAA,0x00,0x38,(c8)0x9B,0x71},
|
||||
16,
|
||||
XvPlanar,
|
||||
1,
|
||||
0, 0, 0, 0,
|
||||
8, 8, 8,
|
||||
1, 2, 2,
|
||||
1, 1, 1,
|
||||
{'Y','V','Y','U',
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
XvTopToBottom
|
||||
},
|
||||
{
|
||||
0x59555956,
|
||||
XvYUV,
|
||||
LSBFirst,
|
||||
{'V','Y','U','Y',
|
||||
0x00,0x00,0x00,0x10,(c8)0x80,0x00,0x00,(c8)0xAA,0x00,0x38,(c8)0x9B,0x71},
|
||||
16,
|
||||
XvPlanar,
|
||||
1,
|
||||
0, 0, 0, 0,
|
||||
8, 8, 8,
|
||||
1, 2, 2,
|
||||
1, 1, 1,
|
||||
{'V','Y','U','Y',
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
XvTopToBottom
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
Bool on;
|
||||
unsigned char brightness;
|
||||
unsigned char contrast;
|
||||
unsigned short reg, val;
|
||||
ApmPtr pApm;
|
||||
int x1, x10, y1, drw_x, drw_y, Bpp, Bps;
|
||||
FBAreaPtr area;
|
||||
RegionRec clip;
|
||||
int xnum, xden, ynum, yden;
|
||||
CARD32 scalex, scaley;
|
||||
CARD32 data;
|
||||
} ApmPortPrivRec, *ApmPortPrivPtr;
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
A(ResetVideo)(ScrnInfoPtr pScrn)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
|
||||
A(WaitForFifo)(pApm, 2);
|
||||
((ApmPortPrivPtr)pApm->adaptor->pPortPrivates[0].ptr)->on = 0;
|
||||
((ApmPortPrivPtr)pApm->adaptor->pPortPrivates[1].ptr)->on = 0;
|
||||
WRXW(0x82, 0);
|
||||
WRXW(0x92, 0);
|
||||
}
|
||||
|
||||
|
||||
static XF86VideoAdaptorPtr
|
||||
A(SetupImageVideo)(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
APMDECL(pScrn);
|
||||
XF86VideoAdaptorPtr adapt;
|
||||
ApmPortPrivPtr pPriv;
|
||||
|
||||
if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
|
||||
2 * sizeof(ApmPortPrivRec) +
|
||||
2 * sizeof(DevUnion))))
|
||||
return NULL;
|
||||
|
||||
adapt->type = XvWindowMask | XvInputMask | XvImageMask;
|
||||
adapt->flags = VIDEO_OVERLAID_IMAGES;
|
||||
adapt->name = "Alliance Pro Motion video engine";
|
||||
adapt->nEncodings = 1;
|
||||
adapt->pEncodings = DummyEncoding;
|
||||
adapt->nFormats = NUM_FORMATS;
|
||||
adapt->pFormats = Formats;
|
||||
adapt->nPorts = 2;
|
||||
adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
|
||||
pPriv = (ApmPortPrivPtr)(&adapt->pPortPrivates[2]);
|
||||
pPriv->pApm = pApm;
|
||||
pPriv[1].pApm = pApm;
|
||||
pPriv->reg = 0x82;
|
||||
pPriv[1].reg = 0x92;
|
||||
adapt->pPortPrivates[0].ptr = (pointer)(pPriv);
|
||||
adapt->pPortPrivates[1].ptr = (pointer)(pPriv + 1);
|
||||
adapt->nAttributes = NUM_ATTRIBUTES;
|
||||
adapt->pAttributes = Attributes;
|
||||
adapt->nImages = NUM_IMAGES;
|
||||
adapt->pImages = Images;
|
||||
adapt->PutVideo = NULL;
|
||||
adapt->PutStill = NULL;
|
||||
adapt->GetVideo = NULL;
|
||||
adapt->GetStill = NULL;
|
||||
adapt->StopVideo = A(StopVideo);
|
||||
adapt->SetPortAttribute = A(SetPortAttribute);
|
||||
adapt->GetPortAttribute = ApmGetPortAttribute;
|
||||
adapt->QueryBestSize = ApmQueryBestSize;
|
||||
adapt->PutImage = A(PutImage);
|
||||
#ifndef XV_NEW_REPUT
|
||||
adapt->ReputImage = A(ReputImage);
|
||||
#endif
|
||||
adapt->QueryImageAttributes = ApmQueryImageAttributes;
|
||||
|
||||
pPriv->brightness = 0;
|
||||
pPriv->contrast = 128;
|
||||
pPriv[1].brightness = 0;
|
||||
pPriv[1].contrast = 128;
|
||||
|
||||
/* gotta uninit this someplace */
|
||||
REGION_NULL(pScreen, &pPriv->clip);
|
||||
REGION_NULL(pScreen, &(pPriv + 1)->clip);
|
||||
|
||||
pApm->adaptor = adapt;
|
||||
|
||||
xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
|
||||
xvContrast = MAKE_ATOM("XV_CONTRAST");
|
||||
|
||||
A(ResetVideo)(pScrn);
|
||||
|
||||
return adapt;
|
||||
}
|
||||
|
||||
/* ApmClipVideo -
|
||||
|
||||
Takes the dst box in standard X BoxRec form (top and left
|
||||
edges inclusive, bottom and right exclusive). The new dst
|
||||
box is returned. The source boundaries are given (x1, y1
|
||||
inclusive, x2, y2 exclusive) and returned are the new source
|
||||
boundaries in 16.16 fixed point.
|
||||
|
||||
extents is the extents of the clip region
|
||||
*/
|
||||
|
||||
static void
|
||||
ApmClipVideo(BoxPtr dst, INT32 *x1, INT32 *x2, INT32 *y1, INT32 *y2,
|
||||
BoxPtr extents, INT32 width, INT32 height,
|
||||
CARD32 *scalex, CARD32 *scaley, INT32 mask)
|
||||
{
|
||||
INT32 vscale, hscale;
|
||||
int diff;
|
||||
|
||||
if (dst->x2 - dst->x1 < *x2 - *x1)
|
||||
dst->x2 = dst->x1 + *x2 - *x1;
|
||||
|
||||
if (dst->y2 - dst->y1 < *y2 - *y1)
|
||||
dst->y2 = dst->y1 + *y2 - *y1;
|
||||
|
||||
*x1 <<= 12; *x2 <<= 16;
|
||||
*y1 <<= 12; *y2 <<= 16;
|
||||
|
||||
hscale = (*x2 - *x1) / (dst->x2 - dst->x1);
|
||||
vscale = (*y2 - *y1) / (dst->y2 - dst->y1);
|
||||
|
||||
diff = extents->x1 - dst->x1;
|
||||
if(diff > 0) {
|
||||
dst->x1 = extents->x1;
|
||||
*x1 += diff * hscale;
|
||||
}
|
||||
diff = dst->x2 - extents->x2;
|
||||
if(diff > 0) {
|
||||
dst->x2 = extents->x2;
|
||||
*x2 -= diff * hscale;
|
||||
}
|
||||
diff = extents->y1 - dst->y1;
|
||||
if(diff > 0) {
|
||||
dst->y1 = extents->y1;
|
||||
*y1 += diff * vscale;
|
||||
}
|
||||
diff = dst->y2 - extents->y2;
|
||||
if(diff > 0) {
|
||||
dst->y2 = extents->y2;
|
||||
*y2 -= diff * vscale;
|
||||
}
|
||||
|
||||
if (*x2 - *x1 == 0x10000 * (dst->x2 - dst->x1)) /* Shrinking */
|
||||
*scalex = 0;
|
||||
else
|
||||
*scalex = ((*x2 - *x1) / (dst->x2 - dst->x1)) >> 4;
|
||||
if (*y2 - *y1 == 0x10000 * (dst->y2 - dst->y1)) /* Shrinking */
|
||||
*scaley = 0;
|
||||
else
|
||||
*scaley = ((*y2 - *y1) / (dst->y2 - dst->y1)) >> 4;
|
||||
}
|
||||
|
||||
static void
|
||||
A(StopVideo)(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
|
||||
{
|
||||
ApmPortPrivPtr pPriv = (ApmPortPrivPtr)data;
|
||||
APMDECL(pScrn);
|
||||
|
||||
REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
|
||||
|
||||
pPriv->on = 0;
|
||||
A(WaitForFifo)(pApm, 1);
|
||||
WRXB(pPriv->reg, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
A(SetPortAttribute)(ScrnInfoPtr pScrn, Atom attribute, INT32 value,
|
||||
pointer data)
|
||||
{
|
||||
ApmPortPrivPtr pPriv = (ApmPortPrivPtr)data;
|
||||
/*APMDECL(pScrn);*/
|
||||
|
||||
if(attribute == xvBrightness) {
|
||||
if((value < -128) || (value > 127))
|
||||
return BadValue;
|
||||
pPriv->brightness = value;
|
||||
/* TODO : enable */
|
||||
} else if(attribute == xvContrast) {
|
||||
if((value < 0) || (value > 255))
|
||||
return BadValue;
|
||||
pPriv->contrast = value;
|
||||
/* TODO : enable */
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
ApmGetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 *value,
|
||||
pointer data)
|
||||
{
|
||||
ApmPortPrivPtr pPriv = (ApmPortPrivPtr)data;
|
||||
|
||||
if(attribute == xvBrightness) {
|
||||
*value = pPriv->brightness;
|
||||
} else
|
||||
if(attribute == xvContrast) {
|
||||
*value = pPriv->contrast;
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static void
|
||||
ApmQueryBestSize(ScrnInfoPtr pScrn, Bool motion, short vid_w, short vid_h,
|
||||
short drw_w, short drw_h,
|
||||
unsigned int *p_w, unsigned int *p_h, pointer data)
|
||||
{
|
||||
APMDECL(pScrn);
|
||||
unsigned short round = ~pApm->CurrentLayout.mask32;
|
||||
|
||||
*p_w = drw_w & round;
|
||||
*p_h = drw_h & round;
|
||||
}
|
||||
|
||||
static void A(XvMoveCB)(FBAreaPtr area1, FBAreaPtr area2)
|
||||
{
|
||||
ApmPortPrivPtr pPriv = (ApmPortPrivPtr)area1->devPrivate.ptr;
|
||||
ApmPtr pApm = pPriv->pApm;
|
||||
|
||||
pPriv->on = 0;
|
||||
A(WaitForFifo)(pApm, 1);
|
||||
WRXB(pPriv->reg, 0); /* Stop video for this port */
|
||||
pPriv->area = area2;
|
||||
}
|
||||
|
||||
static void A(XvRemoveCB)(FBAreaPtr area)
|
||||
{
|
||||
ApmPortPrivPtr pPriv = (ApmPortPrivPtr)area->devPrivate.ptr;
|
||||
ApmPtr pApm = pPriv->pApm;
|
||||
|
||||
pPriv->on = 0;
|
||||
A(WaitForFifo)(pApm, 1);
|
||||
WRXB(pPriv->reg, 0); /* Stop video for this port */
|
||||
pPriv->area = NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
A(ReputImage)(ScrnInfoPtr pScrn, short drw_x, short drw_y,
|
||||
RegionPtr clipBoxes, pointer pdata, DrawablePtr pDraw)
|
||||
{
|
||||
ScreenPtr pScreen = pScrn->pScreen;
|
||||
APMDECL(pScrn);
|
||||
ApmPortPrivPtr pPriv = pdata, pPriv0, pPriv1;
|
||||
register int fx, fy;
|
||||
CARD32 mask;
|
||||
RegionRec Union;
|
||||
RegionPtr reg0;
|
||||
int nrects, CurrY, tile;
|
||||
int X1, X2, Y1, y2, xmax, ymax;
|
||||
BoxPtr rects;
|
||||
Bool didit = 0;
|
||||
|
||||
mask = pApm->CurrentLayout.mask32;
|
||||
fx = pScrn->frameX0 & ~mask;
|
||||
fy = pScrn->frameY0 + 1;
|
||||
REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
|
||||
pPriv->x1 += drw_x - pPriv->drw_x;
|
||||
pPriv->x10 = ((pPriv->x1 + mask) & ~mask) - fx;
|
||||
pPriv->y1 += drw_y - pPriv->drw_y;
|
||||
pPriv->drw_x = drw_x;
|
||||
pPriv->drw_y = drw_y;
|
||||
A(WaitForFifo)(pApm, 2);
|
||||
WRXW(pPriv->reg + 0x06, 0xFFF - ((pPriv->scalex * pPriv->x10) & 0xFFF));
|
||||
WRXW(pPriv->reg + 0x0A, 0xFFF - ((pPriv->scaley * pPriv->y1) & 0xFFF));
|
||||
pPriv0 = (ApmPortPrivPtr)pApm->adaptor->pPortPrivates[0].ptr;
|
||||
pPriv1 = (ApmPortPrivPtr)pApm->adaptor->pPortPrivates[1].ptr;
|
||||
reg0 = &pPriv0->clip;
|
||||
bzero(&Union, sizeof Union);
|
||||
REGION_EMPTY(pScreen, &Union);
|
||||
REGION_NULL(pScreen, &Union);
|
||||
REGION_UNION(pScreen, &Union, reg0, &pPriv1->clip);
|
||||
nrects = REGION_NUM_RECTS(&Union);
|
||||
rects = REGION_RECTS(&Union);
|
||||
tile = 0x200;
|
||||
xmax = pScrn->frameX1 - pScrn->frameX0 + 1;
|
||||
ymax = pScrn->frameY1 - pScrn->frameY0;
|
||||
CurrY = -1;
|
||||
goto BEGIN_LOOP_1;
|
||||
do {
|
||||
rects++;
|
||||
BEGIN_LOOP_1:
|
||||
X1 = ((rects->x1 + mask) & ~mask) - fx;
|
||||
if (X1 < 0)
|
||||
X1 = 0;
|
||||
X2 = (rects->x2 & ~mask) - fx;
|
||||
if (X2 > xmax)
|
||||
X2 = xmax;
|
||||
y2 = rects->y2 - fy;
|
||||
} while ((X2 <= X1 || y2 < -1) && --nrects > 0);
|
||||
Y1 = rects->y1 - fy;
|
||||
|
||||
while (!(STATUS() & 0x800));
|
||||
while (STATUS() & 0x800);
|
||||
while (nrects-- > 0) {
|
||||
CARD32 reg, data;
|
||||
int x1, x2, y1;
|
||||
|
||||
x1 = X1;
|
||||
x2 = X2;
|
||||
y1 = Y1;
|
||||
if (y1 < -1) y1 = -1;
|
||||
if (y1 > ymax)
|
||||
break;
|
||||
didit = 1;
|
||||
if (y1 > CurrY) {
|
||||
A(WaitForFifo)(pApm, 3);
|
||||
WRXL(tile + 0x00, 0xFFF0011);
|
||||
WRXL(tile + 0x04, y1 << 16);
|
||||
WRXL(tile + 0x08, 0);
|
||||
tile += 16;
|
||||
}
|
||||
if (RECT_IN_REGION(pScreen, reg0, rects)) {
|
||||
pPriv = pPriv0;
|
||||
reg = (x1 << 16) | 1;
|
||||
}
|
||||
else {
|
||||
pPriv = pPriv1;
|
||||
reg = (x1 << 16) | 2;
|
||||
}
|
||||
CurrY = y2;
|
||||
if (nrects <= 0)
|
||||
goto BEGIN_LOOP_2;
|
||||
do {
|
||||
rects++;
|
||||
BEGIN_LOOP_2:
|
||||
X1 = ((rects->x1 + mask) & ~mask) - fx;
|
||||
if (X1 < 0)
|
||||
X1 = 0;
|
||||
X2 = (rects->x2 & ~mask) - fx;
|
||||
if (X2 > xmax)
|
||||
X2 = xmax;
|
||||
} while (X2 <= X1 && --nrects > 0);
|
||||
Y1 = rects->y1 - fy;
|
||||
y2 = rects->y2 - fy;
|
||||
data = pPriv->data + (((x1 - pPriv->x10)
|
||||
* pPriv->xden) / pPriv->xnum) * pPriv->Bpp +
|
||||
(((y1 - pPriv->y1 + fy) * pPriv->yden) / pPriv->ynum) * pPriv->Bps;
|
||||
A(WaitForFifo)(pApm, 4);
|
||||
if (!nrects || tile == 0x2B0 || y1 < Y1) {
|
||||
WRXL(tile , 0x10 | reg);
|
||||
}
|
||||
else {
|
||||
WRXL(tile , reg);
|
||||
}
|
||||
WRXL(tile + 0x04, x2 | (CurrY << 16));
|
||||
WRXL(tile + 0x08, (((x2-x1)*pPriv->xden+pPriv->xnum-1) / pPriv->xnum) |
|
||||
(data << 16));
|
||||
WRXB(tile + 0x0C, data >> 16);
|
||||
tile += 16;
|
||||
if (tile == 0x2C0) {
|
||||
tile = 0x200;
|
||||
break;
|
||||
}
|
||||
}
|
||||
REGION_UNINIT(pScreen, &Union);
|
||||
|
||||
if (didit) {
|
||||
A(WaitForFifo)(pApm, 1);
|
||||
WRXW(0x8E, tile - 0x200);
|
||||
}
|
||||
|
||||
if (didit ^ ((pPriv0->val | pPriv1->val) & 1)) {
|
||||
if (didit) {
|
||||
pPriv0->val |= 1;
|
||||
pPriv1->val |= 1;
|
||||
}
|
||||
else {
|
||||
pPriv0->val &= 0xFFFE;
|
||||
pPriv1->val &= 0xFFFE;
|
||||
}
|
||||
if (pPriv0->on) {
|
||||
A(WaitForFifo)(pApm, 1);
|
||||
WRXW(0x82, pPriv0->val);
|
||||
}
|
||||
if (pPriv1->on) {
|
||||
A(WaitForFifo)(pApm, 1);
|
||||
WRXW(0x92, pPriv1->val);
|
||||
}
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
A(PutImage)(ScrnInfoPtr pScrn, short src_x, short src_y,
|
||||
short drw_x, short drw_y, short src_w, short src_h,
|
||||
short drw_w, short drw_h, int id, unsigned char* buf,
|
||||
short width, short height, Bool sync, RegionPtr clipBoxes,
|
||||
pointer data, DrawablePtr pDraw)
|
||||
{
|
||||
ApmPortPrivPtr pPriv = (ApmPortPrivPtr)data;
|
||||
ScreenPtr pScreen = pScrn->pScreen;
|
||||
APMDECL(pScrn);
|
||||
INT32 x1, x2, y1, y2;
|
||||
unsigned char *dst_start;
|
||||
int pitch, Bpp, new_h, offset = 0, offset2 = 0, offset3 = 0;
|
||||
CARD32 mask;
|
||||
FBAreaPtr area;
|
||||
int srcPitch, dstPitch, srcPitch2 = 0;
|
||||
int top, left, npixels, nlines;
|
||||
BoxRec dstBox;
|
||||
CARD32 scalex, scaley, scale;
|
||||
CARD32 tmp;
|
||||
Bool offscreen;
|
||||
|
||||
offscreen = (buf < (unsigned char *)pApm->FbBase ||
|
||||
buf > (unsigned char *)pApm->FbBase + 0x400000);
|
||||
|
||||
if(drw_w > 16384) drw_w = 16384;
|
||||
|
||||
/* Clip */
|
||||
x1 = src_x;
|
||||
x2 = src_x + src_w;
|
||||
y1 = src_y;
|
||||
y2 = src_y + src_h;
|
||||
|
||||
dstBox.x1 = drw_x;
|
||||
dstBox.x2 = drw_x + drw_w;
|
||||
dstBox.y1 = drw_y;
|
||||
dstBox.y2 = drw_y + drw_h;
|
||||
|
||||
mask = pApm->CurrentLayout.mask32;
|
||||
|
||||
ApmClipVideo(&dstBox, &x1, &x2, &y1, &y2,
|
||||
REGION_EXTENTS(pScreen, clipBoxes), width, height,
|
||||
&scalex, &scaley, mask);
|
||||
|
||||
pPriv->drw_x = drw_x;
|
||||
pPriv->drw_y = drw_y;
|
||||
pPriv->xnum = drw_w;
|
||||
if (scalex)
|
||||
pPriv->xden = src_w;
|
||||
else
|
||||
pPriv->xden = drw_w; /* If image is larger than window */
|
||||
pPriv->ynum = drw_h;
|
||||
if (scaley)
|
||||
pPriv->yden = src_h;
|
||||
else
|
||||
pPriv->yden = drw_h;
|
||||
if((x1 - x2 >= 0xFFFF) || (y1 - y2 >= 0xFFFF))
|
||||
return Success;
|
||||
|
||||
Bpp = pScrn->bitsPerPixel >> 3;
|
||||
pitch = Bpp * pScrn->displayWidth;
|
||||
|
||||
switch(id) {
|
||||
case 0x32315659:
|
||||
dstPitch = ((width << 1) + 3) & ~3;
|
||||
srcPitch = (width + 3) & ~3;
|
||||
offset2 = srcPitch * height;
|
||||
srcPitch2 = ((width >> 1) + 3) & ~3;
|
||||
offset = srcPitch2 * (height >> 1);
|
||||
offset3 = offset + offset2;
|
||||
new_h = (2 * offset2 + pitch - 1) / pitch;
|
||||
break;
|
||||
case 0x59595959:
|
||||
srcPitch = width;
|
||||
dstPitch = (srcPitch + 3) & ~3;
|
||||
offset = dstPitch * height;
|
||||
new_h = (offset + pitch - 1) / pitch;
|
||||
break;
|
||||
case 0x32335652:
|
||||
srcPitch = (width << 2);
|
||||
dstPitch = (srcPitch + 3) & ~3;
|
||||
offset = dstPitch * height;
|
||||
new_h = (offset + pitch - 1) / pitch;
|
||||
break;
|
||||
default:
|
||||
if (pApm->PutImageStride)
|
||||
srcPitch = pApm->PutImageStride;
|
||||
else
|
||||
srcPitch = (width << 1);
|
||||
dstPitch = (srcPitch + 3) & ~3;
|
||||
offset = dstPitch * height;
|
||||
new_h = (offset + pitch - 1) / pitch;
|
||||
break;
|
||||
}
|
||||
|
||||
area = pPriv->area;
|
||||
|
||||
/* Allocate offscreen memory */
|
||||
if (offscreen && (!area || ((area->box.y2 - area->box.y1) < new_h))) {
|
||||
Bool nukeMem = FALSE;
|
||||
int max_w, max_h;
|
||||
|
||||
xf86QueryLargestOffscreenArea(pScreen, &max_w, &max_h, 0,
|
||||
FAVOR_WIDTH_THEN_AREA, PRIORITY_LOW);
|
||||
if (max_w == pScrn->displayWidth && max_h >= new_h) {
|
||||
area = xf86AllocateOffscreenArea(pScreen,
|
||||
pScrn->displayWidth, new_h,
|
||||
4, A(XvMoveCB), A(XvRemoveCB), pPriv);
|
||||
if (area) {
|
||||
if (pPriv->area)
|
||||
xf86FreeOffscreenArea(pPriv->area);
|
||||
}
|
||||
else
|
||||
area = pPriv->area; /* Should not happen */
|
||||
}
|
||||
if(!area) {
|
||||
if(!(area = xf86AllocateOffscreenArea(pScreen,
|
||||
pScrn->displayWidth, new_h, 4,
|
||||
A(XvMoveCB), A(XvRemoveCB), pPriv)))
|
||||
{
|
||||
nukeMem = TRUE;
|
||||
}
|
||||
} else {
|
||||
if(!xf86ResizeOffscreenArea(area, pScrn->displayWidth, new_h)) {
|
||||
xf86FreeOffscreenArea(area);
|
||||
pPriv->area = area = NULL;
|
||||
nukeMem = TRUE;
|
||||
}
|
||||
}
|
||||
if(nukeMem) {
|
||||
xf86QueryLargestOffscreenArea(pScreen, &max_w, &max_h, 0,
|
||||
FAVOR_WIDTH_THEN_AREA, PRIORITY_EXTREME);
|
||||
|
||||
if((max_w < pScrn->displayWidth) || (max_h < new_h))
|
||||
return BadAlloc;
|
||||
|
||||
xf86PurgeUnlockedOffscreenAreas(pScreen);
|
||||
|
||||
area = xf86AllocateOffscreenArea(pScreen,
|
||||
pScrn->displayWidth, new_h, 4,
|
||||
A(XvMoveCB), A(XvRemoveCB), pPriv);
|
||||
}
|
||||
|
||||
pPriv->area = area;
|
||||
}
|
||||
|
||||
/* copy data */
|
||||
pPriv->x1 = dstBox.x1 /*drw_x*/;
|
||||
pPriv->y1 = dstBox.y1 /*drw_y*/;
|
||||
top = y1 >> 16;
|
||||
left = (x1 >> 16) & ~1;
|
||||
npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
|
||||
|
||||
switch(id) {
|
||||
case 0x59595959:
|
||||
pPriv->Bpp = 1;
|
||||
break;
|
||||
default:
|
||||
pPriv->Bpp = 2;
|
||||
left <<= 1;
|
||||
break;
|
||||
case 0x32335652:
|
||||
pPriv->Bpp = 4;
|
||||
left <<= 2;
|
||||
break;
|
||||
}
|
||||
pPriv->Bps = pPriv->Bpp * pPriv->xden;
|
||||
if (offscreen) {
|
||||
offset = (area->box.y1 * pitch) + (top * dstPitch);
|
||||
dst_start = ((unsigned char *)pApm->FbBase) +
|
||||
(pPriv->data = offset + left);
|
||||
switch(id) {
|
||||
case 0x32315659:
|
||||
top &= ~1;
|
||||
tmp = ((top >> 1) * srcPitch2) + (left >> 2);
|
||||
offset2 += tmp;
|
||||
offset3 += tmp;
|
||||
nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
|
||||
xf86XVCopyYUV12ToPacked(buf + (top * srcPitch) + (left >> 1),
|
||||
buf + offset2, buf + offset3, dst_start,
|
||||
srcPitch, srcPitch2, dstPitch,
|
||||
nlines, npixels);
|
||||
break;
|
||||
default:
|
||||
if (id == 0x32335652)
|
||||
npixels <<= 1;
|
||||
else if (id == 0x59595959)
|
||||
npixels >>= 1;
|
||||
buf += (top * srcPitch) + left;
|
||||
nlines = ((y2 + 0xffff) >> 16) - top;
|
||||
if (offscreen)
|
||||
xf86XVCopyPacked(buf, dst_start, srcPitch, dstPitch,
|
||||
nlines, npixels);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
pPriv->data = buf - (unsigned char *)pApm->FbBase;
|
||||
pPriv->on = 1;
|
||||
A(WaitForFifo)(pApm, 3);
|
||||
WRXW(pPriv->reg + 0x02, dstPitch >> 2);
|
||||
WRXW(pPriv->reg + 0x04, scalex);
|
||||
WRXW(pPriv->reg + 0x08, scaley);
|
||||
pPriv->scalex = scalex;
|
||||
pPriv->scaley = scaley;
|
||||
if (scalex && scaley)
|
||||
scale = 0x0E00;
|
||||
else if (scalex)
|
||||
scale = 0x0600;
|
||||
else if (scaley)
|
||||
scale = 0x0A00;
|
||||
else
|
||||
scale = 0;
|
||||
switch(id) {
|
||||
case 0x59595959:
|
||||
pPriv->val = 0x017B | scale;
|
||||
break;
|
||||
case 0x32335652:
|
||||
pPriv->val = 0x002F | (scale & 0xF7FF);/*Smoothing filter doesn't work*/
|
||||
break;
|
||||
case 0x36315652:
|
||||
pPriv->val = 0x002B | (scale & 0xF7FF);
|
||||
break;
|
||||
case 0x35315652:
|
||||
pPriv->val = 0x0029 | (scale & 0xF7FF);
|
||||
break;
|
||||
case 0x59555956:
|
||||
pPriv->val = 0x013B | scale;
|
||||
break;
|
||||
case 0x55595659:
|
||||
pPriv->val = 0x014B | scale;
|
||||
break;
|
||||
case 0x32315659:
|
||||
case 0x59565955:
|
||||
default:
|
||||
pPriv->val = 0x016B | scale;
|
||||
break;
|
||||
}
|
||||
|
||||
(void) A(ReputImage)(pScrn, drw_x, drw_y, clipBoxes, data, pDraw);
|
||||
|
||||
A(WaitForFifo)(pApm, 1);
|
||||
WRXW(pPriv->reg, pPriv->val);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
ApmQueryImageAttributes(ScrnInfoPtr pScrn, int id,
|
||||
unsigned short *w, unsigned short *h,
|
||||
int *pitches, int *offsets)
|
||||
{
|
||||
int size, tmp;
|
||||
|
||||
if(*w > 1024) *w = 1024;
|
||||
if(*h > 1024) *h = 1024;
|
||||
|
||||
*w = (*w + 1) & ~1;
|
||||
if(offsets) offsets[0] = 0;
|
||||
|
||||
switch(id) {
|
||||
case 0x32315659:
|
||||
*h = (*h + 1) & ~1;
|
||||
size = (*w + 3) & ~3;
|
||||
if(pitches) pitches[0] = size;
|
||||
size *= *h;
|
||||
if(offsets) offsets[1] = size;
|
||||
tmp = ((*w >> 1) + 3) & ~3;
|
||||
if(pitches) pitches[1] = pitches[2] = tmp;
|
||||
tmp *= (*h >> 1);
|
||||
size += tmp;
|
||||
if(offsets) offsets[2] = size;
|
||||
size += tmp;
|
||||
break;
|
||||
case 0x59565955:
|
||||
case 0x55595659:
|
||||
case 0x59555956:
|
||||
case 0x32595559:
|
||||
size = *w << 1;
|
||||
goto common;
|
||||
case 0x59595959:
|
||||
default:
|
||||
size = *w;
|
||||
common:
|
||||
if (pitches)
|
||||
pitches[0] = size;
|
||||
size *= *h;
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
#endif
|
99
driver/xf86-video-apm/src/compat-api.h
Normal file
99
driver/xf86-video-apm/src/compat-api.h
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* Copyright 2012 Red Hat, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author: Dave Airlie <airlied@redhat.com>
|
||||
*/
|
||||
|
||||
/* this file provides API compat between server post 1.13 and pre it,
|
||||
it should be reused inside as many drivers as possible */
|
||||
#ifndef COMPAT_API_H
|
||||
#define COMPAT_API_H
|
||||
|
||||
#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
|
||||
#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
|
||||
#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
|
||||
#endif
|
||||
|
||||
#ifndef XF86_HAS_SCRN_CONV
|
||||
#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
|
||||
#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
|
||||
#endif
|
||||
|
||||
#ifndef XF86_SCRN_INTERFACE
|
||||
|
||||
#define SCRN_ARG_TYPE int
|
||||
#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
|
||||
|
||||
#define SCREEN_ARG_TYPE int
|
||||
#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
|
||||
|
||||
#define SCREEN_INIT_ARGS_DECL int scrnIndex, ScreenPtr pScreen, int argc, char **argv
|
||||
|
||||
#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
|
||||
#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
|
||||
|
||||
#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
|
||||
#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
|
||||
|
||||
#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
|
||||
#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
|
||||
|
||||
#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
|
||||
#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
|
||||
|
||||
#define FREE_SCREEN_ARGS_DECL int arg, int flags
|
||||
|
||||
#define VT_FUNC_ARGS_DECL int arg, int flags
|
||||
#define VT_FUNC_ARGS pScrn->scrnIndex, 0
|
||||
|
||||
#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
|
||||
#else
|
||||
#define SCRN_ARG_TYPE ScrnInfoPtr
|
||||
#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
|
||||
|
||||
#define SCREEN_ARG_TYPE ScreenPtr
|
||||
#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
|
||||
|
||||
#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
|
||||
|
||||
#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
|
||||
#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
|
||||
|
||||
#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
|
||||
#define CLOSE_SCREEN_ARGS pScreen
|
||||
|
||||
#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
|
||||
#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
|
||||
|
||||
#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
|
||||
#define SWITCH_MODE_ARGS(arg, m) arg, m
|
||||
|
||||
#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
|
||||
|
||||
#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
|
||||
#define VT_FUNC_ARGS pScrn
|
||||
|
||||
#define XF86_SCRN_ARG(x) (x)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue