diff options
Diffstat (limited to 'xserver/hw/xfree86')
234 files changed, 5586 insertions, 29256 deletions
diff --git a/xserver/hw/xfree86/Makefile.am b/xserver/hw/xfree86/Makefile.am index 72be8891c..c3899b577 100644 --- a/xserver/hw/xfree86/Makefile.am +++ b/xserver/hw/xfree86/Makefile.am @@ -1,18 +1,18 @@ if DRI DRI_SUBDIR = dri +DRI_LIB = dri/libdri.la endif if DRI2 DRI2_SUBDIR = dri2 +DRI2_LIB = dri2/libdri2.la endif if XF86UTILS XF86UTILS_SUBDIR = utils endif -XAA_SUBDIR = xaa - if VGAHW VGAHW_SUBDIR = vgahw endif @@ -25,13 +25,13 @@ if INT10MODULE INT10_SUBDIR = int10 endif -SUBDIRS = common ddc i2c x86emu $(INT10_SUBDIR) fbdevhw os-support parser \ - ramdac shadowfb $(VBE_SUBDIR) $(VGAHW_SUBDIR) $(XAA_SUBDIR) \ - loader dixmods exa modes \ - $(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) doc man +SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \ + ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \ + $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \ + fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \ - parser ramdac shadowfb vbe vgahw xaa \ + parser ramdac shadowfb vbe vgahw \ loader dixmods dri dri2 exa modes \ utils doc man @@ -40,7 +40,8 @@ nodist_Xorg_SOURCES = sdksyms.c AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ INCLUDES = $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \ - -I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac + -I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac \ + -I$(srcdir)/dri -I$(srcdir)/dri2 LOCAL_LIBS = \ $(MAIN_LIB) \ @@ -54,8 +55,10 @@ LOCAL_LIBS = \ ramdac/libramdac.la \ ddc/libddc.la \ i2c/libi2c.la \ - dixmods/libxorgxkb.la \ $(XORG_LIBS) \ + dixmods/libxorgxkb.la \ + $(DRI_LIB) \ + $(DRI2_LIB) \ $(top_builddir)/mi/libmi.la \ $(top_builddir)/os/libos.la Xorg_LDADD = \ @@ -92,6 +95,9 @@ if INSTALL_SETUID chown root $(DESTDIR)$(bindir)/Xorg chmod u+s $(DESTDIR)$(bindir)/Xorg endif +if CYGWIN + $(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a +endif # Use variables from XORG_MANPAGE_SECTIONS and X Server configuration # Do not include manpages.am as values are not appropriate for rc files @@ -103,13 +109,22 @@ xorg.conf.example: xorgconf.cpp $(AM_V_GEN)$(SED) $(CONF_SUBSTS) < $(srcdir)/xorgconf.cpp > $@ relink: - $(AM_V_at)rm -f Xorg && $(MAKE) Xorg + $(AM_V_at)rm -f Xorg$(EXEEXT) && $(MAKE) Xorg$(EXEEXT) CLEANFILES = sdksyms.c sdksyms.dep EXTRA_DIST += sdksyms.sh sdksyms.dep sdksyms.c: sdksyms.sh - CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(INCLUDES) + $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(INCLUDES) SDKSYMS_DEP = sdksyms.dep include $(SDKSYMS_DEP) + +i2c/libi2c.la: + $(AM_V_at)cd i2c && $(MAKE) libi2c.la + +dixmods/libdixmods.la: + $(AM_V_at)cd dixmods && $(MAKE) libdixmods.la + +dixmods/libxorgxkb.la: + $(AM_V_at)cd dixmods && $(MAKE) libxorgxkb.la diff --git a/xserver/hw/xfree86/Makefile.in b/xserver/hw/xfree86/Makefile.in index a3152b884..89ac21d99 100644 --- a/xserver/hw/xfree86/Makefile.in +++ b/xserver/hw/xfree86/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -87,8 +87,9 @@ am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ os-support/libxorgos.la parser/libxf86config_internal.la \ dixmods/libdixmods.la modes/libxf86modes.la \ ramdac/libramdac.la ddc/libddc.la i2c/libi2c.la \ - dixmods/libxorgxkb.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/mi/libmi.la $(top_builddir)/os/libos.la + $(am__DEPENDENCIES_1) dixmods/libxorgxkb.la $(DRI_LIB) \ + $(DRI2_LIB) $(top_builddir)/mi/libmi.la \ + $(top_builddir)/os/libos.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -234,13 +235,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -262,6 +259,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -286,6 +284,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -400,6 +399,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -500,26 +500,28 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @DRI_TRUE@DRI_SUBDIR = dri +@DRI_TRUE@DRI_LIB = dri/libdri.la @DRI2_TRUE@DRI2_SUBDIR = dri2 +@DRI2_TRUE@DRI2_LIB = dri2/libdri2.la @XF86UTILS_TRUE@XF86UTILS_SUBDIR = utils -XAA_SUBDIR = xaa @VGAHW_TRUE@VGAHW_SUBDIR = vgahw @VBE_TRUE@VBE_SUBDIR = vbe @INT10MODULE_TRUE@INT10_SUBDIR = int10 -SUBDIRS = common ddc i2c x86emu $(INT10_SUBDIR) fbdevhw os-support parser \ - ramdac shadowfb $(VBE_SUBDIR) $(VGAHW_SUBDIR) $(XAA_SUBDIR) \ - loader dixmods exa modes \ - $(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) doc man +SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \ + ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \ + $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \ + fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \ - parser ramdac shadowfb vbe vgahw xaa \ + parser ramdac shadowfb vbe vgahw \ loader dixmods dri dri2 exa modes \ utils doc man nodist_Xorg_SOURCES = sdksyms.c AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ INCLUDES = $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \ - -I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac + -I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac \ + -I$(srcdir)/dri -I$(srcdir)/dri2 LOCAL_LIBS = \ $(MAIN_LIB) \ @@ -533,8 +535,10 @@ LOCAL_LIBS = \ ramdac/libramdac.la \ ddc/libddc.la \ i2c/libi2c.la \ - dixmods/libxorgxkb.la \ $(XORG_LIBS) \ + dixmods/libxorgxkb.la \ + $(DRI_LIB) \ + $(DRI2_LIB) \ $(top_builddir)/mi/libmi.la \ $(top_builddir)/os/libos.la @@ -1005,17 +1009,27 @@ install-exec-local: install-binPROGRAMS (cd $(DESTDIR)$(bindir) && rm -f X && ln -s Xorg X) @INSTALL_SETUID_TRUE@ chown root $(DESTDIR)$(bindir)/Xorg @INSTALL_SETUID_TRUE@ chmod u+s $(DESTDIR)$(bindir)/Xorg +@CYGWIN_TRUE@ $(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a xorg.conf.example: xorgconf.cpp $(AM_V_GEN)$(SED) $(CONF_SUBSTS) < $(srcdir)/xorgconf.cpp > $@ relink: - $(AM_V_at)rm -f Xorg && $(MAKE) Xorg + $(AM_V_at)rm -f Xorg$(EXEEXT) && $(MAKE) Xorg$(EXEEXT) sdksyms.dep sdksyms.c: sdksyms.sh - CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(INCLUDES) + $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(INCLUDES) include $(SDKSYMS_DEP) +i2c/libi2c.la: + $(AM_V_at)cd i2c && $(MAKE) libi2c.la + +dixmods/libdixmods.la: + $(AM_V_at)cd dixmods && $(MAKE) libdixmods.la + +dixmods/libxorgxkb.la: + $(AM_V_at)cd dixmods && $(MAKE) libxorgxkb.la + # 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: diff --git a/xserver/hw/xfree86/common/Makefile.am b/xserver/hw/xfree86/common/Makefile.am index 27921777d..532d87bbe 100644 --- a/xserver/hw/xfree86/common/Makefile.am +++ b/xserver/hw/xfree86/common/Makefile.am @@ -15,16 +15,22 @@ XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h endif if XF86VIDMODE +XF86VMODESOURCES = xf86vmode.c XF86VMODE_SDK = vidmodeproc.h endif if DGA DGASOURCES = xf86DGA.c +DGA_SDK = dgaproc.h +endif + +if XORG_BUS_PLATFORM +PLATSOURCES = xf86platformBus.c endif RANDRSOURCES = xf86RandR.c -BUSSOURCES = xf86fbBus.c xf86noBus.c $(PCI_SOURCES) $(SBUS_SOURCES) +BUSSOURCES = xf86fbBus.c xf86noBus.c $(PCI_SOURCES) $(SBUS_SOURCES) $(PLATSOURCES) MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes @@ -41,7 +47,8 @@ libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \ xf86Option.c xf86Init.c \ xf86VidMode.c xf86fbman.c xf86cmap.c \ xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \ - xf86Mode.c xorgHelper.c \ + xf86Mode.c xorgHelper.c xf86Extensions.h \ + xf86Extensions.c $(XF86VMODESOURCES) \ $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES) nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h libcommon_la_LIBADD = $(top_builddir)/config/libconfig.la @@ -50,13 +57,14 @@ INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ -I$(srcdir)/../loader -I$(srcdir)/../parser \ -I$(srcdir)/../vbe -I$(srcdir)/../int10 \ -I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod \ - -I$(srcdir)/../modes -I$(srcdir)/../ramdac + -I$(srcdir)/../modes -I$(srcdir)/../ramdac -I$(srcdir)/../dri2 sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \ xf86PciInfo.h xf86Priv.h xf86Privstr.h \ xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \ - $(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \ - xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h + $(XVSDKINCS) $(XF86VMODE_SDK) $(DGA_SDK) xorgVersion.h \ + xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h xf86platformBus.h \ + xaarop.h DISTCLEANFILES = xf86Build.h CLEANFILES = $(BUILT_SOURCES) @@ -88,7 +96,8 @@ EXTRA_DIST = \ modeline2c.awk \ xf86VGAarbiter.h \ xf86VGAarbiterPriv.h \ - $(DISTKBDSOURCES) + $(DISTKBDSOURCES) \ + xaarop.h if LNXACPI XORG_CFLAGS += -DHAVE_ACPI diff --git a/xserver/hw/xfree86/common/Makefile.in b/xserver/hw/xfree86/common/Makefile.in index 7c684cd40..7f3836127 100644 --- a/xserver/hw/xfree86/common/Makefile.in +++ b/xserver/hw/xfree86/common/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -81,22 +81,27 @@ am__libcommon_la_SOURCES_DIST = xf86Configure.c xf86Bus.c xf86Config.c \ xf86Cursor.c xf86DGA.c xf86DPMS.c xf86Events.c xf86Globals.c \ xf86AutoConfig.c xf86Option.c xf86Init.c xf86VidMode.c \ xf86fbman.c xf86cmap.c xf86Helper.c xf86PM.c xf86Xinput.c \ - xisb.c xf86Mode.c xorgHelper.c xf86xv.c xf86xvmc.c xf86fbBus.c \ + xisb.c xf86Mode.c xorgHelper.c xf86Extensions.h \ + xf86Extensions.c xf86vmode.c xf86xv.c xf86xvmc.c xf86fbBus.c \ xf86noBus.c xf86pciBus.c xf86VGAarbiter.c xf86VGAarbiter.h \ - xf86VGAarbiterPriv.h xf86sbusBus.c xf86RandR.c + xf86VGAarbiterPriv.h xf86sbusBus.c xf86platformBus.c \ + xf86RandR.c @DGA_TRUE@am__objects_1 = xf86DGA.lo -@XV_TRUE@am__objects_2 = xf86xv.lo xf86xvmc.lo -@XORG_BUS_PCI_TRUE@am__objects_3 = xf86pciBus.lo xf86VGAarbiter.lo -@XORG_BUS_SPARC_TRUE@am__objects_4 = xf86sbusBus.lo -am__objects_5 = xf86fbBus.lo xf86noBus.lo $(am__objects_3) \ - $(am__objects_4) -am__objects_6 = xf86RandR.lo +@XF86VIDMODE_TRUE@am__objects_2 = xf86vmode.lo +@XV_TRUE@am__objects_3 = xf86xv.lo xf86xvmc.lo +@XORG_BUS_PCI_TRUE@am__objects_4 = xf86pciBus.lo xf86VGAarbiter.lo +@XORG_BUS_SPARC_TRUE@am__objects_5 = xf86sbusBus.lo +@XORG_BUS_PLATFORM_TRUE@am__objects_6 = xf86platformBus.lo +am__objects_7 = xf86fbBus.lo xf86noBus.lo $(am__objects_4) \ + $(am__objects_5) $(am__objects_6) +am__objects_8 = xf86RandR.lo am_libcommon_la_OBJECTS = xf86Configure.lo xf86Bus.lo xf86Config.lo \ xf86Cursor.lo $(am__objects_1) xf86DPMS.lo xf86Events.lo \ xf86Globals.lo xf86AutoConfig.lo xf86Option.lo xf86Init.lo \ xf86VidMode.lo xf86fbman.lo xf86cmap.lo xf86Helper.lo \ xf86PM.lo xf86Xinput.lo xisb.lo xf86Mode.lo xorgHelper.lo \ - $(am__objects_2) $(am__objects_5) $(am__objects_6) + xf86Extensions.lo $(am__objects_2) $(am__objects_3) \ + $(am__objects_7) $(am__objects_8) nodist_libcommon_la_OBJECTS = xf86DefModeSet.lo libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS) \ $(nodist_libcommon_la_OBJECTS) @@ -148,8 +153,9 @@ am__can_run_installinfo = \ am__sdk_HEADERS_DIST = compiler.h fourcc.h xf86.h xf86Module.h \ xf86Opt.h xf86PciInfo.h xf86Priv.h xf86Privstr.h xf86cmap.h \ xf86fbman.h xf86str.h xf86Xinput.h xisb.h xf86xv.h xf86xvmc.h \ - xf86xvpriv.h vidmodeproc.h xorgVersion.h xf86sbusBus.h \ - xf86VGAarbiter.h xf86Optionstr.h + xf86xvpriv.h vidmodeproc.h dgaproc.h xorgVersion.h \ + xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h \ + xf86platformBus.h xaarop.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -239,13 +245,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -267,6 +269,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -291,6 +294,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -405,6 +409,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ $(am__append_1) +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -511,10 +516,13 @@ noinst_LTLIBRARIES = libcommon.la @XORG_BUS_SPARC_TRUE@SBUS_SOURCES = xf86sbusBus.c @XV_TRUE@XVSOURCES = xf86xv.c xf86xvmc.c @XV_TRUE@XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h +@XF86VIDMODE_TRUE@XF86VMODESOURCES = xf86vmode.c @XF86VIDMODE_TRUE@XF86VMODE_SDK = vidmodeproc.h @DGA_TRUE@DGASOURCES = xf86DGA.c +@DGA_TRUE@DGA_SDK = dgaproc.h +@XORG_BUS_PLATFORM_TRUE@PLATSOURCES = xf86platformBus.c RANDRSOURCES = xf86RandR.c -BUSSOURCES = xf86fbBus.c xf86noBus.c $(PCI_SOURCES) $(SBUS_SOURCES) +BUSSOURCES = xf86fbBus.c xf86noBus.c $(PCI_SOURCES) $(SBUS_SOURCES) $(PLATSOURCES) MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes BUILT_SOURCES = xf86DefModeSet.c AM_LDFLAGS = -r @@ -524,7 +532,8 @@ libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \ xf86Option.c xf86Init.c \ xf86VidMode.c xf86fbman.c xf86cmap.c \ xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \ - xf86Mode.c xorgHelper.c \ + xf86Mode.c xorgHelper.c xf86Extensions.h \ + xf86Extensions.c $(XF86VMODESOURCES) \ $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES) nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h @@ -533,13 +542,14 @@ INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ -I$(srcdir)/../loader -I$(srcdir)/../parser \ -I$(srcdir)/../vbe -I$(srcdir)/../int10 \ -I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod \ - -I$(srcdir)/../modes -I$(srcdir)/../ramdac + -I$(srcdir)/../modes -I$(srcdir)/../ramdac -I$(srcdir)/../dri2 sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \ xf86PciInfo.h xf86Priv.h xf86Privstr.h \ xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \ - $(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \ - xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h + $(XVSDKINCS) $(XF86VMODE_SDK) $(DGA_SDK) xorgVersion.h \ + xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h xf86platformBus.h \ + xaarop.h DISTCLEANFILES = xf86Build.h CLEANFILES = $(BUILT_SOURCES) @@ -570,7 +580,8 @@ EXTRA_DIST = \ modeline2c.awk \ xf86VGAarbiter.h \ xf86VGAarbiterPriv.h \ - $(DISTKBDSOURCES) + $(DISTKBDSOURCES) \ + xaarop.h AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) all: $(BUILT_SOURCES) @@ -639,6 +650,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DPMS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DefModeSet.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Events.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Extensions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Globals.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Helper.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Init.Plo@am__quote@ @@ -654,7 +666,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86fbman.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86noBus.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86pciBus.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86platformBus.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86sbusBus.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86vmode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86xv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86xvmc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xisb.Plo@am__quote@ diff --git a/xserver/hw/xfree86/common/compiler.h b/xserver/hw/xfree86/common/compiler.h index f1d491d18..a403cbd34 100644 --- a/xserver/hw/xfree86/common/compiler.h +++ b/xserver/hw/xfree86/common/compiler.h @@ -119,6 +119,23 @@ extern _X_EXPORT unsigned int inb(unsigned long); extern _X_EXPORT unsigned int inw(unsigned long); extern _X_EXPORT unsigned int inl(unsigned long); +#ifdef __SUNPRO_C +extern _X_EXPORT unsigned char xf86ReadMmio8 (void *, unsigned long); +extern _X_EXPORT unsigned short xf86ReadMmio16Be (void *, unsigned long); +extern _X_EXPORT unsigned short xf86ReadMmio16Le (void *, unsigned long); +extern _X_EXPORT unsigned int xf86ReadMmio32Be (void *, unsigned long); +extern _X_EXPORT unsigned int xf86ReadMmio32Le (void *, unsigned long); +extern _X_EXPORT void xf86WriteMmio8 (void *, unsigned long, unsigned int); +extern _X_EXPORT void xf86WriteMmio16Be (void *, unsigned long, unsigned int); +extern _X_EXPORT void xf86WriteMmio16Le (void *, unsigned long, unsigned int); +extern _X_EXPORT void xf86WriteMmio32Be (void *, unsigned long, unsigned int); +extern _X_EXPORT void xf86WriteMmio32Le (void *, unsigned long, unsigned int); +extern _X_EXPORT void xf86WriteMmio8NB (void *, unsigned long, unsigned int); +extern _X_EXPORT void xf86WriteMmio16BeNB (void *, unsigned long, unsigned int); +extern _X_EXPORT void xf86WriteMmio16LeNB (void *, unsigned long, unsigned int); +extern _X_EXPORT void xf86WriteMmio32BeNB (void *, unsigned long, unsigned int); +extern _X_EXPORT void xf86WriteMmio32LeNB (void *, unsigned long, unsigned int); +#endif /* _SUNPRO_C */ #endif /* __sparc__, __arm32__, __alpha__, __nds32__ */ #endif /* __arm__ */ diff --git a/xserver/hw/xfree86/dixmods/extmod/dgaproc.h b/xserver/hw/xfree86/common/dgaproc.h index b4e0ddfea..e824d3094 100644 --- a/xserver/hw/xfree86/dixmods/extmod/dgaproc.h +++ b/xserver/hw/xfree86/common/dgaproc.h @@ -64,6 +64,7 @@ extern _X_EXPORT void DGASelectInput(int Index, ClientPtr client, long mask); extern _X_EXPORT Bool DGAAvailable(int Index); +extern _X_EXPORT Bool DGAScreenAvailable(ScreenPtr pScreen); extern _X_EXPORT Bool DGAActive(int Index); extern _X_EXPORT void DGAShutdown(void); extern _X_EXPORT void DGAInstallCmap(ColormapPtr cmap); @@ -106,9 +107,4 @@ extern _X_EXPORT Bool DGAChangePixmapMode(int Index, int *x, int *y, int mode); extern _X_EXPORT int DGACreateColormap(int Index, ClientPtr client, int id, int mode, int alloc); -extern _X_EXPORT unsigned char DGAReqCode; -extern _X_EXPORT int DGAErrorBase; -extern _X_EXPORT int DGAEventBase; -extern _X_EXPORT int *XDGAEventBase; - #endif /* __DGAPROC_H */ diff --git a/xserver/hw/xfree86/common/vidmodeproc.h b/xserver/hw/xfree86/common/vidmodeproc.h index aa43237d4..311d35c7b 100644 --- a/xserver/hw/xfree86/common/vidmodeproc.h +++ b/xserver/hw/xfree86/common/vidmodeproc.h @@ -39,7 +39,7 @@ typedef union { float f; } vidMonitorValue; -extern _X_EXPORT void XFree86VidModeExtensionInit(void); +extern Bool VidModeExtensionInit(ScreenPtr pScreen); extern _X_EXPORT Bool VidModeAvailable(int scrnIndex); extern _X_EXPORT Bool VidModeGetCurrentModeline(int scrnIndex, pointer *mode, diff --git a/xserver/hw/xfree86/xaa/xaarop.h b/xserver/hw/xfree86/common/xaarop.h index f2acde075..84aa9baba 100644 --- a/xserver/hw/xfree86/xaa/xaarop.h +++ b/xserver/hw/xfree86/common/xaarop.h @@ -1,30 +1,3 @@ -/* - - int XAAHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop) - - For use with solid fills emulated by solid 8x8 patterns. You - give it the foreground, planemask and X rop and it will replace - the foreground with a new one and the rop with the appropriate - MS triadic raster op. The function will return which components - (S-P) need to be enabled. - - int XAAHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, int pm, int *rop) - - For use with 8x8 opaque pattern fills. You give it the foreground, - and background, planemask and X rop and it will replace the - foreground and background with new ones and the rop with the - appropriate MS triadic raster op. The function will return which - components (S-P) need to be enabled. - - ROP_PAT - Means to enable 8x8 mono patterns (all bits - set for solid patterns). Set the foreground and - background as returned by the function. - - ROP_SRC - Means a source of color == planemask should be used. - - -*/ - #ifndef _XAAROP_H #define _XAAROP_H @@ -292,20 +265,4 @@ #define NO_SRC_ROP(rop) \ ((rop == GXnoop) || (rop == GXset) || (rop == GXclear) || (rop == GXinvert)) -extern _X_EXPORT int XAAHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, - int *rop); -extern _X_EXPORT int XAAHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, - int pm, int *rop); - -/* XXX These four should be static, but it breaks the 6.7.0 ABI. */ -extern _X_EXPORT int XAACopyROP[16]; -extern _X_EXPORT int XAACopyROP_PM[16]; -extern _X_EXPORT int XAAPatternROP[16]; -extern _X_EXPORT int XAAPatternROP_PM[16]; - -extern _X_EXPORT int XAAGetCopyROP(int i); -extern _X_EXPORT int XAAGetCopyROP_PM(int i); -extern _X_EXPORT int XAAGetPatternROP(int i); -extern _X_EXPORT int XAAGetPatternROP_PM(int i); - #endif /* _XAAROP_H */ diff --git a/xserver/hw/xfree86/common/xf86.h b/xserver/hw/xfree86/common/xf86.h index fc4c34e92..74da4389a 100644 --- a/xserver/hw/xfree86/common/xf86.h +++ b/xserver/hw/xfree86/common/xf86.h @@ -71,13 +71,18 @@ extern _X_EXPORT Bool fbSlotClaimed; #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) extern _X_EXPORT Bool sbusSlotClaimed; #endif + +#if defined(XSERVER_PLATFORM_BUS) +extern _X_EXPORT int platformSlotClaimed; +#endif + extern _X_EXPORT confDRIRec xf86ConfigDRI; extern _X_EXPORT Bool xf86DRI2Enabled(void); extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */ -#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \ - xf86ScreenKey)) +#define XF86SCRNINFO(p) xf86ScreenToScrn(p) + #define XF86FLIP_PIXELS() \ do { \ if (xf86GetFlipPixels()) { \ @@ -97,12 +102,12 @@ extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */ /* PCI related */ #ifdef XSERVER_LIBPCIACCESS #include <pciaccess.h> -extern _X_EXPORT Bool pciSlotClaimed; +extern _X_EXPORT int pciSlotClaimed; extern _X_EXPORT Bool xf86CheckPciSlot(const struct pci_device *); extern _X_EXPORT int xf86ClaimPciSlot(struct pci_device *, DriverPtr drvp, int chipset, GDevPtr dev, Bool active); -extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *); +extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *, GDevPtr dev); extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func); extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus, @@ -244,7 +249,7 @@ extern _X_EXPORT void xf86AddDriver(DriverPtr driver, pointer module, int flags); extern _X_EXPORT void xf86DeleteDriver(int drvIndex); extern _X_EXPORT ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags); -extern _X_EXPORT void xf86DeleteScreen(int scrnIndex, int flags); +extern _X_EXPORT void xf86DeleteScreen(ScrnInfoPtr pScrn); extern _X_EXPORT int xf86AllocateScrnInfoPrivateIndex(void); extern _X_EXPORT Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad); @@ -256,7 +261,7 @@ extern _X_EXPORT Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual); extern _X_EXPORT Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma); extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y); extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen); -extern _X_EXPORT void xf86EnableDisableFBAccess(int scrnIndex, Bool enable); +extern _X_EXPORT void xf86EnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable); extern _X_EXPORT void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, va_list args) @@ -347,7 +352,7 @@ xf86SetBackingStore(ScreenPtr pScreen); extern _X_EXPORT void xf86SetSilkenMouse(ScreenPtr pScreen); extern _X_EXPORT pointer -xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name, +xf86FindXvOptions(ScrnInfoPtr pScrn, int adapt_index, char *port_name, char **adaptor_name, pointer *adaptor_options); extern _X_EXPORT void xf86GetOS(const char **name, int *major, int *minor, int *teeny); @@ -357,7 +362,7 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, EntityProc enter, EntityProc leave, pointer private); extern _X_EXPORT Bool -xf86IsScreenPrimary(int scrnIndex); +xf86IsScreenPrimary(ScrnInfoPtr pScrn); extern _X_EXPORT int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, int format, unsigned long len, pointer value); @@ -417,6 +422,8 @@ extern _X_EXPORT void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags); extern _X_EXPORT DisplayModePtr xf86DuplicateMode(const DisplayModeRec * pMode); +extern _X_EXPORT void +xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec * pMode); extern _X_EXPORT DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList); extern _X_EXPORT Bool @@ -444,11 +451,25 @@ xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, Bool resetMode); #endif -/* xf86VidModeExtentionInit.c */ +/* xf86Extensions.c */ +extern void xf86ExtensionInit(void); -extern _X_EXPORT Bool -VidModeExtensionInit(ScreenPtr pScreen); +/* convert ScreenPtr to ScrnInfoPtr */ +extern _X_EXPORT ScrnInfoPtr xf86ScreenToScrn(ScreenPtr pScreen); +/* convert ScrnInfoPtr to ScreenPtr */ +extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn); #endif /* _NO_XF86_PROTOTYPES */ +#define XF86_HAS_SCRN_CONV 1 /* define for drivers to use in api compat */ + +#define XF86_SCRN_INTERFACE 1 /* define for drivers to use in api compat */ + +/* flags passed to xf86 allocate screen */ +#define XF86_ALLOCATE_GPU_SCREEN 1 + +/* Update the internal total dimensions of all ScreenRecs together */ +extern _X_EXPORT void +xf86UpdateDesktopDimensions(void); + #endif /* _XF86_H */ diff --git a/xserver/hw/xfree86/common/xf86AutoConfig.c b/xserver/hw/xfree86/common/xf86AutoConfig.c index dd0bb4e8b..bcc1feee0 100644 --- a/xserver/hw/xfree86/common/xf86AutoConfig.c +++ b/xserver/hw/xfree86/common/xf86AutoConfig.c @@ -39,6 +39,7 @@ #include "xf86Config.h" #include "xf86Priv.h" #include "xf86_OSlib.h" +#include "xf86platformBus.h" #include "xf86pciBus.h" #if defined(__sparc__) #include "xf86sbusBus.h" @@ -198,10 +199,13 @@ listPossibleVideoDrivers(char *matches[], int nmatches) } i = 0; +#ifdef XSERVER_PLATFORM_BUS + i = xf86PlatformMatchDriver(matches, nmatches); +#endif #ifdef sun /* Check for driver type based on /dev/fb type and if valid, use it instead of PCI bus probe results */ - if (xf86Info.consoleFd >= 0) { + if (xf86Info.consoleFd >= 0 && (i < (nmatches - 1))) { struct vis_identifier visid; const char *cp; extern char xf86SolarisFbDev[PATH_MAX]; @@ -250,7 +254,8 @@ listPossibleVideoDrivers(char *matches[], int nmatches) } } #endif -#if defined(__sparc__) +#ifdef __sparc__ + if (i < (nmatches - 1)) { char *sbusDriver = sparcDriverName(); @@ -259,7 +264,8 @@ listPossibleVideoDrivers(char *matches[], int nmatches) } #endif #ifdef XSERVER_LIBPCIACCESS - i = xf86PciMatchDriver(matches, nmatches); + if (i < (nmatches - 1)) + i = xf86PciMatchDriver(matches, nmatches); #endif /* Fallback to platform default hardware */ if (i < (nmatches - 1)) { @@ -270,6 +276,10 @@ listPossibleVideoDrivers(char *matches[], int nmatches) #endif } +#if defined(__linux__) + matches[i++] = xnfstrdup("modesetting"); +#endif + #if !defined(sun) /* Fallback to platform default frame buffer driver */ if (i < (nmatches - 1)) { diff --git a/xserver/hw/xfree86/common/xf86Bus.c b/xserver/hw/xfree86/common/xf86Bus.c index ccd44f651..ad5714ad7 100644 --- a/xserver/hw/xfree86/common/xf86Bus.c +++ b/xserver/hw/xfree86/common/xf86Bus.c @@ -77,8 +77,16 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only) { Bool foundScreen = FALSE; +#ifdef XSERVER_PLATFORM_BUS + if (drv->platformProbe != NULL) { + foundScreen = xf86platformProbeDev(drv); + } + if (ServerIsNotSeat0()) + return foundScreen; +#endif + #ifdef XSERVER_LIBPCIACCESS - if (drv->PciProbe != NULL) { + if (!foundScreen && (drv->PciProbe != NULL)) { if (xf86DoConfigure && xf86DoConfigurePass1) { assert(detect_only); foundScreen = xf86PciAddMatchingDev(drv); @@ -179,10 +187,14 @@ xf86BusConfig(void) xf86Msg(X_ERROR, "Screen %d deleted because of no matching config section.\n", i); - xf86DeleteScreen(i--, 0); + xf86DeleteScreen(xf86Screens[i--]); } } + /* bind GPU conf screen to protocol screen 0 */ + for (i = 0; i < xf86NumGPUScreens; i++) + xf86GPUScreens[i]->confScreen = xf86Screens[0]->confScreen; + /* If no screens left, return now. */ if (xf86NumScreens == 0) { xf86Msg(X_ERROR, @@ -202,6 +214,11 @@ xf86BusConfig(void) void xf86BusProbe(void) { +#ifdef XSERVER_PLATFORM_BUS + xf86platformProbe(); + if (ServerIsNotSeat0()) + return; +#endif #ifdef XSERVER_LIBPCIACCESS xf86PciProbe(); #endif @@ -238,6 +255,8 @@ StringToBusType(const char *busID, const char **retID) ret = BUS_PCI; if (!xf86NameCmp(p, "sbus")) ret = BUS_SBUS; + if (!xf86NameCmp(p, "platform")) + ret = BUS_PLATFORM; if (ret != BUS_NONE) if (retID) *retID = busID + strlen(p) + 1; @@ -270,6 +289,8 @@ xf86IsEntityPrimary(int entityIndex) return pEnt->bus.id.pci == primaryBus.id.pci; case BUS_SBUS: return pEnt->bus.id.sbus.fbNum == primaryBus.id.sbus.fbNum; + case BUS_PLATFORM: + return pEnt->bus.id.plat == primaryBus.id.plat; default: return FALSE; } @@ -377,13 +398,12 @@ xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex) } /* - * xf86ClearEntitiesForScreen() - called when a screen is deleted + * xf86ClearEntityListForScreen() - called when a screen is deleted * to mark it's entities unused. Called by xf86DeleteScreen(). */ void -xf86ClearEntityListForScreen(int scrnIndex) +xf86ClearEntityListForScreen(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; int i, entityIndex; if (pScrn->entityList == NULL || pScrn->numEntities == 0) @@ -420,6 +440,26 @@ xf86AddDevToEntity(int entityIndex, GDevPtr dev) dev->claimed = TRUE; } + +void +xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev) +{ + EntityPtr pEnt; + int i, j; + if (entityIndex >= xf86NumEntities) + return; + + pEnt = xf86Entities[entityIndex]; + for (i = 0; i < pEnt->numInstances; i++) { + if (pEnt->devices[i] == dev) { + for (j = i; j < pEnt->numInstances - 1; j++) + pEnt->devices[j] = pEnt->devices[j + 1]; + break; + } + } + pEnt->numInstances--; + dev->claimed = FALSE; +} /* * xf86GetEntityInfo() -- This function hands information from the * EntityRec struct to the drivers. The EntityRec structure itself @@ -522,6 +562,9 @@ xf86PostProbe(void) #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) sbusSlotClaimed || #endif +#ifdef XSERVER_PLATFORM_BUS + platformSlotClaimed || +#endif #ifdef XSERVER_LIBPCIACCESS pciSlotClaimed #else diff --git a/xserver/hw/xfree86/common/xf86Bus.h b/xserver/hw/xfree86/common/xf86Bus.h index abf2efd1a..e83ba780a 100644 --- a/xserver/hw/xfree86/common/xf86Bus.h +++ b/xserver/hw/xfree86/common/xf86Bus.h @@ -42,6 +42,7 @@ #if defined(__sparc__) || defined(__sparc) #include "xf86sbusBus.h" #endif +#include "xf86platformBus.h" typedef struct { DriverPtr driver; diff --git a/xserver/hw/xfree86/common/xf86Config.c b/xserver/hw/xfree86/common/xf86Config.c index b2a7dde43..d59b376e1 100644 --- a/xserver/hw/xfree86/common/xf86Config.c +++ b/xserver/hw/xfree86/common/xf86Config.c @@ -109,21 +109,13 @@ #endif static ModuleDefault ModuleDefaults[] = { - {.name = "extmod",.toLoad = TRUE,.load_opt = NULL}, -#ifdef DBE - {.name = "dbe",.toLoad = TRUE,.load_opt = NULL}, -#endif #ifdef GLXEXT {.name = "glx",.toLoad = TRUE,.load_opt = NULL}, #endif -#ifdef XRECORD - {.name = "record",.toLoad = TRUE,.load_opt = NULL}, -#endif -#ifdef XF86DRI - {.name = "dri",.toLoad = TRUE,.load_opt = NULL}, -#endif -#ifdef DRI2 - {.name = "dri2",.toLoad = TRUE,.load_opt = NULL}, +#ifdef __CYGWIN__ + /* load DIX modules used by drivers first */ + {.name = "fb",.toLoad = TRUE,.load_opt = NULL}, + {.name = "shadow",.toLoad = TRUE,.load_opt = NULL}, #endif {.name = NULL,.toLoad = FALSE,.load_opt = NULL} }; @@ -717,7 +709,8 @@ typedef enum { FLAG_AUTO_ENABLE_DEVICES, FLAG_GLX_VISUALS, FLAG_DRI2, - FLAG_USE_SIGIO + FLAG_USE_SIGIO, + FLAG_AUTO_ADD_GPU, } FlagValues; /** @@ -775,6 +768,8 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE}, {FLAG_USE_SIGIO, "UseSIGIO", OPTV_BOOLEAN, {0}, FALSE}, + {FLAG_AUTO_ADD_GPU, "AutoAddGPU", OPTV_BOOLEAN, + {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE}, }; @@ -867,6 +862,16 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86Msg(from, "%sutomatically enabling devices\n", xf86Info.autoEnableDevices ? "A" : "Not a"); + if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_GPU)) { + xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_GPU, + &xf86Info.autoAddGPU); + from = X_CONFIG; + } + else { + from = X_DEFAULT; + } + xf86Msg(from, "%sutomatically adding GPU devices\n", + xf86Info.autoAddGPU ? "A" : "Not a"); /* * Set things up based on the config file information. Some of these * settings may be overridden later when the command line options are diff --git a/xserver/hw/xfree86/common/xf86Configure.c b/xserver/hw/xfree86/common/xf86Configure.c index d466118d5..84566970a 100644 --- a/xserver/hw/xfree86/common/xf86Configure.c +++ b/xserver/hw/xfree86/common/xf86Configure.c @@ -301,9 +301,8 @@ configureDeviceSection(int screennum) if (!ptr->dev_comment) break; p_e = ptr->dev_comment + strlen(ptr->dev_comment); - snprintf(p_e, len - (ptr->dev_comment - p_e), - "%s%-20s%s%s%s", prefix, optname, middle, - opttype, suffix); + sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle, + opttype, suffix); free(optname); } } diff --git a/xserver/hw/xfree86/common/xf86Cursor.c b/xserver/hw/xfree86/common/xf86Cursor.c index 3716434f0..65a9e8264 100644 --- a/xserver/hw/xfree86/common/xf86Cursor.c +++ b/xserver/hw/xfree86/common/xf86Cursor.c @@ -66,7 +66,7 @@ static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y); static void xf86CrossScreen(ScreenPtr pScreen, Bool entering); static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); -static void xf86PointerMoved(int scrnIndex, int x, int y); +static void xf86PointerMoved(ScrnInfoPtr pScrn, int x, int y); static miPointerScreenFuncRec xf86PointerScreenFuncs = { xf86CursorOffScreen, @@ -133,16 +133,15 @@ xf86InitViewport(ScrnInfoPtr pScr) void xf86SetViewport(ScreenPtr pScreen, int x, int y) { - ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); + ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); - (*pScr->PointerMoved) (pScreen->myNum, x, y); + (*pScr->PointerMoved) (pScr, x, y); } static void -xf86PointerMoved(int scrnIndex, int x, int y) +xf86PointerMoved(ScrnInfoPtr pScr, int x, int y) { Bool frameChanged = FALSE; - ScrnInfoPtr pScr = xf86Screens[scrnIndex]; /* * check wether (x,y) belongs to the visual part of the screen @@ -173,7 +172,7 @@ xf86PointerMoved(int scrnIndex, int x, int y) } if (frameChanged && pScr->AdjustFrame != NULL) - pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); + pScr->AdjustFrame(pScr, pScr->frameX0, pScr->frameY0); } /* @@ -184,7 +183,8 @@ xf86PointerMoved(int scrnIndex, int x, int y) void xf86LockZoom(ScreenPtr pScreen, Bool lock) { - XF86SCRNINFO(pScreen)->zoomLocked = lock; + ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); + pScr->zoomLocked = lock; } /* @@ -196,10 +196,10 @@ xf86LockZoom(ScreenPtr pScreen, Bool lock) Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) { - ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); + ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); ScreenPtr pCursorScreen; Bool Switched; - int px, py, was_blocked; + int px, py; DeviceIntPtr dev, it; if (!pScr->vtSema || !mode || !pScr->SwitchMode) @@ -228,8 +228,8 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) if (pScreen == pCursorScreen) miPointerGetPosition(dev, &px, &py); - was_blocked = xf86BlockSIGIO(); - Switched = (*pScr->SwitchMode) (pScr->scrnIndex, mode, 0); + OsBlockSIGIO(); + Switched = (*pScr->SwitchMode) (pScr, mode); if (Switched) { pScr->currentMode = mode; @@ -267,10 +267,10 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) pScr->frameY1 = pScr->virtualY - 1; } } - xf86UnblockSIGIO(was_blocked); + OsReleaseSIGIO(); if (pScr->AdjustFrame) - (*pScr->AdjustFrame) (pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); + (*pScr->AdjustFrame) (pScr, pScr->frameX0, pScr->frameY0); /* The original code centered the frame around the cursor if possible. * Since this is hard to achieve with multiple cursors, we do the following: @@ -316,7 +316,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) void xf86ZoomViewport(ScreenPtr pScreen, int zoom) { - ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); + ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); DisplayModePtr mode; if (pScr->zoomLocked || !(mode = pScr->currentMode)) @@ -469,13 +469,11 @@ xf86CrossScreen(ScreenPtr pScreen, Bool entering) static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { - int sigstate; - - sigstate = xf86BlockSIGIO(); + OsBlockSIGIO(); miPointerWarpCursor(pDev, pScreen, x, y); xf86Info.currentScreen = pScreen; - xf86UnblockSIGIO(sigstate); + OsReleaseSIGIO(); } void * diff --git a/xserver/hw/xfree86/common/xf86DGA.c b/xserver/hw/xfree86/common/xf86DGA.c index 316978cfa..7f1a0c6ff 100644 --- a/xserver/hw/xfree86/common/xf86DGA.c +++ b/xserver/hw/xfree86/common/xf86DGA.c @@ -1,4 +1,6 @@ /* + * Copyright (c) 1995 Jon Tombs + * Copyright (c) 1995, 1996, 1999 XFree86 Inc * Copyright (c) 1998-2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -27,10 +29,20 @@ * Written by Mark Vojkovich */ +/* + * This is quite literally just two files glued together: + * hw/xfree86/common/xf86DGA.c is the first part, and + * hw/xfree86/dixmods/extmod/xf86dga2.c is the second part. One day, if + * someone actually cares about DGA, it'd be nice to clean this up. But trust + * me, I am not that person. + */ + #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif +#include <X11/X.h> +#include <X11/Xproto.h> #include "xf86.h" #include "xf86str.h" #include "xf86Priv.h" @@ -48,15 +60,30 @@ #include "exevents.h" #include "eventstr.h" #include "eventconvert.h" +#include "xf86Extensions.h" #include "mi.h" +#include "misc.h" +#include "dixstruct.h" +#include "dixevents.h" +#include "extnsionst.h" +#include "cursorstr.h" +#include "scrnintstr.h" +#include "swaprep.h" +#include "dgaproc.h" +#include "protocol-versions.h" + +#include <string.h> + +#define DGA_PROTOCOL_OLD_SUPPORT 1 + static DevPrivateKeyRec DGAScreenKeyRec; #define DGAScreenKeyRegistered dixPrivateKeyRegistered(&DGAScreenKeyRec) static Bool mieq_installed; -static Bool DGACloseScreen(int i, ScreenPtr pScreen); +static Bool DGACloseScreen(ScreenPtr pScreen); static void DGADestroyColormap(ColormapPtr pmap); static void DGAInstallColormap(ColormapPtr pmap); static void DGAUninstallColormap(ColormapPtr pmap); @@ -66,7 +93,9 @@ static void DGAHandleEvent(int screen_num, InternalEvent *event, static void DGACopyModeInfo(DGAModePtr mode, XDGAModePtr xmode); -int *XDGAEventBase = NULL; +static unsigned char DGAReqCode = 0; +static int DGAErrorBase; +static int DGAEventBase; #define DGA_GET_SCREEN_PRIV(pScreen) ((DGAScreenPtr) \ dixLookupPrivate(&(pScreen)->devPrivates, &DGAScreenKeyRec)) @@ -100,7 +129,7 @@ typedef struct { Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); DGAScreenPtr pScreenPriv; int i; @@ -235,7 +264,7 @@ FreeMarkedVisuals(ScreenPtr pScreen) } static Bool -DGACloseScreen(int i, ScreenPtr pScreen) +DGACloseScreen(ScreenPtr pScreen) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); @@ -256,7 +285,7 @@ DGACloseScreen(int i, ScreenPtr pScreen) free(pScreenPriv); - return ((*pScreen->CloseScreen) (i, pScreen)); + return ((*pScreen->CloseScreen) (pScreen)); } static void @@ -323,11 +352,10 @@ DGAUninstallColormap(ColormapPtr pmap) } int -xf86SetDGAMode(int index, int num, DGADevicePtr devRet) +xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); DGAScreenPtr pScreenPriv; - ScrnInfoPtr pScrn; DGADevicePtr device; PixmapPtr pPix = NULL; DGAModePtr pMode = NULL; @@ -338,7 +366,6 @@ xf86SetDGAMode(int index, int num, DGADevicePtr devRet) pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); if (!pScreenPriv) return BadValue; - pScrn = pScreenPriv->pScrn; if (!num) { if (pScreenPriv->current) { @@ -359,7 +386,7 @@ xf86SetDGAMode(int index, int num, DGADevicePtr devRet) pScreenPriv->savedColormap = NULL; } pScreenPriv->dgaColormap = NULL; - (*pScrn->EnableDisableFBAccess) (index, TRUE); + (*pScrn->EnableDisableFBAccess) (pScrn, TRUE); FreeMarkedVisuals(pScreen); } @@ -385,7 +412,7 @@ xf86SetDGAMode(int index, int num, DGADevicePtr devRet) Bool oldVTSema = pScrn->vtSema; pScrn->vtSema = FALSE; /* kludge until we rewrite VT switching */ - (*pScrn->EnableDisableFBAccess) (index, FALSE); + (*pScrn->EnableDisableFBAccess) (pScrn, FALSE); pScrn->vtSema = oldVTSema; } @@ -523,18 +550,27 @@ DGAChangePixmapMode(int index, int *x, int *y, int mode) } Bool -DGAAvailable(int index) +DGAScreenAvailable(ScreenPtr pScreen) { if (!DGAScreenKeyRegistered) return FALSE; - if (DGA_GET_SCREEN_PRIV(screenInfo.screens[index])) + if (DGA_GET_SCREEN_PRIV(pScreen)) return TRUE; - return FALSE; } Bool +DGAAvailable(int index) +{ + ScreenPtr pScreen; + + assert(index < MAXSCREENS); + pScreen = screenInfo.screens[index]; + return DGAScreenAvailable(pScreen); +} + +Bool DGAActive(int index) { DGAScreenPtr pScreenPriv; @@ -564,7 +600,7 @@ DGAShutdown(void) for (i = 0; i < screenInfo.numScreens; i++) { pScrn = xf86Screens[i]; - (void) (*pScrn->SetDGAMode) (pScrn->scrnIndex, 0, NULL); + (void) (*pScrn->SetDGAMode) (pScrn, 0, NULL); } } @@ -579,7 +615,7 @@ DGASetMode(int index, int num, XDGAModePtr mode, PixmapPtr *pPix) /* We rely on the extension to check that DGA is available */ - ret = (*pScrn->SetDGAMode) (index, num, &device); + ret = (*pScrn->SetDGAMode) (pScrn, num, &device); if ((ret == Success) && num) { DGACopyModeInfo(device.mode, mode); *pPix = device.pPix; @@ -893,15 +929,16 @@ DGAStealKeyEvent(DeviceIntPtr dev, int index, int key_code, int is_down) if (!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */ return FALSE; - memset(&event, 0, sizeof(event)); - event.header = ET_Internal; - event.type = ET_DGAEvent; - event.length = sizeof(event); - event.time = GetTimeInMillis(); - event.subtype = (is_down ? ET_KeyPress : ET_KeyRelease); - event.detail = key_code; - event.dx = 0; - event.dy = 0; + event = (DGAEvent) { + .header = ET_Internal, + .type = ET_DGAEvent, + .length = sizeof(event), + .time = GetTimeInMillis(), + .subtype = (is_down ? ET_KeyPress : ET_KeyRelease), + .detail = key_code, + .dx = 0, + .dy = 0 + }; mieqEnqueue(dev, (InternalEvent *) &event); return TRUE; @@ -921,15 +958,16 @@ DGAStealMotionEvent(DeviceIntPtr dev, int index, int dx, int dy) if (!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */ return FALSE; - memset(&event, 0, sizeof(event)); - event.header = ET_Internal; - event.type = ET_DGAEvent; - event.length = sizeof(event); - event.time = GetTimeInMillis(); - event.subtype = ET_Motion; - event.detail = 0; - event.dx = dx; - event.dy = dy; + event = (DGAEvent) { + .header = ET_Internal, + .type = ET_DGAEvent, + .length = sizeof(event), + .time = GetTimeInMillis(), + .subtype = ET_Motion, + .detail = 0, + .dx = dx, + .dy = dy + }; mieqEnqueue(dev, (InternalEvent *) &event); return TRUE; } @@ -948,15 +986,16 @@ DGAStealButtonEvent(DeviceIntPtr dev, int index, int button, int is_down) if (!pScreenPriv || !pScreenPriv->grabMouse) return FALSE; - memset(&event, 0, sizeof(event)); - event.header = ET_Internal; - event.type = ET_DGAEvent; - event.length = sizeof(event); - event.time = GetTimeInMillis(); - event.subtype = (is_down ? ET_ButtonPress : ET_ButtonRelease); - event.detail = button; - event.dx = 0; - event.dy = 0; + event = (DGAEvent) { + .header = ET_Internal, + .type = ET_DGAEvent, + .length = sizeof(event), + .time = GetTimeInMillis(), + .subtype = (is_down ? ET_ButtonPress : ET_ButtonRelease), + .detail = button, + .dx = 0, + .dy = 0 + }; mieqEnqueue(dev, (InternalEvent *) &event); return TRUE; @@ -981,33 +1020,35 @@ DGAProcessKeyboardEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr keybd) KeyClassPtr keyc = keybd->key; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); DeviceIntPtr pointer = GetMaster(keybd, POINTER_OR_FLOAT); - DeviceEvent ev; - - memset(&ev, 0, sizeof(ev)); - ev.header = ET_Internal; - ev.length = sizeof(ev); - ev.detail.key = event->detail; - ev.type = event->subtype; - ev.root_x = 0; - ev.root_y = 0; - ev.corestate = XkbStateFieldFromRec(&keyc->xkbInfo->state); + DeviceEvent ev = { + .header = ET_Internal, + .length = sizeof(ev), + .detail.key = event->detail, + .type = event->subtype, + .root_x = 0, + .root_y = 0, + .corestate = XkbStateFieldFromRec(&keyc->xkbInfo->state) + }; ev.corestate |= pointer->button->state; UpdateDeviceState(keybd, &ev); + if (!IsMaster(keybd)) + return; + /* * Deliver the DGA event */ if (pScreenPriv->client) { - dgaEvent de; - - de.u.u.type = *XDGAEventBase + GetCoreType(ev.type); + dgaEvent de = { + .u.event.time = event->time, + .u.event.dx = event->dx, + .u.event.dy = event->dy, + .u.event.screen = pScreen->myNum, + .u.event.state = ev.corestate + }; + de.u.u.type = DGAEventBase + GetCoreType(ev.type); de.u.u.detail = event->detail; - de.u.event.time = event->time; - de.u.event.dx = event->dx; - de.u.event.dy = event->dy; - de.u.event.screen = pScreen->myNum; - de.u.event.state = ev.corestate; /* If the DGA client has selected input, then deliver based on the usual filter */ TryClientEvents(pScreenPriv->client, keybd, (xEvent *) &de, 1, @@ -1032,35 +1073,37 @@ DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse) { ButtonClassPtr butc = mouse->button; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - DeviceEvent ev; DeviceIntPtr master = GetMaster(mouse, MASTER_KEYBOARD); + DeviceEvent ev = { + .header = ET_Internal, + .length = sizeof(ev), + .detail.key = event->detail, + .type = event->subtype, + .corestate = butc ? butc->state : 0 + }; - memset(&ev, 0, sizeof(ev)); - ev.header = ET_Internal; - ev.length = sizeof(ev); - ev.type = event->subtype; - ev.corestate = butc ? butc->state : 0; if (master && master->key) ev.corestate |= XkbStateFieldFromRec(&master->key->xkbInfo->state); UpdateDeviceState(mouse, &ev); + if (!IsMaster(mouse)) + return; + /* * Deliver the DGA event */ if (pScreenPriv->client) { - dgaEvent de; - int coreEquiv; - - coreEquiv = GetCoreType(ev.type); - - de.u.u.type = *XDGAEventBase + coreEquiv; + int coreEquiv = GetCoreType(ev.type); + dgaEvent de = { + .u.event.time = event->time, + .u.event.dx = event->dx, + .u.event.dy = event->dy, + .u.event.screen = pScreen->myNum, + .u.event.state = ev.corestate + }; + de.u.u.type = DGAEventBase + coreEquiv; de.u.u.detail = event->detail; - de.u.event.time = event->time; - de.u.event.dx = event->dx; - de.u.event.dy = event->dy; - de.u.event.screen = pScreen->myNum; - de.u.event.state = ev.corestate; /* If the DGA client has selected input, then deliver based on the usual filter */ TryClientEvents(pScreenPriv->client, mouse, (xEvent *) &de, 1, @@ -1146,17 +1189,14 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device) DGAScreenPtr pScreenPriv; /* no DGA */ - if (!DGAScreenKeyRegistered || XDGAEventBase == 0) - return; + if (!DGAScreenKeyRegistered || noXFree86DGAExtension) + return; pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); /* DGA not initialized on this screen */ if (!pScreenPriv) return; - if (!IsMaster(device)) - return; - switch (event->subtype) { case KeyPress: case KeyRelease: @@ -1171,3 +1211,989 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device) break; } } + +static void XDGAResetProc(ExtensionEntry * extEntry); + +static void DGAClientStateChange(CallbackListPtr *, pointer, pointer); + +static DevPrivateKeyRec DGAScreenPrivateKeyRec; + +#define DGAScreenPrivateKey (&DGAScreenPrivateKeyRec) +#define DGAScreenPrivateKeyRegistered (DGAScreenPrivateKeyRec.initialized) +static DevPrivateKeyRec DGAClientPrivateKeyRec; + +#define DGAClientPrivateKey (&DGAClientPrivateKeyRec) +static int DGACallbackRefCount = 0; + +/* This holds the client's version information */ +typedef struct { + int major; + int minor; +} DGAPrivRec, *DGAPrivPtr; + +#define DGA_GETCLIENT(idx) ((ClientPtr) \ + dixLookupPrivate(&screenInfo.screens[idx]->devPrivates, DGAScreenPrivateKey)) +#define DGA_SETCLIENT(idx,p) \ + dixSetPrivate(&screenInfo.screens[idx]->devPrivates, DGAScreenPrivateKey, p) + +#define DGA_GETPRIV(c) ((DGAPrivPtr) \ + dixLookupPrivate(&(c)->devPrivates, DGAClientPrivateKey)) +#define DGA_SETPRIV(c,p) \ + dixSetPrivate(&(c)->devPrivates, DGAClientPrivateKey, p) + +static void +XDGAResetProc(ExtensionEntry * extEntry) +{ + DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL); + DGACallbackRefCount = 0; +} + +static int +ProcXDGAQueryVersion(ClientPtr client) +{ + xXDGAQueryVersionReply rep; + + REQUEST_SIZE_MATCH(xXDGAQueryVersionReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.majorVersion = SERVER_XDGA_MAJOR_VERSION; + rep.minorVersion = SERVER_XDGA_MINOR_VERSION; + + WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *) &rep); + return Success; +} + +static int +ProcXDGAOpenFramebuffer(ClientPtr client) +{ + REQUEST(xXDGAOpenFramebufferReq); + xXDGAOpenFramebufferReply rep; + char *deviceName; + int nameSize; + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (!DGAAvailable(stuff->screen)) + return DGAErrorBase + XF86DGANoDirectVideoMode; + + REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + if (!DGAOpenFramebuffer(stuff->screen, &deviceName, + (unsigned char **) (&rep.mem1), + (int *) &rep.size, (int *) &rep.offset, + (int *) &rep.extra)) { + return BadAlloc; + } + + nameSize = deviceName ? (strlen(deviceName) + 1) : 0; + rep.length = bytes_to_int32(nameSize); + + WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *) &rep); + if (rep.length) + WriteToClient(client, nameSize, deviceName); + + return Success; +} + +static int +ProcXDGACloseFramebuffer(ClientPtr client) +{ + REQUEST(xXDGACloseFramebufferReq); + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (!DGAAvailable(stuff->screen)) + return DGAErrorBase + XF86DGANoDirectVideoMode; + + REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq); + + DGACloseFramebuffer(stuff->screen); + + return Success; +} + +static int +ProcXDGAQueryModes(ClientPtr client) +{ + int i, num, size; + + REQUEST(xXDGAQueryModesReq); + xXDGAQueryModesReply rep; + xXDGAModeInfo info; + XDGAModePtr mode; + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + REQUEST_SIZE_MATCH(xXDGAQueryModesReq); + rep.type = X_Reply; + rep.length = 0; + rep.number = 0; + rep.sequenceNumber = client->sequence; + + if (!DGAAvailable(stuff->screen)) { + rep.number = 0; + rep.length = 0; + WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep); + return Success; + } + + if (!(num = DGAGetModes(stuff->screen))) { + WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep); + return Success; + } + + if (!(mode = (XDGAModePtr) malloc(num * sizeof(XDGAModeRec)))) + return BadAlloc; + + for (i = 0; i < num; i++) + DGAGetModeInfo(stuff->screen, mode + i, i + 1); + + size = num * sz_xXDGAModeInfo; + for (i = 0; i < num; i++) + size += pad_to_int32(strlen(mode[i].name) + 1); /* plus NULL */ + + rep.number = num; + rep.length = bytes_to_int32(size); + + WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep); + + for (i = 0; i < num; i++) { + size = strlen(mode[i].name) + 1; + + info.byte_order = mode[i].byteOrder; + info.depth = mode[i].depth; + info.num = mode[i].num; + info.bpp = mode[i].bitsPerPixel; + info.name_size = (size + 3) & ~3L; + info.vsync_num = mode[i].VSync_num; + info.vsync_den = mode[i].VSync_den; + info.flags = mode[i].flags; + info.image_width = mode[i].imageWidth; + info.image_height = mode[i].imageHeight; + info.pixmap_width = mode[i].pixmapWidth; + info.pixmap_height = mode[i].pixmapHeight; + info.bytes_per_scanline = mode[i].bytesPerScanline; + info.red_mask = mode[i].red_mask; + info.green_mask = mode[i].green_mask; + info.blue_mask = mode[i].blue_mask; + info.visual_class = mode[i].visualClass; + info.viewport_width = mode[i].viewportWidth; + info.viewport_height = mode[i].viewportHeight; + info.viewport_xstep = mode[i].xViewportStep; + info.viewport_ystep = mode[i].yViewportStep; + info.viewport_xmax = mode[i].maxViewportX; + info.viewport_ymax = mode[i].maxViewportY; + info.viewport_flags = mode[i].viewportFlags; + info.reserved1 = mode[i].reserved1; + info.reserved2 = mode[i].reserved2; + + WriteToClient(client, sz_xXDGAModeInfo, (char *) (&info)); + WriteToClient(client, size, mode[i].name); + } + + free(mode); + + return Success; +} + +static void +DGAClientStateChange(CallbackListPtr *pcbl, pointer nulldata, pointer calldata) +{ + NewClientInfoRec *pci = (NewClientInfoRec *) calldata; + ClientPtr client = NULL; + int i; + + for (i = 0; i < screenInfo.numScreens; i++) { + if (DGA_GETCLIENT(i) == pci->client) { + client = pci->client; + break; + } + } + + if (client && + ((client->clientState == ClientStateGone) || + (client->clientState == ClientStateRetained))) { + XDGAModeRec mode; + PixmapPtr pPix; + + DGA_SETCLIENT(i, NULL); + DGASelectInput(i, NULL, 0); + DGASetMode(i, 0, &mode, &pPix); + + if (--DGACallbackRefCount == 0) + DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL); + } +} + +static int +ProcXDGASetMode(ClientPtr client) +{ + REQUEST(xXDGASetModeReq); + xXDGASetModeReply rep; + XDGAModeRec mode; + xXDGAModeInfo info; + PixmapPtr pPix; + ClientPtr owner; + int size; + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + owner = DGA_GETCLIENT(stuff->screen); + + REQUEST_SIZE_MATCH(xXDGASetModeReq); + rep.type = X_Reply; + rep.length = 0; + rep.offset = 0; + rep.flags = 0; + rep.sequenceNumber = client->sequence; + + if (!DGAAvailable(stuff->screen)) + return DGAErrorBase + XF86DGANoDirectVideoMode; + + if (owner && owner != client) + return DGAErrorBase + XF86DGANoDirectVideoMode; + + if (!stuff->mode) { + if (owner) { + if (--DGACallbackRefCount == 0) + DeleteCallback(&ClientStateCallback, DGAClientStateChange, + NULL); + } + DGA_SETCLIENT(stuff->screen, NULL); + DGASelectInput(stuff->screen, NULL, 0); + DGASetMode(stuff->screen, 0, &mode, &pPix); + WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep); + return Success; + } + + if (Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix)) + return BadValue; + + if (!owner) { + if (DGACallbackRefCount++ == 0) + AddCallback(&ClientStateCallback, DGAClientStateChange, NULL); + } + + DGA_SETCLIENT(stuff->screen, client); + + if (pPix) { + if (AddResource(stuff->pid, RT_PIXMAP, (pointer) (pPix))) { + pPix->drawable.id = (int) stuff->pid; + rep.flags = DGA_PIXMAP_AVAILABLE; + } + } + + size = strlen(mode.name) + 1; + + info.byte_order = mode.byteOrder; + info.depth = mode.depth; + info.num = mode.num; + info.bpp = mode.bitsPerPixel; + info.name_size = (size + 3) & ~3L; + info.vsync_num = mode.VSync_num; + info.vsync_den = mode.VSync_den; + info.flags = mode.flags; + info.image_width = mode.imageWidth; + info.image_height = mode.imageHeight; + info.pixmap_width = mode.pixmapWidth; + info.pixmap_height = mode.pixmapHeight; + info.bytes_per_scanline = mode.bytesPerScanline; + info.red_mask = mode.red_mask; + info.green_mask = mode.green_mask; + info.blue_mask = mode.blue_mask; + info.visual_class = mode.visualClass; + info.viewport_width = mode.viewportWidth; + info.viewport_height = mode.viewportHeight; + info.viewport_xstep = mode.xViewportStep; + info.viewport_ystep = mode.yViewportStep; + info.viewport_xmax = mode.maxViewportX; + info.viewport_ymax = mode.maxViewportY; + info.viewport_flags = mode.viewportFlags; + info.reserved1 = mode.reserved1; + info.reserved2 = mode.reserved2; + + rep.length = bytes_to_int32(sz_xXDGAModeInfo + info.name_size); + + WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep); + WriteToClient(client, sz_xXDGAModeInfo, (char *) (&info)); + WriteToClient(client, size, mode.name); + + return Success; +} + +static int +ProcXDGASetViewport(ClientPtr client) +{ + REQUEST(xXDGASetViewportReq); + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXDGASetViewportReq); + + DGASetViewport(stuff->screen, stuff->x, stuff->y, stuff->flags); + + return Success; +} + +static int +ProcXDGAInstallColormap(ClientPtr client) +{ + ColormapPtr cmap; + int rc; + + REQUEST(xXDGAInstallColormapReq); + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXDGAInstallColormapReq); + + rc = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, RT_COLORMAP, + client, DixInstallAccess); + if (rc != Success) + return rc; + DGAInstallCmap(cmap); + return Success; +} + +static int +ProcXDGASelectInput(ClientPtr client) +{ + REQUEST(xXDGASelectInputReq); + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXDGASelectInputReq); + + if (DGA_GETCLIENT(stuff->screen) == client) + DGASelectInput(stuff->screen, client, stuff->mask); + + return Success; +} + +static int +ProcXDGAFillRectangle(ClientPtr client) +{ + REQUEST(xXDGAFillRectangleReq); + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXDGAFillRectangleReq); + + if (Success != DGAFillRect(stuff->screen, stuff->x, stuff->y, + stuff->width, stuff->height, stuff->color)) + return BadMatch; + + return Success; +} + +static int +ProcXDGACopyArea(ClientPtr client) +{ + REQUEST(xXDGACopyAreaReq); + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXDGACopyAreaReq); + + if (Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy, + stuff->width, stuff->height, stuff->dstx, + stuff->dsty)) + return BadMatch; + + return Success; +} + +static int +ProcXDGACopyTransparentArea(ClientPtr client) +{ + REQUEST(xXDGACopyTransparentAreaReq); + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq); + + if (Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy, + stuff->width, stuff->height, stuff->dstx, + stuff->dsty, stuff->key)) + return BadMatch; + + return Success; +} + +static int +ProcXDGAGetViewportStatus(ClientPtr client) +{ + REQUEST(xXDGAGetViewportStatusReq); + xXDGAGetViewportStatusReply rep; + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + rep.status = DGAGetViewportStatus(stuff->screen); + + WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *) &rep); + return Success; +} + +static int +ProcXDGASync(ClientPtr client) +{ + REQUEST(xXDGASyncReq); + xXDGASyncReply rep; + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXDGASyncReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + DGASync(stuff->screen); + + WriteToClient(client, sizeof(xXDGASyncReply), (char *) &rep); + return Success; +} + +static int +ProcXDGASetClientVersion(ClientPtr client) +{ + REQUEST(xXDGASetClientVersionReq); + + DGAPrivPtr pPriv; + + REQUEST_SIZE_MATCH(xXDGASetClientVersionReq); + if ((pPriv = DGA_GETPRIV(client)) == NULL) { + pPriv = malloc(sizeof(DGAPrivRec)); + /* XXX Need to look into freeing this */ + if (!pPriv) + return BadAlloc; + DGA_SETPRIV(client, pPriv); + } + pPriv->major = stuff->major; + pPriv->minor = stuff->minor; + + return Success; +} + +static int +ProcXDGAChangePixmapMode(ClientPtr client) +{ + REQUEST(xXDGAChangePixmapModeReq); + xXDGAChangePixmapModeReply rep; + int x, y; + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + x = stuff->x; + y = stuff->y; + + if (!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags)) + return BadMatch; + + rep.x = x; + rep.y = y; + WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *) &rep); + + return Success; +} + +static int +ProcXDGACreateColormap(ClientPtr client) +{ + REQUEST(xXDGACreateColormapReq); + int result; + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXDGACreateColormapReq); + + if (!stuff->mode) + return BadValue; + + result = DGACreateColormap(stuff->screen, client, stuff->id, + stuff->mode, stuff->alloc); + if (result != Success) + return result; + + return Success; +} + +/* + * + * Support for the old DGA protocol, used to live in xf86dga.c + * + */ + +#ifdef DGA_PROTOCOL_OLD_SUPPORT + +static int +ProcXF86DGAGetVideoLL(ClientPtr client) +{ + REQUEST(xXF86DGAGetVideoLLReq); + xXF86DGAGetVideoLLReply rep; + XDGAModeRec mode; + int num, offset, flags; + char *name; + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + if (!DGAAvailable(stuff->screen)) + return DGAErrorBase + XF86DGANoDirectVideoMode; + + if (!(num = DGAGetOldDGAMode(stuff->screen))) + return DGAErrorBase + XF86DGANoDirectVideoMode; + + /* get the parameters for the mode that best matches */ + DGAGetModeInfo(stuff->screen, &mode, num); + + if (!DGAOpenFramebuffer(stuff->screen, &name, + (unsigned char **) (&rep.offset), + (int *) (&rep.bank_size), &offset, &flags)) + return BadAlloc; + + rep.offset += mode.offset; + rep.width = mode.bytesPerScanline / (mode.bitsPerPixel >> 3); + rep.ram_size = rep.bank_size >> 10; + + WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *) &rep); + return Success; +} + +static int +ProcXF86DGADirectVideo(ClientPtr client) +{ + int num; + PixmapPtr pix; + XDGAModeRec mode; + ClientPtr owner; + + REQUEST(xXF86DGADirectVideoReq); + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq); + + if (!DGAAvailable(stuff->screen)) + return DGAErrorBase + XF86DGANoDirectVideoMode; + + owner = DGA_GETCLIENT(stuff->screen); + + if (owner && owner != client) + return DGAErrorBase + XF86DGANoDirectVideoMode; + + if (stuff->enable & XF86DGADirectGraphics) { + if (!(num = DGAGetOldDGAMode(stuff->screen))) + return DGAErrorBase + XF86DGANoDirectVideoMode; + } + else + num = 0; + + if (Success != DGASetMode(stuff->screen, num, &mode, &pix)) + return DGAErrorBase + XF86DGAScreenNotActive; + + DGASetInputMode(stuff->screen, + (stuff->enable & XF86DGADirectKeyb) != 0, + (stuff->enable & XF86DGADirectMouse) != 0); + + /* We need to track the client and attach the teardown callback */ + if (stuff->enable & + (XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse)) { + if (!owner) { + if (DGACallbackRefCount++ == 0) + AddCallback(&ClientStateCallback, DGAClientStateChange, NULL); + } + + DGA_SETCLIENT(stuff->screen, client); + } + else { + if (owner) { + if (--DGACallbackRefCount == 0) + DeleteCallback(&ClientStateCallback, DGAClientStateChange, + NULL); + } + + DGA_SETCLIENT(stuff->screen, NULL); + } + + return Success; +} + +static int +ProcXF86DGAGetViewPortSize(ClientPtr client) +{ + int num; + XDGAModeRec mode; + + REQUEST(xXF86DGAGetViewPortSizeReq); + xXF86DGAGetViewPortSizeReply rep; + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + if (!DGAAvailable(stuff->screen)) + return DGAErrorBase + XF86DGANoDirectVideoMode; + + if (!(num = DGAGetOldDGAMode(stuff->screen))) + return DGAErrorBase + XF86DGANoDirectVideoMode; + + DGAGetModeInfo(stuff->screen, &mode, num); + + rep.width = mode.viewportWidth; + rep.height = mode.viewportHeight; + + WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *) &rep); + return Success; +} + +static int +ProcXF86DGASetViewPort(ClientPtr client) +{ + REQUEST(xXF86DGASetViewPortReq); + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq); + + if (!DGAAvailable(stuff->screen)) + return DGAErrorBase + XF86DGANoDirectVideoMode; + + if (!DGAActive(stuff->screen)) + return DGAErrorBase + XF86DGADirectNotActivated; + + if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE) + != Success) + return DGAErrorBase + XF86DGADirectNotActivated; + + return Success; +} + +static int +ProcXF86DGAGetVidPage(ClientPtr client) +{ + REQUEST(xXF86DGAGetVidPageReq); + xXF86DGAGetVidPageReply rep; + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.vpage = 0; /* silently fail */ + + WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), (char *) &rep); + return Success; +} + +static int +ProcXF86DGASetVidPage(ClientPtr client) +{ + REQUEST(xXF86DGASetVidPageReq); + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq); + + /* silently fail */ + + return Success; +} + +static int +ProcXF86DGAInstallColormap(ClientPtr client) +{ + ColormapPtr pcmp; + int rc; + + REQUEST(xXF86DGAInstallColormapReq); + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq); + + if (!DGAActive(stuff->screen)) + return DGAErrorBase + XF86DGADirectNotActivated; + + rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP, + client, DixInstallAccess); + if (rc == Success) { + DGAInstallCmap(pcmp); + return Success; + } + else { + return rc; + } +} + +static int +ProcXF86DGAQueryDirectVideo(ClientPtr client) +{ + REQUEST(xXF86DGAQueryDirectVideoReq); + xXF86DGAQueryDirectVideoReply rep; + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.flags = 0; + + if (DGAAvailable(stuff->screen)) + rep.flags = XF86DGADirectPresent; + + WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *) &rep); + return Success; +} + +static int +ProcXF86DGAViewPortChanged(ClientPtr client) +{ + REQUEST(xXF86DGAViewPortChangedReq); + xXF86DGAViewPortChangedReply rep; + + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + + if (DGA_GETCLIENT(stuff->screen) != client) + return DGAErrorBase + XF86DGADirectNotActivated; + + REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq); + + if (!DGAActive(stuff->screen)) + return DGAErrorBase + XF86DGADirectNotActivated; + + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.result = 1; + + WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *) &rep); + return Success; +} + +#endif /* DGA_PROTOCOL_OLD_SUPPORT */ + +static int +SProcXDGADispatch(ClientPtr client) +{ + return DGAErrorBase + XF86DGAClientNotLocal; +} + +#if 0 +#define DGA_REQ_DEBUG +#endif + +#ifdef DGA_REQ_DEBUG +static char *dgaMinor[] = { + "QueryVersion", + "GetVideoLL", + "DirectVideo", + "GetViewPortSize", + "SetViewPort", + "GetVidPage", + "SetVidPage", + "InstallColormap", + "QueryDirectVideo", + "ViewPortChanged", + "10", + "11", + "QueryModes", + "SetMode", + "SetViewport", + "InstallColormap", + "SelectInput", + "FillRectangle", + "CopyArea", + "CopyTransparentArea", + "GetViewportStatus", + "Sync", + "OpenFramebuffer", + "CloseFramebuffer", + "SetClientVersion", + "ChangePixmapMode", + "CreateColormap", +}; +#endif + +static int +ProcXDGADispatch(ClientPtr client) +{ + REQUEST(xReq); + + if (!LocalClient(client)) + return DGAErrorBase + XF86DGAClientNotLocal; + +#ifdef DGA_REQ_DEBUG + if (stuff->data <= X_XDGACreateColormap) + fprintf(stderr, " DGA %s\n", dgaMinor[stuff->data]); +#endif + + switch (stuff->data) { + /* + * DGA2 Protocol + */ + case X_XDGAQueryVersion: + return ProcXDGAQueryVersion(client); + case X_XDGAQueryModes: + return ProcXDGAQueryModes(client); + case X_XDGASetMode: + return ProcXDGASetMode(client); + case X_XDGAOpenFramebuffer: + return ProcXDGAOpenFramebuffer(client); + case X_XDGACloseFramebuffer: + return ProcXDGACloseFramebuffer(client); + case X_XDGASetViewport: + return ProcXDGASetViewport(client); + case X_XDGAInstallColormap: + return ProcXDGAInstallColormap(client); + case X_XDGASelectInput: + return ProcXDGASelectInput(client); + case X_XDGAFillRectangle: + return ProcXDGAFillRectangle(client); + case X_XDGACopyArea: + return ProcXDGACopyArea(client); + case X_XDGACopyTransparentArea: + return ProcXDGACopyTransparentArea(client); + case X_XDGAGetViewportStatus: + return ProcXDGAGetViewportStatus(client); + case X_XDGASync: + return ProcXDGASync(client); + case X_XDGASetClientVersion: + return ProcXDGASetClientVersion(client); + case X_XDGAChangePixmapMode: + return ProcXDGAChangePixmapMode(client); + case X_XDGACreateColormap: + return ProcXDGACreateColormap(client); + /* + * Old DGA Protocol + */ +#ifdef DGA_PROTOCOL_OLD_SUPPORT + case X_XF86DGAGetVideoLL: + return ProcXF86DGAGetVideoLL(client); + case X_XF86DGADirectVideo: + return ProcXF86DGADirectVideo(client); + case X_XF86DGAGetViewPortSize: + return ProcXF86DGAGetViewPortSize(client); + case X_XF86DGASetViewPort: + return ProcXF86DGASetViewPort(client); + case X_XF86DGAGetVidPage: + return ProcXF86DGAGetVidPage(client); + case X_XF86DGASetVidPage: + return ProcXF86DGASetVidPage(client); + case X_XF86DGAInstallColormap: + return ProcXF86DGAInstallColormap(client); + case X_XF86DGAQueryDirectVideo: + return ProcXF86DGAQueryDirectVideo(client); + case X_XF86DGAViewPortChanged: + return ProcXF86DGAViewPortChanged(client); +#endif /* DGA_PROTOCOL_OLD_SUPPORT */ + default: + return BadRequest; + } +} + +void +XFree86DGAExtensionInit(void) +{ + ExtensionEntry *extEntry; + + if (!dixRegisterPrivateKey(&DGAClientPrivateKeyRec, PRIVATE_CLIENT, 0)) + return; + + if (!dixRegisterPrivateKey(&DGAScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) + return; + + if ((extEntry = AddExtension(XF86DGANAME, + XF86DGANumberEvents, + XF86DGANumberErrors, + ProcXDGADispatch, + SProcXDGADispatch, + XDGAResetProc, StandardMinorOpcode))) { + int i; + + DGAReqCode = (unsigned char) extEntry->base; + DGAErrorBase = extEntry->errorBase; + DGAEventBase = extEntry->eventBase; + for (i = KeyPress; i <= MotionNotify; i++) + SetCriticalEvent(DGAEventBase + i); + } +} diff --git a/xserver/hw/xfree86/common/xf86DPMS.c b/xserver/hw/xfree86/common/xf86DPMS.c index 75f034239..ef4a2c19b 100644 --- a/xserver/hw/xfree86/common/xf86DPMS.c +++ b/xserver/hw/xfree86/common/xf86DPMS.c @@ -49,7 +49,7 @@ #ifdef DPMSExtension static DevPrivateKeyRec DPMSKeyRec; static DevPrivateKey DPMSKey; -static Bool DPMSClose(int i, ScreenPtr pScreen); +static Bool DPMSClose(ScreenPtr pScreen); static int DPMSCount = 0; #endif @@ -57,7 +57,7 @@ Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) { #ifdef DPMSExtension - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); DPMSPtr pDPMS; pointer DPMSOpt; MessageType enabled_from; @@ -99,10 +99,10 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) #ifdef DPMSExtension static Bool -DPMSClose(int i, ScreenPtr pScreen) +DPMSClose(ScreenPtr pScreen) { DPMSPtr pDPMS; - + ScrnInfoPtr pScrn; /* This shouldn't happen */ if (DPMSKey == NULL) return FALSE; @@ -114,20 +114,20 @@ DPMSClose(int i, ScreenPtr pScreen) return FALSE; pScreen->CloseScreen = pDPMS->CloseScreen; - + pScrn = xf86ScreenToScrn(pScreen); /* * Turn on DPMS when shutting down. If this function can be used * depends on the order the driver wraps things. If this is called * after the driver has shut down everything the driver will have * to deal with this internally. */ - if (xf86Screens[i]->vtSema && xf86Screens[i]->DPMSSet) { - xf86Screens[i]->DPMSSet(xf86Screens[i], DPMSModeOn, 0); + if (pScrn->vtSema && pScrn->DPMSSet) { + pScrn->DPMSSet(pScrn, DPMSModeOn, 0); } if (--DPMSCount == 0) DPMSKey = NULL; - return pScreen->CloseScreen(i, pScreen); + return pScreen->CloseScreen(pScreen); } /* diff --git a/xserver/hw/xfree86/common/xf86Events.c b/xserver/hw/xfree86/common/xf86Events.c index 058057e92..7e80fa922 100644 --- a/xserver/hw/xfree86/common/xf86Events.c +++ b/xserver/hw/xfree86/common/xf86Events.c @@ -180,6 +180,7 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) switch (action) { case ACTION_TERMINATE: if (!xf86Info.dontZap) { + xf86Msg(X_INFO, "Server zapped. Shutting down.\n"); #ifdef XFreeXDGA DGAShutdown(); #endif @@ -254,7 +255,7 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) while (pInfo) { if (pInfo->read_input && pInfo->fd >= 0 && (FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) { - int sigstate = xf86BlockSIGIO(); + OsBlockSIGIO(); /* * Remove the descriptior from the set because more than one @@ -263,7 +264,7 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) FD_CLR(pInfo->fd, &devicesWithInput); pInfo->read_input(pInfo); - xf86UnblockSIGIO(sigstate); + OsReleaseSIGIO(); } pInfo = pInfo->next; } @@ -397,9 +398,9 @@ xf86ReleaseKeys(DeviceIntPtr pDev) for (i = keyc->xkbInfo->desc->min_key_code; i < keyc->xkbInfo->desc->max_key_code; i++) { if (key_is_down(pDev, i, KEY_POSTED)) { - sigstate = xf86BlockSIGIO(); + OsBlockSIGIO(); QueueKeyboardEvents(pDev, KeyRelease, i, NULL); - xf86UnblockSIGIO(sigstate); + OsReleaseSIGIO(); } } } @@ -438,7 +439,7 @@ xf86VTSwitch(void) for (i = 0; i < xf86NumScreens; i++) { if (!(dispatchException & DE_TERMINATE)) if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE); } /* @@ -449,15 +450,19 @@ xf86VTSwitch(void) xf86DisableInputHandler(ih); for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) { if (pInfo->dev) { + if (!pInfo->dev->enabled) + pInfo->flags |= XI86_DEVICE_DISABLED; xf86ReleaseKeys(pInfo->dev); ProcessInputEvents(); DisableDevice(pInfo->dev, TRUE); } } - prevSIGIO = xf86BlockSIGIO(); + OsBlockSIGIO(); for (i = 0; i < xf86NumScreens; i++) - xf86Screens[i]->LeaveVT(i, 0); + xf86Screens[i]->LeaveVT(xf86Screens[i]); + for (i = 0; i < xf86NumGPUScreens; i++) + xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]); xf86AccessLeave(); /* We need this here, otherwise */ @@ -469,27 +474,32 @@ xf86VTSwitch(void) DebugF("xf86VTSwitch: Leave failed\n"); xf86AccessEnter(); for (i = 0; i < xf86NumScreens; i++) { - if (!xf86Screens[i]->EnterVT(i, 0)) + if (!xf86Screens[i]->EnterVT(xf86Screens[i])) FatalError("EnterVT failed for screen %d\n", i); } + for (i = 0; i < xf86NumGPUScreens; i++) { + if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i])) + FatalError("EnterVT failed for gpu screen %d\n", i); + } if (!(dispatchException & DE_TERMINATE)) { for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); } } dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); pInfo = xf86InputDevs; while (pInfo) { - if (pInfo->dev) + if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0) EnableDevice(pInfo->dev, TRUE); + pInfo->flags &= ~XI86_DEVICE_DISABLED; pInfo = pInfo->next; } for (ih = InputHandlers; ih; ih = ih->next) xf86EnableInputHandler(ih); - xf86UnblockSIGIO(prevSIGIO); + OsReleaseSIGIO(); } else { @@ -524,12 +534,17 @@ xf86VTSwitch(void) xf86AccessEnter(); for (i = 0; i < xf86NumScreens; i++) { xf86Screens[i]->vtSema = TRUE; - if (!xf86Screens[i]->EnterVT(i, 0)) + if (!xf86Screens[i]->EnterVT(xf86Screens[i])) FatalError("EnterVT failed for screen %d\n", i); } + for (i = 0; i < xf86NumGPUScreens; i++) { + xf86GPUScreens[i]->vtSema = TRUE; + if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i])) + FatalError("EnterVT failed for gpu screen %d\n", i); + } for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); } /* Turn screen saver off when switching back */ @@ -537,15 +552,16 @@ xf86VTSwitch(void) pInfo = xf86InputDevs; while (pInfo) { - if (pInfo->dev) + if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0) EnableDevice(pInfo->dev, TRUE); + pInfo->flags &= ~XI86_DEVICE_DISABLED; pInfo = pInfo->next; } for (ih = InputHandlers; ih; ih = ih->next) xf86EnableInputHandler(ih); - xf86UnblockSIGIO(prevSIGIO); + OsReleaseSIGIO(); } } @@ -603,14 +619,16 @@ InputHandlerProc xf86SetConsoleHandler(InputHandlerProc proc, pointer data) { static IHPtr handler = NULL; - IHPtr old_handler = handler; + InputHandlerProc old_proc = NULL; - if (old_handler) - xf86RemoveGeneralHandler(old_handler); + if (handler) { + old_proc = handler->ihproc; + xf86RemoveGeneralHandler(handler); + } handler = xf86AddGeneralHandler(xf86Info.consoleFd, proc, data); - return (old_handler) ? old_handler->ihproc : NULL; + return old_proc; } static void diff --git a/xserver/hw/xfree86/common/xf86Extensions.c b/xserver/hw/xfree86/common/xf86Extensions.c new file mode 100644 index 000000000..d5309d558 --- /dev/null +++ b/xserver/hw/xfree86/common/xf86Extensions.c @@ -0,0 +1,142 @@ +/* + * Copyright © 2011 Daniel Stone + * + * 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: Daniel Stone <daniel@fooishbar.org> + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "extension.h" +#include "globals.h" + +#include "xf86.h" +#include "xf86Config.h" +#include "xf86Module.h" +#include "xf86Extensions.h" +#include "xf86Opt.h" +#include "optionstr.h" + +#ifdef XSELINUX +#include "xselinux.h" +#endif + +#ifdef XFreeXDGA +#include <X11/extensions/xf86dgaproto.h> +#endif + +#ifdef XF86VIDMODE +#include <X11/extensions/xf86vmproto.h> +#include "vidmodeproc.h" +#endif + +/* + * DDX-specific extensions. + */ +static ExtensionModule extensionModules[] = { +#ifdef XF86VIDMODE + { + XFree86VidModeExtensionInit, + XF86VIDMODENAME, + &noXFree86VidModeExtension + }, +#endif +#ifdef XFreeXDGA + { + XFree86DGAExtensionInit, + XF86DGANAME, + &noXFree86DGAExtension + }, +#endif +#ifdef XF86DRI + { + XFree86DRIExtensionInit, + "XFree86-DRI", + &noXFree86DRIExtension + }, +#endif +#ifdef DRI2 + { + DRI2ExtensionInit, + DRI2_NAME, + &noDRI2Extension + } +#endif +}; + +static void +load_extension_config(void) +{ + XF86ConfModulePtr mod_con = xf86configptr->conf_modules; + XF86LoadPtr modp; + int i; + + /* Only the best. */ + if (!mod_con) + return; + + nt_list_for_each_entry(modp, mod_con->mod_load_lst, list.next) { + InputOption *opt; + + if (strcasecmp(modp->load_name, "extmod") != 0) + continue; + + /* extmod options are of the form "omit <extension-name>" */ + nt_list_for_each_entry(opt, modp->load_opt, list.next) { + const char *key = input_option_get_key(opt); + if (strncasecmp(key, "omit", 4) != 0 || strlen(key) < 5) + continue; + if (EnableDisableExtension(key + 4, FALSE)) + xf86MarkOptionUsed(opt); + } + +#ifdef XSELINUX + if ((opt = xf86FindOption(modp->load_opt, + "SELinux mode disabled"))) { + xf86MarkOptionUsed(opt); + selinuxEnforcingState = SELINUX_MODE_DISABLED; + } + if ((opt = xf86FindOption(modp->load_opt, + "SELinux mode permissive"))) { + xf86MarkOptionUsed(opt); + selinuxEnforcingState = SELINUX_MODE_PERMISSIVE; + } + if ((opt = xf86FindOption(modp->load_opt, + "SELinux mode enforcing"))) { + xf86MarkOptionUsed(opt); + selinuxEnforcingState = SELINUX_MODE_ENFORCING; + } +#endif + } +} + +void +xf86ExtensionInit(void) +{ + int i; + + load_extension_config(); + + for (i = 0; i < ARRAY_SIZE(extensionModules); i++) + LoadExtension(&extensionModules[i], TRUE); +} diff --git a/xserver/hw/xfree86/common/xf86Extensions.h b/xserver/hw/xfree86/common/xf86Extensions.h new file mode 100644 index 000000000..cad86c881 --- /dev/null +++ b/xserver/hw/xfree86/common/xf86Extensions.h @@ -0,0 +1,55 @@ +/* + * Copyright © 2011 Daniel Stone + * + * 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: Daniel Stone <daniel@fooishbar.org> + */ + +#ifndef XF86EXTENSIONS_H +#define XF86EXTENSIONS_H + +#include "extnsionst.h" + +#ifdef XF86DRI +extern _X_EXPORT Bool noXFree86DRIExtension; +extern void XFree86DRIExtensionInit(void); +#endif + +#ifdef DRI2 +#include <X11/extensions/dri2proto.h> +extern _X_EXPORT Bool noDRI2Extension; +extern void DRI2ExtensionInit(void); +#endif + +#ifdef XF86VIDMODE +#include <X11/extensions/xf86vmproto.h> +extern _X_EXPORT Bool noXFree86VidModeExtension; +extern void XFree86VidModeExtensionInit(void); +#endif + +#ifdef XFreeXDGA +#include <X11/extensions/xf86dgaproto.h> +extern _X_EXPORT Bool noXFree86DGAExtension; +extern void XFree86DGAExtensionInit(void); +extern void XFree86DGARegister(void); +#endif + +#endif diff --git a/xserver/hw/xfree86/common/xf86Globals.c b/xserver/hw/xfree86/common/xf86Globals.c index 0071004eb..7df7a80c4 100644 --- a/xserver/hw/xfree86/common/xf86Globals.c +++ b/xserver/hw/xfree86/common/xf86Globals.c @@ -51,6 +51,7 @@ DevPrivateKeyRec xf86CreateRootWindowKeyRec; DevPrivateKeyRec xf86ScreenKeyRec; ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */ +ScrnInfoPtr *xf86GPUScreens = NULL; /* List of ScrnInfos */ const unsigned char byte_reversed[256] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, @@ -125,11 +126,16 @@ xf86InfoRec xf86Info = { #if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) .forceInputDevices = FALSE, .autoAddDevices = TRUE, - .autoEnableDevices = TRUE + .autoEnableDevices = TRUE, #else .forceInputDevices = TRUE, .autoAddDevices = FALSE, - .autoEnableDevices = FALSE + .autoEnableDevices = FALSE, +#endif +#if defined(CONFIG_UDEV_KMS) + .autoAddGPU = TRUE, +#else + .autoAddGPU = FALSE, #endif }; @@ -153,6 +159,7 @@ int xf86NumDrivers = 0; InputDriverPtr *xf86InputDriverList = NULL; int xf86NumInputDrivers = 0; int xf86NumScreens = 0; +int xf86NumGPUScreens = 0; const char *xf86VisualNames[] = { "StaticGray", diff --git a/xserver/hw/xfree86/common/xf86Helper.c b/xserver/hw/xfree86/common/xf86Helper.c index 8c948cf6f..721159d0b 100644 --- a/xserver/hw/xfree86/common/xf86Helper.c +++ b/xserver/hw/xfree86/common/xf86Helper.c @@ -167,29 +167,43 @@ ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags) { int i; + ScrnInfoPtr pScrn; - if (xf86Screens == NULL) - xf86NumScreens = 0; - - i = xf86NumScreens++; - xf86Screens = xnfrealloc(xf86Screens, xf86NumScreens * sizeof(ScrnInfoPtr)); - xf86Screens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1); - xf86Screens[i]->scrnIndex = i; /* Changes when a screen is removed */ - xf86Screens[i]->origIndex = i; /* This never changes */ - xf86Screens[i]->privates = xnfcalloc(sizeof(DevUnion), - xf86ScrnInfoPrivateCount); + if (flags & XF86_ALLOCATE_GPU_SCREEN) { + if (xf86GPUScreens == NULL) + xf86NumGPUScreens = 0; + i = xf86NumGPUScreens++; + xf86GPUScreens = xnfrealloc(xf86GPUScreens, xf86NumGPUScreens * sizeof(ScrnInfoPtr)); + xf86GPUScreens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1); + pScrn = xf86GPUScreens[i]; + pScrn->scrnIndex = i + GPU_SCREEN_OFFSET; /* Changes when a screen is removed */ + pScrn->is_gpu = TRUE; + } else { + if (xf86Screens == NULL) + xf86NumScreens = 0; + + i = xf86NumScreens++; + xf86Screens = xnfrealloc(xf86Screens, xf86NumScreens * sizeof(ScrnInfoPtr)); + xf86Screens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1); + pScrn = xf86Screens[i]; + + pScrn->scrnIndex = i; /* Changes when a screen is removed */ + } + + pScrn->origIndex = pScrn->scrnIndex; /* This never changes */ + pScrn->privates = xnfcalloc(sizeof(DevUnion), xf86ScrnInfoPrivateCount); /* * EnableDisableFBAccess now gets initialized in InitOutput() - * xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess; + * pScrn->EnableDisableFBAccess = xf86EnableDisableFBAccess; */ - xf86Screens[i]->drv = drv; + pScrn->drv = drv; drv->refCount++; - xf86Screens[i]->module = DuplicateModule(drv->module, NULL); + pScrn->module = DuplicateModule(drv->module, NULL); - xf86Screens[i]->DriverFunc = drv->driverFunc; + pScrn->DriverFunc = drv->driverFunc; - return xf86Screens[i]; + return pScrn; } /* @@ -198,24 +212,29 @@ xf86AllocateScreen(DriverPtr drv, int flags) */ void -xf86DeleteScreen(int scrnIndex, int flags) +xf86DeleteScreen(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn; int i; + int scrnIndex; + Bool is_gpu = FALSE; + if (pScrn->is_gpu) { + /* First check if the screen is valid */ + if (xf86NumGPUScreens == 0 || xf86GPUScreens == NULL) + return; + is_gpu = TRUE; + } else { + /* First check if the screen is valid */ + if (xf86NumScreens == 0 || xf86Screens == NULL) + return; + } - /* First check if the screen is valid */ - if (xf86NumScreens == 0 || xf86Screens == NULL) - return; - - if (scrnIndex > xf86NumScreens - 1) - return; - - if (!(pScrn = xf86Screens[scrnIndex])) + if (!pScrn) return; + scrnIndex = pScrn->scrnIndex; /* If a FreeScreen function is defined, call it here */ if (pScrn->FreeScreen != NULL) - pScrn->FreeScreen(scrnIndex, 0); + pScrn->FreeScreen(pScrn); while (pScrn->modes) xf86DeleteMode(&pScrn->modes, pScrn->modes); @@ -233,18 +252,29 @@ xf86DeleteScreen(int scrnIndex, int flags) free(pScrn->privates); - xf86ClearEntityListForScreen(scrnIndex); + xf86ClearEntityListForScreen(pScrn); free(pScrn); /* Move the other entries down, updating their scrnIndex fields */ - xf86NumScreens--; + if (is_gpu) { + xf86NumGPUScreens--; + scrnIndex -= GPU_SCREEN_OFFSET; + for (i = scrnIndex; i < xf86NumGPUScreens; i++) { + xf86GPUScreens[i] = xf86GPUScreens[i + 1]; + xf86GPUScreens[i]->scrnIndex = i + GPU_SCREEN_OFFSET; + /* Also need to take care of the screen layout settings */ + } + } + else { + xf86NumScreens--; - for (i = scrnIndex; i < xf86NumScreens; i++) { - xf86Screens[i] = xf86Screens[i + 1]; - xf86Screens[i]->scrnIndex = i; - /* Also need to take care of the screen layout settings */ + for (i = scrnIndex; i < xf86NumScreens; i++) { + xf86Screens[i] = xf86Screens[i + 1]; + xf86Screens[i]->scrnIndex = i; + /* Also need to take care of the screen layout settings */ + } } } @@ -268,6 +298,14 @@ xf86AllocateScrnInfoPrivateIndex(void) memset(&nprivs[idx], 0, sizeof(DevUnion)); pScr->privates = nprivs; } + for (i = 0; i < xf86NumGPUScreens; i++) { + pScr = xf86GPUScreens[i]; + nprivs = xnfrealloc(pScr->privates, + xf86ScrnInfoPrivateCount * sizeof(DevUnion)); + /* Zero the new private */ + memset(&nprivs[idx], 0, sizeof(DevUnion)); + pScr->privates = nprivs; + } return idx; } @@ -1027,9 +1065,8 @@ xf86SetBlackWhitePixels(ScreenPtr pScreen) * private data, and therefore don't need to access pScrnInfo->vtSema. */ void -xf86EnableDisableFBAccess(int scrnIndex, Bool enable) +xf86EnableDisableFBAccess(ScrnInfoPtr pScrnInfo, Bool enable) { - ScrnInfoPtr pScrnInfo = xf86Screens[scrnIndex]; ScreenPtr pScreen = pScrnInfo->pScreen; PixmapPtr pspix; @@ -1061,6 +1098,11 @@ xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, xf86Screens[scrnIndex]->name) LogHdrMessageVerb(type, verb, format, args, "%s(%d): ", xf86Screens[scrnIndex]->name, scrnIndex); + else if (scrnIndex >= GPU_SCREEN_OFFSET && + scrnIndex < GPU_SCREEN_OFFSET + xf86NumGPUScreens && + xf86GPUScreens[scrnIndex - GPU_SCREEN_OFFSET]->name) + LogHdrMessageVerb(type, verb, format, args, "%s(G%d): ", + xf86GPUScreens[scrnIndex - GPU_SCREEN_OFFSET]->name, scrnIndex - GPU_SCREEN_OFFSET); else LogVMessageVerb(type, verb, format, args); } @@ -1577,7 +1619,7 @@ xf86SetBackingStore(ScreenPtr pScreen) { Bool useBS = FALSE; MessageType from = X_DEFAULT; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); OptionInfoPtr options; options = xnfalloc(sizeof(BSOptions)); @@ -1618,7 +1660,7 @@ xf86SetSilkenMouse(ScreenPtr pScreen) { Bool useSM = TRUE; MessageType from = X_DEFAULT; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); OptionInfoPtr options; options = xnfalloc(sizeof(SMOptions)); @@ -1651,10 +1693,9 @@ xf86SetSilkenMouse(ScreenPtr pScreen) /* Wrote this function for the PM2 Xv driver, preliminary. */ pointer -xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name, +xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, char *port_name, char **adaptor_name, pointer *adaptor_options) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; confXvAdaptorPtr adaptor; int i; @@ -1726,9 +1767,8 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, } Bool -xf86IsScreenPrimary(int scrnIndex) +xf86IsScreenPrimary(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; int i; for (i = 0; i < pScrn->numEntities; i++) { @@ -1834,3 +1874,33 @@ xf86MotionHistoryAllocate(InputInfoPtr pInfo) { AllocateMotionHistory(pInfo->dev); } + +ScrnInfoPtr +xf86ScreenToScrn(ScreenPtr pScreen) +{ + if (pScreen->isGPU) { + assert(pScreen->myNum - GPU_SCREEN_OFFSET < xf86NumGPUScreens); + return xf86GPUScreens[pScreen->myNum - GPU_SCREEN_OFFSET]; + } else { + assert(pScreen->myNum < xf86NumScreens); + return xf86Screens[pScreen->myNum]; + } +} + +ScreenPtr +xf86ScrnToScreen(ScrnInfoPtr pScrn) +{ + if (pScrn->is_gpu) { + assert(pScrn->scrnIndex - GPU_SCREEN_OFFSET < screenInfo.numGPUScreens); + return screenInfo.gpuscreens[pScrn->scrnIndex - GPU_SCREEN_OFFSET]; + } else { + assert(pScrn->scrnIndex < screenInfo.numScreens); + return screenInfo.screens[pScrn->scrnIndex]; + } +} + +void +xf86UpdateDesktopDimensions(void) +{ + update_desktop_dimensions(); +} diff --git a/xserver/hw/xfree86/common/xf86Init.c b/xserver/hw/xfree86/common/xf86Init.c index 7c32bf5d9..630a35891 100644 --- a/xserver/hw/xfree86/common/xf86Init.c +++ b/xserver/hw/xfree86/common/xf86Init.c @@ -398,17 +398,20 @@ InstallSignalHandlers(void) void InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) { - int i, j, k, scr_index, was_blocked = 0; + int i, j, k, scr_index; char **modulelist; pointer *optionlist; Pix24Flags screenpix24, pix24; MessageType pix24From = X_DEFAULT; Bool pix24Fail = FALSE; Bool autoconfig = FALSE; + Bool sigio_blocked = FALSE; GDevPtr configured_device; xf86Initialising = TRUE; + config_pre_init(); + if (serverGeneration == 1) { if ((xf86ServerName = strrchr(argv[0], '/')) != 0) xf86ServerName++; @@ -473,6 +476,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) xf86OSPMClose = xf86OSPMOpen(); #endif + xf86ExtensionInit(); + /* Load all modules specified explicitly in the config file */ if ((modulelist = xf86ModulelistFromConfig(&optionlist))) { xf86LoadModules(modulelist, optionlist); @@ -593,7 +598,19 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) } for (i = 0; i < xf86NumScreens; i++) if (!xf86Screens[i]->configured) - xf86DeleteScreen(i--, 0); + xf86DeleteScreen(xf86Screens[i--]); + + for (i = 0; i < xf86NumGPUScreens; i++) { + xf86VGAarbiterScrnInit(xf86GPUScreens[i]); + xf86VGAarbiterLock(xf86GPUScreens[i]); + if (xf86GPUScreens[i]->PreInit && + xf86GPUScreens[i]->PreInit(xf86GPUScreens[i], 0)) + xf86GPUScreens[i]->configured = TRUE; + xf86VGAarbiterUnlock(xf86GPUScreens[i]); + } + for (i = 0; i < xf86NumGPUScreens; i++) + if (!xf86GPUScreens[i]->configured) + xf86DeleteScreen(xf86GPUScreens[i--]); /* * If no screens left, return now. @@ -808,7 +825,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ); #endif xf86AccessEnter(); - was_blocked = xf86BlockSIGIO(); + OsBlockSIGIO(); + sigio_blocked = TRUE; } } @@ -820,6 +838,36 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) !dixRegisterPrivateKey(&xf86CreateRootWindowKeyRec, PRIVATE_SCREEN, 0)) FatalError("Cannot register DDX private keys"); + for (i = 0; i < xf86NumGPUScreens; i++) { + ScrnInfoPtr pScrn = xf86GPUScreens[i]; + xf86VGAarbiterLock(pScrn); + + /* + * Almost everything uses these defaults, and many of those that + * don't, will wrap them. + */ + pScrn->EnableDisableFBAccess = xf86EnableDisableFBAccess; +#ifdef XFreeXDGA + pScrn->SetDGAMode = xf86SetDGAMode; +#endif + pScrn->DPMSSet = NULL; + pScrn->LoadPalette = NULL; + pScrn->SetOverscan = NULL; + pScrn->DriverFunc = NULL; + pScrn->pScreen = NULL; + scr_index = AddGPUScreen(pScrn->ScreenInit, argc, argv); + xf86VGAarbiterUnlock(pScrn); + if (scr_index == i) { + dixSetPrivate(&screenInfo.gpuscreens[scr_index]->devPrivates, + xf86ScreenKey, xf86GPUScreens[i]); + pScrn->pScreen = screenInfo.gpuscreens[scr_index]; + /* The driver should set this, but make sure it is set anyway */ + pScrn->vtSema = TRUE; + } else { + FatalError("AddScreen/ScreenInit failed for gpu driver %d %d\n", i, scr_index); + } + } + for (i = 0; i < xf86NumScreens; i++) { xf86VGAarbiterLock(xf86Screens[i]); /* @@ -880,8 +928,12 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) #endif } + for (i = 0; i < xf86NumGPUScreens; i++) + AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); + xf86VGAarbiterWrapFunctions(); - xf86UnblockSIGIO(was_blocked); + if (sigio_blocked) + OsReleaseSIGIO(); xf86InitOrigins(); @@ -977,7 +1029,6 @@ OsVendorInit(void) xf86DropPriv(display); } #endif - xf86UnblockSIGIO(0); beenHere = TRUE; } @@ -1036,7 +1087,7 @@ AbortDDX(enum ExitCode error) { int i; - xf86BlockSIGIO(); + OsBlockSIGIO(); /* * try to restore the original video state @@ -1054,7 +1105,7 @@ AbortDDX(enum ExitCode error) * screen explicitely. */ xf86VGAarbiterLock(xf86Screens[i]); - (xf86Screens[i]->LeaveVT) (i, 0); + (xf86Screens[i]->LeaveVT) (xf86Screens[i]); xf86VGAarbiterUnlock(xf86Screens[i]); } } @@ -1069,19 +1120,19 @@ AbortDDX(enum ExitCode error) } void -OsVendorFatalError(void) +OsVendorFatalError(const char *f, va_list args) { #ifdef VENDORSUPPORT - ErrorF("\nPlease refer to your Operating System Vendor support pages\n" - "at %s for support on this crash.\n", VENDORSUPPORT); + ErrorFSigSafe("\nPlease refer to your Operating System Vendor support " + "pages\nat %s for support on this crash.\n", VENDORSUPPORT); #else - ErrorF("\nPlease consult the " XVENDORNAME " support \n" - "\t at " __VENDORDWEBSUPPORT__ "\n for help. \n"); + ErrorFSigSafe("\nPlease consult the " XVENDORNAME " support \n\t at " + __VENDORDWEBSUPPORT__ "\n for help. \n"); #endif if (xf86LogFile && xf86LogFileWasOpened) - ErrorF("Please also check the log file at \"%s\" for additional " - "information.\n", xf86LogFile); - ErrorF("\n"); + ErrorFSigSafe("Please also check the log file at \"%s\" for additional " + "information.\n", xf86LogFile); + ErrorFSigSafe("\n"); } int @@ -1177,7 +1228,7 @@ ddxProcessArgument(int argc, char **argv, int i) #ifdef X_PRIVSEP /* Cannot drop privs when -xf86config is used with unsafe path */ if (!xf86PathIsSafe(xf86ConfigFile)) - xf86KeepPriv = TRUE; + xf86KeepPriv = TRUE; #endif return 2; } @@ -1394,7 +1445,7 @@ ddxProcessArgument(int argc, char **argv, int i) } #ifdef X_PRIVSEP if (!strcmp(argv[i], "-keepPriv")) { - if (getuid() != 0 && geteuid() == 0) { + if (getuid() != 0) { ErrorF("The '-keepPriv' option can only be used by root.\n"); exit(1); } @@ -1507,8 +1558,7 @@ ddxUseMsg(void) ("-novtswitch don't automatically switch VT at reset & exit\n"); ErrorF("-sharevts share VTs with another X server\n"); #ifdef X_PRIVSEP - ErrorF("-keepPriv " - "don't revoque privileges when running as root\n"); + ErrorF("-keepPriv don't revoque privs when running as root\n"); #endif /* OS-specific usage */ xf86UseMsg(); @@ -1618,3 +1668,10 @@ xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth) else return 0; } + +#ifdef DDXBEFORERESET +void +ddxBeforeReset(void) +{ +} +#endif diff --git a/xserver/hw/xfree86/common/xf86Mode.c b/xserver/hw/xfree86/common/xf86Mode.c index ab4d595c7..d80dec892 100644 --- a/xserver/hw/xfree86/common/xf86Mode.c +++ b/xserver/hw/xfree86/common/xf86Mode.c @@ -950,7 +950,7 @@ xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, mode->SynthClock /= 2; } - status = (*scrp->ValidMode) (scrp->scrnIndex, mode, FALSE, + status = (*scrp->ValidMode) (scrp, mode, FALSE, MODECHECK_INITIAL); if (status != MODE_OK) return status; @@ -1840,7 +1840,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, scrp->virtualX = newVirtX; scrp->virtualY = newVirtY; scrp->displayWidth = newLinePitch; - p->status = (scrp->ValidMode) (scrp->scrnIndex, p, FALSE, + p->status = (scrp->ValidMode) (scrp, p, FALSE, MODECHECK_FINAL); if (p->status != MODE_OK) { diff --git a/xserver/hw/xfree86/common/xf86Module.h b/xserver/hw/xfree86/common/xf86Module.h index 894b93f59..f58b87e30 100644 --- a/xserver/hw/xfree86/common/xf86Module.h +++ b/xserver/hw/xfree86/common/xf86Module.h @@ -42,6 +42,7 @@ #define _XF86MODULE_H #include "misc.h" +#include "extension.h" #ifndef NULL #define NULL ((void *)0) #endif @@ -55,9 +56,6 @@ typedef enum { #define DEFAULT_LIST ((char *)-1) -/* This indicates a special module that doesn't have the usual entry point */ -#define EXTERN_MODULE ((pointer)-1) - /* Built-in ABI classes. These definitions must not be changed. */ #define ABI_CLASS_NONE NULL #define ABI_CLASS_ANSIC "X.Org ANSI C Emulation" @@ -82,9 +80,9 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(12, 0) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(16, 0) -#define ABI_EXTENSION_VERSION SET_ABI_VERSION(6, 0) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(13, 1) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(18, 0) +#define ABI_EXTENSION_VERSION SET_ABI_VERSION(7, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) #define MODINFOSTRING1 0xef23fdc5 @@ -171,18 +169,6 @@ typedef struct { #define INITARGS void -typedef void (*InitExtension) (INITARGS); - -typedef struct { - InitExtension initFunc; - const char *name; - Bool *disablePtr; - InitExtension setupFunc; - const char **initDependencies; -} ExtensionModule; - -extern _X_EXPORT ExtensionModule *ExtensionModuleList; - /* Prototypes for Loader functions that are exported to modules */ extern _X_EXPORT pointer LoadSubModule(pointer, const char *, const char **, const char **, pointer, @@ -193,7 +179,6 @@ extern _X_EXPORT pointer LoaderSymbol(const char *); extern _X_EXPORT char **LoaderListDirs(const char **, const char **); extern _X_EXPORT void LoaderFreeDirList(char **); extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int); -extern _X_EXPORT void LoadExtension(ExtensionModule *, Bool); extern _X_EXPORT void LoaderGetOS(const char **name, int *major, int *minor, int *teeny); extern _X_EXPORT Bool LoaderShouldIgnoreABI(void); diff --git a/xserver/hw/xfree86/common/xf86PM.c b/xserver/hw/xfree86/common/xf86PM.c index f69fffa0e..15257cb81 100644 --- a/xserver/hw/xfree86/common/xf86PM.c +++ b/xserver/hw/xfree86/common/xf86PM.c @@ -92,8 +92,6 @@ eventName(pmEvent event, const char **str) } } -static int sigio_blocked_for_suspend; - static void suspend(pmEvent event, Bool undo) { @@ -102,19 +100,19 @@ suspend(pmEvent event, Bool undo) for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE); } pInfo = xf86InputDevs; while (pInfo) { DisableDevice(pInfo->dev, TRUE); pInfo = pInfo->next; } - sigio_blocked_for_suspend = xf86BlockSIGIO(); + OsBlockSIGIO(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) - xf86Screens[i]->PMEvent(i, event, undo); + xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); else { - xf86Screens[i]->LeaveVT(i, 0); + xf86Screens[i]->LeaveVT(xf86Screens[i]); xf86Screens[i]->vtSema = FALSE; } } @@ -131,16 +129,16 @@ resume(pmEvent event, Bool undo) xf86AccessEnter(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) - xf86Screens[i]->PMEvent(i, event, undo); + xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); else { xf86Screens[i]->vtSema = TRUE; - xf86Screens[i]->EnterVT(i, 0); + xf86Screens[i]->EnterVT(xf86Screens[i]); } } - xf86UnblockSIGIO(sigio_blocked_for_suspend); + OsReleaseSIGIO(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); } dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); pInfo = xf86InputDevs; @@ -153,7 +151,7 @@ resume(pmEvent event, Bool undo) static void DoApmEvent(pmEvent event, Bool undo) { - int i, was_blocked; + int i; switch (event) { #if 0 @@ -184,13 +182,13 @@ DoApmEvent(pmEvent event, Bool undo) } break; default: - was_blocked = xf86BlockSIGIO(); + OsBlockSIGIO(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) { - xf86Screens[i]->PMEvent(i, event, undo); + xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); } } - xf86UnblockSIGIO(was_blocked); + OsReleaseSIGIO(); break; } } diff --git a/xserver/hw/xfree86/common/xf86Priv.h b/xserver/hw/xfree86/common/xf86Priv.h index 8d9cb5539..c9f2e7eb8 100644 --- a/xserver/hw/xfree86/common/xf86Priv.h +++ b/xserver/hw/xfree86/common/xf86Priv.h @@ -95,6 +95,8 @@ extern _X_EXPORT Bool xorgHWAccess; extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable; +extern ScrnInfoPtr *xf86GPUScreens; /* List of pointers to ScrnInfoRecs */ +extern int xf86NumGPUScreens; #ifndef DEFAULT_VERBOSE #define DEFAULT_VERBOSE 0 #endif @@ -114,8 +116,9 @@ extern _X_EXPORT void xf86BusProbe(void); extern _X_EXPORT void xf86AccessEnter(void); extern _X_EXPORT void xf86AccessLeave(void); extern _X_EXPORT void xf86PostProbe(void); -extern _X_EXPORT void xf86ClearEntityListForScreen(int scrnIndex); +extern _X_EXPORT void xf86ClearEntityListForScreen(ScrnInfoPtr pScrn); extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev); +extern _X_EXPORT void xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev); /* xf86Config.c */ diff --git a/xserver/hw/xfree86/common/xf86Privstr.h b/xserver/hw/xfree86/common/xf86Privstr.h index e78cd407d..e20be03a9 100644 --- a/xserver/hw/xfree86/common/xf86Privstr.h +++ b/xserver/hw/xfree86/common/xf86Privstr.h @@ -110,6 +110,8 @@ typedef struct { Bool dri2; MessageType dri2From; + + Bool autoAddGPU; } xf86InfoRec, *xf86InfoPtr; #ifdef DPMSExtension diff --git a/xserver/hw/xfree86/common/xf86RandR.c b/xserver/hw/xfree86/common/xf86RandR.c index abd894dff..5606bee4b 100644 --- a/xserver/hw/xfree86/common/xf86RandR.c +++ b/xserver/hw/xfree86/common/xf86RandR.c @@ -66,7 +66,7 @@ static Bool xf86RandRGetInfo(ScreenPtr pScreen, Rotation * rotations) { RRScreenSizePtr pSize; - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int refresh0 = 60; @@ -147,7 +147,7 @@ xf86RandRSetMode(ScreenPtr pScreen, DisplayModePtr mode, Bool useVirtual, int mmWidth, int mmHeight) { - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); int oldWidth = pScreen->width; int oldHeight = pScreen->height; @@ -159,7 +159,7 @@ xf86RandRSetMode(ScreenPtr pScreen, Bool ret = TRUE; if (pRoot && scrp->vtSema) - (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE); + (*scrp->EnableDisableFBAccess) (scrp, FALSE); if (useVirtual) { scrp->virtualX = randrp->virtualX; scrp->virtualY = randrp->virtualY; @@ -220,7 +220,7 @@ xf86RandRSetMode(ScreenPtr pScreen, xf86SetViewport(pScreen, pScreen->width, pScreen->height); xf86SetViewport(pScreen, 0, 0); if (pRoot && scrp->vtSema) - (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE); + (*scrp->EnableDisableFBAccess) (scrp, TRUE); return ret; } @@ -228,7 +228,7 @@ static Bool xf86RandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int pos[MAXDEVICES][2]; @@ -344,7 +344,7 @@ xf86RandRCreateScreenResources(ScreenPtr pScreen) XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); #if 0 - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); DisplayModePtr mode; #endif @@ -365,9 +365,9 @@ xf86RandRCreateScreenResources(ScreenPtr pScreen) * Reset size back to original */ static Bool -xf86RandRCloseScreen(int index, ScreenPtr pScreen) +xf86RandRCloseScreen(ScreenPtr pScreen) { - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); scrp->virtualX = pScreen->width = randrp->virtualX; @@ -376,7 +376,7 @@ xf86RandRCloseScreen(int index, ScreenPtr pScreen) pScreen->CloseScreen = randrp->CloseScreen; free(randrp); dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, NULL); - return (*pScreen->CloseScreen) (index, pScreen); + return (*pScreen->CloseScreen) (pScreen); } Rotation @@ -417,8 +417,9 @@ xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, /* This is only for during server start */ if (resetMode) { + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); return (xf86RandRSetMode(pScreen, - XF86SCRNINFO(pScreen)->currentMode, + pScrn->currentMode, TRUE, pScreen->mmWidth, pScreen->mmHeight)); } @@ -430,7 +431,7 @@ xf86RandRInit(ScreenPtr pScreen) { rrScrPrivPtr rp; XF86RandRInfoPtr randrp; - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); #ifdef PANORAMIX /* XXX disable RandR when using Xinerama */ diff --git a/xserver/hw/xfree86/common/xf86VGAarbiter.c b/xserver/hw/xfree86/common/xf86VGAarbiter.c index 7c9e6ba02..225fff06e 100644 --- a/xserver/hw/xfree86/common/xf86VGAarbiter.c +++ b/xserver/hw/xfree86/common/xf86VGAarbiter.c @@ -106,7 +106,7 @@ xf86VGAarbiterAllowDRI(ScreenPtr pScreen) { int vga_count; int rsrc_decodes; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (vga_no_arb) return TRUE; @@ -173,7 +173,7 @@ xf86VGAarbiterWrapFunctions(void) for (i = 0; i < xf86NumScreens; i++) { pScreen = xf86Screens[i]->pScreen; ps = GetPictureScreenIfSet(pScreen); - pScrn = xf86Screens[pScreen->myNum]; + pScrn = xf86ScreenToScrn(pScreen); PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); if (!dixRegisterPrivateKey @@ -221,10 +221,10 @@ xf86VGAarbiterWrapFunctions(void) /* Screen funcs */ static Bool -VGAarbiterCloseScreen(int i, ScreenPtr pScreen) +VGAarbiterCloseScreen(ScreenPtr pScreen) { Bool val; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); @@ -258,34 +258,30 @@ VGAarbiterCloseScreen(int i, ScreenPtr pScreen) UNWRAP_SPRITE; free((pointer) pScreenPriv); - xf86VGAarbiterLock(xf86Screens[i]); - val = (*pScreen->CloseScreen) (i, pScreen); - xf86VGAarbiterUnlock(xf86Screens[i]); + xf86VGAarbiterLock(xf86ScreenToScrn(pScreen)); + val = (*pScreen->CloseScreen) (pScreen); + xf86VGAarbiterUnlock(xf86ScreenToScrn(pScreen)); return val; } static void -VGAarbiterBlockHandler(int i, - pointer blockData, pointer pTimeout, pointer pReadmask) +VGAarbiterBlockHandler(ScreenPtr pScreen, + pointer pTimeout, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[i]; - SCREEN_PROLOG(BlockHandler); VGAGet(pScreen); - pScreen->BlockHandler(i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler(pScreen, pTimeout, pReadmask); VGAPut(); SCREEN_EPILOG(BlockHandler, VGAarbiterBlockHandler); } static void -VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, +VGAarbiterWakeupHandler(ScreenPtr pScreen, unsigned long result, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[i]; - SCREEN_PROLOG(WakeupHandler); VGAGet(pScreen); - pScreen->WakeupHandler(i, blockData, result, pReadmask); + pScreen->WakeupHandler(pScreen, result, pReadmask); VGAPut(); SCREEN_EPILOG(WakeupHandler, VGAarbiterWakeupHandler); } @@ -298,9 +294,7 @@ VGAarbiterGetImage(DrawablePtr pDrawable, ScreenPtr pScreen = pDrawable->pScreen; SCREEN_PROLOG(GetImage); -// if (xf86Screens[pScreen->myNum]->vtSema) { VGAGet(pScreen); -// } (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); VGAPut(); SCREEN_EPILOG(GetImage, VGAarbiterGetImage); @@ -468,46 +462,45 @@ VGAarbiterSetCursorPosition(DeviceIntPtr pDev, } static void -VGAarbiterAdjustFrame(int index, int x, int y, int flags) +VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); - (*pScreenPriv->AdjustFrame) (index, x, y, flags); + (*pScreenPriv->AdjustFrame) (pScrn, x, y); VGAPut(); } static Bool -VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags) +VGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { Bool val; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); - val = (*pScreenPriv->SwitchMode) (index, mode, flags); + val = (*pScreenPriv->SwitchMode) (pScrn, mode); VGAPut(); return val; } static Bool -VGAarbiterEnterVT(int index, int flags) +VGAarbiterEnterVT(ScrnInfoPtr pScrn) { Bool val; - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); pScrn->EnterVT = pScreenPriv->EnterVT; - val = (*pScrn->EnterVT) (index, flags); + val = (*pScrn->EnterVT) (pScrn); pScreenPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = VGAarbiterEnterVT; VGAPut(); @@ -515,32 +508,31 @@ VGAarbiterEnterVT(int index, int flags) } static void -VGAarbiterLeaveVT(int index, int flags) +VGAarbiterLeaveVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); pScrn->LeaveVT = pScreenPriv->LeaveVT; - (*pScreenPriv->LeaveVT) (index, flags); + (*pScreenPriv->LeaveVT) (pScrn); pScreenPriv->LeaveVT = pScrn->LeaveVT; pScrn->LeaveVT = VGAarbiterLeaveVT; VGAPut(); } static void -VGAarbiterFreeScreen(int index, int flags) +VGAarbiterFreeScreen(ScrnInfoPtr pScrn) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); - (*pScreenPriv->FreeScreen) (index, flags); + (*pScreenPriv->FreeScreen) (pScrn); VGAPut(); } diff --git a/xserver/hw/xfree86/common/xf86VGAarbiterPriv.h b/xserver/hw/xfree86/common/xf86VGAarbiterPriv.h index 2513ce65d..ba6edfcc3 100644 --- a/xserver/hw/xfree86/common/xf86VGAarbiterPriv.h +++ b/xserver/hw/xfree86/common/xf86VGAarbiterPriv.h @@ -95,7 +95,7 @@ static inline void VGAGet(ScreenPtr pScreen) { - pci_device_vgaarb_set_target(xf86Screens[pScreen->myNum]->vgaDev); + pci_device_vgaarb_set_target(xf86ScreenToScrn(pScreen)->vgaDev); pci_device_vgaarb_lock(); } @@ -125,11 +125,11 @@ typedef struct _VGAarbiterScreen { UnrealizeCursorProcPtr UnrealizeCursor; RecolorCursorProcPtr RecolorCursor; SetCursorPositionProcPtr SetCursorPosition; - void (*AdjustFrame) (int, int, int, int); - Bool (*SwitchMode) (int, DisplayModePtr, int); - Bool (*EnterVT) (int, int); - void (*LeaveVT) (int, int); - void (*FreeScreen) (int, int); + void (*AdjustFrame) (ScrnInfoPtr, int, int); + Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr); + Bool (*EnterVT) (ScrnInfoPtr); + void (*LeaveVT) (ScrnInfoPtr); + void (*FreeScreen) (ScrnInfoPtr); miPointerSpriteFuncPtr miSprite; CompositeProcPtr Composite; GlyphsProcPtr Glyphs; @@ -142,11 +142,11 @@ typedef struct _VGAarbiterGC { } VGAarbiterGCRec, *VGAarbiterGCPtr; /* Screen funcs */ -static void VGAarbiterBlockHandler(int i, pointer blockData, pointer pTimeout, +static void VGAarbiterBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask); -static void VGAarbiterWakeupHandler(int i, pointer blockData, +static void VGAarbiterWakeupHandler(ScreenPtr pScreen, unsigned long result, pointer pReadmask); -static Bool VGAarbiterCloseScreen(int i, ScreenPtr pScreen); +static Bool VGAarbiterCloseScreen(ScreenPtr pScreen); static void VGAarbiterGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine); @@ -176,11 +176,11 @@ static Bool VGAarbiterDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, static Bool VGAarbiterSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent); -static void VGAarbiterAdjustFrame(int index, int x, int y, int flags); -static Bool VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags); -static Bool VGAarbiterEnterVT(int index, int flags); -static void VGAarbiterLeaveVT(int index, int flags); -static void VGAarbiterFreeScreen(int index, int flags); +static void VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y); +static Bool VGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode); +static Bool VGAarbiterEnterVT(ScrnInfoPtr pScrn); +static void VGAarbiterLeaveVT(ScrnInfoPtr pScrn); +static void VGAarbiterFreeScreen(ScrnInfoPtr pScrn); /* GC funcs */ static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes, diff --git a/xserver/hw/xfree86/common/xf86VidMode.c b/xserver/hw/xfree86/common/xf86VidMode.c index 13ffe061c..a7d1c25bf 100644 --- a/xserver/hw/xfree86/common/xf86VidMode.c +++ b/xserver/hw/xfree86/common/xf86VidMode.c @@ -50,7 +50,7 @@ static DevPrivateKeyRec VidModeKeyRec; static DevPrivateKey VidModeKey; static int VidModeCount = 0; -static Bool VidModeClose(int i, ScreenPtr pScreen); +static Bool VidModeClose(ScreenPtr pScreen); #define VMPTR(p) ((VidModePtr)dixLookupPrivate(&(p)->devPrivates, VidModeKey)) @@ -93,7 +93,7 @@ VidModeExtensionInit(ScreenPtr pScreen) #ifdef XF86VIDMODE static Bool -VidModeClose(int i, ScreenPtr pScreen) +VidModeClose(ScreenPtr pScreen) { VidModePtr pVidMode = VMPTR(pScreen); @@ -108,7 +108,7 @@ VidModeClose(int i, ScreenPtr pScreen) dixSetPrivate(&pScreen->devPrivates, VidModeKey, NULL); VidModeKey = NULL; } - return pScreen->CloseScreen(i, pScreen); + return pScreen->CloseScreen(pScreen); } Bool @@ -303,7 +303,7 @@ VidModeSetViewPort(int scrnIndex, int x, int y) pScrn->virtualY - pScrn->currentMode->VDisplay); pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay - 1; if (pScrn->AdjustFrame != NULL) - (pScrn->AdjustFrame) (scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + (pScrn->AdjustFrame) (pScrn, pScrn->frameX0, pScrn->frameY0); return TRUE; } diff --git a/xserver/hw/xfree86/common/xf86Xinput.c b/xserver/hw/xfree86/common/xf86Xinput.c index bee407bf9..3433d2670 100644 --- a/xserver/hw/xfree86/common/xf86Xinput.c +++ b/xserver/hw/xfree86/common/xf86Xinput.c @@ -1,6 +1,6 @@ /* * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org> - * + * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that @@ -9,8 +9,8 @@ * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Frederic Lepied makes no * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * + * is provided "as is" without express or implied warranty. + * * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -305,7 +305,7 @@ ApplyTransformationMatrix(DeviceIntPtr dev) /*********************************************************************** * * xf86ProcessCommonOptions -- - * + * * Process global options. * *********************************************************************** @@ -1021,7 +1021,7 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev) OsReleaseSignals(); } -/* +/* * convenient functions to post events */ @@ -1345,7 +1345,7 @@ xf86FirstLocalDevice(void) return xf86InputDevs; } -/* +/* * Cx - raw data from touch screen * to_max - scaled highest dimension * (remember, this is of rows - 1 because of 0 origin) @@ -1419,7 +1419,7 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum) * Device will be moved to the off_devices list, but it will still be there * until you really clean up after it. * Notifies the client about an inactive device. - * + * * @param panic True if device is unrecoverable and needs to be removed. */ void @@ -1437,7 +1437,7 @@ xf86DisableDevice(DeviceIntPtr dev, Bool panic) /** * Reactivate a device. Call this function from the driver if you just found * out that the read error wasn't quite that bad after all. - * Device will be re-activated, and an event sent to the client. + * Device will be re-activated, and an event sent to the client. */ void xf86EnableDevice(DeviceIntPtr dev) diff --git a/xserver/hw/xfree86/common/xf86Xinput.h b/xserver/hw/xfree86/common/xf86Xinput.h index 3731a34d5..35c38a554 100644 --- a/xserver/hw/xfree86/common/xf86Xinput.h +++ b/xserver/hw/xfree86/common/xf86Xinput.h @@ -61,18 +61,21 @@ #define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */ /* the device sends Xinput and core pointer events */ #define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE +/* 0x08 is reserved for legacy XI86_SEND_DRAG_EVENTS, do not use for now */ +/* server-internal only */ +#define XI86_DEVICE_DISABLED 0x10 /* device was disabled before vt switch */ /* This holds the input driver entry and module information. */ typedef struct _InputDriverRec { int driverVersion; - char *driverName; + const char *driverName; void (*Identify) (int flags); int (*PreInit) (struct _InputDriverRec * drv, struct _InputInfoRec * pInfo, int flags); void (*UnInit) (struct _InputDriverRec * drv, struct _InputInfoRec * pInfo, int flags); pointer module; - char **default_options; + const char **default_options; } InputDriverRec, *InputDriverPtr; /* This is to input devices what the ScrnInfoRec is to screens. */ @@ -95,7 +98,7 @@ typedef struct _InputInfoRec { int fd; DeviceIntPtr dev; pointer private; - char *type_name; + const char *type_name; InputDriverPtr drv; pointer module; XF86OptionPtr options; diff --git a/xserver/hw/xfree86/common/xf86cmap.c b/xserver/hw/xfree86/common/xf86cmap.c index cdc8459af..25f84e579 100644 --- a/xserver/hw/xfree86/common/xf86cmap.c +++ b/xserver/hw/xfree86/common/xf86cmap.c @@ -66,7 +66,7 @@ #define LOAD_PALETTE(pmap) \ ((pmap == GetInstalledmiColormap(pmap->pScreen)) && \ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \ - xf86Screens[pmap->pScreen->myNum]->vtSema || pScreenPriv->isDGAmode)) + xf86ScreenToScrn(pmap->pScreen)->vtSema || pScreenPriv->isDGAmode)) typedef struct _CMapLink { ColormapPtr cmap; @@ -80,9 +80,9 @@ typedef struct { DestroyColormapProcPtr DestroyColormap; InstallColormapProcPtr InstallColormap; StoreColorsProcPtr StoreColors; - Bool (*EnterVT) (int, int); - Bool (*SwitchMode) (int, DisplayModePtr, int); - int (*SetDGAMode) (int, int, DGADevicePtr); + Bool (*EnterVT) (ScrnInfoPtr); + Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr); + int (*SetDGAMode) (ScrnInfoPtr, int, DGADevicePtr); xf86ChangeGammaProc *ChangeGamma; int maxColors; int sigRGBbits; @@ -111,17 +111,17 @@ static DevPrivateKeyRec CMapColormapKeyRec; static void CMapInstallColormap(ColormapPtr); static void CMapStoreColors(ColormapPtr, int, xColorItem *); -static Bool CMapCloseScreen(int, ScreenPtr); +static Bool CMapCloseScreen(ScreenPtr); static Bool CMapCreateColormap(ColormapPtr); static void CMapDestroyColormap(ColormapPtr); -static Bool CMapEnterVT(int, int); -static Bool CMapSwitchMode(int, DisplayModePtr, int); +static Bool CMapEnterVT(ScrnInfoPtr); +static Bool CMapSwitchMode(ScrnInfoPtr, DisplayModePtr); #ifdef XFreeXDGA -static int CMapSetDGAMode(int, int, DGADevicePtr); +static int CMapSetDGAMode(ScrnInfoPtr, int, DGADevicePtr); #endif -static int CMapChangeGamma(int, Gamma); +static int CMapChangeGamma(ScrnInfoPtr, Gamma); static void ComputeGamma(CMapScreenPtr); static Bool CMapAllocateColormapPrivate(ColormapPtr); @@ -151,7 +151,7 @@ xf86HandleColormaps(ScreenPtr pScreen, xf86LoadPaletteProc * loadPalette, xf86SetOverscanProc * setOverscan, unsigned int flags) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ColormapPtr pDefMap = NULL; CMapScreenPtr pScreenPriv; LOCO *gamma; @@ -241,11 +241,11 @@ xf86HandleColormaps(ScreenPtr pScreen, /**** Screen functions ****/ static Bool -CMapCloseScreen(int i, ScreenPtr pScreen) +CMapCloseScreen(ScreenPtr pScreen) { CMapUnwrapScreen(pScreen); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } static Bool @@ -462,16 +462,15 @@ CMapInstallColormap(ColormapPtr pmap) /**** ScrnInfoRec functions ****/ static Bool -CMapEnterVT(int index, int flags) +CMapEnterVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); Bool ret; CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); pScrn->EnterVT = pScreenPriv->EnterVT; - ret = (*pScreenPriv->EnterVT) (index, flags); + ret = (*pScreenPriv->EnterVT) (pScrn); pScreenPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = CMapEnterVT; if (ret) { @@ -483,13 +482,13 @@ CMapEnterVT(int index, int flags) } static Bool -CMapSwitchMode(int index, DisplayModePtr mode, int flags) +CMapSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); - if ((*pScreenPriv->SwitchMode) (index, mode, flags)) { + if ((*pScreenPriv->SwitchMode) (pScrn, mode)) { if (GetInstalledmiColormap(pScreen)) CMapReinstallMap(GetInstalledmiColormap(pScreen)); return TRUE; @@ -499,19 +498,19 @@ CMapSwitchMode(int index, DisplayModePtr mode, int flags) #ifdef XFreeXDGA static int -CMapSetDGAMode(int index, int num, DGADevicePtr dev) +CMapSetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr dev) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); int ret; - ret = (*pScreenPriv->SetDGAMode) (index, num, dev); + ret = (*pScreenPriv->SetDGAMode) (pScrn, num, dev); - pScreenPriv->isDGAmode = DGAActive(index); + pScreenPriv->isDGAmode = DGAActive(pScrn->scrnIndex); if (!pScreenPriv->isDGAmode && GetInstalledmiColormap(pScreen) - && xf86Screens[pScreen->myNum]->vtSema) + && xf86ScreenToScrn(pScreen)->vtSema) CMapReinstallMap(GetInstalledmiColormap(pScreen)); return ret; @@ -528,7 +527,7 @@ CMapReinstallMap(ColormapPtr pmap) CMapScreenKey); CMapColormapPtr cmapPriv = (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey); - ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen); int i = cmapPriv->numColors; int *indices = pScreenPriv->PreAllocIndices; @@ -560,7 +559,7 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int *indices) CMapColormapPtr pColPriv = (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey); VisualPtr pVisual = pmap->pVisual; - ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen); int numColors, i; LOCO *gamma, *colors; EntryPtr entry; @@ -692,7 +691,7 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices) CMapScreenKey); CMapColormapPtr pColPriv = (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey); - ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen); VisualPtr pVisual = pmap->pVisual; int i; LOCO *colors; @@ -833,7 +832,7 @@ CMapUnwrapScreen(ScreenPtr pScreen) { CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->CreateColormap = pScreenPriv->CreateColormap; @@ -908,11 +907,10 @@ ComputeGamma(CMapScreenPtr priv) } int -CMapChangeGamma(int index, Gamma gamma) +CMapChangeGamma(ScrnInfoPtr pScrn, Gamma gamma) { int ret = Success; - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); CMapColormapPtr pColPriv; CMapScreenPtr pScreenPriv; CMapLinkPtr pLink; @@ -979,7 +977,7 @@ CMapChangeGamma(int index, Gamma gamma) pScrn->ChangeGamma = pScreenPriv->ChangeGamma; if (pScrn->ChangeGamma) - ret = pScrn->ChangeGamma(index, gamma); + ret = pScrn->ChangeGamma(pScrn, gamma); pScrn->ChangeGamma = CMapChangeGamma; return ret; @@ -1008,7 +1006,7 @@ xf86ChangeGammaRamp(ScreenPtr pScreen, unsigned short *red, unsigned short *green, unsigned short *blue) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); CMapColormapPtr pColPriv; CMapScreenPtr pScreenPriv; CMapLinkPtr pLink; @@ -1085,7 +1083,7 @@ xf86ChangeGammaRamp(ScreenPtr pScreen, int xf86GetGammaRampSize(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); CMapScreenPtr pScreenPriv; if (xf86_crtc_supports_gamma(pScrn)) { @@ -1112,7 +1110,7 @@ xf86GetGammaRamp(ScreenPtr pScreen, unsigned short *red, unsigned short *green, unsigned short *blue) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); CMapScreenPtr pScreenPriv; LOCO *entry; int shift, sigbits; @@ -1172,10 +1170,10 @@ xf86GetGammaRamp(ScreenPtr pScreen, int xf86ChangeGamma(ScreenPtr pScreen, Gamma gamma) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (pScrn->ChangeGamma) - return (*pScrn->ChangeGamma) (pScreen->myNum, gamma); + return (*pScrn->ChangeGamma) (pScrn, gamma); return BadImplementation; } diff --git a/xserver/hw/xfree86/common/xf86fbBus.c b/xserver/hw/xfree86/common/xf86fbBus.c index 1d50e5102..0f07352a8 100644 --- a/xserver/hw/xfree86/common/xf86fbBus.c +++ b/xserver/hw/xfree86/common/xf86fbBus.c @@ -54,6 +54,10 @@ xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active) EntityPtr p; int num; +#ifdef XSERVER_PLATFORM_BUS + if (platformSlotClaimed) + return -1; +#endif #ifdef XSERVER_LIBPCIACCESS if (pciSlotClaimed) return -1; diff --git a/xserver/hw/xfree86/common/xf86fbman.c b/xserver/hw/xfree86/common/xf86fbman.c index 3c29bf531..c2e7bab9f 100644 --- a/xserver/hw/xfree86/common/xf86fbman.c +++ b/xserver/hw/xfree86/common/xf86fbman.c @@ -1149,7 +1149,7 @@ static FBManagerFuncs xf86FBManFuncs = { }; static Bool -xf86FBCloseScreen(int i, ScreenPtr pScreen) +xf86FBCloseScreen(ScreenPtr pScreen) { FBLinkPtr pLink, tmp; FBLinearLinkPtr pLinearLink, tmp2; @@ -1180,13 +1180,13 @@ xf86FBCloseScreen(int i, ScreenPtr pScreen) free(offman); dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RegionRec ScreenRegion; RegionRec FullRegion; BoxRec ScreenBox; @@ -1223,7 +1223,7 @@ xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox) Bool xf86InitFBManagerArea(ScreenPtr pScreen, int PixelArea, int Verbosity) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xRectangle Rect[3]; RegionPtr pRegion, pScreenRegion; int nRect; diff --git a/xserver/hw/xfree86/common/xf86pciBus.c b/xserver/hw/xfree86/common/xf86pciBus.c index e52f1da84..a2c18ebf2 100644 --- a/xserver/hw/xfree86/common/xf86pciBus.c +++ b/xserver/hw/xfree86/common/xf86pciBus.c @@ -52,7 +52,7 @@ #define PCI_VENDOR_GENERIC 0x00FF /* Bus-specific globals */ -Bool pciSlotClaimed = FALSE; +int pciSlotClaimed = 0; #define PCIINFOCLASSES(c) \ ( (((c) & 0x00ff0000) == (PCI_CLASS_PREHISTORIC << 16)) \ @@ -110,7 +110,7 @@ xf86PciProbe(void) xf86PciVideoInfo[num - 1] = info; pci_device_probe(info); - if (pci_device_is_boot_vga(info)) { + if (primaryBus.type == BUS_NONE && pci_device_is_boot_vga(info)) { primaryBus.type = BUS_PCI; primaryBus.id.pci = info; } @@ -223,7 +223,7 @@ xf86ClaimPciSlot(struct pci_device *d, DriverPtr drvp, p->inUse = FALSE; if (dev) xf86AddDevToEntity(num, dev); - pciSlotClaimed = TRUE; + pciSlotClaimed++; return num; } @@ -235,7 +235,7 @@ xf86ClaimPciSlot(struct pci_device *d, DriverPtr drvp, * Unclaim PCI slot, e.g. if probing failed, so that a different driver can claim. */ void -xf86UnclaimPciSlot(struct pci_device *d) +xf86UnclaimPciSlot(struct pci_device *d, GDevPtr dev) { int i; @@ -244,6 +244,8 @@ xf86UnclaimPciSlot(struct pci_device *d) if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) { /* Probably the slot should be deallocated? */ + xf86RemoveDevFromEntity(i, dev); + pciSlotClaimed--; p->bus.type = BUS_NONE; return; } @@ -350,7 +352,15 @@ xf86ComparePciBusString(const char *busID, int bus, int device, int func) Bool xf86IsPrimaryPci(struct pci_device *pPci) { - return ((primaryBus.type == BUS_PCI) && (pPci == primaryBus.id.pci)); + if (primaryBus.type == BUS_PCI) + return pPci == primaryBus.id.pci; +#ifdef XSERVER_PLATFORM_BUS + if (primaryBus.type == BUS_PLATFORM) + if (primaryBus.id.plat->pdev) + if (MATCH_PCI_DEVICES(primaryBus.id.plat->pdev, pPci)) + return TRUE; +#endif + return FALSE; } /* @@ -365,7 +375,15 @@ xf86GetPciInfoForEntity(int entityIndex) return NULL; p = xf86Entities[entityIndex]; - return (p->bus.type == BUS_PCI) ? p->bus.id.pci : NULL; + switch (p->bus.type) { + case BUS_PCI: + return p->bus.id.pci; + case BUS_PLATFORM: + return p->bus.id.plat->pdev; + default: + break; + } + return NULL; } /* @@ -398,6 +416,13 @@ xf86CheckPciSlot(const struct pci_device *d) if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) { return FALSE; } +#ifdef XSERVER_PLATFORM_BUS + if ((p->bus.type == BUS_PLATFORM) && (p->bus.id.plat->pdev)) { + struct pci_device *ud = p->bus.id.plat->pdev; + if (MATCH_PCI_DEVICES(ud, d)) + return FALSE; + } +#endif } return TRUE; } @@ -537,7 +562,7 @@ xf86PciProbeDev(DriverPtr drvp) foundScreen = TRUE; } else - xf86UnclaimPciSlot(pPci); + xf86UnclaimPciSlot(pPci, devList[i]); } break; @@ -1063,8 +1088,8 @@ xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex, return TRUE; } -static int -videoPtrToDriverList(struct pci_device *dev, +int +xf86VideoPtrToDriverList(struct pci_device *dev, char *returnList[], int returnListMax) { int i; @@ -1247,8 +1272,8 @@ xchomp(char *line) * don't export their PCI ID's properly. If distros don't end up using this * feature it can and should be removed because the symbol-based resolution * scheme should be the primary one */ -static void -matchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_chip) +void +xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_chip) { DIR *idsdir; FILE *fp; @@ -1377,7 +1402,7 @@ xf86PciMatchDriver(char *matches[], int nmatches) pci_iterator_destroy(iter); #ifdef __linux__ if (info) - matchDriverFromFiles(matches, info->vendor_id, info->device_id); + xf86MatchDriverFromFiles(matches, info->vendor_id, info->device_id); #endif for (i = 0; (i < nmatches) && (matches[i]); i++) { @@ -1385,7 +1410,7 @@ xf86PciMatchDriver(char *matches[], int nmatches) } if ((info != NULL) && (i < nmatches)) { - i += videoPtrToDriverList(info, &(matches[i]), nmatches - i); + i += xf86VideoPtrToDriverList(info, &(matches[i]), nmatches - i); } return i; diff --git a/xserver/hw/xfree86/common/xf86pciBus.h b/xserver/hw/xfree86/common/xf86pciBus.h index 56ec6e9e7..4972c3688 100644 --- a/xserver/hw/xfree86/common/xf86pciBus.h +++ b/xserver/hw/xfree86/common/xf86pciBus.h @@ -42,4 +42,14 @@ Bool xf86PciConfigure(void *busData, struct pci_device *pDev); void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo, GDevRec * GDev, int *chipset); +#define MATCH_PCI_DEVICES(x, y) (((x)->domain == (y)->domain) && \ + ((x)->bus == (y)->bus) && \ + ((x)->func == (y)->func) && \ + ((x)->dev == (y)->dev)) + +void +xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_chip); +int +xf86VideoPtrToDriverList(struct pci_device *dev, + char *returnList[], int returnListMax); #endif /* _XF86_PCI_BUS_H */ diff --git a/xserver/hw/xfree86/common/xf86platformBus.c b/xserver/hw/xfree86/common/xf86platformBus.c new file mode 100644 index 000000000..0525e39bc --- /dev/null +++ b/xserver/hw/xfree86/common/xf86platformBus.c @@ -0,0 +1,496 @@ +/* + * Copyright © 2012 Red Hat. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE 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 contains the interfaces to the bus-specific code + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#ifdef XSERVER_PLATFORM_BUS +#include <errno.h> + +#include <pciaccess.h> +#include <fcntl.h> +#include <unistd.h> +#include "os.h" +#include "hotplug.h" + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Priv.h" +#include "xf86str.h" +#include "xf86Bus.h" +#include "Pci.h" +#include "xf86platformBus.h" + +int platformSlotClaimed; + +int xf86_num_platform_devices; + +static struct xf86_platform_device *xf86_platform_devices; + +int +xf86_add_platform_device(struct OdevAttributes *attribs) +{ + xf86_platform_devices = xnfrealloc(xf86_platform_devices, + (sizeof(struct xf86_platform_device) + * (xf86_num_platform_devices + 1))); + + xf86_platform_devices[xf86_num_platform_devices].attribs = attribs; + xf86_platform_devices[xf86_num_platform_devices].pdev = NULL; + + xf86_num_platform_devices++; + return 0; +} + +int +xf86_remove_platform_device(int dev_index) +{ + int j; + + config_odev_free_attribute_list(xf86_platform_devices[dev_index].attribs); + + for (j = dev_index; j < xf86_num_platform_devices - 1; j++) + memcpy(&xf86_platform_devices[j], &xf86_platform_devices[j + 1], sizeof(struct xf86_platform_device)); + xf86_num_platform_devices--; + return 0; +} + +Bool +xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_name) +{ + struct xf86_platform_device *device = &xf86_platform_devices[index]; + + return config_odev_add_attribute(device->attribs, attrib_id, attrib_name); +} + +char * +xf86_get_platform_attrib(int index, int attrib_id) +{ + struct xf86_platform_device *device = &xf86_platform_devices[index]; + struct OdevAttribute *oa; + + xorg_list_for_each_entry(oa, &device->attribs->list, member) { + if (oa->attrib_id == attrib_id) + return oa->attrib_name; + } + return NULL; +} + +char * +xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id) +{ + struct OdevAttribute *oa; + + xorg_list_for_each_entry(oa, &device->attribs->list, member) { + if (oa->attrib_id == attrib_id) + return oa->attrib_name; + } + return NULL; +} + + +/* + * xf86IsPrimaryPlatform() -- return TRUE if primary device + * is a platform device and it matches this one. + */ + +static Bool +xf86IsPrimaryPlatform(struct xf86_platform_device *plat) +{ + return ((primaryBus.type == BUS_PLATFORM) && (plat == primaryBus.id.plat)); +} + +static void +platform_find_pci_info(struct xf86_platform_device *pd, char *busid) +{ + struct pci_slot_match devmatch; + struct pci_device *info; + struct pci_device_iterator *iter; + int ret; + + ret = sscanf(busid, "pci:%04x:%02x:%02x.%u", + &devmatch.domain, &devmatch.bus, &devmatch.dev, + &devmatch.func); + if (ret != 4) + return; + + iter = pci_slot_match_iterator_create(&devmatch); + info = pci_device_next(iter); + if (info) { + pd->pdev = info; + pci_device_probe(info); + if (pci_device_is_boot_vga(info)) { + primaryBus.type = BUS_PLATFORM; + primaryBus.id.plat = pd; + } + } + pci_iterator_destroy(iter); + +} + +static Bool +xf86_check_platform_slot(const struct xf86_platform_device *pd) +{ + int i; + + for (i = 0; i < xf86NumEntities; i++) { + const EntityPtr u = xf86Entities[i]; + + if (pd->pdev && u->bus.type == BUS_PCI) + return !MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci); + if ((u->bus.type == BUS_PLATFORM) && (pd == u->bus.id.plat)) { + return FALSE; + } + } + return TRUE; +} + +/** + * @return The numbers of found devices that match with the current system + * drivers. + */ +int +xf86PlatformMatchDriver(char *matches[], int nmatches) +{ + int i, j = 0; + struct pci_device *info = NULL; + int pass = 0; + + for (pass = 0; pass < 2; pass++) { + for (i = 0; i < xf86_num_platform_devices; i++) { + + if (xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 1)) + continue; + else if (!xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 0)) + continue; + + info = xf86_platform_devices[i].pdev; +#ifdef __linux__ + if (info) + xf86MatchDriverFromFiles(matches, info->vendor_id, info->device_id); +#endif + + for (j = 0; (j < nmatches) && (matches[j]); j++) { + /* find end of matches list */ + } + + if ((info != NULL) && (j < nmatches)) { + j += xf86VideoPtrToDriverList(info, &(matches[j]), nmatches - j); + } + } + } + return j; +} + +int +xf86platformProbe(void) +{ + int i; + Bool pci = TRUE; + + config_odev_probe(xf86PlatformDeviceProbe); + + if (!xf86scanpci()) { + pci = FALSE; + } + + for (i = 0; i < xf86_num_platform_devices; i++) { + char *busid = xf86_get_platform_attrib(i, ODEV_ATTRIB_BUSID); + + if (pci && (strncmp(busid, "pci:", 4) == 0)) { + platform_find_pci_info(&xf86_platform_devices[i], busid); + } + } + return 0; +} + +static int +xf86ClaimPlatformSlot(struct xf86_platform_device * d, DriverPtr drvp, + int chipset, GDevPtr dev, Bool active) +{ + EntityPtr p = NULL; + int num; + + if (xf86_check_platform_slot(d)) { + num = xf86AllocateEntity(); + p = xf86Entities[num]; + p->driver = drvp; + p->chipset = chipset; + p->bus.type = BUS_PLATFORM; + p->bus.id.plat = d; + p->active = active; + p->inUse = FALSE; + if (dev) + xf86AddDevToEntity(num, dev); + + platformSlotClaimed++; + return num; + } + else + return -1; +} + +static int +xf86UnclaimPlatformSlot(struct xf86_platform_device *d, GDevPtr dev) +{ + int i; + + for (i = 0; i < xf86NumEntities; i++) { + const EntityPtr p = xf86Entities[i]; + + if ((p->bus.type == BUS_PLATFORM) && (p->bus.id.plat == d)) { + if (dev) + xf86RemoveDevFromEntity(i, dev); + platformSlotClaimed--; + p->bus.type = BUS_NONE; + return 0; + } + } + return 0; +} + + +#define END_OF_MATCHES(m) \ + (((m).vendor_id == 0) && ((m).device_id == 0) && ((m).subvendor_id == 0)) + +static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp, + GDevPtr gdev, int flags, intptr_t match_data) +{ + Bool foundScreen = FALSE; + int entity; + + if (gdev->screen == 0 && !xf86_check_platform_slot(dev)) + return FALSE; + + entity = xf86ClaimPlatformSlot(dev, drvp, 0, + gdev, gdev->active); + + if ((entity == -1) && (gdev->screen > 0)) { + unsigned nent; + + for (nent = 0; nent < xf86NumEntities; nent++) { + EntityPtr pEnt = xf86Entities[nent]; + + if (pEnt->bus.type != BUS_PLATFORM) + continue; + if (pEnt->bus.id.plat == dev) { + entity = nent; + xf86AddDevToEntity(nent, gdev); + break; + } + } + } + if (entity != -1) { + if (drvp->platformProbe(drvp, entity, flags, dev, match_data)) + foundScreen = TRUE; + else + xf86UnclaimPlatformSlot(dev, gdev); + } + return foundScreen; +} + +static Bool +probeSingleDevice(struct xf86_platform_device *dev, DriverPtr drvp, GDevPtr gdev, int flags) +{ + int k; + Bool foundScreen = FALSE; + struct pci_device *pPci; + const struct pci_id_match *const devices = drvp->supported_devices; + + if (dev->pdev && devices) { + int device_id = dev->pdev->device_id; + pPci = dev->pdev; + for (k = 0; !END_OF_MATCHES(devices[k]); k++) { + if (PCI_ID_COMPARE(devices[k].vendor_id, pPci->vendor_id) + && PCI_ID_COMPARE(devices[k].device_id, device_id) + && ((devices[k].device_class_mask & pPci->device_class) + == devices[k].device_class)) { + foundScreen = doPlatformProbe(dev, drvp, gdev, flags, devices[k].match_data); + if (foundScreen) + break; + } + } + } + else if (dev->pdev && !devices) + return FALSE; + else + foundScreen = doPlatformProbe(dev, drvp, gdev, flags, 0); + return foundScreen; +} + +int +xf86platformProbeDev(DriverPtr drvp) +{ + Bool foundScreen = FALSE; + GDevPtr *devList; + const unsigned numDevs = xf86MatchDevice(drvp->driverName, &devList); + int i, j; + + /* find the main device or any device specificed in xorg.conf */ + for (i = 0; i < numDevs; i++) { + for (j = 0; j < xf86_num_platform_devices; j++) { + if (devList[i]->busID && *devList[i]->busID) { + if (xf86PlatformDeviceCheckBusID(&xf86_platform_devices[j], devList[i]->busID)) + break; + } + else { + /* for non-seat0 servers assume first device is the master */ + if (ServerIsNotSeat0()) + break; + if (xf86_platform_devices[j].pdev) { + if (xf86IsPrimaryPlatform(&xf86_platform_devices[j])) + break; + } + } + } + + if (j == xf86_num_platform_devices) + continue; + + foundScreen = probeSingleDevice(&xf86_platform_devices[j], drvp, devList[i], 0); + if (!foundScreen) + continue; + } + + /* if autoaddgpu devices is enabled then go find a few more and add them as GPU screens */ + if (xf86Info.autoAddGPU && numDevs) { + for (j = 0; j < xf86_num_platform_devices; j++) { + probeSingleDevice(&xf86_platform_devices[j], drvp, devList[0], PLATFORM_PROBE_GPU_SCREEN); + } + } + + return foundScreen; +} + +int +xf86platformAddDevice(int index) +{ + int i, old_screens, scr_index; + DriverPtr drvp = NULL; + int entity; + screenLayoutPtr layout; + static char *hotplug_driver_name = "modesetting"; + + /* force load the driver for now */ + xf86LoadOneModule(hotplug_driver_name, NULL); + + for (i = 0; i < xf86NumDrivers; i++) { + if (!xf86DriverList[i]) + continue; + + if (!strcmp(xf86DriverList[i]->driverName, hotplug_driver_name)) { + drvp = xf86DriverList[i]; + break; + } + } + if (i == xf86NumDrivers) + return -1; + + old_screens = xf86NumGPUScreens; + entity = xf86ClaimPlatformSlot(&xf86_platform_devices[index], + drvp, 0, 0, 0); + if (!drvp->platformProbe(drvp, entity, PLATFORM_PROBE_GPU_SCREEN, &xf86_platform_devices[index], 0)) { + xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL); + } + if (old_screens == xf86NumGPUScreens) + return -1; + i = old_screens; + + for (layout = xf86ConfigLayout.screens; layout->screen != NULL; + layout++) { + xf86GPUScreens[i]->confScreen = layout->screen; + break; + } + + if (xf86GPUScreens[i]->PreInit && + xf86GPUScreens[i]->PreInit(xf86GPUScreens[i], 0)) + xf86GPUScreens[i]->configured = TRUE; + + if (!xf86GPUScreens[i]->configured) { + ErrorF("hotplugged device %d didn't configure\n", i); + xf86DeleteScreen(xf86GPUScreens[i]); + return -1; + } + + scr_index = AddGPUScreen(xf86GPUScreens[i]->ScreenInit, 0, NULL); + + dixSetPrivate(&xf86GPUScreens[i]->pScreen->devPrivates, + xf86ScreenKey, xf86GPUScreens[i]); + + CreateScratchPixmapsForScreen(xf86GPUScreens[i]->pScreen); + + /* attach unbound to 0 protocol screen */ + AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); + + return 0; +} + +void +xf86platformRemoveDevice(int index) +{ + EntityPtr entity; + int ent_num, i, j; + Bool found; + + for (ent_num = 0; ent_num < xf86NumEntities; ent_num++) { + entity = xf86Entities[ent_num]; + if (entity->bus.type == BUS_PLATFORM && + entity->bus.id.plat == &xf86_platform_devices[index]) + break; + } + if (ent_num == xf86NumEntities) + goto out; + + found = FALSE; + for (i = 0; i < xf86NumGPUScreens; i++) { + for (j = 0; j < xf86GPUScreens[i]->numEntities; j++) + if (xf86GPUScreens[i]->entityList[j] == ent_num) { + found = TRUE; + break; + } + if (found) + break; + } + if (!found) { + ErrorF("failed to find screen to remove\n"); + goto out; + } + + xf86GPUScreens[i]->pScreen->CloseScreen(xf86GPUScreens[i]->pScreen); + + RemoveGPUScreen(xf86GPUScreens[i]->pScreen); + xf86DeleteScreen(xf86GPUScreens[i]); + + xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL); + + xf86_remove_platform_device(index); + + out: + return; +} +#endif diff --git a/xserver/hw/xfree86/common/xf86platformBus.h b/xserver/hw/xfree86/common/xf86platformBus.h new file mode 100644 index 000000000..49afc247b --- /dev/null +++ b/xserver/hw/xfree86/common/xf86platformBus.h @@ -0,0 +1,64 @@ +/* + * Copyright © 2012 Red Hat. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE 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> + */ +#ifndef XF86_PLATFORM_BUS_H +#define XF86_PLATFORM_BUS_H + +#include "hotplug.h" + +struct xf86_platform_device { + struct OdevAttributes *attribs; + /* for PCI devices */ + struct pci_device *pdev; +}; + +#ifdef XSERVER_PLATFORM_BUS +int xf86platformProbe(void); +int xf86platformProbeDev(DriverPtr drvp); + +extern int xf86_num_platform_devices; + +extern char * +xf86_get_platform_attrib(int index, int attrib_id); +extern int +xf86_add_platform_device(struct OdevAttributes *attribs); +extern int +xf86_remove_platform_device(int dev_index); +extern Bool +xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_str); + +extern int +xf86platformAddDevice(int index); +extern void +xf86platformRemoveDevice(int index); + +extern _X_EXPORT char * +xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id); +extern _X_EXPORT Bool +xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid); + +extern _X_EXPORT int +xf86PlatformMatchDriver(char *matches[], int nmatches); +#endif + +#endif diff --git a/xserver/hw/xfree86/common/xf86sbusBus.c b/xserver/hw/xfree86/common/xf86sbusBus.c index 27d24f8e1..b6a6b94b3 100644 --- a/xserver/hw/xfree86/common/xf86sbusBus.c +++ b/xserver/hw/xfree86/common/xf86sbusBus.c @@ -667,7 +667,7 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, } static Bool -xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen) +xf86SbusCmapCloseScreen(ScreenPtr pScreen) { sbusCmapPtr cmap; struct fbcmap fbcmap; @@ -683,7 +683,7 @@ xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen) } pScreen->CloseScreen = cmap->CloseScreen; free(cmap); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } Bool diff --git a/xserver/hw/xfree86/common/xf86str.h b/xserver/hw/xfree86/common/xf86str.h index 6294845bc..059026243 100644 --- a/xserver/hw/xfree86/common/xf86str.h +++ b/xserver/hw/xfree86/common/xf86str.h @@ -311,6 +311,7 @@ struct _SymTabRec; struct _PciChipsets; struct pci_device; +struct xf86_platform_device; typedef struct _DriverRec { int driverVersion; @@ -325,9 +326,16 @@ typedef struct _DriverRec { const struct pci_id_match *supported_devices; Bool (*PciProbe) (struct _DriverRec * drv, int entity_num, struct pci_device * dev, intptr_t match_data); + Bool (*platformProbe) (struct _DriverRec * drv, int entity_num, int flags, + struct xf86_platform_device * dev, intptr_t match_data); } DriverRec, *DriverPtr; /* + * platform probe flags + */ +#define PLATFORM_PROBE_GPU_SCREEN 1 + +/* * AddDriver flags */ #define HaveDriverFuncs 1 @@ -343,6 +351,7 @@ typedef struct _DriverRec { #undef BUS_NONE #undef BUS_PCI #undef BUS_SBUS +#undef BUS_PLATFORM #undef BUS_last #endif @@ -350,6 +359,7 @@ typedef enum { BUS_NONE, BUS_PCI, BUS_SBUS, + BUS_PLATFORM, BUS_last /* Keep last */ } BusType; @@ -362,6 +372,7 @@ typedef struct _bus { union { struct pci_device *pci; SbusBusId sbus; + struct xf86_platform_device *plat; } id; } BusRec, *BusPtr; @@ -630,18 +641,18 @@ typedef struct { typedef Bool xf86ProbeProc(DriverPtr, int); typedef Bool xf86PreInitProc(ScrnInfoPtr, int); -typedef Bool xf86ScreenInitProc(int, ScreenPtr, int, char **); -typedef Bool xf86SwitchModeProc(int, DisplayModePtr, int); -typedef void xf86AdjustFrameProc(int, int, int, int); -typedef Bool xf86EnterVTProc(int, int); -typedef void xf86LeaveVTProc(int, int); -typedef void xf86FreeScreenProc(int, int); -typedef ModeStatus xf86ValidModeProc(int, DisplayModePtr, Bool, int); -typedef void xf86EnableDisableFBAccessProc(int, Bool); -typedef int xf86SetDGAModeProc(int, int, DGADevicePtr); -typedef int xf86ChangeGammaProc(int, Gamma); -typedef void xf86PointerMovedProc(int, int, int); -typedef Bool xf86PMEventProc(int, pmEvent, Bool); +typedef Bool xf86ScreenInitProc(ScreenPtr, int, char **); +typedef Bool xf86SwitchModeProc(ScrnInfoPtr, DisplayModePtr); +typedef void xf86AdjustFrameProc(ScrnInfoPtr, int, int); +typedef Bool xf86EnterVTProc(ScrnInfoPtr); +typedef void xf86LeaveVTProc(ScrnInfoPtr); +typedef void xf86FreeScreenProc(ScrnInfoPtr); +typedef ModeStatus xf86ValidModeProc(ScrnInfoPtr, DisplayModePtr, Bool, int); +typedef void xf86EnableDisableFBAccessProc(ScrnInfoPtr, Bool); +typedef int xf86SetDGAModeProc(ScrnInfoPtr, int, DGADevicePtr); +typedef int xf86ChangeGammaProc(ScrnInfoPtr, Gamma); +typedef void xf86PointerMovedProc(ScrnInfoPtr, int, int); +typedef Bool xf86PMEventProc(ScrnInfoPtr, pmEvent, Bool); typedef void xf86DPMSSetProc(ScrnInfoPtr, int, int); typedef void xf86LoadPaletteProc(ScrnInfoPtr, int, int *, LOCO *, VisualPtr); typedef void xf86SetOverscanProc(ScrnInfoPtr, int); @@ -802,6 +813,8 @@ typedef struct _ScrnInfoRec { */ funcPointer reservedFuncs[NUM_RESERVED_FUNCS]; + Bool is_gpu; + uint32_t capabilities; } ScrnInfoRec; typedef struct { diff --git a/xserver/hw/xfree86/dixmods/extmod/xf86vmode.c b/xserver/hw/xfree86/common/xf86vmode.c index 68c4b583f..7cd2eedb3 100644 --- a/xserver/hw/xfree86/dixmods/extmod/xf86vmode.c +++ b/xserver/hw/xfree86/common/xf86vmode.c @@ -39,6 +39,7 @@ from Kaleb S. KEITHLEY #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" +#include "xf86Extensions.h" #include "scrnintstr.h" #include "servermd.h" #include <X11/extensions/xf86vmproto.h> @@ -240,7 +241,6 @@ static void SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced) { XF86VidModeScreenPrivatePtr pPriv; - XF86VidModeEventPtr pEv; unsigned long mask; xXF86VidModeNotifyEvent ev; int kind; @@ -253,17 +253,21 @@ SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced) return; kind = XF86VidModeModeChange; for (pEv = pPriv->events; pEv; pEv = pEv->next) { - if (!(pEv->mask & mask)) - continue; - ev.type = XF86VidModeNotify + XF86VidModeEventBase; - ev.state = state; - ev.timestamp = currentTime.milliseconds; - ev.root = pScreen->root->drawable.id; - ev.kind = kind; - ev.forced = forced; - WriteEventsToClient(pEv->client, 1, (xEvent *) &ev); -}} static void + if (pEv->mask & mask) { + XF86VidModeEventPtr pEv = { + .type = XF86VidModeNotify + XF86VidModeEventBase, + .state = state, + .timestamp = currentTime.milliseconds, + .root = pScreen->root->drawable.id, + .kind = kind, + .forced = forced + }; + WriteEventsToClient(pEv->client, 1, (xEvent *) &ev); + } + } +} +static void SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * from, xXF86VidModeNotifyEvent * to) { @@ -280,23 +284,25 @@ SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * from, static int ProcXF86VidModeQueryVersion(ClientPtr client) { - xXF86VidModeQueryVersionReply rep; + xXF86VidModeQueryVersionReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION, + .minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION + }; DEBUG_P("XF86VidModeQueryVersion"); REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION; - rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } - WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), &rep); return Success; } @@ -304,8 +310,10 @@ static int ProcXF86VidModeGetModeLine(ClientPtr client) { REQUEST(xXF86VidModeGetModeLineReq); - xXF86VidModeGetModeLineReply rep; - xXF86OldVidModeGetModeLineReply oldrep; + xXF86VidModeGetModeLineReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence + }; pointer mode; int dotClock; int ver; @@ -314,7 +322,7 @@ ProcXF86VidModeGetModeLine(ClientPtr client) ver = ClientMajorVersion(client); REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq); - rep.type = X_Reply; + if (ver < 2) { rep.length = bytes_to_int32(SIZEOF(xXF86OldVidModeGetModeLineReply) - SIZEOF(xGenericReply)); @@ -323,7 +331,6 @@ ProcXF86VidModeGetModeLine(ClientPtr client) rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xGenericReply)); } - rep.sequenceNumber = client->sequence; if (stuff->screen >= screenInfo.numScreens) return BadValue; @@ -377,26 +384,26 @@ ProcXF86VidModeGetModeLine(ClientPtr client) swapl(&rep.privsize); } if (ver < 2) { - oldrep.type = rep.type; - oldrep.sequenceNumber = rep.sequenceNumber; - oldrep.length = rep.length; - oldrep.dotclock = rep.dotclock; - oldrep.hdisplay = rep.hdisplay; - oldrep.hsyncstart = rep.hsyncstart; - oldrep.hsyncend = rep.hsyncend; - oldrep.htotal = rep.htotal; - oldrep.vdisplay = rep.vdisplay; - oldrep.vsyncstart = rep.vsyncstart; - oldrep.vsyncend = rep.vsyncend; - oldrep.vtotal = rep.vtotal; - oldrep.flags = rep.flags; - oldrep.privsize = rep.privsize; - WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply), - (char *) &oldrep); + xXF86OldVidModeGetModeLineReply oldrep = { + .type = rep.type, + .sequenceNumber = rep.sequenceNumber, + .length = rep.length, + .dotclock = rep.dotclock, + .hdisplay = rep.hdisplay, + .hsyncstart = rep.hsyncstart, + .hsyncend = rep.hsyncend, + .htotal = rep.htotal, + .vdisplay = rep.vdisplay, + .vsyncstart = rep.vsyncstart, + .vsyncend = rep.vsyncend, + .vtotal = rep.vtotal, + .flags = rep.flags, + .privsize = rep.privsize + }; + WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply), &oldrep); } else { - WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply), - (char *) &rep); + WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply), &rep); } return Success; } @@ -406,8 +413,6 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client) { REQUEST(xXF86VidModeGetAllModeLinesReq); xXF86VidModeGetAllModeLinesReply rep; - xXF86VidModeModeInfo mdinf; - xXF86OldVidModeModeInfo oldmdinf; pointer mode; int modecount, dotClock; int ver; @@ -428,37 +433,40 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client) if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) return BadValue; - rep.type = X_Reply; - rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) - - SIZEOF(xGenericReply); + rep = (xXF86VidModeGetAllModeLinesReply) { + .type = X_Reply, + .length = SIZEOF(xXF86VidModeGetAllModeLinesReply) - + SIZEOF(xGenericReply), + .sequenceNumber = client->sequence, + .modecount = modecount + }; if (ver < 2) rep.length += modecount * sizeof(xXF86OldVidModeModeInfo); else rep.length += modecount * sizeof(xXF86VidModeModeInfo); rep.length >>= 2; - rep.sequenceNumber = client->sequence; - rep.modecount = modecount; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.modecount); } - WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), - (char *) &rep); + WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), &rep); do { - mdinf.dotclock = dotClock; - mdinf.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY); - mdinf.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART); - mdinf.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND); - mdinf.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL); - mdinf.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW); - mdinf.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY); - mdinf.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART); - mdinf.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND); - mdinf.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL); - mdinf.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS); - mdinf.privsize = 0; + xXF86VidModeModeInfo mdinf = { + .dotclock = dotClock, + .hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY), + .hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART), + .hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND), + .htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL), + .hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW), + .vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY), + .vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART), + .vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND), + .vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL), + .flags = VidModeGetModeValue(mode, VIDMODE_FLAGS), + .privsize = 0 + }; if (client->swapped) { swapl(&mdinf.dotclock); swaps(&mdinf.hdisplay); @@ -474,23 +482,23 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client) swapl(&mdinf.privsize); } if (ver < 2) { - oldmdinf.dotclock = mdinf.dotclock; - oldmdinf.hdisplay = mdinf.hdisplay; - oldmdinf.hsyncstart = mdinf.hsyncstart; - oldmdinf.hsyncend = mdinf.hsyncend; - oldmdinf.htotal = mdinf.htotal; - oldmdinf.vdisplay = mdinf.vdisplay; - oldmdinf.vsyncstart = mdinf.vsyncstart; - oldmdinf.vsyncend = mdinf.vsyncend; - oldmdinf.vtotal = mdinf.vtotal; - oldmdinf.flags = mdinf.flags; - oldmdinf.privsize = mdinf.privsize; - WriteToClient(client, sizeof(xXF86OldVidModeModeInfo), - (char *) &oldmdinf); + xXF86OldVidModeModeInfo oldmdinf = { + .dotclock = mdinf.dotclock, + .hdisplay = mdinf.hdisplay, + .hsyncstart = mdinf.hsyncstart, + .hsyncend = mdinf.hsyncend, + .htotal = mdinf.htotal, + .vdisplay = mdinf.vdisplay, + .vsyncstart = mdinf.vsyncstart, + .vsyncend = mdinf.vsyncend, + .vtotal = mdinf.vtotal, + .flags = mdinf.flags, + .privsize = mdinf.privsize + }; + WriteToClient(client, sizeof(xXF86OldVidModeModeInfo), &oldmdinf); } else { - WriteToClient(client, sizeof(xXF86VidModeModeInfo), - (char *) &mdinf); + WriteToClient(client, sizeof(xXF86VidModeModeInfo), &mdinf); } } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock)); @@ -1030,18 +1038,19 @@ ProcXF86VidModeValidateModeLine(ClientPtr client) status_reply: free(modetmp); - rep.type = X_Reply; - rep.length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply) - - SIZEOF(xGenericReply)); - rep.sequenceNumber = client->sequence; - rep.status = status; + rep = (xXF86VidModeValidateModeLineReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply) + - SIZEOF(xGenericReply)), + .status = status + }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.status); } - WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), - (char *) &rep); + WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), &rep); if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status); return Success; @@ -1190,7 +1199,10 @@ static int ProcXF86VidModeGetMonitor(ClientPtr client) { REQUEST(xXF86VidModeGetMonitorReq); - xXF86VidModeGetMonitorReply rep; + xXF86VidModeGetMonitorReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence + }; CARD32 *hsyncdata, *vsyncdata; int i, nHsync, nVrefresh; pointer monitor; @@ -1208,7 +1220,6 @@ ProcXF86VidModeGetMonitor(ClientPtr client) nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i; nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i; - rep.type = X_Reply; if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr) rep.vendorLength = strlen((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, @@ -1227,7 +1238,6 @@ ProcXF86VidModeGetMonitor(ClientPtr client) nVrefresh) * sizeof(CARD32) + pad_to_int32(rep.vendorLength) + pad_to_int32(rep.modelLength)); - rep.sequenceNumber = client->sequence; rep.nhsync = nHsync; rep.nvsync = nVrefresh; hsyncdata = malloc(nHsync * sizeof(CARD32)); @@ -1262,20 +1272,16 @@ ProcXF86VidModeGetMonitor(ClientPtr client) swaps(&rep.sequenceNumber); swapl(&rep.length); } - WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *) &rep); + WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), &rep); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, nHsync * sizeof(CARD32), hsyncdata); WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32), vsyncdata); if (rep.vendorLength) WriteToClient(client, rep.vendorLength, - (char - *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, - 0)).ptr); + (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr); if (rep.modelLength) WriteToClient(client, rep.modelLength, - (char - *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, - 0)).ptr); + (VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr); free(hsyncdata); free(vsyncdata); @@ -1297,13 +1303,15 @@ ProcXF86VidModeGetViewPort(ClientPtr client) if (stuff->screen >= screenInfo.numScreens) return BadValue; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - VidModeGetViewPort(stuff->screen, &x, &y); - rep.x = x; - rep.y = y; + + rep = (xXF86VidModeGetViewPortReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .x = x, + .y = y + }; if (client->swapped) { swaps(&rep.sequenceNumber); @@ -1311,7 +1319,7 @@ ProcXF86VidModeGetViewPort(ClientPtr client) swapl(&rep.x); swapl(&rep.y); } - WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *) &rep); + WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), &rep); return Success; } @@ -1353,16 +1361,18 @@ ProcXF86VidModeGetDotClocks(ClientPtr client) numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg); - rep.type = X_Reply; - rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply) - - SIZEOF(xGenericReply) + numClocks); - rep.sequenceNumber = client->sequence; - rep.clocks = numClocks; - rep.maxclocks = MAXCLOCKS; - rep.flags = 0; + rep = (xXF86VidModeGetDotClocksReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply) + - SIZEOF(xGenericReply) + numClocks), + .clocks = numClocks, + .maxclocks = MAXCLOCKS, + .flags = 0 + }; if (!ClockProg) { - Clocks = malloc(numClocks * sizeof(int)); + Clocks = calloc(numClocks, sizeof(int)); if (!Clocks) return BadValue; if (!VidModeGetClocks(stuff->screen, Clocks)) { @@ -1380,7 +1390,7 @@ ProcXF86VidModeGetDotClocks(ClientPtr client) swapl(&rep.maxclocks); swapl(&rep.flags); } - WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), &rep); if (!ClockProg) { for (n = 0; n < numClocks; n++) { dotclock = *Clocks++; @@ -1388,7 +1398,7 @@ ProcXF86VidModeGetDotClocks(ClientPtr client) WriteSwappedDataToClient(client, 4, (char *) &dotclock); } else { - WriteToClient(client, 4, (char *) &dotclock); + WriteToClient(client, 4, &dotclock); } } } @@ -1431,14 +1441,16 @@ ProcXF86VidModeGetGamma(ClientPtr client) if (stuff->screen >= screenInfo.numScreens) return BadValue; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; if (!VidModeGetGamma(stuff->screen, &red, &green, &blue)) return BadValue; - rep.red = (CARD32) (red * 10000.); - rep.green = (CARD32) (green * 10000.); - rep.blue = (CARD32) (blue * 10000.); + rep = (xXF86VidModeGetGammaReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .red = (CARD32) (red * 10000.), + .green = (CARD32) (green * 10000.), + .blue = (CARD32) (blue * 10000.) + }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -1446,7 +1458,7 @@ ProcXF86VidModeGetGamma(ClientPtr client) swapl(&rep.green); swapl(&rep.blue); } - WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), &rep); return Success; } @@ -1489,14 +1501,14 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client) REQUEST(xXF86VidModeGetGammaRampReq); + REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq); + if (stuff->screen >= screenInfo.numScreens) return BadValue; if (stuff->size != VidModeGetGammaRampSize(stuff->screen)) return BadValue; - REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq); - length = (stuff->size + 1) & ~1; if (stuff->size) { @@ -1510,20 +1522,22 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client) return BadValue; } } - rep.type = X_Reply; - rep.length = (length >> 1) * 3; - rep.sequenceNumber = client->sequence; - rep.size = stuff->size; + rep = (xXF86VidModeGetGammaRampReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = (length >> 1) * 3, + .size = stuff->size + }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.size); SwapShorts((short *) ramp, length * 3); } - WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), &rep); if (stuff->size) { - WriteToClient(client, ramplen, (char *) ramp); + WriteToClient(client, ramplen, ramp); free(ramp); } @@ -1537,22 +1551,23 @@ ProcXF86VidModeGetGammaRampSize(ClientPtr client) REQUEST(xXF86VidModeGetGammaRampSizeReq); + REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq); + if (stuff->screen >= screenInfo.numScreens) return BadValue; - REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq); - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.size = VidModeGetGammaRampSize(stuff->screen); + rep = (xXF86VidModeGetGammaRampSizeReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .size = VidModeGetGammaRampSize(stuff->screen) + }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.size); } - WriteToClient(client, sizeof(xXF86VidModeGetGammaRampSizeReply), - (char *) &rep); + WriteToClient(client, sizeof(xXF86VidModeGetGammaRampSizeReply), &rep); return Success; } @@ -1560,19 +1575,20 @@ ProcXF86VidModeGetGammaRampSize(ClientPtr client) static int ProcXF86VidModeGetPermissions(ClientPtr client) { - xXF86VidModeGetPermissionsReply rep; + xXF86VidModeGetPermissionsReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .permissions = XF86VM_READ_PERMISSION + }; REQUEST(xXF86VidModeGetPermissionsReq); + REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq); + if (stuff->screen >= screenInfo.numScreens) return BadValue; - REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq); - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.permissions = XF86VM_READ_PERMISSION; if (xf86GetVidModeEnabled() && (xf86GetVidModeAllowNonLocal() || LocalClient(client))) { rep.permissions |= XF86VM_WRITE_PERMISSION; @@ -1582,8 +1598,7 @@ ProcXF86VidModeGetPermissions(ClientPtr client) swapl(&rep.length); swapl(&rep.permissions); } - WriteToClient(client, sizeof(xXF86VidModeGetPermissionsReply), - (char *) &rep); + WriteToClient(client, sizeof(xXF86VidModeGetPermissionsReply), &rep); return Success; } diff --git a/xserver/hw/xfree86/common/xf86xv.c b/xserver/hw/xfree86/common/xf86xv.c index 88e2f314b..92d0f6da2 100644 --- a/xserver/hw/xfree86/common/xf86xv.c +++ b/xserver/hw/xfree86/common/xf86xv.c @@ -51,13 +51,12 @@ #include <X11/extensions/Xv.h> #include <X11/extensions/Xvproto.h> #include "xvdix.h" -#include "xvmodproc.h" #include "xf86xvpriv.h" /* XvScreenRec fields */ -static Bool xf86XVCloseScreen(int, ScreenPtr); +static Bool xf86XVCloseScreen(ScreenPtr); static int xf86XVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *); /* XvAdaptorRec fields */ @@ -101,9 +100,9 @@ static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy); /* ScrnInfoRec functions */ -static Bool xf86XVEnterVT(int, int); -static void xf86XVLeaveVT(int, int); -static void xf86XVAdjustFrame(int index, int x, int y, int flags); +static Bool xf86XVEnterVT(ScrnInfoPtr); +static void xf86XVLeaveVT(ScrnInfoPtr); +static void xf86XVAdjustFrame(ScrnInfoPtr, int x, int y); static void xf86XVModeSet(ScrnInfoPtr pScrn); /* misc */ @@ -118,10 +117,6 @@ DevPrivateKey XF86XvScreenKey; static unsigned long PortResource = 0; -DevPrivateKey (*XvGetScreenKeyProc) (void) = NULL; -unsigned long (*XvGetRTPortProc) (void) = NULL; -int (*XvScreenInitProc) (ScreenPtr) = NULL; - #define GET_XV_SCREEN(pScreen) \ ((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey)) @@ -239,19 +234,18 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num) XF86XVScreenPtr ScreenPriv; XvScreenPtr pxvs; - if (num <= 0 || - !XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc) + if (num <= 0 || noXvExtension) return FALSE; - if (Success != (*XvScreenInitProc) (pScreen)) + if (Success != XvScreenInit(pScreen)) return FALSE; if (!dixRegisterPrivateKey(&XF86XVWindowKeyRec, PRIVATE_WINDOW, 0)) return FALSE; - XF86XvScreenKey = (*XvGetScreenKeyProc) (); + XF86XvScreenKey = XvGetScreenKey(); - PortResource = (*XvGetRTPortProc) (); + PortResource = XvGetRTPort(); pxvs = GET_XV_SCREEN(pScreen); @@ -272,7 +266,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num) if (!ScreenPriv) return FALSE; - pScrn = xf86Screens[pScreen->myNum]; + pScrn = xf86ScreenToScrn(pScreen); ScreenPriv->DestroyWindow = pScreen->DestroyWindow; ScreenPriv->WindowExposures = pScreen->WindowExposures; @@ -357,7 +351,7 @@ static Bool xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number) { XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XF86VideoAdaptorPtr adaptorPtr; XvAdaptorPtr pAdaptor, pa; XvAdaptorRecPrivatePtr adaptorPriv; @@ -1067,7 +1061,7 @@ xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv, WindowPtr pWin, Bool visible) static void xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged) { - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); XvAdaptorPtr pa; int c, i; @@ -1151,7 +1145,7 @@ xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind) pScreen = pLayerWin->drawable.pScreen; ScreenPriv = GET_XF86XV_SCREEN(pScreen); - pScrn = xf86Screens[pScreen->myNum]; + pScrn = xf86ScreenToScrn(pScreen); xf86XVReputOrStopAllPorts(pScrn, TRUE); @@ -1256,9 +1250,9 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy) /**** Required XvScreenRec fields ****/ static Bool -xf86XVCloseScreen(int i, ScreenPtr pScreen) +xf86XVCloseScreen(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); XvAdaptorPtr pa; @@ -1300,15 +1294,14 @@ xf86XVQueryAdaptors(ScreenPtr pScreen, /**** ScrnInfoRec fields ****/ static Bool -xf86XVEnterVT(int index, int flags) +xf86XVEnterVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); Bool ret; pScrn->EnterVT = ScreenPriv->EnterVT; - ret = (*ScreenPriv->EnterVT) (index, flags); + ret = (*ScreenPriv->EnterVT) (pScrn); ScreenPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = xf86XVEnterVT; @@ -1319,10 +1312,9 @@ xf86XVEnterVT(int index, int flags) } static void -xf86XVLeaveVT(int index, int flags) +xf86XVLeaveVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); XvAdaptorPtr pAdaptor; @@ -1354,21 +1346,20 @@ xf86XVLeaveVT(int index, int flags) } pScrn->LeaveVT = ScreenPriv->LeaveVT; - (*ScreenPriv->LeaveVT) (index, flags); + (*ScreenPriv->LeaveVT) (pScrn); ScreenPriv->LeaveVT = pScrn->LeaveVT; pScrn->LeaveVT = xf86XVLeaveVT; } static void -xf86XVAdjustFrame(int index, int x, int y, int flags) +xf86XVAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); if (ScreenPriv->AdjustFrame) { pScrn->AdjustFrame = ScreenPriv->AdjustFrame; - (*pScrn->AdjustFrame) (index, x, y, flags); + (*pScrn->AdjustFrame) (pScrn, x, y); pScrn->AdjustFrame = xf86XVAdjustFrame; } @@ -1378,7 +1369,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags) static void xf86XVModeSet(ScrnInfoPtr pScrn) { - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XF86XVScreenPtr ScreenPriv; /* Can be called before pScrn->pScreen is set */ @@ -1900,7 +1891,7 @@ xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes) xRectangle *rects; GCPtr gc; - if (!xf86Screens[pScreen->myNum]->vtSema) + if (!xf86ScreenToScrn(pScreen)->vtSema) return; gc = GetScratchGC(pDraw->depth, pScreen); diff --git a/xserver/hw/xfree86/common/xf86xv.h b/xserver/hw/xfree86/common/xf86xv.h index 2db00a83f..091efcaa9 100644 --- a/xserver/hw/xfree86/common/xf86xv.h +++ b/xserver/hw/xfree86/common/xf86xv.h @@ -263,8 +263,4 @@ extern _X_EXPORT void xf86XVCopyPacked(const void *src, void *dst, int srcPitch, int dstPitch, int h, int w); -extern _X_EXPORT DevPrivateKey (*XvGetScreenKeyProc) (void); -extern _X_EXPORT unsigned long (*XvGetRTPortProc) (void); -extern _X_EXPORT int (*XvScreenInitProc) (ScreenPtr); - #endif /* _XF86XV_H_ */ diff --git a/xserver/hw/xfree86/common/xf86xvmc.c b/xserver/hw/xfree86/common/xf86xvmc.c index e58465289..78a32bfe1 100644 --- a/xserver/hw/xfree86/common/xf86xvmc.c +++ b/xserver/hw/xfree86/common/xf86xvmc.c @@ -40,13 +40,9 @@ #include "resource.h" #include "dixstruct.h" -#include "xvmodproc.h" - #include "xf86xvpriv.h" #include "xf86xvmc.h" -XvMCScreenInitProcPtr XvMCScreenInitProc = NULL; - typedef struct { CloseScreenProcPtr CloseScreen; int num_adaptors; @@ -66,7 +62,7 @@ xf86XvMCCreateContext(XvPortPtr pPort, XvMCContextPtr pContext, int *num_priv, CARD32 **priv) { xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); pContext->port_priv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr); @@ -80,7 +76,7 @@ static void xf86XvMCDestroyContext(XvMCContextPtr pContext) { xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); (*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext) (pScrn, pContext); @@ -91,7 +87,7 @@ xf86XvMCCreateSurface(XvMCSurfacePtr pSurface, int *num_priv, CARD32 **priv) { XvMCContextPtr pContext = pSurface->context; xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface) (pScrn, pSurface, @@ -104,7 +100,7 @@ xf86XvMCDestroySurface(XvMCSurfacePtr pSurface) { XvMCContextPtr pContext = pSurface->context; xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface) (pScrn, pSurface); @@ -116,7 +112,7 @@ xf86XvMCCreateSubpicture(XvMCSubpicturePtr pSubpicture, { XvMCContextPtr pContext = pSubpicture->context; xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); return (*pScreenPriv->adaptors[pContext->adapt_num]-> CreateSubpicture) (pScrn, pSubpicture, num_priv, priv); @@ -127,14 +123,14 @@ xf86XvMCDestroySubpicture(XvMCSubpicturePtr pSubpicture) { XvMCContextPtr pContext = pSubpicture->context; xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen); (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture) (pScrn, pSubpicture); } static Bool -xf86XvMCCloseScreen(int i, ScreenPtr pScreen) +xf86XvMCCloseScreen(ScreenPtr pScreen) { xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen); @@ -143,7 +139,7 @@ xf86XvMCCloseScreen(int i, ScreenPtr pScreen) free(pScreenPriv->dixinfo); free(pScreenPriv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } Bool @@ -156,7 +152,7 @@ xf86XvMCScreenInit(ScreenPtr pScreen, XF86XvScreenKey); int i, j; - if (!XvMCScreenInitProc) + if (noXvExtension) return FALSE; if (!(pAdapt = malloc(sizeof(XvMCAdaptorRec) * num_adaptors))) @@ -205,7 +201,7 @@ xf86XvMCScreenInit(ScreenPtr pScreen, adaptors++; } - if (Success != (*XvMCScreenInitProc) (pScreen, num_adaptors, pAdapt)) + if (Success != XvMCScreenInit(pScreen, num_adaptors, pAdapt)) return FALSE; return TRUE; diff --git a/xserver/hw/xfree86/common/xf86xvmc.h b/xserver/hw/xfree86/common/xf86xvmc.h index ff32379fe..2478fe344 100644 --- a/xserver/hw/xfree86/common/xf86xvmc.h +++ b/xserver/hw/xfree86/common/xf86xvmc.h @@ -138,7 +138,4 @@ extern _X_EXPORT Bool xf86XvMCScreenInit(ScreenPtr pScreen, extern _X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec(void); extern _X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor); -typedef int (*XvMCScreenInitProcPtr) (ScreenPtr, int, XvMCAdaptorPtr); -extern _X_EXPORT XvMCScreenInitProcPtr XvMCScreenInitProc; - #endif /* _XF86XVMC_H */ diff --git a/xserver/hw/xfree86/common/xf86xvpriv.h b/xserver/hw/xfree86/common/xf86xvpriv.h index 289ca5843..e95f959a8 100644 --- a/xserver/hw/xfree86/common/xf86xvpriv.h +++ b/xserver/hw/xfree86/common/xf86xvpriv.h @@ -41,9 +41,9 @@ typedef struct { ClipNotifyProcPtr ClipNotify; WindowExposuresProcPtr WindowExposures; PostValidateTreeProcPtr PostValidateTree; - void (*AdjustFrame) (int, int, int, int); - Bool (*EnterVT) (int, int); - void (*LeaveVT) (int, int); + void (*AdjustFrame) (ScrnInfoPtr, int, int); + Bool (*EnterVT) (ScrnInfoPtr); + void (*LeaveVT) (ScrnInfoPtr); xf86ModeSetProc *ModeSet; } XF86XVScreenRec, *XF86XVScreenPtr; diff --git a/xserver/hw/xfree86/ddc/Makefile.in b/xserver/hw/xfree86/ddc/Makefile.in index 0c9b9f6ea..38164f2c0 100644 --- a/xserver/hw/xfree86/ddc/Makefile.in +++ b/xserver/hw/xfree86/ddc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -212,13 +212,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -240,6 +236,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -264,6 +261,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -378,6 +376,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/ddc/ddc.c b/xserver/hw/xfree86/ddc/ddc.c index a1281d735..28c969646 100644 --- a/xserver/hw/xfree86/ddc/ddc.c +++ b/xserver/hw/xfree86/ddc/ddc.c @@ -258,10 +258,9 @@ EDIDRead_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDCSpeed, * @return NULL if no monitor attached or failure to interpret the EDID. */ xf86MonPtr -xf86DoEDID_DDC1(int scrnIndex, DDC1SetSpeedProc DDC1SetSpeed, +xf86DoEDID_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDC1SetSpeed, unsigned int (*DDC1Read) (ScrnInfoPtr)) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; unsigned char *EDID_block = NULL; xf86MonPtr tmp = NULL; @@ -285,7 +284,7 @@ xf86DoEDID_DDC1(int scrnIndex, DDC1SetSpeedProc DDC1SetSpeed, OsReleaseSignals(); if (EDID_block) { - tmp = xf86InterpretEDID(scrnIndex, EDID_block); + tmp = xf86InterpretEDID(pScrn->scrnIndex, EDID_block); } #ifdef DEBUG else @@ -323,7 +322,7 @@ DDC2MakeDevice(I2CBusPtr pBus, int address, char *name) } static I2CDevPtr -DDC2Init(int scrnIndex, I2CBusPtr pBus) +DDC2Init(I2CBusPtr pBus) { I2CDevPtr dev = NULL; @@ -403,9 +402,8 @@ DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer) * @return NULL if no monitor attached or failure to interpret the EDID. */ xf86MonPtr -xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete) +xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool complete) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; unsigned char *EDID_block = NULL; xf86MonPtr tmp = NULL; I2CDevPtr dev = NULL; @@ -427,7 +425,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete) if (noddc || noddc2) return NULL; - if (!(dev = DDC2Init(scrnIndex, pBus))) + if (!(dev = DDC2Init(pBus))) return NULL; EDID_block = calloc(1, EDID1_LEN); @@ -444,7 +442,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete) DDC2Read(dev, i + 1, EDID_block + (EDID1_LEN * (1 + i))); } - tmp = xf86InterpretEEDID(scrnIndex, EDID_block); + tmp = xf86InterpretEEDID(pScrn->scrnIndex, EDID_block); } if (tmp && complete) @@ -465,9 +463,9 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete) * @return NULL if no monitor attached or failure to interpret the EDID. */ xf86MonPtr -xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus) +xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus) { - return xf86DoEEDID(scrnIndex, pBus, FALSE); + return xf86DoEEDID(pScrn, pBus, FALSE); } /* XXX write me */ @@ -489,9 +487,8 @@ DDC2ReadDisplayID(void) * @return NULL if no monitor attached or failure to interpret the DisplayID. */ xf86MonPtr -xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus) +xf86DoDisplayID(ScrnInfoPtr pScrn, I2CBusPtr pBus) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; unsigned char *did = NULL; xf86MonPtr tmp = NULL; I2CDevPtr dev = NULL; @@ -513,7 +510,7 @@ xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus) if (noddc || noddc2) return NULL; - if (!(dev = DDC2Init(scrnIndex, pBus))) + if (!(dev = DDC2Init(pBus))) return NULL; if ((did = DDC2ReadDisplayID())) { @@ -521,7 +518,7 @@ xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus) if (!tmp) return NULL; - tmp->scrnIndex = scrnIndex; + tmp->scrnIndex = pScrn->scrnIndex; tmp->flags |= MONITOR_DISPLAYID; tmp->rawData = did; } diff --git a/xserver/hw/xfree86/ddc/xf86DDC.h b/xserver/hw/xfree86/ddc/xf86DDC.h index 2071d530d..c63da8bff 100644 --- a/xserver/hw/xfree86/ddc/xf86DDC.h +++ b/xserver/hw/xfree86/ddc/xf86DDC.h @@ -24,15 +24,15 @@ typedef enum { typedef void (*DDC1SetSpeedProc) (ScrnInfoPtr, xf86ddcSpeed); -extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC1(int scrnIndex, +extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDC1SetSpeed, unsigned int (*DDC1Read) (ScrnInfoPtr) ); -extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus); +extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus); -extern _X_EXPORT xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool); +extern _X_EXPORT xf86MonPtr xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool); extern _X_EXPORT xf86MonPtr xf86PrintEDID(xf86MonPtr monPtr); @@ -50,7 +50,7 @@ extern _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC); extern _X_EXPORT Bool xf86MonitorIsHDMI(xf86MonPtr mon); -extern _X_EXPORT xf86MonPtr xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus); +extern _X_EXPORT xf86MonPtr xf86DoDisplayID(ScrnInfoPtr pScrn, I2CBusPtr pBus); extern _X_EXPORT void xf86DisplayIDMonitorSet(int scrnIndex, MonPtr mon, xf86MonPtr DDC); diff --git a/xserver/hw/xfree86/dixmods/Makefile.am b/xserver/hw/xfree86/dixmods/Makefile.am index a5be3ae00..f161db60a 100644 --- a/xserver/hw/xfree86/dixmods/Makefile.am +++ b/xserver/hw/xfree86/dixmods/Makefile.am @@ -1,67 +1,50 @@ noinst_LTLIBRARIES = libdixmods.la libxorgxkb.la -SUBDIRS = extmod - if GLX GLXMODS = libglx.la endif -if DBE -DBEMOD = libdbe.la -endif - -if RECORD -RECORDMOD = librecord.la -endif - module_LTLIBRARIES = libfb.la \ libwfb.la \ libshadow.la extsmoduledir = $(moduledir)/extensions -extsmodule_LTLIBRARIES = $(RECORDMOD) \ - $(DBEMOD) \ - $(GLXMODS) +extsmodule_LTLIBRARIES = $(GLXMODS) AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@ INCLUDES = @XORG_INCS@ \ - -I$(top_srcdir)/dbe \ -I$(top_srcdir)/hw/xfree86/loader \ -I$(top_srcdir)/miext/shadow \ -I$(top_srcdir)/glx -libdbe_la_LDFLAGS = -module -avoid-version -libdbe_la_LIBADD = $(top_builddir)/dbe/libdbe.la -libdbe_la_SOURCES = dbemodule.c - -libfb_la_LDFLAGS = -module -avoid-version +libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libfb_la_LIBADD = $(top_builddir)/fb/libfb.la libfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c libfb_la_CFLAGS = $(AM_CFLAGS) -libwfb_la_LDFLAGS = -module -avoid-version +libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la libwfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER -libglx_la_LDFLAGS = -module -avoid-version +libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) +libglx_la_LIBADD = $(top_builddir)/glx/libglx.la $(GLX_SYS_LIBS) if AIGLX_DRI_LOADER -GLXDRI_LIBRARY = $(top_builddir)/glx/libglxdri.la +libglx_la_LIBADD += $(top_builddir)/glx/libglxdri.la +if NO_UNDEFINED +libglx_la_LIBADD += ../dri/libdri.la ../dri2/libdri2.la +endif endif -libglx_la_LIBADD = \ - $(top_builddir)/glx/libglx.la \ - $(GLXDRI_LIBRARY) libglx_la_SOURCES = glxmodule.c -librecord_la_LDFLAGS = -module -avoid-version -librecord_la_LIBADD = $(top_builddir)/record/librecord.la -librecord_la_SOURCES = recordmod.c - -libshadow_la_LDFLAGS = -module -avoid-version +libshadow_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libshadow_la_LIBADD = $(top_builddir)/miext/shadow/libshadow.la +if NO_UNDEFINED +libshadow_la_LIBADD += libfb.la +endif libshadow_la_SOURCES = shmodule.c libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c -libdixmods_la_CFLAGS = -DXFree86LOADER $(AM_CFLAGS) +libdixmods_la_CFLAGS = $(AM_CFLAGS) libxorgxkb_la_SOURCES = xkbVT.c xkbPrivate.c xkbKillSrv.c diff --git a/xserver/hw/xfree86/dixmods/Makefile.in b/xserver/hw/xfree86/dixmods/Makefile.in index 9ab9e8e7c..ed804dbc2 100644 --- a/xserver/hw/xfree86/dixmods/Makefile.in +++ b/xserver/hw/xfree86/dixmods/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -50,6 +50,9 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@AIGLX_DRI_LOADER_TRUE@am__append_1 = $(top_builddir)/glx/libglxdri.la +@AIGLX_DRI_LOADER_TRUE@@NO_UNDEFINED_TRUE@am__append_2 = ../dri/libdri.la ../dri2/libdri2.la +@NO_UNDEFINED_TRUE@am__append_3 = libfb.la subdir = hw/xfree86/dixmods DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/depcomp @@ -103,20 +106,13 @@ am__installdirs = "$(DESTDIR)$(extsmoduledir)" \ "$(DESTDIR)$(moduledir)" LTLIBRARIES = $(extsmodule_LTLIBRARIES) $(module_LTLIBRARIES) \ $(noinst_LTLIBRARIES) -libdbe_la_DEPENDENCIES = $(top_builddir)/dbe/libdbe.la -am_libdbe_la_OBJECTS = dbemodule.lo -libdbe_la_OBJECTS = $(am_libdbe_la_OBJECTS) +libdixmods_la_LIBADD = +am_libdixmods_la_OBJECTS = libdixmods_la-miinitext.lo +libdixmods_la_OBJECTS = $(am_libdixmods_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 = -libdbe_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(libdbe_la_LDFLAGS) $(LDFLAGS) -o $@ -@DBE_TRUE@am_libdbe_la_rpath = -rpath $(extsmoduledir) -libdixmods_la_LIBADD = -am_libdixmods_la_OBJECTS = libdixmods_la-miinitext.lo -libdixmods_la_OBJECTS = $(am_libdixmods_la_OBJECTS) libdixmods_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libdixmods_la_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ @@ -126,22 +122,17 @@ libfb_la_OBJECTS = $(am_libfb_la_OBJECTS) libfb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libfb_la_CFLAGS) \ $(CFLAGS) $(libfb_la_LDFLAGS) $(LDFLAGS) -o $@ +am__DEPENDENCIES_1 = libglx_la_DEPENDENCIES = $(top_builddir)/glx/libglx.la \ - $(GLXDRI_LIBRARY) + $(am__DEPENDENCIES_1) $(am__append_1) $(am__append_2) am_libglx_la_OBJECTS = glxmodule.lo libglx_la_OBJECTS = $(am_libglx_la_OBJECTS) libglx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libglx_la_LDFLAGS) $(LDFLAGS) -o $@ @GLX_TRUE@am_libglx_la_rpath = -rpath $(extsmoduledir) -librecord_la_DEPENDENCIES = $(top_builddir)/record/librecord.la -am_librecord_la_OBJECTS = recordmod.lo -librecord_la_OBJECTS = $(am_librecord_la_OBJECTS) -librecord_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(librecord_la_LDFLAGS) $(LDFLAGS) -o $@ -@RECORD_TRUE@am_librecord_la_rpath = -rpath $(extsmoduledir) -libshadow_la_DEPENDENCIES = $(top_builddir)/miext/shadow/libshadow.la +libshadow_la_DEPENDENCIES = $(top_builddir)/miext/shadow/libshadow.la \ + $(am__append_3) am_libshadow_la_OBJECTS = shmodule.lo libshadow_la_OBJECTS = $(am_libshadow_la_OBJECTS) libshadow_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -190,60 +181,20 @@ 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 = $(libdbe_la_SOURCES) $(libdixmods_la_SOURCES) \ - $(libfb_la_SOURCES) $(libglx_la_SOURCES) \ - $(librecord_la_SOURCES) $(libshadow_la_SOURCES) \ +SOURCES = $(libdixmods_la_SOURCES) $(libfb_la_SOURCES) \ + $(libglx_la_SOURCES) $(libshadow_la_SOURCES) \ $(libwfb_la_SOURCES) $(libxorgxkb_la_SOURCES) -DIST_SOURCES = $(libdbe_la_SOURCES) $(libdixmods_la_SOURCES) \ - $(libfb_la_SOURCES) $(libglx_la_SOURCES) \ - $(librecord_la_SOURCES) $(libshadow_la_SOURCES) \ +DIST_SOURCES = $(libdixmods_la_SOURCES) $(libfb_la_SOURCES) \ + $(libglx_la_SOURCES) $(libshadow_la_SOURCES) \ $(libwfb_la_SOURCES) $(libxorgxkb_la_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ @@ -301,13 +252,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -329,6 +276,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -353,6 +301,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -467,6 +416,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -567,54 +517,39 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libdixmods.la libxorgxkb.la -SUBDIRS = extmod @GLX_TRUE@GLXMODS = libglx.la -@DBE_TRUE@DBEMOD = libdbe.la -@RECORD_TRUE@RECORDMOD = librecord.la module_LTLIBRARIES = libfb.la \ libwfb.la \ libshadow.la extsmoduledir = $(moduledir)/extensions -extsmodule_LTLIBRARIES = $(RECORDMOD) \ - $(DBEMOD) \ - $(GLXMODS) - +extsmodule_LTLIBRARIES = $(GLXMODS) AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@ INCLUDES = @XORG_INCS@ \ - -I$(top_srcdir)/dbe \ -I$(top_srcdir)/hw/xfree86/loader \ -I$(top_srcdir)/miext/shadow \ -I$(top_srcdir)/glx -libdbe_la_LDFLAGS = -module -avoid-version -libdbe_la_LIBADD = $(top_builddir)/dbe/libdbe.la -libdbe_la_SOURCES = dbemodule.c -libfb_la_LDFLAGS = -module -avoid-version +libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libfb_la_LIBADD = $(top_builddir)/fb/libfb.la libfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c libfb_la_CFLAGS = $(AM_CFLAGS) -libwfb_la_LDFLAGS = -module -avoid-version +libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la libwfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER -libglx_la_LDFLAGS = -module -avoid-version -@AIGLX_DRI_LOADER_TRUE@GLXDRI_LIBRARY = $(top_builddir)/glx/libglxdri.la -libglx_la_LIBADD = \ - $(top_builddir)/glx/libglx.la \ - $(GLXDRI_LIBRARY) - +libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) +libglx_la_LIBADD = $(top_builddir)/glx/libglx.la $(GLX_SYS_LIBS) \ + $(am__append_1) $(am__append_2) libglx_la_SOURCES = glxmodule.c -librecord_la_LDFLAGS = -module -avoid-version -librecord_la_LIBADD = $(top_builddir)/record/librecord.la -librecord_la_SOURCES = recordmod.c -libshadow_la_LDFLAGS = -module -avoid-version -libshadow_la_LIBADD = $(top_builddir)/miext/shadow/libshadow.la +libshadow_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) +libshadow_la_LIBADD = $(top_builddir)/miext/shadow/libshadow.la \ + $(am__append_3) libshadow_la_SOURCES = shmodule.c libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c -libdixmods_la_CFLAGS = -DXFree86LOADER $(AM_CFLAGS) +libdixmods_la_CFLAGS = $(AM_CFLAGS) libxorgxkb_la_SOURCES = xkbVT.c xkbPrivate.c xkbKillSrv.c -all: all-recursive +all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj @@ -727,16 +662,12 @@ clean-noinstLTLIBRARIES: echo rm -f $${locs}; \ rm -f $${locs}; \ } -libdbe.la: $(libdbe_la_OBJECTS) $(libdbe_la_DEPENDENCIES) $(EXTRA_libdbe_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdbe_la_LINK) $(am_libdbe_la_rpath) $(libdbe_la_OBJECTS) $(libdbe_la_LIBADD) $(LIBS) libdixmods.la: $(libdixmods_la_OBJECTS) $(libdixmods_la_DEPENDENCIES) $(EXTRA_libdixmods_la_DEPENDENCIES) $(AM_V_CCLD)$(libdixmods_la_LINK) $(libdixmods_la_OBJECTS) $(libdixmods_la_LIBADD) $(LIBS) libfb.la: $(libfb_la_OBJECTS) $(libfb_la_DEPENDENCIES) $(EXTRA_libfb_la_DEPENDENCIES) $(AM_V_CCLD)$(libfb_la_LINK) -rpath $(moduledir) $(libfb_la_OBJECTS) $(libfb_la_LIBADD) $(LIBS) libglx.la: $(libglx_la_OBJECTS) $(libglx_la_DEPENDENCIES) $(EXTRA_libglx_la_DEPENDENCIES) $(AM_V_CCLD)$(libglx_la_LINK) $(am_libglx_la_rpath) $(libglx_la_OBJECTS) $(libglx_la_LIBADD) $(LIBS) -librecord.la: $(librecord_la_OBJECTS) $(librecord_la_DEPENDENCIES) $(EXTRA_librecord_la_DEPENDENCIES) - $(AM_V_CCLD)$(librecord_la_LINK) $(am_librecord_la_rpath) $(librecord_la_OBJECTS) $(librecord_la_LIBADD) $(LIBS) libshadow.la: $(libshadow_la_OBJECTS) $(libshadow_la_DEPENDENCIES) $(EXTRA_libshadow_la_DEPENDENCIES) $(AM_V_CCLD)$(libshadow_la_LINK) -rpath $(moduledir) $(libshadow_la_OBJECTS) $(libshadow_la_LIBADD) $(LIBS) libwfb.la: $(libwfb_la_OBJECTS) $(libwfb_la_DEPENDENCIES) $(EXTRA_libwfb_la_DEPENDENCIES) @@ -750,14 +681,12 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbemodule.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxmodule.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdixmods_la-miinitext.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbcmap_mi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbmodule.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbcmap_mi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbmodule.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/recordmod.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shmodule.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbKillSrv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbPrivate.Plo@am__quote@ @@ -825,53 +754,6 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done -cscopelist-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ - done - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -882,23 +764,10 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) mkid -fID $$unique tags: TAGS -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ @@ -917,7 +786,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ fi; \ fi ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -934,7 +803,7 @@ GTAGS: && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) +cscopelist: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ @@ -981,48 +850,22 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done check-am: all-am -check: check-recursive +check: check-am all-am: Makefile $(LTLIBRARIES) -installdirs: installdirs-recursive -installdirs-am: +installdirs: for dir in "$(DESTDIR)$(extsmoduledir)" "$(DESTDIR)$(moduledir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive +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-recursive +installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ @@ -1044,88 +887,85 @@ distclean-generic: 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-recursive +clean: clean-am clean-am: clean-extsmoduleLTLIBRARIES clean-generic clean-libtool \ clean-moduleLTLIBRARIES clean-noinstLTLIBRARIES mostlyclean-am -distclean: distclean-recursive +distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags -dvi: dvi-recursive +dvi: dvi-am dvi-am: -html: html-recursive +html: html-am html-am: -info: info-recursive +info: info-am info-am: install-data-am: install-extsmoduleLTLIBRARIES \ install-moduleLTLIBRARIES -install-dvi: install-dvi-recursive +install-dvi: install-dvi-am install-dvi-am: install-exec-am: -install-html: install-html-recursive +install-html: install-html-am install-html-am: -install-info: install-info-recursive +install-info: install-info-am install-info-am: install-man: -install-pdf: install-pdf-recursive +install-pdf: install-pdf-am install-pdf-am: -install-ps: install-ps-recursive +install-ps: install-ps-am install-ps-am: installcheck-am: -maintainer-clean: maintainer-clean-recursive +maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic -mostlyclean: mostlyclean-recursive +mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool -pdf: pdf-recursive +pdf: pdf-am pdf-am: -ps: ps-recursive +ps: ps-am ps-am: uninstall-am: uninstall-extsmoduleLTLIBRARIES \ uninstall-moduleLTLIBRARIES -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \ - cscopelist-recursive ctags-recursive install-am install-strip \ - tags-recursive +.MAKE: install-am install-strip -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am clean clean-extsmoduleLTLIBRARIES \ - clean-generic clean-libtool clean-moduleLTLIBRARIES \ - clean-noinstLTLIBRARIES cscopelist cscopelist-recursive ctags \ - ctags-recursive distclean distclean-compile distclean-generic \ +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-extsmoduleLTLIBRARIES clean-generic clean-libtool \ + clean-moduleLTLIBRARIES clean-noinstLTLIBRARIES 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-data \ install-data-am install-dvi install-dvi-am install-exec \ @@ -1133,11 +973,11 @@ uninstall-am: uninstall-extsmoduleLTLIBRARIES \ install-html-am install-info install-info-am install-man \ install-moduleLTLIBRARIES install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am \ - uninstall-extsmoduleLTLIBRARIES uninstall-moduleLTLIBRARIES + tags uninstall uninstall-am uninstall-extsmoduleLTLIBRARIES \ + uninstall-moduleLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/xserver/hw/xfree86/dixmods/dbemodule.c b/xserver/hw/xfree86/dixmods/dbemodule.c deleted file mode 100644 index 5541eacab..000000000 --- a/xserver/hw/xfree86/dixmods/dbemodule.c +++ /dev/null @@ -1,45 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86Module.h" -#include "globals.h" - -static MODULESETUPPROTO(dbeSetup); - -extern void DbeExtensionInit(INITARGS); - -static ExtensionModule dbeExt = { - DbeExtensionInit, - "DOUBLE-BUFFER", - &noDbeExtension, - NULL, - NULL -}; - -static XF86ModuleVersionInfo VersRec = { - "dbe", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_EXTENSION, - ABI_EXTENSION_VERSION, - MOD_CLASS_EXTENSION, - {0, 0, 0, 0} -}; - -/* - * Data for the loader - */ -_X_EXPORT XF86ModuleData dbeModuleData = { &VersRec, dbeSetup, NULL }; - -static pointer -dbeSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - LoadExtension(&dbeExt, FALSE); - - /* Need a non-NULL return value to indicate success */ - return (pointer) 1; -} diff --git a/xserver/hw/xfree86/dixmods/extmod/Makefile.am b/xserver/hw/xfree86/dixmods/extmod/Makefile.am deleted file mode 100644 index 87c28a421..000000000 --- a/xserver/hw/xfree86/dixmods/extmod/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -sdk_HEADERS = dgaproc.h - -extsmoduledir = $(moduledir)/extensions -extsmodule_LTLIBRARIES = libextmod.la - -if DGA -DGA_SRCS = xf86dga2.c dgaproc.h -endif - -if XV -XV_SRCS = xvmod.c xvmodproc.h -endif - -if XF86VIDMODE -XF86VMODE_SRCS = xf86vmode.c -endif - -AM_CFLAGS = @DIX_CFLAGS@ @XORG_CFLAGS@ -INCLUDES = @XORG_INCS@ \ - -I$(top_srcdir)/dbe \ - -I$(top_srcdir)/hw/xfree86/loader \ - -I$(top_srcdir)/miext/shadow - -libextmod_la_LDFLAGS = -module -avoid-version -libextmod_la_SOURCES = modinit.c \ - modinit.h \ - $(DGA_SRCS) \ - $(XF86VMODE_SRCS) \ - $(XV_SRCS) -libextmod_la_LIBADD = $(top_builddir)/Xext/libXextmodule.la diff --git a/xserver/hw/xfree86/dixmods/extmod/modinit.c b/xserver/hw/xfree86/dixmods/extmod/modinit.c deleted file mode 100644 index ca15ee0e7..000000000 --- a/xserver/hw/xfree86/dixmods/extmod/modinit.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 1997 Matthieu Herrb - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Matthieu Herrb not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Matthieu Herrb makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * MATTHIEU HERRB DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL MATTHIEU HERRB BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86Module.h" -#include "xf86Opt.h" - -#include <X11/Xproto.h> - -#include "modinit.h" -#include "globals.h" - -static MODULESETUPPROTO(extmodSetup); - -/* - * Array describing extensions to be initialized - */ -static ExtensionModule extensionModules[] = { -#ifdef XSELINUX - { - SELinuxExtensionInit, - SELINUX_EXTENSION_NAME, - &noSELinuxExtension, - NULL, - NULL}, -#endif -#ifdef SCREENSAVER - { - ScreenSaverExtensionInit, - ScreenSaverName, - &noScreenSaverExtension, - NULL, - NULL}, -#endif -#ifdef XF86VIDMODE - { - XFree86VidModeExtensionInit, - XF86VIDMODENAME, - &noXFree86VidModeExtension, - NULL, - NULL}, -#endif -#ifdef XFreeXDGA - { - XFree86DGAExtensionInit, - XF86DGANAME, - &noXFree86DGAExtension, - XFree86DGARegister, - NULL}, -#endif -#ifdef DPMSExtension - { - DPMSExtensionInit, - DPMSExtensionName, - &noDPMSExtension, - NULL, - NULL}, -#endif -#ifdef XV - { - XvExtensionInit, - XvName, - &noXvExtension, - XvRegister, - NULL}, - { - XvMCExtensionInit, - XvMCName, - &noXvExtension, - NULL, - NULL}, -#endif -#ifdef RES - { - ResExtensionInit, - XRES_NAME, - &noResExtension, - NULL, - NULL}, -#endif - { /* DON'T delete this entry ! */ - NULL, - NULL, - NULL, - NULL, - NULL} -}; - -static XF86ModuleVersionInfo VersRec = { - "extmod", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_EXTENSION, - ABI_EXTENSION_VERSION, - MOD_CLASS_EXTENSION, - {0, 0, 0, 0} -}; - -/* - * Data for the loader - */ -_X_EXPORT XF86ModuleData extmodModuleData = { &VersRec, extmodSetup, NULL }; - -static pointer -extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - int i; - - /* XXX the option stuff here is largely a sample/test case */ - - for (i = 0; extensionModules[i].name != NULL; i++) { - if (opts) { - char *s; - - if (asprintf(&s, "omit%s", extensionModules[i].name) != -1) { - pointer o; - - o = xf86FindOption(opts, s); - free(s); - if (o) { - xf86MarkOptionUsed(o); - continue; - } - } - } - -#ifdef XSELINUX - if (!strcmp(SELINUX_EXTENSION_NAME, extensionModules[i].name)) { - pointer o; - - selinuxEnforcingState = SELINUX_MODE_DEFAULT; - - if ((o = xf86FindOption(opts, "SELinux mode disabled"))) { - xf86MarkOptionUsed(o); - selinuxEnforcingState = SELINUX_MODE_DISABLED; - } - if ((o = xf86FindOption(opts, "SELinux mode permissive"))) { - xf86MarkOptionUsed(o); - selinuxEnforcingState = SELINUX_MODE_PERMISSIVE; - } - if ((o = xf86FindOption(opts, "SELinux mode enforcing"))) { - xf86MarkOptionUsed(o); - selinuxEnforcingState = SELINUX_MODE_ENFORCING; - } - } -#endif - - LoadExtension(&extensionModules[i], FALSE); - } - /* Need a non-NULL return */ - return (pointer) 1; -} diff --git a/xserver/hw/xfree86/dixmods/extmod/modinit.h b/xserver/hw/xfree86/dixmods/extmod/modinit.h index 9753fe0fd..4c9b6e3cc 100644 --- a/xserver/hw/xfree86/dixmods/extmod/modinit.h +++ b/xserver/hw/xfree86/dixmods/extmod/modinit.h @@ -3,91 +3,78 @@ #include <dix-config.h> #endif -#ifndef INITARGS -#define INITARGS void -#endif - #include <X11/extensions/shapeproto.h> #ifdef XTEST -extern void XTestExtensionInit(INITARGS); - +extern void XTestExtensionInit(void); #include <X11/extensions/xtestproto.h> #endif #if 1 -extern void XTestExtension1Init(INITARGS); +extern void XTestExtension1Init(void); #endif #if 1 -extern void XCMiscExtensionInit(INITARGS); +extern void XCMiscExtensionInit(void); #endif #ifdef SCREENSAVER -extern void ScreenSaverExtensionInit(INITARGS); - +extern void ScreenSaverExtensionInit(void); #include <X11/extensions/saver.h> #endif #ifdef XF86VIDMODE -extern void XFree86VidModeExtensionInit(INITARGS); - +extern void XFree86VidModeExtensionInit(void); #include <X11/extensions/xf86vmproto.h> #endif #ifdef XFreeXDGA -extern void XFree86DGAExtensionInit(INITARGS); -extern void XFree86DGARegister(INITARGS); - +extern void XFree86DGAExtensionInit(void); +extern void XFree86DGARegister(void); #include <X11/extensions/xf86dgaproto.h> #endif #ifdef DPMSExtension -extern void DPMSExtensionInit(INITARGS); - +extern void DPMSExtensionInit(void); #include <X11/extensions/dpmsconst.h> #endif #ifdef XV -extern void XvExtensionInit(INITARGS); -extern void XvMCExtensionInit(INITARGS); -extern void XvRegister(INITARGS); - +extern void XvExtensionInit(void); +extern void XvMCExtensionInit(void); +extern void XvRegister(void); #include <X11/extensions/Xv.h> #include <X11/extensions/XvMC.h> #endif #ifdef RES -extern void ResExtensionInit(INITARGS); - +extern void ResExtensionInit(void); #include <X11/extensions/XResproto.h> #endif #ifdef SHM -extern void ShmExtensionInit(INITARGS); - #include <X11/extensions/shmproto.h> +extern void ShmExtensionInit(void); extern void ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs); #endif #ifdef XSELINUX -extern void SELinuxExtensionInit(INITARGS); - +extern void SELinuxExtensionInit(void); #include "xselinux.h" #endif #ifdef XEVIE -extern void XevieExtensionInit(INITARGS); +extern void XevieExtensionInit(void); #endif #if 1 -extern void SecurityExtensionInit(INITARGS); +extern void SecurityExtensionInit(void); #endif #if 1 -extern void PanoramiXExtensionInit(int argc, char *argv[]); +extern void PanoramiXExtensionInit(void); #endif #if 1 -extern void XkbExtensionInit(INITARGS); +extern void XkbExtensionInit(void); #endif diff --git a/xserver/hw/xfree86/dixmods/extmod/xf86dga2.c b/xserver/hw/xfree86/dixmods/extmod/xf86dga2.c deleted file mode 100644 index 6b33941ef..000000000 --- a/xserver/hw/xfree86/dixmods/extmod/xf86dga2.c +++ /dev/null @@ -1,1029 +0,0 @@ -/* - * Copyright (c) 1995 Jon Tombs - * Copyright (c) 1995, 1996, 1999 XFree86 Inc - * Copyright (c) 1999 - The XFree86 Project Inc. - * - * Written by Mark Vojkovich - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <X11/X.h> -#include <X11/Xproto.h> -#include "misc.h" -#include "dixstruct.h" -#include "dixevents.h" -#include "pixmapstr.h" -#include "extnsionst.h" -#include "colormapst.h" -#include "cursorstr.h" -#include "scrnintstr.h" -#include "servermd.h" -#include <X11/extensions/xf86dgaproto.h> -#include "swaprep.h" -#include "dgaproc.h" -#include "protocol-versions.h" - -#include <string.h> - -#include "modinit.h" - -#define DGA_PROTOCOL_OLD_SUPPORT 1 - -static void XDGAResetProc(ExtensionEntry * extEntry); - -static void DGAClientStateChange(CallbackListPtr *, pointer, pointer); - -unsigned char DGAReqCode = 0; -int DGAErrorBase; -int DGAEventBase; - -static DevPrivateKeyRec DGAScreenPrivateKeyRec; - -#define DGAScreenPrivateKey (&DGAScreenPrivateKeyRec) -#define DGAScreenPrivateKeyRegistered (DGAScreenPrivateKeyRec.initialized) -static DevPrivateKeyRec DGAClientPrivateKeyRec; - -#define DGAClientPrivateKey (&DGAClientPrivateKeyRec) -static int DGACallbackRefCount = 0; - -/* This holds the client's version information */ -typedef struct { - int major; - int minor; -} DGAPrivRec, *DGAPrivPtr; - -#define DGA_GETCLIENT(idx) ((ClientPtr) \ - dixLookupPrivate(&screenInfo.screens[idx]->devPrivates, DGAScreenPrivateKey)) -#define DGA_SETCLIENT(idx,p) \ - dixSetPrivate(&screenInfo.screens[idx]->devPrivates, DGAScreenPrivateKey, p) - -#define DGA_GETPRIV(c) ((DGAPrivPtr) \ - dixLookupPrivate(&(c)->devPrivates, DGAClientPrivateKey)) -#define DGA_SETPRIV(c,p) \ - dixSetPrivate(&(c)->devPrivates, DGAClientPrivateKey, p) - -static void -XDGAResetProc(ExtensionEntry * extEntry) -{ - DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL); - DGACallbackRefCount = 0; -} - -static int -ProcXDGAQueryVersion(ClientPtr client) -{ - xXDGAQueryVersionReply rep; - - REQUEST_SIZE_MATCH(xXDGAQueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = SERVER_XDGA_MAJOR_VERSION; - rep.minorVersion = SERVER_XDGA_MINOR_VERSION; - - WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *) &rep); - return Success; -} - -static int -ProcXDGAOpenFramebuffer(ClientPtr client) -{ - REQUEST(xXDGAOpenFramebufferReq); - xXDGAOpenFramebufferReply rep; - char *deviceName; - int nameSize; - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (!DGAAvailable(stuff->screen)) - return DGAErrorBase + XF86DGANoDirectVideoMode; - - REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - if (!DGAOpenFramebuffer(stuff->screen, &deviceName, - (unsigned char **) (&rep.mem1), - (int *) &rep.size, (int *) &rep.offset, - (int *) &rep.extra)) { - return BadAlloc; - } - - nameSize = deviceName ? (strlen(deviceName) + 1) : 0; - rep.length = bytes_to_int32(nameSize); - - WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *) &rep); - if (rep.length) - WriteToClient(client, nameSize, deviceName); - - return Success; -} - -static int -ProcXDGACloseFramebuffer(ClientPtr client) -{ - REQUEST(xXDGACloseFramebufferReq); - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (!DGAAvailable(stuff->screen)) - return DGAErrorBase + XF86DGANoDirectVideoMode; - - REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq); - - DGACloseFramebuffer(stuff->screen); - - return Success; -} - -static int -ProcXDGAQueryModes(ClientPtr client) -{ - int i, num, size; - - REQUEST(xXDGAQueryModesReq); - xXDGAQueryModesReply rep; - xXDGAModeInfo info; - XDGAModePtr mode; - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - REQUEST_SIZE_MATCH(xXDGAQueryModesReq); - rep.type = X_Reply; - rep.length = 0; - rep.number = 0; - rep.sequenceNumber = client->sequence; - - if (!DGAAvailable(stuff->screen)) { - rep.number = 0; - rep.length = 0; - WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep); - return Success; - } - - if (!(num = DGAGetModes(stuff->screen))) { - WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep); - return Success; - } - - if (!(mode = (XDGAModePtr) malloc(num * sizeof(XDGAModeRec)))) - return BadAlloc; - - for (i = 0; i < num; i++) - DGAGetModeInfo(stuff->screen, mode + i, i + 1); - - size = num * sz_xXDGAModeInfo; - for (i = 0; i < num; i++) - size += pad_to_int32(strlen(mode[i].name) + 1); /* plus NULL */ - - rep.number = num; - rep.length = bytes_to_int32(size); - - WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep); - - for (i = 0; i < num; i++) { - size = strlen(mode[i].name) + 1; - - info.byte_order = mode[i].byteOrder; - info.depth = mode[i].depth; - info.num = mode[i].num; - info.bpp = mode[i].bitsPerPixel; - info.name_size = (size + 3) & ~3L; - info.vsync_num = mode[i].VSync_num; - info.vsync_den = mode[i].VSync_den; - info.flags = mode[i].flags; - info.image_width = mode[i].imageWidth; - info.image_height = mode[i].imageHeight; - info.pixmap_width = mode[i].pixmapWidth; - info.pixmap_height = mode[i].pixmapHeight; - info.bytes_per_scanline = mode[i].bytesPerScanline; - info.red_mask = mode[i].red_mask; - info.green_mask = mode[i].green_mask; - info.blue_mask = mode[i].blue_mask; - info.visual_class = mode[i].visualClass; - info.viewport_width = mode[i].viewportWidth; - info.viewport_height = mode[i].viewportHeight; - info.viewport_xstep = mode[i].xViewportStep; - info.viewport_ystep = mode[i].yViewportStep; - info.viewport_xmax = mode[i].maxViewportX; - info.viewport_ymax = mode[i].maxViewportY; - info.viewport_flags = mode[i].viewportFlags; - info.reserved1 = mode[i].reserved1; - info.reserved2 = mode[i].reserved2; - - WriteToClient(client, sz_xXDGAModeInfo, (char *) (&info)); - WriteToClient(client, size, mode[i].name); - } - - free(mode); - - return Success; -} - -static void -DGAClientStateChange(CallbackListPtr *pcbl, pointer nulldata, pointer calldata) -{ - NewClientInfoRec *pci = (NewClientInfoRec *) calldata; - ClientPtr client = NULL; - int i; - - for (i = 0; i < screenInfo.numScreens; i++) { - if (DGA_GETCLIENT(i) == pci->client) { - client = pci->client; - break; - } - } - - if (client && - ((client->clientState == ClientStateGone) || - (client->clientState == ClientStateRetained))) { - XDGAModeRec mode; - PixmapPtr pPix; - - DGA_SETCLIENT(i, NULL); - DGASelectInput(i, NULL, 0); - DGASetMode(i, 0, &mode, &pPix); - - if (--DGACallbackRefCount == 0) - DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL); - } -} - -static int -ProcXDGASetMode(ClientPtr client) -{ - REQUEST(xXDGASetModeReq); - xXDGASetModeReply rep; - XDGAModeRec mode; - xXDGAModeInfo info; - PixmapPtr pPix; - ClientPtr owner; - int size; - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - owner = DGA_GETCLIENT(stuff->screen); - - REQUEST_SIZE_MATCH(xXDGASetModeReq); - rep.type = X_Reply; - rep.length = 0; - rep.offset = 0; - rep.flags = 0; - rep.sequenceNumber = client->sequence; - - if (!DGAAvailable(stuff->screen)) - return DGAErrorBase + XF86DGANoDirectVideoMode; - - if (owner && owner != client) - return DGAErrorBase + XF86DGANoDirectVideoMode; - - if (!stuff->mode) { - if (owner) { - if (--DGACallbackRefCount == 0) - DeleteCallback(&ClientStateCallback, DGAClientStateChange, - NULL); - } - DGA_SETCLIENT(stuff->screen, NULL); - DGASelectInput(stuff->screen, NULL, 0); - DGASetMode(stuff->screen, 0, &mode, &pPix); - WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep); - return Success; - } - - if (Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix)) - return BadValue; - - if (!owner) { - if (DGACallbackRefCount++ == 0) - AddCallback(&ClientStateCallback, DGAClientStateChange, NULL); - } - - DGA_SETCLIENT(stuff->screen, client); - - if (pPix) { - if (AddResource(stuff->pid, RT_PIXMAP, (pointer) (pPix))) { - pPix->drawable.id = (int) stuff->pid; - rep.flags = DGA_PIXMAP_AVAILABLE; - } - } - - size = strlen(mode.name) + 1; - - info.byte_order = mode.byteOrder; - info.depth = mode.depth; - info.num = mode.num; - info.bpp = mode.bitsPerPixel; - info.name_size = (size + 3) & ~3L; - info.vsync_num = mode.VSync_num; - info.vsync_den = mode.VSync_den; - info.flags = mode.flags; - info.image_width = mode.imageWidth; - info.image_height = mode.imageHeight; - info.pixmap_width = mode.pixmapWidth; - info.pixmap_height = mode.pixmapHeight; - info.bytes_per_scanline = mode.bytesPerScanline; - info.red_mask = mode.red_mask; - info.green_mask = mode.green_mask; - info.blue_mask = mode.blue_mask; - info.visual_class = mode.visualClass; - info.viewport_width = mode.viewportWidth; - info.viewport_height = mode.viewportHeight; - info.viewport_xstep = mode.xViewportStep; - info.viewport_ystep = mode.yViewportStep; - info.viewport_xmax = mode.maxViewportX; - info.viewport_ymax = mode.maxViewportY; - info.viewport_flags = mode.viewportFlags; - info.reserved1 = mode.reserved1; - info.reserved2 = mode.reserved2; - - rep.length = bytes_to_int32(sz_xXDGAModeInfo + info.name_size); - - WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep); - WriteToClient(client, sz_xXDGAModeInfo, (char *) (&info)); - WriteToClient(client, size, mode.name); - - return Success; -} - -static int -ProcXDGASetViewport(ClientPtr client) -{ - REQUEST(xXDGASetViewportReq); - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXDGASetViewportReq); - - DGASetViewport(stuff->screen, stuff->x, stuff->y, stuff->flags); - - return Success; -} - -static int -ProcXDGAInstallColormap(ClientPtr client) -{ - ColormapPtr cmap; - int rc; - - REQUEST(xXDGAInstallColormapReq); - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXDGAInstallColormapReq); - - rc = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, RT_COLORMAP, - client, DixInstallAccess); - if (rc != Success) - return rc; - DGAInstallCmap(cmap); - return Success; -} - -static int -ProcXDGASelectInput(ClientPtr client) -{ - REQUEST(xXDGASelectInputReq); - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXDGASelectInputReq); - - if (DGA_GETCLIENT(stuff->screen) == client) - DGASelectInput(stuff->screen, client, stuff->mask); - - return Success; -} - -static int -ProcXDGAFillRectangle(ClientPtr client) -{ - REQUEST(xXDGAFillRectangleReq); - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXDGAFillRectangleReq); - - if (Success != DGAFillRect(stuff->screen, stuff->x, stuff->y, - stuff->width, stuff->height, stuff->color)) - return BadMatch; - - return Success; -} - -static int -ProcXDGACopyArea(ClientPtr client) -{ - REQUEST(xXDGACopyAreaReq); - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXDGACopyAreaReq); - - if (Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy, - stuff->width, stuff->height, stuff->dstx, - stuff->dsty)) - return BadMatch; - - return Success; -} - -static int -ProcXDGACopyTransparentArea(ClientPtr client) -{ - REQUEST(xXDGACopyTransparentAreaReq); - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq); - - if (Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy, - stuff->width, stuff->height, stuff->dstx, - stuff->dsty, stuff->key)) - return BadMatch; - - return Success; -} - -static int -ProcXDGAGetViewportStatus(ClientPtr client) -{ - REQUEST(xXDGAGetViewportStatusReq); - xXDGAGetViewportStatusReply rep; - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - rep.status = DGAGetViewportStatus(stuff->screen); - - WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *) &rep); - return Success; -} - -static int -ProcXDGASync(ClientPtr client) -{ - REQUEST(xXDGASyncReq); - xXDGASyncReply rep; - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXDGASyncReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - DGASync(stuff->screen); - - WriteToClient(client, sizeof(xXDGASyncReply), (char *) &rep); - return Success; -} - -static int -ProcXDGASetClientVersion(ClientPtr client) -{ - REQUEST(xXDGASetClientVersionReq); - - DGAPrivPtr pPriv; - - REQUEST_SIZE_MATCH(xXDGASetClientVersionReq); - if ((pPriv = DGA_GETPRIV(client)) == NULL) { - pPriv = malloc(sizeof(DGAPrivRec)); - /* XXX Need to look into freeing this */ - if (!pPriv) - return BadAlloc; - DGA_SETPRIV(client, pPriv); - } - pPriv->major = stuff->major; - pPriv->minor = stuff->minor; - - return Success; -} - -static int -ProcXDGAChangePixmapMode(ClientPtr client) -{ - REQUEST(xXDGAChangePixmapModeReq); - xXDGAChangePixmapModeReply rep; - int x, y; - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - x = stuff->x; - y = stuff->y; - - if (!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags)) - return BadMatch; - - rep.x = x; - rep.y = y; - WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *) &rep); - - return Success; -} - -static int -ProcXDGACreateColormap(ClientPtr client) -{ - REQUEST(xXDGACreateColormapReq); - int result; - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXDGACreateColormapReq); - - if (!stuff->mode) - return BadValue; - - result = DGACreateColormap(stuff->screen, client, stuff->id, - stuff->mode, stuff->alloc); - if (result != Success) - return result; - - return Success; -} - -/* - * - * Support for the old DGA protocol, used to live in xf86dga.c - * - */ - -#ifdef DGA_PROTOCOL_OLD_SUPPORT - -static int -ProcXF86DGAGetVideoLL(ClientPtr client) -{ - REQUEST(xXF86DGAGetVideoLLReq); - xXF86DGAGetVideoLLReply rep; - XDGAModeRec mode; - int num, offset, flags; - char *name; - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - if (!DGAAvailable(stuff->screen)) - return DGAErrorBase + XF86DGANoDirectVideoMode; - - if (!(num = DGAGetOldDGAMode(stuff->screen))) - return DGAErrorBase + XF86DGANoDirectVideoMode; - - /* get the parameters for the mode that best matches */ - DGAGetModeInfo(stuff->screen, &mode, num); - - if (!DGAOpenFramebuffer(stuff->screen, &name, - (unsigned char **) (&rep.offset), - (int *) (&rep.bank_size), &offset, &flags)) - return BadAlloc; - - rep.offset += mode.offset; - rep.width = mode.bytesPerScanline / (mode.bitsPerPixel >> 3); - rep.ram_size = rep.bank_size >> 10; - - WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *) &rep); - return Success; -} - -static int -ProcXF86DGADirectVideo(ClientPtr client) -{ - int num; - PixmapPtr pix; - XDGAModeRec mode; - ClientPtr owner; - - REQUEST(xXF86DGADirectVideoReq); - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq); - - if (!DGAAvailable(stuff->screen)) - return DGAErrorBase + XF86DGANoDirectVideoMode; - - owner = DGA_GETCLIENT(stuff->screen); - - if (owner && owner != client) - return DGAErrorBase + XF86DGANoDirectVideoMode; - - if (stuff->enable & XF86DGADirectGraphics) { - if (!(num = DGAGetOldDGAMode(stuff->screen))) - return DGAErrorBase + XF86DGANoDirectVideoMode; - } - else - num = 0; - - if (Success != DGASetMode(stuff->screen, num, &mode, &pix)) - return DGAErrorBase + XF86DGAScreenNotActive; - - DGASetInputMode(stuff->screen, - (stuff->enable & XF86DGADirectKeyb) != 0, - (stuff->enable & XF86DGADirectMouse) != 0); - - /* We need to track the client and attach the teardown callback */ - if (stuff->enable & - (XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse)) { - if (!owner) { - if (DGACallbackRefCount++ == 0) - AddCallback(&ClientStateCallback, DGAClientStateChange, NULL); - } - - DGA_SETCLIENT(stuff->screen, client); - } - else { - if (owner) { - if (--DGACallbackRefCount == 0) - DeleteCallback(&ClientStateCallback, DGAClientStateChange, - NULL); - } - - DGA_SETCLIENT(stuff->screen, NULL); - } - - return Success; -} - -static int -ProcXF86DGAGetViewPortSize(ClientPtr client) -{ - int num; - XDGAModeRec mode; - - REQUEST(xXF86DGAGetViewPortSizeReq); - xXF86DGAGetViewPortSizeReply rep; - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - if (!DGAAvailable(stuff->screen)) - return DGAErrorBase + XF86DGANoDirectVideoMode; - - if (!(num = DGAGetOldDGAMode(stuff->screen))) - return DGAErrorBase + XF86DGANoDirectVideoMode; - - DGAGetModeInfo(stuff->screen, &mode, num); - - rep.width = mode.viewportWidth; - rep.height = mode.viewportHeight; - - WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *) &rep); - return Success; -} - -static int -ProcXF86DGASetViewPort(ClientPtr client) -{ - REQUEST(xXF86DGASetViewPortReq); - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq); - - if (!DGAAvailable(stuff->screen)) - return DGAErrorBase + XF86DGANoDirectVideoMode; - - if (!DGAActive(stuff->screen)) - return DGAErrorBase + XF86DGADirectNotActivated; - - if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE) - != Success) - return DGAErrorBase + XF86DGADirectNotActivated; - - return Success; -} - -static int -ProcXF86DGAGetVidPage(ClientPtr client) -{ - REQUEST(xXF86DGAGetVidPageReq); - xXF86DGAGetVidPageReply rep; - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.vpage = 0; /* silently fail */ - - WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), (char *) &rep); - return Success; -} - -static int -ProcXF86DGASetVidPage(ClientPtr client) -{ - REQUEST(xXF86DGASetVidPageReq); - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq); - - /* silently fail */ - - return Success; -} - -static int -ProcXF86DGAInstallColormap(ClientPtr client) -{ - ColormapPtr pcmp; - int rc; - - REQUEST(xXF86DGAInstallColormapReq); - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq); - - if (!DGAActive(stuff->screen)) - return DGAErrorBase + XF86DGADirectNotActivated; - - rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP, - client, DixInstallAccess); - if (rc == Success) { - DGAInstallCmap(pcmp); - return Success; - } - else { - return rc; - } -} - -static int -ProcXF86DGAQueryDirectVideo(ClientPtr client) -{ - REQUEST(xXF86DGAQueryDirectVideoReq); - xXF86DGAQueryDirectVideoReply rep; - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.flags = 0; - - if (DGAAvailable(stuff->screen)) - rep.flags = XF86DGADirectPresent; - - WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *) &rep); - return Success; -} - -static int -ProcXF86DGAViewPortChanged(ClientPtr client) -{ - REQUEST(xXF86DGAViewPortChangedReq); - xXF86DGAViewPortChangedReply rep; - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - - REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq); - - if (!DGAActive(stuff->screen)) - return DGAErrorBase + XF86DGADirectNotActivated; - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.result = 1; - - WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *) &rep); - return Success; -} - -#endif /* DGA_PROTOCOL_OLD_SUPPORT */ - -static int -SProcXDGADispatch(ClientPtr client) -{ - return DGAErrorBase + XF86DGAClientNotLocal; -} - -#if 0 -#define DGA_REQ_DEBUG -#endif - -#ifdef DGA_REQ_DEBUG -static char *dgaMinor[] = { - "QueryVersion", - "GetVideoLL", - "DirectVideo", - "GetViewPortSize", - "SetViewPort", - "GetVidPage", - "SetVidPage", - "InstallColormap", - "QueryDirectVideo", - "ViewPortChanged", - "10", - "11", - "QueryModes", - "SetMode", - "SetViewport", - "InstallColormap", - "SelectInput", - "FillRectangle", - "CopyArea", - "CopyTransparentArea", - "GetViewportStatus", - "Sync", - "OpenFramebuffer", - "CloseFramebuffer", - "SetClientVersion", - "ChangePixmapMode", - "CreateColormap", -}; -#endif - -static int -ProcXDGADispatch(ClientPtr client) -{ - REQUEST(xReq); - - if (!LocalClient(client)) - return DGAErrorBase + XF86DGAClientNotLocal; - -#ifdef DGA_REQ_DEBUG - if (stuff->data <= X_XDGACreateColormap) - fprintf(stderr, " DGA %s\n", dgaMinor[stuff->data]); -#endif - - switch (stuff->data) { - /* - * DGA2 Protocol - */ - case X_XDGAQueryVersion: - return ProcXDGAQueryVersion(client); - case X_XDGAQueryModes: - return ProcXDGAQueryModes(client); - case X_XDGASetMode: - return ProcXDGASetMode(client); - case X_XDGAOpenFramebuffer: - return ProcXDGAOpenFramebuffer(client); - case X_XDGACloseFramebuffer: - return ProcXDGACloseFramebuffer(client); - case X_XDGASetViewport: - return ProcXDGASetViewport(client); - case X_XDGAInstallColormap: - return ProcXDGAInstallColormap(client); - case X_XDGASelectInput: - return ProcXDGASelectInput(client); - case X_XDGAFillRectangle: - return ProcXDGAFillRectangle(client); - case X_XDGACopyArea: - return ProcXDGACopyArea(client); - case X_XDGACopyTransparentArea: - return ProcXDGACopyTransparentArea(client); - case X_XDGAGetViewportStatus: - return ProcXDGAGetViewportStatus(client); - case X_XDGASync: - return ProcXDGASync(client); - case X_XDGASetClientVersion: - return ProcXDGASetClientVersion(client); - case X_XDGAChangePixmapMode: - return ProcXDGAChangePixmapMode(client); - case X_XDGACreateColormap: - return ProcXDGACreateColormap(client); - /* - * Old DGA Protocol - */ -#ifdef DGA_PROTOCOL_OLD_SUPPORT - case X_XF86DGAGetVideoLL: - return ProcXF86DGAGetVideoLL(client); - case X_XF86DGADirectVideo: - return ProcXF86DGADirectVideo(client); - case X_XF86DGAGetViewPortSize: - return ProcXF86DGAGetViewPortSize(client); - case X_XF86DGASetViewPort: - return ProcXF86DGASetViewPort(client); - case X_XF86DGAGetVidPage: - return ProcXF86DGAGetVidPage(client); - case X_XF86DGASetVidPage: - return ProcXF86DGASetVidPage(client); - case X_XF86DGAInstallColormap: - return ProcXF86DGAInstallColormap(client); - case X_XF86DGAQueryDirectVideo: - return ProcXF86DGAQueryDirectVideo(client); - case X_XF86DGAViewPortChanged: - return ProcXF86DGAViewPortChanged(client); -#endif /* DGA_PROTOCOL_OLD_SUPPORT */ - default: - return BadRequest; - } -} - -void -XFree86DGARegister(INITARGS) -{ - XDGAEventBase = &DGAEventBase; -} - -void -XFree86DGAExtensionInit(INITARGS) -{ - ExtensionEntry *extEntry; - - if (!dixRegisterPrivateKey(&DGAClientPrivateKeyRec, PRIVATE_CLIENT, 0)) - return; - - if (!dixRegisterPrivateKey(&DGAScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) - return; - - if ((extEntry = AddExtension(XF86DGANAME, - XF86DGANumberEvents, - XF86DGANumberErrors, - ProcXDGADispatch, - SProcXDGADispatch, - XDGAResetProc, StandardMinorOpcode))) { - int i; - - DGAReqCode = (unsigned char) extEntry->base; - DGAErrorBase = extEntry->errorBase; - DGAEventBase = extEntry->eventBase; - for (i = KeyPress; i <= MotionNotify; i++) - SetCriticalEvent(DGAEventBase + i); - } -} diff --git a/xserver/hw/xfree86/dixmods/extmod/xvmod.c b/xserver/hw/xfree86/dixmods/extmod/xvmod.c deleted file mode 100644 index 97616c705..000000000 --- a/xserver/hw/xfree86/dixmods/extmod/xvmod.c +++ /dev/null @@ -1,22 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <X11/X.h> -#include "misc.h" -#include "scrnintstr.h" -#include "gc.h" -#include <X11/extensions/Xv.h> -#include <X11/extensions/Xvproto.h> -#include "xvdix.h" -#include "xvmodproc.h" - -void -XvRegister(void) -{ - XvScreenInitProc = XvScreenInit; - XvGetScreenKeyProc = XvGetScreenKey; - XvGetRTPortProc = XvGetRTPort; - XvMCScreenInitProc = XvMCScreenInit; -} diff --git a/xserver/hw/xfree86/dixmods/extmod/xvmodproc.h b/xserver/hw/xfree86/dixmods/extmod/xvmodproc.h deleted file mode 100644 index be51e559d..000000000 --- a/xserver/hw/xfree86/dixmods/extmod/xvmodproc.h +++ /dev/null @@ -1,13 +0,0 @@ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "xvmcext.h" - -extern DevPrivateKey (*XvGetScreenKeyProc) (void); -extern unsigned long (*XvGetRTPortProc) (void); -extern int (*XvScreenInitProc) (ScreenPtr); -extern int (*XvMCScreenInitProc) (ScreenPtr, int, XvMCAdaptorPtr); - -extern void XvRegister(void); diff --git a/xserver/hw/xfree86/dixmods/glxmodule.c b/xserver/hw/xfree86/dixmods/glxmodule.c index e72f3821a..c0c611401 100644 --- a/xserver/hw/xfree86/dixmods/glxmodule.c +++ b/xserver/hw/xfree86/dixmods/glxmodule.c @@ -42,17 +42,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "micmap.h" #include "globals.h" #include "glxserver.h" +#include "extinit.h" +#include "glx_extinit.h" static MODULESETUPPROTO(glxSetup); -static const char *initdeps[] = { "DOUBLE-BUFFER", "COMPOSITE", NULL }; - static ExtensionModule GLXExt = { GlxExtensionInit, "GLX", - &noGlxExtension, - NULL, - initdeps + &noGlxExtension }; static XF86ModuleVersionInfo VersRec = { @@ -84,11 +82,6 @@ glxSetup(pointer module, pointer opts, int *errmaj, int *errmin) setupDone = TRUE; - provider = LoaderSymbol("__glXDRISWRastProvider"); - if (provider == NULL) - return NULL; - GlxPushProvider(provider); - xf86Msg(xf86Info.aiglxFrom, "AIGLX %s\n", xf86Info.aiglx ? "enabled" : "disabled"); if (xf86Info.aiglx) { diff --git a/xserver/hw/xfree86/dixmods/recordmod.c b/xserver/hw/xfree86/dixmods/recordmod.c deleted file mode 100644 index b75cc3fdb..000000000 --- a/xserver/hw/xfree86/dixmods/recordmod.c +++ /dev/null @@ -1,43 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86Module.h" - -extern Bool noTestExtensions; - -static MODULESETUPPROTO(recordSetup); - -extern void RecordExtensionInit(INITARGS); - -static ExtensionModule recordExt = { - RecordExtensionInit, - "RECORD", - &noTestExtensions, - NULL, - NULL -}; - -static XF86ModuleVersionInfo VersRec = { - "record", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 13, 0, - ABI_CLASS_EXTENSION, - ABI_EXTENSION_VERSION, - MOD_CLASS_EXTENSION, - {0, 0, 0, 0} -}; - -_X_EXPORT XF86ModuleData recordModuleData = { &VersRec, recordSetup, NULL }; - -static pointer -recordSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - LoadExtension(&recordExt, FALSE); - - /* Need a non-NULL return value to indicate success */ - return (pointer) 1; -} diff --git a/xserver/hw/xfree86/doc/Makefile.in b/xserver/hw/xfree86/doc/Makefile.in index 63fd5b49c..e11ba93ac 100644 --- a/xserver/hw/xfree86/doc/Makefile.in +++ b/xserver/hw/xfree86/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -170,13 +170,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -198,6 +194,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -222,6 +219,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -336,6 +334,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/doc/README.modes b/xserver/hw/xfree86/doc/README.modes index 894e21313..ea228e592 100644 --- a/xserver/hw/xfree86/doc/README.modes +++ b/xserver/hw/xfree86/doc/README.modes @@ -133,11 +133,10 @@ this function computes an initial configuration for the server. It tries to enable as much hardware as possible using some fairly simple heuristics. The 'canGrow' parameter indicates that the frame buffer does not have a fixed -size (fixed size frame buffers are required by XAA). When the frame buffer -has a fixed size, the configuration selects a 'reasonablely large' frame -buffer so that common reconfiguration options are possible. For resizable -frame buffers, the frame buffer is set to the smallest size that encloses -the desired configuration. +size. When the frame buffer has a fixed size, the configuration selects a +'reasonablely large' frame buffer so that common reconfiguration options are +possible. For resizable frame buffers, the frame buffer is set to the smallest +size that encloses the desired configuration. 3.2 ScreenInit functions diff --git a/xserver/hw/xfree86/doc/ddxDesign.xml b/xserver/hw/xfree86/doc/ddxDesign.xml index 6a087322f..4c2ca47da 100644 --- a/xserver/hw/xfree86/doc/ddxDesign.xml +++ b/xserver/hw/xfree86/doc/ddxDesign.xml @@ -330,8 +330,8 @@ that. This is a significant difference compared with the old design. <para> The entry points for drawing operations are already taken care of by -the framebuffer code (including, XAA). Extensions and enhancements to -framebuffer code are outside the scope of this document. +the framebuffer code. Extensions and enhancements to framebuffer code +are outside the scope of this document. </para> <para> @@ -1306,7 +1306,7 @@ Here is what <function>InitOutput()</function> does: <blockquote><para> <programlisting> - Bool ChipScreenInit(int index, ScreenPtr pScreen, + Bool ChipScreenInit(ScreenPtr pScreen, int argc, char **argv); </programlisting> <blockquote><para> @@ -1442,7 +1442,7 @@ Here is what <function>InitOutput()</function> does: <blockquote><para> <programlisting> - Bool ChipSwitchMode(int index, DisplayModePtr mode, int flags); + Bool ChipSwitchMode(int index, DisplayModePtr mode); </programlisting> <blockquote><para> Initialises the new mode for the screen identified by @@ -1464,7 +1464,7 @@ Here is what <function>InitOutput()</function> does: <blockquote><para> <programlisting> - void ChipAdjustFrame(int index, int x, int y, int flags); + void ChipAdjustFrame(int index, int x, int y); </programlisting> <blockquote><para> Changes the viewport for the screen identified by @@ -1572,7 +1572,7 @@ Here is what <function>InitOutput()</function> does: <blockquote><para> <programlisting> - Bool ChipEnterVT(int index, int flags); + Bool ChipEnterVT(ScrnInfoPtr pScrn); </programlisting> <blockquote><para> This function should initialise the current video mode and @@ -1589,7 +1589,7 @@ Here is what <function>InitOutput()</function> does: <blockquote><para> <programlisting> - void ChipLeaveVT(int index, int flags); + void ChipLeaveVT(ScrnInfoPtr pScrn); </programlisting> <blockquote><para> This function should restore the saved video state. If @@ -1691,7 +1691,7 @@ but their presence is optional. <blockquote><para> <programlisting> - ModeStatus ChipValidMode(int index, DisplayModePtr mode, + ModeStatus ChipValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags); </programlisting> <blockquote><para> @@ -1739,7 +1739,7 @@ MODECHECK_FINAL are intended for checks that may involve more than one mode. <blockquote><para> <programlisting> - void ChipFreeScreen(int scrnindex, int flags); + void ChipFreeScreen(ScrnInfoPtr pScrn); </programlisting> <blockquote><para> Free any driver-allocated data that may have been allocated up to @@ -2003,10 +2003,9 @@ also include the video card's saved state. </para> <para> -Per-screen data for other modules that the driver uses (for example, -the XAA module) that is reset for each server generation is hooked into -the <structname>ScrnInfoRec</structname> through it's <structfield>privates</structfield> -field. +Per-screen data for other modules that the driver uses that is reset for each +server generation is hooked into the <structname>ScrnInfoRec</structname> +through its <structfield>privates</structfield> field. </para> <para> @@ -2824,12 +2823,12 @@ Several functions are provided to simplify resource registration: <blockquote><para> <programlisting> - Bool xf86IsScreenPrimary(int scrnIndex); + Bool xf86IsScreenPrimary(ScrnInfoPtr pScrn); </programlisting> <blockquote><para> This function returns <constant>TRUE</constant> if the primary entity is registered with the screen referenced by - <parameter>scrnIndex</parameter>. + <parameter>pScrn</parameter>. </para> </blockquote></para></blockquote> @@ -3615,14 +3614,6 @@ The following include files are typically required by video drivers: </para> <para> - If a driver uses XAA, it needs these: - <literallayout><filename> - "xaa.h" - "xaalocal.h" - </filename></literallayout> - </para> - - <para> If a driver uses the fb manager, it needs this: <literallayout><filename> "xf86fbman.h" @@ -3840,31 +3831,6 @@ manager is allowed to manage. This is typically a box with a width of can be fit within the total video memory, however, the driver can reserve areas at the extremities by passing a smaller area to the manager. </para> - - <para> -<function>xf86InitFBManager()</function> must be called before XAA is -initialized since XAA uses the manager for it's pixmap cache. - </para> - - <para> -An alternative function is provided to allow the driver to initialize -the framebuffer manager with a Region rather than a box. - - <programlisting> - Bool xf86InitFBManagerRegion(ScreenPtr pScreen, - RegionPtr FullRegion); - </programlisting> - -<function>xf86InitFBManagerRegion()</function>, unlike -<function>xf86InitFBManager()</function>, does not remove the area used for -the visible screen so that area should not be included in the region -passed to the function. <function>xf86InitFBManagerRegion()</function> is -useful when non-contiguous areas are available to be managed, and is -required when multiple framebuffers are stored in video memory (as in -the case where an overlay of a different depth is stored as a second -framebuffer in offscreen memory). - </para> - </sect1> <sect1 id="cmap"> @@ -5363,15 +5329,6 @@ XFree86 common layer. way by modules loaded directly by the XFree86 common layer. However, it may be used for application-specific parameter passing in other situations. - </para> - - <para> - When loading <quote>external</quote> modules (modules that don't - have the standard entry point, for example a - special shared library) the options parameter can be - set to <constant>EXTERN_MODULE</constant> to tell the - loader not to reject the module when it doesn't find - the standard entry point. </para></listitem></varlistentry> @@ -5982,7 +5939,6 @@ typedef struct { InitExtension initFunc; char * name; Bool *disablePtr; - InitExtension setupFunc; } ExtensionModule; </programlisting> </para> @@ -8910,12 +8866,6 @@ ZZZPreInit(ScrnInfoPtr pScrn, int flags) ZZZFreeRec(pScrn); return FALSE; - /* Load XAA if needed */ - if (!pZzz->noAccel || pZzz->hwCursor) - if (!xf86LoadSubModule(pScrn, "xaa")) { - ZZZFreeRec(pScrn); - return FALSE; - } /* Done */ return TRUE; @@ -9033,10 +8983,10 @@ ZZZModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) <programlisting> static Bool -ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +ZZZScreenInit(ScreenPtr pScreen, int argc, char **argv) { /* Get the ScrnInfoRec */ - pScrn = xf86Screens[pScreen->myNum]; + pScrn = xf86ScreenToScrn(pScreen); /* * If using the vgahw module, its data structures and related @@ -9051,7 +9001,7 @@ ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Set the viewport if supported */ - ZZZAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + ZZZAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0); /* * Setup the screen's visuals, and initialise the framebuffer @@ -9220,9 +9170,9 @@ ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) <programlisting> static Bool -ZZZSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +ZZZSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { - return ZZZModeInit(xf86Screens[scrnIndex], mode); + return ZZZModeInit(pScrn, mode); } </programlisting> </sect3> @@ -9237,7 +9187,7 @@ ZZZSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) <programlisting> static void -ZZZAdjustFrame(int scrnIndex, int x, int y, int flags) +ZZZAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { /* Adjust the viewport */ } @@ -9258,16 +9208,14 @@ ZZZAdjustFrame(int scrnIndex, int x, int y, int flags) <programlisting> static Bool -ZZZEnterVT(int scrnIndex, int flags) +ZZZEnterVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; return ZZZModeInit(pScrn, pScrn->currentMode); } static void -ZZZLeaveVT(int scrnIndex, int flags) +ZZZLeaveVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; ZZZRestore(pScrn); } </programlisting> @@ -9288,16 +9236,16 @@ ZZZLeaveVT(int scrnIndex, int flags) <programlisting> static Bool -ZZZCloseScreen(int scrnIndex, ScreenPtr pScreen) +ZZZCloseScreen(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (pScrn->vtSema) { ZZZRestore(pScrn); ZZZUnmapMem(pScrn); } pScrn->vtSema = FALSE; pScreen->CloseScreen = ZZZPTR(pScrn)->CloseScreen; - return (*pScreen->CloseScreen)(scrnIndex, pScreen); + return (*pScreen->CloseScreen)(pScreen); } </programlisting> </sect3> @@ -9342,13 +9290,13 @@ ZZZSaveScreen(ScreenPtr pScreen, int mode) <programlisting> static void -ZZZFreeScreen(int scrnIndex, int flags) +ZZZFreeScreen(ScrnInfoPtr pScrn) { /* * If the vgahw module is used vgaHWFreeHWRec() would be called * here. */ - ZZZFreeRec(xf86Screens[scrnIndex]); + ZZZFreeRec(pScrn); } </programlisting> diff --git a/xserver/hw/xfree86/doc/exa-driver.txt b/xserver/hw/xfree86/doc/exa-driver.txt index 048307ee7..da39d3f91 100644 --- a/xserver/hw/xfree86/doc/exa-driver.txt +++ b/xserver/hw/xfree86/doc/exa-driver.txt @@ -8,15 +8,10 @@ from system memory, and Porter-Duff compositing and transform operations. Configuration ------------- -A new config file option, AccelMethod, should be added to your driver, to allow -the user to select between the EXA and XAA acceleration APIs. - Some drivers implement a per-instance useEXA flag to track whether EXA is -active or not. It can be helpful to also conditionalize XAA support with an -ifdef so that it can easily be turned off/removed in the future. +active or not. -Setting the flag and checking for AccelMethod can be done in the driver's -Options parsing routine. +Setting the flag can be done in the driver's Options parsing routine. Loading EXA ------------ diff --git a/xserver/hw/xfree86/dri/Makefile.am b/xserver/hw/xfree86/dri/Makefile.am index a7b491c6e..ced04ff38 100644 --- a/xserver/hw/xfree86/dri/Makefile.am +++ b/xserver/hw/xfree86/dri/Makefile.am @@ -1,23 +1,18 @@ -libdri_la_LTLIBRARIES = libdri.la -libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \ - -I$(top_srcdir)/hw/xfree86/os-support \ - -I$(top_srcdir)/hw/xfree86/modes \ - -I$(top_srcdir)/hw/xfree86/ddc \ - -I$(top_srcdir)/hw/xfree86/i2c \ - -I$(top_srcdir)/hw/xfree86/parser \ - -I$(top_srcdir)/hw/xfree86/ramdac \ - -I$(top_srcdir)/hw/xfree86/os-support/bus \ - -I$(top_srcdir)/glx \ - -DHAVE_XORG_CONFIG_H \ - @DIX_CFLAGS@ @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ \ - @LIBDRM_CFLAGS@ \ - @DRI_CFLAGS@ -libdri_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ -libdri_ladir = $(moduledir)/extensions +noinst_LTLIBRARIES = libdri.la +AM_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \ + -I$(top_srcdir)/hw/xfree86/os-support \ + -I$(top_srcdir)/hw/xfree86/modes \ + -I$(top_srcdir)/hw/xfree86/ddc \ + -I$(top_srcdir)/hw/xfree86/i2c \ + -I$(top_srcdir)/hw/xfree86/parser \ + -I$(top_srcdir)/hw/xfree86/ramdac \ + -I$(top_srcdir)/hw/xfree86/os-support/bus \ + -I$(top_srcdir)/glx \ + -DHAVE_XORG_CONFIG_H \ + @DIX_CFLAGS@ @XORG_CFLAGS@ libdri_la_SOURCES = \ dri.c \ dri.h \ - drimodule.c \ dristruct.h \ sarea.h \ xf86dri.c diff --git a/xserver/hw/xfree86/dri/Makefile.in b/xserver/hw/xfree86/dri/Makefile.in index 475e9046c..474436c1c 100644 --- a/xserver/hw/xfree86/dri/Makefile.in +++ b/xserver/hw/xfree86/dri/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -73,46 +73,14 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/version-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)$(libdri_ladir)" "$(DESTDIR)$(sdkdir)" -LTLIBRARIES = $(libdri_la_LTLIBRARIES) +LTLIBRARIES = $(noinst_LTLIBRARIES) libdri_la_LIBADD = -am_libdri_la_OBJECTS = libdri_la-dri.lo libdri_la-drimodule.lo \ - libdri_la-xf86dri.lo +am_libdri_la_OBJECTS = dri.lo xf86dri.lo libdri_la_OBJECTS = $(am_libdri_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 = -libdri_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libdri_la_CFLAGS) \ - $(CFLAGS) $(libdri_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 @@ -154,6 +122,34 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +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)$(sdkdir)" HEADERS = $(sdk_HEADERS) ETAGS = etags CTAGS = ctags @@ -215,13 +211,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -243,6 +235,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,6 +260,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -381,6 +375,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -480,27 +475,22 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -libdri_la_LTLIBRARIES = libdri.la -libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \ - -I$(top_srcdir)/hw/xfree86/os-support \ - -I$(top_srcdir)/hw/xfree86/modes \ - -I$(top_srcdir)/hw/xfree86/ddc \ - -I$(top_srcdir)/hw/xfree86/i2c \ - -I$(top_srcdir)/hw/xfree86/parser \ - -I$(top_srcdir)/hw/xfree86/ramdac \ - -I$(top_srcdir)/hw/xfree86/os-support/bus \ - -I$(top_srcdir)/glx \ - -DHAVE_XORG_CONFIG_H \ - @DIX_CFLAGS@ @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ \ - @LIBDRM_CFLAGS@ \ - @DRI_CFLAGS@ - -libdri_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ -libdri_ladir = $(moduledir)/extensions +noinst_LTLIBRARIES = libdri.la +AM_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \ + -I$(top_srcdir)/hw/xfree86/os-support \ + -I$(top_srcdir)/hw/xfree86/modes \ + -I$(top_srcdir)/hw/xfree86/ddc \ + -I$(top_srcdir)/hw/xfree86/i2c \ + -I$(top_srcdir)/hw/xfree86/parser \ + -I$(top_srcdir)/hw/xfree86/ramdac \ + -I$(top_srcdir)/hw/xfree86/os-support/bus \ + -I$(top_srcdir)/glx \ + -DHAVE_XORG_CONFIG_H \ + @DIX_CFLAGS@ @XORG_CFLAGS@ + libdri_la_SOURCES = \ dri.c \ dri.h \ - drimodule.c \ dristruct.h \ sarea.h \ xf86dri.c @@ -540,33 +530,10 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -install-libdri_laLTLIBRARIES: $(libdri_la_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(libdri_la_LTLIBRARIES)'; test -n "$(libdri_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)$(libdri_ladir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libdri_ladir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdri_ladir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdri_ladir)"; \ - } -uninstall-libdri_laLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(libdri_la_LTLIBRARIES)'; test -n "$(libdri_ladir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdri_ladir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdri_ladir)/$$f"; \ - done - -clean-libdri_laLTLIBRARIES: - -test -z "$(libdri_la_LTLIBRARIES)" || rm -f $(libdri_la_LTLIBRARIES) - @list='$(libdri_la_LTLIBRARIES)'; \ +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ @@ -575,7 +542,7 @@ clean-libdri_laLTLIBRARIES: rm -f $${locs}; \ } libdri.la: $(libdri_la_OBJECTS) $(libdri_la_DEPENDENCIES) $(EXTRA_libdri_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdri_la_LINK) -rpath $(libdri_ladir) $(libdri_la_OBJECTS) $(libdri_la_LIBADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(libdri_la_OBJECTS) $(libdri_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -583,9 +550,8 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdri_la-dri.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdri_la-drimodule.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdri_la-xf86dri.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86dri.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -608,27 +574,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -libdri_la-dri.lo: dri.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri_la_CFLAGS) $(CFLAGS) -MT libdri_la-dri.lo -MD -MP -MF $(DEPDIR)/libdri_la-dri.Tpo -c -o libdri_la-dri.lo `test -f 'dri.c' || echo '$(srcdir)/'`dri.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdri_la-dri.Tpo $(DEPDIR)/libdri_la-dri.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dri.c' object='libdri_la-dri.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri_la_CFLAGS) $(CFLAGS) -c -o libdri_la-dri.lo `test -f 'dri.c' || echo '$(srcdir)/'`dri.c - -libdri_la-drimodule.lo: drimodule.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri_la_CFLAGS) $(CFLAGS) -MT libdri_la-drimodule.lo -MD -MP -MF $(DEPDIR)/libdri_la-drimodule.Tpo -c -o libdri_la-drimodule.lo `test -f 'drimodule.c' || echo '$(srcdir)/'`drimodule.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdri_la-drimodule.Tpo $(DEPDIR)/libdri_la-drimodule.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='drimodule.c' object='libdri_la-drimodule.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri_la_CFLAGS) $(CFLAGS) -c -o libdri_la-drimodule.lo `test -f 'drimodule.c' || echo '$(srcdir)/'`drimodule.c - -libdri_la-xf86dri.lo: xf86dri.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri_la_CFLAGS) $(CFLAGS) -MT libdri_la-xf86dri.lo -MD -MP -MF $(DEPDIR)/libdri_la-xf86dri.Tpo -c -o libdri_la-xf86dri.lo `test -f 'xf86dri.c' || echo '$(srcdir)/'`xf86dri.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdri_la-xf86dri.Tpo $(DEPDIR)/libdri_la-xf86dri.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xf86dri.c' object='libdri_la-xf86dri.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri_la_CFLAGS) $(CFLAGS) -c -o libdri_la-xf86dri.lo `test -f 'xf86dri.c' || echo '$(srcdir)/'`xf86dri.c - mostlyclean-libtool: -rm -f *.lo @@ -756,7 +701,7 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(libdri_ladir)" "$(DESTDIR)$(sdkdir)"; do \ + for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -791,7 +736,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libdri_laLTLIBRARIES clean-libtool \ +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am @@ -812,7 +757,7 @@ info: info-am info-am: -install-data-am: install-libdri_laLTLIBRARIES install-sdkHEADERS +install-data-am: install-sdkHEADERS install-dvi: install-dvi-am @@ -858,25 +803,23 @@ ps: ps-am ps-am: -uninstall-am: uninstall-libdri_laLTLIBRARIES uninstall-sdkHEADERS +uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libdri_laLTLIBRARIES clean-libtool cscopelist ctags \ + clean-libtool clean-noinstLTLIBRARIES 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-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-libdri_laLTLIBRARIES install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-sdkHEADERS 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-libdri_laLTLIBRARIES \ - uninstall-sdkHEADERS + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-sdkHEADERS 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-sdkHEADERS # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/xserver/hw/xfree86/dri/dri.c b/xserver/hw/xfree86/dri/dri.c index 13b3fd884..f0cfaf82b 100644 --- a/xserver/hw/xfree86/dri/dri.c +++ b/xserver/hw/xfree86/dri/dri.c @@ -51,6 +51,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" +#include "extinit.h" #include "colormapst.h" #include "cursorstr.h" #include "scrnintstr.h" @@ -68,6 +69,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xf86_OSproc.h" #include "inputstr.h" #include "xf86VGAarbiter.h" +#include "xf86Extensions.h" static int DRIEntPrivIndex = -1; static DevPrivateKeyRec DRIScreenPrivKeyRec; @@ -315,7 +317,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) int reserved_count; int i; DRIEntPrivPtr pDRIEntPriv; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); DRIContextFlags flags = 0; DRIContextPrivPtr pDRIContextPriv; @@ -597,7 +599,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) pScreen->ClipNotify = pDRIInfo->wrap.ClipNotify; } if (pDRIInfo->wrap.AdjustFrame) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; pScrn->AdjustFrame = pDRIInfo->wrap.AdjustFrame; @@ -616,7 +618,7 @@ DRICloseScreen(ScreenPtr pScreen) DRIInfoPtr pDRIInfo; drm_context_t *reserved; int reserved_count; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); DRIEntPrivPtr pDRIEntPriv = DRI_ENT_PRIV(pScrn); Bool closeMaster; @@ -654,7 +656,7 @@ DRICloseScreen(ScreenPtr pScreen) pDRIPriv->wrap.ClipNotify = NULL; } if (pDRIInfo->wrap.AdjustFrame) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; pDRIPriv->wrap.AdjustFrame = NULL; @@ -764,6 +766,8 @@ DRIExtensionInit(void) RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL); + drmSetServerInfo(&DRIDRMServerInfo); + return TRUE; } @@ -1593,7 +1597,7 @@ DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask) DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv && pDRIPriv->pDriverInfo->wrap.WakeupHandler) - (*pDRIPriv->pDriverInfo->wrap.WakeupHandler) (i, wakeupData, + (*pDRIPriv->pDriverInfo->wrap.WakeupHandler) (pScreen, result, pReadmask); } } @@ -1608,16 +1612,15 @@ DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv && pDRIPriv->pDriverInfo->wrap.BlockHandler) - (*pDRIPriv->pDriverInfo->wrap.BlockHandler) (i, blockData, + (*pDRIPriv->pDriverInfo->wrap.BlockHandler) (pScreen, pTimeout, pReadmask); } } void -DRIDoWakeupHandler(int screenNum, pointer wakeupData, +DRIDoWakeupHandler(ScreenPtr pScreen, unsigned long result, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[screenNum]; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRILock(pScreen, 0); @@ -1633,10 +1636,9 @@ DRIDoWakeupHandler(int screenNum, pointer wakeupData, } void -DRIDoBlockHandler(int screenNum, pointer blockData, +DRIDoBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[screenNum]; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { @@ -2282,15 +2284,14 @@ _DRIAdjustFrame(ScrnInfoPtr pScrn, DRIScreenPrivPtr pDRIPriv, int x, int y) } void -DRIAdjustFrame(int scrnIndex, int x, int y, int flags) +DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { - ScreenPtr pScreen = screenInfo.screens[scrnIndex]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; int px, py; if (!pDRIPriv || !pDRIPriv->pSAREA) { - DRIDrvMsg(scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n", + DRIDrvMsg(pScrn->scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n", pDRIPriv, pDRIPriv ? pDRIPriv->pSAREA : NULL); return; } @@ -2322,7 +2323,7 @@ DRIAdjustFrame(int scrnIndex, int x, int y, int flags) /* unwrap */ pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; /* call lower layers */ - (*pScrn->AdjustFrame) (scrnIndex, x, y, flags); + (*pScrn->AdjustFrame) (pScrn, x, y); /* rewrap */ pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; pScrn->AdjustFrame = DRIAdjustFrame; diff --git a/xserver/hw/xfree86/dri/dri.h b/xserver/hw/xfree86/dri/dri.h index 53458bb4a..3606100b8 100644 --- a/xserver/hw/xfree86/dri/dri.h +++ b/xserver/hw/xfree86/dri/dri.h @@ -73,7 +73,7 @@ typedef int DRIWindowRequests; #define DRI_ALL_WINDOWS 2 typedef void (*ClipNotifyPtr) (WindowPtr, int, int); -typedef void (*AdjustFramePtr) (int scrnIndex, int x, int y, int flags); +typedef void (*AdjustFramePtr) (ScrnInfoPtr pScrn, int x, int y); /* * These functions can be wrapped by the DRI. Each of these have @@ -197,7 +197,7 @@ extern _X_EXPORT Bool DRIScreenInit(ScreenPtr pScreen, extern _X_EXPORT void DRICloseScreen(ScreenPtr pScreen); -extern _X_EXPORT Bool DRIExtensionInit(void); +extern Bool DRIExtensionInit(void); extern _X_EXPORT void DRIReset(void); @@ -271,13 +271,11 @@ extern _X_EXPORT void DRIWakeupHandler(pointer wakeupData, extern _X_EXPORT void DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask); -extern _X_EXPORT void DRIDoWakeupHandler(int screenNum, - pointer wakeupData, +extern _X_EXPORT void DRIDoWakeupHandler(ScreenPtr pScreen, unsigned long result, pointer pReadmask); -extern _X_EXPORT void DRIDoBlockHandler(int screenNum, - pointer blockData, +extern _X_EXPORT void DRIDoBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask); extern _X_EXPORT void DRISwapContext(int drmFD, void *oldctx, void *newctx); @@ -334,7 +332,7 @@ extern _X_EXPORT drm_context_t DRIGetContext(ScreenPtr pScreen); extern _X_EXPORT void DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion); -extern _X_EXPORT void DRIAdjustFrame(int scrnIndex, int x, int y, int flags); +extern _X_EXPORT void DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y); extern _X_EXPORT void DRIMoveBuffersHelper(ScreenPtr pScreen, int dx, @@ -343,9 +341,11 @@ extern _X_EXPORT void DRIMoveBuffersHelper(ScreenPtr pScreen, extern _X_EXPORT char *DRICreatePCIBusID(const struct pci_device *PciInfo); +#if 0 extern _X_EXPORT int drmInstallSIGIOHandler(int fd, void (*f) (int, void *, void *)); extern _X_EXPORT int drmRemoveSIGIOHandler(int fd); +#endif extern _X_EXPORT int DRIMasterFD(ScrnInfoPtr pScrn); extern _X_EXPORT void *DRIMasterSareaPointer(ScrnInfoPtr pScrn); diff --git a/xserver/hw/xfree86/dri/drimodule.c b/xserver/hw/xfree86/dri/drimodule.c deleted file mode 100644 index 83eca4eb9..000000000 --- a/xserver/hw/xfree86/dri/drimodule.c +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************** - -Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, 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 PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Rickard E. Faith <faith@precisioninsight.com> - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86Module.h" -#include "globals.h" - -#include "xf86drm.h" -static MODULESETUPPROTO(driSetup); - -drmServerInfo DRIDRMServerInfo; - -static XF86ModuleVersionInfo VersRec = { - "dri", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_EXTENSION, - ABI_EXTENSION_VERSION, - MOD_CLASS_NONE, - {0, 0, 0, 0} -}; - -extern void XFree86DRIExtensionInit(INITARGS); - -#define _XF86DRI_SERVER_ -#include <X11/dri/xf86driproto.h> - -static ExtensionModule XF86DRIExt = { - XFree86DRIExtensionInit, - XF86DRINAME, - &noXFree86DRIExtension, - NULL, - NULL -}; - -_X_EXPORT XF86ModuleData driModuleData = { &VersRec, driSetup, NULL }; - -static pointer -driSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - static Bool setupDone = FALSE; - - if (!setupDone) { - setupDone = TRUE; - LoadExtension(&XF86DRIExt, FALSE); - } - else { - if (errmaj) - *errmaj = LDR_ONCEONLY; - } - - drmSetServerInfo(&DRIDRMServerInfo); - - /* Need a non-NULL return value to indicate success */ - return (pointer) 1; -} diff --git a/xserver/hw/xfree86/dri/xf86dri.c b/xserver/hw/xfree86/dri/xf86dri.c index 72ce8690d..ba74bb04f 100644 --- a/xserver/hw/xfree86/dri/xf86dri.c +++ b/xserver/hw/xfree86/dri/xf86dri.c @@ -47,6 +47,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" +#include "extinit.h" #include "colormapst.h" #include "cursorstr.h" #include "scrnintstr.h" @@ -60,17 +61,17 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "dristruct.h" #include "xf86drm.h" #include "protocol-versions.h" +#include "xf86Extensions.h" static int DRIErrorBase; -static void XF86DRIResetProc(ExtensionEntry * extEntry); +static void XF86DRIResetProc(ExtensionEntry *extEntry); static unsigned char DRIReqCode = 0; -extern void XFree86DRIExtensionInit(void); - - /*ARGSUSED*/ static void -XF86DRIResetProc(ExtensionEntry * extEntry) +/*ARGSUSED*/ +static void +XF86DRIResetProc(ExtensionEntry *extEntry) { DRIReset(); } @@ -78,15 +79,16 @@ XF86DRIResetProc(ExtensionEntry * extEntry) static int ProcXF86DRIQueryVersion(register ClientPtr client) { - xXF86DRIQueryVersionReply rep; + xXF86DRIQueryVersionReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .majorVersion = SERVER_XF86DRI_MAJOR_VERSION, + .minorVersion = SERVER_XF86DRI_MINOR_VERSION, + .patchVersion = SERVER_XF86DRI_PATCH_VERSION + }; REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION; - rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION; - rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -94,7 +96,7 @@ ProcXF86DRIQueryVersion(register ClientPtr client) swaps(&rep.minorVersion); swapl(&rep.patchVersion); } - WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), &rep); return Success; } @@ -111,18 +113,20 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen], &isCapable)) { return BadValue; } - rep.isCapable = isCapable; if (!LocalClient(client) || client->swapped) - rep.isCapable = 0; + isCapable = 0; + + rep = (xXF86DRIQueryDirectRenderingCapableReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .isCapable = isCapable + }; if (client->swapped) { swaps(&rep.sequenceNumber); @@ -131,7 +135,7 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client) WriteToClient(client, sizeof(xXF86DRIQueryDirectRenderingCapableReply), - (char *) &rep); + &rep); return Success; } @@ -141,6 +145,7 @@ ProcXF86DRIOpenConnection(register ClientPtr client) xXF86DRIOpenConnectionReply rep; drm_handle_t hSAREA; char *busIdString; + CARD32 busIdStringLength = 0; REQUEST(xXF86DRIOpenConnectionReq); REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq); @@ -154,33 +159,40 @@ ProcXF86DRIOpenConnection(register ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.busIdStringLength = 0; if (busIdString) - rep.busIdStringLength = strlen(busIdString); - rep.length = - bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) - - SIZEOF(xGenericReply) + - pad_to_int32(rep.busIdStringLength)); + busIdStringLength = strlen(busIdString); - rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff); + rep = (xXF86DRIOpenConnectionReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) - + SIZEOF(xGenericReply) + + pad_to_int32(busIdStringLength)), + .busIdStringLength = busIdStringLength, + + .hSAREALow = (CARD32) (hSAREA & 0xffffffff), #if defined(LONG64) && !defined(__linux__) - rep.hSAREAHigh = (CARD32) (hSAREA >> 32); + .hSAREAHigh = (CARD32) (hSAREA >> 32), #else - rep.hSAREAHigh = 0; + .hSAREAHigh = 0 #endif + }; - WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *) &rep); - if (rep.busIdStringLength) - WriteToClient(client, rep.busIdStringLength, busIdString); + WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep); + if (busIdStringLength) + WriteToClient(client, busIdStringLength, busIdString); return Success; } static int ProcXF86DRIAuthConnection(register ClientPtr client) { - xXF86DRIAuthConnectionReply rep; + xXF86DRIAuthConnectionReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .authenticated = 1 + }; REQUEST(xXF86DRIAuthConnectionReq); REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq); @@ -189,16 +201,11 @@ ProcXF86DRIAuthConnection(register ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.authenticated = 1; - if (!DRIAuthConnection(screenInfo.screens[stuff->screen], stuff->magic)) { ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic); rep.authenticated = 0; } - WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), &rep); return Success; } @@ -220,7 +227,11 @@ ProcXF86DRICloseConnection(register ClientPtr client) static int ProcXF86DRIGetClientDriverName(register ClientPtr client) { - xXF86DRIGetClientDriverNameReply rep; + xXF86DRIGetClientDriverNameReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .clientDriverNameLength = 0 + }; char *clientDriverName; REQUEST(xXF86DRIGetClientDriverNameReq); @@ -236,17 +247,13 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client) (int *) &rep.ddxDriverPatchVersion, &clientDriverName); - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.clientDriverNameLength = 0; if (clientDriverName) rep.clientDriverNameLength = strlen(clientDriverName); rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) - SIZEOF(xGenericReply) + pad_to_int32(rep.clientDriverNameLength)); - WriteToClient(client, - sizeof(xXF86DRIGetClientDriverNameReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRIGetClientDriverNameReply), &rep); if (rep.clientDriverNameLength) WriteToClient(client, rep.clientDriverNameLength, clientDriverName); return Success; @@ -255,7 +262,11 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client) static int ProcXF86DRICreateContext(register ClientPtr client) { - xXF86DRICreateContextReply rep; + xXF86DRICreateContextReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; ScreenPtr pScreen; REQUEST(xXF86DRICreateContextReq); @@ -265,10 +276,6 @@ ProcXF86DRICreateContext(register ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - pScreen = screenInfo.screens[stuff->screen]; if (!DRICreateContext(pScreen, @@ -277,7 +284,7 @@ ProcXF86DRICreateContext(register ClientPtr client) return BadValue; } - WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRICreateContextReply), &rep); return Success; } @@ -301,7 +308,11 @@ ProcXF86DRIDestroyContext(register ClientPtr client) static int ProcXF86DRICreateDrawable(ClientPtr client) { - xXF86DRICreateDrawableReply rep; + xXF86DRICreateDrawableReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; DrawablePtr pDrawable; int rc; @@ -312,10 +323,6 @@ ProcXF86DRICreateDrawable(ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, DixReadAccess); if (rc != Success) @@ -326,7 +333,7 @@ ProcXF86DRICreateDrawable(ClientPtr client) return BadValue; } - WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), &rep); return Success; } @@ -360,7 +367,11 @@ ProcXF86DRIDestroyDrawable(register ClientPtr client) static int ProcXF86DRIGetDrawableInfo(register ClientPtr client) { - xXF86DRIGetDrawableInfoReply rep; + xXF86DRIGetDrawableInfoReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; DrawablePtr pDrawable; int X, Y, W, H; drm_clip_rect_t *pClipRects, *pClippedRects; @@ -374,10 +385,6 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, DixReadAccess); if (rc != Success) @@ -444,19 +451,19 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client) rep.length = bytes_to_int32(rep.length); - WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), &rep); if (rep.numClipRects) { WriteToClient(client, sizeof(drm_clip_rect_t) * rep.numClipRects, - (char *) pClippedRects); + pClippedRects); free(pClippedRects); } if (rep.numBackClipRects) { WriteToClient(client, sizeof(drm_clip_rect_t) * rep.numBackClipRects, - (char *) pBackClipRects); + pBackClipRects); } return Success; @@ -465,7 +472,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client) static int ProcXF86DRIGetDeviceInfo(register ClientPtr client) { - xXF86DRIGetDeviceInfoReply rep; + xXF86DRIGetDeviceInfoReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; drm_handle_t hFrameBuffer; void *pDevPrivate; @@ -476,10 +487,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - if (!DRIGetDeviceInfo(screenInfo.screens[stuff->screen], &hFrameBuffer, (int *) &rep.framebufferOrigin, @@ -496,16 +503,15 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client) rep.hFrameBufferHigh = 0; #endif - rep.length = 0; if (rep.devPrivateSize) { rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) - SIZEOF(xGenericReply) + pad_to_int32(rep.devPrivateSize)); } - WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), &rep); if (rep.length) { - WriteToClient(client, rep.devPrivateSize, (char *) pDevPrivate); + WriteToClient(client, rep.devPrivateSize, pDevPrivate); } return Success; } diff --git a/xserver/hw/xfree86/dri2/Makefile.am b/xserver/hw/xfree86/dri2/Makefile.am index c9fdde2f8..502a2ee29 100644 --- a/xserver/hw/xfree86/dri2/Makefile.am +++ b/xserver/hw/xfree86/dri2/Makefile.am @@ -1,16 +1,14 @@ -libdri2_la_LTLIBRARIES = libdri2.la -libdri2_la_CFLAGS = \ +noinst_LTLIBRARIES = libdri2.la +AM_CFLAGS = \ -DHAVE_XORG_CONFIG_H \ - @DRI_CFLAGS@ \ - @DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \ + @DIX_CFLAGS@ @XORG_CFLAGS@ \ -I$(top_srcdir)/hw/xfree86/common \ -I$(top_srcdir)/hw/xfree86/os-support/bus -libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ -libdri2_ladir = $(moduledir)/extensions libdri2_la_SOURCES = \ dri2.c \ dri2.h \ - dri2ext.c + dri2ext.c \ + dri2int.h sdk_HEADERS = dri2.h diff --git a/xserver/hw/xfree86/dri2/Makefile.in b/xserver/hw/xfree86/dri2/Makefile.in index c714dedfd..758d63b31 100644 --- a/xserver/hw/xfree86/dri2/Makefile.in +++ b/xserver/hw/xfree86/dri2/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -73,45 +73,14 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/version-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)$(libdri2_ladir)" "$(DESTDIR)$(sdkdir)" -LTLIBRARIES = $(libdri2_la_LTLIBRARIES) +LTLIBRARIES = $(noinst_LTLIBRARIES) libdri2_la_LIBADD = -am_libdri2_la_OBJECTS = libdri2_la-dri2.lo libdri2_la-dri2ext.lo +am_libdri2_la_OBJECTS = dri2.lo dri2ext.lo libdri2_la_OBJECTS = $(am_libdri2_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 = -libdri2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libdri2_la_CFLAGS) \ - $(CFLAGS) $(libdri2_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 @@ -153,6 +122,34 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +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)$(sdkdir)" HEADERS = $(sdk_HEADERS) ETAGS = etags CTAGS = ctags @@ -214,13 +211,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -242,6 +235,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -266,6 +260,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -380,6 +375,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -479,20 +475,18 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -libdri2_la_LTLIBRARIES = libdri2.la -libdri2_la_CFLAGS = \ +noinst_LTLIBRARIES = libdri2.la +AM_CFLAGS = \ -DHAVE_XORG_CONFIG_H \ - @DRI_CFLAGS@ \ - @DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \ + @DIX_CFLAGS@ @XORG_CFLAGS@ \ -I$(top_srcdir)/hw/xfree86/common \ -I$(top_srcdir)/hw/xfree86/os-support/bus -libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ -libdri2_ladir = $(moduledir)/extensions libdri2_la_SOURCES = \ dri2.c \ dri2.h \ - dri2ext.c + dri2ext.c \ + dri2int.h sdk_HEADERS = dri2.h all: all-am @@ -529,33 +523,10 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -install-libdri2_laLTLIBRARIES: $(libdri2_la_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(libdri2_la_LTLIBRARIES)'; test -n "$(libdri2_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)$(libdri2_ladir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libdri2_ladir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdri2_ladir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdri2_ladir)"; \ - } -uninstall-libdri2_laLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(libdri2_la_LTLIBRARIES)'; test -n "$(libdri2_ladir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdri2_ladir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdri2_ladir)/$$f"; \ - done - -clean-libdri2_laLTLIBRARIES: - -test -z "$(libdri2_la_LTLIBRARIES)" || rm -f $(libdri2_la_LTLIBRARIES) - @list='$(libdri2_la_LTLIBRARIES)'; \ +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ @@ -564,7 +535,7 @@ clean-libdri2_laLTLIBRARIES: rm -f $${locs}; \ } libdri2.la: $(libdri2_la_OBJECTS) $(libdri2_la_DEPENDENCIES) $(EXTRA_libdri2_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdri2_la_LINK) -rpath $(libdri2_ladir) $(libdri2_la_OBJECTS) $(libdri2_la_LIBADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(libdri2_la_OBJECTS) $(libdri2_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -572,8 +543,8 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdri2_la-dri2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdri2_la-dri2ext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri2ext.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -596,20 +567,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -libdri2_la-dri2.lo: dri2.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri2_la_CFLAGS) $(CFLAGS) -MT libdri2_la-dri2.lo -MD -MP -MF $(DEPDIR)/libdri2_la-dri2.Tpo -c -o libdri2_la-dri2.lo `test -f 'dri2.c' || echo '$(srcdir)/'`dri2.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdri2_la-dri2.Tpo $(DEPDIR)/libdri2_la-dri2.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dri2.c' object='libdri2_la-dri2.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri2_la_CFLAGS) $(CFLAGS) -c -o libdri2_la-dri2.lo `test -f 'dri2.c' || echo '$(srcdir)/'`dri2.c - -libdri2_la-dri2ext.lo: dri2ext.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri2_la_CFLAGS) $(CFLAGS) -MT libdri2_la-dri2ext.lo -MD -MP -MF $(DEPDIR)/libdri2_la-dri2ext.Tpo -c -o libdri2_la-dri2ext.lo `test -f 'dri2ext.c' || echo '$(srcdir)/'`dri2ext.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdri2_la-dri2ext.Tpo $(DEPDIR)/libdri2_la-dri2ext.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dri2ext.c' object='libdri2_la-dri2ext.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri2_la_CFLAGS) $(CFLAGS) -c -o libdri2_la-dri2ext.lo `test -f 'dri2ext.c' || echo '$(srcdir)/'`dri2ext.c - mostlyclean-libtool: -rm -f *.lo @@ -737,7 +694,7 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(libdri2_ladir)" "$(DESTDIR)$(sdkdir)"; do \ + for dir in "$(DESTDIR)$(sdkdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -772,7 +729,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libdri2_laLTLIBRARIES clean-libtool \ +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am @@ -793,7 +750,7 @@ info: info-am info-am: -install-data-am: install-libdri2_laLTLIBRARIES install-sdkHEADERS +install-data-am: install-sdkHEADERS install-dvi: install-dvi-am @@ -839,25 +796,23 @@ ps: ps-am ps-am: -uninstall-am: uninstall-libdri2_laLTLIBRARIES uninstall-sdkHEADERS +uninstall-am: uninstall-sdkHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libdri2_laLTLIBRARIES clean-libtool cscopelist ctags \ + clean-libtool clean-noinstLTLIBRARIES 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-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-libdri2_laLTLIBRARIES install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-sdkHEADERS 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-libdri2_laLTLIBRARIES \ - uninstall-sdkHEADERS + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-sdkHEADERS 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-sdkHEADERS # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/xserver/hw/xfree86/dri2/dri2.c b/xserver/hw/xfree86/dri2/dri2.c index 591ff3ace..40963c3b0 100644 --- a/xserver/hw/xfree86/dri2/dri2.c +++ b/xserver/hw/xfree86/dri2/dri2.c @@ -44,13 +44,16 @@ #include "windowstr.h" #include "dixstruct.h" #include "dri2.h" +#include "dri2int.h" #include "xf86VGAarbiter.h" - +#include "damage.h" #include "xf86.h" CARD8 dri2_major; /* version of DRI2 supported by DDX */ CARD8 dri2_minor; +uint32_t prime_id_allocate_bitmask; + static DevPrivateKeyRec dri2ScreenPrivateKeyRec; #define dri2ScreenPrivateKey (&dri2ScreenPrivateKeyRec) @@ -63,6 +66,17 @@ static DevPrivateKeyRec dri2PixmapPrivateKeyRec; #define dri2PixmapPrivateKey (&dri2PixmapPrivateKeyRec) +static DevPrivateKeyRec dri2ClientPrivateKeyRec; + +#define dri2ClientPrivateKey (&dri2ClientPrivateKeyRec) + +#define dri2ClientPrivate(_pClient) (dixLookupPrivate(&(_pClient)->devPrivates, \ + dri2ClientPrivateKey)) + +typedef struct _DRI2Client { + int prime_id; +} DRI2ClientRec, *DRI2ClientPtr; + static RESTYPE dri2DrawableRes; typedef struct _DRI2Screen *DRI2ScreenPtr; @@ -87,6 +101,9 @@ typedef struct _DRI2Drawable { int swap_limit; /* for N-buffering */ unsigned long serialNumber; Bool needInvalidate; + int prime_id; + PixmapPtr prime_slave_pixmap; + PixmapPtr redirectpixmap; } DRI2DrawableRec, *DRI2DrawablePtr; typedef struct _DRI2Screen { @@ -97,6 +114,7 @@ typedef struct _DRI2Screen { const char *deviceName; int fd; unsigned int lastSequence; + int prime_id; DRI2CreateBufferProcPtr CreateBuffer; DRI2DestroyBufferProcPtr DestroyBuffer; @@ -104,21 +122,55 @@ typedef struct _DRI2Screen { DRI2ScheduleSwapProcPtr ScheduleSwap; DRI2GetMSCProcPtr GetMSC; DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC; - DRI2AuthMagicProcPtr AuthMagic; + DRI2AuthMagic2ProcPtr AuthMagic; + DRI2AuthMagicProcPtr LegacyAuthMagic; DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify; DRI2SwapLimitValidateProcPtr SwapLimitValidate; + DRI2GetParamProcPtr GetParam; HandleExposuresProcPtr HandleExposures; ConfigNotifyProcPtr ConfigNotify; + DRI2CreateBuffer2ProcPtr CreateBuffer2; + DRI2DestroyBuffer2ProcPtr DestroyBuffer2; + DRI2CopyRegion2ProcPtr CopyRegion2; } DRI2ScreenRec; +static void +destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, int prime_id); + static DRI2ScreenPtr DRI2GetScreen(ScreenPtr pScreen) { return dixLookupPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey); } +static ScreenPtr +GetScreenPrime(ScreenPtr master, int prime_id) +{ + ScreenPtr slave; + if (prime_id == 0 || xorg_list_is_empty(&master->offload_slave_list)) { + return master; + } + xorg_list_for_each_entry(slave, &master->offload_slave_list, offload_head) { + DRI2ScreenPtr ds; + + ds = DRI2GetScreen(slave); + if (ds->prime_id == prime_id) + break; + } + if (!slave) + return master; + return slave; +} + +static DRI2ScreenPtr +DRI2GetScreenPrime(ScreenPtr master, int prime_id) +{ + ScreenPtr slave = GetScreenPrime(master, prime_id); + return DRI2GetScreen(slave); +} + static DRI2DrawablePtr DRI2GetDrawable(DrawablePtr pDraw) { @@ -185,7 +237,8 @@ DRI2AllocateDrawable(DrawablePtr pDraw) xorg_list_init(&pPriv->reference_list); pPriv->serialNumber = DRI2DrawableSerial(pDraw); pPriv->needInvalidate = FALSE; - + pPriv->redirectpixmap = NULL; + pPriv->prime_slave_pixmap = NULL; if (pDraw->type == DRAWABLE_WINDOW) { pWin = (WindowPtr) pDraw; dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv); @@ -280,10 +333,12 @@ DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id, } int -DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id, - DRI2InvalidateProcPtr invalidate, void *priv) +DRI2CreateDrawable2(ClientPtr client, DrawablePtr pDraw, XID id, + DRI2InvalidateProcPtr invalidate, void *priv, + XID *dri2_id_out) { DRI2DrawablePtr pPriv; + DRI2ClientPtr dri2_client = dri2ClientPrivate(client); XID dri2_id; int rc; @@ -293,19 +348,30 @@ DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id, if (pPriv == NULL) return BadAlloc; + pPriv->prime_id = dri2_client->prime_id; + dri2_id = FakeClientID(client->index); rc = DRI2AddDrawableRef(pPriv, id, dri2_id, invalidate, priv); if (rc != Success) return rc; + if (dri2_id_out) + *dri2_id_out = dri2_id; + return Success; } +int +DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id, + DRI2InvalidateProcPtr invalidate, void *priv) +{ + return DRI2CreateDrawable2(client, pDraw, id, invalidate, priv, NULL); +} + static int DRI2DrawableGone(pointer p, XID id) { DRI2DrawablePtr pPriv = p; - DRI2ScreenPtr ds = pPriv->dri2_screen; DRI2DrawableRefPtr ref, next; WindowPtr pWin; PixmapPtr pPixmap; @@ -343,18 +409,59 @@ DRI2DrawableGone(pointer p, XID id) dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL); } + if (pPriv->prime_slave_pixmap) { + (*pPriv->prime_slave_pixmap->master_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_slave_pixmap->master_pixmap); + (*pPriv->prime_slave_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_slave_pixmap); + } + if (pPriv->buffers != NULL) { for (i = 0; i < pPriv->bufferCount; i++) - (*ds->DestroyBuffer) (pDraw, pPriv->buffers[i]); + destroy_buffer(pDraw, pPriv->buffers[i], pPriv->prime_id); free(pPriv->buffers); } + if (pPriv->redirectpixmap) { + (*pDraw->pScreen->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); + (*pDraw->pScreen->DestroyPixmap)(pPriv->redirectpixmap); + } + free(pPriv); return Success; } +static DRI2BufferPtr +create_buffer(DrawablePtr pDraw, + unsigned int attachment, unsigned int format) +{ + ScreenPtr primeScreen; + DRI2DrawablePtr pPriv; + DRI2ScreenPtr ds; + DRI2BufferPtr buffer; + pPriv = DRI2GetDrawable(pDraw); + primeScreen = GetScreenPrime(pDraw->pScreen, pPriv->prime_id); + ds = DRI2GetScreenPrime(pDraw->pScreen, pPriv->prime_id); + if (ds->CreateBuffer2) + buffer = (*ds->CreateBuffer2)(primeScreen, pDraw, attachment, format); + else + buffer = (*ds->CreateBuffer)(pDraw, attachment, format); + return buffer; +} + +static void +destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, int prime_id) +{ + ScreenPtr primeScreen; + DRI2ScreenPtr ds; + primeScreen = GetScreenPrime(pDraw->pScreen, prime_id); + ds = DRI2GetScreen(primeScreen); + if (ds->DestroyBuffer2) + (*ds->DestroyBuffer2)(primeScreen, pDraw, buffer); + else + (*ds->DestroyBuffer)(pDraw, buffer); +} + static int find_attachment(DRI2DrawablePtr pPriv, unsigned attachment) { @@ -385,7 +492,7 @@ allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds, if ((old_buf < 0) || attachment == DRI2BufferFrontLeft || !dimensions_match || (pPriv->buffers[old_buf]->format != format)) { - *buffer = (*ds->CreateBuffer) (pDraw, attachment, format); + *buffer = create_buffer (pDraw, attachment, format); pPriv->serialNumber = DRI2DrawableSerial(pDraw); return TRUE; @@ -406,13 +513,12 @@ update_dri2_drawable_buffers(DRI2DrawablePtr pPriv, DrawablePtr pDraw, DRI2BufferPtr * buffers, int out_count, int *width, int *height) { - DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); int i; if (pPriv->buffers != NULL) { for (i = 0; i < pPriv->bufferCount; i++) { if (pPriv->buffers[i] != NULL) { - (*ds->DestroyBuffer) (pDraw, pPriv->buffers[i]); + destroy_buffer(pDraw, pPriv->buffers[i], pPriv->prime_id); } } @@ -432,8 +538,8 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, unsigned int *attachments, int count, int *out_count, int has_format) { - DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); + DRI2ScreenPtr ds; DRI2BufferPtr *buffers; int need_real_front = 0; int need_fake_front = 0; @@ -450,6 +556,8 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, return NULL; } + ds = DRI2GetScreen(pDraw->pScreen); + dimensions_match = (pDraw->width == pPriv->width) && (pDraw->height == pPriv->height) && (pPriv->serialNumber == DRI2DrawableSerial(pDraw)); @@ -554,7 +662,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, if (buffers) { for (i = 0; i < count; i++) { if (buffers[i] != NULL) - (*ds->DestroyBuffer) (pDraw, buffers[i]); + destroy_buffer(pDraw, buffers[i], 0); } free(buffers); @@ -648,11 +756,159 @@ DRI2BlockClient(ClientPtr client, DrawablePtr pDraw) pPriv->blockedOnMsc = TRUE; } +static inline PixmapPtr GetDrawablePixmap(DrawablePtr drawable) +{ + if (drawable->type == DRAWABLE_PIXMAP) + return (PixmapPtr)drawable; + else { + struct _Window *pWin = (struct _Window *)drawable; + return drawable->pScreen->GetWindowPixmap(pWin); + } +} + +/* + * A TraverseTree callback to invalidate all windows using the same + * pixmap + */ +static int +DRI2InvalidateWalk(WindowPtr pWin, pointer data) +{ + if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data) + return WT_DONTWALKCHILDREN; + DRI2InvalidateDrawable(&pWin->drawable); + return WT_WALKCHILDREN; +} + +static void +DRI2InvalidateDrawableAll(DrawablePtr pDraw) +{ + if (pDraw->type == DRAWABLE_WINDOW) { + WindowPtr pWin = (WindowPtr) pDraw; + PixmapPtr pPixmap = pDraw->pScreen->GetWindowPixmap(pWin); + + /* + * Find the top-most window using this pixmap + */ + while (pWin->parent && + pDraw->pScreen->GetWindowPixmap(pWin->parent) == pPixmap) + pWin = pWin->parent; + + /* + * Walk the sub-tree to invalidate all of the + * windows using the same pixmap + */ + TraverseTree(pWin, DRI2InvalidateWalk, pPixmap); + DRI2InvalidateDrawable(&pPixmap->drawable); + } + else + DRI2InvalidateDrawable(pDraw); +} + +DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest) +{ + DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); + PixmapPtr spix; + PixmapPtr mpix = GetDrawablePixmap(pDraw); + ScreenPtr master, slave; + Bool ret; + + master = mpix->drawable.pScreen; + + if (pDraw->type == DRAWABLE_WINDOW) { + WindowPtr pWin = (WindowPtr)pDraw; + PixmapPtr pPixmap = pDraw->pScreen->GetWindowPixmap(pWin); + + if (pDraw->pScreen->GetScreenPixmap(pDraw->pScreen) == pPixmap) { + if (pPriv->redirectpixmap && + pPriv->redirectpixmap->drawable.width == pDraw->width && + pPriv->redirectpixmap->drawable.height == pDraw->height && + pPriv->redirectpixmap->drawable.depth == pDraw->depth) { + mpix = pPriv->redirectpixmap; + } else { + if (master->ReplaceScanoutPixmap) { + mpix = (*master->CreatePixmap)(master, pDraw->width, pDraw->height, + pDraw->depth, CREATE_PIXMAP_USAGE_SHARED); + if (!mpix) + return NULL; + + ret = (*master->ReplaceScanoutPixmap)(pDraw, mpix, TRUE); + if (ret == FALSE) { + (*master->DestroyPixmap)(mpix); + return NULL; + } + pPriv->redirectpixmap = mpix; + } else + return NULL; + } + } else if (pPriv->redirectpixmap) { + (*master->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); + (*master->DestroyPixmap)(pPriv->redirectpixmap); + pPriv->redirectpixmap = NULL; + } + } + + slave = GetScreenPrime(pDraw->pScreen, pPriv->prime_id); + + /* check if the pixmap is still fine */ + if (pPriv->prime_slave_pixmap) { + if (pPriv->prime_slave_pixmap->master_pixmap == mpix) + return &pPriv->prime_slave_pixmap->drawable; + else { + (*pPriv->prime_slave_pixmap->master_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_slave_pixmap->master_pixmap); + (*slave->DestroyPixmap)(pPriv->prime_slave_pixmap); + pPriv->prime_slave_pixmap = NULL; + } + } + + spix = PixmapShareToSlave(mpix, slave); + if (!spix) + return NULL; + + pPriv->prime_slave_pixmap = spix; +#ifdef COMPOSITE + spix->screen_x = mpix->screen_x; + spix->screen_y = mpix->screen_y; +#endif + + DRI2InvalidateDrawableAll(pDraw); + return &spix->drawable; +} + +static void dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, + DRI2BufferPtr pDest, DRI2BufferPtr pSrc) +{ + DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); + DRI2ScreenPtr ds; + ScreenPtr primeScreen; + + primeScreen = GetScreenPrime(pDraw->pScreen, pPriv->prime_id); + ds = DRI2GetScreen(primeScreen); + + if (ds->CopyRegion2) + (*ds->CopyRegion2)(primeScreen, pDraw, pRegion, pDest, pSrc); + else + (*ds->CopyRegion) (pDraw, pRegion, pDest, pSrc); + + /* cause damage to the box */ + if (pPriv->prime_id) { + BoxRec box; + RegionRec region; + box.x1 = 0; + box.x2 = box.x1 + pDraw->width; + box.y1 = 0; + box.y2 = box.y1 + pDraw->height; + RegionInit(®ion, &box, 1); + RegionTranslate(®ion, pDraw->x, pDraw->y); + DamageRegionAppend(pDraw, ®ion); + DamageRegionProcessPending(pDraw); + RegionUninit(®ion); + } +} + int DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion, unsigned int dest, unsigned int src) { - DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); DRI2DrawablePtr pPriv; DRI2BufferPtr pDestBuffer, pSrcBuffer; int i; @@ -672,7 +928,7 @@ DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion, if (pSrcBuffer == NULL || pDestBuffer == NULL) return BadValue; - (*ds->CopyRegion) (pDraw, pRegion, pDestBuffer, pSrcBuffer); + dri2_copy_region(pDraw, pRegion, pDestBuffer, pSrcBuffer); return Success; } @@ -832,18 +1088,7 @@ DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable) return FALSE; } -/* - * A TraverseTree callback to invalidate all windows using the same - * pixmap - */ -static int -DRI2InvalidateWalk(WindowPtr pWin, pointer data) -{ - if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data) - return WT_DONTWALKCHILDREN; - DRI2InvalidateDrawable(&pWin->drawable); - return WT_WALKCHILDREN; -} + int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, @@ -877,7 +1122,7 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, } /* Old DDX or no swap interval, just blit */ - if (!ds->ScheduleSwap || !pPriv->swap_interval) { + if (!ds->ScheduleSwap || !pPriv->swap_interval || pPriv->prime_id) { BoxRec box; RegionRec region; @@ -889,7 +1134,7 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, pPriv->swapsPending++; - (*ds->CopyRegion) (pDraw, ®ion, pDestBuffer, pSrcBuffer); + dri2_copy_region(pDraw, ®ion, pDestBuffer, pSrcBuffer); DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE, func, data); return Success; @@ -946,26 +1191,7 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, */ *swap_target = pPriv->swap_count + pPriv->swapsPending; - if (pDraw->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) pDraw; - PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin); - - /* - * Find the top-most window using this pixmap - */ - while (pWin->parent && - pScreen->GetWindowPixmap(pWin->parent) == pPixmap) - pWin = pWin->parent; - - /* - * Walk the sub-tree to invalidate all of the - * windows using the same pixmap - */ - TraverseTree(pWin, DRI2InvalidateWalk, pPixmap); - DRI2InvalidateDrawable(&pPixmap->drawable); - } - else - DRI2InvalidateDrawable(pDraw); + DRI2InvalidateDrawableAll(pDraw); return Success; } @@ -1089,34 +1315,62 @@ DRI2HasSwapControl(ScreenPtr pScreen) } Bool -DRI2Connect(ScreenPtr pScreen, unsigned int driverType, int *fd, +DRI2Connect(ClientPtr client, ScreenPtr pScreen, + unsigned int driverType, int *fd, const char **driverName, const char **deviceName) { DRI2ScreenPtr ds; + uint32_t prime_id = DRI2DriverPrimeId(driverType); + uint32_t driver_id = driverType & 0xffff; if (!dixPrivateKeyRegistered(dri2ScreenPrivateKey)) return FALSE; - ds = DRI2GetScreen(pScreen); - if (ds == NULL || driverType >= ds->numDrivers || - !ds->driverNames[driverType]) + ds = DRI2GetScreenPrime(pScreen, prime_id); + if (ds == NULL) return FALSE; - *fd = ds->fd; - *driverName = ds->driverNames[driverType]; + if (driver_id >= ds->numDrivers || + !ds->driverNames[driver_id]) + return FALSE; + + *driverName = ds->driverNames[driver_id]; *deviceName = ds->deviceName; + *fd = ds->fd; + + if (client) { + DRI2ClientPtr dri2_client; + dri2_client = dri2ClientPrivate(client); + dri2_client->prime_id = prime_id; + } return TRUE; } -Bool -DRI2Authenticate(ScreenPtr pScreen, uint32_t magic) +static int +DRI2AuthMagic (ScreenPtr pScreen, uint32_t magic) { DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + if (ds == NULL) + return -EINVAL; - if (ds == NULL || (*ds->AuthMagic) (ds->fd, magic)) + return (*ds->LegacyAuthMagic) (ds->fd, magic); +} + +Bool +DRI2Authenticate(ClientPtr client, ScreenPtr pScreen, uint32_t magic) +{ + DRI2ScreenPtr ds; + DRI2ClientPtr dri2_client = dri2ClientPrivate(client); + ScreenPtr primescreen; + + ds = DRI2GetScreenPrime(pScreen, dri2_client->prime_id); + if (ds == NULL) return FALSE; + primescreen = GetScreenPrime(pScreen, dri2_client->prime_id); + if ((*ds->AuthMagic)(primescreen, magic)) + return FALSE; return TRUE; } @@ -1148,6 +1402,22 @@ DRI2ConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw, return Success; } +#define MAX_PRIME DRI2DriverPrimeMask +static int +get_prime_id(void) +{ + int i; + /* start at 1, prime id 0 is just normal driver */ + for (i = 1; i < MAX_PRIME; i++) { + if (prime_id_allocate_bitmask & (1 << i)) + continue; + + prime_id_allocate_bitmask |= (1 << i); + return i; + } + return -1; +} + Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) { @@ -1178,6 +1448,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) if (!dixRegisterPrivateKey(&dri2PixmapPrivateKeyRec, PRIVATE_PIXMAP, 0)) return FALSE; + if (!dixRegisterPrivateKey(&dri2ClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(DRI2ClientRec))) + return FALSE; + ds = calloc(1, sizeof *ds); if (!ds) return FALSE; @@ -1201,8 +1474,11 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) cur_minor = 1; } + if (info->version >= 8) { + ds->AuthMagic = info->AuthMagic2; + } if (info->version >= 5) { - ds->AuthMagic = info->AuthMagic; + ds->LegacyAuthMagic = info->AuthMagic; } if (info->version >= 6) { @@ -1210,16 +1486,41 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) ds->SwapLimitValidate = info->SwapLimitValidate; } + if (info->version >= 7) { + ds->GetParam = info->GetParam; + cur_minor = 4; + } + + if (info->version >= 9) { + ds->CreateBuffer2 = info->CreateBuffer2; + if (info->CreateBuffer2 && pScreen->isGPU) { + ds->prime_id = get_prime_id(); + if (ds->prime_id == -1) { + free(ds); + return FALSE; + } + } + ds->DestroyBuffer2 = info->DestroyBuffer2; + ds->CopyRegion2 = info->CopyRegion2; + } + /* * if the driver doesn't provide an AuthMagic function or the info struct - * version is too low, it relies on the old method (using libdrm) or fail + * version is too low, call through LegacyAuthMagic */ - if (!ds->AuthMagic) + if (!ds->AuthMagic) { + ds->AuthMagic = DRI2AuthMagic; + /* + * If the driver doesn't provide an AuthMagic function + * it relies on the old method (using libdrm) or fails + */ + if (!ds->LegacyAuthMagic) #ifdef WITH_LIBDRM - ds->AuthMagic = drmAuthMagic; + ds->LegacyAuthMagic = drmAuthMagic; #else - goto err_out; + goto err_out; #endif + } /* Initialize minor if needed and set to minimum provied by DDX */ if (!dri2_minor || dri2_minor > cur_minor) @@ -1272,12 +1573,13 @@ DRI2CloseScreen(ScreenPtr pScreen) pScreen->ConfigNotify = ds->ConfigNotify; + if (ds->prime_id) + prime_id_allocate_bitmask &= ~(1 << ds->prime_id); free(ds->driverNames); free(ds); dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL); } -extern ExtensionModule dri2ExtensionModule; extern Bool DRI2ModuleSetup(void); /* Called by InitExtensions() */ @@ -1291,44 +1593,47 @@ DRI2ModuleSetup(void) return TRUE; } -static pointer -DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - static Bool setupDone = FALSE; - - if (!setupDone) { - setupDone = TRUE; - LoadExtension(&dri2ExtensionModule, FALSE); - } - else { - if (errmaj) - *errmaj = LDR_ONCEONLY; - } - - return (pointer) 1; -} - -static XF86ModuleVersionInfo DRI2VersRec = { - "dri2", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 2, 0, - ABI_CLASS_EXTENSION, - ABI_EXTENSION_VERSION, - MOD_CLASS_NONE, - {0, 0, 0, 0} -}; - -_X_EXPORT XF86ModuleData dri2ModuleData = { &DRI2VersRec, DRI2Setup, NULL }; - void DRI2Version(int *major, int *minor) { if (major != NULL) - *major = DRI2VersRec.majorversion; + *major = 1; if (minor != NULL) - *minor = DRI2VersRec.minorversion; + *minor = 2; +} + +int +DRI2GetParam(ClientPtr client, + DrawablePtr drawable, + CARD64 param, + BOOL *is_param_recognized, + CARD64 *value) +{ + DRI2ScreenPtr ds = DRI2GetScreen(drawable->pScreen); + char high_byte = (param >> 24); + + switch (high_byte) { + case 0: + /* Parameter names whose high_byte is 0 are reserved for the X + * server. The server currently recognizes no parameters. + */ + goto not_recognized; + case 1: + /* Parameter names whose high byte is 1 are reserved for the DDX. */ + if (ds->GetParam) + return ds->GetParam(client, drawable, param, + is_param_recognized, value); + else + goto not_recognized; + default: + /* Other parameter names are reserved for future use. They are never + * recognized. + */ + goto not_recognized; + } + +not_recognized: + *is_param_recognized = FALSE; + return Success; } diff --git a/xserver/hw/xfree86/dri2/dri2.h b/xserver/hw/xfree86/dri2/dri2.h index 00b3668cc..1e7afddbd 100644 --- a/xserver/hw/xfree86/dri2/dri2.h +++ b/xserver/hw/xfree86/dri2/dri2.h @@ -64,6 +64,7 @@ typedef void (*DRI2CopyRegionProcPtr) (DrawablePtr pDraw, DRI2BufferPtr pSrcBuffer); typedef void (*DRI2WaitProcPtr) (WindowPtr pWin, unsigned int sequence); typedef int (*DRI2AuthMagicProcPtr) (int fd, uint32_t magic); +typedef int (*DRI2AuthMagic2ProcPtr) (ScreenPtr pScreen, uint32_t magic); /** * Schedule a buffer swap @@ -175,10 +176,36 @@ typedef void (*DRI2InvalidateProcPtr) (DrawablePtr pDraw, void *data, XID id); typedef Bool (*DRI2SwapLimitValidateProcPtr) (DrawablePtr pDraw, int swap_limit); +typedef DRI2BufferPtr(*DRI2CreateBuffer2ProcPtr) (ScreenPtr pScreen, + DrawablePtr pDraw, + unsigned int attachment, + unsigned int format); +typedef void (*DRI2DestroyBuffer2ProcPtr) (ScreenPtr pScreen, DrawablePtr pDraw, + DRI2BufferPtr buffer); + +typedef void (*DRI2CopyRegion2ProcPtr) (ScreenPtr pScreen, DrawablePtr pDraw, + RegionPtr pRegion, + DRI2BufferPtr pDestBuffer, + DRI2BufferPtr pSrcBuffer); + +/** + * \brief Get the value of a parameter. + * + * The parameter's \a value is looked up on the screen associated with + * \a pDrawable. + * + * \return \c Success or error code. + */ +typedef int (*DRI2GetParamProcPtr) (ClientPtr client, + DrawablePtr pDrawable, + CARD64 param, + BOOL *is_param_recognized, + CARD64 *value); + /** * Version of the DRI2InfoRec structure defined in this header */ -#define DRI2INFOREC_VERSION 6 +#define DRI2INFOREC_VERSION 9 typedef struct { unsigned int version; /**< Version of this struct */ @@ -211,9 +238,21 @@ typedef struct { DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify; DRI2SwapLimitValidateProcPtr SwapLimitValidate; -} DRI2InfoRec, *DRI2InfoPtr; -extern _X_EXPORT int DRI2EventBase; + /* added in version 7 */ + DRI2GetParamProcPtr GetParam; + + /* added in version 8 */ + /* AuthMagic callback which passes extra context */ + /* If this is NULL the AuthMagic callback is used */ + /* If this is non-NULL the AuthMagic callback is ignored */ + DRI2AuthMagic2ProcPtr AuthMagic2; + + /* added in version 9 */ + DRI2CreateBuffer2ProcPtr CreateBuffer2; + DRI2DestroyBuffer2ProcPtr DestroyBuffer2; + DRI2CopyRegion2ProcPtr CopyRegion2; +} DRI2InfoRec, *DRI2InfoPtr; extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info); @@ -221,13 +260,13 @@ extern _X_EXPORT void DRI2CloseScreen(ScreenPtr pScreen); extern _X_EXPORT Bool DRI2HasSwapControl(ScreenPtr pScreen); -extern _X_EXPORT Bool DRI2Connect(ScreenPtr pScreen, +extern _X_EXPORT Bool DRI2Connect(ClientPtr client, ScreenPtr pScreen, unsigned int driverType, int *fd, const char **driverName, const char **deviceName); -extern _X_EXPORT Bool DRI2Authenticate(ScreenPtr pScreen, uint32_t magic); +extern _X_EXPORT Bool DRI2Authenticate(ClientPtr client, ScreenPtr pScreen, uint32_t magic); extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, @@ -235,7 +274,12 @@ extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client, DRI2InvalidateProcPtr invalidate, void *priv); -extern _X_EXPORT void DRI2DestroyDrawable(DrawablePtr pDraw); +extern _X_EXPORT int DRI2CreateDrawable2(ClientPtr client, + DrawablePtr pDraw, + XID id, + DRI2InvalidateProcPtr invalidate, + void *priv, + XID *dri2_id_out); extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffers(DrawablePtr pDraw, int *width, @@ -308,4 +352,11 @@ extern _X_EXPORT void DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw, int frame, unsigned int tv_sec, unsigned int tv_usec); +extern _X_EXPORT int DRI2GetParam(ClientPtr client, + DrawablePtr pDrawable, + CARD64 param, + BOOL *is_param_recognized, + CARD64 *value); + +extern _X_EXPORT DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest); #endif diff --git a/xserver/hw/xfree86/dri2/dri2ext.c b/xserver/hw/xfree86/dri2/dri2ext.c index 2579a5c86..ee610c0ec 100644 --- a/xserver/hw/xfree86/dri2/dri2ext.c +++ b/xserver/hw/xfree86/dri2/dri2ext.c @@ -44,13 +44,15 @@ #include "extnsionst.h" #include "xfixes.h" #include "dri2.h" +#include "dri2int.h" #include "protocol-versions.h" -/* The only xf86 include */ +/* The only xf86 includes */ #include "xf86Module.h" +#include "xf86Extensions.h" + +static int DRI2EventBase; -static ExtensionEntry *dri2Extension; -extern Bool DRI2ModuleSetup(void); static Bool validDrawable(ClientPtr client, XID drawable, Mask access_mode, @@ -71,17 +73,18 @@ static int ProcDRI2QueryVersion(ClientPtr client) { REQUEST(xDRI2QueryVersionReq); - xDRI2QueryVersionReply rep; + xDRI2QueryVersionReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .majorVersion = dri2_major, + .minorVersion = dri2_minor + }; if (client->swapped) swaps(&stuff->length); REQUEST_SIZE_MATCH(xDRI2QueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = dri2_major; - rep.minorVersion = dri2_minor; if (client->swapped) { swaps(&rep.sequenceNumber); @@ -99,7 +102,13 @@ static int ProcDRI2Connect(ClientPtr client) { REQUEST(xDRI2ConnectReq); - xDRI2ConnectReply rep; + xDRI2ConnectReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .driverNameLength = 0, + .deviceNameLength = 0 + }; DrawablePtr pDraw; int fd, status; const char *driverName; @@ -110,13 +119,7 @@ ProcDRI2Connect(ClientPtr client) &pDraw, &status)) return status; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.driverNameLength = 0; - rep.deviceNameLength = 0; - - if (!DRI2Connect(pDraw->pScreen, + if (!DRI2Connect(client, pDraw->pScreen, stuff->driverType, &fd, &driverName, &deviceName)) goto fail; @@ -146,10 +149,12 @@ ProcDRI2Authenticate(ClientPtr client) &pDraw, &status)) return status; - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.authenticated = DRI2Authenticate(pDraw->pScreen, stuff->magic); + rep = (xDRI2AuthenticateReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .authenticated = DRI2Authenticate(client, pDraw->pScreen, stuff->magic) + }; WriteToClient(client, sizeof(xDRI2AuthenticateReply), &rep); return Success; @@ -158,11 +163,11 @@ ProcDRI2Authenticate(ClientPtr client) static void DRI2InvalidateBuffersEvent(DrawablePtr pDraw, void *priv, XID id) { - xDRI2InvalidateBuffers event; ClientPtr client = priv; - - event.type = DRI2EventBase + DRI2_InvalidateBuffers; - event.drawable = id; + xDRI2InvalidateBuffers event = { + .type = DRI2EventBase + DRI2_InvalidateBuffers, + .drawable = id + }; WriteEventsToClient(client, 1, (xEvent *) &event); } @@ -225,12 +230,14 @@ send_buffers_reply(ClientPtr client, DrawablePtr pDrawable, } } - rep.type = X_Reply; - rep.length = (count - skip) * sizeof(xDRI2Buffer) / 4; - rep.sequenceNumber = client->sequence; - rep.width = width; - rep.height = height; - rep.count = count - skip; + rep = (xDRI2GetBuffersReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = (count - skip) * sizeof(xDRI2Buffer) / 4, + .width = width, + .height = height, + .count = count - skip + }; WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep); for (i = 0; i < count; i++) { @@ -330,9 +337,11 @@ ProcDRI2CopyRegion(ClientPtr client) * that yet. */ - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; + rep = (xDRI2CopyRegionReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; WriteToClient(client, sizeof(xDRI2CopyRegionReply), &rep); @@ -356,17 +365,17 @@ static void DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc, CARD32 sbc) { - xDRI2BufferSwapComplete2 event; DrawablePtr pDrawable = data; - - event.type = DRI2EventBase + DRI2_BufferSwapComplete; - event.event_type = type; - event.drawable = pDrawable->id; - event.ust_hi = (CARD64) ust >> 32; - event.ust_lo = ust & 0xffffffff; - event.msc_hi = (CARD64) msc >> 32; - event.msc_lo = msc & 0xffffffff; - event.sbc = sbc; + xDRI2BufferSwapComplete2 event = { + .type = DRI2EventBase + DRI2_BufferSwapComplete, + .event_type = type, + .drawable = pDrawable->id, + .ust_hi = (CARD64) ust >> 32, + .ust_lo = ust & 0xffffffff, + .msc_hi = (CARD64) msc >> 32, + .msc_lo = msc & 0xffffffff, + .sbc = sbc + }; WriteEventsToClient(client, 1, (xEvent *) &event); } @@ -375,7 +384,11 @@ static int ProcDRI2SwapBuffers(ClientPtr client) { REQUEST(xDRI2SwapBuffersReq); - xDRI2SwapBuffersReply rep; + xDRI2SwapBuffersReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; DrawablePtr pDrawable; CARD64 target_msc, divisor, remainder, swap_target; int status; @@ -402,9 +415,6 @@ ProcDRI2SwapBuffers(ClientPtr client) if (status != Success) return BadDrawable; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; load_swap_reply(&rep, swap_target); WriteToClient(client, sizeof(xDRI2SwapBuffersReply), &rep); @@ -427,7 +437,11 @@ static int ProcDRI2GetMSC(ClientPtr client) { REQUEST(xDRI2GetMSCReq); - xDRI2MSCReply rep; + xDRI2MSCReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; DrawablePtr pDrawable; CARD64 ust, msc, sbc; int status; @@ -442,9 +456,6 @@ ProcDRI2GetMSC(ClientPtr client) if (status != Success) return status; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; load_msc_reply(&rep, ust, msc, sbc); WriteToClient(client, sizeof(xDRI2MSCReply), &rep); @@ -482,11 +493,12 @@ ProcDRI2WaitMSC(ClientPtr client) int ProcDRI2WaitMSCReply(ClientPtr client, CARD64 ust, CARD64 msc, CARD64 sbc) { - xDRI2MSCReply rep; + xDRI2MSCReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; load_msc_reply(&rep, ust, msc, sbc); WriteToClient(client, sizeof(xDRI2MSCReply), &rep); @@ -535,6 +547,38 @@ ProcDRI2WaitSBC(ClientPtr client) } static int +ProcDRI2GetParam(ClientPtr client) +{ + REQUEST(xDRI2GetParamReq); + xDRI2GetParamReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; + DrawablePtr pDrawable; + CARD64 value; + int status; + + REQUEST_SIZE_MATCH(xDRI2GetParamReq); + + if (!validDrawable(client, stuff->drawable, DixReadAccess, + &pDrawable, &status)) + return status; + + status = DRI2GetParam(client, pDrawable, stuff->param, + &rep.is_param_recognized, &value); + rep.value_hi = value >> 32; + rep.value_lo = value & 0xffffffff; + + if (status != Success) + return status; + + WriteToClient(client, sizeof(xDRI2GetParamReply), &rep); + + return status; +} + +static int ProcDRI2Dispatch(ClientPtr client) { REQUEST(xReq); @@ -572,6 +616,8 @@ ProcDRI2Dispatch(ClientPtr client) return ProcDRI2WaitSBC(client); case X_DRI2SwapInterval: return ProcDRI2SwapInterval(client); + case X_DRI2GetParam: + return ProcDRI2GetParam(client); default: return BadRequest; } @@ -581,7 +627,13 @@ static int SProcDRI2Connect(ClientPtr client) { REQUEST(xDRI2ConnectReq); - xDRI2ConnectReply rep; + xDRI2ConnectReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .driverNameLength = 0, + .deviceNameLength = 0 + }; /* If the client is swapped, it's not local. Talk to the hand. */ @@ -589,11 +641,9 @@ SProcDRI2Connect(ClientPtr client) if (sizeof(*stuff) / 4 != client->req_len) return BadLength; - rep.sequenceNumber = client->sequence; swaps(&rep.sequenceNumber); - rep.length = 0; - rep.driverNameLength = 0; - rep.deviceNameLength = 0; + + WriteToClient(client, sizeof(xDRI2ConnectReply), &rep); return Success; } @@ -617,11 +667,11 @@ SProcDRI2Dispatch(ClientPtr client) } } -int DRI2EventBase; - -static void +void DRI2ExtensionInit(void) { + ExtensionEntry *dri2Extension; + dri2Extension = AddExtension(DRI2_NAME, DRI2NumberEvents, DRI2NumberErrors, @@ -632,13 +682,3 @@ DRI2ExtensionInit(void) DRI2ModuleSetup(); } - -extern Bool noDRI2Extension; - -_X_HIDDEN ExtensionModule dri2ExtensionModule = { - DRI2ExtensionInit, - DRI2_NAME, - &noDRI2Extension, - NULL, - NULL -}; diff --git a/xserver/hw/xfree86/dri2/dri2int.h b/xserver/hw/xfree86/dri2/dri2int.h new file mode 100644 index 000000000..7f53eba45 --- /dev/null +++ b/xserver/hw/xfree86/dri2/dri2int.h @@ -0,0 +1,26 @@ +/* + * Copyright © 2011 Daniel Stone + * + * 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: Daniel Stone <daniel@fooishbar.org> + */ + +extern Bool DRI2ModuleSetup(void); diff --git a/xserver/hw/xfree86/exa/Makefile.am b/xserver/hw/xfree86/exa/Makefile.am index 3ced531fa..433908411 100644 --- a/xserver/hw/xfree86/exa/Makefile.am +++ b/xserver/hw/xfree86/exa/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = man module_LTLIBRARIES = libexa.la -libexa_la_LDFLAGS = -module -avoid-version +libexa_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) INCLUDES = \ $(XORG_INCS) \ @@ -15,4 +15,4 @@ libexa_la_SOURCES = \ examodule.c libexa_la_LIBADD = \ - ../../../exa/libexa.la + ../../../exa/libexa.la $(PIXMAN_LIBS) diff --git a/xserver/hw/xfree86/exa/Makefile.in b/xserver/hw/xfree86/exa/Makefile.in index 7ff252015..34a4db2c7 100644 --- a/xserver/hw/xfree86/exa/Makefile.in +++ b/xserver/hw/xfree86/exa/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -101,7 +101,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(moduledir)" LTLIBRARIES = $(module_LTLIBRARIES) -libexa_la_DEPENDENCIES = ../../../exa/libexa.la +am__DEPENDENCIES_1 = +libexa_la_DEPENDENCIES = ../../../exa/libexa.la $(am__DEPENDENCIES_1) am_libexa_la_OBJECTS = examodule.lo libexa_la_OBJECTS = $(am_libexa_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -250,13 +251,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -278,6 +275,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -302,6 +300,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -416,6 +415,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -517,7 +517,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man module_LTLIBRARIES = libexa.la -libexa_la_LDFLAGS = -module -avoid-version +libexa_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) INCLUDES = \ $(XORG_INCS) \ -I$(srcdir)/../../../exa \ @@ -528,7 +528,7 @@ libexa_la_SOURCES = \ examodule.c libexa_la_LIBADD = \ - ../../../exa/libexa.la + ../../../exa/libexa.la $(PIXMAN_LIBS) all: all-recursive diff --git a/xserver/hw/xfree86/exa/examodule.c b/xserver/hw/xfree86/exa/examodule.c index 72cf7988d..4e809ea37 100644 --- a/xserver/hw/xfree86/exa/examodule.c +++ b/xserver/hw/xfree86/exa/examodule.c @@ -38,7 +38,7 @@ typedef struct _ExaXorgScreenPrivRec { CloseScreenProcPtr SavedCloseScreen; - EnableDisableFBAccessProcPtr SavedEnableDisableFBAccess; + xf86EnableDisableFBAccessProc *SavedEnableDisableFBAccess; OptionInfoPtr options; } ExaXorgScreenPrivRec, *ExaXorgScreenPrivPtr; @@ -70,9 +70,9 @@ static const OptionInfoRec EXAOptions[] = { }; static Bool -exaXorgCloseScreen(int i, ScreenPtr pScreen) +exaXorgCloseScreen(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey); @@ -83,24 +83,24 @@ exaXorgCloseScreen(int i, ScreenPtr pScreen) free(pScreenPriv->options); free(pScreenPriv); - return pScreen->CloseScreen(i, pScreen); + return pScreen->CloseScreen(pScreen); } static void -exaXorgEnableDisableFBAccess(int index, Bool enable) +exaXorgEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey); if (!enable) - exaEnableDisableFBAccess(index, enable); + exaEnableDisableFBAccess(pScreen, enable); if (pScreenPriv->SavedEnableDisableFBAccess) - pScreenPriv->SavedEnableDisableFBAccess(index, enable); + pScreenPriv->SavedEnableDisableFBAccess(pScrn, enable); if (enable) - exaEnableDisableFBAccess(index, enable); + exaEnableDisableFBAccess(pScreen, enable); } /** @@ -111,8 +111,7 @@ void exaDDXDriverInit(ScreenPtr pScreen) { ExaScreenPriv(pScreen); - /* Do NOT use XF86SCRNINFO macro here!! */ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ExaXorgScreenPrivPtr pScreenPriv; if (!dixRegisterPrivateKey(&exaXorgScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) diff --git a/xserver/hw/xfree86/exa/man/Makefile.in b/xserver/hw/xfree86/exa/man/Makefile.in index d1064b52f..b15695780 100644 --- a/xserver/hw/xfree86/exa/man/Makefile.in +++ b/xserver/hw/xfree86/exa/man/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -179,13 +179,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -207,6 +203,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -231,6 +228,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -361,6 +359,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/exa/man/exa.man b/xserver/hw/xfree86/exa/man/exa.man index 30d01824d..42a8de31d 100644 --- a/xserver/hw/xfree86/exa/man/exa.man +++ b/xserver/hw/xfree86/exa/man/exa.man @@ -14,7 +14,7 @@ The .B EXA architecture is designed to make accelerating the Render extension simple and efficient, and results in various performance tradeoffs compared to XAA. Some -__xconfigfile__ options are available for debugging performance issues or +xorg.conf options are available for debugging performance issues or driver rendering problems. They are not intended for general use. .TP .BI "Option \*qEXANoComposite\*q \*q" boolean \*q @@ -36,7 +36,7 @@ default is intended to be the best performing one for general use, though others may help with specific use cases. Available options include \*qalways\*q, \*qgreedy\*q, and \*qsmart\*q. Default: always. .SH "SEE ALSO" -.BR __xservername__ (__appmansuffix__), -.BR __xconfigfile__(__filemansuffix__). +.BR Xorg (__appmansuffix__), +.BR xorg.conf(__filemansuffix__). .SH AUTHORS Authors include: Keith Packard, Eric Anholt, Zack Rusin, and Michel D\(:anzer diff --git a/xserver/hw/xfree86/fbdevhw/Makefile.am b/xserver/hw/xfree86/fbdevhw/Makefile.am index 4472acd91..1fa9321cb 100644 --- a/xserver/hw/xfree86/fbdevhw/Makefile.am +++ b/xserver/hw/xfree86/fbdevhw/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = man module_LTLIBRARIES = libfbdevhw.la -libfbdevhw_la_LDFLAGS = -module -avoid-version +libfbdevhw_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) if FBDEVHW libfbdevhw_la_SOURCES = fbdevhw.c diff --git a/xserver/hw/xfree86/fbdevhw/Makefile.in b/xserver/hw/xfree86/fbdevhw/Makefile.in index e0995a4eb..f275ef24b 100644 --- a/xserver/hw/xfree86/fbdevhw/Makefile.in +++ b/xserver/hw/xfree86/fbdevhw/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -254,13 +254,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -282,6 +278,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -306,6 +303,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -420,6 +418,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -521,7 +520,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man module_LTLIBRARIES = libfbdevhw.la -libfbdevhw_la_LDFLAGS = -module -avoid-version +libfbdevhw_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) @FBDEVHW_FALSE@libfbdevhw_la_SOURCES = fbdevhwstub.c @FBDEVHW_TRUE@libfbdevhw_la_SOURCES = fbdevhw.c INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c diff --git a/xserver/hw/xfree86/fbdevhw/fbdevhw.c b/xserver/hw/xfree86/fbdevhw/fbdevhw.c index 2881d7ec2..d4b5558a7 100644 --- a/xserver/hw/xfree86/fbdevhw/fbdevhw.c +++ b/xserver/hw/xfree86/fbdevhw/fbdevhw.c @@ -775,10 +775,8 @@ fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, /* these can be hooked directly into ScrnInfoRec */ ModeStatus -fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) +fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - if (!fbdevHWSetMode(pScrn, mode, TRUE)) return MODE_BAD; @@ -786,10 +784,8 @@ fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) } Bool -fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - if (!fbdevHWSetMode(pScrn, mode, FALSE)) return FALSE; @@ -797,9 +793,8 @@ fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) } void -fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags) +fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); if (x < 0 || x + fPtr->var.xres > fPtr->var.xres_virtual || @@ -809,26 +804,22 @@ fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags) fPtr->var.xoffset = x; fPtr->var.yoffset = y; if (-1 == ioctl(fPtr->fd, FBIOPAN_DISPLAY, (void *) &fPtr->var)) - xf86DrvMsgVerb(scrnIndex, X_WARNING, 5, + xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 5, "FBIOPAN_DISPLAY: %s\n", strerror(errno)); } Bool -fbdevHWEnterVT(int scrnIndex, int flags) +fbdevHWEnterVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; - fbdevHWAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + fbdevHWAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0); return TRUE; } void -fbdevHWLeaveVT(int scrnIndex, int flags) +fbdevHWLeaveVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - fbdevHWRestore(pScrn); } @@ -866,7 +857,7 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); unsigned long unblank; diff --git a/xserver/hw/xfree86/fbdevhw/fbdevhw.h b/xserver/hw/xfree86/fbdevhw/fbdevhw.h index 536987101..4984ccf89 100644 --- a/xserver/hw/xfree86/fbdevhw/fbdevhw.h +++ b/xserver/hw/xfree86/fbdevhw/fbdevhw.h @@ -44,14 +44,12 @@ extern _X_EXPORT void fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors, VisualPtr pVisual); -extern _X_EXPORT ModeStatus fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, +extern _X_EXPORT ModeStatus fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags); -extern _X_EXPORT Bool fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, - int flags); -extern _X_EXPORT void fbdevHWAdjustFrame(int scrnIndex, int x, int y, - int flags); -extern _X_EXPORT Bool fbdevHWEnterVT(int scrnIndex, int flags); -extern _X_EXPORT void fbdevHWLeaveVT(int scrnIndex, int flags); +extern _X_EXPORT Bool fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode); +extern _X_EXPORT void fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y); +extern _X_EXPORT Bool fbdevHWEnterVT(ScrnInfoPtr pScrn); +extern _X_EXPORT void fbdevHWLeaveVT(ScrnInfoPtr pScrn); extern _X_EXPORT void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags); extern _X_EXPORT Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode); diff --git a/xserver/hw/xfree86/fbdevhw/fbdevhwstub.c b/xserver/hw/xfree86/fbdevhw/fbdevhwstub.c index 6e0a470b8..7d554e60a 100644 --- a/xserver/hw/xfree86/fbdevhw/fbdevhwstub.c +++ b/xserver/hw/xfree86/fbdevhw/fbdevhwstub.c @@ -131,30 +131,30 @@ fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, } ModeStatus -fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) +fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags) { return MODE_ERROR; } Bool -fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { return FALSE; } void -fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags) +fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { } Bool -fbdevHWEnterVT(int scrnIndex, int flags) +fbdevHWEnterVT(ScrnInfoPtr pScrn) { return FALSE; } void -fbdevHWLeaveVT(int scrnIndex, int flags) +fbdevHWLeaveVT(ScrnInfoPtr pScrn) { } diff --git a/xserver/hw/xfree86/fbdevhw/man/Makefile.in b/xserver/hw/xfree86/fbdevhw/man/Makefile.in index bc85b1452..8a7837d49 100644 --- a/xserver/hw/xfree86/fbdevhw/man/Makefile.in +++ b/xserver/hw/xfree86/fbdevhw/man/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -179,13 +179,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -207,6 +203,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -231,6 +228,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -361,6 +359,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/fbdevhw/man/fbdevhw.man b/xserver/hw/xfree86/fbdevhw/man/fbdevhw.man index fe5d1e17b..fa46df08f 100644 --- a/xserver/hw/xfree86/fbdevhw/man/fbdevhw.man +++ b/xserver/hw/xfree86/fbdevhw/man/fbdevhw.man @@ -14,7 +14,7 @@ fbdev(__drivermansuffix__) is a non-accelerated driver which runs on top of the fbdevhw module. fbdevhw can be used by other drivers too, this is usually activated with `Option "UseFBDev"' in the device section. .SH "SEE ALSO" -__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), +Xorg(__appmansuffix__), xorg.conf(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__), fbdev(__drivermansuffix__) .SH AUTHORS diff --git a/xserver/hw/xfree86/i2c/Makefile.am b/xserver/hw/xfree86/i2c/Makefile.am index 0b80cc8a6..cb18db188 100644 --- a/xserver/hw/xfree86/i2c/Makefile.am +++ b/xserver/hw/xfree86/i2c/Makefile.am @@ -21,23 +21,23 @@ sdk_HEADERS = xf86i2c.h bt829.h fi1236.h msp3430.h tda8425.h tda9850.h tda9885.h # # i2c drivers # -bt829_drv_la_LDFLAGS = -module -avoid-version +bt829_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) bt829_drv_la_SOURCES = bt829.c bt829.h bt829_module.c -fi1236_drv_la_LDFLAGS = -module -avoid-version -fi1236_drv_la_SOURCES = fi1236.c fi1236.h fi1236_module.c +fi1236_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) +fi1236_drv_la_SOURCES = fi1236.c fi1236.h fi1236_module.c tda9885.c -msp3430_drv_la_LDFLAGS = -module -avoid-version +msp3430_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) msp3430_drv_la_SOURCES = msp3430.c msp3430.h msp3430_module.c -tda8425_drv_la_LDFLAGS = -module -avoid-version +tda8425_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) tda8425_drv_la_SOURCES = tda8425.c tda8425.h tda8425_module.c -tda9850_drv_la_LDFLAGS = -module -avoid-version +tda9850_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) tda9850_drv_la_SOURCES = tda9850.c tda9850.h tda9850_module.c -tda9885_drv_la_LDFLAGS = -module -avoid-version +tda9885_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) tda9885_drv_la_SOURCES = tda9885.c tda9885.h tda9885_module.c -uda1380_drv_la_LDFLAGS = -module -avoid-version +uda1380_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) uda1380_drv_la_SOURCES = uda1380.c uda1380.h uda1380_module.c diff --git a/xserver/hw/xfree86/i2c/Makefile.in b/xserver/hw/xfree86/i2c/Makefile.in index ddcf90a10..a7d43adc5 100644 --- a/xserver/hw/xfree86/i2c/Makefile.in +++ b/xserver/hw/xfree86/i2c/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -113,7 +113,7 @@ bt829_drv_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(bt829_drv_la_LDFLAGS) $(LDFLAGS) -o $@ fi1236_drv_la_LIBADD = -am_fi1236_drv_la_OBJECTS = fi1236.lo fi1236_module.lo +am_fi1236_drv_la_OBJECTS = fi1236.lo fi1236_module.lo tda9885.lo fi1236_drv_la_OBJECTS = $(am_fi1236_drv_la_OBJECTS) fi1236_drv_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -264,13 +264,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -292,6 +288,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -316,6 +313,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -430,6 +428,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -548,19 +547,19 @@ sdk_HEADERS = xf86i2c.h bt829.h fi1236.h msp3430.h tda8425.h tda9850.h tda9885.h # # i2c drivers # -bt829_drv_la_LDFLAGS = -module -avoid-version +bt829_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) bt829_drv_la_SOURCES = bt829.c bt829.h bt829_module.c -fi1236_drv_la_LDFLAGS = -module -avoid-version -fi1236_drv_la_SOURCES = fi1236.c fi1236.h fi1236_module.c -msp3430_drv_la_LDFLAGS = -module -avoid-version +fi1236_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) +fi1236_drv_la_SOURCES = fi1236.c fi1236.h fi1236_module.c tda9885.c +msp3430_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) msp3430_drv_la_SOURCES = msp3430.c msp3430.h msp3430_module.c -tda8425_drv_la_LDFLAGS = -module -avoid-version +tda8425_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) tda8425_drv_la_SOURCES = tda8425.c tda8425.h tda8425_module.c -tda9850_drv_la_LDFLAGS = -module -avoid-version +tda9850_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) tda9850_drv_la_SOURCES = tda9850.c tda9850.h tda9850_module.c -tda9885_drv_la_LDFLAGS = -module -avoid-version +tda9885_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) tda9885_drv_la_SOURCES = tda9885.c tda9885.h tda9885_module.c -uda1380_drv_la_LDFLAGS = -module -avoid-version +uda1380_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) uda1380_drv_la_SOURCES = uda1380.c uda1380.h uda1380_module.c all: all-am diff --git a/xserver/hw/xfree86/i2c/xf86i2c.c b/xserver/hw/xfree86/i2c/xf86i2c.c index 1273f4bab..2d261d4ce 100644 --- a/xserver/hw/xfree86/i2c/xf86i2c.c +++ b/xserver/hw/xfree86/i2c/xf86i2c.c @@ -709,6 +709,7 @@ xf86CreateI2CBusRec(void) if (b != NULL) { b->scrnIndex = -1; + b->pScrn = NULL; b->HoldTime = 5; /* 100 kHz bus */ b->BitTimeout = 5; b->ByteTimeout = 5; diff --git a/xserver/hw/xfree86/i2c/xf86i2c.h b/xserver/hw/xfree86/i2c/xf86i2c.h index 9a8fb21a3..e296d7d81 100644 --- a/xserver/hw/xfree86/i2c/xf86i2c.h +++ b/xserver/hw/xfree86/i2c/xf86i2c.h @@ -6,6 +6,7 @@ #define _XF86I2C_H #include "regionstr.h" +#include "xf86.h" typedef unsigned char I2CByte; typedef unsigned short I2CSlaveAddr; @@ -18,6 +19,7 @@ typedef struct _I2CDevRec *I2CDevPtr; typedef struct _I2CBusRec { char *BusName; int scrnIndex; + ScrnInfoPtr pScrn; void (*I2CUDelay) (I2CBusPtr b, int usec); diff --git a/xserver/hw/xfree86/int10/Makefile.in b/xserver/hw/xfree86/int10/Makefile.in index 6054aba50..b1763c97b 100644 --- a/xserver/hw/xfree86/int10/Makefile.in +++ b/xserver/hw/xfree86/int10/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -229,13 +229,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -257,6 +253,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -281,6 +278,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -395,6 +393,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/int10/generic.c b/xserver/hw/xfree86/int10/generic.c index 8614e0b9b..4633120fd 100644 --- a/xserver/hw/xfree86/int10/generic.c +++ b/xserver/hw/xfree86/int10/generic.c @@ -70,12 +70,12 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) void *base = 0; void *vbiosMem = 0; void *options = NULL; - int screen; legacyVGARec vga; + ScrnInfoPtr pScrn; - screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; + pScrn = xf86FindScreenForEntity(entityIndex); - options = xf86HandleInt10Options(xf86Screens[screen], entityIndex); + options = xf86HandleInt10Options(pScrn, entityIndex); if (int10skip(options)) { free(options); @@ -89,7 +89,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) pInt->mem = &genericMem; pInt->private = (pointer) xnfcalloc(1, sizeof(genericInt10Priv)); INTPriv(pInt)->alloc = (pointer) xnfcalloc(1, ALLOC_ENTRIES(getpagesize())); - pInt->scrnIndex = screen; + pInt->pScrn = pScrn; base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS); /* FIXME: Shouldn't this be a failure case? Leaving dev as NULL seems like @@ -109,7 +109,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) INTPriv(pInt)->sysMem = sysMem; if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) { - xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read int vect\n"); goto error1; } @@ -148,7 +148,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) vbiosMem = (unsigned char *) base + bios_location; err = pci_device_read_rom(rom_device, vbiosMem); if (err) { - xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (3) %s\n", + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read V_BIOS (3) %s\n", strerror(err)); goto error1; } @@ -179,7 +179,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) vbiosMem = (char *) base + V_BIOS; memset(vbiosMem, 0, 2 * V_BIOS_SIZE); if (pci_device_read_rom(pInt->dev, vbiosMem) < V_BIOS_SIZE) { - xf86DrvMsg(screen, X_WARNING, + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to retrieve all of segment 0x0C0000.\n"); } @@ -194,10 +194,10 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) vbiosMem = (unsigned char *) base + bios_location; if (xf86IsEntityPrimary(entityIndex)) { - if (int10_check_bios(screen, bios_location >> 4, vbiosMem)) + if (int10_check_bios(pScrn->scrnIndex, bios_location >> 4, vbiosMem)) done = TRUE; else - xf86DrvMsg(screen, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No legacy BIOS found -- trying PCI\n"); } if (!done) { @@ -207,7 +207,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) err = pci_device_read_rom(rom_device, vbiosMem); if (err) { - xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (5) %s\n", + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read V_BIOS (5) %s\n", strerror(err)); goto error1; } @@ -249,7 +249,6 @@ MapVRam(xf86Int10InfoPtr pInt) static void UnmapVRam(xf86Int10InfoPtr pInt) { - int screen = pInt->scrnIndex; int pagesize = getpagesize(); int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize; diff --git a/xserver/hw/xfree86/int10/helper_exec.c b/xserver/hw/xfree86/int10/helper_exec.c index 1e908778f..1c58cf7ae 100644 --- a/xserver/hw/xfree86/int10/helper_exec.c +++ b/xserver/hw/xfree86/int10/helper_exec.c @@ -125,7 +125,7 @@ run_bios_int(int num, xf86Int10InfoPtr pInt) if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ? */ if (num == 21 && X86_AH == 0x4e) { - xf86DrvMsg(pInt->scrnIndex, X_NOTICE, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_NOTICE, "Failing Find-Matching-File on non-PC" " (int 21, func 4e)\n"); X86_AX = 2; @@ -133,7 +133,7 @@ run_bios_int(int num, xf86Int10InfoPtr pInt) return 1; } else { - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "Ignoring int 0x%02x call\n", num); if (xf86GetVerbosity() > 3) { dump_registers(pInt); @@ -169,7 +169,7 @@ dump_code(xf86Int10InfoPtr pInt) int i; CARD32 lina = SEG_ADR((CARD32), X86_CS, IP); - xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n", + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n", lina); for (i = 0; i < 0x10; i++) xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i)); @@ -182,19 +182,19 @@ dump_code(xf86Int10InfoPtr pInt) void dump_registers(xf86Int10InfoPtr pInt) { - xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "EAX=0x%8.8lx, EBX=0x%8.8lx, ECX=0x%8.8lx, EDX=0x%8.8lx\n", (unsigned long) X86_EAX, (unsigned long) X86_EBX, (unsigned long) X86_ECX, (unsigned long) X86_EDX); - xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "ESP=0x%8.8lx, EBP=0x%8.8lx, ESI=0x%8.8lx, EDI=0x%8.8lx\n", (unsigned long) X86_ESP, (unsigned long) X86_EBP, (unsigned long) X86_ESI, (unsigned long) X86_EDI); - xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "CS=0x%4.4x, SS=0x%4.4x," " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n", X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS); - xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "EIP=0x%8.8lx, EFLAGS=0x%8.8lx\n", (unsigned long) X86_EIP, (unsigned long) X86_EFLAGS); } @@ -337,7 +337,7 @@ x_inb(CARD16 port) } else if (port < 0x0100) { /* Don't interfere with mainboard */ val = 0; - xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(Int10Current->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "inb 0x%4.4x\n", port); if (xf86GetVerbosity() > 3) { dump_registers(Int10Current); @@ -395,7 +395,7 @@ x_outb(CARD16 port, CARD8 val) #ifdef __NOT_YET__ } else if (port < 0x0100) { /* Don't interfere with mainboard */ - xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(Int10Current->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "outb 0x%4.4x,0x%2.2x\n", port, val); if (xf86GetVerbosity() > 3) { dump_registers(Int10Current); diff --git a/xserver/hw/xfree86/int10/helper_mem.c b/xserver/hw/xfree86/int10/helper_mem.c index 96c598a53..160c5aedf 100644 --- a/xserver/hw/xfree86/int10/helper_mem.c +++ b/xserver/hw/xfree86/int10/helper_mem.c @@ -281,7 +281,7 @@ xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt) #define CHECK_V_SEGMENT_RANGE(x) \ if (((x) << 4) < V_BIOS) { \ - xf86DrvMsg(pInt->scrnIndex, X_ERROR, \ + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, \ "V_BIOS address 0x%lx out of range\n", \ (unsigned long)(x) << 4); \ return FALSE; \ @@ -306,17 +306,17 @@ xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base) CHECK_V_SEGMENT_RANGE(cs); vbiosMem = (unsigned char *) base + (cs << 4); - if (int10_check_bios(pInt->scrnIndex, cs, vbiosMem)) { + if (int10_check_bios(pInt->pScrn->scrnIndex, cs, vbiosMem)) { break; } } if (segments[i] == ~0) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "No V_BIOS found\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "No V_BIOS found\n"); return FALSE; } - xf86DrvMsg(pInt->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n", + xf86DrvMsg(pInt->pScrn->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n", (unsigned long) cs); pInt->BIOSseg = cs; diff --git a/xserver/hw/xfree86/int10/xf86int10.c b/xserver/hw/xfree86/int10/xf86int10.c index df347d4dd..5ead44f23 100644 --- a/xserver/hw/xfree86/int10/xf86int10.c +++ b/xserver/hw/xfree86/int10/xf86int10.c @@ -57,7 +57,7 @@ int_handler(xf86Int10InfoPtr pInt) ret = run_bios_int(num, pInt); if (!ret) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Halting on int 0x%2.2x!\n", num); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Halting on int 0x%2.2x!\n", num); dump_registers(pInt); stack_trace(pInt); } @@ -257,7 +257,7 @@ int42_handler(xf86Int10InfoPtr pInt) /* DL = character column */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n", pInt->num); if (xf86GetVerbosity() > 3) { @@ -314,10 +314,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, " AL=0x%2.2x, BH=0x%2.2x," " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n", X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL); @@ -339,10 +339,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, " AL=0x%2.2x, BH=0x%2.2x," " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n", X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL); @@ -360,10 +360,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* AL = character */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at" " Cursor\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "BH=0x%2.2x\n", X86_BH); if (xf86GetVerbosity() > 3) { dump_registers(pInt); @@ -382,10 +382,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at" " Cursor\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n", X86_AL, X86_BH, X86_BL, X86_CX); if (xf86GetVerbosity() > 3) { @@ -404,10 +404,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n", X86_AL, X86_BH, X86_BL, X86_CX); if (xf86GetVerbosity() > 3) { @@ -450,10 +450,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", X86_AL, X86_BH, X86_CX, X86_DX); if (xf86GetVerbosity() > 3) { @@ -471,10 +471,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* Leave: AL = pixel value */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", X86_BH, X86_CX, X86_DX); if (xf86GetVerbosity() > 3) { @@ -498,10 +498,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* which might or might not have been */ /* installed yet. */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n", X86_AL, X86_BH, X86_BL); if (xf86GetVerbosity() > 3) { @@ -564,10 +564,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* which might or might not have been */ /* installed yet. */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x," " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n", X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP); @@ -840,7 +840,7 @@ int1A_handler(xf86Int10InfoPtr pInt) #endif return 1; default: - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x1a subfunction\n"); dump_registers(pInt); if (xf86GetVerbosity() > 3) diff --git a/xserver/hw/xfree86/int10/xf86int10.h b/xserver/hw/xfree86/int10/xf86int10.h index 36b659fd7..6d564fc1a 100644 --- a/xserver/hw/xfree86/int10/xf86int10.h +++ b/xserver/hw/xfree86/int10/xf86int10.h @@ -21,10 +21,10 @@ /* int10 info structure */ typedef struct { int entityIndex; - int scrnIndex; - pointer cpuRegs; CARD16 BIOSseg; CARD16 inb40time; + ScrnInfoPtr pScrn; + pointer cpuRegs; char *BIOSScratch; int Flags; pointer private; diff --git a/xserver/hw/xfree86/loader/Makefile.am b/xserver/hw/xfree86/loader/Makefile.am index ebe0c813a..bd47a635b 100644 --- a/xserver/hw/xfree86/loader/Makefile.am +++ b/xserver/hw/xfree86/loader/Makefile.am @@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libloader.la INCLUDES = $(XORG_INCS) -I$(srcdir)/../parser -I$(top_srcdir)/miext/cw \ -I$(srcdir)/../ddc -I$(srcdir)/../i2c -I$(srcdir)/../modes \ - -I$(srcdir)/../ramdac + -I$(srcdir)/../ramdac -I$(srcdir)/../dri -I$(srcdir)/../dri2 #AM_LDFLAGS = -r AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) @@ -14,7 +14,6 @@ EXTRA_DIST = \ libloader_la_SOURCES = \ loader.c \ loaderProcs.h \ - loadext.c \ loadmod.c \ os.c diff --git a/xserver/hw/xfree86/loader/Makefile.in b/xserver/hw/xfree86/loader/Makefile.in index ad4073fd0..f90a8d95c 100644 --- a/xserver/hw/xfree86/loader/Makefile.in +++ b/xserver/hw/xfree86/loader/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -75,7 +75,7 @@ CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = libloader_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_libloader_la_OBJECTS = loader.lo loadext.lo loadmod.lo os.lo +am_libloader_la_OBJECTS = loader.lo loadmod.lo os.lo libloader_la_OBJECTS = $(am_libloader_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -182,13 +182,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -210,6 +206,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -234,6 +231,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -348,6 +346,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -450,7 +449,7 @@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libloader.la INCLUDES = $(XORG_INCS) -I$(srcdir)/../parser -I$(top_srcdir)/miext/cw \ -I$(srcdir)/../ddc -I$(srcdir)/../i2c -I$(srcdir)/../modes \ - -I$(srcdir)/../ramdac + -I$(srcdir)/../ramdac -I$(srcdir)/../dri -I$(srcdir)/../dri2 #AM_LDFLAGS = -r @@ -462,7 +461,6 @@ EXTRA_DIST = \ libloader_la_SOURCES = \ loader.c \ loaderProcs.h \ - loadext.c \ loadmod.c \ os.c @@ -522,7 +520,6 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loader.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadext.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadmod.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os.Plo@am__quote@ diff --git a/xserver/hw/xfree86/loader/loader.c b/xserver/hw/xfree86/loader/loader.c index b72b8b89d..64c69bb8a 100644 --- a/xserver/hw/xfree86/loader/loader.c +++ b/xserver/hw/xfree86/loader/loader.c @@ -160,10 +160,16 @@ LoaderSymbol(const char *name) return NULL; } +void * +LoaderSymbolFromModule(void *handle, const char *name) +{ + return dlsym(handle, name); +} + void LoaderUnload(const char *name, void *handle) { - xf86Msg(X_INFO, "Unloading %s\n", name); + LogMessageVerbSigSafe(X_INFO, 1, "Unloading %s\n", name); if (handle) dlclose(handle); } @@ -189,13 +195,12 @@ LoaderGetABIVersion(const char *abiclass) const char *name; int version; } classes[] = { - { - ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion}, { - ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion}, { - ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion}, { - ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion}, { - ABI_CLASS_FONT, LoaderVersionInfo.fontVersion}, { - NULL, 0} + {ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion}, + {ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion}, + {ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion}, + {ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion}, + {ABI_CLASS_FONT, LoaderVersionInfo.fontVersion}, + {NULL, 0} }; int i; diff --git a/xserver/hw/xfree86/loader/loader.h b/xserver/hw/xfree86/loader/loader.h index 5cadd5ad6..c89c6410a 100644 --- a/xserver/hw/xfree86/loader/loader.h +++ b/xserver/hw/xfree86/loader/loader.h @@ -72,5 +72,6 @@ extern unsigned long LoaderOptions; /* Internal Functions */ void *LoaderOpen(const char *, int *, int *); +void *LoaderSymbolFromModule(void *, const char *); #endif /* _LOADER_H */ diff --git a/xserver/hw/xfree86/loader/loaderProcs.h b/xserver/hw/xfree86/loader/loaderProcs.h index a7b752b9a..8b4b53f28 100644 --- a/xserver/hw/xfree86/loader/loaderProcs.h +++ b/xserver/hw/xfree86/loader/loaderProcs.h @@ -80,7 +80,6 @@ ModuleDescPtr LoadModule(const char *, const char *, const char **, ModuleDescPtr DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent); void UnloadDriver(ModuleDescPtr); void LoaderSetPath(const char *path); -void LoaderSortExtensions(void); void LoaderUnload(const char *, void *); unsigned long LoaderGetModuleVersion(ModuleDescPtr mod); diff --git a/xserver/hw/xfree86/loader/loadext.c b/xserver/hw/xfree86/loader/loadext.c deleted file mode 100644 index daa1abf8d..000000000 --- a/xserver/hw/xfree86/loader/loadext.c +++ /dev/null @@ -1,440 +0,0 @@ -/* - * Copyright (c) 2000 by The XFree86 Project, 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* Maybe this file belongs elsewhere? */ - -#define LOADERDECLARATIONS -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "loaderProcs.h" -#include "misc.h" -#include "xf86.h" - -/* - * This should be static, but miinitext wants it. FIXME: make extension - * initialization not completely terrible. - */ -ExtensionModule *ExtensionModuleList = NULL; -static int numExtensionModules = 0; - -static ExtensionModule * -NewExtensionModule(void) -{ - ExtensionModule *save = ExtensionModuleList; - int n; - - /* Sanity check */ - if (!ExtensionModuleList) - numExtensionModules = 0; - - n = numExtensionModules + 1; - ExtensionModuleList = realloc(ExtensionModuleList, - (n + 1) * sizeof(ExtensionModule)); - if (ExtensionModuleList == NULL) { - ExtensionModuleList = save; - return NULL; - } - else { - numExtensionModules++; - ExtensionModuleList[numExtensionModules].name = NULL; - return ExtensionModuleList + (numExtensionModules - 1); - } -} - -void -LoadExtension(ExtensionModule * e, Bool builtin) -{ - ExtensionModule *newext; - - if (e == NULL || e->name == NULL) - return; - - if (!(newext = NewExtensionModule())) - return; - - if (builtin) - xf86MsgVerb(X_INFO, 2, "Initializing built-in extension %s\n", e->name); - else - xf86MsgVerb(X_INFO, 2, "Loading extension %s\n", e->name); - - newext->name = e->name; - newext->initFunc = e->initFunc; - newext->disablePtr = e->disablePtr; - newext->setupFunc = e->setupFunc; - newext->initDependencies = e->initDependencies; - - if (e->setupFunc != NULL) - e->setupFunc(); -} - -/* - * Sort ExtensionModuleList according to the initialisation order - * dependencies. The code for this is taken from BSD's tsort, - * and carries the following copyright/license: - * - * - * Copyright (c) 1989, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Michael Rendell of Memorial University of Newfoundland. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#define NF_MARK 0x1 /* marker for cycle detection */ -#define NF_ACYCLIC 0x2 /* this node is cycle free */ -#define NF_NODEST 0x4 /* Unreachable */ - -typedef struct node_str NODE; -struct node_str { - NODE **n_prevp; /* pointer to previous node's n_next */ - NODE *n_next; /* next node in graph */ - NODE **n_arcs; /* array of arcs to other nodes */ - int n_narcs; /* number of arcs in n_arcs[] */ - int n_arcsize; /* size of n_arcs[] array */ - int n_refcnt; /* # of arcs pointing to this node */ - int n_flags; /* NF_* */ - const char *n_name; /* name of this node */ -}; - -static NODE *graph = NULL, **cycle_buf = NULL, **longest_cycle = NULL; -static int longest = 0; -static NODE *sorted = NULL, *last = NULL; - -/* Find a node in the graph (insert if not found) and return a pointer to it. */ -static NODE * -get_node(const char *name) -{ - NODE *n; - - for (n = graph; n && n->n_name && strcmp(n->n_name, name); n = n->n_next); - if (n) - return n; - - n = xnfalloc(sizeof(NODE)); - - n->n_narcs = 0; - n->n_arcsize = 0; - n->n_arcs = NULL; - n->n_refcnt = 0; - n->n_flags = 0; - n->n_name = name; - - /* Add to linked list. */ - if ((n->n_next = graph) != NULL) - graph->n_prevp = &n->n_next; - n->n_prevp = &graph; - graph = n; - - return n; -} - -/* - * add an arc from node s1 to node s2 in the graph. If s1 or s2 are not in - * the graph, then add them. - */ -static void -add_arc(const char *s1, const char *s2) -{ - NODE *n1; - NODE *n2; - int bsize, i; - - n1 = get_node(s1); - - if (!strcmp(s1, s2)) - return; - - n2 = get_node(s2); - - /* - * Check if this arc is already here. - */ - for (i = 0; i < n1->n_narcs; i++) - if (n1->n_arcs[i] == n2) - return; - /* - * Add it. - */ - if (n1->n_narcs == n1->n_arcsize) { - if (!n1->n_arcsize) - n1->n_arcsize = 10; - bsize = n1->n_arcsize * sizeof(*n1->n_arcs) * 2; - n1->n_arcs = xnfrealloc(n1->n_arcs, bsize); - n1->n_arcsize = bsize / sizeof(*n1->n_arcs); - } - n1->n_arcs[n1->n_narcs++] = n2; - ++n2->n_refcnt; -} - -/* - * Clear the NODEST flag from all nodes. - */ -static void -clear_cycle(void) -{ - NODE *n; - - for (n = graph; n != NULL; n = n->n_next) - n->n_flags &= ~NF_NODEST; -} - -/* print node and remove from graph (does not actually free node) */ -static void -remove_node(NODE * n) -{ - NODE **np; - NODE *newnode; - int i; - -#ifdef DEBUG - ErrorF("%s\n", n->n_name); -#endif - newnode = xnfalloc(sizeof(NODE)); - memcpy(newnode, n, sizeof(NODE)); - if (last) - last->n_next = newnode; - else - sorted = newnode; - last = newnode; - newnode->n_next = NULL; - - for (np = n->n_arcs, i = n->n_narcs; --i >= 0; np++) - --(*np)->n_refcnt; - n->n_narcs = 0; - *n->n_prevp = n->n_next; - if (n->n_next) - n->n_next->n_prevp = n->n_prevp; -} - -static void -free_nodes(NODE * nodelist) -{ - NODE *n, *nextnode; - - for (n = nodelist; n;) { - nextnode = n->n_next; - free(n); - n = nextnode; - } -} - -/* look for the longest? cycle from node from to node to. */ -static int -find_cycle(NODE * from, NODE * to, int longest_len, int depth) -{ - NODE **np; - int i, len; - - /* - * avoid infinite loops and ignore portions of the graph known - * to be acyclic - */ - if (from->n_flags & (NF_NODEST | NF_MARK | NF_ACYCLIC)) - return 0; - from->n_flags |= NF_MARK; - - for (np = from->n_arcs, i = from->n_narcs; --i >= 0; np++) { - cycle_buf[depth] = *np; - if (*np == to) { - if (depth + 1 > longest_len) { - longest_len = depth + 1; - memcpy((char *) longest_cycle, - (char *) cycle_buf, longest_len * sizeof(NODE *)); - } - } - else { - if ((*np)->n_flags & (NF_MARK | NF_ACYCLIC | NF_NODEST)) - continue; - len = find_cycle(*np, to, longest_len, depth + 1); - -#ifdef DEBUG - ErrorF("%*s %s->%s %d\n", depth, "", from->n_name, to->n_name, len); -#endif - - if (len == 0) - (*np)->n_flags |= NF_NODEST; - - if (len > longest_len) - longest_len = len; - - if (len > 0 && !longest) - break; - } - } - from->n_flags &= ~NF_MARK; - return longest_len; -} - -/* do topological sort on graph */ -static void -tsort(void) -{ - NODE *n, *next; - int cnt, i; - - while (graph != NULL) { - /* - * Keep getting rid of simple cases until there are none left, - * if there are any nodes still in the graph, then there is - * a cycle in it. - */ - do { - for (cnt = 0, n = graph; n != NULL; n = next) { - next = n->n_next; - if (n->n_refcnt == 0) { - remove_node(n); - ++cnt; - } - } - } while (graph != NULL && cnt); - - if (graph == NULL) - break; - - if (!cycle_buf) { - /* - * Allocate space for two cycle logs - one to be used - * as scratch space, the other to save the longest - * cycle. - */ - for (cnt = 0, n = graph; n != NULL; n = n->n_next) - ++cnt; - cycle_buf = xnfalloc(sizeof(NODE *) * cnt); - longest_cycle = xnfalloc(sizeof(NODE *) * cnt); - if (cycle_buf == NULL || longest_cycle == NULL) - return; - } - for (n = graph; n != NULL; n = n->n_next) - if (!(n->n_flags & NF_ACYCLIC)) { - if ((cnt = find_cycle(n, n, 0, 0))) { - ErrorF("tsort: cycle in data"); - for (i = 0; i < cnt; i++) - ErrorF("%s", longest_cycle[i]->n_name); - remove_node(n); - clear_cycle(); - break; - } - else { - /* to avoid further checks */ - n->n_flags |= NF_ACYCLIC; - clear_cycle(); - } - } - - if (n == NULL) - ErrorF("tsort: internal error -- could not find cycle"); - } - free(cycle_buf); - free(longest_cycle); - if (graph) - free_nodes(graph); -} - -void -LoaderSortExtensions(void) -{ - int i, j; - ExtensionModule *ext, *newList; - NODE *node; - - graph = NULL; - longest = 0; - sorted = NULL; - last = NULL; - cycle_buf = NULL; - longest_cycle = NULL; - - /* - * Parse list and build the graph. Enter them in reverse order - * because tsort() will reverse those that have no depedencies. - */ - for (i = numExtensionModules - 1; i >= 0; i--) { - ext = &ExtensionModuleList[i]; - add_arc(ext->name, ext->name); -#ifdef DEBUG - ErrorF("Extension %s:\n", ext->name); -#endif - if (ext->initDependencies) - for (j = 0; ext->initDependencies[j]; j++) { - add_arc(ext->initDependencies[j], ext->name); -#ifdef DEBUG - ErrorF("\t%s\n", ext->initDependencies[j]); -#endif - } - } - tsort(); - newList = xnfalloc((numExtensionModules + 1) * sizeof(ExtensionModule)); - i = 0; - for (node = sorted; node; node = node->n_next) { - for (j = 0; j < numExtensionModules; j++) - if (!strcmp(node->n_name, ExtensionModuleList[j].name)) - break; - if (j != numExtensionModules) - newList[i++] = ExtensionModuleList[j]; - } - if (sorted) - free_nodes(sorted); - if (graph) - free_nodes(graph); - newList[i].name = NULL; - free(ExtensionModuleList); - ExtensionModuleList = newList; -#ifdef DEBUG - for (i = 0; ExtensionModuleList[i].name; i++) - ErrorF("Extension %s\n", ExtensionModuleList[i].name); -#endif -} diff --git a/xserver/hw/xfree86/loader/loadmod.c b/xserver/hw/xfree86/loader/loadmod.c index c6b559072..2347b8e5b 100644 --- a/xserver/hw/xfree86/loader/loadmod.c +++ b/xserver/hw/xfree86/loader/loadmod.c @@ -212,9 +212,15 @@ static const char *stdSubdirs[] = { * to port this DDX to, say, Darwin, we'll need to fix this. */ static PatternRec stdPatterns[] = { +#ifdef __CYGWIN__ + {"^cyg(.*)\\.dll$",}, + {"(.*)_drv\\.dll$",}, + {"(.*)\\.dll$",}, +#else {"^lib(.*)\\.so$",}, {"(.*)_drv\\.so$",}, {"(.*)\\.so$",}, +#endif {NULL,} }; @@ -408,21 +414,33 @@ FindModuleInSubdir(const char *dirpath, const char *module) continue; } +#ifdef __CYGWIN__ + snprintf(tmpBuf, PATH_MAX, "cyg%s.dll", module); +#else snprintf(tmpBuf, PATH_MAX, "lib%s.so", module); +#endif if (strcmp(direntry->d_name, tmpBuf) == 0) { if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1) ret = NULL; break; } +#ifdef __CYGWIN__ + snprintf(tmpBuf, PATH_MAX, "%s_drv.dll", module); +#else snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module); +#endif if (strcmp(direntry->d_name, tmpBuf) == 0) { if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1) ret = NULL; break; } +#ifdef __CYGWIN__ + snprintf(tmpBuf, PATH_MAX, "%s.dll", module); +#else snprintf(tmpBuf, PATH_MAX, "%s.so", module); +#endif if (strcmp(direntry->d_name, tmpBuf) == 0) { if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1) ret = NULL; @@ -815,6 +833,11 @@ static const char *compiled_in_modules[] = { "ddc", "i2c", "ramdac", + "dbe", + "record", + "extmod", + "dri", + "dri2", NULL }; @@ -938,7 +961,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist, *errmin = 0; goto LoadModule_fail; } - initdata = LoaderSymbol(p); + initdata = LoaderSymbolFromModule(ret->handle, p); if (initdata) { ModuleSetupProc setup; ModuleTearDownProc teardown; @@ -974,10 +997,6 @@ doLoadModule(const char *module, const char *path, const char **subdirlist, ret->VersionInfo = vers; } else { - /* No initdata is OK for external modules */ - if (options == EXTERN_MODULE) - goto LoadModule_exit; - /* no initdata, fail the load */ xf86Msg(X_ERROR, "LoadModule: Module %s does not have a %s " "data object.\n", module, p); @@ -1075,9 +1094,10 @@ UnloadModuleOrDriver(ModuleDescPtr mod) return; if (mod->parent) - xf86MsgVerb(X_INFO, 3, "UnloadSubModule: \"%s\"\n", mod->name); + LogMessageVerbSigSafe(X_INFO, 3, "UnloadSubModule: \"%s\"\n", + mod->name); else - xf86MsgVerb(X_INFO, 3, "UnloadModule: \"%s\"\n", mod->name); + LogMessageVerbSigSafe(X_INFO, 3, "UnloadModule: \"%s\"\n", mod->name); if (mod->TearDownData != ModuleDuplicated) { if ((mod->TearDownProc) && (mod->TearDownData)) diff --git a/xserver/hw/xfree86/man/Makefile.in b/xserver/hw/xfree86/man/Makefile.in index 074007c68..5901a3c26 100644 --- a/xserver/hw/xfree86/man/Makefile.in +++ b/xserver/hw/xfree86/man/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -179,13 +179,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -207,6 +203,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -231,6 +228,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -361,6 +359,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/man/Xorg.man b/xserver/hw/xfree86/man/Xorg.man index 0c469129f..a48c4e8dd 100644 --- a/xserver/hw/xfree86/man/Xorg.man +++ b/xserver/hw/xfree86/man/Xorg.man @@ -1,16 +1,16 @@ .\" $XdotOrg: xserver/xorg/hw/xfree86/doc/man/Xorg.man.pre,v 1.3 2005/07/04 18:41:01 ajax Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' -.TH __xservername__ __appmansuffix__ __vendorversion__ +.TH Xorg __appmansuffix__ __vendorversion__ .SH NAME -__xservername__ - X11R7 X server +Xorg - X11R7 X server .SH SYNOPSIS -.B __xservername__ +.B Xorg .RI [\fB:\fP display ] .RI [ option .IR ... ] .SH DESCRIPTION -.B __xservername__ +.B Xorg is a full featured X server that was originally designed for UNIX and UNIX-like operating systems running on Intel x86 hardware. It now runs on a wider range of hardware and OS platforms. @@ -24,7 +24,7 @@ by Thomas Roell which was contributed to X11R5 by Snitily Graphics Consulting Service. .SH PLATFORMS .PP -.B __xservername__ +.B Xorg operates under a wide range of operating systems and hardware platforms. The Intel x86 (IA32) architecture is the most widely supported hardware platform. Other hardware platforms include Compaq Alpha, Intel IA64, AMD64, @@ -37,7 +37,7 @@ Xquartz(__appmansuffix__) X server. Win32/Cygwin is supported with the XWin(__appmansuffix__) X server. .PP .SH "NETWORK CONNECTIONS" -.B __xservername__ +.B Xorg supports connections made using the following reliable byte-streams: .TP 4 @@ -47,7 +47,7 @@ On some System V platforms, the "local" connection types also include STREAMS pipes, named pipes, and some other mechanisms. .TP 4 .I TCP\/IP -.B __xservername__ +.B Xorg listens on port .RI 6000+ n , where @@ -108,10 +108,10 @@ file. If you use xdm(1), the definitions should be early on in the .I __projectroot__/lib/X11/xdm/Xsession script. .SH OPTIONS -.B __xservername__ +.B Xorg supports several mechanisms for supplying/obtaining configuration and run-time parameters: command line options, environment variables, the -__xconfigfile__(__filemansuffix__) configuration files, auto-detection, and +xorg.conf(__filemansuffix__) configuration files, auto-detection, and fallback defaults. When the same information is supplied in more than one way, the highest precedence mechanism is used. The list of mechanisms is ordered from highest precedence to lowest. Note that not all parameters @@ -119,21 +119,21 @@ can be supplied via all methods. The available command line options and environment variables (and some defaults) are described here and in the Xserver(__appmansuffix__) manual page. Most configuration file parameters, with their defaults, are described in the -__xconfigfile__(__filemansuffix__) manual page. Driver and module specific +xorg.conf(__filemansuffix__) manual page. Driver and module specific configuration parameters are described in the relevant driver or module manual page. .PP In addition to the normal server options described in the Xserver(__appmansuffix__) manual page, -.B __xservername__ +.B Xorg accepts the following command line switches: .TP 8 .BI vt XX .I XX specifies the Virtual Terminal device number which -.B __xservername__ +.B Xorg will use. Without this option, -.B __xservername__ +.B Xorg will pick the first available Virtual Terminal that it can locate. This option applies only to platforms that have virtual terminal support, such as Linux, BSD, OpenSolaris, SVR3, and SVR4. @@ -142,14 +142,14 @@ as Linux, BSD, OpenSolaris, SVR3, and SVR4. Allow the server to start up even if the mouse device can't be opened or initialised. This is equivalent to the .B AllowMouseOpenFail -__xconfigfile__(__filemansuffix__) file option. +xorg.conf(__filemansuffix__) file option. .TP 8 .B \-allowNonLocalXvidtune Make the VidMode extension available to remote clients. This allows the xvidtune client to connect from another host. This is equivalent to the .B AllowNonLocalXvidtune -__xconfigfile__(__filemansuffix__) file option. By default non-local +xorg.conf(__filemansuffix__) file option. By default non-local connections are not allowed. .TP 8 .BI \-bgamma " value" @@ -187,9 +187,9 @@ config directory search path for all other users. .TP 8 .B \-configure When this option is specified, the -.B __xservername__ +.B Xorg server loads all video driver modules, probes for available hardware, -and writes out an initial __xconfigfile__(__filemansuffix__) file based on +and writes out an initial xorg.conf(__filemansuffix__) file based on what was detected. This option currently has some problems on some platforms, but in most cases it is a good way to bootstrap the configuration process. This option is only available when the server @@ -209,7 +209,7 @@ Disable the parts of the VidMode extension (used by the xvidtune client) that can be used to change the video modes. This is equivalent to the .B DisableVidModeExtension -__xconfigfile__(__filemansuffix__) file option. +xorg.conf(__filemansuffix__) file option. .TP 8 .B \-fbbpp \fIn\fP Sets the number of framebuffer bits per pixel. You should only set this @@ -249,7 +249,7 @@ options. .TP 8 .B \-ignoreABI The -.B __xservername__ +.B Xorg server checks the ABI revision levels of each module that it loads. It will normally refuse to load modules with ABI revisions that are newer than the server's. This is because such modules might use interfaces @@ -284,7 +284,7 @@ This option is only useful when debugging the server. Not all platforms support (or can use) this option. .TP 8 .BI \-keyboard " keyboard-name" -Use the __xconfigfile__(__filemansuffix__) file +Use the xorg.conf(__filemansuffix__) file .B InputDevice section called .I keyboard-name @@ -296,7 +296,7 @@ section and this option, the first relevant section is used for the core keyboard. .TP 8 .BI \-layout " layout-name" -Use the __xconfigfile__(__filemansuffix__) file +Use the xorg.conf(__filemansuffix__) file .B Layout section called .IR layout-name . @@ -308,20 +308,20 @@ section is used. Use the file called .I filename as the -.B __xservername__ +.B Xorg server log file. The default log file is -.BI __logdir__/__xservername__. n .log +.BI __logdir__/Xorg. n .log on most platforms, where .I n is the display number of the -.B __xservername__ +.B Xorg server. The default may be in a different directory on some platforms. This option is only available when the server is run as root (i.e, with real-uid 0). .TP 8 .BR \-logverbose " [\fIn\fP]" Sets the verbosity level for information printed to the -.B __xservername__ +.B Xorg server log file. If the .I n value isn't supplied, each occurrence of this option increments the log @@ -335,7 +335,7 @@ Set the module search path to .IR searchpath . .I searchpath is a comma separated list of directories to search for -.B __xservername__ +.B Xorg server modules. This option is only available when the server is run as root (i.e, with real-uid 0). .TP 8 @@ -353,16 +353,16 @@ reason to use this option. Some client applications don't like this pixmap format, even though it is a perfectly legal format. This is equivalent to the .B Pixmap -__xconfigfile__(__filemansuffix__) file option. +xorg.conf(__filemansuffix__) file option. .TP 8 .B \-pixmap32 Set the internal pixmap format for depth 24 pixmaps to 32 bits per pixel. This is usually the default. This is equivalent to the .B Pixmap -__xconfigfile__(__filemansuffix__) file option. +xorg.conf(__filemansuffix__) file option. .TP 8 .BI \-pointer " pointer-name" -Use the __xconfigfile__(__filemansuffix__) file +Use the xorg.conf(__filemansuffix__) file .B InputDevice section called .I pointer-name @@ -392,7 +392,7 @@ options. Share virtual terminals with another X server, if supported by the OS. .TP 8 .BI \-screen " screen-name" -Use the __xconfigfile__(__filemansuffix__) file +Use the xorg.conf(__filemansuffix__) file .B Screen section called .IR screen-name . @@ -442,7 +442,7 @@ support. .SH "KEYBOARD" .PP The -.B __xservername__ +.B Xorg server is normally configured to recognize various special combinations of key presses that instruct the server to perform some action, rather than just sending the key press event to a client application. These actions @@ -456,7 +456,7 @@ keymap. Immediately kills the server -- no questions asked. It can be disabled by setting the .B DontZap -__xconfigfile__(__filemansuffix__) file option to a TRUE value. +xorg.conf(__filemansuffix__) file option to a TRUE value. .PP .RS 8 It should be noted that zapping is triggered by the @@ -470,43 +470,43 @@ but can be enabled with the XKB option Change video mode to next one specified in the configuration file. This can be disabled with the .B DontZoom -__xconfigfile__(__filemansuffix__) file option. +xorg.conf(__filemansuffix__) file option. .TP 8 .B Ctrl+Alt+Keypad-Minus Change video mode to previous one specified in the configuration file. This can be disabled with the .B DontZoom -__xconfigfile__(__filemansuffix__) file option. +xorg.conf(__filemansuffix__) file option. .TP 8 .B Ctrl+Alt+F1...F12 For systems with virtual terminal support, these keystroke combinations are used to switch to virtual terminals 1 through 12, respectively. This can be disabled with the .B DontVTSwitch -__xconfigfile__(__filemansuffix__) file option. +xorg.conf(__filemansuffix__) file option. .SH CONFIGURATION -.B __xservername__ +.B Xorg typically uses a configuration file called -.B __xconfigfile__ +.B xorg.conf and configuration files with the suffix .I .conf in a directory called .B __xconfigdir__ for its initial setup. -Refer to the __xconfigfile__(__filemansuffix__) manual page for information +Refer to the xorg.conf(__filemansuffix__) manual page for information about the format of this file. .PP -.B __xservername__ +.B Xorg has a mechanism for automatically generating a built-in configuration at run-time when no -.B __xconfigfile__ +.B xorg.conf file or .B __xconfigdir__ files are present. The current version of this automatic configuration mechanism works in two ways. .PP The first is via enhancements that have made many components of the -.B __xconfigfile__ +.B xorg.conf file optional. This means that information that can be probed or reasonably deduced doesn't need to be specified explicitly, greatly reducing the amount of built-in configuration information that needs to @@ -514,33 +514,33 @@ be generated at run-time. .PP The second is to have "safe" fallbacks for most configuration information. This maximises the likelihood that the -.B __xservername__ +.B Xorg server will start up in some usable configuration even when information about the specific hardware is not available. .PP -The automatic configuration support for __xservername__ is work in progress. +The automatic configuration support for Xorg is work in progress. It is currently aimed at the most popular hardware and software platforms -supported by __xservername__. Enhancements are planned for future releases. +supported by Xorg. Enhancements are planned for future releases. .SH FILES The -.B __xservername__ +.B Xorg server config files can be found in a range of locations. These are -documented fully in the __xconfigfile__(__filemansuffix__) manual page. The +documented fully in the xorg.conf(__filemansuffix__) manual page. The most commonly used locations are shown here. .TP 30 -.B /etc/X11/__xconfigfile__ +.B /etc/X11/xorg.conf Server configuration file. .TP 30 -.B /etc/X11/__xconfigfile__-4 +.B /etc/X11/xorg.conf-4 Server configuration file. .TP 30 -.B /etc/__xconfigfile__ +.B /etc/xorg.conf Server configuration file. .TP 30 -.B __projectroot__/etc/__xconfigfile__ +.B __projectroot__/etc/xorg.conf Server configuration file. .TP 30 -.B __projectroot__/lib/X11/__xconfigfile__ +.B __projectroot__/lib/X11/xorg.conf Server configuration file. .TP 30 .B /etc/X11/__xconfigdir__ @@ -558,7 +558,7 @@ Server configuration directory. .B __projectroot__/lib/X11/__xconfigdir__ Server configuration directory. .TP 30 -.BI __logdir__/__xservername__. n .log +.BI __logdir__/Xorg. n .log Server log file for display .IR n . .TP 30 @@ -588,7 +588,7 @@ Initial access control list for display .IR n . .SH "SEE ALSO" X(__miscmansuffix__), Xserver(__appmansuffix__), xdm(__appmansuffix__), xinit(__appmansuffix__), -__xconfigfile__(__filemansuffix__), xvidtune(__appmansuffix__), +xorg.conf(__filemansuffix__), xvidtune(__appmansuffix__), xkeyboard-config (__miscmansuffix__), apm(__drivermansuffix__), ati(__drivermansuffix__), @@ -631,15 +631,15 @@ Web site .IR <http://www.x.org> . .SH AUTHORS -__xservername__ has many contributors world wide. The names of most of them +Xorg has many contributors world wide. The names of most of them can be found in the documentation, ChangeLog files in the source tree, and in the actual source code. .PP -__xservername__ was originally based on XFree86 4.4rc2. +Xorg was originally based on XFree86 4.4rc2. That was originally based on \fIX386 1.2\fP by Thomas Roell, which was contributed to the then X Consortium's X11R5 distribution by SGCS. .PP -__xservername__ is released by the X.Org Foundation. +Xorg is released by the X.Org Foundation. .PP The project that became XFree86 was originally founded in 1992 by David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat. @@ -679,7 +679,7 @@ Orest Zborowski \fIorestz@eskimo.com\fP .fi .RE .PP -__xservername__ source is available from the FTP server +Xorg source is available from the FTP server \fI<ftp://ftp.x.org/>\fP, and from the X.Org server \fI<http://gitweb.freedesktop.org/>\fP. Documentation and other information can be found from the X.Org web site @@ -687,10 +687,10 @@ information can be found from the X.Org web site .SH LEGAL .PP -.B __xservername__ +.B Xorg is copyright software, provided under licenses that permit modification and redistribution in source and binary form without fee. -.B __xservername__ is copyright by numerous authors and +.B Xorg is copyright by numerous authors and contributors from around the world. Licensing information can be found at .IR <http://www.x.org> . diff --git a/xserver/hw/xfree86/man/xorg.conf.man b/xserver/hw/xfree86/man/xorg.conf.man index c1b3c4f2d..5d92bbe8b 100644 --- a/xserver/hw/xfree86/man/xorg.conf.man +++ b/xserver/hw/xfree86/man/xorg.conf.man @@ -1,35 +1,35 @@ .\" shorthand for double quote that works everywhere. .ds q \N'34' -.TH __xconfigfile__ __filemansuffix__ __vendorversion__ +.TH xorg.conf __filemansuffix__ __vendorversion__ .SH NAME -__xconfigfile__, __xconfigdir__ \- configuration files for -__xservername__ X server +xorg.conf, __xconfigdir__ \- configuration files for +Xorg X server .SH INTRODUCTION -.B __xservername__ +.B Xorg supports several mechanisms for supplying/obtaining configuration and run-time parameters: command line options, environment variables, the -__xconfigfile__ and __xconfigdir__ configuration files, auto-detection, +xorg.conf and __xconfigdir__ configuration files, auto-detection, and fallback defaults. When the same information is supplied in more than one way, the highest precedence mechanism is used. The list of mechanisms is ordered from highest precedence to lowest. Note that not all parameters can be supplied via all methods. The available command line options and environment variables (and some defaults) are described in the Xserver(__appmansuffix__) and -__xservername__(__appmansuffix__) manual pages. Most configuration file +Xorg(__appmansuffix__) manual pages. Most configuration file parameters, with their defaults, are described below. Driver and module specific configuration parameters are described in the relevant driver or module manual page. .SH DESCRIPTION -.B __xservername__ +.B Xorg uses a configuration file called -.I __xconfigfile__ +.I xorg.conf and files ending in the suffix .I .conf from the directory .I __xconfigdir__ for its initial setup. The -.I __xconfigfile__ +.I xorg.conf configuration file is searched for in the following places when the server is started as a normal user: .PP @@ -39,12 +39,12 @@ server is started as a normal user: .IR __projectroot__/etc/X11/ <cmdline> .IB /etc/X11/ $XORGCONFIG .IB __projectroot__/etc/X11/ $XORGCONFIG -.I /etc/X11/__xconfigfile__ -.I /etc/__xconfigfile__ -.IR __projectroot__/etc/X11/__xconfigfile__. <hostname> -.I __projectroot__/etc/X11/__xconfigfile__ -.IR __projectroot__/lib/X11/__xconfigfile__. <hostname> -.I __projectroot__/lib/X11/__xconfigfile__ +.I /etc/X11/xorg.conf +.I /etc/xorg.conf +.IR __projectroot__/etc/X11/xorg.conf. <hostname> +.I __projectroot__/etc/X11/xorg.conf +.IR __projectroot__/lib/X11/xorg.conf. <hostname> +.I __projectroot__/lib/X11/xorg.conf .fi .RE .PP @@ -60,7 +60,7 @@ environment variable, and is the machine's hostname as reported by .BR gethostname (__libmansuffix__). .PP -When the __xservername__ server is started by the \(lqroot\(rq user, the config file +When the Xorg server is started by the \(lqroot\(rq user, the config file search locations are as follows: .PP .RS 4 @@ -71,12 +71,12 @@ search locations are as follows: .B $XORGCONFIG .IB /etc/X11/ $XORGCONFIG .IB __projectroot__/etc/X11/ $XORGCONFIG -.I /etc/X11/__xconfigfile__ -.I /etc/__xconfigfile__ -.IR __projectroot__/etc/X11/__xconfigfile__. <hostname> -.I __projectroot__/etc/X11/__xconfigfile__ -.IR __projectroot__/lib/X11/__xconfigfile__. <hostname> -.I __projectroot__/lib/X11/__xconfigfile__ +.I /etc/X11/xorg.conf +.I /etc/xorg.conf +.IR __projectroot__/etc/X11/xorg.conf. <hostname> +.I __projectroot__/etc/X11/xorg.conf +.IR __projectroot__/lib/X11/xorg.conf. <hostname> +.I __projectroot__/lib/X11/xorg.conf .fi .RE .PP @@ -113,7 +113,7 @@ is a relative path (with no \(lq..\(rq components) specified with the .B \-configdir command line option. .PP -When the __xservername__ server is started by the \(lqroot\(rq user, the +When the Xorg server is started by the \(lqroot\(rq user, the config directory search locations are as follows: .PP .RS 4 @@ -145,7 +145,7 @@ These files are found in the following directories: .RE .PP The -.I __xconfigfile__ +.I xorg.conf and .I __xconfigdir__ files are composed of a number of sections which may be present in any order, @@ -331,7 +331,7 @@ section is used to specify some path names required by the server. Some of these paths can also be set from the command line (see .BR Xserver (__appmansuffix__) and -.BR __xservername__ (__appmansuffix__)). +.BR Xorg (__appmansuffix__)). The command line settings override the values specified in the config file. The @@ -342,7 +342,7 @@ The entries that can appear in this section are: .TP 7 .BI "FontPath \*q" path \*q sets the search path for fonts. -This path is a comma separated list of font path elements which the __xservername__ +This path is a comma separated list of font path elements which the Xorg server searches for font databases. Multiple .B FontPath @@ -426,8 +426,8 @@ font path when the server starts up. .RE .TP 7 .BI "ModulePath \*q" path \*q -sets the search path for loadable __xservername__ server modules. -This path is a comma separated list of directories which the __xservername__ server +sets the search path for loadable Xorg server modules. +This path is a comma separated list of directories which the Xorg server searches for loadable modules loading in the order specified. Multiple .B ModulePath @@ -441,17 +441,17 @@ __modulepath__ .ig .TP 7 .BI "LogFile \*q" path \*q -sets the name of the __xservername__ server log file. +sets the name of the Xorg server log file. The default log file name is .PP .RS 11 -.RI __logdir__/__xservername__. <n> .log +.RI __logdir__/Xorg. <n> .log .RE .PP .RS 7 where .I <n> -is the display number for the __xservername__ server. +is the display number for the Xorg server. .. .TP 7 .BI "XkbDir \*q" path \*q @@ -466,7 +466,7 @@ __xkbdir__ In addition to options specific to this section (described below), the .B ServerFlags section is used to specify some global -__xservername__ server options. +Xorg server options. All of the entries in this section are .BR Options , although for compatibility purposes some of the old style entries are @@ -498,20 +498,20 @@ section to use in the absence of the command line option. .TP 7 .BI "Option \*qNoTrapSignals\*q \*q" boolean \*q -This prevents the __xservername__ server from trapping a range of unexpected fatal +This prevents the Xorg server from trapping a range of unexpected fatal signals and exiting cleanly. -Instead, the __xservername__ server will die and drop core where the fault occurred. -The default behaviour is for the __xservername__ server to exit cleanly, but still drop a +Instead, the Xorg server will die and drop core where the fault occurred. +The default behaviour is for the Xorg server to exit cleanly, but still drop a core file. -In general you never want to use this option unless you are debugging an __xservername__ +In general you never want to use this option unless you are debugging an Xorg server problem and know how to deal with the consequences. .TP 7 .BI "Option \*qUseSIGIO\*q \*q" boolean \*q -This controls whether the __xservername__ server requests that events from +This controls whether the Xorg server requests that events from input devices be reported via a SIGIO signal handler (also known as SIGPOLL on some platforms), or only reported via the standard select(3) loop. The default behaviour is platform specific. In general you do not want to -use this option unless you are debugging the __xservername__ server, or +use this option unless you are debugging the Xorg server, or working around a specific bug until it is fixed, and understand the consequences. .TP 7 @@ -531,7 +531,7 @@ Default: off. This disallows the use of the .B Terminate_Server XKB action (usually on Ctrl+Alt+Backspace, depending on XKB options). -This action is normally used to terminate the __xservername__ server. +This action is normally used to terminate the Xorg server. When this option is enabled, the action has no effect. Default: off. .TP 7 @@ -568,7 +568,7 @@ sets the inactivity timeout for the phase of the screensaver. .I time is in minutes. -This is equivalent to the __xservername__ server's +This is equivalent to the Xorg server's .B \-s flag, and the value can be changed at run\-time with .BR xset(__appmansuffix__). @@ -679,9 +679,9 @@ Unset by default. .SH "MODULE SECTION" The .B Module -section is used to specify which __xservername__ server modules should be loaded. -This section is ignored when the __xservername__ server is built in static form. -The type of modules normally loaded in this section are __xservername__ server +section is used to specify which Xorg server modules should be loaded. +This section is ignored when the Xorg server is built in static form. +The type of modules normally loaded in this section are Xorg server extension modules. Most other module types are loaded automatically when they are needed via other mechanisms. @@ -701,7 +701,7 @@ This instructs the server to load the module called The module name given should be the module's standard name, not the module file name. The standard name is case\-sensitive, and does not include the \(lqlib\(rq -prefix, or the \(lq.a\(rq, \(lq.o\(rq, or \(lq.so\(rq suffixes. +or \(lqcyg\(rq prefixes, or the \(lq.so\(rq or \(lq.dll\(rq suffixes. .PP .RS 7 Example: the DRI extension module can be loaded with the following entry: @@ -1324,14 +1324,14 @@ recommends that you do. .BI "ClockChip \*q" clockchip\-type \*q This optional entry is used to specify the clock chip type on graphics boards which have a programmable clock generator. -Only a few __xservername__ drivers support programmable clock chips. +Only a few Xorg drivers support programmable clock chips. For details, see the appropriate driver manual page. .TP 7 .BI "VideoRam " "mem" This optional entry specifies the amount of video ram that is installed on the graphics board. This is measured in kBytes. -In most cases this is not required because the __xservername__ server probes +In most cases this is not required because the Xorg server probes the graphics board to determine this quantity. The driver-specific documentation should indicate when it might be needed. .TP 7 @@ -1481,7 +1481,7 @@ if or .B Hz is added to the end of the line. -The data given here is used by the __xservername__ server to determine if video +The data given here is used by the Xorg server to determine if video modes are within the specifications of the monitor. This information should be available in the monitor's handbook. If this entry is omitted, a default range of 28\-33kHz is used. @@ -1500,7 +1500,7 @@ if or .B kHz is added to the end of the line. -The data given here is used by the __xservername__ server to determine if video +The data given here is used by the Xorg server to determine if video modes are within the specifications of the monitor. This information should be available in the monitor's handbook. If this entry is omitted, a default range of 43\-72Hz is used. @@ -1894,8 +1894,7 @@ Others are driver\-independent, and will eventually be described here. .\" XXX These should really be in an xaa man page. .TP 7 .BI "Option \*qAccel\*q" -Enables XAA (X Acceleration Architecture), a mechanism that makes video cards' -2D hardware acceleration available to the __xservername__ server. +Enables 2D hardware acceleration. This option is on by default, but it may be necessary to turn it off if there are bugs in the driver. There are many options to disable specific accelerated operations, listed @@ -1920,73 +1919,6 @@ Disables MTRR (Memory Type Range Register) support, a feature of modern processors which can improve video performance by a factor of up to 2.5. Some hardware has buggy MTRR support, and some video drivers have been known to exhibit problems when MTRR's are used. -.TP 7 -.BI "Option \*qXaaNoCPUToScreenColorExpandFill\*q" -Disables accelerated rectangular expansion blits from source patterns -stored in system memory (using a memory\-mapped aperture). -.TP 7 -.BI "Option \*qXaaNoColor8x8PatternFillRect\*q" -Disables accelerated fills of a rectangular region with a full\-color -pattern. -.TP 7 -.BI "Option \*qXaaNoColor8x8PatternFillTrap\*q" -Disables accelerated fills of a trapezoidal region with a full\-color -pattern. -.TP 7 -.BI "Option \*qXaaNoDashedBresenhamLine\*q" -Disables accelerated dashed Bresenham line draws. -.TP 7 -.BI "Option \*qXaaNoDashedTwoPointLine\*q" -Disables accelerated dashed line draws between two arbitrary points. -.TP 7 -.BI "Option \*qXaaNoImageWriteRect\*q" -Disables accelerated transfers of full\-color rectangular patterns from -system memory to video memory (using a memory\-mapped aperture). -.TP 7 -.BI "Option \*qXaaNoMono8x8PatternFillRect\*q" -Disables accelerated fills of a rectangular region with a monochrome -pattern. -.TP 7 -.BI "Option \*qXaaNoMono8x8PatternFillTrap\*q" -Disables accelerated fills of a trapezoidal region with a monochrome -pattern. -.TP 7 -.BI "Option \*qXaaNoOffscreenPixmaps\*q" -Disables accelerated draws into pixmaps stored in offscreen video memory. -.TP 7 -.BI "Option \*qXaaNoPixmapCache\*q" -Disables caching of patterns in offscreen video memory. -.TP 7 -.BI "Option \*qXaaNoScanlineCPUToScreenColorExpandFill\*q" -Disables accelerated rectangular expansion blits from source patterns -stored in system memory (one scan line at a time). -.TP 7 -.BI "Option \*qXaaNoScanlineImageWriteRect\*q" -Disables accelerated transfers of full\-color rectangular patterns from -system memory to video memory (one scan line at a time). -.TP 7 -.BI "Option \*qXaaNoScreenToScreenColorExpandFill\*q" -Disables accelerated rectangular expansion blits from source patterns -stored in offscreen video memory. -.TP 7 -.BI "Option \*qXaaNoScreenToScreenCopy\*q" -Disables accelerated copies of rectangular regions from one part of -video memory to another part of video memory. -.TP 7 -.BI "Option \*qXaaNoSolidBresenhamLine\*q" -Disables accelerated solid Bresenham line draws. -.TP 7 -.BI "Option \*qXaaNoSolidFillRect\*q" -Disables accelerated solid\-color fills of rectangles. -.TP 7 -.BI "Option \*qXaaNoSolidFillTrap\*q" -Disables accelerated solid\-color fills of Bresenham trapezoids. -.TP 7 -.BI "Option \*qXaaNoSolidHorVertLine\*q" -Disables accelerated solid horizontal and vertical line draws. -.TP 7 -.BI "Option \*qXaaNoSolidTwoPointLine\*q" -Disables accelerated solid line draws between two arbitrary points. .PP Each .B Screen @@ -2070,7 +2002,7 @@ formats. This may also be specified from the command line with the .B \-weight option (see -.BR __xservername__(__appmansuffix__)). +.BR Xorg(__appmansuffix__)). .TP 7 .BI "Virtual " "xdim ydim" This optional entry specifies the virtual screen resolution to be used. @@ -2414,7 +2346,7 @@ The data therein is not used in this release. General: .BR X (__miscmansuffix__), .BR Xserver (__appmansuffix__), -.BR __xservername__ (__appmansuffix__), +.BR Xorg (__appmansuffix__), .BR cvt (__appmansuffix__), .BR gtf (__appmansuffix__). .PP diff --git a/xserver/hw/xfree86/modes/Makefile.in b/xserver/hw/xfree86/modes/Makefile.in index 1bb4f78b8..9556ea4b6 100644 --- a/xserver/hw/xfree86/modes/Makefile.in +++ b/xserver/hw/xfree86/modes/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -218,13 +218,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -246,6 +242,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -270,6 +267,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -384,6 +382,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/modes/xf86Crtc.c b/xserver/hw/xfree86/modes/xf86Crtc.c index 6d5e92f12..33f5a14a3 100644 --- a/xserver/hw/xfree86/modes/xf86Crtc.c +++ b/xserver/hw/xfree86/modes/xf86Crtc.c @@ -44,7 +44,9 @@ #include "X11/Xatom.h" #include "picturestr.h" +#ifdef XV #include "xf86xv.h" +#endif #define NO_OUTPUT_DEFAULT_WIDTH 1024 #define NO_OUTPUT_DEFAULT_HEIGHT 768 @@ -64,6 +66,7 @@ xf86CrtcConfigInit(ScrnInfoPtr scrn, const xf86CrtcConfigFuncsRec * funcs) config = xnfcalloc(1, sizeof(xf86CrtcConfigRec)); config->funcs = funcs; + config->compat_output = -1; scrn->privates[xf86CrtcConfigPrivateIndex].ptr = config; } @@ -180,7 +183,7 @@ xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen) { int subpixel_order = SubPixelUnknown; Bool has_none = FALSE; - ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int c, o; @@ -696,7 +699,7 @@ xf86OutputDestroy(xf86OutputPtr output) static Bool xf86CrtcCreateScreenResources(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); screen->CreateScreenResources = config->CreateScreenResources; @@ -714,9 +717,9 @@ xf86CrtcCreateScreenResources(ScreenPtr screen) * Clean up config on server reset */ static Bool -xf86CrtcCloseScreen(int index, ScreenPtr screen) +xf86CrtcCloseScreen(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int o, c; @@ -724,6 +727,10 @@ xf86CrtcCloseScreen(int index, ScreenPtr screen) xf86RotateCloseScreen(screen); + xf86RandR12CloseScreen(screen); + + screen->CloseScreen(screen); + for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; @@ -734,9 +741,12 @@ xf86CrtcCloseScreen(int index, ScreenPtr screen) crtc->randr_crtc = NULL; } - xf86RandR12CloseScreen(screen); - - return screen->CloseScreen(index, screen); + /* detach any providers */ + if (config->randr_provider) { + RRProviderDestroy(config->randr_provider); + config->randr_provider = NULL; + } + return TRUE; } /* @@ -749,7 +759,7 @@ Bool #endif xf86CrtcScreenInit(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int c; @@ -1824,11 +1834,15 @@ SetCompatOutput(xf86CrtcConfigPtr config) if (compat >= 0) { config->compat_output = compat; } - else { + else if (config->compat_output >= 0 && config->compat_output < config->num_output) { /* Don't change the compat output when no valid outputs found */ output = config->output[config->compat_output]; } + /* All outputs are disconnected, select one to fake */ + if (!output && config->num_output) + output = config->output[0]; + return output; } @@ -2054,12 +2068,13 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, /* * If there's no preferred mode, but only one monitor, pick the - * biggest mode for its aspect ratio, assuming one exists. + * biggest mode for its aspect ratio or 4:3, assuming one exists. */ if (!ret) do { int i = 0; float aspect = 0.0; + DisplayModePtr a = NULL, b = NULL; /* count the number of enabled outputs */ for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++); @@ -2073,8 +2088,11 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, aspect = (float) config->output[p]->mm_width / (float) config->output[p]->mm_height; + a = bestModeForAspect(config, enabled, 4.0/3.0); if (aspect) - preferred_match[p] = bestModeForAspect(config, enabled, aspect); + b = bestModeForAspect(config, enabled, aspect); + + preferred_match[p] = biggestMode(a, b); if (preferred_match[p]) ret = TRUE; @@ -2434,7 +2452,7 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow) xf86CrtcPtr crtc = crtcs[o]; if (mode && crtc) { - crtc->desiredMode = *mode; + xf86SaveModeContents(&crtc->desiredMode, mode); crtc->desiredRotation = output->initial_rotation; crtc->desiredX = output->initial_x; crtc->desiredY = output->initial_y; @@ -2618,7 +2636,7 @@ xf86SetDesiredModes(ScrnInfoPtr scrn) if (!mode) return FALSE; - crtc->desiredMode = *mode; + xf86SaveModeContents(&crtc->desiredMode, mode); crtc->desiredRotation = RR_Rotate_0; crtc->desiredTransformPresent = FALSE; crtc->desiredX = 0; @@ -2757,7 +2775,7 @@ xf86SetSingleMode(ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation) if (!xf86CrtcSetModeTransform(crtc, crtc_mode, rotation, NULL, 0, 0)) ok = FALSE; else { - crtc->desiredMode = *crtc_mode; + xf86SaveModeContents(&crtc->desiredMode, crtc_mode); crtc->desiredRotation = rotation; crtc->desiredTransformPresent = FALSE; crtc->desiredX = 0; @@ -2821,7 +2839,7 @@ xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags) Bool xf86SaveScreen(ScreenPtr pScreen, int mode) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (xf86IsUnblank(mode)) xf86DPMSSet(pScrn, DPMSModeOn, 0); @@ -3007,7 +3025,7 @@ xf86OutputGetEDID(xf86OutputPtr output, I2CBusPtr pDDCBus) ScrnInfoPtr scrn = output->scrn; xf86MonPtr mon; - mon = xf86DoEEDID(scrn->scrnIndex, pDDCBus, TRUE); + mon = xf86DoEEDID(scrn, pDDCBus, TRUE); if (mon) xf86DDCApplyQuirks(scrn->scrnIndex, mon); @@ -3149,7 +3167,7 @@ xf86_crtc_notify_proc_ptr xf86_wrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr new) { if (xf86CrtcConfigPrivateIndex != -1) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); xf86_crtc_notify_proc_ptr old; @@ -3164,7 +3182,7 @@ void xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old) { if (xf86CrtcConfigPrivateIndex != -1) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); config->xf86_crtc_notify = old; @@ -3174,7 +3192,7 @@ xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old) void xf86_crtc_notify(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); if (config->xf86_crtc_notify) @@ -3200,3 +3218,40 @@ xf86_crtc_supports_gamma(ScrnInfoPtr pScrn) return FALSE; } + +void +xf86ProviderSetup(ScrnInfoPtr scrn, + const xf86ProviderFuncsRec *funcs, const char *name) +{ + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + + assert(!xf86_config->name); + assert(name); + + xf86_config->name = strdup(name); + xf86_config->provider_funcs = funcs; +#ifdef RANDR_12_INTERFACE + xf86_config->randr_provider = NULL; +#endif +} + +void +xf86DetachAllCrtc(ScrnInfoPtr scrn) +{ + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + int i; + + for (i = 0; i < xf86_config->num_crtc; i++) { + xf86CrtcPtr crtc = xf86_config->crtc[i]; + + if (crtc->randr_crtc) + RRCrtcDetachScanoutPixmap(crtc->randr_crtc); + + /* dpms off */ + (*crtc->funcs->dpms) (crtc, DPMSModeOff); + /* force a reset the next time its used */ + crtc->randr_crtc->mode = NULL; + crtc->mode.HDisplay = 0; + crtc->x = crtc->y = 0; + } +} diff --git a/xserver/hw/xfree86/modes/xf86Crtc.h b/xserver/hw/xfree86/modes/xf86Crtc.h index a6a3c2e95..802303f74 100644 --- a/xserver/hw/xfree86/modes/xf86Crtc.h +++ b/xserver/hw/xfree86/modes/xf86Crtc.h @@ -218,9 +218,14 @@ typedef struct _xf86CrtcFuncs { void (*set_origin) (xf86CrtcPtr crtc, int x, int y); + /** + */ + Bool + (*set_scanout_pixmap)(xf86CrtcPtr crtc, PixmapPtr pixmap); + } xf86CrtcFuncsRec, *xf86CrtcFuncsPtr; -#define XF86_CRTC_VERSION 4 +#define XF86_CRTC_VERSION 5 struct _xf86Crtc { /** @@ -371,6 +376,10 @@ struct _xf86Crtc { * Added in ABI version 4 */ Bool driverIsPerformingTransform; + + /* Added in ABI version 5 + */ + PixmapPtr current_scanout; }; typedef struct _xf86OutputFuncs { @@ -607,6 +616,29 @@ struct _xf86Output { INT16 initialBorder[4]; }; +typedef struct _xf86ProviderFuncs { + /** + * Called to allow the provider a chance to create properties after the + * RandR objects have been created. + */ + void + (*create_resources) (ScrnInfoPtr scrn); + + /** + * Callback when an provider's property has changed. + */ + Bool + (*set_property) (ScrnInfoPtr scrn, + Atom property, RRPropertyValuePtr value); + + /** + * Callback to get an updated property value + */ + Bool + (*get_property) (ScrnInfoPtr provider, Atom property); + +} xf86ProviderFuncsRec, *xf86ProviderFuncsPtr; + typedef struct _xf86CrtcConfigFuncs { /** * Requests that the driver resize the screen. @@ -681,6 +713,13 @@ typedef struct _xf86CrtcConfig { /* callback when crtc configuration changes */ xf86_crtc_notify_proc_ptr xf86_crtc_notify; + char *name; + const xf86ProviderFuncsRec *provider_funcs; +#ifdef RANDR_12_INTERFACE + RRProviderPtr randr_provider; +#else + void *randr_provider; +#endif } xf86CrtcConfigRec, *xf86CrtcConfigPtr; extern _X_EXPORT int xf86CrtcConfigPrivateIndex; @@ -975,4 +1014,11 @@ extern _X_EXPORT void extern _X_EXPORT Bool xf86_crtc_supports_gamma(ScrnInfoPtr pScrn); +extern _X_EXPORT void +xf86ProviderSetup(ScrnInfoPtr scrn, + const xf86ProviderFuncsRec * funcs, const char *name); + +extern _X_EXPORT void +xf86DetachAllCrtc(ScrnInfoPtr scrn); + #endif /* _XF86CRTC_H_ */ diff --git a/xserver/hw/xfree86/modes/xf86Cursors.c b/xserver/hw/xfree86/modes/xf86Cursors.c index 95a78921d..634ee3fe0 100644 --- a/xserver/hw/xfree86/modes/xf86Cursors.c +++ b/xserver/hw/xfree86/modes/xf86Cursors.c @@ -477,7 +477,7 @@ xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src) static Bool xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; @@ -496,7 +496,7 @@ xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor) static Bool xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; @@ -564,7 +564,7 @@ xf86_load_cursor_argb(ScrnInfoPtr scrn, CursorPtr cursor) Bool xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info; @@ -631,7 +631,7 @@ xf86_reload_cursors(ScreenPtr screen) if (!cursor_screen_priv || !cursor_screen_priv->isUp) return; - scrn = xf86Screens[screen->myNum]; + scrn = xf86ScreenToScrn(screen); xf86_config = XF86_CRTC_CONFIG_PTR(scrn); /* make sure the cursor code has been initialized */ @@ -667,7 +667,7 @@ xf86_reload_cursors(ScreenPtr screen) void xf86_cursors_fini(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); if (xf86_config->cursor_info) { diff --git a/xserver/hw/xfree86/modes/xf86DiDGA.c b/xserver/hw/xfree86/modes/xf86DiDGA.c index fafd95aed..3f1a3309f 100644 --- a/xserver/hw/xfree86/modes/xf86DiDGA.c +++ b/xserver/hw/xfree86/modes/xf86DiDGA.c @@ -41,7 +41,7 @@ static Bool xf86_dga_get_modes(ScreenPtr pScreen) { - ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); DGAModePtr modes, mode; DisplayModePtr display_mode; @@ -137,7 +137,7 @@ xf86_dga_get_viewport(ScrnInfoPtr scrn) static void xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags) { - scrn->AdjustFrame(scrn->pScreen->myNum, x, y, flags); + scrn->AdjustFrame(scrn, x, y); } static Bool @@ -175,10 +175,10 @@ xf86DiDGAReInit(ScreenPtr pScreen) Bool _xf86_di_dga_reinit_internal(ScreenPtr pScreen) { - ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); - if (!DGAAvailable(pScreen->myNum)) + if (!DGAScreenAvailable(pScreen)) return TRUE; if (!xf86_dga_get_modes(pScreen)) @@ -197,7 +197,7 @@ xf86DiDGAInit(ScreenPtr pScreen, unsigned long dga_address) Bool _xf86_di_dga_init_internal(ScreenPtr pScreen) { - ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86_config->dga_flags = 0; diff --git a/xserver/hw/xfree86/modes/xf86DisplayIDModes.c b/xserver/hw/xfree86/modes/xf86DisplayIDModes.c index 781c806bc..bead1265a 100644 --- a/xserver/hw/xfree86/modes/xf86DisplayIDModes.c +++ b/xserver/hw/xfree86/modes/xf86DisplayIDModes.c @@ -184,105 +184,96 @@ static const struct did_dmt { short w, h, r, f; } did_dmt[] = { /* byte 3 */ - { - 640, 350, 85, 0}, { - 640, 400, 85, 0}, { - 720, 400, 85, 0}, { - 640, 480, 60, 0}, { - 640, 480, 72, 0}, { - 640, 480, 75, 0}, { - 640, 480, 85, 0}, { - 800, 600, 56, 0}, + {640, 350, 85, 0}, + {640, 400, 85, 0}, + {720, 400, 85, 0}, + {640, 480, 60, 0}, + {640, 480, 72, 0}, + {640, 480, 75, 0}, + {640, 480, 85, 0}, + {800, 600, 56, 0}, /* byte 4 */ - { - 800, 600, 60, 0}, { - 800, 600, 72, 0}, { - 800, 600, 75, 0}, { - 800, 600, 85, 0}, { - 800, 600, 120, RB}, { - 848, 480, 60, 0}, { - 1024, 768, 43, INT}, { - 1024, 768, 60, 0}, + {800, 600, 60, 0}, + {800, 600, 72, 0}, + {800, 600, 75, 0}, + {800, 600, 85, 0}, + {800, 600, 120, RB}, + {848, 480, 60, 0}, + {1024, 768, 43, INT}, + {1024, 768, 60, 0}, /* byte 5 */ - { - 1024, 768, 70, 0}, { - 1024, 768, 75, 0}, { - 1024, 768, 85, 0}, { - 1024, 768, 120, RB}, { - 1152, 864, 75, 0}, { - 1280, 768, 60, RB}, { - 1280, 768, 60, 0}, { - 1280, 768, 75, 0}, + {1024, 768, 70, 0}, + {1024, 768, 75, 0}, + {1024, 768, 85, 0}, + {1024, 768, 120, RB}, + {1152, 864, 75, 0}, + {1280, 768, 60, RB}, + {1280, 768, 60, 0}, + {1280, 768, 75, 0}, /* byte 6 */ - { - 1280, 768, 85, 0}, { - 1280, 768, 120, RB}, { - 1280, 800, 60, RB}, { - 1280, 800, 60, 0}, { - 1280, 800, 75, 0}, { - 1280, 800, 85, 0}, { - 1280, 800, 120, RB}, { - 1280, 960, 60, 0}, + {1280, 768, 85, 0}, + {1280, 768, 120, RB}, + {1280, 800, 60, RB}, + {1280, 800, 60, 0}, + {1280, 800, 75, 0}, + {1280, 800, 85, 0}, + {1280, 800, 120, RB}, + {1280, 960, 60, 0}, /* byte 7 */ - { - 1280, 960, 85, 0}, { - 1280, 960, 120, RB}, { - 1280, 1024, 60, 0}, { - 1280, 1024, 75, 0}, { - 1280, 1024, 85, 0}, { - 1280, 1024, 120, RB}, { - 1360, 768, 60, 0}, { - 1360, 768, 120, RB}, + {1280, 960, 85, 0}, + {1280, 960, 120, RB}, + {1280, 1024, 60, 0}, + {1280, 1024, 75, 0}, + {1280, 1024, 85, 0}, + {1280, 1024, 120, RB}, + {1360, 768, 60, 0}, + {1360, 768, 120, RB}, /* byte 8 */ - { - 1400, 1050, 60, RB}, { - 1400, 1050, 60, 0}, { - 1400, 1050, 75, 0}, { - 1400, 1050, 85, 0}, { - 1400, 1050, 120, RB}, { - 1440, 900, 60, RB}, { - 1440, 900, 60, 0}, { - 1440, 900, 75, 0}, + {1400, 1050, 60, RB}, + {1400, 1050, 60, 0}, + {1400, 1050, 75, 0}, + {1400, 1050, 85, 0}, + {1400, 1050, 120, RB}, + {1440, 900, 60, RB}, + {1440, 900, 60, 0}, + {1440, 900, 75, 0}, /* byte 9 */ - { - 1440, 900, 85, 0}, { - 1440, 900, 120, RB}, { - 1600, 1200, 60, 0}, { - 1600, 1200, 65, 0}, { - 1600, 1200, 70, 0}, { - 1600, 1200, 75, 0}, { - 1600, 1200, 85, 0}, { - 1600, 1200, 120, RB}, + {1440, 900, 85, 0}, + {1440, 900, 120, RB}, + {1600, 1200, 60, 0}, + {1600, 1200, 65, 0}, + {1600, 1200, 70, 0}, + {1600, 1200, 75, 0}, + {1600, 1200, 85, 0}, + {1600, 1200, 120, RB}, /* byte a */ - { - 1680, 1050, 60, RB}, { - 1680, 1050, 60, 0}, { - 1680, 1050, 75, 0}, { - 1680, 1050, 85, 0}, { - 1680, 1050, 120, RB}, { - 1792, 1344, 60, 0}, { - 1792, 1344, 75, 0}, { - 1792, 1344, 120, RB}, + {1680, 1050, 60, RB}, + {1680, 1050, 60, 0}, + {1680, 1050, 75, 0}, + {1680, 1050, 85, 0}, + {1680, 1050, 120, RB}, + {1792, 1344, 60, 0}, + {1792, 1344, 75, 0}, + {1792, 1344, 120, RB}, /* byte b */ - { - 1856, 1392, 60, 0}, { - 1856, 1392, 75, 0}, { - 1856, 1392, 120, RB}, { - 1920, 1200, 60, RB}, { - 1920, 1200, 60, 0}, { - 1920, 1200, 75, 0}, { - 1920, 1200, 85, 0}, { - 1920, 1200, 120, RB}, + {1856, 1392, 60, 0}, + {1856, 1392, 75, 0}, + {1856, 1392, 120, RB}, + {1920, 1200, 60, RB}, + {1920, 1200, 60, 0}, + {1920, 1200, 75, 0}, + {1920, 1200, 85, 0}, + {1920, 1200, 120, RB}, /* byte c */ - { - 1920, 1440, 60, 0}, { - 1920, 1440, 75, 0}, { - 1920, 1440, 120, RB}, { - 2560, 1600, 60, RB}, { - 2560, 1600, 60, 0}, { - 2560, 1600, 75, 0}, { - 2560, 1600, 85, 0}, { -2560, 1600, 120, RB},}; + {1920, 1440, 60, 0}, + {1920, 1440, 75, 0}, + {1920, 1440, 120, RB}, + {2560, 1600, 60, RB}, + {2560, 1600, 60, 0}, + {2560, 1600, 75, 0}, + {2560, 1600, 85, 0}, + {2560, 1600, 120, RB}, +}; static void didVesaTiming(int scrn, unsigned char *x, MonPtr mon) diff --git a/xserver/hw/xfree86/modes/xf86EdidModes.c b/xserver/hw/xfree86/modes/xf86EdidModes.c index 258ada5b4..4ee862da0 100644 --- a/xserver/hw/xfree86/modes/xf86EdidModes.c +++ b/xserver/hw/xfree86/modes/xf86EdidModes.c @@ -513,14 +513,14 @@ DDCModeDoInterlaceQuirks(DisplayModePtr mode) static const struct { int w, h; } cea_interlaced[] = { - { - 1920, 1080}, { - 720, 480}, { - 1440, 480}, { - 2880, 480}, { - 720, 576}, { - 1440, 576}, { - 2880, 576},}; + {1920, 1080}, + {720, 480}, + {1440, 480}, + {2880, 480}, + {720, 576}, + {1440, 576}, + {2880, 576}, + }; static const int n_modes = sizeof(cea_interlaced) / sizeof(cea_interlaced[0]); int i; @@ -668,68 +668,62 @@ static const struct { short r; short rb; } EstIIIModes[] = { - /* byte 6 */ - { - 640, 350, 85, 0}, { - 640, 400, 85, 0}, { - 720, 400, 85, 0}, { - 640, 480, 85, 0}, { - 848, 480, 60, 0}, { - 800, 600, 85, 0}, { - 1024, 768, 85, 0}, { - 1152, 864, 75, 0}, + /* byte 6 */ + {640, 350, 85, 0}, + {640, 400, 85, 0}, + {720, 400, 85, 0}, + {640, 480, 85, 0}, + {848, 480, 60, 0}, + {800, 600, 85, 0}, + {1024, 768, 85, 0}, + {1152, 864, 75, 0}, /* byte 7 */ - { - 1280, 768, 60, 1}, { - 1280, 768, 60, 0}, { - 1280, 768, 75, 0}, { - 1280, 768, 85, 0}, { - 1280, 960, 60, 0}, { - 1280, 960, 85, 0}, { - 1280, 1024, 60, 0}, { - 1280, 1024, 85, 0}, + {1280, 768, 60, 1}, + {1280, 768, 60, 0}, + {1280, 768, 75, 0}, + {1280, 768, 85, 0}, + {1280, 960, 60, 0}, + {1280, 960, 85, 0}, + {1280, 1024, 60, 0}, + {1280, 1024, 85, 0}, /* byte 8 */ - { - 1360, 768, 60, 0}, { - 1440, 900, 60, 1}, { - 1440, 900, 60, 0}, { - 1440, 900, 75, 0}, { - 1440, 900, 85, 0}, { - 1400, 1050, 60, 1}, { - 1400, 1050, 60, 0}, { - 1400, 1050, 75, 0}, + {1360, 768, 60, 0}, + {1440, 900, 60, 1}, + {1440, 900, 60, 0}, + {1440, 900, 75, 0}, + {1440, 900, 85, 0}, + {1400, 1050, 60, 1}, + {1400, 1050, 60, 0}, + {1400, 1050, 75, 0}, /* byte 9 */ - { - 1400, 1050, 85, 0}, { - 1680, 1050, 60, 1}, { - 1680, 1050, 60, 0}, { - 1680, 1050, 75, 0}, { - 1680, 1050, 85, 0}, { - 1600, 1200, 60, 0}, { - 1600, 1200, 65, 0}, { - 1600, 1200, 70, 0}, + {1400, 1050, 85, 0}, + {1680, 1050, 60, 1}, + {1680, 1050, 60, 0}, + {1680, 1050, 75, 0}, + {1680, 1050, 85, 0}, + {1600, 1200, 60, 0}, + {1600, 1200, 65, 0}, + {1600, 1200, 70, 0}, /* byte 10 */ - { - 1600, 1200, 75, 0}, { - 1600, 1200, 85, 0}, { - 1792, 1344, 60, 0}, { - 1792, 1344, 85, 0}, { - 1856, 1392, 60, 0}, { - 1856, 1392, 75, 0}, { - 1920, 1200, 60, 1}, { - 1920, 1200, 60, 0}, + {1600, 1200, 75, 0}, + {1600, 1200, 85, 0}, + {1792, 1344, 60, 0}, + {1792, 1344, 85, 0}, + {1856, 1392, 60, 0}, + {1856, 1392, 75, 0}, + {1920, 1200, 60, 1}, + {1920, 1200, 60, 0}, /* byte 11 */ - { - 1920, 1200, 75, 0}, { - 1920, 1200, 85, 0}, { - 1920, 1440, 60, 0}, { - 1920, 1440, 75, 0}, + {1920, 1200, 75, 0}, + {1920, 1200, 85, 0}, + {1920, 1440, 60, 0}, + {1920, 1440, 75, 0}, /* fill up last byte */ - { - 0,0,0,0}, { - 0,0,0,0}, { - 0,0,0,0}, { - 0,0,0,0}, }; + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, +}; static DisplayModePtr DDCModesFromEstIII(unsigned char *est) diff --git a/xserver/hw/xfree86/modes/xf86Modes.c b/xserver/hw/xfree86/modes/xf86Modes.c index 2a6d26756..c4a3eb0a3 100644 --- a/xserver/hw/xfree86/modes/xf86Modes.c +++ b/xserver/hw/xfree86/modes/xf86Modes.c @@ -191,6 +191,21 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags) } /** + * Fills in a copy of mode, removing all stale pointer references. + * xf86ModesEqual will return true when comparing with original mode. + */ +void +xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec *mode) +{ + *intern = *mode; + intern->prev = intern->next = NULL; + intern->name = NULL; + intern->PrivSize = 0; + intern->PrivFlags = 0; + intern->Private = NULL; +} + +/** * Allocates and returns a copy of pMode, including pointers within pMode. */ DisplayModePtr diff --git a/xserver/hw/xfree86/modes/xf86RandR12.c b/xserver/hw/xfree86/modes/xf86RandR12.c index aea9e1c7e..edc31a922 100644 --- a/xserver/hw/xfree86/modes/xf86RandR12.c +++ b/xserver/hw/xfree86/modes/xf86RandR12.c @@ -60,6 +60,9 @@ typedef struct _xf86RandR12Info { * See https://bugs.freedesktop.org/show_bug.cgi?id=21554 */ xf86EnterVTProc *orig_EnterVT; + + Bool panning; + ConstrainCursorHarderProcPtr orig_ConstrainCursorHarder; } XF86RandRInfoRec, *XF86RandRInfoPtr; #ifdef RANDR_12_INTERFACE @@ -447,7 +450,7 @@ static Bool xf86RandR12GetInfo(ScreenPtr pScreen, Rotation * rotations) { RRScreenSizePtr pSize; - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int refresh0 = 60; @@ -504,7 +507,7 @@ xf86RandR12SetMode(ScreenPtr pScreen, DisplayModePtr mode, Bool useVirtual, int mmWidth, int mmHeight) { - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); int oldWidth = pScreen->width; int oldHeight = pScreen->height; @@ -515,7 +518,7 @@ xf86RandR12SetMode(ScreenPtr pScreen, Bool ret = TRUE; if (pRoot) - (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE); + (*scrp->EnableDisableFBAccess) (scrp, FALSE); if (useVirtual) { scrp->virtualX = randrp->virtualX; scrp->virtualY = randrp->virtualY; @@ -568,7 +571,7 @@ xf86RandR12SetMode(ScreenPtr pScreen, xf86SetViewport(pScreen, pScreen->width, pScreen->height); xf86SetViewport(pScreen, 0, 0); if (pRoot) - (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE); + (*scrp->EnableDisableFBAccess) (scrp, TRUE); return ret; } @@ -576,7 +579,7 @@ Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); + ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int pos[MAXDEVICES][2]; @@ -665,17 +668,22 @@ xf86RandR12SetConfig(ScreenPtr pScreen, return TRUE; } +#define PANNING_ENABLED(crtc) \ + ((crtc)->panningTotalArea.x2 > (crtc)->panningTotalArea.x1 || \ + (crtc)->panningTotalArea.y2 > (crtc)->panningTotalArea.y1) + static Bool xf86RandR12ScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); - ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); WindowPtr pRoot = pScreen->root; PixmapPtr pScrnPix; Bool ret = FALSE; + Bool panning = FALSE; int c; if (xf86RandR12Key) { @@ -685,7 +693,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen, } } if (pRoot && pScrn->vtSema) - (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE); + (*pScrn->EnableDisableFBAccess) (pScrn, FALSE); /* Let the driver update virtualX and virtualY */ if (!(*config->funcs->resize) (pScrn, width, height)) @@ -696,8 +704,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen, for (c = 0; c < config->num_crtc; c++) { xf86CrtcPtr crtc = config->crtc[c]; - if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1 || - crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) { + if (PANNING_ENABLED (crtc)) { if (crtc->panningTotalArea.x2 > crtc->panningTrackingArea.x1) crtc->panningTotalArea.x2 += width - pScreen->width; if (crtc->panningTotalArea.y2 > crtc->panningTrackingArea.y1) @@ -708,6 +715,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen, crtc->panningTrackingArea.y2 += height - pScreen->height; xf86RandR13VerifyPanningArea(crtc, width, height); xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY); + panning = TRUE; } } @@ -724,7 +732,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen, update_desktop_dimensions(); if (pRoot && pScrn->vtSema) - (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE); + (*pScrn->EnableDisableFBAccess) (pScrn, TRUE); #if RANDR_12_INTERFACE if (xf86RandR12Key && pScreen->root && ret) RRScreenSizeNotify(pScreen); @@ -743,7 +751,7 @@ xf86RandR12GetRotation(ScreenPtr pScreen) Bool xf86RandR12CreateScreenResources(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config; XF86RandRInfoPtr randrp; int c; @@ -903,7 +911,8 @@ xf86RandR12CloseScreen(ScreenPtr pScreen) randrp = XF86RANDRINFO(pScreen); #if RANDR_12_INTERFACE - xf86Screens[pScreen->myNum]->EnterVT = randrp->orig_EnterVT; + xf86ScreenToScrn(pScreen)->EnterVT = randrp->orig_EnterVT; + pScreen->ConstrainCursorHarder = randrp->orig_ConstrainCursorHarder; #endif free(randrp); @@ -915,7 +924,7 @@ xf86RandR12SetRotations(ScreenPtr pScreen, Rotation rotations) XF86RandRInfoPtr randrp; #if RANDR_12_INTERFACE - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); int c; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); #endif @@ -940,7 +949,7 @@ xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms) XF86RandRInfoPtr randrp; #if RANDR_13_INTERFACE - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); int c; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); #endif @@ -961,7 +970,7 @@ xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms) void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y) { - ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); if (xf86RandR12Generation != serverGeneration || XF86RANDRINFO(pScreen)->virtualX == -1) { @@ -1042,7 +1051,7 @@ static Bool xf86RandR12CrtcNotify(RRCrtcPtr randr_crtc) { ScreenPtr pScreen = randr_crtc->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); RRModePtr randr_mode = NULL; int x; @@ -1137,7 +1146,7 @@ xf86RandR12CrtcSet(ScreenPtr pScreen, int num_randr_outputs, RROutputPtr * randr_outputs) { XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcPtr crtc = randr_crtc->devPrivate; RRTransformPtr transform; @@ -1158,6 +1167,9 @@ xf86RandR12CrtcSet(ScreenPtr pScreen, if (rotation != crtc->rotation) changed = TRUE; + if (crtc->current_scanout != randr_crtc->scanout_pixmap) + changed = TRUE; + transform = RRCrtcGetTransform(randr_crtc); if ((transform != NULL) != crtc->transformPresent) changed = TRUE; @@ -1214,11 +1226,13 @@ xf86RandR12CrtcSet(ScreenPtr pScreen, } xf86RandR13VerifyPanningArea(crtc, pScreen->width, pScreen->height); xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY); + randrp->panning = PANNING_ENABLED (crtc); /* * Save the last successful setting for EnterVT */ - crtc->desiredMode = mode; + xf86SaveModeContents(&crtc->desiredMode, &mode); crtc->desiredRotation = rotation; + crtc->current_scanout = randr_crtc->scanout_pixmap; if (transform) { crtc->desiredTransform = *transform; crtc->desiredTransformPresent = TRUE; @@ -1350,7 +1364,7 @@ static Bool xf86RandR12OutputValidateMode(ScreenPtr pScreen, RROutputPtr randr_output, RRModePtr randr_mode) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86OutputPtr output = randr_output->devPrivate; DisplayModeRec mode; @@ -1435,7 +1449,7 @@ xf86RROutputSetModes(RROutputPtr randr_output, DisplayModePtr modes) static Bool xf86RandR12SetInfo12(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); RROutputPtr *clones; RRCrtcPtr *crtcs; @@ -1511,7 +1525,7 @@ xf86RandR12SetInfo12(ScreenPtr pScreen) static Bool xf86RandR12GetInfo12(ScreenPtr pScreen, Rotation * rotations) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (!pScrn->vtSema) return TRUE; @@ -1523,7 +1537,7 @@ xf86RandR12GetInfo12(ScreenPtr pScreen, Rotation * rotations) static Bool xf86RandR12CreateObjects12(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int c; int o; @@ -1553,6 +1567,14 @@ xf86RandR12CreateObjects12(ScreenPtr pScreen) output->funcs->create_resources(output); RRPostPendingProperties(output->randr_output); } + + if (config->name) { + config->randr_provider = RRProviderCreate(pScreen, config->name, + strlen(config->name)); + + RRProviderSetCapabilities(config->randr_provider, pScrn->capabilities); + } + return TRUE; } @@ -1560,7 +1582,7 @@ static Bool xf86RandR12CreateScreenResources12(ScreenPtr pScreen) { int c; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); if (xf86RandR12Key == NULL) @@ -1582,7 +1604,7 @@ xf86RandR12CreateScreenResources12(ScreenPtr pScreen) void xf86RandR12TellChanged(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int c; @@ -1597,10 +1619,9 @@ xf86RandR12TellChanged(ScreenPtr pScreen) } static void -xf86RandR12PointerMoved(int scrnIndex, int x, int y) +xf86RandR12PointerMoved(ScrnInfoPtr pScrn, int x, int y) { - ScreenPtr pScreen = screenInfo.screens[scrnIndex]; - ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); int c; @@ -1640,6 +1661,7 @@ xf86RandR13SetPanning(ScreenPtr pScreen, BoxRec oldTotalArea; BoxRec oldTrackingArea; INT16 oldBorder[4]; + Bool oldPanning = randrp->panning; if (crtc->version < 2) return FALSE; @@ -1657,6 +1679,7 @@ xf86RandR13SetPanning(ScreenPtr pScreen, if (xf86RandR13VerifyPanningArea(crtc, pScreen->width, pScreen->height)) { xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY); + randrp->panning = PANNING_ENABLED (crtc); return TRUE; } else { @@ -1664,6 +1687,7 @@ xf86RandR13SetPanning(ScreenPtr pScreen, memcpy(&crtc->panningTotalArea, &oldTotalArea, sizeof(BoxRec)); memcpy(&crtc->panningTrackingArea, &oldTrackingArea, sizeof(BoxRec)); memcpy(crtc->panningBorder, oldBorder, 4 * sizeof(INT16)); + randrp->panning = oldPanning; return FALSE; } } @@ -1680,19 +1704,18 @@ gamma_to_ramp(float gamma, CARD16 *ramp, int size) for (i = 0; i < size; i++) { if (gamma == 1.0) - ramp[i] = i << 8; + ramp[i] = i | i << 8; else ramp[i] = (CARD16) (pow((double) i / (double) (size - 1), 1. / gamma) - * (double) (size - 1) * 256); + * (double) (size - 1) * 257); } } static int -xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma) +xf86RandR12ChangeGamma(ScrnInfoPtr pScrn, Gamma gamma) { CARD16 *points, *red, *green, *blue; - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn); int size; @@ -1724,10 +1747,9 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma) } static Bool -xf86RandR12EnterVT(int screen_index, int flags) +xf86RandR12EnterVT(ScrnInfoPtr pScrn) { - ScreenPtr pScreen = screenInfo.screens[screen_index]; - ScrnInfoPtr pScrn = xf86Screens[screen_index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); rrScrPrivPtr rp = rrGetScrPriv(pScreen); Bool ret; @@ -1735,7 +1757,7 @@ xf86RandR12EnterVT(int screen_index, int flags) if (randrp->orig_EnterVT) { pScrn->EnterVT = randrp->orig_EnterVT; - ret = pScrn->EnterVT(screen_index, flags); + ret = pScrn->EnterVT(pScrn); randrp->orig_EnterVT = pScrn->EnterVT; pScrn->EnterVT = xf86RandR12EnterVT; if (!ret) @@ -1750,9 +1772,145 @@ xf86RandR12EnterVT(int screen_index, int flags) } static Bool +xf86RandR14ProviderSetOutputSource(ScreenPtr pScreen, + RRProviderPtr provider, + RRProviderPtr source_provider) +{ + if (!source_provider) { + if (provider->output_source) { + ScreenPtr cmScreen = pScreen->current_master; + + DetachOutputGPU(pScreen); + AttachUnboundGPU(cmScreen, pScreen); + } + provider->output_source = NULL; + return TRUE; + } + + if (provider->output_source == source_provider) + return TRUE; + + SetRootClip(source_provider->pScreen, FALSE); + + DetachUnboundGPU(pScreen); + AttachOutputGPU(source_provider->pScreen, pScreen); + + provider->output_source = source_provider; + SetRootClip(source_provider->pScreen, TRUE); + return TRUE; +} + +static Bool +xf86RandR14ProviderSetOffloadSink(ScreenPtr pScreen, + RRProviderPtr provider, + RRProviderPtr sink_provider) +{ + if (!sink_provider) { + if (provider->offload_sink) { + ScreenPtr cmScreen = pScreen->current_master; + DetachOutputGPU(pScreen); + AttachUnboundGPU(cmScreen, pScreen); + } + + provider->offload_sink = NULL; + return TRUE; + } + + if (provider->offload_sink == sink_provider) + return TRUE; + + DetachUnboundGPU(pScreen); + AttachOffloadGPU(sink_provider->pScreen, pScreen); + + provider->offload_sink = sink_provider; + return TRUE; +} + +static Bool +xf86RandR14ProviderSetProperty(ScreenPtr pScreen, + RRProviderPtr randr_provider, + Atom property, RRPropertyValuePtr value) +{ + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + + /* If we don't have any property handler, then we don't care what the + * user is setting properties to. + */ + if (config->provider_funcs->set_property == NULL) + return TRUE; + + /* + * This function gets called even when vtSema is FALSE, as + * drivers will need to remember the correct value to apply + * when the VT switch occurs + */ + return config->provider_funcs->set_property(pScrn, property, value); +} + +static Bool +xf86RandR14ProviderGetProperty(ScreenPtr pScreen, + RRProviderPtr randr_provider, Atom property) +{ + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + + if (config->provider_funcs->get_property == NULL) + return TRUE; + + /* Should be safe even w/o vtSema */ + return config->provider_funcs->get_property(pScrn, property); +} + +static Bool +xf86CrtcSetScanoutPixmap(RRCrtcPtr randr_crtc, PixmapPtr pixmap) +{ + xf86CrtcPtr crtc = randr_crtc->devPrivate; + if (!crtc->funcs->set_scanout_pixmap) + return FALSE; + return crtc->funcs->set_scanout_pixmap(crtc, pixmap); +} + +static void +xf86RandR13ConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, int *x, int *y) +{ + XF86RandRInfoPtr randrp = XF86RANDRINFO(screen); + + if (randrp->panning) + return; + + if (randrp->orig_ConstrainCursorHarder) { + screen->ConstrainCursorHarder = randrp->orig_ConstrainCursorHarder; + screen->ConstrainCursorHarder(dev, screen, mode, x, y); + screen->ConstrainCursorHarder = xf86RandR13ConstrainCursorHarder; + } +} + +static void +xf86RandR14ProviderDestroy(ScreenPtr screen, RRProviderPtr provider) +{ + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + + if (config->randr_provider == provider) { + if (config->randr_provider->offload_sink) { + DetachOffloadGPU(screen); + config->randr_provider->offload_sink = NULL; + } + else if (config->randr_provider->output_source) { + DetachOutputGPU(screen); + config->randr_provider->output_source = NULL; + } + else if (screen->current_master) + DetachUnboundGPU(screen); + } + config->randr_provider = NULL; +} + +static Bool xf86RandR12Init12(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); rrScrPrivPtr rp = rrGetScrPriv(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); int i; @@ -1771,12 +1929,25 @@ xf86RandR12Init12(ScreenPtr pScreen) #endif rp->rrModeDestroy = xf86RandR12ModeDestroy; rp->rrSetConfig = NULL; + + rp->rrProviderSetOutputSource = xf86RandR14ProviderSetOutputSource; + rp->rrProviderSetOffloadSink = xf86RandR14ProviderSetOffloadSink; + + rp->rrProviderSetProperty = xf86RandR14ProviderSetProperty; + rp->rrProviderGetProperty = xf86RandR14ProviderGetProperty; + rp->rrCrtcSetScanoutPixmap = xf86CrtcSetScanoutPixmap; + rp->rrProviderDestroy = xf86RandR14ProviderDestroy; + pScrn->PointerMoved = xf86RandR12PointerMoved; pScrn->ChangeGamma = xf86RandR12ChangeGamma; randrp->orig_EnterVT = pScrn->EnterVT; pScrn->EnterVT = xf86RandR12EnterVT; + randrp->panning = FALSE; + randrp->orig_ConstrainCursorHarder = pScreen->ConstrainCursorHarder; + pScreen->ConstrainCursorHarder = xf86RandR13ConstrainCursorHarder; + if (!xf86RandR12CreateObjects12(pScreen)) return FALSE; diff --git a/xserver/hw/xfree86/modes/xf86Rotate.c b/xserver/hw/xfree86/modes/xf86Rotate.c index cbc868735..a3937478f 100644 --- a/xserver/hw/xfree86/modes/xf86Rotate.c +++ b/xserver/hw/xfree86/modes/xf86Rotate.c @@ -46,28 +46,6 @@ /* borrowed from composite extension, move to Render and publish? */ -static VisualPtr -compGetWindowVisual(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - VisualID vid = wVisual(pWin); - int i; - - for (i = 0; i < pScreen->numVisuals; i++) - if (pScreen->visuals[i].vid == vid) - return &pScreen->visuals[i]; - return 0; -} - -static PictFormatPtr -compWindowFormat(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - - return PictureMatchVisual(pScreen, pWin->drawable.depth, - compGetWindowVisual(pWin)); -} - #define F(x) IntToxFixed(x) #define toF(x) ((float) (x) / 65536.0f) @@ -79,7 +57,7 @@ xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, RegionPtr region) ScreenPtr screen = scrn->pScreen; WindowPtr root = screen->root; PixmapPtr dst_pixmap = crtc->rotatedPixmap; - PictFormatPtr format = compWindowFormat(screen->root); + PictFormatPtr format = PictureWindowFormat(screen->root); int error; PicturePtr src, dst; int n = RegionNumRects(region); @@ -144,7 +122,7 @@ xf86CrtcDamageShadow(xf86CrtcPtr crtc) ScrnInfoPtr pScrn = crtc->scrn; BoxRec damage_box; RegionRec damage_region; - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); damage_box.x1 = 0; damage_box.x2 = crtc->mode.HDisplay; @@ -174,7 +152,7 @@ xf86CrtcDamageShadow(xf86CrtcPtr crtc) static void xf86RotatePrepare(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int c; @@ -204,7 +182,7 @@ xf86RotatePrepare(ScreenPtr pScreen) static Bool xf86RotateRedisplay(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); DamagePtr damage = xf86_config->rotation_damage; RegionPtr region; @@ -250,17 +228,16 @@ xf86RotateRedisplay(ScreenPtr pScreen) } static void -xf86RotateBlockHandler(int screenNum, pointer blockData, +xf86RotateBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[screenNum]; - ScrnInfoPtr pScrn = xf86Screens[screenNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); Bool rotation_active; rotation_active = xf86RotateRedisplay(pScreen); pScreen->BlockHandler = xf86_config->BlockHandler; - (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask); + (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask); /* cannot avoid re-wrapping until all wrapping is audited */ xf86_config->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = xf86RotateBlockHandler; @@ -270,7 +247,7 @@ void xf86RotateDestroy(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int c; @@ -328,7 +305,7 @@ xf86RotateFreeShadow(ScrnInfoPtr pScrn) void xf86RotateCloseScreen(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int c; @@ -345,6 +322,12 @@ xf86CrtcFitsScreen(xf86CrtcPtr crtc, struct pict_f_transform *crtc_to_fb) /* When called before PreInit, the driver is * presumably doing load detect */ + if (pScrn->is_gpu) { + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); + if (pScreen->current_master) + pScrn = xf86ScreenToScrn(pScreen->current_master); + } + if (pScrn->virtualX == 0 || pScrn->virtualY == 0) return TRUE; @@ -370,9 +353,7 @@ xf86CrtcRotate(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - - /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */ - ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); PictTransform crtc_to_fb; struct pict_f_transform f_crtc_to_fb, f_fb_to_crtc; xFixed *new_params = NULL; diff --git a/xserver/hw/xfree86/os-support/Makefile.in b/xserver/hw/xfree86/os-support/Makefile.in index d856f2a10..7fdd064c4 100644 --- a/xserver/hw/xfree86/os-support/Makefile.in +++ b/xserver/hw/xfree86/os-support/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -246,13 +246,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -274,6 +270,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -298,6 +295,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -412,6 +410,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/os-support/bsd/Makefile.in b/xserver/hw/xfree86/os-support/bsd/Makefile.in index e9cae2794..61ad58c31 100644 --- a/xserver/hw/xfree86/os-support/bsd/Makefile.in +++ b/xserver/hw/xfree86/os-support/bsd/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -216,13 +216,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -244,6 +240,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -268,6 +265,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -382,6 +380,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/os-support/bsd/alpha_video.c b/xserver/hw/xfree86/os-support/bsd/alpha_video.c index 2fc482792..2da673c10 100644 --- a/xserver/hw/xfree86/os-support/bsd/alpha_video.c +++ b/xserver/hw/xfree86/os-support/bsd/alpha_video.c @@ -6,19 +6,19 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of + * documentation, and that the names of Rich Murphey and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or + * David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or * implied warranty. * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ @@ -67,6 +67,7 @@ memory_base(void) if (base == 0) { size_t len = sizeof(base); int error; + #ifdef __OpenBSD__ int mib[3]; @@ -76,11 +77,11 @@ memory_base(void) if ((error = sysctl(mib, 3, &base, &len, NULL, 0)) < 0) #else - if ((error = sysctlbyname("hw.chipset.memory", &base, &len, - 0, 0)) < 0) + if ((error = sysctlbyname("hw.chipset.memory", &base, &len, 0, 0)) < 0) #endif FatalError("xf86MapVidMem: can't find memory\n"); } + return base; } @@ -90,6 +91,7 @@ has_bwx(void) static int bwx = 0; size_t len = sizeof(bwx); int error; + #ifdef __OpenBSD__ int mib[3]; @@ -108,9 +110,9 @@ has_bwx(void) return bwx; #endif } -#else /* __NetBSD__ */ +#else /* __NetBSD__ */ static unsigned long hae_thresh = (1UL << 24); -static unsigned long hae_mask = 0xf8000000UL; /* XXX - should use xf86AXP.c */ +static unsigned long hae_mask = 0xf8000000UL; /* XXX - should use xf86AXP.c */ static struct alpha_bus_window *abw; static int abw_count = -1; @@ -130,8 +132,7 @@ has_bwx(void) if (abw_count < 0) init_abw(); - xf86Msg(X_INFO, "has_bwx = %d\n", - abw[0].abw_abst.abst_flags & ABST_BWX ? 1 : 0); /* XXXX */ + xf86Msg(X_INFO, "has_bwx = %d\n", abw[0].abw_abst.abst_flags & ABST_BWX ? 1 : 0); /* XXXX */ return abw[0].abw_abst.abst_flags & ABST_BWX; } @@ -142,8 +143,7 @@ dense_base(void) init_abw(); /* XXX check abst_flags for ABST_DENSE just to be safe? */ - xf86Msg(X_INFO, "dense base = %#lx\n", - abw[0].abw_abst.abst_sys_start); /* XXXX */ + xf86Msg(X_INFO, "dense base = %#lx\n", abw[0].abw_abst.abst_sys_start); /* XXXX */ return abw[0].abw_abst.abst_sys_start; } @@ -163,23 +163,23 @@ memory_base(void) return 0; } } -#endif /* __NetBSD__ */ +#endif /* __NetBSD__ */ -#define BUS_BASE dense_base() -#define BUS_BASE_BWX memory_base() +#define BUS_BASE dense_base() +#define BUS_BASE_BWX memory_base() /***************************************************************************/ /* Video Memory Mapping section */ /***************************************************************************/ #ifdef __OpenBSD__ -#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n" \ +#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\ "\tin /etc/sysctl.conf and reboot your machine\n" \ "\trefer to xf86(4) for details" #endif static Bool useDevMem = FALSE; -static int devMemFd = -1; +static int devMemFd = -1; #ifdef HAS_APERTURE_DRV #define DEV_APERTURE "/dev/xf86" @@ -209,11 +209,11 @@ checkDevMem(Bool warn) /* Try the aperture driver first */ if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, - MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); + base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE, + MAP_FLAGS, fd, (off_t) 0xA0000 + BUS_BASE); if (base != MAP_FAILED) { - munmap((caddr_t)base, 4096); + munmap((caddr_t) base, 4096); devMemFd = fd; useDevMem = TRUE; xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n", @@ -230,11 +230,11 @@ checkDevMem(Bool warn) #endif if ((fd = open(DEV_MEM, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, - MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); + base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE, + MAP_FLAGS, fd, (off_t) 0xA0000 + BUS_BASE); if (base != MAP_FAILED) { - munmap((caddr_t)base, 4096); + munmap((caddr_t) base, 4096); devMemFd = fd; useDevMem = TRUE; return; @@ -254,11 +254,11 @@ checkDevMem(Bool warn) #ifndef __OpenBSD__ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno)); -#else /* __OpenBSD__ */ +#else /* __OpenBSD__ */ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" "\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno), SYSCTL_MSG); -#endif /* __OpenBSD__ */ +#endif /* __OpenBSD__ */ #endif xf86ErrorF("\tlinear framebuffer access unavailable\n"); } @@ -273,12 +273,12 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) pVidMem->linearSupported = useDevMem; if (has_bwx()) { - xf86Msg(X_PROBED,"Machine type has 8/16 bit access\n"); + xf86Msg(X_PROBED, "Machine type has 8/16 bit access\n"); pVidMem->mapMem = mapVidMem; pVidMem->unmapMem = unmapVidMem; } else { - xf86Msg(X_PROBED,"Machine needs sparse mapping\n"); + xf86Msg(X_PROBED, "Machine needs sparse mapping\n"); pVidMem->mapMem = mapVidMemSparse; pVidMem->unmapMem = unmapVidMemSparse; #ifndef __NetBSD__ @@ -286,7 +286,7 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) axpSystem = bsdGetAXP(); hae_thresh = xf86AXPParams[axpSystem].hae_thresh; hae_mask = xf86AXPParams[axpSystem].hae_mask; -#endif /* __NetBSD__ */ +#endif /* __NetBSD__ */ } pVidMem->initialised = TRUE; } @@ -297,35 +297,33 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) pointer base; checkDevMem(FALSE); - Base = Base & ((1L<<32) - 1); + Base = Base & ((1L << 32) - 1); if (useDevMem) { if (devMemFd < 0) { FatalError("xf86MapVidMem: failed to open %s (%s)\n", DEV_MEM, strerror(errno)); } - base = mmap((caddr_t)0, Size, + base = mmap((caddr_t) 0, Size, (flags & VIDMEM_READONLY) ? PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX); + MAP_FLAGS, devMemFd, (off_t) Base + BUS_BASE_BWX); if (base == MAP_FAILED) { FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)\n", - "xf86MapVidMem", DEV_MEM, Size, Base, - strerror(errno)); + "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno)); } return base; } /* else, mmap /dev/vga */ - if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000) { + if ((unsigned long) Base < 0xA0000 || (unsigned long) Base >= 0xC0000) { FatalError("%s: Address 0x%lx outside allowable range\n", "xf86MapVidMem", Base); } base = mmap(0, Size, (flags & VIDMEM_READONLY) ? PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FLAGS, xf86Info.consoleFd, - (unsigned long)Base + BUS_BASE); + MAP_FLAGS, xf86Info.consoleFd, (unsigned long) Base + BUS_BASE); if (base == MAP_FAILED) { FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n", strerror(errno)); @@ -336,7 +334,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) static void unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) { - munmap((caddr_t)Base, Size); + munmap((caddr_t) Base, Size); } /* @@ -360,20 +358,21 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, Offset += Base & (psize - 1); Base &= ~(psize - 1); mlen = (Offset + Len + psize - 1) & ~(psize - 1); - ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, - MAP_SHARED, devMemFd, (off_t)Base+BUS_BASE); - if ((long)ptr == -1) { + ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ, + MAP_SHARED, devMemFd, (off_t) Base + BUS_BASE); + if ((long) ptr == -1) { xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n", DEV_MEM, Len, Base, Offset, strerror(errno)); return -1; } #ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", - Base, ptr[0] | (ptr[1] << 8)); + xf86MsgVerb(X_INFO, 3, + "xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", Base, + ptr[0] | (ptr[1] << 8)); #endif - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); + (void) memcpy(Buf, (void *) (ptr + Offset), Len); + (void) munmap((caddr_t) ptr, mlen); #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)" "-> %02x %02x %02x %02x...\n", @@ -382,7 +381,6 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, return Len; } - #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) extern int ioperm(unsigned long from, unsigned long num, int on); @@ -401,7 +399,7 @@ xf86DisableIO() return; } -#endif /* __FreeBSD_kernel__ || __OpenBSD__ */ +#endif /* __FreeBSD_kernel__ || __OpenBSD__ */ #ifdef USE_ALPHA_PIO @@ -418,7 +416,7 @@ xf86DisableIO() alpha_pci_io_enable(0); } -#endif /* USE_ALPHA_PIO */ +#endif /* USE_ALPHA_PIO */ #define vuip volatile unsigned int * @@ -429,33 +427,33 @@ extern int readDense8(pointer Base, register unsigned long Offset); extern int readDense16(pointer Base, register unsigned long Offset); extern int readDense32(pointer Base, register unsigned long Offset); extern void -writeDenseNB8(int Value, pointer Base, register unsigned long Offset); + writeDenseNB8(int Value, pointer Base, register unsigned long Offset); extern void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset); + writeDenseNB16(int Value, pointer Base, register unsigned long Offset); extern void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset); + writeDenseNB32(int Value, pointer Base, register unsigned long Offset); extern void -writeDense8(int Value, pointer Base, register unsigned long Offset); + writeDense8(int Value, pointer Base, register unsigned long Offset); extern void -writeDense16(int Value, pointer Base, register unsigned long Offset); + writeDense16(int Value, pointer Base, register unsigned long Offset); extern void -writeDense32(int Value, pointer Base, register unsigned long Offset); + writeDense32(int Value, pointer Base, register unsigned long Offset); static int readSparse8(pointer Base, register unsigned long Offset); static int readSparse16(pointer Base, register unsigned long Offset); static int readSparse32(pointer Base, register unsigned long Offset); static void -writeSparseNB8(int Value, pointer Base, register unsigned long Offset); + writeSparseNB8(int Value, pointer Base, register unsigned long Offset); static void -writeSparseNB16(int Value, pointer Base, register unsigned long Offset); + writeSparseNB16(int Value, pointer Base, register unsigned long Offset); static void -writeSparseNB32(int Value, pointer Base, register unsigned long Offset); + writeSparseNB32(int Value, pointer Base, register unsigned long Offset); static void -writeSparse8(int Value, pointer Base, register unsigned long Offset); + writeSparse8(int Value, pointer Base, register unsigned long Offset); static void -writeSparse16(int Value, pointer Base, register unsigned long Offset); + writeSparse16(int Value, pointer Base, register unsigned long Offset); static void -writeSparse32(int Value, pointer Base, register unsigned long Offset); + writeSparse32(int Value, pointer Base, register unsigned long Offset); #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) extern int sysarch(int, void *); @@ -474,13 +472,14 @@ sethae(u_int64_t hae) if (p.hae != hae) { p.hae = hae; - sysarch(ALPHA_SETHAE, (char *)&p); + sysarch(ALPHA_SETHAE, (char *) &p); } } #endif static pointer -mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) +mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, + int flags) { static Bool was_here = FALSE; @@ -499,21 +498,19 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags xf86ReadMmio16 = readSparse16; xf86ReadMmio32 = readSparse32; - memBase = mmap((caddr_t)0, 0x100000000, + memBase = mmap((caddr_t) 0, 0x100000000, PROT_READ | PROT_WRITE, - MAP_SHARED, devMemFd, - (off_t) BUS_BASE); - memSBase = mmap((caddr_t)0, 0x100000000, + MAP_SHARED, devMemFd, (off_t) BUS_BASE); + memSBase = mmap((caddr_t) 0, 0x100000000, PROT_READ | PROT_WRITE, - MAP_SHARED, devMemFd, - (off_t) BUS_BASE_BWX); + MAP_SHARED, devMemFd, (off_t) BUS_BASE_BWX); - if (memSBase == MAP_FAILED || memBase == MAP_FAILED) { + if (memSBase == MAP_FAILED || memBase == MAP_FAILED) { FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n", strerror(errno)); } } - return (pointer)((unsigned long)memBase + Base); + return (pointer) ((unsigned long) memBase + Base); } static void @@ -526,8 +523,9 @@ readSparse8(pointer Base, register unsigned long Offset) { register unsigned long result, shift; register unsigned long msb; + mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; + Offset += (unsigned long) Base - (unsigned long) memBase; shift = (Offset & 0x3) << 3; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; @@ -536,7 +534,7 @@ readSparse8(pointer Base, register unsigned long Offset) sethae(msb); #endif } - result = *(vuip) ((unsigned long)memSBase + (Offset << 5)); + result = *(vuip) ((unsigned long) memSBase + (Offset << 5)); result >>= shift; return 0xffUL & result; } @@ -548,7 +546,7 @@ readSparse16(pointer Base, register unsigned long Offset) register unsigned long msb; mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; + Offset += (unsigned long) Base - (unsigned long) memBase; shift = (Offset & 0x2) << 3; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; @@ -557,7 +555,8 @@ readSparse16(pointer Base, register unsigned long Offset) sethae(msb); #endif } - result = *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))); + result = + *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2))); result >>= shift; return 0xffffUL & result; } @@ -566,7 +565,7 @@ static int readSparse32(pointer Base, register unsigned long Offset) { mem_barrier(); - return *(vuip)((unsigned long)Base+(Offset)); + return *(vuip) ((unsigned long) Base + (Offset)); } static void @@ -576,7 +575,7 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset) register unsigned int b = Value & 0xffU; write_mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; + Offset += (unsigned long) Base - (unsigned long) memBase; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; Offset -= msb; @@ -584,7 +583,7 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset) sethae(msb); #endif } - *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; + *(vuip) ((unsigned long) memSBase + (Offset << 5)) = b * 0x01010101; } static void @@ -594,7 +593,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) register unsigned int w = Value & 0xffffU; write_mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; + Offset += (unsigned long) Base - (unsigned long) memBase; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; Offset -= msb; @@ -602,7 +601,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) sethae(msb); #endif } - *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = + *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2))) = w * 0x00010001; } @@ -611,7 +610,7 @@ static void writeSparse32(int Value, pointer Base, register unsigned long Offset) { write_mem_barrier(); - *(vuip)((unsigned long)Base + (Offset)) = Value; + *(vuip) ((unsigned long) Base + (Offset)) = Value; return; } @@ -621,7 +620,7 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset) register unsigned long msb; register unsigned int b = Value & 0xffU; - Offset += (unsigned long)Base - (unsigned long)memBase; + Offset += (unsigned long) Base - (unsigned long) memBase; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; Offset -= msb; @@ -629,7 +628,7 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset) sethae(msb); #endif } - *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; + *(vuip) ((unsigned long) memSBase + (Offset << 5)) = b * 0x01010101; } static void @@ -638,47 +637,47 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset) register unsigned long msb; register unsigned int w = Value & 0xffffU; - Offset += (unsigned long)Base - (unsigned long)memBase; + Offset += (unsigned long) Base - (unsigned long) memBase; if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask ; + msb = Offset & hae_mask; Offset -= msb; #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) sethae(msb); #endif } - *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = + *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2))) = w * 0x00010001; } static void writeSparseNB32(int Value, pointer Base, register unsigned long Offset) { - *(vuip)((unsigned long)Base + (Offset)) = Value; + *(vuip) ((unsigned long) Base + (Offset)) = Value; return; } -_X_EXPORT void (*xf86WriteMmio8)(int Value, pointer Base, unsigned long Offset) - = writeDense8; -_X_EXPORT void (*xf86WriteMmio16)(int Value, pointer Base, unsigned long Offset) - = writeDense16; -_X_EXPORT void (*xf86WriteMmio32)(int Value, pointer Base, unsigned long Offset) - = writeDense32; -_X_EXPORT void (*xf86WriteMmioNB8)(int Value, pointer Base, unsigned long Offset) - = writeDenseNB8; -_X_EXPORT void (*xf86WriteMmioNB16)(int Value, pointer Base, unsigned long Offset) - = writeDenseNB16; -_X_EXPORT void (*xf86WriteMmioNB32)(int Value, pointer Base, unsigned long Offset) - = writeDenseNB32; -_X_EXPORT int (*xf86ReadMmio8)(pointer Base, unsigned long Offset) - = readDense8; -_X_EXPORT int (*xf86ReadMmio16)(pointer Base, unsigned long Offset) - = readDense16; -_X_EXPORT int (*xf86ReadMmio32)(pointer Base, unsigned long Offset) - = readDense32; +void (*xf86WriteMmio8) (int Value, pointer Base, unsigned long Offset) + = writeDense8; +void (*xf86WriteMmio16) (int Value, pointer Base, unsigned long Offset) + = writeDense16; +void (*xf86WriteMmio32) (int Value, pointer Base, unsigned long Offset) + = writeDense32; +void (*xf86WriteMmioNB8) (int Value, pointer Base, unsigned long Offset) + = writeDenseNB8; +void (*xf86WriteMmioNB16) (int Value, pointer Base, unsigned long Offset) + = writeDenseNB16; +void (*xf86WriteMmioNB32) (int Value, pointer Base, unsigned long Offset) + = writeDenseNB32; +int (*xf86ReadMmio8) (pointer Base, unsigned long Offset) + = readDense8; +int (*xf86ReadMmio16) (pointer Base, unsigned long Offset) + = readDense16; +int (*xf86ReadMmio32) (pointer Base, unsigned long Offset) + = readDense32; /* - * Do all things that need root privileges early - * and revoke those priviledges + * Do all things that need root privileges early + * and revoke those priviledges */ _X_EXPORT void xf86PrivilegedInit(void) @@ -688,3 +687,4 @@ xf86PrivilegedInit(void) pci_system_init(); xf86OpenConsole(); } + diff --git a/xserver/hw/xfree86/os-support/bsd/arm_video.c b/xserver/hw/xfree86/os-support/bsd/arm_video.c index 0d9c41f6a..0c7db8edc 100644 --- a/xserver/hw/xfree86/os-support/bsd/arm_video.c +++ b/xserver/hw/xfree86/os-support/bsd/arm_video.c @@ -1,5 +1,5 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c,v 1.6 2003/10/07 23:14:55 herrb Exp $ */ -/* $OpenBSD: arm_video.c,v 1.9 2012/06/10 13:21:25 matthieu Exp $ */ +/* $OpenBSD: arm_video.c,v 1.5 2009/09/06 19:44:26 matthieu Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -119,13 +119,14 @@ ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) if (base == MAP_FAILED) FatalError("%s: could not mmap screen [s=%lx,a=%lx] (%s)", "xf86MapVidMem", Size, Base, strerror(errno)); - + return base; } static void ppcUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) { + munmap(Base, Size); } @@ -136,24 +137,24 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, int Len) { int rv; - + if (Base < 0x80000000) { xf86Msg(X_WARNING, "No VGA Base=%#lx\n", Base); return 0; } - + if (kmem == -1) { kmem = open(DEV_MEM, 2); if (kmem == -1) { FatalError("xf86ReadBIOS: open %s", DEV_MEM); } } - + #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n", Base, Offset, Len); #endif - + lseek(kmem, Base + Offset, 0); rv = read(kmem, Buf, Len); return rv; @@ -168,7 +169,7 @@ xf86PrivilegedInit(void) int mib[2]; char buf[128]; size_t len; - + mib[0] = CTL_HW; mib[1] = HW_MACHINE; len = sizeof(buf); @@ -195,58 +196,58 @@ xf86PrivilegedInit(void) */ arm_softfloat() { - void __adddf3(); - void __addsf3(); - void __eqdf2(); - void __eqsf2(); - void __extendsfdf2(); - void __fixdfsi(); - void __fixsfsi(); - void __fixunsdfsi(); - void __fixunssfsi(); - void __floatsidf(); - void __floatsisf(); - void __gedf2(); - void __gesf2(); - void __gtdf2(); - void __gtsf2(); - void __ledf2(); - void __lesf2(); - void __ltdf2(); - void __ltsf2(); - void __nedf2(); - void __negdf2(); - void __negsf2(); - void __nesf2(); - void __subdf3(); - void __subsf3(); - void __truncdfsf2(); - - __adddf3(); - __addsf3(); - __eqdf2(); - __eqsf2(); - __extendsfdf2(); - __fixdfsi(); - __fixsfsi(); - __fixunsdfsi(); - __fixunssfsi(); - __floatsidf(); - __floatsisf(); - __gedf2(); - __gesf2(); - __gtdf2(); - __gtsf2(); - __ledf2(); - __lesf2(); - __ltdf2(); - __ltsf2(); - __nedf2(); - __negdf2(); - __negsf2(); - __nesf2(); - __subdf3(); - __subsf3(); - __truncdfsf2(); +void __adddf3(); +void __addsf3(); +void __eqdf2(); +void __eqsf2(); +void __extendsfdf2(); +void __fixdfsi(); +void __fixsfsi(); +void __fixunsdfsi(); +void __fixunssfsi(); +void __floatsidf(); +void __floatsisf(); +void __gedf2(); +void __gesf2(); +void __gtdf2(); +void __gtsf2(); +void __ledf2(); +void __lesf2(); +void __ltdf2(); +void __ltsf2(); +void __nedf2(); +void __negdf2(); +void __negsf2(); +void __nesf2(); +void __subdf3(); +void __subsf3(); +void __truncdfsf2(); + +__adddf3(); +__addsf3(); +__eqdf2(); +__eqsf2(); +__extendsfdf2(); +__fixdfsi(); +__fixsfsi(); +__fixunsdfsi(); +__fixunssfsi(); +__floatsidf(); +__floatsisf(); +__gedf2(); +__gesf2(); +__gtdf2(); +__gtsf2(); +__ledf2(); +__lesf2(); +__ltdf2(); +__ltsf2(); +__nedf2(); +__negdf2(); +__negsf2(); +__nesf2(); +__subdf3(); +__subsf3(); +__truncdfsf2(); } #endif /* __VFP_FP__ */ diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_agp.c b/xserver/hw/xfree86/os-support/bsd/bsd_agp.c index c32a5bc56..745124e2b 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_agp.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_agp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bsd_agp.c,v 1.5 2012/06/10 13:21:25 matthieu Exp $ */ +/* $OpenBSD: bsd_agp.c,v 1.4 2011/01/28 19:34:22 matthieu Exp $ */ /* * Abstraction of the AGP GART interface. * diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_apm.c b/xserver/hw/xfree86/os-support/bsd/bsd_apm.c index a8a4164e0..b1938cf0d 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_apm.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_apm.c @@ -21,21 +21,19 @@ static struct { u_int apmBsd; pmEvent xf86; } bsdToXF86Array[] = { - { - APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, { - APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, { - APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, { - APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, { - APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, { - APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, { - APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, { - APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, { - APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, { - APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, { - APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, + {APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, + {APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, + {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, + {APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, + {APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, + {APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, + {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, + {APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, + {APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, + {APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, + {APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, #ifdef APM_CAPABILITY_CHANGE - { - APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, + {APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, #endif }; diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_init.c b/xserver/hw/xfree86/os-support/bsd/bsd_init.c index b78912191..0c4501a25 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_init.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_init.c @@ -47,7 +47,9 @@ static Bool KeepTty = FALSE; +#ifdef PCCONS_SUPPORT static int devConsoleFd = -1; +#endif #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) static int VTnum = -1; static int initialVT = -1; @@ -104,7 +106,6 @@ static char *supported_drivers[] = { #endif }; - /* * Functions to probe for the existance of a supported console driver. * Any function returns either a valid file descriptor (driver probed @@ -113,19 +114,19 @@ static char *supported_drivers[] = { * an X server. */ -typedef int (*xf86ConsOpen_t)(void); +typedef int (*xf86ConsOpen_t) (void); #ifdef PCCONS_SUPPORT static int xf86OpenPccons(void); -#endif /* PCCONS_SUPPORT */ +#endif /* PCCONS_SUPPORT */ #ifdef SYSCONS_SUPPORT static int xf86OpenSyscons(void); -#endif /* SYSCONS_SUPPORT */ +#endif /* SYSCONS_SUPPORT */ #ifdef PCVT_SUPPORT static int xf86OpenPcvt(void); -#endif /* PCVT_SUPPORT */ +#endif /* PCVT_SUPPORT */ #ifdef WSCONS_SUPPORT static int xf86OpenWScons(void); @@ -150,17 +151,18 @@ static xf86ConsOpen_t xf86ConsTab[] = { #ifdef WSCONS_SUPPORT xf86OpenWScons, #endif - (xf86ConsOpen_t)NULL + (xf86ConsOpen_t) NULL }; - void xf86OpenConsole() { int i, fd = -1; xf86ConsOpen_t *driver; + #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) int result; + #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) struct utsname uts; #endif @@ -171,50 +173,50 @@ xf86OpenConsole() return; } if (serverGeneration == 1) { - /* check if we are run with euid==0 */ - if (geteuid() != 0 && issetugid()) { - FatalError("xf86OpenConsole: Server must either be suid root" + /* check if we are run with euid==0 */ + if (geteuid() != 0 && issetugid()) { + FatalError("xf86OpenConsole: Server must either be suid root" " or without privileges at all"); - } - - if (!KeepTty) { - /* - * detaching the controlling tty solves problems of kbd character - * loss. This is not interesting for CO driver, because it is - * exclusive. - */ - setpgrp(0, getpid()); - if ((i = open("/dev/tty",O_RDWR)) >= 0) { - ioctl(i,TIOCNOTTY,(char *)0); - close(i); - } - } - - /* detect which driver we are running on */ - for (driver = xf86ConsTab; *driver; driver++) { - if ((fd = (*driver)()) >= 0) - break; - } - - /* Check that a supported console driver was found */ - if (fd < 0) { - char cons_drivers[80] = {0, }; - for (i = 0; i < sizeof(supported_drivers) / sizeof(char *); i++) { - if (i) { - strcat(cons_drivers, ", "); - } - strcat(cons_drivers, supported_drivers[i]); - } - FatalError - ("%s: No console driver found\n\tSupported drivers: %s\n\t%s", - "xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG); - } - xf86Info.consoleFd = fd; - - switch (xf86Info.consType) { + } + + if (!KeepTty) { + /* + * detaching the controlling tty solves problems of kbd character + * loss. This is not interesting for CO driver, because it is + * exclusive. + */ + setpgrp(0, getpid()); + if ((i = open("/dev/tty",O_RDWR)) >= 0) { + ioctl(i,TIOCNOTTY,(char *)0); + close(i); + } + } + + /* detect which driver we are running on */ + for (driver = xf86ConsTab; *driver; driver++) { + if ((fd = (*driver)()) >= 0) + break; + } + + /* Check that a supported console driver was found */ + if (fd < 0) { + char cons_drivers[80] = {0, }; + for (i = 0; i < sizeof(supported_drivers) / sizeof(char *); i++) { + if (i) { + strcat(cons_drivers, ", "); + } + strcat(cons_drivers, supported_drivers[i]); + } + FatalError( + "%s: No console driver found\n\tSupported drivers: %s\n\t%s", + "xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG); + } + xf86Info.consoleFd = fd; + + switch (xf86Info.consType) { #ifdef PCCONS_SUPPORT case PCCONS: - if (ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_ON, 0) < 0) { + if (ioctl(xf86Info.consoleFd, CONSOLE_X_MODE_ON, 0) < 0) { FatalError("%s: CONSOLE_X_MODE_ON failed (%s)\n%s", "xf86OpenConsole", strerror(errno), CHECK_DRIVER_MSG); @@ -223,7 +225,7 @@ xf86OpenConsole() * Hack to prevent keyboard hanging when syslogd closes * /dev/console */ - if ((devConsoleFd = open("/dev/console", O_WRONLY,0)) < 0) { + if ((devConsoleFd = open("/dev/console", O_WRONLY, 0)) < 0) { xf86Msg(X_WARNING, "xf86OpenConsole: couldn't open /dev/console (%s)\n", strerror(errno)); @@ -235,31 +237,32 @@ xf86OpenConsole() /* as of FreeBSD 2.2.8, syscons driver does not need the #1 vt * switching anymore. Here we check for FreeBSD 3.1 and up. * Add cases for other *BSD that behave the same. - */ + */ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - uname (&uts); + uname(&uts); i = atof(uts.release) * 100; - if (i >= 310) goto acquire_vt; + if (i >= 310) + goto acquire_vt; #endif /* otherwise fall through */ case PCVT: #if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 200000000)) /* - * First activate the #1 VT. This is a hack to allow a server - * to be started while another one is active. There should be - * a better way. - */ - if (initialVT != 1) { - - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0) { - xf86Msg(X_WARNING, + * First activate the #1 VT. This is a hack to allow a server + * to be started while another one is active. There should be + * a better way. + */ + if (initialVT != 1) { + + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0) { + xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - sleep(1); - } + } + sleep(1); + } #endif acquire_vt: - if (!xf86Info.ShareVTs) { + if (!xf86Info.ShareVTs) { /* * now get the VT */ @@ -275,7 +278,7 @@ acquire_vt: } signal(SIGUSR2, xf86VTRequest); - + vtmode.mode = VT_PROCESS; vtmode.relsig = SIGUSR2; vtmode.acqsig = SIGUSR2; @@ -292,21 +295,21 @@ acquire_vt: if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) { FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed"); } - } + } else { /* xf86Info.ShareVTs */ close(xf86Info.consoleFd); - } - break; + } + break; #endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ #ifdef WSCONS_SUPPORT - case WSCONS: - /* Nothing to do */ - break; + case WSCONS: + /* Nothing to do */ + break; #endif } } else { - /* serverGeneration != 1 */ + /* serverGeneration != 1 */ #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) if (!xf86Info.ShareVTs && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)) { @@ -314,12 +317,11 @@ acquire_vt: xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); } } -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ +#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ } return; } - #ifdef PCCONS_SUPPORT static int @@ -328,16 +330,14 @@ xf86OpenPccons() int fd = -1; if ((fd = open(PCCONS_CONSOLE_DEV1, PCCONS_CONSOLE_MODE, 0)) - >= 0 || - (fd = open(PCCONS_CONSOLE_DEV2, PCCONS_CONSOLE_MODE, 0)) + >= 0 || (fd = open(PCCONS_CONSOLE_DEV2, PCCONS_CONSOLE_MODE, 0)) >= 0) { if (ioctl(fd, CONSOLE_X_MODE_OFF, 0) < 0) { - FatalError( - "%s: CONSOLE_X_MODE_OFF failed (%s)\n%s\n%s", - "xf86OpenPccons", - strerror(errno), - "Was expecting pccons driver with X support", - CHECK_DRIVER_MSG); + FatalError("%s: CONSOLE_X_MODE_OFF failed (%s)\n%s\n%s", + "xf86OpenPccons", + strerror(errno), + "Was expecting pccons driver with X support", + CHECK_DRIVER_MSG); } xf86Info.consType = PCCONS; xf86Msg(X_PROBED, "Using pccons driver with X support\n"); @@ -345,7 +345,7 @@ xf86OpenPccons() return fd; } -#endif /* PCCONS_SUPPORT */ +#endif /* PCCONS_SUPPORT */ #ifdef SYSCONS_SUPPORT @@ -394,68 +394,67 @@ xf86OpenSyscons() xf86Info.vtno = -1; } #if 0 - } + } #endif - - if (xf86Info.vtno == -1) { - /* - * All VTs are in use. If initialVT was found, use it. - */ - if (initialVT != -1) { - xf86Info.vtno = initialVT; - } + + if (xf86Info.vtno == -1) { + /* + * All VTs are in use. If initialVT was found, use it. + */ + if (initialVT != -1) { + xf86Info.vtno = initialVT; + } else { - if (syscons_version >= 0x100) { - FatalError("%s: Cannot find a free VT", - "xf86OpenSyscons"); - } - /* Should no longer reach here */ - FatalError("%s: %s %s\n\t%s %s", - "xf86OpenSyscons", - "syscons versions prior to 1.0 require", - "either the", - "server's stdin be a VT", - "or the use of the vtxx server option"); - } - } - from = X_PROBED; - } - - close(fd); + if (syscons_version >= 0x100) { + FatalError("%s: Cannot find a free VT", + "xf86OpenSyscons"); + } + /* Should no longer reach here */ + FatalError("%s: %s %s\n\t%s %s", + "xf86OpenSyscons", + "syscons versions prior to 1.0 require", + "either the", + "server's stdin be a VT", + "or the use of the vtxx server option"); + } + } + from = X_PROBED; + } + + close(fd); #ifndef __OpenBSD__ - snprintf(vtname, sizeof(vtname), "/dev/ttyv%01x", xf86Info.vtno - 1); + snprintf(vtname, sizeof(vtname), "/dev/ttyv%01x", xf86Info.vtno - 1); #else - sprintf(vtname, sizeof(vtname), "/dev/ttyC%01x", xf86Info.vtno - 1); -#endif - if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0) { - FatalError("xf86OpenSyscons: Cannot open %s (%s)", - vtname, strerror(errno)); - } - if (ioctl(fd, VT_GETMODE, &vtmode) < 0) { - FatalError("xf86OpenSyscons: VT_GETMODE failed"); - } - xf86Info.consType = SYSCONS; - xf86Msg(X_PROBED, "Using syscons driver with X support"); - if (syscons_version >= 0x100) { - xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8, - syscons_version & 0xFF); - } + sprintf(vtname, sizeof(vtname), "/dev/ttyC%01x", xf86Info.vtno - 1); +#endif + if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0) { + FatalError("xf86OpenSyscons: Cannot open %s (%s)", + vtname, strerror(errno)); + } + if (ioctl(fd, VT_GETMODE, &vtmode) < 0) { + FatalError("xf86OpenSyscons: VT_GETMODE failed"); + } + xf86Info.consType = SYSCONS; + xf86Msg(X_PROBED, "Using syscons driver with X support"); + if (syscons_version >= 0x100) { + xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8, + syscons_version & 0xFF); + } else { - xf86ErrorF(" (version 0.x)\n"); - } - xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); - } + xf86ErrorF(" (version 0.x)\n"); + } + xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); + } else { - /* VT_GETMODE failed, probably not syscons */ - close(fd); - fd = -1; - } + /* VT_GETMODE failed, probably not syscons */ + close(fd); + fd = -1; + } } return fd; } -#endif /* SYSCONS_SUPPORT */ - +#endif /* SYSCONS_SUPPORT */ #ifdef PCVT_SUPPORT @@ -475,11 +474,11 @@ xf86OpenPcvt() #endif if (VTnum != -1) { - snprintf(vtname, sizeof(vtname), "%s%x", vtprefix, VTnum - 1); - fd = open(vtname, PCVT_CONSOLE_MODE, 0); - } + snprintf(vtname, sizeof(vtname), "%s%x", vtprefix, VTnum - 1); + fd = open(vtname, PCVT_CONSOLE_MODE, 0); + } else { - fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0); + fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0); } #ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV if (fd < 0) { @@ -488,55 +487,55 @@ xf86OpenPcvt() } #endif if (fd >= 0) { - if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0) { - if(ioctl(fd, VT_GETMODE, &vtmode) < 0) { - FatalError("%s: VT_GETMODE failed\n%s%s\n%s", - "xf86OpenPcvt", - "Found pcvt driver but X11 seems to be", - " not supported.", CHECK_DRIVER_MSG); - } - - xf86Info.vtno = VTnum; - - if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0) - initialVT = -1; - - if (xf86Info.vtno == -1) { - if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) { - /* No free VTs */ - xf86Info.vtno = -1; - } - - if (xf86Info.vtno == -1) { - /* - * All VTs are in use. If initialVT was found, use it. - */ - if (initialVT != -1) { - xf86Info.vtno = initialVT; - } + if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0) { + if(ioctl(fd, VT_GETMODE, &vtmode) < 0) { + FatalError("%s: VT_GETMODE failed\n%s%s\n%s", + "xf86OpenPcvt", + "Found pcvt driver but X11 seems to be", + " not supported.", CHECK_DRIVER_MSG); + } + + xf86Info.vtno = VTnum; + + if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0) + initialVT = -1; + + if (xf86Info.vtno == -1) { + if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) { + /* No free VTs */ + xf86Info.vtno = -1; + } + + if (xf86Info.vtno == -1) { + /* + * All VTs are in use. If initialVT was found, use it. + */ + if (initialVT != -1) { + xf86Info.vtno = initialVT; + } else { - FatalError("%s: Cannot find a free VT", - "xf86OpenPcvt"); - } - } - } + FatalError("%s: Cannot find a free VT", + "xf86OpenPcvt"); + } + } + } - close(fd); + close(fd); snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1); - if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) { - ErrorF("xf86OpenPcvt: Cannot open %s (%s)", - vtname, strerror(errno)); - xf86Info.vtno = initialVT; - snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1); - if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) { - FatalError("xf86OpenPcvt: Cannot open %s (%s)", - vtname, strerror(errno)); - } - } - if (ioctl(fd, VT_GETMODE, &vtmode) < 0) { - FatalError("xf86OpenPcvt: VT_GETMODE failed"); - } - xf86Info.consType = PCVT; + if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) { + ErrorF("xf86OpenPcvt: Cannot open %s (%s)", + vtname, strerror(errno)); + xf86Info.vtno = initialVT; + snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1); + if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) { + FatalError("xf86OpenPcvt: Cannot open %s (%s)", + vtname, strerror(errno)); + } + } + if (ioctl(fd, VT_GETMODE, &vtmode) < 0) { + FatalError("xf86OpenPcvt: VT_GETMODE failed"); + } + xf86Info.consType = PCVT; #ifdef WSCONS_SUPPORT xf86Msg(X_PROBED, "Using wscons driver on %s in pcvt compatibility mode " @@ -556,7 +555,7 @@ xf86OpenPcvt() return fd; } -#endif /* PCVT_SUPPORT */ +#endif /* PCVT_SUPPORT */ #ifdef WSCONS_SUPPORT @@ -576,31 +575,30 @@ xf86OpenWScons() mib[1] = KERN_CONSDEV; len = sizeof(dev); if (sysctl(mib, 2, &dev, &len, NULL, 0) != -1) { - snprintf(ttyname, sizeof(ttyname), "/dev/%s", devname(dev, S_IFCHR)); - if ((fd = open(ttyname, 2)) != -1) { - if (ioctl(fd, WSDISPLAYIO_GTYPE, &i) == -1) { - close(fd); - fd = -1; - } - } + snprintf(ttyname, sizeof(ttyname), "/dev/%s", devname(dev, S_IFCHR)); + if ((fd = open(ttyname, 2)) != -1) { + if (ioctl(fd, WSDISPLAYIO_GTYPE, &i) == -1) { + close(fd); + fd = -1; + } + } } #endif if (fd == -1) { - for (i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) { #if defined(__NetBSD__) - snprintf(ttyname, sizeof(ttyname), "/dev/ttyE%d", i); + snprintf(ttyname, sizeof(ttyname), "/dev/ttyE%d", i); #elif defined(__OpenBSD__) - snprintf(ttyname, sizeof(ttyname), "/dev/ttyC%x", i); + snprintf(ttyname, sizeof(ttyname), "/dev/ttyC%x", i); #endif - if ((fd = open(ttyname, 2)) != -1) - break; + if ((fd = open(ttyname, 2)) != -1) + break; } } if (fd != -1) { if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) < 0) { FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s", - "xf86OpenConsole", strerror(errno), - CHECK_DRIVER_MSG); + "xf86OpenConsole", strerror(errno), CHECK_DRIVER_MSG); } xf86Info.consType = WSCONS; xf86Msg(X_PROBED, "Using wscons driver\n"); @@ -608,23 +606,24 @@ xf86OpenWScons() return fd; } -#endif /* WSCONS_SUPPORT */ +#endif /* WSCONS_SUPPORT */ void xf86CloseConsole() { #if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) - struct vt_mode VT; + struct vt_mode VT; #endif - if (xf86Info.ShareVTs) return; + if (xf86Info.ShareVTs) + return; switch (xf86Info.consType) { #ifdef PCCONS_SUPPORT case PCCONS: - ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_OFF, 0); + ioctl(xf86Info.consoleFd, CONSOLE_X_MODE_OFF, 0); break; -#endif /* PCCONS_SUPPORT */ +#endif /* PCCONS_SUPPORT */ #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) case SYSCONS: case PCVT: @@ -633,7 +632,7 @@ xf86CloseConsole() VT.mode = VT_AUTO; ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */ } -#if !defined(OpenBSD) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL) +#if !defined(__OpenBSD__) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL) if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0) { xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)", strerror(errno)); @@ -642,13 +641,15 @@ xf86CloseConsole() if (initialVT != -1) ioctl(xf86Info.consoleFd, VT_ACTIVATE, initialVT); break; -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ +#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ #ifdef WSCONS_SUPPORT - case WSCONS: { + case WSCONS: + { int mode = WSDISPLAYIO_MODE_EMUL; + ioctl(xf86Info.consoleFd, WSDISPLAYIO_SMODE, &mode); break; - } + } #endif } @@ -667,7 +668,7 @@ int xf86ProcessArgument(int argc, char *argv[], int i) { /* - * Keep server from detaching from controlling tty. This is useful + * Keep server from detaching from controlling tty. This is useful * when debugging (so the server can receive keyboard signals. */ if (!strcmp(argv[i], "-keeptty")) { @@ -676,15 +677,14 @@ xf86ProcessArgument(int argc, char *argv[], int i) } #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) if ((argv[i][0] == 'v') && (argv[i][1] == 't')) { - if (sscanf(argv[i], "vt%2d", &VTnum) == 0 || - VTnum < 1 || VTnum > 12) { + if (sscanf(argv[i], "vt%2d", &VTnum) == 0 || VTnum < 1 || VTnum > 12) { UseMsg(); VTnum = -1; return 0; } return 1; } -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ +#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ return 0; } @@ -693,7 +693,7 @@ xf86UseMsg() { #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) ErrorF("vtXX use the specified VT number (1-12)\n"); -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ +#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ ErrorF("-keeptty "); ErrorF("don't detach controlling tty (for debugging only)\n"); return; @@ -709,29 +709,29 @@ xf86UseMsg() void xf86DropPriv(char *disp) { - struct passwd *pw; - - /* revoke privileges */ - if (getuid() == 0) { - /* Running as root */ - pw = getpwnam("_x11"); - if (!pw) - return; - /* give away lock file to unpriviledged user */ - if (ChownLock(pw->pw_uid, pw->pw_gid) == -1) { - FatalError("Chown Lock"); - } - - /* Start privileged child */ - if (priv_init(pw->pw_uid, pw->pw_gid) == -1) { - FatalError("priv_init"); - } - } - else { - /* Normal user */ - if (priv_init(getuid(), getgid()) == -1) { - FatalError("priv_init"); - } - } + struct passwd *pw; + + /* revoke privileges */ + if (getuid() == 0) { + /* Running as root */ + pw = getpwnam("_x11"); + if (!pw) + return; + /* give away lock file to unpriviledged user */ + if (ChownLock(pw->pw_uid, pw->pw_gid) == -1) { + FatalError("Chown Lock"); + } + + /* Start privileged child */ + if (priv_init(pw->pw_uid, pw->pw_gid) == -1) { + FatalError("priv_init"); + } + } + else { + /* Normal user */ + if (priv_init(getuid(), getgid()) == -1) { + FatalError("priv_init"); + } + } } #endif diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c b/xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c index 79703c5d7..8417c335a 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c @@ -54,21 +54,19 @@ static struct { u_int apmBsd; pmEvent xf86; } bsdToXF86Array[] = { - { - APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, { - APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, { - APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, { - APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, { - APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, { - APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, { - APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, { - APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, { - APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, { - APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, { - APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, + {APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, + {APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, + {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, + {APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, + {APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, + {APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, + {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, + {APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, + {APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, + {APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, + {APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, #ifdef APM_CAPABILITY_CHANGE - { - APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, + {APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, #endif }; diff --git a/xserver/hw/xfree86/os-support/bsd/hp300_video.c b/xserver/hw/xfree86/os-support/bsd/hp300_video.c index 83292e202..757b65348 100644 --- a/xserver/hw/xfree86/os-support/bsd/hp300_video.c +++ b/xserver/hw/xfree86/os-support/bsd/hp300_video.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hp300_video.c,v 1.4 2012/06/16 15:08:08 matthieu Exp $ */ +/* $OpenBSD: hp300_video.c,v 1.3 2008/02/16 21:40:29 miod Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> diff --git a/xserver/hw/xfree86/os-support/bsd/hppa_video.c b/xserver/hw/xfree86/os-support/bsd/hppa_video.c index 111eec527..3054b7b85 100644 --- a/xserver/hw/xfree86/os-support/bsd/hppa_video.c +++ b/xserver/hw/xfree86/os-support/bsd/hppa_video.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hppa_video.c,v 1.7 2012/06/16 15:08:08 matthieu Exp $ */ +/* $OpenBSD: hppa_video.c,v 1.2 2009/12/18 22:47:56 matthieu Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> diff --git a/xserver/hw/xfree86/os-support/bsd/i386_video.c b/xserver/hw/xfree86/os-support/bsd/i386_video.c index f7057c625..3141e27c1 100644 --- a/xserver/hw/xfree86/os-support/bsd/i386_video.c +++ b/xserver/hw/xfree86/os-support/bsd/i386_video.c @@ -65,12 +65,12 @@ #ifdef __OpenBSD__ #define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\ - "\tin /etc/sysctl.conf and reboot your machine\n" \ - "\trefer to xf86(4) for details\n" + "\tin /etc/sysctl.conf and reboot your machine\n" \ + "\trefer to xf86(4) for details\n" #define SYSCTL_MSG2 \ - "Check that you have set 'machdep.allowaperture=2'\n" \ - "\tin /etc/sysctl.conf and reboot your machine\n" \ - "\trefer to xf86(4) for details\n" + "Check that you have set 'machdep.allowaperture=2'\n" \ + "\tin /etc/sysctl.conf and reboot your machine\n" \ + "\trefer to xf86(4) for details\n" #endif /***************************************************************************/ @@ -78,7 +78,7 @@ /***************************************************************************/ static Bool useDevMem = FALSE; -static int devMemFd = -1; +static int devMemFd = -1; #ifdef HAS_APERTURE_DRV #define DEV_APERTURE "/dev/xf86" @@ -108,18 +108,18 @@ checkDevMem(Bool warn) static Bool devMemChecked = FALSE; int fd; pointer base; - + if (devMemChecked) return; devMemChecked = TRUE; - + #ifdef HAS_APERTURE_DRV /* Try the aperture driver first */ if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, MAP_FLAGS, fd, (off_t)0xA0000); - + if (base != MAP_FAILED) { munmap((caddr_t)base, 4096); devMemFd = fd; @@ -140,7 +140,7 @@ checkDevMem(Bool warn) /* Try to map a page at the VGA address */ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, MAP_FLAGS, fd, (off_t)0xA0000); - + if (base != MAP_FAILED) { munmap((caddr_t)base, 4096); devMemFd = fd; @@ -162,13 +162,13 @@ checkDevMem(Bool warn) #else #ifndef __OpenBSD__ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" - "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno)); + "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno)); #else /* __OpenBSD__ */ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" "\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno), SYSCTL_MSG); #endif /* __OpenBSD__ */ - + xf86ErrorF("\tlinear framebuffer access unavailable\n"); } useDevMem = FALSE; @@ -206,9 +206,9 @@ static pointer mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { pointer base; - + checkDevMem(FALSE); - + if (useDevMem) { if (devMemFd < 0) { FatalError("xf86MapVidMem: failed to open %s (%s)", @@ -246,7 +246,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) static void unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) { - munmap((caddr_t)Base, Size); + munmap((caddr_t) Base, Size); } /* @@ -260,12 +260,12 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, unsigned char *ptr; int psize; int mlen; - + checkDevMem(TRUE); if (devMemFd == -1) { return -1; } - + psize = getpagesize(); Offset += Base & (psize - 1); Base &= ~(psize - 1); @@ -287,8 +287,8 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", Base, ptr[0] | (ptr[1] << 8)); #endif - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); + (void) memcpy(Buf, (void *) (ptr + Offset), Len); + (void) munmap((caddr_t) ptr, mlen); #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)" "-> %02x %02x %02x %02x...\n", @@ -310,13 +310,12 @@ xf86EnableIO() if (ExtendedEnabled) return TRUE; - if (i386_iopl(TRUE) < 0) - { + if (i386_iopl(TRUE) < 0) { #ifndef __OpenBSD__ - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O", + xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O", "xf86EnableIO"); #else - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n%s", + xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O\n%s", "xf86EnableIO", SYSCTL_MSG); #endif return FALSE; @@ -337,11 +336,10 @@ xf86DisableIO() } /* Otherwise, the X server has revoqued its root uid, and thus cannot give up IO privileges any more */ - return; } -#endif /* USE_I386_IOPL */ +#endif /* USE_I386_IOPL */ #ifdef USE_AMD64_IOPL /***************************************************************************/ @@ -358,10 +356,10 @@ xf86EnableIO() if (amd64_iopl(TRUE) < 0) { #ifndef __OpenBSD__ - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O", + xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O", "xf86EnableIO"); #else - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n%s", + xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O\n%s", "xf86EnableIO", SYSCTL_MSG); #endif return FALSE; @@ -376,17 +374,17 @@ xf86DisableIO() { if (!ExtendedEnabled) return; - + if (amd64_iopl(FALSE) == 0) { ExtendedEnabled = FALSE; } /* Otherwise, the X server has revoqued its root uid, and thus cannot give up IO privileges any more */ - + return; } -#endif /* USE_AMD64_IOPL */ +#endif /* USE_AMD64_IOPL */ #ifdef USE_DEV_IO static int IoFd = -1; @@ -398,7 +396,7 @@ xf86EnableIO() return TRUE; if ((IoFd = open("/dev/io", O_RDWR)) == -1) { - xf86Msg(X_WARNING,"xf86EnableIO: " + xf86Msg(X_WARNING, "xf86EnableIO: " "Failed to open /dev/io for extended I/O"); return FALSE; } @@ -427,17 +425,18 @@ xf86SetTVOut(int mode) { switch (xf86Info.consType) { #ifdef PCCONS_SUPPORT - case PCCONS:{ - if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_ON, &mode) < 0) { - xf86Msg(X_WARNING, - "xf86SetTVOut: Could not set console to TV output, %s\n", - strerror(errno)); - } - } - break; + case PCCONS:{ + + if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_ON, &mode) < 0) { + xf86Msg(X_WARNING, + "xf86SetTVOut: Could not set console to TV output, %s\n", + strerror(errno)); + } + } + break; #endif /* PCCONS_SUPPORT */ - default: + default: FatalError("Xf86SetTVOut: Unsupported console"); break; } @@ -449,17 +448,18 @@ xf86SetRGBOut() { switch (xf86Info.consType) { #ifdef PCCONS_SUPPORT - case PCCONS:{ - if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_OFF, 0) < 0) { - xf86Msg(X_WARNING, - "xf86SetTVOut: Could not set console to RGB output, %s\n", - strerror(errno)); - } - } - break; + case PCCONS:{ + + if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_OFF, 0) < 0) { + xf86Msg(X_WARNING, + "xf86SetTVOut: Could not set console to RGB output, %s\n", + strerror(errno)); + } + } + break; #endif /* PCCONS_SUPPORT */ - default: + default: FatalError("Xf86SetTVOut: Unsupported console"); break; } @@ -528,8 +528,8 @@ cleanMTRR() (mrd[i].mr_flags & MDF_ACTIVE)) { #ifdef DEBUG ErrorF("Clean for (0x%lx,0x%lx)\n", - (unsigned long)mrd[i].mr_base, - (unsigned long)mrd[i].mr_len); + (unsigned long) mrd[i].mr_base, + (unsigned long) mrd[i].mr_len); #endif if (mrd[i].mr_flags & MDF_FIXACTIVE) { mro.mo_arg[0] = MEMRANGE_SET_UPDATE; @@ -624,15 +624,16 @@ sortRangeList(RangePtr list) */ static void -findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp) +findRanges(unsigned long base, unsigned long size, RangePtr * ucp, + RangePtr * wcp) { struct mem_range_desc *mrd; int nmr, i; RangePtr rp, *p; - + if (!(mrd = getAllRanges(&nmr))) return; - + for (i = 0; i < nmr; i++) { if ((mrd[i].mr_flags & MDF_ACTIVE) && mrd[i].mr_base < base + size && @@ -691,17 +692,17 @@ addWC(int screenNum, unsigned long base, unsigned long size, MessageType from) RangePtr uc = NULL, wc = NULL, retlist = NULL; struct mem_range_desc mrd; struct mem_range_op mro; - + findRanges(base, size, &uc, &wc); - + /* See of the full range is already WC */ if (!uc && fullCoverage(base, size, wc)) { xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx) was already set\n", + "Write-combining range (0x%lx,0x%lx) was already set\n", base, size); return NULL; } - + /* Otherwise, try to add the new range */ mrd.mr_base = base; mrd.mr_len = size; @@ -732,20 +733,20 @@ delWC(int screenNum, unsigned long base, unsigned long size, MessageType from) RangePtr uc = NULL, wc = NULL, retlist = NULL; struct mem_range_desc mrd; struct mem_range_op mro; - + findRanges(base, size, &uc, &wc); - + /* * See of the full range is already not WC, or if there is full * coverage from UC ranges. */ if (!wc || fullCoverage(base, size, uc)) { xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx) was already clear\n", + "Write-combining range (0x%lx,0x%lx) was already clear\n", base, size); return NULL; } - + /* Otherwise, try to add the new range */ mrd.mr_base = base; mrd.mr_len = size; @@ -793,8 +794,8 @@ undoWC(int screenNum, pointer list) while (rp) { #ifdef DEBUG ErrorF("Undo for (0x%lx,0x%lx), %d\n", - (unsigned long)rp->mrd.mr_base, - (unsigned long)rp->mrd.mr_len, rp->wasWC); + (unsigned long) rp->mrd.mr_base, + (unsigned long) rp->mrd.mr_len, rp->wasWC); #endif failed = FALSE; if (rp->wasWC) { @@ -821,15 +822,14 @@ undoWC(int screenNum, pointer list) if (failed) { xf86DrvMsg(screenNum, X_WARNING, "Failed to restore MTRR range (0x%lx,0x%lx)\n", - (unsigned long)rp->mrd.mr_base, - (unsigned long)rp->mrd.mr_len); + (unsigned long) rp->mrd.mr_base, + (unsigned long) rp->mrd.mr_len); } rp = rp->next; } } -#endif /* HAS_MTRR_SUPPORT */ - +#endif /* HAS_MTRR_SUPPORT */ #if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) static pointer @@ -843,7 +843,7 @@ NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable, "%s MTRR %lx - %lx\n", enable ? "set" : "remove", base, (base + size)); - mtrrp = xnfalloc(sizeof (struct mtrr)); + mtrrp = xnfalloc(sizeof(struct mtrr)); mtrrp->base = base; mtrrp->len = size; mtrrp->type = MTRR_TYPE_WC; @@ -870,7 +870,7 @@ NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable, static void NetBSDundoWC(int screenNum, pointer list) { - struct mtrr *mtrrp = (struct mtrr *)list; + struct mtrr *mtrrp = (struct mtrr *) list; int n; if (mtrrp == NULL) diff --git a/xserver/hw/xfree86/os-support/bsd/ppc_video.c b/xserver/hw/xfree86/os-support/bsd/ppc_video.c index 7790774d1..9c256f53f 100644 --- a/xserver/hw/xfree86/os-support/bsd/ppc_video.c +++ b/xserver/hw/xfree86/os-support/bsd/ppc_video.c @@ -56,24 +56,25 @@ void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { xf86OpenConsole(); - + pVidMem->linearSupported = TRUE; pVidMem->mapMem = ppcMapVidMem; pVidMem->unmapMem = ppcUnmapVidMem; pVidMem->initialised = TRUE; - + pci_system_init_dev_mem(xf86Info.consoleFd); xf86EnableIO(); } -_X_EXPORT volatile unsigned char *ioBase = MAP_FAILED; +volatile unsigned char *ioBase = MAP_FAILED; static pointer ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { int fd = xf86Info.consoleFd; pointer base; + #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd); @@ -103,7 +104,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, int Len) { int rv; - + if (Base < 0x80000000) { xf86Msg(X_WARNING, "No VGA Base=%#lx\n", Base); return 0; @@ -117,18 +118,15 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, } #ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n", - Base, Offset, Len); + xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n", Base, Offset, Len); #endif - lseek(kmem, Base + Offset, 0); rv = read(kmem, Buf, Len); return rv; } - #ifdef X_PRIVSEP /* * Do all initialisation that need root privileges @@ -155,7 +153,7 @@ Bool xf86EnableIO() xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd); if (ioBase == MAP_FAILED) { - ioBase = mmap(NULL, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, + ioBase = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0xf2000000); xf86MsgVerb(X_INFO, 3, "xf86EnableIO: %08x\n", ioBase); if (ioBase == MAP_FAILED) { @@ -166,7 +164,8 @@ Bool xf86EnableIO() return TRUE; } -void xf86DisableIO() +void +xf86DisableIO() { if (ioBase != MAP_FAILED) { diff --git a/xserver/hw/xfree86/os-support/bsd/sparc64_video.c b/xserver/hw/xfree86/os-support/bsd/sparc64_video.c index 39ccc7a6b..c500f5e11 100644 --- a/xserver/hw/xfree86/os-support/bsd/sparc64_video.c +++ b/xserver/hw/xfree86/os-support/bsd/sparc64_video.c @@ -6,19 +6,19 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of + * documentation, and that the names of Rich Murphey and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or + * David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or * implied warranty. * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ @@ -61,14 +61,12 @@ sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, pointer base; #ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", - Base, Size, fd); + xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd); #endif base = mmap(0, Size, (flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_SHARED, fd, Base); + PROT_READ : (PROT_READ | PROT_WRITE), MAP_SHARED, fd, Base); if (base == MAP_FAILED) FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)", "xf86MapVidMem", Size, Base, strerror(errno)); @@ -91,13 +89,13 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, #ifdef X_PRIVSEP /* - * Do all things that need root privileges early - * and revoke those privileges + * Do all things that need root privileges early + * and revoke those privileges */ _X_EXPORT void xf86PrivilegedInit(void) { - pci_system_init(); - xf86OpenConsole(); + pci_system_init(); + xf86OpenConsole(); } #endif diff --git a/xserver/hw/xfree86/os-support/bus/Makefile.in b/xserver/hw/xfree86/os-support/bus/Makefile.in index 37c87b882..cc033ec3d 100644 --- a/xserver/hw/xfree86/os-support/bus/Makefile.in +++ b/xserver/hw/xfree86/os-support/bus/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -220,13 +220,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -248,6 +244,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -272,6 +269,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -386,6 +384,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/os-support/bus/Sbus.c b/xserver/hw/xfree86/os-support/bus/Sbus.c index b75308aa1..826000712 100644 --- a/xserver/hw/xfree86/os-support/bus/Sbus.c +++ b/xserver/hw/xfree86/os-support/bus/Sbus.c @@ -403,16 +403,16 @@ sparcPromAssignNodes(void) int devId; char *prefix; } procFbPrefixes[] = { - { - SBUS_DEVICE_BW2, "BWtwo"}, { - SBUS_DEVICE_CG14, "CGfourteen"}, { - SBUS_DEVICE_CG6, "CGsix"}, { - SBUS_DEVICE_CG3, "CGthree"}, { - SBUS_DEVICE_FFB, "Creator"}, { - SBUS_DEVICE_FFB, "Elite 3D"}, { - SBUS_DEVICE_LEO, "Leo"}, { - SBUS_DEVICE_TCX, "TCX"}, { - 0, NULL},}; + {SBUS_DEVICE_BW2, "BWtwo"}, + {SBUS_DEVICE_CG14, "CGfourteen"}, + {SBUS_DEVICE_CG6, "CGsix"}, + {SBUS_DEVICE_CG3, "CGthree"}, + {SBUS_DEVICE_FFB, "Creator"}, + {SBUS_DEVICE_FFB, "Elite 3D"}, + {SBUS_DEVICE_LEO, "Leo"}, + {SBUS_DEVICE_TCX, "TCX"}, + {0, NULL}, + }; while (fscanf(f, "%d %63s\n", &fbNum, buffer) == 2) { for (i = 0; procFbPrefixes[i].devId; i++) diff --git a/xserver/hw/xfree86/os-support/hurd/Makefile.in b/xserver/hw/xfree86/os-support/hurd/Makefile.in index 726c77207..14a0764b0 100644 --- a/xserver/hw/xfree86/os-support/hurd/Makefile.in +++ b/xserver/hw/xfree86/os-support/hurd/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -183,13 +183,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -211,6 +207,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -235,6 +232,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -349,6 +347,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/os-support/linux/Makefile.am b/xserver/hw/xfree86/os-support/linux/Makefile.am index 36748df2c..61175b386 100644 --- a/xserver/hw/xfree86/os-support/linux/Makefile.am +++ b/xserver/hw/xfree86/os-support/linux/Makefile.am @@ -22,7 +22,7 @@ XORG_CFLAGS += -DHAVE_APM endif liblinux_la_SOURCES = lnx_init.c lnx_video.c \ - lnx_agp.c lnx_kmod.c lnx_bell.c \ + lnx_agp.c lnx_kmod.c lnx_bell.c lnx_platform.c \ $(srcdir)/../shared/bios_mmap.c \ $(srcdir)/../shared/VTsw_usl.c \ $(srcdir)/../shared/posix_tty.c \ diff --git a/xserver/hw/xfree86/os-support/linux/Makefile.in b/xserver/hw/xfree86/os-support/linux/Makefile.in index b01901474..dd276f925 100644 --- a/xserver/hw/xfree86/os-support/linux/Makefile.in +++ b/xserver/hw/xfree86/os-support/linux/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -78,18 +78,18 @@ CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) @LINUX_ALPHA_TRUE@liblinux_la_DEPENDENCIES = liblinuxev56.la am__liblinux_la_SOURCES_DIST = lnx_init.c lnx_video.c lnx_agp.c \ - lnx_kmod.c lnx_bell.c $(srcdir)/../shared/bios_mmap.c \ - $(srcdir)/../shared/VTsw_usl.c $(srcdir)/../shared/posix_tty.c \ - $(srcdir)/../shared/vidmem.c $(srcdir)/../shared/sigio.c \ - lnx_acpi.c lnx_apm.c $(srcdir)/lnx_axp.c \ - $(srcdir)/../shared/xf86Axp.c + lnx_kmod.c lnx_bell.c lnx_platform.c \ + $(srcdir)/../shared/bios_mmap.c $(srcdir)/../shared/VTsw_usl.c \ + $(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/vidmem.c \ + $(srcdir)/../shared/sigio.c lnx_acpi.c lnx_apm.c \ + $(srcdir)/lnx_axp.c $(srcdir)/../shared/xf86Axp.c @LNXACPI_TRUE@am__objects_1 = lnx_acpi.lo lnx_apm.lo @LNXAPM_TRUE@am__objects_2 = lnx_apm.lo @LINUX_ALPHA_TRUE@am__objects_3 = lnx_axp.lo xf86Axp.lo am_liblinux_la_OBJECTS = lnx_init.lo lnx_video.lo lnx_agp.lo \ - lnx_kmod.lo lnx_bell.lo bios_mmap.lo VTsw_usl.lo posix_tty.lo \ - vidmem.lo sigio.lo $(am__objects_1) $(am__objects_2) \ - $(am__objects_3) + lnx_kmod.lo lnx_bell.lo lnx_platform.lo bios_mmap.lo \ + VTsw_usl.lo posix_tty.lo vidmem.lo sigio.lo $(am__objects_1) \ + $(am__objects_2) $(am__objects_3) liblinux_la_OBJECTS = $(am_liblinux_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -207,13 +207,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -235,6 +231,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -259,6 +256,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -373,6 +371,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ $(am__append_2) $(am__append_3) +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -482,7 +481,7 @@ noinst_LTLIBRARIES = liblinux.la $(am__append_1) @LNXACPI_TRUE@ACPI_SRCS = lnx_acpi.c lnx_apm.c @LNXAPM_TRUE@APM_SRCS = lnx_apm.c liblinux_la_SOURCES = lnx_init.c lnx_video.c \ - lnx_agp.c lnx_kmod.c lnx_bell.c \ + lnx_agp.c lnx_kmod.c lnx_bell.c lnx_platform.c \ $(srcdir)/../shared/bios_mmap.c \ $(srcdir)/../shared/VTsw_usl.c \ $(srcdir)/../shared/posix_tty.c \ @@ -564,6 +563,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_bell.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_init.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_kmod.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_platform.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_video.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_tty.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigio.Plo@am__quote@ diff --git a/xserver/hw/xfree86/os-support/linux/int10/linux.c b/xserver/hw/xfree86/os-support/linux/int10/linux.c index fa58a72b6..8bca37524 100644 --- a/xserver/hw/xfree86/os-support/linux/int10/linux.c +++ b/xserver/hw/xfree86/os-support/linux/int10/linux.c @@ -52,7 +52,6 @@ typedef struct { int highMem; char *base; char *base_high; - int screen; char *alloc; } linuxInt10Priv; @@ -89,15 +88,16 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) memType cs; legacyVGARec vga; Bool videoBiosMapped = FALSE; - + ScrnInfoPtr pScrn; if (int10Generation != serverGeneration) { counter = 0; int10Generation = serverGeneration; } - screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; + pScrn = xf86FindScreenForEntity(entityIndex); + screen = pScrn->scrnIndex; - options = xf86HandleInt10Options(xf86Screens[screen], entityIndex); + options = xf86HandleInt10Options(pScrn, entityIndex); if (int10skip(options)) { free(options); @@ -106,7 +106,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) #if defined DoSubModules if (loadedSubModule == INT10_NOT_LOADED) - loadedSubModule = int10LinuxLoadSubModule(xf86Screens[screen]); + loadedSubModule = int10LinuxLoadSubModule(pScrn); if (loadedSubModule == INT10_LOAD_FAILED) return NULL; @@ -145,7 +145,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) } pInt = (xf86Int10InfoPtr) xnfcalloc(1, sizeof(xf86Int10InfoRec)); - pInt->scrnIndex = screen; + pInt->pScrn = pScrn; pInt->entityIndex = entityIndex; pInt->dev = xf86GetPciInfoForEntity(entityIndex); @@ -154,7 +154,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) pInt->mem = &linuxMem; pagesize = getpagesize(); pInt->private = (pointer) xnfcalloc(1, sizeof(linuxInt10Priv)); - ((linuxInt10Priv *) pInt->private)->screen = screen; ((linuxInt10Priv *) pInt->private)->alloc = (pointer) xnfcalloc(1, ALLOC_ENTRIES(pagesize)); @@ -333,28 +332,28 @@ MapCurrentInt10(xf86Int10InfoPtr pInt) addr = shmat(((linuxInt10Priv *) pInt->private)->lowMem, (char *) 1, SHM_RND); if (addr == SHMERRORPTR) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() low memory\n"); - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot shmat() low memory\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "shmat(low_mem) error: %s\n", strerror(errno)); return FALSE; } if (mprotect((void *) 0, V_RAM, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot set EXEC bit on low memory: %s\n", strerror(errno)); if (((linuxInt10Priv *) pInt->private)->highMem >= 0) { addr = shmat(((linuxInt10Priv *) pInt->private)->highMem, (char *) HIGH_MEM, 0); if (addr == SHMERRORPTR) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot shmat() high memory\n"); - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "shmget error: %s\n", strerror(errno)); return FALSE; } if (mprotect((void *) HIGH_MEM, HIGH_MEM_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot set EXEC bit on high memory: %s\n", strerror(errno)); } @@ -364,13 +363,13 @@ MapCurrentInt10(xf86Int10InfoPtr pInt) PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED | MAP_FIXED, fd, V_BIOS) == MAP_FAILED) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot map V_BIOS\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot map V_BIOS\n"); close(fd); return FALSE; } } else { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot open %s\n", DEV_MEM); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot open %s\n", DEV_MEM); return FALSE; } close(fd); diff --git a/xserver/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c b/xserver/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c index 8502b21b7..187698399 100644 --- a/xserver/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c +++ b/xserver/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c @@ -210,19 +210,19 @@ vm86_GP_fault(xf86Int10InfoPtr pInt) return FALSE; case 0x0f: - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8lx\n", X86_CS, X86_EIP); goto op0ferr; default: - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "unknown reason for exception\n"); op0ferr: dump_registers(pInt); stack_trace(pInt); dump_code(pInt); - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "cannot continue\n"); return FALSE; } /* end of switch() */ return TRUE; @@ -238,7 +238,7 @@ do_vm86(xf86Int10InfoPtr pInt) xf86InterceptSignals(NULL); if (signo >= 0) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "vm86() syscall generated signal %d.\n", signo); dump_registers(pInt); dump_code(pInt); @@ -252,7 +252,7 @@ do_vm86(xf86Int10InfoPtr pInt) return 0; break; case VM86_STI: - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "vm86_sti :-((\n"); dump_registers(pInt); dump_code(pInt); stack_trace(pInt); @@ -260,7 +260,7 @@ do_vm86(xf86Int10InfoPtr pInt) case VM86_INTx: pInt->num = VM86_ARG(retval); if (!int_handler(pInt)) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval)); dump_registers(pInt); dump_code(pInt); @@ -275,10 +275,10 @@ do_vm86(xf86Int10InfoPtr pInt) * we used to warn here and bail out - but now the sigio stuff * always fires signals at us. So we just ignore them for now. */ - xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_WARNING, "received signal\n"); return 0; default: - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n", + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n", VM86_ARG(retval), VM86_TYPE(retval)); dump_registers(pInt); dump_code(pInt); diff --git a/xserver/hw/xfree86/os-support/linux/lnx_apm.c b/xserver/hw/xfree86/os-support/linux/lnx_apm.c index a37331e52..387934099 100644 --- a/xserver/hw/xfree86/os-support/linux/lnx_apm.c +++ b/xserver/hw/xfree86/os-support/linux/lnx_apm.c @@ -42,26 +42,23 @@ static struct { apm_event_t apmLinux; pmEvent xf86; } LinuxToXF86[] = { - { - APM_SYS_STANDBY, XF86_APM_SYS_STANDBY}, { - APM_SYS_SUSPEND, XF86_APM_SYS_SUSPEND}, { - APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, { - APM_CRITICAL_RESUME, XF86_APM_CRITICAL_RESUME}, { - APM_LOW_BATTERY, XF86_APM_LOW_BATTERY}, { - APM_POWER_STATUS_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, { - APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, { - APM_CRITICAL_SUSPEND, XF86_APM_CRITICAL_SUSPEND}, { - APM_USER_STANDBY, XF86_APM_USER_STANDBY}, { - APM_USER_SUSPEND, XF86_APM_USER_SUSPEND}, { - APM_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, + {APM_SYS_STANDBY, XF86_APM_SYS_STANDBY}, + {APM_SYS_SUSPEND, XF86_APM_SYS_SUSPEND}, + {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, + {APM_CRITICAL_RESUME, XF86_APM_CRITICAL_RESUME}, + {APM_LOW_BATTERY, XF86_APM_LOW_BATTERY}, + {APM_POWER_STATUS_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, + {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, + {APM_CRITICAL_SUSPEND, XF86_APM_CRITICAL_SUSPEND}, + {APM_USER_STANDBY, XF86_APM_USER_STANDBY}, + {APM_USER_SUSPEND, XF86_APM_USER_SUSPEND}, + {APM_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, #if defined(APM_CAPABILITY_CHANGED) - { - APM_CAPABILITY_CHANGED, XF86_CAPABILITY_CHANGED}, + {APM_CAPABILITY_CHANGED, XF86_CAPABILITY_CHANGED}, #endif #if 0 - { - APM_STANDBY_FAILED, XF86_APM_STANDBY_FAILED}, { - APM_SUSPEND_FAILED, XF86_APM_SUSPEND_FAILED} + {APM_STANDBY_FAILED, XF86_APM_STANDBY_FAILED}, + {APM_SUSPEND_FAILED, XF86_APM_SUSPEND_FAILED} #endif }; diff --git a/xserver/hw/xfree86/os-support/linux/lnx_init.c b/xserver/hw/xfree86/os-support/linux/lnx_init.c index c938b87d3..68c296b0f 100644 --- a/xserver/hw/xfree86/os-support/linux/lnx_init.c +++ b/xserver/hw/xfree86/os-support/linux/lnx_init.c @@ -238,9 +238,6 @@ xf86OpenConsole(void) cfsetispeed(&nTty, 9600); cfsetospeed(&nTty, 9600); tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty); - - /* we really should have a InitOSInputDevices() function instead - * of Init?$#*&Device(). So I just place it here */ } } else { /* serverGeneration != 1 */ diff --git a/xserver/hw/xfree86/os-support/linux/lnx_platform.c b/xserver/hw/xfree86/os-support/linux/lnx_platform.c new file mode 100644 index 000000000..76f5583dd --- /dev/null +++ b/xserver/hw/xfree86/os-support/linux/lnx_platform.c @@ -0,0 +1,179 @@ +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#ifdef XSERVER_PLATFORM_BUS + +#include <xf86drm.h> +#include <fcntl.h> +#include <unistd.h> + +/* Linux platform device support */ +#include "xf86_OSproc.h" + +#include "xf86.h" +#include "xf86platformBus.h" +#include "xf86Bus.h" + +#include "hotplug.h" + +static Bool +get_drm_info(struct OdevAttributes *attribs, char *path) +{ + drmSetVersion sv; + char *buf; + int fd; + + fd = open(path, O_RDWR, O_CLOEXEC); + if (fd == -1) + return FALSE; + + sv.drm_di_major = 1; + sv.drm_di_minor = 4; + sv.drm_dd_major = -1; /* Don't care */ + sv.drm_dd_minor = -1; /* Don't care */ + if (drmSetInterfaceVersion(fd, &sv)) { + ErrorF("setversion 1.4 failed\n"); + return FALSE; + } + + xf86_add_platform_device(attribs); + + buf = drmGetBusid(fd); + xf86_add_platform_device_attrib(xf86_num_platform_devices - 1, + ODEV_ATTRIB_BUSID, buf); + drmFreeBusid(buf); + close(fd); + return TRUE; +} + +Bool +xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid) +{ + struct OdevAttribute *attrib; + const char *syspath = NULL; + BusType bustype; + const char *id; + xorg_list_for_each_entry(attrib, &device->attribs->list, member) { + if (attrib->attrib_id == ODEV_ATTRIB_SYSPATH) { + syspath = attrib->attrib_name; + break; + } + } + + if (!syspath) + return FALSE; + + bustype = StringToBusType(busid, &id); + if (bustype == BUS_PCI) { + struct pci_device *pPci = device->pdev; + if (xf86ComparePciBusString(busid, + ((pPci->domain << 8) + | pPci->bus), + pPci->dev, pPci->func)) { + return TRUE; + } + } + else if (bustype == BUS_PLATFORM) { + /* match on the minimum string */ + int len = strlen(id); + + if (strlen(syspath) < strlen(id)) + len = strlen(syspath); + + if (strncmp(id, syspath, len)) + return FALSE; + return TRUE; + } + return FALSE; +} + +void +xf86PlatformDeviceProbe(struct OdevAttributes *attribs) +{ + struct OdevAttribute *attrib; + int i; + char *path = NULL; + Bool ret; + + xorg_list_for_each_entry(attrib, &attribs->list, member) { + if (attrib->attrib_id == ODEV_ATTRIB_PATH) { + path = attrib->attrib_name; + break; + } + } + if (!path) + goto out_free; + + for (i = 0; i < xf86_num_platform_devices; i++) { + char *dpath; + dpath = xf86_get_platform_attrib(i, ODEV_ATTRIB_PATH); + + if (!strcmp(path, dpath)) + break; + } + + if (i != xf86_num_platform_devices) + goto out_free; + + LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n", + path); + + ret = get_drm_info(attribs, path); + if (ret == FALSE) + goto out_free; + + return; + +out_free: + config_odev_free_attribute_list(attribs); +} + +void NewGPUDeviceRequest(struct OdevAttributes *attribs) +{ + int old_num = xf86_num_platform_devices; + int ret; + xf86PlatformDeviceProbe(attribs); + + if (old_num == xf86_num_platform_devices) + return; + + ret = xf86platformAddDevice(xf86_num_platform_devices-1); + if (ret == -1) + xf86_remove_platform_device(xf86_num_platform_devices-1); + + ErrorF("xf86: found device %d\n", xf86_num_platform_devices); + return; +} + +void DeleteGPUDeviceRequest(struct OdevAttributes *attribs) +{ + struct OdevAttribute *attrib; + int index; + char *syspath = NULL; + + xorg_list_for_each_entry(attrib, &attribs->list, member) { + if (attrib->attrib_id == ODEV_ATTRIB_SYSPATH) { + syspath = attrib->attrib_name; + break; + } + } + + for (index = 0; index < xf86_num_platform_devices; index++) { + char *dspath; + dspath = xf86_get_platform_attrib(index, ODEV_ATTRIB_SYSPATH); + if (!strcmp(syspath, dspath)) + break; + } + + if (index == xf86_num_platform_devices) + goto out; + + ErrorF("xf86: remove device %d %s\n", index, syspath); + + xf86platformRemoveDevice(index); +out: + config_odev_free_attribute_list(attribs); +} + +#endif diff --git a/xserver/hw/xfree86/os-support/misc/Makefile.in b/xserver/hw/xfree86/os-support/misc/Makefile.in index 088de1a44..f950599ec 100644 --- a/xserver/hw/xfree86/os-support/misc/Makefile.in +++ b/xserver/hw/xfree86/os-support/misc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -181,13 +181,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -209,6 +205,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -233,6 +230,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -347,6 +345,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/os-support/shared/platform_noop.c b/xserver/hw/xfree86/os-support/shared/platform_noop.c new file mode 100644 index 000000000..199ae5e8e --- /dev/null +++ b/xserver/hw/xfree86/os-support/shared/platform_noop.c @@ -0,0 +1,23 @@ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#ifdef XSERVER_PLATFORM_BUS +/* noop platform device support */ +#include "xf86_OSproc.h" + +#include "xf86.h" +#include "xf86platformBus.h" + +Bool +xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid) +{ + return FALSE; +} + +void xf86PlatformDeviceProbe(struct OdevAttributes *attribs) +{ + +} +#endif diff --git a/xserver/hw/xfree86/os-support/shared/posix_tty.c b/xserver/hw/xfree86/os-support/shared/posix_tty.c index ff3724f78..7a1a5d736 100644 --- a/xserver/hw/xfree86/os-support/shared/posix_tty.c +++ b/xserver/hw/xfree86/os-support/shared/posix_tty.c @@ -62,8 +62,8 @@ #include "xf86_OSlib.h" -static int -GetBaud(int baudrate) +static int +GetBaud (int baudrate) { #ifdef B300 if (baudrate == 300) @@ -119,63 +119,62 @@ xf86OpenSerial(XF86OptionPtr options) int fd, i; char *dev; - dev = xf86SetStrOption(options, "Device", NULL); + dev = xf86SetStrOption (options, "Device", NULL); if (!dev) { - xf86Msg(X_ERROR, "xf86OpenSerial: No Device specified.\n"); + xf86Msg (X_ERROR, "xf86OpenSerial: No Device specified.\n"); return -1; } - #ifndef X_PRIVSEP - SYSCALL(fd = open(dev, O_RDWR | O_NONBLOCK)); + SYSCALL (fd = open (dev, O_RDWR | O_NONBLOCK)); #else fd = priv_open_device (dev); #endif if (fd == -1) { - xf86Msg(X_ERROR, - "xf86OpenSerial: Cannot open device %s\n\t%s.\n", - dev, strerror(errno)); + xf86Msg (X_ERROR, + "xf86OpenSerial: Cannot open device %s\n\t%s.\n", + dev, strerror (errno)); free(dev); return -1; } - if (!isatty(fd)) { + if (!isatty (fd)) { /* Allow non-tty devices to be opened. */ free(dev); return fd; } /* set up default port parameters */ - SYSCALL(tcgetattr(fd, &t)); - t.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR - | IGNCR | ICRNL | IXON); + SYSCALL (tcgetattr (fd, &t)); + t.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR + |IGNCR|ICRNL|IXON); t.c_oflag &= ~OPOST; - t.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); - t.c_cflag &= ~(CSIZE | PARENB); - t.c_cflag |= CS8 | CLOCAL; - - cfsetispeed(&t, B9600); - cfsetospeed(&t, B9600); + t.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); + t.c_cflag &= ~(CSIZE|PARENB); + t.c_cflag |= CS8|CLOCAL; + + cfsetispeed (&t, B9600); + cfsetospeed (&t, B9600); t.c_cc[VMIN] = 1; t.c_cc[VTIME] = 0; - SYSCALL(tcsetattr(fd, TCSANOW, &t)); + SYSCALL (tcsetattr (fd, TCSANOW, &t)); - if (xf86SetSerial(fd, options) == -1) { - SYSCALL(close(fd)); + if (xf86SetSerial (fd, options) == -1) { + SYSCALL (close (fd)); free(dev); return -1; } - SYSCALL(i = fcntl(fd, F_GETFL, 0)); + SYSCALL (i = fcntl (fd, F_GETFL, 0)); if (i == -1) { - SYSCALL(close(fd)); + SYSCALL (close (fd)); free(dev); return -1; } i &= ~O_NONBLOCK; - SYSCALL(i = fcntl(fd, F_SETFL, i)); + SYSCALL (i = fcntl (fd, F_SETFL, i)); if (i == -1) { - SYSCALL(close(fd)); + SYSCALL (close (fd)); free(dev); return -1; } diff --git a/xserver/hw/xfree86/os-support/shared/sigio.c b/xserver/hw/xfree86/os-support/shared/sigio.c index 12ae8a480..f3c153b89 100644 --- a/xserver/hw/xfree86/os-support/shared/sigio.c +++ b/xserver/hw/xfree86/os-support/shared/sigio.c @@ -99,6 +99,8 @@ xf86SIGIO(int sig) int save_errno = errno; /* do not clobber the global errno */ int r; + inSignalContext = TRUE; + ready = xf86SigIOMask; to.tv_sec = 0; to.tv_usec = 0; @@ -114,6 +116,8 @@ xf86SIGIO(int sig) } /* restore global errno */ errno = save_errno; + + inSignalContext = FALSE; } static int @@ -132,7 +136,6 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) struct sigaction sa; struct sigaction osa; int i; - int blocked; int installed = FALSE; if (!xf86Info.useSIGIO) @@ -142,7 +145,7 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) if (!xf86SigIOFuncs[i].f) { if (xf86IsPipe(fd)) return 0; - blocked = xf86BlockSIGIO(); + OsBlockSIGIO(); #ifdef O_ASYNC if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) { xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n", @@ -170,7 +173,7 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) } #endif if (!installed) { - xf86UnblockSIGIO(blocked); + OsReleaseSIGIO(); return 0; } sigemptyset(&sa.sa_mask); @@ -186,7 +189,7 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) if (fd >= xf86SigIOMaxFd) xf86SigIOMaxFd = fd + 1; FD_SET(fd, &xf86SigIOMask); - xf86UnblockSIGIO(blocked); + OsReleaseSIGIO(); return 1; } /* Allow overwriting of the closure and callback */ @@ -259,26 +262,13 @@ xf86RemoveSIGIOHandler(int fd) int xf86BlockSIGIO(void) { - sigset_t set, old; - int ret; - - sigemptyset(&set); - sigaddset(&set, SIGIO); - sigprocmask(SIG_BLOCK, &set, &old); - ret = sigismember(&old, SIGIO); - return ret; + return OsBlockSIGIO(); } void xf86UnblockSIGIO(int wasset) { - sigset_t set; - - if (!wasset) { - sigemptyset(&set); - sigaddset(&set, SIGIO); - sigprocmask(SIG_UNBLOCK, &set, NULL); - } + OsReleaseSIGIO(); } void diff --git a/xserver/hw/xfree86/os-support/shared/vidmem.c b/xserver/hw/xfree86/os-support/shared/vidmem.c index a7717d8f6..514fc2fa7 100644 --- a/xserver/hw/xfree86/os-support/shared/vidmem.c +++ b/xserver/hw/xfree86/os-support/shared/vidmem.c @@ -157,19 +157,6 @@ checkMtrrOption(VidMapPtr vp) } void -xf86MakeNewMapping(int ScreenNum, int Flags, unsigned long Base, - unsigned long Size, pointer Vbase) -{ - VidMapPtr vp; - MappingPtr mp; - - vp = getVidMapRec(ScreenNum); - mp = newMapping(vp); - mp->size = Size; - mp->virtBase = Vbase; -} - -void xf86InitVidMem(void) { if (!vidMemInfo.initialised) { diff --git a/xserver/hw/xfree86/os-support/solaris/Makefile.in b/xserver/hw/xfree86/os-support/solaris/Makefile.in index da91c0b29..3621b06f0 100644 --- a/xserver/hw/xfree86/os-support/solaris/Makefile.in +++ b/xserver/hw/xfree86/os-support/solaris/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -236,13 +236,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -264,6 +260,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -288,6 +285,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -402,6 +400,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/os-support/solaris/sun_apm.c b/xserver/hw/xfree86/os-support/solaris/sun_apm.c index 4ff64649a..b6a1432f6 100644 --- a/xserver/hw/xfree86/os-support/solaris/sun_apm.c +++ b/xserver/hw/xfree86/os-support/solaris/sun_apm.c @@ -97,21 +97,19 @@ static struct { u_int apmBsd; pmEvent xf86; } sunToXF86Array[] = { - { - APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, { - APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, { - APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, { - APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, { - APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, { - APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, { - APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, { - APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, { - APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, { - APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, { - APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, + {APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, + {APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, + {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, + {APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, + {APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, + {APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, + {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, + {APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, + {APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, + {APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, + {APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, #ifdef APM_CAPABILITY_CHANGE - { - APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, + {APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, #endif }; diff --git a/xserver/hw/xfree86/os-support/stub/Makefile.in b/xserver/hw/xfree86/os-support/stub/Makefile.in index e8ff97249..726d64b1e 100644 --- a/xserver/hw/xfree86/os-support/stub/Makefile.in +++ b/xserver/hw/xfree86/os-support/stub/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -183,13 +183,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -211,6 +207,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -235,6 +232,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -349,6 +347,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/os-support/xf86_OSlib.h b/xserver/hw/xfree86/os-support/xf86_OSlib.h index 9161e181e..e931b09a1 100644 --- a/xserver/hw/xfree86/os-support/xf86_OSlib.h +++ b/xserver/hw/xfree86/os-support/xf86_OSlib.h @@ -171,7 +171,7 @@ /**************************************************************************/ /* Linux or Glibc-based system */ /**************************************************************************/ -#if defined(__linux__) || defined(__GLIBC__) +#if defined(__linux__) || defined(__GLIBC__) || defined(__CYGWIN__) #include <sys/ioctl.h> #include <signal.h> #include <stdlib.h> diff --git a/xserver/hw/xfree86/os-support/xf86_OSproc.h b/xserver/hw/xfree86/os-support/xf86_OSproc.h index e171146dd..ea2b16e46 100644 --- a/xserver/hw/xfree86/os-support/xf86_OSproc.h +++ b/xserver/hw/xfree86/os-support/xf86_OSproc.h @@ -215,12 +215,16 @@ extern _X_EXPORT int xf86ProcessArgument(int, char **, int); extern _X_EXPORT void xf86UseMsg(void); extern _X_EXPORT PMClose xf86OSPMOpen(void); -extern _X_EXPORT _X_DEPRECATED void xf86MakeNewMapping(int, int, unsigned long, - unsigned long, pointer); extern _X_EXPORT void xf86InitVidMem(void); #endif /* XF86_OS_PRIVS */ +#ifdef XSERVER_PLATFORM_BUS +#include "hotplug.h" +void +xf86PlatformDeviceProbe(struct OdevAttributes *attribs); +#endif + _XFUNCPROTOEND #endif /* NO_OSLIB_PROTOTYPES */ #endif /* _XF86_OSPROC_H */ diff --git a/xserver/hw/xfree86/parser/Device.c b/xserver/hw/xfree86/parser/Device.c index f27b56fef..bb1ba88fb 100644 --- a/xserver/hw/xfree86/parser/Device.c +++ b/xserver/hw/xfree86/parser/Device.c @@ -52,8 +52,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/Files.c b/xserver/hw/xfree86/parser/Files.c index d8152c008..0d3e47ac5 100644 --- a/xserver/hw/xfree86/parser/Files.c +++ b/xserver/hw/xfree86/parser/Files.c @@ -51,8 +51,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/Flags.c b/xserver/hw/xfree86/parser/Flags.c index 29a60a2e1..2461476d1 100644 --- a/xserver/hw/xfree86/parser/Flags.c +++ b/xserver/hw/xfree86/parser/Flags.c @@ -51,8 +51,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/Input.c b/xserver/hw/xfree86/parser/Input.c index 6e0073437..ff2b9acbc 100644 --- a/xserver/hw/xfree86/parser/Input.c +++ b/xserver/hw/xfree86/parser/Input.c @@ -52,8 +52,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/InputClass.c b/xserver/hw/xfree86/parser/InputClass.c index 8493685cd..de6a816ea 100644 --- a/xserver/hw/xfree86/parser/InputClass.c +++ b/xserver/hw/xfree86/parser/InputClass.c @@ -23,8 +23,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/Layout.c b/xserver/hw/xfree86/parser/Layout.c index bd33d6dfc..cbd8d247a 100644 --- a/xserver/hw/xfree86/parser/Layout.c +++ b/xserver/hw/xfree86/parser/Layout.c @@ -52,8 +52,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/Makefile.in b/xserver/hw/xfree86/parser/Makefile.in index 006b01345..f5ecc9f36 100644 --- a/xserver/hw/xfree86/parser/Makefile.in +++ b/xserver/hw/xfree86/parser/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -238,13 +238,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -266,6 +262,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -290,6 +287,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -404,6 +402,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/parser/Module.c b/xserver/hw/xfree86/parser/Module.c index 1c458ae6c..87ddfc635 100644 --- a/xserver/hw/xfree86/parser/Module.c +++ b/xserver/hw/xfree86/parser/Module.c @@ -52,8 +52,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/Monitor.c b/xserver/hw/xfree86/parser/Monitor.c index b237dfb32..36b4ebe35 100644 --- a/xserver/hw/xfree86/parser/Monitor.c +++ b/xserver/hw/xfree86/parser/Monitor.c @@ -52,8 +52,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/Pointer.c b/xserver/hw/xfree86/parser/Pointer.c index cdbc09c1a..ff748d99a 100644 --- a/xserver/hw/xfree86/parser/Pointer.c +++ b/xserver/hw/xfree86/parser/Pointer.c @@ -52,8 +52,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/Screen.c b/xserver/hw/xfree86/parser/Screen.c index 71778d88d..f294ec490 100644 --- a/xserver/hw/xfree86/parser/Screen.c +++ b/xserver/hw/xfree86/parser/Screen.c @@ -52,8 +52,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/Vendor.c b/xserver/hw/xfree86/parser/Vendor.c index b4e2165b0..9b7695c8e 100644 --- a/xserver/hw/xfree86/parser/Vendor.c +++ b/xserver/hw/xfree86/parser/Vendor.c @@ -52,8 +52,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/Video.c b/xserver/hw/xfree86/parser/Video.c index fc1f1e544..68d611ae7 100644 --- a/xserver/hw/xfree86/parser/Video.c +++ b/xserver/hw/xfree86/parser/Video.c @@ -52,8 +52,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/read.c b/xserver/hw/xfree86/parser/read.c index eef873e89..6545bcdae 100644 --- a/xserver/hw/xfree86/parser/read.c +++ b/xserver/hw/xfree86/parser/read.c @@ -52,8 +52,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/scan.c b/xserver/hw/xfree86/parser/scan.c index 795da615f..f852b83ec 100644 --- a/xserver/hw/xfree86/parser/scan.c +++ b/xserver/hw/xfree86/parser/scan.c @@ -51,8 +51,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/parser/write.c b/xserver/hw/xfree86/parser/write.c index c001c3d51..9c706a062 100644 --- a/xserver/hw/xfree86/parser/write.c +++ b/xserver/hw/xfree86/parser/write.c @@ -51,8 +51,6 @@ * authorization from the copyright holder(s) and author(s). */ -/* View/edit this file with tab stops set to 4 */ - #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif diff --git a/xserver/hw/xfree86/ramdac/Makefile.am b/xserver/hw/xfree86/ramdac/Makefile.am index 3c3780516..346af4ccc 100644 --- a/xserver/hw/xfree86/ramdac/Makefile.am +++ b/xserver/hw/xfree86/ramdac/Makefile.am @@ -1,19 +1,12 @@ noinst_LTLIBRARIES = libramdac.la libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \ - xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \ - xf86BitOrder.c + xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h -DISTCLEANFILES = xf86BitOrder.c EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \ CURSOR.NOTES -AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \ - $(DIX_CFLAGS) $(XORG_CFLAGS) +AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) INCLUDES = $(XORG_INCS) - -xf86BitOrder.c: - $(AM_V_GEN)echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@ - $(AM_V_GEN)echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@ diff --git a/xserver/hw/xfree86/ramdac/Makefile.in b/xserver/hw/xfree86/ramdac/Makefile.in index 2558f68e8..bbc7d3999 100644 --- a/xserver/hw/xfree86/ramdac/Makefile.in +++ b/xserver/hw/xfree86/ramdac/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -76,7 +76,7 @@ CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libramdac_la_LIBADD = am_libramdac_la_OBJECTS = xf86RamDac.lo xf86RamDacCmap.lo \ - xf86Cursor.lo xf86HWCurs.lo IBM.lo BT.lo TI.lo xf86BitOrder.lo + xf86Cursor.lo xf86HWCurs.lo IBM.lo BT.lo TI.lo libramdac_la_OBJECTS = $(am_libramdac_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -212,13 +212,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -240,6 +236,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -264,6 +261,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -378,6 +376,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -479,17 +478,13 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libramdac.la libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \ - xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \ - xf86BitOrder.c + xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h -DISTCLEANFILES = xf86BitOrder.c EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \ CURSOR.NOTES -AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \ - $(DIX_CFLAGS) $(XORG_CFLAGS) - +AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) INCLUDES = $(XORG_INCS) all: all-am @@ -548,7 +543,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BT.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IBM.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TI.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86BitOrder.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Cursor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86HWCurs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RamDac.Plo@am__quote@ @@ -731,7 +725,6 @@ 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) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -824,10 +817,6 @@ uninstall-am: uninstall-sdkHEADERS tags uninstall uninstall-am uninstall-sdkHEADERS -xf86BitOrder.c: - $(AM_V_GEN)echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@ - $(AM_V_GEN)echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@ - # 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: diff --git a/xserver/hw/xfree86/ramdac/xf86Cursor.c b/xserver/hw/xfree86/ramdac/xf86Cursor.c index 678d2be5c..8d48a7542 100644 --- a/xserver/hw/xfree86/ramdac/xf86Cursor.c +++ b/xserver/hw/xfree86/ramdac/xf86Cursor.c @@ -43,19 +43,19 @@ static miPointerSpriteFuncRec xf86CursorSpriteFuncs = { static void xf86CursorInstallColormap(ColormapPtr); static void xf86CursorRecolorCursor(DeviceIntPtr pDev, ScreenPtr, CursorPtr, Bool); -static Bool xf86CursorCloseScreen(int, ScreenPtr); +static Bool xf86CursorCloseScreen(ScreenPtr); static void xf86CursorQueryBestSize(int, unsigned short *, unsigned short *, ScreenPtr); /* ScrnInfoRec functions */ -static void xf86CursorEnableDisableFBAccess(int, Bool); -static Bool xf86CursorSwitchMode(int, DisplayModePtr, int); +static void xf86CursorEnableDisableFBAccess(ScrnInfoPtr, Bool); +static Bool xf86CursorSwitchMode(ScrnInfoPtr, DisplayModePtr); Bool xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CursorScreenPtr ScreenPriv; miPointerScreenPtr PointPriv; @@ -118,9 +118,9 @@ xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) /***** Screen functions *****/ static Bool -xf86CursorCloseScreen(int i, ScreenPtr pScreen) +xf86CursorCloseScreen(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); miPointerScreenPtr PointPriv = (miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); @@ -149,7 +149,7 @@ xf86CursorCloseScreen(int i, ScreenPtr pScreen) free(ScreenPriv->transparentData); free(ScreenPriv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } static void @@ -203,11 +203,11 @@ xf86CursorRecolorCursor(DeviceIntPtr pDev, /***** ScrnInfoRec functions *********/ static void -xf86CursorEnableDisableFBAccess(int index, Bool enable) +xf86CursorEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable) { DeviceIntPtr pDev = inputInfo.pointer; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); @@ -223,7 +223,7 @@ xf86CursorEnableDisableFBAccess(int index, Bool enable) } if (ScreenPriv->EnableDisableFBAccess) - (*ScreenPriv->EnableDisableFBAccess) (index, enable); + (*ScreenPriv->EnableDisableFBAccess) (pScrn, enable); if (enable && ScreenPriv->SavedCursor) { /* @@ -237,10 +237,10 @@ xf86CursorEnableDisableFBAccess(int index, Bool enable) } static Bool -xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags) +xf86CursorSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { Bool ret; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); @@ -250,7 +250,7 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags) ScreenPriv->isUp = FALSE; } - ret = (*ScreenPriv->SwitchMode) (index, mode, flags); + ret = (*ScreenPriv->SwitchMode) (pScrn, mode); /* * Cannot restore cursor here because the new frame[XY][01] haven't been @@ -336,28 +336,19 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, if (!infoPtr->pScrn->vtSema) ScreenPriv->SavedCursor = pCurs; - if (infoPtr->pScrn->vtSema && (ScreenPriv->ForceHWCursorCount || (( + if (infoPtr->pScrn->vtSema && xorg_list_is_empty(&pScreen->pixmap_dirty_list) && + (ScreenPriv->ForceHWCursorCount || + (( #ifdef ARGB_CURSOR - pCurs-> - bits-> - argb - && - infoPtr-> - UseHWCursorARGB - && - (*infoPtr-> - UseHWCursorARGB) - (pScreen, - pCurs)) - || - (pCurs-> - bits-> - argb - == 0 - && + pCurs->bits->argb && + infoPtr->UseHWCursorARGB && + (*infoPtr->UseHWCursorARGB)(pScreen, pCurs)) || + (pCurs->bits->argb == 0 && #endif - (pCurs->bits->height <= infoPtr->MaxHeight) && (pCurs->bits->width <= infoPtr->MaxWidth) && (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor) (pScreen, pCurs)))))) { - + (pCurs->bits->height <= infoPtr->MaxHeight) && + (pCurs->bits->width <= infoPtr->MaxWidth) && + (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor) (pScreen, pCurs)))))) { + if (ScreenPriv->SWCursor) /* remove the SW cursor */ (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, NullCursor, x, y); diff --git a/xserver/hw/xfree86/ramdac/xf86CursorPriv.h b/xserver/hw/xfree86/ramdac/xf86CursorPriv.h index 062b2eb7c..04be14135 100644 --- a/xserver/hw/xfree86/ramdac/xf86CursorPriv.h +++ b/xserver/hw/xfree86/ramdac/xf86CursorPriv.h @@ -26,7 +26,7 @@ typedef struct { miPointerSpriteFuncPtr spriteFuncs; Bool PalettedCursor; ColormapPtr pInstalledMap; - Bool (*SwitchMode) (int, DisplayModePtr, int); + Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr); xf86EnableDisableFBAccessProc *EnableDisableFBAccess; CursorPtr SavedCursor; @@ -43,8 +43,6 @@ void xf86MoveCursor(ScreenPtr pScreen, int x, int y); void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed); Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr); -CARD32 xf86ReverseBitOrder(CARD32 data); - extern _X_EXPORT DevPrivateKeyRec xf86CursorScreenKeyRec; #define xf86CursorScreenKey (&xf86CursorScreenKeyRec) diff --git a/xserver/hw/xfree86/ramdac/xf86HWCurs.c b/xserver/hw/xfree86/ramdac/xf86HWCurs.c index 95721490a..197abff8f 100644 --- a/xserver/hw/xfree86/ramdac/xf86HWCurs.c +++ b/xserver/hw/xfree86/ramdac/xf86HWCurs.c @@ -21,6 +21,15 @@ #include "servermd.h" +static CARD32 +xf86ReverseBitOrder(CARD32 v) +{ + return (((0x01010101 & v) << 7) | ((0x02020202 & v) << 5) | + ((0x04040404 & v) << 3) | ((0x08080808 & v) << 1) | + ((0x10101010 & v) >> 1) | ((0x20202020 & v) >> 3) | + ((0x40404040 & v) >> 5) | ((0x80808080 & v) >> 7)); +} + #if BITMAP_SCANLINE_PAD == 64 #if 1 @@ -105,7 +114,7 @@ xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) infoPtr->RealizeCursor = RealizeCursorInterleave0; } - infoPtr->pScrn = xf86Screens[pScreen->myNum]; + infoPtr->pScrn = xf86ScreenToScrn(pScreen); return TRUE; } diff --git a/xserver/hw/xfree86/ramdac/xf86RamDacCmap.c b/xserver/hw/xfree86/ramdac/xf86RamDacCmap.c index 7a903d8e4..fa7a86663 100644 --- a/xserver/hw/xfree86/ramdac/xf86RamDacCmap.c +++ b/xserver/hw/xfree86/ramdac/xf86RamDacCmap.c @@ -59,7 +59,7 @@ Bool RamDacHandleColormaps(ScreenPtr pScreen, int maxColors, int sigRGBbits, unsigned int flags) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RamDacRecPtr hwp = RAMDACSCRPTR(pScrn); if (hwp->LoadPalette == NULL) diff --git a/xserver/hw/xfree86/sdksyms.sh b/xserver/hw/xfree86/sdksyms.sh index 7584e8c88..59bdf5180 100644 --- a/xserver/hw/xfree86/sdksyms.sh +++ b/xserver/hw/xfree86/sdksyms.sh @@ -45,10 +45,10 @@ cat > sdksyms.c << EOF #include "misyncstr.h" /* Xext/Makefile.am -- half is module, half is builtin */ -/* +#ifdef XV #include "xvdix.h" #include "xvmcext.h" - */ +#endif #include "geext.h" #include "geint.h" #ifdef MITSHM @@ -94,11 +94,9 @@ cat > sdksyms.c << EOF /* hw/xfree86/dri2/Makefile.am -- module */ -/* #if DRI2 # include "dri2.h" #endif - */ /* hw/xfree86/vgahw/Makefile.am -- module */ @@ -134,12 +132,9 @@ cat > sdksyms.c << EOF # include "xf86xvmc.h" # include "xf86xvpriv.h" #endif -/* XF86VidMode code is in libextmod module */ -/* #if XF86VIDMODE # include "vidmodeproc.h" #endif - */ #include "xorgVersion.h" #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) # include "xf86sbusBus.h" @@ -180,18 +175,10 @@ cat > sdksyms.c << EOF #endif -/* hw/xfree86/xaa/Makefile.am -- module */ -/* -#include "xaa.h" -#include "xaalocal.h" -#include "xaarop.h" - */ - - /* hw/xfree86/dixmods/extmod/Makefile.am -- module */ -/* +#ifdef XFreeXDGA #include "dgaproc.h" - */ +#endif /* hw/xfree86/parser/Makefile.am */ @@ -207,13 +194,11 @@ cat > sdksyms.c << EOF /* hw/xfree86/dri/Makefile.am -- module */ -/* #if XF86DRI # include "dri.h" # include "sarea.h" # include "dristruct.h" #endif - */ /* mi/Makefile.am */ @@ -240,9 +225,9 @@ cat > sdksyms.c << EOF /* dbe/Makefile.am -- module */ -/* +#ifdef DBE #include "dbestruct.h" - */ +#endif /* exa/Makefile.am -- module */ @@ -250,6 +235,9 @@ cat > sdksyms.c << EOF #include "exa.h" */ +#ifdef COMPOSITE +#include "compositeext.h" +#endif /* xfixes/Makefile.am */ #include "xfixes.h" @@ -275,7 +263,6 @@ cat > sdksyms.c << EOF #include "dixstruct.h" #include "exevents.h" #include "extension.h" -#include "extinit.h" #include "extnsionst.h" #include "gc.h" #include "gcstruct.h" @@ -331,8 +318,8 @@ topdir=$1 shift LC_ALL=C export LC_ALL -${CPP:-cpp} "$@" -DXorgLoader sdksyms.c > /dev/null || exit $? -${CPP:-cpp} "$@" -DXorgLoader sdksyms.c | ${AWK:-awk} -v topdir=$topdir ' +${CPP:-cpp} "$@" sdksyms.c > /dev/null || exit $? +${CPP:-cpp} "$@" sdksyms.c | ${AWK:-awk} -v topdir=$topdir ' BEGIN { sdk = 0; print("/*"); @@ -367,7 +354,6 @@ BEGIN { /^extern[ ]/ { if (sdk) { n = 3; - printf("/* %s */\n", $0) # skip attribute, if any while ($n ~ /^(__attribute__|__global)/ || diff --git a/xserver/hw/xfree86/shadowfb/Makefile.am b/xserver/hw/xfree86/shadowfb/Makefile.am index 39c66109e..5756fca3b 100644 --- a/xserver/hw/xfree86/shadowfb/Makefile.am +++ b/xserver/hw/xfree86/shadowfb/Makefile.am @@ -1,6 +1,7 @@ module_LTLIBRARIES = libshadowfb.la -libshadowfb_la_LDFLAGS = -module -avoid-version +libshadowfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libshadowfb_la_SOURCES = sfbmodule.c shadow.c +libshadowfb_la_LIBADD = $(PIXMAN_LIBS) sdk_HEADERS = shadowfb.h diff --git a/xserver/hw/xfree86/shadowfb/Makefile.in b/xserver/hw/xfree86/shadowfb/Makefile.in index df7fd3a20..4948c7baf 100644 --- a/xserver/hw/xfree86/shadowfb/Makefile.in +++ b/xserver/hw/xfree86/shadowfb/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -102,7 +102,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)" LTLIBRARIES = $(module_LTLIBRARIES) -libshadowfb_la_LIBADD = +am__DEPENDENCIES_1 = +libshadowfb_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libshadowfb_la_OBJECTS = sfbmodule.lo shadow.lo libshadowfb_la_OBJECTS = $(am_libshadowfb_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -215,13 +216,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -243,6 +240,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,6 +265,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -381,6 +380,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -481,8 +481,9 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ module_LTLIBRARIES = libshadowfb.la -libshadowfb_la_LDFLAGS = -module -avoid-version +libshadowfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libshadowfb_la_SOURCES = sfbmodule.c shadow.c +libshadowfb_la_LIBADD = $(PIXMAN_LIBS) sdk_HEADERS = shadowfb.h INCLUDES = $(XORG_INCS) AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) diff --git a/xserver/hw/xfree86/shadowfb/shadow.c b/xserver/hw/xfree86/shadowfb/shadow.c index 714dd141a..614501770 100644 --- a/xserver/hw/xfree86/shadowfb/shadow.c +++ b/xserver/hw/xfree86/shadowfb/shadow.c @@ -28,13 +28,13 @@ #include "picturestr.h" -static Bool ShadowCloseScreen(int i, ScreenPtr pScreen); +static Bool ShadowCloseScreen(ScreenPtr pScreen); static void ShadowCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgn); static Bool ShadowCreateGC(GCPtr pGC); -static Bool ShadowEnterVT(int index, int flags); -static void ShadowLeaveVT(int index, int flags); +static Bool ShadowEnterVT(ScrnInfoPtr pScrn); +static void ShadowLeaveVT(ScrnInfoPtr pScrn); static void ShadowComposite(CARD8 op, PicturePtr pSrc, @@ -56,8 +56,8 @@ typedef struct { CreateGCProcPtr CreateGC; ModifyPixmapHeaderProcPtr ModifyPixmapHeader; CompositeProcPtr Composite; - Bool (*EnterVT) (int, int); - void (*LeaveVT) (int, int); + Bool (*EnterVT) (ScrnInfoPtr); + void (*LeaveVT) (ScrnInfoPtr); Bool vtSema; } ShadowScreenRec, *ShadowScreenPtr; @@ -136,7 +136,7 @@ ShadowFBInit2(ScreenPtr pScreen, RefreshAreaFuncPtr preRefreshArea, RefreshAreaFuncPtr postRefreshArea) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ShadowScreenPtr pPriv; PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); @@ -192,14 +192,13 @@ ShadowFBInit(ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea) /**********************************************************/ static Bool -ShadowEnterVT(int index, int flags) +ShadowEnterVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; Bool ret; ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen); pScrn->EnterVT = pPriv->EnterVT; - ret = (*pPriv->EnterVT) (index, flags); + ret = (*pPriv->EnterVT) (pScrn); pPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = ShadowEnterVT; if (ret) { @@ -211,15 +210,14 @@ ShadowEnterVT(int index, int flags) } static void -ShadowLeaveVT(int index, int flags) +ShadowLeaveVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(xf86Screens[index]->pScreen); + ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen); pPriv->vtSema = FALSE; pScrn->LeaveVT = pPriv->LeaveVT; - (*pPriv->LeaveVT) (index, flags); + (*pPriv->LeaveVT) (pScrn); pPriv->LeaveVT = pScrn->LeaveVT; pScrn->LeaveVT = ShadowLeaveVT; } @@ -227,9 +225,9 @@ ShadowLeaveVT(int index, int flags) /**********************************************************/ static Bool -ShadowCloseScreen(int i, ScreenPtr pScreen) +ShadowCloseScreen(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); @@ -247,7 +245,7 @@ ShadowCloseScreen(int i, ScreenPtr pScreen) free((pointer) pPriv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } static void diff --git a/xserver/hw/xfree86/utils/Makefile.in b/xserver/hw/xfree86/utils/Makefile.in index 8aa59352e..a862be4e4 100644 --- a/xserver/hw/xfree86/utils/Makefile.in +++ b/xserver/hw/xfree86/utils/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -187,13 +187,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -215,6 +211,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -239,6 +236,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -353,6 +351,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/utils/cvt/Makefile.in b/xserver/hw/xfree86/utils/cvt/Makefile.in index 086df0b6b..ae806c107 100644 --- a/xserver/hw/xfree86/utils/cvt/Makefile.in +++ b/xserver/hw/xfree86/utils/cvt/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -209,13 +209,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -237,6 +233,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -261,6 +258,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -375,6 +373,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/utils/gtf/Makefile.in b/xserver/hw/xfree86/utils/gtf/Makefile.in index 6908044e6..5cb533fe3 100644 --- a/xserver/hw/xfree86/utils/gtf/Makefile.in +++ b/xserver/hw/xfree86/utils/gtf/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -208,13 +208,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -236,6 +232,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -260,6 +257,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -374,6 +372,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/utils/man/Makefile.in b/xserver/hw/xfree86/utils/man/Makefile.in index 3d9cf420e..0cc1bd136 100644 --- a/xserver/hw/xfree86/utils/man/Makefile.in +++ b/xserver/hw/xfree86/utils/man/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -179,13 +179,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -207,6 +203,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -231,6 +228,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -361,6 +359,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/utils/man/cvt.man b/xserver/hw/xfree86/utils/man/cvt.man index 2125fd146..8d70ead1b 100644 --- a/xserver/hw/xfree86/utils/man/cvt.man +++ b/xserver/hw/xfree86/utils/man/cvt.man @@ -12,8 +12,8 @@ cvt - calculate VESA CVT mode lines .I Cvt is a utility for calculating VESA Coordinated Video Timing modes. Given the desired horizontal and vertical resolutions, a modeline adhering to the CVT -standard is printed. This modeline can be included in __xservername__ -.B __xconfigfile__(__filemansuffix__) +standard is printed. This modeline can be included in Xorg +.B xorg.conf(__filemansuffix__) . .SH OPTIONS @@ -31,7 +31,7 @@ Create a mode with reduced blanking. This allows for higher frequency signals, with a lower or equal dotclock. Not for Cathode Ray Tube based displays though. .SH "SEE ALSO" -__xconfigfile__(__filemansuffix__), gtf(__appmansuffix__) +xorg.conf(__filemansuffix__), gtf(__appmansuffix__) .SH AUTHOR Luc Verhaegen. .PP diff --git a/xserver/hw/xfree86/utils/man/gtf.man b/xserver/hw/xfree86/utils/man/gtf.man index 8e83650aa..004d2f059 100644 --- a/xserver/hw/xfree86/utils/man/gtf.man +++ b/xserver/hw/xfree86/utils/man/gtf.man @@ -14,8 +14,8 @@ gtf - calculate VESA GTF mode lines is a utility for calculating VESA GTF modes. Given the desired horizontal and vertical resolutions and refresh rate (in Hz), the parameters for a matching VESA GTF mode are printed out. Two output formats are -supported: mode lines suitable for the __xservername__ -.B __xconfigfile__(__filemansuffix__) +supported: mode lines suitable for the Xorg +.B xorg.conf(__filemansuffix__) file, and mode parameters suitable for the Linux .B fbset(8) utility. @@ -27,14 +27,14 @@ Enable verbose printouts This shows a trace for each step of the computation. .TP 8 .BR \-x | \-\-xorgmode -Print the mode parameters as __xservername__-style mode lines. This is the +Print the mode parameters as Xorg-style mode lines. This is the default format. .TP 8 .BR \-f | \-\-fbset Print the mode parameters in a format suitable for .BR fbset(8) . .SH "SEE ALSO" -__xconfigfile__(__filemansuffix__), cvt(__appmansuffix__) +xorg.conf(__filemansuffix__), cvt(__appmansuffix__) .SH AUTHOR Andy Ritger. .PP diff --git a/xserver/hw/xfree86/vbe/Makefile.am b/xserver/hw/xfree86/vbe/Makefile.am index 4b794e647..0b24faf1f 100644 --- a/xserver/hw/xfree86/vbe/Makefile.am +++ b/xserver/hw/xfree86/vbe/Makefile.am @@ -1,6 +1,9 @@ module_LTLIBRARIES = libvbe.la -libvbe_la_LDFLAGS = -module -avoid-version +libvbe_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libvbe_la_SOURCES = vbe.c vbeModes.c vbe_module.c +if NO_UNDEFINED +libvbe_la_LIBADD = ../int10/libint10.la +endif sdk_HEADERS = vbe.h vbeModes.h diff --git a/xserver/hw/xfree86/vbe/Makefile.in b/xserver/hw/xfree86/vbe/Makefile.in index 4a41abe2a..ea0723b38 100644 --- a/xserver/hw/xfree86/vbe/Makefile.in +++ b/xserver/hw/xfree86/vbe/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -102,7 +102,7 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)" LTLIBRARIES = $(module_LTLIBRARIES) -libvbe_la_LIBADD = +@NO_UNDEFINED_TRUE@libvbe_la_DEPENDENCIES = ../int10/libint10.la am_libvbe_la_OBJECTS = vbe.lo vbeModes.lo vbe_module.lo libvbe_la_OBJECTS = $(am_libvbe_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -214,13 +214,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -242,6 +238,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -266,6 +263,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -380,6 +378,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -480,8 +479,9 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ module_LTLIBRARIES = libvbe.la -libvbe_la_LDFLAGS = -module -avoid-version +libvbe_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libvbe_la_SOURCES = vbe.c vbeModes.c vbe_module.c +@NO_UNDEFINED_TRUE@libvbe_la_LIBADD = ../int10/libint10.la sdk_HEADERS = vbe.h vbeModes.h AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ diff --git a/xserver/hw/xfree86/vbe/vbe.c b/xserver/hw/xfree86/vbe/vbe.c index bbb60e3a1..97a9bcf60 100644 --- a/xserver/hw/xfree86/vbe/vbe.c +++ b/xserver/hw/xfree86/vbe/vbe.c @@ -179,7 +179,7 @@ static Bool vbeProbeDDC(vbeInfoPtr pVbe) { const char *ddc_level; - int screen = pVbe->pInt10->scrnIndex; + int screen = pVbe->pInt10->pScrn->scrnIndex; if (pVbe->ddc == DDC_NONE) return FALSE; @@ -262,7 +262,8 @@ vbeReadEDID(vbeInfoPtr pVbe) unsigned char *tmp = NULL; Bool novbe = FALSE; Bool noddc = FALSE; - int screen = pVbe->pInt10->scrnIndex; + ScrnInfoPtr pScrn = pVbe->pInt10->pScrn; + int screen = pScrn->scrnIndex; OptionInfoPtr options; if (!page) @@ -270,7 +271,7 @@ vbeReadEDID(vbeInfoPtr pVbe) options = xnfalloc(sizeof(VBEOptions)); (void) memcpy(options, VBEOptions, sizeof(VBEOptions)); - xf86ProcessOptions(screen, xf86Screens[screen]->options, options); + xf86ProcessOptions(screen, pScrn->options, options); xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe); xf86GetOptValBool(options, VBEOPT_NODDC, &noddc); free(options); @@ -330,7 +331,7 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule) if (!(pModule = pDDCModule)) { pModule = - xf86LoadSubModule(xf86Screens[pVbe->pInt10->scrnIndex], "ddc"); + xf86LoadSubModule(pVbe->pInt10->pScrn, "ddc"); if (!pModule) return NULL; } @@ -340,7 +341,7 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule) if (!DDC_data) return NULL; - pMonitor = xf86InterpretEDID(pVbe->pInt10->scrnIndex, DDC_data); + pMonitor = xf86InterpretEDID(pVbe->pInt10->pScrn->scrnIndex, DDC_data); if (!pDDCModule) xf86UnloadSubModule(pModule); @@ -598,7 +599,7 @@ VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function, */ if ((pVbe->version & 0xff00) > 0x100) { - int screen = pVbe->pInt10->scrnIndex; + int screen = pVbe->pInt10->pScrn->scrnIndex; if (function == MODE_QUERY || (function == MODE_SAVE && !*memory)) { /* Query amount of memory to save state */ @@ -904,7 +905,7 @@ VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock * vbe) m->n = id; m->next = ModeList; - xf86DrvMsgVerb(pVbe->pInt10->scrnIndex, X_PROBED, 3, + xf86DrvMsgVerb(pVbe->pInt10->pScrn->scrnIndex, X_PROBED, 3, "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n", m->n, m->width, m->height, m->bpp); @@ -1026,23 +1027,22 @@ VBEDPMSSet(vbeInfoPtr pVbe, int mode) } void -VBEInterpretPanelID(int scrnIndex, struct vbePanelID *data) +VBEInterpretPanelID(ScrnInfoPtr pScrn, struct vbePanelID *data) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; DisplayModePtr mode; const float PANEL_HZ = 60.0; if (!data) return; - xf86DrvMsg(scrnIndex, X_INFO, "PanelID returned panel resolution %dx%d\n", + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PanelID returned panel resolution %dx%d\n", data->hsize, data->vsize); if (pScrn->monitor->nHsync || pScrn->monitor->nVrefresh) return; if (data->hsize < 320 || data->vsize < 240) { - xf86DrvMsg(scrnIndex, X_INFO, "...which I refuse to believe\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "...which I refuse to believe\n"); return; } @@ -1069,7 +1069,7 @@ VBEReadPanelID(vbeInfoPtr pVbe) int RealOff = pVbe->real_mode_base; pointer page = pVbe->memory; void *tmp = NULL; - int screen = pVbe->pInt10->scrnIndex; + int screen = pVbe->pInt10->pScrn->scrnIndex; pVbe->pInt10->ax = 0x4F11; pVbe->pInt10->bx = 0x01; diff --git a/xserver/hw/xfree86/vbe/vbe.h b/xserver/hw/xfree86/vbe/vbe.h index 81be0ff40..3907c53f3 100644 --- a/xserver/hw/xfree86/vbe/vbe.h +++ b/xserver/hw/xfree86/vbe/vbe.h @@ -350,7 +350,7 @@ struct vbePanelID { char reserved[14]; }; -extern _X_EXPORT void VBEInterpretPanelID(int scrnIndex, +extern _X_EXPORT void VBEInterpretPanelID(ScrnInfoPtr pScrn, struct vbePanelID *data); extern _X_EXPORT struct vbePanelID *VBEReadPanelID(vbeInfoPtr pVbe); diff --git a/xserver/hw/xfree86/vgahw/Makefile.in b/xserver/hw/xfree86/vgahw/Makefile.in index 32112ff18..8aea86a9a 100644 --- a/xserver/hw/xfree86/vgahw/Makefile.in +++ b/xserver/hw/xfree86/vgahw/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -214,13 +214,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -242,6 +238,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -266,6 +263,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -380,6 +378,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/vgahw/vgaCmap.c b/xserver/hw/xfree86/vgahw/vgaCmap.c index 0cfabc5d6..e7a0d023e 100644 --- a/xserver/hw/xfree86/vgahw/vgaCmap.c +++ b/xserver/hw/xfree86/vgahw/vgaCmap.c @@ -81,11 +81,8 @@ xColorItem *pdefs; xColorItem directDefs[256]; Bool new_overscan = FALSE; Bool writeColormap; - - /* This can get called before the ScrnInfoRec is installed so we - can't rely on getting it with XF86SCRNINFO() */ int scrnIndex = pmap->pScreen->myNum; - ScrnInfoPtr scrninfp = xf86Screens[scrnIndex]; + ScrnInfoPtr scrninfp = xf86ScreenToScrn(pmap->pScreen); vgaHWPtr hwp = VGAHWPTR(scrninfp); unsigned char overscan = hwp->ModeReg.Attribute[OVERSCAN]; @@ -100,7 +97,7 @@ xColorItem *pdefs; } writeColormap = scrninfp->vtSema; - if (DGAAvailable(scrnIndex)) { + if (DGAScreenAvailable(pmap->pScreen)) { writeColormap = writeColormap || (DGAGetDirectMode(scrnIndex) && !(DGAGetFlags(scrnIndex) & XF86DGADirectColormap)) || diff --git a/xserver/hw/xfree86/vgahw/vgaHW.c b/xserver/hw/xfree86/vgahw/vgaHW.c index e044682c7..a64f4f85d 100644 --- a/xserver/hw/xfree86/vgahw/vgaHW.c +++ b/xserver/hw/xfree86/vgahw/vgaHW.c @@ -651,7 +651,7 @@ vgaHWSaveScreen(ScreenPtr pScreen, int mode) Bool on; if (pScreen != NULL) - pScrn = xf86Screens[pScreen->myNum]; + pScrn = xf86ScreenToScrn(pScreen); on = xf86IsUnblank(mode); @@ -1873,7 +1873,7 @@ vgaHWSetOverscan(ScrnInfoPtr pScrn, int overscan) Bool vgaHWHandleColormaps(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (pScrn->depth > 1 && pScrn->depth <= 8) { return xf86HandleColormaps(pScreen, 1 << pScrn->depth, diff --git a/xserver/hw/xfree86/x86emu/Makefile.in b/xserver/hw/xfree86/x86emu/Makefile.in index 5dd0c2fd8..4c23b1481 100644 --- a/xserver/hw/xfree86/x86emu/Makefile.in +++ b/xserver/hw/xfree86/x86emu/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -183,13 +183,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -211,6 +207,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -235,6 +232,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -349,6 +347,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ diff --git a/xserver/hw/xfree86/xaa/Makefile.am b/xserver/hw/xfree86/xaa/Makefile.am deleted file mode 100644 index 78d934876..000000000 --- a/xserver/hw/xfree86/xaa/Makefile.am +++ /dev/null @@ -1,78 +0,0 @@ -LSB_FIRST = l-xaaBitmap.c l-xaaStipple.c l-xaaTEGlyph.c -LSB_3_FIRST = l3-xaaBitmap.c l3-xaaStipple.c -MSB_FIRST = m-xaaBitmap.c m-xaaStipple.c m-xaaTEGlyph.c -MSB_3_FIRST = m3-xaaBitmap.c m3-xaaStipple.c -LSB_FIXED = lf-xaaBitmap.c lf-xaaStipple.c lf-xaaTEGlyph.c -LSB_3_FIXED = lf3-xaaBitmap.c lf3-xaaStipple.c -MSB_FIXED = mf-xaaBitmap.c mf-xaaStipple.c mf-xaaTEGlyph.c -MSB_3_FIXED = mf3-xaaBitmap.c mf3-xaaStipple.c -POLYSEG = s-xaaLine.c s-xaaDashLine.c - -if XAA - -libxaa_la_LDFLAGS = -module -avoid-version -if COMPOSITE -libxaa_la_LIBADD = $(top_builddir)/miext/cw/libcw.la -endif - -module_LTLIBRARIES = libxaa.la -libxaa_la_SOURCES = xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \ - xaaBitBlt.c xaaCpyArea.c xaaGCmisc.c xaaCpyWin.c \ - xaaCpyPlane.c xaaFillRect.c xaaTEText.c xaaNonTEText.c \ - xaaPCache.c xaaSpans.c xaaROP.c xaaImage.c \ - xaaRect.c xaaLineMisc.c xaaBitOrder.c \ - xaaFillPoly.c xaaWideLine.c xaaTables.c xaaFillArc.c \ - xaaLine.c xaaDashLine.c xaaOverlay.c xaaOffscreen.c \ - xaaOverlayDF.c xaaStateChange.c xaaPict.c $(POLYSEG) \ - $(LSB_FIRST) $(MSB_FIRST) $(LSB_FIXED) $(MSB_FIXED) \ - $(LSB_3_FIRST) $(MSB_3_FIRST) $(LSB_3_FIXED) $(MSB_3_FIXED) -${POLYSEG}: - $(AM_V_GEN)echo "#define POLYSEGMENT" > $@ - $(AM_V_GEN)echo '#include "$(srcdir)/${@:s-%=%}"' >> $@ -${LSB_FIRST}: - $(AM_V_GEN)echo "#define LSBFIRST" > $@ - $(AM_V_GEN)echo '#include "$(srcdir)/${@:l-%=%}"' >> $@ -${LSB_3_FIRST}: - $(AM_V_GEN)echo "#define LSBFIRST" > $@ - $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@ - $(AM_V_GEN)echo '#include "$(srcdir)/${@:l3-%=%}"' >> $@ -${LSB_FIXED}: - $(AM_V_GEN)echo "#define LSBFIRST" > $@ - $(AM_V_GEN)echo "#define FIXEDBASE" >> $@ - $(AM_V_GEN)echo '#include "$(srcdir)/${@:lf-%=%}"' >> $@ -${LSB_3_FIXED}: - $(AM_V_GEN)echo "#define LSBFIRST" > $@ - $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@ - $(AM_V_GEN)echo "#define FIXEDBASE" >> $@ - $(AM_V_GEN)echo '#include "$(srcdir)/${@:lf3-%=%}"' >> $@ -${MSB_FIRST}: - $(AM_V_GEN)echo "#define MSBFIRST" > $@ - $(AM_V_GEN)echo '#include "$(srcdir)/${@:m-%=%}"' >> $@ -${MSB_3_FIRST}: - $(AM_V_GEN)echo "#define MSBFIRST" > $@ - $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@ - $(AM_V_GEN)echo '#include "$(srcdir)/${@:m3-%=%}"' >> $@ -${MSB_FIXED}: - $(AM_V_GEN)echo "#define MSBFIRST" > $@ - $(AM_V_GEN)echo "#define FIXEDBASE" >> $@ - $(AM_V_GEN)echo '#include "$(srcdir)/${@:mf-%=%}"' >> $@ -${MSB_3_FIXED}: - $(AM_V_GEN)echo "#define MSBFIRST" > $@ - $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@ - $(AM_V_GEN)echo "#define FIXEDBASE" >> $@ - $(AM_V_GEN)echo '#include "$(srcdir)/${@:mf3-%=%}"' >> $@ - -endif # XAA - -DISTCLEANFILES = $(POLYSEG) \ - $(LSB_FIRST) $(LSB_FIXED) $(MSB_FIRST) $(MSB_FIXED) \ - $(LSB_3_FIRST) $(LSB_3_FIXED) $(MSB_3_FIRST) $(MSB_3_FIXED) - -sdk_HEADERS = xaa.h xaalocal.h xaarop.h -EXTRA_DIST = xaacexp.h xaawrap.h xaaLine.c xaaDashLine.c \ - xaaStipple.c xaaTEGlyph.c xaaNonTEGlyph.c xaaBitmap.c \ - XAA.HOWTO - -INCLUDES = $(XORG_INCS) -I$(srcdir)/../../../miext/cw - -AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) diff --git a/xserver/hw/xfree86/xaa/XAA.HOWTO b/xserver/hw/xfree86/xaa/XAA.HOWTO deleted file mode 100644 index cbd71c138..000000000 --- a/xserver/hw/xfree86/xaa/XAA.HOWTO +++ /dev/null @@ -1,1427 +0,0 @@ - - - XAA.HOWTO - - This file describes how to add basic XAA support to a chipset driver. - -0) What is XAA -1) XAA Initialization and Shutdown -2) The Primitives - 2.0 Generic Flags - 2.1 Screen to Screen Copies - 2.2 Solid Fills - 2.3 Solid Lines - 2.4 Dashed Lines - 2.5 Color Expand Fills - 2.5.1 Screen to Screen Color Expansion - 2.5.2 CPU to Screen Color Expansion - 2.5.2.1 The Direct Method - 2.5.2.2 The Indirect Method - 2.6 8x8 Mono Pattern Fills - 2.7 8x8 Color Pattern Fills - 2.8 Image Writes - 2.8.1 The Direct Method - 2.8.2 The Indirect Method - 2.9 Clipping -3) The Pixmap Cache -4) Offscreen Pixmaps - -/********************************************************************/ - -0) WHAT IS XAA - - XAA (the XFree86 Acceleration Architecture) is a device dependent -layer that encapsulates the unaccelerated framebuffer rendering layer, -intercepting rendering commands sent to it from higher levels of the -server. For rendering tasks where hardware acceleration is not -possible, XAA allows the requests to proceed to the software rendering -code. Otherwise, XAA breaks the sometimes complicated X primitives -into simpler primitives more suitable for hardware acceleration and -will use accelerated functions exported by the chipset driver to -render these. - - XAA provides a simple, easy to use driver interface that allows -the driver to communicate its acceleration capabilities and restrictions -back to XAA. XAA will use the information provided by the driver -to determine whether or not acceleration will be possible for a -particular X primitive. - - - -1) XAA INITIALIZATION AND SHUTDOWN - - All relevant prototypes and defines are in xaa.h. - - To Initialize the XAA layer, the driver should allocate an XAAInfoRec -via XAACreateInfoRec(), fill it out as described in this document -and pass it to XAAInit(). XAAInit() must be called _after_ the -framebuffer initialization (usually cfb?ScreenInit or similar) since -it is "wrapping" that layer. XAAInit() should be called _before_ the -cursor initialization (usually miDCInitialize) since the cursor -layer needs to "wrap" all the rendering code including XAA. - - When shutting down, the driver should free the XAAInfoRec -structure in its CloseScreen function via XAADestroyInfoRec(). -The prototypes for the functions mentioned above are as follows: - - XAAInfoRecPtr XAACreateInfoRec(void); - Bool XAAInit(ScreenPtr, XAAInfoRecPtr); - void XAADestroyInfoRec(XAAInfoRec); - - The driver informs XAA of it's acceleration capablities by -filling out an XAAInfoRec structure and passing it to XAAInit(). -The XAAInfoRec structure contains many fields, most of which are -function pointers and flags. Each primitive will typically have -two functions and a set of flags associated with it, but it may -have more. These two functions are the "SetupFor" and "Subsequent" -functions. The "SetupFor" function tells the driver that the -hardware should be initialized for a particular type of graphics -operation. After the "SetupFor" function, one or more calls to the -"Subsequent" function will be made to indicate that an instance -of the particular primitive should be rendered by the hardware. -The details of each instance (width, height, etc...) are given -with each "Subsequent" function. The set of flags associated -with each primitive lets the driver tell XAA what its hardware -limitations are (eg. It doesn't support a planemask, it can only -do one of the raster-ops, etc...). - - Of the XAAInfoRec fields, one is required. This is the -Sync function. XAA initialization will fail if this function -is not provided. - -void Sync(ScrnInfoPtr pScrn) /* Required */ - - Sync will be called when XAA needs to be certain that all - graphics coprocessor operations are finished, such as when - the framebuffer must be written to or read from directly - and it must be certain that the accelerator will not be - overwriting the area of interest. - - One needs to make certain that the Sync function not only - waits for the accelerator fifo to empty, but that it waits for - the rendering of that last operation to complete. - - It is guaranteed that no direct framebuffer access will - occur after a "SetupFor" or "Subsequent" function without - the Sync function being called first. - - - -2) THE PRIMITIVES - -2.0 Generic Flags - - Each primitive type has a set of flags associated with it which -allow the driver to tell XAA what the hardware limitations are. -The common ones are as follows: - -/* Foreground, Background, rop and planemask restrictions */ - - GXCOPY_ONLY - - This indicates that the accelerator only supports GXcopy - for the particular primitive. - - ROP_NEEDS_SOURCE - - This indicates that the accelerator doesn't supports a - particular primitive with rops that don't involve the source. - These rops are GXclear, GXnoop, GXinvert and GXset. If neither - this flag nor GXCOPY_ONLY is defined, it is assumed that the - accelerator supports all 16 raster operations (rops) for that - primitive. - - NO_PLANEMASK - - This indicates that the accelerator does not support a hardware - write planemask for the particular primitive. - - RGB_EQUAL - - This indicates that the particular primitive requires the red, - green and blue bytes of the foreground color (and background color, - if applicable) to be equal. This is useful for 24bpp when a graphics - coprocessor is used in 8bpp mode, which is not uncommon in older - hardware since some have no support for or only limited support for - acceleration at 24bpp. This way, many operations will be accelerated - for the common case of "grayscale" colors. This flag should only - be used in 24bpp. - - In addition to the common ones listed above which are possible for -nearly all primitives, each primitive may have its own flags specific -to that primitive. If such flags exist they are documented in the -descriptions of those primitives below. - - - - -2.1 Screen to Screen Copies - - The SetupFor and Subsequent ScreenToScreenCopy functions provide - an interface for copying rectangular areas from video memory to - video memory. To accelerate this primitive the driver should - provide both the SetupFor and Subsequent functions and indicate - the hardware restrictions via the ScreenToScreenCopyFlags. The - NO_PLANEMASK, GXCOPY_ONLY and ROP_NEEDS_SOURCE flags as described - in Section 2.0 are valid as well as the following: - - NO_TRANSPARENCY - - This indicates that the accelerator does not support skipping - of color keyed pixels when copying from the source to the destination. - - TRANSPARENCY_GXCOPY_ONLY - - This indicates that the accelerator supports skipping of color keyed - pixels only when the rop is GXcopy. - - ONLY_LEFT_TO_RIGHT_BITBLT - - This indicates that the hardware only accepts blitting when the - x direction is positive. - - ONLY_TWO_BITBLT_DIRECTIONS - - This indicates that the hardware can only cope with blitting when - the direction of x is the same as the direction in y. - - -void SetupForScreenToScreenCopy( ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int trans_color ) - - When this is called, SubsequentScreenToScreenCopy will be called - one or more times directly after. If ydir is 1, then the accelerator - should copy starting from the top (minimum y) of the source and - proceed downward. If ydir is -1, then the accelerator should copy - starting from the bottom of the source (maximum y) and proceed - upward. If xdir is 1, then the accelerator should copy each - y scanline starting from the leftmost pixel of the source. If - xdir is -1, it should start from the rightmost pixel. - If trans_color is not -1 then trans_color indicates that the - accelerator should not copy pixels with the color trans_color - from the source to the destination, but should skip them. - Trans_color is always -1 if the NO_TRANSPARENCY flag is set. - - -void SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int width, int height) - - Copy a rectangle "width" x "height" from the source (x1,y1) to the - destination (x2,y2) using the parameters passed by the last - SetupForScreenToScreenCopy call. (x1,y1) and (x2,y2) always denote - the upper left hand corners of the source and destination regardless - of which xdir and ydir values are given by SetupForScreenToScreenCopy. - - - -2.2 Solid Fills - - The SetupFor and Subsequent SolidFill(Rect/Trap) functions provide - an interface for filling rectangular areas of the screen with a - foreground color. To accelerate this primitive the driver should - provide both the SetupForSolidFill and SubsequentSolidFillRect - functions and indicate the hardware restrictions via the SolidFillFlags. - The driver may optionally provide a SubsequentSolidFillTrap if - it is capable of rendering the primitive correctly. - The GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags - as described in Section 2.0 are valid. - - -void SetupForSolidFill(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask) - - SetupForSolidFill indicates that any combination of the following - may follow it. - - SubsequentSolidFillRect - SubsequentSolidFillTrap - - - -void SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) - - Fill a rectangle of dimensions "w" by "h" with origin at (x,y) - using the color, rop and planemask given by the last - SetupForSolidFill call. - -void SubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h, - int left, int dxL, int dyL, int eL, - int right, int dxR, int dyR, int eR) - - These parameters describe a trapezoid via a version of - Bresenham's parameters. "y" is the top line. "h" is the - number of spans to be filled in the positive Y direction. - "left" and "right" indicate the starting X values of the - left and right edges. dy/dx describes the edge slope. - These are not the deltas between the beginning and ending - points on an edge. They merely describe the slope. "e" is - the initial error term. It's the relationships between dx, - dy and e that define the edge. - If your engine does not do bresenham trapezoids or does - not allow the programmer to specify the error term then - you are not expected to be able to accelerate them. - - -2.3 Solid Lines - - XAA provides an interface for drawing thin lines. In order to - draw X lines correctly a high degree of accuracy is required. - This usually limits line acceleration to hardware which has a - Bresenham line engine, though depending on the algorithm used, - other line engines may come close if they accept 16 bit line - deltas. XAA has both a Bresenham line interface and a two-point - line interface for drawing lines of arbitrary orientation. - Additionally there is a SubsequentSolidHorVertLine which will - be used for all horizontal and vertical lines. Horizontal and - vertical lines are handled separately since hardware that doesn't - have a line engine (or has one that is unusable due to precision - problems) can usually draw these lines by some other method such - as drawing them as thin rectangles. Even for hardware that can - draw arbitrary lines via the Bresenham or two-point interfaces, - the SubsequentSolidHorVertLine is used for horizontal and vertical - lines since most hardware is able to render the horizontal lines - and sometimes the vertical lines faster by other methods (Hint: - try rendering horizontal lines as flattened rectangles). If you have - not provided a SubsequentSolidHorVertLine but you have provided - Bresenham or two-point lines, a SubsequentSolidHorVertLine function - will be supplied for you. - - The flags field associated with Solid Lines is SolidLineFlags and - the GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags as - described in Section 2.0 are valid restrictions. - - Some line engines have line biases hardcoded to comply with - Microsoft line biasing rules. A tell-tale sign of this is the - hardware lines not matching the software lines in the zeroth and - fourth octants. The driver can set the flag: - - MICROSOFT_ZERO_LINE_BIAS - - in the AccelInfoRec.Flags field to adjust the software lines to - match the hardware lines. This is in the generic flags field - rather than the SolidLineFlags since this flag applies to all - software zero-width lines on the screen and not just the solid ones. - - -void SetupForSolidLine(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask) - - SetupForSolidLine indicates that any combination of the following - may follow it. - - SubsequentSolidBresenhamLine - SubsequentSolidTwoPointLine - SubsequentSolidHorVertLine - - -void SubsequentSolidHorVertLine( ScrnInfoPtr pScrn, - int x, int y, int len, int dir ) - - All vertical and horizontal solid thin lines are rendered with - this function. The line starts at coordinate (x,y) and extends - "len" pixels inclusive. In the direction indicated by "dir." - The direction is either DEGREES_O or DEGREES_270. That is, it - always extends to the right or down. - - - -void SubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags) - - Draw a line from (x1,y1) to (x2,y2). If the flags field contains - the flag OMIT_LAST, the last pixel should not be drawn. Otherwise, - the pixel at (x2,y2) should be drawn. - - If you use the TwoPoint line interface there is a good possibility - that your line engine has hard-coded line biases that do not match - the default X zero-width lines. If so, you may need to set the - MICROSOFT_ZERO_LINE_BIAS flag described above. Note that since - any vertex in the 16-bit signed coordinate system is valid, your - line engine is expected to handle 16-bit values if you have hardware - line clipping enabled. If your engine cannot handle 16-bit values, - you should not use hardware line clipping. - - -void SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, int major, int minor, int err, int len, int octant) - - "X" and "y" are the starting point of the line. "Major" and "minor" - are the major and minor step constants. "Err" is the initial error - term. "Len" is the number of pixels to be drawn (inclusive). "Octant" - can be any combination of the following flags OR'd together: - - Y_MAJOR Y is the major axis (X otherwise) - X_DECREASING The line is drawn from right to left - Y_DECREASING The line is drawn from bottom to top - - The major, minor and err terms are the "raw" Bresenham parameters - consistent with a line engine that does: - - e = err; - while(len--) { - DRAW_POINT(x,y); - e += minor; - if(e >= 0) { - e -= major; - TAKE_ONE_STEP_ALONG_MINOR_AXIS; - } - TAKE_ONE_STEP_ALONG_MAJOR_AXIS; - } - - IBM 8514 style Bresenham line interfaces require their parameters - modified in the following way: - - Axial = minor; - Diagonal = minor - major; - Error = minor + err; - -SolidBresenhamLineErrorTermBits - - This field allows the driver to tell XAA how many bits large its - Bresenham parameter registers are. Many engines have registers that - only accept 12 or 13 bit Bresenham parameters, and the parameters - for clipped lines may overflow these if they are not scaled down. - If this field is not set, XAA will assume the engine can accomodate - 16 bit parameters, otherwise, it will scale the parameters to the - size specified. - - -2.4 Dashed Lines - - The same degree of accuracy required by the solid lines is required - for drawing dashed lines as well. The dash pattern itself is a - buffer of binary data where ones are expanded into the foreground - color and zeros either correspond to the background color or - indicate transparency depending on whether or not DoubleDash or - OnOffDashes are being drawn. - - The flags field associated with dashed Lines is DashedLineFlags and - the GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags as - described in Section 2.0 are valid restrictions. Additionally, the - following flags are valid: - - NO_TRANSPARENCY - - This indicates that the driver cannot support dashed lines - with transparent backgrounds (OnOffDashes). - - TRANSPARENCY_ONLY - - This indicates that the driver cannot support dashes with - both a foreground and background color (DoubleDashes). - - LINE_PATTERN_POWER_OF_2_ONLY - - This indicates that only patterns with a power of 2 length - can be accelerated. - - LINE_PATTERN_LSBFIRST_MSBJUSTIFIED - LINE_PATTERN_LSBFIRST_LSBJUSTIFIED - LINE_PATTERN_MSBFIRST_MSBJUSTIFIED - LINE_PATTERN_MSBFIRST_LSBJUSTIFIED - - These describe how the line pattern should be packed. - The pattern buffer is DWORD padded. LSBFIRST indicates - that the pattern runs from the LSB end to the MSB end. - MSBFIRST indicates that the pattern runs from the MSB end - to the LSB end. When the pattern does not completely fill - the DWORD padded buffer, the pattern will be justified - towards the MSB or LSB end based on the flags above. - - - The following field indicates the maximum length dash pattern that - should be accelerated. - - int DashPatternMaxLength - - -void SetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, int rop, unsigned int planemask, - int length, unsigned char *pattern) - - - SetupForDashedLine indicates that any combination of the following - may follow it. - - SubsequentDashedBresenhamLine - SubsequentDashedTwoPointLine - - If "bg" is -1, then the background (pixels corresponding to clear - bits in the pattern) should remain unmodified. "Bg" indicates the - background color otherwise. "Length" indicates the length of - the pattern in bits and "pattern" points to the DWORD padded buffer - holding the pattern which has been packed according to the flags - set above. - - -void SubsequentDashedTwoPointLine( ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags, int phase) - -void SubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, - int x1, int y1, int major, int minor, int err, int len, int octant, - int phase) - - These are the same as the SubsequentSolidTwoPointLine and - SubsequentBresenhamLine functions except for the addition - of the "phase" field which indicates the offset into the dash - pattern that the pixel at (x1,y1) corresponds to. - - As with the SubsequentBresenhamLine, there is an - - int DashedBresenhamLineErrorTermBits - - field which indicates the size of the error term registers - used with dashed lines. This is usually the same value as - the field for the solid lines (because it's usually the same - register). - - - -2.5 Color Expansion Fills - - When filling a color expansion rectangle, the accelerator - paints each pixel depending on whether or not a bit in a - corresponding bitmap is set or clear. Opaque expansions are - when a set bit corresponds to the foreground color and a clear - bit corresponds to the background color. A transparent expansion - is when a set bit corresponds to the foreground color and a - clear bit indicates that the pixel should remain unmodified. - - The graphics accelerator usually has access to the source - bitmap in one of two ways: 1) the bitmap data is sent serially - to the accelerator by the CPU through some memory mapped aperture - or 2) the accelerator reads the source bitmap out of offscreen - video memory. Some types of primitives are better suited towards - one method or the other. Type 2 is useful for reusable patterns - such as stipples which can be cached in offscreen memory. The - aperature method can be used for stippling but the CPU must pass - the data across the bus each time a stippled fill is to be performed. - For expanding 1bpp client pixmaps or text strings to the screen, - the aperature method is usually superior because the intermediate - copy in offscreen memory needed by the second method would only be - used once. Unfortunately, many accelerators can only do one of these - methods and not both. - - XAA provides both ScreenToScreen and CPUToScreen color expansion - interfaces for doing color expansion fills. The ScreenToScreen - functions can only be used with hardware that supports reading - of source bitmaps from offscreen video memory, and these are only - used for cacheable patterns such as stipples. There are two - variants of the CPUToScreen routines - a direct method intended - for hardware that has a transfer aperature, and an indirect method - intended for hardware without transfer aperatures or hardware - with unusual transfer requirements. Hardware that can only expand - bitmaps from video memory should supply ScreenToScreen routines - but also ScanlineCPUToScreen (indirect) routines to optimize transfers - of non-cacheable data. Hardware that can only accept source bitmaps - through an aperature should supply CPUToScreen (or ScanlineCPUToScreen) - routines. Hardware that can do both should provide both ScreenToScreen - and CPUToScreen routines. - - For both ScreenToScreen and CPUToScreen interfaces, the GXCOPY_ONLY, - ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags described in - Section 2.0 are valid as well as the following: - - /* bit order requirements (one of these must be set) */ - - BIT_ORDER_IN_BYTE_LSBFIRST - - This indicates that least significant bit in each byte of the source - data corresponds to the leftmost of that block of 8 pixels. This - is the prefered format. - - BIT_ORDER_IN_BYTE_MSBFIRST - - This indicates that most significant bit in each byte of the source - data corresponds to the leftmost of that block of 8 pixels. - - /* transparency restrictions */ - - NO_TRANSPARENCY - - This indicates that the accelerator cannot do a transparent expansion. - - TRANSPARENCY_ONLY - - This indicates that the accelerator cannot do an opaque expansion. - In cases where where the background needs to be filled, XAA will - render the primitive in two passes when using the CPUToScreen - interface, but will not do so with the ScreenToScreen interface - since that would require caching of two patterns. Some - ScreenToScreen hardware may be able to render two passes at the - driver level and remove the TRANSPARENCY_ONLY restriction if - it can render pixels corresponding to the zero bits. - - - -2.5.1 Screen To Screen Color Expansion - - The ScreenToScreenColorExpandFill routines provide an interface - for doing expansion blits from source patterns stored in offscreen - video memory. - - void SetupForScreenToScreenColorExpandFill (ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask) - - - Ones in the source bitmap will correspond to the fg color. - Zeros in the source bitmap will correspond to the bg color - unless bg = -1. In that case the pixels corresponding to the - zeros in the bitmap shall be left unmodified by the accelerator. - - For hardware that doesn't allow an easy implementation of skipleft, the - driver can replace CacheMonoStipple function with one that stores multiple - rotated copies of the stipple and select between them. In this case the - driver should set CacheColorExpandDensity to tell XAA how many copies of - the pattern are stored in the width of a cache slot. For instance if the - hardware can specify the starting address in bytes, then 8 rotated copies - of the stipple are needed and CacheColorExpandDensity should be set to 8. - - void SubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int offset ) - - - Fill a rectangle "w" x "h" at location (x,y). The source pitch - between scanlines is the framebuffer pitch (pScrn->displayWidth - pixels) and srcx and srcy indicate the start of the source pattern - in units of framebuffer pixels. "Offset" indicates the bit offset - into the pattern that corresponds to the pixel being painted at - "x" on the screen. Some hardware accepts source coordinates in - units of bits which makes implementation of the offset trivial. - In that case, the bit address of the source bit corresponding to - the pixel painted at (x,y) would be: - - (srcy * pScrn->displayWidth + srcx) * pScrn->bitsPerPixel + offset - - It should be noted that the offset assumes LSBFIRST hardware. - For MSBFIRST hardware, the driver may need to implement the - offset by bliting only from byte boundaries and hardware clipping. - - - -2.5.2 CPU To Screen Color Expansion - - - The CPUToScreenColorExpandFill routines provide an interface for - doing expansion blits from source patterns stored in system memory. - There are two varieties of this primitive, a CPUToScreenColorExpandFill - and a ScanlineCPUToScreenColorExpandFill. With the - CPUToScreenColorExpandFill method, the source data is sent serially - through a memory mapped aperature. With the Scanline version, the - data is rendered scanline at a time into intermediate buffers with - a call to SubsequentColorExpandScanline following each scanline. - - These two methods have separate flags fields, the - CPUToScreenColorExpandFillFlags and ScanlineCPUToScreenColorExpandFillFlags - respectively. Flags specific to one method or the other are described - in sections 2.5.2.1 and 2.5.2.2 but for both cases the bit order and - transparency restrictions listed at the beginning of section 2.5 are - valid as well as the following: - - /* clipping (optional) */ - - LEFT_EDGE_CLIPPING - - This indicates that the accelerator supports omission of up to - 31 pixels on the left edge of the rectangle to be filled. This - is beneficial since it allows transfer of the source bitmap to - always occur from DWORD boundaries. - - LEFT_EDGE_CLIPPING_NEGATIVE_X - - This flag indicates that the accelerator can render color expansion - rectangles even if the value of x origin is negative (off of - the screen on the left edge). - - /* misc */ - - TRIPLE_BITS_24BPP - - When enabled (must be in 24bpp mode), color expansion functions - are expected to require three times the amount of bits to be - transferred so that 24bpp grayscale colors can be used with color - expansion in 8bpp coprocessor mode. Each bit is expanded to 3 - bits when writing the monochrome data. - - - 2.5.1 The Direct Method - - - Using the direct method of color expansion XAA will send all - bitmap data to the accelerator serially through an memory mapped - transfer window defined by the following two fields: - - unsigned char *ColorExpandBase - - This indicates the memory address of the beginning of the aperture. - - int ColorExpandRange - - This indicates the size in bytes of the aperture. - - The driver should specify how the transfered data should be padded. - There are options for both the padding of each Y scanline and for the - total transfer to the aperature. - One of the following two flags must be set: - - CPU_TRANSFER_PAD_DWORD - - This indicates that the total transfer (sum of all scanlines) sent - to the aperature must be DWORD padded. This is the default behavior. - - CPU_TRANSFER_PAD_QWORD - - This indicates that the total transfer (sum of all scanlines) sent - to the aperature must be QWORD padded. With this set, XAA will send - an extra DWORD to the aperature when needed to ensure that only - an even number of DWORDs are sent. - - And then there are the flags for padding of each scanline: - - SCANLINE_PAD_DWORD - - This indicates that each Y scanline should be DWORD padded. - This is the only option available and is the default. - - Finally, there is the CPU_TRANSFER_BASE_FIXED flag which indicates - that the aperture is a single register rather than a range of - registers, and XAA should write all of the data to the first DWORD. - If the ColorExpandRange is not large enough to accomodate scanlines - the width of the screen, this option will be forced. That is, the - ColorExpandRange must be: - - ((virtualX + 31)/32) * 4 bytes or more. - - ((virtualX + 62)/32 * 4) if LEFT_EDGE_CLIPPING_NEGATIVE_X is set. - - If the TRIPLE_BITS_24BPP flag is set, the required area should be - multiplied by three. - - -void SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) - - - - Ones in the source bitmap will correspond to the fg color. - Zeros in the source bitmap will correspond to the bg color - unless bg = -1. In that case the pixels corresponding to the - zeros in the bitmap shall be left unmodified by the accelerator. - - -void SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft ) - - When this function is called, the accelerator should be setup - to fill a rectangle of dimension "w" by "h" with origin at (x,y) - in the fill style prescribed by the last call to - SetupForCPUToScreenColorExpandFill. XAA will pass the data to - the aperture immediately after this function is called. If the - skipleft is non-zero (and LEFT_EDGE_CLIPPING has been enabled), then - the accelerator _should_not_ render skipleft pixels on the leftmost - edge of the rectangle. Some engines have an alignment feature - like this built in, some others can do this using a clipping - window. - - It can be arranged for XAA to call Sync() after it is through - calling the Subsequent function by setting SYNC_AFTER_COLOR_EXPAND - in the CPUToScreenColorExpandFillFlags. This can provide the driver - with an oportunity to reset a clipping window if needed. - - -2.5.2 The Indirect Method - - Using the indirect method, XAA will render the bitmap data scanline - at a time to one or more buffers. These buffers may be memory - mapped apertures or just intermediate storage. - - int NumScanlineColorExpandBuffers - - This indicates the number of buffers available. - - unsigned char **ScanlineColorExpandBuffers - - This is an array of pointers to the memory locations of each buffer. - Each buffer is expected to be large enough to accommodate scanlines - the width of the screen. That is: - - ((virtualX + 31)/32) * 4 bytes or more. - - ((virtualX + 62)/32 * 4) if LEFT_EDGE_CLIPPING_NEGATIVE_X is set. - - Scanlines are always DWORD padded. - If the TRIPLE_BITS_24BPP flag is set, the required area should be - multiplied by three. - - -void SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) - - Ones in the source bitmap will correspond to the fg color. - Zeros in the source bitmap will correspond to the bg color - unless bg = -1. In that case the pixels corresponding to the - zeros in the bitmap shall be left unmodified by the accelerator. - - -void SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft ) - -void SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) - - - When SubsequentScanlineCPUToScreenColorExpandFill is called, XAA - will begin transfering the source data scanline at a time, calling - SubsequentColorExpandScanline after each scanline. If more than - one buffer is available, XAA will cycle through the buffers. - Subsequent scanlines will use the next buffer and go back to the - buffer 0 again when the last buffer is reached. The index into - the ScanlineColorExpandBuffers array is presented as "bufno" - with each SubsequentColorExpandScanline call. - - The skipleft field is the same as for the direct method. - - The indirect method can be use to send the source data directly - to a memory mapped aperture represented by a single color expand - buffer, scanline at a time, but more commonly it is used to place - the data into offscreen video memory so that the accelerator can - blit it to the visible screen from there. In the case where the - accelerator permits rendering into offscreen video memory while - the accelerator is active, several buffers can be used so that - XAA can be placing source data into the next buffer while the - accelerator is blitting the current buffer. For cases where - the accelerator requires some special manipulation of the source - data first, the buffers can be in system memory. The CPU can - manipulate these buffers and then send the data to the accelerator. - - - -2.6 8x8 Mono Pattern Fills - - XAA provides support for two types of 8x8 hardware patterns - - "Mono" patterns and "Color" patterns. Mono pattern data is - 64 bits of color expansion data with ones indicating the - foreground color and zeros indicating the background color. - The source bitmaps for the 8x8 mono patterns can be presented - to the graphics accelerator in one of two ways. They can be - passed as two DWORDS to the 8x8 mono pattern functions or - they can be cached in offscreen memory and their locations - passed to the 8x8 mono pattern functions. In addition to the - GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags - defined in Section 2.0, the following are defined for the - Mono8x8PatternFillFlags: - - HARDWARE_PATTERN_PROGRAMMED_BITS - - This indicates that the 8x8 patterns should be packed into two - DWORDS and passed to the 8x8 mono pattern functions. The default - behavior is to cache the patterns in offscreen video memory and - pass the locations of these patterns to the functions instead. - The pixmap cache must be enabled for the default behavior (8x8 - pattern caching) to work. See Section 3 for how to enable the - pixmap cache. The pixmap cache is not necessary for - HARDWARE_PATTERN_PROGRAMMED_BITS. - - HARDWARE_PATTERN_PROGRAMMED_ORIGIN - - If the hardware supports programmable pattern offsets then - this option should be set. See the table below for further - infomation. - - HARDWARE_PATTERN_SCREEN_ORIGIN - - Some hardware wants the pattern offset specified with respect to the - upper left-hand corner of the primitive being drawn. Other hardware - needs the option HARDWARE_PATTERN_SCREEN_ORIGIN set to indicate that - all pattern offsets should be referenced to the upper left-hand - corner of the screen. HARDWARE_PATTERN_SCREEN_ORIGIN is preferable - since this is more natural for the X-Window system and offsets will - have to be recalculated for each Subsequent function otherwise. - - BIT_ORDER_IN_BYTE_MSBFIRST - BIT_ORDER_IN_BYTE_LSBFIRST - - As with other color expansion routines this indicates whether the - most or the least significant bit in each byte from the pattern is - the leftmost on the screen. - - TRANSPARENCY_ONLY - NO_TRANSPARENCY - - This means the same thing as for the color expansion rect routines - except that for TRANSPARENCY_ONLY XAA will not render the primitive - in two passes since this is more easily handled by the driver. - It is recommended that TRANSPARENCY_ONLY hardware handle rendering - of opaque patterns in two passes (the background can be filled as - a rectangle in GXcopy) in the Subsequent function so that the - TRANSPARENCY_ONLY restriction can be removed. - - - - Additional information about cached patterns... - For the case where HARDWARE_PATTERN_PROGRAMMED_BITS is not set and - the pattern must be cached in offscreen memory, the first pattern - starts at the cache slot boundary which is set by the - CachePixelGranularity field used to configure the pixmap cache. - One should ensure that the CachePixelGranularity reflects any - alignment restrictions that the accelerator may put on 8x8 pattern - storage locations. When HARDWARE_PATTERN_PROGRAMMED_ORIGIN is set - there is only one pattern stored. When this flag is not set, - all 64 pre-rotated copies of the pattern are cached in offscreen memory. - The MonoPatternPitch field can be used to specify the X position pixel - granularity that each of these patterns must align on. If the - MonoPatternPitch is not supplied, the patterns will be densely packed - within the cache slot. The behavior of the default XAA 8x8 pattern - caching mechanism to store all 8x8 patterns linearly in video memory. - If the accelerator needs the patterns stored in a more unusual fashion, - the driver will need to provide its own 8x8 mono pattern caching - routines for XAA to use. - - The following table describes the meanings of the "patx" and "paty" - fields in both the SetupFor and Subsequent functions. - - With HARDWARE_PATTERN_SCREEN_ORIGIN - ----------------------------------- - - HARDWARE_PATTERN_PROGRAMMED_BITS and HARDWARE_PATTERN_PROGRAMMED_ORIGIN - - SetupFor: patx and paty are the first and second DWORDS of the - 8x8 mono pattern. - - Subsequent: patx and paty are the x,y offset into that pattern. - All Subsequent calls will have the same offset in - the case of HARDWARE_PATTERN_SCREEN_ORIGIN so only - the offset specified by the first Subsequent call - after a SetupFor call will need to be observed. - - HARDWARE_PATTERN_PROGRAMMED_BITS only - - SetupFor: patx and paty hold the first and second DWORDS of - the 8x8 mono pattern pre-rotated to match the desired - offset. - - Subsequent: These just hold the same patterns and can be ignored. - - HARDWARE_PATTERN_PROGRAMMED_ORIGIN only - - SetupFor: patx and paty hold the x,y coordinates of the offscreen - memory location where the 8x8 pattern is stored. The - bits are stored linearly in memory at that location. - - Subsequent: patx and paty hold the offset into the pattern. - All Subsequent calls will have the same offset in - the case of HARDWARE_PATTERN_SCREEN_ORIGIN so only - the offset specified by the first Subsequent call - after a SetupFor call will need to be observed. - - Neither programmed bits or origin - - SetupFor: patx and paty hold the x,y coordinates of the offscreen - memory location where the pre-rotated 8x8 pattern is - stored. - - Subsequent: patx and paty are the same as in the SetupFor function - and can be ignored. - - - Without HARDWARE_PATTERN_SCREEN_ORIGIN - -------------------------------------- - - HARDWARE_PATTERN_PROGRAMMED_BITS and HARDWARE_PATTERN_PROGRAMMED_ORIGIN - - SetupFor: patx and paty are the first and second DWORDS of the - 8x8 mono pattern. - - Subsequent: patx and paty are the x,y offset into that pattern. - - HARDWARE_PATTERN_PROGRAMMED_BITS only - - SetupFor: patx and paty holds the first and second DWORDS of - the unrotated 8x8 mono pattern. This can be ignored. - - Subsequent: patx and paty hold the rotated 8x8 pattern to be - rendered. - - HARDWARE_PATTERN_PROGRAMMED_ORIGIN only - - SetupFor: patx and paty hold the x,y coordinates of the offscreen - memory location where the 8x8 pattern is stored. The - bits are stored linearly in memory at that location. - - Subsequent: patx and paty hold the offset into the pattern. - - Neither programmed bits or origin - - SetupFor: patx and paty hold the x,y coordinates of the offscreen - memory location where the unrotated 8x8 pattern is - stored. This can be ignored. - - Subsequent: patx and paty hold the x,y coordinates of the - rotated 8x8 pattern to be rendered. - - - -void SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, - int fg, int bg, int rop, unsigned int planemask) - - SetupForMono8x8PatternFill indicates that any combination of the - following may follow it. - - SubsequentMono8x8PatternFillRect - SubsequentMono8x8PatternFillTrap - - The fg, bg, rop and planemask fields have the same meaning as the - ones used for the other color expansion routines. Patx's and paty's - meaning can be determined from the table above. - - -void SubsequentMono8x8PatternFillRect( ScrnInfoPtr pScrn, - int patx, int paty, int x, int y, int w, int h) - - Fill a rectangle of dimensions "w" by "h" with origin at (x,y) - using the parameters give by the last SetupForMono8x8PatternFill - call. The meanings of patx and paty can be determined by the - table above. - -void SubsequentMono8x8PatternFillTrap( ScrnInfoPtr pScrn, - int patx, int paty, int y, int h, - int left, int dxL, int dyL, int eL, - int right, int dxR, int dyR, int eR ) - - The meanings of patx and paty can be determined by the table above. - The rest of the fields have the same meanings as those in the - SubsequentSolidFillTrap function. - - - -2.7 8x8 Color Pattern Fills - - 8x8 color pattern data is 64 pixels of full color data that - is stored linearly in offscreen video memory. 8x8 color patterns - are useful as a substitute for 8x8 mono patterns when tiling, - doing opaque stipples, or in the case where transperency is - supported, regular stipples. 8x8 color pattern fills also have - the additional benefit of being able to tile full color 8x8 - patterns instead of just 2 color ones like the mono patterns. - However, full color 8x8 patterns aren't used very often in the - X Window system so you might consider passing this primitive - by if you already can do mono patterns, especially if they - require alot of cache area. Color8x8PatternFillFlags is - the flags field for this primitive and the GXCOPY_ONLY, - ROP_NEEDS_SOURCE and NO_PLANEMASK flags as described in - Section 2.0 are valid as well as the following: - - - HARDWARE_PATTERN_PROGRAMMED_ORIGIN - - If the hardware supports programmable pattern offsets then - this option should be set. - - HARDWARE_PATTERN_SCREEN_ORIGIN - - Some hardware wants the pattern offset specified with respect to the - upper left-hand corner of the primitive being drawn. Other hardware - needs the option HARDWARE_PATTERN_SCREEN_ORIGIN set to indicate that - all pattern offsets should be referenced to the upper left-hand - corner of the screen. HARDWARE_PATTERN_SCREEN_ORIGIN is preferable - since this is more natural for the X-Window system and offsets will - have to be recalculated for each Subsequent function otherwise. - - NO_TRANSPARENCY - TRANSPARENCY_GXCOPY_ONLY - - These mean the same as for the ScreenToScreenCopy functions. - - - The following table describes the meanings of patx and paty passed - to the SetupFor and Subsequent fields: - - HARDWARE_PATTERN_PROGRAMMED_ORIGIN && HARDWARE_PATTERN_SCREEN_ORIGIN - - SetupFor: patx and paty hold the x,y location of the unrotated - pattern. - - Subsequent: patx and paty hold the pattern offset. For the case - of HARDWARE_PATTERN_SCREEN_ORIGIN all Subsequent calls - have the same offset so only the first call will need - to be observed. - - - HARDWARE_PATTERN_PROGRAMMED_ORIGIN only - - SetupFor: patx and paty hold the x,y location of the unrotated - pattern. - - Subsequent: patx and paty hold the pattern offset. - - HARDWARE_PATTERN_SCREEN_ORIGIN - - SetupFor: patx and paty hold the x,y location of the rotated pattern. - - Subsequent: patx and paty hold the same location as the SetupFor - function so these can be ignored. - - neither flag - - SetupFor: patx and paty hold the x,y location of the unrotated - pattern. This can be ignored. - - Subsequent: patx and paty hold the x,y location of the rotated - pattern. - - Additional information about cached patterns... - All 8x8 color patterns are cached in offscreen video memory so - the pixmap cache must be enabled to use them. The first pattern - starts at the cache slot boundary which is set by the - CachePixelGranularity field used to configure the pixmap cache. - One should ensure that the CachePixelGranularity reflects any - alignment restrictions that the accelerator may put on 8x8 pattern - storage locations. When HARDWARE_PATTERN_PROGRAMMED_ORIGIN is set - there is only one pattern stored. When this flag is not set, - all 64 rotations off the pattern are accessible but it is assumed - that the accelerator is capable of accessing data stored on 8 - pixel boundaries. If the accelerator has stricter alignment - requirements than this the dirver will need to provide its own - 8x8 color pattern caching routines. - - -void SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, - int rop, unsigned int planemask, int trans_color) - - SetupForColor8x8PatternFill indicates that any combination of the - following may follow it. - - SubsequentColor8x8PatternFillRect - SubsequentColor8x8PatternFillTrap (not implemented yet) - - For the meanings of patx and paty, see the table above. Trans_color - means the same as for the ScreenToScreenCopy functions. - - - -void SubsequentColor8x8PatternFillRect( ScrnInfoPtr pScrn, - int patx, int paty, int x, int y, int w, int h) - - Fill a rectangle of dimensions "w" by "h" with origin at (x,y) - using the parameters give by the last SetupForColor8x8PatternFill - call. The meanings of patx and paty can be determined by the - table above. - -void SubsequentColor8x8PatternFillTrap( ScrnInfoPtr pScrn, - int patx, int paty, int y, int h, - int left, int dxL, int dyL, int eL, - int right, int dxR, int dyR, int eR ) - - For the meanings of patx and paty, see the table above. - The rest of the fields have the same meanings as those in the - SubsequentSolidFillTrap function. - - - -2.8 Image Writes - - XAA provides a mechanism for transfering full color pixel data from - system memory to video memory through the accelerator. This is - useful for dealing with alignment issues and performing raster ops - on the data when writing it to the framebuffer. As with color - expansion rectangles, there is a direct and indirect method. The - direct method sends all data through a memory mapped aperature. - The indirect method sends the data to an intermediated buffer scanline - at a time. - - The direct and indirect methods have separate flags fields, the - ImageWriteFlags and ScanlineImageWriteFlags respectively. - Flags specific to one method or the other are described in sections - 2.8.1 and 2.8.2 but for both cases the GXCOPY_ONLY, ROP_NEEDS_SOURCE - and NO_PLANEMASK flags described in Section 2.0 are valid as well as - the following: - - NO_GXCOPY - - In order to have accelerated image transfers faster than the - software versions for GXcopy, the engine needs to support clipping, - be using the direct method and have a large enough image transfer - range so that CPU_TRANSFER_BASE_FIXED doesn't need to be set. - If these are not supported, then it is unlikely that transfering - the data through the accelerator will be of any advantage for the - simple case of GXcopy. In fact, it may be much slower. For such - cases it's probably best to set the NO_GXCOPY flag so that - Image writes will only be used for the more complicated rops. - - /* transparency restrictions */ - - NO_TRANSPARENCY - - This indicates that the accelerator does not support skipping - of color keyed pixels when copying from the source to the destination. - - TRANSPARENCY_GXCOPY_ONLY - - This indicates that the accelerator supports skipping of color keyed - pixels only when the rop is GXcopy. - - /* clipping (optional) */ - - LEFT_EDGE_CLIPPING - - This indicates that the accelerator supports omission of up to - 3 pixels on the left edge of the rectangle to be filled. This - is beneficial since it allows transfer from the source pixmap to - always occur from DWORD boundaries. - - LEFT_EDGE_CLIPPING_NEGATIVE_X - - This flag indicates that the accelerator can fill areas with - image write data even if the value of x origin is negative (off of - the screen on the left edge). - - -2.8.1 The Direct Method - - Using the direct method of ImageWrite XAA will send all - bitmap data to the accelerator serially through an memory mapped - transfer window defined by the following two fields: - - unsigned char *ImageWriteBase - - This indicates the memory address of the beginning of the aperture. - - int ImageWriteRange - - This indicates the size in bytes of the aperture. - - The driver should specify how the transfered data should be padded. - There are options for both the padding of each Y scanline and for the - total transfer to the aperature. - One of the following two flags must be set: - - CPU_TRANSFER_PAD_DWORD - - This indicates that the total transfer (sum of all scanlines) sent - to the aperature must be DWORD padded. This is the default behavior. - - CPU_TRANSFER_PAD_QWORD - - This indicates that the total transfer (sum of all scanlines) sent - to the aperature must be QWORD padded. With this set, XAA will send - an extra DWORD to the aperature when needed to ensure that only - an even number of DWORDs are sent. - - And then there are the flags for padding of each scanline: - - SCANLINE_PAD_DWORD - - This indicates that each Y scanline should be DWORD padded. - This is the only option available and is the default. - - Finally, there is the CPU_TRANSFER_BASE_FIXED flag which indicates - that the aperture is a single register rather than a range of - registers, and XAA should write all of the data to the first DWORD. - XAA will automatically select CPU_TRANSFER_BASE_FIXED if the - ImageWriteRange is not large enough to accomodate an entire scanline. - - -void SetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, - int trans_color, int bpp, int depth) - - If trans_color is not -1 then trans_color indicates the transparency - color key and pixels with color trans_color passed through the - aperature should not be transfered to the screen but should be - skipped. Bpp and depth indicate the bits per pixel and depth of - the source pixmap. Trans_color is always -1 if the NO_TRANSPARENCY - flag is set. - - -void SubsequentImageWriteRect(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft) - - - Data passed through the aperature should be copied to a rectangle - of width "w" and height "h" with origin (x,y). If LEFT_EDGE_CLIPPING - has been enabled, skipleft will correspond to the number of pixels - on the left edge that should not be drawn. Skipleft is zero - otherwise. - - It can be arranged for XAA to call Sync() after it is through - calling the Subsequent functions by setting SYNC_AFTER_IMAGE_WRITE - in the ImageWriteFlags. This can provide the driver with an - oportunity to reset a clipping window if needed. - -2.8.2 The Indirect Method - - Using the indirect method, XAA will render the pixel data scanline - at a time to one or more buffers. These buffers may be memory - mapped apertures or just intermediate storage. - - int NumScanlineImageWriteBuffers - - This indicates the number of buffers available. - - unsigned char **ScanlineImageWriteBuffers - - This is an array of pointers to the memory locations of each buffer. - Each buffer is expected to be large enough to accommodate scanlines - the width of the screen. That is: - - pScrn->VirtualX * pScreen->bitsPerPixel/8 bytes or more. - - If LEFT_EDGE_CLIPPING_NEGATIVE_X is set, add an additional 4 - bytes to that requirement in 8 and 16bpp, 12 bytes in 24bpp. - - Scanlines are always DWORD padded. - -void SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int trans_color, - int bpp, int depth) - - If trans_color is not -1 then trans_color indicates the transparency - color key and pixels with color trans_color in the buffer should not - be transfered to the screen but should be skipped. Bpp and depth - indicate the bits per pixel and depth of the source bitmap. - Trans_color is always -1 if the NO_TRANSPARENCY flag is set. - - -void SubsequentImageWriteRect(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft) - - -void SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) - - - When SubsequentImageWriteRect is called, XAA will begin - transfering the source data scanline at a time, calling - SubsequentImageWriteScanline after each scanline. If more than - one buffer is available, XAA will cycle through the buffers. - Subsequent scanlines will use the next buffer and go back to the - buffer 0 again when the last buffer is reached. The index into - the ScanlineImageWriteBuffers array is presented as "bufno" - with each SubsequentImageWriteScanline call. - - The skipleft field is the same as for the direct method. - - The indirect method can be use to send the source data directly - to a memory mapped aperture represented by a single image write - buffer, scanline at a time, but more commonly it is used to place - the data into offscreen video memory so that the accelerator can - blit it to the visible screen from there. In the case where the - accelerator permits rendering into offscreen video memory while - the accelerator is active, several buffers can be used so that - XAA can be placing source data into the next buffer while the - accelerator is blitting the current buffer. For cases where - the accelerator requires some special manipulation of the source - data first, the buffers can be in system memory. The CPU can - manipulate these buffers and then send the data to the accelerator. - - -2.9 Clipping - - XAA supports hardware clipping rectangles. To use clipping - in this way it is expected that the graphics accelerator can - clip primitives with verticies anywhere in the 16 bit signed - coordinate system. - -void SetClippingRectangle ( ScrnInfoPtr pScrn, - int left, int top, int right, int bottom) - -void DisableClipping (ScrnInfoPtr pScrn) - - When SetClippingRectangle is called, all hardware rendering - following it should be clipped to the rectangle specified - until DisableClipping is called. - - The ClippingFlags field indicates which operations this sort - of Set/Disable pairing can be used with. Any of the following - flags may be OR'd together. - - HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND - HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY - HARDWARE_CLIP_MONO_8x8_FILL - HARDWARE_CLIP_COLOR_8x8_FILL - HARDWARE_CLIP_SOLID_FILL - HARDWARE_CLIP_DASHED_LINE - HARDWARE_CLIP_SOLID_LINE - - - -3) XAA PIXMAP CACHE - - /* NOTE: XAA has no knowledge of framebuffer particulars so until - the framebuffer is able to render into offscreen memory, usage - of the pixmap cache requires that the driver provide ImageWrite - routines or a WritePixmap or WritePixmapToCache replacement so - that patterns can even be placed in the cache. - - ADDENDUM: XAA can now load the pixmap cache without requiring - that the driver supply an ImageWrite function, but this can - only be done on linear framebuffers. If you have a linear - framebuffer, set LINEAR_FRAMEBUFFER in the XAAInfoRec.Flags - field and XAA will then be able to upload pixmaps into the - cache without the driver providing functions to do so. - */ - - - The XAA pixmap cache provides a mechanism for caching of patterns - in offscreen video memory so that tiled fills and in some cases - stippling can be done by blitting the source patterns from offscreen - video memory. The pixmap cache also provides the mechanism for caching - of 8x8 color and mono hardware patterns. Any unused offscreen video - memory gets used for the pixmap cache and that information is - provided by the XFree86 Offscreen Memory Manager. XAA registers a - callback with the manager so that it can be informed of any changes - in the offscreen memory configuration. The driver writer does not - need to deal with any of this since it is all automatic. The driver - merely needs to initialize the Offscreen Memory Manager as described - in the DESIGN document and set the PIXMAP_CACHE flag in the - XAAInfoRec.Flags field. The Offscreen Memory Manager initialization - must occur before XAA is initialized or else pixmap cache - initialization will fail. - - PixmapCacheFlags is an XAAInfoRec field which allows the driver to - control pixmap cache behavior to some extent. Currently only one - flag is defined: - - DO_NOT_BLIT_STIPPLES - - This indicates that the stippling should not be done by blitting - from the pixmap cache. This does not apply to 8x8 pattern fills. - - - CachePixelGranularity is an optional field. If the hardware requires - that a 8x8 patterns have some particular pixel alignment it should - be reflected in this field. Ignoring this field or setting it to - zero or one means there are no alignment issues. - - -4) OFFSCREEN PIXMAPS - - XAA has the ability to store pixmap drawables in offscreen video - memory and render into them with full hardware acceleration. Placement - of pixmaps in the cache is done automatically on a first-come basis and - only if there is room. To enable this feature, set the OFFSCREEN_PIXMAPS - flag in the XAAInfoRec.Flags field. This is only available when a - ScreenToScreenCopy function is provided, when the Offscreen memory - manager has been initialized and when the LINEAR_FRAMEBUFFER flag is - also set. - - int maxOffPixWidth - int maxOffPixHeight - - These two fields allow the driver to limit the maximum dimensions - of an offscreen pixmap. If one of these is not set, it is assumed - that there is no limit on that dimension. Note that if an offscreen - pixmap with a particular dimension is allowed, then your driver will be - expected to render primitives as large as that pixmap. - -$XFree86: xc/programs/Xserver/hw/xfree86/xaa/XAA.HOWTO,v 1.12 2000/04/12 14:44:42 tsi Exp $ diff --git a/xserver/hw/xfree86/xaa/xaa.h b/xserver/hw/xfree86/xaa/xaa.h deleted file mode 100644 index b530037c9..000000000 --- a/xserver/hw/xfree86/xaa/xaa.h +++ /dev/null @@ -1,1038 +0,0 @@ - -#ifndef _XAA_H -#define _XAA_H - -#define XAA_VERSION_MAJOR 1 -#define XAA_VERSION_MINOR 2 -#define XAA_VERSION_RELEASE 1 - -/* - - ******** OPERATION SPECIFIC FLAGS ********* - - **** solid/dashed line flags **** - ---------- -------- -23 LINE_PATTERN_LSBFIRST_MSBJUSTIFIED -22 LINE_PATTERN_LSBFIRST_LSBJUSTIFIED -21 LINE_PATTERN_MSBFIRST_MSBJUSTIFIED -20 LINE_PATTERN_MSBFIRST_LSBJUSTIFIED -19 LINE_PATTERN_POWER_OF_2_ONLY -18 LINE_LIMIT_COORDS -17 . -16 . ---------- ------- - - **** screen to screen copy flags **** - ---------- -------- -23 ONLY_LEFT_TO_RIGHT_BITBLT -22 ONLY_TWO_BITBLT_DIRECTIONS -21 . -20 . -19 . -18 . -17 . -16 . ---------- ------- - - **** clipping flags **** - ---------- -------- -23 . -22 HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND -21 HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY -20 HARDWARE_CLIP_MONO_8x8_FILL -19 HARDWARE_CLIP_COLOR_8x8_FILL -18 HARDWARE_CLIP_SOLID_FILL -17 HARDWARE_CLIP_DASHED_LINE -16 HARDWARE_CLIP_SOLID_LINE ---------- ------- - - **** hardware pattern flags **** - ---------- -------- -23 . -22 . -21 HARDWARE_PATTERN_SCREEN_ORIGIN -20 . -19 . -18 . -17 HARDWARE_PATTERN_PROGRAMMED_ORIGIN -16 HARDWARE_PATTERN_PROGRAMMED_BITS ---------- ------- - - **** write pixmap flags **** - ---------- -------- -23 . -22 . -21 . -20 . -19 . -18 . -17 . -16 CONVERT_32BPP_TO_24BPP ---------- ------- - - ******** GENERIC FLAGS ********* - ---------- ------- -15 SYNC_AFTER_COLOR_EXPAND -14 CPU_TRANSFER_PAD_QWORD -13 . -12 LEFT_EDGE_CLIPPING_NEGATIVE_X -11 LEFT_EDGE_CLIPPING -10 CPU_TRANSFER_BASE_FIXED - 9 BIT_ORDER_IN_BYTE_MSBFIRST - 8 TRANSPARENCY_GXCOPY_ONLY ---------- ------- - 7 NO_TRANSPARENCY - 6 TRANSPARENCY_ONLY - 5 ROP_NEEDS_SOURCE - 4 TRIPLE_BITS_24BPP - 3 RGB_EQUAL - 2 NO_PLANEMASK - 1 NO_GXCOPY - 0 GXCOPY_ONLY ---------- ------- - - -*/ - -#include "gcstruct.h" -#include "pixmapstr.h" -#include "xf86str.h" -#include "regionstr.h" -#include "xf86fbman.h" - -#include "picturestr.h" - -/* Flags */ -#define PIXMAP_CACHE 0x00000001 -#define MICROSOFT_ZERO_LINE_BIAS 0x00000002 -#define OFFSCREEN_PIXMAPS 0x00000004 -#define LINEAR_FRAMEBUFFER 0x00000008 - -/* GC fg, bg, and planemask restrictions */ -#define GXCOPY_ONLY 0x00000001 -#define NO_GXCOPY 0x00000002 -#define NO_PLANEMASK 0x00000004 -#define RGB_EQUAL 0x00000008 -#define TRIPLE_BITS_24BPP 0x00000010 -#define ROP_NEEDS_SOURCE 0x00000020 - -/* transparency restrictions */ -#define TRANSPARENCY_ONLY 0x00000040 -#define NO_TRANSPARENCY 0x00000080 -#define TRANSPARENCY_GXCOPY_ONLY 0x00000100 - -/* bit order restrictions */ -#define BIT_ORDER_IN_BYTE_MSBFIRST 0x00000200 -#define BIT_ORDER_IN_BYTE_LSBFIRST 0x00000000 - -/* transfer base restriction */ -#define CPU_TRANSFER_BASE_FIXED 0x00000400 - -/* skipleft restrictions */ -#define LEFT_EDGE_CLIPPING 0x00000800 -#define LEFT_EDGE_CLIPPING_NEGATIVE_X 0x00001000 - -/* data padding */ -#define CPU_TRANSFER_PAD_DWORD 0x00000000 -#define CPU_TRANSFER_PAD_QWORD 0x00004000 -#define SCANLINE_PAD_DWORD 0x00000000 - -#define SYNC_AFTER_COLOR_EXPAND 0x00008000 -#define SYNC_AFTER_IMAGE_WRITE SYNC_AFTER_COLOR_EXPAND - -/* hardware pattern */ -#define HARDWARE_PATTERN_PROGRAMMED_BITS 0x00010000 -#define HARDWARE_PATTERN_PROGRAMMED_ORIGIN 0x00020000 -#define HARDWARE_PATTERN_SCREEN_ORIGIN 0x00200000 - -/* copyarea flags */ -#define ONLY_TWO_BITBLT_DIRECTIONS 0x00400000 -#define ONLY_LEFT_TO_RIGHT_BITBLT 0x00800000 - -/* line flags */ -#define LINE_PATTERN_LSBFIRST_MSBJUSTIFIED 0x00800000 -#define LINE_PATTERN_LSBFIRST_LSBJUSTIFIED 0x00400000 -#define LINE_PATTERN_MSBFIRST_MSBJUSTIFIED 0x00200000 -#define LINE_PATTERN_MSBFIRST_LSBJUSTIFIED 0x00100000 -#define LINE_PATTERN_POWER_OF_2_ONLY 0x00080000 -#define LINE_LIMIT_COORDS 0x00040000 - -/* clipping flags */ -#define HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND 0x00400000 -#define HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY 0x00200000 -#define HARDWARE_CLIP_MONO_8x8_FILL 0x00100000 -#define HARDWARE_CLIP_COLOR_8x8_FILL 0x00080000 -#define HARDWARE_CLIP_SOLID_FILL 0x00040000 -#define HARDWARE_CLIP_DASHED_LINE 0x00020000 -#define HARDWARE_CLIP_SOLID_LINE 0x00010000 - -#define HARDWARE_CLIP_LINE 0x00000000 - -/* image write flags */ -#define CONVERT_32BPP_TO_24BPP 0x00010000 - -/* pixmap cache flags */ -#define CACHE_MONO_8x8 0x00000001 -#define CACHE_COLOR_8x8 0x00000002 -#define DO_NOT_BLIT_STIPPLES 0x00000004 -#define DO_NOT_TILE_MONO_DATA 0x00000008 -#define DO_NOT_TILE_COLOR_DATA 0x00000010 - -#define DEGREES_0 0 -#define DEGREES_90 1 -#define DEGREES_180 2 -#define DEGREES_270 3 - -#define OMIT_LAST 1 - -/* render flags */ - -#define XAA_RENDER_POWER_OF_2_TILE_ONLY 0x00000008 -#define XAA_RENDER_NO_SRC_ALPHA 0x00000004 -#define XAA_RENDER_IMPRECISE_ONLY 0x00000002 -#define XAA_RENDER_NO_TILE 0x00000001 - -#define XAA_RENDER_REPEAT 0x00000001 - -typedef void (*ValidateGCProcPtr) (GCPtr pGC, - unsigned long changes, DrawablePtr pDraw); - -typedef struct { - unsigned char *bits; - int width; - int height; - int yoff; - int srcwidth; - int start; - int end; -} NonTEGlyphInfo, *NonTEGlyphPtr; - -typedef struct { - int x; - int y; - int w; - int h; - int orig_w; - int orig_h; - unsigned long serialNumber; - int pat0; - int pat1; - int fg; - int bg; - int trans_color; - DDXPointPtr offsets; - DevUnion devPrivate; -} XAACacheInfoRec, *XAACacheInfoPtr; - -typedef struct _PixmapLink { - PixmapPtr pPix; - struct _PixmapLink *next; - FBAreaPtr area; -} PixmapLink, *PixmapLinkPtr; - -typedef struct _XAAInfoRec { - ScrnInfoPtr pScrn; - int Flags; - - void (*Sync) (ScrnInfoPtr pScrn); - - /* Restore Accel State is a driver callback that is used - * when another screen on the same device has been active. - * This allows multihead on a single device to work. - * If The entityProp has IS_SHARED_ACCEL defined then this - * function is required. - */ - - void (*RestoreAccelState) (ScrnInfoPtr pScrn); - - /***************** Low Level *****************/ - -/* Blits */ - void (*SetupForScreenToScreenCopy) (ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int trans_color); - int ScreenToScreenCopyFlags; - - void (*SubsequentScreenToScreenCopy) (ScrnInfoPtr pScrn, - int xsrc, int ysrc, - int xdst, int ydst, int w, int h); - -/* Solid fills */ - void (*SetupForSolidFill) (ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask); - int SolidFillFlags; - - void (*SubsequentSolidFillRect) (ScrnInfoPtr pScrn, - int x, int y, int w, int h); - - void (*SubsequentSolidFillTrap) (ScrnInfoPtr pScrn, - int y, int h, - int left, int dxL, int dyL, int eL, - int right, int dxR, int dyR, int eR); - -/* Solid lines */ - - void (*SetupForSolidLine) (ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask); - int SolidLineFlags; - - void (*SubsequentSolidTwoPointLine) (ScrnInfoPtr pScrn, - int xa, int ya, int xb, int yb, - int flags); - - void (*SubsequentSolidBresenhamLine) (ScrnInfoPtr pScrn, - int x, int y, int absmaj, int absmin, - int err, int len, int octant); - int SolidBresenhamLineErrorTermBits; - - void (*SubsequentSolidHorVertLine) (ScrnInfoPtr pScrn, - int x, int y, int len, int dir); - -/* Dashed lines */ - - void (*SetupForDashedLine) (ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask, - int length, unsigned char *pattern); - int DashedLineFlags; - int DashPatternMaxLength; - - void (*SubsequentDashedTwoPointLine) (ScrnInfoPtr pScrn, - int xa, int ya, int xb, int yb, - int flags, int phase); - - void (*SubsequentDashedBresenhamLine) (ScrnInfoPtr pScrn, - int x, int y, int absmaj, int absmin, - int err, int len, int flags, - int phase); - int DashedBresenhamLineErrorTermBits; - -/* Clipper */ - - void (*SetClippingRectangle) (ScrnInfoPtr pScrn, - int left, int top, int right, int bottom); - int ClippingFlags; - - void (*DisableClipping) (ScrnInfoPtr pScrn); - -/* 8x8 mono pattern fills */ - void (*SetupForMono8x8PatternFill) (ScrnInfoPtr pScrn, - int patx, int paty, - int fg, int bg, - int rop, unsigned int planemask); - int Mono8x8PatternFillFlags; - - void (*SubsequentMono8x8PatternFillRect) (ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h); - - void (*SubsequentMono8x8PatternFillTrap) (ScrnInfoPtr pScrn, - int patx, int paty, - int y, int h, - int left, int dxL, int dyL, - int eL, int right, int dxR, - int dyR, int eR); - -/* 8x8 color pattern fills */ - - void (*SetupForColor8x8PatternFill) (ScrnInfoPtr pScrn, - int patx, int paty, - int rop, - unsigned int planemask, - int transparency_color); - int Color8x8PatternFillFlags; - - void (*SubsequentColor8x8PatternFillRect) (ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h); - - void (*SubsequentColor8x8PatternFillTrap) (ScrnInfoPtr pScrn, - int patx, int paty, - int y, int h, - int left, int dxL, int dyL, - int eL, int right, int dxR, - int dyR, int eR); - -/* Color expansion */ - - void (*SetupForCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask); - int CPUToScreenColorExpandFillFlags; - - void (*SubsequentCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft); - - unsigned char *ColorExpandBase; - int ColorExpandRange; - -/* Scanline color expansion */ - - void (*SetupForScanlineCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask); - int ScanlineCPUToScreenColorExpandFillFlags; - - void (*SubsequentScanlineCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn, - int x, int y, int w, - int h, int skipleft); - - void (*SubsequentColorExpandScanline) (ScrnInfoPtr pScrn, int bufno); - - int NumScanlineColorExpandBuffers; - unsigned char **ScanlineColorExpandBuffers; - -/* Screen to screen color expansion */ - - void (*SetupForScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask); - int ScreenToScreenColorExpandFillFlags; - - void (*SubsequentScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, - int skipleft); - -/* Image transfers */ - - void (*SetupForImageWrite) (ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int transparency_color, int bpp, int depth); - int ImageWriteFlags; - - void (*SubsequentImageWriteRect) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); - unsigned char *ImageWriteBase; - int ImageWriteRange; - -/* Scanline Image transfers */ - - void (*SetupForScanlineImageWrite) (ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int transparency_color, - int bpp, int depth); - int ScanlineImageWriteFlags; - - void (*SubsequentScanlineImageWriteRect) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft); - - void (*SubsequentImageWriteScanline) (ScrnInfoPtr pScrn, int bufno); - - int NumScanlineImageWriteBuffers; - unsigned char **ScanlineImageWriteBuffers; - - /* Image Reads - OBSOLETE AND NOT USED */ - - void (*SetupForImageRead) (ScrnInfoPtr pScrn, int bpp, int depth); - int ImageReadFlags; - - unsigned char *ImageReadBase; - int ImageReadRange; - - void (*SubsequentImageReadRect) (ScrnInfoPtr pScrn, - int x, int y, int w, int h); - - /***************** Mid Level *****************/ - void (*ScreenToScreenBitBlt) (ScrnInfoPtr pScrn, - int nbox, - DDXPointPtr pptSrc, - BoxPtr pbox, - int xdir, int ydir, - int alu, unsigned int planmask); - int ScreenToScreenBitBltFlags; - - void (*WriteBitmap) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, int rop, unsigned int planemask); - int WriteBitmapFlags; - - void (*FillSolidRects) (ScrnInfoPtr pScrn, - int fg, int rop, - unsigned int planemask, int nBox, BoxPtr pBox); - int FillSolidRectsFlags; - - void (*FillMono8x8PatternRects) (ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int pat0, int pat1, int xorg, int yorg); - int FillMono8x8PatternRectsFlags; - - void (*FillColor8x8PatternRects) (ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, - XAACacheInfoPtr pCache); - int FillColor8x8PatternRectsFlags; - - void (*FillCacheBltRects) (ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, XAACacheInfoPtr pCache); - int FillCacheBltRectsFlags; - - void (*FillColorExpandRects) (ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - int FillColorExpandRectsFlags; - - void (*FillCacheExpandRects) (ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - int FillCacheExpandRectsFlags; - - void (*FillImageWriteRects) (ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - int FillImageWriteRectsFlags; - - void (*FillSolidSpans) (ScrnInfoPtr pScrn, - int fg, int rop, - unsigned int planemask, - int n, - DDXPointPtr points, int *widths, int fSorted); - int FillSolidSpansFlags; - - void (*FillMono8x8PatternSpans) (ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr points, - int *widths, - int fSorted, - int pat0, int pat1, int xorg, int yorg); - int FillMono8x8PatternSpansFlags; - - void (*FillColor8x8PatternSpans) (ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int n, - DDXPointPtr points, - int *widths, - int fSorted, - XAACacheInfoPtr pCache, - int xorg, int yorg); - int FillColor8x8PatternSpansFlags; - - void (*FillCacheBltSpans) (ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int n, - DDXPointPtr points, - int *widths, - int fSorted, - XAACacheInfoPtr pCache, int xorg, int yorg); - int FillCacheBltSpansFlags; - - void (*FillColorExpandSpans) (ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr points, - int *widths, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - int FillColorExpandSpansFlags; - - void (*FillCacheExpandSpans) (ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - int FillCacheExpandSpansFlags; - - void (*TEGlyphRenderer) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask); - int TEGlyphRendererFlags; - - void (*NonTEGlyphRenderer) (ScrnInfoPtr pScrn, - int x, int y, int n, - NonTEGlyphPtr glyphs, - BoxPtr pbox, - int fg, int rop, unsigned int planemask); - int NonTEGlyphRendererFlags; - - void (*WritePixmap) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int rop, - unsigned int planemask, - int transparency_color, int bpp, int depth); - int WritePixmapFlags; - - void (*ReadPixmap) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *dst, int dstwidth, int bpp, int depth); - int ReadPixmapFlags; - - /***************** GC Level *****************/ - RegionPtr (*CopyArea) (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GC * pGC, - int srcx, int srcy, - int width, int height, int dstx, int dsty); - int CopyAreaFlags; - - RegionPtr (*CopyPlane) (DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, unsigned long bitPlane); - int CopyPlaneFlags; - - void (*PushPixelsSolid) (GCPtr pGC, - PixmapPtr pBitMap, - DrawablePtr pDrawable, - int dx, int dy, int xOrg, int yOrg); - int PushPixelsFlags; - - /** PolyFillRect **/ - - void (*PolyFillRectSolid) (DrawablePtr pDraw, - GCPtr pGC, int nrectFill, xRectangle *prectInit); - int PolyFillRectSolidFlags; - - void (*PolyFillRectStippled) (DrawablePtr pDraw, - GCPtr pGC, - int nrectFill, xRectangle *prectInit); - int PolyFillRectStippledFlags; - - void (*PolyFillRectOpaqueStippled) (DrawablePtr pDraw, - GCPtr pGC, - int nrectFill, xRectangle *prectInit); - int PolyFillRectOpaqueStippledFlags; - - void (*PolyFillRectTiled) (DrawablePtr pDraw, - GCPtr pGC, int nrectFill, xRectangle *prectInit); - int PolyFillRectTiledFlags; - - /** FillSpans **/ - - void (*FillSpansSolid) (DrawablePtr pDraw, - GCPtr pGC, - int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted); - int FillSpansSolidFlags; - - void (*FillSpansStippled) (DrawablePtr pDraw, - GCPtr pGC, - int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted); - int FillSpansStippledFlags; - - void (*FillSpansOpaqueStippled) (DrawablePtr pDraw, - GCPtr pGC, - int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted); - int FillSpansOpaqueStippledFlags; - - void (*FillSpansTiled) (DrawablePtr pDraw, - GCPtr pGC, - int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted); - int FillSpansTiledFlags; - - int (*PolyText8TE) (DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars); - int PolyText8TEFlags; - - int (*PolyText16TE) (DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, unsigned short *chars); - int PolyText16TEFlags; - - void (*ImageText8TE) (DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars); - int ImageText8TEFlags; - - void (*ImageText16TE) (DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, unsigned short *chars); - int ImageText16TEFlags; - - void (*ImageGlyphBltTE) (DrawablePtr pDrawable, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); - int ImageGlyphBltTEFlags; - - void (*PolyGlyphBltTE) (DrawablePtr pDrawable, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); - int PolyGlyphBltTEFlags; - - int (*PolyText8NonTE) (DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars); - int PolyText8NonTEFlags; - - int (*PolyText16NonTE) (DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, unsigned short *chars); - int PolyText16NonTEFlags; - - void (*ImageText8NonTE) (DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars); - int ImageText8NonTEFlags; - - void (*ImageText16NonTE) (DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, unsigned short *chars); - int ImageText16NonTEFlags; - - void (*ImageGlyphBltNonTE) (DrawablePtr pDrawable, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); - int ImageGlyphBltNonTEFlags; - - void (*PolyGlyphBltNonTE) (DrawablePtr pDrawable, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); - int PolyGlyphBltNonTEFlags; - - void (*PolyRectangleThinSolid) (DrawablePtr pDrawable, - GCPtr pGC, - int nRectsInit, xRectangle *pRectsInit); - int PolyRectangleThinSolidFlags; - - void (*PolylinesWideSolid) (DrawablePtr pDrawable, - GCPtr pGC, int mode, int npt, DDXPointPtr pPts); - int PolylinesWideSolidFlags; - - void (*PolylinesThinSolid) (DrawablePtr pDrawable, - GCPtr pGC, int mode, int npt, DDXPointPtr pPts); - int PolylinesThinSolidFlags; - - void (*PolySegmentThinSolid) (DrawablePtr pDrawable, - GCPtr pGC, int nseg, xSegment * pSeg); - int PolySegmentThinSolidFlags; - - void (*PolylinesThinDashed) (DrawablePtr pDrawable, - GCPtr pGC, - int mode, int npt, DDXPointPtr pPts); - int PolylinesThinDashedFlags; - - void (*PolySegmentThinDashed) (DrawablePtr pDrawable, - GCPtr pGC, int nseg, xSegment * pSeg); - int PolySegmentThinDashedFlags; - - void (*FillPolygonSolid) (DrawablePtr pDrawable, - GCPtr pGC, - int shape, - int mode, int count, DDXPointPtr ptsIn); - int FillPolygonSolidFlags; - - void (*FillPolygonStippled) (DrawablePtr pDrawable, - GCPtr pGC, - int shape, - int mode, int count, DDXPointPtr ptsIn); - int FillPolygonStippledFlags; - - void (*FillPolygonOpaqueStippled) (DrawablePtr pDrawable, - GCPtr pGC, - int shape, - int mode, int count, DDXPointPtr ptsIn); - int FillPolygonOpaqueStippledFlags; - - void (*FillPolygonTiled) (DrawablePtr pDrawable, - GCPtr pGC, - int shape, - int mode, int count, DDXPointPtr ptsIn); - int FillPolygonTiledFlags; - - void (*PolyFillArcSolid) (DrawablePtr pDraw, - GCPtr pGC, int narcs, xArc * parcs); - int PolyFillArcSolidFlags; - - void (*PutImage) (DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, - int y, - int w, int h, int leftPad, int format, char *pImage); - int PutImageFlags; - - /* Validation masks */ - - unsigned long FillSpansMask; - ValidateGCProcPtr ValidateFillSpans; - unsigned long SetSpansMask; - ValidateGCProcPtr ValidateSetSpans; - unsigned long PutImageMask; - ValidateGCProcPtr ValidatePutImage; - unsigned long CopyAreaMask; - ValidateGCProcPtr ValidateCopyArea; - unsigned long CopyPlaneMask; - ValidateGCProcPtr ValidateCopyPlane; - unsigned long PolyPointMask; - ValidateGCProcPtr ValidatePolyPoint; - unsigned long PolylinesMask; - ValidateGCProcPtr ValidatePolylines; - unsigned long PolySegmentMask; - ValidateGCProcPtr ValidatePolySegment; - unsigned long PolyRectangleMask; - ValidateGCProcPtr ValidatePolyRectangle; - unsigned long PolyArcMask; - ValidateGCProcPtr ValidatePolyArc; - unsigned long FillPolygonMask; - ValidateGCProcPtr ValidateFillPolygon; - unsigned long PolyFillRectMask; - ValidateGCProcPtr ValidatePolyFillRect; - unsigned long PolyFillArcMask; - ValidateGCProcPtr ValidatePolyFillArc; - unsigned long PolyText8Mask; - ValidateGCProcPtr ValidatePolyText8; - unsigned long PolyText16Mask; - ValidateGCProcPtr ValidatePolyText16; - unsigned long ImageText8Mask; - ValidateGCProcPtr ValidateImageText8; - unsigned long ImageText16Mask; - ValidateGCProcPtr ValidateImageText16; - unsigned long PolyGlyphBltMask; - ValidateGCProcPtr ValidatePolyGlyphBlt; - unsigned long ImageGlyphBltMask; - ValidateGCProcPtr ValidateImageGlyphBlt; - unsigned long PushPixelsMask; - ValidateGCProcPtr ValidatePushPixels; - - void (*ComputeDash) (GCPtr pGC); - - /* Pixmap Cache */ - - int PixmapCacheFlags; - Bool UsingPixmapCache; - Bool CanDoMono8x8; - Bool CanDoColor8x8; - - void (*InitPixmapCache) (ScreenPtr pScreen, RegionPtr areas, pointer data); - void (*ClosePixmapCache) (ScreenPtr pScreen); - - int (*StippledFillChooser) (GCPtr pGC); - int (*OpaqueStippledFillChooser) (GCPtr pGC); - int (*TiledFillChooser) (GCPtr pGC); - - int CachePixelGranularity; - int MaxCacheableTileWidth; - int MaxCacheableTileHeight; - int MaxCacheableStippleWidth; - int MaxCacheableStippleHeight; - - XAACacheInfoPtr(*CacheTile) (ScrnInfoPtr Scrn, PixmapPtr pPix); - XAACacheInfoPtr(*CacheStipple) (ScrnInfoPtr Scrn, PixmapPtr pPix, - int fg, int bg); - XAACacheInfoPtr(*CacheMonoStipple) (ScrnInfoPtr Scrn, PixmapPtr pPix); - XAACacheInfoPtr(*CacheMono8x8Pattern) (ScrnInfoPtr Scrn, int pat0, - int pat1); - XAACacheInfoPtr(*CacheColor8x8Pattern) (ScrnInfoPtr Scrn, PixmapPtr pPix, - int fg, int bg); - - int MonoPatternPitch; - int CacheWidthMono8x8Pattern; - int CacheHeightMono8x8Pattern; - - int ColorPatternPitch; - int CacheWidthColor8x8Pattern; - int CacheHeightColor8x8Pattern; - - int CacheColorExpandDensity; - - void (*WriteBitmapToCache) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, int fg, int bg); - void (*WritePixmapToCache) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, int bpp, int depth); - void (*WriteMono8x8PatternToCache) (ScrnInfoPtr pScrn, - XAACacheInfoPtr pCache); - void (*WriteColor8x8PatternToCache) (ScrnInfoPtr pScrn, - PixmapPtr pPix, - XAACacheInfoPtr pCache); - - char *PixmapCachePrivate; - - /* Miscellaneous */ - - GC ScratchGC; - int PreAllocSize; - unsigned char *PreAllocMem; - - CharInfoPtr CharInfo[255]; - NonTEGlyphInfo GlyphInfo[255]; - - unsigned int FullPlanemask; /* deprecated */ - - PixmapLinkPtr OffscreenPixmaps; - int maxOffPixWidth; - int maxOffPixHeight; - - XAACacheInfoRec ScratchCacheInfoRec; - - BoxPtr ClipBox; - - Bool NeedToSync; - - char *dgaSaves; - - /* These can be supplied to override the defaults */ - - GetImageProcPtr GetImage; - GetSpansProcPtr GetSpans; - CopyWindowProcPtr CopyWindow; - - unsigned int offscreenDepths; - Bool offscreenDepthsInitialized; - - CARD32 FullPlanemasks[32]; - - Bool (*Composite) (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); - - Bool (*Glyphs) (CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, - INT16 ySrc, - int nlist, GlyphListPtr list, GlyphPtr * glyphs); - - /* The old SetupForCPUToScreenAlphaTexture function is no longer used because - * it doesn't pass in enough information to write a conforming - * implementation. See SetupForCPUToScreenAlphaTexture2. - */ - Bool (*SetupForCPUToScreenAlphaTexture) (ScrnInfoPtr pScrn, - int op, - CARD16 red, - CARD16 green, - CARD16 blue, - CARD16 alpha, - int alphaType, - CARD8 *alphaPtr, - int alphaPitch, - int width, int height, int flags); - void (*SubsequentCPUToScreenAlphaTexture) (ScrnInfoPtr pScrn, - int dstx, - int dsty, - int srcx, - int srcy, int width, int height); - int CPUToScreenAlphaTextureFlags; - CARD32 *CPUToScreenAlphaTextureFormats; - - /* The old SetupForCPUToScreenTexture function is no longer used because - * it doesn't pass in enough information to write a conforming - * implementation. See SetupForCPUToScreenTexture2. - */ - Bool (*SetupForCPUToScreenTexture) (ScrnInfoPtr pScrn, - int op, - int texType, - CARD8 *texPtr, - int texPitch, - int width, int height, int flags); - void (*SubsequentCPUToScreenTexture) (ScrnInfoPtr pScrn, - int dstx, - int dsty, - int srcx, - int srcy, int width, int height); - int CPUToScreenTextureFlags; - CARD32 *CPUToScreenTextureFormats; - - /* these were added for 4.3.0 */ - BoxRec SolidLineLimits; - BoxRec DashedLineLimits; - - /* These were added for X.Org 6.8.0 */ - Bool (*SetupForCPUToScreenAlphaTexture2) (ScrnInfoPtr pScrn, - int op, - CARD16 red, - CARD16 green, - CARD16 blue, - CARD16 alpha, - CARD32 maskFormat, - CARD32 dstFormat, - CARD8 *alphaPtr, - int alphaPitch, - int width, int height, int flags); - CARD32 *CPUToScreenAlphaTextureDstFormats; - - Bool (*SetupForCPUToScreenTexture2) (ScrnInfoPtr pScrn, - int op, - CARD32 srcFormat, - CARD32 dstFormat, - CARD8 *texPtr, - int texPitch, - int width, int height, int flags); - CARD32 *CPUToScreenTextureDstFormats; -} XAAInfoRec, *XAAInfoRecPtr; - -#define SET_SYNC_FLAG(infoRec) (infoRec)->NeedToSync = TRUE - -extern _X_EXPORT Bool - XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec); - -extern _X_EXPORT XAAInfoRecPtr XAACreateInfoRec(void); - -extern _X_EXPORT void - XAADestroyInfoRec(XAAInfoRecPtr infoRec); - -typedef void (*DepthChangeFuncPtr) (ScrnInfoPtr pScrn, int depth); - -extern _X_EXPORT Bool - XAAInitDualFramebufferOverlay(ScreenPtr pScreen, DepthChangeFuncPtr callback); - -#endif /* _XAA_H */ diff --git a/xserver/hw/xfree86/xaa/xaaBitBlt.c b/xserver/hw/xfree86/xaa/xaaBitBlt.c deleted file mode 100644 index c1595c497..000000000 --- a/xserver/hw/xfree86/xaa/xaaBitBlt.c +++ /dev/null @@ -1,229 +0,0 @@ - -/* - This is a lighter version of cfbBitBlt. We calculate the boxes - when accelerating pixmap->screen and screen->screen copies. - We also pass the GC to the doBitBlt function so that it has access - to the fg and bg so CopyPlane can use this. -*/ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "mi.h" -#include "pixmapstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "xaalocal.h" - -RegionPtr -XAABitBlt(DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GC * pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, - void (*doBitBlt) (DrawablePtr, DrawablePtr, GCPtr, RegionPtr, - DDXPointPtr), unsigned long bitPlane) -{ - - RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */ - RegionPtr prgnExposed; - Bool freeSrcClip = FALSE; - RegionRec rgnDst; - DDXPointPtr pptSrc, ppt; - DDXPointRec origDest; - BoxPtr pbox; - BoxRec fastBox; - int i, dx, dy, numRects; - xRectangle origSource; - int fastClip = 0; /* for fast clipping with pixmap source */ - int fastExpose = 0; /* for fast exposures with pixmap source */ - - origSource.x = srcx; - origSource.y = srcy; - origSource.width = width; - origSource.height = height; - origDest.x = dstx; - origDest.y = dsty; - - if (pSrcDrawable->pScreen->SourceValidate) { - (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, - width, height, - pGC->subWindowMode); - } - - srcx += pSrcDrawable->x; - srcy += pSrcDrawable->y; - - /* clip the source */ - if (pSrcDrawable->type == DRAWABLE_PIXMAP) { - if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE)) - prgnSrcClip = pGC->pCompositeClip; - else - fastClip = 1; - } - else { /* Window */ - if (pGC->subWindowMode == IncludeInferiors) { - if (!((WindowPtr) pSrcDrawable)->parent) { - /* - * special case bitblt from root window in - * IncludeInferiors mode; just like from a pixmap - */ - fastClip = 1; - } - else if ((pSrcDrawable == pDstDrawable) && - (pGC->clientClipType == CT_NONE)) { - prgnSrcClip = pGC->pCompositeClip; - } - else { - prgnSrcClip = NotClippedByChildren((WindowPtr) pSrcDrawable); - freeSrcClip = TRUE; - } - } - else { - prgnSrcClip = &((WindowPtr) pSrcDrawable)->clipList; - } - } - - fastBox.x1 = srcx; - fastBox.y1 = srcy; - fastBox.x2 = srcx + width; - fastBox.y2 = srcy + height; - - /* Don't create a source region if we are doing a fast clip */ - if (fastClip) { - fastExpose = 1; - /* - * clip the source; if regions extend beyond the source size, - * make sure exposure events get sent - */ - if (fastBox.x1 < pSrcDrawable->x) { - fastBox.x1 = pSrcDrawable->x; - fastExpose = 0; - } - if (fastBox.y1 < pSrcDrawable->y) { - fastBox.y1 = pSrcDrawable->y; - fastExpose = 0; - } - if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) { - fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; - fastExpose = 0; - } - if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) { - fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; - fastExpose = 0; - } - } - else { - RegionInit(&rgnDst, &fastBox, 1); - RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip); - } - - dstx += pDstDrawable->x; - dsty += pDstDrawable->y; - - if (pDstDrawable->type == DRAWABLE_WINDOW) { - if (!((WindowPtr) pDstDrawable)->realized) { - if (!fastClip) - RegionUninit(&rgnDst); - if (freeSrcClip) - RegionDestroy(prgnSrcClip); - return NULL; - } - } - - dx = srcx - dstx; - dy = srcy - dsty; - - /* Translate and clip the dst to the destination composite clip */ - if (fastClip) { - RegionPtr cclip; - - /* Translate the region directly */ - fastBox.x1 -= dx; - fastBox.x2 -= dx; - fastBox.y1 -= dy; - fastBox.y2 -= dy; - - /* If the destination composite clip is one rectangle we can - do the clip directly. Otherwise we have to create a full - blown region and call intersect */ - - cclip = pGC->pCompositeClip; - if (RegionNumRects(cclip) == 1) { - BoxPtr pBox = RegionRects(cclip); - - if (fastBox.x1 < pBox->x1) - fastBox.x1 = pBox->x1; - if (fastBox.x2 > pBox->x2) - fastBox.x2 = pBox->x2; - if (fastBox.y1 < pBox->y1) - fastBox.y1 = pBox->y1; - if (fastBox.y2 > pBox->y2) - fastBox.y2 = pBox->y2; - - /* Check to see if the region is empty */ - if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) { - RegionNull(&rgnDst); - } - else { - RegionInit(&rgnDst, &fastBox, 1); - } - } - else { - /* We must turn off fastClip now, since we must create - a full blown region. It is intersected with the - composite clip below. */ - fastClip = 0; - RegionInit(&rgnDst, &fastBox, 1); - } - } - else { - RegionTranslate(&rgnDst, -dx, -dy); - } - - if (!fastClip) { - RegionIntersect(&rgnDst, &rgnDst, pGC->pCompositeClip); - } - - /* Do bit blitting */ - numRects = RegionNumRects(&rgnDst); - if (numRects && width && height) { - if (!(pptSrc = (DDXPointPtr) malloc(numRects * sizeof(DDXPointRec)))) { - RegionUninit(&rgnDst); - if (freeSrcClip) - RegionDestroy(prgnSrcClip); - return NULL; - } - pbox = RegionRects(&rgnDst); - ppt = pptSrc; - for (i = numRects; --i >= 0; pbox++, ppt++) { - ppt->x = pbox->x1 + dx; - ppt->y = pbox->y1 + dy; - } - - (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC, &rgnDst, pptSrc); - free(pptSrc); - } - - prgnExposed = NULL; - if (pGC->fExpose) { - /* Pixmap sources generate a NoExposed (we return NULL to do this) */ - if (!fastExpose) - prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, - origSource.x, origSource.y, - (int) origSource.width, - (int) origSource.height, - origDest.x, origDest.y, bitPlane); - } - RegionUninit(&rgnDst); - if (freeSrcClip) - RegionDestroy(prgnSrcClip); - return prgnExposed; -} diff --git a/xserver/hw/xfree86/xaa/xaaBitOrder.c b/xserver/hw/xfree86/xaa/xaaBitOrder.c deleted file mode 100644 index 3d9b980e1..000000000 --- a/xserver/hw/xfree86/xaa/xaaBitOrder.c +++ /dev/null @@ -1,16 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <X11/Xmd.h> -#include "xaalocal.h" - -CARD32 -XAAReverseBitOrder(CARD32 v) -{ - return (((0x01010101 & v) << 7) | ((0x02020202 & v) << 5) | - ((0x04040404 & v) << 3) | ((0x08080808 & v) << 1) | - ((0x10101010 & v) >> 1) | ((0x20202020 & v) >> 3) | - ((0x40404040 & v) >> 5) | ((0x80808080 & v) >> 7)); -} diff --git a/xserver/hw/xfree86/xaa/xaaBitmap.c b/xserver/hw/xfree86/xaa/xaaBitmap.c deleted file mode 100644 index 45d5a09be..000000000 --- a/xserver/hw/xfree86/xaa/xaaBitmap.c +++ /dev/null @@ -1,477 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xaa.h" -#include "xaalocal.h" -#include "xaacexp.h" -#include "xf86.h" - -/********** byte swapping ***************/ - -#ifdef FIXEDBASE -#define DEST(i) *dest -#define RETURN(i) return(dest) -#else -#define DEST(i) dest[i] -#define RETURN(i) return(dest + i) -#endif - -#ifdef MSBFIRST -#define SOURCE(i) SWAP_BITS_IN_BYTES(src[i]) -#else -#define SOURCE(i) src[i] -#endif - -typedef CARD32 *(*BitmapScanlineProcPtr) (CARD32 *, CARD32 *, int, int); - -#ifdef TRIPLE_BITS -static CARD32 * -BitmapScanline(CARD32 *src, CARD32 *base, int count, int skipleft) -{ - CARD32 bits; - - while (count >= 3) { - bits = *src; - WRITE_BITS3(bits); - src++; - count -= 3; - } - if (count == 2) { - bits = *src; - WRITE_BITS2(bits); - } - else if (count == 1) { - bits = *src; - WRITE_BITS1(bits); - } - - return base; -} - -static CARD32 * -BitmapScanline_Inverted(CARD32 *src, CARD32 *base, int count, int skipleft) -{ - CARD32 bits; - - while (count >= 3) { - bits = ~(*src); - WRITE_BITS3(bits); - src++; - count -= 3; - } - if (count == 2) { - bits = ~(*src); - WRITE_BITS2(bits); - } - else if (count == 1) { - bits = ~(*src); - WRITE_BITS1(bits); - } - - return base; -} - -static CARD32 * -BitmapScanline_Shifted(CARD32 *src, CARD32 *base, int count, int skipleft) -{ - CARD32 bits; - - while (count >= 3) { - bits = SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft)); - WRITE_BITS3(bits); - src++; - count -= 3; - } - if (count == 2) { - bits = SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft)); - WRITE_BITS2(bits); - } - else if (count == 1) { - bits = SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft)); - WRITE_BITS1(bits); - } - - return base; -} - -static CARD32 * -BitmapScanline_Shifted_Inverted(CARD32 *src, CARD32 *base, - int count, int skipleft) -{ - CARD32 bits; - - while (count >= 3) { - bits = - ~(SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft))); - WRITE_BITS3(bits); - src++; - count -= 3; - } - if (count == 2) { - bits = - ~(SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft))); - WRITE_BITS2(bits); - } - else if (count == 1) { - bits = - ~(SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft))); - WRITE_BITS1(bits); - } - - return base; -} - -#define BitmapScanline_Shifted_Careful BitmapScanline_Shifted -#define BitmapScanline_Shifted_Inverted_Careful BitmapScanline_Shifted_Inverted - -#else -static CARD32 * -BitmapScanline(CARD32 *src, CARD32 *dest, int count, int skipleft) -{ - while (count >= 4) { - DEST(0) = SOURCE(0); - DEST(1) = SOURCE(1); - DEST(2) = SOURCE(2); - DEST(3) = SOURCE(3); - count -= 4; - src += 4; -#ifndef FIXEDBASE - dest += 4; -#endif - } - - if (!count) - return dest; - DEST(0) = SOURCE(0); - if (count == 1) - RETURN(1); - DEST(1) = SOURCE(1); - if (count == 2) - RETURN(2); - DEST(2) = SOURCE(2); - RETURN(3); -} - -static CARD32 * -BitmapScanline_Inverted(CARD32 *src, CARD32 *dest, int count, int skipleft) -{ - while (count >= 4) { - DEST(0) = ~SOURCE(0); - DEST(1) = ~SOURCE(1); - DEST(2) = ~SOURCE(2); - DEST(3) = ~SOURCE(3); - count -= 4; - src += 4; -#ifndef FIXEDBASE - dest += 4; -#endif - } - - if (!count) - return dest; - DEST(0) = ~SOURCE(0); - if (count == 1) - RETURN(1); - DEST(1) = ~SOURCE(1); - if (count == 2) - RETURN(2); - DEST(2) = ~SOURCE(2); - RETURN(3); -} - -static CARD32 * -BitmapScanline_Shifted(CARD32 *bits, CARD32 *base, int count, int skipleft) -{ - while (count--) { - register CARD32 tmp = SHIFT_R(*bits, skipleft) | - SHIFT_L(*(bits + 1), (32 - skipleft)); - WRITE_BITS(tmp); - bits++; - } - return base; -} - -static CARD32 * -BitmapScanline_Shifted_Inverted(CARD32 *bits, CARD32 *base, - int count, int skipleft) -{ - while (count--) { - register CARD32 tmp = ~(SHIFT_R(*bits, skipleft) | - SHIFT_L(*(bits + 1), (32 - skipleft))); - WRITE_BITS(tmp); - bits++; - } - return base; -} - -static CARD32 * -BitmapScanline_Shifted_Careful(CARD32 *bits, CARD32 *base, - int count, int skipleft) -{ - register CARD32 tmp; - - while (--count) { - tmp = SHIFT_R(*bits, skipleft) | SHIFT_L(*(bits + 1), (32 - skipleft)); - WRITE_BITS(tmp); - bits++; - } - tmp = SHIFT_R(*bits, skipleft); - WRITE_BITS(tmp); - - return base; -} - -static CARD32 * -BitmapScanline_Shifted_Inverted_Careful(CARD32 *bits, CARD32 *base, - int count, int skipleft) -{ - register CARD32 tmp; - - while (--count) { - tmp = - ~(SHIFT_R(*bits, skipleft) | SHIFT_L(*(bits + 1), (32 - skipleft))); - WRITE_BITS(tmp); - bits++; - } - tmp = ~(SHIFT_R(*bits, skipleft)); - WRITE_BITS(tmp); - return base; -} - -#endif - -/* - When the accelerator is TRANSPARENCY_ONLY, WriteBitmap can do - the fill in two passes, inverting the source on the second pass. - For GXcopy we can fill the backing rectangle as a solid rect and - avoid the invert. -*/ - -void -#ifdef TRIPLE_BITS - EXPNAME(XAAWriteBitmapColorExpand3) ( -#else - EXPNAME(XAAWriteBitmapColorExpand) ( -#endif - ScrnInfoPtr pScrn, - int x, int y, int w, int H, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - CARD32 *base; - unsigned char *srcp = src; - int SecondPassColor = -1; - int shift = 0, dwords; - BitmapScanlineProcPtr firstFunc; - BitmapScanlineProcPtr secondFunc; - int flag; - int h = H; - -#ifdef TRIPLE_BITS - if ((bg != -1) && - ((infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) || - ((infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) && - (!CHECK_RGB_EQUAL(bg))))) { -#else - if ((bg != -1) && - (infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) { -#endif - if ((rop == GXcopy) && infoRec->SetupForSolidFill) { - (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask); - (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h); - } - else - SecondPassColor = bg; - bg = -1; - } - -#ifdef TRIPLE_BITS - if (skipleft) { -#else - if (skipleft && - (!(infoRec->CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING) || - (!(infoRec-> - CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) && - (skipleft > x)))) { -#endif - if ((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) { - /* don't read past the end */ - firstFunc = BitmapScanline_Shifted_Careful; - secondFunc = BitmapScanline_Shifted_Inverted_Careful; - } - else { - firstFunc = BitmapScanline_Shifted; - secondFunc = BitmapScanline_Shifted_Inverted; - } - shift = skipleft; - skipleft = 0; - } - else { - firstFunc = BitmapScanline; - secondFunc = BitmapScanline_Inverted; - w += skipleft; - x -= skipleft; - } - -#ifdef TRIPLE_BITS - dwords = (3 * w + 31) >> 5; -#else - dwords = (w + 31) >> 5; -#endif - - SECOND_PASS: - - flag = (infoRec->CPUToScreenColorExpandFillFlags - & CPU_TRANSFER_PAD_QWORD) && ((dwords * h) & 0x01); - (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop, - planemask); - (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, w, h, - skipleft); - - base = (CARD32 *) infoRec->ColorExpandBase; - -#ifndef FIXEDBASE - if ((dwords * h) <= infoRec->ColorExpandRange) - while (h--) { - base = (*firstFunc) ((CARD32 *) srcp, base, dwords, shift); - srcp += srcwidth; - } - else -#endif - while (h--) { - (*firstFunc) ((CARD32 *) srcp, base, dwords, shift); - srcp += srcwidth; - } - - if (flag) { - base = (CARD32 *) infoRec->ColorExpandBase; - base[0] = 0x00000000; - } - - if (SecondPassColor != -1) { - h = H; /* Reset height */ - fg = SecondPassColor; - SecondPassColor = -1; - firstFunc = secondFunc; - srcp = src; - goto SECOND_PASS; - } - - if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND) - (*infoRec->Sync) (pScrn); - else - SET_SYNC_FLAG(infoRec); -} - -#ifndef FIXEDBASE - -void -#ifdef TRIPLE_BITS - EXPNAME(XAAWriteBitmapScanlineColorExpand3) ( -#else - EXPNAME(XAAWriteBitmapScanlineColorExpand) ( -#endif - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, - unsigned int planemask) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - CARD32 *base; - unsigned char *srcp = src; - int SecondPassColor = -1; - int shift = 0, dwords, bufferNo; - BitmapScanlineProcPtr firstFunc; - BitmapScanlineProcPtr secondFunc; - -#ifdef TRIPLE_BITS - if ((bg != -1) && - ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) - || ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) && - (!CHECK_RGB_EQUAL(bg))))) { -#else - if ((bg != -1) && - (infoRec-> - ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) { -#endif - if ((rop == GXcopy) && infoRec->SetupForSolidFill) { - (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask); - (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h); - } - else - SecondPassColor = bg; - bg = -1; - } - -#ifdef TRIPLE_BITS - if (skipleft) { -#else - if (skipleft && - (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & - LEFT_EDGE_CLIPPING) || - (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & - LEFT_EDGE_CLIPPING_NEGATIVE_X) && (skipleft > x)))) { -#endif - if ((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) { - /* don't read past the end */ - firstFunc = BitmapScanline_Shifted_Careful; - secondFunc = BitmapScanline_Shifted_Inverted_Careful; - } - else { - firstFunc = BitmapScanline_Shifted; - secondFunc = BitmapScanline_Shifted_Inverted; - } - shift = skipleft; - skipleft = 0; - } - else { - firstFunc = BitmapScanline; - secondFunc = BitmapScanline_Inverted; - w += skipleft; - x -= skipleft; - } - -#ifdef TRIPLE_BITS - dwords = (3 * w + 31) >> 5; -#else - dwords = (w + 31) >> 5; -#endif - - SECOND_PASS: - - (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, rop, - planemask); - (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y, w, h, - skipleft); - - bufferNo = 0; - - while (h--) { - base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo]; - (*firstFunc) ((CARD32 *) srcp, base, dwords, shift); - (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++); - srcp += srcwidth; - if (bufferNo >= infoRec->NumScanlineColorExpandBuffers) - bufferNo = 0; - } - - if (SecondPassColor != -1) { - fg = SecondPassColor; - SecondPassColor = -1; - firstFunc = secondFunc; - srcp = src; - goto SECOND_PASS; - } - - SET_SYNC_FLAG(infoRec); -} - -#endif diff --git a/xserver/hw/xfree86/xaa/xaaCpyArea.c b/xserver/hw/xfree86/xaa/xaaCpyArea.c deleted file mode 100644 index 0b11b810e..000000000 --- a/xserver/hw/xfree86/xaa/xaaCpyArea.c +++ /dev/null @@ -1,409 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" -#include "migc.h" -#include "gcstruct.h" -#include "pixmapstr.h" - -/* - Written mostly by Harm Hanemaayer (H.Hanemaayer@inter.nl.net). - */ - -RegionPtr -XAACopyArea(DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GC * pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - if (pDstDrawable->type == DRAWABLE_WINDOW) { - if ((pSrcDrawable->type == DRAWABLE_WINDOW) || - IS_OFFSCREEN_PIXMAP(pSrcDrawable)) { - if (infoRec->ScreenToScreenBitBlt && - CHECK_ROP(pGC, infoRec->ScreenToScreenBitBltFlags) && - CHECK_ROPSRC(pGC, infoRec->ScreenToScreenBitBltFlags) && - CHECK_PLANEMASK(pGC, infoRec->ScreenToScreenBitBltFlags)) - return (XAABitBlt(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, - XAADoBitBlt, 0L)); - } - else { - if (infoRec->WritePixmap && - ((pDstDrawable->bitsPerPixel == pSrcDrawable->bitsPerPixel) || - ((pDstDrawable->bitsPerPixel == 24) && - (pSrcDrawable->bitsPerPixel == 32) && - (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) && - CHECK_ROP(pGC, infoRec->WritePixmapFlags) && - CHECK_ROPSRC(pGC, infoRec->WritePixmapFlags) && - CHECK_PLANEMASK(pGC, infoRec->WritePixmapFlags) && - CHECK_NO_GXCOPY(pGC, infoRec->WritePixmapFlags)) - return (XAABitBlt(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, - XAADoImageWrite, 0L)); - } - } - else if (IS_OFFSCREEN_PIXMAP(pDstDrawable)) { - if ((pSrcDrawable->type == DRAWABLE_WINDOW) || - IS_OFFSCREEN_PIXMAP(pSrcDrawable)) { - if (infoRec->ScreenToScreenBitBlt && - CHECK_ROP(pGC, infoRec->ScreenToScreenBitBltFlags) && - CHECK_ROPSRC(pGC, infoRec->ScreenToScreenBitBltFlags) && - CHECK_PLANEMASK(pGC, infoRec->ScreenToScreenBitBltFlags)) - return (XAABitBlt(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, - XAADoBitBlt, 0L)); - } - } - - return (XAAFallbackOps.CopyArea(pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, dstx, dsty)); -} - -void -XAADoBitBlt(DrawablePtr pSrc, - DrawablePtr pDst, GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc) -{ - int nbox, careful; - BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; - DDXPointPtr pptTmp, pptNew1, pptNew2; - int xdir, ydir; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - /* XXX we have to err on the side of safety when both are windows, - * because we don't know if IncludeInferiors is being used. - */ - careful = ((pSrc == pDst) || - ((pSrc->type == DRAWABLE_WINDOW) && - (pDst->type == DRAWABLE_WINDOW))); - - pbox = RegionRects(prgnDst); - nbox = RegionNumRects(prgnDst); - - pboxNew1 = NULL; - pptNew1 = NULL; - pboxNew2 = NULL; - pptNew2 = NULL; - if (careful && (pptSrc->y < pbox->y1)) { - /* walk source botttom to top */ - ydir = -1; - - if (nbox > 1) { - /* keep ordering in each band, reverse order of bands */ - pboxNew1 = (BoxPtr) malloc(sizeof(BoxRec) * nbox); - if (!pboxNew1) - return; - pptNew1 = (DDXPointPtr) malloc(sizeof(DDXPointRec) * nbox); - if (!pptNew1) { - free(pboxNew1); - return; - } - pboxBase = pboxNext = pbox + nbox - 1; - while (pboxBase >= pbox) { - while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) - pboxNext--; - pboxTmp = pboxNext + 1; - pptTmp = pptSrc + (pboxTmp - pbox); - while (pboxTmp <= pboxBase) { - *pboxNew1++ = *pboxTmp++; - *pptNew1++ = *pptTmp++; - } - pboxBase = pboxNext; - } - pboxNew1 -= nbox; - pbox = pboxNew1; - pptNew1 -= nbox; - pptSrc = pptNew1; - } - } - else { - /* walk source top to bottom */ - ydir = 1; - } - - if (careful && (pptSrc->x < pbox->x1)) { - /* walk source right to left */ - xdir = -1; - - if (nbox > 1) { - /* reverse order of rects in each band */ - pboxNew2 = (BoxPtr) malloc(sizeof(BoxRec) * nbox); - pptNew2 = (DDXPointPtr) malloc(sizeof(DDXPointRec) * nbox); - if (!pboxNew2 || !pptNew2) { - free(pptNew2); - free(pboxNew2); - if (pboxNew1) { - free(pptNew1); - free(pboxNew1); - } - return; - } - pboxBase = pboxNext = pbox; - while (pboxBase < pbox + nbox) { - while ((pboxNext < pbox + nbox) && - (pboxNext->y1 == pboxBase->y1)) - pboxNext++; - pboxTmp = pboxNext; - pptTmp = pptSrc + (pboxTmp - pbox); - while (pboxTmp != pboxBase) { - *pboxNew2++ = *--pboxTmp; - *pptNew2++ = *--pptTmp; - } - pboxBase = pboxNext; - } - pboxNew2 -= nbox; - pbox = pboxNew2; - pptNew2 -= nbox; - pptSrc = pptNew2; - } - } - else { - /* walk source left to right */ - xdir = 1; - } - - (*infoRec->ScreenToScreenBitBlt) (infoRec->pScrn, nbox, pptSrc, pbox, - xdir, ydir, pGC->alu, pGC->planemask); - - if (pboxNew2) { - free(pptNew2); - free(pboxNew2); - } - if (pboxNew1) { - free(pptNew1); - free(pboxNew1); - } - -} - -void -XAADoImageWrite(DrawablePtr pSrc, - DrawablePtr pDst, - GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc) -{ - int srcwidth; - unsigned char *psrcBase; /* start of image */ - unsigned char *srcPntr; /* index into the image */ - BoxPtr pbox = RegionRects(prgnDst); - int nbox = RegionNumRects(prgnDst); - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int Bpp = pSrc->bitsPerPixel >> 3; - - psrcBase = (unsigned char *) ((PixmapPtr) pSrc)->devPrivate.ptr; - srcwidth = (int) ((PixmapPtr) pSrc)->devKind; - - for (; nbox; pbox++, pptSrc++, nbox--) { - srcPntr = psrcBase + (pptSrc->y * srcwidth) + (pptSrc->x * Bpp); - - (*infoRec->WritePixmap) (infoRec->pScrn, pbox->x1, pbox->y1, - pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, - srcPntr, srcwidth, pGC->alu, pGC->planemask, - -1, pSrc->bitsPerPixel, pSrc->depth); - } -} - -void -XAADoImageRead(DrawablePtr pSrc, - DrawablePtr pDst, - GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc) -{ - int dstwidth; - unsigned char *pdstBase; /* start of image */ - unsigned char *dstPntr; /* index into the image */ - BoxPtr pbox = RegionRects(prgnDst); - int nbox = RegionNumRects(prgnDst); - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int Bpp = pSrc->bitsPerPixel >> 3; /* wouldn't get here unless both - src and dst have same bpp */ - - pdstBase = (unsigned char *) ((PixmapPtr) pDst)->devPrivate.ptr; - dstwidth = (int) ((PixmapPtr) pDst)->devKind; - - for (; nbox; pbox++, pptSrc++, nbox--) { - dstPntr = pdstBase + (pbox->y1 * dstwidth) + (pbox->x1 * Bpp); - - (*infoRec->ReadPixmap) (infoRec->pScrn, pptSrc->x, pptSrc->y, - pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, - dstPntr, dstwidth, pSrc->bitsPerPixel, - pSrc->depth); - } -} - -void -XAAScreenToScreenBitBlt(ScrnInfoPtr pScrn, - int nbox, - DDXPointPtr pptSrc, - BoxPtr pbox, - int xdir, int ydir, int alu, unsigned int planemask) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int dirsetup; - - if ((!(infoRec->CopyAreaFlags & ONLY_TWO_BITBLT_DIRECTIONS) - || (xdir == ydir)) && - (!(infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT) - || (xdir == 1))) { - (*infoRec->SetupForScreenToScreenCopy) (pScrn, - xdir, ydir, alu, planemask, -1); - for (; nbox; pbox++, pptSrc++, nbox--) - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pptSrc->x, - pptSrc->y, pbox->x1, - pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); - SET_SYNC_FLAG(infoRec); - return; - } - - if (infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT) { - /* - * This is the case of a chip that only supports xdir = 1, - * with ydir = 1 or ydir = -1, but we have xdir = -1. - */ - (*infoRec->SetupForScreenToScreenCopy) (pScrn, - 1, ydir, alu, planemask, -1); - for (; nbox; pbox++, pptSrc++, nbox--) - if (pptSrc->y != pbox->y1 || pptSrc->x >= pbox->x1) - /* No problem. Do a xdir = 1 blit instead. */ - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, - pptSrc->x, pptSrc->y, - pbox->x1, pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); - else { - /* - * This is the difficult case. Needs striping into - * non-overlapping horizontal chunks. - */ - int stripeWidth, w, fullStripes, extra, i; - - stripeWidth = 16; - w = pbox->x2 - pbox->x1; - if (pbox->x1 - pptSrc->x < stripeWidth) - stripeWidth = pbox->x1 - pptSrc->x; - fullStripes = w / stripeWidth; - extra = w % stripeWidth; - - /* First, take care of the little bit on the far right */ - if (extra) - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, - pptSrc->x + - fullStripes * - stripeWidth, - pptSrc->y, - pbox->x1 + - fullStripes * - stripeWidth, - pbox->y1, extra, - pbox->y2 - - pbox->y1); - - /* Now, take care of the rest of the blit */ - for (i = fullStripes - 1; i >= 0; i--) - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, - pptSrc->x + - i * stripeWidth, - pptSrc->y, - pbox->x1 + - i * stripeWidth, - pbox->y1, - stripeWidth, - pbox->y2 - - pbox->y1); - } - SET_SYNC_FLAG(infoRec); - return; - } - - /* - * Now the case of a chip that only supports xdir = ydir = 1 or - * xdir = ydir = -1, but we have xdir != ydir. - */ - dirsetup = 0; /* No direction set up yet. */ - for (; nbox; pbox++, pptSrc++, nbox--) { - if (xdir == 1 && pptSrc->y != pbox->y1) { - /* Do a xdir = ydir = -1 blit instead. */ - if (dirsetup != -1) { - (*infoRec->SetupForScreenToScreenCopy) (pScrn, - -1, -1, alu, planemask, - -1); - dirsetup = -1; - } - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pptSrc->x, - pptSrc->y, pbox->x1, - pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); - } - else if (xdir == -1 && pptSrc->y != pbox->y1) { - /* Do a xdir = ydir = 1 blit instead. */ - if (dirsetup != 1) { - (*infoRec->SetupForScreenToScreenCopy) (pScrn, - 1, 1, alu, planemask, - -1); - dirsetup = 1; - } - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pptSrc->x, - pptSrc->y, pbox->x1, - pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); - } - else if (xdir == 1) { - /* - * xdir = 1, ydir = -1. - * Perform line-by-line xdir = ydir = 1 blits, going up. - */ - int i; - - if (dirsetup != 1) { - (*infoRec->SetupForScreenToScreenCopy) (pScrn, - 1, 1, alu, planemask, - -1); - dirsetup = 1; - } - for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--) - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, - pptSrc->x, - pptSrc->y + i, - pbox->x1, - pbox->y1 + i, - pbox->x2 - pbox->x1, - 1); - } - else { - /* - * xdir = -1, ydir = 1. - * Perform line-by-line xdir = ydir = -1 blits, going down. - */ - int i; - - if (dirsetup != -1) { - (*infoRec->SetupForScreenToScreenCopy) (pScrn, - -1, -1, alu, planemask, - -1); - dirsetup = -1; - } - for (i = 0; i < pbox->y2 - pbox->y1; i++) - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, - pptSrc->x, - pptSrc->y + i, - pbox->x1, - pbox->y1 + i, - pbox->x2 - pbox->x1, - 1); - } - } /* next box */ - SET_SYNC_FLAG(infoRec); -} diff --git a/xserver/hw/xfree86/xaa/xaaCpyPlane.c b/xserver/hw/xfree86/xaa/xaaCpyPlane.c deleted file mode 100644 index b9197e41f..000000000 --- a/xserver/hw/xfree86/xaa/xaaCpyPlane.c +++ /dev/null @@ -1,204 +0,0 @@ - -/* - A CopyPlane function that handles bitmap->screen copies and - sends anything else to the Fallback. - - Also, a PushPixels for solid fill styles. - - Written by Mark Vojkovich (markv@valinux.com) - -*/ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <string.h> - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" -#include "servermd.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "mi.h" -#include "pixmapstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" -#include "xaawrap.h" - -static void XAACopyPlane1toNColorExpand(DrawablePtr pSrc, DrawablePtr pDst, - GCPtr pGC, RegionPtr rgnDst, - DDXPointPtr pptSrc); -static void XAACopyPlaneNtoNColorExpand(DrawablePtr pSrc, DrawablePtr pDst, - GCPtr pGC, RegionPtr rgnDst, - DDXPointPtr pptSrc); - -static unsigned long TmpBitPlane; - -RegionPtr -XAACopyPlaneColorExpansion(DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, unsigned long bitPlane) -{ - if ((pSrc->type == DRAWABLE_PIXMAP) && !XAA_DEPTH_BUG(pGC)) { - if (pSrc->bitsPerPixel == 1) { - return (XAABitBlt(pSrc, pDst, pGC, srcx, srcy, - width, height, dstx, dsty, - XAACopyPlane1toNColorExpand, bitPlane)); - } - else if (bitPlane < (1 << pDst->depth)) { - TmpBitPlane = bitPlane; - return (XAABitBlt(pSrc, pDst, pGC, srcx, srcy, - width, height, dstx, dsty, - XAACopyPlaneNtoNColorExpand, bitPlane)); - } - } - - return (XAAFallbackOps.CopyPlane(pSrc, pDst, pGC, srcx, srcy, - width, height, dstx, dsty, bitPlane)); -} - -static void -XAACopyPlane1toNColorExpand(DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, RegionPtr rgnDst, DDXPointPtr pptSrc) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - BoxPtr pbox = RegionRects(rgnDst); - int numrects = RegionNumRects(rgnDst); - unsigned char *src = ((PixmapPtr) pSrc)->devPrivate.ptr; - int srcwidth = ((PixmapPtr) pSrc)->devKind; - - while (numrects--) { - (*infoRec->WriteBitmap) (infoRec->pScrn, pbox->x1, pbox->y1, - pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, - src + (srcwidth * pptSrc->y) + - ((pptSrc->x >> 5) << 2), srcwidth, - pptSrc->x & 31, pGC->fgPixel, pGC->bgPixel, - pGC->alu, pGC->planemask); - pbox++; - pptSrc++; - } -} - -static void -XAACopyPlaneNtoNColorExpand(DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, RegionPtr rgnDst, DDXPointPtr pptSrc) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - BoxPtr pbox = RegionRects(rgnDst); - int numrects = RegionNumRects(rgnDst); - unsigned char *src = ((PixmapPtr) pSrc)->devPrivate.ptr; - unsigned char *data, *srcPtr, *dataPtr; - int srcwidth = ((PixmapPtr) pSrc)->devKind; - int pitch, width, height, h, i, index, offset; - int Bpp = pSrc->bitsPerPixel >> 3; - unsigned long mask = TmpBitPlane; - - if (TmpBitPlane < (1 << 8)) { - offset = 0; - } - else if (TmpBitPlane < (1 << 16)) { - offset = 1; - mask >>= 8; - } - else if (TmpBitPlane < (1 << 24)) { - offset = 2; - mask >>= 16; - } - else { - offset = 3; - mask >>= 24; - } - - if (IS_OFFSCREEN_PIXMAP(pSrc)) - SYNC_CHECK(pSrc); - - while (numrects--) { - width = pbox->x2 - pbox->x1; - h = height = pbox->y2 - pbox->y1; - pitch = BitmapBytePad(width); - - if (!(data = calloc(height, pitch))) - goto ALLOC_FAILED; - - dataPtr = data; - srcPtr = ((pptSrc->y) * srcwidth) + src + ((pptSrc->x) * Bpp) + offset; - - while (h--) { - for (i = index = 0; i < width; i++, index += Bpp) { - if (mask & srcPtr[index]) - dataPtr[i >> 3] |= (1 << (i & 7)); - } - dataPtr += pitch; - srcPtr += srcwidth; - } - - (*infoRec->WriteBitmap) (infoRec->pScrn, - pbox->x1, pbox->y1, width, height, data, pitch, - 0, pGC->fgPixel, pGC->bgPixel, pGC->alu, - pGC->planemask); - - free(data); - - ALLOC_FAILED: - - pbox++; - pptSrc++; - } -} - -void -XAAPushPixelsSolidColorExpansion(GCPtr pGC, - PixmapPtr pBitMap, - DrawablePtr pDraw, - int dx, int dy, int xOrg, int yOrg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int MaxBoxes = RegionNumRects(pGC->pCompositeClip); - BoxPtr pbox, pClipBoxes; - int nboxes, srcx, srcy; - xRectangle TheRect; - unsigned char *src = pBitMap->devPrivate.ptr; - int srcwidth = pBitMap->devKind; - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - TheRect.x = xOrg; - TheRect.y = yOrg; - TheRect.width = dx; - TheRect.height = dy; - - if (MaxBoxes > (infoRec->PreAllocSize / sizeof(BoxRec))) { - pClipBoxes = malloc(MaxBoxes * sizeof(BoxRec)); - if (!pClipBoxes) - return; - } - else - pClipBoxes = (BoxPtr) infoRec->PreAllocMem; - - nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect); - pbox = pClipBoxes; - - while (nboxes--) { - srcx = pbox->x1 - xOrg; - srcy = pbox->y1 - yOrg; - (*infoRec->WriteBitmap) (infoRec->pScrn, pbox->x1, pbox->y1, - pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, - src + (srcwidth * srcy) + ((srcx >> 5) << 2), - srcwidth, srcx & 31, - pGC->fgPixel, -1, pGC->alu, pGC->planemask); - pbox++; - } - - if (pClipBoxes != (BoxPtr) infoRec->PreAllocMem) - free(pClipBoxes); -} diff --git a/xserver/hw/xfree86/xaa/xaaCpyWin.c b/xserver/hw/xfree86/xaa/xaaCpyWin.c deleted file mode 100644 index e851f4a37..000000000 --- a/xserver/hw/xfree86/xaa/xaaCpyWin.c +++ /dev/null @@ -1,78 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "windowstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "xaawrap.h" - -/* - Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net). -*/ - -void -XAACopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - DDXPointPtr pptSrc, ppt; - RegionRec rgnDst; - BoxPtr pbox; - int dx, dy, nbox; - WindowPtr pwinRoot; - ScreenPtr pScreen = pWin->drawable.pScreen; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable)); - - if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) { - XAA_SCREEN_PROLOGUE(pScreen, CopyWindow); - if (infoRec->pScrn->vtSema && infoRec->NeedToSync) { - (*infoRec->Sync) (infoRec->pScrn); - infoRec->NeedToSync = FALSE; - } - (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); - XAA_SCREEN_EPILOGUE(pScreen, CopyWindow, XAACopyWindow); - return; - } - - pwinRoot = pScreen->root; - - RegionNull(&rgnDst); - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - RegionTranslate(prgnSrc, -dx, -dy); - RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); - - pbox = RegionRects(&rgnDst); - nbox = RegionNumRects(&rgnDst); - if (!nbox || !(pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) { - RegionUninit(&rgnDst); - return; - } - ppt = pptSrc; - - while (nbox--) { - ppt->x = pbox->x1 + dx; - ppt->y = pbox->y1 + dy; - ppt++; - pbox++; - } - - infoRec->ScratchGC.planemask = ~0L; - infoRec->ScratchGC.alu = GXcopy; - - XAADoBitBlt((DrawablePtr) pwinRoot, (DrawablePtr) pwinRoot, - &(infoRec->ScratchGC), &rgnDst, pptSrc); - - free(pptSrc); - RegionUninit(&rgnDst); -} diff --git a/xserver/hw/xfree86/xaa/xaaDashLine.c b/xserver/hw/xfree86/xaa/xaaDashLine.c deleted file mode 100644 index c7e52cd0b..000000000 --- a/xserver/hw/xfree86/xaa/xaaDashLine.c +++ /dev/null @@ -1,353 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <stdlib.h> - -#include <X11/X.h> -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "miline.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" - -void -#ifdef POLYSEGMENT - XAAPolySegmentDashed(DrawablePtr pDrawable, - GCPtr pGC, int nseg, xSegment * pSeg -#else -XAAPolyLinesDashed(DrawablePtr pDrawable, GCPtr pGC, int mode, /* Origin or Previous */ - int npt, /* number of points */ - DDXPointPtr pptInit -#endif - ) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates, - XAAGetGCKey()); - BoxPtr pboxInit = RegionRects(pGC->pCompositeClip); - int nboxInit = RegionNumRects(pGC->pCompositeClip); - unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - int xorg = pDrawable->x; - int yorg = pDrawable->y; - int nbox; - BoxPtr pbox; - -#ifndef POLYSEGMENT - DDXPointPtr ppt; -#endif - unsigned int oc1, oc2; - int dmin, dmaj, e, octant; - int x1, x2, y1, y2, tmp, len, offset; - int PatternLength, PatternOffset; - - if (!nboxInit) - return; - - if (infoRec->DashedLineFlags & LINE_LIMIT_COORDS) { - int minValX = infoRec->DashedLineLimits.x1; - int maxValX = infoRec->DashedLineLimits.x2; - int minValY = infoRec->DashedLineLimits.y1; - int maxValY = infoRec->DashedLineLimits.y2; - -#ifdef POLYSEGMENT - int n = nseg; - xSegment *s = pSeg; - - while (n--) -#else - int n = npt; - int xorgtmp = xorg; - int yorgtmp = yorg; - - ppt = pptInit; - x2 = ppt->x + xorgtmp; - y2 = ppt->y + yorgtmp; - while (--n) -#endif - { -#ifdef POLYSEGMENT - x1 = s->x1 + xorg; - y1 = s->y1 + yorg; - x2 = s->x2 + xorg; - y2 = s->y2 + yorg; - s++; -#else - x1 = x2; - y1 = y2; - ++ppt; - if (mode == CoordModePrevious) { - xorgtmp = x1; - yorgtmp = y1; - } - x2 = ppt->x + xorgtmp; - y2 = ppt->y + yorgtmp; -#endif - if (x1 > maxValX || x1 < minValX || - x2 > maxValX || x2 < minValX || - y1 > maxValY || y1 < minValY || y2 > maxValY || y2 < minValY) { -#ifdef POLYSEGMENT - XAAFallbackOps.PolySegment(pDrawable, pGC, nseg, pSeg); -#else - XAAFallbackOps.Polylines(pDrawable, pGC, mode, npt, pptInit); -#endif - return; - } - } - } - - PatternLength = pGCPriv->DashLength; - PatternOffset = pGC->dashOffset % PatternLength; - - (*infoRec->SetupForDashedLine) (infoRec->pScrn, pGC->fgPixel, - (pGC->lineStyle == - LineDoubleDash) ? pGC->bgPixel : -1, - pGC->alu, pGC->planemask, PatternLength, - pGCPriv->DashPattern); - -#ifdef POLYSEGMENT - while (nseg--) -#else - ppt = pptInit; - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; - while (--npt) -#endif - { - nbox = nboxInit; - pbox = pboxInit; - -#ifdef POLYSEGMENT - x1 = pSeg->x1 + xorg; - y1 = pSeg->y1 + yorg; - x2 = pSeg->x2 + xorg; - y2 = pSeg->y2 + yorg; - pSeg++; -#else - x1 = x2; - y1 = y2; - ++ppt; - if (mode == CoordModePrevious) { - xorg = x1; - yorg = y1; - } - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; -#endif - - if (infoRec->SubsequentDashedBresenhamLine) { - if ((dmaj = x2 - x1) < 0) { - dmaj = -dmaj; - octant = XDECREASING; - } - else - octant = 0; - - if ((dmin = y2 - y1) < 0) { - dmin = -dmin; - octant |= YDECREASING; - } - - if (dmin >= dmaj) { - tmp = dmin; - dmin = dmaj; - dmaj = tmp; - octant |= YMAJOR; - } - - e = -dmaj - ((bias >> octant) & 1); - len = dmaj; - dmin <<= 1; - dmaj <<= 1; - } - else { /* Muffle compiler */ - dmin = dmaj = e = octant = len = 0; - } - - while (nbox--) { - oc1 = oc2 = 0; - OUTCODES(oc1, x1, y1, pbox); - OUTCODES(oc2, x2, y2, pbox); - if (!(oc1 | oc2)) { /* uncliped */ - if (infoRec->SubsequentDashedTwoPointLine) { - (*infoRec->SubsequentDashedTwoPointLine) (infoRec->pScrn, - x1, y1, x2, y2, -#ifdef POLYSEGMENT - (pGC->capStyle != - CapNotLast) ? 0 : -#endif - OMIT_LAST, - PatternOffset); - } - else { - (*infoRec->SubsequentDashedBresenhamLine) (infoRec->pScrn, - x1, y1, dmaj, - dmin, e, -#ifdef POLYSEGMENT - (pGC->capStyle != - CapNotLast) - ? (len + 1) : -#endif - len, octant, - PatternOffset); - } - break; - } - else if (oc1 & oc2) { /* completely clipped */ - pbox++; - } - else if (infoRec->ClippingFlags & HARDWARE_CLIP_DASHED_LINE) { - (*infoRec->SetClippingRectangle) (infoRec->pScrn, - pbox->x1, pbox->y1, - pbox->x2 - 1, pbox->y2 - 1); - - if (infoRec->SubsequentDashedBresenhamLine) { - (*infoRec->SubsequentDashedBresenhamLine) (infoRec->pScrn, - x1, y1, dmaj, - dmin, e, -#ifdef POLYSEGMENT - (pGC->capStyle != - CapNotLast) - ? (len + 1) : -#endif - len, octant, - PatternOffset); - } - else { - (*infoRec->SubsequentDashedTwoPointLine) (infoRec->pScrn, - x1, y1, x2, y2, -#ifdef POLYSEGMENT - (pGC->capStyle != - CapNotLast) ? 0 : -#endif - OMIT_LAST, - PatternOffset); - } - (*infoRec->DisableClipping) (infoRec->pScrn); - pbox++; - } - else { - int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2; - int clip1 = 0, clip2 = 0; - int err, adx, ady; - - if (octant & YMAJOR) { - ady = dmaj >> 1; - adx = dmin >> 1; - } - else { - ady = dmin >> 1; - adx = dmaj >> 1; - } - - if (miZeroClipLine(pbox->x1, pbox->y1, - pbox->x2 - 1, pbox->y2 - 1, - &new_x1, &new_y1, &new_x2, &new_y2, - adx, ady, &clip1, &clip2, - octant, bias, oc1, oc2) == -1) { - pbox++; - continue; - } - - if (octant & YMAJOR) - len = abs(new_y2 - new_y1); - else - len = abs(new_x2 - new_x1); -#ifdef POLYSEGMENT - if (clip2 != 0 || pGC->capStyle != CapNotLast) - len++; -#else - len += (clip2 != 0); -#endif - if (len) { - int abserr, clipdx, clipdy; - - /* unwind bresenham error term to first point */ - if (clip1) { - clipdx = abs(new_x1 - x1); - clipdy = abs(new_y1 - y1); - - if (octant & YMAJOR) - err = e + clipdy * dmin - clipdx * dmaj; - else - err = e + clipdx * dmin - clipdy * dmaj; - } - else - err = e; - -#define range infoRec->DashedBresenhamLineErrorTermBits - abserr = abs(err); - while ((abserr & range) || (dmaj & range) || (dmin & range)) { - dmin >>= 1; - dmaj >>= 1; - abserr >>= 1; - err /= 2; - } - - if (octant & YMAJOR) - offset = abs(new_y1 - y1); - else - offset = abs(new_x1 - x1); - - offset += PatternOffset; - offset %= PatternLength; - - (*infoRec->SubsequentDashedBresenhamLine) (infoRec->pScrn, - new_x1, new_y1, - dmaj, dmin, err, - len, octant, - offset); - } - pbox++; - } - } /* while (nbox--) */ -#ifndef POLYSEGMENT - len = abs(y2 - y1); - tmp = abs(x2 - x1); - PatternOffset += (len > tmp) ? len : tmp; - PatternOffset %= PatternLength; -#endif - } /* while (nline--) */ - -#ifndef POLYSEGMENT - /* paint the last point if the end style isn't CapNotLast. - (Assume that a projecting, butt, or round cap that is one - pixel wide is the same as the single pixel of the endpoint.) - */ - - if ((pGC->capStyle != CapNotLast) && - ((ppt->x + xorg != pptInit->x + pDrawable->x) || - (ppt->y + yorg != pptInit->y + pDrawable->y) || - (ppt == pptInit + 1))) { - nbox = nboxInit; - pbox = pboxInit; - while (nbox--) { - if ((x2 >= pbox->x1) && (y2 >= pbox->y1) && - (x2 < pbox->x2) && (y2 < pbox->y2)) { - if (infoRec->SubsequentDashedTwoPointLine) { - (*infoRec->SubsequentDashedTwoPointLine) (infoRec->pScrn, - x2, y2, x2, y2, 0, - PatternOffset); - } - else { - (*infoRec->SubsequentDashedBresenhamLine) (infoRec->pScrn, - x2, y2, 2, 0, -1, - 1, 0, - PatternOffset); - } - break; - } - else - pbox++; - } - } -#endif - - SET_SYNC_FLAG(infoRec); -} diff --git a/xserver/hw/xfree86/xaa/xaaFallback.c b/xserver/hw/xfree86/xaa/xaaFallback.c deleted file mode 100644 index f7604ef90..000000000 --- a/xserver/hw/xfree86/xaa/xaaFallback.c +++ /dev/null @@ -1,281 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "xaawrap.h" - -static void -XAAFillSpansFallback(DrawablePtr pDraw, - GC * pGC, - int nInit, - DDXPointPtr pptInit, int *pwidthInit, int fSorted) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAASetSpansFallback(DrawablePtr pDraw, - GCPtr pGC, - char *pcharsrc, - register DDXPointPtr ppt, - int *pwidth, int nspans, int fSorted) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAAPutImageFallback(DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, int y, int w, int h, - int leftPad, int format, char *pImage) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h, - leftPad, format, pImage); - XAA_GC_OP_EPILOGUE(pGC); -} - -static RegionPtr -XAACopyAreaFallback(DrawablePtr pSrc, - DrawablePtr pDst, - GC * pGC, - int srcx, int srcy, - int width, int height, int dstx, int dsty) -{ - RegionPtr ret; - - XAA_GC_OP_PROLOGUE(pGC); - if ((pSrc->type == DRAWABLE_WINDOW) || (pDst->type == DRAWABLE_WINDOW) || - IS_OFFSCREEN_PIXMAP(pSrc) || IS_OFFSCREEN_PIXMAP(pDst)) { - SYNC_CHECK(pGC); - } - ret = (*pGC->ops->CopyArea) (pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty); - XAA_GC_OP_EPILOGUE(pGC); - return ret; -} - -static RegionPtr -XAACopyPlaneFallback(DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, unsigned long bitPlane) -{ - RegionPtr ret; - - XAA_GC_OP_PROLOGUE(pGC); - if ((pSrc->type == DRAWABLE_WINDOW) || (pDst->type == DRAWABLE_WINDOW) || - IS_OFFSCREEN_PIXMAP(pSrc) || IS_OFFSCREEN_PIXMAP(pDst)) { - SYNC_CHECK(pGC); - } - ret = (*pGC->ops->CopyPlane) (pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty, - bitPlane); - XAA_GC_OP_EPILOGUE(pGC); - return ret; -} - -static void -XAAPolyPointFallback(DrawablePtr pDraw, - GCPtr pGC, int mode, int npt, xPoint * pptInit) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->PolyPoint) (pDraw, pGC, mode, npt, pptInit); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAAPolylinesFallback(DrawablePtr pDraw, - GCPtr pGC, int mode, int npt, DDXPointPtr pptInit) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->Polylines) (pDraw, pGC, mode, npt, pptInit); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAAPolySegmentFallback(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment * pSeg) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->PolySegment) (pDraw, pGC, nseg, pSeg); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAAPolyRectangleFallback(DrawablePtr pDraw, - GCPtr pGC, int nRectsInit, xRectangle *pRectsInit) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAAPolyArcFallback(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->PolyArc) (pDraw, pGC, narcs, parcs); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAAFillPolygonFallback(DrawablePtr pDraw, - GCPtr pGC, - int shape, int mode, int count, DDXPointPtr ptsIn) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAAPolyFillRectFallback(DrawablePtr pDraw, - GCPtr pGC, int nrectFill, xRectangle *prectInit) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->PolyFillRect) (pDraw, pGC, nrectFill, prectInit); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAAPolyFillArcFallback(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, parcs); - XAA_GC_OP_EPILOGUE(pGC); -} - -static int -XAAPolyText8Fallback(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - int ret; - - XAA_GC_OP_PROLOGUE(pGC); - SYNC_CHECK(pGC); - ret = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars); - XAA_GC_OP_EPILOGUE(pGC); - return ret; -} - -static int -XAAPolyText16Fallback(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, unsigned short *chars) -{ - int ret; - - XAA_GC_OP_PROLOGUE(pGC); - SYNC_CHECK(pGC); - ret = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars); - XAA_GC_OP_EPILOGUE(pGC); - return ret; -} - -static void -XAAImageText8Fallback(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAAImageText16Fallback(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAAImageGlyphBltFallback(DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph, ppci, - pglyphBase); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAAPolyGlyphBltFallback(DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph, ppci, - pglyphBase); - XAA_GC_OP_EPILOGUE(pGC); -} - -static void -XAAPushPixelsFallback(GCPtr pGC, - PixmapPtr pBitMap, - DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg) -{ - XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); - SYNC_CHECK(pGC); - (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); - XAA_GC_OP_EPILOGUE(pGC); -} - -GCOps XAAFallbackOps = { - XAAFillSpansFallback, XAASetSpansFallback, - XAAPutImageFallback, XAACopyAreaFallback, - XAACopyPlaneFallback, XAAPolyPointFallback, - XAAPolylinesFallback, XAAPolySegmentFallback, - XAAPolyRectangleFallback, XAAPolyArcFallback, - XAAFillPolygonFallback, XAAPolyFillRectFallback, - XAAPolyFillArcFallback, XAAPolyText8Fallback, - XAAPolyText16Fallback, XAAImageText8Fallback, - XAAImageText16Fallback, XAAImageGlyphBltFallback, - XAAPolyGlyphBltFallback, XAAPushPixelsFallback, -}; - -GCOps * -XAAGetFallbackOps(void) -{ - return &XAAFallbackOps; -} diff --git a/xserver/hw/xfree86/xaa/xaaFillArc.c b/xserver/hw/xfree86/xaa/xaaFillArc.c deleted file mode 100644 index fb7e7201f..000000000 --- a/xserver/hw/xfree86/xaa/xaaFillArc.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright 1996 The XFree86 Project - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * HARM HANEMAAYER 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. - * - * Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net). - */ - -/* - * Filled solid arcs, based on cfbfillarc.c. - * - * Fill arc using calls to low-level span fill. Because the math for - * each span can be done concurrently with the drawing of the span - * with a graphics coprocessor operation, this is faster than just - * using miPolyFillArc, which first calculates all the spans and then - * calls FillSpans. - * - * Clipped arcs are dispatched to FillSpans. - */ -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <limits.h> - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" -#include "mifillarc.h" -#include "mi.h" - -/* - * This is based on the integer-math versions from mi. Perhaps on a - * Pentium, the floating-point (double)-math version is faster. - */ - -static void -XAAFillEllipseSolid(DrawablePtr pDraw, GCPtr pGC, xArc * arc) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - register int x, y, e; - int yk, xk, ym, xm, dx, dy, xorg, yorg; - int slw; - miFillArcRec info; - - (*infoRec->SetupForSolidFill) (infoRec->pScrn, pGC->fgPixel, pGC->alu, - pGC->planemask); - - miFillArcSetup(arc, &info); - MIFILLARCSETUP(); - if (pGC->miTranslate) { - xorg += pDraw->x; - yorg += pDraw->y; - } - while (y > 0) { - MIFILLARCSTEP(slw); - if (slw > 0) { - (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn, xorg - x, - yorg - y, slw, 1); - if (miFillArcLower(slw)) - (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn, - xorg - x, yorg + y + dy, - slw, 1); - } - } - - SET_SYNC_FLAG(infoRec); -} - -#define ADDSPAN(l,r) \ - if (r >= l) \ - (*infoRec->SubsequentSolidFillRect)( \ - infoRec->pScrn, l, ya, r - l + 1, 1); - -#define ADDSLICESPANS(flip) \ - if (!flip) \ - { \ - ADDSPAN(xl, xr); \ - } \ - else \ - { \ - xc = xorg - x; \ - ADDSPAN(xc, xr); \ - xc += slw - 1; \ - ADDSPAN(xl, xc); \ - } - -static void -XAAFillArcSliceSolid(DrawablePtr pDraw, GCPtr pGC, xArc * arc) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int yk, xk, ym, xm, dx, dy, xorg, yorg, slw; - register int x, y, e; - miFillArcRec info; - miArcSliceRec slice; - int ya, xl, xr, xc; - - (*infoRec->SetupForSolidFill) (infoRec->pScrn, pGC->fgPixel, pGC->alu, - pGC->planemask); - - miFillArcSetup(arc, &info); - miFillArcSliceSetup(arc, &slice, pGC); - MIFILLARCSETUP(); - slw = arc->height; - if (slice.flip_top || slice.flip_bot) - slw += (arc->height >> 1) + 1; - if (pGC->miTranslate) { - xorg += pDraw->x; - yorg += pDraw->y; - slice.edge1.x += pDraw->x; - slice.edge2.x += pDraw->x; - } - while (y > 0) { - MIFILLARCSTEP(slw); - MIARCSLICESTEP(slice.edge1); - MIARCSLICESTEP(slice.edge2); - if (miFillSliceUpper(slice)) { - ya = yorg - y; - MIARCSLICEUPPER(xl, xr, slice, slw); - - ADDSLICESPANS(slice.flip_top); - } - if (miFillSliceLower(slice)) { - ya = yorg + y + dy; - MIARCSLICELOWER(xl, xr, slice, slw); - ADDSLICESPANS(slice.flip_bot); - } - } - - SET_SYNC_FLAG(infoRec); -} - -void -XAAPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) -{ - register xArc *arc; - register int i; - int x2, y2; - BoxRec box; - RegionPtr cclip; - - cclip = pGC->pCompositeClip; - - if (!RegionNumRects(cclip)) - return; - - for (arc = parcs, i = narcs; --i >= 0; arc++) { - if (miFillArcEmpty(arc)) - continue; - if (miCanFillArc(arc)) { - box.x1 = arc->x + pDraw->x; - box.y1 = arc->y + pDraw->y; - /* - * Because box.x2 and box.y2 get truncated to 16 bits, and the - * RECT_IN_REGION test treats the resulting number as a signed - * integer, the RECT_IN_REGION test alone can go the wrong way. - * This can result in a server crash because the rendering - * routines in this file deal directly with cpu addresses - * of pixels to be stored, and do not clip or otherwise check - * that all such addresses are within their respective pixmaps. - * So we only allow the RECT_IN_REGION test to be used for - * values that can be expressed correctly in a signed short. - */ - x2 = box.x1 + (int) arc->width + 1; - box.x2 = x2; - y2 = box.y1 + (int) arc->height + 1; - box.y2 = y2; - if ((x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) && - (RegionContainsRect(cclip, &box) == rgnIN)) { - if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE)) - XAAFillEllipseSolid(pDraw, pGC, arc); - else - XAAFillArcSliceSolid(pDraw, pGC, arc); - continue; - } - } - miPolyFillArc(pDraw, pGC, 1, arc); - } -} diff --git a/xserver/hw/xfree86/xaa/xaaFillPoly.c b/xserver/hw/xfree86/xaa/xaaFillPoly.c deleted file mode 100644 index 0cdedf57e..000000000 --- a/xserver/hw/xfree86/xaa/xaaFillPoly.c +++ /dev/null @@ -1,991 +0,0 @@ - -/* - * Copyright 1996 The XFree86 Project - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * HARM HANEMAAYER 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. - * - */ - -/* - * Written by Mark Vojkovich. Loosly based on an original version - * written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net) which - * only did solid rectangles and didn't have trapezoid support. - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "xf86str.h" -#include "mi.h" -#include "micoord.h" - -#include "xaa.h" -#include "xaalocal.h" - -#define POLY_USE_MI 0 -#define POLY_FULLY_CLIPPED 1 -#define POLY_IS_EASY 2 - -#define Setup(c,x,vertex,dx,dy,e,sign,step,DX) {\ - x = intToX(vertex); \ - if ((dy = intToY(c) - y)) { \ - DX = dx = intToX(c) - x; \ - step = 0; \ - if (dx >= 0) \ - { \ - e = 0; \ - sign = 1; \ - if (dx >= dy) {\ - step = dx / dy; \ - dx %= dy; \ - } \ - } \ - else \ - { \ - e = 1 - dy; \ - sign = -1; \ - dx = -dx; \ - if (dx >= dy) { \ - step = - (dx / dy); \ - dx %= dy; \ - } \ - } \ - } \ - x += origin; \ - vertex = c; \ -} - -#define Step(x,dx,dy,e,sign,step) {\ - x += step; \ - if ((e += dx) > 0) \ - { \ - x += sign; \ - e -= dy; \ - } \ -} - -#define FixError(x, dx, dy, e, sign, step, h) { \ - e += (h) * dx; \ - x += (h) * step; \ - if(e > 0) { \ - x += e * sign/dy; \ - e %= dy; \ - if(e) { \ - x += sign; \ - e -= dy; \ - } \ - } \ -} - -/* - XAAIsEasyPoly - - - Checks CoordModeOrigin one rect polygons to see if we need - to use Mi. - Returns: POLY_USE_MI, POLY_FULLY_CLIPPED or POLY_IS_EASY - as well as the pointer to the "top" point and the y - extents. -*/ - -int -XAAIsEasyPolygon(DDXPointPtr ptsIn, int count, BoxPtr extents, int origin, DDXPointPtr * topPoint, /* return */ - int *topY, int *bottomY, /* return */ - int shape) -{ - int c = 0, vertex1, vertex2; - - *topY = 32767; - *bottomY = 0; - - origin -= (origin & 0x8000) << 1; - vertex1 = extents->x1 - origin; - vertex2 = extents->x2 - origin /* - 0x00010001 */ ; - /* I think this was an error in cfb ^ */ - - if (shape == Convex) { - while (count--) { - c = *((int *) ptsIn); - if (((c - vertex1) | (vertex2 - c)) & 0x80008000) - return POLY_USE_MI; - - c = intToY(c); - if (c < *topY) { - *topY = c; - *topPoint = ptsIn; - } - ptsIn++; - if (c > *bottomY) - *bottomY = c; - } - } - else { - int yFlip = 0; - int dx2, dx1, x1, x2; - - x2 = x1 = -1; - dx2 = dx1 = 1; - - while (count--) { - c = *((int *) ptsIn); - if (((c - vertex1) | (vertex2 - c)) & 0x80008000) - return POLY_USE_MI; - c = intToY(c); - if (c < *topY) { - *topY = c; - *topPoint = ptsIn; - } - ptsIn++; - if (c > *bottomY) - *bottomY = c; - if (c == x1) - continue; - if (dx1 > 0) { - if (x2 < 0) - x2 = c; - else - dx2 = dx1 = (c - x1) >> 31; - } - else if ((c - x1) >> 31 != dx1) { - dx1 = ~dx1; - yFlip++; - } - x1 = c; - } - x1 = (x2 - c) >> 31; - if (x1 != dx1) - yFlip++; - if (x1 != dx2) - yFlip++; - if (yFlip != 2) { - if (*topY == *bottomY) - return POLY_FULLY_CLIPPED; - else - return POLY_USE_MI; - } - } - if (*topY == *bottomY) - return POLY_FULLY_CLIPPED; - - return POLY_IS_EASY; -} - -void -XAAFillPolygonSolid(DrawablePtr pDraw, - GCPtr pGC, - int shape, int mode, int count, DDXPointPtr ptsIn) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int origin, vertex1, vertex2; - int *vertex1p, *vertex2p, *endp; - int x1 = 0, x2 = 0; - int dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0; - int DX1 = 0, DX2 = 0, e1 = 0, e2 = 0; - int step1 = 0, step2 = 0, sign1 = 0, sign2 = 0; - int c, y, maxy, h, yoffset; - DDXPointPtr topPoint; - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - if (mode == CoordModePrevious) { - register DDXPointPtr ppt = ptsIn + 1; - - for (origin = 1; origin < count; origin++, ppt++) { - ppt->x += (ppt - 1)->x; - ppt->y += (ppt - 1)->y; - } - mode = CoordModeOrigin; - } - - if (RegionNumRects(pGC->pCompositeClip) != 1) { - miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn); - return; - } - - origin = coordToInt(pDraw->x, pDraw->y); - - switch (XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents, - origin, &topPoint, &y, &maxy, shape)) { - case POLY_USE_MI: - miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn); - case POLY_FULLY_CLIPPED: - return; - } - - endp = (int *) ptsIn + count; - vertex2p = vertex1p = (int *) topPoint; - origin = pDraw->x; - yoffset = pDraw->y; - vertex2 = vertex1 = *vertex2p++; - if (vertex2p == endp) - vertex2p = (int *) ptsIn; - - (*infoRec->SetupForSolidFill) (infoRec->pScrn, pGC->fgPixel, pGC->alu, - pGC->planemask); - - while (1) { - if (y == intToY(vertex1)) { - do { - if (vertex1p == (int *) ptsIn) - vertex1p = endp; - c = *--vertex1p; - Setup(c, x1, vertex1, dx1, dy1, e1, sign1, step1, DX1) - } while (y >= intToY(vertex1)); - h = dy1; - } - else { - Step(x1, dx1, dy1, e1, sign1, step1) - h = intToY(vertex1) - y; - } - if (y == intToY(vertex2)) { - do { - c = *vertex2p++; - if (vertex2p == endp) - vertex2p = (int *) ptsIn; - Setup(c, x2, vertex2, dx2, dy2, e2, sign2, step2, DX2) - } while (y >= intToY(vertex2)); - if (dy2 < h) - h = dy2; - } - else { - Step(x2, dx2, dy2, e2, sign2, step2) - if ((c = (intToY(vertex2) - y)) < h) - h = c; - } - - /* fill spans for this segment */ - if (DX1 | DX2) { - if (infoRec->SubsequentSolidFillTrap && (h > 6)) { - if (x1 == x2) { - while (x1 == x2) { - y++; - if (!--h) - break; - Step(x1, dx1, dy1, e1, sign1, step1) - Step(x2, dx2, dy2, e2, sign2, step2) - } - if (y == maxy) - break; - if (!h) - continue; - } - - if (x1 < x2) - (*infoRec->SubsequentSolidFillTrap) (infoRec->pScrn, - y + yoffset, h, - x1, DX1, dy1, e1, - x2 - 1, DX2, dy2, e2); - else - (*infoRec->SubsequentSolidFillTrap) (infoRec->pScrn, - y + yoffset, h, - x2, DX2, dy2, e2, - x1 - 1, DX1, dy1, e1); - y += h; - if (--h) { - FixError(x1, dx1, dy1, e1, sign1, step1, h); - FixError(x2, dx2, dy2, e2, sign2, step2, h); - h = 0; - } - } - else { - while (1) { - if (x2 > x1) - (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn, - x1, y + yoffset, - x2 - x1, 1); - else if (x1 > x2) - (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn, - x2, y + yoffset, - x1 - x2, 1); - y++; - if (!--h) - break; - Step(x1, dx1, dy1, e1, sign1, step1) - Step(x2, dx2, dy2, e2, sign2, step2) - } - } - } - else { - if (x2 > x1) - (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn, - x1, y + yoffset, x2 - x1, - h); - else if (x1 > x2) - (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn, - x2, y + yoffset, x1 - x2, - h); - - y += h; - h = 0; - } - if (y == maxy) - break; - } - SET_SYNC_FLAG(infoRec); -} - -void -XAAFillPolygonHelper(ScrnInfoPtr pScrn, - DDXPointPtr ptsIn, - int count, - DDXPointPtr topPoint, - int y, - int maxy, - int origin, - RectFuncPtr RectFunc, - TrapFuncPtr TrapFunc, - int xorg, int yorg, XAACacheInfoPtr pCache) -{ - int *vertex1p, *vertex2p, *endp; - int vertex1, vertex2; - int x1 = 0, x2 = 0; - int dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0; - int DX1 = 0, DX2 = 0, e1 = 0, e2 = 0; - int step1 = 0, step2 = 0, sign1 = 0, sign2 = 0; - int c, h, yoffset; - - endp = (int *) ptsIn + count; - vertex2p = vertex1p = (int *) topPoint; - yoffset = intToY(origin); - origin = intToX(origin); - vertex2 = vertex1 = *vertex2p++; - if (vertex2p == endp) - vertex2p = (int *) ptsIn; - - while (1) { - if (y == intToY(vertex1)) { - do { - if (vertex1p == (int *) ptsIn) - vertex1p = endp; - c = *--vertex1p; - Setup(c, x1, vertex1, dx1, dy1, e1, sign1, step1, DX1) - } while (y >= intToY(vertex1)); - h = dy1; - } - else { - Step(x1, dx1, dy1, e1, sign1, step1) - h = intToY(vertex1) - y; - } - if (y == intToY(vertex2)) { - do { - c = *vertex2p++; - if (vertex2p == endp) - vertex2p = (int *) ptsIn; - Setup(c, x2, vertex2, dx2, dy2, e2, sign2, step2, DX2) - } while (y >= intToY(vertex2)); - if (dy2 < h) - h = dy2; - } - else { - Step(x2, dx2, dy2, e2, sign2, step2) - if ((c = (intToY(vertex2) - y)) < h) - h = c; - } - - /* fill spans for this segment */ - if (DX1 | DX2) { - if (TrapFunc && (h > 6)) { - if (x1 == x2) { - while (x1 == x2) { - y++; - if (!--h) - break; - Step(x1, dx1, dy1, e1, sign1, step1) - Step(x2, dx2, dy2, e2, sign2, step2) - } - if (y == maxy) - break; - if (!h) - continue; - } - - if (x1 < x2) - (*TrapFunc) (pScrn, y + yoffset, h, - x1, DX1, dy1, e1, - x2 - 1, DX2, dy2, e2, xorg, yorg, pCache); - else - (*TrapFunc) (pScrn, y + yoffset, h, - x2, DX2, dy2, e2, - x1 - 1, DX1, dy1, e1, xorg, yorg, pCache); - y += h; - if (--h) { - FixError(x1, dx1, dy1, e1, sign1, step1, h); - FixError(x2, dx2, dy2, e2, sign2, step2, h); - h = 0; - } - } - else { - while (1) { - if (x2 > x1) - (*RectFunc) (pScrn, - x1, y + yoffset, x2 - x1, 1, xorg, yorg, - pCache); - else if (x1 > x2) - (*RectFunc) (pScrn, - x2, y + yoffset, x1 - x2, 1, xorg, yorg, - pCache); - y++; - if (!--h) - break; - Step(x1, dx1, dy1, e1, sign1, step1) - Step(x2, dx2, dy2, e2, sign2, step2) - } - } - } - else { - if (x2 > x1) - (*RectFunc) (pScrn, - x1, y + yoffset, x2 - x1, h, xorg, yorg, pCache); - else if (x1 > x2) - (*RectFunc) (pScrn, - x2, y + yoffset, x1 - x2, h, xorg, yorg, pCache); - - y += h; - h = 0; - } - if (y == maxy) - break; - } -} - - /*****************\ - | Solid Helpers | - \*****************/ - -static void -SolidTrapHelper(ScrnInfoPtr pScrn, - int y, int h, - int x1, int dx1, int dy1, int e1, - int x2, int dx2, int dy2, int e2, - int xorg, int yorg, XAACacheInfoPtr pCache) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - (*infoRec->SubsequentSolidFillTrap) (pScrn, - y, h, x1, dx1, dy1, e1, x2, dx2, dy2, - e2); -} - -static void -SolidRectHelper(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int xorg, int yorg, XAACacheInfoPtr pCache) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h); -} - - /*********************\ - | Mono 8x8 Patterns | - \*********************/ - -static void -Mono8x8PatternTrapHelper_ScreenOrigin(ScrnInfoPtr pScrn, - int y, int h, - int x1, int dx1, int dy1, int e1, - int x2, int dx2, int dy2, int e2, - int xorg, int yorg, - XAACacheInfoPtr pCache) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - (*infoRec->SubsequentMono8x8PatternFillTrap) (pScrn, xorg, yorg, - y, h, x1, dx1, dy1, e1, x2, - dx2, dy2, e2); -} - -static void -Mono8x8PatternRectHelper_ScreenOrigin(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int xorg, int yorg, - XAACacheInfoPtr pCache) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, xorg, yorg, - x, y, w, h); -} - -static void -Mono8x8PatternRectHelper(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int xorg, int yorg, XAACacheInfoPtr pCache) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - xorg = (x - xorg) & 0x07; - yorg = (y - yorg) & 0x07; - - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) { - int patx = pCache->pat0; - int paty = pCache->pat1; - - XAARotateMonoPattern(&patx, &paty, xorg, yorg, - (infoRec->Mono8x8PatternFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST)); - xorg = patx; - yorg = paty; - } - else { - int slot = (yorg << 3) + xorg; - - xorg = pCache->x + pCache->offsets[slot].x; - yorg = pCache->y + pCache->offsets[slot].y; - } - } - - (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, xorg, yorg, - x, y, w, h); -} - - /****************\ - | Cache Expand | - \****************/ - -static void -CacheExpandRectHelper(ScrnInfoPtr pScrn, - int X, int Y, int Width, int Height, - int xorg, int yorg, XAACacheInfoPtr pCache) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int x, phaseY, phaseX, skipleft, w, blit_w, blit_h; - int cacheWidth; - - cacheWidth = (pCache->w * pScrn->bitsPerPixel) / - infoRec->CacheColorExpandDensity; - - phaseY = (Y - yorg) % pCache->orig_h; - if (phaseY < 0) - phaseY += pCache->orig_h; - phaseX = (X - xorg) % pCache->orig_w; - if (phaseX < 0) - phaseX += pCache->orig_w; - - while (1) { - w = Width; - skipleft = phaseX; - x = X; - blit_h = pCache->h - phaseY; - if (blit_h > Height) - blit_h = Height; - - while (1) { - blit_w = cacheWidth - skipleft; - if (blit_w > w) - blit_w = w; - (*infoRec->SubsequentScreenToScreenColorExpandFill) (pScrn, x, Y, - blit_w, blit_h, - pCache->x, - pCache->y + - phaseY, - skipleft); - w -= blit_w; - if (!w) - break; - x += blit_w; - skipleft = (skipleft + blit_w) % pCache->orig_w; - } - Height -= blit_h; - if (!Height) - break; - Y += blit_h; - phaseY = (phaseY + blit_h) % pCache->orig_h; - } -} - - /**************\ - | Cache Blit | - \**************/ - -static void -CacheBltRectHelper(ScrnInfoPtr pScrn, - int X, int Y, int Width, int Height, - int xorg, int yorg, XAACacheInfoPtr pCache) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int x, phaseY, phaseX, skipleft, w, blit_w, blit_h; - - phaseY = (Y - yorg) % pCache->orig_h; - if (phaseY < 0) - phaseY += pCache->orig_h; - phaseX = (X - xorg) % pCache->orig_w; - if (phaseX < 0) - phaseX += pCache->orig_w; - - while (1) { - w = Width; - skipleft = phaseX; - x = X; - blit_h = pCache->h - phaseY; - if (blit_h > Height) - blit_h = Height; - - while (1) { - blit_w = pCache->w - skipleft; - if (blit_w > w) - blit_w = w; - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, - pCache->x + skipleft, - pCache->y + phaseY, x, Y, - blit_w, blit_h); - w -= blit_w; - if (!w) - break; - x += blit_w; - skipleft = (skipleft + blit_w) % pCache->orig_w; - } - Height -= blit_h; - if (!Height) - break; - Y += blit_h; - phaseY = (phaseY + blit_h) % pCache->orig_h; - } -} - - /**********************\ - | Stippled Polygons | - \**********************/ - -void -XAAFillPolygonStippled(DrawablePtr pDraw, - GCPtr pGC, - int shape, int mode, int count, DDXPointPtr ptsIn) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); - int origin, type, patx, paty, fg, bg; - int y, maxy, xorg, yorg; - DDXPointPtr topPoint; - XAACacheInfoPtr pCache = NULL; - RectFuncPtr RectFunc = NULL; - TrapFuncPtr TrapFunc = NULL; - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - if (mode == CoordModePrevious) { - register DDXPointPtr ppt = ptsIn + 1; - - for (origin = 1; origin < count; origin++, ppt++) { - ppt->x += (ppt - 1)->x; - ppt->y += (ppt - 1)->y; - } - mode = CoordModeOrigin; - } - - if (RegionNumRects(pGC->pCompositeClip) != 1) { - miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn); - return; - } - - if (pGC->fillStyle == FillStippled) { - type = (*infoRec->StippledFillChooser) (pGC); - fg = pGC->fgPixel; - bg = -1; - } - else { - type = (*infoRec->OpaqueStippledFillChooser) (pGC); - fg = pGC->fgPixel; - bg = pGC->bgPixel; - } - - if (!type) { - (*XAAFallbackOps.FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn); - return; - } - - if ((type == DO_COLOR_EXPAND) || (type == DO_COLOR_8x8)) { - miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn); - return; - } - - origin = pDraw->x; - - switch (XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents, - origin, &topPoint, &y, &maxy, shape)) { - case POLY_USE_MI: - miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn); - case POLY_FULLY_CLIPPED: - return; - } - - xorg = (pDraw->x + pGC->patOrg.x); - yorg = (pDraw->y + pGC->patOrg.y); - - if ((fg == bg) && (bg != -1) && infoRec->SetupForSolidFill) { - - (*infoRec->SetupForSolidFill) (infoRec->pScrn, fg, - pGC->alu, pGC->planemask); - - RectFunc = SolidRectHelper; - TrapFunc = infoRec->SubsequentSolidFillTrap ? SolidTrapHelper : NULL; - } - else - switch (type) { - case DO_MONO_8x8: - patx = pPriv->pattern0; - paty = pPriv->pattern1; - if (infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_SCREEN_ORIGIN) { - xorg = (-xorg) & 0x07; - yorg = (-yorg) & 0x07; - if (infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_BITS) { - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - XAARotateMonoPattern(&patx, &paty, xorg, yorg, - (infoRec->Mono8x8PatternFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST)); - xorg = patx; - yorg = paty; - } - } - else { - XAACacheInfoPtr pCache = - (*infoRec->CacheMono8x8Pattern) (infoRec->pScrn, patx, - paty); - patx = pCache->x; - paty = pCache->y; - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - int slot = (yorg << 3) + xorg; - - patx += pCache->offsets[slot].x; - paty += pCache->offsets[slot].y; - xorg = patx; - yorg = paty; - } - } - RectFunc = Mono8x8PatternRectHelper_ScreenOrigin; - if (infoRec->SubsequentMono8x8PatternFillTrap) - TrapFunc = Mono8x8PatternTrapHelper_ScreenOrigin; - } - else { /* !HARDWARE_PATTERN_SCREEN_ORIGIN */ - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_BITS)) { - pCache = - (*infoRec->CacheMono8x8Pattern) (infoRec->pScrn, patx, - paty); - patx = pCache->x; - paty = pCache->y; - } - else { - pCache = &(infoRec->ScratchCacheInfoRec); - pCache->pat0 = patx; - pCache->pat1 = paty; - } - RectFunc = Mono8x8PatternRectHelper; - } - - (*infoRec->SetupForMono8x8PatternFill) (infoRec->pScrn, - patx, paty, fg, bg, - pGC->alu, pGC->planemask); - break; - case DO_CACHE_EXPAND: - pCache = - (*infoRec->CacheMonoStipple) (infoRec->pScrn, pGC->stipple); - - (*infoRec->SetupForScreenToScreenColorExpandFill) (infoRec->pScrn, - fg, bg, pGC->alu, - pGC->planemask); - - RectFunc = CacheExpandRectHelper; - break; - case DO_CACHE_BLT: - pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple, - fg, bg); - (*infoRec->SetupForScreenToScreenCopy) (infoRec->pScrn, 1, 1, - pGC->alu, pGC->planemask, - pCache->trans_color); - - RectFunc = CacheBltRectHelper; - break; - default: - return; - } - - XAAFillPolygonHelper(infoRec->pScrn, ptsIn, count, topPoint, - y, maxy, origin, RectFunc, TrapFunc, xorg, yorg, - pCache); - - SET_SYNC_FLAG(infoRec); -} - - /*******************\ - | Tiled Polygons | - \*******************/ - -void -XAAFillPolygonTiled(DrawablePtr pDraw, - GCPtr pGC, - int shape, int mode, int count, DDXPointPtr ptsIn) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); - int origin, type, patx, paty; - int y, maxy, xorg, yorg; - DDXPointPtr topPoint; - XAACacheInfoPtr pCache = NULL; - RectFuncPtr RectFunc = NULL; - TrapFuncPtr TrapFunc = NULL; - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - if (mode == CoordModePrevious) { - register DDXPointPtr ppt = ptsIn + 1; - - for (origin = 1; origin < count; origin++, ppt++) { - ppt->x += (ppt - 1)->x; - ppt->y += (ppt - 1)->y; - } - mode = CoordModeOrigin; - } - - if (RegionNumRects(pGC->pCompositeClip) != 1) { - miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn); - return; - } - - type = (*infoRec->TiledFillChooser) (pGC); - - if (!type || (type == DO_IMAGE_WRITE)) { - (*XAAFallbackOps.FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn); - return; - } - - if (type == DO_COLOR_8x8) { - miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn); - return; - } - - origin = pDraw->x; - - switch (XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents, - origin, &topPoint, &y, &maxy, shape)) { - case POLY_USE_MI: - miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn); - case POLY_FULLY_CLIPPED: - return; - } - - xorg = (pDraw->x + pGC->patOrg.x); - yorg = (pDraw->y + pGC->patOrg.y); - - switch (type) { - case DO_MONO_8x8: - patx = pPriv->pattern0; - paty = pPriv->pattern1; - if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) { - xorg = (-xorg) & 0x07; - yorg = (-yorg) & 0x07; - if (infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_BITS) { - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - XAARotateMonoPattern(&patx, &paty, xorg, yorg, - (infoRec->Mono8x8PatternFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST)); - xorg = patx; - yorg = paty; - } - } - else { - XAACacheInfoPtr pCache = - (*infoRec->CacheMono8x8Pattern) (infoRec->pScrn, patx, - paty); - patx = pCache->x; - paty = pCache->y; - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - int slot = (yorg << 3) + xorg; - - patx += pCache->offsets[slot].x; - paty += pCache->offsets[slot].y; - xorg = patx; - yorg = paty; - } - } - RectFunc = Mono8x8PatternRectHelper_ScreenOrigin; - if (infoRec->SubsequentMono8x8PatternFillTrap) - TrapFunc = Mono8x8PatternTrapHelper_ScreenOrigin; - } - else { /* !HARDWARE_PATTERN_SCREEN_ORIGIN */ - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_BITS)) { - pCache = - (*infoRec->CacheMono8x8Pattern) (infoRec->pScrn, patx, - paty); - patx = pCache->x; - paty = pCache->y; - } - else { - pCache = &(infoRec->ScratchCacheInfoRec); - pCache->pat0 = patx; - pCache->pat1 = paty; - } - RectFunc = Mono8x8PatternRectHelper; - } - - (*infoRec->SetupForMono8x8PatternFill) (infoRec->pScrn, - patx, paty, pPriv->fg, - pPriv->bg, pGC->alu, - pGC->planemask); - break; - case DO_CACHE_BLT: - pCache = (*infoRec->CacheTile) (infoRec->pScrn, pGC->tile.pixmap); - (*infoRec->SetupForScreenToScreenCopy) (infoRec->pScrn, 1, 1, - pGC->alu, pGC->planemask, -1); - - RectFunc = CacheBltRectHelper; - break; - case DO_PIXMAP_COPY: - pCache = &(infoRec->ScratchCacheInfoRec); - pCache->x = pPriv->offscreenArea->box.x1; - pCache->y = pPriv->offscreenArea->box.y1; - pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x; - pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y; - - (*infoRec->SetupForScreenToScreenCopy) (infoRec->pScrn, 1, 1, - pGC->alu, pGC->planemask, -1); - - RectFunc = CacheBltRectHelper; - break; - default: - return; - } - - XAAFillPolygonHelper(infoRec->pScrn, ptsIn, count, topPoint, - y, maxy, origin, RectFunc, TrapFunc, xorg, yorg, - pCache); - - SET_SYNC_FLAG(infoRec); -} diff --git a/xserver/hw/xfree86/xaa/xaaFillRect.c b/xserver/hw/xfree86/xaa/xaaFillRect.c deleted file mode 100644 index ec0fb9df7..000000000 --- a/xserver/hw/xfree86/xaa/xaaFillRect.c +++ /dev/null @@ -1,1101 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" - -static void XAARenderSolidRects(GCPtr, int, BoxPtr, int, int); -static void XAARenderColor8x8Rects(GCPtr, int, BoxPtr, int, int); -static void XAARenderMono8x8Rects(GCPtr, int, BoxPtr, int, int); -static void XAARenderColorExpandRects(GCPtr, int, BoxPtr, int, int); -static void XAARenderCacheExpandRects(GCPtr, int, BoxPtr, int, int); -static void XAARenderCacheBltRects(GCPtr, int, BoxPtr, int, int); -static void XAARenderImageWriteRects(GCPtr, int, BoxPtr, int, int); -static void XAARenderPixmapCopyRects(GCPtr, int, BoxPtr, int, int); - -void -XAAPolyFillRect(DrawablePtr pDraw, GCPtr pGC, int nrectFill, /* number of rectangles to fill */ - xRectangle *prectInit /* Pointer to first rectangle to fill */ - ) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int xorg = pDraw->x; - int yorg = pDraw->y; - int type = 0; - ClipAndRenderRectsFunc function; - - if ((nrectFill <= 0) || !pGC->planemask) - return; - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - switch (pGC->fillStyle) { - case FillSolid: - type = DO_SOLID; - break; - case FillStippled: - type = (*infoRec->StippledFillChooser) (pGC); - break; - case FillOpaqueStippled: - if ((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSolidRects && - CHECK_PLANEMASK(pGC, infoRec->FillSolidRectsFlags) && - CHECK_ROP(pGC, infoRec->FillSolidRectsFlags) && - CHECK_ROPSRC(pGC, infoRec->FillSolidRectsFlags) && - CHECK_FG(pGC, infoRec->FillSolidRectsFlags)) - type = DO_SOLID; - else - type = (*infoRec->OpaqueStippledFillChooser) (pGC); - break; - case FillTiled: - type = (*infoRec->TiledFillChooser) (pGC); - break; - } - - switch (type) { - case DO_SOLID: - function = XAARenderSolidRects; - break; - case DO_COLOR_8x8: - function = XAARenderColor8x8Rects; - break; - case DO_MONO_8x8: - function = XAARenderMono8x8Rects; - break; - case DO_CACHE_BLT: - function = XAARenderCacheBltRects; - break; - case DO_COLOR_EXPAND: - function = XAARenderColorExpandRects; - break; - case DO_CACHE_EXPAND: - function = XAARenderCacheExpandRects; - break; - case DO_IMAGE_WRITE: - function = XAARenderImageWriteRects; - break; - case DO_PIXMAP_COPY: - function = XAARenderPixmapCopyRects; - break; - default: - (*XAAFallbackOps.PolyFillRect) (pDraw, pGC, nrectFill, prectInit); - return; - } - - if (xorg | yorg) { - int n = nrectFill; - xRectangle *prect = prectInit; - - while (n--) { - prect->x += xorg; - prect->y += yorg; - prect++; - } - } - - XAAClipAndRenderRects(pGC, function, nrectFill, prectInit, xorg, yorg); -} - - /*********************\ - | Solid Rects | - \*********************/ - -static void -XAARenderSolidRects(GCPtr pGC, - int nboxes, BoxPtr pClipBoxes, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - (*infoRec->FillSolidRects) (infoRec->pScrn, - pGC->fgPixel, pGC->alu, pGC->planemask, nboxes, - pClipBoxes); -} - - /************************\ - | Mono 8x8 Rects | - \************************/ - -static void -XAARenderMono8x8Rects(GCPtr pGC, - int nboxes, BoxPtr pClipBoxes, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAPixmapPtr pPriv; - int fg, bg; - - switch (pGC->fillStyle) { - case FillStippled: - pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); - fg = pGC->fgPixel; - bg = -1; - break; - case FillOpaqueStippled: - pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); - fg = pGC->fgPixel; - bg = pGC->bgPixel; - break; - case FillTiled: - pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); - fg = pPriv->fg; - bg = pPriv->bg; - break; - default: /* Muffle compiler */ - pPriv = NULL; /* Kaboom */ - fg = -1; - bg = -1; - break; - } - - (*infoRec->FillMono8x8PatternRects) (infoRec->pScrn, - fg, bg, pGC->alu, pGC->planemask, - nboxes, pClipBoxes, pPriv->pattern0, - pPriv->pattern1, - (xorg + pGC->patOrg.x), - (yorg + pGC->patOrg.y)); -} - - /*************************\ - | Color 8x8 Rects | - \*************************/ - -static void -XAARenderColor8x8Rects(GCPtr pGC, - int nboxes, BoxPtr pClipBoxes, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAACacheInfoPtr pCache; - PixmapPtr pPix; - int fg, bg; - - switch (pGC->fillStyle) { - case FillStippled: - pPix = pGC->stipple; - fg = pGC->fgPixel; - bg = -1; - break; - case FillOpaqueStippled: - pPix = pGC->stipple; - fg = pGC->fgPixel; - bg = pGC->bgPixel; - break; - case FillTiled: - pPix = pGC->tile.pixmap; - fg = -1; - bg = -1; - break; - default: /* Muffle compiler */ - pPix = NULL; - fg = -1; - bg = -1; - break; - } - - pCache = (*infoRec->CacheColor8x8Pattern) (infoRec->pScrn, pPix, fg, bg); - (*infoRec->FillColor8x8PatternRects) (infoRec->pScrn, - pGC->alu, pGC->planemask, nboxes, - pClipBoxes, (xorg + pGC->patOrg.x), - (yorg + pGC->patOrg.y), pCache); -} - - /****************************\ - | Color Expand Rects | - \****************************/ - -static void -XAARenderColorExpandRects(GCPtr pGC, - int nboxes, BoxPtr pClipBoxes, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int fg, bg; - - switch (pGC->fillStyle) { - case FillStippled: - fg = pGC->fgPixel; - bg = -1; - break; - case FillOpaqueStippled: - fg = pGC->fgPixel; - bg = pGC->bgPixel; - break; - default: /* Muffle compiler */ - fg = -1; - bg = -1; - break; - } - - (*infoRec->FillColorExpandRects) (infoRec->pScrn, fg, bg, - pGC->alu, pGC->planemask, nboxes, - pClipBoxes, (xorg + pGC->patOrg.x), - (yorg + pGC->patOrg.y), pGC->stipple); -} - - /*************************\ - | Cache Blt Rects | - \*************************/ - -static void -XAARenderCacheBltRects(GCPtr pGC, - int nboxes, BoxPtr pClipBoxes, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAACacheInfoPtr pCache; - - switch (pGC->fillStyle) { - case FillStippled: - pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple, - pGC->fgPixel, -1); - break; - case FillOpaqueStippled: - pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple, - pGC->fgPixel, pGC->bgPixel); - break; - case FillTiled: - pCache = (*infoRec->CacheTile) (infoRec->pScrn, pGC->tile.pixmap); - break; - default: /* Muffle compiler */ - pCache = NULL; - break; - } - - (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu, - pGC->planemask, nboxes, pClipBoxes, - (xorg + pGC->patOrg.x), - (yorg + pGC->patOrg.y), pCache); -} - - /****************************\ - | Cache Expand Rects | - \****************************/ - -static void -XAARenderCacheExpandRects(GCPtr pGC, - int nboxes, BoxPtr pClipBoxes, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int fg, bg; - - switch (pGC->fillStyle) { - case FillStippled: - fg = pGC->fgPixel; - bg = -1; - break; - case FillOpaqueStippled: - fg = pGC->fgPixel; - bg = pGC->bgPixel; - break; - default: /* Muffle compiler */ - fg = -1; - bg = -1; - break; - } - - (*infoRec->FillCacheExpandRects) (infoRec->pScrn, fg, bg, - pGC->alu, pGC->planemask, nboxes, - pClipBoxes, (xorg + pGC->patOrg.x), - (yorg + pGC->patOrg.y), pGC->stipple); -} - - /***************************\ - | Image Write Rects | - \***************************/ - -static void -XAARenderImageWriteRects(GCPtr pGC, - int nboxes, BoxPtr pClipBoxes, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - (*infoRec->FillImageWriteRects) (infoRec->pScrn, pGC->alu, - pGC->planemask, nboxes, pClipBoxes, - (xorg + pGC->patOrg.x), - (yorg + pGC->patOrg.y), pGC->tile.pixmap); -} - - /***************************\ - | Pixmap Copy Rects | - \***************************/ - -static void -XAARenderPixmapCopyRects(GCPtr pGC, - int nboxes, BoxPtr pClipBoxes, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec); - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); - - pCache->x = pPriv->offscreenArea->box.x1; - pCache->y = pPriv->offscreenArea->box.y1; - pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x; - pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y; - pCache->trans_color = -1; - - (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu, - pGC->planemask, nboxes, pClipBoxes, - (xorg + pGC->patOrg.x), - (yorg + pGC->patOrg.y), pCache); -} - - /************\ - | Solid | - \************/ - -void -XAAFillSolidRects(ScrnInfoPtr pScrn, int fg, int rop, unsigned int planemask, int nBox, /* number of rectangles to fill */ - BoxPtr pBox /* Pointer to first rectangle to fill */ - ) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - (*infoRec->SetupForSolidFill) (pScrn, fg, rop, planemask); - while (nBox--) { - (*infoRec->SubsequentSolidFillRect) (pScrn, pBox->x1, pBox->y1, - pBox->x2 - pBox->x1, - pBox->y2 - pBox->y1); - pBox++; - } - SET_SYNC_FLAG(infoRec); -} - - /*********************\ - | 8x8 Mono Patterns | - \*********************/ - -void -XAAFillMono8x8PatternRectsScreenOrigin(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int pattern0, int pattern1, - int xorigin, int yorigin) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int patx = pattern0, paty = pattern1; - int xorg = (-xorigin) & 0x07; - int yorg = (-yorigin) & 0x07; - - if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) { - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - XAARotateMonoPattern(&patx, &paty, xorg, yorg, - (infoRec->Mono8x8PatternFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST)); - xorg = patx; - yorg = paty; - } - } - else { - XAACacheInfoPtr pCache = - (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1); - patx = pCache->x; - paty = pCache->y; - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - int slot = (yorg << 3) + xorg; - - patx += pCache->offsets[slot].x; - paty += pCache->offsets[slot].y; - xorg = patx; - yorg = paty; - } - } - - (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty, - fg, bg, rop, planemask); - - while (nBox--) { - (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, - xorg, yorg, pBox->x1, - pBox->y1, - pBox->x2 - pBox->x1, - pBox->y2 - pBox->y1); - pBox++; - } - SET_SYNC_FLAG(infoRec); -} - -void -XAAFillMono8x8PatternRects(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int pattern0, int pattern1, int xorigin, int yorigin) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int patx = pattern0, paty = pattern1; - int xorg, yorg; - XAACacheInfoPtr pCache = NULL; - - if (!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS)) { - pCache = (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1); - patx = pCache->x; - paty = pCache->y; - } - - (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty, - fg, bg, rop, planemask); - - while (nBox--) { - xorg = (pBox->x1 - xorigin) & 0x07; - yorg = (pBox->y1 - yorigin) & 0x07; - - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - if (infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_BITS) { - patx = pattern0; - paty = pattern1; - XAARotateMonoPattern(&patx, &paty, xorg, yorg, - (infoRec->Mono8x8PatternFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST)); - xorg = patx; - yorg = paty; - } - else { - int slot = (yorg << 3) + xorg; - - xorg = patx + pCache->offsets[slot].x; - yorg = paty + pCache->offsets[slot].y; - } - } - - (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, - xorg, yorg, pBox->x1, - pBox->y1, - pBox->x2 - pBox->x1, - pBox->y2 - pBox->y1); - pBox++; - } - - SET_SYNC_FLAG(infoRec); -} - - /**********************\ - | 8x8 Color Patterns | - \**********************/ - -void -XAAFillColor8x8PatternRectsScreenOrigin(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorigin, int yorigin, - XAACacheInfoPtr pCache) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int patx = pCache->x, paty = pCache->y; - int xorg = (-xorigin) & 0x07; - int yorg = (-yorigin) & 0x07; - - if (!(infoRec->Color8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - int slot = (yorg << 3) + xorg; - - paty += pCache->offsets[slot].y; - patx += pCache->offsets[slot].x; - xorg = patx; - yorg = paty; - } - - (*infoRec->SetupForColor8x8PatternFill) (pScrn, patx, paty, - rop, planemask, - pCache->trans_color); - - while (nBox--) { - (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn, - xorg, yorg, pBox->x1, - pBox->y1, - pBox->x2 - pBox->x1, - pBox->y2 - pBox->y1); - pBox++; - } - SET_SYNC_FLAG(infoRec); -} - -void -XAAFillColor8x8PatternRects(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorigin, int yorigin, XAACacheInfoPtr pCache) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int xorg, yorg; - - (*infoRec->SetupForColor8x8PatternFill) (pScrn, pCache->x, pCache->y, - rop, planemask, - pCache->trans_color); - - while (nBox--) { - xorg = (pBox->x1 - xorigin) & 0x07; - yorg = (pBox->y1 - yorigin) & 0x07; - - if (!(infoRec->Color8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - int slot = (yorg << 3) + xorg; - - yorg = pCache->y + pCache->offsets[slot].y; - xorg = pCache->x + pCache->offsets[slot].x; - } - - (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn, - xorg, yorg, pBox->x1, - pBox->y1, - pBox->x2 - pBox->x1, - pBox->y2 - pBox->y1); - pBox++; - } - - SET_SYNC_FLAG(infoRec); -} - - /***************\ - | Cache Blits | - \***************/ - -void -XAAFillCacheBltRects(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, int xorg, int yorg, XAACacheInfoPtr pCache) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int x, y, phaseY, phaseX, skipleft, height, width, w, blit_w, blit_h; - - (*infoRec->SetupForScreenToScreenCopy) (pScrn, 1, 1, rop, planemask, - pCache->trans_color); - - while (nBox--) { - y = pBox->y1; - phaseY = (y - yorg) % pCache->orig_h; - if (phaseY < 0) - phaseY += pCache->orig_h; - phaseX = (pBox->x1 - xorg) % pCache->orig_w; - if (phaseX < 0) - phaseX += pCache->orig_w; - height = pBox->y2 - y; - width = pBox->x2 - pBox->x1; - -#if 0 - if (rop == GXcopy) { - while (1) { - w = width; - skipleft = phaseX; - x = pBox->x1; - blit_h = pCache->h - phaseY; - if (blit_h > height) - blit_h = height; - - while (1) { - blit_w = pCache->w - skipleft; - if (blit_w > w) - blit_w = w; - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, - pCache->x + - skipleft, - pCache->y + - phaseY, x, y, - blit_w, blit_h); - w -= blit_w; - if (!w) - break; - x += blit_w; - skipleft = (skipleft + blit_w) % pCache->orig_w; - if (blit_w >= pCache->orig_w) - break; - } - - /* Expand horizontally */ - if (w) { - skipleft -= phaseX; - if (skipleft < 0) - skipleft += pCache->orig_w; - blit_w = x - pBox->x1 - skipleft; - while (w) { - if (blit_w > w) - blit_w = w; - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, - pBox->x1 + - skipleft, y, - x, y, blit_w, - blit_h); - w -= blit_w; - x += blit_w; - blit_w <<= 1; - } - } - - height -= blit_h; - if (!height) - break; - y += blit_h; - phaseY = (phaseY + blit_h) % pCache->orig_h; - if (blit_h >= pCache->orig_h) - break; - } - - /* Expand vertically */ - if (height) { - blit_w = pBox->x2 - pBox->x1; - phaseY -= (pBox->y1 - yorg) % pCache->orig_h; - if (phaseY < 0) - phaseY += pCache->orig_h; - blit_h = y - pBox->y1 - phaseY; - while (height) { - if (blit_h > height) - blit_h = height; - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pBox->x1, - pBox->y1 + phaseY, - pBox->x1, y, - blit_w, blit_h); - height -= blit_h; - y += blit_h; - blit_h <<= 1; - } - } - } - else -#endif - { - while (1) { - w = width; - skipleft = phaseX; - x = pBox->x1; - blit_h = pCache->h - phaseY; - if (blit_h > height) - blit_h = height; - - while (1) { - blit_w = pCache->w - skipleft; - if (blit_w > w) - blit_w = w; - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, - pCache->x + - skipleft, - pCache->y + - phaseY, x, y, - blit_w, blit_h); - w -= blit_w; - if (!w) - break; - x += blit_w; - skipleft = (skipleft + blit_w) % pCache->orig_w; - } - height -= blit_h; - if (!height) - break; - y += blit_h; - phaseY = (phaseY + blit_h) % pCache->orig_h; - } - } - pBox++; - } - - SET_SYNC_FLAG(infoRec); -} - - /*******************\ - | Cache Expansion | - \*******************/ - -void -XAAFillCacheExpandRects(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, int xorg, int yorg, PixmapPtr pPix) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int x, y, phaseY, phaseX, skipleft, height, width, w, blit_w, blit_h; - int cacheWidth; - XAACacheInfoPtr pCache; - - pCache = (*infoRec->CacheMonoStipple) (pScrn, pPix); - - cacheWidth = (pCache->w * pScrn->bitsPerPixel) / - infoRec->CacheColorExpandDensity; - - (*infoRec->SetupForScreenToScreenColorExpandFill) (pScrn, fg, bg, rop, - planemask); - - while (nBox--) { - y = pBox->y1; - phaseY = (y - yorg) % pCache->orig_h; - if (phaseY < 0) - phaseY += pCache->orig_h; - phaseX = (pBox->x1 - xorg) % pCache->orig_w; - if (phaseX < 0) - phaseX += pCache->orig_w; - height = pBox->y2 - y; - width = pBox->x2 - pBox->x1; - - while (1) { - w = width; - skipleft = phaseX; - x = pBox->x1; - blit_h = pCache->h - phaseY; - if (blit_h > height) - blit_h = height; - - while (1) { - blit_w = cacheWidth - skipleft; - if (blit_w > w) - blit_w = w; - (*infoRec->SubsequentScreenToScreenColorExpandFill) (pScrn, x, - y, blit_w, - blit_h, - pCache->x, - pCache->y + - phaseY, - skipleft); - w -= blit_w; - if (!w) - break; - x += blit_w; - skipleft = (skipleft + blit_w) % pCache->orig_w; - } - height -= blit_h; - if (!height) - break; - y += blit_h; - phaseY = (phaseY + blit_h) % pCache->orig_h; - } - pBox++; - } - - SET_SYNC_FLAG(infoRec); -} - - /******************\ - | Image Writes | - \******************/ - -/* This requires all LEFT_EDGE clipping. You get too many problems - with reading past the edge of the pattern otherwise */ - -static void -WriteColumn(ScrnInfoPtr pScrn, - unsigned char *pSrc, - int x, int y, int w, int h, - int xoff, int yoff, int pHeight, int srcwidth, int Bpp) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - unsigned char *src; - Bool PlusOne = FALSE; - int skipleft, dwords; - - pSrc += (Bpp * xoff); - - if ((skipleft = (long) pSrc & 0x03L)) { - if (Bpp == 3) - skipleft = 4 - skipleft; - else - skipleft /= Bpp; - - x -= skipleft; - w += skipleft; - - if (Bpp == 3) - pSrc -= 3 * skipleft; - else /* is this Alpha friendly ? */ - pSrc = (unsigned char *) ((long) pSrc & ~0x03L); - } - - src = pSrc + (yoff * srcwidth); - - dwords = bytes_to_int32(w * Bpp); - - if ((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) && - ((dwords * h) & 0x01)) { - PlusOne = TRUE; - } - - (*infoRec->SubsequentImageWriteRect) (pScrn, x, y, w, h, skipleft); - - if (dwords > infoRec->ImageWriteRange) { - while (h--) { - XAAMoveDWORDS_FixedBase((CARD32 *) infoRec->ImageWriteBase, - (CARD32 *) src, dwords); - src += srcwidth; - yoff++; - if (yoff >= pHeight) { - yoff = 0; - src = pSrc; - } - } - } - else { - if (srcwidth == (dwords << 2)) { - int maxLines = infoRec->ImageWriteRange / dwords; - int step; - - while (h) { - step = pHeight - yoff; - if (step > maxLines) - step = maxLines; - if (step > h) - step = h; - - XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase, - (CARD32 *) src, dwords * step); - - src += (srcwidth * step); - yoff += step; - if (yoff >= pHeight) { - yoff = 0; - src = pSrc; - } - h -= step; - } - } - else { - while (h--) { - XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase, - (CARD32 *) src, dwords); - src += srcwidth; - yoff++; - if (yoff >= pHeight) { - yoff = 0; - src = pSrc; - } - } - } - } - - if (PlusOne) { - CARD32 *base = (CARD32 *) infoRec->ImageWriteBase; - - *base = 0x00000000; - } -} - -void -XAAFillImageWriteRects(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, int xorg, int yorg, PixmapPtr pPix) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int x, phaseY, phaseX, height, width, blit_w; - int pHeight = pPix->drawable.height; - int pWidth = pPix->drawable.width; - int Bpp = pPix->drawable.bitsPerPixel >> 3; - int srcwidth = pPix->devKind; - - (*infoRec->SetupForImageWrite) (pScrn, rop, planemask, -1, - pPix->drawable.bitsPerPixel, - pPix->drawable.depth); - - while (nBox--) { - x = pBox->x1; - phaseY = (pBox->y1 - yorg) % pHeight; - if (phaseY < 0) - phaseY += pHeight; - phaseX = (x - xorg) % pWidth; - if (phaseX < 0) - phaseX += pWidth; - height = pBox->y2 - pBox->y1; - width = pBox->x2 - x; - - while (1) { - blit_w = pWidth - phaseX; - if (blit_w > width) - blit_w = width; - - WriteColumn(pScrn, pPix->devPrivate.ptr, x, pBox->y1, - blit_w, height, phaseX, phaseY, pHeight, srcwidth, Bpp); - - width -= blit_w; - if (!width) - break; - x += blit_w; - phaseX = (phaseX + blit_w) % pWidth; - } - pBox++; - } - - if (infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE) - (*infoRec->Sync) (pScrn); - else - SET_SYNC_FLAG(infoRec); -} - - /*************\ - | Utilities | - \*************/ - -void -XAAClipAndRenderRects(GCPtr pGC, - ClipAndRenderRectsFunc BoxFunc, - int nrectFill, xRectangle *prect, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int Right, Bottom, MaxBoxes; - BoxPtr pextent, pboxClipped, pboxClippedBase; - - MaxBoxes = infoRec->PreAllocSize / sizeof(BoxRec); - pboxClippedBase = (BoxPtr) infoRec->PreAllocMem; - pboxClipped = pboxClippedBase; - - if (RegionNumRects(pGC->pCompositeClip) == 1) { - pextent = RegionRects(pGC->pCompositeClip); - while (nrectFill--) { - pboxClipped->x1 = max(pextent->x1, prect->x); - pboxClipped->y1 = max(pextent->y1, prect->y); - - Right = (int) prect->x + (int) prect->width; - pboxClipped->x2 = min(pextent->x2, Right); - - Bottom = (int) prect->y + (int) prect->height; - pboxClipped->y2 = min(pextent->y2, Bottom); - - prect++; - if ((pboxClipped->x1 < pboxClipped->x2) && - (pboxClipped->y1 < pboxClipped->y2)) { - pboxClipped++; - if (pboxClipped >= (pboxClippedBase + MaxBoxes)) { - (*BoxFunc) (pGC, MaxBoxes, pboxClippedBase, xorg, yorg); - pboxClipped = pboxClippedBase; - } - } - } - } - else { - pextent = RegionExtents(pGC->pCompositeClip); - while (nrectFill--) { - int n; - BoxRec box, *pbox; - - box.x1 = max(pextent->x1, prect->x); - box.y1 = max(pextent->y1, prect->y); - - Right = (int) prect->x + (int) prect->width; - box.x2 = min(pextent->x2, Right); - - Bottom = (int) prect->y + (int) prect->height; - box.y2 = min(pextent->y2, Bottom); - - prect++; - - if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) - continue; - - n = RegionNumRects(pGC->pCompositeClip); - pbox = RegionRects(pGC->pCompositeClip); - - /* clip the rectangle to each box in the clip region - this is logically equivalent to calling Intersect() - */ - while (n--) { - pboxClipped->x1 = max(box.x1, pbox->x1); - pboxClipped->y1 = max(box.y1, pbox->y1); - pboxClipped->x2 = min(box.x2, pbox->x2); - pboxClipped->y2 = min(box.y2, pbox->y2); - pbox++; - - /* see if clipping left anything */ - if (pboxClipped->x1 < pboxClipped->x2 && - pboxClipped->y1 < pboxClipped->y2) { - pboxClipped++; - if (pboxClipped >= (pboxClippedBase + MaxBoxes)) { - (*BoxFunc) (pGC, MaxBoxes, pboxClippedBase, xorg, yorg); - pboxClipped = pboxClippedBase; - } - } - } - } - } - - if (pboxClipped != pboxClippedBase) - (*BoxFunc) (pGC, pboxClipped - pboxClippedBase, pboxClippedBase, - xorg, yorg); -} - -int -XAAGetRectClipBoxes(GCPtr pGC, - BoxPtr pboxClippedBase, - int nrectFill, xRectangle *prectInit) -{ - int Right, Bottom; - BoxPtr pextent, pboxClipped = pboxClippedBase; - xRectangle *prect = prectInit; - RegionPtr prgnClip = pGC->pCompositeClip; - - if (RegionNumRects(prgnClip) == 1) { - pextent = RegionRects(prgnClip); - while (nrectFill--) { - pboxClipped->x1 = max(pextent->x1, prect->x); - pboxClipped->y1 = max(pextent->y1, prect->y); - - Right = (int) prect->x + (int) prect->width; - pboxClipped->x2 = min(pextent->x2, Right); - - Bottom = (int) prect->y + (int) prect->height; - pboxClipped->y2 = min(pextent->y2, Bottom); - - prect++; - if ((pboxClipped->x1 < pboxClipped->x2) && - (pboxClipped->y1 < pboxClipped->y2)) { - pboxClipped++; - } - } - } - else { - pextent = RegionExtents(prgnClip); - while (nrectFill--) { - int n; - BoxRec box, *pbox; - - box.x1 = max(pextent->x1, prect->x); - box.y1 = max(pextent->y1, prect->y); - - Right = (int) prect->x + (int) prect->width; - box.x2 = min(pextent->x2, Right); - - Bottom = (int) prect->y + (int) prect->height; - box.y2 = min(pextent->y2, Bottom); - - prect++; - - if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) - continue; - - n = RegionNumRects(prgnClip); - pbox = RegionRects(prgnClip); - - /* clip the rectangle to each box in the clip region - this is logically equivalent to calling Intersect() - */ - while (n--) { - pboxClipped->x1 = max(box.x1, pbox->x1); - pboxClipped->y1 = max(box.y1, pbox->y1); - pboxClipped->x2 = min(box.x2, pbox->x2); - pboxClipped->y2 = min(box.y2, pbox->y2); - pbox++; - - /* see if clipping left anything */ - if (pboxClipped->x1 < pboxClipped->x2 && - pboxClipped->y1 < pboxClipped->y2) { - pboxClipped++; - } - } - } - } - - return pboxClipped - pboxClippedBase; -} diff --git a/xserver/hw/xfree86/xaa/xaaGC.c b/xserver/hw/xfree86/xaa/xaaGC.c deleted file mode 100644 index d55f1e445..000000000 --- a/xserver/hw/xfree86/xaa/xaaGC.c +++ /dev/null @@ -1,564 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <string.h> - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" -#include "migc.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "xaawrap.h" - -static void XAAValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw); -static void XAAChangeGC(GCPtr pGC, unsigned long mask); -static void XAACopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); -static void XAADestroyGC(GCPtr pGC); -static void XAAChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects); -static void XAADestroyClip(GCPtr pGC); -static void XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc); - -GCFuncs XAAGCFuncs = { - XAAValidateGC, XAAChangeGC, XAACopyGC, XAADestroyGC, - XAAChangeClip, XAADestroyClip, XAACopyClip -}; - -extern GCOps XAAPixmapOps; - -Bool -XAACreateGC(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates, - XAAGetGCKey()); - Bool ret; - - XAA_SCREEN_PROLOGUE(pScreen, CreateGC); - - if ((ret = (*pScreen->CreateGC) (pGC))) { - pGCPriv->wrapOps = NULL; - pGCPriv->wrapFuncs = pGC->funcs; - pGCPriv->XAAOps = &XAAFallbackOps; - pGC->funcs = &XAAGCFuncs; - } - - XAA_SCREEN_EPILOGUE(pScreen, CreateGC, XAACreateGC); - - return ret; -} - -static void -XAAValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - XAA_GC_FUNC_PROLOGUE(pGC); - - (*pGC->funcs->ValidateGC) (pGC, changes, pDraw); - - if ((changes & GCPlaneMask) && - ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) == - infoRec->FullPlanemasks[pGC->depth - 1])) { - pGC->planemask = ~0; - } - - if (pGC->depth != 32) { - /* 0xffffffff is reserved for transparency */ - if (pGC->bgPixel == 0xffffffff) - pGC->bgPixel = 0x7fffffff; - if (pGC->fgPixel == 0xffffffff) - pGC->fgPixel = 0x7fffffff; - } - - if ((pDraw->type == DRAWABLE_PIXMAP) && !IS_OFFSCREEN_PIXMAP(pDraw)) { - pGCPriv->flags = OPS_ARE_PIXMAP; - pGCPriv->changes |= changes; - - /* make sure we're not using videomemory pixmaps to render - onto system memory drawables */ - - if ((pGC->fillStyle == FillTiled) && - IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) && - !OFFSCREEN_PIXMAP_LOCKED(pGC->tile.pixmap)) { - - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); - FBAreaPtr area = pPriv->offscreenArea; - - XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */ - xf86FreeOffscreenArea(area); - } - } - else if (!infoRec->pScrn->vtSema && (pDraw->type == DRAWABLE_WINDOW)) { - pGCPriv->flags = 0; - pGCPriv->changes |= changes; - } - else { - if (!(pGCPriv->flags & OPS_ARE_ACCEL)) { - changes |= pGCPriv->changes; - pGCPriv->changes = 0; - } - pGCPriv->flags = OPS_ARE_ACCEL; - -#if 1 - /* Ugh. If we can't use the blitter on offscreen pixmaps used - as tiles, then we need to move them out as cfb can't handle - tiles with non-zero origins */ - - if ((pGC->fillStyle == FillTiled) && - IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) && - (DO_PIXMAP_COPY != (*infoRec->TiledFillChooser) (pGC))) { - - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); - FBAreaPtr area = pPriv->offscreenArea; - - XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */ - xf86FreeOffscreenArea(area); - } -#endif - } - - XAA_GC_FUNC_EPILOGUE(pGC); - - if (!(pGCPriv->flags & OPS_ARE_ACCEL)) - return; - - if ((changes & GCTile) && !pGC->tileIsPixel && pGC->tile.pixmap) { - XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); - - if (pixPriv->flags & DIRTY) { - pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK); - pGC->tile.pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; - } - } - if ((changes & GCStipple) && pGC->stipple) { - XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); - - if (pixPriv->flags & DIRTY) { - pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK); - pGC->stipple->drawable.serialNumber = NEXT_SERIAL_NUMBER; - } - } - - /* If our Ops are still the default ones we need to allocate new ones */ - if (pGC->ops == &XAAFallbackOps) { - if (!(pGCPriv->XAAOps = malloc(sizeof(GCOps)))) { - pGCPriv->XAAOps = &XAAFallbackOps; - return; - } - /* make a modifiable copy of the default ops */ - memcpy(pGCPriv->XAAOps, &XAAFallbackOps, sizeof(GCOps)); - pGC->ops = pGCPriv->XAAOps; - changes = ~0; - } - - if (!changes) - return; - - if ((changes & GCDashList) && infoRec->ComputeDash) - infoRec->ComputeDash(pGC); - - if (changes & infoRec->FillSpansMask) - (*infoRec->ValidateFillSpans) (pGC, changes, pDraw); - - if (changes & infoRec->SetSpansMask) - (*infoRec->ValidateSetSpans) (pGC, changes, pDraw); - - if (changes & infoRec->PutImageMask) - (*infoRec->ValidatePutImage) (pGC, changes, pDraw); - - if (changes & infoRec->CopyAreaMask) - (*infoRec->ValidateCopyArea) (pGC, changes, pDraw); - - if (changes & infoRec->CopyPlaneMask) - (*infoRec->ValidateCopyPlane) (pGC, changes, pDraw); - - if (changes & infoRec->PolyPointMask) - (*infoRec->ValidatePolyPoint) (pGC, changes, pDraw); - - if (changes & infoRec->PolylinesMask) - (*infoRec->ValidatePolylines) (pGC, changes, pDraw); - - if (changes & infoRec->PolySegmentMask) - (*infoRec->ValidatePolySegment) (pGC, changes, pDraw); - - if (changes & infoRec->PolyRectangleMask) - (*infoRec->ValidatePolyRectangle) (pGC, changes, pDraw); - - if (changes & infoRec->PolyArcMask) - (*infoRec->ValidatePolyArc) (pGC, changes, pDraw); - - if (changes & infoRec->FillPolygonMask) - (*infoRec->ValidateFillPolygon) (pGC, changes, pDraw); - - if (changes & infoRec->PolyFillRectMask) - (*infoRec->ValidatePolyFillRect) (pGC, changes, pDraw); - - if (changes & infoRec->PolyFillArcMask) - (*infoRec->ValidatePolyFillArc) (pGC, changes, pDraw); - - if (changes & infoRec->PolyGlyphBltMask) - (*infoRec->ValidatePolyGlyphBlt) (pGC, changes, pDraw); - - if (changes & infoRec->ImageGlyphBltMask) - (*infoRec->ValidateImageGlyphBlt) (pGC, changes, pDraw); - - if (changes & infoRec->PolyText8Mask) - (*infoRec->ValidatePolyText8) (pGC, changes, pDraw); - - if (changes & infoRec->PolyText16Mask) - (*infoRec->ValidatePolyText16) (pGC, changes, pDraw); - - if (changes & infoRec->ImageText8Mask) - (*infoRec->ValidateImageText8) (pGC, changes, pDraw); - - if (changes & infoRec->ImageText16Mask) - (*infoRec->ValidateImageText16) (pGC, changes, pDraw); - - if (changes & infoRec->PushPixelsMask) - (*infoRec->ValidatePushPixels) (pGC, changes, pDraw); -} - -static void -XAADestroyGC(GCPtr pGC) -{ - XAA_GC_FUNC_PROLOGUE(pGC); - - if (pGCPriv->XAAOps != &XAAFallbackOps) - free(pGCPriv->XAAOps); - - free(pGCPriv->DashPattern); - pGCPriv->flags = 0; - - (*pGC->funcs->DestroyGC) (pGC); - XAA_GC_FUNC_EPILOGUE(pGC); -} - -static void -XAAChangeGC(GCPtr pGC, unsigned long mask) -{ - XAA_GC_FUNC_PROLOGUE(pGC); - (*pGC->funcs->ChangeGC) (pGC, mask); - XAA_GC_FUNC_EPILOGUE(pGC); - - /* we have to assume that shared memory pixmaps are dirty - because we can't wrap all operations on them */ - - if ((mask & GCTile) && !pGC->tileIsPixel && - PIXMAP_IS_SHARED(pGC->tile.pixmap)) { - XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); - - pPixPriv->flags |= DIRTY; - } - - if ((mask & GCStipple) && PIXMAP_IS_SHARED(pGC->stipple)) { - XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); - - pPixPriv->flags |= DIRTY; - } -} - -static void -XAACopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) -{ - XAA_GC_FUNC_PROLOGUE(pGCDst); - (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); - XAA_GC_FUNC_EPILOGUE(pGCDst); -} - -static void -XAAChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) -{ - XAA_GC_FUNC_PROLOGUE(pGC); - (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); - XAA_GC_FUNC_EPILOGUE(pGC); -} - -static void -XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc) -{ - XAA_GC_FUNC_PROLOGUE(pgcDst); - (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc); - XAA_GC_FUNC_EPILOGUE(pgcDst); -} - -static void -XAADestroyClip(GCPtr pGC) -{ - XAA_GC_FUNC_PROLOGUE(pGC); - (*pGC->funcs->DestroyClip) (pGC); - XAA_GC_FUNC_EPILOGUE(pGC); -} - -/**** Pixmap Wrappers ****/ - -static void -XAAFillSpansPixmap(DrawablePtr pDraw, - GC * pGC, - int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAASetSpansPixmap(DrawablePtr pDraw, - GCPtr pGC, - char *pcharsrc, - register DDXPointPtr ppt, - int *pwidth, int nspans, int fSorted) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPutImagePixmap(DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, int y, int w, int h, - int leftPad, int format, char *pImage) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h, - leftPad, format, pImage); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static RegionPtr -XAACopyAreaPixmap(DrawablePtr pSrc, - DrawablePtr pDst, - GC * pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - RegionPtr ret; - - if (infoRec->pScrn->vtSema && - ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))) { - if (infoRec->ReadPixmap && (pGC->alu == GXcopy) && - (pSrc->bitsPerPixel == pDst->bitsPerPixel) && - ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1]) - == infoRec->FullPlanemasks[pSrc->depth - 1])) { - XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr) (pDst)); - - pixPriv->flags |= DIRTY; - - return (XAABitBlt(pSrc, pDst, pGC, - srcx, srcy, width, height, dstx, dsty, - XAADoImageRead, 0L)); - } - else if (infoRec->NeedToSync) { - (*infoRec->Sync) (infoRec->pScrn); - infoRec->NeedToSync = FALSE; - } - } - - { - XAA_PIXMAP_OP_PROLOGUE(pGC, pDst); - ret = (*pGC->ops->CopyArea) (pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, - dsty); - XAA_PIXMAP_OP_EPILOGUE(pGC); - } - return ret; -} - -static RegionPtr -XAACopyPlanePixmap(DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, unsigned long bitPlane) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - RegionPtr ret; - - XAA_PIXMAP_OP_PROLOGUE(pGC, pDst); - - if (infoRec->pScrn->vtSema && - ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))) { - if (infoRec->NeedToSync) { - (*infoRec->Sync) (infoRec->pScrn); - infoRec->NeedToSync = FALSE; - } - } - - ret = (*pGC->ops->CopyPlane) (pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty, - bitPlane); - XAA_PIXMAP_OP_EPILOGUE(pGC); - return ret; -} - -static void -XAAPolyPointPixmap(DrawablePtr pDraw, - GCPtr pGC, int mode, int npt, xPoint * pptInit) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyPoint) (pDraw, pGC, mode, npt, pptInit); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPolylinesPixmap(DrawablePtr pDraw, - GCPtr pGC, int mode, int npt, DDXPointPtr pptInit) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->Polylines) (pDraw, pGC, mode, npt, pptInit); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPolySegmentPixmap(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment * pSeg) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolySegment) (pDraw, pGC, nseg, pSeg); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPolyRectanglePixmap(DrawablePtr pDraw, - GCPtr pGC, int nRectsInit, xRectangle *pRectsInit) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPolyArcPixmap(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyArc) (pDraw, pGC, narcs, parcs); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAFillPolygonPixmap(DrawablePtr pDraw, - GCPtr pGC, - int shape, int mode, int count, DDXPointPtr ptsIn) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPolyFillRectPixmap(DrawablePtr pDraw, - GCPtr pGC, int nrectFill, xRectangle *prectInit) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyFillRect) (pDraw, pGC, nrectFill, prectInit); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPolyFillArcPixmap(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, parcs); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static int -XAAPolyText8Pixmap(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - int ret; - - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - ret = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars); - XAA_PIXMAP_OP_EPILOGUE(pGC); - return ret; -} - -static int -XAAPolyText16Pixmap(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, unsigned short *chars) -{ - int ret; - - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - ret = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars); - XAA_PIXMAP_OP_EPILOGUE(pGC); - return ret; -} - -static void -XAAImageText8Pixmap(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAImageText16Pixmap(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, unsigned short *chars) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAImageGlyphBltPixmap(DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph, - ppci, pglyphBase); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPolyGlyphBltPixmap(DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph, - ppci, pglyphBase); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPushPixelsPixmap(GCPtr pGC, - PixmapPtr pBitMap, - DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg) -{ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -GCOps XAAPixmapOps = { - XAAFillSpansPixmap, XAASetSpansPixmap, - XAAPutImagePixmap, XAACopyAreaPixmap, - XAACopyPlanePixmap, XAAPolyPointPixmap, - XAAPolylinesPixmap, XAAPolySegmentPixmap, - XAAPolyRectanglePixmap, XAAPolyArcPixmap, - XAAFillPolygonPixmap, XAAPolyFillRectPixmap, - XAAPolyFillArcPixmap, XAAPolyText8Pixmap, - XAAPolyText16Pixmap, XAAImageText8Pixmap, - XAAImageText16Pixmap, XAAImageGlyphBltPixmap, - XAAPolyGlyphBltPixmap, XAAPushPixelsPixmap, -}; diff --git a/xserver/hw/xfree86/xaa/xaaGCmisc.c b/xserver/hw/xfree86/xaa/xaaGCmisc.c deleted file mode 100644 index ca69aae74..000000000 --- a/xserver/hw/xfree86/xaa/xaaGCmisc.c +++ /dev/null @@ -1,412 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include <X11/fonts/fontstruct.h> -#include "dixfontstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" -#include "migc.h" -#include "mi.h" -#include "gcstruct.h" -#include "pixmapstr.h" - -void -XAAValidateCopyArea(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - if (infoRec->CopyArea && - CHECK_PLANEMASK(pGC, infoRec->CopyAreaFlags) && - CHECK_ROP(pGC, infoRec->CopyAreaFlags) && - CHECK_ROPSRC(pGC, infoRec->CopyAreaFlags) - ) - pGC->ops->CopyArea = infoRec->CopyArea; - else - pGC->ops->CopyArea = XAAFallbackOps.CopyArea; -} - -void -XAAValidatePutImage(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - if (infoRec->PutImage && - CHECK_PLANEMASK(pGC, infoRec->PutImageFlags) && - CHECK_ROP(pGC, infoRec->PutImageFlags) && - CHECK_ROPSRC(pGC, infoRec->PutImageFlags) && - CHECK_COLORS(pGC, infoRec->PutImageFlags) - ) - pGC->ops->PutImage = infoRec->PutImage; - else - pGC->ops->PutImage = XAAFallbackOps.PutImage; -} - -void -XAAValidateCopyPlane(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - if (infoRec->CopyPlane && - CHECK_PLANEMASK(pGC, infoRec->CopyPlaneFlags) && - CHECK_ROP(pGC, infoRec->CopyPlaneFlags) && - CHECK_ROPSRC(pGC, infoRec->CopyPlaneFlags) && - CHECK_COLORS(pGC, infoRec->CopyPlaneFlags) - ) - pGC->ops->CopyPlane = infoRec->CopyPlane; - else - pGC->ops->CopyPlane = XAAFallbackOps.CopyPlane; -} - -void -XAAValidatePushPixels(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - if (infoRec->PushPixelsSolid && - (pGC->fillStyle == FillSolid) && - CHECK_PLANEMASK(pGC, infoRec->PushPixelsFlags) && - CHECK_ROP(pGC, infoRec->PushPixelsFlags) && - CHECK_ROPSRC(pGC, infoRec->PushPixelsFlags) && - CHECK_FG(pGC, infoRec->PushPixelsFlags) && - (!(infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY) || - (pGC->alu == GXcopy)) - ) - pGC->ops->PushPixels = infoRec->PushPixelsSolid; - else - pGC->ops->PushPixels = XAAFallbackOps.PushPixels; - -} - -/* We make the assumption that the FillSpans, PolyFillRect, FillPolygon - and PolyFillArc functions are linked in a way that they all have - the same rop/color/planemask restrictions. If the driver provides - a GC level replacement for these, it will need to supply a new - Validate functions if it breaks this assumption */ - -void -XAAValidateFillSpans(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - if (pGC->fillStyle != FillTiled) - changes &= ~GCTile; - if ((pGC->fillStyle == FillTiled) || (pGC->fillStyle == FillSolid)) - changes &= ~GCStipple; - if (!changes) - return; - - pGC->ops->FillSpans = XAAFallbackOps.FillSpans; - pGC->ops->PolyFillRect = XAAFallbackOps.PolyFillRect; - pGC->ops->FillPolygon = XAAFallbackOps.FillPolygon; - pGC->ops->PolyFillArc = XAAFallbackOps.PolyFillArc; - - switch (pGC->fillStyle) { - case FillSolid: - if (infoRec->FillSpansSolid && - CHECK_PLANEMASK(pGC, infoRec->FillSpansSolidFlags) && - CHECK_ROP(pGC, infoRec->FillSpansSolidFlags) && - CHECK_ROPSRC(pGC, infoRec->FillSpansSolidFlags) && - CHECK_FG(pGC, infoRec->FillSpansSolidFlags) - ) { - pGC->ops->FillSpans = infoRec->FillSpansSolid; - pGC->ops->PolyFillRect = infoRec->PolyFillRectSolid; - pGC->ops->FillPolygon = infoRec->FillPolygonSolid; - pGC->ops->PolyFillArc = infoRec->PolyFillArcSolid; - } - break; - /* The [Stippled/OpaqueStippled/Tiled]FillChooser - functions do the validating */ - case FillStippled: - if (infoRec->FillSpansStippled) { - pGC->ops->FillSpans = infoRec->FillSpansStippled; - pGC->ops->PolyFillRect = infoRec->PolyFillRectStippled; - if (infoRec->FillPolygonStippled) - pGC->ops->FillPolygon = infoRec->FillPolygonStippled; - else - pGC->ops->FillPolygon = miFillPolygon; - pGC->ops->PolyFillArc = miPolyFillArc; - } - break; - case FillOpaqueStippled: - if (infoRec->FillSpansOpaqueStippled) { - pGC->ops->FillSpans = infoRec->FillSpansOpaqueStippled; - pGC->ops->PolyFillRect = infoRec->PolyFillRectOpaqueStippled; - if (infoRec->FillPolygonOpaqueStippled) - pGC->ops->FillPolygon = infoRec->FillPolygonOpaqueStippled; - else - pGC->ops->FillPolygon = miFillPolygon; - pGC->ops->PolyFillArc = miPolyFillArc; - } - break; - case FillTiled: - if (infoRec->FillSpansTiled) { - pGC->ops->FillSpans = infoRec->FillSpansTiled; - pGC->ops->PolyFillRect = infoRec->PolyFillRectTiled; - if (infoRec->FillPolygonTiled) - pGC->ops->FillPolygon = infoRec->FillPolygonTiled; - else - pGC->ops->FillPolygon = miFillPolygon; - pGC->ops->PolyFillArc = miPolyFillArc; - } - break; - default: - return; - } -} - -/* We make the assumption that these Text8/16 and GlyphBlt functions - are linked in a way that they all have the same rop/color/planemask - restrictions. If the driver provides a GC level replacement for - these, it will need to supply a new Validate functions if it breaks - this assumption */ - -void -XAAValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - Bool BigFont = FALSE; - - pGC->ops->PolyText8 = XAAFallbackOps.PolyText8; - pGC->ops->PolyText16 = XAAFallbackOps.PolyText16; - pGC->ops->PolyGlyphBlt = XAAFallbackOps.PolyGlyphBlt; - - if (!pGC->font) - return; - if (pGC->fillStyle != FillSolid) - return; - - if ((FONTMAXBOUNDS(pGC->font, rightSideBearing) - - FONTMINBOUNDS(pGC->font, leftSideBearing) > 32)) - BigFont = TRUE; - - /* no funny business */ - if ((FONTMINBOUNDS(pGC->font, characterWidth) <= 0) || - ((FONTASCENT(pGC->font) + FONTDESCENT(pGC->font)) <= 0)) - return; - - /* Check for TE Fonts */ - if (!TERMINALFONT(pGC->font) || BigFont) { - if (infoRec->PolyGlyphBltNonTE && - CHECK_PLANEMASK(pGC, infoRec->PolyGlyphBltNonTEFlags) && - CHECK_ROP(pGC, infoRec->PolyGlyphBltNonTEFlags) && - CHECK_ROPSRC(pGC, infoRec->PolyGlyphBltNonTEFlags) && - CHECK_FG(pGC, infoRec->PolyGlyphBltNonTEFlags) && - (!(infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY) || - (pGC->alu == GXcopy)) - ) { - pGC->ops->PolyText8 = infoRec->PolyText8NonTE; - pGC->ops->PolyText16 = infoRec->PolyText16NonTE; - pGC->ops->PolyGlyphBlt = infoRec->PolyGlyphBltNonTE; - } - } - else { - if (infoRec->PolyGlyphBltTE && - CHECK_PLANEMASK(pGC, infoRec->PolyGlyphBltTEFlags) && - CHECK_ROP(pGC, infoRec->PolyGlyphBltTEFlags) && - CHECK_ROPSRC(pGC, infoRec->PolyGlyphBltNonTEFlags) && - CHECK_FG(pGC, infoRec->PolyGlyphBltTEFlags) && - (!(infoRec->PolyGlyphBltTEFlags & TRANSPARENCY_GXCOPY_ONLY) || - (pGC->alu == GXcopy)) - ) { - pGC->ops->PolyText8 = infoRec->PolyText8TE; - pGC->ops->PolyText16 = infoRec->PolyText16TE; - pGC->ops->PolyGlyphBlt = infoRec->PolyGlyphBltTE; - } - } -} - -void -XAAValidateImageGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - Bool BigFont = FALSE; - - pGC->ops->ImageText8 = XAAFallbackOps.ImageText8; - pGC->ops->ImageText16 = XAAFallbackOps.ImageText16; - pGC->ops->ImageGlyphBlt = XAAFallbackOps.ImageGlyphBlt; - - if (!pGC->font) - return; - - if ((FONTMAXBOUNDS(pGC->font, rightSideBearing) - - FONTMINBOUNDS(pGC->font, leftSideBearing) > 32)) - BigFont = TRUE; - - /* no funny business */ - if ((FONTMINBOUNDS(pGC->font, characterWidth) <= 0) || - ((FONTASCENT(pGC->font) + FONTDESCENT(pGC->font)) <= 0)) - return; - - /* Check for TE Fonts */ - if (!TERMINALFONT(pGC->font) || BigFont || (pGC->depth == 32)) { - if (infoRec->ImageGlyphBltNonTE && - CHECK_PLANEMASK(pGC, infoRec->ImageGlyphBltNonTEFlags) && - CHECK_FG(pGC, infoRec->ImageGlyphBltNonTEFlags) && - infoRec->SetupForSolidFill && - CHECK_PLANEMASK(pGC, infoRec->SolidFillFlags) && - CHECK_BG(pGC, infoRec->SolidFillFlags)) { - pGC->ops->ImageText8 = infoRec->ImageText8NonTE; - pGC->ops->ImageText16 = infoRec->ImageText16NonTE; - pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltNonTE; - } - } - else if (infoRec->ImageGlyphBltTE && - CHECK_PLANEMASK(pGC, infoRec->ImageGlyphBltTEFlags)) { - if (!(infoRec->ImageGlyphBltTEFlags & TRANSPARENCY_ONLY) && - CHECK_COLORS(pGC, infoRec->ImageGlyphBltTEFlags)) { - pGC->ops->ImageText8 = infoRec->ImageText8TE; - pGC->ops->ImageText16 = infoRec->ImageText16TE; - pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltTE; - } - else { - if (CHECK_FG(pGC, infoRec->ImageGlyphBltTEFlags) && - infoRec->SetupForSolidFill && - CHECK_PLANEMASK(pGC, infoRec->SolidFillFlags) && - CHECK_BG(pGC, infoRec->SolidFillFlags)) { - pGC->ops->ImageText8 = infoRec->ImageText8TE; - pGC->ops->ImageText16 = infoRec->ImageText16TE; - pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltTE; - } - } - } -} - -void -XAAValidatePolylines(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates, - XAAGetGCKey()); - - if (pGC->lineStyle == LineSolid) - changes &= ~GCDashList; - if (!changes) - return; - - pGC->ops->PolySegment = XAAFallbackOps.PolySegment; - pGC->ops->Polylines = XAAFallbackOps.Polylines; - pGC->ops->PolyRectangle = XAAFallbackOps.PolyRectangle; - pGC->ops->PolyArc = XAAFallbackOps.PolyArc; - - if ((pGC->ops->FillSpans != XAAFallbackOps.FillSpans) && - (pGC->lineWidth > 0)) { - - pGC->ops->PolyArc = miPolyArc; - pGC->ops->PolySegment = miPolySegment; - pGC->ops->PolyRectangle = miPolyRectangle; - if (pGC->lineStyle == LineSolid) - pGC->ops->Polylines = miWideLine; - else - pGC->ops->Polylines = miWideDash; - } - - if ((pGC->lineWidth == 0) && (pGC->fillStyle == FillSolid)) { - - if (pGC->lineStyle == LineSolid) { - - if (infoRec->PolyRectangleThinSolid && - CHECK_PLANEMASK(pGC, infoRec->PolyRectangleThinSolidFlags) && - CHECK_ROP(pGC, infoRec->PolyRectangleThinSolidFlags) && - CHECK_ROPSRC(pGC, infoRec->PolyRectangleThinSolidFlags) && - CHECK_FG(pGC, infoRec->PolyRectangleThinSolidFlags)) { - - pGC->ops->PolyRectangle = infoRec->PolyRectangleThinSolid; - } - - if (infoRec->PolySegmentThinSolid && - CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinSolidFlags) && - CHECK_ROP(pGC, infoRec->PolySegmentThinSolidFlags) && - CHECK_ROPSRC(pGC, infoRec->PolySegmentThinSolidFlags) && - CHECK_FG(pGC, infoRec->PolySegmentThinSolidFlags)) { - - pGC->ops->PolySegment = infoRec->PolySegmentThinSolid; - } - - if (infoRec->PolylinesThinSolid && - CHECK_PLANEMASK(pGC, infoRec->PolylinesThinSolidFlags) && - CHECK_ROP(pGC, infoRec->PolylinesThinSolidFlags) && - CHECK_ROPSRC(pGC, infoRec->PolylinesThinSolidFlags) && - CHECK_FG(pGC, infoRec->PolylinesThinSolidFlags)) { - - pGC->ops->Polylines = infoRec->PolylinesThinSolid; - } - } - else if ((pGC->lineStyle == LineOnOffDash) && pGCPriv->DashPattern) { - - if (infoRec->PolySegmentThinDashed && - !(infoRec->PolySegmentThinDashedFlags & NO_TRANSPARENCY) && - ((pGC->alu == GXcopy) || !(infoRec->PolySegmentThinDashedFlags & - TRANSPARENCY_GXCOPY_ONLY)) && - CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinDashedFlags) && - CHECK_ROP(pGC, infoRec->PolySegmentThinDashedFlags) && - CHECK_ROPSRC(pGC, infoRec->PolySegmentThinDashedFlags) && - CHECK_FG(pGC, infoRec->PolySegmentThinDashedFlags)) { - - pGC->ops->PolySegment = infoRec->PolySegmentThinDashed; - } - - if (infoRec->PolylinesThinDashed && - !(infoRec->PolylinesThinDashedFlags & NO_TRANSPARENCY) && - ((pGC->alu == GXcopy) || !(infoRec->PolylinesThinDashedFlags & - TRANSPARENCY_GXCOPY_ONLY)) && - CHECK_PLANEMASK(pGC, infoRec->PolylinesThinDashedFlags) && - CHECK_ROP(pGC, infoRec->PolylinesThinDashedFlags) && - CHECK_ROPSRC(pGC, infoRec->PolylinesThinDashedFlags) && - CHECK_FG(pGC, infoRec->PolylinesThinDashedFlags)) { - - pGC->ops->Polylines = infoRec->PolylinesThinDashed; - } - - if (pGC->ops->Polylines != XAAFallbackOps.Polylines) - pGC->ops->PolyRectangle = miPolyRectangle; - - } - else if (pGCPriv->DashPattern && (pGC->depth != 32)) { - /* LineDoubleDash */ - if (infoRec->PolySegmentThinDashed && - !(infoRec->PolySegmentThinDashedFlags & TRANSPARENCY_ONLY) && - CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinDashedFlags) && - CHECK_ROP(pGC, infoRec->PolySegmentThinDashedFlags) && - CHECK_ROPSRC(pGC, infoRec->PolySegmentThinDashedFlags) && - CHECK_COLORS(pGC, infoRec->PolySegmentThinDashedFlags)) { - - pGC->ops->PolySegment = infoRec->PolySegmentThinDashed; - } - - if (infoRec->PolylinesThinDashed && - !(infoRec->PolylinesThinDashedFlags & TRANSPARENCY_ONLY) && - CHECK_PLANEMASK(pGC, infoRec->PolylinesThinDashedFlags) && - CHECK_ROP(pGC, infoRec->PolylinesThinDashedFlags) && - CHECK_ROPSRC(pGC, infoRec->PolylinesThinDashedFlags) && - CHECK_COLORS(pGC, infoRec->PolylinesThinDashedFlags)) { - - pGC->ops->Polylines = infoRec->PolylinesThinDashed; - } - - if (pGC->ops->Polylines != XAAFallbackOps.Polylines) - pGC->ops->PolyRectangle = miPolyRectangle; - - } - } - - if (infoRec->PolylinesWideSolid && - (pGC->lineWidth > 0) && - (pGC->fillStyle == FillSolid) && - (pGC->lineStyle == LineSolid) && - CHECK_PLANEMASK(pGC, infoRec->PolylinesWideSolidFlags) && - CHECK_ROP(pGC, infoRec->PolylinesWideSolidFlags) && - CHECK_ROPSRC(pGC, infoRec->PolylinesWideSolidFlags) && - CHECK_FG(pGC, infoRec->PolylinesWideSolidFlags)) { - - pGC->ops->Polylines = infoRec->PolylinesWideSolid; - } -} diff --git a/xserver/hw/xfree86/xaa/xaaImage.c b/xserver/hw/xfree86/xaa/xaaImage.c deleted file mode 100644 index 4457c9efa..000000000 --- a/xserver/hw/xfree86/xaa/xaaImage.c +++ /dev/null @@ -1,534 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" -#include "servermd.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "mi.h" -#include "pixmapstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" - -void -XAAMoveDWORDS_FixedBase(register CARD32 *dest, - register CARD32 *src, register int dwords) -{ - while (dwords & ~0x03) { - *dest = *src; - *dest = *(src + 1); - *dest = *(src + 2); - *dest = *(src + 3); - dwords -= 4; - src += 4; - } - - if (!dwords) - return; - *dest = *src; - if (dwords == 1) - return; - *dest = *(src + 1); - if (dwords == 2) - return; - *dest = *(src + 2); -} - -void -XAAMoveDWORDS(register CARD32 *dest, register CARD32 *src, register int dwords) -{ - while (dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - *(dest + 3) = *(src + 3); - src += 4; - dest += 4; - dwords -= 4; - } - if (!dwords) - return; - *dest = *src; - if (dwords == 1) - return; - *(dest + 1) = *(src + 1); - if (dwords == 2) - return; - *(dest + 2) = *(src + 2); -} - -void -XAAMoveDWORDS_FixedSrc(register CARD32 *dest, - register CARD32 *src, register int dwords) -{ - while (dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *src; - *(dest + 2) = *src; - *(dest + 3) = *src; - dest += 4; - dwords -= 4; - } - if (!dwords) - return; - *dest = *src; - if (dwords == 1) - return; - *(dest + 1) = *src; - if (dwords == 2) - return; - *(dest + 2) = *src; -} - -static void -XAAWritePixmap32To24(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *srcInit, int srcwidth, /* bytes */ - int rop, unsigned int planemask, int trans) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int count, dwords = bytes_to_int32(w * 3); - CARD32 *src, *dst; - Bool PlusOne = FALSE; - - if ((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) && - ((dwords * h) & 0x01)) { - PlusOne = TRUE; - } - - (*infoRec->SetupForImageWrite) (pScrn, rop, planemask, trans, 24, 24); - (*infoRec->SubsequentImageWriteRect) (pScrn, x, y, w, h, 0); - - if (dwords > infoRec->ImageWriteRange) { - dst = (CARD32 *) infoRec->ImageWriteBase; - while (h--) { - src = (CARD32 *) srcInit; - count = w; - - while (count >= 4) { - *dst = (src[0] & 0x00ffffff) | (src[1] << 24); - *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16); - *dst = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8); - src += 4; - count -= 4; - } - switch (count) { - case 0: - break; - case 1: - *dst = src[0]; - break; - case 2: - *dst = (src[0] & 0x00ffffff) | (src[1] << 24); - *dst = src[1] >> 8; - break; - default: - *dst = (src[0] & 0x00ffffff) | (src[1] << 24); - *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16); - *dst = src[2] >> 16; - break; - } - srcInit += srcwidth; - } - } - else { - while (h--) { - dst = (CARD32 *) infoRec->ImageWriteBase; - src = (CARD32 *) srcInit; - count = w; - - while (count >= 4) { - dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24); - dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16); - dst[2] = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8); - dst += 3; - src += 4; - count -= 4; - } - switch (count) { - case 0: - break; - case 1: - dst[0] = src[0]; - break; - case 2: - dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24); - dst[1] = src[1] >> 8; - break; - default: - dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24); - dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16); - dst[2] = src[2] >> 16; - break; - } - srcInit += srcwidth; - } - } - - if (PlusOne) { - CARD32 *base = (CARD32 *) infoRec->ImageWriteBase; - - *base = 0x00000000; - } - - if (infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE) - (*infoRec->Sync) (pScrn); - else - SET_SYNC_FLAG(infoRec); - -} - -void -XAAWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, /* bytes */ - int rop, unsigned int planemask, int trans, int bpp, int depth) -{ - XAAInfoRecPtr infoRec; - int dwords, skipleft, Bpp; - Bool beCareful, PlusOne; - - if ((bpp == 32) && (pScrn->bitsPerPixel == 24)) { - XAAWritePixmap32To24(pScrn, x, y, w, h, src, srcwidth, - rop, planemask, trans); - return; - } - - infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - beCareful = PlusOne = FALSE; - Bpp = bpp >> 3; - - if ((skipleft = (long) src & 0x03L)) { - if (!(infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) { - skipleft = 0; - beCareful = TRUE; - goto BAD_ALIGNMENT; - } - - if (Bpp == 3) - skipleft = 4 - skipleft; - else - skipleft /= Bpp; - - if ((x < skipleft) && !(infoRec->ImageWriteFlags & - LEFT_EDGE_CLIPPING_NEGATIVE_X)) { - skipleft = 0; - beCareful = TRUE; - goto BAD_ALIGNMENT; - } - - x -= skipleft; - w += skipleft; - - if (Bpp == 3) - src -= 3 * skipleft; - else /* is this Alpha friendly ? */ - src = (unsigned char *) ((long) src & ~0x03L); - } - - BAD_ALIGNMENT: - - dwords = bytes_to_int32(w * Bpp); - - if ((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) && - ((dwords * h) & 0x01)) { - PlusOne = TRUE; - } - - (*infoRec->SetupForImageWrite) (pScrn, rop, planemask, trans, bpp, depth); - (*infoRec->SubsequentImageWriteRect) (pScrn, x, y, w, h, skipleft); - - if (beCareful) { - /* in cases with bad alignment we have to be careful not - to read beyond the end of the source */ - if (((x * Bpp) + (dwords << 2)) > srcwidth) - h--; - else - beCareful = FALSE; - } - - if (dwords > infoRec->ImageWriteRange) { - while (h--) { - XAAMoveDWORDS_FixedBase((CARD32 *) infoRec->ImageWriteBase, - (CARD32 *) src, dwords); - src += srcwidth; - } - if (beCareful) { - int shift = ((long) src & 0x03L) << 3; - - if (--dwords) - XAAMoveDWORDS_FixedBase((CARD32 *) infoRec->ImageWriteBase, - (CARD32 *) src, dwords); - src = (unsigned char *) ((long) (src + (dwords << 2)) & ~0x03L); - *((CARD32 *) infoRec->ImageWriteBase) = *((CARD32 *) src) >> shift; - } - } - else { - if (srcwidth == (dwords << 2)) { - int decrement = infoRec->ImageWriteRange / dwords; - - while (h > decrement) { - XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase, - (CARD32 *) src, dwords * decrement); - src += (srcwidth * decrement); - h -= decrement; - } - if (h) { - XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase, - (CARD32 *) src, dwords * h); - if (beCareful) - src += (srcwidth * h); - } - } - else { - while (h--) { - XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase, - (CARD32 *) src, dwords); - src += srcwidth; - } - } - - if (beCareful) { - int shift = ((long) src & 0x03L) << 3; - - if (--dwords) - XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase, - (CARD32 *) src, dwords); - src = (unsigned char *) ((long) (src + (dwords << 2)) & ~0x03L); - - ((CARD32 *) infoRec->ImageWriteBase)[dwords] = - *((CARD32 *) src) >> shift; - } - } - - if (PlusOne) { - CARD32 *base = (CARD32 *) infoRec->ImageWriteBase; - - *base = 0x00000000; - } - - if (infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE) - (*infoRec->Sync) (pScrn); - else - SET_SYNC_FLAG(infoRec); -} - -void -XAAWritePixmapScanline(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, /* bytes */ - int rop, - unsigned int planemask, int trans, int bpp, int depth) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int dwords, skipleft, bufferNo = 0, Bpp = bpp >> 3; - Bool beCareful = FALSE; - CARD32 *base; - - if ((skipleft = (long) src & 0x03L)) { - if (!(infoRec->ScanlineImageWriteFlags & LEFT_EDGE_CLIPPING)) { - skipleft = 0; - beCareful = TRUE; - goto BAD_ALIGNMENT; - } - - if (Bpp == 3) - skipleft = 4 - skipleft; - else - skipleft /= Bpp; - - if ((x < skipleft) && !(infoRec->ScanlineImageWriteFlags & - LEFT_EDGE_CLIPPING_NEGATIVE_X)) { - skipleft = 0; - beCareful = TRUE; - goto BAD_ALIGNMENT; - } - - x -= skipleft; - w += skipleft; - - if (Bpp == 3) - src -= 3 * skipleft; - else - src = (unsigned char *) ((long) src & ~0x03L); - } - - BAD_ALIGNMENT: - - dwords = bytes_to_int32(w * Bpp); - - (*infoRec->SetupForScanlineImageWrite) (pScrn, rop, planemask, trans, bpp, - depth); - (*infoRec->SubsequentScanlineImageWriteRect) (pScrn, x, y, w, h, skipleft); - - if (beCareful) { - /* in cases with bad alignment we have to be careful not - to read beyond the end of the source */ - if (((x * Bpp) + (dwords << 2)) > srcwidth) - h--; - else - beCareful = FALSE; - } - - while (h--) { - base = (CARD32 *) infoRec->ScanlineImageWriteBuffers[bufferNo]; - XAAMoveDWORDS(base, (CARD32 *) src, dwords); - (*infoRec->SubsequentImageWriteScanline) (pScrn, bufferNo++); - src += srcwidth; - if (bufferNo >= infoRec->NumScanlineImageWriteBuffers) - bufferNo = 0; - } - - if (beCareful) { - int shift = ((long) src & 0x03L) << 3; - - base = (CARD32 *) infoRec->ScanlineImageWriteBuffers[bufferNo]; - if (--dwords) - XAAMoveDWORDS(base, (CARD32 *) src, dwords); - src = (unsigned char *) ((long) (src + (dwords << 2)) & ~0x03L); - - base[dwords] = *((CARD32 *) src) >> shift; - (*infoRec->SubsequentImageWriteScanline) (pScrn, bufferNo); - } - - SET_SYNC_FLAG(infoRec); -} - -void -XAAPutImage(DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, int y, int w, int h, int leftPad, int format, char *pImage) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int bpp = BitsPerPixel(depth); - Bool depthBug = FALSE; - - if (!w || !h) - return; - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - depthBug = XAA_DEPTH_BUG(pGC); - - if (((format == ZPixmap) && infoRec->WritePixmap && - ((pDraw->bitsPerPixel == bpp) || - ((pDraw->bitsPerPixel == 24) && (bpp == 32) && - (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) && - CHECK_ROP(pGC, infoRec->WritePixmapFlags) && - CHECK_ROPSRC(pGC, infoRec->WritePixmapFlags) && - CHECK_PLANEMASK(pGC, infoRec->WritePixmapFlags) && - CHECK_NO_GXCOPY(pGC, infoRec->WritePixmapFlags)) || - ((format == XYBitmap) && !depthBug && infoRec->WriteBitmap && - CHECK_ROP(pGC, infoRec->WriteBitmapFlags) && - CHECK_ROPSRC(pGC, infoRec->WriteBitmapFlags) && - CHECK_PLANEMASK(pGC, infoRec->WriteBitmapFlags) && - CHECK_COLORS(pGC, infoRec->WriteBitmapFlags) && - !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) || - ((format == XYPixmap) && !depthBug && infoRec->WriteBitmap && - CHECK_ROP(pGC, infoRec->WriteBitmapFlags) && - CHECK_ROPSRC(pGC, infoRec->WriteBitmapFlags) && - !(infoRec->WriteBitmapFlags & NO_PLANEMASK) && - !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))) { - - int MaxBoxes = RegionNumRects(pGC->pCompositeClip); - BoxPtr pbox, pClipBoxes; - int nboxes, srcx, srcy, srcwidth; - xRectangle TheRect; - - TheRect.x = pDraw->x + x; - TheRect.y = pDraw->y + y; - TheRect.width = w; - TheRect.height = h; - - if (MaxBoxes > (infoRec->PreAllocSize / sizeof(BoxRec))) { - pClipBoxes = malloc(MaxBoxes * sizeof(BoxRec)); - if (!pClipBoxes) - return; - } - else - pClipBoxes = (BoxPtr) infoRec->PreAllocMem; - - nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect); - pbox = pClipBoxes; - - if (format == XYBitmap) { - srcwidth = BitmapBytePad(leftPad + w); - while (nboxes--) { - srcx = pbox->x1 - TheRect.x + leftPad; - srcy = pbox->y1 - TheRect.y; - (*infoRec->WriteBitmap) (infoRec->pScrn, pbox->x1, pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1, - (unsigned char *) pImage + - (srcwidth * srcy) + ((srcx >> 5) << 2), - srcwidth, srcx & 31, pGC->fgPixel, - pGC->bgPixel, pGC->alu, - pGC->planemask); - pbox++; - } - } - else if (format == ZPixmap) { - int Bpp = bpp >> 3; - - srcwidth = PixmapBytePad(leftPad + w, depth); - while (nboxes--) { - srcx = pbox->x1 - TheRect.x + leftPad; - srcy = pbox->y1 - TheRect.y; - (*infoRec->WritePixmap) (infoRec->pScrn, pbox->x1, pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1, - (unsigned char *) pImage + - (srcwidth * srcy) + (srcx * Bpp), - srcwidth, pGC->alu, pGC->planemask, -1, - Bpp << 3, depth); - pbox++; - } - } - else { /* XYPixmap */ - int depth = pGC->depth; - int numBox, increment; - unsigned long i, mask; - BoxPtr pntBox; - - srcwidth = BitmapBytePad(w + leftPad); - increment = h * srcwidth; - i = 1 << (depth - 1); - mask = ~0; - - if ((infoRec->pScrn->overlayFlags & OVERLAY_8_32_PLANAR) && - (pGC->depth == 8)) { - i = 0x80000000; - mask = 0xff000000; - } - - for (; i & mask; i >>= 1, pImage += increment) { - if (i & pGC->planemask) { - pntBox = pbox; - numBox = nboxes; - while (numBox--) { - srcx = pntBox->x1 - TheRect.x + leftPad; - srcy = pntBox->y1 - TheRect.y; - (*infoRec->WriteBitmap) (infoRec->pScrn, - pntBox->x1, pntBox->y1, - pntBox->x2 - pntBox->x1, - pntBox->y2 - pntBox->y1, - (unsigned char *) pImage + - (srcwidth * srcy) + - ((srcx >> 5) << 2), srcwidth, - srcx & 31, ~0, 0, pGC->alu, i); - pntBox++; - } - } - } - - } - - if (pClipBoxes != (BoxPtr) infoRec->PreAllocMem) - free(pClipBoxes); - } - else - XAAFallbackOps.PutImage(pDraw, pGC, depth, x, y, w, h, leftPad, - format, pImage); -} diff --git a/xserver/hw/xfree86/xaa/xaaInit.c b/xserver/hw/xfree86/xaa/xaaInit.c deleted file mode 100644 index 661fa90ab..000000000 --- a/xserver/hw/xfree86/xaa/xaaInit.c +++ /dev/null @@ -1,637 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "xf86str.h" -#include "mi.h" -#include "miline.h" -#include "xaa.h" -#include "xaalocal.h" -#include "xaawrap.h" -#include "xf86fbman.h" -#include "servermd.h" -#ifdef COMPOSITE -#include "cw.h" -#endif - -#define MAX_PREALLOC_MEM 65536 /* MUST be >= 1024 */ - -#define MIN_OFFPIX_SIZE (320*200) - -static Bool XAACloseScreen(int i, ScreenPtr pScreen); -static void XAAGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, - unsigned int format, unsigned long planemask, - char *pdstLine); -static void XAAGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, - int *pwidth, int nspans, char *pdstStart); -static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, - unsigned usage_hint); -static Bool XAADestroyPixmap(PixmapPtr pPixmap); -static Bool XAAEnterVT(int index, int flags); -static void XAALeaveVT(int index, int flags); -static int XAASetDGAMode(int index, int num, DGADevicePtr devRet); -static void XAAEnableDisableFBAccess(int index, Bool enable); -static Bool XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask); - -static DevPrivateKeyRec XAAScreenKeyRec; - -#define XAAScreenKey (&XAAScreenKeyRec) -static DevPrivateKeyRec XAAGCKeyRec; - -#define XAAGCKey (&XAAGCKeyRec) -static DevPrivateKeyRec XAAPixmapKeyRec; - -#define XAAPixmapKey (&XAAPixmapKeyRec) - -DevPrivateKey -XAAGetScreenKey(void) -{ - return XAAScreenKey; -} - -DevPrivateKey -XAAGetGCKey(void) -{ - return XAAGCKey; -} - -DevPrivateKey -XAAGetPixmapKey(void) -{ - return XAAPixmapKey; -} - -/* temp kludge */ -static Bool SwitchedOut = FALSE; - -XAAInfoRecPtr -XAACreateInfoRec(void) -{ - XAAInfoRecPtr infoRec; - - infoRec = calloc(1, sizeof(XAAInfoRec)); - if (infoRec) - infoRec->CachePixelGranularity = -1; - - return infoRec; -} - -void -XAADestroyInfoRec(XAAInfoRecPtr infoRec) -{ - if (!infoRec) - return; - - if (infoRec->ClosePixmapCache) - (*infoRec->ClosePixmapCache) (infoRec->pScrn->pScreen); - - free(infoRec->PreAllocMem); - - free(infoRec->PixmapCachePrivate); - - free(infoRec); -} - -Bool -XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - XAAScreenPtr pScreenPriv; - int i; - PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); - - /* Return successfully if no acceleration wanted */ - if (!infoRec) - return TRUE; - - if (!dixRegisterPrivateKey(&XAAGCKeyRec, PRIVATE_GC, sizeof(XAAGCRec))) - return FALSE; - - if (!dixRegisterPrivateKey - (&XAAPixmapKeyRec, PRIVATE_PIXMAP, sizeof(XAAPixmapRec))) - return FALSE; - - if (!dixRegisterPrivateKey(&XAAScreenKeyRec, PRIVATE_SCREEN, 0)) - return FALSE; - - if (!(pScreenPriv = malloc(sizeof(XAAScreenRec)))) - return FALSE; - - dixSetPrivate(&pScreen->devPrivates, XAAScreenKey, pScreenPriv); - - if (!xf86FBManagerRunning(pScreen)) - infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS); - if (!(infoRec->Flags & LINEAR_FRAMEBUFFER)) - infoRec->Flags &= ~OFFSCREEN_PIXMAPS; - - if (!infoRec->FullPlanemask) { /* for backwards compatibility */ - infoRec->FullPlanemask = (1 << pScrn->depth) - 1; - infoRec->FullPlanemasks[pScrn->depth - 1] = infoRec->FullPlanemask; - } - - for (i = 0; i < 32; i++) { - if (!infoRec->FullPlanemasks[i]) /* keep any set by caller */ - infoRec->FullPlanemasks[i] = (1 << (i + 1)) - 1; - } - - if (!XAAInitAccel(pScreen, infoRec)) - return FALSE; - pScreenPriv->AccelInfoRec = infoRec; - infoRec->ScratchGC.pScreen = pScreen; - - if (!infoRec->GetImage) - infoRec->GetImage = XAAGetImage; - if (!infoRec->GetSpans) - infoRec->GetSpans = XAAGetSpans; - if (!infoRec->CopyWindow) - infoRec->CopyWindow = XAACopyWindow; - - pScreenPriv->CreateGC = pScreen->CreateGC; - pScreen->CreateGC = XAACreateGC; - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = XAACloseScreen; - pScreenPriv->GetImage = pScreen->GetImage; - pScreen->GetImage = infoRec->GetImage; - pScreenPriv->GetSpans = pScreen->GetSpans; - pScreen->GetSpans = infoRec->GetSpans; - pScreenPriv->CopyWindow = pScreen->CopyWindow; - pScreen->CopyWindow = infoRec->CopyWindow; - pScreenPriv->CreatePixmap = pScreen->CreatePixmap; - pScreen->CreatePixmap = XAACreatePixmap; - pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap; - pScreen->DestroyPixmap = XAADestroyPixmap; - pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes; - pScreen->ChangeWindowAttributes = XAAChangeWindowAttributes; - - pScreenPriv->EnterVT = pScrn->EnterVT; - pScrn->EnterVT = XAAEnterVT; - pScreenPriv->LeaveVT = pScrn->LeaveVT; - pScrn->LeaveVT = XAALeaveVT; - pScreenPriv->SetDGAMode = pScrn->SetDGAMode; - pScrn->SetDGAMode = XAASetDGAMode; - pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess; - pScrn->EnableDisableFBAccess = XAAEnableDisableFBAccess; - - pScreenPriv->WindowExposures = pScreen->WindowExposures; - if (ps) { - pScreenPriv->Composite = ps->Composite; - ps->Composite = XAAComposite; - pScreenPriv->Glyphs = ps->Glyphs; - ps->Glyphs = XAAGlyphs; - } - if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) - XAASetupOverlay8_32Planar(pScreen); - - infoRec->PreAllocMem = malloc(MAX_PREALLOC_MEM); - if (infoRec->PreAllocMem) - infoRec->PreAllocSize = MAX_PREALLOC_MEM; - - if (infoRec->Flags & PIXMAP_CACHE) - xf86RegisterFreeBoxCallback(pScreen, infoRec->InitPixmapCache, - (pointer) infoRec); - - if (infoRec->Flags & MICROSOFT_ZERO_LINE_BIAS) - miSetZeroLineBias(pScreen, OCTANT1 | OCTANT2 | OCTANT3 | OCTANT4); - -#ifdef COMPOSITE - /* Initialize the composite wrapper. This needs to happen after the - * wrapping above (so it comes before us), but before all other extensions, - * so it doesn't confuse them. (particularly damage). - */ - miInitializeCompositeWrapper(pScreen); -#endif - - return TRUE; -} - -static Bool -XAACloseScreen(int i, ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - XAAScreenPtr pScreenPriv = - (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); - - pScrn->EnterVT = pScreenPriv->EnterVT; - pScrn->LeaveVT = pScreenPriv->LeaveVT; - pScrn->EnableDisableFBAccess = pScreenPriv->EnableDisableFBAccess; - - pScreen->CreateGC = pScreenPriv->CreateGC; - pScreen->CloseScreen = pScreenPriv->CloseScreen; - pScreen->GetImage = pScreenPriv->GetImage; - pScreen->GetSpans = pScreenPriv->GetSpans; - pScreen->CopyWindow = pScreenPriv->CopyWindow; - pScreen->WindowExposures = pScreenPriv->WindowExposures; - pScreen->CreatePixmap = pScreenPriv->CreatePixmap; - pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap; - pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes; - - /* We leave it up to the client to free the XAAInfoRec */ - - free((pointer) pScreenPriv); - - return (*pScreen->CloseScreen) (i, pScreen); -} - -static void -XAAGetImage(DrawablePtr pDraw, - int sx, int sy, int w, int h, - unsigned int format, unsigned long planemask, char *pdstLine) -{ - ScreenPtr pScreen = pDraw->pScreen; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - ScrnInfoPtr pScrn = infoRec->pScrn; - - if (pScrn->vtSema && - ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw))) { - if (infoRec->ReadPixmap && (format == ZPixmap) && - ((planemask & infoRec->FullPlanemasks[pDraw->depth - 1]) == - infoRec->FullPlanemasks[pDraw->depth - 1]) && - (pDraw->bitsPerPixel == BitsPerPixel(pDraw->depth))) { - (*infoRec->ReadPixmap) (pScrn, - sx + pDraw->x, sy + pDraw->y, w, h, - (unsigned char *) pdstLine, - PixmapBytePad(w, pDraw->depth), - pDraw->bitsPerPixel, pDraw->depth); - return; - } - SYNC_CHECK(pDraw); - } - - XAA_SCREEN_PROLOGUE(pScreen, GetImage); - (*pScreen->GetImage) (pDraw, sx, sy, w, h, format, planemask, pdstLine); - XAA_SCREEN_EPILOGUE(pScreen, GetImage, XAAGetImage); -} - -static void -XAAGetSpans(DrawablePtr pDraw, - int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart) -{ - ScreenPtr pScreen = pDraw->pScreen; - - XAA_SCREEN_PROLOGUE(pScreen, GetSpans); - if (xf86Screens[pScreen->myNum]->vtSema && - ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw))) { - SYNC_CHECK(pDraw); - } - (*pScreen->GetSpans) (pDraw, wMax, ppt, pwidth, nspans, pdstStart); - XAA_SCREEN_EPILOGUE(pScreen, GetSpans, XAAGetSpans); -} - -static int -XAAPixmapBPP(ScreenPtr pScreen, int depth) -{ - PixmapPtr pPix; - int bpp; - DestroyPixmapProcPtr destroyPixmap; - - XAA_SCREEN_PROLOGUE(pScreen, CreatePixmap); - pPix = (*pScreen->CreatePixmap) (pScreen, 1, 1, depth, - CREATE_PIXMAP_USAGE_SCRATCH); - XAA_SCREEN_EPILOGUE(pScreen, CreatePixmap, XAACreatePixmap); - if (!pPix) - return 0; - bpp = pPix->drawable.bitsPerPixel; - destroyPixmap = pScreen->DestroyPixmap; - XAA_SCREEN_PROLOGUE(pScreen, DestroyPixmap); - (*pScreen->DestroyPixmap) (pPix); - XAA_SCREEN_EPILOGUE(pScreen, DestroyPixmap, destroyPixmap); - return bpp; -} - -static void -XAAInitializeOffscreenDepths(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - int d, dep; - - infoRec->offscreenDepthsInitialized = TRUE; - infoRec->offscreenDepths = 0; - if (infoRec->Flags & OFFSCREEN_PIXMAPS) { - for (d = 0; d < pScreen->numDepths; d++) { - dep = pScreen->allowedDepths[d].depth; - if (XAAPixmapBPP(pScreen, dep) == pScrn->bitsPerPixel) - infoRec->offscreenDepths |= (1 << (dep - 1)); - } - } -} - -static PixmapPtr -XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - XAAPixmapPtr pPriv; - PixmapPtr pPix = NULL; - int size = w * h; - - if (w > 32767 || h > 32767) - return NullPixmap; - - if (!infoRec->offscreenDepthsInitialized) - XAAInitializeOffscreenDepths(pScreen); - - if (pScrn->vtSema && - (usage_hint != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) && - (infoRec->offscreenDepths & (1 << (depth - 1))) && - (size >= MIN_OFFPIX_SIZE) && !SwitchedOut && - (!infoRec->maxOffPixWidth || (w <= infoRec->maxOffPixWidth)) && - (!infoRec->maxOffPixHeight || (h <= infoRec->maxOffPixHeight))) { - PixmapLinkPtr pLink; - PixmapPtr pScreenPix; - FBAreaPtr area; - int gran = 0; - - switch (pScrn->bitsPerPixel) { - case 24: - case 8: - gran = 4; - break; - case 16: - gran = 2; - break; - case 32: - gran = 1; - break; - default: - break; - } - - if (BITMAP_SCANLINE_PAD == 64) - gran *= 2; - - if (!(area = xf86AllocateOffscreenArea(pScreen, w, h, gran, 0, - XAARemoveAreaCallback, NULL))) { - goto BAILOUT; - } - - if (!(pLink = malloc(sizeof(PixmapLink)))) { - xf86FreeOffscreenArea(area); - goto BAILOUT; - } - - XAA_SCREEN_PROLOGUE(pScreen, CreatePixmap); - pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, usage_hint); - XAA_SCREEN_EPILOGUE(pScreen, CreatePixmap, XAACreatePixmap); - - if (!pPix) { - free(pLink); - xf86FreeOffscreenArea(area); - goto BAILOUT; - } - - pScreenPix = (*pScreen->GetScreenPixmap) (pScreen); - - pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); - pPix->drawable.x = area->box.x1; - pPix->drawable.y = area->box.y1; - pPix->drawable.width = w; - pPix->drawable.height = h; - pPix->drawable.bitsPerPixel = pScrn->bitsPerPixel; - pPix->devKind = pScreenPix->devKind; - pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr; - area->devPrivate.ptr = pPix; - - pPriv->flags = OFFSCREEN; - pPriv->offscreenArea = area; - pPriv->freeData = FALSE; - - pLink->next = infoRec->OffscreenPixmaps; - pLink->pPix = pPix; - infoRec->OffscreenPixmaps = pLink; - return pPix; - } - BAILOUT: - XAA_SCREEN_PROLOGUE(pScreen, CreatePixmap); - pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint); - XAA_SCREEN_EPILOGUE(pScreen, CreatePixmap, XAACreatePixmap); - - if (pPix) { - pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); - pPriv->flags = 0; - pPriv->offscreenArea = NULL; - pPriv->freeData = FALSE; - if (!w || !h) /* either scratch or shared memory */ - pPriv->flags |= SHARED_PIXMAP; - } - - return pPix; -} - -static Bool -XAADestroyPixmap(PixmapPtr pPix) -{ - ScreenPtr pScreen = pPix->drawable.pScreen; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); - Bool ret; - - if (pPix->refcnt == 1) { - if (pPriv->flags & OFFSCREEN) { - if (pPriv->flags & DGA_PIXMAP) - free(pPriv->offscreenArea); - else { - FBAreaPtr area = pPriv->offscreenArea; - PixmapLinkPtr pLink = infoRec->OffscreenPixmaps; - PixmapLinkPtr prev = NULL; - - while (pLink->pPix != pPix) { - prev = pLink; - pLink = pLink->next; - } - - if (prev) - prev->next = pLink->next; - else - infoRec->OffscreenPixmaps = pLink->next; - - if (!area) - area = pLink->area; - - xf86FreeOffscreenArea(area); - pPriv->offscreenArea = NULL; - free(pLink); - } - } - - if (pPriv->freeData) { /* pixmaps that were once in video ram */ - free(pPix->devPrivate.ptr); - pPix->devPrivate.ptr = NULL; - } - } - - XAA_SCREEN_PROLOGUE(pScreen, DestroyPixmap); - ret = (*pScreen->DestroyPixmap) (pPix); - XAA_SCREEN_EPILOGUE(pScreen, DestroyPixmap, XAADestroyPixmap); - - return ret; -} - -static Bool -XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - Bool ret; - - XAA_SCREEN_PROLOGUE(pScreen, ChangeWindowAttributes); - ret = (*pScreen->ChangeWindowAttributes) (pWin, mask); - XAA_SCREEN_EPILOGUE(pScreen, ChangeWindowAttributes, - XAAChangeWindowAttributes); - - /* we have to assume that shared memory pixmaps are dirty - because we can't wrap operations on them */ - - if ((mask & CWBackPixmap) && (pWin->backgroundState == BackgroundPixmap) && - PIXMAP_IS_SHARED(pWin->background.pixmap)) { - XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->background.pixmap); - - pPixPriv->flags |= DIRTY; - } - if ((mask & CWBorderPixmap) && !(pWin->borderIsPixel) && - PIXMAP_IS_SHARED(pWin->border.pixmap)) { - XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->border.pixmap); - - pPixPriv->flags |= DIRTY; - } - - return ret; -} - -/* These two aren't really needed for anything */ - -static Bool -XAAEnterVT(int index, int flags) -{ - ScrnInfoPtr pScrn = xf86Screens[index]; - Bool ret; - ScreenPtr pScreen = screenInfo.screens[index]; - XAAScreenPtr pScreenPriv = - (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); - - pScrn->EnterVT = pScreenPriv->EnterVT; - ret = ((*pScreenPriv->EnterVT) (index, flags)); - pScreenPriv->EnterVT = pScrn->EnterVT; - pScrn->EnterVT = XAAEnterVT; - return ret; -} - -static void -XAALeaveVT(int index, int flags) -{ - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = screenInfo.screens[index]; - XAAScreenPtr pScreenPriv = - (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); - XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec; - - if (infoRec->NeedToSync) { - (*infoRec->Sync) (infoRec->pScrn); - infoRec->NeedToSync = FALSE; - } - - pScrn->LeaveVT = pScreenPriv->LeaveVT; - (*pScreenPriv->LeaveVT) (index, flags); - pScreenPriv->LeaveVT = pScrn->LeaveVT; - pScrn->LeaveVT = XAALeaveVT; -} - -typedef struct { - Bool UsingPixmapCache; - Bool CanDoColor8x8; - Bool CanDoMono8x8; -} SavedCacheState, *SavedCacheStatePtr; - -static int -XAASetDGAMode(int index, int num, DGADevicePtr devRet) -{ - ScreenPtr pScreen = screenInfo.screens[index]; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - XAAScreenPtr pScreenPriv = - (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); - int ret; - - if (!num && infoRec->dgaSaves) { /* restore old pixmap cache state */ - SavedCacheStatePtr state = (SavedCacheStatePtr) infoRec->dgaSaves; - - infoRec->UsingPixmapCache = state->UsingPixmapCache; - infoRec->CanDoColor8x8 = state->CanDoColor8x8; - infoRec->CanDoMono8x8 = state->CanDoMono8x8; - free(infoRec->dgaSaves); - infoRec->dgaSaves = NULL; - } - - ret = (*pScreenPriv->SetDGAMode) (index, num, devRet); - if (ret != Success) - return ret; - - if (num && devRet->pPix) { /* accelerate this pixmap */ - XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(devRet->pPix); - FBAreaPtr area; - - if ((area = malloc(sizeof(FBArea)))) { - area->pScreen = pScreen; - area->box.x1 = 0; - area->box.x2 = 0; - area->box.y1 = devRet->mode->pixmapWidth; - area->box.y2 = devRet->mode->pixmapHeight; - area->granularity = 0; - area->MoveAreaCallback = 0; - area->RemoveAreaCallback = 0; - area->devPrivate.ptr = 0; - - pixPriv->flags |= OFFSCREEN | DGA_PIXMAP; - pixPriv->offscreenArea = area; - - if (!infoRec->dgaSaves) { /* save pixmap cache state */ - SavedCacheStatePtr state = malloc(sizeof(SavedCacheState)); - - state->UsingPixmapCache = infoRec->UsingPixmapCache; - state->CanDoColor8x8 = infoRec->CanDoColor8x8; - state->CanDoMono8x8 = infoRec->CanDoMono8x8; - infoRec->dgaSaves = (char *) state; - - infoRec->UsingPixmapCache = FALSE; - if (infoRec->PixmapCacheFlags & CACHE_MONO_8x8) - infoRec->CanDoMono8x8 = FALSE; - if (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8) - infoRec->CanDoColor8x8 = FALSE; - } - } - } - - return ret; -} - -static void -XAAEnableDisableFBAccess(int index, Bool enable) -{ - ScreenPtr pScreen = screenInfo.screens[index]; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - XAAScreenPtr pScreenPriv = - (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); - - if (!enable) { - if ((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps)) - XAAMoveOutOffscreenPixmaps(pScreen); - if (infoRec->Flags & PIXMAP_CACHE) - XAAInvalidatePixmapCache(pScreen); - SwitchedOut = TRUE; - } - - (*pScreenPriv->EnableDisableFBAccess) (index, enable); - - if (enable) { - if ((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps)) - XAAMoveInOffscreenPixmaps(pScreen); - SwitchedOut = FALSE; - } -} diff --git a/xserver/hw/xfree86/xaa/xaaInitAccel.c b/xserver/hw/xfree86/xaa/xaaInitAccel.c deleted file mode 100644 index 2a85a1996..000000000 --- a/xserver/hw/xfree86/xaa/xaaInitAccel.c +++ /dev/null @@ -1,1571 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <string.h> - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" -#include "xf86fbman.h" -#include "servermd.h" - -/* - * XAA Config options - */ - -typedef enum { - XAAOPT_SCREEN_TO_SCREEN_COPY, - XAAOPT_SOLID_FILL_RECT, - XAAOPT_SOLID_FILL_TRAP, - XAAOPT_SOLID_TWO_POINT_LINE, - XAAOPT_SOLID_BRESENHAM_LINE, - XAAOPT_SOLID_HORVERT_LINE, - XAAOPT_DASHED_TWO_POINT_LINE, - XAAOPT_DASHED_BRESENHAM_LINE, - XAAOPT_MONO_8x8_PATTERN_FILL_RECT, - XAAOPT_MONO_8x8_PATTERN_FILL_TRAP, - XAAOPT_COL_8x8_PATTERN_FILL_RECT, - XAAOPT_COL_8x8_PATTERN_FILL_TRAP, - XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL, - XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL, - XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL, - XAAOPT_IMAGE_WRITE_RECT, - XAAOPT_SCANLINE_IMAGE_WRITE_RECT, - XAAOPT_WRITE_BITMAP, - XAAOPT_WRITE_PIXMAP, - XAAOPT_PIXMAP_CACHE, - XAAOPT_OFFSCREEN_PIXMAPS, - XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE -} XAAOpts; - -static const OptionInfoRec XAAOptions[] = { - {XAAOPT_SCREEN_TO_SCREEN_COPY, "XaaNoScreenToScreenCopy", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_SOLID_FILL_RECT, "XaaNoSolidFillRect", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_SOLID_FILL_TRAP, "XaaNoSolidFillTrap", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_SOLID_TWO_POINT_LINE, "XaaNoSolidTwoPointLine", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_SOLID_BRESENHAM_LINE, "XaaNoSolidBresenhamLine", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_SOLID_HORVERT_LINE, "XaaNoSolidHorVertLine", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_DASHED_TWO_POINT_LINE, "XaaNoDashedTwoPointLine", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_DASHED_BRESENHAM_LINE, "XaaNoDashedBresenhamLine", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_MONO_8x8_PATTERN_FILL_RECT, "XaaNoMono8x8PatternFillRect", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_MONO_8x8_PATTERN_FILL_TRAP, "XaaNoMono8x8PatternFillTrap", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_COL_8x8_PATTERN_FILL_RECT, "XaaNoColor8x8PatternFillRect", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_COL_8x8_PATTERN_FILL_TRAP, "XaaNoColor8x8PatternFillTrap", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL, "XaaNoCPUToScreenColorExpandFill", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL, - "XaaNoScanlineCPUToScreenColorExpandFill", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL, "XaaNoScreenToScreenColorExpandFill", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_IMAGE_WRITE_RECT, "XaaNoImageWriteRect", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_SCANLINE_IMAGE_WRITE_RECT, "XaaNoScanlineImageWriteRect", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_WRITE_BITMAP, "XaaNoWriteBitmap", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_WRITE_PIXMAP, "XaaNoWritePixmap", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_PIXMAP_CACHE, "XaaNoPixmapCache", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_OFFSCREEN_PIXMAPS, "XaaNoOffscreenPixmaps", - OPTV_BOOLEAN, {0}, FALSE}, - {XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE, "XaaOffscreenPixmaps", - OPTV_BOOLEAN, {0}, FALSE}, - {-1, NULL, - OPTV_NONE, {0}, FALSE} -}; - -static XF86ModuleVersionInfo xaaVersRec = { - "xaa", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - XAA_VERSION_MAJOR, - XAA_VERSION_MINOR, - XAA_VERSION_RELEASE, - ABI_CLASS_VIDEODRV, /* requires the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0, 0, 0, 0} -}; - -_X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL }; - -Bool -XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) -{ - int index = pScreen->myNum; - ScrnInfoPtr pScrn = xf86Screens[index]; - Bool HaveScreenToScreenCopy = FALSE; - Bool HaveColorExpansion = FALSE; - Bool HaveScanlineColorExpansion = FALSE; - Bool HaveSolidFillRect = FALSE; - Bool HaveMono8x8PatternFillRect = FALSE; - Bool HaveColor8x8PatternFillRect = FALSE; - Bool HaveSolidFillTrap = FALSE; - Bool HaveMono8x8PatternFillTrap = FALSE; - Bool HaveColor8x8PatternFillTrap = FALSE; - Bool HaveSolidTwoPointLine = FALSE; - Bool HaveSolidBresenhamLine = FALSE; - Bool HaveSolidHorVertLine = FALSE; - Bool HaveDashedTwoPointLine = FALSE; - Bool HaveDashedBresenhamLine = FALSE; - Bool HaveImageWriteRect = FALSE; - Bool HaveScanlineImageWriteRect = FALSE; - Bool HaveScreenToScreenColorExpandFill = FALSE; - OptionInfoPtr options; - int is_shared = 0; - int i; - - options = xnfalloc(sizeof(XAAOptions)); - (void) memcpy(options, XAAOptions, sizeof(XAAOptions)); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); - - infoRec->pScrn = pScrn; - infoRec->NeedToSync = FALSE; - - /* must have a Sync function */ - if (!infoRec->Sync) - return FALSE; - for (i = 0; i < pScrn->numEntities; i++) { - if (xf86IsEntityShared(pScrn->entityList[i])) - is_shared = 1; - } - - /* If this PCI entity has IS_SHARED_ACCEL set in entityProp - * then a RestoreAccelState function is required - */ - if (!infoRec->RestoreAccelState && is_shared) - return FALSE; - - if (infoRec->RestoreAccelState) { - if (!XAAInitStateWrap(pScreen, infoRec)) - return FALSE; - } - - if (serverGeneration == 1) - xf86DrvMsg(index, X_INFO, - "Using XFree86 Acceleration Architecture (XAA)\n"); - - /************** Low Level *************/ - - if (!infoRec->SetClippingRectangle || !infoRec->DisableClipping) { - infoRec->ClippingFlags = 0; - infoRec->SetClippingRectangle = NULL; - infoRec->DisableClipping = NULL; - } - - /**** CopyArea ****/ - - if (infoRec->SetupForScreenToScreenCopy && - infoRec->SubsequentScreenToScreenCopy && - !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COPY, FALSE)) { - HaveScreenToScreenCopy = TRUE; - } - else { - infoRec->ScreenToScreenCopyFlags = 0; - infoRec->SetupForScreenToScreenCopy = NULL; - infoRec->SubsequentScreenToScreenCopy = NULL; - } - - /**** Solid Filled Rects ****/ - - if (infoRec->SetupForSolidFill && infoRec->SubsequentSolidFillRect && - !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_RECT, FALSE)) { - HaveSolidFillRect = TRUE; - if (infoRec->SubsequentSolidFillTrap && - !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_TRAP, FALSE)) - HaveSolidFillTrap = TRUE; - else - infoRec->SubsequentSolidFillTrap = NULL; - } - else { - infoRec->SolidFillFlags = 0; - infoRec->SetupForSolidFill = NULL; - infoRec->SubsequentSolidFillRect = NULL; - infoRec->SubsequentSolidFillTrap = NULL; - } - - /**** Solid lines ****/ - - if (infoRec->SetupForSolidLine) { - if (infoRec->SubsequentSolidTwoPointLine && - !xf86ReturnOptValBool(options, XAAOPT_SOLID_TWO_POINT_LINE, FALSE)) - HaveSolidTwoPointLine = TRUE; - if (infoRec->SubsequentSolidBresenhamLine && - !xf86ReturnOptValBool(options, XAAOPT_SOLID_BRESENHAM_LINE, - FALSE)) { - HaveSolidBresenhamLine = TRUE; - - if (infoRec->SolidBresenhamLineErrorTermBits) - infoRec->SolidBresenhamLineErrorTermBits = - ~((1 << infoRec->SolidBresenhamLineErrorTermBits) - 1); - } - - if (infoRec->SubsequentSolidHorVertLine && - !xf86ReturnOptValBool(options, XAAOPT_SOLID_HORVERT_LINE, FALSE)) - HaveSolidHorVertLine = TRUE; - else if (HaveSolidTwoPointLine) { - infoRec->SubsequentSolidHorVertLine = XAASolidHorVertLineAsTwoPoint; - HaveSolidHorVertLine = TRUE; - } - else if (HaveSolidBresenhamLine) { - infoRec->SubsequentSolidHorVertLine = - XAASolidHorVertLineAsBresenham; - HaveSolidHorVertLine = TRUE; - } - } - - /* XXX Should this also check for XAAOPT_SOLID_HORVERT_LINE? */ - if (!HaveSolidTwoPointLine && - !HaveSolidBresenhamLine && !HaveSolidHorVertLine && HaveSolidFillRect) { - infoRec->SetupForSolidLine = infoRec->SetupForSolidFill; - infoRec->SubsequentSolidHorVertLine = XAASolidHorVertLineAsRects; - infoRec->SolidLineFlags = infoRec->SolidFillFlags; - HaveSolidHorVertLine = TRUE; - } - - if (!HaveSolidTwoPointLine) - infoRec->SubsequentSolidTwoPointLine = NULL; - if (!HaveSolidBresenhamLine) - infoRec->SubsequentSolidBresenhamLine = NULL; - if (!HaveSolidHorVertLine) - infoRec->SubsequentSolidHorVertLine = NULL; - - /* Disable all if nothing left over */ - if (!HaveSolidTwoPointLine && - !HaveSolidBresenhamLine && !HaveSolidHorVertLine) { - infoRec->SolidLineFlags = 0; - infoRec->SetupForSolidLine = NULL; - } - - /**** 8x8 Mono Pattern Filled Rects ****/ - - if (infoRec->SetupForMono8x8PatternFill && - infoRec->SubsequentMono8x8PatternFillRect && - !xf86ReturnOptValBool(options, - XAAOPT_MONO_8x8_PATTERN_FILL_RECT, FALSE)) { - HaveMono8x8PatternFillRect = TRUE; - if (infoRec->SubsequentMono8x8PatternFillTrap && - !xf86ReturnOptValBool(options, - XAAOPT_MONO_8x8_PATTERN_FILL_TRAP, FALSE)) - HaveMono8x8PatternFillTrap = TRUE; - - if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) { - infoRec->CanDoMono8x8 = TRUE; - } - else { /* others require caching */ - int min_pitch; - - infoRec->PixmapCacheFlags |= CACHE_MONO_8x8; - - switch (pScrn->bitsPerPixel) { - case 32: - min_pitch = 2; - break; - case 24: - min_pitch = 3; - break; - case 16: - min_pitch = 4; - break; - default: - min_pitch = 8; - break; - } - - if (min_pitch > infoRec->MonoPatternPitch) - infoRec->MonoPatternPitch = min_pitch; - - if (infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN) { - if (!infoRec->CacheWidthMono8x8Pattern || - !infoRec->CacheHeightMono8x8Pattern) { - infoRec->CacheWidthMono8x8Pattern = - infoRec->MonoPatternPitch; - infoRec->CacheHeightMono8x8Pattern = 1; - } - } - else { - int numPerLine = 128 / infoRec->MonoPatternPitch; - - if (!infoRec->CacheWidthMono8x8Pattern || - !infoRec->CacheHeightMono8x8Pattern) { - infoRec->CacheWidthMono8x8Pattern = - numPerLine * infoRec->MonoPatternPitch; - infoRec->CacheHeightMono8x8Pattern = - (64 + numPerLine - 1) / numPerLine; - } - } - } - } - else { - infoRec->Mono8x8PatternFillFlags = 0; - infoRec->SetupForMono8x8PatternFill = NULL; - infoRec->SubsequentMono8x8PatternFillRect = NULL; - } - - /**** Dashed lines ****/ - - if (infoRec->SetupForDashedLine && infoRec->DashPatternMaxLength) { - if (infoRec->SubsequentDashedTwoPointLine && - !xf86ReturnOptValBool(options, XAAOPT_DASHED_TWO_POINT_LINE, FALSE)) - HaveDashedTwoPointLine = TRUE; - if (infoRec->SubsequentDashedBresenhamLine && - !xf86ReturnOptValBool(options, XAAOPT_DASHED_BRESENHAM_LINE, - FALSE)) { - HaveDashedBresenhamLine = TRUE; - - if (infoRec->DashedBresenhamLineErrorTermBits) - infoRec->DashedBresenhamLineErrorTermBits = - ~((1 << infoRec->DashedBresenhamLineErrorTermBits) - 1); - } - } - - if (!HaveDashedTwoPointLine) - infoRec->SubsequentDashedTwoPointLine = NULL; - if (!HaveDashedBresenhamLine) - infoRec->SubsequentDashedBresenhamLine = NULL; - - /* Disable all if nothing left over */ - if (!HaveDashedTwoPointLine && !HaveDashedBresenhamLine) { - infoRec->DashedLineFlags = 0; - infoRec->SetupForDashedLine = NULL; - } - - /**** 8x8 Color Pattern Filled Rects ****/ - - if (infoRec->SetupForColor8x8PatternFill && - infoRec->SubsequentColor8x8PatternFillRect && - !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT, - FALSE)) { - HaveColor8x8PatternFillRect = TRUE; - if (infoRec->SubsequentColor8x8PatternFillTrap && - !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP, - FALSE)) - HaveColor8x8PatternFillTrap = TRUE; - else - infoRec->SubsequentColor8x8PatternFillTrap = NULL; - - infoRec->PixmapCacheFlags |= CACHE_COLOR_8x8; - - if (infoRec->Color8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN) { - if (!infoRec->CacheWidthColor8x8Pattern || - !infoRec->CacheHeightColor8x8Pattern) { - infoRec->CacheWidthColor8x8Pattern = 64; - infoRec->CacheHeightColor8x8Pattern = 1; - } - } - else { - if (!infoRec->CacheWidthColor8x8Pattern || - !infoRec->CacheHeightColor8x8Pattern) { - infoRec->CacheWidthColor8x8Pattern = 128; - infoRec->CacheHeightColor8x8Pattern = 8; - } - } - } - else { - infoRec->Color8x8PatternFillFlags = 0; - infoRec->SetupForColor8x8PatternFill = NULL; - infoRec->SubsequentColor8x8PatternFillRect = NULL; - infoRec->SubsequentColor8x8PatternFillTrap = NULL; - } - - /**** Color Expansion ****/ - - if (infoRec->SetupForCPUToScreenColorExpandFill && - infoRec->ColorExpandBase && - infoRec->SubsequentCPUToScreenColorExpandFill && - !xf86ReturnOptValBool(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL, - FALSE)) { - int dwordsNeeded = pScrn->virtualX; - - infoRec->ColorExpandRange >>= 2; /* convert to DWORDS */ - HaveColorExpansion = TRUE; - - if (infoRec->CPUToScreenColorExpandFillFlags & - LEFT_EDGE_CLIPPING_NEGATIVE_X) - dwordsNeeded += 31; - dwordsNeeded = (dwordsNeeded + 31) >> 5; - if (dwordsNeeded > infoRec->ColorExpandRange) - infoRec->CPUToScreenColorExpandFillFlags |= CPU_TRANSFER_BASE_FIXED; - } - else { - infoRec->CPUToScreenColorExpandFillFlags = 0; - infoRec->SetupForCPUToScreenColorExpandFill = NULL; - infoRec->SubsequentCPUToScreenColorExpandFill = NULL; - } - - /**** Scanline Color Expansion ****/ - - if (infoRec->SetupForScanlineCPUToScreenColorExpandFill && - infoRec->SubsequentScanlineCPUToScreenColorExpandFill && - infoRec->SubsequentColorExpandScanline && - infoRec->ScanlineColorExpandBuffers && - (infoRec->NumScanlineColorExpandBuffers > 0) && - !xf86ReturnOptValBool(options, - XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL, - FALSE)) { - HaveScanlineColorExpansion = TRUE; - } - else { - infoRec->ScanlineCPUToScreenColorExpandFillFlags = 0; - infoRec->SetupForScanlineCPUToScreenColorExpandFill = NULL; - infoRec->SubsequentScanlineCPUToScreenColorExpandFill = NULL; - infoRec->SubsequentColorExpandScanline = NULL; - } - - /**** Screen to Screen Color Expansion ****/ - - if (infoRec->SetupForScreenToScreenColorExpandFill && - infoRec->SubsequentScreenToScreenColorExpandFill && - !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL, - FALSE)) { - HaveScreenToScreenColorExpandFill = TRUE; - if (!infoRec->CacheColorExpandDensity) - infoRec->CacheColorExpandDensity = 1; - } - else { - infoRec->ScreenToScreenColorExpandFillFlags = 0; - infoRec->SetupForScreenToScreenColorExpandFill = NULL; - infoRec->SubsequentScreenToScreenColorExpandFill = NULL; - } - - /**** Image Writes ****/ - - if (infoRec->SetupForImageWrite && infoRec->ImageWriteBase && - infoRec->SubsequentImageWriteRect && - !xf86ReturnOptValBool(options, XAAOPT_IMAGE_WRITE_RECT, FALSE)) { - - infoRec->ImageWriteRange >>= 2; /* convert to DWORDS */ - if (infoRec->ImageWriteFlags & CPU_TRANSFER_BASE_FIXED) - infoRec->ImageWriteRange = 0; - HaveImageWriteRect = TRUE; - } - else { - infoRec->ImageWriteFlags = 0; - infoRec->SetupForImageWrite = NULL; - infoRec->SubsequentImageWriteRect = NULL; - } - - /**** Scanline Image Writes ****/ - - if (infoRec->SetupForScanlineImageWrite && - infoRec->SubsequentScanlineImageWriteRect && - infoRec->SubsequentImageWriteScanline && - infoRec->ScanlineImageWriteBuffers && - (infoRec->NumScanlineImageWriteBuffers > 0) && - !xf86ReturnOptValBool(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT, - FALSE)) { - HaveScanlineImageWriteRect = TRUE; - } - else { - infoRec->ScanlineImageWriteFlags = 0; - infoRec->SetupForScanlineImageWrite = NULL; - infoRec->SubsequentScanlineImageWriteRect = NULL; - infoRec->SubsequentImageWriteScanline = NULL; - } - -#ifndef __i386__ - /* XAA makes some unaligned accesses when clipping is not available */ -#define CLIP_FLAGS (LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X) - if (HaveImageWriteRect && - ((infoRec->ImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS)) { - HaveImageWriteRect = FALSE; - } - if (HaveScanlineImageWriteRect && - ((infoRec->ScanlineImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS)) { - HaveScanlineImageWriteRect = FALSE; - } -#endif - - if (serverGeneration == 1) { - if (HaveScreenToScreenCopy) - xf86ErrorF("\tScreen to screen bit blits\n"); - if (HaveSolidFillRect) - xf86ErrorF("\tSolid filled rectangles\n"); - if (HaveSolidFillTrap) - xf86ErrorF("\tSolid filled trapezoids\n"); - if (HaveMono8x8PatternFillRect) - xf86ErrorF("\t8x8 mono pattern filled rectangles\n"); - if (HaveMono8x8PatternFillTrap) - xf86ErrorF("\t8x8 mono pattern filled trapezoids\n"); - if (HaveColor8x8PatternFillRect) - xf86ErrorF("\t8x8 color pattern filled rectangles\n"); - if (HaveColor8x8PatternFillTrap) - xf86ErrorF("\t8x8 color pattern filled trapezoids\n"); - - if (HaveColorExpansion) - xf86ErrorF("\tCPU to Screen color expansion\n"); - else if (HaveScanlineColorExpansion) - xf86ErrorF("\tIndirect CPU to Screen color expansion\n"); - - if (HaveScreenToScreenColorExpandFill) - xf86ErrorF("\tScreen to Screen color expansion\n"); - - if (HaveSolidTwoPointLine || HaveSolidBresenhamLine) - xf86ErrorF("\tSolid Lines\n"); - else if (HaveSolidHorVertLine) - xf86ErrorF("\tSolid Horizontal and Vertical Lines\n"); - - if (HaveDashedTwoPointLine || HaveDashedBresenhamLine) - xf86ErrorF("\tDashed Lines\n"); - - if (HaveImageWriteRect) - xf86ErrorF("\tImage Writes\n"); - else if (HaveScanlineImageWriteRect) - xf86ErrorF("\tScanline Image Writes\n"); - - } - -#define XAAMSG(s) do { if (serverGeneration == 1) xf86ErrorF(s); } while (0) - - if ((infoRec->Flags & OFFSCREEN_PIXMAPS) && HaveScreenToScreenCopy && - xf86ReturnOptValBool(options, - XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE, FALSE)) { - XAAMSG("\tOffscreen Pixmaps\n"); - } - else { - infoRec->Flags &= ~OFFSCREEN_PIXMAPS; - } - - /************** Mid Level *************/ - - /**** ScreenToScreenBitBlt ****/ - - if (infoRec->ScreenToScreenBitBlt) { - XAAMSG("\tDriver provided ScreenToScreenBitBlt replacement\n"); - } - else if (HaveScreenToScreenCopy) { - infoRec->ScreenToScreenBitBlt = XAAScreenToScreenBitBlt; - infoRec->ScreenToScreenBitBltFlags = infoRec->ScreenToScreenCopyFlags; - } - - /**** FillSolidRects ****/ - - if (infoRec->FillSolidRects) { - XAAMSG("\tDriver provided FillSolidRects replacement\n"); - } - else if (HaveSolidFillRect) { - infoRec->FillSolidRects = XAAFillSolidRects; - infoRec->FillSolidRectsFlags = infoRec->SolidFillFlags; - } - - /**** FillSolidSpans ****/ - - if (infoRec->FillSolidSpans) { - XAAMSG("\tDriver provided FillSolidSpans replacement\n"); - } - else if (HaveSolidFillRect) { - infoRec->FillSolidSpans = XAAFillSolidSpans; - infoRec->FillSolidSpansFlags = infoRec->SolidFillFlags; - } - - /**** FillMono8x8PatternRects ****/ - - if (infoRec->FillMono8x8PatternRects) { - XAAMSG("\tDriver provided FillMono8x8PatternRects replacement\n"); - } - else if (HaveMono8x8PatternFillRect) { - infoRec->FillMono8x8PatternRects = - (infoRec-> - Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ? - XAAFillMono8x8PatternRectsScreenOrigin : XAAFillMono8x8PatternRects; - - infoRec->FillMono8x8PatternRectsFlags = - infoRec->Mono8x8PatternFillFlags; - } - - /**** FillMono8x8PatternSpans ****/ - - if (infoRec->FillMono8x8PatternSpans) { - XAAMSG("\tDriver provided FillMono8x8PatternSpans replacement\n"); - } - else if (HaveMono8x8PatternFillRect) { - infoRec->FillMono8x8PatternSpans = - (infoRec-> - Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ? - XAAFillMono8x8PatternSpansScreenOrigin : XAAFillMono8x8PatternSpans; - - infoRec->FillMono8x8PatternSpansFlags = - infoRec->Mono8x8PatternFillFlags; - } - - /**** FillColor8x8Rects ****/ - - if (infoRec->FillColor8x8PatternRects) { - XAAMSG("\tDriver provided FillColor8x8PatternRects replacement\n"); - } - else if (HaveColor8x8PatternFillRect) { - infoRec->FillColor8x8PatternRects = - (infoRec-> - Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ? - XAAFillColor8x8PatternRectsScreenOrigin : - XAAFillColor8x8PatternRects; - - infoRec->FillColor8x8PatternRectsFlags = - infoRec->Color8x8PatternFillFlags; - } - - /**** FillColor8x8Spans ****/ - - if (infoRec->FillColor8x8PatternSpans) { - XAAMSG("\tDriver provided FillColor8x8PatternSpans replacement\n"); - } - else if (HaveColor8x8PatternFillRect) { - infoRec->FillColor8x8PatternSpans = - (infoRec-> - Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ? - XAAFillColor8x8PatternSpansScreenOrigin : - XAAFillColor8x8PatternSpans; - - infoRec->FillColor8x8PatternSpansFlags = - infoRec->Color8x8PatternFillFlags; - } - - /**** FillCacheBltRects ****/ - - if (infoRec->FillCacheBltRects) { - XAAMSG("\tDriver provided FillCacheBltRects replacement\n"); - } - else if (HaveScreenToScreenCopy) { - infoRec->FillCacheBltRects = XAAFillCacheBltRects; - infoRec->FillCacheBltRectsFlags = infoRec->ScreenToScreenCopyFlags; - } - - /**** FillCacheBltSpans ****/ - - if (infoRec->FillCacheBltSpans) { - XAAMSG("\tDriver provided FillCacheBltSpans replacement\n"); - } - else if (HaveScreenToScreenCopy) { - infoRec->FillCacheBltSpans = XAAFillCacheBltSpans; - infoRec->FillCacheBltSpansFlags = infoRec->ScreenToScreenCopyFlags; - } - - /**** FillCacheExpandRects ****/ - - if (infoRec->FillCacheExpandRects) { - XAAMSG("\tDriver provided FillCacheExpandRects replacement\n"); - } - else if (HaveScreenToScreenColorExpandFill) { - infoRec->FillCacheExpandRects = XAAFillCacheExpandRects; - infoRec->FillCacheExpandRectsFlags = - infoRec->ScreenToScreenColorExpandFillFlags; - } - - /**** FillCacheExpandSpans ****/ - - if (infoRec->FillCacheExpandSpans) { - XAAMSG("\tDriver provided FillCacheExpandSpans replacement\n"); - } - else if (HaveScreenToScreenColorExpandFill) { - infoRec->FillCacheExpandSpans = XAAFillCacheExpandSpans; - infoRec->FillCacheExpandSpansFlags = - infoRec->ScreenToScreenColorExpandFillFlags; - } - - /**** FillColorExpandRects ****/ - - if (infoRec->FillColorExpandRects) { - XAAMSG("\tDriver provided FillColorExpandRects replacement\n"); - } - else if (HaveColorExpansion) { - if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) { - if (infoRec->CPUToScreenColorExpandFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST) { - if (infoRec->CPUToScreenColorExpandFillFlags & - CPU_TRANSFER_BASE_FIXED) - infoRec->FillColorExpandRects = - XAAFillColorExpandRects3MSBFirstFixedBase; - else - infoRec->FillColorExpandRects = - XAAFillColorExpandRects3MSBFirst; - } - else { - if (infoRec->CPUToScreenColorExpandFillFlags & - CPU_TRANSFER_BASE_FIXED) - infoRec->FillColorExpandRects = - XAAFillColorExpandRects3LSBFirstFixedBase; - else - infoRec->FillColorExpandRects = - XAAFillColorExpandRects3LSBFirst; - } - } - else { - if (infoRec->CPUToScreenColorExpandFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST) { - if (infoRec->CPUToScreenColorExpandFillFlags & - CPU_TRANSFER_BASE_FIXED) - infoRec->FillColorExpandRects = - XAAFillColorExpandRectsMSBFirstFixedBase; - else - infoRec->FillColorExpandRects = - XAAFillColorExpandRectsMSBFirst; - } - else { - if (infoRec->CPUToScreenColorExpandFillFlags & - CPU_TRANSFER_BASE_FIXED) - infoRec->FillColorExpandRects = - XAAFillColorExpandRectsLSBFirstFixedBase; - else - infoRec->FillColorExpandRects = - XAAFillColorExpandRectsLSBFirst; - } - } - infoRec->FillColorExpandRectsFlags = - infoRec->CPUToScreenColorExpandFillFlags; - } - else if (HaveScanlineColorExpansion) { - if (infoRec->ScanlineCPUToScreenColorExpandFillFlags & - TRIPLE_BITS_24BPP) { - if (infoRec->ScanlineCPUToScreenColorExpandFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST) - infoRec->FillColorExpandRects = - XAAFillScanlineColorExpandRects3MSBFirst; - else - infoRec->FillColorExpandRects = - XAAFillScanlineColorExpandRects3LSBFirst; - } - else { - if (infoRec->ScanlineCPUToScreenColorExpandFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST) - infoRec->FillColorExpandRects = - XAAFillScanlineColorExpandRectsMSBFirst; - else - infoRec->FillColorExpandRects = - XAAFillScanlineColorExpandRectsLSBFirst; - } - infoRec->FillColorExpandRectsFlags = - infoRec->ScanlineCPUToScreenColorExpandFillFlags; - } - - /**** FillColorExpandSpans ****/ - - if (infoRec->FillColorExpandSpans) { - XAAMSG("\tDriver provided FillColorExpandSpans replacement\n"); - } - else if (HaveColorExpansion) { - if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) { - if (infoRec->CPUToScreenColorExpandFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST) { - if (infoRec->CPUToScreenColorExpandFillFlags & - CPU_TRANSFER_BASE_FIXED) - infoRec->FillColorExpandSpans = - XAAFillColorExpandSpans3MSBFirstFixedBase; - else - infoRec->FillColorExpandSpans = - XAAFillColorExpandSpans3MSBFirst; - } - else { - if (infoRec->CPUToScreenColorExpandFillFlags & - CPU_TRANSFER_BASE_FIXED) - infoRec->FillColorExpandSpans = - XAAFillColorExpandSpans3LSBFirstFixedBase; - else - infoRec->FillColorExpandSpans = - XAAFillColorExpandSpans3LSBFirst; - } - } - else { - if (infoRec->CPUToScreenColorExpandFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST) { - if (infoRec->CPUToScreenColorExpandFillFlags & - CPU_TRANSFER_BASE_FIXED) - infoRec->FillColorExpandSpans = - XAAFillColorExpandSpansMSBFirstFixedBase; - else - infoRec->FillColorExpandSpans = - XAAFillColorExpandSpansMSBFirst; - } - else { - if (infoRec->CPUToScreenColorExpandFillFlags & - CPU_TRANSFER_BASE_FIXED) - infoRec->FillColorExpandSpans = - XAAFillColorExpandSpansLSBFirstFixedBase; - else - infoRec->FillColorExpandSpans = - XAAFillColorExpandSpansLSBFirst; - } - } - infoRec->FillColorExpandSpansFlags = - infoRec->CPUToScreenColorExpandFillFlags; - } - else if (HaveScanlineColorExpansion) { - if (infoRec->ScanlineCPUToScreenColorExpandFillFlags & - TRIPLE_BITS_24BPP) { - if (infoRec->ScanlineCPUToScreenColorExpandFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST) - infoRec->FillColorExpandSpans = - XAAFillScanlineColorExpandSpans3MSBFirst; - else - infoRec->FillColorExpandSpans = - XAAFillScanlineColorExpandSpans3LSBFirst; - } - else { - if (infoRec->ScanlineCPUToScreenColorExpandFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST) - infoRec->FillColorExpandSpans = - XAAFillScanlineColorExpandSpansMSBFirst; - else - infoRec->FillColorExpandSpans = - XAAFillScanlineColorExpandSpansLSBFirst; - } - infoRec->FillColorExpandSpansFlags = - infoRec->ScanlineCPUToScreenColorExpandFillFlags; - } - - /**** FillImageWriteRects ****/ - - if (infoRec->FillImageWriteRects) { - XAAMSG("\tDriver provided FillImageWriteRects replacement\n"); - } - else if (HaveImageWriteRect && - (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) && - (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) { - infoRec->FillImageWriteRects = XAAFillImageWriteRects; - infoRec->FillImageWriteRectsFlags = infoRec->ImageWriteFlags; - } - - /**** WriteBitmap ****/ - - if (infoRec->WriteBitmap && - !xf86ReturnOptValBool(options, XAAOPT_WRITE_BITMAP, FALSE)) { - XAAMSG("\tDriver provided WriteBitmap replacement\n"); - } - else if (HaveColorExpansion) { - if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) { - if (infoRec->CPUToScreenColorExpandFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST) { - if (infoRec->CPUToScreenColorExpandFillFlags & - CPU_TRANSFER_BASE_FIXED) - infoRec->WriteBitmap = - XAAWriteBitmapColorExpand3MSBFirstFixedBase; - else - infoRec->WriteBitmap = XAAWriteBitmapColorExpand3MSBFirst; - } - else { - if (infoRec->CPUToScreenColorExpandFillFlags & - CPU_TRANSFER_BASE_FIXED) - infoRec->WriteBitmap = - XAAWriteBitmapColorExpand3LSBFirstFixedBase; - else - infoRec->WriteBitmap = XAAWriteBitmapColorExpand3LSBFirst; - } - } - else { - if (infoRec->CPUToScreenColorExpandFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST) { - if (infoRec->CPUToScreenColorExpandFillFlags & - CPU_TRANSFER_BASE_FIXED) - infoRec->WriteBitmap = - XAAWriteBitmapColorExpandMSBFirstFixedBase; - else - infoRec->WriteBitmap = XAAWriteBitmapColorExpandMSBFirst; - } - else { - if (infoRec->CPUToScreenColorExpandFillFlags & - CPU_TRANSFER_BASE_FIXED) - infoRec->WriteBitmap = - XAAWriteBitmapColorExpandLSBFirstFixedBase; - else - infoRec->WriteBitmap = XAAWriteBitmapColorExpandLSBFirst; - } - } - infoRec->WriteBitmapFlags = infoRec->CPUToScreenColorExpandFillFlags; - } - else if (HaveScanlineColorExpansion) { - if (infoRec->ScanlineCPUToScreenColorExpandFillFlags & - TRIPLE_BITS_24BPP) { - if (infoRec->ScanlineCPUToScreenColorExpandFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST) - infoRec->WriteBitmap = - XAAWriteBitmapScanlineColorExpand3MSBFirst; - else - infoRec->WriteBitmap = - XAAWriteBitmapScanlineColorExpand3LSBFirst; - } - else { - if (infoRec->ScanlineCPUToScreenColorExpandFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST) - infoRec->WriteBitmap = - XAAWriteBitmapScanlineColorExpandMSBFirst; - else - infoRec->WriteBitmap = - XAAWriteBitmapScanlineColorExpandLSBFirst; - } - infoRec->WriteBitmapFlags = - infoRec->ScanlineCPUToScreenColorExpandFillFlags; - } - else - infoRec->WriteBitmap = NULL; - - /**** TE Glyphs ****/ - - if (infoRec->TEGlyphRenderer) { - XAAMSG("\tDriver provided TEGlyphRenderer replacement\n"); - } - else if (HaveColorExpansion) { - infoRec->TEGlyphRendererFlags = - infoRec->CPUToScreenColorExpandFillFlags; - - if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) { - if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) { - if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED) - infoRec->TEGlyphRenderer = - XAATEGlyphRenderer3MSBFirstFixedBase; - else - infoRec->TEGlyphRenderer = XAATEGlyphRenderer3MSBFirst; - } - else { - if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED) - infoRec->TEGlyphRenderer = - XAATEGlyphRenderer3LSBFirstFixedBase; - else - infoRec->TEGlyphRenderer = XAATEGlyphRenderer3LSBFirst; - } - - if (!HaveSolidFillRect && - (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) { - infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL; - XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL" - " without solid fills\n"); - } - } - else { - if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) { - if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED) - infoRec->TEGlyphRenderer = - XAATEGlyphRendererMSBFirstFixedBase; - else - infoRec->TEGlyphRenderer = XAATEGlyphRendererMSBFirst; - } - else { - if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED) - infoRec->TEGlyphRenderer = - XAATEGlyphRendererLSBFirstFixedBase; - else - infoRec->TEGlyphRenderer = XAATEGlyphRendererLSBFirst; - } - } - - if (!HaveSolidFillRect && - (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) { - infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY; - XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY" - " without solid fills\n"); - } - - } - else if (HaveScanlineColorExpansion) { - infoRec->TEGlyphRendererFlags = - infoRec->ScanlineCPUToScreenColorExpandFillFlags; - - if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) { - if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) - infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3MSBFirst; - else - infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3LSBFirst; - - if (!HaveSolidFillRect && - (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) { - infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL; - XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL" - " without solid fills\n"); - } - } - else { - if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) - infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineMSBFirst; - else - infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineLSBFirst; - } - - if (!HaveSolidFillRect && - (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) { - infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY; - XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY" - " without solid fills\n"); - } - } - - /**** NonTE Glyphs ****/ - - if (infoRec->NonTEGlyphRenderer) { - XAAMSG("\tDriver provided NonTEGlyphRenderer replacement\n"); - } - else if (infoRec->WriteBitmap && - !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) { - infoRec->NonTEGlyphRenderer = XAANonTEGlyphRenderer; - infoRec->NonTEGlyphRendererFlags = infoRec->WriteBitmapFlags; - } - - /**** WritePixmap ****/ - - if (infoRec->WritePixmap && - !xf86ReturnOptValBool(options, XAAOPT_WRITE_PIXMAP, FALSE)) { - XAAMSG("\tDriver provided WritePixmap replacement\n"); - } - else if (HaveImageWriteRect) { - infoRec->WritePixmap = XAAWritePixmap; - infoRec->WritePixmapFlags = - infoRec->ImageWriteFlags | CONVERT_32BPP_TO_24BPP; - } - else if (HaveScanlineImageWriteRect) { - infoRec->WritePixmap = XAAWritePixmapScanline; - infoRec->WritePixmapFlags = infoRec->ScanlineImageWriteFlags; - } - else - infoRec->WritePixmap = NULL; - - /**** ReadPixmap ****/ - - if (infoRec->ReadPixmap) { - XAAMSG("\tDriver provided ReadPixmap replacement\n"); - } - - /************** GC Level *************/ - - /**** CopyArea ****/ - - if (infoRec->CopyArea) { - XAAMSG("\tDriver provided GC level CopyArea replacement\n"); - } - else if (infoRec->ScreenToScreenBitBlt) { - infoRec->CopyArea = XAACopyArea; - infoRec->CopyAreaFlags = infoRec->ScreenToScreenBitBltFlags; - - /* most GC level primitives use one mid-level primitive so - the GC level primitive gets the mid-level primitive flag - and we use that at GC validation time. But CopyArea uses - more than one mid-level primitive so we have to essentially - do a GC validation every time that primitive is used. - The CopyAreaFlags would only be used for filtering out the - common denominators. Here we assume that if you don't do - ScreenToScreenBitBlt you aren't going to do the others. - We also assume that ScreenToScreenBitBlt has the least - restrictions. */ - } - - if (infoRec->CopyPlane) { - XAAMSG("\tDriver provided GC level CopyPlane replacement\n"); - } - else if (infoRec->WriteBitmap && - !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) { - infoRec->CopyPlane = XAACopyPlaneColorExpansion; - infoRec->CopyPlaneFlags = infoRec->WriteBitmapFlags; - } - - if (infoRec->PushPixelsSolid) { - XAAMSG("\tDriver provided GC level PushPixelsSolid replacement\n"); - } - else if (infoRec->WriteBitmap && - !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) { - infoRec->PushPixelsSolid = XAAPushPixelsSolidColorExpansion; - infoRec->PushPixelsFlags = infoRec->WriteBitmapFlags; - } - - if (infoRec->FillSolidRects) { - if (!infoRec->PolyFillRectSolid) { - infoRec->PolyFillRectSolid = XAAPolyFillRect; - infoRec->PolyFillRectSolidFlags = infoRec->FillSolidRectsFlags; - } - } - if (infoRec->FillSolidSpans) { - if (!infoRec->FillSpansSolid) { - infoRec->FillSpansSolid = XAAFillSpans; - infoRec->FillSpansSolidFlags = infoRec->FillSolidSpansFlags; - } - } - - if (infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects || - infoRec->FillCacheBltRects || infoRec->FillColorExpandRects || - infoRec->FillCacheExpandRects) { - if (!infoRec->PolyFillRectStippled) { - - infoRec->PolyFillRectStippled = XAAPolyFillRect; - infoRec->PolyFillRectStippledFlags = 0; - } - } - - if (infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans || - infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans || - infoRec->FillCacheExpandSpans) { - if (!infoRec->FillSpansStippled) { - - infoRec->FillSpansStippled = XAAFillSpans; - infoRec->FillSpansStippledFlags = 0; - } - } - - if (infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects || - infoRec->FillCacheBltRects || infoRec->FillColorExpandRects || - infoRec->FillCacheExpandRects) { - if (!infoRec->PolyFillRectOpaqueStippled) { - - infoRec->PolyFillRectOpaqueStippled = XAAPolyFillRect; - infoRec->PolyFillRectOpaqueStippledFlags = 0; - } - } - - if (infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans || - infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans || - infoRec->FillCacheExpandSpans) { - if (!infoRec->FillSpansOpaqueStippled) { - - infoRec->FillSpansOpaqueStippled = XAAFillSpans; - infoRec->FillSpansOpaqueStippledFlags = 0; - } - } - - if (infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects || - infoRec->FillCacheBltRects || infoRec->FillImageWriteRects) { - if (!infoRec->PolyFillRectTiled) { - - infoRec->PolyFillRectTiled = XAAPolyFillRect; - infoRec->PolyFillRectTiledFlags = 0; - } - } - - if (infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans || - infoRec->FillCacheBltSpans) { - if (!infoRec->FillSpansTiled) { - - infoRec->FillSpansTiled = XAAFillSpans; - infoRec->FillSpansTiledFlags = 0; - } - } - - if (infoRec->TEGlyphRenderer && - !(infoRec->TEGlyphRendererFlags & NO_TRANSPARENCY)) { - - if (!infoRec->PolyText8TE) { - infoRec->PolyText8TE = XAAPolyText8TEColorExpansion; - infoRec->PolyText8TEFlags = infoRec->TEGlyphRendererFlags; - } - - if (!infoRec->PolyText16TE) { - infoRec->PolyText16TE = XAAPolyText16TEColorExpansion; - infoRec->PolyText16TEFlags = infoRec->TEGlyphRendererFlags; - } - - if (!infoRec->PolyGlyphBltTE) { - infoRec->PolyGlyphBltTE = XAAPolyGlyphBltTEColorExpansion; - infoRec->PolyGlyphBltTEFlags = infoRec->TEGlyphRendererFlags; - } - } - - if (infoRec->TEGlyphRenderer && - !(infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) { - - if (!infoRec->ImageText8TE) { - infoRec->ImageText8TE = XAAImageText8TEColorExpansion; - infoRec->ImageText8TEFlags = infoRec->TEGlyphRendererFlags; - } - - if (!infoRec->ImageText16TE) { - infoRec->ImageText16TE = XAAImageText16TEColorExpansion; - infoRec->ImageText16TEFlags = infoRec->TEGlyphRendererFlags; - } - - if (!infoRec->ImageGlyphBltTE) { - infoRec->ImageGlyphBltTE = XAAImageGlyphBltTEColorExpansion; - infoRec->ImageGlyphBltTEFlags = infoRec->TEGlyphRendererFlags; - } - } - - if (infoRec->NonTEGlyphRenderer) { - if (!infoRec->PolyText8NonTE) { - infoRec->PolyText8NonTE = XAAPolyText8NonTEColorExpansion; - infoRec->PolyText8NonTEFlags = infoRec->NonTEGlyphRendererFlags; - } - - if (!infoRec->PolyText16NonTE) { - infoRec->PolyText16NonTE = XAAPolyText16NonTEColorExpansion; - infoRec->PolyText16NonTEFlags = infoRec->NonTEGlyphRendererFlags; - } - if (!infoRec->PolyGlyphBltNonTE) { - infoRec->PolyGlyphBltNonTE = XAAPolyGlyphBltNonTEColorExpansion; - infoRec->PolyGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags; - } - } - - if (infoRec->NonTEGlyphRenderer && HaveSolidFillRect) { - if (!infoRec->ImageText8NonTE) { - infoRec->ImageText8NonTE = XAAImageText8NonTEColorExpansion; - infoRec->ImageText8NonTEFlags = infoRec->NonTEGlyphRendererFlags; - } - - if (!infoRec->ImageText16NonTE) { - infoRec->ImageText16NonTE = XAAImageText16NonTEColorExpansion; - infoRec->ImageText16NonTEFlags = infoRec->NonTEGlyphRendererFlags; - } - - if (!infoRec->ImageGlyphBltNonTE) { - infoRec->ImageGlyphBltNonTE = XAAImageGlyphBltNonTEColorExpansion; - infoRec->ImageGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags; - } - } - - if (!infoRec->PolyRectangleThinSolid && HaveSolidHorVertLine) { - infoRec->PolyRectangleThinSolid = XAAPolyRectangleThinSolid; - infoRec->PolyRectangleThinSolidFlags = infoRec->SolidLineFlags; - } - - if (!infoRec->FillPolygonSolid && HaveSolidFillRect) { - infoRec->FillPolygonSolid = XAAFillPolygonSolid; - infoRec->FillPolygonSolidFlags = infoRec->SolidFillFlags; - } - - if (!infoRec->FillPolygonStippled && (HaveMono8x8PatternFillRect || - HaveScreenToScreenColorExpandFill || - HaveScreenToScreenCopy)) { - infoRec->FillPolygonStippled = XAAFillPolygonStippled; - infoRec->FillPolygonStippledFlags = infoRec->SolidFillFlags; - } - - if (!infoRec->FillPolygonOpaqueStippled && (HaveMono8x8PatternFillRect || - HaveScreenToScreenColorExpandFill - || HaveScreenToScreenCopy)) { - infoRec->FillPolygonOpaqueStippled = XAAFillPolygonStippled; - infoRec->FillPolygonOpaqueStippledFlags = infoRec->SolidFillFlags; - } - - if (!infoRec->FillPolygonTiled && (HaveMono8x8PatternFillRect || - HaveScreenToScreenColorExpandFill || - HaveScreenToScreenCopy)) { - infoRec->FillPolygonTiled = XAAFillPolygonTiled; - infoRec->FillPolygonTiledFlags = infoRec->SolidFillFlags; - } - - if (!infoRec->PolyFillArcSolid && HaveSolidFillRect) { - infoRec->PolyFillArcSolid = XAAPolyFillArcSolid; - infoRec->PolyFillArcSolidFlags = infoRec->SolidFillFlags; - } - - if (!infoRec->PolylinesWideSolid && HaveSolidFillRect) { - infoRec->PolylinesWideSolid = XAAPolylinesWideSolid; - infoRec->PolylinesWideSolidFlags = - infoRec->SolidFillFlags | GXCOPY_ONLY; - } - - if (!infoRec->PutImage && (infoRec->WritePixmap || - (infoRec->WriteBitmap && - !(infoRec-> - WriteBitmapFlags & TRANSPARENCY_ONLY)))) { - infoRec->PutImage = XAAPutImage; - - /* See comment for CopyArea above. But here we make fewer - assumptions. The driver can provide the PutImageFlags if - it wants too */ - } - - if (HaveSolidHorVertLine && - (HaveSolidBresenhamLine || (HaveSolidTwoPointLine && - (infoRec-> - ClippingFlags & - HARDWARE_CLIP_SOLID_LINE)))) { - if (!infoRec->PolylinesThinSolid) { - infoRec->PolylinesThinSolid = XAAPolyLines; - infoRec->PolylinesThinSolidFlags = infoRec->SolidLineFlags; - } - if (!infoRec->PolySegmentThinSolid) { - infoRec->PolySegmentThinSolid = XAAPolySegment; - infoRec->PolySegmentThinSolidFlags = infoRec->SolidLineFlags; - } - } - - if (HaveDashedBresenhamLine || (HaveDashedTwoPointLine && - (infoRec-> - ClippingFlags & - HARDWARE_CLIP_DASHED_LINE))) { - if (!infoRec->PolylinesThinDashed) { - infoRec->PolylinesThinDashed = XAAPolyLinesDashed; - infoRec->PolylinesThinDashedFlags = infoRec->DashedLineFlags; - } - if (!infoRec->PolySegmentThinDashed) { - infoRec->PolySegmentThinDashed = XAAPolySegmentDashed; - infoRec->PolySegmentThinDashedFlags = infoRec->DashedLineFlags; - } - } - - if (infoRec->PolylinesThinDashed || infoRec->PolySegmentThinDashed) { - if (!infoRec->ComputeDash) - infoRec->ComputeDash = XAAComputeDash; - } - - { - Bool haveTexture = infoRec->CPUToScreenTextureFormats && - infoRec->CPUToScreenTextureDstFormats && - infoRec->SetupForCPUToScreenTexture2 && - infoRec->SubsequentCPUToScreenTexture; - Bool haveAlphaTexture = infoRec->CPUToScreenAlphaTextureFormats && - infoRec->CPUToScreenAlphaTextureDstFormats && - infoRec->SetupForCPUToScreenAlphaTexture2 && - infoRec->SubsequentCPUToScreenAlphaTexture; - - if (!infoRec->Composite && (haveTexture || haveAlphaTexture)) - infoRec->Composite = XAADoComposite; - - if (!infoRec->Glyphs && infoRec->WriteBitmap && - !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) { - infoRec->Glyphs = XAADoGlyphs; - } - } - - /************ Validation Functions **************/ - - if (!infoRec->ValidateCopyArea && infoRec->CopyArea) { - infoRec->CopyAreaMask = GCWhenForced; - if ((infoRec->CopyAreaFlags & GXCOPY_ONLY) || - (infoRec->CopyAreaFlags & ROP_NEEDS_SOURCE)) - infoRec->CopyAreaMask |= GCFunction; - if (infoRec->CopyAreaFlags & NO_PLANEMASK) - infoRec->CopyAreaMask |= GCPlaneMask; - infoRec->ValidateCopyArea = XAAValidateCopyArea; - } - - if (!infoRec->ValidateCopyPlane && infoRec->CopyPlane) { - infoRec->CopyPlaneMask = GCWhenForced; - if ((infoRec->CopyPlaneFlags & GXCOPY_ONLY) || - (infoRec->CopyPlaneFlags & ROP_NEEDS_SOURCE)) - infoRec->CopyPlaneMask |= GCFunction; - if (infoRec->CopyPlaneFlags & NO_PLANEMASK) - infoRec->CopyPlaneMask |= GCPlaneMask; - if (infoRec->CopyPlaneFlags & RGB_EQUAL) - infoRec->CopyPlaneMask |= GCForeground | GCBackground; - infoRec->ValidateCopyPlane = XAAValidateCopyPlane; - } - - if (!infoRec->ValidatePutImage && infoRec->PutImage) { - infoRec->PutImageMask = GCWhenForced; - if ((infoRec->PutImageFlags & GXCOPY_ONLY) || - (infoRec->PutImageFlags & ROP_NEEDS_SOURCE)) - infoRec->PutImageMask |= GCFunction; - if (infoRec->PutImageFlags & NO_PLANEMASK) - infoRec->PutImageMask |= GCPlaneMask; - if (infoRec->PutImageFlags & RGB_EQUAL) - infoRec->PutImageMask |= GCForeground | GCBackground; - infoRec->ValidatePutImage = XAAValidatePutImage; - } - - if (!infoRec->ValidatePushPixels && infoRec->PushPixelsSolid) { - infoRec->PushPixelsMask = GCFillStyle; - if ((infoRec->PushPixelsFlags & GXCOPY_ONLY) || - (infoRec->PushPixelsFlags & ROP_NEEDS_SOURCE) || - (infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY)) - infoRec->PushPixelsMask |= GCFunction; - if (infoRec->PushPixelsFlags & NO_PLANEMASK) - infoRec->PushPixelsMask |= GCPlaneMask; - if (infoRec->PushPixelsFlags & RGB_EQUAL) - infoRec->PushPixelsMask |= GCForeground; - infoRec->ValidatePushPixels = XAAValidatePushPixels; - } - - /* By default XAA assumes the FillSpans, PolyFillRects, FillPolygon - and PolyFillArcs have the same restrictions. If you supply GC - level replacements for any of these and alter this relationship - you may need to supply replacement validation routines */ - - if (!infoRec->ValidateFillSpans && - (infoRec->FillSpansSolid || infoRec->FillSpansStippled || - infoRec->FillSpansOpaqueStippled || infoRec->FillSpansTiled)) { - - int compositeFlags = infoRec->FillSpansSolidFlags | - infoRec->FillSpansStippledFlags | - infoRec->FillSpansOpaqueStippledFlags | - infoRec->FillSpansTiledFlags; - - infoRec->FillSpansMask = GCFillStyle | GCTile | GCStipple; - - if ((compositeFlags & GXCOPY_ONLY) || - (compositeFlags & ROP_NEEDS_SOURCE)) - infoRec->FillSpansMask |= GCFunction; - if (compositeFlags & NO_PLANEMASK) - infoRec->FillSpansMask |= GCPlaneMask; - if (compositeFlags & RGB_EQUAL) - infoRec->FillSpansMask |= GCForeground; - infoRec->ValidateFillSpans = XAAValidateFillSpans; - } - - /* By default XAA only provides Validations for the GlyphBlt - functions and not the text higher up. This is because the - Text8/16 and GlyphBlt are linked. If you break this linkage, - you may need to have the driver supply its own Validation - routines */ - - if (!infoRec->ValidatePolyGlyphBlt && - (infoRec->PolyGlyphBltTE || infoRec->PolyGlyphBltNonTE)) { - int compositeFlags = infoRec->PolyGlyphBltTEFlags | - infoRec->PolyGlyphBltNonTEFlags; - - infoRec->PolyGlyphBltMask = GCFillStyle | GCFont; - if ((compositeFlags & GXCOPY_ONLY) || - (compositeFlags & ROP_NEEDS_SOURCE) || - (infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY)) - infoRec->PolyGlyphBltMask |= GCFunction; - if (compositeFlags & NO_PLANEMASK) - infoRec->PolyGlyphBltMask |= GCPlaneMask; - if (compositeFlags & RGB_EQUAL) - infoRec->PolyGlyphBltMask |= GCForeground; - infoRec->ValidatePolyGlyphBlt = XAAValidatePolyGlyphBlt; - } - - if (!infoRec->ValidateImageGlyphBlt && - (infoRec->ImageGlyphBltTE || infoRec->ImageGlyphBltNonTE)) { - int compositeFlags = infoRec->ImageGlyphBltTEFlags | - infoRec->ImageGlyphBltNonTEFlags; - - if (infoRec->ImageGlyphBltNonTE) - compositeFlags |= infoRec->SolidFillFlags; - - infoRec->ImageGlyphBltMask = GCFont; - if (compositeFlags & NO_PLANEMASK) - infoRec->ImageGlyphBltMask |= GCPlaneMask; - if (compositeFlags & RGB_EQUAL) - infoRec->ImageGlyphBltMask |= GCForeground | GCBackground; - infoRec->ValidateImageGlyphBlt = XAAValidateImageGlyphBlt; - } - - /* By default XAA only provides a Validation function for the - Polylines and does segments and polylines at the same time */ - - if (!infoRec->ValidatePolylines && infoRec->ValidateFillSpans) { - int compositeFlags = infoRec->PolyRectangleThinSolidFlags | - infoRec->PolylinesWideSolidFlags | - infoRec->PolylinesThinSolidFlags | - infoRec->PolySegmentThinSolidFlags | - infoRec->PolySegmentThinDashedFlags | - infoRec->PolylinesThinDashedFlags; - - infoRec->ValidatePolylines = XAAValidatePolylines; - infoRec->PolylinesMask = - infoRec->FillSpansMask | GCLineStyle | GCLineWidth; - - if (infoRec->PolySegmentThinDashed || infoRec->PolylinesThinDashed) - infoRec->PolylinesMask |= GCDashList; - if (compositeFlags & NO_PLANEMASK) - infoRec->PolylinesMask |= GCPlaneMask; - if ((compositeFlags & GXCOPY_ONLY) || - (compositeFlags & ROP_NEEDS_SOURCE)) - infoRec->PolylinesMask |= GCFunction; - if (compositeFlags & RGB_EQUAL) - infoRec->PolylinesMask |= GCForeground; - } - - /**** Fill choosers ****/ - - if (!infoRec->StippledFillChooser) - infoRec->StippledFillChooser = XAAStippledFillChooser; - - if (!infoRec->OpaqueStippledFillChooser) - infoRec->OpaqueStippledFillChooser = XAAOpaqueStippledFillChooser; - - if (!infoRec->TiledFillChooser) - infoRec->TiledFillChooser = XAATiledFillChooser; - - /**** Setup the pixmap cache ****/ - - if (infoRec->WriteBitmapToCache) { - } - else if (infoRec->WriteBitmap && - !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) - infoRec->WriteBitmapToCache = XAAWriteBitmapToCache; - else if (infoRec->Flags & LINEAR_FRAMEBUFFER) - infoRec->WriteBitmapToCache = XAAWriteBitmapToCacheLinear; - else - infoRec->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES; - - if (infoRec->WritePixmapToCache) { - } - else if (infoRec->WritePixmap && !(infoRec->WritePixmapFlags & NO_GXCOPY)) - infoRec->WritePixmapToCache = XAAWritePixmapToCache; - else if (infoRec->Flags & LINEAR_FRAMEBUFFER) - infoRec->WritePixmapToCache = XAAWritePixmapToCacheLinear; - else - infoRec->Flags &= ~PIXMAP_CACHE; - - if (xf86ReturnOptValBool(options, XAAOPT_PIXMAP_CACHE, FALSE)) - infoRec->Flags &= ~PIXMAP_CACHE; - - if (infoRec->WriteMono8x8PatternToCache) { - } - else if (infoRec->PixmapCacheFlags & CACHE_MONO_8x8) { - if (infoRec->WritePixmapToCache) - infoRec->WriteMono8x8PatternToCache = XAAWriteMono8x8PatternToCache; - else - infoRec->PixmapCacheFlags &= ~CACHE_MONO_8x8; - } - - if (infoRec->WriteColor8x8PatternToCache) { - } - else if (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8) { - if (infoRec->WritePixmapToCache && infoRec->WriteBitmapToCache) - infoRec->WriteColor8x8PatternToCache = - XAAWriteColor8x8PatternToCache; - else - infoRec->PixmapCacheFlags &= ~CACHE_COLOR_8x8; - } - - if (infoRec->CachePixelGranularity < 0) { - switch (pScrn->bitsPerPixel) { - case 24: - case 8: - infoRec->CachePixelGranularity = 4; - break; - case 16: - infoRec->CachePixelGranularity = 2; - break; - case 32: - infoRec->CachePixelGranularity = 1; - break; - default: - break; - } - - if (BITMAP_SCANLINE_PAD == 64) - infoRec->CachePixelGranularity *= 2; - } - - free(options); - - if (!infoRec->CacheTile && infoRec->WritePixmapToCache) - infoRec->CacheTile = XAACacheTile; - if (!infoRec->CacheMonoStipple && infoRec->WritePixmapToCache) - infoRec->CacheMonoStipple = XAACacheMonoStipple; - if (!infoRec->CacheStipple && infoRec->WriteBitmapToCache) - infoRec->CacheStipple = XAACacheStipple; - if (!infoRec->CacheMono8x8Pattern && infoRec->WriteMono8x8PatternToCache) - infoRec->CacheMono8x8Pattern = XAACacheMono8x8Pattern; - if (!infoRec->CacheColor8x8Pattern && infoRec->WriteColor8x8PatternToCache) - infoRec->CacheColor8x8Pattern = XAACacheColor8x8Pattern; - - if ((infoRec->Flags & PIXMAP_CACHE) && !infoRec->InitPixmapCache) { - infoRec->InitPixmapCache = XAAInitPixmapCache; - infoRec->ClosePixmapCache = XAAClosePixmapCache; - } - - return TRUE; -} diff --git a/xserver/hw/xfree86/xaa/xaaLine.c b/xserver/hw/xfree86/xaa/xaaLine.c deleted file mode 100644 index d7c60975e..000000000 --- a/xserver/hw/xfree86/xaa/xaaLine.c +++ /dev/null @@ -1,422 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <stdlib.h> - -#include <X11/X.h> -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "miline.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" - -void -#ifdef POLYSEGMENT - XAAPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg -#else -XAAPolyLines(DrawablePtr pDrawable, GCPtr pGC, int mode, /* Origin or Previous */ - int npt, /* number of points */ - DDXPointPtr pptInit -#endif - ) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - BoxPtr pboxInit = RegionRects(pGC->pCompositeClip); - int nboxInit = RegionNumRects(pGC->pCompositeClip); - unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - int xorg = pDrawable->x; - int yorg = pDrawable->y; - int nbox; - BoxPtr pbox; - -#ifndef POLYSEGMENT - DDXPointPtr ppt; -#endif - int x1, x2, y1, y2, tmp, len; - - if (!nboxInit) - return; - - if (infoRec->SolidLineFlags & LINE_LIMIT_COORDS) { - int minValX = infoRec->SolidLineLimits.x1; - int maxValX = infoRec->SolidLineLimits.x2; - int minValY = infoRec->SolidLineLimits.y1; - int maxValY = infoRec->SolidLineLimits.y2; - -#ifdef POLYSEGMENT - int n = nseg; - xSegment *s = pSeg; - - while (n--) -#else - int n = npt; - int xorgtmp = xorg; - int yorgtmp = yorg; - - ppt = pptInit; - x2 = ppt->x + xorgtmp; - y2 = ppt->y + yorgtmp; - while (--n) -#endif - { -#ifdef POLYSEGMENT - x1 = s->x1 + xorg; - y1 = s->y1 + yorg; - x2 = s->x2 + xorg; - y2 = s->y2 + yorg; - s++; -#else - x1 = x2; - y1 = y2; - ++ppt; - if (mode == CoordModePrevious) { - xorgtmp = x1; - yorgtmp = y1; - } - x2 = ppt->x + xorgtmp; - y2 = ppt->y + yorgtmp; -#endif - if (x1 > maxValX || x1 < minValX || - x2 > maxValX || x2 < minValX || - y1 > maxValY || y1 < minValY || y2 > maxValY || y2 < minValY) { -#ifdef POLYSEGMENT - XAAFallbackOps.PolySegment(pDrawable, pGC, nseg, pSeg); -#else - XAAFallbackOps.Polylines(pDrawable, pGC, mode, npt, pptInit); -#endif - return; - } - } - } - - (*infoRec->SetupForSolidLine) (infoRec->pScrn, pGC->fgPixel, - pGC->alu, pGC->planemask); - -#ifdef POLYSEGMENT - while (nseg--) -#else - ppt = pptInit; - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; - while (--npt) -#endif - { - nbox = nboxInit; - pbox = pboxInit; - -#ifdef POLYSEGMENT - x1 = pSeg->x1 + xorg; - y1 = pSeg->y1 + yorg; - x2 = pSeg->x2 + xorg; - y2 = pSeg->y2 + yorg; - pSeg++; -#else - x1 = x2; - y1 = y2; - ++ppt; - if (mode == CoordModePrevious) { - xorg = x1; - yorg = y1; - } - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; -#endif - - if (x1 == x2) { /* vertical line */ - /* make the line go top to bottom of screen, keeping - endpoint semantics - */ - if (y1 > y2) { - tmp = y2; - y2 = y1 + 1; - y1 = tmp + 1; -#ifdef POLYSEGMENT - if (pGC->capStyle != CapNotLast) - y1--; -#endif - } -#ifdef POLYSEGMENT - else if (pGC->capStyle != CapNotLast) - y2++; -#endif - /* get to first band that might contain part of line */ - while (nbox && (pbox->y2 <= y1)) { - pbox++; - nbox--; - } - - /* stop when lower edge of box is beyond end of line */ - while (nbox && (y2 >= pbox->y1)) { - if ((x1 >= pbox->x1) && (x1 < pbox->x2)) { - tmp = max(y1, pbox->y1); - len = min(y2, pbox->y2) - tmp; - if (len) - (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn, - x1, tmp, len, - DEGREES_270); - } - nbox--; - pbox++; - } -#ifndef POLYSEGMENT - y2 = ppt->y + yorg; -#endif - } - else if (y1 == y2) { /* horizontal line */ - /* force line from left to right, keeping endpoint semantics */ - if (x1 > x2) { - tmp = x2; - x2 = x1 + 1; - x1 = tmp + 1; -#ifdef POLYSEGMENT - if (pGC->capStyle != CapNotLast) - x1--; -#endif - } -#ifdef POLYSEGMENT - else if (pGC->capStyle != CapNotLast) - x2++; -#endif - - /* find the correct band */ - while (nbox && (pbox->y2 <= y1)) { - pbox++; - nbox--; - } - - /* try to draw the line, if we haven't gone beyond it */ - if (nbox && (pbox->y1 <= y1)) { - int orig_y = pbox->y1; - - /* when we leave this band, we're done */ - while (nbox && (orig_y == pbox->y1)) { - if (pbox->x2 <= x1) { - /* skip boxes until one might contain start point */ - nbox--; - pbox++; - continue; - } - - /* stop if left of box is beyond right of line */ - if (pbox->x1 >= x2) { - nbox = 0; - break; - } - - tmp = max(x1, pbox->x1); - len = min(x2, pbox->x2) - tmp; - if (len) - (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn, - tmp, y1, len, - DEGREES_0); - nbox--; - pbox++; - } - } -#ifndef POLYSEGMENT - x2 = ppt->x + xorg; -#endif - } - else { /* sloped line */ - unsigned int oc1, oc2; - int dmin, dmaj, e, octant; - - if (infoRec->SubsequentSolidBresenhamLine) { - if ((dmaj = x2 - x1) < 0) { - dmaj = -dmaj; - octant = XDECREASING; - } - else - octant = 0; - - if ((dmin = y2 - y1) < 0) { - dmin = -dmin; - octant |= YDECREASING; - } - - if (dmin >= dmaj) { - tmp = dmin; - dmin = dmaj; - dmaj = tmp; - octant |= YMAJOR; - } - - e = -dmaj - ((bias >> octant) & 1); - len = dmaj; - dmin <<= 1; - dmaj <<= 1; - } - else { /* Muffle compiler */ - dmin = dmaj = e = octant = len = 0; - } - - while (nbox--) { - oc1 = oc2 = 0; - OUTCODES(oc1, x1, y1, pbox); - OUTCODES(oc2, x2, y2, pbox); - if (!(oc1 | oc2)) { /* unclipped */ - if (infoRec->SubsequentSolidTwoPointLine) { - (*infoRec->SubsequentSolidTwoPointLine) (infoRec->pScrn, - x1, y1, x2, y2, -#ifdef POLYSEGMENT - (pGC-> - capStyle != - CapNotLast) ? - 0 : -#endif - OMIT_LAST); - } - else { - (*infoRec->SubsequentSolidBresenhamLine) (infoRec-> - pScrn, x1, y1, - dmaj, dmin, e, -#ifdef POLYSEGMENT - (pGC-> - capStyle != - CapNotLast) - ? (len + 1) : -#endif - len, octant); - } - break; - } - else if (oc1 & oc2) { /* completely clipped */ - pbox++; - } - else if (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_LINE) { - (*infoRec->SetClippingRectangle) (infoRec->pScrn, - pbox->x1, pbox->y1, - pbox->x2 - 1, - pbox->y2 - 1); - - if (infoRec->SubsequentSolidBresenhamLine) { - (*infoRec->SubsequentSolidBresenhamLine) (infoRec-> - pScrn, x1, y1, - dmaj, dmin, e, -#ifdef POLYSEGMENT - (pGC-> - capStyle != - CapNotLast) - ? (len + 1) : -#endif - len, octant); - } - else { - (*infoRec->SubsequentSolidTwoPointLine) (infoRec->pScrn, - x1, y1, x2, y2, -#ifdef POLYSEGMENT - (pGC-> - capStyle != - CapNotLast) ? - 0 : -#endif - OMIT_LAST); - } - (*infoRec->DisableClipping) (infoRec->pScrn); - pbox++; - } - else { - int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2; - int clip1 = 0, clip2 = 0; - int err, adx, ady; - - if (octant & YMAJOR) { - ady = dmaj >> 1; - adx = dmin >> 1; - } - else { - ady = dmin >> 1; - adx = dmaj >> 1; - } - - if (miZeroClipLine(pbox->x1, pbox->y1, - pbox->x2 - 1, pbox->y2 - 1, - &new_x1, &new_y1, &new_x2, &new_y2, - adx, ady, &clip1, &clip2, - octant, bias, oc1, oc2) == -1) { - pbox++; - continue; - } - - if (octant & YMAJOR) - len = abs(new_y2 - new_y1); - else - len = abs(new_x2 - new_x1); -#ifdef POLYSEGMENT - if (clip2 != 0 || pGC->capStyle != CapNotLast) - len++; -#else - len += (clip2 != 0); -#endif - if (len) { - int abserr, clipdx, clipdy; - - /* unwind bresenham error term to first point */ - if (clip1) { - clipdx = abs(new_x1 - x1); - clipdy = abs(new_y1 - y1); - - if (octant & YMAJOR) - err = e + clipdy * dmin - clipdx * dmaj; - else - err = e + clipdx * dmin - clipdy * dmaj; - } - else - err = e; - -#define range infoRec->SolidBresenhamLineErrorTermBits - abserr = abs(err); - while ((abserr & range) || - (dmaj & range) || (dmin & range)) { - dmin >>= 1; - dmaj >>= 1; - abserr >>= 1; - err /= 2; - } - - (*infoRec->SubsequentSolidBresenhamLine) (infoRec-> - pScrn, new_x1, - new_y1, dmaj, - dmin, err, - len, octant); - } - pbox++; - } - } /* while (nbox--) */ - } /* sloped line */ - } /* while (nline--) */ - -#ifndef POLYSEGMENT - /* paint the last point if the end style isn't CapNotLast. - (Assume that a projecting, butt, or round cap that is one - pixel wide is the same as the single pixel of the endpoint.) - */ - - if ((pGC->capStyle != CapNotLast) && - ((ppt->x + xorg != pptInit->x + pDrawable->x) || - (ppt->y + yorg != pptInit->y + pDrawable->y) || - (ppt == pptInit + 1))) { - nbox = nboxInit; - pbox = pboxInit; - while (nbox--) { - if ((x2 >= pbox->x1) && (y2 >= pbox->y1) && - (x2 < pbox->x2) && (y2 < pbox->y2)) { - (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn, x2, y2, - 1, DEGREES_0); - break; - } - else - pbox++; - } - } -#endif - - SET_SYNC_FLAG(infoRec); -} diff --git a/xserver/hw/xfree86/xaa/xaaLineMisc.c b/xserver/hw/xfree86/xaa/xaaLineMisc.c deleted file mode 100644 index 4379778f6..000000000 --- a/xserver/hw/xfree86/xaa/xaaLineMisc.c +++ /dev/null @@ -1,149 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "miline.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" - -void -XAASolidHorVertLineAsRects(ScrnInfoPtr pScrn, int x, int y, int len, int dir) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - if (dir == DEGREES_0) - (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, len, 1); - else - (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, 1, len); -} - -void -XAASolidHorVertLineAsTwoPoint(ScrnInfoPtr pScrn, int x, int y, int len, int dir) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - len--; - - if (dir == DEGREES_0) - (*infoRec->SubsequentSolidTwoPointLine) (pScrn, x, y, x + len, y, 0); - else - (*infoRec->SubsequentSolidTwoPointLine) (pScrn, x, y, x, y + len, 0); -} - -void -XAASolidHorVertLineAsBresenham(ScrnInfoPtr pScrn, - int x, int y, int len, int dir) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - if (dir == DEGREES_0) - (*infoRec->SubsequentSolidBresenhamLine) (pScrn, x, y, len << 1, 0, - -len, len, 0); - else - (*infoRec->SubsequentSolidBresenhamLine) (pScrn, x, y, len << 1, 0, - -len, len, YMAJOR); -} - -void -XAAComputeDash(GCPtr pGC) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates, - XAAGetGCKey()); - Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE; - int PatternLength = 0; - unsigned char *DashPtr = (unsigned char *) pGC->dash; - CARD32 *ptr; - int count = pGC->numInDashList; - int shift, value, direction; - Bool set; - - free(pGCPriv->DashPattern); - - pGCPriv->DashPattern = NULL; - pGCPriv->DashLength = 0; - - while (count--) - PatternLength += *(DashPtr++); - - if (!EvenDash) - PatternLength <<= 1; - - if (PatternLength > infoRec->DashPatternMaxLength) - return; - - if ((infoRec->DashedLineFlags & LINE_PATTERN_POWER_OF_2_ONLY) && - (PatternLength & (PatternLength - 1))) - return; - - pGCPriv->DashPattern = calloc((PatternLength + 31) >> 5, 4); - if (!pGCPriv->DashPattern) - return; - pGCPriv->DashLength = PatternLength; - - if (infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED | - LINE_PATTERN_LSBFIRST_LSBJUSTIFIED)) { - direction = 1; - set = TRUE; - DashPtr = (unsigned char *) pGC->dash; - } - else { - direction = -1; - set = FALSE; - DashPtr = (unsigned char *) pGC->dash + pGC->numInDashList - 1; - } - - if (infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED | - LINE_PATTERN_MSBFIRST_MSBJUSTIFIED)) - shift = 32 - (PatternLength & 31); - else - shift = 0; - - ptr = (CARD32 *) (pGCPriv->DashPattern); - - CONCATENATE: - - count = pGC->numInDashList; - - while (count--) { - value = *DashPtr; - DashPtr += direction; - while (value) { - if (value < (32 - shift)) { - if (set) - *ptr |= XAAShiftMasks[value] << shift; - shift += value; - break; - } - else { - if (set) - *ptr |= ~0L << shift; - value -= (32 - shift); - shift = 0; - ptr++; - } - } - if (set) - set = FALSE; - else - set = TRUE; - } - - if (!EvenDash) { - EvenDash = TRUE; - if (infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED | - LINE_PATTERN_LSBFIRST_LSBJUSTIFIED)) - DashPtr = (unsigned char *) pGC->dash; - else - DashPtr = (unsigned char *) pGC->dash + pGC->numInDashList; - goto CONCATENATE; - } -} diff --git a/xserver/hw/xfree86/xaa/xaaNonTEGlyph.c b/xserver/hw/xfree86/xaa/xaaNonTEGlyph.c deleted file mode 100644 index bfe7f9a09..000000000 --- a/xserver/hw/xfree86/xaa/xaaNonTEGlyph.c +++ /dev/null @@ -1,192 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xaa.h" -#include "xaalocal.h" -#include "xaacexp.h" -#include "xf86.h" - -/* Not used anymore because the algorithm isn't correct. It doesn't - handle overlapping characters properly */ - -#ifdef TRIPLE_BITS -#define NonTEGlyphFunc EXPNAME(XAANonTEGlyphScanlineFunc3) -#else -#define NonTEGlyphFunc EXPNAME(XAANonTEGlyphScanlineFunc) -#endif - -/******************************************************************** - - Here we have NonTEGlyphRenders for a bunch of different color - expansion types. The driver may provide its own renderer, but - this is the default one which renders using lower-level primitives - exported by the chipset driver. - -********************************************************************/ - -/* Since the dimensions of the text string and the backing rectangle - do not always coincide, it is possible that wBack or wText - may be 0! The NonTEGlyphRender must always check for this. */ - -/* This gets built for MSBFIRST or LSBFIRST with FIXEDBASE or not, - with TRIPLE_BITS or not. A total of 8 versions */ - -/* if the backing rectangle and text are of the same dimensions - then we can draw in one pass */ - -void -#ifdef TRIPLE_BITS - EXPNAME(XAANonTEGlyphRenderer3) ( -#else - EXPNAME(XAANonTEGlyphRenderer) ( -#endif - ScrnInfoPtr pScrn, - int xText, int wText, - int y, int h, int skipleft, int startline, - NonTEGlyphInfo * glyphp, - int fg, int rop, unsigned int planemask) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - CARD32 *base = (CARD32 *) infoRec->ColorExpandBase; - -#ifdef TRIPLE_BITS - int dwords = ((3 * wText + 31) >> 5) * h; -#else - int dwords = ((wText + 31) >> 5) * h; -#endif - - (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, -1, rop, - planemask); - (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, xText, y, wText, h, - 0); - -#ifndef FIXEDBASE -#ifdef TRIPLE_BITS - if ((((3 * wText + 31) >> 5) * h) <= infoRec->ColorExpandRange) -#else - if ((((wText + 31) >> 5) * h) <= infoRec->ColorExpandRange) -#endif - while (h--) - base = NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft); - else -#endif - while (h--) - NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft); - - if ((infoRec->CPUToScreenColorExpandFillFlags & CPU_TRANSFER_PAD_QWORD) && - (dwords & 1)) { - base = (CARD32 *) infoRec->ColorExpandBase; - base[0] = 0x00000000; - } - - if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND) - (*infoRec->Sync) (pScrn); - else - SET_SYNC_FLAG(infoRec); -} - -#ifndef FIXEDBASE -/* Scanline version of above gets built for LSBFIRST and MSBFIRST */ - -void -#ifdef TRIPLE_BITS - EXPNAME(XAANonTEGlyphRendererScanline3) ( -#else - EXPNAME(XAANonTEGlyphRendererScanline) ( -#endif - ScrnInfoPtr pScrn, - int xText, int wText, - int y, int h, int skipleft, - int startline, - NonTEGlyphInfo * glyphp, int fg, - int rop, unsigned int planemask) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int bufferNo = 0; - CARD32 *base; - - (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, -1, rop, - planemask); - (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, xText, y, - wText, h, 0); - - while (h--) { - base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo]; - NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft); - (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++); - if (bufferNo >= infoRec->NumScanlineColorExpandBuffers) - bufferNo = 0; - } - - SET_SYNC_FLAG(infoRec); -} - -#endif - -/******************************************************************** - - Generic NonTE scanline rendering code. - -********************************************************************/ - -CARD32 * -NonTEGlyphFunc(CARD32 *base, - NonTEGlyphInfo * glyphp, int line, int TotalWidth, int skipleft) -{ - CARD32 bits = 0; - int shift = glyphp->width; - - if (skipleft) { - if ((line >= glyphp->firstline) && (line <= glyphp->lastline)) - bits = SHIFT_R(glyphp->bitsp[line], skipleft); - shift -= skipleft; - } - else if ((line >= glyphp->firstline) && (line <= glyphp->lastline)) - bits = glyphp->bitsp[line]; - - while (TotalWidth > 32) { - while (shift < 32) { - glyphp++; - if ((line >= glyphp->firstline) && (line <= glyphp->lastline)) - bits |= SHIFT_L(glyphp->bitsp[line], shift); - shift += glyphp->width; - } -#ifdef TRIPLE_BITS - WRITE_BITS3(bits); -#else - WRITE_BITS(bits); -#endif - shift &= 31; - if (shift && (line >= glyphp->firstline) && (line <= glyphp->lastline)) - bits = SHIFT_R(glyphp->bitsp[line], glyphp->width - shift); - else - bits = 0; - TotalWidth -= 32; - } - - if (TotalWidth) { - TotalWidth -= shift; - while (TotalWidth > 0) { - glyphp++; - if ((line >= glyphp->firstline) && (line <= glyphp->lastline)) - bits |= SHIFT_L(glyphp->bitsp[line], shift); - shift += glyphp->width; - TotalWidth -= glyphp->width; - } -#ifdef TRIPLE_BITS - if (shift >= 22) { - WRITE_BITS3(bits); - } - else if (shift >= 11) { - WRITE_BITS2(bits); - } - else { - WRITE_BITS1(bits); - } -#else - WRITE_BITS(bits); -#endif - } - - return base; -} diff --git a/xserver/hw/xfree86/xaa/xaaNonTEText.c b/xserver/hw/xfree86/xaa/xaaNonTEText.c deleted file mode 100644 index 35b43912b..000000000 --- a/xserver/hw/xfree86/xaa/xaaNonTEText.c +++ /dev/null @@ -1,591 +0,0 @@ - -/******************************************************************** - - In this file we have GC level replacements for PolyText8/16, - ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for NonTE (proportional) - fonts. The idea is that everything in this file is device independent. - The mentioned GCOps are merely wrappers for the - PolyGlyphBltNonTEColorExpansion and ImageGlyphBltNonTEColorExpansion - functions which calculate the boxes containing arbitrarily clipped - text and passes them to the NonTEGlyphRenderer which will usually - be a lower level XAA function which renders these clipped glyphs using - the basic color expansion functions exported by the chipset driver. - The NonTEGlyphRenderer itself may optionally be driver supplied to - facilitate work-arounds/optimizations at a higher level than usual. - - Written by Mark Vojkovich (mvojkovi@ucsd.edu) - -********************************************************************/ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <string.h> - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include <X11/fonts/font.h> -#include "scrnintstr.h" -#include "dixfontstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaacexp.h" -#include "xaalocal.h" -#include "gcstruct.h" -#include "pixmapstr.h" - -static void ImageGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn, - int xInit, int yInit, FontPtr font, - int fg, int bg, unsigned planemask, - RegionPtr cclip, int nglyph, - unsigned char *gBase, - CharInfoPtr * ppci); -static int PolyGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn, int xInit, - int yInit, FontPtr font, int fg, - int rop, unsigned planemask, - RegionPtr cclip, int nglyph, - unsigned char *gBase, - CharInfoPtr * ppci); - -/******************************************************************** - - GC level replacements for PolyText8/16 and ImageText8/16 - for NonTE fonts when using color expansion. - -********************************************************************/ - -int -XAAPolyText8NonTEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - unsigned long n; - int width = 0; - - (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count, - (unsigned char *) chars, Linear8Bit, &n, - infoRec->CharInfo); - - if (n) { - width = PolyGlyphBltNonTEColorExpansion(infoRec->pScrn, - x + pDraw->x, y + pDraw->y, - pGC->font, pGC->fgPixel, - pGC->alu, pGC->planemask, - pGC->pCompositeClip, n, - FONTGLYPHS(pGC->font), - infoRec->CharInfo); - } - - return x + width; -} - -int -XAAPolyText16NonTEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - unsigned long n; - int width = 0; - - (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count, - (unsigned char *) chars, - (FONTLASTROW(pGC->font) == - 0) ? Linear16Bit : TwoD16Bit, &n, - infoRec->CharInfo); - - if (n) { - width = PolyGlyphBltNonTEColorExpansion(infoRec->pScrn, - x + pDraw->x, y + pDraw->y, - pGC->font, pGC->fgPixel, - pGC->alu, pGC->planemask, - pGC->pCompositeClip, n, - FONTGLYPHS(pGC->font), - infoRec->CharInfo); - } - - return x + width; -} - -void -XAAImageText8NonTEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, char *chars) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - unsigned long n; - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count, - (unsigned char *) chars, Linear8Bit, &n, - infoRec->CharInfo); - - if (n) - ImageGlyphBltNonTEColorExpansion(infoRec->pScrn, x + pDraw->x, - y + pDraw->y, pGC->font, pGC->fgPixel, - pGC->bgPixel, pGC->planemask, - pGC->pCompositeClip, n, - FONTGLYPHS(pGC->font), - infoRec->CharInfo); -} - -void -XAAImageText16NonTEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, int count, unsigned short *chars) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - unsigned long n; - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count, - (unsigned char *) chars, - (FONTLASTROW(pGC->font) == - 0) ? Linear16Bit : TwoD16Bit, &n, - infoRec->CharInfo); - - if (n) - ImageGlyphBltNonTEColorExpansion(infoRec->pScrn, x + pDraw->x, - y + pDraw->y, pGC->font, pGC->fgPixel, - pGC->bgPixel, pGC->planemask, - pGC->pCompositeClip, n, - FONTGLYPHS(pGC->font), - infoRec->CharInfo); -} - -/******************************************************************** - - GC level replacements for ImageGlyphBlt and PolyGlyphBlt for - NonTE fonts when using color expansion. - -********************************************************************/ - -void -XAAImageGlyphBltNonTEColorExpansion(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */ - pointer pglyphBase /* start of array of glyphs */ - ) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - ImageGlyphBltNonTEColorExpansion(infoRec->pScrn, xInit + pDraw->x, - yInit + pDraw->y, pGC->font, pGC->fgPixel, - pGC->bgPixel, pGC->planemask, - pGC->pCompositeClip, nglyph, - (unsigned char *) pglyphBase, ppci); -} - -void -XAAPolyGlyphBltNonTEColorExpansion(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */ - pointer pglyphBase /* start of array of glyphs */ - ) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - PolyGlyphBltNonTEColorExpansion(infoRec->pScrn, xInit + pDraw->x, - yInit + pDraw->y, pGC->font, pGC->fgPixel, - pGC->alu, pGC->planemask, - pGC->pCompositeClip, nglyph, - (unsigned char *) pglyphBase, ppci); -} - -/******************************************************************** - - ImageGlyphBltNonTEColorExpansion - - PolyGlyphBltNonTEColorExpansion - - - These guys compute the clipped pieces of text and send it to - the lower-level function which will handle acceleration of - arbitrarily clipped text. - -********************************************************************/ - -static int -CollectCharacterInfo(NonTEGlyphPtr glyphs, - unsigned int nglyph, CharInfoPtr * ppci, FontPtr pfont) -{ - int i, w = 0; - - for (i = 0; i < nglyph; i++, ppci++, glyphs++) { - glyphs->bits = (unsigned char *) ((*ppci)->bits); - glyphs->start = w + (*ppci)->metrics.leftSideBearing; - glyphs->end = w + (*ppci)->metrics.rightSideBearing; - glyphs->yoff = (*ppci)->metrics.ascent; - glyphs->height = glyphs->yoff + (*ppci)->metrics.descent; - glyphs->srcwidth = PADGLYPHWIDTHBYTES(glyphs->end - glyphs->start); - w += (*ppci)->metrics.characterWidth; - } - return w; -} - -static void -PolyGlyphBltAsSingleBitmap(ScrnInfoPtr pScrn, - int nglyph, - FontPtr font, - int xInit, - int yInit, - int nbox, - BoxPtr pbox, int fg, int rop, unsigned planemask) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - CARD32 *block, *pntr, *bits; - int pitch, topLine, botLine, top, bot, height; - int Left, Right, Top, Bottom; - int LeftEdge, RightEdge; - int bitPitch, shift, size, i, skippix; - NonTEGlyphPtr glyphs = infoRec->GlyphInfo; - Bool extra; - - Left = xInit + infoRec->GlyphInfo[0].start; - Right = xInit + infoRec->GlyphInfo[nglyph - 1].end; - Top = yInit - FONTMAXBOUNDS(font, ascent); - Bottom = yInit + FONTMAXBOUNDS(font, descent); - - /* get into the first band that may contain part of our string */ - while (nbox && (Top >= pbox->y2)) { - pbox++; - nbox--; - } - - if (!nbox) - return; - - pitch = (Right - Left + 31) >> 5; - size = (pitch << 2) * (Bottom - Top); - block = calloc(1, size); - - topLine = 10000; - botLine = -10000; - - while (nglyph--) { - top = -glyphs->yoff; - bot = top + glyphs->height; - if (top < topLine) - topLine = top; - if (bot > botLine) - botLine = bot; - skippix = glyphs->start - infoRec->GlyphInfo[0].start; - bits = (CARD32 *) glyphs->bits; - bitPitch = glyphs->srcwidth >> 2; - pntr = block + ((FONTMAXBOUNDS(font, ascent) + top) * pitch) + - (skippix >> 5); - shift = skippix & 31; - extra = ((shift + glyphs->end - glyphs->start) > 32); - - for (i = top; i < bot; i++) { - *pntr |= SHIFT_L(*bits, shift); - if (extra) - *(pntr + 1) |= SHIFT_R(*bits, 32 - shift); - pntr += pitch; - bits += bitPitch; - } - - glyphs++; - } - - pntr = block + ((FONTMAXBOUNDS(font, ascent) + topLine) * pitch); - - Top = yInit + topLine; - Bottom = yInit + botLine; - - while (nbox && (Top >= pbox->y2)) { - pbox++; - nbox--; - } - - while (nbox && (Bottom > pbox->y1)) { - LeftEdge = max(Left, pbox->x1); - RightEdge = min(Right, pbox->x2); - - if (RightEdge > LeftEdge) { - skippix = LeftEdge - Left; - topLine = max(Top, pbox->y1); - botLine = min(Bottom, pbox->y2); - height = botLine - topLine; - - if (height > 0) - (*infoRec->WriteBitmap) (pScrn, LeftEdge, topLine, - RightEdge - LeftEdge, height, - (unsigned char *) (pntr + - ((topLine - - Top) * pitch) + - (skippix >> 5)), - pitch << 2, skippix & 31, fg, -1, rop, - planemask); - } - - nbox--; - pbox++; - } - - free(block); -} - -static void -ImageGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn, - int xInit, int yInit, - FontPtr font, - int fg, int bg, - unsigned planemask, - RegionPtr cclip, - int nglyph, - unsigned char *gBase, CharInfoPtr * ppci) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int skippix, skipglyph, width, n, i; - int Left, Right, Top, Bottom; - int LeftEdge, RightEdge, ytop, ybot; - int nbox = RegionNumRects(cclip); - BoxPtr pbox = RegionRects(cclip); - Bool AlreadySetup = FALSE; - - width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font); - - /* find our backing rectangle dimensions */ - Left = xInit; - Right = Left + width; - Top = yInit - FONTASCENT(font); - Bottom = yInit + FONTDESCENT(font); - - /* get into the first band that may contain part of our box */ - while (nbox && (Top >= pbox->y2)) { - pbox++; - nbox--; - } - - while (nbox && (Bottom >= pbox->y1)) { - /* handle backing rect first */ - LeftEdge = max(Left, pbox->x1); - RightEdge = min(Right, pbox->x2); - if (RightEdge > LeftEdge) { - ytop = max(Top, pbox->y1); - ybot = min(Bottom, pbox->y2); - - if (ybot > ytop) { - if (!AlreadySetup) { - (*infoRec->SetupForSolidFill) (pScrn, bg, GXcopy, - planemask); - AlreadySetup = TRUE; - } - (*infoRec->SubsequentSolidFillRect) (pScrn, - LeftEdge, ytop, - RightEdge - LeftEdge, - ybot - ytop); - } - } - nbox--; - pbox++; - } - - nbox = RegionNumRects(cclip); - pbox = RegionRects(cclip); - - if (infoRec->WriteBitmap && (nglyph > 1) && - ((FONTMAXBOUNDS(font, rightSideBearing) - - FONTMINBOUNDS(font, leftSideBearing)) <= 32)) { - PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font, - xInit, yInit, nbox, pbox, - fg, GXcopy, planemask); - - return; - } - - /* compute an approximate but covering bounding box */ - Left = xInit + infoRec->GlyphInfo[0].start; - Right = xInit + infoRec->GlyphInfo[nglyph - 1].end; - Top = yInit - FONTMAXBOUNDS(font, ascent); - Bottom = yInit + FONTMAXBOUNDS(font, descent); - - /* get into the first band that may contain part of our box */ - while (nbox && (Top >= pbox->y2)) { - pbox++; - nbox--; - } - - /* stop when the lower edge of the box is beyond our string */ - while (nbox && (Bottom >= pbox->y1)) { - LeftEdge = max(Left, pbox->x1); - RightEdge = min(Right, pbox->x2); - - if (RightEdge > LeftEdge) { /* we're possibly drawing something */ - ytop = max(Top, pbox->y1); - ybot = min(Bottom, pbox->y2); - if (ybot > ytop) { - skippix = LeftEdge - xInit; - skipglyph = 0; - while (skippix >= infoRec->GlyphInfo[skipglyph].end) - skipglyph++; - - skippix = RightEdge - xInit; - n = 0; - i = skipglyph; - while ((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) { - i++; - n++; - } - - if (n) - (*infoRec->NonTEGlyphRenderer) (pScrn, - xInit, yInit, n, - infoRec->GlyphInfo + - skipglyph, pbox, fg, GXcopy, - planemask); - } - } - - nbox--; - pbox++; - } -} - -static int -PolyGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn, - int xInit, int yInit, - FontPtr font, - int fg, int rop, - unsigned planemask, - RegionPtr cclip, - int nglyph, - unsigned char *gBase, CharInfoPtr * ppci) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int skippix, skipglyph, width, n, i; - int Left, Right, Top, Bottom; - int LeftEdge, RightEdge; - int nbox = RegionNumRects(cclip); - BoxPtr pbox = RegionRects(cclip); - - width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font); - - if (!nbox) - return width; - - if ((infoRec->WriteBitmap) && (rop == GXcopy) && (nglyph > 1) && - ((FONTMAXBOUNDS(font, rightSideBearing) - - FONTMINBOUNDS(font, leftSideBearing)) <= 32)) { - - PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font, - xInit, yInit, nbox, pbox, - fg, rop, planemask); - - return width; - } - - /* compute an approximate but covering bounding box */ - Left = xInit + infoRec->GlyphInfo[0].start; - Right = xInit + infoRec->GlyphInfo[nglyph - 1].end; - Top = yInit - FONTMAXBOUNDS(font, ascent); - Bottom = yInit + FONTMAXBOUNDS(font, descent); - - /* get into the first band that may contain part of our string */ - while (nbox && (Top >= pbox->y2)) { - pbox++; - nbox--; - } - - /* stop when the lower edge of the box is beyond our string */ - while (nbox && (Bottom >= pbox->y1)) { - LeftEdge = max(Left, pbox->x1); - RightEdge = min(Right, pbox->x2); - - if (RightEdge > LeftEdge) { /* we're possibly drawing something */ - - skippix = LeftEdge - xInit; - skipglyph = 0; - while (skippix >= infoRec->GlyphInfo[skipglyph].end) - skipglyph++; - - skippix = RightEdge - xInit; - n = 0; - i = skipglyph; - while ((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) { - i++; - n++; - } - - if (n) - (*infoRec->NonTEGlyphRenderer) (pScrn, - xInit, yInit, n, - infoRec->GlyphInfo + skipglyph, - pbox, fg, rop, planemask); - } - - nbox--; - pbox++; - } - return width; -} - -/* It is possible that the none of the glyphs passed to the - NonTEGlyphRenderer will be drawn. This function being called - indicates that part of the text string's bounding box is visible - but not necessarily that any of the characters are visible */ - -void -XAANonTEGlyphRenderer(ScrnInfoPtr pScrn, - int x, int y, int n, - NonTEGlyphPtr glyphs, - BoxPtr pbox, int fg, int rop, unsigned int planemask) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int x1, x2, y1, y2, i, w, h, skipleft, skiptop; - unsigned char *src; - - for (i = 0; i < n; i++, glyphs++) { - x1 = x + glyphs->start; - x2 = x + glyphs->end; - y1 = y - glyphs->yoff; - y2 = y1 + glyphs->height; - - if (y1 < pbox->y1) { - skiptop = pbox->y1 - y1; - y1 = pbox->y1; - } - else - skiptop = 0; - if (y2 > pbox->y2) - y2 = pbox->y2; - h = y2 - y1; - if (h <= 0) - continue; - - if (x1 < pbox->x1) { - skipleft = pbox->x1 - x1; - x1 = pbox->x1; - } - else - skipleft = 0; - if (x2 > pbox->x2) - x2 = pbox->x2; - - w = x2 - x1; - - if (w > 0) { - src = glyphs->bits + (skiptop * glyphs->srcwidth); - - if (skipleft) { - src += (skipleft >> 5) << 2; - skipleft &= 31; - } - - (*infoRec->WriteBitmap) (pScrn, x1, y1, w, h, src, - glyphs->srcwidth, skipleft, fg, -1, rop, - planemask); - } - } - -} diff --git a/xserver/hw/xfree86/xaa/xaaOffscreen.c b/xserver/hw/xfree86/xaa/xaaOffscreen.c deleted file mode 100644 index 7d89fc17a..000000000 --- a/xserver/hw/xfree86/xaa/xaaOffscreen.c +++ /dev/null @@ -1,163 +0,0 @@ - -/* - Copyright (c) 1999 - The XFree86 Project Inc. - - Written by Mark Vojkovich - -*/ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "xf86str.h" -#include "mi.h" -#include "miline.h" -#include "xaa.h" -#include "xaalocal.h" -#include "xaawrap.h" -#include "xf86fbman.h" -#include "servermd.h" - -void -XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - PixmapLinkPtr pLink = infoRec->OffscreenPixmaps; - XAAPixmapPtr pPriv; - - while (pLink) { - pPriv = XAA_GET_PIXMAP_PRIVATE(pLink->pPix); - pLink->area = pPriv->offscreenArea; - XAAMoveOutOffscreenPixmap(pLink->pPix); - pLink = pLink->next; - } -} - -void -XAAMoveInOffscreenPixmaps(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - PixmapLinkPtr pLink = infoRec->OffscreenPixmaps; - PixmapPtr pPix, pScreenPix, tmpPix; - pointer data; - XAAPixmapPtr pPriv; - GCPtr pGC; - FBAreaPtr area; - - pScreenPix = (*pScreen->GetScreenPixmap) (pScreen); - - while (pLink) { - pPix = pLink->pPix; - pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); - area = pLink->area; - - data = pPix->devPrivate.ptr; - tmpPix = GetScratchPixmapHeader(pScreen, - pPix->drawable.width, - pPix->drawable.height, - pPix->drawable.depth, - pPix->drawable.bitsPerPixel, - pPix->devKind, data); - - pPriv->freeData = FALSE; - - pPix->drawable.x = area->box.x1; - pPix->drawable.y = area->box.y1; - pPix->devKind = pScreenPix->devKind; - pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr; - pPix->drawable.bitsPerPixel = infoRec->pScrn->bitsPerPixel; - pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER; - - if (!tmpPix) { - pPriv->offscreenArea = area; - free(data); - pLink = pLink->next; - continue; - } - - pGC = GetScratchGC(pPix->drawable.depth, pScreen); - ValidateGC((DrawablePtr) pPix, pGC); - - (*pGC->ops->CopyArea) ((DrawablePtr) tmpPix, (DrawablePtr) pPix, pGC, - 0, 0, pPix->drawable.width, - pPix->drawable.height, 0, 0); - - free(data); - tmpPix->devPrivate.ptr = NULL; - - FreeScratchGC(pGC); - FreeScratchPixmapHeader(tmpPix); - - pPriv->offscreenArea = area; - pLink->area = NULL; - pLink = pLink->next; - } -} - -void -XAARemoveAreaCallback(FBAreaPtr area) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(area->pScreen); - PixmapPtr pPix = (PixmapPtr) area->devPrivate.ptr; - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); - - XAAMoveOutOffscreenPixmap(pPix); - - pPriv->flags &= ~OFFSCREEN; - - DELIST_OFFSCREEN_PIXMAP(pPix); -} - -void -XAAMoveOutOffscreenPixmap(PixmapPtr pPix) -{ - ScreenPtr pScreen = pPix->drawable.pScreen; - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); - int width, height, devKind, bitsPerPixel; - PixmapPtr tmpPix; - unsigned char *data; - GCPtr pGC; - - width = pPix->drawable.width; - height = pPix->drawable.height; - bitsPerPixel = pPix->drawable.bitsPerPixel; - - devKind = BitmapBytePad(width * bitsPerPixel); - if (!(data = malloc(devKind * height))) - FatalError("Out of memory\n"); - - tmpPix = GetScratchPixmapHeader(pScreen, width, height, - pPix->drawable.depth, bitsPerPixel, devKind, - data); - if (!tmpPix) { - free(data); - FatalError("Out of memory\n"); - } - - pGC = GetScratchGC(pPix->drawable.depth, pScreen); - ValidateGC((DrawablePtr) tmpPix, pGC); - - (*pGC->ops->CopyArea) ((DrawablePtr) pPix, (DrawablePtr) tmpPix, - pGC, 0, 0, width, height, 0, 0); - - FreeScratchGC(pGC); - FreeScratchPixmapHeader(tmpPix); - - pPix->drawable.x = 0; - pPix->drawable.y = 0; - pPix->devKind = devKind; - pPix->devPrivate.ptr = data; - pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER; - - pPriv->offscreenArea = NULL; - pPriv->freeData = TRUE; -} diff --git a/xserver/hw/xfree86/xaa/xaaOverlay.c b/xserver/hw/xfree86/xaa/xaaOverlay.c deleted file mode 100644 index 25d18da96..000000000 --- a/xserver/hw/xfree86/xaa/xaaOverlay.c +++ /dev/null @@ -1,122 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "windowstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" -#include "xaawrap.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "mioverlay.h" - -#ifdef PANORAMIX -#include "panoramiX.h" -#include "panoramiXsrv.h" -#endif - -static void -XAACopyWindow8_32(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - DDXPointPtr pptSrc, ppt; - RegionRec rgnDst; - BoxPtr pbox; - int dx, dy, nbox; - WindowPtr pwinRoot; - ScreenPtr pScreen = pWin->drawable.pScreen; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable)); - Bool doUnderlay = miOverlayCopyUnderlay(pScreen); - RegionPtr borderClip = &pWin->borderClip; - Bool freeReg = FALSE; - - if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt || - (infoRec->ScreenToScreenBitBltFlags & NO_PLANEMASK)) { - XAA_SCREEN_PROLOGUE(pScreen, CopyWindow); - if (infoRec->pScrn->vtSema && infoRec->NeedToSync) { - (*infoRec->Sync) (infoRec->pScrn); - infoRec->NeedToSync = FALSE; - } - (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); - XAA_SCREEN_EPILOGUE(pScreen, CopyWindow, XAACopyWindow8_32); - return; - } - - pwinRoot = pScreen->root; - - if (doUnderlay) - freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip); - - RegionNull(&rgnDst); - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - RegionTranslate(prgnSrc, -dx, -dy); - RegionIntersect(&rgnDst, borderClip, prgnSrc); - - pbox = RegionRects(&rgnDst); - nbox = RegionNumRects(&rgnDst); - if (!nbox || !(pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) { - RegionUninit(&rgnDst); - return; - } - ppt = pptSrc; - - while (nbox--) { - ppt->x = pbox->x1 + dx; - ppt->y = pbox->y1 + dy; - ppt++; - pbox++; - } - - infoRec->ScratchGC.planemask = doUnderlay ? 0x00ffffff : 0xff000000; - infoRec->ScratchGC.alu = GXcopy; - - XAADoBitBlt((DrawablePtr) pwinRoot, (DrawablePtr) pwinRoot, - &(infoRec->ScratchGC), &rgnDst, pptSrc); - - free(pptSrc); - RegionUninit(&rgnDst); - if (freeReg) - RegionDestroy(borderClip); -} - -static void -XAASetColorKey8_32(ScreenPtr pScreen, int nbox, BoxPtr pbox) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - ScrnInfoPtr pScrn = infoRec->pScrn; - - /* I'm counting on writes being clipped away while switched away. - If this isn't going to be true then I need to be wrapping instead. */ - if (!infoRec->pScrn->vtSema) - return; - - (*infoRec->FillSolidRects) (pScrn, pScrn->colorKey << 24, GXcopy, - 0xff000000, nbox, pbox); - - SET_SYNC_FLAG(infoRec); -} - -void -XAASetupOverlay8_32Planar(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - int i; - - pScreen->CopyWindow = XAACopyWindow8_32; - - if (!(infoRec->FillSolidRectsFlags & NO_PLANEMASK)) - miOverlaySetTransFunction(pScreen, XAASetColorKey8_32); - - infoRec->FullPlanemask = ~0; - for (i = 0; i < 32; i++) /* haven't thought about this much */ - infoRec->FullPlanemasks[i] = ~0; -} diff --git a/xserver/hw/xfree86/xaa/xaaOverlayDF.c b/xserver/hw/xfree86/xaa/xaaOverlayDF.c deleted file mode 100644 index 5918f65a3..000000000 --- a/xserver/hw/xfree86/xaa/xaaOverlayDF.c +++ /dev/null @@ -1,906 +0,0 @@ -/* - Copyright (c) 1999 - The XFree86 Project Inc. - - Written by Mark Vojkovich -*/ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "xf86str.h" -#include "mi.h" -#include "miline.h" -#include "xaa.h" -#include "xaalocal.h" -#include "xaawrap.h" -#include "servermd.h" - -/* Screen funcs */ - -static void XAAOverCopyWindow(WindowPtr, DDXPointRec, RegionPtr); -static void XAAOverWindowExposures(WindowPtr, RegionPtr, RegionPtr); - -static int XAAOverStippledFillChooser(GCPtr); -static int XAAOverOpaqueStippledFillChooser(GCPtr); -static int XAAOverTiledFillChooser(GCPtr); - -/* GC funcs */ - -static RegionPtr XAAOverCopyArea(DrawablePtr, DrawablePtr, GC *, - int, int, int, int, int, int); -static RegionPtr XAAOverCopyPlane(DrawablePtr, DrawablePtr, GCPtr, - int, int, int, int, int, int, unsigned long); -static void XAAOverPushPixelsSolid(GCPtr, PixmapPtr, DrawablePtr, int, - int, int, int); -static void XAAOverPolyFillRectSolid(DrawablePtr, GCPtr, int, xRectangle *); -static void XAAOverPolyFillRectStippled(DrawablePtr, GCPtr, int, xRectangle *); -static void XAAOverPolyFillRectOpaqueStippled(DrawablePtr, GCPtr, - int, xRectangle *); -static void XAAOverPolyFillRectTiled(DrawablePtr, GCPtr, int, xRectangle *); -static void XAAOverFillSpansSolid(DrawablePtr, GCPtr, int, DDXPointPtr, - int *, int); -static void XAAOverFillSpansStippled(DrawablePtr, GCPtr, int, DDXPointPtr, - int *, int); -static void XAAOverFillSpansOpaqueStippled(DrawablePtr, GCPtr, int, - DDXPointPtr, int *, int); -static void XAAOverFillSpansTiled(DrawablePtr, GCPtr, int, DDXPointPtr, - int *, int); -static int XAAOverPolyText8TE(DrawablePtr, GCPtr, int, int, int, char *); -static int XAAOverPolyText16TE(DrawablePtr, GCPtr, int, int, int, - unsigned short *); -static void XAAOverImageText8TE(DrawablePtr, GCPtr, int, int, int, char *); -static void XAAOverImageText16TE(DrawablePtr, GCPtr, int, int, int, - unsigned short *); -static void XAAOverImageGlyphBltTE(DrawablePtr, GCPtr, int, int, - unsigned int, CharInfoPtr *, pointer); -static void XAAOverPolyGlyphBltTE(DrawablePtr, GCPtr, int, int, - unsigned int, CharInfoPtr *, pointer); -static int XAAOverPolyText8NonTE(DrawablePtr, GCPtr, int, int, int, char *); -static int XAAOverPolyText16NonTE(DrawablePtr, GCPtr, int, int, int, - unsigned short *); -static void XAAOverImageText8NonTE(DrawablePtr, GCPtr, int, int, int, char *); -static void XAAOverImageText16NonTE(DrawablePtr, GCPtr, int, int, int, - unsigned short *); -static void XAAOverImageGlyphBltNonTE(DrawablePtr, GCPtr, int, int, - unsigned int, CharInfoPtr *, pointer); -static void XAAOverPolyGlyphBltNonTE(DrawablePtr, GCPtr, int, int, - unsigned int, CharInfoPtr *, pointer); -static void XAAOverPolyRectangleThinSolid(DrawablePtr, GCPtr, int, - xRectangle *); -static void XAAOverPolylinesWideSolid(DrawablePtr, GCPtr, int, int, - DDXPointPtr); -static void XAAOverPolylinesThinSolid(DrawablePtr, GCPtr, int, int, - DDXPointPtr); -static void XAAOverPolySegmentThinSolid(DrawablePtr, GCPtr, int, xSegment *); -static void XAAOverPolylinesThinDashed(DrawablePtr, GCPtr, int, int, - DDXPointPtr); -static void XAAOverPolySegmentThinDashed(DrawablePtr, GCPtr, int, xSegment *); -static void XAAOverFillPolygonSolid(DrawablePtr, GCPtr, int, int, int, - DDXPointPtr); -static void XAAOverFillPolygonStippled(DrawablePtr, GCPtr, int, int, int, - DDXPointPtr); -static void XAAOverFillPolygonOpaqueStippled(DrawablePtr, GCPtr, int, int, int, - DDXPointPtr); -static void XAAOverFillPolygonTiled(DrawablePtr, GCPtr, int, int, int, - DDXPointPtr); -static void XAAOverPolyFillArcSolid(DrawablePtr, GCPtr, int, xArc *); -static void XAAOverPutImage(DrawablePtr, GCPtr, int, int, int, int, int, - int, int, char *); - -typedef struct { - ScrnInfoPtr pScrn; - DepthChangeFuncPtr callback; - int currentDepth; -/* GC funcs */ - RegionPtr (*CopyArea) (DrawablePtr, DrawablePtr, GC *, - int, int, int, int, int, int); - RegionPtr (*CopyPlane) (DrawablePtr, DrawablePtr, GCPtr, - int, int, int, int, int, int, unsigned long); - void (*PushPixelsSolid) (GCPtr, PixmapPtr, DrawablePtr, int, int, int, int); - void (*PolyFillRectSolid) (DrawablePtr, GCPtr, int, xRectangle *); - void (*PolyFillRectStippled) (DrawablePtr, GCPtr, int, xRectangle *); - void (*PolyFillRectOpaqueStippled) (DrawablePtr, GCPtr, int, xRectangle *); - void (*PolyFillRectTiled) (DrawablePtr, GCPtr, int, xRectangle *); - void (*FillSpansSolid) (DrawablePtr, GCPtr, int, DDXPointPtr, int *, int); - void (*FillSpansStippled) (DrawablePtr, GCPtr, int, DDXPointPtr, int *, - int); - void (*FillSpansOpaqueStippled) (DrawablePtr, GCPtr, int, DDXPointPtr, - int *, int); - void (*FillSpansTiled) (DrawablePtr, GCPtr, int, DDXPointPtr, int *, int); - int (*PolyText8TE) (DrawablePtr, GCPtr, int, int, int, char *); - int (*PolyText16TE) (DrawablePtr, GCPtr, int, int, int, unsigned short *); - void (*ImageText8TE) (DrawablePtr, GCPtr, int, int, int, char *); - void (*ImageText16TE) (DrawablePtr, GCPtr, int, int, int, unsigned short *); - void (*ImageGlyphBltTE) (DrawablePtr, GCPtr, int, int, unsigned int, - CharInfoPtr *, pointer); - void (*PolyGlyphBltTE) (DrawablePtr, GCPtr, int, int, unsigned int, - CharInfoPtr *, pointer); - int (*PolyText8NonTE) (DrawablePtr, GCPtr, int, int, int, char *); - int (*PolyText16NonTE) (DrawablePtr, GCPtr, int, int, int, - unsigned short *); - void (*ImageText8NonTE) (DrawablePtr, GCPtr, int, int, int, char *); - void (*ImageText16NonTE) (DrawablePtr, GCPtr, int, int, int, - unsigned short *); - void (*ImageGlyphBltNonTE) (DrawablePtr, GCPtr, int, int, unsigned int, - CharInfoPtr *, pointer); - void (*PolyGlyphBltNonTE) (DrawablePtr, GCPtr, int, int, unsigned int, - CharInfoPtr *, pointer); - void (*PolyRectangleThinSolid) (DrawablePtr, GCPtr, int, xRectangle *); - void (*PolylinesWideSolid) (DrawablePtr, GCPtr, int, int, DDXPointPtr); - - void (*PolylinesThinSolid) (DrawablePtr, GCPtr, int, int, DDXPointPtr); - void (*PolySegmentThinSolid) (DrawablePtr, GCPtr, int, xSegment *); - void (*PolylinesThinDashed) (DrawablePtr, GCPtr, int, int, DDXPointPtr); - void (*PolySegmentThinDashed) (DrawablePtr, GCPtr, int, xSegment *); - void (*FillPolygonSolid) (DrawablePtr, GCPtr, int, int, int, DDXPointPtr); - void (*FillPolygonStippled) (DrawablePtr, GCPtr, int, int, int, - DDXPointPtr); - void (*FillPolygonOpaqueStippled) (DrawablePtr, GCPtr, int, int, int, - DDXPointPtr); - void (*FillPolygonTiled) (DrawablePtr, GCPtr, int, int, int, DDXPointPtr); - void (*PolyFillArcSolid) (DrawablePtr, GCPtr, int, xArc *); - void (*PutImage) (DrawablePtr, GCPtr, int, int, int, int, int, int, - int, char *); - int (*StippledFillChooser) (GCPtr); - int (*OpaqueStippledFillChooser) (GCPtr); - int (*TiledFillChooser) (GCPtr); -} XAAOverlayRec, *XAAOverlayPtr; - -static DevPrivateKeyRec XAAOverlayKeyRec; - -#define XAAOverlayKey (&XAAOverlayKeyRec) - -#define GET_OVERLAY_PRIV(pScreen) \ - (XAAOverlayPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAOverlayKey) - -#define SWITCH_DEPTH(d) \ - if(pOverPriv->currentDepth != d) { \ - (*pOverPriv->callback)(pOverPriv->pScrn, d); \ - pOverPriv->currentDepth = d; \ - } - -Bool -XAAInitDualFramebufferOverlay(ScreenPtr pScreen, DepthChangeFuncPtr callback) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - XAAOverlayPtr pOverPriv; - - if (!dixRegisterPrivateKey(&XAAOverlayKeyRec, PRIVATE_SCREEN, 0)) - return FALSE; - - if (!(pOverPriv = malloc(sizeof(XAAOverlayRec)))) - return FALSE; - - dixSetPrivate(&pScreen->devPrivates, XAAOverlayKey, pOverPriv); - - pOverPriv->pScrn = pScrn; - pOverPriv->callback = callback; - pOverPriv->currentDepth = -1; - - /* Overwrite key screen functions. The XAA core will clean up */ - - pScreen->CopyWindow = XAAOverCopyWindow; - pScreen->WindowExposures = XAAOverWindowExposures; - - pOverPriv->StippledFillChooser = infoRec->StippledFillChooser; - pOverPriv->OpaqueStippledFillChooser = infoRec->OpaqueStippledFillChooser; - pOverPriv->TiledFillChooser = infoRec->TiledFillChooser; - - infoRec->StippledFillChooser = XAAOverStippledFillChooser; - infoRec->OpaqueStippledFillChooser = XAAOverOpaqueStippledFillChooser; - infoRec->TiledFillChooser = XAAOverTiledFillChooser; - - /* wrap all XAA GC rendering */ - - pOverPriv->CopyArea = infoRec->CopyArea; - pOverPriv->CopyPlane = infoRec->CopyPlane; - pOverPriv->PushPixelsSolid = infoRec->PushPixelsSolid; - pOverPriv->PolyFillRectSolid = infoRec->PolyFillRectSolid; - pOverPriv->PolyFillRectStippled = infoRec->PolyFillRectStippled; - pOverPriv->PolyFillRectOpaqueStippled = infoRec->PolyFillRectOpaqueStippled; - pOverPriv->PolyFillRectTiled = infoRec->PolyFillRectTiled; - pOverPriv->FillSpansSolid = infoRec->FillSpansSolid; - pOverPriv->FillSpansStippled = infoRec->FillSpansStippled; - pOverPriv->FillSpansOpaqueStippled = infoRec->FillSpansOpaqueStippled; - pOverPriv->FillSpansTiled = infoRec->FillSpansTiled; - pOverPriv->PolyText8TE = infoRec->PolyText8TE; - pOverPriv->PolyText16TE = infoRec->PolyText16TE; - pOverPriv->ImageText8TE = infoRec->ImageText8TE; - pOverPriv->ImageText16TE = infoRec->ImageText16TE; - pOverPriv->ImageGlyphBltTE = infoRec->ImageGlyphBltTE; - pOverPriv->PolyGlyphBltTE = infoRec->PolyGlyphBltTE; - pOverPriv->PolyText8NonTE = infoRec->PolyText8NonTE; - pOverPriv->PolyText16NonTE = infoRec->PolyText16NonTE; - pOverPriv->ImageText8NonTE = infoRec->ImageText8NonTE; - pOverPriv->ImageText16NonTE = infoRec->ImageText16NonTE; - pOverPriv->ImageGlyphBltNonTE = infoRec->ImageGlyphBltNonTE; - pOverPriv->PolyGlyphBltNonTE = infoRec->PolyGlyphBltNonTE; - pOverPriv->PolyRectangleThinSolid = infoRec->PolyRectangleThinSolid; - pOverPriv->PolylinesWideSolid = infoRec->PolylinesWideSolid; - pOverPriv->PolylinesThinSolid = infoRec->PolylinesThinSolid; - pOverPriv->PolySegmentThinSolid = infoRec->PolySegmentThinSolid; - pOverPriv->PolylinesThinDashed = infoRec->PolylinesThinDashed; - pOverPriv->PolySegmentThinDashed = infoRec->PolySegmentThinDashed; - pOverPriv->FillPolygonSolid = infoRec->FillPolygonSolid; - pOverPriv->FillPolygonStippled = infoRec->FillPolygonStippled; - pOverPriv->FillPolygonOpaqueStippled = infoRec->FillPolygonOpaqueStippled; - pOverPriv->FillPolygonTiled = infoRec->FillPolygonTiled; - pOverPriv->PolyFillArcSolid = infoRec->PolyFillArcSolid; - pOverPriv->PutImage = infoRec->PutImage; - - if (infoRec->CopyArea) - infoRec->CopyArea = XAAOverCopyArea; - if (infoRec->CopyPlane) - infoRec->CopyPlane = XAAOverCopyPlane; - if (infoRec->PushPixelsSolid) - infoRec->PushPixelsSolid = XAAOverPushPixelsSolid; - if (infoRec->PolyFillRectSolid) - infoRec->PolyFillRectSolid = XAAOverPolyFillRectSolid; - if (infoRec->PolyFillRectStippled) - infoRec->PolyFillRectStippled = XAAOverPolyFillRectStippled; - if (infoRec->PolyFillRectOpaqueStippled) - infoRec->PolyFillRectOpaqueStippled = XAAOverPolyFillRectOpaqueStippled; - if (infoRec->PolyFillRectTiled) - infoRec->PolyFillRectTiled = XAAOverPolyFillRectTiled; - if (infoRec->FillSpansSolid) - infoRec->FillSpansSolid = XAAOverFillSpansSolid; - if (infoRec->FillSpansStippled) - infoRec->FillSpansStippled = XAAOverFillSpansStippled; - if (infoRec->FillSpansOpaqueStippled) - infoRec->FillSpansOpaqueStippled = XAAOverFillSpansOpaqueStippled; - if (infoRec->FillSpansTiled) - infoRec->FillSpansTiled = XAAOverFillSpansTiled; - if (infoRec->PolyText8TE) - infoRec->PolyText8TE = XAAOverPolyText8TE; - if (infoRec->PolyText16TE) - infoRec->PolyText16TE = XAAOverPolyText16TE; - if (infoRec->ImageText8TE) - infoRec->ImageText8TE = XAAOverImageText8TE; - if (infoRec->ImageText16TE) - infoRec->ImageText16TE = XAAOverImageText16TE; - if (infoRec->ImageGlyphBltTE) - infoRec->ImageGlyphBltTE = XAAOverImageGlyphBltTE; - if (infoRec->PolyGlyphBltTE) - infoRec->PolyGlyphBltTE = XAAOverPolyGlyphBltTE; - if (infoRec->PolyText8NonTE) - infoRec->PolyText8NonTE = XAAOverPolyText8NonTE; - if (infoRec->PolyText16NonTE) - infoRec->PolyText16NonTE = XAAOverPolyText16NonTE; - if (infoRec->ImageText8NonTE) - infoRec->ImageText8NonTE = XAAOverImageText8NonTE; - if (infoRec->ImageText16NonTE) - infoRec->ImageText16NonTE = XAAOverImageText16NonTE; - if (infoRec->ImageGlyphBltNonTE) - infoRec->ImageGlyphBltNonTE = XAAOverImageGlyphBltNonTE; - if (infoRec->PolyGlyphBltNonTE) - infoRec->PolyGlyphBltNonTE = XAAOverPolyGlyphBltNonTE; - if (infoRec->PolyRectangleThinSolid) - infoRec->PolyRectangleThinSolid = XAAOverPolyRectangleThinSolid; - if (infoRec->PolylinesWideSolid) - infoRec->PolylinesWideSolid = XAAOverPolylinesWideSolid; - if (infoRec->PolylinesThinSolid) - infoRec->PolylinesThinSolid = XAAOverPolylinesThinSolid; - if (infoRec->PolySegmentThinSolid) - infoRec->PolySegmentThinSolid = XAAOverPolySegmentThinSolid; - if (infoRec->PolylinesThinDashed) - infoRec->PolylinesThinDashed = XAAOverPolylinesThinDashed; - if (infoRec->PolySegmentThinDashed) - infoRec->PolySegmentThinDashed = XAAOverPolySegmentThinDashed; - if (infoRec->FillPolygonSolid) - infoRec->FillPolygonSolid = XAAOverFillPolygonSolid; - if (infoRec->FillPolygonStippled) - infoRec->FillPolygonStippled = XAAOverFillPolygonStippled; - if (infoRec->FillPolygonOpaqueStippled) - infoRec->FillPolygonOpaqueStippled = XAAOverFillPolygonOpaqueStippled; - if (infoRec->FillPolygonTiled) - infoRec->FillPolygonTiled = XAAOverFillPolygonTiled; - if (infoRec->PolyFillArcSolid) - infoRec->PolyFillArcSolid = XAAOverPolyFillArcSolid; - if (infoRec->PutImage) - infoRec->PutImage = XAAOverPutImage; - - return TRUE; -} - -/*********************** Screen functions ************************/ - -void -XAAOverCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen); - ScrnInfoPtr pScrn = infoRec->pScrn; - DDXPointPtr ppt, pptSrc; - RegionRec rgnDst; - BoxPtr pbox; - int i, nbox, dx, dy; - WindowPtr pRoot = pScreen->root; - - if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) { - XAA_SCREEN_PROLOGUE(pScreen, CopyWindow); - if (pScrn->vtSema && infoRec->NeedToSync) { - (*infoRec->Sync) (pScrn); - infoRec->NeedToSync = FALSE; - } - (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); - XAA_SCREEN_EPILOGUE(pScreen, CopyWindow, XAAOverCopyWindow); - return; - } - - infoRec->ScratchGC.alu = GXcopy; - infoRec->ScratchGC.planemask = ~0; - - RegionNull(&rgnDst); - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - RegionTranslate(prgnSrc, -dx, -dy); - RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); - - nbox = RegionNumRects(&rgnDst); - if (nbox && (pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) { - - pbox = RegionRects(&rgnDst); - for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) { - ppt->x = pbox->x1 + dx; - ppt->y = pbox->y1 + dy; - } - - SWITCH_DEPTH(8); - XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot, - &(infoRec->ScratchGC), &rgnDst, pptSrc); - - if (pWin->drawable.bitsPerPixel != 8) { - SWITCH_DEPTH(pScrn->depth); - XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot, - &(infoRec->ScratchGC), &rgnDst, pptSrc); - } - - free(pptSrc); - } - - RegionUninit(&rgnDst); - - if (pWin->drawable.depth == 8) { - RegionNull(&rgnDst); - miSegregateChildren(pWin, &rgnDst, pScrn->depth); - if (RegionNotEmpty(&rgnDst)) { - RegionIntersect(&rgnDst, &rgnDst, prgnSrc); - nbox = RegionNumRects(&rgnDst); - if (nbox && - (pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) { - - pbox = RegionRects(&rgnDst); - for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) { - ppt->x = pbox->x1 + dx; - ppt->y = pbox->y1 + dy; - } - - SWITCH_DEPTH(pScrn->depth); - XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot, - &(infoRec->ScratchGC), &rgnDst, pptSrc); - free(pptSrc); - } - } - RegionUninit(&rgnDst); - } -} - -void -XAAOverWindowExposures(WindowPtr pWin, RegionPtr pReg, RegionPtr pOtherReg) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - - if ((pWin->drawable.bitsPerPixel != 8) && infoRec->pScrn->vtSema) { - if (RegionNumRects(pReg) && infoRec->FillSolidRects) { - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen); - - SWITCH_DEPTH(8); - (*infoRec->FillSolidRects) (infoRec->pScrn, - infoRec->pScrn->colorKey, GXcopy, ~0, - RegionNumRects(pReg), - RegionRects(pReg)); - miWindowExposures(pWin, pReg, pOtherReg); - return; - } - else if (infoRec->NeedToSync) { - (*infoRec->Sync) (infoRec->pScrn); - infoRec->NeedToSync = FALSE; - } - } - - XAA_SCREEN_PROLOGUE(pScreen, WindowExposures); - (*pScreen->WindowExposures) (pWin, pReg, pOtherReg); - XAA_SCREEN_EPILOGUE(pScreen, WindowExposures, XAAOverWindowExposures); -} - -/********************* Choosers *************************/ - -static int -XAAOverStippledFillChooser(GCPtr pGC) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - int ret; - - ret = (*pOverPriv->StippledFillChooser) (pGC); - - if ((pGC->depth == 8) && ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) { - ret = 0; - } - - return ret; -} - -static int -XAAOverOpaqueStippledFillChooser(GCPtr pGC) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - int ret; - - ret = (*pOverPriv->OpaqueStippledFillChooser) (pGC); - - if ((pGC->depth == 8) && ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) { - ret = 0; - } - - return ret; -} - -static int -XAAOverTiledFillChooser(GCPtr pGC) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - int ret; - - ret = (*pOverPriv->TiledFillChooser) (pGC); - - if ((pGC->depth == 8) && ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) { - ret = 0; - } - - return ret; -} - -/**************************** GC Functions **************************/ - -static RegionPtr -XAAOverCopyArea(DrawablePtr pSrc, - DrawablePtr pDst, - GC * pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - return (*pOverPriv->CopyArea) (pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty); -} - -static RegionPtr -XAAOverCopyPlane(DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, unsigned long bitPlane) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - return (*pOverPriv->CopyPlane) (pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty, - bitPlane); - -} - -static void -XAAOverPushPixelsSolid(GCPtr pGC, - PixmapPtr pBitMap, - DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PushPixelsSolid) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); -} - -static void -XAAOverPolyFillRectSolid(DrawablePtr pDraw, - GCPtr pGC, int nrectFill, xRectangle *prectInit) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolyFillRectSolid) (pDraw, pGC, nrectFill, prectInit); -} - -static void -XAAOverPolyFillRectStippled(DrawablePtr pDraw, - GCPtr pGC, int nrectFill, xRectangle *prectInit) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolyFillRectStippled) (pDraw, pGC, nrectFill, prectInit); -} - -static void -XAAOverPolyFillRectOpaqueStippled(DrawablePtr pDraw, - GCPtr pGC, - int nrectFill, xRectangle *prectInit) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolyFillRectOpaqueStippled) (pDraw, pGC, nrectFill, prectInit); -} - -static void -XAAOverPolyFillRectTiled(DrawablePtr pDraw, - GCPtr pGC, int nrectFill, xRectangle *prectInit) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolyFillRectTiled) (pDraw, pGC, nrectFill, prectInit); -} - -static void -XAAOverFillSpansSolid(DrawablePtr pDraw, - GCPtr pGC, - int nInit, DDXPointPtr ppt, int *pwidth, int fSorted) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->FillSpansSolid) (pDraw, pGC, nInit, ppt, pwidth, fSorted); -} - -static void -XAAOverFillSpansStippled(DrawablePtr pDraw, - GCPtr pGC, - int nInit, DDXPointPtr ppt, int *pwidth, int fSorted) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->FillSpansStippled) (pDraw, pGC, nInit, ppt, pwidth, fSorted); -} - -static void -XAAOverFillSpansOpaqueStippled(DrawablePtr pDraw, - GCPtr pGC, - int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->FillSpansOpaqueStippled) (pDraw, pGC, nInit, ppt, pwidth, - fSorted); -} - -static void -XAAOverFillSpansTiled(DrawablePtr pDraw, - GCPtr pGC, - int nInit, DDXPointPtr ppt, int *pwidth, int fSorted) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->FillSpansTiled) (pDraw, pGC, nInit, ppt, pwidth, fSorted); -} - -static int -XAAOverPolyText8TE(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - return (*pOverPriv->PolyText8TE) (pDraw, pGC, x, y, count, chars); -} - -static int -XAAOverPolyText16TE(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, unsigned short *chars) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - return (*pOverPriv->PolyText16TE) (pDraw, pGC, x, y, count, chars); -} - -static void -XAAOverImageText8TE(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->ImageText8TE) (pDraw, pGC, x, y, count, chars); -} - -static void -XAAOverImageText16TE(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, unsigned short *chars) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->ImageText16TE) (pDraw, pGC, x, y, count, chars); -} - -static void -XAAOverImageGlyphBltTE(DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->ImageGlyphBltTE) (pDraw, pGC, xInit, yInit, nglyph, ppci, - pglyphBase); -} - -static void -XAAOverPolyGlyphBltTE(DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolyGlyphBltTE) (pDraw, pGC, xInit, yInit, nglyph, ppci, - pglyphBase); -} - -static int -XAAOverPolyText8NonTE(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - return (*pOverPriv->PolyText8NonTE) (pDraw, pGC, x, y, count, chars); -} - -static int -XAAOverPolyText16NonTE(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - return (*pOverPriv->PolyText16NonTE) (pDraw, pGC, x, y, count, chars); -} - -static void -XAAOverImageText8NonTE(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->ImageText8NonTE) (pDraw, pGC, x, y, count, chars); -} - -static void -XAAOverImageText16NonTE(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->ImageText16NonTE) (pDraw, pGC, x, y, count, chars); -} - -static void -XAAOverImageGlyphBltNonTE(DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->ImageGlyphBltNonTE) (pDraw, pGC, xInit, yInit, nglyph, ppci, - pglyphBase); -} - -static void -XAAOverPolyGlyphBltNonTE(DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolyGlyphBltNonTE) (pDraw, pGC, xInit, yInit, nglyph, ppci, - pglyphBase); -} - -static void -XAAOverPolyRectangleThinSolid(DrawablePtr pDraw, - GCPtr pGC, int nRectsInit, xRectangle *pRectsInit) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolyRectangleThinSolid) (pDraw, pGC, nRectsInit, pRectsInit); -} - -static void -XAAOverPolylinesWideSolid(DrawablePtr pDraw, - GCPtr pGC, int mode, int npt, DDXPointPtr pPts) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolylinesWideSolid) (pDraw, pGC, mode, npt, pPts); -} - -static void -XAAOverPolylinesThinSolid(DrawablePtr pDraw, - GCPtr pGC, int mode, int npt, DDXPointPtr pPts) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolylinesThinSolid) (pDraw, pGC, mode, npt, pPts); -} - -static void -XAAOverPolySegmentThinSolid(DrawablePtr pDraw, - GCPtr pGC, int nseg, xSegment * pSeg) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolySegmentThinSolid) (pDraw, pGC, nseg, pSeg); -} - -static void -XAAOverPolylinesThinDashed(DrawablePtr pDraw, - GCPtr pGC, int mode, int npt, DDXPointPtr pPts) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolylinesThinDashed) (pDraw, pGC, mode, npt, pPts); -} - -static void -XAAOverPolySegmentThinDashed(DrawablePtr pDraw, - GCPtr pGC, int nseg, xSegment * pSeg) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolySegmentThinDashed) (pDraw, pGC, nseg, pSeg); -} - -static void -XAAOverFillPolygonSolid(DrawablePtr pDraw, - GCPtr pGC, - int shape, int mode, int count, DDXPointPtr ptsIn) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->FillPolygonSolid) (pDraw, pGC, shape, mode, count, ptsIn); -} - -static void -XAAOverFillPolygonStippled(DrawablePtr pDraw, - GCPtr pGC, - int shape, int mode, int count, DDXPointPtr ptsIn) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->FillPolygonStippled) (pDraw, pGC, shape, mode, count, ptsIn); -} - -static void -XAAOverFillPolygonOpaqueStippled(DrawablePtr pDraw, - GCPtr pGC, - int shape, - int mode, int count, DDXPointPtr ptsIn) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->FillPolygonOpaqueStippled) (pDraw, pGC, shape, mode, count, - ptsIn); -} - -static void -XAAOverFillPolygonTiled(DrawablePtr pDraw, - GCPtr pGC, - int shape, int mode, int count, DDXPointPtr ptsIn) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->FillPolygonTiled) (pDraw, pGC, shape, mode, count, ptsIn); -} - -static void -XAAOverPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PolyFillArcSolid) (pDraw, pGC, narcs, parcs); -} - -static void -XAAOverPutImage(DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, - int y, int w, int h, int leftPad, int format, char *pImage) -{ - XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen); - - SWITCH_DEPTH(pGC->depth); - - (*pOverPriv->PutImage) (pDraw, pGC, depth, x, y, w, h, - leftPad, format, pImage); -} diff --git a/xserver/hw/xfree86/xaa/xaaPCache.c b/xserver/hw/xfree86/xaa/xaaPCache.c deleted file mode 100644 index 02c0cd498..000000000 --- a/xserver/hw/xfree86/xaa/xaaPCache.c +++ /dev/null @@ -1,2527 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <string.h> - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "gc.h" -#include "mi.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "regionstr.h" -#include "servermd.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaacexp.h" -#include "xaalocal.h" -#include "xaawrap.h" - -#define MAX_COLOR 32 -#define MAX_MONO 32 -#define MAX_8 32 -#define MAX_128 32 -#define MAX_256 32 -#define MAX_512 16 - -static int CacheInitIndex = -1; - -#define CACHEINIT(p) ((p)->privates[CacheInitIndex].val) - -typedef struct _CacheLink { - int x; - int y; - int w; - int h; - struct _CacheLink *next; -} CacheLink, *CacheLinkPtr; - -static void -TransferList(CacheLinkPtr list, XAACacheInfoPtr array, int num) -{ - while (num--) { - array->x = list->x; - array->y = list->y; - array->w = list->w; - array->h = list->h; - array->serialNumber = 0; - array->fg = array->bg = -1; - list = list->next; - array++; - } -} - -static CacheLinkPtr -Enlist(CacheLinkPtr link, int x, int y, int w, int h) -{ - CacheLinkPtr newLink; - - newLink = malloc(sizeof(CacheLink)); - newLink->next = link; - newLink->x = x; - newLink->y = y; - newLink->w = w; - newLink->h = h; - return newLink; -} - -static CacheLinkPtr -Delist(CacheLinkPtr link) -{ - CacheLinkPtr ret = NULL; - - if (link) { - ret = link->next; - free(link); - } - return ret; -} - -static void -FreeList(CacheLinkPtr link) -{ - CacheLinkPtr tmp; - - while (link) { - tmp = link; - link = link->next; - free(tmp); - } -} - -static CacheLinkPtr -QuadLinks(CacheLinkPtr big, CacheLinkPtr little) -{ - /* CAUTION: This doesn't free big */ - int w1, w2, h1, h2; - - while (big) { - w1 = big->w >> 1; - w2 = big->w - w1; - h1 = big->h >> 1; - h2 = big->h - h1; - - little = Enlist(little, big->x, big->y, w1, h1); - little = Enlist(little, big->x + w1, big->y, w2, h1); - little = Enlist(little, big->x, big->y + h1, w1, h2); - little = Enlist(little, big->x + w1, big->y + h1, w2, h2); - - big = big->next; - } - return little; -} - -static void -SubdivideList(CacheLinkPtr * large, CacheLinkPtr * small) -{ - CacheLinkPtr big = *large; - CacheLinkPtr little = *small; - int size = big->w >> 1; - - little = Enlist(little, big->x, big->y, size, size); - little = Enlist(little, big->x + size, big->y, size, size); - little = Enlist(little, big->x, big->y + size, size, size); - little = Enlist(little, big->x + size, big->y + size, size, size); - *small = little; - big = Delist(big); - *large = big; -} - -static void -FreePixmapCachePrivate(XAAPixmapCachePrivatePtr pPriv) -{ - if (!pPriv) - return; - - free(pPriv->Info512); - free(pPriv->Info256); - free(pPriv->Info128); - free(pPriv->InfoColor); - free(pPriv->InfoMono); - free(pPriv->InfoPartial); - - free(pPriv); -} - -void -XAAClosePixmapCache(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - - if (infoRec->PixmapCachePrivate) - FreePixmapCachePrivate((XAAPixmapCachePrivatePtr) infoRec-> - PixmapCachePrivate); - - infoRec->PixmapCachePrivate = NULL; -} - -static CacheLinkPtr -ThinOutPartials(CacheLinkPtr ListPartial, int *num, int *maxw, int *maxh) -{ -/* This guy's job is to get at least 4 big slots out of a list of fragments */ - - CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers; - int Num64, Num32, Num16, Num8, NumKeepers; - int w, h; - - List64 = List32 = List16 = List8 = ListKeepers = NULL; - Num64 = Num32 = Num16 = Num8 = NumKeepers = 0; - w = h = 0; - - /* We sort partials by how large a square tile they can cache. - If a partial can't store a 64x64, 32x32, 16x16 or 8x8 tile, - we free it. */ - - pCur = ListPartial; - while (pCur) { - next = pCur->next; - if ((pCur->w >= 64) && (pCur->h >= 64)) { - pCur->next = List64; - List64 = pCur; - Num64++; - } - else if ((pCur->w >= 32) && (pCur->h >= 32)) { - pCur->next = List32; - List32 = pCur; - Num32++; - } - else if ((pCur->w >= 16) && (pCur->h >= 16)) { - pCur->next = List16; - List16 = pCur; - Num16++; - } - else if ((pCur->w >= 8) && (pCur->h >= 8)) { - pCur->next = List8; - List8 = pCur; - Num8++; - } - else { - free(pCur); - } - - pCur = next; - } - - /* We save all the tiles from the largest bin that we can get - at least 4 of. If there are too few of a bigger slot, we - cut it in fourths to make smaller slots. */ - - if (Num64 >= 4) { - ListKeepers = List64; - List64 = NULL; - NumKeepers = Num64; - goto GOT_EM; - } - else if (Num64) { - List32 = QuadLinks(List64, List32); - Num32 += Num64 * 4; - Num64 = 0; - } - - if (Num32 >= 4) { - ListKeepers = List32; - List32 = NULL; - NumKeepers = Num32; - goto GOT_EM; - } - else if (Num32) { - List16 = QuadLinks(List32, List16); - Num16 += Num32 * 4; - Num32 = 0; - } - - if (Num16 >= 4) { - ListKeepers = List16; - List16 = NULL; - NumKeepers = Num16; - goto GOT_EM; - } - else if (Num16) { - List8 = QuadLinks(List16, List8); - Num8 += Num16 * 4; - Num16 = 0; - } - - if (Num8 >= 4) { - ListKeepers = List8; - List8 = NULL; - NumKeepers = Num8; - goto GOT_EM; - } - - GOT_EM: - - /* Free the ones we aren't using */ - - if (List64) - FreeList(List64); - if (List32) - FreeList(List32); - if (List16) - FreeList(List16); - if (List8) - FreeList(List8); - - /* Enlarge the slots if we can */ - - if (ListKeepers) { - CacheLinkPtr pLink = ListKeepers; - - w = h = 128; - - while (pLink) { - if (pLink->w < w) - w = pLink->w; - if (pLink->h < h) - h = pLink->h; - pLink = pLink->next; - } - } - - *maxw = w; - *maxh = h; - *num = NumKeepers; - return ListKeepers; -} - -static void -ConvertColorToMono(CacheLinkPtr * ColorList, - int ColorW, int ColorH, - CacheLinkPtr * MonoList, int MonoW, int MonoH) -{ - int x, y, w; - - x = (*ColorList)->x; - y = (*ColorList)->y; - *ColorList = Delist(*ColorList); - - while (ColorH) { - ColorH -= MonoH; - for (w = 0; w <= (ColorW - MonoW); w += MonoW) - *MonoList = Enlist(*MonoList, x + w, y + ColorH, MonoW, MonoH); - } -} - -static void -ConvertAllPartialsTo8x8(int *NumMono, int *NumColor, - CacheLinkPtr ListPartial, - CacheLinkPtr * ListMono, - CacheLinkPtr * ListColor, XAAInfoRecPtr infoRec) -{ -/* This guy extracts as many 8x8 slots as it can out of fragments */ - - int ColorH = infoRec->CacheHeightColor8x8Pattern; - int ColorW = infoRec->CacheWidthColor8x8Pattern; - int MonoH = infoRec->CacheHeightMono8x8Pattern; - int MonoW = infoRec->CacheWidthMono8x8Pattern; - int x, y, w, Height, Width; - Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8); - Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8); - CacheLinkPtr pLink = ListPartial; - CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor; - - if (DoColor && DoMono) { - /* we assume color patterns take more space than color ones */ - if (MonoH > ColorH) - ColorH = MonoH; - if (MonoW > ColorW) - ColorW = MonoW; - } - - /* Break up the area into as many Color and Mono slots as we can */ - - while (pLink) { - Height = pLink->h; - Width = pLink->w; - x = pLink->x; - y = pLink->y; - - if (DoColor) { - while (Height >= ColorH) { - Height -= ColorH; - for (w = 0; w <= (Width - ColorW); w += ColorW) { - ColorList = - Enlist(ColorList, x + w, y + Height, ColorW, ColorH); - (*NumColor)++; - } - } - } - - if (DoMono && (Height >= MonoH)) { - while (Height >= MonoH) { - Height -= MonoH; - for (w = 0; w <= (Width - MonoW); w += MonoW) { - MonoList = - Enlist(MonoList, x + w, y + Height, MonoW, MonoH); - (*NumMono)++; - } - } - } - - pLink = pLink->next; - } - - *ListMono = MonoList; - *ListColor = ColorList; - FreeList(ListPartial); -} - -static CacheLinkPtr -ExtractOneThatFits(CacheLinkPtr * initList, int w, int h) -{ - CacheLinkPtr list = *initList; - CacheLinkPtr prev = NULL; - - while (list) { - if ((list->w >= w) && (list->h >= h)) - break; - prev = list; - list = list->next; - } - - if (list) { - if (prev) - prev->next = list->next; - else - *initList = list->next; - - list->next = NULL; - } - - return list; -} - -static CacheLinkPtr -ConvertSomePartialsTo8x8(int *NumMono, int *NumColor, int *NumPartial, - CacheLinkPtr ListPartial, - CacheLinkPtr * ListMono, - CacheLinkPtr * ListColor, - int *maxw, int *maxh, XAAInfoRecPtr infoRec) -{ -/* This guy tries to get 4 of each type of 8x8 slot requested out of - a list of fragments all while trying to retain some big fragments - for the cache blits */ - - int ColorH = infoRec->CacheHeightColor8x8Pattern; - int ColorW = infoRec->CacheWidthColor8x8Pattern; - int MonoH = infoRec->CacheHeightMono8x8Pattern; - int MonoW = infoRec->CacheWidthMono8x8Pattern; - Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8); - Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8); - CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers; - CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor; - int Num64, Num32, Num16, Num8, NumKeepers; - int w, h, Width, Height; - int MonosPerColor = 1; - - if (DoColor && DoMono) { - /* we assume color patterns take more space than color ones */ - if (MonoH > ColorH) - ColorH = MonoH; - if (MonoW > ColorW) - ColorW = MonoW; - MonosPerColor = (ColorH / MonoH) * (ColorW / MonoW); - } - - List64 = List32 = List16 = List8 = ListKeepers = MonoList = ColorList = - NULL; - Num64 = Num32 = Num16 = Num8 = NumKeepers = 0; - Width = Height = 0; - - /* We sort partials by how large a square tile they can cache. - We make 8x8 patterns from the leftovers if we can. */ - - pCur = ListPartial; - while (pCur) { - next = pCur->next; - if ((pCur->w >= 64) && (pCur->h >= 64)) { - pCur->next = List64; - List64 = pCur; - Num64++; - } - else if ((pCur->w >= 32) && (pCur->h >= 32)) { - pCur->next = List32; - List32 = pCur; - Num32++; - } - else if ((pCur->w >= 16) && (pCur->h >= 16)) { - pCur->next = List16; - List16 = pCur; - Num16++; - } - else if ((pCur->w >= 8) && (pCur->h >= 8)) { - pCur->next = List8; - List8 = pCur; - Num8++; - } - else { - h = pCur->h; - if (DoColor && (pCur->w >= ColorW) && (h >= ColorH)) { - while (h >= ColorH) { - h -= ColorH; - for (w = 0; w <= (pCur->w - ColorW); w += ColorW) { - ColorList = Enlist(ColorList, - pCur->x + w, pCur->y + h, ColorW, - ColorH); - (*NumColor)++; - } - } - } - if (DoMono && (pCur->w >= MonoW) && (h >= MonoH)) { - while (h >= MonoH) { - h -= MonoH; - for (w = 0; w <= (pCur->w - MonoW); w += MonoW) { - MonoList = Enlist(MonoList, - pCur->x + w, pCur->y + h, MonoW, - MonoH); - (*NumMono)++; - } - } - } - free(pCur); - } - - pCur = next; - } - - /* Try to extract at least 4 of each type of 8x8 slot that we need */ - - if (DoColor) { - CacheLinkPtr theOne; - - while (*NumColor < 4) { - theOne = NULL; - if (Num8) { - if ((theOne = ExtractOneThatFits(&List8, ColorW, ColorH))) - Num8--; - } - if (Num16 && !theOne) { - if ((theOne = ExtractOneThatFits(&List16, ColorW, ColorH))) - Num16--; - } - if (Num32 && !theOne) { - if ((theOne = ExtractOneThatFits(&List32, ColorW, ColorH))) - Num32--; - } - if (Num64 && !theOne) { - if ((theOne = ExtractOneThatFits(&List64, ColorW, ColorH))) - Num64--; - } - - if (!theOne) - break; - - ConvertAllPartialsTo8x8(NumMono, NumColor, theOne, - &MonoList, &ColorList, infoRec); - - if (DoMono) { - while (*NumColor && (*NumMono < 4)) { - ConvertColorToMono(&ColorList, ColorW, ColorH, - &MonoList, MonoW, MonoH); - (*NumColor)--; - *NumMono += MonosPerColor; - } - } - } - } - - if (DoMono) { - CacheLinkPtr theOne; - - while (*NumMono < 4) { - theOne = NULL; - if (Num8) { - if ((theOne = ExtractOneThatFits(&List8, MonoW, MonoH))) - Num8--; - } - if (Num16 && !theOne) { - if ((theOne = ExtractOneThatFits(&List16, MonoW, MonoH))) - Num16--; - } - if (Num32 && !theOne) { - if ((theOne = ExtractOneThatFits(&List32, MonoW, MonoH))) - Num32--; - } - if (Num64 && !theOne) { - if ((theOne = ExtractOneThatFits(&List64, MonoW, MonoH))) - Num64--; - } - - if (!theOne) - break; - - ConvertAllPartialsTo8x8(NumMono, NumColor, theOne, - &MonoList, &ColorList, infoRec); - } - } - - /* We save all the tiles from the largest bin that we can get - at least 4 of. If there are too few of a bigger slot, we - cut it in fourths to make smaller slots. */ - - if (Num64 >= 4) { - ListKeepers = List64; - List64 = NULL; - NumKeepers = Num64; - goto GOT_EM; - } - else if (Num64) { - List32 = QuadLinks(List64, List32); - Num32 += Num64 * 4; - Num64 = 0; - } - - if (Num32 >= 4) { - ListKeepers = List32; - List32 = NULL; - NumKeepers = Num32; - goto GOT_EM; - } - else if (Num32) { - List16 = QuadLinks(List32, List16); - Num16 += Num32 * 4; - Num32 = 0; - } - - if (Num16 >= 4) { - ListKeepers = List16; - List16 = NULL; - NumKeepers = Num16; - goto GOT_EM; - } - else if (Num16) { - List8 = QuadLinks(List16, List8); - Num8 += Num16 * 4; - Num16 = 0; - } - - if (Num8 >= 4) { - ListKeepers = List8; - List8 = NULL; - NumKeepers = Num8; - goto GOT_EM; - } - - GOT_EM: - - /* Free the ones we aren't using */ - - if (List64) - ConvertAllPartialsTo8x8(NumMono, NumColor, List64, - &MonoList, &ColorList, infoRec); - if (List32) - ConvertAllPartialsTo8x8(NumMono, NumColor, List32, - &MonoList, &ColorList, infoRec); - if (List16) - ConvertAllPartialsTo8x8(NumMono, NumColor, List16, - &MonoList, &ColorList, infoRec); - if (List8) - ConvertAllPartialsTo8x8(NumMono, NumColor, List8, - &MonoList, &ColorList, infoRec); - - /* Enlarge the slots if we can */ - - if (ListKeepers) { - CacheLinkPtr pLink = ListKeepers; - - Width = Height = 128; - - while (pLink) { - if (pLink->w < Width) - Width = pLink->w; - if (pLink->h < Height) - Height = pLink->h; - pLink = pLink->next; - } - } - - *ListMono = MonoList; - *ListColor = ColorList; - *maxw = Width; - *maxh = Height; - *NumPartial = NumKeepers; - return ListKeepers; -} - -void -XAAInitPixmapCache(ScreenPtr pScreen, RegionPtr areas, pointer data) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - XAAInfoRecPtr infoRec = (XAAInfoRecPtr) data; - XAAPixmapCachePrivatePtr pCachePriv; - BoxPtr pBox = RegionRects(areas); - int nBox = RegionNumRects(areas); - int Num512, Num256, Num128, NumPartial, NumColor, NumMono; - int Target512, Target256; - CacheLinkPtr List512, List256, List128, ListPartial, ListColor, ListMono; - int x, y, w, h, ntotal, granularity, width, height, i; - int MaxPartialWidth, MaxPartialHeight; - - infoRec->MaxCacheableTileWidth = 0; - infoRec->MaxCacheableTileHeight = 0; - infoRec->MaxCacheableStippleHeight = 0; - infoRec->MaxCacheableStippleWidth = 0; - infoRec->UsingPixmapCache = FALSE; - - if (!nBox || !pBox || !(infoRec->Flags & PIXMAP_CACHE)) - return; - - /* Allocate a persistent per-screen init flag to control messages */ - if (CacheInitIndex < 0) - CacheInitIndex = xf86AllocateScrnInfoPrivateIndex(); - - /* free the old private data if it exists */ - if (infoRec->PixmapCachePrivate) { - FreePixmapCachePrivate((XAAPixmapCachePrivatePtr) infoRec-> - PixmapCachePrivate); - infoRec->PixmapCachePrivate = NULL; - } - - Num512 = Num256 = Num128 = NumPartial = NumMono = NumColor = 0; - List512 = List256 = List128 = ListPartial = ListMono = ListColor = NULL; - granularity = infoRec->CachePixelGranularity; - if (granularity <= 1) - granularity = 0; - - /* go through the boxes and break it into as many pieces as we can fit */ - - while (nBox--) { - x = pBox->x1; - if (granularity) { - int tmp = x % granularity; - - if (tmp) - x += (granularity - tmp); - } - width = pBox->x2 - x; - if (width <= 0) { - pBox++; - continue; - } - - y = pBox->y1; - height = pBox->y2 - y; - - for (h = 0; h <= (height - 512); h += 512) { - for (w = 0; w <= (width - 512); w += 512) { - List512 = Enlist(List512, x + w, y + h, 512, 512); - Num512++; - } - for (; w <= (width - 256); w += 256) { - List256 = Enlist(List256, x + w, y + h, 256, 256); - List256 = Enlist(List256, x + w, y + h + 256, 256, 256); - Num256 += 2; - } - for (; w <= (width - 128); w += 128) { - List128 = Enlist(List128, x + w, y + h, 128, 128); - List128 = Enlist(List128, x + w, y + h + 128, 128, 128); - List128 = Enlist(List128, x + w, y + h + 256, 128, 128); - List128 = Enlist(List128, x + w, y + h + 384, 128, 128); - Num128 += 4; - } - if (w < width) { - int d = width - w; - - ListPartial = Enlist(ListPartial, x + w, y + h, d, 128); - ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128); - ListPartial = Enlist(ListPartial, x + w, y + h + 256, d, 128); - ListPartial = Enlist(ListPartial, x + w, y + h + 384, d, 128); - NumPartial += 4; - } - } - for (; h <= (height - 256); h += 256) { - for (w = 0; w <= (width - 256); w += 256) { - List256 = Enlist(List256, x + w, y + h, 256, 256); - Num256++; - } - for (; w <= (width - 128); w += 128) { - List128 = Enlist(List128, x + w, y + h, 128, 128); - List128 = Enlist(List128, x + w, y + h + 128, 128, 128); - Num128 += 2; - } - if (w < width) { - int d = width - w; - - ListPartial = Enlist(ListPartial, x + w, y + h, d, 128); - ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128); - NumPartial += 2; - } - } - for (; h <= (height - 128); h += 128) { - for (w = 0; w <= (width - 128); w += 128) { - List128 = Enlist(List128, x + w, y + h, 128, 128); - Num128++; - } - if (w < width) { - ListPartial = Enlist(ListPartial, x + w, y + h, width - w, 128); - NumPartial++; - } - } - if (h < height) { - int d = height - h; - - for (w = 0; w <= (width - 128); w += 128) { - ListPartial = Enlist(ListPartial, x + w, y + h, 128, d); - NumPartial++; - } - if (w < width) { - ListPartial = Enlist(ListPartial, x + w, y + h, width - w, d); - NumPartial++; - } - } - pBox++; - } - -/* - by this point we've carved the space into as many 512x512, 256x256 - and 128x128 blocks as we could fit. We will then break larger - blocks into smaller ones if we need to. The rules are as follows: - - 512x512 - - 1) Don't take up more than half the memory. - 2) Don't bother if you can't get at least four. - 3) Don't make more than MAX_512. - 4) Don't have any of there are no 256x256s. - - 256x256 - - 1) Don't take up more than a quarter of the memory enless there - aren't any 512x512s. Then we can take up to half. - 2) Don't bother if you can't get at least four. - 3) Don't make more than MAX_256. - - 128x128 - - 1) Don't make more than MAX_128. - - We don't bother with the partial blocks unless we can use them - for 8x8 pattern fills or we are short on larger blocks. - -*/ - - ntotal = Num128 + (Num256 << 2) + (Num512 << 4); - - Target512 = ntotal >> 5; - if (Target512 < 4) - Target512 = 0; - if (!Target512) - Target256 = ntotal >> 3; - else - Target256 = ntotal >> 4; - if (Target256 < 4) - Target256 = 0; - - if (Num512 && Num256 < 4) { - while (Num512 && Num256 < Target256) { - SubdivideList(&List512, &List256); - Num256 += 4; - Num512--; - } - } - - if (!Num512) { /* no room */ - } - else if ((Num512 < 4) || (!Target512)) { - while (Num512) { - SubdivideList(&List512, &List256); - Num256 += 4; - Num512--; - } - } - else if ((Num512 > MAX_512) || (Num512 > Target512)) { - while (Num512 > MAX_512) { - SubdivideList(&List512, &List256); - Num256 += 4; - Num512--; - } - while (Num512 > Target512) { - if (Num256 < MAX_256) { - SubdivideList(&List512, &List256); - Num256 += 4; - Num512--; - } - else - break; - } - } - - if (!Num256) { /* no room */ - } - else if ((Num256 < 4) || (!Target256)) { - while (Num256) { - SubdivideList(&List256, &List128); - Num128 += 4; - Num256--; - } - } - else if ((Num256 > MAX_256) || (Num256 > Target256)) { - while (Num256 > MAX_256) { - SubdivideList(&List256, &List128); - Num128 += 4; - Num256--; - } - while (Num256 > Target256) { - if (Num128 < MAX_128) { - SubdivideList(&List256, &List128); - Num128 += 4; - Num256--; - } - else - break; - } - } - - if (Num128 && ((Num128 < 4) || (Num128 > MAX_128))) { - CacheLinkPtr next; - int max = (Num128 > MAX_128) ? MAX_128 : 0; - - /* - * Note: next is set in this way to work around a code generation - * bug in gcc 2.7.2.3. - */ - next = List128->next; - while (Num128 > max) { - List128->next = ListPartial; - ListPartial = List128; - if ((List128 = next)) - next = List128->next; - NumPartial++; - Num128--; - } - } - - MaxPartialHeight = MaxPartialWidth = 0; - - /* at this point we have as many 512x512 and 256x256 slots as we - want but may have an excess of 128x128 slots. We still need - to find out if we need 8x8 slots. We take these from the - partials if we have them. Otherwise, we break some 128x128's */ - - if (!(infoRec->PixmapCacheFlags & (CACHE_MONO_8x8 | CACHE_COLOR_8x8))) { - if (NumPartial) { - if (Num128) { /* don't bother with partials */ - FreeList(ListPartial); - NumPartial = 0; - ListPartial = NULL; - } - else { - /* We have no big slots. Weed out the unusable partials */ - ListPartial = ThinOutPartials(ListPartial, &NumPartial, - &MaxPartialWidth, - &MaxPartialHeight); - } - } - } - else { - int MonosPerColor = 1; - int ColorH = infoRec->CacheHeightColor8x8Pattern; - int ColorW = infoRec->CacheWidthColor8x8Pattern; - int MonoH = infoRec->CacheHeightMono8x8Pattern; - int MonoW = infoRec->CacheWidthMono8x8Pattern; - Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8); - Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8); - - if (DoColor) - infoRec->CanDoColor8x8 = FALSE; - if (DoMono) - infoRec->CanDoMono8x8 = FALSE; - - if (DoColor && DoMono) { - /* we assume color patterns take more space than color ones */ - if (MonoH > ColorH) - ColorH = MonoH; - if (MonoW > ColorW) - ColorW = MonoW; - MonosPerColor = (ColorH / MonoH) * (ColorW / MonoW); - } - - if (Num128) { - if (NumPartial) { /* use all for 8x8 slots */ - ConvertAllPartialsTo8x8(&NumMono, &NumColor, - ListPartial, &ListMono, &ListColor, - infoRec); - NumPartial = 0; - ListPartial = NULL; - } - - /* Get some 8x8 slots from the 128 slots */ - while ((Num128 > 4) && - ((NumMono < MAX_MONO) && (NumColor < MAX_COLOR))) { - CacheLinkPtr tmp = NULL; - - tmp = Enlist(tmp, List128->x, List128->y, - List128->w, List128->h); - List128 = Delist(List128); - Num128--; - - ConvertAllPartialsTo8x8(&NumMono, &NumColor, - tmp, &ListMono, &ListColor, infoRec); - } - } - else if (NumPartial) { - /* We have share partials between 8x8 slots and tiles. */ - ListPartial = ConvertSomePartialsTo8x8(&NumMono, &NumColor, - &NumPartial, ListPartial, - &ListMono, &ListColor, - &MaxPartialWidth, - &MaxPartialHeight, infoRec); - } - - if (DoMono && DoColor) { - if (NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) { - int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0; - - while (NumColor > max) { - ConvertColorToMono(&ListColor, ColorW, ColorH, - &ListMono, MonoW, MonoH); - NumColor--; - NumMono += MonosPerColor; - } - } - - /* favor Mono slots over Color ones */ - while ((NumColor > 4) && (NumMono < MAX_MONO)) { - ConvertColorToMono(&ListColor, ColorW, ColorH, - &ListMono, MonoW, MonoH); - NumColor--; - NumMono += MonosPerColor; - } - } - - if (NumMono && ((NumMono > MAX_MONO) || (NumMono < 4))) { - int max = (NumMono > MAX_MONO) ? MAX_MONO : 0; - - while (NumMono > max) { - ListMono = Delist(ListMono); - NumMono--; - } - } - if (NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) { - int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0; - - while (NumColor > max) { - ListColor = Delist(ListColor); - NumColor--; - } - } - } - - pCachePriv = calloc(1, sizeof(XAAPixmapCachePrivate)); - if (!pCachePriv) { - if (Num512) - FreeList(List512); - if (Num256) - FreeList(List256); - if (Num128) - FreeList(List128); - if (NumPartial) - FreeList(ListPartial); - if (NumColor) - FreeList(ListColor); - if (NumMono) - FreeList(ListMono); - return; - } - - infoRec->PixmapCachePrivate = (char *) pCachePriv; - - if (Num512) { - pCachePriv->Info512 = calloc(Num512, sizeof(XAACacheInfoRec)); - if (!pCachePriv->Info512) - Num512 = 0; - if (Num512) - TransferList(List512, pCachePriv->Info512, Num512); - FreeList(List512); - pCachePriv->Num512x512 = Num512; - } - if (Num256) { - pCachePriv->Info256 = calloc(Num256, sizeof(XAACacheInfoRec)); - if (!pCachePriv->Info256) - Num256 = 0; - if (Num256) - TransferList(List256, pCachePriv->Info256, Num256); - FreeList(List256); - pCachePriv->Num256x256 = Num256; - } - if (Num128) { - pCachePriv->Info128 = calloc(Num128, sizeof(XAACacheInfoRec)); - if (!pCachePriv->Info128) - Num128 = 0; - if (Num128) - TransferList(List128, pCachePriv->Info128, Num128); - FreeList(List128); - pCachePriv->Num128x128 = Num128; - } - - if (NumPartial) { - pCachePriv->InfoPartial = calloc(NumPartial, sizeof(XAACacheInfoRec)); - if (!pCachePriv->InfoPartial) - NumPartial = 0; - if (NumPartial) - TransferList(ListPartial, pCachePriv->InfoPartial, NumPartial); - FreeList(ListPartial); - pCachePriv->NumPartial = NumPartial; - } - - if (NumColor) { - pCachePriv->InfoColor = calloc(NumColor, sizeof(XAACacheInfoRec)); - if (!pCachePriv->InfoColor) - NumColor = 0; - if (NumColor) - TransferList(ListColor, pCachePriv->InfoColor, NumColor); - FreeList(ListColor); - pCachePriv->NumColor = NumColor; - } - - if (NumMono) { - pCachePriv->InfoMono = calloc(NumMono, sizeof(XAACacheInfoRec)); - if (!pCachePriv->InfoMono) - NumMono = 0; - if (NumMono) - TransferList(ListMono, pCachePriv->InfoMono, NumMono); - FreeList(ListMono); - pCachePriv->NumMono = NumMono; - } - - if (NumPartial) { - infoRec->MaxCacheableTileWidth = MaxPartialWidth; - infoRec->MaxCacheableTileHeight = MaxPartialHeight; - } - if (Num128) - infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 128; - if (Num256) - infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 256; - if (Num512) - infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 512; - - infoRec->MaxCacheableStippleHeight = infoRec->MaxCacheableTileHeight; - infoRec->MaxCacheableStippleWidth = - infoRec->MaxCacheableTileWidth * pScrn->bitsPerPixel; - if (infoRec->ScreenToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) - infoRec->MaxCacheableStippleWidth /= 3; - - if (NumMono) { - if (!(infoRec->Mono8x8PatternFillFlags & - (HARDWARE_PATTERN_PROGRAMMED_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS))) { - int numPerLine = - infoRec->CacheWidthMono8x8Pattern / infoRec->MonoPatternPitch; - - for (i = 0; i < 64; i++) { - pCachePriv->MonoOffsets[i].y = i / numPerLine; - pCachePriv->MonoOffsets[i].x = (i % numPerLine) * - infoRec->MonoPatternPitch; - } - } - infoRec->CanDoMono8x8 = TRUE; - } - if (NumColor) { - if (!(infoRec->Color8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - - for (i = 0; i < 64; i++) { - pCachePriv->ColorOffsets[i].y = i & 0x07; - pCachePriv->ColorOffsets[i].x = i & ~0x07; - } - } - infoRec->CanDoColor8x8 = TRUE; - } - - if (!CACHEINIT(pScrn)) { - xf86ErrorF("\tSetting up tile and stipple cache:\n"); - if (NumPartial) - xf86ErrorF("\t\t%i %ix%i slots\n", - NumPartial, MaxPartialWidth, MaxPartialHeight); - if (Num128) - xf86ErrorF("\t\t%i 128x128 slots\n", Num128); - if (Num256) - xf86ErrorF("\t\t%i 256x256 slots\n", Num256); - if (Num512) - xf86ErrorF("\t\t%i 512x512 slots\n", Num512); - if (NumColor) - xf86ErrorF("\t\t%i 8x8 color pattern slots\n", NumColor); - if (NumMono) - xf86ErrorF("\t\t%i 8x8 color expansion slots\n", NumMono); - } - - if (!(NumPartial | Num128 | Num256 | Num512 | NumColor | NumMono)) { - if (!CACHEINIT(pScrn)) - xf86ErrorF("\t\tNot enough video memory for pixmap cache\n"); - } - else - infoRec->UsingPixmapCache = TRUE; - - CACHEINIT(pScrn) = 1; -} - -#if X_BYTE_ORDER == X_BIG_ENDIAN -static CARD32 StippleMasks[4] = { - 0x80808080, - 0xC0C0C0C0, - 0x00000000, - 0xF0F0F0F0 -}; -#else -static CARD32 StippleMasks[4] = { - 0x01010101, - 0x03030303, - 0x00000000, - 0x0F0F0F0F -}; -#endif - -Bool -XAACheckStippleReducibility(PixmapPtr pPixmap) -{ - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap); - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable); - CARD32 *IntPtr = (CARD32 *) pPixmap->devPrivate.ptr; - int w = pPixmap->drawable.width; - int h = pPixmap->drawable.height; - int i; - CARD32 bits[8]; - CARD32 mask = SHIFT_R(0xFFFFFFFF, 24); - - pPriv->flags |= REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR; - pPriv->flags &= ~REDUCIBLE_TO_8x8; - - if ((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1))) - return FALSE; - - i = (h > 8) ? 8 : h; - - switch (w) { - case 32: - while (i--) { - bits[i] = IntPtr[i] & mask; - if ((bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 8)), 8)) || - (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 16)), 16)) || - (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 24)), 24))) - return FALSE; - } - break; - case 16: - while (i--) { - bits[i] = IntPtr[i] & mask; - if (bits[i] != ((IntPtr[i] & SHIFT_R(SHIFT_L(mask, 8), 8)))) - return FALSE; - } - break; - default: - while (i--) - bits[i] = IntPtr[i] & mask; - break; - } - - switch (h) { - case 32: - if ((IntPtr[8] != IntPtr[16]) || (IntPtr[9] != IntPtr[17]) || - (IntPtr[10] != IntPtr[18]) || (IntPtr[11] != IntPtr[19]) || - (IntPtr[12] != IntPtr[20]) || (IntPtr[13] != IntPtr[21]) || - (IntPtr[14] != IntPtr[22]) || (IntPtr[15] != IntPtr[23]) || - (IntPtr[16] != IntPtr[24]) || (IntPtr[17] != IntPtr[25]) || - (IntPtr[18] != IntPtr[26]) || (IntPtr[19] != IntPtr[27]) || - (IntPtr[20] != IntPtr[28]) || (IntPtr[21] != IntPtr[29]) || - (IntPtr[22] != IntPtr[30]) || (IntPtr[23] != IntPtr[31])) - return FALSE; - /* fall through */ - case 16: - if ((IntPtr[0] != IntPtr[8]) || (IntPtr[1] != IntPtr[9]) || - (IntPtr[2] != IntPtr[10]) || (IntPtr[3] != IntPtr[11]) || - (IntPtr[4] != IntPtr[12]) || (IntPtr[5] != IntPtr[13]) || - (IntPtr[6] != IntPtr[14]) || (IntPtr[7] != IntPtr[15])) - return FALSE; - case 8: - break; - case 1: - bits[1] = bits[0]; - case 2: - bits[2] = bits[0]; - bits[3] = bits[1]; - case 4: - bits[4] = bits[0]; - bits[5] = bits[1]; - bits[6] = bits[2]; - bits[7] = bits[3]; - break; - } - - pPriv->flags |= REDUCIBLE_TO_8x8; - - pPriv->pattern0 = - bits[0] | SHIFT_L(bits[1], 8) | SHIFT_L(bits[2], 16) | SHIFT_L(bits[3], - 24); - pPriv->pattern1 = - bits[4] | SHIFT_L(bits[5], 8) | SHIFT_L(bits[6], 16) | SHIFT_L(bits[7], - 24); - - if (w < 8) { - pPriv->pattern0 &= StippleMasks[w - 1]; - pPriv->pattern1 &= StippleMasks[w - 1]; - - switch (w) { - case 1: - pPriv->pattern0 |= SHIFT_L(pPriv->pattern0, 1); - pPriv->pattern1 |= SHIFT_L(pPriv->pattern1, 1); - case 2: - pPriv->pattern0 |= SHIFT_L(pPriv->pattern0, 2); - pPriv->pattern1 |= SHIFT_L(pPriv->pattern1, 2); - case 4: - pPriv->pattern0 |= SHIFT_L(pPriv->pattern0, 4); - pPriv->pattern1 |= SHIFT_L(pPriv->pattern1, 4); - } - } - - if (infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) { - pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0); - pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1); - } - - return TRUE; -} - -Bool -XAACheckTileReducibility(PixmapPtr pPixmap, Bool checkMono) -{ - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap); - CARD32 *IntPtr; - int w = pPixmap->drawable.width; - int h = pPixmap->drawable.height; - int pitch = pPixmap->devKind >> 2; - int dwords, i, j; - - pPriv->flags |= REDUCIBILITY_CHECKED; - pPriv->flags &= ~(REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR); - - if ((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1))) - return FALSE; - - dwords = ((w * pPixmap->drawable.bitsPerPixel) + 31) >> 5; - i = (h > 8) ? 8 : h; - - if (w > 8) { - IntPtr = (CARD32 *) pPixmap->devPrivate.ptr; - switch (pPixmap->drawable.bitsPerPixel) { - case 8: - while (i--) { - for (j = 2; j < dwords; j++) - if (IntPtr[j] != IntPtr[j & 0x01]) - return FALSE; - IntPtr += pitch; - } - break; - case 16: - while (i--) { - for (j = 4; j < dwords; j++) - if (IntPtr[j] != IntPtr[j & 0x03]) - return FALSE; - IntPtr += pitch; - } - break; - case 24: - while (i--) { - for (j = 6; j < dwords; j++) - if (IntPtr[j] != IntPtr[j % 6]) - return FALSE; - IntPtr += pitch; - } - break; - case 32: - while (i--) { - for (j = 8; j < dwords; j++) - if (IntPtr[j] != IntPtr[j & 0x07]) - return FALSE; - IntPtr += pitch; - } - break; - default: - return FALSE; - } - - } - - if (h == 32) { - CARD32 *IntPtr2, *IntPtr3, *IntPtr4; - - i = 8; - IntPtr = (CARD32 *) pPixmap->devPrivate.ptr; - IntPtr2 = IntPtr + (pitch << 3); - IntPtr3 = IntPtr2 + (pitch << 3); - IntPtr4 = IntPtr3 + (pitch << 3); - while (i--) { - for (j = 0; j < dwords; j++) - if ((IntPtr[j] != IntPtr2[j]) || (IntPtr[j] != IntPtr3[j]) || - (IntPtr[j] != IntPtr4[j])) - return FALSE; - IntPtr += pitch; - IntPtr2 += pitch; - IntPtr3 += pitch; - IntPtr4 += pitch; - } - } - else if (h == 16) { - CARD32 *IntPtr2; - - i = 8; - IntPtr = (CARD32 *) pPixmap->devPrivate.ptr; - IntPtr2 = IntPtr + (pitch << 3); - while (i--) { - for (j = 0; j < dwords; j++) - if (IntPtr[j] != IntPtr2[j]) - return FALSE; - IntPtr += pitch; - IntPtr2 += pitch; - } - } - - pPriv->flags |= REDUCIBLE_TO_8x8; - - if (checkMono) { - XAAInfoRecPtr infoRec = - GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable); - unsigned char bits[8]; - int fg, bg = -1, x, y; - - i = (h > 8) ? 8 : h; - j = (w > 8) ? 8 : w; - - if (pPixmap->drawable.bitsPerPixel == 8) { - unsigned char *srcp = pPixmap->devPrivate.ptr; - - fg = srcp[0]; - pitch = pPixmap->devKind; - for (y = 0; y < i; y++) { - bits[y] = 0; - for (x = 0; x < j; x++) { - if (srcp[x] != fg) { - if (bg == -1) - bg = srcp[x]; - else if (bg != srcp[x]) - return TRUE; - } - else - bits[y] |= 1 << x; - } - srcp += pitch; - } - } - else if (pPixmap->drawable.bitsPerPixel == 16) { - unsigned short *srcp = (unsigned short *) pPixmap->devPrivate.ptr; - - fg = srcp[0]; - pitch = pPixmap->devKind >> 1; - for (y = 0; y < i; y++) { - bits[y] = 0; - for (x = 0; x < j; x++) { - if (srcp[x] != fg) { - if (bg == -1) - bg = srcp[x]; - else if (bg != srcp[x]) - return TRUE; - } - else - bits[y] |= 1 << x; - } - srcp += pitch; - } - } - else if (pPixmap->drawable.bitsPerPixel == 24) { - CARD32 val; - unsigned char *srcp = pPixmap->devPrivate.ptr; - - fg = *((CARD32 *) srcp) & 0x00FFFFFF; - pitch = pPixmap->devKind; - j *= 3; - for (y = 0; y < i; y++) { - bits[y] = 0; - for (x = 0; x < j; x += 3) { - val = *((CARD32 *) (srcp + x)) & 0x00FFFFFF; - if (val != fg) { - if (bg == -1) - bg = val; - else if (bg != val) - return TRUE; - } - else - bits[y] |= 1 << (x / 3); - } - srcp += pitch; - } - } - else if (pPixmap->drawable.bitsPerPixel == 32) { - IntPtr = (CARD32 *) pPixmap->devPrivate.ptr; - fg = IntPtr[0]; - for (y = 0; y < i; y++) { - bits[y] = 0; - for (x = 0; x < j; x++) { - if (IntPtr[x] != fg) { - if (bg == -1) - bg = IntPtr[x]; - else if (bg != IntPtr[x]) - return TRUE; - } - else - bits[y] |= 1 << x; - } - IntPtr += pitch; - } - } - else - return TRUE; - - pPriv->fg = fg; - if (bg == -1) - pPriv->bg = fg; - else - pPriv->bg = bg; - - if (h < 8) { - switch (h) { - case 1: - bits[1] = bits[0]; - case 2: - bits[2] = bits[0]; - bits[3] = bits[1]; - case 4: - bits[4] = bits[0]; - bits[5] = bits[1]; - bits[6] = bits[2]; - bits[7] = bits[3]; - break; - } - } - - pPriv->pattern0 = - bits[0] | (bits[1] << 8) | (bits[2] << 16) | (bits[3] << 24); - pPriv->pattern1 = - bits[4] | (bits[5] << 8) | (bits[6] << 16) | (bits[7] << 24); - - if (w < 8) { - switch (w) { - case 1: - pPriv->pattern0 |= (pPriv->pattern0 << 1); - pPriv->pattern1 |= (pPriv->pattern1 << 1); - case 2: - pPriv->pattern0 |= (pPriv->pattern0 << 2); - pPriv->pattern1 |= (pPriv->pattern1 << 2); - case 4: - pPriv->pattern0 |= (pPriv->pattern0 << 4); - pPriv->pattern1 |= (pPriv->pattern1 << 4); - } - } - pPriv->flags |= REDUCIBLE_TO_2_COLOR; - - if (infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) { - pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0); - pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1); - } - - } - - return TRUE; -} - -void -XAATileCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache, int w, int h) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - (*infoRec->SetupForScreenToScreenCopy) (pScrn, 1, 1, GXcopy, ~0, -1); - - while ((w << 1) <= pCache->w) { - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pCache->x, pCache->y, - pCache->x + w, pCache->y, w, - h); - w <<= 1; - } - if (w != pCache->w) { - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pCache->x, pCache->y, - pCache->x + w, pCache->y, - pCache->w - w, h); - w = pCache->w; - } - - while ((h << 1) <= pCache->h) { - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pCache->x, pCache->y, - pCache->x, pCache->y + h, w, - h); - h <<= 1; - } - if (h != pCache->h) { - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pCache->x, pCache->y, - pCache->x, pCache->y + h, w, - pCache->h - h); - } - SET_SYNC_FLAG(infoRec); -} - -XAACacheInfoPtr -XAACacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix) -{ - int w = pPix->drawable.width; - int h = pPix->drawable.height; - int size = max(w, h); - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - XAAPixmapCachePrivatePtr pCachePriv = - (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate; - XAACacheInfoPtr pCache, cacheRoot = NULL; - int i, max = 0; - int *current; - - if (size <= 128) { - if (pCachePriv->Info128) { - cacheRoot = pCachePriv->Info128; - max = pCachePriv->Num128x128; - current = &pCachePriv->Current128; - } - else { - cacheRoot = pCachePriv->InfoPartial; - max = pCachePriv->NumPartial; - current = &pCachePriv->CurrentPartial; - } - } - else if (size <= 256) { - cacheRoot = pCachePriv->Info256; - max = pCachePriv->Num256x256; - current = &pCachePriv->Current256; - } - else if (size <= 512) { - cacheRoot = pCachePriv->Info512; - max = pCachePriv->Num512x512; - current = &pCachePriv->Current512; - } - else { /* something's wrong */ - ErrorF("Something's wrong in XAACacheTile()\n"); - return pCachePriv->Info128; - } - - pCache = cacheRoot; - - /* lets look for it */ - for (i = 0; i < max; i++, pCache++) { - if (pCache->serialNumber == pPix->drawable.serialNumber) { - pCache->trans_color = -1; - return pCache; - } - } - - pCache = &cacheRoot[(*current)++]; - if (*current >= max) - *current = 0; - - pCache->serialNumber = pPix->drawable.serialNumber; - pCache->trans_color = pCache->bg = pCache->fg = -1; - pCache->orig_w = w; - pCache->orig_h = h; - (*infoRec->WritePixmapToCache) (pScrn, pCache->x, pCache->y, w, h, - pPix->devPrivate.ptr, pPix->devKind, - pPix->drawable.bitsPerPixel, - pPix->drawable.depth); - if (!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) && - ((w != pCache->w) || (h != pCache->h))) - XAATileCache(pScrn, pCache, w, h); - - return pCache; -} - -XAACacheInfoPtr -XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix) -{ - int w = pPix->drawable.width; - int h = pPix->drawable.height; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - XAAPixmapCachePrivatePtr pCachePriv = - (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate; - XAACacheInfoPtr pCache, cacheRoot = NULL; - int i, max = 0, funcNo, pad, dwords, bpp = pScrn->bitsPerPixel; - int *current; - StippleScanlineProcPtr StippleFunc; - unsigned char *data, *srcPtr, *dstPtr; - - if ((h <= 128) && (w <= 128 * bpp)) { - if (pCachePriv->Info128) { - cacheRoot = pCachePriv->Info128; - max = pCachePriv->Num128x128; - current = &pCachePriv->Current128; - } - else { - cacheRoot = pCachePriv->InfoPartial; - max = pCachePriv->NumPartial; - current = &pCachePriv->CurrentPartial; - } - } - else if ((h <= 256) && (w <= 256 * bpp)) { - cacheRoot = pCachePriv->Info256; - max = pCachePriv->Num256x256; - current = &pCachePriv->Current256; - } - else if ((h <= 512) && (w <= 526 * bpp)) { - cacheRoot = pCachePriv->Info512; - max = pCachePriv->Num512x512; - current = &pCachePriv->Current512; - } - else { /* something's wrong */ - ErrorF("Something's wrong in XAACacheMonoStipple()\n"); - return pCachePriv->Info128; - } - - pCache = cacheRoot; - - /* lets look for it */ - for (i = 0; i < max; i++, pCache++) { - if ((pCache->serialNumber == pPix->drawable.serialNumber) && - (pCache->fg == -1) && (pCache->bg == -1)) { - pCache->trans_color = -1; - return pCache; - } - } - - pCache = &cacheRoot[(*current)++]; - if (*current >= max) - *current = 0; - - pCache->serialNumber = pPix->drawable.serialNumber; - pCache->trans_color = pCache->bg = pCache->fg = -1; - pCache->orig_w = w; - pCache->orig_h = h; - - if (w <= 32) { - if (w & (w - 1)) - funcNo = 1; - else - funcNo = 0; - } - else - funcNo = 2; - - pad = BitmapBytePad(pCache->w * bpp); - dwords = bytes_to_int32(pad); - dstPtr = data = (unsigned char *) malloc(pad * pCache->h); - srcPtr = (unsigned char *) pPix->devPrivate.ptr; - - if (infoRec-> - ScreenToScreenColorExpandFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) - StippleFunc = XAAStippleScanlineFuncMSBFirst[funcNo]; - else - StippleFunc = XAAStippleScanlineFuncLSBFirst[funcNo]; - - /* don't bother generating more than we'll ever use */ - max = ((pScrn->displayWidth + w - 1) + 31) >> 5; - if (dwords > max) - dwords = max; - - for (i = 0; i < h; i++) { - (*StippleFunc) ((CARD32 *) dstPtr, (CARD32 *) srcPtr, 0, w, dwords); - srcPtr += pPix->devKind; - dstPtr += pad; - } - - while ((h << 1) <= pCache->h) { - memcpy(data + (pad * h), data, pad * h); - h <<= 1; - } - - if (h < pCache->h) - memcpy(data + (pad * h), data, pad * (pCache->h - h)); - - (*infoRec->WritePixmapToCache) (pScrn, pCache->x, pCache->y, pCache->w, - pCache->h, data, pad, bpp, pScrn->depth); - - free(data); - - return pCache; -} - -XAACacheInfoPtr -XAACachePlanarMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix) -{ - int w = pPix->drawable.width; - int h = pPix->drawable.height; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - XAAPixmapCachePrivatePtr pCachePriv = - (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate; - XAACacheInfoPtr pCache, cacheRoot = NULL; - int i, max = 0; - int *current; - - if ((h <= 128) && (w <= 128)) { - if (pCachePriv->Info128) { - cacheRoot = pCachePriv->Info128; - max = pCachePriv->Num128x128; - current = &pCachePriv->Current128; - } - else { - cacheRoot = pCachePriv->InfoPartial; - max = pCachePriv->NumPartial; - current = &pCachePriv->CurrentPartial; - } - } - else if ((h <= 256) && (w <= 256)) { - cacheRoot = pCachePriv->Info256; - max = pCachePriv->Num256x256; - current = &pCachePriv->Current256; - } - else if ((h <= 512) && (w <= 526)) { - cacheRoot = pCachePriv->Info512; - max = pCachePriv->Num512x512; - current = &pCachePriv->Current512; - } - else { /* something's wrong */ - ErrorF("Something's wrong in XAACachePlanarMonoStipple()\n"); - return pCachePriv->Info128; - } - - pCache = cacheRoot; - - /* lets look for it */ - for (i = 0; i < max; i++, pCache++) { - if ((pCache->serialNumber == pPix->drawable.serialNumber) && - (pCache->fg == -1) && (pCache->bg == -1)) { - pCache->trans_color = -1; - return pCache; - } - } - - pCache = &cacheRoot[(*current)++]; - if (*current >= max) - *current = 0; - - pCache->serialNumber = pPix->drawable.serialNumber; - pCache->trans_color = pCache->bg = pCache->fg = -1; - pCache->orig_w = w; - pCache->orig_h = h; - - /* Plane 0 holds the stipple. Plane 1 holds the inverted stipple */ - (*infoRec->WriteBitmapToCache) (pScrn, pCache->x, pCache->y, - pPix->drawable.width, pPix->drawable.height, - pPix->devPrivate.ptr, pPix->devKind, 1, 2); - if (!(infoRec->PixmapCacheFlags & DO_NOT_TILE_MONO_DATA) && - ((w != pCache->w) || (h != pCache->h))) - XAATileCache(pScrn, pCache, w, h); - - return pCache; -} - -XAACachePlanarMonoStippleProc -XAAGetCachePlanarMonoStipple(void) -{ - return XAACachePlanarMonoStipple; -} - -XAACacheInfoPtr -XAACacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg) -{ - int w = pPix->drawable.width; - int h = pPix->drawable.height; - int size = max(w, h); - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - XAAPixmapCachePrivatePtr pCachePriv = - (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate; - XAACacheInfoPtr pCache, cacheRoot = NULL; - int i, max = 0; - int *current; - - if (size <= 128) { - if (pCachePriv->Info128) { - cacheRoot = pCachePriv->Info128; - max = pCachePriv->Num128x128; - current = &pCachePriv->Current128; - } - else { - cacheRoot = pCachePriv->InfoPartial; - max = pCachePriv->NumPartial; - current = &pCachePriv->CurrentPartial; - } - } - else if (size <= 256) { - cacheRoot = pCachePriv->Info256; - max = pCachePriv->Num256x256; - current = &pCachePriv->Current256; - } - else if (size <= 512) { - cacheRoot = pCachePriv->Info512; - max = pCachePriv->Num512x512; - current = &pCachePriv->Current512; - } - else { /* something's wrong */ - ErrorF("Something's wrong in XAACacheStipple()\n"); - return pCachePriv->Info128; - } - - pCache = cacheRoot; - /* lets look for it */ - if (bg == -1) - for (i = 0; i < max; i++, pCache++) { - if ((pCache->serialNumber == pPix->drawable.serialNumber) && - (fg == pCache->fg) && (pCache->fg != pCache->bg)) { - pCache->trans_color = pCache->bg; - return pCache; - } - } - else - for (i = 0; i < max; i++, pCache++) { - if ((pCache->serialNumber == pPix->drawable.serialNumber) && - (fg == pCache->fg) && (bg == pCache->bg)) { - pCache->trans_color = -1; - return pCache; - } - } - - pCache = &cacheRoot[(*current)++]; - if (*current >= max) - *current = 0; - - pCache->serialNumber = pPix->drawable.serialNumber; - pCache->fg = fg; - if (bg == -1) - pCache->trans_color = bg = fg ^ 1; - else - pCache->trans_color = -1; - pCache->bg = bg; - - pCache->orig_w = w; - pCache->orig_h = h; - (*infoRec->WriteBitmapToCache) (pScrn, pCache->x, pCache->y, - pPix->drawable.width, pPix->drawable.height, - pPix->devPrivate.ptr, pPix->devKind, fg, - bg); - if (!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) && - ((w != pCache->w) || (h != pCache->h))) - XAATileCache(pScrn, pCache, w, h); - - return pCache; -} - -XAACacheInfoPtr -XAACacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0, int pat1) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - XAAPixmapCachePrivatePtr pCachePriv = - (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate; - XAACacheInfoPtr pCache = pCachePriv->InfoMono; - int i; - - for (i = 0; i < pCachePriv->NumMono; i++, pCache++) { - if (pCache->serialNumber && - (pCache->pat0 == pat0) && (pCache->pat1 == pat1)) - return pCache; - } - - /* OK, let's cache it */ - pCache = &pCachePriv->InfoMono[pCachePriv->CurrentMono++]; - if (pCachePriv->CurrentMono >= pCachePriv->NumMono) - pCachePriv->CurrentMono = 0; - - pCache->serialNumber = 1; /* we don't care since we do lookups by pattern */ - pCache->pat0 = pat0; - pCache->pat1 = pat1; - - (*infoRec->WriteMono8x8PatternToCache) (pScrn, pCache); - - return pCache; -} - -XAACacheInfoPtr -XAACacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - XAAPixmapCachePrivatePtr pCachePriv = - (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate; - XAACacheInfoPtr pCache = pCachePriv->InfoColor; - XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix); - int i; - - if (!(pixPriv->flags & REDUCIBLE_TO_2_COLOR)) { - for (i = 0; i < pCachePriv->NumColor; i++, pCache++) { - if (pCache->serialNumber == pPix->drawable.serialNumber) { - pCache->trans_color = -1; - return pCache; - } - } - pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++]; - if (pCachePriv->CurrentColor >= pCachePriv->NumColor) - pCachePriv->CurrentColor = 0; - - pCache->serialNumber = pPix->drawable.serialNumber; - pCache->trans_color = pCache->fg = pCache->bg = -1; - } - else { - int pat0 = pixPriv->pattern0; - int pat1 = pixPriv->pattern1; - - if (fg == -1) { /* it's a tile */ - fg = pixPriv->fg; - bg = pixPriv->bg; - } - - if (bg == -1) { /* stipple */ - for (i = 0; i < pCachePriv->NumColor; i++, pCache++) { - if (pCache->serialNumber && - (pCache->pat0 == pat0) && (pCache->pat1 == pat1) && - (pCache->fg == fg) && (pCache->bg != fg)) { - pCache->trans_color = pCache->bg; - return pCache; - } - } - } - else { /* opaque stipple */ - for (i = 0; i < pCachePriv->NumColor; i++, pCache++) { - if (pCache->serialNumber && - (pCache->pat0 == pat0) && (pCache->pat1 == pat1) && - (pCache->fg == fg) && (pCache->bg == bg)) { - pCache->trans_color = -1; - return pCache; - } - } - } - pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++]; - if (pCachePriv->CurrentColor >= pCachePriv->NumColor) - pCachePriv->CurrentColor = 0; - - if (bg == -1) - pCache->trans_color = bg = fg ^ 1; - else - pCache->trans_color = -1; - - pCache->pat0 = pat0; - pCache->pat1 = pat1; - pCache->fg = fg; - pCache->bg = bg; - pCache->serialNumber = 1; - } - - (*infoRec->WriteColor8x8PatternToCache) (pScrn, pPix, pCache); - - return pCache; -} - -void -XAAWriteBitmapToCache(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, int srcwidth, int fg, int bg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - (*infoRec->WriteBitmap) (pScrn, x, y, w, h, src, srcwidth, - 0, fg, bg, GXcopy, ~0); -} - -void -XAAWriteBitmapToCacheLinear(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, int srcwidth, int fg, int bg) -{ - ScreenPtr pScreen = pScrn->pScreen; - PixmapPtr pScreenPix, pDstPix; - ChangeGCVal gcvals[2]; - GCPtr pGC; - - pScreenPix = (*pScreen->GetScreenPixmap) (pScreen); - - pDstPix = GetScratchPixmapHeader(pScreen, pScreenPix->drawable.width, - y + h, pScreenPix->drawable.depth, - pScreenPix->drawable.bitsPerPixel, - pScreenPix->devKind, - pScreenPix->devPrivate.ptr); - - pGC = GetScratchGC(pScreenPix->drawable.depth, pScreen); - gcvals[0].val = fg; - gcvals[1].val = bg; - ChangeGC(NullClient, pGC, GCForeground | GCBackground, gcvals); - ValidateGC((DrawablePtr) pDstPix, pGC); - - /* We've unwrapped already so these ops miss a sync */ - SYNC_CHECK(pScrn); - - (*pGC->ops->PutImage) ((DrawablePtr) pDstPix, pGC, 1, x, y, w, h, 0, - XYBitmap, (pointer) src); - - FreeScratchGC(pGC); - FreeScratchPixmapHeader(pDstPix); -} - -void -XAAWritePixmapToCache(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, int srcwidth, int bpp, int depth) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - (*infoRec->WritePixmap) (pScrn, x, y, w, h, src, srcwidth, - GXcopy, ~0, -1, bpp, depth); -} - -void -XAAWritePixmapToCacheLinear(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, int bpp, int depth) -{ - ScreenPtr pScreen = pScrn->pScreen; - PixmapPtr pScreenPix, pDstPix; - GCPtr pGC; - - pScreenPix = (*pScreen->GetScreenPixmap) (pScreen); - - pDstPix = GetScratchPixmapHeader(pScreen, x + w, y + h, - depth, bpp, pScreenPix->devKind, - pScreenPix->devPrivate.ptr); - - pGC = GetScratchGC(depth, pScreen); - ValidateGC((DrawablePtr) pDstPix, pGC); - - /* We've unwrapped already so these ops miss a sync */ - SYNC_CHECK(pScrn); - - if (bpp == BitsPerPixel(depth)) - (*pGC->ops->PutImage) ((DrawablePtr) pDstPix, pGC, depth, x, y, w, - h, 0, ZPixmap, (pointer) src); - else { - PixmapPtr pSrcPix; - - pSrcPix = GetScratchPixmapHeader(pScreen, w, h, depth, bpp, - srcwidth, (pointer) src); - - (*pGC->ops->CopyArea) ((DrawablePtr) pSrcPix, (DrawablePtr) pDstPix, - pGC, 0, 0, w, h, x, y); - - FreeScratchPixmapHeader(pSrcPix); - } - - FreeScratchGC(pGC); - FreeScratchPixmapHeader(pDstPix); -} - -void -XAAWriteMono8x8PatternToCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - XAAPixmapCachePrivatePtr pCachePriv = - (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate; - unsigned char *data; - int pad, Bpp = (pScrn->bitsPerPixel >> 3); - - pCache->offsets = pCachePriv->MonoOffsets; - - pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel); - - data = (unsigned char *) malloc(pad * pCache->h); - if (!data) - return; - - if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_ORIGIN) { - CARD32 *ptr = (CARD32 *) data; - - ptr[0] = pCache->pat0; - ptr[1] = pCache->pat1; - } - else { - CARD32 *ptr; - DDXPointPtr pPoint = pCache->offsets; - int patx, paty, i; - - for (i = 0; i < 64; i++, pPoint++) { - patx = pCache->pat0; - paty = pCache->pat1; - XAARotateMonoPattern(&patx, &paty, i & 0x07, i >> 3, - (infoRec->Mono8x8PatternFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST)); - ptr = (CARD32 *) (data + (pad * pPoint->y) + (Bpp * pPoint->x)); - ptr[0] = patx; - ptr[1] = paty; - } - } - - (*infoRec->WritePixmapToCache) (pScrn, pCache->x, pCache->y, - pCache->w, pCache->h, data, pad, - pScrn->bitsPerPixel, pScrn->depth); - - free(data); -} - -void -XAAWriteColor8x8PatternToCache(ScrnInfoPtr pScrn, - PixmapPtr pPix, XAACacheInfoPtr pCache) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix); - XAAPixmapCachePrivatePtr pCachePriv = - (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate; - int pad, i, w, h, nw, nh, Bpp; - unsigned char *data, *srcPtr, *dstPtr; - - pCache->offsets = pCachePriv->ColorOffsets; - - if (pixPriv->flags & REDUCIBLE_TO_2_COLOR) { - CARD32 *ptr; - - pad = BitmapBytePad(pCache->w); - data = (unsigned char *) malloc(pad * pCache->h); - if (!data) - return; - - if (infoRec->Color8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN) { - ptr = (CARD32 *) data; - ptr[0] = pCache->pat0; - ptr[1] = pCache->pat1; - } - else { - int patx, paty; - - ptr = (CARD32 *) data; - ptr[0] = ptr[2] = pCache->pat0; - ptr[1] = ptr[3] = pCache->pat1; - for (i = 1; i < 8; i++) { - patx = pCache->pat0; - paty = pCache->pat1; - XAARotateMonoPattern(&patx, &paty, i, 0, - (infoRec->Mono8x8PatternFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST)); - ptr = (CARD32 *) (data + (pad * i)); - ptr[0] = ptr[2] = patx; - ptr[1] = ptr[3] = paty; - } - } - - (*infoRec->WriteBitmapToCache) (pScrn, pCache->x, pCache->y, - pCache->w, pCache->h, data, pad, - pCache->fg, pCache->bg); - - free(data); - return; - } - - Bpp = pScrn->bitsPerPixel >> 3; - h = min(8, pPix->drawable.height); - w = min(8, pPix->drawable.width); - pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel); - - data = (unsigned char *) malloc(pad * pCache->h); - if (!data) - return; - - /* Write and expand horizontally. */ - for (i = h, dstPtr = data, srcPtr = pPix->devPrivate.ptr; i--; - srcPtr += pPix->devKind, dstPtr += pScrn->bitsPerPixel) { - nw = w; - memcpy(dstPtr, srcPtr, w * Bpp); - while (nw != 8) { - memcpy(dstPtr + (nw * Bpp), dstPtr, nw * Bpp); - nw <<= 1; - } - } - nh = h; - /* Expand vertically. */ - while (nh != 8) { - memcpy(data + (nh * pScrn->bitsPerPixel), data, - nh * pScrn->bitsPerPixel); - nh <<= 1; - } - - if (!(infoRec->Color8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - int j; - unsigned char *ptr = data + (128 * Bpp); - - memcpy(data + (64 * Bpp), data, 64 * Bpp); - for (i = 1; i < 8; i++, ptr += (128 * Bpp)) { - for (j = 0; j < 8; j++) { - memcpy(ptr + (j * 8) * Bpp, data + (j * 8 + i) * Bpp, - (8 - i) * Bpp); - memcpy(ptr + (j * 8 + 8 - i) * Bpp, data + j * 8 * Bpp, - i * Bpp); - } - memcpy(ptr + (64 * Bpp), ptr, 64 * Bpp); - } - } - - (*infoRec->WritePixmapToCache) (pScrn, pCache->x, pCache->y, - pCache->w, pCache->h, data, pad, - pScrn->bitsPerPixel, pScrn->depth); - - free(data); -} - -int -XAAStippledFillChooser(GCPtr pGC) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - PixmapPtr pPixmap = pGC->stipple; - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap); - - if (!(pPriv->flags & REDUCIBILITY_CHECKED) && - (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) { - XAACheckStippleReducibility(pPixmap); - } - - if (pPriv->flags & REDUCIBLE_TO_8x8) { - if (infoRec->CanDoMono8x8 && - !(infoRec->FillMono8x8PatternSpansFlags & NO_TRANSPARENCY) && - ((pGC->alu == GXcopy) || !(infoRec->FillMono8x8PatternSpansFlags & - TRANSPARENCY_GXCOPY_ONLY)) && - CHECK_ROP(pGC, infoRec->FillMono8x8PatternSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillMono8x8PatternSpansFlags) && - CHECK_FG(pGC, infoRec->FillMono8x8PatternSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillMono8x8PatternSpansFlags)) { - - return DO_MONO_8x8; - } - - if (infoRec->CanDoColor8x8 && - !(infoRec->FillColor8x8PatternSpansFlags & NO_TRANSPARENCY) && - ((pGC->alu == GXcopy) || !(infoRec->FillColor8x8PatternSpansFlags & - TRANSPARENCY_GXCOPY_ONLY)) && - CHECK_ROP(pGC, infoRec->FillColor8x8PatternSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillColor8x8PatternSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillColor8x8PatternSpansFlags)) { - - return DO_COLOR_8x8; - } - } - - if (infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans && - (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) && - (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth / - infoRec->CacheColorExpandDensity) && - !(infoRec->FillCacheExpandSpansFlags & NO_TRANSPARENCY) && - ((pGC->alu == GXcopy) || !(infoRec->FillCacheExpandSpansFlags & - TRANSPARENCY_GXCOPY_ONLY)) && - CHECK_ROP(pGC, infoRec->FillCacheExpandSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillCacheExpandSpansFlags) && - CHECK_FG(pGC, infoRec->FillCacheExpandSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillCacheExpandSpansFlags)) { - - return DO_CACHE_EXPAND; - } - - if (infoRec->UsingPixmapCache && - !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) && - infoRec->FillCacheBltSpans && - (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) && - (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) && - !(infoRec->FillCacheBltSpansFlags & NO_TRANSPARENCY) && - ((pGC->alu == GXcopy) || !(infoRec->FillCacheBltSpansFlags & - TRANSPARENCY_GXCOPY_ONLY)) && - CHECK_ROP(pGC, infoRec->FillCacheBltSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillCacheBltSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillCacheBltSpansFlags)) { - - return DO_CACHE_BLT; - } - - if (infoRec->FillColorExpandSpans && - !(infoRec->FillColorExpandSpansFlags & NO_TRANSPARENCY) && - ((pGC->alu == GXcopy) || !(infoRec->FillColorExpandSpansFlags & - TRANSPARENCY_GXCOPY_ONLY)) && - CHECK_ROP(pGC, infoRec->FillColorExpandSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillColorExpandSpansFlags) && - CHECK_FG(pGC, infoRec->FillColorExpandSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillColorExpandSpansFlags)) { - - return DO_COLOR_EXPAND; - } - - return 0; -} - -int -XAAOpaqueStippledFillChooser(GCPtr pGC) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - PixmapPtr pPixmap = pGC->stipple; - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap); - - if (XAA_DEPTH_BUG(pGC)) - return 0; - - if (!(pPriv->flags & REDUCIBILITY_CHECKED) && - (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) { - XAACheckStippleReducibility(pPixmap); - } - - if (pPriv->flags & REDUCIBLE_TO_8x8) { - if (infoRec->CanDoMono8x8 && - !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) && - CHECK_ROP(pGC, infoRec->FillMono8x8PatternSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillMono8x8PatternSpansFlags) && - CHECK_COLORS(pGC, infoRec->FillMono8x8PatternSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillMono8x8PatternSpansFlags)) { - - return DO_MONO_8x8; - } - - if (infoRec->CanDoColor8x8 && - CHECK_ROP(pGC, infoRec->FillColor8x8PatternSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillColor8x8PatternSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillColor8x8PatternSpansFlags)) { - - return DO_COLOR_8x8; - } - } - - if (infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans && - (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) && - (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth / - infoRec->CacheColorExpandDensity) && - !(infoRec->FillCacheExpandSpansFlags & TRANSPARENCY_ONLY) && - CHECK_ROP(pGC, infoRec->FillCacheExpandSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillCacheExpandSpansFlags) && - CHECK_COLORS(pGC, infoRec->FillCacheExpandSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillCacheExpandSpansFlags)) { - - return DO_CACHE_EXPAND; - } - - if (infoRec->UsingPixmapCache && - !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) && - infoRec->FillCacheBltSpans && - (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) && - (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) && - CHECK_ROP(pGC, infoRec->FillCacheBltSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillCacheBltSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillCacheBltSpansFlags)) { - - return DO_CACHE_BLT; - } - - if (infoRec->FillColorExpandSpans && - !(infoRec->FillColorExpandSpansFlags & TRANSPARENCY_ONLY) && - CHECK_ROP(pGC, infoRec->FillColorExpandSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillColorExpandSpansFlags) && - CHECK_COLORS(pGC, infoRec->FillColorExpandSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillColorExpandSpansFlags)) { - - return DO_COLOR_EXPAND; - } - - return 0; -} - -int -XAATiledFillChooser(GCPtr pGC) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - PixmapPtr pPixmap = pGC->tile.pixmap; - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap); - - if (IS_OFFSCREEN_PIXMAP(pPixmap) && infoRec->FillCacheBltSpans && - CHECK_ROP(pGC, infoRec->FillCacheBltSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillCacheBltSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillCacheBltSpansFlags)) { - - return DO_PIXMAP_COPY; - } - - if (!(pPriv->flags & REDUCIBILITY_CHECKED) && - (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) { - XAACheckTileReducibility(pPixmap, infoRec->CanDoMono8x8); - } - - if (pPriv->flags & REDUCIBLE_TO_8x8) { - if ((pPriv->flags & REDUCIBLE_TO_2_COLOR) && infoRec->CanDoMono8x8 && - !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) && - CHECK_ROP(pGC, infoRec->FillMono8x8PatternSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillMono8x8PatternSpansFlags) && - (!(infoRec->FillMono8x8PatternSpansFlags & RGB_EQUAL) || - (CHECK_RGB_EQUAL(pPriv->fg) && CHECK_RGB_EQUAL(pPriv->bg))) && - CHECK_PLANEMASK(pGC, infoRec->FillMono8x8PatternSpansFlags)) { - - return DO_MONO_8x8; - } - - if (infoRec->CanDoColor8x8 && - CHECK_ROP(pGC, infoRec->FillColor8x8PatternSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillColor8x8PatternSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillColor8x8PatternSpansFlags)) { - - return DO_COLOR_8x8; - } - } - - if (infoRec->UsingPixmapCache && infoRec->FillCacheBltSpans && - (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) && - (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) && - CHECK_ROP(pGC, infoRec->FillCacheBltSpansFlags) && - CHECK_ROPSRC(pGC, infoRec->FillCacheBltSpansFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillCacheBltSpansFlags)) { - - return DO_CACHE_BLT; - } - - if (infoRec->FillImageWriteRects && - CHECK_NO_GXCOPY(pGC, infoRec->FillImageWriteRectsFlags) && - CHECK_ROP(pGC, infoRec->FillImageWriteRectsFlags) && - CHECK_ROPSRC(pGC, infoRec->FillImageWriteRectsFlags) && - CHECK_PLANEMASK(pGC, infoRec->FillImageWriteRectsFlags)) { - - return DO_IMAGE_WRITE; - } - - return 0; -} - -static int RotateMasksX[8] = { - 0xFFFFFFFF, 0x7F7F7F7F, 0x3F3F3F3F, 0x1F1F1F1F, - 0x0F0F0F0F, 0x07070707, 0x03030303, 0x01010101 -}; - -static int RotateMasksY[4] = { - 0xFFFFFFFF, 0x00FFFFFF, 0x0000FFFF, 0x000000FF -}; - -void -XAARotateMonoPattern(int *pat0, int *pat1, int xorg, int yorg, Bool msbfirst) -{ - int tmp, mask; - - if (xorg) { - if (msbfirst) - xorg = 8 - xorg; - mask = RotateMasksX[xorg]; - *pat0 = ((*pat0 >> xorg) & mask) | ((*pat0 << (8 - xorg)) & ~mask); - *pat1 = ((*pat1 >> xorg) & mask) | ((*pat1 << (8 - xorg)) & ~mask); - } - if (yorg >= 4) { - tmp = *pat0; - *pat0 = *pat1; - *pat1 = tmp; - yorg -= 4; - } - if (yorg) { - mask = RotateMasksY[yorg]; - yorg <<= 3; - tmp = *pat0; - *pat0 = ((*pat0 >> yorg) & mask) | ((*pat1 << (32 - yorg)) & ~mask); - *pat1 = ((*pat1 >> yorg) & mask) | ((tmp << (32 - yorg)) & ~mask); - } -} - -void -XAAInvalidatePixmapCache(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - XAAPixmapCachePrivatePtr pCachePriv = - (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate; - int i; - - if (!pCachePriv) - return; - - for (i = 0; i < pCachePriv->Num512x512; i++) - (pCachePriv->Info512)[i].serialNumber = 0; - for (i = 0; i < pCachePriv->Num256x256; i++) - (pCachePriv->Info256)[i].serialNumber = 0; - for (i = 0; i < pCachePriv->Num128x128; i++) - (pCachePriv->Info128)[i].serialNumber = 0; - for (i = 0; i < pCachePriv->NumPartial; i++) - (pCachePriv->InfoPartial)[i].serialNumber = 0; - for (i = 0; i < pCachePriv->NumMono; i++) - (pCachePriv->InfoMono)[i].serialNumber = 0; - for (i = 0; i < pCachePriv->NumColor; i++) - (pCachePriv->InfoColor)[i].serialNumber = 0; -} diff --git a/xserver/hw/xfree86/xaa/xaaPict.c b/xserver/hw/xfree86/xaa/xaaPict.c deleted file mode 100644 index 0721768ed..000000000 --- a/xserver/hw/xfree86/xaa/xaaPict.c +++ /dev/null @@ -1,654 +0,0 @@ -/* - * - * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <string.h> - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "xf86str.h" -#include "mi.h" -#include "picturestr.h" -#include "glyphstr.h" -#include "picture.h" -#include "mipict.h" -#include "xaa.h" -#include "xaalocal.h" -#include "xaawrap.h" -#include "xaacexp.h" -#include "xf86fbman.h" -#include "servermd.h" - -Bool -XAAGetPixelFromRGBA(CARD32 *pixel, - CARD16 red, - CARD16 green, CARD16 blue, CARD16 alpha, CARD32 format) -{ - int rbits, bbits, gbits, abits; - int rshift, bshift, gshift, ashift; - - *pixel = 0; - - if (!PICT_FORMAT_COLOR(format)) - return FALSE; - - rbits = PICT_FORMAT_R(format); - gbits = PICT_FORMAT_G(format); - bbits = PICT_FORMAT_B(format); - abits = PICT_FORMAT_A(format); - - if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) { - bshift = 0; - gshift = bbits; - rshift = gshift + gbits; - ashift = rshift + rbits; - } - else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) { - rshift = 0; - gshift = rbits; - bshift = gshift + gbits; - ashift = bshift + bbits; - } - else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) { - bshift = PICT_FORMAT_BPP(format) - bbits; - gshift = bshift - gbits; - rshift = gshift - rbits; - ashift = 0; - } - else - return FALSE; - - *pixel |= (blue >> (16 - bbits)) << bshift; - *pixel |= (red >> (16 - rbits)) << rshift; - *pixel |= (green >> (16 - gbits)) << gshift; - *pixel |= (alpha >> (16 - abits)) << ashift; - - return TRUE; -} - -Bool -XAAGetRGBAFromPixel(CARD32 pixel, - CARD16 *red, - CARD16 *green, CARD16 *blue, CARD16 *alpha, CARD32 format) -{ - int rbits, bbits, gbits, abits; - int rshift, bshift, gshift, ashift; - - if (!PICT_FORMAT_COLOR(format)) - return FALSE; - - rbits = PICT_FORMAT_R(format); - gbits = PICT_FORMAT_G(format); - bbits = PICT_FORMAT_B(format); - abits = PICT_FORMAT_A(format); - - if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) { - bshift = 0; - gshift = bbits; - rshift = gshift + gbits; - ashift = rshift + rbits; - } - else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) { - rshift = 0; - gshift = rbits; - bshift = gshift + gbits; - ashift = bshift + bbits; - } - else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) { - bshift = PICT_FORMAT_BPP(format) - bbits; - gshift = bshift - gbits; - rshift = gshift - rbits; - ashift = 0; - } - else - return FALSE; - - *red = ((pixel >> rshift) & ((1 << rbits) - 1)) << (16 - rbits); - while (rbits < 16) { - *red |= *red >> rbits; - rbits <<= 1; - } - - *green = ((pixel >> gshift) & ((1 << gbits) - 1)) << (16 - gbits); - while (gbits < 16) { - *green |= *green >> gbits; - gbits <<= 1; - } - - *blue = ((pixel >> bshift) & ((1 << bbits) - 1)) << (16 - bbits); - while (bbits < 16) { - *blue |= *blue >> bbits; - bbits <<= 1; - } - - if (abits) { - *alpha = ((pixel >> ashift) & ((1 << abits) - 1)) << (16 - abits); - while (abits < 16) { - *alpha |= *alpha >> abits; - abits <<= 1; - } - } - else - *alpha = 0xffff; - - return TRUE; -} - -/* 8:8:8 + PICT_a8 -> 8:8:8:8 texture */ - -void -XAA_888_plus_PICT_a8_to_8888(CARD32 color, CARD8 *alphaPtr, /* in bytes */ - int alphaPitch, CARD32 *dstPtr, int dstPitch, /* in dwords */ - int width, int height) -{ - int x; - - color &= 0x00ffffff; - - while (height--) { - for (x = 0; x < width; x++) - dstPtr[x] = color | (alphaPtr[x] << 24); - dstPtr += dstPitch; - alphaPtr += alphaPitch; - } -} - -#define DRAWABLE_IS_ON_CARD(pDraw) \ - (pDraw->type == DRAWABLE_WINDOW || \ - (pDraw->type == DRAWABLE_PIXMAP && IS_OFFSCREEN_PIXMAP(pDraw))) - -Bool -XAADoComposite(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - RegionRec region; - CARD32 *formats, *dstformats; - int flags = 0; - BoxPtr pbox; - int nbox, w, h; - - if (!RegionNumRects(pDst->pCompositeClip)) - return TRUE; - - if (!infoRec->pScrn->vtSema || !DRAWABLE_IS_ON_CARD(pDst->pDrawable)) - return FALSE; - - if (DRAWABLE_IS_ON_CARD(pSrc->pDrawable)) - return FALSE; - - if (pSrc->transform || (pMask && pMask->transform)) - return FALSE; - - if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap)) - return FALSE; - - if ((pSrc->repeat && pSrc->repeatType != RepeatNormal) || - (pMask && pMask->repeat && pMask->repeatType != RepeatNormal)) { - return FALSE; - } - - xDst += pDst->pDrawable->x; - yDst += pDst->pDrawable->y; - xSrc += pSrc->pDrawable->x; - ySrc += pSrc->pDrawable->y; - - if (pMask) { - if (pMask->componentAlpha) - return FALSE; - - /* for now we only do it if there is a 1x1 (solid) source */ - - if ((pSrc->pDrawable->width == 1) && (pSrc->pDrawable->height == 1)) { - CARD16 red, green, blue, alpha; - CARD32 pixel = - *((CARD32 *) (((PixmapPtr) (pSrc->pDrawable))->devPrivate.ptr)); - - if (!XAAGetRGBAFromPixel - (pixel, &red, &green, &blue, &alpha, pSrc->format)) - return FALSE; - - xMask += pMask->pDrawable->x; - yMask += pMask->pDrawable->y; - - /* pull out color expandable operations here */ - if ((pMask->format == PICT_a1) && (alpha == 0xffff) && - (op == PictOpOver) && infoRec->WriteBitmap && !pMask->repeat && - !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY) && - (!(infoRec->WriteBitmapFlags & RGB_EQUAL) || - ((red == green) && (green == blue)))) { - PixmapPtr pPix = (PixmapPtr) (pMask->pDrawable); - int skipleft; - - if (!miComputeCompositeRegion(®ion, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, - yDst, width, height)) - return TRUE; - - nbox = RegionNumRects(®ion); - pbox = RegionRects(®ion); - - if (!nbox) - return TRUE; - - XAAGetPixelFromRGBA(&pixel, red, green, blue, 0, pDst->format); - - xMask -= xDst; - yMask -= yDst; - - while (nbox--) { - skipleft = pbox->x1 + xMask; - - (*infoRec->WriteBitmap) (infoRec->pScrn, - pbox->x1, pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1, - (unsigned char *) (pPix-> - devPrivate. - ptr) + - (pPix->devKind * - (pbox->y1 + yMask)) + - ((skipleft >> 3) & ~3), - pPix->devKind, skipleft & 31, - pixel, -1, GXcopy, ~0); - pbox++; - } - - /* WriteBitmap sets the Sync flag */ - RegionUninit(®ion); - return TRUE; - } - - formats = infoRec->CPUToScreenAlphaTextureFormats; - dstformats = infoRec->CPUToScreenAlphaTextureDstFormats; - if (!formats || !dstformats) - return FALSE; - - w = pMask->pDrawable->width; - h = pMask->pDrawable->height; - - if (pMask->repeat) { - if ((infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_TILE) - || - ((infoRec-> - CPUToScreenAlphaTextureFlags & - XAA_RENDER_POWER_OF_2_TILE_ONLY) && ((h & (h - 1)) || - (w & (w - 1))))) { - return FALSE; - } - flags |= XAA_RENDER_REPEAT; - } - - if ((alpha != 0xffff) && - (infoRec-> - CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_SRC_ALPHA)) - return FALSE; - - while (*formats != pMask->format) { - if (!(*formats)) - return FALSE; - formats++; - } - while (*dstformats != pDst->format) { - if (!(*dstformats)) - return FALSE; - dstformats++; - } - - if (!miComputeCompositeRegion(®ion, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, - width, height)) - return TRUE; - - nbox = RegionNumRects(®ion); - pbox = RegionRects(®ion); - - if (!nbox) { - RegionUninit(®ion); - return TRUE; - } - - if (!(infoRec->SetupForCPUToScreenAlphaTexture2) (infoRec->pScrn, - op, red, green, - blue, alpha, - pMask->format, - pDst->format, - ((PixmapPtr) - (pMask-> - pDrawable))-> - devPrivate.ptr, - ((PixmapPtr) - (pMask-> - pDrawable))-> - devKind, w, h, - flags)) { - RegionUninit(®ion); - return FALSE; - } - - xMask -= xDst; - yMask -= yDst; - - while (nbox--) { - (*infoRec->SubsequentCPUToScreenAlphaTexture) (infoRec->pScrn, - pbox->x1, - pbox->y1, - pbox->x1 + xMask, - pbox->y1 + yMask, - pbox->x2 - - pbox->x1, - pbox->y2 - - pbox->y1); - pbox++; - } - - SET_SYNC_FLAG(infoRec); - RegionUninit(®ion); - return TRUE; - } - } - else { - formats = infoRec->CPUToScreenTextureFormats; - dstformats = infoRec->CPUToScreenTextureDstFormats; - if (!formats || !dstformats) - return FALSE; - - w = pSrc->pDrawable->width; - h = pSrc->pDrawable->height; - - if (pSrc->repeat) { - if ((infoRec->CPUToScreenTextureFlags & XAA_RENDER_NO_TILE) || - ((infoRec->CPUToScreenTextureFlags & - XAA_RENDER_POWER_OF_2_TILE_ONLY) && - ((h & (h - 1)) || (w & (w - 1))))) { - return FALSE; - } - flags |= XAA_RENDER_REPEAT; - } - - while (*formats != pSrc->format) { - if (!(*formats)) - return FALSE; - formats++; - } - while (*dstformats != pDst->format) { - if (!(*dstformats)) - return FALSE; - dstformats++; - } - - if (!miComputeCompositeRegion(®ion, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, - width, height)) - return TRUE; - - nbox = RegionNumRects(®ion); - pbox = RegionRects(®ion); - - if (!nbox) { - RegionUninit(®ion); - return TRUE; - } - - if (!(infoRec->SetupForCPUToScreenTexture2) (infoRec->pScrn, - op, pSrc->format, - pDst->format, - ((PixmapPtr) - (pSrc->pDrawable))-> - devPrivate.ptr, - ((PixmapPtr) - (pSrc->pDrawable))-> - devKind, w, h, flags)) { - RegionUninit(®ion); - return FALSE; - } - - xSrc -= xDst; - ySrc -= yDst; - - while (nbox--) { - (*infoRec->SubsequentCPUToScreenTexture) (infoRec->pScrn, - pbox->x1, pbox->y1, - pbox->x1 + xSrc, - pbox->y1 + ySrc, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); - pbox++; - } - - SET_SYNC_FLAG(infoRec); - RegionUninit(®ion); - return TRUE; - } - - return FALSE; -} - -static void -XAACompositeSrcCopy(PicturePtr pSrc, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - int i, nbox; - int xoff, yoff; - BoxPtr pbox; - DDXPointPtr pptSrc; - RegionRec region; - - xDst += pDst->pDrawable->x; - yDst += pDst->pDrawable->y; - xSrc += pSrc->pDrawable->x; - ySrc += pSrc->pDrawable->y; - - if (!miComputeCompositeRegion(®ion, pSrc, NULL, pDst, - xSrc, ySrc, 0, 0, xDst, yDst, width, height)) - return; - - nbox = RegionNumRects(®ion); - pbox = RegionRects(®ion); - - if (!nbox) { - RegionUninit(®ion); - return; - } - pptSrc = malloc(sizeof(DDXPointRec) * nbox); - if (!pptSrc) { - RegionUninit(®ion); - return; - } - xoff = xSrc - xDst; - yoff = ySrc - yDst; - for (i = 0; i < nbox; i++) { - pptSrc[i].x = pbox[i].x1 + xoff; - pptSrc[i].y = pbox[i].y1 + yoff; - } - - infoRec->ScratchGC.planemask = ~0L; - infoRec->ScratchGC.alu = GXcopy; - - XAADoBitBlt(pSrc->pDrawable, pDst->pDrawable, &infoRec->ScratchGC, ®ion, - pptSrc); - - free(pptSrc); - RegionUninit(®ion); - return; -} - -void -XAAComposite(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - - XAA_RENDER_PROLOGUE(pScreen, Composite); - - if (!pMask && infoRec->pScrn->vtSema && - infoRec->ScreenToScreenBitBlt && - pSrc->pDrawable && - DRAWABLE_IS_ON_CARD(pSrc->pDrawable) && - DRAWABLE_IS_ON_CARD(pDst->pDrawable) && - !pSrc->transform && - (!pSrc->repeat || (xSrc >= 0 && ySrc >= 0 && - xSrc + width <= pSrc->pDrawable->width && - ySrc + height <= pSrc->pDrawable->height)) && - ((op == PictOpSrc && - ((pSrc->format == pDst->format) || - (pSrc->format == PICT_a8r8g8b8 && pDst->format == PICT_x8r8g8b8) || - (pSrc->format == PICT_a8b8g8r8 && pDst->format == PICT_x8b8g8r8))) || - (op == PictOpOver && !pSrc->alphaMap && !pDst->alphaMap && - pSrc->format == pDst->format && - (pSrc->format == PICT_x8r8g8b8 || pSrc->format == PICT_x8b8g8r8)))) { - XAACompositeSrcCopy(pSrc, pDst, xSrc, ySrc, xDst, yDst, width, height); - } - else if (!pSrc->pDrawable || (pMask && !pMask->pDrawable) || - !infoRec->Composite || - !(*infoRec->Composite) (op, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, - width, height)) { - if (infoRec->pScrn->vtSema && - ((pSrc->pDrawable && - (pSrc->pDrawable->type == DRAWABLE_WINDOW || - IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) || - pDst->pDrawable->type == DRAWABLE_WINDOW || - IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) { - SYNC_CHECK(pDst->pDrawable); - } - (*GetPictureScreen(pScreen)->Composite) (op, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, yDst, width, height); - } - - if (pDst->pDrawable->type == DRAWABLE_PIXMAP) - (XAA_GET_PIXMAP_PRIVATE((PixmapPtr) (pDst->pDrawable)))->flags |= DIRTY; - - XAA_RENDER_EPILOGUE(pScreen, Composite, XAAComposite); -} - -Bool -XAADoGlyphs(CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, - INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - - if (!RegionNumRects(pDst->pCompositeClip)) - return TRUE; - - if (!infoRec->pScrn->vtSema || - ((pDst->pDrawable->type != DRAWABLE_WINDOW) && - !IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) - return FALSE; - - if ((pSrc->pDrawable->type != DRAWABLE_PIXMAP) || - IS_OFFSCREEN_PIXMAP(pSrc->pDrawable)) - return FALSE; - - /* - * If it looks like we have a chance of being able to draw these - * glyphs with an accelerated Composite, do that now to avoid - * unneeded and costly syncs. - */ - if (maskFormat) { - if (!infoRec->CPUToScreenAlphaTextureFormats) - return FALSE; - } - else { - if (!infoRec->CPUToScreenTextureFormats) - return FALSE; - } - - miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); - - return TRUE; -} - -void -XAAGlyphs(CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, - INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); - - XAA_RENDER_PROLOGUE(pScreen, Glyphs); - - if (!pSrc->pDrawable || !infoRec->Glyphs || - !(*infoRec->Glyphs) (op, pSrc, pDst, maskFormat, - xSrc, ySrc, nlist, list, glyphs)) { - if (infoRec->pScrn->vtSema && - ((pSrc->pDrawable && - (pSrc->pDrawable->type == DRAWABLE_WINDOW || - IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) || - pDst->pDrawable->type == DRAWABLE_WINDOW || - IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) { - SYNC_CHECK(pDst->pDrawable); - } - (*GetPictureScreen(pScreen)->Glyphs) (op, pSrc, pDst, maskFormat, - xSrc, ySrc, nlist, list, glyphs); - } - - if (pDst->pDrawable->type == DRAWABLE_PIXMAP) - (XAA_GET_PIXMAP_PRIVATE((PixmapPtr) (pDst->pDrawable)))->flags |= DIRTY; - - XAA_RENDER_EPILOGUE(pScreen, Glyphs, XAAGlyphs); -} diff --git a/xserver/hw/xfree86/xaa/xaaROP.c b/xserver/hw/xfree86/xaa/xaaROP.c deleted file mode 100644 index 3b6ec9385..000000000 --- a/xserver/hw/xfree86/xaa/xaaROP.c +++ /dev/null @@ -1,182 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <X11/X.h> -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include "scrnintstr.h" -#include "xf86str.h" -#include "xaarop.h" -#include "xaa.h" -#include "xaalocal.h" - -int XAACopyROP[16] = { - ROP_0, /* GXclear */ - ROP_DSa, /* GXand */ - ROP_SDna, /* GXandReverse */ - ROP_S, /* GXcopy */ - ROP_DSna, /* GXandInverted */ - ROP_D, /* GXnoop */ - ROP_DSx, /* GXxor */ - ROP_DSo, /* GXor */ - ROP_DSon, /* GXnor */ - ROP_DSxn, /* GXequiv */ - ROP_Dn, /* GXinvert */ - ROP_SDno, /* GXorReverse */ - ROP_Sn, /* GXcopyInverted */ - ROP_DSno, /* GXorInverted */ - ROP_DSan, /* GXnand */ - ROP_1 /* GXset */ -}; - -int XAACopyROP_PM[16] = { - ROP_0, /* not used */ - ROP_DSPnoa, - ROP_DPSnaon, - ROP_DPSDxax, - ROP_DPSana, - ROP_D, /* not used */ - ROP_DPSax, - ROP_DPSao, - ROP_DPSaon, - ROP_DPSaxn, - ROP_Dn, /* not used */ - ROP_DPSanan, - ROP_PSDPxox, /* is that correct ? */ - ROP_DPSnao, - ROP_DSPnoan, - ROP_1 /* not used */ -}; - -int XAAPatternROP[16] = { - ROP_0, - ROP_DPa, - ROP_PDna, - ROP_P, - ROP_DPna, - ROP_D, - ROP_DPx, - ROP_DPo, - ROP_DPon, - ROP_PDxn, - ROP_Dn, - ROP_PDno, - ROP_Pn, - ROP_DPno, - ROP_DPan, - ROP_1 -}; - -int XAAPatternROP_PM[16] = { - ROP_DPna, - ROP_DPSnoa, - ROP_DSPnaon, - ROP_DSPDxax, - ROP_DPSana, - ROP_D, - ROP_DPSax, - ROP_DPSao, - ROP_DPSaon, - ROP_DPSaxn, - ROP_DPx, - ROP_DPSanan, - ROP_SPDSxox, /* is that correct ? */ - ROP_DSPnao, - ROP_DPSnoan, - ROP_DPo -}; - -int -XAAGetCopyROP(int i) -{ - return XAACopyROP[i]; -} - -int -XAAGetCopyROP_PM(int i) -{ - return XAACopyROP_PM[i]; -} - -int -XAAGetPatternROP(int i) -{ - return XAAPatternROP[i]; -} - -int -XAAGetPatternROP_PM(int i) -{ - return XAAPatternROP_PM[i]; -} - -int -XAAHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, int pm, int *rop) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int ret = 0; - - pm &= infoRec->FullPlanemasks[pScrn->depth - 1]; - - if (pm == infoRec->FullPlanemasks[pScrn->depth - 1]) { - if (!NO_SRC_ROP(*rop)) - ret |= ROP_PAT; - *rop = XAAPatternROP[*rop]; - } - else { - switch (*rop) { - case GXnoop: - break; - case GXset: - case GXclear: - case GXinvert: - ret |= ROP_PAT; - *fg = pm; - if (*bg != -1) - *bg = pm; - break; - default: - ret |= ROP_PAT | ROP_SRC; - break; - } - *rop = XAAPatternROP_PM[*rop]; - } - - return ret; -} - -int -XAAHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int ret = 0; - - pm &= infoRec->FullPlanemasks[pScrn->depth - 1]; - - if (pm == infoRec->FullPlanemasks[pScrn->depth - 1]) { - if (!NO_SRC_ROP(*rop)) - ret |= ROP_PAT; - *rop = XAAPatternROP[*rop]; - } - else { - switch (*rop) { - case GXnoop: - break; - case GXset: - case GXclear: - case GXinvert: - ret |= ROP_PAT; - *fg = pm; - break; - default: - ret |= ROP_PAT | ROP_SRC; - break; - } - *rop = XAAPatternROP_PM[*rop]; - } - - return ret; -} diff --git a/xserver/hw/xfree86/xaa/xaaRect.c b/xserver/hw/xfree86/xaa/xaaRect.c deleted file mode 100644 index 002090085..000000000 --- a/xserver/hw/xfree86/xaa/xaaRect.c +++ /dev/null @@ -1,121 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" - -/* - Much of this file based on code by - Harm Hanemaayer (H.Hanemaayer@inter.nl.net). -*/ - -void -XAAPolyRectangleThinSolid(DrawablePtr pDrawable, - GCPtr pGC, int nRectsInit, xRectangle *pRectsInit) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int nClipRects; /* number of clip rectangles */ - BoxPtr pClipRects; /* points to the list of clip rects */ - int xOrigin; /* Drawables x origin */ - int yOrigin; /* Drawables x origin */ - xRectangle *pRect; /* list of rects */ - int nRects; /* running count of number of rects */ - int origX1, origY1; /* original rectangle's U/L corner */ - int origX2, origY2; /* original rectangle's L/R corner */ - int clippedX1; /* clipped rectangle's left x */ - int clippedY1; /* clipped rectangle's top y */ - int clippedX2; /* clipped rectangle's right x */ - int clippedY2; /* clipped rectangle's bottom y */ - int clipXMin; /* upper left corner of clip rect */ - int clipYMin; /* upper left corner of clip rect */ - int clipXMax; /* lower right corner of clip rect */ - int clipYMax; /* lower right corner of clip rect */ - int width, height; /* width and height of rect */ - - nClipRects = RegionNumRects(pGC->pCompositeClip); - pClipRects = RegionRects(pGC->pCompositeClip); - - if (!nClipRects) - return; - - xOrigin = pDrawable->x; - yOrigin = pDrawable->y; - - (*infoRec->SetupForSolidLine) (infoRec->pScrn, - pGC->fgPixel, pGC->alu, pGC->planemask); - - for (; nClipRects > 0; nClipRects--, pClipRects++) { - clipYMin = pClipRects->y1; - clipYMax = pClipRects->y2 - 1; - clipXMin = pClipRects->x1; - clipXMax = pClipRects->x2 - 1; - - for (pRect = pRectsInit, nRects = nRectsInit; - nRects > 0; nRects--, pRect++) { - /* translate rectangle data over to the drawable */ - origX1 = pRect->x + xOrigin; - origY1 = pRect->y + yOrigin; - origX2 = origX1 + pRect->width; - origY2 = origY1 + pRect->height; - - /* reject entire rectangle if completely outside clip rect */ - if ((origX1 > clipXMax) || (origX2 < clipXMin) || - (origY1 > clipYMax) || (origY2 < clipYMin)) - continue; - - /* clip the rectangle */ - clippedX1 = max(origX1, clipXMin); - clippedX2 = min(origX2, clipXMax); - clippedY1 = max(origY1, clipYMin); - clippedY2 = min(origY2, clipYMax); - - width = clippedX2 - clippedX1 + 1; - - if (origY1 >= clipYMin) { - (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn, - clippedX1, clippedY1, - width, DEGREES_0); - - /* don't overwrite corner */ - clippedY1++; - } - - if ((origY2 <= clipYMax) && (origY1 != origY2)) { - (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn, - clippedX1, clippedY2, - width, DEGREES_0); - - /* don't overwrite corner */ - clippedY2--; - } - - if (clippedY2 < clippedY1) - continue; - - height = clippedY2 - clippedY1 + 1; - - /* draw vertical edges using lines if not clipped out */ - if (origX1 >= clipXMin) - (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn, - clippedX1, clippedY1, - height, DEGREES_270); - - if ((origX2 <= clipXMax) && (origX2 != origX1)) - (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn, - clippedX2, clippedY1, - height, DEGREES_270); - } - } - - SET_SYNC_FLAG(infoRec); -} diff --git a/xserver/hw/xfree86/xaa/xaaSpans.c b/xserver/hw/xfree86/xaa/xaaSpans.c deleted file mode 100644 index f03452a46..000000000 --- a/xserver/hw/xfree86/xaa/xaaSpans.c +++ /dev/null @@ -1,876 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "xf86str.h" -#include "mi.h" -#include "mispans.h" -#include "xaa.h" -#include "xaalocal.h" - -static void XAARenderSolidSpans(GCPtr, int, DDXPointPtr, int *, int, int, int); -static void XAARenderColor8x8Spans(GCPtr, int, DDXPointPtr, int *, int, int, - int); -static void XAARenderMono8x8Spans(GCPtr, int, DDXPointPtr, int *, int, int, - int); -static void XAARenderCacheBltSpans(GCPtr, int, DDXPointPtr, int *, int, int, - int); -static void XAARenderColorExpandSpans(GCPtr, int, DDXPointPtr, int *, int, int, - int); -static void XAARenderCacheExpandSpans(GCPtr, int, DDXPointPtr, int *, int, int, - int); -static void XAARenderPixmapCopySpans(GCPtr, int, DDXPointPtr, int *, int, int, - int); - -void -XAAFillSpans(DrawablePtr pDraw, GC * pGC, int nInit, /* number of spans to fill */ - DDXPointPtr pptInit, /* pointer to list of start points */ - int *pwidthInit, /* pointer to list of n widths */ - int fSorted) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int type = 0; - ClipAndRenderSpansFunc function; - Bool fastClip = FALSE; - - if ((nInit <= 0) || !pGC->planemask) - return; - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - switch (pGC->fillStyle) { - case FillSolid: - type = DO_SOLID; - break; - case FillStippled: - type = (*infoRec->StippledFillChooser) (pGC); - break; - case FillOpaqueStippled: - if ((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSpansSolid && - CHECK_PLANEMASK(pGC, infoRec->FillSpansSolidFlags) && - CHECK_ROP(pGC, infoRec->FillSpansSolidFlags) && - CHECK_ROPSRC(pGC, infoRec->FillSpansSolidFlags) && - CHECK_FG(pGC, infoRec->FillSpansSolidFlags)) - type = DO_SOLID; - else - type = (*infoRec->OpaqueStippledFillChooser) (pGC); - break; - case FillTiled: - type = (*infoRec->TiledFillChooser) (pGC); - break; - } - - switch (type) { - case DO_SOLID: - function = XAARenderSolidSpans; - if (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL) - fastClip = TRUE; - break; - case DO_COLOR_8x8: - function = XAARenderColor8x8Spans; - if (infoRec->ClippingFlags & HARDWARE_CLIP_COLOR_8x8_FILL) - fastClip = TRUE; - break; - case DO_MONO_8x8: - function = XAARenderMono8x8Spans; - if (infoRec->ClippingFlags & HARDWARE_CLIP_MONO_8x8_FILL) - fastClip = TRUE; - break; - case DO_CACHE_BLT: - function = XAARenderCacheBltSpans; - if (infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY) - fastClip = TRUE; - break; - case DO_COLOR_EXPAND: - function = XAARenderColorExpandSpans; - break; - case DO_CACHE_EXPAND: - function = XAARenderCacheExpandSpans; - if (infoRec->ClippingFlags & - HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND) - fastClip = TRUE; - break; - case DO_PIXMAP_COPY: - function = XAARenderPixmapCopySpans; - if (infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY) - fastClip = TRUE; - break; - case DO_IMAGE_WRITE: - default: - (*XAAFallbackOps.FillSpans) (pDraw, pGC, nInit, pptInit, - pwidthInit, fSorted); - return; - } - - if ((nInit < 10) || (RegionNumRects(pGC->pCompositeClip) != 1)) - fastClip = FALSE; - - if (fastClip) { - infoRec->ClipBox = &pGC->pCompositeClip->extents; - (*function) (pGC, nInit, pptInit, pwidthInit, fSorted, - pDraw->x, pDraw->y); - infoRec->ClipBox = NULL; - } - else - XAAClipAndRenderSpans(pGC, pptInit, pwidthInit, nInit, fSorted, - function, pDraw->x, pDraw->y); -} - - /*********************\ - | Solid Spans | - \*********************/ - -static void -XAARenderSolidSpans(GCPtr pGC, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - (*infoRec->FillSolidSpans) (infoRec->pScrn, pGC->fgPixel, - pGC->alu, pGC->planemask, n, ppt, pwidth, - fSorted); -} - - /************************\ - | Mono 8x8 Spans | - \************************/ - -static void -XAARenderMono8x8Spans(GCPtr pGC, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAPixmapPtr pPriv; - int fg, bg; - - switch (pGC->fillStyle) { - case FillStippled: - pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); - fg = pGC->fgPixel; - bg = -1; - break; - case FillOpaqueStippled: - pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); - fg = pGC->fgPixel; - bg = pGC->bgPixel; - break; - case FillTiled: - pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); - fg = pPriv->fg; - bg = pPriv->bg; - break; - default: /* Muffle compiler */ - pPriv = NULL; /* Kaboom */ - fg = -1; - bg = -1; - break; - } - - (*infoRec->FillMono8x8PatternSpans) (infoRec->pScrn, - fg, bg, pGC->alu, pGC->planemask, - n, ppt, pwidth, fSorted, - pPriv->pattern0, pPriv->pattern1, - (xorg + pGC->patOrg.x), - (yorg + pGC->patOrg.y)); -} - - /*************************\ - | Color 8x8 Spans | - \*************************/ - -static void -XAARenderColor8x8Spans(GCPtr pGC, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAACacheInfoPtr pCache; - PixmapPtr pPix; - int fg, bg; - - switch (pGC->fillStyle) { - case FillStippled: - pPix = pGC->stipple; - fg = pGC->fgPixel; - bg = -1; - break; - case FillOpaqueStippled: - pPix = pGC->stipple; - fg = pGC->fgPixel; - bg = pGC->bgPixel; - break; - case FillTiled: - pPix = pGC->tile.pixmap; - fg = -1; - bg = -1; - break; - default: /* Muffle compiler */ - pPix = NULL; - fg = -1; - bg = -1; - break; - } - - pCache = (*infoRec->CacheColor8x8Pattern) (infoRec->pScrn, pPix, fg, bg); - - (*infoRec->FillColor8x8PatternSpans) (infoRec->pScrn, - pGC->alu, pGC->planemask, n, ppt, - pwidth, fSorted, pCache, - (yorg + pGC->patOrg.x), - (xorg + pGC->patOrg.y)); -} - - /****************************\ - | Color Expand Spans | - \****************************/ - -static void -XAARenderColorExpandSpans(GCPtr pGC, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int fg, bg; - - switch (pGC->fillStyle) { - case FillStippled: - fg = pGC->fgPixel; - bg = -1; - break; - case FillOpaqueStippled: - fg = pGC->fgPixel; - bg = pGC->bgPixel; - break; - default: /* Muffle compiler */ - fg = -1; - bg = -1; - break; - } - - (*infoRec->FillColorExpandSpans) (infoRec->pScrn, fg, bg, - pGC->alu, pGC->planemask, n, ppt, pwidth, - fSorted, (xorg + pGC->patOrg.x), - (yorg + pGC->patOrg.y), pGC->stipple); - -} - - /*************************\ - | Cache Blt Spans | - \*************************/ - -static void -XAARenderCacheBltSpans(GCPtr pGC, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAACacheInfoPtr pCache; - - switch (pGC->fillStyle) { - case FillStippled: - pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple, - pGC->fgPixel, -1); - break; - case FillOpaqueStippled: - pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple, - pGC->fgPixel, pGC->bgPixel); - break; - case FillTiled: - pCache = (*infoRec->CacheTile) (infoRec->pScrn, pGC->tile.pixmap); - break; - default: /* Muffle compiler */ - pCache = NULL; - break; - } - - (*infoRec->FillCacheBltSpans) (infoRec->pScrn, - pGC->alu, pGC->planemask, n, ppt, pwidth, - fSorted, pCache, (xorg + pGC->patOrg.x), - (yorg + pGC->patOrg.y)); - -} - - /****************************\ - | Cache Expand Spans | - \****************************/ - -static void -XAARenderCacheExpandSpans(GCPtr pGC, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int fg, bg; - - switch (pGC->fillStyle) { - case FillStippled: - fg = pGC->fgPixel; - bg = -1; - break; - case FillOpaqueStippled: - fg = pGC->fgPixel; - bg = pGC->bgPixel; - break; - default: /* Muffle compiler */ - fg = -1; - bg = -1; - break; - } - - (*infoRec->FillCacheExpandSpans) (infoRec->pScrn, fg, bg, - pGC->alu, pGC->planemask, n, ppt, pwidth, - fSorted, (xorg + pGC->patOrg.x), - (yorg + pGC->patOrg.y), pGC->stipple); -} - - /***************************\ - | Pixmap Copy Spans | - \***************************/ - -static void -XAARenderPixmapCopySpans(GCPtr pGC, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec); - XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); - - pCache->x = pPriv->offscreenArea->box.x1; - pCache->y = pPriv->offscreenArea->box.y1; - pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x; - pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y; - pCache->trans_color = -1; - - (*infoRec->FillCacheBltSpans) (infoRec->pScrn, - pGC->alu, pGC->planemask, n, ppt, pwidth, - fSorted, pCache, (xorg + pGC->patOrg.x), - (yorg + pGC->patOrg.y)); -} - - /****************\ - | Solid | - \****************/ - -void -XAAFillSolidSpans(ScrnInfoPtr pScrn, - int fg, int rop, - unsigned int planemask, - int n, DDXPointPtr ppt, int *pwidth, int fSorted) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - (*infoRec->SetupForSolidFill) (pScrn, fg, rop, planemask); - - if (infoRec->ClipBox) - (*infoRec->SetClippingRectangle) (infoRec->pScrn, - infoRec->ClipBox->x1, - infoRec->ClipBox->y1, - infoRec->ClipBox->x2 - 1, - infoRec->ClipBox->y2 - 1); - - while (n--) { - if (*pwidth > 0) - (*infoRec->SubsequentSolidFillRect) (pScrn, ppt->x, ppt->y, - *pwidth, 1); - ppt++; - pwidth++; - } - - if (infoRec->ClipBox) - (*infoRec->DisableClipping) (infoRec->pScrn); - - SET_SYNC_FLAG(infoRec); -} - - /***************\ - | Mono 8x8 | - \***************/ - -void -XAAFillMono8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, - int pattern0, int pattern1, - int xorigin, int yorigin) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int patx = pattern0, paty = pattern1; - int xorg = (-xorigin) & 0x07; - int yorg = (-yorigin) & 0x07; - - if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) { - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - XAARotateMonoPattern(&patx, &paty, xorg, yorg, - (infoRec->Mono8x8PatternFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST)); - xorg = patx; - yorg = paty; - } - } - else { - XAACacheInfoPtr pCache = - (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1); - patx = pCache->x; - paty = pCache->y; - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - int slot = (yorg << 3) + xorg; - - patx += pCache->offsets[slot].x; - paty += pCache->offsets[slot].y; - xorg = patx; - yorg = paty; - } - } - - (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty, - fg, bg, rop, planemask); - - if (infoRec->ClipBox) - (*infoRec->SetClippingRectangle) (infoRec->pScrn, - infoRec->ClipBox->x1, - infoRec->ClipBox->y1, - infoRec->ClipBox->x2 - 1, - infoRec->ClipBox->y2 - 1); - - while (n--) { - (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, - xorg, yorg, ppt->x, - ppt->y, *pwidth, 1); - ppt++; - pwidth++; - } - - if (infoRec->ClipBox) - (*infoRec->DisableClipping) (infoRec->pScrn); - - SET_SYNC_FLAG(infoRec); -} - -void -XAAFillMono8x8PatternSpans(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, - int pattern0, int pattern1, int xorigin, int yorigin) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int patx = pattern0, paty = pattern1; - int xorg, yorg, slot; - XAACacheInfoPtr pCache = NULL; - - if (!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS)) { - pCache = (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1); - patx = pCache->x; - paty = pCache->y; - } - - (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty, - fg, bg, rop, planemask); - - if (infoRec->ClipBox) - (*infoRec->SetClippingRectangle) (infoRec->pScrn, - infoRec->ClipBox->x1, - infoRec->ClipBox->y1, - infoRec->ClipBox->x2 - 1, - infoRec->ClipBox->y2 - 1); - - while (n--) { - xorg = (ppt->x - xorigin) & 0x07; - yorg = (ppt->y - yorigin) & 0x07; - - if (!(infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - if (infoRec->Mono8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_BITS) { - patx = pattern0; - paty = pattern1; - XAARotateMonoPattern(&patx, &paty, xorg, yorg, - (infoRec->Mono8x8PatternFillFlags & - BIT_ORDER_IN_BYTE_MSBFIRST)); - xorg = patx; - yorg = paty; - } - else { - slot = (yorg << 3) + xorg; - xorg = patx + pCache->offsets[slot].x; - yorg = paty + pCache->offsets[slot].y; - } - } - - (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, - xorg, yorg, ppt->x, - ppt->y, *pwidth, 1); - ppt++; - pwidth++; - } - - if (infoRec->ClipBox) - (*infoRec->DisableClipping) (infoRec->pScrn); - - SET_SYNC_FLAG(infoRec); -} - - /****************\ - | Color 8x8 | - \****************/ - -void -XAAFillColor8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, - XAACacheInfoPtr pCache, - int xorigin, int yorigin) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int patx = pCache->x, paty = pCache->y; - int xorg = (-xorigin) & 0x07; - int yorg = (-yorigin) & 0x07; - - if (!(infoRec->Color8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - int slot = (yorg << 3) + xorg; - - paty += pCache->offsets[slot].y; - patx += pCache->offsets[slot].x; - xorg = patx; - yorg = paty; - } - - (*infoRec->SetupForColor8x8PatternFill) (pScrn, patx, paty, - rop, planemask, - pCache->trans_color); - - if (infoRec->ClipBox) - (*infoRec->SetClippingRectangle) (infoRec->pScrn, - infoRec->ClipBox->x1, - infoRec->ClipBox->y1, - infoRec->ClipBox->x2 - 1, - infoRec->ClipBox->y2 - 1); - - while (n--) { - (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn, - xorg, yorg, ppt->x, - ppt->y, *pwidth, 1); - ppt++; - pwidth++; - } - - if (infoRec->ClipBox) - (*infoRec->DisableClipping) (infoRec->pScrn); - - SET_SYNC_FLAG(infoRec); -} - -void -XAAFillColor8x8PatternSpans(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, - XAACacheInfoPtr pCache, int xorigin, int yorigin) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int xorg, yorg, slot; - - (*infoRec->SetupForColor8x8PatternFill) (pScrn, pCache->x, pCache->y, - rop, planemask, - pCache->trans_color); - - if (infoRec->ClipBox) - (*infoRec->SetClippingRectangle) (infoRec->pScrn, - infoRec->ClipBox->x1, - infoRec->ClipBox->y1, - infoRec->ClipBox->x2 - 1, - infoRec->ClipBox->y2 - 1); - - while (n--) { - xorg = (ppt->x - xorigin) & 0x07; - yorg = (ppt->y - yorigin) & 0x07; - - if (!(infoRec->Color8x8PatternFillFlags & - HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { - slot = (yorg << 3) + xorg; - yorg = pCache->y + pCache->offsets[slot].y; - xorg = pCache->x + pCache->offsets[slot].x; - } - - (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn, - xorg, yorg, ppt->x, - ppt->y, *pwidth, 1); - ppt++; - pwidth++; - } - - if (infoRec->ClipBox) - (*infoRec->DisableClipping) (infoRec->pScrn); - - SET_SYNC_FLAG(infoRec); -} - - /*****************\ - | Cache Blit | - \*****************/ - -void -XAAFillCacheBltSpans(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, XAACacheInfoPtr pCache, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int x, w, phaseX, phaseY, blit_w; - - (*infoRec->SetupForScreenToScreenCopy) (pScrn, 1, 1, rop, planemask, - pCache->trans_color); - - if (infoRec->ClipBox) - (*infoRec->SetClippingRectangle) (infoRec->pScrn, - infoRec->ClipBox->x1, - infoRec->ClipBox->y1, - infoRec->ClipBox->x2 - 1, - infoRec->ClipBox->y2 - 1); - - while (n--) { - x = ppt->x; - w = *pwidth; - phaseX = (x - xorg) % pCache->orig_w; - if (phaseX < 0) - phaseX += pCache->orig_w; - phaseY = (ppt->y - yorg) % pCache->orig_h; - if (phaseY < 0) - phaseY += pCache->orig_h; - - while (1) { - blit_w = pCache->w - phaseX; - if (blit_w > w) - blit_w = w; - - (*infoRec->SubsequentScreenToScreenCopy) (pScrn, - pCache->x + phaseX, - pCache->y + phaseY, x, - ppt->y, blit_w, 1); - - w -= blit_w; - if (!w) - break; - x += blit_w; - phaseX = (phaseX + blit_w) % pCache->orig_w; - } - ppt++; - pwidth++; - } - - if (infoRec->ClipBox) - (*infoRec->DisableClipping) (infoRec->pScrn); - - SET_SYNC_FLAG(infoRec); -} - - /****************\ - | Cache Expand | - \****************/ - -void -XAAFillCacheExpandSpans(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, int xorg, int yorg, PixmapPtr pPix) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int x, w, phaseX, phaseY, blit_w, cacheWidth; - XAACacheInfoPtr pCache; - - pCache = (*infoRec->CacheMonoStipple) (pScrn, pPix); - - cacheWidth = (pCache->w * pScrn->bitsPerPixel) / - infoRec->CacheColorExpandDensity; - - (*infoRec->SetupForScreenToScreenColorExpandFill) (pScrn, fg, bg, rop, - planemask); - - if (infoRec->ClipBox) - (*infoRec->SetClippingRectangle) (infoRec->pScrn, - infoRec->ClipBox->x1, - infoRec->ClipBox->y1, - infoRec->ClipBox->x2 - 1, - infoRec->ClipBox->y2 - 1); - - while (n--) { - x = ppt->x; - w = *pwidth; - phaseX = (x - xorg) % pCache->orig_w; - if (phaseX < 0) - phaseX += pCache->orig_w; - phaseY = (ppt->y - yorg) % pCache->orig_h; - if (phaseY < 0) - phaseY += pCache->orig_h; - - while (1) { - blit_w = cacheWidth - phaseX; - if (blit_w > w) - blit_w = w; - - (*infoRec->SubsequentScreenToScreenColorExpandFill) (pScrn, x, - ppt->y, blit_w, - 1, pCache->x, - pCache->y + - phaseY, - phaseX); - - w -= blit_w; - if (!w) - break; - x += blit_w; - phaseX = (phaseX + blit_w) % pCache->orig_w; - } - ppt++; - pwidth++; - } - - if (infoRec->ClipBox) - (*infoRec->DisableClipping) (infoRec->pScrn); - - SET_SYNC_FLAG(infoRec); -} - -void -XAAClipAndRenderSpans(GCPtr pGC, - DDXPointPtr ppt, - int *pwidth, - int nspans, - int fSorted, - ClipAndRenderSpansFunc func, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - DDXPointPtr pptNew, pptBase; - int *pwidthBase, *pwidthNew; - int Right, numRects, MaxBoxes; - - MaxBoxes = infoRec->PreAllocSize / (sizeof(DDXPointRec) + sizeof(int)); - pptBase = (DDXPointRec *) infoRec->PreAllocMem; - pwidthBase = (int *) (&pptBase[MaxBoxes]); - - pptNew = pptBase; - pwidthNew = pwidthBase; - - numRects = RegionNumRects(pGC->pCompositeClip); - - if (numRects == 1) { - BoxPtr pextent = RegionRects(pGC->pCompositeClip); - - while (nspans--) { - if ((pextent->y1 <= ppt->y) && (ppt->y < pextent->y2)) { - pptNew->x = max(pextent->x1, ppt->x); - Right = ppt->x + *pwidth; - *pwidthNew = min(pextent->x2, Right) - pptNew->x; - - if (*pwidthNew > 0) { - pptNew->y = ppt->y; - pptNew++; - pwidthNew++; - - if (pptNew >= (pptBase + MaxBoxes)) { - (*func) (pGC, MaxBoxes, pptBase, pwidthBase, fSorted, - xorg, yorg); - pptNew = pptBase; - pwidthNew = pwidthBase; - } - } - } - ppt++; - pwidth++; - } - } - else if (numRects) { - BoxPtr pbox; - int nbox; - - while (nspans--) { - nbox = numRects; - pbox = RegionRects(pGC->pCompositeClip); - - /* find the first band */ - while (nbox && (pbox->y2 <= ppt->y)) { - pbox++; - nbox--; - } - - if (nbox && (pbox->y1 <= ppt->y)) { - int orig_y = pbox->y1; - - Right = ppt->x + *pwidth; - while (nbox && (orig_y == pbox->y1)) { - if (pbox->x2 <= ppt->x) { - nbox--; - pbox++; - continue; - } - - if (pbox->x1 >= Right) { - nbox = 0; - break; - } - - pptNew->x = max(pbox->x1, ppt->x); - *pwidthNew = min(pbox->x2, Right) - pptNew->x; - if (*pwidthNew > 0) { - pptNew->y = ppt->y; - pptNew++; - pwidthNew++; - - if (pptNew >= (pptBase + MaxBoxes)) { - (*func) (pGC, MaxBoxes, pptBase, pwidthBase, - fSorted, xorg, yorg); - pptNew = pptBase; - pwidthNew = pwidthBase; - } - } - pbox++; - nbox--; - } - } - ppt++; - pwidth++; - } - } - - if (pptNew != pptBase) - (*func) (pGC, pptNew - pptBase, pptBase, pwidthBase, fSorted, - xorg, yorg); -} diff --git a/xserver/hw/xfree86/xaa/xaaStateChange.c b/xserver/hw/xfree86/xaa/xaaStateChange.c deleted file mode 100644 index 0218cb57c..000000000 --- a/xserver/hw/xfree86/xaa/xaaStateChange.c +++ /dev/null @@ -1,1665 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "xf86str.h" -#include "mi.h" -#include "miline.h" -#include "xaa.h" -#include "xaalocal.h" -#include "xaawrap.h" -#include "servermd.h" - -#define XAA_STATE_WRAP(func) do {\ -if(infoRec->func) { \ - pStatePriv->func = infoRec->func;\ - infoRec->func = XAAStateWrap##func;\ -}} while(0) - -/* Wrap all XAA functions and allocate our private structure. - */ - -typedef struct _XAAStateWrapRec { - ScrnInfoPtr pScrn; - void (*RestoreAccelState) (ScrnInfoPtr pScrn); - void (*Sync) (ScrnInfoPtr pScrn); - void (*SetupForScreenToScreenCopy) (ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, unsigned int planemask, - int trans_color); - void (*SetupForSolidFill) (ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask); - void (*SetupForSolidLine) (ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask); - void (*SetupForDashedLine) (ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int length, - unsigned char *pattern); - void (*SetClippingRectangle) (ScrnInfoPtr pScrn, int left, int top, - int right, int bottom); - void (*DisableClipping) (ScrnInfoPtr pScrn); - void (*SetupForMono8x8PatternFill) (ScrnInfoPtr pScrn, int patx, int paty, - int fg, int bg, int rop, - unsigned int planemask); - void (*SetupForColor8x8PatternFill) (ScrnInfoPtr pScrn, int patx, int paty, - int rop, unsigned int planemask, - int transparency_color); - void (*SetupForCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn, int fg, - int bg, int rop, - unsigned int planemask); - void (*SetupForScanlineCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask); - void (*SetupForScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask); - void (*SetupForImageWrite) (ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int transparency_color, - int bpp, int depth); - void (*SetupForScanlineImageWrite) (ScrnInfoPtr pScrn, int rop, - unsigned int planemask, - int transparency_color, - int bpp, int depth); - void (*SetupForImageRead) (ScrnInfoPtr pScrn, int bpp, int depth); - void (*ScreenToScreenBitBlt) (ScrnInfoPtr pScrn, int nbox, - DDXPointPtr pptSrc, BoxPtr pbox, int xdir, - int ydir, int alu, unsigned int planmask); - void (*WriteBitmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int skipleft, - int fg, int bg, int rop, unsigned int planemask); - void (*FillSolidRects) (ScrnInfoPtr pScrn, int fg, int rop, - unsigned int planemask, int nBox, BoxPtr pBox); - void (*FillMono8x8PatternRects) (ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int nBox, - BoxPtr pBox, int pat0, int pat1, - int xorg, int yorg); - void (*FillColor8x8PatternRects) (ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int nBox, - BoxPtr pBox, int xorg, int yorg, - XAACacheInfoPtr pCache); - void (*FillCacheBltRects) (ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int nBox, BoxPtr pBox, - int xorg, int yorg, XAACacheInfoPtr pCache); - void (*FillColorExpandRects) (ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int nBox, - BoxPtr pBox, int xorg, int yorg, - PixmapPtr pPix); - void (*FillCacheExpandRects) (ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int nBox, BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - void (*FillImageWriteRects) (ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int nBox, BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - void (*FillSolidSpans) (ScrnInfoPtr pScrn, int fg, int rop, - unsigned int planemask, int n, DDXPointPtr points, - int *widths, int fSorted); - void (*FillMono8x8PatternSpans) (ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int n, - DDXPointPtr points, int *widths, - int fSorted, int pat0, int pat1, - int xorg, int yorg); - void (*FillColor8x8PatternSpans) (ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int n, - DDXPointPtr points, int *widths, - int fSorted, XAACacheInfoPtr pCache, - int xorg, int yorg); - void (*FillCacheBltSpans) (ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int n, - DDXPointPtr points, int *widths, int fSorted, - XAACacheInfoPtr pCache, int xorg, int yorg); - void (*FillColorExpandSpans) (ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int n, - DDXPointPtr points, int *widths, int fSorted, - int xorg, int yorg, PixmapPtr pPix); - void (*FillCacheExpandSpans) (ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int n, - DDXPointPtr ppt, int *pwidth, int fSorted, - int xorg, int yorg, PixmapPtr pPix); - void (*TEGlyphRenderer) (ScrnInfoPtr pScrn, int x, int y, int w, int h, - int skipleft, int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask); - void (*NonTEGlyphRenderer) (ScrnInfoPtr pScrn, int x, int y, int n, - NonTEGlyphPtr glyphs, BoxPtr pbox, int fg, - int rop, unsigned int planemask); - void (*WritePixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int rop, - unsigned int planemask, int transparency_color, - int bpp, int depth); - void (*ReadPixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *dst, int dstwidth, int bpp, int depth); - RegionPtr (*CopyArea) (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, - GC * pGC, int srcx, int srcy, int width, int height, - int dstx, int dsty); - RegionPtr (*CopyPlane) (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, - int srcx, int srcy, int width, int height, int dstx, - int dsty, unsigned long bitPlane); - void (*PushPixelsSolid) (GCPtr pGC, PixmapPtr pBitMap, - DrawablePtr pDrawable, int dx, int dy, int xOrg, - int yOrg); - void (*PolyFillRectSolid) (DrawablePtr pDraw, GCPtr pGC, int nrectFill, - xRectangle *prectInit); - void (*PolyFillRectStippled) (DrawablePtr pDraw, GCPtr pGC, int nrectFill, - xRectangle *prectInit); - void (*PolyFillRectOpaqueStippled) (DrawablePtr pDraw, GCPtr pGC, - int nrectFill, xRectangle *prectInit); - void (*PolyFillRectTiled) (DrawablePtr pDraw, GCPtr pGC, int nrectFill, - xRectangle *prectInit); - void (*FillSpansSolid) (DrawablePtr pDraw, GCPtr pGC, int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted); - void (*FillSpansStippled) (DrawablePtr pDraw, GCPtr pGC, int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted); - void (*FillSpansOpaqueStippled) (DrawablePtr pDraw, GCPtr pGC, int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted); - void (*FillSpansTiled) (DrawablePtr pDraw, GCPtr pGC, int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted); - int (*PolyText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, - char *chars); - int (*PolyText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, - unsigned short *chars); - void (*ImageText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, - char *chars); - void (*ImageText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, unsigned short *chars); - void (*ImageGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit, - int yInit, unsigned int nglyph, CharInfoPtr * ppci, - pointer pglyphBase); - void (*PolyGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit, - int yInit, unsigned int nglyph, CharInfoPtr * ppci, - pointer pglyphBase); - int (*PolyText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, char *chars); - int (*PolyText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, unsigned short *chars); - void (*ImageText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, char *chars); - void (*ImageText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, unsigned short *chars); - void (*ImageGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit, - int yInit, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); - void (*PolyGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit, - int yInit, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); - void (*PolyRectangleThinSolid) (DrawablePtr pDrawable, GCPtr pGC, - int nRectsInit, xRectangle *pRectsInit); - void (*PolylinesWideSolid) (DrawablePtr pDrawable, GCPtr pGC, int mode, - int npt, DDXPointPtr pPts); - void (*PolylinesThinSolid) (DrawablePtr pDrawable, GCPtr pGC, int mode, - int npt, DDXPointPtr pPts); - void (*PolySegmentThinSolid) (DrawablePtr pDrawable, GCPtr pGC, int nseg, - xSegment * pSeg); - void (*PolylinesThinDashed) (DrawablePtr pDrawable, GCPtr pGC, int mode, - int npt, DDXPointPtr pPts); - void (*PolySegmentThinDashed) (DrawablePtr pDrawable, GCPtr pGC, int nseg, - xSegment * pSeg); - void (*FillPolygonSolid) (DrawablePtr pDrawable, GCPtr pGC, int shape, - int mode, int count, DDXPointPtr ptsIn); - void (*FillPolygonStippled) (DrawablePtr pDrawable, GCPtr pGC, int shape, - int mode, int count, DDXPointPtr ptsIn); - void (*FillPolygonOpaqueStippled) (DrawablePtr pDrawable, GCPtr pGC, - int shape, int mode, int count, - DDXPointPtr ptsIn); - void (*FillPolygonTiled) (DrawablePtr pDrawable, GCPtr pGC, int shape, - int mode, int count, DDXPointPtr ptsIn); - void (*PolyFillArcSolid) (DrawablePtr pDraw, GCPtr pGC, int narcs, - xArc * parcs); - void (*PutImage) (DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y, - int w, int h, int leftPad, int format, char *pImage); - ValidateGCProcPtr ValidateFillSpans; - ValidateGCProcPtr ValidateSetSpans; - ValidateGCProcPtr ValidatePutImage; - ValidateGCProcPtr ValidateCopyArea; - ValidateGCProcPtr ValidateCopyPlane; - ValidateGCProcPtr ValidatePolyPoint; - ValidateGCProcPtr ValidatePolylines; - ValidateGCProcPtr ValidatePolySegment; - ValidateGCProcPtr ValidatePolyRectangle; - ValidateGCProcPtr ValidatePolyArc; - ValidateGCProcPtr ValidateFillPolygon; - ValidateGCProcPtr ValidatePolyFillRect; - ValidateGCProcPtr ValidatePolyFillArc; - ValidateGCProcPtr ValidatePolyText8; - ValidateGCProcPtr ValidatePolyText16; - ValidateGCProcPtr ValidateImageText8; - ValidateGCProcPtr ValidateImageText16; - ValidateGCProcPtr ValidatePolyGlyphBlt; - ValidateGCProcPtr ValidateImageGlyphBlt; - ValidateGCProcPtr ValidatePushPixels; - void (*ComputeDash) (GCPtr pGC); - void (*InitPixmapCache) (ScreenPtr pScreen, RegionPtr areas, pointer data); - void (*ClosePixmapCache) (ScreenPtr pScreen); - int (*StippledFillChooser) (GCPtr pGC); - int (*OpaqueStippledFillChooser) (GCPtr pGC); - int (*TiledFillChooser) (GCPtr pGC); - XAACacheInfoPtr(*CacheTile) (ScrnInfoPtr Scrn, PixmapPtr pPix); - XAACacheInfoPtr(*CacheStipple) (ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, - int bg); - XAACacheInfoPtr(*CacheMonoStipple) (ScrnInfoPtr Scrn, PixmapPtr pPix); - XAACacheInfoPtr(*CacheMono8x8Pattern) (ScrnInfoPtr Scrn, int pat0, - int pat1); - XAACacheInfoPtr(*CacheColor8x8Pattern) (ScrnInfoPtr Scrn, PixmapPtr pPix, - int fg, int bg); - void (*WriteBitmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int fg, - int bg); - void (*WritePixmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int bpp, - int depth); - void (*WriteMono8x8PatternToCache) (ScrnInfoPtr pScrn, - XAACacheInfoPtr pCache); - void (*WriteColor8x8PatternToCache) (ScrnInfoPtr pScrn, PixmapPtr pPix, - XAACacheInfoPtr pCache); - GetImageProcPtr GetImage; - GetSpansProcPtr GetSpans; - CopyWindowProcPtr CopyWindow; - Bool (*SetupForCPUToScreenAlphaTexture2) (ScrnInfoPtr pScrn, int op, - CARD16 red, CARD16 green, - CARD16 blue, CARD16 alpha, - CARD32 maskFormat, - CARD32 dstFormat, CARD8 *alphaPtr, - int alphaPitch, int width, - int height, int flags); - Bool (*SetupForCPUToScreenTexture2) (ScrnInfoPtr pScrn, int op, - CARD32 srcFormat, CARD32 dstFormat, - CARD8 *texPtr, int texPitch, int width, - int height, int flags); -} XAAStateWrapRec, *XAAStateWrapPtr; - -static DevPrivateKeyRec XAAStateKeyRec; - -#define XAAStateKey (&XAAStateKeyRec) - -/* Wrap functions start here */ -#define GET_STATEPRIV_GC(pGC) XAAStateWrapPtr pStatePriv =\ -(XAAStateWrapPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAStateKey) - -#define GET_STATEPRIV_SCREEN(pScreen) XAAStateWrapPtr pStatePriv =\ -(XAAStateWrapPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAStateKey) - -#define GET_STATEPRIV_PSCRN(pScrn) XAAStateWrapPtr pStatePriv =\ -(XAAStateWrapPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAStateKey) - -#define STATE_CHECK_SP(pStatePriv) {\ - ScrnInfoPtr pScrn = pStatePriv->pScrn;\ - int i = 0;\ - int need_change = 0;\ - while(i < pScrn->numEntities) {\ - if(xf86IsEntityShared(pScrn->entityList[i]) &&\ - xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\ - need_change = 1;\ - xf86SetLastScrnFlag(pScrn->entityList[i],\ - pScrn->scrnIndex);\ - }\ - i++;\ - }\ - if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\ -} - -#define STATE_CHECK_PSCRN(pScrn) {\ - int i = 0;\ - int need_change = 0;\ - while(i < pScrn->numEntities) {\ - if(xf86IsEntityShared(pScrn->entityList[i]) &&\ - xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\ - need_change = 1;\ - xf86SetLastScrnFlag(pScrn->entityList[i],\ - pScrn->scrnIndex);\ - }\ - i++;\ - }\ - if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\ -} - -static void -XAAStateWrapSync(ScrnInfoPtr pScrn) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->Sync) (pScrn); -} - -static void -XAAStateWrapSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, unsigned int planemask, - int trans_color) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetupForScreenToScreenCopy) (pScrn, xdir, ydir, rop, - planemask, trans_color); -} - -static void -XAAStateWrapSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetupForSolidFill) (pScrn, color, rop, planemask); -} - -static void -XAAStateWrapSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetupForSolidLine) (pScrn, color, rop, planemask); -} - -static void -XAAStateWrapSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int length, - unsigned char *pattern) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetupForDashedLine) (pScrn, fg, bg, rop, planemask, length, - pattern); -} - -static void -XAAStateWrapSetClippingRectangle(ScrnInfoPtr pScrn, int left, int top, - int right, int bottom) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetClippingRectangle) (pScrn, left, top, right, bottom); -} - -static void -XAAStateWrapDisableClipping(ScrnInfoPtr pScrn) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->DisableClipping) (pScrn); -} - -static void -XAAStateWrapSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, - int fg, int bg, int rop, - unsigned int planemask) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetupForMono8x8PatternFill) (pScrn, patx, paty, fg, bg, rop, - planemask); -} - -static void -XAAStateWrapSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, - int rop, unsigned int planemask, - int transparency_color) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetupForColor8x8PatternFill) (pScrn, patx, paty, rop, - planemask, transparency_color); -} - -static void -XAAStateWrapSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, - int bg, int rop, - unsigned int planemask) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop, - planemask); -} - -static void -XAAStateWrapSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, - rop, planemask); -} - -static void -XAAStateWrapSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetupForScreenToScreenColorExpandFill) (pScrn, fg, bg, rop, - planemask); -} - -static void -XAAStateWrapSetupForImageWrite(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int transparency_color, - int bpp, int depth) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetupForImageWrite) (pScrn, rop, planemask, - transparency_color, bpp, depth); -} - -static void -XAAStateWrapSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, - int transparency_color, - int bpp, int depth) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetupForScanlineImageWrite) (pScrn, rop, planemask, - transparency_color, bpp, depth); -} - -static void -XAAStateWrapSetupForImageRead(ScrnInfoPtr pScrn, int bpp, int depth) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->SetupForImageRead) (pScrn, bpp, depth); -} - -static void -XAAStateWrapScreenToScreenBitBlt(ScrnInfoPtr pScrn, int nbox, - DDXPointPtr pptSrc, BoxPtr pbox, int xdir, - int ydir, int alu, unsigned int planmask) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->ScreenToScreenBitBlt) (pScrn, nbox, - pptSrc, pbox, xdir, - ydir, alu, planmask); -} - -static void -XAAStateWrapWriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int skipleft, - int fg, int bg, int rop, unsigned int planemask) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->WriteBitmap) (pScrn, x, y, w, h, - src, srcwidth, skipleft, - fg, bg, rop, planemask); -} - -static void -XAAStateWrapFillSolidRects(ScrnInfoPtr pScrn, int fg, int rop, - unsigned int planemask, int nBox, BoxPtr pBox) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillSolidRects) (pScrn, fg, rop, planemask, nBox, pBox); -} - -static void -XAAStateWrapFillMono8x8PatternRects(ScrnInfoPtr pScrn, int fg, int bg, - int rop, unsigned int planemask, int nBox, - BoxPtr pBox, int pat0, int pat1, - int xorg, int yorg) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillMono8x8PatternRects) (pScrn, fg, bg, - rop, planemask, nBox, - pBox, pat0, pat1, xorg, yorg); -} - -static void -XAAStateWrapFillColor8x8PatternRects(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int nBox, - BoxPtr pBox, int xorg, int yorg, - XAACacheInfoPtr pCache) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillColor8x8PatternRects) (pScrn, rop, - planemask, nBox, - pBox, xorg, yorg, pCache); -} - -static void -XAAStateWrapFillCacheBltRects(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int nBox, BoxPtr pBox, - int xorg, int yorg, XAACacheInfoPtr pCache) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillCacheBltRects) (pScrn, rop, - planemask, nBox, pBox, - xorg, yorg, pCache); -} - -static void -XAAStateWrapFillColorExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int nBox, - BoxPtr pBox, int xorg, int yorg, - PixmapPtr pPix) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillColorExpandRects) (pScrn, fg, bg, rop, - planemask, nBox, - pBox, xorg, yorg, pPix); -} - -static void -XAAStateWrapFillCacheExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int nBox, - BoxPtr pBox, int xorg, int yorg, - PixmapPtr pPix) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillCacheExpandRects) (pScrn, fg, bg, rop, - planemask, nBox, - pBox, xorg, yorg, pPix); -} - -static void -XAAStateWrapFillImageWriteRects(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int nBox, BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillImageWriteRects) (pScrn, rop, - planemask, nBox, pBox, - xorg, yorg, pPix); -} - -static void -XAAStateWrapFillSolidSpans(ScrnInfoPtr pScrn, int fg, int rop, - unsigned int planemask, int n, DDXPointPtr points, - int *widths, int fSorted) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillSolidSpans) (pScrn, fg, rop, - planemask, n, points, widths, fSorted); -} - -static void -XAAStateWrapFillMono8x8PatternSpans(ScrnInfoPtr pScrn, int fg, int bg, - int rop, unsigned int planemask, int n, - DDXPointPtr points, int *widths, - int fSorted, int pat0, int pat1, - int xorg, int yorg) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillMono8x8PatternSpans) (pScrn, fg, bg, - rop, planemask, n, - points, widths, - fSorted, pat0, pat1, xorg, yorg); -} - -static void -XAAStateWrapFillColor8x8PatternSpans(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int n, - DDXPointPtr points, int *widths, - int fSorted, XAACacheInfoPtr pCache, - int xorg, int yorg) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillColor8x8PatternSpans) (pScrn, rop, - planemask, n, - points, widths, - fSorted, pCache, xorg, yorg); -} - -static void -XAAStateWrapFillCacheBltSpans(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int n, - DDXPointPtr points, int *widths, - int fSorted, XAACacheInfoPtr pCache, - int xorg, int yorg) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillCacheBltSpans) (pScrn, rop, - planemask, n, - points, widths, - fSorted, pCache, xorg, yorg); -} - -static void -XAAStateWrapFillColorExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int n, - DDXPointPtr points, int *widths, int fSorted, - int xorg, int yorg, PixmapPtr pPix) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillColorExpandSpans) (pScrn, fg, bg, rop, - planemask, n, - points, widths, fSorted, - xorg, yorg, pPix); -} - -static void -XAAStateWrapFillCacheExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask, int n, - DDXPointPtr ppt, int *pwidth, int fSorted, - int xorg, int yorg, PixmapPtr pPix) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->FillCacheExpandSpans) (pScrn, fg, bg, rop, - planemask, n, - ppt, pwidth, fSorted, - xorg, yorg, pPix); -} - -static void -XAAStateWrapTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int w, int h, - int skipleft, int startline, - unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->TEGlyphRenderer) (pScrn, x, y, w, h, - skipleft, startline, - glyphs, glyphWidth, fg, bg, rop, planemask); -} - -static void -XAAStateWrapNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n, - NonTEGlyphPtr glyphs, BoxPtr pbox, - int fg, int rop, unsigned int planemask) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->NonTEGlyphRenderer) (pScrn, x, y, n, - glyphs, pbox, fg, rop, planemask); -} - -static void -XAAStateWrapWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int rop, - unsigned int planemask, int transparency_color, - int bpp, int depth) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->WritePixmap) (pScrn, x, y, w, h, - src, srcwidth, rop, - planemask, transparency_color, bpp, depth); -} - -static void -XAAStateWrapReadPixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *dst, int dstwidth, int bpp, int depth) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->ReadPixmap) (pScrn, x, y, w, h, dst, dstwidth, bpp, depth); -} - -static RegionPtr -XAAStateWrapCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, - GC * pGC, int srcx, int srcy, int width, int height, - int dstx, int dsty) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - return (*pStatePriv->CopyArea) (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty); -} - -static RegionPtr -XAAStateWrapCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, - int srcx, int srcy, int width, int height, - int dstx, int dsty, unsigned long bitPlane) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - return (*pStatePriv->CopyPlane) (pSrc, pDst, pGC, - srcx, srcy, width, height, - dstx, dsty, bitPlane); -} - -static void -XAAStateWrapPushPixelsSolid(GCPtr pGC, PixmapPtr pBitMap, - DrawablePtr pDrawable, int dx, int dy, int xOrg, - int yOrg) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PushPixelsSolid) (pGC, pBitMap, - pDrawable, dx, dy, xOrg, yOrg); -} - -static void -XAAStateWrapPolyFillRectSolid(DrawablePtr pDraw, GCPtr pGC, int nrectFill, - xRectangle *prectInit) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolyFillRectSolid) (pDraw, pGC, nrectFill, prectInit); -} - -static void -XAAStateWrapPolyFillRectStippled(DrawablePtr pDraw, GCPtr pGC, int nrectFill, - xRectangle *prectInit) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolyFillRectStippled) (pDraw, pGC, nrectFill, prectInit); -} - -static void -XAAStateWrapPolyFillRectOpaqueStippled(DrawablePtr pDraw, GCPtr pGC, - int nrectFill, xRectangle *prectInit) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolyFillRectOpaqueStippled) (pDraw, pGC, - nrectFill, prectInit); -} - -static void -XAAStateWrapPolyFillRectTiled(DrawablePtr pDraw, GCPtr pGC, int nrectFill, - xRectangle *prectInit) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolyFillRectTiled) (pDraw, pGC, nrectFill, prectInit); -} - -static void -XAAStateWrapFillSpansSolid(DrawablePtr pDraw, GCPtr pGC, int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->FillSpansSolid) (pDraw, pGC, nInit, ppt, pwidth, fSorted); -} - -static void -XAAStateWrapFillSpansStippled(DrawablePtr pDraw, GCPtr pGC, int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->FillSpansStippled) (pDraw, pGC, nInit, ppt, pwidth, fSorted); -} - -static void -XAAStateWrapFillSpansOpaqueStippled(DrawablePtr pDraw, GCPtr pGC, int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->FillSpansOpaqueStippled) (pDraw, pGC, nInit, - ppt, pwidth, fSorted); -} - -static void -XAAStateWrapFillSpansTiled(DrawablePtr pDraw, GCPtr pGC, int nInit, - DDXPointPtr ppt, int *pwidth, int fSorted) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->FillSpansTiled) (pDraw, pGC, nInit, ppt, pwidth, fSorted); -} - -static int -XAAStateWrapPolyText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, - char *chars) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - return (*pStatePriv->PolyText8TE) (pDraw, pGC, x, y, count, chars); -} - -static int -XAAStateWrapPolyText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, - unsigned short *chars) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - return (*pStatePriv->PolyText16TE) (pDraw, pGC, x, y, count, chars); -} - -static void -XAAStateWrapImageText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, char *chars) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ImageText8TE) (pDraw, pGC, x, y, count, chars); -} - -static void -XAAStateWrapImageText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, unsigned short *chars) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ImageText16TE) (pDraw, pGC, x, y, count, chars); -} - -static void -XAAStateWrapImageGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit, - int yInit, unsigned int nglyph, CharInfoPtr * ppci, - pointer pglyphBase) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ImageGlyphBltTE) (pDrawable, pGC, xInit, - yInit, nglyph, ppci, pglyphBase); -} - -static void -XAAStateWrapPolyGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit, - int yInit, unsigned int nglyph, CharInfoPtr * ppci, - pointer pglyphBase) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolyGlyphBltTE) (pDrawable, pGC, xInit, - yInit, nglyph, ppci, pglyphBase); -} - -static int -XAAStateWrapPolyText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, char *chars) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - return (*pStatePriv->PolyText8NonTE) (pDraw, pGC, x, y, count, chars); -} - -static int -XAAStateWrapPolyText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, unsigned short *chars) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - return (*pStatePriv->PolyText16NonTE) (pDraw, pGC, x, y, count, chars); -} - -static void -XAAStateWrapImageText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, char *chars) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ImageText8NonTE) (pDraw, pGC, x, y, count, chars); -} - -static void -XAAStateWrapImageText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, unsigned short *chars) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ImageText16NonTE) (pDraw, pGC, x, y, count, chars); -} - -static void -XAAStateWrapImageGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit, - int yInit, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ImageGlyphBltNonTE) (pDrawable, pGC, xInit, - yInit, nglyph, ppci, pglyphBase); -} - -static void -XAAStateWrapPolyGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit, - int yInit, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolyGlyphBltNonTE) (pDrawable, pGC, xInit, - yInit, nglyph, ppci, pglyphBase); -} - -static void -XAAStateWrapPolyRectangleThinSolid(DrawablePtr pDrawable, GCPtr pGC, - int nRectsInit, xRectangle *pRectsInit) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolyRectangleThinSolid) (pDrawable, pGC, - nRectsInit, pRectsInit); -} - -static void -XAAStateWrapPolylinesWideSolid(DrawablePtr pDrawable, GCPtr pGC, int mode, - int npt, DDXPointPtr pPts) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolylinesWideSolid) (pDrawable, pGC, mode, npt, pPts); -} - -static void -XAAStateWrapPolylinesThinSolid(DrawablePtr pDrawable, GCPtr pGC, int mode, - int npt, DDXPointPtr pPts) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolylinesThinSolid) (pDrawable, pGC, mode, npt, pPts); -} - -static void -XAAStateWrapPolySegmentThinSolid(DrawablePtr pDrawable, GCPtr pGC, int nseg, - xSegment * pSeg) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolySegmentThinSolid) (pDrawable, pGC, nseg, pSeg); -} - -static void -XAAStateWrapPolylinesThinDashed(DrawablePtr pDrawable, GCPtr pGC, int mode, - int npt, DDXPointPtr pPts) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolylinesThinDashed) (pDrawable, pGC, mode, npt, pPts); -} - -static void -XAAStateWrapPolySegmentThinDashed(DrawablePtr pDrawable, GCPtr pGC, int nseg, - xSegment * pSeg) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolySegmentThinDashed) (pDrawable, pGC, nseg, pSeg); -} - -static void -XAAStateWrapFillPolygonSolid(DrawablePtr pDrawable, GCPtr pGC, int shape, - int mode, int count, DDXPointPtr ptsIn) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->FillPolygonSolid) (pDrawable, pGC, shape, mode, count, ptsIn); -} - -static void -XAAStateWrapFillPolygonStippled(DrawablePtr pDrawable, GCPtr pGC, int shape, - int mode, int count, DDXPointPtr ptsIn) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->FillPolygonStippled) (pDrawable, pGC, shape, - mode, count, ptsIn); -} - -static void -XAAStateWrapFillPolygonOpaqueStippled(DrawablePtr pDrawable, GCPtr pGC, - int shape, int mode, int count, - DDXPointPtr ptsIn) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->FillPolygonOpaqueStippled) (pDrawable, pGC, - shape, mode, count, ptsIn); -} - -static void -XAAStateWrapFillPolygonTiled(DrawablePtr pDrawable, GCPtr pGC, int shape, - int mode, int count, DDXPointPtr ptsIn) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->FillPolygonTiled) (pDrawable, pGC, shape, mode, count, ptsIn); -} - -static void -XAAStateWrapPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, - xArc * parcs) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PolyFillArcSolid) (pDraw, pGC, narcs, parcs); -} - -static void -XAAStateWrapPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y, - int w, int h, int leftPad, int format, char *pImage) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->PutImage) (pDraw, pGC, depth, x, y, - w, h, leftPad, format, pImage); -} - -static void -XAAStateWrapValidateFillSpans(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidateFillSpans) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidateSetSpans(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidateSetSpans) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidatePutImage(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidatePutImage) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidateCopyArea(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidateCopyArea) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidateCopyPlane(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidateCopyPlane) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidatePolyPoint(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidatePolyPoint) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidatePolylines(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidatePolylines) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidatePolySegment(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidatePolySegment) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidatePolyRectangle(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidatePolyRectangle) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidatePolyArc(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidatePolyArc) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidateFillPolygon(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidateFillPolygon) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidatePolyFillRect(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidatePolyFillRect) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidatePolyFillArc(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidatePolyFillArc) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidatePolyText8(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidatePolyText8) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidatePolyText16(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidatePolyText16) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidateImageText8(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidateImageText8) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidateImageText16(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidateImageText16) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidatePolyGlyphBlt) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidateImageGlyphBlt(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - (*pStatePriv->ValidateImageGlyphBlt) (pGC, changes, pDraw); -} - -static void -XAAStateWrapValidatePushPixels(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ValidatePushPixels) (pGC, changes, pDraw); -} - -static void -XAAStateWrapComputeDash(GCPtr pGC) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ComputeDash) (pGC); -} - -static void -XAAStateWrapInitPixmapCache(ScreenPtr pScreen, RegionPtr areas, pointer data) -{ - GET_STATEPRIV_SCREEN(pScreen); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->InitPixmapCache) (pScreen, areas, data); -} - -static void -XAAStateWrapClosePixmapCache(ScreenPtr pScreen) -{ - GET_STATEPRIV_SCREEN(pScreen); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->ClosePixmapCache) (pScreen); -} - -static int -XAAStateWrapStippledFillChooser(GCPtr pGC) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - return (*pStatePriv->StippledFillChooser) (pGC); -} - -static int -XAAStateWrapOpaqueStippledFillChooser(GCPtr pGC) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - return (*pStatePriv->OpaqueStippledFillChooser) (pGC); -} - -static int -XAAStateWrapTiledFillChooser(GCPtr pGC) -{ - GET_STATEPRIV_GC(pGC); - STATE_CHECK_SP(pStatePriv); - - return (*pStatePriv->TiledFillChooser) (pGC); -} - -static XAACacheInfoPtr -XAAStateWrapCacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - return (*pStatePriv->CacheTile) (pScrn, pPix); -} - -static XAACacheInfoPtr -XAAStateWrapCacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - return (*pStatePriv->CacheStipple) (pScrn, pPix, fg, bg); -} - -static XAACacheInfoPtr -XAAStateWrapCacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - return (*pStatePriv->CacheMonoStipple) (pScrn, pPix); -} - -static XAACacheInfoPtr -XAAStateWrapCacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0, int pat1) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - return (*pStatePriv->CacheMono8x8Pattern) (pScrn, pat0, pat1); -} - -static XAACacheInfoPtr -XAAStateWrapCacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix, - int fg, int bg) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - return (*pStatePriv->CacheColor8x8Pattern) (pScrn, pPix, fg, bg); -} - -static void -XAAStateWrapWriteBitmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int fg, int bg) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->WriteBitmapToCache) (pScrn, x, y, w, h, - src, srcwidth, fg, bg); -} - -static void -XAAStateWrapWritePixmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int bpp, - int depth) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->WritePixmapToCache) (pScrn, x, y, w, h, - src, srcwidth, bpp, depth); -} - -static void -XAAStateWrapWriteMono8x8PatternToCache(ScrnInfoPtr pScrn, - XAACacheInfoPtr pCache) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->WriteMono8x8PatternToCache) (pScrn, pCache); -} - -static void -XAAStateWrapWriteColor8x8PatternToCache(ScrnInfoPtr pScrn, PixmapPtr pPix, - XAACacheInfoPtr pCache) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - (*pStatePriv->WriteColor8x8PatternToCache) (pScrn, pPix, pCache); -} - -static void -XAAStateWrapGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, - unsigned int format, unsigned long planeMask, - char *pdstLine) -{ - GET_STATEPRIV_SCREEN(pDrawable->pScreen); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->GetImage) (pDrawable, sx, sy, w, h, - format, planeMask, pdstLine); -} - -static void -XAAStateWrapGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, - int *pwidth, int nspans, char *pdstStart) -{ - GET_STATEPRIV_SCREEN(pDrawable->pScreen); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); -} - -static void -XAAStateWrapCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, - RegionPtr prgnSrc) -{ - GET_STATEPRIV_SCREEN(pWindow->drawable.pScreen); - STATE_CHECK_SP(pStatePriv); - - (*pStatePriv->CopyWindow) (pWindow, ptOldOrg, prgnSrc); -} - -static Bool -XAAStateWrapSetupForCPUToScreenAlphaTexture2(ScrnInfoPtr pScrn, - int op, CARD16 red, - CARD16 green, - CARD16 blue, - CARD16 alpha, - CARD32 srcFormat, - CARD32 dstFormat, - CARD8 *alphaPtr, - int alphaPitch, - int width, int height, int flags) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - return (*pStatePriv->SetupForCPUToScreenAlphaTexture2) (pScrn, op, red, - green, blue, alpha, - srcFormat, - dstFormat, alphaPtr, - alphaPitch, width, - height, flags); -} - -static Bool -XAAStateWrapSetupForCPUToScreenTexture2(ScrnInfoPtr pScrn, int op, - CARD32 srcFormat, - CARD32 dstFormat, - CARD8 *texPtr, int texPitch, - int width, int height, int flags) -{ - GET_STATEPRIV_PSCRN(pScrn); - STATE_CHECK_PSCRN(pScrn); - - return (*pStatePriv->SetupForCPUToScreenTexture2) (pScrn, op, srcFormat, - dstFormat, texPtr, - texPitch, width, height, - flags); -} - -/* Setup Function */ -Bool -XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - XAAStateWrapPtr pStatePriv; - int i = 0; - - if (!dixRegisterPrivateKey(&XAAStateKeyRec, PRIVATE_SCREEN, 0)) - return FALSE; - if (!(pStatePriv = malloc(sizeof(XAAStateWrapRec)))) - return FALSE; - dixSetPrivate(&pScreen->devPrivates, XAAStateKey, pStatePriv); - pStatePriv->RestoreAccelState = infoRec->RestoreAccelState; - pStatePriv->pScrn = pScrn; - - /* Initialize the last screen to -1 so whenever an accel function - * is called the proper state is setup - */ - while (i < pScrn->numEntities) { - xf86SetLastScrnFlag(pScrn->entityList[i], -1); - i++; - } -/* Do the wrapping */ - XAA_STATE_WRAP(Sync); - XAA_STATE_WRAP(SetupForScreenToScreenCopy); - XAA_STATE_WRAP(SetupForSolidFill); - XAA_STATE_WRAP(SetupForSolidLine); - XAA_STATE_WRAP(SetupForDashedLine); - XAA_STATE_WRAP(SetClippingRectangle); - XAA_STATE_WRAP(DisableClipping); - XAA_STATE_WRAP(SetupForMono8x8PatternFill); - XAA_STATE_WRAP(SetupForColor8x8PatternFill); - XAA_STATE_WRAP(SetupForCPUToScreenColorExpandFill); - XAA_STATE_WRAP(SetupForScanlineCPUToScreenColorExpandFill); - XAA_STATE_WRAP(SetupForScreenToScreenColorExpandFill); - XAA_STATE_WRAP(SetupForImageWrite); - XAA_STATE_WRAP(SetupForScanlineImageWrite); - XAA_STATE_WRAP(SetupForImageRead); - XAA_STATE_WRAP(ScreenToScreenBitBlt); - XAA_STATE_WRAP(WriteBitmap); - XAA_STATE_WRAP(FillSolidRects); - XAA_STATE_WRAP(FillMono8x8PatternRects); - XAA_STATE_WRAP(FillColor8x8PatternRects); - XAA_STATE_WRAP(FillCacheBltRects); - XAA_STATE_WRAP(FillColorExpandRects); - XAA_STATE_WRAP(FillCacheExpandRects); - XAA_STATE_WRAP(FillImageWriteRects); - XAA_STATE_WRAP(FillSolidSpans); - XAA_STATE_WRAP(FillMono8x8PatternSpans); - XAA_STATE_WRAP(FillColor8x8PatternSpans); - XAA_STATE_WRAP(FillCacheBltSpans); - XAA_STATE_WRAP(FillColorExpandSpans); - XAA_STATE_WRAP(FillCacheExpandSpans); - XAA_STATE_WRAP(TEGlyphRenderer); - XAA_STATE_WRAP(NonTEGlyphRenderer); - XAA_STATE_WRAP(WritePixmap); - XAA_STATE_WRAP(ReadPixmap); - XAA_STATE_WRAP(CopyArea); - XAA_STATE_WRAP(CopyPlane); - XAA_STATE_WRAP(PushPixelsSolid); - XAA_STATE_WRAP(PolyFillRectSolid); - XAA_STATE_WRAP(PolyFillRectStippled); - XAA_STATE_WRAP(PolyFillRectOpaqueStippled); - XAA_STATE_WRAP(PolyFillRectTiled); - XAA_STATE_WRAP(FillSpansSolid); - XAA_STATE_WRAP(FillSpansStippled); - XAA_STATE_WRAP(FillSpansOpaqueStippled); - XAA_STATE_WRAP(FillSpansTiled); - XAA_STATE_WRAP(PolyText8TE); - XAA_STATE_WRAP(PolyText16TE); - XAA_STATE_WRAP(ImageText8TE); - XAA_STATE_WRAP(ImageText16TE); - XAA_STATE_WRAP(ImageGlyphBltTE); - XAA_STATE_WRAP(PolyGlyphBltTE); - XAA_STATE_WRAP(PolyText8NonTE); - XAA_STATE_WRAP(PolyText16NonTE); - XAA_STATE_WRAP(ImageText8NonTE); - XAA_STATE_WRAP(ImageText16NonTE); - XAA_STATE_WRAP(ImageGlyphBltNonTE); - XAA_STATE_WRAP(PolyGlyphBltNonTE); - XAA_STATE_WRAP(PolyRectangleThinSolid); - XAA_STATE_WRAP(PolylinesWideSolid); - XAA_STATE_WRAP(PolylinesThinSolid); - XAA_STATE_WRAP(PolySegmentThinSolid); - XAA_STATE_WRAP(PolylinesThinDashed); - XAA_STATE_WRAP(PolySegmentThinDashed); - XAA_STATE_WRAP(FillPolygonSolid); - XAA_STATE_WRAP(FillPolygonStippled); - XAA_STATE_WRAP(FillPolygonOpaqueStippled); - XAA_STATE_WRAP(FillPolygonTiled); - XAA_STATE_WRAP(PolyFillArcSolid); - XAA_STATE_WRAP(PutImage); - XAA_STATE_WRAP(ValidateFillSpans); - XAA_STATE_WRAP(ValidateSetSpans); - XAA_STATE_WRAP(ValidatePutImage); - XAA_STATE_WRAP(ValidateCopyArea); - XAA_STATE_WRAP(ValidateCopyPlane); - XAA_STATE_WRAP(ValidatePolyPoint); - XAA_STATE_WRAP(ValidatePolylines); - XAA_STATE_WRAP(ValidatePolySegment); - XAA_STATE_WRAP(ValidatePolyRectangle); - XAA_STATE_WRAP(ValidatePolyArc); - XAA_STATE_WRAP(ValidateFillPolygon); - XAA_STATE_WRAP(ValidatePolyFillRect); - XAA_STATE_WRAP(ValidatePolyFillArc); - XAA_STATE_WRAP(ValidatePolyText8); - XAA_STATE_WRAP(ValidatePolyText16); - XAA_STATE_WRAP(ValidateImageText8); - XAA_STATE_WRAP(ValidateImageText16); - XAA_STATE_WRAP(ValidatePolyGlyphBlt); - XAA_STATE_WRAP(ValidateImageGlyphBlt); - XAA_STATE_WRAP(ValidatePushPixels); - XAA_STATE_WRAP(ComputeDash); - XAA_STATE_WRAP(InitPixmapCache); - XAA_STATE_WRAP(ClosePixmapCache); - XAA_STATE_WRAP(StippledFillChooser); - XAA_STATE_WRAP(OpaqueStippledFillChooser); - XAA_STATE_WRAP(TiledFillChooser); - XAA_STATE_WRAP(CacheTile); - XAA_STATE_WRAP(CacheStipple); - XAA_STATE_WRAP(CacheMonoStipple); - XAA_STATE_WRAP(CacheMono8x8Pattern); - XAA_STATE_WRAP(CacheColor8x8Pattern); - XAA_STATE_WRAP(WriteBitmapToCache); - XAA_STATE_WRAP(WritePixmapToCache); - XAA_STATE_WRAP(WriteMono8x8PatternToCache); - XAA_STATE_WRAP(WriteColor8x8PatternToCache); - XAA_STATE_WRAP(GetImage); - XAA_STATE_WRAP(GetSpans); - XAA_STATE_WRAP(CopyWindow); - XAA_STATE_WRAP(SetupForCPUToScreenAlphaTexture2); - XAA_STATE_WRAP(SetupForCPUToScreenTexture2); - return TRUE; -} diff --git a/xserver/hw/xfree86/xaa/xaaStipple.c b/xserver/hw/xfree86/xaa/xaaStipple.c deleted file mode 100644 index fc74e3988..000000000 --- a/xserver/hw/xfree86/xaa/xaaStipple.c +++ /dev/null @@ -1,915 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xaa.h" -#include "xaalocal.h" -#include "xaacexp.h" -#include "xf86.h" - -static CARD32 *StipplePowerOfTwo(CARD32 *, CARD32 *, int, int, int); -static CARD32 *StipplePowerOfTwo_Inverted(CARD32 *, CARD32 *, int, int, int); -static CARD32 *StippleUpTo32(CARD32 *, CARD32 *, int, int, int); -static CARD32 *StippleUpTo32_Inverted(CARD32 *, CARD32 *, int, int, int); -static CARD32 *StippleOver32(CARD32 *, CARD32 *, int, int, int); -static CARD32 *StippleOver32_Inverted(CARD32 *, CARD32 *, int, int, int); - -#ifdef TRIPLE_BITS -#define stipple_scanline_func EXPNAME(XAAStippleScanlineFunc3) -#define stipple_get_scanline_func EXPNAME(XAAGetStippleScanlineFunc3) -#else -#define stipple_scanline_func EXPNAME(XAAStippleScanlineFunc) -#define stipple_get_scanline_func EXPNAME(XAAGetStippleScanlineFunc) -#endif - -StippleScanlineProcPtr stipple_scanline_func[6] = { - StipplePowerOfTwo, - StippleUpTo32, - StippleOver32, - StipplePowerOfTwo_Inverted, - StippleUpTo32_Inverted, - StippleOver32_Inverted -}; - -StippleScanlineProcPtr * -stipple_get_scanline_func(void) -{ - return stipple_scanline_func; -} - -#ifdef FIXEDBASE -#define DEST(i) *dest -#define RETURN(i) return(dest) -#else -#define DEST(i) dest[i] -#define RETURN(i) return(dest + i) -#endif - -/* TRIPLE_BITS pattern expansion */ -#ifdef TRIPLE_BITS -#define EXPAND_PAT \ - CARD32 pat1 = byte_expand3[pat & 0xFF], \ - pat2 = byte_expand3[(pat & 0xFF00) >> 8], \ - pat3 = byte_expand3[(pat & 0xFF0000) >> 16], \ - pat4 = byte_expand3[(pat & 0xFF000000) >> 24], \ - patA = pat1 | (pat2 << 24), \ - patB = (pat2 >> 8) | (pat3 << 16), \ - patC = (pat3 >> 16) | (pat4 << 8) -#ifdef FIXED_BASE -#define WRITE_PAT1 { \ - *dest = patA; } -#define WRITE_PAT2 { \ - *dest = patA; \ - *dest = patB; } -#define WRITE_PAT3 { \ - *dest = patA; \ - *dest = patB; \ - *dest = patC; } -#else -#define WRITE_PAT1 { \ - *(dest++) = patA; } -#define WRITE_PAT2 { \ - *(dest) = patA; \ - *(dest + 1) = patB; \ - dest += 2; } -#define WRITE_PAT3 { \ - *(dest) = patA; \ - *(dest + 1) = patB; \ - *(dest + 2) = patC; \ - dest += 3; } -#endif -#endif - -#if !defined(FIXEDBASE) && !defined(MSBFIRST) && !defined(TRIPLE_BITS) - -unsigned int XAAShiftMasks[32] = { - /* gcc is rather pedantic about SHIFT_R(0xFFFFFFFF,32) */ - 0x00000000, SHIFT_R(0xFFFFFFFF, 31), - SHIFT_R(0xFFFFFFFF, 30), SHIFT_R(0xFFFFFFFF, 29), - SHIFT_R(0xFFFFFFFF, 28), SHIFT_R(0xFFFFFFFF, 27), - SHIFT_R(0xFFFFFFFF, 26), SHIFT_R(0xFFFFFFFF, 25), - SHIFT_R(0xFFFFFFFF, 24), SHIFT_R(0xFFFFFFFF, 23), - SHIFT_R(0xFFFFFFFF, 22), SHIFT_R(0xFFFFFFFF, 21), - SHIFT_R(0xFFFFFFFF, 20), SHIFT_R(0xFFFFFFFF, 19), - SHIFT_R(0xFFFFFFFF, 18), SHIFT_R(0xFFFFFFFF, 17), - SHIFT_R(0xFFFFFFFF, 16), SHIFT_R(0xFFFFFFFF, 15), - SHIFT_R(0xFFFFFFFF, 14), SHIFT_R(0xFFFFFFFF, 13), - SHIFT_R(0xFFFFFFFF, 12), SHIFT_R(0xFFFFFFFF, 11), - SHIFT_R(0xFFFFFFFF, 10), SHIFT_R(0xFFFFFFFF, 9), - SHIFT_R(0xFFFFFFFF, 8), SHIFT_R(0xFFFFFFFF, 7), - SHIFT_R(0xFFFFFFFF, 6), SHIFT_R(0xFFFFFFFF, 5), - SHIFT_R(0xFFFFFFFF, 4), SHIFT_R(0xFFFFFFFF, 3), - SHIFT_R(0xFFFFFFFF, 2), SHIFT_R(0xFFFFFFFF, 1) -}; - -#endif - -void -#ifdef TRIPLE_BITS - EXPNAME(XAAFillColorExpandRects3) ( -#else - EXPNAME(XAAFillColorExpandRects) ( -#endif - ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - CARD32 *base; - Bool TwoPass = FALSE, FirstPass = TRUE; - StippleScanlineProcPtr StippleFunc, FirstFunc, SecondFunc; - int stipplewidth = pPix->drawable.width; - int stippleheight = pPix->drawable.height; - int srcwidth = pPix->devKind; - int dwords, srcy, srcx, funcNo = 2, h; - unsigned char *src = (unsigned char *) pPix->devPrivate.ptr; - unsigned char *srcp; - int flag; - - if (stipplewidth <= 32) { - if (stipplewidth & (stipplewidth - 1)) - funcNo = 1; - else - funcNo = 0; - } - StippleFunc = stipple_scanline_func[funcNo]; - SecondFunc = stipple_scanline_func[funcNo]; - FirstFunc = stipple_scanline_func[funcNo + 3]; - -#ifdef TRIPLE_BITS - if ((bg == -1) || - (!(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) && - (!(infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) || - (CHECK_RGB_EQUAL(bg))))) { -#else - if ((bg == -1) || - !(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) { -#endif - /* one pass */ - } - else if ((rop == GXcopy) && infoRec->FillSolidRects) { - /* one pass but we fill background rects first */ - (*infoRec->FillSolidRects) (pScrn, bg, rop, planemask, nBox, pBox); - bg = -1; - } - else { - /* gotta do two passes */ - TwoPass = TRUE; - } - - if (!TwoPass) - (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop, - planemask); - - while (nBox--) { -#ifdef TRIPLE_BITS - dwords = (3 * (pBox->x2 - pBox->x1) + 31) >> 5; -#else - dwords = (pBox->x2 - pBox->x1 + 31) >> 5; -#endif - - SECOND_PASS: - if (TwoPass) { - (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, - (FirstPass) ? bg : - fg, -1, rop, - planemask); - StippleFunc = (FirstPass) ? FirstFunc : SecondFunc; - } - - h = pBox->y2 - pBox->y1; - flag = (infoRec->CPUToScreenColorExpandFillFlags - & CPU_TRANSFER_PAD_QWORD) && ((dwords * h) & 0x01); - - (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, pBox->x1, - pBox->y1, - pBox->x2 - pBox->x1, - h, 0); - - base = (CARD32 *) infoRec->ColorExpandBase; - - srcy = (pBox->y1 - yorg) % stippleheight; - if (srcy < 0) - srcy += stippleheight; - srcx = (pBox->x1 - xorg) % stipplewidth; - if (srcx < 0) - srcx += stipplewidth; - - srcp = (srcwidth * srcy) + src; - -#ifndef FIXEDBASE - if ((dwords * h) <= infoRec->ColorExpandRange) { - while (h--) { - base = - (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth, - dwords); - srcy++; - srcp += srcwidth; - if (srcy >= stippleheight) { - srcy = 0; - srcp = src; - } - } - } - else -#endif - while (h--) { - (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth, - dwords); - srcy++; - srcp += srcwidth; - if (srcy >= stippleheight) { - srcy = 0; - srcp = src; - } - } - - if (flag) { - base = (CARD32 *) infoRec->ColorExpandBase; - base[0] = 0x00000000; - } - - if (TwoPass) { - if (FirstPass) { - FirstPass = FALSE; - goto SECOND_PASS; - } - else - FirstPass = TRUE; - } - - pBox++; - } - - if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND) - (*infoRec->Sync) (pScrn); - else - SET_SYNC_FLAG(infoRec); -} - -void -#ifdef TRIPLE_BITS - EXPNAME(XAAFillColorExpandSpans3) ( -#else - EXPNAME(XAAFillColorExpandSpans) ( -#endif - ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - CARD32 *base; - Bool TwoPass = FALSE, FirstPass = TRUE; - StippleScanlineProcPtr StippleFunc, FirstFunc, SecondFunc; - int stipplewidth = pPix->drawable.width; - int stippleheight = pPix->drawable.height; - int dwords, srcy, srcx, funcNo = 2; - unsigned char *srcp; - - if (stipplewidth <= 32) { - if (stipplewidth & (stipplewidth - 1)) - funcNo = 1; - else - funcNo = 0; - } - StippleFunc = stipple_scanline_func[funcNo]; - SecondFunc = stipple_scanline_func[funcNo]; - FirstFunc = stipple_scanline_func[funcNo + 3]; - -#ifdef TRIPLE_BITS - if ((bg == -1) || - (!(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) && - (!(infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) || - (CHECK_RGB_EQUAL(bg))))) { -#else - if ((bg == -1) || - !(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) { -#endif - /* one pass */ - } - else if ((rop == GXcopy) && infoRec->FillSolidSpans) { - /* one pass but we fill background rects first */ - (*infoRec->FillSolidSpans) (pScrn, bg, rop, planemask, n, ppt, pwidth, - fSorted); - bg = -1; - } - else { - /* gotta do two passes */ - TwoPass = TRUE; - } - - if (!TwoPass) - (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop, - planemask); - - while (n--) { -#ifdef TRIPLE_BITS - dwords = (3 * *pwidth + 31) >> 5; -#else - dwords = (*pwidth + 31) >> 5; -#endif - - srcy = (ppt->y - yorg) % stippleheight; - if (srcy < 0) - srcy += stippleheight; - srcx = (ppt->x - xorg) % stipplewidth; - if (srcx < 0) - srcx += stipplewidth; - - srcp = (pPix->devKind * srcy) + (unsigned char *) pPix->devPrivate.ptr; - - SECOND_PASS: - if (TwoPass) { - (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, - (FirstPass) ? bg : - fg, -1, rop, - planemask); - StippleFunc = (FirstPass) ? FirstFunc : SecondFunc; - } - - (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, ppt->x, ppt->y, - *pwidth, 1, 0); - - base = (CARD32 *) infoRec->ColorExpandBase; - - (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth, dwords); - - if ((infoRec->CPUToScreenColorExpandFillFlags & CPU_TRANSFER_PAD_QWORD) - && (dwords & 0x01)) { - base = (CARD32 *) infoRec->ColorExpandBase; - base[0] = 0x00000000; - } - - if (TwoPass) { - if (FirstPass) { - FirstPass = FALSE; - goto SECOND_PASS; - } - else - FirstPass = TRUE; - } - - ppt++; - pwidth++; - } - - if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND) - (*infoRec->Sync) (pScrn); - else - SET_SYNC_FLAG(infoRec); -} - -#ifndef FIXEDBASE - -void -#ifdef TRIPLE_BITS - EXPNAME(XAAFillScanlineColorExpandRects3) ( -#else - EXPNAME(XAAFillScanlineColorExpandRects) ( -#endif - ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, - PixmapPtr pPix) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - CARD32 *base; - Bool TwoPass = FALSE, FirstPass = TRUE; - StippleScanlineProcPtr StippleFunc, FirstFunc, SecondFunc; - int stipplewidth = pPix->drawable.width; - int stippleheight = pPix->drawable.height; - int srcwidth = pPix->devKind; - int dwords, srcy, srcx, funcNo = 2, bufferNo, h; - unsigned char *src = pPix->devPrivate.ptr; - unsigned char *srcp; - - if (stipplewidth <= 32) { - if (stipplewidth & (stipplewidth - 1)) - funcNo = 1; - else - funcNo = 0; - } - StippleFunc = stipple_scanline_func[funcNo]; - SecondFunc = stipple_scanline_func[funcNo]; - FirstFunc = stipple_scanline_func[funcNo + 3]; - -#ifdef TRIPLE_BITS - if ((bg == -1) || - (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) - && (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) || - (CHECK_RGB_EQUAL(bg))))) { -#else - if ((bg == -1) || - !(infoRec-> - ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) { -#endif - /* one pass */ - } - else if ((rop == GXcopy) && infoRec->FillSolidRects) { - /* one pass but we fill background rects first */ - (*infoRec->FillSolidRects) (pScrn, bg, rop, planemask, nBox, pBox); - bg = -1; - } - else { - /* gotta do two passes */ - TwoPass = TRUE; - } - - if (!TwoPass) - (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, - rop, planemask); - - while (nBox--) { -#ifdef TRIPLE_BITS - dwords = (3 * (pBox->x2 - pBox->x1) + 31) >> 5; -#else - dwords = (pBox->x2 - pBox->x1 + 31) >> 5; -#endif - - SECOND_PASS: - if (TwoPass) { - (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, - (FirstPass) - ? bg : fg, - -1, rop, - planemask); - StippleFunc = (FirstPass) ? FirstFunc : SecondFunc; - } - - h = pBox->y2 - pBox->y1; - - (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, - pBox->x1, - pBox->y1, - pBox->x2 - - pBox->x1, h, - 0); - - bufferNo = 0; - - srcy = (pBox->y1 - yorg) % stippleheight; - if (srcy < 0) - srcy += stippleheight; - srcx = (pBox->x1 - xorg) % stipplewidth; - if (srcx < 0) - srcx += stipplewidth; - - srcp = (srcwidth * srcy) + src; - - while (h--) { - base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo]; - (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth, dwords); - (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++); - if (bufferNo >= infoRec->NumScanlineColorExpandBuffers) - bufferNo = 0; - srcy++; - srcp += srcwidth; - if (srcy >= stippleheight) { - srcy = 0; - srcp = src; - } - } - - if (TwoPass) { - if (FirstPass) { - FirstPass = FALSE; - goto SECOND_PASS; - } - else - FirstPass = TRUE; - } - - pBox++; - } - - SET_SYNC_FLAG(infoRec); -} - -void -#ifdef TRIPLE_BITS - EXPNAME(XAAFillScanlineColorExpandSpans3) ( -#else - EXPNAME(XAAFillScanlineColorExpandSpans) ( -#endif - ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, - PixmapPtr pPix) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - CARD32 *base; - Bool TwoPass = FALSE, FirstPass = TRUE; - StippleScanlineProcPtr StippleFunc, FirstFunc, SecondFunc; - int stipplewidth = pPix->drawable.width; - int stippleheight = pPix->drawable.height; - int dwords, srcy, srcx, funcNo = 2; - unsigned char *srcp; - - if (stipplewidth <= 32) { - if (stipplewidth & (stipplewidth - 1)) - funcNo = 1; - else - funcNo = 0; - } - StippleFunc = stipple_scanline_func[funcNo]; - SecondFunc = stipple_scanline_func[funcNo]; - FirstFunc = stipple_scanline_func[funcNo + 3]; - -#ifdef TRIPLE_BITS - if ((bg == -1) || - (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) - && (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) || - (CHECK_RGB_EQUAL(bg))))) { -#else - if ((bg == -1) || - !(infoRec-> - ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) { -#endif - /* one pass */ - } - else if ((rop == GXcopy) && infoRec->FillSolidSpans) { - /* one pass but we fill background rects first */ - (*infoRec->FillSolidSpans) (pScrn, bg, rop, planemask, n, ppt, pwidth, - fSorted); - bg = -1; - } - else { - /* gotta do two passes */ - TwoPass = TRUE; - } - - if (!TwoPass) - (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, - rop, planemask); - - while (n--) { -#ifdef TRIPLE_BITS - dwords = (3 * *pwidth + 31) >> 5; -#else - dwords = (*pwidth + 31) >> 5; -#endif - - srcy = (ppt->y - yorg) % stippleheight; - if (srcy < 0) - srcy += stippleheight; - srcx = (ppt->x - xorg) % stipplewidth; - if (srcx < 0) - srcx += stipplewidth; - - srcp = (pPix->devKind * srcy) + (unsigned char *) pPix->devPrivate.ptr; - - SECOND_PASS: - if (TwoPass) { - (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, - (FirstPass) - ? bg : fg, - -1, rop, - planemask); - StippleFunc = (FirstPass) ? FirstFunc : SecondFunc; - } - - (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, ppt->x, - ppt->y, - *pwidth, 1, - 0); - - base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[0]; - - (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth, dwords); - (*infoRec->SubsequentColorExpandScanline) (pScrn, 0); - - if (TwoPass) { - if (FirstPass) { - FirstPass = FALSE; - goto SECOND_PASS; - } - else - FirstPass = TRUE; - } - - ppt++; - pwidth++; - } - - SET_SYNC_FLAG(infoRec); -} - -#endif - -static CARD32 * -StipplePowerOfTwo(CARD32 *dest, CARD32 *src, int shift, int width, int dwords) -{ - CARD32 pat = *src; - - if (width < 32) { - pat &= XAAShiftMasks[width]; - while (width < 32) { - pat |= SHIFT_L(pat, width); - width <<= 1; - } - } - - if (shift) - pat = SHIFT_R(pat, shift) | SHIFT_L(pat, 32 - shift); - -#ifdef MSBFIRST - pat = SWAP_BITS_IN_BYTES(pat); -#endif - -#ifdef TRIPLE_BITS - { - EXPAND_PAT; - - while (dwords >= 3) { - WRITE_PAT3; - dwords -= 3; - } - if (dwords == 2) { - WRITE_PAT2; - } - else if (dwords == 1) { - WRITE_PAT1; - } - - return dest; - } -#else /* TRIPLE_BITS */ - while (dwords >= 4) { - DEST(0) = pat; - DEST(1) = pat; - DEST(2) = pat; - DEST(3) = pat; - dwords -= 4; -#ifndef FIXEDBASE - dest += 4; -#endif - } - - if (!dwords) - return dest; - DEST(0) = pat; - if (dwords == 1) - RETURN(1); - DEST(1) = pat; - if (dwords == 2) - RETURN(2); - DEST(2) = pat; - RETURN(3); -#endif /* TRIPLE_BITS */ -} - -static CARD32 * -StipplePowerOfTwo_Inverted(CARD32 *dest, CARD32 *src, - int shift, int width, int dwords) -{ - CARD32 pat = *src; - - if (width < 32) { - pat &= XAAShiftMasks[width]; - while (width < 32) { - pat |= SHIFT_L(pat, width); - width <<= 1; - } - } - - if (shift) - pat = SHIFT_R(pat, shift) | SHIFT_L(pat, 32 - shift); - -#ifdef MSBFIRST - pat = SWAP_BITS_IN_BYTES(pat); -#endif - - pat = ~pat; - -#ifdef TRIPLE_BITS - { - EXPAND_PAT; - - while (dwords >= 3) { - WRITE_PAT3; - dwords -= 3; - } - if (dwords == 2) { - WRITE_PAT2; - } - else if (dwords == 1) { - WRITE_PAT1; - } - - return dest; - } -#else /* TRIPLE_BITS */ - while (dwords >= 4) { - DEST(0) = pat; - DEST(1) = pat; - DEST(2) = pat; - DEST(3) = pat; - dwords -= 4; -#ifndef FIXEDBASE - dest += 4; -#endif - } - - if (!dwords) - return dest; - DEST(0) = pat; - if (dwords == 1) - RETURN(1); - DEST(1) = pat; - if (dwords == 2) - RETURN(2); - DEST(2) = pat; - RETURN(3); -#endif /* TRIPLE_BITS */ -} - -static CARD32 * -StippleUpTo32(CARD32 *base, CARD32 *src, int shift, int width, int dwords) -{ - CARD32 pat = *src & XAAShiftMasks[width]; - - while (width <= 15) { - pat |= SHIFT_L(pat, width); - width <<= 1; - } - pat |= SHIFT_L(pat, width); - - while (dwords--) { - CARD32 bits = SHIFT_R(pat, shift) | SHIFT_L(pat, width - shift); - -#ifdef TRIPLE_BITS - if (dwords >= 2) { - WRITE_BITS3(bits); - dwords -= 2; - } - else if (dwords > 0) { - WRITE_BITS2(bits); - dwords--; - } - else { - WRITE_BITS1(bits); - } -#else - WRITE_BITS(bits); -#endif - - shift += 32; - shift %= width; - } - return base; -} - -static CARD32 * -StippleUpTo32_Inverted(CARD32 *base, CARD32 *src, - int shift, int width, int dwords) -{ - CARD32 pat = *src & XAAShiftMasks[width]; - - while (width <= 15) { - pat |= SHIFT_L(pat, width); - width <<= 1; - } - pat |= SHIFT_L(pat, width); - - while (dwords--) { - CARD32 bits = ~(SHIFT_R(pat, shift) | SHIFT_L(pat, width - shift)); - -#ifdef TRIPLE_BITS - if (dwords >= 2) { - WRITE_BITS3(bits); - dwords -= 2; - } - else if (dwords > 0) { - WRITE_BITS2(bits); - dwords--; - } - else { - WRITE_BITS1(bits); - } -#else - WRITE_BITS(bits); -#endif - - shift += 32; - shift %= width; - } - return base; -} - -static CARD32 * -StippleOver32(CARD32 *base, CARD32 *src, int offset, int width, int dwords) -{ - CARD32 *srcp; - CARD32 bits; - int bitsleft, shift, usable; - - while (dwords--) { - bitsleft = width - offset; - srcp = src + (offset >> 5); - shift = offset & 31; - usable = 32 - shift; - - if (bitsleft < 32) { - if (bitsleft <= usable) { - bits = SHIFT_L(*src, bitsleft) | - (SHIFT_R(*srcp, shift) & XAAShiftMasks[bitsleft]); - } - else { - bits = SHIFT_L(*src, bitsleft) | - (SHIFT_L(srcp[1], usable) & XAAShiftMasks[bitsleft]) | - (SHIFT_R(*srcp, shift) & XAAShiftMasks[usable]); - } - } - else if (shift) - bits = SHIFT_R(*srcp, shift) | SHIFT_L(srcp[1], usable); - else - bits = *srcp; - -#ifdef TRIPLE_BITS - if (dwords >= 2) { - WRITE_BITS3(bits); - dwords -= 2; - } - else if (dwords > 0) { - WRITE_BITS2(bits); - dwords--; - } - else { - WRITE_BITS1(bits); - } -#else - WRITE_BITS(bits); -#endif - - offset += 32; - offset %= width; - } - return base; -} - -static CARD32 * -StippleOver32_Inverted(CARD32 *base, CARD32 *src, - int offset, int width, int dwords) -{ - CARD32 *srcp; - CARD32 bits; - int bitsleft, shift, usable; - - while (dwords--) { - bitsleft = width - offset; - srcp = src + (offset >> 5); - shift = offset & 31; - usable = 32 - shift; - - if (bitsleft < 32) { - if (bitsleft <= usable) { - bits = SHIFT_L(*src, bitsleft) | - (SHIFT_R(*srcp, shift) & XAAShiftMasks[bitsleft]); - } - else { - bits = SHIFT_L(*src, bitsleft) | - (SHIFT_L(srcp[1], usable) & XAAShiftMasks[bitsleft]) | - (SHIFT_R(*srcp, shift) & XAAShiftMasks[usable]); - } - } - else if (shift) - bits = SHIFT_R(*srcp, shift) | SHIFT_L(srcp[1], usable); - else - bits = *srcp; - - bits = ~bits; - -#ifdef TRIPLE_BITS - if (dwords >= 2) { - WRITE_BITS3(bits); - dwords -= 2; - } - else if (dwords > 0) { - WRITE_BITS2(bits); - dwords--; - } - else { - WRITE_BITS1(bits); - } -#else - WRITE_BITS(bits); -#endif - - offset += 32; - offset %= width; - } - return base; -} diff --git a/xserver/hw/xfree86/xaa/xaaTEGlyph.c b/xserver/hw/xfree86/xaa/xaaTEGlyph.c deleted file mode 100644 index 2926c1df2..000000000 --- a/xserver/hw/xfree86/xaa/xaaTEGlyph.c +++ /dev/null @@ -1,1083 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xaa.h" -#include "xaalocal.h" -#include "xaacexp.h" -#include "xf86.h" - -/* scanline function for TRIPLE_BITS_24BPP */ -static CARD32 *DrawTextScanline3(CARD32 *base, CARD32 *mem, int width); - -/* Loop unrolled functions for common font widths */ -static CARD32 *DrawTETextScanlineGeneric(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -static CARD32 *DrawTETextScanlineWidth7(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -static CARD32 *DrawTETextScanlineWidth10(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -static CARD32 *DrawTETextScanlineWidth12(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -static CARD32 *DrawTETextScanlineWidth14(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -static CARD32 *DrawTETextScanlineWidth16(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -static CARD32 *DrawTETextScanlineWidth18(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -static CARD32 *DrawTETextScanlineWidth24(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); - -#ifdef USEASSEMBLER -#ifdef FIXEDBASE -#ifdef MSBFIRST -CARD32 *DrawTETextScanlineWidth6PMSBFirstFixedBase(CARD32 *base, - unsigned int **glyphp, - int line, int width, - int glyphwidth); -CARD32 *DrawTETextScanlineWidth8PMSBFirstFixedBase(CARD32 *base, - unsigned int **glyphp, - int line, int width, - int glyphwidth); -CARD32 *DrawTETextScanlineWidth9PMSBFirstFixedBase(CARD32 *base, - unsigned int **glyphp, - int line, int width, - int glyphwidth); -#else -CARD32 *DrawTETextScanlineWidth6PLSBFirstFixedBase(CARD32 *base, - unsigned int **glyphp, - int line, int width, - int glyphwidth); -CARD32 *DrawTETextScanlineWidth8PLSBFirstFixedBase(CARD32 *base, - unsigned int **glyphp, - int line, int width, - int glyphwidth); -CARD32 *DrawTETextScanlineWidth9PLSBFirstFixedBase(CARD32 *base, - unsigned int **glyphp, - int line, int width, - int glyphwidth); -#endif -#else -#ifdef MSBFIRST -CARD32 *DrawTETextScanlineWidth6PMSBFirst(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -CARD32 *DrawTETextScanlineWidth8PMSBFirst(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -CARD32 *DrawTETextScanlineWidth9PMSBFirst(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -#else -CARD32 *DrawTETextScanlineWidth6PLSBFirst(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -CARD32 *DrawTETextScanlineWidth8PLSBFirst(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -CARD32 *DrawTETextScanlineWidth9PLSBFirst(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -#endif -#endif -#else -static CARD32 *DrawTETextScanlineWidth6(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -static CARD32 *DrawTETextScanlineWidth8(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -static CARD32 *DrawTETextScanlineWidth9(CARD32 *base, unsigned int **glyphp, - int line, int width, int glyphwidth); -#endif - -#define glyph_scanline_func EXPNAME(XAAGlyphScanlineFunc) -#define glyph_get_scanline_func EXPNAME(XAAGetGlyphScanlineFunc) - -GlyphScanlineFuncPtr glyph_scanline_func[32] = { - DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, - DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, - DrawTETextScanlineGeneric, -#ifdef USEASSEMBLER -#ifdef FIXEDBASE -#ifdef MSBFIRST - DrawTETextScanlineWidth6PMSBFirstFixedBase, - DrawTETextScanlineWidth7, - DrawTETextScanlineWidth8PMSBFirstFixedBase, - DrawTETextScanlineWidth9PMSBFirstFixedBase, -#else - DrawTETextScanlineWidth6PLSBFirstFixedBase, - DrawTETextScanlineWidth7, - DrawTETextScanlineWidth8PLSBFirstFixedBase, - DrawTETextScanlineWidth9PLSBFirstFixedBase, -#endif -#else -#ifdef MSBFIRST - DrawTETextScanlineWidth6PMSBFirst, - DrawTETextScanlineWidth7, - DrawTETextScanlineWidth8PMSBFirst, - DrawTETextScanlineWidth9PMSBFirst, -#else - DrawTETextScanlineWidth6PLSBFirst, - DrawTETextScanlineWidth7, - DrawTETextScanlineWidth8PLSBFirst, - DrawTETextScanlineWidth9PLSBFirst, -#endif -#endif -#else - DrawTETextScanlineWidth6, DrawTETextScanlineWidth7, - DrawTETextScanlineWidth8, DrawTETextScanlineWidth9, -#endif - DrawTETextScanlineWidth10, - DrawTETextScanlineGeneric, DrawTETextScanlineWidth12, - DrawTETextScanlineGeneric, DrawTETextScanlineWidth14, - DrawTETextScanlineGeneric, DrawTETextScanlineWidth16, - DrawTETextScanlineGeneric, DrawTETextScanlineWidth18, - DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, - DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, - DrawTETextScanlineGeneric, DrawTETextScanlineWidth24, - DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, - DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, - DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, - DrawTETextScanlineGeneric, DrawTETextScanlineGeneric -}; - -GlyphScanlineFuncPtr * -glyph_get_scanline_func(void) -{ - return glyph_scanline_func; -} - -/******************************************************************** - - Here we have TEGlyphRenders for a bunch of different color - expansion types. The driver may provide its own renderer, but - this is the default one which renders using lower-level primitives - exported by the chipset driver. - -********************************************************************/ - -/* This gets built for MSBFIRST or LSBFIRST with FIXEDBASE or not. - A total of 4 versions */ - -void - -EXPNAME(XAATEGlyphRenderer) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - CARD32 *base; - GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1]; - int dwords = 0; - - if ((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) { - (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask); - (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h); - bg = -1; - } - - (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop, - planemask); - - if (skipleft && - (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) || - (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) && - (skipleft > x)))) { - /* draw the first character only */ - - int count = h, line = startline; - int width = glyphWidth - skipleft; - - if (width > w) - width = w; - - (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, width, h, - 0); - - base = (CARD32 *) infoRec->ColorExpandBase; - - while (count--) { - register CARD32 tmp = SHIFT_R(glyphs[0][line++], skipleft); - - WRITE_BITS(tmp); - } - - w -= width; - if ((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) && - ((((width + 31) >> 5) * h) & 1)) { - base = (CARD32 *) infoRec->ColorExpandBase; - base[0] = 0x00000000; - } - if (!w) - goto THE_END; - glyphs++; - x += width; - skipleft = 0; /* nicely aligned again */ - } - - w += skipleft; - x -= skipleft; - dwords = ((w + 31) >> 5) * h; - - (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, w, h, - skipleft); - - base = (CARD32 *) infoRec->ColorExpandBase; - -#ifndef FIXEDBASE - if ((((w + 31) >> 5) * h) <= infoRec->ColorExpandRange) - while (h--) { - base = (*GlyphFunc) (base, glyphs, startline++, w, glyphWidth); - } - else -#endif - while (h--) { - (*GlyphFunc) (base, glyphs, startline++, w, glyphWidth); - } - - if ((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) && - (dwords & 1)) { - base = (CARD32 *) infoRec->ColorExpandBase; - base[0] = 0x00000000; - } - - THE_END: - - if (infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND) - (*infoRec->Sync) (pScrn); - else - SET_SYNC_FLAG(infoRec); -} - -/******************************************************************** - - This is the GlyphRenderer for TRIPLE_BITS_24BPP. It renders to a buffer - with the non FIXEDBASE LSB_FIRST code before tripling, and possibly - reversing the bits and sending them to the screen - -********************************************************************/ - -void - -EXPNAME(XAATEGlyphRenderer3) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - CARD32 *base, *mem; - GlyphScanlineFuncPtr GlyphFunc = - XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1]; - int dwords = 0; - - if ((bg != -1) && - ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) || - ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) && - (!CHECK_RGB_EQUAL(bg))))) { - (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask); - (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h); - bg = -1; - } - - (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop, - planemask); - - if (skipleft) { - /* draw the first character only */ - - int count = h, line = startline; - int width = glyphWidth - skipleft; - CARD32 bits; - - if (width > w) - width = w; - (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, width, h, - 0); - - base = (CARD32 *) infoRec->ColorExpandBase; - - while (count--) { - bits = SHIFT_R(glyphs[0][line++], skipleft); - if (width >= 22) { - WRITE_BITS3(bits); - } - else if (width >= 11) { - WRITE_BITS2(bits); - } - else { - WRITE_BITS1(bits); - } - } - - w -= width; - if ((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) && - ((((3 * width + 31) >> 5) * h) & 1)) { - base = (CARD32 *) infoRec->ColorExpandBase; - base[0] = 0x00000000; - } - if (!w) - goto THE_END; - glyphs++; - x += width; - skipleft = 0; /* nicely aligned again */ - } - - dwords = ((3 * w + 31) >> 5) * h; - mem = (CARD32 *) malloc(((w + 31) >> 3) * sizeof(char)); - if (!mem) - return; - - (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, w, h, 0); - - base = (CARD32 *) infoRec->ColorExpandBase; - -#ifndef FIXEDBASE - if ((((3 * w + 31) >> 5) * h) <= infoRec->ColorExpandRange) - while (h--) { - (*GlyphFunc) (mem, glyphs, startline++, w, glyphWidth); - base = DrawTextScanline3(base, mem, w); - } - else -#endif - while (h--) { - (*GlyphFunc) (mem, glyphs, startline++, w, glyphWidth); - DrawTextScanline3(base, mem, w); - } - - free(mem); - - if ((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) && - (dwords & 1)) { - base = (CARD32 *) infoRec->ColorExpandBase; - base[0] = 0x00000000; - } - - THE_END: - - if (infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND) - (*infoRec->Sync) (pScrn); - else - SET_SYNC_FLAG(infoRec); -} - -#ifndef FIXEDBASE -/* Scanline version of above gets built for LSBFIRST and MSBFIRST */ - -void - -EXPNAME(XAATEGlyphRendererScanline) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int bufferNo; - CARD32 *base; - GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1]; - - if ((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) { - (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask); - (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h); - bg = -1; - } - - (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, rop, - planemask); - - if (skipleft && - (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) || - (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) && - (skipleft > x)))) { - /* draw the first character only */ - - int count = h, line = startline; - int width = glyphWidth - skipleft; - - if (width > w) - width = w; - - (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y, - width, h, 0); - - bufferNo = 0; - - while (count--) { - register CARD32 tmp = SHIFT_R(glyphs[0][line++], skipleft); - - base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo]; - WRITE_BITS(tmp); - (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++); - if (bufferNo >= infoRec->NumScanlineColorExpandBuffers) - bufferNo = 0; - } - - w -= width; - if (!w) - goto THE_END; - glyphs++; - x += width; - skipleft = 0; /* nicely aligned again */ - } - - w += skipleft; - x -= skipleft; - - (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y, w, h, - skipleft); - - bufferNo = 0; - - while (h--) { - base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo]; - (*GlyphFunc) (base, glyphs, startline++, w, glyphWidth); - (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++); - if (bufferNo >= infoRec->NumScanlineColorExpandBuffers) - bufferNo = 0; - } - - THE_END: - - SET_SYNC_FLAG(infoRec); -} - -void - -EXPNAME(XAATEGlyphRendererScanline3) (ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int bufferNo; - CARD32 *base, *mem; - GlyphScanlineFuncPtr GlyphFunc = - XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1]; - - if ((bg != -1) && - ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) || - ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) && - (!CHECK_RGB_EQUAL(bg))))) { - (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask); - (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h); - bg = -1; - } - - (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, rop, - planemask); - - if (skipleft) { - /* draw the first character only */ - - int count = h, line = startline; - int width = glyphWidth - skipleft; - CARD32 bits; - - if (width > w) - width = w; - - (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y, - width, h, 0); - - bufferNo = 0; - - while (count--) { - base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo]; - bits = SHIFT_R(glyphs[0][line++], skipleft); - if (width >= 22) { - WRITE_BITS3(bits); - } - else if (width >= 11) { - WRITE_BITS2(bits); - } - else { - WRITE_BITS1(bits); - } - (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++); - if (bufferNo >= infoRec->NumScanlineColorExpandBuffers) - bufferNo = 0; - } - - w -= width; - if (!w) - goto THE_END; - glyphs++; - x += width; - skipleft = 0; /* nicely aligned again */ - } - - w += skipleft; - x -= skipleft; - mem = (CARD32 *) malloc(((w + 31) >> 3) * sizeof(char)); - if (!mem) - return; - - (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y, w, h, - skipleft); - - bufferNo = 0; - - while (h--) { - base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo]; - (*GlyphFunc) (mem, glyphs, startline++, w, glyphWidth); - DrawTextScanline3(base, mem, w); - (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++); - if (bufferNo >= infoRec->NumScanlineColorExpandBuffers) - bufferNo = 0; - } - - free(mem); - - THE_END: - - SET_SYNC_FLAG(infoRec); -} - -#endif - -/******************************************************************** - - TRIPLE_BITS_24BPP scanline rendering code. - -********************************************************************/ - -static CARD32 * -DrawTextScanline3(CARD32 *base, CARD32 *mem, int width) -{ - - while (width > 32) { - WRITE_BITS3(*mem); - mem++; - width -= 32; - } - if (width) { - if (width >= 22) { - WRITE_BITS3(*mem); - } - else if (width >= 11) { - WRITE_BITS2(*mem); - } - else { - WRITE_BITS1(*mem); - } - } - - return base; -} - -/******************************************************************** - - Generic TE scanline rendering code. - -********************************************************************/ - -static CARD32 * -DrawTETextScanlineGeneric(CARD32 *base, - unsigned int **glyphp, - int line, int width, int glyphwidth) -{ - CARD32 bits = (*glyphp)[line]; - int shift = glyphwidth; - - while (width > 32) { - while (shift < 32) { - glyphp++; - bits |= SHIFT_L((*glyphp)[line], shift); - shift += glyphwidth; - } - WRITE_BITS(bits); - shift &= 31; - if (shift) - bits = SHIFT_R((*glyphp)[line], (glyphwidth - shift)); - else - bits = 0; - width -= 32; - } - - if (width) { - width -= shift; - while (width > 0) { - glyphp++; - bits |= SHIFT_L((*glyphp)[line], shift); - shift += glyphwidth; - width -= glyphwidth; - } - WRITE_BITS(bits); - } - - return base; -} - -/******************************************************************** - - Loop unrolled TE font scanline rendering code - -********************************************************************/ - -#ifndef USEASSEMBLER -static CARD32 * -DrawTETextScanlineWidth6(CARD32 *base, - unsigned int **glyphp, - int line, int width, int glyphwidth) -{ - while (1) { - unsigned int bits; - - bits = glyphp[0][line]; - bits |= SHIFT_L(glyphp[1][line], 6); - bits |= SHIFT_L(glyphp[2][line], 12); - bits |= SHIFT_L(glyphp[3][line], 18); - bits |= SHIFT_L(glyphp[4][line], 24); - bits |= SHIFT_L(glyphp[5][line], 30); - WRITE_IN_BITORDER(base, 0, bits); - CHECKRETURN(1); - bits = SHIFT_R(glyphp[5][line], 2); - bits |= SHIFT_L(glyphp[6][line], 4); - bits |= SHIFT_L(glyphp[7][line], 10); - bits |= SHIFT_L(glyphp[8][line], 16); - bits |= SHIFT_L(glyphp[9][line], 22); - bits |= SHIFT_L(glyphp[10][line], 28); - WRITE_IN_BITORDER(base, 1, bits); - CHECKRETURN(2); - bits = SHIFT_R(glyphp[10][line], 4); - bits |= SHIFT_L(glyphp[11][line], 2); - bits |= SHIFT_L(glyphp[12][line], 8); - bits |= SHIFT_L(glyphp[13][line], 14); - bits |= SHIFT_L(glyphp[14][line], 20); - bits |= SHIFT_L(glyphp[15][line], 26); - WRITE_IN_BITORDER(base, 2, bits); - CHECKRETURN(3); -#ifndef FIXEDBASE - base += 3; -#endif - width -= 96; - glyphp += 16; - } - return base; -} -#endif - -static CARD32 * -DrawTETextScanlineWidth7(CARD32 *base, - unsigned int **glyphp, - int line, int width, int glyphwidth) -{ - while (1) { - unsigned int bits; - - bits = glyphp[0][line]; - bits |= SHIFT_L(glyphp[1][line], 7); - bits |= SHIFT_L(glyphp[2][line], 14); - bits |= SHIFT_L(glyphp[3][line], 21); - bits |= SHIFT_L(glyphp[4][line], 28); - WRITE_IN_BITORDER(base, 0, bits); - CHECKRETURN(1); - bits = SHIFT_R(glyphp[4][line], 4); - bits |= SHIFT_L(glyphp[5][line], 3); - bits |= SHIFT_L(glyphp[6][line], 10); - bits |= SHIFT_L(glyphp[7][line], 17); - bits |= SHIFT_L(glyphp[8][line], 24); - bits |= SHIFT_L(glyphp[9][line], 31); - WRITE_IN_BITORDER(base, 1, bits); - CHECKRETURN(2); - bits = SHIFT_R(glyphp[9][line], 1); - bits |= SHIFT_L(glyphp[10][line], 6); - bits |= SHIFT_L(glyphp[11][line], 13); - bits |= SHIFT_L(glyphp[12][line], 20); - bits |= SHIFT_L(glyphp[13][line], 27); - WRITE_IN_BITORDER(base, 2, bits); - CHECKRETURN(3); - bits = SHIFT_R(glyphp[13][line], 5); - bits |= SHIFT_L(glyphp[14][line], 2); - bits |= SHIFT_L(glyphp[15][line], 9); - bits |= SHIFT_L(glyphp[16][line], 16); - bits |= SHIFT_L(glyphp[17][line], 23); - bits |= SHIFT_L(glyphp[18][line], 30); - WRITE_IN_BITORDER(base, 3, bits); - CHECKRETURN(4); - bits = SHIFT_R(glyphp[18][line], 2); - bits |= SHIFT_L(glyphp[19][line], 5); - bits |= SHIFT_L(glyphp[20][line], 12); - bits |= SHIFT_L(glyphp[21][line], 19); - bits |= SHIFT_L(glyphp[22][line], 26); - WRITE_IN_BITORDER(base, 4, bits); - CHECKRETURN(5); - bits = SHIFT_R(glyphp[22][line], 6); - bits |= SHIFT_L(glyphp[23][line], 1); - bits |= SHIFT_L(glyphp[24][line], 8); - bits |= SHIFT_L(glyphp[25][line], 15); - bits |= SHIFT_L(glyphp[26][line], 22); - bits |= SHIFT_L(glyphp[27][line], 29); - WRITE_IN_BITORDER(base, 5, bits); - CHECKRETURN(6); - bits = SHIFT_R(glyphp[27][line], 3); - bits |= SHIFT_L(glyphp[28][line], 4); - bits |= SHIFT_L(glyphp[29][line], 11); - bits |= SHIFT_L(glyphp[30][line], 18); - bits |= SHIFT_L(glyphp[31][line], 25); - WRITE_IN_BITORDER(base, 6, bits); - CHECKRETURN(7); -#ifndef FIXEDBASE - base += 7; -#endif - width -= 224; - glyphp += 32; - } - return base; -} - -#ifndef USEASSEMBLER -static CARD32 * -DrawTETextScanlineWidth8(CARD32 *base, - unsigned int **glyphp, - int line, int width, int glyphwidth) -{ - while (1) { - unsigned int bits; - - bits = glyphp[0][line]; - bits |= SHIFT_L(glyphp[1][line], 8); - bits |= SHIFT_L(glyphp[2][line], 16); - bits |= SHIFT_L(glyphp[3][line], 24); - WRITE_IN_BITORDER(base, 0, bits); - CHECKRETURN(1); - bits = glyphp[4][line]; - bits |= SHIFT_L(glyphp[5][line], 8); - bits |= SHIFT_L(glyphp[6][line], 16); - bits |= SHIFT_L(glyphp[7][line], 24); - WRITE_IN_BITORDER(base, 1, bits); - CHECKRETURN(2); -#ifndef FIXEDBASE - base += 2; -#endif - width -= 64; - glyphp += 8; - } - return base; -} -#endif - -#ifndef USEASSEMBLER -static CARD32 * -DrawTETextScanlineWidth9(CARD32 *base, - unsigned int **glyphp, - int line, int width, int glyphwidth) -{ - while (1) { - unsigned int bits; - - bits = glyphp[0][line]; - bits |= SHIFT_L(glyphp[1][line], 9); - bits |= SHIFT_L(glyphp[2][line], 18); - bits |= SHIFT_L(glyphp[3][line], 27); - WRITE_IN_BITORDER(base, 0, bits); - CHECKRETURN(1); - bits = SHIFT_R(glyphp[3][line], 5); - bits |= SHIFT_L(glyphp[4][line], 4); - bits |= SHIFT_L(glyphp[5][line], 13); - bits |= SHIFT_L(glyphp[6][line], 22); - bits |= SHIFT_L(glyphp[7][line], 31); - WRITE_IN_BITORDER(base, 1, bits); - CHECKRETURN(2); - bits = SHIFT_R(glyphp[7][line], 1); - bits |= SHIFT_L(glyphp[8][line], 8); - bits |= SHIFT_L(glyphp[9][line], 17); - bits |= SHIFT_L(glyphp[10][line], 26); - WRITE_IN_BITORDER(base, 2, bits); - CHECKRETURN(3); - bits = SHIFT_R(glyphp[10][line], 6); - bits |= SHIFT_L(glyphp[11][line], 3); - bits |= SHIFT_L(glyphp[12][line], 12); - bits |= SHIFT_L(glyphp[13][line], 21); - bits |= SHIFT_L(glyphp[14][line], 30); - WRITE_IN_BITORDER(base, 3, bits); - CHECKRETURN(4); - bits = SHIFT_R(glyphp[14][line], 2); - bits |= SHIFT_L(glyphp[15][line], 7); - bits |= SHIFT_L(glyphp[16][line], 16); - bits |= SHIFT_L(glyphp[17][line], 25); - WRITE_IN_BITORDER(base, 4, bits); - CHECKRETURN(5); - bits = SHIFT_R(glyphp[17][line], 7); - bits |= SHIFT_L(glyphp[18][line], 2); - bits |= SHIFT_L(glyphp[19][line], 11); - bits |= SHIFT_L(glyphp[20][line], 20); - bits |= SHIFT_L(glyphp[21][line], 29); - WRITE_IN_BITORDER(base, 5, bits); - CHECKRETURN(6); - bits = SHIFT_R(glyphp[21][line], 3); - bits |= SHIFT_L(glyphp[22][line], 6); - bits |= SHIFT_L(glyphp[23][line], 15); - bits |= SHIFT_L(glyphp[24][line], 24); - WRITE_IN_BITORDER(base, 6, bits); - CHECKRETURN(7); - bits = SHIFT_R(glyphp[24][line], 8); - bits |= SHIFT_L(glyphp[25][line], 1); - bits |= SHIFT_L(glyphp[26][line], 10); - bits |= SHIFT_L(glyphp[27][line], 19); - bits |= SHIFT_L(glyphp[28][line], 28); - WRITE_IN_BITORDER(base, 7, bits); - CHECKRETURN(8); - bits = SHIFT_R(glyphp[28][line], 4); - bits |= SHIFT_L(glyphp[29][line], 5); - bits |= SHIFT_L(glyphp[30][line], 14); - bits |= SHIFT_L(glyphp[31][line], 23); - WRITE_IN_BITORDER(base, 8, bits); - CHECKRETURN(9); -#ifndef FIXEDBASE - base += 9; -#endif - width -= 288; - glyphp += 32; - } - return base; -} -#endif - -static CARD32 * -DrawTETextScanlineWidth10(CARD32 *base, - unsigned int **glyphp, - int line, int width, int glyphwidth) -{ - while (1) { - unsigned int bits; - - bits = glyphp[0][line]; - bits |= SHIFT_L(glyphp[1][line], 10); - bits |= SHIFT_L(glyphp[2][line], 20); - bits |= SHIFT_L(glyphp[3][line], 30); - WRITE_IN_BITORDER(base, 0, bits); - CHECKRETURN(1); - bits = SHIFT_R(glyphp[3][line], 2); - bits |= SHIFT_L(glyphp[4][line], 8); - bits |= SHIFT_L(glyphp[5][line], 18); - bits |= SHIFT_L(glyphp[6][line], 28); - WRITE_IN_BITORDER(base, 1, bits); - CHECKRETURN(2); - bits = SHIFT_R(glyphp[6][line], 4); - bits |= SHIFT_L(glyphp[7][line], 6); - bits |= SHIFT_L(glyphp[8][line], 16); - bits |= SHIFT_L(glyphp[9][line], 26); - WRITE_IN_BITORDER(base, 2, bits); - CHECKRETURN(3); - bits = SHIFT_R(glyphp[9][line], 6); - bits |= SHIFT_L(glyphp[10][line], 4); - bits |= SHIFT_L(glyphp[11][line], 14); - bits |= SHIFT_L(glyphp[12][line], 24); - WRITE_IN_BITORDER(base, 3, bits); - CHECKRETURN(4); - bits = SHIFT_R(glyphp[12][line], 8); - bits |= SHIFT_L(glyphp[13][line], 2); - bits |= SHIFT_L(glyphp[14][line], 12); - bits |= SHIFT_L(glyphp[15][line], 22); - WRITE_IN_BITORDER(base, 4, bits); - CHECKRETURN(5); -#ifndef FIXEDBASE - base += 5; -#endif - width -= 160; - glyphp += 16; - } - return base; -} - -static CARD32 * -DrawTETextScanlineWidth12(CARD32 *base, - unsigned int **glyphp, - int line, int width, int glyphwidth) -{ - while (1) { - unsigned int bits; - - bits = glyphp[0][line]; - bits |= SHIFT_L(glyphp[1][line], 12); - bits |= SHIFT_L(glyphp[2][line], 24); - WRITE_IN_BITORDER(base, 0, bits); - CHECKRETURN(1); - bits = SHIFT_R(glyphp[2][line], 8); - bits |= SHIFT_L(glyphp[3][line], 4); - bits |= SHIFT_L(glyphp[4][line], 16); - bits |= SHIFT_L(glyphp[5][line], 28); - WRITE_IN_BITORDER(base, 1, bits); - CHECKRETURN(2); - bits = SHIFT_R(glyphp[5][line], 4); - bits |= SHIFT_L(glyphp[6][line], 8); - bits |= SHIFT_L(glyphp[7][line], 20); - WRITE_IN_BITORDER(base, 2, bits); - CHECKRETURN(3); -#ifndef FIXEDBASE - base += 3; -#endif - width -= 96; - glyphp += 8; - } - return base; -} - -static CARD32 * -DrawTETextScanlineWidth14(CARD32 *base, - unsigned int **glyphp, - int line, int width, int glyphwidth) -{ - while (1) { - unsigned int bits; - - bits = glyphp[0][line]; - bits |= SHIFT_L(glyphp[1][line], 14); - bits |= SHIFT_L(glyphp[2][line], 28); - WRITE_IN_BITORDER(base, 0, bits); - CHECKRETURN(1); - bits = SHIFT_R(glyphp[2][line], 4); - bits |= SHIFT_L(glyphp[3][line], 10); - bits |= SHIFT_L(glyphp[4][line], 24); - WRITE_IN_BITORDER(base, 1, bits); - CHECKRETURN(2); - bits = SHIFT_R(glyphp[4][line], 8); - bits |= SHIFT_L(glyphp[5][line], 6); - bits |= SHIFT_L(glyphp[6][line], 20); - WRITE_IN_BITORDER(base, 2, bits); - CHECKRETURN(3); - bits = SHIFT_R(glyphp[6][line], 12); - bits |= SHIFT_L(glyphp[7][line], 2); - bits |= SHIFT_L(glyphp[8][line], 16); - bits |= SHIFT_L(glyphp[9][line], 30); - WRITE_IN_BITORDER(base, 3, bits); - CHECKRETURN(4); - bits = SHIFT_R(glyphp[9][line], 2); - bits |= SHIFT_L(glyphp[10][line], 12); - bits |= SHIFT_L(glyphp[11][line], 26); - WRITE_IN_BITORDER(base, 4, bits); - CHECKRETURN(5); - bits = SHIFT_R(glyphp[11][line], 6); - bits |= SHIFT_L(glyphp[12][line], 8); - bits |= SHIFT_L(glyphp[13][line], 22); - WRITE_IN_BITORDER(base, 5, bits); - CHECKRETURN(6); - bits = SHIFT_R(glyphp[13][line], 10); - bits |= SHIFT_L(glyphp[14][line], 4); - bits |= SHIFT_L(glyphp[15][line], 18); - WRITE_IN_BITORDER(base, 6, bits); - CHECKRETURN(7); -#ifndef FIXEDBASE - base += 7; -#endif - width -= 224; - glyphp += 16; - } - return base; -} - -static CARD32 * -DrawTETextScanlineWidth16(CARD32 *base, - unsigned int **glyphp, - int line, int width, int glyphwidth) -{ - while (1) { - unsigned int bits; - - bits = glyphp[0][line]; - bits |= SHIFT_L(glyphp[1][line], 16); - WRITE_IN_BITORDER(base, 0, bits); - CHECKRETURN(1); - bits = glyphp[2][line]; - bits |= SHIFT_L(glyphp[3][line], 16); - WRITE_IN_BITORDER(base, 1, bits); - CHECKRETURN(2); - bits = glyphp[4][line]; - bits |= SHIFT_L(glyphp[5][line], 16); - WRITE_IN_BITORDER(base, 2, bits); - CHECKRETURN(3); - bits = glyphp[6][line]; - bits |= SHIFT_L(glyphp[7][line], 16); - WRITE_IN_BITORDER(base, 3, bits); - CHECKRETURN(4); -#ifndef FIXEDBASE - base += 4; -#endif - width -= 128; - glyphp += 8; - } - return base; -} - -static CARD32 * -DrawTETextScanlineWidth18(CARD32 *base, - unsigned int **glyphp, - int line, int width, int glyphwidth) -{ - while (1) { - unsigned int bits; - - bits = glyphp[0][line]; - bits |= SHIFT_L(glyphp[1][line], 18); - WRITE_IN_BITORDER(base, 0, bits); - CHECKRETURN(1); - bits = SHIFT_R(glyphp[1][line], 14); - bits |= SHIFT_L(glyphp[2][line], 4); - bits |= SHIFT_L(glyphp[3][line], 22); - WRITE_IN_BITORDER(base, 1, bits); - CHECKRETURN(2); - bits = SHIFT_R(glyphp[3][line], 10); - bits |= SHIFT_L(glyphp[4][line], 8); - bits |= SHIFT_L(glyphp[5][line], 26); - WRITE_IN_BITORDER(base, 2, bits); - CHECKRETURN(3); - bits = SHIFT_R(glyphp[5][line], 6); - bits |= SHIFT_L(glyphp[6][line], 12); - bits |= SHIFT_L(glyphp[7][line], 30); - WRITE_IN_BITORDER(base, 3, bits); - CHECKRETURN(4); - bits = SHIFT_R(glyphp[7][line], 2); - bits |= SHIFT_L(glyphp[8][line], 16); - WRITE_IN_BITORDER(base, 4, bits); - CHECKRETURN(5); - bits = SHIFT_R(glyphp[8][line], 16); - bits |= SHIFT_L(glyphp[9][line], 2); - bits |= SHIFT_L(glyphp[10][line], 20); - WRITE_IN_BITORDER(base, 5, bits); - CHECKRETURN(6); - bits = SHIFT_R(glyphp[10][line], 12); - bits |= SHIFT_L(glyphp[11][line], 6); - bits |= SHIFT_L(glyphp[12][line], 24); - WRITE_IN_BITORDER(base, 6, bits); - CHECKRETURN(7); - bits = SHIFT_R(glyphp[12][line], 8); - bits |= SHIFT_L(glyphp[13][line], 10); - bits |= SHIFT_L(glyphp[14][line], 28); - WRITE_IN_BITORDER(base, 7, bits); - CHECKRETURN(8); - bits = SHIFT_R(glyphp[14][line], 4); - bits |= SHIFT_L(glyphp[15][line], 14); - WRITE_IN_BITORDER(base, 8, bits); - CHECKRETURN(9); -#ifndef FIXEDBASE - base += 9; -#endif - width -= 288; - glyphp += 16; - } - return base; -} - -static CARD32 * -DrawTETextScanlineWidth24(CARD32 *base, - unsigned int **glyphp, - int line, int width, int glyphwidth) -{ - while (1) { - unsigned int bits; - - bits = glyphp[0][line]; - bits |= SHIFT_L(glyphp[1][line], 24); - WRITE_IN_BITORDER(base, 0, bits); - CHECKRETURN(1); - bits = SHIFT_R(glyphp[1][line], 8); - bits |= SHIFT_L(glyphp[2][line], 16); - WRITE_IN_BITORDER(base, 1, bits); - CHECKRETURN(2); - bits = SHIFT_R(glyphp[2][line], 16); - bits |= SHIFT_L(glyphp[3][line], 8); - WRITE_IN_BITORDER(base, 2, bits); - CHECKRETURN(3); -#ifndef FIXEDBASE - base += 3; -#endif - width -= 96; - glyphp += 4; - } - return base; -} diff --git a/xserver/hw/xfree86/xaa/xaaTEText.c b/xserver/hw/xfree86/xaa/xaaTEText.c deleted file mode 100644 index a5ef44768..000000000 --- a/xserver/hw/xfree86/xaa/xaaTEText.c +++ /dev/null @@ -1,295 +0,0 @@ - -/******************************************************************** - - In this file we have GC level replacements for PolyText8/16, - ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for TE (fixed) fonts. - The idea is that everything in this file is device independent. - The mentioned GCOps are merely wrappers for XAAGlyphBltTEColorExpansion - which calculates the boxes containing arbitrarily clipped text - and passes them to the TEGlyphRenderer which will usually be a lower - level XAA function which renders these clipped glyphs using - the basic color expansion functions exported by the chipset driver. - The TEGlyphRenderer itself may optionally be driver supplied to - facilitate work-arounds/optimizations at a higher level than usual. - - v1.0 - Mark Vojkovich (mvojkovi@ucsd.edu) - -********************************************************************/ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include <X11/fonts/font.h> -#include "scrnintstr.h" -#include "dixfontstr.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" -#include "gcstruct.h" -#include "pixmapstr.h" - -static void XAAGlyphBltTEColorExpansion(ScrnInfoPtr pScrn, int xInit, - int yInit, FontPtr font, int fg, int bg, - int rop, unsigned int planemask, - RegionPtr cclip, int nglyph, - unsigned char *gBase, - CharInfoPtr * ppci); - -/******************************************************************** - - GC level replacements for PolyText8/16 and ImageText8/16 - for TE fonts when using color expansion. - -********************************************************************/ - -int -XAAPolyText8TEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - unsigned long n; - - (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count, - (unsigned char *) chars, Linear8Bit, &n, - infoRec->CharInfo); - - /* we have divorced XAAGlyphBltTEColorExpansion from the drawable */ - if (n) - XAAGlyphBltTEColorExpansion(infoRec->pScrn, x + pDraw->x, y + pDraw->y, - pGC->font, pGC->fgPixel, -1, pGC->alu, - pGC->planemask, pGC->pCompositeClip, n, - FONTGLYPHS(pGC->font), infoRec->CharInfo); - - return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth))); -} - -int -XAAPolyText16TEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - unsigned long n; - - (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count, - (unsigned char *) chars, - (FONTLASTROW(pGC->font) == - 0) ? Linear16Bit : TwoD16Bit, &n, - infoRec->CharInfo); - - if (n) - XAAGlyphBltTEColorExpansion(infoRec->pScrn, x + pDraw->x, y + pDraw->y, - pGC->font, pGC->fgPixel, -1, pGC->alu, - pGC->planemask, pGC->pCompositeClip, n, - FONTGLYPHS(pGC->font), infoRec->CharInfo); - - return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth))); -} - -void -XAAImageText8TEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - unsigned long n; - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count, - (unsigned char *) chars, Linear8Bit, &n, - infoRec->CharInfo); - - if (n) - XAAGlyphBltTEColorExpansion(infoRec->pScrn, x + pDraw->x, y + pDraw->y, - pGC->font, pGC->fgPixel, pGC->bgPixel, - GXcopy, pGC->planemask, pGC->pCompositeClip, - n, FONTGLYPHS(pGC->font), - infoRec->CharInfo); -} - -void -XAAImageText16TEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - unsigned long n; - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count, - (unsigned char *) chars, - (FONTLASTROW(pGC->font) == - 0) ? Linear16Bit : TwoD16Bit, &n, - infoRec->CharInfo); - - if (n) - XAAGlyphBltTEColorExpansion(infoRec->pScrn, x + pDraw->x, y + pDraw->y, - pGC->font, pGC->fgPixel, pGC->bgPixel, - GXcopy, pGC->planemask, pGC->pCompositeClip, - n, FONTGLYPHS(pGC->font), - infoRec->CharInfo); -} - -/******************************************************************** - - GC level replacements for ImageGlyphBlt and PolyGlyphBlt for - TE fonts when using color expansion. - -********************************************************************/ - -void -XAAImageGlyphBltTEColorExpansion(DrawablePtr pDrawable, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - XAAGlyphBltTEColorExpansion(infoRec->pScrn, xInit + pDrawable->x, - yInit + pDrawable->y, pGC->font, pGC->fgPixel, - pGC->bgPixel, GXcopy, pGC->planemask, - pGC->pCompositeClip, nglyph, - (unsigned char *) pglyphBase, ppci); -} - -void -XAAPolyGlyphBltTEColorExpansion(DrawablePtr pDrawable, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - XAAGlyphBltTEColorExpansion(infoRec->pScrn, xInit + pDrawable->x, - yInit + pDrawable->y, pGC->font, pGC->fgPixel, - -1, pGC->alu, pGC->planemask, - pGC->pCompositeClip, nglyph, - (unsigned char *) pglyphBase, ppci); -} - -/******************************************************************** - - XAAGlyphBltTEColorExpansion - - - This guy computes the clipped pieces of text and sends it to - the lower-level function which will handle acceleration of - arbitrarily clipped text. - -********************************************************************/ - -static void -XAAGlyphBltTEColorExpansion(ScrnInfoPtr pScrn, - int xInit, int yInit, - FontPtr font, - int fg, int bg, - int rop, - unsigned int planemask, - RegionPtr cclip, - int nglyph, - unsigned char *gBase, CharInfoPtr * ppci) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int skippix, skipglyphs; - int Left, Right, Top, Bottom; - int LeftEdge, RightEdge, ytop, ybot; - int nbox = RegionNumRects(cclip); - BoxPtr pbox = RegionRects(cclip); - unsigned int **glyphs = NULL; - int glyphWidth = FONTMAXBOUNDS(font, characterWidth); - - /* find the size of the box */ - Left = xInit; - Right = Left + (glyphWidth * nglyph); - Top = yInit - FONTASCENT(font); - Bottom = yInit + FONTDESCENT(font); - - /* get into the first band that may contain part of our string */ - while (nbox && (Top >= pbox->y2)) { - pbox++; - nbox--; - } - - /* stop when the lower edge of the box is beyond our string */ - while (nbox && (Bottom > pbox->y1)) { - LeftEdge = max(Left, pbox->x1); - RightEdge = min(Right, pbox->x2); - - if (RightEdge > LeftEdge) { /* we have something to draw */ - unsigned int *fallbackBits = NULL; - - ytop = max(Top, pbox->y1); - ybot = min(Bottom, pbox->y2); - - if ((skippix = LeftEdge - Left)) { - skipglyphs = skippix / glyphWidth; - skippix %= glyphWidth; - } - else - skipglyphs = 0; - - if (!glyphs) { - int count; - - glyphs = (unsigned int **) (infoRec->PreAllocMem); - - for (count = 0; count < nglyph; count++) { - glyphs[count] = (unsigned int *) - FONTGLYPHBITS(gBase, *ppci++); - if (!glyphs[count]) { - /* Glyphs with NULL bits do exist in the wild. - Replace with blank bits in that case */ - - if (!fallbackBits) { - int fontHeight = Bottom - Top + 1; - - fallbackBits = calloc(glyphWidth * fontHeight, 1); - if (!fallbackBits) - return; - } - glyphs[count] = fallbackBits; - } - } - - /* our new unrolled TE code only writes DWORDS at a time - so it can read up to 6 characters past the last one - we're displaying */ - glyphs[count + 0] = glyphs[0]; - glyphs[count + 1] = glyphs[0]; - glyphs[count + 2] = glyphs[0]; - glyphs[count + 3] = glyphs[0]; - glyphs[count + 4] = glyphs[0]; - glyphs[count + 5] = glyphs[0]; - } - - /* x, y, w, h, skipleft, skiptop, glyphp, glyphWidth, fg, bg, rop, pm */ - - (*infoRec->TEGlyphRenderer) (pScrn, - LeftEdge, ytop, RightEdge - LeftEdge, - ybot - ytop, skippix, ytop - Top, - glyphs + skipglyphs, glyphWidth, fg, - bg, rop, planemask); - - free(fallbackBits); - } - - nbox--; - pbox++; - } -} diff --git a/xserver/hw/xfree86/xaa/xaaTables.c b/xserver/hw/xfree86/xaa/xaaTables.c deleted file mode 100644 index 35641da59..000000000 --- a/xserver/hw/xfree86/xaa/xaaTables.c +++ /dev/null @@ -1,152 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif -#include "xaalocal.h" -/* - * This is a table of 24-bit values, indexed with an 8-bit byte value, then - * expands each bit to three consecutive bits. This is required for color - * expansion in 24bpp mode with the coprocessor in 8bpp mode, with LSB-first - * bit order within a byte. - */ - -unsigned int byte_expand3[256] = { - 0x000000, 0x000007, 0x000038, 0x00003F, 0x0001C0, 0x0001C7, 0x0001F8, - 0x0001FF, - 0x000E00, 0x000E07, 0x000E38, 0x000E3F, 0x000FC0, 0x000FC7, 0x000FF8, - 0x000FFF, - 0x007000, 0x007007, 0x007038, 0x00703F, 0x0071C0, 0x0071C7, 0x0071F8, - 0x0071FF, - 0x007E00, 0x007E07, 0x007E38, 0x007E3F, 0x007FC0, 0x007FC7, 0x007FF8, - 0x007FFF, - 0x038000, 0x038007, 0x038038, 0x03803F, 0x0381C0, 0x0381C7, 0x0381F8, - 0x0381FF, - 0x038E00, 0x038E07, 0x038E38, 0x038E3F, 0x038FC0, 0x038FC7, 0x038FF8, - 0x038FFF, - 0x03F000, 0x03F007, 0x03F038, 0x03F03F, 0x03F1C0, 0x03F1C7, 0x03F1F8, - 0x03F1FF, - 0x03FE00, 0x03FE07, 0x03FE38, 0x03FE3F, 0x03FFC0, 0x03FFC7, 0x03FFF8, - 0x03FFFF, - 0x1C0000, 0x1C0007, 0x1C0038, 0x1C003F, 0x1C01C0, 0x1C01C7, 0x1C01F8, - 0x1C01FF, - 0x1C0E00, 0x1C0E07, 0x1C0E38, 0x1C0E3F, 0x1C0FC0, 0x1C0FC7, 0x1C0FF8, - 0x1C0FFF, - 0x1C7000, 0x1C7007, 0x1C7038, 0x1C703F, 0x1C71C0, 0x1C71C7, 0x1C71F8, - 0x1C71FF, - 0x1C7E00, 0x1C7E07, 0x1C7E38, 0x1C7E3F, 0x1C7FC0, 0x1C7FC7, 0x1C7FF8, - 0x1C7FFF, - 0x1F8000, 0x1F8007, 0x1F8038, 0x1F803F, 0x1F81C0, 0x1F81C7, 0x1F81F8, - 0x1F81FF, - 0x1F8E00, 0x1F8E07, 0x1F8E38, 0x1F8E3F, 0x1F8FC0, 0x1F8FC7, 0x1F8FF8, - 0x1F8FFF, - 0x1FF000, 0x1FF007, 0x1FF038, 0x1FF03F, 0x1FF1C0, 0x1FF1C7, 0x1FF1F8, - 0x1FF1FF, - 0x1FFE00, 0x1FFE07, 0x1FFE38, 0x1FFE3F, 0x1FFFC0, 0x1FFFC7, 0x1FFFF8, - 0x1FFFFF, - 0xE00000, 0xE00007, 0xE00038, 0xE0003F, 0xE001C0, 0xE001C7, 0xE001F8, - 0xE001FF, - 0xE00E00, 0xE00E07, 0xE00E38, 0xE00E3F, 0xE00FC0, 0xE00FC7, 0xE00FF8, - 0xE00FFF, - 0xE07000, 0xE07007, 0xE07038, 0xE0703F, 0xE071C0, 0xE071C7, 0xE071F8, - 0xE071FF, - 0xE07E00, 0xE07E07, 0xE07E38, 0xE07E3F, 0xE07FC0, 0xE07FC7, 0xE07FF8, - 0xE07FFF, - 0xE38000, 0xE38007, 0xE38038, 0xE3803F, 0xE381C0, 0xE381C7, 0xE381F8, - 0xE381FF, - 0xE38E00, 0xE38E07, 0xE38E38, 0xE38E3F, 0xE38FC0, 0xE38FC7, 0xE38FF8, - 0xE38FFF, - 0xE3F000, 0xE3F007, 0xE3F038, 0xE3F03F, 0xE3F1C0, 0xE3F1C7, 0xE3F1F8, - 0xE3F1FF, - 0xE3FE00, 0xE3FE07, 0xE3FE38, 0xE3FE3F, 0xE3FFC0, 0xE3FFC7, 0xE3FFF8, - 0xE3FFFF, - 0xFC0000, 0xFC0007, 0xFC0038, 0xFC003F, 0xFC01C0, 0xFC01C7, 0xFC01F8, - 0xFC01FF, - 0xFC0E00, 0xFC0E07, 0xFC0E38, 0xFC0E3F, 0xFC0FC0, 0xFC0FC7, 0xFC0FF8, - 0xFC0FFF, - 0xFC7000, 0xFC7007, 0xFC7038, 0xFC703F, 0xFC71C0, 0xFC71C7, 0xFC71F8, - 0xFC71FF, - 0xFC7E00, 0xFC7E07, 0xFC7E38, 0xFC7E3F, 0xFC7FC0, 0xFC7FC7, 0xFC7FF8, - 0xFC7FFF, - 0xFF8000, 0xFF8007, 0xFF8038, 0xFF803F, 0xFF81C0, 0xFF81C7, 0xFF81F8, - 0xFF81FF, - 0xFF8E00, 0xFF8E07, 0xFF8E38, 0xFF8E3F, 0xFF8FC0, 0xFF8FC7, 0xFF8FF8, - 0xFF8FFF, - 0xFFF000, 0xFFF007, 0xFFF038, 0xFFF03F, 0xFFF1C0, 0xFFF1C7, 0xFFF1F8, - 0xFFF1FF, - 0xFFFE00, 0xFFFE07, 0xFFFE38, 0xFFFE3F, 0xFFFFC0, 0xFFFFC7, 0xFFFFF8, - 0xFFFFFF -}; - -/* - * This is a table of 24-bit values, indexed with an 8-bit byte value, - * that reverses the bit order of a byte and then expands each bit to three - * consecutive bits. This is required for color expansion in 24bpp mode - * with the coprocessor in 8bpp mode, with MSB-first bit order within a - * byte. - */ - -unsigned int byte_reversed_expand3[256] = { - 0x000000, 0x0000E0, 0x00001C, 0x0000FC, 0x008003, 0x0080E3, 0x00801F, - 0x0080FF, - 0x007000, 0x0070E0, 0x00701C, 0x0070FC, 0x00F003, 0x00F0E3, 0x00F01F, - 0x00F0FF, - 0x000E00, 0x000EE0, 0x000E1C, 0x000EFC, 0x008E03, 0x008EE3, 0x008E1F, - 0x008EFF, - 0x007E00, 0x007EE0, 0x007E1C, 0x007EFC, 0x00FE03, 0x00FEE3, 0x00FE1F, - 0x00FEFF, - 0xC00100, 0xC001E0, 0xC0011C, 0xC001FC, 0xC08103, 0xC081E3, 0xC0811F, - 0xC081FF, - 0xC07100, 0xC071E0, 0xC0711C, 0xC071FC, 0xC0F103, 0xC0F1E3, 0xC0F11F, - 0xC0F1FF, - 0xC00F00, 0xC00FE0, 0xC00F1C, 0xC00FFC, 0xC08F03, 0xC08FE3, 0xC08F1F, - 0xC08FFF, - 0xC07F00, 0xC07FE0, 0xC07F1C, 0xC07FFC, 0xC0FF03, 0xC0FFE3, 0xC0FF1F, - 0xC0FFFF, - 0x380000, 0x3800E0, 0x38001C, 0x3800FC, 0x388003, 0x3880E3, 0x38801F, - 0x3880FF, - 0x387000, 0x3870E0, 0x38701C, 0x3870FC, 0x38F003, 0x38F0E3, 0x38F01F, - 0x38F0FF, - 0x380E00, 0x380EE0, 0x380E1C, 0x380EFC, 0x388E03, 0x388EE3, 0x388E1F, - 0x388EFF, - 0x387E00, 0x387EE0, 0x387E1C, 0x387EFC, 0x38FE03, 0x38FEE3, 0x38FE1F, - 0x38FEFF, - 0xF80100, 0xF801E0, 0xF8011C, 0xF801FC, 0xF88103, 0xF881E3, 0xF8811F, - 0xF881FF, - 0xF87100, 0xF871E0, 0xF8711C, 0xF871FC, 0xF8F103, 0xF8F1E3, 0xF8F11F, - 0xF8F1FF, - 0xF80F00, 0xF80FE0, 0xF80F1C, 0xF80FFC, 0xF88F03, 0xF88FE3, 0xF88F1F, - 0xF88FFF, - 0xF87F00, 0xF87FE0, 0xF87F1C, 0xF87FFC, 0xF8FF03, 0xF8FFE3, 0xF8FF1F, - 0xF8FFFF, - 0x070000, 0x0700E0, 0x07001C, 0x0700FC, 0x078003, 0x0780E3, 0x07801F, - 0x0780FF, - 0x077000, 0x0770E0, 0x07701C, 0x0770FC, 0x07F003, 0x07F0E3, 0x07F01F, - 0x07F0FF, - 0x070E00, 0x070EE0, 0x070E1C, 0x070EFC, 0x078E03, 0x078EE3, 0x078E1F, - 0x078EFF, - 0x077E00, 0x077EE0, 0x077E1C, 0x077EFC, 0x07FE03, 0x07FEE3, 0x07FE1F, - 0x07FEFF, - 0xC70100, 0xC701E0, 0xC7011C, 0xC701FC, 0xC78103, 0xC781E3, 0xC7811F, - 0xC781FF, - 0xC77100, 0xC771E0, 0xC7711C, 0xC771FC, 0xC7F103, 0xC7F1E3, 0xC7F11F, - 0xC7F1FF, - 0xC70F00, 0xC70FE0, 0xC70F1C, 0xC70FFC, 0xC78F03, 0xC78FE3, 0xC78F1F, - 0xC78FFF, - 0xC77F00, 0xC77FE0, 0xC77F1C, 0xC77FFC, 0xC7FF03, 0xC7FFE3, 0xC7FF1F, - 0xC7FFFF, - 0x3F0000, 0x3F00E0, 0x3F001C, 0x3F00FC, 0x3F8003, 0x3F80E3, 0x3F801F, - 0x3F80FF, - 0x3F7000, 0x3F70E0, 0x3F701C, 0x3F70FC, 0x3FF003, 0x3FF0E3, 0x3FF01F, - 0x3FF0FF, - 0x3F0E00, 0x3F0EE0, 0x3F0E1C, 0x3F0EFC, 0x3F8E03, 0x3F8EE3, 0x3F8E1F, - 0x3F8EFF, - 0x3F7E00, 0x3F7EE0, 0x3F7E1C, 0x3F7EFC, 0x3FFE03, 0x3FFEE3, 0x3FFE1F, - 0x3FFEFF, - 0xFF0100, 0xFF01E0, 0xFF011C, 0xFF01FC, 0xFF8103, 0xFF81E3, 0xFF811F, - 0xFF81FF, - 0xFF7100, 0xFF71E0, 0xFF711C, 0xFF71FC, 0xFFF103, 0xFFF1E3, 0xFFF11F, - 0xFFF1FF, - 0xFF0F00, 0xFF0FE0, 0xFF0F1C, 0xFF0FFC, 0xFF8F03, 0xFF8FE3, 0xFF8F1F, - 0xFF8FFF, - 0xFF7F00, 0xFF7FE0, 0xFF7F1C, 0xFF7FFC, 0xFFFF03, 0xFFFFE3, 0xFFFF1F, - 0xFFFFFF, -}; diff --git a/xserver/hw/xfree86/xaa/xaaWideLine.c b/xserver/hw/xfree86/xaa/xaaWideLine.c deleted file mode 100644 index b8a53c1c8..000000000 --- a/xserver/hw/xfree86/xaa/xaaWideLine.c +++ /dev/null @@ -1,924 +0,0 @@ -/* - -XAAPolylinesWideSolid does not maintain a span list and subsequently does -not follow the "touch-each-pixel-once" rules for wide lines and arcs. -This means it can only be used in the case where we have -miSpansEasyRop(pGC->alu). Since we clip spans on the fly, we -limited usage of this function to one rect situations. This -function is used only for solid lines. - - Adapted from miWideLine by Mark Vojkovich (mvojkovi@ucsd.edu) -Original mi code written by Keith Packard. - -*/ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <math.h> - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include <X11/X.h> -#include "windowstr.h" -#include "gcstruct.h" -#include "regionstr.h" -#include "miwideline.h" -#include "mi.h" -#include "xf86str.h" -#include "xaa.h" -#include "xaalocal.h" - -#define DRAW_POINT(pScrn, x, y) \ - if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, 1, 1); \ - else XAAPointHelper(pScrn, x, y) - -#define FILL_RECT(pScrn, x, y, w, h) \ - if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); \ - else XAAFillRectHelper(pScrn, x, y, w, h) - -#define FILL_SPAN(pScrn, x, y, w) \ - if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, 1); \ - else XAASpanHelper(pScrn, x, y, w) - -#define CLIPSTEPEDGE(edgey,edge,edgeleft) \ - if (ybase == edgey) { \ - if (edgeleft) { \ - if (edge->x > xcl) \ - xcl = edge->x; \ - } else { \ - if (edge->x < xcr) \ - xcr = edge->x; \ - } \ - edgey++; \ - edge->x += edge->stepx; \ - edge->e += edge->dx; \ - if (edge->e > 0) { \ - edge->x += edge->signdx; \ - edge->e -= edge->dy; \ - } \ - } - -static void -XAAPointHelper(ScrnInfoPtr pScrn, int x, int y) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - BoxPtr extents = infoRec->ClipBox; - - if ((x >= extents->x1) && (x < extents->x2) && - (y >= extents->y1) && (y < extents->y2)) - (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, 1, 1); -} - -static void -XAAFillRectHelper(ScrnInfoPtr pScrn, int x1, int y1, int dx, int dy) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - BoxPtr extents = infoRec->ClipBox; - int x2 = x1 + dx; - int y2 = y1 + dy; - - if (x1 < extents->x1) - x1 = extents->x1; - if (x2 >= extents->x2) - x2 = extents->x2; - if ((dx = x2 - x1) < 1) - return; - if (y1 < extents->y1) - y1 = extents->y1; - if (y2 >= extents->y2) - y2 = extents->y2; - if ((dy = y2 - y1) < 1) - return; - - (*infoRec->SubsequentSolidFillRect) (pScrn, x1, y1, dx, dy); -} - -static void -XAASpanHelper(ScrnInfoPtr pScrn, int x1, int y, int width) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - BoxPtr extents = infoRec->ClipBox; - int x2; - - if ((y < extents->y1) || (y >= extents->y2)) - return; - - x2 = x1 + width; - if (x1 < extents->x1) - x1 = extents->x1; - if (x2 > extents->x2) - x2 = extents->x2; - width = x2 - x1; - - if (width > 0) - (*infoRec->SubsequentSolidFillRect) (pScrn, x1, y, width, 1); - -} - -#define FixError(x, dx, dy, e, sign, step, h) { \ - e += (h) * dx; \ - x += (h) * step; \ - if(e > 0) { \ - x += e * sign/dy; \ - e %= dy; \ - if(e) { \ - x += sign; \ - e -= dy; \ - } \ - } \ -} - -static void -XAAFillPolyHelper(GCPtr pGC, int y, /* start y coordinate */ - int overall_height, /* height of entire segment */ - PolyEdgePtr left, PolyEdgePtr right, - int left_count, int right_count) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - BoxPtr extents = infoRec->ClipBox; - int left_x, left_e, left_stepx, left_signdx, left_dy, left_dx; - int right_x, right_e, right_stepx, right_signdx, right_dy, right_dx; - int height, left_height, right_height; - int xorg; - Bool hardClip; - - if ((y >= extents->y2) || ((y + overall_height) <= extents->y1)) - return; - - /* Muffle compiler */ - left_x = left_e = left_stepx = left_signdx = left_dy = left_dx = 0; - right_x = right_e = right_stepx = right_signdx = right_dy = right_dx = 0; - - left_height = right_height = 0; - xorg = 0; - - hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL); - - while ((left_count || left_height) && (right_count || right_height)) { - if (!left_height && left_count) { - left_height = left->height; - left_x = left->x + xorg; - left_stepx = left->stepx; - left_signdx = left->signdx; - left_e = left->e; - left_dy = left->dy; - left_dx = left->dx; - left_count--; - left++; - } - if (!right_height && right_count) { - right_height = right->height; - right_x = right->x + xorg + 1; - right_stepx = right->stepx; - right_signdx = right->signdx; - right_e = right->e; - right_dy = right->dy; - right_dx = right->dx; - right_count--; - right++; - } - - height = (left_height > right_height) ? right_height : left_height; - - left_height -= height; - right_height -= height; - - if (hardClip && infoRec->SubsequentSolidFillTrap && (height > 6)) { - int right_DX, left_DX; - - right_DX = (right_dx * right_signdx) + (right_stepx * right_dy); - left_DX = (left_dx * left_signdx) + (left_stepx * left_dy); - - (*infoRec->SubsequentSolidFillTrap) (infoRec->pScrn, y, height, - left_x, left_DX, left_dy, - left_e, right_x - 1, right_DX, - right_dy, right_e); - - FixError(left_x, left_dx, left_dy, left_e, left_signdx, - left_stepx, height); - FixError(right_x, right_dx, right_dy, right_e, right_signdx, - right_stepx, height); - y += height; - continue; - } - - while (height--) { - if (right_x > left_x) { - FILL_SPAN(infoRec->pScrn, left_x, y, right_x - left_x); - } - y++; - - left_x += left_stepx; - left_e += left_dx; - if (left_e > 0) { - left_x += left_signdx; - left_e -= left_dy; - } - right_x += right_stepx; - right_e += right_dx; - if (right_e > 0) { - right_x += right_signdx; - right_e -= right_dy; - } - - } - } -} - -static void -XAAWideSegment(GCPtr pGC, - int x1, int y1, int x2, int y2, - Bool projectLeft, Bool projectRight, - LineFacePtr leftFace, LineFacePtr rightFace) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - double l, L, r; - double xa, ya; - double projectXoff, projectYoff; - double k; - double maxy; - int x, y; - int dx, dy; - int finaly; - PolyEdgePtr left, right; - PolyEdgePtr top, bottom; - int lefty, righty, topy, bottomy; - int signdx; - PolyEdgeRec lefts[2], rights[2]; - LineFacePtr tface; - int lw = pGC->lineWidth; - Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL); - - /* draw top-to-bottom always */ - if ((y2 < y1) || ((y2 == y1) && (x2 < x1))) { - x = x1; - x1 = x2; - x2 = x; - - y = y1; - y1 = y2; - y2 = y; - - x = projectLeft; - projectLeft = projectRight; - projectRight = x; - - tface = leftFace; - leftFace = rightFace; - rightFace = tface; - } - - dy = y2 - y1; - signdx = 1; - dx = x2 - x1; - if (dx < 0) - signdx = -1; - - leftFace->x = x1; - leftFace->y = y1; - leftFace->dx = dx; - leftFace->dy = dy; - - rightFace->x = x2; - rightFace->y = y2; - rightFace->dx = -dx; - rightFace->dy = -dy; - - if (!dy) { - rightFace->xa = 0; - rightFace->ya = (double) lw / 2.0; - rightFace->k = -(double) (lw * dx) / 2.0; - leftFace->xa = 0; - leftFace->ya = -rightFace->ya; - leftFace->k = rightFace->k; - x = x1; - if (projectLeft) - x -= (lw >> 1); - y = y1 - (lw >> 1); - dx = x2 - x; - if (projectRight) - dx += ((lw + 1) >> 1); - dy = lw; - FILL_RECT(infoRec->pScrn, x, y, dx, dy); - } - else if (!dx) { - leftFace->xa = (double) lw / 2.0; - leftFace->ya = 0; - leftFace->k = (double) (lw * dy) / 2.0; - rightFace->xa = -leftFace->xa; - rightFace->ya = 0; - rightFace->k = leftFace->k; - y = y1; - if (projectLeft) - y -= lw >> 1; - x = x1 - (lw >> 1); - dy = y2 - y; - if (projectRight) - dy += ((lw + 1) >> 1); - dx = lw; - FILL_RECT(infoRec->pScrn, x, y, dx, dy); - } - else { - l = ((double) lw) / 2.0; - L = sqrt((double) (dx * dx + dy * dy)); - - if (dx < 0) { - right = &rights[1]; - left = &lefts[0]; - top = &rights[0]; - bottom = &lefts[1]; - } - else { - right = &rights[0]; - left = &lefts[1]; - top = &lefts[0]; - bottom = &rights[1]; - } - r = l / L; - - /* coord of upper bound at integral y */ - ya = -r * dx; - xa = r * dy; - - projectXoff = -ya; - projectYoff = xa; - - /* xa * dy - ya * dx */ - k = l * L; - - leftFace->xa = xa; - leftFace->ya = ya; - leftFace->k = k; - rightFace->xa = -xa; - rightFace->ya = -ya; - rightFace->k = k; - - if (projectLeft) - righty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff, - k, dx, dy, x1, y1, 0, right); - else - righty = miPolyBuildEdge(xa, ya, k, dx, dy, x1, y1, 0, right); - - /* coord of lower bound at integral y */ - ya = -ya; - xa = -xa; - - /* xa * dy - ya * dx */ - k = -k; - - if (projectLeft) - lefty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff, - k, dx, dy, x1, y1, 1, left); - else - lefty = miPolyBuildEdge(xa, ya, k, dx, dy, x1, y1, 1, left); - - /* coord of top face at integral y */ - - if (signdx > 0) { - ya = -ya; - xa = -xa; - } - - if (projectLeft) { - double xap = xa - projectXoff; - double yap = ya - projectYoff; - - topy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy, - -dy, dx, x1, y1, dx > 0, top); - } - else - topy = miPolyBuildEdge(xa, ya, 0.0, -dy, dx, x1, y1, dx > 0, top); - - /* coord of bottom face at integral y */ - - if (projectRight) { - double xap = xa + projectXoff; - double yap = ya + projectYoff; - - bottomy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy, - -dy, dx, x2, y2, dx < 0, bottom); - maxy = -ya + projectYoff; - } - else { - bottomy = miPolyBuildEdge(xa, ya, 0.0, - -dy, dx, x2, y2, dx < 0, bottom); - maxy = -ya; - } - - finaly = ICEIL(maxy) + y2; - - if (dx < 0) { - left->height = bottomy - lefty; - right->height = finaly - righty; - top->height = righty - topy; - } - else { - right->height = bottomy - righty; - left->height = finaly - lefty; - top->height = lefty - topy; - } - bottom->height = finaly - bottomy; - XAAFillPolyHelper(pGC, topy, - bottom->height + bottomy - topy, lefts, rights, 2, 2); - } -} - -static void -XAALineArcI(GCPtr pGC, int xorg, int yorg) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int x, y, e, ex; - int slw = pGC->lineWidth; - Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL); - - y = (slw >> 1) + 1; - if (slw & 1) - e = -((y << 2) + 3); - else - e = -(y << 3); - ex = -4; - x = 0; - while (y) { - e += (y << 3) - 4; - while (e >= 0) { - x++; - e += (ex = -((x << 3) + 4)); - } - y--; - slw = (x << 1) + 1; - if ((e == ex) && (slw > 1)) - slw--; - - FILL_SPAN(infoRec->pScrn, xorg - x, yorg - y, slw); - - if ((y != 0) && ((slw > 1) || (e != ex))) { - FILL_SPAN(infoRec->pScrn, xorg - x, yorg + y, slw); - } - } -} - -static void -XAALineArcD(GCPtr pGC, - double xorg, - double yorg, - PolyEdgePtr edge1, - int edgey1, - Bool edgeleft1, PolyEdgePtr edge2, int edgey2, Bool edgeleft2) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - double radius, x0, y0, el, er, yk, xlk, xrk, k; - int xbase, ybase, y, boty, xl, xr, xcl, xcr; - int ymin, ymax; - Bool edge1IsMin, edge2IsMin; - int ymin1, ymin2; - Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL); - - xbase = floor(xorg); - x0 = xorg - xbase; - ybase = ICEIL(yorg); - y0 = yorg - ybase; - - xlk = x0 + x0 + 1.0; - xrk = x0 + x0 - 1.0; - yk = y0 + y0 - 1.0; - radius = ((double) pGC->lineWidth) / 2.0; - y = floor(radius - y0 + 1.0); - ybase -= y; - ymin = ybase; - ymax = 65536; - edge1IsMin = FALSE; - ymin1 = edgey1; - if (edge1->dy >= 0) { - if (!edge1->dy) { - if (edgeleft1) - edge1IsMin = TRUE; - else - ymax = edgey1; - edgey1 = 65536; - } - else if ((edge1->signdx < 0) == edgeleft1) - edge1IsMin = TRUE; - } - edge2IsMin = FALSE; - ymin2 = edgey2; - if (edge2->dy >= 0) { - if (!edge2->dy) { - if (edgeleft2) - edge2IsMin = TRUE; - else - ymax = edgey2; - edgey2 = 65536; - } - else if ((edge2->signdx < 0) == edgeleft2) - edge2IsMin = TRUE; - } - if (edge1IsMin) { - ymin = ymin1; - if (edge2IsMin && (ymin1 > ymin2)) - ymin = ymin2; - } - else if (edge2IsMin) - ymin = ymin2; - el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0); - er = el + xrk; - xl = 1; - xr = 0; - if (x0 < 0.5) { - xl = 0; - el -= xlk; - } - boty = (y0 < -0.5) ? 1 : 0; - if (ybase + y - boty > ymax) - boty = ymax - ybase - y; - while (y > boty) { - k = (y << 1) + yk; - er += k; - while (er > 0.0) { - xr++; - er += xrk - (xr << 1); - } - el += k; - while (el >= 0.0) { - xl--; - el += (xl << 1) - xlk; - } - y--; - ybase++; - if (ybase < ymin) - continue; - xcl = xl + xbase; - xcr = xr + xbase; - CLIPSTEPEDGE(edgey1, edge1, edgeleft1); - CLIPSTEPEDGE(edgey2, edge2, edgeleft2); - if (xcr >= xcl) { - FILL_SPAN(infoRec->pScrn, xcl, ybase, xcr - xcl + 1); - } - } - er = xrk - (xr << 1) - er; - el = (xl << 1) - xlk - el; - boty = floor(-y0 - radius + 1.0); - if (ybase + y - boty > ymax) - boty = ymax - ybase - y; - while (y > boty) { - k = (y << 1) + yk; - er -= k; - while ((er >= 0.0) && (xr >= 0)) { - xr--; - er += xrk - (xr << 1); - } - el -= k; - while ((el > 0.0) && (xl <= 0)) { - xl++; - el += (xl << 1) - xlk; - } - y--; - ybase++; - if (ybase < ymin) - continue; - xcl = xl + xbase; - xcr = xr + xbase; - CLIPSTEPEDGE(edgey1, edge1, edgeleft1); - CLIPSTEPEDGE(edgey2, edge2, edgeleft2); - if (xcr >= xcl) { - FILL_SPAN(infoRec->pScrn, xcl, ybase, xcr - xcl + 1); - } - } -} - -static void -XAALineArc(GCPtr pGC, - LineFacePtr leftFace, - LineFacePtr rightFace, double xorg, double yorg, Bool isInt) -{ - int xorgi, yorgi; - PolyEdgeRec edge1, edge2; - int edgey1, edgey2; - Bool edgeleft1, edgeleft2; - - if (isInt) { - xorgi = leftFace ? leftFace->x : rightFace->x; - yorgi = leftFace ? leftFace->y : rightFace->y; - } - else { /* Muffle compiler */ - xorgi = yorgi = 0; - } - edgey1 = 65536; - edgey2 = 65536; - edge1.x = 0; /* not used, keep memory checkers happy */ - edge1.dy = -1; - edge2.x = 0; /* not used, keep memory checkers happy */ - edge2.dy = -1; - edgeleft1 = FALSE; - edgeleft2 = FALSE; - - if ((pGC->lineWidth > 2) && - ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) || - (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))) { - if (isInt) { - xorg = (double) xorgi; - yorg = (double) yorgi; - } - - if (leftFace && rightFace) - miRoundJoinClip(leftFace, rightFace, &edge1, &edge2, - &edgey1, &edgey2, &edgeleft1, &edgeleft2); - else if (leftFace) - edgey1 = miRoundCapClip(leftFace, isInt, &edge1, &edgeleft1); - else if (rightFace) - edgey2 = miRoundCapClip(rightFace, isInt, &edge2, &edgeleft2); - - isInt = FALSE; - } - - if (isInt) { - if (pGC->lineWidth == 1) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL); - - DRAW_POINT(infoRec->pScrn, xorgi, yorgi); - } - else - XAALineArcI(pGC, xorgi, yorgi); - } - else - XAALineArcD(pGC, xorg, yorg, &edge1, edgey1, edgeleft1, - &edge2, edgey2, edgeleft2); - -} - -static void -XAALineJoin(GCPtr pGC, LineFacePtr pLeft, LineFacePtr pRight) -{ - double mx = 0, my = 0; - double denom = 0; - PolyVertexRec vertices[4]; - PolySlopeRec slopes[4]; - int edgecount; - PolyEdgeRec left[4], right[4]; - int nleft, nright; - int y, height; - int swapslopes; - int joinStyle = pGC->joinStyle; - int lw = pGC->lineWidth; - - if (lw == 1) { - /* Lines going in the same direction have no join */ - if ((pLeft->dx >= 0) == (pRight->dx <= 0)) - return; - if (joinStyle != JoinRound) { - denom = -pLeft->dx * (double) pRight->dy + pRight->dx * - (double) pLeft->dy; - if (denom == 0.0) - return; /* no join to draw */ - } - if (joinStyle != JoinMiter) { - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL); - - DRAW_POINT(infoRec->pScrn, pLeft->x, pLeft->y); - return; - } - } - else { - if (joinStyle == JoinRound) { - XAALineArc(pGC, pLeft, pRight, (double) 0.0, (double) 0.0, TRUE); - return; - } - denom = -pLeft->dx * (double) pRight->dy + pRight->dx * - (double) pLeft->dy; - if (denom == 0.0) - return; /* no join to draw */ - } - - swapslopes = 0; - if (denom > 0) { - pLeft->xa = -pLeft->xa; - pLeft->ya = -pLeft->ya; - pLeft->dx = -pLeft->dx; - pLeft->dy = -pLeft->dy; - } - else { - swapslopes = 1; - pRight->xa = -pRight->xa; - pRight->ya = -pRight->ya; - pRight->dx = -pRight->dx; - pRight->dy = -pRight->dy; - } - - vertices[0].x = pRight->xa; - vertices[0].y = pRight->ya; - slopes[0].dx = -pRight->dy; - slopes[0].dy = pRight->dx; - slopes[0].k = 0; - - vertices[1].x = 0; - vertices[1].y = 0; - slopes[1].dx = pLeft->dy; - slopes[1].dy = -pLeft->dx; - slopes[1].k = 0; - - vertices[2].x = pLeft->xa; - vertices[2].y = pLeft->ya; - - if (joinStyle == JoinMiter) { - my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) - - pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx)) / - denom; - if (pLeft->dy != 0) - mx = pLeft->xa + (my - pLeft->ya) * - (double) pLeft->dx / (double) pLeft->dy; - else - mx = pRight->xa + (my - pRight->ya) * - (double) pRight->dx / (double) pRight->dy; - - /* check miter limit */ - if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw) - joinStyle = JoinBevel; - } - - if (joinStyle == JoinMiter) { - slopes[2].dx = pLeft->dx; - slopes[2].dy = pLeft->dy; - slopes[2].k = pLeft->k; - if (swapslopes) { - slopes[2].dx = -slopes[2].dx; - slopes[2].dy = -slopes[2].dy; - slopes[2].k = -slopes[2].k; - } - vertices[3].x = mx; - vertices[3].y = my; - slopes[3].dx = pRight->dx; - slopes[3].dy = pRight->dy; - slopes[3].k = pRight->k; - if (swapslopes) { - slopes[3].dx = -slopes[3].dx; - slopes[3].dy = -slopes[3].dy; - slopes[3].k = -slopes[3].k; - } - edgecount = 4; - } - else { - double scale, dx, dy, adx, ady; - - adx = dx = pRight->xa - pLeft->xa; - ady = dy = pRight->ya - pLeft->ya; - if (adx < 0) - adx = -adx; - if (ady < 0) - ady = -ady; - scale = ady; - if (adx > ady) - scale = adx; - slopes[2].dx = (dx * 65536) / scale; - slopes[2].dy = (dy * 65536) / scale; - slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy - - (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0; - edgecount = 3; - } - - y = miPolyBuildPoly(vertices, slopes, edgecount, pLeft->x, pLeft->y, - left, right, &nleft, &nright, &height); - XAAFillPolyHelper(pGC, y, height, left, right, nleft, nright); -} - -void -XAAPolylinesWideSolid(DrawablePtr pDrawable, - GCPtr pGC, int mode, int npt, DDXPointPtr pPts) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int x1, y1, x2, y2; - Bool projectLeft, projectRight; - LineFaceRec leftFace, rightFace, prevRightFace, firstFace; - int first = TRUE; - Bool somethingDrawn = FALSE; - Bool selfJoin = FALSE; - int xorg = pDrawable->x; - int yorg = pDrawable->y; - Bool hardClip = FALSE; - - if (!RegionNumRects(pGC->pCompositeClip)) - return; - - if (RegionNumRects(pGC->pCompositeClip) != 1) { - miWideLine(pDrawable, pGC, mode, npt, pPts); - return; - } - - x2 = pPts->x; - y2 = pPts->y; - if (npt > 1) { - if (mode == CoordModePrevious) { - int nptTmp; - register DDXPointPtr pPtsTmp; - - x1 = x2; - y1 = y2; - nptTmp = npt; - pPtsTmp = pPts + 1; - while (--nptTmp) { - x1 += pPtsTmp->x; - y1 += pPtsTmp->y; - ++pPtsTmp; - } - if ((x2 == x1) && (y2 == y1)) - selfJoin = TRUE; - } - else if ((x2 == pPts[npt - 1].x) && (y2 == pPts[npt - 1].y)) - selfJoin = TRUE; - } - - projectLeft = ((pGC->capStyle == CapProjecting) && !selfJoin); - projectRight = FALSE; - - (*infoRec->SetupForSolidFill) (infoRec->pScrn, pGC->fgPixel, pGC->alu, - pGC->planemask); - - infoRec->ClipBox = &pGC->pCompositeClip->extents; - - if (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL) { - hardClip = TRUE; - (*infoRec->SetClippingRectangle) (infoRec->pScrn, - infoRec->ClipBox->x1, - infoRec->ClipBox->y1, - infoRec->ClipBox->x2 - 1, - infoRec->ClipBox->y2 - 1); - } - - x2 += xorg; - y2 += yorg; - while (--npt) { - x1 = x2; - y1 = y2; - ++pPts; - x2 = pPts->x; - y2 = pPts->y; - if (mode == CoordModePrevious) { - x2 += x1; - y2 += y1; - } - else { - x2 += xorg; - y2 += yorg; - } - if ((x1 != x2) || (y1 != y2)) { - somethingDrawn = TRUE; - if ((npt == 1) && (pGC->capStyle == CapProjecting) && !selfJoin) - projectRight = TRUE; - XAAWideSegment(pGC, x1, y1, x2, y2, - projectLeft, projectRight, &leftFace, &rightFace); - if (first) { - if (selfJoin) - firstFace = leftFace; - else if (pGC->capStyle == CapRound) { - if (pGC->lineWidth == 1) { - DRAW_POINT(infoRec->pScrn, x1, y1); - } - else - XAALineArc(pGC, &leftFace, (LineFacePtr) NULL, - (double) 0.0, (double) 0.0, TRUE); - } - } - else - XAALineJoin(pGC, &leftFace, &prevRightFace); - - prevRightFace = rightFace; - first = FALSE; - projectLeft = FALSE; - } - if (npt == 1 && somethingDrawn) { - if (selfJoin) - XAALineJoin(pGC, &firstFace, &rightFace); - else if (pGC->capStyle == CapRound) { - if (pGC->lineWidth == 1) { - DRAW_POINT(infoRec->pScrn, x2, y2); - } - else - XAALineArc(pGC, (LineFacePtr) NULL, &rightFace, - (double) 0.0, (double) 0.0, TRUE); - } - } - } - /* handle crock where all points are coincedent */ - if (!somethingDrawn) { - projectLeft = (pGC->capStyle == CapProjecting); - XAAWideSegment(pGC, x2, y2, x2, y2, projectLeft, projectLeft, - &leftFace, &rightFace); - if (pGC->capStyle == CapRound) { - XAALineArc(pGC, &leftFace, (LineFacePtr) NULL, - (double) 0.0, (double) 0.0, TRUE); - rightFace.dx = -1; /* sleezy hack to make it work */ - XAALineArc(pGC, (LineFacePtr) NULL, &rightFace, - (double) 0.0, (double) 0.0, TRUE); - } - } - - infoRec->ClipBox = NULL; - if (hardClip) - (*infoRec->DisableClipping) (infoRec->pScrn); - - SET_SYNC_FLAG(infoRec); -} diff --git a/xserver/hw/xfree86/xaa/xaacexp.h b/xserver/hw/xfree86/xaa/xaacexp.h deleted file mode 100644 index 6fde54c65..000000000 --- a/xserver/hw/xfree86/xaa/xaacexp.h +++ /dev/null @@ -1,126 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <X11/Xarch.h> - -#ifndef FIXEDBASE -#define CHECKRETURN(b) if(width <= ((b) * 32)) return(base + (b)) -#else -#define CHECKRETURN(b) if(width <= ((b) * 32)) return(base) -#endif - -#if X_BYTE_ORDER == X_BIG_ENDIAN -#define SHIFT_L(value, shift) ((value) >> (shift)) -#define SHIFT_R(value, shift) ((value) << (shift)) -#else -#define SHIFT_L(value, shift) ((value) << (shift)) -#define SHIFT_R(value, shift) ((value) >> (shift)) -#endif - -#ifndef MSBFIRST -#ifdef FIXEDBASE -#define WRITE_IN_BITORDER(dest, offset, data) *(dest) = data; -#else -#define WRITE_IN_BITORDER(dest, offset, data) *(dest + offset) = data; -#endif -#else -#ifdef FIXEDBASE -#define WRITE_IN_BITORDER(dest, offset, data) *(dest) = SWAP_BITS_IN_BYTES(data); -#else -#define WRITE_IN_BITORDER(dest, offset, data) *(dest + offset) = SWAP_BITS_IN_BYTES(data) -#endif -#endif - -#ifdef FIXEDBASE -#ifdef MSBFIRST -#define WRITE_BITS(b) *base = SWAP_BITS_IN_BYTES(b) -#define WRITE_BITS1(b) { \ - *base = byte_reversed_expand3[(b) & 0xFF] | \ - byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; } -#define WRITE_BITS2(b) { \ - *base = byte_reversed_expand3[(b) & 0xFF] | \ - byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \ - *base = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \ - byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; } -#define WRITE_BITS3(b) { \ - *base = byte_reversed_expand3[(b) & 0xFF] | \ - byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \ - *base = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \ - byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; \ - *base = byte_reversed_expand3[((b) & 0xFF0000) >> 16] >> 16 | \ - byte_reversed_expand3[((b) & 0xFF000000) >> 24] << 8; } -#else -#define WRITE_BITS(b) *base = (b) -#define WRITE_BITS1(b) { \ - *base = byte_expand3[(b) & 0xFF] | \ - byte_expand3[((b) & 0xFF00) >> 8] << 24; } -#define WRITE_BITS2(b) { \ - *base = byte_expand3[(b) & 0xFF] | \ - byte_expand3[((b) & 0xFF00) >> 8] << 24; \ - *base = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \ - byte_expand3[((b) & 0xFF0000) >> 16] << 16; } -#define WRITE_BITS3(b) { \ - *base = byte_expand3[(b) & 0xFF] | \ - byte_expand3[((b) & 0xFF00) >> 8] << 24; \ - *base = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \ - byte_expand3[((b) & 0xFF0000) >> 16] << 16; \ - *base = byte_expand3[((b) & 0xFF0000) >> 16] >> 16 | \ - byte_expand3[((b) & 0xFF000000) >> 24] << 8; } -#endif -#else -#ifdef MSBFIRST -#define WRITE_BITS(b) *(base++) = SWAP_BITS_IN_BYTES(b) -#define WRITE_BITS1(b) { \ - *(base++) = byte_reversed_expand3[(b) & 0xFF] | \ - byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; } -#define WRITE_BITS2(b) { \ - *(base) = byte_reversed_expand3[(b) & 0xFF] | \ - byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \ - *(base + 1) = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \ - byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; \ - base += 2; } -#define WRITE_BITS3(b) { \ - *(base) = byte_reversed_expand3[(b) & 0xFF] | \ - byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \ - *(base + 1) = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \ - byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; \ - *(base + 2) = byte_reversed_expand3[((b) & 0xFF0000) >> 16] >> 16 | \ - byte_reversed_expand3[((b) & 0xFF000000) >> 24] << 8; \ - base += 3; } -#else -#define WRITE_BITS(b) *(base++) = (b) -#define WRITE_BITS1(b) { \ - *(base++) = byte_expand3[(b) & 0xFF] | \ - byte_expand3[((b) & 0xFF00) >> 8] << 24; } -#define WRITE_BITS2(b) { \ - *(base) = byte_expand3[(b) & 0xFF] | \ - byte_expand3[((b) & 0xFF00) >> 8] << 24; \ - *(base + 1) = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \ - byte_expand3[((b) & 0xFF0000) >> 16] << 16; \ - base += 2; } -#define WRITE_BITS3(b) { \ - *(base) = byte_expand3[(b) & 0xFF] | \ - byte_expand3[((b) & 0xFF00) >> 8] << 24; \ - *(base + 1) = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \ - byte_expand3[((b) & 0xFF0000) >> 16] << 16; \ - *(base + 2) = byte_expand3[((b) & 0xFF0000) >> 16] >> 16 | \ - byte_expand3[((b) & 0xFF000000) >> 24] << 8; \ - base += 3; } -#endif -#endif - -#ifdef FIXEDBASE -#ifdef MSBFIRST -#define EXPNAME(x) x##MSBFirstFixedBase -#else -#define EXPNAME(x) x##LSBFirstFixedBase -#endif -#else -#ifdef MSBFIRST -#define EXPNAME(x) x##MSBFirst -#else -#define EXPNAME(x) x##LSBFirst -#endif -#endif diff --git a/xserver/hw/xfree86/xaa/xaalocal.h b/xserver/hw/xfree86/xaa/xaalocal.h deleted file mode 100644 index c028ef033..000000000 --- a/xserver/hw/xfree86/xaa/xaalocal.h +++ /dev/null @@ -1,1437 +0,0 @@ - -#ifndef _XAALOCAL_H -#define _XAALOCAL_H - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -/* This file is very unorganized ! */ - -#include "gcstruct.h" -#include "regionstr.h" -#include "xf86fbman.h" -#include "xaa.h" -#include "mi.h" -#include "picturestr.h" - -#define GCWhenForced (GCArcMode << 1) - -#define DO_COLOR_8x8 0x00000001 -#define DO_MONO_8x8 0x00000002 -#define DO_CACHE_BLT 0x00000003 -#define DO_COLOR_EXPAND 0x00000004 -#define DO_CACHE_EXPAND 0x00000005 -#define DO_IMAGE_WRITE 0x00000006 -#define DO_PIXMAP_COPY 0x00000007 -#define DO_SOLID 0x00000008 - -typedef CARD32 *(*GlyphScanlineFuncPtr) (CARD32 *base, unsigned int **glyphp, - int line, int nglyph, int width); - -typedef CARD32 *(*StippleScanlineProcPtr) (CARD32 *, CARD32 *, int, int, int); - -typedef void (*RectFuncPtr) (ScrnInfoPtr, int, int, int, int, int, int, - XAACacheInfoPtr); -typedef void (*TrapFuncPtr) (ScrnInfoPtr, int, int, int, int, int, int, - int, int, int, int, int, int, XAACacheInfoPtr); - -typedef struct _XAAScreen { - CreateGCProcPtr CreateGC; - CloseScreenProcPtr CloseScreen; - GetImageProcPtr GetImage; - GetSpansProcPtr GetSpans; - CopyWindowProcPtr CopyWindow; - WindowExposuresProcPtr WindowExposures; - CreatePixmapProcPtr CreatePixmap; - DestroyPixmapProcPtr DestroyPixmap; - ChangeWindowAttributesProcPtr ChangeWindowAttributes; - XAAInfoRecPtr AccelInfoRec; - Bool (*EnterVT) (int, int); - void (*LeaveVT) (int, int); - int (*SetDGAMode) (int, int, DGADevicePtr); - void (*EnableDisableFBAccess) (int, Bool); - CompositeProcPtr Composite; - GlyphsProcPtr Glyphs; -} XAAScreenRec, *XAAScreenPtr; - -#define OPS_ARE_PIXMAP 0x00000001 -#define OPS_ARE_ACCEL 0x00000002 - -typedef struct _XAAGC { - GCOps *wrapOps; - GCFuncs *wrapFuncs; - GCOps *XAAOps; - int DashLength; - unsigned char *DashPattern; - unsigned long changes; - unsigned long flags; -} XAAGCRec, *XAAGCPtr; - -#define REDUCIBILITY_CHECKED 0x00000001 -#define REDUCIBLE_TO_8x8 0x00000002 -#define REDUCIBLE_TO_2_COLOR 0x00000004 -#define DIRTY 0x00010000 -#define OFFSCREEN 0x00020000 -#define DGA_PIXMAP 0x00040000 -#define SHARED_PIXMAP 0x00080000 -#define LOCKED_PIXMAP 0x00100000 - -#define REDUCIBILITY_MASK \ - (REDUCIBILITY_CHECKED | REDUCIBLE_TO_8x8 | REDUCIBLE_TO_2_COLOR) - -typedef struct _XAAPixmap { - unsigned long flags; - CARD32 pattern0; - CARD32 pattern1; - int fg; - int bg; - FBAreaPtr offscreenArea; - Bool freeData; -} XAAPixmapRec, *XAAPixmapPtr; - -extern _X_EXPORT Bool - XAACreateGC(GCPtr pGC); - -extern _X_EXPORT Bool - XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec); - -extern _X_EXPORT RegionPtr - -XAABitBlt(DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GC * pGC, - int srcx, - int srcy, - int width, - int height, - int dstx, - int dsty, - void (*doBitBlt) (DrawablePtr, DrawablePtr, GCPtr, RegionPtr, - DDXPointPtr), unsigned long bitPlane); - -extern _X_EXPORT void - -XAAScreenToScreenBitBlt(ScrnInfoPtr pScrn, - int nbox, - DDXPointPtr pptSrc, - BoxPtr pbox, - int xdir, int ydir, int alu, unsigned int planemask); - -extern _X_EXPORT void - -XAADoBitBlt(DrawablePtr pSrc, - DrawablePtr pDst, GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc); - -extern _X_EXPORT void - -XAADoImageWrite(DrawablePtr pSrc, - DrawablePtr pDst, - GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc); - -extern _X_EXPORT void - -XAADoImageRead(DrawablePtr pSrc, - DrawablePtr pDst, - GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc); - -extern _X_EXPORT void - XAACopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); - -extern _X_EXPORT RegionPtr - -XAACopyArea(DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GC * pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty); - -extern _X_EXPORT void - XAAValidateCopyArea(GCPtr pGC, unsigned long changes, DrawablePtr pDraw); - -extern _X_EXPORT void - XAAValidatePutImage(GCPtr pGC, unsigned long changes, DrawablePtr pDraw); - -extern _X_EXPORT void - XAAValidateCopyPlane(GCPtr pGC, unsigned long changes, DrawablePtr pDraw); - -extern _X_EXPORT void - XAAValidatePushPixels(GCPtr pGC, unsigned long changes, DrawablePtr pDraw); - -extern _X_EXPORT void - XAAValidateFillSpans(GCPtr pGC, unsigned long changes, DrawablePtr pDraw); - -extern _X_EXPORT void - XAAValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw); - -extern _X_EXPORT void - XAAValidateImageGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw); - -extern _X_EXPORT void - XAAValidatePolylines(GCPtr pGC, unsigned long changes, DrawablePtr pDraw); - -extern _X_EXPORT RegionPtr - -XAACopyPlaneColorExpansion(DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, - int srcy, - int width, - int height, - int dstx, int dsty, unsigned long bitPlane); - -extern _X_EXPORT void - -XAAPushPixelsSolidColorExpansion(GCPtr pGC, - PixmapPtr pBitMap, - DrawablePtr pDrawable, - int dx, int dy, int xOrg, int yOrg); - -extern _X_EXPORT void - -XAAWriteBitmapColorExpandMSBFirstFixedBase(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapColorExpand3MSBFirstFixedBase(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapColorExpandMSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapColorExpand3MSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapColorExpandLSBFirstFixedBase(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapColorExpand3LSBFirstFixedBase(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapColorExpandLSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapColorExpand3LSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapScanlineColorExpandMSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapScanlineColorExpand3MSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapScanlineColorExpandMSBFirstFixedBase(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, - unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapScanlineColorExpand3MSBFirstFixedBase(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, - unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapScanlineColorExpandLSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapScanlineColorExpand3LSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapScanlineColorExpandLSBFirstFixedBase(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, - unsigned int planemask); - -extern _X_EXPORT void - -XAAWriteBitmapScanlineColorExpand3LSBFirstFixedBase(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, - unsigned int planemask); - -extern _X_EXPORT void - -XAAWritePixmap(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int rop, - unsigned int planemask, - int transparency_color, int bpp, int depth); - -extern _X_EXPORT void - -XAAWritePixmapScanline(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int rop, - unsigned int planemask, - int transparency_color, int bpp, int depth); - -typedef void (*ClipAndRenderRectsFunc) (GCPtr, int, BoxPtr, int, int); - -extern _X_EXPORT void - -XAAClipAndRenderRects(GCPtr pGC, - ClipAndRenderRectsFunc func, - int nrectFill, xRectangle *prectInit, int xorg, int yorg); - -typedef void (*ClipAndRenderSpansFunc) (GCPtr, int, DDXPointPtr, int *, - int, int, int); - -extern _X_EXPORT void - -XAAClipAndRenderSpans(GCPtr pGC, - DDXPointPtr ppt, - int *pwidth, - int nspans, - int fSorted, - ClipAndRenderSpansFunc func, int xorg, int yorg); - -extern _X_EXPORT void - -XAAFillSolidRects(ScrnInfoPtr pScrn, - int fg, int rop, - unsigned int planemask, int nBox, BoxPtr pBox); - -extern _X_EXPORT void - -XAAFillMono8x8PatternRects(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, int pat0, int pat1, int xorg, int yorg); - -extern _X_EXPORT void - -XAAFillMono8x8PatternRectsScreenOrigin(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int pat0, int pat1, int xorg, int yorg); - -extern _X_EXPORT void - -XAAFillColor8x8PatternRectsScreenOrigin(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorigin, int yorigin, - XAACacheInfoPtr pCache); - -extern _X_EXPORT void - -XAAFillColor8x8PatternRects(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorigin, int yorigin, XAACacheInfoPtr pCache); - -extern _X_EXPORT void - -XAAFillCacheBltRects(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, int xorg, int yorg, XAACacheInfoPtr pCache); - -extern _X_EXPORT void - -XAAFillCacheExpandRects(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillImageWriteRects(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAPolyFillRect(DrawablePtr pDraw, - GCPtr pGC, int nrectFill, xRectangle *prectInit); - -extern _X_EXPORT void - -XAATEGlyphRendererMSBFirstFixedBase(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask); - -extern _X_EXPORT void - -XAATEGlyphRenderer3MSBFirstFixedBase(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask); - -extern _X_EXPORT void - -XAATEGlyphRendererMSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, int glyphWidth, - int fg, int bg, int rop, unsigned planemask); - -extern _X_EXPORT void - -XAATEGlyphRenderer3MSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask); - -extern _X_EXPORT void - -XAATEGlyphRendererLSBFirstFixedBase(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask); - -extern _X_EXPORT void - -XAATEGlyphRenderer3LSBFirstFixedBase(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask); - -extern _X_EXPORT void - -XAATEGlyphRendererLSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, int glyphWidth, - int fg, int bg, int rop, unsigned planemask); - -extern _X_EXPORT void - -XAATEGlyphRenderer3LSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask); - -extern _X_EXPORT void - -XAATEGlyphRendererScanlineMSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask); - -extern _X_EXPORT void - -XAATEGlyphRendererScanline3MSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask); - -extern _X_EXPORT void - -XAATEGlyphRendererScanlineLSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask); - -extern _X_EXPORT void - -XAATEGlyphRendererScanline3LSBFirst(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft, - int startline, unsigned int **glyphs, - int glyphWidth, int fg, int bg, int rop, - unsigned planemask); - -extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncMSBFirstFixedBase[32]) (CARD32 - *base, - unsigned - int - **glyphp, - int line, - int - nglyph, - int - width); - -extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncMSBFirst[32]) (CARD32 *base, - unsigned int - **glyphp, - int line, - int nglyph, - int width); - -extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncLSBFirstFixedBase[32]) (CARD32 - *base, - unsigned - int - **glyphp, - int line, - int - nglyph, - int - width); - -extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncLSBFirst[32]) (CARD32 *base, - unsigned int - **glyphp, - int line, - int nglyph, - int width); - -extern _X_EXPORT GlyphScanlineFuncPtr - *XAAGetGlyphScanlineFuncMSBFirstFixedBase(void); -extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncMSBFirst(void); -extern _X_EXPORT GlyphScanlineFuncPtr - *XAAGetGlyphScanlineFuncLSBFirstFixedBase(void); -extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncLSBFirst(void); - -extern _X_EXPORT void - -XAAFillColorExpandRectsLSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandRects3LSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandRectsLSBFirstFixedBase(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandRects3LSBFirstFixedBase(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandRectsMSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandRects3MSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandRectsMSBFirstFixedBase(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandRects3MSBFirstFixedBase(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillScanlineColorExpandRectsLSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillScanlineColorExpandRects3LSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillScanlineColorExpandRectsMSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillScanlineColorExpandRects3MSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int nBox, - BoxPtr pBox, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandSpansLSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandSpans3LSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandSpansLSBFirstFixedBase(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandSpans3LSBFirstFixedBase(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandSpansMSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandSpans3MSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandSpansMSBFirstFixedBase(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillColorExpandSpans3MSBFirstFixedBase(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillScanlineColorExpandSpansLSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillScanlineColorExpandSpans3LSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAPutImage(DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, int y, int w, int h, int leftPad, int format, char *pImage); - -extern _X_EXPORT void - -XAAFillScanlineColorExpandSpansMSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillScanlineColorExpandSpans3MSBFirst(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, - int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncMSBFirstFixedBase[6]) (CARD32 - *base, - CARD32 - *src, - int - offset, - int - width, - int - dwords); - -extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncMSBFirst[6]) (CARD32 *base, - CARD32 *src, - int offset, - int width, - int dwords); - -extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncLSBFirstFixedBase[6]) (CARD32 - *base, - CARD32 - *src, - int - offset, - int - width, - int - dwords); - -extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncLSBFirst[6]) (CARD32 *base, - CARD32 *src, - int offset, - int width, - int dwords); - -extern _X_EXPORT StippleScanlineProcPtr - *XAAGetStippleScanlineFuncMSBFirstFixedBase(void); -extern _X_EXPORT StippleScanlineProcPtr - *XAAGetStippleScanlineFuncMSBFirst(void); -extern _X_EXPORT StippleScanlineProcPtr - *XAAGetStippleScanlineFuncLSBFirstFixedBase(void); -extern _X_EXPORT StippleScanlineProcPtr - *XAAGetStippleScanlineFuncLSBFirst(void); -extern _X_EXPORT StippleScanlineProcPtr - *XAAGetStippleScanlineFunc3MSBFirstFixedBase(void); -extern _X_EXPORT StippleScanlineProcPtr - *XAAGetStippleScanlineFunc3MSBFirst(void); -extern _X_EXPORT StippleScanlineProcPtr - *XAAGetStippleScanlineFunc3LSBFirstFixedBase(void); -extern _X_EXPORT StippleScanlineProcPtr - *XAAGetStippleScanlineFunc3LSBFirst(void); - -extern _X_EXPORT int - -XAAPolyText8TEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars); - -extern _X_EXPORT int - -XAAPolyText16TEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, unsigned short *chars); - -extern _X_EXPORT void - -XAAImageText8TEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars); - -extern _X_EXPORT void - -XAAImageText16TEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, unsigned short *chars); - -extern _X_EXPORT void - -XAAImageGlyphBltTEColorExpansion(DrawablePtr pDrawable, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); - -extern _X_EXPORT void - -XAAPolyGlyphBltTEColorExpansion(DrawablePtr pDrawable, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); - -extern _X_EXPORT int - -XAAPolyText8NonTEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, char *chars); - -extern _X_EXPORT int - -XAAPolyText16NonTEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, - int count, unsigned short *chars); - -extern _X_EXPORT void - -XAAImageText8NonTEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, int count, char *chars); - -extern _X_EXPORT void - -XAAImageText16NonTEColorExpansion(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, - int count, unsigned short *chars); - -extern _X_EXPORT void - -XAAImageGlyphBltNonTEColorExpansion(DrawablePtr pDrawable, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); - -extern _X_EXPORT void - -XAAPolyGlyphBltNonTEColorExpansion(DrawablePtr pDrawable, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); - -extern _X_EXPORT void XAANonTEGlyphRenderer(ScrnInfoPtr pScrn, - int x, int y, int n, - NonTEGlyphPtr glyphs, - BoxPtr pbox, - int fg, int rop, - unsigned int planemask); - -extern _X_EXPORT void - -XAAFillSolidSpans(ScrnInfoPtr pScrn, - int fg, int rop, - unsigned int planemask, - int n, DDXPointPtr ppt, int *pwidth, int fSorted); - -extern _X_EXPORT void - -XAAFillMono8x8PatternSpans(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, - int patx, int paty, int xorg, int yorg); - -extern _X_EXPORT void - -XAAFillMono8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, - int patx, int paty, int xorg, int yorg); - -extern _X_EXPORT void - -XAAFillColor8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, - XAACacheInfoPtr, - int xorigin, int yorigin); - -extern _X_EXPORT void - -XAAFillColor8x8PatternSpans(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, int fSorted, - XAACacheInfoPtr, int xorigin, int yorigin); - -extern _X_EXPORT void - -XAAFillCacheBltSpans(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int n, - DDXPointPtr points, - int *widths, - int fSorted, XAACacheInfoPtr pCache, int xorg, int yorg); - -extern _X_EXPORT void - -XAAFillCacheExpandSpans(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int n, - DDXPointPtr ppt, - int *pwidth, - int fSorted, int xorg, int yorg, PixmapPtr pPix); - -extern _X_EXPORT void - -XAAFillSpans(DrawablePtr pDrawable, - GC * pGC, - int nInit, DDXPointPtr pptInit, int *pwidth, int fSorted); - -extern _X_EXPORT void - XAAInitPixmapCache(ScreenPtr pScreen, RegionPtr areas, pointer data); - -extern _X_EXPORT void - -XAAWriteBitmapToCache(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, int srcwidth, int fg, int bg); - -extern _X_EXPORT void - -XAAWriteBitmapToCacheLinear(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, int srcwidth, int fg, int bg); - -extern _X_EXPORT void - -XAAWritePixmapToCache(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, int srcwidth, int bpp, int depth); - -extern _X_EXPORT void - -XAAWritePixmapToCacheLinear(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, int bpp, int depth); - -extern _X_EXPORT void - XAASolidHorVertLineAsRects(ScrnInfoPtr pScrn, int x, int y, int len, int dir); - -extern _X_EXPORT void - -XAASolidHorVertLineAsTwoPoint(ScrnInfoPtr pScrn, - int x, int y, int len, int dir); - -extern _X_EXPORT void - -XAASolidHorVertLineAsBresenham(ScrnInfoPtr pScrn, - int x, int y, int len, int dir); - -extern _X_EXPORT void - -XAAPolyRectangleThinSolid(DrawablePtr pDrawable, - GCPtr pGC, int nRectsInit, xRectangle *pRectsInit); - -extern _X_EXPORT void - -XAAPolylinesWideSolid(DrawablePtr pDrawable, - GCPtr pGC, int mode, int npt, DDXPointPtr pPts); - -extern _X_EXPORT void - -XAAFillPolygonSolid(DrawablePtr pDrawable, - GCPtr pGC, - int shape, int mode, int count, DDXPointPtr ptsIn); - -extern _X_EXPORT void - -XAAFillPolygonStippled(DrawablePtr pDrawable, - GCPtr pGC, - int shape, int mode, int count, DDXPointPtr ptsIn); - -extern _X_EXPORT void - -XAAFillPolygonTiled(DrawablePtr pDrawable, - GCPtr pGC, - int shape, int mode, int count, DDXPointPtr ptsIn); - -extern _X_EXPORT int - -XAAIsEasyPolygon(DDXPointPtr ptsIn, - int count, - BoxPtr extents, - int origin, - DDXPointPtr * topPoint, int *topY, int *bottomY, int shape); - -extern _X_EXPORT void - -XAAFillPolygonHelper(ScrnInfoPtr pScrn, - DDXPointPtr ptsIn, - int count, - DDXPointPtr topPoint, - int y, - int maxy, - int origin, - RectFuncPtr RectFunc, - TrapFuncPtr TrapFunc, - int xorg, int yorg, XAACacheInfoPtr pCache); - -extern _X_EXPORT void - XAAPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg); - -extern _X_EXPORT void - -XAAPolyLines(DrawablePtr pDrawable, - GCPtr pGC, int mode, int npt, DDXPointPtr pptInit); - -extern _X_EXPORT void - -XAAPolySegmentDashed(DrawablePtr pDrawable, - GCPtr pGC, int nseg, xSegment * pSeg); - -extern _X_EXPORT void - -XAAPolyLinesDashed(DrawablePtr pDrawable, - GCPtr pGC, int mode, int npt, DDXPointPtr pptInit); - -extern _X_EXPORT void - XAAWriteMono8x8PatternToCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache); - -extern _X_EXPORT void - -XAAWriteColor8x8PatternToCache(ScrnInfoPtr pScrn, - PixmapPtr pPix, XAACacheInfoPtr pCache); - -extern _X_EXPORT void - -XAARotateMonoPattern(int *pat0, int *pat1, - int xoffset, int yoffset, Bool msbfirst); - -extern _X_EXPORT void XAAComputeDash(GCPtr pGC); - -extern _X_EXPORT void XAAMoveDWORDS_FixedBase(register CARD32 *dest, - register CARD32 *src, - register int dwords); - -extern _X_EXPORT void XAAMoveDWORDS_FixedSrc(register CARD32 *dest, - register CARD32 *src, - register int dwords); - -extern _X_EXPORT void XAAMoveDWORDS(register CARD32 *dest, - register CARD32 *src, register int dwords); - -extern _X_EXPORT int - -XAAGetRectClipBoxes(GCPtr pGC, - BoxPtr pboxClippedBase, - int nrectFill, xRectangle *prectInit); - -extern _X_EXPORT void - XAASetupOverlay8_32Planar(ScreenPtr); - -extern _X_EXPORT void - XAAPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs); - -extern _X_EXPORT XAACacheInfoPtr XAACacheTile(ScrnInfoPtr Scrn, PixmapPtr pPix); - -extern _X_EXPORT XAACacheInfoPtr -XAACacheMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix); - -extern _X_EXPORT XAACacheInfoPtr -XAACachePlanarMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix); - -typedef XAACacheInfoPtr(*XAACachePlanarMonoStippleProc) (ScrnInfoPtr, - PixmapPtr); -extern _X_EXPORT XAACachePlanarMonoStippleProc -XAAGetCachePlanarMonoStipple(void); - -extern _X_EXPORT XAACacheInfoPtr -XAACacheStipple(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, int bg); - -extern _X_EXPORT XAACacheInfoPtr -XAACacheMono8x8Pattern(ScrnInfoPtr Scrn, int pat0, int pat1); - -extern _X_EXPORT XAACacheInfoPtr -XAACacheColor8x8Pattern(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, int bg); - -extern _X_EXPORT void - XAATileCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache, int w, int h); - -extern _X_EXPORT void XAAClosePixmapCache(ScreenPtr pScreen); -void XAAInvalidatePixmapCache(ScreenPtr pScreen); - -extern _X_EXPORT Bool XAACheckStippleReducibility(PixmapPtr pPixmap); -extern _X_EXPORT Bool XAACheckTileReducibility(PixmapPtr pPixmap, - Bool checkMono); - -extern _X_EXPORT int XAAStippledFillChooser(GCPtr pGC); -extern _X_EXPORT int XAAOpaqueStippledFillChooser(GCPtr pGC); -extern _X_EXPORT int XAATiledFillChooser(GCPtr pGC); - -extern _X_EXPORT void XAAMoveInOffscreenPixmaps(ScreenPtr pScreen); -extern _X_EXPORT void XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen); -extern _X_EXPORT void XAARemoveAreaCallback(FBAreaPtr area); -extern _X_EXPORT void XAAMoveOutOffscreenPixmap(PixmapPtr pPix); -extern _X_EXPORT Bool XAAInitStateWrap(ScreenPtr pScreen, - XAAInfoRecPtr infoRec); - -extern _X_EXPORT void - -XAAComposite(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); - -extern _X_EXPORT Bool - -XAADoComposite(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); - -extern _X_EXPORT void - -XAAGlyphs(CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, - INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs); - -extern _X_EXPORT Bool - -XAADoGlyphs(CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, - INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs); - -/* helpers */ -extern _X_EXPORT void - XAA_888_plus_PICT_a8_to_8888(CARD32 color, CARD8 *alphaPtr, /* in bytes */ - int alphaPitch, CARD32 *dstPtr, int dstPitch, /* in dwords */ - int width, int height); - -extern _X_EXPORT Bool - -XAAGetRGBAFromPixel(CARD32 pixel, - CARD16 *red, - CARD16 *green, CARD16 *blue, CARD16 *alpha, CARD32 format); - -extern _X_EXPORT Bool - -XAAGetPixelFromRGBA(CARD32 *pixel, - CARD16 red, - CARD16 green, CARD16 blue, CARD16 alpha, CARD32 format); - -/* XXX should be static */ -extern _X_EXPORT GCOps XAAFallbackOps; -extern _X_EXPORT GCOps *XAAGetFallbackOps(void); -extern _X_EXPORT GCFuncs XAAGCFuncs; -extern _X_EXPORT DevPrivateKey XAAGetScreenKey(void); -extern _X_EXPORT DevPrivateKey XAAGetGCKey(void); -extern _X_EXPORT DevPrivateKey XAAGetPixmapKey(void); - -extern _X_EXPORT unsigned int XAAShiftMasks[32]; - -extern _X_EXPORT unsigned int byte_expand3[256], byte_reversed_expand3[256]; - -extern _X_EXPORT CARD32 XAAReverseBitOrder(CARD32 data); - -#define GET_XAASCREENPTR_FROM_SCREEN(pScreen)\ - dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()) - -#define GET_XAASCREENPTR_FROM_GC(pGC)\ - dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()) - -#define GET_XAASCREENPTR_FROM_DRAWABLE(pDraw)\ - dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey()) - -#define GET_XAAINFORECPTR_FROM_SCREEN(pScreen)\ -((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->AccelInfoRec - -#define GET_XAAINFORECPTR_FROM_GC(pGC)\ -((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec - -#define GET_XAAINFORECPTR_FROM_DRAWABLE(pDraw)\ -((XAAScreenPtr)dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec - -#define GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn)\ -((XAAScreenPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec - -#define XAA_GET_PIXMAP_PRIVATE(pix)\ - (XAAPixmapPtr)dixLookupPrivate(&(pix)->devPrivates, XAAGetPixmapKey()) - -#define CHECK_RGB_EQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff)) - -#define CHECK_FG(pGC, flags) \ - (!(flags & RGB_EQUAL) || CHECK_RGB_EQUAL(pGC->fgPixel)) - -#define CHECK_BG(pGC, flags) \ - (!(flags & RGB_EQUAL) || CHECK_RGB_EQUAL(pGC->bgPixel)) - -#define CHECK_ROP(pGC, flags) \ - (!(flags & GXCOPY_ONLY) || (pGC->alu == GXcopy)) - -#define CHECK_ROPSRC(pGC, flags) \ - (!(flags & ROP_NEEDS_SOURCE) || ((pGC->alu != GXclear) && \ - (pGC->alu != GXnoop) && (pGC->alu != GXinvert) && \ - (pGC->alu != GXset))) - -#define CHECK_PLANEMASK(pGC, flags) \ - (!(flags & NO_PLANEMASK) || \ - ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) == \ - infoRec->FullPlanemasks[pGC->depth - 1])) - -#define CHECK_COLORS(pGC, flags) \ - (!(flags & RGB_EQUAL) || \ - (CHECK_RGB_EQUAL(pGC->fgPixel) && CHECK_RGB_EQUAL(pGC->bgPixel))) - -#define CHECK_NO_GXCOPY(pGC, flags) \ - ((pGC->alu != GXcopy) || !(flags & NO_GXCOPY) || \ - ((pGC->planemask & infoRec->FullPlanemask) != infoRec->FullPlanemask)) - -#define IS_OFFSCREEN_PIXMAP(pPix)\ - ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->offscreenArea) - -#define PIXMAP_IS_SHARED(pPix)\ - ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags & SHARED_PIXMAP) - -#define OFFSCREEN_PIXMAP_LOCKED(pPix)\ - ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags & LOCKED_PIXMAP) - -#define XAA_DEPTH_BUG(pGC) \ - ((pGC->depth == 32) && (pGC->bgPixel == 0xffffffff)) - -#define DELIST_OFFSCREEN_PIXMAP(pPix) { \ - PixmapLinkPtr _pLink, _prev; \ - _pLink = infoRec->OffscreenPixmaps; \ - _prev = NULL; \ - while(_pLink) { \ - if(_pLink->pPix == pPix) { \ - if(_prev) _prev->next = _pLink->next; \ - else infoRec->OffscreenPixmaps = _pLink->next; \ - free(_pLink); \ - break; \ - } \ - _prev = _pLink; \ - _pLink = _pLink->next; \ - }} - -#define SWAP_BITS_IN_BYTES(v) \ - (((0x01010101 & (v)) << 7) | ((0x02020202 & (v)) << 5) | \ - ((0x04040404 & (v)) << 3) | ((0x08080808 & (v)) << 1) | \ - ((0x10101010 & (v)) >> 1) | ((0x20202020 & (v)) >> 3) | \ - ((0x40404040 & (v)) >> 5) | ((0x80808080 & (v)) >> 7)) - -/* - * Moved XAAPixmapCachePrivate here from xaaPCache.c, since driver - * replacements for CacheMonoStipple need access to it - */ - -typedef struct { - int Num512x512; - int Current512; - XAACacheInfoPtr Info512; - int Num256x256; - int Current256; - XAACacheInfoPtr Info256; - int Num128x128; - int Current128; - XAACacheInfoPtr Info128; - int NumMono; - int CurrentMono; - XAACacheInfoPtr InfoMono; - int NumColor; - int CurrentColor; - XAACacheInfoPtr InfoColor; - int NumPartial; - int CurrentPartial; - XAACacheInfoPtr InfoPartial; - DDXPointRec MonoOffsets[64]; - DDXPointRec ColorOffsets[64]; -} XAAPixmapCachePrivate, *XAAPixmapCachePrivatePtr; - -#endif /* _XAALOCAL_H */ diff --git a/xserver/hw/xfree86/xaa/xaawrap.h b/xserver/hw/xfree86/xaa/xaawrap.h deleted file mode 100644 index 2d2d7881a..000000000 --- a/xserver/hw/xfree86/xaa/xaawrap.h +++ /dev/null @@ -1,75 +0,0 @@ - -#define XAA_SCREEN_PROLOGUE(pScreen, field)\ - ((pScreen)->field = \ - ((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field) - -#define XAA_SCREEN_EPILOGUE(pScreen, field, wrapper)\ - ((pScreen)->field = wrapper) - -#define XAA_GC_FUNC_PROLOGUE(pGC)\ - XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \ - (pGC)->funcs = pGCPriv->wrapFuncs;\ - if(pGCPriv->flags)\ - (pGC)->ops = pGCPriv->wrapOps - -#define XAA_GC_FUNC_EPILOGUE(pGC)\ - pGCPriv->wrapFuncs = (pGC)->funcs;\ - (pGC)->funcs = &XAAGCFuncs;\ - if(pGCPriv->flags) {\ - pGCPriv->wrapOps = (pGC)->ops;\ - (pGC)->ops = (pGCPriv->flags & OPS_ARE_ACCEL) ? pGCPriv->XAAOps :\ - &XAAPixmapOps;\ - } - -#define XAA_GC_OP_PROLOGUE(pGC)\ - XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \ - GCFuncs *oldFuncs = pGC->funcs;\ - pGC->funcs = pGCPriv->wrapFuncs;\ - pGC->ops = pGCPriv->wrapOps - -#define XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC)\ - XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \ - GCFuncs *oldFuncs = pGC->funcs;\ - if(!RegionNumRects(pGC->pCompositeClip)) return; \ - pGC->funcs = pGCPriv->wrapFuncs;\ - pGC->ops = pGCPriv->wrapOps - -#define XAA_GC_OP_EPILOGUE(pGC)\ - pGCPriv->wrapOps = pGC->ops;\ - pGC->funcs = oldFuncs;\ - pGC->ops = pGCPriv->XAAOps - -#define XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw)\ - XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \ - XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDraw));\ - GCFuncs *oldFuncs = pGC->funcs;\ - pGC->funcs = pGCPriv->wrapFuncs;\ - pGC->ops = pGCPriv->wrapOps; \ - SYNC_CHECK(pGC) - -#define XAA_PIXMAP_OP_EPILOGUE(pGC)\ - pGCPriv->wrapOps = pGC->ops;\ - pGC->funcs = oldFuncs;\ - pGC->ops = &XAAPixmapOps;\ - pixPriv->flags |= DIRTY - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#define XAA_RENDER_PROLOGUE(pScreen,field)\ - (GetPictureScreen(pScreen)->field = \ - ((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field) - -#define XAA_RENDER_EPILOGUE(pScreen, field, wrapper)\ - (GetPictureScreen(pScreen)->field = wrapper) - -/* This also works fine for drawables */ - -#define SYNC_CHECK(pGC) {\ - XAAInfoRecPtr infoRec =\ -((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec; \ - if(infoRec->NeedToSync) {\ - (*infoRec->Sync)(infoRec->pScrn);\ - infoRec->NeedToSync = FALSE;\ - }} |