diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2007-11-24 20:08:20 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2007-11-24 20:08:20 +0000 |
commit | 6a3b94f3d640fd972b5ec8b244a66c92c5ebec20 (patch) | |
tree | ba3dd1c53b25c79ae7efbfa26a0dd8fd2cbea9ab /driver/xf86-video-intel/src | |
parent | 621df55ad49646572010dd46760717472a2cf8f4 (diff) |
merge xf86-video-intel 2.2.0
Diffstat (limited to 'driver/xf86-video-intel/src')
19 files changed, 7730 insertions, 16011 deletions
diff --git a/driver/xf86-video-intel/src/Makefile.in b/driver/xf86-video-intel/src/Makefile.in index 6eecbca41..01481d2da 100644 --- a/driver/xf86-video-intel/src/Makefile.in +++ b/driver/xf86-video-intel/src/Makefile.in @@ -56,12 +56,11 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -@DRI_TRUE@am__append_1 = \ -@DRI_TRUE@ i810_dri.c \ -@DRI_TRUE@ i810_dri.h \ -@DRI_TRUE@ i830_dri.c \ -@DRI_TRUE@ i810_hwmc.c \ -@DRI_TRUE@ i830_dri.h +@XMODES_TRUE@am__append_1 = \ +@XMODES_TRUE@ $(XMODE_SRCS) + +@DRI_TRUE@am__append_2 = \ +@DRI_TRUE@ $(INTEL_DRI_SRCS) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in @@ -78,27 +77,44 @@ am__vpath_adj = case $$p in \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(i810_drv_ladir)" -i810_drv_laLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(i810_drv_la_LTLIBRARIES) -i810_drv_la_LIBADD = -am__i810_drv_la_SOURCES_DIST = brw_defines.h brw_structs.h sf_prog.h \ - wm_prog.h common.h i810_accel.c i810_common.h i810_cursor.c \ - i810_dga.c i810_driver.c i810.h i810_io.c i810_memory.c \ - i810_reg.h i810_video.c i810_wmark.c i830_accel.c \ - i830_common.h i830_cursor.c i830_dga.c i830_driver.c i830.h \ - i830_io.c i830_memory.c i830_modes.c i830_video.c i830_video.h \ - i830_rotate.c i830_randr.c i830_3d.c i830_reg.h i915_3d.c \ - i915_3d.h i915_reg.h i915_video.c i810_dri.c i810_dri.h \ +am__installdirs = "$(DESTDIR)$(intel_drv_ladir)" +intel_drv_laLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(intel_drv_la_LTLIBRARIES) +intel_drv_la_LIBADD = +am__intel_drv_la_SOURCES_DIST = brw_defines.h brw_structs.h sf_prog.h \ + wm_prog.h common.h i2c_vid.h i810_accel.c i810_common.h \ + i810_cursor.c i810_dga.c i810_driver.c i810.h i810_io.c \ + i810_memory.c i810_reg.h i810_video.c i810_wmark.c i830_3d.c \ + i830_accel.c i830_bios.c i830_bios.h i830_common.h i830_crt.c \ + i830_cursor.c i830_debug.c i830_debug.h i830_display.c \ + i830_display.h i830_quirks.c i830_driver.c i830_dvo.c i830.h \ + i830_i2c.c i830_io.c i830_lvds.c i830_memory.c i830_modes.c \ + i830_video.c i830_video.h i830_reg.h i830_sdvo.c i830_sdvo.h \ + i830_sdvo_regs.h i830_tv.c i915_3d.c i915_3d.h i915_reg.h \ + i915_video.c i965_video.c i830_exa.c i830_xaa.c i830_render.c \ + i915_render.c i965_render.c local_xf86Rename.h \ + parser/xf86Parser.h parser/xf86Optrec.h modes/xf86Modes.h \ + modes/xf86Modes.c modes/xf86cvt.c modes/xf86Crtc.h \ + modes/xf86Crtc.c modes/xf86Cursors.c modes/xf86EdidModes.c \ + modes/xf86RandR12.c modes/xf86RandR12.h modes/xf86Rename.h \ + modes/xf86Rotate.c modes/xf86DiDGA.c i810_dri.c i810_dri.h \ i830_dri.c i810_hwmc.c i830_dri.h -@DRI_TRUE@am__objects_1 = i810_dri.lo i830_dri.lo i810_hwmc.lo -am_i810_drv_la_OBJECTS = i810_accel.lo i810_cursor.lo i810_dga.lo \ +am__objects_1 = xf86Modes.lo xf86cvt.lo xf86Crtc.lo xf86Cursors.lo \ + xf86EdidModes.lo xf86RandR12.lo xf86Rotate.lo xf86DiDGA.lo +@XMODES_TRUE@am__objects_2 = $(am__objects_1) +am__objects_3 = i810_dri.lo i830_dri.lo i810_hwmc.lo +@DRI_TRUE@am__objects_4 = $(am__objects_3) +am_intel_drv_la_OBJECTS = i810_accel.lo i810_cursor.lo i810_dga.lo \ i810_driver.lo i810_io.lo i810_memory.lo i810_video.lo \ - i810_wmark.lo i830_accel.lo i830_cursor.lo i830_dga.lo \ - i830_driver.lo i830_io.lo i830_memory.lo i830_modes.lo \ - i830_video.lo i830_rotate.lo i830_randr.lo i830_3d.lo \ - i915_3d.lo i915_video.lo $(am__objects_1) -i810_drv_la_OBJECTS = $(am_i810_drv_la_OBJECTS) + i810_wmark.lo i830_3d.lo i830_accel.lo i830_bios.lo \ + i830_crt.lo i830_cursor.lo i830_debug.lo i830_display.lo \ + i830_quirks.lo i830_driver.lo i830_dvo.lo i830_i2c.lo \ + i830_io.lo i830_lvds.lo i830_memory.lo i830_modes.lo \ + i830_video.lo i830_sdvo.lo i830_tv.lo i915_3d.lo i915_video.lo \ + i965_video.lo i830_exa.lo i830_xaa.lo i830_render.lo \ + i915_render.lo i965_render.lo $(am__objects_2) \ + $(am__objects_4) +intel_drv_la_OBJECTS = $(am_intel_drv_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -110,8 +126,8 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(i810_drv_la_SOURCES) -DIST_SOURCES = $(am__i810_drv_la_SOURCES_DIST) +SOURCES = $(intel_drv_la_SOURCES) +DIST_SOURCES = $(am__intel_drv_la_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ @@ -120,7 +136,8 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ uninstall-recursive ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) +DIST_SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 \ + reg_dumper DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ @@ -157,6 +174,8 @@ DRIVER_NAME = @DRIVER_NAME@ DRI_CFLAGS = @DRI_CFLAGS@ DRI_FALSE = @DRI_FALSE@ DRI_LIBS = @DRI_LIBS@ +DRI_MM_CFLAGS = @DRI_MM_CFLAGS@ +DRI_MM_LIBS = @DRI_MM_LIBS@ DRI_TRUE = @DRI_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ @@ -176,6 +195,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ +LIBPCIACCESS_FALSE = @LIBPCIACCESS_FALSE@ +LIBPCIACCESS_TRUE = @LIBPCIACCESS_TRUE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ @@ -201,6 +222,8 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PS2PDF = @PS2PDF@ RANLIB = @RANLIB@ @@ -210,8 +233,14 @@ STRIP = @STRIP@ VERSION = @VERSION@ VIDEO_DEBUG_FALSE = @VIDEO_DEBUG_FALSE@ VIDEO_DEBUG_TRUE = @VIDEO_DEBUG_TRUE@ +WARN_CFLAGS = @WARN_CFLAGS@ +XMODES_CFLAGS = @XMODES_CFLAGS@ +XMODES_FALSE = @XMODES_FALSE@ +XMODES_TRUE = @XMODES_TRUE@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ +XSERVER_LIBPCIACCESS_FALSE = @XSERVER_LIBPCIACCESS_FALSE@ +XSERVER_LIBPCIACCESS_TRUE = @XSERVER_LIBPCIACCESS_TRUE@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ @@ -258,27 +287,85 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -SUBDIRS = xvmc +@LIBPCIACCESS_TRUE@REGDUMPER = reg_dumper +SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER) + # this is obnoxious: # -module lets us name the module exactly how we want # -avoid-version prevents gratuitous .0.0.0 version numbers on the end # _ladir passes a dummy rpath to libtool so the thing will actually link # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. -AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ -DI830_XV -i810_drv_la_LTLIBRARIES = i810_drv.la -i810_drv_la_LDFLAGS = -module -avoid-version -i810_drv_ladir = @moduledir@/drivers -i810_drv_la_SOURCES = brw_defines.h brw_structs.h sf_prog.h wm_prog.h \ - common.h i810_accel.c i810_common.h i810_cursor.c i810_dga.c \ - i810_driver.c i810.h i810_io.c i810_memory.c i810_reg.h \ - i810_video.c i810_wmark.c i830_accel.c i830_common.h \ - i830_cursor.c i830_dga.c i830_driver.c i830.h i830_io.c \ - i830_memory.c i830_modes.c i830_video.c i830_video.h \ - i830_rotate.c i830_randr.c i830_3d.c i830_reg.h i915_3d.c \ - i915_3d.h i915_reg.h i915_video.c $(am__append_1) +AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ @XMODES_CFLAGS@ \ + -DI830_XV -DI830_USE_XAA -DI830_USE_EXA + +intel_drv_la_LTLIBRARIES = intel_drv.la +intel_drv_la_LDFLAGS = -module -avoid-version +intel_drv_ladir = @moduledir@/drivers +XMODE_SRCS = \ + local_xf86Rename.h \ + parser/xf86Parser.h \ + parser/xf86Optrec.h \ + modes/xf86Modes.h \ + modes/xf86Modes.c \ + modes/xf86cvt.c \ + modes/xf86Crtc.h \ + modes/xf86Crtc.c \ + modes/xf86Cursors.c \ + modes/xf86EdidModes.c \ + modes/xf86RandR12.c \ + modes/xf86RandR12.h \ + modes/xf86Rename.h \ + modes/xf86Rotate.c \ + modes/xf86DiDGA.c + +INTEL_DRI_SRCS = \ + i810_dri.c \ + i810_dri.h \ + i830_dri.c \ + i810_hwmc.c \ + i830_dri.h + +intel_drv_la_SOURCES = brw_defines.h brw_structs.h sf_prog.h wm_prog.h \ + common.h i2c_vid.h i810_accel.c i810_common.h i810_cursor.c \ + i810_dga.c i810_driver.c i810.h i810_io.c i810_memory.c \ + i810_reg.h i810_video.c i810_wmark.c i830_3d.c i830_accel.c \ + i830_bios.c i830_bios.h i830_common.h i830_crt.c i830_cursor.c \ + i830_debug.c i830_debug.h i830_display.c i830_display.h \ + i830_quirks.c i830_driver.c i830_dvo.c i830.h i830_i2c.c \ + i830_io.c i830_lvds.c i830_memory.c i830_modes.c i830_video.c \ + i830_video.h i830_reg.h i830_sdvo.c i830_sdvo.h \ + i830_sdvo_regs.h i830_tv.c i915_3d.c i915_3d.h i915_reg.h \ + i915_video.c i965_video.c i830_exa.c i830_xaa.c i830_render.c \ + i915_render.c i965_render.c $(am__append_1) $(am__append_2) +INTEL_G4A = \ + packed_yuv_sf.g4a \ + packed_yuv_wm.g4a \ + exa_sf.g4a \ + exa_sf_mask.g4a \ + exa_sf_rotation.g4a \ + exa_wm_maskca.g4a \ + exa_wm_maskca_srcalpha.g4a \ + exa_wm_masknoca.g4a \ + exa_wm_nomask.g4a \ + exa_wm_rotation.g4a + +INTEL_G4H = \ + sf_prog.h \ + wm_prog.h \ + exa_sf_mask_prog.h \ + exa_sf_prog.h \ + exa_sf_rotation_prog.h \ + exa_wm_maskca_prog.h \ + exa_wm_maskca_srcalpha_prog.h \ + exa_wm_masknoca_prog.h \ + exa_wm_nomask_prog.h \ + exa_wm_rotation_prog.h + EXTRA_DIST = \ - packed_yuv_sf.g4a \ - packed_yuv_wm.g4a + $(XMODE_SRCS) \ + $(INTEL_G4A) \ + $(INTEL_G4H) \ + $(INTEL_DRI_SRCS) all: all-recursive @@ -313,35 +400,35 @@ $(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-i810_drv_laLTLIBRARIES: $(i810_drv_la_LTLIBRARIES) +install-intel_drv_laLTLIBRARIES: $(intel_drv_la_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(i810_drv_ladir)" || $(mkdir_p) "$(DESTDIR)$(i810_drv_ladir)" - @list='$(i810_drv_la_LTLIBRARIES)'; for p in $$list; do \ + test -z "$(intel_drv_ladir)" || $(mkdir_p) "$(DESTDIR)$(intel_drv_ladir)" + @list='$(intel_drv_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(i810_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(i810_drv_ladir)/$$f'"; \ - $(LIBTOOL) --mode=install $(i810_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(i810_drv_ladir)/$$f"; \ + echo " $(LIBTOOL) --mode=install $(intel_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(intel_drv_ladir)/$$f'"; \ + $(LIBTOOL) --mode=install $(intel_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(intel_drv_ladir)/$$f"; \ else :; fi; \ done -uninstall-i810_drv_laLTLIBRARIES: +uninstall-intel_drv_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @set -x; list='$(i810_drv_la_LTLIBRARIES)'; for p in $$list; do \ + @set -x; list='$(intel_drv_la_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(i810_drv_ladir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(i810_drv_ladir)/$$p"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(intel_drv_ladir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(intel_drv_ladir)/$$p"; \ done -clean-i810_drv_laLTLIBRARIES: - -test -z "$(i810_drv_la_LTLIBRARIES)" || rm -f $(i810_drv_la_LTLIBRARIES) - @list='$(i810_drv_la_LTLIBRARIES)'; for p in $$list; do \ +clean-intel_drv_laLTLIBRARIES: + -test -z "$(intel_drv_la_LTLIBRARIES)" || rm -f $(intel_drv_la_LTLIBRARIES) + @list='$(intel_drv_la_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -i810_drv.la: $(i810_drv_la_OBJECTS) $(i810_drv_la_DEPENDENCIES) - $(LINK) -rpath $(i810_drv_ladir) $(i810_drv_la_LDFLAGS) $(i810_drv_la_OBJECTS) $(i810_drv_la_LIBADD) $(LIBS) +intel_drv.la: $(intel_drv_la_OBJECTS) $(intel_drv_la_DEPENDENCIES) + $(LINK) -rpath $(intel_drv_ladir) $(intel_drv_la_LDFLAGS) $(intel_drv_la_OBJECTS) $(intel_drv_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -361,18 +448,39 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i810_wmark.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_3d.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_accel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_bios.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_crt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_cursor.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_dga.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_debug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_display.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_dri.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_driver.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_dvo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_exa.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_i2c.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_io.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_lvds.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_memory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_modes.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_randr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_rotate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_quirks.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_render.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_sdvo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_tv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_video.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_xaa.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i915_3d.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i915_render.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i915_video.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i965_render.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i965_video.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Crtc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Cursors.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DiDGA.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86EdidModes.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Modes.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RandR12.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Rotate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86cvt.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @@ -395,6 +503,62 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +xf86Modes.lo: modes/xf86Modes.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xf86Modes.lo -MD -MP -MF "$(DEPDIR)/xf86Modes.Tpo" -c -o xf86Modes.lo `test -f 'modes/xf86Modes.c' || echo '$(srcdir)/'`modes/xf86Modes.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xf86Modes.Tpo" "$(DEPDIR)/xf86Modes.Plo"; else rm -f "$(DEPDIR)/xf86Modes.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modes/xf86Modes.c' object='xf86Modes.lo' libtool=yes @AMDEPBACKSLASH@ +@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) $(AM_CFLAGS) $(CFLAGS) -c -o xf86Modes.lo `test -f 'modes/xf86Modes.c' || echo '$(srcdir)/'`modes/xf86Modes.c + +xf86cvt.lo: modes/xf86cvt.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xf86cvt.lo -MD -MP -MF "$(DEPDIR)/xf86cvt.Tpo" -c -o xf86cvt.lo `test -f 'modes/xf86cvt.c' || echo '$(srcdir)/'`modes/xf86cvt.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xf86cvt.Tpo" "$(DEPDIR)/xf86cvt.Plo"; else rm -f "$(DEPDIR)/xf86cvt.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modes/xf86cvt.c' object='xf86cvt.lo' libtool=yes @AMDEPBACKSLASH@ +@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) $(AM_CFLAGS) $(CFLAGS) -c -o xf86cvt.lo `test -f 'modes/xf86cvt.c' || echo '$(srcdir)/'`modes/xf86cvt.c + +xf86Crtc.lo: modes/xf86Crtc.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xf86Crtc.lo -MD -MP -MF "$(DEPDIR)/xf86Crtc.Tpo" -c -o xf86Crtc.lo `test -f 'modes/xf86Crtc.c' || echo '$(srcdir)/'`modes/xf86Crtc.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xf86Crtc.Tpo" "$(DEPDIR)/xf86Crtc.Plo"; else rm -f "$(DEPDIR)/xf86Crtc.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modes/xf86Crtc.c' object='xf86Crtc.lo' libtool=yes @AMDEPBACKSLASH@ +@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) $(AM_CFLAGS) $(CFLAGS) -c -o xf86Crtc.lo `test -f 'modes/xf86Crtc.c' || echo '$(srcdir)/'`modes/xf86Crtc.c + +xf86Cursors.lo: modes/xf86Cursors.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xf86Cursors.lo -MD -MP -MF "$(DEPDIR)/xf86Cursors.Tpo" -c -o xf86Cursors.lo `test -f 'modes/xf86Cursors.c' || echo '$(srcdir)/'`modes/xf86Cursors.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xf86Cursors.Tpo" "$(DEPDIR)/xf86Cursors.Plo"; else rm -f "$(DEPDIR)/xf86Cursors.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modes/xf86Cursors.c' object='xf86Cursors.lo' libtool=yes @AMDEPBACKSLASH@ +@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) $(AM_CFLAGS) $(CFLAGS) -c -o xf86Cursors.lo `test -f 'modes/xf86Cursors.c' || echo '$(srcdir)/'`modes/xf86Cursors.c + +xf86EdidModes.lo: modes/xf86EdidModes.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xf86EdidModes.lo -MD -MP -MF "$(DEPDIR)/xf86EdidModes.Tpo" -c -o xf86EdidModes.lo `test -f 'modes/xf86EdidModes.c' || echo '$(srcdir)/'`modes/xf86EdidModes.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xf86EdidModes.Tpo" "$(DEPDIR)/xf86EdidModes.Plo"; else rm -f "$(DEPDIR)/xf86EdidModes.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modes/xf86EdidModes.c' object='xf86EdidModes.lo' libtool=yes @AMDEPBACKSLASH@ +@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) $(AM_CFLAGS) $(CFLAGS) -c -o xf86EdidModes.lo `test -f 'modes/xf86EdidModes.c' || echo '$(srcdir)/'`modes/xf86EdidModes.c + +xf86RandR12.lo: modes/xf86RandR12.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xf86RandR12.lo -MD -MP -MF "$(DEPDIR)/xf86RandR12.Tpo" -c -o xf86RandR12.lo `test -f 'modes/xf86RandR12.c' || echo '$(srcdir)/'`modes/xf86RandR12.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xf86RandR12.Tpo" "$(DEPDIR)/xf86RandR12.Plo"; else rm -f "$(DEPDIR)/xf86RandR12.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modes/xf86RandR12.c' object='xf86RandR12.lo' libtool=yes @AMDEPBACKSLASH@ +@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) $(AM_CFLAGS) $(CFLAGS) -c -o xf86RandR12.lo `test -f 'modes/xf86RandR12.c' || echo '$(srcdir)/'`modes/xf86RandR12.c + +xf86Rotate.lo: modes/xf86Rotate.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xf86Rotate.lo -MD -MP -MF "$(DEPDIR)/xf86Rotate.Tpo" -c -o xf86Rotate.lo `test -f 'modes/xf86Rotate.c' || echo '$(srcdir)/'`modes/xf86Rotate.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xf86Rotate.Tpo" "$(DEPDIR)/xf86Rotate.Plo"; else rm -f "$(DEPDIR)/xf86Rotate.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modes/xf86Rotate.c' object='xf86Rotate.lo' libtool=yes @AMDEPBACKSLASH@ +@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) $(AM_CFLAGS) $(CFLAGS) -c -o xf86Rotate.lo `test -f 'modes/xf86Rotate.c' || echo '$(srcdir)/'`modes/xf86Rotate.c + +xf86DiDGA.lo: modes/xf86DiDGA.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xf86DiDGA.lo -MD -MP -MF "$(DEPDIR)/xf86DiDGA.Tpo" -c -o xf86DiDGA.lo `test -f 'modes/xf86DiDGA.c' || echo '$(srcdir)/'`modes/xf86DiDGA.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xf86DiDGA.Tpo" "$(DEPDIR)/xf86DiDGA.Plo"; else rm -f "$(DEPDIR)/xf86DiDGA.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modes/xf86DiDGA.c' object='xf86DiDGA.lo' libtool=yes @AMDEPBACKSLASH@ +@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) $(AM_CFLAGS) $(CFLAGS) -c -o xf86DiDGA.lo `test -f 'modes/xf86DiDGA.c' || echo '$(srcdir)/'`modes/xf86DiDGA.c + mostlyclean-libtool: -rm -f *.lo @@ -538,6 +702,7 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/modes $(distdir)/parser @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ @@ -584,7 +749,7 @@ check: check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(i810_drv_ladir)"; do \ + for dir in "$(DESTDIR)$(intel_drv_ladir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive @@ -613,7 +778,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive -clean-am: clean-generic clean-i810_drv_laLTLIBRARIES clean-libtool \ +clean-am: clean-generic clean-intel_drv_laLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-recursive @@ -632,7 +797,7 @@ info: info-recursive info-am: -install-data-am: install-i810_drv_laLTLIBRARIES +install-data-am: install-data-local install-intel_drv_laLTLIBRARIES install-exec-am: @@ -660,31 +825,64 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-i810_drv_laLTLIBRARIES uninstall-info-am +uninstall-am: uninstall-info-am uninstall-intel_drv_laLTLIBRARIES \ + uninstall-local uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-generic clean-i810_drv_laLTLIBRARIES clean-libtool \ - clean-recursive ctags ctags-recursive distclean \ + clean clean-generic clean-intel_drv_laLTLIBRARIES \ + clean-libtool clean-recursive ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-recursive distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am \ - install-i810_drv_laLTLIBRARIES install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am \ - uninstall-i810_drv_laLTLIBRARIES uninstall-info-am + install-data-am install-data-local install-exec \ + install-exec-am install-info install-info-am \ + install-intel_drv_laLTLIBRARIES install-man install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-info-am uninstall-intel_drv_laLTLIBRARIES \ + uninstall-local @HAVE_GEN4ASM_TRUE@sf_prog.h: packed_yuv_sf.g4a @HAVE_GEN4ASM_TRUE@ intel-gen4asm -o sf_prog.h packed_yuv_sf.g4a + @HAVE_GEN4ASM_TRUE@wm_prog.h: packed_yuv_wm.g4a @HAVE_GEN4ASM_TRUE@ intel-gen4asm -o wm_prog.h packed_yuv_wm.g4a + +@HAVE_GEN4ASM_TRUE@exa_sf_mask_prog.h: exa_sf_mask.g4a +@HAVE_GEN4ASM_TRUE@ intel-gen4asm -o exa_sf_mask_prog.h exa_sf_mask.g4a + +@HAVE_GEN4ASM_TRUE@exa_sf_prog.h: exa_sf.g4a +@HAVE_GEN4ASM_TRUE@ intel-gen4asm -o exa_sf_prog.h exa_sf.g4a + +@HAVE_GEN4ASM_TRUE@exa_sf_rotation_prog.h: exa_sf_rotation.g4a +@HAVE_GEN4ASM_TRUE@ intel-gen4asm -o exa_sf_rotation_prog.h exa_sf_rotation.g4a + +@HAVE_GEN4ASM_TRUE@exa_wm_maskca_prog.h: exa_wm_maskca.g4a +@HAVE_GEN4ASM_TRUE@ intel-gen4asm -o exa_wm_maskca_prog.h exa_wm_maskca.g4a + +@HAVE_GEN4ASM_TRUE@exa_wm_maskca_srcalpha_prog.h: exa_wm_maskca_srcalpha.g4a +@HAVE_GEN4ASM_TRUE@ intel-gen4asm -o exa_wm_maskca_srcalpha_prog.h exa_wm_maskca_srcalpha.g4a + +@HAVE_GEN4ASM_TRUE@exa_wm_masknoca_prog.h: exa_wm_masknoca.g4a +@HAVE_GEN4ASM_TRUE@ intel-gen4asm -o exa_wm_masknoca_prog.h exa_wm_masknoca.g4a + +@HAVE_GEN4ASM_TRUE@exa_wm_nomask_prog.h: exa_wm_nomask.g4a +@HAVE_GEN4ASM_TRUE@ intel-gen4asm -o exa_wm_nomask_prog.h exa_wm_nomask.g4a + +@HAVE_GEN4ASM_TRUE@exa_wm_rotation_prog.h: exa_wm_rotation.g4a +@HAVE_GEN4ASM_TRUE@ intel-gen4asm -o exa_wm_rotation_prog.h exa_wm_rotation.g4a + +install-data-local: install-intel_drv_laLTLIBRARIES + (cd $(DESTDIR)$(intel_drv_ladir) && rm -f i810_drv.so && ln -s intel_drv.so i810_drv.so) + +uninstall-local: + (cd $(DESTDIR)$(intel_drv_ladir) && rm -f i810_drv.so) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/driver/xf86-video-intel/src/bios_reader/Makefile.in b/driver/xf86-video-intel/src/bios_reader/Makefile.in index 32beb0b5c..e3cfc81f9 100644 --- a/driver/xf86-video-intel/src/bios_reader/Makefile.in +++ b/driver/xf86-video-intel/src/bios_reader/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 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. @@ -14,11 +14,15 @@ @SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ VPATH = @srcdir@ 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 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -39,7 +43,7 @@ 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 +mkinstalldirs = $(SHELL) $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @LIBPCIACCESS_TRUE@am__EXEEXT_1 = bios_dumper$(EXEEXT) @@ -50,24 +54,20 @@ am__bios_dumper_SOURCES_DIST = bios_dumper.c bios_dumper_OBJECTS = $(am_bios_dumper_OBJECTS) am__DEPENDENCIES_1 = @LIBPCIACCESS_TRUE@bios_dumper_DEPENDENCIES = $(am__DEPENDENCIES_1) -bios_dumper_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(bios_dumper_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ bios_reader_SOURCES = bios_reader.c bios_reader_OBJECTS = bios_reader.$(OBJEXT) bios_reader_LDADD = $(LDADD) -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(bios_dumper_SOURCES) bios_reader.c DIST_SOURCES = $(am__bios_dumper_SOURCES_DIST) bios_reader.c ETAGS = etags @@ -76,6 +76,8 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ @@ -84,6 +86,10 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BUILD_LINUXDOC_FALSE = @BUILD_LINUXDOC_FALSE@ +BUILD_LINUXDOC_TRUE = @BUILD_LINUXDOC_TRUE@ +BUILD_PDFDOC_FALSE = @BUILD_PDFDOC_FALSE@ +BUILD_PDFDOC_TRUE = @BUILD_PDFDOC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -100,9 +106,11 @@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRIVER_NAME = @DRIVER_NAME@ DRI_CFLAGS = @DRI_CFLAGS@ +DRI_FALSE = @DRI_FALSE@ DRI_LIBS = @DRI_LIBS@ DRI_MM_CFLAGS = @DRI_MM_CFLAGS@ DRI_MM_LIBS = @DRI_MM_LIBS@ +DRI_TRUE = @DRI_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -113,14 +121,16 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -GREP = @GREP@ -INSTALL = @INSTALL@ +HAVE_GEN4ASM_FALSE = @HAVE_GEN4ASM_FALSE@ +HAVE_GEN4ASM_TRUE = @HAVE_GEN4ASM_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ +LIBPCIACCESS_FALSE = @LIBPCIACCESS_FALSE@ +LIBPCIACCESS_TRUE = @LIBPCIACCESS_TRUE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ @@ -129,6 +139,8 @@ LINUXDOC = @LINUXDOC@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MAKE_HTML = @MAKE_HTML@ MAKE_PDF = @MAKE_PDF@ @@ -136,7 +148,6 @@ MAKE_PS = @MAKE_PS@ MAKE_TEXT = @MAKE_TEXT@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ -MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -150,22 +161,31 @@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PS2PDF = @PS2PDF@ RANLIB = @RANLIB@ -SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +VIDEO_DEBUG_FALSE = @VIDEO_DEBUG_FALSE@ +VIDEO_DEBUG_TRUE = @VIDEO_DEBUG_TRUE@ WARN_CFLAGS = @WARN_CFLAGS@ XMODES_CFLAGS = @XMODES_CFLAGS@ +XMODES_FALSE = @XMODES_FALSE@ +XMODES_TRUE = @XMODES_TRUE@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ +XSERVER_LIBPCIACCESS_FALSE = @XSERVER_LIBPCIACCESS_FALSE@ +XSERVER_LIBPCIACCESS_TRUE = @XSERVER_LIBPCIACCESS_TRUE@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -177,11 +197,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -builddir = @builddir@ datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ exec_prefix = @exec_prefix@ gen4asm = @gen4asm@ host = @host@ @@ -189,29 +205,22 @@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ -htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ -localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ -psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @XMODES_CFLAGS@ @LIBPCIACCESS_TRUE@BIOS_DUMPER = bios_dumper @LIBPCIACCESS_TRUE@bios_dumper_SOURCES = bios_dumper.c @@ -259,10 +268,10 @@ clean-noinstPROGRAMS: done bios_dumper$(EXEEXT): $(bios_dumper_OBJECTS) $(bios_dumper_DEPENDENCIES) @rm -f bios_dumper$(EXEEXT) - $(bios_dumper_LINK) $(bios_dumper_OBJECTS) $(bios_dumper_LDADD) $(LIBS) + $(LINK) $(bios_dumper_LDFLAGS) $(bios_dumper_OBJECTS) $(bios_dumper_LDADD) $(LIBS) bios_reader$(EXEEXT): $(bios_reader_OBJECTS) $(bios_reader_DEPENDENCIES) @rm -f bios_reader$(EXEEXT) - $(LINK) $(bios_reader_OBJECTS) $(bios_reader_LDADD) $(LIBS) + $(LINK) $(bios_reader_LDFLAGS) $(bios_reader_OBJECTS) $(bios_reader_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -274,36 +283,36 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bios_reader.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< bios_dumper-bios_dumper.o: bios_dumper.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bios_dumper_CFLAGS) $(CFLAGS) -MT bios_dumper-bios_dumper.o -MD -MP -MF $(DEPDIR)/bios_dumper-bios_dumper.Tpo -c -o bios_dumper-bios_dumper.o `test -f 'bios_dumper.c' || echo '$(srcdir)/'`bios_dumper.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bios_dumper-bios_dumper.Tpo $(DEPDIR)/bios_dumper-bios_dumper.Po +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bios_dumper_CFLAGS) $(CFLAGS) -MT bios_dumper-bios_dumper.o -MD -MP -MF "$(DEPDIR)/bios_dumper-bios_dumper.Tpo" -c -o bios_dumper-bios_dumper.o `test -f 'bios_dumper.c' || echo '$(srcdir)/'`bios_dumper.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/bios_dumper-bios_dumper.Tpo" "$(DEPDIR)/bios_dumper-bios_dumper.Po"; else rm -f "$(DEPDIR)/bios_dumper-bios_dumper.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios_dumper.c' object='bios_dumper-bios_dumper.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bios_dumper_CFLAGS) $(CFLAGS) -c -o bios_dumper-bios_dumper.o `test -f 'bios_dumper.c' || echo '$(srcdir)/'`bios_dumper.c bios_dumper-bios_dumper.obj: bios_dumper.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bios_dumper_CFLAGS) $(CFLAGS) -MT bios_dumper-bios_dumper.obj -MD -MP -MF $(DEPDIR)/bios_dumper-bios_dumper.Tpo -c -o bios_dumper-bios_dumper.obj `if test -f 'bios_dumper.c'; then $(CYGPATH_W) 'bios_dumper.c'; else $(CYGPATH_W) '$(srcdir)/bios_dumper.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bios_dumper-bios_dumper.Tpo $(DEPDIR)/bios_dumper-bios_dumper.Po +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bios_dumper_CFLAGS) $(CFLAGS) -MT bios_dumper-bios_dumper.obj -MD -MP -MF "$(DEPDIR)/bios_dumper-bios_dumper.Tpo" -c -o bios_dumper-bios_dumper.obj `if test -f 'bios_dumper.c'; then $(CYGPATH_W) 'bios_dumper.c'; else $(CYGPATH_W) '$(srcdir)/bios_dumper.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/bios_dumper-bios_dumper.Tpo" "$(DEPDIR)/bios_dumper-bios_dumper.Po"; else rm -f "$(DEPDIR)/bios_dumper-bios_dumper.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bios_dumper.c' object='bios_dumper-bios_dumper.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bios_dumper_CFLAGS) $(CFLAGS) -c -o bios_dumper-bios_dumper.obj `if test -f 'bios_dumper.c'; then $(CYGPATH_W) 'bios_dumper.c'; else $(CYGPATH_W) '$(srcdir)/bios_dumper.c'; fi` @@ -314,6 +323,10 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +distclean-libtool: + -rm -f libtool +uninstall-info-am: + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -363,21 +376,22 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -425,7 +439,7 @@ distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-libtool distclean-tags dvi: dvi-am @@ -439,20 +453,12 @@ info-am: install-data-am: -install-dvi: install-dvi-am - install-exec-am: -install-html: install-html-am - install-info: install-info-am install-man: -install-pdf: install-pdf-am - -install-ps: install-ps-am - installcheck-am: maintainer-clean: maintainer-clean-am @@ -473,22 +479,19 @@ ps: ps-am ps-am: -uninstall-am: - -.MAKE: install-am install-strip +uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/driver/xf86-video-intel/src/ch7017/Makefile.in b/driver/xf86-video-intel/src/ch7017/Makefile.in index 243aca457..f4dd6edd4 100644 --- a/driver/xf86-video-intel/src/ch7017/Makefile.in +++ b/driver/xf86-video-intel/src/ch7017/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 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. @@ -14,11 +14,15 @@ @SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ VPATH = @srcdir@ 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 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -38,7 +42,7 @@ 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 +mkinstalldirs = $(SHELL) $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -53,21 +57,17 @@ LTLIBRARIES = $(ch7017_la_LTLIBRARIES) ch7017_la_LIBADD = am_ch7017_la_OBJECTS = ch7017.lo ch7017_module.lo ch7017_la_OBJECTS = $(am_ch7017_la_OBJECTS) -ch7017_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(ch7017_la_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(ch7017_la_SOURCES) DIST_SOURCES = $(ch7017_la_SOURCES) ETAGS = etags @@ -76,6 +76,8 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ @@ -84,6 +86,10 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BUILD_LINUXDOC_FALSE = @BUILD_LINUXDOC_FALSE@ +BUILD_LINUXDOC_TRUE = @BUILD_LINUXDOC_TRUE@ +BUILD_PDFDOC_FALSE = @BUILD_PDFDOC_FALSE@ +BUILD_PDFDOC_TRUE = @BUILD_PDFDOC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -100,9 +106,11 @@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRIVER_NAME = @DRIVER_NAME@ DRI_CFLAGS = @DRI_CFLAGS@ +DRI_FALSE = @DRI_FALSE@ DRI_LIBS = @DRI_LIBS@ DRI_MM_CFLAGS = @DRI_MM_CFLAGS@ DRI_MM_LIBS = @DRI_MM_LIBS@ +DRI_TRUE = @DRI_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -113,14 +121,16 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -GREP = @GREP@ -INSTALL = @INSTALL@ +HAVE_GEN4ASM_FALSE = @HAVE_GEN4ASM_FALSE@ +HAVE_GEN4ASM_TRUE = @HAVE_GEN4ASM_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ +LIBPCIACCESS_FALSE = @LIBPCIACCESS_FALSE@ +LIBPCIACCESS_TRUE = @LIBPCIACCESS_TRUE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ @@ -129,6 +139,8 @@ LINUXDOC = @LINUXDOC@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MAKE_HTML = @MAKE_HTML@ MAKE_PDF = @MAKE_PDF@ @@ -136,7 +148,6 @@ MAKE_PS = @MAKE_PS@ MAKE_TEXT = @MAKE_TEXT@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ -MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -150,22 +161,31 @@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PS2PDF = @PS2PDF@ RANLIB = @RANLIB@ -SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +VIDEO_DEBUG_FALSE = @VIDEO_DEBUG_FALSE@ +VIDEO_DEBUG_TRUE = @VIDEO_DEBUG_TRUE@ WARN_CFLAGS = @WARN_CFLAGS@ XMODES_CFLAGS = @XMODES_CFLAGS@ +XMODES_FALSE = @XMODES_FALSE@ +XMODES_TRUE = @XMODES_TRUE@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ +XSERVER_LIBPCIACCESS_FALSE = @XSERVER_LIBPCIACCESS_FALSE@ +XSERVER_LIBPCIACCESS_TRUE = @XSERVER_LIBPCIACCESS_TRUE@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -177,11 +197,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -builddir = @builddir@ datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ exec_prefix = @exec_prefix@ gen4asm = @gen4asm@ host = @host@ @@ -189,29 +205,22 @@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ -htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ -localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ -psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ # this is obnoxious: # -module lets us name the module exactly how we want @@ -262,7 +271,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-ch7017_laLTLIBRARIES: $(ch7017_la_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(ch7017_ladir)" || $(MKDIR_P) "$(DESTDIR)$(ch7017_ladir)" + test -z "$(ch7017_ladir)" || $(mkdir_p) "$(DESTDIR)$(ch7017_ladir)" @list='$(ch7017_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ @@ -273,7 +282,7 @@ install-ch7017_laLTLIBRARIES: $(ch7017_la_LTLIBRARIES) uninstall-ch7017_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(ch7017_la_LTLIBRARIES)'; for p in $$list; do \ + @set -x; list='$(ch7017_la_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(ch7017_ladir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(ch7017_ladir)/$$p"; \ @@ -288,7 +297,7 @@ clean-ch7017_laLTLIBRARIES: rm -f "$${dir}/so_locations"; \ done ch7017.la: $(ch7017_la_OBJECTS) $(ch7017_la_DEPENDENCIES) - $(ch7017_la_LINK) -rpath $(ch7017_ladir) $(ch7017_la_OBJECTS) $(ch7017_la_LIBADD) $(LIBS) + $(LINK) -rpath $(ch7017_ladir) $(ch7017_la_LDFLAGS) $(ch7017_la_OBJECTS) $(ch7017_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -300,22 +309,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ch7017_module.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< @@ -326,6 +335,10 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +distclean-libtool: + -rm -f libtool +uninstall-info-am: + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -375,21 +388,22 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -405,7 +419,7 @@ check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(ch7017_ladir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -440,7 +454,7 @@ distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-libtool distclean-tags dvi: dvi-am @@ -454,20 +468,12 @@ info-am: install-data-am: install-ch7017_laLTLIBRARIES -install-dvi: install-dvi-am - install-exec-am: -install-html: install-html-am - install-info: install-info-am install-man: -install-pdf: install-pdf-am - -install-ps: install-ps-am - installcheck-am: maintainer-clean: maintainer-clean-am @@ -488,9 +494,7 @@ ps: ps-am ps-am: -uninstall-am: uninstall-ch7017_laLTLIBRARIES - -.MAKE: install-am install-strip +uninstall-am: uninstall-ch7017_laLTLIBRARIES uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean \ clean-ch7017_laLTLIBRARIES clean-generic clean-libtool ctags \ @@ -498,14 +502,12 @@ uninstall-am: uninstall-ch7017_laLTLIBRARIES distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am \ install-ch7017_laLTLIBRARIES install-data install-data-am \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-ch7017_laLTLIBRARIES + uninstall-am uninstall-ch7017_laLTLIBRARIES uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/driver/xf86-video-intel/src/ch7xxx/Makefile.in b/driver/xf86-video-intel/src/ch7xxx/Makefile.in index eccc3e6af..14f4d690d 100644 --- a/driver/xf86-video-intel/src/ch7xxx/Makefile.in +++ b/driver/xf86-video-intel/src/ch7xxx/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 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. @@ -14,11 +14,15 @@ @SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ VPATH = @srcdir@ 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 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -38,7 +42,7 @@ 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 +mkinstalldirs = $(SHELL) $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -53,21 +57,17 @@ LTLIBRARIES = $(ch7xxx_la_LTLIBRARIES) ch7xxx_la_LIBADD = am_ch7xxx_la_OBJECTS = ch7xxx.lo ch7xxx_module.lo ch7xxx_la_OBJECTS = $(am_ch7xxx_la_OBJECTS) -ch7xxx_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(ch7xxx_la_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(ch7xxx_la_SOURCES) DIST_SOURCES = $(ch7xxx_la_SOURCES) ETAGS = etags @@ -76,6 +76,8 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ @@ -84,6 +86,10 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BUILD_LINUXDOC_FALSE = @BUILD_LINUXDOC_FALSE@ +BUILD_LINUXDOC_TRUE = @BUILD_LINUXDOC_TRUE@ +BUILD_PDFDOC_FALSE = @BUILD_PDFDOC_FALSE@ +BUILD_PDFDOC_TRUE = @BUILD_PDFDOC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -100,9 +106,11 @@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRIVER_NAME = @DRIVER_NAME@ DRI_CFLAGS = @DRI_CFLAGS@ +DRI_FALSE = @DRI_FALSE@ DRI_LIBS = @DRI_LIBS@ DRI_MM_CFLAGS = @DRI_MM_CFLAGS@ DRI_MM_LIBS = @DRI_MM_LIBS@ +DRI_TRUE = @DRI_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -113,14 +121,16 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -GREP = @GREP@ -INSTALL = @INSTALL@ +HAVE_GEN4ASM_FALSE = @HAVE_GEN4ASM_FALSE@ +HAVE_GEN4ASM_TRUE = @HAVE_GEN4ASM_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ +LIBPCIACCESS_FALSE = @LIBPCIACCESS_FALSE@ +LIBPCIACCESS_TRUE = @LIBPCIACCESS_TRUE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ @@ -129,6 +139,8 @@ LINUXDOC = @LINUXDOC@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MAKE_HTML = @MAKE_HTML@ MAKE_PDF = @MAKE_PDF@ @@ -136,7 +148,6 @@ MAKE_PS = @MAKE_PS@ MAKE_TEXT = @MAKE_TEXT@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ -MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -150,22 +161,31 @@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PS2PDF = @PS2PDF@ RANLIB = @RANLIB@ -SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +VIDEO_DEBUG_FALSE = @VIDEO_DEBUG_FALSE@ +VIDEO_DEBUG_TRUE = @VIDEO_DEBUG_TRUE@ WARN_CFLAGS = @WARN_CFLAGS@ XMODES_CFLAGS = @XMODES_CFLAGS@ +XMODES_FALSE = @XMODES_FALSE@ +XMODES_TRUE = @XMODES_TRUE@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ +XSERVER_LIBPCIACCESS_FALSE = @XSERVER_LIBPCIACCESS_FALSE@ +XSERVER_LIBPCIACCESS_TRUE = @XSERVER_LIBPCIACCESS_TRUE@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -177,11 +197,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -builddir = @builddir@ datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ exec_prefix = @exec_prefix@ gen4asm = @gen4asm@ host = @host@ @@ -189,29 +205,22 @@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ -htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ -localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ -psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ # this is obnoxious: # -module lets us name the module exactly how we want @@ -263,7 +272,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-ch7xxx_laLTLIBRARIES: $(ch7xxx_la_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(ch7xxx_ladir)" || $(MKDIR_P) "$(DESTDIR)$(ch7xxx_ladir)" + test -z "$(ch7xxx_ladir)" || $(mkdir_p) "$(DESTDIR)$(ch7xxx_ladir)" @list='$(ch7xxx_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ @@ -274,7 +283,7 @@ install-ch7xxx_laLTLIBRARIES: $(ch7xxx_la_LTLIBRARIES) uninstall-ch7xxx_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(ch7xxx_la_LTLIBRARIES)'; for p in $$list; do \ + @set -x; list='$(ch7xxx_la_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(ch7xxx_ladir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(ch7xxx_ladir)/$$p"; \ @@ -289,7 +298,7 @@ clean-ch7xxx_laLTLIBRARIES: rm -f "$${dir}/so_locations"; \ done ch7xxx.la: $(ch7xxx_la_OBJECTS) $(ch7xxx_la_DEPENDENCIES) - $(ch7xxx_la_LINK) -rpath $(ch7xxx_ladir) $(ch7xxx_la_OBJECTS) $(ch7xxx_la_LIBADD) $(LIBS) + $(LINK) -rpath $(ch7xxx_ladir) $(ch7xxx_la_LDFLAGS) $(ch7xxx_la_OBJECTS) $(ch7xxx_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -301,22 +310,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ch7xxx_module.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< @@ -327,6 +336,10 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +distclean-libtool: + -rm -f libtool +uninstall-info-am: + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -376,21 +389,22 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -406,7 +420,7 @@ check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(ch7xxx_ladir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -441,7 +455,7 @@ distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-libtool distclean-tags dvi: dvi-am @@ -455,20 +469,12 @@ info-am: install-data-am: install-ch7xxx_laLTLIBRARIES -install-dvi: install-dvi-am - install-exec-am: -install-html: install-html-am - install-info: install-info-am install-man: -install-pdf: install-pdf-am - -install-ps: install-ps-am - installcheck-am: maintainer-clean: maintainer-clean-am @@ -489,9 +495,7 @@ ps: ps-am ps-am: -uninstall-am: uninstall-ch7xxx_laLTLIBRARIES - -.MAKE: install-am install-strip +uninstall-am: uninstall-ch7xxx_laLTLIBRARIES uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean \ clean-ch7xxx_laLTLIBRARIES clean-generic clean-libtool ctags \ @@ -499,14 +503,12 @@ uninstall-am: uninstall-ch7xxx_laLTLIBRARIES distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am \ install-ch7xxx_laLTLIBRARIES install-data install-data-am \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-ch7xxx_laLTLIBRARIES + uninstall-am uninstall-ch7xxx_laLTLIBRARIES uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/driver/xf86-video-intel/src/common.h b/driver/xf86-video-intel/src/common.h index 14c90134c..40ea038ee 100644 --- a/driver/xf86-video-intel/src/common.h +++ b/driver/xf86-video-intel/src/common.h @@ -72,11 +72,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define DELAY(x) do {;} while (0) #endif +#ifndef REG_DUMPER /* I830 hooks for the I810 driver setup/probe. */ -extern const OptionInfoRec *I830BIOSAvailableOptions(int chipid, int busid); +extern const OptionInfoRec *I830AvailableOptions(int chipid, int busid); extern void I830InitpScrn(ScrnInfoPtr pScrn); /* Symbol lists shared by the i810 and i830 parts. */ +extern int I830EntityIndex; extern const char *I810vgahwSymbols[]; extern const char *I810ramdacSymbols[]; extern const char *I810int10Symbols[]; @@ -85,17 +87,17 @@ extern const char *I810ddcSymbols[]; extern const char *I810fbSymbols[]; extern const char *I810xaaSymbols[]; extern const char *I810shadowFBSymbols[]; -extern const char *I810shadowSymbols[]; #ifdef XF86DRI extern const char *I810driSymbols[]; extern const char *I810drmSymbols[]; #endif +extern const char *I810i2cSymbols[]; extern void I830DPRINTF_stub(const char *filename, int line, const char *function, const char *fmt, ...); #ifdef _I830_H_ -#define PrintErrorState I830PrintErrorState +#define PrintErrorState i830_dump_error_state #define WaitRingFunc I830WaitLpRing #define RecPtr pI830 #else @@ -106,8 +108,8 @@ extern void I830DPRINTF_stub(const char *filename, int line, /* BIOS debug macro */ #define xf86ExecX86int10_wrapper(pInt, pScrn) do { \ + ErrorF("Executing (ax == 0x%x) BIOS call at %s:%d\n", pInt->ax, __FILE__, __LINE__); \ if (I810_DEBUG & DEBUG_VERBOSE_BIOS) { \ - ErrorF("\n\n\n\nExecuting (ax == 0x%x) BIOS call\n", pInt->ax); \ ErrorF("Checking Error state before execution\n"); \ PrintErrorState(pScrn); \ } \ @@ -128,6 +130,54 @@ extern void I830DPRINTF_stub(const char *filename, int line, outring &= ringmask; \ } while (0) +static inline void memset_volatile(volatile void *b, int c, size_t len) +{ + int i; + + for (i = 0; i < len; i++) + ((volatile char *)b)[i] = c; +} + +static inline void memcpy_volatile(volatile void *dst, const void *src, + size_t len) +{ + int i; + + for (i = 0; i < len; i++) + ((volatile char *)dst)[i] = ((volatile char *)src)[i]; +} + +/** Copies a given number of bytes to the ring */ +#define OUT_RING_COPY(n, ptr) do { \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF("OUT_RING_DATA %d bytes\n", n); \ + memcpy_volatile(virt + outring, ptr, n); \ + outring += n; \ + ringused += n; \ + outring &= ringmask; \ +} while (0) + +/** Pads the ring with a given number of zero bytes */ +#define OUT_RING_PAD(n) do { \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF("OUT_RING_PAD %d bytes\n", n); \ + memset_volatile(virt + outring, 0, n); \ + outring += n; \ + ringused += n; \ + outring &= ringmask; \ +} while (0) + +union intfloat { + float f; + unsigned int ui; +}; + +#define OUT_RING_F(x) do { \ + union intfloat tmp; \ + tmp.f = (float)(x); \ + OUT_RING(tmp.ui); \ +} while(0) + #define ADVANCE_LP_RING() do { \ if (ringused > needed) \ FatalError("%s: ADVANCE_LP_RING: exceeded allocation %d/%d\n ", \ @@ -183,6 +233,8 @@ extern void I830DPRINTF_stub(const char *filename, int line, #define INREG8(addr) *(volatile CARD8 *)(RecPtr->MMIOBase + (addr)) #define INREG16(addr) *(volatile CARD16 *)(RecPtr->MMIOBase + (addr)) #define INREG(addr) *(volatile CARD32 *)(RecPtr->MMIOBase + (addr)) +#define INGTT(addr) *(volatile CARD32 *)(RecPtr->GTTBase + (addr)) +#define POSTING_READ(addr) (void)INREG(addr) #define OUTREG8(addr, val) do { \ *(volatile CARD8 *)(RecPtr->MMIOBase + (addr)) = (val); \ @@ -229,6 +281,7 @@ extern int I810_DEBUG; #define DEBUG_ALWAYS_SYNC 0x80 #define DEBUG_VERBOSE_DRI 0x100 #define DEBUG_VERBOSE_BIOS 0x200 +#endif /* !REG_DUMPER */ /* Size of the mmio region. */ @@ -281,6 +334,11 @@ extern int I810_DEBUG; #define PCI_CHIP_I945_GM_BRIDGE 0x27A0 #endif +#ifndef PCI_CHIP_I945_GME +#define PCI_CHIP_I945_GME 0x27AE +#define PCI_CHIP_I945_GME_BRIDGE 0x27AC +#endif + #ifndef PCI_CHIP_I965_G_1 #define PCI_CHIP_I965_G_1 0x2982 #define PCI_CHIP_I965_G_1_BRIDGE 0x2980 @@ -302,31 +360,71 @@ extern int I810_DEBUG; #endif #ifndef PCI_CHIP_I965_GM -#define PCI_CHIP_I965_GM 0x2A02 -#define PCI_CHIP_I965_GM_BRIDGE 0x2A00 +#define PCI_CHIP_I965_GM 0x2A02 +#define PCI_CHIP_I965_GM_BRIDGE 0x2A00 #endif -#define IS_I810(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I810 || \ - pI810->PciInfo->chipType == PCI_CHIP_I810_DC100 || \ - pI810->PciInfo->chipType == PCI_CHIP_I810_E) -#define IS_I815(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I815) -#define IS_I830(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I830_M) -#define IS_845G(pI810) (pI810->PciInfo->chipType == PCI_CHIP_845_G) -#define IS_I85X(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I855_GM) -#define IS_I852(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I855_GM && (pI810->variant == I852_GM || pI810->variant == I852_GME)) -#define IS_I855(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I855_GM && (pI810->variant == I855_GM || pI810->variant == I855_GME)) -#define IS_I865G(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I865_G) - -#define IS_I915G(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I915_G || pI810->PciInfo->chipType == PCI_CHIP_E7221_G) -#define IS_I915GM(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I915_GM) -#define IS_I945G(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I945_G) -#define IS_I945GM(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I945_GM) -#define IS_I965G(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I965_G || pI810->PciInfo->chipType == PCI_CHIP_I965_G_1 || pI810->PciInfo->chipType == PCI_CHIP_I965_Q || pI810->PciInfo->chipType == PCI_CHIP_I946_GZ) -#define IS_I965GM(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I965_GM) -#define IS_I96X(pI810) (IS_I965G(pI810) || IS_I965GM(pI810)) -#define IS_I9XX(pI810) (IS_I915G(pI810) || IS_I915GM(pI810) || IS_I945G(pI810) || IS_I945GM(pI810) || IS_I965G(pI810) || IS_I965GM(pI810)) +#ifndef PCI_CHIP_I965_GME +#define PCI_CHIP_I965_GME 0x2A12 +#define PCI_CHIP_I965_GME_BRIDGE 0x2A10 +#endif + +#ifndef PCI_CHIP_G33_G +#define PCI_CHIP_G33_G 0x29C2 +#define PCI_CHIP_G33_G_BRIDGE 0x29C0 +#endif + +#ifndef PCI_CHIP_Q35_G +#define PCI_CHIP_Q35_G 0x29B2 +#define PCI_CHIP_Q35_G_BRIDGE 0x29B0 +#endif + +#ifndef PCI_CHIP_Q33_G +#define PCI_CHIP_Q33_G 0x29D2 +#define PCI_CHIP_Q33_G_BRIDGE 0x29D0 +#endif + +#if XSERVER_LIBPCIACCESS +#define I810_MEMBASE(p,n) (p)->regions[(n)].base_addr +#define VENDOR_ID(p) (p)->vendor_id +#define DEVICE_ID(p) (p)->device_id +#define SUBVENDOR_ID(p) (p)->subvendor_id +#define SUBSYS_ID(p) (p)->subdevice_id +#define CHIP_REVISION(p) (p)->revision +#else +#define I810_MEMBASE(p,n) (p)->memBase[n] +#define VENDOR_ID(p) (p)->vendor +#define DEVICE_ID(p) (p)->chipType +#define SUBVENDOR_ID(p) (p)->subsysVendor +#define SUBSYS_ID(p) (p)->subsysCard +#define CHIP_REVISION(p) (p)->chipRev +#endif + +#define IS_I810(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I810 || \ + DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I810_DC100 || \ + DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I810_E) +#define IS_I815(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I815) +#define IS_I830(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I830_M) +#define IS_845G(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_845_G) +#define IS_I85X(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I855_GM) +#define IS_I852(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I855_GM && (pI810->variant == I852_GM || pI810->variant == I852_GME)) +#define IS_I855(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I855_GM && (pI810->variant == I855_GM || pI810->variant == I855_GME)) +#define IS_I865G(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I865_G) + +#define IS_I915G(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I915_G || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_E7221_G) +#define IS_I915GM(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I915_GM) +#define IS_I945G(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I945_G) +#define IS_I945GM(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I945_GM || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I945_GME) +#define IS_I965GM(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_GM || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_GME) +#define IS_I965G(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_G || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_G_1 || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_Q || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I946_GZ || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_GM || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_GME) +#define IS_G33CLASS(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_G33_G ||\ + DEVICE_ID(pI810->PciInfo) == PCI_CHIP_Q35_G ||\ + DEVICE_ID(pI810->PciInfo) == PCI_CHIP_Q33_G) +#define IS_I9XX(pI810) (IS_I915G(pI810) || IS_I915GM(pI810) || IS_I945G(pI810) || IS_I945GM(pI810) || IS_I965G(pI810) || IS_G33CLASS(pI810)) #define IS_MOBILE(pI810) (IS_I830(pI810) || IS_I85X(pI810) || IS_I915GM(pI810) || IS_I945GM(pI810) || IS_I965GM(pI810)) +/* mark chipsets for using gfx VM offset for overlay */ +#define OVERLAY_NOPHYSICAL(pI810) (IS_G33CLASS(pI810)) #define GTT_PAGE_SIZE KB(4) #define ROUND_TO(x, y) (((x) + (y) - 1) / (y) * (y)) @@ -344,10 +442,11 @@ extern int I810_DEBUG; #define I810_CURSOR_X 64 #define I810_CURSOR_Y I810_CURSOR_X -/* XXX Need to check if these are reasonable. */ -#define MAX_DISPLAY_PITCH 2048 -#define MAX_DISPLAY_HEIGHT 2048 - #define PIPE_NAME(n) ('A' + (n)) +#if XSERVER_LIBPCIACCESS +struct pci_device * +intel_host_bridge (void); +#endif + #endif /* _INTEL_COMMON_H_ */ diff --git a/driver/xf86-video-intel/src/i810_driver.c b/driver/xf86-video-intel/src/i810_driver.c index 17e5d7185..a6c13ed72 100644 --- a/driver/xf86-video-intel/src/i810_driver.c +++ b/driver/xf86-video-intel/src/i810_driver.c @@ -94,7 +94,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* Required Functions: */ static void I810Identify(int flags); + +#if XSERVER_LIBPCIACCESS +static Bool intel_pci_probe (DriverPtr drv, + int entity_num, + struct pci_device *dev, + intptr_t match_data); +#else static Bool I810Probe(DriverPtr drv, int flags); +#endif + #ifndef I830_ONLY static Bool I810PreInit(ScrnInfoPtr pScrn, int flags); static Bool I810ScreenInit(int Index, ScreenPtr pScreen, int argc, @@ -112,14 +121,59 @@ static ModeStatus I810ValidMode(int scrnIndex, DisplayModePtr mode, #endif /* I830_ONLY */ +#if XSERVER_LIBPCIACCESS + +#define INTEL_DEVICE_MATCH(d,i) \ + { 0x8086, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) } + +static const struct pci_id_match intel_device_match[] = { +#ifndef I830_ONLY + INTEL_DEVICE_MATCH (PCI_CHIP_I810, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I810_DC100, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I810_E, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I815, 0 ), +#endif + INTEL_DEVICE_MATCH (PCI_CHIP_I830_M, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_845_G, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I855_GM, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I865_G, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I915_G, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_E7221_G, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I915_GM, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I945_G, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I945_GM, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I945_GME, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I965_G, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I965_G_1, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I965_Q, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I946_GZ, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I965_GM, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_I965_GME, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_G33_G, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_Q35_G, 0 ), + INTEL_DEVICE_MATCH (PCI_CHIP_Q33_G, 0 ), + { 0, 0, 0 }, +}; + +#endif /* XSERVER_LIBPCIACCESS */ + _X_EXPORT DriverRec I810 = { I810_VERSION, I810_DRIVER_NAME, I810Identify, +#if XSERVER_LIBPCIACCESS + NULL, +#else I810Probe, +#endif I810AvailableOptions, NULL, - 0 + 0, + NULL, +#if XSERVER_LIBPCIACCESS + intel_device_match, + intel_pci_probe +#endif }; /* *INDENT-OFF* */ @@ -140,11 +194,16 @@ static SymTabRec I810Chipsets[] = { {PCI_CHIP_I915_GM, "915GM"}, {PCI_CHIP_I945_G, "945G"}, {PCI_CHIP_I945_GM, "945GM"}, + {PCI_CHIP_I945_GME, "945GME"}, {PCI_CHIP_I965_G, "965G"}, {PCI_CHIP_I965_G_1, "965G"}, {PCI_CHIP_I965_Q, "965Q"}, {PCI_CHIP_I946_GZ, "946GZ"}, {PCI_CHIP_I965_GM, "965GM"}, + {PCI_CHIP_I965_GME, "965GME/GLE"}, + {PCI_CHIP_G33_G, "G33"}, + {PCI_CHIP_Q35_G, "Q35"}, + {PCI_CHIP_Q33_G, "Q33"}, {-1, NULL} }; @@ -164,11 +223,16 @@ static PciChipsets I810PciChipsets[] = { {PCI_CHIP_I915_GM, PCI_CHIP_I915_GM, RES_SHARED_VGA}, {PCI_CHIP_I945_G, PCI_CHIP_I945_G, RES_SHARED_VGA}, {PCI_CHIP_I945_GM, PCI_CHIP_I945_GM, RES_SHARED_VGA}, + {PCI_CHIP_I945_GME, PCI_CHIP_I945_GME, RES_SHARED_VGA}, {PCI_CHIP_I965_G, PCI_CHIP_I965_G, RES_SHARED_VGA}, {PCI_CHIP_I965_G_1, PCI_CHIP_I965_G_1, RES_SHARED_VGA}, {PCI_CHIP_I965_Q, PCI_CHIP_I965_Q, RES_SHARED_VGA}, {PCI_CHIP_I946_GZ, PCI_CHIP_I946_GZ, RES_SHARED_VGA}, {PCI_CHIP_I965_GM, PCI_CHIP_I965_GM, RES_SHARED_VGA}, + {PCI_CHIP_I965_GME, PCI_CHIP_I965_GME, RES_SHARED_VGA}, + {PCI_CHIP_G33_G, PCI_CHIP_G33_G, RES_SHARED_VGA}, + {PCI_CHIP_Q35_G, PCI_CHIP_Q35_G, RES_SHARED_VGA}, + {PCI_CHIP_Q33_G, PCI_CHIP_Q33_G, RES_SHARED_VGA}, {-1, -1, RES_UNDEFINED } }; @@ -343,10 +407,9 @@ const char *I810driSymbols[] = { #endif /* I830_ONLY */ -const char *I810shadowSymbols[] = { - "shadowInit", - "shadowSetup", - "shadowAdd", +const char *I810i2cSymbols[] = { + "xf86CreateI2CBusRec", + "xf86I2CBusInit", NULL }; @@ -381,6 +444,21 @@ int I830EntityIndex = -1; static MODULESETUPPROTO(i810Setup); +static XF86ModuleVersionInfo intelVersRec = { + "intel", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + INTEL_VERSION_MAJOR, INTEL_VERSION_MINOR, INTEL_VERSION_PATCH, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0, 0, 0, 0} +}; + +_X_EXPORT XF86ModuleData intelModuleData = { &intelVersRec, i810Setup, NULL }; + static XF86ModuleVersionInfo i810VersRec = { "i810", MODULEVENDORSTRING, @@ -394,7 +472,7 @@ static XF86ModuleVersionInfo i810VersRec = { {0, 0, 0, 0} }; -_X_EXPORT XF86ModuleData i810ModuleData = { &i810VersRec, i810Setup, 0 }; +_X_EXPORT XF86ModuleData i810ModuleData = { &i810VersRec, i810Setup, NULL }; static pointer i810Setup(pointer module, pointer opts, int *errmaj, int *errmin) @@ -405,7 +483,13 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin) */ if (!setupDone) { setupDone = 1; - xf86AddDriver(&I810, module, 0); + xf86AddDriver(&I810, module, +#if XSERVER_LIBPCIACCESS + HaveDriverFuncs +#else + 0 +#endif + ); /* * Tell the loader about symbols from other modules that this module @@ -417,7 +501,6 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin) I810drmSymbols, I810driSymbols, #endif - I810shadowSymbols, I810shadowFBSymbols, I810vbeSymbols, vbeOptionalSymbols, I810ddcSymbols, I810int10Symbols, NULL); @@ -462,7 +545,7 @@ I810FreeRec(ScrnInfoPtr pScrn) if (!pScrn->driverPrivate) return; xfree(pScrn->driverPrivate); - pScrn->driverPrivate = 0; + pScrn->driverPrivate = NULL; } #endif @@ -486,13 +569,120 @@ I810AvailableOptions(int chipid, int busid) #ifndef I830_ONLY const OptionInfoRec *pOptions; - if ((pOptions = I830BIOSAvailableOptions(chipid, busid))) + if ((pOptions = I830AvailableOptions(chipid, busid))) return pOptions; return I810Options; #else - return I830BIOSAvailableOptions(chipid, busid); + return I830AvailableOptions(chipid, busid); +#endif +} + +#if XSERVER_LIBPCIACCESS +struct pci_device * +intel_host_bridge (void) +{ + static const struct pci_slot_match bridge_match = { + 0, 0, 0, PCI_MATCH_ANY, 0 + }; + struct pci_device_iterator *slot_iterator; + struct pci_device *bridge; + + slot_iterator = pci_slot_match_iterator_create (&bridge_match); + bridge = pci_device_next (slot_iterator); + pci_iterator_destroy (slot_iterator); + return bridge; +} + +/* + * intel_pci_probe -- + * + * Look through the PCI bus to find cards that are intel boards. + * Setup the dispatch table for the rest of the driver functions. + * + */ +static Bool intel_pci_probe (DriverPtr driver, + int entity_num, + struct pci_device *device, + intptr_t match_data) +{ + ScrnInfoPtr scrn = NULL; + EntityInfoPtr entity; + I830EntPtr i830_ent = NULL; + DevUnion *private; + + scrn = xf86ConfigPciEntity (scrn, 0, entity_num, I810PciChipsets, + NULL, + NULL, NULL, NULL, NULL); + if (scrn != NULL) + { + scrn->driverVersion = I810_VERSION; + scrn->driverName = I810_DRIVER_NAME; + scrn->name = I810_NAME; + scrn->Probe = NULL; + + entity = xf86GetEntityInfo (entity_num); + + switch (DEVICE_ID(device)) { +#ifndef I830_ONLY + case PCI_CHIP_I810: + case PCI_CHIP_I810_DC100: + case PCI_CHIP_I810_E: + case PCI_CHIP_I815: + scrn->PreInit = I810PreInit; + scrn->ScreenInit = I810ScreenInit; + scrn->SwitchMode = I810SwitchMode; + scrn->AdjustFrame = I810AdjustFrame; + scrn->EnterVT = I810EnterVT; + scrn->LeaveVT = I810LeaveVT; + scrn->FreeScreen = I810FreeScreen; + scrn->ValidMode = I810ValidMode; + break; #endif + case PCI_CHIP_845_G: + case PCI_CHIP_I865_G: + /* + * These two chips have only one pipe, and + * cannot do dual-head + */ + I830InitpScrn(scrn); + break; + default: + /* + * Everything else is an i830-ish dual-pipe chip + */ + xf86SetEntitySharable(entity_num); + + /* Allocate an entity private if necessary */ + if (I830EntityIndex < 0) + I830EntityIndex = xf86AllocateEntityPrivateIndex(); + + private = xf86GetEntityPrivate(scrn->entityList[0], + I830EntityIndex); + i830_ent = private->ptr; + if (!i830_ent) + { + private->ptr = xnfcalloc(sizeof(I830EntRec), 1); + i830_ent = private->ptr; + i830_ent->lastInstance = -1; + } + + /* + * Set the entity instance for this instance of the driver. + * For dual head per card, instance 0 is the "master" + * instance, driving the primary head, and instance 1 is + * the "slave". + */ + i830_ent->lastInstance++; + xf86SetEntityInstanceForScreen(scrn, + scrn->entityList[0], + i830_ent->lastInstance); + I830InitpScrn(scrn); + break; + } + } + return scrn != NULL; } +#else /* XSERVER_LIBPCIACCESS */ /* * I810Probe -- @@ -518,7 +708,9 @@ I810Probe(DriverPtr drv, int flags) * driver, and return if there are none. */ if ((numDevSections = - xf86MatchDevice(I810_DRIVER_NAME, &devSections)) <= 0) { + xf86MatchDevice(I810_DRIVER_NAME, &devSections)) <= 0 && + (numDevSections = + xf86MatchDevice(I810_LEGACY_DRIVER_NAME, &devSections)) <= 0) { return FALSE; } @@ -571,7 +763,8 @@ I810Probe(DriverPtr drv, int flags) /* Allocate new ScrnInfoRec and claim the slot */ if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], - I810PciChipsets, 0, 0, 0, 0, 0))) { + I810PciChipsets, NULL, NULL, NULL, + NULL, NULL))) { EntityInfoPtr pEnt; pEnt = xf86GetEntityInfo(usedChips[i]); @@ -593,34 +786,39 @@ I810Probe(DriverPtr drv, int flags) case PCI_CHIP_I915_GM: case PCI_CHIP_I945_G: case PCI_CHIP_I945_GM: + case PCI_CHIP_I945_GME: case PCI_CHIP_I965_G: case PCI_CHIP_I965_G_1: case PCI_CHIP_I965_Q: case PCI_CHIP_I946_GZ: case PCI_CHIP_I965_GM: + case PCI_CHIP_I965_GME: + case PCI_CHIP_G33_G: + case PCI_CHIP_Q35_G: + case PCI_CHIP_Q33_G: xf86SetEntitySharable(usedChips[i]); /* Allocate an entity private if necessary */ if (I830EntityIndex < 0) I830EntityIndex = xf86AllocateEntityPrivateIndex(); - pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], I830EntityIndex); - if (!pPriv->ptr) { - pPriv->ptr = xnfcalloc(sizeof(I830EntRec), 1); - pI830Ent = pPriv->ptr; - pI830Ent->lastInstance = -1; - } else { - pI830Ent = pPriv->ptr; + if (!pPriv->ptr) { + pPriv->ptr = xnfcalloc(sizeof(I830EntRec), 1); + pI830Ent = pPriv->ptr; + pI830Ent->lastInstance = -1; + } else { + pI830Ent = pPriv->ptr; } - - /* - * Set the entity instance for this instance of the driver. - * For dual head per card, instance 0 is the "master" - * instance, driving the primary head, and instance 1 is - * the "slave". - */ - pI830Ent->lastInstance++; + + /* + * Set the entity instance for this instance of the driver. + * For dual head per card, instance 0 is the "master" + * instance, driving the primary head, and instance 1 is + * the "slave". + */ + pI830Ent->lastInstance++; xf86SetEntityInstanceForScreen(pScrn, pScrn->entityList[0], pI830Ent->lastInstance); I830InitpScrn(pScrn); @@ -647,6 +845,7 @@ I810Probe(DriverPtr drv, int flags) return foundScreen; } +#endif /* else XSERVER_LIBPCIACCESS */ #ifndef I830_ONLY static void @@ -738,10 +937,12 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) pI810->ioBase = hwp->PIOOffset; pI810->PciInfo = xf86GetPciInfoForEntity(pI810->pEnt->index); +#if !XSERVER_LIBPCIACCESS pI810->PciTag = pciTag(pI810->PciInfo->bus, pI810->PciInfo->device, pI810->PciInfo->func); +#endif - if (xf86RegisterResources(pI810->pEnt->index, 0, ResNone)) + if (xf86RegisterResources(pI810->pEnt->index, NULL, ResNone)) return FALSE; pScrn->racMemFlags = RAC_FB | RAC_COLORMAP; @@ -832,11 +1033,11 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) if (!pI810->directRenderingDisabled) { if (pI810->noAccel) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it " + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "DRI is disabled because it " "needs 2D acceleration.\n"); pI810->directRenderingDisabled=TRUE; } else if (pScrn->depth!=16) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it " + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "DRI is disabled because it " "runs only at 16-bit depth.\n"); pI810->directRenderingDisabled=TRUE; } @@ -868,7 +1069,7 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) } else { from = X_PROBED; pScrn->chipset = (char *)xf86TokenToString(I810Chipsets, - pI810->PciInfo->chipType); + DEVICE_ID(pI810->PciInfo)); } if (pI810->pEnt->device->chipRev >= 0) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", @@ -878,6 +1079,9 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", (pScrn->chipset != NULL) ? pScrn->chipset : "Unknown i810"); +#if XSERVER_LIBPCIACCESS + pI810->LinearAddr = pI810->PciInfo->regions[0].base_addr; +#else if (pI810->pEnt->device->MemBase != 0) { pI810->LinearAddr = pI810->pEnt->device->MemBase; from = X_CONFIG; @@ -892,9 +1096,13 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } } +#endif xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", (unsigned long)pI810->LinearAddr); +#if XSERVER_LIBPCIACCESS + pI810->MMIOAddr = pI810->PciInfo->regions[1].base_addr; +#else if (pI810->pEnt->device->IOBase != 0) { pI810->MMIOAddr = pI810->pEnt->device->IOBase; from = X_CONFIG; @@ -909,6 +1117,7 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } } +#endif xf86DrvMsg(pScrn->scrnIndex, from, "IO registers at addr 0x%lX\n", (unsigned long)pI810->MMIOAddr); @@ -925,8 +1134,13 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) /* Find out memory bus frequency. */ { - unsigned long whtcfg_pamr_drp = pciReadLong(pI810->PciTag, - WHTCFG_PAMR_DRP); + uint32_t whtcfg_pamr_drp; + +#if XSERVER_LIBPCIACCESS + pci_device_cfg_read_u32(pI810->PciInfo, & whtcfg_pamr_drp, WHTCFG_PAMR_DRP); +#else + whtcfg_pamr_drp = pciReadLong(pI810->PciTag, WHTCFG_PAMR_DRP); +#endif /* Need this for choosing watermarks. */ @@ -979,11 +1193,19 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) /* Calculate Fixed Offsets depending on graphics aperture size */ { +#if XSERVER_LIBPCIACCESS + struct pci_device *bridge = intel_host_bridge (); + uint32_t smram_miscc; + + pci_device_cfg_read_u32 (bridge, & smram_miscc, SMRAM_MISCC); +#else PCITAG bridge; long smram_miscc; bridge = pciTag(0, 0, 0); /* This is always the host bridge */ smram_miscc = pciReadLong(bridge, SMRAM_MISCC); +#endif + if ((smram_miscc & GFX_MEM_WIN_SIZE) == GFX_MEM_WIN_32M) { pI810->FbMapSize = 0x1000000; pI810->DepthOffset = 0x1000000; @@ -1173,6 +1395,10 @@ I810MapMMIO(ScrnInfoPtr pScrn) { int mmioFlags; I810Ptr pI810 = I810PTR(pScrn); +#if XSERVER_LIBPCIACCESS + struct pci_device *const device = pI810->PciInfo; + int err; +#endif #if !defined(__alpha__) mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; @@ -1180,11 +1406,26 @@ I810MapMMIO(ScrnInfoPtr pScrn) mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE; #endif +#if XSERVER_LIBPCIACCESS + err = pci_device_map_range (device, + pI810->MMIOAddr, + I810_REG_SIZE, + PCI_DEV_MAP_FLAG_WRITABLE, + (void **) &pI810->MMIOBase); + if (err) + { + xf86DrvMsg (pScrn->scrnIndex, X_ERROR, + "Unable to map mmio BAR. %s (%d)\n", + strerror (err), err); + return FALSE; + } +#else pI810->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pI810->PciTag, pI810->MMIOAddr, I810_REG_SIZE); if (!pI810->MMIOBase) return FALSE; +#endif return TRUE; } @@ -1192,18 +1433,38 @@ static Bool I810MapMem(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); +#if XSERVER_LIBPCIACCESS + struct pci_device *const device = pI810->PciInfo; + int err; +#else long i; - - for (i = 2; i < pI810->FbMapSize; i <<= 1) ; +#endif if (!I810MapMMIO(pScrn)) return FALSE; +#if XSERVER_LIBPCIACCESS + err = pci_device_map_range (device, + pI810->LinearAddr, + pI810->FbMapSize, + PCI_DEV_MAP_FLAG_WRITABLE | PCI_DEV_MAP_FLAG_WRITE_COMBINE, + (void **) &pI810->FbBase); + if (err) + { + xf86DrvMsg (pScrn->scrnIndex, X_ERROR, + "Unable to map frame buffer BAR. %s (%d)\n", + strerror (err), err); + return FALSE; + } +#else + for (i = 2; i < pI810->FbMapSize; i <<= 1) ; + pI810->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pI810->PciTag, pI810->LinearAddr, i); if (!pI810->FbBase) return FALSE; +#endif pI810->LpRing->virtual_start = pI810->FbBase + pI810->LpRing->mem.Start; @@ -1215,9 +1476,13 @@ I810UnmapMMIO(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); +#if XSERVER_LIBPCIACCESS + pci_device_unmap_range (pI810->PciInfo, pI810->MMIOBase, I810_REG_SIZE); +#else xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI810->MMIOBase, I810_REG_SIZE); - pI810->MMIOBase = 0; +#endif + pI810->MMIOBase = NULL; } static Bool @@ -1225,9 +1490,13 @@ I810UnmapMem(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); +#if XSERVER_LIBPCIACCESS + pci_device_unmap_range (pI810->PciInfo, pI810->FbBase, pI810->FbMapSize); +#else xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI810->FbBase, pI810->FbMapSize); - pI810->FbBase = 0; +#endif + pI810->FbBase = NULL; I810UnmapMMIO(pScrn); return TRUE; } @@ -2204,7 +2473,7 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } - fbPictureInit(pScreen, 0, 0); + fbPictureInit(pScreen, NULL, 0); xf86SetBlackWhitePixels(pScreen); @@ -2263,18 +2532,18 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Use driver specific palette load routines for Direct Color support. -jens */ if (pScrn->bitsPerPixel == 16) { if (pScrn->depth == 15) { - if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette15, 0, + if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette15, NULL, CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; } else { - if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette16, 0, + if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette16, NULL, CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; } } else { - if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette24, 0, + if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette24, NULL, CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; @@ -2522,19 +2791,19 @@ I810CloseScreen(int scrnIndex, ScreenPtr pScreen) if (pI810->ScanlineColorExpandBuffers) { xfree(pI810->ScanlineColorExpandBuffers); - pI810->ScanlineColorExpandBuffers = 0; + pI810->ScanlineColorExpandBuffers = NULL; } if (infoPtr) { if (infoPtr->ScanlineColorExpandBuffers) xfree(infoPtr->ScanlineColorExpandBuffers); XAADestroyInfoRec(infoPtr); - pI810->AccelInfoRec = 0; + pI810->AccelInfoRec = NULL; } if (pI810->CursorInfoRec) { xf86DestroyCursorInfoRec(pI810->CursorInfoRec); - pI810->CursorInfoRec = 0; + pI810->CursorInfoRec = NULL; } /* Free all allocated video ram. diff --git a/driver/xf86-video-intel/src/i830_accel.c b/driver/xf86-video-intel/src/i830_accel.c index f2bc5b6a5..53f17a9e2 100644 --- a/driver/xf86-video-intel/src/i830_accel.c +++ b/driver/xf86-video-intel/src/i830_accel.c @@ -7,10 +7,6 @@ #include "config.h" #endif -#ifndef DO_SCANLINE_IMAGE_WRITE -#define DO_SCANLINE_IMAGE_WRITE 0 -#endif - /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -62,6 +58,37 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xaarop.h" #include "i830.h" #include "i810_reg.h" +#include "i830_debug.h" + +unsigned long +intel_get_pixmap_offset(PixmapPtr pPix) +{ + ScreenPtr pScreen = pPix->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + +#ifdef I830_USE_EXA + if (pI830->useEXA) + return exaGetPixmapOffset(pPix); +#endif + return (unsigned long)pPix->devPrivate.ptr - (unsigned long)pI830->FbBase; +} + +unsigned long +intel_get_pixmap_pitch(PixmapPtr pPix) +{ + ScreenPtr pScreen = pPix->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + +#ifdef I830_USE_EXA + if (pI830->useEXA) + return exaGetPixmapPitch(pPix); +#endif +#ifdef I830_USE_XAA + return (unsigned long)pPix->devKind; +#endif +} int I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) @@ -69,10 +96,10 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) I830Ptr pI830 = I830PTR(pScrn); I830RingBuffer *ring = pI830->LpRing; int iters = 0; - int start = 0; - int now = 0; + unsigned int start = 0; + unsigned int now = 0; int last_head = 0; - int first = 0; + unsigned int first = 0; /* If your system hasn't moved the head pointer in 2 seconds, I'm going to * call it crashed. @@ -90,7 +117,7 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) ring->space = ring->head - (ring->tail + 8); if (ring->space < 0) - ring->space += ring->mem.Size; + ring->space += ring->mem->size; iters++; now = GetTimeInMillis(); @@ -101,9 +128,12 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) start = now; last_head = ring->head; } else if (now - start > timeout_millis) { - ErrorF("Error in I830WaitLpRing(), now is %d, start is %d\n", now, - start); - I830PrintErrorState(pScrn); + ErrorF("Error in I830WaitLpRing(), timeout for %d seconds\n", + timeout_millis/1000); + if (IS_I965G(pI830)) + i965_dump_error_state(pScrn); + else + i830_dump_error_state(pScrn); ErrorF("space: %d wanted %d\n", ring->space, n); #ifdef XF86DRI if (pI830->directRenderingEnabled) { @@ -111,7 +141,12 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) DRICloseScreen(screenInfo.screens[pScrn->scrnIndex]); } #endif +#ifdef I830_USE_XAA pI830->AccelInfoRec = NULL; /* Stops recursive behavior */ +#endif +#ifdef I830_USE_EXA + pI830->EXADriverPtr = NULL; +#endif FatalError("lockup\n"); } @@ -121,7 +156,7 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) { now = GetTimeInMillis(); if (now - first) { - ErrorF("Elapsed %d ms\n", now - first); + ErrorF("Elapsed %u ms\n", now - first); ErrorF("space: %d wanted %d\n", ring->space, n); } } @@ -163,9 +198,9 @@ I830Sync(ScrnInfoPtr pScrn) ADVANCE_LP_RING(); } - I830WaitLpRing(pScrn, pI830->LpRing->mem.Size - 8, 0); + I830WaitLpRing(pScrn, pI830->LpRing->mem->size - 8, 0); - pI830->LpRing->space = pI830->LpRing->mem.Size - 8; + pI830->LpRing->space = pI830->LpRing->mem->size - 8; pI830->nextColorExpandBuf = 0; } @@ -178,10 +213,12 @@ I830EmitFlush(ScrnInfoPtr pScrn) if (IS_I96X(pI830)) flags = 0; - BEGIN_LP_RING(2); - OUT_RING(MI_FLUSH | flags); - OUT_RING(MI_NOOP); /* pad to quadword */ - ADVANCE_LP_RING(); + { + BEGIN_LP_RING(2); + OUT_RING(MI_FLUSH | flags); + OUT_RING(MI_NOOP); /* pad to quadword */ + ADVANCE_LP_RING(); + } } void @@ -192,10 +229,13 @@ I830SelectBuffer(ScrnInfoPtr pScrn, int buffer) switch (buffer) { #ifdef XF86DRI case I830_SELECT_BACK: - pI830->bufferOffset = pI830->BackBuffer.Start; + pI830->bufferOffset = pI830->back_buffer->offset; + break; + case I830_SELECT_THIRD: + pI830->bufferOffset = pI830->third_buffer->offset; break; case I830_SELECT_DEPTH: - pI830->bufferOffset = pI830->DepthBuffer.Start; + pI830->bufferOffset = pI830->depth_buffer->offset; break; #endif default: @@ -209,57 +249,6 @@ I830SelectBuffer(ScrnInfoPtr pScrn, int buffer) buffer, pI830->bufferOffset); } -void -I830RefreshRing(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; - pI830->LpRing->tail = INREG(LP_RING + RING_TAIL); - pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8); - if (pI830->LpRing->space < 0) - pI830->LpRing->space += pI830->LpRing->mem.Size; - - if (pI830->AccelInfoRec) - pI830->AccelInfoRec->NeedToSync = TRUE; -} - -/* I830 Accel Functions */ - -static void I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int pattx, int patty, - int fg, int bg, int rop, - unsigned int planemask); -static void I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int pattx, int patty, - int x, int y, int w, int h); - -static void I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int mask); - -static void I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr - pScrn, int x, - int y, int w, - int h, - int skipleft); - -static void I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); - -#if DO_SCANLINE_IMAGE_WRITE -static void I830SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, - int trans_color, int bpp, - int depth); -static void I830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft); -static void I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno); -#endif -static void I830RestoreAccelState(ScrnInfoPtr pScrn); - - /* The following function sets up the supported acceleration. Call it * from the FbInit() function in the SVGA driver, or before ScreenInit * in a monolithic server. @@ -267,597 +256,15 @@ static void I830RestoreAccelState(ScrnInfoPtr pScrn); Bool I830AccelInit(ScreenPtr pScreen) { - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - int i; - int width = 0; - int nr_buffers = 0; - unsigned char *ptr = NULL; - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830AccelInit\n"); +#ifdef I830_USE_EXA + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); - pI830->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if (!infoPtr) - return FALSE; - - pI830->bufferOffset = 0; - infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS | PIXMAP_CACHE; - - /* Use the same sync function as the I830. - */ - infoPtr->Sync = I830Sync; - - /* Everything else is different enough to justify different functions */ - { - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = I830SetupForSolidFill; - infoPtr->SubsequentSolidFillRect = I830SubsequentSolidFillRect; - } - - { - infoPtr->ScreenToScreenCopyFlags = (NO_PLANEMASK | NO_TRANSPARENCY); - - infoPtr->SetupForScreenToScreenCopy = I830SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - I830SubsequentScreenToScreenCopy; - } - - { - infoPtr->SetupForMono8x8PatternFill = I830SetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - I830SubsequentMono8x8PatternFillRect; - - infoPtr->Mono8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_ORIGIN | - BIT_ORDER_IN_BYTE_MSBFIRST | - NO_PLANEMASK); - - } - - /* On the primary screen */ - if (pI830->init == 0) { - if (pI830->Scratch.Size != 0) { - width = ((pScrn->displayWidth + 31) & ~31) / 8; - nr_buffers = pI830->Scratch.Size / width; - ptr = pI830->FbBase + pI830->Scratch.Start; - } - } else { - /* On the secondary screen */ - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - if (pI8301->Scratch2.Size != 0) { - width = ((pScrn->displayWidth + 31) & ~31) / 8; - nr_buffers = pI8301->Scratch2.Size / width; - /* We have to use the primary screen's FbBase, as that's where - * we allocated Scratch2, so we get the correct pointer */ - ptr = pI8301->FbBase + pI8301->Scratch2.Start; - } - } - - if (nr_buffers) { - pI830->NumScanlineColorExpandBuffers = nr_buffers; - pI830->ScanlineColorExpandBuffers = (unsigned char **) - xnfcalloc(nr_buffers, sizeof(unsigned char *)); - - for (i = 0; i < nr_buffers; i++, ptr += width) - pI830->ScanlineColorExpandBuffers[i] = ptr; - - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = - (NO_PLANEMASK | ROP_NEEDS_SOURCE | BIT_ORDER_IN_BYTE_MSBFIRST); - - infoPtr->ScanlineColorExpandBuffers = (unsigned char **) - xnfcalloc(1, sizeof(unsigned char *)); - infoPtr->NumScanlineColorExpandBuffers = 1; - - infoPtr->ScanlineColorExpandBuffers[0] = - pI830->ScanlineColorExpandBuffers[0]; - pI830->nextColorExpandBuf = 0; - - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - I830SetupForScanlineCPUToScreenColorExpandFill; - - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - I830SubsequentScanlineCPUToScreenColorExpandFill; - - infoPtr->SubsequentColorExpandScanline = - I830SubsequentColorExpandScanline; - -#if DO_SCANLINE_IMAGE_WRITE - infoPtr->NumScanlineImageWriteBuffers = 1; - infoPtr->ScanlineImageWriteBuffers = infoPtr->ScanlineColorExpandBuffers; - infoPtr->SetupForScanlineImageWrite = I830SetupForScanlineImageWrite; - infoPtr->SubsequentScanlineImageWriteRect = - I830SubsequentScanlineImageWriteRect; - infoPtr->SubsequentImageWriteScanline = I830SubsequentImageWriteScanline; - infoPtr->ScanlineImageWriteFlags = NO_GXCOPY | - NO_PLANEMASK | - ROP_NEEDS_SOURCE | - SCANLINE_PAD_DWORD; + if (pI830->useEXA) + return I830EXAInit(pScreen); #endif - } - - { - Bool shared_accel = FALSE; - int i; - - for(i = 0; i < pScrn->numEntities; i++) { - if(xf86IsEntityShared(pScrn->entityList[i])) - shared_accel = TRUE; - } - if(shared_accel == TRUE) - infoPtr->RestoreAccelState = I830RestoreAccelState; - } - - I830SelectBuffer(pScrn, I830_SELECT_FRONT); - - return XAAInit(pScreen, infoPtr); -} - -#ifdef XF86DRI -static unsigned int -CheckTiling(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - unsigned int tiled = 0; - - /* Check tiling */ - if (IS_I96X(pI830)) { - if (pI830->bufferOffset == pScrn->fbOffset && pI830->front_tiled == FENCE_XMAJOR) - tiled = 1; - if (pI830->bufferOffset == pI830->RotatedMem.Start && pI830->rotated_tiled == FENCE_XMAJOR) - tiled = 1; - if (pI830->bufferOffset == pI830->BackBuffer.Start && pI830->back_tiled == FENCE_XMAJOR) - tiled = 1; - /* not really supported as it's always YMajor tiled */ - if (pI830->bufferOffset == pI830->DepthBuffer.Start && pI830->depth_tiled == FENCE_XMAJOR) - tiled = 1; - } - - return tiled; -} -#else -#define CheckTiling(pScrn) 0 -#endif - -void -I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SetupForFillRectSolid color: %x rop: %x mask: %x\n", - color, rop, planemask); - - pI830->BR[13] = ((XAAGetPatternROP(rop) << 16) | - (pScrn->displayWidth * pI830->cpp)); - - pI830->BR[16] = color; - - switch (pScrn->bitsPerPixel) { - case 8: - break; - case 16: - pI830->BR[13] |= (1 << 24); - break; - case 32: - pI830->BR[13] |= ((1 << 25) | (1 << 24)); - break; - } -} - -void -I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentFillRectSolid %d,%d %dx%d\n", x, y, w, h); - - { - BEGIN_LP_RING(6); - - if (pScrn->bitsPerPixel == 32) { - OUT_RING(COLOR_BLT_CMD | COLOR_BLT_WRITE_ALPHA | - COLOR_BLT_WRITE_RGB); - } else { - OUT_RING(COLOR_BLT_CMD); - } - OUT_RING(pI830->BR[13]); - OUT_RING((h << 16) | (w * pI830->cpp)); - OUT_RING(pI830->bufferOffset + (y * pScrn->displayWidth + x) * - pI830->cpp); - OUT_RING(pI830->BR[16]); - OUT_RING(0); - - ADVANCE_LP_RING(); - } - - if (IS_I96X(pI830)) - I830EmitFlush(pScrn); -} - -void -I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, - unsigned int planemask, int transparency_color) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SetupForScreenToScreenCopy %d %d %x %x %d\n", - xdir, ydir, rop, planemask, transparency_color); - - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); - pI830->BR[13] |= XAAGetCopyROP(rop) << 16; - - switch (pScrn->bitsPerPixel) { - case 8: - break; - case 16: - pI830->BR[13] |= (1 << 24); - break; - case 32: - pI830->BR[13] |= ((1 << 25) | (1 << 24)); - break; - } - -} - -void -I830SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int src_x1, int src_y1, - int dst_x1, int dst_y1, int w, int h) -{ - I830Ptr pI830 = I830PTR(pScrn); - int dst_x2, dst_y2; - unsigned int tiled = CheckTiling(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentScreenToScreenCopy %d,%d - %d,%d %dx%d\n", - src_x1, src_y1, dst_x1, dst_y1, w, h); - - dst_x2 = dst_x1 + w; - dst_y2 = dst_y1 + h; - - if (tiled) - pI830->BR[13] = ((pI830->BR[13] & 0xFFFF) >> 2) | - (pI830->BR[13] & 0xFFFF0000); - - { - BEGIN_LP_RING(8); - - if (pScrn->bitsPerPixel == 32) { - OUT_RING(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - XY_SRC_COPY_BLT_WRITE_RGB | tiled << 15 | tiled << 11); - } else { - OUT_RING(XY_SRC_COPY_BLT_CMD | tiled << 15 | tiled << 11); - } - OUT_RING(pI830->BR[13]); - OUT_RING((dst_y1 << 16) | (dst_x1 & 0xffff)); - OUT_RING((dst_y2 << 16) | (dst_x2 & 0xffff)); - OUT_RING(pI830->bufferOffset); - OUT_RING((src_y1 << 16) | (src_x1 & 0xffff)); - OUT_RING(pI830->BR[13] & 0xFFFF); - OUT_RING(pI830->bufferOffset); - - ADVANCE_LP_RING(); - } - - if (IS_I96X(pI830)) - I830EmitFlush(pScrn); -} - -static void -I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattx, int patty, - int fg, int bg, int rop, - unsigned int planemask) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SetupForMono8x8PatternFill\n"); - - pI830->BR[16] = pattx; - pI830->BR[17] = patty; - pI830->BR[18] = bg; - pI830->BR[19] = fg; - - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); /* In bytes */ - pI830->BR[13] |= XAAGetPatternROP(rop) << 16; - if (bg == -1) - pI830->BR[13] |= (1 << 28); - - switch (pScrn->bitsPerPixel) { - case 8: - break; - case 16: - pI830->BR[13] |= (1 << 24); - break; - case 32: - pI830->BR[13] |= ((1 << 25) | (1 << 24)); - break; - } - -} - -static void -I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty, - int x, int y, int w, int h) -{ - I830Ptr pI830 = I830PTR(pScrn); - int x1, x2, y1, y2; - unsigned int tiled = CheckTiling(pScrn); - - x1 = x; - x2 = x + w; - y1 = y; - y2 = y + h; - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentMono8x8PatternFillRect\n"); - - if (tiled) - pI830->BR[13] = ((pI830->BR[13] & 0xFFFF) >> 2) | - (pI830->BR[13] & 0xFFFF0000); - - { - BEGIN_LP_RING(10); - - if (pScrn->bitsPerPixel == 32) { - OUT_RING(XY_MONO_PAT_BLT_CMD | XY_MONO_PAT_BLT_WRITE_ALPHA | - XY_MONO_PAT_BLT_WRITE_RGB | - tiled << 11 | - ((patty << 8) & XY_MONO_PAT_VERT_SEED) | - ((pattx << 12) & XY_MONO_PAT_HORT_SEED)); - } else { - OUT_RING(XY_MONO_PAT_BLT_CMD | - tiled << 11 | - ((patty << 8) & XY_MONO_PAT_VERT_SEED) | - ((pattx << 12) & XY_MONO_PAT_HORT_SEED)); - } - OUT_RING(pI830->BR[13]); - OUT_RING((y1 << 16) | x1); - OUT_RING((y2 << 16) | x2); - OUT_RING(pI830->bufferOffset); - OUT_RING(pI830->BR[18]); /* bg */ - OUT_RING(pI830->BR[19]); /* fg */ - OUT_RING(pI830->BR[16]); /* pattern data */ - OUT_RING(pI830->BR[17]); - OUT_RING(0); - ADVANCE_LP_RING(); - } - - if (IS_I96X(pI830)) - I830EmitFlush(pScrn); -} - -static void -I830GetNextScanlineColorExpandBuffer(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - XAAInfoRecPtr infoPtr = pI830->AccelInfoRec; - - if (pI830->nextColorExpandBuf == pI830->NumScanlineColorExpandBuffers) - I830Sync(pScrn); - - infoPtr->ScanlineColorExpandBuffers[0] = - pI830->ScanlineColorExpandBuffers[pI830->nextColorExpandBuf]; - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("using color expand buffer %d\n", pI830->nextColorExpandBuf); - - pI830->nextColorExpandBuf++; -} - -static void -I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SetupForScanlineScreenToScreenColorExpand %d %d %x %x\n", - fg, bg, rop, planemask); - - /* Fill out register values */ - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); - pI830->BR[13] |= XAAGetCopyROP(rop) << 16; - if (bg == -1) - pI830->BR[13] |= (1 << 29); - - switch (pScrn->bitsPerPixel) { - case 8: - break; - case 16: - pI830->BR[13] |= (1 << 24); - break; - case 32: - pI830->BR[13] |= ((1 << 25) | (1 << 24)); - break; - } - - pI830->BR[18] = bg; - pI830->BR[19] = fg; - - I830GetNextScanlineColorExpandBuffer(pScrn); -} - -static void -I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, int skipleft) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentScanlineCPUToScreenColorExpandFill " - "%d,%d %dx%x %d\n", x, y, w, h, skipleft); - - /* Fill out register values */ - pI830->BR[9] = (pI830->bufferOffset + - (y * pScrn->displayWidth + x) * pI830->cpp); - pI830->BR[11] = ((1 << 16) | w); -} - -static void -I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - I830Ptr pI830 = I830PTR(pScrn); - unsigned int tiled = CheckTiling(pScrn); - - if (pI830->init == 0) { - pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - - pI830->FbBase); - } else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - - /* We have to use the primary screen's FbBase, as that's where - * we allocated Scratch2, so we get the correct pointer */ - pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - - pI8301->FbBase); - } - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentColorExpandScanline %d (addr %x)\n", - bufno, pI830->BR[12]); - - if (tiled) - pI830->BR[13] = ((pI830->BR[13] & 0xFFFF) >> 2) | - (pI830->BR[13] & 0xFFFF0000); - - { - BEGIN_LP_RING(8); - - if (pScrn->bitsPerPixel == 32) { - OUT_RING(XY_MONO_SRC_BLT_CMD | XY_MONO_SRC_BLT_WRITE_ALPHA | - tiled << 11 | - XY_MONO_SRC_BLT_WRITE_RGB); - } else { - OUT_RING(XY_MONO_SRC_BLT_CMD | tiled << 11); - } - OUT_RING(pI830->BR[13]); - OUT_RING(0); /* x1 = 0, y1 = 0 */ - OUT_RING(pI830->BR[11]); /* x2 = w, y2 = 1 */ - OUT_RING(pI830->BR[9]); /* dst addr */ - OUT_RING(pI830->BR[12]); /* src addr */ - OUT_RING(pI830->BR[18]); /* bg */ - OUT_RING(pI830->BR[19]); /* fg */ - - ADVANCE_LP_RING(); - } - - /* Advance to next scanline. - */ - pI830->BR[9] += pScrn->displayWidth * pI830->cpp; - I830GetNextScanlineColorExpandBuffer(pScrn); - - if (IS_I96X(pI830)) - I830EmitFlush(pScrn); -} - -#if DO_SCANLINE_IMAGE_WRITE -static void -I830SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int trans_color, - int bpp, int depth) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SetupForScanlineImageWrite %x %x\n", rop, planemask); - - /* Fill out register values */ - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); - pI830->BR[13] |= XAAGetCopyROP(rop) << 16; - - switch (pScrn->bitsPerPixel) { - case 8: - break; - case 16: - pI830->BR[13] |= (1 << 24); - break; - case 32: - pI830->BR[13] |= ((1 << 25) | (1 << 24)); - break; - } - - I830GetNextScanlineColorExpandBuffer(pScrn); -} - -static void -I830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y, - int w, int h, int skipleft) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentScanlineImageWriteRect " - "%d,%d %dx%x %d\n", x, y, w, h, skipleft); - - /* Fill out register values */ - pI830->BR[9] = (pI830->bufferOffset + - (y * pScrn->displayWidth + x) * pI830->cpp); - pI830->BR[11] = ((1 << 16) | w); -} - -static void -I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) -{ - I830Ptr pI830 = I830PTR(pScrn); - unsigned int tiled = CheckTiling(pScrn); - - if (pI830->init == 0) { - pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - - pI830->FbBase); - } else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - - /* We have to use the primary screen's FbBase, as that's where - * we allocated Scratch2, so we get the correct pointer */ - pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - - pI8301->FbBase); - } - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentImageWriteScanline %d (addr %x)\n", - bufno, pI830->BR[12]); - - { - BEGIN_LP_RING(8); - - if (pScrn->bitsPerPixel == 32) { - OUT_RING(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - tiled << 11 | - XY_SRC_COPY_BLT_WRITE_RGB); - } else { - OUT_RING(XY_SRC_COPY_BLT_CMD | tiled << 11); - } - OUT_RING(pI830->BR[13]); - OUT_RING(0); /* x1 = 0, y1 = 0 */ - OUT_RING(pI830->BR[11]); /* x2 = w, y2 = 1 */ - OUT_RING(pI830->BR[9]); /* dst addr */ - OUT_RING(0); /* source origin (0,0) */ - OUT_RING(pI830->BR[11] & 0xffff); /* source pitch */ - OUT_RING(pI830->BR[12]); /* src addr */ - - ADVANCE_LP_RING(); - } - - /* Advance to next scanline. - */ - pI830->BR[9] += pScrn->displayWidth * pI830->cpp; - I830GetNextScanlineColorExpandBuffer(pScrn); -} -#endif - -/* Support for multiscreen */ -static void -I830RestoreAccelState(ScrnInfoPtr pScrn) -{ -#if 0 - /* might be needed, but everything is on a ring, so I don't think so */ - I830Sync(pScrn); +#ifdef I830_USE_XAA + return I830XAAInit(pScreen); #endif + return FALSE; } diff --git a/driver/xf86-video-intel/src/i830_dga.c b/driver/xf86-video-intel/src/i830_dga.c deleted file mode 100644 index 55ffecd33..000000000 --- a/driver/xf86-video-intel/src/i830_dga.c +++ /dev/null @@ -1,442 +0,0 @@ -/* - * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - */ -/* - * Reformatted with GNU indent (2.2.8), using the following options: - * - * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 - * -lp -npcs -psl -sob -ss -br -ce -sc -hnl - * - * This provides a good match with the original i810 code and preferred - * XFree86 formatting conventions. - * - * When editing this driver, please follow the existing formatting, and edit - * with <TAB> characters expanded at 8-column intervals. - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dga.c,v 1.2 2002/11/05 02:01:18 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86Pci.h" -#include "xf86PciInfo.h" -#include "xaa.h" -#include "xaalocal.h" -#include "i830.h" -#include "i810_reg.h" -#include "dgaproc.h" -#include "vgaHW.h" - -static Bool I830_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, - int *, int *, int *); -static void I830_CloseFramebuffer(ScrnInfoPtr pScrn); -static Bool I830_SetMode(ScrnInfoPtr, DGAModePtr); -static void I830_Sync(ScrnInfoPtr); -static int I830_GetViewport(ScrnInfoPtr); -static void I830_SetViewport(ScrnInfoPtr, int, int, int); -static void I830_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); -static void I830_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); - -#if 0 -static void I830_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, - unsigned long); -#endif - -static -DGAFunctionRec I830DGAFuncs = { - I830_OpenFramebuffer, - I830_CloseFramebuffer, - I830_SetMode, - I830_SetViewport, - I830_GetViewport, - I830_Sync, - I830_FillRect, - I830_BlitRect, -#if 0 - I830_BlitTransRect -#else - NULL -#endif -}; - -Bool -I830DGAInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - DGAModePtr modes = NULL, newmodes = NULL, currentMode; - DisplayModePtr pMode, firstMode; - int Bpp = pScrn->bitsPerPixel >> 3; - int num = 0; - - MARKER(); - - pMode = firstMode = pScrn->modes; - - while (pMode) { - - if(pI830->MergedFB) { - Bool nogood = FALSE; - /* Filter out all meta modes that would require driver-side panning */ - switch(((I830ModePrivatePtr)pMode->Private)->merged.SecondPosition) { - case PosRightOf: - case PosLeftOf: - if( (((I830ModePrivatePtr)pMode->Private)->merged.First->VDisplay != - ((I830ModePrivatePtr)pMode->Private)->merged.Second->VDisplay) || - (((I830ModePrivatePtr)pMode->Private)->merged.First->VDisplay != pMode->VDisplay) ) - nogood = TRUE; - break; - default: - if( (((I830ModePrivatePtr)pMode->Private)->merged.First->HDisplay != - ((I830ModePrivatePtr)pMode->Private)->merged.Second->HDisplay) || - (((I830ModePrivatePtr)pMode->Private)->merged.First->HDisplay != pMode->HDisplay) ) - nogood = TRUE; - } - if(nogood) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "DGA: MetaMode %dx%d not suitable for DGA, skipping\n", - pMode->HDisplay, pMode->VDisplay); - goto mode_nogood; - } - } - - newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); - - if (!newmodes) { - xfree(modes); - return FALSE; - } - modes = newmodes; - - currentMode = modes + num; - num++; - - currentMode->mode = pMode; - currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; - if (!pI830->noAccel) - currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; - if (pMode->Flags & V_DBLSCAN) - currentMode->flags |= DGA_DOUBLESCAN; - if (pMode->Flags & V_INTERLACE) - currentMode->flags |= DGA_INTERLACED; - currentMode->byteOrder = pScrn->imageByteOrder; - currentMode->depth = pScrn->depth; - currentMode->bitsPerPixel = pScrn->bitsPerPixel; - currentMode->red_mask = pScrn->mask.red; - currentMode->green_mask = pScrn->mask.green; - currentMode->blue_mask = pScrn->mask.blue; - currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; - currentMode->viewportWidth = pMode->HDisplay; - currentMode->viewportHeight = pMode->VDisplay; - currentMode->xViewportStep = (Bpp == 3) ? 2 : 1; - currentMode->yViewportStep = 1; - currentMode->viewportFlags = DGA_FLIP_RETRACE; - currentMode->offset = 0; - if (I830IsPrimary(pScrn)) { - currentMode->address = pI830->FbBase + pI830->FrontBuffer.Start; - } else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - currentMode->address = pI830->FbBase + pI8301->FrontBuffer2.Start; - } - - currentMode->bytesPerScanline = ((pI830->displayWidth * Bpp) + 3) & ~3L; - if (I830IsPrimary(pScrn)) { - currentMode->imageWidth = pI830->FbMemBox.x2; - currentMode->imageHeight = pI830->FbMemBox.y2; - } else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - currentMode->imageWidth = pI8301->FbMemBox2.x2; - currentMode->imageHeight = pI8301->FbMemBox2.y2; - } - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - - currentMode->viewportHeight; - -mode_nogood: - pMode = pMode->next; - if (pMode == firstMode) - break; - } - - pI830->numDGAModes = num; - pI830->DGAModes = modes; - - return DGAInit(pScreen, &I830DGAFuncs, modes, num); -} - -static DisplayModePtr I830SavedDGAModes[MAXSCREENS]; - -static Bool -I830_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) -{ - int index = pScrn->pScreen->myNum; - I830Ptr pI830 = I830PTR(pScrn); - - MARKER(); - - if (!pMode) { /* restore the original mode */ - DPRINTF(PFX, "Restoring original mode (from DGA mode)\n"); - if (pI830->DGAactive) { - I830_CloseFramebuffer(pScrn); - pScrn->currentMode = I830SavedDGAModes[index]; - pScrn->SwitchMode(index, pScrn->currentMode, 0); - pScrn->AdjustFrame(index, 0, 0, 0); - pI830->DGAactive = FALSE; - } - } else { - if (!pI830->DGAactive) { - DPRINTF(PFX, "Setting DGA mode\n"); - I830SavedDGAModes[index] = pScrn->currentMode; - pI830->DGAactive = TRUE; - if (I830IsPrimary(pScrn)) { - pScrn->fbOffset = pI830->FrontBuffer.Start; - } - else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - pScrn->fbOffset = pI8301->FrontBuffer2.Start; - } - pScrn->displayWidth = pI830->displayWidth; - I830SelectBuffer(pScrn, I830_SELECT_FRONT); - } - - pScrn->SwitchMode(index, pMode->mode, 0); - } - - return TRUE; -} - -static int -I830_GetViewport(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - MARKER(); - - return pI830->DGAViewportStatus; -} - -static void -I830_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) -{ - I830Ptr pI830 = I830PTR(pScrn); - vgaHWPtr hwp = VGAHWPTR(pScrn); - - MARKER(); - - pScrn->AdjustFrame(pScrn->pScreen->myNum, x, y, flags); - - /* wait for retrace */ - while ((hwp->readST01(hwp) & 0x08)) ; - while (!(hwp->readST01(hwp) & 0x08)) ; - - pI830->DGAViewportStatus = 0; -} - -static void -I830_FillRect(ScrnInfoPtr pScrn, - int x, int y, int w, int h, unsigned long color) -{ - I830Ptr pI830 = I830PTR(pScrn); - - MARKER(); - - if (pI830->AccelInfoRec) { - (*pI830->AccelInfoRec->SetupForSolidFill) (pScrn, color, GXcopy, ~0); - (*pI830->AccelInfoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h); - SET_SYNC_FLAG(pI830->AccelInfoRec); - } -} - -static void -I830_Sync(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - int flags = MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE; - - MARKER(); - - if (pI830->noAccel) - return; - - if (IS_I96X(pI830)) - flags = 0; - - BEGIN_LP_RING(2); - OUT_RING(MI_FLUSH | flags); - OUT_RING(MI_NOOP); /* pad to quadword */ - ADVANCE_LP_RING(); - - I830WaitLpRing(pScrn, pI830->LpRing->mem.Size - 8, 0); - - pI830->LpRing->space = pI830->LpRing->mem.Size - 8; - pI830->nextColorExpandBuf = 0; -} - -static void -I830_BlitRect(ScrnInfoPtr pScrn, - int srcx, int srcy, int w, int h, int dstx, int dsty) -{ - I830Ptr pI830 = I830PTR(pScrn); - - MARKER(); - - if (pI830->AccelInfoRec) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; - - (*pI830->AccelInfoRec->SetupForScreenToScreenCopy) (pScrn, xdir, ydir, - GXcopy, ~0, -1); - (*pI830->AccelInfoRec->SubsequentScreenToScreenCopy) (pScrn, srcx, srcy, - dstx, dsty, w, h); - SET_SYNC_FLAG(pI830->AccelInfoRec); - } -} - -#if 0 -static void -I830_BlitTransRect(ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, int dstx, int dsty, unsigned long color) -{ - - MARKER(); - - /* this one should be separate since the XAA function would - * prohibit usage of ~0 as the key */ -} -#endif - -static Bool -I830_OpenFramebuffer(ScrnInfoPtr pScrn, - char **name, - unsigned char **mem, int *size, int *offset, int *flags) -{ - I830Ptr pI830 = I830PTR(pScrn); - - MARKER(); - - *name = NULL; /* no special device */ - if (I830IsPrimary(pScrn)) { - *size = pI830->FrontBuffer.Size; - *mem = (unsigned char *)(pI830->LinearAddr + pI830->FrontBuffer.Start); - pScrn->fbOffset = pI830->FrontBuffer.Start; - } - else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - *size = pI8301->FrontBuffer2.Size; - *mem = (unsigned char *)(pI8301->LinearAddr + pI8301->FrontBuffer2.Start); - pScrn->fbOffset = pI8301->FrontBuffer2.Start; - } - pScrn->displayWidth = pI830->displayWidth; - I830SelectBuffer(pScrn, I830_SELECT_FRONT); - *offset = 0; - *flags = DGA_NEED_ROOT; - - DPRINTF(PFX, - " mem == 0x%.8x (pI830->LinearAddr)\n" - "size == %lu (pI830->FbMapSize)\n", *mem, *size); - - return TRUE; -} - -static void -I830_CloseFramebuffer(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - int i; - /* Good pitches to allow tiling. Don't care about pitches < 1024. */ - static const int pitches[] = { -/* - 128 * 2, - 128 * 4, -*/ - 128 * 8, - 128 * 16, - 128 * 32, - 128 * 64, - 0 - }; - - if (I830IsPrimary(pScrn)) { - if (pI830->rotation != RR_Rotate_0) - pScrn->fbOffset = pI830->RotatedMem.Start; - else - pScrn->fbOffset = pI830->FrontBuffer.Start; - } else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - - if (pI830->rotation != RR_Rotate_0) - pScrn->fbOffset = pI8301->RotatedMem2.Start; - else - pScrn->fbOffset = pI8301->FrontBuffer2.Start; - } - I830SelectBuffer(pScrn, I830_SELECT_FRONT); - - switch (pI830->rotation) { - case RR_Rotate_0: - pScrn->displayWidth = pI830->displayWidth; - break; - case RR_Rotate_90: - pScrn->displayWidth = pScrn->pScreen->width; - break; - case RR_Rotate_180: - pScrn->displayWidth = pI830->displayWidth; - break; - case RR_Rotate_270: - pScrn->displayWidth = pScrn->pScreen->width; - break; - } - - /* As DRI doesn't run on the secondary head, we know that disableTiling - * is always TRUE. - */ - if (I830IsPrimary(pScrn) && !pI830->disableTiling) { -#if 0 - int dWidth = pScrn->displayWidth; /* save current displayWidth */ -#endif - - for (i = 0; pitches[i] != 0; i++) { - if (pitches[i] >= pScrn->displayWidth) { - pScrn->displayWidth = pitches[i]; - break; - } - } - - /* - * If the displayWidth is a tilable pitch, test if there's enough - * memory available to enable tiling. - */ - if (pScrn->displayWidth == pitches[i]) { - /* TODO */ - } - } - -} diff --git a/driver/xf86-video-intel/src/i830_dri.c b/driver/xf86-video-intel/src/i830_dri.c index 56db194b4..b223b02e7 100644 --- a/driver/xf86-video-intel/src/i830_dri.c +++ b/driver/xf86-video-intel/src/i830_dri.c @@ -81,12 +81,26 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "i830.h" #include "i830_dri.h" -#include "dristruct.h" +#include "i915_drm.h" + +/* This block and the corresponding configure test can be removed when + * libdrm >= 2.3.1 is required. + */ +#ifndef HAVE_I915_FLIP + +#define DRM_VBLANK_FLIP 0x8000000 + +typedef struct drm_i915_flip { + int pipes; +} drm_i915_flip_t; + +#undef DRM_IOCTL_I915_FLIP +#define DRM_IOCTL_I915_FLIP DRM_IOW(DRM_COMMAND_BASE + DRM_I915_FLIP, \ + drm_i915_flip_t) -static char I830KernelDriverName[] = "i915"; -static char I830ClientDriverName[] = "i915tex"; -static char I965ClientDriverName[] = "i965"; -static char I830LegacyClientDriverName[] = "i915"; +#endif + +#include "dristruct.h" static Bool I830InitVisualConfigs(ScreenPtr pScreen); static Bool I830CreateContext(ScreenPtr pScreen, VisualPtr visual, @@ -105,11 +119,24 @@ static void I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, static void I830DRITransitionTo2d(ScreenPtr pScreen); static void I830DRITransitionTo3d(ScreenPtr pScreen); +#if defined(DAMAGE) && (DRIINFO_MAJOR_VERSION > 5 || \ + (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 1)) +#define DRI_SUPPORTS_CLIP_NOTIFY 1 +#else +#define DRI_SUPPORTS_CLIP_NOTIFY 0 static void I830DRITransitionMultiToSingle3d(ScreenPtr pScreen); static void I830DRITransitionSingleToMulti3d(ScreenPtr pScreen); +#endif -#if 0 -static void I830DRIShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf); +#if (DRIINFO_MAJOR_VERSION > 5 || \ + (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 4)) +#define DRI_DRIVER_FRAMEBUFFER_MAP 1 +#else +#define DRI_DRIVER_FRAMEBUFFER_MAP 0 +#endif + +#ifdef DRI_SUPPORTS_CLIP_NOTIFY +static void I830DRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num); #endif extern void GlxSetVisualConfigs(int nconfigs, @@ -145,22 +172,22 @@ I830InitDma(ScrnInfoPtr pScrn) memset(&info, 0, sizeof(drmI830Init)); info.func = I830_INIT_DMA; - info.ring_start = ring->mem.Start + pI830->LinearAddr; - info.ring_end = ring->mem.End + pI830->LinearAddr; - info.ring_size = ring->mem.Size; + info.ring_start = ring->mem->offset + pI830->LinearAddr; + info.ring_end = ring->mem->end + pI830->LinearAddr; + info.ring_size = ring->mem->size; info.mmio_offset = (unsigned int)pI830DRI->regs; info.sarea_priv_offset = sizeof(XF86DRISAREARec); - info.front_offset = pI830->FrontBuffer.Start; - info.back_offset = pI830->BackBuffer.Start; - info.depth_offset = pI830->DepthBuffer.Start; + info.front_offset = pI830->front_buffer->offset; + info.back_offset = pI830->back_buffer->offset; + info.depth_offset = pI830->depth_buffer->offset; info.w = pScrn->virtualX; info.h = pScrn->virtualY; - info.pitch = pI830->displayWidth; - info.back_pitch = pI830->displayWidth; - info.depth_pitch = pI830->displayWidth; + info.pitch = pScrn->displayWidth; + info.back_pitch = pScrn->displayWidth; + info.depth_pitch = pScrn->displayWidth; info.cpp = pI830->cpp; if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT, @@ -209,6 +236,22 @@ I830SetParam(ScrnInfoPtr pScrn, int param, int value) return TRUE; } +static Bool +I830SetHWS(ScrnInfoPtr pScrn, int addr) +{ + I830Ptr pI830 = I830PTR(pScrn); + drmI830HWS hws; + + hws.addr = addr; + + if (drmCommandWrite(pI830->drmSubFD, DRM_I830_HWS_PAGE_ADDR, + &hws, sizeof(drmI830HWS))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "G33 status page initialization Failed\n"); + return FALSE; + } + return TRUE; +} static Bool I830InitVisualConfigs(ScreenPtr pScreen) @@ -216,9 +259,9 @@ I830InitVisualConfigs(ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); int numConfigs = 0; - __GLXvisualConfig *pConfigs = 0; - I830ConfigPrivPtr pI830Configs = 0; - I830ConfigPrivPtr *pI830ConfigPtrs = 0; + __GLXvisualConfig *pConfigs = NULL; + I830ConfigPrivPtr pI830Configs = NULL; + I830ConfigPrivPtr *pI830ConfigPtrs = NULL; int accum, stencil, db, depth; int i; @@ -426,15 +469,24 @@ I830CheckDRIAvailable(ScrnInfoPtr pScrn) /* Check that the GLX, DRI, and DRM modules have been loaded by testing * for known symbols in each module. */ - if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) + if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[dri] %s failed: glx not loaded\n", __FUNCTION__); return FALSE; - if (!xf86LoaderCheckSymbol("DRIScreenInit")) + } + if (!xf86LoaderCheckSymbol("DRIScreenInit")) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[dri] %s failed: dri not loaded\n", __FUNCTION__); return FALSE; - if (!xf86LoaderCheckSymbol("drmAvailable")) + } + if (!xf86LoaderCheckSymbol("drmAvailable")) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[dri] %s failed: libdrm not loaded\n", __FUNCTION__); return FALSE; + } if (!xf86LoaderCheckSymbol("DRIQueryVersion")) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[dri] %s failed (libdri.a too old)\n", "I830CheckDRIAvailable"); + "[dri] %s failed (libdri.a too old)\n", __FUNCTION__); return FALSE; } @@ -443,7 +495,8 @@ I830CheckDRIAvailable(ScrnInfoPtr pScrn) int major, minor, patch; DRIQueryVersion(&major, &minor, &patch); - if (major != DRIINFO_MAJOR_VERSION || minor < DRIINFO_MINOR_VERSION) { + if (major != DRIINFO_MAJOR_VERSION || minor < DRIINFO_MINOR_VERSION || + major < 5) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[dri] %s failed because of a version mismatch.\n" "[dri] libDRI version is %d.%d.%d but version %d.%d.x is needed.\n" @@ -480,34 +533,30 @@ I830DRIScreenInit(ScreenPtr pScreen) pI830->pDRIInfo = pDRIInfo; pI830->LockHeld = 0; - pDRIInfo->drmDriverName = I830KernelDriverName; - if (IS_I96X(pI830)) - pDRIInfo->clientDriverName = I965ClientDriverName; - else - pDRIInfo->clientDriverName = I830ClientDriverName; + pDRIInfo->drmDriverName = "i915"; + if (IS_I965G(pI830)) + pDRIInfo->clientDriverName = "i965"; + else + pDRIInfo->clientDriverName = "i915"; if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) { pDRIInfo->busIdString = DRICreatePCIBusID(pI830->PciInfo); } else { pDRIInfo->busIdString = xalloc(64); sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", +#if XSERVER_LIBPCIACCESS + ((pI830->PciInfo->domain << 8) | pI830->PciInfo->bus), + pI830->PciInfo->dev, pI830->PciInfo->func +#else ((pciConfigPtr) pI830->PciInfo->thisCard)->busnum, ((pciConfigPtr) pI830->PciInfo->thisCard)->devnum, - ((pciConfigPtr) pI830->PciInfo->thisCard)->funcnum); + ((pciConfigPtr) pI830->PciInfo->thisCard)->funcnum +#endif + ); } pDRIInfo->ddxDriverMajorVersion = I830_MAJOR_VERSION; pDRIInfo->ddxDriverMinorVersion = I830_MINOR_VERSION; pDRIInfo->ddxDriverPatchVersion = I830_PATCHLEVEL; -#if 1 /* Remove this soon - see bug 5714 */ - pDRIInfo->frameBufferPhysicalAddress = (char *) pI830->LinearAddr + - pI830->FrontBuffer.Start; - pDRIInfo->frameBufferSize = ROUND_TO_PAGE(pScrn->displayWidth * - pScrn->virtualY * pI830->cpp); -#else - /* For rotation we map a 0 length framebuffer as we remap ourselves later */ - pDRIInfo->frameBufferSize = 0; -#endif - pDRIInfo->frameBufferStride = pScrn->displayWidth * pI830->cpp; pDRIInfo->ddxDrawableTableEntry = I830_MAX_DRAWABLES; if (SAREA_MAX_DRAWABLES < I830_MAX_DRAWABLES) @@ -529,7 +578,7 @@ I830DRIScreenInit(ScreenPtr pScreen) if (!(pI830DRI = (I830DRIPtr) xcalloc(sizeof(I830DRIRec), 1))) { DRIDestroyInfoRec(pI830->pDRIInfo); - pI830->pDRIInfo = 0; + pI830->pDRIInfo = NULL; return FALSE; } pDRIInfo->devPrivate = pI830DRI; @@ -542,42 +591,70 @@ I830DRIScreenInit(ScreenPtr pScreen) pDRIInfo->InitBuffers = I830DRIInitBuffers; pDRIInfo->MoveBuffers = I830DRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + +#if DRIINFO_MAJOR_VERSION > 5 || \ + (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 3) + if (pI830->useEXA) + pDRIInfo->texOffsetStart = I830TexOffsetStart; +#endif + +#if DRI_SUPPORTS_CLIP_NOTIFY + pDRIInfo->ClipNotify = I830DRIClipNotify; +#endif + +#if DRI_DRIVER_FRAMEBUFFER_MAP + /* DRI version is high enough that we can get the DRI code to not + * try to manage the framebuffer. + */ + pDRIInfo->frameBufferPhysicalAddress = 0; + pDRIInfo->frameBufferSize = 0; + pDRIInfo->frameBufferStride = 0; + pDRIInfo->dontMapFrameBuffer = TRUE; +#else + /* Supply a dummy mapping info required by DRI setup. + */ + pDRIInfo->frameBufferPhysicalAddress = (char *) pI830->LinearAddr; + pDRIInfo->frameBufferSize = GTT_PAGE_SIZE; + pDRIInfo->frameBufferStride = 1; +#endif + pDRIInfo->TransitionTo2d = I830DRITransitionTo2d; pDRIInfo->TransitionTo3d = I830DRITransitionTo3d; + +#if !DRI_SUPPORTS_CLIP_NOTIFY pDRIInfo->TransitionSingleToMulti3D = I830DRITransitionSingleToMulti3d; pDRIInfo->TransitionMultiToSingle3D = I830DRITransitionMultiToSingle3d; +#endif /* do driver-independent DRI screen initialization here */ if (!DRIScreenInit(pScreen, pDRIInfo, &pI830->drmSubFD)) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] DRIScreenInit failed. Disabling DRI.\n"); xfree(pDRIInfo->devPrivate); - pDRIInfo->devPrivate = 0; + pDRIInfo->devPrivate = NULL; DRIDestroyInfoRec(pI830->pDRIInfo); - pI830->pDRIInfo = 0; + pI830->pDRIInfo = NULL; return FALSE; } -#if 0 /* disabled now, see frameBufferSize above being set to 0 */ - /* for this driver, get rid of the front buffer mapping now */ - if (xf86LoaderCheckSymbol("DRIGetScreenPrivate")) { - DRIScreenPrivPtr pDRIPriv - = (DRIScreenPrivPtr) DRIGetScreenPrivate(pScreen); - - if (pDRIPriv && pDRIPriv->drmFD && pDRIPriv->hFrameBuffer) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[intel] removing original screen mapping\n"); - drmRmMap(pDRIPriv->drmFD, pDRIPriv->hFrameBuffer); - pDRIPriv->hFrameBuffer = 0; - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[intel] done removing original screen mapping\n"); - } + /* Now, nuke dri.c's dummy frontbuffer map setup if we did that. */ + if (pDRIInfo->frameBufferSize != 0) { + int tmp; + drm_handle_t fb_handle; + void *ptmp; + + /* With the compat method, it will continue to report + * the wrong map out of GetDeviceInfo, which will break AIGLX. + */ + DRIGetDeviceInfo(pScreen, &fb_handle, &tmp, &tmp, &tmp, &tmp, &ptmp); + drmRmMap(pI830->drmSubFD, fb_handle); + + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Removed DRI frontbuffer mapping in compatibility mode.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "DRIGetDeviceInfo will report incorrect frontbuffer " + "handle.\n"); } - else { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[intel] DRIGetScreenPrivate not found!!!!\n"); - } -#endif /* Check the i915 DRM versioning */ { @@ -637,164 +714,67 @@ I830DRIScreenInit(ScreenPtr pScreen) drmFreeVersion(version); return FALSE; } - if (strncmp(version->name, I830KernelDriverName, strlen(I830KernelDriverName))) { - xf86DrvMsg(pScreen->myNum, X_WARNING, - "i830 Kernel module detected, Use the i915 Kernel module instead, aborting DRI init.\n"); + /* Check whether the kernel module attached to the device isn't the + * one we expected (meaning it's the old i830 module). + */ + if (strncmp(version->name, pDRIInfo->drmDriverName, + strlen(pDRIInfo->drmDriverName))) + { + xf86DrvMsg(pScreen->myNum, X_WARNING, + "Detected i830 kernel module. The i915 kernel module " + "is required for DRI. Aborting.\n"); I830DRICloseScreen(pScreen); drmFreeVersion(version); return FALSE; } pI830->drmMinor = version->version_minor; - if (!(pI830->mmModeFlags & I830_KERNEL_TEX)) { - if ((version->version_major > 1) || - ((version->version_minor >= 7) && - (version->version_major == 1))) { - pI830->mmModeFlags |= I830_KERNEL_MM; - } else { - pI830->mmModeFlags |= I830_KERNEL_TEX; - } - } else { - xf86DrvMsg(pScreen->myNum, X_INFO, - "Not enabling the DRM memory manager.\n"); - } +#ifdef DAMAGE + if (pI830->allowPageFlip && pI830->drmMinor < 9) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "DRM version 1.9 or newer required for Page flipping. " + "Disabling.\n"); + pI830->allowPageFlip = FALSE; + } +#endif drmFreeVersion(version); } } - /* - * Backwards compatibility - */ - - if ((pDRIInfo->clientDriverName == I830ClientDriverName) && - (pI830->mmModeFlags & I830_KERNEL_TEX)) { - pDRIInfo->clientDriverName = I830LegacyClientDriverName; - } - return TRUE; } -Bool -I830DRIMapScreenRegions(ScrnInfoPtr pScrn, drmI830Sarea *sarea) -{ - ScreenPtr pScreen = pScrn->pScreen; - I830Ptr pI830 = I830PTR(pScrn); - -#if 1 /* Remove this soon - see bug 5714 */ - pI830->pDRIInfo->frameBufferSize = ROUND_TO_PAGE(pScrn->displayWidth * - pScrn->virtualY * pI830->cpp); -#endif - - /* The I965 isn't ready for the front buffer mapping to be moved around, - * because of issues with rmmap, it seems. - */ - if (!IS_I96X(pI830)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] Mapping front buffer\n"); - if (drmAddMap(pI830->drmSubFD, - (drm_handle_t)(sarea->front_offset + pI830->LinearAddr), - sarea->front_size, - DRM_AGP, - 0, - (drmAddress) &sarea->front_handle) < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] drmAddMap(front_handle) failed. Disabling DRI\n"); - DRICloseScreen(pScreen); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Front Buffer = 0x%08x\n", - (int)sarea->front_handle); - } - - if (drmAddMap(pI830->drmSubFD, - (drm_handle_t)(sarea->back_offset + pI830->LinearAddr), - sarea->back_size, DRM_AGP, 0, - (drmAddress) &sarea->back_handle) < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] drmAddMap(back_handle) failed. Disabling DRI\n"); - DRICloseScreen(pScreen); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Back Buffer = 0x%08x\n", - (int)sarea->back_handle); - - if (drmAddMap(pI830->drmSubFD, - (drm_handle_t)sarea->depth_offset + pI830->LinearAddr, - sarea->depth_size, DRM_AGP, 0, - (drmAddress) &sarea->depth_handle) < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] drmAddMap(depth_handle) failed. Disabling DRI\n"); - DRICloseScreen(pScreen); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Depth Buffer = 0x%08x\n", - (int)sarea->depth_handle); - - if (pI830->mmModeFlags & I830_KERNEL_TEX) { - if (drmAddMap(pI830->drmSubFD, - (drm_handle_t)sarea->tex_offset + pI830->LinearAddr, - sarea->tex_size, DRM_AGP, 0, - (drmAddress) &sarea->tex_handle) < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] drmAddMap(tex_handle) failed. Disabling DRI\n"); - DRICloseScreen(pScreen); - return FALSE; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] textures = 0x%08x\n", - (int)sarea->tex_handle); - } - return TRUE; -} - - -void -I830DRIUnmapScreenRegions(ScrnInfoPtr pScrn, drmI830Sarea *sarea) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (sarea->front_handle) { - drmRmMap(pI830->drmSubFD, sarea->front_handle); - sarea->front_handle = 0; - } - if (sarea->back_handle) { - drmRmMap(pI830->drmSubFD, sarea->back_handle); - sarea->back_handle = 0; - } - if (sarea->depth_handle) { - drmRmMap(pI830->drmSubFD, sarea->depth_handle); - sarea->depth_handle = 0; - } - if (sarea->tex_handle) { - drmRmMap(pI830->drmSubFD, sarea->tex_handle); - sarea->tex_handle = 0; - } -} - static void -I830InitTextureHeap(ScrnInfoPtr pScrn, drmI830Sarea *sarea) +I830InitTextureHeap(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); + if (pI830->textures == NULL) + return; + /* Start up the simple memory manager for agp space */ drmI830MemInitHeap drmHeap; drmHeap.region = I830_MEM_REGION_AGP; drmHeap.start = 0; - drmHeap.size = sarea->tex_size; - + drmHeap.size = pI830->textures->size; + if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT_HEAP, &drmHeap, sizeof(drmHeap))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Failed to initialized agp heap manager\n"); } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] Initialized kernel agp heap manager, %d\n", - sarea->tex_size); + "[drm] Initialized kernel agp heap manager, %ld\n", + pI830->textures->size); I830SetParam(pScrn, I830_SETPARAM_TEX_LRU_LOG_GRANULARITY, - sarea->log_tex_granularity); + pI830->TexGranularity); } } +/** + * Sets up mappings for static, lifetime-fixed allocations, and inital SAREA + * setup. + */ Bool I830DRIDoMappings(ScreenPtr pScreen) { @@ -817,8 +797,8 @@ I830DRIDoMappings(ScreenPtr pScreen) (int)pI830DRI->regs); if (drmAddMap(pI830->drmSubFD, - (drm_handle_t)pI830->LpRing->mem.Start + pI830->LinearAddr, - pI830->LpRing->mem.Size, DRM_AGP, 0, + (drm_handle_t)pI830->LpRing->mem->offset + pI830->LinearAddr, + pI830->LpRing->mem->size, DRM_AGP, 0, (drmAddress) &pI830->ring_map) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(ring_map) failed. Disabling DRI\n"); @@ -833,9 +813,16 @@ I830DRIDoMappings(ScreenPtr pScreen) return FALSE; } + if (IS_G33CLASS(pI830)) { + if (!I830SetHWS(pScrn, pI830->hw_status->offset)) { + DRICloseScreen(pScreen); + return FALSE; + } + } /* init to zero to be safe */ sarea->front_handle = 0; sarea->back_handle = 0; + sarea->third_handle = 0; sarea->depth_handle = 0; sarea->tex_handle = 0; @@ -846,21 +833,31 @@ I830DRIDoMappings(ScreenPtr pScreen) pScrn->pScreen->width = pScrn->virtualX; pScrn->pScreen->height = pScrn->virtualY; - /* this will map the screen regions */ - if (!I830UpdateDRIBuffers(pScrn, sarea)) { - /* screen mappings probably failed */ - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAddMap(screen mappings) failed. Disabling DRI\n"); - return FALSE; + /* If we are using the kernel memory manager, we have to delay SAREA and + * mapping setup until our buffers are pinned at EnterVT, losing the + * opportunity to fail cleanly early on. + */ + if (pI830->memory_manager == NULL) { + if (!i830_update_dri_buffers(pScrn)) { + /* screen mappings probably failed */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAddMap(screen mappings) failed. " + "Disabling DRI\n"); + DRICloseScreen(pScreen); + return FALSE; + } } - if (pI830->PciInfo->chipType != PCI_CHIP_845_G && - pI830->PciInfo->chipType != PCI_CHIP_I830_M) { + if (pI830->allocate_classic_textures) + I830InitTextureHeap(pScrn); + + if (DEVICE_ID(pI830->PciInfo) != PCI_CHIP_845_G && + DEVICE_ID(pI830->PciInfo) != PCI_CHIP_I830_M) { I830SetParam(pScrn, I830_SETPARAM_USE_MI_BATCHBUFFER_START, 1 ); } pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate; - pI830DRI->deviceID = pI830->PciInfo->chipType; + pI830DRI->deviceID = DEVICE_ID(pI830->PciInfo); pI830DRI->width = pScrn->virtualX; pI830DRI->height = pScrn->virtualY; pI830DRI->mem = pScrn->videoRam * 1024; @@ -896,12 +893,20 @@ I830DRIResume(ScreenPtr pScreen) { pI830DRI->irq = drmGetInterruptFromBusID(pI830->drmSubFD, +#if XSERVER_LIBPCIACCESS + ((pI830->PciInfo->domain << 8) | + pI830->PciInfo->bus), + pI830->PciInfo->dev, + pI830->PciInfo->func +#else ((pciConfigPtr) pI830-> PciInfo->thisCard)->busnum, ((pciConfigPtr) pI830-> PciInfo->thisCard)->devnum, ((pciConfigPtr) pI830-> - PciInfo->thisCard)->funcnum); + PciInfo->thisCard)->funcnum +#endif + ); if (drmCtlInstHandler(pI830->drmSubFD, pI830DRI->irq)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -927,6 +932,10 @@ I830DRICloseScreen(ScreenPtr pScreen) DPRINTF(PFX, "I830DRICloseScreen\n"); +#ifdef DAMAGE + REGION_UNINIT(pScreen, &pI830->driRegion); +#endif + if (pI830DRI->irq) { drmCtlUninstHandler(pI830->drmSubFD); pI830DRI->irq = 0; @@ -939,10 +948,10 @@ I830DRICloseScreen(ScreenPtr pScreen) if (pI830->pDRIInfo) { if (pI830->pDRIInfo->devPrivate) { xfree(pI830->pDRIInfo->devPrivate); - pI830->pDRIInfo->devPrivate = 0; + pI830->pDRIInfo->devPrivate = NULL; } DRIDestroyInfoRec(pI830->pDRIInfo); - pI830->pDRIInfo = 0; + pI830->pDRIInfo = NULL; } if (pI830->pVisualConfigs) xfree(pI830->pVisualConfigs); @@ -972,17 +981,6 @@ I830DRIFinishScreenInit(ScreenPtr pScreen) DPRINTF(PFX, "I830DRIFinishScreenInit\n"); - /* Have shadow run only while there is 3d active. - */ -#if 0 - if (pI830->allowPageFlip && pI830->drmMinor >= 1) { - shadowAdd(pScreen, 0, I830DRIShadowUpdate, 0, 0, 0); - } - else -#endif - pI830->allowPageFlip = 0; - - if (!DRIFinishScreenInit(pScreen)) return FALSE; @@ -991,12 +989,20 @@ I830DRIFinishScreenInit(ScreenPtr pScreen) I830DRIPtr pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate; pI830DRI->irq = drmGetInterruptFromBusID(pI830->drmSubFD, +#if XSERVER_LIBPCIACCESS + ((pI830->PciInfo->domain << 8) | + pI830->PciInfo->bus), + pI830->PciInfo->dev, + pI830->PciInfo->func +#else ((pciConfigPtr) pI830-> PciInfo->thisCard)->busnum, ((pciConfigPtr) pI830-> PciInfo->thisCard)->devnum, ((pciConfigPtr) pI830-> - PciInfo->thisCard)->funcnum); + PciInfo->thisCard)->funcnum +#endif + ); if (drmCtlInstHandler(pI830->drmSubFD, pI830DRI->irq)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -1013,7 +1019,62 @@ I830DRIFinishScreenInit(ScreenPtr pScreen) } } -void +#ifdef DAMAGE +/* This should be done *before* XAA syncs, + * Otherwise will have to sync again??? + */ +static void +I830DRIDoRefreshArea (ScrnInfoPtr pScrn, int num, BoxPtr pbox, CARD32 dst) +{ + I830Ptr pI830 = I830PTR(pScrn); + int i, cmd, br13 = (pScrn->displayWidth * pI830->cpp) | (0xcc << 16); + + if (pScrn->bitsPerPixel == 32) { + cmd = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | + XY_SRC_COPY_BLT_WRITE_RGB); + br13 |= 3 << 24; + } else { + cmd = (XY_SRC_COPY_BLT_CMD); + br13 |= 1 << 24; + } + + for (i = 0 ; i < num ; i++, pbox++) { + BEGIN_LP_RING(8); + OUT_RING(cmd); + OUT_RING(br13); + OUT_RING((pbox->y1 << 16) | pbox->x1); + OUT_RING((pbox->y2 << 16) | pbox->x2); + OUT_RING(dst); + OUT_RING((pbox->y1 << 16) | pbox->x1); + OUT_RING(br13 & 0xffff); + OUT_RING(pI830->front_buffer->offset); + ADVANCE_LP_RING(); + } +} + +static void +I830DRIRefreshArea (ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + I830Ptr pI830 = I830PTR(pScrn); + drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen); + + /* Don't want to do this when no 3d is active and pages are + * right-way-round : + */ + if (!pSAREAPriv->pf_active && pSAREAPriv->pf_current_page == 0) + return; + + I830DRIDoRefreshArea(pScrn, num, pbox, pI830->back_buffer->offset); + + if (pI830->third_buffer) { + I830DRIDoRefreshArea(pScrn, num, pbox, pI830->third_buffer->offset); + } + + DamageEmpty(pI830->pDamage); +} +#endif + +static void I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, DRIContextType oldContextType, void *oldContext, DRIContextType newContextType, void *newContext) @@ -1023,21 +1084,102 @@ I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, if (syncType == DRI_3D_SYNC && oldContextType == DRI_2D_CONTEXT && newContextType == DRI_2D_CONTEXT) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("i830DRISwapContext (in)\n"); + *pI830->last_3d = LAST_3D_OTHER; + if (!pScrn->vtSema) return; pI830->LockHeld = 1; - I830RefreshRing(pScrn); + i830_refresh_ring(pScrn); + + I830EmitFlush(pScrn); + +#ifdef DAMAGE + if (!pI830->pDamage && pI830->allowPageFlip) { + PixmapPtr pPix = pScreen->GetScreenPixmap(pScreen); + pI830->pDamage = DamageCreate(NULL, NULL, DamageReportNone, TRUE, + pScreen, pPix); + + if (pI830->pDamage == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No screen damage record, page flipping disabled\n"); + pI830->allowPageFlip = FALSE; + } else { + DamageRegister(&pPix->drawable, pI830->pDamage); + + DamageDamageRegion(&pPix->drawable, + &WindowTable[pScreen->myNum]->winSize); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Damage tracking initialized for page flipping\n"); + } + } +#endif } else if (syncType == DRI_2D_SYNC && oldContextType == DRI_NO_CONTEXT && newContextType == DRI_2D_CONTEXT) { - pI830->LockHeld = 0; +#ifdef DAMAGE + drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen); +#endif + if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("i830DRISwapContext (out)\n"); + + if (!pScrn->vtSema) + return; + +#ifdef DAMAGE + if (pI830->pDamage) { + RegionPtr pDamageReg = DamageRegion(pI830->pDamage); + + if (pDamageReg) { + RegionRec region; + int nrects; + + REGION_NULL(pScreen, ®ion); + REGION_SUBTRACT(pScreen, ®ion, pDamageReg, &pI830->driRegion); + + if ((nrects = REGION_NUM_RECTS(®ion))) + I830DRIRefreshArea(pScrn, nrects, REGION_RECTS(®ion)); + + REGION_UNINIT(pScreen, ®ion); + } + } +#endif + + I830EmitFlush(pScrn); + +#ifdef DAMAGE + /* Try flipping back to the front page if necessary */ + if (sPriv && !sPriv->pf_enabled && sPriv->pf_current_page != 0) { + drm_i915_flip_t flip = { .pipes = 0 }; + + if (sPriv->pf_current_page & (0x3 << 2)) { + sPriv->pf_current_page = sPriv->pf_current_page & 0x3; + sPriv->pf_current_page |= (sPriv->third_handle ? 2 : 1) << 2; + + flip.pipes |= 0x2; + } + + if (sPriv->pf_current_page & 0x3) { + sPriv->pf_current_page = sPriv->pf_current_page & (0x3 << 2); + sPriv->pf_current_page |= sPriv->third_handle ? 2 : 1; + + flip.pipes |= 0x1; + } + + drmCommandWrite(pI830->drmSubFD, DRM_I915_FLIP, &flip, sizeof(flip)); + + if (sPriv->pf_current_page != 0) + xf86DrvMsg(pScreen->myNum, X_WARNING, + "[dri] %s: kernel failed to unflip buffers.\n", __func__); + } +#endif + + pI830->LockHeld = 0; } else if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("i830DRISwapContext (other)\n"); } @@ -1047,7 +1189,6 @@ I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index) { ScreenPtr pScreen = pWin->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); BoxPtr pbox = REGION_RECTS(prgn); int nbox = REGION_NUM_RECTS(prgn); @@ -1059,6 +1200,13 @@ I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index) I830SelectBuffer(pScrn, I830_SELECT_BACK); I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); + + if (I830PTR(pScrn)->third_buffer) { + I830SelectBuffer(pScrn, I830_SELECT_THIRD); + I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); + } + pbox++; } @@ -1085,7 +1233,7 @@ I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index) } I830SelectBuffer(pScrn, I830_SELECT_FRONT); - pI830->AccelInfoRec->NeedToSync = TRUE; + i830MarkSync(pScrn); } /* This routine is a modified form of XAADoBitBlt with the calls to @@ -1115,9 +1263,9 @@ I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, BoxPtr pbox = REGION_RECTS(prgnSrc); int nbox = REGION_NUM_RECTS(prgnSrc); - BoxPtr pboxNew1 = 0; - BoxPtr pboxNew2 = 0; - DDXPointPtr pptNew1 = 0; + BoxPtr pboxNew1 = NULL; + BoxPtr pboxNew2 = NULL; + DDXPointPtr pptNew1 = NULL; DDXPointPtr pptSrc = &ptOldOrg; int dx = pParent->drawable.x - ptOldOrg.x; @@ -1232,7 +1380,11 @@ I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, I830SelectBuffer(pScrn, I830_SELECT_BACK); I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h); - if (!IS_I96X(pI830)) { + if (pI830->third_buffer) { + I830SelectBuffer(pScrn, I830_SELECT_THIRD); + I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h); + } + if (!IS_I965G(pI830)) { I830SelectBuffer(pScrn, I830_SELECT_DEPTH); I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h); } @@ -1248,8 +1400,7 @@ I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, DEALLOCATE_LOCAL(pptNew1); DEALLOCATE_LOCAL(pboxNew1); } - - pI830->AccelInfoRec->NeedToSync = TRUE; + i830MarkSync(pScrn); } /* Use callbacks from dri.c to support pageflipping mode for a single @@ -1259,10 +1410,6 @@ I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, * allocate and free 3d-specific memory on demand. */ - - - - /* Use the miext/shadow module to maintain a list of dirty rectangles. * These are blitted to the back buffer to keep both buffers clean * during page-flipping when the 3d application isn't fullscreen. @@ -1275,99 +1422,21 @@ I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, * might be faster, but seems like a lot more work... */ - -#if 0 -/* This should be done *before* XAA syncs, - * Otherwise will have to sync again??? - */ static void -I830DRIShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf) +I830DRISetPfMask(ScreenPtr pScreen, int pfMask) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - RegionPtr damage = &pBuf->damage; - int i, num = REGION_NUM_RECTS(damage); - BoxPtr pbox = REGION_RECTS(damage); drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScreen); - int cmd, br13; - - /* Don't want to do this when no 3d is active and pages are - * right-way-round : - */ - if (!pSAREAPriv->pf_active && pSAREAPriv->pf_current_page == 0) - return; - br13 = (pScrn->displayWidth * pI830->cpp) | (0xcc << 16); - - if (pScrn->bitsPerPixel == 32) { - cmd = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - XY_SRC_COPY_BLT_WRITE_RGB); - br13 |= 3 << 24; - } else { - cmd = (XY_SRC_COPY_BLT_CMD); - br13 |= 1 << 24; - } - - for (i = 0 ; i < num ; i++, pbox++) { - BEGIN_LP_RING(8); - OUT_RING(cmd); - OUT_RING(br13); - OUT_RING((pbox->y1 << 16) | pbox->x1); - OUT_RING((pbox->y2 << 16) | pbox->x2); - OUT_RING(pI830->BackBuffer.Start); - OUT_RING((pbox->y1 << 16) | pbox->x1); - OUT_RING(br13 & 0xffff); - OUT_RING(pI830->FrontBuffer.Start); - ADVANCE_LP_RING(); - } -} -#endif - -static void -I830EnablePageFlip(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScreen); - - pSAREAPriv->pf_enabled = pI830->allowPageFlip; - pSAREAPriv->pf_active = 0; - - if (pI830->allowPageFlip) { - int br13 = (pScrn->displayWidth * pI830->cpp) | (0xcc << 16); - - BEGIN_LP_RING(8); - if (pScrn->bitsPerPixel == 32) { - OUT_RING(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - XY_SRC_COPY_BLT_WRITE_RGB); - br13 |= 3 << 24; - } else { - OUT_RING(XY_SRC_COPY_BLT_CMD); - br13 |= 1 << 24; - } - - OUT_RING(br13); - OUT_RING(0); - OUT_RING((pScrn->virtualY << 16) | pScrn->virtualX); - OUT_RING(pI830->BackBuffer.Start); - OUT_RING(0); - OUT_RING(br13 & 0xffff); - OUT_RING(pI830->FrontBuffer.Start); - ADVANCE_LP_RING(); - - pSAREAPriv->pf_active = 1; - } + if (pI830->allowPageFlip && pfMask) { + pSAREAPriv->pf_enabled = pI830->allowPageFlip; + pSAREAPriv->pf_active = pfMask; + } else + pSAREAPriv->pf_active = 0; } -static void -I830DisablePageFlip(ScreenPtr pScreen) -{ - drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScreen); - - pSAREAPriv->pf_active = 0; -} - - +#if !DRI_SUPPORTS_CLIP_NOTIFY static void I830DRITransitionSingleToMulti3d(ScreenPtr pScreen) { @@ -1375,16 +1444,20 @@ I830DRITransitionSingleToMulti3d(ScreenPtr pScreen) * -- Field in sarea, plus bumping the window counters. * -- DRM needs to cope with Front-to-Back swapbuffers. */ - I830DisablePageFlip(pScreen); + I830DRISetPfMask(pScreen, 0); } static void I830DRITransitionMultiToSingle3d(ScreenPtr pScreen) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + /* Let the remaining 3d app start page flipping again. */ - I830EnablePageFlip(pScreen); + I830DRISetPfMask(pScreen, pI830->allowPageFlip ? 0x3 : 0); } +#endif /* !DRI_SUPPORTS_CLIP_NOTIFY */ static void I830DRITransitionTo3d(ScreenPtr pScreen) @@ -1392,10 +1465,11 @@ I830DRITransitionTo3d(ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - I830EnablePageFlip(pScreen); - pI830->have3DWindows = 1; -} + I830DRISetPfMask(pScreen, pI830->allowPageFlip ? 0x3 : 0); + pI830->want_vblank_interrupts = TRUE; + I830DRISetVBlankInterrupt(pScrn, TRUE); +} static void I830DRITransitionTo2d(ScreenPtr pScreen) @@ -1404,128 +1478,290 @@ I830DRITransitionTo2d(ScreenPtr pScreen) I830Ptr pI830 = I830PTR(pScrn); drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen); - /* Try flipping back to the front page if necessary */ - if (sPriv->pf_current_page == 1) - drmCommandNone(pI830->drmSubFD, DRM_I830_FLIP); - - /* Shut down shadowing if we've made it back to the front page: - */ - if (sPriv->pf_current_page == 0) { - I830DisablePageFlip(pScreen); - } + I830DRISetPfMask(pScreen, 0); - pI830->have3DWindows = 0; + sPriv->pf_enabled = 0; + pI830->want_vblank_interrupts = FALSE; + I830DRISetVBlankInterrupt(pScrn, FALSE); } - -/** - * Update the SAREA fields with the most recent values. - * This gets called after the screen orientation/rotation changes. - */ -Bool -I830UpdateDRIBuffers(ScrnInfoPtr pScrn, drmI830Sarea *sarea) +#if DRI_SUPPORTS_CLIP_NOTIFY +static void +I830DRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - ScreenPtr pScreen = pScrn->pScreen; - Bool success; - - I830DRIUnmapScreenRegions(pScrn, sarea); + unsigned pfMask = 0; + + REGION_UNINIT(pScreen, &pI830->driRegion); + REGION_NULL(pScreen, &pI830->driRegion); + + if (num > 0) { + drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen); + BoxRec crtcBox[2]; + unsigned numvisible[2] = { 0, 0 }; + int i, j; + + crtcBox[0].x1 = sPriv->planeA_x; + crtcBox[0].y1 = sPriv->planeA_y; + crtcBox[0].x2 = crtcBox[0].x1 + sPriv->planeA_w; + crtcBox[0].y2 = crtcBox[0].y1 + sPriv->planeA_h; + crtcBox[1].x1 = sPriv->planeB_x; + crtcBox[1].y1 = sPriv->planeB_y; + crtcBox[1].x2 = crtcBox[1].x1 + sPriv->planeB_w; + crtcBox[1].y2 = crtcBox[1].y1 + sPriv->planeB_h; + + for (i = 0; i < 2; i++) { + for (j = 0; j < num; j++) { + WindowPtr pWin = ppWin[j]; + + if (pWin) { + if (RECT_IN_REGION(pScreen, &pWin->clipList, &crtcBox[i]) != + rgnOUT) + numvisible[i]++; + + if (i == 0) + REGION_UNION(pScreen, &pI830->driRegion, &pWin->clipList, + &pI830->driRegion); + } + } - sarea->front_tiled = pI830->front_tiled; - sarea->back_tiled = pI830->back_tiled; - sarea->depth_tiled = pI830->depth_tiled; - sarea->rotated_tiled = pI830->rotated_tiled; -#if 0 - sarea->rotated2_tiled = pI830->rotated2_tiled; -#endif + if (numvisible[i] == 1) + pfMask |= 1 << i; + } + } else + REGION_NULL(pScreen, &pI830->driRegion); - if (pI830->rotation == RR_Rotate_0) { - sarea->front_offset = pI830->FrontBuffer.Start; - /* Don't use FrontBuffer.Size here as it includes the pixmap cache area - * Instead, calculate the entire framebuffer. - */ - sarea->front_size = pI830->displayWidth * pScrn->virtualY * pI830->cpp; - } else { - /* Need to deal with rotated2 once we have dual head DRI */ - sarea->front_offset = pI830->RotatedMem.Start; - sarea->front_size = pI830->RotatedMem.Size; - } + I830DRISetPfMask(pScreen, pfMask); +} +#endif /* DRI_SUPPORTS_CLIP_NOTIFY */ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] init sarea width,height = %d x %d (pitch %d)\n", - pScreen->width, pScreen->height,pScrn->displayWidth); +/** + * Update the SAREA fields with current buffer information. + * + * Most of the SAREA fields are already updated by i830_do_addmap(). + * + * This does include other SAREA initialization which will actually be constant + * over the lifetime of the server. + */ +static void +i830_update_sarea(ScrnInfoPtr pScrn, drmI830Sarea *sarea) +{ + ScreenPtr pScreen = pScrn->pScreen; + I830Ptr pI830 = I830PTR(pScrn); sarea->width = pScreen->width; sarea->height = pScreen->height; - sarea->back_offset = pI830->BackBuffer.Start; - sarea->back_size = pI830->BackBuffer.Size; - sarea->depth_offset = pI830->DepthBuffer.Start; - sarea->depth_size = pI830->DepthBuffer.Size; - sarea->tex_offset = pI830->TexMem.Start; - sarea->tex_size = pI830->TexMem.Size; - sarea->log_tex_granularity = pI830->TexGranularity; sarea->pitch = pScrn->displayWidth; sarea->virtualX = pScrn->virtualX; sarea->virtualY = pScrn->virtualY; - switch (pI830->rotation) { - case RR_Rotate_0: - sarea->rotation = 0; - break; - case RR_Rotate_90: - sarea->rotation = 90; - break; - case RR_Rotate_180: - sarea->rotation = 180; - break; - case RR_Rotate_270: - sarea->rotation = 270; - break; - default: - sarea->rotation = 0; + sarea->front_tiled = (pI830->front_buffer->tiling != TILE_NONE); + sarea->back_tiled = (pI830->back_buffer->tiling != TILE_NONE); + if (pI830->third_buffer != NULL) + sarea->third_tiled = (pI830->third_buffer->tiling != TILE_NONE); + else + sarea->third_tiled = FALSE; + sarea->depth_tiled = (pI830->depth_buffer->tiling != TILE_NONE); + sarea->rotated_tiled = FALSE; + + sarea->log_tex_granularity = pI830->TexGranularity; + + sarea->front_bo_handle = -1; + sarea->back_bo_handle = -1; + sarea->third_bo_handle = -1; + sarea->depth_bo_handle = -1; +#ifdef XF86DRI_MM + if (pI830->front_buffer->bo.size) + sarea->front_bo_handle = pI830->front_buffer->bo.handle; + if (pI830->back_buffer->bo.size) + sarea->back_bo_handle = pI830->back_buffer->bo.handle; + if (pI830->third_buffer != NULL && pI830->third_buffer->bo.size) + sarea->third_bo_handle = pI830->third_buffer->bo.handle; + if (pI830->depth_buffer->bo.size) + sarea->depth_bo_handle = pI830->depth_buffer->bo.handle; +#endif + + /* The rotation is now handled entirely by the X Server, so just leave the + * DRI unaware. + */ + sarea->rotation = 0; + sarea->rotated_offset = -1; + sarea->rotated_size = 0; + sarea->rotated_pitch = pScrn->displayWidth; +} + +/** + * Updates the DRI mapping for the given i830_memory struct, with the given + * flags. + */ +static int +i830_do_addmap(ScrnInfoPtr pScrn, i830_memory *mem, + drm_handle_t *sarea_handle, int *sarea_size, int *sarea_offset) +{ + I830Ptr pI830 = I830PTR(pScrn); + int size = mem->size; + + if (mem == pI830->front_buffer) { + /* Workaround for XAA pixmap cache: Don't use front_buffer->size + * and instead, calculate the visible frontbuffer size and round to + * avoid irritating the assertions of older DRI drivers. + */ + size = ROUND_TO_PAGE(pScrn->displayWidth * pScrn->virtualY * + pI830->cpp); + } + + if (*sarea_handle != 0 && + (*sarea_size != size || *sarea_offset != mem->offset)) + { + drmRmMap(pI830->drmSubFD, *sarea_handle); + *sarea_handle = 0; + *sarea_size = 0; + *sarea_offset = 0; + } + + if (*sarea_handle == 0) { + int ret; + + ret = drmAddMap(pI830->drmSubFD, + (drm_handle_t)(mem->offset + pI830->LinearAddr), + size, DRM_AGP, 0, + (drmAddress) sarea_handle); + if (ret == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] mapped %s at 0x%08lx, handle = 0x%08x\n", + mem->name, mem->offset + pI830->LinearAddr, + (int)*sarea_handle); + *sarea_size = size; + *sarea_offset = mem->offset; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[drm] failed to map %s at 0x%08lx\n", + mem->name, mem->offset + pI830->LinearAddr); + return FALSE; + } + } + + return TRUE; +} + +/** + * Updates the DRM mappings with the current buffer information. + * + * Some old DRI drivers may be unprepared for buffers actually moving at + * runtime, which would likely result in bus errors on software fallbacks or + * hangs or misrendering on hardware rendering. + */ +static Bool +i830_update_dri_mappings(ScrnInfoPtr pScrn, drmI830Sarea *sarea) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (!i830_do_addmap(pScrn, pI830->front_buffer, &sarea->front_handle, + &sarea->front_size, &sarea->front_offset)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n"); + return FALSE; + } + + if (!i830_do_addmap(pScrn, pI830->back_buffer, &sarea->back_handle, + &sarea->back_size, &sarea->back_offset)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n"); + return FALSE; + } + + if (pI830->third_buffer) { + if (!i830_do_addmap(pScrn, pI830->third_buffer, &sarea->third_handle, + &sarea->third_size, &sarea->third_offset)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n"); + return FALSE; + } + } else { + sarea->third_handle = 0; + sarea->third_offset = 0; + sarea->third_size = 0; } - if (pI830->rotation == RR_Rotate_0) { - sarea->rotated_offset = -1; - sarea->rotated_size = 0; + + if (!i830_do_addmap(pScrn, pI830->depth_buffer, &sarea->depth_handle, + &sarea->depth_size, &sarea->depth_offset)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n"); + return FALSE; } - else { - sarea->rotated_offset = pI830->FrontBuffer.Start; - sarea->rotated_size = pI830->FrontBuffer.Size; + + if (pI830->allocate_classic_textures) { + if (!i830_do_addmap(pScrn, pI830->textures, &sarea->tex_handle, + &sarea->tex_size, &sarea->tex_offset)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n"); + return FALSE; + } } - /* This is the original pitch */ - sarea->rotated_pitch = pI830->displayWidth; + return TRUE; +} - success = I830DRIMapScreenRegions(pScrn, sarea); +static void +i830_update_screen_private(ScrnInfoPtr pScrn, drmI830Sarea *sarea) +{ + I830Ptr pI830 = I830PTR(pScrn); - if (success && (pI830->mmModeFlags & I830_KERNEL_TEX)) - I830InitTextureHeap(pScrn, sarea); + pI830->pDRIInfo->frameBufferPhysicalAddress = (char *) pI830->LinearAddr; + pI830->pDRIInfo->frameBufferStride = pScrn->displayWidth * pI830->cpp; + pI830->pDRIInfo->frameBufferSize = sarea->front_size; +#if DRI_DRIVER_FRAMEBUFFER_MAP + pI830->pDRIInfo->hFrameBuffer = sarea->front_handle; +#endif +} - return success; +/** + * Update the SAREA fields, DRI mappings, and screen info passed through the + * protocol. + * + * This gets called both at startup and after any of the buffers might have + * been relocated. + */ +Bool +i830_update_dri_buffers(ScrnInfoPtr pScrn) +{ + ScreenPtr pScreen = pScrn->pScreen; + drmI830Sarea *sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen); + Bool success; + + success = i830_update_dri_mappings(pScrn, sarea); + if (!success) + return FALSE; + i830_update_sarea(pScrn, sarea); + i830_update_screen_private(pScrn, sarea); + + return TRUE; } Bool I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on) { I830Ptr pI830 = I830PTR(pScrn); + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); drmI830VBlankPipe pipe; + /* If we have no 3d running, then don't bother enabling the vblank + * interrupt. + */ + if (!pI830->want_vblank_interrupts) + on = FALSE; + if (pI830->directRenderingEnabled && pI830->drmMinor >= 5) { if (on) { - if (pI830->planeEnabled[1]) { + if (xf86_config->num_crtc > 1 && xf86_config->crtc[1]->enabled) if (pI830->drmMinor >= 6) pipe.pipe = DRM_I830_VBLANK_PIPE_A | DRM_I830_VBLANK_PIPE_B; else pipe.pipe = DRM_I830_VBLANK_PIPE_B; - } else + else pipe.pipe = DRM_I830_VBLANK_PIPE_A; } else { pipe.pipe = 0; } if (drmCommandWrite(pI830->drmSubFD, DRM_I830_SET_VBLANK_PIPE, &pipe, sizeof (pipe))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Vblank Pipe Setup Failed\n"); return FALSE; } } @@ -1541,7 +1777,7 @@ I830DRILock(ScrnInfoPtr pScrn) if (pI830->directRenderingEnabled && !pI830->LockHeld) { DRILock(screenInfo.screens[pScrn->scrnIndex], 0); pI830->LockHeld = 1; - I830RefreshRing(pScrn); + i830_refresh_ring(pScrn); return TRUE; } else diff --git a/driver/xf86-video-intel/src/i830_driver.c b/driver/xf86-video-intel/src/i830_driver.c index 09f933be1..5d9d44096 100644 --- a/driver/xf86-video-intel/src/i830_driver.c +++ b/driver/xf86-video-intel/src/i830_driver.c @@ -165,10 +165,14 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define PRINT_MODE_INFO 0 #endif +#include <assert.h> #include <string.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> +#include <stdio.h> +#include <sys/mman.h> +#include <errno.h> #include "xf86.h" #include "xf86_OSproc.h" @@ -190,15 +194,29 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "vbe.h" #include "shadow.h" #include "i830.h" - -#ifdef HAS_MTRR_SUPPORT -#include <asm/mtrr.h> -#endif +#include "i830_display.h" +#include "i830_debug.h" +#include "i830_bios.h" +#include "i830_video.h" #ifdef XF86DRI #include "dri.h" #include <sys/ioctl.h> -#include <errno.h> +#ifdef XF86DRI_MM +#include "xf86mm.h" +#endif +#endif + +#ifdef I830_USE_EXA +const char *I830exaSymbols[] = { + "exaGetVersion", + "exaDriverInit", + "exaDriverFini", + "exaOffscreenAlloc", + "exaOffscreenFree", + "exaWaitSync", + NULL +}; #endif #define BIT(x) (1 << (x)) @@ -206,7 +224,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define NB_OF(x) (sizeof (x) / sizeof (*x)) /* *INDENT-OFF* */ -static SymTabRec I830BIOSChipsets[] = { +static SymTabRec I830Chipsets[] = { {PCI_CHIP_I830_M, "i830"}, {PCI_CHIP_845_G, "845G"}, {PCI_CHIP_I855_GM, "852GM/855GM"}, @@ -216,15 +234,20 @@ static SymTabRec I830BIOSChipsets[] = { {PCI_CHIP_I915_GM, "915GM"}, {PCI_CHIP_I945_G, "945G"}, {PCI_CHIP_I945_GM, "945GM"}, + {PCI_CHIP_I945_GME, "945GME"}, {PCI_CHIP_I965_G, "965G"}, {PCI_CHIP_I965_G_1, "965G"}, {PCI_CHIP_I965_Q, "965Q"}, {PCI_CHIP_I946_GZ, "946GZ"}, {PCI_CHIP_I965_GM, "965GM"}, + {PCI_CHIP_I965_GME, "965GME/GLE"}, + {PCI_CHIP_G33_G, "G33"}, + {PCI_CHIP_Q35_G, "Q35"}, + {PCI_CHIP_Q33_G, "Q33"}, {-1, NULL} }; -static PciChipsets I830BIOSPciChipsets[] = { +static PciChipsets I830PciChipsets[] = { {PCI_CHIP_I830_M, PCI_CHIP_I830_M, RES_SHARED_VGA}, {PCI_CHIP_845_G, PCI_CHIP_845_G, RES_SHARED_VGA}, {PCI_CHIP_I855_GM, PCI_CHIP_I855_GM, RES_SHARED_VGA}, @@ -234,11 +257,16 @@ static PciChipsets I830BIOSPciChipsets[] = { {PCI_CHIP_I915_GM, PCI_CHIP_I915_GM, RES_SHARED_VGA}, {PCI_CHIP_I945_G, PCI_CHIP_I945_G, RES_SHARED_VGA}, {PCI_CHIP_I945_GM, PCI_CHIP_I945_GM, RES_SHARED_VGA}, + {PCI_CHIP_I945_GME, PCI_CHIP_I945_GME, RES_SHARED_VGA}, {PCI_CHIP_I965_G, PCI_CHIP_I965_G, RES_SHARED_VGA}, {PCI_CHIP_I965_G_1, PCI_CHIP_I965_G_1, RES_SHARED_VGA}, {PCI_CHIP_I965_Q, PCI_CHIP_I965_Q, RES_SHARED_VGA}, {PCI_CHIP_I946_GZ, PCI_CHIP_I946_GZ, RES_SHARED_VGA}, {PCI_CHIP_I965_GM, PCI_CHIP_I965_GM, RES_SHARED_VGA}, + {PCI_CHIP_I965_GME, PCI_CHIP_I965_GME, RES_SHARED_VGA}, + {PCI_CHIP_G33_G, PCI_CHIP_G33_G, RES_SHARED_VGA}, + {PCI_CHIP_Q35_G, PCI_CHIP_Q35_G, RES_SHARED_VGA}, + {PCI_CHIP_Q33_G, PCI_CHIP_Q33_G, RES_SHARED_VGA}, {-1, -1, RES_UNDEFINED} }; @@ -249,6 +277,9 @@ static PciChipsets I830BIOSPciChipsets[] = { */ typedef enum { +#if defined(I830_USE_XAA) && defined(I830_USE_EXA) + OPTION_ACCELMETHOD, +#endif OPTION_NOACCEL, OPTION_SW_CURSOR, OPTION_CACHE_LINES, @@ -257,27 +288,20 @@ typedef enum { OPTION_XVIDEO, OPTION_VIDEO_KEY, OPTION_COLOR_KEY, - OPTION_VBE_RESTORE, - OPTION_DISPLAY_INFO, - OPTION_DEVICE_PRESENCE, - OPTION_MONITOR_LAYOUT, - OPTION_CLONE, - OPTION_CLONE_REFRESH, OPTION_CHECKDEVICES, - OPTION_FIXEDPIPE, - OPTION_ROTATE, - OPTION_LINEARALLOC, - OPTION_MERGEDFB, - OPTION_METAMODES, - OPTION_SECONDHSYNC, - OPTION_SECONDVREFRESH, - OPTION_SECONDPOSITION, - OPTION_INTELXINERAMA, + OPTION_MODEDEBUG, + OPTION_FBC, + OPTION_TILING, +#ifdef XF86DRI_MM OPTION_INTELTEXPOOL, - OPTION_INTELMMSIZE +#endif + OPTION_TRIPLEBUFFER, } I830Opts; -static OptionInfoRec I830BIOSOptions[] = { +static OptionInfoRec I830Options[] = { +#if defined(I830_USE_XAA) && defined(I830_USE_EXA) + {OPTION_ACCELMETHOD, "AccelMethod", OPTV_ANYSTR, {0}, FALSE}, +#endif {OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE}, @@ -286,60 +310,37 @@ static OptionInfoRec I830BIOSOptions[] = { {OPTION_XVIDEO, "XVideo", OPTV_BOOLEAN, {0}, TRUE}, {OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE}, {OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE}, - {OPTION_VBE_RESTORE, "VBERestore", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_DISPLAY_INFO,"DisplayInfo", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_DEVICE_PRESENCE,"DevicePresence",OPTV_BOOLEAN,{0}, FALSE}, - {OPTION_MONITOR_LAYOUT, "MonitorLayout", OPTV_ANYSTR,{0}, FALSE}, - {OPTION_CLONE, "Clone", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_CLONE_REFRESH,"CloneRefresh",OPTV_INTEGER, {0}, FALSE}, {OPTION_CHECKDEVICES, "CheckDevices",OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_FIXEDPIPE, "FixedPipe", OPTV_ANYSTR, {0}, FALSE}, - {OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE}, - {OPTION_LINEARALLOC, "LinearAlloc", OPTV_INTEGER, {0}, FALSE}, - {OPTION_MERGEDFB, "MergedFB", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_METAMODES, "MetaModes", OPTV_STRING, {0}, FALSE}, - {OPTION_SECONDHSYNC, "SecondMonitorHorizSync",OPTV_STRING, {0}, FALSE }, - {OPTION_SECONDVREFRESH,"SecondMonitorVertRefresh",OPTV_STRING,{0}, FALSE }, - {OPTION_SECONDPOSITION,"SecondPosition",OPTV_STRING, {0}, FALSE }, - {OPTION_INTELXINERAMA,"MergedXinerama",OPTV_BOOLEAN, {0}, TRUE}, + {OPTION_MODEDEBUG, "ModeDebug", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_FBC, "FramebufferCompression", OPTV_BOOLEAN, {0}, TRUE}, + {OPTION_TILING, "Tiling", OPTV_BOOLEAN, {0}, TRUE}, +#ifdef XF86DRI_MM {OPTION_INTELTEXPOOL,"Legacy3D", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_INTELMMSIZE, "AperTexSize", OPTV_INTEGER, {0}, FALSE}, +#endif + {OPTION_TRIPLEBUFFER, "TripleBuffer", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} }; /* *INDENT-ON* */ -static void I830DisplayPowerManagementSet(ScrnInfoPtr pScrn, - int PowerManagementMode, int flags); -static void I830AdjustFrame(int scrnIndex, int x, int y, int flags); -static Bool I830BIOSCloseScreen(int scrnIndex, ScreenPtr pScreen); -static Bool I830BIOSSaveScreen(ScreenPtr pScreen, int unblack); -static Bool I830BIOSEnterVT(int scrnIndex, int flags); -static Bool I830VESASetVBEMode(ScrnInfoPtr pScrn, int mode, - VbeCRTCInfoBlock *block); -static CARD32 I830CheckDevicesTimer(OsTimerPtr timer, CARD32 now, pointer arg); -static Bool SetPipeAccess(ScrnInfoPtr pScrn); - -extern int I830EntityIndex; - -static Bool I830noPanoramiXExtension = TRUE; -static int I830XineramaNumScreens = 0; -static I830XineramaData *I830XineramadataPtr = NULL; -static int I830XineramaGeneration; +const char *i830_output_type_names[] = { + "Unused", + "Analog", + "DVO", + "SDVO", + "LVDS", + "TVOUT", +}; -static int I830ProcXineramaQueryVersion(ClientPtr client); -static int I830ProcXineramaGetState(ClientPtr client); -static int I830ProcXineramaGetScreenCount(ClientPtr client); -static int I830ProcXineramaGetScreenSize(ClientPtr client); -static int I830ProcXineramaIsActive(ClientPtr client); -static int I830ProcXineramaQueryScreens(ClientPtr client); -static int I830SProcXineramaDispatch(ClientPtr client); +static void i830AdjustFrame(int scrnIndex, int x, int y, int flags); +static Bool I830CloseScreen(int scrnIndex, ScreenPtr pScreen); +static Bool I830EnterVT(int scrnIndex, int flags); +static CARD32 I830CheckDevicesTimer(OsTimerPtr timer, CARD32 now, pointer arg); +static Bool SaveHWState(ScrnInfoPtr pScrn); +static Bool RestoreHWState(ScrnInfoPtr pScrn); /* temporary */ extern void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y); -static const char *SecondMonitorName = "MergedFBMonitor"; - - #ifdef I830DEBUG void I830DPRINTF_stub(const char *filename, int line, const char *function, @@ -364,37 +365,34 @@ I830DPRINTF_stub(const char *filename, int line, const char *function, } #endif /* #ifdef I830DEBUG */ -/* XXX Check if this is still needed. */ +/* Export I830 options to i830 driver where necessary */ const OptionInfoRec * -I830BIOSAvailableOptions(int chipid, int busid) +I830AvailableOptions(int chipid, int busid) { int i; - for (i = 0; I830BIOSPciChipsets[i].PCIid > 0; i++) { - if (chipid == I830BIOSPciChipsets[i].PCIid) - return I830BIOSOptions; + for (i = 0; I830PciChipsets[i].PCIid > 0; i++) { + if (chipid == I830PciChipsets[i].PCIid) + return I830Options; } return NULL; } static Bool -I830BIOSGetRec(ScrnInfoPtr pScrn) +I830GetRec(ScrnInfoPtr pScrn) { I830Ptr pI830; if (pScrn->driverPrivate) return TRUE; pI830 = pScrn->driverPrivate = xnfcalloc(sizeof(I830Rec), 1); - pI830->vesa = xnfcalloc(sizeof(VESARec), 1); return TRUE; } static void -I830BIOSFreeRec(ScrnInfoPtr pScrn) +I830FreeRec(ScrnInfoPtr pScrn) { I830Ptr pI830; - VESAPtr pVesa; - DisplayModePtr mode; if (!pScrn) return; @@ -402,1680 +400,13 @@ I830BIOSFreeRec(ScrnInfoPtr pScrn) return; pI830 = I830PTR(pScrn); - mode = pScrn->modes; - - if (mode) { - do { - if (mode->Private) { - I830ModePrivatePtr mp = (I830ModePrivatePtr) mode->Private; - - xfree(mp); - mode->Private = NULL; - } - mode = mode->next; - } while (mode && mode != pScrn->modes); - } - - if (I830IsPrimary(pScrn)) { - if (pI830->vbeInfo) - VBEFreeVBEInfo(pI830->vbeInfo); - if (pI830->pVbe) - vbeFree(pI830->pVbe); - } - - pVesa = pI830->vesa; - if (pVesa->savedPal) - xfree(pVesa->savedPal); - xfree(pVesa); xfree(pScrn->driverPrivate); pScrn->driverPrivate = NULL; } -static Bool -InRegion(int x, int y, region r) -{ - return (r.x0 <= x) && (x <= r.x1) && (r.y0 <= y) && (y <= r.y1); -} - -static int -I830StrToRanges(range *r, char *s, int max) -{ - float num = 0.0; - int rangenum = 0; - Bool gotdash = FALSE; - Bool nextdash = FALSE; - char *strnum = NULL; - do { - switch(*s) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '.': - if(strnum == NULL) { - strnum = s; - gotdash = nextdash; - nextdash = FALSE; - } - break; - case '-': - case ' ': - case 0: - if(strnum == NULL) break; - sscanf(strnum, "%f", &num); - strnum = NULL; - if(gotdash) { - r[rangenum - 1].hi = num; - } else { - r[rangenum].lo = num; - r[rangenum].hi = num; - rangenum++; - } - if(*s == '-') nextdash = (rangenum != 0); - else if(rangenum >= max) return rangenum; - break; - default: - return 0; - } - - } while(*(s++) != 0); - - return rangenum; -} - -/* Calculate the vertical refresh rate from a mode */ -static float -I830CalcVRate(DisplayModePtr mode) -{ - float hsync, refresh = 0; - - if(mode->HSync > 0.0) - hsync = mode->HSync; - else if(mode->HTotal > 0) - hsync = (float)mode->Clock / (float)mode->HTotal; - else - hsync = 0.0; - - if(mode->VTotal > 0) - refresh = hsync * 1000.0 / mode->VTotal; - - if(mode->Flags & V_INTERLACE) - refresh *= 2.0; - - if(mode->Flags & V_DBLSCAN) - refresh /= 2.0; - - if(mode->VScan > 1) - refresh /= mode->VScan; - - if(mode->VRefresh > 0.0) - refresh = mode->VRefresh; - - if(hsync == 0.0 || refresh == 0.0) return 0.0; - - return refresh; -} - -/* Copy and link two modes (i, j) for mergedfb mode - * (Code base taken from mga driver) - * - * - Copy mode i, merge j to copy of i, link the result to dest - * - Link i and j in private record. - * - If dest is NULL, return value is copy of i linked to itself. - * - For mergedfb auto-config, we only check the dimension - * against virtualX/Y, if they were user-provided. - * - No special treatment required for CRTxxOffs. - * - Provide fake dotclock in order to distinguish between similar - * looking MetaModes (for RandR and VidMode extensions) - * - Set unique VRefresh of dest mode for RandR - */ -static DisplayModePtr -I830CopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest, - DisplayModePtr i, DisplayModePtr j, - int pos) -{ - DisplayModePtr mode; - int dx = 0,dy = 0; - - if(!((mode = xalloc(sizeof(DisplayModeRec))))) return dest; - memcpy(mode, i, sizeof(DisplayModeRec)); - if(!((mode->Private = xalloc(sizeof(I830ModePrivateRec))))) { - xfree(mode); - return dest; - } - ((I830ModePrivatePtr)mode->Private)->merged.First = i; - ((I830ModePrivatePtr)mode->Private)->merged.Second = j; - ((I830ModePrivatePtr)mode->Private)->merged.SecondPosition = pos; - if (((I830ModePrivatePtr)i->Private)->vbeData.mode > 0x30) { - ((I830ModePrivatePtr)mode->Private)->vbeData.mode = ((I830ModePrivatePtr)i->Private)->vbeData.mode; - ((I830ModePrivatePtr)mode->Private)->vbeData.data = ((I830ModePrivatePtr)i->Private)->vbeData.data; - } else { - ((I830ModePrivatePtr)mode->Private)->vbeData.mode = ((I830ModePrivatePtr)j->Private)->vbeData.mode; - ((I830ModePrivatePtr)mode->Private)->vbeData.data = ((I830ModePrivatePtr)j->Private)->vbeData.data; - } - mode->PrivSize = sizeof(I830ModePrivateRec); - - switch(pos) { - case PosLeftOf: - case PosRightOf: - if(!(pScrn->display->virtualX)) { - dx = i->HDisplay + j->HDisplay; - } else { - dx = min(pScrn->virtualX, i->HDisplay + j->HDisplay); - } - dx -= mode->HDisplay; - if(!(pScrn->display->virtualY)) { - dy = max(i->VDisplay, j->VDisplay); - } else { - dy = min(pScrn->virtualY, max(i->VDisplay, j->VDisplay)); - } - dy -= mode->VDisplay; - break; - case PosAbove: - case PosBelow: - if(!(pScrn->display->virtualY)) { - dy = i->VDisplay + j->VDisplay; - } else { - dy = min(pScrn->virtualY, i->VDisplay + j->VDisplay); - } - dy -= mode->VDisplay; - if(!(pScrn->display->virtualX)) { - dx = max(i->HDisplay, j->HDisplay); - } else { - dx = min(pScrn->virtualX, max(i->HDisplay, j->HDisplay)); - } - dx -= mode->HDisplay; - break; - } - mode->HDisplay += dx; - mode->HSyncStart += dx; - mode->HSyncEnd += dx; - mode->HTotal += dx; - mode->VDisplay += dy; - mode->VSyncStart += dy; - mode->VSyncEnd += dy; - mode->VTotal += dy; - - mode->type = M_T_DEFAULT; - - /* Set up as user defined (ie fake that the mode has been named in the - * Modes-list in the screen section; corrects cycling with CTRL-ALT-[-+] - * when source mode has not been listed there.) - */ - mode->type |= M_T_USERDEF; - - /* Set the VRefresh field (in order to make RandR use it for the rates). We - * simply set this to the refresh rate for the First mode (since Second will - * mostly be LCD or TV anyway). - */ - mode->VRefresh = I830CalcVRate(i); - - if( ((mode->HDisplay * ((pScrn->bitsPerPixel + 7) / 8) * mode->VDisplay) > (pScrn->videoRam * 1024)) || - (mode->HDisplay > 4088) || - (mode->VDisplay > 4096) ) { - - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Skipped \"%s\" (%dx%d), not enough video RAM or beyond hardware specs\n", - mode->name, mode->HDisplay, mode->VDisplay); - xfree(mode->Private); - xfree(mode); - - return dest; - } - - /* Now see if the resulting mode would be discarded as a "size" by the - * RandR extension, and increase its clock by 1000 in case it does. - */ - if(dest) { - DisplayModePtr t = dest; - do { - if((t->HDisplay == mode->HDisplay) && - (t->VDisplay == mode->VDisplay) && - ((int)(t->VRefresh + .5) == (int)(mode->VRefresh + .5))) { - mode->VRefresh += 1000.0; - } - t = t->next; - } while((t) && (t != dest)); - } - - /* Provide a fake but unique DotClock in order to trick the vidmode - * extension to allow selecting among a number of modes whose merged result - * looks identical but consists of different modes for First and Second - */ - mode->Clock = (int)(mode->VRefresh * 1000.0); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Merged \"%s\" (%dx%d) and \"%s\" (%dx%d) to %dx%d (%d)\n", - i->name, i->HDisplay, i->VDisplay, j->name, j->HDisplay, j->VDisplay, - mode->HDisplay, mode->VDisplay, (int)mode->VRefresh); - - mode->next = mode; - mode->prev = mode; - - if(dest) { - mode->next = dest->next; /* Insert node after "dest" */ - dest->next->prev = mode; - mode->prev = dest; - dest->next = mode; - } - - return mode; -} - -/* Helper function to find a mode from a given name - * (Code base taken from mga driver) - */ -static DisplayModePtr -I830GetModeFromName(char* str, DisplayModePtr i) -{ - DisplayModePtr c = i; - if(!i) return NULL; - do { - if(strcmp(str, c->name) == 0) return c; - c = c->next; - } while(c != i); - return NULL; -} - -static DisplayModePtr -I830FindWidestTallestMode(DisplayModePtr i, Bool tallest) -{ - DisplayModePtr c = i, d = NULL; - int max = 0; - if(!i) return NULL; - do { - if(tallest) { - if(c->VDisplay > max) { - max = c->VDisplay; - d = c; - } - } else { - if(c->HDisplay > max) { - max = c->HDisplay; - d = c; - } - } - c = c->next; - } while(c != i); - return d; -} - static void -I830FindWidestTallestCommonMode(DisplayModePtr i, DisplayModePtr j, Bool tallest, - DisplayModePtr *a, DisplayModePtr *b) -{ - DisplayModePtr c = i, d; - int max = 0; - Bool foundone; - - (*a) = (*b) = NULL; - - if(!i || !j) return; - - do { - d = j; - foundone = FALSE; - do { - if( (c->HDisplay == d->HDisplay) && - (c->VDisplay == d->VDisplay) ) { - foundone = TRUE; - break; - } - d = d->next; - } while(d != j); - if(foundone) { - if(tallest) { - if(c->VDisplay > max) { - max = c->VDisplay; - (*a) = c; - (*b) = d; - } - } else { - if(c->HDisplay > max) { - max = c->HDisplay; - (*a) = c; - (*b) = d; - } - } - } - c = c->next; - } while(c != i); -} - -static DisplayModePtr -I830GenerateModeListFromLargestModes(ScrnInfoPtr pScrn, - DisplayModePtr i, DisplayModePtr j, - int pos) -{ - I830Ptr pI830 = I830PTR(pScrn); - DisplayModePtr mode1 = NULL; - DisplayModePtr mode2 = NULL; - DisplayModePtr mode3 = NULL; - DisplayModePtr mode4 = NULL; - DisplayModePtr result = NULL; - - /* Now build a default list of MetaModes. - * - Non-clone: If the user enabled NonRectangular, we use the - * largest mode for each First and Second. If not, we use the largest - * common mode for First and Second (if available). Additionally, and - * regardless if the above, we produce a clone mode consisting of - * the largest common mode (if available) in order to use DGA. - */ - - switch(pos) { - case PosLeftOf: - case PosRightOf: - mode1 = I830FindWidestTallestMode(i, FALSE); - mode2 = I830FindWidestTallestMode(j, FALSE); - I830FindWidestTallestCommonMode(i, j, FALSE, &mode3, &mode4); - break; - case PosAbove: - case PosBelow: - mode1 = I830FindWidestTallestMode(i, TRUE); - mode2 = I830FindWidestTallestMode(j, TRUE); - I830FindWidestTallestCommonMode(i, j, TRUE, &mode3, &mode4); - break; - } - - if(mode3 && mode4 && !pI830->NonRect) { - mode1 = mode3; - mode2 = mode2; - } - - if(mode1 && mode2) { - result = I830CopyModeNLink(pScrn, result, mode1, mode2, pos); - } - - return result; -} - -/* Generate the merged-fb mode modelist - * (Taken from mga driver) - */ -static DisplayModePtr -I830GenerateModeListFromMetaModes(ScrnInfoPtr pScrn, char* str, - DisplayModePtr i, DisplayModePtr j, - int pos) -{ - char* strmode = str; - char modename[256]; - Bool gotdash = FALSE; - char gotsep = 0; - int p; - DisplayModePtr mode1 = NULL; - DisplayModePtr mode2 = NULL; - DisplayModePtr result = NULL; - int myslen; - - do { - switch(*str) { - case 0: - case '-': - case '+': - case ' ': - case ',': - case ';': - if(strmode != str) { - - myslen = str - strmode; - if(myslen > 255) myslen = 255; - strncpy(modename, strmode, myslen); - modename[myslen] = 0; - - if(gotdash) { - if(mode1 == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Error parsing MetaModes parameter\n"); - return NULL; - } - mode2 = I830GetModeFromName(modename, j); - if(!mode2) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Mode \"%s\" is not a supported mode for Second\n", modename); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "\t(Skipping metamode \"%s%c%s\")\n", mode1->name, gotsep, modename); - mode1 = NULL; - gotsep = 0; - } - } else { - mode1 = I830GetModeFromName(modename, i); - if(!mode1) { - char* tmps = str; - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Mode \"%s\" is not a supported mode for First\n", modename); - while(*tmps == ' ' || *tmps == ';') tmps++; - /* skip the next mode */ - if(*tmps == '-' || *tmps == '+' || *tmps == ',') { - tmps++; - /* skip spaces */ - while(*tmps == ' ' || *tmps == ';') tmps++; - /* skip modename */ - while(*tmps && *tmps != ' ' && *tmps != ';' && *tmps != '-' && *tmps != '+' && *tmps != ',') tmps++; - myslen = tmps - strmode; - if(myslen > 255) myslen = 255; - strncpy(modename,strmode,myslen); - modename[myslen] = 0; - str = tmps - 1; - } - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "\t(Skipping metamode \"%s\")\n", modename); - mode1 = NULL; - gotsep = 0; - } - } - gotdash = FALSE; - } - strmode = str + 1; - gotdash |= (*str == '-' || *str == '+' || *str == ','); - if (*str == '-' || *str == '+' || *str == ',') - gotsep = *str; - - if(*str != 0) break; - /* Fall through otherwise */ - - default: - if(!gotdash && mode1) { - p = pos ; - if(!mode2) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Mode \"%s\" is not a supported mode for Second\n", mode1->name); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "\t(Skipping metamode \"%s\")\n", modename); - mode1 = NULL; - } else { - result = I830CopyModeNLink(pScrn, result, mode1, mode2, p); - mode1 = NULL; - mode2 = NULL; - } - gotsep = 0; - } - break; - - } - - } while(*(str++) != 0); - - return result; -} - -static DisplayModePtr -I830GenerateModeList(ScrnInfoPtr pScrn, char* str, - DisplayModePtr i, DisplayModePtr j, - int pos) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if(str != NULL) { - return(I830GenerateModeListFromMetaModes(pScrn, str, i, j, pos)); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "No MetaModes given, linking %s modes by default\n", - (pI830->NonRect ? - (((pos == PosLeftOf) || (pos == PosRightOf)) ? "widest" : "tallest") - : - (((pos == PosLeftOf) || (pos == PosRightOf)) ? "widest common" : "tallest common")) ); - return(I830GenerateModeListFromLargestModes(pScrn, i, j, pos)); - } -} - -static void -I830RecalcDefaultVirtualSize(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - DisplayModePtr mode, bmode; - int maxh, maxv; - static const char *str = "MergedFB: Virtual %s %d\n"; - static const char *errstr = "Virtual %s to small for given SecondPosition offset\n"; - - mode = bmode = pScrn->modes; - maxh = maxv = 0; - do { - if(mode->HDisplay > maxh) maxh = mode->HDisplay; - if(mode->VDisplay > maxv) maxv = mode->VDisplay; - mode = mode->next; - } while(mode != bmode); - - maxh += pI830->FirstXOffs + pI830->SecondXOffs; - maxv += pI830->FirstYOffs + pI830->SecondYOffs; - - if(!(pScrn->display->virtualX)) { - if(maxh > 4088) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Virtual width with SecondPosition offset beyond hardware specs\n"); - pI830->FirstXOffs = pI830->SecondXOffs = 0; - maxh -= (pI830->FirstXOffs + pI830->SecondXOffs); - } - pScrn->virtualX = maxh; - pScrn->displayWidth = maxh; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, str, "width", maxh); - } else { - if(maxh < pScrn->display->virtualX) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, errstr, "width"); - pI830->FirstXOffs = pI830->SecondXOffs = 0; - } - } - - if(!(pScrn->display->virtualY)) { - pScrn->virtualY = maxv; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, str, "height", maxv); - } else { - if(maxv < pScrn->display->virtualY) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, errstr, "height"); - pI830->FirstYOffs = pI830->SecondYOffs = 0; - } - } -} - -#define SDMPTR(x) ((I830ModePrivatePtr)x->currentMode->Private)->merged -#define CDMPTR ((I830ModePrivatePtr)pI830->currentMode->Private)->merged - -#define BOUND(test,low,hi) \ - { \ - if((test) < (low)) (test) = (low); \ - if((test) > (hi)) (test) = (hi); \ - } - -#define REBOUND(low,hi,test) \ - { \ - if((test) < (low)) { \ - (hi) += (test)-(low); \ - (low) = (test); \ - } \ - if((test) > (hi)) { \ - (low) += (test)-(hi); \ - (hi) = (test); \ - } \ - } - - -static void -I830MergedPointerMoved(int scrnIndex, int x, int y) -{ - ScrnInfoPtr pScrn1 = xf86Screens[scrnIndex]; - I830Ptr pI830 = I830PTR(pScrn1); - ScrnInfoPtr pScrn2 = pI830->pScrn_2; - region out, in1, in2, f2, f1; - int deltax, deltay; - int temp1, temp2; - int old1x0, old1y0, old2x0, old2y0; - int FirstXOffs = 0, FirstYOffs = 0, SecondXOffs = 0, SecondYOffs = 0; - int HVirt = pScrn1->virtualX; - int VVirt = pScrn1->virtualY; - int sigstate; - Bool doit = FALSE, HaveNonRect = FALSE, HaveOffsRegions = FALSE; - int pos = ((I830MergedDisplayModePtr)pI830->currentMode->Private)->SecondPosition; - - if(pI830->DGAactive) { - return; - /* DGA: There is no cursor and no panning while DGA is active. */ - } else { - FirstXOffs = pI830->FirstXOffs; - FirstYOffs = pI830->FirstYOffs; - SecondXOffs = pI830->SecondXOffs; - SecondYOffs = pI830->SecondYOffs; - HaveNonRect = pI830->HaveNonRect; - HaveOffsRegions = pI830->HaveOffsRegions; - } - - /* Check if the pointer is inside our dead areas */ - if((pI830->MouseRestrictions) && !I830noPanoramiXExtension) { - if(HaveNonRect) { - if(InRegion(x, y, pI830->NonRectDead)) { - switch(pos) { - case PosLeftOf: - case PosRightOf: y = pI830->NonRectDead.y0 - 1; - doit = TRUE; - break; - case PosAbove: - case PosBelow: x = pI830->NonRectDead.x0 - 1; - doit = TRUE; - default: break; - } - } - } - if(HaveOffsRegions) { - if(InRegion(x, y, pI830->OffDead1)) { - switch(pos) { - case PosLeftOf: - case PosRightOf: y = pI830->OffDead1.y1; - doit = TRUE; - break; - case PosAbove: - case PosBelow: x = pI830->OffDead1.x1; - doit = TRUE; - default: break; - } - } else if(InRegion(x, y, pI830->OffDead2)) { - switch(pos) { - case PosLeftOf: - case PosRightOf: y = pI830->OffDead2.y0 - 1; - doit = TRUE; - break; - case PosAbove: - case PosBelow: x = pI830->OffDead2.x0 - 1; - doit = TRUE; - default: break; - } - } - } - if(doit) { - UpdateCurrentTime(); - sigstate = xf86BlockSIGIO(); - miPointerAbsoluteCursor(x, y, currentTime.milliseconds); - xf86UnblockSIGIO(sigstate); - return; - } - } - - f1.x0 = old1x0 = pI830->FirstframeX0; - f1.x1 = pI830->FirstframeX1; - f1.y0 = old1y0 = pI830->FirstframeY0; - f1.y1 = pI830->FirstframeY1; - f2.x0 = old2x0 = pScrn2->frameX0; - f2.x1 = pScrn2->frameX1; - f2.y0 = old2y0 = pScrn2->frameY0; - f2.y1 = pScrn2->frameY1; - - /* Define the outer region. Crossing this causes all frames to move */ - out.x0 = pScrn1->frameX0; - out.x1 = pScrn1->frameX1; - out.y0 = pScrn1->frameY0; - out.y1 = pScrn1->frameY1; - - /* - * Define the inner sliding window. Being outsize both frames but - * inside the outer clipping window will slide corresponding frame - */ - in1 = out; - in2 = out; - switch(pos) { - case PosLeftOf: - in1.x0 = f1.x0; - in2.x1 = f2.x1; - break; - case PosRightOf: - in1.x1 = f1.x1; - in2.x0 = f2.x0; - break; - case PosBelow: - in1.y1 = f1.y1; - in2.y0 = f2.y0; - break; - case PosAbove: - in1.y0 = f1.y0; - in2.y1 = f2.y1; - break; - } - - deltay = 0; - deltax = 0; - - if(InRegion(x, y, out)) { /* inside outer region */ - - if(InRegion(x, y, in1) && !InRegion(x, y, f1)) { - REBOUND(f1.x0, f1.x1, x); - REBOUND(f1.y0, f1.y1, y); - deltax = 1; - } - if(InRegion(x, y, in2) && !InRegion(x, y, f2)) { - REBOUND(f2.x0, f2.x1, x); - REBOUND(f2.y0, f2.y1, y); - deltax = 1; - } - - } else { /* outside outer region */ - - if(out.x0 > x) { - deltax = x - out.x0; - } - if(out.x1 < x) { - deltax = x - out.x1; - } - if(deltax) { - pScrn1->frameX0 += deltax; - pScrn1->frameX1 += deltax; - f1.x0 += deltax; - f1.x1 += deltax; - f2.x0 += deltax; - f2.x1 += deltax; - } - - if(out.y0 > y) { - deltay = y - out.y0; - } - if(out.y1 < y) { - deltay = y - out.y1; - } - if(deltay) { - pScrn1->frameY0 += deltay; - pScrn1->frameY1 += deltay; - f1.y0 += deltay; - f1.y1 += deltay; - f2.y0 += deltay; - f2.y1 += deltay; - } - - switch(pos) { - case PosLeftOf: - if(x >= f1.x0) { REBOUND(f1.y0, f1.y1, y); } - if(x <= f2.x1) { REBOUND(f2.y0, f2.y1, y); } - break; - case PosRightOf: - if(x <= f1.x1) { REBOUND(f1.y0, f1.y1, y); } - if(x >= f2.x0) { REBOUND(f2.y0, f2.y1, y); } - break; - case PosBelow: - if(y <= f1.y1) { REBOUND(f1.x0, f1.x1, x); } - if(y >= f2.y0) { REBOUND(f2.x0, f2.x1, x); } - break; - case PosAbove: - if(y >= f1.y0) { REBOUND(f1.x0, f1.x1, x); } - if(y <= f2.y1) { REBOUND(f2.x0, f2.x1, x); } - break; - } - - } - - if(deltax || deltay) { - pI830->FirstframeX0 = f1.x0; - pI830->FirstframeY0 = f1.y0; - pScrn2->frameX0 = f2.x0; - pScrn2->frameY0 = f2.y0; - - switch(pos) { - case PosLeftOf: - case PosRightOf: - if(FirstYOffs || SecondYOffs || HaveNonRect) { - if(pI830->FirstframeY0 != old1y0) { - if(pI830->FirstframeY0 < FirstYOffs) - pI830->FirstframeY0 = FirstYOffs; - - temp1 = pI830->FirstframeY0 + CDMPTR.First->VDisplay; - temp2 = min((VVirt - SecondYOffs), (FirstYOffs + pI830->MBXNR1YMAX)); - if(temp1 > temp2) - pI830->FirstframeY0 -= (temp1 - temp2); - } - if(pScrn2->frameY0 != old2y0) { - if(pScrn2->frameY0 < SecondYOffs) - pScrn2->frameY0 = SecondYOffs; - - temp1 = pScrn2->frameY0 + CDMPTR.Second->VDisplay; - temp2 = min((VVirt - FirstYOffs), (SecondYOffs + pI830->MBXNR2YMAX)); - if(temp1 > temp2) - pScrn2->frameY0 -= (temp1 - temp2); - } - } - break; - case PosBelow: - case PosAbove: - if(FirstXOffs || SecondXOffs || HaveNonRect) { - if(pI830->FirstframeX0 != old1x0) { - if(pI830->FirstframeX0 < FirstXOffs) - pI830->FirstframeX0 = FirstXOffs; - - temp1 = pI830->FirstframeX0 + CDMPTR.First->HDisplay; - temp2 = min((HVirt - SecondXOffs), (FirstXOffs + pI830->MBXNR1XMAX)); - if(temp1 > temp2) - pI830->FirstframeX0 -= (temp1 - temp2); - } - if(pScrn2->frameX0 != old2x0) { - if(pScrn2->frameX0 < SecondXOffs) - pScrn2->frameX0 = SecondXOffs; - - temp1 = pScrn2->frameX0 + CDMPTR.Second->HDisplay; - temp2 = min((HVirt - FirstXOffs), (SecondXOffs + pI830->MBXNR2XMAX)); - if(temp1 > temp2) - pScrn2->frameX0 -= (temp1 - temp2); - } - } - break; - } - - pI830->FirstframeX1 = pI830->FirstframeX0 + CDMPTR.First->HDisplay - 1; - pI830->FirstframeY1 = pI830->FirstframeY0 + CDMPTR.First->VDisplay - 1; - pScrn2->frameX1 = pScrn2->frameX0 + CDMPTR.Second->HDisplay - 1; - pScrn2->frameY1 = pScrn2->frameY0 + CDMPTR.Second->VDisplay - 1; - - /* No need to update pScrn1->frame?1, done above */ - if (pI830->pipe == 0) { - OUTREG(DSPABASE, pI830->FrontBuffer.Start + ((pI830->FirstframeY0 * pScrn1->displayWidth + pI830->FirstframeX0) * pI830->cpp)); - OUTREG(DSPBBASE, pI830->FrontBuffer.Start + ((pScrn2->frameY0 * pScrn1->displayWidth + pScrn2->frameX0) * pI830->cpp)); - } else { - OUTREG(DSPBBASE, pI830->FrontBuffer.Start + ((pI830->FirstframeY0 * pScrn1->displayWidth + pI830->FirstframeX0) * pI830->cpp)); - OUTREG(DSPABASE, pI830->FrontBuffer.Start + ((pScrn2->frameY0 * pScrn1->displayWidth + pScrn2->frameX0) * pI830->cpp)); - } - } -} - -static void -I830AdjustFrameMerged(int scrnIndex, int x, int y, int flags) -{ - ScrnInfoPtr pScrn1 = xf86Screens[scrnIndex]; - I830Ptr pI830 = I830PTR(pScrn1); - ScrnInfoPtr pScrn2 = pI830->pScrn_2; - int HTotal = pI830->currentMode->HDisplay; - int VTotal = pI830->currentMode->VDisplay; - int HMax = HTotal; - int VMax = VTotal; - int HVirt = pScrn1->virtualX; - int VVirt = pScrn1->virtualY; - int x1 = x, x2 = x; - int y1 = y, y2 = y; - int FirstXOffs = 0, FirstYOffs = 0, SecondXOffs = 0, SecondYOffs = 0; - int MBXNR1XMAX = 65536, MBXNR1YMAX = 65536, MBXNR2XMAX = 65536, MBXNR2YMAX = 65536; - - if(pI830->DGAactive) { - HVirt = pScrn1->displayWidth; - VVirt = pScrn1->virtualY; - } else { - FirstXOffs = pI830->FirstXOffs; - FirstYOffs = pI830->FirstYOffs; - SecondXOffs = pI830->SecondXOffs; - SecondYOffs = pI830->SecondYOffs; - MBXNR1XMAX = pI830->MBXNR1XMAX; - MBXNR1YMAX = pI830->MBXNR1YMAX; - MBXNR2XMAX = pI830->MBXNR2XMAX; - MBXNR2YMAX = pI830->MBXNR2YMAX; - } - - BOUND(x, 0, HVirt - HTotal); - BOUND(y, 0, VVirt - VTotal); - BOUND(x1, FirstXOffs, min(HVirt, MBXNR1XMAX + FirstXOffs) - min(HTotal, MBXNR1XMAX) - SecondXOffs); - BOUND(y1, FirstYOffs, min(VVirt, MBXNR1YMAX + FirstYOffs) - min(VTotal, MBXNR1YMAX) - SecondYOffs); - BOUND(x2, SecondXOffs, min(HVirt, MBXNR2XMAX + SecondXOffs) - min(HTotal, MBXNR2XMAX) - FirstXOffs); - BOUND(y2, SecondYOffs, min(VVirt, MBXNR2YMAX + SecondYOffs) - min(VTotal, MBXNR2YMAX) - FirstYOffs); - - switch(SDMPTR(pScrn1).SecondPosition) { - case PosLeftOf: - pScrn2->frameX0 = x2; - BOUND(pScrn2->frameY0, y2, y2 + min(VMax, MBXNR2YMAX) - CDMPTR.Second->VDisplay); - pI830->FirstframeX0 = x1 + CDMPTR.Second->HDisplay; - BOUND(pI830->FirstframeY0, y1, y1 + min(VMax, MBXNR1YMAX) - CDMPTR.First->VDisplay); - break; - case PosRightOf: - pI830->FirstframeX0 = x1; - BOUND(pI830->FirstframeY0, y1, y1 + min(VMax, MBXNR1YMAX) - CDMPTR.First->VDisplay); - pScrn2->frameX0 = x2 + CDMPTR.First->HDisplay; - BOUND(pScrn2->frameY0, y2, y2 + min(VMax, MBXNR2YMAX) - CDMPTR.Second->VDisplay); - break; - case PosAbove: - BOUND(pScrn2->frameX0, x2, x2 + min(HMax, MBXNR2XMAX) - CDMPTR.Second->HDisplay); - pScrn2->frameY0 = y2; - BOUND(pI830->FirstframeX0, x1, x1 + min(HMax, MBXNR1XMAX) - CDMPTR.First->HDisplay); - pI830->FirstframeY0 = y1 + CDMPTR.Second->VDisplay; - break; - case PosBelow: - BOUND(pI830->FirstframeX0, x1, x1 + min(HMax, MBXNR1XMAX) - CDMPTR.First->HDisplay); - pI830->FirstframeY0 = y1; - BOUND(pScrn2->frameX0, x2, x2 + min(HMax, MBXNR2XMAX) - CDMPTR.Second->HDisplay); - pScrn2->frameY0 = y2 + CDMPTR.First->VDisplay; - break; - } - - BOUND(pI830->FirstframeX0, 0, HVirt - CDMPTR.First->HDisplay); - BOUND(pI830->FirstframeY0, 0, VVirt - CDMPTR.First->VDisplay); - BOUND(pScrn2->frameX0, 0, HVirt - CDMPTR.Second->HDisplay); - BOUND(pScrn2->frameY0, 0, VVirt - CDMPTR.Second->VDisplay); - - pScrn1->frameX0 = x; - pScrn1->frameY0 = y; - - pI830->FirstframeX1 = pI830->FirstframeX0 + CDMPTR.First->HDisplay - 1; - pI830->FirstframeY1 = pI830->FirstframeY0 + CDMPTR.First->VDisplay - 1; - pScrn2->frameX1 = pScrn2->frameX0 + CDMPTR.Second->HDisplay - 1; - pScrn2->frameY1 = pScrn2->frameY0 + CDMPTR.Second->VDisplay - 1; - - pScrn1->frameX1 = pScrn1->frameX0 + pI830->currentMode->HDisplay - 1; - pScrn1->frameY1 = pScrn1->frameY0 + pI830->currentMode->VDisplay - 1; - pScrn1->frameX1 += FirstXOffs + SecondXOffs; - pScrn1->frameY1 += FirstYOffs + SecondYOffs; -} - -/* Pseudo-Xinerama extension for MergedFB mode */ -static void -I830UpdateXineramaScreenInfo(ScrnInfoPtr pScrn1) -{ - I830Ptr pI830 = I830PTR(pScrn1); - int scrnnum1 = 0, scrnnum2 = 1; - int x1=0, x2=0, y1=0, y2=0, h1=0, h2=0, w1=0, w2=0; - int realvirtX, realvirtY; - DisplayModePtr currentMode, firstMode; - Bool infochanged = FALSE; - Bool usenonrect = pI830->NonRect; - const char *rectxine = "\t... setting up rectangular Xinerama layout\n"; -#ifdef XF86DRI - drmI830Sarea *sarea = NULL; - - if (pI830->directRenderingEnabled) { - sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScrn1->pScreen); - } -#endif - - pI830->MBXNR1XMAX = pI830->MBXNR1YMAX = pI830->MBXNR2XMAX = pI830->MBXNR2YMAX = 65536; - pI830->HaveNonRect = pI830->HaveOffsRegions = FALSE; - - if(!pI830->MergedFB) { -#ifdef XF86DRI - if (pI830->directRenderingEnabled) { - sarea->pipeA_x = sarea->pipeA_y = sarea->pipeB_x = sarea->pipeB_y = 0; - - if (pI830->planeEnabled[0]) { - sarea->pipeA_w = pScrn1->virtualX; - sarea->pipeA_h = pScrn1->virtualY; - } else { - sarea->pipeA_w = 0; - sarea->pipeA_h = 0; - } - - if (pI830->planeEnabled[1]) { - sarea->pipeB_w = pScrn1->virtualX; - sarea->pipeB_h = pScrn1->virtualY; - } else { - sarea->pipeB_w = 0; - sarea->pipeB_h = 0; - } - } -#endif - - return; - } - - if (I830noPanoramiXExtension || !I830XineramadataPtr) { -#ifdef XF86DRI - if (!pI830->directRenderingEnabled) -#endif - return; - } - - if(pI830->SecondIsScrn0) { - scrnnum1 = 1; - scrnnum2 = 0; - } - - /* Attention: Usage of RandR may lead to virtual X and Y dimensions - * actually smaller than our MetaModes. To avoid this, we calculate - * the max* fields here (and not somewhere else, like in CopyNLink) - * - * *** Note: RandR is disabled if one of CRTxxOffs is non-zero. - */ - - /* "Real" virtual: Virtual without the Offset */ - realvirtX = pScrn1->virtualX - pI830->FirstXOffs - pI830->SecondXOffs; - realvirtY = pScrn1->virtualY - pI830->FirstYOffs - pI830->SecondYOffs; - - if((pI830->I830XineramaVX != pScrn1->virtualX) || (pI830->I830XineramaVY != pScrn1->virtualY)) { - - if(!(pScrn1->modes)) return; - - pI830->maxFirst_X1 = pI830->maxFirst_X2 = 0; - pI830->maxFirst_Y1 = pI830->maxFirst_Y2 = 0; - pI830->maxSecond_X1 = pI830->maxSecond_X2 = 0; - pI830->maxSecond_Y1 = pI830->maxSecond_Y2 = 0; - - currentMode = firstMode = pScrn1->modes; - - do { - - DisplayModePtr p = currentMode->next; - DisplayModePtr i = ((I830ModePrivatePtr)currentMode->Private)->merged.First; - DisplayModePtr j = ((I830ModePrivatePtr)currentMode->Private)->merged.Second; - - if((currentMode->HDisplay <= realvirtX) && (currentMode->VDisplay <= realvirtY) && - (i->HDisplay <= realvirtX) && (j->HDisplay <= realvirtX) && - (i->VDisplay <= realvirtY) && (j->VDisplay <= realvirtY)) { - - if(pI830->maxFirst_X1 == i->HDisplay) { - if(pI830->maxFirst_X2 < j->HDisplay) { - pI830->maxFirst_X2 = j->HDisplay; /* Widest Second mode displayed with widest CRT1 mode */ - } - } else if(pI830->maxFirst_X1 < i->HDisplay) { - pI830->maxFirst_X1 = i->HDisplay; /* Widest CRT1 mode */ - pI830->maxFirst_X2 = j->HDisplay; - } - if(pI830->maxSecond_X2 == j->HDisplay) { - if(pI830->maxSecond_X1 < i->HDisplay) { - pI830->maxSecond_X1 = i->HDisplay; /* Widest First mode displayed with widest Second mode */ - } - } else if(pI830->maxSecond_X2 < j->HDisplay) { - pI830->maxSecond_X2 = j->HDisplay; /* Widest Second mode */ - pI830->maxSecond_X1 = i->HDisplay; - } - if(pI830->maxFirst_Y1 == i->VDisplay) { /* Same as above, but tallest instead of widest */ - if(pI830->maxFirst_Y2 < j->VDisplay) { - pI830->maxFirst_Y2 = j->VDisplay; - } - } else if(pI830->maxFirst_Y1 < i->VDisplay) { - pI830->maxFirst_Y1 = i->VDisplay; - pI830->maxFirst_Y2 = j->VDisplay; - } - if(pI830->maxSecond_Y2 == j->VDisplay) { - if(pI830->maxSecond_Y1 < i->VDisplay) { - pI830->maxSecond_Y1 = i->VDisplay; - } - } else if(pI830->maxSecond_Y2 < j->VDisplay) { - pI830->maxSecond_Y2 = j->VDisplay; - pI830->maxSecond_Y1 = i->VDisplay; - } - } - currentMode = p; - - } while((currentMode) && (currentMode != firstMode)); - - pI830->I830XineramaVX = pScrn1->virtualX; - pI830->I830XineramaVY = pScrn1->virtualY; - infochanged = TRUE; - - } - - if((usenonrect) && pI830->maxFirst_X1) { - switch(pI830->SecondPosition) { - case PosLeftOf: - case PosRightOf: - if((pI830->maxFirst_Y1 != realvirtY) && (pI830->maxSecond_Y2 != realvirtY)) { - usenonrect = FALSE; - } - break; - case PosAbove: - case PosBelow: - if((pI830->maxFirst_X1 != realvirtX) && (pI830->maxSecond_X2 != realvirtX)) { - usenonrect = FALSE; - } - break; - } - if(infochanged && !usenonrect) { - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, - "Virtual screen size does not match maximum display modes...\n"); - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, rectxine); - - } - } else if(infochanged && usenonrect) { - usenonrect = FALSE; - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, - "Only clone modes available for this virtual screen size...\n"); - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, rectxine); - } - - if(pI830->maxFirst_X1) { /* Means we have at least one non-clone mode */ - switch(pI830->SecondPosition) { - case PosLeftOf: - x1 = min(pI830->maxFirst_X2, pScrn1->virtualX - pI830->maxFirst_X1); - if(x1 < 0) x1 = 0; - y1 = pI830->FirstYOffs; - w1 = pScrn1->virtualX - x1; - h1 = realvirtY; - if((usenonrect) && (pI830->maxFirst_Y1 != realvirtY)) { - h1 = pI830->MBXNR1YMAX = pI830->maxFirst_Y1; - pI830->NonRectDead.x0 = x1; - pI830->NonRectDead.x1 = x1 + w1 - 1; - pI830->NonRectDead.y0 = y1 + h1; - pI830->NonRectDead.y1 = pScrn1->virtualY - 1; - pI830->HaveNonRect = TRUE; - } - x2 = 0; - y2 = pI830->SecondYOffs; - w2 = max(pI830->maxSecond_X2, pScrn1->virtualX - pI830->maxSecond_X1); - if(w2 > pScrn1->virtualX) w2 = pScrn1->virtualX; - h2 = realvirtY; - if((usenonrect) && (pI830->maxSecond_Y2 != realvirtY)) { - h2 = pI830->MBXNR2YMAX = pI830->maxSecond_Y2; - pI830->NonRectDead.x0 = x2; - pI830->NonRectDead.x1 = x2 + w2 - 1; - pI830->NonRectDead.y0 = y2 + h2; - pI830->NonRectDead.y1 = pScrn1->virtualY - 1; - pI830->HaveNonRect = TRUE; - } - break; - case PosRightOf: - x1 = 0; - y1 = pI830->FirstYOffs; - w1 = max(pI830->maxFirst_X1, pScrn1->virtualX - pI830->maxFirst_X2); - if(w1 > pScrn1->virtualX) w1 = pScrn1->virtualX; - h1 = realvirtY; - if((usenonrect) && (pI830->maxFirst_Y1 != realvirtY)) { - h1 = pI830->MBXNR1YMAX = pI830->maxFirst_Y1; - pI830->NonRectDead.x0 = x1; - pI830->NonRectDead.x1 = x1 + w1 - 1; - pI830->NonRectDead.y0 = y1 + h1; - pI830->NonRectDead.y1 = pScrn1->virtualY - 1; - pI830->HaveNonRect = TRUE; - } - x2 = min(pI830->maxSecond_X1, pScrn1->virtualX - pI830->maxSecond_X2); - if(x2 < 0) x2 = 0; - y2 = pI830->SecondYOffs; - w2 = pScrn1->virtualX - x2; - h2 = realvirtY; - if((usenonrect) && (pI830->maxSecond_Y2 != realvirtY)) { - h2 = pI830->MBXNR2YMAX = pI830->maxSecond_Y2; - pI830->NonRectDead.x0 = x2; - pI830->NonRectDead.x1 = x2 + w2 - 1; - pI830->NonRectDead.y0 = y2 + h2; - pI830->NonRectDead.y1 = pScrn1->virtualY - 1; - pI830->HaveNonRect = TRUE; - } - break; - case PosAbove: - x1 = pI830->FirstXOffs; - y1 = min(pI830->maxFirst_Y2, pScrn1->virtualY - pI830->maxFirst_Y1); - if(y1 < 0) y1 = 0; - w1 = realvirtX; - h1 = pScrn1->virtualY - y1; - if((usenonrect) && (pI830->maxFirst_X1 != realvirtX)) { - w1 = pI830->MBXNR1XMAX = pI830->maxFirst_X1; - pI830->NonRectDead.x0 = x1 + w1; - pI830->NonRectDead.x1 = pScrn1->virtualX - 1; - pI830->NonRectDead.y0 = y1; - pI830->NonRectDead.y1 = y1 + h1 - 1; - pI830->HaveNonRect = TRUE; - } - x2 = pI830->SecondXOffs; - y2 = 0; - w2 = realvirtX; - h2 = max(pI830->maxSecond_Y2, pScrn1->virtualY - pI830->maxSecond_Y1); - if(h2 > pScrn1->virtualY) h2 = pScrn1->virtualY; - if((usenonrect) && (pI830->maxSecond_X2 != realvirtX)) { - w2 = pI830->MBXNR2XMAX = pI830->maxSecond_X2; - pI830->NonRectDead.x0 = x2 + w2; - pI830->NonRectDead.x1 = pScrn1->virtualX - 1; - pI830->NonRectDead.y0 = y2; - pI830->NonRectDead.y1 = y2 + h2 - 1; - pI830->HaveNonRect = TRUE; - } - break; - case PosBelow: - x1 = pI830->FirstXOffs; - y1 = 0; - w1 = realvirtX; - h1 = max(pI830->maxFirst_Y1, pScrn1->virtualY - pI830->maxFirst_Y2); - if(h1 > pScrn1->virtualY) h1 = pScrn1->virtualY; - if((usenonrect) && (pI830->maxFirst_X1 != realvirtX)) { - w1 = pI830->MBXNR1XMAX = pI830->maxFirst_X1; - pI830->NonRectDead.x0 = x1 + w1; - pI830->NonRectDead.x1 = pScrn1->virtualX - 1; - pI830->NonRectDead.y0 = y1; - pI830->NonRectDead.y1 = y1 + h1 - 1; - pI830->HaveNonRect = TRUE; - } - x2 = pI830->SecondXOffs; - y2 = min(pI830->maxSecond_Y1, pScrn1->virtualY - pI830->maxSecond_Y2); - if(y2 < 0) y2 = 0; - w2 = realvirtX; - h2 = pScrn1->virtualY - y2; - if((usenonrect) && (pI830->maxSecond_X2 != realvirtX)) { - w2 = pI830->MBXNR2XMAX = pI830->maxSecond_X2; - pI830->NonRectDead.x0 = x2 + w2; - pI830->NonRectDead.x1 = pScrn1->virtualX - 1; - pI830->NonRectDead.y0 = y2; - pI830->NonRectDead.y1 = y2 + h2 - 1; - pI830->HaveNonRect = TRUE; - } - default: - break; - } - - switch(pI830->SecondPosition) { - case PosLeftOf: - case PosRightOf: - if(pI830->FirstYOffs) { - pI830->OffDead1.x0 = x1; - pI830->OffDead1.x1 = x1 + w1 - 1; - pI830->OffDead1.y0 = 0; - pI830->OffDead1.y1 = y1 - 1; - pI830->OffDead2.x0 = x2; - pI830->OffDead2.x1 = x2 + w2 - 1; - pI830->OffDead2.y0 = y2 + h2; - pI830->OffDead2.y1 = pScrn1->virtualY - 1; - pI830->HaveOffsRegions = TRUE; - } else if(pI830->SecondYOffs) { - pI830->OffDead1.x0 = x2; - pI830->OffDead1.x1 = x2 + w2 - 1; - pI830->OffDead1.y0 = 0; - pI830->OffDead1.y1 = y2 - 1; - pI830->OffDead2.x0 = x1; - pI830->OffDead2.x1 = x1 + w1 - 1; - pI830->OffDead2.y0 = y1 + h1; - pI830->OffDead2.y1 = pScrn1->virtualY - 1; - pI830->HaveOffsRegions = TRUE; - } - break; - case PosAbove: - case PosBelow: - if(pI830->FirstXOffs) { - pI830->OffDead1.x0 = x2 + w2; - pI830->OffDead1.x1 = pScrn1->virtualX - 1; - pI830->OffDead1.y0 = y2; - pI830->OffDead1.y1 = y2 + h2 - 1; - pI830->OffDead2.x0 = 0; - pI830->OffDead2.x1 = x1 - 1; - pI830->OffDead2.y0 = y1; - pI830->OffDead2.y1 = y1 + h1 - 1; - pI830->HaveOffsRegions = TRUE; - } else if(pI830->SecondXOffs) { - pI830->OffDead1.x0 = x1 + w1; - pI830->OffDead1.x1 = pScrn1->virtualX - 1; - pI830->OffDead1.y0 = y1; - pI830->OffDead1.y1 = y1 + h1 - 1; - pI830->OffDead2.x0 = 0; - pI830->OffDead2.x1 = x2 - 1; - pI830->OffDead2.y0 = y2; - pI830->OffDead2.y1 = y2 + h2 - 1; - pI830->HaveOffsRegions = TRUE; - } - default: - break; - } - - } - -#ifdef XF86DRI - if (pI830->directRenderingEnabled) { - sarea->pipeA_x = x1; - sarea->pipeA_y = y1; - sarea->pipeA_w = w1; - sarea->pipeA_h = h1; - sarea->pipeB_x = x2; - sarea->pipeB_y = y2; - sarea->pipeB_w = w2; - sarea->pipeB_h = h2; - } -#endif - - if (I830XineramadataPtr && !I830noPanoramiXExtension) { - I830XineramadataPtr[scrnnum1].x = x1; - I830XineramadataPtr[scrnnum1].y = y1; - I830XineramadataPtr[scrnnum1].width = w1; - I830XineramadataPtr[scrnnum1].height = h1; - I830XineramadataPtr[scrnnum2].x = x2; - I830XineramadataPtr[scrnnum2].y = y2; - I830XineramadataPtr[scrnnum2].width = w2; - I830XineramadataPtr[scrnnum2].height = h2; - } else - return; - - if(infochanged) { - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, - "Pseudo-Xinerama: First (Screen %d) (%d,%d)-(%d,%d)\n", - scrnnum1, x1, y1, w1+x1-1, h1+y1-1); - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, - "Pseudo-Xinerama: Second (Screen %d) (%d,%d)-(%d,%d)\n", - scrnnum2, x2, y2, w2+x2-1, h2+y2-1); - if(pI830->HaveNonRect) { - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, - "Pseudo-Xinerama: Inaccessible area (%d,%d)-(%d,%d)\n", - pI830->NonRectDead.x0, pI830->NonRectDead.y0, - pI830->NonRectDead.x1, pI830->NonRectDead.y1); - } - if(pI830->HaveOffsRegions) { - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, - "Pseudo-Xinerama: Inaccessible offset area (%d,%d)-(%d,%d)\n", - pI830->OffDead1.x0, pI830->OffDead1.y0, - pI830->OffDead1.x1, pI830->OffDead1.y1); - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, - "Pseudo-Xinerama: Inaccessible offset area (%d,%d)-(%d,%d)\n", - pI830->OffDead2.x0, pI830->OffDead2.y0, - pI830->OffDead2.x1, pI830->OffDead2.y1); - } - if(pI830->HaveNonRect || pI830->HaveOffsRegions) { - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, - "Mouse restriction for inaccessible areas is %s\n", - pI830->MouseRestrictions ? "enabled" : "disabled"); - } - } -} - -/* Proc */ - -int -I830ProcXineramaQueryVersion(ClientPtr client) -{ - xPanoramiXQueryVersionReply rep; - register int n; - - REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = 1; - rep.minorVersion = 0; - if(client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.majorVersion, n); - swaps(&rep.minorVersion, n); - } - WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *)&rep); - return (client->noClientException); -} - -int -I830ProcXineramaGetState(ClientPtr client) -{ - REQUEST(xPanoramiXGetStateReq); - WindowPtr pWin; - xPanoramiXGetStateReply rep; - register int n; - - REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); - pWin = LookupWindow(stuff->window, client); - if(!pWin) return BadWindow; - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.state = !I830noPanoramiXExtension; - if(client->swapped) { - swaps (&rep.sequenceNumber, n); - swapl (&rep.length, n); - swaps (&rep.state, n); - } - WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep); - return client->noClientException; -} - -int -I830ProcXineramaGetScreenCount(ClientPtr client) -{ - REQUEST(xPanoramiXGetScreenCountReq); - WindowPtr pWin; - xPanoramiXGetScreenCountReply rep; - register int n; - - REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); - pWin = LookupWindow(stuff->window, client); - if(!pWin) return BadWindow; - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.ScreenCount = I830XineramaNumScreens; - if(client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.ScreenCount, n); - } - WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep); - return client->noClientException; -} - -int -I830ProcXineramaGetScreenSize(ClientPtr client) -{ - REQUEST(xPanoramiXGetScreenSizeReq); - WindowPtr pWin; - xPanoramiXGetScreenSizeReply rep; - register int n; - - REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - pWin = LookupWindow (stuff->window, client); - if(!pWin) return BadWindow; - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.width = I830XineramadataPtr[stuff->screen].width; - rep.height = I830XineramadataPtr[stuff->screen].height; - if(client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.width, n); - swaps(&rep.height, n); - } - WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep); - return client->noClientException; -} - -int -I830ProcXineramaIsActive(ClientPtr client) -{ - xXineramaIsActiveReply rep; - - REQUEST_SIZE_MATCH(xXineramaIsActiveReq); - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.state = !I830noPanoramiXExtension; - if(client->swapped) { - register int n; - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.state, n); - } - WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep); - return client->noClientException; -} - -int -I830ProcXineramaQueryScreens(ClientPtr client) -{ - xXineramaQueryScreensReply rep; - - REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); - - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.number = (I830noPanoramiXExtension) ? 0 : I830XineramaNumScreens; - rep.length = rep.number * sz_XineramaScreenInfo >> 2; - if(client->swapped) { - register int n; - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.number, n); - } - WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *)&rep); - - if(!I830noPanoramiXExtension) { - xXineramaScreenInfo scratch; - int i; - - for(i = 0; i < I830XineramaNumScreens; i++) { - scratch.x_org = I830XineramadataPtr[i].x; - scratch.y_org = I830XineramadataPtr[i].y; - scratch.width = I830XineramadataPtr[i].width; - scratch.height = I830XineramadataPtr[i].height; - if(client->swapped) { - register int n; - swaps(&scratch.x_org, n); - swaps(&scratch.y_org, n); - swaps(&scratch.width, n); - swaps(&scratch.height, n); - } - WriteToClient(client, sz_XineramaScreenInfo, (char *)&scratch); - } - } - - return client->noClientException; -} - -static int -I830ProcXineramaDispatch(ClientPtr client) -{ - REQUEST(xReq); - switch (stuff->data) { - case X_PanoramiXQueryVersion: - return I830ProcXineramaQueryVersion(client); - case X_PanoramiXGetState: - return I830ProcXineramaGetState(client); - case X_PanoramiXGetScreenCount: - return I830ProcXineramaGetScreenCount(client); - case X_PanoramiXGetScreenSize: - return I830ProcXineramaGetScreenSize(client); - case X_XineramaIsActive: - return I830ProcXineramaIsActive(client); - case X_XineramaQueryScreens: - return I830ProcXineramaQueryScreens(client); - } - return BadRequest; -} - -/* SProc */ - -static int -I830SProcXineramaQueryVersion (ClientPtr client) -{ - REQUEST(xPanoramiXQueryVersionReq); - register int n; - swaps(&stuff->length,n); - REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq); - return I830ProcXineramaQueryVersion(client); -} - -static int -I830SProcXineramaGetState(ClientPtr client) -{ - REQUEST(xPanoramiXGetStateReq); - register int n; - swaps (&stuff->length, n); - REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); - return I830ProcXineramaGetState(client); -} - -static int -I830SProcXineramaGetScreenCount(ClientPtr client) -{ - REQUEST(xPanoramiXGetScreenCountReq); - register int n; - swaps (&stuff->length, n); - REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); - return I830ProcXineramaGetScreenCount(client); -} - -static int -I830SProcXineramaGetScreenSize(ClientPtr client) -{ - REQUEST(xPanoramiXGetScreenSizeReq); - register int n; - swaps (&stuff->length, n); - REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - return I830ProcXineramaGetScreenSize(client); -} - -static int -I830SProcXineramaIsActive(ClientPtr client) -{ - REQUEST(xXineramaIsActiveReq); - register int n; - swaps (&stuff->length, n); - REQUEST_SIZE_MATCH(xXineramaIsActiveReq); - return I830ProcXineramaIsActive(client); -} - -static int -I830SProcXineramaQueryScreens(ClientPtr client) -{ - REQUEST(xXineramaQueryScreensReq); - register int n; - swaps (&stuff->length, n); - REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); - return I830ProcXineramaQueryScreens(client); -} - -int -I830SProcXineramaDispatch(ClientPtr client) -{ - REQUEST(xReq); - switch (stuff->data) { - case X_PanoramiXQueryVersion: - return I830SProcXineramaQueryVersion(client); - case X_PanoramiXGetState: - return I830SProcXineramaGetState(client); - case X_PanoramiXGetScreenCount: - return I830SProcXineramaGetScreenCount(client); - case X_PanoramiXGetScreenSize: - return I830SProcXineramaGetScreenSize(client); - case X_XineramaIsActive: - return I830SProcXineramaIsActive(client); - case X_XineramaQueryScreens: - return I830SProcXineramaQueryScreens(client); - } - return BadRequest; -} - -static void -I830XineramaResetProc(ExtensionEntry* extEntry) -{ - /* Called by CloseDownExtensions() */ - if(I830XineramadataPtr) { - Xfree(I830XineramadataPtr); - I830XineramadataPtr = NULL; - } -} - -static void -I830XineramaExtensionInit(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - Bool success = FALSE; - - if(!(I830XineramadataPtr)) { - - if(!pI830->MergedFB) { - I830noPanoramiXExtension = TRUE; - pI830->MouseRestrictions = FALSE; - return; - } - -#ifdef PANORAMIX - if(!noPanoramiXExtension) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Xinerama active, not initializing Intel Pseudo-Xinerama\n"); - I830noPanoramiXExtension = TRUE; - pI830->MouseRestrictions = FALSE; - return; - } -#endif - - if(I830noPanoramiXExtension) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Intel Pseudo-Xinerama disabled\n"); - pI830->MouseRestrictions = FALSE; - return; - } - - I830XineramaNumScreens = 2; - - while(I830XineramaGeneration != serverGeneration) { - - pI830->XineramaExtEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0, - I830ProcXineramaDispatch, - I830SProcXineramaDispatch, - I830XineramaResetProc, - StandardMinorOpcode); - - if(!pI830->XineramaExtEntry) break; - - if(!(I830XineramadataPtr = (I830XineramaData *) - xcalloc(I830XineramaNumScreens, sizeof(I830XineramaData)))) break; - - I830XineramaGeneration = serverGeneration; - success = TRUE; - } - - if(!success) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to initialize Intel Pseudo-Xinerama extension\n"); - I830noPanoramiXExtension = TRUE; - pI830->MouseRestrictions = FALSE; - return; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Intel Pseudo-Xinerama extension initialized\n"); - - pI830->I830XineramaVX = 0; - pI830->I830XineramaVY = 0; - - } -} - -static void -I830BIOSProbeDDC(ScrnInfoPtr pScrn, int index) +I830ProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; @@ -2085,1036 +416,70 @@ I830BIOSProbeDDC(ScrnInfoPtr pScrn, int index) ConfiguredMonitor = vbeDoEDID(pVbe, NULL); } -/* Various extended video BIOS functions. - * 100 and 120Hz aren't really supported, they work but only get close - * to the requested refresh, and really not close enough. - * I've seen 100Hz come out at 104Hz, and 120Hz come out at 128Hz */ -const int i830refreshes[] = { - 43, 56, 60, 70, 72, 75, 85 /* 100, 120 */ -}; -static const int nrefreshes = sizeof(i830refreshes) / sizeof(i830refreshes[0]); - -static Bool -Check5fStatus(ScrnInfoPtr pScrn, int func, int ax) -{ - if (ax == 0x005f) - return TRUE; - else if (ax == 0x015f) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Extended BIOS function 0x%04x failed.\n", func); - return FALSE; - } else if ((ax & 0xff) != 0x5f) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Extended BIOS function 0x%04x not supported.\n", func); - return FALSE; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Extended BIOS function 0x%04x returns 0x%04x.\n", - func, ax & 0xffff); - return FALSE; - } -} - -static int -GetToggleList(ScrnInfoPtr pScrn, int toggle) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - - DPRINTF(PFX, "GetToggleList\n"); - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f64; - pVbe->pInt10->bx = 0x500; - - pVbe->pInt10->bx |= toggle; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Toggle (%d) 0x%x\n", toggle, pVbe->pInt10->cx); - return pVbe->pInt10->cx & 0xffff; - } - - return 0; -} - -static int -GetNextDisplayDeviceList(ScrnInfoPtr pScrn, int toggle) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - int devices = 0; - int pipe = 0; - int i; - - DPRINTF(PFX, "GetNextDisplayDeviceList\n"); - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f64; - pVbe->pInt10->bx = 0xA00; - pVbe->pInt10->bx |= toggle; - pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); - pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (!Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) - return 0; - - for (i=0; i<(pVbe->pInt10->cx & 0xff); i++) { - CARD32 VODA = (CARD32)((CARD32*)pVbe->memory)[i]; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Next ACPI _DGS [%d] 0x%lx\n", - i, VODA); - - /* Check if it's a custom Video Output Device Attribute */ - if (!(VODA & 0x80000000)) - continue; - - pipe = (VODA & 0x000000F0) >> 4; - - if (pipe != 0 && pipe != 1) { - pipe = 0; -#if 0 - ErrorF("PIPE %d\n",pipe); -#endif - } - - switch ((VODA & 0x00000F00) >> 8) { - case 0x0: - case 0x1: /* CRT */ - devices |= PIPE_CRT << (pipe == 1 ? 8 : 0); - break; - case 0x2: /* TV/HDTV */ - devices |= PIPE_TV << (pipe == 1 ? 8 : 0); - break; - case 0x3: /* DFP */ - devices |= PIPE_DFP << (pipe == 1 ? 8 : 0); - break; - case 0x4: /* LFP */ - devices |= PIPE_LFP << (pipe == 1 ? 8 : 0); - break; - } - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ACPI Toggle devices 0x%x\n", devices); - - return devices; -} - static int -GetAttachableDisplayDeviceList(ScrnInfoPtr pScrn) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - int i; - - DPRINTF(PFX, "GetAttachableDisplayDeviceList\n"); - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f64; - pVbe->pInt10->bx = 0x900; - pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); - pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (!Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) - return 0; - - for (i=0; i<(pVbe->pInt10->cx & 0xff); i++) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Attachable device 0x%lx.\n", ((CARD32*)pVbe->memory)[i]); - - return pVbe->pInt10->cx & 0xffff; -} - -static int -BitToRefresh(int bits) -{ - int i; - - for (i = 0; i < nrefreshes; i++) - if (bits & (1 << i)) - return i830refreshes[i]; - return 0; -} - -static int -GetRefreshRate(ScrnInfoPtr pScrn, int mode, int *availRefresh) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - - DPRINTF(PFX, "GetRefreshRate\n"); - - /* Only 8-bit mode numbers are supported. */ - if (mode & 0x100) - return 0; - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f05; - pVbe->pInt10->bx = (mode & 0xff) | 0x100; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f05, pVbe->pInt10->ax)) { - if (availRefresh) - *availRefresh = pVbe->pInt10->bx; - return BitToRefresh(pVbe->pInt10->cx); - } else - return 0; -} - -struct panelid { - short hsize; - short vsize; - short fptype; - char redbpp; - char greenbpp; - char bluebpp; - char reservedbpp; - int rsvdoffscrnmemsize; - int rsvdoffscrnmemptr; - char reserved[14]; -}; - -static void -I830InterpretPanelID(int scrnIndex, unsigned char *tmp) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - struct panelid *block = (struct panelid *)tmp; - -#define PANEL_DEFAULT_HZ 60 - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "PanelID returned panel resolution : %dx%d\n", - block->hsize, block->vsize); - - /* If we get bogus values from this, don't accept it */ - if (block->hsize == 0 || block->vsize == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Bad Panel resolution - ignoring panelID\n"); - - return; - } - - /* If we have monitor timings then don't overwrite them */ - if (pScrn->monitor->nHsync > 0 && - pScrn->monitor->nVrefresh > 0) - return; - - /* With panels, we're always assuming a refresh of 60Hz */ - - pScrn->monitor->nHsync = 1; - pScrn->monitor->nVrefresh = 1; - - /* Give a little tolerance for the selected panel */ - pScrn->monitor->hsync[0].lo = (float)((PANEL_DEFAULT_HZ/1.05)*block->vsize)/1000; - pScrn->monitor->hsync[0].hi = (float)((PANEL_DEFAULT_HZ/0.95)*block->vsize)/1000; - pScrn->monitor->vrefresh[0].lo = (float)PANEL_DEFAULT_HZ; - pScrn->monitor->vrefresh[0].hi = (float)PANEL_DEFAULT_HZ; -} - -/* This should probably go into the VBE layer */ -static unsigned char * -vbeReadPanelID(vbeInfoPtr pVbe) -{ - int RealOff = pVbe->real_mode_base; - pointer page = pVbe->memory; - unsigned char *tmp = NULL; - int screen = pVbe->pInt10->scrnIndex; - - pVbe->pInt10->ax = 0x4F11; - pVbe->pInt10->bx = 0x01; - pVbe->pInt10->cx = 0; - pVbe->pInt10->dx = 0; - pVbe->pInt10->es = SEG_ADDR(RealOff); - pVbe->pInt10->di = SEG_OFF(RealOff); - pVbe->pInt10->num = 0x10; - - xf86ExecX86int10(pVbe->pInt10); - - if ((pVbe->pInt10->ax & 0xff) != 0x4f) { - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID invalid\n"); - goto error; - } - switch (pVbe->pInt10->ax & 0xff00) { - case 0x0: - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read successfully\n"); - tmp = (unsigned char *)xnfalloc(32); - memcpy(tmp,page,32); - break; - case 0x100: - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read failed\n"); - break; - default: - xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID unknown failure %i\n", - pVbe->pInt10->ax & 0xff00); - break; - } - - error: - return tmp; -} - -static void -vbeDoPanelID(vbeInfoPtr pVbe) -{ - unsigned char *PanelID_data; - - if (!pVbe) return; - - PanelID_data = vbeReadPanelID(pVbe); - - if (!PanelID_data) - return; - - I830InterpretPanelID(pVbe->pInt10->scrnIndex, PanelID_data); -} - -int -I830GetBestRefresh(ScrnInfoPtr pScrn, int refresh) -{ - int i; - - for (i = nrefreshes - 1; i >= 0; i--) { - /* - * Look for the highest value that the requested (refresh + 2) is - * greater than or equal to. - */ - if (i830refreshes[i] <= (refresh + 2)) - break; - } - /* i can be 0 if the requested refresh was higher than the max. */ - if (i == 0) { - if (refresh >= i830refreshes[nrefreshes - 1]) - i = nrefreshes - 1; - } - - return i; -} - -static int -SetRefreshRate(ScrnInfoPtr pScrn, int mode, int refresh) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - int i = I830GetBestRefresh(pScrn, refresh); - - DPRINTF(PFX, "SetRefreshRate: mode 0x%x, refresh: %d\n", mode, refresh); - - DPRINTF(PFX, "Setting refresh rate to %dHz for mode 0x%02x\n", - i830refreshes[i], mode & 0xff); - - /* Only 8-bit mode numbers are supported. */ - if (mode & 0x100) - return 0; - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f05; - pVbe->pInt10->bx = mode & 0xff; - - pVbe->pInt10->cx = 1 << i; - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f05, pVbe->pInt10->ax)) - return i830refreshes[i]; - else - return 0; -} - -#if 0 -static Bool -SetPowerStatus(ScrnInfoPtr pScrn, int mode) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f64; - pVbe->pInt10->bx = 0x0800 | mode; - pVbe->pInt10->cx = 0x0000; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) - return TRUE; - - return FALSE; -} -#endif - -static Bool -GetModeSupport(ScrnInfoPtr pScrn, int modePipeA, int modePipeB, - int devicesPipeA, int devicesPipeB, int *maxBandwidth, - int *bandwidthPipeA, int *bandwidthPipeB) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - - DPRINTF(PFX, "GetModeSupport: modes 0x%x, 0x%x, devices: 0x%x, 0x%x\n", - modePipeA, modePipeB, devicesPipeA, devicesPipeB); - - /* Only 8-bit mode numbers are supported. */ - if ((modePipeA & 0x100) || (modePipeB & 0x100)) - return FALSE; - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f28; - pVbe->pInt10->bx = (modePipeA & 0xff) | ((modePipeB & 0xff) << 8); - if ((devicesPipeA & 0x80) || (devicesPipeB & 0x80)) - pVbe->pInt10->cx = 0x8000; - else - pVbe->pInt10->cx = (devicesPipeA & 0xff) | ((devicesPipeB & 0xff) << 8); - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f28, pVbe->pInt10->ax)) { - if (maxBandwidth) - *maxBandwidth = pVbe->pInt10->cx; - if (bandwidthPipeA) - *bandwidthPipeA = pVbe->pInt10->dx & 0xffff; - /* XXX For XFree86 4.2.0 and earlier, ->dx is truncated to 16 bits. */ - if (bandwidthPipeB) - *bandwidthPipeB = (pVbe->pInt10->dx >> 16) & 0xffff; - return TRUE; - } else - return FALSE; -} - -#if 0 -static int -GetLFPCompMode(ScrnInfoPtr pScrn) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - - DPRINTF(PFX, "GetLFPCompMode\n"); - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f61; - pVbe->pInt10->bx = 0x100; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f61, pVbe->pInt10->ax)) - return pVbe->pInt10->cx & 0xffff; - else - return -1; -} - -static Bool -SetLFPCompMode(ScrnInfoPtr pScrn, int compMode) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - - DPRINTF(PFX, "SetLFPCompMode: compMode %d\n", compMode); - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f61; - pVbe->pInt10->bx = 0; - pVbe->pInt10->cx = compMode; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - return Check5fStatus(pScrn, 0x5f61, pVbe->pInt10->ax); -} -#endif - -static int -GetDisplayDevices(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - vbeInfoPtr pVbe = pI830->pVbe; - - DPRINTF(PFX, "GetDisplayDevices\n"); - -#if 0 - { - CARD32 temp; - ErrorF("ADPA is 0x%08x\n", INREG(ADPA)); - ErrorF("DVOA is 0x%08x\n", INREG(DVOA)); - ErrorF("DVOB is 0x%08x\n", INREG(DVOB)); - ErrorF("DVOC is 0x%08x\n", INREG(DVOC)); - ErrorF("LVDS is 0x%08x\n", INREG(LVDS)); - temp = INREG(DVOA_SRCDIM); - ErrorF("DVOA_SRCDIM is 0x%08x (%d x %d)\n", temp, - (temp >> 12) & 0xfff, temp & 0xfff); - temp = INREG(DVOB_SRCDIM); - ErrorF("DVOB_SRCDIM is 0x%08x (%d x %d)\n", temp, - (temp >> 12) & 0xfff, temp & 0xfff); - temp = INREG(DVOC_SRCDIM); - ErrorF("DVOC_SRCDIM is 0x%08x (%d x %d)\n", temp, - (temp >> 12) & 0xfff, temp & 0xfff); - ErrorF("SWF0 is 0x%08x\n", INREG(SWF0)); - ErrorF("SWF4 is 0x%08x\n", INREG(SWF4)); - } -#endif - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f64; - pVbe->pInt10->bx = 0x100; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) { - return pVbe->pInt10->cx & 0xffff; - } else { - if (pI830->PciInfo->chipType == PCI_CHIP_E7221_G) /* FIXED CONFIG */ - return PIPE_CRT; - else - return -1; - } -} - -static int -GetBIOSPipe(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - vbeInfoPtr pVbe = pI830->pVbe; - int pipe; - - DPRINTF(PFX, "GetBIOSPipe:\n"); - - /* single pipe machines should always return Pipe A */ - if (pI830->availablePipes == 1) return 0; - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f1c; - pVbe->pInt10->bx = 0x100; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f1c, pVbe->pInt10->ax)) { - if (pI830->newPipeSwitch) { - pipe = ((pVbe->pInt10->bx & 0x0001)); - } else { - pipe = ((pVbe->pInt10->cx & 0x0100) >> 8); - } - return pipe; - } - - /* failed, assume pipe A */ - return 0; -} - -static Bool -SetBIOSPipe(ScrnInfoPtr pScrn, int pipe) -{ - I830Ptr pI830 = I830PTR(pScrn); - vbeInfoPtr pVbe = pI830->pVbe; - - DPRINTF(PFX, "SetBIOSPipe: pipe 0x%x\n", pipe); - - /* single pipe machines should always return TRUE */ - if (pI830->availablePipes == 1) return TRUE; - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f1c; - if (pI830->newPipeSwitch) { - pVbe->pInt10->bx = pipe; - pVbe->pInt10->cx = 0; - } else { - pVbe->pInt10->bx = 0x0; - pVbe->pInt10->cx = pipe << 8; - } - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f1c, pVbe->pInt10->ax)) { - return TRUE; - } - - return FALSE; -} - -static Bool -SetPipeAccess(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - /* Don't try messing with the pipe, unless we're dual head */ - if (xf86IsEntityShared(pScrn->entityList[0]) || pI830->Clone || pI830->MergedFB || pI830->origPipe != pI830->pipe) { - if (!SetBIOSPipe(pScrn, pI830->pipe)) - return FALSE; - } - - return TRUE; -} - -static Bool -I830Set640x480(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - int m; - - /* 640x480 8bpp */ - m = 0x30 | (1 << 15) | (1 << 14); - if (VBESetVBEMode(pI830->pVbe, m, NULL)) - return TRUE; - - /* if the first failed, let's try the next - usually 800x600 */ - m = 0x32 | (1 << 15) | (1 << 14); - - if (VBESetVBEMode(pI830->pVbe, m, NULL)) - return TRUE; - - return FALSE; -} - -/* This is needed for SetDisplayDevices to work correctly on I915G. - * Enable for all chipsets now as it has no bad side effects, apart - * from slightly longer startup time. - */ -#define I915G_WORKAROUND - -static Bool -SetDisplayDevices(ScrnInfoPtr pScrn, int devices) +I830DetectMemory(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); - vbeInfoPtr pVbe = pI830->pVbe; - CARD32 temp; - int singlepipe = 0; -#ifdef I915G_WORKAROUND - int getmode1; - Bool setmode = FALSE; -#endif - - DPRINTF(PFX, "SetDisplayDevices: devices 0x%x\n", devices); - - if (!pI830->specifiedMonitor) - return TRUE; - -#ifdef I915G_WORKAROUND - if (pI830->preinit) - setmode = TRUE; - if (pI830->leaving) - setmode = FALSE; - if (pI830->closing) - setmode = FALSE; - - if (setmode) { - VBEGetVBEMode(pVbe, &getmode1); - I830Set640x480(pScrn); - } +#if !XSERVER_LIBPCIACCESS + PCITAG bridge; #endif - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f64; - pVbe->pInt10->bx = 0x1; - pVbe->pInt10->cx = devices; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) { -#ifdef I915G_WORKAROUND - if (setmode) { - VBESetVBEMode(pI830->pVbe, getmode1 | 1<<15, NULL); - } + uint16_t gmch_ctrl; + int memsize = 0, gtt_size; + int range; +#if 0 + VbeInfoBlock *vbeInfo; #endif - pI830->pipeEnabled[0] = (devices & 0xff) ? TRUE : FALSE; - pI830->pipeEnabled[1] = (devices & 0xff00) ? TRUE : FALSE; - return TRUE; - } - -#ifdef I915G_WORKAROUND - if (setmode) - VBESetVBEMode(pI830->pVbe, getmode1 | 1<<15, NULL); +#if XSERVER_LIBPCIACCESS + struct pci_device *bridge = intel_host_bridge (); + pci_device_cfg_read_u16(bridge, & gmch_ctrl, I830_GMCH_CTRL); +#else + bridge = pciTag(0, 0, 0); /* This is always the host bridge */ + gmch_ctrl = pciReadWord(bridge, I830_GMCH_CTRL); #endif - if (devices & 0xff) { - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f64; - pVbe->pInt10->bx = 0x1; - pVbe->pInt10->cx = devices & 0xff; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Successfully set display devices to 0x%x.\n",devices & 0xff); - singlepipe = devices & 0xff00; /* set alternate */ - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to set display devices to 0x%x.\n",devices & 0xff); - singlepipe = devices; - } - } else - singlepipe = devices; - - if (singlepipe == devices && devices & 0xff00) { - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f64; - pVbe->pInt10->bx = 0x1; - pVbe->pInt10->cx = devices & 0xff00; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Successfully set display devices to 0x%x.\n",devices & 0xff00); - singlepipe = devices & 0xff; /* set alternate */ - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to set display devices to 0x%x.\n",devices & 0xff00); - singlepipe = devices; - } - } - - /* LVDS doesn't exist on these */ - if (IS_I830(pI830) || IS_845G(pI830) || IS_I865G(pI830) || IS_I915G(pI830) || IS_I945G(pI830) || IS_I965G(pI830)) - singlepipe &= ~(PIPE_LFP | (PIPE_LFP<<8)); - - if (pI830->availablePipes == 1) - singlepipe &= 0xFF; - - /* Disable LVDS */ - if (singlepipe & PIPE_LFP) { - /* LFP on PipeA is unlikely! */ - OUTREG(0x61200, INREG(0x61200) & ~0x80000000); - OUTREG(0x61204, INREG(0x61204) & ~0x00000001); - while ((INREG(0x61200) & 0x80000000) || (INREG(0x61204) & 1)); - /* Fix up LVDS */ - OUTREG(LVDS, (INREG(LVDS) & ~1<<30) | 0x80000300); - /* Enable LVDS */ - OUTREG(0x61200, INREG(0x61200) | 0x80000000); - OUTREG(0x61204, INREG(0x61204) | 0x00000001); - while (!(INREG(0x61200) & 0x80000000) && !(INREG(0x61204) & 1)); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Enabling LVDS directly. Pipe A.\n"); - } else - if (singlepipe & (PIPE_LFP << 8)) { - OUTREG(0x61200, INREG(0x61200) & ~0x80000000); - OUTREG(0x61204, INREG(0x61204) & ~0x00000001); - while ((INREG(0x61200) & 0x80000000) || (INREG(0x61204) & 1)); - /* Fix up LVDS */ - OUTREG(LVDS, (INREG(LVDS) | 1<<30) | 0x80000300); - /* Enable LVDS */ - OUTREG(0x61200, INREG(0x61200) | 0x80000000); - OUTREG(0x61204, INREG(0x61204) | 0x00000001); - while (!(INREG(0x61200) & 0x80000000) && !(INREG(0x61204) & 1)); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Enabling LVDS directly. Pipe B.\n"); - } - else if (!(IS_I830(pI830) || IS_845G(pI830) || IS_I865G(pI830))) { - if (!(devices & (PIPE_LFP | PIPE_LFP<<8))) { - OUTREG(0x61200, INREG(0x61200) & ~0x80000000); - OUTREG(0x61204, INREG(0x61204) & ~0x00000001); - while ((INREG(0x61200) & 0x80000000) || (INREG(0x61204) & 1)); - /* Fix up LVDS */ - OUTREG(LVDS, (INREG(LVDS) | 1<<30) & ~0x80000300); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Disabling LVDS directly.\n"); - } - } - - /* Now try to program the registers directly if the BIOS failed. */ - temp = INREG(ADPA); - temp &= ~(ADPA_DAC_ENABLE | ADPA_PIPE_SELECT_MASK); - temp &= ~(ADPA_VSYNC_CNTL_DISABLE | ADPA_HSYNC_CNTL_DISABLE); - /* Turn on ADPA */ - if (singlepipe & PIPE_CRT) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Enabling ADPA directly. Pipe A.\n"); - temp |= ADPA_DAC_ENABLE | ADPA_PIPE_A_SELECT; - OUTREG(ADPA, temp); - } else - if (singlepipe & (PIPE_CRT << 8)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Enabling ADPA directly. Pipe B.\n"); - temp |= ADPA_DAC_ENABLE | ADPA_PIPE_B_SELECT; - OUTREG(ADPA, temp); - } - else { - if (!(devices & (PIPE_CRT | PIPE_CRT<<8))) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Disabling ADPA directly.\n"); - temp |= ADPA_VSYNC_CNTL_DISABLE | ADPA_HSYNC_CNTL_DISABLE; - OUTREG(ADPA, temp); - } - } - - xf86DrvMsg(pScrn->scrnIndex, X_WARNING,"Writing config directly to SWF0.\n"); - temp = INREG(SWF0); - OUTREG(SWF0, (temp & ~(0xffff)) | (devices & 0xffff)); - - if (GetDisplayDevices(pScrn) != devices) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "SetDisplayDevices failed with devices 0x%x instead of 0x%x\n", - GetDisplayDevices(pScrn), devices); - return FALSE; - } - - pI830->pipeEnabled[0] = (devices & 0xff) ? TRUE : FALSE; - pI830->pipeEnabled[1] = (devices & 0xff00) ? TRUE : FALSE; - - return TRUE; -} - -static Bool -GetBIOSVersion(ScrnInfoPtr pScrn, unsigned int *version) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - - DPRINTF(PFX, "GetBIOSVersion\n"); - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f01; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f01, pVbe->pInt10->ax)) { - *version = pVbe->pInt10->bx; - return TRUE; - } - - *version = 0; - return FALSE; -} - -static Bool -GetDevicePresence(ScrnInfoPtr pScrn, Bool *required, int *attached, - int *encoderPresent) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - - DPRINTF(PFX, "GetDevicePresence\n"); - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f64; - pVbe->pInt10->bx = 0x200; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) { - if (required) - *required = ((pVbe->pInt10->bx & 0x1) == 0); - if (attached) - *attached = (pVbe->pInt10->cx >> 8) & 0xff; - if (encoderPresent) - *encoderPresent = pVbe->pInt10->cx & 0xff; - return TRUE; - } else - return FALSE; -} - -static Bool -GetDisplayInfo(ScrnInfoPtr pScrn, int device, Bool *attached, Bool *present, - short *x, short *y) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - - DPRINTF(PFX, "GetDisplayInfo: device: 0x%x\n", device); - - switch (device & 0xff) { - case PIPE_CRT: - case PIPE_TV: - case PIPE_DFP: - case PIPE_LFP: - case PIPE_CRT2: - case PIPE_TV2: - case PIPE_DFP2: - case PIPE_LFP2: - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "GetDisplayInfo: invalid device: 0x%x\n", device & 0xff); - return FALSE; - } - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f64; - pVbe->pInt10->bx = 0x300; - pVbe->pInt10->cx = device & 0xff; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - if (Check5fStatus(pScrn, 0x5f64, pVbe->pInt10->ax)) { - if (attached) - *attached = ((pVbe->pInt10->bx & 0x2) != 0); - if (present) - *present = ((pVbe->pInt10->bx & 0x1) != 0); - if (pVbe->pInt10->cx != (device & 0xff)) { - if (y) { - *y = pVbe->pInt10->cx & 0xffff; - } - if (x) { - *x = (pVbe->pInt10->cx >> 16) & 0xffff; - } - } - return TRUE; - } else - return FALSE; -} - -/* - * Returns a string matching the device corresponding to the first bit set - * in "device". savedDevice is then set to device with that bit cleared. - * Subsequent calls with device == -1 will use savedDevice. - */ - -static const char *displayDevices[] = { - "CRT", - "TV", - "DFP (digital flat panel)", - "LFP (local flat panel)", - "Second (second CRT)", - "TV2 (second TV)", - "DFP2 (second digital flat panel)", - "LFP2 (second local flat panel)", - NULL -}; - -static const char * -DeviceToString(int device) -{ - static int savedDevice = -1; - int bit = 0; - const char *name; - - if (device == -1) { - device = savedDevice; - bit = 0; - } - - if (device == -1) - return NULL; - - while (displayDevices[bit]) { - if (device & (1 << bit)) { - name = displayDevices[bit]; - savedDevice = device & ~(1 << bit); - bit++; - return name; - } - bit++; - } - return NULL; -} - -static void -PrintDisplayDeviceInfo(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - int pipe, n; - int displays; - - DPRINTF(PFX, "PrintDisplayDeviceInfo\n"); - - displays = pI830->operatingDevices; - if (displays == -1) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "No active display devices.\n"); - return; - } - - /* Check for active devices connected to each display pipe. */ - for (n = 0; n < pI830->availablePipes; n++) { - pipe = ((displays >> PIPE_SHIFT(n)) & PIPE_ACTIVE_MASK); - if (pipe) { - const char *name; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Currently active displays on Pipe %c:\n", PIPE_NAME(n)); - name = DeviceToString(pipe); - do { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t%s\n", name); - name = DeviceToString(-1); - } while (name); - - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "No active displays on Pipe %c.\n", PIPE_NAME(n)); - } - - if (pI830->pipeDisplaySize[n].x2 != 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Lowest common panel size for pipe %c is %d x %d\n", - PIPE_NAME(n), pI830->pipeDisplaySize[n].x2, - pI830->pipeDisplaySize[n].y2); - } else if (pI830->pipeEnabled[n] && pipe & ~PIPE_CRT_ACTIVE) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "No display size information available for pipe %c.\n", - PIPE_NAME(n)); - } - } -} - -static void -GetPipeSizes(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - int pipe, n; - DisplayType i; - - DPRINTF(PFX, "GetPipeSizes\n"); - - - for (n = 0; n < pI830->availablePipes; n++) { - pipe = (pI830->operatingDevices >> PIPE_SHIFT(n)) & PIPE_ACTIVE_MASK; - pI830->pipeDisplaySize[n].x1 = pI830->pipeDisplaySize[n].y1 = 0; - pI830->pipeDisplaySize[n].x2 = pI830->pipeDisplaySize[n].y2 = 4096; - for (i = 0; i < NumDisplayTypes; i++) { - if (pipe & (1 << i) & PIPE_SIZED_DISP_MASK) { - if (pI830->displaySize[i].x2 != 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Size of device %s is %d x %d\n", - displayDevices[i], - pI830->displaySize[i].x2, - pI830->displaySize[i].y2); - if (pI830->displaySize[i].x2 < pI830->pipeDisplaySize[n].x2) - pI830->pipeDisplaySize[n].x2 = pI830->displaySize[i].x2; - if (pI830->displaySize[i].y2 < pI830->pipeDisplaySize[n].y2) - pI830->pipeDisplaySize[n].y2 = pI830->displaySize[i].y2; - } - } + if (IS_I965G(pI830)) { + /* The 965 may have a GTT that is actually larger than is necessary + * to cover the aperture, so check the hardware's reporting of the + * GTT size. + */ + switch (INREG(PGETBL_CTL) & PGETBL_SIZE_MASK) { + case PGETBL_SIZE_512KB: + gtt_size = 512; + break; + case PGETBL_SIZE_256KB: + gtt_size = 256; + break; + case PGETBL_SIZE_128KB: + gtt_size = 128; + break; + default: + FatalError("Unknown GTT size value: %08x\n", (int)INREG(PGETBL_CTL)); } - - if (pI830->pipeDisplaySize[n].x2 == 4096) - pI830->pipeDisplaySize[n].x2 = 0; - if (pI830->pipeDisplaySize[n].y2 == 4096) - pI830->pipeDisplaySize[n].y2 = 0; - } -} - -static Bool -I830DetectDisplayDevice(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - int pipe, n; - DisplayType i; - - /* This seems to lockup some Dell BIOS'. So it's on option to turn on */ - if (pI830->displayInfo) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Broken BIOSes cause the system to hang here.\n" - "\t If you encounter this problem please add \n" - "\t\t Option \"DisplayInfo\" \"FALSE\"\n" - "\t to the Device section of your XF86Config file.\n"); - for (i = 0; i < NumDisplayTypes; i++) { - if (GetDisplayInfo(pScrn, 1 << i, &pI830->displayAttached[i], - &pI830->displayPresent[i], - &pI830->displaySize[i].x2, - &pI830->displaySize[i].y2)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Display Info: %s: attached: %s, present: %s, size: " - "(%d,%d)\n", displayDevices[i], - BOOLTOSTRING(pI830->displayAttached[i]), - BOOLTOSTRING(pI830->displayPresent[i]), - pI830->displaySize[i].x2, pI830->displaySize[i].y2); - } + } else if (IS_G33CLASS(pI830)) { + /* G33's GTT size is detect in GMCH_CTRL */ + switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) { + case G33_PGETBL_SIZE_1M: + gtt_size = 1024; + break; + case G33_PGETBL_SIZE_2M: + gtt_size = 2048; + break; + default: + FatalError("Unknown GTT size value: %08x\n", + (int)(gmch_ctrl & G33_PGETBL_SIZE_MASK)); } + } else { + /* Older chipsets only had GTT appropriately sized for the aperture. */ + gtt_size = pI830->FbMapSize / (1024*1024); } - /* Check for active devices connected to each display pipe. */ - for (n = 0; n < pI830->availablePipes; n++) { - pipe = ((pI830->operatingDevices >> PIPE_SHIFT(n)) & PIPE_ACTIVE_MASK); - if (pipe) - pI830->pipeEnabled[n] = TRUE; - else - pI830->pipeEnabled[n] = FALSE; - } - - GetPipeSizes(pScrn); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "detected %d kB GTT.\n", gtt_size); - return TRUE; -} - -static int -I830DetectMemory(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - PCITAG bridge; - CARD16 gmch_ctrl; - int memsize = 0; - int range; - - bridge = pciTag(0, 0, 0); /* This is always the host bridge */ - gmch_ctrl = pciReadWord(bridge, I830_GMCH_CTRL); - - /* We need to reduce the stolen size, by the GTT and the popup. - * The GTT varying according the the FbMapSize and the popup is 4KB. */ - if (IS_I96X(pI830)) - range = 512 + 4; /* Fixed 512KB size for i965 */ - else - range = (pI830->FbMapSize / MB(1)) + 4; + /* The stolen memory has the GTT at the top, and the 4KB popup below that. + * Everything else can be freely used by the graphics driver. + */ + range = gtt_size + 4; if (IS_I85X(pI830) || IS_I865G(pI830) || IS_I9XX(pI830)) { switch (gmch_ctrl & I830_GMCH_GMS_MASK) { @@ -3141,6 +506,14 @@ I830DetectMemory(ScrnInfoPtr pScrn) if (IS_I9XX(pI830)) memsize = MB(64) - KB(range); break; + case G33_GMCH_GMS_STOLEN_128M: + if (IS_G33CLASS(pI830)) + memsize = MB(128) - KB(range); + break; + case G33_GMCH_GMS_STOLEN_256M: + if (IS_G33CLASS(pI830)) + memsize = MB(256) - KB(range); + break; } } else { switch (gmch_ctrl & I830_GMCH_GMS_MASK) { @@ -3172,15 +545,37 @@ I830DetectMemory(ScrnInfoPtr pScrn) } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "no video memory detected.\n"); } + return memsize; } static Bool I830MapMMIO(ScrnInfoPtr pScrn) { +#if XSERVER_LIBPCIACCESS + int err; + struct pci_device *device; +#else int mmioFlags; +#endif I830Ptr pI830 = I830PTR(pScrn); +#if XSERVER_LIBPCIACCESS + device = pI830->PciInfo; + err = pci_device_map_range (device, + pI830->MMIOAddr, + I810_REG_SIZE, + PCI_DEV_MAP_FLAG_WRITABLE, + (void **) &pI830->MMIOBase); + if (err) + { + xf86DrvMsg (pScrn->scrnIndex, X_ERROR, + "Unable to map mmio range. %s (%d)\n", + strerror (err), err); + return FALSE; + } +#else + #if !defined(__alpha__) mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; #else @@ -3192,6 +587,51 @@ I830MapMMIO(ScrnInfoPtr pScrn) pI830->MMIOAddr, I810_REG_SIZE); if (!pI830->MMIOBase) return FALSE; +#endif + + /* Set up the GTT mapping for the various places it has been moved over + * time. + */ + if (IS_I9XX(pI830)) { + CARD32 gttaddr; + + if (IS_I965G(pI830)) + { + gttaddr = pI830->MMIOAddr + (512 * 1024); + pI830->GTTMapSize = 512 * 1024; + } + else + { + gttaddr = I810_MEMBASE(pI830->PciInfo, 3) & 0xFFFFFF00; + pI830->GTTMapSize = pI830->FbMapSize / 1024; + } +#if XSERVER_LIBPCIACCESS + err = pci_device_map_range (device, + gttaddr, pI830->GTTMapSize, + PCI_DEV_MAP_FLAG_WRITABLE, + (void **) &pI830->GTTBase); + if (err) + { + xf86DrvMsg (pScrn->scrnIndex, X_ERROR, + "Unable to map GTT range. %s (%d)\n", + strerror (err), err); + return FALSE; + } +#else + pI830->GTTBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, + pI830->PciTag, + gttaddr, pI830->GTTMapSize); + if (pI830->GTTBase == NULL) + return FALSE; +#endif + } else { + /* The GTT aperture on i830 is write-only. We could probably map the + * actual physical pages that back it, but leave it alone for now. + */ + pI830->GTTBase = NULL; + pI830->GTTMapSize = 0; + } + return TRUE; } @@ -3200,6 +640,10 @@ I830MapMem(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); long i; +#if XSERVER_LIBPCIACCESS + struct pci_device *const device = pI830->PciInfo; + int err; +#endif for (i = 2; i < pI830->FbMapSize; i <<= 1) ; pI830->FbMapSize = i; @@ -3207,14 +651,31 @@ I830MapMem(ScrnInfoPtr pScrn) if (!I830MapMMIO(pScrn)) return FALSE; +#if XSERVER_LIBPCIACCESS + err = pci_device_map_range (device, pI830->LinearAddr, pI830->FbMapSize, + PCI_DEV_MAP_FLAG_WRITABLE | PCI_DEV_MAP_FLAG_WRITE_COMBINE, + (void **) &pI830->FbBase); +#else pI830->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pI830->PciTag, pI830->LinearAddr, pI830->FbMapSize); if (!pI830->FbBase) return FALSE; +#endif - if (I830IsPrimary(pScrn)) - pI830->LpRing->virtual_start = pI830->FbBase + pI830->LpRing->mem.Start; + if (I830IsPrimary(pScrn) && pI830->LpRing->mem != NULL) { + pI830->LpRing->virtual_start = + pI830->FbBase + pI830->LpRing->mem->offset; + } + + /* Mark the pages we haven't yet bound into AGP as inaccessible. */ + if (pI830->FbMapSize > pI830->stolen_size) { + if (mprotect(pI830->FbBase + pI830->stolen_size, + pI830->FbMapSize - pI830->stolen_size, PROT_NONE) != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to mprotect unbound AGP: %s\n", strerror(errno)); + } + } return TRUE; } @@ -3224,9 +685,22 @@ I830UnmapMMIO(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); +#if XSERVER_LIBPCIACCESS + pci_device_unmap_range (pI830->PciInfo, pI830->MMIOBase, I810_REG_SIZE); +#else xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI830->MMIOBase, I810_REG_SIZE); - pI830->MMIOBase = 0; +#endif + pI830->MMIOBase = NULL; + + if (IS_I9XX(pI830)) { +#if XSERVER_LIBPCIACCESS + pci_device_unmap_range (pI830->PciInfo, pI830->GTTBase, pI830->GTTMapSize); +#else + xf86UnMapVidMem(pScrn->scrnIndex, pI830->GTTBase, pI830->GTTMapSize); +#endif + pI830->GTTBase = NULL; + } } static Bool @@ -3234,549 +708,243 @@ I830UnmapMem(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); +#if XSERVER_LIBPCIACCESS + pci_device_unmap_range (pI830->PciInfo, pI830->FbBase, pI830->FbMapSize); +#else xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI830->FbBase, pI830->FbMapSize); - pI830->FbBase = 0; +#endif + pI830->FbBase = NULL; I830UnmapMMIO(pScrn); return TRUE; } -#ifndef HAVE_GET_PUT_BIOSMEMSIZE -#define HAVE_GET_PUT_BIOSMEMSIZE 1 -#endif - -#if HAVE_GET_PUT_BIOSMEMSIZE -/* - * Tell the BIOS how much video memory is available. The BIOS call used - * here won't always be available. - */ -static Bool -PutBIOSMemSize(ScrnInfoPtr pScrn, int memSize) -{ - vbeInfoPtr pVbe = I830PTR(pScrn)->pVbe; - - DPRINTF(PFX, "PutBIOSMemSize: %d kB\n", memSize / 1024); - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x5f11; - pVbe->pInt10->bx = 0; - pVbe->pInt10->cx = memSize / GTT_PAGE_SIZE; - - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - return Check5fStatus(pScrn, 0x5f11, pVbe->pInt10->ax); -} - -/* - * This reports what the previous VBEGetVBEInfo() found. Be sure to call - * VBEGetVBEInfo() after changing the BIOS memory size view. If - * a separate BIOS call is added for this, it can be put here. Only - * return a valid value if the funtionality for PutBIOSMemSize() - * is available. - */ -static int -GetBIOSMemSize(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - int memSize = KB(pI830->vbeInfo->TotalMemory * 64); - - DPRINTF(PFX, "GetBIOSMemSize\n"); - - if (PutBIOSMemSize(pScrn, memSize)) - return memSize; - else - return -1; -} -#endif - -/* - * These three functions allow the video BIOS's view of the available video - * memory to be changed. This is currently implemented only for the 830 - * and 845G, which can do this via a BIOS scratch register that holds the - * BIOS's view of the (pre-reserved) memory size. If another mechanism - * is available in the future, it can be plugged in here. - * - * The mapping used for the 830/845G scratch register's low 4 bits is: - * - * 320k => 0 - * 832k => 1 - * 8000k => 8 - * - * The "unusual" values are the 512k, 1M, 8M pre-reserved memory, less - * overhead, rounded down to the BIOS-reported 64k granularity. - */ - -static Bool -SaveBIOSMemSize(ScrnInfoPtr pScrn) +static void +I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO * colors, VisualPtr pVisual) { - I830Ptr pI830 = I830PTR(pScrn); + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + int i,j, index; + int p; + CARD16 lut_r[256], lut_g[256], lut_b[256]; - DPRINTF(PFX, "SaveBIOSMemSize\n"); + DPRINTF(PFX, "I830LoadPalette: numColors: %d\n", numColors); - if (!I830IsPrimary(pScrn)) - return FALSE; + for(p = 0; p < xf86_config->num_crtc; p++) { + xf86CrtcPtr crtc = xf86_config->crtc[p]; + I830CrtcPrivatePtr intel_crtc = crtc->driver_private; - pI830->useSWF1 = FALSE; + /* Initialize to the old lookup table values. */ + for (i = 0; i < 256; i++) { + lut_r[i] = intel_crtc->lut_r[i] << 8; + lut_g[i] = intel_crtc->lut_g[i] << 8; + lut_b[i] = intel_crtc->lut_b[i] << 8; + } -#if HAVE_GET_PUT_BIOSMEMSIZE - if ((pI830->saveBIOSMemSize = GetBIOSMemSize(pScrn)) != -1) - return TRUE; -#endif + switch(pScrn->depth) { + case 15: + for (i = 0; i < numColors; i++) { + index = indices[i]; + for (j = 0; j < 8; j++) { + lut_r[index * 8 + j] = colors[index].red << 8; + lut_g[index * 8 + j] = colors[index].green << 8; + lut_b[index * 8 + j] = colors[index].blue << 8; + } + } + break; + case 16: + for (i = 0; i < numColors; i++) { + index = indices[i]; - if (IS_I830(pI830) || IS_845G(pI830)) { - pI830->useSWF1 = TRUE; - pI830->saveSWF1 = INREG(SWF1) & 0x0f; + if (index <= 31) { + for (j = 0; j < 8; j++) { + lut_r[index * 8 + j] = colors[index].red << 8; + lut_b[index * 8 + j] = colors[index].blue << 8; + } + } - /* - * This is for sample purposes only. pI830->saveBIOSMemSize isn't used - * when pI830->useSWF1 is TRUE. - */ - switch (pI830->saveSWF1) { - case 0: - pI830->saveBIOSMemSize = KB(320); - break; - case 1: - pI830->saveBIOSMemSize = KB(832); - break; - case 8: - pI830->saveBIOSMemSize = KB(8000); - break; + for (j = 0; j < 4; j++) { + lut_g[index * 4 + j] = colors[index].green << 8; + } + } + break; default: - pI830->saveBIOSMemSize = 0; + for (i = 0; i < numColors; i++) { + index = indices[i]; + lut_r[index] = colors[index].red << 8; + lut_g[index] = colors[index].green << 8; + lut_b[index] = colors[index].blue << 8; + } break; } - return TRUE; - } - return FALSE; -} - -/* - * TweakMemorySize() tweaks the BIOS image to set the correct size. - * Original implementation by Christian Zietz in a stand-alone tool. - */ -static CARD32 -TweakMemorySize(ScrnInfoPtr pScrn, CARD32 newsize, Bool preinit) -{ -#define SIZE 0x10000 -#define _855_IDOFFSET (-23) -#define _845_IDOFFSET (-19) - - const char *MAGICstring = "Total time for VGA POST:"; - const int len = strlen(MAGICstring); - I830Ptr pI830 = I830PTR(pScrn); - volatile char *position; - char *biosAddr; - CARD32 oldsize; - CARD32 oldpermission; - CARD32 ret = 0; - int i,j = 0; - int reg = (IS_845G(pI830) || IS_I865G(pI830)) ? _845_DRAM_RW_CONTROL - : _855_DRAM_RW_CONTROL; - - PCITAG tag =pciTag(0,0,0); - if (!I830IsPrimary(pScrn)) - return 0; - - if(!pI830->PciInfo - || !(IS_845G(pI830) || IS_I85X(pI830) || IS_I865G(pI830))) - return 0; - - if (!pI830->pVbe) - return 0; - - biosAddr = xf86int10Addr(pI830->pVbe->pInt10, - pI830->pVbe->pInt10->BIOSseg << 4); - - if (!pI830->BIOSMemSizeLoc) { - if (!preinit) - return 0; - - /* Search for MAGIC string */ - for (i = 0; i < SIZE; i++) { - if (biosAddr[i] == MAGICstring[j]) { - if (++j == len) - break; - } else { - i -= j; - j = 0; - } - } - if (j < len) return 0; - - pI830->BIOSMemSizeLoc = (i - j + 1 + (IS_845G(pI830) - ? _845_IDOFFSET : _855_IDOFFSET)); - } - - position = biosAddr + pI830->BIOSMemSizeLoc; - oldsize = *(CARD32 *)position; - - ret = oldsize - 0x21000; - - /* verify that register really contains current size */ - if (preinit && ((ret >> 16) != pI830->vbeInfo->TotalMemory)) - return 0; - - oldpermission = pciReadLong(tag, reg); - pciWriteLong(tag, reg, DRAM_WRITE | (oldpermission & 0xffff)); - - *(CARD32 *)position = newsize + 0x21000; - - if (preinit) { - /* reinitialize VBE for new size */ - if (I830IsPrimary(pScrn)) { - VBEFreeVBEInfo(pI830->vbeInfo); - vbeFree(pI830->pVbe); - pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); - pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); - } else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - pI830->pVbe = pI8301->pVbe; - pI830->vbeInfo = pI8301->vbeInfo; - } - - /* verify that change was successful */ - if (pI830->vbeInfo->TotalMemory != (newsize >> 16)){ - ret = 0; - *(CARD32 *)position = oldsize; - } else { - pI830->BIOSMemorySize = KB(pI830->vbeInfo->TotalMemory * 64); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Tweak BIOS image to %d kB VideoRAM\n", - (int)(pI830->BIOSMemorySize / 1024)); - } - } - - pciWriteLong(tag, reg, oldpermission); - - return ret; + /* Make the change through RandR */ +#ifdef RANDR_12_INTERFACE + RRCrtcGammaSet(crtc->randr_crtc, lut_r, lut_g, lut_b); +#else + crtc->funcs->gamma_set(crtc, lut_r, lut_g, lut_b, 256); +#endif + } } static void -RestoreBIOSMemSize(ScrnInfoPtr pScrn) +i830_update_front_offset(ScrnInfoPtr pScrn) { + ScreenPtr pScreen = pScrn->pScreen; I830Ptr pI830 = I830PTR(pScrn); - CARD32 swf1; - - DPRINTF(PFX, "RestoreBIOSMemSize\n"); - - if (!I830IsPrimary(pScrn)) - return; - if (TweakMemorySize(pScrn, pI830->saveBIOSMemSize,FALSE)) - return; - - if (!pI830->overrideBIOSMemSize) - return; - -#if HAVE_GET_PUT_BIOSMEMSIZE - if (!pI830->useSWF1) { - PutBIOSMemSize(pScrn, pI830->saveBIOSMemSize); - return; - } -#endif + /* Update buffer locations, which may have changed as a result of + * i830_bind_all_memory(). + */ + pScrn->fbOffset = pI830->front_buffer->offset; - if ((IS_I830(pI830) || IS_845G(pI830)) && pI830->useSWF1) { - swf1 = INREG(SWF1); - swf1 &= ~0x0f; - swf1 |= (pI830->saveSWF1 & 0x0f); - OUTREG(SWF1, swf1); + /* If we are still in ScreenInit, there is no screen pixmap to be updated + * yet. We'll fix it up at CreateScreenResources. + */ + if (!pI830->starting) { + if (!pScreen->ModifyPixmapHeader(pScreen->GetScreenPixmap(pScreen), + -1, -1, -1, -1, -1, + (pointer)(pI830->FbBase + + pScrn->fbOffset))) + FatalError("Couldn't adjust screen pixmap\n"); } } -static void -SetBIOSMemSize(ScrnInfoPtr pScrn, int newSize) +/** + * Adjust the screen pixmap for the current location of the front buffer. + * This is done at EnterVT when buffers are bound as long as the resources + * have already been created, but the first EnterVT happens before + * CreateScreenResources. + */ +static Bool +i830CreateScreenResources(ScreenPtr pScreen) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - unsigned long swf1; - Bool mapped; - - DPRINTF(PFX, "SetBIOSMemSize: %d kB\n", newSize / 1024); - - if (!pI830->overrideBIOSMemSize) - return; - -#if HAVE_GET_PUT_BIOSMEMSIZE - if (!pI830->useSWF1) { - PutBIOSMemSize(pScrn, newSize); - return; - } -#endif - if ((IS_I830(pI830) || IS_845G(pI830)) && pI830->useSWF1) { - unsigned long newSWF1; + pScreen->CreateScreenResources = pI830->CreateScreenResources; + if (!(*pScreen->CreateScreenResources)(pScreen)) + return FALSE; - /* Need MMIO access here. */ - mapped = (pI830->MMIOBase != NULL); - if (!mapped) - I830MapMMIO(pScrn); + i830_update_front_offset(pScrn); - if (newSize <= KB(832)) - newSWF1 = 1; - else - newSWF1 = 8; - - swf1 = INREG(SWF1); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Before: SWF1 is 0x%08lx\n", swf1); - swf1 &= ~0x0f; - swf1 |= (newSWF1 & 0x0f); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "After: SWF1 is 0x%08lx\n", swf1); - OUTREG(SWF1, swf1); - if (!mapped) - I830UnmapMMIO(pScrn); - } + return TRUE; } -static CARD32 val8[256]; +int +i830_output_clones (ScrnInfoPtr pScrn, int type_mask) +{ + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (pScrn); + int o; + int index_mask = 0; + + for (o = 0; o < config->num_output; o++) + { + xf86OutputPtr output = config->output[o]; + I830OutputPrivatePtr intel_output = output->driver_private; + if (type_mask & (1 << intel_output->type)) + index_mask |= (1 << o); + } + return index_mask; +} +/** + * Set up the outputs according to what type of chip we are. + * + * Some outputs may not initialize, due to allocation failure or because a + * controller chip isn't found. + */ static void -I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, - LOCO * colors, VisualPtr pVisual) +I830SetupOutputs(ScrnInfoPtr pScrn) { - I830Ptr pI830; - int i,j, index; - unsigned char r, g, b; - CARD32 val, temp; - int palreg; - int dspreg, dspbase, dspsurf; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (pScrn); + I830Ptr pI830 = I830PTR(pScrn); + int o, c; + Bool lvds_detected = FALSE; - DPRINTF(PFX, "I830LoadPalette: numColors: %d\n", numColors); - pI830 = I830PTR(pScrn); - - if (pI830->Clone || pI830->MergedFB) { - if (!pI830->pipe == 0) { - palreg = PALETTE_A; - dspreg = DSPACNTR; - dspbase = DSPABASE; - } else { - palreg = PALETTE_B; - dspreg = DSPBCNTR; - dspbase = DSPBBASE; - } - - /* To ensure gamma is enabled we need to turn off and on the plane */ - temp = INREG(dspreg); - OUTREG(dspreg, temp & ~(1<<31)); - OUTREG(dspbase, INREG(dspbase)); - OUTREG(dspreg, temp | DISPPLANE_GAMMA_ENABLE); - OUTREG(dspbase, INREG(dspbase)); - - /* It seems that an initial read is needed. */ - temp = INREG(palreg); + /* everyone has at least a single analog output */ + i830_crt_init(pScrn); - switch(pScrn->depth) { - case 15: - for (i = 0; i < numColors; i++) { - index = indices[i]; - r = colors[index].red; - g = colors[index].green; - b = colors[index].blue; - val = (r << 16) | (g << 8) | b; - for (j = 0; j < 8; j++) { - OUTREG(palreg + index * 32 + (j * 4), val); - } - } - break; - case 16: - for (i = 0; i < numColors; i++) { - index = indices[i]; - r = colors[index / 2].red; - g = colors[index].green; - b = colors[index / 2].blue; - - val = (r << 16) | (g << 8) | b; - OUTREG(palreg + index * 16, val); - OUTREG(palreg + index * 16 + 4, val); - OUTREG(palreg + index * 16 + 8, val); - OUTREG(palreg + index * 16 + 12, val); - - if (index <= 31) { - r = colors[index].red; - g = colors[(index * 2) + 1].green; - b = colors[index].blue; - - val = (r << 16) | (g << 8) | b; - OUTREG(palreg + index * 32, val); - OUTREG(palreg + index * 32 + 4, val); - OUTREG(palreg + index * 32 + 8, val); - OUTREG(palreg + index * 32 + 12, val); - } - } - break; - default: - for(i = 0; i < numColors; i++) { - index = indices[i]; - r = colors[index].red; - g = colors[index].green; - b = colors[index].blue; - val = (r << 16) | (g << 8) | b; - OUTREG(palreg + index * 4, val); - } - break; - } - } + /* Set up integrated LVDS */ + if (IS_MOBILE(pI830) && !IS_I830(pI830)) + i830_lvds_init(pScrn); - if (pI830->pipe == 0) { - palreg = PALETTE_A; - dspreg = DSPACNTR; - dspbase = DSPABASE; - dspsurf = DSPASURF; + if (IS_I9XX(pI830)) { + i830_sdvo_init(pScrn, SDVOB); + i830_sdvo_init(pScrn, SDVOC); } else { - palreg = PALETTE_B; - dspreg = DSPBCNTR; - dspbase = DSPBBASE; - dspsurf = DSPBSURF; + i830_dvo_init(pScrn); } + if (IS_I9XX(pI830) && !IS_I915G(pI830)) + i830_tv_init(pScrn); + + for (o = 0; o < config->num_output; o++) + { + xf86OutputPtr output = config->output[o]; + I830OutputPrivatePtr intel_output = output->driver_private; + int crtc_mask; - /* To ensure gamma is enabled we need to turn off and on the plane */ - temp = INREG(dspreg); - OUTREG(dspreg, temp & ~(1<<31)); - OUTREG(dspbase, INREG(dspbase)); - OUTREG(dspreg, temp | DISPPLANE_GAMMA_ENABLE); - OUTREG(dspbase, INREG(dspbase)); - if (IS_I96X(pI830)) - OUTREG(dspsurf, INREG(dspsurf)); - - /* It seems that an initial read is needed. */ - temp = INREG(palreg); + if (intel_output->type == I830_OUTPUT_LVDS) + lvds_detected = TRUE; + + crtc_mask = 0; + for (c = 0; c < config->num_crtc; c++) + { + xf86CrtcPtr crtc = config->crtc[c]; + I830CrtcPrivatePtr intel_crtc = crtc->driver_private; - switch(pScrn->depth) { - case 15: - for (i = 0; i < numColors; i++) { - index = indices[i]; - r = colors[index].red; - g = colors[index].green; - b = colors[index].blue; - val = (r << 16) | (g << 8) | b; - for (j = 0; j < 8; j++) { - OUTREG(palreg + index * 32 + (j * 4), val); - } - } - break; - case 16: - for (i = 0; i < numColors; i++) { - index = indices[i]; - r = colors[index / 2].red; - g = colors[index].green; - b = colors[index / 2].blue; - - val = (r << 16) | (g << 8) | b; - OUTREG(palreg + index * 16, val); - OUTREG(palreg + index * 16 + 4, val); - OUTREG(palreg + index * 16 + 8, val); - OUTREG(palreg + index * 16 + 12, val); - - if (index <= 31) { - r = colors[index].red; - g = colors[(index * 2) + 1].green; - b = colors[index].blue; - - val = (r << 16) | (g << 8) | b; - OUTREG(palreg + index * 32, val); - OUTREG(palreg + index * 32 + 4, val); - OUTREG(palreg + index * 32 + 8, val); - OUTREG(palreg + index * 32 + 12, val); - } + if (intel_output->pipe_mask & (1 << intel_crtc->pipe)) + crtc_mask |= (1 << c); } - break; - default: -#if 1 - /* Dual head 8bpp modes seem to squish the primary's cmap - reload */ - if (I830IsPrimary(pScrn) && xf86IsEntityShared(pScrn->entityList[0]) && - pScrn->depth == 8) { - for(i = 0; i < numColors; i++) { - index = indices[i]; - r = colors[index].red; - g = colors[index].green; - b = colors[index].blue; - val8[index] = (r << 16) | (g << 8) | b; - } - } -#endif - for(i = 0; i < numColors; i++) { - index = indices[i]; - r = colors[index].red; - g = colors[index].green; - b = colors[index].blue; - val = (r << 16) | (g << 8) | b; - OUTREG(palreg + index * 4, val); -#if 1 - /* Dual head 8bpp modes seem to squish the primary's cmap - reload */ - if (!I830IsPrimary(pScrn) && xf86IsEntityShared(pScrn->entityList[0]) && - pScrn->depth == 8) { - if (palreg == PALETTE_A) - OUTREG(PALETTE_B + index * 4, val8[index]); - else - OUTREG(PALETTE_A + index * 4, val8[index]); - } -#endif - } - break; + output->possible_crtcs = crtc_mask; + output->possible_clones = i830_output_clones (pScrn, intel_output->clone_mask); } } static int -I830UseDDC(ScrnInfoPtr pScrn) +I830LVDSPresent(ScrnInfoPtr pScrn) { - xf86MonPtr DDC = (xf86MonPtr)(pScrn->monitor->DDC); - struct detailed_monitor_section* detMon; - struct monitor_ranges *mon_range = NULL; - int i; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (pScrn); + int o, lvds_detected = FALSE; - if (!DDC) return 0; + for (o = 0; o < config->num_output; o++) { + xf86OutputPtr output = config->output[o]; + I830OutputPrivatePtr intel_output = output->driver_private; - /* Now change the hsync/vrefresh values of the current monitor to - * match those of DDC */ - for (i = 0; i < 4; i++) { - detMon = &DDC->det_mon[i]; - if(detMon->type == DS_RANGES) - mon_range = &detMon->section.ranges; + if (intel_output->type == I830_OUTPUT_LVDS) + lvds_detected = TRUE; } - if (!mon_range || mon_range->min_h == 0 || mon_range->max_h == 0 || - mon_range->min_v == 0 || mon_range->max_v == 0) - return 0; /* bad ddc */ - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using detected DDC timings\n"); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tHorizSync %d-%d\n", - mon_range->min_h, mon_range->max_h); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tVertRefresh %d-%d\n", - mon_range->min_v, mon_range->max_v); -#define DDC_SYNC_TOLERANCE SYNC_TOLERANCE - if (pScrn->monitor->nHsync > 0) { - for (i = 0; i < pScrn->monitor->nHsync; i++) { - if ((1.0 - DDC_SYNC_TOLERANCE) * mon_range->min_h > - pScrn->monitor->hsync[i].lo || - (1.0 + DDC_SYNC_TOLERANCE) * mon_range->max_h < - pScrn->monitor->hsync[i].hi) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "config file hsync range %g-%gkHz not within DDC " - "hsync range %d-%dkHz\n", - pScrn->monitor->hsync[i].lo, pScrn->monitor->hsync[i].hi, - mon_range->min_h, mon_range->max_h); - } - pScrn->monitor->hsync[i].lo = mon_range->min_h; - pScrn->monitor->hsync[i].hi = mon_range->max_h; - } + return lvds_detected; +} +/** + * Setup the CRTCs + */ + + +static void +I830PreInitDDC(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (!xf86LoadSubModule(pScrn, "ddc")) { + pI830->ddc2 = FALSE; + } else { + xf86LoaderReqSymLists(I810ddcSymbols, NULL); + pI830->ddc2 = TRUE; } - if (pScrn->monitor->nVrefresh > 0) { - for (i=0; i<pScrn->monitor->nVrefresh; i++) { - if ((1.0 - DDC_SYNC_TOLERANCE) * mon_range->min_v > - pScrn->monitor->vrefresh[i].lo || - (1.0 + DDC_SYNC_TOLERANCE) * mon_range->max_v < - pScrn->monitor->vrefresh[i].hi) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "config file vrefresh range %g-%gHz not within DDC " - "vrefresh range %d-%dHz\n", - pScrn->monitor->vrefresh[i].lo, pScrn->monitor->vrefresh[i].hi, - mon_range->min_v, mon_range->max_v); - } - pScrn->monitor->vrefresh[i].lo = mon_range->min_v; - pScrn->monitor->vrefresh[i].hi = mon_range->max_v; + /* DDC can use I2C bus */ + /* Load I2C if we have the code to use it */ + if (pI830->ddc2) { + if (xf86LoadSubModule(pScrn, "i2c")) { + xf86LoaderReqSymLists(I810i2cSymbols, NULL); + + pI830->ddc2 = TRUE; + } else { + pI830->ddc2 = FALSE; } } - - return mon_range->max_clock; } static void @@ -3785,39 +953,19 @@ PreInitCleanup(ScrnInfoPtr pScrn) I830Ptr pI830 = I830PTR(pScrn); if (I830IsPrimary(pScrn)) { - SetPipeAccess(pScrn); - - pI830->entityPrivate->pScrn_1 = NULL; - if (pI830->LpRing) - xfree(pI830->LpRing); - pI830->LpRing = NULL; - if (pI830->CursorMem) - xfree(pI830->CursorMem); - pI830->CursorMem = NULL; - if (pI830->CursorMemARGB) - xfree(pI830->CursorMemARGB); - pI830->CursorMemARGB = NULL; - if (pI830->OverlayMem) - xfree(pI830->OverlayMem); - pI830->OverlayMem = NULL; - if (pI830->overlayOn) - xfree(pI830->overlayOn); - pI830->overlayOn = NULL; - if (pI830->used3D) - xfree(pI830->used3D); - pI830->used3D = NULL; + if (pI830->entityPrivate) + pI830->entityPrivate->pScrn_1 = NULL; } else { if (pI830->entityPrivate) pI830->entityPrivate->pScrn_2 = NULL; } - RestoreBIOSMemSize(pScrn); if (pI830->swfSaved) { OUTREG(SWF0, pI830->saveSWF0); OUTREG(SWF4, pI830->saveSWF4); } if (pI830->MMIOBase) I830UnmapMMIO(pScrn); - I830BIOSFreeRec(pScrn); + I830FreeRec(pScrn); } Bool @@ -3833,53 +981,69 @@ I830IsPrimary(ScrnInfoPtr pScrn) return TRUE; } -#ifdef XF86DRI -static void -I830ReduceMMSize(ScrnInfoPtr pScrn, unsigned long newSize, - const char *reason) +static Bool +i830_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height) +{ + scrn->virtualX = width; + scrn->virtualY = height; + return TRUE; +} + +static const xf86CrtcConfigFuncsRec i830_xf86crtc_config_funcs = { + i830_xf86crtc_resize +}; + +#define HOTKEY_BIOS_SWITCH 0 +#define HOTKEY_DRIVER_NOTIFY 1 + +/** + * Controls the BIOS's behavior on hotkey switch. + * + * If the mode is HOTKEY_BIOS_SWITCH, the BIOS will be set to do a mode switch + * on its own and update the state in the scratch register. + * If the mode is HOTKEY_DRIVER_NOTIFY, the BIOS won't do a mode switch and + * will just update the state to represent what it would have been switched to. + */ +static void +i830SetHotkeyControl(ScrnInfoPtr pScrn, int mode) { I830Ptr pI830 = I830PTR(pScrn); + CARD8 gr18; - newSize = ROUND_DOWN_TO(newSize, GTT_PAGE_SIZE); - if (newSize / GTT_PAGE_SIZE > I830_MM_MINPAGES) { - pI830->mmSize = newSize / 1024; - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "DRM memory manager aperture size is reduced to %d kiB\n" - "\t%s\n", pI830->mmSize, reason); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "DRM memory manager will be disabled\n\t%s\n", reason); - pI830->mmSize = 0; - } + gr18 = pI830->readControl(pI830, GRX, 0x18); + if (mode == HOTKEY_BIOS_SWITCH) + gr18 &= ~HOTKEY_VBIOS_SWITCH_BLOCK; + else + gr18 |= HOTKEY_VBIOS_SWITCH_BLOCK; + pI830->writeControl(pI830, GRX, 0x18, gr18); } -#endif - +/** + * This is called per zaphod head (so usually just once) to do initialization + * before the Screen is created. + * + * This code generally covers probing, module loading, option handling + * card mapping, and RandR setup. + */ static Bool -I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) +I830PreInit(ScrnInfoPtr pScrn, int flags) { + xf86CrtcConfigPtr xf86_config; vgaHWPtr hwp; I830Ptr pI830; MessageType from = X_PROBED; rgb defaultWeight = { 0, 0, 0 }; EntityInfoPtr pEnt; I830EntPtr pI830Ent = NULL; - int mem, memsize; int flags24; - int defmon = 0; - int i, n; - int DDCclock = 0, DDCclock2 = 0; + int i; char *s; - DisplayModePtr p, pMon; - xf86MonPtr monitor = NULL; - pointer pDDCModule = NULL, pVBEModule = NULL; - Bool enable; + pointer pVBEModule = NULL; const char *chipname; - unsigned int ver; - char v[5]; -#ifdef XF86DRI - unsigned long savedMMSize; -#endif + int num_pipe; + int max_width, max_height; + uint32_t capid; + int fb_bar, mmio_bar; if (pScrn->numEntities != 1) return FALSE; @@ -3897,7 +1061,7 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if (flags & PROBE_DETECT) { - I830BIOSProbeDDC(pScrn, pEnt->index); + I830ProbeDDC(pScrn, pEnt->index); return TRUE; } @@ -3911,21 +1075,23 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; /* Allocate driverPrivate */ - if (!I830BIOSGetRec(pScrn)) + if (!I830GetRec(pScrn)) return FALSE; pI830 = I830PTR(pScrn); pI830->SaveGeneration = -1; pI830->pEnt = pEnt; - pI830->displayWidth = 640; /* default it */ + pScrn->displayWidth = 640; /* default it */ if (pI830->pEnt->location.type != BUS_PCI) return FALSE; pI830->PciInfo = xf86GetPciInfoForEntity(pI830->pEnt->index); +#if !XSERVER_LIBPCIACCESS pI830->PciTag = pciTag(pI830->PciInfo->bus, pI830->PciInfo->device, pI830->PciInfo->func); +#endif /* Allocate an entity private if necessary */ if (xf86IsEntityShared(pScrn->entityList[0])) { @@ -3935,7 +1101,7 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) } else pI830->entityPrivate = NULL; - if (xf86RegisterResources(pI830->pEnt->index, 0, ResNone)) { + if (xf86RegisterResources(pI830->pEnt->index, NULL, ResNone)) { PreInitCleanup(pScrn); return FALSE; } @@ -4000,26 +1166,21 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) /* Process the options */ xf86CollectOptions(pScrn, NULL); - if (!(pI830->Options = xalloc(sizeof(I830BIOSOptions)))) + if (!(pI830->Options = xalloc(sizeof(I830Options)))) return FALSE; - memcpy(pI830->Options, I830BIOSOptions, sizeof(I830BIOSOptions)); + memcpy(pI830->Options, I830Options, sizeof(I830Options)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI830->Options); - /* We have to use PIO to probe, because we haven't mapped yet. */ - I830SetPIOAccess(pI830); - - /* Initialize VBE record */ - if (I830IsPrimary(pScrn)) { - if ((pI830->pVbe = VBEInit(NULL, pI830->pEnt->index)) == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "VBE initialization failed.\n"); - return FALSE; - } + if (xf86ReturnOptValBool(pI830->Options, OPTION_MODEDEBUG, FALSE)) { + pI830->debug_modes = TRUE; } else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - pI830->pVbe = pI8301->pVbe; + pI830->debug_modes = FALSE; } - switch (pI830->PciInfo->chipType) { + /* We have to use PIO to probe, because we haven't mapped yet. */ + I830SetPIOAccess(pI830); + + switch (DEVICE_ID(pI830->PciInfo)) { case PCI_CHIP_I830_M: chipname = "830M"; break; @@ -4028,8 +1189,12 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) break; case PCI_CHIP_I855_GM: /* Check capid register to find the chipset variant */ - pI830->variant = (pciReadLong(pI830->PciTag, I85X_CAPID) - >> I85X_VARIANT_SHIFT) & I85X_VARIANT_MASK; +#if XSERVER_LIBPCIACCESS + pci_device_cfg_read_u32 (pI830->PciInfo, &capid, I85X_CAPID); +#else + capid = pciReadLong (pI830->PciTag, I85X_CAPID); +#endif + pI830->variant = (capid >> I85X_VARIANT_SHIFT) & I85X_VARIANT_MASK; switch (pI830->variant) { case I855_GM: chipname = "855GM"; @@ -4068,6 +1233,9 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) case PCI_CHIP_I945_GM: chipname = "945GM"; break; + case PCI_CHIP_I945_GME: + chipname = "945GME"; + break; case PCI_CHIP_I965_G: case PCI_CHIP_I965_G_1: chipname = "965G"; @@ -4081,6 +1249,18 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) case PCI_CHIP_I965_GM: chipname = "965GM"; break; + case PCI_CHIP_I965_GME: + chipname = "965GME/GLE"; + break; + case PCI_CHIP_G33_G: + chipname = "G33"; + break; + case PCI_CHIP_Q35_G: + chipname = "Q35"; + break; + case PCI_CHIP_Q33_G: + chipname = "Q33"; + break; default: chipname = "unknown chipset"; break; @@ -4088,28 +1268,21 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Integrated Graphics Chipset: Intel(R) %s\n", chipname); - if (I830IsPrimary(pScrn)) { - pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); - } else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - pI830->vbeInfo = pI8301->vbeInfo; - } - /* Set the Chipset and ChipRev, allowing config file entries to override. */ if (pI830->pEnt->device->chipset && *pI830->pEnt->device->chipset) { pScrn->chipset = pI830->pEnt->device->chipset; from = X_CONFIG; } else if (pI830->pEnt->device->chipID >= 0) { - pScrn->chipset = (char *)xf86TokenToString(I830BIOSChipsets, + pScrn->chipset = (char *)xf86TokenToString(I830Chipsets, pI830->pEnt->device->chipID); from = X_CONFIG; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n", pI830->pEnt->device->chipID); - pI830->PciInfo->chipType = pI830->pEnt->device->chipID; + DEVICE_ID(pI830->PciInfo) = pI830->pEnt->device->chipID; } else { from = X_PROBED; - pScrn->chipset = (char *)xf86TokenToString(I830BIOSChipsets, - pI830->PciInfo->chipType); + pScrn->chipset = (char *)xf86TokenToString(I830Chipsets, + DEVICE_ID(pI830->PciInfo)); } if (pI830->pEnt->device->chipRev >= 0) { @@ -4120,18 +1293,23 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", (pScrn->chipset != NULL) ? pScrn->chipset : "Unknown i8xx"); + if (IS_I9XX(pI830)) + { + fb_bar = 2; + mmio_bar = 0; + } + else + { + fb_bar = 0; + mmio_bar = 1; + } + if (pI830->pEnt->device->MemBase != 0) { pI830->LinearAddr = pI830->pEnt->device->MemBase; from = X_CONFIG; } else { - if (IS_I9XX(pI830)) { - pI830->LinearAddr = pI830->PciInfo->memBase[2] & 0xFF000000; - from = X_PROBED; - } else if (pI830->PciInfo->memBase[1] != 0) { - /* XXX Check mask. */ - pI830->LinearAddr = pI830->PciInfo->memBase[0] & 0xFF000000; - from = X_PROBED; - } else { + pI830->LinearAddr = I810_MEMBASE (pI830->PciInfo, fb_bar); + if (pI830->LinearAddr == 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid FB address in PCI config space\n"); PreInitCleanup(pScrn); @@ -4146,13 +1324,8 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) pI830->MMIOAddr = pI830->pEnt->device->IOBase; from = X_CONFIG; } else { - if (IS_I9XX(pI830)) { - pI830->MMIOAddr = pI830->PciInfo->memBase[0] & 0xFFF80000; - from = X_PROBED; - } else if (pI830->PciInfo->memBase[1]) { - pI830->MMIOAddr = pI830->PciInfo->memBase[1] & 0xFFF80000; - from = X_PROBED; - } else { + pI830->MMIOAddr = I810_MEMBASE (pI830->PciInfo, mmio_bar); + if (pI830->MMIOAddr == 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid MMIO address in PCI config space\n"); PreInitCleanup(pScrn); @@ -4163,102 +1336,129 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, from, "IO registers at addr 0x%lX\n", (unsigned long)pI830->MMIOAddr); - /* Some of the probing needs MMIO access, so map it here. */ - I830MapMMIO(pScrn); - -#if 1 - pI830->saveSWF0 = INREG(SWF0); - pI830->saveSWF4 = INREG(SWF4); - pI830->swfSaved = TRUE; + /* check quirks */ + i830_fixup_devices(pScrn); - /* Set "extended desktop" */ - OUTREG(SWF0, pI830->saveSWF0 | (1 << 21)); + /* Allocate an xf86CrtcConfig */ + xf86CrtcConfigInit (pScrn, &i830_xf86crtc_config_funcs); + xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - /* Set "driver loaded", "OS unknown", "APM 1.2" */ - OUTREG(SWF4, (pI830->saveSWF4 & ~((3 << 19) | (7 << 16))) | - (1 << 23) | (2 << 16)); -#endif + /* See i830_exa.c comments for why we limit the framebuffer size like this. + */ + if (IS_I965G(pI830)) { + max_width = 8192; + max_height = 8192; + } else { + max_width = 2048; + max_height = 2048; + } + xf86CrtcSetSizeRange (pScrn, 320, 200, max_width, max_height); if (IS_I830(pI830) || IS_845G(pI830)) { +#if XSERVER_LIBPCIACCESS + uint16_t gmch_ctrl; + struct pci_device *bridge; + + bridge = intel_host_bridge (); + pci_device_cfg_read_u16 (bridge, &gmch_ctrl, I830_GMCH_CTRL); +#else PCITAG bridge; CARD16 gmch_ctrl; bridge = pciTag(0, 0, 0); /* This is always the host bridge */ gmch_ctrl = pciReadWord(bridge, I830_GMCH_CTRL); +#endif if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) { pI830->FbMapSize = 0x8000000; } else { pI830->FbMapSize = 0x4000000; /* 64MB - has this been tested ?? */ } } else { - if (IS_I9XX(pI830) && !IS_I965GM(pI830) && - pI830->PciInfo->chipType != PCI_CHIP_E7221_G) { - if (pI830->PciInfo->memBase[2] & 0x08000000) - pI830->FbMapSize = 0x8000000; /* 128MB aperture */ - else - pI830->FbMapSize = 0x10000000; /* 256MB aperture */ - } else - /* 128MB aperture for later chips */ + if (IS_I9XX(pI830)) { +#if XSERVER_LIBPCIACCESS + pI830->FbMapSize = pI830->PciInfo->regions[fb_bar].size; +#else + pI830->FbMapSize = 1UL << pciGetBaseSize(pI830->PciTag, 2, TRUE, + NULL); +#endif + } else { + /* 128MB aperture for later i8xx series. */ pI830->FbMapSize = 0x8000000; + } + } + + /* Some of the probing needs MMIO access, so map it here. */ + I830MapMMIO(pScrn); + + if (pI830->debug_modes) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Hardware state on X startup:\n"); + i830DumpRegs (pScrn); } - if (pI830->PciInfo->chipType == PCI_CHIP_E7221_G) - pI830->availablePipes = 1; + i830TakeRegSnapshot(pScrn); + +#if 1 + pI830->saveSWF0 = INREG(SWF0); + pI830->saveSWF4 = INREG(SWF4); + pI830->swfSaved = TRUE; + + /* Set "extended desktop" */ + OUTREG(SWF0, pI830->saveSWF0 | (1 << 21)); + + /* Set "driver loaded", "OS unknown", "APM 1.2" */ + OUTREG(SWF4, (pI830->saveSWF4 & ~((3 << 19) | (7 << 16))) | + (1 << 23) | (2 << 16)); +#endif + + if (DEVICE_ID(pI830->PciInfo) == PCI_CHIP_E7221_G) + num_pipe = 1; else if (IS_MOBILE(pI830) || IS_I9XX(pI830)) - pI830->availablePipes = 2; + num_pipe = 2; else - pI830->availablePipes = 1; + num_pipe = 1; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%d display pipe%s available.\n", - pI830->availablePipes, pI830->availablePipes > 1 ? "s" : ""); - - /* - * Get the pre-allocated (stolen) memory size. - */ - pI830->StolenMemory.Size = I830DetectMemory(pScrn); - pI830->StolenMemory.Start = 0; - pI830->StolenMemory.End = pI830->StolenMemory.Size; + num_pipe, num_pipe > 1 ? "s" : ""); - /* Sanity check: compare with what the BIOS thinks. */ - if (pI830->vbeInfo->TotalMemory != pI830->StolenMemory.Size / 1024 / 64) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Detected stolen memory (%ld kB) doesn't match what the BIOS" - " reports (%d kB)\n", - ROUND_DOWN_TO(pI830->StolenMemory.Size / 1024, 64), - pI830->vbeInfo->TotalMemory * 64); - } - - /* Find the maximum amount of agpgart memory available. */ - if (I830IsPrimary(pScrn)) { - mem = I830CheckAvailableMemory(pScrn); - pI830->StolenOnly = FALSE; - } else { - /* videoRam isn't used on the second head, but faked */ - mem = pI830->entityPrivate->pScrn_1->videoRam; - pI830->StolenOnly = TRUE; + if (xf86ReturnOptValBool(pI830->Options, OPTION_NOACCEL, FALSE)) { + pI830->noAccel = TRUE; } - if (mem <= 0) { - if (pI830->StolenMemory.Size <= 0) { - /* Shouldn't happen. */ - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "/dev/agpgart is either not available, or no memory " - "is available\nfor allocation, " - "and no pre-allocated memory is available.\n"); - PreInitCleanup(pScrn); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "/dev/agpgart is either not available, or no memory " - "is available\nfor allocation. " - "Using pre-allocated memory only.\n"); - mem = 0; - pI830->StolenOnly = TRUE; + /* + * The ugliness below: + * If either XAA or EXA (exclusive) is compiled in, default to it. + * + * If both are compiled in, and the user didn't specify noAccel, use the + * config option AccelMethod to determine which to use, defaulting to EXA + * if none is specified, or if the string was unrecognized. + * + * All this *could* go away if we removed XAA support from this driver, + * for example. :) + */ + if (!pI830->noAccel) { +#ifdef I830_USE_EXA + pI830->useEXA = TRUE; +#else + pI830->useEXA = FALSE; +#endif +#if defined(I830_USE_XAA) && defined(I830_USE_EXA) + int from = X_DEFAULT; + if ((s = (char *)xf86GetOptValString(pI830->Options, + OPTION_ACCELMETHOD))) { + if (!xf86NameCmp(s, "EXA")) { + from = X_CONFIG; + pI830->useEXA = TRUE; + } + else if (!xf86NameCmp(s, "XAA")) { + from = X_CONFIG; + pI830->useEXA = FALSE; + } + } +#endif + xf86DrvMsg(pScrn->scrnIndex, from, "Using %s for acceleration\n", + pI830->useEXA ? "EXA" : "XAA"); } - if (xf86ReturnOptValBool(pI830->Options, OPTION_NOACCEL, FALSE)) { - pI830->noAccel = TRUE; - } if (xf86ReturnOptValBool(pI830->Options, OPTION_SW_CURSOR, FALSE)) { pI830->SWCursor = TRUE; } @@ -4278,223 +1478,51 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) pI830->directRenderingDisabled = TRUE; } - pI830->mmModeFlags = 0; - if (!pI830->directRenderingDisabled) { - Bool tmp = FALSE; - - if (IS_I96X(pI830)) - pI830->mmModeFlags |= I830_KERNEL_TEX; + pI830->allocate_classic_textures = TRUE; from = X_PROBED; - if (xf86GetOptValBool(pI830->Options, - OPTION_INTELTEXPOOL, &tmp)) { - from = X_CONFIG; - if (tmp) { - pI830->mmModeFlags |= I830_KERNEL_TEX; - } else { - pI830->mmModeFlags &= ~I830_KERNEL_TEX; - } - } - if (from == X_CONFIG || - (pI830->mmModeFlags & I830_KERNEL_TEX)) { - xf86DrvMsg(pScrn->scrnIndex, from, - "Will %stry to allocate texture pool " - "for old Mesa 3D driver.\n", - (pI830->mmModeFlags & I830_KERNEL_TEX) ? - "" : "not "); - } - pI830->mmSize = I830_MM_MAXSIZE; - from = X_INFO; - if (xf86GetOptValInteger(pI830->Options, OPTION_INTELMMSIZE, - &(pI830->mmSize))) { - from = X_CONFIG; + +#ifdef XF86DRI_MM + if (!IS_I965G(pI830)) { + Bool tmp; + + if (xf86GetOptValBool(pI830->Options, + OPTION_INTELTEXPOOL, &tmp)) { + from = X_CONFIG; + if (!tmp) + pI830->allocate_classic_textures = FALSE; + } } - xf86DrvMsg(pScrn->scrnIndex, from, - "Will try to reserve %d kiB of AGP aperture space\n" - "\tfor the DRM memory manager.\n", - pI830->mmSize); +#endif } } #endif - pI830->LinearAlloc = 0; - if (xf86GetOptValInteger(pI830->Options, OPTION_LINEARALLOC, - &(pI830->LinearAlloc))) { - if (pI830->LinearAlloc > 0) - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Allocating %dKbytes of memory\n", - pI830->LinearAlloc); - else - pI830->LinearAlloc = 0; - } - - pI830->fixedPipe = -1; - if ((s = xf86GetOptValString(pI830->Options, OPTION_FIXEDPIPE)) && - I830IsPrimary(pScrn)) { - - if (strstr(s, "A") || strstr(s, "a") || strstr(s, "0")) - pI830->fixedPipe = 0; - else if (strstr(s, "B") || strstr(s, "b") || strstr(s, "1")) - pI830->fixedPipe = 1; + I830PreInitDDC(pScrn); + for (i = 0; i < num_pipe; i++) { + i830_crtc_init(pScrn, i); } + I830SetupOutputs(pScrn); - pI830->MergedFB = - xf86ReturnOptValBool(pI830->Options, OPTION_MERGEDFB, FALSE); - - pI830->IntelXinerama = - xf86ReturnOptValBool(pI830->Options, OPTION_INTELXINERAMA, TRUE); - - pI830->MonType1 = PIPE_NONE; - pI830->MonType2 = PIPE_NONE; - pI830->specifiedMonitor = FALSE; - - if ((s = xf86GetOptValString(pI830->Options, OPTION_MONITOR_LAYOUT)) && - I830IsPrimary(pScrn)) { - char *Mon1; - char *Mon2; - char *sub; - - Mon1 = strtok(s, ","); - Mon2 = strtok(NULL, ","); - - if (Mon1) { - sub = strtok(Mon1, "+"); - do { - if (strcmp(sub, "NONE") == 0) - pI830->MonType1 |= PIPE_NONE; - else if (strcmp(sub, "CRT") == 0) - pI830->MonType1 |= PIPE_CRT; - else if (strcmp(sub, "TV") == 0) - pI830->MonType1 |= PIPE_TV; - else if (strcmp(sub, "DFP") == 0) - pI830->MonType1 |= PIPE_DFP; - else if (strcmp(sub, "LFP") == 0) - pI830->MonType1 |= PIPE_LFP; - else if (strcmp(sub, "Second") == 0) - pI830->MonType1 |= PIPE_CRT2; - else if (strcmp(sub, "TV2") == 0) - pI830->MonType1 |= PIPE_TV2; - else if (strcmp(sub, "DFP2") == 0) - pI830->MonType1 |= PIPE_DFP2; - else if (strcmp(sub, "LFP2") == 0) - pI830->MonType1 |= PIPE_LFP2; - else - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Invalid Monitor type specified for Pipe A\n"); - - sub = strtok(NULL, "+"); - } while (sub); - } - - if (Mon2) { - sub = strtok(Mon2, "+"); - do { - if (strcmp(sub, "NONE") == 0) - pI830->MonType2 |= PIPE_NONE; - else if (strcmp(sub, "CRT") == 0) - pI830->MonType2 |= PIPE_CRT; - else if (strcmp(sub, "TV") == 0) - pI830->MonType2 |= PIPE_TV; - else if (strcmp(sub, "DFP") == 0) - pI830->MonType2 |= PIPE_DFP; - else if (strcmp(sub, "LFP") == 0) - pI830->MonType2 |= PIPE_LFP; - else if (strcmp(sub, "Second") == 0) - pI830->MonType2 |= PIPE_CRT2; - else if (strcmp(sub, "TV2") == 0) - pI830->MonType2 |= PIPE_TV2; - else if (strcmp(sub, "DFP2") == 0) - pI830->MonType2 |= PIPE_DFP2; - else if (strcmp(sub, "LFP2") == 0) - pI830->MonType2 |= PIPE_LFP2; - else - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Invalid Monitor type specified for Pipe B\n"); - - sub = strtok(NULL, "+"); - } while (sub); - } - - if (pI830->availablePipes == 1 && pI830->MonType2 != PIPE_NONE) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Monitor 2 cannot be specified on single pipe devices\n"); - return FALSE; - } - - if (pI830->MonType1 == PIPE_NONE && pI830->MonType2 == PIPE_NONE) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Monitor 1 and 2 cannot be type NONE\n"); - return FALSE; - } - - pI830->specifiedMonitor = TRUE; - } - - if (!pI830->MergedFB && - xf86ReturnOptValBool(pI830->Options, OPTION_CLONE, FALSE)) { - if (pI830->availablePipes == 1) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Can't enable Clone Mode because this is a single pipe device\n"); - PreInitCleanup(pScrn); - return FALSE; - } - if (pI830->entityPrivate) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Can't enable Clone Mode because second head is configured\n"); - PreInitCleanup(pScrn); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling Clone Mode\n"); - pI830->Clone = TRUE; - } - - pI830->CloneRefresh = 60; /* default to 60Hz */ - if (xf86GetOptValInteger(pI830->Options, OPTION_CLONE_REFRESH, - &(pI830->CloneRefresh))) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Clone Monitor Refresh Rate %d\n", - pI830->CloneRefresh); - } - - /* See above i830refreshes on why 120Hz is commented out */ - if (pI830->CloneRefresh < 60 || pI830->CloneRefresh > 85 /* 120 */) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Bad Clone Refresh Rate\n"); + SaveHWState(pScrn); + if (!xf86InitialConfiguration (pScrn, FALSE)) + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); + RestoreHWState(pScrn); PreInitCleanup(pScrn); return FALSE; } + RestoreHWState(pScrn); - if ((pI830->entityPrivate && I830IsPrimary(pScrn)) || pI830->Clone || - pI830->MergedFB) { - if ((!xf86GetOptValString(pI830->Options, OPTION_MONITOR_LAYOUT))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "You must have a MonitorLayout " - "defined for use in a DualHead, Clone or MergedFB setup.\n"); - PreInitCleanup(pScrn); - return FALSE; - } - - if (pI830->MonType1 == PIPE_NONE || pI830->MonType2 == PIPE_NONE) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Monitor 1 or Monitor 2 " - "cannot be type NONE in DualHead, Clone or MergedFB setup.\n"); - PreInitCleanup(pScrn); - return FALSE; - } - } - + /* XXX This should go away, replaced by xf86Crtc.c support for it */ pI830->rotation = RR_Rotate_0; - if ((s = xf86GetOptValString(pI830->Options, OPTION_ROTATE))) { - pI830->InitialRotation = 0; - if(!xf86NameCmp(s, "CW") || !xf86NameCmp(s, "270")) - pI830->InitialRotation = 270; - if(!xf86NameCmp(s, "CCW") || !xf86NameCmp(s, "90")) - pI830->InitialRotation = 90; - if(!xf86NameCmp(s, "180")) - pI830->InitialRotation = 180; - } /* * Let's setup the mobile systems to check the lid status */ - if (IS_MOBILE(pI830) && !pI830->MergedFB) { + if (IS_MOBILE(pI830)) { pI830->checkDevices = TRUE; if (!xf86ReturnOptValBool(pI830->Options, OPTION_CHECKDEVICES, TRUE)) { @@ -4512,164 +1540,7 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) } else pI830->checkDevices = FALSE; - /* - * The "VideoRam" config file parameter specifies the total amount of - * memory that will be used/allocated. When agpgart support isn't - * available (StolenOnly == TRUE), this is limited to the amount of - * pre-allocated ("stolen") memory. - */ - - /* - * Default to I830_DEFAULT_VIDEOMEM_2D (8192KB) for 2D-only, - * or I830_DEFAULT_VIDEOMEM_3D (32768KB) for 3D. If the stolen memory - * amount is higher, default to it rounded up to the nearest MB. This - * guarantees that by default there will be at least some run-time - * space for things that need a physical address. - * But, we double the amounts when dual head is enabled, and therefore - * for 2D-only we use 16384KB, and 3D we use 65536KB. The VideoRAM - * for the second head is never used, as the primary head does the - * allocation. - */ - if (!pI830->pEnt->device->videoRam) { - from = X_DEFAULT; -#ifdef XF86DRI - if (!pI830->directRenderingDisabled) - pScrn->videoRam = I830_DEFAULT_VIDEOMEM_3D; - else -#endif - pScrn->videoRam = I830_DEFAULT_VIDEOMEM_2D; - - if (xf86IsEntityShared(pScrn->entityList[0])) { - if (I830IsPrimary(pScrn)) - pScrn->videoRam += I830_DEFAULT_VIDEOMEM_2D; - else - pScrn->videoRam = I830_MAXIMUM_VBIOS_MEM; - } - - if (pI830->StolenMemory.Size / 1024 > pScrn->videoRam) - pScrn->videoRam = ROUND_TO(pI830->StolenMemory.Size / 1024, 1024); - } else { - from = X_CONFIG; - pScrn->videoRam = pI830->pEnt->device->videoRam; - } - - /* Make sure it's on a page boundary */ - if (pScrn->videoRam & (GTT_PAGE_SIZE - 1)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "VideoRAM reduced to %d kByte " - "(page aligned - was %d)\n", pScrn->videoRam & ~(GTT_PAGE_SIZE - 1), pScrn->videoRam); - pScrn->videoRam &= ~(GTT_PAGE_SIZE - 1); - } - - DPRINTF(PFX, - "Available memory: %dk\n" - "Requested memory: %dk\n", mem, pScrn->videoRam); - - - if (mem + (pI830->StolenMemory.Size / 1024) < pScrn->videoRam) { - pScrn->videoRam = mem + (pI830->StolenMemory.Size / 1024); - from = X_PROBED; - if (mem + (pI830->StolenMemory.Size / 1024) < - pI830->pEnt->device->videoRam) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "VideoRAM reduced to %d kByte " - "(limited to available sysmem)\n", pScrn->videoRam); - } - } - - if (pScrn->videoRam > pI830->FbMapSize / 1024) { - pScrn->videoRam = pI830->FbMapSize / 1024; - if (pI830->FbMapSize / 1024 < pI830->pEnt->device->videoRam) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "VideoRam reduced to %d kByte (limited to aperture size)\n", - pScrn->videoRam); - } - - if (mem > 0) { - /* - * If the reserved (BIOS accessible) memory is less than the desired - * amount, try to increase it. So far this is only implemented for - * the 845G and 830, but those details are handled in SetBIOSMemSize(). - * - * The BIOS-accessible amount is only important for setting video - * modes. The maximum amount we try to set is limited to what would - * be enough for 1920x1440 with a 2048 pitch. - * - * If ALLOCATE_ALL_BIOSMEM is enabled in i830_memory.c, all of the - * BIOS-aware memory will get allocated. If it isn't then it may - * not be, and in that case there is an assumption that the video - * BIOS won't attempt to access memory beyond what is needed for - * modes that are actually used. ALLOCATE_ALL_BIOSMEM is enabled by - * default. - */ - - /* Try to keep HW cursor and Overlay amounts separate from this. */ - int reserve = (HWCURSOR_SIZE + HWCURSOR_SIZE_ARGB + OVERLAY_SIZE) / 1024; - - if (pScrn->videoRam - reserve >= I830_MAXIMUM_VBIOS_MEM) - pI830->newBIOSMemSize = KB(I830_MAXIMUM_VBIOS_MEM); - else - pI830->newBIOSMemSize = - KB(ROUND_DOWN_TO(pScrn->videoRam - reserve, 64)); - if (pI830->vbeInfo->TotalMemory * 64 < pI830->newBIOSMemSize / 1024) { - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Will attempt to tell the BIOS that there is " - "%d kB VideoRAM\n", pI830->newBIOSMemSize / 1024); - if (SaveBIOSMemSize(pScrn)) { - pI830->overrideBIOSMemSize = TRUE; - SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); - - if (I830IsPrimary(pScrn)) { - VBEFreeVBEInfo(pI830->vbeInfo); - vbeFree(pI830->pVbe); - pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); - pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); - } else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - pI830->pVbe = pI8301->pVbe; - pI830->vbeInfo = pI8301->vbeInfo; - } - - pI830->BIOSMemorySize = KB(pI830->vbeInfo->TotalMemory * 64); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "BIOS now sees %ld kB VideoRAM\n", - pI830->BIOSMemorySize / 1024); - } else if ((pI830->saveBIOSMemSize - = TweakMemorySize(pScrn, pI830->newBIOSMemSize,TRUE)) != 0) - pI830->overrideBIOSMemSize = TRUE; - else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "BIOS view of memory size can't be changed " - "(this is not an error).\n"); - } - } - } - - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Pre-allocated VideoRAM: %ld kByte\n", - pI830->StolenMemory.Size / 1024); - xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", - pScrn->videoRam); - - pI830->TotalVideoRam = KB(pScrn->videoRam); - - /* - * If the requested videoRam amount is less than the stolen memory size, - * reduce the stolen memory size accordingly. - */ - if (pI830->StolenMemory.Size > pI830->TotalVideoRam) { - pI830->StolenMemory.Size = pI830->TotalVideoRam; - pI830->StolenMemory.End = pI830->TotalVideoRam; - } - - if (xf86GetOptValInteger(pI830->Options, OPTION_CACHE_LINES, - &(pI830->CacheLines))) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Requested %d cache lines\n", - pI830->CacheLines); - } else { - pI830->CacheLines = -1; - } + pI830->stolen_size = I830DetectMemory(pScrn); pI830->XvDisabled = !xf86ReturnOptValBool(pI830->Options, OPTION_XVIDEO, TRUE); @@ -4692,89 +1563,25 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) pI830->colorKey); #endif - pI830->allowPageFlip = FALSE; - enable = xf86ReturnOptValBool(pI830->Options, OPTION_PAGEFLIP, FALSE); #ifdef XF86DRI - if (!pI830->directRenderingDisabled) { - pI830->allowPageFlip = enable; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "page flipping %s\n", - enable ? "enabled" : "disabled"); - } -#endif + pI830->allowPageFlip = FALSE; + from = (!pI830->directRenderingDisabled && + xf86GetOptValBool(pI830->Options, OPTION_PAGEFLIP, + &pI830->allowPageFlip)) ? X_CONFIG : X_DEFAULT; - if (pI830->MergedFB) { - pI830->pScrn_2 = xalloc(sizeof(ScrnInfoRec)); + xf86DrvMsg(pScrn->scrnIndex, from, "Will%s try to enable page flipping\n", + pI830->allowPageFlip ? "" : " not"); +#endif - if(!pI830->pScrn_2) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Failed to allocate memory for MergedFB mode. Disabling.\n"); - pI830->MergedFB = FALSE; - } else { - memcpy(pI830->pScrn_2, pScrn, sizeof(ScrnInfoRec)); - } - if((s = (char *)xf86GetOptValString(pI830->Options, OPTION_SECONDPOSITION))) { - int result; - int ival; - Bool valid = FALSE; - char *tempstr = xalloc(strlen(s) + 1); - result = sscanf(s, "%s %d", tempstr, &ival); - if(result >= 1) { - if(!xf86NameCmp(tempstr,"LeftOf")) { - pI830->SecondPosition = PosLeftOf; - valid = TRUE; - if(result == 2) { - if(ival < 0) pI830->FirstYOffs = -ival; - else pI830->SecondYOffs = ival; - } - pI830->SecondIsScrn0 = TRUE; - } else if(!xf86NameCmp(tempstr,"RightOf")) { - pI830->SecondPosition = PosRightOf; - valid = TRUE; - if(result == 2) { - if(ival < 0) pI830->FirstYOffs = -ival; - else pI830->SecondYOffs = ival; - } - pI830->SecondIsScrn0 = FALSE; - } else if(!xf86NameCmp(tempstr,"Above")) { - pI830->SecondPosition = PosAbove; - valid = TRUE; - if(result == 2) { - if(ival < 0) pI830->FirstXOffs = -ival; - else pI830->SecondXOffs = ival; - } - pI830->SecondIsScrn0 = FALSE; - } else if(!xf86NameCmp(tempstr,"Below")) { - pI830->SecondPosition = PosBelow; - valid = TRUE; - if(result == 2) { - if(ival < 0) pI830->FirstXOffs = -ival; - else pI830->SecondXOffs = ival; - } - pI830->SecondIsScrn0 = TRUE; - } - } - if(!valid) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Valid parameters are: \"RightOf\", \"LeftOf\", \"Above\" or \"Below\"\n"); - } - xfree(tempstr); - } - if((s = (char *)xf86GetOptValString(pI830->Options, OPTION_METAMODES))) { - pI830->MetaModes = xalloc(strlen(s) + 1); - if(pI830->MetaModes) - memcpy(pI830->MetaModes, s, strlen(s) + 1); - } - if((s = (char *)xf86GetOptValString(pI830->Options, OPTION_SECONDHSYNC))) { - pI830->SecondHSync = xalloc(strlen(s) + 1); - if(pI830->SecondHSync) - memcpy(pI830->SecondHSync, s, strlen(s) + 1); - } - if((s = (char *)xf86GetOptValString(pI830->Options, OPTION_SECONDVREFRESH))) { - pI830->SecondVRefresh = xalloc(strlen(s) + 1); - if(pI830->SecondVRefresh) - memcpy(pI830->SecondVRefresh, s, strlen(s) + 1); - } - } +#ifdef XF86DRI + pI830->TripleBuffer = FALSE; + from = (!pI830->directRenderingDisabled && + xf86GetOptValBool(pI830->Options, OPTION_TRIPLEBUFFER, + &pI830->TripleBuffer)) ? X_CONFIG : X_DEFAULT; + xf86DrvMsg(pScrn->scrnIndex, from, "Triple buffering %sabled\n", + pI830->TripleBuffer ? "en" : "dis"); +#endif /* * If the driver can do gamma correction, it should call xf86SetGamma() here. @@ -4789,196 +1596,15 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) } } - GetBIOSVersion(pScrn, &ver); - - v[0] = (ver & 0xff000000) >> 24; - v[1] = (ver & 0x00ff0000) >> 16; - v[2] = (ver & 0x0000ff00) >> 8; - v[3] = (ver & 0x000000ff) >> 0; - v[4] = 0; - - pI830->bios_version = atoi(v); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS Build: %d\n",pI830->bios_version); - - if (IS_I9XX(pI830)) - pI830->newPipeSwitch = TRUE; - else - if (pI830->availablePipes == 2 && pI830->bios_version >= 3062) { - /* BIOS build 3062 changed the pipe switching functionality */ - pI830->newPipeSwitch = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using new Pipe switch code\n"); - } else - pI830->newPipeSwitch = FALSE; - - pI830->devicePresence = FALSE; - from = X_DEFAULT; - if (xf86ReturnOptValBool(pI830->Options, OPTION_DEVICE_PRESENCE, FALSE)) { - pI830->devicePresence = TRUE; - from = X_CONFIG; - } - xf86DrvMsg(pScrn->scrnIndex, from, "Device Presence: %s.\n", - pI830->devicePresence ? "enabled" : "disabled"); - - /* This performs an active detect of the currently attached monitors - * or, at least it's meant to..... alas it doesn't seem to always work. - */ - if (pI830->devicePresence) { - int req, att, enc; - GetDevicePresence(pScrn, &req, &att, &enc); - for (i = 0; i < NumDisplayTypes; i++) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Display Presence: %s: attached: %s, encoder: %s\n", - displayDevices[i], - BOOLTOSTRING(((1<<i) & att)>>i), - BOOLTOSTRING(((1<<i) & enc)>>i)); - } - } - - /* Save old configuration of detected devices */ - pI830->savedDevices = GetDisplayDevices(pScrn); - - if (I830IsPrimary(pScrn)) { - pI830->pipe = pI830->origPipe = GetBIOSPipe(pScrn); - - /* Override */ - if (pI830->fixedPipe != -1) { - if (xf86IsEntityShared(pScrn->entityList[0]) || pI830->Clone || - pI830->MergedFB) { - pI830->pipe = pI830->fixedPipe; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Fixed Pipe setting primary to pipe %s.\n", - pI830->fixedPipe ? "B" : "A"); - } - } - - /* If the monitors aren't setup, read from the current config */ - if (pI830->MonType1 == PIPE_NONE && pI830->MonType2 == PIPE_NONE) { - pI830->MonType1 = pI830->savedDevices & 0xff; - pI830->MonType2 = (pI830->savedDevices & 0xff00) >> 8; - } else { - /* Here, we've switched pipes from our primary */ - if (pI830->MonType1 == PIPE_NONE && pI830->pipe == 0) - pI830->pipe = 1; - if (pI830->MonType2 == PIPE_NONE && pI830->pipe == 1) - pI830->pipe = 0; - } - - pI830->operatingDevices = (pI830->MonType2 << 8) | pI830->MonType1; - - if (!xf86IsEntityShared(pScrn->entityList[0]) && !pI830->Clone && - !pI830->MergedFB) { - /* If we're not dual head, clone or mergedfb, turn off the - * second head if monitorlayout is also specified. - */ - - if (pI830->pipe == 0) - pI830->operatingDevices = pI830->MonType1; - else - pI830->operatingDevices = pI830->MonType2 << 8; - } - - if (pI830->pipe != pI830->origPipe) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Primary Pipe has been switched from original pipe (%s to %s)\n", - pI830->origPipe ? "B" : "A", pI830->pipe ? "B" : "A"); - } else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - pI830->operatingDevices = pI8301->operatingDevices; - pI830->pipe = !pI8301->pipe; - pI830->MonType1 = pI8301->MonType1; - pI830->MonType2 = pI8301->MonType2; - } - - /* Buggy BIOS 3066 is known to cause this, so turn this off */ - if (pI830->bios_version == 3066) { - pI830->displayInfo = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Detected Broken Video BIOS, turning off displayInfo.\n"); - } else - pI830->displayInfo = TRUE; - from = X_DEFAULT; - if (!xf86ReturnOptValBool(pI830->Options, OPTION_DISPLAY_INFO, TRUE)) { - pI830->displayInfo = FALSE; - from = X_CONFIG; - } - if (xf86ReturnOptValBool(pI830->Options, OPTION_DISPLAY_INFO, FALSE)) { - pI830->displayInfo = TRUE; - from = X_CONFIG; - } - xf86DrvMsg(pScrn->scrnIndex, from, "Display Info: %s.\n", - pI830->displayInfo ? "enabled" : "disabled"); - - if (!I830DetectDisplayDevice(pScrn)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Couldn't detect display devices.\n"); - PreInitCleanup(pScrn); - return FALSE; - } - - if (I830IsPrimary(pScrn)) { - if (!SetDisplayDevices(pScrn, pI830->operatingDevices)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to switch to monitor configuration (0x%x)\n", - pI830->operatingDevices); - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Please check the devices specified in your MonitorLayout\n"); - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "is configured correctly.\n"); - PreInitCleanup(pScrn); - return FALSE; - } - } - - PrintDisplayDeviceInfo(pScrn); - - if (xf86IsEntityShared(pScrn->entityList[0])) { - if (!I830IsPrimary(pScrn)) { - /* This could be made to work with a little more fiddling */ - pI830->directRenderingDisabled = TRUE; - - xf86DrvMsg(pScrn->scrnIndex, from, "Secondary head is using Pipe %s\n", - pI830->pipe ? "B" : "A"); - } else { - xf86DrvMsg(pScrn->scrnIndex, from, "Primary head is using Pipe %s\n", - pI830->pipe ? "B" : "A"); - } - } else { - xf86DrvMsg(pScrn->scrnIndex, from, "Display is using Pipe %s\n", - pI830->pipe ? "B" : "A"); - } - - /* Alloc our pointers for the primary head */ - if (I830IsPrimary(pScrn)) { - pI830->LpRing = xalloc(sizeof(I830RingBuffer)); - pI830->CursorMem = xalloc(sizeof(I830MemRange)); - pI830->CursorMemARGB = xalloc(sizeof(I830MemRange)); - pI830->OverlayMem = xalloc(sizeof(I830MemRange)); - pI830->overlayOn = xalloc(sizeof(Bool)); - pI830->used3D = xalloc(sizeof(int)); - if (!pI830->LpRing || !pI830->CursorMem || !pI830->CursorMemARGB || - !pI830->OverlayMem || !pI830->overlayOn || !pI830->used3D) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Could not allocate primary data structures.\n"); - PreInitCleanup(pScrn); - return FALSE; - } - *pI830->overlayOn = FALSE; - if (pI830->entityPrivate) - pI830->entityPrivate->XvInUse = -1; - } - /* Check if the HW cursor needs physical address. */ if (IS_MOBILE(pI830) || IS_I9XX(pI830)) pI830->CursorNeedsPhysical = TRUE; else pI830->CursorNeedsPhysical = FALSE; - if (IS_I96X(pI830)) + if (IS_I965G(pI830) || IS_G33CLASS(pI830)) pI830->CursorNeedsPhysical = FALSE; - /* Force ring buffer to be in low memory for all chipsets */ - pI830->NeedRingBufferLow = TRUE; - /* * XXX If we knew the pre-initialised GTT format for certain, we could * probably figure out the physical address even in the StolenOnly case. @@ -4997,602 +1623,18 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) pI830->SWCursor = TRUE; } - /* - * Reduce the maximum videoram available for video modes by the ring buffer, - * minimum scratch space and HW cursor amounts. - */ - if (!pI830->SWCursor) { - pScrn->videoRam -= (HWCURSOR_SIZE / 1024); - pScrn->videoRam -= (HWCURSOR_SIZE_ARGB / 1024); - } - if (!pI830->XvDisabled) - pScrn->videoRam -= (OVERLAY_SIZE / 1024); - if (!pI830->noAccel) { - pScrn->videoRam -= (PRIMARY_RINGBUFFER_SIZE / 1024); - pScrn->videoRam -= (MIN_SCRATCH_BUFFER_SIZE / 1024); - } - - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Maximum frambuffer space: %d kByte\n", pScrn->videoRam); - - SetPipeAccess(pScrn); - - /* Check we have an LFP connected, before trying to - * read PanelID information. */ - if ( (pI830->pipe == 1 && pI830->operatingDevices & (PIPE_LFP << 8)) || - (pI830->pipe == 0 && pI830->operatingDevices & PIPE_LFP) ) - vbeDoPanelID(pI830->pVbe); - - pDDCModule = xf86LoadSubModule(pScrn, "ddc"); - - monitor = vbeDoEDID(pI830->pVbe, pDDCModule); - - if ((pScrn->monitor->DDC = monitor) != NULL) { - xf86PrintEDID(monitor); - xf86SetDDCproperties(pScrn, monitor); - } - - if(pI830->MergedFB) { - pI830->pScrn_2->monitor = xalloc(sizeof(MonRec)); - if(pI830->pScrn_2->monitor) { - DisplayModePtr tempm = NULL, currentm = NULL, newm = NULL; - memcpy(pI830->pScrn_2->monitor, pScrn->monitor, sizeof(MonRec)); - pI830->pScrn_2->monitor->DDC = NULL; - pI830->pScrn_2->monitor->Modes = NULL; - pI830->pScrn_2->monitor->id = (char *)SecondMonitorName; - tempm = pScrn->monitor->Modes; - while(tempm) { - if(!(newm = xalloc(sizeof(DisplayModeRec)))) break; - memcpy(newm, tempm, sizeof(DisplayModeRec)); - if(!(newm->name = xalloc(strlen(tempm->name) + 1))) { - xfree(newm); - break; - } - strcpy(newm->name, tempm->name); - if(!pI830->pScrn_2->monitor->Modes) - pI830->pScrn_2->monitor->Modes = newm; - if(currentm) { - currentm->next = newm; - newm->prev = currentm; - } - currentm = newm; - tempm = tempm->next; - } - if(pI830->SecondHSync) { - pI830->pScrn_2->monitor->nHsync = - I830StrToRanges(pI830->pScrn_2->monitor->hsync, pI830->SecondHSync, MAX_HSYNC); - } - if(pI830->SecondVRefresh) { - pI830->pScrn_2->monitor->nVrefresh = - I830StrToRanges(pI830->pScrn_2->monitor->vrefresh, pI830->SecondVRefresh, MAX_VREFRESH); - } - SetBIOSPipe(pScrn, !pI830->pipe); - pI830->pVbe->ddc = DDC_UNCHECKED; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Probing DDC data for second head\n"); - if((monitor = vbeDoEDID(pI830->pVbe, pDDCModule))) { - xf86PrintEDID(monitor); - xf86SetDDCproperties(pI830->pScrn_2, monitor); - pI830->pScrn_2->monitor->DDC = monitor; - /* use DDC data if no ranges in config file */ - if(!pI830->SecondHSync) { - pI830->pScrn_2->monitor->nHsync = 0; - } - if(!pI830->SecondVRefresh) { - pI830->pScrn_2->monitor->nVrefresh = 0; - } - } - SetPipeAccess(pScrn); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate memory for second monitor.\n"); - if(pI830->pScrn_2) - xfree(pI830->pScrn_2); - pI830->pScrn_2 = NULL; - pI830->MergedFB = FALSE; - } - } - - xf86UnloadSubModule(pDDCModule); - - /* XXX Move this to a header. */ -#define VIDEO_BIOS_SCRATCH 0x18 - -#if 1 - /* - * XXX This should be in ScreenInit/EnterVT. PreInit should not leave the - * state changed. - */ - /* Enable hot keys by writing the proper value to GR18 */ - { - CARD8 gr18; - - gr18 = pI830->readControl(pI830, GRX, VIDEO_BIOS_SCRATCH); - gr18 &= ~0x80; /* - * Clear Hot key bit so that Video - * BIOS performs the hot key - * servicing - */ - pI830->writeControl(pI830, GRX, VIDEO_BIOS_SCRATCH, gr18); - } -#endif - - pI830->useExtendedRefresh = FALSE; - - if (xf86IsEntityShared(pScrn->entityList[0]) || pI830->Clone || - pI830->MergedFB) { - int pipe = - (pI830->operatingDevices >> PIPE_SHIFT(pI830->pipe)) & PIPE_ACTIVE_MASK; - if (pipe & ~PIPE_CRT_ACTIVE) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "A non-CRT device is attached to pipe %c.\n" - "\tNo refresh rate overrides will be attempted.\n", - PIPE_NAME(pI830->pipe)); - pI830->vesa->useDefaultRefresh = TRUE; - } - /* - * Some desktop platforms might not have 0x5f05, so useExtendedRefresh - * would need to be set to FALSE for those cases. - */ - if (!pI830->vesa->useDefaultRefresh) - pI830->useExtendedRefresh = TRUE; - } else { - for (i = 0; i < pI830->availablePipes; i++) { - int pipe = - (pI830->operatingDevices >> PIPE_SHIFT(i)) & PIPE_ACTIVE_MASK; - if (pipe & ~PIPE_CRT_ACTIVE) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "A non-CRT device is attached to pipe %c.\n" - "\tNo refresh rate overrides will be attempted.\n", - PIPE_NAME(i)); - pI830->vesa->useDefaultRefresh = TRUE; - } - /* - * Some desktop platforms might not have 0x5f05, so useExtendedRefresh - * would need to be set to FALSE for those cases. - */ - if (!pI830->vesa->useDefaultRefresh) - pI830->useExtendedRefresh = TRUE; - } - } - - if (pI830->useExtendedRefresh && !pI830->vesa->useDefaultRefresh) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Will use BIOS call 0x5f05 to set refresh rates for CRTs.\n"); - } - - /* - * Limit videoram available for mode selection to what the video - * BIOS can see. - */ - if (pScrn->videoRam > (pI830->vbeInfo->TotalMemory * 64)) - memsize = pI830->vbeInfo->TotalMemory * 64; - else - memsize = pScrn->videoRam; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Maximum space available for video modes: %d kByte\n", memsize); - - /* By now, we should have had some monitor settings, but if not, we - * need to setup some defaults. These are used in common/xf86Modes.c - * so we'll use them here for GetModePool, and that's all. - * We unset them after the call, so we can report 'defaults' as being - * used through the common layer. - */ -#define DEFAULT_HSYNC_LO 28 -#define DEFAULT_HSYNC_HI 33 -#define DEFAULT_VREFRESH_LO 43 -#define DEFAULT_VREFRESH_HI 72 - - if (pScrn->monitor->nHsync == 0) { - pScrn->monitor->hsync[0].lo = DEFAULT_HSYNC_LO; - pScrn->monitor->hsync[0].hi = DEFAULT_HSYNC_HI; - pScrn->monitor->nHsync = 1; - defmon |= 1; - } - - if (pScrn->monitor->nVrefresh == 0) { - pScrn->monitor->vrefresh[0].lo = DEFAULT_VREFRESH_LO; - pScrn->monitor->vrefresh[0].hi = DEFAULT_VREFRESH_HI; - pScrn->monitor->nVrefresh = 1; - defmon |= 2; - } - - DDCclock = I830UseDDC(pScrn); - - if (pI830->MergedFB) - DDCclock2 = I830UseDDC(pI830->pScrn_2); - - /* - * Note: VBE modes (> 0x7f) won't work with Intel's extended BIOS - * functions. - */ - pScrn->modePool = I830GetModePool(pScrn, pI830->pVbe, pI830->vbeInfo); - - if (!pScrn->modePool) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "No Video BIOS modes for chosen depth.\n"); - PreInitCleanup(pScrn); - return FALSE; - } - - if (pI830->MergedFB) { - SetBIOSPipe(pScrn, !pI830->pipe); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Retrieving mode pool for second head.\n"); - pI830->pScrn_2->modePool = I830GetModePool(pI830->pScrn_2, pI830->pVbe, pI830->vbeInfo); - - if (!pI830->pScrn_2->modePool) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "No Video BIOS modes for chosen depth.\n"); - PreInitCleanup(pScrn); - return FALSE; - } - SetPipeAccess(pScrn); - } - - /* This may look a little weird, but to notify that we're using the - * default hsync/vrefresh we need to unset what we just set ..... - */ - if (defmon & 1) { - pScrn->monitor->hsync[0].lo = 0; - pScrn->monitor->hsync[0].hi = 0; - pScrn->monitor->nHsync = 0; - } - - if (defmon & 2) { - pScrn->monitor->vrefresh[0].lo = 0; - pScrn->monitor->vrefresh[0].hi = 0; - pScrn->monitor->nVrefresh = 0; - } - - SetPipeAccess(pScrn); - VBESetModeNames(pScrn->modePool); - if (pI830->MergedFB) - VBESetModeNames(pI830->pScrn_2->modePool); - - - /* - * XXX DDC information: There's code in xf86ValidateModes - * (VBEValidateModes) to set monitor defaults based on DDC information - * where available. If we need something that does better than this, - * there's code in vesa/vesa.c. - */ - - /* XXX Need to get relevant modes and virtual parameters. */ - /* Do the mode validation without regard to special scanline pitches. */ - SetPipeAccess(pScrn); - n = VBEValidateModes(pScrn, NULL, pScrn->display->modes, NULL, - NULL, 0, MAX_DISPLAY_PITCH, 1, - 0, MAX_DISPLAY_HEIGHT, - pScrn->display->virtualX, - pScrn->display->virtualY, - memsize, LOOKUP_BEST_REFRESH); - if (n <= 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); - PreInitCleanup(pScrn); - return FALSE; - } - - if (pI830->MergedFB) { - n = VBEValidateModes(pI830->pScrn_2, NULL, pI830->pScrn_2->display->modes, NULL, - NULL, 0, MAX_DISPLAY_PITCH, 1, - 0, MAX_DISPLAY_HEIGHT, - pScrn->display->virtualX, - pScrn->display->virtualY, - memsize, LOOKUP_BEST_REFRESH); - if (n <= 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); - PreInitCleanup(pScrn); - return FALSE; - } - } - - /* Only use this if we've got DDC available */ - if (DDCclock > 0) { - p = pScrn->modes; - if (p == NULL) - return FALSE; - do { - int Clock = 100000000; /* incredible value */ - - if (p->status == MODE_OK) { - for (pMon = pScrn->monitor->Modes; pMon != NULL; pMon = pMon->next) { - if ((pMon->HDisplay != p->HDisplay) || - (pMon->VDisplay != p->VDisplay) || - (pMon->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2))) - continue; - - /* Find lowest supported Clock for this resolution */ - if (Clock > pMon->Clock) - Clock = pMon->Clock; - } - - if (Clock != 100000000 && DDCclock < 2550 && Clock / 1000.0 > DDCclock) { - ErrorF("(%s,%s) mode clock %gMHz exceeds DDC maximum %dMHz\n", - p->name, pScrn->monitor->id, - Clock/1000.0, DDCclock); - p->status = MODE_BAD; - } - } - p = p->next; - } while (p != NULL && p != pScrn->modes); - } - - /* Only use this if we've got DDC available */ - if (DDCclock2 > 0) { - p = pI830->pScrn_2->modes; - if (p == NULL) - return FALSE; - do { - int Clock = 100000000; /* incredible value */ - - if (p->status == MODE_OK) { - for (pMon = pI830->pScrn_2->monitor->Modes; pMon != NULL; pMon = pMon->next) { - if ((pMon->HDisplay != p->HDisplay) || - (pMon->VDisplay != p->VDisplay) || - (pMon->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2))) - continue; - - /* Find lowest supported Clock for this resolution */ - if (Clock > pMon->Clock) - Clock = pMon->Clock; - } - - if (Clock != 100000000 && DDCclock2 < 2550 && Clock / 1000.0 > DDCclock2) { - ErrorF("(%s,%s) mode clock %gMHz exceeds DDC maximum %dMHz\n", - p->name, pI830->pScrn_2->monitor->id, - Clock/1000.0, DDCclock2); - p->status = MODE_BAD; - } - } - p = p->next; - } while (p != NULL && p != pI830->pScrn_2->modes); - } - - xf86PruneDriverModes(pScrn); - if (pScrn->modes == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n"); PreInitCleanup(pScrn); return FALSE; } - - if (pI830->MergedFB) { - DisplayModePtr old_modes, cur_mode; - - xf86PruneDriverModes(pI830->pScrn_2); - - if (pI830->pScrn_2->modes == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n"); - PreInitCleanup(pScrn); - return FALSE; - } - - old_modes = pScrn->modes; - cur_mode = pScrn->currentMode; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MergedFB: Generating mode list\n"); - - pScrn->modes = I830GenerateModeList(pScrn, pI830->MetaModes, - old_modes, pI830->pScrn_2->modes, - pI830->SecondPosition); - - if(!pScrn->modes) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes. Disabling MergedFB.\n"); - pScrn->modes = old_modes; - pScrn->currentMode = cur_mode; - pI830->MergedFB = FALSE; - } - } - - /* Now we check the VESA BIOS's displayWidth and reset if necessary */ - p = pScrn->modes; - do { - I830ModePrivatePtr mp = (I830ModePrivatePtr) p->Private; - VbeModeInfoBlock *modeInfo; - - /* Get BytesPerScanline so we can reset displayWidth */ - if ((modeInfo = VBEGetModeInfo(pI830->pVbe, mp->vbeData.mode))) { - if (pScrn->displayWidth < modeInfo->BytesPerScanline / pI830->cpp) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Correcting stride (%d -> %d)\n", pScrn->displayWidth, modeInfo->BytesPerScanline); - pScrn->displayWidth = modeInfo->BytesPerScanline / pI830->cpp; - } - } - p = p->next; - } while (p != NULL && p != pScrn->modes); - pScrn->currentMode = pScrn->modes; - if (pI830->MergedFB) { - /* If no virtual dimension was given by the user, - * calculate a sane one now. Adapts pScrn->virtualX, - * pScrn->virtualY and pScrn->displayWidth. - */ - I830RecalcDefaultVirtualSize(pScrn); - - pScrn->modes = pScrn->modes->next; /* We get the last from GenerateModeList(), skip to first */ - pScrn->currentMode = pScrn->modes; - pI830->currentMode = pScrn->currentMode; - } - -#ifndef USE_PITCHES -#define USE_PITCHES 1 -#endif - pI830->disableTiling = FALSE; - - /* - * If DRI is potentially usable, check if there is enough memory available - * for it, and if there's also enough to allow tiling to be enabled. - */ - -#if defined(XF86DRI) - if (!I830CheckDRIAvailable(pScrn)) { - pI830->directRenderingDisabled = TRUE; - pI830->mmSize = 0; - } else if (pScrn->videoRam > pI830->FbMapSize / 1024 - pI830->mmSize) { - I830ReduceMMSize(pScrn, pI830->FbMapSize - KB(pScrn->videoRam), - "to make room for video memory"); - } - - if (I830IsPrimary(pScrn) && !pI830->directRenderingDisabled) { - int savedDisplayWidth = pScrn->displayWidth; - int memNeeded = 0; - /* Good pitches to allow tiling. Don't care about pitches < 1024. */ - static const int pitches[] = { -/* - 128 * 2, - 128 * 4, -*/ - 128 * 8, - 128 * 16, - 128 * 32, - 128 * 64, - 0 - }; - -#ifdef I830_XV - /* - * Set this so that the overlay allocation is factored in when - * appropriate. - */ - pI830->XvEnabled = !pI830->XvDisabled; -#endif - - for (i = 0; pitches[i] != 0; i++) { -#if USE_PITCHES - if (pitches[i] >= pScrn->displayWidth) { - pScrn->displayWidth = pitches[i]; - break; - } -#else - if (pitches[i] == pScrn->displayWidth) - break; -#endif - } - - /* - * If the displayWidth is a tilable pitch, test if there's enough - * memory available to enable tiling. - */ - savedMMSize = pI830->mmSize; - if (pScrn->displayWidth == pitches[i]) { - retry_dryrun: - I830ResetAllocations(pScrn, 0); - if (I830Allocate2DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_INITIAL) && - I830Allocate3DMemory(pScrn, ALLOCATE_DRY_RUN)) { - memNeeded = I830GetExcessMemoryAllocations(pScrn); - if (memNeeded > 0 || pI830->MemoryAperture.Size < 0) { - if (memNeeded > 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "%d kBytes additional video memory is " - "required to\n\tenable tiling mode for DRI.\n", - (memNeeded + 1023) / 1024); - } - if (pI830->MemoryAperture.Size < 0) { - if (KB(pI830->mmSize) > I830_MM_MINPAGES * GTT_PAGE_SIZE) { - I830ReduceMMSize(pScrn, I830_MM_MINPAGES * GTT_PAGE_SIZE, - "to make room in AGP aperture for tiling."); - goto retry_dryrun; - } - - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Allocation with DRI tiling enabled would " - "exceed the\n" - "\tmemory aperture size (%ld kB) by %ld kB.\n" - "\tReduce VideoRam amount to avoid this!\n", - pI830->FbMapSize / 1024, - -pI830->MemoryAperture.Size / 1024); - } - pScrn->displayWidth = savedDisplayWidth; - pI830->allowPageFlip = FALSE; - } else if (pScrn->displayWidth != savedDisplayWidth) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Increasing the scanline pitch to allow tiling mode " - "(%d -> %d).\n", - savedDisplayWidth, pScrn->displayWidth); - } - } else { - memNeeded = 0; - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Unexpected dry run allocation failure (1).\n"); - } - } - if (memNeeded > 0 || pI830->MemoryAperture.Size < 0) { - /* - * Tiling can't be enabled. Check if there's enough memory for DRI - * without tiling. - */ - pI830->mmSize = savedMMSize; - pI830->disableTiling = TRUE; - retry_dryrun2: - I830ResetAllocations(pScrn, 0); - if (I830Allocate2DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_INITIAL) && - I830Allocate3DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_NO_TILING)) { - memNeeded = I830GetExcessMemoryAllocations(pScrn); - if (memNeeded > 0 || pI830->MemoryAperture.Size < 0) { - if (memNeeded > 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "%d kBytes additional video memory is required " - "to enable DRI.\n", - (memNeeded + 1023) / 1024); - } - if (pI830->MemoryAperture.Size < 0) { - if (KB(pI830->mmSize) > I830_MM_MINPAGES * GTT_PAGE_SIZE) { - I830ReduceMMSize(pScrn, I830_MM_MINPAGES * GTT_PAGE_SIZE, - "to save AGP aperture space for video memory."); - goto retry_dryrun2; - } - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Allocation with DRI enabled would " - "exceed the\n" - "\tmemory aperture size (%ld kB) by %ld kB.\n" - "\tReduce VideoRam amount to avoid this!\n", - pI830->FbMapSize / 1024, - -pI830->MemoryAperture.Size / 1024); - } - pI830->mmSize = 0; - pI830->directRenderingDisabled = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n"); - } - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Unexpected dry run allocation failure (2).\n"); - } - } - } else -#endif - pI830->disableTiling = TRUE; /* no DRI - so disableTiling */ - - if (pScrn->displayWidth >= 4096) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot support > 1024x768 in leftof/rightof configurations. disabling DRI.\n"); - pI830->directRenderingDisabled = TRUE; - } - - if (pScrn->virtualY > 2048) { + if (!IS_I965G(pI830) && pScrn->virtualY > 2048) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot support > 2048 vertical lines. disabling acceleration.\n"); pI830->noAccel = TRUE; } - pI830->displayWidth = pScrn->displayWidth; - - SetPipeAccess(pScrn); - I830PrintModes(pScrn); - - if (!pI830->vesa->useDefaultRefresh) { - /* - * This sets the parameters for the VBE modes according to the best - * usable parameters from the Monitor sections modes (usually the - * default VESA modes), allowing for better than default refresh rates. - * This only works for VBE 3.0 and later. Also, we only do this - * if there are no non-CRT devices attached. - */ - SetPipeAccess(pScrn); - I830SetModeParameters(pScrn, pI830->pVbe); - } - - /* PreInit shouldn't leave any state changes, so restore this. */ - RestoreBIOSMemSize(pScrn); - /* Don't need MMIO access anymore. */ if (pI830->swfSaved) { OUTREG(SWF0, pI830->saveSWF0); @@ -5610,14 +1652,37 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) xf86LoaderReqSymLists(I810fbSymbols, NULL); - if (!pI830->noAccel) { +#ifdef I830_USE_XAA + if (!pI830->noAccel && !pI830->useEXA) { if (!xf86LoadSubModule(pScrn, "xaa")) { PreInitCleanup(pScrn); return FALSE; } xf86LoaderReqSymLists(I810xaaSymbols, NULL); } +#endif + +#ifdef I830_USE_EXA + if (!pI830->noAccel && pI830->useEXA) { + XF86ModReqInfo req; + int errmaj, errmin; + memset(&req, 0, sizeof(req)); + req.majorversion = 2; +#if EXA_VERSION_MINOR >= 2 + req.minorversion = 2; +#else + req.minorversion = 1; +#endif + if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL, &req, + &errmaj, &errmin)) { + LoaderErrorMsg(NULL, "exa", errmaj, errmin); + PreInitCleanup(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(I830exaSymbols, NULL); + } +#endif if (!pI830->SWCursor) { if (!xf86LoadSubModule(pScrn, "ramdac")) { PreInitCleanup(pScrn); @@ -5626,6 +1691,8 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) xf86LoaderReqSymLists(I810ramdacSymbols, NULL); } + i830CompareRegsToSnapshot(pScrn, "After PreInit"); + I830UnmapMMIO(pScrn); /* We won't be using the VGA access after the probe. */ @@ -5635,23 +1702,11 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) #if 0 if (I830IsPrimary(pScrn)) { - VBEFreeVBEInfo(pI830->vbeInfo); vbeFree(pI830->pVbe); } - pI830->vbeInfo = NULL; pI830->pVbe = NULL; #endif - /* Use the VBE mode restore workaround by default. */ - pI830->vbeRestoreWorkaround = TRUE; - from = X_DEFAULT; - if (xf86ReturnOptValBool(pI830->Options, OPTION_VBE_RESTORE, FALSE)) { - pI830->vbeRestoreWorkaround = FALSE; - from = X_CONFIG; - } - xf86DrvMsg(pScrn->scrnIndex, from, "VBE Restore workaround: %s.\n", - pI830->vbeRestoreWorkaround ? "enabled" : "disabled"); - #if defined(XF86DRI) /* Load the dri module if requested. */ if (xf86ReturnOptValBool(pI830->Options, OPTION_DRI, FALSE) && @@ -5662,100 +1717,21 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) } #endif - /* rotation requires the newer libshadow */ - if (I830IsPrimary(pScrn)) { - int errmaj, errmin; - pI830->shadowReq.majorversion = 1; - pI830->shadowReq.minorversion = 1; - - if (!LoadSubModule(pScrn->module, "shadow", NULL, NULL, NULL, - &pI830->shadowReq, &errmaj, &errmin)) { - pI830->shadowReq.minorversion = 0; - if (!LoadSubModule(pScrn->module, "shadow", NULL, NULL, NULL, - &pI830->shadowReq, &errmaj, &errmin)) { - LoaderErrorMsg(NULL, "shadow", errmaj, errmin); - return FALSE; - } - } - } else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - pI830->shadowReq.majorversion = pI8301->shadowReq.majorversion; - pI830->shadowReq.minorversion = pI8301->shadowReq.minorversion; - pI830->shadowReq.patchlevel = pI8301->shadowReq.patchlevel; - } - xf86LoaderReqSymLists(I810shadowSymbols, NULL); - pI830->preinit = FALSE; return TRUE; } /* - * As the name says. Check that the initial state is reasonable. - * If any unrecoverable problems are found, bail out here. - */ -static Bool -CheckInheritedState(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - int errors = 0, fatal = 0; - unsigned long temp, head, tail; - - if (!I830IsPrimary(pScrn)) return TRUE; - - /* Check first for page table errors */ - temp = INREG(PGE_ERR); - if (temp != 0) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "PGTBL_ER is 0x%08lx\n", temp); - errors++; - } - temp = INREG(PGETBL_CTL); - if (!(temp & 1)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "PGTBL_CTL (0x%08lx) indicates GTT is disabled\n", temp); - errors++; - } - temp = INREG(LP_RING + RING_LEN); - if (temp & 1) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "PRB0_CTL (0x%08lx) indicates ring buffer enabled\n", temp); - errors++; - } - head = INREG(LP_RING + RING_HEAD); - tail = INREG(LP_RING + RING_TAIL); - if ((tail & I830_TAIL_MASK) != (head & I830_HEAD_MASK)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "PRB0_HEAD (0x%08lx) and PRB0_TAIL (0x%08lx) indicate " - "ring buffer not flushed\n", head, tail); - errors++; - } - -#if 0 - if (errors) { - if (IS_I96X(pI830)) - I965PrintErrorState(pScrn); - else - I830PrintErrorState(pScrn); - } -#endif - - if (fatal) - FatalError("CheckInheritedState: can't recover from the above\n"); - - return (errors != 0); -} - -/* * Reset registers that it doesn't make sense to save/restore to a sane state. * This is basically the ring buffer and fence registers. Restoring these * doesn't make sense without restoring GTT mappings. This is something that * whoever gets control next should do. */ static void -ResetState(ScrnInfoPtr pScrn, Bool flush) +i830_stop_ring(ScrnInfoPtr pScrn, Bool flush) { I830Ptr pI830 = I830PTR(pScrn); - int i; unsigned long temp; DPRINTF(PFX, "ResetState: flush is %s\n", BOOLTOSTRING(flush)); @@ -5765,65 +1741,24 @@ ResetState(ScrnInfoPtr pScrn, Bool flush) if (pI830->entityPrivate) pI830->entityPrivate->RingRunning = 0; - /* Reset the fence registers to 0 */ - if (IS_I96X(pI830)) { - for (i = 0; i < FENCE_NEW_NR; i++) { - OUTREG(FENCE_NEW + i * 8, 0); - OUTREG(FENCE_NEW + 4 + i * 8, 0); - } - } else { - for (i = 0; i < FENCE_NR; i++) - OUTREG(FENCE + i * 4, 0); - } - /* Flush the ring buffer (if enabled), then disable it. */ - if (pI830->AccelInfoRec != NULL && flush) { + if (!pI830->noAccel) { temp = INREG(LP_RING + RING_LEN); - if (temp & 1) { - I830RefreshRing(pScrn); + if (temp & RING_VALID) { + i830_refresh_ring(pScrn); I830Sync(pScrn); DO_RING_IDLE(); } - } - OUTREG(LP_RING + RING_LEN, 0); - OUTREG(LP_RING + RING_HEAD, 0); - OUTREG(LP_RING + RING_TAIL, 0); - OUTREG(LP_RING + RING_START, 0); - - if (pI830->CursorInfoRec && pI830->CursorInfoRec->HideCursor) - pI830->CursorInfoRec->HideCursor(pScrn); -} -static void -SetFenceRegs(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - int i; - - DPRINTF(PFX, "SetFenceRegs\n"); - - if (!I830IsPrimary(pScrn)) return; - - if (IS_I96X(pI830)) { - for (i = 0; i < FENCE_NEW_NR; i++) { - OUTREG(FENCE_NEW + i * 8, pI830->ModeReg.Fence[i]); - OUTREG(FENCE_NEW + 4 + i * 8, pI830->ModeReg.Fence[i+FENCE_NEW_NR]); - if (I810_DEBUG & DEBUG_VERBOSE_VGA) { - ErrorF("Fence Start Register : %x\n", pI830->ModeReg.Fence[i]); - ErrorF("Fence End Register : %x\n", pI830->ModeReg.Fence[i+FENCE_NEW_NR]); - } - } - } else { - for (i = 0; i < FENCE_NR; i++) { - OUTREG(FENCE + i * 4, pI830->ModeReg.Fence[i]); - if (I810_DEBUG & DEBUG_VERBOSE_VGA) - ErrorF("Fence Register : %x\n", pI830->ModeReg.Fence[i]); - } + OUTREG(LP_RING + RING_LEN, 0); + OUTREG(LP_RING + RING_HEAD, 0); + OUTREG(LP_RING + RING_TAIL, 0); + OUTREG(LP_RING + RING_START, 0); } } static void -SetRingRegs(ScrnInfoPtr pScrn) +i830_start_ring(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); unsigned int itemp; @@ -5842,28 +1777,44 @@ SetRingRegs(ScrnInfoPtr pScrn) OUTREG(LP_RING + RING_TAIL, 0); OUTREG(LP_RING + RING_HEAD, 0); - if ((long)(pI830->LpRing->mem.Start & I830_RING_START_MASK) != - pI830->LpRing->mem.Start) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "I830SetRingRegs: Ring buffer start (%lx) violates its " - "mask (%x)\n", pI830->LpRing->mem.Start, I830_RING_START_MASK); - } + assert((pI830->LpRing->mem->offset & I830_RING_START_MASK) == + pI830->LpRing->mem->offset); + /* Don't care about the old value. Reserved bits must be zero anyway. */ - itemp = pI830->LpRing->mem.Start & I830_RING_START_MASK; + itemp = pI830->LpRing->mem->offset; OUTREG(LP_RING + RING_START, itemp); - if (((pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES) != - pI830->LpRing->mem.Size - 4096) { + if (((pI830->LpRing->mem->size - 4096) & I830_RING_NR_PAGES) != + pI830->LpRing->mem->size - 4096) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830SetRingRegs: Ring buffer size - 4096 (%lx) violates its " - "mask (%x)\n", pI830->LpRing->mem.Size - 4096, + "mask (%x)\n", pI830->LpRing->mem->size - 4096, I830_RING_NR_PAGES); } /* Don't care about the old value. Reserved bits must be zero anyway. */ - itemp = (pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES; + itemp = (pI830->LpRing->mem->size - 4096) & I830_RING_NR_PAGES; itemp |= (RING_NO_REPORT | RING_VALID); OUTREG(LP_RING + RING_LEN, itemp); - I830RefreshRing(pScrn); + i830_refresh_ring(pScrn); +} + +void +i830_refresh_ring(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + /* If we're reaching RefreshRing as a result of grabbing the DRI lock + * before we've set up the ringbuffer, don't bother. + */ + if (pI830->LpRing->mem == NULL) + return; + + pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; + pI830->LpRing->tail = INREG(LP_RING + RING_TAIL); + pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8); + if (pI830->LpRing->space < 0) + pI830->LpRing->space += pI830->LpRing->mem->size; + i830MarkSync(pScrn); } /* @@ -5877,1109 +1828,332 @@ SetHWOperatingState(ScrnInfoPtr pScrn) DPRINTF(PFX, "SetHWOperatingState\n"); - if (!pI830->noAccel) - SetRingRegs(pScrn); - SetFenceRegs(pScrn); + /* Disable clock gating reported to work incorrectly according to the specs. + */ + if (IS_I965GM(pI830)) { + OUTREG(RENCLK_GATE_D1, I965_RCC_CLOCK_GATE_DISABLE); + } else if (IS_I965G(pI830)) { + OUTREG(RENCLK_GATE_D1, + I965_RCC_CLOCK_GATE_DISABLE | I965_ISC_CLOCK_GATE_DISABLE); + } else if (IS_I855(pI830) || IS_I865G(pI830)) { + OUTREG(RENCLK_GATE_D1, SV_CLOCK_GATE_DISABLE); + } else if (IS_I830(pI830)) { + OUTREG(DSPCLK_GATE_D, OVRUNIT_CLOCK_GATE_DISABLE); + } + + i830_start_ring(pScrn); if (!pI830->SWCursor) I830InitHWCursor(pScrn); } +enum pipe { + PIPE_A = 0, + PIPE_B, +}; + static Bool -SaveHWState(ScrnInfoPtr pScrn) +i830_pipe_enabled(I830Ptr pI830, enum pipe pipe) { - I830Ptr pI830 = I830PTR(pScrn); - vbeInfoPtr pVbe = pI830->pVbe; - vgaHWPtr hwp = VGAHWPTR(pScrn); - vgaRegPtr vgaReg = &hwp->SavedReg; - VbeModeInfoBlock *modeInfo; - VESAPtr pVesa; - - DPRINTF(PFX, "SaveHWState\n"); - - if (I830IsPrimary(pScrn) && pI830->pipe != pI830->origPipe) - SetBIOSPipe(pScrn, pI830->origPipe); - else - SetPipeAccess(pScrn); - - pVesa = pI830->vesa; - - /* Make sure we save at least this information in case of failure. */ - VBEGetVBEMode(pVbe, &pVesa->stateMode); - pVesa->stateRefresh = GetRefreshRate(pScrn, pVesa->stateMode, NULL); - modeInfo = VBEGetModeInfo(pVbe, pVesa->stateMode); - pVesa->savedScanlinePitch = 0; - if (modeInfo) { - if (VBE_MODE_GRAPHICS(modeInfo)) { - VBEGetLogicalScanline(pVbe, &pVesa->savedScanlinePitch, NULL, NULL); - } - VBEFreeModeInfo(modeInfo); - } - - vgaHWUnlock(hwp); - vgaHWSave(pScrn, vgaReg, VGA_SR_FONTS); - - pVesa = pI830->vesa; - - if (IS_I96X(pI830)) { - pI830->savedAsurf = INREG(DSPASURF); - pI830->savedBsurf = INREG(DSPBSURF); - } + if (pipe == PIPE_A) + return (INREG(PIPEACONF) & PIPEACONF_ENABLE); + else + return (INREG(PIPEBCONF) & PIPEBCONF_ENABLE); +} - /* - * This save/restore method doesn't work for 845G BIOS, or for some - * other platforms. Enable it in all cases. - */ - /* - * KW: This may have been because of the behaviour I've found on my - * board: The 'save' command actually modifies the interrupt - * registers, turning off the irq & breaking the kernel module - * behaviour. - */ - if (!pI830->vbeRestoreWorkaround) { - CARD16 imr = INREG16(IMR); - CARD16 ier = INREG16(IER); - CARD16 hwstam = INREG16(HWSTAM); +static void +i830_save_palette(I830Ptr pI830, enum pipe pipe) +{ + int i; - if (!VBESaveRestore(pVbe, MODE_SAVE, &pVesa->state, &pVesa->stateSize, - &pVesa->statePage)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "SaveHWState: VBESaveRestore(MODE_SAVE) failed.\n"); - return FALSE; - } + if (!i830_pipe_enabled(pI830, pipe)) + return; - OUTREG16(IMR, imr); - OUTREG16(IER, ier); - OUTREG16(HWSTAM, hwstam); - } + for(i= 0; i < 256; i++) { + if (pipe == PIPE_A) + pI830->savePaletteA[i] = INREG(PALETTE_A + (i << 2)); + else + pI830->savePaletteB[i] = INREG(PALETTE_B + (i << 2)); + } +} - pVesa->savedPal = VBESetGetPaletteData(pVbe, FALSE, 0, 256, - NULL, FALSE, FALSE); - if (!pVesa->savedPal) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "SaveHWState: VBESetGetPaletteData(GET) failed.\n"); - return FALSE; - } +static void +i830_restore_palette(I830Ptr pI830, enum pipe pipe) +{ + int i; - VBEGetDisplayStart(pVbe, &pVesa->x, &pVesa->y); + if (!i830_pipe_enabled(pI830, pipe)) + return; - return TRUE; + for(i= 0; i < 256; i++) { + if (pipe == PIPE_A) + OUTREG(PALETTE_A + (i << 2), pI830->savePaletteA[i]); + else + OUTREG(PALETTE_B + (i << 2), pI830->savePaletteB[i]); + } } static Bool -RestoreHWState(ScrnInfoPtr pScrn) +SaveHWState(ScrnInfoPtr pScrn) { + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); I830Ptr pI830 = I830PTR(pScrn); - vbeInfoPtr pVbe = pI830->pVbe; vgaHWPtr hwp = VGAHWPTR(pScrn); vgaRegPtr vgaReg = &hwp->SavedReg; - VESAPtr pVesa; - Bool restored = FALSE; - - DPRINTF(PFX, "RestoreHWState\n"); - - if (I830IsPrimary(pScrn) && pI830->pipe != pI830->origPipe) - SetBIOSPipe(pScrn, pI830->origPipe); - else - SetPipeAccess(pScrn); - - pVesa = pI830->vesa; - - /* - * Workaround for text mode restoration with some flat panels. - * Temporarily program a 640x480 mode before switching back to - * text mode. - */ - if (pVesa->useDefaultRefresh) - I830Set640x480(pScrn); - - if (pVesa->state && pVesa->stateSize) { - CARD16 imr = INREG16(IMR); - CARD16 ier = INREG16(IER); - CARD16 hwstam = INREG16(HWSTAM); - - /* Make a copy of the state. Don't rely on it not being touched. */ - if (!pVesa->pstate) { - pVesa->pstate = xalloc(pVesa->stateSize); - if (pVesa->pstate) - memcpy(pVesa->pstate, pVesa->state, pVesa->stateSize); - } - restored = VBESaveRestore(pVbe, MODE_RESTORE, &pVesa->state, - &pVesa->stateSize, &pVesa->statePage); - if (!restored) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "RestoreHWState: VBESaveRestore failed.\n"); - } - /* Copy back */ - if (pVesa->pstate) - memcpy(pVesa->state, pVesa->pstate, pVesa->stateSize); - - OUTREG16(IMR, imr); - OUTREG16(IER, ier); - OUTREG16(HWSTAM, hwstam); - } - /* If that failed, restore the original mode. */ - if (!restored) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Setting the original video mode instead of restoring\n\t" - "the saved state\n"); - I830VESASetVBEMode(pScrn, pVesa->stateMode, NULL); - if (!pVesa->useDefaultRefresh && pI830->useExtendedRefresh) { - SetRefreshRate(pScrn, pVesa->stateMode, pVesa->stateRefresh); - } - } - if (pVesa->savedScanlinePitch) - VBESetLogicalScanline(pVbe, pVesa->savedScanlinePitch); - - if (pVesa->savedPal) - VBESetGetPaletteData(pVbe, TRUE, 0, 256, pVesa->savedPal, FALSE, TRUE); - - VBESetDisplayStart(pVbe, pVesa->x, pVesa->y, TRUE); + int i; - if (IS_I96X(pI830)) { - OUTREG(DSPASURF, pI830->savedAsurf); - OUTREG(DSPBSURF, pI830->savedBsurf); + if (pI830->fb_compression) { + pI830->saveFBC_CFB_BASE = INREG(FBC_CFB_BASE); + pI830->saveFBC_LL_BASE = INREG(FBC_LL_BASE); + pI830->saveFBC_CONTROL2 = INREG(FBC_CONTROL2); + pI830->saveFBC_CONTROL = INREG(FBC_CONTROL); + } + + /* Save video mode information for native mode-setting. */ + pI830->saveDSPACNTR = INREG(DSPACNTR); + pI830->savePIPEACONF = INREG(PIPEACONF); + pI830->savePIPEASRC = INREG(PIPEASRC); + pI830->saveFPA0 = INREG(FPA0); + pI830->saveFPA1 = INREG(FPA1); + pI830->saveDPLL_A = INREG(DPLL_A); + if (IS_I965G(pI830)) + pI830->saveDPLL_A_MD = INREG(DPLL_A_MD); + pI830->saveHTOTAL_A = INREG(HTOTAL_A); + pI830->saveHBLANK_A = INREG(HBLANK_A); + pI830->saveHSYNC_A = INREG(HSYNC_A); + pI830->saveVTOTAL_A = INREG(VTOTAL_A); + pI830->saveVBLANK_A = INREG(VBLANK_A); + pI830->saveVSYNC_A = INREG(VSYNC_A); + pI830->saveBCLRPAT_A = INREG(BCLRPAT_A); + pI830->saveDSPASTRIDE = INREG(DSPASTRIDE); + pI830->saveDSPASIZE = INREG(DSPASIZE); + pI830->saveDSPAPOS = INREG(DSPAPOS); + pI830->saveDSPABASE = INREG(DSPABASE); + + i830_save_palette(pI830, PIPE_A); + + if(xf86_config->num_crtc == 2) { + pI830->savePIPEBCONF = INREG(PIPEBCONF); + pI830->savePIPEBSRC = INREG(PIPEBSRC); + pI830->saveDSPBCNTR = INREG(DSPBCNTR); + pI830->saveFPB0 = INREG(FPB0); + pI830->saveFPB1 = INREG(FPB1); + pI830->saveDPLL_B = INREG(DPLL_B); + if (IS_I965G(pI830)) + pI830->saveDPLL_B_MD = INREG(DPLL_B_MD); + pI830->saveHTOTAL_B = INREG(HTOTAL_B); + pI830->saveHBLANK_B = INREG(HBLANK_B); + pI830->saveHSYNC_B = INREG(HSYNC_B); + pI830->saveVTOTAL_B = INREG(VTOTAL_B); + pI830->saveVBLANK_B = INREG(VBLANK_B); + pI830->saveVSYNC_B = INREG(VSYNC_B); + pI830->saveBCLRPAT_B = INREG(BCLRPAT_B); + pI830->saveDSPBSTRIDE = INREG(DSPBSTRIDE); + pI830->saveDSPBSIZE = INREG(DSPBSIZE); + pI830->saveDSPBPOS = INREG(DSPBPOS); + pI830->saveDSPBBASE = INREG(DSPBBASE); + + i830_save_palette(pI830, PIPE_B); + } + + if (IS_I965G(pI830)) { + pI830->saveDSPASURF = INREG(DSPASURF); + pI830->saveDSPBSURF = INREG(DSPBSURF); + pI830->saveDSPATILEOFF = INREG(DSPATILEOFF); + pI830->saveDSPBTILEOFF = INREG(DSPBTILEOFF); + } + + pI830->saveVCLK_DIVISOR_VGA0 = INREG(VCLK_DIVISOR_VGA0); + pI830->saveVCLK_DIVISOR_VGA1 = INREG(VCLK_DIVISOR_VGA1); + pI830->saveVCLK_POST_DIV = INREG(VCLK_POST_DIV); + pI830->saveVGACNTRL = INREG(VGACNTRL); + + for(i = 0; i < 7; i++) { + pI830->saveSWF[i] = INREG(SWF0 + (i << 2)); + pI830->saveSWF[i+7] = INREG(SWF00 + (i << 2)); + } + pI830->saveSWF[14] = INREG(SWF30); + pI830->saveSWF[15] = INREG(SWF31); + pI830->saveSWF[16] = INREG(SWF32); + + if (IS_MOBILE(pI830) && !IS_I830(pI830)) + pI830->saveLVDS = INREG(LVDS); + pI830->savePFIT_CONTROL = INREG(PFIT_CONTROL); + + for (i = 0; i < xf86_config->num_output; i++) { + xf86OutputPtr output = xf86_config->output[i]; + if (output->funcs->save) + (*output->funcs->save) (output); } - vgaHWRestore(pScrn, vgaReg, VGA_SR_FONTS); - vgaHWLock(hwp); + vgaHWUnlock(hwp); + vgaHWSave(pScrn, vgaReg, VGA_SR_FONTS); return TRUE; } -static void I830SetCloneVBERefresh(ScrnInfoPtr pScrn, int mode, VbeCRTCInfoBlock * block, int refresh) -{ - I830Ptr pI830 = I830PTR(pScrn); - DisplayModePtr p = NULL; - int RefreshRate; - int clock; - - /* Search for our mode and get a refresh to match */ - for (p = pScrn->monitor->Modes; p != NULL; p = p->next) { - if ((p->HDisplay != pI830->CloneHDisplay) || - (p->VDisplay != pI830->CloneVDisplay) || - (p->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2))) - continue; - RefreshRate = ((double)(p->Clock * 1000) / - (double)(p->HTotal * p->VTotal)) * 100; - /* we could probably do better here that 2Hz boundaries */ - if (RefreshRate > (refresh - 200) && RefreshRate < (refresh + 200)) { - block->HorizontalTotal = p->HTotal; - block->HorizontalSyncStart = p->HSyncStart; - block->HorizontalSyncEnd = p->HSyncEnd; - block->VerticalTotal = p->VTotal; - block->VerticalSyncStart = p->VSyncStart; - block->VerticalSyncEnd = p->VSyncEnd; - block->Flags = ((p->Flags & V_NHSYNC) ? CRTC_NHSYNC : 0) | - ((p->Flags & V_NVSYNC) ? CRTC_NVSYNC : 0); - block->PixelClock = p->Clock * 1000; - /* XXX May not have this. */ - clock = VBEGetPixelClock(pI830->pVbe, mode, block->PixelClock); -#ifdef DEBUG - ErrorF("Setting clock %.2fMHz, closest is %.2fMHz\n", - (double)data->block->PixelClock / 1000000.0, - (double)clock / 1000000.0); -#endif - if (clock) - block->PixelClock = clock; - block->RefreshRate = RefreshRate; - return; - } - } -} - -static Bool -I830VESASetVBEMode(ScrnInfoPtr pScrn, int mode, VbeCRTCInfoBlock * block) -{ - I830Ptr pI830 = I830PTR(pScrn); - Bool ret = FALSE; - int Mon; - - DPRINTF(PFX, "Setting mode 0x%.8x\n", mode); - -#if 0 - /* Clear the framebuffer (could do this with VBIOS call) */ - if (I830IsPrimary(pScrn)) - memset(pI830->FbBase + pI830->FrontBuffer.Start, 0, - pScrn->virtualY * pI830->displayWidth * pI830->cpp); - else - memset(pI830->FbBase + pI830->FrontBuffer2.Start, 0, - pScrn->virtualY * pI830->displayWidth * pI830->cpp); -#endif - - if (pI830->Clone && - pI830->CloneHDisplay && pI830->CloneVDisplay && - !pI830->preinit && !pI830->closing) { - VbeCRTCInfoBlock newblock; - int newmode = mode; - - if (pI830->pipe == 1) - Mon = pI830->MonType1; - else - Mon = pI830->MonType2; - - SetBIOSPipe(pScrn, !pI830->pipe); - - /* Now recheck refresh operations we can use */ - pI830->useExtendedRefresh = FALSE; - pI830->vesa->useDefaultRefresh = FALSE; - - if (Mon != PIPE_CRT) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "A non-CRT device is attached to Clone pipe %c.\n" - "\tNo refresh rate overrides will be attempted (0x%x).\n", - PIPE_NAME(!pI830->pipe), newmode); - pI830->vesa->useDefaultRefresh = TRUE; - } - /* - * Some desktop platforms might not have 0x5f05, so useExtendedRefresh - * would need to be set to FALSE for those cases. - */ - if (!pI830->vesa->useDefaultRefresh) - pI830->useExtendedRefresh = TRUE; - - newmode |= 1 << 11; - if (pI830->vesa->useDefaultRefresh) - newmode &= ~(1 << 11); - - if (!SetRefreshRate(pScrn, newmode, 60)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "BIOS call 0x5f05 not supported on Clone Head, " - "setting refresh with VBE 3 method.\n"); - pI830->useExtendedRefresh = FALSE; - } - - if (!pI830->vesa->useDefaultRefresh) { - I830SetCloneVBERefresh(pScrn, newmode, &newblock, pI830->CloneRefresh * 100); - - if (!VBESetVBEMode(pI830->pVbe, newmode, &newblock)) { - if (!VBESetVBEMode(pI830->pVbe, (newmode & ~(1 << 11)), NULL)) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to set mode for Clone head.\n"); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Setting refresh on clone head with VBE 3 method.\n"); - pI830->useExtendedRefresh = FALSE; - } - } else { - if (!VBESetVBEMode(pI830->pVbe, (newmode & ~(1 << 11)), NULL)) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to set mode for Clone head.\n"); - } - - if (pI830->useExtendedRefresh && !pI830->vesa->useDefaultRefresh) { - if (!SetRefreshRate(pScrn, newmode, pI830->CloneRefresh)) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to set refresh rate to %dHz on Clone head.\n", - pI830->CloneRefresh); - else - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Set refresh rate to %dHz on Clone head.\n", - pI830->CloneRefresh); - } - SetPipeAccess(pScrn); - } - - if (pI830->pipe == 0) - Mon = pI830->MonType1; - else - Mon = pI830->MonType2; - - - /* Now recheck refresh operations we can use */ - pI830->useExtendedRefresh = FALSE; - pI830->vesa->useDefaultRefresh = FALSE; - - if (Mon != PIPE_CRT) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "A non-CRT device is attached to pipe %c.\n" - "\tNo refresh rate overrides will be attempted.\n", - PIPE_NAME(pI830->pipe)); - pI830->vesa->useDefaultRefresh = TRUE; - } - - mode |= 1 << 11; - if (pI830->vesa->useDefaultRefresh) - mode &= ~(1 << 11); - /* - * Some desktop platforms might not have 0x5f05, so useExtendedRefresh - * would need to be set to FALSE for those cases. - */ - if (!pI830->vesa->useDefaultRefresh) - pI830->useExtendedRefresh = TRUE; - - if (!SetRefreshRate(pScrn, mode, 60)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "BIOS call 0x5f05 not supported, " - "setting refresh with VBE 3 method.\n"); - pI830->useExtendedRefresh = FALSE; - } - - if (!pI830->vesa->useDefaultRefresh && block) { - ret = VBESetVBEMode(pI830->pVbe, mode, block); - if (!ret) - ret = VBESetVBEMode(pI830->pVbe, (mode & ~(1 << 11)), NULL); - else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Setting refresh with VBE 3 method.\n"); - pI830->useExtendedRefresh = FALSE; - } - } else { - ret = VBESetVBEMode(pI830->pVbe, (mode & ~(1 << 11)), NULL); - } - - /* Might as well bail now if we've failed */ - if (!ret) return FALSE; - - if (pI830->useExtendedRefresh && !pI830->vesa->useDefaultRefresh && block) { - if (!SetRefreshRate(pScrn, mode, block->RefreshRate / 100)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to set refresh rate to %dHz.\n", - block->RefreshRate / 100); - pI830->useExtendedRefresh = FALSE; - } - } - - return ret; -} - static Bool -I830VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) +RestoreHWState(ScrnInfoPtr pScrn) { + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); I830Ptr pI830 = I830PTR(pScrn); - vbeInfoPtr pVbe = pI830->pVbe; - I830ModePrivatePtr mp = (I830ModePrivatePtr) pMode->Private; - int mode, i; - CARD32 planeA, planeB, temp; - int refresh = 60; -#ifdef XF86DRI - Bool didLock = FALSE; -#endif - - DPRINTF(PFX, "I830VESASetMode\n"); + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->SavedReg; + int i; - /* Always Enable Linear Addressing */ - mode = mp->vbeData.mode | (1 << 15) | (1 << 14); + DPRINTF(PFX, "RestoreHWState\n"); #ifdef XF86DRI - didLock = I830DRILock(pScrn); + I830DRISetVBlankInterrupt (pScrn, FALSE); #endif - - if (pI830->Clone) { - pI830->CloneHDisplay = pMode->HDisplay; - pI830->CloneVDisplay = pMode->VDisplay; + /* Disable outputs */ + for (i = 0; i < xf86_config->num_output; i++) { + xf86OutputPtr output = xf86_config->output[i]; + output->funcs->dpms(output, DPMSModeOff); } - -#ifndef MODESWITCH_RESET_STATE -#define MODESWITCH_RESET_STATE 0 -#endif -#if MODESWITCH_RESET_STATE - ResetState(pScrn, TRUE); -#endif - - SetPipeAccess(pScrn); - - if (!pI830->MergedFB) { - if (I830VESASetVBEMode(pScrn, mode, mp->vbeData.block) == FALSE) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Set VBE Mode failed!\n"); - return FALSE; - } - }else { - I830ModePrivatePtr s = (I830ModePrivatePtr)mp->merged.Second->Private; - I830ModePrivatePtr f = (I830ModePrivatePtr)mp->merged.First->Private; - int pipe = pI830->pipe; /* save current pipe */ - - SetBIOSPipe(pScrn, !pI830->pipe); - - pI830->pipe = !pI830->pipe; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting mode on Pipe %s.\n", pI830->pipe ? "B" : "A"); - - if (I830VESASetVBEMode(pScrn, (s->vbeData.mode | 1<<15 | 1<<14), s->vbeData.block) == FALSE) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Set VBE Mode failed!\n"); - return FALSE; - } - - pI830->pipe = pipe; /* restore current pipe */ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting mode on Pipe %s.\n", pI830->pipe ? "B" : "A"); - - SetPipeAccess(pScrn); - - if (I830VESASetVBEMode(pScrn, (f->vbeData.mode | 1<<15 | 1<<14), f->vbeData.block) == FALSE) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Set VBE Mode failed!\n"); - return FALSE; - } - } - -#if 0 - { /* I96X ENABLE TILING */ - planeA = INREG(DSPACNTR) | 1<<10; - OUTREG(DSPACNTR, planeA); - /* flush the change. */ - temp = INREG(DSPABASE); - OUTREG(DSPABASE, temp); - } -#else - { /* I96X DISABLE TILING */ - planeA = INREG(DSPACNTR) & ~1<<10; - OUTREG(DSPACNTR, planeA); - /* flush the change. */ - temp = INREG(DSPABASE); - OUTREG(DSPABASE, temp); - OUTREG(DSPASURF, INREG(DSPASURF)); - } -#endif - - /* - * The BIOS may not set a scanline pitch that would require more video - * memory than it's aware of. We check for this later, and set it - * explicitly if necessary. - */ - if (mp->vbeData.data->XResolution != pI830->displayWidth) { - if (pI830->Clone || pI830->MergedFB) { - SetBIOSPipe(pScrn, !pI830->pipe); - VBESetLogicalScanline(pVbe, pI830->displayWidth); - } - SetPipeAccess(pScrn); - VBESetLogicalScanline(pVbe, pI830->displayWidth); - } - - if (pScrn->bitsPerPixel >= 8 && pI830->vbeInfo->Capabilities[0] & 0x01) { - if (pI830->Clone || pI830->MergedFB) { - SetBIOSPipe(pScrn, !pI830->pipe); - VBESetGetDACPaletteFormat(pVbe, 8); - } - SetPipeAccess(pScrn); - VBESetGetDACPaletteFormat(pVbe, 8); + i830WaitForVblank(pScrn); + + /* Disable pipes */ + for (i = 0; i < xf86_config->num_crtc; i++) { + xf86CrtcPtr crtc = xf86_config->crtc[i]; + crtc->funcs->dpms(crtc, DPMSModeOff); } + i830WaitForVblank(pScrn); - /* XXX Fix plane A with pipe A, and plane B with pipe B. */ - planeA = INREG(DSPACNTR); - planeB = INREG(DSPBCNTR); - - pI830->planeEnabled[0] = ((planeA & DISPLAY_PLANE_ENABLE) != 0); - pI830->planeEnabled[1] = ((planeB & DISPLAY_PLANE_ENABLE) != 0); + if (IS_MOBILE(pI830) && !IS_I830(pI830)) + OUTREG(LVDS, pI830->saveLVDS); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Display plane A is %s and connected to %s.\n", - pI830->planeEnabled[0] ? "enabled" : "disabled", - planeA & DISPPLANE_SEL_PIPE_MASK ? "Pipe B" : "Pipe A"); - if (pI830->availablePipes == 2) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Display plane B is %s and connected to %s.\n", - pI830->planeEnabled[1] ? "enabled" : "disabled", - planeB & DISPPLANE_SEL_PIPE_MASK ? "Pipe B" : "Pipe A"); - - if (pI830->operatingDevices & 0xff) { - pI830->planeEnabled[0] = 1; - } else { - pI830->planeEnabled[0] = 0; - } + if (!IS_I830(pI830) && !IS_845G(pI830)) + OUTREG(PFIT_CONTROL, pI830->savePFIT_CONTROL); - if (pI830->operatingDevices & 0xff00) { - pI830->planeEnabled[1] = 1; - } else { - pI830->planeEnabled[1] = 0; - } + if (pI830->saveDPLL_A & DPLL_VCO_ENABLE) + { + OUTREG(DPLL_A, pI830->saveDPLL_A & ~DPLL_VCO_ENABLE); + usleep(150); + } + OUTREG(FPA0, pI830->saveFPA0); + OUTREG(FPA1, pI830->saveFPA1); + OUTREG(DPLL_A, pI830->saveDPLL_A); + usleep(150); + if (IS_I965G(pI830)) + OUTREG(DPLL_A_MD, pI830->saveDPLL_A_MD); + else + OUTREG(DPLL_A, pI830->saveDPLL_A); + usleep(150); + + OUTREG(HTOTAL_A, pI830->saveHTOTAL_A); + OUTREG(HBLANK_A, pI830->saveHBLANK_A); + OUTREG(HSYNC_A, pI830->saveHSYNC_A); + OUTREG(VTOTAL_A, pI830->saveVTOTAL_A); + OUTREG(VBLANK_A, pI830->saveVBLANK_A); + OUTREG(VSYNC_A, pI830->saveVSYNC_A); + OUTREG(BCLRPAT_A, pI830->saveBCLRPAT_A); - if (pI830->planeEnabled[0]) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling plane A.\n"); - planeA |= DISPLAY_PLANE_ENABLE; - planeA &= ~DISPPLANE_SEL_PIPE_MASK; - planeA |= DISPPLANE_SEL_PIPE_A; - OUTREG(DSPACNTR, planeA); - /* flush the change. */ - temp = INREG(DSPABASE); - OUTREG(DSPABASE, temp); - if (IS_I96X(pI830)) { - temp = INREG(DSPASURF); - OUTREG(DSPASURF, temp); - } - } - if (pI830->planeEnabled[1]) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling plane B.\n"); - planeB |= DISPLAY_PLANE_ENABLE; - planeB &= ~DISPPLANE_SEL_PIPE_MASK; - planeB |= DISPPLANE_SEL_PIPE_B; - OUTREG(DSPBCNTR, planeB); - /* flush the change. */ - temp = INREG(DSPBADDR); - OUTREG(DSPBADDR, temp); - if (IS_I96X(pI830)) { - temp = INREG(DSPBSURF); - OUTREG(DSPBSURF, temp); - } + OUTREG(DSPASTRIDE, pI830->saveDSPASTRIDE); + OUTREG(DSPASIZE, pI830->saveDSPASIZE); + OUTREG(DSPAPOS, pI830->saveDSPAPOS); + OUTREG(PIPEASRC, pI830->savePIPEASRC); + OUTREG(DSPABASE, pI830->saveDSPABASE); + if (IS_I965G(pI830)) + { + OUTREG(DSPASURF, pI830->saveDSPASURF); + OUTREG(DSPATILEOFF, pI830->saveDSPATILEOFF); } - - planeA = INREG(DSPACNTR); - planeB = INREG(DSPBCNTR); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Display plane A is now %s and connected to %s.\n", - pI830->planeEnabled[0] ? "enabled" : "disabled", - planeA & DISPPLANE_SEL_PIPE_MASK ? "Pipe B" : "Pipe A"); - if (pI830->availablePipes == 2) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Display plane B is now %s and connected to %s.\n", - pI830->planeEnabled[1] ? "enabled" : "disabled", - planeB & DISPPLANE_SEL_PIPE_MASK ? "Pipe B" : "Pipe A"); - - /* XXX Plane C is ignored for now (overlay). */ - /* - * Print out the PIPEACONF and PIPEBCONF registers. + * Make sure the DPLL is active and not in VGA mode or the + * write of PIPEnCONF may cause a crash */ - temp = INREG(PIPEACONF); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEACONF is 0x%08lx\n", - (unsigned long) temp); - if (pI830->availablePipes == 2) { - temp = INREG(PIPEBCONF); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEBCONF is 0x%08lx\n", - (unsigned long) temp); - } - - if (xf86IsEntityShared(pScrn->entityList[0])) { - /* Clean this up !! */ - if (I830IsPrimary(pScrn)) { - CARD32 stridereg = !pI830->pipe ? DSPASTRIDE : DSPBSTRIDE; - CARD32 basereg = !pI830->pipe ? DSPABASE : DSPBBASE; - CARD32 sizereg = !pI830->pipe ? DSPASIZE : DSPBSIZE; - CARD32 surfreg = !pI830->pipe ? DSPASURF : DSPBSURF; - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - - temp = INREG(stridereg); - if (temp / pI8301->cpp != (CARD32)(pI830->displayWidth)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Correcting plane %c stride (%d -> %d)\n", PIPE_NAME(!pI830->pipe), - (int)(temp / pI8301->cpp), pI830->displayWidth); - OUTREG(stridereg, pI830->displayWidth * pI8301->cpp); - } - OUTREG(sizereg, (pMode->HDisplay - 1) | ((pMode->VDisplay - 1) << 16)); - /* Trigger update */ - temp = INREG(basereg); - OUTREG(basereg, temp); - if (IS_I96X(pI830)) { - temp = INREG(surfreg); - OUTREG(surfreg, temp); - } - - if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) { - I830Ptr pI8302 = I830PTR(pI830->entityPrivate->pScrn_2); - stridereg = pI830->pipe ? DSPASTRIDE : DSPBSTRIDE; - basereg = pI830->pipe ? DSPABASE : DSPBBASE; - sizereg = pI830->pipe ? DSPASIZE : DSPBSIZE; - surfreg = pI830->pipe ? DSPASURF : DSPBSURF; - - temp = INREG(stridereg); - if (temp / pI8302->cpp != (CARD32)(pI8302->displayWidth)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Correcting plane %c stride (%d -> %d)\n", PIPE_NAME(pI830->pipe), - (int)(temp / pI8302->cpp), pI8302->displayWidth); - OUTREG(stridereg, pI8302->displayWidth * pI8302->cpp); - } - OUTREG(sizereg, (pI830->entityPrivate->pScrn_2->currentMode->HDisplay - 1) | ((pI830->entityPrivate->pScrn_2->currentMode->VDisplay - 1) << 16)); - /* Trigger update */ - temp = INREG(basereg); - OUTREG(basereg, temp); - if (IS_I96X(pI830)) { - temp = INREG(surfreg); - OUTREG(surfreg, temp); - } - } - } else { - CARD32 stridereg = pI830->pipe ? DSPASTRIDE : DSPBSTRIDE; - CARD32 basereg = pI830->pipe ? DSPABASE : DSPBBASE; - CARD32 sizereg = pI830->pipe ? DSPASIZE : DSPBSIZE; - CARD32 surfreg = pI830->pipe ? DSPASURF : DSPBSURF; - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - I830Ptr pI8302 = I830PTR(pI830->entityPrivate->pScrn_2); - - temp = INREG(stridereg); - if (temp / pI8301->cpp != (CARD32)(pI8301->displayWidth)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Correcting plane %c stride (%d -> %d)\n", PIPE_NAME(pI830->pipe), - (int)(temp / pI8301->cpp), pI8301->displayWidth); - OUTREG(stridereg, pI8301->displayWidth * pI8301->cpp); - } - OUTREG(sizereg, (pI830->entityPrivate->pScrn_1->currentMode->HDisplay - 1) | ((pI830->entityPrivate->pScrn_1->currentMode->VDisplay - 1) << 16)); - /* Trigger update */ - temp = INREG(basereg); - OUTREG(basereg, temp); - if (IS_I96X(pI830)) { - temp = INREG(surfreg); - OUTREG(surfreg, temp); - } - - stridereg = !pI830->pipe ? DSPASTRIDE : DSPBSTRIDE; - basereg = !pI830->pipe ? DSPABASE : DSPBBASE; - sizereg = !pI830->pipe ? DSPASIZE : DSPBSIZE; - surfreg = !pI830->pipe ? DSPASURF : DSPBSURF; - - temp = INREG(stridereg); - if (temp / pI8302->cpp != ((CARD32)pI8302->displayWidth)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Correcting plane %c stride (%d -> %d)\n", PIPE_NAME(!pI830->pipe), - (int)(temp / pI8302->cpp), pI8302->displayWidth); - OUTREG(stridereg, pI8302->displayWidth * pI8302->cpp); - } - OUTREG(sizereg, (pMode->HDisplay - 1) | ((pMode->VDisplay - 1) << 16)); - /* Trigger update */ - temp = INREG(basereg); - OUTREG(basereg, temp); - if (IS_I96X(pI830)) { - temp = INREG(surfreg); - OUTREG(surfreg, temp); - } - } - } else { - for (i = 0; i < pI830->availablePipes; i++) { - CARD32 stridereg = i ? DSPBSTRIDE : DSPASTRIDE; - CARD32 basereg = i ? DSPBBASE : DSPABASE; - CARD32 sizereg = i ? DSPBSIZE : DSPASIZE; - CARD32 surfreg = i ? DSPBSURF : DSPASURF; - - if (!pI830->planeEnabled[i]) - continue; - - temp = INREG(stridereg); - if (temp / pI830->cpp != (CARD32)pI830->displayWidth) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Correcting plane %c stride (%d -> %d)\n", PIPE_NAME(i), - (int)(temp / pI830->cpp), pI830->displayWidth); - OUTREG(stridereg, pI830->displayWidth * pI830->cpp); - } - - if (pI830->MergedFB) { - switch (pI830->SecondPosition) { - case PosRightOf: - case PosBelow: - OUTREG(DSPABASE, (CDMPTR.First->HDisplay - 1) | ((CDMPTR.First->VDisplay - 1) << 16)); - OUTREG(DSPBBASE, (CDMPTR.Second->HDisplay - 1) | ((CDMPTR.Second->VDisplay - 1) << 16)); - break; - case PosLeftOf: - case PosAbove: - OUTREG(DSPABASE, (CDMPTR.Second->HDisplay - 1) | ((CDMPTR.Second->VDisplay - 1) << 16)); - OUTREG(DSPBBASE, (CDMPTR.First->HDisplay - 1) | ((CDMPTR.First->VDisplay - 1) << 16)); - break; - } - } else - OUTREG(sizereg, (pMode->HDisplay - 1) | ((pMode->VDisplay - 1) << 16)); - /* Trigger update */ - temp = INREG(basereg); - OUTREG(basereg, temp); - if (IS_I96X(pI830)) { - temp = INREG(surfreg); - OUTREG(surfreg, temp); - } - } - } - -#if 0 - /* Print out some CRTC/display information. */ - temp = INREG(HTOTAL_A); - ErrorF("Horiz active: %d, Horiz total: %d\n", temp & 0x7ff, - (temp >> 16) & 0xfff); - temp = INREG(HBLANK_A); - ErrorF("Horiz blank start: %d, Horiz blank end: %d\n", temp & 0xfff, - (temp >> 16) & 0xfff); - temp = INREG(HSYNC_A); - ErrorF("Horiz sync start: %d, Horiz sync end: %d\n", temp & 0xfff, - (temp >> 16) & 0xfff); - temp = INREG(VTOTAL_A); - ErrorF("Vert active: %d, Vert total: %d\n", temp & 0x7ff, - (temp >> 16) & 0xfff); - temp = INREG(VBLANK_A); - ErrorF("Vert blank start: %d, Vert blank end: %d\n", temp & 0xfff, - (temp >> 16) & 0xfff); - temp = INREG(VSYNC_A); - ErrorF("Vert sync start: %d, Vert sync end: %d\n", temp & 0xfff, - (temp >> 16) & 0xfff); - temp = INREG(PIPEASRC); - ErrorF("Image size: %dx%d (%dx%d)\n", - (temp >> 16) & 0x7ff, temp & 0x7ff, - (((temp >> 16) & 0x7ff) + 1), ((temp & 0x7ff) + 1)); - ErrorF("Pixel multiply is %d\n", (planeA >> 20) & 0x3); - temp = INREG(DSPABASE); - ErrorF("Plane A start offset is %d\n", temp); - temp = INREG(DSPASTRIDE); - ErrorF("Plane A stride is %d bytes (%d pixels)\n", temp, temp / pI830->cpp); - temp = INREG(DSPAPOS); - ErrorF("Plane A position %d %d\n", temp & 0xffff, (temp & 0xffff0000) >> 16); - temp = INREG(DSPASIZE); - ErrorF("Plane A size %d %d\n", temp & 0xffff, (temp & 0xffff0000) >> 16); - - /* Print out some CRTC/display information. */ - temp = INREG(HTOTAL_B); - ErrorF("Horiz active: %d, Horiz total: %d\n", temp & 0x7ff, - (temp >> 16) & 0xfff); - temp = INREG(HBLANK_B); - ErrorF("Horiz blank start: %d, Horiz blank end: %d\n", temp & 0xfff, - (temp >> 16) & 0xfff); - temp = INREG(HSYNC_B); - ErrorF("Horiz sync start: %d, Horiz sync end: %d\n", temp & 0xfff, - (temp >> 16) & 0xfff); - temp = INREG(VTOTAL_B); - ErrorF("Vert active: %d, Vert total: %d\n", temp & 0x7ff, - (temp >> 16) & 0xfff); - temp = INREG(VBLANK_B); - ErrorF("Vert blank start: %d, Vert blank end: %d\n", temp & 0xfff, - (temp >> 16) & 0xfff); - temp = INREG(VSYNC_B); - ErrorF("Vert sync start: %d, Vert sync end: %d\n", temp & 0xfff, - (temp >> 16) & 0xfff); - temp = INREG(PIPEBSRC); - ErrorF("Image size: %dx%d (%dx%d)\n", - (temp >> 16) & 0x7ff, temp & 0x7ff, - (((temp >> 16) & 0x7ff) + 1), ((temp & 0x7ff) + 1)); - ErrorF("Pixel multiply is %d\n", (planeA >> 20) & 0x3); - temp = INREG(DSPBBASE); - ErrorF("Plane B start offset is %d\n", temp); - temp = INREG(DSPBSTRIDE); - ErrorF("Plane B stride is %d bytes (%d pixels)\n", temp, temp / pI830->cpp); - temp = INREG(DSPBPOS); - ErrorF("Plane B position %d %d\n", temp & 0xffff, (temp & 0xffff0000) >> 16); - temp = INREG(DSPBSIZE); - ErrorF("Plane B size %d %d\n", temp & 0xffff, (temp & 0xffff0000) >> 16); -#endif - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Mode bandwidth is %d Mpixel/s\n", - pMode->HDisplay * pMode->VDisplay * refresh / 1000000); - - { - int maxBandwidth, bandwidthA, bandwidthB; - - if (GetModeSupport(pScrn, 0x80, 0x80, 0x80, 0x80, - &maxBandwidth, &bandwidthA, &bandwidthB)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "maxBandwidth is %d Mbyte/s, " - "pipe bandwidths are %d Mbyte/s, %d Mbyte/s\n", - maxBandwidth, bandwidthA, bandwidthB); - } - } - -#if 0 + if ((pI830->saveDPLL_A & DPLL_VCO_ENABLE) && + (pI830->saveDPLL_A & DPLL_VGA_MODE_DIS)) + OUTREG(PIPEACONF, pI830->savePIPEACONF); + i830WaitForVblank(pScrn); + OUTREG(DSPACNTR, pI830->saveDSPACNTR); + OUTREG(DSPABASE, INREG(DSPABASE)); + i830WaitForVblank(pScrn); + + if(xf86_config->num_crtc == 2) { - int ret; - - ret = GetLFPCompMode(pScrn); - if (ret != -1) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "LFP compensation mode: 0x%x\n", ret); - } - } -#endif - -#if MODESWITCH_RESET_STATE - ResetState(pScrn, TRUE); - SetHWOperatingState(pScrn); -#endif - -#if 0 - if (IS_I96X(pI830)) - I965PrintErrorState(pScrn); - else - I830PrintErrorState(pScrn); -#endif - -#ifdef XF86DRI - if (didLock) - I830DRIUnlock(pScrn); -#endif - - pScrn->vtSema = TRUE; - return TRUE; -} - -static void -InitRegisterRec(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - I830RegPtr i830Reg = &pI830->ModeReg; - int i; - - if (!I830IsPrimary(pScrn)) return; - - for (i = 0; i < 8; i++) - i830Reg->Fence[i] = 0; -} - -/* Famous last words - */ -void -I830PrintErrorState(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - ErrorF("pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n", - (unsigned long)INREG(PGETBL_CTL), (unsigned long)INREG(PGE_ERR)); - - ErrorF("ipeir: %lx iphdr: %lx\n", (unsigned long)INREG(IPEIR), - (unsigned long)INREG(IPEHR)); - - ErrorF("LP ring tail: %lx head: %lx len: %lx start %lx\n", - (unsigned long)INREG(LP_RING + RING_TAIL), - (unsigned long)INREG(LP_RING + RING_HEAD) & HEAD_ADDR, - (unsigned long)INREG(LP_RING + RING_LEN), - (unsigned long)INREG(LP_RING + RING_START)); - - ErrorF("eir: %x esr: %x emr: %x\n", - INREG16(EIR), INREG16(ESR), INREG16(EMR)); - - ErrorF("instdone: %x instpm: %x\n", INREG16(INST_DONE), INREG8(INST_PM)); - - ErrorF("memmode: %lx instps: %lx\n", (unsigned long)INREG(MEMMODE), - (unsigned long)INREG(INST_PS)); - - ErrorF("hwstam: %x ier: %x imr: %x iir: %x\n", - INREG16(HWSTAM), INREG16(IER), INREG16(IMR), INREG16(IIR)); -} - -void -I965PrintErrorState(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - ErrorF("pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n", - INREG(PGETBL_CTL), INREG(PGE_ERR)); - - ErrorF("ipeir: %lx iphdr: %lx\n", INREG(IPEIR_I965), INREG(IPEHR_I965)); - - ErrorF("LP ring tail: %lx head: %lx len: %lx start %lx\n", - INREG(LP_RING + RING_TAIL), - INREG(LP_RING + RING_HEAD) & HEAD_ADDR, - INREG(LP_RING + RING_LEN), INREG(LP_RING + RING_START)); - - ErrorF("Err ID (eir): %x Err Status (esr): %x Err Mask (emr): %x\n", - (int)INREG(EIR), (int)INREG(ESR), (int)INREG(EMR)); - - ErrorF("instdone: %x instdone_1: %x\n", (int)INREG(INST_DONE_I965), - (int)INREG(INST_DONE_1)); - ErrorF("instpm: %x\n", (int)INREG(INST_PM)); - - ErrorF("memmode: %lx instps: %lx\n", INREG(MEMMODE), INREG(INST_PS_I965)); - - ErrorF("HW Status mask (hwstam): %x\nIRQ enable (ier): %x imr: %x iir: %x\n", - (int)INREG(HWSTAM), (int)INREG(IER), (int)INREG(IMR), - (int)INREG(IIR)); - - ErrorF("acthd: %lx dma_fadd_p: %lx\n", INREG(ACTHD), INREG(DMA_FADD_P)); - ErrorF("ecoskpd: %lx excc: %lx\n", INREG(ECOSKPD), INREG(EXCC)); - - ErrorF("cache_mode: %x/%x\n", (int)INREG(CACHE_MODE_0), - (int)INREG(CACHE_MODE_1)); - ErrorF("mi_arb_state: %x\n", (int)INREG(MI_ARB_STATE)); - - ErrorF("IA_VERTICES_COUNT_QW %x/%x\n", (int)INREG(IA_VERTICES_COUNT_QW), - (int)INREG(IA_VERTICES_COUNT_QW+4)); - ErrorF("IA_PRIMITIVES_COUNT_QW %x/%x\n", (int)INREG(IA_PRIMITIVES_COUNT_QW), - (int)INREG(IA_PRIMITIVES_COUNT_QW+4)); - - ErrorF("VS_INVOCATION_COUNT_QW %x/%x\n", (int)INREG(VS_INVOCATION_COUNT_QW), - (int)INREG(VS_INVOCATION_COUNT_QW+4)); - - ErrorF("GS_INVOCATION_COUNT_QW %x/%x\n", (int)INREG(GS_INVOCATION_COUNT_QW), - (int)INREG(GS_INVOCATION_COUNT_QW+4)); - ErrorF("GS_PRIMITIVES_COUNT_QW %x/%x\n", (int)INREG(GS_PRIMITIVES_COUNT_QW), - (int)INREG(GS_PRIMITIVES_COUNT_QW+4)); - - ErrorF("CL_INVOCATION_COUNT_QW %x/%x\n", (int)INREG(CL_INVOCATION_COUNT_QW), - (int)INREG(CL_INVOCATION_COUNT_QW+4)); - ErrorF("CL_PRIMITIVES_COUNT_QW %x/%x\n", (int)INREG(CL_PRIMITIVES_COUNT_QW), - (int)INREG(CL_PRIMITIVES_COUNT_QW+4)); - - ErrorF("PS_INVOCATION_COUNT_QW %x/%x\n", (int)INREG(PS_INVOCATION_COUNT_QW), - (int)INREG(PS_INVOCATION_COUNT_QW+4)); - ErrorF("PS_DEPTH_COUNT_QW %x/%x\n", (int)INREG(PS_DEPTH_COUNT_QW), - (int)INREG(PS_DEPTH_COUNT_QW+4)); - - ErrorF("WIZ_CTL %x\n", (int)INREG(WIZ_CTL)); - ErrorF("TS_CTL %x TS_DEBUG_DATA %x\n", (int)INREG(TS_CTL), - (int)INREG(TS_DEBUG_DATA)); - ErrorF("TD_CTL %x / %x\n", (int)INREG(TD_CTL), (int)INREG(TD_CTL2)); - + if (pI830->saveDPLL_B & DPLL_VCO_ENABLE) + { + OUTREG(DPLL_B, pI830->saveDPLL_B & ~DPLL_VCO_ENABLE); + usleep(150); + } + OUTREG(FPB0, pI830->saveFPB0); + OUTREG(FPB1, pI830->saveFPB1); + OUTREG(DPLL_B, pI830->saveDPLL_B); + usleep(150); + if (IS_I965G(pI830)) + OUTREG(DPLL_B_MD, pI830->saveDPLL_B_MD); + else + OUTREG(DPLL_B, pI830->saveDPLL_B); + usleep(150); -} - -#ifdef I830DEBUG -static void -dump_DSPACNTR(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - unsigned int tmp; - - /* Display A Control */ - tmp = INREG(0x70180); - ErrorF("Display A Plane Control Register (0x%.8x)\n", tmp); - - if (tmp & BIT(31)) - ErrorF(" Display Plane A (Primary) Enable\n"); - else - ErrorF(" Display Plane A (Primary) Disabled\n"); - - if (tmp & BIT(30)) - ErrorF(" Display A pixel data is gamma corrected\n"); - else - ErrorF(" Display A pixel data bypasses gamma correction logic (default)\n"); + OUTREG(HTOTAL_B, pI830->saveHTOTAL_B); + OUTREG(HBLANK_B, pI830->saveHBLANK_B); + OUTREG(HSYNC_B, pI830->saveHSYNC_B); + OUTREG(VTOTAL_B, pI830->saveVTOTAL_B); + OUTREG(VBLANK_B, pI830->saveVBLANK_B); + OUTREG(VSYNC_B, pI830->saveVSYNC_B); + OUTREG(BCLRPAT_B, pI830->saveBCLRPAT_B); + OUTREG(DSPBSTRIDE, pI830->saveDSPBSTRIDE); + OUTREG(DSPBSIZE, pI830->saveDSPBSIZE); + OUTREG(DSPBPOS, pI830->saveDSPBPOS); + OUTREG(PIPEBSRC, pI830->savePIPEBSRC); + OUTREG(DSPBBASE, pI830->saveDSPBBASE); + if (IS_I965G(pI830)) + { + OUTREG(DSPBSURF, pI830->saveDSPBSURF); + OUTREG(DSPBTILEOFF, pI830->saveDSPBTILEOFF); + } - switch ((tmp & 0x3c000000) >> 26) { /* bit 29:26 */ - case 0x00: - case 0x01: - case 0x03: - ErrorF(" Reserved\n"); - break; - case 0x02: - ErrorF(" 8-bpp Indexed\n"); - break; - case 0x04: - ErrorF(" 15-bit (5-5-5) pixel format (Targa compatible)\n"); - break; - case 0x05: - ErrorF(" 16-bit (5-6-5) pixel format (XGA compatible)\n"); - break; - case 0x06: - ErrorF(" 32-bit format (X:8:8:8)\n"); - break; - case 0x07: - ErrorF(" 32-bit format (8:8:8:8)\n"); - break; - default: - ErrorF(" Unknown - Invalid register value maybe?\n"); + /* + * See PIPEnCONF note above + */ + if ((pI830->saveDPLL_B & DPLL_VCO_ENABLE) && + (pI830->saveDPLL_B & DPLL_VGA_MODE_DIS)) + OUTREG(PIPEBCONF, pI830->savePIPEBCONF); + i830WaitForVblank(pScrn); + OUTREG(DSPBCNTR, pI830->saveDSPBCNTR); + OUTREG(DSPBBASE, INREG(DSPBBASE)); + i830WaitForVblank(pScrn); } - if (tmp & BIT(25)) - ErrorF(" Stereo Enable\n"); - else - ErrorF(" Stereo Disable\n"); - - if (tmp & BIT(24)) - ErrorF(" Display A, Pipe B Select\n"); - else - ErrorF(" Display A, Pipe A Select\n"); - - if (tmp & BIT(22)) - ErrorF(" Source key is enabled\n"); - else - ErrorF(" Source key is disabled\n"); - - switch ((tmp & 0x00300000) >> 20) { /* bit 21:20 */ - case 0x00: - ErrorF(" No line duplication\n"); - break; - case 0x01: - ErrorF(" Line/pixel Doubling\n"); - break; - case 0x02: - case 0x03: - ErrorF(" Reserved\n"); - break; + /* Restore outputs */ + for (i = 0; i < xf86_config->num_output; i++) { + xf86OutputPtr output = xf86_config->output[i]; + if (output->funcs->restore) + output->funcs->restore(output); } + + OUTREG(VGACNTRL, pI830->saveVGACNTRL); - if (tmp & BIT(18)) - ErrorF(" Stereo output is high during second image\n"); - else - ErrorF(" Stereo output is high during first image\n"); -} - -static void -dump_DSPBCNTR(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - unsigned int tmp; - - /* Display B/Sprite Control */ - tmp = INREG(0x71180); - ErrorF("Display B/Sprite Plane Control Register (0x%.8x)\n", tmp); - - if (tmp & BIT(31)) - ErrorF(" Display B/Sprite Enable\n"); - else - ErrorF(" Display B/Sprite Disable\n"); + OUTREG(VCLK_DIVISOR_VGA0, pI830->saveVCLK_DIVISOR_VGA0); + OUTREG(VCLK_DIVISOR_VGA1, pI830->saveVCLK_DIVISOR_VGA1); + OUTREG(VCLK_POST_DIV, pI830->saveVCLK_POST_DIV); - if (tmp & BIT(30)) - ErrorF(" Display B pixel data is gamma corrected\n"); - else - ErrorF(" Display B pixel data bypasses gamma correction logic (default)\n"); + i830_restore_palette(pI830, PIPE_A); + i830_restore_palette(pI830, PIPE_B); - switch ((tmp & 0x3c000000) >> 26) { /* bit 29:26 */ - case 0x00: - case 0x01: - case 0x03: - ErrorF(" Reserved\n"); - break; - case 0x02: - ErrorF(" 8-bpp Indexed\n"); - break; - case 0x04: - ErrorF(" 15-bit (5-5-5) pixel format (Targa compatible)\n"); - break; - case 0x05: - ErrorF(" 16-bit (5-6-5) pixel format (XGA compatible)\n"); - break; - case 0x06: - ErrorF(" 32-bit format (X:8:8:8)\n"); - break; - case 0x07: - ErrorF(" 32-bit format (8:8:8:8)\n"); - break; - default: - ErrorF(" Unknown - Invalid register value maybe?\n"); + for(i = 0; i < 7; i++) { + OUTREG(SWF0 + (i << 2), pI830->saveSWF[i]); + OUTREG(SWF00 + (i << 2), pI830->saveSWF[i+7]); } - if (tmp & BIT(25)) - ErrorF(" Stereo is enabled and both start addresses are used in a two frame sequence\n"); - else - ErrorF(" Stereo disable and only a single start address is used\n"); + OUTREG(SWF30, pI830->saveSWF[14]); + OUTREG(SWF31, pI830->saveSWF[15]); + OUTREG(SWF32, pI830->saveSWF[16]); - if (tmp & BIT(24)) - ErrorF(" Display B/Sprite, Pipe B Select\n"); - else - ErrorF(" Display B/Sprite, Pipe A Select\n"); - - if (tmp & BIT(22)) - ErrorF(" Sprite source key is enabled\n"); - else - ErrorF(" Sprite source key is disabled (default)\n"); - - switch ((tmp & 0x00300000) >> 20) { /* bit 21:20 */ - case 0x00: - ErrorF(" No line duplication\n"); - break; - case 0x01: - ErrorF(" Line/pixel Doubling\n"); - break; - case 0x02: - case 0x03: - ErrorF(" Reserved\n"); - break; + if (pI830->fb_compression) { + OUTREG(FBC_CFB_BASE, pI830->saveFBC_CFB_BASE); + OUTREG(FBC_LL_BASE, pI830->saveFBC_LL_BASE); + OUTREG(FBC_CONTROL2, pI830->saveFBC_CONTROL2); + OUTREG(FBC_CONTROL, pI830->saveFBC_CONTROL); } - if (tmp & BIT(18)) - ErrorF(" Stereo output is high during second image\n"); - else - ErrorF(" Stereo output is high during first image\n"); - - if (tmp & BIT(15)) - ErrorF(" Alpha transfer mode enabled\n"); - else - ErrorF(" Alpha transfer mode disabled\n"); - - if (tmp & BIT(0)) - ErrorF(" Sprite is above overlay\n"); - else - ErrorF(" Sprite is above display A (default)\n"); -} - -void -I830_dump_registers(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - unsigned int i; - - ErrorF("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); - - dump_DSPACNTR(pScrn); - dump_DSPBCNTR(pScrn); - - ErrorF("0x71400 == 0x%.8x\n", INREG(0x71400)); - ErrorF("0x70008 == 0x%.8x\n", INREG(0x70008)); - for (i = 0x71410; i <= 0x71428; i += 4) - ErrorF("0x%x == 0x%.8x\n", i, INREG(i)); + vgaHWRestore(pScrn, vgaReg, VGA_SR_FONTS); + vgaHWLock(hwp); - ErrorF("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); + return TRUE; } -#endif static void I830PointerMoved(int index, int x, int y) @@ -7009,46 +2183,11 @@ I830PointerMoved(int index, int x, int y) } static Bool -I830CreateScreenResources (ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - - pScreen->CreateScreenResources = pI830->CreateScreenResources; - if (!(*pScreen->CreateScreenResources)(pScreen)) - return FALSE; - - if (xf86LoaderCheckSymbol("I830RandRSetConfig") && pI830->rotation != RR_Rotate_0) { - Rotation (*I830RandRSetConfig)(ScreenPtr pScreen, Rotation rr, int rate, RRScreenSizePtr pSize) = NULL; - RRScreenSize p; - Rotation requestedRotation = pI830->rotation; - - pI830->rotation = RR_Rotate_0; - - /* Just setup enough for an initial rotate */ - p.width = pScreen->width; - p.height = pScreen->height; - p.mmWidth = pScreen->mmWidth; - p.mmHeight = pScreen->mmHeight; - - I830RandRSetConfig = LoaderSymbol("I830RandRSetConfig"); - if (I830RandRSetConfig) { - pI830->starting = TRUE; /* abuse this for dual head & rotation */ - (*I830RandRSetConfig) (pScreen, requestedRotation, 0, &p); - pI830->starting = FALSE; - } - } - - return TRUE; -} - -static Bool I830InitFBManager( ScreenPtr pScreen, BoxPtr FullBox ){ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); RegionRec ScreenRegion; RegionRec FullRegion; BoxRec ScreenBox; @@ -7057,7 +2196,7 @@ I830InitFBManager( ScreenBox.x1 = 0; ScreenBox.y1 = 0; ScreenBox.x2 = pScrn->displayWidth; - if (!pI830->MergedFB && pScrn->virtualX > pScrn->virtualY) + if (pScrn->virtualX > pScrn->virtualY) ScreenBox.y2 = pScrn->virtualX; else ScreenBox.y2 = pScrn->virtualY; @@ -7083,24 +2222,44 @@ I830InitFBManager( return ret; } -/* Initialize the first context */ +/** + * Intialiazes the hardware for the 3D pipeline use in the 2D driver. + * + * Some state caching is performed to avoid redundant state emits. This + * function is also responsible for marking the state as clobbered for DRI + * clients. + */ void IntelEmitInvarientState(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); CARD32 ctx_addr; - if (pI830->noAccel || !I830IsPrimary(pScrn)) + if (pI830->noAccel) return; - ctx_addr = pI830->ContextMem.Start; - /* Align to a 2k boundry */ - ctx_addr = ((ctx_addr + 2048 - 1) / 2048) * 2048; +#ifdef XF86DRI + if (pI830->directRenderingEnabled) { + drmI830Sarea *sarea = DRIGetSAREAPrivate(pScrn->pScreen); + + /* Mark that the X Server was the last holder of the context */ + if (sarea) + sarea->ctxOwner = DRIGetContext(pScrn->pScreen); + } +#endif + + /* If we've emitted our state since the last clobber by another client, + * skip it. + */ + if (*pI830->last_3d != LAST_3D_OTHER) + return; + ctx_addr = pI830->logical_context->offset; + assert((pI830->logical_context->offset & 2047) == 0); { BEGIN_LP_RING(2); OUT_RING(MI_SET_CONTEXT); - OUT_RING(ctx_addr | + OUT_RING(pI830->logical_context->offset | CTXT_NO_RESTORE | CTXT_PALETTE_SAVE_DISABLE | CTXT_PALETTE_RESTORE_DISABLE); ADVANCE_LP_RING(); @@ -7115,112 +2274,344 @@ IntelEmitInvarientState(ScrnInfoPtr pScrn) } } -#ifdef XF86DRI -#ifndef DRM_BO_MEM_TT -#error "Wrong drm.h file included. You need to compile and install a recent libdrm." -#endif - -#ifndef XSERVER_LIBDRM_MM - -static int -I830DrmMMInit(int drmFD, unsigned long pageOffs, unsigned long pageSize, - unsigned memType) -{ - - drm_mm_init_arg_t arg; - int ret; - - memset(&arg, 0, sizeof(arg)); - arg.req.op = mm_init; - arg.req.p_offset = pageOffs; - arg.req.p_size = pageSize; - arg.req.mem_type = memType; - - ret = ioctl(drmFD, DRM_IOCTL_MM_INIT, &arg); - - if (ret) - return -errno; - - return 0; - -} - -static int -I830DrmMMTakedown(int drmFD, unsigned memType) -{ - drm_mm_init_arg_t arg; - int ret = 0; - - memset(&arg, 0, sizeof(arg)); - arg.req.op = mm_takedown; - arg.req.mem_type = memType; - if (ioctl(drmFD, DRM_IOCTL_MM_INIT, &arg)) { - ret = -errno; - } - - return ret; -} - -static int I830DrmMMLock(int fd, unsigned memType) +static void +I830BlockHandler(int i, + pointer blockData, pointer pTimeout, pointer pReadmask) { - drm_mm_init_arg_t arg; - int ret; + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + I830Ptr pI830 = I830PTR(pScrn); - memset(&arg, 0, sizeof(arg)); - arg.req.op = mm_lock; - arg.req.mem_type = memType; + pScreen->BlockHandler = pI830->BlockHandler; - do{ - ret = ioctl(fd, DRM_IOCTL_MM_INIT, &arg); - } while (ret && errno == EAGAIN); - - return ret; -} + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); -static int I830DrmMMUnlock(int fd, unsigned memType) -{ - drm_mm_init_arg_t arg; - int ret; + pScreen->BlockHandler = I830BlockHandler; - memset(&arg, 0, sizeof(arg)); - arg.req.op = mm_unlock; - arg.req.mem_type = memType; - - do{ - ret = ioctl(fd, DRM_IOCTL_MM_INIT, &arg); - } while (ret && errno == EAGAIN); - - return ret; + I830VideoBlockHandler(i, blockData, pTimeout, pReadmask); } -#endif -#endif - static Bool -I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn; vgaHWPtr hwp; I830Ptr pI830; VisualPtr visual; I830Ptr pI8301 = NULL; + unsigned long sys_mem; + int i, c; + Bool allocation_done = FALSE; + MessageType from; #ifdef XF86DRI - Bool driDisabled; + xf86CrtcConfigPtr config; #endif pScrn = xf86Screens[pScreen->myNum]; pI830 = I830PTR(pScrn); hwp = VGAHWPTR(pScrn); - pScrn->displayWidth = pI830->displayWidth; + pScrn->displayWidth = (pScrn->virtualX + 63) & ~63; + + /* + * The "VideoRam" config file parameter specifies the maximum amount of + * memory that will be used/allocated. When not present, we allow the + * driver to allocate as much memory as it wishes to satisfy its + * allocations, but if agpgart support isn't available, it gets limited + * to the amount of pre-allocated ("stolen") memory. + * + * Note that in using this value for allocator initialization, we're + * limiting aperture allocation to the VideoRam option, rather than limiting + * actual memory allocation, so alignment and things will cause less than + * VideoRam to be actually used. + */ + if (pI830->pEnt->device->videoRam == 0) { + from = X_DEFAULT; + pScrn->videoRam = pI830->FbMapSize / KB(1); + } else { +#if 0 + from = X_CONFIG; + pScrn->videoRam = pI830->pEnt->device->videoRam; +#else + /* Disable VideoRam configuration, at least for now. Previously, + * VideoRam was necessary to avoid overly low limits on allocated + * memory, so users created larger, yet still small, fixed allocation + * limits in their config files. Now, the driver wants to allocate more, + * and the old intention of the VideoRam lines that had been entered is + * obsolete. + */ + from = X_DEFAULT; + pScrn->videoRam = pI830->FbMapSize / KB(1); + + if (pScrn->videoRam != pI830->pEnt->device->videoRam) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "VideoRam configuration found, which is no longer " + "recommended.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Continuing with default %dkB VideoRam instead of %d " + "kB.\n", + pScrn->videoRam, pI830->pEnt->device->videoRam); + } +#endif + } + + /* Limit videoRam to how much we might be able to allocate from AGP */ + sys_mem = I830CheckAvailableMemory(pScrn); + if (sys_mem == -1) { + if (pScrn->videoRam > pI830->stolen_size / KB(1)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "/dev/agpgart is either not available, or no memory " + "is available\nfor allocation. " + "Using pre-allocated memory only.\n"); + pScrn->videoRam = pI830->stolen_size / KB(1); + } + pI830->StolenOnly = TRUE; + } else { + if (sys_mem + (pI830->stolen_size / 1024) < pScrn->videoRam) { + pScrn->videoRam = sys_mem + (pI830->stolen_size / 1024); + from = X_PROBED; + if (sys_mem + (pI830->stolen_size / 1024) < + pI830->pEnt->device->videoRam) + { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "VideoRAM reduced to %d kByte " + "(limited to available sysmem)\n", pScrn->videoRam); + } + } + } + + /* Limit video RAM to the actual aperture size */ + if (pScrn->videoRam > pI830->FbMapSize / 1024) { + pScrn->videoRam = pI830->FbMapSize / 1024; + if (pI830->FbMapSize / 1024 < pI830->pEnt->device->videoRam) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "VideoRam reduced to %d kByte (limited to aperture " + "size)\n", + pScrn->videoRam); + } + } + + /* Make sure it's on a page boundary */ + if (pScrn->videoRam & 3) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VideoRam reduced to %d KB " + "(page aligned - was %d KB)\n", + pScrn->videoRam & ~3, pScrn->videoRam); + pScrn->videoRam &= ~3; + } + +#ifdef XF86DRI + /* Check for appropriate bpp and module support to initialize DRI. */ + if (!I830CheckDRIAvailable(pScrn)) { + pI830->directRenderingDisabled = TRUE; + } + + /* If DRI hasn't been explicitly disabled, try to initialize it. + * It will be used by the memory allocator. + */ + if (!pI830->directRenderingDisabled) + pI830->directRenderingEnabled = I830DRIScreenInit(pScreen); + else + pI830->directRenderingEnabled = FALSE; +#else + pI830->directRenderingEnabled = FALSE; +#endif + + /* Set up our video memory allocator for the chosen videoRam */ + if (!i830_allocator_init(pScrn, 0, pScrn->videoRam * KB(1))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Couldn't initialize video memory allocator\n"); + PreInitCleanup(pScrn); + return FALSE; + } + + xf86DrvMsg(pScrn->scrnIndex, + pI830->pEnt->device->videoRam ? X_CONFIG : X_DEFAULT, + "VideoRam: %d KB\n", pScrn->videoRam); + + if (xf86GetOptValInteger(pI830->Options, OPTION_CACHE_LINES, + &(pI830->CacheLines))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Requested %d cache lines\n", + pI830->CacheLines); + } else { + pI830->CacheLines = -1; + } + + /* Enable tiling by default */ + pI830->tiling = TRUE; + + /* Allow user override if they set a value */ + if (xf86IsOptionSet(pI830->Options, OPTION_TILING)) { + if (xf86ReturnOptValBool(pI830->Options, OPTION_TILING, FALSE)) + pI830->tiling = TRUE; + else + pI830->tiling = FALSE; + } + + /* Enable FB compression if possible */ + if (i830_fb_compression_supported(pI830) && !IS_I965GM(pI830)) + pI830->fb_compression = TRUE; + else + pI830->fb_compression = FALSE; + + /* Again, allow user override if set */ + if (xf86IsOptionSet(pI830->Options, OPTION_FBC)) { + if (xf86ReturnOptValBool(pI830->Options, OPTION_FBC, FALSE)) + pI830->fb_compression = TRUE; + else + pI830->fb_compression = FALSE; + } + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Framebuffer compression %sabled\n", + pI830->fb_compression ? "en" : "dis"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Tiling %sabled\n", pI830->tiling ? + "en" : "dis"); if (I830IsPrimary(pScrn)) { - /* Rotated Buffer */ - memset(&(pI830->RotatedMem), 0, sizeof(pI830->RotatedMem)); - pI830->RotatedMem.Key = -1; - /* Rotated2 Buffer */ - memset(&(pI830->RotatedMem2), 0, sizeof(pI830->RotatedMem2)); - pI830->RotatedMem2.Key = -1; + /* Alloc our pointers for the primary head */ + if (!pI830->LpRing) + pI830->LpRing = xcalloc(1, sizeof(I830RingBuffer)); + if (!pI830->overlayOn) + pI830->overlayOn = xalloc(sizeof(Bool)); + if (!pI830->last_3d) + pI830->last_3d = xalloc(sizeof(enum last_3d)); + if (!pI830->LpRing || !pI830->overlayOn || !pI830->last_3d) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not allocate primary data structures.\n"); + return FALSE; + } + *pI830->last_3d = LAST_3D_OTHER; + *pI830->overlayOn = FALSE; + if (pI830->entityPrivate) + pI830->entityPrivate->XvInUse = -1; + } else { + /* Make our second head point to the first heads structures */ + pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); + pI830->LpRing = pI8301->LpRing; + pI830->overlay_regs = pI8301->overlay_regs; + pI830->overlayOn = pI8301->overlayOn; + pI830->last_3d = pI8301->last_3d; + } + + /* Need MMIO mapped to do GTT lookups during memory allocation. */ + I830MapMMIO(pScrn); + +#if defined(XF86DRI) + /* + * If DRI is potentially usable, check if there is enough memory available + * for it, and if there's also enough to allow tiling to be enabled. + */ + + +#ifdef I830_XV + /* + * Set this so that the overlay allocation is factored in when + * appropriate. + */ + pI830->XvEnabled = !pI830->XvDisabled; +#endif + + if (pI830->directRenderingEnabled) { + int savedDisplayWidth = pScrn->displayWidth; + Bool tiled = FALSE; + + if (IS_I965G(pI830)) { + int tile_pixels = 512 / pI830->cpp; + pScrn->displayWidth = (pScrn->displayWidth + tile_pixels - 1) & + ~(tile_pixels - 1); + tiled = TRUE; + } else { + /* Good pitches to allow tiling. Don't care about pitches < 1024 + * pixels. + */ + static const int pitches[] = { + 1024, + 2048, + 4096, + 8192, + 0 + }; + + for (i = 0; pitches[i] != 0; i++) { + if (pitches[i] >= pScrn->displayWidth) { + pScrn->displayWidth = pitches[i]; + tiled = TRUE; + break; + } + } + } + + /* Attempt two rounds of allocation to get 2d and 3d memory to fit: + * + * 0: untiled + * 1: tiled + */ + +#define MM_TURNS 2 + for (i = 0; i < MM_TURNS; i++) { + if (!tiled && i == 0) + continue; + + if (i >= 1) { + /* For further allocations, disable tiling */ + pI830->tiling = FALSE; + pScrn->displayWidth = savedDisplayWidth; + if (pI830->allowPageFlip) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Couldn't allocate tiled memory, page flipping " + "disabled\n"); + pI830->allowPageFlip = FALSE; + if (pI830->fb_compression) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Couldn't allocate tiled memory, fb compression " + "disabled\n"); + pI830->fb_compression = FALSE; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Attempting memory allocation with %s buffers.\n", + (i & 1) ? "untiled" : "tiled"); + + if (i830_allocate_2d_memory(pScrn) && + i830_allocate_3d_memory(pScrn)) + { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Success.\n"); + if (pScrn->displayWidth != savedDisplayWidth) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Increasing the scanline pitch to allow tiling mode " + "(%d -> %d).\n", + savedDisplayWidth, pScrn->displayWidth); + } + allocation_done = TRUE; + break; + } + + i830_reset_allocations(pScrn); + } + + if (i == MM_TURNS) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Not enough video memory. Disabling DRI.\n"); + pI830->directRenderingEnabled = FALSE; + } + } +#endif + + if (!allocation_done) { + if (!i830_allocate_2d_memory(pScrn)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Couldn't allocate video memory\n"); + return FALSE; + } + allocation_done = TRUE; + } + + I830UnmapMMIO(pScrn); + + if (!IS_I965G(pI830) && pScrn->displayWidth > 2048) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Cannot support DRI with frame buffer width > 2048.\n"); + pI830->tiling = FALSE; + pI830->directRenderingEnabled = FALSE; } #ifdef HAS_MTRR_SUPPORT @@ -7264,86 +2655,8 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } #endif - if (xf86IsEntityShared(pScrn->entityList[0])) { - /* PreInit failed on the second head, so make sure we turn it off */ - if (I830IsPrimary(pScrn) && !pI830->entityPrivate->pScrn_2) { - if (pI830->pipe == 0) { - pI830->operatingDevices &= 0xFF; - } else { - pI830->operatingDevices &= 0xFF00; - } - } - } - pI830->starting = TRUE; - /* Alloc our pointers for the primary head */ - if (I830IsPrimary(pScrn)) { - if (!pI830->LpRing) - pI830->LpRing = xalloc(sizeof(I830RingBuffer)); - if (!pI830->CursorMem) - pI830->CursorMem = xalloc(sizeof(I830MemRange)); - if (!pI830->CursorMemARGB) - pI830->CursorMemARGB = xalloc(sizeof(I830MemRange)); - if (!pI830->OverlayMem) - pI830->OverlayMem = xalloc(sizeof(I830MemRange)); - if (!pI830->overlayOn) - pI830->overlayOn = xalloc(sizeof(Bool)); - if (!pI830->used3D) - pI830->used3D = xalloc(sizeof(int)); - if (!pI830->LpRing || !pI830->CursorMem || !pI830->CursorMemARGB || - !pI830->OverlayMem || !pI830->overlayOn || !pI830->used3D) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Could not allocate primary data structures.\n"); - return FALSE; - } - *pI830->overlayOn = FALSE; - if (pI830->entityPrivate) - pI830->entityPrivate->XvInUse = -1; - } - - /* Make our second head point to the first heads structures */ - if (!I830IsPrimary(pScrn)) { - pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - pI830->LpRing = pI8301->LpRing; - pI830->CursorMem = pI8301->CursorMem; - pI830->CursorMemARGB = pI8301->CursorMemARGB; - pI830->OverlayMem = pI8301->OverlayMem; - pI830->overlayOn = pI8301->overlayOn; - pI830->used3D = pI8301->used3D; - } - - /* - * If we're changing the BIOS's view of the video memory size, do that - * first, then re-initialise the VBE information. - */ - if (I830IsPrimary(pScrn)) { - SetPipeAccess(pScrn); - if (pI830->pVbe) - vbeFree(pI830->pVbe); - pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); - } else { - pI830->pVbe = pI8301->pVbe; - } - - if (I830IsPrimary(pScrn)) { - if (!TweakMemorySize(pScrn, pI830->newBIOSMemSize,FALSE)) - SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); - } - - if (!pI830->pVbe) - return FALSE; - - if (I830IsPrimary(pScrn)) { - if (pI830->vbeInfo) - VBEFreeVBEInfo(pI830->vbeInfo); - pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); - } else { - pI830->vbeInfo = pI8301->vbeInfo; - } - - SetPipeAccess(pScrn); - miClearVisualTypes(); if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), @@ -7371,15 +2684,8 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pI830->XvEnabled = FALSE; #endif - if (I830IsPrimary(pScrn)) { - I830ResetAllocations(pScrn, 0); - - if (!I830Allocate2DMemory(pScrn, ALLOC_INITIAL)) - return FALSE; - } - if (!pI830->noAccel) { - if (pI830->LpRing->mem.Size == 0) { + if (pI830->LpRing->mem->size == 0) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Disabling acceleration because the ring buffer " "allocation failed.\n"); @@ -7387,15 +2693,6 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } - if (!pI830->SWCursor) { - if (pI830->CursorMem->Size == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Disabling HW cursor because the cursor memory " - "allocation failed.\n"); - pI830->SWCursor = TRUE; - } - } - #ifdef I830_XV if (pI830->XvEnabled) { if (pI830->noAccel) { @@ -7403,7 +2700,7 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) "needs 2D acceleration.\n"); pI830->XvEnabled = FALSE; } - if (pI830->OverlayMem->Physical == 0) { + if (!IS_I9XX(pI830) && pI830->overlay_regs == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Disabling Xv because the overlay register buffer " "allocation failed.\n"); @@ -7412,15 +2709,8 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } #endif - InitRegisterRec(pScrn); - #ifdef XF86DRI /* - * pI830->directRenderingDisabled is set once in PreInit. Reinitialise - * pI830->directRenderingEnabled based on it each generation. - */ - pI830->directRenderingEnabled = !pI830->directRenderingDisabled; - /* * Setup DRI after visuals have been established, but before fbScreenInit * is called. fbScreenInit will eventually call into the drivers * InitGLXVisuals call back. @@ -7434,44 +2724,46 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } - driDisabled = !pI830->directRenderingEnabled; - if (pI830->directRenderingEnabled) - pI830->directRenderingEnabled = I830DRIScreenInit(pScreen); + pI830->directRenderingEnabled = I830DRIDoMappings(pScreen); - if (pI830->directRenderingEnabled) { - pI830->directRenderingEnabled = - I830Allocate3DMemory(pScrn, - pI830->disableTiling ? ALLOC_NO_TILING : 0); - if (!pI830->directRenderingEnabled) - I830DRICloseScreen(pScreen); - } + /* If we failed for any reason, free DRI memory. */ + if (!pI830->directRenderingEnabled) + i830_free_3d_memory(pScrn); -#else - pI830->directRenderingEnabled = FALSE; -#endif + config = XF86_CRTC_CONFIG_PTR(pScrn); /* - * After the 3D allocations have been done, see if there's any free space - * that can be added to the framebuffer allocation. + * If an LVDS display is present, swap the plane/pipe mappings so we can + * use FBC on the builtin display. + * Note: 965+ chips can compress either plane, so we leave the mapping + * alone in that case. + * Also make sure the DRM can handle the swap. */ - if (I830IsPrimary(pScrn)) { - I830Allocate2DMemory(pScrn, 0); - - DPRINTF(PFX, "assert(if(!I830DoPoolAllocation(pScrn, pI830->StolenPool)))\n"); - if (!I830DoPoolAllocation(pScrn, &(pI830->StolenPool))) - return FALSE; + if (I830LVDSPresent(pScrn) && !IS_I965GM(pI830) && + (!pI830->directRenderingEnabled || + (pI830->directRenderingEnabled && pI830->drmMinor >= 10))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "adjusting plane->pipe mappings " + "to allow for framebuffer compression\n"); + for (c = 0; c < config->num_crtc; c++) { + xf86CrtcPtr crtc = config->crtc[c]; + I830CrtcPrivatePtr intel_crtc = crtc->driver_private; - DPRINTF(PFX, "assert( if(!I830FixupOffsets(pScrn)) )\n"); - if (!I830FixupOffsets(pScrn)) - return FALSE; + if (intel_crtc->pipe == 0) + intel_crtc->plane = 1; + else if (intel_crtc->pipe == 1) + intel_crtc->plane = 0; + } } +#else + pI830->directRenderingEnabled = FALSE; +#endif + #ifdef XF86DRI - if (pI830->directRenderingEnabled) { - I830SetupMemoryTiling(pScrn); - pI830->directRenderingEnabled = I830DRIDoMappings(pScreen); - } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Page Flipping %sabled\n", + pI830->allowPageFlip ? "en" : "dis"); #endif DPRINTF(PFX, "assert( if(!I830MapMem(pScrn)) )\n"); @@ -7481,9 +2773,9 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->memPhysBase = (unsigned long)pI830->FbBase; if (I830IsPrimary(pScrn)) { - pScrn->fbOffset = pI830->FrontBuffer.Start; + pScrn->fbOffset = pI830->front_buffer->offset; } else { - pScrn->fbOffset = pI8301->FrontBuffer2.Start; + pScrn->fbOffset = pI8301->front_buffer_2->offset; } pI830->xoffset = (pScrn->fbOffset / pI830->cpp) % pScrn->displayWidth; @@ -7495,13 +2787,24 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!vgaHWMapMem(pScrn)) return FALSE; - /* Clear SavedReg */ - memset(&pI830->SavedReg, 0, sizeof(pI830->SavedReg)); + DPRINTF(PFX, "assert( if(!I830EnterVT(scrnIndex, 0)) )\n"); - DPRINTF(PFX, "assert( if(!I830BIOSEnterVT(scrnIndex, 0)) )\n"); + if (!pI830->useEXA) { + if (I830IsPrimary(pScrn)) { + if (!I830InitFBManager(pScreen, &(pI830->FbMemBox))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to init memory manager\n"); + } + } else { + if (!I830InitFBManager(pScreen, &(pI8301->FbMemBox2))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to init memory manager\n"); + } + } + } - if (!I830BIOSEnterVT(scrnIndex, 0)) - return FALSE; + if (pScrn->virtualX > pScrn->displayWidth) + pScrn->displayWidth = pScrn->virtualX; DPRINTF(PFX, "assert( if(!fbScreenInit(pScreen, ...) )\n"); if (!fbScreenInit(pScreen, pI830->FbBase + pScrn->fbOffset, @@ -7525,30 +2828,14 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } - fbPictureInit(pScreen, 0, 0); + fbPictureInit(pScreen, NULL, 0); xf86SetBlackWhitePixels(pScreen); - I830DGAInit(pScreen); + xf86DiDGAInit (pScreen, pI830->LinearAddr + pScrn->fbOffset); DPRINTF(PFX, "assert( if(!I830InitFBManager(pScreen, &(pI830->FbMemBox))) )\n"); - if (I830IsPrimary(pScrn)) { - if (!I830InitFBManager(pScreen, &(pI830->FbMemBox))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to init memory manager\n"); - } - - if (pI830->LinearAlloc && xf86InitFBManagerLinear(pScreen, pI830->LinearMem.Offset / pI830->cpp, pI830->LinearMem.Size / pI830->cpp)) - xf86DrvMsg(scrnIndex, X_INFO, - "Using %ld bytes of offscreen memory for linear (offset=0x%lx)\n", pI830->LinearMem.Size, pI830->LinearMem.Offset); - - } else { - if (!I830InitFBManager(pScreen, &(pI8301->FbMemBox2))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to init memory manager\n"); - } - } if (!pI830->noAccel) { if (!I830AccelInit(pScreen)) { @@ -7570,18 +2857,29 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } else xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing SW Cursor!\n"); +#ifdef XF86DRI + /* Must be called before EnterVT, so we can acquire the DRI lock when + * binding our memory. + */ + if (pI830->directRenderingEnabled) + pI830->directRenderingEnabled = I830DRIFinishScreenInit(pScreen); +#endif + + if (!I830EnterVT(scrnIndex, 0)) + return FALSE; + DPRINTF(PFX, "assert( if(!miCreateDefColormap(pScreen)) )\n"); if (!miCreateDefColormap(pScreen)) return FALSE; DPRINTF(PFX, "assert( if(!xf86HandleColormaps(pScreen, ...)) )\n"); - if (!xf86HandleColormaps(pScreen, 256, 8, I830LoadPalette, 0, + if (!xf86HandleColormaps(pScreen, 256, 8, I830LoadPalette, NULL, CMAP_RELOAD_ON_MODE_SWITCH | CMAP_PALETTED_TRUECOLOR)) { return FALSE; } - xf86DPMSInit(pScreen, I830DisplayPowerManagementSet, 0); + xf86DPMSInit(pScreen, xf86DPMSSet, 0); #ifdef I830_XV /* Init video */ @@ -7589,12 +2887,6 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) I830InitVideo(pScreen); #endif -#ifdef XF86DRI - if (pI830->directRenderingEnabled) { - pI830->directRenderingEnabled = I830DRIFinishScreenInit(pScreen); - } -#endif - /* Setup 3D engine, needed for rotation too */ IntelEmitInvarientState(pScrn); @@ -7603,7 +2895,7 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pI830->directRenderingOpen = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Enabled\n"); } else { - if (driDisabled) + if (pI830->directRenderingDisabled) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Disabled\n"); else xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Failed\n"); @@ -7612,57 +2904,26 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Not available\n"); #endif - pScreen->SaveScreen = I830BIOSSaveScreen; + pI830->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = I830BlockHandler; + + pScreen->SaveScreen = xf86SaveScreen; pI830->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = I830BIOSCloseScreen; - - if (pI830->MergedFB) { - pI830->PointerMoved = pScrn->PointerMoved; - pScrn->PointerMoved = I830MergedPointerMoved; - - if(pI830->IntelXinerama) { - I830noPanoramiXExtension = FALSE; - I830XineramaExtensionInit(pScrn); - if(!I830noPanoramiXExtension) { - if(pI830->HaveNonRect) { - /* Reset the viewport (now eventually non-recangular) */ - I830AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - } - } - } else { - pI830->MouseRestrictions = FALSE; - } - } else if (pI830->shadowReq.minorversion >= 1) { - /* Rotation */ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "RandR enabled, ignore the following RandR disabled message.\n"); - xf86DisableRandR(); /* Disable built-in RandR extension */ - shadowSetup(pScreen); - /* support all rotations */ - if (IS_I96X(pI830)) { - I830RandRInit(pScreen, RR_Rotate_0); /* only 0 degrees for I96X */ - } else { - I830RandRInit(pScreen, RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270); - } - pI830->PointerMoved = pScrn->PointerMoved; - pScrn->PointerMoved = I830PointerMoved; - pI830->CreateScreenResources = pScreen->CreateScreenResources; - pScreen->CreateScreenResources = I830CreateScreenResources; - } else { - /* Rotation */ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "libshadow is version %d.%d.%d, required 1.1.0 or greater for rotation.\n",pI830->shadowReq.majorversion,pI830->shadowReq.minorversion,pI830->shadowReq.patchlevel); - } + pScreen->CloseScreen = I830CloseScreen; + pI830->CreateScreenResources = pScreen->CreateScreenResources; + pScreen->CreateScreenResources = i830CreateScreenResources; - /* Call this unconditionally, as it also sets some fields in the SAREA */ - I830UpdateXineramaScreenInfo(pScrn); + if (!xf86CrtcScreenInit (pScreen)) + return FALSE; + + /* Wrap pointer motion to flip touch screen around */ + pI830->PointerMoved = pScrn->PointerMoved; + pScrn->PointerMoved = I830PointerMoved; if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); -#ifdef I830DEBUG - I830_dump_registers(pScrn); -#endif - - if (IS_I96X(pI830)) { + if (IS_I965G(pI830)) { /* turn off clock gating */ #if 0 OUTREG(0x6204, 0x70804000); @@ -7680,195 +2941,41 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pI830->closing = FALSE; pI830->suspended = FALSE; - switch (pI830->InitialRotation) { - case 0: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Rotating to 0 degrees\n"); - pI830->rotation = RR_Rotate_0; - break; - case 90: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Rotating to 90 degrees\n"); - pI830->rotation = RR_Rotate_90; - break; - case 180: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Rotating to 180 degrees\n"); - pI830->rotation = RR_Rotate_180; - break; - case 270: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Rotating to 270 degrees\n"); - pI830->rotation = RR_Rotate_270; - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Bad rotation setting - defaulting to 0 degrees\n"); - pI830->rotation = RR_Rotate_0; - break; - } - - -#ifdef XF86DRI - if (pI830->directRenderingEnabled && (pI830->mmModeFlags & I830_KERNEL_MM)) { - unsigned long aperEnd = ROUND_DOWN_TO(pI830->FbMapSize, GTT_PAGE_SIZE) - / GTT_PAGE_SIZE; - unsigned long aperStart = ROUND_TO(pI830->FbMapSize - KB(pI830->mmSize), GTT_PAGE_SIZE) - / GTT_PAGE_SIZE; - - if (aperEnd < aperStart || aperEnd - aperStart < I830_MM_MINPAGES) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Too little AGP aperture space for DRM memory manager.\n" - "\tPlease increase AGP aperture size from BIOS configuration screen\n" - "\tor decrease the amount of video RAM using option \"VideoRam\".\n" - "\tDisabling DRI.\n"); - pI830->directRenderingOpen = FALSE; - I830DRICloseScreen(pScreen); - pI830->directRenderingEnabled = FALSE; - } else { -#ifndef XSERVER_LIBDRM_MM - if (I830DrmMMInit(pI830->drmSubFD, aperStart, aperEnd - aperStart, - DRM_BO_MEM_TT)) { -#else - if (drmMMInit(pI830->drmSubFD, aperStart, aperEnd - aperStart, - DRM_BO_MEM_TT)) { -#endif - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Could not initialize the DRM memory manager.\n"); - - pI830->directRenderingOpen = FALSE; - I830DRICloseScreen(pScreen); - pI830->directRenderingEnabled = FALSE; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Initialized DRM memory manager, %ld AGP pages\n" - "\tat AGP offset 0x%lx\n", - aperEnd - aperStart, - aperStart); - } - } - } -#endif - return TRUE; } - static void -I830AdjustFrame(int scrnIndex, int x, int y, int flags) +i830AdjustFrame(int scrnIndex, int x, int y, int flags) { - ScrnInfoPtr pScrn; - I830Ptr pI830; - vbeInfoPtr pVbe; - unsigned long Start; - - pScrn = xf86Screens[scrnIndex]; - pI830 = I830PTR(pScrn); - pVbe = pI830->pVbe; + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + I830Ptr pI830 = I830PTR(pScrn); + xf86OutputPtr output = config->output[config->compat_output]; + xf86CrtcPtr crtc = output->crtc; - DPRINTF(PFX, "I830AdjustFrame: y = %d (+ %d), x = %d (+ %d)\n", + DPRINTF(PFX, "i830AdjustFrame: y = %d (+ %d), x = %d (+ %d)\n", x, pI830->xoffset, y, pI830->yoffset); - /* Sync the engine before adjust frame */ - if (pI830->AccelInfoRec && pI830->AccelInfoRec->NeedToSync) { - (*pI830->AccelInfoRec->Sync)(pScrn); - pI830->AccelInfoRec->NeedToSync = FALSE; - } - - if (pI830->MergedFB) { - I830AdjustFrameMerged(scrnIndex, x, y, flags); - - if (pI830->pipe == 0) { - OUTREG(DSPABASE, pI830->FrontBuffer.Start + ((pI830->FirstframeY0 * pScrn->displayWidth + pI830->FirstframeX0) * pI830->cpp)); - OUTREG(DSPBBASE, pI830->FrontBuffer.Start + ((pI830->pScrn_2->frameY0 * pScrn->displayWidth + pI830->pScrn_2->frameX0) * pI830->cpp)); - } else { - OUTREG(DSPBBASE, pI830->FrontBuffer.Start + ((pI830->FirstframeY0 * pScrn->displayWidth + pI830->FirstframeX0) * pI830->cpp)); - OUTREG(DSPABASE, pI830->FrontBuffer.Start + ((pI830->pScrn_2->frameY0 * pScrn->displayWidth + pI830->pScrn_2->frameX0) * pI830->cpp)); - } - - return; - } - - if (I830IsPrimary(pScrn)) - Start = pI830->FrontBuffer.Start; - else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - Start = pI8301->FrontBuffer2.Start; - } - - /* Sigh... - * It seems that there are quite a few Video BIOS' that get this wrong. - * So, we'll bypass the VBE call and hit the hardware directly. - */ - - if (pI830->Clone) { - if (!pI830->pipe == 0) { - if (!IS_I96X(pI830)) { - OUTREG(DSPABASE, Start + ((y * pScrn->displayWidth + x) * pI830->cpp)); - } else { - OUTREG(DSPABASE, 0); - OUTREG(DSPASURF, Start + ((y * pScrn->displayWidth + x) * pI830->cpp)); - } - } else { - if (!IS_I96X(pI830)) { - OUTREG(DSPBBASE, Start + ((y * pScrn->displayWidth + x) * pI830->cpp)); - } else { - OUTREG(DSPBBASE, 0); - OUTREG(DSPBSURF, Start + ((y * pScrn->displayWidth + x) * pI830->cpp)); - } - } - } - - if (pI830->pipe == 0) { - if (!IS_I96X(pI830)) { - OUTREG(DSPABASE, Start + ((y * pScrn->displayWidth + x) * pI830->cpp)); - } else { - OUTREG(DSPABASE, 0); - OUTREG(DSPASURF, Start + ((y * pScrn->displayWidth + x) * pI830->cpp)); - } - } else { - if (!IS_I96X(pI830)) { - OUTREG(DSPBBASE, Start + ((y * pScrn->displayWidth + x) * pI830->cpp)); - } else { - OUTREG(DSPBBASE, 0); - OUTREG(DSPBSURF, Start + ((y * pScrn->displayWidth + x) * pI830->cpp)); - } + if (crtc && crtc->enabled) + { + /* Sync the engine before adjust frame */ + i830WaitSync(pScrn); + i830PipeSetBase(crtc, crtc->desiredX + x, crtc->desiredY + y); + crtc->x = output->initial_x + x; + crtc->y = output->initial_y + y; } } static void -I830BIOSFreeScreen(int scrnIndex, int flags) +I830FreeScreen(int scrnIndex, int flags) { - I830BIOSFreeRec(xf86Screens[scrnIndex]); + I830FreeRec(xf86Screens[scrnIndex]); if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) vgaHWFreeHWRec(xf86Screens[scrnIndex]); } -#ifndef SAVERESTORE_HWSTATE -#define SAVERESTORE_HWSTATE 0 -#endif - -#if SAVERESTORE_HWSTATE static void -SaveHWOperatingState(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - I830RegPtr save = &pI830->SavedReg; - - DPRINTF(PFX, "SaveHWOperatingState\n"); - - return; -} - -static void -RestoreHWOperatingState(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - I830RegPtr save = &pI830->SavedReg; - - DPRINTF(PFX, "RestoreHWOperatingState\n"); - - return; -} -#endif - -static void -I830BIOSLeaveVT(int scrnIndex, int flags) +I830LeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); @@ -7881,20 +2988,11 @@ I830BIOSLeaveVT(int scrnIndex, int flags) TimerCancel(pI830->devicesTimer); pI830->devicesTimer = NULL; -#ifdef I830_XV - /* Give the video overlay code a chance to shutdown. */ - I830VideoSwitchModeBefore(pScrn, NULL); -#endif - - if (pI830->Clone || pI830->MergedFB) { - /* Ensure we don't try and setup modes on a clone head */ - pI830->CloneHDisplay = 0; - pI830->CloneVDisplay = 0; - } + i830SetHotkeyControl(pScrn, HOTKEY_BIOS_SWITCH); if (!I830IsPrimary(pScrn)) { I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - if (!pI8301->GttBound) { + if (!pI8301->gtt_acquired) { return; } } @@ -7902,352 +3000,51 @@ I830BIOSLeaveVT(int scrnIndex, int flags) #ifdef XF86DRI if (pI830->directRenderingOpen) { DRILock(screenInfo.screens[pScrn->scrnIndex], 0); - if (pI830->mmModeFlags & I830_KERNEL_MM) { -#ifndef XSERVER_LIBDRM_MM - I830DrmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT); -#else - drmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT); -#endif - } + I830DRISetVBlankInterrupt (pScrn, FALSE); - drmCtlUninstHandler(pI830->drmSubFD); } #endif -#if SAVERESTORE_HWSTATE - if (!pI830->closing) - SaveHWOperatingState(pScrn); -#endif - - if (pI830->CursorInfoRec && pI830->CursorInfoRec->HideCursor) - pI830->CursorInfoRec->HideCursor(pScrn); - - ResetState(pScrn, TRUE); - - if (I830IsPrimary(pScrn)) { - if (!SetDisplayDevices(pScrn, pI830->savedDevices)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to switch back to original display devices (0x%x)\n", - pI830->savedDevices); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Successfully set original devices\n"); - } - } + xf86_hide_cursors (pScrn); RestoreHWState(pScrn); - RestoreBIOSMemSize(pScrn); - if (I830IsPrimary(pScrn)) - I830UnbindAGPMemory(pScrn); - if (pI830->AccelInfoRec) - pI830->AccelInfoRec->NeedToSync = FALSE; - /* DO IT AGAIN! AS IT SEEMS THAT SOME LFPs FLICKER OTHERWISE */ - if (I830IsPrimary(pScrn)) { - if (!SetDisplayDevices(pScrn, pI830->savedDevices)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to switch back to original display devices (0x%x) (2)\n", - pI830->savedDevices); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Successfully set original devices (2)\n"); - } - } -} + i830_stop_ring(pScrn, TRUE); -static Bool -I830DetectMonitorChange(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - pointer pDDCModule = NULL; - DisplayModePtr p, pMon; - int memsize; - int DDCclock = 0, DDCclock2 = 0; - int displayWidth = pScrn->displayWidth; - int curHDisplay = pScrn->currentMode->HDisplay; - int curVDisplay = pScrn->currentMode->VDisplay; - xf86MonPtr monitor = NULL; - - DPRINTF(PFX, "Detect Monitor Change\n"); - - SetPipeAccess(pScrn); - - /* Re-read EDID */ - pDDCModule = xf86LoadSubModule(pScrn, "ddc"); - - if (pI830->MergedFB) { - pI830->pVbe->ddc = DDC_UNCHECKED; - SetBIOSPipe(pScrn, !pI830->pipe); - monitor = vbeDoEDID(pI830->pVbe, pDDCModule); - if ((pI830->pScrn_2->monitor->DDC = monitor) != NULL) { - xf86PrintEDID(monitor); - xf86SetDDCproperties(pScrn, monitor); - } - SetPipeAccess(pScrn); + if (pI830->debug_modes) { + i830CompareRegsToSnapshot(pScrn, "After LeaveVT"); + i830DumpRegs (pScrn); } - pI830->pVbe->ddc = DDC_UNCHECKED; - monitor = vbeDoEDID(pI830->pVbe, pDDCModule); - xf86UnloadSubModule(pDDCModule); - if ((pScrn->monitor->DDC = monitor) != NULL) { - xf86PrintEDID(monitor); - xf86SetDDCproperties(pScrn, monitor); - } - - DDCclock = I830UseDDC(pScrn); - - /* Check if DDC exists on the second head, if not don't abort. */ - if (pI830->MergedFB) - DDCclock2 = I830UseDDC(pI830->pScrn_2); - - /* Revalidate the modes */ + if (I830IsPrimary(pScrn)) + i830_unbind_all_memory(pScrn); - /* - * Note: VBE modes (> 0x7f) won't work with Intel's extended BIOS - * functions. + /* Tell the kernel to evict all buffer objects and block new buffer + * allocations until we relese the lock. */ - SetPipeAccess(pScrn); - - pScrn->modePool = I830GetModePool(pScrn, pI830->pVbe, pI830->vbeInfo); - - if (!pScrn->modePool) { - /* This is bad, which would cause the Xserver to exit, maybe - * we should default to a 640x480 @ 60Hz mode here ??? */ - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "No Video BIOS modes for chosen depth.\n"); - return FALSE; - } - - if (pI830->MergedFB) { - SetBIOSPipe(pScrn, !pI830->pipe); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Retrieving mode pool for second head.\n"); - pI830->pScrn_2->modePool = I830GetModePool(pI830->pScrn_2, pI830->pVbe, pI830->vbeInfo); - - if (!pI830->pScrn_2->modePool) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "No Video BIOS modes for chosen depth.\n"); - PreInitCleanup(pScrn); - return FALSE; - } - SetPipeAccess(pScrn); - } - - VBESetModeNames(pScrn->modePool); - if (pI830->MergedFB) - VBESetModeNames(pI830->pScrn_2->modePool); - - if (pScrn->videoRam > (pI830->vbeInfo->TotalMemory * 64)) - memsize = pI830->vbeInfo->TotalMemory * 64; - else - memsize = pScrn->videoRam; - - VBEValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, NULL, - NULL, 0, MAX_DISPLAY_PITCH, 1, - 0, MAX_DISPLAY_HEIGHT, - pScrn->display->virtualX, - pScrn->display->virtualY, - memsize, LOOKUP_BEST_REFRESH); - - if (pI830->MergedFB) { - VBEValidateModes(pI830->pScrn_2, pI830->pScrn_2->monitor->Modes, - pI830->pScrn_2->display->modes, NULL, - NULL, 0, MAX_DISPLAY_PITCH, 1, - 0, MAX_DISPLAY_HEIGHT, - pScrn->display->virtualX, - pScrn->display->virtualY, - memsize, LOOKUP_BEST_REFRESH); - } - - if (DDCclock > 0) { - p = pScrn->modes; - if (p == NULL) - return FALSE; - do { - int Clock = 100000000; /* incredible value */ - - if (p->status == MODE_OK) { - for (pMon = pScrn->monitor->Modes; pMon != NULL; pMon = pMon->next) { - if ((pMon->HDisplay != p->HDisplay) || - (pMon->VDisplay != p->VDisplay) || - (pMon->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2))) - continue; - - /* Find lowest supported Clock for this resolution */ - if (Clock > pMon->Clock) - Clock = pMon->Clock; - } - - if (Clock != 100000000 && DDCclock < 2550 && Clock / 1000.0 > DDCclock) { - ErrorF("(%s,%s) mode clock %gMHz exceeds DDC maximum %dMHz\n", - p->name, pScrn->monitor->id, - Clock/1000.0, DDCclock); - p->status = MODE_BAD; - } - } - p = p->next; - } while (p != NULL && p != pScrn->modes); - } - - /* Only use this if we've got DDC available */ - if (pI830->MergedFB && DDCclock2 > 0) { - p = pI830->pScrn_2->modes; - if (p == NULL) - return FALSE; - do { - int Clock = 100000000; /* incredible value */ - - if (p->status == MODE_OK) { - for (pMon = pI830->pScrn_2->monitor->Modes; pMon != NULL; pMon = pMon->next) { - if ((pMon->HDisplay != p->HDisplay) || - (pMon->VDisplay != p->VDisplay) || - (pMon->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2))) - continue; - - /* Find lowest supported Clock for this resolution */ - if (Clock > pMon->Clock) - Clock = pMon->Clock; - } - - if (Clock != 100000000 && DDCclock2 < 2550 && Clock / 1000.0 > DDCclock2) { - ErrorF("(%s,%s) mode clock %gMHz exceeds DDC maximum %dMHz\n", - p->name, pI830->pScrn_2->monitor->id, - Clock/1000.0, DDCclock2); - p->status = MODE_BAD; - } - } - p = p->next; - } while (p != NULL && p != pI830->pScrn_2->modes); - } - - xf86PruneDriverModes(pScrn); - - if (pI830->MergedFB) - xf86PruneDriverModes(pI830->pScrn_2); - - if (pI830->MergedFB) { - DisplayModePtr old_modes, cur_mode; - - old_modes = pScrn->modes; - cur_mode = pScrn->currentMode; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MergedFB: Generating mode list\n"); - - pScrn->modes = I830GenerateModeList(pScrn, pI830->MetaModes, - old_modes, pI830->pScrn_2->modes, - pI830->SecondPosition); - - if(!pScrn->modes) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes. Disabling MergedFB.\n"); - pScrn->modes = old_modes; - pScrn->currentMode = cur_mode; - pI830->MergedFB = FALSE; - } - } - - if (!pI830->vesa->useDefaultRefresh) - I830SetModeParameters(pScrn, pI830->pVbe); - - /* Now check if the previously used mode is o.k. for the current monitor. - * This allows VT switching to continue happily when not disconnecting - * and reconnecting monitors */ - - pScrn->currentMode = pScrn->modes; - - if (pI830->MergedFB) { - /* If no virtual dimension was given by the user, - * calculate a sane one now. Adapts pScrn->virtualX, - * pScrn->virtualY and pScrn->displayWidth. - */ - I830RecalcDefaultVirtualSize(pScrn); - - pScrn->modes = pScrn->modes->next; /* We get the last from GenerateModeList(), skip to first */ - pScrn->currentMode = pScrn->modes; - pI830->currentMode = pScrn->currentMode; - } - - pScrn->displayWidth = displayWidth; /* restore old displayWidth */ - - p = pScrn->modes; - if (p == NULL) - return FALSE; - do { - if ((p->HDisplay == curHDisplay) && - (p->VDisplay == curVDisplay) && - (!(p->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2)))) { - pScrn->currentMode = p; /* previous mode is o.k. */ - } - p = p->next; - } while (p != NULL && p != pScrn->modes); - - I830PrintModes(pScrn); - - /* Now readjust for panning if necessary */ - { - pScrn->frameX0 = (pScrn->frameX0 + pScrn->frameX1 + 1 - pScrn->currentMode->HDisplay) / 2; - - if (pScrn->frameX0 < 0) - pScrn->frameX0 = 0; - - pScrn->frameX1 = pScrn->frameX0 + pScrn->currentMode->HDisplay - 1; - if (pScrn->frameX1 >= pScrn->virtualX) { - pScrn->frameX0 = pScrn->virtualX - pScrn->currentMode->HDisplay; - pScrn->frameX1 = pScrn->virtualX - 1; - } - - pScrn->frameY0 = (pScrn->frameY0 + pScrn->frameY1 + 1 - pScrn->currentMode->VDisplay) / 2; - - if (pScrn->frameY0 < 0) - pScrn->frameY0 = 0; - - pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay - 1; - if (pScrn->frameY1 >= pScrn->virtualY) { - pScrn->frameY0 = pScrn->virtualY - pScrn->currentMode->VDisplay; - pScrn->frameY1 = pScrn->virtualY - 1; +#ifdef XF86DRI_MM + if (pI830->directRenderingOpen) { + if (pI830->memory_manager != NULL && pScrn->vtSema) { + drmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT, 1, 0); } } +#endif /* XF86DRI_MM */ - if (pI830->MergedFB) - I830AdjustFrameMerged(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - - return TRUE; + if (pI830->AccelInfoRec) + pI830->AccelInfoRec->NeedToSync = FALSE; } -Bool -I830CheckModeSupport(ScrnInfoPtr pScrn, int x, int y, int mode) -{ - I830Ptr pI830 = I830PTR(pScrn); - Bool ret = TRUE; - - if (pI830->Clone) { - if (pI830->pipeDisplaySize[0].x2 != 0) { - if (x > pI830->pipeDisplaySize[0].x2 || - y > pI830->pipeDisplaySize[0].y2) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Bad Clone Mode removing\n"); - return FALSE; - } - } - if (pI830->pipeDisplaySize[1].x2 != 0) { - if (x > pI830->pipeDisplaySize[1].x2 || - y > pI830->pipeDisplaySize[1].y2) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Bad Clone Mode removing\n"); - return FALSE; - } - } - } - - return ret; -} - /* * This gets called when gaining control of the VT, and from ScreenInit(). */ static Bool -I830BIOSEnterVT(int scrnIndex, int flags) +I830EnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - I830Ptr pI830 = I830PTR(pScrn); + I830Ptr pI830 = I830PTR(pScrn); + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + int o; DPRINTF(PFX, "Enter VT\n"); @@ -8262,89 +3059,62 @@ I830BIOSEnterVT(int scrnIndex, int flags) pI830->leaving = FALSE; -#if 1 - /* Clear the framebuffer */ - memset(pI830->FbBase + pScrn->fbOffset, 0, - pScrn->virtualY * pScrn->displayWidth * pI830->cpp); -#endif - - if (I830IsPrimary(pScrn)) { - /* - * This is needed for restoring from ACPI modes (especially S3) - * so that we warmboot the Video BIOS. Some platforms have problems, - * warm booting when we don't need to, so check that we can call - * the Video BIOS with our saved devices, and only when that fails, - * we'll warm boot it. - */ - /* Check Pipe conf registers or possibly HTOTAL/VTOTAL for 0x00000000)*/ - CARD32 temp; - Bool set = I830Set640x480(pScrn); - temp = pI830->pipe ? INREG(PIPEBCONF) : INREG(PIPEACONF); - if (!set || !(temp & 0x80000000)) { - xf86Int10InfoPtr pInt; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected resume, re-POSTing.\n"); - - pInt = xf86InitInt10(pI830->pEnt->index); - - /* Now perform our warm boot */ - if (pInt) { - pInt->num = 0xe6; - xf86ExecX86int10 (pInt); - xf86FreeInt10 (pInt); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Re-POSTing via int10.\n"); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Re-POSTing via int10 failed, trying to continue.\n"); - } - } - - /* Finally, re-setup the display devices */ - if (!SetDisplayDevices(pScrn, pI830->operatingDevices)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to switch to configured display devices\n"); - return FALSE; +#ifdef XF86DRI_MM + if (pI830->directRenderingEnabled) { + /* Unlock the memory manager first of all so that we can pin our + * buffer objects + */ + if (pI830->memory_manager != NULL && pScrn->vtSema) { + drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT, 1); } } - - /* Setup for device monitoring status */ - pI830->monitorSwitch = pI830->toggleDevices = INREG(SWF0) & 0x0000FFFF; +#endif /* XF86DRI_MM */ if (I830IsPrimary(pScrn)) - if (!I830BindAGPMemory(pScrn)) + if (!i830_bind_all_memory(pScrn)) return FALSE; - CheckInheritedState(pScrn); - if (I830IsPrimary(pScrn)) { - if (!TweakMemorySize(pScrn, pI830->newBIOSMemSize,FALSE)) - SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); + i830_describe_allocations(pScrn, 1, ""); + + /* Update the screen pixmap in case the buffer moved */ + i830_update_front_offset(pScrn); + + if (i830_check_error_state(pScrn)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Existing errors found in hardware state.\n"); } - ResetState(pScrn, FALSE); + i830_stop_ring(pScrn, FALSE); SetHWOperatingState(pScrn); - if (!pI830->starting) - I830DetectMonitorChange(pScrn); - - if (!I830VESASetMode(pScrn, pScrn->currentMode)) + /* Clear the framebuffer */ + memset(pI830->FbBase + pScrn->fbOffset, 0, + pScrn->virtualY * pScrn->displayWidth * pI830->cpp); + + for (o = 0; o < config->num_output; o++) { + xf86OutputPtr output = config->output[o]; + output->funcs->dpms(output, DPMSModeOff); + } + + if (!xf86SetDesiredModes (pScrn)) return FALSE; -#ifdef I830_XV - I830VideoSwitchModeAfter(pScrn, pScrn->currentMode); -#endif + if (pI830->debug_modes) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Hardware state at EnterVT:\n"); + i830DumpRegs (pScrn); + } + i830DescribeOutputConfiguration(pScrn); - ResetState(pScrn, TRUE); + i830_stop_ring(pScrn, TRUE); SetHWOperatingState(pScrn); - pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - -#if SAVERESTORE_HWSTATE - RestoreHWOperatingState(pScrn); -#endif - #ifdef XF86DRI if (pI830->directRenderingEnabled) { + /* Update buffer offsets in sarea and mappings, since buffer offsets + * may have changed. + */ + if (!i830_update_dri_buffers(pScrn)) + FatalError("i830_update_dri_buffers() failed\n"); I830DRISetVBlankInterrupt (pScrn, TRUE); @@ -8355,7 +3125,7 @@ I830BIOSEnterVT(int scrnIndex, int flags) I830DRIResume(screenInfo.screens[scrnIndex]); - I830RefreshRing(pScrn); + i830_refresh_ring(pScrn); I830Sync(pScrn); DO_RING_IDLE(); @@ -8363,14 +3133,6 @@ I830BIOSEnterVT(int scrnIndex, int flags) for(i = 0; i < I830_NR_TEX_REGIONS+1 ; i++) sarea->texList[i].age = sarea->texAge; - if (pI830->mmModeFlags & I830_KERNEL_MM) { -#ifndef XSERVER_LIBDRM_MM - I830DrmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT); -#else - drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT); -#endif - } - DPRINTF(PFX, "calling dri unlock\n"); DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); } @@ -8378,226 +3140,53 @@ I830BIOSEnterVT(int scrnIndex, int flags) } #endif - /* Needed for rotation */ - IntelEmitInvarientState(pScrn); + /* Set the hotkey to just notify us. We can check its results periodically + * in the CheckDevicesTimer. Eventually we want the kernel to just hand us + * an input event when someone presses the button, but for now we just have + * to poll. + */ + i830SetHotkeyControl(pScrn, HOTKEY_DRIVER_NOTIFY); if (pI830->checkDevices) pI830->devicesTimer = TimerSet(NULL, 0, 1000, I830CheckDevicesTimer, pScrn); - pI830->currentMode = pScrn->currentMode; - - /* Force invarient state when rotated to be emitted */ - *pI830->used3D = 1<<31; + /* Mark 3D state as being clobbered and setup the basics */ + *pI830->last_3d = LAST_3D_OTHER; + IntelEmitInvarientState(pScrn); return TRUE; } static Bool -I830BIOSSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +I830SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); - Bool ret = TRUE; - PixmapPtr pspix = (*pScrn->pScreen->GetScreenPixmap) (pScrn->pScreen); - - DPRINTF(PFX, "I830BIOSSwitchMode: mode == %p\n", mode); - -#ifdef I830_XV - /* Give the video overlay code a chance to see the new mode. */ - I830VideoSwitchModeBefore(pScrn, mode); -#endif - /* Sync the engine before mode switch */ - if (pI830->AccelInfoRec && pI830->AccelInfoRec->NeedToSync) { - (*pI830->AccelInfoRec->Sync)(pScrn); - pI830->AccelInfoRec->NeedToSync = FALSE; - } - - /* Check if our currentmode is about to change. We do this so if we - * are rotating, we don't need to call the mode setup again. - */ - if (pI830->currentMode != mode) { - if (!I830VESASetMode(pScrn, mode)) - ret = FALSE; - } - - /* Kludge to detect Rotate or Vidmode switch. Not very elegant, but - * workable given the implementation currently. We only need to call - * the rotation function when we know that the framebuffer has been - * disabled by the EnableDisableFBAccess() function. - * - * The extra WindowTable check detects a rotation at startup. - */ - if ( (!WindowTable[pScrn->scrnIndex] || pspix->devPrivate.ptr == NULL) && - !pI830->DGAactive && (pScrn->PointerMoved == I830PointerMoved) && - !IS_I96X(pI830)) { - if (!I830Rotate(pScrn, mode)) - ret = FALSE; - } - - /* Either the original setmode or rotation failed, so restore the previous - * video mode here, as we'll have already re-instated the original rotation. - */ - if (!ret) { - if (!I830VESASetMode(pScrn, pI830->currentMode)) { - xf86DrvMsg(scrnIndex, X_INFO, - "Failed to restore previous mode (SwitchMode)\n"); - } - -#ifdef I830_XV - /* Give the video overlay code a chance to see the new mode. */ - I830VideoSwitchModeAfter(pScrn, pI830->currentMode); -#endif - } else { - pI830->currentMode = mode; - -#ifdef I830_XV - /* Give the video overlay code a chance to see the new mode. */ - I830VideoSwitchModeAfter(pScrn, mode); -#endif - } - - /* Since RandR (indirectly) uses SwitchMode(), we need to - * update our Xinerama info here, too, in case of resizing - * Call this unconditionally, as it also sets some fields in the SAREA - */ - I830UpdateXineramaScreenInfo(pScrn); - - return ret; + return xf86SetSingleMode (pScrn, mode, pI830->rotation); } static Bool -I830BIOSSaveScreen(ScreenPtr pScreen, int mode) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - Bool on = xf86IsUnblank(mode); - CARD32 temp, ctrl, base, surf; - - DPRINTF(PFX, "I830BIOSSaveScreen: %d, on is %s\n", mode, BOOLTOSTRING(on)); - - if (pScrn->vtSema) { - if (pI830->pipe == 0) { - ctrl = DSPACNTR; - base = DSPABASE; - surf = DSPASURF; - } else { - ctrl = DSPBCNTR; - base = DSPBADDR; - surf = DSPBSURF; - } - if (pI830->planeEnabled[pI830->pipe]) { - temp = INREG(ctrl); - if (on) - temp |= DISPLAY_PLANE_ENABLE; - else - temp &= ~DISPLAY_PLANE_ENABLE; - OUTREG(ctrl, temp); - /* Flush changes */ - temp = INREG(base); - OUTREG(base, temp); - if (IS_I96X(pI830)) { - temp = INREG(surf); - OUTREG(surf, temp); - } - } - - if (pI830->CursorInfoRec && !pI830->SWCursor && pI830->cursorOn) { - if (on) - pI830->CursorInfoRec->ShowCursor(pScrn); - else - pI830->CursorInfoRec->HideCursor(pScrn); - pI830->cursorOn = TRUE; - } - } - return TRUE; -} - -/* Use the VBE version when available. */ -static void -I830DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, - int flags) -{ - I830Ptr pI830 = I830PTR(pScrn); - vbeInfoPtr pVbe = pI830->pVbe; - - if (pI830->Clone || pI830->MergedFB) { - SetBIOSPipe(pScrn, !pI830->pipe); - if (xf86LoaderCheckSymbol("VBEDPMSSet")) { - VBEDPMSSet(pVbe, PowerManagementMode); - } else { - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f10; - pVbe->pInt10->bx = 0x01; - - switch (PowerManagementMode) { - case DPMSModeOn: - break; - case DPMSModeStandby: - pVbe->pInt10->bx |= 0x0100; - break; - case DPMSModeSuspend: - pVbe->pInt10->bx |= 0x0200; - break; - case DPMSModeOff: - pVbe->pInt10->bx |= 0x0400; - break; - } - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - } - } - - SetPipeAccess(pScrn); - - if (xf86LoaderCheckSymbol("VBEDPMSSet")) { - VBEDPMSSet(pVbe, PowerManagementMode); - } else { - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f10; - pVbe->pInt10->bx = 0x01; - - switch (PowerManagementMode) { - case DPMSModeOn: - break; - case DPMSModeStandby: - pVbe->pInt10->bx |= 0x0100; - break; - case DPMSModeSuspend: - pVbe->pInt10->bx |= 0x0200; - break; - case DPMSModeOff: - pVbe->pInt10->bx |= 0x0400; - break; - } - xf86ExecX86int10_wrapper(pVbe->pInt10, pScrn); - } -} - -static Bool -I830BIOSCloseScreen(int scrnIndex, ScreenPtr pScreen) +I830CloseScreen(int scrnIndex, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); +#ifdef I830_USE_XAA XAAInfoRecPtr infoPtr = pI830->AccelInfoRec; +#endif pI830->closing = TRUE; -#ifdef XF86DRI - if (pI830->directRenderingOpen) { - if (pI830->mmModeFlags & I830_KERNEL_MM) { -#ifndef XSERVER_LIBDRM_MM - I830DrmMMTakedown(pI830->drmSubFD, DRM_BO_MEM_TT); -#else - drmMMTakedown(pI830->drmSubFD, DRM_BO_MEM_TT); -#endif - } - pI830->directRenderingOpen = FALSE; - I830DRICloseScreen(pScreen); - } -#endif if (pScrn->vtSema == TRUE) { - I830BIOSLeaveVT(scrnIndex, 0); + I830LeaveVT(scrnIndex, 0); +#ifdef XF86DRI_MM + if (pI830->directRenderingEnabled) { + if (pI830->memory_manager != NULL) { + drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT, 1); + } + } +#endif /* XF86DRI_MM */ + } if (pI830->devicesTimer) @@ -8610,36 +3199,51 @@ I830BIOSCloseScreen(int scrnIndex, ScreenPtr pScreen) if (pI830->ScanlineColorExpandBuffers) { xfree(pI830->ScanlineColorExpandBuffers); - pI830->ScanlineColorExpandBuffers = 0; + pI830->ScanlineColorExpandBuffers = NULL; } - +#ifdef I830_USE_XAA if (infoPtr) { if (infoPtr->ScanlineColorExpandBuffers) xfree(infoPtr->ScanlineColorExpandBuffers); XAADestroyInfoRec(infoPtr); pI830->AccelInfoRec = NULL; } +#endif +#ifdef I830_USE_EXA + if (pI830->useEXA && pI830->EXADriverPtr) { + exaDriverFini(pScreen); + xfree(pI830->EXADriverPtr); + pI830->EXADriverPtr = NULL; + } +#endif + xf86_cursors_fini (pScreen); - if (pI830->CursorInfoRec) { - xf86DestroyCursorInfoRec(pI830->CursorInfoRec); - pI830->CursorInfoRec = 0; + i830_allocator_fini(pScrn); +#ifdef XF86DRI + if (pI830->directRenderingOpen) { +#ifdef DAMAGE + if (pI830->pDamage) { + PixmapPtr pPix = pScreen->GetScreenPixmap(pScreen); + + DamageUnregister(&pPix->drawable, pI830->pDamage); + DamageDestroy(pI830->pDamage); + pI830->pDamage = NULL; + } +#endif + pI830->directRenderingOpen = FALSE; + I830DRICloseScreen(pScreen); } +#endif if (I830IsPrimary(pScrn)) { xf86GARTCloseScreen(scrnIndex); xfree(pI830->LpRing); pI830->LpRing = NULL; - xfree(pI830->CursorMem); - pI830->CursorMem = NULL; - xfree(pI830->CursorMemARGB); - pI830->CursorMemARGB = NULL; - xfree(pI830->OverlayMem); - pI830->OverlayMem = NULL; xfree(pI830->overlayOn); pI830->overlayOn = NULL; - xfree(pI830->used3D); - pI830->used3D = NULL; + xfree(pI830->last_3d); + pI830->last_3d = NULL; } pScrn->PointerMoved = pI830->PointerMoved; @@ -8732,15 +3336,6 @@ I830PMEvent(int scrnIndex, pmEvent event, Bool undo) ErrorF("I830PMEvent: Capability change\n"); - /* ACPI Toggle */ - pI830->toggleDevices = GetNextDisplayDeviceList(pScrn, 1); - if (xf86IsEntityShared(pScrn->entityList[0])) { - I830Ptr pI8302 = I830PTR(pI830->entityPrivate->pScrn_2); - pI8302->toggleDevices = pI830->toggleDevices; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ACPI Toggle to 0x%x\n",pI830->toggleDevices); - I830CheckDevicesTimer(NULL, 0, pScrn); SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); break; @@ -8750,338 +3345,127 @@ I830PMEvent(int scrnIndex, pmEvent event, Bool undo) return TRUE; } -static int CountBits(int a) +#if 0 +/** + * This function is used for testing of the screen detect functions from the + * periodic timer. + */ +static void +i830MonitorDetectDebugger(ScrnInfoPtr pScrn) { - int i; - int b = 0; + Bool found_crt; + I830Ptr pI830 = I830PTR(pScrn); + int start, finish, i; - for (i=0;i<8;i++) { - if (a & (1<<i)) - b+=1; - } + if (!pScrn->vtSema) + return 1000; + + for (i = 0; i < xf86_config->num_output; i++) { + enum output_status ret; + char *result; + + start = GetTimeInMillis(); + ret = pI830->output[i].detect(pScrn, &pI830->output[i]); + finish = GetTimeInMillis(); - return b; + if (ret == OUTPUT_STATUS_CONNECTED) + result = "connected"; + else if (ret == OUTPUT_STATUS_DISCONNECTED) + result = "disconnected"; + else + result = "unknown"; + + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Detected SDVO as %s in %dms\n", + result, finish - start); + } } +#endif static CARD32 I830CheckDevicesTimer(OsTimerPtr timer, CARD32 now, pointer arg) { ScrnInfoPtr pScrn = (ScrnInfoPtr) arg; I830Ptr pI830 = I830PTR(pScrn); - int cloned = 0; - - if (pScrn->vtSema) { - /* Check for monitor lid being closed/opened and act accordingly */ - CARD32 adjust; - CARD32 temp = INREG(SWF0) & 0x0000FFFF; - int fixup = 0; - I830Ptr pI8301; - I830Ptr pI8302 = NULL; - - if (I830IsPrimary(pScrn)) - pI8301 = pI830; - else - pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - - if (xf86IsEntityShared(pScrn->entityList[0])) - pI8302 = I830PTR(pI830->entityPrivate->pScrn_2); - - /* this avoids several BIOS calls if possible */ - if (pI830->monitorSwitch != temp || pI830->monitorSwitch != pI830->toggleDevices) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Hotkey switch to 0x%lx.\n", (unsigned long) temp); - - if (pI830->AccelInfoRec && pI830->AccelInfoRec->NeedToSync) { - (*pI830->AccelInfoRec->Sync)(pScrn); - pI830->AccelInfoRec->NeedToSync = FALSE; - if (xf86IsEntityShared(pScrn->entityList[0])) - pI8302->AccelInfoRec->NeedToSync = FALSE; - } + CARD8 gr18; - GetAttachableDisplayDeviceList(pScrn); - - pI8301->lastDevice0 = pI8301->lastDevice1; - pI8301->lastDevice1 = pI8301->lastDevice2; - pI8301->lastDevice2 = pI8301->monitorSwitch; - - if (temp != pI8301->lastDevice1 && - temp != pI8301->lastDevice2) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected three device configs.\n"); - } else - if (CountBits(temp & 0xff) > 1) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected cloned pipe mode (A).\n"); - if (xf86IsEntityShared(pScrn->entityList[0]) || pI830->Clone) - temp = pI8301->MonType2 << 8 | pI8301->MonType1; - } else - if (CountBits((temp & 0xff00) >> 8) > 1) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected cloned pipe mode (B).\n"); - if (xf86IsEntityShared(pScrn->entityList[0]) || pI830->Clone) - temp = pI8301->MonType2 << 8 | pI8301->MonType1; - } else - if (pI8301->lastDevice1 && pI8301->lastDevice2) { - if ( ((pI8301->lastDevice1 & 0xFF00) == 0) && - ((pI8301->lastDevice2 & 0x00FF) == 0) ) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected last devices (1).\n"); - cloned = 1; - } else if ( ((pI8301->lastDevice2 & 0xFF00) == 0) && - ((pI8301->lastDevice1 & 0x00FF) == 0) ) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected last devices (2).\n"); - cloned = 1; - } else - cloned = 0; - } - - if (cloned && - ((CountBits(pI8301->lastDevice1 & 0xff) > 1) || - ((CountBits((pI8301->lastDevice1 & 0xff00) >> 8) > 1))) ) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected duplicate (1).\n"); - cloned = 0; - } else - if (cloned && - ((CountBits(pI8301->lastDevice2 & 0xff) > 1) || - ((CountBits((pI8301->lastDevice2 & 0xff00) >> 8) > 1))) ) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected duplicate (2).\n"); - cloned = 0; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Requested display devices 0x%lx.\n", - (unsigned long) temp); - - - /* If the BIOS doesn't flip between CRT, LFP and CRT+LFP we fake - * it here as it seems some just flip between CRT and LFP. Ugh! - * - * So this pushes them onto Pipe B and clones the displays, which - * is what most BIOS' should be doing. - * - * Cloned pipe mode should only be done when running single head. - */ - if (xf86IsEntityShared(pScrn->entityList[0])) { - cloned = 0; - - /* Some BIOS' don't realize we may be in true dual head mode. - * And only display the primary output on both when switching. - * We detect this here and cycle back to both pipes. - */ - if ((pI830->lastDevice0 == temp) && - ((CountBits(pI8301->lastDevice2 & 0xff) > 1) || - ((CountBits((pI8301->lastDevice2 & 0xff00) >> 8) > 1))) ) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected cloned pipe mode when dual head on previous switch. (0x%x -> 0x%x)\n", (int)temp, pI8301->MonType2 << 8 | pI8301->MonType1); - temp = pI8301->MonType2 << 8 | pI8301->MonType1; - } - - } - - if (cloned) { - if (pI830->Clone) - temp = pI8301->MonType2 << 8 | pI8301->MonType1; - else if (pI8301->lastDevice1 & 0xFF) - temp = pI8301->lastDevice1 << 8 | pI8301->lastDevice2; - else - temp = pI8301->lastDevice2 << 8 | pI8301->lastDevice1; - } - - /* Jump to our next mode if we detect we've been here before */ - if (temp == pI8301->lastDevice1 || temp == pI8301->lastDevice2) { - temp = GetToggleList(pScrn, 1); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected duplicate devices. Toggling (0x%lx)\n", - (unsigned long) temp); - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected display change operation (0x%x, 0x%x, 0x%lx).\n", - pI8301->lastDevice1, pI8301->lastDevice2, - (unsigned long) temp); - - /* So that if we close on the wrong config, we restore correctly */ - pI830->specifiedMonitor = TRUE; - - if (!xf86IsEntityShared(pScrn->entityList[0])) { - if ((temp & 0xFF00) && (temp & 0x00FF)) { - pI830->Clone = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting Clone mode\n"); - } else { - pI830->Clone = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clearing Clone mode\n"); - } - } - - { - /* Turn Cursor off before switching */ - Bool on = pI830->cursorOn; - if (pI830->CursorInfoRec && pI830->CursorInfoRec->HideCursor) - pI830->CursorInfoRec->HideCursor(pScrn); - pI830->cursorOn = on; - } - - /* double check the display devices are what's configured and try - * not to do it twice because of dual heads with the code above */ - if (!SetDisplayDevices(pScrn, temp)) { - if ( cloned && - ((CountBits(temp & 0xff) > 1) || - (CountBits((temp & 0xff00) >> 8) > 1)) ) { - temp = pI8301->lastDevice2 | pI8301->lastDevice1; - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Cloning failed, " - "trying dual pipe clone mode (0x%lx)\n", - (unsigned long) temp); - if (!SetDisplayDevices(pScrn, temp)) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Failed to switch " - "to configured display devices (0x%lx).\n", - (unsigned long) temp); - else { - pI830->Clone = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting Clone mode\n"); - } - } - } - - pI8301->monitorSwitch = temp; - pI8301->operatingDevices = temp; - pI8301->toggleDevices = temp; - - if (xf86IsEntityShared(pScrn->entityList[0])) { - pI8302->operatingDevices = pI8301->operatingDevices; - pI8302->monitorSwitch = pI8301->monitorSwitch; - pI8302->toggleDevices = pI8301->toggleDevices; - } - - fixup = 1; + if (!pScrn->vtSema) + return 1000; #if 0 - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "ACPI _DGS queried devices is 0x%x, but probed is 0x%x monitorSwitch=0x%x\n", - pI830->toggleDevices, INREG(SWF0), pI830->monitorSwitch); + i830MonitorDetectDebugger(pScrn); #endif - } else { - int offset = -1; - if (I830IsPrimary(pScrn)) - offset = pI8301->FrontBuffer.Start + ((pScrn->frameY0 * pI830->displayWidth + pScrn->frameX0) * pI830->cpp); - else { - offset = pI8301->FrontBuffer2.Start + ((pScrn->frameY0 * pI830->displayWidth + pScrn->frameX0) * pI830->cpp); - } - if (IS_I96X(pI830)) { - if (pI830->pipe == 0) - adjust = INREG(DSPASURF); - else - adjust = INREG(DSPBSURF); - } else { - if (pI830->pipe == 0) - adjust = INREG(DSPABASE); - else - adjust = INREG(DSPBBASE); - } + /* Check for a hotkey press report from the BIOS. */ + gr18 = pI830->readControl(pI830, GRX, 0x18); + if ((gr18 & (HOTKEY_TOGGLE | HOTKEY_SWITCH)) != 0) { + /* The user has pressed the hotkey requesting a toggle or switch. + * Re-probe our connected displays and turn on whatever we find. + * + * In the future, we want the hotkey to dump down to a user app which + * implements a sensible policy using RandR-1.2. For now, all we get + * is this. + */ + + xf86ProbeOutputModes (pScrn, 0, 0); + xf86SetScrnInfoModes (pScrn); + xf86DiDGAReInit (pScrn->pScreen); + xf86SwitchMode(pScrn->pScreen, pScrn->currentMode); - if (adjust != offset) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Fixing display offsets.\n"); + /* Clear the BIOS's hotkey press flags */ + gr18 &= ~(HOTKEY_TOGGLE | HOTKEY_SWITCH); + pI830->writeControl(pI830, GRX, 0x18, gr18); + } - I830AdjustFrame(pScrn->pScreen->myNum, pScrn->frameX0, pScrn->frameY0, 0); - } - } + return 1000; +} - if (fixup) { - ScreenPtr pCursorScreen; - int x = 0, y = 0; +void +i830WaitSync(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); - pCursorScreen = miPointerCurrentScreen(); - if (pScrn->pScreen == pCursorScreen) - miPointerPosition(&x, &y); +#ifdef I830_USE_XAA + if (!pI830->noAccel && !pI830->useEXA && pI830->AccelInfoRec + && pI830->AccelInfoRec->NeedToSync) { + (*pI830->AccelInfoRec->Sync)(pScrn); + pI830->AccelInfoRec->NeedToSync = FALSE; + } +#endif +#ifdef I830_USE_EXA + if (!pI830->noAccel && pI830->useEXA && pI830->EXADriverPtr) { + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + exaWaitSync(pScreen); + } +#endif +} - /* Now, when we're single head, make sure we switch pipes */ - if (!(xf86IsEntityShared(pScrn->entityList[0]) || pI830->Clone) || cloned) { - if (temp & 0xFF00) - pI830->pipe = 1; - else - pI830->pipe = 0; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Primary pipe is now %s.\n", pI830->pipe ? "B" : "A"); - } - - pI830->currentMode = NULL; - I830BIOSSwitchMode(pScrn->pScreen->myNum, pScrn->currentMode, 0); - I830AdjustFrame(pScrn->pScreen->myNum, pScrn->frameX0, pScrn->frameY0, 0); - - if (xf86IsEntityShared(pScrn->entityList[0])) { - ScrnInfoPtr pScrn2; - I830Ptr pI8302; - - if (I830IsPrimary(pScrn)) { - pScrn2 = pI830->entityPrivate->pScrn_2; - pI8302 = I830PTR(pI830->entityPrivate->pScrn_2); - } else { - pScrn2 = pI830->entityPrivate->pScrn_1; - pI8302 = I830PTR(pI830->entityPrivate->pScrn_1); - } - - if (pScrn2->pScreen == pCursorScreen) - miPointerPosition(&x, &y); - - pI8302->currentMode = NULL; - I830BIOSSwitchMode(pScrn2->pScreen->myNum, pScrn2->currentMode, 0); - I830AdjustFrame(pScrn2->pScreen->myNum, pScrn2->frameX0, pScrn2->frameY0, 0); - - (*pScrn2->EnableDisableFBAccess) (pScrn2->pScreen->myNum, FALSE); - (*pScrn2->EnableDisableFBAccess) (pScrn2->pScreen->myNum, TRUE); - - if (pScrn2->pScreen == pCursorScreen) { - int sigstate = xf86BlockSIGIO (); - miPointerWarpCursor(pScrn2->pScreen,x,y); - - /* xf86Info.currentScreen = pScrn->pScreen; */ - xf86UnblockSIGIO (sigstate); - if (pI8302->CursorInfoRec && !pI8302->SWCursor && pI8302->cursorOn) { - pI8302->CursorInfoRec->HideCursor(pScrn); - xf86SetCursor(pScrn2->pScreen, pI830->pCurs, x, y); - pI8302->CursorInfoRec->ShowCursor(pScrn); - pI8302->cursorOn = TRUE; - } - } - } +void +i830MarkSync(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); - (*pScrn->EnableDisableFBAccess) (pScrn->pScreen->myNum, FALSE); - (*pScrn->EnableDisableFBAccess) (pScrn->pScreen->myNum, TRUE); - - if (pScrn->pScreen == pCursorScreen) { - int sigstate = xf86BlockSIGIO (); - miPointerWarpCursor(pScrn->pScreen,x,y); - - /* xf86Info.currentScreen = pScrn->pScreen; */ - xf86UnblockSIGIO (sigstate); - if (pI830->CursorInfoRec && !pI830->SWCursor && pI830->cursorOn) { - pI830->CursorInfoRec->HideCursor(pScrn); - xf86SetCursor(pScrn->pScreen, pI830->pCurs, x, y); - pI830->CursorInfoRec->ShowCursor(pScrn); - pI830->cursorOn = TRUE; - } - } - } +#ifdef I830_USE_XAA + if (!pI830->useEXA && pI830->AccelInfoRec) + pI830->AccelInfoRec->NeedToSync = TRUE; +#endif +#ifdef I830_USE_EXA + if (pI830->useEXA && pI830->EXADriverPtr) { + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + exaMarkSync(pScreen); } - - - return 1000; +#endif } void I830InitpScrn(ScrnInfoPtr pScrn) { - pScrn->PreInit = I830BIOSPreInit; - pScrn->ScreenInit = I830BIOSScreenInit; - pScrn->SwitchMode = I830BIOSSwitchMode; - pScrn->AdjustFrame = I830AdjustFrame; - pScrn->EnterVT = I830BIOSEnterVT; - pScrn->LeaveVT = I830BIOSLeaveVT; - pScrn->FreeScreen = I830BIOSFreeScreen; + pScrn->PreInit = I830PreInit; + pScrn->ScreenInit = I830ScreenInit; + pScrn->SwitchMode = I830SwitchMode; + pScrn->AdjustFrame = i830AdjustFrame; + pScrn->EnterVT = I830EnterVT; + pScrn->LeaveVT = I830LeaveVT; + pScrn->FreeScreen = I830FreeScreen; pScrn->ValidMode = I830ValidMode; pScrn->PMEvent = I830PMEvent; } diff --git a/driver/xf86-video-intel/src/i830_memory.c b/driver/xf86-video-intel/src/i830_memory.c index d1c670670..3379b66f4 100644 --- a/driver/xf86-video-intel/src/i830_memory.c +++ b/driver/xf86-video-intel/src/i830_memory.c @@ -50,11 +50,57 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Alan Hourihane <alanh@tungstengraphics.com> */ +/** + * @file i830_memory.c + * + * This is the video memory allocator. Our memory allocation is different from + * other graphics chips, where you have a fixed amount of graphics memory + * available that you want to put to the best use. Instead, we have almost no + * memory pre-allocated, and we have to choose an appropriate amount of sytem + * memory to use. + * + * The allocations we might do: + * + * - Ring buffer + * - HW cursor block (either one block or four) + * - Overlay registers + * - XAA linear allocator (optional) + * - EXA 965 state buffer + * - XAA scratch (screen 1) + * - XAA scratch (screen 2, only in zaphod mode) + * - Front buffer (screen 1, more is better for XAA) + * - Front buffer (screen 2, only in zaphod mode, more is better for XAA) + * - Back/depth buffer (3D only) + * - Compatibility texture pool (optional, more is always better) + * - New texture pool (optional, more is always better. aperture allocation + * only) + * - EXA offscreen pool (more is always better) + * + * We also want to be able to resize the front/back/depth buffers, and then + * resize the EXA and texture memory pools appropriately. + * + * The user may request a specific amount of memory to be used + * (pI830->pEnt->videoRam != 0), in which case allocations have to fit within + * that much aperture. If not, the individual allocations will be + * automatically sized, and will be fit within the maximum aperture size. + * Only the actual memory used (not alignment padding) will get actual AGP + * memory allocated. + * + * Given that the allocations listed are generally a page or more than a page, + * our allocator will only return page-aligned offsets, simplifying the memory + * binding process. For smaller allocations, the acceleration architecture's + * linear allocator is preferred. + */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include <assert.h> #include <string.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/mman.h> #include "xf86.h" #include "xf86_OSproc.h" @@ -62,1983 +108,1888 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "i830.h" #include "i810_reg.h" -static int nextTile = 0; -static unsigned int tileGeneration = -1; +#define ALIGN(i,m) (((i) + (m) - 1) & ~((m) - 1)) -#ifndef ALLOCATE_ALL_BIOSMEM -#define ALLOCATE_ALL_BIOSMEM 1 -#endif +/* Our hardware status area is just a single page */ +#define HWSTATUS_PAGE_SIZE GTT_PAGE_SIZE + +static i830_memory * +i830_allocate_aperture(ScrnInfoPtr pScrn, const char *name, + long size, unsigned long alignment, int flags); +static int i830_set_tiling(ScrnInfoPtr pScrn, unsigned int offset, + unsigned int pitch, unsigned int size, + enum tile_format tile_format); + +static void i830_clear_tiling(ScrnInfoPtr pScrn, unsigned int fence_nr); + +/** + * Returns the fence size for a tiled area of the given size. + */ static unsigned long -GetBestTileAlignment(unsigned long size) +i830_get_fence_size(ScrnInfoPtr pScrn, unsigned long size) +{ + I830Ptr pI830 = I830PTR(pScrn); + unsigned long i; + unsigned long start; + + if (IS_I965G(pI830)) { + /* The 965 can have fences at any page boundary. */ + return ALIGN(size, GTT_PAGE_SIZE); + } else { + /* Align the size to a power of two greater than the smallest fence + * size. + */ + if (IS_I9XX(pI830)) + start = MB(1); + else + start = KB(512); + + for (i = start; i < size; i <<= 1) + ; + + return i; + } +} + +static Bool +i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem) { - unsigned long i; + I830Ptr pI830 = I830PTR(pScrn); + + if (mem == NULL || mem->bound) + return TRUE; + +#ifdef XF86DRI_MM + if (mem->bo.size != 0) { + I830Ptr pI830 = I830PTR(pScrn); + int ret; + + ret = drmBOSetStatus(pI830->drmSubFD, &mem->bo, + DRM_BO_FLAG_MEM_VRAM | + DRM_BO_FLAG_MEM_TT | + DRM_BO_FLAG_READ | + DRM_BO_FLAG_WRITE | + DRM_BO_FLAG_NO_EVICT, + DRM_BO_MASK_MEM | + DRM_BO_FLAG_READ | + DRM_BO_FLAG_WRITE | + DRM_BO_FLAG_NO_EVICT, + 0, 0, 0); + if (ret != 0) + return FALSE; + + mem->bound = TRUE; + mem->offset = mem->bo.offset; + mem->end = mem->bo.offset + mem->size; + } +#endif + + if (!mem->bound) { + if (!pI830->gtt_acquired) + return TRUE; + + if (mem->key != -1 && + !xf86BindGARTMemory(pScrn->scrnIndex, mem->key, mem->agp_offset)) + { + return FALSE; + } + + mem->bound = TRUE; + } - for (i = KB(512); i < size; i <<= 1) - ; + if (mem->tiling != TILE_NONE) { + mem->fence_nr = i830_set_tiling(pScrn, mem->offset, mem->pitch, + mem->allocated_size, mem->tiling); + } - if (i > MB(64)) - i = MB(64); + /* Mark the pages accessible now that they're bound. */ + if (mprotect(pI830->FbBase + mem->offset, ALIGN(mem->size, GTT_PAGE_SIZE), + PROT_READ | PROT_WRITE) != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to mprotect %s: %s\n", mem->name, strerror(errno)); + } - return i; + return TRUE; } -/* - * Allocate memory from the given pool. Grow the pool if needed and if - * possible. +static Bool +i830_unbind_memory(ScrnInfoPtr pScrn, i830_memory *mem) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (mem == NULL || !mem->bound) + return TRUE; + + /* Mark the pages accessible now that they're bound. */ + if (mprotect(pI830->FbBase + mem->offset, ALIGN(mem->size, GTT_PAGE_SIZE), + PROT_NONE) != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to mprotect %s: %s\n", mem->name, strerror(errno)); + } + + if (mem->tiling != TILE_NONE) + i830_clear_tiling(pScrn, mem->fence_nr); + +#ifdef XF86DRI_MM + if (mem->bo.size != 0) { + I830Ptr pI830 = I830PTR(pScrn); + int ret; + + ret = drmBOSetStatus(pI830->drmSubFD, &mem->bo, + 0, DRM_BO_FLAG_NO_EVICT, + 0, 0, 0); + + if (ret == 0) { + mem->bound = FALSE; + /* Give buffer obviously wrong offset/end until it's re-pinned. */ + mem->offset = -1; + mem->end = -1; + return TRUE; + } else { + return FALSE; + } + } +#endif + + if (mem->key == -1 || xf86UnbindGARTMemory(pScrn->scrnIndex, mem->key)) { + mem->bound = FALSE; + return TRUE; + } else { + return FALSE; + } +} + +void +i830_free_memory(ScrnInfoPtr pScrn, i830_memory *mem) +{ + if (mem == NULL) + return; + + /* Free any AGP memory. */ + i830_unbind_memory(pScrn, mem); + +#ifdef XF86DRI_MM + if (mem->bo.size != 0) { + I830Ptr pI830 = I830PTR(pScrn); + + drmBOUnreference(pI830->drmSubFD, &mem->bo); + if (pI830->bo_list == mem) + pI830->bo_list = mem->next; + if (mem->next) + mem->next->prev = NULL; + if (mem->prev) + mem->prev->next = NULL; + xfree(mem->name); + xfree(mem); + return; + } +#endif + /* Disconnect from the list of allocations */ + if (mem->prev != NULL) + mem->prev->next = mem->next; + if (mem->next != NULL) + mem->next->prev = mem->prev; + + if (mem->key != -1) { + xf86DeallocateGARTMemory(pScrn->scrnIndex, mem->key); + mem->key = -1; + } + + xfree(mem->name); + xfree(mem); +} + +/* Resets the state of the aperture allocator, freeing all memory that had + * been allocated. */ -static unsigned long -AllocFromPool(ScrnInfoPtr pScrn, I830MemRange *result, I830MemPool *pool, - long size, unsigned long alignment, int flags) +void +i830_reset_allocations(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); - long needed, start, end; - Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); - - if (!result || !pool || !size) - return 0; - - /* Calculate how much space is needed. */ - if (alignment <= GTT_PAGE_SIZE) - needed = size; - else { - if (flags & ALLOCATE_AT_BOTTOM) { - start = ROUND_TO(pool->Free.Start, alignment); - if (flags & ALIGN_BOTH_ENDS) - end = ROUND_TO(start + size, alignment); - else - end = start + size; - needed = end - pool->Free.Start; - } else { /* allocate at top */ - if (flags & ALIGN_BOTH_ENDS) - end = ROUND_DOWN_TO(pool->Free.End, alignment); - else - end = pool->Free.End; - - start = ROUND_DOWN_TO(end - size, alignment); - needed = end - start; - } - } - if (needed > pool->Free.Size) { - long extra; - /* See if the pool can be grown. */ - if (pI830->StolenOnly && !dryrun) - return 0; - extra = needed - pool->Free.Size; - extra = ROUND_TO_PAGE(extra); - if (extra > pI830->FreeMemory) { - if (dryrun) - pI830->FreeMemory = extra; - else - return 0; - } - - if (!dryrun && ((long)extra > pI830->MemoryAperture.Size)) - return 0; - - pool->Free.Size += extra; - pool->Free.End += extra; - pool->Total.Size += extra; - pool->Total.End += extra; - pI830->FreeMemory -= extra; - pI830->MemoryAperture.Start += extra; - pI830->MemoryAperture.Size -= extra; - } - if (flags & ALLOCATE_AT_BOTTOM) { - result->Start = ROUND_TO(pool->Free.Start, alignment); - pool->Free.Start += needed; - result->End = pool->Free.Start; - } else { - result->Start = ROUND_DOWN_TO(pool->Free.End - size, alignment); - pool->Free.End -= needed; - result->End = result->Start + needed; - } - pool->Free.Size = pool->Free.End - pool->Free.Start; - result->Size = result->End - result->Start; - result->Pool = pool; - result->Alignment = alignment; - return needed; + I830Ptr pI830 = I830PTR(pScrn); + int p; + + /* While there is any memory between the start and end markers, free it. */ + while (pI830->memory_list->next->next != NULL) { + i830_memory *mem = pI830->memory_list->next; + +#ifdef XF86DRI + /* Don't reset BO allocator, which we set up at init. */ + if (pI830->memory_manager == mem) { + mem = mem->next; + if (mem->next == NULL) + break; + } +#endif + + i830_free_memory(pScrn, mem); + } + + /* Free any allocations in buffer objects */ +#ifdef XF86DRI_MM + if (pI830->memory_manager) { + while (pI830->bo_list != NULL) + i830_free_memory(pScrn, pI830->bo_list); + } +#endif + + /* Null out the pointers for all the allocations we just freed. This is + * kind of gross, but at least it's just one place now. + */ + pI830->cursor_mem = NULL; + for (p = 0; p < 2; p++) { + pI830->cursor_mem_classic[p] = NULL; + pI830->cursor_mem_argb[p] = NULL; + } + pI830->front_buffer = NULL; + pI830->front_buffer_2 = NULL; + pI830->xaa_scratch = NULL; + pI830->xaa_scratch_2 = NULL; + pI830->exa_offscreen = NULL; + pI830->exa_965_state = NULL; + pI830->overlay_regs = NULL; + pI830->logical_context = NULL; +#ifdef XF86DRI + pI830->back_buffer = NULL; + pI830->third_buffer = NULL; + pI830->depth_buffer = NULL; + pI830->textures = NULL; +#endif + pI830->LpRing->mem = NULL; } -static unsigned long -AllocFromAGP(ScrnInfoPtr pScrn, I830MemRange *result, long size, - unsigned long alignment, int flags) +void +i830_free_3d_memory(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); - unsigned long start, end; - unsigned long newApStart, newApEnd; - Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); - - if (!result || !size) - return 0; - - if ((flags & ALLOCATE_AT_BOTTOM) && pI830->StolenMemory.Size != 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "AllocFromAGP(): can't allocate from " - "bottom when there is stolen memory\n"); - return 0; - } - - if (size > pI830->FreeMemory) { - if (dryrun) - pI830->FreeMemory = size; - else - return 0; - } - - /* Calculate offset */ - if (flags & ALLOCATE_AT_BOTTOM) { - start = ROUND_TO(pI830->MemoryAperture.Start, alignment); - if (flags & ALIGN_BOTH_ENDS) - end = ROUND_TO(start + size, alignment); - else - end = start + size; - newApStart = end; - newApEnd = pI830->MemoryAperture.End; - } else { - if (flags & ALIGN_BOTH_ENDS) - end = ROUND_DOWN_TO(pI830->MemoryAperture.End, alignment); - else - end = pI830->MemoryAperture.End; - start = ROUND_DOWN_TO(end - size, alignment); - newApStart = pI830->MemoryAperture.Start; - newApEnd = start; - } - - if (!dryrun) { - if (newApStart > newApEnd) - return 0; - - if (flags & NEED_PHYSICAL_ADDR) - result->Key = xf86AllocateGARTMemory(pScrn->scrnIndex, size, 2, - &(result->Physical)); - else - result->Key = xf86AllocateGARTMemory(pScrn->scrnIndex, size, 0, NULL); - - if (result->Key == -1) - return 0; - } - - pI830->allocatedMemory += size; - pI830->MemoryAperture.Start = newApStart; - pI830->MemoryAperture.End = newApEnd; - pI830->MemoryAperture.Size = newApEnd - newApStart; - pI830->FreeMemory -= size; - result->Start = start; - result->End = start + size; - result->Size = size; - result->Offset = start; - result->Alignment = alignment; - result->Pool = NULL; - - return size; + I830Ptr pI830 = I830PTR(pScrn); + +#ifdef XF86DRI + i830_free_memory(pScrn, pI830->back_buffer); + pI830->back_buffer = NULL; + i830_free_memory(pScrn, pI830->third_buffer); + pI830->third_buffer = NULL; + i830_free_memory(pScrn, pI830->depth_buffer); + pI830->depth_buffer = NULL; + i830_free_memory(pScrn, pI830->textures); + pI830->textures = NULL; +#endif +} + +/** + * Initialize's the driver's video memory allocator to allocate in the + * given range. + * + * This sets up the kernel memory manager to manage as much of the memory + * as we think it can, while leaving enough to us to fulfill our non-TTM + * static allocations. Some of these exist because of the need for physical + * addresses to reference. + */ +Bool +i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size) +{ + I830Ptr pI830 = I830PTR(pScrn); + i830_memory *start, *end; +#ifdef XF86DRI_MM + int dri_major, dri_minor, dri_patch; +#endif + + start = xcalloc(1, sizeof(*start)); + if (start == NULL) + return FALSE; + start->name = xstrdup("start marker"); + if (start->name == NULL) { + xfree(start); + return FALSE; + } + end = xcalloc(1, sizeof(*end)); + if (end == NULL) { + xfree(start->name); + xfree(start); + return FALSE; + } + end->name = xstrdup("end marker"); + if (end->name == NULL) { + xfree(start->name); + xfree(start); + xfree(end); + return FALSE; + } + + start->key = -1; + start->offset = offset; + start->end = start->offset; + start->size = 0; + start->next = end; + end->key = -1; + end->offset = offset + size; + end->end = end->offset; + end->size = 0; + end->prev = start; + + pI830->memory_list = start; + +#ifdef XF86DRI_MM + DRIQueryVersion(&dri_major, &dri_minor, &dri_patch); + + /* Now that we have our manager set up, initialize the kernel MM if + * possible, covering almost all of the aperture. We need libdri interface + * 5.4 or newer so we can rely on the lock being held after DRIScreenInit, + * rather than after DRIFinishScreenInit. + */ + if (pI830->directRenderingEnabled && pI830->drmMinor >= 7 && + (dri_major > 5 || (dri_major == 5 && dri_minor >= 4))) + { + int mmsize; + + /* Take over all of the graphics aperture minus enough to for + * physical-address allocations of cursor/overlay registers. + */ + mmsize = size; + + /* EXA area is fixed. */ + if (pI830->useEXA) { + mmsize -= ROUND_TO_PAGE(3 * pScrn->displayWidth * pI830->cpp * + pScrn->virtualY); + } + /* Classic textures are fixed. */ + if (pI830->allocate_classic_textures) + mmsize -= MB(32); + /* Overlay and cursors, if physical, need to be allocated outside + * of the kernel memory manager. + */ + if (!OVERLAY_NOPHYSICAL(pI830) && !IS_I965G(pI830)) { + mmsize -= ROUND_TO(OVERLAY_SIZE, GTT_PAGE_SIZE); + } + if (pI830->CursorNeedsPhysical) { + mmsize -= 2 * (ROUND_TO(HWCURSOR_SIZE, GTT_PAGE_SIZE) + + ROUND_TO(HWCURSOR_SIZE_ARGB, GTT_PAGE_SIZE)); + } + if (pI830->fb_compression) + mmsize -= MB(6); + /* Can't do TTM on stolen memory */ + mmsize -= pI830->stolen_size; + + /* Create the aperture allocation */ + pI830->memory_manager = + i830_allocate_aperture(pScrn, "DRI memory manager", + mmsize, GTT_PAGE_SIZE, + ALIGN_BOTH_ENDS | NEED_NON_STOLEN); + + if (pI830->memory_manager != NULL) { + int ret; + + /* Tell the kernel to manage it */ + ret = drmMMInit(pI830->drmSubFD, + pI830->memory_manager->offset / GTT_PAGE_SIZE, + pI830->memory_manager->size / GTT_PAGE_SIZE, + DRM_BO_MEM_TT); + if (ret != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to initialize kernel memory manager\n"); + i830_free_memory(pScrn, pI830->memory_manager); + pI830->memory_manager = NULL; + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate space for kernel memory manager\n"); + i830_free_memory(pScrn, pI830->memory_manager); + pI830->memory_manager = NULL; + } + } +#endif /* XF86DRI_MM */ + + return TRUE; } void -I830FreeVidMem(ScrnInfoPtr pScrn, I830MemRange *range) +i830_allocator_fini(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); - - if (!range || range->Size == 0) - return; - - if (range->Key != -1) - xf86DeallocateGARTMemory(pScrn->scrnIndex, range->Key); - - if (range->Pool) { - /* - * This code essentially resets what I830DoPoolAllocation() did. - * And if things are freed in the wrong order this can break wildly! - * USE CAUTION when changing anything here... - */ - I830MemPool *Pool = range->Pool; - if (pI830->overrideBIOSMemSize && - pI830->BIOSMemorySize > pI830->StolenMemory.Size) - Pool->Total.End = pI830->BIOSMemorySize; - else - Pool->Total.End = pI830->StolenMemory.End; - - if (pI830->StolenOnly) - Pool->Free.End += range->Size; - else - Pool->Free.End = Pool->Total.End; - - if (Pool->Free.End < Pool->Free.Start) { - Pool->Free.End = Pool->Free.Start; - } - - Pool->Free.Size = Pool->Free.End - Pool->Free.Start; - Pool->Total.Size = Pool->Total.End - Pool->Total.Start; - - if (!pI830->StolenOnly) { - pI830->FreeMemory -= Pool->Free.Size; - pI830->MemoryAperture.Start -= (range->Size - Pool->Free.Size); - pI830->MemoryAperture.Size += (range->Size - Pool->Free.Size); - } - } else { - if (range->Alignment == GTT_PAGE_SIZE) - pI830->MemoryAperture.End = range->End; - else - pI830->MemoryAperture.End = range->End - range->Size + range->Alignment; - pI830->MemoryAperture.Size = pI830->MemoryAperture.End - pI830->MemoryAperture.Start; - } - - if (!pI830->StolenOnly) - pI830->FreeMemory += range->Size; - pI830->allocatedMemory -= range->Size; + I830Ptr pI830 = I830PTR(pScrn); + + /* Free most of the allocations */ + i830_reset_allocations(pScrn); + +#ifdef XF86DRI_MM + /* The memory manager is more special */ + if (pI830->memory_manager) { + drmMMTakedown(pI830->drmSubFD, DRM_BO_MEM_TT); + i830_free_memory(pScrn, pI830->memory_manager); + pI830->memory_manager = NULL; + } +#endif /* XF86DRI_MM */ + + /* Free the start/end markers */ + free(pI830->memory_list->next); + free(pI830->memory_list); + pI830->memory_list = NULL; } -unsigned long -I830AllocVidMem(ScrnInfoPtr pScrn, I830MemRange *result, I830MemPool *pool, - long size, unsigned long alignment, int flags) +/** + * Reads a GTT entry for the memory at the given offset and returns the + * physical address. + * + * \return physical address if successful. + * \return (uint64_t)-1 if unsuccessful. + */ +static uint64_t +i830_get_gtt_physical(ScrnInfoPtr pScrn, unsigned long offset) { - I830Ptr pI830 = I830PTR(pScrn); - Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); - - if (!result) - return 0; - - /* Make sure these are initialised. */ - result->Size = 0; - result->Key = -1; - - if (!size) { - return 0; - } - - switch (flags & FROM_MASK) { - case FROM_POOL_ONLY: - return AllocFromPool(pScrn, result, pool, size, alignment, flags); - case FROM_NEW_ONLY: - if (!dryrun && (pI830->StolenOnly || (pI830->FreeMemory <= 0))) - return 0; - return AllocFromAGP(pScrn, result, size, alignment, flags); - case FROM_ANYWHERE: - if ((!(flags & ALLOCATE_AT_BOTTOM) && (pI830->FreeMemory >= size)) || - (flags & NEED_PHYSICAL_ADDR)) - return AllocFromAGP(pScrn, result, size, alignment, flags); - else - return AllocFromPool(pScrn, result, pool, size, alignment, flags); - default: - /* Shouldn't happen. */ - return 0; - } + I830Ptr pI830 = I830PTR(pScrn); + CARD32 gttentry; + + /* We don't have GTTBase set up on i830 yet. */ + if (pI830->GTTBase == NULL) + return -1; + + gttentry = INGTT(offset / 1024); + + /* Mask out these reserved bits on this hardware. */ + if (!IS_I9XX(pI830) || IS_I915G(pI830) || IS_I915GM(pI830) || + IS_I945G(pI830) || IS_I945GM(pI830)) + { + gttentry &= ~PTE_ADDRESS_MASK_HIGH; + } + + /* If it's not a mapping type we know, then bail. */ + if ((gttentry & PTE_MAPPING_TYPE_MASK) != PTE_MAPPING_TYPE_UNCACHED && + (gttentry & PTE_MAPPING_TYPE_MASK) != PTE_MAPPING_TYPE_CACHED) + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Unusable physical mapping type 0x%08x\n", + (unsigned int)(gttentry & PTE_MAPPING_TYPE_MASK)); + return -1; + } + assert((gttentry & PTE_VALID) != 0); + + return (gttentry & PTE_ADDRESS_MASK) | + ((uint64_t)(gttentry & PTE_ADDRESS_MASK_HIGH) << (32 - 4)); } -static Bool -AllocateRingBuffer(ScrnInfoPtr pScrn, int flags) +/** + * Reads the GTT entries for stolen memory at the given offset, returning the + * physical address. + * + * \return physical address if successful. + * \return (uint64_t)-1 if unsuccessful. + */ +static uint64_t +i830_get_stolen_physical(ScrnInfoPtr pScrn, unsigned long offset, + unsigned long size) { - I830Ptr pI830 = I830PTR(pScrn); - unsigned long size, alloced; - Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); - int verbosity = dryrun ? 4 : 1; - const char *s = dryrun ? "[dryrun] " : ""; - - /* Clear ring buffer info */ - memset(pI830->LpRing, 0, sizeof(I830RingBuffer)); - pI830->LpRing->mem.Key = -1; - - if (pI830->noAccel) - return TRUE; - - /* Ring buffer */ - size = PRIMARY_RINGBUFFER_SIZE; - if (flags & FORCE_LOW) - flags |= FROM_POOL_ONLY | ALLOCATE_AT_BOTTOM; - else - flags |= FROM_ANYWHERE | ALLOCATE_AT_TOP; - - alloced = I830AllocVidMem(pScrn, &(pI830->LpRing->mem), - &(pI830->StolenPool), size, - GTT_PAGE_SIZE, flags); - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate Ring Buffer space\n"); - } - return FALSE; - } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for the ring buffer at 0x%lx\n", s, - alloced / 1024, pI830->LpRing->mem.Start); - pI830->LpRing->tail_mask = pI830->LpRing->mem.Size - 1; - return TRUE; + I830Ptr pI830 = I830PTR(pScrn); + uint64_t physical; + unsigned long scan; + + /* Check that the requested region is within stolen memory. */ + if (offset + size >= pI830->stolen_size) + return -1; + + physical = i830_get_gtt_physical(pScrn, offset); + if (physical == -1) + return -1; + + /* Check that the following pages in our allocation follow the first page + * contiguously. + */ + for (scan = offset + 4096; scan < offset + size; scan += 4096) { + uint64_t scan_physical = i830_get_gtt_physical(pScrn, scan); + + if ((scan - offset) != (scan_physical - physical)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Non-contiguous GTT entries: (%ld,0x16%llx) vs " + "(%ld,0x%16llx)\n", + scan, scan_physical, offset, physical); + return -1; + } + } + + return physical; } -#ifdef I830_XV -/* - * Note, the FORCE_LOW flag is currently not used or supported. +/* Allocate aperture space for the given size and alignment, and returns the + * memory allocation. + * + * Allocations are a minimum of a page, and will be at least page-aligned. */ -static Bool -AllocateOverlay(ScrnInfoPtr pScrn, int flags) +static i830_memory * +i830_allocate_aperture(ScrnInfoPtr pScrn, const char *name, + long size, unsigned long alignment, int flags) { - I830Ptr pI830 = I830PTR(pScrn); - unsigned long size, alloced; - Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); - int verbosity = dryrun ? 4 : 1; - const char *s = dryrun ? "[dryrun] " : ""; - - /* Clear overlay info */ - memset(pI830->OverlayMem, 0, sizeof(I830MemRange)); - pI830->OverlayMem->Key = -1; - - if (!pI830->XvEnabled) - return TRUE; - - /* - * The overlay register space needs a physical address in - * system memory. We get this from the agpgart module using - * a special memory type. - */ - - size = OVERLAY_SIZE; - if (flags & FORCE_LOW) - flags |= FROM_POOL_ONLY | ALLOCATE_AT_BOTTOM | NEED_PHYSICAL_ADDR; - else - flags |= FROM_ANYWHERE | ALLOCATE_AT_TOP | NEED_PHYSICAL_ADDR; - - alloced = I830AllocVidMem(pScrn, pI830->OverlayMem, - &(pI830->StolenPool), size, GTT_PAGE_SIZE, flags); - - /* - * XXX For testing only. Don't enable this unless you know how to set - * physBase. - */ - if (flags & FORCE_LOW) { - ErrorF("AllocateOverlay() doesn't support setting FORCE_LOW\n"); - return FALSE; - } - - if (!dryrun && (alloced < size)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate Overlay register space.\n"); - /* This failure isn't fatal. */ - } else { - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for Overlay registers at 0x%lx " - "(0x%08lx).\n", s, - alloced / 1024, pI830->OverlayMem->Start, - pI830->OverlayMem->Physical); - } - - /* Clear linearmem info */ - if (pI830->LinearAlloc) { - memset(&(pI830->LinearMem), 0, sizeof(I830MemRange)); - pI830->LinearMem.Key = -1; - - size = KB(pI830->LinearAlloc); - alloced = I830AllocVidMem(pScrn, &(pI830->LinearMem), &(pI830->StolenPool), - size, GTT_PAGE_SIZE, - FROM_ANYWHERE | ALLOCATE_AT_TOP); - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate linear buffer space\n"); - } - } else - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for the linear buffer at 0x%lx\n", s, - alloced / 1024, pI830->LinearMem.Start); - } - - return TRUE; + I830Ptr pI830 = I830PTR(pScrn); + i830_memory *mem, *scan; + + mem = xcalloc(1, sizeof(*mem)); + if (mem == NULL) + return NULL; + + /* No memory allocated to back the region */ + mem->key = -1; + + mem->name = xstrdup(name); + if (mem->name == NULL) { + xfree(mem); + return NULL; + } + /* Only allocate page-sized increments. */ + size = ALIGN(size, GTT_PAGE_SIZE); + mem->size = size; + mem->allocated_size = size; + + if (alignment < GTT_PAGE_SIZE) + alignment = GTT_PAGE_SIZE; + + for (scan = pI830->memory_list; scan->next != NULL; scan = scan->next) { + mem->offset = ROUND_TO(scan->end, alignment); + if ((flags & NEED_PHYSICAL_ADDR) && mem->offset < pI830->stolen_size) { + /* If the allocation is entirely within stolen memory, and we're + * able to get the physical addresses out of the GTT and check that + * it's contiguous (it ought to be), then we can do our physical + * allocations there and not bother the kernel about it. This + * helps avoid aperture fragmentation from our physical + * allocations. + */ + mem->bus_addr = i830_get_stolen_physical(pScrn, mem->offset, + mem->size); + + if (mem->bus_addr == ((uint64_t)-1)) { + /* Move the start of the allocation to just past the end of + * stolen memory. + */ + mem->offset = ROUND_TO(pI830->stolen_size, alignment); + } + } + if ((flags & NEED_NON_STOLEN) && mem->offset < pI830->stolen_size) { + mem->offset = ROUND_TO(pI830->stolen_size, alignment); + } + + mem->end = mem->offset + size; + if (flags & ALIGN_BOTH_ENDS) + mem->end = ROUND_TO(mem->end, alignment); + if (mem->end <= scan->next->offset) + break; + } + if (scan->next == NULL) { + /* Reached the end of the list, and didn't find space */ + xfree(mem->name); + xfree(mem); + return NULL; + } + /* Insert new allocation into the list */ + mem->prev = scan; + mem->next = scan->next; + scan->next = mem; + mem->next->prev = mem; + + return mem; } -#endif +/** + * Allocates the AGP memory necessary for the part of a memory allocation not + * already covered by the stolen memory. + * + * The memory is automatically bound if we have the VT. + */ static Bool -IsTileable(int pitch) +i830_allocate_agp_memory(ScrnInfoPtr pScrn, i830_memory *mem, int flags) { - /* - * Allow tiling for pitches that are a power of 2 multiple of 128 bytes, - * up to 64 * 128 (= 8192) bytes. - */ - switch (pitch) { - case 128 * 1: - case 128 * 2: - case 128 * 4: - case 128 * 8: - case 128 * 16: - case 128 * 32: - case 128 * 64: - return TRUE; - default: - return FALSE; - } + I830Ptr pI830 = I830PTR(pScrn); + unsigned long size; + + if (mem->key != -1) + return TRUE; + + if (mem->offset + mem->size <= pI830->stolen_size) + return TRUE; + + if (mem->offset < pI830->stolen_size) + mem->agp_offset = pI830->stolen_size; + else + mem->agp_offset = mem->offset; + + size = mem->size - (mem->agp_offset - mem->offset); + + if (flags & NEED_PHYSICAL_ADDR) { + unsigned long agp_bus_addr; + + mem->key = xf86AllocateGARTMemory(pScrn->scrnIndex, size, 2, + &agp_bus_addr); + mem->bus_addr = agp_bus_addr; + } else { + mem->key = xf86AllocateGARTMemory(pScrn->scrnIndex, size, 0, NULL); + } + if (mem->key == -1 || ((flags & NEED_PHYSICAL_ADDR) && mem->bus_addr == 0)) + { + return FALSE; + } + + if (!i830_bind_memory(pScrn, mem)) { + return FALSE; + } + + return TRUE; } -Bool -I830AllocateRotatedBuffer(ScrnInfoPtr pScrn, int flags) +#ifdef XF86DRI_MM +static i830_memory * +i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name, + unsigned long size, unsigned long align, int flags) { - I830Ptr pI830 = I830PTR(pScrn); - unsigned long size, alloced; - Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); - int verbosity = dryrun ? 4 : 1; - const char *s = dryrun ? "[dryrun] " : ""; - int align; - Bool tileable; - int lines; - int height = (pI830->rotation & (RR_Rotate_0 | RR_Rotate_180)) ? pScrn->virtualY : pScrn->virtualX; - - /* Rotated Buffer */ - memset(&(pI830->RotatedMem), 0, sizeof(I830MemRange)); - pI830->RotatedMem.Key = -1; - tileable = !(flags & ALLOC_NO_TILING) && - IsTileable(pScrn->displayWidth * pI830->cpp); - if (tileable) { - /* Make the height a multiple of the tile height (16) */ - lines = (height + 15) / 16 * 16; - } else { - lines = height; - } - - size = ROUND_TO_PAGE(pScrn->displayWidth * lines * pI830->cpp); - /* - * Try to allocate on the best tile-friendly boundaries. - */ - alloced = 0; - if (tileable) { - align = GetBestTileAlignment(size); - for (align = GetBestTileAlignment(size); align >= (IS_I9XX(pI830) ? MB(1) : KB(512)); align >>= 1) { - alloced = I830AllocVidMem(pScrn, &(pI830->RotatedMem), - &(pI830->StolenPool), size, align, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP | - ALIGN_BOTH_ENDS); - if (alloced >= size) - break; - } - } - if (alloced < size) { - /* Give up on trying to tile */ - tileable = FALSE; - size = ROUND_TO_PAGE(pScrn->displayWidth * height * pI830->cpp); - align = GTT_PAGE_SIZE; - alloced = I830AllocVidMem(pScrn, &(pI830->RotatedMem), - &(pI830->StolenPool), size, align, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); - } - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate rotated buffer space.\n"); - } - return FALSE; - } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for the rotated buffer at 0x%lx.\n", s, - alloced / 1024, pI830->RotatedMem.Start); - return TRUE; + I830Ptr pI830 = I830PTR(pScrn); + i830_memory *mem; + unsigned long mask; + int ret; + + assert((flags & NEED_PHYSICAL_ADDR) == 0); + + /* Only allocate page-sized increments. */ + size = ALIGN(size, GTT_PAGE_SIZE); + align = ROUND_TO(align, GTT_PAGE_SIZE); + + mem = xcalloc(1, sizeof(*mem)); + if (mem == NULL) + return NULL; + + mem->name = xstrdup(name); + if (name == NULL) { + xfree(mem); + return NULL; + } + + /* + * Create buffers in local memory to avoid having the creation order + * determine the TT offset. Driver acceleration + * cannot handle changed front buffer TT offsets yet , + * so let's keep our fingers crossed. + */ + + mask = DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE | + DRM_BO_FLAG_MEM_LOCAL; + if (flags & ALLOW_SHARING) + mask |= DRM_BO_FLAG_SHAREABLE; + + ret = drmBOCreate(pI830->drmSubFD, size, align / GTT_PAGE_SIZE, NULL, + mask, 0, &mem->bo); + if (ret) { + xfree(mem->name); + xfree(mem); + return NULL; + } + /* Give buffer obviously wrong offset/end until it's pinned. */ + mem->offset = -1; + mem->end = -1; + mem->size = size; + mem->allocated_size = size; + if (flags & NEED_LIFETIME_FIXED) + mem->lifetime_fixed_offset = TRUE; + + /* Bind it if we currently control the VT */ + if (pScrn->vtSema) { + if (!i830_bind_memory(pScrn, mem)) { + drmBOUnreference(pI830->drmSubFD, &mem->bo); + xfree(mem->name); + xfree(mem); + return NULL; + } + } + + /* Insert new allocation into the list */ + mem->prev = NULL; + mem->next = pI830->bo_list; + if (pI830->bo_list != NULL) + pI830->bo_list->prev = mem; + pI830->bo_list = mem; + + return mem; } +#endif /* XF86DRI_MM */ -Bool -I830AllocateRotated2Buffer(ScrnInfoPtr pScrn, int flags) +/* Allocates video memory at the given size and alignment. + * + * The memory will be bound automatically when the driver is in control of the + * VT. When the kernel memory manager is available and compatible with flags + * (that is, flags doesn't say that the allocation must include a physical + * address), that will be used for the allocation. + * + * flags: + * - NEED_PHYSICAL_ADDR: Allocates the memory physically contiguous, and return + * the bus address for that memory. + * - ALIGN_BOTH_ENDS: after choosing the alignment, align the end offset to + * @alignment as well. + * - NEED_NON-STOLEN: don't allow any part of the memory allocation to lie + * within stolen memory + * - NEED_LIFETIME_FIXED: don't allow the buffer object to move throughout + * the entire Screen lifetime. This means not using buffer objects, which + * get their offsets chosen at each EnterVT time. + */ +i830_memory * +i830_allocate_memory(ScrnInfoPtr pScrn, const char *name, + unsigned long size, unsigned long alignment, int flags) { - I830Ptr pI830 = I830PTR(pScrn); - unsigned long size, alloced; - Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); - int verbosity = dryrun ? 4 : 1; - const char *s = dryrun ? "[dryrun] " : ""; - int align; - Bool tileable; - int lines; - I830EntPtr pI830Ent = pI830->entityPrivate; - I830Ptr pI8302 = I830PTR(pI830Ent->pScrn_2); - int height = (pI8302->rotation & (RR_Rotate_0 | RR_Rotate_180)) ? pI830Ent->pScrn_2->virtualY : pI830Ent->pScrn_2->virtualX; - - /* Rotated Buffer */ - memset(&(pI830->RotatedMem2), 0, sizeof(I830MemRange)); - pI830->RotatedMem2.Key = -1; - tileable = !(flags & ALLOC_NO_TILING) && - IsTileable(pI830Ent->pScrn_2->displayWidth * pI8302->cpp); - if (tileable) { - /* Make the height a multiple of the tile height (16) */ - lines = (height + 15) / 16 * 16; - } else { - lines = height; - } - - size = ROUND_TO_PAGE(pI830Ent->pScrn_2->displayWidth * lines * pI8302->cpp); - /* - * Try to allocate on the best tile-friendly boundaries. - */ - alloced = 0; - if (tileable) { - align = GetBestTileAlignment(size); - for (align = GetBestTileAlignment(size); align >= (IS_I9XX(pI830) ? MB(1) : KB(512)); align >>= 1) { - alloced = I830AllocVidMem(pScrn, &(pI830->RotatedMem2), - &(pI830->StolenPool), size, align, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP | - ALIGN_BOTH_ENDS); - if (alloced >= size) - break; - } - } - if (alloced < size) { - /* Give up on trying to tile */ - tileable = FALSE; - size = ROUND_TO_PAGE(pI830Ent->pScrn_2->displayWidth * height * pI8302->cpp); - align = GTT_PAGE_SIZE; - alloced = I830AllocVidMem(pScrn, &(pI830->RotatedMem2), - &(pI830->StolenPool), size, align, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); - } - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate rotated2 buffer space.\n"); - } - return FALSE; - } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for the rotated2 buffer at 0x%lx.\n", s, - alloced / 1024, pI830->RotatedMem2.Start); - return TRUE; + i830_memory *mem; + +#ifdef XF86DRI_MM + I830Ptr pI830 = I830PTR(pScrn); + + if (pI830->memory_manager && !(flags & NEED_PHYSICAL_ADDR) && + !(flags & NEED_LIFETIME_FIXED)) + { + return i830_allocate_memory_bo(pScrn, name, size, alignment, flags); + } else +#endif + { + mem = i830_allocate_aperture(pScrn, name, size, alignment, flags); + if (mem == NULL) + return NULL; + + if (!i830_allocate_agp_memory(pScrn, mem, flags)) { + i830_free_memory(pScrn, mem); + return NULL; + } + } + + mem->tiling = TILE_NONE; + + return mem; } -static unsigned long -GetFreeSpace(ScrnInfoPtr pScrn) +/* Allocate a tiled region with the given size and pitch. + * + * As is, we might miss out on tiling some allocations on older hardware with + * large framebuffer size and a small aperture size, where the first + * allocations use a large alignment even though we've got fences to spare, and + * the later allocations can't find enough aperture space left. We could do + * some search across all allocation options to fix this, probably, but that + * would be another rewrite. + */ +i830_memory * +i830_allocate_memory_tiled(ScrnInfoPtr pScrn, const char *name, + unsigned long size, unsigned long pitch, + unsigned long alignment, int flags, + enum tile_format tile_format) { - I830Ptr pI830 = I830PTR(pScrn); - unsigned long extra = 0; + I830Ptr pI830 = I830PTR(pScrn); + unsigned long aper_size; + unsigned long aper_align; + i830_memory *mem; + + if (tile_format == TILE_NONE) + return i830_allocate_memory(pScrn, name, size, alignment, flags); - /* First check for free space in StolenPool. */ - if (pI830->StolenPool.Free.Size > 0) - extra = pI830->StolenPool.Free.Size; - /* Next check for unallocated space. */ - if (pI830->FreeMemory > 0) - extra += pI830->FreeMemory; + /* Only allocate page-sized increments. */ + size = ALIGN(size, GTT_PAGE_SIZE); + + /* Check for maximum tiled region size */ + if (IS_I9XX(pI830)) { + if (size > MB(128)) + return NULL; + } else { + if (size > MB(64)) + return NULL; + } - return extra; + aper_size = i830_get_fence_size(pScrn, size); + if (IS_I965G(pI830)) { + aper_align = GTT_PAGE_SIZE; + } else { + /* The offset has to be aligned to at least the size of the fence + * region. + */ + aper_align = aper_size; + } + if (aper_align < alignment) + aper_align = alignment; + + mem = i830_allocate_memory(pScrn, name, aper_size, aper_align, flags); + if (mem == NULL) + return NULL; + mem->size = size; + mem->tiling = tile_format; + mem->pitch = pitch; + mem->fence_nr = -1; + + return mem; } -/* - * Allocate memory for 2D operation. This includes the (front) framebuffer, - * ring buffer, scratch memory, HW cursor. - */ +void +i830_describe_allocations(ScrnInfoPtr pScrn, int verbosity, const char *prefix) +{ + I830Ptr pI830 = I830PTR(pScrn); + i830_memory *mem; + + if (pI830->memory_list == NULL) { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sMemory allocator not initialized\n", prefix); + return; + } + + if (pI830->memory_list->next->next == NULL) { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sNo memory allocations\n", prefix); + return; + } + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sFixed memory allocation layout:\n", prefix); + + for (mem = pI830->memory_list->next; mem->next != NULL; mem = mem->next) { + char phys_suffix[32] = ""; + char *tile_suffix = ""; + + if (mem->offset >= pI830->stolen_size && + mem->prev->offset < pI830->stolen_size) + { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%s0x%08lx: end of stolen memory\n", + prefix, pI830->stolen_size); + } + + if (mem->bus_addr != 0) + snprintf(phys_suffix, sizeof(phys_suffix), + ", 0x%016llx physical\n", mem->bus_addr); + if (mem->tiling == TILE_XMAJOR) + tile_suffix = " X tiled"; + else if (mem->tiling == TILE_YMAJOR) + tile_suffix = " Y tiled"; + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%s0x%08lx-0x%08lx: %s (%ld kB%s)%s\n", prefix, + mem->offset, mem->end - 1, mem->name, + mem->size / 1024, phys_suffix, tile_suffix); + } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%s0x%08lx: end of aperture\n", + prefix, pI830->FbMapSize); + +#ifdef XF86DRI_MM + if (pI830->memory_manager) { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sBO memory allocation layout:\n", prefix); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%s0x%08lx: start of memory manager\n", + prefix, pI830->memory_manager->offset); + for (mem = pI830->bo_list; mem != NULL; mem = mem->next) { + char *tile_suffix = ""; + + if (mem->tiling == TILE_XMAJOR) + tile_suffix = " X tiled"; + else if (mem->tiling == TILE_YMAJOR) + tile_suffix = " Y tiled"; + + if (mem->bound) { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%s0x%08lx-0x%08lx: %s (%ld kB)%s\n", prefix, + mem->offset, mem->end - 1, mem->name, + mem->size / 1024, tile_suffix); + } else { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sunpinned : %s (%ld kB)%s\n", prefix, + mem->name, mem->size / 1024, tile_suffix); + } + } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%s0x%08lx: end of memory manager\n", + prefix, pI830->memory_manager->end); + } +#endif /* XF86DRI_MM */ +} -Bool -I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags) +static Bool +i830_allocate_ringbuffer(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (pI830->noAccel || pI830->LpRing->mem != NULL) + return TRUE; + + /* We don't have any mechanism in the DRM yet to alert it that we've moved + * the ringbuffer since init time, so allocate it fixed for its lifetime. + */ + pI830->LpRing->mem = i830_allocate_memory(pScrn, "ring buffer", + PRIMARY_RINGBUFFER_SIZE, + GTT_PAGE_SIZE, + NEED_LIFETIME_FIXED); + if (pI830->LpRing->mem == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate Ring Buffer space\n"); + return FALSE; + } + + pI830->LpRing->tail_mask = pI830->LpRing->mem->size - 1; + return TRUE; +} + +#ifdef I830_XV +/** + * Allocate space for overlay registers and XAA linear allocator (if + * requested) + */ +static Bool +i830_allocate_overlay(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); - long size, alloced; - Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); - int verbosity = dryrun ? 4 : 1; - const char *s = dryrun ? "[dryrun] " : ""; - Bool tileable; - int align, alignflags; - - DPRINTF(PFX, "I830Allocate2DMemory: inital is %s\n", - BOOLTOSTRING(flags & ALLOC_INITIAL)); - - if (!pI830->StolenOnly && - (!xf86AgpGARTSupported() || !xf86AcquireGART(pScrn->scrnIndex))) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "AGP GART support is either not available or cannot " - "be used.\n" - "\tMake sure your kernel has agpgart support or has the\n" - "\tagpgart module loaded.\n"); - } - return FALSE; - } - - - /* - * The I830 is slightly different from the I830/I815, it has no - * dcache and it has stolen memory by default in its gtt. All - * additional memory must go after it. - */ - - DPRINTF(PFX, - "size == %luk (%lu bytes == pScrn->videoRam)\n" - "pI830->StolenSize == %luk (%lu bytes)\n", - pScrn->videoRam, pScrn->videoRam * 1024, - pI830->StolenPool.Free.Size / 1024, - pI830->StolenPool.Free.Size); - - if (flags & ALLOC_INITIAL) { - unsigned long minspace, avail, lineSize; - int cacheLines, maxCacheLines; - - if (pI830->NeedRingBufferLow) - AllocateRingBuffer(pScrn, flags | FORCE_LOW); - - /* Unfortunately this doesn't run on the DRY_RUN pass because our - * second head hasn't been created yet..... */ - if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) { - I830EntPtr pI830Ent = pI830->entityPrivate; - I830Ptr pI8302 = I830PTR(pI830Ent->pScrn_2); - - /* Clear everything first. */ - memset(&(pI830->FbMemBox2), 0, sizeof(pI830->FbMemBox2)); - memset(&(pI830->FrontBuffer2), 0, sizeof(pI830->FrontBuffer2)); - pI830->FrontBuffer2.Key = -1; - -#if 1 /* ROTATION */ - pI830->FbMemBox2.x1 = 0; - pI830->FbMemBox2.x2 = pI830Ent->pScrn_2->displayWidth; - pI830->FbMemBox2.y1 = 0; - if (pI830Ent->pScrn_2->virtualX > pI830Ent->pScrn_2->virtualY) - pI830->FbMemBox2.y2 = pI830Ent->pScrn_2->virtualX; - else - pI830->FbMemBox2.y2 = pI830Ent->pScrn_2->virtualY; -#else - pI830->FbMemBox2.x1 = 0; - pI830->FbMemBox2.x2 = pI830Ent->pScrn_2->displayWidth; - pI830->FbMemBox2.y1 = 0; - pI830->FbMemBox2.y2 = pI830Ent->pScrn_2->virtualY; + I830Ptr pI830 = I830PTR(pScrn); + int flags = 0; + + /* Only allocate if overlay is going to be enabled. */ + if (!pI830->XvEnabled) + return TRUE; + + if (!OVERLAY_NOPHYSICAL(pI830)) + flags |= NEED_PHYSICAL_ADDR; + + if (!IS_I965G(pI830)) { + pI830->overlay_regs = i830_allocate_memory(pScrn, "overlay registers", + OVERLAY_SIZE, GTT_PAGE_SIZE, + flags); + if (pI830->overlay_regs == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to allocate Overlay register space.\n"); + /* This failure isn't fatal. */ + } + } + + return TRUE; +} #endif - /* - * Calculate how much framebuffer memory to allocate. For the - * initial allocation, calculate a reasonable minimum. This is - * enough for the virtual screen size, plus some pixmap cache - * space. - */ - - lineSize = pI830Ent->pScrn_2->displayWidth * pI8302->cpp; - minspace = lineSize * pI830Ent->pScrn_2->virtualY; - avail = pI830Ent->pScrn_2->videoRam * 1024; - maxCacheLines = (avail - minspace) / lineSize; - /* This shouldn't happen. */ - if (maxCacheLines < 0) { +static Bool +IsTileable(ScrnInfoPtr pScrn, int pitch) +{ + I830Ptr pI830 = I830PTR(pScrn); + + if (IS_I965G(pI830)) { + if (pitch / 512 * 512 == pitch && pitch <= KB(128)) + return TRUE; + else + return FALSE; + } + + /* + * Allow tiling for pitches that are a power of 2 multiple of 128 bytes, + * up to 64 * 128 (= 8192) bytes. + */ + switch (pitch) { + case 128: + case 256: + if (IS_I945G(pI830) || IS_I945GM(pI830) || IS_G33CLASS(pI830)) + return TRUE; + else + return FALSE; + case 512: + case KB(1): + case KB(2): + case KB(4): + case KB(8): + return TRUE; + default: + return FALSE; + } +} + +/* This is the 2D rendering vertical coordinate limit. We can ignore + * the 3D rendering limits in our 2d pixmap cache allocation, because XAA + * doesn't do any 3D rendering to/from the cache lines when using an offset + * at the start of framebuffer. + */ +#define MAX_2D_HEIGHT 65536 + +/** + * Allocates a framebuffer for a screen. + * + * Used once for each X screen, so once with RandR 1.2 and twice with classic + * dualhead. + * + * \param pScrn ScrnInfoPtr for the screen being allocated + * \param pI830 I830Ptr for the screen being allocated. + * \param FbMemBox + */ +static i830_memory * +i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox, + Bool secondary) +{ + unsigned int pitch = pScrn->displayWidth * pI830->cpp; + unsigned long minspace, avail; + int cacheLines, maxCacheLines; + int align; + long size, fb_height; + char *name; + int flags; + i830_memory *front_buffer = NULL; + Bool tiling; + + flags = ALLOW_SHARING; + + /* Clear everything first. */ + memset(FbMemBox, 0, sizeof(*FbMemBox)); + + /* We'll allocate the fb such that the root window will fit regardless of + * rotation. + */ + if (pScrn->virtualX > pScrn->virtualY) + fb_height = pScrn->virtualX; + else + fb_height = pScrn->virtualY; + + FbMemBox->x1 = 0; + FbMemBox->x2 = pScrn->displayWidth; + FbMemBox->y1 = 0; + FbMemBox->y2 = fb_height; + + /* Calculate how much framebuffer memory to allocate. For the + * initial allocation, calculate a reasonable minimum. This is + * enough for the virtual screen size, plus some pixmap cache + * space if we're using XAA. + */ + minspace = pitch * pScrn->virtualY; + avail = pScrn->videoRam * 1024; + + if (!pI830->useEXA) { + maxCacheLines = (avail - minspace) / pitch; + /* This shouldn't happen. */ + if (maxCacheLines < 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Internal Error: " - "maxCacheLines < 0 in I830Allocate2DMemory()\n"); + "Internal Error: " + "maxCacheLines < 0 in i830_allocate_2d_memory()\n"); maxCacheLines = 0; - } - if (maxCacheLines > (MAX_DISPLAY_HEIGHT - pI830Ent->pScrn_2->virtualY)) - maxCacheLines = MAX_DISPLAY_HEIGHT - pI830Ent->pScrn_2->virtualY; - - if (pI8302->CacheLines >= 0) { - cacheLines = pI8302->CacheLines; - } else { -#if 1 - /* Make sure there is enough for two DVD sized YUV buffers */ - cacheLines = (pI830Ent->pScrn_2->depth == 24) ? 256 : 384; - if (pI830Ent->pScrn_2->displayWidth <= 1024) - cacheLines *= 2; -#else - /* - * Make sure there is enough for two DVD sized YUV buffers. - * Make that 1.5MB, which is around what was allocated with - * the old algorithm - */ - cacheLines = (MB(1) + KB(512)) / pI8302->cpp / pI830Ent->pScrn_2->displayWidth; -#endif - } - if (cacheLines > maxCacheLines) + } + if (maxCacheLines > (MAX_2D_HEIGHT - pScrn->virtualY)) + maxCacheLines = MAX_2D_HEIGHT - pScrn->virtualY; + + if (pI830->CacheLines >= 0) { + cacheLines = pI830->CacheLines; + } else { + int size; + + size = 3 * pitch * pScrn->virtualY; + size = ROUND_TO_PAGE(size); + + cacheLines = (size + pitch - 1) / pitch; + } + if (cacheLines > maxCacheLines) cacheLines = maxCacheLines; - pI830->FbMemBox2.y2 += cacheLines; - - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocating at least %d scanlines for pixmap cache\n", - s, cacheLines); - - tileable = !(flags & ALLOC_NO_TILING) && pI8302->allowPageFlip && - IsTileable(pI830Ent->pScrn_2->displayWidth * pI8302->cpp); - if (tileable) { - if (IS_I9XX(pI830)) - align = MB(1); - else - align = KB(512); - alignflags = ALIGN_BOTH_ENDS; - } else { - align = KB(64); - alignflags = 0; - } - -#if 1 /* ROTATION */ - if (pI830Ent->pScrn_2->virtualX > pI830Ent->pScrn_2->virtualY) - size = lineSize * (pI830Ent->pScrn_2->virtualX + cacheLines); - else - size = lineSize * (pI830Ent->pScrn_2->virtualY + cacheLines); - size = ROUND_TO_PAGE(size); -#else - size = lineSize * (pI830Ent->pScrn_2->virtualY + cacheLines); - size = ROUND_TO_PAGE(size); -#endif - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sSecondary framebuffer allocation size: %ld kByte\n", s, - size / 1024); - alloced = I830AllocVidMem(pScrn, &(pI830->FrontBuffer2), - &(pI830->StolenPool), size, align, - flags | alignflags | - FROM_ANYWHERE | ALLOCATE_AT_BOTTOM); - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pI830Ent->pScrn_2->scrnIndex, X_ERROR, - "Failed to allocate secondary framebuffer.\n"); - } - return FALSE; - } - } - - /* Clear everything first. */ - memset(&(pI830->FbMemBox), 0, sizeof(pI830->FbMemBox)); - memset(&(pI830->FrontBuffer), 0, sizeof(pI830->FrontBuffer)); - pI830->FrontBuffer.Key = -1; - -#if 1 /* ROTATION */ - pI830->FbMemBox.x1 = 0; - pI830->FbMemBox.x2 = pScrn->displayWidth; - pI830->FbMemBox.y1 = 0; - if (!pI830->MergedFB && pScrn->virtualX > pScrn->virtualY) - pI830->FbMemBox.y2 = pScrn->virtualX; - else - pI830->FbMemBox.y2 = pScrn->virtualY; -#else - pI830->FbMemBox.x1 = 0; - pI830->FbMemBox.x2 = pScrn->displayWidth; - pI830->FbMemBox.y1 = 0; - pI830->FbMemBox.y2 = pScrn->virtualY; -#endif + FbMemBox->y2 += cacheLines; - /* - * Calculate how much framebuffer memory to allocate. For the - * initial allocation, calculate a reasonable minimum. This is - * enough for the virtual screen size, plus some pixmap cache - * space. - */ - - lineSize = pScrn->displayWidth * pI830->cpp; - minspace = lineSize * pScrn->virtualY; - avail = pScrn->videoRam * 1024; - maxCacheLines = (avail - minspace) / lineSize; - /* This shouldn't happen. */ - if (maxCacheLines < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Internal Error: " - "maxCacheLines < 0 in I830Allocate2DMemory()\n"); - maxCacheLines = 0; - } - if (maxCacheLines > (MAX_DISPLAY_HEIGHT - pScrn->virtualY)) - maxCacheLines = MAX_DISPLAY_HEIGHT - pScrn->virtualY; - - if (pI830->CacheLines >= 0) { - cacheLines = pI830->CacheLines; - } else { -#if 1 - /* Make sure there is enough for two DVD sized YUV buffers */ - cacheLines = (pScrn->depth == 24) ? 256 : 384; - if (pScrn->displayWidth <= 1024) - cacheLines *= 2; -#else - /* - * Make sure there is enough for two DVD sized YUV buffers. - * Make that 1.5MB, which is around what was allocated with - * the old algorithm - */ - cacheLines = (MB(1) + KB(512)) / pI830->cpp / pScrn->displayWidth; -#endif - } - if (cacheLines > maxCacheLines) - cacheLines = maxCacheLines; - - pI830->FbMemBox.y2 += cacheLines; - - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocating at least %d scanlines for pixmap cache\n", - s, cacheLines); - - tileable = !(flags & ALLOC_NO_TILING) && pI830->allowPageFlip && - IsTileable(pScrn->displayWidth * pI830->cpp); - if (tileable) { - if (IS_I9XX(pI830)) - align = MB(1); - else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Allocating %d scanlines for pixmap cache\n", + cacheLines); + } else { + /* For EXA, we have a separate allocation for the linear allocator + * which also does the pixmap cache. + */ + cacheLines = 0; + } + + size = pitch * (fb_height + cacheLines); + size = ROUND_TO_PAGE(size); + + name = secondary ? "secondary front buffer" : "front buffer"; + + /* Front buffer tiling has to be disabled with G965 XAA because some of the + * acceleration operations (non-XY COLOR_BLT) can't be done to tiled + * buffers. + */ + if (!pI830->useEXA && IS_I965G(pI830)) + tiling = FALSE; + else + tiling = pI830->tiling; + + /* Attempt to allocate it tiled first if we have page flipping on. */ + if (tiling && IsTileable(pScrn, pitch)) { + /* XXX: probably not the case on 965 */ + if (IS_I9XX(pI830)) + align = MB(1); + else align = KB(512); - alignflags = ALIGN_BOTH_ENDS; - } else { - align = KB(64); - alignflags = 0; - } - -#if 1 /* ROTATION */ - if (!pI830->MergedFB && pScrn->virtualX > pScrn->virtualY) - size = lineSize * (pScrn->virtualX + cacheLines); - else - size = lineSize * (pScrn->virtualY + cacheLines); - size = ROUND_TO_PAGE(size); -#else - size = lineSize * (pScrn->virtualY + cacheLines); - size = ROUND_TO_PAGE(size); -#endif - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sInitial framebuffer allocation size: %ld kByte\n", s, - size / 1024); - alloced = I830AllocVidMem(pScrn, &(pI830->FrontBuffer), - &(pI830->StolenPool), size, align, - flags | alignflags | - FROM_ANYWHERE | ALLOCATE_AT_BOTTOM); - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to allocate " - "framebuffer. Is your VideoRAM set too low ??\n"); - } - return FALSE; - } - } else { - long lineSize; - long extra = 0; - long maxFb = 0; - - /* - * XXX Need to "free" up any 3D allocations if the DRI ended up - * and make them available for 2D. The best way to do this would - * be position all of those regions contiguously at the end of the - * StolenPool. - */ - extra = GetFreeSpace(pScrn); - - if (extra == 0) - return TRUE; - - maxFb = pI830->FrontBuffer.Size + extra; - lineSize = pScrn->displayWidth * pI830->cpp; - maxFb = ROUND_DOWN_TO(maxFb, lineSize); - if (maxFb > lineSize * MAX_DISPLAY_HEIGHT) - maxFb = lineSize * MAX_DISPLAY_HEIGHT; - if (0/*maxFb > pI830->FrontBuffer.Size*/) { - unsigned long oldsize; - /* - * Sanity check -- the fb should be the last thing allocated at - * the bottom of the stolen pool. - */ - if (pI830->StolenPool.Free.Start != pI830->FrontBuffer.End) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Internal error in I830Allocate2DMemory():\n\t" - "Framebuffer isn't the last allocation at the bottom" - " of StolenPool\n\t(%lx != %lx).\n", - pI830->FrontBuffer.End, - pI830->StolenPool.Free.Start); + front_buffer = i830_allocate_memory_tiled(pScrn, name, size, + pitch, align, flags, + TILE_XMAJOR); + } + + /* If not, attempt it linear */ + if (front_buffer == NULL) { + front_buffer = i830_allocate_memory(pScrn, name, size, KB(64), flags); + } + + if (front_buffer == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to allocate " + "%sframebuffer. Is your VideoRAM set too low?\n", + secondary ? "secondary " : ""); + return NULL; + } + + if (pI830->FbBase) + memset (pI830->FbBase + front_buffer->offset, 0, size); + return front_buffer; +} + +static Bool +i830_allocate_cursor_buffers(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + int flags = pI830->CursorNeedsPhysical ? NEED_PHYSICAL_ADDR : 0; + int i; + long size; + + /* Try to allocate one big blob for our cursor memory. This works + * around a limitation in the FreeBSD AGP driver that allows only one + * physical allocation larger than a page, and could allow us + * to pack the cursors smaller. + */ + size = xf86_config->num_crtc * (HWCURSOR_SIZE + HWCURSOR_SIZE_ARGB); + + pI830->cursor_mem = i830_allocate_memory(pScrn, "HW cursors", + size, GTT_PAGE_SIZE, + flags); + if (pI830->cursor_mem != NULL) + return TRUE; + + /* + * Allocate four separate buffers when the kernel doesn't support + * large allocations as on Linux. If any of these fail, just + * bail back to software cursors everywhere + */ + for (i = 0; i < xf86_config->num_crtc; i++) + { + pI830->cursor_mem_classic[i] = i830_allocate_memory (pScrn, + "Core cursor", + HWCURSOR_SIZE, + GTT_PAGE_SIZE, + flags); + if (!pI830->cursor_mem_classic[i]) return FALSE; - } - /* - * XXX Maybe should have a "Free" function. This should be - * the only place where a region is resized, and we know that - * the fb is always at the bottom of the aperture/stolen pool, - * and is the only region that is allocated bottom-up. - * Allowing for more general realloction would require a smarter - * allocation system. - */ - oldsize = pI830->FrontBuffer.Size; - pI830->StolenPool.Free.Size += pI830->FrontBuffer.Size; - pI830->StolenPool.Free.Start -= pI830->FrontBuffer.Size; - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sUpdated framebuffer allocation size from %ld " - "to %ld kByte\n", s, oldsize / 1024, maxFb / 1024); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sUpdated pixmap cache from %ld scanlines to %ld " - "scanlines\n", s, - oldsize / lineSize - pScrn->virtualY, - maxFb / lineSize - pScrn->virtualY); - pI830->FbMemBox.y2 = maxFb / lineSize; - tileable = !(flags & ALLOC_NO_TILING) && pI830->allowPageFlip && - IsTileable(pScrn->displayWidth * pI830->cpp); - if (tileable) { - if (IS_I9XX(pI830)) - align = MB(1); - else - align = KB(512); - alignflags = ALIGN_BOTH_ENDS; - } else { - align = KB(64); - alignflags = 0; - } - alloced = I830AllocVidMem(pScrn, &(pI830->FrontBuffer), - &(pI830->StolenPool), maxFb, align, - flags | alignflags | - FROM_ANYWHERE | ALLOCATE_AT_BOTTOM); - if (alloced < maxFb) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to re-allocate framebuffer\n"); - } + pI830->cursor_mem_argb[i] = i830_allocate_memory (pScrn, "ARGB cursor", + HWCURSOR_SIZE_ARGB, + GTT_PAGE_SIZE, + flags); + if (!pI830->cursor_mem_argb[i]) return FALSE; - } - } - return TRUE; - } - -#if REMAP_RESERVED - /* - * Allocate a dummy page to pass when attempting to rebind the - * pre-allocated region. - */ - if (!dryrun) { - memset(&(pI830->Dummy), 0, sizeof(pI830->Dummy)); - pI830->Dummy.Key = xf86AllocateGARTMemory(pScrn->scrnIndex, size, 0, NULL); - pI830->Dummy.Offset = 0; - } -#endif - /* Clear cursor info */ - memset(pI830->CursorMem, 0, sizeof(I830MemRange)); - pI830->CursorMem->Key = -1; - memset(pI830->CursorMemARGB, 0, sizeof(I830MemRange)); - pI830->CursorMemARGB->Key = -1; - - if (!pI830->SWCursor) { - int cursFlags = 0; - /* - * Mouse cursor -- The i810-i830 need a physical address in system - * memory from which to upload the cursor. We get this from - * the agpgart module using a special memory type. - */ - - size = HWCURSOR_SIZE; - cursFlags = FROM_ANYWHERE | ALLOCATE_AT_TOP; - if (pI830->CursorNeedsPhysical) - cursFlags |= NEED_PHYSICAL_ADDR; - - alloced = I830AllocVidMem(pScrn, pI830->CursorMem, - &(pI830->StolenPool), size, - GTT_PAGE_SIZE, flags | cursFlags); - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate HW cursor space.\n"); - } - } else { - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for HW cursor at 0x%lx", s, - alloced / 1024, pI830->CursorMem->Start); - if (pI830->CursorNeedsPhysical) - xf86ErrorFVerb(verbosity, " (0x%08lx)", pI830->CursorMem->Physical); - xf86ErrorFVerb(verbosity, "\n"); - } - - size = HWCURSOR_SIZE_ARGB; - cursFlags = FROM_ANYWHERE | ALLOCATE_AT_TOP; - if (pI830->CursorNeedsPhysical) - cursFlags |= NEED_PHYSICAL_ADDR; - - alloced = I830AllocVidMem(pScrn, pI830->CursorMemARGB, - &(pI830->StolenPool), size, - GTT_PAGE_SIZE, flags | cursFlags); - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate HW (ARGB) cursor space.\n"); - } - } else { - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for HW (ARGB) cursor at 0x%lx", s, - alloced / 1024, pI830->CursorMemARGB->Start); - if (pI830->CursorNeedsPhysical) - xf86ErrorFVerb(verbosity, " (0x%08lx)", pI830->CursorMemARGB->Physical); - xf86ErrorFVerb(verbosity, "\n"); - } - } + } + return TRUE; +} + +static void i830_setup_fb_compression(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + /* Only mobile chips since 845 support this feature */ + if (!IS_MOBILE(pI830)) { + pI830->fb_compression = FALSE; + goto out; + } + + /* Clear out any stale state */ + OUTREG(FBC_CFB_BASE, 0); + OUTREG(FBC_LL_BASE, 0); + OUTREG(FBC_CONTROL2, 0); + OUTREG(FBC_CONTROL, 0); + + /* + * Compressed framebuffer limitations: + * - contiguous, physical, uncached memory + * - ideally as large as the front buffer(s), smaller sizes cache less + * - uncompressed buffer must be tiled w/pitch 2k-16k + * - uncompressed fb is <= 2048 in width, 0 mod 8 + * - uncompressed fb is <= 1536 in height, 0 mod 2 + * - compressed fb stride is <= uncompressed stride + * - SR display watermarks must be equal between 16bpp and 32bpp? + * - both compressed and line buffers must be in stolen memory + */ + pI830->compressed_front_buffer = + i830_allocate_memory(pScrn, "compressed frame buffer", + MB(6), KB(4), NEED_PHYSICAL_ADDR); + + if (!pI830->compressed_front_buffer) { + pI830->fb_compression = FALSE; + goto out; + } + + pI830->compressed_ll_buffer = + i830_allocate_memory(pScrn, "compressed ll buffer", + FBC_LL_SIZE + FBC_LL_PAD, KB(4), + NEED_PHYSICAL_ADDR); + if (!pI830->compressed_ll_buffer) { + i830_free_memory(pScrn, pI830->compressed_front_buffer); + pI830->fb_compression = FALSE; + goto out; + } + +out: + if (!pI830->fb_compression) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Allocation error, framebuffer" + " compression disabled\n"); + + return; +} +/* + * Allocate memory for 2D operation. This includes the (front) framebuffer, + * ring buffer, scratch memory, HW cursor. + */ +Bool +i830_allocate_2d_memory(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + unsigned int pitch = pScrn->displayWidth * pI830->cpp; + long size; + + if (!pI830->StolenOnly && + (!xf86AgpGARTSupported() || !xf86AcquireGART(pScrn->scrnIndex))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "AGP GART support is either not available or cannot " + "be used.\n" + "\tMake sure your kernel has agpgart support or has\n" + "\tthe agpgart module loaded.\n"); + return FALSE; + } + + /* Allocate the ring buffer first, so it ends up in stolen mem. */ + i830_allocate_ringbuffer(pScrn); + + if (pI830->fb_compression) + i830_setup_fb_compression(pScrn); + + /* Next, allocate other fixed-size allocations we have. */ + if (!pI830->SWCursor && !i830_allocate_cursor_buffers(pScrn)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Disabling HW cursor because the cursor memory " + "allocation failed.\n"); + pI830->SWCursor = TRUE; + } + + /* Space for the X Server's 3D context. 32k is fine for right now. */ + pI830->logical_context = i830_allocate_memory(pScrn, "logical 3D context", + KB(32), GTT_PAGE_SIZE, 0); + if (pI830->logical_context == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to allocate logical context space.\n"); + return FALSE; + } + + /* even in XAA, 965G needs state mem buffer for rendering */ + if (IS_I965G(pI830) && !pI830->noAccel && pI830->exa_965_state == NULL) { + pI830->exa_965_state = + i830_allocate_memory(pScrn, "exa G965 state buffer", + EXA_LINEAR_EXTRA, GTT_PAGE_SIZE, 0); + if (pI830->exa_965_state == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to allocate exa state buffer for 965.\n"); + return FALSE; + } + } #ifdef I830_XV - AllocateOverlay(pScrn, flags); + /* Allocate overlay register space and optional XAA linear allocator + * space. The second head in zaphod mode will share the space. + */ + if (I830IsPrimary(pScrn)) + i830_allocate_overlay(pScrn); #endif - if (!pI830->NeedRingBufferLow) - AllocateRingBuffer(pScrn, flags); - - /* Clear scratch info */ - memset(&(pI830->Scratch), 0, sizeof(I830MemRange)); - pI830->Scratch.Key = -1; - memset(&(pI830->Scratch2), 0, sizeof(I830MemRange)); - pI830->Scratch2.Key = -1; - - if (!pI830->noAccel) { - size = MAX_SCRATCH_BUFFER_SIZE; - alloced = I830AllocVidMem(pScrn, &(pI830->Scratch), &(pI830->StolenPool), - size, GTT_PAGE_SIZE, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); - if (alloced < size) { - size = MIN_SCRATCH_BUFFER_SIZE; - alloced = I830AllocVidMem(pScrn, &(pI830->Scratch), - &(pI830->StolenPool), size, - GTT_PAGE_SIZE, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); - } - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate scratch buffer space\n"); - } - return FALSE; - } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for the scratch buffer at 0x%lx\n", s, - alloced / 1024, pI830->Scratch.Start); - - /* Let's allocate another scratch buffer for the second head */ - /* Again, this code won't execute on the dry run pass */ - if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) { - size = MAX_SCRATCH_BUFFER_SIZE; - alloced = I830AllocVidMem(pScrn, &(pI830->Scratch2), - &(pI830->StolenPool), - size, GTT_PAGE_SIZE, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); - if (alloced < size) { - size = MIN_SCRATCH_BUFFER_SIZE; - alloced = I830AllocVidMem(pScrn, &(pI830->Scratch2), - &(pI830->StolenPool), size, - GTT_PAGE_SIZE, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); - } - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate second scratch buffer space\n"); - } - return FALSE; - } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for the second scratch buffer at 0x%lx\n", s, - alloced / 1024, pI830->Scratch2.Start); - } - } - - return TRUE; -} + if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) { + I830EntPtr pI830Ent = pI830->entityPrivate; + I830Ptr pI8302 = I830PTR(pI830Ent->pScrn_2); -void -I830ResetAllocations(ScrnInfoPtr pScrn, const int flags) -{ - I830Ptr pI830 = I830PTR(pScrn); + pI830->front_buffer_2 = + i830_allocate_framebuffer(pI830Ent->pScrn_2, pI8302, + &pI830->FbMemBox2, TRUE); + if (pI830->front_buffer_2 == NULL) + return FALSE; + } + pI830->front_buffer = + i830_allocate_framebuffer(pScrn, pI830, &pI830->FbMemBox, FALSE); + if (pI830->front_buffer == NULL) + return FALSE; + +#ifdef I830_USE_EXA + if (pI830->useEXA) { + if (pI830->exa_offscreen == NULL) { + /* Default EXA to having 3 screens worth of offscreen memory space + * (for pixmaps). + * + * XXX: It would be nice to auto-size it larger if the user + * specified a larger size, or to fit along with texture and FB + * memory if a low videoRam is specified. + */ + size = 3 * pitch * pScrn->virtualY; + size = ROUND_TO_PAGE(size); - pI830->MemoryAperture.Start = pI830->StolenMemory.End; - pI830->MemoryAperture.End = pI830->FbMapSize; - pI830->MemoryAperture.Size = pI830->FbMapSize - pI830->StolenMemory.Size; -#ifdef XF86DRI - if (!pI830->directRenderingDisabled) { - pI830->MemoryAperture.End -= KB(pI830->mmSize); - pI830->MemoryAperture.Size -= KB(pI830->mmSize); - } -#endif - pI830->StolenPool.Fixed = pI830->StolenMemory; - pI830->StolenPool.Total = pI830->StolenMemory; -#if ALLOCATE_ALL_BIOSMEM - if (pI830->overrideBIOSMemSize && - pI830->BIOSMemorySize > pI830->StolenMemory.Size) { - pI830->StolenPool.Total.End = pI830->BIOSMemorySize; - pI830->StolenPool.Total.Size = pI830->BIOSMemorySize; - } -#endif - pI830->StolenPool.Free = pI830->StolenPool.Total; - pI830->FreeMemory = pI830->TotalVideoRam - pI830->StolenPool.Total.Size; - pI830->allocatedMemory = 0; -} + /* EXA has no way to tell it that the offscreen memory manager has + * moved its base and all the contents with it, so we have to have + * it locked in place for the whole driver instance. + */ + pI830->exa_offscreen = + i830_allocate_memory(pScrn, "exa offscreen", + size, 1, NEED_LIFETIME_FIXED); + if (pI830->exa_offscreen == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to allocate EXA offscreen memory.\n"); + return FALSE; + } + } + } +#endif /* I830_USE_EXA */ + + if (!pI830->noAccel && !pI830->useEXA) { + /* The lifetime fixed offset of xaa scratch is probably not required, + * but we do some setup using it at XAAInit() time. And XAA may not + * end up being supported with TTM anyway. + */ + pI830->xaa_scratch = + i830_allocate_memory(pScrn, "xaa scratch", MAX_SCRATCH_BUFFER_SIZE, + GTT_PAGE_SIZE, NEED_LIFETIME_FIXED); + if (pI830->xaa_scratch == NULL) { + pI830->xaa_scratch = + i830_allocate_memory(pScrn, "xaa scratch", + MIN_SCRATCH_BUFFER_SIZE, GTT_PAGE_SIZE, + NEED_LIFETIME_FIXED); + if (pI830->xaa_scratch == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to allocate scratch buffer space\n"); + return FALSE; + } + } + + /* Let's allocate another scratch buffer for the second head */ + /* Again, this code won't execute on the dry run pass */ + if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) + { + pI830->xaa_scratch_2 = + i830_allocate_memory(pScrn, "xaa scratch 2", + MAX_SCRATCH_BUFFER_SIZE, GTT_PAGE_SIZE, + NEED_LIFETIME_FIXED); + if (pI830->xaa_scratch_2 == NULL) { + pI830->xaa_scratch_2 = + i830_allocate_memory(pScrn, "xaa scratch 2", + MIN_SCRATCH_BUFFER_SIZE, + GTT_PAGE_SIZE, NEED_LIFETIME_FIXED); + if (pI830->xaa_scratch_2 == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to allocate secondary scratch " + "buffer space\n"); + return FALSE; + } + } + } + } -long -I830GetExcessMemoryAllocations(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - long allocated; - - allocated = pI830->StolenPool.Total.Size + pI830->allocatedMemory; - if (allocated > pI830->TotalVideoRam) - return allocated - pI830->TotalVideoRam; - else - return 0; + return TRUE; } #ifdef XF86DRI static unsigned int myLog2(unsigned int n) { - unsigned int log2 = 1; + unsigned int log2 = 1; - while (n > 1) { - n >>= 1; - log2++; - } - return log2; + while (n > 1) { + n >>= 1; + log2++; + } + return log2; } -Bool -I830AllocateBackBuffer(ScrnInfoPtr pScrn, const int flags) +static Bool +i830_allocate_backbuffer(ScrnInfoPtr pScrn, i830_memory **buffer, + const char *name) { - I830Ptr pI830 = I830PTR(pScrn); - unsigned long size, alloced, align = 0; - Bool tileable; - Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); - int verbosity = dryrun ? 4 : 1; - const char *s = dryrun ? "[dryrun] " : ""; - int lines; - int height = (pI830->rotation & (RR_Rotate_0 | RR_Rotate_180)) ? pScrn->virtualY : pScrn->virtualX; - - /* Back Buffer */ - memset(&(pI830->BackBuffer), 0, sizeof(pI830->BackBuffer)); - pI830->BackBuffer.Key = -1; - tileable = !(flags & ALLOC_NO_TILING) && - IsTileable(pScrn->displayWidth * pI830->cpp); - if (tileable) { - /* Make the height a multiple of the tile height (16) */ - lines = (height + 15) / 16 * 16; - } else { - lines = height; - } - - size = ROUND_TO_PAGE(pScrn->displayWidth * lines * pI830->cpp); - /* - * Try to allocate on the best tile-friendly boundaries. - */ - alloced = 0; - if (tileable) { - align = GetBestTileAlignment(size); - for (align = GetBestTileAlignment(size); align >= (IS_I9XX(pI830) ? MB(1) : KB(512)); align >>= 1) { - alloced = I830AllocVidMem(pScrn, &(pI830->BackBuffer), - &(pI830->StolenPool), size, align, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP | - ALIGN_BOTH_ENDS); - if (alloced >= size) - break; - } - } - if (alloced < size) { - /* Give up on trying to tile */ - tileable = FALSE; - size = ROUND_TO_PAGE(pScrn->displayWidth * height * pI830->cpp); - align = GTT_PAGE_SIZE; - alloced = I830AllocVidMem(pScrn, &(pI830->BackBuffer), - &(pI830->StolenPool), size, align, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); - } - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate back buffer space.\n"); - } - return FALSE; - } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for the back buffer at 0x%lx.\n", s, - alloced / 1024, pI830->BackBuffer.Start); - - return TRUE; + I830Ptr pI830 = I830PTR(pScrn); + unsigned int pitch = pScrn->displayWidth * pI830->cpp; + unsigned long size; + int height; + + if (pI830->rotation & (RR_Rotate_0 | RR_Rotate_180)) + height = pScrn->virtualY; + else + height = pScrn->virtualX; + + /* Try to allocate on the best tile-friendly boundaries. */ + if (pI830->tiling && IsTileable(pScrn, pitch)) + { + size = ROUND_TO_PAGE(pitch * ALIGN(height, 16)); + *buffer = i830_allocate_memory_tiled(pScrn, name, size, pitch, + GTT_PAGE_SIZE, + ALIGN_BOTH_ENDS | + ALLOW_SHARING, + TILE_XMAJOR); + } + + /* Otherwise, just allocate it linear. The offset must stay constant + * currently because we don't ever update the DRI maps after screen init. + */ + if (*buffer == NULL) { + size = ROUND_TO_PAGE(pitch * height); + *buffer = i830_allocate_memory(pScrn, name, size, GTT_PAGE_SIZE, + ALIGN_BOTH_ENDS | + ALLOW_SHARING); + } + + if (*buffer == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to allocate %s space.\n", name); + return FALSE; + } + + return TRUE; } -Bool -I830AllocateDepthBuffer(ScrnInfoPtr pScrn, const int flags) +static Bool +i830_allocate_depthbuffer(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); - unsigned long size, alloced, align = 0; - Bool tileable; - Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); - int verbosity = dryrun ? 4 : 1; - const char *s = dryrun ? "[dryrun] " : ""; - int lines; - int height = (pI830->rotation & (RR_Rotate_0 | RR_Rotate_180)) ? pScrn->virtualY : pScrn->virtualX; - - /* Depth Buffer -- same size as the back buffer */ - memset(&(pI830->DepthBuffer), 0, sizeof(pI830->DepthBuffer)); - pI830->DepthBuffer.Key = -1; - tileable = !(flags & ALLOC_NO_TILING) && - IsTileable(pScrn->displayWidth * pI830->cpp); - if (tileable) { - /* Make the height a multiple of the tile height (16) */ - lines = (height + 15) / 16 * 16; - } else { - lines = height; - } - - size = ROUND_TO_PAGE(pScrn->displayWidth * lines * pI830->cpp); - /* - * Try to allocate on the best tile-friendly boundaries. - */ - alloced = 0; - if (tileable) { - align = GetBestTileAlignment(size); - for (align = GetBestTileAlignment(size); align >= (IS_I9XX(pI830) ? MB(1) : KB(512)); align >>= 1) { - alloced = I830AllocVidMem(pScrn, &(pI830->DepthBuffer), - &(pI830->StolenPool), size, align, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP | - ALIGN_BOTH_ENDS); - if (alloced >= size) - break; - } - } - if (alloced < size) { - /* Give up on trying to tile */ - tileable = FALSE; - size = ROUND_TO_PAGE(pScrn->displayWidth * height * pI830->cpp); - align = GTT_PAGE_SIZE; - alloced = I830AllocVidMem(pScrn, &(pI830->DepthBuffer), - &(pI830->StolenPool), size, align, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); - } - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate depth buffer space.\n"); - } - return FALSE; - } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for the depth buffer at 0x%lx.\n", s, - alloced / 1024, pI830->DepthBuffer.Start); - - return TRUE; + I830Ptr pI830 = I830PTR(pScrn); + unsigned long size; + unsigned int pitch = pScrn->displayWidth * pI830->cpp; + int height; + + /* XXX: this rotation stuff is bogus */ + if (pI830->rotation & (RR_Rotate_0 | RR_Rotate_180)) + height = pScrn->virtualY; + else + height = pScrn->virtualX; + + /* First try allocating it tiled */ + if (pI830->tiling && IsTileable(pScrn, pitch)) + { + enum tile_format tile_format; + + size = ROUND_TO_PAGE(pitch * ALIGN(height, 16)); + + /* The 965 requires that the depth buffer be in Y Major format, while + * the rest appear to fail when handed that format. + */ + tile_format = IS_I965G(pI830) ? TILE_YMAJOR: TILE_XMAJOR; + + pI830->depth_buffer = + i830_allocate_memory_tiled(pScrn, "depth buffer", size, pitch, + GTT_PAGE_SIZE, + ALIGN_BOTH_ENDS | + ALLOW_SHARING, + tile_format); + } + + /* Otherwise, allocate it linear. The offset must stay constant + * currently because we don't ever update the DRI maps after screen init. + */ + if (pI830->depth_buffer == NULL) { + size = ROUND_TO_PAGE(pitch * height); + pI830->depth_buffer = + i830_allocate_memory(pScrn, "depth buffer", size, GTT_PAGE_SIZE, + ALLOW_SHARING); + } + + if (pI830->depth_buffer == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to allocate depth buffer space.\n"); + return FALSE; + } + + return TRUE; } Bool -I830AllocateTextureMemory(ScrnInfoPtr pScrn, const int flags) +i830_allocate_texture_memory(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); - unsigned long size, alloced; - int i; - Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); - int verbosity = dryrun ? 4 : 1; - const char *s = dryrun ? "[dryrun] " : ""; - - /* Allocate the remaining space for textures. */ - memset(&(pI830->TexMem), 0, sizeof(pI830->TexMem)); - pI830->TexMem.Key = -1; - - if (pI830->mmModeFlags & I830_KERNEL_TEX) { - - size = GetFreeSpace(pScrn); - if (dryrun && (size < MB(1))) - size = MB(1); - i = myLog2(size / I830_NR_TEX_REGIONS); - if (i < I830_LOG_MIN_TEX_REGION_SIZE) - i = I830_LOG_MIN_TEX_REGION_SIZE; - pI830->TexGranularity = i; - /* Truncate size */ - size >>= i; - size <<= i; - if (size < KB(512)) { - if (!dryrun) { + I830Ptr pI830 = I830PTR(pScrn); + unsigned long size; + int i; + + if (pI830->allocate_classic_textures) { + /* XXX: auto-sizing */ + size = MB(32); + i = myLog2(size / I830_NR_TEX_REGIONS); + if (i < I830_LOG_MIN_TEX_REGION_SIZE) + i = I830_LOG_MIN_TEX_REGION_SIZE; + pI830->TexGranularity = i; + /* Truncate size */ + size >>= i; + size <<= i; + if (size < KB(512)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Less than 512 kBytes for texture space (real %ld kBytes).\n", + "Less than 512 kBytes for texture space (real %ld" + "kBytes).\n", size / 1024); - } - return FALSE; - } - alloced = I830AllocVidMem(pScrn, &(pI830->TexMem), - &(pI830->StolenPool), size, GTT_PAGE_SIZE, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + return FALSE; + } + /* The offset must stay constant currently because we don't ever update + * the DRI maps after screen init. + */ + pI830->textures = i830_allocate_memory(pScrn, "classic textures", size, + GTT_PAGE_SIZE, + ALLOW_SHARING | + NEED_LIFETIME_FIXED); + if (pI830->textures == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Failed to allocate texture space.\n"); - } - return FALSE; - } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for textures at 0x%lx\n", s, - alloced / 1024, pI830->TexMem.Start); - } - - return TRUE; + return FALSE; + } + } + + return TRUE; } -Bool -I830Allocate3DMemory(ScrnInfoPtr pScrn, const int flags) +static Bool +i830_allocate_hwstatus(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); - unsigned long size, alloced; - Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); - int verbosity = dryrun ? 4 : 1; - const char *s = dryrun ? "[dryrun] " : ""; - - DPRINTF(PFX, "I830Allocate3DMemory\n"); - - /* Space for logical context. 32k is fine for right now. */ - memset(&(pI830->ContextMem), 0, sizeof(pI830->ContextMem)); - pI830->ContextMem.Key = -1; - size = KB(32); - alloced = I830AllocVidMem(pScrn, &(pI830->ContextMem), - &(pI830->StolenPool), size, GTT_PAGE_SIZE, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate logical context space.\n"); - } - return FALSE; - } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for the logical context at 0x%lx.\n", s, - alloced / 1024, pI830->ContextMem.Start); - - if (!I830AllocateBackBuffer(pScrn, flags)) - return FALSE; - - if (!I830AllocateDepthBuffer(pScrn, flags)) - return FALSE; - - if (!I830AllocateTextureMemory(pScrn, flags)) - return FALSE; - - return TRUE; + I830Ptr pI830 = I830PTR(pScrn); + + /* The current DRM will leak the HWS mapping if we update the address + * after init (at best), so allocate it fixed for its lifetime + * (i.e. not through buffer objects). + */ + pI830->hw_status = i830_allocate_memory(pScrn, "G33 hw status", + HWSTATUS_PAGE_SIZE, GTT_PAGE_SIZE, NEED_LIFETIME_FIXED); + if (pI830->hw_status == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to allocate hw status page for G33.\n"); + return FALSE; + } + return TRUE; } -#endif -/* Allocate pool space that isn't pre-allocated */ Bool -I830DoPoolAllocation(ScrnInfoPtr pScrn, I830MemPool *pool) +i830_allocate_3d_memory(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); - - DPRINTF(PFX, "I830DoPoolAllocation\n"); - - if (!pool) - return FALSE; - - /* - * Sanity check: there shouldn't be an allocation required when - * there is only stolen memory. - */ - if (pI830->StolenOnly && (pool->Total.Size > pool->Fixed.Size)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "I830DoPoolAllocation(): pool size is greater than the " - "preallocated size,\n\t" - "and there is no allocatable memory.\n"); - return FALSE; - } - - if (pool->Total.Size > pool->Fixed.Size) { - pool->Allocated.Size = pool->Total.Size - pool->Fixed.Size; - pool->Allocated.Key = xf86AllocateGARTMemory(pScrn->scrnIndex, - pool->Allocated.Size, 0, NULL); - if (pool->Allocated.Key == -1) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Pool allocation failed\n"); - return FALSE; - } - pool->Allocated.Start = pool->Fixed.End; - pool->Allocated.End = pool->Total.Size; - pool->Allocated.Offset = pool->Allocated.Start; - } else - pool->Allocated.Key = -1; - return TRUE; -} + I830Ptr pI830 = I830PTR(pScrn); -static unsigned long topOfMem = 0; + DPRINTF(PFX, "i830_allocate_3d_memory\n"); -/* - * These modify the way memory is positioned within the aperture. - * - * By default, memory allocated from the bottom or specifically within - * the pool at the bottom gets allocated from the "stolen pool", which is - * actually the stolen memory plus any extra allocated to make it a larger - * contiguous region. Memory allocated from the AGP is allocated top-down - * from the end of the aperture space. Memory allocated "from top" defaults - * to AGP if there is enough "free space". The total allocation (stolen + - * extra) doesn't exceed the orignal pScrn->videoRam amount (this isn't true - * when memory allocated from AGP gets moved into the pool by one of the - * following options. - * - * XXX Write a better description. - * - */ -#define PACK_RANGES 0 -#define POOL_RANGES 0 + if (IS_G33CLASS(pI830)) { + if (!i830_allocate_hwstatus(pScrn)) + return FALSE; + } -Bool -I830FixOffset(ScrnInfoPtr pScrn, I830MemRange *mem) -{ -#if POOL_RANGES - I830Ptr pI830 = I830PTR(pScrn); -#endif + if (!i830_allocate_backbuffer(pScrn, &pI830->back_buffer, "back buffer")) + return FALSE; - if (!mem) - return FALSE; - - if (mem->Pool && mem->Key == -1 && mem->Start < 0) { - mem->Start = mem->Pool->Total.End + mem->Start; - mem->End = mem->Start + mem->Size; - } -#if PACK_RANGES - /* - * Map AGP-allocated areas at the top of the stolen area, resulting in - * a contiguous region in the aperture. Normally most AGP-allocated areas - * will be at the top of the aperture, making alignment requirements - * easier to achieve. This optin is primarily for debugging purposes, - * and using this option can break any special alignment requirements. - */ - if (!mem->Pool && mem->Start != 0 && mem->Key != -1 && mem->Physical == 0 && - mem->Offset != 0) { - long diff; - if (mem->Offset != mem->Start) - ErrorF("mem %p, Offset != Start\n", mem); - diff = mem->Offset - topOfMem; - mem->Start -= diff; - mem->End -= diff; - mem->Offset -= diff; - topOfMem += mem->Size; - } -#elif POOL_RANGES - /* - * Move AGP-allocated regions (that don't need a physical address) into - * the pre-allocated pool when there's enough space to do so. Note: the - * AGP-allocated areas aren't freed. This option is primarily for - * debugging purposes, and using it can break any special alignment - * requirements. - */ - if (!mem->Pool && mem->Start >= pI830->StolenPool.Free.End && - mem->Key != -1 && mem->Physical == 0 && mem->Offset != 0 && - pI830->StolenPool.Free.Size >= mem->Size) { - long diff; - if (mem->Offset != mem->Start) - ErrorF("mem %p, Offset != Start\n", mem); - diff = mem->Offset - pI830->StolenPool.Free.Start; - mem->Start -= diff; - mem->End -= diff; - mem->Offset -= diff; - mem->Key = -1; - pI830->StolenPool.Free.Start += mem->Size; - pI830->StolenPool.Free.Size -= mem->Size; - } -#endif - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "%p: Memory at offset 0x%08lx, size %ld kBytes\n", (void *)mem, - mem->Start, mem->Size / 1024); - return TRUE; -} + if (pI830->TripleBuffer && !i830_allocate_backbuffer(pScrn, + &pI830->third_buffer, + "third buffer")) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to allocate third buffer, triple buffering " + "inactive\n"); + } -Bool -I830FixupOffsets(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - DPRINTF(PFX, "I830FixupOffsets\n"); - - topOfMem = pI830->StolenPool.Total.End; - if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) - I830FixOffset(pScrn, &(pI830->FrontBuffer2)); - I830FixOffset(pScrn, &(pI830->FrontBuffer)); - I830FixOffset(pScrn, pI830->CursorMem); - I830FixOffset(pScrn, pI830->CursorMemARGB); - I830FixOffset(pScrn, &(pI830->LpRing->mem)); - I830FixOffset(pScrn, &(pI830->Scratch)); - if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) - I830FixOffset(pScrn, &(pI830->Scratch2)); -#ifdef I830_XV - if (pI830->XvEnabled) { - I830FixOffset(pScrn, pI830->OverlayMem); - if (pI830->LinearAlloc) - I830FixOffset(pScrn, &(pI830->LinearMem)); - } -#endif -#ifdef XF86DRI - if (pI830->directRenderingEnabled) { - I830FixOffset(pScrn, &(pI830->ContextMem)); - I830FixOffset(pScrn, &(pI830->BackBuffer)); - I830FixOffset(pScrn, &(pI830->DepthBuffer)); - if (pI830->mmModeFlags & I830_KERNEL_TEX) { - I830FixOffset(pScrn, &(pI830->TexMem)); - } - } -#endif - return TRUE; + if (!i830_allocate_depthbuffer(pScrn)) + return FALSE; + + if (!i830_allocate_texture_memory(pScrn)) + return FALSE; + + return TRUE; } +#endif -#ifdef XF86DRI -/* Tiled memory is good... really, really good... +/** + * Sets up tiled surface registers ("fences") for the hardware. * - * Need to make it less likely that we miss out on this - probably - * need to move the frontbuffer away from the 'guarenteed' alignment - * of the first memory segment, or perhaps allocate a discontigous - * framebuffer to get more alignment 'sweet spots'. + * The fences control automatic tiled address swizzling for CPU access of the + * framebuffer, and may be used in many rendering operations instead of + * manually supplying tiling enables per surface. */ -static void -SetFence(ScrnInfoPtr pScrn, int nr, unsigned int start, unsigned int pitch, - unsigned int size) +static int +i830_set_tiling(ScrnInfoPtr pScrn, unsigned int offset, + unsigned int pitch, unsigned int size, + enum tile_format tile_format) { - I830Ptr pI830 = I830PTR(pScrn); - I830RegPtr i830Reg = &pI830->ModeReg; - CARD32 val; - CARD32 fence_mask = 0; - unsigned int fence_pitch; - - DPRINTF(PFX, "SetFence: %d, 0x%08x, %d, %d kByte\n", - nr, start, pitch, size / 1024); - - if (nr < 0 || nr > 7) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "SetFence: fence %d out of range\n",nr); - return; - } - - i830Reg->Fence[nr] = 0; - - if (IS_I9XX(pI830)) - fence_mask = ~I915G_FENCE_START_MASK; - else - fence_mask = ~I830_FENCE_START_MASK; - - if (start & fence_mask) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "SetFence: %d: start (0x%08x) is not %s aligned\n", - nr, start, (IS_I9XX(pI830)) ? "1MB" : "512k"); - return; - } - - if (start % size) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "SetFence: %d: start (0x%08x) is not size (%dk) aligned\n", - nr, start, size / 1024); - return; - } - - if (pitch & 127) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "SetFence: %d: pitch (%d) not a multiple of 128 bytes\n", - nr, pitch); - return; - } - - val = (start | FENCE_X_MAJOR | FENCE_VALID); - - if (IS_I9XX(pI830)) { - switch (size) { - case MB(1): - val |= I915G_FENCE_SIZE_1M; - break; - case MB(2): - val |= I915G_FENCE_SIZE_2M; - break; - case MB(4): - val |= I915G_FENCE_SIZE_4M; - break; - case MB(8): - val |= I915G_FENCE_SIZE_8M; - break; - case MB(16): - val |= I915G_FENCE_SIZE_16M; - break; - case MB(32): - val |= I915G_FENCE_SIZE_32M; - break; - case MB(64): - val |= I915G_FENCE_SIZE_64M; - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "SetFence: %d: illegal size (%d kByte)\n", nr, size / 1024); - return; - } - } else { - switch (size) { - case KB(512): - val |= FENCE_SIZE_512K; - break; - case MB(1): - val |= FENCE_SIZE_1M; - break; - case MB(2): - val |= FENCE_SIZE_2M; - break; - case MB(4): - val |= FENCE_SIZE_4M; - break; - case MB(8): - val |= FENCE_SIZE_8M; - break; - case MB(16): - val |= FENCE_SIZE_16M; - break; - case MB(32): - val |= FENCE_SIZE_32M; - break; - case MB(64): - val |= FENCE_SIZE_64M; - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "SetFence: %d: illegal size (%d kByte)\n", nr, size / 1024); - return; - } - } - - if (IS_I9XX(pI830)) - fence_pitch = pitch / 512; - else - fence_pitch = pitch / 128; - - switch (fence_pitch) { - case 1: - val |= FENCE_PITCH_1; - break; - case 2: - val |= FENCE_PITCH_2; - break; - case 4: - val |= FENCE_PITCH_4; - break; - case 8: - val |= FENCE_PITCH_8; - break; - case 16: - val |= FENCE_PITCH_16; - break; - case 32: - val |= FENCE_PITCH_32; - break; - case 64: - val |= FENCE_PITCH_64; - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "SetFence: %d: illegal pitch (%d)\n", nr, pitch); - return; - } - - i830Reg->Fence[nr] = val; -} + I830Ptr pI830 = I830PTR(pScrn); + CARD32 val; + CARD32 fence_mask = 0; + unsigned int fence_pitch; + unsigned int max_fence; + unsigned int fence_nr; -static Bool -MakeTiles(ScrnInfoPtr pScrn, I830MemRange *pMem, unsigned int fence) -{ - I830Ptr pI830 = I830PTR(pScrn); - int pitch, ntiles, i; - -#if 0 - /* Hack to "improve" the alignment of the front buffer. - */ - while (!(pMem->Start & ~pMem->Alignment) && pMem->Alignment < 0x00400000 ) - pMem->Alignment <<= 1; -#endif + DPRINTF(PFX, "i830_set_tiling(): 0x%08x, %d, %d kByte\n", + offset, pitch, size / 1024); + + assert(tile_format != TILE_NONE); - if (tileGeneration != serverGeneration) { - tileGeneration = serverGeneration; - nextTile = 0; - } + if (IS_I965G(pI830)) + max_fence = FENCE_NEW_NR; + else + max_fence = FENCE_NR; - pitch = pScrn->displayWidth * pI830->cpp; + for (fence_nr = 0; fence_nr < max_fence; fence_nr++) { + if (!pI830->fence_used[fence_nr]) + break; + } + if (fence_nr == max_fence) + FatalError("Ran out of fence registers at %d\n", fence_nr); - if (IS_I96X(pI830)) { - I830RegPtr i830Reg = &pI830->ModeReg; + pI830->fence_used[fence_nr] = TRUE; - switch (fence) { - case FENCE_XMAJOR: - i830Reg->Fence[nextTile] = (((pitch / 128) - 1) << 2) | pMem->Start | 1; + if (IS_I965G(pI830)) { + uint32_t fence_start, fence_end; + + switch (tile_format) { + case TILE_XMAJOR: + fence_start = (((pitch / 128) - 1) << 2) | offset | 1; + fence_start |= I965_FENCE_X_MAJOR; break; - case FENCE_YMAJOR: + case TILE_YMAJOR: /* YMajor can be 128B aligned but the current code dictates * otherwise. This isn't a problem apart from memory waste. * FIXME */ - i830Reg->Fence[nextTile] = (((pitch / 128) - 1) << 2) | pMem->Start | 1; - i830Reg->Fence[nextTile] |= (1<<1); - break; - default: - case FENCE_LINEAR: + fence_start = (((pitch / 128) - 1) << 2) | offset | 1; + fence_start |= I965_FENCE_Y_MAJOR; break; - } - - i830Reg->Fence[nextTile+FENCE_NEW_NR] = pMem->End; - nextTile++; - return TRUE; - } - - /* - * Simply try to break the region up into at most four pieces of size - * equal to the alignment. - */ - ntiles = ROUND_TO(pMem->Size, pMem->Alignment) / pMem->Alignment; - if (ntiles >= 4) { - return FALSE; - } - - for (i = 0; i < ntiles; i++, nextTile++) { - SetFence(pScrn, nextTile, pMem->Start + i * pMem->Alignment, - pitch, pMem->Alignment); - } - return TRUE; -} + default: + return -1; + } -void -I830SetupMemoryTiling(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - int i; - - /* Clear out */ - for (i = 0; i < 8; i++) - pI830->ModeReg.Fence[i] = 0; - - nextTile = 0; - tileGeneration = -1; - - /* We currently only attempt to tile the back and depth buffers. */ - if (!pI830->directRenderingEnabled) - return; - - if (!IsTileable(pScrn->displayWidth * pI830->cpp)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "I830SetupMemoryTiling: Not tileable 0x%x\n", - pScrn->displayWidth * pI830->cpp); - pI830->allowPageFlip = FALSE; - return; - } - - pI830->front_tiled = FENCE_LINEAR; - pI830->back_tiled = FENCE_LINEAR; - pI830->depth_tiled = FENCE_LINEAR; - pI830->rotated_tiled = FENCE_LINEAR; - pI830->rotated2_tiled = FENCE_LINEAR; - - if (pI830->allowPageFlip) { - if (pI830->allowPageFlip && pI830->FrontBuffer.Alignment >= KB(512)) { - if (MakeTiles(pScrn, &(pI830->FrontBuffer), FENCE_XMAJOR)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Activating tiled memory for the front buffer\n"); - pI830->front_tiled = FENCE_XMAJOR; - } else { - pI830->allowPageFlip = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "MakeTiles failed for the front buffer\n"); - } - } else { - pI830->allowPageFlip = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Alignment bad for the front buffer\n"); - } - } - - /* - * We tried to get the best alignment during the allocation. Check - * the alignment values to tell. If well-aligned allocations were - * successful, the address range reserved is a multiple of the align - * value. - */ - if (pI830->BackBuffer.Alignment >= KB(512)) { - if (MakeTiles(pScrn, &(pI830->BackBuffer), FENCE_XMAJOR)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Activating tiled memory for the back buffer.\n"); - pI830->back_tiled = FENCE_XMAJOR; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "MakeTiles failed for the back buffer.\n"); - pI830->allowPageFlip = FALSE; - } - } - - if (pI830->DepthBuffer.Alignment >= KB(512)) { - if (MakeTiles(pScrn, &(pI830->DepthBuffer), FENCE_YMAJOR)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Activating tiled memory for the depth buffer.\n"); - pI830->depth_tiled = FENCE_YMAJOR; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "MakeTiles failed for the depth buffer.\n"); - } - } - - if (pI830->RotatedMem.Alignment >= KB(512)) { - if (MakeTiles(pScrn, &(pI830->RotatedMem), FENCE_XMAJOR)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Activating tiled memory for the rotated buffer.\n"); - pI830->rotated_tiled = FENCE_XMAJOR; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "MakeTiles failed for the rotated buffer.\n"); - } - } - -#if 0 - if (pI830->RotatedMem2.Alignment >= KB(512)) { - if (MakeTiles(pScrn, &(pI830->RotatedMem2), FENCE_XMAJOR)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Activating tiled memory for the rotated2 buffer.\n"); - pI830->rotated2_tiled = FENCE_XMAJOR; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "MakeTiles failed for the rotated buffer.\n"); - } - } -#endif -} -#endif /* XF86DRI */ + /* The end marker is the address of the last page in the allocation. */ + fence_end = offset + size - 4096; -static Bool -BindMemRange(ScrnInfoPtr pScrn, I830MemRange *mem) -{ - if (!mem) - return FALSE; + OUTREG(FENCE_NEW + fence_nr * 8, fence_start); + OUTREG(FENCE_NEW + fence_nr * 8 + 4, fence_end); + } else { + if (IS_I9XX(pI830)) + fence_mask = ~I915G_FENCE_START_MASK; + else + fence_mask = ~I830_FENCE_START_MASK; + + if (offset & fence_mask) { + FatalError("i830_set_tiling(): %d: offset (0x%08x) is not %s " + "aligned\n", + fence_nr, offset, (IS_I9XX(pI830)) ? "1MB" : "512k"); + } + + if (offset % size) { + FatalError("i830_set_tiling(): %d: offset (0x%08x) is not " + "size (%dk) aligned\n", + fence_nr, offset, size / 1024); + } + + if (pitch & 127) { + FatalError("i830_set_tiling(): %d: pitch (%d) not a multiple of " + "128 bytes\n", + fence_nr, pitch); + } + + val = offset | FENCE_VALID; + + switch (tile_format) { + case TILE_XMAJOR: + val |= FENCE_X_MAJOR; + break; + case TILE_YMAJOR: + val |= FENCE_Y_MAJOR; + break; + case TILE_NONE: + break; + } + + if (IS_I9XX(pI830)) { + switch (size) { + case MB(1): + val |= I915G_FENCE_SIZE_1M; + break; + case MB(2): + val |= I915G_FENCE_SIZE_2M; + break; + case MB(4): + val |= I915G_FENCE_SIZE_4M; + break; + case MB(8): + val |= I915G_FENCE_SIZE_8M; + break; + case MB(16): + val |= I915G_FENCE_SIZE_16M; + break; + case MB(32): + val |= I915G_FENCE_SIZE_32M; + break; + case MB(64): + val |= I915G_FENCE_SIZE_64M; + break; + default: + FatalError("i830_set_tiling(): %d: illegal size (%d kByte)\n", + fence_nr, size / 1024); + } + } else { + switch (size) { + case KB(512): + val |= FENCE_SIZE_512K; + break; + case MB(1): + val |= FENCE_SIZE_1M; + break; + case MB(2): + val |= FENCE_SIZE_2M; + break; + case MB(4): + val |= FENCE_SIZE_4M; + break; + case MB(8): + val |= FENCE_SIZE_8M; + break; + case MB(16): + val |= FENCE_SIZE_16M; + break; + case MB(32): + val |= FENCE_SIZE_32M; + break; + case MB(64): + val |= FENCE_SIZE_64M; + break; + default: + FatalError("i830_set_tiling(): %d: illegal size (%d kByte)\n", + fence_nr, size / 1024); + } + } + + if ((IS_I945G(pI830) || IS_I945GM(pI830) || IS_G33CLASS(pI830)) && + tile_format == TILE_YMAJOR) + fence_pitch = pitch / 128; + else if (IS_I9XX(pI830)) + fence_pitch = pitch / 512; + else + fence_pitch = pitch / 128; + + switch (fence_pitch) { + case 1: + val |= FENCE_PITCH_1; + break; + case 2: + val |= FENCE_PITCH_2; + break; + case 4: + val |= FENCE_PITCH_4; + break; + case 8: + val |= FENCE_PITCH_8; + break; + case 16: + val |= FENCE_PITCH_16; + break; + case 32: + val |= FENCE_PITCH_32; + break; + case 64: + val |= FENCE_PITCH_64; + break; + default: + FatalError("i830_set_tiling(): %d: illegal pitch (%d)\n", + fence_nr, pitch); + } - if (mem->Key == -1) - return TRUE; + OUTREG(FENCE + fence_nr * 4, val); + } - return xf86BindGARTMemory(pScrn->scrnIndex, mem->Key, mem->Offset); + return fence_nr; } -Bool -I830BindAGPMemory(ScrnInfoPtr pScrn) +static void +i830_clear_tiling(ScrnInfoPtr pScrn, unsigned int fence_nr) { - I830Ptr pI830 = I830PTR(pScrn); + I830Ptr pI830 = I830PTR(pScrn); - DPRINTF(PFX, - "I830BindAGPMemory: StolenOnly is %s, pI830->GttBound is %s\n", - BOOLTOSTRING(pI830->StolenOnly), BOOLTOSTRING(pI830->GttBound)); + if (IS_I965G(pI830)) { + OUTREG(FENCE_NEW + fence_nr * 8, 0); + OUTREG(FENCE_NEW + fence_nr * 8 + 4, 0); + } else { + OUTREG(FENCE + fence_nr * 4, 0); + } + pI830->fence_used[fence_nr] = FALSE; +} - if (pI830->StolenOnly == TRUE) - return TRUE; +/** + * Called at EnterVT to grab the AGP GART and bind our allocations. + * + * In zaphod mode, this will walk the list trying to bind twice, since each + * pI830 points to the same allocation list, but the bind_memory will just + * no-op then. + */ +Bool +i830_bind_all_memory(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); - if (xf86AgpGARTSupported() && !pI830->GttBound) { - if (!xf86AcquireGART(pScrn->scrnIndex)) - return FALSE; + if (pI830->StolenOnly == TRUE || pI830->memory_list == NULL) + return TRUE; -#if REMAP_RESERVED - /* Rebind the pre-allocated region. */ - BindMemRange(pScrn, &(pI830->Dummy)); -#endif + if (xf86AgpGARTSupported() && !pI830->gtt_acquired) { + i830_memory *mem; - if (!BindMemRange(pScrn, &(pI830->StolenPool.Allocated))) - return FALSE; - if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) - if (!BindMemRange(pScrn, &(pI830->FrontBuffer2))) - return FALSE; - if (!BindMemRange(pScrn, &(pI830->FrontBuffer))) - return FALSE; - if (!BindMemRange(pScrn, pI830->CursorMem)) - return FALSE; - if (!BindMemRange(pScrn, pI830->CursorMemARGB)) - return FALSE; - if (!BindMemRange(pScrn, &(pI830->LpRing->mem))) - return FALSE; - if (!BindMemRange(pScrn, &(pI830->Scratch))) - return FALSE; - if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) - if (!BindMemRange(pScrn, &(pI830->Scratch2))) - return FALSE; -#ifdef I830_XV - if (pI830->XvEnabled) { - if (!BindMemRange(pScrn, pI830->OverlayMem)) - return FALSE; - if (pI830->LinearAlloc) - if (!BindMemRange(pScrn, &(pI830->LinearMem))) - return FALSE; - } -#endif - if (pI830->RotatedMem.Start) - if (!BindMemRange(pScrn, &(pI830->RotatedMem))) - return FALSE; - if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2 && - pI830->RotatedMem2.Start) - if (!BindMemRange(pScrn, &(pI830->RotatedMem2))) - return FALSE; -#ifdef XF86DRI - if (pI830->directRenderingEnabled) { - if (!BindMemRange(pScrn, &(pI830->ContextMem))) - return FALSE; - if (!BindMemRange(pScrn, &(pI830->BackBuffer))) - return FALSE; - if (!BindMemRange(pScrn, &(pI830->DepthBuffer))) + if (!xf86AcquireGART(pScrn->scrnIndex)) return FALSE; - if ((pI830->mmModeFlags & I830_KERNEL_TEX) && - !BindMemRange(pScrn, &(pI830->TexMem))) - return FALSE; - } -#endif - pI830->GttBound = 1; - } - return TRUE; -} + pI830->gtt_acquired = TRUE; -static Bool -UnbindMemRange(ScrnInfoPtr pScrn, I830MemRange *mem) -{ - if (!mem) - return FALSE; - - if (mem->Key == -1) - return TRUE; + for (mem = pI830->memory_list->next; mem->next != NULL; + mem = mem->next) + { + if (!i830_bind_memory(pScrn, mem)) { + /* This shouldn't happen */ + FatalError("Couldn't bind memory for %s\n", mem->name); + } + } +#ifdef XF86DRI_MM + for (mem = pI830->bo_list; mem != NULL; mem = mem->next) { + if (!mem->lifetime_fixed_offset && !i830_bind_memory(pScrn, mem)) + FatalError("Couldn't bind memory for BO %s\n", mem->name); + } +#endif + } + i830_update_cursor_offsets(pScrn); - return xf86UnbindGARTMemory(pScrn->scrnIndex, mem->Key); + return TRUE; } - +/** Called at LeaveVT, to unbind all of our AGP allocations. */ Bool -I830UnbindAGPMemory(ScrnInfoPtr pScrn) +i830_unbind_all_memory(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); - - DPRINTF(PFX, - "I830UnbindAGPMemory: StolenOnly is %s, pI830->GttBound is %s\n", - BOOLTOSTRING(pI830->StolenOnly), BOOLTOSTRING(pI830->GttBound)); - - if (pI830->StolenOnly == TRUE) - return TRUE; - - if (xf86AgpGARTSupported() && pI830->GttBound) { - -#if REMAP_RESERVED - /* "unbind" the pre-allocated region. */ - UnbindMemRange(pScrn, &(pI830->Dummy)); + I830Ptr pI830 = I830PTR(pScrn); + + if (pI830->StolenOnly == TRUE) + return TRUE; + + if (xf86AgpGARTSupported() && pI830->gtt_acquired) { + i830_memory *mem; + + for (mem = pI830->memory_list->next; mem->next != NULL; + mem = mem->next) + { + i830_unbind_memory(pScrn, mem); + } +#ifdef XF86DRI_MM + for (mem = pI830->bo_list; mem != NULL; mem = mem->next) { + /* Don't unpin objects which require that their offsets never + * change. + */ + if (!mem->lifetime_fixed_offset) + i830_unbind_memory(pScrn, mem); + } #endif - if (!UnbindMemRange(pScrn, &(pI830->StolenPool.Allocated))) - return FALSE; - if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) - if (!UnbindMemRange(pScrn, &(pI830->FrontBuffer2))) - return FALSE; - if (!UnbindMemRange(pScrn, &(pI830->FrontBuffer))) - return FALSE; - if (!UnbindMemRange(pScrn, pI830->CursorMem)) - return FALSE; - if (!UnbindMemRange(pScrn, pI830->CursorMemARGB)) - return FALSE; - if (!UnbindMemRange(pScrn, &(pI830->LpRing->mem))) - return FALSE; - if (!UnbindMemRange(pScrn, &(pI830->Scratch))) - return FALSE; - if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) - if (!UnbindMemRange(pScrn, &(pI830->Scratch2))) - return FALSE; -#ifdef I830_XV - if (pI830->XvEnabled) { - if (!UnbindMemRange(pScrn, pI830->OverlayMem)) - return FALSE; - if (pI830->LinearAlloc) - if (!UnbindMemRange(pScrn, &(pI830->LinearMem))) - return FALSE; - } -#endif - if (pI830->RotatedMem.Start) - if (!UnbindMemRange(pScrn, &(pI830->RotatedMem))) - return FALSE; - if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2 && - pI830->RotatedMem2.Start) - if (!UnbindMemRange(pScrn, &(pI830->RotatedMem2))) - return FALSE; -#ifdef XF86DRI - if (pI830->directRenderingEnabled) { - if (!UnbindMemRange(pScrn, &(pI830->ContextMem))) - return FALSE; - if (!UnbindMemRange(pScrn, &(pI830->BackBuffer))) - return FALSE; - if (!UnbindMemRange(pScrn, &(pI830->DepthBuffer))) - return FALSE; - if ((pI830->mmModeFlags & I830_KERNEL_TEX) && - !UnbindMemRange(pScrn, &(pI830->TexMem))) - return FALSE; - } -#endif - if (!xf86ReleaseGART(pScrn->scrnIndex)) - return FALSE; + pI830->gtt_acquired = FALSE; - pI830->GttBound = 0; - } + if (!xf86ReleaseGART(pScrn->scrnIndex)) + return FALSE; + } - return TRUE; + return TRUE; } +/** + * Returns the amount of system memory that could potentially be allocated + * from AGP, in kB. + */ long I830CheckAvailableMemory(ScrnInfoPtr pScrn) { - AgpInfoPtr agpinf; - int maxPages; + AgpInfoPtr agpinf; + int maxPages; - if (!xf86AgpGARTSupported() || - !xf86AcquireGART(pScrn->scrnIndex) || - (agpinf = xf86GetAGPInfo(pScrn->scrnIndex)) == NULL || - !xf86ReleaseGART(pScrn->scrnIndex)) - return -1; + if (!xf86AgpGARTSupported() || + !xf86AcquireGART(pScrn->scrnIndex) || + (agpinf = xf86GetAGPInfo(pScrn->scrnIndex)) == NULL || + !xf86ReleaseGART(pScrn->scrnIndex)) + return -1; - maxPages = agpinf->totalPages - agpinf->usedPages; - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "%s: %d kB available\n", - "I830CheckAvailableMemory", maxPages * 4); + maxPages = agpinf->totalPages - agpinf->usedPages; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "%s: %d kB available\n", + "I830CheckAvailableMemory", maxPages * 4); - return maxPages * 4; + return maxPages * 4; } diff --git a/driver/xf86-video-intel/src/i830_randr.c b/driver/xf86-video-intel/src/i830_randr.c deleted file mode 100644 index 0311f2b67..000000000 --- a/driver/xf86-video-intel/src/i830_randr.c +++ /dev/null @@ -1,355 +0,0 @@ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.3 2004/07/30 21:53:09 eich Exp $ */ -/* - * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.7tsi Exp $ - * - * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#include "xf86.h" -#include "os.h" -#include "mibank.h" -#include "globals.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86DDC.h" -#include "mipointer.h" -#include "windowstr.h" -#include <randrstr.h> - -#include "i830.h" - -typedef struct _i830RandRInfo { - int virtualX; - int virtualY; - int mmWidth; - int mmHeight; - int maxX; - int maxY; - Rotation rotation; /* current mode */ - Rotation supported_rotations; /* driver supported */ -} XF86RandRInfoRec, *XF86RandRInfoPtr; - -static int i830RandRIndex; -static int i830RandRGeneration; - -#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) (p)->devPrivates[i830RandRIndex].ptr) - -static int -I830RandRModeRefresh (DisplayModePtr mode) -{ - if (mode->VRefresh) - return (int) (mode->VRefresh + 0.5); - else - return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5); -} - -static Bool -I830RandRGetInfo (ScreenPtr pScreen, Rotation *rotations) -{ - RRScreenSizePtr pSize; - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); - XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); - DisplayModePtr mode; - int refresh0 = 60; - int maxX = 0, maxY = 0; - - *rotations = randrp->supported_rotations; - - if (randrp->virtualX == -1 || randrp->virtualY == -1) - { - randrp->virtualX = scrp->virtualX; - randrp->virtualY = scrp->virtualY; - } - - for (mode = scrp->modes; ; mode = mode->next) - { - int refresh = I830RandRModeRefresh (mode); - if (randrp->maxX == 0 || randrp->maxY == 0) - { - if (maxX < mode->HDisplay) - maxX = mode->HDisplay; - if (maxY < mode->VDisplay) - maxY = mode->VDisplay; - } - if (mode == scrp->modes) - refresh0 = refresh; - pSize = RRRegisterSize (pScreen, - mode->HDisplay, mode->VDisplay, - randrp->mmWidth, randrp->mmHeight); - if (!pSize) - return FALSE; - RRRegisterRate (pScreen, pSize, refresh); - if (mode == scrp->currentMode && - mode->HDisplay == scrp->virtualX && mode->VDisplay == scrp->virtualY) - RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize); - if (mode->next == scrp->modes) - break; - } - - if (randrp->maxX == 0 || randrp->maxY == 0) - { - randrp->maxX = maxX; - randrp->maxY = maxY; - } - - if (scrp->currentMode->HDisplay != randrp->virtualX || - scrp->currentMode->VDisplay != randrp->virtualY) - { - mode = scrp->modes; - pSize = RRRegisterSize (pScreen, - randrp->virtualX, randrp->virtualY, - randrp->mmWidth, - randrp->mmHeight); - if (!pSize) - return FALSE; - RRRegisterRate (pScreen, pSize, refresh0); - if (scrp->virtualX == randrp->virtualX && - scrp->virtualY == randrp->virtualY) - { - RRSetCurrentConfig (pScreen, randrp->rotation, refresh0, pSize); - } - } - - return TRUE; -} - -static Bool -I830RandRSetMode (ScreenPtr pScreen, - DisplayModePtr mode, - Bool useVirtual, - int mmWidth, - int mmHeight) -{ - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); - XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); - int oldWidth = pScreen->width; - int oldHeight = pScreen->height; - int oldmmWidth = pScreen->mmWidth; - int oldmmHeight = pScreen->mmHeight; - WindowPtr pRoot = WindowTable[pScreen->myNum]; - DisplayModePtr currentMode = NULL; - Bool ret = TRUE; - PixmapPtr pspix = NULL; - - if (pRoot) - (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE); - if (useVirtual) - { - scrp->virtualX = randrp->virtualX; - scrp->virtualY = randrp->virtualY; - } - else - { - scrp->virtualX = mode->HDisplay; - scrp->virtualY = mode->VDisplay; - } - if(randrp->rotation & (RR_Rotate_90 | RR_Rotate_270)) - { - /* If the screen is rotated 90 or 270 degrees, swap the sizes. */ - pScreen->width = scrp->virtualY; - pScreen->height = scrp->virtualX; - pScreen->mmWidth = mmHeight; - pScreen->mmHeight = mmWidth; - } - else - { - pScreen->width = scrp->virtualX; - pScreen->height = scrp->virtualY; - pScreen->mmWidth = mmWidth; - pScreen->mmHeight = mmHeight; - } - if (scrp->currentMode == mode) { - /* Save current mode */ - currentMode = scrp->currentMode; - /* Reset, just so we ensure the drivers SwitchMode is called */ - scrp->currentMode = NULL; - } - /* - * We know that if the driver failed to SwitchMode to the rotated - * version, then it should revert back to it's prior mode. - */ - if (!xf86SwitchMode (pScreen, mode)) - { - ret = FALSE; - scrp->virtualX = pScreen->width = oldWidth; - scrp->virtualY = pScreen->height = oldHeight; - pScreen->mmWidth = oldmmWidth; - pScreen->mmHeight = oldmmHeight; - scrp->currentMode = currentMode; - } - /* - * Get the new Screen pixmap ptr as SwitchMode might have called - * ModifyPixmapHeader and xf86EnableDisableFBAccess will put it back... - * Unfortunately. - */ - pspix = (*pScreen->GetScreenPixmap) (pScreen); - if (pspix->devPrivate.ptr) - scrp->pixmapPrivate = pspix->devPrivate; - - /* - * Make sure the layout is correct - */ - xf86ReconfigureLayout(); - - /* - * Make sure the whole screen is visible - */ - xf86SetViewport (pScreen, pScreen->width, pScreen->height); - xf86SetViewport (pScreen, 0, 0); - if (pRoot) - (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE); - return ret; -} - -Bool -I830RandRSetConfig (ScreenPtr pScreen, - Rotation rotation, - int rate, - RRScreenSizePtr pSize) -{ - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); - XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); - DisplayModePtr mode; - int px, py; - Bool useVirtual = FALSE; - int maxX = 0, maxY = 0; - Rotation oldRotation = randrp->rotation; - - randrp->rotation = rotation; - - if (randrp->virtualX == -1 || randrp->virtualY == -1) - { - randrp->virtualX = scrp->virtualX; - randrp->virtualY = scrp->virtualY; - } - - miPointerPosition (&px, &py); - for (mode = scrp->modes; ; mode = mode->next) - { - if (randrp->maxX == 0 || randrp->maxY == 0) - { - if (maxX < mode->HDisplay) - maxX = mode->HDisplay; - if (maxY < mode->VDisplay) - maxY = mode->VDisplay; - } - if (mode->HDisplay == pSize->width && - mode->VDisplay == pSize->height && - (rate == 0 || I830RandRModeRefresh (mode) == rate)) - break; - if (mode->next == scrp->modes) - { - if (pSize->width == randrp->virtualX && - pSize->height == randrp->virtualY) - { - mode = scrp->modes; - useVirtual = TRUE; - break; - } - if (randrp->maxX == 0 || randrp->maxY == 0) - { - randrp->maxX = maxX; - randrp->maxY = maxY; - } - return FALSE; - } - } - - if (randrp->maxX == 0 || randrp->maxY == 0) - { - randrp->maxX = maxX; - randrp->maxY = maxY; - } - - if (!I830RandRSetMode (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) { - randrp->rotation = oldRotation; - return FALSE; - } - - /* - * Move the cursor back where it belongs; SwitchMode repositions it - */ - if (pScreen == miPointerCurrentScreen ()) - { - px = (px >= pScreen->width ? (pScreen->width - 1) : px); - py = (py >= pScreen->height ? (pScreen->height - 1) : py); - - xf86SetViewport(pScreen, px, py); - - (*pScreen->SetCursorPosition) (pScreen, px, py, FALSE); - } - - return TRUE; -} - -Rotation -I830GetRotation(ScreenPtr pScreen) -{ - XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); - - return randrp->rotation; -} - -Bool -I830RandRInit (ScreenPtr pScreen, int rotation) -{ - rrScrPrivPtr rp; - XF86RandRInfoPtr randrp; - -#ifdef PANORAMIX - /* XXX disable RandR when using Xinerama */ - if (!noPanoramiXExtension) - return TRUE; -#endif - if (i830RandRGeneration != serverGeneration) - { - i830RandRIndex = AllocateScreenPrivateIndex(); - i830RandRGeneration = serverGeneration; - } - - randrp = xalloc (sizeof (XF86RandRInfoRec)); - if (!randrp) - return FALSE; - - if (!RRScreenInit(pScreen)) - { - xfree (randrp); - return FALSE; - } - rp = rrGetScrPriv(pScreen); - rp->rrGetInfo = I830RandRGetInfo; - rp->rrSetConfig = I830RandRSetConfig; - - randrp->virtualX = -1; - randrp->virtualY = -1; - randrp->mmWidth = pScreen->mmWidth; - randrp->mmHeight = pScreen->mmHeight; - - randrp->rotation = RR_Rotate_0; /* initial rotated mode */ - - randrp->supported_rotations = rotation; - - randrp->maxX = randrp->maxY = 0; - - pScreen->devPrivates[i830RandRIndex].ptr = randrp; - - return TRUE; -} diff --git a/driver/xf86-video-intel/src/i830_rotate.c b/driver/xf86-video-intel/src/i830_rotate.c deleted file mode 100644 index 020d7e619..000000000 --- a/driver/xf86-video-intel/src/i830_rotate.c +++ /dev/null @@ -1,1239 +0,0 @@ -/* -*- c-basic-offset: 3 -*- */ -/************************************************************************** - -Copyright 2005 Tungsten Graphics, Inc., Cedar Park, Texas. - -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND/OR THEIR 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. - -**************************************************************************/ - -/* - * Reformatted with GNU indent (2.2.8), using the following options: - * - * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 - * -lp -npcs -psl -sob -ss -br -ce -sc -hnl - * - * This provides a good match with the original i810 code and preferred - * XFree86 formatting conventions. - * - * When editing this driver, please follow the existing formatting, and edit - * with <TAB> characters expanded at 8-column intervals. - */ - -/* - * Authors: - * Alan Hourihane <alanh@tungstengraphics.com> - * Brian Paul <brian.paul@tungstengraphics.com> - * Keith Whitwell <keith@tungstengraphics.com> - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <string.h> - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "servermd.h" -#include "shadow.h" - -#include "i830.h" -#include "i915_reg.h" -#include "i915_3d.h" - -#ifdef XF86DRI -#include "dri.h" -#endif - -static void * -I830WindowLinear (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size, - void *closure) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - CARD8 *ptr; - - *size = (pScrn->bitsPerPixel * pI830->displayWidth >> 3); - if (I830IsPrimary(pScrn)) - ptr = (CARD8 *) (pI830->FbBase + pI830->FrontBuffer.Start) + row * (*size) + offset; - else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - ptr = (CARD8 *) (pI830->FbBase + pI8301->FrontBuffer2.Start) + row * (*size) + offset; - } - return (void *)ptr; -} - -struct matrix23 -{ - int m00, m01, m02; - int m10, m11, m12; -}; - -static void -matrix23Set(struct matrix23 *m, - int m00, int m01, int m02, - int m10, int m11, int m12) -{ - m->m00 = m00; m->m01 = m01; m->m02 = m02; - m->m10 = m10; m->m11 = m11; m->m12 = m12; -} - - -/* - * Transform (x,y) coordinate by the given matrix. - */ -static void -matrix23TransformCoordf(const struct matrix23 *m, float *x, float *y) -{ - const float x0 = *x; - const float y0 = *y; - - *x = m->m00 * x0 + m->m01 * y0 + m->m02; - *y = m->m10 * x0 + m->m11 * y0 + m->m12; -} - -/* - * Make rotation matrix for width X height screen. - */ -static void -matrix23Rotate(struct matrix23 *m, int width, int height, int angle) -{ - switch (angle) { - case 0: - matrix23Set(m, 1, 0, 0, 0, 1, 0); - break; - case 90: - matrix23Set(m, 0, 1, 0, -1, 0, width); - break; - case 180: - matrix23Set(m, -1, 0, width, 0, -1, height); - break; - case 270: - matrix23Set(m, 0, -1, height, 1, 0, 0); - break; - default: - break; - } -} - -/* Doesn't matter on the order for our purposes */ -typedef struct { - unsigned char red, green, blue, alpha; -} intel_color_t; - -/* Vertex format */ -typedef union { - struct { - float x, y, z, w; - intel_color_t color; - intel_color_t specular; - float u0, v0; - float u1, v1; - float u2, v2; - float u3, v3; - } v; - float f[24]; - unsigned int ui[24]; - unsigned char ub4[24][4]; -} intelVertex, *intelVertexPtr; - -static void draw_poly(CARD32 *vb, - float verts[][2], - float texcoords[][2]) -{ - int vertex_size = 8; - intelVertex tmp; - int i, k; - - /* initial constant vertex fields */ - tmp.v.z = 1.0; - tmp.v.w = 1.0; - tmp.v.color.red = 255; - tmp.v.color.green = 255; - tmp.v.color.blue = 255; - tmp.v.color.alpha = 255; - tmp.v.specular.red = 0; - tmp.v.specular.green = 0; - tmp.v.specular.blue = 0; - tmp.v.specular.alpha = 0; - - for (k = 0; k < 4; k++) { - tmp.v.x = verts[k][0]; - tmp.v.y = verts[k][1]; - tmp.v.u0 = texcoords[k][0]; - tmp.v.v0 = texcoords[k][1]; - - for (i = 0 ; i < vertex_size ; i++) - vb[i] = tmp.ui[i]; - - vb += vertex_size; - } -} - -static void -I915UpdateRotate (ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - ScrnInfoPtr pScrn1 = pScrn; - I830Ptr pI8301 = NULL; - RegionPtr damage = shadowDamage(pBuf); - int nbox = REGION_NUM_RECTS (damage); - BoxPtr pbox = REGION_RECTS (damage); - int box_x1, box_x2, box_y1, box_y2; - CARD32 vb[32]; /* 32 dword vertex buffer */ - float verts[4][2], tex[4][2]; - struct matrix23 rotMatrix; - int j; - int use_fence; - Bool updateInvarient = FALSE; -#ifdef XF86DRI - drmI830Sarea *sarea = NULL; - drm_context_t myContext = 0; -#endif - Bool didLock = FALSE; - - if (I830IsPrimary(pScrn)) { - pI8301 = pI830; - } else { - pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - pScrn1 = pI830->entityPrivate->pScrn_1; - } - - switch (pI830->rotation) { - case RR_Rotate_90: - matrix23Rotate(&rotMatrix, - pScreen->width, pScreen->height, - 90); - break; - case RR_Rotate_180: - matrix23Rotate(&rotMatrix, - pScreen->width, pScreen->height, - 180); - break; - case RR_Rotate_270: - matrix23Rotate(&rotMatrix, - pScreen->width, pScreen->height, - 270); - break; - default: - break; - } - -#ifdef XF86DRI - if (pI8301->directRenderingEnabled) { - sarea = DRIGetSAREAPrivate(pScrn1->pScreen); - myContext = DRIGetContext(pScrn1->pScreen); - didLock = I830DRILock(pScrn1); - } -#endif - - if (pScrn->scrnIndex != *pI830->used3D) - updateInvarient = TRUE; - -#ifdef XF86DRI - if (sarea && sarea->ctxOwner != myContext) - updateInvarient = TRUE; -#endif - - if (updateInvarient) { - FS_LOCALS(3); - *pI830->used3D = pScrn->scrnIndex; -#ifdef XF86DRI - if (sarea) - sarea->ctxOwner = myContext; -#endif - BEGIN_LP_RING(54); - /* invarient state */ - OUT_RING(MI_NOOP); - OUT_RING(_3DSTATE_AA_CMD | - AA_LINE_ECAAR_WIDTH_ENABLE | AA_LINE_ECAAR_WIDTH_1_0 | - AA_LINE_REGION_WIDTH_ENABLE | AA_LINE_REGION_WIDTH_1_0); - - OUT_RING(_3DSTATE_DFLT_DIFFUSE_CMD); - OUT_RING(0x00000000); - - OUT_RING(_3DSTATE_DFLT_SPEC_CMD); - OUT_RING(0x00000000); - - OUT_RING(_3DSTATE_DFLT_Z_CMD); - OUT_RING(0x00000000); - - OUT_RING(_3DSTATE_COORD_SET_BINDINGS | - CSB_TCB(0, 0) | CSB_TCB(1, 1) | - CSB_TCB(2, 2) | CSB_TCB(3, 3) | - CSB_TCB(4, 4) | CSB_TCB(5, 5) | - CSB_TCB(6, 6) | CSB_TCB(7, 7)); - - OUT_RING(_3DSTATE_RASTER_RULES_CMD | - ENABLE_TRI_FAN_PROVOKE_VRTX | TRI_FAN_PROVOKE_VRTX(2) | - ENABLE_LINE_STRIP_PROVOKE_VRTX | LINE_STRIP_PROVOKE_VRTX(1) | - ENABLE_TEXKILL_3D_4D | TEXKILL_4D | - ENABLE_POINT_RASTER_RULE | OGL_POINT_RASTER_RULE); - - OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(3) | 1); - OUT_RING(0x00000000); - - /* flush map & render cache */ - OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE); - OUT_RING(0x00000000); - - /* draw rect */ - OUT_RING(_3DSTATE_DRAW_RECT_CMD); - OUT_RING(DRAW_DITHER_OFS_X(0) | DRAW_DITHER_OFS_Y(0)); - OUT_RING(DRAW_XMIN(0) | DRAW_YMIN(0)); - OUT_RING(DRAW_XMAX(pScrn->virtualX - 1) | - DRAW_YMAX(pScrn->virtualY - 1)); - OUT_RING(DRAW_XORG(0) | DRAW_YORG(0)); - - OUT_RING(MI_NOOP); - - OUT_RING(_3DSTATE_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT); - OUT_RING(_3DSTATE_SCISSOR_RECT_0_CMD); - OUT_RING(0x00000000); /* ymin, xmin */ - OUT_RING(0x00000000); /* ymax, xmax */ - - OUT_RING(0x7c000003); /* XXX: magic numbers */ - OUT_RING(0x7d070000); - OUT_RING(0x00000000); - OUT_RING(0x68000002); - - /* context setup */ - OUT_RING(_3DSTATE_MODES_4_CMD | - ENABLE_LOGIC_OP_FUNC | LOGIC_OP_FUNC(LOGICOP_COPY) | - MODE4_ENABLE_STENCIL_WRITE_MASK | - MODE4_ENABLE_STENCIL_TEST_MASK); - - OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | - I1_LOAD_S(2) | I1_LOAD_S(4) | I1_LOAD_S(5) | I1_LOAD_S(6) | 4); - - OUT_RING(S2_TEXCOORD_FMT(0, TEXCOORDFMT_2D) | - S2_TEXCOORD_FMT(1, TEXCOORDFMT_NOT_PRESENT) | - S2_TEXCOORD_FMT(2, TEXCOORDFMT_NOT_PRESENT) | - S2_TEXCOORD_FMT(3, TEXCOORDFMT_NOT_PRESENT) | - S2_TEXCOORD_FMT(4, TEXCOORDFMT_NOT_PRESENT) | - S2_TEXCOORD_FMT(5, TEXCOORDFMT_NOT_PRESENT) | - S2_TEXCOORD_FMT(6, TEXCOORDFMT_NOT_PRESENT) | - S2_TEXCOORD_FMT(7, TEXCOORDFMT_NOT_PRESENT)); - OUT_RING((1 << S4_POINT_WIDTH_SHIFT) | S4_LINE_WIDTH_ONE | - S4_CULLMODE_NONE | S4_VFMT_SPEC_FOG | S4_VFMT_COLOR | - S4_VFMT_XYZW); - OUT_RING(0x00000000); /* S5 -- enable bits */ - OUT_RING((2 << S6_DEPTH_TEST_FUNC_SHIFT) | - (2 << S6_CBUF_SRC_BLEND_FACT_SHIFT) | - (1 << S6_CBUF_DST_BLEND_FACT_SHIFT) | S6_COLOR_WRITE_ENABLE | - (2 << S6_TRISTRIP_PV_SHIFT)); - - OUT_RING(_3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD | - IAB_MODIFY_ENABLE | - IAB_MODIFY_FUNC | (BLENDFUNC_ADD << IAB_FUNC_SHIFT) | - IAB_MODIFY_SRC_FACTOR | - (BLENDFACT_ONE << IAB_SRC_FACTOR_SHIFT) | - IAB_MODIFY_DST_FACTOR | - (BLENDFACT_ZERO << IAB_DST_FACTOR_SHIFT)); - - OUT_RING(_3DSTATE_CONST_BLEND_COLOR_CMD); - OUT_RING(0x00000000); - - OUT_RING(_3DSTATE_DST_BUF_VARS_CMD); - if (pI830->cpp == 1) { - OUT_RING(LOD_PRECLAMP_OGL | DSTORG_HORT_BIAS(0x8) | - DSTORG_VERT_BIAS(0x8) | COLR_BUF_8BIT); - } else if (pI830->cpp == 2) { - OUT_RING(LOD_PRECLAMP_OGL | DSTORG_HORT_BIAS(0x8) | - DSTORG_VERT_BIAS(0x8) | COLR_BUF_RGB565); - } else { - OUT_RING(LOD_PRECLAMP_OGL | DSTORG_HORT_BIAS(0x8) | - DSTORG_VERT_BIAS(0x8) | COLR_BUF_ARGB8888 | - DEPTH_FRMT_24_FIXED_8_OTHER); - } - - OUT_RING(_3DSTATE_STIPPLE); - OUT_RING(0x00000000); - - /* texture sampler state */ - OUT_RING(_3DSTATE_SAMPLER_STATE | 3); - OUT_RING(0x00000001); - OUT_RING(0x00000000); - OUT_RING(0x00000000); - OUT_RING(0x00000000); - - /* front buffer, pitch, offset */ - OUT_RING(_3DSTATE_BUF_INFO_CMD); - OUT_RING(BUF_3D_ID_COLOR_BACK | BUF_3D_USE_FENCE | - BUF_3D_PITCH(pI830->displayWidth * pI830->cpp)); - if (I830IsPrimary(pScrn)) - OUT_RING(pI830->FrontBuffer.Start); - else - OUT_RING(pI8301->FrontBuffer2.Start); - - /* Set the entire frontbuffer up as a texture */ - OUT_RING(_3DSTATE_MAP_STATE | 3); - OUT_RING(0x00000001); - - if (I830IsPrimary(pScrn)) - OUT_RING(pI830->RotatedMem.Start); - else - OUT_RING(pI8301->RotatedMem2.Start); - - if (pI830->disableTiling) - use_fence = 0; - else - use_fence = MS3_USE_FENCE_REGS; - - if (pI830->cpp == 1) - use_fence |= MAPSURF_8BIT; - else - if (pI830->cpp == 2) - use_fence |= MAPSURF_16BIT; - else - use_fence |= MAPSURF_32BIT; - OUT_RING(use_fence | (pScreen->height - 1) << 21 | (pScreen->width - 1) << 10); - OUT_RING(((((pScrn->displayWidth * pI830->cpp) / 4) - 1) << 21)); - ADVANCE_LP_RING(); - - /* fragment program - texture blend replace*/ - FS_BEGIN(); - i915_fs_dcl(FS_S0); - i915_fs_dcl(FS_T0); - i915_fs_texld(FS_OC, FS_S0, FS_T0); - FS_END(); - } - - { - BEGIN_LP_RING(2); - OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE); - OUT_RING(0x00000000); - ADVANCE_LP_RING(); - } - - while (nbox--) - { - box_x1 = pbox->x1; - box_y1 = pbox->y1; - box_x2 = pbox->x2; - box_y2 = pbox->y2; - pbox++; - - BEGIN_LP_RING(40); - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - - /* vertex data */ - OUT_RING(PRIM3D_INLINE | PRIM3D_TRIFAN | (32 - 1)); - verts[0][0] = box_x1; verts[0][1] = box_y1; - verts[1][0] = box_x2; verts[1][1] = box_y1; - verts[2][0] = box_x2; verts[2][1] = box_y2; - verts[3][0] = box_x1; verts[3][1] = box_y2; - tex[0][0] = box_x1; tex[0][1] = box_y1; - tex[1][0] = box_x2; tex[1][1] = box_y1; - tex[2][0] = box_x2; tex[2][1] = box_y2; - tex[3][0] = box_x1; tex[3][1] = box_y2; - - /* transform coordinates to rotated versions, but leave texcoords unchanged */ - for (j = 0; j < 4; j++) - matrix23TransformCoordf(&rotMatrix, &verts[j][0], &verts[j][1]); - - /* emit vertex buffer */ - draw_poly(vb, verts, tex); - for (j = 0; j < 32; j++) - OUT_RING(vb[j]); - - ADVANCE_LP_RING(); - } - -#ifdef XF86DRI - if (didLock) - I830DRIUnlock(pScrn1); -#endif -} - -static void -I830UpdateRotate (ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - I830Ptr pI8301 = NULL; - ScrnInfoPtr pScrn1 = pScrn; - RegionPtr damage = shadowDamage(pBuf); - int nbox = REGION_NUM_RECTS (damage); - BoxPtr pbox = REGION_RECTS (damage); - int box_x1, box_x2, box_y1, box_y2; - CARD32 vb[32]; /* 32 dword vertex buffer */ - float verts[4][2], tex[4][2]; - struct matrix23 rotMatrix; - Bool updateInvarient = FALSE; - int use_fence; - int j; -#ifdef XF86DRI - drmI830Sarea *sarea = NULL; - drm_context_t myContext = 0; -#endif - Bool didLock = FALSE; - - if (I830IsPrimary(pScrn)) { - pI8301 = pI830; - } else { - pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - pScrn1 = pI830->entityPrivate->pScrn_1; - } - - switch (pI830->rotation) { - case RR_Rotate_90: - matrix23Rotate(&rotMatrix, - pScreen->width, pScreen->height, - 90); - break; - case RR_Rotate_180: - matrix23Rotate(&rotMatrix, - pScreen->width, pScreen->height, - 180); - break; - case RR_Rotate_270: - matrix23Rotate(&rotMatrix, - pScreen->width, pScreen->height, - 270); - break; - default: - break; - } - -#ifdef XF86DRI - if (pI8301->directRenderingEnabled) { - sarea = DRIGetSAREAPrivate(pScrn1->pScreen); - myContext = DRIGetContext(pScrn1->pScreen); - didLock = I830DRILock(pScrn1); - } -#endif - - if (pScrn->scrnIndex != *pI830->used3D) - updateInvarient = TRUE; - -#ifdef XF86DRI - if (sarea && sarea->ctxOwner != myContext) - updateInvarient = TRUE; -#endif - - if (updateInvarient) { - *pI830->used3D = pScrn->scrnIndex; -#ifdef XF86DRI - if (sarea) - sarea->ctxOwner = myContext; -#endif - - BEGIN_LP_RING(48); - OUT_RING(0x682008a1); - OUT_RING(0x6f402100); - OUT_RING(0x62120aa9); - OUT_RING(0x76b3ffff); - OUT_RING(0x6c818a01); - OUT_RING(0x6ba008a1); - OUT_RING(0x69802100); - OUT_RING(0x63a00aaa); - OUT_RING(0x6423070e); - OUT_RING(0x66014142); - OUT_RING(0x75000000); - OUT_RING(0x7d880000); - OUT_RING(0x00000000); - OUT_RING(0x650001c4); - OUT_RING(0x6a000000); - OUT_RING(0x7d020000); - OUT_RING(0x0000ba98); - - /* flush map & render cache */ - OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE); - OUT_RING(0x00000000); - /* draw rect */ - OUT_RING(_3DSTATE_DRAW_RECT_CMD); - OUT_RING(0x00000000); /* flags */ - OUT_RING(0x00000000); /* ymin, xmin */ - OUT_RING((pScrn->virtualX - 1) | (pScrn->virtualY - 1) << 16); /* ymax, xmax */ - OUT_RING(0x00000000); /* yorigin, xorigin */ - OUT_RING(MI_NOOP); - - /* front buffer */ - OUT_RING(_3DSTATE_BUF_INFO_CMD); - OUT_RING(0x03800000 | (((pI830->displayWidth * pI830->cpp) / 4) << 2)); - if (I830IsPrimary(pScrn)) - OUT_RING(pI830->FrontBuffer.Start); - else - OUT_RING(pI8301->FrontBuffer2.Start); - OUT_RING(0x7d850000); - if (pI830->cpp == 1) - OUT_RING(0x00880000); - else - if (pI830->cpp == 2) - OUT_RING(0x00880200); - else - OUT_RING(0x00880308); - /* scissor */ - OUT_RING(0x7c800002); - OUT_RING(0x7d810001); - OUT_RING(0x00000000); - OUT_RING(0x00000000); - /* stipple */ - OUT_RING(0x7d830000); - OUT_RING(0x00000000); - - /* texture blend replace */ - OUT_RING(0x7c088088); - OUT_RING(0x00000000); - OUT_RING(0x6d021181); - OUT_RING(0x6d060101); - OUT_RING(0x6e008046); - OUT_RING(0x6e048046); - - - /* Set the entire frontbuffer up as a texture */ - OUT_RING(0x7d030804); - - if (pI830->disableTiling) - use_fence = 0; - else - use_fence = 2; - - if (I830IsPrimary(pScrn)) - OUT_RING(pI830->RotatedMem.Start | use_fence); - else - OUT_RING(pI8301->RotatedMem2.Start | use_fence); - - if (pI830->cpp == 1) - OUT_RING(0x40 | (pScreen->height - 1) << 21 | (pScreen->width - 1) << 10); - else if (pI830->cpp == 2) - OUT_RING(0x80 | (pScreen->height - 1) << 21 | (pScreen->width - 1) << 10); - else - OUT_RING(0xc0 | (pScreen->height - 1) << 21 | (pScreen->width - 1) << 10); - - OUT_RING((((pScrn->displayWidth * pI830->cpp / 4) - 1) << 21)); - OUT_RING(0x00000000); - OUT_RING(0x00000000); - - - ADVANCE_LP_RING(); - } - - { - BEGIN_LP_RING(2); - /* flush map & render cache */ - OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE); - OUT_RING(0x00000000); - ADVANCE_LP_RING(); - } - - while (nbox--) - { - box_x1 = pbox->x1; - box_y1 = pbox->y1; - box_x2 = pbox->x2; - box_y2 = pbox->y2; - pbox++; - - BEGIN_LP_RING(40); - - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - - /* vertex data */ - OUT_RING(0x7f0c001f); - verts[0][0] = box_x1; verts[0][1] = box_y1; - verts[1][0] = box_x2; verts[1][1] = box_y1; - verts[2][0] = box_x2; verts[2][1] = box_y2; - verts[3][0] = box_x1; verts[3][1] = box_y2; - tex[0][0] = box_x1; tex[0][1] = box_y1; - tex[1][0] = box_x2; tex[1][1] = box_y1; - tex[2][0] = box_x2; tex[2][1] = box_y2; - tex[3][0] = box_x1; tex[3][1] = box_y2; - - /* transform coordinates to rotated versions, but leave texcoords unchanged */ - for (j = 0; j < 4; j++) - matrix23TransformCoordf(&rotMatrix, &verts[j][0], &verts[j][1]); - - /* emit vertex buffer */ - draw_poly(vb, verts, tex); - for (j = 0; j < 32; j++) - OUT_RING(vb[j]); - - OUT_RING(0x05000000); - OUT_RING(0x00000000); - - ADVANCE_LP_RING(); - } - - { - BEGIN_LP_RING(2); - /* flush map & render cache */ - OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE); - OUT_RING(0x00000000); - ADVANCE_LP_RING(); - } - -#ifdef XF86DRI - if (didLock) - I830DRIUnlock(pScrn1); -#endif -} - -Bool -I830Rotate(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - I830Ptr pI830 = I830PTR(pScrn); - I830Ptr pI8301 = NULL; - I830Ptr pI8302 = NULL; - ScrnInfoPtr pScrn1 = NULL; - ScrnInfoPtr pScrn2 = NULL; - int i; - ShadowUpdateProc func = NULL; - Rotation oldRotation = pI830->rotation; /* save old state */ - int displayWidth = pScrn->displayWidth; /* save displayWidth */ - Bool reAllocate = TRUE; - Bool didLock = FALSE; - - /* Good pitches to allow tiling. Don't care about pitches < 1024. */ - static const int pitches[] = { -/* - 128 * 2, - 128 * 4, -*/ - 128 * 8, - 128 * 16, - 128 * 32, - 128 * 64, - 0 - }; - - if (pI830->noAccel) - func = LoaderSymbol("shadowUpdateRotatePacked"); - else - if (IS_I9XX(pI830)) - func = I915UpdateRotate; - else - func = I830UpdateRotate; - - if (I830IsPrimary(pScrn)) { - pI8301 = pI830; - pScrn1 = pScrn; - if (pI830->entityPrivate) { - pI8302 = I830PTR(pI830->entityPrivate->pScrn_2); - pScrn2 = pI830->entityPrivate->pScrn_2; - } - } else { - pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - pScrn1 = pI830->entityPrivate->pScrn_1; - pI8302 = pI830; - pScrn2 = pScrn; - } - - pI830->rotation = I830GetRotation(pScrn->pScreen); - - /* Check if we've still got the same orientation, or same mode */ - if (pI830->rotation == oldRotation && pI830->currentMode == mode) -#if 0 - reAllocate = FALSE; -#else - return TRUE; -#endif - - /* - * We grab the DRI lock when reallocating buffers to avoid DRI clients - * getting bogus information. - */ - -#ifdef XF86DRI - if (pI8301->directRenderingEnabled && reAllocate) { - didLock = I830DRILock(pScrn1); - - /* Do heap teardown here - */ - { - drmI830MemDestroyHeap destroy; - destroy.region = I830_MEM_REGION_AGP; - - if (drmCommandWrite(pI8301->drmSubFD, - DRM_I830_DESTROY_HEAP, - &destroy, sizeof(destroy))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[dri] I830 destroy heap failed\n"); - } - } - - - if (pI8301->TexMem.Key != -1) - xf86UnbindGARTMemory(pScrn1->scrnIndex, pI8301->TexMem.Key); - I830FreeVidMem(pScrn1, &(pI8301->TexMem)); - if (pI8301->StolenPool.Allocated.Key != -1) { - xf86UnbindGARTMemory(pScrn1->scrnIndex, pI8301->StolenPool.Allocated.Key); - xf86DeallocateGARTMemory(pScrn1->scrnIndex, pI8301->StolenPool.Allocated.Key); - } - if (pI8301->DepthBuffer.Key != -1) - xf86UnbindGARTMemory(pScrn1->scrnIndex, pI8301->DepthBuffer.Key); - I830FreeVidMem(pScrn1, &(pI8301->DepthBuffer)); - if (pI8301->BackBuffer.Key != -1) - xf86UnbindGARTMemory(pScrn1->scrnIndex, pI8301->BackBuffer.Key); - I830FreeVidMem(pScrn1, &(pI8301->BackBuffer)); - } -#endif - - if (reAllocate) { - *pI830->used3D |= 1<<31; /* use high bit to denote new rotation occured */ - - if (pI8301->RotatedMem.Key != -1) - xf86UnbindGARTMemory(pScrn1->scrnIndex, pI8301->RotatedMem.Key); - - I830FreeVidMem(pScrn1, &(pI8301->RotatedMem)); - memset(&(pI8301->RotatedMem), 0, sizeof(pI8301->RotatedMem)); - pI8301->RotatedMem.Key = -1; - - if (pI830->entityPrivate) { - if (pI8301->RotatedMem2.Key != -1) - xf86UnbindGARTMemory(pScrn1->scrnIndex, pI8301->RotatedMem2.Key); - - I830FreeVidMem(pScrn1, &(pI8301->RotatedMem2)); - memset(&(pI8301->RotatedMem2), 0, sizeof(pI8301->RotatedMem2)); - pI8301->RotatedMem2.Key = -1; - } - } - - switch (pI830->rotation) { - case RR_Rotate_0: - if (reAllocate) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Rotating Screen to 0 degrees\n"); - pScrn->displayWidth = pI830->displayWidth; - break; - case RR_Rotate_90: - if (reAllocate) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Rotating Screen to 90 degrees\n"); - pScrn->displayWidth = pScrn->pScreen->width; - break; - case RR_Rotate_180: - if (reAllocate) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Rotating Screen to 180 degrees\n"); - pScrn->displayWidth = pI830->displayWidth; - break; - case RR_Rotate_270: - if (reAllocate) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Rotating Screen to 270 degrees\n"); - pScrn->displayWidth = pScrn->pScreen->width; - break; - } - - /* As DRI doesn't run on the secondary head, we know that disableTiling - * is always TRUE. - */ - if (I830IsPrimary(pScrn) && !pI830->disableTiling) { -#if 0 - int dWidth = pScrn->displayWidth; /* save current displayWidth */ -#endif - - for (i = 0; pitches[i] != 0; i++) { - if (pitches[i] >= pScrn->displayWidth) { - pScrn->displayWidth = pitches[i]; - break; - } - } - - /* - * If the displayWidth is a tilable pitch, test if there's enough - * memory available to enable tiling. - */ - if (pScrn->displayWidth == pitches[i]) { - /* TODO */ - } - } - - if (reAllocate) { - if (pI830->entityPrivate) { - if (pI8302->rotation != RR_Rotate_0) { - if (!I830AllocateRotated2Buffer(pScrn1, - pI8302->disableTiling ? ALLOC_NO_TILING : 0)) - goto BAIL0; - - I830FixOffset(pScrn1, &(pI8301->RotatedMem2)); - if (pI8301->RotatedMem2.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->RotatedMem2.Key, pI8301->RotatedMem2.Offset); - } - } - - if (pI8301->rotation != RR_Rotate_0) { - if (!I830AllocateRotatedBuffer(pScrn1, - pI8301->disableTiling ? ALLOC_NO_TILING : 0)) - goto BAIL1; - - I830FixOffset(pScrn1, &(pI8301->RotatedMem)); - if (pI8301->RotatedMem.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->RotatedMem.Key, pI8301->RotatedMem.Offset); - } - } - - shadowRemove (pScrn->pScreen, NULL); - if (pI830->rotation != RR_Rotate_0) - shadowAdd (pScrn->pScreen, - (*pScrn->pScreen->GetScreenPixmap) (pScrn->pScreen), - func, I830WindowLinear, pI830->rotation, 0); - - if (I830IsPrimary(pScrn)) { - if (pI830->rotation != RR_Rotate_0) - pScrn->fbOffset = pI830->RotatedMem.Start; - else - pScrn->fbOffset = pI830->FrontBuffer.Start; - if (pI830->entityPrivate) { - if (pI8302->rotation != RR_Rotate_0) - pScrn2->fbOffset = pI8301->RotatedMem2.Start; - else - pScrn2->fbOffset = pI8301->FrontBuffer2.Start; - I830SelectBuffer(pScrn2, I830_SELECT_FRONT); - } - } else { - if (pI830->rotation != RR_Rotate_0) - pScrn->fbOffset = pI8301->RotatedMem2.Start; - else - pScrn->fbOffset = pI8301->FrontBuffer2.Start; - if (pI8301->rotation != RR_Rotate_0) - pScrn1->fbOffset = pI8301->RotatedMem.Start; - else - pScrn1->fbOffset = pI8301->FrontBuffer.Start; - I830SelectBuffer(pScrn1, I830_SELECT_FRONT); - } - I830SelectBuffer(pScrn, I830_SELECT_FRONT); - -#ifdef XF86DRI - if (pI8301->directRenderingEnabled && reAllocate) { - if (!I830AllocateBackBuffer(pScrn1, - pI8301->disableTiling ? ALLOC_NO_TILING : 0)) - goto BAIL2; - - if (!I830AllocateDepthBuffer(pScrn1, - pI8301->disableTiling ? ALLOC_NO_TILING : 0)) - goto BAIL3; - - if (!I830AllocateTextureMemory(pScrn1, - pI8301->disableTiling ? ALLOC_NO_TILING : 0)) - goto BAIL4; - - I830DoPoolAllocation(pScrn1, &(pI8301->StolenPool)); - - I830FixOffset(pScrn1, &(pI8301->BackBuffer)); - I830FixOffset(pScrn1, &(pI8301->DepthBuffer)); - - if (pI8301->BackBuffer.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->BackBuffer.Key, pI8301->BackBuffer.Offset); - if (pI8301->DepthBuffer.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->DepthBuffer.Key, pI8301->DepthBuffer.Offset); - if (pI8301->StolenPool.Allocated.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->StolenPool.Allocated.Key, pI8301->StolenPool.Allocated.Offset); - if (pI8301->TexMem.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->TexMem.Key, pI8301->TexMem.Offset); - I830SetupMemoryTiling(pScrn1); - /* update fence registers */ - for (i = 0; i < 8; i++) - OUTREG(FENCE + i * 4, pI8301->ModeReg.Fence[i]); - { - drmI830Sarea *sarea = DRIGetSAREAPrivate(pScrn1->pScreen); - I830UpdateDRIBuffers(pScrn1, sarea ); - } - - if (didLock) - I830DRIUnlock(pScrn1); - } -#endif - -#if 0 - if (I830IsPrimary(pScrn)) { - pI830->xoffset = (pI830->FrontBuffer.Start / pI830->cpp) % pI830->displayWidth; - pI830->yoffset = (pI830->FrontBuffer.Start / pI830->cpp) / pI830->displayWidth; - } else { - I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); - pI830->xoffset = (pI8301->FrontBuffer2.Start / pI830->cpp) % pI830->displayWidth; - pI830->yoffset = (pI8301->FrontBuffer2.Start / pI830->cpp) / pI830->displayWidth; - } -#endif - - pScrn->pScreen->ModifyPixmapHeader((*pScrn->pScreen->GetScreenPixmap)(pScrn->pScreen), pScrn->pScreen->width, - pScrn->pScreen->height, pScrn->pScreen->rootDepth, pScrn->bitsPerPixel, - PixmapBytePad(pScrn->displayWidth, pScrn->pScreen->rootDepth), - (pointer)(pI8301->FbBase + pScrn->fbOffset)); - - if (pI830->entityPrivate) { - if (I830IsPrimary(pScrn)) { - if (!pI830->starting) { - pScrn2->pScreen->ModifyPixmapHeader((*pScrn2->pScreen->GetScreenPixmap)(pScrn2->pScreen), pScrn2->pScreen->width, - pScrn2->pScreen->height, pScrn2->pScreen->rootDepth, pScrn2->bitsPerPixel, - PixmapBytePad(pScrn2->displayWidth, pScrn2->pScreen->rootDepth), - (pointer)(pI8301->FbBase + pScrn2->fbOffset)); - - /* Repaint the second head */ - (*pScrn2->EnableDisableFBAccess) (pScrn2->pScreen->myNum, FALSE); - (*pScrn2->EnableDisableFBAccess) (pScrn2->pScreen->myNum, TRUE); - } - } else { - if (!pI830->starting) { - pScrn1->pScreen->ModifyPixmapHeader((*pScrn1->pScreen->GetScreenPixmap)(pScrn1->pScreen), pScrn1->pScreen->width, - pScrn1->pScreen->height, pScrn1->pScreen->rootDepth, pScrn1->bitsPerPixel, - PixmapBytePad(pScrn1->displayWidth, pScrn1->pScreen->rootDepth), - (pointer)(pI8301->FbBase + pScrn1->fbOffset)); - - /* Repaint the first head */ - (*pScrn1->EnableDisableFBAccess) (pScrn1->pScreen->myNum, FALSE); - (*pScrn1->EnableDisableFBAccess) (pScrn1->pScreen->myNum, TRUE); - } - } - } - - /* Don't allow pixmap cache or offscreen pixmaps when rotated */ - /* XAA needs some serious fixing for this to happen */ - if (pI830->rotation == RR_Rotate_0) { - pI830->AccelInfoRec->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS | PIXMAP_CACHE; - pI830->AccelInfoRec->UsingPixmapCache = TRUE; - /* funny as it seems this will enable XAA's createpixmap */ - pI830->AccelInfoRec->maxOffPixWidth = 0; - pI830->AccelInfoRec->maxOffPixHeight = 0; - } else { - pI830->AccelInfoRec->Flags = LINEAR_FRAMEBUFFER; - pI830->AccelInfoRec->UsingPixmapCache = FALSE; - /* funny as it seems this will disable XAA's createpixmap */ - pI830->AccelInfoRec->maxOffPixWidth = 1; - pI830->AccelInfoRec->maxOffPixHeight = 1; - } - - return TRUE; - -BAIL4: -#ifdef XF86DRI - if (pI8301->directRenderingEnabled) - I830FreeVidMem(pScrn1, &(pI8301->DepthBuffer)); -#endif -BAIL3: -#ifdef XF86DRI - if (pI8301->directRenderingEnabled) - I830FreeVidMem(pScrn1, &(pI8301->BackBuffer)); -#endif -BAIL2: - if (pI8301->rotation != RR_Rotate_0) { - if (pI8301->RotatedMem.Key != -1) - xf86UnbindGARTMemory(pScrn1->scrnIndex, pI8301->RotatedMem.Key); - - I830FreeVidMem(pScrn1, &(pI8301->RotatedMem)); - memset(&(pI8301->RotatedMem), 0, sizeof(pI8301->RotatedMem)); - pI8301->RotatedMem.Key = -1; - } -BAIL1: - if (pI830->entityPrivate) { - if (pI8302->rotation != RR_Rotate_0) { - if (pI8301->RotatedMem.Key != -1) - xf86UnbindGARTMemory(pScrn1->scrnIndex, pI8301->RotatedMem.Key); - - I830FreeVidMem(pScrn1, &(pI8301->RotatedMem)); - memset(&(pI8301->RotatedMem), 0, sizeof(pI8301->RotatedMem)); - pI8301->RotatedMem.Key = -1; - } - } -BAIL0: - pScrn->displayWidth = displayWidth; - - /* must flip mmWidth & mmHeight */ - if ( ((oldRotation & (RR_Rotate_90 | RR_Rotate_270)) && - (pI830->rotation & (RR_Rotate_0 | RR_Rotate_180))) || - ((oldRotation & (RR_Rotate_0 | RR_Rotate_180)) && - (pI830->rotation & (RR_Rotate_90 | RR_Rotate_270))) ) { - int tmp = pScrn->pScreen->mmWidth; - pScrn->pScreen->mmWidth = pScrn->pScreen->mmHeight; - pScrn->pScreen->mmHeight = tmp; - } - - if (oldRotation & (RR_Rotate_0 | RR_Rotate_180)) { - pScrn->pScreen->width = pScrn->virtualX; - pScrn->pScreen->height = pScrn->virtualY; - } else { - pScrn->pScreen->width = pScrn->virtualY; - pScrn->pScreen->height = pScrn->virtualX; - } - - pI830->rotation = oldRotation; - - if (pI830->entityPrivate) { - if (pI8302->rotation != RR_Rotate_0) { - if (!I830AllocateRotated2Buffer(pScrn1, - pI8302->disableTiling ? ALLOC_NO_TILING : 0)) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Oh dear, the rotated2 buffer failed - badness\n"); - - I830FixOffset(pScrn1, &(pI8301->RotatedMem2)); - if (pI8301->RotatedMem2.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->RotatedMem2.Key, pI8301->RotatedMem2.Offset); - } - } - - if (pI8301->rotation != RR_Rotate_0) { - if (!I830AllocateRotatedBuffer(pScrn1, - pI8301->disableTiling ? ALLOC_NO_TILING : 0)) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Oh dear, the rotated buffer failed - badness\n"); - - I830FixOffset(pScrn1, &(pI8301->RotatedMem)); - if (pI8301->RotatedMem.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->RotatedMem.Key, pI8301->RotatedMem.Offset); - } - - shadowRemove (pScrn->pScreen, NULL); - if (pI830->rotation != RR_Rotate_0) - shadowAdd (pScrn->pScreen, - (*pScrn->pScreen->GetScreenPixmap) (pScrn->pScreen), - func, I830WindowLinear, pI830->rotation, 0); - - if (I830IsPrimary(pScrn)) { - if (pI830->rotation != RR_Rotate_0) - pScrn->fbOffset = pI830->RotatedMem.Start; - else - pScrn->fbOffset = pI830->FrontBuffer.Start; - if (pI830->entityPrivate) { - if (pI8302->rotation != RR_Rotate_0) - pScrn2->fbOffset = pI8301->RotatedMem2.Start; - else - pScrn2->fbOffset = pI8301->FrontBuffer2.Start; - I830SelectBuffer(pScrn2, I830_SELECT_FRONT); - } - } else { - if (pI830->rotation != RR_Rotate_0) - pScrn->fbOffset = pI8301->RotatedMem2.Start; - else - pScrn->fbOffset = pI8301->FrontBuffer2.Start; - if (pI8301->rotation != RR_Rotate_0) - pScrn1->fbOffset = pI8301->RotatedMem.Start; - else - pScrn1->fbOffset = pI8301->FrontBuffer.Start; - I830SelectBuffer(pScrn1, I830_SELECT_FRONT); - } - I830SelectBuffer(pScrn, I830_SELECT_FRONT); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Reverting to previous configured mode\n"); - - switch (oldRotation) { - case RR_Rotate_0: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Rotating Screen back to 0 degrees\n"); - break; - case RR_Rotate_90: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Rotating Screen back to 90 degrees\n"); - break; - case RR_Rotate_180: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Rotating Screen back to 180 degrees\n"); - break; - case RR_Rotate_270: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Rotating Screen back to 270 degrees\n"); - break; - } - -#ifdef XF86DRI - if (pI8301->directRenderingEnabled) { - if (!I830AllocateBackBuffer(pScrn1, - pI8301->disableTiling ? ALLOC_NO_TILING : 0)) - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, - "Oh dear, the back buffer failed - badness\n"); - - if (!I830AllocateDepthBuffer(pScrn1, - pI8301->disableTiling ? ALLOC_NO_TILING : 0)) - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, - "Oh dear, the depth buffer failed - badness\n"); - - if (!I830AllocateTextureMemory(pScrn1, - pI8301->disableTiling ? ALLOC_NO_TILING : 0)) - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, - "Oh dear, the texture cache failed - badness\n"); - - I830DoPoolAllocation(pScrn1, &(pI8301->StolenPool)); - - I830FixOffset(pScrn1, &(pI8301->BackBuffer)); - I830FixOffset(pScrn1, &(pI8301->DepthBuffer)); - - if (pI8301->BackBuffer.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->BackBuffer.Key, pI8301->BackBuffer.Offset); - if (pI8301->DepthBuffer.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->DepthBuffer.Key, pI8301->DepthBuffer.Offset); - if (pI8301->StolenPool.Allocated.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->StolenPool.Allocated.Key, pI8301->StolenPool.Allocated.Offset); - if (pI8301->TexMem.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->TexMem.Key, pI8301->TexMem.Offset); - I830SetupMemoryTiling(pScrn1); - /* update fence registers */ - for (i = 0; i < 8; i++) - OUTREG(FENCE + i * 4, pI8301->ModeReg.Fence[i]); - { - drmI830Sarea *sarea = DRIGetSAREAPrivate(pScrn1->pScreen); - I830UpdateDRIBuffers(pScrn1, sarea ); - } - - if (didLock) - I830DRIUnlock(pScrn1); - } -#endif - - pScrn->pScreen->ModifyPixmapHeader((*pScrn->pScreen->GetScreenPixmap)(pScrn->pScreen), pScrn->pScreen->width, - pScrn->pScreen->height, pScrn->pScreen->rootDepth, pScrn->bitsPerPixel, - PixmapBytePad(pScrn->displayWidth, pScrn->pScreen->rootDepth), - (pointer)(pI8301->FbBase + pScrn->fbOffset)); - - if (pI830->entityPrivate) { - if (I830IsPrimary(pScrn)) { - pScrn2->pScreen->ModifyPixmapHeader((*pScrn2->pScreen->GetScreenPixmap)(pScrn2->pScreen), pScrn2->pScreen->width, - pScrn2->pScreen->height, pScrn2->pScreen->rootDepth, pScrn2->bitsPerPixel, - PixmapBytePad(pScrn2->displayWidth, pScrn2->pScreen->rootDepth), - (pointer)(pI8301->FbBase + pScrn2->fbOffset)); - - /* Repaint the second head */ - (*pScrn2->EnableDisableFBAccess) (pScrn2->pScreen->myNum, FALSE); - (*pScrn2->EnableDisableFBAccess) (pScrn2->pScreen->myNum, TRUE); - } else { - pScrn1->pScreen->ModifyPixmapHeader((*pScrn1->pScreen->GetScreenPixmap)(pScrn1->pScreen), pScrn1->pScreen->width, - pScrn1->pScreen->height, pScrn1->pScreen->rootDepth, pScrn1->bitsPerPixel, - PixmapBytePad(pScrn1->displayWidth, pScrn1->pScreen->rootDepth), - (pointer)(pI8301->FbBase + pScrn1->fbOffset)); - - /* Repaint the first head */ - (*pScrn1->EnableDisableFBAccess) (pScrn1->pScreen->myNum, FALSE); - (*pScrn1->EnableDisableFBAccess) (pScrn1->pScreen->myNum, TRUE); - } - } - - return FALSE; -} diff --git a/driver/xf86-video-intel/src/i830_video.c b/driver/xf86-video-intel/src/i830_video.c index c97dfc8f3..c888d5687 100644 --- a/driver/xf86-video-intel/src/i830_video.c +++ b/driver/xf86-video-intel/src/i830_video.c @@ -1,42 +1,29 @@ /*************************************************************************** - -Copyright 2000 Intel Corporation. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL INTEL, 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. - -**************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_video.c,v 1.11tsi Exp $ */ -/* - * Reformatted with GNU indent (2.2.8), using the following options: - * - * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 - * -lp -npcs -psl -sob -ss -br -ce -sc -hnl - * - * This provides a good match with the original i810 code and preferred - * XFree86 formatting conventions. - * - * When editing this driver, please follow the existing formatting, and edit - * with <TAB> characters expanded at 8-column intervals. - */ + Copyright 2000 Intel Corporation. All Rights Reserved. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sub license, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + IN NO EVENT SHALL INTEL, 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. + + **************************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_video.c,v 1.11tsi Exp $ */ /* * i830_video.c: i830/i845 Xv driver. @@ -76,6 +63,8 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xf86fbman.h" #include "regionstr.h" #include "randrstr.h" +#include "windowstr.h" +#include "damage.h" #include "i830.h" #include "i830_video.h" #include "xf86xv.h" @@ -84,8 +73,6 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xaalocal.h" #include "dixstruct.h" #include "fourcc.h" -#include "brw_defines.h" -#include "brw_structs.h" #ifndef USE_USLEEP_FOR_VIDEO #define USE_USLEEP_FOR_VIDEO 0 @@ -118,94 +105,40 @@ static int I830QueryImageAttributesOverlay(ScrnInfoPtr, int, unsigned short *, static int I830QueryImageAttributesTextured(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); -static void I830BlockHandler(int, pointer, pointer, pointer); - -static FBLinearPtr -I830AllocateMemory(ScrnInfoPtr pScrn, FBLinearPtr linear, int size); - #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -static Atom xvBrightness, xvContrast, xvColorKey, xvPipe, xvDoubleBuffer; +static Atom xvBrightness, xvContrast, xvSaturation, xvColorKey, xvPipe, xvDoubleBuffer; static Atom xvGamma0, xvGamma1, xvGamma2, xvGamma3, xvGamma4, xvGamma5; +/* Limits for the overlay/textured video source sizes. The documented hardware + * limits are 2048x2048 or better for overlay and both of our textured video + * implementations. However, we run into the bigrequests limit of (currently) + * 4MB, which even the planar format's 2048*2048*1.5 bytes is larger than. + * Conveniently, the HD resolution, even in packed format, takes + * (1920*1088*2) bytes, which is just shy of 4MB. Additionally, on the 830 + * and 845, larger sizes resulted in the card hanging, so we keep the limits + * lower there. + * + * While the HD resolution is actually 1920x1080, we increase our advertised + * size to 1088 because some software wants to send an image aligned to + * 16-pixel boundaries. + */ #define IMAGE_MAX_WIDTH 1920 #define IMAGE_MAX_HEIGHT 1088 #define IMAGE_MAX_WIDTH_LEGACY 1024 #define IMAGE_MAX_HEIGHT_LEGACY 1088 -/* - * Broadwater requires a bit of extra video memory for state information - */ -#define BRW_LINEAR_EXTRA (32*1024) - -#if !VIDEO_DEBUG -#define ErrorF Edummy -static void -Edummy(const char *dummy, ...) -{ -} +/* overlay debugging printf function */ +#if 0 +#define OVERLAY_DEBUG ErrorF +#else +#define OVERLAY_DEBUG if (0) ErrorF #endif -/* - * This is more or less the correct way to initalise, update, and shut down - * the overlay. Note OVERLAY_OFF should be used only after disabling the - * overlay in OCMD and calling OVERLAY_UPDATE. - * - * XXX Need to make sure that the overlay engine is cleanly shutdown in - * all modes of server exit. - */ - -#define OVERLAY_UPDATE \ - do { \ - BEGIN_LP_RING(8); \ - OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE); \ - OUT_RING(MI_NOOP); \ - if (!*pI830->overlayOn) { \ - OUT_RING(MI_NOOP); \ - OUT_RING(MI_NOOP); \ - OUT_RING(MI_OVERLAY_FLIP | MI_OVERLAY_FLIP_ON); \ - ErrorF("Overlay goes from off to on\n"); \ - *pI830->overlayOn = TRUE; \ - } else { \ - OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); \ - OUT_RING(MI_NOOP); \ - OUT_RING(MI_OVERLAY_FLIP | MI_OVERLAY_FLIP_CONTINUE); \ - } \ - if (IS_I96X(pI830)) \ - OUT_RING(pI830->OverlayMem->Start | OFC_UPDATE); \ - else \ - OUT_RING(pI830->OverlayMem->Physical | OFC_UPDATE); \ - OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); \ - OUT_RING(MI_NOOP); \ - ADVANCE_LP_RING(); \ - ErrorF("OVERLAY_UPDATE\n"); \ - } while(0) - -#define OVERLAY_OFF \ - do { \ - if (*pI830->overlayOn) { \ - int spin = 1000000; \ - BEGIN_LP_RING(6); \ - OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE); \ - OUT_RING(MI_NOOP); \ - OUT_RING(MI_OVERLAY_FLIP | MI_OVERLAY_FLIP_OFF); \ - if (IS_I96X(pI830)) \ - OUT_RING(pI830->OverlayMem->Start | OFC_UPDATE); \ - else \ - OUT_RING(pI830->OverlayMem->Physical | OFC_UPDATE); \ - OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); \ - OUT_RING(MI_NOOP); \ - ADVANCE_LP_RING(); \ - *pI830->overlayOn = FALSE; \ - ErrorF("Overlay goes from on to off\n"); \ - while (spin != 0 && (INREG(OCMD_REGISTER) & OVERLAY_ENABLE)){ \ - ErrorF("SPIN %d\n",spin); \ - spin--; \ - } \ - if (spin == 0) ErrorF("OVERLAY FAILED TO GO OFF\n"); \ - ErrorF("OVERLAY_OFF\n"); \ - } \ - } while(0) +/* Oops, I never exported this function in EXA. I meant to. */ +#ifndef exaMoveInPixmap +void exaMoveInPixmap (PixmapPtr pPixmap); +#endif /* * OCMD - Overlay Command Register @@ -268,297 +201,482 @@ Edummy(const char *dummy, ...) #define MAX_CUTOFF_FREQ 3.0 #define RGB16ToColorKey(c) \ - (((c & 0xF800) << 8) | ((c & 0x07E0) << 5) | ((c & 0x001F) << 3)) +(((c & 0xF800) << 8) | ((c & 0x07E0) << 5) | ((c & 0x001F) << 3)) #define RGB15ToColorKey(c) \ - (((c & 0x7c00) << 9) | ((c & 0x03E0) << 6) | ((c & 0x001F) << 3)) +(((c & 0x7c00) << 9) | ((c & 0x03E0) << 6) | ((c & 0x001F) << 3)) /* client libraries expect an encoding */ static XF86VideoEncodingRec DummyEncoding[1] = { - { - 0, - "XV_IMAGE", - IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, - {1, 1} - } + { + 0, + "XV_IMAGE", + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + {1, 1} + } }; #define NUM_FORMATS 3 static XF86VideoFormatRec Formats[NUM_FORMATS] = { - {15, TrueColor}, {16, TrueColor}, {24, TrueColor} + {15, TrueColor}, {16, TrueColor}, {24, TrueColor} }; #define CLONE_ATTRIBUTES 1 static XF86AttributeRec CloneAttributes[CLONE_ATTRIBUTES] = { - {XvSettable | XvGettable, 0, 1, "XV_PIPE"} + {XvSettable | XvGettable, -1, 1, "XV_PIPE"} }; -#define NUM_ATTRIBUTES 4 +#define NUM_ATTRIBUTES 5 static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { - {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, - {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, - {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}, - {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"} + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}, + {XvSettable | XvGettable, 0, 1023, "XV_SATURATION"}, + {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"} }; #define NUM_TEXTURED_ATTRIBUTES 2 static XF86AttributeRec TexturedAttributes[NUM_ATTRIBUTES] = { - {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, - {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}, + {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}, }; #define GAMMA_ATTRIBUTES 6 static XF86AttributeRec GammaAttributes[GAMMA_ATTRIBUTES] = { - {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA0"}, - {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA1"}, - {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA2"}, - {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA3"}, - {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA4"}, - {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA5"} + {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA0"}, + {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA1"}, + {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA2"}, + {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA3"}, + {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA4"}, + {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA5"} }; #define NUM_IMAGES 4 static XF86ImageRec Images[NUM_IMAGES] = { - XVIMAGE_YUY2, - XVIMAGE_YV12, - XVIMAGE_I420, - XVIMAGE_UYVY + XVIMAGE_YUY2, + XVIMAGE_YV12, + XVIMAGE_I420, + XVIMAGE_UYVY }; typedef struct { - CARD32 OBUF_0Y; - CARD32 OBUF_1Y; - CARD32 OBUF_0U; - CARD32 OBUF_0V; - CARD32 OBUF_1U; - CARD32 OBUF_1V; - CARD32 OSTRIDE; - CARD32 YRGB_VPH; - CARD32 UV_VPH; - CARD32 HORZ_PH; - CARD32 INIT_PHS; - CARD32 DWINPOS; - CARD32 DWINSZ; - CARD32 SWIDTH; - CARD32 SWIDTHSW; - CARD32 SHEIGHT; - CARD32 YRGBSCALE; - CARD32 UVSCALE; - CARD32 OCLRC0; - CARD32 OCLRC1; - CARD32 DCLRKV; - CARD32 DCLRKM; - CARD32 SCLRKVH; - CARD32 SCLRKVL; - CARD32 SCLRKEN; - CARD32 OCONFIG; - CARD32 OCMD; - CARD32 RESERVED1; /* 0x6C */ - CARD32 OSTART_0Y; /* for i965 */ - CARD32 OSTART_1Y; /* for i965 */ - CARD32 OSTART_0U; - CARD32 OSTART_0V; - CARD32 OSTART_1U; - CARD32 OSTART_1V; - CARD32 OTILEOFF_0Y; - CARD32 OTILEOFF_1Y; - CARD32 OTILEOFF_0U; - CARD32 OTILEOFF_0V; - CARD32 OTILEOFF_1U; - CARD32 OTILEOFF_1V; - CARD32 FASTHSCALE; /* 0xA0 */ - CARD32 UVSCALEV; /* 0xA4 */ - - CARD32 RESERVEDC[(0x200 - 0xA8) / 4]; /* 0xA8 - 0x1FC */ - CARD16 Y_VCOEFS[N_VERT_Y_TAPS * N_PHASES]; /* 0x200 */ - CARD16 RESERVEDD[0x100 / 2 - N_VERT_Y_TAPS * N_PHASES]; - CARD16 Y_HCOEFS[N_HORIZ_Y_TAPS * N_PHASES]; /* 0x300 */ - CARD16 RESERVEDE[0x200 / 2 - N_HORIZ_Y_TAPS * N_PHASES]; - CARD16 UV_VCOEFS[N_VERT_UV_TAPS * N_PHASES]; /* 0x500 */ - CARD16 RESERVEDF[0x100 / 2 - N_VERT_UV_TAPS * N_PHASES]; - CARD16 UV_HCOEFS[N_HORIZ_UV_TAPS * N_PHASES]; /* 0x600 */ - CARD16 RESERVEDG[0x100 / 2 - N_HORIZ_UV_TAPS * N_PHASES]; + CARD32 OBUF_0Y; + CARD32 OBUF_1Y; + CARD32 OBUF_0U; + CARD32 OBUF_0V; + CARD32 OBUF_1U; + CARD32 OBUF_1V; + CARD32 OSTRIDE; + CARD32 YRGB_VPH; + CARD32 UV_VPH; + CARD32 HORZ_PH; + CARD32 INIT_PHS; + CARD32 DWINPOS; + CARD32 DWINSZ; + CARD32 SWIDTH; + CARD32 SWIDTHSW; + CARD32 SHEIGHT; + CARD32 YRGBSCALE; + CARD32 UVSCALE; + CARD32 OCLRC0; + CARD32 OCLRC1; + CARD32 DCLRKV; + CARD32 DCLRKM; + CARD32 SCLRKVH; + CARD32 SCLRKVL; + CARD32 SCLRKEN; + CARD32 OCONFIG; + CARD32 OCMD; + CARD32 RESERVED1; /* 0x6C */ + CARD32 OSTART_0Y; /* for i965 */ + CARD32 OSTART_1Y; /* for i965 */ + CARD32 OSTART_0U; + CARD32 OSTART_0V; + CARD32 OSTART_1U; + CARD32 OSTART_1V; + CARD32 OTILEOFF_0Y; + CARD32 OTILEOFF_1Y; + CARD32 OTILEOFF_0U; + CARD32 OTILEOFF_0V; + CARD32 OTILEOFF_1U; + CARD32 OTILEOFF_1V; + CARD32 FASTHSCALE; /* 0xA0 */ + CARD32 UVSCALEV; /* 0xA4 */ + + CARD32 RESERVEDC[(0x200 - 0xA8) / 4]; /* 0xA8 - 0x1FC */ + CARD16 Y_VCOEFS[N_VERT_Y_TAPS * N_PHASES]; /* 0x200 */ + CARD16 RESERVEDD[0x100 / 2 - N_VERT_Y_TAPS * N_PHASES]; + CARD16 Y_HCOEFS[N_HORIZ_Y_TAPS * N_PHASES]; /* 0x300 */ + CARD16 RESERVEDE[0x200 / 2 - N_HORIZ_Y_TAPS * N_PHASES]; + CARD16 UV_VCOEFS[N_VERT_UV_TAPS * N_PHASES]; /* 0x500 */ + CARD16 RESERVEDF[0x100 / 2 - N_VERT_UV_TAPS * N_PHASES]; + CARD16 UV_HCOEFS[N_HORIZ_UV_TAPS * N_PHASES]; /* 0x600 */ + CARD16 RESERVEDG[0x100 / 2 - N_HORIZ_UV_TAPS * N_PHASES]; } I830OverlayRegRec, *I830OverlayRegPtr; +#define I830OVERLAYREG(pI830) ((I830OverlayRegPtr)\ + ((pI830)->FbBase + \ + (pI830)->overlay_regs->offset)) #if VIDEO_DEBUG static void CompareOverlay(I830Ptr pI830, CARD32 * overlay, int size) { - int i; - CARD32 val; - int bad = 0; - - for (i = 0; i < size; i += 4) { - val = INREG(0x30100 + i); - if (val != overlay[i / 4]) { - ErrorF("0x%05x value doesn't match (0x%lx != 0x%lx)\n", - 0x30100 + i, val, overlay[i / 4]); - bad++; - } - } - if (!bad) - ErrorF("CompareOverlay: no differences\n"); + int i; + CARD32 val; + int bad = 0; + + for (i = 0; i < size; i += 4) { + val = INREG(0x30100 + i); + if (val != overlay[i / 4]) { + OVERLAY_DEBUG("0x%05x value doesn't match (0x%lx != 0x%lx)\n", + 0x30100 + i, val, overlay[i / 4]); + bad++; + } + } + if (!bad) + OVERLAY_DEBUG("CompareOverlay: no differences\n"); } #endif -void -I830InitVideo(ScreenPtr pScreen) +static void +I830SetOneLineModeRatio(ScrnInfoPtr pScrn); + +static void +i830_overlay_switch_to_crtc (ScrnInfoPtr pScrn, xf86CrtcPtr crtc) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; - XF86VideoAdaptorPtr overlayAdaptor = NULL, texturedAdaptor = NULL; - int num_adaptors; + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + I830CrtcPrivatePtr intel_crtc = crtc->driver_private; + int pipeconf_reg = intel_crtc->pipe == 0 ? PIPEACONF : PIPEBCONF; + + if (INREG(pipeconf_reg) & PIPEACONF_DOUBLE_WIDE) + pPriv->overlayOK = FALSE; + else + pPriv->overlayOK = TRUE; + + if (!pPriv->overlayOK) + return; + + /* Check we have an LFP connected */ + if (i830PipeHasType(crtc, I830_OUTPUT_LVDS)) + { + + int vtotal_reg = intel_crtc->pipe ? VTOTAL_A : VTOTAL_B; + CARD32 size = intel_crtc->pipe ? INREG(PIPEBSRC) : INREG(PIPEASRC); + CARD32 active; + CARD32 hsize, vsize; + + hsize = (size >> 16) & 0x7FF; + vsize = size & 0x7FF; + active = INREG(vtotal_reg) & 0x7FF; + + if (vsize < active && hsize > 1024) + I830SetOneLineModeRatio(pScrn); + + if (pPriv->scaleRatio & 0xFFFE0000) + { + /* Possible bogus ratio, using in-accurate fallback */ + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Bogus panel fit register, Xvideo positioning may not " + "be accurate.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Using fallback ratio - was 0x%x, now 0x%x\n", + pPriv->scaleRatio, + (int)(((float)active * 65536)/(float)vsize)); + + pPriv->scaleRatio = (int)(((float)active * 65536) / (float)vsize); + } + } +} - ErrorF("I830InitVideo\n"); +/* + * This is more or less the correct way to initalise, update, and shut down + * the overlay. + * + * XXX Need to make sure that the overlay engine is cleanly shutdown in + * all modes of server exit. + */ -#if 0 - { - I830OverlayRegRec tmp; - - ErrorF("sizeof I830OverlayRegRec is 0x%x\n", sizeof(I830OverlayRegRec)); - ErrorF("Reserved C, D, E, F, G are %x, %x, %x, %x, %x\n", - (unsigned long)&(tmp.RESERVEDC[0]) - (unsigned long)&tmp, - (unsigned long)&(tmp.RESERVEDD[0]) - (unsigned long)&tmp, - (unsigned long)&(tmp.RESERVEDE[0]) - (unsigned long)&tmp, - (unsigned long)&(tmp.RESERVEDF[0]) - (unsigned long)&tmp, - (unsigned long)&(tmp.RESERVEDG[0]) - (unsigned long)&tmp); - } -#endif +static void +i830_overlay_on(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + I830OverlayRegPtr overlay = I830OVERLAYREG(pI830); + I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; + Bool deactivate = FALSE; + + if (*pI830->overlayOn) + return; + + /* + * On I830, if pipe A is off when the overlayis enabled, it will fail to + * turn on and blank the entire screen or lock up the ring. Light up pipe + * A in this case to provide a clock for the overlay hardware + */ + if (pPriv->current_crtc && i830_crtc_pipe (pPriv->current_crtc) != 0) + deactivate = i830_pipe_a_require_activate (pScrn); + + overlay->OCMD &= ~OVERLAY_ENABLE; + BEGIN_LP_RING(6); + OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE); + OUT_RING(MI_NOOP); + OUT_RING(MI_OVERLAY_FLIP | MI_OVERLAY_FLIP_ON); + if (OVERLAY_NOPHYSICAL(pI830)) + OUT_RING(pI830->overlay_regs->offset | OFC_UPDATE); + else + OUT_RING(pI830->overlay_regs->bus_addr | OFC_UPDATE); + /* Wait for the overlay to light up before attempting to use it */ + OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); + OUT_RING(MI_NOOP); + ADVANCE_LP_RING(); + i830WaitSync(pScrn); + + /* + * If we turned pipe A on up above, turn it + * back off + */ + if (deactivate) + i830_pipe_a_require_deactivate (pScrn); + + OVERLAY_DEBUG("overlay_on\n"); + *pI830->overlayOn = TRUE; + + overlay->OCMD |= OVERLAY_ENABLE; +} - num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); - /* Give our adaptor list enough space for the overlay and/or texture video - * adaptors. - */ - newAdaptors = xalloc((num_adaptors + 2) * sizeof(XF86VideoAdaptorPtr *)); - if (newAdaptors == NULL) - return; - - memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); - adaptors = newAdaptors; - - /* Add the adaptors supported by our hardware. First, set up the atoms - * that will be used by both output adaptors. - */ - xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); - xvContrast = MAKE_ATOM("XV_CONTRAST"); - - /* Set up overlay video if we can do it at this depth. */ - if (!IS_I96X(pI830) && pScrn->bitsPerPixel != 8) { - overlayAdaptor = I830SetupImageVideoOverlay(pScreen); - if (overlayAdaptor != NULL) { - adaptors[num_adaptors++] = overlayAdaptor; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up overlay video\n"); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to set up overlay video\n"); - } - I830InitOffscreenImages(pScreen); - } +static void +i830_overlay_continue(ScrnInfoPtr pScrn, Bool update_filter) +{ + I830Ptr pI830 = I830PTR(pScrn); + CARD32 flip_addr; + I830OverlayRegPtr overlay = I830OVERLAYREG(pI830); + + if (!*pI830->overlayOn) + return; + + if (OVERLAY_NOPHYSICAL(pI830)) + flip_addr = pI830->overlay_regs->offset; + else + flip_addr = pI830->overlay_regs->bus_addr; + if (update_filter) + flip_addr |= OFC_UPDATE; + OVERLAY_DEBUG ("overlay_continue cmd 0x%08lx -> 0x%08lx sta 0x%08lx\n", + overlay->OCMD, INREG(OCMD_REGISTER), INREG(DOVSTA)); + BEGIN_LP_RING(4); + OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE); + OUT_RING(MI_NOOP); + OUT_RING(MI_OVERLAY_FLIP | MI_OVERLAY_FLIP_CONTINUE); + OUT_RING(flip_addr); + ADVANCE_LP_RING(); + OVERLAY_DEBUG("overlay_continue\n"); +} - /* Set up textured video if we can do it at this depth and we are on - * supported hardware. - */ - if (pScrn->bitsPerPixel >= 16 && (IS_I9XX(pI830) || IS_I96X(pI830))) { - texturedAdaptor = I830SetupImageVideoTextured(pScreen); - if (texturedAdaptor != NULL) { - adaptors[num_adaptors++] = texturedAdaptor; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up textured video\n"); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to set up textured video\n"); - } - } - if (num_adaptors) - xf86XVScreenInit(pScreen, adaptors, num_adaptors); +static void +i830_overlay_off(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + I830OverlayRegPtr overlay = I830OVERLAYREG(pI830); + + if (!*pI830->overlayOn) + return; + + /* + * Wait for overlay to go idle. This has to be + * separated from the turning off state by a WaitSync + * to ensure the overlay will not read OCMD early and + * disable the overlay before the commands here are + * executed + */ + { + BEGIN_LP_RING(2); + OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); + OUT_RING(MI_NOOP); + ADVANCE_LP_RING(); + i830WaitSync(pScrn); + } + + /* + * Turn overlay off + */ + { + overlay->OCMD &= ~OVERLAY_ENABLE; + OVERLAY_DEBUG ("overlay_off cmd 0x%08lx -> 0x%08lx sta 0x%08lx\n", + overlay->OCMD, INREG(OCMD_REGISTER), INREG(DOVSTA)); + BEGIN_LP_RING(6); + OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE); + OUT_RING(MI_NOOP); + OUT_RING(MI_OVERLAY_FLIP | MI_OVERLAY_FLIP_CONTINUE); + if (OVERLAY_NOPHYSICAL(pI830)) + OUT_RING(pI830->overlay_regs->offset); + else + OUT_RING(pI830->overlay_regs->bus_addr); + OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); + OUT_RING(MI_NOOP); + ADVANCE_LP_RING(); + i830WaitSync(pScrn); + } + *pI830->overlayOn = FALSE; + OVERLAY_DEBUG("overlay_off\n"); +} - xfree(adaptors); +void +I830InitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr overlayAdaptor = NULL, texturedAdaptor = NULL; + int num_adaptors; + +#if 0 + { + I830OverlayRegRec tmp; + + ErrorF("sizeof I830OverlayRegRec is 0x%x\n", sizeof(I830OverlayRegRec)); + ErrorF("Reserved C, D, E, F, G are %x, %x, %x, %x, %x\n", + (unsigned long)&(tmp.RESERVEDC[0]) - (unsigned long)&tmp, + (unsigned long)&(tmp.RESERVEDD[0]) - (unsigned long)&tmp, + (unsigned long)&(tmp.RESERVEDE[0]) - (unsigned long)&tmp, + (unsigned long)&(tmp.RESERVEDF[0]) - (unsigned long)&tmp, + (unsigned long)&(tmp.RESERVEDG[0]) - (unsigned long)&tmp); + } +#endif + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + /* Give our adaptor list enough space for the overlay and/or texture video + * adaptors. + */ + newAdaptors = xalloc((num_adaptors + 2) * sizeof(XF86VideoAdaptorPtr *)); + if (newAdaptors == NULL) + return; + + memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); + adaptors = newAdaptors; + + /* Add the adaptors supported by our hardware. First, set up the atoms + * that will be used by both output adaptors. + */ + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + + /* Set up textured video if we can do it at this depth and we are on + * supported hardware. + */ + if (pScrn->bitsPerPixel >= 16 && (IS_I9XX(pI830) || IS_I965G(pI830)) && + !(!IS_I965G(pI830) && pScrn->displayWidth > 2048)) + { + texturedAdaptor = I830SetupImageVideoTextured(pScreen); + if (texturedAdaptor != NULL) { + adaptors[num_adaptors++] = texturedAdaptor; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up textured video\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to set up textured video\n"); + } + } + + /* Set up overlay video if we can do it at this depth. */ + if (!IS_I965G(pI830) && pScrn->bitsPerPixel != 8 && + pI830->overlay_regs != NULL) + { + overlayAdaptor = I830SetupImageVideoOverlay(pScreen); + if (overlayAdaptor != NULL) { + adaptors[num_adaptors++] = overlayAdaptor; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up overlay video\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to set up overlay video\n"); + } + I830InitOffscreenImages(pScreen); + } + + if (num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + + xfree(adaptors); } static void I830ResetVideo(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); - I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; - I830OverlayRegPtr overlay = - (I830OverlayRegPtr) (pI830->FbBase + pI830->OverlayMem->Start); - - ErrorF("I830ResetVideo: base: %p, offset: 0x%lx, obase: %p\n", - pI830->FbBase, pI830->OverlayMem->Start, overlay); - /* - * Default to maximum image size in YV12 - */ - - memset(overlay, 0, sizeof(*overlay)); - overlay->YRGB_VPH = 0; - overlay->UV_VPH = 0; - overlay->HORZ_PH = 0; - overlay->INIT_PHS = 0; - overlay->DWINPOS = 0; - overlay->DWINSZ = 0; - overlay->SWIDTH = 0; - overlay->SWIDTHSW = 0; - overlay->SHEIGHT = 0; - overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff); - overlay->OCLRC1 = 0x00000080; /* saturation: bypass */ + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; + I830OverlayRegPtr overlay = I830OVERLAYREG(pI830); + + OVERLAY_DEBUG("I830ResetVideo: base: %p, offset: 0x%lx, obase: %p\n", + pI830->FbBase, pI830->overlay_regs->offset, overlay); + /* + * Default to maximum image size in YV12 + */ + + memset(overlay, 0, sizeof(*overlay)); + overlay->YRGB_VPH = 0; + overlay->UV_VPH = 0; + overlay->HORZ_PH = 0; + overlay->INIT_PHS = 0; + overlay->DWINPOS = 0; + overlay->DWINSZ = 0; + overlay->SWIDTH = 0; + overlay->SWIDTHSW = 0; + overlay->SHEIGHT = 0; + overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff); + overlay->OCLRC1 = pPriv->saturation; #if 0 - overlay->AWINPOS = 0; - overlay->AWINSZ = 0; + overlay->AWINPOS = 0; + overlay->AWINSZ = 0; #endif - overlay->FASTHSCALE = 0; - - /* - * Enable destination color keying - */ - switch (pScrn->depth) { - case 8: - overlay->DCLRKV = 0; - overlay->DCLRKM = 0xffffff | DEST_KEY_ENABLE; - break; - case 15: - overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey); - overlay->DCLRKM = 0x070707 | DEST_KEY_ENABLE; - break; - case 16: - overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey); - overlay->DCLRKM = 0x070307 | DEST_KEY_ENABLE; - break; - default: - overlay->DCLRKV = pPriv->colorKey; - overlay->DCLRKM = DEST_KEY_ENABLE; - break; - } - - overlay->SCLRKVH = 0; - overlay->SCLRKVL = 0; - overlay->SCLRKEN = 0; /* source color key disable */ - overlay->OCONFIG = CC_OUT_8BIT; - - /* - * Select which pipe the overlay is enabled on. - */ - overlay->OCONFIG &= ~OVERLAY_PIPE_MASK; - if (pPriv->pipe == 0) - overlay->OCONFIG |= OVERLAY_PIPE_A; - else - overlay->OCONFIG |= OVERLAY_PIPE_B; - - overlay->OCMD = YUV_420; + overlay->FASTHSCALE = 0; + + /* + * Enable destination color keying + */ + switch (pScrn->depth) { + case 8: + overlay->DCLRKV = 0; + overlay->DCLRKM = 0xffffff | DEST_KEY_ENABLE; + break; + case 15: + overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey); + overlay->DCLRKM = 0x070707 | DEST_KEY_ENABLE; + break; + case 16: + overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey); + overlay->DCLRKM = 0x070307 | DEST_KEY_ENABLE; + break; + default: + overlay->DCLRKV = pPriv->colorKey; + overlay->DCLRKM = DEST_KEY_ENABLE; + break; + } + + overlay->SCLRKVH = 0; + overlay->SCLRKVL = 0; + overlay->SCLRKEN = 0; /* source color key disable */ + overlay->OCONFIG = CC_OUT_8BIT; + + /* + * Select which pipe the overlay is enabled on. + */ + overlay->OCONFIG &= ~OVERLAY_PIPE_MASK; + if (i830_crtc_pipe (pPriv->current_crtc) == 0) + overlay->OCONFIG |= OVERLAY_PIPE_A; + else + overlay->OCONFIG |= OVERLAY_PIPE_B; #if 0 - /* - * XXX DUMP REGISTER CODE !!! - * This allows us to dump the complete i845 registers and compare - * with warm boot situations before we upload our first copy. - */ - { - int i; - for (i = 0x30000; i < 0x31000; i += 4) - ErrorF("0x%x 0x%lx\n", i, INREG(i)); - } + /* + * XXX DUMP REGISTER CODE !!! + * This allows us to dump the complete i845 registers and compare + * with warm boot situations before we upload our first copy. + */ + { + int i; + for (i = 0x30000; i < 0x31000; i += 4) + ErrorF("0x%x 0x%lx\n", i, INREG(i)); + } #endif } @@ -571,343 +689,337 @@ I830ResetVideo(ScrnInfoPtr pScrn) static void I830SetOneLineModeRatio(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); - I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; - CARD32 panelFitControl = INREG(PFIT_CONTROLS); - int vertScale; - - pPriv->scaleRatio = 0x10000; - - if (panelFitControl & PFIT_ON_MASK) { - if (panelFitControl & PFIT_AUTOVSCALE_MASK) { - vertScale = INREG(PFIT_AUTOSCALE_RATIO) >> 16; - } else { - vertScale = INREG(PFIT_PROGRAMMED_SCALE_RATIO) >> 16; - } - - if (vertScale != 0) - pPriv->scaleRatio = ((double) 0x10000 / (double)vertScale) * 0x10000; - - pPriv->oneLineMode = TRUE; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling Xvideo one-line mode\n"); - } + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; + CARD32 panelFitControl = INREG(PFIT_CONTROLS); + int vertScale; + + pPriv->scaleRatio = 0x10000; + + if (panelFitControl & PFIT_ON_MASK) { + if (panelFitControl & PFIT_AUTOVSCALE_MASK) { + vertScale = INREG(PFIT_AUTOSCALE_RATIO) >> 16; + } else { + vertScale = INREG(PFIT_PROGRAMMED_SCALE_RATIO) >> 16; + } - if (pPriv->scaleRatio == 0x10000) - pPriv->oneLineMode = FALSE; + if (vertScale != 0) + pPriv->scaleRatio = ((double) 0x10000 / (double)vertScale) * 0x10000; + + pPriv->oneLineMode = TRUE; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling Xvideo one-line mode\n"); + } + + if (pPriv->scaleRatio == 0x10000) + pPriv->oneLineMode = FALSE; } static CARD32 I830BoundGammaElt (CARD32 elt, CARD32 eltPrev) { - elt &= 0xff; - eltPrev &= 0xff; - if (elt < eltPrev) - elt = eltPrev; - else if ((elt - eltPrev) > 0x7e) - elt = eltPrev + 0x7e; - return elt; + elt &= 0xff; + eltPrev &= 0xff; + if (elt < eltPrev) + elt = eltPrev; + else if ((elt - eltPrev) > 0x7e) + elt = eltPrev + 0x7e; + return elt; } static CARD32 I830BoundGamma (CARD32 gamma, CARD32 gammaPrev) { - return (I830BoundGammaElt (gamma >> 24, gammaPrev >> 24) << 24 | - I830BoundGammaElt (gamma >> 16, gammaPrev >> 16) << 16 | - I830BoundGammaElt (gamma >> 8, gammaPrev >> 8) << 8 | - I830BoundGammaElt (gamma , gammaPrev )); + return (I830BoundGammaElt (gamma >> 24, gammaPrev >> 24) << 24 | + I830BoundGammaElt (gamma >> 16, gammaPrev >> 16) << 16 | + I830BoundGammaElt (gamma >> 8, gammaPrev >> 8) << 8 | + I830BoundGammaElt (gamma , gammaPrev )); } static void I830UpdateGamma(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); - I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; - CARD32 gamma0 = pPriv->gamma0; - CARD32 gamma1 = pPriv->gamma1; - CARD32 gamma2 = pPriv->gamma2; - CARD32 gamma3 = pPriv->gamma3; - CARD32 gamma4 = pPriv->gamma4; - CARD32 gamma5 = pPriv->gamma5; - - ErrorF ("Original gamma: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", - gamma0, gamma1, gamma2, gamma3, gamma4, gamma5); - gamma1 = I830BoundGamma (gamma1, gamma0); - gamma2 = I830BoundGamma (gamma2, gamma1); - gamma3 = I830BoundGamma (gamma3, gamma2); - gamma4 = I830BoundGamma (gamma4, gamma3); - gamma5 = I830BoundGamma (gamma5, gamma4); - ErrorF ("Bounded gamma: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", - gamma0, gamma1, gamma2, gamma3, gamma4, gamma5); - - OUTREG(OGAMC5, gamma5); - OUTREG(OGAMC4, gamma4); - OUTREG(OGAMC3, gamma3); - OUTREG(OGAMC2, gamma2); - OUTREG(OGAMC1, gamma1); - OUTREG(OGAMC0, gamma0); + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; + CARD32 gamma0 = pPriv->gamma0; + CARD32 gamma1 = pPriv->gamma1; + CARD32 gamma2 = pPriv->gamma2; + CARD32 gamma3 = pPriv->gamma3; + CARD32 gamma4 = pPriv->gamma4; + CARD32 gamma5 = pPriv->gamma5; + +#if 0 + ErrorF ("Original gamma: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", + gamma0, gamma1, gamma2, gamma3, gamma4, gamma5); +#endif + gamma1 = I830BoundGamma (gamma1, gamma0); + gamma2 = I830BoundGamma (gamma2, gamma1); + gamma3 = I830BoundGamma (gamma3, gamma2); + gamma4 = I830BoundGamma (gamma4, gamma3); + gamma5 = I830BoundGamma (gamma5, gamma4); +#if 0 + ErrorF ("Bounded gamma: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", + gamma0, gamma1, gamma2, gamma3, gamma4, gamma5); +#endif + + OUTREG(OGAMC5, gamma5); + OUTREG(OGAMC4, gamma4); + OUTREG(OGAMC3, gamma3); + OUTREG(OGAMC2, gamma2); + OUTREG(OGAMC1, gamma1); + OUTREG(OGAMC0, gamma0); } static XF86VideoAdaptorPtr I830SetupImageVideoOverlay(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - XF86VideoAdaptorPtr adapt; - I830PortPrivPtr pPriv; - XF86AttributePtr att; - - ErrorF("I830SetupImageVideoOverlay\n"); - - if (!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + - sizeof(I830PortPrivRec) + sizeof(DevUnion)))) - return NULL; - - adapt->type = XvWindowMask | XvInputMask | XvImageMask; - adapt->flags = VIDEO_OVERLAID_IMAGES /*| VIDEO_CLIP_TO_VIEWPORT*/; - adapt->name = "Intel(R) Video Overlay"; - adapt->nEncodings = 1; - adapt->pEncodings = DummyEncoding; - /* update the DummyEncoding for these two chipsets */ - if (IS_845G(pI830) || IS_I830(pI830)) { - adapt->pEncodings->width = IMAGE_MAX_WIDTH_LEGACY; - adapt->pEncodings->height = IMAGE_MAX_HEIGHT_LEGACY; - } - adapt->nFormats = NUM_FORMATS; - adapt->pFormats = Formats; - adapt->nPorts = 1; - adapt->pPortPrivates = (DevUnion *) (&adapt[1]); - - pPriv = (I830PortPrivPtr) (&adapt->pPortPrivates[1]); - - adapt->pPortPrivates[0].ptr = (pointer) (pPriv); - adapt->nAttributes = NUM_ATTRIBUTES; - adapt->nAttributes += CLONE_ATTRIBUTES; - if (IS_I9XX(pI830)) - adapt->nAttributes += GAMMA_ATTRIBUTES; /* has gamma */ - adapt->pAttributes = xnfalloc(sizeof(XF86AttributeRec) * adapt->nAttributes); - /* Now copy the attributes */ - att = adapt->pAttributes; - memcpy((char *)att, (char*)Attributes, sizeof(XF86AttributeRec)* NUM_ATTRIBUTES); - att+=NUM_ATTRIBUTES; - memcpy((char*)att, (char*)CloneAttributes, sizeof(XF86AttributeRec) * CLONE_ATTRIBUTES); - att+=CLONE_ATTRIBUTES; - if (IS_I9XX(pI830)) { - memcpy((char*)att, (char*)GammaAttributes, sizeof(XF86AttributeRec) * GAMMA_ATTRIBUTES); - att+=GAMMA_ATTRIBUTES; - } - adapt->nImages = NUM_IMAGES; - adapt->pImages = Images; - adapt->PutVideo = NULL; - adapt->PutStill = NULL; - adapt->GetVideo = NULL; - adapt->GetStill = NULL; - adapt->StopVideo = I830StopVideo; - adapt->SetPortAttribute = I830SetPortAttribute; - adapt->GetPortAttribute = I830GetPortAttribute; - adapt->QueryBestSize = I830QueryBestSize; - adapt->PutImage = I830PutImage; - adapt->QueryImageAttributes = I830QueryImageAttributesOverlay; - - pPriv->textured = FALSE; - pPriv->colorKey = pI830->colorKey & ((1 << pScrn->depth) - 1); - pPriv->videoStatus = 0; - pPriv->brightness = 0; - pPriv->contrast = 64; - pPriv->pipe = pI830->pipe; /* default to current pipe */ - pPriv->linear = NULL; - pPriv->currentBuf = 0; - pPriv->gamma5 = 0xc0c0c0; - pPriv->gamma4 = 0x808080; - pPriv->gamma3 = 0x404040; - pPriv->gamma2 = 0x202020; - pPriv->gamma1 = 0x101010; - pPriv->gamma0 = 0x080808; - pPriv->doubleBuffer = 1; - - /* gotta uninit this someplace */ - REGION_NULL(pScreen, &pPriv->clip); - - pI830->adaptor = adapt; - - /* With LFP's we need to detect whether we're in One Line Mode, which - * essentially means a resolution greater than 1024x768, and fix up - * the scaler accordingly. */ - pPriv->scaleRatio = 0x10000; - pPriv->oneLineMode = FALSE; - - /* - * Initialise pPriv->overlayOK. Set it to TRUE here so that a warning will - * be generated if I830VideoSwitchModeAfter() sets it to FALSE. - */ - pPriv->overlayOK = TRUE; - I830VideoSwitchModeAfter(pScrn, pScrn->currentMode); - - pI830->BlockHandler = pScreen->BlockHandler; - pScreen->BlockHandler = I830BlockHandler; - - xvColorKey = MAKE_ATOM("XV_COLORKEY"); - xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); - - /* Allow the pipe to be switched from pipe A to B when in clone mode */ - xvPipe = MAKE_ATOM("XV_PIPE"); - - if (IS_I9XX(pI830)) { - xvGamma0 = MAKE_ATOM("XV_GAMMA0"); - xvGamma1 = MAKE_ATOM("XV_GAMMA1"); - xvGamma2 = MAKE_ATOM("XV_GAMMA2"); - xvGamma3 = MAKE_ATOM("XV_GAMMA3"); - xvGamma4 = MAKE_ATOM("XV_GAMMA4"); - xvGamma5 = MAKE_ATOM("XV_GAMMA5"); - } - - I830ResetVideo(pScrn); - - I830UpdateGamma(pScrn); - - return adapt; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + XF86VideoAdaptorPtr adapt; + I830PortPrivPtr pPriv; + XF86AttributePtr att; + + OVERLAY_DEBUG("I830SetupImageVideoOverlay\n"); + + if (!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(I830PortPrivRec) + sizeof(DevUnion)))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES /*| VIDEO_CLIP_TO_VIEWPORT*/; + adapt->name = "Intel(R) Video Overlay"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + /* update the DummyEncoding for these two chipsets */ + if (IS_845G(pI830) || IS_I830(pI830)) { + adapt->pEncodings->width = IMAGE_MAX_WIDTH_LEGACY; + adapt->pEncodings->height = IMAGE_MAX_HEIGHT_LEGACY; + } + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion *) (&adapt[1]); + + pPriv = (I830PortPrivPtr) (&adapt->pPortPrivates[1]); + + adapt->pPortPrivates[0].ptr = (pointer) (pPriv); + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->nAttributes += CLONE_ATTRIBUTES; + if (IS_I9XX(pI830)) + adapt->nAttributes += GAMMA_ATTRIBUTES; /* has gamma */ + adapt->pAttributes = xnfalloc(sizeof(XF86AttributeRec) * adapt->nAttributes); + /* Now copy the attributes */ + att = adapt->pAttributes; + memcpy((char *)att, (char*)Attributes, sizeof(XF86AttributeRec)* NUM_ATTRIBUTES); + att+=NUM_ATTRIBUTES; + memcpy((char*)att, (char*)CloneAttributes, sizeof(XF86AttributeRec) * CLONE_ATTRIBUTES); + att+=CLONE_ATTRIBUTES; + if (IS_I9XX(pI830)) { + memcpy((char*)att, (char*)GammaAttributes, sizeof(XF86AttributeRec) * GAMMA_ATTRIBUTES); + att+=GAMMA_ATTRIBUTES; + } + adapt->nImages = NUM_IMAGES; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = I830StopVideo; + adapt->SetPortAttribute = I830SetPortAttribute; + adapt->GetPortAttribute = I830GetPortAttribute; + adapt->QueryBestSize = I830QueryBestSize; + adapt->PutImage = I830PutImage; + adapt->QueryImageAttributes = I830QueryImageAttributesOverlay; + + pPriv->textured = FALSE; + pPriv->colorKey = pI830->colorKey & ((1 << pScrn->depth) - 1); + pPriv->videoStatus = 0; + pPriv->brightness = 0; + pPriv->contrast = 64; + pPriv->saturation = 128; + pPriv->current_crtc = NULL; + pPriv->desired_crtc = NULL; + pPriv->buf = NULL; + pPriv->currentBuf = 0; + pPriv->gamma5 = 0xc0c0c0; + pPriv->gamma4 = 0x808080; + pPriv->gamma3 = 0x404040; + pPriv->gamma2 = 0x202020; + pPriv->gamma1 = 0x101010; + pPriv->gamma0 = 0x080808; + pPriv->doubleBuffer = 1; + + /* gotta uninit this someplace */ + REGION_NULL(pScreen, &pPriv->clip); + + pI830->adaptor = adapt; + + /* With LFP's we need to detect whether we're in One Line Mode, which + * essentially means a resolution greater than 1024x768, and fix up + * the scaler accordingly. */ + pPriv->scaleRatio = 0x10000; + pPriv->oneLineMode = FALSE; + + /* + * Initialise pPriv->overlayOK. Set it to TRUE here so that a warning will + * be generated if i830_crtc_dpms_video() sets it to FALSE during mode + * setup. + */ + pPriv->overlayOK = TRUE; + + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvSaturation = MAKE_ATOM("XV_SATURATION"); + xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); + + /* Allow the pipe to be switched from pipe A to B when in clone mode */ + xvPipe = MAKE_ATOM("XV_PIPE"); + + if (IS_I9XX(pI830)) { + xvGamma0 = MAKE_ATOM("XV_GAMMA0"); + xvGamma1 = MAKE_ATOM("XV_GAMMA1"); + xvGamma2 = MAKE_ATOM("XV_GAMMA2"); + xvGamma3 = MAKE_ATOM("XV_GAMMA3"); + xvGamma4 = MAKE_ATOM("XV_GAMMA4"); + xvGamma5 = MAKE_ATOM("XV_GAMMA5"); + } + + I830ResetVideo(pScrn); + + I830UpdateGamma(pScrn); + + return adapt; } static XF86VideoAdaptorPtr I830SetupImageVideoTextured(ScreenPtr pScreen) { - XF86VideoAdaptorPtr adapt; - XF86VideoEncodingPtr encoding; - XF86AttributePtr attrs; - I830PortPrivPtr portPrivs; - DevUnion *devUnions; - int nports = 16, i; - int nAttributes; - - ErrorF("I830SetupImageVideoOverlay\n"); - - nAttributes = NUM_TEXTURED_ATTRIBUTES; - - adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec)); - portPrivs = xcalloc(nports, sizeof(I830PortPrivRec)); - devUnions = xcalloc(nports, sizeof(DevUnion)); - encoding = xcalloc(1, sizeof(XF86VideoEncodingRec)); - attrs = xcalloc(nAttributes, sizeof(XF86AttributeRec)); - if (adapt == NULL || portPrivs == NULL || devUnions == NULL || - encoding == NULL || attrs == NULL) - { - xfree(adapt); - xfree(portPrivs); - xfree(devUnions); - xfree(encoding); - xfree(attrs); - return NULL; - } - - adapt->type = XvWindowMask | XvInputMask | XvImageMask; - adapt->flags = 0; - adapt->name = "Intel(R) Textured Video"; - adapt->nEncodings = 1; - adapt->pEncodings = encoding; - adapt->pEncodings[0].id = 0; - adapt->pEncodings[0].name = "XV_IMAGE"; - adapt->pEncodings[0].width = 2048; - adapt->pEncodings[0].height = 2048; - adapt->pEncodings[0].rate.numerator = 1; - adapt->pEncodings[0].rate.denominator = 1; - adapt->nFormats = NUM_FORMATS; - adapt->pFormats = Formats; - adapt->nPorts = nports; - adapt->pPortPrivates = devUnions; - adapt->nAttributes = nAttributes; - adapt->pAttributes = attrs; - memcpy(attrs, TexturedAttributes, nAttributes * sizeof(XF86AttributeRec)); - adapt->nImages = NUM_IMAGES; - adapt->pImages = Images; - adapt->PutVideo = NULL; - adapt->PutStill = NULL; - adapt->GetVideo = NULL; - adapt->GetStill = NULL; - adapt->StopVideo = I830StopVideo; - adapt->SetPortAttribute = I830SetPortAttribute; - adapt->GetPortAttribute = I830GetPortAttribute; - adapt->QueryBestSize = I830QueryBestSize; - adapt->PutImage = I830PutImage; - adapt->QueryImageAttributes = I830QueryImageAttributesTextured; - - for (i = 0; i < nports; i++) { - I830PortPrivPtr pPriv = &portPrivs[i]; - - pPriv->textured = TRUE; - pPriv->videoStatus = 0; - pPriv->linear = NULL; - pPriv->currentBuf = 0; - pPriv->doubleBuffer = 0; - - /* gotta uninit this someplace, XXX: shouldn't be necessary for textured */ - REGION_NULL(pScreen, &pPriv->clip); - - adapt->pPortPrivates[i].ptr = (pointer) (pPriv); - } - - return adapt; + XF86VideoAdaptorPtr adapt; + XF86AttributePtr attrs; + I830PortPrivPtr portPrivs; + DevUnion *devUnions; + int nports = 16, i; + int nAttributes; + + OVERLAY_DEBUG("I830SetupImageVideoOverlay\n"); + + nAttributes = NUM_TEXTURED_ATTRIBUTES; + + adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec)); + portPrivs = xcalloc(nports, sizeof(I830PortPrivRec)); + devUnions = xcalloc(nports, sizeof(DevUnion)); + attrs = xcalloc(nAttributes, sizeof(XF86AttributeRec)); + if (adapt == NULL || portPrivs == NULL || devUnions == NULL || + attrs == NULL) + { + xfree(adapt); + xfree(portPrivs); + xfree(devUnions); + xfree(attrs); + return NULL; + } + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = 0; + adapt->name = "Intel(R) Textured Video"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = nports; + adapt->pPortPrivates = devUnions; + adapt->nAttributes = nAttributes; + adapt->pAttributes = attrs; + memcpy(attrs, TexturedAttributes, nAttributes * sizeof(XF86AttributeRec)); + adapt->nImages = NUM_IMAGES; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = I830StopVideo; + adapt->SetPortAttribute = I830SetPortAttribute; + adapt->GetPortAttribute = I830GetPortAttribute; + adapt->QueryBestSize = I830QueryBestSize; + adapt->PutImage = I830PutImage; + adapt->QueryImageAttributes = I830QueryImageAttributesTextured; + + for (i = 0; i < nports; i++) { + I830PortPrivPtr pPriv = &portPrivs[i]; + + pPriv->textured = TRUE; + pPriv->videoStatus = 0; + pPriv->buf = NULL; + pPriv->currentBuf = 0; + pPriv->doubleBuffer = 0; + + /* gotta uninit this someplace, XXX: shouldn't be necessary for textured */ + REGION_NULL(pScreen, &pPriv->clip); + + adapt->pPortPrivates[i].ptr = (pointer) (pPriv); + } + + return adapt; } static Bool RegionsEqual(RegionPtr A, RegionPtr B) { - int *dataA, *dataB; - int num; - - num = REGION_NUM_RECTS(A); - if (num != REGION_NUM_RECTS(B)) - return FALSE; - - if ((A->extents.x1 != B->extents.x1) || - (A->extents.x2 != B->extents.x2) || - (A->extents.y1 != B->extents.y1) || (A->extents.y2 != B->extents.y2)) - return FALSE; - - dataA = (int *)REGION_RECTS(A); - dataB = (int *)REGION_RECTS(B); - - while (num--) { - if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - return FALSE; - dataA += 2; - dataB += 2; - } + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if (num != REGION_NUM_RECTS(B)) + return FALSE; + + if ((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int *)REGION_RECTS(A); + dataB = (int *)REGION_RECTS(B); - return TRUE; + while (num--) { + if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } + + return TRUE; } static void I830StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { - I830PortPrivPtr pPriv = (I830PortPrivPtr) data; - I830Ptr pI830 = I830PTR(pScrn); - - if (pPriv->textured) - return; - - ErrorF("I830StopVideo\n"); - - REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - - if (shutdown) { - if (pPriv->videoStatus & CLIENT_VIDEO_ON) { - - I830ResetVideo(pScrn); - OVERLAY_UPDATE; - OVERLAY_OFF; - - if (pI830->entityPrivate) - pI830->entityPrivate->XvInUse = -1; - } - if (pPriv->linear) { - xf86FreeOffscreenLinear(pPriv->linear); - pPriv->linear = NULL; - } - pPriv->videoStatus = 0; - } else { - if (pPriv->videoStatus & CLIENT_VIDEO_ON) { - pPriv->videoStatus |= OFF_TIMER; - pPriv->offTime = currentTime.milliseconds + OFF_DELAY; - } - } + I830PortPrivPtr pPriv = (I830PortPrivPtr) data; + I830Ptr pI830 = I830PTR(pScrn); + + if (pPriv->textured) + return; + + OVERLAY_DEBUG("I830StopVideo\n"); + + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + if (shutdown) { + if (pPriv->videoStatus & CLIENT_VIDEO_ON) { + i830_overlay_off(pScrn); + if (pI830->entityPrivate) + pI830->entityPrivate->XvInUse = -1; + } + /* Sync before freeing the buffer, because the pages will be unbound. + */ + I830Sync(pScrn); + i830_free_memory(pScrn, pPriv->buf); + pPriv->buf = NULL; + pPriv->videoStatus = 0; + } else { + if (pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } } @@ -915,135 +1027,144 @@ static int I830SetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, pointer data) { - I830PortPrivPtr pPriv = (I830PortPrivPtr) data; - I830Ptr pI830 = I830PTR(pScrn); - I830OverlayRegPtr overlay = - (I830OverlayRegPtr) (pI830->FbBase + pI830->OverlayMem->Start); - - if (pPriv->textured) { - /* XXX: Currently the brightness/saturation attributes aren't hooked up. - * However, apps expect them to be there, and the spec seems to let us - * sneak out of actually implementing them for now. - */ - return Success; - } - - if (attribute == xvBrightness) { - if ((value < -128) || (value > 127)) - return BadValue; - pPriv->brightness = value; - overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff); - ErrorF("BRIGHTNESS\n"); - if (*pI830->overlayOn) - OVERLAY_UPDATE; - } else if (attribute == xvContrast) { - if ((value < 0) || (value > 255)) - return BadValue; - pPriv->contrast = value; - overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff); - ErrorF("CONTRAST\n"); - if (*pI830->overlayOn) - OVERLAY_UPDATE; - } else if (pI830->Clone && attribute == xvPipe) { - if ((value < 0) || (value > 1)) - return BadValue; - pPriv->pipe = value; - /* - * Select which pipe the overlay is enabled on. - */ - overlay->OCONFIG &= ~OVERLAY_PIPE_MASK; - if (pPriv->pipe == 0) - overlay->OCONFIG |= OVERLAY_PIPE_A; - else - overlay->OCONFIG |= OVERLAY_PIPE_B; - ErrorF("PIPE CHANGE\n"); - if (*pI830->overlayOn) - OVERLAY_UPDATE; - } else if (attribute == xvGamma0 && (IS_I9XX(pI830))) { - pPriv->gamma0 = value; - } else if (attribute == xvGamma1 && (IS_I9XX(pI830))) { - pPriv->gamma1 = value; - } else if (attribute == xvGamma2 && (IS_I9XX(pI830))) { - pPriv->gamma2 = value; - } else if (attribute == xvGamma3 && (IS_I9XX(pI830))) { - pPriv->gamma3 = value; - } else if (attribute == xvGamma4 && (IS_I9XX(pI830))) { - pPriv->gamma4 = value; - } else if (attribute == xvGamma5 && (IS_I9XX(pI830))) { - pPriv->gamma5 = value; - } else if (attribute == xvColorKey) { - pPriv->colorKey = value; - switch (pScrn->depth) { - case 16: - overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey); - break; - case 15: - overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey); - break; - default: - overlay->DCLRKV = pPriv->colorKey; - break; - } - ErrorF("COLORKEY\n"); - if (*pI830->overlayOn) - OVERLAY_UPDATE; - REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - } else if(attribute == xvDoubleBuffer) { - if ((value < 0) || (value > 1)) - return BadValue; - /* Do not allow buffer change while playing video */ - if(!*pI830->overlayOn) - pPriv->doubleBuffer = value; - } else - return BadMatch; - - /* Ensure that the overlay is off, ready for updating */ - if ((attribute == xvGamma0 || - attribute == xvGamma1 || - attribute == xvGamma2 || - attribute == xvGamma3 || - attribute == xvGamma4 || - attribute == xvGamma5) && (IS_I9XX(pI830))) { - ErrorF("GAMMA\n"); + I830PortPrivPtr pPriv = (I830PortPrivPtr) data; + I830Ptr pI830 = I830PTR(pScrn); + I830OverlayRegPtr overlay; + + if (pPriv->textured) { + /* XXX: Currently the brightness/saturation attributes aren't hooked up. + * However, apps expect them to be there, and the spec seems to let us + * sneak out of actually implementing them for now. + */ + return Success; + } + + overlay = I830OVERLAYREG(pI830); + + if (attribute == xvBrightness) { + if ((value < -128) || (value > 127)) + return BadValue; + pPriv->brightness = value; + overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff); + OVERLAY_DEBUG("BRIGHTNESS\n"); + i830_overlay_continue (pScrn, FALSE); + } else if (attribute == xvContrast) { + if ((value < 0) || (value > 255)) + return BadValue; + pPriv->contrast = value; + overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff); + OVERLAY_DEBUG("CONTRAST\n"); + i830_overlay_continue (pScrn, FALSE); + } else if (attribute == xvSaturation) { + if ((value < 0) || (value > 1023)) + return BadValue; + pPriv->saturation = value; + overlay->OCLRC1 = pPriv->saturation; + i830_overlay_continue (pScrn, FALSE); + } else if (attribute == xvPipe) { + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + if ((value < -1) || (value > xf86_config->num_crtc)) + return BadValue; + if (value < 0) + pPriv->desired_crtc = NULL; + else + pPriv->desired_crtc = xf86_config->crtc[value]; + /* + * Leave this to be updated at the next frame + */ + } else if (attribute == xvGamma0 && (IS_I9XX(pI830))) { + pPriv->gamma0 = value; + } else if (attribute == xvGamma1 && (IS_I9XX(pI830))) { + pPriv->gamma1 = value; + } else if (attribute == xvGamma2 && (IS_I9XX(pI830))) { + pPriv->gamma2 = value; + } else if (attribute == xvGamma3 && (IS_I9XX(pI830))) { + pPriv->gamma3 = value; + } else if (attribute == xvGamma4 && (IS_I9XX(pI830))) { + pPriv->gamma4 = value; + } else if (attribute == xvGamma5 && (IS_I9XX(pI830))) { + pPriv->gamma5 = value; + } else if (attribute == xvColorKey) { + pPriv->colorKey = value; + switch (pScrn->depth) { + case 16: + overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey); + break; + case 15: + overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey); + break; + default: + overlay->DCLRKV = pPriv->colorKey; + break; + } + OVERLAY_DEBUG("COLORKEY\n"); + i830_overlay_continue (pScrn, FALSE); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } else if(attribute == xvDoubleBuffer) { + if ((value < 0) || (value > 1)) + return BadValue; + /* Do not allow buffer change while playing video */ + if(!*pI830->overlayOn) + pPriv->doubleBuffer = value; + } else + return BadMatch; + + /* Ensure that the overlay is off, ready for updating */ + if ((attribute == xvGamma0 || + attribute == xvGamma1 || + attribute == xvGamma2 || + attribute == xvGamma3 || + attribute == xvGamma4 || + attribute == xvGamma5) && (IS_I9XX(pI830))) { + OVERLAY_DEBUG("GAMMA\n"); I830UpdateGamma(pScrn); - } + } - return Success; + return Success; } static int I830GetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 * value, pointer data) { - I830Ptr pI830 = I830PTR(pScrn); - I830PortPrivPtr pPriv = (I830PortPrivPtr) data; - - if (attribute == xvBrightness) { - *value = pPriv->brightness; - } else if (attribute == xvContrast) { - *value = pPriv->contrast; - } else if (attribute == xvPipe) { - *value = pPriv->pipe; - } else if (attribute == xvGamma0 && (IS_I9XX(pI830))) { - *value = pPriv->gamma0; - } else if (attribute == xvGamma1 && (IS_I9XX(pI830))) { - *value = pPriv->gamma1; - } else if (attribute == xvGamma2 && (IS_I9XX(pI830))) { - *value = pPriv->gamma2; - } else if (attribute == xvGamma3 && (IS_I9XX(pI830))) { - *value = pPriv->gamma3; - } else if (attribute == xvGamma4 && (IS_I9XX(pI830))) { - *value = pPriv->gamma4; - } else if (attribute == xvGamma5 && (IS_I9XX(pI830))) { - *value = pPriv->gamma5; - } else if (attribute == xvColorKey) { - *value = pPriv->colorKey; - } else if (attribute == xvDoubleBuffer) { - *value = pPriv->doubleBuffer; - } else - return BadMatch; - - return Success; + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = (I830PortPrivPtr) data; + + if (attribute == xvBrightness) { + *value = pPriv->brightness; + } else if (attribute == xvContrast) { + *value = pPriv->contrast; + } else if (attribute == xvSaturation) { + *value = pPriv->saturation; + } else if (attribute == xvPipe) { + int c; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + for (c = 0; c < xf86_config->num_crtc; c++) + if (xf86_config->crtc[c] == pPriv->desired_crtc) + break; + if (c == xf86_config->num_crtc) + c = -1; + *value = c; + } else if (attribute == xvGamma0 && (IS_I9XX(pI830))) { + *value = pPriv->gamma0; + } else if (attribute == xvGamma1 && (IS_I9XX(pI830))) { + *value = pPriv->gamma1; + } else if (attribute == xvGamma2 && (IS_I9XX(pI830))) { + *value = pPriv->gamma2; + } else if (attribute == xvGamma3 && (IS_I9XX(pI830))) { + *value = pPriv->gamma3; + } else if (attribute == xvGamma4 && (IS_I9XX(pI830))) { + *value = pPriv->gamma4; + } else if (attribute == xvGamma5 && (IS_I9XX(pI830))) { + *value = pPriv->gamma5; + } else if (attribute == xvColorKey) { + *value = pPriv->colorKey; + } else if (attribute == xvDoubleBuffer) { + *value = pPriv->doubleBuffer; + } else + return BadMatch; + + return Success; } static void @@ -1053,13 +1174,13 @@ I830QueryBestSize(ScrnInfoPtr pScrn, short drw_w, short drw_h, unsigned int *p_w, unsigned int *p_h, pointer data) { - if (vid_w > (drw_w << 1)) - drw_w = vid_w >> 1; - if (vid_h > (drw_h << 1)) - drw_h = vid_h >> 1; + if (vid_w > (drw_w << 1)) + drw_w = vid_w >> 1; + if (vid_h > (drw_h << 1)) + drw_h = vid_h >> 1; - *p_w = drw_w; - *p_h = drw_h; + *p_w = drw_w; + *p_h = drw_h; } static void @@ -1068,92 +1189,95 @@ I830CopyPackedData(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int srcPitch, int dstPitch, int top, int left, int h, int w) { - I830Ptr pI830 = I830PTR(pScrn); - unsigned char *src, *dst; - int i,j; - unsigned char *s; - - ErrorF("I830CopyPackedData: (%d,%d) (%d,%d)\n" - "srcPitch: %d, dstPitch: %d\n", top, left, h, w, srcPitch, dstPitch); - - src = buf + (top * srcPitch) + (left << 1); - - if (pPriv->currentBuf == 0) - dst = pI830->FbBase + pPriv->YBuf0offset; - else - dst = pI830->FbBase + pPriv->YBuf1offset; - - switch (pI830->rotation) { - case RR_Rotate_0: - w <<= 1; - for (i = 0; i < h; i++) { - memcpy(dst, src, w); - src += srcPitch; - dst += dstPitch; - } - break; - case RR_Rotate_90: - h <<= 1; - for (i = 0; i < h; i+=2) { - s = src; - for (j = 0; j < w; j++) { + I830Ptr pI830 = I830PTR(pScrn); + unsigned char *src, *dst; + int i,j; + unsigned char *s; + +#if 0 + ErrorF("I830CopyPackedData: (%d,%d) (%d,%d)\n" + "srcPitch: %d, dstPitch: %d\n", top, left, h, w, + srcPitch, dstPitch); +#endif + + src = buf + (top * srcPitch) + (left << 1); + + if (pPriv->currentBuf == 0) + dst = pI830->FbBase + pPriv->YBuf0offset; + else + dst = pI830->FbBase + pPriv->YBuf1offset; + + switch (pI830->rotation) { + case RR_Rotate_0: + w <<= 1; + for (i = 0; i < h; i++) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } + break; + case RR_Rotate_90: + h <<= 1; + for (i = 0; i < h; i+=2) { + s = src; + for (j = 0; j < w; j++) { /* Copy Y */ - dst[(i + 0) + ((w - j - 1) * dstPitch)] = *s++; + dst[(i + 0) + ((w - j - 1) * dstPitch)] = *s++; (void)*s++; - } - src += srcPitch; - } - h >>= 1; - src = buf + (top * srcPitch) + (left << 1); - for (i = 0; i < h; i+=2) { - for (j = 0; j < w; j+=2) { + } + src += srcPitch; + } + h >>= 1; + src = buf + (top * srcPitch) + (left << 1); + for (i = 0; i < h; i+=2) { + for (j = 0; j < w; j+=2) { /* Copy U */ dst[((i*2) + 1) + ((w - j - 1) * dstPitch)] = src[(j*2) + 1 + (i * srcPitch)]; dst[((i*2) + 1) + ((w - j - 2) * dstPitch)] = src[(j*2) + 1 + ((i+1) * srcPitch)]; /* Copy V */ dst[((i*2) + 3) + ((w - j - 1) * dstPitch)] = src[(j*2) + 3 + (i * srcPitch)]; dst[((i*2) + 3) + ((w - j - 2) * dstPitch)] = src[(j*2) + 3 + ((i+1) * srcPitch)]; - } - } - break; - case RR_Rotate_180: - w <<= 1; - for (i = 0; i < h; i++) { - s = src; - for (j = 0; j < w; j+=4) { - dst[(w - j - 4) + ((h - i - 1) * dstPitch)] = *s++; - dst[(w - j - 3) + ((h - i - 1) * dstPitch)] = *s++; - dst[(w - j - 2) + ((h - i - 1) * dstPitch)] = *s++; - dst[(w - j - 1) + ((h - i - 1) * dstPitch)] = *s++; - } - src += srcPitch; - } - break; - case RR_Rotate_270: - h <<= 1; - for (i = 0; i < h; i+=2) { - s = src; - for (j = 0; j < w; j++) { + } + } + break; + case RR_Rotate_180: + w <<= 1; + for (i = 0; i < h; i++) { + s = src; + for (j = 0; j < w; j+=4) { + dst[(w - j - 4) + ((h - i - 1) * dstPitch)] = *s++; + dst[(w - j - 3) + ((h - i - 1) * dstPitch)] = *s++; + dst[(w - j - 2) + ((h - i - 1) * dstPitch)] = *s++; + dst[(w - j - 1) + ((h - i - 1) * dstPitch)] = *s++; + } + src += srcPitch; + } + break; + case RR_Rotate_270: + h <<= 1; + for (i = 0; i < h; i+=2) { + s = src; + for (j = 0; j < w; j++) { /* Copy Y */ - dst[(h - i - 2) + (j * dstPitch)] = *s++; + dst[(h - i - 2) + (j * dstPitch)] = *s++; (void)*s++; - } - src += srcPitch; - } - h >>= 1; - src = buf + (top * srcPitch) + (left << 1); - for (i = 0; i < h; i+=2) { - for (j = 0; j < w; j+=2) { + } + src += srcPitch; + } + h >>= 1; + src = buf + (top * srcPitch) + (left << 1); + for (i = 0; i < h; i+=2) { + for (j = 0; j < w; j+=2) { /* Copy U */ dst[(((h - i)*2) - 3) + (j * dstPitch)] = src[(j*2) + 1 + (i * srcPitch)]; dst[(((h - i)*2) - 3) + ((j - 1) * dstPitch)] = src[(j*2) + 1 + ((i+1) * srcPitch)]; /* Copy V */ dst[(((h - i)*2) - 1) + (j * dstPitch)] = src[(j*2) + 3 + (i * srcPitch)]; dst[(((h - i)*2) - 1) + ((j - 1) * dstPitch)] = src[(j*2) + 3 + ((i+1) * srcPitch)]; - } - } - break; - } + } + } + break; + } } /* Copies planar data in *buf to UYVY-packed data in the screen atYBufXOffset. @@ -1164,55 +1288,55 @@ I830CopyPlanarToPackedData(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int srcPitch2, int dstPitch, int srcH, int top, int left, int h, int w, int id) { - I830Ptr pI830 = I830PTR(pScrn); - CARD8 *dst1, *srcy, *srcu, *srcv; - int y; - - if (pPriv->currentBuf == 0) - dst1 = pI830->FbBase + pPriv->YBuf0offset; - else - dst1 = pI830->FbBase + pPriv->YBuf1offset; - - srcy = buf + (top * srcPitch) + left; - if (id == FOURCC_YV12) { - srcu = buf + (srcH * srcPitch) + ((top / 2) * srcPitch2) + (left / 2); - srcv = buf + (srcH * srcPitch) + ((srcH / 2) * srcPitch2) + - ((top / 2) * srcPitch2) + (left / 2); - } else { - srcv = buf + (srcH * srcPitch) + ((top / 2) * srcPitch2) + (left / 2); - srcu = buf + (srcH * srcPitch) + ((srcH / 2) * srcPitch2) + - ((top / 2) * srcPitch2) + (left / 2); - } - - for (y = 0; y < h; y++) { - CARD32 *dst = (CARD32 *)dst1; - CARD8 *sy = srcy; - CARD8 *su = srcu; - CARD8 *sv = srcv; - int i; - - i = w / 2; - while(i > 4) { - dst[0] = sy[0] | (sy[1] << 16) | (sv[0] << 8) | (su[0] << 24); - dst[1] = sy[2] | (sy[3] << 16) | (sv[1] << 8) | (su[1] << 24); - dst[2] = sy[4] | (sy[5] << 16) | (sv[2] << 8) | (su[2] << 24); - dst[3] = sy[6] | (sy[7] << 16) | (sv[3] << 8) | (su[3] << 24); - dst += 4; su += 4; sv += 4; sy += 8; - i -= 4; - } - while(i--) { - dst[0] = sy[0] | (sy[1] << 16) | (sv[0] << 8) | (su[0] << 24); - dst++; su++; sv++; - sy += 2; - } - - dst1 += dstPitch; - srcy += srcPitch; - if (y & 1) { - srcu += srcPitch2; - srcv += srcPitch2; - } - } + I830Ptr pI830 = I830PTR(pScrn); + CARD8 *dst1, *srcy, *srcu, *srcv; + int y; + + if (pPriv->currentBuf == 0) + dst1 = pI830->FbBase + pPriv->YBuf0offset; + else + dst1 = pI830->FbBase + pPriv->YBuf1offset; + + srcy = buf + (top * srcPitch) + left; + if (id == FOURCC_YV12) { + srcu = buf + (srcH * srcPitch) + ((top / 2) * srcPitch2) + (left / 2); + srcv = buf + (srcH * srcPitch) + ((srcH / 2) * srcPitch2) + + ((top / 2) * srcPitch2) + (left / 2); + } else { + srcv = buf + (srcH * srcPitch) + ((top / 2) * srcPitch2) + (left / 2); + srcu = buf + (srcH * srcPitch) + ((srcH / 2) * srcPitch2) + + ((top / 2) * srcPitch2) + (left / 2); + } + + for (y = 0; y < h; y++) { + CARD32 *dst = (CARD32 *)dst1; + CARD8 *sy = srcy; + CARD8 *su = srcu; + CARD8 *sv = srcv; + int i; + + i = w / 2; + while(i > 4) { + dst[0] = sy[0] | (sy[1] << 16) | (sv[0] << 8) | (su[0] << 24); + dst[1] = sy[2] | (sy[3] << 16) | (sv[1] << 8) | (su[1] << 24); + dst[2] = sy[4] | (sy[5] << 16) | (sv[2] << 8) | (su[2] << 24); + dst[3] = sy[6] | (sy[7] << 16) | (sv[3] << 8) | (su[3] << 24); + dst += 4; su += 4; sv += 4; sy += 8; + i -= 4; + } + while(i--) { + dst[0] = sy[0] | (sy[1] << 16) | (sv[0] << 8) | (su[0] << 24); + dst++; su++; sv++; + sy += 2; + } + + dst1 += dstPitch; + srcy += srcPitch; + if (y & 1) { + srcu += srcPitch2; + srcv += srcPitch2; + } + } } static void @@ -1221,1677 +1345,812 @@ I830CopyPlanarData(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int srcPitch2, int dstPitch, int srcH, int top, int left, int h, int w, int id) { - I830Ptr pI830 = I830PTR(pScrn); - int i, j = 0; - unsigned char *src1, *src2, *src3, *dst1, *dst2, *dst3; - unsigned char *s; - int dstPitch2 = dstPitch << 1; - - ErrorF("I830CopyPlanarData: srcPitch %d, srcPitch %d, dstPitch %d\n" - "nlines %d, npixels %d, top %d, left %d\n", srcPitch, srcPitch2, dstPitch, - h, w, top, left); - - /* Copy Y data */ - src1 = buf + (top * srcPitch) + left; - ErrorF("src1 is %p, offset is %ld\n", src1, - (unsigned long)src1 - (unsigned long)buf); - if (pPriv->currentBuf == 0) - dst1 = pI830->FbBase + pPriv->YBuf0offset; - else - dst1 = pI830->FbBase + pPriv->YBuf1offset; - - switch (pI830->rotation) { - case RR_Rotate_0: - for (i = 0; i < h; i++) { - memcpy(dst1, src1, w); - src1 += srcPitch; - dst1 += dstPitch2; - } - break; - case RR_Rotate_90: - for (i = 0; i < h; i++) { - s = src1; - for (j = 0; j < w; j++) { - dst1[(i) + ((w - j - 1) * dstPitch2)] = *s++; - } - src1 += srcPitch; - } - break; - case RR_Rotate_180: - for (i = 0; i < h; i++) { - s = src1; - for (j = 0; j < w; j++) { - dst1[(w - j - 1) + ((h - i - 1) * dstPitch2)] = *s++; - } - src1 += srcPitch; - } - break; - case RR_Rotate_270: - for (i = 0; i < h; i++) { - s = src1; - for (j = 0; j < w; j++) { - dst1[(h - i - 1) + (j * dstPitch2)] = *s++; - } - src1 += srcPitch; - } - break; - } + I830Ptr pI830 = I830PTR(pScrn); + int i, j = 0; + unsigned char *src1, *src2, *src3, *dst1, *dst2, *dst3; + unsigned char *s; + int dstPitch2 = dstPitch << 1; - /* Copy V data for YV12, or U data for I420 */ - src2 = buf + (srcH * srcPitch) + ((top * srcPitch) >> 2) + (left >> 1); - ErrorF("src2 is %p, offset is %ld\n", src2, - (unsigned long)src2 - (unsigned long)buf); - if (pPriv->currentBuf == 0) { - if (id == FOURCC_I420) - dst2 = pI830->FbBase + pPriv->UBuf0offset; - else - dst2 = pI830->FbBase + pPriv->VBuf0offset; - } else { - if (id == FOURCC_I420) - dst2 = pI830->FbBase + pPriv->UBuf1offset; - else - dst2 = pI830->FbBase + pPriv->VBuf1offset; - } - - switch (pI830->rotation) { - case RR_Rotate_0: - for (i = 0; i < h / 2; i++) { - memcpy(dst2, src2, w / 2); - src2 += srcPitch2; - dst2 += dstPitch; - } - break; - case RR_Rotate_90: - for (i = 0; i < (h/2); i++) { - s = src2; - for (j = 0; j < (w/2); j++) { - dst2[(i) + (((w/2) - j - 1) * (dstPitch))] = *s++; - } - src2 += srcPitch2; - } - break; - case RR_Rotate_180: - for (i = 0; i < (h/2); i++) { - s = src2; - for (j = 0; j < (w/2); j++) { - dst2[((w/2) - j - 1) + (((h/2) - i - 1) * dstPitch)] = *s++; - } - src2 += srcPitch2; - } - break; - case RR_Rotate_270: - for (i = 0; i < (h/2); i++) { - s = src2; - for (j = 0; j < (w/2); j++) { - dst2[((h/2) - i - 1) + (j * dstPitch)] = *s++; - } - src2 += srcPitch2; - } - break; - } +#if 0 + ErrorF("I830CopyPlanarData: srcPitch %d, srcPitch %d, dstPitch %d\n" + "nlines %d, npixels %d, top %d, left %d\n", + srcPitch, srcPitch2, dstPitch, + h, w, top, left); +#endif - /* Copy U data for YV12, or V data for I420 */ - src3 = buf + (srcH * srcPitch) + ((srcH >> 1) * srcPitch2) + - ((top * srcPitch) >> 2) + (left >> 1); - ErrorF("src3 is %p, offset is %ld\n", src3, - (unsigned long)src3 - (unsigned long)buf); - if (pPriv->currentBuf == 0) { - if (id == FOURCC_I420) - dst3 = pI830->FbBase + pPriv->VBuf0offset; - else - dst3 = pI830->FbBase + pPriv->UBuf0offset; - } else { - if (id == FOURCC_I420) - dst3 = pI830->FbBase + pPriv->VBuf1offset; - else - dst3 = pI830->FbBase + pPriv->UBuf1offset; - } + /* Copy Y data */ + src1 = buf + (top * srcPitch) + left; +#if 0 + ErrorF("src1 is %p, offset is %ld\n", src1, + (unsigned long)src1 - (unsigned long)buf); +#endif + if (pPriv->currentBuf == 0) + dst1 = pI830->FbBase + pPriv->YBuf0offset; + else + dst1 = pI830->FbBase + pPriv->YBuf1offset; + + switch (pI830->rotation) { + case RR_Rotate_0: + for (i = 0; i < h; i++) { + memcpy(dst1, src1, w); + src1 += srcPitch; + dst1 += dstPitch2; + } + break; + case RR_Rotate_90: + for (i = 0; i < h; i++) { + s = src1; + for (j = 0; j < w; j++) { + dst1[(i) + ((w - j - 1) * dstPitch2)] = *s++; + } + src1 += srcPitch; + } + break; + case RR_Rotate_180: + for (i = 0; i < h; i++) { + s = src1; + for (j = 0; j < w; j++) { + dst1[(w - j - 1) + ((h - i - 1) * dstPitch2)] = *s++; + } + src1 += srcPitch; + } + break; + case RR_Rotate_270: + for (i = 0; i < h; i++) { + s = src1; + for (j = 0; j < w; j++) { + dst1[(h - i - 1) + (j * dstPitch2)] = *s++; + } + src1 += srcPitch; + } + break; + } - switch (pI830->rotation) { - case RR_Rotate_0: - for (i = 0; i < h / 2; i++) { - memcpy(dst3, src3, w / 2); - src3 += srcPitch2; - dst3 += dstPitch; - } - break; - case RR_Rotate_90: - for (i = 0; i < (h/2); i++) { - s = src3; - for (j = 0; j < (w/2); j++) { - dst3[(i) + (((w/2) - j - 1) * (dstPitch))] = *s++; - } - src3 += srcPitch2; - } - break; - case RR_Rotate_180: - for (i = 0; i < (h/2); i++) { - s = src3; - for (j = 0; j < (w/2); j++) { - dst3[((w/2) - j - 1) + (((h/2) - i - 1) * dstPitch)] = *s++; - } - src3 += srcPitch2; - } - break; - case RR_Rotate_270: - for (i = 0; i < (h/2); i++) { - s = src3; - for (j = 0; j < (w/2); j++) { - dst3[((h/2) - i - 1) + (j * dstPitch)] = *s++; - } - src3 += srcPitch2; - } - break; - } + /* Copy V data for YV12, or U data for I420 */ + src2 = buf + (srcH * srcPitch) + ((top * srcPitch) >> 2) + (left >> 1); +#if 0 + ErrorF("src2 is %p, offset is %ld\n", src2, + (unsigned long)src2 - (unsigned long)buf); +#endif + if (pPriv->currentBuf == 0) { + if (id == FOURCC_I420) + dst2 = pI830->FbBase + pPriv->UBuf0offset; + else + dst2 = pI830->FbBase + pPriv->VBuf0offset; + } else { + if (id == FOURCC_I420) + dst2 = pI830->FbBase + pPriv->UBuf1offset; + else + dst2 = pI830->FbBase + pPriv->VBuf1offset; + } + + switch (pI830->rotation) { + case RR_Rotate_0: + for (i = 0; i < h / 2; i++) { + memcpy(dst2, src2, w / 2); + src2 += srcPitch2; + dst2 += dstPitch; + } + break; + case RR_Rotate_90: + for (i = 0; i < (h/2); i++) { + s = src2; + for (j = 0; j < (w/2); j++) { + dst2[(i) + (((w/2) - j - 1) * (dstPitch))] = *s++; + } + src2 += srcPitch2; + } + break; + case RR_Rotate_180: + for (i = 0; i < (h/2); i++) { + s = src2; + for (j = 0; j < (w/2); j++) { + dst2[((w/2) - j - 1) + (((h/2) - i - 1) * dstPitch)] = *s++; + } + src2 += srcPitch2; + } + break; + case RR_Rotate_270: + for (i = 0; i < (h/2); i++) { + s = src2; + for (j = 0; j < (w/2); j++) { + dst2[((h/2) - i - 1) + (j * dstPitch)] = *s++; + } + src2 += srcPitch2; + } + break; + } + + /* Copy U data for YV12, or V data for I420 */ + src3 = buf + (srcH * srcPitch) + ((srcH >> 1) * srcPitch2) + + ((top * srcPitch) >> 2) + (left >> 1); +#if 0 + ErrorF("src3 is %p, offset is %ld\n", src3, + (unsigned long)src3 - (unsigned long)buf); +#endif + if (pPriv->currentBuf == 0) { + if (id == FOURCC_I420) + dst3 = pI830->FbBase + pPriv->VBuf0offset; + else + dst3 = pI830->FbBase + pPriv->UBuf0offset; + } else { + if (id == FOURCC_I420) + dst3 = pI830->FbBase + pPriv->VBuf1offset; + else + dst3 = pI830->FbBase + pPriv->UBuf1offset; + } + + switch (pI830->rotation) { + case RR_Rotate_0: + for (i = 0; i < h / 2; i++) { + memcpy(dst3, src3, w / 2); + src3 += srcPitch2; + dst3 += dstPitch; + } + break; + case RR_Rotate_90: + for (i = 0; i < (h/2); i++) { + s = src3; + for (j = 0; j < (w/2); j++) { + dst3[(i) + (((w/2) - j - 1) * (dstPitch))] = *s++; + } + src3 += srcPitch2; + } + break; + case RR_Rotate_180: + for (i = 0; i < (h/2); i++) { + s = src3; + for (j = 0; j < (w/2); j++) { + dst3[((w/2) - j - 1) + (((h/2) - i - 1) * dstPitch)] = *s++; + } + src3 += srcPitch2; + } + break; + case RR_Rotate_270: + for (i = 0; i < (h/2); i++) { + s = src3; + for (j = 0; j < (w/2); j++) { + dst3[((h/2) - i - 1) + (j * dstPitch)] = *s++; + } + src3 += srcPitch2; + } + break; + } } typedef struct { - CARD8 sign; - CARD16 mantissa; - CARD8 exponent; + CARD8 sign; + CARD16 mantissa; + CARD8 exponent; } coeffRec, *coeffPtr; static Bool SetCoeffRegs(double *coeff, int mantSize, coeffPtr pCoeff, int pos) { - int maxVal, icoeff, res; - int sign; - double c; - - sign = 0; - maxVal = 1 << mantSize; - c = *coeff; - if (c < 0.0) { - sign = 1; - c = -c; - } - - res = 12 - mantSize; - if ((icoeff = (int)(c * 4 * maxVal + 0.5)) < maxVal) { - pCoeff[pos].exponent = 3; - pCoeff[pos].mantissa = icoeff << res; - *coeff = (double)icoeff / (double)(4 * maxVal); - } else if ((icoeff = (int)(c * 2 * maxVal + 0.5)) < maxVal) { - pCoeff[pos].exponent = 2; - pCoeff[pos].mantissa = icoeff << res; - *coeff = (double)icoeff / (double)(2 * maxVal); - } else if ((icoeff = (int)(c * maxVal + 0.5)) < maxVal) { - pCoeff[pos].exponent = 1; - pCoeff[pos].mantissa = icoeff << res; - *coeff = (double)icoeff / (double)(maxVal); - } else if ((icoeff = (int)(c * maxVal * 0.5 + 0.5)) < maxVal) { - pCoeff[pos].exponent = 0; - pCoeff[pos].mantissa = icoeff << res; - *coeff = (double)icoeff / (double)(maxVal / 2); - } else { - /* Coeff out of range */ - return FALSE; - } - - pCoeff[pos].sign = sign; - if (sign) - *coeff = -(*coeff); - return TRUE; + int maxVal, icoeff, res; + int sign; + double c; + + sign = 0; + maxVal = 1 << mantSize; + c = *coeff; + if (c < 0.0) { + sign = 1; + c = -c; + } + + res = 12 - mantSize; + if ((icoeff = (int)(c * 4 * maxVal + 0.5)) < maxVal) { + pCoeff[pos].exponent = 3; + pCoeff[pos].mantissa = icoeff << res; + *coeff = (double)icoeff / (double)(4 * maxVal); + } else if ((icoeff = (int)(c * 2 * maxVal + 0.5)) < maxVal) { + pCoeff[pos].exponent = 2; + pCoeff[pos].mantissa = icoeff << res; + *coeff = (double)icoeff / (double)(2 * maxVal); + } else if ((icoeff = (int)(c * maxVal + 0.5)) < maxVal) { + pCoeff[pos].exponent = 1; + pCoeff[pos].mantissa = icoeff << res; + *coeff = (double)icoeff / (double)(maxVal); + } else if ((icoeff = (int)(c * maxVal * 0.5 + 0.5)) < maxVal) { + pCoeff[pos].exponent = 0; + pCoeff[pos].mantissa = icoeff << res; + *coeff = (double)icoeff / (double)(maxVal / 2); + } else { + /* Coeff out of range */ + return FALSE; + } + + pCoeff[pos].sign = sign; + if (sign) + *coeff = -(*coeff); + return TRUE; } static void UpdateCoeff(int taps, double fCutoff, Bool isHoriz, Bool isY, coeffPtr pCoeff) { - int i, j, j1, num, pos, mantSize; - double pi = 3.1415926535, val, sinc, window, sum; - double rawCoeff[MAX_TAPS * 32], coeffs[N_PHASES][MAX_TAPS]; - double diff; - int tapAdjust[MAX_TAPS], tap2Fix; - Bool isVertAndUV; - - if (isHoriz) - mantSize = 7; - else - mantSize = 6; - - isVertAndUV = !isHoriz && !isY; - num = taps * 16; - for (i = 0; i < num * 2; i++) { - val = (1.0 / fCutoff) * taps * pi * (i - num) / (2 * num); - if (val == 0.0) - sinc = 1.0; - else - sinc = sin(val) / val; - - /* Hamming window */ - window = (0.5 - 0.5 * cos(i * pi / num)); - rawCoeff[i] = sinc * window; - } - - for (i = 0; i < N_PHASES; i++) { - /* Normalise the coefficients. */ - sum = 0.0; - for (j = 0; j < taps; j++) { - pos = i + j * 32; - sum += rawCoeff[pos]; - } - for (j = 0; j < taps; j++) { - pos = i + j * 32; - coeffs[i][j] = rawCoeff[pos] / sum; - } - - /* Set the register values. */ - for (j = 0; j < taps; j++) { - pos = j + i * taps; - if ((j == (taps - 1) / 2) && !isVertAndUV) - SetCoeffRegs(&coeffs[i][j], mantSize + 2, pCoeff, pos); - else - SetCoeffRegs(&coeffs[i][j], mantSize, pCoeff, pos); - } - - tapAdjust[0] = (taps - 1) / 2; - for (j = 1, j1 = 1; j <= tapAdjust[0]; j++, j1++) { - tapAdjust[j1] = tapAdjust[0] - j; - tapAdjust[++j1] = tapAdjust[0] + j; - } - - /* Adjust the coefficients. */ - sum = 0.0; - for (j = 0; j < taps; j++) - sum += coeffs[i][j]; - if (sum != 1.0) { - for (j1 = 0; j1 < taps; j1++) { - tap2Fix = tapAdjust[j1]; - diff = 1.0 - sum; - coeffs[i][tap2Fix] += diff; - pos = tap2Fix + i * taps; - if ((tap2Fix == (taps - 1) / 2) && !isVertAndUV) - SetCoeffRegs(&coeffs[i][tap2Fix], mantSize + 2, pCoeff, pos); + int i, j, j1, num, pos, mantSize; + double pi = 3.1415926535, val, sinc, window, sum; + double rawCoeff[MAX_TAPS * 32], coeffs[N_PHASES][MAX_TAPS]; + double diff; + int tapAdjust[MAX_TAPS], tap2Fix; + Bool isVertAndUV; + + if (isHoriz) + mantSize = 7; + else + mantSize = 6; + + isVertAndUV = !isHoriz && !isY; + num = taps * 16; + for (i = 0; i < num * 2; i++) { + val = (1.0 / fCutoff) * taps * pi * (i - num) / (2 * num); + if (val == 0.0) + sinc = 1.0; + else + sinc = sin(val) / val; + + /* Hamming window */ + window = (0.5 - 0.5 * cos(i * pi / num)); + rawCoeff[i] = sinc * window; + } + + for (i = 0; i < N_PHASES; i++) { + /* Normalise the coefficients. */ + sum = 0.0; + for (j = 0; j < taps; j++) { + pos = i + j * 32; + sum += rawCoeff[pos]; + } + for (j = 0; j < taps; j++) { + pos = i + j * 32; + coeffs[i][j] = rawCoeff[pos] / sum; + } + + /* Set the register values. */ + for (j = 0; j < taps; j++) { + pos = j + i * taps; + if ((j == (taps - 1) / 2) && !isVertAndUV) + SetCoeffRegs(&coeffs[i][j], mantSize + 2, pCoeff, pos); else - SetCoeffRegs(&coeffs[i][tap2Fix], mantSize, pCoeff, pos); - - sum = 0.0; - for (j = 0; j < taps; j++) - sum += coeffs[i][j]; - if (sum == 1.0) - break; - } - } - } + SetCoeffRegs(&coeffs[i][j], mantSize, pCoeff, pos); + } + + tapAdjust[0] = (taps - 1) / 2; + for (j = 1, j1 = 1; j <= tapAdjust[0]; j++, j1++) { + tapAdjust[j1] = tapAdjust[0] - j; + tapAdjust[++j1] = tapAdjust[0] + j; + } + + /* Adjust the coefficients. */ + sum = 0.0; + for (j = 0; j < taps; j++) + sum += coeffs[i][j]; + if (sum != 1.0) { + for (j1 = 0; j1 < taps; j1++) { + tap2Fix = tapAdjust[j1]; + diff = 1.0 - sum; + coeffs[i][tap2Fix] += diff; + pos = tap2Fix + i * taps; + if ((tap2Fix == (taps - 1) / 2) && !isVertAndUV) + SetCoeffRegs(&coeffs[i][tap2Fix], mantSize + 2, pCoeff, pos); + else + SetCoeffRegs(&coeffs[i][tap2Fix], mantSize, pCoeff, pos); + + sum = 0.0; + for (j = 0; j < taps; j++) + sum += coeffs[i][j]; + if (sum == 1.0) + break; + } + } + } } static void -I830DisplayVideo(ScrnInfoPtr pScrn, int id, short width, short height, - int dstPitch, int x1, int y1, int x2, int y2, BoxPtr dstBox, - short src_w, short src_h, short drw_w, short drw_h) +i830_box_intersect (BoxPtr dest, BoxPtr a, BoxPtr b) { - I830Ptr pI830 = I830PTR(pScrn); - I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; - I830OverlayRegPtr overlay = - (I830OverlayRegPtr) (pI830->FbBase + pI830->OverlayMem->Start); - unsigned int swidth; - unsigned int mask, shift, offsety, offsetu; - int tmp; - BoxRec dstBox2; - - ErrorF("I830DisplayVideo: %dx%d (pitch %d)\n", width, height, - dstPitch); - - if (!pPriv->overlayOK) - return; - -#if VIDEO_DEBUG - CompareOverlay(pI830, (CARD32 *) overlay, 0x100); -#endif - - switch (pI830->rotation) { - case RR_Rotate_0: - if (pI830->MergedFB) { - memcpy(&dstBox2, dstBox, sizeof(BoxRec)); - dstBox->x1 -= pI830->FirstframeX0; - dstBox->x2 -= pI830->FirstframeX0; - dstBox->y1 -= pI830->FirstframeY0; - dstBox->y2 -= pI830->FirstframeY0; - dstBox2.x1 -= pI830->pScrn_2->frameX0; - dstBox2.x2 -= pI830->pScrn_2->frameX0; - dstBox2.y1 -= pI830->pScrn_2->frameY0; - dstBox2.y2 -= pI830->pScrn_2->frameY0; - } else { - dstBox->x1 -= pScrn->frameX0; - dstBox->x2 -= pScrn->frameX0; - dstBox->y1 -= pScrn->frameY0; - dstBox->y2 -= pScrn->frameY0; - } - break; - case RR_Rotate_90: - tmp = dstBox->x1; - dstBox->x1 = dstBox->y1 - pScrn->frameX0; - dstBox->y1 = pScrn->virtualY - tmp - pScrn->frameY0; - tmp = dstBox->x2; - dstBox->x2 = dstBox->y2 - pScrn->frameX0; - dstBox->y2 = pScrn->virtualY - tmp - pScrn->frameY0; - tmp = dstBox->y1; - dstBox->y1 = dstBox->y2; - dstBox->y2 = tmp; - break; - case RR_Rotate_180: - tmp = dstBox->x1; - dstBox->x1 = pScrn->virtualX - dstBox->x2 - pScrn->frameX0; - dstBox->x2 = pScrn->virtualX - tmp - pScrn->frameX0; - tmp = dstBox->y1; - dstBox->y1 = pScrn->virtualY - dstBox->y2 - pScrn->frameY0; - dstBox->y2 = pScrn->virtualY - tmp - pScrn->frameY0; - break; - case RR_Rotate_270: - tmp = dstBox->x1; - dstBox->x1 = pScrn->virtualX - dstBox->y1 - pScrn->frameX0; - dstBox->y1 = tmp - pScrn->frameY0; - tmp = dstBox->x2; - dstBox->x2 = pScrn->virtualX - dstBox->y2 - pScrn->frameX0; - dstBox->y2 = tmp - pScrn->frameY0; - tmp = dstBox->x1; - dstBox->x1 = dstBox->x2; - dstBox->x2 = tmp; - break; - } - - if (pI830->MergedFB) { - I830ModePrivatePtr mp = (I830ModePrivatePtr)pScrn->currentMode->Private; - int w1, h1, w2, h2; - - /* Clip the video to the independent modes of the merged screens */ - if (dstBox->x1 > mp->merged.First->HDisplay) dstBox->x1 = mp->merged.First->HDisplay - 1; - if (dstBox->x2 > mp->merged.First->HDisplay) dstBox->x2 = mp->merged.First->HDisplay - 1; - if (dstBox2.x1 > mp->merged.Second->HDisplay) dstBox2.x1 = mp->merged.Second->HDisplay - 1; - if (dstBox2.x2 > mp->merged.Second->HDisplay) dstBox2.x2 = mp->merged.Second->HDisplay - 1; - if (dstBox->y1 > mp->merged.First->VDisplay) dstBox->y1 = mp->merged.First->VDisplay - 1; - if (dstBox->y2 > mp->merged.First->VDisplay) dstBox->y2 = mp->merged.First->VDisplay - 1; - if (dstBox2.y1 > mp->merged.Second->VDisplay) dstBox2.y1 = mp->merged.Second->VDisplay - 1; - if (dstBox2.y2 > mp->merged.Second->VDisplay) dstBox2.y2 = mp->merged.Second->VDisplay - 1; - if (dstBox->y1 < 0) dstBox->y1 = 0; - if (dstBox->y2 < 0) dstBox->y2 = 0; - if (dstBox->x1 < 0) dstBox->x1 = 0; - if (dstBox->x2 < 0) dstBox->x2 = 0; - if (dstBox2.y1 < 0) dstBox2.y1 = 0; - if (dstBox2.y2 < 0) dstBox2.y2 = 0; - if (dstBox2.x1 < 0) dstBox2.x1 = 0; - if (dstBox2.x2 < 0) dstBox2.x2 = 0; - - w1 = dstBox->x2 - dstBox->x1; - w2 = dstBox2.x2 - dstBox2.x1; - h1 = dstBox->y2 - dstBox->y1; - h2 = dstBox2.y2 - dstBox2.y1; - - switch (pI830->SecondPosition) { - case PosRightOf: - case PosBelow: - if ((w2 > 0 && w1 == 0) || - (h2 > 0 && h1 == 0)) { - pPriv->pipe = !pI830->pipe; - dstBox->x1 = dstBox2.x1; - dstBox->y1 = dstBox2.y1; - dstBox->x2 = dstBox2.x2; - dstBox->y2 = dstBox2.y2; - } else - pPriv->pipe = pI830->pipe; - break; - case PosLeftOf: - case PosAbove: - if ((w1 > 0 && w2 == 0) || - (h1 > 0 && h2 == 0)) { - pPriv->pipe = pI830->pipe; - } else { - pPriv->pipe = !pI830->pipe; - dstBox->x1 = dstBox2.x1; - dstBox->y1 = dstBox2.y1; - dstBox->x2 = dstBox2.x2; - dstBox->y2 = dstBox2.y2; - } - break; - } - } - - /* When in dual head with different bpp setups we need to refresh the - * color key, so let's reset the video parameters and refresh here. - * In MergedFB mode, we may need to flip pipes too. */ - if (pI830->entityPrivate || pI830->MergedFB) - I830ResetVideo(pScrn); - - /* Ensure overlay is turned on with OVERLAY_ENABLE at 0 */ - if (!*pI830->overlayOn) { - ErrorF("TURNING ON OVERLAY BEFORE UPDATE\n"); - I830ResetVideo(pScrn); - OVERLAY_UPDATE; - } - - /* Fix up the dstBox if outside the visible screen */ - { - int offset_x = (dstBox->x1 < 0) ? -dstBox->x1 : 0; - int offset_y = (dstBox->y1 < 0) ? -dstBox->y1 : 0; - int offset, offset2; - - /* align */ - offset_x = (offset_x + 3) & ~3; - offset_y = (offset_y + 3) & ~3; - - if (pI830->rotation & (RR_Rotate_90 | RR_Rotate_270)) { - height -= offset_x; - width -= offset_y; - } else { - height -= offset_y; - width -= offset_x; - } - - if (id == FOURCC_I420 || id == FOURCC_YV12) { - offset = ((offset_x/2) + (dstPitch * offset_y)) * 2; - offset2 = ((offset_x/2) + ((dstPitch/2) * offset_y)); - } else { - offset = ((offset_x*2) + (dstPitch * offset_y)); - offset2 = ((offset_x*2) + ((dstPitch/2) * offset_y)); - } - - /* buffer locations */ - pPriv->YBuf0offset += offset; - pPriv->UBuf0offset += offset2; - pPriv->VBuf0offset += offset2; - - if(pPriv->doubleBuffer) { - pPriv->YBuf1offset += offset; - pPriv->UBuf1offset += offset2; - pPriv->VBuf1offset += offset2; - } - } - - if (pI830->rotation & (RR_Rotate_90 | RR_Rotate_270)) { - tmp = width; - width = height; - height = tmp; - tmp = drw_w; - drw_w = drw_h; - drw_h = tmp; - tmp = src_w; - src_w = src_h; - src_h = tmp; - } - - if (pPriv->oneLineMode) { - /* change the coordinates with panel fitting active */ - dstBox->y1 = (((dstBox->y1 - 1) * pPriv->scaleRatio) >> 16) + 1; - dstBox->y2 = ((dstBox->y2 * pPriv->scaleRatio) >> 16) + 1; - - /* Now, alter the height, so we scale to the correct size */ - drw_h = ((drw_h * pPriv->scaleRatio) >> 16) + 1; - } - - { - /* Keep the engine happy and clip to the real vertical size just - * in case an LFP is in use and it's not at it's native resolution. - */ - int vactive = pPriv->pipe ? (INREG(VTOTAL_B) & 0x7FF) : (INREG(VTOTAL_A) & 0x7FF); - - vactive += 1; - - if (dstBox->y1 < 0) dstBox->y1 = 0; - if (dstBox->y2 < 0) dstBox->y2 = 0; - if (dstBox->x1 < 0) dstBox->x1 = 0; - if (dstBox->x2 < 0) dstBox->x2 = 0; - if (dstBox->y1 > vactive) dstBox->y1 = vactive; - if (dstBox->y2 > vactive) dstBox->y2 = vactive; - if (dstBox->x1 > pScrn->currentMode->HDisplay) dstBox->x1 = pScrn->currentMode->HDisplay - 1; - if (dstBox->x2 > pScrn->currentMode->HDisplay) dstBox->x2 = pScrn->currentMode->HDisplay - 1; - - /* nothing do to */ - if ((!dstBox->x1 && !dstBox->x2) || (!dstBox->y1 && !dstBox->y2)) { - ErrorF("NOTHING TO DO\n"); - return; - } - if ((dstBox->x1 == (pScrn->currentMode->HDisplay - 1) && - dstBox->x2 == (pScrn->currentMode->HDisplay - 1)) || - (dstBox->y1 == vactive && - dstBox->y2 == vactive)) { - ErrorF("NOTHING TO DO\n"); - return; - } - if ((dstBox->y2 - dstBox->y1) <= N_VERT_Y_TAPS) { - ErrorF("NOTHING TO DO\n"); - return; - } - if ((dstBox->x2 - dstBox->x1) <= 2) { - ErrorF("NOTHING TO DO\n"); - return; - } - } - - if (IS_I9XX(pI830)) { - shift = 6; - mask = 0x3f; - } else { - shift = 5; - mask = 0x1f; - } - - if (pPriv->currentBuf == 0) { - offsety = pPriv->YBuf0offset; - offsetu = pPriv->UBuf0offset; - } else { - offsety = pPriv->YBuf1offset; - offsetu = pPriv->UBuf1offset; - } - - switch (id) { - case FOURCC_YV12: - case FOURCC_I420: - swidth = width; - - overlay->SWIDTH = swidth; - swidth /= 2; - overlay->SWIDTH |= (swidth & 0x7ff) << 16; - - swidth = ((offsety + width + mask) >> shift) - - (offsety >> shift); - - if (IS_I9XX(pI830)) - swidth <<= 1; - - swidth -= 1; - - ErrorF("Y width is %d, swidth is %d\n", width, swidth); - - overlay->SWIDTHSW = swidth << 2; - - swidth = ((offsetu + (width / 2) + mask) >> shift) - - (offsetu >> shift); - - if (IS_I9XX(pI830)) - swidth <<= 1; - - swidth -= 1; - - ErrorF("UV width is %d, swidthsw is %d\n", width / 2, swidth); - - overlay->SWIDTHSW |= swidth << 18; - - ErrorF("HEIGHT is %d\n",height); - - overlay->SHEIGHT = height | ((height / 2) << 16); - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - swidth = width; - overlay->SWIDTH = swidth; - - ErrorF("Y width is %d\n", swidth); - - swidth = ((offsety + (width << 1) + mask) >> shift) - - (offsety >> shift); - - if (IS_I9XX(pI830)) - swidth <<= 1; - - swidth -= 1; - - ErrorF("swidthsw is %d\n", swidth); - - overlay->SWIDTHSW = swidth << 2; - - ErrorF("HEIGHT is %d\n",height); - - overlay->SHEIGHT = height; - break; - } - - overlay->OCMD = OVERLAY_ENABLE; - - overlay->DWINPOS = (dstBox->y1 << 16) | dstBox->x1; - - overlay->DWINSZ = ((dstBox->y2 - dstBox->y1) << 16) | - (dstBox->x2 - dstBox->x1); - - ErrorF("dstBox: x1: %d, y1: %d, x2: %d, y2: %d\n", dstBox->x1, dstBox->y1, - dstBox->x2, dstBox->y2); - - /* buffer locations */ - if (IS_I96X(pI830)) - { - overlay->OBUF_0Y = 0; - overlay->OBUF_0U = 0; - overlay->OBUF_0V = 0; - overlay->OSTART_0Y = pPriv->YBuf0offset; - overlay->OSTART_0U = pPriv->UBuf0offset; - overlay->OSTART_0V = pPriv->VBuf0offset; - if(pPriv->doubleBuffer) { - overlay->OBUF_1Y = 0; - overlay->OBUF_1U = 0; - overlay->OBUF_1V = 0; - overlay->OSTART_1Y = pPriv->YBuf1offset; - overlay->OSTART_1U = pPriv->UBuf1offset; - overlay->OSTART_1V = pPriv->VBuf1offset; - } - } else { - overlay->OBUF_0Y = pPriv->YBuf0offset; - overlay->OBUF_0U = pPriv->UBuf0offset; - overlay->OBUF_0V = pPriv->VBuf0offset; - if(pPriv->doubleBuffer) { - overlay->OBUF_1Y = pPriv->YBuf1offset; - overlay->OBUF_1U = pPriv->UBuf1offset; - overlay->OBUF_1V = pPriv->VBuf1offset; - } - } - - ErrorF("Buffers: Y0: 0x%lx, U0: 0x%lx, V0: 0x%lx\n", overlay->OBUF_0Y, - overlay->OBUF_0U, overlay->OBUF_0V); - ErrorF("Buffers: Y1: 0x%lx, U1: 0x%lx, V1: 0x%lx\n", overlay->OBUF_1Y, - overlay->OBUF_1U, overlay->OBUF_1V); - -#if 0 - { - int i; - - ErrorF("First 32 bytes of Y data:\n"); - for (i = 0; i < 32; i++) - ErrorF(" %02x", - ((unsigned char *)pI830->FbBase + pPriv->YBuf0offset)[i]); - ErrorF("\n"); - ErrorF("First 16 bytes of U data:\n"); - for (i = 0; i < 16; i++) - ErrorF(" %02x", - ((unsigned char *)pI830->FbBase + pPriv->UBuf0offset)[i]); - ErrorF("\n"); - ErrorF("First 16 bytes of V data:\n"); - for (i = 0; i < 16; i++) - ErrorF(" %02x", - ((unsigned char *)pI830->FbBase + pPriv->VBuf0offset)[i]); - ErrorF("\n"); - } -#endif - - ErrorF("pos: 0x%lx, size: 0x%lx\n", overlay->DWINPOS, overlay->DWINSZ); - ErrorF("dst: %d x %d, src: %d x %d\n", drw_w, drw_h, src_w, src_h); - - /* - * Calculate horizontal and vertical scaling factors and polyphase - * coefficients. - */ - - { - Bool scaleChanged = FALSE; - int xscaleInt, xscaleFract, yscaleInt, yscaleFract; - int xscaleIntUV, xscaleFractUV; - int yscaleIntUV, yscaleFractUV; - /* UV is half the size of Y -- YUV420 */ - int uvratio = 2; - CARD32 newval; - coeffRec xcoeffY[N_HORIZ_Y_TAPS * N_PHASES]; - coeffRec xcoeffUV[N_HORIZ_UV_TAPS * N_PHASES]; - int i, j, pos; - - /* - * Y down-scale factor as a multiple of 4096. - */ - xscaleFract = ((src_w - 1) << 12) / drw_w; - yscaleFract = ((src_h - 1) << 12) / drw_h; - - /* Calculate the UV scaling factor. */ - xscaleFractUV = xscaleFract / uvratio; - yscaleFractUV = yscaleFract / uvratio; - - /* - * To keep the relative Y and UV ratios exact, round the Y scales - * to a multiple of the Y/UV ratio. - */ - xscaleFract = xscaleFractUV * uvratio; - yscaleFract = yscaleFractUV * uvratio; - - /* Integer (un-multiplied) values. */ - xscaleInt = xscaleFract >> 12; - yscaleInt = yscaleFract >> 12; - - xscaleIntUV = xscaleFractUV >> 12; - yscaleIntUV = yscaleFractUV >> 12; - - ErrorF("xscale: %x.%03x, yscale: %x.%03x\n", xscaleInt, - xscaleFract & 0xFFF, yscaleInt, yscaleFract & 0xFFF); - ErrorF("UV xscale: %x.%03x, UV yscale: %x.%03x\n", xscaleIntUV, - xscaleFractUV & 0xFFF, yscaleIntUV, yscaleFractUV & 0xFFF); - - /* shouldn't get here */ - if (xscaleInt > 7) { - ErrorF("xscale: bad scale\n"); - return; - } - - /* shouldn't get here */ - if (xscaleIntUV > 7) { - ErrorF("xscaleUV: bad scale\n"); - return; - } - - newval = (xscaleInt << 16) | - ((xscaleFract & 0xFFF) << 3) | ((yscaleFract & 0xFFF) << 20); - if (newval != overlay->YRGBSCALE) { - scaleChanged = TRUE; - overlay->YRGBSCALE = newval; - } - - newval = (xscaleIntUV << 16) | ((xscaleFractUV & 0xFFF) << 3) | - ((yscaleFractUV & 0xFFF) << 20); - if (newval != overlay->UVSCALE) { - scaleChanged = TRUE; - overlay->UVSCALE = newval; - } - - newval = yscaleInt << 16 | yscaleIntUV; - if (newval != overlay->UVSCALEV) { - scaleChanged = TRUE; - overlay->UVSCALEV = newval; - } - - /* Recalculate coefficients if the scaling changed. */ - - /* - * Only Horizontal coefficients so far. - */ - if (scaleChanged) { - double fCutoffY; - double fCutoffUV; - - fCutoffY = xscaleFract / 4096.0; - fCutoffUV = xscaleFractUV / 4096.0; - - /* Limit to between 1.0 and 3.0. */ - if (fCutoffY < MIN_CUTOFF_FREQ) - fCutoffY = MIN_CUTOFF_FREQ; - if (fCutoffY > MAX_CUTOFF_FREQ) - fCutoffY = MAX_CUTOFF_FREQ; - if (fCutoffUV < MIN_CUTOFF_FREQ) - fCutoffUV = MIN_CUTOFF_FREQ; - if (fCutoffUV > MAX_CUTOFF_FREQ) - fCutoffUV = MAX_CUTOFF_FREQ; - - UpdateCoeff(N_HORIZ_Y_TAPS, fCutoffY, TRUE, TRUE, xcoeffY); - UpdateCoeff(N_HORIZ_UV_TAPS, fCutoffUV, TRUE, FALSE, xcoeffUV); - - for (i = 0; i < N_PHASES; i++) { - for (j = 0; j < N_HORIZ_Y_TAPS; j++) { - pos = i * N_HORIZ_Y_TAPS + j; - overlay->Y_HCOEFS[pos] = xcoeffY[pos].sign << 15 | - xcoeffY[pos].exponent << 12 | - xcoeffY[pos].mantissa; - } - } - for (i = 0; i < N_PHASES; i++) { - for (j = 0; j < N_HORIZ_UV_TAPS; j++) { - pos = i * N_HORIZ_UV_TAPS + j; - overlay->UV_HCOEFS[pos] = xcoeffUV[pos].sign << 15 | - xcoeffUV[pos].exponent << 12 | - xcoeffUV[pos].mantissa; - } - } - } - } - - switch (id) { - case FOURCC_YV12: - case FOURCC_I420: - ErrorF("YUV420\n"); -#if 0 - /* set UV vertical phase to -0.25 */ - overlay->UV_VPH = 0x30003000; -#endif - ErrorF("UV stride is %d, Y stride is %d\n", dstPitch, dstPitch * 2); - overlay->OSTRIDE = (dstPitch * 2) | (dstPitch << 16); - overlay->OCMD &= ~SOURCE_FORMAT; - overlay->OCMD &= ~OV_BYTE_ORDER; - overlay->OCMD |= YUV_420; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - ErrorF("YUV422\n"); - overlay->OSTRIDE = dstPitch; - overlay->OCMD &= ~SOURCE_FORMAT; - overlay->OCMD |= YUV_422; - overlay->OCMD &= ~OV_BYTE_ORDER; - if (id == FOURCC_UYVY) - overlay->OCMD |= Y_SWAP; - break; - } - - overlay->OCMD &= ~(BUFFER_SELECT | FIELD_SELECT); - if (pPriv->currentBuf == 0) - overlay->OCMD |= BUFFER0; - else - overlay->OCMD |= BUFFER1; - - ErrorF("OCMD is 0x%lx\n", overlay->OCMD); - - OVERLAY_UPDATE; + dest->x1 = a->x1 > b->x1 ? a->x1 : b->x1; + dest->x2 = a->x2 < b->x2 ? a->x2 : b->x2; + dest->y1 = a->y1 > b->y1 ? a->y1 : b->y1; + dest->y2 = a->y2 < b->y2 ? a->y2 : b->y2; + if (dest->x1 >= dest->x2 || dest->y1 >= dest->y2) + dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0; } -static const CARD32 sip_kernel_static[][4] = { -/* wait (1) a0<1>UW a145<0,1,0>UW { align1 + } */ - { 0x00000030, 0x20000108, 0x00001220, 0x00000000 }, -/* nop (4) g0<1>UD { align1 + } */ - { 0x0040007e, 0x20000c21, 0x00690000, 0x00000000 }, -/* nop (4) g0<1>UD { align1 + } */ - { 0x0040007e, 0x20000c21, 0x00690000, 0x00000000 }, -/* nop (4) g0<1>UD { align1 + } */ - { 0x0040007e, 0x20000c21, 0x00690000, 0x00000000 }, -/* nop (4) g0<1>UD { align1 + } */ - { 0x0040007e, 0x20000c21, 0x00690000, 0x00000000 }, -/* nop (4) g0<1>UD { align1 + } */ - { 0x0040007e, 0x20000c21, 0x00690000, 0x00000000 }, -/* nop (4) g0<1>UD { align1 + } */ - { 0x0040007e, 0x20000c21, 0x00690000, 0x00000000 }, -/* nop (4) g0<1>UD { align1 + } */ - { 0x0040007e, 0x20000c21, 0x00690000, 0x00000000 }, -/* nop (4) g0<1>UD { align1 + } */ - { 0x0040007e, 0x20000c21, 0x00690000, 0x00000000 }, -/* nop (4) g0<1>UD { align1 + } */ - { 0x0040007e, 0x20000c21, 0x00690000, 0x00000000 }, -}; - -/* - * this program computes dA/dx and dA/dy for the texture coordinates along - * with the base texture coordinate. It was extracted from the Mesa driver. - * It uses about 10 GRF registers. - */ - -#define SF_KERNEL_NUM_GRF 16 -#define SF_MAX_THREADS 1 +static void +i830_crtc_box (xf86CrtcPtr crtc, BoxPtr crtc_box) +{ + if (crtc->enabled) + { + crtc_box->x1 = crtc->x; + crtc_box->x2 = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation); + crtc_box->y1 = crtc->y; + crtc_box->y2 = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation); + } + else + crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0; +} -static const CARD32 sf_kernel_static[][4] = { -#include "sf_prog.h" -}; +static int +i830_box_area (BoxPtr box) +{ + return (int) (box->x2 - box->x1) * (int) (box->y2 - box->y1); +} /* - * Ok, this kernel picks up the required data flow values in g0 and g1 - * and passes those along in m0 and m1. In m2-m9, it sticks constant - * values (bright pink). + * Return the crtc covering 'box'. If two crtcs cover a portion of + * 'box', then prefer 'desired'. If 'desired' is NULL, then prefer the crtc + * with greater coverage */ -/* Our PS kernel uses less than 32 GRF registers (about 20) */ -#define PS_KERNEL_NUM_GRF 32 -#define PS_MAX_THREADS 32 - -#define BRW_GRF_BLOCKS(nreg) ((nreg + 15) / 16 - 1) - -static const CARD32 ps_kernel_static[][4] = { -#include "wm_prog.h" -}; - -#define ALIGN(i,m) (((i) + (m) - 1) & ~((m) - 1)) -#define MIN(a,b) ((a) < (b) ? (a) : (b)) - -#define WM_BINDING_TABLE_ENTRIES 2 - -static CARD32 float_to_uint (float f) { - union {CARD32 i; float f;} x; - x.f = f; - return x.i; +static xf86CrtcPtr +i830_covering_crtc (ScrnInfoPtr pScrn, + BoxPtr box, + xf86CrtcPtr desired, + BoxPtr crtc_box_ret) +{ + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + xf86CrtcPtr crtc, best_crtc; + int coverage, best_coverage; + int c; + BoxRec crtc_box, cover_box; + + best_crtc = NULL; + best_coverage = 0; + crtc_box_ret->x1 = 0; + crtc_box_ret->x2 = 0; + crtc_box_ret->y1 = 0; + crtc_box_ret->y2 = 0; + for (c = 0; c < xf86_config->num_crtc; c++) + { + crtc = xf86_config->crtc[c]; + i830_crtc_box (crtc, &crtc_box); + i830_box_intersect (&cover_box, &crtc_box, box); + coverage = i830_box_area (&cover_box); + if (coverage && crtc == desired) + { + *crtc_box_ret = crtc_box; + return crtc; + } + if (coverage > best_coverage) + { + *crtc_box_ret = crtc_box; + best_crtc = crtc; + best_coverage = coverage; + } + } + return best_crtc; } -#if 0 -static struct { - CARD32 svg_ctl; - char *name; -} svg_ctl_bits[] = { - { BRW_SVG_CTL_GS_BA, "General State Base Address" }, - { BRW_SVG_CTL_SS_BA, "Surface State Base Address" }, - { BRW_SVG_CTL_IO_BA, "Indirect Object Base Address" }, - { BRW_SVG_CTL_GS_AUB, "Generate State Access Upper Bound" }, - { BRW_SVG_CTL_IO_AUB, "Indirect Object Access Upper Bound" }, - { BRW_SVG_CTL_SIP, "System Instruction Pointer" }, - { 0, 0 }, -}; - -static void -brw_debug (ScrnInfoPtr pScrn, char *when) +static int +i830_swidth (I830Ptr pI830, unsigned int offset, + unsigned int width, unsigned int mask, int shift) { - I830Ptr pI830 = I830PTR(pScrn); - int i; - CARD32 v; - - I830Sync (pScrn); - ErrorF("brw_debug: %s\n", when); - for (i = 0; svg_ctl_bits[i].name; i++) { - OUTREG(BRW_SVG_CTL, svg_ctl_bits[i].svg_ctl); - v = INREG(BRW_SVG_RDATA); - ErrorF("\t%34.34s: 0x%08x\n", svg_ctl_bits[i].name, v); - } + int swidth = ((offset + width + mask) >> shift) - (offset >> shift); + if (IS_I9XX(pI830)) + swidth <<= 1; + swidth -= 1; + return swidth << 2; } -#endif - -#define WATCH_SF 0 -#define WATCH_WIZ 0 -#define WATCH_STATS 0 static void -BroadwaterDisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, - RegionPtr dstRegion, - short width, short height, int video_pitch, - int x1, int y1, int x2, int y2, - short src_w, short src_h, - short drw_w, short drw_h, - DrawablePtr pDraw) +i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc, + int id, short width, short height, + int dstPitch, int x1, int y1, int x2, int y2, BoxPtr dstBox, + short src_w, short src_h, short drw_w, short drw_h) { - I830Ptr pI830 = I830PTR(pScrn); - BoxPtr pbox; - int nbox, dxo, dyo; - int urb_vs_start, urb_vs_size; - int urb_gs_start, urb_gs_size; - int urb_clip_start, urb_clip_size; - int urb_sf_start, urb_sf_size; - int urb_cs_start, urb_cs_size; - struct brw_surface_state *dest_surf_state; - struct brw_surface_state *src_surf_state; - struct brw_sampler_state *src_sampler_state; - struct brw_vs_unit_state *vs_state; - struct brw_sf_unit_state *sf_state; - struct brw_wm_unit_state *wm_state; - struct brw_cc_unit_state *cc_state; - struct brw_cc_viewport *cc_viewport; - struct brw_instruction *sf_kernel; - struct brw_instruction *ps_kernel; - struct brw_instruction *sip_kernel; - float *vb; - CARD32 *binding_table; - Bool first_output = TRUE; - int dest_surf_offset, src_surf_offset, src_sampler_offset, vs_offset; - int sf_offset, wm_offset, cc_offset, vb_offset, cc_viewport_offset; - int wm_scratch_offset; - int sf_kernel_offset, ps_kernel_offset, sip_kernel_offset; - int binding_table_offset; - int next_offset, total_state_size; - int vb_size = (4 * 4) * 4; /* 4 DWORDS per vertex */ - char *state_base; - int state_base_offset; - -#if 0 - ErrorF("BroadwaterDisplayVideoTextured: %dx%d (pitch %d)\n", width, height, - video_pitch); -#endif + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; + I830OverlayRegPtr overlay = I830OVERLAYREG(pI830); + unsigned int swidth, swidthy, swidthuv; + unsigned int mask, shift, offsety, offsetu; + int tmp; + CARD32 OCMD; + Bool scaleChanged = FALSE; + + OVERLAY_DEBUG("I830DisplayVideo: %dx%d (pitch %d)\n", width, height, + dstPitch); - /* enable debug */ - OUTREG (INST_PM, - (1 << (16 + 4)) | - (1 << 4)); -#if 0 - ErrorF ("INST_PM 0x%08x\n", INREG(INST_PM)); -#endif - - assert((id == FOURCC_UYVY) || (id == FOURCC_YUY2)); - - /* Tell the rotation code that we have stomped its invariant state by - * setting a high bit. We don't use any invariant 3D state for video, so we - * don't have to worry about it ourselves. - */ - *pI830->used3D |= 1 << 30; - -#ifdef XF86DRI - /* Tell the DRI that we're smashing its state. */ - if (pI830->directRenderingEnabled) { - drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen); - - pSAREAPriv->ctxOwner = DRIGetContext(pScrn->pScreen); - } -#endif /* XF86DRI */ - - next_offset = 0; - - /* Set up our layout of state in framebuffer. First the general state: */ - vs_offset = ALIGN(next_offset, 64); - next_offset = vs_offset + sizeof(*vs_state); - sf_offset = ALIGN(next_offset, 32); - next_offset = sf_offset + sizeof(*sf_state); - wm_offset = ALIGN(next_offset, 32); - next_offset = wm_offset + sizeof(*wm_state); - wm_scratch_offset = ALIGN(next_offset, 1024); - next_offset = wm_scratch_offset + 1024 * PS_MAX_THREADS; - cc_offset = ALIGN(next_offset, 32); - next_offset = cc_offset + sizeof(*cc_state); - - sf_kernel_offset = ALIGN(next_offset, 64); - next_offset = sf_kernel_offset + sizeof (sf_kernel_static); - ps_kernel_offset = ALIGN(next_offset, 64); - next_offset = ps_kernel_offset + sizeof (ps_kernel_static); - sip_kernel_offset = ALIGN(next_offset, 64); - next_offset = sip_kernel_offset + sizeof (sip_kernel_static); - cc_viewport_offset = ALIGN(next_offset, 32); - next_offset = cc_viewport_offset + sizeof(*cc_viewport); - - src_sampler_offset = ALIGN(next_offset, 32); - next_offset = src_sampler_offset + sizeof(*src_sampler_state); - - /* Align VB to native size of elements, for safety */ - vb_offset = ALIGN(next_offset, 8); - next_offset = vb_offset + vb_size; - - /* And then the general state: */ - dest_surf_offset = ALIGN(next_offset, 32); - next_offset = dest_surf_offset + sizeof(*dest_surf_state); - src_surf_offset = ALIGN(next_offset, 32); - next_offset = src_surf_offset + sizeof(*src_surf_state); - binding_table_offset = ALIGN(next_offset, 32); - next_offset = binding_table_offset + (WM_BINDING_TABLE_ENTRIES * 4); - - /* Allocate an area in framebuffer for our state layout we just set up */ - total_state_size = next_offset; - assert (total_state_size < BRW_LINEAR_EXTRA); - - /* - * Use the extra space allocated at the end of the Xv buffer - */ - state_base_offset = (pPriv->YBuf0offset + - pPriv->linear->size * pI830->cpp - - BRW_LINEAR_EXTRA); - state_base_offset = ALIGN(state_base_offset, 64); - - state_base = (char *)(pI830->FbBase + state_base_offset); - /* Set up our pointers to state structures in framebuffer. It would probably - * be a good idea to fill these structures out in system memory and then dump - * them there, instead. - */ - vs_state = (void *)(state_base + vs_offset); - sf_state = (void *)(state_base + sf_offset); - wm_state = (void *)(state_base + wm_offset); - cc_state = (void *)(state_base + cc_offset); - sf_kernel = (void *)(state_base + sf_kernel_offset); - ps_kernel = (void *)(state_base + ps_kernel_offset); - sip_kernel = (void *)(state_base + sip_kernel_offset); - - cc_viewport = (void *)(state_base + cc_viewport_offset); - dest_surf_state = (void *)(state_base + dest_surf_offset); - src_surf_state = (void *)(state_base + src_surf_offset); - src_sampler_state = (void *)(state_base + src_sampler_offset); - binding_table = (void *)(state_base + binding_table_offset); - vb = (void *)(state_base + vb_offset); - - /* For 3D, the VS must have 8, 12, 16, 24, or 32 VUEs allocated to it. - * A VUE consists of a 256-bit vertex header followed by the vertex data, - * which in our case is 4 floats (128 bits), thus a single 512-bit URB - * entry. - */ -#define URB_VS_ENTRIES 8 -#define URB_VS_ENTRY_SIZE 1 - -#define URB_GS_ENTRIES 0 -#define URB_GS_ENTRY_SIZE 0 - -#define URB_CLIP_ENTRIES 0 -#define URB_CLIP_ENTRY_SIZE 0 - - /* The SF kernel we use outputs only 4 256-bit registers, leading to an - * entry size of 2 512-bit URBs. We don't need to have many entries to - * output as we're generally working on large rectangles and don't care - * about having WM threads running on different rectangles simultaneously. - */ -#define URB_SF_ENTRIES 1 -#define URB_SF_ENTRY_SIZE 2 - -#define URB_CS_ENTRIES 0 -#define URB_CS_ENTRY_SIZE 0 - - urb_vs_start = 0; - urb_vs_size = URB_VS_ENTRIES * URB_VS_ENTRY_SIZE; - urb_gs_start = urb_vs_start + urb_vs_size; - urb_gs_size = URB_GS_ENTRIES * URB_GS_ENTRY_SIZE; - urb_clip_start = urb_gs_start + urb_gs_size; - urb_clip_size = URB_CLIP_ENTRIES * URB_CLIP_ENTRY_SIZE; - urb_sf_start = urb_clip_start + urb_clip_size; - urb_sf_size = URB_SF_ENTRIES * URB_SF_ENTRY_SIZE; - urb_cs_start = urb_sf_start + urb_sf_size; - urb_cs_size = URB_CS_ENTRIES * URB_CS_ENTRY_SIZE; - - /* We'll be poking the state buffers that could be in use by the 3d hardware - * here, but we should have synced the 3D engine already in I830PutImage. - */ - - memset (cc_viewport, 0, sizeof (*cc_viewport)); - cc_viewport->min_depth = -1.e35; - cc_viewport->max_depth = 1.e35; - - /* Color calculator state */ - memset(cc_state, 0, sizeof(*cc_state)); - cc_state->cc0.stencil_enable = 0; /* disable stencil */ - cc_state->cc2.depth_test = 0; /* disable depth test */ - cc_state->cc2.logicop_enable = 1; /* enable logic op */ - cc_state->cc3.ia_blend_enable = 1; /* blend alpha just like colors */ - cc_state->cc3.blend_enable = 0; /* disable color blend */ - cc_state->cc3.alpha_test = 0; /* disable alpha test */ - cc_state->cc4.cc_viewport_state_offset = (state_base_offset + cc_viewport_offset) >> 5; - cc_state->cc5.dither_enable = 0; /* disable dither */ - cc_state->cc5.logicop_func = 0xc; /* WHITE */ - cc_state->cc5.statistics_enable = 1; - cc_state->cc5.ia_blend_function = BRW_BLENDFUNCTION_ADD; - cc_state->cc5.ia_src_blend_factor = BRW_BLENDFACTOR_ONE; - cc_state->cc5.ia_dest_blend_factor = BRW_BLENDFACTOR_ONE; - - /* Upload system kernel */ - memcpy (sip_kernel, sip_kernel_static, sizeof (sip_kernel_static)); - - /* Set up the state buffer for the destination surface */ - memset(dest_surf_state, 0, sizeof(*dest_surf_state)); - dest_surf_state->ss0.surface_type = BRW_SURFACE_2D; - dest_surf_state->ss0.data_return_format = BRW_SURFACERETURNFORMAT_FLOAT32; - if (pI830->cpp == 2) { - dest_surf_state->ss0.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM; - } else { - dest_surf_state->ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; - } - dest_surf_state->ss0.writedisable_alpha = 0; - dest_surf_state->ss0.writedisable_red = 0; - dest_surf_state->ss0.writedisable_green = 0; - dest_surf_state->ss0.writedisable_blue = 0; - dest_surf_state->ss0.color_blend = 1; - dest_surf_state->ss0.vert_line_stride = 0; - dest_surf_state->ss0.vert_line_stride_ofs = 0; - dest_surf_state->ss0.mipmap_layout_mode = 0; - dest_surf_state->ss0.render_cache_read_mode = 0; - - dest_surf_state->ss1.base_addr = pI830->FrontBuffer.Start; - dest_surf_state->ss2.height = pScrn->virtualY - 1; - dest_surf_state->ss2.width = pScrn->virtualX - 1; - dest_surf_state->ss2.mip_count = 0; - dest_surf_state->ss2.render_target_rotation = 0; - dest_surf_state->ss3.pitch = (pI830->displayWidth * pI830->cpp) - 1; - - /* Set up the source surface state buffer */ - memset(src_surf_state, 0, sizeof(*src_surf_state)); - src_surf_state->ss0.surface_type = BRW_SURFACE_2D; -/* src_surf_state->ss0.data_return_format = BRW_SURFACERETURNFORMAT_FLOAT32; */ - switch (id) { - case FOURCC_YUY2: - src_surf_state->ss0.surface_format = BRW_SURFACEFORMAT_YCRCB_NORMAL; - break; - case FOURCC_UYVY: - src_surf_state->ss0.surface_format = BRW_SURFACEFORMAT_YCRCB_SWAPY; - break; - } - src_surf_state->ss0.writedisable_alpha = 0; - src_surf_state->ss0.writedisable_red = 0; - src_surf_state->ss0.writedisable_green = 0; - src_surf_state->ss0.writedisable_blue = 0; - src_surf_state->ss0.color_blend = 1; - src_surf_state->ss0.vert_line_stride = 0; - src_surf_state->ss0.vert_line_stride_ofs = 0; - src_surf_state->ss0.mipmap_layout_mode = 0; - src_surf_state->ss0.render_cache_read_mode = 0; - - src_surf_state->ss1.base_addr = pPriv->YBuf0offset; - src_surf_state->ss2.width = width - 1; - src_surf_state->ss2.height = height - 1; - src_surf_state->ss2.mip_count = 0; - src_surf_state->ss2.render_target_rotation = 0; - src_surf_state->ss3.pitch = video_pitch - 1; - - /* Set up a binding table for our two surfaces. Only the PS will use it */ - /* XXX: are these offset from the right place? */ - binding_table[0] = state_base_offset + dest_surf_offset; - binding_table[1] = state_base_offset + src_surf_offset; - - /* Set up the packed YUV source sampler. Doesn't do colorspace conversion. - */ - memset(src_sampler_state, 0, sizeof(*src_sampler_state)); - src_sampler_state->ss0.min_filter = BRW_MAPFILTER_LINEAR; - src_sampler_state->ss0.mag_filter = BRW_MAPFILTER_LINEAR; - src_sampler_state->ss1.r_wrap_mode = BRW_TEXCOORDMODE_CLAMP; - src_sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CLAMP; - src_sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CLAMP; - - /* Set up the vertex shader to be disabled (passthrough) */ - memset(vs_state, 0, sizeof(*vs_state)); - vs_state->thread4.nr_urb_entries = URB_VS_ENTRIES; - vs_state->thread4.urb_entry_allocation_size = URB_VS_ENTRY_SIZE - 1; - vs_state->vs6.vs_enable = 0; - vs_state->vs6.vert_cache_disable = 1; - - /* Set up the SF kernel to do coord interp: for each attribute, - * calculate dA/dx and dA/dy. Hand these interpolation coefficients - * back to SF which then hands pixels off to WM. - */ - - memcpy (sf_kernel, sf_kernel_static, sizeof (sf_kernel_static)); - memset(sf_state, 0, sizeof(*sf_state)); -#if 0 - ErrorF ("sf kernel: 0x%08x\n", state_base_offset + sf_kernel_offset); -#endif - sf_state->thread0.kernel_start_pointer = - (state_base_offset + sf_kernel_offset) >> 6; - sf_state->thread0.grf_reg_count = BRW_GRF_BLOCKS(SF_KERNEL_NUM_GRF); - sf_state->sf1.single_program_flow = 1; /* XXX */ - sf_state->sf1.binding_table_entry_count = 0; - sf_state->sf1.thread_priority = 0; - sf_state->sf1.floating_point_mode = 0; /* Mesa does this */ - sf_state->sf1.illegal_op_exception_enable = 1; - sf_state->sf1.mask_stack_exception_enable = 1; - sf_state->sf1.sw_exception_enable = 1; - sf_state->thread2.per_thread_scratch_space = 0; - sf_state->thread2.scratch_space_base_pointer = 0; /* not used in our kernel */ - sf_state->thread3.const_urb_entry_read_length = 0; /* no const URBs */ - sf_state->thread3.const_urb_entry_read_offset = 0; /* no const URBs */ - sf_state->thread3.urb_entry_read_length = 1; /* 1 URB per vertex */ - sf_state->thread3.urb_entry_read_offset = 0; - sf_state->thread3.dispatch_grf_start_reg = 3; - sf_state->thread4.max_threads = SF_MAX_THREADS - 1; - sf_state->thread4.urb_entry_allocation_size = URB_SF_ENTRY_SIZE - 1; - sf_state->thread4.nr_urb_entries = URB_SF_ENTRIES; - sf_state->thread4.stats_enable = 1; - sf_state->sf5.viewport_transform = FALSE; /* skip viewport */ - sf_state->sf6.cull_mode = BRW_CULLMODE_NONE; - sf_state->sf6.scissor = 0; - sf_state->sf7.trifan_pv = 2; - sf_state->sf6.dest_org_vbias = 0x8; - sf_state->sf6.dest_org_hbias = 0x8; - - memcpy (ps_kernel, ps_kernel_static, sizeof (ps_kernel_static)); -#if 0 - ErrorF ("ps kernel: 0x%08x\n", state_base_offset + ps_kernel_offset); -#endif - memset (wm_state, 0, sizeof (*wm_state)); - wm_state->thread0.kernel_start_pointer = - (state_base_offset + ps_kernel_offset) >> 6; - wm_state->thread0.grf_reg_count = BRW_GRF_BLOCKS(PS_KERNEL_NUM_GRF); - wm_state->thread1.single_program_flow = 1; /* XXX */ - wm_state->thread1.binding_table_entry_count = 2; - /* Though we never use the scratch space in our WM kernel, it has to be - * set, and the minimum allocation is 1024 bytes. - */ - wm_state->thread2.scratch_space_base_pointer = (state_base_offset + - wm_scratch_offset) >> 10; - wm_state->thread2.per_thread_scratch_space = 0; /* 1024 bytes */ - wm_state->thread3.dispatch_grf_start_reg = 3; /* XXX */ - wm_state->thread3.const_urb_entry_read_length = 0; - wm_state->thread3.const_urb_entry_read_offset = 0; - wm_state->thread3.urb_entry_read_length = 1; /* XXX */ - wm_state->thread3.urb_entry_read_offset = 0; /* XXX */ - wm_state->wm4.stats_enable = 1; - wm_state->wm4.sampler_state_pointer = (state_base_offset + src_sampler_offset) >> 5; - wm_state->wm4.sampler_count = 1; /* 1-4 samplers used */ - wm_state->wm5.max_threads = PS_MAX_THREADS - 1; - wm_state->wm5.thread_dispatch_enable = 1; - wm_state->wm5.enable_16_pix = 1; - wm_state->wm5.enable_8_pix = 0; - wm_state->wm5.early_depth_test = 1; - - { - BEGIN_LP_RING(2); - OUT_RING(MI_FLUSH | - MI_STATE_INSTRUCTION_CACHE_FLUSH | - BRW_MI_GLOBAL_SNAPSHOT_RESET); - OUT_RING(MI_NOOP); - ADVANCE_LP_RING(); - } - -/* brw_debug (pScrn, "before base address modify"); */ - { BEGIN_LP_RING(12); - /* Match Mesa driver setup */ - OUT_RING(BRW_PIPELINE_SELECT | PIPELINE_SELECT_3D); - - /* Mesa does this. Who knows... */ - OUT_RING(BRW_CS_URB_STATE | 0); - OUT_RING((0 << 4) | /* URB Entry Allocation Size */ - (0 << 0)); /* Number of URB Entries */ - - /* Zero out the two base address registers so all offsets are absolute */ - OUT_RING(BRW_STATE_BASE_ADDRESS | 4); - OUT_RING(0 | BASE_ADDRESS_MODIFY); /* Generate state base address */ - OUT_RING(0 | BASE_ADDRESS_MODIFY); /* Surface state base address */ - OUT_RING(0 | BASE_ADDRESS_MODIFY); /* media base addr, don't care */ - OUT_RING(0x10000000 | BASE_ADDRESS_MODIFY); /* general state max addr, disabled */ - OUT_RING(0x10000000 | BASE_ADDRESS_MODIFY); /* media object state max addr, disabled */ - - /* Set system instruction pointer */ - OUT_RING(BRW_STATE_SIP | 0); - OUT_RING(state_base_offset + sip_kernel_offset); /* system instruction pointer */ - - OUT_RING(MI_NOOP); - ADVANCE_LP_RING(); } - -/* brw_debug (pScrn, "after base address modify"); */ - - { BEGIN_LP_RING(42); - /* Enable VF statistics */ - OUT_RING(BRW_3DSTATE_VF_STATISTICS | 1); - - /* Pipe control */ - OUT_RING(BRW_PIPE_CONTROL | - BRW_PIPE_CONTROL_NOWRITE | - BRW_PIPE_CONTROL_IS_FLUSH | - 2); - OUT_RING(0); /* Destination address */ - OUT_RING(0); /* Immediate data low DW */ - OUT_RING(0); /* Immediate data high DW */ - - /* Binding table pointers */ - OUT_RING(BRW_3DSTATE_BINDING_TABLE_POINTERS | 4); - OUT_RING(0); /* vs */ - OUT_RING(0); /* gs */ - OUT_RING(0); /* clip */ - OUT_RING(0); /* sf */ - /* Only the PS uses the binding table */ - OUT_RING(state_base_offset + binding_table_offset); /* ps */ - - /* Blend constant color (magenta is fun) */ - OUT_RING(BRW_3DSTATE_CONSTANT_COLOR | 3); - OUT_RING(float_to_uint (1.0)); - OUT_RING(float_to_uint (0.0)); - OUT_RING(float_to_uint (1.0)); - OUT_RING(float_to_uint (1.0)); - - /* The drawing rectangle clipping is always on. Set it to values that - * shouldn't do any clipping. - */ - OUT_RING(BRW_3DSTATE_DRAWING_RECTANGLE | 2); /* XXX 3 for BLC or CTG */ - OUT_RING(0x00000000); /* ymin, xmin */ - OUT_RING((pScrn->virtualX - 1) | - (pScrn->virtualY - 1) << 16); /* ymax, xmax */ - OUT_RING(0x00000000); /* yorigin, xorigin */ - - /* skip the depth buffer */ - /* skip the polygon stipple */ - /* skip the polygon stipple offset */ - /* skip the line stipple */ - - /* Set the pointers to the 3d pipeline state */ - OUT_RING(BRW_3DSTATE_PIPELINED_POINTERS | 5); - OUT_RING(state_base_offset + vs_offset); /* 32 byte aligned */ - OUT_RING(BRW_GS_DISABLE); /* disable GS, resulting in passthrough */ - OUT_RING(BRW_CLIP_DISABLE); /* disable CLIP, resulting in passthrough */ - OUT_RING(state_base_offset + sf_offset); /* 32 byte aligned */ - OUT_RING(state_base_offset + wm_offset); /* 32 byte aligned */ - OUT_RING(state_base_offset + cc_offset); /* 64 byte aligned */ - - /* URB fence */ - OUT_RING(BRW_URB_FENCE | - UF0_CS_REALLOC | - UF0_SF_REALLOC | - UF0_CLIP_REALLOC | - UF0_GS_REALLOC | - UF0_VS_REALLOC | - 1); - OUT_RING(((urb_clip_start + urb_clip_size) << UF1_CLIP_FENCE_SHIFT) | - ((urb_gs_start + urb_gs_size) << UF1_GS_FENCE_SHIFT) | - ((urb_vs_start + urb_vs_size) << UF1_VS_FENCE_SHIFT)); - OUT_RING(((urb_cs_start + urb_cs_size) << UF2_CS_FENCE_SHIFT) | - ((urb_sf_start + urb_sf_size) << UF2_SF_FENCE_SHIFT)); - - /* Constant buffer state */ - OUT_RING(BRW_CS_URB_STATE | 0); - OUT_RING(((URB_CS_ENTRY_SIZE - 1) << 4) | /* URB Entry Allocation Size */ - (URB_CS_ENTRIES << 0)); /* Number of URB Entries */ - - /* Set up the pointer to our vertex buffer */ - OUT_RING(BRW_3DSTATE_VERTEX_BUFFERS | 2); - OUT_RING((0 << VB0_BUFFER_INDEX_SHIFT) | - VB0_VERTEXDATA | - ((4 * 4) << VB0_BUFFER_PITCH_SHIFT)); /* four 32-bit floats per vertex */ - OUT_RING(state_base_offset + vb_offset); - OUT_RING(3); /* four corners to our rectangle */ - - /* Set up our vertex elements, sourced from the single vertex buffer. */ - OUT_RING(BRW_3DSTATE_VERTEX_ELEMENTS | 3); - /* offset 0: X,Y -> {X, Y, 1.0, 1.0} */ - OUT_RING((0 << VE0_VERTEX_BUFFER_INDEX_SHIFT) | - VE0_VALID | - (BRW_SURFACEFORMAT_R32G32_FLOAT << VE0_FORMAT_SHIFT) | - (0 << VE0_OFFSET_SHIFT)); - OUT_RING((BRW_VFCOMPONENT_STORE_SRC << VE1_VFCOMPONENT_0_SHIFT) | - (BRW_VFCOMPONENT_STORE_SRC << VE1_VFCOMPONENT_1_SHIFT) | - (BRW_VFCOMPONENT_STORE_1_FLT << VE1_VFCOMPONENT_2_SHIFT) | - (BRW_VFCOMPONENT_STORE_1_FLT << VE1_VFCOMPONENT_3_SHIFT) | - (0 << VE1_DESTINATION_ELEMENT_OFFSET_SHIFT)); - /* offset 8: S0, T0 -> {S0, T0, 1.0, 1.0} */ - OUT_RING((0 << VE0_VERTEX_BUFFER_INDEX_SHIFT) | - VE0_VALID | - (BRW_SURFACEFORMAT_R32G32_FLOAT << VE0_FORMAT_SHIFT) | - (8 << VE0_OFFSET_SHIFT)); - OUT_RING((BRW_VFCOMPONENT_STORE_SRC << VE1_VFCOMPONENT_0_SHIFT) | - (BRW_VFCOMPONENT_STORE_SRC << VE1_VFCOMPONENT_1_SHIFT) | - (BRW_VFCOMPONENT_STORE_1_FLT << VE1_VFCOMPONENT_2_SHIFT) | - (BRW_VFCOMPONENT_STORE_1_FLT << VE1_VFCOMPONENT_3_SHIFT) | - (4 << VE1_DESTINATION_ELEMENT_OFFSET_SHIFT)); - - OUT_RING(MI_NOOP); /* pad to quadword */ - ADVANCE_LP_RING(); } - - dxo = dstRegion->extents.x1; - dyo = dstRegion->extents.y1; - - pbox = REGION_RECTS(dstRegion); - nbox = REGION_NUM_RECTS(dstRegion); - while (nbox--) - { - int box_x1 = pbox->x1; - int box_y1 = pbox->y1; - int box_x2 = pbox->x2; - int box_y2 = pbox->y2; - int i; - float src_scale_x, src_scale_y; - - if (!first_output) { - /* Since we use the same little vertex buffer over and over, sync for - * subsequent rectangles. - */ - if (pI830->AccelInfoRec && pI830->AccelInfoRec->NeedToSync) { - (*pI830->AccelInfoRec->Sync)(pScrn); - pI830->AccelInfoRec->NeedToSync = FALSE; - } - } - - pbox++; - - /* Use normalized texture coordinates */ - src_scale_x = (float)1.0 / (float)drw_w; - src_scale_y = (float)1.0 / (float)drw_h; - - i = 0; - vb[i++] = (box_x2 - dxo) * src_scale_x; - vb[i++] = (box_y2 - dyo) * src_scale_y; - vb[i++] = (float) box_x2; - vb[i++] = (float) box_y2; - - vb[i++] = (box_x1 - dxo) * src_scale_x; - vb[i++] = (box_y2 - dyo) * src_scale_y; - vb[i++] = (float) box_x1; - vb[i++] = (float) box_y2; - - vb[i++] = (box_x1 - dxo) * src_scale_x; - vb[i++] = (box_y1 - dyo) * src_scale_y; - vb[i++] = (float) box_x1; - vb[i++] = (float) box_y1; - -#if 0 - ErrorF ("before EU_ATT 0x%08x%08x EU_ATT_DATA 0x%08x%08x\n", - INREG(BRW_EU_ATT_1), INREG(BRW_EU_ATT_0), - INREG(BRW_EU_ATT_DATA_1), INREG(BRW_EU_ATT_DATA_0)); - - OUTREG(BRW_VF_CTL, - BRW_VF_CTL_SNAPSHOT_MUX_SELECT_THREADID | - BRW_VF_CTL_SNAPSHOT_TYPE_VERTEX_INDEX | - BRW_VF_CTL_SNAPSHOT_ENABLE); - OUTREG(BRW_VF_STRG_VAL, 0); -#endif - -#if 0 - OUTREG(BRW_VS_CTL, - BRW_VS_CTL_SNAPSHOT_ALL_THREADS | - BRW_VS_CTL_SNAPSHOT_MUX_VALID_COUNT | - BRW_VS_CTL_THREAD_SNAPSHOT_ENABLE); - - OUTREG(BRW_VS_STRG_VAL, 0); -#endif - -#if WATCH_SF - OUTREG(BRW_SF_CTL, - BRW_SF_CTL_SNAPSHOT_MUX_VERTEX_COUNT | - BRW_SF_CTL_SNAPSHOT_ALL_THREADS | - BRW_SF_CTL_THREAD_SNAPSHOT_ENABLE); - OUTREG(BRW_SF_STRG_VAL, 0); -#endif - -#if WATCH_WIZ - OUTREG(BRW_WIZ_CTL, - BRW_WIZ_CTL_SNAPSHOT_MUX_SUBSPAN_INSTANCE | - BRW_WIZ_CTL_SNAPSHOT_ALL_THREADS | - BRW_WIZ_CTL_SNAPSHOT_ENABLE); - OUTREG(BRW_WIZ_STRG_VAL, - (box_x1) | (box_y1 << 16)); -#endif - -#if 0 - OUTREG(BRW_TS_CTL, - BRW_TS_CTL_SNAPSHOT_MESSAGE_ERROR | - BRW_TS_CTL_SNAPSHOT_ALL_CHILD_THREADS | - BRW_TS_CTL_SNAPSHOT_ALL_ROOT_THREADS | - BRW_TS_CTL_SNAPSHOT_ENABLE); -#endif - - BEGIN_LP_RING(6); - OUT_RING(BRW_3DPRIMITIVE | - BRW_3DPRIMITIVE_VERTEX_SEQUENTIAL | - (_3DPRIM_RECTLIST << BRW_3DPRIMITIVE_TOPOLOGY_SHIFT) | - (0 << 9) | /* CTG - indirect vertex count */ - 4); - OUT_RING(3); /* vertex count per instance */ - OUT_RING(0); /* start vertex offset */ - OUT_RING(1); /* single instance */ - OUT_RING(0); /* start instance location */ - OUT_RING(0); /* index buffer offset, ignored */ - ADVANCE_LP_RING(); - -#if 0 - for (j = 0; j < 100000; j++) { - ctl = INREG(BRW_VF_CTL); - if (ctl & BRW_VF_CTL_SNAPSHOT_COMPLETE) - break; - } - - rdata = INREG(BRW_VF_RDATA); - OUTREG(BRW_VF_CTL, 0); - ErrorF ("VF_CTL: 0x%08x VF_RDATA: 0x%08x\n", ctl, rdata); -#endif - -#if 0 - for (j = 0; j < 1000000; j++) { - ctl = INREG(BRW_VS_CTL); - if (ctl & BRW_VS_CTL_SNAPSHOT_COMPLETE) - break; - } - - rdata = INREG(BRW_VS_RDATA); - for (k = 0; k <= 3; k++) { - OUTREG(BRW_VS_CTL, - BRW_VS_CTL_SNAPSHOT_COMPLETE | - (k << 8)); - rdata = INREG(BRW_VS_RDATA); - ErrorF ("VS_CTL: 0x%08x VS_RDATA(%d): 0x%08x\n", ctl, k, rdata); - } - - OUTREG(BRW_VS_CTL, 0); -#endif - -#if WATCH_SF - for (j = 0; j < 1000000; j++) { - ctl = INREG(BRW_SF_CTL); - if (ctl & BRW_SF_CTL_SNAPSHOT_COMPLETE) - break; - } - - for (k = 0; k <= 7; k++) { - OUTREG(BRW_SF_CTL, - BRW_SF_CTL_SNAPSHOT_COMPLETE | - (k << 8)); - rdata = INREG(BRW_SF_RDATA); - ErrorF ("SF_CTL: 0x%08x SF_RDATA(%d): 0x%08x\n", ctl, k, rdata); - } - - OUTREG(BRW_SF_CTL, 0); -#endif - -#if WATCH_WIZ - for (j = 0; j < 100000; j++) { - ctl = INREG(BRW_WIZ_CTL); - if (ctl & BRW_WIZ_CTL_SNAPSHOT_COMPLETE) - break; - } - - rdata = INREG(BRW_WIZ_RDATA); - OUTREG(BRW_WIZ_CTL, 0); - ErrorF ("WIZ_CTL: 0x%08x WIZ_RDATA: 0x%08x\n", ctl, rdata); -#endif - -#if 0 - for (j = 0; j < 100000; j++) { - ctl = INREG(BRW_TS_CTL); - if (ctl & BRW_TS_CTL_SNAPSHOT_COMPLETE) - break; - } - - rdata = INREG(BRW_TS_RDATA); - OUTREG(BRW_TS_CTL, 0); - ErrorF ("TS_CTL: 0x%08x TS_RDATA: 0x%08x\n", ctl, rdata); - - ErrorF ("after EU_ATT 0x%08x%08x EU_ATT_DATA 0x%08x%08x\n", - INREG(BRW_EU_ATT_1), INREG(BRW_EU_ATT_0), - INREG(BRW_EU_ATT_DATA_1), INREG(BRW_EU_ATT_DATA_0)); +#if VIDEO_DEBUG + CompareOverlay(pI830, (CARD32 *) overlay, 0x100); #endif - + + /* + * If the video isn't visible on any CRTC, turn it off + */ + if (!crtc) + { + pPriv->current_crtc = NULL; + i830_overlay_off (pScrn); + return; + } + + if (crtc != pPriv->current_crtc) + { + pPriv->current_crtc = crtc; + i830_overlay_switch_to_crtc (pScrn, crtc); + if (pPriv->overlayOK) + I830ResetVideo (pScrn); + } + + if (!pPriv->overlayOK) + return; + + switch (crtc->rotation & 0xf) { + case RR_Rotate_0: + dstBox->x1 -= crtc->x; + dstBox->x2 -= crtc->x; + dstBox->y1 -= crtc->y; + dstBox->y2 -= crtc->y; + break; + case RR_Rotate_90: + tmp = dstBox->x1; + dstBox->x1 = dstBox->y1 - crtc->x; + dstBox->y1 = pScrn->virtualY - tmp - crtc->y; + tmp = dstBox->x2; + dstBox->x2 = dstBox->y2 - crtc->x; + dstBox->y2 = pScrn->virtualY - tmp - crtc->y; + tmp = dstBox->y1; + dstBox->y1 = dstBox->y2; + dstBox->y2 = tmp; + break; + case RR_Rotate_180: + tmp = dstBox->x1; + dstBox->x1 = pScrn->virtualX - dstBox->x2 - crtc->x; + dstBox->x2 = pScrn->virtualX - tmp - crtc->x; + tmp = dstBox->y1; + dstBox->y1 = pScrn->virtualY - dstBox->y2 - crtc->y; + dstBox->y2 = pScrn->virtualY - tmp - crtc->y; + break; + case RR_Rotate_270: + tmp = dstBox->x1; + dstBox->x1 = pScrn->virtualX - dstBox->y1 - crtc->x; + dstBox->y1 = tmp - crtc->y; + tmp = dstBox->x2; + dstBox->x2 = pScrn->virtualX - dstBox->y2 - crtc->x; + dstBox->y2 = tmp - crtc->y; + tmp = dstBox->x1; + dstBox->x1 = dstBox->x2; + dstBox->x2 = tmp; + break; + } + + if (crtc->rotation & (RR_Rotate_90 | RR_Rotate_270)) { + tmp = width; + width = height; + height = tmp; + tmp = drw_w; + drw_w = drw_h; + drw_h = tmp; + tmp = src_w; + src_w = src_h; + src_h = tmp; + } + + if (pPriv->oneLineMode) { + /* change the coordinates with panel fitting active */ + dstBox->y1 = (((dstBox->y1 - 1) * pPriv->scaleRatio) >> 16) + 1; + dstBox->y2 = ((dstBox->y2 * pPriv->scaleRatio) >> 16) + 1; + + /* Now, alter the height, so we scale to the correct size */ + drw_h = ((drw_h * pPriv->scaleRatio) >> 16) + 1; + } + + if (IS_I9XX(pI830)) { + shift = 6; + mask = 0x3f; + } else { + shift = 5; + mask = 0x1f; + } + + if (pPriv->currentBuf == 0) { + offsety = pPriv->YBuf0offset; + offsetu = pPriv->UBuf0offset; + } else { + offsety = pPriv->YBuf1offset; + offsetu = pPriv->UBuf1offset; + } + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + overlay->SWIDTH = width | ((width/2 & 0x7ff) << 16); + swidthy = i830_swidth (pI830, offsety, width, mask, shift); + swidthuv = i830_swidth (pI830, offsetu, width/2, mask, shift); + overlay->SWIDTHSW = (swidthy) | (swidthuv << 16); + overlay->SHEIGHT = height | ((height / 2) << 16); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + overlay->SWIDTH = width; + swidth = ((offsety + (width << 1) + mask) >> shift) - + (offsety >> shift); + + if (IS_I9XX(pI830)) + swidth <<= 1; + + swidth -= 1; + + swidth <<= 2; + + OVERLAY_DEBUG("swidthsw is old %d new %d\n", + swidth, + i830_swidth (pI830, offsety, width << 1, + mask, shift)); + + overlay->SWIDTHSW = swidth; + overlay->SHEIGHT = height; + break; + } + + overlay->DWINPOS = (dstBox->y1 << 16) | dstBox->x1; + + overlay->DWINSZ = (((dstBox->y2 - dstBox->y1) << 16) | + (dstBox->x2 - dstBox->x1)); + + OVERLAY_DEBUG("dstBox: x1: %d, y1: %d, x2: %d, y2: %d\n", + dstBox->x1, dstBox->y1, dstBox->x2, dstBox->y2); + + /* buffer locations */ + overlay->OBUF_0Y = pPriv->YBuf0offset; + overlay->OBUF_0U = pPriv->UBuf0offset; + overlay->OBUF_0V = pPriv->VBuf0offset; + if(pPriv->doubleBuffer) { + overlay->OBUF_1Y = pPriv->YBuf1offset; + overlay->OBUF_1U = pPriv->UBuf1offset; + overlay->OBUF_1V = pPriv->VBuf1offset; + } + + OVERLAY_DEBUG("pos: 0x%lx, size: 0x%lx\n", + overlay->DWINPOS, overlay->DWINSZ); + OVERLAY_DEBUG("dst: %d x %d, src: %d x %d\n", drw_w, drw_h, src_w, src_h); + + /* + * Calculate horizontal and vertical scaling factors and polyphase + * coefficients. + */ + + { + int xscaleInt, xscaleFract, yscaleInt, yscaleFract; + int xscaleIntUV, xscaleFractUV; + int yscaleIntUV, yscaleFractUV; + /* UV is half the size of Y -- YUV420 */ + int uvratio = 2; + CARD32 newval; + coeffRec xcoeffY[N_HORIZ_Y_TAPS * N_PHASES]; + coeffRec xcoeffUV[N_HORIZ_UV_TAPS * N_PHASES]; + int i, j, pos; + + /* + * Y down-scale factor as a multiple of 4096. + */ + xscaleFract = ((src_w - 1) << 12) / drw_w; + yscaleFract = ((src_h - 1) << 12) / drw_h; + + /* Calculate the UV scaling factor. */ + xscaleFractUV = xscaleFract / uvratio; + yscaleFractUV = yscaleFract / uvratio; + + /* + * To keep the relative Y and UV ratios exact, round the Y scales + * to a multiple of the Y/UV ratio. + */ + xscaleFract = xscaleFractUV * uvratio; + yscaleFract = yscaleFractUV * uvratio; + + /* Integer (un-multiplied) values. */ + xscaleInt = xscaleFract >> 12; + yscaleInt = yscaleFract >> 12; + + xscaleIntUV = xscaleFractUV >> 12; + yscaleIntUV = yscaleFractUV >> 12; + + OVERLAY_DEBUG("xscale: %x.%03x, yscale: %x.%03x\n", xscaleInt, + xscaleFract & 0xFFF, yscaleInt, yscaleFract & 0xFFF); + OVERLAY_DEBUG("UV xscale: %x.%03x, UV yscale: %x.%03x\n", xscaleIntUV, + xscaleFractUV & 0xFFF, yscaleIntUV, yscaleFractUV & 0xFFF); + + /* shouldn't get here */ + if (xscaleInt > 7) { + OVERLAY_DEBUG("xscale: bad scale\n"); + return; + } + + /* shouldn't get here */ + if (xscaleIntUV > 7) { + OVERLAY_DEBUG("xscaleUV: bad scale\n"); + return; + } + + newval = (xscaleInt << 16) | + ((xscaleFract & 0xFFF) << 3) | ((yscaleFract & 0xFFF) << 20); + if (newval != overlay->YRGBSCALE) { + scaleChanged = TRUE; + overlay->YRGBSCALE = newval; + } + + newval = (xscaleIntUV << 16) | ((xscaleFractUV & 0xFFF) << 3) | + ((yscaleFractUV & 0xFFF) << 20); + if (newval != overlay->UVSCALE) { + scaleChanged = TRUE; + overlay->UVSCALE = newval; + } + + newval = yscaleInt << 16 | yscaleIntUV; + if (newval != overlay->UVSCALEV) { + scaleChanged = TRUE; + overlay->UVSCALEV = newval; + } + + /* Recalculate coefficients if the scaling changed. */ + + /* + * Only Horizontal coefficients so far. + */ + if (scaleChanged) { + double fCutoffY; + double fCutoffUV; + + fCutoffY = xscaleFract / 4096.0; + fCutoffUV = xscaleFractUV / 4096.0; + + /* Limit to between 1.0 and 3.0. */ + if (fCutoffY < MIN_CUTOFF_FREQ) + fCutoffY = MIN_CUTOFF_FREQ; + if (fCutoffY > MAX_CUTOFF_FREQ) + fCutoffY = MAX_CUTOFF_FREQ; + if (fCutoffUV < MIN_CUTOFF_FREQ) + fCutoffUV = MIN_CUTOFF_FREQ; + if (fCutoffUV > MAX_CUTOFF_FREQ) + fCutoffUV = MAX_CUTOFF_FREQ; + + UpdateCoeff(N_HORIZ_Y_TAPS, fCutoffY, TRUE, TRUE, xcoeffY); + UpdateCoeff(N_HORIZ_UV_TAPS, fCutoffUV, TRUE, FALSE, xcoeffUV); + + for (i = 0; i < N_PHASES; i++) { + for (j = 0; j < N_HORIZ_Y_TAPS; j++) { + pos = i * N_HORIZ_Y_TAPS + j; + overlay->Y_HCOEFS[pos] = (xcoeffY[pos].sign << 15 | + xcoeffY[pos].exponent << 12 | + xcoeffY[pos].mantissa); + } + } + for (i = 0; i < N_PHASES; i++) { + for (j = 0; j < N_HORIZ_UV_TAPS; j++) { + pos = i * N_HORIZ_UV_TAPS + j; + overlay->UV_HCOEFS[pos] = (xcoeffUV[pos].sign << 15 | + xcoeffUV[pos].exponent << 12 | + xcoeffUV[pos].mantissa); + } + } + } + } + + OCMD = OVERLAY_ENABLE; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + OVERLAY_DEBUG("YUV420\n"); #if 0 - for (j = 0; j < 256; j++) { - OUTREG(BRW_TD_CTL, j << BRW_TD_CTL_MUX_SHIFT); - rdata = INREG(BRW_TD_RDATA); - ErrorF ("TD_RDATA(%d): 0x%08x\n", j, rdata); - } -#endif - first_output = FALSE; - if (pI830->AccelInfoRec) - pI830->AccelInfoRec->NeedToSync = TRUE; - } - - if (pI830->AccelInfoRec) - (*pI830->AccelInfoRec->Sync)(pScrn); -#if WATCH_STATS - I830PrintErrorState (pScrn); + /* set UV vertical phase to -0.25 */ + overlay->UV_VPH = 0x30003000; #endif + OVERLAY_DEBUG("UV stride is %d, Y stride is %d\n", + dstPitch, dstPitch * 2); + overlay->OSTRIDE = (dstPitch * 2) | (dstPitch << 16); + OCMD &= ~SOURCE_FORMAT; + OCMD &= ~OV_BYTE_ORDER; + OCMD |= YUV_420; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + OVERLAY_DEBUG("YUV422\n"); + overlay->OSTRIDE = dstPitch; + OCMD &= ~SOURCE_FORMAT; + OCMD |= YUV_422; + OCMD &= ~OV_BYTE_ORDER; + if (id == FOURCC_UYVY) + OCMD |= Y_SWAP; + break; + } + + OCMD &= ~(BUFFER_SELECT | FIELD_SELECT); + if (pPriv->currentBuf == 0) + OCMD |= BUFFER0; + else + OCMD |= BUFFER1; + + overlay->OCMD = OCMD; + OVERLAY_DEBUG("OCMD is 0x%lx\n", OCMD); + + /* make sure the overlay is on */ + i830_overlay_on (pScrn); + /* and show this frame */ + i830_overlay_continue (pScrn, scaleChanged); } -static FBLinearPtr -I830AllocateMemory(ScrnInfoPtr pScrn, FBLinearPtr linear, int size) +static Bool +i830_clip_video_helper (ScrnInfoPtr pScrn, + xf86CrtcPtr *crtc_ret, + BoxPtr dst, + INT32 *xa, + INT32 *xb, + INT32 *ya, + INT32 *yb, + RegionPtr reg, + INT32 width, + INT32 height) { - ScreenPtr pScreen; - FBLinearPtr new_linear = NULL; - - ErrorF("I830AllocateMemory\n"); - - if (linear) { - if (linear->size >= size) - return linear; - - if (xf86ResizeOffscreenLinear(linear, size)) - return linear; - - xf86FreeOffscreenLinear(linear); - } - - pScreen = screenInfo.screens[pScrn->scrnIndex]; + Bool ret; + RegionRec crtc_region_local; + RegionPtr crtc_region = reg; + + /* + * For overlay video, compute the relevant CRTC and + * clip video to that + */ + if (crtc_ret) + { + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr; + BoxRec crtc_box; + xf86CrtcPtr crtc = i830_covering_crtc (pScrn, dst, + pPriv->desired_crtc, + &crtc_box); + + if (crtc) + { + REGION_INIT (pScreen, &crtc_region_local, &crtc_box, 1); + crtc_region = &crtc_region_local; + REGION_INTERSECT (pScreen, crtc_region, crtc_region, reg); + } + *crtc_ret = crtc; + } + ret = xf86XVClipVideoHelper (dst, xa, xb, ya, yb, + crtc_region, width, height); + if (crtc_region != reg) + REGION_UNINIT (pScreen, &crtc_region_local); + return ret; +} - new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, - NULL, NULL, NULL); +static void +i830_fill_colorkey (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes) +{ + DrawablePtr root = &WindowTable[pScreen->myNum]->drawable; + XID pval[2]; + BoxPtr pbox = REGION_RECTS(clipboxes); + int i, nbox = REGION_NUM_RECTS(clipboxes); + xRectangle *rects; + GCPtr gc; - if (!new_linear) { - int max_size; + if(!xf86Screens[pScreen->myNum]->vtSema) return; - xf86QueryLargestOffscreenLinear(pScreen, &max_size, 4, - PRIORITY_EXTREME); + gc = GetScratchGC(root->depth, pScreen); + pval[0] = key; + pval[1] = IncludeInferiors; + (void) ChangeGC(gc, GCForeground|GCSubwindowMode, pval); + ValidateGC(root, gc); - if (max_size < size) { - ErrorF("No memory available\n"); - return NULL; - } + rects = xalloc (nbox * sizeof(xRectangle)); - xf86PurgeUnlockedOffscreenAreas(pScreen); - new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, - NULL, NULL, NULL); + for(i = 0; i < nbox; i++, pbox++) + { + rects[i].x = pbox->x1; + rects[i].y = pbox->y1; + rects[i].width = pbox->x2 - pbox->x1; + rects[i].height = pbox->y2 - pbox->y1; } - - return new_linear; + + (*gc->ops->PolyFillRect)(root, gc, nbox, rects); + + xfree (rects); + FreeScratchGC (gc); } /* @@ -2918,245 +2177,264 @@ I830PutImage(ScrnInfoPtr pScrn, Bool sync, RegionPtr clipBoxes, pointer data, DrawablePtr pDraw) { - I830Ptr pI830 = I830PTR(pScrn); - I830PortPrivPtr pPriv = (I830PortPrivPtr) data; - ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; - I830OverlayRegPtr overlay = - (I830OverlayRegPtr) (pI830->FbBase + pI830->OverlayMem->Start); - INT32 x1, x2, y1, y2; - int srcPitch, srcPitch2 = 0, dstPitch, destId; - int top, left, npixels, nlines, size, loops; - BoxRec dstBox; - int pitchAlignMask; - int extraLinear; - - ErrorF("I830PutImage: src: (%d,%d)(%d,%d), dst: (%d,%d)(%d,%d)\n" + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv = (I830PortPrivPtr) data; + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + I830OverlayRegPtr overlay; + PixmapPtr pPixmap; + INT32 x1, x2, y1, y2; + int srcPitch, srcPitch2 = 0, dstPitch, destId; + int top, left, npixels, nlines, size; + BoxRec dstBox; + int pitchAlignMask; + int alloc_size, extraLinear; + xf86CrtcPtr crtc; + + if (pPriv->textured) + overlay = NULL; + else + overlay = I830OVERLAYREG(pI830); + +#if 0 + ErrorF("I830PutImage: src: (%d,%d)(%d,%d), dst: (%d,%d)(%d,%d)\n" "width %d, height %d\n", src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, width, height); - - if (pI830->entityPrivate) { - if (pI830->entityPrivate->XvInUse != -1 && - pI830->entityPrivate->XvInUse != pPriv->pipe) { -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - return Success; /* faked for trying to share it */ - } else #endif - { - return BadAlloc; - } - } - - pI830->entityPrivate->XvInUse = pPriv->pipe; - } - - /* overlay limits */ - if(src_w > (drw_w * 7)) - drw_w = src_w * 7; - - if(src_h > (drw_h * 7)) - drw_h = src_h * 7; - - /* Clip */ - x1 = src_x; - x2 = src_x + src_w; - y1 = src_y; - y2 = src_y + src_h; - - dstBox.x1 = drw_x; - dstBox.x2 = drw_x + drw_w; - dstBox.y1 = drw_y; - dstBox.y2 = drw_y + drw_h; - - if (!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, - width, height)) - return Success; - - destId = id; - switch (id) { - case FOURCC_YV12: - case FOURCC_I420: - srcPitch = (width + 3) & ~3; - srcPitch2 = ((width >> 1) + 3) & ~3; - if (pPriv->textured) { - destId = FOURCC_YUY2; - } - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - srcPitch = width << 1; - break; - } - - /* Only needs to be DWORD-aligned for textured on i915, but overlay has - * stricter requirements. - */ - if (pPriv->textured) { - pitchAlignMask = 3; - } else { - if (IS_I96X(pI830)) - pitchAlignMask = 255; - else - pitchAlignMask = 63; - } - /* Determine the desired destination pitch (representing the chroma's pitch, - * in the planar case. - */ - switch (destId) { - case FOURCC_YV12: - case FOURCC_I420: - if (pI830->rotation & (RR_Rotate_90 | RR_Rotate_270)) { - dstPitch = ((height / 2) + pitchAlignMask) & ~pitchAlignMask; - size = dstPitch * width * 3; - } else { - dstPitch = ((width / 2) + pitchAlignMask) & ~pitchAlignMask; - size = dstPitch * height * 3; - } - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - if (pI830->rotation & (RR_Rotate_90 | RR_Rotate_270)) { - dstPitch = ((height << 1) + pitchAlignMask) & ~pitchAlignMask; - size = dstPitch * width; - } else { - dstPitch = ((width << 1) + pitchAlignMask) & ~pitchAlignMask; - size = dstPitch * height; - } - break; - } -#if 0 - ErrorF("srcPitch: %d, dstPitch: %d, size: %d\n", srcPitch, dstPitch, size); + if (pI830->entityPrivate) { + if (pI830->entityPrivate->XvInUse != -1 && + pI830->entityPrivate->XvInUse != i830_crtc_pipe (pPriv->current_crtc)) { +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + return Success; /* faked for trying to share it */ + } else #endif - - if (IS_I96X(pI830)) - extraLinear = BRW_LINEAR_EXTRA; - else - extraLinear = 0; - - /* size is multiplied by 2 because we have two buffers that are flipping */ - pPriv->linear = I830AllocateMemory(pScrn, pPriv->linear, - (extraLinear + - (pPriv->doubleBuffer ? size * 2 : size)) / - pI830->cpp); - - if(!pPriv->linear || pPriv->linear->offset < (pScrn->virtualX * pScrn->virtualY)) - return BadAlloc; - - /* fixup pointers */ + { + return BadAlloc; + } + } + + pI830->entityPrivate->XvInUse = i830_crtc_pipe (pPriv->current_crtc);; + } + + /* Clamp dst width & height to 7x of src (overlay limit) */ + if(drw_w > (src_w * 7)) + drw_w = src_w * 7; + + if(drw_h > (src_h * 7)) + drw_h = src_h * 7; + + /* Clip */ + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if (!i830_clip_video_helper(pScrn, + pPriv->textured ? NULL : &crtc, + &dstBox, &x1, &x2, &y1, &y2, clipBoxes, + width, height)) + return Success; + + destId = id; + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + srcPitch = (width + 3) & ~3; + srcPitch2 = ((width >> 1) + 3) & ~3; + if (pPriv->textured && IS_I965G(pI830)) + destId = FOURCC_YUY2; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + srcPitch = width << 1; + break; + } + + /* Only needs to be DWORD-aligned for textured on i915, but overlay has + * stricter requirements. + */ + if (pPriv->textured) { + pitchAlignMask = 3; + } else { + if (IS_I965G(pI830)) + pitchAlignMask = 255; + else + pitchAlignMask = 63; + } + + /* Determine the desired destination pitch (representing the chroma's pitch, + * in the planar case. + */ + switch (destId) { + case FOURCC_YV12: + case FOURCC_I420: + if (pI830->rotation & (RR_Rotate_90 | RR_Rotate_270)) { + dstPitch = ((height / 2) + pitchAlignMask) & ~pitchAlignMask; + size = dstPitch * width * 3; + } else { + dstPitch = ((width / 2) + pitchAlignMask) & ~pitchAlignMask; + size = dstPitch * height * 3; + } + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + if (pI830->rotation & (RR_Rotate_90 | RR_Rotate_270)) { + dstPitch = ((height << 1) + pitchAlignMask) & ~pitchAlignMask; + size = dstPitch * width; + } else { + dstPitch = ((width << 1) + pitchAlignMask) & ~pitchAlignMask; + size = dstPitch * height; + } + break; + } #if 0 - pPriv->YBuf0offset = pScrn->fbOffset + pPriv->linear->offset * pI830->cpp; -#else - pPriv->YBuf0offset = pI830->FrontBuffer.Start + pPriv->linear->offset * pI830->cpp; + ErrorF("srcPitch: %d, dstPitch: %d, size: %d\n", srcPitch, dstPitch, size); #endif - if (pI830->rotation & (RR_Rotate_90 | RR_Rotate_270)) { - pPriv->UBuf0offset = pPriv->YBuf0offset + (dstPitch * 2 * width); - pPriv->VBuf0offset = pPriv->UBuf0offset + (dstPitch * width / 2); - if(pPriv->doubleBuffer) { - pPriv->YBuf1offset = pPriv->YBuf0offset + size; - pPriv->UBuf1offset = pPriv->YBuf1offset + (dstPitch * 2 * width); - pPriv->VBuf1offset = pPriv->UBuf1offset + (dstPitch * width / 2); - } - } else { - pPriv->UBuf0offset = pPriv->YBuf0offset + (dstPitch * 2 * height); - pPriv->VBuf0offset = pPriv->UBuf0offset + (dstPitch * height / 2); - if(pPriv->doubleBuffer) { - pPriv->YBuf1offset = pPriv->YBuf0offset + size; - pPriv->UBuf1offset = pPriv->YBuf1offset + (dstPitch * 2 * height); - pPriv->VBuf1offset = pPriv->UBuf1offset + (dstPitch * height / 2); - } - } - /* Make sure this buffer isn't in use */ - loops = 0; - if (!pPriv->textured && *pI830->overlayOn && pPriv->doubleBuffer && - (overlay->OCMD & OVERLAY_ENABLE)) - { - while (loops < 1000000) { -#if USE_USLEEP_FOR_VIDEO - usleep(10); -#endif - if (((INREG(DOVSTA) & OC_BUF) >> 20) == pPriv->currentBuf) { - break; - } - loops++; - } - if (loops >= 1000000) { - ErrorF("loops (1) maxed out for buffer %d\n", pPriv->currentBuf); -#if 0 - pPriv->currentBuf = !pPriv->currentBuf; + if (IS_I965G(pI830)) + extraLinear = BRW_LINEAR_EXTRA; + else + extraLinear = 0; + + alloc_size = size; + if (pPriv->doubleBuffer) + alloc_size *= 2; + alloc_size += extraLinear; + + if (pPriv->buf) { + /* Wait for any previous acceleration to the buffer to have completed. + * When we start using BOs for rendering, we won't have to worry + * because mapping or freeing will take care of it automatically. + */ + I830Sync(pScrn); + } + + /* Free the current buffer if we're going to have to reallocate */ + if (pPriv->buf && pPriv->buf->size < alloc_size) { + i830_free_memory(pScrn, pPriv->buf); + pPriv->buf = NULL; + } + + if (pPriv->buf == NULL) { + pPriv->buf = i830_allocate_memory(pScrn, "xv buffer", alloc_size, 16, + 0); + } + + if (pPriv->buf == NULL) + return BadAlloc; + + pPriv->extra_offset = pPriv->buf->offset + + (pPriv->doubleBuffer ? size * 2 : size); + + /* fixup pointers */ + pPriv->YBuf0offset = pPriv->buf->offset; + if (pI830->rotation & (RR_Rotate_90 | RR_Rotate_270)) { + pPriv->UBuf0offset = pPriv->YBuf0offset + (dstPitch * 2 * width); + pPriv->VBuf0offset = pPriv->UBuf0offset + (dstPitch * width / 2); + if(pPriv->doubleBuffer) { + pPriv->YBuf1offset = pPriv->YBuf0offset + size; + pPriv->UBuf1offset = pPriv->YBuf1offset + (dstPitch * 2 * width); + pPriv->VBuf1offset = pPriv->UBuf1offset + (dstPitch * width / 2); + } + } else { + pPriv->UBuf0offset = pPriv->YBuf0offset + (dstPitch * 2 * height); + pPriv->VBuf0offset = pPriv->UBuf0offset + (dstPitch * height / 2); + if(pPriv->doubleBuffer) { + pPriv->YBuf1offset = pPriv->YBuf0offset + size; + pPriv->UBuf1offset = pPriv->YBuf1offset + (dstPitch * 2 * height); + pPriv->VBuf1offset = pPriv->UBuf1offset + (dstPitch * height / 2); + } + } + + /* Pick the idle buffer */ + if (!pPriv->textured && *pI830->overlayOn && pPriv->doubleBuffer) + pPriv->currentBuf = !((INREG(DOVSTA) & OC_BUF) >> 20); + + /* copy data */ + top = y1 >> 16; + left = (x1 >> 16) & ~1; + npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; + if (pPriv->textured && IS_I965G(pI830)) { + I830CopyPlanarToPackedData(pScrn, pPriv, buf, srcPitch, srcPitch2, + dstPitch, height, top, left, nlines, + npixels, id); + } else { + I830CopyPlanarData(pScrn, pPriv, buf, srcPitch, srcPitch2, dstPitch, + height, top, left, nlines, npixels, id); + } + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + nlines = ((y2 + 0xffff) >> 16) - top; + I830CopyPackedData(pScrn, pPriv, buf, srcPitch, dstPitch, top, left, + nlines, npixels); + break; + } + + if (pDraw->type == DRAWABLE_WINDOW) { + pPixmap = (*pScreen->GetWindowPixmap)((WindowPtr)pDraw); + } else { + pPixmap = (PixmapPtr)pDraw; + } + +#ifdef I830_USE_EXA + if (pI830->useEXA) { + /* Force the pixmap into framebuffer so we can draw to it. */ + exaMoveInPixmap(pPixmap); + } #endif - } - /* buffer swap */ - if (pPriv->currentBuf == 0) - pPriv->currentBuf = 1; - else - pPriv->currentBuf = 0; - } - - /* copy data */ - top = y1 >> 16; - left = (x1 >> 16) & ~1; - npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; - - if (pPriv->textured) { - /* For textured video, we don't double buffer, and instead just wait for - * acceleration to finish before writing the new video data into - * framebuffer. - */ - if (pI830->AccelInfoRec && pI830->AccelInfoRec->NeedToSync) { - (*pI830->AccelInfoRec->Sync)(pScrn); - pI830->AccelInfoRec->NeedToSync = FALSE; - } - } - - switch (id) { - case FOURCC_YV12: - case FOURCC_I420: - top &= ~1; - nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; - if (pPriv->textured) { - I830CopyPlanarToPackedData(pScrn, pPriv, buf, srcPitch, srcPitch2, - dstPitch, height, top, left, nlines, - npixels, id); - } else { - I830CopyPlanarData(pScrn, pPriv, buf, srcPitch, srcPitch2, dstPitch, - height, top, left, nlines, npixels, id); - } - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - nlines = ((y2 + 0xffff) >> 16) - top; - I830CopyPackedData(pScrn, pPriv, buf, srcPitch, dstPitch, top, left, - nlines, npixels); - break; - } - - if (!pPriv->textured) { - /* update cliplist */ - if (!RegionsEqual(&pPriv->clip, clipBoxes)) { - REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes); - xf86XVFillKeyHelper(pScreen, pPriv->colorKey, clipBoxes); - } - - I830DisplayVideo(pScrn, destId, width, height, dstPitch, - x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); - } else if (IS_I96X(pI830)) { - BroadwaterDisplayVideoTextured (pScrn, pPriv, destId, clipBoxes, width, height, - dstPitch, x1, y1, x2, y2, - src_w, src_h, drw_w, drw_h, pDraw); - } else { - I915DisplayVideoTextured(pScrn, pPriv, destId, clipBoxes, width, height, - dstPitch, x1, y1, x2, y2, - src_w, src_h, drw_w, drw_h, pDraw); - } - pPriv->videoStatus = CLIENT_VIDEO_ON; - - return Success; + if (!pI830->useEXA && + (((char *)pPixmap->devPrivate.ptr < (char *)pI830->FbBase) || + ((char *)pPixmap->devPrivate.ptr >= (char *)pI830->FbBase + + pI830->FbMapSize))) { + /* If the pixmap wasn't in framebuffer, then we have no way in XAA to + * force it there. So, we simply refuse to draw and fail. + */ + return BadAlloc; + } + + if (!pPriv->textured) { + i830_display_video(pScrn, crtc, destId, width, height, dstPitch, + x1, y1, x2, y2, &dstBox, src_w, src_h, + drw_w, drw_h); + + /* update cliplist */ + if (!RegionsEqual(&pPriv->clip, clipBoxes)) { + REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes); + i830_fill_colorkey (pScreen, pPriv->colorKey, clipBoxes); + } + } else if (IS_I965G(pI830)) { + I965DisplayVideoTextured(pScrn, pPriv, destId, clipBoxes, width, height, + dstPitch, x1, y1, x2, y2, + src_w, src_h, drw_w, drw_h, pPixmap); + } else { + I915DisplayVideoTextured(pScrn, pPriv, destId, clipBoxes, width, height, + dstPitch, x1, y1, x2, y2, + src_w, src_h, drw_w, drw_h, pPixmap); + } + if (pPriv->textured) { + DamageDamageRegion(pDraw, clipBoxes); + } + + pPriv->videoStatus = CLIENT_VIDEO_ON; + + return Success; } static int @@ -3165,75 +2443,75 @@ I830QueryImageAttributes(ScrnInfoPtr pScrn, unsigned short *w, unsigned short *h, int *pitches, int *offsets, Bool textured) { - I830Ptr pI830 = I830PTR(pScrn); - int size, tmp; + I830Ptr pI830 = I830PTR(pScrn); + int size, tmp; #if 0 - ErrorF("I830QueryImageAttributes: w is %d, h is %d\n", *w, *h); + ErrorF("I830QueryImageAttributes: w is %d, h is %d\n", *w, *h); #endif - if (!textured) { - if (IS_845G(pI830) || IS_I830(pI830)) { - if (*w > IMAGE_MAX_WIDTH_LEGACY) + if (IS_845G(pI830) || IS_I830(pI830)) { + if (*w > IMAGE_MAX_WIDTH_LEGACY) *w = IMAGE_MAX_WIDTH_LEGACY; - if (*h > IMAGE_MAX_HEIGHT_LEGACY) + if (*h > IMAGE_MAX_HEIGHT_LEGACY) *h = IMAGE_MAX_HEIGHT_LEGACY; - } else { - if (*w > IMAGE_MAX_WIDTH) + } else { + if (*w > IMAGE_MAX_WIDTH) *w = IMAGE_MAX_WIDTH; - if (*h > IMAGE_MAX_HEIGHT) + if (*h > IMAGE_MAX_HEIGHT) *h = IMAGE_MAX_HEIGHT; - } - } - - *w = (*w + 1) & ~1; - if (offsets) - offsets[0] = 0; - - switch (id) { - /* IA44 is for XvMC only */ - case FOURCC_IA44: - case FOURCC_AI44: - if (pitches) - pitches[0] = *w; - size = *w * *h; - break; - case FOURCC_YV12: - case FOURCC_I420: - *h = (*h + 1) & ~1; - size = (*w + 3) & ~3; - if (pitches) - pitches[0] = size; - size *= *h; - if (offsets) - offsets[1] = size; - tmp = ((*w >> 1) + 3) & ~3; - if (pitches) - pitches[1] = pitches[2] = tmp; - tmp *= (*h >> 1); - size += tmp; - if (offsets) - offsets[2] = size; - size += tmp; - if (pitches) - ErrorF("pitch 0 is %d, pitch 1 is %d, pitch 2 is %d\n", pitches[0], - pitches[1], pitches[2]); - if (offsets) - ErrorF("offset 1 is %d, offset 2 is %d\n", offsets[1], offsets[2]); - if (offsets) - ErrorF("size is %d\n", size); - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - size = *w << 1; - if (pitches) - pitches[0] = size; - size *= *h; - break; - } - - return size; + } + + *w = (*w + 1) & ~1; + if (offsets) + offsets[0] = 0; + + switch (id) { + /* IA44 is for XvMC only */ + case FOURCC_IA44: + case FOURCC_AI44: + if (pitches) + pitches[0] = *w; + size = *w * *h; + break; + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if (pitches) + pitches[0] = size; + size *= *h; + if (offsets) + offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if (pitches) + pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if (offsets) + offsets[2] = size; + size += tmp; +#if 0 + if (pitches) + ErrorF("pitch 0 is %d, pitch 1 is %d, pitch 2 is %d\n", pitches[0], + pitches[1], pitches[2]); + if (offsets) + ErrorF("offset 1 is %d, offset 2 is %d\n", offsets[1], offsets[2]); + if (offsets) + ErrorF("size is %d\n", size); +#endif + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if (pitches) + pitches[0] = size; + size *= *h; + break; + } + + return size; } static int @@ -3242,7 +2520,7 @@ I830QueryImageAttributesOverlay(ScrnInfoPtr pScrn, unsigned short *w, unsigned short *h, int *pitches, int *offsets) { - return I830QueryImageAttributes(pScrn, id, w, h, pitches, offsets, FALSE); + return I830QueryImageAttributes(pScrn, id, w, h, pitches, offsets, FALSE); } static int @@ -3251,55 +2529,56 @@ I830QueryImageAttributesTextured(ScrnInfoPtr pScrn, unsigned short *w, unsigned short *h, int *pitches, int *offsets) { - return I830QueryImageAttributes(pScrn, id, w, h, pitches, offsets, TRUE); + return I830QueryImageAttributes(pScrn, id, w, h, pitches, offsets, TRUE); } -static void -I830BlockHandler(int i, - pointer blockData, pointer pTimeout, pointer pReadmask) +void +I830VideoBlockHandler(int i, pointer blockData, pointer pTimeout, + pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[i]; - ScrnInfoPtr pScrn = xf86Screens[i]; - I830Ptr pI830 = I830PTR(pScrn); - I830PortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + ScrnInfoPtr pScrn = xf86Screens[i]; + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv; - pScreen->BlockHandler = pI830->BlockHandler; + if (pI830->adaptor == NULL) + return; - (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + /* No overlay scaler on the 965. */ + if (IS_I965G(pI830)) + return; - pScreen->BlockHandler = I830BlockHandler; + pPriv = GET_PORT_PRIVATE(pScrn); - if (pPriv->videoStatus & TIMER_MASK) { + if (pPriv->videoStatus & TIMER_MASK) { #if 1 - Time now = currentTime.milliseconds; + Time now = currentTime.milliseconds; #else - UpdateCurrentTime(); + UpdateCurrentTime(); #endif - if (pPriv->videoStatus & OFF_TIMER) { - if (pPriv->offTime < now) { - /* Turn off the overlay */ - ErrorF("BLOCKHANDLER\n"); - - I830ResetVideo(pScrn); - OVERLAY_UPDATE; - OVERLAY_OFF; - - pPriv->videoStatus = FREE_TIMER; - pPriv->freeTime = now + FREE_DELAY; - - if (pI830->entityPrivate) - pI830->entityPrivate->XvInUse = -1; - } - } else { /* FREE_TIMER */ - if (pPriv->freeTime < now) { - if (pPriv->linear) { - xf86FreeOffscreenLinear(pPriv->linear); - pPriv->linear = NULL; + if (pPriv->videoStatus & OFF_TIMER) { + if (pPriv->offTime < now) { + /* Turn off the overlay */ + OVERLAY_DEBUG("BLOCKHANDLER\n"); + + i830_overlay_off (pScrn); + + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = now + FREE_DELAY; + + if (pI830->entityPrivate) + pI830->entityPrivate->XvInUse = -1; } - pPriv->videoStatus = 0; - } - } - } + } else { /* FREE_TIMER */ + if (pPriv->freeTime < now) { + /* Sync before freeing the buffer, because the pages will be + * unbound. + */ + I830Sync(pScrn); + i830_free_memory(pScrn, pPriv->buf); + pPriv->videoStatus = 0; + } + } + } } /*************************************************************************** @@ -3307,8 +2586,8 @@ I830BlockHandler(int i, ***************************************************************************/ typedef struct { - FBLinearPtr linear; - Bool isOn; + i830_memory *buf; + Bool isOn; } OffscreenPrivRec, *OffscreenPrivPtr; static int @@ -3317,121 +2596,114 @@ I830AllocateSurface(ScrnInfoPtr pScrn, unsigned short w, unsigned short h, XF86SurfacePtr surface) { - FBLinearPtr linear; - int pitch, fbpitch, size, bpp; - OffscreenPrivPtr pPriv; - I830Ptr pI830 = I830PTR(pScrn); - - ErrorF("I830AllocateSurface\n"); - - if (IS_845G(pI830) || IS_I830(pI830)) { - if ((w > IMAGE_MAX_WIDTH_LEGACY) || (h > IMAGE_MAX_HEIGHT_LEGACY)) - return BadAlloc; - } else { - if ((w > IMAGE_MAX_WIDTH) || (h > IMAGE_MAX_HEIGHT)) - return BadAlloc; - } - - /* What to do when rotated ?? */ - if (pI830->rotation != RR_Rotate_0) - return BadAlloc; - - w = (w + 1) & ~1; - pitch = ((w << 1) + 15) & ~15; - bpp = pScrn->bitsPerPixel >> 3; - fbpitch = bpp * pScrn->displayWidth; - size = ((pitch * h) + bpp - 1) / bpp; - - if (!(linear = I830AllocateMemory(pScrn, NULL, size))) - return BadAlloc; - - surface->width = w; - surface->height = h; - - if (!(surface->pitches = xalloc(sizeof(int)))) { - xf86FreeOffscreenLinear(linear); - return BadAlloc; - } - if (!(surface->offsets = xalloc(sizeof(int)))) { - xfree(surface->pitches); - xf86FreeOffscreenLinear(linear); - return BadAlloc; - } - if (!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { - xfree(surface->pitches); - xfree(surface->offsets); - xf86FreeOffscreenLinear(linear); - return BadAlloc; - } - - pPriv->linear = linear; - pPriv->isOn = FALSE; - - surface->pScrn = pScrn; - surface->id = id; - surface->pitches[0] = pitch; - surface->offsets[0] = linear->offset * bpp; - surface->devPrivate.ptr = (pointer) pPriv; - -#if 0 - memset(pI830->FbBase + pScrn->fbOffset + surface->offsets[0], 0, size); -#else - memset(pI830->FbBase + pI830->FrontBuffer.Start + surface->offsets[0], 0, size); -#endif - - return Success; + int pitch, fbpitch, size; + OffscreenPrivPtr pPriv; + I830Ptr pI830 = I830PTR(pScrn); + + OVERLAY_DEBUG("I830AllocateSurface\n"); + + if (IS_845G(pI830) || IS_I830(pI830)) { + if ((w > IMAGE_MAX_WIDTH_LEGACY) || (h > IMAGE_MAX_HEIGHT_LEGACY)) + return BadAlloc; + } else { + if ((w > IMAGE_MAX_WIDTH) || (h > IMAGE_MAX_HEIGHT)) + return BadAlloc; + } + + /* What to do when rotated ?? */ + if (pI830->rotation != RR_Rotate_0) + return BadAlloc; + + if (!(surface->pitches = xalloc(sizeof(int)))) + return BadAlloc; + if (!(surface->offsets = xalloc(sizeof(int)))) { + xfree(surface->pitches); + return BadAlloc; + } + if (!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { + xfree(surface->pitches); + xfree(surface->offsets); + return BadAlloc; + } + + w = (w + 1) & ~1; + pitch = ((w << 1) + 15) & ~15; + fbpitch = pI830->cpp * pScrn->displayWidth; + size = pitch * h; + + pPriv->buf = i830_allocate_memory(pScrn, "xv surface buffer", size, 16, 0); + if (pPriv->buf == NULL) { + xfree(surface->pitches); + xfree(surface->offsets); + xfree(pPriv); + return BadAlloc; + } + + surface->width = w; + surface->height = h; + + pPriv->isOn = FALSE; + + surface->pScrn = pScrn; + surface->id = id; + surface->pitches[0] = pitch; + surface->offsets[0] = pPriv->buf->offset; + surface->devPrivate.ptr = (pointer) pPriv; + + memset(pI830->FbBase + surface->offsets[0], 0, size); + + return Success; } static int I830StopSurface(XF86SurfacePtr surface) { - OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; - ScrnInfoPtr pScrn = surface->pScrn; + OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; + ScrnInfoPtr pScrn = surface->pScrn; - if (pPriv->isOn) { - I830Ptr pI830 = I830PTR(pScrn); + if (pPriv->isOn) { + I830Ptr pI830 = I830PTR(pScrn); - ErrorF("StopSurface\n"); + OVERLAY_DEBUG("StopSurface\n"); - I830ResetVideo(pScrn); - OVERLAY_UPDATE; - OVERLAY_OFF; + i830_overlay_off (pScrn); - if (pI830->entityPrivate) - pI830->entityPrivate->XvInUse = -1; + if (pI830->entityPrivate) + pI830->entityPrivate->XvInUse = -1; - pPriv->isOn = FALSE; - } + pPriv->isOn = FALSE; + } - return Success; + return Success; } static int I830FreeSurface(XF86SurfacePtr surface) { - OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; - - if (pPriv->isOn) { - I830StopSurface(surface); - } - xf86FreeOffscreenLinear(pPriv->linear); - xfree(surface->pitches); - xfree(surface->offsets); - xfree(surface->devPrivate.ptr); - - return Success; + ScrnInfoPtr pScrn = surface->pScrn; + OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; + + I830StopSurface(surface); + /* Sync before freeing the buffer, because the pages will be unbound. */ + I830Sync(pScrn); + i830_free_memory(surface->pScrn, pPriv->buf); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + + return Success; } static int I830GetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 * value) { - return I830GetPortAttribute(pScrn, attribute, value, 0); + return I830GetPortAttribute(pScrn, attribute, value, NULL); } static int I830SetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value) { - return I830SetPortAttribute(pScrn, attribute, value, 0); + return I830SetPortAttribute(pScrn, attribute, value, NULL); } static int @@ -3441,230 +2713,135 @@ I830DisplaySurface(XF86SurfacePtr surface, short src_w, short src_h, short drw_w, short drw_h, RegionPtr clipBoxes) { - OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; - ScrnInfoPtr pScrn = surface->pScrn; - ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; - I830Ptr pI830 = I830PTR(pScrn); - I830PortPrivPtr pI830Priv = GET_PORT_PRIVATE(pScrn); - I830OverlayRegPtr overlay = - (I830OverlayRegPtr) (pI830->FbBase + pI830->OverlayMem->Start); - INT32 x1, y1, x2, y2; - INT32 loops = 0; - BoxRec dstBox; - - ErrorF("I830DisplaySurface\n"); - - if (pI830->entityPrivate) { - if (pI830->entityPrivate->XvInUse != -1 && - pI830->entityPrivate->XvInUse != pI830Priv->pipe) { + OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr; + ScrnInfoPtr pScrn = surface->pScrn; + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pI830Priv = GET_PORT_PRIVATE(pScrn); + INT32 x1, y1, x2, y2; + BoxRec dstBox; + xf86CrtcPtr crtc; + + OVERLAY_DEBUG("I830DisplaySurface\n"); + + if (pI830->entityPrivate) { + if (pI830->entityPrivate->XvInUse != -1 && + pI830->entityPrivate->XvInUse != i830_crtc_pipe (pI830Priv->current_crtc)) { #ifdef PANORAMIX - if (!noPanoramiXExtension) { - return Success; /* faked for trying to share it */ - } else + if (!noPanoramiXExtension) { + return Success; /* faked for trying to share it */ + } else #endif - { - return BadAlloc; - } - } - - pI830->entityPrivate->XvInUse = pI830Priv->pipe; - } - - x1 = src_x; - x2 = src_x + src_w; - y1 = src_y; - y2 = src_y + src_h; - - dstBox.x1 = drw_x; - dstBox.x2 = drw_x + drw_w; - dstBox.y1 = drw_y; - dstBox.y2 = drw_y + drw_h; - - if (!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, - surface->width, surface->height)) - return Success; - - /* fixup pointers */ - pI830Priv->YBuf0offset = surface->offsets[0]; - pI830Priv->YBuf1offset = pI830Priv->YBuf0offset; - - /* Make sure this buffer isn't in use */ - loops = 0; - if (*pI830->overlayOn && pI830Priv->doubleBuffer && (overlay->OCMD & OVERLAY_ENABLE)) { - while (loops < 1000000) { -#if USE_USLEEP_FOR_VIDEO - usleep(10); -#endif - if (((INREG(DOVSTA) & OC_BUF) >> 20) == pI830Priv->currentBuf) { - break; - } - loops++; - } - if (loops >= 1000000) { - ErrorF("loops (1) maxed out for buffer %d\n", pI830Priv->currentBuf); -#if 0 - pI830Priv->currentBuf = !pI830Priv->currentBuf; -#endif - } - - /* buffer swap */ - if (pI830Priv->currentBuf == 0) - pI830Priv->currentBuf = 1; - else - pI830Priv->currentBuf = 0; - } - - I830DisplayVideo(pScrn, surface->id, surface->width, surface->height, - surface->pitches[0], x1, y1, x2, y2, &dstBox, - src_w, src_h, drw_w, drw_h); - - xf86XVFillKeyHelper(pScreen, pI830Priv->colorKey, clipBoxes); - - pPriv->isOn = TRUE; - /* we've prempted the XvImage stream so set its free timer */ - if (pI830Priv->videoStatus & CLIENT_VIDEO_ON) { - REGION_EMPTY(pScrn->pScreen, &pI830Priv->clip); - UpdateCurrentTime(); - pI830Priv->videoStatus = FREE_TIMER; - pI830Priv->freeTime = currentTime.milliseconds + FREE_DELAY; - pScrn->pScreen->BlockHandler = I830BlockHandler; - } - - return Success; + { + return BadAlloc; + } + } + + pI830->entityPrivate->XvInUse = i830_crtc_pipe (pI830Priv->current_crtc); + } + + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if (!i830_clip_video_helper (pScrn, &crtc, &dstBox, + &x1, &x2, &y1, &y2, clipBoxes, + surface->width, surface->height)) + return Success; + + /* fixup pointers */ + pI830Priv->YBuf0offset = surface->offsets[0]; + pI830Priv->YBuf1offset = pI830Priv->YBuf0offset; + + /* Pick the idle buffer */ + if (!pI830Priv->textured && *pI830->overlayOn && pI830Priv->doubleBuffer) + pI830Priv->currentBuf = !((INREG(DOVSTA) & OC_BUF) >> 20); + + i830_display_video(pScrn, crtc, surface->id, surface->width, surface->height, + surface->pitches[0], x1, y1, x2, y2, &dstBox, + src_w, src_h, drw_w, drw_h); + + i830_fill_colorkey (pScreen, pI830Priv->colorKey, clipBoxes); + + pPriv->isOn = TRUE; + /* we've prempted the XvImage stream so set its free timer */ + if (pI830Priv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrn->pScreen, &pI830Priv->clip); + UpdateCurrentTime(); + pI830Priv->videoStatus = FREE_TIMER; + pI830Priv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + + return Success; } static void I830InitOffscreenImages(ScreenPtr pScreen) { - XF86OffscreenImagePtr offscreenImages; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - - /* need to free this someplace */ - if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) { - return; - } - - offscreenImages[0].image = &Images[0]; - offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES /*| VIDEO_CLIP_TO_VIEWPORT*/; - offscreenImages[0].alloc_surface = I830AllocateSurface; - offscreenImages[0].free_surface = I830FreeSurface; - offscreenImages[0].display = I830DisplaySurface; - offscreenImages[0].stop = I830StopSurface; - offscreenImages[0].setAttribute = I830SetSurfaceAttribute; - offscreenImages[0].getAttribute = I830GetSurfaceAttribute; - if (IS_845G(pI830) || IS_I830(pI830)) { - offscreenImages[0].max_width = IMAGE_MAX_WIDTH_LEGACY; - offscreenImages[0].max_height = IMAGE_MAX_HEIGHT_LEGACY; - } else { - offscreenImages[0].max_width = IMAGE_MAX_WIDTH; - offscreenImages[0].max_height = IMAGE_MAX_HEIGHT; - } - offscreenImages[0].num_attributes = 1; - offscreenImages[0].attributes = Attributes; - - xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); -} - -void -I830VideoSwitchModeBefore(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - I830Ptr pI830 = I830PTR(pScrn); - I830PortPrivPtr pPriv; - - if (!pI830->adaptor) { - return; - } - - pPriv = GET_PORT_PRIVATE(pScrn); - - if (!pPriv) { - xf86ErrorF("pPriv isn't set\n"); - return; - } - - /* We stop the video when mode switching, just so we don't lockup - * the engine. The overlayOK will determine whether we can re-enable - * with the current video on completion of the mode switch. - */ - I830StopVideo(pScrn, pPriv, TRUE); - - pPriv->overlayOK = FALSE; - - pPriv->oneLineMode = FALSE; + XF86OffscreenImagePtr offscreenImages; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + + /* need to free this someplace */ + if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) { + return; + } + + offscreenImages[0].image = &Images[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES /*| VIDEO_CLIP_TO_VIEWPORT*/; + offscreenImages[0].alloc_surface = I830AllocateSurface; + offscreenImages[0].free_surface = I830FreeSurface; + offscreenImages[0].display = I830DisplaySurface; + offscreenImages[0].stop = I830StopSurface; + offscreenImages[0].setAttribute = I830SetSurfaceAttribute; + offscreenImages[0].getAttribute = I830GetSurfaceAttribute; + if (IS_845G(pI830) || IS_I830(pI830)) { + offscreenImages[0].max_width = IMAGE_MAX_WIDTH_LEGACY; + offscreenImages[0].max_height = IMAGE_MAX_HEIGHT_LEGACY; + } else { + offscreenImages[0].max_width = IMAGE_MAX_WIDTH; + offscreenImages[0].max_height = IMAGE_MAX_HEIGHT; + } + offscreenImages[0].num_attributes = 1; + offscreenImages[0].attributes = Attributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); } void -I830VideoSwitchModeAfter(ScrnInfoPtr pScrn, DisplayModePtr mode) +i830_crtc_dpms_video(xf86CrtcPtr crtc, Bool on) { - I830Ptr pI830 = I830PTR(pScrn); - I830PortPrivPtr pPriv; - int size, hsize, vsize, active; - - if (!pI830->adaptor) { - return; - } - pPriv = GET_PORT_PRIVATE(pScrn); - if (!pPriv) - return; - - pPriv->overlayOK = TRUE; - - /* ensure pipe is updated on mode switch */ - if (!pI830->Clone) { - if (pPriv->pipe != pI830->pipe) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Changing XVideo pipe (%d to %d).\n", pPriv->pipe, pI830->pipe); - pPriv->pipe = pI830->pipe; - } - } - - if (!IS_I96X(pI830)) { - if (pPriv->pipe == 0) { - if (INREG(PIPEACONF) & PIPEACONF_DOUBLE_WIDE) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Disabling XVideo output because Pipe A is in double-wide mode.\n"); - pPriv->overlayOK = FALSE; - } else if (!pPriv->overlayOK) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Re-enabling XVideo output because Pipe A is now in single-wide mode.\n"); - pPriv->overlayOK = TRUE; - } - } - - if (pPriv->pipe == 1) { - if (INREG(PIPEBCONF) & PIPEBCONF_DOUBLE_WIDE) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Disabling XVideo output because Pipe B is in double-wide mode.\n"); - pPriv->overlayOK = FALSE; - } else if (!pPriv->overlayOK) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Re-enabling XVideo output because Pipe B is now in single-wide mode.\n"); - pPriv->overlayOK = TRUE; - } - } - } - - /* Check we have an LFP connected */ - if ((pPriv->pipe == 1 && pI830->operatingDevices & (PIPE_LFP << 8)) || - (pPriv->pipe == 0 && pI830->operatingDevices & PIPE_LFP) ) { - size = pPriv->pipe ? INREG(PIPEBSRC) : INREG(PIPEASRC); - hsize = (size >> 16) & 0x7FF; - vsize = size & 0x7FF; - active = pPriv->pipe ? (INREG(VTOTAL_B) & 0x7FF) : (INREG(VTOTAL_A) & 0x7FF); - - if (vsize < active && hsize > 1024) - I830SetOneLineModeRatio(pScrn); - - if (pPriv->scaleRatio & 0xFFFE0000) { - /* Possible bogus ratio, using in-accurate fallback */ - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Bogus panel fit register, Xvideo positioning may not be accurate.\n"); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Using fallback ratio - was 0x%x, now 0x%x\n", pPriv->scaleRatio, (int)(((float)active * 65536)/(float)vsize)); - - - pPriv->scaleRatio = (int)(((float)active * 65536) / (float)vsize); - } - } + ScrnInfoPtr pScrn = crtc->scrn; + I830Ptr pI830 = I830PTR(pScrn); + I830PortPrivPtr pPriv; + + if (pI830->adaptor == NULL) + return; + + /* No overlay scaler on the 965. */ + if (IS_I965G(pI830)) + return; + + pPriv = GET_PORT_PRIVATE(pScrn); + + if (crtc != pPriv->current_crtc) + return; + + /* Check if it's the crtc the overlay is off */ + if (!on) { + /* We stop the video when mode switching, so we don't lock up + * the engine. The overlayOK will determine whether we can re-enable + * with the current video on completion of the mode switch. + */ + I830StopVideo(pScrn, pPriv, TRUE); + pPriv->current_crtc = NULL; + pPriv->overlayOK = FALSE; + pPriv->oneLineMode = FALSE; + } } diff --git a/driver/xf86-video-intel/src/ivch/Makefile.in b/driver/xf86-video-intel/src/ivch/Makefile.in index 231d3d2c3..07f8cd95b 100644 --- a/driver/xf86-video-intel/src/ivch/Makefile.in +++ b/driver/xf86-video-intel/src/ivch/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 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. @@ -14,11 +14,15 @@ @SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ VPATH = @srcdir@ 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 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -38,7 +42,7 @@ 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 +mkinstalldirs = $(SHELL) $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -53,21 +57,17 @@ LTLIBRARIES = $(ivch_la_LTLIBRARIES) ivch_la_LIBADD = am_ivch_la_OBJECTS = ivch.lo ivch_module.lo ivch_la_OBJECTS = $(am_ivch_la_OBJECTS) -ivch_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ivch_la_LDFLAGS) \ - $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(ivch_la_SOURCES) DIST_SOURCES = $(ivch_la_SOURCES) ETAGS = etags @@ -76,6 +76,8 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ @@ -84,6 +86,10 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BUILD_LINUXDOC_FALSE = @BUILD_LINUXDOC_FALSE@ +BUILD_LINUXDOC_TRUE = @BUILD_LINUXDOC_TRUE@ +BUILD_PDFDOC_FALSE = @BUILD_PDFDOC_FALSE@ +BUILD_PDFDOC_TRUE = @BUILD_PDFDOC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -100,9 +106,11 @@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRIVER_NAME = @DRIVER_NAME@ DRI_CFLAGS = @DRI_CFLAGS@ +DRI_FALSE = @DRI_FALSE@ DRI_LIBS = @DRI_LIBS@ DRI_MM_CFLAGS = @DRI_MM_CFLAGS@ DRI_MM_LIBS = @DRI_MM_LIBS@ +DRI_TRUE = @DRI_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -113,14 +121,16 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -GREP = @GREP@ -INSTALL = @INSTALL@ +HAVE_GEN4ASM_FALSE = @HAVE_GEN4ASM_FALSE@ +HAVE_GEN4ASM_TRUE = @HAVE_GEN4ASM_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ +LIBPCIACCESS_FALSE = @LIBPCIACCESS_FALSE@ +LIBPCIACCESS_TRUE = @LIBPCIACCESS_TRUE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ @@ -129,6 +139,8 @@ LINUXDOC = @LINUXDOC@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MAKE_HTML = @MAKE_HTML@ MAKE_PDF = @MAKE_PDF@ @@ -136,7 +148,6 @@ MAKE_PS = @MAKE_PS@ MAKE_TEXT = @MAKE_TEXT@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ -MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -150,22 +161,31 @@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PS2PDF = @PS2PDF@ RANLIB = @RANLIB@ -SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +VIDEO_DEBUG_FALSE = @VIDEO_DEBUG_FALSE@ +VIDEO_DEBUG_TRUE = @VIDEO_DEBUG_TRUE@ WARN_CFLAGS = @WARN_CFLAGS@ XMODES_CFLAGS = @XMODES_CFLAGS@ +XMODES_FALSE = @XMODES_FALSE@ +XMODES_TRUE = @XMODES_TRUE@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ +XSERVER_LIBPCIACCESS_FALSE = @XSERVER_LIBPCIACCESS_FALSE@ +XSERVER_LIBPCIACCESS_TRUE = @XSERVER_LIBPCIACCESS_TRUE@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -177,11 +197,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -builddir = @builddir@ datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ exec_prefix = @exec_prefix@ gen4asm = @gen4asm@ host = @host@ @@ -189,29 +205,22 @@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ -htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ -localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ -psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ # this is obnoxious: # -module lets us name the module exactly how we want @@ -262,7 +271,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-ivch_laLTLIBRARIES: $(ivch_la_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(ivch_ladir)" || $(MKDIR_P) "$(DESTDIR)$(ivch_ladir)" + test -z "$(ivch_ladir)" || $(mkdir_p) "$(DESTDIR)$(ivch_ladir)" @list='$(ivch_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ @@ -273,7 +282,7 @@ install-ivch_laLTLIBRARIES: $(ivch_la_LTLIBRARIES) uninstall-ivch_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(ivch_la_LTLIBRARIES)'; for p in $$list; do \ + @set -x; list='$(ivch_la_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(ivch_ladir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(ivch_ladir)/$$p"; \ @@ -288,7 +297,7 @@ clean-ivch_laLTLIBRARIES: rm -f "$${dir}/so_locations"; \ done ivch.la: $(ivch_la_OBJECTS) $(ivch_la_DEPENDENCIES) - $(ivch_la_LINK) -rpath $(ivch_ladir) $(ivch_la_OBJECTS) $(ivch_la_LIBADD) $(LIBS) + $(LINK) -rpath $(ivch_ladir) $(ivch_la_LDFLAGS) $(ivch_la_OBJECTS) $(ivch_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -300,22 +309,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ivch_module.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< @@ -326,6 +335,10 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +distclean-libtool: + -rm -f libtool +uninstall-info-am: + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -375,21 +388,22 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -405,7 +419,7 @@ check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(ivch_ladir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -440,7 +454,7 @@ distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-libtool distclean-tags dvi: dvi-am @@ -454,20 +468,12 @@ info-am: install-data-am: install-ivch_laLTLIBRARIES -install-dvi: install-dvi-am - install-exec-am: -install-html: install-html-am - install-info: install-info-am install-man: -install-pdf: install-pdf-am - -install-ps: install-ps-am - installcheck-am: maintainer-clean: maintainer-clean-am @@ -488,23 +494,20 @@ ps: ps-am ps-am: -uninstall-am: uninstall-ivch_laLTLIBRARIES - -.MAKE: install-am install-strip +uninstall-am: uninstall-info-am uninstall-ivch_laLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-ivch_laLTLIBRARIES clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am \ - install-ivch_laLTLIBRARIES install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am \ + install-ivch_laLTLIBRARIES install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-ivch_laLTLIBRARIES + tags uninstall uninstall-am uninstall-info-am \ + uninstall-ivch_laLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/driver/xf86-video-intel/src/reg_dumper/Makefile.in b/driver/xf86-video-intel/src/reg_dumper/Makefile.in index 28cb5a31e..cc5c46fb1 100644 --- a/driver/xf86-video-intel/src/reg_dumper/Makefile.in +++ b/driver/xf86-video-intel/src/reg_dumper/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 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. @@ -14,11 +14,15 @@ @SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ VPATH = @srcdir@ 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 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -39,7 +43,7 @@ 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 +mkinstalldirs = $(SHELL) $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = PROGRAMS = $(noinst_PROGRAMS) @@ -49,21 +53,17 @@ am_intel_reg_dumper_OBJECTS = intel_reg_dumper-main.$(OBJEXT) \ intel_reg_dumper_OBJECTS = $(am_intel_reg_dumper_OBJECTS) am__DEPENDENCIES_1 = intel_reg_dumper_DEPENDENCIES = $(am__DEPENDENCIES_1) -intel_reg_dumper_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(intel_reg_dumper_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(intel_reg_dumper_SOURCES) DIST_SOURCES = $(intel_reg_dumper_SOURCES) ETAGS = etags @@ -72,6 +72,8 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ @@ -80,6 +82,10 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BUILD_LINUXDOC_FALSE = @BUILD_LINUXDOC_FALSE@ +BUILD_LINUXDOC_TRUE = @BUILD_LINUXDOC_TRUE@ +BUILD_PDFDOC_FALSE = @BUILD_PDFDOC_FALSE@ +BUILD_PDFDOC_TRUE = @BUILD_PDFDOC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -96,9 +102,11 @@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRIVER_NAME = @DRIVER_NAME@ DRI_CFLAGS = @DRI_CFLAGS@ +DRI_FALSE = @DRI_FALSE@ DRI_LIBS = @DRI_LIBS@ DRI_MM_CFLAGS = @DRI_MM_CFLAGS@ DRI_MM_LIBS = @DRI_MM_LIBS@ +DRI_TRUE = @DRI_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -109,14 +117,16 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -GREP = @GREP@ -INSTALL = @INSTALL@ +HAVE_GEN4ASM_FALSE = @HAVE_GEN4ASM_FALSE@ +HAVE_GEN4ASM_TRUE = @HAVE_GEN4ASM_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ +LIBPCIACCESS_FALSE = @LIBPCIACCESS_FALSE@ +LIBPCIACCESS_TRUE = @LIBPCIACCESS_TRUE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ @@ -125,6 +135,8 @@ LINUXDOC = @LINUXDOC@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MAKE_HTML = @MAKE_HTML@ MAKE_PDF = @MAKE_PDF@ @@ -132,7 +144,6 @@ MAKE_PS = @MAKE_PS@ MAKE_TEXT = @MAKE_TEXT@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ -MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -146,22 +157,31 @@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PS2PDF = @PS2PDF@ RANLIB = @RANLIB@ -SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +VIDEO_DEBUG_FALSE = @VIDEO_DEBUG_FALSE@ +VIDEO_DEBUG_TRUE = @VIDEO_DEBUG_TRUE@ WARN_CFLAGS = @WARN_CFLAGS@ XMODES_CFLAGS = @XMODES_CFLAGS@ +XMODES_FALSE = @XMODES_FALSE@ +XMODES_TRUE = @XMODES_TRUE@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ +XSERVER_LIBPCIACCESS_FALSE = @XSERVER_LIBPCIACCESS_FALSE@ +XSERVER_LIBPCIACCESS_TRUE = @XSERVER_LIBPCIACCESS_TRUE@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -173,11 +193,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -builddir = @builddir@ datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ exec_prefix = @exec_prefix@ gen4asm = @gen4asm@ host = @host@ @@ -185,29 +201,22 @@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ -htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ -localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ -psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ intel_reg_dumper_SOURCES = \ main.c \ reg_dumper.h \ @@ -260,7 +269,7 @@ clean-noinstPROGRAMS: done intel_reg_dumper$(EXEEXT): $(intel_reg_dumper_OBJECTS) $(intel_reg_dumper_DEPENDENCIES) @rm -f intel_reg_dumper$(EXEEXT) - $(intel_reg_dumper_LINK) $(intel_reg_dumper_OBJECTS) $(intel_reg_dumper_LDADD) $(LIBS) + $(LINK) $(intel_reg_dumper_LDFLAGS) $(intel_reg_dumper_OBJECTS) $(intel_reg_dumper_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -273,64 +282,64 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intel_reg_dumper-xprintf.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< intel_reg_dumper-main.o: main.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -MT intel_reg_dumper-main.o -MD -MP -MF $(DEPDIR)/intel_reg_dumper-main.Tpo -c -o intel_reg_dumper-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/intel_reg_dumper-main.Tpo $(DEPDIR)/intel_reg_dumper-main.Po +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -MT intel_reg_dumper-main.o -MD -MP -MF "$(DEPDIR)/intel_reg_dumper-main.Tpo" -c -o intel_reg_dumper-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/intel_reg_dumper-main.Tpo" "$(DEPDIR)/intel_reg_dumper-main.Po"; else rm -f "$(DEPDIR)/intel_reg_dumper-main.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='intel_reg_dumper-main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -c -o intel_reg_dumper-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c intel_reg_dumper-main.obj: main.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -MT intel_reg_dumper-main.obj -MD -MP -MF $(DEPDIR)/intel_reg_dumper-main.Tpo -c -o intel_reg_dumper-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/intel_reg_dumper-main.Tpo $(DEPDIR)/intel_reg_dumper-main.Po +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -MT intel_reg_dumper-main.obj -MD -MP -MF "$(DEPDIR)/intel_reg_dumper-main.Tpo" -c -o intel_reg_dumper-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/intel_reg_dumper-main.Tpo" "$(DEPDIR)/intel_reg_dumper-main.Po"; else rm -f "$(DEPDIR)/intel_reg_dumper-main.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='intel_reg_dumper-main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -c -o intel_reg_dumper-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` intel_reg_dumper-xprintf.o: xprintf.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -MT intel_reg_dumper-xprintf.o -MD -MP -MF $(DEPDIR)/intel_reg_dumper-xprintf.Tpo -c -o intel_reg_dumper-xprintf.o `test -f 'xprintf.c' || echo '$(srcdir)/'`xprintf.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/intel_reg_dumper-xprintf.Tpo $(DEPDIR)/intel_reg_dumper-xprintf.Po +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -MT intel_reg_dumper-xprintf.o -MD -MP -MF "$(DEPDIR)/intel_reg_dumper-xprintf.Tpo" -c -o intel_reg_dumper-xprintf.o `test -f 'xprintf.c' || echo '$(srcdir)/'`xprintf.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/intel_reg_dumper-xprintf.Tpo" "$(DEPDIR)/intel_reg_dumper-xprintf.Po"; else rm -f "$(DEPDIR)/intel_reg_dumper-xprintf.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xprintf.c' object='intel_reg_dumper-xprintf.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -c -o intel_reg_dumper-xprintf.o `test -f 'xprintf.c' || echo '$(srcdir)/'`xprintf.c intel_reg_dumper-xprintf.obj: xprintf.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -MT intel_reg_dumper-xprintf.obj -MD -MP -MF $(DEPDIR)/intel_reg_dumper-xprintf.Tpo -c -o intel_reg_dumper-xprintf.obj `if test -f 'xprintf.c'; then $(CYGPATH_W) 'xprintf.c'; else $(CYGPATH_W) '$(srcdir)/xprintf.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/intel_reg_dumper-xprintf.Tpo $(DEPDIR)/intel_reg_dumper-xprintf.Po +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -MT intel_reg_dumper-xprintf.obj -MD -MP -MF "$(DEPDIR)/intel_reg_dumper-xprintf.Tpo" -c -o intel_reg_dumper-xprintf.obj `if test -f 'xprintf.c'; then $(CYGPATH_W) 'xprintf.c'; else $(CYGPATH_W) '$(srcdir)/xprintf.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/intel_reg_dumper-xprintf.Tpo" "$(DEPDIR)/intel_reg_dumper-xprintf.Po"; else rm -f "$(DEPDIR)/intel_reg_dumper-xprintf.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xprintf.c' object='intel_reg_dumper-xprintf.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -c -o intel_reg_dumper-xprintf.obj `if test -f 'xprintf.c'; then $(CYGPATH_W) 'xprintf.c'; else $(CYGPATH_W) '$(srcdir)/xprintf.c'; fi` intel_reg_dumper-i830_debug.o: ../i830_debug.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -MT intel_reg_dumper-i830_debug.o -MD -MP -MF $(DEPDIR)/intel_reg_dumper-i830_debug.Tpo -c -o intel_reg_dumper-i830_debug.o `test -f '../i830_debug.c' || echo '$(srcdir)/'`../i830_debug.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/intel_reg_dumper-i830_debug.Tpo $(DEPDIR)/intel_reg_dumper-i830_debug.Po +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -MT intel_reg_dumper-i830_debug.o -MD -MP -MF "$(DEPDIR)/intel_reg_dumper-i830_debug.Tpo" -c -o intel_reg_dumper-i830_debug.o `test -f '../i830_debug.c' || echo '$(srcdir)/'`../i830_debug.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/intel_reg_dumper-i830_debug.Tpo" "$(DEPDIR)/intel_reg_dumper-i830_debug.Po"; else rm -f "$(DEPDIR)/intel_reg_dumper-i830_debug.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../i830_debug.c' object='intel_reg_dumper-i830_debug.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -c -o intel_reg_dumper-i830_debug.o `test -f '../i830_debug.c' || echo '$(srcdir)/'`../i830_debug.c intel_reg_dumper-i830_debug.obj: ../i830_debug.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -MT intel_reg_dumper-i830_debug.obj -MD -MP -MF $(DEPDIR)/intel_reg_dumper-i830_debug.Tpo -c -o intel_reg_dumper-i830_debug.obj `if test -f '../i830_debug.c'; then $(CYGPATH_W) '../i830_debug.c'; else $(CYGPATH_W) '$(srcdir)/../i830_debug.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/intel_reg_dumper-i830_debug.Tpo $(DEPDIR)/intel_reg_dumper-i830_debug.Po +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -MT intel_reg_dumper-i830_debug.obj -MD -MP -MF "$(DEPDIR)/intel_reg_dumper-i830_debug.Tpo" -c -o intel_reg_dumper-i830_debug.obj `if test -f '../i830_debug.c'; then $(CYGPATH_W) '../i830_debug.c'; else $(CYGPATH_W) '$(srcdir)/../i830_debug.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/intel_reg_dumper-i830_debug.Tpo" "$(DEPDIR)/intel_reg_dumper-i830_debug.Po"; else rm -f "$(DEPDIR)/intel_reg_dumper-i830_debug.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../i830_debug.c' object='intel_reg_dumper-i830_debug.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(intel_reg_dumper_CFLAGS) $(CFLAGS) -c -o intel_reg_dumper-i830_debug.obj `if test -f '../i830_debug.c'; then $(CYGPATH_W) '../i830_debug.c'; else $(CYGPATH_W) '$(srcdir)/../i830_debug.c'; fi` @@ -341,6 +350,10 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +distclean-libtool: + -rm -f libtool +uninstall-info-am: + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -390,21 +403,22 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -452,7 +466,7 @@ distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-libtool distclean-tags dvi: dvi-am @@ -466,20 +480,12 @@ info-am: install-data-am: -install-dvi: install-dvi-am - install-exec-am: -install-html: install-html-am - install-info: install-info-am install-man: -install-pdf: install-pdf-am - -install-ps: install-ps-am - installcheck-am: maintainer-clean: maintainer-clean-am @@ -500,22 +506,19 @@ ps: ps-am ps-am: -uninstall-am: - -.MAKE: install-am install-strip +uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/driver/xf86-video-intel/src/sil164/Makefile.in b/driver/xf86-video-intel/src/sil164/Makefile.in index 2ebdc98ce..4b628819a 100644 --- a/driver/xf86-video-intel/src/sil164/Makefile.in +++ b/driver/xf86-video-intel/src/sil164/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 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. @@ -14,11 +14,15 @@ @SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ VPATH = @srcdir@ 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 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -38,7 +42,7 @@ 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 +mkinstalldirs = $(SHELL) $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -53,21 +57,17 @@ LTLIBRARIES = $(sil164_la_LTLIBRARIES) sil164_la_LIBADD = am_sil164_la_OBJECTS = sil164.lo sil164_module.lo sil164_la_OBJECTS = $(am_sil164_la_OBJECTS) -sil164_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(sil164_la_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(sil164_la_SOURCES) DIST_SOURCES = $(sil164_la_SOURCES) ETAGS = etags @@ -76,6 +76,8 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ @@ -84,6 +86,10 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BUILD_LINUXDOC_FALSE = @BUILD_LINUXDOC_FALSE@ +BUILD_LINUXDOC_TRUE = @BUILD_LINUXDOC_TRUE@ +BUILD_PDFDOC_FALSE = @BUILD_PDFDOC_FALSE@ +BUILD_PDFDOC_TRUE = @BUILD_PDFDOC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -100,9 +106,11 @@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRIVER_NAME = @DRIVER_NAME@ DRI_CFLAGS = @DRI_CFLAGS@ +DRI_FALSE = @DRI_FALSE@ DRI_LIBS = @DRI_LIBS@ DRI_MM_CFLAGS = @DRI_MM_CFLAGS@ DRI_MM_LIBS = @DRI_MM_LIBS@ +DRI_TRUE = @DRI_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -113,14 +121,16 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -GREP = @GREP@ -INSTALL = @INSTALL@ +HAVE_GEN4ASM_FALSE = @HAVE_GEN4ASM_FALSE@ +HAVE_GEN4ASM_TRUE = @HAVE_GEN4ASM_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ +LIBPCIACCESS_FALSE = @LIBPCIACCESS_FALSE@ +LIBPCIACCESS_TRUE = @LIBPCIACCESS_TRUE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ @@ -129,6 +139,8 @@ LINUXDOC = @LINUXDOC@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MAKE_HTML = @MAKE_HTML@ MAKE_PDF = @MAKE_PDF@ @@ -136,7 +148,6 @@ MAKE_PS = @MAKE_PS@ MAKE_TEXT = @MAKE_TEXT@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ -MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -150,22 +161,31 @@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PS2PDF = @PS2PDF@ RANLIB = @RANLIB@ -SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +VIDEO_DEBUG_FALSE = @VIDEO_DEBUG_FALSE@ +VIDEO_DEBUG_TRUE = @VIDEO_DEBUG_TRUE@ WARN_CFLAGS = @WARN_CFLAGS@ XMODES_CFLAGS = @XMODES_CFLAGS@ +XMODES_FALSE = @XMODES_FALSE@ +XMODES_TRUE = @XMODES_TRUE@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ +XSERVER_LIBPCIACCESS_FALSE = @XSERVER_LIBPCIACCESS_FALSE@ +XSERVER_LIBPCIACCESS_TRUE = @XSERVER_LIBPCIACCESS_TRUE@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -177,11 +197,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -builddir = @builddir@ datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ exec_prefix = @exec_prefix@ gen4asm = @gen4asm@ host = @host@ @@ -189,29 +205,22 @@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ -htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ -localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ -psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ # this is obnoxious: # -module lets us name the module exactly how we want @@ -263,7 +272,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-sil164_laLTLIBRARIES: $(sil164_la_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(sil164_ladir)" || $(MKDIR_P) "$(DESTDIR)$(sil164_ladir)" + test -z "$(sil164_ladir)" || $(mkdir_p) "$(DESTDIR)$(sil164_ladir)" @list='$(sil164_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ @@ -274,7 +283,7 @@ install-sil164_laLTLIBRARIES: $(sil164_la_LTLIBRARIES) uninstall-sil164_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(sil164_la_LTLIBRARIES)'; for p in $$list; do \ + @set -x; list='$(sil164_la_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(sil164_ladir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(sil164_ladir)/$$p"; \ @@ -289,7 +298,7 @@ clean-sil164_laLTLIBRARIES: rm -f "$${dir}/so_locations"; \ done sil164.la: $(sil164_la_OBJECTS) $(sil164_la_DEPENDENCIES) - $(sil164_la_LINK) -rpath $(sil164_ladir) $(sil164_la_OBJECTS) $(sil164_la_LIBADD) $(LIBS) + $(LINK) -rpath $(sil164_ladir) $(sil164_la_LDFLAGS) $(sil164_la_OBJECTS) $(sil164_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -301,22 +310,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sil164_module.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< @@ -327,6 +336,10 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +distclean-libtool: + -rm -f libtool +uninstall-info-am: + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -376,21 +389,22 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -406,7 +420,7 @@ check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(sil164_ladir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -441,7 +455,7 @@ distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-libtool distclean-tags dvi: dvi-am @@ -455,20 +469,12 @@ info-am: install-data-am: install-sil164_laLTLIBRARIES -install-dvi: install-dvi-am - install-exec-am: -install-html: install-html-am - install-info: install-info-am install-man: -install-pdf: install-pdf-am - -install-ps: install-ps-am - installcheck-am: maintainer-clean: maintainer-clean-am @@ -489,23 +495,20 @@ ps: ps-am ps-am: -uninstall-am: uninstall-sil164_laLTLIBRARIES - -.MAKE: install-am install-strip +uninstall-am: uninstall-info-am uninstall-sil164_laLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-sil164_laLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ install-sil164_laLTLIBRARIES install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-sil164_laLTLIBRARIES + tags uninstall uninstall-am uninstall-info-am \ + uninstall-sil164_laLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/driver/xf86-video-intel/src/tfp410/Makefile.in b/driver/xf86-video-intel/src/tfp410/Makefile.in index 92b935a4c..41f20e6f6 100644 --- a/driver/xf86-video-intel/src/tfp410/Makefile.in +++ b/driver/xf86-video-intel/src/tfp410/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 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. @@ -14,11 +14,15 @@ @SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ VPATH = @srcdir@ 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 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -38,7 +42,7 @@ 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 +mkinstalldirs = $(SHELL) $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -53,21 +57,17 @@ LTLIBRARIES = $(tfp410_la_LTLIBRARIES) tfp410_la_LIBADD = am_tfp410_la_OBJECTS = tfp410.lo tfp410_module.lo tfp410_la_OBJECTS = $(am_tfp410_la_OBJECTS) -tfp410_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(tfp410_la_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(tfp410_la_SOURCES) DIST_SOURCES = $(tfp410_la_SOURCES) ETAGS = etags @@ -76,6 +76,8 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ @@ -84,6 +86,10 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BUILD_LINUXDOC_FALSE = @BUILD_LINUXDOC_FALSE@ +BUILD_LINUXDOC_TRUE = @BUILD_LINUXDOC_TRUE@ +BUILD_PDFDOC_FALSE = @BUILD_PDFDOC_FALSE@ +BUILD_PDFDOC_TRUE = @BUILD_PDFDOC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -100,9 +106,11 @@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRIVER_NAME = @DRIVER_NAME@ DRI_CFLAGS = @DRI_CFLAGS@ +DRI_FALSE = @DRI_FALSE@ DRI_LIBS = @DRI_LIBS@ DRI_MM_CFLAGS = @DRI_MM_CFLAGS@ DRI_MM_LIBS = @DRI_MM_LIBS@ +DRI_TRUE = @DRI_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -113,14 +121,16 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -GREP = @GREP@ -INSTALL = @INSTALL@ +HAVE_GEN4ASM_FALSE = @HAVE_GEN4ASM_FALSE@ +HAVE_GEN4ASM_TRUE = @HAVE_GEN4ASM_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ +LIBPCIACCESS_FALSE = @LIBPCIACCESS_FALSE@ +LIBPCIACCESS_TRUE = @LIBPCIACCESS_TRUE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ @@ -129,6 +139,8 @@ LINUXDOC = @LINUXDOC@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MAKE_HTML = @MAKE_HTML@ MAKE_PDF = @MAKE_PDF@ @@ -136,7 +148,6 @@ MAKE_PS = @MAKE_PS@ MAKE_TEXT = @MAKE_TEXT@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ -MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -150,22 +161,31 @@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PS2PDF = @PS2PDF@ RANLIB = @RANLIB@ -SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +VIDEO_DEBUG_FALSE = @VIDEO_DEBUG_FALSE@ +VIDEO_DEBUG_TRUE = @VIDEO_DEBUG_TRUE@ WARN_CFLAGS = @WARN_CFLAGS@ XMODES_CFLAGS = @XMODES_CFLAGS@ +XMODES_FALSE = @XMODES_FALSE@ +XMODES_TRUE = @XMODES_TRUE@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ +XSERVER_LIBPCIACCESS_FALSE = @XSERVER_LIBPCIACCESS_FALSE@ +XSERVER_LIBPCIACCESS_TRUE = @XSERVER_LIBPCIACCESS_TRUE@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -177,11 +197,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -builddir = @builddir@ datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ exec_prefix = @exec_prefix@ gen4asm = @gen4asm@ host = @host@ @@ -189,29 +205,22 @@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ -htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ -localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ -psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ # this is obnoxious: # -module lets us name the module exactly how we want @@ -263,7 +272,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-tfp410_laLTLIBRARIES: $(tfp410_la_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(tfp410_ladir)" || $(MKDIR_P) "$(DESTDIR)$(tfp410_ladir)" + test -z "$(tfp410_ladir)" || $(mkdir_p) "$(DESTDIR)$(tfp410_ladir)" @list='$(tfp410_la_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ @@ -274,7 +283,7 @@ install-tfp410_laLTLIBRARIES: $(tfp410_la_LTLIBRARIES) uninstall-tfp410_laLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(tfp410_la_LTLIBRARIES)'; for p in $$list; do \ + @set -x; list='$(tfp410_la_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(tfp410_ladir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(tfp410_ladir)/$$p"; \ @@ -289,7 +298,7 @@ clean-tfp410_laLTLIBRARIES: rm -f "$${dir}/so_locations"; \ done tfp410.la: $(tfp410_la_OBJECTS) $(tfp410_la_DEPENDENCIES) - $(tfp410_la_LINK) -rpath $(tfp410_ladir) $(tfp410_la_OBJECTS) $(tfp410_la_LIBADD) $(LIBS) + $(LINK) -rpath $(tfp410_ladir) $(tfp410_la_LDFLAGS) $(tfp410_la_OBJECTS) $(tfp410_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -301,22 +310,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfp410_module.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@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@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< @@ -327,6 +336,10 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +distclean-libtool: + -rm -f libtool +uninstall-info-am: + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -376,21 +389,22 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -406,7 +420,7 @@ check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(tfp410_ladir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -441,7 +455,7 @@ distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-libtool distclean-tags dvi: dvi-am @@ -455,20 +469,12 @@ info-am: install-data-am: install-tfp410_laLTLIBRARIES -install-dvi: install-dvi-am - install-exec-am: -install-html: install-html-am - install-info: install-info-am install-man: -install-pdf: install-pdf-am - -install-ps: install-ps-am - installcheck-am: maintainer-clean: maintainer-clean-am @@ -489,23 +495,20 @@ ps: ps-am ps-am: -uninstall-am: uninstall-tfp410_laLTLIBRARIES - -.MAKE: install-am install-strip +uninstall-am: uninstall-info-am uninstall-tfp410_laLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-tfp410_laLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ install-strip install-tfp410_laLTLIBRARIES installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-tfp410_laLTLIBRARIES + tags uninstall uninstall-am uninstall-info-am \ + uninstall-tfp410_laLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/driver/xf86-video-intel/src/xvmc/Makefile.in b/driver/xf86-video-intel/src/xvmc/Makefile.in index e3f0728ad..6e4db51e7 100644 --- a/driver/xf86-video-intel/src/xvmc/Makefile.in +++ b/driver/xf86-video-intel/src/xvmc/Makefile.in @@ -54,7 +54,7 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) -libI810XvMC_la_LIBADD = +libI810XvMC_la_DEPENDENCIES = am__libI810XvMC_la_SOURCES_DIST = I810XvMC.c I810XvMC.h @DRI_TRUE@am_libI810XvMC_la_OBJECTS = libI810XvMC_la-I810XvMC.lo libI810XvMC_la_OBJECTS = $(am_libI810XvMC_la_OBJECTS) @@ -110,6 +110,8 @@ DRIVER_NAME = @DRIVER_NAME@ DRI_CFLAGS = @DRI_CFLAGS@ DRI_FALSE = @DRI_FALSE@ DRI_LIBS = @DRI_LIBS@ +DRI_MM_CFLAGS = @DRI_MM_CFLAGS@ +DRI_MM_LIBS = @DRI_MM_LIBS@ DRI_TRUE = @DRI_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ @@ -129,6 +131,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ +LIBPCIACCESS_FALSE = @LIBPCIACCESS_FALSE@ +LIBPCIACCESS_TRUE = @LIBPCIACCESS_TRUE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ @@ -154,6 +158,8 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PS2PDF = @PS2PDF@ RANLIB = @RANLIB@ @@ -163,8 +169,14 @@ STRIP = @STRIP@ VERSION = @VERSION@ VIDEO_DEBUG_FALSE = @VIDEO_DEBUG_FALSE@ VIDEO_DEBUG_TRUE = @VIDEO_DEBUG_TRUE@ +WARN_CFLAGS = @WARN_CFLAGS@ +XMODES_CFLAGS = @XMODES_CFLAGS@ +XMODES_FALSE = @XMODES_FALSE@ +XMODES_TRUE = @XMODES_TRUE@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ +XSERVER_LIBPCIACCESS_FALSE = @XSERVER_LIBPCIACCESS_FALSE@ +XSERVER_LIBPCIACCESS_TRUE = @XSERVER_LIBPCIACCESS_TRUE@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ @@ -215,8 +227,11 @@ target_alias = @target_alias@ @DRI_TRUE@libI810XvMC_la_SOURCES = I810XvMC.c \ @DRI_TRUE@ I810XvMC.h -@DRI_TRUE@libI810XvMC_la_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ -I$(top_srcdir)/src -DTRUE=1 -DFALSE=0 +@DRI_TRUE@libI810XvMC_la_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \ +@DRI_TRUE@ -I$(top_srcdir)/src -DTRUE=1 -DFALSE=0 + @DRI_TRUE@libI810XvMC_la_LDFLAGS = -version-number 1:0:0 +@DRI_TRUE@libI810XvMC_la_LIBADD = @DRI_LIBS@ all: all-am .SUFFIXES: |