diff options
Diffstat (limited to 'src')
80 files changed, 4337 insertions, 1581 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 3b28ece..7e6af9c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -41,6 +41,11 @@ if ATIMISC_DGA ATIMISC_DGA_SOURCES = atidga.c endif +if USE_EXA +ATIMISC_EXA_SOURCES = atimach64exa.c +RADEON_EXA_SOURCES = radeon_exa.c +endif + AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ ati_drv_la_LTLIBRARIES = ati_drv.la @@ -61,7 +66,7 @@ atimisc_drv_la_SOURCES = \ atimach64i2c.c atimach64io.c atimach64xv.c atimode.c atipreinit.c \ atiprint.c atirgb514.c atiscreen.c atituner.c atiutil.c ativalid.c \ atixv.c atiload.c atimisc.c $(ATIMISC_DRI_SRCS) $(ATIMISC_DGA_SOURCES) \ - $(ATIMISC_CPIO_SOURCES) + $(ATIMISC_CPIO_SOURCES) $(ATIMISC_EXA_SOURCES) r128_drv_la_LTLIBRARIES = r128_drv.la r128_drv_la_LDFLAGS = -module -avoid-version @@ -76,7 +81,7 @@ radeon_drv_ladir = @moduledir@/drivers radeon_drv_la_SOURCES = \ radeon_accel.c radeon_mergedfb.c radeon_cursor.c radeon_dga.c \ radeon_driver.c radeon_video.c radeon_bios.c radeon_mm_i2c.c \ - radeon_vip.c radeon_misc.c radeon_exa.c $(RADEON_DRI_SRCS) + radeon_vip.c radeon_misc.c $(RADEON_DRI_SRCS) $(RADEON_EXA_SOURCES) theatre_detect_drv_la_LTLIBRARIES = theatre_detect_drv.la theatre_detect_drv_la_LDFLAGS = -module -avoid-version @@ -133,12 +138,12 @@ EXTRA_DIST = \ atimach64.h \ atimach64i2c.h \ atimach64io.h \ + atimach64render.c \ atimach64xv.h \ atimode.h \ atimodule.h \ atimono.h \ atioption.h \ - atipciids.h \ atipreinit.h \ atiprint.h \ atipriv.h \ @@ -188,4 +193,5 @@ EXTRA_DIST = \ theatre200.h \ theatre_detect.h \ theatre.h \ - theatre_reg.h + theatre_reg.h \ + atipciids.h diff --git a/src/Makefile.in b/src/Makefile.in index 9e40c58..03703d1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -48,7 +48,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -62,7 +61,127 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +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 = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(ati_drv_ladir)" \ + "$(DESTDIR)$(atimisc_drv_ladir)" "$(DESTDIR)$(r128_drv_ladir)" \ + "$(DESTDIR)$(radeon_drv_ladir)" \ + "$(DESTDIR)$(theatre200_drv_ladir)" \ + "$(DESTDIR)$(theatre_detect_drv_ladir)" \ + "$(DESTDIR)$(theatre_drv_ladir)" +ati_drv_laLTLIBRARIES_INSTALL = $(INSTALL) +atimisc_drv_laLTLIBRARIES_INSTALL = $(INSTALL) +r128_drv_laLTLIBRARIES_INSTALL = $(INSTALL) +radeon_drv_laLTLIBRARIES_INSTALL = $(INSTALL) +theatre200_drv_laLTLIBRARIES_INSTALL = $(INSTALL) +theatre_detect_drv_laLTLIBRARIES_INSTALL = $(INSTALL) +theatre_drv_laLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(ati_drv_la_LTLIBRARIES) $(atimisc_drv_la_LTLIBRARIES) \ + $(r128_drv_la_LTLIBRARIES) $(radeon_drv_la_LTLIBRARIES) \ + $(theatre200_drv_la_LTLIBRARIES) \ + $(theatre_detect_drv_la_LTLIBRARIES) \ + $(theatre_drv_la_LTLIBRARIES) +ati_drv_la_LIBADD = +am__ati_drv_la_SOURCES_DIST = ati.c atiadapter.c atibus.c atichip.c \ + atiident.c atioption.c atiprobe.c atividmem.c atimodule.c \ + ativgaio.c radeon_probe.c r128_probe.c +@ATIMISC_CPIO_TRUE@am__objects_1 = ativgaio.lo +am_ati_drv_la_OBJECTS = ati.lo atiadapter.lo atibus.lo atichip.lo \ + atiident.lo atioption.lo atiprobe.lo atividmem.lo atimodule.lo \ + $(am__objects_1) radeon_probe.lo r128_probe.lo +ati_drv_la_OBJECTS = $(am_ati_drv_la_OBJECTS) +atimisc_drv_la_LIBADD = +am__atimisc_drv_la_SOURCES_DIST = atiaccel.c atiadjust.c atiaudio.c \ + aticlock.c aticonfig.c aticonsole.c aticursor.c atidac.c \ + atidecoder.c atidsp.c atifillin.c atii2c.c atilock.c \ + atimach64.c atimach64accel.c atimach64cursor.c atimach64i2c.c \ + atimach64io.c atimach64xv.c atimode.c atipreinit.c atiprint.c \ + atirgb514.c atiscreen.c atituner.c atiutil.c ativalid.c \ + atixv.c atiload.c atimisc.c atidri.c atidga.c ativga.c \ + atibank.c atiwonder.c atiwonderio.c atimach64exa.c +@DRI_TRUE@am__objects_2 = atidri.lo +@ATIMISC_DGA_TRUE@am__objects_3 = atidga.lo +@ATIMISC_CPIO_TRUE@am__objects_4 = ativga.lo atibank.lo atiwonder.lo \ +@ATIMISC_CPIO_TRUE@ atiwonderio.lo +@USE_EXA_TRUE@am__objects_5 = atimach64exa.lo +am_atimisc_drv_la_OBJECTS = atiaccel.lo atiadjust.lo atiaudio.lo \ + aticlock.lo aticonfig.lo aticonsole.lo aticursor.lo atidac.lo \ + atidecoder.lo atidsp.lo atifillin.lo atii2c.lo atilock.lo \ + atimach64.lo atimach64accel.lo atimach64cursor.lo \ + atimach64i2c.lo atimach64io.lo atimach64xv.lo atimode.lo \ + atipreinit.lo atiprint.lo atirgb514.lo atiscreen.lo \ + atituner.lo atiutil.lo ativalid.lo atixv.lo atiload.lo \ + atimisc.lo $(am__objects_2) $(am__objects_3) $(am__objects_4) \ + $(am__objects_5) +atimisc_drv_la_OBJECTS = $(am_atimisc_drv_la_OBJECTS) +r128_drv_la_LIBADD = +am__r128_drv_la_SOURCES_DIST = r128_accel.c r128_cursor.c r128_dga.c \ + r128_driver.c r128_video.c r128_misc.c r128_dri.c +@DRI_TRUE@am__objects_6 = r128_dri.lo +am_r128_drv_la_OBJECTS = r128_accel.lo r128_cursor.lo r128_dga.lo \ + r128_driver.lo r128_video.lo r128_misc.lo $(am__objects_6) +r128_drv_la_OBJECTS = $(am_r128_drv_la_OBJECTS) +radeon_drv_la_LIBADD = +am__radeon_drv_la_SOURCES_DIST = radeon_accel.c radeon_mergedfb.c \ + radeon_cursor.c radeon_dga.c radeon_driver.c radeon_video.c \ + radeon_bios.c radeon_mm_i2c.c radeon_vip.c radeon_misc.c \ + radeon_dri.c radeon_exa.c +@DRI_TRUE@am__objects_7 = radeon_dri.lo +@USE_EXA_TRUE@am__objects_8 = radeon_exa.lo +am_radeon_drv_la_OBJECTS = radeon_accel.lo radeon_mergedfb.lo \ + radeon_cursor.lo radeon_dga.lo radeon_driver.lo \ + radeon_video.lo radeon_bios.lo radeon_mm_i2c.lo radeon_vip.lo \ + radeon_misc.lo $(am__objects_7) $(am__objects_8) +radeon_drv_la_OBJECTS = $(am_radeon_drv_la_OBJECTS) +theatre200_drv_la_LIBADD = +am_theatre200_drv_la_OBJECTS = theatre200_drv_la-theatre200.lo \ + theatre200_drv_la-theatre200_module.lo +theatre200_drv_la_OBJECTS = $(am_theatre200_drv_la_OBJECTS) +theatre_detect_drv_la_LIBADD = +am_theatre_detect_drv_la_OBJECTS = theatre_detect.lo \ + theatre_detect_module.lo +theatre_detect_drv_la_OBJECTS = $(am_theatre_detect_drv_la_OBJECTS) +theatre_drv_la_LIBADD = +am_theatre_drv_la_OBJECTS = theatre.lo theatre_module.lo +theatre_drv_la_OBJECTS = $(am_theatre_drv_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(ati_drv_la_SOURCES) $(atimisc_drv_la_SOURCES) \ + $(r128_drv_la_SOURCES) $(radeon_drv_la_SOURCES) \ + $(theatre200_drv_la_SOURCES) $(theatre_detect_drv_la_SOURCES) \ + $(theatre_drv_la_SOURCES) +DIST_SOURCES = $(am__ati_drv_la_SOURCES_DIST) \ + $(am__atimisc_drv_la_SOURCES_DIST) \ + $(am__r128_drv_la_SOURCES_DIST) \ + $(am__radeon_drv_la_SOURCES_DIST) $(theatre200_drv_la_SOURCES) \ + $(theatre_detect_drv_la_SOURCES) $(theatre_drv_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ @@ -154,6 +273,8 @@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +USE_EXA_FALSE = @USE_EXA_FALSE@ +USE_EXA_TRUE = @USE_EXA_TRUE@ VERSION = @VERSION@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ @@ -171,6 +292,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -191,6 +314,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ prefix = @prefix@ @@ -199,18 +323,15 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - @DRI_TRUE@ATIMISC_DRI_SRCS = atidri.c @DRI_TRUE@R128_DRI_SRCS = r128_dri.c @DRI_TRUE@RADEON_DRI_SRCS = radeon_dri.c - @ATIMISC_CPIO_TRUE@ATI_CPIO_SOURCES = ativgaio.c @ATIMISC_CPIO_TRUE@ATIMISC_CPIO_SOURCES = ativga.c atibank.c atiwonder.c atiwonderio.c - @ATIMISC_DGA_TRUE@ATIMISC_DGA_SOURCES = atidga.c - +@USE_EXA_TRUE@ATIMISC_EXA_SOURCES = atimach64exa.c +@USE_EXA_TRUE@RADEON_EXA_SOURCES = radeon_exa.c AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ - ati_drv_la_LTLIBRARIES = ati_drv.la ati_drv_la_LDFLAGS = -module -avoid-version ati_drv_ladir = @moduledir@/drivers @@ -219,7 +340,6 @@ ati_drv_la_SOURCES = \ atiprobe.c atividmem.c atimodule.c $(ATI_CPIO_SOURCES) \ radeon_probe.c r128_probe.c - atimisc_drv_la_LTLIBRARIES = atimisc_drv.la atimisc_drv_la_LDFLAGS = -module -avoid-version atimisc_drv_ladir = @moduledir@/drivers @@ -230,8 +350,7 @@ atimisc_drv_la_SOURCES = \ atimach64i2c.c atimach64io.c atimach64xv.c atimode.c atipreinit.c \ atiprint.c atirgb514.c atiscreen.c atituner.c atiutil.c ativalid.c \ atixv.c atiload.c atimisc.c $(ATIMISC_DRI_SRCS) $(ATIMISC_DGA_SOURCES) \ - $(ATIMISC_CPIO_SOURCES) - + $(ATIMISC_CPIO_SOURCES) $(ATIMISC_EXA_SOURCES) r128_drv_la_LTLIBRARIES = r128_drv.la r128_drv_la_LDFLAGS = -module -avoid-version @@ -240,15 +359,13 @@ r128_drv_la_SOURCES = \ r128_accel.c r128_cursor.c r128_dga.c r128_driver.c \ r128_video.c r128_misc.c $(R128_DRI_SRCS) - radeon_drv_la_LTLIBRARIES = radeon_drv.la radeon_drv_la_LDFLAGS = -module -avoid-version radeon_drv_ladir = @moduledir@/drivers radeon_drv_la_SOURCES = \ radeon_accel.c radeon_mergedfb.c radeon_cursor.c radeon_dga.c \ radeon_driver.c radeon_video.c radeon_bios.c radeon_mm_i2c.c \ - radeon_vip.c radeon_misc.c radeon_exa.c $(RADEON_DRI_SRCS) - + radeon_vip.c radeon_misc.c $(RADEON_DRI_SRCS) $(RADEON_EXA_SOURCES) theatre_detect_drv_la_LTLIBRARIES = theatre_detect_drv.la theatre_detect_drv_la_LDFLAGS = -module -avoid-version @@ -256,15 +373,12 @@ theatre_detect_drv_ladir = @moduledir@/multimedia theatre_detect_drv_la_SOURCES = \ theatre_detect.c theatre_detect_module.c - theatre_drv_la_LTLIBRARIES = theatre_drv.la theatre_drv_la_LDFLAGS = -module -avoid-version theatre_drv_ladir = @moduledir@/multimedia - theatre_drv_la_SOURCES = \ theatre.c theatre_module.c - theatre200_drv_la_LTLIBRARIES = theatre200_drv.la theatre200_drv_la_LDFLAGS = -module -avoid-version theatre200_drv_ladir = @moduledir@/multimedia @@ -274,7 +388,6 @@ theatre200_drv_la_CFLAGS = \ theatre200_drv_la_SOURCES = \ theatre200.c theatre200_module.c - EXTRA_DIST = \ radeon_render.c \ radeon_accelfuncs.c \ @@ -309,12 +422,12 @@ EXTRA_DIST = \ atimach64.h \ atimach64i2c.h \ atimach64io.h \ + atimach64render.c \ atimach64xv.h \ atimode.h \ atimodule.h \ atimono.h \ atioption.h \ - atipciids.h \ atipreinit.h \ atiprint.h \ atipriv.h \ @@ -364,352 +477,228 @@ EXTRA_DIST = \ theatre200.h \ theatre_detect.h \ theatre.h \ - theatre_reg.h - -subdir = src -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(ati_drv_la_LTLIBRARIES) $(atimisc_drv_la_LTLIBRARIES) \ - $(r128_drv_la_LTLIBRARIES) $(radeon_drv_la_LTLIBRARIES) \ - $(theatre200_drv_la_LTLIBRARIES) \ - $(theatre_detect_drv_la_LTLIBRARIES) \ - $(theatre_drv_la_LTLIBRARIES) - -ati_drv_la_LIBADD = -am__ati_drv_la_SOURCES_DIST = ati.c atiadapter.c atibus.c atichip.c \ - atiident.c atioption.c atiprobe.c atividmem.c atimodule.c \ - ativgaio.c radeon_probe.c r128_probe.c -@ATIMISC_CPIO_TRUE@am__objects_1 = ativgaio.lo -am_ati_drv_la_OBJECTS = ati.lo atiadapter.lo atibus.lo atichip.lo \ - atiident.lo atioption.lo atiprobe.lo atividmem.lo atimodule.lo \ - $(am__objects_1) radeon_probe.lo r128_probe.lo -ati_drv_la_OBJECTS = $(am_ati_drv_la_OBJECTS) -atimisc_drv_la_LIBADD = -am__atimisc_drv_la_SOURCES_DIST = atiaccel.c atiadjust.c atiaudio.c \ - aticlock.c aticonfig.c aticonsole.c aticursor.c atidac.c \ - atidecoder.c atidsp.c atifillin.c atii2c.c atilock.c \ - atimach64.c atimach64accel.c atimach64cursor.c atimach64i2c.c \ - atimach64io.c atimach64xv.c atimode.c atipreinit.c atiprint.c \ - atirgb514.c atiscreen.c atituner.c atiutil.c ativalid.c atixv.c \ - atiload.c atimisc.c atidri.c atidga.c ativga.c atibank.c \ - atiwonder.c atiwonderio.c -@DRI_TRUE@am__objects_2 = atidri.lo -@ATIMISC_DGA_TRUE@am__objects_3 = atidga.lo -@ATIMISC_CPIO_TRUE@am__objects_4 = ativga.lo atibank.lo atiwonder.lo \ -@ATIMISC_CPIO_TRUE@ atiwonderio.lo -am_atimisc_drv_la_OBJECTS = atiaccel.lo atiadjust.lo atiaudio.lo \ - aticlock.lo aticonfig.lo aticonsole.lo aticursor.lo atidac.lo \ - atidecoder.lo atidsp.lo atifillin.lo atii2c.lo atilock.lo \ - atimach64.lo atimach64accel.lo atimach64cursor.lo \ - atimach64i2c.lo atimach64io.lo atimach64xv.lo atimode.lo \ - atipreinit.lo atiprint.lo atirgb514.lo atiscreen.lo atituner.lo \ - atiutil.lo ativalid.lo atixv.lo atiload.lo atimisc.lo \ - $(am__objects_2) $(am__objects_3) $(am__objects_4) -atimisc_drv_la_OBJECTS = $(am_atimisc_drv_la_OBJECTS) -r128_drv_la_LIBADD = -am__r128_drv_la_SOURCES_DIST = r128_accel.c r128_cursor.c r128_dga.c \ - r128_driver.c r128_video.c r128_misc.c r128_dri.c -@DRI_TRUE@am__objects_5 = r128_dri.lo -am_r128_drv_la_OBJECTS = r128_accel.lo r128_cursor.lo r128_dga.lo \ - r128_driver.lo r128_video.lo r128_misc.lo $(am__objects_5) -r128_drv_la_OBJECTS = $(am_r128_drv_la_OBJECTS) -radeon_drv_la_LIBADD = -am__radeon_drv_la_SOURCES_DIST = radeon_accel.c radeon_mergedfb.c \ - radeon_cursor.c radeon_dga.c radeon_driver.c radeon_video.c \ - radeon_bios.c radeon_mm_i2c.c radeon_vip.c radeon_misc.c \ - radeon_exa.c radeon_dri.c -@DRI_TRUE@am__objects_6 = radeon_dri.lo -am_radeon_drv_la_OBJECTS = radeon_accel.lo radeon_mergedfb.lo \ - radeon_cursor.lo radeon_dga.lo radeon_driver.lo radeon_video.lo \ - radeon_bios.lo radeon_mm_i2c.lo radeon_vip.lo radeon_misc.lo \ - radeon_exa.lo $(am__objects_6) -radeon_drv_la_OBJECTS = $(am_radeon_drv_la_OBJECTS) -theatre200_drv_la_LIBADD = -am_theatre200_drv_la_OBJECTS = theatre200_drv_la-theatre200.lo \ - theatre200_drv_la-theatre200_module.lo -theatre200_drv_la_OBJECTS = $(am_theatre200_drv_la_OBJECTS) -theatre_detect_drv_la_LIBADD = -am_theatre_detect_drv_la_OBJECTS = theatre_detect.lo \ - theatre_detect_module.lo -theatre_detect_drv_la_OBJECTS = $(am_theatre_detect_drv_la_OBJECTS) -theatre_drv_la_LIBADD = -am_theatre_drv_la_OBJECTS = theatre.lo theatre_module.lo -theatre_drv_la_OBJECTS = $(am_theatre_drv_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ati.Plo ./$(DEPDIR)/atiaccel.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atiadapter.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atiadjust.Plo ./$(DEPDIR)/atiaudio.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atibank.Plo ./$(DEPDIR)/atibus.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atichip.Plo ./$(DEPDIR)/aticlock.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/aticonfig.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/aticonsole.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/aticursor.Plo ./$(DEPDIR)/atidac.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atidecoder.Plo ./$(DEPDIR)/atidga.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atidri.Plo ./$(DEPDIR)/atidsp.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atifillin.Plo ./$(DEPDIR)/atii2c.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atiident.Plo ./$(DEPDIR)/atiload.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atilock.Plo ./$(DEPDIR)/atimach64.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atimach64accel.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atimach64cursor.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atimach64i2c.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atimach64io.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atimach64xv.Plo ./$(DEPDIR)/atimisc.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atimode.Plo ./$(DEPDIR)/atimodule.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atioption.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atipreinit.Plo ./$(DEPDIR)/atiprint.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atiprobe.Plo ./$(DEPDIR)/atirgb514.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atiscreen.Plo ./$(DEPDIR)/atituner.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atiutil.Plo ./$(DEPDIR)/ativalid.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/ativga.Plo ./$(DEPDIR)/ativgaio.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atividmem.Plo ./$(DEPDIR)/atiwonder.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/atiwonderio.Plo ./$(DEPDIR)/atixv.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/r128_accel.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/r128_cursor.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/r128_dga.Plo ./$(DEPDIR)/r128_dri.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/r128_driver.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/r128_misc.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/r128_probe.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/r128_video.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_accel.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_bios.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_cursor.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_dga.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_dri.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_driver.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_exa.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_mergedfb.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_misc.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_mm_i2c.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_probe.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_video.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/radeon_vip.Plo ./$(DEPDIR)/theatre.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/theatre200_drv_la-theatre200.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/theatre200_drv_la-theatre200_module.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/theatre_detect.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/theatre_detect_module.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/theatre_module.Plo -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(am__ati_drv_la_SOURCES_DIST) \ - $(am__atimisc_drv_la_SOURCES_DIST) \ - $(am__r128_drv_la_SOURCES_DIST) \ - $(am__radeon_drv_la_SOURCES_DIST) $(theatre200_drv_la_SOURCES) \ - $(theatre_detect_drv_la_SOURCES) $(theatre_drv_la_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(ati_drv_la_SOURCES) $(atimisc_drv_la_SOURCES) $(r128_drv_la_SOURCES) $(radeon_drv_la_SOURCES) $(theatre200_drv_la_SOURCES) $(theatre_detect_drv_la_SOURCES) $(theatre_drv_la_SOURCES) + theatre_reg.h \ + atipciids.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -ati_drv_laLTLIBRARIES_INSTALL = $(INSTALL) +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-ati_drv_laLTLIBRARIES: $(ati_drv_la_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(ati_drv_ladir) + test -z "$(ati_drv_ladir)" || $(mkdir_p) "$(DESTDIR)$(ati_drv_ladir)" @list='$(ati_drv_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(ati_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(ati_drv_ladir)/$$f"; \ - $(LIBTOOL) --mode=install $(ati_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(ati_drv_ladir)/$$f; \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(ati_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(ati_drv_ladir)/$$f'"; \ + $(LIBTOOL) --mode=install $(ati_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(ati_drv_ladir)/$$f"; \ else :; fi; \ done uninstall-ati_drv_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(ati_drv_la_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(ati_drv_ladir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(ati_drv_ladir)/$$p; \ + @set -x; list='$(ati_drv_la_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(ati_drv_ladir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(ati_drv_ladir)/$$p"; \ done clean-ati_drv_laLTLIBRARIES: -test -z "$(ati_drv_la_LTLIBRARIES)" || rm -f $(ati_drv_la_LTLIBRARIES) @list='$(ati_drv_la_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ + test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -atimisc_drv_laLTLIBRARIES_INSTALL = $(INSTALL) install-atimisc_drv_laLTLIBRARIES: $(atimisc_drv_la_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(atimisc_drv_ladir) + test -z "$(atimisc_drv_ladir)" || $(mkdir_p) "$(DESTDIR)$(atimisc_drv_ladir)" @list='$(atimisc_drv_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(atimisc_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(atimisc_drv_ladir)/$$f"; \ - $(LIBTOOL) --mode=install $(atimisc_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(atimisc_drv_ladir)/$$f; \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(atimisc_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(atimisc_drv_ladir)/$$f'"; \ + $(LIBTOOL) --mode=install $(atimisc_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(atimisc_drv_ladir)/$$f"; \ else :; fi; \ done uninstall-atimisc_drv_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(atimisc_drv_la_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(atimisc_drv_ladir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(atimisc_drv_ladir)/$$p; \ + @set -x; list='$(atimisc_drv_la_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(atimisc_drv_ladir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(atimisc_drv_ladir)/$$p"; \ done clean-atimisc_drv_laLTLIBRARIES: -test -z "$(atimisc_drv_la_LTLIBRARIES)" || rm -f $(atimisc_drv_la_LTLIBRARIES) @list='$(atimisc_drv_la_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ + test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -r128_drv_laLTLIBRARIES_INSTALL = $(INSTALL) install-r128_drv_laLTLIBRARIES: $(r128_drv_la_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(r128_drv_ladir) + test -z "$(r128_drv_ladir)" || $(mkdir_p) "$(DESTDIR)$(r128_drv_ladir)" @list='$(r128_drv_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(r128_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(r128_drv_ladir)/$$f"; \ - $(LIBTOOL) --mode=install $(r128_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(r128_drv_ladir)/$$f; \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(r128_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(r128_drv_ladir)/$$f'"; \ + $(LIBTOOL) --mode=install $(r128_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(r128_drv_ladir)/$$f"; \ else :; fi; \ done uninstall-r128_drv_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(r128_drv_la_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(r128_drv_ladir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(r128_drv_ladir)/$$p; \ + @set -x; list='$(r128_drv_la_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(r128_drv_ladir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(r128_drv_ladir)/$$p"; \ done clean-r128_drv_laLTLIBRARIES: -test -z "$(r128_drv_la_LTLIBRARIES)" || rm -f $(r128_drv_la_LTLIBRARIES) @list='$(r128_drv_la_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ + test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -radeon_drv_laLTLIBRARIES_INSTALL = $(INSTALL) install-radeon_drv_laLTLIBRARIES: $(radeon_drv_la_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(radeon_drv_ladir) + test -z "$(radeon_drv_ladir)" || $(mkdir_p) "$(DESTDIR)$(radeon_drv_ladir)" @list='$(radeon_drv_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(radeon_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(radeon_drv_ladir)/$$f"; \ - $(LIBTOOL) --mode=install $(radeon_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(radeon_drv_ladir)/$$f; \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(radeon_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(radeon_drv_ladir)/$$f'"; \ + $(LIBTOOL) --mode=install $(radeon_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(radeon_drv_ladir)/$$f"; \ else :; fi; \ done uninstall-radeon_drv_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(radeon_drv_la_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(radeon_drv_ladir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(radeon_drv_ladir)/$$p; \ + @set -x; list='$(radeon_drv_la_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(radeon_drv_ladir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(radeon_drv_ladir)/$$p"; \ done clean-radeon_drv_laLTLIBRARIES: -test -z "$(radeon_drv_la_LTLIBRARIES)" || rm -f $(radeon_drv_la_LTLIBRARIES) @list='$(radeon_drv_la_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ + test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -theatre200_drv_laLTLIBRARIES_INSTALL = $(INSTALL) install-theatre200_drv_laLTLIBRARIES: $(theatre200_drv_la_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(theatre200_drv_ladir) + test -z "$(theatre200_drv_ladir)" || $(mkdir_p) "$(DESTDIR)$(theatre200_drv_ladir)" @list='$(theatre200_drv_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(theatre200_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(theatre200_drv_ladir)/$$f"; \ - $(LIBTOOL) --mode=install $(theatre200_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(theatre200_drv_ladir)/$$f; \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(theatre200_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(theatre200_drv_ladir)/$$f'"; \ + $(LIBTOOL) --mode=install $(theatre200_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(theatre200_drv_ladir)/$$f"; \ else :; fi; \ done uninstall-theatre200_drv_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(theatre200_drv_la_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(theatre200_drv_ladir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(theatre200_drv_ladir)/$$p; \ + @set -x; list='$(theatre200_drv_la_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(theatre200_drv_ladir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(theatre200_drv_ladir)/$$p"; \ done clean-theatre200_drv_laLTLIBRARIES: -test -z "$(theatre200_drv_la_LTLIBRARIES)" || rm -f $(theatre200_drv_la_LTLIBRARIES) @list='$(theatre200_drv_la_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ + test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -theatre_detect_drv_laLTLIBRARIES_INSTALL = $(INSTALL) install-theatre_detect_drv_laLTLIBRARIES: $(theatre_detect_drv_la_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(theatre_detect_drv_ladir) + test -z "$(theatre_detect_drv_ladir)" || $(mkdir_p) "$(DESTDIR)$(theatre_detect_drv_ladir)" @list='$(theatre_detect_drv_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(theatre_detect_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(theatre_detect_drv_ladir)/$$f"; \ - $(LIBTOOL) --mode=install $(theatre_detect_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(theatre_detect_drv_ladir)/$$f; \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(theatre_detect_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(theatre_detect_drv_ladir)/$$f'"; \ + $(LIBTOOL) --mode=install $(theatre_detect_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(theatre_detect_drv_ladir)/$$f"; \ else :; fi; \ done uninstall-theatre_detect_drv_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(theatre_detect_drv_la_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(theatre_detect_drv_ladir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(theatre_detect_drv_ladir)/$$p; \ + @set -x; list='$(theatre_detect_drv_la_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(theatre_detect_drv_ladir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(theatre_detect_drv_ladir)/$$p"; \ done clean-theatre_detect_drv_laLTLIBRARIES: -test -z "$(theatre_detect_drv_la_LTLIBRARIES)" || rm -f $(theatre_detect_drv_la_LTLIBRARIES) @list='$(theatre_detect_drv_la_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ + test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -theatre_drv_laLTLIBRARIES_INSTALL = $(INSTALL) install-theatre_drv_laLTLIBRARIES: $(theatre_drv_la_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(theatre_drv_ladir) + test -z "$(theatre_drv_ladir)" || $(mkdir_p) "$(DESTDIR)$(theatre_drv_ladir)" @list='$(theatre_drv_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(theatre_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(theatre_drv_ladir)/$$f"; \ - $(LIBTOOL) --mode=install $(theatre_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(theatre_drv_ladir)/$$f; \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(theatre_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(theatre_drv_ladir)/$$f'"; \ + $(LIBTOOL) --mode=install $(theatre_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(theatre_drv_ladir)/$$f"; \ else :; fi; \ done uninstall-theatre_drv_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(theatre_drv_la_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(theatre_drv_ladir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(theatre_drv_ladir)/$$p; \ + @set -x; list='$(theatre_drv_la_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(theatre_drv_ladir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(theatre_drv_ladir)/$$p"; \ done clean-theatre_drv_laLTLIBRARIES: -test -z "$(theatre_drv_la_LTLIBRARIES)" || rm -f $(theatre_drv_la_LTLIBRARIES) @list='$(theatre_drv_la_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ + test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done @@ -729,7 +718,7 @@ theatre_drv.la: $(theatre_drv_la_OBJECTS) $(theatre_drv_la_DEPENDENCIES) $(LINK) -rpath $(theatre_drv_ladir) $(theatre_drv_la_LDFLAGS) $(theatre_drv_la_OBJECTS) $(theatre_drv_la_LIBADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @@ -759,6 +748,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atimach64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atimach64accel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atimach64cursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atimach64exa.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atimach64i2c.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atimach64io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atimach64xv.Plo@am__quote@ @@ -809,103 +799,39 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/theatre_module.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -theatre200_drv_la-theatre200.o: theatre200.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -MT theatre200_drv_la-theatre200.o -MD -MP -MF "$(DEPDIR)/theatre200_drv_la-theatre200.Tpo" \ -@am__fastdepCC_TRUE@ -c -o theatre200_drv_la-theatre200.o `test -f 'theatre200.c' || echo '$(srcdir)/'`theatre200.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/theatre200_drv_la-theatre200.Tpo" "$(DEPDIR)/theatre200_drv_la-theatre200.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/theatre200_drv_la-theatre200.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='theatre200.c' object='theatre200_drv_la-theatre200.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/theatre200_drv_la-theatre200.Po' tmpdepfile='$(DEPDIR)/theatre200_drv_la-theatre200.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -c -o theatre200_drv_la-theatre200.o `test -f 'theatre200.c' || echo '$(srcdir)/'`theatre200.c - -theatre200_drv_la-theatre200.obj: theatre200.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -MT theatre200_drv_la-theatre200.obj -MD -MP -MF "$(DEPDIR)/theatre200_drv_la-theatre200.Tpo" \ -@am__fastdepCC_TRUE@ -c -o theatre200_drv_la-theatre200.obj `if test -f 'theatre200.c'; then $(CYGPATH_W) 'theatre200.c'; else $(CYGPATH_W) '$(srcdir)/theatre200.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/theatre200_drv_la-theatre200.Tpo" "$(DEPDIR)/theatre200_drv_la-theatre200.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/theatre200_drv_la-theatre200.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='theatre200.c' object='theatre200_drv_la-theatre200.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/theatre200_drv_la-theatre200.Po' tmpdepfile='$(DEPDIR)/theatre200_drv_la-theatre200.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -c -o theatre200_drv_la-theatre200.obj `if test -f 'theatre200.c'; then $(CYGPATH_W) 'theatre200.c'; else $(CYGPATH_W) '$(srcdir)/theatre200.c'; fi` +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< theatre200_drv_la-theatre200.lo: theatre200.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -MT theatre200_drv_la-theatre200.lo -MD -MP -MF "$(DEPDIR)/theatre200_drv_la-theatre200.Tpo" \ -@am__fastdepCC_TRUE@ -c -o theatre200_drv_la-theatre200.lo `test -f 'theatre200.c' || echo '$(srcdir)/'`theatre200.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/theatre200_drv_la-theatre200.Tpo" "$(DEPDIR)/theatre200_drv_la-theatre200.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/theatre200_drv_la-theatre200.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -MT theatre200_drv_la-theatre200.lo -MD -MP -MF "$(DEPDIR)/theatre200_drv_la-theatre200.Tpo" -c -o theatre200_drv_la-theatre200.lo `test -f 'theatre200.c' || echo '$(srcdir)/'`theatre200.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/theatre200_drv_la-theatre200.Tpo" "$(DEPDIR)/theatre200_drv_la-theatre200.Plo"; else rm -f "$(DEPDIR)/theatre200_drv_la-theatre200.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='theatre200.c' object='theatre200_drv_la-theatre200.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/theatre200_drv_la-theatre200.Plo' tmpdepfile='$(DEPDIR)/theatre200_drv_la-theatre200.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -c -o theatre200_drv_la-theatre200.lo `test -f 'theatre200.c' || echo '$(srcdir)/'`theatre200.c - -theatre200_drv_la-theatre200_module.o: theatre200_module.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -MT theatre200_drv_la-theatre200_module.o -MD -MP -MF "$(DEPDIR)/theatre200_drv_la-theatre200_module.Tpo" \ -@am__fastdepCC_TRUE@ -c -o theatre200_drv_la-theatre200_module.o `test -f 'theatre200_module.c' || echo '$(srcdir)/'`theatre200_module.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/theatre200_drv_la-theatre200_module.Tpo" "$(DEPDIR)/theatre200_drv_la-theatre200_module.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/theatre200_drv_la-theatre200_module.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='theatre200_module.c' object='theatre200_drv_la-theatre200_module.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/theatre200_drv_la-theatre200_module.Po' tmpdepfile='$(DEPDIR)/theatre200_drv_la-theatre200_module.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -c -o theatre200_drv_la-theatre200_module.o `test -f 'theatre200_module.c' || echo '$(srcdir)/'`theatre200_module.c - -theatre200_drv_la-theatre200_module.obj: theatre200_module.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -MT theatre200_drv_la-theatre200_module.obj -MD -MP -MF "$(DEPDIR)/theatre200_drv_la-theatre200_module.Tpo" \ -@am__fastdepCC_TRUE@ -c -o theatre200_drv_la-theatre200_module.obj `if test -f 'theatre200_module.c'; then $(CYGPATH_W) 'theatre200_module.c'; else $(CYGPATH_W) '$(srcdir)/theatre200_module.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/theatre200_drv_la-theatre200_module.Tpo" "$(DEPDIR)/theatre200_drv_la-theatre200_module.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/theatre200_drv_la-theatre200_module.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='theatre200_module.c' object='theatre200_drv_la-theatre200_module.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/theatre200_drv_la-theatre200_module.Po' tmpdepfile='$(DEPDIR)/theatre200_drv_la-theatre200_module.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -c -o theatre200_drv_la-theatre200_module.obj `if test -f 'theatre200_module.c'; then $(CYGPATH_W) 'theatre200_module.c'; else $(CYGPATH_W) '$(srcdir)/theatre200_module.c'; fi` +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -c -o theatre200_drv_la-theatre200.lo `test -f 'theatre200.c' || echo '$(srcdir)/'`theatre200.c theatre200_drv_la-theatre200_module.lo: theatre200_module.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -MT theatre200_drv_la-theatre200_module.lo -MD -MP -MF "$(DEPDIR)/theatre200_drv_la-theatre200_module.Tpo" \ -@am__fastdepCC_TRUE@ -c -o theatre200_drv_la-theatre200_module.lo `test -f 'theatre200_module.c' || echo '$(srcdir)/'`theatre200_module.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/theatre200_drv_la-theatre200_module.Tpo" "$(DEPDIR)/theatre200_drv_la-theatre200_module.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/theatre200_drv_la-theatre200_module.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -MT theatre200_drv_la-theatre200_module.lo -MD -MP -MF "$(DEPDIR)/theatre200_drv_la-theatre200_module.Tpo" -c -o theatre200_drv_la-theatre200_module.lo `test -f 'theatre200_module.c' || echo '$(srcdir)/'`theatre200_module.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/theatre200_drv_la-theatre200_module.Tpo" "$(DEPDIR)/theatre200_drv_la-theatre200_module.Plo"; else rm -f "$(DEPDIR)/theatre200_drv_la-theatre200_module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='theatre200_module.c' object='theatre200_drv_la-theatre200_module.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/theatre200_drv_la-theatre200_module.Plo' tmpdepfile='$(DEPDIR)/theatre200_drv_la-theatre200_module.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -c -o theatre200_drv_la-theatre200_module.lo `test -f 'theatre200_module.c' || echo '$(srcdir)/'`theatre200_module.c +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(theatre200_drv_la_CFLAGS) $(CFLAGS) -c -o theatre200_drv_la-theatre200_module.lo `test -f 'theatre200_module.c' || echo '$(srcdir)/'`theatre200_module.c mostlyclean-libtool: -rm -f *.lo @@ -917,14 +843,6 @@ distclean-libtool: -rm -f libtool uninstall-info-am: -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -933,6 +851,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique +tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -944,10 +863,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -970,10 +890,6 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @@ -987,7 +903,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -1005,9 +921,10 @@ distdir: $(DISTFILES) check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) - installdirs: - $(mkinstalldirs) $(DESTDIR)$(ati_drv_ladir) $(DESTDIR)$(atimisc_drv_ladir) $(DESTDIR)$(r128_drv_ladir) $(DESTDIR)$(radeon_drv_ladir) $(DESTDIR)$(theatre200_drv_ladir) $(DESTDIR)$(theatre_detect_drv_ladir) $(DESTDIR)$(theatre_drv_ladir) + for dir in "$(DESTDIR)$(ati_drv_ladir)" "$(DESTDIR)$(atimisc_drv_ladir)" "$(DESTDIR)$(r128_drv_ladir)" "$(DESTDIR)$(radeon_drv_ladir)" "$(DESTDIR)$(theatre200_drv_ladir)" "$(DESTDIR)$(theatre_detect_drv_ladir)" "$(DESTDIR)$(theatre_drv_ladir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -1027,7 +944,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -1051,13 +968,16 @@ dvi: dvi-am dvi-am: +html: html-am + info: info-am info-am: install-data-am: install-ati_drv_laLTLIBRARIES \ install-atimisc_drv_laLTLIBRARIES \ - install-r128_drv_laLTLIBRARIES install-radeon_drv_laLTLIBRARIES \ + install-r128_drv_laLTLIBRARIES \ + install-radeon_drv_laLTLIBRARIES \ install-theatre200_drv_laLTLIBRARIES \ install-theatre_detect_drv_laLTLIBRARIES \ install-theatre_drv_laLTLIBRARIES @@ -1104,8 +1024,8 @@ uninstall-am: uninstall-ati_drv_laLTLIBRARIES \ clean-theatre_detect_drv_laLTLIBRARIES \ clean-theatre_drv_laLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-ati_drv_laLTLIBRARIES \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-ati_drv_laLTLIBRARIES \ install-atimisc_drv_laLTLIBRARIES install-data install-data-am \ install-exec install-exec-am install-info install-info-am \ install-man install-r128_drv_laLTLIBRARIES \ @@ -24,12 +24,12 @@ #ifndef ___ATI_H___ #define ___ATI_H___ 1 +#include <unistd.h> #include "xf86Pci.h" #include "atipciids.h" #include "xf86.h" -#include "xf86_ansic.h" #include "xf86_OSproc.h" extern DriverRec ATI; diff --git a/src/atiaccel.c b/src/atiaccel.c index 050019d..99efae9 100644 --- a/src/atiaccel.c +++ b/src/atiaccel.c @@ -33,6 +33,7 @@ #include "atimach64accel.h" #include "atistruct.h" +#ifdef USE_XAA /* * ATIInitializeAcceleration -- * @@ -47,8 +48,6 @@ ATIInitializeAcceleration ATIPtr pATI ) { - int maxScanlines = 32767, maxPixelArea, PixelArea; - if (pATI->OptionAccel) { if (!(pATI->pXAAInfo = XAACreateInfoRec())) @@ -57,7 +56,7 @@ ATIInitializeAcceleration switch (pATI->Adapter) { case ATI_ADAPTER_MACH64: - maxScanlines = ATIMach64AccelInit(pATI, pATI->pXAAInfo); + ATIMach64AccelInit(pATI, pATI->pXAAInfo); break; default: @@ -65,31 +64,6 @@ ATIInitializeAcceleration } } -#ifndef AVOID_CPIO - - if (!pATI->BankInfo.BankSize) - -#endif /* AVOID_CPIO */ - -#ifdef XF86DRI_DEVEL - - /* If DRI is enabled, we've already set up the FB manager in ATIScreenInit */ - if (!pATI->directRenderingEnabled) - -#endif /* XF86DRI */ - { - /* - * Note: If PixelArea exceeds the engine's maximum, the excess is - * never used, even though it would be useful for such things - * as XVideo buffers. - */ - maxPixelArea = maxScanlines * pScreenInfo->displayWidth; - PixelArea = pScreenInfo->videoRam * 1024 * 8 / pATI->bitsPerPixel; - if (PixelArea > maxPixelArea) - PixelArea = maxPixelArea; - xf86InitFBManagerArea(pScreen, PixelArea, 2); - } - if (!pATI->OptionAccel || XAAInit(pScreen, pATI->pXAAInfo)) return TRUE; @@ -144,3 +118,4 @@ ATIResizeOffscreenLinear return pLinear; } +#endif /* USE_XAA */ diff --git a/src/atiadapter.h b/src/atiadapter.h index 5cfb79c..8db366e 100644 --- a/src/atiadapter.h +++ b/src/atiadapter.h @@ -1,6 +1,6 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h,v 1.10 2003/01/01 19:16:30 tsi Exp $ */ /* - * Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@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 diff --git a/src/atiaudio.h b/src/atiaudio.h index f2eb94c..19080d2 100644 --- a/src/atiaudio.h +++ b/src/atiaudio.h @@ -1,6 +1,6 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaudio.h,v 1.1 2003/07/24 22:08:27 tsi Exp $ */ /* - * Copyright 2003 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@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 diff --git a/src/atibus.c b/src/atibus.c index c6eade1..7219483 100644 --- a/src/atibus.c +++ b/src/atibus.c @@ -25,6 +25,8 @@ #include "config.h" #endif +#include <string.h> + #include "ati.h" #include "atiadapter.h" #include "atibus.h" diff --git a/src/aticlock.c b/src/aticlock.c index 5acd3f8..c0de559 100644 --- a/src/aticlock.c +++ b/src/aticlock.c @@ -196,6 +196,7 @@ #include "config.h" #endif +#include <stdlib.h> #include "ati.h" #include "atiadapter.h" #include "atichip.h" diff --git a/src/aticonfig.c b/src/aticonfig.c index 6a118a0..d0a3677 100644 --- a/src/aticonfig.c +++ b/src/aticonfig.c @@ -28,6 +28,8 @@ #include "config.h" #endif +#include <string.h> + #include "ati.h" #include "atiadapter.h" #include "atichip.h" @@ -151,6 +153,8 @@ ATIProcessOptions # define ProbeClocks PublicOption[ATI_OPTION_PROBE_CLOCKS].value.bool # define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.bool # define SWCursor PublicOption[ATI_OPTION_SWCURSOR].value.bool +# define AccelMethod PublicOption[ATI_OPTION_ACCELMETHOD].value.str +# define RenderAccel PublicOption[ATI_OPTION_RENDER_ACCEL].value.bool # define LCDSync PrivateOption[ATI_OPTION_LCDSYNC].value.bool # define ReferenceClock \ @@ -338,5 +342,32 @@ ATIProcessOptions } } + pATI->useEXA = FALSE; + if (pATI->OptionAccel) + { + MessageType from = X_DEFAULT; +#if defined(USE_EXA) +#if defined(USE_XAA) + if (AccelMethod != NULL) + { + from = X_CONFIG; + if (xf86NameCmp(AccelMethod, "EXA") == 0) + pATI->useEXA = TRUE; + } +#else /* USE_XAA */ + pATI->useEXA = TRUE; +#endif /* !USE_XAA */ +#endif /* USE_EXA */ + xf86DrvMsg(pScreenInfo->scrnIndex, from, + "Using %s acceleration architecture\n", + pATI->useEXA ? "EXA" : "XAA"); + + pATI->RenderAccelEnabled = FALSE; +#if defined(USE_EXA) + if (pATI->useEXA && RenderAccel) + pATI->RenderAccelEnabled = TRUE; +#endif + } + xfree(PublicOption); } diff --git a/src/aticonsole.c b/src/aticonsole.c index 346bf44..53b1ed8 100644 --- a/src/aticonsole.c +++ b/src/aticonsole.c @@ -177,8 +177,7 @@ ATIProbeAndSetActiveDisplays xf86LoaderRefSymLists(vbeSymbols, NULL); if (xf86GetVerbosity() > 3) { - xf86ErrorFVerb(4, "\n Before TV-Out queries\n\n", - pScreenInfo->currentMode->name); + xf86ErrorFVerb(4, "\n Before TV-Out queries\n\n"); ATIPrintRegisters(pATI); } diff --git a/src/aticrtc.h b/src/aticrtc.h index ba2a7a1..9f6ec38 100644 --- a/src/aticrtc.h +++ b/src/aticrtc.h @@ -1,6 +1,6 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h,v 1.8 2003/01/01 19:16:31 tsi Exp $ */ /* - * Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@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 diff --git a/src/atidac.c b/src/atidac.c index 7eb4515..8c5ea52 100644 --- a/src/atidac.c +++ b/src/atidac.c @@ -25,6 +25,8 @@ #include "config.h" #endif +#include <string.h> + #include "ati.h" #include "atidac.h" #include "atimach64io.h" diff --git a/src/atidecoder.h b/src/atidecoder.h index 0c3cc5c..e88b89f 100644 --- a/src/atidecoder.h +++ b/src/atidecoder.h @@ -1,6 +1,6 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidecoder.h,v 1.1 2003/07/24 22:08:28 tsi Exp $ */ /* - * Copyright 2003 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@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 diff --git a/src/atidga.c b/src/atidga.c index 0f8fb8a..1c652a7 100644 --- a/src/atidga.c +++ b/src/atidga.c @@ -26,6 +26,8 @@ #endif #ifndef AVOID_DGA +#include <string.h> + #include "ati.h" #include "atiadjust.h" #include "atichip.h" @@ -186,6 +188,8 @@ ATIDGAFillRect ) { ATIPtr pATI = ATIPTR(pScreenInfo); +/*FIXME : use EXA if available */ +#ifdef USE_XAA XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; (*pXAAInfo->SetupForSolidFill)(pScreenInfo, (int)colour, GXcopy, @@ -194,6 +198,7 @@ ATIDGAFillRect if (pScreenInfo->bitsPerPixel == pATI->bitsPerPixel) SET_SYNC_FLAG(pXAAInfo); +#endif } /* @@ -215,6 +220,8 @@ ATIDGABlitRect ) { ATIPtr pATI = ATIPTR(pScreenInfo); +/*FIXME : use EXA if available */ +#ifdef USE_XAA XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; int xdir = ((xSrc < xDst) && (ySrc == yDst)) ? -1 : 1; int ydir = (ySrc < yDst) ? -1 : 1; @@ -226,6 +233,7 @@ ATIDGABlitRect if (pScreenInfo->bitsPerPixel == pATI->bitsPerPixel) SET_SYNC_FLAG(pXAAInfo); +#endif } /* @@ -248,6 +256,8 @@ ATIDGABlitTransRect ) { ATIPtr pATI = ATIPTR(pScreenInfo); +/*FIXME : use EXA if available */ +#ifdef USE_XAA XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; int xdir = ((xSrc < xDst) && (ySrc == yDst)) ? -1 : 1; int ydir = (ySrc < yDst) ? -1 : 1; @@ -264,6 +274,7 @@ ATIDGABlitTransRect if (pScreenInfo->bitsPerPixel == pATI->bitsPerPixel) SET_SYNC_FLAG(pXAAInfo); +#endif } /* @@ -333,8 +344,10 @@ ATIDGAAddModes pDGAMode->flags |= DGA_PIXMAP_AVAILABLE; pDGAMode->address = pATI->pMemory; +#ifdef USE_XAA if (pATI->pXAAInfo) pDGAMode->flags &= ~DGA_CONCURRENT_ACCESS; +#endif } if ((pMode->Flags & V_DBLSCAN) || (pMode->VScan > 1)) pDGAMode->flags |= DGA_DOUBLESCAN; @@ -395,7 +408,9 @@ ATIDGAInit ATIPtr pATI ) { +#ifdef USE_XAA XAAInfoRecPtr pXAAInfo; +#endif int flags; if (!pATI->nDGAMode) @@ -420,6 +435,7 @@ ATIDGAInit pATI->ATIDGAFunctions.GetViewport = ATIDGAGetViewport; flags = 0; +#ifdef USE_XAA if ((pXAAInfo = pATI->pXAAInfo)) { pATI->ATIDGAFunctions.Sync = pXAAInfo->Sync; @@ -437,6 +453,7 @@ ATIDGAInit pATI->ATIDGAFunctions.BlitTransRect = ATIDGABlitTransRect; } } +#endif if (!flags) flags = DGA_CONCURRENT_ACCESS; diff --git a/src/atidri.c b/src/atidri.c index 2156603..720c96a 100644 --- a/src/atidri.c +++ b/src/atidri.c @@ -31,6 +31,10 @@ * Leif Delgass <ldelgass@retinalburn.net> */ +#include <string.h> +#include <stdio.h> +#include <unistd.h> + /* Driver data structures */ #include "ati.h" #include "atibus.h" @@ -289,9 +293,9 @@ static void ATIEnterServer( ScreenPtr pScreen ) ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; ATIPtr pATI = ATIPTR(pScreenInfo); - if ( pATI->directRenderingEnabled && pATI->pXAAInfo ) { - pATI->pXAAInfo->NeedToSync = TRUE; - pATI->NeedDRISync = TRUE; + if ( pATI->directRenderingEnabled ) { + ATIDRIMarkSyncInt(pScreenInfo); + ATIDRIMarkSyncExt(pScreenInfo); } } @@ -329,6 +333,7 @@ static void ATIDRISwapContext( ScreenPtr pScreen, } } +#ifdef USE_XAA static void ATIDRITransitionTo2d(ScreenPtr pScreen) { ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; @@ -396,10 +401,49 @@ static void ATIDRITransitionTo3d(ScreenPtr pScreen) pATI->have3DWindows = TRUE; } +#endif /* USE_XAA */ + +#ifdef USE_EXA +static void ATIDRITransitionTo2d_EXA(ScreenPtr pScreen) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); +#if 0 + ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; + + exaEnableDisableFBAccess(pScreen->myNum, FALSE); + + pATI->pExa->offScreenBase = pATIDRIServer->backOffset; + + exaEnableDisableFBAccess(pScreen->myNum, TRUE); +#endif + + pATI->have3DWindows = FALSE; +} + +static void ATIDRITransitionTo3d_EXA(ScreenPtr pScreen) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); +#if 0 + ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; + + exaEnableDisableFBAccess(pScreen->myNum, FALSE); + + pATI->pExa->offScreenBase = pATIDRIServer->textureOffset + + pATIDRIServer->textureSize; + + exaEnableDisableFBAccess(pScreen->myNum, TRUE); +#endif + + pATI->have3DWindows = TRUE; +} +#endif /* USE_EXA */ /* Initialize the state of the back and depth buffers. */ static void ATIDRIInitBuffers( WindowPtr pWin, RegionPtr prgn, CARD32 indx ) { +#ifdef USE_XAA ScreenPtr pScreen = pWin->drawable.pScreen; ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; ATIPtr pATI = ATIPTR(pScreenInfo); @@ -450,7 +494,8 @@ static void ATIDRIInitBuffers( WindowPtr pWin, RegionPtr prgn, CARD32 indx ) pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); - pXAAInfo->NeedToSync = TRUE; + ATIDRIMarkSyncInt(pScreenInfo); +#endif } /* Copy the back and depth buffers when the X server moves a window. @@ -465,6 +510,7 @@ static void ATIDRIInitBuffers( WindowPtr pWin, RegionPtr prgn, CARD32 indx ) static void ATIDRIMoveBuffers( WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 indx ) { +#ifdef USE_XAA ScreenPtr pScreen = pWin->drawable.pScreen; ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; ATIPtr pATI = ATIPTR(pScreenInfo); @@ -628,7 +674,8 @@ static void ATIDRIMoveBuffers( WindowPtr pWin, DDXPointRec ptOldOrg, DEALLOCATE_LOCAL(pptNew1); DEALLOCATE_LOCAL(pboxNew1); - pXAAInfo->NeedToSync = TRUE; + ATIDRIMarkSyncInt(pScreenInfo); +#endif } /* Compute log base 2 of val. */ @@ -678,7 +725,6 @@ static Bool ATIDRISetAgpMode( ScreenPtr pScreen ) if (pATI->OptionAGPSize) { switch (pATI->OptionAGPSize) { - case 256: case 128: case 64: case 32: @@ -772,8 +818,7 @@ static Bool ATIDRIAgpInit( ScreenPtr pScreen ) if (pATI->OptionBufferSize > 2) { xf86DrvMsg( pScreen->myNum, X_WARNING, "[agp] Illegal DMA buffers size: %d MB\n", pATI->OptionBufferSize ); - xf86DrvMsg( pScreen->myNum, X_WARNING, "[agp] Clamping DMA buffers size to 2 MB\n", - pATI->OptionBufferSize ); + xf86DrvMsg( pScreen->myNum, X_WARNING, "[agp] Clamping DMA buffers size to 2 MB\n"); pATIDRIServer->bufferSize = 2; } else { pATIDRIServer->bufferSize = pATI->OptionBufferSize; @@ -814,7 +859,7 @@ static Bool ATIDRIAgpInit( ScreenPtr pScreen ) return FALSE; } xf86DrvMsg( pScreen->myNum, X_INFO, - "[agp] ring handle = 0x%08lx\n", + "[agp] ring handle = 0x%08x\n", pATIDRIServer->ringHandle ); if ( drmMap( pATI->drmFD, pATIDRIServer->ringHandle, @@ -835,7 +880,7 @@ static Bool ATIDRIAgpInit( ScreenPtr pScreen ) return FALSE; } xf86DrvMsg( pScreen->myNum, X_INFO, - "[agp] vertex buffers handle = 0x%08lx\n", + "[agp] vertex buffers handle = 0x%08x\n", pATIDRIServer->bufferHandle ); if ( drmMap( pATI->drmFD, pATIDRIServer->bufferHandle, @@ -856,7 +901,7 @@ static Bool ATIDRIAgpInit( ScreenPtr pScreen ) return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[agp] AGP texture region handle = 0x%08lx\n", + "[agp] AGP texture region handle = 0x%08x\n", pATIDRIServer->agpTexHandle); if (drmMap(pATI->drmFD, pATIDRIServer->agpTexHandle, pATIDRIServer->agpTexMapSize, @@ -925,7 +970,7 @@ static Bool ATIDRIMapInit( ScreenPtr pScreen ) return FALSE; } xf86DrvMsg( pScreen->myNum, X_INFO, - "[drm] register handle = 0x%08lx\n", + "[drm] register handle = 0x%08x\n", pATIDRIServer->regsHandle ); return TRUE; @@ -1020,7 +1065,7 @@ static Bool ATIDRIMapBuffers( ScreenPtr pScreen ) xf86DrvMsg( pScreen->myNum, X_INFO, "[drm] Mapped %d DMA buffers at 0x%08lx\n", pATIDRIServer->drmBuffers->count, - pATIDRIServer->drmBuffers->list->address ); + (unsigned long)pATIDRIServer->drmBuffers->list->address ); return TRUE; } @@ -1058,8 +1103,7 @@ static Bool ATIDRIIrqInit( ScreenPtr pScreen ) pATI->irq); else { xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, - "[drm] Falling back to irq-free operation\n", - pATI->irq); + "[drm] Falling back to irq-free operation\n"); return FALSE; } } @@ -1149,7 +1193,7 @@ Bool ATIDRIScreenInit( ScreenPtr pScreen ) pDRIInfo->ddxDriverMajorVersion = ATI_VERSION_MAJOR; pDRIInfo->ddxDriverMinorVersion = ATI_VERSION_MINOR; pDRIInfo->ddxDriverPatchVersion = ATI_VERSION_PATCH; - pDRIInfo->frameBufferPhysicalAddress = pATI->LinearBase; + pDRIInfo->frameBufferPhysicalAddress = (void *)pATI->LinearBase; pDRIInfo->frameBufferSize = pATI->LinearSize; pDRIInfo->frameBufferStride = (pScreenInfo->displayWidth * pATI->FBBytesPerPixel); @@ -1203,8 +1247,18 @@ Bool ATIDRIScreenInit( ScreenPtr pScreen ) pDRIInfo->SwapContext = ATIDRISwapContext; pDRIInfo->InitBuffers = ATIDRIInitBuffers; pDRIInfo->MoveBuffers = ATIDRIMoveBuffers; - pDRIInfo->TransitionTo2d = ATIDRITransitionTo2d; - pDRIInfo->TransitionTo3d = ATIDRITransitionTo3d; +#ifdef USE_XAA + if (!pATI->useEXA) { + pDRIInfo->TransitionTo2d = ATIDRITransitionTo2d; + pDRIInfo->TransitionTo3d = ATIDRITransitionTo3d; + } +#endif /* USE_XAA */ +#ifdef USE_EXA + if (pATI->useEXA) { + pDRIInfo->TransitionTo2d = ATIDRITransitionTo2d_EXA; + pDRIInfo->TransitionTo3d = ATIDRITransitionTo3d_EXA; + } +#endif /* USE_EXA */ pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; pDRIInfo->createDummyCtx = TRUE; @@ -1314,8 +1368,7 @@ Bool ATIDRIScreenInit( ScreenPtr pScreen ) if (pATI->OptionBufferSize > 2) { xf86DrvMsg( pScreen->myNum, X_WARNING, "[pci] Illegal DMA buffers size: %d MB\n", pATI->OptionBufferSize ); - xf86DrvMsg( pScreen->myNum, X_WARNING, "[pci] Clamping DMA buffers size to 2 MB\n", - pATI->OptionBufferSize ); + xf86DrvMsg( pScreen->myNum, X_WARNING, "[pci] Clamping DMA buffers size to 2 MB\n"); pATIDRIServer->bufferSize = 2; } else { pATIDRIServer->bufferSize = pATI->OptionBufferSize; @@ -1460,8 +1513,6 @@ void ATIDRIResume( ScreenPtr pScreen ) ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; - int ret; - xf86DrvMsg( pScreen->myNum, X_INFO, "[RESUME] Attempting to re-init Mach64 hardware.\n"); diff --git a/src/atii2c.c b/src/atii2c.c index cb7bc04..35de71f 100644 --- a/src/atii2c.c +++ b/src/atii2c.c @@ -117,21 +117,22 @@ /* - * ATII2CAddress -- + * ATII2CStart -- * - * This function puts a Start bit and an 8-bit address on the I2C bus. + * This function puts a start signal on the I2C bus. */ static Bool -ATII2CAddress +ATII2CStart ( - I2CDevPtr pI2CDev, - I2CSlaveAddr Address + I2CBusPtr pI2CBus, + int timeout ) { - I2CBusPtr pI2CBus = pI2CDev->pI2CBus; ATII2CPtr pATII2C = pI2CBus->DriverPrivate.ptr; ATIPtr pATI = pATII2C->pATI; + (void)timeout; + /* * Set I2C line directions to out-bound. SCL will remain out-bound until * next I2C Stop. @@ -148,6 +149,23 @@ ATII2CAddress ATII2CSDABitOff; ATII2CSCLBitOff; + return TRUE; +} + +/* + * ATII2CAddress -- + * + * This function puts an 8-bit address on the I2C bus. + */ +static Bool +ATII2CAddress +( + I2CDevPtr pI2CDev, + I2CSlaveAddr Address +) +{ + I2CBusPtr pI2CBus = pI2CDev->pI2CBus; + /* Send low byte of device address */ if ((*pI2CBus->I2CPutByte)(pI2CDev, (I2CByte)Address)) { @@ -318,6 +336,7 @@ ATICreateI2CBusRec pI2CBus->scrnIndex = iScreen; pI2CBus->I2CAddress = ATII2CAddress; + pI2CBus->I2CStart = ATII2CStart; pI2CBus->I2CStop = ATII2CStop; pI2CBus->I2CPutByte = ATII2CPutByte; pI2CBus->I2CGetByte = ATII2CGetByte; diff --git a/src/atiio.h b/src/atiio.h index 9405033..f6f871b 100644 --- a/src/atiio.h +++ b/src/atiio.h @@ -1,6 +1,6 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h,v 1.14 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@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 diff --git a/src/atiload.c b/src/atiload.c index 7c901f6..83165bc 100644 --- a/src/atiload.c +++ b/src/atiload.c @@ -144,6 +144,19 @@ const char *ATIshadowfbSymbols[] = NULL }; +#ifdef USE_EXA +const char *ATIexaSymbols[] = +{ + "exaDriverAlloc", + "exaDriverInit", + "exaDriverFini", + "exaOffscreenAlloc", + "exaOffscreenFree", + NULL +}; +#endif + +#ifdef USE_XAA const char *ATIxaaSymbols[] = { "XAACreateInfoRec", @@ -151,6 +164,7 @@ const char *ATIxaaSymbols[] = "XAAInit", NULL }; +#endif const char *ATIramdacSymbols[] = { @@ -205,21 +219,13 @@ ATILoadModules ATIPtr pATI ) { + pointer fbPtr = NULL; + /* Load shadow frame buffer code if needed */ if (pATI->OptionShadowFB && !ATILoadModule(pScreenInfo, "shadowfb", ATIshadowfbSymbols)) return NULL; - /* Load XAA if needed */ - if (pATI->OptionAccel && - !ATILoadModule(pScreenInfo, "xaa", ATIxaaSymbols)) - return NULL; - - /* Load ramdac module if needed */ - if ((pATI->Cursor > ATI_CURSOR_SOFTWARE) && - !ATILoadModule(pScreenInfo, "ramdac", ATIramdacSymbols)) - return NULL; - /* Load depth-specific entry points */ switch (pATI->bitsPerPixel) { @@ -227,10 +233,12 @@ ATILoadModules #ifndef AVOID_CPIO case 1: - return ATILoadModule(pScreenInfo, "xf1bpp", ATIxf1bppSymbols); + fbPtr = ATILoadModule(pScreenInfo, "xf1bpp", ATIxf1bppSymbols); + break; case 4: - return ATILoadModule(pScreenInfo, "xf4bpp", ATIxf4bppSymbols); + fbPtr = ATILoadModule(pScreenInfo, "xf4bpp", ATIxf4bppSymbols); + break; #endif /* AVOID_CPIO */ @@ -238,11 +246,48 @@ ATILoadModules case 16: case 24: case 32: - return ATILoadModule(pScreenInfo, "fb", ATIfbSymbols); + fbPtr = ATILoadModule(pScreenInfo, "fb", ATIfbSymbols); + break; default: return NULL; } + if (!fbPtr) + return NULL; + + /* Load ramdac module if needed */ + if ((pATI->Cursor > ATI_CURSOR_SOFTWARE) && + !ATILoadModule(pScreenInfo, "ramdac", ATIramdacSymbols)) + return NULL; + +#ifdef USE_EXA + /* Load EXA if needed */ + if (pATI->useEXA && pATI->OptionAccel) + { + /* Cannot use ATILoadModule(), because of version checking */ + XF86ModReqInfo req; + int errmaj, errmin; + + memset(&req, 0, sizeof(XF86ModReqInfo)); + req.majorversion = 2; + req.minorversion = 0; + if (!LoadSubModule(pScreenInfo->module, "exa", NULL, NULL, NULL, &req, + &errmaj, &errmin)) + { + LoaderErrorMsg(NULL, "exa", errmaj, errmin); + return NULL; + } + xf86LoaderReqSymLists(ATIexaSymbols, NULL); + } +#endif +#ifdef USE_XAA + /* Load XAA if needed */ + if (!pATI->useEXA && pATI->OptionAccel && + !ATILoadModule(pScreenInfo, "xaa", ATIxaaSymbols)) + return NULL; +#endif + + return fbPtr; } #endif /* XFree86LOADER */ diff --git a/src/atiload.h b/src/atiload.h index 96606e3..49f2bf2 100644 --- a/src/atiload.h +++ b/src/atiload.h @@ -47,7 +47,20 @@ extern const char *ATIint10Symbols[], *ATIddcSymbols[], *ATIvbeSymbols[], #endif /* XF86DRI_DEVEL */ - *ATIfbSymbols[], *ATIshadowfbSymbols[], *ATIxaaSymbols[], + *ATIfbSymbols[], *ATIshadowfbSymbols[], + +#ifdef USE_EXA + + *ATIexaSymbols[], + +#endif /* USE_EXA */ + +#ifdef USE_XAA + + *ATIxaaSymbols[], + +#endif /* USE_XAA */ + *ATIramdacSymbols[], *ATIi2cSymbols[]; extern pointer ATILoadModule(ScrnInfoPtr, const char *, const char **); diff --git a/src/atimach64.c b/src/atimach64.c index 95a9c07..ba2ac8e 100644 --- a/src/atimach64.c +++ b/src/atimach64.c @@ -53,6 +53,8 @@ #include "config.h" #endif +#include <string.h> + #include "ati.h" #include "atibus.h" #include "atichip.h" @@ -82,7 +84,6 @@ ATIMach64PreInit ) { CARD32 bus_cntl, config_cntl; - int tmp; #ifndef AVOID_CPIO @@ -181,6 +182,7 @@ ATIMach64PreInit if (pATI->Chip >= ATI_CHIP_264VTB) { + pATIHW->mem_buf_cntl = inr(MEM_BUF_CNTL) | INVALIDATE_RB_CACHE; pATIHW->mem_cntl = (pATI->LockData.mem_cntl & ~(CTL_MEM_LOWER_APER_ENDIAN | CTL_MEM_UPPER_APER_ENDIAN)) | SetBits(CTL_MEM_APER_BYTE_ENDIAN, CTL_MEM_LOWER_APER_ENDIAN); @@ -255,12 +257,29 @@ ATIMach64PreInit pATIHW->src_cntl = SRC_LINE_X_DIR; /* Initialise scissor, allowing for offscreen areas */ - pATIHW->sc_right = (pATI->displayWidth * pATI->XModifier) - 1; - tmp = pATI->displayWidth * pATI->bitsPerPixel; - tmp = (((pScreenInfo->videoRam * (1024 * 8)) + tmp - 1) / tmp) - 1; - if (tmp > ATIMach64MaxY) - tmp = ATIMach64MaxY; - pATIHW->sc_bottom = tmp; +#ifdef USE_XAA + if (!pATI->useEXA) + { + int width, height, total; + + pATIHW->sc_right = (pATI->displayWidth * pATI->XModifier) - 1; + width = pATI->displayWidth * pATI->bitsPerPixel; + total = pScreenInfo->videoRam * (1024 * 8); + height = (total + width - 1) / width; + if (height > ATIMach64MaxY + 1) + height = ATIMach64MaxY + 1; + pATIHW->sc_bottom = height - 1; + } +#endif /* USE_XAA */ + +#ifdef USE_EXA + if (pATI->useEXA) + { + pATIHW->sc_right = ATIMach64MaxX; + pATIHW->sc_bottom = ATIMach64MaxY; + } +#endif /* USE_EXA */ + pATI->sc_left_right = SetWord(pATI->NewHW.sc_right, 1) | SetWord(pATI->NewHW.sc_left, 0); pATI->sc_top_bottom = SetWord(pATI->NewHW.sc_bottom, 1) | @@ -422,6 +441,7 @@ ATIMach64Save if (pATI->Chip >= ATI_CHIP_264VTB) { + pATIHW->mem_buf_cntl = inr(MEM_BUF_CNTL) | INVALIDATE_RB_CACHE; pATIHW->mem_cntl = inr(MEM_CNTL); pATIHW->mpp_config = inr(MPP_CONFIG); pATIHW->mpp_strobe_seq = inr(MPP_STROBE_SEQ); @@ -463,6 +483,15 @@ ATIMach64Save pATIHW->src_height2 = inm(SRC_HEIGHT2); pATIHW->src_cntl = inm(SRC_CNTL); + if (pATI->Chip >= ATI_CHIP_264GTPRO) + { + CARD32 offset = TEX_LEVEL(inm(TEX_SIZE_PITCH)); + + /* Save 3D control & texture registers */ + pATIHW->tex_offset = inm(TEX_0_OFF + offset); + pATIHW->scale_3d_cntl = inm(SCALE_3D_CNTL); + } + /* Save host data register */ pATIHW->host_cntl = inm(HOST_CNTL); @@ -494,6 +523,13 @@ ATIMach64Save /* Save context */ pATIHW->context_mask = inm(CONTEXT_MASK); + if (pATI->Chip >= ATI_CHIP_264GTPRO) + { + /* Save texture setup registers */ + pATIHW->tex_size_pitch = inm(TEX_SIZE_PITCH); + pATIHW->tex_cntl = inm(TEX_CNTL); + } + if (pATI->Block1Base) { /* Save overlay & scaler registers */ @@ -833,6 +869,14 @@ ATIMach64Set outf(DST_BRES_DEC, pATIHW->dst_bres_dec); outf(DST_CNTL, pATIHW->dst_cntl); + if (pATI->Chip >= ATI_CHIP_264GTPRO) + { + /* Load ROP unit registers */ + ATIMach64WaitForFIFO(pATI, 2); + outf(Z_CNTL, 0); + outf(ALPHA_TST_CNTL, 0); + } + /* Load source registers */ ATIMach64WaitForFIFO(pATI, 6); outf(SRC_OFF_PITCH, pATIHW->src_off_pitch); @@ -845,14 +889,22 @@ ATIMach64Set SetWord(pATIHW->src_width2, 1) | SetWord(pATIHW->src_height2, 0)); outf(SRC_CNTL, pATIHW->src_cntl); + if (pATI->Chip >= ATI_CHIP_264GTPRO) + { + CARD32 offset = TEX_LEVEL(pATIHW->tex_size_pitch); + + /* Load 3D control & texture registers */ + ATIMach64WaitForFIFO(pATI, 2); + outf(TEX_0_OFF + offset, pATIHW->tex_offset); + outf(SCALE_3D_CNTL, pATIHW->scale_3d_cntl); + } + /* Load host data register */ ATIMach64WaitForFIFO(pATI, 1); outf(HOST_CNTL, pATIHW->host_cntl); /* Set host transfer window address and size clamp */ - pATI->pHOST_DATA = - (CARD8 *)pATI->pBlock[GetBits(HOST_DATA_0, BLOCK_SELECT)] + - (HOST_DATA_0 & MM_IO_SELECT); + pATI->pHOST_DATA = ATIHostDataAddr(HOST_DATA_0); pATI->nHostFIFOEntries = pATI->nFIFOEntries >> 1; if (pATI->nHostFIFOEntries > 16) pATI->nHostFIFOEntries = 16; @@ -894,6 +946,14 @@ ATIMach64Set ATIMach64WaitForFIFO(pATI, 1); outf(CONTEXT_MASK, pATIHW->context_mask); + if (pATI->Chip >= ATI_CHIP_264GTPRO) + { + /* Load texture setup registers */ + ATIMach64WaitForFIFO(pATI, 2); + outf(TEX_SIZE_PITCH, pATIHW->tex_size_pitch); + outf(TEX_CNTL, pATIHW->tex_cntl); + } + if (pATI->Block1Base) { /* Load overlay & scaler registers */ @@ -964,6 +1024,11 @@ ATIMach64Set CacheRegister(SRC_CNTL); + if (pATI->Chip >= ATI_CHIP_264GTPRO) + { + CacheRegister(SCALE_3D_CNTL); + } + CacheRegister(HOST_CNTL); CacheRegister(PAT_REG0); @@ -975,13 +1040,18 @@ ATIMach64Set CacheRegister(DP_BKGD_CLR); CacheRegister(DP_FRGD_CLR); - CacheRegister(DP_WRITE_MASK); + CacheRegister(DP_PIX_WIDTH); CacheRegister(DP_MIX); CacheRegister(CLR_CMP_CLR); CacheRegister(CLR_CMP_MSK); CacheRegister(CLR_CMP_CNTL); + if (pATI->Chip >= ATI_CHIP_264GTPRO) + { + CacheRegister(TEX_SIZE_PITCH); + } + if (pATI->Block1Base) { CacheRegister(OVERLAY_Y_X_START); @@ -1055,6 +1125,7 @@ ATIMach64Set if (pATI->Chip >= ATI_CHIP_264VTB) { + outr(MEM_BUF_CNTL, pATIHW->mem_buf_cntl); outr(MEM_CNTL, pATIHW->mem_cntl); outr(MPP_CONFIG, pATIHW->mpp_config); outr(MPP_STROBE_SEQ, pATIHW->mpp_strobe_seq); diff --git a/src/atimach64accel.c b/src/atimach64accel.c index 1ecb13b..442dcf7 100644 --- a/src/atimach64accel.c +++ b/src/atimach64accel.c @@ -79,7 +79,7 @@ /* * X-to-Mach64 mix translation table. */ -static CARD8 ATIMach64ALU[16] = +CARD8 ATIMach64ALU[16] = { MIX_0, /* GXclear */ MIX_AND, /* GXand */ @@ -105,7 +105,7 @@ static CARD8 ATIMach64ALU[16] = * This function ensures the current scissor settings do not interfere with * the current draw request. */ -static void +void ATIMach64ValidateClip ( ATIPtr pATI, @@ -130,6 +130,9 @@ ATIMach64ValidateClip } } +static __inline__ void TestRegisterCachingDP(ScrnInfoPtr pScreenInfo); +static __inline__ void TestRegisterCachingXV(ScrnInfoPtr pScreenInfo); + /* * ATIMach64Sync -- * @@ -148,19 +151,22 @@ ATIMach64Sync if ( pATI->directRenderingEnabled && pATI->NeedDRISync ) { ATIHWPtr pATIHW = &pATI->NewHW; + CARD32 offset; if (pATI->OptionMMIOCache) { /* "Invalidate" the MMIO cache so the cache slots get updated */ UncacheRegister(SRC_CNTL); + UncacheRegister(SCALE_3D_CNTL); UncacheRegister(HOST_CNTL); UncacheRegister(PAT_CNTL); UncacheRegister(SC_LEFT_RIGHT); UncacheRegister(SC_TOP_BOTTOM); UncacheRegister(DP_BKGD_CLR); UncacheRegister(DP_FRGD_CLR); - UncacheRegister(DP_WRITE_MASK); + UncacheRegister(DP_PIX_WIDTH); UncacheRegister(DP_MIX); UncacheRegister(CLR_CMP_CNTL); + UncacheRegister(TEX_SIZE_PITCH); } ATIDRIWaitForIdle(pATI); @@ -181,12 +187,19 @@ ATIMach64Sync outf( DP_MIX, pATIHW->dp_mix ); outf( DP_FRGD_CLR, pATIHW->dp_frgd_clr ); outf( DP_WRITE_MASK, pATIHW->dp_write_mask ); - outf( DP_PIX_WIDTH, pATIHW->dp_pix_width ); + outf( CLR_CMP_CNTL, pATIHW->clr_cmp_cntl ); + + offset = TEX_LEVEL(pATIHW->tex_size_pitch); + + ATIMach64WaitForFIFO(pATI, 6); outf( ALPHA_TST_CNTL, 0 ); outf( Z_CNTL, 0 ); - outf( SCALE_3D_CNTL, 0 ); + outf( SCALE_3D_CNTL, pATIHW->scale_3d_cntl ); + outf( TEX_0_OFF + offset, pATIHW->tex_offset ); + outf( TEX_SIZE_PITCH, pATIHW->tex_size_pitch ); + outf( TEX_CNTL, pATIHW->tex_cntl ); ATIMach64WaitForFIFO(pATI, 2); outf( SC_LEFT_RIGHT, @@ -197,15 +210,17 @@ ATIMach64Sync if (pATI->OptionMMIOCache) { /* Now that the cache slots reflect the register state, re-enable MMIO cache */ CacheRegister(SRC_CNTL); + CacheRegister(SCALE_3D_CNTL); CacheRegister(HOST_CNTL); CacheRegister(PAT_CNTL); CacheRegister(SC_LEFT_RIGHT); CacheRegister(SC_TOP_BOTTOM); CacheRegister(DP_BKGD_CLR); CacheRegister(DP_FRGD_CLR); - CacheRegister(DP_WRITE_MASK); + CacheRegister(DP_PIX_WIDTH); CacheRegister(DP_MIX); CacheRegister(CLR_CMP_CNTL); + CacheRegister(TEX_SIZE_PITCH); } ATIMach64WaitForIdle(pATI); @@ -219,58 +234,7 @@ ATIMach64Sync TestRegisterCaching(CLR_CMP_CLR); TestRegisterCaching(CLR_CMP_MSK); - if (pATI->Block1Base) - { - TestRegisterCaching(OVERLAY_Y_X_START); - TestRegisterCaching(OVERLAY_Y_X_END); - - TestRegisterCaching(OVERLAY_GRAPHICS_KEY_CLR); - TestRegisterCaching(OVERLAY_GRAPHICS_KEY_MSK); - - TestRegisterCaching(OVERLAY_KEY_CNTL); - - TestRegisterCaching(OVERLAY_SCALE_INC); - TestRegisterCaching(OVERLAY_SCALE_CNTL); - - TestRegisterCaching(SCALER_HEIGHT_WIDTH); - - TestRegisterCaching(SCALER_TEST); - - TestRegisterCaching(VIDEO_FORMAT); - - if (pATI->Chip < ATI_CHIP_264VTB) - { - TestRegisterCaching(BUF0_OFFSET); - TestRegisterCaching(BUF0_PITCH); - TestRegisterCaching(BUF1_OFFSET); - TestRegisterCaching(BUF1_PITCH); - } - else - { - TestRegisterCaching(SCALER_BUF0_OFFSET); - TestRegisterCaching(SCALER_BUF1_OFFSET); - TestRegisterCaching(SCALER_BUF_PITCH); - - TestRegisterCaching(OVERLAY_EXCLUSIVE_HORZ); - TestRegisterCaching(OVERLAY_EXCLUSIVE_VERT); - - if (pATI->Chip >= ATI_CHIP_264GTPRO) - { - TestRegisterCaching(SCALER_COLOUR_CNTL); - - TestRegisterCaching(SCALER_H_COEFF0); - TestRegisterCaching(SCALER_H_COEFF1); - TestRegisterCaching(SCALER_H_COEFF2); - TestRegisterCaching(SCALER_H_COEFF3); - TestRegisterCaching(SCALER_H_COEFF4); - - TestRegisterCaching(SCALER_BUF0_OFFSET_U); - TestRegisterCaching(SCALER_BUF0_OFFSET_V); - TestRegisterCaching(SCALER_BUF1_OFFSET_U); - TestRegisterCaching(SCALER_BUF1_OFFSET_V); - } - } - } + TestRegisterCachingXV(pScreenInfo); } pATI->NeedDRISync = FALSE; @@ -287,108 +251,157 @@ ATIMach64Sync * For debugging purposes, attempt to verify that each cached register * should actually be cached. */ - TestRegisterCaching(SRC_CNTL); + TestRegisterCachingDP(pScreenInfo); - TestRegisterCaching(HOST_CNTL); + TestRegisterCachingXV(pScreenInfo); + } + } - TestRegisterCaching(PAT_REG0); - TestRegisterCaching(PAT_REG1); - TestRegisterCaching(PAT_CNTL); +#ifdef USE_EXA + /* EXA sets pEXA->needsSync to FALSE on its own */ +#endif - if (RegisterIsCached(SC_LEFT_RIGHT) && /* Special case */ - (CacheSlot(SC_LEFT_RIGHT) != - (SetWord(inm(SC_RIGHT), 1) | SetWord(inm(SC_LEFT), 0)))) - { - UncacheRegister(SC_LEFT_RIGHT); - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "SC_LEFT_RIGHT write cache disabled!\n"); - } +#ifdef USE_XAA + if (pATI->pXAAInfo) + pATI->pXAAInfo->NeedToSync = FALSE; +#endif - if (RegisterIsCached(SC_TOP_BOTTOM) && /* Special case */ - (CacheSlot(SC_TOP_BOTTOM) != - (SetWord(inm(SC_BOTTOM), 1) | SetWord(inm(SC_TOP), 0)))) - { - UncacheRegister(SC_TOP_BOTTOM); - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "SC_TOP_BOTTOM write cache disabled!\n"); - } + if (pATI->Chip >= ATI_CHIP_264VTB) + { + /* + * Flush the read-back cache (by turning on INVALIDATE_RB_CACHE), + * otherwise the host might get stale data when reading through the + * aperture. + */ + outr(MEM_BUF_CNTL, pATI->NewHW.mem_buf_cntl); + } - TestRegisterCaching(DP_BKGD_CLR); - TestRegisterCaching(DP_FRGD_CLR); - TestRegisterCaching(DP_WRITE_MASK); - TestRegisterCaching(DP_MIX); + /* + * Note: + * Before actually invalidating the read-back cache, the mach64 driver + * was using the trick below which is buggy. The code is left here for + * reference, DRI uses this trick and needs updating. + * + * For VTB's and later, the first CPU read of the framebuffer will return + * zeroes, so do it here. This appears to be due to some kind of engine + * caching of framebuffer data I haven't found any way of disabling, or + * otherwise circumventing. Thanks to Mark Vojkovich for the suggestion. + * + * pATI = *(volatile ATIPtr *)pATI->pMemory; + */ +} - TestRegisterCaching(CLR_CMP_CLR); - TestRegisterCaching(CLR_CMP_MSK); - TestRegisterCaching(CLR_CMP_CNTL); +static __inline__ void +TestRegisterCachingDP(ScrnInfoPtr pScreenInfo) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); - if (pATI->Block1Base) - { - TestRegisterCaching(OVERLAY_Y_X_START); - TestRegisterCaching(OVERLAY_Y_X_END); + TestRegisterCaching(SRC_CNTL); - TestRegisterCaching(OVERLAY_GRAPHICS_KEY_CLR); - TestRegisterCaching(OVERLAY_GRAPHICS_KEY_MSK); + if (pATI->Chip >= ATI_CHIP_264GTPRO) + { + TestRegisterCaching(SCALE_3D_CNTL); + } - TestRegisterCaching(OVERLAY_KEY_CNTL); + TestRegisterCaching(HOST_CNTL); - TestRegisterCaching(OVERLAY_SCALE_INC); - TestRegisterCaching(OVERLAY_SCALE_CNTL); + TestRegisterCaching(PAT_REG0); + TestRegisterCaching(PAT_REG1); + TestRegisterCaching(PAT_CNTL); - TestRegisterCaching(SCALER_HEIGHT_WIDTH); + if (RegisterIsCached(SC_LEFT_RIGHT) && /* Special case */ + (CacheSlot(SC_LEFT_RIGHT) != + (SetWord(inm(SC_RIGHT), 1) | SetWord(inm(SC_LEFT), 0)))) + { + UncacheRegister(SC_LEFT_RIGHT); + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "SC_LEFT_RIGHT write cache disabled!\n"); + } - TestRegisterCaching(SCALER_TEST); + if (RegisterIsCached(SC_TOP_BOTTOM) && /* Special case */ + (CacheSlot(SC_TOP_BOTTOM) != + (SetWord(inm(SC_BOTTOM), 1) | SetWord(inm(SC_TOP), 0)))) + { + UncacheRegister(SC_TOP_BOTTOM); + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "SC_TOP_BOTTOM write cache disabled!\n"); + } - TestRegisterCaching(VIDEO_FORMAT); + TestRegisterCaching(DP_BKGD_CLR); + TestRegisterCaching(DP_FRGD_CLR); + TestRegisterCaching(DP_PIX_WIDTH); + TestRegisterCaching(DP_MIX); - if (pATI->Chip < ATI_CHIP_264VTB) - { - TestRegisterCaching(BUF0_OFFSET); - TestRegisterCaching(BUF0_PITCH); - TestRegisterCaching(BUF1_OFFSET); - TestRegisterCaching(BUF1_PITCH); - } - else - { - TestRegisterCaching(SCALER_BUF0_OFFSET); - TestRegisterCaching(SCALER_BUF1_OFFSET); - TestRegisterCaching(SCALER_BUF_PITCH); - - TestRegisterCaching(OVERLAY_EXCLUSIVE_HORZ); - TestRegisterCaching(OVERLAY_EXCLUSIVE_VERT); - - if (pATI->Chip >= ATI_CHIP_264GTPRO) - { - TestRegisterCaching(SCALER_COLOUR_CNTL); - - TestRegisterCaching(SCALER_H_COEFF0); - TestRegisterCaching(SCALER_H_COEFF1); - TestRegisterCaching(SCALER_H_COEFF2); - TestRegisterCaching(SCALER_H_COEFF3); - TestRegisterCaching(SCALER_H_COEFF4); - - TestRegisterCaching(SCALER_BUF0_OFFSET_U); - TestRegisterCaching(SCALER_BUF0_OFFSET_V); - TestRegisterCaching(SCALER_BUF1_OFFSET_U); - TestRegisterCaching(SCALER_BUF1_OFFSET_V); - } - } - } - } + TestRegisterCaching(CLR_CMP_CLR); + TestRegisterCaching(CLR_CMP_MSK); + TestRegisterCaching(CLR_CMP_CNTL); + + if (pATI->Chip >= ATI_CHIP_264GTPRO) + { + TestRegisterCaching(TEX_SIZE_PITCH); } +} - /* - * For VTB's and later, the first CPU read of the framebuffer will return - * zeroes, so do it here. This appears to be due to some kind of engine - * caching of framebuffer data I haven't found any way of disabling, or - * otherwise circumventing. Thanks to Mark Vojkovich for the suggestion. - */ - if (pATI->pXAAInfo) - pATI->pXAAInfo->NeedToSync = FALSE; +static __inline__ void +TestRegisterCachingXV(ScrnInfoPtr pScreenInfo) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + + if (!pATI->Block1Base) + return; + + TestRegisterCaching(OVERLAY_Y_X_START); + TestRegisterCaching(OVERLAY_Y_X_END); - pATI = *(volatile ATIPtr *)pATI->pMemory; + TestRegisterCaching(OVERLAY_GRAPHICS_KEY_CLR); + TestRegisterCaching(OVERLAY_GRAPHICS_KEY_MSK); + + TestRegisterCaching(OVERLAY_KEY_CNTL); + + TestRegisterCaching(OVERLAY_SCALE_INC); + TestRegisterCaching(OVERLAY_SCALE_CNTL); + + TestRegisterCaching(SCALER_HEIGHT_WIDTH); + + TestRegisterCaching(SCALER_TEST); + + TestRegisterCaching(VIDEO_FORMAT); + + if (pATI->Chip < ATI_CHIP_264VTB) + { + TestRegisterCaching(BUF0_OFFSET); + TestRegisterCaching(BUF0_PITCH); + TestRegisterCaching(BUF1_OFFSET); + TestRegisterCaching(BUF1_PITCH); + + return; + } + + TestRegisterCaching(SCALER_BUF0_OFFSET); + TestRegisterCaching(SCALER_BUF1_OFFSET); + TestRegisterCaching(SCALER_BUF_PITCH); + + TestRegisterCaching(OVERLAY_EXCLUSIVE_HORZ); + TestRegisterCaching(OVERLAY_EXCLUSIVE_VERT); + + if (pATI->Chip < ATI_CHIP_264GTPRO) + return; + + TestRegisterCaching(SCALER_COLOUR_CNTL); + + TestRegisterCaching(SCALER_H_COEFF0); + TestRegisterCaching(SCALER_H_COEFF1); + TestRegisterCaching(SCALER_H_COEFF2); + TestRegisterCaching(SCALER_H_COEFF3); + TestRegisterCaching(SCALER_H_COEFF4); + + TestRegisterCaching(SCALER_BUF0_OFFSET_U); + TestRegisterCaching(SCALER_BUF0_OFFSET_V); + TestRegisterCaching(SCALER_BUF1_OFFSET_U); + TestRegisterCaching(SCALER_BUF1_OFFSET_V); } +#ifdef USE_XAA /* * ATIMach64SetupForScreenToScreenCopy -- * @@ -497,6 +510,18 @@ ATIMach64SubsequentScreenToScreenCopy outf(SRC_WIDTH1, w); outf(DST_Y_X, SetWord(xDst, 1) | SetWord(yDst, 0)); outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); + + /* + * On VTB's and later, the engine will randomly not wait for a copy + * operation to commit its results to video memory before starting the next + * one. The probability of such occurrences increases with GUI_WB_FLUSH + * (or GUI_WB_FLUSH_P) setting, bitsPerPixel and/or CRTC clock. This + * would point to some kind of video memory bandwidth problem were it noti + * for the fact that the problem occurs less often (but still occurs) when + * copying larger rectangles. + */ + if ((pATI->Chip >= ATI_CHIP_264VTB) && !pATI->OptionDevel) + ATIMach64Sync(pScreenInfo); } /* @@ -1035,3 +1060,4 @@ ATIMach64AccelInit return ATIMach64MaxY; } +#endif /* USE_XAA */ diff --git a/src/atimach64accel.h b/src/atimach64accel.h index a1b9426..973f2ba 100644 --- a/src/atimach64accel.h +++ b/src/atimach64accel.h @@ -27,11 +27,17 @@ #include "atipriv.h" #include "xaa.h" +#include "exa.h" -#define ATIMach64MaxX 8191 -#define ATIMach64MaxY 32767 +#define ATIMach64MaxX 4095 +#define ATIMach64MaxY 16383 +#ifdef USE_EXA +extern Bool ATIMach64ExaInit(ScreenPtr); +#endif +#ifdef USE_XAA extern int ATIMach64AccelInit(ATIPtr, XAAInfoRecPtr); +#endif extern void ATIMach64Sync(ScrnInfoPtr); #endif /* ___ATIMACH64ACCEL_H___ */ diff --git a/src/atimach64exa.c b/src/atimach64exa.c new file mode 100644 index 0000000..e2b2540 --- /dev/null +++ b/src/atimach64exa.c @@ -0,0 +1,706 @@ +/* + * Copyright 2003 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@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 copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE 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. + */ +/* + * Copyright 1999-2000 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, 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 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. + */ +/* + * DRI support by: + * Manuel Teira + * Leif Delgass <ldelgass@retinalburn.net> + * + * EXA support by: + * Jakub Stachowski <qbast@go2.pl> + * George Sapountzis <gsap7@yahoo.gr> + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <string.h> + +#include "ati.h" +#include "atichip.h" +#include "atidri.h" +#include "atimach64accel.h" +#include "atimach64io.h" +#include "atipriv.h" +#include "atiregs.h" + +#ifdef XF86DRI_DEVEL +#include "mach64_dri.h" +#include "mach64_sarea.h" +#endif + +#ifdef USE_EXA +extern CARD8 ATIMach64ALU[]; + +extern void +ATIMach64ValidateClip +( + ATIPtr pATI, + int sc_left, + int sc_right, + int sc_top, + int sc_bottom +); + +#if 0 +#define MACH64_TRACE(x) \ +do { \ + ErrorF("Mach64(%s): ", __FUNCTION__); \ + ErrorF x; \ +} while(0) +#else +#define MACH64_TRACE(x) do { } while(0) +#endif + +#if 0 +#define MACH64_FALLBACK(x) \ +do { \ + ErrorF("Fallback(%s): ", __FUNCTION__); \ + ErrorF x; \ + return FALSE; \ +} while (0) +#else +#define MACH64_FALLBACK(x) return FALSE +#endif + +static void +Mach64WaitMarker(ScreenPtr pScreenInfo, int Marker) +{ + ATIMach64Sync(xf86Screens[pScreenInfo->myNum]); +} + +static Bool +Mach64GetDatatypeBpp(PixmapPtr pPix, CARD32 *pix_width) +{ + int bpp = pPix->drawable.bitsPerPixel; + + switch (bpp) { + case 8: + *pix_width = + SetBits(PIX_WIDTH_8BPP, DP_DST_PIX_WIDTH) | + SetBits(PIX_WIDTH_8BPP, DP_SRC_PIX_WIDTH) | + SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); + break; + case 16: + *pix_width = + SetBits(PIX_WIDTH_16BPP, DP_DST_PIX_WIDTH) | + SetBits(PIX_WIDTH_16BPP, DP_SRC_PIX_WIDTH) | + SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); + break; + case 24: + *pix_width = + SetBits(PIX_WIDTH_8BPP, DP_DST_PIX_WIDTH) | + SetBits(PIX_WIDTH_8BPP, DP_SRC_PIX_WIDTH) | + SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); + break; + case 32: + *pix_width = + SetBits(PIX_WIDTH_32BPP, DP_DST_PIX_WIDTH) | + SetBits(PIX_WIDTH_32BPP, DP_SRC_PIX_WIDTH) | + SetBits(PIX_WIDTH_1BPP, DP_HOST_PIX_WIDTH); + break; + default: + MACH64_FALLBACK(("Unsupported bpp: %d\n", bpp)); + } + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + + *pix_width |= DP_BYTE_PIX_ORDER; + +#endif /* X_BYTE_ORDER */ + + return TRUE; +} + +static Bool +Mach64GetOffsetPitch(PixmapPtr pPix, int bpp, CARD32 *pitch_offset, + unsigned int offset, unsigned int pitch) +{ +#if 0 + ScrnInfoPtr pScreenInfo = xf86Screens[pPix->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + if (pitch % pATI->pExa->pixmapPitchAlign != 0) + MACH64_FALLBACK(("Bad pitch 0x%08x\n", pitch)); + + if (offset % pATI->pExa->pixmapOffsetAlign != 0) + MACH64_FALLBACK(("Bad offset 0x%08x\n", offset)); +#endif + + /* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */ + pitch = pitch / bpp; + + /* bytes / 8 */ + offset = offset >> 3; + + *pitch_offset = ((pitch << 22) | (offset << 0)); + + return TRUE; +} + +static Bool +Mach64GetPixmapOffsetPitch(PixmapPtr pPix, CARD32 *pitch_offset) +{ + CARD32 pitch, offset; + int bpp; + + bpp = pPix->drawable.bitsPerPixel; + if (bpp == 24) + bpp = 8; + + pitch = exaGetPixmapPitch(pPix); + offset = exaGetPixmapOffset(pPix); + + return Mach64GetOffsetPitch(pPix, bpp, pitch_offset, offset, pitch); +} + +static Bool +Mach64PrepareCopy +( + PixmapPtr pSrcPixmap, + PixmapPtr pDstPixmap, + int xdir, + int ydir, + int alu, + Pixel planemask +) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + CARD32 src_pitch_offset, dst_pitch_offset, dp_pix_width; + + ATIDRISync(pScreenInfo); + + if (!Mach64GetDatatypeBpp(pDstPixmap, &dp_pix_width)) + return FALSE; + if (!Mach64GetPixmapOffsetPitch(pSrcPixmap, &src_pitch_offset)) + return FALSE; + if (!Mach64GetPixmapOffsetPitch(pDstPixmap, &dst_pitch_offset)) + return FALSE; + + ATIMach64WaitForFIFO(pATI, 7); + outf(DP_WRITE_MASK, planemask); + outf(DP_PIX_WIDTH, dp_pix_width); + outf(SRC_OFF_PITCH, src_pitch_offset); + outf(DST_OFF_PITCH, dst_pitch_offset); + + outf(DP_SRC, DP_MONO_SRC_ALLONES | + SetBits(SRC_BLIT, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); + outf(DP_MIX, SetBits(ATIMach64ALU[alu], DP_FRGD_MIX)); + + outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); + + pATI->dst_cntl = 0; + + if (ydir > 0) + pATI->dst_cntl |= DST_Y_DIR; + if (xdir > 0) + pATI->dst_cntl |= DST_X_DIR; + + if (pATI->XModifier == 1) + outf(DST_CNTL, pATI->dst_cntl); + else + pATI->dst_cntl |= DST_24_ROT_EN; + + return TRUE; +} + +static void +Mach64Copy +( + PixmapPtr pDstPixmap, + int srcX, + int srcY, + int dstX, + int dstY, + int w, + int h +) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + srcX *= pATI->XModifier; + dstY *= pATI->XModifier; + w *= pATI->XModifier; + + ATIDRISync(pScreenInfo); + + /* Disable clipping if it gets in the way */ + ATIMach64ValidateClip(pATI, dstX, dstX + w - 1, dstY, dstY + h - 1); + + if (!(pATI->dst_cntl & DST_X_DIR)) + { + srcX += w - 1; + dstX += w - 1; + } + + if (!(pATI->dst_cntl & DST_Y_DIR)) + { + srcY += h - 1; + dstY += h - 1; + } + + if (pATI->XModifier != 1) + outf(DST_CNTL, pATI->dst_cntl | SetBits((dstX / 4) % 6, DST_24_ROT)); + + ATIMach64WaitForFIFO(pATI, 4); + outf(SRC_Y_X, SetWord(srcX, 1) | SetWord(srcY, 0)); + outf(SRC_WIDTH1, w); + outf(DST_Y_X, SetWord(dstX, 1) | SetWord(dstY, 0)); + outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); + + /* + * On VTB's and later, the engine will randomly not wait for a copy + * operation to commit its results to video memory before starting the next + * one. The probability of such occurrences increases with GUI_WB_FLUSH + * (or GUI_WB_FLUSH_P) setting, bitsPerPixel and/or CRTC clock. This + * would point to some kind of video memory bandwidth problem were it noti + * for the fact that the problem occurs less often (but still occurs) when + * copying larger rectangles. + */ + if ((pATI->Chip >= ATI_CHIP_264VTB) && !pATI->OptionDevel) + { + exaMarkSync(pScreenInfo->pScreen); /* Force sync. */ + exaWaitSync(pScreenInfo->pScreen); /* Sync and notify EXA. */ + } +} + +static void Mach64DoneCopy(PixmapPtr pDstPixmap) { } + +static Bool +Mach64PrepareSolid +( + PixmapPtr pPixmap, + int alu, + Pixel planemask, + Pixel fg +) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pPixmap->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + CARD32 dst_pitch_offset, dp_pix_width; + + ATIDRISync(pScreenInfo); + + if (!Mach64GetDatatypeBpp(pPixmap, &dp_pix_width)) + return FALSE; + if (!Mach64GetPixmapOffsetPitch(pPixmap, &dst_pitch_offset)) + return FALSE; + + ATIMach64WaitForFIFO(pATI, 7); + outf(DP_WRITE_MASK, planemask); + outf(DP_PIX_WIDTH, dp_pix_width); + outf(DST_OFF_PITCH, dst_pitch_offset); + + outf(DP_SRC, DP_MONO_SRC_ALLONES | + SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); + outf(DP_FRGD_CLR, fg); + outf(DP_MIX, SetBits(ATIMach64ALU[alu], DP_FRGD_MIX)); + + outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); + + if (pATI->XModifier == 1) + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); + + return TRUE; +} + +static void +Mach64Solid +( + PixmapPtr pPixmap, + int x1, + int y1, + int x2, + int y2 +) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pPixmap->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + int x = x1; + int y = y1; + int w = x2-x1; + int h = y2-y1; + + ATIDRISync(pScreenInfo); + + if (pATI->XModifier != 1) + { + x *= pATI->XModifier; + w *= pATI->XModifier; + + outf(DST_CNTL, SetBits((x / 4) % 6, DST_24_ROT) | + (DST_X_DIR | DST_Y_DIR | DST_24_ROT_EN)); + } + + /* Disable clipping if it gets in the way */ + ATIMach64ValidateClip(pATI, x, x + w - 1, y, y + h - 1); + + ATIMach64WaitForFIFO(pATI, 2); + outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); + outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); +} + +static void Mach64DoneSolid(PixmapPtr pPixmap) { } + +/* + * Memcpy-based UTS. + */ +static Bool +Mach64UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, + char *src, int src_pitch) +{ + char *dst = pDst->devPrivate.ptr; + int dst_pitch = exaGetPixmapPitch(pDst); + + int bpp = pDst->drawable.bitsPerPixel; + int cpp = (bpp + 7) / 8; + int wBytes = w * cpp; + + exaWaitSync(pDst->drawable.pScreen); + + dst += (x * cpp) + (y * dst_pitch); + + while (h--) { + memcpy(dst, src, wBytes); + src += src_pitch; + dst += dst_pitch; + } + + return TRUE; +} + +/* + * Memcpy-based DFS. + */ +static Bool +Mach64DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, + char *dst, int dst_pitch) +{ + char *src = pSrc->devPrivate.ptr; + int src_pitch = exaGetPixmapPitch(pSrc); + + int bpp = pSrc->drawable.bitsPerPixel; + int cpp = (bpp + 7) / 8; + int wBytes = w * cpp; + + exaWaitSync(pSrc->drawable.pScreen); + + src += (x * cpp) + (y * src_pitch); + + while (h--) { + memcpy(dst, src, wBytes); + src += src_pitch; + dst += dst_pitch; + } + + return TRUE; +} + +#include "atimach64render.c" + +/* Compute log base 2 of val. */ +static __inline__ int Mach64Log2(int val) +{ + int bits; + + for (bits = 0; val != 0; val >>= 1, ++bits) + ; + return bits - 1; +} + +/* + * Memory layour for EXA with DRI (no local_textures): + * | front | back | depth | textures | pixmaps, xv | c | + * + * 1024x768@16bpp with 8 MB: + * | 1.5 MB | 1.5 MB | 1.5 MB | 0 | ~3.5 MB | c | + * + * 1024x768@32bpp with 8 MB: + * | 3.0 MB | 3.0 MB | 1.5 MB | 0 | ~0.5 MB | c | + * + * "c" is the hw cursor which occupies 1KB + */ +static void +Mach64SetupMemEXA(ScreenPtr pScreen) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + int cpp = (pScreenInfo->bitsPerPixel + 7) / 8; + /* front and back buffer */ + int bufferSize = pScreenInfo->virtualY * pScreenInfo->displayWidth * cpp; + /* always 16-bit z-buffer */ + int depthSize = pScreenInfo->virtualY * pScreenInfo->displayWidth * 2; + + ExaDriverPtr pExa = pATI->pExa; + + pExa->memoryBase = pATI->pMemory; + pExa->memorySize = pScreenInfo->videoRam * 1024; + pExa->offScreenBase = bufferSize; + +#ifdef XF86DRI_DEVEL + if (pATI->directRenderingEnabled) + { + ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; + Bool is_pci = pATIDRIServer->IsPCI; + + int textureSize = 0; + int pixmapCache = 0; + int next = 0; + + /* front buffer */ + pATIDRIServer->frontOffset = 0; + pATIDRIServer->frontPitch = pScreenInfo->displayWidth; + next += bufferSize; + + /* back buffer */ + pATIDRIServer->backOffset = next; + pATIDRIServer->backPitch = pScreenInfo->displayWidth; + next += bufferSize; + + /* depth buffer */ + pATIDRIServer->depthOffset = next; + pATIDRIServer->depthPitch = pScreenInfo->displayWidth; + next += depthSize; + + /* ATIScreenInit does check for the this condition. */ + if (next > pExa->memorySize) + { + xf86DrvMsg(pScreen->myNum, X_WARNING, + "DRI static buffer allocation failed, disabling DRI --" + "need at least %d kB video memory\n", next / 1024 ); + ATIDRICloseScreen(pScreen); + pATI->directRenderingEnabled = FALSE; + } + + /* local textures */ + + /* Reserve approx. half of offscreen memory for local textures */ + textureSize = (pExa->memorySize - next) / 2; + + /* In case DRI requires more offscreen memory than available, + * should not happen as ATIScreenInit would have not enabled DRI */ + if (textureSize < 0) + textureSize = 0; + + /* Try for enough pixmap cache for a full viewport */ + pixmapCache = (pExa->memorySize - next) - textureSize; + if (pixmapCache < bufferSize) + textureSize = 0; + + /* Don't allocate a local texture heap for AGP unless requested */ + if ( !is_pci && !pATI->OptionLocalTextures ) + textureSize = 0; + + if (textureSize > 0) + { + int l = Mach64Log2(textureSize / MACH64_NR_TEX_REGIONS); + if (l < MACH64_LOG_TEX_GRANULARITY) + l = MACH64_LOG_TEX_GRANULARITY; + pATIDRIServer->logTextureGranularity = l; + + /* Round the texture size down to the nearest whole number of + * texture regions. + */ + textureSize = (textureSize >> l) << l; + } + + /* Set a minimum usable local texture heap size. This will fit + * two 256x256 textures. We check this after any rounding of + * the texture area. + */ + if (textureSize < 256*256 * cpp * 2) + textureSize = 0; + + /* Disable DRI for PCI if cannot allocate a local texture heap */ + if ( is_pci && textureSize == 0 ) + { + xf86DrvMsg(pScreen->myNum, X_WARNING, + "Not enough memory for local textures, disabling DRI\n"); + ATIDRICloseScreen(pScreen); + pATI->directRenderingEnabled = FALSE; + } + + pATIDRIServer->textureOffset = next; + pATIDRIServer->textureSize = textureSize; + next += textureSize; + + if (pATI->directRenderingEnabled) + pExa->offScreenBase = next; + } +#endif /* XF86DRI_DEVEL */ + + xf86DrvMsg(pScreen->myNum, X_INFO, + "EXA memory management initialized\n" + "\t base : %10p\n" + "\t offscreen: +%10lx\n" + "\t size : +%10lx\n" + "\t cursor : %10p\n", + pExa->memoryBase, + pExa->offScreenBase, + pExa->memorySize, + pATI->pCursorImage); + + if (TRUE || xf86GetVerbosity() > 1) + { + int offscreen = pExa->memorySize - pExa->offScreenBase; + int viewport = bufferSize; + int dvdframe = 720*480*cpp; /* enough for single-buffered DVD */ + + xf86DrvMsg(pScreen->myNum, X_INFO, + "Will use %d kB of offscreen memory for EXA\n" + "\t\t or %5.2f viewports (composite)\n" + "\t\t or %5.2f dvdframes (xvideo)\n", + offscreen / 1024, + 1.0 * offscreen / viewport, + 1.0 * offscreen / dvdframe); + } + +#ifdef XF86DRI_DEVEL + if (pATI->directRenderingEnabled) + { + ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; + + xf86DrvMsg(pScreen->myNum, X_INFO, + "Will use back buffer at offset 0x%x\n", + pATIDRIServer->backOffset); + + xf86DrvMsg(pScreen->myNum, X_INFO, + "Will use depth buffer at offset 0x%x\n", + pATIDRIServer->depthOffset); + + if (pATIDRIServer->textureSize > 0) + { + xf86DrvMsg(pScreen->myNum, X_INFO, + "Will use %d kB for local textures at offset 0x%x\n", + pATIDRIServer->textureSize/1024, + pATIDRIServer->textureOffset); + } + } +#endif /* XF86DRI_DEVEL */ + + pExa->pixmapOffsetAlign = 64; + pExa->pixmapPitchAlign = 64; + + pExa->flags = EXA_OFFSCREEN_PIXMAPS; + + pExa->maxX = ATIMach64MaxX; + pExa->maxY = ATIMach64MaxY; +} + +Bool ATIMach64ExaInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + ExaDriverPtr pExa; + + /* FIXME: which chips support EXA ? */ + if (pATI->Chip < ATI_CHIP_264CT) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "EXA is not supported for ATI chips earlier than " + "the ATI Mach64.\n"); + return FALSE; + } + + pExa = exaDriverAlloc(); + if (!pExa) + return FALSE; + + pATI->pExa = pExa; + + pExa->exa_major = 2; + pExa->exa_minor = 0; + + Mach64SetupMemEXA(pScreen); + + pExa->WaitMarker = Mach64WaitMarker; + + pExa->PrepareSolid = Mach64PrepareSolid; + pExa->Solid = Mach64Solid; + pExa->DoneSolid = Mach64DoneSolid; + + pExa->PrepareCopy = Mach64PrepareCopy; + pExa->Copy = Mach64Copy; + pExa->DoneCopy = Mach64DoneCopy; + + /* EXA hits more optimized paths when it does not have to fallback because + * of missing UTS/DFS, hook memcpy-based UTS/DFS. + */ + pExa->UploadToScreen = Mach64UploadToScreen; + pExa->DownloadFromScreen = Mach64DownloadFromScreen; + + if (pATI->RenderAccelEnabled) { + if (pATI->Chip >= ATI_CHIP_264GTPRO) { + /* 3D Rage Pro does not support NPOT textures. */ + pExa->flags |= EXA_OFFSCREEN_ALIGN_POT; + + pExa->CheckComposite = Mach64CheckComposite; + pExa->PrepareComposite = Mach64PrepareComposite; + pExa->Composite = Mach64Composite; + pExa->DoneComposite = Mach64DoneComposite; + } else { + xf86DrvMsg(pScreen->myNum, X_INFO, + "Render acceleration is not supported for ATI chips " + "earlier than the ATI 3D Rage Pro.\n"); + pATI->RenderAccelEnabled = FALSE; + } + } + + xf86DrvMsg(pScreen->myNum, X_INFO, "Render acceleration %s\n", + pATI->RenderAccelEnabled ? "enabled" : "disabled"); + + if (!exaDriverInit(pScreen, pATI->pExa)) { + xfree(pATI->pExa); + pATI->pExa = NULL; + return FALSE; + } + + return TRUE; +} +#endif diff --git a/src/atimach64io.h b/src/atimach64io.h index 9dbf244..e2d3c7c 100644 --- a/src/atimach64io.h +++ b/src/atimach64io.h @@ -206,6 +206,10 @@ extern void ATIMach64PollEngineStatus(ATIPtr); #ifdef XF86DRI_DEVEL +/* + * DRI Sync and Lock definitions. + */ + #define ATIDRIWaitForIdle(_pATI) \ do { \ ATIDRIServerInfoPtr pATIDRIServer = _pATI->pDRIServerInfo; \ @@ -226,6 +230,53 @@ do { \ } \ } while (0) +/* + * Set upon DRISwapContext and when DRI accesses the GPU engine + * from within the server, see DRIInitBuffers/DRIMoveBuffers. + * + * Forces the EXA/XAA software paths to sync before accessing the FB memory. + */ +static __inline__ void ATIDRIMarkSyncInt(ScrnInfoPtr _pScrInfo) +{ + ATIPtr _pATI=ATIPTR(_pScrInfo); +#ifdef USE_EXA + if (_pATI->useEXA) + exaMarkSync(_pScrInfo->pScreen); +#endif +#ifdef USE_XAA + if (!_pATI->useEXA) + SET_SYNC_FLAG(_pATI->pXAAInfo); /* NeedToSync = TRUE */ +#endif +} + +/* + * Set upon DRISwapContext and when the server acquires the DRI lock. + * + * Forces the EXA/XAA accelerated paths to sync before accessing the GPU engine. + */ +static __inline__ void ATIDRIMarkSyncExt(ScrnInfoPtr _pScrInfo) +{ + ATIPtr _pATI=ATIPTR(_pScrInfo); + _pATI->NeedDRISync = TRUE; +} + +static __inline__ void ATIDRISync(ScrnInfoPtr _pScrInfo) +{ + ATIPtr _pATI=ATIPTR(_pScrInfo); +#ifdef USE_EXA + if (_pATI->directRenderingEnabled && _pATI->pExa) + { + if (_pATI->NeedDRISync) exaWaitSync(_pScrInfo->pScreen); + } +#endif +#ifdef USE_XAA + if (_pATI->directRenderingEnabled && _pATI->pXAAInfo) + { + if (_pATI->NeedDRISync) (*_pATI->pXAAInfo->Sync)(_pScrInfo); + } +#endif +} + #define ATIDRILock(_pScrInfo) \ do \ { \ @@ -233,7 +284,7 @@ do \ if (_pATI->directRenderingEnabled) \ { \ DRILock(_pScrInfo->pScreen, 0); \ - pATI->NeedDRISync = TRUE; \ + ATIDRIMarkSyncExt(_pScrInfo); \ } \ } while (0) @@ -247,16 +298,6 @@ do \ } \ } while (0) -#define ATIDRISync(_pScrInfo) \ -do \ -{ \ - ATIPtr _pATI=ATIPTR(_pScrInfo); \ - if (_pATI->directRenderingEnabled && _pATI->pXAAInfo) \ - { \ - if (_pATI->NeedDRISync) (*_pATI->pXAAInfo->Sync)(_pScrInfo); \ - } \ -} while (0) - #else /* XF86DRI_DEVEL */ @@ -368,4 +409,11 @@ extern void ATIMach64AccessPLLReg(ATIPtr, const CARD8, const Bool); #endif +/* + * Return the MMIO address of register, used for HOST_DATA_X only. + */ +#define ATIHostDataAddr(_Register) \ + ((CARD8 *)pATI->pBlock[GetBits(_Register, BLOCK_SELECT)] + \ + ((_Register) & MM_IO_SELECT)) + #endif /* ___ATIMACH64IO_H___ */ diff --git a/src/atimach64render.c b/src/atimach64render.c new file mode 100644 index 0000000..8a6ebbc --- /dev/null +++ b/src/atimach64render.c @@ -0,0 +1,891 @@ +/* + * Copyright 2006 George Sapountzis + * All Rights Reserved. + * + * Based on the mach64 DRI and DRM drivers: + * Copyright 2000 Gareth Hughes + * Copyright 2002-2003 Leif Delgass + * All Rights Reserved. + * + * Based on the ati hw/kdrive driver: + * Copyright 2003 Eric Anholt, Anders Carlsson + * + * Based on the via hw/xfree86 driver: + * Copyright 2006 Thomas Hellstrom. 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, 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. + * + * Authors: + * George Sapountzis <gsap7@yahoo.gr> + */ + +/* + * Interesting cases for RENDER acceleration: + * + * cursor : ARGB8888 (24x24) Over + * RGB565 + * + * glyph : A8 (9x10) Add + * A8 (420x13) + * glyph set : ARGB8888 (1x1 R) In + * A8 (420x13) Over + * RGB565 + * + * shadow : ARGB8888 (1x1 R) In + * A8 (670x362) Over + * RGB565 + * translucent : RGB565 (652x344) In + * A8 (1x1 R) Over + * RGB565 + * + * In all interesting cases one of src/mask is "1x1 R". + */ + +/* + * Assumptions and limitations of mach64 RENDER acceleration: + * + * RENDER acceleration is supported for GTPRO and later chips using the 3D + * triangle setup, i.e. the VERTEX_? registers (see the dri driver). According + * to atiregs.h, SCALE_3D_CNTL and TEX_?_OFF appear in GT, thus chips as old + * as GT should be capable of RENDER acceleration, using the S_?_INC, T_?_INC + * registers for texture mapping (see the directfb driver). + * + * GTPRO added a triangle setup engine and multitexturing. However, it seems + * that none of the 8bpp mach64 formats expands the 8bit value to the alpha + * channel in texture mapping, RGB8 appears to expand to (I,I,I,0). This makes + * GTPRO multitexturing unsuitable for emulating the IN operation. Moreover, + * it seems that GT/GTPRO has a muxltiplexer instead of a blender for computing + * the final alpha channel which forbids destinations with an alpha channel and + * generic two-pass compositing. + * + * A texture unit combines the fragment color (VERTEX_?_ARGB) coming in from + * triangle rasterization with the texel from the texture according to the + * texture environment (TEX_LIGHT_FCN_). "1x1 R" textures may come in as frag- + * ment colors, eliminating the need for multitexturing in all interesting + * cases (via also uses this optimization). + * + * Texture registers are saved/restored and cached (see atimach64.c). TEX_CNTL + * cannot be cached because it flushes the texture cache. TEX_?_OFF are also + * not cached because I am not sure whether writing at some offset register + * affects the value at another offset. + * + * Vertex registers are not saved/restored. This shouldn't be a problem though + * either for DRI or VT switch because vertex registers are set and used within + * a signle acceleration hook. Synchronization between the DDX and DRI is based + * on calling ATIDRISync() at the beginning of each DDX acceleration hook, + * which suggests the assumption that individual acceleration hooks are not + * interrupted. + */ + +#include <string.h> +#include <stdio.h> + +/* + * Helper functions copied from exa and via. + */ + +#if 0 +static void +Mach64ExaCompositePictDesc(PicturePtr pict, char *string, int n) +{ + char format[20]; + char size[20]; + + if (!pict) { + snprintf(string, n, "None"); + return; + } + + switch (pict->format) { + case PICT_x8r8g8b8: + snprintf(format, 20, "RGB8888 "); + break; + case PICT_x8b8g8r8: + snprintf(format, 20, "BGR8888 "); + break; + case PICT_a8r8g8b8: + snprintf(format, 20, "ARGB8888"); + break; + case PICT_a8b8g8r8: + snprintf(format, 20, "ABGR8888"); + break; + case PICT_r5g6b5: + snprintf(format, 20, "RGB565 "); + break; + case PICT_x1r5g5b5: + snprintf(format, 20, "RGB555 "); + break; + case PICT_a8: + snprintf(format, 20, "A8 "); + break; + case PICT_a1: + snprintf(format, 20, "A1 "); + break; + default: + snprintf(format, 20, "0x%x", (int)pict->format); + break; + } + + snprintf(size, 20, "%dx%d%s%s", + pict->pDrawable->width, + pict->pDrawable->height, + pict->repeat ? " R" : "", + pict->componentAlpha ? " C" : "" + ); + + snprintf(string, n, "%-10p: fmt %s (%s)", (void *)pict->pDrawable, format, size); +} + +static void +Mach64ExaPrintComposite(CARD8 op, + PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, char *string) +{ + char sop[20]; + char srcdesc[40], maskdesc[40], dstdesc[40]; + + switch (op) { + case PictOpSrc: + sprintf(sop, "Src"); + break; + case PictOpOver: + sprintf(sop, "Over"); + break; + case PictOpInReverse: + sprintf(sop, "InR"); + break; + case PictOpOutReverse: + sprintf(sop, "OutR"); + break; + case PictOpAdd: + sprintf(sop, "Add"); + break; + default: + sprintf(sop, "0x%x", (int)op); + break; + } + + Mach64ExaCompositePictDesc(pSrc, srcdesc, 40); + Mach64ExaCompositePictDesc(pMask, maskdesc, 40); + Mach64ExaCompositePictDesc(pDst, dstdesc, 40); + + sprintf(string, "op %s, \n" + " src %s\n" + " mask %s\n" + " dst %s\n", sop, srcdesc, maskdesc, dstdesc); +} +#endif + +static __inline__ CARD32 +viaBitExpandHelper(CARD32 component, CARD32 bits) +{ + CARD32 tmp, mask; + + mask = (1 << (8 - bits)) - 1; + tmp = component << (8 - bits); + return ((component & 1) ? tmp | mask : tmp); +} + +static __inline__ void +Mach64PixelARGB(PixmapPtr pPixmap, CARD32 format, CARD32 *argb) +{ + CARD32 pixel; + CARD8 comp; + int bits, shift; + + /* Ensure that texture drawing has completed. */ + exaWaitSync(pPixmap->drawable.pScreen); + + /* exaGetPixmapFirstPixel() */ + + switch (pPixmap->drawable.bitsPerPixel) { + case 32: + pixel = *(CARD32 *)(pPixmap->devPrivate.ptr); + break; + case 16: + pixel = *(CARD16 *)(pPixmap->devPrivate.ptr); + break; + default: + pixel = *(CARD8 *)(pPixmap->devPrivate.ptr); + break; + } + + /* exaGetRGBAFromPixel()/viaPixelARGB8888() */ + + switch (PICT_FORMAT_TYPE(format)) { + case PICT_TYPE_A: + shift = 0; + bits = PICT_FORMAT_A(format); + comp = (pixel >> shift) & ((1 << bits) - 1); + comp = viaBitExpandHelper(comp, bits); + *argb = comp << 24; + break; + case PICT_TYPE_ARGB: + shift = 0; + bits = PICT_FORMAT_B(format); + comp = (pixel >> shift) & ((1 << bits) - 1); + comp = viaBitExpandHelper(comp, bits); + *argb = comp; + + shift += bits; + bits = PICT_FORMAT_G(format); + comp = (pixel >> shift) & ((1 << bits) - 1); + comp = viaBitExpandHelper(comp, bits); + *argb |= comp << 8; + + shift += bits; + bits = PICT_FORMAT_R(format); + comp = (pixel >> shift) & ((1 << bits) - 1); + comp = viaBitExpandHelper(comp, bits); + *argb |= comp << 16; + + shift += bits; + bits = PICT_FORMAT_A(format); + if (bits) { + comp = (pixel >> shift) & ((1 << bits) - 1); + comp = viaBitExpandHelper(comp, bits); + } else { + comp = 0xff; + } + *argb |= comp << 24; + break; + case PICT_TYPE_ABGR: + break; + default: + break; + } +} + +/* + * RENDER acceleration for mach64 + */ + +typedef struct { + Bool supported; + CARD32 scale_3d_cntl; +} Mach64BlendOp; + +static Mach64BlendOp Mach64BlendOps[] = { + /* Clear */ + {1, MACH64_ALPHA_BLEND_SRC_ZERO | MACH64_ALPHA_BLEND_DST_ZERO}, + /* Src */ + {1, MACH64_ALPHA_BLEND_SRC_ONE | MACH64_ALPHA_BLEND_DST_ZERO}, + /* Dst */ + {1, MACH64_ALPHA_BLEND_SRC_ZERO | MACH64_ALPHA_BLEND_DST_ONE}, + /* Over */ + {1, MACH64_ALPHA_BLEND_SRC_ONE | MACH64_ALPHA_BLEND_DST_INVSRCALPHA}, + /* OverReverse */ + {1, MACH64_ALPHA_BLEND_SRC_INVDSTALPHA | MACH64_ALPHA_BLEND_DST_ONE}, + /* In */ + {1, MACH64_ALPHA_BLEND_SRC_DSTALPHA | MACH64_ALPHA_BLEND_DST_ZERO}, + /* InReverse */ + {1, MACH64_ALPHA_BLEND_SRC_ZERO | MACH64_ALPHA_BLEND_DST_SRCALPHA}, + /* Out */ + {1, MACH64_ALPHA_BLEND_SRC_INVDSTALPHA | MACH64_ALPHA_BLEND_DST_ZERO}, + /* OutReverse */ + {1, MACH64_ALPHA_BLEND_SRC_ZERO | MACH64_ALPHA_BLEND_DST_INVSRCALPHA}, + /* Atop */ + {0, MACH64_ALPHA_BLEND_SRC_DSTALPHA | MACH64_ALPHA_BLEND_DST_INVSRCALPHA}, + /* AtopReverse */ + {0, MACH64_ALPHA_BLEND_SRC_INVDSTALPHA | MACH64_ALPHA_BLEND_DST_SRCALPHA}, + /* Xor */ + {1, MACH64_ALPHA_BLEND_SRC_INVDSTALPHA | MACH64_ALPHA_BLEND_DST_INVSRCALPHA}, + /* Add */ + {1, MACH64_ALPHA_BLEND_SRC_ONE | MACH64_ALPHA_BLEND_DST_ONE} +}; + +#define MACH64_NR_BLEND_OPS \ + (sizeof(Mach64BlendOps) / sizeof(Mach64BlendOps[0])) + +typedef struct { + CARD32 pictFormat; + CARD32 dstFormat; + CARD32 texFormat; +} Mach64TexFormat; + +static Mach64TexFormat Mach64TexFormats[] = { + {PICT_a8r8g8b8, -1, MACH64_DATATYPE_ARGB8888}, + {PICT_x8r8g8b8, MACH64_DATATYPE_ARGB8888, MACH64_DATATYPE_ARGB8888}, + {PICT_a1r5g5b5, -1, MACH64_DATATYPE_ARGB1555}, + {PICT_x1r5g5b5, MACH64_DATATYPE_ARGB1555, MACH64_DATATYPE_ARGB1555}, + {PICT_r5g6b5, MACH64_DATATYPE_RGB565, MACH64_DATATYPE_RGB565 }, + {PICT_a8, MACH64_DATATYPE_RGB8, MACH64_DATATYPE_RGB8 } +}; + +#define MACH64_NR_TEX_FORMATS \ + (sizeof(Mach64TexFormats) / sizeof(Mach64TexFormats[0])) + +#define MACH64_PICT_IS_1x1R(_pPict) \ + ((_pPict) && \ + (_pPict)->pDrawable->width == 1 && \ + (_pPict)->pDrawable->height == 1 && \ + (_pPict)->repeat) + +/* + * CheckComposite hook helper functions. + */ +static __inline__ Bool +Mach64GetOrder(int val, int *shift) +{ + *shift = 0; + + while (val > (1 << *shift)) + (*shift)++; + + return (val == (1 << *shift)); +} + +static Bool +Mach64CheckTexture(PicturePtr pPict) +{ + int w = pPict->pDrawable->width; + int h = pPict->pDrawable->height; + int l2w, l2h, level, i; + + for (i = 0; i < MACH64_NR_TEX_FORMATS; i++) { + if (Mach64TexFormats[i].pictFormat == pPict->format) + break; + } + + if (i == MACH64_NR_TEX_FORMATS) + MACH64_FALLBACK(("Unsupported picture format 0x%x\n", + (int)pPict->format)); + + /* l2w equals l2p (pitch) for all interesting cases (w >= 64) */ + Mach64GetOrder(w, &l2w); + Mach64GetOrder(h, &l2h); + + level = (l2w > l2h) ? l2w : l2h; + + if (level > 10) + MACH64_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h)); + + return TRUE; +} + +/* + * CheckComposite acceleration hook. + */ +Bool +Mach64CheckComposite +( + int op, + PicturePtr pSrcPicture, + PicturePtr pMaskPicture, + PicturePtr pDstPicture +) +{ + Bool src_solid, mask_solid, mask_comp, op_comp; + int i; + + if (op >= MACH64_NR_BLEND_OPS || !Mach64BlendOps[op].supported) + return FALSE; + + if (!Mach64CheckTexture(pSrcPicture)) + return FALSE; + + if (pMaskPicture && !Mach64CheckTexture(pMaskPicture)) + return FALSE; + + /* Check destination format */ + + for (i = 0; i < MACH64_NR_TEX_FORMATS; i++) { + if (Mach64TexFormats[i].pictFormat == pDstPicture->format) + break; + } + + if (i == MACH64_NR_TEX_FORMATS || Mach64TexFormats[i].dstFormat == -1) + MACH64_FALLBACK(("Unsupported dst format 0x%x\n", + (int)pDstPicture->format)); + + /* Check that A8 src/dst appears only as "A8 ADD A8" */ + + if (pDstPicture->format == PICT_a8) { + if (pMaskPicture || pSrcPicture->format != PICT_a8 || op != PictOpAdd) + MACH64_FALLBACK(("A8 dst with mask or non-A8 src.\n")); + } + + if (pDstPicture->format != PICT_a8) { + if (pSrcPicture->format == PICT_a8) + MACH64_FALLBACK(("A8 src with non-A8 dst.\n")); + } + + /* Check that one of src/mask can come in as the fragment color. */ + + src_solid = MACH64_PICT_IS_1x1R(pSrcPicture); + + mask_solid = MACH64_PICT_IS_1x1R(pMaskPicture); + + mask_comp = pMaskPicture && pMaskPicture->componentAlpha; + + op_comp = op == PictOpAdd || + op == PictOpInReverse || + op == PictOpOutReverse; + + if (mask_solid && src_solid) + MACH64_FALLBACK(("Bad one-pixel IN composite operation.\n")); + + if (pMaskPicture) { + if (!mask_solid && !src_solid) + MACH64_FALLBACK(("Multitexturing required.\n")); + + if (!mask_solid && !op_comp) + MACH64_FALLBACK(("Non-solid mask.\n")); + + if (mask_comp && !src_solid) + MACH64_FALLBACK(("Component-alpha mask.\n")); + + if (!mask_comp && pMaskPicture->format != PICT_a8) + MACH64_FALLBACK(("Non-A8 mask.\n")); + + if (mask_comp && pMaskPicture->format != PICT_a8r8g8b8) + MACH64_FALLBACK(("Non-ARGB mask.\n")); + } + + return TRUE; +} + +/* + * This function setups the fragment color from a solid pixmap in the presence + * of a mask. + */ +static __inline__ Bool +Mach64PrepareMask +( + Mach64ContextRegs3D *m3d, + int op, + PicturePtr pSrcPicture, + PicturePtr pMaskPicture, + PixmapPtr pSrc, + PixmapPtr pMask +) +{ + Bool mask_solid, src_solid; + CARD32 argb = 0; + + mask_solid = MACH64_PICT_IS_1x1R(pMaskPicture); + + src_solid = MACH64_PICT_IS_1x1R(pSrcPicture); + + if (mask_solid) { + Mach64PixelARGB(pMask, pMaskPicture->format, &argb); + argb >>= 24; + argb &= 0xff; + + m3d->frag_mask = TRUE; + m3d->frag_color = (argb << 24) | (argb << 16) | (argb << 8) | argb; + return TRUE; + } + + if (src_solid) { + /* We can only handle cases where either the src color (e.g. ADD) or + * the src alpha (e.g. IN_REV, OUT_REV) is used but not both. + * + * (ARGB8888 IN A8) OVER RGB565 is implemented as: + * (ARGB8888 IN A8) ADD ((ARGB8888 IN A8) OUT_REV RGB565). + */ + if (op == PictOpInReverse || op == PictOpOutReverse) { + Mach64PixelARGB(pSrc, pSrcPicture->format, &argb); + argb >>= 24; + argb &= 0xff; + + m3d->frag_src = TRUE; + m3d->frag_color = (argb << 24) | (argb << 16) | (argb << 8) | argb; + m3d->color_alpha = TRUE; + return TRUE; + } + + if (op == PictOpAdd) { + Mach64PixelARGB(pSrc, pSrcPicture->format, &argb); + + m3d->frag_src = TRUE; + m3d->frag_color = argb; + return TRUE; + } + } + + return FALSE; +} + +/* + * This function setups the texturing and blending environments. It also + * manipulates blend control for non-solid masks. + */ +static void __inline__ +Mach64BlendCntl(Mach64ContextRegs3D *m3d, int op) +{ + m3d->scale_3d_cntl |= MACH64_SCALE_PIX_EXPAND_DYNAMIC_RANGE | + MACH64_SCALE_DITHER_2D_TABLE | + MACH64_DITHER_INIT_RESET; + + m3d->scale_3d_cntl |= Mach64BlendOps[op].scale_3d_cntl; + + if (m3d->color_alpha) { + /* A8 uses RGB8 which expands to (I,I,I,0). Thus, we use the color + * channels instead of the alpha channel as the alpha factor. We also + * use the color channels for ARGB8888 masks with component-alpha. + */ + CARD32 Ad = m3d->scale_3d_cntl & MACH64_ALPHA_BLEND_DST_MASK; + + /* InReverse */ + if (Ad == MACH64_ALPHA_BLEND_DST_SRCALPHA) { + m3d->scale_3d_cntl &= ~MACH64_ALPHA_BLEND_DST_MASK; + m3d->scale_3d_cntl |= MACH64_ALPHA_BLEND_DST_SRCCOLOR; + } + + /* OutReverse */ + if (Ad == MACH64_ALPHA_BLEND_DST_INVSRCALPHA) { + m3d->scale_3d_cntl &= ~MACH64_ALPHA_BLEND_DST_MASK; + m3d->scale_3d_cntl |= MACH64_ALPHA_BLEND_DST_INVSRCCOLOR; + } + } + + /* Can't color mask and blend at the same time */ + m3d->dp_write_mask = 0xffffffff; + + /* Can't fog and blend at the same time */ + m3d->scale_3d_cntl |= MACH64_ALPHA_FOG_EN_ALPHA; + + /* Enable texture mapping mode */ + m3d->scale_3d_cntl |= MACH64_SCALE_3D_FCN_TEXTURE; + m3d->scale_3d_cntl |= MACH64_MIP_MAP_DISABLE; + + /* Setup the texture environment */ + m3d->scale_3d_cntl |= MACH64_TEX_LIGHT_FCN_MODULATE; + + /* Initialize texture unit */ + m3d->tex_cntl |= MACH64_TEX_ST_DIRECT | + MACH64_TEX_SRC_LOCAL | + MACH64_TEX_UNCOMPRESSED | + MACH64_TEX_CACHE_FLUSH | + MACH64_TEX_CACHE_SIZE_4K; +} + +/* + * This function setups the texture unit. + */ +static Bool +Mach64PrepareTexture(PicturePtr pPict, PixmapPtr pPix) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pPix->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + Mach64ContextRegs3D *m3d = &pATI->m3d; + + CARD32 texFormat; + + int w = pPict->pDrawable->width; + int h = pPict->pDrawable->height; + int l2w, l2h, l2p, level, pitch, cpp, i; + + /* Prepare picture format */ + for (i = 0; i < MACH64_NR_TEX_FORMATS; i++) { + if (Mach64TexFormats[i].pictFormat == pPict->format) + break; + } + texFormat = Mach64TexFormats[i].texFormat; + + /* Prepare picture size */ + cpp = PICT_FORMAT_BPP(pPict->format) / 8; + pitch = exaGetPixmapPitch(pPix) / cpp; + + Mach64GetOrder(w, &l2w); + Mach64GetOrder(h, &l2h); + Mach64GetOrder(pitch, &l2p); + + if (pPict->repeat && w == 1 && h == 1) + l2p = 0; + else if (pPict->repeat) + MACH64_FALLBACK(("Repeat not supported for w,h != 1,1\n")); + + l2w = l2p; + + level = (l2w > l2h) ? l2w : l2h; + + m3d->tex_width = (1 << l2w); + m3d->tex_height = (1 << l2h); + + /* Update hw state */ + m3d->dp_pix_width |= SetBits(texFormat, DP_SCALE_PIX_WIDTH); + + m3d->tex_size_pitch = (l2w << 0) | + (level << 4) | + (l2h << 8); + + m3d->tex_offset = exaGetPixmapOffset(pPix); + + if (PICT_FORMAT_A(pPict->format)) + m3d->scale_3d_cntl |= MACH64_TEX_MAP_AEN; + + switch (pPict->filter) { + case PictFilterNearest: + m3d->scale_3d_cntl |= MACH64_TEX_BLEND_FCN_NEAREST; + break; + case PictFilterBilinear: + /* FIXME */ +#if 0 + m3d->scale_3d_cntl |= MACH64_TEX_BLEND_FCN_LINEAR; + m3d->scale_3d_cntl |= MACH64_BILINEAR_TEX_EN; +#endif + MACH64_FALLBACK(("Bilinear filter 0x%x\n", pPict->filter)); + break; + default: + MACH64_FALLBACK(("Bad filter 0x%x\n", pPict->filter)); + } + + m3d->transform = pPict->transform; + + return TRUE; +} + +/* + * PrepareComposite acceleration hook. + */ +Bool +Mach64PrepareComposite +( + int op, + PicturePtr pSrcPicture, + PicturePtr pMaskPicture, + PicturePtr pDstPicture, + PixmapPtr pSrc, + PixmapPtr pMask, + PixmapPtr pDst +) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pDst->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + Mach64ContextRegs3D *m3d = &pATI->m3d; + + CARD32 dstFormat; + int offset, i; + + ATIDRISync(pScreenInfo); + + /* Initialize state */ + m3d->dp_mix = SetBits(MIX_SRC, DP_BKGD_MIX) | + SetBits(MIX_SRC, DP_FRGD_MIX); + + m3d->dp_src = SetBits(SRC_SCALER_3D, DP_BKGD_SRC) | + SetBits(SRC_SCALER_3D, DP_FRGD_SRC) | + DP_MONO_SRC_ALLONES; + + Mach64GetPixmapOffsetPitch(pDst, &m3d->dst_pitch_offset); + + m3d->scale_3d_cntl = 0; + m3d->tex_cntl = 0; + + m3d->frag_src = FALSE; + m3d->frag_mask = FALSE; + m3d->frag_color = 0xffffffff; + + m3d->color_alpha = FALSE; + + m3d->transform = NULL; + + /* Compute state */ + if (pMaskPicture && !Mach64PrepareMask(m3d, op, pSrcPicture, pMaskPicture, + pSrc, pMask)) + return FALSE; + + Mach64BlendCntl(m3d, op); + + for (i = 0; i < MACH64_NR_TEX_FORMATS; i++) { + if (Mach64TexFormats[i].pictFormat == pDstPicture->format) + break; + } + dstFormat = Mach64TexFormats[i].dstFormat; + + m3d->dp_pix_width = SetBits(dstFormat, DP_DST_PIX_WIDTH) | + SetBits(dstFormat, DP_SRC_PIX_WIDTH) | + SetBits(dstFormat, DP_HOST_PIX_WIDTH); + + if (!m3d->frag_src) { + if (!Mach64PrepareTexture(pSrcPicture, pSrc)) + return FALSE; + } + + if (pMaskPicture && !m3d->frag_mask) { + if (!Mach64PrepareTexture(pMaskPicture, pMask)) + return FALSE; + } + + offset = TEX_LEVEL(m3d->tex_size_pitch); + + /* Emit state */ + ATIMach64WaitForFIFO(pATI, 12); + outf(DP_SRC, m3d->dp_src); + outf(DP_MIX, m3d->dp_mix); + + outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); + outf(DST_OFF_PITCH, m3d->dst_pitch_offset); + + outf(SCALE_3D_CNTL, m3d->scale_3d_cntl); + outf(DP_WRITE_MASK, m3d->dp_write_mask); + outf(DP_PIX_WIDTH, m3d->dp_pix_width); + + outf(SETUP_CNTL, 0); + + outf(TEX_SIZE_PITCH, m3d->tex_size_pitch); + outf(TEX_CNTL, m3d->tex_cntl); + outf(TEX_0_OFF + offset, m3d->tex_offset); + + return TRUE; +} + +/* + * Vertex format, setup and emission. + */ +typedef struct { + float s0; /* normalized texture coords */ + float t0; + float x; /* quarter-pixels */ + float y; + CARD32 argb; /* fragment color */ +} Mach64Vertex; + +#define VTX_SET(_v, _col, _dstX, _dstY, _srcX, _dx, _srcY, _dy) \ +do { \ + _v.s0 = ((float)(_srcX) + _dx) / m3d->tex_width; \ + _v.t0 = ((float)(_srcY) + _dy) / m3d->tex_height; \ + _v.x = ((float)(_dstX) * 4.0); \ + _v.y = ((float)(_dstY) * 4.0); \ + _v.argb = _col; \ +} while (0) + +#define FVAL(_fval) (*(CARD32 *)&(_fval)) + +#define VTX_OUT(_v, n) \ +do { \ + float w = 1.0; \ + CARD32 z = 0xffff << 15; \ + CARD32 x_y = ((CARD16)_v.x << 16) | \ + ((CARD16)_v.y & 0xffff); \ + \ + ATIMach64WaitForFIFO(pATI, 6); \ + outf(VERTEX_##n##_S, FVAL(_v.s0)); \ + outf(VERTEX_##n##_T, FVAL(_v.t0)); \ + outf(VERTEX_##n##_W, FVAL(w)); \ + \ + outf(VERTEX_##n##_Z, z); \ + outf(VERTEX_##n##_ARGB, _v.argb); \ + outf(VERTEX_##n##_X_Y, x_y); \ +} while (0) + +/* + * Composite acceleration hook. + */ +void +Mach64Composite +( + PixmapPtr pDst, + int srcX, + int srcY, + int maskX, + int maskY, + int dstX, + int dstY, + int w, + int h +) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pDst->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + Mach64ContextRegs3D *m3d = &pATI->m3d; + + Mach64Vertex v0, v1, v2, v3; + float ooa; + CARD32 col; + PictVector v; + int srcXend, srcYend; + float dxy = 0.0, dwh = 0.0; + + ATIDRISync(pScreenInfo); + + /* Disable clipping if it gets in the way */ + ATIMach64ValidateClip(pATI, dstX, dstX + w - 1, dstY, dstY + h - 1); + + /* Handle solid textures which come in as fragment color */ + col = m3d->frag_color; + if (m3d->frag_src) { + srcX = maskX; + srcY = maskY; + } + + /* Handle transform */ + srcXend = srcX + w; + srcYend = srcY + h; + if (m3d->transform) { + v.vector[0] = IntToxFixed(srcX); + v.vector[1] = IntToxFixed(srcY); + v.vector[2] = xFixed1; + PictureTransformPoint(m3d->transform, &v); + srcX = xFixedToInt(v.vector[0]); + srcY = xFixedToInt(v.vector[1]); + + v.vector[0] = IntToxFixed(srcXend); + v.vector[1] = IntToxFixed(srcYend); + v.vector[2] = xFixed1; + PictureTransformPoint(m3d->transform, &v); + srcXend = xFixedToInt(v.vector[0]); + srcYend = xFixedToInt(v.vector[1]); + +#if 0 + /* Bilinear needs manipulation of texture coordinates */ + if (m3d->scale_3d_cntl & MACH64_BILINEAR_TEX_EN) { + dxy = 0.5; + dwh = -1.0; + } +#endif + } + + /* Create vertices in clock-wise order */ + VTX_SET(v0, col, dstX, dstY, srcX, dxy, srcY, dxy); + VTX_SET(v1, col, dstX + w, dstY, srcXend, dwh, srcY, dxy); + VTX_SET(v2, col, dstX + w, dstY + h, srcXend, dwh, srcYend, dwh); + VTX_SET(v3, col, dstX, dstY + h, srcX, dxy, srcYend, dwh); + + /* Setup upper triangle (v0, v1, v3) */ + VTX_OUT(v0, 1); + VTX_OUT(v1, 2); + VTX_OUT(v3, 3); + + ooa = 1.0 / (w * h); + outf(ONE_OVER_AREA, FVAL(ooa)); + + /* Setup lower triangle (v2, v1, v3) */ + VTX_OUT(v2, 1); + + ooa = -ooa; + outf(ONE_OVER_AREA, FVAL(ooa)); +} + +/* + * DoneComposite acceleration hook. + */ +void +Mach64DoneComposite(PixmapPtr pDst) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pDst->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + ATIDRISync(pScreenInfo); + + outf(SCALE_3D_CNTL, 0); +} diff --git a/src/atimach64xv.c b/src/atimach64xv.c index cba6f99..b72f88f 100644 --- a/src/atimach64xv.c +++ b/src/atimach64xv.c @@ -25,6 +25,8 @@ #include "config.h" #endif +#include <string.h> + #include "ati.h" #include "atiaccel.h" #include "atichip.h" @@ -499,6 +501,25 @@ ATIMach64GetPortAttribute return Success; } +static pointer +ATIMach64XVMemAlloc +( + ScreenPtr pScreen, + pointer pVideo, + int size, + int *offset, + ATIPtr pATI +); + +static void +ATIMach64XVMemFree +( + ScreenPtr pScreen, + pointer pVideo, + ATIPtr pATI +); + +#ifdef USE_XAA /* * ATIMach64RemoveLinearCallback -- * @@ -517,6 +538,7 @@ ATIMach64RemoveLinearCallback pATI->pXVBuffer = NULL; outf(OVERLAY_SCALE_CNTL, SCALE_EN); } +#endif /* USE_XAA */ /* * ATIMach64StopVideo -- @@ -541,19 +563,23 @@ ATIMach64StopVideo REGION_EMPTY(pScreen, &pATI->VideoClip); - if (!Cleanup) +#ifdef USE_XAA + if (!pATI->useEXA && !Cleanup) { /* * Free offscreen buffer if/when its allocation is needed by XAA's * pixmap cache. */ - if (pATI->pXVBuffer) - pATI->pXVBuffer->RemoveLinearCallback = + FBLinearPtr linear = (FBLinearPtr)pATI->pXVBuffer; + if (linear) + linear->RemoveLinearCallback = ATIMach64RemoveLinearCallback; return; } +#endif /* USE_XAA */ - pATI->pXVBuffer = ATIResizeOffscreenLinear(pScreen, pATI->pXVBuffer, 0); + ATIMach64XVMemFree(pScreen, pATI->pXVBuffer, pATI); + pATI->pXVBuffer = NULL; outf(OVERLAY_SCALE_CNTL, SCALE_EN); } @@ -942,7 +968,8 @@ ATIMach64PutImage short Height, Bool Synchronise, RegionPtr pClip, - pointer Data + pointer Data, + DrawablePtr pDraw ) { ATIPtr pATI = Data; @@ -953,6 +980,7 @@ ATIMach64PutImage int SrcTop, SrcLeft, DstWidth, DstHeight; int Top, Bottom, Left, Right, nLine, nPixel, Offset; int OffsetV, OffsetU; + int XVOffset; int tmp; CARD8 *pDst; @@ -978,11 +1006,11 @@ ATIMach64PutImage */ DstPitch = /* bytes */ (DstWidth + DstWidth + 15) & ~15; - DstSize = /* pixels */ - ((DstPitch * DstHeight) + pATI->AdjustDepth - 1) / pATI->AdjustDepth; + DstSize = /* bytes */ + (DstPitch * DstHeight); - pATI->pXVBuffer = ATIResizeOffscreenLinear(pScreen, pATI->pXVBuffer, - (pATI->DoubleBuffer + 1) * DstSize); + pATI->pXVBuffer = ATIMach64XVMemAlloc(pScreen, pATI->pXVBuffer, + (pATI->DoubleBuffer + 1) * DstSize, &XVOffset, pATI); if (!pATI->pXVBuffer) { @@ -990,7 +1018,7 @@ ATIMach64PutImage return BadAlloc; pATI->pXVBuffer = - ATIResizeOffscreenLinear(pScreen, pATI->pXVBuffer, DstSize); + ATIMach64XVMemAlloc(pScreen, pATI->pXVBuffer, DstSize, &XVOffset, pATI); if (!pATI->pXVBuffer) return BadAlloc; @@ -1009,8 +1037,7 @@ ATIMach64PutImage /* Synchronise video memory accesses */ ATIMach64Sync(pScreenInfo); - Offset = (pATI->pXVBuffer->offset * pATI->AdjustDepth) + - (pATI->CurrentBuffer * DstSize * pATI->AdjustDepth); + Offset = XVOffset + pATI->CurrentBuffer * DstSize; pDst = pATI->pMemoryLE; pDst += Offset; @@ -1110,6 +1137,7 @@ ATIMach64AllocateSurface { ScreenPtr pScreen; ATIPtr pATI = ATIPTR(pScreenInfo); + int XVOffset; if (pATI->ActiveSurface) return BadAlloc; @@ -1123,13 +1151,12 @@ ATIMach64AllocateSurface pScreen = pScreenInfo->pScreen; - pATI->pXVBuffer = ATIResizeOffscreenLinear(pScreen, pATI->pXVBuffer, - ((Height * pATI->SurfacePitch) + pATI->AdjustDepth - 1) / - pATI->AdjustDepth); + pATI->pXVBuffer = ATIMach64XVMemAlloc(pScreen, pATI->pXVBuffer, + Height * pATI->SurfacePitch, &XVOffset, pATI); if (!pATI->pXVBuffer) return BadAlloc; - pATI->SurfaceOffset = pATI->pXVBuffer->offset * pATI->AdjustDepth; + pATI->SurfaceOffset = XVOffset; pSurface->pScrn = pScreenInfo; pSurface->id = ImageID; @@ -1164,8 +1191,8 @@ ATIMach64FreeSurface return Success; outf(OVERLAY_SCALE_CNTL, SCALE_EN); - pATI->pXVBuffer = ATIResizeOffscreenLinear(pSurface->pScrn->pScreen, - pATI->pXVBuffer, 0); + ATIMach64XVMemFree(pSurface->pScrn->pScreen, pATI->pXVBuffer, pATI); + pATI->pXVBuffer = NULL; pATI->ActiveSurface = FALSE; return Success; @@ -1495,3 +1522,84 @@ ATIMach64CloseXVideo REGION_UNINIT(pScreen, &pATI->VideoClip); } + +static pointer +ATIMach64XVMemAlloc +( + ScreenPtr pScreen, + pointer pVideo, + int size, + int *offset, + ATIPtr pATI +) +{ +#ifdef USE_EXA + if (pATI->useEXA) { + ExaOffscreenArea *area = (ExaOffscreenArea *)pVideo; + + if (area != NULL) { + if (area->size >= size) { + *offset = area->offset; + return area; + } + + exaOffscreenFree(pScreen, area); + } + + area = exaOffscreenAlloc(pScreen, size, 64, TRUE, NULL, NULL); + if (area != NULL) { + *offset = area->offset; + return area; + } + } +#endif /* USE_EXA */ + +#ifdef USE_XAA + if (!pATI->useEXA) { + FBLinearPtr linear = (FBLinearPtr)pVideo; + int cpp = pATI->AdjustDepth; + + /* XAA allocates in units of pixels at the screen bpp, so adjust size + * appropriately. + */ + size = (size + cpp - 1) / cpp; + + linear = ATIResizeOffscreenLinear(pScreen, linear, size); + if (linear != NULL) { + *offset = linear->offset * cpp; + return linear; + } + } +#endif /* USE_XAA */ + + *offset = 0; + return NULL; +} + +static void +ATIMach64XVMemFree +( + ScreenPtr pScreen, + pointer pVideo, + ATIPtr pATI +) +{ +#ifdef USE_EXA + if (pATI->useEXA) { + ExaOffscreenArea *area = (ExaOffscreenArea *)pVideo; + + if (area != NULL) + exaOffscreenFree(pScreen, area); + } +#endif /* USE_EXA */ + +#ifdef USE_XAA + if (!pATI->useEXA) { + FBLinearPtr linear = (FBLinearPtr)pVideo; + + if (linear != NULL) + ATIResizeOffscreenLinear(pScreen, linear, 0); + } +#endif /* USE_XAA */ +} + diff --git a/src/atimisc.c b/src/atimisc.c index de118c0..ee4b518 100644 --- a/src/atimisc.c +++ b/src/atimisc.c @@ -127,7 +127,19 @@ ATISetup ATIfbSymbols, ATIshadowfbSymbols, + +#ifdef USE_EXA + + ATIexaSymbols, + +#endif /* USE_EXA */ + +#ifdef USE_XAA + ATIxaaSymbols, + +#endif /* USE_XAA */ + ATIramdacSymbols, ATIi2cSymbols, NULL); diff --git a/src/atimode.c b/src/atimode.c index 098659e..17210de 100644 --- a/src/atimode.c +++ b/src/atimode.c @@ -24,6 +24,8 @@ #include "config.h" #endif +#include <string.h> + #include "ati.h" #include "atiadapter.h" #include "atichip.h" @@ -998,7 +1000,7 @@ ATISetVBEMode #endif default: xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, - "Mode not supported for TV-Out: depth: %ld HDisplay: %ld\n", + "Mode not supported for TV-Out: depth: %d HDisplay: %d\n", modekey>>16, modekey & 0xffff); return; } diff --git a/src/atimodule.h b/src/atimodule.h index 1a203ae..833e421 100644 --- a/src/atimodule.h +++ b/src/atimodule.h @@ -1,6 +1,6 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h,v 1.9 2003/01/01 19:16:32 tsi Exp $ */ /* - * Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@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 diff --git a/src/atimono.h b/src/atimono.h index f050ceb..6325cbe 100644 --- a/src/atimono.h +++ b/src/atimono.h @@ -1,6 +1,6 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h,v 1.7 2003/01/01 19:16:33 tsi Exp $ */ /* - * Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@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 diff --git a/src/atioption.c b/src/atioption.c index 6c862ed..bc1129b 100644 --- a/src/atioption.c +++ b/src/atioption.c @@ -219,6 +219,20 @@ const OptionInfoRec ATIPublicOptions[] = FALSE, }, { + ATI_OPTION_ACCELMETHOD, + "AccelMethod", + OPTV_STRING, + {0, }, + FALSE + }, + { + ATI_OPTION_RENDER_ACCEL, + "RenderAccel", + OPTV_BOOLEAN, + {0, }, + FALSE + }, + { -1, NULL, OPTV_NONE, diff --git a/src/atioption.h b/src/atioption.h index 51778a4..808d90d 100644 --- a/src/atioption.h +++ b/src/atioption.h @@ -69,7 +69,9 @@ typedef enum ATI_OPTION_PROBE_CLOCKS, ATI_OPTION_REFERENCE_CLOCK, ATI_OPTION_SHADOW_FB, - ATI_OPTION_SWCURSOR + ATI_OPTION_SWCURSOR, + ATI_OPTION_ACCELMETHOD, + ATI_OPTION_RENDER_ACCEL } ATIPublicOptionType; #ifdef TV_OUT diff --git a/src/atipciids.h b/src/atipciids.h index eb3bc53..0e6a290 100644 --- a/src/atipciids.h +++ b/src/atipciids.h @@ -1,4 +1,4 @@ -/* $XdotOrg: driver/xf86-video-ati/src/atipciids.h,v 1.1.2.1 2006/03/12 06:57:12 benh Exp $ */ +/* $XdotOrg: driver/xf86-video-ati/src/atipciids.c, Exp $ */ /* * Copyright (c) 1995-2003 by The XFree86 Project, Inc. diff --git a/src/atipreinit.c b/src/atipreinit.c index 1f0b016..8609f25 100644 --- a/src/atipreinit.c +++ b/src/atipreinit.c @@ -26,6 +26,9 @@ #include "config.h" #endif +#include <string.h> +#include <stdio.h> + #include "ati.h" #include "atiadapter.h" #include "atiadjust.h" diff --git a/src/atiprint.c b/src/atiprint.c index f611e9a..d785101 100644 --- a/src/atiprint.c +++ b/src/atiprint.c @@ -25,6 +25,9 @@ #include "config.h" #endif +#include <string.h> +#include <ctype.h> + #include "ati.h" #include "atiadapter.h" #include "atichip.h" diff --git a/src/atipriv.h b/src/atipriv.h index 723bf9a..69341ba 100644 --- a/src/atipriv.h +++ b/src/atipriv.h @@ -1,6 +1,6 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h,v 1.5 2003/01/01 19:16:33 tsi Exp $ */ /* - * Copyright 1999 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1999 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@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 diff --git a/src/atiprobe.c b/src/atiprobe.c index 5c347bb..da214d4 100644 --- a/src/atiprobe.c +++ b/src/atiprobe.c @@ -25,6 +25,9 @@ #include "config.h" #endif +#include <string.h> +#include <stdio.h> + #include "ati.h" #include "atiadapter.h" #include "atiadjust.h" @@ -994,10 +997,8 @@ ATIProbe ATIPtr pATI, *ATIPtrs = NULL; GDevPtr *GDevs, pGDev; pciVideoPtr pVideo, *xf86PciVideoInfo = xf86GetPciVideoInfo(); - pciConfigPtr pPCI; ATIGDev *ATIGDevs = NULL, *pATIGDev; ScrnInfoPtr pScreenInfo; - CARD32 PciReg; Bool ProbeSuccess = FALSE; Bool DoRage128 = FALSE, DoRadeon = FALSE; int i, j, k; @@ -1005,10 +1006,18 @@ ATIProbe int Chipset; ATIChipType Chip; +#if !defined(AVOID_NON_PCI) || !defined(AVOID_CPIO) + pciConfigPtr pPCI; + CARD32 PciReg; +#endif /* AVOID_NON_PCI || AVOID_CPIO */ + +#ifndef AVOID_NON_PCI + ATIPtr pMach64[3] = {NULL, NULL, NULL}; +#endif + #ifndef AVOID_CPIO ATIPtr pVGA = NULL, p8514 = NULL; - ATIPtr pMach64[3] = {NULL, NULL, NULL}; pciConfigPtr *xf86PciInfo = xf86GetPciConfigInfo(); PortPtr PCIPorts = NULL; int nPCIPort = 0; diff --git a/src/atiregs.h b/src/atiregs.h index f9730c7..8ab8340 100644 --- a/src/atiregs.h +++ b/src/atiregs.h @@ -692,6 +692,19 @@ /* ? 0xf8000000ul */ #define TIMER_CONFIG BlockIOTag(0x0au) /* VTB/GTB/LT */ #define MEM_BUF_CNTL BlockIOTag(0x0bu) /* VTB/GTB/LT */ +#define Z_WB_FLUSH 0x00000007ul +#define Z_WB_FLUSH_P 0x0000000ful /* GTPro */ +#define VID_WB_FLUSH_P 0x000000f0ul /* GTPro */ +#define VID_WB_FLUSH_MSB 0x00000100ul +#define GUI_WB_FLUSH_P 0x00001f00ul /* GTPro */ +#define HST_WB_FLUSH_P 0x0000e000ul /* GTPro */ +#define SCL_MIN_BURST_LEN 0x001f0000ul +#define SCL_THRESH 0x003f0000ul /* GTPro */ +/* ? 0x00400000ul */ +#define INVALIDATE_RB_CACHE 0x00800000ul +#define HST_WB_FLUSH 0x03000000ul +#define VID_WB_FLUSH 0x1c000000ul +#define GUI_WB_FLUSH 0xe0000000ul #define SHARED_CNTL BlockIOTag(0x0cu) /* VTB/GTB/LT */ #define SHARED_MEM_CONFIG BlockIOTag(0x0du) /* VTB/GTB/LT */ #define MEM_ADDR_CONFIG BlockIOTag(0x0du) /* GTPro */ @@ -2738,4 +2751,132 @@ /* ? 0x06u */ /* ? 0x07u */ +/* 3D Engine for render acceleration (from Mach64 DRI driver) */ + +/* SCALE_3D_CNTL */ +#define MACH64_SCALE_PIX_EXPAND_ZERO_EXTEND (0 << 0) +#define MACH64_SCALE_PIX_EXPAND_DYNAMIC_RANGE (1 << 0) +#define MACH64_SCALE_DITHER_ERROR_DIFFUSE (0 << 1) +#define MACH64_SCALE_DITHER_2D_TABLE (1 << 1) +#define MACH64_DITHER_EN (1 << 2) +#define MACH64_DITHER_INIT_CURRENT (O << 3) +#define MACH64_DITHER_INIT_RESET (1 << 3) +#define MACH64_ROUND_EN (1 << 4) + +#define MACH64_TEX_CACHE_DIS (1 << 5) + +#define MACH64_SCALE_3D_FCN_MASK (3 << 6) +#define MACH64_SCALE_3D_FCN_NOP (0 << 6) +#define MACH64_SCALE_3D_FCN_SCALE (1 << 6) +#define MACH64_SCALE_3D_FCN_TEXTURE (2 << 6) +#define MACH64_SCALE_3D_FCN_SHADE (3 << 6) +#define MACH64_TEXTURE_DISABLE (1 << 6) + +#define MACH64_EDGE_ANTI_ALIAS (1 << 8) +#define MACH64_TEX_CACHE_SPLIT (1 << 9) +#define MACH64_APPLE_YUV_MODE (1 << 10) + +#define MACH64_ALPHA_FOG_EN_MASK (3 << 11) +#define MACH64_ALPHA_FOG_DIS (0 << 11) +#define MACH64_ALPHA_FOG_EN_ALPHA (1 << 11) +#define MACH64_ALPHA_FOG_EN_FOG (2 << 11) + +#define MACH64_ALPHA_BLEND_SAT (1 << 13) +#define MACH64_RED_DITHER_MAX (1 << 14) +#define MACH64_SIGNED_DST_CLAMP (1 << 15) + +#define MACH64_ALPHA_BLEND_SRC_MASK (7 << 16) +#define MACH64_ALPHA_BLEND_SRC_ZERO (0 << 16) +#define MACH64_ALPHA_BLEND_SRC_ONE (1 << 16) +#define MACH64_ALPHA_BLEND_SRC_DSTCOLOR (2 << 16) +#define MACH64_ALPHA_BLEND_SRC_INVDSTCOLOR (3 << 16) +#define MACH64_ALPHA_BLEND_SRC_SRCALPHA (4 << 16) +#define MACH64_ALPHA_BLEND_SRC_INVSRCALPHA (5 << 16) +#define MACH64_ALPHA_BLEND_SRC_DSTALPHA (6 << 16) +#define MACH64_ALPHA_BLEND_SRC_INVDSTALPHA (7 << 16) +#define MACH64_ALPHA_BLEND_DST_MASK (7 << 19) +#define MACH64_ALPHA_BLEND_DST_ZERO (0 << 19) +#define MACH64_ALPHA_BLEND_DST_ONE (1 << 19) +#define MACH64_ALPHA_BLEND_DST_SRCCOLOR (2 << 19) +#define MACH64_ALPHA_BLEND_DST_INVSRCCOLOR (3 << 19) +#define MACH64_ALPHA_BLEND_DST_SRCALPHA (4 << 19) +#define MACH64_ALPHA_BLEND_DST_INVSRCALPHA (5 << 19) +#define MACH64_ALPHA_BLEND_DST_DSTALPHA (6 << 19) +#define MACH64_ALPHA_BLEND_DST_INVDSTALPHA (7 << 19) + +#define MACH64_TEX_LIGHT_FCN_MASK (3 << 22) +#define MACH64_TEX_LIGHT_FCN_REPLACE (0 << 22) +#define MACH64_TEX_LIGHT_FCN_MODULATE (1 << 22) +#define MACH64_TEX_LIGHT_FCN_ALPHA_DECAL (2 << 22) + +#define MACH64_MIP_MAP_DISABLE (1 << 24) + +#define MACH64_BILINEAR_TEX_EN (1 << 25) +#define MACH64_TEX_BLEND_FCN_MASK (3 << 26) +#define MACH64_TEX_BLEND_FCN_NEAREST (0 << 26) +#define MACH64_TEX_BLEND_FCN_LINEAR (2 << 26) +#define MACH64_TEX_BLEND_FCN_TRILINEAR (3 << 26) + +#define MACH64_TEX_AMASK_AEN (1 << 28) +#define MACH64_TEX_AMASK_BLEND_EDGE (1 << 29) +#define MACH64_TEX_MAP_AEN (1 << 30) +#define MACH64_SRC_3D_HOST_FIFO (1 << 31) + +/* TEX_CNTL */ +#define MACH64_LOD_BIAS_SHIFT 0 +#define MACH64_LOD_BIAS_MASK (0xf << 0) +#define MACH64_COMP_FACTOR_SHIFT 4 +#define MACH64_COMP_FACTOR_MASK (0xf << 4) + +#define MACH64_TEXTURE_COMPOSITE (1 << 8) + +#define MACH64_COMP_COMBINE_BLEND (0 << 9) +#define MACH64_COMP_COMBINE_MODULATE (1 << 9) +#define MACH64_COMP_BLEND_NEAREST (0 << 11) +#define MACH64_COMP_BLEND_BILINEAR (1 << 11) +#define MACH64_COMP_FILTER_NEAREST (0 << 12) +#define MACH64_COMP_FILTER_BILINEAR (1 << 12) +#define MACH64_COMP_ALPHA (1 << 13) + +#define MACH64_TEXTURE_TILING (1 << 14) +#define MACH64_COMPOSITE_TEX_TILING (1 << 15) +#define MACH64_TEX_COLLISION_DISABLE (1 << 16) + +#define MACH64_TEXTURE_CLAMP_S (1 << 17) +#define MACH64_TEXTURE_CLAMP_T (1 << 18) +#define MACH64_TEX_ST_MULT_W (0 << 19) +#define MACH64_TEX_ST_DIRECT (1 << 19) +#define MACH64_TEX_SRC_LOCAL (0 << 20) +#define MACH64_TEX_SRC_AGP (1 << 20) +#define MACH64_TEX_UNCOMPRESSED (0 << 21) +#define MACH64_TEX_VQ_COMPRESSED (1 << 21) +#define MACH64_COMP_TEX_UNCOMPRESSED (0 << 22) +#define MACH64_COMP_TEX_VQ_COMPRESSED (1 << 22) +#define MACH64_TEX_CACHE_FLUSH (1 << 23) +#define MACH64_SEC_TEX_CLAMP_S (1 << 24) +#define MACH64_SEC_TEX_CLAMP_T (1 << 25) +#define MACH64_TEX_WRAP_S (1 << 28) +#define MACH64_TEX_WRAP_T (1 << 29) +#define MACH64_TEX_CACHE_SIZE_4K (1 << 30) +#define MACH64_TEX_CACHE_SIZE_2K (1 << 30) +#define MACH64_SECONDARY_STW (1 << 31) + +/* DP_PIX_WIDTH (superset of PIX_WIDTH_?BPP) */ +#define MACH64_DATATYPE_CI8 2 +#define MACH64_DATATYPE_ARGB1555 3 +#define MACH64_DATATYPE_RGB565 4 +#define MACH64_DATATYPE_ARGB8888 6 +#define MACH64_DATATYPE_RGB332 7 +#define MACH64_DATATYPE_Y8 8 +#define MACH64_DATATYPE_RGB8 9 +#define MACH64_DATATYPE_VYUY422 11 +#define MACH64_DATATYPE_YVYU422 12 +#define MACH64_DATATYPE_AYUV444 14 +#define MACH64_DATATYPE_ARGB4444 15 + +/* Extract texture level from TEX_SIZE_PITCH and shift appropriately for + * addition to TEX_0_OFF. + */ +#define TEX_LEVEL(_tex_size_pitch) (((_tex_size_pitch) & 0xf0) >> 2) + #endif /* ___ATIREGS_H___ */ diff --git a/src/atiscreen.c b/src/atiscreen.c index effeb66..3297df5 100644 --- a/src/atiscreen.c +++ b/src/atiscreen.c @@ -30,6 +30,8 @@ #include "config.h" #endif +#include <string.h> + #include "ati.h" #include "atibus.h" #include "atichip.h" @@ -123,6 +125,235 @@ ATIMinBits for (bits = 0; val; val >>= 1, ++bits); return bits; } + +#ifdef USE_XAA +static Bool +ATIMach64SetupMemXAA_NoDRI +( + int iScreen, + ScreenPtr pScreen +) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[iScreen]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + int maxScanlines = ATIMach64MaxY; + int maxPixelArea, PixelArea; + +#ifndef AVOID_CPIO + + if (!pATI->BankInfo.BankSize) + +#endif /* AVOID_CPIO */ + { + /* + * Note: If PixelArea exceeds the engine's maximum, the excess is + * never used, even though it would be useful for such things + * as XVideo buffers. + */ + maxPixelArea = maxScanlines * pScreenInfo->displayWidth; + PixelArea = pScreenInfo->videoRam * 1024 * 8 / pATI->bitsPerPixel; + if (PixelArea > maxPixelArea) + PixelArea = maxPixelArea; + xf86InitFBManagerArea(pScreen, PixelArea, 2); + } + + return TRUE; +} + +#ifdef XF86DRI_DEVEL +/* + * Memory layour for XAA with DRI (no local_textures): + * | front | pixmaps, xv | back | depth | textures | c | + * + * 1024x768@16bpp with 8 MB: + * | 1.5 MB | ~3.5 MB | 1.5 MB | 1.5 MB | 0 | c | + * + * 1024x768@32bpp with 8 MB: + * | 3.0 MB | ~0.5 MB | 3.0 MB | 1.5 MB | 0 | c | + * + * "c" is the hw cursor which occupies 1KB + */ +static Bool +ATIMach64SetupMemXAA +( + int iScreen, + ScreenPtr pScreen +) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[iScreen]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; + int cpp = pATI->bitsPerPixel >> 3; + int widthBytes = pScreenInfo->displayWidth * cpp; + int zWidthBytes = pScreenInfo->displayWidth * 2; /* always 16-bit z-buffer */ + int fbSize = pScreenInfo->videoRam * 1024; + int bufferSize = pScreenInfo->virtualY * widthBytes; + int zBufferSize = pScreenInfo->virtualY * zWidthBytes; + int offscreenBytes, total, scanlines; + + pATIDRIServer->fbX = 0; + pATIDRIServer->fbY = 0; + pATIDRIServer->frontOffset = 0; + pATIDRIServer->frontPitch = pScreenInfo->displayWidth; + + /* Calculate memory remaining for pixcache and textures after + * front, back, and depth buffers + */ + offscreenBytes = fbSize - ( 2 * bufferSize + zBufferSize ); + + if ( !pATIDRIServer->IsPCI && !pATI->OptionLocalTextures ) { + /* Don't allocate a local texture heap for AGP unless requested */ + pATIDRIServer->textureSize = 0; + } else { + int l, maxPixcache; + +#ifdef XvExtension + + int xvBytes; + + /* Try for enough pixmap cache for DVD and a full viewport + */ + xvBytes = 720*480*cpp; /* enough for single-buffered DVD */ + maxPixcache = xvBytes > bufferSize ? xvBytes : bufferSize; + +#else /* XvExtension */ + + /* Try for one viewport */ + maxPixcache = bufferSize; + +#endif /* XvExtension */ + + pATIDRIServer->textureSize = offscreenBytes - maxPixcache; + + /* If that gives us less than half the offscreen mem available for textures, split + * the available mem between textures and pixmap cache + */ + if (pATIDRIServer->textureSize < (offscreenBytes/2)) { + pATIDRIServer->textureSize = offscreenBytes/2; + } + + if (pATIDRIServer->textureSize <= 0) + pATIDRIServer->textureSize = 0; + + l = ATIMinBits((pATIDRIServer->textureSize-1) / MACH64_NR_TEX_REGIONS); + if (l < MACH64_LOG_TEX_GRANULARITY) l = MACH64_LOG_TEX_GRANULARITY; + + /* Round the texture size up to the nearest whole number of + * texture regions. Again, be greedy about this, don't round + * down. + */ + pATIDRIServer->logTextureGranularity = l; + pATIDRIServer->textureSize = + (pATIDRIServer->textureSize >> l) << l; + } + + total = fbSize - pATIDRIServer->textureSize; + scanlines = total / widthBytes; + if (scanlines > ATIMach64MaxY) scanlines = ATIMach64MaxY; + + /* Recalculate the texture offset and size to accomodate any + * rounding to a whole number of scanlines. + * FIXME: Is this actually needed? + */ + pATIDRIServer->textureOffset = scanlines * widthBytes; + pATIDRIServer->textureSize = fbSize - pATIDRIServer->textureOffset; + + /* Set a minimum usable local texture heap size. This will fit + * two 256x256 textures. We check this after any rounding of + * the texture area. + */ + if (pATIDRIServer->textureSize < 256*256 * cpp * 2) { + pATIDRIServer->textureOffset = 0; + pATIDRIServer->textureSize = 0; + scanlines = fbSize / widthBytes; + if (scanlines > ATIMach64MaxY) scanlines = ATIMach64MaxY; + } + + pATIDRIServer->depthOffset = scanlines * widthBytes - zBufferSize; + pATIDRIServer->depthPitch = pScreenInfo->displayWidth; + pATIDRIServer->depthY = pATIDRIServer->depthOffset/widthBytes; + pATIDRIServer->depthX = (pATIDRIServer->depthOffset - + (pATIDRIServer->depthY * widthBytes)) / cpp; + + pATIDRIServer->backOffset = pATIDRIServer->depthOffset - bufferSize; + pATIDRIServer->backPitch = pScreenInfo->displayWidth; + pATIDRIServer->backY = pATIDRIServer->backOffset/widthBytes; + pATIDRIServer->backX = (pATIDRIServer->backOffset - + (pATIDRIServer->backY * widthBytes)) / cpp; + + scanlines = fbSize / widthBytes; + if (scanlines > ATIMach64MaxY) scanlines = ATIMach64MaxY; + + if ( pATIDRIServer->IsPCI && pATIDRIServer->textureSize == 0 ) { + xf86DrvMsg(iScreen, X_WARNING, + "Not enough memory for local textures, disabling DRI\n"); + ATIDRICloseScreen(pScreen); + pATI->directRenderingEnabled = FALSE; + } else { + BoxRec ScreenArea; + + ScreenArea.x1 = 0; + ScreenArea.y1 = 0; + ScreenArea.x2 = pATI->displayWidth; + ScreenArea.y2 = scanlines; + + if (!xf86InitFBManager(pScreen, &ScreenArea)) { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Memory manager initialization to (%d,%d) (%d,%d) failed\n", + ScreenArea.x1, ScreenArea.y1, + ScreenArea.x2, ScreenArea.y2); + return FALSE; + } else { + int width, height; + + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, + "Memory manager initialized to (%d,%d) (%d,%d)\n", + ScreenArea.x1, ScreenArea.y1, ScreenArea.x2, ScreenArea.y2); + + if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, 0, 0, 0)) { + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, + "Largest offscreen area available: %d x %d\n", + width, height); + + /* lines in offscreen area needed for depth buffer and textures */ + pATI->depthTexLines = scanlines + - pATIDRIServer->depthOffset / widthBytes; + pATI->backLines = scanlines + - pATIDRIServer->backOffset / widthBytes + - pATI->depthTexLines; + pATI->depthTexArea = NULL; + pATI->backArea = NULL; + } else { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Unable to determine largest offscreen area available\n"); + return FALSE; + } + + } + + xf86DrvMsg(iScreen, X_INFO, "Will use %d kB of offscreen memory for XAA\n", + (offscreenBytes - pATIDRIServer->textureSize)/1024); + + xf86DrvMsg(iScreen, X_INFO, "Will use back buffer at offset 0x%x\n", + pATIDRIServer->backOffset); + + xf86DrvMsg(iScreen, X_INFO, "Will use depth buffer at offset 0x%x\n", + pATIDRIServer->depthOffset); + + if (pATIDRIServer->textureSize > 0) { + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, + "Will use %d kB for local textures at offset 0x%x\n", + pATIDRIServer->textureSize/1024, + pATIDRIServer->textureOffset); + } + } + + return TRUE; +} +#endif /* XF86DRI_DEVEL */ +#endif /* USE_XAA */ /* * ATIScreenInit -- @@ -142,9 +373,6 @@ ATIScreenInit ATIPtr pATI = ATIPTR(pScreenInfo); pointer pFB; int VisualMask; -#ifdef XF86DRI_DEVEL - BoxRec ScreenArea; -#endif /* Set video hardware state */ if (!ATIEnterGraphics(pScreen, pScreenInfo, pATI)) @@ -327,185 +555,44 @@ ATIScreenInit #endif /* AVOID_CPIO */ - /* Memory manager setup */ +#ifdef USE_XAA -#ifdef XF86DRI_DEVEL + if (!pATI->useEXA) { + /* Memory manager setup */ + +#ifdef XF86DRI_DEVEL if (pATI->directRenderingEnabled) { - ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; - int cpp = pATI->bitsPerPixel >> 3; - int widthBytes = pScreenInfo->displayWidth * cpp; - int zWidthBytes = pScreenInfo->displayWidth * 2; /* always 16-bit z-buffer */ - int fbSize = pScreenInfo->videoRam * 1024; - int bufferSize = pScreenInfo->virtualY * widthBytes; - int zBufferSize = pScreenInfo->virtualY * zWidthBytes; - int offscreenBytes, total, scanlines; - - pATIDRIServer->fbX = 0; - pATIDRIServer->fbY = 0; - pATIDRIServer->frontOffset = 0; - pATIDRIServer->frontPitch = pScreenInfo->displayWidth; - - /* Calculate memory remaining for pixcache and textures after - * front, back, and depth buffers - */ - offscreenBytes = fbSize - ( 2 * bufferSize + zBufferSize ); - - if ( !pATIDRIServer->IsPCI && !pATI->OptionLocalTextures ) { - /* Don't allocate a local texture heap for AGP unless requested */ - pATIDRIServer->textureSize = 0; - } else { - int l, maxPixcache; - -#ifdef XvExtension - - int xvBytes; - - /* Try for enough pixmap cache for DVD and a full viewport - */ - xvBytes = 720*480*cpp; /* enough for single-buffered DVD */ - maxPixcache = xvBytes > bufferSize ? xvBytes : bufferSize; - -#else /* XvExtension */ - - /* Try for one viewport */ - maxPixcache = bufferSize; - -#endif /* XvExtension */ - - pATIDRIServer->textureSize = offscreenBytes - maxPixcache; - - /* If that gives us less than half the offscreen mem available for textures, split - * the available mem between textures and pixmap cache - */ - if (pATIDRIServer->textureSize < (offscreenBytes/2)) { - pATIDRIServer->textureSize = offscreenBytes/2; - } - - if (pATIDRIServer->textureSize <= 0) - pATIDRIServer->textureSize = 0; - - l = ATIMinBits((pATIDRIServer->textureSize-1) / MACH64_NR_TEX_REGIONS); - if (l < MACH64_LOG_TEX_GRANULARITY) l = MACH64_LOG_TEX_GRANULARITY; - - /* Round the texture size up to the nearest whole number of - * texture regions. Again, be greedy about this, don't round - * down. - */ - pATIDRIServer->logTextureGranularity = l; - pATIDRIServer->textureSize = - (pATIDRIServer->textureSize >> l) << l; - } - - total = fbSize - pATIDRIServer->textureSize; - scanlines = total / widthBytes; - if (scanlines > ATIMach64MaxY) scanlines = ATIMach64MaxY; - - /* Recalculate the texture offset and size to accomodate any - * rounding to a whole number of scanlines. - * FIXME: Is this actually needed? - */ - pATIDRIServer->textureOffset = scanlines * widthBytes; - pATIDRIServer->textureSize = fbSize - pATIDRIServer->textureOffset; - - /* Set a minimum usable local texture heap size. This will fit - * two 256x256 textures. We check this after any rounding of - * the texture area. - */ - if (pATIDRIServer->textureSize < 256*256 * cpp * 2) { - pATIDRIServer->textureOffset = 0; - pATIDRIServer->textureSize = 0; - scanlines = fbSize / widthBytes; - if (scanlines > ATIMach64MaxY) scanlines = ATIMach64MaxY; - } - - pATIDRIServer->depthOffset = scanlines * widthBytes - zBufferSize; - pATIDRIServer->depthPitch = pScreenInfo->displayWidth; - pATIDRIServer->depthY = pATIDRIServer->depthOffset/widthBytes; - pATIDRIServer->depthX = (pATIDRIServer->depthOffset - - (pATIDRIServer->depthY * widthBytes)) / cpp; - - pATIDRIServer->backOffset = pATIDRIServer->depthOffset - bufferSize; - pATIDRIServer->backPitch = pScreenInfo->displayWidth; - pATIDRIServer->backY = pATIDRIServer->backOffset/widthBytes; - pATIDRIServer->backX = (pATIDRIServer->backOffset - - (pATIDRIServer->backY * widthBytes)) / cpp; - - scanlines = fbSize / widthBytes; - if (scanlines > ATIMach64MaxY) scanlines = ATIMach64MaxY; - - if ( pATIDRIServer->IsPCI && pATIDRIServer->textureSize == 0 ) { - xf86DrvMsg(iScreen, X_WARNING, - "Not enough memory for local textures, disabling DRI\n"); - ATIDRICloseScreen(pScreen); - pATI->directRenderingEnabled = FALSE; - } else { - - ScreenArea.x1 = 0; - ScreenArea.y1 = 0; - ScreenArea.x2 = pATI->displayWidth; - ScreenArea.y2 = scanlines; - - if (!xf86InitFBManager(pScreen, &ScreenArea)) { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Memory manager initialization to (%d,%d) (%d,%d) failed\n", - ScreenArea.x1, ScreenArea.y1, - ScreenArea.x2, ScreenArea.y2); - return FALSE; - } else { - int width, height; - - xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, - "Memory manager initialized to (%d,%d) (%d,%d)\n", - ScreenArea.x1, ScreenArea.y1, ScreenArea.x2, ScreenArea.y2); + if (!ATIMach64SetupMemXAA(iScreen, pScreen)) + return FALSE; + } + else +#endif /* XF86DRI_DEVEL */ + { + if (!ATIMach64SetupMemXAA_NoDRI(iScreen, pScreen)) + return FALSE; + } - if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, 0, 0, 0)) { - xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, - "Largest offscreen area available: %d x %d\n", - width, height); + /* Setup acceleration */ - /* lines in offscreen area needed for depth buffer and textures */ - pATI->depthTexLines = scanlines - - pATIDRIServer->depthOffset / widthBytes; - pATI->backLines = scanlines - - pATIDRIServer->backOffset / widthBytes - - pATI->depthTexLines; - pATI->depthTexArea = NULL; - pATI->backArea = NULL; - } else { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Unable to determine largest offscreen area available\n"); - return FALSE; - } + if (!ATIInitializeAcceleration(pScreen, pScreenInfo, pATI)) + return FALSE; - } + } - xf86DrvMsg(iScreen, X_INFO, "Will use %d kB of offscreen memory for XAA\n", - (offscreenBytes - pATIDRIServer->textureSize)/1024); +#endif /* USE_XAA */ - xf86DrvMsg(iScreen, X_INFO, "Will use back buffer at offset 0x%x\n", - pATIDRIServer->backOffset); +#ifdef USE_EXA - xf86DrvMsg(iScreen, X_INFO, "Will use depth buffer at offset 0x%x\n", - pATIDRIServer->depthOffset); + if (pATI->useEXA) { + /* EXA setups both memory manager and acceleration here */ - if (pATIDRIServer->textureSize > 0) { - xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, - "Will use %d kB for local textures at offset 0x%x\n", - pATIDRIServer->textureSize/1024, - pATIDRIServer->textureOffset); - } - } + if (pATI->OptionAccel && !ATIMach64ExaInit(pScreen)) + return FALSE; } -#endif /* XF86DRI_DEVEL */ - - /* Setup acceleration */ - /* If direct rendering is not enabled, the framebuffer memory - * manager is initialized by this function call */ - if (!ATIInitializeAcceleration(pScreen, pScreenInfo, pATI)) - return FALSE; +#endif /* USE_EXA */ #ifndef AVOID_DGA @@ -621,11 +708,21 @@ ATICloseScreen ATICloseXVideo(pScreen, pScreenInfo, pATI); +#ifdef USE_EXA + if (pATI->pExa) + { + exaDriverFini(pScreen); + xfree(pATI->pExa); + pATI->pExa = NULL; + } +#endif +#ifdef USE_XAA if (pATI->pXAAInfo) { XAADestroyInfoRec(pATI->pXAAInfo); pATI->pXAAInfo = NULL; } +#endif if ((pScreen->CloseScreen = pATI->CloseScreen)) { @@ -643,9 +740,14 @@ ATICloseScreen ATILeaveGraphics(pScreenInfo, pATI); - xfree(pATI->ExpansionBitmapScanlinePtr[1]); - pATI->ExpansionBitmapScanlinePtr[0] = +#ifdef USE_XAA + if (!pATI->useEXA) + { + xfree(pATI->ExpansionBitmapScanlinePtr[1]); + pATI->ExpansionBitmapScanlinePtr[0] = NULL; pATI->ExpansionBitmapScanlinePtr[1] = NULL; + } +#endif xfree(pATI->pShadow); pATI->pShadow = NULL; diff --git a/src/atistruct.h b/src/atistruct.h index 0aa37b5..08f6a5b 100644 --- a/src/atistruct.h +++ b/src/atistruct.h @@ -52,7 +52,12 @@ #endif /* TV_OUT */ +#ifdef USE_EXA +#include "exa.h" +#endif +#ifdef USE_XAA #include "xaa.h" +#endif #include "xf86Cursor.h" #include "xf86Pci.h" #include "xf86Resources.h" @@ -110,7 +115,7 @@ typedef struct _ATIHWRec /* Mach64 CPIO registers */ CARD32 crtc_h_total_disp, crtc_h_sync_strt_wid, crtc_v_total_disp, crtc_v_sync_strt_wid, - crtc_off_pitch, crtc_gen_cntl, dsp_config, dsp_on_off, + crtc_off_pitch, crtc_gen_cntl, dsp_config, dsp_on_off, mem_buf_cntl, ovr_clr, ovr_wid_left_right, ovr_wid_top_bottom, cur_clr0, cur_clr1, cur_offset, cur_horz_vert_posn, cur_horz_vert_off, @@ -142,6 +147,8 @@ typedef struct _ATIHWRec CARD32 clr_cmp_clr, clr_cmp_msk, clr_cmp_cntl; CARD32 context_mask, context_load_cntl; + CARD32 scale_3d_cntl, tex_size_pitch, tex_cntl, tex_offset; + /* Mach64 MMIO Block 1 registers */ CARD32 overlay_y_x_start, overlay_y_x_end, overlay_graphics_key_clr, overlay_graphics_key_msk, overlay_key_cntl, overlay_scale_inc, @@ -171,6 +178,38 @@ typedef struct _ATIHWRec } ATIHWRec; +#ifdef USE_EXA +/* + * Card engine state for communication across RENDER acceleration hooks. + */ +typedef struct _Mach64ContextRegs3D +{ + CARD32 dp_mix; + CARD32 dp_src; + CARD32 dp_write_mask; + CARD32 dp_pix_width; + CARD32 dst_pitch_offset; + + CARD32 scale_3d_cntl; + + CARD32 tex_cntl; + CARD32 tex_size_pitch; + CARD32 tex_offset; + + int tex_width; /* src/mask texture width (pixels) */ + int tex_height; /* src/mask texture height (pixels) */ + + Bool frag_src; /* solid src uses fragment color */ + Bool frag_mask; /* solid mask uses fragment color */ + CARD32 frag_color; /* solid src/mask color */ + + Bool color_alpha; /* the alpha value is contained in the color + channels instead of the alpha channel */ + + PictTransform *transform; +} Mach64ContextRegs3D; +#endif /* USE_EXA */ + /* * This structure defines the driver's private area. */ @@ -296,15 +335,27 @@ typedef struct _ATIRec /* * XAA interface. */ + Bool useEXA; +#ifdef USE_EXA + ExaDriverPtr pExa; +#endif +#ifdef USE_XAA XAAInfoRecPtr pXAAInfo; +#endif int nAvailableFIFOEntries, nFIFOEntries, nHostFIFOEntries; CARD8 EngineIsBusy, EngineIsLocked, XModifier; CARD32 dst_cntl; /* For SetupFor/Subsequent communication */ CARD32 sc_left_right, sc_top_bottom; CARD16 sc_left, sc_right, sc_top, sc_bottom; /* Current scissors */ pointer pHOST_DATA; /* Current HOST_DATA_* transfer window address */ +#ifdef USE_XAA CARD32 *ExpansionBitmapScanlinePtr[2]; int ExpansionBitmapWidth; +#endif +#ifdef USE_EXA + Bool RenderAccelEnabled; + Mach64ContextRegs3D m3d; +#endif /* * Cursor-related definitions. @@ -382,7 +433,8 @@ typedef struct _ATIRec * XVideo-related data. */ DevUnion XVPortPrivate[1]; - FBLinearPtr pXVBuffer; + pointer pXVBuffer; /* USE_EXA: ExaOffscreenArea* + USE_XAA: FBLinearPtr */ RegionRec VideoClip; int SurfacePitch, SurfaceOffset; CARD8 AutoPaint, DoubleBuffer, CurrentBuffer, ActiveSurface; @@ -430,16 +482,16 @@ typedef struct _ATIRec /* * Driver options. */ - CARD8 OptionAccel:1; /* Use hardware draw engine */ - CARD8 OptionBIOSDisplay:1; /* Allow BIOS interference */ - CARD8 OptionBlend:1; /* Force horizontal blending */ - CARD8 OptionCRTDisplay:1; /* Display on both CRT and digital panel */ - CARD8 OptionCSync:1; /* Use composite sync */ - CARD8 OptionDevel:1; /* Intentionally undocumented */ + unsigned int OptionAccel:1; /* Use hardware draw engine */ + unsigned int OptionBIOSDisplay:1; /* Allow BIOS interference */ + unsigned int OptionBlend:1; /* Force horizontal blending */ + unsigned int OptionCRTDisplay:1; /* Display on both CRT & DFP */ + unsigned int OptionCSync:1; /* Use composite sync */ + unsigned int OptionDevel:1; /* Intentionally undocumented */ #ifndef AVOID_CPIO - CARD8 OptionLinear:1; /* Use linear fb aperture when available */ + unsigned int OptionLinear:1; /* Use linear aperture if available */ #endif /* AVOID_CPIO */ @@ -450,12 +502,12 @@ typedef struct _ATIRec #endif /* TV_OUT */ - CARD8 OptionMMIOCache:1; /* Cache MMIO writes */ - CARD8 OptionTestMMIOCache:1;/* Test MMIO cache integrity */ - CARD8 OptionPanelDisplay:1; /* Prefer digital panel over CRT */ - CARD8 OptionProbeClocks:1; /* Force probe for fixed clocks */ - CARD8 OptionShadowFB:1; /* Use shadow frame buffer */ - CARD8 OptionLCDSync:1; /* Temporary */ + unsigned int OptionMMIOCache:1; /* Cache MMIO writes */ + unsigned int OptionTestMMIOCache:1;/* Test MMIO cache integrity */ + unsigned int OptionPanelDisplay:1; /* Prefer digital panel over CRT */ + unsigned int OptionProbeClocks:1; /* Force probe for fixed clocks */ + unsigned int OptionShadowFB:1; /* Use shadow frame buffer */ + unsigned int OptionLCDSync:1; /* Temporary */ /* * State flags. @@ -485,10 +537,12 @@ typedef struct _ATIRec Bool have3DWindows; /* offscreen memory management */ +#ifdef USE_XAA int backLines; FBAreaPtr backArea; int depthTexLines; FBAreaPtr depthTexArea; +#endif CARD8 OptionIsPCI; /* Force PCI mode */ CARD8 OptionDMAMode; /* async, sync, mmio */ CARD8 OptionAGPMode; /* AGP mode */ diff --git a/src/atituner.h b/src/atituner.h index 2b40d30..0c3c67f 100644 --- a/src/atituner.h +++ b/src/atituner.h @@ -1,6 +1,6 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atituner.h,v 1.1 2003/07/24 22:08:28 tsi Exp $ */ /* - * Copyright 2003 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@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 diff --git a/src/ativersion.h b/src/ativersion.h index 59c5995..b822072 100644 --- a/src/ativersion.h +++ b/src/ativersion.h @@ -26,9 +26,6 @@ #undef ATI_NAME #undef ATI_DRIVER_NAME -#undef ATI_VERSION_MAJOR -#undef ATI_VERSION_MINOR -#undef ATI_VERSION_PATCH #undef ATI_VERSION_CURRENT #undef ATI_VERSION_EVALUATE #undef ATI_VERSION_STRINGIFY @@ -37,10 +34,6 @@ #define ATI_NAME "ATI" #define ATI_DRIVER_NAME "ati" -#define ATI_VERSION_MAJOR 6 -#define ATI_VERSION_MINOR 5 -#define ATI_VERSION_PATCH 8 - #ifndef ATI_VERSION_EXTRA #define ATI_VERSION_EXTRA "" #endif diff --git a/src/ativga.c b/src/ativga.c index 91ac302..f9e57d1 100644 --- a/src/ativga.c +++ b/src/ativga.c @@ -1,5 +1,5 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c,v 1.20 2003/04/23 21:51:31 tsi Exp $ */ -/* $XdotOrg: driver/xf86-video-ati/src/ativga.c,v 1.6 2005/07/11 02:29:45 ajax Exp $ */ +/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c,v 1.4 2005/06/04 20:26:28 alanc Exp $ */ /* * Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -38,6 +38,7 @@ #ifndef _R128_H_ #define _R128_H_ +#include <unistd.h> #include "xf86str.h" /* PCI support */ @@ -337,7 +338,7 @@ typedef struct { Bool IsPCI; /* Current card is a PCI card */ drmSize pciSize; drm_handle_t pciMemHandle; - unsigned char *PCI; /* Map */ + drmAddress PCI; /* Map */ Bool allowPageFlip; /* Enable 3d page flipping */ Bool have3DWindows; /* Are there any 3d clients? */ @@ -346,7 +347,7 @@ typedef struct { drmSize agpSize; drm_handle_t agpMemHandle; /* Handle from drmAgpAlloc */ unsigned long agpOffset; - unsigned char *AGP; /* Map */ + drmAddress AGP; /* Map */ int agpMode; Bool CCEInUse; /* CCE is currently active */ @@ -360,20 +361,20 @@ typedef struct { drm_handle_t ringHandle; /* Handle from drmAddMap */ drmSize ringMapSize; /* Size of map */ int ringSize; /* Size of ring (in MB) */ - unsigned char *ring; /* Map */ + drmAddress ring; /* Map */ int ringSizeLog2QW; unsigned long ringReadOffset; /* Offset into AGP space */ drm_handle_t ringReadPtrHandle; /* Handle from drmAddMap */ drmSize ringReadMapSize; /* Size of map */ - unsigned char *ringReadPtr; /* Map */ + drmAddress ringReadPtr; /* Map */ /* CCE vertex/indirect buffer data */ unsigned long bufStart; /* Offset into AGP space */ drm_handle_t bufHandle; /* Handle from drmAddMap */ drmSize bufMapSize; /* Size of map */ int bufSize; /* Size of buffers (in MB) */ - unsigned char *buf; /* Map */ + drmAddress buf; /* Map */ int bufNumBufs; /* Number of buffers */ drmBufMapPtr buffers; /* Buffer map */ @@ -382,7 +383,7 @@ typedef struct { drm_handle_t agpTexHandle; /* Handle from drmAddMap */ drmSize agpTexMapSize; /* Size of map */ int agpTexSize; /* Size of AGP tex space (in MB) */ - unsigned char *agpTex; /* Map */ + drmAddress agpTex; /* Map */ int log2AGPTexGran; /* CCE 2D accleration */ diff --git a/src/r128_accel.c b/src/r128_accel.c index fe284e1..351594b 100644 --- a/src/r128_accel.c +++ b/src/r128_accel.c @@ -84,6 +84,8 @@ #define R128_TRAPEZOIDS 0 /* Trapezoids don't work */ /* Driver data structures */ +#include <errno.h> + #include "r128.h" #include "r128_reg.h" #include "r128_probe.h" @@ -219,6 +221,9 @@ void R128WaitForIdle(ScrnInfoPtr pScrn) INREG(R128_GUI_PROBE))); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Idle timed out, resetting engine...\n"); +#ifdef XF86DRI + R128CCE_STOP(pScrn, info); +#endif R128EngineReset(pScrn); #ifdef XF86DRI R128CCE_RESET(pScrn, info); diff --git a/src/r128_dga.c b/src/r128_dga.c index ec85480..ffc2533 100644 --- a/src/r128_dga.c +++ b/src/r128_dga.c @@ -9,6 +9,8 @@ #include "config.h" #endif +#include <string.h> + /* Driver data structures */ #include "r128.h" #include "r128_probe.h" diff --git a/src/r128_dri.c b/src/r128_dri.c index c516bec..f3915f6 100644 --- a/src/r128_dri.c +++ b/src/r128_dri.c @@ -32,6 +32,9 @@ #include "config.h" #endif +#include <string.h> +#include <stdio.h> + /* * Authors: * Kevin E. Martin <martin@valinux.com> @@ -486,7 +489,7 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[agp] %d kB allocated with handle 0x%08lx\n", + "[agp] %d kB allocated with handle 0x%08x\n", info->agpSize*1024, info->agpMemHandle); if (drmAgpBind(info->drmFD, info->agpMemHandle, info->agpOffset) < 0) { @@ -529,7 +532,7 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) "[agp] ring handle = 0x%08x\n", info->ringHandle); if (drmMap(info->drmFD, info->ringHandle, info->ringMapSize, - (drmAddressPtr)&info->ring) < 0) { + &info->ring) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Could not map ring\n"); return FALSE; } @@ -548,7 +551,7 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) info->ringReadPtrHandle); if (drmMap(info->drmFD, info->ringReadPtrHandle, info->ringReadMapSize, - (drmAddressPtr)&info->ringReadPtr) < 0) { + &info->ringReadPtr) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Could not map ring read ptr\n"); return FALSE; @@ -564,11 +567,11 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[agp] vertex/indirect buffers handle = 0x%08lx\n", + "[agp] vertex/indirect buffers handle = 0x%08x\n", info->bufHandle); if (drmMap(info->drmFD, info->bufHandle, info->bufMapSize, - (drmAddressPtr)&info->buf) < 0) { + &info->buf) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Could not map vertex/indirect buffers\n"); return FALSE; @@ -584,11 +587,11 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[agp] AGP texture map handle = 0x%08lx\n", + "[agp] AGP texture map handle = 0x%08x\n", info->agpTexHandle); if (drmMap(info->drmFD, info->agpTexHandle, info->agpTexMapSize, - (drmAddressPtr)&info->agpTex) < 0) { + &info->agpTex) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Could not map AGP texture map\n"); return FALSE; @@ -646,7 +649,7 @@ static Bool R128DRIPciInit(R128InfoPtr info, ScreenPtr pScreen) return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[pci] %d kB allocated with handle 0x%08lx\n", + "[pci] %d kB allocated with handle 0x%08x\n", info->agpSize*1024, info->pciMemHandle); /* Initialize the CCE ring buffer data */ @@ -670,10 +673,10 @@ static Bool R128DRIPciInit(R128InfoPtr info, ScreenPtr pScreen) return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[pci] ring handle = 0x%08lx\n", info->ringHandle); + "[pci] ring handle = 0x%08x\n", info->ringHandle); if (drmMap(info->drmFD, info->ringHandle, info->ringMapSize, - (drmAddressPtr)&info->ring) < 0) { + &info->ring) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[pci] Could not map ring\n"); return FALSE; } @@ -691,11 +694,11 @@ static Bool R128DRIPciInit(R128InfoPtr info, ScreenPtr pScreen) return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[pci] ring read ptr handle = 0x%08lx\n", + "[pci] ring read ptr handle = 0x%08x\n", info->ringReadPtrHandle); if (drmMap(info->drmFD, info->ringReadPtrHandle, info->ringReadMapSize, - (drmAddressPtr)&info->ringReadPtr) < 0) { + &info->ringReadPtr) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[pci] Could not map ring read ptr\n"); return FALSE; @@ -714,11 +717,11 @@ static Bool R128DRIPciInit(R128InfoPtr info, ScreenPtr pScreen) return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[pci] vertex/indirect buffers handle = 0x%08lx\n", + "[pci] vertex/indirect buffers handle = 0x%08x\n", info->bufHandle); if (drmMap(info->drmFD, info->bufHandle, info->bufMapSize, - (drmAddressPtr)&info->buf) < 0) { + &info->buf) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[pci] Could not map vertex/indirect buffers\n"); return FALSE; @@ -1034,7 +1037,7 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) pDRIInfo->ddxDriverMajorVersion = R128_VERSION_MAJOR; pDRIInfo->ddxDriverMinorVersion = R128_VERSION_MINOR; pDRIInfo->ddxDriverPatchVersion = R128_VERSION_PATCH; - pDRIInfo->frameBufferPhysicalAddress = info->LinearAddr; + pDRIInfo->frameBufferPhysicalAddress = (void *)info->LinearAddr; pDRIInfo->frameBufferSize = info->FbMapSize; pDRIInfo->frameBufferStride = (pScrn->displayWidth * info->CurrentLayout.pixel_bytes); diff --git a/src/r128_dripriv.h b/src/r128_dripriv.h index 043e7bd..7f84987 100644 --- a/src/r128_dripriv.h +++ b/src/r128_dripriv.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dripriv.h,v 1.2 2000/11/09 03:24:35 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dripriv.h,v 1.3 2000/11/18 19:37:11 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and diff --git a/src/r128_driver.c b/src/r128_driver.c index c4fc27d..49c0d86 100644 --- a/src/r128_driver.c +++ b/src/r128_driver.c @@ -63,6 +63,8 @@ * Dualhead support - Alex Deucher <agd5f@yahoo.com> */ +#include <string.h> +#include <stdio.h> /* Driver data structures */ #include "r128.h" @@ -1375,8 +1377,10 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn) static Bool R128PreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { +#if !defined(__powerpc__) && !defined(__alpha__) R128InfoPtr info = R128PTR(pScrn); vbeInfoPtr pVbe; +#endif if (!xf86LoadSubModule(pScrn, "ddc")) return FALSE; xf86LoaderReqSymLists(ddcSymbols, NULL); @@ -3519,7 +3523,7 @@ static Bool R128InitCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr save, int vsync_wid; int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 }; int hsync_fudge_fp[] = { 0x12, 0x11, 0x09, 0x09, 0x05, 0x05 }; - int hsync_fudge_fp_crt[] = { 0x12, 0x10, 0x08, 0x08, 0x04, 0x04 }; +// int hsync_fudge_fp_crt[] = { 0x12, 0x10, 0x08, 0x08, 0x04, 0x04 }; switch (info->CurrentLayout.pixel_code) { case 4: format = 1; break; diff --git a/src/r128_probe.c b/src/r128_probe.c index ff6f75e..daad9db 100644 --- a/src/r128_probe.c +++ b/src/r128_probe.c @@ -32,6 +32,8 @@ #include "config.h" #endif +#include <string.h> + /* * Authors: * Rickard E. Faith <faith@valinux.com> @@ -48,7 +50,6 @@ #include "atipciids.h" #include "xf86.h" -#include "xf86_ansic.h" #include "xf86Resources.h" #include "r128_chipset.h" diff --git a/src/r128_reg.h b/src/r128_reg.h index 721a72c..5dc2628 100644 --- a/src/r128_reg.h +++ b/src/r128_reg.h @@ -48,9 +48,6 @@ #ifndef _R128_REG_H_ #define _R128_REG_H_ -#ifdef XFree86Module -#include "xf86_ansic.h" -#endif #include "compiler.h" /* Memory mapped register access macros */ diff --git a/src/r128_version.h b/src/r128_version.h index 1bdcae3..9e5f740 100644 --- a/src/r128_version.h +++ b/src/r128_version.h @@ -38,8 +38,8 @@ #define R128_DRIVER_NAME "r128" #define R128_VERSION_MAJOR 4 -#define R128_VERSION_MINOR 0 -#define R128_VERSION_PATCH 4 +#define R128_VERSION_MINOR 1 +#define R128_VERSION_PATCH 0 #ifndef R128_VERSION_EXTRA #define R128_VERSION_EXTRA "" diff --git a/src/r128_video.c b/src/r128_video.c index 7f4912f..c814e49 100644 --- a/src/r128_video.c +++ b/src/r128_video.c @@ -4,6 +4,8 @@ #include "config.h" #endif +#include <string.h> + #include "r128.h" #include "r128_reg.h" @@ -35,7 +37,7 @@ static void R128QueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); static int R128PutImage(ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, - short, Bool, RegionPtr, pointer); + short, Bool, RegionPtr, pointer, DrawablePtr); static int R128QueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); @@ -769,7 +771,8 @@ R128PutImage( int id, unsigned char* buf, short width, short height, Bool Sync, - RegionPtr clipBoxes, pointer data + RegionPtr clipBoxes, pointer data, + DrawablePtr pDraw ){ R128InfoPtr info = R128PTR(pScrn); R128PortPrivPtr pPriv = (R128PortPrivPtr)data; diff --git a/src/radeon.h b/src/radeon.h index 02098b6..6402e48 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -38,8 +38,10 @@ #ifndef _RADEON_H_ #define _RADEON_H_ +#include <stdlib.h> /* For abs() */ +#include <unistd.h> /* For usleep() */ + #include "xf86str.h" -#include "xf86_ansic.h" #include "compiler.h" #include "xf86fbman.h" @@ -77,6 +79,74 @@ #include "picturestr.h" #endif +typedef enum { + OPTION_NOACCEL, + OPTION_SW_CURSOR, + OPTION_DAC_6BIT, + OPTION_DAC_8BIT, +#ifdef XF86DRI + OPTION_BUS_TYPE, + OPTION_CP_PIO, + OPTION_USEC_TIMEOUT, + OPTION_AGP_MODE, + OPTION_AGP_FW, + OPTION_GART_SIZE, + OPTION_GART_SIZE_OLD, + OPTION_RING_SIZE, + OPTION_BUFFER_SIZE, + OPTION_DEPTH_MOVE, + OPTION_PAGE_FLIP, + OPTION_NO_BACKBUFFER, + OPTION_XV_DMA, + OPTION_FBTEX_PERCENT, + OPTION_DEPTH_BITS, +#ifdef USE_EXA + OPTION_ACCEL_DFS, +#endif +#endif + OPTION_PANEL_OFF, + OPTION_DDC_MODE, + OPTION_MONITOR_LAYOUT, + OPTION_IGNORE_EDID, + OPTION_FBDEV, + OPTION_MERGEDFB, + OPTION_CRT2HSYNC, + OPTION_CRT2VREFRESH, + OPTION_CRT2POS, + OPTION_METAMODES, + OPTION_MERGEDDPI, + OPTION_RADEONXINERAMA, + OPTION_CRT2ISSCRN0, + OPTION_MERGEDFBNONRECT, + OPTION_MERGEDFBMOUSER, + OPTION_DISP_PRIORITY, + OPTION_PANEL_SIZE, + OPTION_MIN_DOTCLOCK, + OPTION_COLOR_TILING, +#ifdef XvExtension + OPTION_VIDEO_KEY, + OPTION_RAGE_THEATRE_CRYSTAL, + OPTION_RAGE_THEATRE_TUNER_PORT, + OPTION_RAGE_THEATRE_COMPOSITE_PORT, + OPTION_RAGE_THEATRE_SVIDEO_PORT, + OPTION_TUNER_TYPE, + OPTION_RAGE_THEATRE_MICROC_PATH, + OPTION_RAGE_THEATRE_MICROC_TYPE, +#endif +#ifdef RENDER + OPTION_RENDER_ACCEL, + OPTION_SUBPIXEL_ORDER, +#endif + OPTION_SHOWCACHE, + OPTION_DYNAMIC_CLOCKS, + OPTION_BIOS_HOTKEYS, + OPTION_VGA_ACCESS, + OPTION_REVERSE_DDC, + OPTION_LVDS_PROBE_PLL, + OPTION_ACCELMETHOD, + OPTION_CONSTANTDPI +} RADEONOpts; + /* ------- mergedfb support ------------- */ /* Psuedo Xinerama support */ #define NEED_REPLIES /* ? */ @@ -105,7 +175,6 @@ typedef struct _region { #define RADEON_DEBUG 1 /* Turn off debugging output */ #define RADEON_IDLE_RETRY 16 /* Fall out of idle loops after this count */ #define RADEON_TIMEOUT 2000000 /* Fall out of wait loops after this count */ -#define RADEON_MMIOSIZE 0x80000 /* Buffer are aligned on 4096 byte boundaries */ #define RADEON_BUFFER_ALIGN 0x00000fff @@ -333,7 +402,8 @@ typedef struct { unsigned long LinearAddr; /* Frame buffer physical address */ unsigned long MMIOAddr; /* MMIO region physical address */ unsigned long BIOSAddr; /* BIOS physical address */ - unsigned int fbLocation; + CARD32 fbLocation; + CARD32 gartLocation; CARD32 mc_fb_location; CARD32 mc_agp_location; @@ -347,6 +417,7 @@ typedef struct { CARD32 MemCntl; CARD32 BusCntl; + unsigned long MMIOSize; /* MMIO region physical address */ unsigned long FbMapSize; /* Size of frame buffer, in bytes */ unsigned long FbSecureSize; /* Size of secured fb area at end of framebuffer */ @@ -409,21 +480,21 @@ typedef struct { Bool PaletteSavedOnVT; /* Palette saved on last VT switch */ #ifdef USE_EXA - ExaDriverRec exa; + ExaDriverPtr exa; int engineMode; #define EXA_ENGINEMODE_UNKNOWN 0 #define EXA_ENGINEMODE_2D 1 #define EXA_ENGINEMODE_3D 2 +#ifdef XF86DRI + Bool accelDFS; +#endif #endif #ifdef USE_XAA XAAInfoRecPtr accel; #endif Bool accelOn; xf86CursorInfoPtr cursor; -#ifdef USE_EXA - ExaOffscreenArea *cursorArea; -#endif - unsigned long cursor_offset; + CARD32 cursor_offset; #ifdef USE_XAA unsigned long cursor_end; #endif @@ -539,20 +610,20 @@ typedef struct { drm_handle_t ringHandle; /* Handle from drmAddMap */ drmSize ringMapSize; /* Size of map */ int ringSize; /* Size of ring (in MB) */ - unsigned char *ring; /* Map */ + drmAddress ring; /* Map */ int ringSizeLog2QW; unsigned long ringReadOffset; /* Offset into GART space */ drm_handle_t ringReadPtrHandle; /* Handle from drmAddMap */ drmSize ringReadMapSize; /* Size of map */ - unsigned char *ringReadPtr; /* Map */ + drmAddress ringReadPtr; /* Map */ /* CP vertex/indirect buffer data */ unsigned long bufStart; /* Offset into GART space */ drm_handle_t bufHandle; /* Handle from drmAddMap */ drmSize bufMapSize; /* Size of map */ int bufSize; /* Size of buffers (in MB) */ - unsigned char *buf; /* Map */ + drmAddress buf; /* Map */ int bufNumBufs; /* Number of buffers */ drmBufMapPtr buffers; /* Buffer map */ @@ -561,7 +632,7 @@ typedef struct { drm_handle_t gartTexHandle; /* Handle from drmAddMap */ drmSize gartTexMapSize; /* Size of map */ int gartTexSize; /* Size of GART tex space (in MB) */ - unsigned char *gartTex; /* Map */ + drmAddress gartTex; /* Map */ int log2GARTTexGran; /* CP accleration */ @@ -582,6 +653,7 @@ typedef struct { int backPitch; int depthOffset; int depthPitch; + int depthBits; int textureOffset; int textureSize; int log2TexGran; @@ -709,6 +781,11 @@ typedef struct { Bool NonRect, HaveNonRect, HaveOffsRegions, MouseRestrictions; region NonRectDead, OffDead1, OffDead2; + int constantDPI; /* -1 = auto, 0 = off, 1 = on */ + int RADEONDPIVX, RADEONDPIVY; + RADEONScrn2Rel MergedDPISRel; + int RADEONMergedDPIVX, RADEONMergedDPIVY, RADEONMergedDPIRot; + /* special handlings for DELL triple-head server */ Bool IsDellServer; @@ -777,6 +854,13 @@ extern void R300CGWorkaround(ScrnInfoPtr pScrn); extern void RADEONPllErrataAfterIndex(RADEONInfoPtr info); extern void RADEONPllErrataAfterData(RADEONInfoPtr info); +extern Bool RADEONGetBIOSInfo(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10); +extern Bool RADEONGetConnectorInfoFromBIOS (ScrnInfoPtr pScrn); +extern Bool RADEONGetClockInfoFromBIOS (ScrnInfoPtr pScrn); +extern Bool RADEONGetLVDSInfoFromBIOS (ScrnInfoPtr pScrn); +extern Bool RADEONGetTMDSInfoFromBIOS (ScrnInfoPtr pScrn); +extern Bool RADEONGetHardCodedEDIDFromBIOS (ScrnInfoPtr pScrn); + #ifdef XF86DRI #ifdef USE_XAA extern void RADEONAccelInitCP(ScreenPtr pScreen, XAAInfoRecPtr a); @@ -795,9 +879,12 @@ extern void RADEONCPFlushIndirect(ScrnInfoPtr pScrn, int discard); extern void RADEONCPReleaseIndirect(ScrnInfoPtr pScrn); extern int RADEONCPStop(ScrnInfoPtr pScrn, RADEONInfoPtr info); -extern CARD8* RADEONHostDataBlit(ScrnInfoPtr pScrn, unsigned int bpp, - unsigned int w, CARD32 dstPitch, - CARD32 *bufPitch, CARD8 **dst, +extern void RADEONHostDataParams(ScrnInfoPtr pScrn, CARD8 *dst, + CARD32 pitch, int cpp, + CARD32 *dstPitchOffset, int *x, int *y); +extern CARD8* RADEONHostDataBlit(ScrnInfoPtr pScrn, unsigned int cpp, + unsigned int w, CARD32 dstPitchOff, + CARD32 *bufPitch, int x, int *y, unsigned int *h, unsigned int *hpass); extern void RADEONHostDataBlitCopyPass(ScrnInfoPtr pScrn, unsigned int bpp, @@ -808,13 +895,6 @@ extern void RADEONHostDataBlitCopyPass(ScrnInfoPtr pScrn, extern void RADEONCopySwap(CARD8 *dst, CARD8 *src, unsigned int size, int swap); -extern Bool RADEONGetBIOSInfo(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10); -extern Bool RADEONGetConnectorInfoFromBIOS (ScrnInfoPtr pScrn); -extern Bool RADEONGetClockInfoFromBIOS (ScrnInfoPtr pScrn); -extern Bool RADEONGetLVDSInfoFromBIOS (ScrnInfoPtr pScrn); -extern Bool RADEONGetTMDSInfoFromBIOS (ScrnInfoPtr pScrn); -extern Bool RADEONGetHardCodedEDIDFromBIOS (ScrnInfoPtr pScrn); - #define RADEONCP_START(pScrn, info) \ do { \ int _ret = drmCommandNone(info->drmFD, DRM_RADEON_CP_START); \ @@ -882,7 +962,7 @@ do { \ #define BEGIN_RING(n) do { \ if (RADEON_VERBOSE) { \ xf86DrvMsg(pScrn->scrnIndex, X_INFO, \ - "BEGIN_RING(%d) in %s\n", n, __FUNCTION__); \ + "BEGIN_RING(%d) in %s\n", (unsigned int)n, __FUNCTION__);\ } \ if (++info->dma_begin_count != 1) { \ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ diff --git a/src/radeon_accel.c b/src/radeon_accel.c index 0e0ede9..6309771 100644 --- a/src/radeon_accel.c +++ b/src/radeon_accel.c @@ -74,6 +74,8 @@ * */ +#include <errno.h> +#include <string.h> /* Driver data structures */ #include "radeon.h" #include "radeon_reg.h" @@ -94,6 +96,7 @@ #include "xf86.h" +#ifdef USE_XAA static struct { int rop; int pattern; @@ -115,6 +118,7 @@ static struct { { RADEON_ROP3_DSan, RADEON_ROP3_DPan }, /* GXnand */ { RADEON_ROP3_ONE, RADEON_ROP3_ONE } /* GXset */ }; +#endif /* The FIFO has 64 slots. This routines waits until at least `entries' * of these slots are empty. @@ -131,7 +135,7 @@ void RADEONWaitForFifoFunction(ScrnInfoPtr pScrn, int entries) INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK; if (info->fifo_slots >= entries) return; } - RADEONTRACE(("FIFO timed out: %d entries, stat=0x%08x\n", + RADEONTRACE(("FIFO timed out: %u entries, stat=0x%08x\n", INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, INREG(RADEON_RBBM_STATUS))); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -154,16 +158,16 @@ void RADEONEngineFlush(ScrnInfoPtr pScrn) unsigned char *RADEONMMIO = info->MMIO; int i; - OUTREGP(RADEON_RB2D_DSTCACHE_CTLSTAT, - RADEON_RB2D_DC_FLUSH_ALL, - ~RADEON_RB2D_DC_FLUSH_ALL); + OUTREGP(RADEON_RB3D_DSTCACHE_CTLSTAT, + RADEON_RB3D_DC_FLUSH_ALL, + ~RADEON_RB3D_DC_FLUSH_ALL); for (i = 0; i < RADEON_TIMEOUT; i++) { - if (!(INREG(RADEON_RB2D_DSTCACHE_CTLSTAT) & RADEON_RB2D_DC_BUSY)) + if (!(INREG(RADEON_RB3D_DSTCACHE_CTLSTAT) & RADEON_RB3D_DC_BUSY)) break; } if (i == RADEON_TIMEOUT) { RADEONTRACE(("DC flush timeout: %x\n", - INREG(RADEON_RB2D_DSTCACHE_CTLSTAT))); + INREG(RADEON_RB3D_DSTCACHE_CTLSTAT))); } } @@ -254,8 +258,8 @@ void RADEONEngineReset(ScrnInfoPtr pScrn) RADEON_SOFT_RESET_E2)); INREG(RADEON_RBBM_SOFT_RESET); OUTREG(RADEON_RBBM_SOFT_RESET, 0); - tmp = INREG(RADEON_RB2D_DSTCACHE_MODE); - OUTREG(RADEON_RB2D_DSTCACHE_MODE, tmp | (1 << 17)); /* FIXME */ + tmp = INREG(RADEON_RB3D_DSTCACHE_MODE); + OUTREG(RADEON_RB3D_DSTCACHE_MODE, tmp | (1 << 17)); /* FIXME */ } else { OUTREG(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset | RADEON_SOFT_RESET_CP | @@ -602,6 +606,22 @@ void RADEONCPReleaseIndirect(ScrnInfoPtr pScrn) &indirect, sizeof(drmRadeonIndirect)); } +/** \brief Calculate HostDataBlit parameters from pointer and pitch + * + * This is a helper for the trivial HostDataBlit users that don't need to worry + * about tiling etc. + */ +void +RADEONHostDataParams(ScrnInfoPtr pScrn, CARD8 *dst, CARD32 pitch, int cpp, + CARD32 *dstPitchOff, int *x, int *y) +{ + RADEONInfoPtr info = RADEONPTR( pScrn ); + CARD32 dstOffs = dst - info->FB + info->fbLocation; + + *dstPitchOff = pitch << 16 | (dstOffs & ~RADEON_BUFFER_ALIGN) >> 10; + *y = ( dstOffs & RADEON_BUFFER_ALIGN ) / pitch; + *x = ( ( dstOffs & RADEON_BUFFER_ALIGN ) - ( *y * pitch ) ) / cpp; +} /* Set up a hostdata blit to transfer data from system memory to the * framebuffer. Returns the address where the data can be written to and sets @@ -610,16 +630,17 @@ void RADEONCPReleaseIndirect(ScrnInfoPtr pScrn) CARD8* RADEONHostDataBlit( ScrnInfoPtr pScrn, - unsigned int bpp, + unsigned int cpp, unsigned int w, - CARD32 dstPitch, + CARD32 dstPitchOff, CARD32 *bufPitch, - CARD8* *dst, + int x, + int *y, unsigned int *h, unsigned int *hpass ){ RADEONInfoPtr info = RADEONPTR( pScrn ); - CARD32 format, dst_offs, dwords, x, y; + CARD32 format, dwords; CARD8 *ret; RING_LOCALS; @@ -628,7 +649,7 @@ RADEONHostDataBlit( return NULL; } - switch ( bpp ) + switch ( cpp ) { case 4: format = RADEON_GMC_DST_32BPP; @@ -636,17 +657,15 @@ RADEONHostDataBlit( break; case 2: format = RADEON_GMC_DST_16BPP; - w = (w + 1) & ~1; - *bufPitch = 2 * w; + *bufPitch = 2 * ((w + 1) & ~1); break; case 1: format = RADEON_GMC_DST_8BPP_CI; - w = (w + 3) & ~3; - *bufPitch = w; + *bufPitch = (w + 3) & ~3; break; default: xf86DrvMsg( pScrn->scrnIndex, X_ERROR, - "%s: Unsupported bpp %d!\n", __func__, bpp ); + "%s: Unsupported cpp %d!\n", __func__, cpp ); return NULL; } @@ -656,10 +675,10 @@ RADEONHostDataBlit( */ if (info->ChipFamily < CHIP_FAMILY_R300) { BEGIN_RING(2); - if (bpp == 2) + if (cpp == 2) OUT_RING_REG(RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_HDW); - else if (bpp == 1) + else if (cpp == 1) OUT_RING_REG(RADEON_RBBM_GUICNTL, RADEON_HOST_DATA_SWAP_32BIT); else @@ -672,16 +691,13 @@ RADEONHostDataBlit( /*RADEON_PURGE_CACHE(); RADEON_WAIT_UNTIL_IDLE();*/ - dst_offs = *dst - info->FB + info->fbLocation; - *hpass = min( *h, ( ( RADEON_BUFFER_SIZE - 8 * 4 ) / *bufPitch ) ); + *hpass = min( *h, ( ( RADEON_BUFFER_SIZE - 10 * 4 ) / *bufPitch ) ); dwords = *hpass * *bufPitch / 4; - y = ( dst_offs & 1023 ) / dstPitch; - x = ( ( dst_offs & 1023 ) - ( y * dstPitch ) ) / bpp; - - BEGIN_RING( dwords + 8 ); - OUT_RING( CP_PACKET3( RADEON_CP_PACKET3_CNTL_HOSTDATA_BLT, dwords + 8 - 2 ) ); + BEGIN_RING( dwords + 10 ); + OUT_RING( CP_PACKET3( RADEON_CP_PACKET3_CNTL_HOSTDATA_BLT, dwords + 10 - 2 ) ); OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL + | RADEON_GMC_DST_CLIPPING | RADEON_GMC_BRUSH_NONE | format | RADEON_GMC_SRC_DATATYPE_COLOR @@ -689,11 +705,13 @@ RADEONHostDataBlit( | RADEON_DP_SRC_SOURCE_HOST_DATA | RADEON_GMC_CLR_CMP_CNTL_DIS | RADEON_GMC_WR_MSK_DIS ); - OUT_RING( dstPitch << 16 | dst_offs >> 10 ); + OUT_RING( dstPitchOff ); + OUT_RING( (*y << 16) | x ); + OUT_RING( ((*y + *hpass) << 16) | (x + w) ); OUT_RING( 0xffffffff ); OUT_RING( 0xffffffff ); - OUT_RING( y << 16 | x ); - OUT_RING( *hpass << 16 | w ); + OUT_RING( *y << 16 | x ); + OUT_RING( *hpass << 16 | (*bufPitch / cpp) ); OUT_RING( dwords ); ret = ( CARD8* )&__head[__count]; @@ -701,7 +719,7 @@ RADEONHostDataBlit( __count += dwords; ADVANCE_RING(); - *dst += *hpass * dstPitch; + *y += *hpass; *h -= *hpass; return ret; @@ -761,7 +779,7 @@ void RADEONCopySwap(CARD8 *dst, CARD8 *src, unsigned int size, int swap) void RADEONHostDataBlitCopyPass( ScrnInfoPtr pScrn, - unsigned int bpp, + unsigned int cpp, CARD8 *dst, CARD8 *src, unsigned int hpass, @@ -769,7 +787,9 @@ RADEONHostDataBlitCopyPass( unsigned int srcPitch ){ +#if X_BYTE_ORDER == X_BIG_ENDIAN RADEONInfoPtr info = RADEONPTR( pScrn ); +#endif /* RADEONHostDataBlitCopy can return NULL ! */ if( (dst==NULL) || (src==NULL)) return; @@ -778,7 +798,7 @@ RADEONHostDataBlitCopyPass( { #if X_BYTE_ORDER == X_BIG_ENDIAN if (info->ChipFamily >= CHIP_FAMILY_R300) { - switch(bpp) { + switch(cpp) { case 1: RADEONCopySwap(dst, src, hpass * dstPitch, RADEON_HOST_DATA_SWAP_32BIT); @@ -799,7 +819,7 @@ RADEONHostDataBlitCopyPass( { #if X_BYTE_ORDER == X_BIG_ENDIAN if (info->ChipFamily >= CHIP_FAMILY_R300) { - switch(bpp) { + switch(cpp) { case 1: RADEONCopySwap(dst, src, minPitch, RADEON_HOST_DATA_SWAP_32BIT); @@ -812,7 +832,9 @@ RADEONHostDataBlitCopyPass( } #endif memcpy( dst, src, minPitch ); +#if X_BYTE_ORDER == X_BIG_ENDIAN next: +#endif src += srcPitch; dst += dstPitch; } diff --git a/src/radeon_bios.c b/src/radeon_bios.c index aec55b7..1ea0550 100644 --- a/src/radeon_bios.c +++ b/src/radeon_bios.c @@ -30,6 +30,8 @@ #include "config.h" #endif +#include <string.h> + #include "xf86.h" #include "xf86_OSproc.h" @@ -554,6 +556,17 @@ Bool RADEONGetTMDSInfoFromBIOS (ScrnInfoPtr pScrn) info->tmds_pll[i].freq = RADEON_BIOS16(tmp+i*10+0x10); } return TRUE; + } else if (RADEON_BIOS8(tmp) == 4) { + int stride = 0; + n = RADEON_BIOS8(tmp + 5) + 1; + if (n > 4) n = 4; + for (i=0; i<n; i++) { + info->tmds_pll[i].value = RADEON_BIOS32(tmp+stride+0x08); + info->tmds_pll[i].freq = RADEON_BIOS16(tmp+stride+0x10); + if (i == 0) stride += 10; + else stride += 6; + } + return TRUE; } /* revision 4 has some problem as it appears in RV280, diff --git a/src/radeon_common.h b/src/radeon_common.h index 1160a29..74ce50e 100644 --- a/src/radeon_common.h +++ b/src/radeon_common.h @@ -31,7 +31,7 @@ * Converted to common header format: * Jens Owen <jens@tungstengraphics.com> * - * $XdotOrg: driver/xf86-video-ati/src/radeon_common.h,v 1.8 2006/02/16 23:27:44 benh Exp $ + * $XdotOrg: driver/xf86-video-ati/src/radeon_common.h,v 1.7 2005/09/11 08:51:38 airlied Exp $ * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_common.h,v 1.8tsi Exp $ * */ diff --git a/src/radeon_commonfuncs.c b/src/radeon_commonfuncs.c index 7b72004..14260c9 100644 --- a/src/radeon_commonfuncs.c +++ b/src/radeon_commonfuncs.c @@ -171,7 +171,7 @@ void FUNC_NAME(RADEONWaitForIdle)(ScrnInfoPtr pScrn) return; } } - RADEONTRACE(("Idle timed out: %d entries, stat=0x%08x\n", + RADEONTRACE(("Idle timed out: %u entries, stat=0x%08x\n", INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, INREG(RADEON_RBBM_STATUS))); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c index 3c748a8..0154c30 100644 --- a/src/radeon_cursor.c +++ b/src/radeon_cursor.c @@ -106,45 +106,6 @@ static CARD32 mono_cursor_color[] = { #endif -#ifdef USE_EXA -static void -RADEONCursorSave(ScreenPtr pScreen, ExaOffscreenArea *area) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - - info->cursorArea = NULL; - info->cursor_offset = 0; -} - -static void -RADEONCursorAllocEXA(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - - info->cursorArea = exaOffscreenAlloc(pScreen, - CURSOR_WIDTH * 4 * CURSOR_HEIGHT, - 128, TRUE, RADEONCursorSave, info); - - if (!info->cursorArea) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Hardware cursor temporarily disabled" - " due to insufficient offscreen memory\n"); - info->cursor_offset = 0; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using hardware cursor\n", - info->cursor_offset = info->cursorArea->offset); - - RADEONCTRACE(("%s (0x%08x-0x%08x)\n", __func__, - info->cursor_offset, - info->cursor_offset + info->cursorArea->size)); - } -} -#endif - - /* Set cursor foreground and background colors */ static void RADEONSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { @@ -155,9 +116,6 @@ static void RADEONSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) RADEONCTRACE(("RADEONSetCursorColors\n")); - if (info->cursor_offset == 0) - return; - #ifdef ARGB_CURSOR /* Don't recolour cursors set with SetCursorARGB. */ if (info->cursor_argb) @@ -200,9 +158,6 @@ static void RADEONSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) int total_y = pScrn->frameY1 - pScrn->frameY0; int stride = 256; - if (info->cursor_offset == 0) - return; - if(info->MergedFB) { RADEONCTRACE(("RADEONSetCursorPositionMerged\n")); RADEONSetCursorPositionMerged(pScrn, x, y); @@ -255,9 +210,6 @@ static void RADEONLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image) CARD8 chunk; CARD32 i, j; - if (info->cursor_offset == 0) - return; - RADEONCTRACE(("RADEONLoadCursorImage (at %x)\n", info->cursor_offset)); if (!info->IsSecondary) { @@ -342,14 +294,7 @@ static Bool RADEONUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); - #ifdef USE_EXA - if (!info->cursor_offset && info->useEXA && info->cursor) - { - RADEONCursorAllocEXA(pScreen); - } -#endif - - return info->cursor_offset ? TRUE : FALSE; + return info->cursor ? TRUE : FALSE; } #ifdef ARGB_CURSOR @@ -357,9 +302,6 @@ static Bool RADEONUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) static Bool RADEONUseHWCursorARGB (ScreenPtr pScreen, CursorPtr pCurs) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - if (RADEONUseHWCursor(pScreen, pCurs) && pCurs->bits->height <= CURSOR_HEIGHT && pCurs->bits->width <= CURSOR_WIDTH) return TRUE; @@ -379,9 +321,6 @@ static void RADEONLoadCursorARGB (ScrnInfoPtr pScrn, CursorPtr pCurs) RADEONCTRACE(("RADEONLoadCursorARGB\n")); - if (info->cursor_offset == 0) - return; - if (!info->IsSecondary) { save1 = INREG(RADEON_CRTC_GEN_CNTL) & ~(CARD32) (3 << 20); save1 |= (CARD32) (2 << 20); @@ -477,11 +416,6 @@ Bool RADEONCursorInit(ScreenPtr pScreen) width_bytes = width * (pScrn->bitsPerPixel / 8); height = (size_bytes + width_bytes - 1) / width_bytes; -#ifdef USE_EXA - if (info->useEXA) { - RADEONCursorAllocEXA(pScreen); - } -#endif /* USE_EXA */ #ifdef USE_XAA if (!info->useEXA) { FBAreaPtr fbarea; diff --git a/src/radeon_dga.c b/src/radeon_dga.c index 06fc62e..f084fd3 100644 --- a/src/radeon_dga.c +++ b/src/radeon_dga.c @@ -43,6 +43,8 @@ * */ +#include <string.h> + /* Driver data structures */ #include "radeon.h" #include "radeon_probe.h" @@ -59,9 +61,9 @@ static Bool RADEON_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, static Bool RADEON_SetMode(ScrnInfoPtr, DGAModePtr); static int RADEON_GetViewport(ScrnInfoPtr); static void RADEON_SetViewport(ScrnInfoPtr, int, int, int); +#ifdef USE_XAA static void RADEON_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void RADEON_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); -#ifdef USE_XAA static void RADEON_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); #endif @@ -361,6 +363,8 @@ static void RADEON_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) } +#ifdef USE_XAA + static void RADEON_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color) @@ -420,7 +424,6 @@ static void RADEON_BlitRect(ScrnInfoPtr pScrn, #endif /* USE_XAA */ } -#ifdef USE_XAA static void RADEON_BlitTransRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long color) @@ -441,6 +444,7 @@ static void RADEON_BlitTransRect(ScrnInfoPtr pScrn, if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) RADEON_MARK_SYNC(info, pScrn); } + #endif /* USE_XAA */ static Bool RADEON_OpenFramebuffer(ScrnInfoPtr pScrn, diff --git a/src/radeon_dri.c b/src/radeon_dri.c index 7e5840c..944fddd 100644 --- a/src/radeon_dri.c +++ b/src/radeon_dri.c @@ -39,6 +39,8 @@ * */ +#include <string.h> +#include <stdio.h> /* Driver data structures */ #include "radeon.h" @@ -69,7 +71,9 @@ static void RADEONDRITransitionTo3d(ScreenPtr pScreen); static void RADEONDRITransitionMultiToSingle3d(ScreenPtr pScreen); static void RADEONDRITransitionSingleToMulti3d(ScreenPtr pScreen); +#ifdef USE_XAA static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +#endif /* Initialize the visual configs that are supported by the hardware. * These are combined with the visual configs that the indirect @@ -127,7 +131,7 @@ static Bool RADEONInitVisualConfigs(ScreenPtr pScreen) } i = 0; - for (db = 0; db <= use_db; db++) { + for (db = use_db; db >= 0; db--) { for (accum = 0; accum <= RADEON_USE_ACCUM; accum++) { for (stencil = 0; stencil <= RADEON_USE_STENCIL; stencil++) { pRADEONConfigPtrs[i] = &pRADEONConfigs[i]; @@ -160,14 +164,17 @@ static Bool RADEONInitVisualConfigs(ScreenPtr pScreen) pConfigs[i].doubleBuffer = FALSE; pConfigs[i].stereo = FALSE; pConfigs[i].bufferSize = 16; - pConfigs[i].depthSize = 16; - if (stencil) + pConfigs[i].depthSize = info->depthBits; + if (pConfigs[i].depthSize == 24 ? (RADEON_USE_STENCIL - stencil) + : stencil) { pConfigs[i].stencilSize = 8; - else + } else { pConfigs[i].stencilSize = 0; + } pConfigs[i].auxBuffers = 0; pConfigs[i].level = 0; - if (accum || stencil) { + if (accum || + (pConfigs[i].stencilSize && pConfigs[i].depthSize == 16)) { pConfigs[i].visualRating = GLX_SLOW_CONFIG; } else { pConfigs[i].visualRating = GLX_NONE; @@ -210,7 +217,7 @@ static Bool RADEONInitVisualConfigs(ScreenPtr pScreen) } i = 0; - for (db = 0; db <= use_db; db++) { + for (db = use_db; db >= 0; db--) { for (accum = 0; accum <= RADEON_USE_ACCUM; accum++) { for (stencil = 0; stencil <= RADEON_USE_STENCIL; stencil++) { pRADEONConfigPtrs[i] = &pRADEONConfigs[i]; @@ -243,16 +250,17 @@ static Bool RADEONInitVisualConfigs(ScreenPtr pScreen) pConfigs[i].doubleBuffer = FALSE; pConfigs[i].stereo = FALSE; pConfigs[i].bufferSize = 32; - if (stencil) { - pConfigs[i].depthSize = 24; + pConfigs[i].depthSize = info->depthBits; + if (pConfigs[i].depthSize == 24 ? (RADEON_USE_STENCIL - stencil) + : stencil) { pConfigs[i].stencilSize = 8; } else { - pConfigs[i].depthSize = 24; pConfigs[i].stencilSize = 0; } pConfigs[i].auxBuffers = 0; pConfigs[i].level = 0; - if (accum) { + if (accum || + (pConfigs[i].stencilSize && pConfigs[i].depthSize == 16)) { pConfigs[i].visualRating = GLX_SLOW_CONFIG; } else { pConfigs[i].visualRating = GLX_NONE; @@ -423,6 +431,10 @@ static void RADEONLeaveServer(ScreenPtr pScreen) info->CPInUse = FALSE; } + +#ifdef USE_EXA + info->engineMode = EXA_ENGINEMODE_UNKNOWN; +#endif } /* Contexts can be swapped by the X server if necessary. This callback @@ -447,6 +459,8 @@ static void RADEONDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, } } +#ifdef USE_XAA + /* The Radeon has depth tiling on all the time. Rely on surface regs to * translate the addresses (only works if allowColorTiling is true). */ @@ -507,6 +521,8 @@ static void RADEONScreenToScreenCopyDepth(ScrnInfoPtr pScrn, } } +#endif /* USE_XAA */ + /* Initialize the state of the back and depth buffers */ static void RADEONDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx) { @@ -726,8 +742,9 @@ static Bool RADEONSetAgpMode(RADEONInfoPtr info, ScreenPtr pScreen) mode &= ~RADEON_AGP_MODE_MASK; if ((mode & RADEON_AGPv3_MODE) && (INREG(RADEON_AGP_STATUS) & RADEON_AGPv3_MODE)) { + /* only set one mode bit for AGPv3 */ switch (info->agpMode) { - case 8: mode |= RADEON_AGPv3_8X_MODE; + case 8: mode |= RADEON_AGPv3_8X_MODE; break; case 4: default: mode |= RADEON_AGPv3_4X_MODE; } /*TODO: need to take care of other bits valid for v3 mode @@ -813,7 +830,7 @@ static Bool RADEONDRIAgpInit(RADEONInfoPtr info, ScreenPtr pScreen) return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[agp] %d kB allocated with handle 0x%08lx\n", + "[agp] %d kB allocated with handle 0x%08x\n", info->gartSize*1024, info->agpMemHandle); if (drmAgpBind(info->drmFD, @@ -834,7 +851,7 @@ static Bool RADEONDRIAgpInit(RADEONInfoPtr info, ScreenPtr pScreen) "[agp] ring handle = 0x%08x\n", info->ringHandle); if (drmMap(info->drmFD, info->ringHandle, info->ringMapSize, - (drmAddressPtr)&info->ring) < 0) { + &info->ring) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Could not map ring\n"); return FALSE; } @@ -853,7 +870,7 @@ static Bool RADEONDRIAgpInit(RADEONInfoPtr info, ScreenPtr pScreen) info->ringReadPtrHandle); if (drmMap(info->drmFD, info->ringReadPtrHandle, info->ringReadMapSize, - (drmAddressPtr)&info->ringReadPtr) < 0) { + &info->ringReadPtr) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Could not map ring read ptr\n"); return FALSE; @@ -873,7 +890,7 @@ static Bool RADEONDRIAgpInit(RADEONInfoPtr info, ScreenPtr pScreen) info->bufHandle); if (drmMap(info->drmFD, info->bufHandle, info->bufMapSize, - (drmAddressPtr)&info->buf) < 0) { + &info->buf) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Could not map vertex/indirect buffers\n"); return FALSE; @@ -893,7 +910,7 @@ static Bool RADEONDRIAgpInit(RADEONInfoPtr info, ScreenPtr pScreen) info->gartTexHandle); if (drmMap(info->drmFD, info->gartTexHandle, info->gartTexMapSize, - (drmAddressPtr)&info->gartTex) < 0) { + &info->gartTex) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Could not map GART texture map\n"); return FALSE; @@ -922,7 +939,7 @@ static Bool RADEONDRIPciInit(RADEONInfoPtr info, ScreenPtr pScreen) return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[pci] %d kB allocated with handle 0x%08lx\n", + "[pci] %d kB allocated with handle 0x%08x\n", info->gartSize*1024, info->pciMemHandle); RADEONDRIInitGARTValues(info); @@ -937,7 +954,7 @@ static Bool RADEONDRIPciInit(RADEONInfoPtr info, ScreenPtr pScreen) "[pci] ring handle = 0x%08x\n", info->ringHandle); if (drmMap(info->drmFD, info->ringHandle, info->ringMapSize, - (drmAddressPtr)&info->ring) < 0) { + &info->ring) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[pci] Could not map ring\n"); return FALSE; } @@ -959,7 +976,7 @@ static Bool RADEONDRIPciInit(RADEONInfoPtr info, ScreenPtr pScreen) info->ringReadPtrHandle); if (drmMap(info->drmFD, info->ringReadPtrHandle, info->ringReadMapSize, - (drmAddressPtr)&info->ringReadPtr) < 0) { + &info->ringReadPtr) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[pci] Could not map ring read ptr\n"); return FALSE; @@ -982,7 +999,7 @@ static Bool RADEONDRIPciInit(RADEONInfoPtr info, ScreenPtr pScreen) info->bufHandle); if (drmMap(info->drmFD, info->bufHandle, info->bufMapSize, - (drmAddressPtr)&info->buf) < 0) { + &info->buf) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[pci] Could not map vertex/indirect buffers\n"); return FALSE; @@ -1005,7 +1022,7 @@ static Bool RADEONDRIPciInit(RADEONInfoPtr info, ScreenPtr pScreen) info->gartTexHandle); if (drmMap(info->drmFD, info->gartTexHandle, info->gartTexMapSize, - (drmAddressPtr)&info->gartTex) < 0) { + &info->gartTex) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[pci] Could not map GART texture map\n"); return FALSE; @@ -1023,13 +1040,13 @@ static Bool RADEONDRIPciInit(RADEONInfoPtr info, ScreenPtr pScreen) static Bool RADEONDRIMapInit(RADEONInfoPtr info, ScreenPtr pScreen) { /* Map registers */ - info->registerSize = RADEON_MMIOSIZE; + info->registerSize = info->MMIOSize; if (drmAddMap(info->drmFD, info->MMIOAddr, info->registerSize, DRM_REGISTERS, DRM_READ_ONLY, &info->registerHandle) < 0) { return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, - "[drm] register handle = 0x%08lx\n", info->registerHandle); + "[drm] register handle = 0x%08x\n", info->registerHandle); return TRUE; } @@ -1058,14 +1075,14 @@ static int RADEONDRIKernelInit(RADEONInfoPtr info, ScreenPtr pScreen) drmInfo.usec_timeout = info->CPusecTimeout; drmInfo.fb_bpp = info->CurrentLayout.pixel_code; - drmInfo.depth_bpp = info->CurrentLayout.pixel_code; + drmInfo.depth_bpp = (info->depthBits - 8) * 2; drmInfo.front_offset = info->frontOffset; drmInfo.front_pitch = info->frontPitch * cpp; drmInfo.back_offset = info->backOffset; drmInfo.back_pitch = info->backPitch * cpp; drmInfo.depth_offset = info->depthOffset; - drmInfo.depth_pitch = info->depthPitch * cpp; + drmInfo.depth_pitch = info->depthPitch * drmInfo.depth_bpp / 8; drmInfo.fb_offset = info->fbHandle; drmInfo.mmio_offset = info->registerHandle; @@ -1092,24 +1109,18 @@ static void RADEONDRIGartHeapInit(RADEONInfoPtr info, ScreenPtr pScreen) drmRadeonMemInitHeap drmHeap; /* Start up the simple memory manager for GART space */ - if (info->pKernelDRMVersion->version_minor >= 6) { - drmHeap.region = RADEON_MEM_REGION_GART; - drmHeap.start = 0; - drmHeap.size = info->gartTexMapSize; - - if (drmCommandWrite(info->drmFD, DRM_RADEON_INIT_HEAP, - &drmHeap, sizeof(drmHeap))) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Failed to initialize GART heap manager\n"); - } else { - xf86DrvMsg(pScreen->myNum, X_INFO, - "[drm] Initialized kernel GART heap manager, %d\n", - info->gartTexMapSize); - } + drmHeap.region = RADEON_MEM_REGION_GART; + drmHeap.start = 0; + drmHeap.size = info->gartTexMapSize; + + if (drmCommandWrite(info->drmFD, DRM_RADEON_INIT_HEAP, + &drmHeap, sizeof(drmHeap))) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] Failed to initialize GART heap manager\n"); } else { xf86DrvMsg(pScreen->myNum, X_INFO, - "[drm] Kernel module too old (1.%d) for GART heap manager\n", - info->pKernelDRMVersion->version_minor); + "[drm] Initialized kernel GART heap manager, %d\n", + info->gartTexMapSize); } } @@ -1200,7 +1211,6 @@ Bool RADEONDRIGetVersion(ScrnInfoPtr pScrn) int major, minor, patch, fd; int req_minor, req_patch; char *busId; - drmVersionPtr libVersion; /* Check that the GLX, DRI, and DRM modules have been loaded by testing * for known symbols in each module. @@ -1294,11 +1304,8 @@ Bool RADEONDRIGetVersion(ScrnInfoPtr pScrn) } else if (info->IsIGP) { req_minor = 10; req_patch = 0; - } else if (info->ChipFamily >= CHIP_FAMILY_R200) { - req_minor = 5; - req_patch = 0; - } else { - req_minor = 3; + } else { /* Many problems have been reported with 1.7 in the 2.4 kernel */ + req_minor = 8; req_patch = 0; } @@ -1338,7 +1345,6 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) RADEONInfoPtr info = RADEONPTR(pScrn); DRIInfoPtr pDRIInfo; RADEONDRIPtr pRADEONDRI; - drmVersionPtr version; info->DRICloseScreen = NULL; @@ -1624,6 +1630,7 @@ void RADEONDRIInitPageFlip(ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); +#ifdef USE_XAA /* Have shadowfb run only while there is 3d active. This must happen late, * after XAAInit has been called */ @@ -1635,7 +1642,9 @@ void RADEONDRIInitPageFlip(ScreenPtr pScreen) } else xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ShadowFB initialized for Page Flipping\n"); - } else { + } else +#endif /* USE_XAA */ + { info->allowPageFlip = 0; } } @@ -1790,6 +1799,8 @@ void RADEONDRICloseScreen(ScreenPtr pScreen) } } +#ifdef USE_XAA + /* Use callbacks from dri.c to support pageflipping mode for a single * 3d context without need for any specific full-screen extension. * @@ -1825,7 +1836,6 @@ static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) if (!pSAREAPriv->pfAllowPageFlip && pSAREAPriv->pfCurrentPage == 0) return; -#ifdef USE_XAA /* XXX: implement for EXA */ /* pretty much a hack. */ @@ -1851,16 +1861,17 @@ static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) } } info->dst_pitch_offset &= ~RADEON_DST_TILE_MACRO; -#endif /* USE_XAA */ } +#endif /* USE_XAA */ + static void RADEONEnablePageFlip(ScreenPtr pScreen) { +#ifdef USE_XAA ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); RADEONSAREAPrivPtr pSAREAPriv = DRIGetSAREAPrivate(pScreen); -#ifdef USE_XAA /* XXX: Fix in EXA case */ if (info->allowPageFlip) { /* pretty much a hack. */ @@ -1911,10 +1922,10 @@ static void RADEONDRITransitionTo3d(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); +#ifdef USE_XAA FBAreaPtr fbarea; int width, height; -#ifdef USE_XAA /* EXA allocates these areas up front, so it doesn't do the following * stuff. */ @@ -1988,7 +1999,7 @@ static void RADEONDRITransitionTo3d(ScreenPtr pScreen) RADEONChangeSurfaces(pScrn); RADEONEnablePageFlip(pScreen); - if (info->cursor_offset != 0) + if (info->cursor) xf86ForceHWCursor (pScreen, TRUE); } @@ -2026,7 +2037,7 @@ static void RADEONDRITransitionTo2d(ScreenPtr pScreen) RADEONChangeSurfaces(pScrn); - if (info->cursor_offset != 0) + if (info->cursor) xf86ForceHWCursor (pScreen, FALSE); } diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 38ff68f..7155e42 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -1,5 +1,5 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.117 2004/02/19 22:38:12 tsi Exp $ */ -/* $XdotOrg: driver/xf86-video-ati/src/radeon_driver.c,v 1.92.2.17 2006/04/24 07:46:37 benh Exp $ */ +/* $XdotOrg: driver/xf86-video-ati/src/radeon_driver.c,v 1.116 2006/04/29 21:30:23 daenzer Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -67,6 +67,9 @@ * */ +#include <string.h> +#include <stdio.h> + /* Driver data structures */ #include "radeon.h" #include "radeon_reg.h" @@ -90,6 +93,7 @@ /* X and server generic header files */ #include "xf86.h" +#include "xf86_ansic.h" /* For xf86getsecs() */ #include "xf86_OSproc.h" #include "xf86RAC.h" #include "xf86Resources.h" @@ -129,77 +133,18 @@ static void RADEONInitDispBandwidth(ScrnInfoPtr pScrn); static void RADEONGetMergedFBOptions(ScrnInfoPtr pScrn); static int RADEONValidateMergeModes(ScrnInfoPtr pScrn); static void RADEONSetDynamicClock(ScrnInfoPtr pScrn, int mode); +static void RADEONForceSomeClocks(ScrnInfoPtr pScrn); static void RADEONUpdatePanelSize(ScrnInfoPtr pScrn); static void RADEONSaveMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save); + +#ifdef XF86DRI static void RADEONAdjustMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save); +#endif /* psuedo xinerama support */ extern Bool RADEONnoPanoramiXExtension; -typedef enum { - OPTION_NOACCEL, - OPTION_SW_CURSOR, - OPTION_DAC_6BIT, - OPTION_DAC_8BIT, -#ifdef XF86DRI - OPTION_BUS_TYPE, - OPTION_CP_PIO, - OPTION_USEC_TIMEOUT, - OPTION_AGP_MODE, - OPTION_AGP_FW, - OPTION_GART_SIZE, - OPTION_GART_SIZE_OLD, - OPTION_RING_SIZE, - OPTION_BUFFER_SIZE, - OPTION_DEPTH_MOVE, - OPTION_PAGE_FLIP, - OPTION_NO_BACKBUFFER, - OPTION_XV_DMA, - OPTION_FBTEX_PERCENT, -#endif - OPTION_PANEL_OFF, - OPTION_DDC_MODE, - OPTION_MONITOR_LAYOUT, - OPTION_IGNORE_EDID, - OPTION_FBDEV, - OPTION_MERGEDFB, - OPTION_CRT2HSYNC, - OPTION_CRT2VREFRESH, - OPTION_CRT2POS, - OPTION_METAMODES, - OPTION_MERGEDDPI, - OPTION_RADEONXINERAMA, - OPTION_CRT2ISSCRN0, - OPTION_MERGEDFBNONRECT, - OPTION_MERGEDFBMOUSER, - OPTION_DISP_PRIORITY, - OPTION_PANEL_SIZE, - OPTION_MIN_DOTCLOCK, - OPTION_COLOR_TILING, -#ifdef XvExtension - OPTION_VIDEO_KEY, - OPTION_RAGE_THEATRE_CRYSTAL, - OPTION_RAGE_THEATRE_TUNER_PORT, - OPTION_RAGE_THEATRE_COMPOSITE_PORT, - OPTION_RAGE_THEATRE_SVIDEO_PORT, - OPTION_TUNER_TYPE, - OPTION_RAGE_THEATRE_MICROC_PATH, - OPTION_RAGE_THEATRE_MICROC_TYPE, -#endif -#ifdef RENDER - OPTION_RENDER_ACCEL, - OPTION_SUBPIXEL_ORDER, -#endif - OPTION_SHOWCACHE, - OPTION_DYNAMIC_CLOCKS, - OPTION_BIOS_HOTKEYS, - OPTION_VGA_ACCESS, - OPTION_REVERSE_DDC, - OPTION_LVDS_PROBE_PLL, - OPTION_ACCELMETHOD -} RADEONOpts; - static const OptionInfoRec RADEONOptions[] = { { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, @@ -220,6 +165,10 @@ static const OptionInfoRec RADEONOptions[] = { { OPTION_NO_BACKBUFFER, "NoBackBuffer", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_XV_DMA, "DMAForXv", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FBTEX_PERCENT, "FBTexPercent", OPTV_INTEGER, {0}, FALSE }, + { OPTION_DEPTH_BITS, "DepthBits", OPTV_INTEGER, {0}, FALSE }, +#ifdef USE_EXA + { OPTION_ACCEL_DFS, "AccelDFS", OPTV_BOOLEAN, {0}, FALSE }, +#endif #endif { OPTION_PANEL_OFF, "PanelOff", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DDC_MODE, "DDCMode", OPTV_BOOLEAN, {0}, FALSE }, @@ -261,6 +210,7 @@ static const OptionInfoRec RADEONOptions[] = { { OPTION_REVERSE_DDC, "ReverseDDC", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_LVDS_PROBE_PLL, "LVDSProbePLL", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ACCELMETHOD, "AccelMethod", OPTV_STRING, {0}, FALSE }, + { OPTION_CONSTANTDPI, "ConstantDPI", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -324,6 +274,7 @@ static const char *fbSymbols[] = { #ifdef USE_EXA static const char *exaSymbols[] = { + "exaDriverAlloc", "exaDriverInit", "exaDriverFini", "exaOffscreenAlloc", @@ -518,7 +469,7 @@ static const RADEONTMDSPll default_tmds_pll[CHIP_FAMILY_LAST][4] = {{15000, 0xa1b}, {0xffffffff, 0xa3f}, {0, 0}, {0, 0}}, /*CHIP_FAMILY_R200*/ {{15500, 0x81b}, {0xffffffff, 0x83f}, {0, 0}, {0, 0}}, /*CHIP_FAMILY_RV250*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, /*CHIP_FAMILY_RS300*/ - {{13000, 0x400f4}, {15000, 0x400f7}, {0xffffffff, 0x400f7/*0x40111*/}, {0, 0}}, /*CHIP_FAMILY_RV280*/ + {{13000, 0x400f4}, {15000, 0x400f7}, {0xffffffff, 0x40111}, {0, 0}}, /*CHIP_FAMILY_RV280*/ {{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}}, /*CHIP_FAMILY_R300*/ {{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}}, /*CHIP_FAMILY_R350*/ {{15000, 0xb0155}, {0xffffffff, 0xb01cb}, {0, 0}, {0, 0}}, /*CHIP_FAMILY_RV350*/ @@ -708,7 +659,7 @@ static Bool RADEONMapMMIO(ScrnInfoPtr pScrn) VIDMEM_MMIO | VIDMEM_READSIDEEFFECT, info->PciTag, info->MMIOAddr, - RADEON_MMIOSIZE); + info->MMIOSize); } if (!info->MMIO) return FALSE; @@ -725,7 +676,7 @@ static Bool RADEONUnmapMMIO(ScrnInfoPtr pScrn) if (info->FBDev) fbdevHWUnmapMMIO(pScrn); else { - xf86UnMapVidMem(pScrn->scrnIndex, info->MMIO, RADEON_MMIOSIZE); + xf86UnMapVidMem(pScrn->scrnIndex, info->MMIO, info->MMIOSize); } info->MMIO = NULL; return TRUE; @@ -739,7 +690,7 @@ static Bool RADEONMapFB(ScrnInfoPtr pScrn) if (info->FBDev) { info->FB = fbdevHWMapVidmem(pScrn); } else { - RADEONTRACE(("Map: 0x%08x, 0x%08x\n", info->LinearAddr, info->FbMapSize)); + RADEONTRACE(("Map: 0x%08lx, 0x%08lx\n", info->LinearAddr, info->FbMapSize)); info->FB = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, info->PciTag, @@ -2295,7 +2246,7 @@ static void RADEONInitMemoryMap(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - unsigned long agp_size, agp_base, mem_size; + unsigned long mem_size; /* Default to existing values */ info->mc_fb_location = INREG(RADEON_MC_FB_LOCATION); @@ -2360,8 +2311,6 @@ static void RADEONInitMemoryMap(ScrnInfoPtr pScrn) RADEONTRACE(("RADEONInitMemoryMap() : \n")); RADEONTRACE((" mem_size : 0x%08lx\n", mem_size)); - RADEONTRACE((" agp_size : 0x%08lx\n", agp_size)); - RADEONTRACE((" agp_base : 0x%08lx\n", agp_base)); RADEONTRACE((" MC_FB_LOCATION : 0x%08lx\n", info->mc_fb_location)); RADEONTRACE((" MC_AGP_LOCATION : 0x%08lx\n", info->mc_agp_location)); } @@ -2414,9 +2363,6 @@ static void RADEONGetVRamType(ScrnInfoPtr pScrn) static CARD32 RADEONGetAccessibleVRAM(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); - EntityInfoPtr pEnt = info->pEnt; - GDevPtr dev = pEnt->device; - MessageType from; unsigned char *RADEONMMIO = info->MMIO; CARD32 aper_size = INREG(RADEON_CONFIG_APER_SIZE) / 1024; @@ -2428,7 +2374,7 @@ static CARD32 RADEONGetAccessibleVRAM(ScrnInfoPtr pScrn) if (info->directRenderingEnabled && info->pKernelDRMVersion->version_minor < 23) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "[dri] limiting video memory to one aperture of %dK\n", + "[dri] limiting video memory to one aperture of %ldK\n", aper_size); xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "[dri] detected radeon kernel module version 1.%d but" @@ -2519,8 +2465,8 @@ static Bool RADEONPreInitVRAM(ScrnInfoPtr pScrn) accessible = bar_size; xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected total video RAM=%dK, accessible=%dK " - "(PCI BAR=%dK)\n", + "Detected total video RAM=%dK, accessible=%ldK " + "(PCI BAR=%ldK)\n", pScrn->videoRam, accessible, bar_size); if (pScrn->videoRam > accessible) pScrn->videoRam = accessible; @@ -3011,8 +2957,9 @@ static Bool RADEONPreInitChipType(ScrnInfoPtr pScrn) "Option ShowCache enabled\n"); #ifdef RENDER - info->RenderAccel = xf86ReturnOptValBool (info->Options, - OPTION_RENDER_ACCEL, TRUE); + info->RenderAccel = xf86ReturnOptValBool(info->Options, OPTION_RENDER_ACCEL, + info->Chipset != PCI_CHIP_RN50_515E && + info->Chipset != PCI_CHIP_RN50_5969); #endif return TRUE; @@ -4355,10 +4302,13 @@ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) /* Set DPI */ /* xf86SetDpi(pScrn, 0, 0); */ - if(info->MergedFB) + if (info->MergedFB) { RADEONMergedFBSetDpi(pScrn, info->CRT2pScrn, info->CRT2Position); - else + } else { xf86SetDpi(pScrn, 0, 0); + info->RADEONDPIVX = pScrn->virtualX; + info->RADEONDPIVY = pScrn->virtualY; + } /* Get ScreenInit function */ if (!xf86LoadSubModule(pScrn, "fb")) return FALSE; @@ -4393,6 +4343,8 @@ static Bool RADEONPreInitAccel(ScrnInfoPtr pScrn) char *optstr; #endif + info->useEXA = FALSE; + if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { int errmaj = 0, errmin = 0; @@ -4418,7 +4370,7 @@ static Bool RADEONPreInitAccel(ScrnInfoPtr pScrn) #ifdef USE_EXA if (info->useEXA) { - info->exaReq.majorversion = 1; + info->exaReq.majorversion = 2; info->exaReq.minorversion = 0; if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL, @@ -4460,13 +4412,32 @@ static Bool RADEONPreInitAccel(ScrnInfoPtr pScrn) static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10) { +#if !defined(__powerpc__) RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + CARD32 fp2_gen_ctl_save = 0; -#if !defined(__powerpc__) if (xf86LoadSubModule(pScrn, "int10")) { xf86LoaderReqSymLists(int10Symbols, NULL); + + /* The VGA BIOS on the RV100/QY cannot be read when the digital output + * is enabled. Clear and restore FP2_ON around int10 to avoid this. + */ + if (info->PciInfo->chipType == PCI_CHIP_RV100_QY) { + fp2_gen_ctl_save = INREG(RADEON_FP2_GEN_CNTL); + if (fp2_gen_ctl_save & RADEON_FP2_ON) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "disabling digital out\n"); + OUTREG(RADEON_FP2_GEN_CNTL, fp2_gen_ctl_save & ~RADEON_FP2_ON); + } + } + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); *ppInt10 = xf86InitInt10(info->pEnt->index); + + if (fp2_gen_ctl_save & RADEON_FP2_ON) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "re-enabling digital out\n"); + OUTREG(RADEON_FP2_GEN_CNTL, fp2_gen_ctl_save); + } } #endif return TRUE; @@ -4497,6 +4468,26 @@ static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn) if (info->IsSecondary) return FALSE; + if (info->Chipset == PCI_CHIP_RN50_515E || + info->Chipset == PCI_CHIP_RN50_5969) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Direct rendering not supported on RN50\n"); + return FALSE; + } + + if (info->Chipset == PCI_CHIP_RS400_5A41 || + info->Chipset == PCI_CHIP_RS400_5A42 || + info->Chipset == PCI_CHIP_RC410_5A61 || + info->Chipset == PCI_CHIP_RC410_5A62 || + info->Chipset == PCI_CHIP_RS480_5954 || + info->Chipset == PCI_CHIP_RS480_5955 || + info->Chipset == PCI_CHIP_RS482_5974 || + info->Chipset == PCI_CHIP_RS482_5975) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Direct rendering broken on XPRESS 200 and 200M\n"); + return FALSE; + } + if (xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "[dri] Acceleration disabled, not initializing the DRI\n"); @@ -4671,15 +4662,12 @@ static void RADEONPreInitColorTiling(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); + info->allowColorTiling = xf86ReturnOptValBool(info->Options, + OPTION_COLOR_TILING, TRUE); if (IS_R300_VARIANT) { - /* false by default on R3/4xx */ - info->allowColorTiling = xf86ReturnOptValBool(info->Options, - OPTION_COLOR_TILING, FALSE); info->MaxSurfaceWidth = 3968; /* one would have thought 4096...*/ info->MaxLines = 4096; } else { - info->allowColorTiling = xf86ReturnOptValBool(info->Options, - OPTION_COLOR_TILING, TRUE); info->MaxSurfaceWidth = 2048; info->MaxLines = 2048; } @@ -4816,7 +4804,7 @@ _X_EXPORT Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) const char *s; char* microc_path = NULL; char* microc_type = NULL; - + MessageType from; RADEONTRACE(("RADEONPreInit\n")); if (pScrn->numEntities != 1) return FALSE; @@ -4838,6 +4826,7 @@ _X_EXPORT Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) info->PciInfo->device, info->PciInfo->func); info->MMIOAddr = info->PciInfo->memBase[2] & 0xffffff00; + info->MMIOSize = (1 << info->PciInfo->size[2]); if (info->pEnt->device->IOBase) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "MMIO address override, using 0x%08lx instead of 0x%08lx\n", @@ -4849,7 +4838,7 @@ _X_EXPORT Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) goto fail1; } xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "MMIO registers at 0x%08lx\n", info->MMIOAddr); + "MMIO registers at 0x%08lx: size %ldKB\n", info->MMIOAddr, info->MMIOSize / 1024); if(!RADEONMapMMIO(pScrn)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -5056,6 +5045,25 @@ _X_EXPORT Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) info->DispPriority = 1; } + info->constantDPI = -1; + from = X_DEFAULT; + if (xf86GetOptValBool(info->Options, OPTION_CONSTANTDPI, &info->constantDPI)) { + from = X_CONFIG; + } else { + if (monitorResolution > 0) { + info->constantDPI = TRUE; + from = X_CMDLINE; + xf86DrvMsg(pScrn->scrnIndex, from, + "\"-dpi %d\" given in command line, assuming \"ConstantDPI\" set\n", + monitorResolution); + } else { + info->constantDPI = FALSE; + } + } + xf86DrvMsg(pScrn->scrnIndex, from, + "X server will %skeep DPI constant for all screen sizes\n", + info->constantDPI ? "" : "not "); + if (xf86ReturnOptValBool(info->Options, OPTION_FBDEV, FALSE)) { /* check for Linux framebuffer device */ @@ -5337,6 +5345,7 @@ Bool RADEONSetupMemXAA_DRI(int scrnIndex, ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); int cpp = info->CurrentLayout.pixel_bytes; + int depthCpp = (info->depthBits - 8) / 4; int width_bytes = pScrn->displayWidth * cpp; int bufferSize; int depthSize; @@ -5367,7 +5376,7 @@ Bool RADEONSetupMemXAA_DRI(int scrnIndex, ScreenPtr pScreen) */ info->depthPitch = (pScrn->displayWidth + 31) & ~31; depthSize = ((((pScrn->virtualY + 15) & ~15) * info->depthPitch - * cpp + RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN); + * depthCpp + RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN); switch (info->CPMode) { case RADEON_DEFAULT_CP_PIO_MODE: @@ -5581,7 +5590,7 @@ Bool RADEONSetupMemXAA_DRI(int scrnIndex, ScreenPtr pScreen) info->depthOffset); if (info->cardType==CARD_PCIE) xf86DrvMsg(scrnIndex, X_INFO, - "Will use %d kb for PCI GART table at offset 0x%x\n", + "Will use %d kb for PCI GART table at offset 0x%lx\n", info->pciGartSize/1024, info->pciGartOffset); xf86DrvMsg(scrnIndex, X_INFO, "Will use %d kb for textures at offset 0x%x\n", @@ -5593,7 +5602,7 @@ Bool RADEONSetupMemXAA_DRI(int scrnIndex, ScreenPtr pScreen) info->backPitchOffset = (((info->backPitch * cpp / 64) << 22) | ((info->backOffset + info->fbLocation) >> 10)); - info->depthPitchOffset = (((info->depthPitch * cpp / 64) << 22) | + info->depthPitchOffset = (((info->depthPitch * depthCpp / 64) << 22) | ((info->depthOffset + info->fbLocation) >> 10)); return TRUE; } @@ -5673,11 +5682,13 @@ _X_EXPORT Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, char* s; #endif - RADEONTRACE(("RADEONScreenInit %x %d\n", + RADEONTRACE(("RADEONScreenInit %lx %ld\n", pScrn->memPhysBase, pScrn->fbOffset)); info->accelOn = FALSE; +#ifdef USE_XAA info->accel = NULL; +#endif pScrn->fbOffset = 0; if (info->IsSecondary) pScrn->fbOffset = pScrn->videoRam * 1024; if (!RADEONMapMem(pScrn)) return FALSE; @@ -5699,6 +5710,9 @@ _X_EXPORT Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, } } + if ((!info->IsSecondary) && (IS_R300_VARIANT || IS_RV100_VARIANT)) + RADEONForceSomeClocks(pScrn); + if (info->allowColorTiling && (pScrn->virtualX > info->MaxSurfaceWidth)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Color tiling not supported with virtual x resolutions larger than %d, disabling\n", @@ -5728,6 +5742,26 @@ _X_EXPORT Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, miSetPixmapDepths (); #ifdef XF86DRI + if (info->directRenderingEnabled) { + MessageType from; + + info->depthBits = pScrn->depth; + + from = xf86GetOptValInteger(info->Options, OPTION_DEPTH_BITS, + &info->depthBits) + ? X_CONFIG : X_DEFAULT; + + if (info->depthBits != 16 && info->depthBits != 24) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Value for Option \"DepthBits\" must be 16 or 24\n"); + info->depthBits = pScrn->depth; + from = X_DEFAULT; + } + + xf86DrvMsg(pScrn->scrnIndex, from, + "Using %d bit depth buffer\n", info->depthBits); + } + /* Setup DRI after visuals have been established, but before fbScreenInit is * called. fbScreenInit will eventually call the driver's InitGLXVisuals * call back. */ @@ -5891,21 +5925,36 @@ _X_EXPORT Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, #ifdef USE_EXA if (info->useEXA) { #ifdef XF86DRI - /* Reserve approx. half of offscreen memory for local textures by - * default, can be overridden with Option "FBTexPercent". - * Round down to a whole number of texture regions. - */ - info->textureSize = 50; + MessageType from = X_DEFAULT; - if (xf86GetOptValInteger(info->Options, OPTION_FBTEX_PERCENT, - &(info->textureSize))) { - if (info->textureSize < 0 || info->textureSize > 100) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Illegal texture memory percentage: %dx, setting to default 50%\n", - info->textureSize); - info->textureSize = 50; + if (hasDRI) { + info->accelDFS = info->cardType != CARD_AGP; + + if (xf86GetOptValInteger(info->Options, OPTION_ACCEL_DFS, + &info->accelDFS)) { + from = X_CONFIG; + } + + /* Reserve approx. half of offscreen memory for local textures by + * default, can be overridden with Option "FBTexPercent". + * Round down to a whole number of texture regions. + */ + info->textureSize = 50; + + if (xf86GetOptValInteger(info->Options, OPTION_FBTEX_PERCENT, + &(info->textureSize))) { + if (info->textureSize < 0 || info->textureSize > 100) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Illegal texture memory percentage: %dx, setting to default 50%%\n", + info->textureSize); + info->textureSize = 50; + } } } + + xf86DrvMsg(pScrn->scrnIndex, from, + "%ssing accelerated EXA DownloadFromScreen hook\n", + info->accelDFS ? "U" : "Not u"); #endif /* XF86DRI */ if (!RADEONSetupMemEXA(pScreen)) @@ -6127,7 +6176,7 @@ static void RADEONRestoreMemMapRegisters(ScrnInfoPtr pScrn, { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int i, timeout; + int timeout; RADEONTRACE(("RADEONRestoreMemMapRegisters() : \n")); RADEONTRACE((" MC_FB_LOCATION : 0x%08lx\n", restore->mc_fb_location)); @@ -6191,8 +6240,8 @@ static void RADEONRestoreMemMapRegisters(ScrnInfoPtr pScrn, xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Timeout trying to update memory controller settings !\n"); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "MC_STATUS = 0x%08x (on entry = 0x%08x)\n", - INREG(RADEON_MC_STATUS), old_mc_status); + "MC_STATUS = 0x%08x (on entry = 0x%08x)\n", + INREG(RADEON_MC_STATUS), (unsigned int)old_mc_status); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "You will probably crash now ... \n"); /* Nothing we can do except maybe try to kill the server, @@ -6266,6 +6315,7 @@ static void RADEONRestoreMemMapRegisters(ScrnInfoPtr pScrn, RADEONTRACE(("Memory map updated.\n")); } +#ifdef XF86DRI static void RADEONAdjustMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) { RADEONInfoPtr info = RADEONPTR(pScrn); @@ -6300,7 +6350,30 @@ static void RADEONAdjustMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) if (fb_loc_changed) RADEONRestoreMemMapRegisters(pScrn, save); } + +#ifdef USE_EXA + if (info->accelDFS) + { + drmRadeonGetParam gp; + int gart_base; + + memset(&gp, 0, sizeof(gp)); + gp.param = RADEON_PARAM_GART_BASE; + gp.value = &gart_base; + + if (drmCommandWriteRead(info->drmFD, DRM_RADEON_GETPARAM, &gp, + sizeof(gp)) < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to determine GART area MC location, not using " + "accelerated DownloadFromScreen hook!\n"); + info->accelDFS = FALSE; + } else { + info->gartLocation = gart_base; + } + } +#endif /* USE_EXA */ } +#endif /* Write common registers */ static void RADEONRestoreCommonRegisters(ScrnInfoPtr pScrn, @@ -6373,7 +6446,7 @@ static void RADEONRestoreCrtcRegisters(ScrnInfoPtr pScrn, RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - RADEONTRACE(("Programming CRTC1, offset: 0x%08x\n", + RADEONTRACE(("Programming CRTC1, offset: 0x%08lx\n", restore->crtc_offset)); /* We prevent the CRTC from hitting the memory controller until @@ -6421,7 +6494,7 @@ static void RADEONRestoreCrtc2Registers(ScrnInfoPtr pScrn, unsigned char *RADEONMMIO = info->MMIO; CARD32 crtc2_gen_cntl; - RADEONTRACE(("Programming CRTC2, offset: 0x%08x\n", + RADEONTRACE(("Programming CRTC2, offset: 0x%08lx\n", restore->crtc2_offset)); crtc2_gen_cntl = INREG(RADEON_CRTC2_GEN_CNTL) & @@ -6666,7 +6739,7 @@ static void RADEONRestorePLLRegisters(ScrnInfoPtr pScrn, | RADEON_PPLL_ATOMIC_UPDATE_EN | RADEON_PPLL_VGA_ATOMIC_UPDATE_EN)); - RADEONTRACE(("Wrote: 0x%08x 0x%08x 0x%08x (0x%08x)\n", + RADEONTRACE(("Wrote: 0x%08x 0x%08x 0x%08lx (0x%08x)\n", restore->ppll_ref_div, restore->ppll_div_3, restore->htotal_cntl, @@ -6725,12 +6798,12 @@ static void RADEONRestorePLL2Registers(ScrnInfoPtr pScrn, | RADEON_P2PLL_ATOMIC_UPDATE_EN | RADEON_P2PLL_VGA_ATOMIC_UPDATE_EN)); - RADEONTRACE(("Wrote: 0x%08x 0x%08x 0x%08x (0x%08x)\n", + RADEONTRACE(("Wrote: 0x%08lx 0x%08lx 0x%08lx (0x%08x)\n", restore->p2pll_ref_div, restore->p2pll_div_0, restore->htotal_cntl2, INPLL(pScrn, RADEON_P2PLL_CNTL))); - RADEONTRACE(("Wrote: rd=%d, fd=%d, pd=%d\n", + RADEONTRACE(("Wrote: rd=%ld, fd=%ld, pd=%ld\n", restore->p2pll_ref_div & RADEON_P2PLL_REF_DIV_MASK, restore->p2pll_div_0 & RADEON_P2PLL_FB0_DIV_MASK, (restore->p2pll_div_0 & RADEON_P2PLL_POST0_DIV_MASK) >>16)); @@ -6787,7 +6860,7 @@ void RADEONChangeSurfaces(ScrnInfoPtr pScrn) int width_bytes = pScrn->displayWidth * cpp; int bufferSize = ((((pScrn->virtualY + 15) & ~15) * width_bytes + RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN); - unsigned int depth_pattern, color_pattern, swap_pattern; + unsigned int color_pattern, swap_pattern; if (!info->allowColorTiling) return; @@ -6806,28 +6879,21 @@ void RADEONChangeSurfaces(ScrnInfoPtr pScrn) #endif if (info->ChipFamily < CHIP_FAMILY_R200) { color_pattern = RADEON_SURF_TILE_COLOR_MACRO; - if (cpp == 2) - depth_pattern = RADEON_SURF_TILE_DEPTH_16BPP; - else - depth_pattern = RADEON_SURF_TILE_DEPTH_32BPP; } else if (IS_R300_VARIANT) { color_pattern = R300_SURF_TILE_COLOR_MACRO; - if (cpp == 2) - depth_pattern = R300_SURF_TILE_COLOR_MACRO; - else - depth_pattern = R300_SURF_TILE_COLOR_MACRO | R300_SURF_TILE_DEPTH_32BPP; } else { color_pattern = R200_SURF_TILE_COLOR_MACRO; - if (cpp == 2) - depth_pattern = R200_SURF_TILE_DEPTH_16BPP; - else - depth_pattern = R200_SURF_TILE_DEPTH_32BPP; } #ifdef XF86DRI if (info->directRenderingInited) { drmRadeonSurfaceFree drmsurffree; drmRadeonSurfaceAlloc drmsurfalloc; int retvalue; + int depthCpp = (info->depthBits - 8) / 4; + int depth_width_bytes = pScrn->displayWidth * depthCpp; + int depthBufferSize = ((((pScrn->virtualY + 15) & ~15) * depth_width_bytes + + RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN); + unsigned int depth_pattern; drmsurffree.address = info->frontOffset; retvalue = drmCommandWrite(info->drmFD, DRM_RADEON_SURF_FREE, @@ -6872,17 +6938,34 @@ void RADEONChangeSurfaces(ScrnInfoPtr pScrn) "drm: could not allocate surface for back buffer!\n"); } + if (info->ChipFamily < CHIP_FAMILY_R200) { + if (depthCpp == 2) + depth_pattern = RADEON_SURF_TILE_DEPTH_16BPP; + else + depth_pattern = RADEON_SURF_TILE_DEPTH_32BPP; + } else if (IS_R300_VARIANT) { + if (depthCpp == 2) + depth_pattern = R300_SURF_TILE_COLOR_MACRO; + else + depth_pattern = R300_SURF_TILE_COLOR_MACRO | R300_SURF_TILE_DEPTH_32BPP; + } else { + if (depthCpp == 2) + depth_pattern = R200_SURF_TILE_DEPTH_16BPP; + else + depth_pattern = R200_SURF_TILE_DEPTH_32BPP; + } + /* rv100 and probably the derivative igps don't have depth tiling on all the time? */ if (info->have3DWindows && ((info->ChipFamily != CHIP_FAMILY_RV100) || (info->ChipFamily != CHIP_FAMILY_RS100) || (info->ChipFamily != CHIP_FAMILY_RS200))) { drmRadeonSurfaceAlloc drmsurfalloc; - drmsurfalloc.size = bufferSize; + drmsurfalloc.size = depthBufferSize; drmsurfalloc.address = info->depthOffset; if (IS_R300_VARIANT) - drmsurfalloc.flags = swap_pattern | (width_bytes / 8) | depth_pattern; + drmsurfalloc.flags = swap_pattern | (depth_width_bytes / 8) | depth_pattern; else - drmsurfalloc.flags = swap_pattern | (width_bytes / 16) | depth_pattern; + drmsurfalloc.flags = swap_pattern | (depth_width_bytes / 16) | depth_pattern; retvalue = drmCommandWrite(info->drmFD, DRM_RADEON_SURF_ALLOC, &drmsurfalloc, sizeof(drmsurfalloc)); if (retvalue < 0) @@ -7163,7 +7246,7 @@ static void RADEONSavePLLRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) save->ppll_div_3 = INPLL(pScrn, RADEON_PPLL_DIV_3); save->htotal_cntl = INPLL(pScrn, RADEON_HTOTAL_CNTL); - RADEONTRACE(("Read: 0x%08x 0x%08x 0x%08x\n", + RADEONTRACE(("Read: 0x%08x 0x%08x 0x%08lx\n", save->ppll_ref_div, save->ppll_div_3, save->htotal_cntl)); @@ -7180,11 +7263,11 @@ static void RADEONSavePLL2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save) save->p2pll_div_0 = INPLL(pScrn, RADEON_P2PLL_DIV_0); save->htotal_cntl2 = INPLL(pScrn, RADEON_HTOTAL2_CNTL); - RADEONTRACE(("Read: 0x%08x 0x%08x 0x%08x\n", + RADEONTRACE(("Read: 0x%08lx 0x%08lx 0x%08lx\n", save->p2pll_ref_div, save->p2pll_div_0, save->htotal_cntl2)); - RADEONTRACE(("Read: rd=%d, fd=%d, pd=%d\n", + RADEONTRACE(("Read: rd=%ld, fd=%ld, pd=%ld\n", save->p2pll_ref_div & RADEON_P2PLL_REF_DIV_MASK, save->p2pll_div_0 & RADEON_P2PLL_FB0_DIV_MASK, (save->p2pll_div_0 & RADEON_P2PLL_POST0_DIV_MASK) >> 16)); @@ -7632,15 +7715,7 @@ static void RADEONInitDispBandwidth(ScrnInfoPtr pScrn) if (critical_point < temp) critical_point = temp; */ if (info->DispPriority == 2) { - if (mode2) { - /*??some R300 cards have problem with this set to 0, when CRTC2 is enabled.*/ - if (info->ChipFamily == CHIP_FAMILY_R300) - critical_point += 0x10; - else - critical_point = 0; - } - else - critical_point = 0; + critical_point = 0; } /* @@ -7649,6 +7724,11 @@ static void RADEONInitDispBandwidth(ScrnInfoPtr pScrn) */ if (max_stop_req - critical_point < 4) critical_point = 0; + if (critical_point == 0 && mode2 && info->ChipFamily == CHIP_FAMILY_R300) { + /* some R300 cards have problem with this set to 0, when CRTC2 is enabled.*/ + critical_point = 0x10; + } + temp = info->SavedReg.grph_buffer_cntl; temp &= ~(RADEON_GRPH_STOP_REQ_MASK); temp |= (stop_req << RADEON_GRPH_STOP_REQ_SHIFT); @@ -7670,7 +7750,7 @@ static void RADEONInitDispBandwidth(ScrnInfoPtr pScrn) (critical_point << RADEON_GRPH_CRITICAL_POINT_SHIFT))); RADEONTRACE(("GRPH_BUFFER_CNTL from %x to %x\n", - info->SavedReg.grph_buffer_cntl, INREG(RADEON_GRPH_BUFFER_CNTL))); + (unsigned int)info->SavedReg.grph_buffer_cntl, INREG(RADEON_GRPH_BUFFER_CNTL))); if (mode2) { stop_req = mode2->HDisplay * info2->CurrentLayout.pixel_bytes / 16; @@ -7702,21 +7782,23 @@ static void RADEONInitDispBandwidth(ScrnInfoPtr pScrn) disp_latency) * disp_drain_rate2 + 0.5); if (info->DispPriority == 2) { - if (info->ChipFamily == CHIP_FAMILY_R300) - critical_point2 += 0x10; - else - critical_point2 = 0; + critical_point2 = 0; } if (max_stop_req - critical_point2 < 4) critical_point2 = 0; } + if (critical_point2 == 0 && info->ChipFamily == CHIP_FAMILY_R300) { + /* some R300 cards have problem with this set to 0 */ + critical_point2 = 0x10; + } + OUTREG(RADEON_GRPH2_BUFFER_CNTL, ((temp & ~RADEON_GRPH_CRITICAL_POINT_MASK) | (critical_point2 << RADEON_GRPH_CRITICAL_POINT_SHIFT))); RADEONTRACE(("GRPH2_BUFFER_CNTL from %x to %x\n", - info->SavedReg.grph2_buffer_cntl, INREG(RADEON_GRPH2_BUFFER_CNTL))); + (unsigned int)info->SavedReg.grph2_buffer_cntl, INREG(RADEON_GRPH2_BUFFER_CNTL))); } } @@ -7908,7 +7990,7 @@ static Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, save->tv_dac_cntl |= (0x03 | (2<<8) | (0x58<<16)); } - RADEONTRACE(("Pitch = %d bytes (virtualX = %d, displayWidth = %d)\n", + RADEONTRACE(("Pitch = %ld bytes (virtualX = %d, displayWidth = %d)\n", save->crtc_pitch, pScrn->virtualX, info->CurrentLayout.displayWidth)); return TRUE; @@ -8113,7 +8195,7 @@ static Bool RADEONInitCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save, } #endif - RADEONTRACE(("Pitch = %d bytes (virtualX = %d, displayWidth = %d)\n", + RADEONTRACE(("Pitch = %ld bytes (virtualX = %d, displayWidth = %d)\n", save->crtc2_pitch, pScrn->virtualX, info->CurrentLayout.displayWidth)); @@ -8286,7 +8368,7 @@ static void RADEONInitFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr orig, save->tmds_pll_cntl = (orig->tmds_pll_cntl & 0xfff00000) | tmp; } else save->tmds_pll_cntl = tmp; - RADEONTRACE(("TMDS_PLL from %x to %x\n", + RADEONTRACE(("TMDS_PLL from %lx to %lx\n", orig->tmds_pll_cntl, save->tmds_pll_cntl)); @@ -8418,7 +8500,7 @@ static void RADEONInitPLLRegisters(ScrnInfoPtr pScrn, RADEONInfoPtr info, pll->reference_freq); save->post_div = post_div->divider; - RADEONTRACE(("dc=%d, of=%d, fd=%d, pd=%d\n", + RADEONTRACE(("dc=%ld, of=%ld, fd=%d, pd=%d\n", save->dot_clock_freq, save->pll_output_freq, save->feedback_div, @@ -8480,7 +8562,7 @@ static void RADEONInitPLL2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save, pll->reference_freq); save->post_div_2 = post_div->divider; - RADEONTRACE(("dc=%d, of=%d, fd=%d, pd=%d\n", + RADEONTRACE(("dc=%ld, of=%ld, fd=%d, pd=%d\n", save->dot_clock_freq_2, save->pll_output_freq_2, save->feedback_div_2, @@ -8657,6 +8739,26 @@ static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode) return TRUE; } +static void +RADEONResetDPI(ScrnInfoPtr pScrn, Bool force) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + + if(force || + (info->RADEONDPIVX != pScrn->virtualX) || + (info->RADEONDPIVY != pScrn->virtualY) + ) { + + pScreen->mmWidth = (pScrn->virtualX * 254 + pScrn->xDpi * 5) / (pScrn->xDpi * 10); + pScreen->mmHeight = (pScrn->virtualY * 254 + pScrn->yDpi * 5) / (pScrn->yDpi * 10); + + info->RADEONDPIVX = pScrn->virtualX; + info->RADEONDPIVY = pScrn->virtualY; + + } +} + _X_EXPORT Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; @@ -8741,8 +8843,11 @@ _X_EXPORT Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) /* Since RandR (indirectly) uses SwitchMode(), we need to * update our Xinerama info here, too, in case of resizing */ - if(info->MergedFB) { - RADEONUpdateXineramaScreenInfo(pScrn); + if (info->MergedFB) { + RADEONMergedFBResetDpi(pScrn, FALSE); + RADEONUpdateXineramaScreenInfo(pScrn); + } else if(info->constantDPI) { + RADEONResetDPI(pScrn, FALSE); } return ret; @@ -8781,7 +8886,7 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int clone) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int reg, Base, regcntl, crtcoffsetcntl, xytilereg, crtcxytile; + int reg, Base, regcntl, crtcoffsetcntl, xytilereg, crtcxytile = 0; #ifdef XF86DRI RADEONSAREAPrivPtr pSAREAPriv; XF86DRISAREAPtr pSAREA; @@ -9060,8 +9165,11 @@ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen) RADEONTRACE(("Disposing accel...\n")); #ifdef USE_EXA - if (info->useEXA && info->accelOn) + if (info->exa) { exaDriverFini(pScreen); + xfree(info->exa); + info->exa = NULL; + } #endif /* USE_EXA */ #ifdef USE_XAA if (!info->useEXA) { @@ -9620,6 +9728,16 @@ RADEONGetMergedFBOptions(ScrnInfoPtr pScrn) } } +static void RADEONForceSomeClocks(ScrnInfoPtr pScrn) +{ + /* It appears from r300 and rv100 may need some clocks forced-on */ + CARD32 tmp; + + tmp = INPLL(pScrn, RADEON_SCLK_CNTL); + tmp |= RADEON_SCLK_FORCE_CP | RADEON_SCLK_FORCE_VIP; + OUTPLL(pScrn, RADEON_SCLK_CNTL, tmp); +} + static void RADEONSetDynamicClock(ScrnInfoPtr pScrn, int mode) { RADEONInfoPtr info = RADEONPTR(pScrn); diff --git a/src/radeon_exa.c b/src/radeon_exa.c index 56927c1..9ef74e9 100644 --- a/src/radeon_exa.c +++ b/src/radeon_exa.c @@ -157,10 +157,10 @@ static Bool RADEONGetOffsetPitch(PixmapPtr pPix, int bpp, CARD32 *pitch_offset, { RINFO_FROM_SCREEN(pPix->drawable.pScreen); - if (pitch % info->exa.card.pixmapPitchAlign != 0) + if (pitch % info->exa->pixmapPitchAlign != 0) RADEON_FALLBACK(("Bad pitch 0x%08x\n", pitch)); - if (offset % info->exa.card.pixmapOffsetAlign != 0) + if (offset % info->exa->pixmapOffsetAlign != 0) RADEON_FALLBACK(("Bad offset 0x%08x\n", offset)); pitch = pitch >> 6; @@ -197,7 +197,7 @@ static Bool RADEONPrepareAccess(PixmapPtr pPix, int index) RINFO_FROM_SCREEN(pPix->drawable.pScreen); unsigned char *RADEONMMIO = info->MMIO; CARD32 offset = exaGetPixmapOffset(pPix); - int bpp, rc, soff; + int bpp, soff; CARD32 size, flags; /* Front buffer is always set with proper swappers */ @@ -231,6 +231,7 @@ static Bool RADEONPrepareAccess(PixmapPtr pPix, int index) #if defined(XF86DRI) if (info->directRenderingEnabled && info->allowColorTiling) { drmRadeonSurfaceAlloc drmsurfalloc; + int rc; drmsurfalloc.address = offset; drmsurfalloc.size = size; @@ -262,7 +263,7 @@ static void RADEONFinishAccess(PixmapPtr pPix, int index) RINFO_FROM_SCREEN(pPix->drawable.pScreen); unsigned char *RADEONMMIO = info->MMIO; CARD32 offset = exaGetPixmapOffset(pPix); - int bpp, soff; + int soff; /* Front buffer is always set with proper swappers */ if (offset == 0) @@ -292,27 +293,34 @@ static void RADEONFinishAccess(PixmapPtr pPix, int index) #define RADEON_SWITCH_TO_2D() \ do { \ - /*if (info->engineMode == EXA_ENGINEMODE_2D)*/ \ - /*break;*/ \ - BEGIN_ACCEL(2); \ - OUT_ACCEL_REG(RADEON_RB2D_DSTCACHE_CTLSTAT, RADEON_RB2D_DC_FLUSH); \ - OUT_ACCEL_REG(RADEON_WAIT_UNTIL, \ - RADEON_WAIT_HOST_IDLECLEAN | \ - RADEON_WAIT_3D_IDLECLEAN); \ + CARD32 wait_until = 0; \ + BEGIN_ACCEL(1); \ + switch (info->engineMode) { \ + case EXA_ENGINEMODE_UNKNOWN: \ + wait_until |= RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_2D_IDLECLEAN; \ + case EXA_ENGINEMODE_3D: \ + wait_until |= RADEON_WAIT_3D_IDLECLEAN; \ + case EXA_ENGINEMODE_2D: \ + break; \ + } \ + OUT_ACCEL_REG(RADEON_WAIT_UNTIL, wait_until); \ FINISH_ACCEL(); \ info->engineMode = EXA_ENGINEMODE_2D; \ } while (0); #define RADEON_SWITCH_TO_3D() \ do { \ - /*if (info->engineMode == EXA_ENGINEMODE_3D)*/ \ - /*break;*/ \ - BEGIN_ACCEL(2); \ - OUT_ACCEL_REG(RADEON_RB2D_DSTCACHE_CTLSTAT, RADEON_RB2D_DC_FLUSH); \ - OUT_ACCEL_REG(RADEON_WAIT_UNTIL, \ - RADEON_WAIT_HOST_IDLECLEAN | \ - RADEON_WAIT_2D_IDLECLEAN | \ - RADEON_WAIT_3D_IDLECLEAN); \ + CARD32 wait_until = 0; \ + BEGIN_ACCEL(1); \ + switch (info->engineMode) { \ + case EXA_ENGINEMODE_UNKNOWN: \ + wait_until |= RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_3D_IDLECLEAN; \ + case EXA_ENGINEMODE_2D: \ + wait_until |= RADEON_WAIT_2D_IDLECLEAN; \ + case EXA_ENGINEMODE_3D: \ + break; \ + } \ + OUT_ACCEL_REG(RADEON_WAIT_UNTIL, wait_until); \ FINISH_ACCEL(); \ info->engineMode = EXA_ENGINEMODE_3D; \ } while (0); @@ -367,10 +375,17 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); int cpp = info->CurrentLayout.pixel_bytes; - int l; - int next, screen_size; + int screen_size; int byteStride = pScrn->displayWidth * cpp; + if (info->exa != NULL) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map already initialized\n"); + return FALSE; + } + info->exa = exaDriverAlloc(); + if (info->exa == NULL) + return FALSE; + /* Need to adjust screen size for 16 line tiles, and then make it align to. * the buffer alignment requirement. */ @@ -379,20 +394,33 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen) else screen_size = pScrn->virtualY * byteStride; - info->exa.card.memoryBase = info->FB + pScrn->fbOffset; - info->exa.card.memorySize = info->FbMapSize - info->FbSecureSize; - info->exa.card.offScreenBase = screen_size; + info->exa->memoryBase = info->FB + pScrn->fbOffset; + info->exa->memorySize = info->FbMapSize - info->FbSecureSize; + info->exa->offScreenBase = screen_size; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Allocating from a screen of %ld kb\n", - info->exa.card.memorySize / 1024); + info->exa->memorySize / 1024); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Will use %d kb for front buffer at offset 0x%08x\n", screen_size / 1024, 0); + /* Reserve static area for hardware cursor */ + if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { + int cursor_size = 64 * 4 * 64; + + info->cursor_offset = info->exa->offScreenBase; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Will use %d kb for hardware cursor at offset 0x%08x\n", + cursor_size / 1024, (unsigned int)info->cursor_offset); + + info->exa->offScreenBase += cursor_size; + } + #if defined(XF86DRI) if (info->directRenderingEnabled) { - int depth_size; + int depthCpp = (info->depthBits - 8) / 4, l, next, depth_size; info->frontOffset = 0; info->frontPitch = pScrn->displayWidth; @@ -412,12 +440,12 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen) * offscreen locations does. */ info->backPitch = pScrn->displayWidth; - next = RADEON_ALIGN(info->exa.card.offScreenBase, RADEON_BUFFER_ALIGN); + next = RADEON_ALIGN(info->exa->offScreenBase, RADEON_BUFFER_ALIGN); if (!info->noBackBuffer && - next + screen_size <= info->exa.card.memorySize) + next + screen_size <= info->exa->memorySize) { info->backOffset = next; - info->exa.card.offScreenBase = next + screen_size; + info->exa->offScreenBase = next + screen_size; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Will use %d kb for back buffer at offset 0x%08x\n", screen_size / 1024, info->backOffset); @@ -427,27 +455,27 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen) * handle tiling. */ info->depthPitch = RADEON_ALIGN(pScrn->displayWidth, 32); - depth_size = RADEON_ALIGN(pScrn->virtualY, 16) * info->depthPitch * cpp; - next = RADEON_ALIGN(info->exa.card.offScreenBase, RADEON_BUFFER_ALIGN); - if (next + depth_size <= info->exa.card.memorySize) + depth_size = RADEON_ALIGN(pScrn->virtualY, 16) * info->depthPitch * depthCpp; + next = RADEON_ALIGN(info->exa->offScreenBase, RADEON_BUFFER_ALIGN); + if (next + depth_size <= info->exa->memorySize) { info->depthOffset = next; - info->exa.card.offScreenBase = next + depth_size; + info->exa->offScreenBase = next + depth_size; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Will use %d kb for depth buffer at offset 0x%08x\n", depth_size / 1024, info->depthOffset); } - info->textureSize *= (info->exa.card.memorySize - - info->exa.card.offScreenBase) / 100; + info->textureSize *= (info->exa->memorySize - + info->exa->offScreenBase) / 100; l = RADEONLog2(info->textureSize / RADEON_NR_TEX_REGIONS); if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY; info->textureSize = (info->textureSize >> l) << l; if (info->textureSize >= 512 * 1024) { - info->textureOffset = info->exa.card.offScreenBase; - info->exa.card.offScreenBase += info->textureSize; + info->textureOffset = info->exa->offScreenBase; + info->exa->offScreenBase += info->textureSize; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Will use %d kb for textures at offset 0x%08x\n", info->textureSize / 1024, info->textureOffset); @@ -460,8 +488,8 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Will use %ld kb for X Server offscreen at offset 0x%08lx\n", - (info->exa.card.memorySize - info->exa.card.offScreenBase) / - 1024, info->exa.card.offScreenBase); + (info->exa->memorySize - info->exa->offScreenBase) / + 1024, info->exa->offScreenBase); return TRUE; } diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c index 65ba4ce..c0bdf6e 100644 --- a/src/radeon_exa_funcs.c +++ b/src/radeon_exa_funcs.c @@ -1,6 +1,7 @@ /* * Copyright 2005 Eric Anholt * Copyright 2005 Benjamin Herrenschmidt + * Copyright 2006 Tungsten Graphics, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -26,6 +27,7 @@ * Eric Anholt <anholt@FreeBSD.org> * Zack Rusin <zrusin@trolltech.com> * Benjamin Herrenschmidt <benh@kernel.crashing.org> + * Michel Dänzer <michel@tungstengraphics.com> * */ @@ -49,19 +51,22 @@ #endif #endif +#include <errno.h> +#include <string.h> + #include "radeon.h" #include "atidri.h" #include "exa.h" -#include "fbdevhw.h" - static void FUNC_NAME(RADEONSync)(ScreenPtr pScreen, int marker) { TRACE; FUNC_NAME(RADEONWaitForIdle)(xf86Screens[pScreen->myNum]); + + RADEONPTR(xf86Screens[pScreen->myNum])->engineMode = EXA_ENGINEMODE_UNKNOWN; } static Bool @@ -217,7 +222,7 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h, unsigned int bpp = pDst->drawable.bitsPerPixel; #ifdef ACCEL_CP unsigned int hpass; - CARD32 buf_pitch; + CARD32 buf_pitch, dst_pitch_off; #endif #if X_BYTE_ORDER == X_BIG_ENDIAN unsigned char *RADEONMMIO = info->MMIO; @@ -232,21 +237,21 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h, return FALSE; #ifdef ACCEL_CP - if (info->directRenderingEnabled) { + if (info->directRenderingEnabled && + RADEONGetPixmapOffsetPitch(pDst, &dst_pitch_off)) { CARD8 *buf; int cpp = bpp / 8; ACCEL_PREAMBLE(); - dst += (x * cpp) + (y * dst_pitch); RADEON_SWITCH_TO_2D(); while ((buf = RADEONHostDataBlit(pScrn, - cpp, w, dst_pitch, &buf_pitch, - &dst, &h, &hpass)) != 0) { - RADEONHostDataBlitCopyPass(pScrn, cpp, buf, (unsigned char *)src, + cpp, w, dst_pitch_off, &buf_pitch, + x, &y, (unsigned int*)&h, &hpass)) != 0) { + RADEONHostDataBlitCopyPass(pScrn, cpp, buf, (CARD8 *)src, hpass, buf_pitch, src_pitch); src += hpass * src_pitch; } - + exaMarkSync(pDst->drawable.pScreen); return TRUE; } @@ -287,27 +292,152 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h, return TRUE; } +#ifdef ACCEL_CP +/* Emit blit with arbitrary source and destination offsets and pitches */ +static void +RADEONBlitChunk(ScrnInfoPtr pScrn, CARD32 datatype, CARD32 src_pitch_offset, + CARD32 dst_pitch_offset, int srcX, int srcY, int dstX, int dstY, + int w, int h) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ACCEL_PREAMBLE(); + + BEGIN_ACCEL(6); + OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL, + RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_SRC_PITCH_OFFSET_CNTL | + RADEON_GMC_BRUSH_NONE | + (datatype << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_ROP3_S | + RADEON_DP_SRC_SOURCE_MEMORY | + RADEON_GMC_CLR_CMP_CNTL_DIS | + RADEON_GMC_WR_MSK_DIS); + OUT_ACCEL_REG(RADEON_SRC_PITCH_OFFSET, src_pitch_offset); + OUT_ACCEL_REG(RADEON_DST_PITCH_OFFSET, dst_pitch_offset); + OUT_ACCEL_REG(RADEON_SRC_Y_X, (srcY << 16) | srcX); + OUT_ACCEL_REG(RADEON_DST_Y_X, (dstY << 16) | dstX); + OUT_ACCEL_REG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w); + FINISH_ACCEL(); +} +#endif + static Bool FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h, char *dst, int dst_pitch) { -#if X_BYTE_ORDER == X_BIG_ENDIAN +#if defined(ACCEL_CP) || X_BYTE_ORDER == X_BIG_ENDIAN RINFO_FROM_SCREEN(pSrc->drawable.pScreen); +#endif +#if X_BYTE_ORDER == X_BIG_ENDIAN unsigned char *RADEONMMIO = info->MMIO; unsigned int swapper = info->ModeReg.surface_cntl & ~(RADEON_NONSURF_AP0_SWP_32BPP | RADEON_NONSURF_AP1_SWP_32BPP | RADEON_NONSURF_AP0_SWP_16BPP | RADEON_NONSURF_AP1_SWP_16BPP); #endif - unsigned char *src = pSrc->devPrivate.ptr; + CARD8 *src = pSrc->devPrivate.ptr; int src_pitch = exaGetPixmapPitch(pSrc); int bpp = pSrc->drawable.bitsPerPixel; +#ifdef ACCEL_CP + CARD32 datatype, src_pitch_offset, scratch_pitch = (w * bpp/8 + 63) & ~63, scratch_off = 0; + drmBufPtr scratch; +#endif TRACE; +#ifdef ACCEL_CP /* - * This is currently done without DMA until I have ironed out the - * various endian issues with R300 among others + * Try to accelerate download. Use an indirect buffer as scratch space, + * blitting the bits to one half while copying them out of the other one and + * then swapping the halves. */ + if (info->accelDFS && bpp != 24 && RADEONGetDatatypeBpp(bpp, &datatype) && + RADEONGetPixmapOffsetPitch(pSrc, &src_pitch_offset) && + (scratch = RADEONCPGetBuffer(pScrn))) + { + int swap = RADEON_HOST_DATA_SWAP_NONE, wpass = w * bpp / 8; + int hpass = min(h, scratch->total/2 / scratch_pitch); + CARD32 scratch_pitch_offset = scratch_pitch << 16 + | (info->gartLocation + info->bufStart + + scratch->idx * scratch->total) >> 10; + drmRadeonIndirect indirect; + ACCEL_PREAMBLE(); + + RADEON_SWITCH_TO_2D(); + + /* Kick the first blit as early as possible */ + RADEONBlitChunk(pScrn, datatype, src_pitch_offset, scratch_pitch_offset, + x, y, 0, 0, w, hpass); + FLUSH_RING(); + +#if X_BYTE_ORDER == X_BIG_ENDIAN + switch (bpp) { + case 16: + swap = RADEON_HOST_DATA_SWAP_16BIT; + break; + case 32: + swap = RADEON_HOST_DATA_SWAP_32BIT; + break; + } +#endif + + while (h) { + int oldhpass = hpass, i = 0; + + src = (CARD8*)scratch->address + scratch_off; + + y += oldhpass; + h -= oldhpass; + hpass = min(h, scratch->total/2 / scratch_pitch); + + /* Prepare next blit if anything's left */ + if (hpass) { + scratch_off = scratch->total/2 - scratch_off; + RADEONBlitChunk(pScrn, datatype, src_pitch_offset, scratch_pitch_offset + (scratch_off >> 10), + x, y, 0, 0, w, hpass); + } + + /* + * Wait for previous blit to complete. + * + * XXX: Doing here essentially the same things this ioctl does in + * the DRM results in corruption with 'small' transfers, apparently + * because the data doesn't actually land in system RAM before the + * memcpy. I suspect the ioctl helps mostly due to its latency; what + * we'd really need is a way to reliably wait for the host interface + * to be done with pushing the data to the host. + */ + while ((drmCommandNone(info->drmFD, DRM_RADEON_CP_IDLE) == -EBUSY) + && (i++ < RADEON_TIMEOUT)) + ; + + /* Kick next blit */ + if (hpass) + FLUSH_RING(); + + /* Copy out data from previous blit */ + if (wpass == scratch_pitch && wpass == dst_pitch) { + RADEONCopySwap((CARD8*)dst, src, wpass * oldhpass, swap); + dst += dst_pitch * oldhpass; + } else while (oldhpass--) { + RADEONCopySwap((CARD8*)dst, src, wpass, swap); + src += scratch_pitch; + dst += dst_pitch; + } + } + + indirect.idx = scratch->idx; + indirect.start = indirect.end = 0; + indirect.discard = 1; + + drmCommandWriteRead(info->drmFD, DRM_RADEON_INDIRECT, + &indirect, sizeof(drmRadeonIndirect)); + + return TRUE; + } +#endif + + /* Can't accelerate download */ exaWaitSync(pSrc->drawable.pScreen); #if X_BYTE_ORDER == X_BIG_ENDIAN @@ -347,31 +477,37 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen) { RINFO_FROM_SCREEN(pScreen); - memset(&info->exa.accel, 0, sizeof(ExaAccelInfoRec)); + if (info->exa == NULL) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map not set up\n"); + return FALSE; + } + + info->exa->exa_major = 2; + info->exa->exa_minor = 0; - info->exa.accel.PrepareSolid = FUNC_NAME(RADEONPrepareSolid); - info->exa.accel.Solid = FUNC_NAME(RADEONSolid); - info->exa.accel.DoneSolid = FUNC_NAME(RADEONDoneSolid); + info->exa->PrepareSolid = FUNC_NAME(RADEONPrepareSolid); + info->exa->Solid = FUNC_NAME(RADEONSolid); + info->exa->DoneSolid = FUNC_NAME(RADEONDoneSolid); - info->exa.accel.PrepareCopy = FUNC_NAME(RADEONPrepareCopy); - info->exa.accel.Copy = FUNC_NAME(RADEONCopy); - info->exa.accel.DoneCopy = FUNC_NAME(RADEONDoneCopy); + info->exa->PrepareCopy = FUNC_NAME(RADEONPrepareCopy); + info->exa->Copy = FUNC_NAME(RADEONCopy); + info->exa->DoneCopy = FUNC_NAME(RADEONDoneCopy); - info->exa.accel.WaitMarker = FUNC_NAME(RADEONSync); - info->exa.accel.UploadToScreen = FUNC_NAME(RADEONUploadToScreen); - info->exa.accel.DownloadFromScreen = FUNC_NAME(RADEONDownloadFromScreen); + info->exa->WaitMarker = FUNC_NAME(RADEONSync); + info->exa->UploadToScreen = FUNC_NAME(RADEONUploadToScreen); + info->exa->DownloadFromScreen = FUNC_NAME(RADEONDownloadFromScreen); #if X_BYTE_ORDER == X_BIG_ENDIAN - info->exa.accel.PrepareAccess = RADEONPrepareAccess; - info->exa.accel.FinishAccess = RADEONFinishAccess; + info->exa->PrepareAccess = RADEONPrepareAccess; + info->exa->FinishAccess = RADEONFinishAccess; #endif /* X_BYTE_ORDER == X_BIG_ENDIAN */ - info->exa.card.flags = EXA_OFFSCREEN_PIXMAPS; - info->exa.card.pixmapOffsetAlign = RADEON_BUFFER_ALIGN + 1; - info->exa.card.pixmapPitchAlign = 64; + info->exa->flags = EXA_OFFSCREEN_PIXMAPS; + info->exa->pixmapOffsetAlign = RADEON_BUFFER_ALIGN + 1; + info->exa->pixmapPitchAlign = 64; - info->exa.card.maxX = 2047; - info->exa.card.maxY = 2047; + info->exa->maxX = 2047; + info->exa->maxY = 2047; #ifdef RENDER if (info->RenderAccel) { @@ -384,26 +520,27 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen) (info->ChipFamily == CHIP_FAMILY_R200)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Render acceleration " "enabled for R200 type cards.\n"); - info->exa.accel.CheckComposite = R200CheckComposite; - info->exa.accel.PrepareComposite = + info->exa->CheckComposite = R200CheckComposite; + info->exa->PrepareComposite = FUNC_NAME(R200PrepareComposite); - info->exa.accel.Composite = FUNC_NAME(RadeonComposite); - info->exa.accel.DoneComposite = RadeonDoneComposite; + info->exa->Composite = FUNC_NAME(RadeonComposite); + info->exa->DoneComposite = RadeonDoneComposite; } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Render acceleration " "enabled for R100 type cards.\n"); - info->exa.accel.CheckComposite = R100CheckComposite; - info->exa.accel.PrepareComposite = + info->exa->CheckComposite = R100CheckComposite; + info->exa->PrepareComposite = FUNC_NAME(R100PrepareComposite); - info->exa.accel.Composite = FUNC_NAME(RadeonComposite); - info->exa.accel.DoneComposite = RadeonDoneComposite; + info->exa->Composite = FUNC_NAME(RadeonComposite); + info->exa->DoneComposite = RadeonDoneComposite; } } #endif RADEONEngineInit(pScrn); - if (!exaDriverInit(pScreen, &info->exa)) { + if (!exaDriverInit(pScreen, info->exa)) { + xfree(info->exa); return FALSE; } exaMarkSync(pScreen); diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index 8206600..98b8dfd 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -95,7 +95,6 @@ static struct blendinfo RadeonBlendOp[] = { struct formatinfo { int fmt; - Bool byte_swap; CARD32 card_fmt; }; @@ -103,25 +102,23 @@ struct formatinfo { * TXFORMAT_Y8 expands to (Y,Y,Y,1). TXFORMAT_I8 expands to (I,I,I,I) */ static struct formatinfo R100TexFormats[] = { - {PICT_a8r8g8b8, 0, RADEON_TXFORMAT_ARGB8888 | RADEON_TXFORMAT_ALPHA_IN_MAP}, - {PICT_x8r8g8b8, 0, RADEON_TXFORMAT_ARGB8888}, - {PICT_a8b8g8r8, 1, RADEON_TXFORMAT_RGBA8888 | RADEON_TXFORMAT_ALPHA_IN_MAP}, - {PICT_x8b8g8r8, 1, RADEON_TXFORMAT_RGBA8888}, - {PICT_r5g6b5, 0, RADEON_TXFORMAT_RGB565}, - {PICT_a1r5g5b5, 0, RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP}, - {PICT_x1r5g5b5, 0, RADEON_TXFORMAT_ARGB1555}, - {PICT_a8, 0, RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP}, + {PICT_a8r8g8b8, RADEON_TXFORMAT_ARGB8888 | RADEON_TXFORMAT_ALPHA_IN_MAP}, + {PICT_x8r8g8b8, RADEON_TXFORMAT_ARGB8888}, + {PICT_r5g6b5, RADEON_TXFORMAT_RGB565}, + {PICT_a1r5g5b5, RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP}, + {PICT_x1r5g5b5, RADEON_TXFORMAT_ARGB1555}, + {PICT_a8, RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP}, }; static struct formatinfo R200TexFormats[] = { - {PICT_a8r8g8b8, 0, R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP}, - {PICT_x8r8g8b8, 0, R200_TXFORMAT_ARGB8888}, - {PICT_a8b8g8r8, 1, R200_TXFORMAT_RGBA8888 | R200_TXFORMAT_ALPHA_IN_MAP}, - {PICT_x8b8g8r8, 1, R200_TXFORMAT_RGBA8888}, - {PICT_r5g6b5, 0, R200_TXFORMAT_RGB565}, - {PICT_a1r5g5b5, 0, R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP}, - {PICT_x1r5g5b5, 0, R200_TXFORMAT_ARGB1555}, - {PICT_a8, 0, R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP}, + {PICT_a8r8g8b8, R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP}, + {PICT_x8r8g8b8, R200_TXFORMAT_ARGB8888}, + {PICT_a8b8g8r8, R200_TXFORMAT_ABGR8888 | R200_TXFORMAT_ALPHA_IN_MAP}, + {PICT_x8b8g8r8, R200_TXFORMAT_ABGR8888}, + {PICT_r5g6b5, R200_TXFORMAT_RGB565}, + {PICT_a1r5g5b5, R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP}, + {PICT_x1r5g5b5, R200_TXFORMAT_ARGB1555}, + {PICT_a8, R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP}, }; /* Common Radeon setup code */ @@ -151,25 +148,36 @@ static Bool RADEONGetDestFormat(PicturePtr pDstPicture, CARD32 *dst_format) return TRUE; } -static CARD32 RADEONGetBlendCntl(int op, CARD32 dst_format) +static CARD32 RADEONGetBlendCntl(int op, PicturePtr pMask, CARD32 dst_format) { - CARD32 blendcntl = RadeonBlendOp[op].blend_cntl; + CARD32 sblend, dblend; + + sblend = RadeonBlendOp[op].blend_cntl & RADEON_SRC_BLEND_MASK; + dblend = RadeonBlendOp[op].blend_cntl & RADEON_DST_BLEND_MASK; + /* If there's no dst alpha channel, adjust the blend op so that we'll treat * it as always 1. */ if (PICT_FORMAT_A(dst_format) == 0 && RadeonBlendOp[op].dst_alpha) { - if ((blendcntl & RADEON_SRC_BLEND_MASK) == - RADEON_SRC_BLEND_GL_DST_ALPHA) { - blendcntl = (blendcntl & ~RADEON_SRC_BLEND_MASK) | - RADEON_SRC_BLEND_GL_ONE; - } else if ((blendcntl & RADEON_SRC_BLEND_MASK) == - RADEON_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA) { - blendcntl = (blendcntl & ~RADEON_SRC_BLEND_MASK) | - RADEON_SRC_BLEND_GL_ZERO; + if (sblend == RADEON_SRC_BLEND_GL_DST_ALPHA) + sblend = RADEON_SRC_BLEND_GL_ONE; + else if (sblend == RADEON_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA) + sblend = RADEON_SRC_BLEND_GL_ZERO; + } + + /* If the source alpha is being used, then we should only be in a case where + * the source blend factor is 0, and the source blend value is the mask + * channels multiplied by the source picture's alpha. + */ + if (pMask && pMask->componentAlpha && RadeonBlendOp[op].src_alpha) { + if (dblend == RADEON_DST_BLEND_GL_SRC_ALPHA) { + dblend = RADEON_DST_BLEND_GL_SRC_COLOR; + } else if (dblend == RADEON_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA) { + dblend = RADEON_DST_BLEND_GL_ONE_MINUS_SRC_COLOR; } } - return blendcntl; + return sblend | dblend; } union intfloat { @@ -234,8 +242,6 @@ static Bool FUNC_NAME(R100TextureSetup)(PicturePtr pPict, PixmapPtr pPix, break; } txformat = R100TexFormats[i].card_fmt; - if (R100TexFormats[i].byte_swap) - txoffset |= RADEON_TXO_ENDIAN_BYTE_SWAP; if (RADEONPixmapIsColortiled(pPix)) txoffset |= RADEON_TXO_MACRO_TILE; @@ -296,12 +302,21 @@ static Bool R100CheckComposite(int op, PicturePtr pSrcPicture, /* Check for unsupported compositing operations. */ if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0])) RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op)); - if (pMaskPicture != NULL && pMaskPicture->componentAlpha && - RadeonBlendOp[op].src_alpha) - { - RADEON_FALLBACK(("Component alpha not supported with source " - "alpha blending.\n")); + + if (pMaskPicture != NULL && pMaskPicture->componentAlpha) { + /* Check if it's component alpha that relies on a source alpha and on + * the source value. We can only get one of those into the single + * source value that we get to blend with. + */ + if (RadeonBlendOp[op].src_alpha && + (RadeonBlendOp[op].blend_cntl & RADEON_SRC_BLEND_MASK) != + RADEON_SRC_BLEND_GL_ZERO) + { + RADEON_FALLBACK(("Component alpha not supported with source " + "alpha and source value blending.\n")); + } } + if (pDstPicture->pDrawable->width >= (1 << 11) || pDstPicture->pDrawable->height >= (1 << 11)) { @@ -315,9 +330,6 @@ static Bool R100CheckComposite(int op, PicturePtr pSrcPicture, if (pMaskPicture != NULL && !R100CheckCompositeTexture(pMaskPicture, 1)) return FALSE; - if (pDstPicture->componentAlpha) - return FALSE; - if (!RADEONGetDestFormat(pDstPicture, &tmp1)) return FALSE; @@ -382,15 +394,20 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op, /* IN operator: Multiply src by mask components or mask alpha. * BLEND_CTL_ADD is A * B + C. - * If a picture is a8, we have to explicitly zero its color values. + * If a source is a8, we have to explicitly zero its color values. * If the destination is a8, we have to route the alpha to red, I think. + * If we're doing component alpha where the source for blending is going to + * be the source alpha (and there's no source value used), we have to zero + * the source's color values. */ cblend = RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX | RADEON_COLOR_ARG_C_ZERO; ablend = RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX | RADEON_ALPHA_ARG_C_ZERO; - if (pDstPicture->format == PICT_a8) + if (pDstPicture->format == PICT_a8 || + (pMask && pMaskPicture->componentAlpha && RadeonBlendOp[op].src_alpha)) + { cblend |= RADEON_COLOR_ARG_A_T0_ALPHA; - else if (pSrcPicture->format == PICT_a8) + } else if (pSrcPicture->format == PICT_a8) cblend |= RADEON_COLOR_ARG_A_ZERO; else cblend |= RADEON_COLOR_ARG_A_T0_COLOR; @@ -414,7 +431,8 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op, RADEON_SE_VTX_FMT_ST0 | RADEON_SE_VTX_FMT_ST1); /* Op operator. */ - blendcntl = RADEONGetBlendCntl(op, pDstPicture->format); + blendcntl = RADEONGetBlendCntl(op, pMaskPicture, pDstPicture->format); + OUT_ACCEL_REG(RADEON_RB3D_BLENDCNTL, blendcntl); FINISH_ACCEL(); @@ -477,8 +495,6 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix, break; } txformat = R200TexFormats[i].card_fmt; - if (R200TexFormats[i].byte_swap) - txoffset |= R200_TXO_ENDIAN_BYTE_SWAP; if (RADEONPixmapIsColortiled(pPix)) txoffset |= R200_TXO_MACRO_TILE; @@ -543,10 +559,20 @@ static Bool R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskP /* Check for unsupported compositing operations. */ if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0])) RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op)); - if (pMaskPicture != NULL && pMaskPicture->componentAlpha && - RadeonBlendOp[op].src_alpha) - RADEON_FALLBACK(("Component alpha not supported with source " - "alpha blending.\n")); + + if (pMaskPicture != NULL && pMaskPicture->componentAlpha) { + /* Check if it's component alpha that relies on a source alpha and on + * the source value. We can only get one of those into the single + * source value that we get to blend with. + */ + if (RadeonBlendOp[op].src_alpha && + (RadeonBlendOp[op].blend_cntl & RADEON_SRC_BLEND_MASK) != + RADEON_SRC_BLEND_GL_ZERO) + { + RADEON_FALLBACK(("Component alpha not supported with source " + "alpha and source value blending.\n")); + } + } if (!R200CheckCompositeTexture(pSrcPicture, 0)) return FALSE; @@ -620,13 +646,18 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture, * BLEND_CTL_ADD is A * B + C. * If a picture is a8, we have to explicitly zero its color values. * If the destination is a8, we have to route the alpha to red, I think. + * If we're doing component alpha where the source for blending is going to + * be the source alpha (and there's no source value used), we have to zero + * the source's color values. */ cblend = R200_TXC_OP_MADD | R200_TXC_ARG_C_ZERO; ablend = R200_TXA_OP_MADD | R200_TXA_ARG_C_ZERO; - if (pDstPicture->format == PICT_a8) + if (pDstPicture->format == PICT_a8 || + (pMask && pMaskPicture->componentAlpha && RadeonBlendOp[op].src_alpha)) + { cblend |= R200_TXC_ARG_A_R0_ALPHA; - else if (pSrcPicture->format == PICT_a8) + } else if (pSrcPicture->format == PICT_a8) cblend |= R200_TXC_ARG_A_ZERO; else cblend |= R200_TXC_ARG_A_R0_COLOR; @@ -652,7 +683,7 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture, R200_TXA_CLAMP_0_1 | R200_TXA_OUTPUT_REG_R0); /* Op operator. */ - blendcntl = RADEONGetBlendCntl(op, pDstPicture->format); + blendcntl = RADEONGetBlendCntl(op, pMaskPicture, pDstPicture->format); OUT_ACCEL_REG(RADEON_RB3D_BLENDCNTL, blendcntl); FINISH_ACCEL(); diff --git a/src/radeon_macros.h b/src/radeon_macros.h index b121a95..0d27405 100644 --- a/src/radeon_macros.h +++ b/src/radeon_macros.h @@ -50,9 +50,6 @@ #ifndef _RADEON_MACROS_H_ #define _RADEON_MACROS_H_ -#ifdef XFree86Module -#include "xf86_ansic.h" -#endif #include "compiler.h" #define RADEON_BIOS8(v) (info->VBIOS[v]) diff --git a/src/radeon_mergedfb.c b/src/radeon_mergedfb.c index 186abc0..313dda2 100644 --- a/src/radeon_mergedfb.c +++ b/src/radeon_mergedfb.c @@ -36,6 +36,9 @@ * Based, in large part, on the sis driver by Thomas Winischhofer. */ +#include <string.h> +#include <stdio.h> + #include "xf86.h" #include "xf86Priv.h" #include "xf86Resources.h" @@ -344,8 +347,6 @@ RADEONGenerateModeListFromLargestModes(ScrnInfoPtr pScrn, DisplayModePtr mode3 = NULL; DisplayModePtr mode4 = NULL; DisplayModePtr result = NULL; - int p = 0; - int count = 0; info->AtLeastOneNonClone = FALSE; @@ -1738,119 +1739,125 @@ RADEONAdjustFrameMerged(int scrnIndex, int x, int y, int flags) RADEONDoAdjustFrame(pScrn1, pScrn2->frameX0, pScrn2->frameY0, TRUE); } -void -RADEONMergedFBSetDpi(ScrnInfoPtr pScrn1, ScrnInfoPtr pScrn2, RADEONScrn2Rel srel) +static void +RADEONMergedFBCalcDPI(ScrnInfoPtr pScrn1, ScrnInfoPtr pScrn2, RADEONScrn2Rel srel, Bool quiet) { - RADEONInfoPtr info = RADEONPTR(pScrn1); - MessageType from = X_DEFAULT; - xf86MonPtr DDC1 = (xf86MonPtr)(pScrn1->monitor->DDC); - xf86MonPtr DDC2 = (xf86MonPtr)(pScrn2->monitor->DDC); - int ddcWidthmm = 0, ddcHeightmm = 0; - const char *dsstr = "MergedFB: Display dimensions: (%d, %d) mm\n"; - - /* This sets the DPI for MergedFB mode. The problem is that - * this can never be exact, because the output devices may - * have different dimensions. This function tries to compromise - * through a few assumptions, and it just calculates an average DPI - * value for both monitors. - */ - - /* Given DisplaySize should regard BOTH monitors */ - pScrn1->widthmm = pScrn1->monitor->widthmm; - pScrn1->heightmm = pScrn1->monitor->heightmm; - - /* Get DDC display size; if only either CRT1 or CRT2 provided these, - * assume equal dimensions for both, otherwise add dimensions - */ - if( (DDC1 && (DDC1->features.hsize > 0 && DDC1->features.vsize > 0)) && - (DDC2 && (DDC2->features.hsize > 0 && DDC2->features.vsize > 0)) ) { - ddcWidthmm = max(DDC1->features.hsize, DDC2->features.hsize) * 10; - ddcHeightmm = max(DDC1->features.vsize, DDC2->features.vsize) * 10; - switch(srel) { - case radeonLeftOf: - case radeonRightOf: - ddcWidthmm = (DDC1->features.hsize + DDC2->features.hsize) * 10; - break; - case radeonAbove: - case radeonBelow: - ddcHeightmm = (DDC1->features.vsize + DDC2->features.vsize) * 10; - default: - break; - } - - } else if(DDC1 && (DDC1->features.hsize > 0 && DDC1->features.vsize > 0)) { - ddcWidthmm = DDC1->features.hsize * 10; - ddcHeightmm = DDC1->features.vsize * 10; - switch(srel) { - case radeonLeftOf: - case radeonRightOf: - ddcWidthmm *= 2; - break; - case radeonAbove: - case radeonBelow: - ddcHeightmm *= 2; - default: - break; - } - } else if(DDC2 && (DDC2->features.hsize > 0 && DDC2->features.vsize > 0) ) { - ddcWidthmm = DDC2->features.hsize * 10; - ddcHeightmm = DDC2->features.vsize * 10; - switch(srel) { - case radeonLeftOf: - case radeonRightOf: - ddcWidthmm *= 2; - break; - case radeonAbove: - case radeonBelow: - ddcHeightmm *= 2; - default: - break; - } - } + RADEONInfoPtr info = RADEONPTR(pScrn1); + MessageType from = X_DEFAULT; + xf86MonPtr DDC1 = (xf86MonPtr)(pScrn1->monitor->DDC); + xf86MonPtr DDC2 = (xf86MonPtr)(pScrn2->monitor->DDC); + int ddcWidthmm = 0, ddcHeightmm = 0; + const char *dsstr = "MergedFB: Display dimensions: %dx%d mm\n"; + + /* This sets the DPI for MergedFB mode. The problem is that + * this can never be exact, because the output devices may + * have different dimensions. This function tries to compromise + * through a few assumptions, and it just calculates an average + * DPI value for both monitors. + */ - if(monitorResolution > 0) { + /* Copy user-given DisplaySize (which should regard BOTH monitors!) */ + pScrn1->widthmm = pScrn1->monitor->widthmm; + pScrn1->heightmm = pScrn1->monitor->heightmm; - /* Set command line given values (overrules given options) */ - pScrn1->xDpi = monitorResolution; - pScrn1->yDpi = monitorResolution; - from = X_CMDLINE; + if(monitorResolution > 0) { - } else if(info->MergedFBXDPI) { + /* Set command line given values (overrules given options) */ + pScrn1->xDpi = monitorResolution; + pScrn1->yDpi = monitorResolution; + from = X_CMDLINE; - /* Set option-wise given values (overrule DisplaySize) */ - pScrn1->xDpi = info->MergedFBXDPI; - pScrn1->yDpi = info->MergedFBYDPI; - from = X_CONFIG; + } else if(info->MergedFBXDPI) { - } else if(pScrn1->widthmm > 0 || pScrn1->heightmm > 0) { + /* Set option-wise given values (overrules DisplaySize config option) */ + pScrn1->xDpi = info->MergedFBXDPI; + pScrn1->yDpi = info->MergedFBYDPI; + from = X_CONFIG; - /* Set values calculated from given DisplaySize */ - from = X_CONFIG; - if(pScrn1->widthmm > 0) { - pScrn1->xDpi = (int)((double)pScrn1->virtualX * 25.4 / pScrn1->widthmm); - } - if(pScrn1->heightmm > 0) { - pScrn1->yDpi = (int)((double)pScrn1->virtualY * 25.4 / pScrn1->heightmm); - } - xf86DrvMsg(pScrn1->scrnIndex, from, dsstr, pScrn1->widthmm, pScrn1->heightmm); + } else if(pScrn1->widthmm > 0 || pScrn1->heightmm > 0) { + + /* Set values calculated from given DisplaySize */ + from = X_CONFIG; + if(pScrn1->widthmm > 0) { + pScrn1->xDpi = (int)((double)pScrn1->virtualX * 25.4 / pScrn1->widthmm); + } + if(pScrn1->heightmm > 0) { + pScrn1->yDpi = (int)((double)pScrn1->virtualY * 25.4 / pScrn1->heightmm); + } + if(!quiet) { + xf86DrvMsg(pScrn1->scrnIndex, from, dsstr, pScrn1->widthmm, pScrn1->heightmm); + } } else if(ddcWidthmm && ddcHeightmm) { - /* Set values from DDC-provided display size */ - from = X_PROBED; - xf86DrvMsg(pScrn1->scrnIndex, from, dsstr, ddcWidthmm, ddcHeightmm ); - pScrn1->widthmm = ddcWidthmm; - pScrn1->heightmm = ddcHeightmm; - if(pScrn1->widthmm > 0) { - pScrn1->xDpi = (int)((double)pScrn1->virtualX * 25.4 / pScrn1->widthmm); - } - if(pScrn1->heightmm > 0) { - pScrn1->yDpi = (int)((double)pScrn1->virtualY * 25.4 / pScrn1->heightmm); - } + /* Set values from DDC-provided display size */ + + /* Get DDC display size; if only either CRT1 or CRT2 provided these, + * assume equal dimensions for both, otherwise add dimensions + */ + if( (DDC1 && (DDC1->features.hsize > 0 && DDC1->features.vsize > 0)) && + (DDC2 && (DDC2->features.hsize > 0 && DDC2->features.vsize > 0)) ) { + ddcWidthmm = max(DDC1->features.hsize, DDC2->features.hsize) * 10; + ddcHeightmm = max(DDC1->features.vsize, DDC2->features.vsize) * 10; + switch(srel) { + case radeonLeftOf: + case radeonRightOf: + ddcWidthmm = (DDC1->features.hsize + DDC2->features.hsize) * 10; + break; + case radeonAbove: + case radeonBelow: + ddcHeightmm = (DDC1->features.vsize + DDC2->features.vsize) * 10; + default: + break; + } + } else if(DDC1 && (DDC1->features.hsize > 0 && DDC1->features.vsize > 0)) { + ddcWidthmm = DDC1->features.hsize * 10; + ddcHeightmm = DDC1->features.vsize * 10; + switch(srel) { + case radeonLeftOf: + case radeonRightOf: + ddcWidthmm *= 2; + break; + case radeonAbove: + case radeonBelow: + ddcHeightmm *= 2; + default: + break; + } + } else if(DDC2 && (DDC2->features.hsize > 0 && DDC2->features.vsize > 0) ) { + ddcWidthmm = DDC2->features.hsize * 10; + ddcHeightmm = DDC2->features.vsize * 10; + switch(srel) { + case radeonLeftOf: + case radeonRightOf: + ddcWidthmm *= 2; + break; + case radeonAbove: + case radeonBelow: + ddcHeightmm *= 2; + default: + break; + } + } + + from = X_PROBED; + + if(!quiet) { + xf86DrvMsg(pScrn1->scrnIndex, from, dsstr, ddcWidthmm, ddcHeightmm); + } + + pScrn1->widthmm = ddcWidthmm; + pScrn1->heightmm = ddcHeightmm; + if(pScrn1->widthmm > 0) { + pScrn1->xDpi = (int)((double)pScrn1->virtualX * 25.4 / pScrn1->widthmm); + } + if(pScrn1->heightmm > 0) { + pScrn1->yDpi = (int)((double)pScrn1->virtualY * 25.4 / pScrn1->heightmm); + } } else { - pScrn1->xDpi = pScrn1->yDpi = DEFAULT_DPI; + pScrn1->xDpi = pScrn1->yDpi = DEFAULT_DPI; } @@ -1863,8 +1870,60 @@ RADEONMergedFBSetDpi(ScrnInfoPtr pScrn1, ScrnInfoPtr pScrn2, RADEONScrn2Rel srel pScrn2->xDpi = pScrn1->xDpi; pScrn2->yDpi = pScrn1->yDpi; - xf86DrvMsg(pScrn1->scrnIndex, from, "MergedFB: DPI set to (%d, %d)\n", - pScrn1->xDpi, pScrn1->yDpi); + if(!quiet) { + xf86DrvMsg(pScrn1->scrnIndex, from, "MergedFB: DPI set to (%d, %d)\n", + pScrn1->xDpi, pScrn1->yDpi); + } +} + + +void +RADEONMergedFBSetDpi(ScrnInfoPtr pScrn1, ScrnInfoPtr pScrn2, RADEONScrn2Rel srel) +{ + RADEONInfoPtr info = RADEONPTR(pScrn1); + + RADEONMergedFBCalcDPI(pScrn1, pScrn2, srel, FALSE); + + info->MergedDPISRel = srel; + info->RADEONMergedDPIVX = pScrn1->virtualX; + info->RADEONMergedDPIVY = pScrn1->virtualY; + +} + +void +RADEONMergedFBResetDpi(ScrnInfoPtr pScrn, Bool force) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + RADEONScrn2Rel srel = ((RADEONMergedDisplayModePtr)info->CurrentLayout.mode->Private)->CRT2Position; + + /* This does the same calculation for the DPI as + * the initial run. This means that an eventually + * given -dpi command line switch will lead to + * constant dpi values, regardless of the virtual + * screen size. + * I consider this consequent. If this is undesired, + * one should use the DisplaySize parameter in the + * config file instead of the command line switch. + * The DPI will be calculated then. + */ + + if(force || + (info->MergedDPISRel != srel) || + (info->RADEONMergedDPIVX != pScrn->virtualX) || + (info->RADEONMergedDPIVY != pScrn->virtualY) + ) { + + RADEONMergedFBCalcDPI(pScrn, info->CRT2pScrn, srel, TRUE); + + pScreen->mmWidth = (pScrn->virtualX * 254 + pScrn->xDpi * 5) / (pScrn->xDpi * 10); + pScreen->mmHeight = (pScrn->virtualY * 254 + pScrn->yDpi * 5) / (pScrn->yDpi * 10); + + info->MergedDPISRel = srel; + info->RADEONMergedDPIVX = pScrn->virtualX; + info->RADEONMergedDPIVY = pScrn->virtualY; + + } } /* radeon cursor helpers */ @@ -1965,14 +2024,7 @@ RADEONSetCursorPositionMerged(ScrnInfoPtr pScrn, int x, int y) OUTREG(RADEON_CUR_HORZ_VERT_POSN, (RADEON_CUR_LOCK | ((xorigin ? 0 : x1) << 16) | (yorigin ? 0 : y1))); -#ifdef USE_EXA - if (info->useEXA) - OUTREG(RADEON_CUR_OFFSET, info->cursor_offset + yorigin * stride); -#endif /* USE_EXA */ -#ifdef USE_XAA - if (!info->useEXA) - OUTREG(RADEON_CUR_OFFSET, info->cursor_offset + yorigin * stride); -#endif /* USE_XAA */ + OUTREG(RADEON_CUR_OFFSET, info->cursor_offset + yorigin * stride); /* cursor2 */ OUTREG(RADEON_CUR2_HORZ_VERT_OFF, (RADEON_CUR2_LOCK | (xorigin << 16) @@ -1980,14 +2032,7 @@ RADEONSetCursorPositionMerged(ScrnInfoPtr pScrn, int x, int y) OUTREG(RADEON_CUR2_HORZ_VERT_POSN, (RADEON_CUR2_LOCK | ((xorigin ? 0 : x2) << 16) | (yorigin ? 0 : y2))); -#ifdef USE_EXA - if (info->useEXA) - OUTREG(RADEON_CUR2_OFFSET, info->cursor_offset + yorigin * stride); -#endif /* USE_EXA */ -#ifdef USE_XAA - if (!info->useEXA) - OUTREG(RADEON_CUR2_OFFSET, info->cursor_offset + yorigin * stride); -#endif /* USE_XAA */ + OUTREG(RADEON_CUR2_OFFSET, info->cursor_offset + yorigin * stride); } /* radeon Xv helpers */ diff --git a/src/radeon_mergedfb.h b/src/radeon_mergedfb.h index a2c792c..f827428 100644 --- a/src/radeon_mergedfb.h +++ b/src/radeon_mergedfb.h @@ -107,6 +107,8 @@ RADEONUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1); extern void RADEONMergedFBSetDpi(ScrnInfoPtr pScrn1, ScrnInfoPtr pScrn2, RADEONScrn2Rel srel); extern void +RADEONMergedFBResetDpi(ScrnInfoPtr pScrn, Bool force); +extern void RADEONRecalcDefaultVirtualSize(ScrnInfoPtr pScrn); /* needed by radeon_cursor.c */ diff --git a/src/radeon_mm_i2c.c b/src/radeon_mm_i2c.c index f95bcf5..377c3df 100644 --- a/src/radeon_mm_i2c.c +++ b/src/radeon_mm_i2c.c @@ -2,6 +2,8 @@ #include "config.h" #endif +#include <math.h> + #include "radeon.h" #include "radeon_reg.h" #include "radeon_macros.h" @@ -116,7 +118,6 @@ static void RADEON_I2C_Halt (ScrnInfoPtr pScrn) RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; CARD8 reg; - long counter = 0; /* reset status flags */ RADEONWaitForIdleMMIO(pScrn); @@ -302,6 +303,7 @@ static Bool R200_I2CWriteRead(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite, return TRUE; } +#if 0 static Bool RADEONProbeAddress(I2CBusPtr b, I2CSlaveAddr addr) { I2CByte a; @@ -314,6 +316,7 @@ static Bool RADEONProbeAddress(I2CBusPtr b, I2CSlaveAddr addr) return I2C_WriteRead(&d, NULL, 0, &a, 1); } +#endif #define I2C_CLOCK_FREQ (60000.0) @@ -376,8 +379,6 @@ void RADEONInitI2C(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) double nm; RADEONInfoPtr info = RADEONPTR(pScrn); RADEONPLLPtr pll = &(info->pll); - int i; - unsigned char *RADEONMMIO = info->MMIO; pPriv->i2c = NULL; pPriv->fi1236 = NULL; diff --git a/src/radeon_probe.c b/src/radeon_probe.c index ddb510e..40f88dc 100644 --- a/src/radeon_probe.c +++ b/src/radeon_probe.c @@ -31,6 +31,8 @@ #include "config.h" #endif +#include <string.h> + /* * Authors: * Kevin E. Martin <martin@xfree86.org> @@ -47,7 +49,6 @@ #include "atipciids.h" #include "xf86.h" -#include "xf86_ansic.h" #define _XF86MISC_SERVER_ #include <X11/extensions/xf86misc.h> #include "xf86Resources.h" diff --git a/src/radeon_reg.h b/src/radeon_reg.h index 53cc803..b7c6e26 100644 --- a/src/radeon_reg.h +++ b/src/radeon_reg.h @@ -2435,6 +2435,7 @@ # define R200_TXFORMAT_DXT1 (12 << 0) # define R200_TXFORMAT_DXT23 (14 << 0) # define R200_TXFORMAT_DXT45 (15 << 0) +# define R200_TXFORMAT_ABGR8888 (22 << 0) # define R200_TXFORMAT_FORMAT_MASK (31 << 0) # define R200_TXFORMAT_FORMAT_SHIFT 0 # define R200_TXFORMAT_ALPHA_IN_MAP (1 << 6) diff --git a/src/radeon_render.c b/src/radeon_render.c index 0fab39f..9e3529e 100644 --- a/src/radeon_render.c +++ b/src/radeon_render.c @@ -31,6 +31,8 @@ #include "config.h" #endif +#include <string.h> + #ifdef USE_XAA #include "dixstruct.h" @@ -381,9 +383,10 @@ static Bool FUNC_NAME(R100SetupTexture)( RADEONInfoPtr info = RADEONPTR(pScrn); CARD8 *dst; CARD32 tex_size = 0, txformat; - int dst_pitch, offset, size, i, tex_bytepp; + int dst_pitch, offset, size, tex_bytepp; #ifdef ACCEL_CP - CARD32 buf_pitch; + CARD32 buf_pitch, dst_pitch_off; + int x, y; unsigned int hpass; CARD8 *tmp_dst; #endif @@ -428,11 +431,13 @@ static Bool FUNC_NAME(R100SetupTexture)( #ifdef ACCEL_CP + RADEONHostDataParams( pScrn, dst, dst_pitch, tex_bytepp, &dst_pitch_off, &x, &y ); + while ( height ) { tmp_dst = RADEONHostDataBlit( pScrn, tex_bytepp, width, - dst_pitch, &buf_pitch, - &dst, &height, &hpass); + dst_pitch_off, &buf_pitch, + x, &y, &height, &hpass ); RADEONHostDataBlitCopyPass( pScrn, tex_bytepp, tmp_dst, src, hpass, buf_pitch, src_pitch ); src += hpass * src_pitch; @@ -443,12 +448,10 @@ static Bool FUNC_NAME(R100SetupTexture)( #else - i = height; - if (info->accel->NeedToSync) info->accel->Sync(pScrn); - while(i--) { + while (height--) { memcpy(dst, src, width * tex_bytepp); src += src_pitch; dst += dst_pitch; @@ -713,9 +716,10 @@ static Bool FUNC_NAME(R200SetupTexture)( RADEONInfoPtr info = RADEONPTR(pScrn); CARD8 *dst; CARD32 tex_size = 0, txformat; - int dst_pitch, offset, size, i, tex_bytepp; + int dst_pitch, offset, size, tex_bytepp; #ifdef ACCEL_CP - CARD32 buf_pitch; + CARD32 buf_pitch, dst_pitch_off; + int x, y; unsigned int hpass; CARD8 *tmp_dst; #endif @@ -760,11 +764,13 @@ static Bool FUNC_NAME(R200SetupTexture)( #ifdef ACCEL_CP + RADEONHostDataParams( pScrn, dst, dst_pitch, tex_bytepp, &dst_pitch_off, &x, &y ); + while ( height ) { tmp_dst = RADEONHostDataBlit( pScrn, tex_bytepp, width, - dst_pitch, &buf_pitch, - &dst, &height, &hpass ); + dst_pitch_off, &buf_pitch, + x, &y, &height, &hpass ); RADEONHostDataBlitCopyPass( pScrn, tex_bytepp, tmp_dst, src, hpass, buf_pitch, src_pitch ); src += hpass * src_pitch; @@ -775,11 +781,10 @@ static Bool FUNC_NAME(R200SetupTexture)( #else - i = height; if (info->accel->NeedToSync) info->accel->Sync(pScrn); - while(i--) { + while (height--) { memcpy(dst, src, width * tex_bytepp); src += src_pitch; dst += dst_pitch; diff --git a/src/radeon_version.h b/src/radeon_version.h index 5fc41c4..a0f87e6 100644 --- a/src/radeon_version.h +++ b/src/radeon_version.h @@ -42,8 +42,8 @@ #define RADEON_VERSION_MAJOR 4 #define RADEON_VERSION_MAJOR_TILED 5 -#define RADEON_VERSION_MINOR 0 -#define RADEON_VERSION_PATCH 3 +#define RADEON_VERSION_MINOR 2 +#define RADEON_VERSION_PATCH 0 #ifndef RADEON_VERSION_EXTRA #define RADEON_VERSION_EXTRA "" diff --git a/src/radeon_video.c b/src/radeon_video.c index e11864c..a077cdf 100644 --- a/src/radeon_video.c +++ b/src/radeon_video.c @@ -4,6 +4,11 @@ #include "config.h" #endif +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <math.h> + #include "radeon.h" #include "radeon_reg.h" #include "radeon_macros.h" @@ -25,13 +30,6 @@ #include "msp3430.h" #include "tda9885.h" -#ifdef USE_EXA -/* FIXME : the video code hasn't been ported so this is a hack to make - * it compile at all without too much ifdefing */ -#include "xaa.h" -#include "xf86fbman.h" -#endif - #define OFF_DELAY 250 /* milliseconds */ #define FREE_DELAY 15000 @@ -85,7 +83,8 @@ static void RADEONQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); static int RADEONPutImage(ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, - short, Bool, RegionPtr, pointer); + short, Bool, RegionPtr, pointer, + DrawablePtr); static int RADEONQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); static void RADEONFreeMemory(ScrnInfoPtr pScrn, void *mem_struct); @@ -93,7 +92,7 @@ static void RADEONFreeMemory(ScrnInfoPtr pScrn, void *mem_struct); static void RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time now); static int RADEONPutVideo(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data); + RegionPtr clipBoxes, pointer data, DrawablePtr pDraw); static void RADEON_board_setmisc(RADEONPortPrivPtr pPriv); static void RADEON_RT_SetEncoding(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv); @@ -410,7 +409,7 @@ typedef struct tagREF_TRANSFORM } REF_TRANSFORM; /* Parameters for ITU-R BT.601 and ITU-R BT.709 colour spaces */ -REF_TRANSFORM trans[2] = +static REF_TRANSFORM trans[2] = { {1.1678, 0.0, 1.6007, -0.3929, -0.8154, 2.0232, 0.0}, /* BT.601 */ {1.1678, 0.0, 1.7980, -0.2139, -0.5345, 2.1186, 0.0} /* BT.709 */ @@ -478,7 +477,7 @@ typedef struct tagGAMMA_CURVE_R200 /* Preset gammas */ -GAMMA_CURVE_R100 gamma_curve_r100[8] = +static GAMMA_CURVE_R100 gamma_curve_r100[8] = { /* Gamma 1.0 */ {0x100, 0x0, @@ -546,7 +545,7 @@ GAMMA_CURVE_R100 gamma_curve_r100[8] = 0.9135} }; -GAMMA_CURVE_R200 gamma_curve_r200[8] = +static GAMMA_CURVE_R200 gamma_curve_r200[8] = { /* Gamma 1.0 */ {0x00000040, 0x00000000, @@ -1263,7 +1262,7 @@ static void RADEONSetupTheatre(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Unsupported reference clock frequency, Rage Theatre disabled\n"); t->theatre_num=-1; - xf86free(pPriv->theatre); + xfree(pPriv->theatre); pPriv->theatre = NULL; return; } @@ -2042,7 +2041,8 @@ RADEONCopyData( if ( info->directRenderingEnabled && info->DMAForXv ) { CARD8 *buf; - CARD32 bufPitch; + CARD32 bufPitch, dstPitchOff; + int x, y; unsigned int hpass; /* Get the byte-swapping right for big endian systems */ @@ -2052,8 +2052,10 @@ RADEONCopyData( bpp = 1; } - while ( buf = RADEONHostDataBlit( pScrn, bpp, w, dstPitch, - &bufPitch, &dst, &h, &hpass ) ) + RADEONHostDataParams( pScrn, dst, dstPitch, bpp, &dstPitchOff, &x, &y ); + + while ( (buf = RADEONHostDataBlit( pScrn, bpp, w, dstPitchOff, &bufPitch, + x, &y, &h, &hpass )) ) { RADEONHostDataBlitCopyPass( pScrn, bpp, buf, src, hpass, bufPitch, srcPitch ); @@ -2100,6 +2102,7 @@ RADEONCopyData( } } +#ifdef XF86DRI static void RADEON_420_422( unsigned int *d, unsigned char *s1, @@ -2114,7 +2117,7 @@ static void RADEON_420_422( n--; } } - +#endif static void RADEONCopyRGB24Data( @@ -2134,23 +2137,25 @@ RADEONCopyRGB24Data( if ( info->directRenderingEnabled && info->DMAForXv ) { - CARD32 bufPitch; + CARD32 bufPitch, dstPitchOff; + int x, y; unsigned int hpass; /* XXX Fix endian flip on R300 */ - while ( dptr = ( CARD32* )RADEONHostDataBlit( pScrn, 4, w, dstPitch, - &bufPitch, &dst, &h, - &hpass ) ) + RADEONHostDataParams( pScrn, dst, dstPitch, 4, &dstPitchOff, &x, &y ); + + while ( (dptr = ( CARD32* )RADEONHostDataBlit( pScrn, 4, w, dstPitch, + &bufPitch, x, &y, &h, + &hpass )) ) { for( j = 0; j < hpass; j++ ) { sptr = src; - for ( i = 0 ; i < w; i++ ) + for ( i = 0 ; i < w; i++, sptr += 3 ) { - *dptr++ = ( ( *sptr++ ) << 24 ) | ( ( *sptr++ ) << 16 ) | - ( *sptr++ ); + *dptr++ = (sptr[0] << 24) | (sptr[1] << 16) | sptr[2]; } src += hpass * srcPitch; @@ -2209,13 +2214,16 @@ RADEONCopyMungedData( if ( info->directRenderingEnabled && info->DMAForXv ) { CARD8 *buf; - CARD32 y = 0, bufPitch; + CARD32 y = 0, bufPitch, dstPitchOff; + int blitX, blitY; unsigned int hpass; /* XXX Fix endian flip on R300 */ - while ( buf = RADEONHostDataBlit( pScrn, 4, w/2, dstPitch, - &bufPitch, &dst1, &h, &hpass ) ) + RADEONHostDataParams( pScrn, dst1, dstPitch, 4, &dstPitchOff, &blitX, &blitY ); + + while ( (buf = RADEONHostDataBlit( pScrn, 4, w/2, dstPitchOff, &bufPitch, + blitX, &blitY, &h, &hpass )) ) { while ( hpass-- ) { @@ -2410,7 +2418,7 @@ RADEONDisplayVideo( ){ RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int v_inc, h_inc, h_inc_uv, step_by_y, step_by_uv, tmp; + CARD32 v_inc, h_inc, h_inc_uv, step_by_y, step_by_uv, tmp; double h_inc_d; int p1_h_accum_init, p23_h_accum_init; int p1_v_accum_init; @@ -2699,7 +2707,8 @@ RADEONPutImage( int id, unsigned char* buf, short width, short height, Bool Sync, - RegionPtr clipBoxes, pointer data + RegionPtr clipBoxes, pointer data, + DrawablePtr pDraw ){ RADEONInfoPtr info = RADEONPTR(pScrn); RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data; @@ -2710,9 +2719,6 @@ RADEONPutImage( int top, left, npixels, nlines, bpp; BoxRec dstBox; CARD32 tmp; -#if X_BYTE_ORDER == X_BIG_ENDIAN - unsigned char *RADEONMMIO = info->MMIO; -#endif /* * s2offset, s3offset - byte offsets into U and V plane of the @@ -2909,6 +2915,18 @@ RADEONQueryImageAttributes( if(offsets) offsets[2] = size; size += tmp; break; + case FOURCC_RGBA32: + size = *w << 2; + if(pitches) pitches[0] = size; + size *= *h; + break; + case FOURCC_RGB24: + size = *w * 3; + if(pitches) pitches[0] = size; + size *= *h; + break; + case FOURCC_RGBT16: + case FOURCC_RGB16: case FOURCC_UYVY: case FOURCC_YUY2: default: @@ -3178,7 +3196,8 @@ RADEONPutVideo( short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data + RegionPtr clipBoxes, pointer data, + DrawablePtr pDraw ){ RADEONInfoPtr info = RADEONPTR(pScrn); RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data; diff --git a/src/radeon_vip.c b/src/radeon_vip.c index b61adfe..abcba06 100644 --- a/src/radeon_vip.c +++ b/src/radeon_vip.c @@ -2,6 +2,8 @@ #include "config.h" #endif +#include <string.h> + #include "radeon.h" #include "radeon_reg.h" #include "radeon_macros.h" diff --git a/src/theatre.c b/src/theatre.c index 7008ca3..0a635fa 100644 --- a/src/theatre.c +++ b/src/theatre.c @@ -2,6 +2,7 @@ #include "config.h" #endif +#include <unistd.h> #include "xf86.h" #include "generic_bus.h" #include "theatre.h" @@ -1795,7 +1796,7 @@ void RT_SetConnector (TheatrePtr t, CARD16 wConnector, int tunerFlag) counter++; } dwTempContrast = ReadRT_fld (fld_LP_CONTRAST); - if(counter>=10000)xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "Rage Theatre: timeout waiting for line count (%d)\n", ReadRT_fld (fld_VS_LINE_COUNT)); + if(counter>=10000)xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "Rage Theatre: timeout waiting for line count (%ld)\n", ReadRT_fld (fld_VS_LINE_COUNT)); WriteRT_fld (fld_LP_CONTRAST, 0x0); @@ -1850,7 +1851,7 @@ void RT_SetConnector (TheatrePtr t, CARD16 wConnector, int tunerFlag) counter++; } WriteRT_fld (fld_LP_CONTRAST, dwTempContrast); - if(counter>=10000)xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "Rage Theatre: timeout waiting for line count (%d)\n", ReadRT_fld (fld_VS_LINE_COUNT)); + if(counter>=10000)xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "Rage Theatre: timeout waiting for line count (%ld)\n", ReadRT_fld (fld_VS_LINE_COUNT)); @@ -1941,7 +1942,7 @@ void DumpRageTheatreRegs(TheatrePtr t) for(i=0;i<0x900;i+=4) { RT_regr(i, &data); - xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "register 0x%04x is equal to 0x%08x\n", i, data); + xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "register 0x%04x is equal to 0x%08lx\n", i, data); } } @@ -2141,21 +2142,18 @@ void DumpRageTheatreRegsByName(TheatrePtr t) { "Y_FALL_CNTL ", 0x01cc }, { "Y_RISE_CNTL ", 0x01d0 }, { "Y_SAW_TOOTH_CNTL ", 0x01d4 }, - {NULL, NULL} + {NULL, 0} }; for(i=0; rt_reg_list[i].name!=NULL;i++){ RT_regr(rt_reg_list[i].addr, &data); - xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "register (0x%04x) %s is equal to 0x%08x\n", rt_reg_list[i].addr, rt_reg_list[i].name, data); + xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "register (0x%04lx) %s is equal to 0x%08lx\n", rt_reg_list[i].addr, rt_reg_list[i].name, data); } } void ResetTheatreRegsForNoTVout(TheatrePtr t) { - int i; - CARD32 data; - RT_regw(VIP_CLKOUT_CNTL, 0x0); RT_regw(VIP_HCOUNT, 0x0); RT_regw(VIP_VCOUNT, 0x0); @@ -2170,9 +2168,6 @@ void ResetTheatreRegsForNoTVout(TheatrePtr t) void ResetTheatreRegsForTVout(TheatrePtr t) { - int i; - CARD32 data; - /* RT_regw(VIP_HW_DEBUG, 0x200); */ /* RT_regw(VIP_INT_CNTL, 0x0); RT_regw(VIP_GPIO_INOUT, 0x10090000); @@ -2187,7 +2182,7 @@ void ResetTheatreRegsForTVout(TheatrePtr t) RT_regw(VIP_VCOUNT, 0x151); #endif RT_regw(VIP_DFCOUNT, 0x01); -/* RT_regw(VIP_CLOCK_SEL_CNTL, 0xb7); /* versus 0x237 <-> 0x2b7 */ +/* RT_regw(VIP_CLOCK_SEL_CNTL, 0xb7); versus 0x237 <-> 0x2b7 */ RT_regw(VIP_CLOCK_SEL_CNTL, 0x2b7); /* versus 0x237 <-> 0x2b7 */ RT_regw(VIP_VIN_PLL_CNTL, 0x60a6039); /* RT_regw(VIP_PLL_CNTL1, 0xacacac74); */ diff --git a/src/theatre200.c b/src/theatre200.c index 9d95b7f..4b64884 100644 --- a/src/theatre200.c +++ b/src/theatre200.c @@ -1,5 +1,5 @@ /************************************************************************************* - * $Id: theatre200.c,v 1.4 2005/08/28 18:00:23 bogdand Exp $ + * $Id$ * * Copyright (C) 2005 Bogdan D. bogdand@users.sourceforge.net * @@ -22,7 +22,17 @@ * otherwise to promote the sale, use or other dealings in this Software without prior written * authorization from the author. * - * $Log: theatre200.c,v $ + * $Log$ + * Revision 1.6 2006/03/22 22:30:14 krh + * 2006-03-22 Kristian Høgsberg <krh@redhat.com> + * + * * src/theatre200.c: Convert use of xf86fopen() and other xf86 + * wrapped libc symbols to use libc symbols directly. The xf86* + * versions aren't supposed to be used directly. + * + * * src/ *.c: Drop libc wrapper; don't include xf86_ansic.h and add + * includes now missing. + * * Revision 1.4 2005/08/28 18:00:23 bogdand * Modified the licens type from GPL to a X/MIT one * @@ -39,9 +49,11 @@ #include "config.h" #endif +#include <stdio.h> +#include <string.h> + #include "xf86.h" #include "generic_bus.h" -#include "xf86_ansic.h" #include "radeon_reg.h" #include "radeon.h" #include "theatre_reg.h" @@ -62,24 +74,24 @@ static int dsp_load(TheatrePtr t, struct rt200_microc_data* microc_datap); static CARD32 dsp_send_command(TheatrePtr t, CARD32 fb_scratch1, CARD32 fb_scratch0); static CARD32 dsp_set_video_input_connector(TheatrePtr t, CARD32 connector); -static CARD32 dsp_reset(TheatrePtr t); +//static CARD32 dsp_reset(TheatrePtr t); static CARD32 dsp_set_lowpowerstate(TheatrePtr t, CARD32 pstate); static CARD32 dsp_set_video_standard(TheatrePtr t, CARD32 standard); static CARD32 dsp_set_videostreamformat(TheatrePtr t, CARD32 format); static CARD32 dsp_video_standard_detection(TheatrePtr t); -static CARD32 dsp_get_signallockstatus(TheatrePtr t); -static CARD32 dsp_get_signallinenumber(TheatrePtr t); +//static CARD32 dsp_get_signallockstatus(TheatrePtr t); +//static CARD32 dsp_get_signallinenumber(TheatrePtr t); static CARD32 dsp_set_brightness(TheatrePtr t, CARD8 brightness); static CARD32 dsp_set_contrast(TheatrePtr t, CARD8 contrast); -static CARD32 dsp_set_sharpness(TheatrePtr t, int sharpness); +//static CARD32 dsp_set_sharpness(TheatrePtr t, int sharpness); static CARD32 dsp_set_tint(TheatrePtr t, CARD8 tint); static CARD32 dsp_set_saturation(TheatrePtr t, CARD8 saturation); static CARD32 dsp_set_video_scaler_horizontal(TheatrePtr t, CARD16 output_width, CARD16 horz_start, CARD16 horz_end); static CARD32 dsp_set_video_scaler_vertical(TheatrePtr t, CARD16 output_height, CARD16 vert_start, CARD16 vert_end); static CARD32 dsp_audio_mute(TheatrePtr t, CARD8 left, CARD8 right); static CARD32 dsp_set_audio_volume(TheatrePtr t, CARD8 left, CARD8 right, CARD8 auto_mute); -static CARD32 dsp_audio_detection(TheatrePtr t, CARD8 option); +//static CARD32 dsp_audio_detection(TheatrePtr t, CARD8 option); static CARD32 dsp_configure_i2s_port(TheatrePtr t, CARD8 tx_mode, CARD8 rx_mode, CARD8 clk_mode); static CARD32 dsp_configure_spdif_port(TheatrePtr t, CARD8 state); @@ -128,15 +140,15 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ if (micro_type == NULL) return -1; - file = xf86fopen(micro_path, "r"); + file = fopen(micro_path, "r"); if (file == NULL) { ERROR_0("Cannot open microcode file\n"); return -1; } - if (!xf86strcmp(micro_type, "BINARY")) + if (!strcmp(micro_type, "BINARY")) { - if (xf86fread(microc_headp, sizeof(struct rt200_microc_head), 1, file) != 1) + if (fread(microc_headp, sizeof(struct rt200_microc_head), 1, file) != 1) { ERROR("Cannot read header from file: %s\n", micro_path); goto fail_exit; @@ -151,23 +163,23 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ { int ret; - curr_seg = (struct rt200_microc_seg*)xf86malloc(sizeof(struct rt200_microc_seg)); + curr_seg = (struct rt200_microc_seg*)Xalloc(sizeof(struct rt200_microc_seg)); if (curr_seg == NULL) { ERROR_0("Cannot allocate memory\n"); goto fail_exit; } - ret = xf86fread(&curr_seg->num_bytes, 4, 1, file); - ret += xf86fread(&curr_seg->download_dst, 4, 1, file); - ret += xf86fread(&curr_seg->crc_val, 4, 1, file); + ret = fread(&curr_seg->num_bytes, 4, 1, file); + ret += fread(&curr_seg->download_dst, 4, 1, file); + ret += fread(&curr_seg->crc_val, 4, 1, file); if (ret != 3) { ERROR("Cannot read segment from microcode file: %s\n", micro_path); goto fail_exit; } - curr_seg->data = (unsigned char*)xf86malloc(curr_seg->num_bytes); + curr_seg->data = (unsigned char*)Xalloc(curr_seg->num_bytes); if (curr_seg->data == NULL) { ERROR_0("cannot allocate memory\n"); @@ -193,7 +205,7 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ curr_seg = seg_list; while (curr_seg) { - if (xf86fread(curr_seg->data, curr_seg->num_bytes, 1, file) != 1) + if (fread(curr_seg->data, curr_seg->num_bytes, 1, file) != 1) { ERROR_0("Cannot read segment data\n"); goto fail_exit; @@ -202,20 +214,20 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ curr_seg = curr_seg->next; } } - else if (!xf86strcmp(micro_type, "ASCII")) + else if (!strcmp(micro_type, "ASCII")) { char tmp1[12], tmp2[12], tmp3[12], tmp4[12]; unsigned int ltmp; - if ((xf86fgets(tmp1, 12, file) != NULL) && - (xf86fgets(tmp2, 12, file) != NULL) && - (xf86fgets(tmp3, 12, file) != NULL) && - xf86fgets(tmp4, 12, file) != NULL) + if ((fgets(tmp1, 12, file) != NULL) && + (fgets(tmp2, 12, file) != NULL) && + (fgets(tmp3, 12, file) != NULL) && + fgets(tmp4, 12, file) != NULL) { - microc_headp->device_id = xf86strtoul(tmp1, NULL, 16); - microc_headp->vendor_id = xf86strtoul(tmp2, NULL, 16); - microc_headp->revision_id = xf86strtoul(tmp3, NULL, 16); - microc_headp->num_seg = xf86strtoul(tmp4, NULL, 16); + microc_headp->device_id = strtoul(tmp1, NULL, 16); + microc_headp->vendor_id = strtoul(tmp2, NULL, 16); + microc_headp->revision_id = strtoul(tmp3, NULL, 16); + microc_headp->num_seg = strtoul(tmp4, NULL, 16); } else { @@ -230,20 +242,20 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ for (i = 0; i < microc_headp->num_seg; i++) { - curr_seg = (struct rt200_microc_seg*)xf86malloc(sizeof(struct rt200_microc_seg)); + curr_seg = (struct rt200_microc_seg*)Xalloc(sizeof(struct rt200_microc_seg)); if (curr_seg == NULL) { ERROR_0("Cannot allocate memory\n"); goto fail_exit; } - if (xf86fgets(tmp1, 12, file) != NULL && - xf86fgets(tmp2, 12, file) != NULL && - xf86fgets(tmp3, 12, file) != NULL) + if (fgets(tmp1, 12, file) != NULL && + fgets(tmp2, 12, file) != NULL && + fgets(tmp3, 12, file) != NULL) { - curr_seg->num_bytes = xf86strtoul(tmp1, NULL, 16); - curr_seg->download_dst = xf86strtoul(tmp2, NULL, 16); - curr_seg->crc_val = xf86strtoul(tmp3, NULL, 16); + curr_seg->num_bytes = strtoul(tmp1, NULL, 16); + curr_seg->download_dst = strtoul(tmp2, NULL, 16); + curr_seg->crc_val = strtoul(tmp3, NULL, 16); } else { @@ -251,7 +263,7 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ goto fail_exit; } - curr_seg->data = (unsigned char*)xf86malloc(curr_seg->num_bytes); + curr_seg->data = (unsigned char*)Xalloc(curr_seg->num_bytes); if (curr_seg->data == NULL) { ERROR_0("cannot allocate memory\n"); @@ -279,12 +291,12 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ for ( i = 0; i < curr_seg->num_bytes; i+=4) { - if (xf86fgets(tmp1, 12, file) == NULL) + if (fgets(tmp1, 12, file) == NULL) { ERROR_0("Cannot read from file\n"); goto fail_exit; } - ltmp = xf86strtoul(tmp1, NULL, 16); + ltmp = strtoul(tmp1, NULL, 16); *(unsigned int*)(curr_seg->data + i) = ltmp; } @@ -300,7 +312,7 @@ static int microc_load (char* micro_path, char* micro_type, struct rt200_microc_ microc_datap->microc_seg_list = seg_list; - xf86fclose(file); + fclose(file); return 0; fail_exit: @@ -312,7 +324,7 @@ fail_exit: curr_seg = curr_seg->next; Xfree(prev_seg); } - xf86fclose(file); + fclose(file); return -1; } @@ -364,12 +376,8 @@ static int dsp_load(TheatrePtr t, struct rt200_microc_data* microc_datap) CARD32 tries = 0; CARD32 result = 0; CARD32 seg_id = 0; - int screen = t->VIP->scrnIndex; - ScrnInfoPtr pScrn = xf86Screens[t->VIP->scrnIndex]; - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - + DEBUG("Microcode: before everything: %x\n", data8); if (RT_fifor(0x000, &data8)) @@ -619,6 +627,7 @@ static CARD32 dsp_set_video_input_connector(TheatrePtr t, CARD32 connector) return result; } +#if 0 static CARD32 dsp_reset(TheatrePtr t) { CARD32 fb_scratch0 = 0; @@ -633,6 +642,7 @@ static CARD32 dsp_reset(TheatrePtr t) return result; } +#endif static CARD32 dsp_set_lowpowerstate(TheatrePtr t, CARD32 pstate) { @@ -693,6 +703,7 @@ static CARD32 dsp_video_standard_detection(TheatrePtr t) return result; } +#if 0 static CARD32 dsp_get_signallockstatus(TheatrePtr t) { CARD32 fb_scratch1 = 0; @@ -726,6 +737,7 @@ static CARD32 dsp_get_signallinenumber(TheatrePtr t) return result; } +#endif static CARD32 dsp_set_brightness(TheatrePtr t, CARD8 brightness) { @@ -759,6 +771,7 @@ static CARD32 dsp_set_contrast(TheatrePtr t, CARD8 contrast) return result; } +#if 0 static CARD32 dsp_set_sharpness(TheatrePtr t, int sharpness) { CARD32 fb_scratch1 = 0; @@ -774,6 +787,7 @@ static CARD32 dsp_set_sharpness(TheatrePtr t, int sharpness) return result; } +#endif static CARD32 dsp_set_tint(TheatrePtr t, CARD8 tint) { @@ -873,6 +887,7 @@ static CARD32 dsp_set_audio_volume(TheatrePtr t, CARD8 left, CARD8 right, CARD8 return result; } +#if 0 static CARD32 dsp_audio_detection(TheatrePtr t, CARD8 option) { CARD32 fb_scratch1 = 0; @@ -888,6 +903,7 @@ static CARD32 dsp_audio_detection(TheatrePtr t, CARD8 option) return result; } +#endif static CARD32 dsp_configure_i2s_port(TheatrePtr t, CARD8 tx_mode, CARD8 rx_mode, CARD8 clk_mode) { @@ -1441,6 +1457,7 @@ static void WriteRT_fld1 (TheatrePtr t, CARD32 dwReg, CARD32 dwData) } /* WriteRT_fld ()... */ +#if 0 /**************************************************************************** * ReadRT_fld (CARD32 dwReg) * * Function: Reads a register field within Rage Theatre * @@ -1464,8 +1481,10 @@ static CARD32 ReadRT_fld1 (TheatrePtr t,CARD32 dwReg) } /* ReadRT_fld ()... */ -#define WriteRT_fld(a,b) WriteRT_fld1(t, (a), (b)) #define ReadRT_fld(a) ReadRT_fld1(t,(a)) +#endif + +#define WriteRT_fld(a,b) WriteRT_fld1(t, (a), (b)) /**************************************************************************** @@ -1781,10 +1800,10 @@ void RT_SetConnector (TheatrePtr t, CARD16 wConnector, int tunerFlag) t->wConnector = wConnector; theatre_read(t, VIP_GPIO_CNTL, &data); - xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_CNTL: %x\n", data); + xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_CNTL: %lx\n", data); theatre_read(t, VIP_GPIO_INOUT, &data); - xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_INOUT: %x\n", data); + xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_INOUT: %lx\n", data); switch (wConnector) { @@ -1833,10 +1852,10 @@ void RT_SetConnector (TheatrePtr t, CARD16 wConnector, int tunerFlag) } theatre_read(t, VIP_GPIO_CNTL, &data); - xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_CNTL: %x\n", data); + xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_CNTL: %lx\n", data); theatre_read(t, VIP_GPIO_INOUT, &data); - xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_INOUT: %x\n", data); + xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_INOUT: %lx\n", data); dsp_configure_i2s_port(t, 0, 0, 0); @@ -1989,7 +2008,7 @@ void DumpRageTheatreRegs(TheatrePtr t) for(i=0;i<0x900;i+=4) { RT_regr(i, &data); - xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "register 0x%04x is equal to 0x%08x\n", i, data); + xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "register 0x%04x is equal to 0x%08lx\n", i, data); } } @@ -2189,21 +2208,18 @@ void DumpRageTheatreRegsByName(TheatrePtr t) { "Y_FALL_CNTL ", 0x01cc }, { "Y_RISE_CNTL ", 0x01d0 }, { "Y_SAW_TOOTH_CNTL ", 0x01d4 }, - {NULL, NULL} + {NULL, 0} }; for(i=0; rt_reg_list[i].name!=NULL;i++){ RT_regr(rt_reg_list[i].addr, &data); - xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "register (0x%04x) %s is equal to 0x%08x\n", rt_reg_list[i].addr, rt_reg_list[i].name, data); + xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "register (0x%04lx) %s is equal to 0x%08lx\n", rt_reg_list[i].addr, rt_reg_list[i].name, data); } } void ResetTheatreRegsForNoTVout(TheatrePtr t) { - int i; - CARD32 data; - RT_regw(VIP_CLKOUT_CNTL, 0x0); RT_regw(VIP_HCOUNT, 0x0); RT_regw(VIP_VCOUNT, 0x0); @@ -2218,9 +2234,6 @@ void ResetTheatreRegsForNoTVout(TheatrePtr t) void ResetTheatreRegsForTVout(TheatrePtr t) { - int i; - CARD32 data; - /* RT_regw(VIP_HW_DEBUG, 0x200); */ /* RT_regw(VIP_INT_CNTL, 0x0); RT_regw(VIP_GPIO_INOUT, 0x10090000); @@ -2235,7 +2248,7 @@ void ResetTheatreRegsForTVout(TheatrePtr t) RT_regw(VIP_VCOUNT, 0x151); #endif RT_regw(VIP_DFCOUNT, 0x01); -/* RT_regw(VIP_CLOCK_SEL_CNTL, 0xb7); /* versus 0x237 <-> 0x2b7 */ +/* RT_regw(VIP_CLOCK_SEL_CNTL, 0xb7); versus 0x237 <-> 0x2b7 */ RT_regw(VIP_CLOCK_SEL_CNTL, 0x2b7); /* versus 0x237 <-> 0x2b7 */ RT_regw(VIP_VIN_PLL_CNTL, 0x60a6039); /* RT_regw(VIP_PLL_CNTL1, 0xacacac74); */ diff --git a/src/theatre200.h b/src/theatre200.h index cb1d987..9602a15 100644 --- a/src/theatre200.h +++ b/src/theatre200.h @@ -1,5 +1,5 @@ /************************************************************************************* - * $Id: theatre200.h,v 1.4 2005/11/07 19:28:40 bogdand Exp $ + * $Id$ * * Copyright (C) 2005 Bogdan D. bogdand@users.sourceforge.net * @@ -22,7 +22,10 @@ * otherwise to promote the sale, use or other dealings in this Software without prior written * authorization from the author. * - * $Log: theatre200.h,v $ + * $Log$ + * Revision 1.5 2005/12/08 17:54:40 kem + * Allow hard-coded paths to be configurable. + * * Revision 1.4 2005/11/07 19:28:40 bogdand * Replaced the variadic macros(gcc) by macros according to C99 standard * @@ -59,14 +62,14 @@ #define ERROR_3(str,param1,param2,param3) xf86DrvMsg(screen, X_ERROR, str, param1, param2, param3) #define DEBUG_3(str,param1,param2,param3) xf86DrvMsg(screen, X_INFO, str, param1, param2, param3) #else -#define ERROR_0(str) -#define DEBUG_0(str) -#define ERROR(str,param1) -#define DEBUG(str,param1) -#define ERROR_2(str,param1,param2) -#define DEBUG_2(str,param1,param2) -#define ERROR_3(str,param1,param2,param3) -#define DEBUG_3(str,param1,param2,param3) +#define ERROR_0(str) (void)screen +#define DEBUG_0(str) (void)screen +#define ERROR(str,param1) (void)screen +#define DEBUG(str,param1) (void)screen +#define ERROR_2(str,param1,param2) (void)screen +#define DEBUG_2(str,param1,param2) (void)screen +#define ERROR_3(str,param1,param2,param3) (void)screen +#define DEBUG_3(str,param1,param2,param3) (void)screen #endif diff --git a/src/theatre_detect.c b/src/theatre_detect.c index 54161fe..4836db8 100644 --- a/src/theatre_detect.c +++ b/src/theatre_detect.c @@ -1,5 +1,5 @@ /************************************************************************************* - * $Id: theatre_detect.c,v 1.3 2005/07/11 02:29:45 ajax Exp $ + * $Id$ * * Copyright (C) 2005 Bogdan D. bogdand@users.sourceforge.net * @@ -22,7 +22,10 @@ * otherwise to promote the sale, use or other dealings in this Software without prior written * authorization from the author. * - * $Log: theatre_detect.c,v $ + * $Log$ + * Revision 1.4 2005/08/28 18:00:23 bogdand + * Modified the licens type from GPL to a X/MIT one + * * Revision 1.3 2005/07/11 02:29:45 ajax * Prep for modular builds by adding guarded #include "config.h" everywhere. * @@ -36,29 +39,29 @@ #include "config.h" #endif +#include <string.h> #include "xf86.h" #include "generic_bus.h" #include "theatre.h" #include "theatre_reg.h" -#undef read -#undef write -#undef ioctl - static Bool theatre_read(TheatrePtr t,CARD32 reg, CARD32 *data) { if(t->theatre_num<0)return FALSE; return t->VIP->read(t->VIP, ((t->theatre_num & 0x3)<<14) | reg,4, (CARD8 *) data); } +/* Unused code - reference */ +#if 0 static Bool theatre_write(TheatrePtr t,CARD32 reg, CARD32 data) { if(t->theatre_num<0)return FALSE; return t->VIP->write(t->VIP,((t->theatre_num & 0x03)<<14) | reg,4, (CARD8 *) &data); } +#define RT_regw(reg,data) theatre_write(t,(reg),(data)) +#endif #define RT_regr(reg,data) theatre_read(t,(reg),(data)) -#define RT_regw(reg,data) theatre_write(t,(reg),(data)) #define VIP_TYPE "ATI VIP BUS" @@ -86,7 +89,7 @@ TheatrePtr DetectTheatre(GENERIC_BUS_Ptr b) { if(b->read(b, ((i & 0x03)<<14) | VIP_VIP_VENDOR_DEVICE_ID, 4, (CARD8 *)&val)) { - if(val)xf86DrvMsg(b->scrnIndex, X_INFO, "Device %d on VIP bus ids as 0x%08x\n",i,val); + if(val)xf86DrvMsg(b->scrnIndex, X_INFO, "Device %ld on VIP bus ids as 0x%08lx\n",i,val); if(t->theatre_num>=0)continue; /* already found one instance */ switch(val){ case RT100_ATI_ID: @@ -99,10 +102,10 @@ TheatrePtr DetectTheatre(GENERIC_BUS_Ptr b) break; } } else { - xf86DrvMsg(b->scrnIndex, X_INFO, "No response from device %d on VIP bus\n",i); + xf86DrvMsg(b->scrnIndex, X_INFO, "No response from device %ld on VIP bus\n",i); } } - if(t->theatre_num>=0)xf86DrvMsg(b->scrnIndex, X_INFO, "Detected Rage Theatre as device %d on VIP bus with id 0x%08x\n",t->theatre_num,t->theatre_id); + if(t->theatre_num>=0)xf86DrvMsg(b->scrnIndex, X_INFO, "Detected Rage Theatre as device %d on VIP bus with id 0x%08lx\n",t->theatre_num,t->theatre_id); if(t->theatre_num < 0) { @@ -111,7 +114,7 @@ TheatrePtr DetectTheatre(GENERIC_BUS_Ptr b) } RT_regr(VIP_VIP_REVISION_ID, &val); - xf86DrvMsg(b->scrnIndex, X_INFO, "Detected Rage Theatre revision %8.8X\n", val); + xf86DrvMsg(b->scrnIndex, X_INFO, "Detected Rage Theatre revision %8.8lX\n", val); #if 0 DumpRageTheatreRegsByName(t); diff --git a/src/theatre_detect.h b/src/theatre_detect.h index cf7bd1f..1628f20 100644 --- a/src/theatre_detect.h +++ b/src/theatre_detect.h @@ -1,5 +1,5 @@ /************************************************************************************* - * $Id: theatre_detect.h,v 1.2 2005/07/01 22:43:11 daniels Exp $ + * $Id$ * * Copyright (C) 2005 Bogdan D. bogdand@users.sourceforge.net * @@ -22,7 +22,10 @@ * otherwise to promote the sale, use or other dealings in this Software without prior written * authorization from the author. * - * $Log: theatre_detect.h,v $ + * $Log$ + * Revision 1.3 2005/08/28 18:00:23 bogdand + * Modified the licens type from GPL to a X/MIT one + * * Revision 1.2 2005/07/01 22:43:11 daniels * Change all misc.h and os.h references to <X11/foo.h>. * |