sync code with last improvements from OpenBSD
This commit is contained in:
commit
88965415ff
26235 changed files with 29195616 additions and 0 deletions
15
lib/libXxf86dga/src/Makefile.am
Normal file
15
lib/libXxf86dga/src/Makefile.am
Normal file
|
@ -0,0 +1,15 @@
|
|||
lib_LTLIBRARIES = libXxf86dga.la
|
||||
|
||||
libXxf86dga_la_SOURCES = XF86DGA.c XF86DGA2.c
|
||||
|
||||
AM_CFLAGS = -I $(top_srcdir)/include \
|
||||
$(XXF86DGA_CFLAGS) \
|
||||
$(MALLOC_ZERO_CFLAGS) \
|
||||
$(CWARNFLAGS)
|
||||
|
||||
libXxf86dga_la_LIBADD = $(XXF86DGA_LIBS)
|
||||
libXxf86dga_la_LDFLAGS = -version-number 1:0:0
|
||||
|
||||
libXxf86dgaincludedir = $(includedir)/X11/extensions
|
||||
libXxf86dgainclude_HEADERS = $(top_srcdir)/include/X11/extensions/Xxf86dga.h \
|
||||
$(top_srcdir)/include/X11/extensions/xf86dga1.h
|
679
lib/libXxf86dga/src/Makefile.in
Normal file
679
lib/libXxf86dga/src/Makefile.in
Normal file
|
@ -0,0 +1,679 @@
|
|||
# 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@
|
||||
|
||||
|
||||
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 = $(libXxf86dgainclude_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/config.h.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 = 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)$(libdir)" \
|
||||
"$(DESTDIR)$(libXxf86dgaincludedir)"
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
am__DEPENDENCIES_1 =
|
||||
libXxf86dga_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
|
||||
am_libXxf86dga_la_OBJECTS = XF86DGA.lo XF86DGA2.lo
|
||||
libXxf86dga_la_OBJECTS = $(am_libXxf86dga_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 =
|
||||
libXxf86dga_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
|
||||
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
|
||||
$(AM_CFLAGS) $(CFLAGS) $(libXxf86dga_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@
|
||||
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 = $(libXxf86dga_la_SOURCES)
|
||||
DIST_SOURCES = $(libXxf86dga_la_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
HEADERS = $(libXxf86dgainclude_HEADERS)
|
||||
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@
|
||||
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@
|
||||
MALLOC_ZERO_CFLAGS = @MALLOC_ZERO_CFLAGS@
|
||||
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@
|
||||
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@
|
||||
XMALLOC_ZERO_CFLAGS = @XMALLOC_ZERO_CFLAGS@
|
||||
XORG_MAN_PAGE = @XORG_MAN_PAGE@
|
||||
XTMALLOC_ZERO_CFLAGS = @XTMALLOC_ZERO_CFLAGS@
|
||||
XXF86DGA_CFLAGS = @XXF86DGA_CFLAGS@
|
||||
XXF86DGA_LIBS = @XXF86DGA_LIBS@
|
||||
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@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
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@
|
||||
lib_LTLIBRARIES = libXxf86dga.la
|
||||
libXxf86dga_la_SOURCES = XF86DGA.c XF86DGA2.c
|
||||
AM_CFLAGS = -I $(top_srcdir)/include \
|
||||
$(XXF86DGA_CFLAGS) \
|
||||
$(MALLOC_ZERO_CFLAGS) \
|
||||
$(CWARNFLAGS)
|
||||
|
||||
libXxf86dga_la_LIBADD = $(XXF86DGA_LIBS)
|
||||
libXxf86dga_la_LDFLAGS = -version-number 1:0:0
|
||||
libXxf86dgaincludedir = $(includedir)/X11/extensions
|
||||
libXxf86dgainclude_HEADERS = $(top_srcdir)/include/X11/extensions/Xxf86dga.h \
|
||||
$(top_srcdir)/include/X11/extensions/xf86dga1.h
|
||||
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) 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):
|
||||
|
||||
config.h: stamp-h1
|
||||
@if test ! -f $@; then rm -f stamp-h1; else :; fi
|
||||
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status src/config.h
|
||||
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || 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)$(libdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
||||
}
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
||||
done
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
@list='$(lib_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}; \
|
||||
}
|
||||
libXxf86dga.la: $(libXxf86dga_la_OBJECTS) $(libXxf86dga_la_DEPENDENCIES) $(EXTRA_libXxf86dga_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libXxf86dga_la_LINK) -rpath $(libdir) $(libXxf86dga_la_OBJECTS) $(libXxf86dga_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XF86DGA.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XF86DGA2.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
|
||||
install-libXxf86dgaincludeHEADERS: $(libXxf86dgainclude_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(libXxf86dgainclude_HEADERS)'; test -n "$(libXxf86dgaincludedir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(libXxf86dgaincludedir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(libXxf86dgaincludedir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libXxf86dgaincludedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(libXxf86dgaincludedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-libXxf86dgaincludeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(libXxf86dgainclude_HEADERS)'; test -n "$(libXxf86dgaincludedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
dir='$(DESTDIR)$(libXxf86dgaincludedir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
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) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(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) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(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) $(HEADERS) config.h
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libXxf86dgaincludedir)"; 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-generic clean-libLTLIBRARIES clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-hdr distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-libXxf86dgaincludeHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
|
||||
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-libLTLIBRARIES \
|
||||
uninstall-libXxf86dgaincludeHEADERS
|
||||
|
||||
.MAKE: all install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libLTLIBRARIES clean-libtool cscopelist ctags distclean \
|
||||
distclean-compile distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am 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-libLTLIBRARIES \
|
||||
install-libXxf86dgaincludeHEADERS 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-libLTLIBRARIES \
|
||||
uninstall-libXxf86dgaincludeHEADERS
|
||||
|
||||
|
||||
# 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:
|
602
lib/libXxf86dga/src/XF86DGA.c
Normal file
602
lib/libXxf86dga/src/XF86DGA.c
Normal file
|
@ -0,0 +1,602 @@
|
|||
/* $XFree86: xc/lib/Xxf86dga/XF86DGA.c,v 3.23tsi Exp $ */
|
||||
/*
|
||||
|
||||
Copyright (c) 1995 Jon Tombs
|
||||
Copyright (c) 1995,1996 The XFree86 Project, Inc
|
||||
|
||||
*/
|
||||
|
||||
/* THIS IS NOT AN X CONSORTIUM STANDARD */
|
||||
|
||||
|
||||
#if defined(linux)
|
||||
#define HAS_MMAP_ANON
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
/* kernel header doesn't work with -ansi */
|
||||
/* #include <asm/page.h> */ /* PAGE_SIZE */
|
||||
#define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */
|
||||
#define HAS_GETPAGESIZE
|
||||
#endif /* linux */
|
||||
|
||||
#if defined(CSRG_BASED)
|
||||
#define HAS_MMAP_ANON
|
||||
#define HAS_GETPAGESIZE
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#endif /* CSRG_BASED */
|
||||
|
||||
#if defined(SVR4)
|
||||
#define MMAP_DEV_ZERO
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#endif /* SVR4 */
|
||||
|
||||
#ifdef XNO_SYSCONF
|
||||
#undef _SC_PAGESIZE
|
||||
#endif
|
||||
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/extensions/Xxf86dga.h>
|
||||
#include <X11/extensions/xf86dgaproto.h>
|
||||
#include <X11/extensions/Xext.h>
|
||||
#include <X11/extensions/extutil.h>
|
||||
|
||||
extern XExtDisplayInfo* xdga_find_display(Display*);
|
||||
extern const char *xdga_extension_name;
|
||||
|
||||
#define XF86DGACheckExtension(dpy,i,val) \
|
||||
XextCheckExtension (dpy, i, xdga_extension_name, val)
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* public XFree86-DGA Extension routines *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
Bool XF86DGAQueryExtension (
|
||||
Display *dpy,
|
||||
int *event_basep,
|
||||
int *error_basep
|
||||
){
|
||||
return XDGAQueryExtension(dpy, event_basep, error_basep);
|
||||
}
|
||||
|
||||
Bool XF86DGAQueryVersion(
|
||||
Display* dpy,
|
||||
int* majorVersion,
|
||||
int* minorVersion
|
||||
){
|
||||
return XDGAQueryVersion(dpy, majorVersion, minorVersion);
|
||||
}
|
||||
|
||||
Bool XF86DGAGetVideoLL(
|
||||
Display* dpy,
|
||||
int screen,
|
||||
unsigned int *offset,
|
||||
int *width,
|
||||
int *bank_size,
|
||||
int *ram_size
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXF86DGAGetVideoLLReply rep;
|
||||
xXF86DGAGetVideoLLReq *req;
|
||||
|
||||
XF86DGACheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DGAGetVideoLL, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XF86DGAGetVideoLL;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
|
||||
*offset = rep.offset;
|
||||
*width = rep.width;
|
||||
*bank_size = rep.bank_size;
|
||||
*ram_size = rep.ram_size;
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
Bool XF86DGADirectVideoLL(
|
||||
Display* dpy,
|
||||
int screen,
|
||||
int enable
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXF86DGADirectVideoReq *req;
|
||||
|
||||
XF86DGACheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DGADirectVideo, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XF86DGADirectVideo;
|
||||
req->screen = screen;
|
||||
req->enable = enable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
XSync(dpy,False);
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DGAGetViewPortSize(
|
||||
Display* dpy,
|
||||
int screen,
|
||||
int *width,
|
||||
int *height
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXF86DGAGetViewPortSizeReply rep;
|
||||
xXF86DGAGetViewPortSizeReq *req;
|
||||
|
||||
XF86DGACheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DGAGetViewPortSize, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XF86DGAGetViewPortSize;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
|
||||
*width = rep.width;
|
||||
*height = rep.height;
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
Bool XF86DGASetViewPort(
|
||||
Display* dpy,
|
||||
int screen,
|
||||
int x,
|
||||
int y
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXF86DGASetViewPortReq *req;
|
||||
|
||||
XF86DGACheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DGASetViewPort, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XF86DGASetViewPort;
|
||||
req->screen = screen;
|
||||
req->x = x;
|
||||
req->y = y;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
XSync(dpy,False);
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
Bool XF86DGAGetVidPage(
|
||||
Display* dpy,
|
||||
int screen,
|
||||
int *vpage
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXF86DGAGetVidPageReply rep;
|
||||
xXF86DGAGetVidPageReq *req;
|
||||
|
||||
XF86DGACheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DGAGetVidPage, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XF86DGAGetVidPage;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
|
||||
*vpage = rep.vpage;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
Bool XF86DGASetVidPage(
|
||||
Display* dpy,
|
||||
int screen,
|
||||
int vpage
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXF86DGASetVidPageReq *req;
|
||||
|
||||
XF86DGACheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DGASetVidPage, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XF86DGASetVidPage;
|
||||
req->screen = screen;
|
||||
req->vpage = vpage;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
XSync(dpy,False);
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DGAInstallColormap(
|
||||
Display* dpy,
|
||||
int screen,
|
||||
Colormap cmap
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXF86DGAInstallColormapReq *req;
|
||||
|
||||
XF86DGACheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DGAInstallColormap, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XF86DGAInstallColormap;
|
||||
req->screen = screen;
|
||||
req->id = cmap;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
XSync(dpy,False);
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DGAQueryDirectVideo(
|
||||
Display *dpy,
|
||||
int screen,
|
||||
int *flags
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXF86DGAQueryDirectVideoReply rep;
|
||||
xXF86DGAQueryDirectVideoReq *req;
|
||||
|
||||
XF86DGACheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DGAQueryDirectVideo, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XF86DGAQueryDirectVideo;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
*flags = rep.flags;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DGAViewPortChanged(
|
||||
Display *dpy,
|
||||
int screen,
|
||||
int n
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXF86DGAViewPortChangedReply rep;
|
||||
xXF86DGAViewPortChangedReq *req;
|
||||
|
||||
XF86DGACheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DGAViewPortChanged, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XF86DGAViewPortChanged;
|
||||
req->screen = screen;
|
||||
req->n = n;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return rep.result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Helper functions */
|
||||
|
||||
#include <X11/Xmd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(SVR4) && !defined(sun)
|
||||
#define DEV_MEM "/dev/pmem"
|
||||
#elif defined(SVR4) && defined(sun)
|
||||
#define DEV_MEM "/dev/xsvc"
|
||||
#elif defined(HAS_APERTURE_DRV)
|
||||
#define DEV_MEM "/dev/xf86"
|
||||
#else
|
||||
#define DEV_MEM "/dev/mem"
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
unsigned long physaddr; /* actual requested physical address */
|
||||
unsigned long size; /* actual requested map size */
|
||||
unsigned long delta; /* delta to account for page alignment */
|
||||
void * vaddr; /* mapped address, without the delta */
|
||||
int refcount; /* reference count */
|
||||
} MapRec, *MapPtr;
|
||||
|
||||
typedef struct {
|
||||
Display * display;
|
||||
int screen;
|
||||
MapPtr map;
|
||||
} ScrRec, *ScrPtr;
|
||||
|
||||
static int mapFd = -1;
|
||||
static int numMaps = 0;
|
||||
static int numScrs = 0;
|
||||
static MapPtr *mapList = NULL;
|
||||
static ScrPtr *scrList = NULL;
|
||||
|
||||
static MapPtr
|
||||
AddMap(void)
|
||||
{
|
||||
MapPtr *old;
|
||||
|
||||
old = mapList;
|
||||
mapList = realloc(mapList, sizeof(MapPtr) * (numMaps + 1));
|
||||
if (!mapList) {
|
||||
mapList = old;
|
||||
return NULL;
|
||||
}
|
||||
mapList[numMaps] = malloc(sizeof(MapRec));
|
||||
if (!mapList[numMaps])
|
||||
return NULL;
|
||||
return mapList[numMaps++];
|
||||
}
|
||||
|
||||
static ScrPtr
|
||||
AddScr(void)
|
||||
{
|
||||
ScrPtr *old;
|
||||
|
||||
old = scrList;
|
||||
scrList = realloc(scrList, sizeof(ScrPtr) * (numScrs + 1));
|
||||
if (!scrList) {
|
||||
scrList = old;
|
||||
return NULL;
|
||||
}
|
||||
scrList[numScrs] = malloc(sizeof(ScrRec));
|
||||
if (!scrList[numScrs])
|
||||
return NULL;
|
||||
return scrList[numScrs++];
|
||||
}
|
||||
|
||||
static MapPtr
|
||||
FindMap(unsigned long address, unsigned long size)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numMaps; i++) {
|
||||
if (mapList[i]->physaddr == address &&
|
||||
mapList[i]->size == size)
|
||||
return mapList[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ScrPtr
|
||||
FindScr(Display *display, int screen)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numScrs; i++) {
|
||||
if (scrList[i]->display == display &&
|
||||
scrList[i]->screen == screen)
|
||||
return scrList[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *
|
||||
MapPhysAddress(unsigned long address, unsigned long size)
|
||||
{
|
||||
unsigned long offset, delta;
|
||||
int pagesize = -1;
|
||||
void *vaddr;
|
||||
MapPtr mp;
|
||||
|
||||
if ((mp = FindMap(address, size))) {
|
||||
mp->refcount++;
|
||||
return (void *)((unsigned long)mp->vaddr + mp->delta);
|
||||
}
|
||||
|
||||
#if defined(_SC_PAGESIZE) && defined(HAS_SC_PAGESIZE)
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
#endif
|
||||
#ifdef _SC_PAGE_SIZE
|
||||
if (pagesize == -1)
|
||||
pagesize = sysconf(_SC_PAGE_SIZE);
|
||||
#endif
|
||||
#ifdef HAS_GETPAGESIZE
|
||||
if (pagesize == -1)
|
||||
pagesize = getpagesize();
|
||||
#endif
|
||||
#ifdef PAGE_SIZE
|
||||
if (pagesize == -1)
|
||||
pagesize = PAGE_SIZE;
|
||||
#endif
|
||||
if (pagesize == -1)
|
||||
pagesize = 4096;
|
||||
|
||||
delta = address % pagesize;
|
||||
offset = address - delta;
|
||||
#ifndef MAP_FILE
|
||||
#define MAP_FILE 0
|
||||
#endif
|
||||
if (mapFd < 0) {
|
||||
if ((mapFd = open(DEV_MEM, O_RDWR)) < 0)
|
||||
return NULL;
|
||||
}
|
||||
vaddr = (void *)mmap(NULL, size + delta, PROT_READ | PROT_WRITE,
|
||||
MAP_FILE | MAP_SHARED, mapFd, (off_t)offset);
|
||||
if (vaddr == (void *)-1)
|
||||
return NULL;
|
||||
|
||||
if (!vaddr) {
|
||||
if (!(mp = AddMap()))
|
||||
return NULL;
|
||||
mp->physaddr = address;
|
||||
mp->size = size;
|
||||
mp->delta = delta;
|
||||
mp->vaddr = vaddr;
|
||||
mp->refcount = 1;
|
||||
}
|
||||
return (void *)((unsigned long)vaddr + delta);
|
||||
}
|
||||
|
||||
/*
|
||||
* Still need to find a clean way of detecting the death of a DGA app
|
||||
* and returning things to normal - Jon
|
||||
* This is here to help debugging without rebooting... Also C-A-BS
|
||||
* should restore text mode.
|
||||
*/
|
||||
|
||||
int
|
||||
XF86DGAForkApp(int screen)
|
||||
{
|
||||
pid_t pid;
|
||||
int status;
|
||||
int i;
|
||||
|
||||
/* fork the app, parent hangs around to clean up */
|
||||
if ((pid = fork()) > 0) {
|
||||
ScrPtr sp;
|
||||
|
||||
waitpid(pid, &status, 0);
|
||||
for (i = 0; i < numScrs; i++) {
|
||||
sp = scrList[i];
|
||||
XF86DGADirectVideoLL(sp->display, sp->screen, 0);
|
||||
XSync(sp->display, False);
|
||||
}
|
||||
if (WIFEXITED(status))
|
||||
_exit(0);
|
||||
else
|
||||
_exit(-1);
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
XF86DGADirectVideo(
|
||||
Display *dis,
|
||||
int screen,
|
||||
int enable
|
||||
){
|
||||
ScrPtr sp;
|
||||
MapPtr mp = NULL;
|
||||
|
||||
if ((sp = FindScr(dis, screen)))
|
||||
mp = sp->map;
|
||||
|
||||
if (enable & XF86DGADirectGraphics) {
|
||||
if (mp && mp->vaddr)
|
||||
mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ | PROT_WRITE);
|
||||
} else {
|
||||
if (mp && mp->vaddr)
|
||||
mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ);
|
||||
}
|
||||
|
||||
XF86DGADirectVideoLL(dis, screen, enable);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
XF86cleanup(int sig)
|
||||
{
|
||||
ScrPtr sp;
|
||||
int i;
|
||||
static char beenhere = 0;
|
||||
|
||||
if (beenhere)
|
||||
_exit(3);
|
||||
beenhere = 1;
|
||||
|
||||
for (i = 0; i < numScrs; i++) {
|
||||
sp = scrList[i];
|
||||
XF86DGADirectVideo(sp->display, sp->screen, 0);
|
||||
XSync(sp->display, False);
|
||||
}
|
||||
_exit(3);
|
||||
}
|
||||
|
||||
Bool
|
||||
XF86DGAGetVideo(
|
||||
Display *dis,
|
||||
int screen,
|
||||
char **addr,
|
||||
int *width,
|
||||
int *bank,
|
||||
int *ram
|
||||
){
|
||||
unsigned int offset;
|
||||
static int beenHere = 0;
|
||||
ScrPtr sp;
|
||||
MapPtr mp;
|
||||
|
||||
if (!(sp = FindScr(dis, screen))) {
|
||||
if (!(sp = AddScr())) {
|
||||
fprintf(stderr, "XF86DGAGetVideo: malloc failure\n");
|
||||
exit(-2);
|
||||
}
|
||||
sp->display = dis;
|
||||
sp->screen = screen;
|
||||
sp->map = NULL;
|
||||
}
|
||||
|
||||
XF86DGAGetVideoLL(dis, screen , &offset, width, bank, ram);
|
||||
|
||||
*addr = MapPhysAddress(offset, *bank);
|
||||
if (*addr == NULL) {
|
||||
fprintf(stderr, "XF86DGAGetVideo: failed to map video memory (%s)\n",
|
||||
strerror(errno));
|
||||
exit(-2);
|
||||
}
|
||||
|
||||
if ((mp = FindMap(offset, *bank)))
|
||||
sp->map = mp;
|
||||
|
||||
if (!beenHere) {
|
||||
beenHere = 1;
|
||||
atexit((void(*)(void))XF86cleanup);
|
||||
/* one shot XF86cleanup attempts */
|
||||
signal(SIGSEGV, XF86cleanup);
|
||||
#ifdef SIGBUS
|
||||
signal(SIGBUS, XF86cleanup);
|
||||
#endif
|
||||
signal(SIGHUP, XF86cleanup);
|
||||
signal(SIGFPE, XF86cleanup);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
903
lib/libXxf86dga/src/XF86DGA2.c
Normal file
903
lib/libXxf86dga/src/XF86DGA2.c
Normal file
|
@ -0,0 +1,903 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 1995 Jon Tombs
|
||||
Copyright (c) 1995,1996 The XFree86 Project, Inc
|
||||
|
||||
*/
|
||||
|
||||
/* THIS IS NOT AN X CONSORTIUM STANDARD */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/extensions/Xxf86dga.h>
|
||||
#include <X11/extensions/xf86dgaproto.h>
|
||||
#include <X11/extensions/Xext.h>
|
||||
#include <X11/extensions/extutil.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* If you change this, change the Bases[] array below as well */
|
||||
#define MAX_HEADS 16
|
||||
|
||||
const char *xdga_extension_name = XF86DGANAME;
|
||||
|
||||
static XExtensionInfo _xdga_info_data;
|
||||
static XExtensionInfo *xdga_info = &_xdga_info_data;
|
||||
|
||||
|
||||
Bool XDGAMapFramebuffer(int, char *, unsigned char*, CARD32, CARD32, CARD32);
|
||||
void XDGAUnmapFramebuffer(int);
|
||||
unsigned char* XDGAGetMappedMemory(int);
|
||||
|
||||
#define XDGACheckExtension(dpy,i,val) \
|
||||
XextCheckExtension (dpy, i, xdga_extension_name, val)
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* private utility routines *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
static int xdga_close_display(Display *dpy, XExtCodes *codes);
|
||||
static Bool xdga_wire_to_event(Display *dpy, XEvent *event, xEvent *wire_ev);
|
||||
static Status xdga_event_to_wire(Display *dpy, XEvent *event, xEvent *wire_ev);
|
||||
|
||||
static XExtensionHooks xdga_extension_hooks = {
|
||||
NULL, /* create_gc */
|
||||
NULL, /* copy_gc */
|
||||
NULL, /* flush_gc */
|
||||
NULL, /* free_gc */
|
||||
NULL, /* create_font */
|
||||
NULL, /* free_font */
|
||||
xdga_close_display, /* close_display */
|
||||
xdga_wire_to_event, /* wire_to_event */
|
||||
xdga_event_to_wire, /* event_to_wire */
|
||||
NULL, /* error */
|
||||
NULL, /* error_string */
|
||||
};
|
||||
|
||||
static XEXT_GENERATE_CLOSE_DISPLAY (xdga_close_display, xdga_info)
|
||||
|
||||
|
||||
XExtDisplayInfo* xdga_find_display(Display*);
|
||||
XEXT_GENERATE_FIND_DISPLAY (xdga_find_display, xdga_info,
|
||||
"XFree86-DGA",
|
||||
&xdga_extension_hooks,
|
||||
0, NULL)
|
||||
|
||||
|
||||
static Status
|
||||
xdga_event_to_wire(
|
||||
Display *dpy,
|
||||
XEvent *event,
|
||||
xEvent *wire_ev
|
||||
){
|
||||
return True;
|
||||
}
|
||||
|
||||
static Bool
|
||||
xdga_wire_to_event(
|
||||
Display *dpy,
|
||||
XEvent *event,
|
||||
xEvent *wire_ev
|
||||
){
|
||||
dgaEvent *wire = (dgaEvent *) wire_ev;
|
||||
XDGAButtonEvent *bevent;
|
||||
XDGAKeyEvent *kevent;
|
||||
XDGAMotionEvent *mevent;
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
|
||||
XDGACheckExtension (dpy, info, False);
|
||||
|
||||
switch((wire->u.u.type & 0x7f) - info->codes->first_event) {
|
||||
case MotionNotify:
|
||||
mevent = (XDGAMotionEvent*)event;
|
||||
mevent->type = wire->u.u.type & 0x7F;
|
||||
mevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
|
||||
mevent->display = dpy;
|
||||
mevent->screen = wire->u.event.screen;
|
||||
mevent->time = wire->u.event.time;
|
||||
mevent->state = wire->u.event.state;
|
||||
mevent->dx = wire->u.event.dx;
|
||||
mevent->dy = wire->u.event.dy;
|
||||
return True;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
bevent = (XDGAButtonEvent*)event;
|
||||
bevent->type = wire->u.u.type & 0x7F;
|
||||
bevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
|
||||
bevent->display = dpy;
|
||||
bevent->screen = wire->u.event.screen;
|
||||
bevent->time = wire->u.event.time;
|
||||
bevent->state = wire->u.event.state;
|
||||
bevent->button = wire->u.u.detail;
|
||||
return True;
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
kevent = (XDGAKeyEvent*)event;
|
||||
kevent->type = wire->u.u.type & 0x7F;
|
||||
kevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
|
||||
kevent->display = dpy;
|
||||
kevent->screen = wire->u.event.screen;
|
||||
kevent->time = wire->u.event.time;
|
||||
kevent->state = wire->u.event.state;
|
||||
kevent->keycode = wire->u.u.detail;
|
||||
return True;
|
||||
}
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
Bool XDGAQueryExtension (
|
||||
Display *dpy,
|
||||
int *event_basep,
|
||||
int *error_basep
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
|
||||
if (XextHasExtension(info)) {
|
||||
*event_basep = info->codes->first_event;
|
||||
*error_basep = info->codes->first_error;
|
||||
return True;
|
||||
} else {
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Bool XDGAQueryVersion(
|
||||
Display *dpy,
|
||||
int *majorVersion,
|
||||
int *minorVersion
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGAQueryVersionReply rep;
|
||||
xXDGAQueryVersionReq *req;
|
||||
|
||||
XDGACheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGAQueryVersion, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGAQueryVersion;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
*majorVersion = rep.majorVersion;
|
||||
*minorVersion = rep.minorVersion;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
if (*majorVersion >= 2)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 0, j = info->codes->first_event;
|
||||
i < XF86DGANumberEvents;
|
||||
i++, j++)
|
||||
{
|
||||
XESetWireToEvent (dpy, j, xdga_wire_to_event);
|
||||
XESetEventToWire (dpy, j, xdga_event_to_wire);
|
||||
}
|
||||
XDGASetClientVersion(dpy);
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XDGASetClientVersion(
|
||||
Display *dpy
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGASetClientVersionReq *req;
|
||||
|
||||
XDGACheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGASetClientVersion, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGASetClientVersion;
|
||||
req->major = XDGA_MAJOR_VERSION;
|
||||
req->minor = XDGA_MINOR_VERSION;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XDGAOpenFramebuffer(
|
||||
Display *dpy,
|
||||
int screen
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGAOpenFramebufferReply rep;
|
||||
xXDGAOpenFramebufferReq *req;
|
||||
char *deviceName = NULL;
|
||||
Bool ret;
|
||||
|
||||
XDGACheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGAOpenFramebuffer, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGAOpenFramebuffer;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
|
||||
if (rep.length) {
|
||||
if (rep.length < (INT_MAX >> 2)) {
|
||||
unsigned long size = rep.length << 2;
|
||||
deviceName = Xmalloc(size);
|
||||
_XRead(dpy, deviceName, size);
|
||||
deviceName[size - 1] = '\0';
|
||||
} else
|
||||
_XEatDataWords(dpy, rep.length);
|
||||
}
|
||||
|
||||
ret = XDGAMapFramebuffer(screen, deviceName,
|
||||
(unsigned char*)(long)rep.mem1,
|
||||
rep.size, rep.offset, rep.extra);
|
||||
|
||||
if(deviceName)
|
||||
Xfree(deviceName);
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void XDGACloseFramebuffer(
|
||||
Display *dpy,
|
||||
int screen
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGACloseFramebufferReq *req;
|
||||
|
||||
XextSimpleCheckExtension (dpy, info, xdga_extension_name);
|
||||
|
||||
XDGAUnmapFramebuffer(screen);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGACloseFramebuffer, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGACloseFramebuffer;
|
||||
req->screen = screen;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
XDGAMode* XDGAQueryModes(
|
||||
Display *dpy,
|
||||
int screen,
|
||||
int *num
|
||||
){
|
||||
XExtDisplayInfo *dinfo = xdga_find_display (dpy);
|
||||
xXDGAQueryModesReply rep;
|
||||
xXDGAQueryModesReq *req;
|
||||
XDGAMode *modes = NULL;
|
||||
|
||||
*num = 0;
|
||||
|
||||
XDGACheckExtension (dpy, dinfo, NULL);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGAQueryModes, req);
|
||||
req->reqType = dinfo->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGAQueryModes;
|
||||
req->screen = screen;
|
||||
|
||||
if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
if(rep.length) {
|
||||
xXDGAModeInfo info;
|
||||
unsigned long size = 0;
|
||||
char *offset;
|
||||
|
||||
if ((rep.length < (INT_MAX >> 2)) &&
|
||||
(rep.number < (INT_MAX / sizeof(XDGAMode)))) {
|
||||
size = rep.length << 2;
|
||||
if (size > (rep.number * sz_xXDGAModeInfo)) {
|
||||
size -= rep.number * sz_xXDGAModeInfo; /* find text size */
|
||||
modes = Xmalloc((rep.number * sizeof(XDGAMode)) + size);
|
||||
offset = (char*)(&modes[rep.number]); /* start of text */
|
||||
}
|
||||
}
|
||||
|
||||
if (modes != NULL) {
|
||||
unsigned int i;
|
||||
for(i = 0; i < rep.number; i++) {
|
||||
_XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
|
||||
|
||||
modes[i].num = info.num;
|
||||
modes[i].verticalRefresh =
|
||||
(float)info.vsync_num / (float)info.vsync_den;
|
||||
modes[i].flags = info.flags;
|
||||
modes[i].imageWidth = info.image_width;
|
||||
modes[i].imageHeight = info.image_height;
|
||||
modes[i].pixmapWidth = info.pixmap_width;
|
||||
modes[i].pixmapHeight = info.pixmap_height;
|
||||
modes[i].bytesPerScanline = info.bytes_per_scanline;
|
||||
modes[i].byteOrder = info.byte_order;
|
||||
modes[i].depth = info.depth;
|
||||
modes[i].bitsPerPixel = info.bpp;
|
||||
modes[i].redMask = info.red_mask;
|
||||
modes[i].greenMask = info.green_mask;
|
||||
modes[i].blueMask = info.blue_mask;
|
||||
modes[i].visualClass = info.visual_class;
|
||||
modes[i].viewportWidth = info.viewport_width;
|
||||
modes[i].viewportHeight = info.viewport_height;
|
||||
modes[i].xViewportStep = info.viewport_xstep;
|
||||
modes[i].yViewportStep = info.viewport_ystep;
|
||||
modes[i].maxViewportX = info.viewport_xmax;
|
||||
modes[i].maxViewportY = info.viewport_ymax;
|
||||
modes[i].viewportFlags = info.viewport_flags;
|
||||
modes[i].reserved1 = info.reserved1;
|
||||
modes[i].reserved2 = info.reserved2;
|
||||
|
||||
if (info.name_size > 0 && info.name_size <= size) {
|
||||
_XRead(dpy, offset, info.name_size);
|
||||
modes[i].name = offset;
|
||||
modes[i].name[info.name_size - 1] = '\0';
|
||||
offset += info.name_size;
|
||||
size -= info.name_size;
|
||||
} else {
|
||||
_XEatData(dpy, info.name_size);
|
||||
modes[i].name = NULL;
|
||||
}
|
||||
}
|
||||
*num = rep.number;
|
||||
} else
|
||||
_XEatDataWords(dpy, rep.length);
|
||||
}
|
||||
}
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return modes;
|
||||
}
|
||||
|
||||
|
||||
XDGADevice *
|
||||
XDGASetMode(
|
||||
Display *dpy,
|
||||
int screen,
|
||||
int mode
|
||||
){
|
||||
XExtDisplayInfo *dinfo = xdga_find_display (dpy);
|
||||
xXDGASetModeReply rep;
|
||||
xXDGASetModeReq *req;
|
||||
XDGADevice *dev = NULL;
|
||||
Pixmap pid;
|
||||
|
||||
XDGACheckExtension (dpy, dinfo, NULL);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGASetMode, req);
|
||||
req->reqType = dinfo->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGASetMode;
|
||||
req->screen = screen;
|
||||
req->mode = mode;
|
||||
req->pid = pid = XAllocID(dpy);
|
||||
|
||||
if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
if(rep.length) {
|
||||
xXDGAModeInfo info;
|
||||
unsigned long size;
|
||||
|
||||
if ((rep.length < (INT_MAX >> 2)) &&
|
||||
(rep.length > (sz_xXDGAModeInfo >> 2))) {
|
||||
size = rep.length << 2;
|
||||
size -= sz_xXDGAModeInfo; /* get text size */
|
||||
|
||||
dev = Xmalloc(sizeof(XDGADevice) + size);
|
||||
}
|
||||
|
||||
if(dev) {
|
||||
_XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
|
||||
|
||||
dev->mode.num = info.num;
|
||||
dev->mode.verticalRefresh =
|
||||
(float)info.vsync_num / (float)info.vsync_den;
|
||||
dev->mode.flags = info.flags;
|
||||
dev->mode.imageWidth = info.image_width;
|
||||
dev->mode.imageHeight = info.image_height;
|
||||
dev->mode.pixmapWidth = info.pixmap_width;
|
||||
dev->mode.pixmapHeight = info.pixmap_height;
|
||||
dev->mode.bytesPerScanline = info.bytes_per_scanline;
|
||||
dev->mode.byteOrder = info.byte_order;
|
||||
dev->mode.depth = info.depth;
|
||||
dev->mode.bitsPerPixel = info.bpp;
|
||||
dev->mode.redMask = info.red_mask;
|
||||
dev->mode.greenMask = info.green_mask;
|
||||
dev->mode.blueMask = info.blue_mask;
|
||||
dev->mode.visualClass = info.visual_class;
|
||||
dev->mode.viewportWidth = info.viewport_width;
|
||||
dev->mode.viewportHeight = info.viewport_height;
|
||||
dev->mode.xViewportStep = info.viewport_xstep;
|
||||
dev->mode.yViewportStep = info.viewport_ystep;
|
||||
dev->mode.maxViewportX = info.viewport_xmax;
|
||||
dev->mode.maxViewportY = info.viewport_ymax;
|
||||
dev->mode.viewportFlags = info.viewport_flags;
|
||||
dev->mode.reserved1 = info.reserved1;
|
||||
dev->mode.reserved2 = info.reserved2;
|
||||
|
||||
if (info.name_size > 0 && info.name_size <= size) {
|
||||
dev->mode.name = (char*)(&dev[1]);
|
||||
_XRead(dpy, dev->mode.name, info.name_size);
|
||||
dev->mode.name[info.name_size - 1] = '\0';
|
||||
} else {
|
||||
dev->mode.name = NULL;
|
||||
_XEatDataWords(dpy, rep.length);
|
||||
}
|
||||
|
||||
dev->pixmap = (rep.flags & XDGAPixmap) ? pid : 0;
|
||||
dev->data = XDGAGetMappedMemory(screen);
|
||||
|
||||
if(dev->data)
|
||||
dev->data += rep.offset;
|
||||
}
|
||||
/* not sure what to do if the allocation fails */
|
||||
else
|
||||
_XEatDataWords(dpy, rep.length);
|
||||
}
|
||||
}
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
void XDGASetViewport(
|
||||
Display *dpy,
|
||||
int screen,
|
||||
int x,
|
||||
int y,
|
||||
int flags
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGASetViewportReq *req;
|
||||
|
||||
XextSimpleCheckExtension (dpy, info, xdga_extension_name);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGASetViewport, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGASetViewport;
|
||||
req->screen = screen;
|
||||
req->x = x;
|
||||
req->y = y;
|
||||
req->flags = flags;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
|
||||
void XDGAInstallColormap(
|
||||
Display *dpy,
|
||||
int screen,
|
||||
Colormap cmap
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGAInstallColormapReq *req;
|
||||
|
||||
XextSimpleCheckExtension (dpy, info, xdga_extension_name);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGAInstallColormap, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGAInstallColormap;
|
||||
req->screen = screen;
|
||||
req->cmap = cmap;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
void XDGASelectInput(
|
||||
Display *dpy,
|
||||
int screen,
|
||||
long mask
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGASelectInputReq *req;
|
||||
|
||||
XextSimpleCheckExtension (dpy, info, xdga_extension_name);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGASelectInput, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGASelectInput;
|
||||
req->screen = screen;
|
||||
req->mask = mask;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
void XDGAFillRectangle(
|
||||
Display *dpy,
|
||||
int screen,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned long color
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGAFillRectangleReq *req;
|
||||
|
||||
XextSimpleCheckExtension (dpy, info, xdga_extension_name);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGAFillRectangle, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGAFillRectangle;
|
||||
req->screen = screen;
|
||||
req->x = x;
|
||||
req->y = y;
|
||||
req->width = width;
|
||||
req->height = height;
|
||||
req->color = color;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
void XDGACopyArea(
|
||||
Display *dpy,
|
||||
int screen,
|
||||
int srcx,
|
||||
int srcy,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
int dstx,
|
||||
int dsty
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGACopyAreaReq *req;
|
||||
|
||||
XextSimpleCheckExtension (dpy, info, xdga_extension_name);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGACopyArea, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGACopyArea;
|
||||
req->screen = screen;
|
||||
req->srcx = srcx;
|
||||
req->srcy = srcy;
|
||||
req->width = width;
|
||||
req->height = height;
|
||||
req->dstx = dstx;
|
||||
req->dsty = dsty;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
void XDGACopyTransparentArea(
|
||||
Display *dpy,
|
||||
int screen,
|
||||
int srcx,
|
||||
int srcy,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
int dstx,
|
||||
int dsty,
|
||||
unsigned long key
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGACopyTransparentAreaReq *req;
|
||||
|
||||
XextSimpleCheckExtension (dpy, info, xdga_extension_name);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGACopyTransparentArea, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGACopyTransparentArea;
|
||||
req->screen = screen;
|
||||
req->srcx = srcx;
|
||||
req->srcy = srcy;
|
||||
req->width = width;
|
||||
req->height = height;
|
||||
req->dstx = dstx;
|
||||
req->dsty = dsty;
|
||||
req->key = key;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
|
||||
int XDGAGetViewportStatus(
|
||||
Display *dpy,
|
||||
int screen
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGAGetViewportStatusReply rep;
|
||||
xXDGAGetViewportStatusReq *req;
|
||||
int status = 0;
|
||||
|
||||
XDGACheckExtension (dpy, info, 0);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGAGetViewportStatus, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGAGetViewportStatus;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse))
|
||||
status = rep.status;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return status;
|
||||
}
|
||||
|
||||
void XDGASync(
|
||||
Display *dpy,
|
||||
int screen
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGASyncReply rep;
|
||||
xXDGASyncReq *req;
|
||||
|
||||
XextSimpleCheckExtension (dpy, info, xdga_extension_name);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGASync, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGASync;
|
||||
req->screen = screen;
|
||||
_XReply(dpy, (xReply *)&rep, 0, xFalse);
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
|
||||
void XDGAChangePixmapMode(
|
||||
Display *dpy,
|
||||
int screen,
|
||||
int *x,
|
||||
int *y,
|
||||
int mode
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGAChangePixmapModeReq *req;
|
||||
xXDGAChangePixmapModeReply rep;
|
||||
|
||||
XextSimpleCheckExtension (dpy, info, xdga_extension_name);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGAChangePixmapMode, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGAChangePixmapMode;
|
||||
req->screen = screen;
|
||||
req->x = *x;
|
||||
req->y = *y;
|
||||
req->flags = mode;
|
||||
_XReply(dpy, (xReply *)&rep, 0, xFalse);
|
||||
*x = rep.x;
|
||||
*y = rep.y;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
Colormap XDGACreateColormap(
|
||||
Display *dpy,
|
||||
int screen,
|
||||
XDGADevice *dev,
|
||||
int alloc
|
||||
){
|
||||
XExtDisplayInfo *info = xdga_find_display (dpy);
|
||||
xXDGACreateColormapReq *req;
|
||||
Colormap cid;
|
||||
|
||||
XDGACheckExtension (dpy, info, -1);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XDGACreateColormap, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dgaReqType = X_XDGACreateColormap;
|
||||
req->screen = screen;
|
||||
req->mode = dev->mode.num;
|
||||
req->alloc = alloc;
|
||||
cid = req->id = XAllocID(dpy);
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return cid;
|
||||
}
|
||||
|
||||
|
||||
void XDGAKeyEventToXKeyEvent(
|
||||
XDGAKeyEvent* dk,
|
||||
XKeyEvent* xk
|
||||
){
|
||||
xk->type = dk->type;
|
||||
xk->serial = dk->serial;
|
||||
xk->send_event = False;
|
||||
xk->display = dk->display;
|
||||
xk->window = RootWindow(dk->display, dk->screen);
|
||||
xk->root = xk->window;
|
||||
xk->subwindow = None;
|
||||
xk->time = dk->time;
|
||||
xk->x = xk->y = xk->x_root = xk->y_root = 0;
|
||||
xk->state = dk->state;
|
||||
xk->keycode = dk->keycode;
|
||||
xk->same_screen = True;
|
||||
}
|
||||
|
||||
#include <X11/Xmd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(SVR4) && !defined(sun)
|
||||
#define DEV_MEM "/dev/pmem"
|
||||
#elif defined(SVR4) && defined(sun)
|
||||
#define DEV_MEM "/dev/xsvc"
|
||||
#elif defined(HAS_APERTURE_DRV)
|
||||
#define DEV_MEM "/dev/xf86"
|
||||
#else
|
||||
#define DEV_MEM "/dev/mem"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef struct _DGAMapRec{
|
||||
unsigned char *physical;
|
||||
unsigned char *virtual;
|
||||
CARD32 size;
|
||||
int fd;
|
||||
int screen;
|
||||
struct _DGAMapRec *next;
|
||||
} DGAMapRec, *DGAMapPtr;
|
||||
|
||||
static Bool
|
||||
DGAMapPhysical(int, const char*, unsigned char*, CARD32, CARD32, CARD32, DGAMapPtr);
|
||||
static void DGAUnmapPhysical(DGAMapPtr);
|
||||
|
||||
static DGAMapPtr _Maps = NULL;
|
||||
|
||||
|
||||
unsigned char*
|
||||
XDGAGetMappedMemory(int screen)
|
||||
{
|
||||
DGAMapPtr pMap = _Maps;
|
||||
unsigned char *pntr = NULL;
|
||||
|
||||
while(pMap != NULL) {
|
||||
if(pMap->screen == screen) {
|
||||
pntr = pMap->virtual;
|
||||
break;
|
||||
}
|
||||
pMap = pMap->next;
|
||||
}
|
||||
|
||||
return pntr;
|
||||
}
|
||||
|
||||
Bool
|
||||
XDGAMapFramebuffer(
|
||||
int screen,
|
||||
char *name, /* optional device name */
|
||||
unsigned char* base, /* physical memory */
|
||||
CARD32 size, /* size */
|
||||
CARD32 offset, /* optional offset */
|
||||
CARD32 extra /* optional extra data */
|
||||
){
|
||||
DGAMapPtr pMap = _Maps;
|
||||
Bool result;
|
||||
|
||||
/* is it already mapped ? */
|
||||
while(pMap != NULL) {
|
||||
if(pMap->screen == screen)
|
||||
return True;
|
||||
pMap = pMap->next;
|
||||
}
|
||||
|
||||
if(extra & XDGANeedRoot) {
|
||||
/* we should probably check if we have root permissions and
|
||||
return False here */
|
||||
|
||||
}
|
||||
|
||||
pMap = (DGAMapPtr)Xmalloc(sizeof(DGAMapRec));
|
||||
|
||||
result = DGAMapPhysical(screen, name, base, size, offset, extra, pMap);
|
||||
|
||||
if(result) {
|
||||
pMap->next = _Maps;
|
||||
_Maps = pMap;
|
||||
} else
|
||||
Xfree(pMap);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
XDGAUnmapFramebuffer(int screen)
|
||||
{
|
||||
DGAMapPtr pMap = _Maps;
|
||||
DGAMapPtr pPrev = NULL;
|
||||
|
||||
/* is it already mapped */
|
||||
while(pMap != NULL) {
|
||||
if(pMap->screen == screen)
|
||||
break;
|
||||
pPrev = pMap;
|
||||
pMap = pMap->next;
|
||||
}
|
||||
|
||||
if(!pMap)
|
||||
return;
|
||||
|
||||
DGAUnmapPhysical(pMap);
|
||||
|
||||
if(!pPrev)
|
||||
_Maps = pMap->next;
|
||||
else
|
||||
pPrev->next = pMap->next;
|
||||
|
||||
Xfree(pMap);
|
||||
}
|
||||
|
||||
|
||||
static Bool
|
||||
DGAMapPhysical(
|
||||
int screen,
|
||||
const char *name, /* optional device name */
|
||||
unsigned char* base, /* physical memory */
|
||||
CARD32 size, /* size */
|
||||
CARD32 offset, /* optional offset */
|
||||
CARD32 extra, /* optional extra data */
|
||||
DGAMapPtr pMap
|
||||
) {
|
||||
|
||||
base += offset;
|
||||
|
||||
pMap->screen = screen;
|
||||
pMap->physical = base;
|
||||
pMap->size = size;
|
||||
|
||||
#ifndef MAP_FILE
|
||||
#define MAP_FILE 0
|
||||
#endif
|
||||
if (!name)
|
||||
name = DEV_MEM;
|
||||
if ((pMap->fd = open(name, O_RDWR)) < 0)
|
||||
return False;
|
||||
pMap->virtual = mmap(NULL, size, PROT_READ | PROT_WRITE,
|
||||
MAP_FILE | MAP_SHARED, pMap->fd, (off_t)(uintptr_t)base);
|
||||
if (pMap->virtual == (void *)-1)
|
||||
return False;
|
||||
mprotect(pMap->virtual, size, PROT_READ | PROT_WRITE);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
DGAUnmapPhysical(DGAMapPtr pMap)
|
||||
{
|
||||
if (pMap->virtual && pMap->virtual != (void *)-1) {
|
||||
mprotect(pMap->virtual,pMap->size, PROT_READ);
|
||||
munmap(pMap->virtual, pMap->size);
|
||||
pMap->virtual = 0;
|
||||
}
|
||||
if (pMap->fd >= 0) {
|
||||
close(pMap->fd);
|
||||
pMap->fd = -1;
|
||||
}
|
||||
}
|
71
lib/libXxf86dga/src/config.h.in
Normal file
71
lib/libXxf86dga/src/config.h.in
Normal file
|
@ -0,0 +1,71 @@
|
|||
/* src/config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Major version of this package */
|
||||
#undef PACKAGE_VERSION_MAJOR
|
||||
|
||||
/* Minor version of this package */
|
||||
#undef PACKAGE_VERSION_MINOR
|
||||
|
||||
/* Patch version of this package */
|
||||
#undef PACKAGE_VERSION_PATCHLEVEL
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
Loading…
Add table
Add a link
Reference in a new issue