summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZou Nan hai <nanhai.zou@intel.com>2009-05-18 17:11:28 +0800
committerZou Nan hai <nanhai.zou@intel.com>2009-05-18 17:11:28 +0800
commit50c10ededba15dd0c118f1b65756362061491090 (patch)
treeafc01093ef9c472e9c0b0f0630635486058a95c3
parent13c730e003e805e19deee0996b2af30f69e54c4d (diff)
parent87332a7cc16af82aa47e07fbf90da3635b071dbf (diff)
Merge branch 'master' into xvmc-vld
-rw-r--r--AUTHORS63
-rw-r--r--Makefile.am4
-rw-r--r--NEWS156
-rw-r--r--README125
-rw-r--r--RELEASING51
-rw-r--r--configure.ac112
-rw-r--r--man/intel.man27
-rw-r--r--src/Makefile.am34
-rw-r--r--src/bios_reader/Makefile.am5
-rw-r--r--src/bios_reader/bios_reader.c4
-rw-r--r--src/ch7017/Makefile.am2
-rw-r--r--src/ch7xxx/Makefile.am2
-rw-r--r--src/common.h26
-rw-r--r--src/drmmode_display.c61
-rw-r--r--src/i2c_vid.h4
-rw-r--r--src/i810.h8
-rw-r--r--src/i810_accel.c14
-rw-r--r--src/i810_common.h1
-rw-r--r--src/i810_cursor.c14
-rw-r--r--src/i810_dga.c14
-rw-r--r--src/i810_dri.c29
-rw-r--r--src/i810_dri.h1
-rw-r--r--src/i810_driver.c259
-rw-r--r--src/i810_hwmc.c1
-rw-r--r--src/i810_io.c14
-rw-r--r--src/i810_memory.c14
-rw-r--r--src/i810_reg.h63
-rw-r--r--src/i810_video.c1
-rw-r--r--src/i810_wmark.c15
-rw-r--r--src/i830.h189
-rw-r--r--src/i830_accel.c154
-rw-r--r--src/i830_batchbuffer.c33
-rw-r--r--src/i830_batchbuffer.h16
-rw-r--r--src/i830_bios.c23
-rw-r--r--src/i830_common.h1
-rw-r--r--src/i830_cursor.c35
-rw-r--r--src/i830_debug.c10
-rw-r--r--src/i830_display.c98
-rw-r--r--src/i830_display.h2
-rw-r--r--src/i830_dri.c1633
-rw-r--r--src/i830_dri.h1
-rw-r--r--src/i830_driver.c904
-rw-r--r--src/i830_dvo.c4
-rw-r--r--src/i830_exa.c499
-rw-r--r--src/i830_hdmi.c90
-rw-r--r--src/i830_hwmc.c2
-rw-r--r--src/i830_hwmc.h1
-rw-r--r--src/i830_lvds.c23
-rw-r--r--src/i830_memory.c458
-rw-r--r--src/i830_quirks.c17
-rw-r--r--src/i830_render.c12
-rw-r--r--src/i830_sdvo.c126
-rw-r--r--src/i830_sdvo.h6
-rw-r--r--src/i830_video.c110
-rw-r--r--src/i830_xaa.c829
-rw-r--r--src/i915_render.c2
-rw-r--r--src/i915_video.c20
-rw-r--r--src/i965_render.c72
-rw-r--r--src/i965_video.c25
-rw-r--r--src/ivch/Makefile.am2
-rw-r--r--src/local_xf86Rename.h23
-rw-r--r--src/reg_dumper/.gitignore1
-rw-r--r--src/reg_dumper/gtt.c8
-rw-r--r--src/reg_dumper/hotplug.c5
-rw-r--r--src/reg_dumper/idle.c5
-rw-r--r--src/reg_dumper/main.c6
-rw-r--r--src/reg_dumper/reg_dumper.h9
-rw-r--r--src/reg_dumper/util.c5
-rw-r--r--src/sil164/Makefile.am2
-rw-r--r--src/tfp410/Makefile.am2
-rw-r--r--src/xvmc/I810XvMC.c1
-rw-r--r--src/xvmc/I810XvMC.h1
-rw-r--r--src/xvmc/xf86dri.c1
-rw-r--r--src/xvmc/xf86dri.h1
-rw-r--r--src/xvmc/xf86dristr.h1
-rw-r--r--uxa/uxa-accel.c63
-rw-r--r--uxa/uxa-glyphs.c4
-rw-r--r--uxa/uxa-priv.h18
-rw-r--r--uxa/uxa-render.c5
-rw-r--r--uxa/uxa-unaccel.c18
-rw-r--r--uxa/uxa.c29
81 files changed, 1243 insertions, 5486 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 00000000..9f1a589f
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,63 @@
+Authors of xf86-video-intel (since 2003-11-14 when revision-control
+history begins, sorted roughly by number of commits, descending):
+
+Eric Anholt
+Keith Packard
+Zhenyu Wang
+Jesse Barnes
+Alan Hourihane
+Carl Worth
+Dave Airlie
+Michel Dänzer
+Zou Nan Hai
+Kristian Høgsberg
+Adam Jackson
+Nian Wu
+Xian, Haihao
+Egbert Eich
+Kevin E Martin
+Alan Coopersmith
+Hong Liu
+Julien Cristau
+Ma Ling
+Bryce Harrington
+Daniel Stone
+Robert Lowery
+Kaleb Keithley
+Paulo Cesar Pereira de Andrade
+Eamon Walsh
+Matthieu Herrb
+Owain G. Ainsworth
+Søren Sandmann Pedersen
+Brice Goglin
+Ian Romanick
+Lukáš Hejtmánek
+Matthias Hopf
+Olivier Fourdan
+Robert Noland
+Rémi Cardona
+Shuang He
+Wu Fengguang
+and many others (with 1 or 2 commits)
+
+Other authors (from before revision-control history begins):
+
+Keith Whitwell
+Jonathan Bian
+Matthew J Sottek
+Jeff Hartmann
+Mark Vojkovich
+H. J. Lu
+David Dawes
+
+If the above list is missing anyone, please accept our apologies and
+let us know.
+
+The X.Org version of this driver is maintained by Intel Corporation:
+
+ http://www.intellinuxgraphics.org
+
+The X11R6 version of this driver originally came from XFree86 4.4 rc2.
+
+The XFree86 version of this driver was donated to The XFree86 Project
+by Precision Insight, Inc.; Cedar Park, TX; USA
diff --git a/Makefile.am b/Makefile.am
index 45b0c423..10653ff7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,5 +23,5 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = uxa src man
-EXTRA_DIST = README
-DISTCLEANFILES = doltcompile
+EXTRA_DIST = README AUTHORS NEWS
+DISTCLEANFILES = doltcompile doltlibtool
diff --git a/NEWS b/NEWS
new file mode 100644
index 00000000..5787be30
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,156 @@
+Snapshot 2.7.99.1 (2009-04-28)
+------------------------------
+This is a development snapshot very early in the process toward
+developing 2.8. There have been some big changes to the code, and
+we're anxious to get feedback on these changes as early as possible.
+
+Here is a summary of the biggest changes:
+
+ * Driver now depends on X server 1.6 or later
+
+ * Eliminate XAA and EXA support (in favor of UXA)
+
+ * Eliminate DRI1 support
+
+ * Fixes for running without DRI at all
+
+These code removals represent a deletion of a substantial amount of
+code, (and hopefully piles of bugs), as well as reduce the maintenance
+effort going forward as the number of combinatorial configurations for
+the driver are greatly reduced. This means that users are much more
+likely to be running code that has actually been tested, and it will
+be much easy for developers to replicate bugs that users experience.
+
+One of the things that would be most useful in testing this release is
+to revisit any outstanding bugs that you have previously reported. If
+the buggy behavior is gone, (or the bug is no longer relevant---such
+as a bug that's specific to XAA only), please feel free to indicate so
+in bugzilla or even just close the bug.
+
+If you confirm that the bug is still present, please indicate so in
+the bug report. (I was going to ask that you select a 1.7.99 version,
+but it looks like bugzilla only has versions for products not
+compoenents, while we use a "xorg" product and a "driver/intel"
+component.) We definitely want to make any such confirmed bugs a
+priority, so it would be nice to have a consistent mechanism to search
+for these bugs. Suggestions are welcome on the best approach.
+
+Thanks in advance for any testing or feedback on this snapshot.
+
+Release 2.7.0 (2009-04-15)
+--------------------------
+Compared to the 2.6 series, 2.7.0 has a large number of bug fixes, but
+also a few significant features, such as:
+
+ SDVO-TV support, available on ADD2 card (bug#9992) and
+ D945GCLF2 board (bug#17776).
+
+ Basic SDVO-LVDS support
+
+ XV video display without tearing
+ [Though this isn't working for all users yet, see
+ https://bugs.freedesktop.org/show_bug.cgi?id=21076 ]
+
+ Various fixes for UXA, DRI2, and Kernel modesetting.
+
+We encourage users to use kernel modesetting and UXA acceleration with
+this release, which should give the best performance and
+robustness. When KMS is available, UXA is the default acceleration
+used by the driver, (EXA is the default otherwise).
+
+Known issue:
+
+ Some Linux kernel versions (such as 2.6.29) are known to have
+ broken PAT code that causes recent versions of this driver to
+ fail, (which can manifest as the X server simply not
+ starting). This can be verified by adding the "nopat" option
+ to the kernel command-line and seeing the failure go away. We
+ hope that newer kernels in the 2.6.29.x as well as 2.6.30 and
+ above will have working PAT code.
+
+Some of the most notable bugs fixed in 2.7.0 include:
+
+ [GM45 965GM] bad htotal causes panel startup failure
+ https://bugs.freedesktop.org/show_bug.cgi?id=17292
+
+ [xrandr TV] need TV output property control
+ https://bugs.freedesktop.org/show_bug.cgi?id=12763
+
+ [TV] "xrandr --set TV_FORMAT" gets BadMatch error
+ https://bugs.freedesktop.org/show_bug.cgi?id=16566
+
+ [945 tiling] Low performance due to no A17 workaround
+ https://bugs.freedesktop.org/show_bug.cgi?id=16835
+
+ [TV]Flicker when launching applications in the 2.4-branch
+ https://bugs.freedesktop.org/show_bug.cgi?id=17405
+
+ [945GM FBC] FBC causes underruns & flicker
+ https://bugs.freedesktop.org/show_bug.cgi?id=18651
+
+ [xv] Textured video suffers from tearing
+ https://bugs.freedesktop.org/show_bug.cgi?id=19635
+
+ [G45] Random hangs with UXA
+ https://bugs.freedesktop.org/show_bug.cgi?id=19734
+
+ [945GM] Any 3D app is slow in resolution higher than 800x600
+ with UXA+DRI2, due to tiling
+ https://bugs.freedesktop.org/show_bug.cgi?id=19738
+
+ [i915 UXA,EXA] rotation messes display with tiling on
+ https://bugs.freedesktop.org/show_bug.cgi?id=20265
+
+ [G45] DRI2/UXA gives solid white instead of transparency
+ https://bugs.freedesktop.org/show_bug.cgi?id=20321
+
+ LVDS output not detected
+ https://bugs.freedesktop.org/show_bug.cgi?id=20517
+
+ xf86-video-intel-2.6.3: Xv crashes X server
+ https://bugs.freedesktop.org/show_bug.cgi?id=20525
+
+ [G965 non-GEM] systray in KDE 4 completely broken
+ https://bugs.freedesktop.org/show_bug.cgi?id=20527
+
+ [SDVO-TV]the desktop is teared in four sections on the screen
+ https://bugs.freedesktop.org/show_bug.cgi?id=20550
+
+ Intel video driver 2.6.3 crashes with XVideo
+ https://bugs.freedesktop.org/show_bug.cgi?id=20563
+
+ [855GM] Xv crash with non-KMS
+ https://bugs.freedesktop.org/show_bug.cgi?id=20585
+
+ 2.6.99.902 breaks native 1680x1050 mode on TMDS -- EDID miss
+ https://bugs.freedesktop.org/show_bug.cgi?id=20594
+
+ [945GM TV] 2.6.99.902 sets a too high CONTRAST-value
+ https://bugs.freedesktop.org/show_bug.cgi?id=20670
+
+ [915GM] fail to detect LVDS with new VBT code
+ https://bugs.freedesktop.org/show_bug.cgi?id=20752
+
+ [regression i965]tiled output when start X
+ https://bugs.freedesktop.org/show_bug.cgi?id=20803
+
+ 2.6.99.902: LVDS wrongly detected as disconnected
+ https://bugs.freedesktop.org/show_bug.cgi?id=20826
+
+ vt switching fails and crashes X
+ https://bugs.freedesktop.org/show_bug.cgi?id=20863
+
+ [HDMI] The screen will flicker when some application runs on
+ G45-64
+ https://bugs.freedesktop.org/show_bug.cgi?id=20875
+
+ TexturedVideo is offsetted wrongly on dualhead
+ https://bugs.freedesktop.org/show_bug.cgi?id=20980
+
+ [EXA] xvideo hang X
+ https://bugs.freedesktop.org/show_bug.cgi?id=21027
+
+ [EXA] x11perf performance regression
+ https://bugs.freedesktop.org/show_bug.cgi?id=21029
+
+ And many others...
diff --git a/README b/README
index c91c6614..8b0998f7 100644
--- a/README
+++ b/README
@@ -1,106 +1,47 @@
-Information for Intel graphics driver users
-Eric Anholt
-2007-07-02
+xf86-video-intel
+Open-source X.org graphics driver for Intel graphics
+http://www.intellinuxgraphics.com/
-This document provides a brief summary of the Intel graphics support provided
-by the xf86-video-intel driver. More information can also be found in the
-intel(4) manual page.
+What is xf86-video-intel
+------------------------
+The xf86-video-intel module is an open-source 2D graphics driver for
+the X Window System as implemented by X.org. It supports a variety of
+Intel graphics chipsets including:
-Supported Hardware:
- i810,
- i810-dc100,
- i810e
- i815
- i830
- i845
- i852
- i855
- 915G
- 915GM
- 945G
- 945GM/GME
- 946GZ
- G965
- GM/GME965
- G33/Q33/Q35
+ i810/i810e/i810-dc100,i815,
+ i830M,845G,852GM,855GM,865G,
+ 915G/GM,945G/GM/GME,946GZ
+ G/GM/GME/Q965,
+ G/Q33,G/Q35,G41,G/Q43,G/GM/Q45
-Features
-- Full support for 8, 15, 16, and 24 bit pixel depths.
-- Hardware accelerated 2D drawing engine support for 8, 15, 16 and 24 bit
- pixel depths.
-- Hardware accelerated 3D drawing using OpenGL and the DRI.
-- Hardware cursor support to reduce sprite flicker.
-- Textured video XV implementation on i915 through i965.
-- Hardware overlay XV implementation up through i945.
-- Screen resize and rotation.
+Where to get more information about the driver
+----------------------------------------------
+The primary source of information about this and other open-source
+drivers for Intel graphics is:
-Technical Notes
-- Interlace modes cannot be supported.
-- This driver requires kernel support for AGP, which is included in Linux
- kernels 2.3.42 and higher, and FreeBSD 4.1 and higher.
-- This driver may be built against xserver 1.2.0 or newer. If built
- from git source against an older server, a copy of xserver 1.3.0 source is
- needed to complete the build, which is chosen with the --with-xserver-source
- argument to ./configure. The compatibility mode with xserver 1.2.0 will have
- limited functionality, in particular by not supporting RandR 1.2 or the
- new Damage 1.1 updated needed for 3D applications to work with display
- rotation.
+ http://intellinuxgraphics.org/
-Configuration
+Documentation specific to the xf86-video-intel driver including
+possible configuration options for the xorg.conf file can be found in
+the intel(4) manual page. After installing the driver this
+documentation can be read with the following command:
-The driver auto-detects all device information necessary to
-initialize the card. The only lines you should need in the "Device"
-section of your xorg.conf file are:
+ man intel
- Section "Device"
- Identifier "intel"
- Driver "intel"
- EndSection
+Mailing list for communication with users and developers of
+xf86-video-intel:
-Please refer to the intel(4) manual page for information on configuration
-options.
+ intel-gfx@lists.freedesktop.org
+ Note: Subscription is required before posting, but anyone is
+ free to subscribe. See instructions (and archives) here:
-Known Limitations
-- No support for "zaphod mode" dualhead. This is the mode in which two
- Device sections are placed in the config file, and doesn't support DRI or
- many other features. Instead, only "MergedFB-style" dualhead is supported.
-- No support for X Screens larger than 2048 pixels in either direction
- before the 965. This reflects hardware limitations in the x direction on
- those older chips, and limits dualhead functionality. It may be possible to
- extend the limit vertically on these older chips.
-- i855 XV may cause hangs. This was present in the previous release, and no
- workaround is known.
-- SDVO TV-out cards not supported. This should be fixed in the next
- release.
-- Gray output with integrated TV-out and PAL TVs.
-- EXA support unstable on i845.
-- Some GM965 systems, such as the Thinkpad T61, probe the TV as being connected
- even when no output connector is available. This results in the gnome-panel
- issue noted below.
+ http://lists.freedesktop.org/mailman/listinfo/intel-gfx
-Common issues not caused by the driver
-- Font sizes (DPI) are wrong. Some displays incorrectly report their
- physical size, which is harmless on most OSes that always assume 96dpi
- displays. This can be fixed through quirks for specific monitors in the X
- Server, and the output of xrandr --prop along with a physical measurement of
- the screen size in a bug report against the server can help get that fixed.
-- gnome-panel is located in the middle of the screen. gnome-panel places
- itself within head #0's boundaries, which doesn't work well with a second
- head covering the same area as head #0 but larger.
-- Older resolution-changing applications have poor results in
- multihead systems. Previous extensions such as RandR 1.1 exposed only a
- single output to client programs, and those requests map poorly to multi-head
- systems. Currently, those requests map to just one of the outputs in the
- RandR 1.2 environment, and those applications need to be updated to RandR 1.2
- API when available for better results.
+To report bugs encountered with the driver, see:
-The X11R6 version of this driver originally came from XFree86 4.4 rc2.
+ http://intellinuxgraphics.org/how_to_report_bug.html
-The XFree86 version of this driver was donated to The XFree86 Project by:
- Precision Insight, Inc.
- Cedar Park, TX
- USA
+To see bugs that are targeted to be fixed in the next release:
-The X.Org version of this driver is maintained by Intel Corporation.
-<http://www.intellinuxgraphics.org>
+ https://bugs.freedesktop.org/show_bug.cgi?id=intel-2d-release
diff --git a/RELEASING b/RELEASING
new file mode 100644
index 00000000..2196c8fd
--- /dev/null
+++ b/RELEASING
@@ -0,0 +1,51 @@
+The process for releasing a new tarball is as follows:
+
+1. Make sure you have the latest build requirements installed:
+
+ git://git.freedesktop.org/git/util/macros
+ git://git.freedesktop.org/git/util/modular
+
+2. Add relevant release notes to the NEWS files
+
+ Skim the git log since the last release, and add notes in a
+ similar style to previous releases.
+
+ For major releases list added features and known limitations.
+
+ For minor releases indicate which bugs were fixed and which
+ are still present.
+
+
+3. Update your module version (usually found in configure.ac)
+
+ $ vi configure.ac # bump version
+ $ git push origin # make sure you're on the release branch
+
+4. Verify your module builds
+
+ $ make distcheck
+
+5. Tag the release
+
+ $ git tag -m "Intel <ver> release" <ver>
+
+6. Run the release script (this should push the tag)
+
+ $ <path_to>/util/modular/release.sh driver <last_ver> <ver>
+
+7. Edit and send the generated release message.
+
+ At the very least, add the release notes from the NEWS file.
+
+ The message is generated as xf86-video-inte-<version>.announce
+
+ For snapshots and release candidates, mail to:
+
+ intel-gfx@lists.freedesktop.org
+
+ For major releases also send to:
+
+ xorg@lists.freedesktop.org
+ xorg-announce@lists.freedesktop.org
+
+8. Throw a release party, you're done! :)
diff --git a/configure.ac b/configure.ac
index 2414a070..2b457870 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-video-intel],
- 2.6.99.1,
+ 2.7.99.1,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-video-intel)
@@ -70,15 +70,18 @@ AC_ARG_ENABLE(video-debug, AC_HELP_STRING([--enable-video-debug],
[VIDEO_DEBUG="$enableval"],
[VIDEO_DEBUG=no])
-AC_ARG_WITH(xserver-source,AC_HELP_STRING([--with-xserver-source=XSERVER_SOURCE],
- [Path to X server source tree]),
- [ XSERVER_SOURCE="$withval" ],
- [ XSERVER_SOURCE="" ])
+AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
+ [Compile with debug support [[default=yes]]]))
+if test "x$enableval" == "xyes" ; then
+ DEBUGFLAGS="-g"
+else
+ DEBUGFLAGS=""
+fi
-AC_ARG_ENABLE(xvmc, AC_HELP_STRING([--disable-xvmc],
- [Disable XvMC support [[default=auto]]]),
- [XVMC="$enableval"],
- [XVMC=auto])
+dnl AC_ARG_ENABLE(xvmc, AC_HELP_STRING([--disable-xvmc],
+dnl [Disable XvMC support [[default=auto]]]),
+dnl [XVMC="$enableval"],
+dnl [XVMC=auto])
# Checks for extensions
XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
@@ -88,14 +91,7 @@ XORG_DRIVER_CHECK_EXT(XF86DRI, xextproto x11)
XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
# Checks for pkg-config packages
-PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES])
-
-PKG_CHECK_MODULES(SERVER_1_5, [xorg-server >= 1.5],
- [SERVER_1_5=yes], [SERVER_1_5=no])
-
-if test "$SERVER_1_5" = yes; then
- AC_DEFINE(SERVER_1_5, 1, [Building against server 1.5])
-fi
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6 xproto fontsproto $REQUIRED_MODULES])
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
drm_cflags=$(pkg-config --cflags libdrm)
@@ -128,78 +124,9 @@ if test x$DRI = xauto; then
fi
fi
AC_MSG_RESULT([$DRI])
+CFLAGS="$save_CFLAGS $DEBUGFLAGS"
-AC_CHECK_HEADER(xf86Modes.h,[XMODES=yes],[XMODES=no],[#include "xorg-server.h"])
-AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
- [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
- [#include "xorg-server.h"])
-CFLAGS="$save_CFLAGS"
-
-if test x$XSERVER_LIBPCIACCESS = xyes; then
- PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10])
-else
- PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10],
- have_libpciaccess=yes,
- have_libpciaccess=no)
-fi
-AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
-AM_CONDITIONAL(LIBPCIACCESS,
- test "x$XSERVER_LIBPCIACCESS" = xyes -o "x$have_libpciaccess" = xyes)
-AM_CONDITIONAL(XMODES, test "x$XMODES" = xno)
-
-if test "x$XSERVER_SOURCE" = x; then
- if test -d ../../xserver; then
- XSERVER_SOURCE="`cd ../../xserver && pwd`"
- fi
-fi
-
-if test -d "$XSERVER_SOURCE"; then
- case "$XSERVER_SOURCE" in
- /*)
- ;;
- *)
- XSERVER_SOURCE="`cd $XSERVER_SOURCE && pwd`"
- ;;
- esac
- if test -f $srcdir/src/modes/xf86Modes.h; then
- :
- else
- ln -sf $XSERVER_SOURCE/hw/xfree86/modes $srcdir/src/modes
- fi
-
- if test -f $srcdir/src/parser/xf86Parser.h; then
- :
- else
- ln -sf $XSERVER_SOURCE/hw/xfree86/parser $srcdir/src/parser
- fi
-fi
-
-if test "x$XMODES" = xyes; then
- AC_MSG_NOTICE([X server has new mode code])
- AC_DEFINE(XMODES, 1,[X server has built-in mode code])
- XMODES_CFLAGS=
-else
- if test -f $srcdir/src/modes/xf86Modes.h -a -f $srcdir/src/parser/xf86Parser.h; then
- AC_MSG_NOTICE([X server is missing new mode code, using local copy])
- else
- AC_MSG_ERROR([Must have X server >= 1.3 source tree for mode setting code. Please specify --with-xserver-source])
- fi
- XMODES_CFLAGS='-DXF86_MODES_RENAME -I$(top_srcdir)/src -I$(top_srcdir)/src/modes -I$(top_srcdir)/src/parser'
-fi
-
-AC_SUBST([XMODES_CFLAGS])
-
-SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
-
-AC_CHECK_DECL(xf86RotateFreeShadow,
- [AC_DEFINE(HAVE_FREE_SHADOW, 1, [have new FreeShadow API])],
- [],
- [#include <xorg-server.h>
- #include <windowstr.h>
- #include <xf86Crtc.h>])
-
-CPPFLAGS="$SAVE_CPPFLAGS"
+PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10])
dnl Use lots of warning flags with GCC
@@ -211,7 +138,7 @@ if test "x$GCC" = "xyes"; then
-Wnested-externs -fno-strict-aliasing"
fi
-PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.5])
+PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.11])
AM_CONDITIONAL(DRI, test x$DRI = xyes)
if test "$DRI" = yes; then
PKG_CHECK_MODULES(DRI, [xf86driproto glproto])
@@ -219,13 +146,6 @@ if test "$DRI" = yes; then
AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
fi
-dnl Server 1.5's set_mode_major required for DRM_MODE.
-PKG_CHECK_MODULES(DRM_MODE, [xorg-server >= 1.5],
- [DRM_MODE=yes], [DRM_MODE=no])
-if test "x$DRM_MODE" = xyes; then
- AC_DEFINE(XF86DRM_MODE,1,[DRM kernel modesetting])
-fi
-
AM_CONDITIONAL(VIDEO_DEBUG, test x$VIDEO_DEBUG = xyes)
if test "$VIDEO_DEBUG" = yes; then
AC_DEFINE(VIDEO_DEBUG,1,[Enable debug support])
diff --git a/man/intel.man b/man/intel.man
index ffe69a12..05aa6789 100644
--- a/man/intel.man
+++ b/man/intel.man
@@ -146,16 +146,6 @@ have options for selecting adaptors.
.IP
Default: Textured video adaptor is preferred.
.TP
-.BI "Option \*qAccelMethod\*q \*q" string \*q
-Choose acceleration architecture, either "XAA", "EXA", or "UXA". XAA is the old
-XFree86 based acceleration architecture. EXA is a simpler
-acceleration architecture designed to better accelerate the X Render extension.
-UXA is a newer acceleration architecture built from the EXA acceleration
-code but taking advantage of kernel memory management to provide simpler,
-faster code.
-.IP
-Default: "EXA".
-.TP
.BI "Option \*qModeDebug\*q \*q" boolean \*q
Enable printing of additional debugging information about modesetting to
the server log.
@@ -321,6 +311,14 @@ First DVI SDVO output
.SS "TMDS-2"
Second DVI SDVO output
+.SS "TMDS-1", "TMDS-2", "HDMI-1", "HDMI-2"
+DVI/HDMI outputs. Avaliable common properties include:
+.PP
+.B BROADCAST_RGB
+- method used to set RGB color range(full range 0-255, not full range 16-235)
+.TP 2
+Adjusting this propertie allows you to set RGB color range on each channel in order to match HDTV requirment(default 0 for full range). Setting 1 means RGB color range is 16-235, 0 means RGB color range is 0-255 on each channel.
+
.PP
SDVO and DVO TV outputs are not supported by the driver at this time.
@@ -451,10 +449,11 @@ You can use the "xvattr" tool to query/set those attributes at runtime.
.SS "XV_SYNC_TO_VBLANK"
XV_SYNC_TO_VBLANK is used to control whether textured adapter synchronizes
-the screen update to the vblank to eliminate tearing. It has three
-values 'auto'(-1), 'off'(0) and 'on(1). 'off' means never sync, 'on' means
-always sync, no matter what size, and 'auto' means sync if the Xv image is
-more than quarter of the pixels on the screen. The default is 'auto'(-1).
+the screen update to the vblank to eliminate tearing. It is a Boolean
+attribute with values of 0 (never sync) or 1 (always sync). An historic
+value of -1 (sync for large windows only) will now be interpreted as 1,
+(since the current approach for sync is not costly even with small
+video windows).
.SS "XV_BRIGHTNESS"
diff --git a/src/Makefile.am b/src/Makefile.am
index ad87afcc..3f42e168 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,11 +18,7 @@
# 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.
-if LIBPCIACCESS
-REGDUMPER = reg_dumper
-endif
-
-SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER)
+SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 reg_dumper
# this is obnoxious:
# -module lets us name the module exactly how we want
@@ -31,33 +27,13 @@ SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER)
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRM_CFLAGS@ @DRI_CFLAGS@ \
- @PCIACCESS_CFLAGS@ -I$(top_srcdir)/uxa \
- @XMODES_CFLAGS@ -DI830_XV -DI830_USE_XAA -DI830_USE_EXA -DI830_USE_UXA
+ @PCIACCESS_CFLAGS@ -I$(top_srcdir)/uxa
intel_drv_la_LTLIBRARIES = intel_drv.la
intel_drv_la_LDFLAGS = -module -avoid-version
intel_drv_ladir = @moduledir@/drivers
intel_drv_la_LIBADD = -lm @DRM_LIBS@ -ldrm_intel ../uxa/libuxa.la
-if XSERVER_LIBPCIACCESS
intel_drv_la_LIBADD += @PCIACCESS_LIBS@
-endif
-
-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 \
@@ -129,7 +105,6 @@ intel_drv_la_SOURCES = \
i915_video.c \
i965_video.c \
i830_exa.c \
- i830_xaa.c \
i830_render.c \
i915_render.c \
i965_render.c \
@@ -204,11 +179,6 @@ clean-local:
-rm -f $(INTEL_G4B)
endif
-if XMODES
-intel_drv_la_SOURCES += \
- $(XMODE_SRCS)
-endif
-
if DRI
intel_drv_la_SOURCES += \
$(INTEL_DRI_SRCS)
diff --git a/src/bios_reader/Makefile.am b/src/bios_reader/Makefile.am
index 9f1c45a5..cff9e1a6 100644
--- a/src/bios_reader/Makefile.am
+++ b/src/bios_reader/Makefile.am
@@ -1,9 +1,8 @@
-AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @XMODES_CFLAGS@ @PCIACCESS_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @PCIACCESS_CFLAGS@ \
-DREG_DUMPER
noinst_PROGRAMS = bios_reader $(BIOS_DUMPER) $(SWF_DUMPER)
-if LIBPCIACCESS
BIOS_DUMPER = bios_dumper
bios_dumper_SOURCES = bios_dumper.c
@@ -15,5 +14,3 @@ SWF_DUMPER = swf_dumper
swf_dumper_SOURCES = swf_dumper.c
swf_dumper_LDADD = $(PCIACCESS_LIBS)
-
-endif
diff --git a/src/bios_reader/bios_reader.c b/src/bios_reader/bios_reader.c
index fc518214..328cacf2 100644
--- a/src/bios_reader/bios_reader.c
+++ b/src/bios_reader/bios_reader.c
@@ -55,8 +55,8 @@ struct _fake_i830 *pI830 = &I830;
#define INTEL_BIOS_16(_addr) (pI830->VBIOS[_addr] | \
(pI830->VBIOS[_addr + 1] << 8))
#define INTEL_BIOS_32(_addr) (pI830->VBIOS[_addr] | \
- (pI830->VBIOS[_addr + 1] << 8) \
- (pI830->VBIOS[_addr + 2] << 16) \
+ (pI830->VBIOS[_addr + 1] << 8) | \
+ (pI830->VBIOS[_addr + 2] << 16) | \
(pI830->VBIOS[_addr + 3] << 24))
#define YESNO(val) ((val) ? "yes" : "no")
diff --git a/src/ch7017/Makefile.am b/src/ch7017/Makefile.am
index fef4d373..48aef60d 100644
--- a/src/ch7017/Makefile.am
+++ b/src/ch7017/Makefile.am
@@ -3,7 +3,7 @@
# -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 = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
@PCIACCESS_CFLAGS@
ch7017_la_LTLIBRARIES = ch7017.la
diff --git a/src/ch7xxx/Makefile.am b/src/ch7xxx/Makefile.am
index 9f936116..476f84b2 100644
--- a/src/ch7xxx/Makefile.am
+++ b/src/ch7xxx/Makefile.am
@@ -3,7 +3,7 @@
# -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 = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
@PCIACCESS_CFLAGS@
ch7xxx_la_LTLIBRARIES = ch7xxx.la
diff --git a/src/common.h b/src/common.h
index 8b32a66e..ab7a6538 100644
--- a/src/common.h
+++ b/src/common.h
@@ -27,7 +27,6 @@ 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/common.h,v 1.9 2003/09/24 02:43:23 dawes Exp $ */
/*
* Authors:
@@ -40,7 +39,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define _INTEL_COMMON_H_
/* Provide substitutes for gcc's __FUNCTION__ on other compilers */
-#ifndef __GNUC__
+#if !defined(__GNUC__) && !defined(__FUNCTION__)
# if defined(__STDC__) && (__STDC_VERSION__>=199901L) /* C99 */
# define __FUNCTION__ __func__
# else
@@ -55,11 +54,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef I830DEBUG
#define MARKER() ErrorF("\n### %s:%d: >>> %s <<< ###\n\n", \
__FILE__, __LINE__,__FUNCTION__)
-#define DPRINTF I830DPRINTF_stub
+#define DPRINTF I830DPRINTF
#else /* #ifdef I830DEBUG */
#define MARKER()
-/* this is a real ugly hack to get the compiler to optimize the debugging statements into oblivion */
-#define DPRINTF if(0) I830DPRINTF_stub
+#define DPRINTF I830DPRINTF_stub
+static inline void
+I830DPRINTF_stub(const char *filename, int line, const char *function,
+ const char *fmt, ...)
+{
+}
#endif /* #ifdef I830DEBUG */
#define KB(x) ((x) * 1024)
@@ -318,21 +321,12 @@ extern int I810_DEBUG;
#define PCI_CHIP_G41_G_BRIDGE 0x2E30
#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 || \
@@ -399,9 +393,7 @@ extern int I810_DEBUG;
#define PIPE_NAME(n) ('A' + (n))
-#if XSERVER_LIBPCIACCESS
struct pci_device *
intel_host_bridge (void);
-#endif
-
+
#endif /* _INTEL_COMMON_H_ */
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 0cbcde76..7df7b6fb 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -31,7 +31,6 @@
#include "xorgVersion.h"
-#ifdef XF86DRM_MODE
#include "i830.h"
#include "intel_bufmgr.h"
#include "xf86drmMode.h"
@@ -382,7 +381,7 @@ drmmode_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *dat
* unbound. */
drmModeRmFB(drmmode->fd, drmmode_crtc->rotate_fb_id);
drmmode_crtc->rotate_fb_id = 0;
- drm_intel_bo_unmap(drmmode_crtc->rotate_bo);
+ drm_intel_gem_bo_unmap_gtt(drmmode_crtc->rotate_bo);
dri_bo_unreference(drmmode_crtc->rotate_bo);
drmmode_crtc->rotate_bo = NULL;
}
@@ -738,19 +737,19 @@ static int subpixel_conv_table[7] = { 0, SubPixelUnknown,
SubPixelVerticalBGR,
SubPixelNone };
-const char *output_names[] = { "None",
- "VGA",
- "DVI",
- "DVI",
- "DVI",
- "Composite",
- "TV",
- "LVDS",
- "CTV",
- "DIN",
- "DP",
- "HDMI",
- "HDMI",
+static const char *output_names[] = { "None",
+ "VGA",
+ "DVI",
+ "DVI",
+ "DVI",
+ "Composite",
+ "TV",
+ "LVDS",
+ "CTV",
+ "DIN",
+ "DP",
+ "HDMI",
+ "HDMI",
};
@@ -824,9 +823,6 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
if (scrn->virtualX == width && scrn->virtualY == height)
return TRUE;
- if (!pI830->can_resize)
- return FALSE;
-
pitch = i830_pad_drawable_width(width, pI830->cpp);
tiled = i830_tiled_width(pI830, &pitch, pI830->cpp);
xf86DrvMsg(scrn->scrnIndex, X_INFO,
@@ -896,7 +892,6 @@ static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = {
Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
{
- I830Ptr pI830 = I830PTR(pScrn);
xf86CrtcConfigPtr xf86_config;
drmmode_ptr drmmode;
int i;
@@ -921,33 +916,15 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
for (i = 0; i < drmmode->mode_res->count_connectors; i++)
drmmode_output_init(pScrn, drmmode, i);
- xf86InitialConfiguration(pScrn, pI830->can_resize);
+ xf86InitialConfiguration(pScrn, TRUE);
return TRUE;
}
-Bool drmmode_is_rotate_pixmap(ScrnInfoPtr pScrn, pointer pPixData, dri_bo **bo)
+int
+drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr crtc)
{
- return FALSE;
-
-#if 0
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (pScrn);
- int i;
-
- for (i = 0; i < config->num_crtc; i++) {
- xf86CrtcPtr crtc = config->crtc[i];
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-
- if (!drmmode_crtc->rotate_bo)
- continue;
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- if (drmmode_crtc->rotate_bo->virtual == pPixData) {
- *bo = drmmode_crtc->rotate_bo;
- return TRUE;
- }
- }
- return FALSE;
-#endif
+ return drm_intel_get_pipe_from_crtc_id (bufmgr, drmmode_crtc->mode_crtc->crtc_id);
}
-
-#endif
diff --git a/src/i2c_vid.h b/src/i2c_vid.h
index 6c4e95df..e5d5ec12 100644
--- a/src/i2c_vid.h
+++ b/src/i2c_vid.h
@@ -129,8 +129,4 @@ typedef struct _I830I2CVidOutputRec {
void (*dump_regs)(I2CDevPtr d);
} I830I2CVidOutputRec, *I830I2CVidOutputPtr;
-/* XXX change this name to avoid driver-specific prefix */
-DisplayModePtr
-i830_dvo_get_current_mode (xf86OutputPtr output);
-
#endif
diff --git a/src/i810.h b/src/i810.h
index c88771e9..bb356e82 100644
--- a/src/i810.h
+++ b/src/i810.h
@@ -27,7 +27,6 @@ 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/i810.h,v 1.41 2003/06/18 13:14:17 dawes Exp $ */
/*
* Authors:
@@ -51,9 +50,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "vgaHW.h"
#include "xorg-server.h"
-#ifdef XSERVER_LIBPCIACCESS
#include <pciaccess.h>
-#endif
#ifdef XF86DRI
#include "xf86drm.h"
@@ -190,12 +187,7 @@ typedef struct _I810Rec {
unsigned long MMIOAddr;
IOADDRESS ioBase;
EntityInfoPtr pEnt;
-#if XSERVER_LIBPCIACCESS
struct pci_device *PciInfo;
-#else
- pciVideoPtr PciInfo;
- PCITAG PciTag;
-#endif
I810RingBuffer *LpRing;
unsigned int BR[20];
diff --git a/src/i810_accel.c b/src/i810_accel.c
index 1f859b8a..ae4a6544 100644
--- a/src/i810_accel.c
+++ b/src/i810_accel.c
@@ -25,26 +25,12 @@ 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/i810_accel.c,v 1.21 2004/01/02 20:22:17 dawes Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/*
- * 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:
* Keith Whitwell <keith@tungstengraphics.com>
*
diff --git a/src/i810_common.h b/src/i810_common.h
index 02e548be..29be444b 100644
--- a/src/i810_common.h
+++ b/src/i810_common.h
@@ -25,7 +25,6 @@
* Converted to common header format:
* Jens Owen <jens@tungstengraphics.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_common.h,v 1.1 2002/09/11 00:29:31 dawes Exp $
*
*/
diff --git a/src/i810_cursor.c b/src/i810_cursor.c
index 30f42d14..898a1364 100644
--- a/src/i810_cursor.c
+++ b/src/i810_cursor.c
@@ -25,26 +25,12 @@ 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/i810_cursor.c,v 1.6 2002/09/11 00:29:31 dawes Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/*
- * 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:
* Keith Whitwell <keith@tungstengraphics.com>
*
diff --git a/src/i810_dga.c b/src/i810_dga.c
index 4ab7a3df..3f530579 100644
--- a/src/i810_dga.c
+++ b/src/i810_dga.c
@@ -21,20 +21,6 @@
*
* 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/i810_dga.c,v 1.5 2002/09/11 00:29:31 dawes Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/src/i810_dri.c b/src/i810_dri.c
index 136a7056..e566acf6 100644
--- a/src/i810_dri.c
+++ b/src/i810_dri.c
@@ -1,17 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.41 2003/09/24 02:43:23 dawes 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.
- */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -354,14 +340,8 @@ I810DRIScreenInit(ScreenPtr pScreen)
} else {
pDRIInfo->busIdString = xalloc(64);
sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
-#if XSERVER_LIBPCIACCESS
((pI810->PciInfo->domain << 8) | pI810->PciInfo->bus),
pI810->PciInfo->dev, pI810->PciInfo->func
-#else
- ((pciConfigPtr) pI810->PciInfo->thisCard)->busnum,
- ((pciConfigPtr) pI810->PciInfo->thisCard)->devnum,
- ((pciConfigPtr) pI810->PciInfo->thisCard)->funcnum
-#endif
);
}
pDRIInfo->ddxDriverMajorVersion = I810_MAJOR_VERSION;
@@ -978,19 +958,10 @@ I810DRIScreenInit(ScreenPtr pScreen)
if (!pI810DRI->irq) {
pI810DRI->irq = drmGetInterruptFromBusID(pI810->drmSubFD,
-#if XSERVER_LIBPCIACCESS
((pI810->PciInfo->domain << 8) |
pI810->PciInfo->bus),
pI810->PciInfo->dev,
pI810->PciInfo->func
-#else
- ((pciConfigPtr) pI810->
- PciInfo->thisCard)->busnum,
- ((pciConfigPtr) pI810->
- PciInfo->thisCard)->devnum,
- ((pciConfigPtr) pI810->
- PciInfo->thisCard)->funcnum
-#endif
);
if ((drmCtlInstHandler(pI810->drmSubFD, pI810DRI->irq)) != 0) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
diff --git a/src/i810_dri.h b/src/i810_dri.h
index 5aa43383..16b6f087 100644
--- a/src/i810_dri.h
+++ b/src/i810_dri.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.10 2002/12/10 01:27:04 dawes Exp $ */
#ifndef _I810_DRI_
#define _I810_DRI_
diff --git a/src/i810_driver.c b/src/i810_driver.c
index fe4bd626..627cffc8 100644
--- a/src/i810_driver.c
+++ b/src/i810_driver.c
@@ -25,26 +25,12 @@ 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/i810_driver.c,v 1.101 2004/01/02 20:15:47 dawes Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/*
- * 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:
* Keith Whitwell <keith@tungstengraphics.com>
*
@@ -95,14 +81,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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);
@@ -120,9 +102,6 @@ static ModeStatus I810ValidMode(int scrnIndex, DisplayModePtr mode,
Bool verbose, int flags);
#endif /* I830_ONLY */
-
-#if XSERVER_LIBPCIACCESS
-
#define INTEL_DEVICE_MATCH(d,i) \
{ 0x8086, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) }
@@ -162,25 +141,17 @@ static const struct pci_id_match intel_device_match[] = {
{ 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,
NULL,
-#if XSERVER_LIBPCIACCESS
intel_device_match,
intel_pci_probe
-#endif
};
/* *INDENT-OFF* */
@@ -482,11 +453,7 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin)
if (!setupDone) {
setupDone = 1;
xf86AddDriver(&I810, module,
-#if XSERVER_LIBPCIACCESS
HaveDriverFuncs
-#else
- 0
-#endif
);
/*
@@ -575,7 +542,6 @@ I810AvailableOptions(int chipid, int busid)
#endif
}
-#if XSERVER_LIBPCIACCESS
struct pci_device *
intel_host_bridge (void)
{
@@ -641,147 +607,6 @@ static Bool intel_pci_probe (DriverPtr driver,
}
return scrn != NULL;
}
-#else /* XSERVER_LIBPCIACCESS */
-
-/*
- * I810Probe --
- *
- * Look through the PCI bus to find cards that are I810 boards.
- * Setup the dispatch table for the rest of the driver functions.
- *
- */
-static Bool
-I810Probe(DriverPtr drv, int flags)
-{
- int i, numUsed, numDevSections, *usedChips;
- DevUnion *pPriv;
- GDevPtr *devSections;
- Bool foundScreen = FALSE;
- pciVideoPtr *VideoInfo;
- pciVideoPtr *ppPci;
- PciChipsets *id;
-
- /*
- * Find the config file Device sections that match this
- * driver, and return if there are none.
- */
- if ((numDevSections =
- xf86MatchDevice(I810_DRIVER_NAME, &devSections)) <= 0 ) {
- return FALSE;
- }
-
- /*
- * This probing is just checking the PCI data the server already
- * collected.
- */
- if (!(VideoInfo = xf86GetPciVideoInfo()))
- return FALSE;
-
- /*
- * Mobile platforms may have both function 0 and 1 active, but they
- * are handled as a single entity. To make sure that the function 1
- * entity isn't assigned to a screen, check for and claim it here
- * first.
- *
- * XXX If function 1's resources are ever needed, they'll need to be
- * added to the screen and marked active.
- */
- for (ppPci = VideoInfo; ppPci != NULL && *ppPci != NULL; ppPci++) {
- if ((*ppPci)->vendor == PCI_VENDOR_INTEL &&
- (*ppPci)->func == 1) {
- for (id = I810PciChipsets; id->PCIid != -1; id++) {
- if (id->PCIid == (*ppPci)->chipType) {
- /* Claim slot */
- if (xf86CheckPciSlot((*ppPci)->bus, (*ppPci)->device,
- (*ppPci)->func)) {
- xf86ClaimPciSlot((*ppPci)->bus, (*ppPci)->device,
- (*ppPci)->func, drv, id->PCIid,
- NULL, FALSE);
- }
- break;
- }
- }
- }
- }
-
- /* Look for Intel i8xx devices. */
- numUsed = xf86MatchPciInstances(I810_NAME, PCI_VENDOR_INTEL,
- I810Chipsets, I810PciChipsets,
- devSections, numDevSections,
- drv, &usedChips);
-
- if (flags & PROBE_DETECT) {
- if (numUsed > 0)
- foundScreen = TRUE;
- } else {
- for (i = 0; i < numUsed; i++) {
- ScrnInfoPtr pScrn = NULL;
-
- /* Allocate new ScrnInfoRec and claim the slot */
- if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
- I810PciChipsets, NULL, NULL, NULL,
- NULL, NULL))) {
- EntityInfoPtr pEnt;
-
- pEnt = xf86GetEntityInfo(usedChips[i]);
-
- pScrn->driverVersion = I810_VERSION;
- pScrn->driverName = I810_DRIVER_NAME;
- pScrn->name = I810_NAME;
- pScrn->Probe = I810Probe;
- foundScreen = TRUE;
- switch (pEnt->chipset) {
- case PCI_CHIP_845_G:
- case PCI_CHIP_I865_G:
- case PCI_CHIP_I830_M:
- case PCI_CHIP_I855_GM:
- case PCI_CHIP_I915_G:
- case PCI_CHIP_E7221_G:
- case PCI_CHIP_I915_GM:
- case PCI_CHIP_I945_G:
- case PCI_CHIP_I945_GM:
- case PCI_CHIP_I945_GME:
- case PCI_CHIP_IGD_GM:
- case PCI_CHIP_IGD_G:
- case PCI_CHIP_I965_G:
- case PCI_CHIP_G35_G:
- 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:
- case PCI_CHIP_GM45_GM:
- case PCI_CHIP_IGD_E_G:
- case PCI_CHIP_G45_G:
- case PCI_CHIP_Q45_G:
- case PCI_CHIP_G41_G:
- I830InitpScrn(pScrn);
- break;
-#ifndef I830_ONLY
- default:
- pScrn->PreInit = I810PreInit;
- pScrn->ScreenInit = I810ScreenInit;
- pScrn->SwitchMode = I810SwitchMode;
- pScrn->AdjustFrame = I810AdjustFrame;
- pScrn->EnterVT = I810EnterVT;
- pScrn->LeaveVT = I810LeaveVT;
- pScrn->FreeScreen = I810FreeScreen;
- pScrn->ValidMode = I810ValidMode;
- break;
-#endif
- }
- }
- }
- }
-
- xfree(usedChips);
- xfree(devSections);
-
- return foundScreen;
-}
-#endif /* else XSERVER_LIBPCIACCESS */
#ifndef I830_ONLY
static void
@@ -873,10 +698,6 @@ 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, NULL, ResNone))
return FALSE;
@@ -1015,45 +836,11 @@ 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;
- } else {
- if (pI810->PciInfo->memBase[1] != 0) {
- pI810->LinearAddr = pI810->PciInfo->memBase[0] & 0xFF000000;
- from = X_PROBED;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "No valid FB address in PCI config space\n");
- I810FreeRec(pScrn);
- 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;
- } else {
- if (pI810->PciInfo->memBase[1]) {
- pI810->MMIOAddr = pI810->PciInfo->memBase[1] & 0xFFF80000;
- from = X_PROBED;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "No valid MMIO address in PCI config space\n");
- I810FreeRec(pScrn);
- return FALSE;
- }
- }
-#endif
xf86DrvMsg(pScrn->scrnIndex, from, "IO registers at addr 0x%lX\n",
(unsigned long)pI810->MMIOAddr);
@@ -1072,11 +859,7 @@ I810PreInit(ScrnInfoPtr pScrn, int flags)
{
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.
*/
@@ -1129,18 +912,10 @@ 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;
@@ -1331,10 +1106,8 @@ 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;
@@ -1342,7 +1115,6 @@ 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,
@@ -1355,13 +1127,6 @@ I810MapMMIO(ScrnInfoPtr pScrn)
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;
}
@@ -1369,17 +1134,12 @@ static Bool
I810MapMem(ScrnInfoPtr pScrn)
{
I810Ptr pI810 = I810PTR(pScrn);
-#if XSERVER_LIBPCIACCESS
struct pci_device *const device = pI810->PciInfo;
int err;
-#else
- long i;
-#endif
if (!I810MapMMIO(pScrn))
return FALSE;
-#if XSERVER_LIBPCIACCESS
err = pci_device_map_range (device,
pI810->LinearAddr,
pI810->FbMapSize,
@@ -1392,15 +1152,6 @@ I810MapMem(ScrnInfoPtr pScrn)
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;
@@ -1412,12 +1163,7 @@ 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);
-#endif
pI810->MMIOBase = NULL;
}
@@ -1426,12 +1172,7 @@ 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);
-#endif
pI810->FbBase = NULL;
I810UnmapMMIO(pScrn);
return TRUE;
diff --git a/src/i810_hwmc.c b/src/i810_hwmc.c
index d56dfc40..12ffdd93 100644
--- a/src/i810_hwmc.c
+++ b/src/i810_hwmc.c
@@ -32,7 +32,6 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_hwmc.c,v 1.3 2001/12/04 21:17:56 tsi Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/src/i810_io.c b/src/i810_io.c
index 3fd8e4e3..a6cf3058 100644
--- a/src/i810_io.c
+++ b/src/i810_io.c
@@ -24,26 +24,12 @@ 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/i810_io.c,v 1.4 2002/01/25 21:56:04 tsi Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/*
- * 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:
* Daryll Strauss <daryll@precisioninsight.com>
*
diff --git a/src/i810_memory.c b/src/i810_memory.c
index 222b5cf7..f57ddbe2 100644
--- a/src/i810_memory.c
+++ b/src/i810_memory.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c,v 1.27 2002/12/10 01:27:05 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -31,19 +30,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
/*
- * 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:
* Keith Whitwell <keith@tungstengraphics.com>
*
diff --git a/src/i810_reg.h b/src/i810_reg.h
index bc462fae..cb337842 100644
--- a/src/i810_reg.h
+++ b/src/i810_reg.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h,v 1.13 2003/02/06 04:18:04 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -1300,6 +1299,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SDVO_ENCODING_HDMI (0x2 << 10)
/** Requird for HDMI operation */
#define SDVO_NULL_PACKETS_DURING_VSYNC (1 << 9)
+#define SDVO_COLOR_NOT_FULL_RANGE (1 << 8)
#define SDVO_BORDER_ENABLE (1 << 7)
#define SDVO_AUDIO_ENABLE (1 << 6)
/** New with 965, default is to be set */
@@ -2214,6 +2214,43 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define PIPE_PIXEL_MASK 0x00ffffff
#define PIPE_PIXEL_SHIFT 0
+/*
+ * Computing GMCH M and N values.
+ *
+ * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes
+ *
+ * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)
+ *
+ * The GMCH value is used internally
+ */
+#define PIPEA_GMCH_DATA_M 0x70050
+
+/* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
+#define PIPE_GMCH_DATA_M_TU_SIZE_MASK (0x3f << 25)
+#define PIPE_GMCH_DATA_M_TU_SIZE_SHIFT 25
+
+#define PIPE_GMCH_DATA_M_MASK (0xffffff)
+
+#define PIPEA_GMCH_DATA_N 0x70054
+#define PIPE_GMCH_DATA_N_MASK (0xffffff)
+
+/*
+ * Computing Link M and N values.
+ *
+ * Link M / N = pixel_clock / ls_clk
+ *
+ * (the DP spec calls pixel_clock the 'strm_clk')
+ *
+ * The Link value is transmitted in the Main Stream
+ * Attributes and VB-ID.
+ */
+
+#define PIPEA_DP_LINK_M 0x70060
+#define PIPEA_DP_LINK_M_MASK (0xffffff)
+
+#define PIPEA_DP_LINK_N 0x70064
+#define PIPEA_DP_LINK_N_MASK (0xffffff)
+
#define PIPEB_DSL 0x71000
#define PIPEBCONF 0x71008
@@ -2231,6 +2268,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define PIPEBFRAMEHIGH 0x71040
#define PIPEBFRAMEPIXEL 0x71044
+#define PIPEB_GMCH_DATA_M 0x71050
+#define PIPEB_GMCH_DATA_N 0x71054
+#define PIPEB_DP_LINK_M 0x71060
+#define PIPEB_DP_LINK_N 0x71064
+
#define DSPACNTR 0x70180
#define DSPBCNTR 0x71180
#define DISPLAY_PLANE_ENABLE (1<<31)
@@ -2436,12 +2478,19 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define MI_OVERLAY_FLIP_OFF (2<<21)
/* Wait for Events */
-#define MI_WAIT_FOR_EVENT (0x03<<23)
-#define MI_WAIT_FOR_PIPEB_SVBLANK (1<<18)
-#define MI_WAIT_FOR_PIPEA_SVBLANK (1<<17)
-#define MI_WAIT_FOR_OVERLAY_FLIP (1<<16)
-#define MI_WAIT_FOR_PIPEB_VBLANK (1<<7)
-#define MI_WAIT_FOR_PIPEA_VBLANK (1<<3)
+#define MI_WAIT_FOR_EVENT (0x03<<23)
+#define MI_WAIT_FOR_PIPEB_SVBLANK (1<<18)
+#define MI_WAIT_FOR_PIPEA_SVBLANK (1<<17)
+#define MI_WAIT_FOR_OVERLAY_FLIP (1<<16)
+#define MI_WAIT_FOR_PIPEB_VBLANK (1<<7)
+#define MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW (1<<5)
+#define MI_WAIT_FOR_PIPEA_VBLANK (1<<3)
+#define MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW (1<<1)
+
+/* Set the scan line for MI_WAIT_FOR_PIPE?_SCAN_LINE_WINDOW */
+#define MI_LOAD_SCAN_LINES_INCL (0x12<<23)
+#define MI_LOAD_SCAN_LINES_DISPLAY_PIPEA (0)
+#define MI_LOAD_SCAN_LINES_DISPLAY_PIPEB (0x1<<20)
/* Flush */
#define MI_FLUSH (0x04<<23)
diff --git a/src/i810_video.c b/src/i810_video.c
index 418f2952..9528bc7f 100644
--- a/src/i810_video.c
+++ b/src/i810_video.c
@@ -23,7 +23,6 @@ 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/i810_video.c,v 1.26 2003/11/10 18:22:22 tsi Exp $ */
/*
* i810_video.c: i810 Xv driver. Based on the mga Xv driver by Mark Vojkovich.
diff --git a/src/i810_wmark.c b/src/i810_wmark.c
index d21f6aa5..71b2a825 100644
--- a/src/i810_wmark.c
+++ b/src/i810_wmark.c
@@ -1,4 +1,3 @@
-
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -25,20 +24,6 @@ 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/i810_wmark.c,v 1.7 2002/09/11 00:29:32 dawes 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.
- */
/*
* Authors:
diff --git a/src/i830.h b/src/i830.h
index f9339177..0969c485 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -26,7 +26,6 @@ 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.h,v 1.12 2004/01/07 03:43:19 dawes Exp $ */
/*
* Authors:
@@ -53,7 +52,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xf86PciInfo.h"
#include "xf86Pci.h"
#include "i810_reg.h"
-#include "xaa.h"
#include "xf86Cursor.h"
#include "xf86xv.h"
#include "vgaHW.h"
@@ -61,44 +59,26 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xf86RandR12.h"
#include "xorg-server.h"
-#ifdef XSERVER_LIBPCIACCESS
#include <pciaccess.h>
-#endif
-#ifdef XF86DRI
#include "xf86drm.h"
#include "sarea.h"
#define _XF86DRI_SERVER_
#include "dri.h"
#include "GL/glxint.h"
#include "i830_dri.h"
-#endif
#include "intel_bufmgr.h"
#include "i915_drm.h"
-#ifdef I830_USE_EXA
-#include "exa.h"
-Bool I830EXAInit(ScreenPtr pScreen);
-unsigned long long I830TexOffsetStart(PixmapPtr pPix);
-#endif
-
-#ifdef I830_USE_UXA
#include "uxa.h"
Bool i830_uxa_init(ScreenPtr pScreen);
void i830_uxa_create_screen_resources(ScreenPtr pScreen);
void i830_uxa_block_handler (ScreenPtr pScreen);
Bool i830_get_aperture_space(ScrnInfoPtr pScrn, drm_intel_bo **bo_table,
int num_bos);
-#endif
-#if defined(I830_USE_UXA) || defined(I830_USE_EXA)
dri_bo *i830_get_pixmap_bo (PixmapPtr pixmap);
void i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo);
-#endif
-
-#ifdef I830_USE_XAA
-Bool I830XAAInit(ScreenPtr pScreen);
-#endif
typedef struct _I830OutputRec I830OutputRec, *I830OutputPtr;
@@ -106,24 +86,15 @@ typedef struct _I830OutputRec I830OutputRec, *I830OutputPtr;
#include "i830_sdvo.h"
#include "i2c_vid.h"
-/*
- * The mode handling is based upon the VESA driver written by
- * Paulo César Pereira de Andrade <pcpa@conectiva.com.br>.
- */
-
-#ifdef XF86DRI
-#define I830_MM_MINPAGES 512
-#define I830_MM_MAXSIZE (32*1024)
-#define I830_KERNEL_MM (1 << 0) /* Initialize the kernel memory manager*/
-#define I830_KERNEL_TEX (1 << 1) /* Allocate texture memory pool */
-#endif
-
#ifdef XvMCExtension
#ifdef ENABLE_XVMC
#define INTEL_XVMC 1
#endif
#endif
+#define ALWAYS_SYNC 0
+#define ALWAYS_FLUSH 0
+
typedef struct _I830Rec *I830Ptr;
typedef void (*I830WriteIndexedByteFunc)(I830Ptr pI830, IOADDRESS addr,
@@ -245,8 +216,6 @@ struct _I830DVODriver {
pointer modhandle;
};
-extern const char *i830_output_type_names[];
-
typedef struct _I830CrtcPrivateRec {
int pipe;
int plane;
@@ -352,15 +321,12 @@ enum backlight_control {
typedef enum accel_method {
ACCEL_UNINIT = 0,
ACCEL_NONE,
- ACCEL_XAA,
- ACCEL_EXA,
ACCEL_UXA
} accel_method_t;
enum dri_type {
DRI_DISABLED,
DRI_NONE,
- DRI_XF86DRI,
DRI_DRI2
};
@@ -371,8 +337,6 @@ typedef struct _I830Rec {
int cpp;
unsigned int bufferOffset; /* for I830SelectBuffer */
- BoxRec FbMemBox;
- int CacheLines;
/* These are set in PreInit and never changed. */
long FbMapSize;
@@ -396,10 +360,6 @@ typedef struct _I830Rec {
/* separate small buffers for kernels that support this */
i830_memory *cursor_mem_classic[2];
i830_memory *cursor_mem_argb[2];
- i830_memory *xaa_scratch;
-#ifdef I830_USE_EXA
- i830_memory *exa_offscreen;
-#endif
i830_memory *fake_bufmgr_mem;
/* Regions allocated either from the above pools, or from agpgart. */
@@ -422,15 +382,15 @@ typedef struct _I830Rec {
/** Number of bytes to be emitted in the current BEGIN_BATCH. */
uint32_t batch_emitting;
dri_bo *batch_bo;
+ dri_bo *last_batch_bo;
/** Whether we're in a section of code that can't tolerate flushing */
Bool in_batch_atomic;
/** Ending batch_used that was verified by i830_start_batch_atomic() */
int batch_atomic_limit;
-#ifdef I830_XV
/* For Xvideo */
i830_memory *overlay_regs;
-#endif
+ void *offscreenImages; /**< remembered memory block for release */
#ifdef INTEL_XVMC
/* For XvMC */
Bool XvMCEnabled;
@@ -443,89 +403,36 @@ typedef struct _I830Rec {
i830_memory *power_context;
-#ifdef XF86DRI
- i830_memory *back_buffer;
- i830_memory *depth_buffer;
- i830_memory *textures; /**< Compatibility texture memory */
i830_memory *memory_manager; /**< DRI memory manager aperture */
- i830_memory *hw_status; /* for G33 hw status page alloc */
-
- int TexGranularity;
- int drmMinor;
- Bool allocate_classic_textures;
-
- Bool can_resize;
-
- Bool want_vblank_interrupts;
-#endif
+ Bool have_gem;
Bool need_mi_flush;
- Bool NeedRingBufferLow;
Bool tiling;
Bool fb_compression;
- int backPitch;
-
Bool CursorNeedsPhysical;
-
- DGAModePtr DGAModes;
- int numDGAModes;
- Bool DGAactive;
- int DGAViewportStatus;
int Chipset;
unsigned long LinearAddr;
unsigned long MMIOAddr;
IOADDRESS ioBase;
EntityInfoPtr pEnt;
-#if XSERVER_LIBPCIACCESS
struct pci_device *PciInfo;
-#else
- pciVideoPtr PciInfo;
- PCITAG PciTag;
-#endif
uint8_t variant;
unsigned int BR[20];
- unsigned char **ScanlineColorExpandBuffers;
- int NumScanlineColorExpandBuffers;
- int nextColorExpandBuf;
-
Bool fence_used[FENCE_NEW_NR];
accel_method_t accel;
-#ifdef I830_USE_XAA
- XAAInfoRecPtr AccelInfoRec;
-
- /* additional XAA accelerated Composite support */
- CompositeProcPtr saved_composite;
- Bool (*xaa_check_composite)(int op, PicturePtr pSrc, PicturePtr pMask,
- PicturePtr pDst);
- Bool (*xaa_prepare_composite)(int op, PicturePtr pSrc, PicturePtr pMask,
- PicturePtr pDst, PixmapPtr pSrcPixmap,
- PixmapPtr pMaskPixmap, PixmapPtr pDstPixmap);
- void (*xaa_composite)(PixmapPtr pDst, int xSrc, int ySrc,
- int xMask, int yMask, int xDst, int yDst,
- int w, int h);
- void (*xaa_done_composite)(PixmapPtr pDst);
-#endif
CloseScreenProcPtr CloseScreen;
void (*batch_flush_notify)(ScrnInfoPtr pScrn);
-#ifdef I830_USE_EXA
- ExaDriverPtr EXADriverPtr;
-#endif
-#ifdef I830_USE_UXA
uxa_driver_t *uxa_driver;
Bool need_flush;
-#endif
- Bool need_sync;
-#if defined(I830_USE_EXA) || defined(I830_USE_UXA)
PixmapPtr pSrcPixmap;
-#endif
int accel_pixmap_pitch_alignment;
int accel_pixmap_offset_alignment;
int accel_max_x;
@@ -540,7 +447,6 @@ typedef struct _I830Rec {
Bool XvEnabled; /* Xv enabled for this generation. */
Bool XvPreferOverlay;
-#ifdef I830_XV
int colorKey;
XF86VideoAdaptorPtr adaptor;
ScreenBlockHandlerProcPtr BlockHandler;
@@ -556,14 +462,13 @@ typedef struct _I830Rec {
drm_intel_bo *gen4_sampler_bo;
drm_intel_bo *gen4_sip_kernel_bo;
} video;
-#endif
- /* EXA render state */
+ /* Render accel state */
float scale_units[2][2];
/** Transform pointers for src/mask, or NULL if identity */
PictTransform *transform[2];
float coord_adjust;
- /* i915 EXA render state */
+ /* i915 render accel state */
uint32_t mapstate[6];
uint32_t samplerstate[6];
@@ -581,18 +486,9 @@ typedef struct _I830Rec {
enum dri_type directRenderingType; /* DRI enabled this generation. */
-#ifdef XF86DRI
Bool directRenderingOpen;
- int LockHeld;
- DRIInfoPtr pDRIInfo;
int drmSubFD;
- int numVisualConfigs;
- __GLXvisualConfig *pVisualConfigs;
- I830ConfigPrivPtr pVisualConfigsPriv;
- drm_handle_t buffer_map;
- drm_handle_t ring_map;
char deviceName[64];
-#endif
/* Broken-out options. */
OptionInfoPtr Options;
@@ -614,10 +510,6 @@ typedef struct _I830Rec {
Bool suspended;
Bool leaving;
- /* fbOffset converted to (x, y). */
- int xoffset;
- int yoffset;
-
unsigned int SaveGeneration;
OsTimerPtr devicesTimer;
@@ -728,10 +620,6 @@ typedef struct _I830Rec {
unsigned long intel_get_pixmap_offset(PixmapPtr pPix);
unsigned long intel_get_pixmap_pitch(PixmapPtr pPix);
-struct i830_exa_pixmap_priv {
- dri_bo *bo;
-};
-
/* Batchbuffer support macros and functions */
#include "i830_batchbuffer.h"
@@ -773,10 +661,8 @@ i830_crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg);
extern void i830_refresh_ring(ScrnInfoPtr pScrn);
extern void I830EmitFlush(ScrnInfoPtr pScrn);
-#ifdef I830_XV
extern void I830InitVideo(ScreenPtr pScreen);
extern void i830_crtc_dpms_video(xf86CrtcPtr crtc, Bool on);
-#endif
int
i830_crtc_pipe (xf86CrtcPtr crtc);
@@ -789,33 +675,11 @@ i830_pipe_a_require_activate (ScrnInfoPtr scrn);
void
i830_pipe_a_require_deactivate (ScrnInfoPtr scrn);
-#ifdef XF86DRI
-extern Bool I830Allocate3DMemory(ScrnInfoPtr pScrn, const int flags);
-extern void I830SetupMemoryTiling(ScrnInfoPtr pScrn);
-extern Bool I830DRIScreenInit(ScreenPtr pScreen);
-extern Bool I830CheckDRIAvailable(ScrnInfoPtr pScrn);
-extern Bool I830DRIDoMappings(ScreenPtr pScreen);
-extern Bool I830DRIResume(ScreenPtr pScreen);
-extern void I830DRICloseScreen(ScreenPtr pScreen);
-extern Bool I830DRIFinishScreenInit(ScreenPtr pScreen);
-extern void I830DRIUnlock(ScrnInfoPtr pScrn);
-extern Bool I830DRILock(ScrnInfoPtr pScrn);
-extern Bool I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on);
-extern Bool i830_update_dri_buffers(ScrnInfoPtr pScrn);
-extern Bool I830DRISetHWS(ScrnInfoPtr pScrn);
-extern Bool I830DRIInstIrqHandler(ScrnInfoPtr pScrn);
-#endif
-
-#ifdef DRI2
Bool I830DRI2ScreenInit(ScreenPtr pScreen);
void I830DRI2CloseScreen(ScreenPtr pScreen);
-#endif
-#ifdef XF86DRM_MODE
extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp);
-extern Bool drmmode_is_rotate_pixmap(ScrnInfoPtr pScrn, pointer pPixData,
- dri_bo **bo);
-#endif
+extern int drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr crtc);
extern Bool I830AccelInit(ScreenPtr pScreen);
extern void I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
@@ -830,8 +694,7 @@ extern void I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
extern void I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y,
int w, int h);
-Bool i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset,
- unsigned long size);
+Bool i830_allocator_init(ScrnInfoPtr pScrn, unsigned long size);
void i830_allocator_fini(ScrnInfoPtr pScrn);
i830_memory * i830_allocate_memory(ScrnInfoPtr pScrn, const char *name,
unsigned long size, unsigned long pitch,
@@ -844,7 +707,6 @@ void i830_free_3d_memory(ScrnInfoPtr pScrn);
void i830_free_memory(ScrnInfoPtr pScrn, i830_memory *mem);
extern long I830CheckAvailableMemory(ScrnInfoPtr pScrn);
Bool i830_allocate_2d_memory(ScrnInfoPtr pScrn);
-Bool i830_allocate_texture_memory(ScrnInfoPtr pScrn);
Bool i830_allocate_pwrctx(ScrnInfoPtr pScrn);
Bool i830_allocate_3d_memory(ScrnInfoPtr pScrn);
void i830_init_bufmgr(ScrnInfoPtr pScrn);
@@ -852,7 +714,6 @@ void i830_init_bufmgr(ScrnInfoPtr pScrn);
Bool i830_allocate_xvmc_buffer(ScrnInfoPtr pScrn, const char *name,
i830_memory **buffer, unsigned long size, int flags);
#endif
-extern void i830_update_front_offset(ScrnInfoPtr pScrn);
extern uint32_t i830_create_new_fb(ScrnInfoPtr pScrn, int width, int height,
int *pitch);
@@ -866,9 +727,6 @@ i830_pad_drawable_width(int width, int cpp);
extern Bool I830I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg,
char *name);
-/* return a mask of output indices matching outputs against type_mask */
-int i830_output_clones (ScrnInfoPtr pScrn, int type_mask);
-
/* i830_display.c */
Bool
i830PipeHasType (xf86CrtcPtr crtc, int type);
@@ -885,15 +743,11 @@ void i830_hdmi_init(ScrnInfoPtr pScrn, int output_reg);
/* i830_lvds.c */
void i830_lvds_init(ScrnInfoPtr pScrn);
-extern void i830MarkSync(ScrnInfoPtr pScrn);
-extern void i830WaitSync(ScrnInfoPtr pScrn);
-
/* i830_memory.c */
Bool i830_bind_all_memory(ScrnInfoPtr pScrn);
Bool i830_unbind_all_memory(ScrnInfoPtr pScrn);
unsigned long i830_get_fence_size(I830Ptr pI830, unsigned long size);
unsigned long i830_get_fence_pitch(I830Ptr pI830, unsigned long pitch, int format);
-unsigned long i830_get_fence_alignment(I830Ptr pI830, unsigned long size);
Bool I830BindAGPMemory(ScrnInfoPtr pScrn);
Bool I830UnbindAGPMemory(ScrnInfoPtr pScrn);
@@ -953,10 +807,6 @@ i830_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform,
void i830_enter_render(ScrnInfoPtr);
-#ifndef SERVER_1_5
-Bool xf86MonitorIsHDMI(xf86MonPtr mon);
-#endif
-
static inline void
i830_wait_ring_idle(ScrnInfoPtr pScrn)
{
@@ -972,10 +822,12 @@ static inline int i830_fb_compression_supported(I830Ptr pI830)
return FALSE;
if (IS_I810(pI830) || IS_I815(pI830) || IS_I830(pI830))
return FALSE;
+ if (IS_IGD(pI830))
+ return FALSE;
/* fbc depends on tiled surface. And we don't support tiled
- * front buffer with XAA now.
+ * front buffer with unaccelerated.
*/
- if (!pI830->tiling || (IS_I965G(pI830) && pI830->accel <= ACCEL_XAA))
+ if (!pI830->tiling || (IS_I965G(pI830) && pI830->accel == ACCEL_NONE))
return FALSE;
/* We have not gotten FBC to work consistently on 965GM. Our best
* working theory right now is that FBC simply isn't reliable on
@@ -991,7 +843,7 @@ static inline int i830_fb_compression_supported(I830Ptr pI830)
do { \
if (I830PTR(pScrn)->fallback_debug) { \
xf86DrvMsg(pScrn->scrnIndex, X_INFO, \
- "EXA fallback: " s "\n", ##arg); \
+ "fallback: " s "\n", ##arg); \
} \
return FALSE; \
} while(0)
@@ -1050,6 +902,7 @@ extern const int I830CopyROP[16];
#define NEED_NON_STOLEN 0x00000004
#define NEED_LIFETIME_FIXED 0x00000008
#define ALLOW_SHARING 0x00000010
+#define DISABLE_REUSE 0x00000020
/* Chipset registers for VIDEO BIOS memory RW access */
#define _855_DRAM_RW_CONTROL 0x58
@@ -1079,4 +932,14 @@ enum {
INTEL_CREATE_PIXMAP_TILING_Y,
};
+#if (ALWAYS_FLUSH | ALWAYS_SYNC)
+void
+i830_debug_sync(ScrnInfoPtr scrn);
+#else
+static inline void
+i830_debug_sync(ScrnInfoPtr scrn)
+{
+}
+#endif
+
#endif /* _I830_H_ */
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 9f5bcb55..b365e3f9 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -1,12 +1,3 @@
-/*
- * XXX So far, for GXxor this is about 40% of the speed of SW, but CPU
- * utilisation falls from 95% to < 5%.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -33,31 +24,25 @@ 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_accel.c,v 1.8 2003/04/24 18:00:24 eich 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.
+ * Authors:
+ * Keith Whitwell <keith@tungstengraphics.com>
*
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
*/
/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
+ * XXX So far, for GXxor this is about 40% of the speed of SW, but CPU
+ * utilisation falls from 95% to < 5%.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <errno.h>
#include "xf86.h"
-#include "xaarop.h"
#include "i830.h"
#include "i810_reg.h"
#include "i830_debug.h"
@@ -67,28 +52,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
unsigned long
intel_get_pixmap_offset(PixmapPtr pPix)
{
-#if defined(I830_USE_EXA) || defined(I830_USE_UXA)
ScreenPtr pScreen = pPix->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
- if (pI830->accel == ACCEL_EXA)
- return exaGetPixmapOffset(pPix);
-#endif
return (unsigned long)pPix->devPrivate.ptr - (unsigned long)pI830->FbBase;
}
unsigned long
intel_get_pixmap_pitch(PixmapPtr pPix)
{
-#ifdef I830_USE_EXA
- ScreenPtr pScreen = pPix->drawable.pScreen;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
-
- if (pI830->accel == ACCEL_EXA)
- return exaGetPixmapPitch(pPix);
-#endif
return (unsigned long)pPix->devKind;
}
@@ -137,21 +110,7 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis)
else
i830_dump_error_state(pScrn);
ErrorF("space: %d wanted %d\n", ring->space, n);
-#ifdef XF86DRI
- if (pI830->directRenderingType == DRI_XF86DRI) {
- DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
- 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
-#ifdef I830_USE_UXA
- pI830->uxa_driver = NULL;
-#endif
+ pI830->uxa_driver = NULL;
FatalError("lockup\n");
}
@@ -177,52 +136,13 @@ I830Sync(ScrnInfoPtr pScrn)
if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC))
ErrorF("I830Sync\n");
- if (pI830->accel == ACCEL_NONE)
+ if (pI830->accel == ACCEL_NONE || !pScrn->vtSema || !pI830->batch_bo)
return;
-#ifdef XF86DRI
- /* VT switching tries to do this.
- */
- if (!pI830->LockHeld && pI830->directRenderingType == DRI_XF86DRI) {
- return;
- }
-#endif
-
I830EmitFlush(pScrn);
intel_batch_flush(pScrn, TRUE);
-
- if (pI830->directRenderingType > DRI_NONE) {
- struct drm_i915_irq_emit emit;
- struct drm_i915_irq_wait wait;
- int ret;
-
- /* Most of the uses of I830Sync while using GEM should actually be
- * using set_domain on a specific buffer. We're not there yet, so fake
- * it up using irq_emit/wait. It's still better than spinning on
- * register reads for idle.
- */
- emit.irq_seq = &wait.irq_seq;
- ret = drmCommandWriteRead(pI830->drmSubFD, DRM_I830_IRQ_EMIT, &emit,
- sizeof(emit));
- if (ret != 0)
- FatalError("Failure to emit IRQ: %s\n", strerror(-ret));
-
- do {
- ret = drmCommandWrite(pI830->drmSubFD, DRM_I830_IRQ_WAIT, &wait,
- sizeof(wait));
- } while (ret == -EINTR);
-
- if (ret != 0)
- FatalError("Failure to wait for IRQ: %s\n", strerror(-ret));
-
- if (!pI830->memory_manager)
- i830_refresh_ring(pScrn);
- } else if (!pI830->use_drm_mode) {
- i830_wait_ring_idle(pScrn);
- }
-
- pI830->nextColorExpandBuf = 0;
+ intel_batch_wait_last(pScrn);
}
void
@@ -241,35 +161,17 @@ I830EmitFlush(ScrnInfoPtr pScrn)
}
}
-Bool
-I830SelectBuffer(ScrnInfoPtr pScrn, int buffer)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-
- switch (buffer) {
-#ifdef XF86DRI
- case I830_SELECT_BACK:
- pI830->bufferOffset = pI830->back_buffer->offset;
- if (pI830->back_buffer->tiling == TILE_YMAJOR)
- return FALSE;
- break;
- case I830_SELECT_DEPTH:
- pI830->bufferOffset = pI830->depth_buffer->offset;
- if (pI830->depth_buffer->tiling == TILE_YMAJOR)
- return FALSE;
- break;
-#endif
- default:
- case I830_SELECT_FRONT:
- pI830->bufferOffset = pScrn->fbOffset;
- break;
- }
- if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
- ErrorF("I830SelectBuffer %d --> offset %x\n",
- buffer, pI830->bufferOffset);
- return TRUE;
+#if (ALWAYS_SYNC || ALWAYS_FLUSH)
+void
+i830_debug_sync(ScrnInfoPtr scrn)
+{
+ if (ALWAYS_SYNC)
+ I830Sync(scrn);
+ else
+ intel_batch_flush(scrn, FALSE);
}
+#endif
/* The following function sets up the supported acceleration. Call it
* from the FbInit() function in the SVGA driver, or before ScreenInit
@@ -317,7 +219,7 @@ I830AccelInit(ScreenPtr pScreen)
*
* For the tiled issues, the only tiled buffer we draw to should be
* the front, which will have an appropriate pitch/offset already set up,
- * so EXA doesn't need to worry.
+ * so UXA doesn't need to worry.
*/
if (IS_I965G(pI830)) {
pI830->accel_pixmap_offset_alignment = 4 * 2;
@@ -336,21 +238,7 @@ I830AccelInit(ScreenPtr pScreen)
switch (pI830->accel) {
case ACCEL_UXA:
-#ifdef I830_USE_UXA
return i830_uxa_init(pScreen);
-#else
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "UXA not built in, falling back to EXA.\n");
- return I830EXAInit(pScreen);
-#endif
-#ifdef I830_USE_EXA
- case ACCEL_EXA:
- return I830EXAInit(pScreen);
-#endif
-#ifdef I830_USE_XAA
- case ACCEL_XAA:
- return I830XAAInit(pScreen);
-#endif
case ACCEL_UNINIT:
case ACCEL_NONE:
break;
diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c
index ff5f0c21..a6d9c6e0 100644
--- a/src/i830_batchbuffer.c
+++ b/src/i830_batchbuffer.c
@@ -159,8 +159,13 @@ intel_batch_teardown(ScrnInfoPtr pScrn)
if (pI830->batch_ptr != NULL) {
dri_bo_unmap(pI830->batch_bo);
- dri_bo_unreference(pI830->batch_bo);
pI830->batch_ptr = NULL;
+
+ dri_bo_unreference(pI830->batch_bo);
+ pI830->batch_bo = NULL;
+
+ dri_bo_unreference(pI830->last_batch_bo);
+ pI830->last_batch_bo = NULL;
}
}
@@ -174,7 +179,7 @@ intel_batch_flush(ScrnInfoPtr pScrn, Bool flushed)
return;
/* If we're not using GEM, then emit a flush after each batch buffer */
- if (pI830->memory_manager == NULL && !flushed) {
+ if (!pI830->have_gem && !flushed) {
int flags = MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE;
if (IS_I965G(pI830))
@@ -201,16 +206,36 @@ intel_batch_flush(ScrnInfoPtr pScrn, Bool flushed)
if (ret != 0)
FatalError("Failed to submit batchbuffer: %s\n", strerror(-ret));
- dri_bo_unreference(pI830->batch_bo);
+ /* Save a ref to the last batch emitted, which we use for syncing
+ * in debug code.
+ */
+ dri_bo_unreference(pI830->last_batch_bo);
+ pI830->last_batch_bo = pI830->batch_bo;
+ pI830->batch_bo = NULL;
+
intel_next_batch(pScrn);
/* Mark that we need to flush whatever potential rendering we've done in the
* blockhandler. We could set this less often, but it's probably not worth
* the work.
*/
- if (pI830->memory_manager != NULL)
+ if (pI830->have_gem)
pI830->need_mi_flush = TRUE;
if (pI830->batch_flush_notify)
pI830->batch_flush_notify (pScrn);
}
+
+/** Waits on the last emitted batchbuffer to be completed. */
+void
+intel_batch_wait_last(ScrnInfoPtr scrn)
+{
+ I830Ptr pI830 = I830PTR(scrn);
+
+ /* Map it CPU write, which guarantees it's done. This is a completely
+ * non performance path, so we don't need anything better.
+ */
+ drm_intel_bo_map(pI830->last_batch_bo, TRUE);
+ drm_intel_bo_unmap(pI830->last_batch_bo);
+}
+
diff --git a/src/i830_batchbuffer.h b/src/i830_batchbuffer.h
index a72786e5..02834381 100644
--- a/src/i830_batchbuffer.h
+++ b/src/i830_batchbuffer.h
@@ -35,6 +35,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
void intel_batch_init(ScrnInfoPtr pScrn);
void intel_batch_teardown(ScrnInfoPtr pScrn);
void intel_batch_flush(ScrnInfoPtr pScrn, Bool flushed);
+void intel_batch_wait_last(ScrnInfoPtr pScrn);
static inline int
intel_batch_space(I830Ptr pI830)
@@ -56,7 +57,7 @@ intel_batch_start_atomic(ScrnInfoPtr pScrn, unsigned int sz)
I830Ptr pI830 = I830PTR(pScrn);
assert(!pI830->in_batch_atomic);
- intel_batch_require_space(pScrn, pI830, sz);
+ intel_batch_require_space(pScrn, pI830, sz * 4);
pI830->in_batch_atomic = TRUE;
pI830->batch_atomic_limit = pI830->batch_used + sz * 4;
@@ -100,21 +101,10 @@ intel_batch_emit_reloc_pixmap(I830Ptr pI830, PixmapPtr pPixmap,
uint32_t read_domains, uint32_t write_domain,
uint32_t delta)
{
-#if I830_USE_UXA || I830_USE_EXA
dri_bo *bo = i830_get_pixmap_bo(pPixmap);
-#endif
- uint32_t offset;
assert(pI830->batch_ptr != NULL);
assert(intel_batch_space(pI830) >= 4);
-#if I830_USE_UXA || I830_USE_EXA
- if (bo) {
- intel_batch_emit_reloc(pI830, bo, read_domains, write_domain, delta);
- return;
- }
-#endif
- offset = intel_get_pixmap_offset(pPixmap);
- *(uint32_t *)(pI830->batch_ptr + pI830->batch_used) = offset + delta;
- pI830->batch_used += 4;
+ intel_batch_emit_reloc(pI830, bo, read_domains, write_domain, delta);
}
#define OUT_BATCH(dword) intel_batch_emit_dword(pI830, dword)
diff --git a/src/i830_bios.c b/src/i830_bios.c
index 9b13bf40..73c097ad 100644
--- a/src/i830_bios.c
+++ b/src/i830_bios.c
@@ -43,8 +43,8 @@
#define INTEL_BIOS_16(_addr) (bios[_addr] | \
(bios[_addr + 1] << 8))
#define INTEL_BIOS_32(_addr) (bios[_addr] | \
- (bios[_addr + 1] << 8) \
- (bios[_addr + 2] << 16) \
+ (bios[_addr + 1] << 8) | \
+ (bios[_addr + 2] << 16) | \
(bios[_addr + 3] << 24))
static void *
@@ -181,6 +181,12 @@ parse_driver_feature(I830Ptr pI830, struct bdb_header *bdb)
if (!IS_I9XX(pI830))
return;
+ /* XXX Disable this parsing, as it looks doesn't work for all
+ VBIOS. Reenable it if we could find out the reliable VBT parsing
+ for LVDS config later. */
+ if (1)
+ return;
+
feature = find_section(bdb, BDB_DRIVER_FEATURES);
if (!feature)
return;
@@ -212,7 +218,6 @@ i830_bios_init(ScrnInfoPtr pScrn)
int ret;
int size;
-#if XSERVER_LIBPCIACCESS
size = pI830->PciInfo->rom_size;
if (size == 0) {
size = INTEL_VBIOS_SIZE;
@@ -220,14 +225,10 @@ i830_bios_init(ScrnInfoPtr pScrn)
"libpciaccess reported 0 rom size, guessing %dkB\n",
size / 1024);
}
-#else
- size = INTEL_VBIOS_SIZE;
-#endif
bios = xalloc(size);
if (bios == NULL)
return -1;
-#if XSERVER_LIBPCIACCESS
ret = pci_device_read_rom (pI830->PciInfo, bios);
if (ret != 0) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
@@ -236,14 +237,6 @@ i830_bios_init(ScrnInfoPtr pScrn)
xfree (bios);
return -1;
}
-#else
- /* xf86ReadPciBIOS returns the length read */
- ret = xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, size);
- if (ret <= 0) {
- xfree (bios);
- return -1;
- }
-#endif
vbt_off = INTEL_BIOS_16(0x1a);
if (vbt_off >= size) {
diff --git a/src/i830_common.h b/src/i830_common.h
index eeb2ed76..e9795a29 100644
--- a/src/i830_common.h
+++ b/src/i830_common.h
@@ -26,7 +26,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h,v 1.1 2002/09/11 00:29:32 dawes Exp $ */
#ifndef _I830_COMMON_H_
#define _I830_COMMON_H_
diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index 43a65cb9..a6aba413 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -26,20 +26,6 @@ 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_cursor.c,v 1.6 2002/12/18 15:49:01 dawes 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.
- */
/*
* Authors:
@@ -136,19 +122,6 @@ I830CursorInit(ScreenPtr pScreen)
HARDWARE_CURSOR_ARGB));
}
-void
-i830_crtc_load_cursor_image (xf86CrtcPtr crtc, unsigned char *src)
-{
- I830Ptr pI830 = I830PTR(crtc->scrn);
- I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
- uint8_t *pcurs;
-
- pcurs = pI830->FbBase + intel_crtc->cursor_offset;
-
- intel_crtc->cursor_is_argb = FALSE;
- memcpy (pcurs, src, I810_CURSOR_X * I810_CURSOR_Y / 4);
-}
-
#ifdef ARGB_CURSOR
void
i830_crtc_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
@@ -174,15 +147,15 @@ i830_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
temp = 0;
if (x < 0) {
- temp |= (CURSOR_POS_SIGN << CURSOR_X_SHIFT);
+ temp |= CURSOR_POS_SIGN << CURSOR_X_SHIFT;
x = -x;
}
if (y < 0) {
- temp |= (CURSOR_POS_SIGN << CURSOR_Y_SHIFT);
+ temp |= CURSOR_POS_SIGN << CURSOR_Y_SHIFT;
y = -y;
}
- temp |= ((x & CURSOR_POS_MASK) << CURSOR_X_SHIFT);
- temp |= ((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT);
+ temp |= x << CURSOR_X_SHIFT;
+ temp |= y << CURSOR_Y_SHIFT;
switch (intel_crtc->pipe) {
case 0:
diff --git a/src/i830_debug.c b/src/i830_debug.c
index 86f5f21d..f0709789 100644
--- a/src/i830_debug.c
+++ b/src/i830_debug.c
@@ -652,6 +652,10 @@ static struct i830SnapshotRec {
DEFINEREG2(PIPEACONF, i830_debug_pipeconf),
DEFINEREG2(PIPEASRC, i830_debug_yxminus1),
DEFINEREG2(PIPEASTAT, i830_debug_pipestat),
+ DEFINEREG(PIPEA_GMCH_DATA_M),
+ DEFINEREG(PIPEA_GMCH_DATA_N),
+ DEFINEREG(PIPEA_DP_LINK_M),
+ DEFINEREG(PIPEA_DP_LINK_N),
DEFINEREG2(FPA0, i830_debug_fp),
DEFINEREG2(FPA1, i830_debug_fp),
@@ -676,6 +680,10 @@ static struct i830SnapshotRec {
DEFINEREG2(PIPEBCONF, i830_debug_pipeconf),
DEFINEREG2(PIPEBSRC, i830_debug_yxminus1),
DEFINEREG2(PIPEBSTAT, i830_debug_pipestat),
+ DEFINEREG(PIPEB_GMCH_DATA_M),
+ DEFINEREG(PIPEB_GMCH_DATA_N),
+ DEFINEREG(PIPEB_DP_LINK_M),
+ DEFINEREG(PIPEB_DP_LINK_N),
DEFINEREG2(FPB0, i830_debug_fp),
DEFINEREG2(FPB1, i830_debug_fp),
@@ -1874,7 +1882,7 @@ i830_check_error_state(ScrnInfoPtr pScrn)
errors++;
}
temp = INREG(LP_RING + RING_LEN);
- if (!pI830->memory_manager && (temp & 1)) {
+ if (!pI830->have_gem && (temp & 1)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"PRB0_CTL (0x%08lx) indicates ring buffer enabled\n", temp);
errors++;
diff --git a/src/i830_display.c b/src/i830_display.c
index a44143fd..a7eafb97 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -245,6 +245,8 @@ intel_find_pll_i8xx_and_i9xx(const intel_limit_t *, xf86CrtcPtr,
static Bool
intel_find_pll_g4x(const intel_limit_t *, xf86CrtcPtr,
int, int, intel_clock_t *);
+static void
+i830_crtc_load_lut(xf86CrtcPtr crtc);
static const intel_limit_t intel_limits[] = {
{ /* INTEL_LIMIT_I8XX_DVO_DAC */
@@ -696,7 +698,6 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
ScrnInfoPtr pScrn = crtc->scrn;
I830Ptr pI830 = I830PTR(pScrn);
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
- int pipe = intel_crtc->pipe;
int plane = intel_crtc->plane;
unsigned long Start, Offset, Stride;
int dspbase = (plane == 0 ? DSPABASE : DSPBBASE);
@@ -735,30 +736,6 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
OUTREG(dspbase, Start + Offset);
POSTING_READ(dspbase);
}
-
-#ifdef XF86DRI
- if (pI830->directRenderingType == DRI_XF86DRI) {
- drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScrn->pScreen);
-
- if (!sPriv)
- return;
-
- switch (pipe) {
- case 0:
- sPriv->pipeA_x = x;
- sPriv->pipeA_y = y;
- break;
- case 1:
- sPriv->pipeB_x = x;
- sPriv->pipeB_y = y;
- break;
- default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Can't update pipe %d in SAREA\n", pipe);
- break;
- }
- }
-#endif
}
/*
@@ -1060,7 +1037,7 @@ i830_use_fb_compression(xf86CrtcPtr crtc)
return TRUE;
}
-#if defined(DRM_IOCTL_MODESET_CTL) && (defined(XF86DRI) || defined(DRI2))
+#if defined(DRM_IOCTL_MODESET_CTL)
static void i830_modeset_ctl(xf86CrtcPtr crtc, int pre)
{
ScrnInfoPtr pScrn = crtc->scrn;
@@ -1092,7 +1069,7 @@ static void i830_modeset_ctl(xf86CrtcPtr crtc, int dpms_state)
{
return;
}
-#endif /* DRM_IOCTL_MODESET_CTL && (XF86DRI || DRI2) */
+#endif /* DRM_IOCTL_MODESET_CTL */
static void
i830_disable_vga_plane (xf86CrtcPtr crtc)
@@ -1113,6 +1090,9 @@ i830_disable_vga_plane (xf86CrtcPtr crtc)
sr01 = INREG8(SRX + 1);
OUTREG8(SRX + 1, sr01 | (1 << 5));
usleep(30);
+ /* disable center mode on 965GM and G4X platform */
+ if (IS_I965GM(pI830) || IS_G4X(pI830))
+ vgacntrl &= ~(3 << 24);
vgacntrl |= VGA_DISP_DISABLE;
@@ -1121,7 +1101,7 @@ i830_disable_vga_plane (xf86CrtcPtr crtc)
}
-void
+static void
i830_crtc_enable(xf86CrtcPtr crtc)
{
ScrnInfoPtr pScrn = crtc->scrn;
@@ -1281,54 +1261,22 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
}
intel_crtc->dpms_mode = mode;
-
-#ifdef XF86DRI
- if (pI830->directRenderingType == DRI_XF86DRI) {
- drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScrn->pScreen);
- Bool enabled = crtc->enabled && mode != DPMSModeOff;
-
- I830DRISetVBlankInterrupt (pScrn, TRUE);
-
- if (!sPriv)
- return;
-
- switch (pipe) {
- case 0:
- sPriv->pipeA_w = enabled ? crtc->mode.HDisplay : 0;
- sPriv->pipeA_h = enabled ? crtc->mode.VDisplay : 0;
- break;
- case 1:
- sPriv->pipeB_w = enabled ? crtc->mode.HDisplay : 0;
- sPriv->pipeB_h = enabled ? crtc->mode.VDisplay : 0;
- break;
- default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Can't update pipe %d in SAREA\n", pipe);
- break;
- }
- }
-#endif
}
static Bool
i830_crtc_lock (xf86CrtcPtr crtc)
{
- /* Sync the engine before mode switch */
- i830WaitSync(crtc->scrn);
+ /* Sync the engine before mode switch, to finish any outstanding
+ * WAIT_FOR_EVENTS that may rely on CRTC state.
+ */
+ I830Sync(crtc->scrn);
-#ifdef XF86DRI
- return I830DRILock(crtc->scrn);
-#else
return FALSE;
-#endif
}
static void
i830_crtc_unlock (xf86CrtcPtr crtc)
{
-#ifdef XF86DRI
- I830DRIUnlock (crtc->scrn);
-#endif
}
static void
@@ -1363,11 +1311,6 @@ i830_crtc_commit (xf86CrtcPtr crtc)
/* Reenable FB compression if possible */
if (i830_use_fb_compression(crtc))
i830_enable_fb_compression(crtc);
-
-#ifdef XF86DRI
- /* Tell DRI1 the news about new output config */
- i830_update_dri_buffers(crtc->scrn);
-#endif
}
void
@@ -1407,11 +1350,7 @@ i830_get_core_clock_speed(ScrnInfoPtr pScrn)
else if (IS_I915GM(pI830)) {
uint16_t gcfgc;
-#if XSERVER_LIBPCIACCESS
pci_device_cfg_read_u16 (pI830->PciInfo, &gcfgc, I915_GCFGC);
-#else
- gcfgc = pciReadWord(pI830->PciTag, I915_GCFGC);
-#endif
if (gcfgc & I915_LOW_FREQUENCY_ENABLE)
return 133000;
else {
@@ -1426,14 +1365,9 @@ i830_get_core_clock_speed(ScrnInfoPtr pScrn)
} else if (IS_I865G(pI830))
return 266000;
else if (IS_I855(pI830)) {
-#if XSERVER_LIBPCIACCESS
struct pci_device *bridge = intel_host_bridge ();
uint16_t hpllcc;
pci_device_cfg_read_u16 (bridge, &hpllcc, I855_HPLLCC);
-#else
- PCITAG bridge = pciTag(0, 0, 0); /* This is always the host bridge */
- uint16_t hpllcc = pciReadWord(bridge, I855_HPLLCC);
-#endif
/* Assume that the hardware is in the high speed state. This
* should be the default.
@@ -1914,16 +1848,13 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
OUTREG(dspcntr_reg, dspcntr);
/* Flush the plane changes */
i830PipeSetBase(crtc, x, y);
-#ifdef XF86DRI
- I830DRISetVBlankInterrupt (pScrn, TRUE);
-#endif
-
+
i830WaitForVblank(pScrn);
}
/** Loads the palette/gamma unit for the CRTC with the prepared values */
-void
+static void
i830_crtc_load_lut(xf86CrtcPtr crtc)
{
ScrnInfoPtr pScrn = crtc->scrn;
@@ -2397,7 +2328,6 @@ static const xf86CrtcFuncsRec i830_crtc_funcs = {
.set_cursor_position = i830_crtc_set_cursor_position,
.show_cursor = i830_crtc_show_cursor,
.hide_cursor = i830_crtc_hide_cursor,
-/* .load_cursor_image = i830_crtc_load_cursor_image, */
.load_cursor_argb = i830_crtc_load_cursor_argb,
.destroy = NULL, /* XXX */
#if RANDR_13_INTERFACE
diff --git a/src/i830_display.h b/src/i830_display.h
index 0ba196d3..24a2717a 100644
--- a/src/i830_display.h
+++ b/src/i830_display.h
@@ -33,12 +33,10 @@ void i830WaitForVblank(ScrnInfoPtr pScrn);
void i830DescribeOutputConfiguration(ScrnInfoPtr pScrn);
void i830_set_new_crtc_bo(ScrnInfoPtr pScrn);
void i830_crtc_disable(xf86CrtcPtr crtc, Bool disable_pipe);
-void i830_crtc_enable(xf86CrtcPtr crtc);
xf86CrtcPtr i830GetLoadDetectPipe(xf86OutputPtr output, DisplayModePtr mode, int *dpms_mode);
void i830ReleaseLoadDetectPipe(xf86OutputPtr output, int dpms_mode);
void i830_crtc_init(ScrnInfoPtr pScrn, int pipe);
-void i830_crtc_load_lut(xf86CrtcPtr crtc);
DisplayModePtr i830_crtc_mode_get(ScrnInfoPtr pScrn, xf86CrtcPtr crtc);
void i830_output_prepare (xf86OutputPtr output);
void i830_output_commit (xf86OutputPtr output);
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 6a324929..0648249a 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1,4 +1,3 @@
-/* $xfree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c,v 1.15 2003/06/18 13:14:17 dawes Exp $ */
/**************************************************************************
Copyright 2001 VA Linux Systems Inc., Fremont, California.
@@ -28,36 +27,11 @@ 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: Jeff Hartmann <jhartmann@valinux.com>
* David Dawes <dawes@xfree86.org>
* Keith Whitwell <keith@tungstengraphics.com>
*/
-/*
- * This driver does AGP memory allocation a little differently from most
- * others. The 2D and 3D allocations have been unified (see i830_memory.c).
- * The driver does the AGP allocations and binding directly, then passes
- * on the mappings to the DRM module. The DRM's AGP interfaces are not used.
- * The main difference with this is that the offsets need to include
- * the AGP aperture base address because that won't be known or added on
- * by the DRM module.
- *
- * DHD 07/2002
- */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -89,1448 +63,22 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i915_drm.h"
-#include "dristruct.h"
-
-#ifdef DRI2
#include "dri2.h"
-#endif
-
-static Bool I830InitVisualConfigs(ScreenPtr pScreen);
-static Bool I830CreateContext(ScreenPtr pScreen, VisualPtr visual,
- drm_context_t hwContext, void *pVisualConfigPriv,
- DRIContextType contextStore);
-static void I830DestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
- DRIContextType contextStore);
-static void I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
- DRIContextType readContextType,
- void *readContextStore,
- DRIContextType writeContextType,
- void *writeContextStore);
-static void I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
-static void I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
- RegionPtr prgnSrc, CARD32 index);
-
-static void I830DRITransitionTo2d(ScreenPtr pScreen);
-static void I830DRITransitionTo3d(ScreenPtr pScreen);
-
-#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
-
-extern void GlxSetVisualConfigs(int nconfigs,
- __GLXvisualConfig * configs,
- void **configprivs);
-
-static Bool
-I830CleanupDma(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
- drmI830Init info;
-
- memset(&info, 0, sizeof(drmI830Init));
- info.func = I830_CLEANUP_DMA;
-
- if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT,
- &info, sizeof(drmI830Init))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Dma Cleanup Failed\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static Bool
-I830InitDma(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
- I830RingBuffer *ring = &pI830->ring;
- I830DRIPtr pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate;
- drmI830Init info;
-
- memset(&info, 0, sizeof(drmI830Init));
- info.func = I830_INIT_DMA;
-
- /* Initialize fields that are used in the absence of GEM */
- if (!pI830->memory_manager && !pI830->use_drm_mode) {
- info.ring_start = ring->mem->offset + pI830->LinearAddr;
- info.ring_end = ring->mem->end + pI830->LinearAddr;
- info.ring_size = ring->mem->size;
-
- /* Not used as of the middle of GEM development. */
- info.mmio_offset = (unsigned int)pI830DRI->regs;
-
- /* Not used as of before GEM development */
- info.front_offset = pI830->front_buffer->offset;
- info.back_offset = pI830->back_buffer->offset;
- info.depth_offset = pI830->depth_buffer->offset;
- info.pitch = pScrn->displayWidth;
- info.back_pitch = pScrn->displayWidth;
- info.depth_pitch = pScrn->displayWidth;
- info.w = pScrn->virtualX;
- info.h = pScrn->virtualY;
- }
-
-
- info.sarea_priv_offset = sizeof(XF86DRISAREARec);
-
- /* This should probably have been moved alongside offset/pitch in the sarea.
- */
- info.cpp = pI830->cpp;
-
- if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT,
- &info, sizeof(drmI830Init))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "I830 Dma Initialization Failed\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static Bool
-I830ResumeDma(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
- drmI830Init info;
-
- memset(&info, 0, sizeof(drmI830Init));
- info.func = I830_RESUME_DMA;
-
- if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT,
- &info, sizeof(drmI830Init))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Dma Resume Failed\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static Bool
-I830SetParam(ScrnInfoPtr pScrn, int param, int value)
-{
- I830Ptr pI830 = I830PTR(pScrn);
- drmI830SetParam sp;
-
- memset(&sp, 0, sizeof(sp));
- sp.param = param;
- sp.value = value;
-
- if (drmCommandWrite(pI830->drmSubFD, DRM_I830_SETPARAM, &sp, sizeof(sp))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 SetParam Failed\n");
- return FALSE;
- }
- return TRUE;
-}
-
-Bool
-I830DRISetHWS(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
- drmI830HWS hws;
-
- hws.addr = pI830->hw_status->offset;
-
- if (drmCommandWrite(pI830->drmSubFD, DRM_I830_HWS_PAGE_ADDR,
- &hws, sizeof(drmI830HWS))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "hw status page initialization Failed\n");
- return FALSE;
- }
- return TRUE;
-}
-
-static Bool
-I830InitVisualConfigs(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
- int numConfigs = 0;
- __GLXvisualConfig *pConfigs = NULL;
- I830ConfigPrivPtr pI830Configs = NULL;
- I830ConfigPrivPtr *pI830ConfigPtrs = NULL;
- int accum, stencil, db, depth;
- int i;
-
- switch (pScrn->bitsPerPixel) {
- case 8:
- case 24:
- break;
-
- case 16:
- numConfigs = 8;
-
- pConfigs =
- (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig),
- numConfigs);
- if (!pConfigs)
- return FALSE;
-
- pI830Configs =
- (I830ConfigPrivPtr) xcalloc(sizeof(I830ConfigPrivRec),
- numConfigs);
- if (!pI830Configs) {
- xfree(pConfigs);
- return FALSE;
- }
-
- pI830ConfigPtrs =
- (I830ConfigPrivPtr *) xcalloc(sizeof(I830ConfigPrivPtr),
- numConfigs);
- if (!pI830ConfigPtrs) {
- xfree(pConfigs);
- xfree(pI830Configs);
- return FALSE;
- }
-
- for (i = 0; i < numConfigs; i++)
- pI830ConfigPtrs[i] = &pI830Configs[i];
-
- i = 0;
- depth = 1;
- for (accum = 0; accum <= 1; accum++) {
- for (stencil = 0; stencil <= 1; stencil++) {
- for (db = 1; db >= 0; db--) {
- pConfigs[i].vid = -1;
- pConfigs[i].class = -1;
- pConfigs[i].rgba = TRUE;
- pConfigs[i].redSize = 5;
- pConfigs[i].greenSize = 6;
- pConfigs[i].blueSize = 5;
- pConfigs[i].alphaSize = 0;
- pConfigs[i].redMask = 0x0000F800;
- pConfigs[i].greenMask = 0x000007E0;
- pConfigs[i].blueMask = 0x0000001F;
- pConfigs[i].alphaMask = 0;
- if (accum) {
- pConfigs[i].accumRedSize = 16;
- pConfigs[i].accumGreenSize = 16;
- pConfigs[i].accumBlueSize = 16;
- pConfigs[i].accumAlphaSize = 0;
- } else {
- pConfigs[i].accumRedSize = 0;
- pConfigs[i].accumGreenSize = 0;
- pConfigs[i].accumBlueSize = 0;
- pConfigs[i].accumAlphaSize = 0;
- }
- pConfigs[i].doubleBuffer = db ? TRUE : FALSE;
- pConfigs[i].stereo = FALSE;
- pConfigs[i].bufferSize = 16;
- if (depth)
- pConfigs[i].depthSize = 16;
- else
- pConfigs[i].depthSize = 0;
- if (stencil)
- pConfigs[i].stencilSize = 8;
- else
- pConfigs[i].stencilSize = 0;
- pConfigs[i].auxBuffers = 0;
- pConfigs[i].level = 0;
- if (stencil || accum)
- pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
- else
- pConfigs[i].visualRating = GLX_NONE_EXT;
- pConfigs[i].transparentPixel = GLX_NONE_EXT;
- pConfigs[i].transparentRed = 0;
- pConfigs[i].transparentGreen = 0;
- pConfigs[i].transparentBlue = 0;
- pConfigs[i].transparentAlpha = 0;
- pConfigs[i].transparentIndex = 0;
- i++;
- }
- }
- }
- assert(i == numConfigs);
- break;
-
- case 32:
- numConfigs = 8;
-
- pConfigs = (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig),
- numConfigs);
- if (!pConfigs) {
- return FALSE;
- }
-
- pI830Configs = (I830ConfigPrivPtr) xcalloc(sizeof(I830ConfigPrivRec),
- numConfigs);
- if (!pI830Configs) {
- xfree(pConfigs);
- return FALSE;
- }
-
- pI830ConfigPtrs = (I830ConfigPrivPtr *)
- xcalloc(sizeof(I830ConfigPrivPtr), numConfigs);
- if (!pI830ConfigPtrs) {
- xfree(pConfigs);
- xfree(pI830Configs);
- return FALSE;
- }
-
- for (i = 0; i < numConfigs; i++) {
- pI830ConfigPtrs[i] = &pI830Configs[i];
- }
-
- i = 0;
- for (accum = 0; accum <= 1; accum++) {
- for (depth = 1; depth >= 0; depth--) { /* and stencil */
- for (db = 1; db >= 0; db--) {
- pConfigs[i].vid = -1;
- pConfigs[i].class = -1;
- pConfigs[i].rgba = TRUE;
- pConfigs[i].redSize = 8;
- pConfigs[i].greenSize = 8;
- pConfigs[i].blueSize = 8;
- pConfigs[i].alphaSize = 8;
- pConfigs[i].redMask = 0x00FF0000;
- pConfigs[i].greenMask = 0x0000FF00;
- pConfigs[i].blueMask = 0x000000FF;
- pConfigs[i].alphaMask = 0xFF000000;
- if (accum) {
- pConfigs[i].accumRedSize = 16;
- pConfigs[i].accumGreenSize = 16;
- pConfigs[i].accumBlueSize = 16;
- pConfigs[i].accumAlphaSize = 16;
- } else {
- pConfigs[i].accumRedSize = 0;
- pConfigs[i].accumGreenSize = 0;
- pConfigs[i].accumBlueSize = 0;
- pConfigs[i].accumAlphaSize = 0;
- }
- if (db) {
- pConfigs[i].doubleBuffer = TRUE;
- } else {
- pConfigs[i].doubleBuffer = FALSE;
- }
- pConfigs[i].stereo = FALSE;
- pConfigs[i].bufferSize = 32;
- if (depth) {
- pConfigs[i].depthSize = 24;
- pConfigs[i].stencilSize = 8;
- } else {
- pConfigs[i].depthSize = 0;
- pConfigs[i].stencilSize = 0;
- }
- pConfigs[i].auxBuffers = 0;
- pConfigs[i].level = 0;
- if (accum) {
- pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
- } else {
- pConfigs[i].visualRating = GLX_NONE_EXT;
- }
- pConfigs[i].transparentPixel = GLX_NONE_EXT;
- pConfigs[i].transparentRed = 0;
- pConfigs[i].transparentGreen = 0;
- pConfigs[i].transparentBlue = 0;
- pConfigs[i].transparentAlpha = 0;
- pConfigs[i].transparentIndex = 0;
- i++;
- }
- }
- }
- if (i != numConfigs) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "[drm] Incorrect initialization of visuals\n");
- return FALSE;
- }
- break;
-
- }
- pI830->numVisualConfigs = numConfigs;
- pI830->pVisualConfigs = pConfigs;
- pI830->pVisualConfigsPriv = pI830Configs;
- GlxSetVisualConfigs(numConfigs, pConfigs, (void **)pI830ConfigPtrs);
- return TRUE;
-}
-
-Bool
-I830CheckDRIAvailable(ScrnInfoPtr pScrn)
-{
- /* Hardware 3D rendering only implemented for 16bpp and 32 bpp */
- if (((pScrn->bitsPerPixel / 8) != 2 && pScrn->depth != 16) &&
- (pScrn->bitsPerPixel / 8) != 4) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "[drm] Direct rendering only supported in 16 and 32 bpp modes\n");
- return FALSE;
- }
-
- /* Check that the GLX, DRI, and DRM modules have been loaded by testing
- * for known symbols in each module. */
- if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "[dri] %s failed: glx not loaded\n", __FUNCTION__);
- return FALSE;
- }
- if (!xf86LoaderCheckSymbol("DRIScreenInit")) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "[dri] %s failed: dri not loaded\n", __FUNCTION__);
- return FALSE;
- }
- 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", __FUNCTION__);
- return FALSE;
- }
-
- /* Check the DRI version */
- {
- int major, minor, patch;
-
- DRIQueryVersion(&major, &minor, &patch);
- 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"
- "[dri] Disabling DRI.\n",
- "I830CheckDRIAvailable", major, minor, patch,
- DRIINFO_MAJOR_VERSION, DRIINFO_MINOR_VERSION);
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-Bool
-I830DRIScreenInit(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
- DRIInfoPtr pDRIInfo;
- I830DRIPtr pI830DRI;
-
- DPRINTF(PFX, "I830DRIScreenInit\n");
-
- if (!I830CheckDRIAvailable(pScrn))
- return FALSE;
-
- pDRIInfo = DRICreateInfoRec();
- if (!pDRIInfo) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[dri] DRICreateInfoRec failed. Disabling DRI.\n");
- return FALSE;
- }
-
- pI830->pDRIInfo = pDRIInfo;
- pI830->LockHeld = 0;
-
- 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
-#endif
- );
- }
- pDRIInfo->ddxDriverMajorVersion = I830_MAJOR_VERSION;
- pDRIInfo->ddxDriverMinorVersion = I830_MINOR_VERSION;
- pDRIInfo->ddxDriverPatchVersion = I830_PATCHLEVEL;
- pDRIInfo->ddxDrawableTableEntry = I830_MAX_DRAWABLES;
-
- if (SAREA_MAX_DRAWABLES < I830_MAX_DRAWABLES)
- pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES;
- else
- pDRIInfo->maxDrawableTableEntry = I830_MAX_DRAWABLES;
-
- if (sizeof(XF86DRISAREARec) + sizeof(drmI830Sarea) > SAREA_MAX) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[dri] Data does not fit in SAREA\n");
- return FALSE;
- }
- /* This is a hack for now. We have to have more than a 4k page here
- * because of the size of the state. However, the state should be
- * in a per-context mapping. This will be added in the Mesa 3.5 port
- * of the I830 driver.
- */
- pDRIInfo->SAREASize = SAREA_MAX;
-
- if (!(pI830DRI = (I830DRIPtr) xcalloc(sizeof(I830DRIRec), 1))) {
- DRIDestroyInfoRec(pI830->pDRIInfo);
- pI830->pDRIInfo = NULL;
- return FALSE;
- }
- pDRIInfo->devPrivate = pI830DRI;
- pDRIInfo->devPrivateSize = sizeof(I830DRIRec);
- pDRIInfo->contextSize = sizeof(I830DRIContextRec);
-
- pDRIInfo->CreateContext = I830CreateContext;
- pDRIInfo->DestroyContext = I830DestroyContext;
- pDRIInfo->SwapContext = I830DRISwapContext;
- 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->accel == ACCEL_EXA)
- pDRIInfo->texOffsetStart = I830TexOffsetStart;
-#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;
-
- /* 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 = NULL;
- DRIDestroyInfoRec(pI830->pDRIInfo);
- pI830->pDRIInfo = NULL;
- return FALSE;
- }
-
- /* 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");
- }
-
- /* Check the i915 DRM versioning */
- {
- drmVersionPtr version;
-
- /* Check the DRM lib version.
- * drmGetLibVersion was not supported in version 1.0, so check for
- * symbol first to avoid possible crash or hang.
- */
- if (xf86LoaderCheckSymbol("drmGetLibVersion")) {
- version = drmGetLibVersion(pI830->drmSubFD);
- } else
- {
- /* drmlib version 1.0.0 didn't have the drmGetLibVersion
- * entry point. Fake it by allocating a version record
- * via drmGetVersion and changing it to version 1.0.0
- */
- version = drmGetVersion(pI830->drmSubFD);
- version->version_major = 1;
- version->version_minor = 0;
- version->version_patchlevel = 0;
- }
-
-#define REQ_MAJ 1
-#define REQ_MIN 1
- if (version) {
- if (version->version_major != REQ_MAJ ||
- version->version_minor < REQ_MIN) {
- /* incompatible drm library version */
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[dri] I830DRIScreenInit failed because of a version mismatch.\n"
- "[dri] libdrm.a module version is %d.%d.%d but version %d.%d.x is needed.\n"
- "[dri] Disabling DRI.\n",
- version->version_major,
- version->version_minor, version->version_patchlevel,
- REQ_MAJ, REQ_MIN);
- drmFreeVersion(version);
- I830DRICloseScreen(pScreen);
- return FALSE;
- }
- drmFreeVersion(version);
- }
-
- /* Check the i915 DRM version */
- version = drmGetVersion(pI830->drmSubFD);
- if (version) {
- if (version->version_major != 1 || version->version_minor < 3) {
- /* incompatible drm version */
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[dri] %s failed because of a version mismatch.\n"
- "[dri] i915 kernel module version is %d.%d.%d but version 1.3 or greater is needed.\n"
- "[dri] Disabling DRI.\n",
- "I830DRIScreenInit",
- version->version_major,
- version->version_minor, version->version_patchlevel);
- I830DRICloseScreen(pScreen);
- drmFreeVersion(version);
- return FALSE;
- }
- /* 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;
- drmFreeVersion(version);
- }
- }
-
- return TRUE;
-}
-
-static void
-I830InitTextureHeap(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
- drmI830MemInitHeap drmHeap;
-
- if (pI830->textures == NULL)
- return;
-
- /* Start up the simple memory manager for agp space */
- drmHeap.region = I830_MEM_REGION_AGP;
- drmHeap.start = 0;
- 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, %ld\n",
- pI830->textures->size);
-
- I830SetParam(pScrn, I830_SETPARAM_TEX_LRU_LOG_GRANULARITY,
- pI830->TexGranularity);
- }
-}
-
-/*
- * Map registers & ring buffer
- */
-static Bool
-I830DRIMapHW(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
- DRIInfoPtr pDRIInfo = pI830->pDRIInfo;
- I830DRIPtr pI830DRI = pDRIInfo->devPrivate;
-
- /* Kernel deals with direct hw access in this case */
- if (pI830->use_drm_mode)
- return TRUE;
-
- DPRINTF(PFX, "I830DRIMapHW\n");
- pI830DRI->regsSize = I830_REG_SIZE;
- if (drmAddMap(pI830->drmSubFD, (drm_handle_t)pI830->MMIOAddr,
- pI830DRI->regsSize, DRM_REGISTERS, 0,
- (drmAddress) &pI830DRI->regs) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(regs) failed\n");
- DRICloseScreen(pScreen);
- return FALSE;
- }
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08x\n",
- (int)pI830DRI->regs);
-
- if (!pI830->memory_manager) {
- if (drmAddMap(pI830->drmSubFD,
- (drm_handle_t)pI830->ring.mem->offset +
- pI830->LinearAddr,
- pI830->ring.mem->size, DRM_AGP, 0,
- (drmAddress) &pI830->ring_map) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] drmAddMap(ring_map) failed. Disabling DRI\n");
- DRICloseScreen(pScreen);
- return FALSE;
- }
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] ring buffer = 0x%08x\n",
- (int)pI830->ring_map);
- }
-
- return TRUE;
-}
-
-/**
- * Sets up mappings for static, lifetime-fixed allocations, and inital SAREA
- * setup.
- */
-Bool
-I830DRIDoMappings(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
- DRIInfoPtr pDRIInfo = pI830->pDRIInfo;
- I830DRIPtr pI830DRI = pDRIInfo->devPrivate;
- drmI830Sarea *sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
-
- if (!I830DRIMapHW(pScreen)) {
- DRICloseScreen(pScreen);
- return FALSE;
- }
-
- if (!I830InitDma(pScrn)) {
- DRICloseScreen(pScreen);
- return FALSE;
- }
-
- if (pI830->memory_manager == NULL)
- intel_bufmgr_fake_set_last_dispatch(pI830->bufmgr,
- (volatile unsigned int *)
- &sarea->last_dispatch);
-
- /* init to zero to be safe */
- sarea->front_handle = 0;
- sarea->back_handle = 0;
- sarea->depth_handle = 0;
- sarea->tex_handle = 0;
-
- /* Assign pScreen */
- pScrn->pScreen = pScreen;
-
- /* Need to initialize pScreen now to let RandR know. */
- pScrn->pScreen->width = pScrn->virtualX;
- pScrn->pScreen->height = pScrn->virtualY;
-
- /* 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->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 = DEVICE_ID(pI830->PciInfo);
- pI830DRI->width = pScrn->virtualX;
- pI830DRI->height = pScrn->virtualY;
- pI830DRI->mem = pScrn->videoRam * 1024;
- pI830DRI->cpp = pI830->cpp;
-
- pI830DRI->bitsPerPixel = pScrn->bitsPerPixel;
-
- pI830DRI->sarea_priv_offset = sizeof(XF86DRISAREARec);
-
- if (!(I830InitVisualConfigs(pScreen))) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[dri] I830InitVisualConfigs failed. Disabling DRI\n");
- DRICloseScreen(pScreen);
- return FALSE;
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized\n");
- pI830->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
-
- return TRUE;
-}
-
-Bool
-I830DRIInstIrqHandler(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
- 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
+#ifdef DRI2
+#if DRI2INFOREC_VERSION >= 1
+#define USE_DRI2_1_1_0
#endif
- );
-
- if (drmCtlInstHandler(pI830->drmSubFD, pI830DRI->irq)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "[drm] failure adding irq handler\n");
- pI830DRI->irq = 0;
- return FALSE;
- } else
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "[drm] dma control initialized, using IRQ %d\n",
- pI830DRI->irq);
-
- return TRUE;
-}
-
-Bool
-I830DRIResume(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
-
- DPRINTF(PFX, "I830DRIResume\n");
-
- I830ResumeDma(pScrn);
-
- if (!pI830->memory_manager)
- I830DRIInstIrqHandler(pScrn);
-
- return TRUE;
-}
-
-void
-I830DRICloseScreen(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
- I830DRIPtr pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate;
-
- DPRINTF(PFX, "I830DRICloseScreen\n");
-
- if (!pI830->memory_manager && pI830DRI->irq) {
- drmCtlUninstHandler(pI830->drmSubFD);
- pI830DRI->irq = 0;
- }
-
- I830CleanupDma(pScrn);
-
- DRICloseScreen(pScreen);
-
- if (pI830->pDRIInfo) {
- if (pI830->pDRIInfo->devPrivate) {
- xfree(pI830->pDRIInfo->devPrivate);
- pI830->pDRIInfo->devPrivate = NULL;
- }
- DRIDestroyInfoRec(pI830->pDRIInfo);
- pI830->pDRIInfo = NULL;
- }
- if (pI830->pVisualConfigs)
- xfree(pI830->pVisualConfigs);
- if (pI830->pVisualConfigsPriv)
- xfree(pI830->pVisualConfigsPriv);
- pI830->directRenderingType = DRI_NONE;
-}
-
-static Bool
-I830CreateContext(ScreenPtr pScreen, VisualPtr visual,
- drm_context_t hwContext, void *pVisualConfigPriv,
- DRIContextType contextStore)
-{
- return TRUE;
-}
-
-static void
-I830DestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
- DRIContextType contextStore)
-{
-}
-
-Bool
-I830DRIFinishScreenInit(ScreenPtr pScreen)
-{
- DPRINTF(PFX, "I830DRIFinishScreenInit\n");
-
- if (!DRIFinishScreenInit(pScreen))
- return FALSE;
-
- /* move irq initialize later in EnterVT, as then we
- * would finish binding possible hw status page, which
- * requires irq ctrl ioctl not be called that early.
- */
- return TRUE;
-}
-
-static void
-I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
- DRIContextType oldContextType, void *oldContext,
- DRIContextType newContextType, void *newContext)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
-
- if (syncType == DRI_3D_SYNC &&
- oldContextType == DRI_2D_CONTEXT && newContextType == DRI_2D_CONTEXT) {
-
- if (I810_DEBUG & DEBUG_VERBOSE_DRI)
- ErrorF("i830DRISwapContext (in)\n");
-
- pI830->last_3d = LAST_3D_OTHER;
-
- if (!pScrn->vtSema)
- return;
- pI830->LockHeld = 1;
- if (!pI830->memory_manager)
- i830_refresh_ring(pScrn);
-
- } else if (syncType == DRI_2D_SYNC &&
- oldContextType == DRI_NO_CONTEXT &&
- newContextType == DRI_2D_CONTEXT) {
- if (I810_DEBUG & DEBUG_VERBOSE_DRI)
- ErrorF("i830DRISwapContext (out)\n");
-
- if (!pScrn->vtSema)
- return;
- pI830->LockHeld = 0;
- } else if (I810_DEBUG & DEBUG_VERBOSE_DRI)
- ErrorF("i830DRISwapContext (other)\n");
-}
-
-static void
-I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- BoxPtr pbox;
- int nbox;
- int buffer, first_buffer, last_buffer;
-
- if (I810_DEBUG & DEBUG_VERBOSE_DRI)
- ErrorF("I830DRIInitBuffers\n");
-
- first_buffer = I830_SELECT_BACK;
- last_buffer = I830_SELECT_DEPTH;
-
- for (buffer = first_buffer; buffer <= last_buffer; buffer++) {
- pbox = REGION_RECTS(prgn);
- nbox = REGION_NUM_RECTS(prgn);
-
- if (!I830SelectBuffer(pScrn, buffer))
- continue;
-
- if (buffer == I830_SELECT_DEPTH) {
- switch (pScrn->bitsPerPixel) {
- case 16:
- I830SetupForSolidFill(pScrn, 0xffff, GXcopy, -1);
- break;
- case 32:
- I830SetupForSolidFill(pScrn, 0xffffff, GXcopy, -1);
- break;
- }
- } else
- I830SetupForSolidFill(pScrn, 0, GXcopy, -1);
- while (nbox--) {
- I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- pbox++;
- }
- }
-
- I830SelectBuffer(pScrn, I830_SELECT_FRONT);
- i830MarkSync(pScrn);
-}
-/* This routine is a modified form of XAADoBitBlt with the calls to
- * ScreenToScreenBitBlt built in. My routine has the prgnSrc as source
- * instead of destination. My origin is upside down so the ydir cases
- * are reversed.
- */
-static void
-I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
- RegionPtr prgnSrc, CARD32 index)
-{
- ScreenPtr pScreen = pParent->drawable.pScreen;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- BoxPtr pboxTmp, pboxNext, pboxBase;
- DDXPointPtr pptTmp, pptNew2 = NULL;
- int xdir, ydir;
-
-#if 0
- int screenwidth = pScrn->virtualX;
- int screenheight = pScrn->virtualY;
-#else
- int screenwidth = pScreen->width;
- int screenheight = pScreen->height;
+extern XF86ModuleData dri2ModuleData;
#endif
- BoxPtr pbox = REGION_RECTS(prgnSrc);
- int nbox = REGION_NUM_RECTS(prgnSrc);
-
- BoxPtr pboxNew1 = NULL;
- BoxPtr pboxNew2 = NULL;
- DDXPointPtr pptNew1 = NULL;
- DDXPointPtr pptSrc = &ptOldOrg;
-
- int dx = pParent->drawable.x - ptOldOrg.x;
- int dy = pParent->drawable.y - ptOldOrg.y;
- int buffer, first_buffer, last_buffer;
-
- /* If the copy will overlap in Y, reverse the order */
- if (dy > 0) {
- ydir = -1;
-
- if (nbox > 1) {
- /* Keep ordering in each band, reverse order of bands */
- pboxNew1 = (BoxPtr) xalloc(sizeof(BoxRec) * nbox);
- if (!pboxNew1)
- return;
- pptNew1 = (DDXPointPtr) xalloc(sizeof(DDXPointRec) * nbox);
- if (!pptNew1) {
- xfree(pboxNew1);
- return;
- }
- pboxBase = pboxNext = pbox + nbox - 1;
- while (pboxBase >= pbox) {
- while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1))
- pboxNext--;
- pboxTmp = pboxNext + 1;
- pptTmp = pptSrc + (pboxTmp - pbox);
- while (pboxTmp <= pboxBase) {
- *pboxNew1++ = *pboxTmp++;
- *pptNew1++ = *pptTmp++;
- }
- pboxBase = pboxNext;
- }
- pboxNew1 -= nbox;
- pbox = pboxNew1;
- pptNew1 -= nbox;
- pptSrc = pptNew1;
- }
- } else {
- /* No changes required */
- ydir = 1;
- }
-
- /* If the regions will overlap in X, reverse the order */
- if (dx > 0) {
- xdir = -1;
-
- if (nbox > 1) {
- /*reverse orderof rects in each band */
- pboxNew2 = (BoxPtr) xalloc(sizeof(BoxRec) * nbox);
- pptNew2 = (DDXPointPtr) xalloc(sizeof(DDXPointRec) * nbox);
- if (!pboxNew2 || !pptNew2) {
- if (pptNew2)
- xfree(pptNew2);
- if (pboxNew2)
- xfree(pboxNew2);
- if (pboxNew1) {
- xfree(pptNew1);
- xfree(pboxNew1);
- }
- return;
- }
- pboxBase = pboxNext = pbox;
- while (pboxBase < pbox + nbox) {
- while ((pboxNext < pbox + nbox) && (pboxNext->y1 == pboxBase->y1))
- pboxNext++;
- pboxTmp = pboxNext;
- pptTmp = pptSrc + (pboxTmp - pbox);
- while (pboxTmp != pboxBase) {
- *pboxNew2++ = *--pboxTmp;
- *pptNew2++ = *--pptTmp;
- }
- pboxBase = pboxNext;
- }
- pboxNew2 -= nbox;
- pbox = pboxNew2;
- pptNew2 -= nbox;
- pptSrc = pptNew2;
- }
- } else {
- /* No changes are needed */
- xdir = 1;
- }
-
- /* SelectBuffer isn't really a good concept for the i810.
- */
- I830EmitFlush(pScrn);
- first_buffer = I830_SELECT_BACK;
- last_buffer = I830_SELECT_DEPTH;
-
- for (buffer = first_buffer; buffer <= last_buffer; buffer++) {
- if (!I830SelectBuffer(pScrn, buffer))
- continue;
- I830SetupForScreenToScreenCopy(pScrn, xdir, ydir, GXcopy, -1, -1);
- pbox = REGION_RECTS(prgnSrc);
- nbox = REGION_NUM_RECTS(prgnSrc);
- for (; nbox--; pbox++) {
-
- int x1 = pbox->x1;
- int y1 = pbox->y1;
- int destx = x1 + dx;
- int desty = y1 + dy;
- int w = pbox->x2 - x1 + 1;
- int h = pbox->y2 - y1 + 1;
-
- if (destx < 0)
- x1 -= destx, w += destx, destx = 0;
- if (desty < 0)
- y1 -= desty, h += desty, desty = 0;
- if (destx + w > screenwidth)
- w = screenwidth - destx;
- if (desty + h > screenheight)
- h = screenheight - desty;
- if (w <= 0)
- continue;
- if (h <= 0)
- continue;
-
- if (I810_DEBUG & DEBUG_VERBOSE_DRI)
- ErrorF("MoveBuffers %d,%d %dx%d dx: %d dy: %d\n",
- x1, y1, w, h, dx, dy);
-
- I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h);
- }
- }
-
- I830SelectBuffer(pScrn, I830_SELECT_FRONT);
- I830EmitFlush(pScrn);
-
- if (pboxNew2) {
- xfree(pptNew2);
- xfree(pboxNew2);
- }
- if (pboxNew1) {
- xfree(pptNew1);
- xfree(pboxNew1);
- }
- i830MarkSync(pScrn);
-}
-
-static void
-I830DRITransitionTo3d(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
-
- pI830->want_vblank_interrupts = TRUE;
- I830DRISetVBlankInterrupt(pScrn, TRUE);
-}
-
-static void
-I830DRITransitionTo2d(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
-
- pI830->want_vblank_interrupts = FALSE;
- I830DRISetVBlankInterrupt(pScrn, FALSE);
-}
-
-static int
-i830_name_buffer (ScrnInfoPtr pScrn, i830_memory *mem)
-{
- if (mem && mem->bo)
- {
- if (!mem->gem_name)
- {
- int ret;
- ret = dri_bo_flink(mem->bo, &mem->gem_name);
- if (ret != 0)
- {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "[drm] failed to name buffer %d\n", -errno);
- return -1;
- }
- }
- return mem->gem_name;
- }
- return -1;
-}
-
-/**
- * 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);
-
- if (pI830->directRenderingType == DRI_DRI2)
- return;
-
- sarea->width = pScreen->width;
- sarea->height = pScreen->height;
- sarea->pitch = pScrn->displayWidth;
- sarea->virtualX = pScrn->virtualX;
- sarea->virtualY = pScrn->virtualY;
-
- sarea->front_tiled = (pI830->front_buffer->tiling != TILE_NONE);
- sarea->back_tiled = (pI830->back_buffer->tiling != TILE_NONE);
- sarea->depth_tiled = (pI830->depth_buffer->tiling != TILE_NONE);
- sarea->rotated_tiled = FALSE;
-
- sarea->log_tex_granularity = pI830->TexGranularity;
-
- sarea->front_bo_handle = i830_name_buffer (pScrn, pI830->front_buffer);
- sarea->back_bo_handle = i830_name_buffer (pScrn, pI830->back_buffer);
- sarea->depth_bo_handle = i830_name_buffer (pScrn, pI830->depth_buffer);
-
- /* 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;
- }
-
- sarea->third_handle = 0;
- sarea->third_offset = 0;
- sarea->third_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;
- }
-
- 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;
- }
- }
-
- return TRUE;
-}
-
-static void
-i830_update_screen_private(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-
- 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
-}
-
-/**
- * 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;
- I830Ptr pI830 = I830PTR(pScrn);
- drmI830Sarea *sarea;
- Bool success;
-
- if (pI830->directRenderingType != DRI_XF86DRI)
- return TRUE;
-
- sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
-
- 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->directRenderingType == DRI_XF86DRI && pI830->drmMinor >= 5) {
- if (on) {
- 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
- pipe.pipe = DRM_I830_VBLANK_PIPE_A;
- } else {
- pipe.pipe = 0;
- }
- if (drmCommandWrite(pI830->drmSubFD, DRM_I830_SET_VBLANK_PIPE,
- &pipe, sizeof (pipe))) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-Bool
-I830DRILock(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-
- if (pI830->directRenderingType == DRI_XF86DRI && !pI830->LockHeld) {
- DRILock(screenInfo.screens[pScrn->scrnIndex], 0);
- pI830->LockHeld = 1;
- if (!pI830->memory_manager)
- i830_refresh_ring(pScrn);
- return TRUE;
- }
- else
- return FALSE;
-}
-
-
-
-void
-I830DRIUnlock(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-
- if (pI830->directRenderingType == DRI_XF86DRI && pI830->LockHeld) {
- DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
- pI830->LockHeld = 0;
- }
-}
-
-#ifdef DRI2
-
typedef struct {
PixmapPtr pPixmap;
+ unsigned int attachment;
} I830DRI2BufferPrivateRec, *I830DRI2BufferPrivatePtr;
+#ifndef USE_DRI2_1_1_0
static DRI2BufferPtr
I830DRI2CreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
{
@@ -1602,6 +150,7 @@ I830DRI2CreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
buffers[i].driverPrivate = &privates[i];
buffers[i].flags = 0; /* not tiled */
privates[i].pPixmap = pPixmap;
+ privates[i].attachment = attachments[i];
bo = i830_get_pixmap_bo (pPixmap);
if (dri_bo_flink(bo, &buffers[i].name) != 0) {
@@ -1613,6 +162,88 @@ I830DRI2CreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
return buffers;
}
+#else
+
+static DRI2BufferPtr
+I830DRI2CreateBuffer(DrawablePtr pDraw, unsigned int attachment,
+ unsigned int format)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ I830Ptr pI830 = I830PTR(pScrn);
+ DRI2BufferPtr buffers;
+ dri_bo *bo;
+ I830DRI2BufferPrivatePtr privates;
+ PixmapPtr pPixmap;
+
+ buffers = xcalloc(1, sizeof *buffers);
+ if (buffers == NULL)
+ return NULL;
+ privates = xcalloc(1, sizeof *privates);
+ if (privates == NULL) {
+ xfree(buffers);
+ return NULL;
+ }
+
+ if (attachment == DRI2BufferFrontLeft) {
+ if (pDraw->type == DRAWABLE_PIXMAP)
+ pPixmap = (PixmapPtr) pDraw;
+ else
+ pPixmap = (*pScreen->GetWindowPixmap)((WindowPtr) pDraw);
+ pPixmap->refcnt++;
+ } else {
+ unsigned int hint = 0;
+
+ switch (attachment) {
+ case DRI2BufferDepth:
+ case DRI2BufferDepthStencil:
+ if (SUPPORTS_YTILING(pI830))
+ hint = INTEL_CREATE_PIXMAP_TILING_Y;
+ else
+ hint = INTEL_CREATE_PIXMAP_TILING_X;
+ break;
+ case DRI2BufferFakeFrontLeft:
+ case DRI2BufferFakeFrontRight:
+ case DRI2BufferBackLeft:
+ case DRI2BufferBackRight:
+ hint = INTEL_CREATE_PIXMAP_TILING_X;
+ break;
+ }
+
+ if (!pI830->tiling ||
+ (!IS_I965G(pI830) && !pI830->kernel_exec_fencing))
+ hint = 0;
+
+ pPixmap = (*pScreen->CreatePixmap)(pScreen,
+ pDraw->width,
+ pDraw->height,
+ (format != 0)?format:pDraw->depth,
+ hint);
+
+ }
+
+
+ buffers->attachment = attachment;
+ buffers->pitch = pPixmap->devKind;
+ buffers->cpp = pPixmap->drawable.bitsPerPixel / 8;
+ buffers->driverPrivate = privates;
+ buffers->format = format;
+ buffers->flags = 0; /* not tiled */
+ privates->pPixmap = pPixmap;
+ privates->attachment = attachment;
+
+ bo = i830_get_pixmap_bo (pPixmap);
+ if (dri_bo_flink(bo, &buffers->name) != 0) {
+ /* failed to name buffer */
+ }
+
+ return buffers;
+}
+
+#endif
+
+#ifndef USE_DRI2_1_1_0
+
static void
I830DRI2DestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
{
@@ -1633,15 +264,37 @@ I830DRI2DestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
}
}
+#else
+
+static void
+I830DRI2DestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
+{
+ if (buffer) {
+ I830DRI2BufferPrivatePtr private = buffer->driverPrivate;
+ ScreenPtr pScreen = pDraw->pScreen;
+
+ (*pScreen->DestroyPixmap)(private->pPixmap);
+
+ xfree(private);
+ xfree(buffer);
+ }
+}
+
+#endif
+
static void
I830DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
- DRI2BufferPtr pDestBuffer, DRI2BufferPtr pSrcBuffer)
+ DRI2BufferPtr pDstBuffer, DRI2BufferPtr pSrcBuffer)
{
- I830DRI2BufferPrivatePtr private = pSrcBuffer->driverPrivate;
+ I830DRI2BufferPrivatePtr srcPrivate = pSrcBuffer->driverPrivate;
+ I830DRI2BufferPrivatePtr dstPrivate = pDstBuffer->driverPrivate;
ScreenPtr pScreen = pDraw->pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
- PixmapPtr pPixmap = private->pPixmap;
+ PixmapPtr pSrcPixmap = (srcPrivate->attachment == DRI2BufferFrontLeft)
+ ? (PixmapPtr) pDraw : srcPrivate->pPixmap;
+ PixmapPtr pDstPixmap = (dstPrivate->attachment == DRI2BufferFrontLeft)
+ ? (PixmapPtr) pDraw : dstPrivate->pPixmap;
RegionPtr pCopyClip;
GCPtr pGC;
@@ -1649,9 +302,9 @@ I830DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
pCopyClip = REGION_CREATE(pScreen, NULL, 0);
REGION_COPY(pScreen, pCopyClip, pRegion);
(*pGC->funcs->ChangeClip) (pGC, CT_REGION, pCopyClip, 0);
- ValidateGC(pDraw, pGC);
- (*pGC->ops->CopyArea)(&pPixmap->drawable,
- pDraw, pGC, 0, 0, pDraw->width, pDraw->height, 0, 0);
+ ValidateGC(&pDstPixmap->drawable, pGC);
+ (*pGC->ops->CopyArea)(&pSrcPixmap->drawable, &pDstPixmap->drawable,
+ pGC, 0, 0, pDraw->width, pDraw->height, 0, 0);
FreeScratchGC(pGC);
/* Emit a flush of the rendering cache, or on the 965 and beyond
@@ -1680,28 +333,53 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen)
int i;
struct stat sbuf;
dev_t d;
+#ifdef USE_DRI2_1_1_0
+ int dri2_major = 1;
+ int dri2_minor = 0;
+#endif
if (pI830->accel != ACCEL_UXA) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "DRI2 requires UXA\n");
return FALSE;
}
+#ifdef USE_DRI2_1_1_0
+ if (xf86LoaderCheckSymbol("DRI2Version")) {
+ DRI2Version(& dri2_major, & dri2_minor);
+ }
+
+ if (dri2_minor < 1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "DRI2 requires DRI2 module version 1.1.0 or later\n");
+ return FALSE;
+ }
+#endif
+
sprintf(buf, "pci:%04x:%02x:%02x.%d",
pI830->PciInfo->domain,
pI830->PciInfo->bus,
pI830->PciInfo->dev,
pI830->PciInfo->func);
- info.fd = -1;
-
-#ifdef XF86DRM_MODE
/* Use the already opened (master) fd from modesetting */
- if (pI830->use_drm_mode)
+ if (pI830->use_drm_mode) {
info.fd = pI830->drmSubFD;
-#endif
-
- if (info.fd < 0)
+ } else {
info.fd = drmOpen("i915", buf);
+ drmSetVersion sv;
+ int err;
+
+ /* Check that what we opened was a master or a master-capable FD,
+ * by setting the version of the interface we'll use to talk to it.
+ * (see DRIOpenDRMMaster() in DRI1)
+ */
+ sv.drm_di_major = 1;
+ sv.drm_di_minor = 1;
+ sv.drm_dd_major = -1;
+ err = drmSetInterfaceVersion(info.fd, &sv);
+ if (err != 0)
+ return FALSE;
+ }
if (info.fd < 0) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Failed to open DRM device\n");
@@ -1730,10 +408,19 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen)
info.driverName = IS_I965G(pI830) ? "i965" : "i915";
info.deviceName = p;
- info.version = 1;
+#ifdef USE_DRI2_1_1_0
+ info.version = 2;
+ info.CreateBuffers = NULL;
+ info.DestroyBuffers = NULL;
+ info.CreateBuffer = I830DRI2CreateBuffer;
+ info.DestroyBuffer = I830DRI2DestroyBuffer;
+#else
+ info.version = 1;
info.CreateBuffers = I830DRI2CreateBuffers;
info.DestroyBuffers = I830DRI2DestroyBuffers;
+#endif
+
info.CopyRegion = I830DRI2CopyRegion;
pI830->drmSubFD = info.fd;
@@ -1749,5 +436,3 @@ void I830DRI2CloseScreen(ScreenPtr pScreen)
DRI2CloseScreen(pScreen);
pI830->directRenderingType = DRI_NONE;
}
-
-#endif
diff --git a/src/i830_dri.h b/src/i830_dri.h
index 83ddd857..bedbcbe2 100644
--- a/src/i830_dri.h
+++ b/src/i830_dri.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h,v 1.6 2003/09/28 20:15:59 alanh Exp $ */
#ifndef _I830_DRI_H
#define _I830_DRI_H
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 7502d301..854ad0fb 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c,v 1.50 2004/02/20 00:06:00 alanh Exp $ */
/**************************************************************************
Copyright 2001 VA Linux Systems Inc., Fremont, California.
@@ -28,135 +27,12 @@ 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: Jeff Hartmann <jhartmann@valinux.com>
* Abraham van der Merwe <abraham@2d3d.co.za>
* David Dawes <dawes@xfree86.org>
* Alan Hourihane <alanh@tungstengraphics.com>
*/
-/*
- * Mode handling is based on the VESA driver written by:
- * Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
- */
-
-/*
- * Changes:
- *
- * 23/08/2001 Abraham van der Merwe <abraham@2d3d.co.za>
- * - Fixed display timing bug (mode information for some
- * modes were not initialized correctly)
- * - Added workarounds for GTT corruptions (I don't adjust
- * the pitches for 1280x and 1600x modes so we don't
- * need extra memory)
- * - The code will now default to 60Hz if LFP is connected
- * - Added different refresh rate setting code to work
- * around 0x4f02 BIOS bug
- * - BIOS workaround for some mode sets (I use legacy BIOS
- * calls for setting those)
- * - Removed 0x4f04, 0x01 (save state) BIOS call which causes
- * LFP to malfunction (do some house keeping and restore
- * modes ourselves instead - not perfect, but at least the
- * LFP is working now)
- * - Several other smaller bug fixes
- *
- * 06/09/2001 Abraham van der Merwe <abraham@2d3d.co.za>
- * - Preliminary local memory support (works without agpgart)
- * - DGA fixes (the code were still using i810 mode sets, etc.)
- * - agpgart fixes
- *
- * 18/09/2001
- * - Proper local memory support (should work correctly now
- * with/without agpgart module)
- * - more agpgart fixes
- * - got rid of incorrect GTT adjustments
- *
- * 09/10/2001
- * - Changed the DPRINTF() variadic macro to an ANSI C compatible
- * version
- *
- * 10/10/2001
- * - Fixed DPRINTF_stub(). I forgot the __...__ macros in there
- * instead of the function arguments :P
- * - Added a workaround for the 1600x1200 bug (Text mode corrupts
- * when you exit from any 1600x1200 mode and 1280x1024@85Hz. I
- * suspect this is a BIOS bug (hence the 1280x1024@85Hz case)).
- * For now I'm switching to 800x600@60Hz then to 80x25 text mode
- * and then restoring the registers - very ugly indeed.
- *
- * 15/10/2001
- * - Improved 1600x1200 mode set workaround. The previous workaround
- * was causing mode set problems later on.
- *
- * 18/10/2001
- * - Fixed a bug in I830BIOSLeaveVT() which caused a bug when you
- * switched VT's
- */
-/*
- * 07/2002 David Dawes
- * - Add Intel(R) 855GM/852GM support.
- */
-/*
- * 07/2002 David Dawes
- * - Cleanup code formatting.
- * - Improve VESA mode selection, and fix refresh rate selection.
- * - Don't duplicate functions provided in 4.2 vbe modules.
- * - Don't duplicate functions provided in the vgahw module.
- * - Rewrite memory allocation.
- * - Rewrite initialisation and save/restore state handling.
- * - Decouple the i810 support from i830 and later.
- * - Remove various unnecessary hacks and workarounds.
- * - Fix an 845G problem with the ring buffer not in pre-allocated
- * memory.
- * - Fix screen blanking.
- * - Clear the screen at startup so you don't see the previous session.
- * - Fix some HW cursor glitches, and turn HW cursor off at VT switch
- * and exit.
- *
- * 08/2002 Keith Whitwell
- * - Fix DRI initialisation.
- *
- *
- * 08/2002 Alan Hourihane and David Dawes
- * - Add XVideo support.
- *
- *
- * 10/2002 David Dawes
- * - Add Intel(R) 865G support.
- *
- *
- * 01/2004 Alan Hourihane
- * - Add Intel(R) 915G support.
- * - Add Dual Head and Clone capabilities.
- * - Add lid status checking
- * - Fix Xvideo with high-res LFP's
- * - Add ARGB HW cursor support
- *
- * 05/2005 Alan Hourihane
- * - Add Intel(R) 945G support.
- *
- * 09/2005 Alan Hourihane
- * - Add Intel(R) 945GM support.
- *
- * 10/2005 Alan Hourihane, Keith Whitwell, Brian Paul
- * - Added Rotation support
- *
- * 12/2005 Alan Hourihane, Keith Whitwell
- * - Add Intel(R) 965G support.
- */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -206,27 +82,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i830_hwmc.h"
#endif
-#ifdef XF86DRI
-#include "dri.h"
#include <sys/ioctl.h>
#include "i915_drm.h"
-#endif
-
-#ifdef XF86DRM_MODE
#include <xf86drmMode.h>
-#endif
-
-#ifdef I830_USE_EXA
-const char *I830exaSymbols[] = {
- "exaGetVersion",
- "exaDriverInit",
- "exaDriverFini",
- "exaOffscreenAlloc",
- "exaOffscreenFree",
- "exaWaitSync",
- NULL
-};
-#endif
#define BIT(x) (1 << (x))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
@@ -300,9 +158,7 @@ static PciChipsets I830PciChipsets[] = {
*/
typedef enum {
- OPTION_ACCELMETHOD,
OPTION_NOACCEL,
- OPTION_CACHE_LINES,
OPTION_DRI,
OPTION_VIDEO_KEY,
OPTION_COLOR_KEY,
@@ -320,9 +176,7 @@ typedef enum {
} I830Opts;
static OptionInfoRec I830Options[] = {
- {OPTION_ACCELMETHOD, "AccelMethod", OPTV_ANYSTR, {0}, FALSE},
{OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE},
{OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, TRUE},
{OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE},
{OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE},
@@ -341,15 +195,6 @@ static OptionInfoRec I830Options[] = {
};
/* *INDENT-ON* */
-const char *i830_output_type_names[] = {
- "Unused",
- "Analog",
- "DVO",
- "SDVO",
- "LVDS",
- "TVOUT",
-};
-
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);
@@ -361,8 +206,8 @@ extern void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y);
#ifdef I830DEBUG
void
-I830DPRINTF_stub(const char *filename, int line, const char *function,
- const char *fmt, ...)
+I830DPRINTF(const char *filename, int line, const char *function,
+ const char *fmt, ...)
{
va_list ap;
@@ -374,13 +219,6 @@ I830DPRINTF_stub(const char *filename, int line, const char *function,
va_end(ap);
ErrorF("##############################################\n\n");
}
-#else /* #ifdef I830DEBUG */
-void
-I830DPRINTF_stub(const char *filename, int line, const char *function,
- const char *fmt, ...)
-{
- /* do nothing */
-}
#endif /* #ifdef I830DEBUG */
/* Export I830 options to i830 driver where necessary */
@@ -427,20 +265,11 @@ static int
I830DetectMemory(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
-#if !XSERVER_LIBPCIACCESS
- PCITAG bridge;
-#endif
uint16_t gmch_ctrl;
int memsize = 0, gtt_size;
int range;
-
-#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 (IS_I965G(pI830)) {
/* The 965 may have a GTT that is actually larger than is necessary
@@ -585,15 +414,10 @@ I830DetectMemory(ScrnInfoPtr pScrn)
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,
@@ -607,20 +431,6 @@ I830MapMMIO(ScrnInfoPtr pScrn)
strerror (err), err);
return FALSE;
}
-#else
-
-#if !defined(__alpha__)
- mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT;
-#else
- mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE;
-#endif
-
- pI830->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
- pI830->PciTag,
- 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.
@@ -643,7 +453,6 @@ I830MapMMIO(ScrnInfoPtr pScrn)
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,
@@ -655,13 +464,6 @@ I830MapMMIO(ScrnInfoPtr pScrn)
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.
@@ -678,30 +480,17 @@ 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;
- 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);
if (err)
return FALSE;
-#else
- pI830->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
- pI830->PciTag,
- pI830->LinearAddr, pI830->FbMapSize);
- if (!pI830->FbBase)
- return FALSE;
-#endif
if (pI830->ring.mem != NULL) {
pI830->ring.virtual_start = pI830->FbBase + pI830->ring.mem->offset;
@@ -715,20 +504,11 @@ 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);
-#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;
}
}
@@ -738,12 +518,7 @@ 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);
-#endif
pI830->FbBase = NULL;
I830UnmapMMIO(pScrn);
return TRUE;
@@ -817,28 +592,47 @@ I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
}
}
-void
+static void
i830_update_front_offset(ScrnInfoPtr pScrn)
{
ScreenPtr pScreen = pScrn->pScreen;
I830Ptr pI830 = I830PTR(pScrn);
int pitch = pScrn->displayWidth * pI830->cpp;
+ pointer data = NULL;
/* Update buffer locations, which may have changed as a result of
* i830_bind_all_memory().
*/
pScrn->fbOffset = pI830->front_buffer->offset;
+ if (pI830->starting || pI830->accel == ACCEL_UXA)
+ return;
+
/* 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 && pI830->accel != ACCEL_UXA) {
- if (!pScreen->ModifyPixmapHeader(pScreen->GetScreenPixmap(pScreen),
+ if (!pI830->have_gem) {
+ data = pI830->FbBase + pScrn->fbOffset; /* default to legacy */
+ } else {
+ dri_bo *bo = pI830->front_buffer->bo;
+
+ if (bo) {
+ if (pI830->kernel_exec_fencing) {
+ if (drm_intel_gem_bo_map_gtt(bo))
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s: bo map failed\n",
+ __FUNCTION__);
+ data = bo->virtual;
+ } else {
+ /* Will already be pinned by bind_all_memory in this case */
+ drm_intel_gem_bo_start_gtt_access(bo, 1);
+ data = pI830->FbBase + bo->offset;
+ }
+ }
+ }
+ if (!pScreen->ModifyPixmapHeader(pScreen->GetScreenPixmap(pScreen),
pScrn->virtualX, pScrn->virtualY, -1, -1,
- pitch, (pointer)(pI830->FbBase +
- pScrn->fbOffset)))
+ pitch, data))
FatalError("Couldn't adjust screen pixmap\n");
- }
}
/**
@@ -859,14 +653,13 @@ i830CreateScreenResources(ScreenPtr pScreen)
i830_update_front_offset(pScrn);
-#ifdef I830_USE_UXA
if (pI830->accel == ACCEL_UXA)
i830_uxa_create_screen_resources(pScreen);
-#endif
+
return TRUE;
}
-int
+static int
i830_output_clones (ScrnInfoPtr pScrn, int type_mask)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (pScrn);
@@ -1125,7 +918,7 @@ i830_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
scrn->virtualX = width;
scrn->virtualY = height;
#ifdef DRI2
- if (i830->can_resize && i830->front_buffer)
+ if (i830->front_buffer)
{
i830_memory *new_front, *old_front;
Bool tiled;
@@ -1196,18 +989,13 @@ i830SetHotkeyControl(ScrnInfoPtr pScrn, int mode)
pI830->writeControl(pI830, GRX, 0x18, gr18);
}
-#ifdef XF86DRM_MODE
/*
* DRM mode setting Linux only at this point... later on we could
* add a wrapper here.
*/
static Bool i830_kernel_mode_enabled(ScrnInfoPtr pScrn)
{
-#if XSERVER_LIBPCIACCESS
struct pci_device *PciInfo;
-#else
- pciVideoPtr PciInfo;
-#endif
EntityInfoPtr pEnt;
char *busIdString;
int ret;
@@ -1221,15 +1009,20 @@ static Bool i830_kernel_mode_enabled(ScrnInfoPtr pScrn)
busIdString = DRICreatePCIBusID(PciInfo);
ret = drmCheckModesettingSupported(busIdString);
+ if (ret)
+ if (xf86LoadKernelModule("i915")) {
+ ret = drmCheckModesettingSupported(busIdString);
+
+ /* Be nice to the user and load fbcon too */
+ if (!ret)
+ (void) xf86LoadKernelModule("fbcon");
+ }
xfree(busIdString);
if (ret)
return FALSE;
return TRUE;
}
-#else
-#define i830_kernel_mode_enabled(x) FALSE
-#endif
static Bool
i830_detect_chipset(ScrnInfoPtr pScrn)
@@ -1254,11 +1047,7 @@ i830_detect_chipset(ScrnInfoPtr pScrn)
break;
case PCI_CHIP_I855_GM:
/* Check capid register to find the chipset variant */
-#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:
@@ -1437,19 +1226,11 @@ i830_detect_chipset(ScrnInfoPtr pScrn)
/* Now figure out mapsize on 8xx chips */
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;
- uint16_t 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 {
@@ -1457,12 +1238,7 @@ i830_detect_chipset(ScrnInfoPtr pScrn)
}
} else {
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;
@@ -1476,8 +1252,6 @@ static const char *accel_name[] =
{
"unspecified",
"no",
- "XAA",
- "EXA",
"UXA",
};
@@ -1570,49 +1344,12 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
MessageType from = X_PROBED;
- char *s;
int i, num_pipe;
if (xf86ReturnOptValBool(pI830->Options, OPTION_NOACCEL, FALSE)) {
pI830->accel = ACCEL_NONE;
- }
-
- /*
- * 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->accel == ACCEL_NONE)) {
-#ifdef I830_USE_UXA
- pI830->accel = ACCEL_UXA;
-#endif
-#ifdef I830_USE_EXA
- pI830->accel = ACCEL_EXA;
-#endif
-#if I830_USE_XAA + I830_USE_EXA + I830_USE_UXA >= 2
- from = X_DEFAULT;
- if ((s = (char *)xf86GetOptValString(pI830->Options,
- OPTION_ACCELMETHOD))) {
- if (!xf86NameCmp(s, "EXA")) {
- from = X_CONFIG;
- pI830->accel = ACCEL_EXA;
- }
- else if (!xf86NameCmp(s, "XAA")) {
- from = X_CONFIG;
- pI830->accel = ACCEL_XAA;
- }
- else if (!xf86NameCmp(s, "UXA")) {
- from = X_CONFIG;
- pI830->accel = ACCEL_UXA;
- }
- }
-#endif
+ } else {
+ pI830->accel = ACCEL_UXA;
xf86DrvMsg(pScrn->scrnIndex, from, "Using %s for acceleration\n",
accel_name[pI830->accel]);
}
@@ -1621,7 +1358,6 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
if (!xf86ReturnOptValBool(pI830->Options, OPTION_DRI, TRUE))
pI830->directRenderingType = DRI_DISABLED;
-#ifdef XF86DRI
if (pI830->accel == ACCEL_NONE) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it "
"needs 2D acceleration.\n");
@@ -1631,7 +1367,6 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
"runs only at depths 16 and 24.\n");
pI830->directRenderingType = DRI_DISABLED;
}
-#endif /* XF86DRI */
I830MapMMIO(pScrn);
@@ -1660,20 +1395,8 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
I830SetupOutputs(pScrn);
SaveHWState(pScrn);
- pI830->can_resize = FALSE;
- if (pI830->accel == ACCEL_UXA && pI830->directRenderingType != DRI_XF86DRI)
- pI830->can_resize = TRUE;
-#if !defined(DRI2) && defined(XF86DRI)
- /* Disable resizing so that DRI1 can initialize and give us GEM support. */
- pI830->can_resize = FALSE;
-#endif
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Resizable framebuffer: %s (%d %d)\n",
- pI830->can_resize ? "available" : "not available",
- pI830->directRenderingType, pI830->accel);
-
- if (!xf86InitialConfiguration (pScrn, pI830->can_resize))
+ if (!xf86InitialConfiguration (pScrn, TRUE))
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n");
RestoreHWState(pScrn);
@@ -1693,29 +1416,12 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
static Bool
I830DrmModeInit(ScrnInfoPtr pScrn)
{
-#ifdef XF86DRM_MODE
I830Ptr pI830 = I830PTR(pScrn);
char *bus_id;
- char *s;
int ret;
- /* Default to UXA but allow override */
pI830->accel = ACCEL_UXA;
- if ((s = (char *)xf86GetOptValString(pI830->Options, OPTION_ACCELMETHOD))) {
- if (xf86NameCmp(s, "UXA"))
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "kernel mode setting active,overridding accelmethod and using UXA\n");
- }
-
- pI830->can_resize = FALSE;
- if (pI830->accel == ACCEL_UXA && pI830->directRenderingType != DRI_XF86DRI)
- pI830->can_resize = TRUE;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Resizable framebuffer: %s (%d %d)\n",
- pI830->can_resize ? "available" : "not available",
- pI830->directRenderingType, pI830->accel);
-
bus_id = DRICreatePCIBusID(pI830->PciInfo);
/* Create a bus Id */
@@ -1738,10 +1444,9 @@ I830DrmModeInit(ScrnInfoPtr pScrn)
}
pI830->directRenderingType = DRI_NONE;
- pI830->allocate_classic_textures = FALSE;
+ pI830->have_gem = TRUE;
i830_init_bufmgr(pScrn);
-#endif
return TRUE;
}
@@ -1754,7 +1459,6 @@ I830XvInit(ScrnInfoPtr pScrn)
pI830->XvPreferOverlay = xf86ReturnOptValBool(pI830->Options, OPTION_PREFER_OVERLAY, FALSE);
-#ifdef I830_XV
if (xf86GetOptValInteger(pI830->Options, OPTION_VIDEO_KEY,
&(pI830->colorKey))) {
from = X_CONFIG;
@@ -1770,7 +1474,6 @@ I830XvInit(ScrnInfoPtr pScrn)
}
xf86DrvMsg(pScrn->scrnIndex, from, "video overlay key set to 0x%x\n",
pI830->colorKey);
-#endif
}
/**
@@ -1827,10 +1530,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
pI830->PciInfo = xf86GetPciInfoForEntity(pI830->pEnt->index);
-#if !XSERVER_LIBPCIACCESS
- pI830->PciTag = pciTag(pI830->PciInfo->bus, pI830->PciInfo->device,
- pI830->PciInfo->func);
-#endif
if (xf86RegisterResources(pI830->pEnt->index, NULL, ResNone)) {
PreInitCleanup(pScrn);
@@ -1922,43 +1621,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
xf86LoaderReqSymLists(I810fbSymbols, NULL);
- switch (pI830->accel) {
-#ifdef I830_USE_XAA
- case ACCEL_XAA:
- if (!xf86LoadSubModule(pScrn, "xaa")) {
- PreInitCleanup(pScrn);
- return FALSE;
- }
- xf86LoaderReqSymLists(I810xaaSymbols, NULL);
- break;
-#endif
-
-#ifdef I830_USE_EXA
- case ACCEL_EXA: {
- 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);
- break;
- }
-#endif
- default:
- break;
- }
-
if (!pI830->use_drm_mode) {
i830CompareRegsToSnapshot(pScrn, "After PreInit");
@@ -1970,23 +1632,11 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
xf86SetOperatingState(resVgaMem, pI830->pEnt->index, ResDisableOpr);
}
-#if defined(XF86DRI)
- /* Load the dri module if requested. */
- if (xf86ReturnOptValBool(pI830->Options, OPTION_DRI, FALSE) &&
- pI830->directRenderingType != DRI_DISABLED) {
- if (xf86LoadSubModule(pScrn, "dri")) {
- xf86LoaderReqSymLists(I810driSymbols, I810drmSymbols, NULL);
- }
- }
-#endif
-
-#if defined(DRI2)
/* Load the dri2 module if requested. */
if (xf86ReturnOptValBool(pI830->Options, OPTION_DRI, FALSE) &&
pI830->directRenderingType != DRI_DISABLED) {
xf86LoadSubModule(pScrn, "dri2");
}
-#endif
pI830->preinit = FALSE;
@@ -2074,7 +1724,6 @@ i830_refresh_ring(ScrnInfoPtr pScrn)
pI830->ring.space = pI830->ring.head - (pI830->ring.tail + 8);
if (pI830->ring.space < 0)
pI830->ring.space += pI830->ring.mem->size;
- i830MarkSync(pScrn);
}
enum pipe {
@@ -2262,9 +1911,6 @@ RestoreHWState(ScrnInfoPtr pScrn)
DPRINTF(PFX, "RestoreHWState\n");
-#ifdef XF86DRI
- I830DRISetVBlankInterrupt (pScrn, FALSE);
-#endif
/* Disable outputs */
for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i];
@@ -2521,46 +2167,6 @@ I830PointerMoved(int index, int x, int y)
(*pI830->PointerMoved)(index, newX, newY);
}
-static Bool
-I830InitFBManager(
- ScreenPtr pScreen,
- BoxPtr FullBox
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- RegionRec ScreenRegion;
- RegionRec FullRegion;
- BoxRec ScreenBox;
- Bool ret;
-
- ScreenBox.x1 = 0;
- ScreenBox.y1 = 0;
- ScreenBox.x2 = pScrn->displayWidth;
- if (pScrn->virtualX > pScrn->virtualY)
- ScreenBox.y2 = pScrn->virtualX;
- else
- ScreenBox.y2 = pScrn->virtualY;
-
- if((FullBox->x1 > ScreenBox.x1) || (FullBox->y1 > ScreenBox.y1) ||
- (FullBox->x2 < ScreenBox.x2) || (FullBox->y2 < ScreenBox.y2)) {
- return FALSE;
- }
-
- if (FullBox->y2 < FullBox->y1) return FALSE;
- if (FullBox->x2 < FullBox->x2) return FALSE;
-
- REGION_INIT(pScreen, &ScreenRegion, &ScreenBox, 1);
- REGION_INIT(pScreen, &FullRegion, FullBox, 1);
-
- REGION_SUBTRACT(pScreen, &FullRegion, &FullRegion, &ScreenRegion);
-
- ret = xf86InitFBManagerRegion(pScreen, &FullRegion);
-
- REGION_UNINIT(pScreen, &ScreenRegion);
- REGION_UNINIT(pScreen, &FullRegion);
-
- return ret;
-}
-
/**
* Intialiazes the hardware for the 3D pipeline use in the 2D driver.
*
@@ -2576,16 +2182,6 @@ IntelEmitInvarientState(ScrnInfoPtr pScrn)
if (pI830->accel == ACCEL_NONE)
return;
-#ifdef XF86DRI
- if (pI830->directRenderingType == DRI_XF86DRI) {
- 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.
*/
@@ -2632,18 +2228,14 @@ I830BlockHandler(int i,
* fashion.
*/
intel_batch_flush(pScrn, flushed);
-#ifdef XF86DRI
- if (pI830->memory_manager)
+ if (pI830->have_gem)
drmCommandNone(pI830->drmSubFD, DRM_I915_GEM_THROTTLE);
-#endif
pI830->need_mi_flush = FALSE;
}
-#ifdef I830_USE_UXA
if (pI830->accel == ACCEL_UXA)
i830_uxa_block_handler (pScreen);
-#endif
I830VideoBlockHandler(i, blockData, pTimeout, pReadmask);
}
@@ -2697,7 +2289,6 @@ i830_try_memory_allocation(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
Bool tiled = pI830->tiling;
- Bool xf86dri = pI830->directRenderingType == DRI_XF86DRI;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Attempting memory allocation with %stiled buffers.\n",
@@ -2710,9 +2301,6 @@ i830_try_memory_allocation(ScrnInfoPtr pScrn)
if (!i830_allocate_pwrctx(pScrn))
goto failed;
- if (xf86dri && !i830_allocate_3d_memory(pScrn))
- goto failed;
-
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%siled allocation successful.\n",
tiled ? "T" : "Unt");
return TRUE;
@@ -2740,7 +2328,7 @@ i830_memory_init(ScrnInfoPtr pScrn)
tiled = i830_tiled_width(pI830, &pScrn->displayWidth, pI830->cpp);
/* Set up our video memory allocator for the chosen videoRam */
- if (!i830_allocator_init(pScrn, 0, pScrn->videoRam * KB(1))) {
+ if (!i830_allocator_init(pScrn, pScrn->videoRam * KB(1))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Couldn't initialize video memory allocator\n");
PreInitCleanup(pScrn);
@@ -2751,14 +2339,6 @@ i830_memory_init(ScrnInfoPtr pScrn)
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;
- }
-
/* Tiled first if we got a good displayWidth */
if (tiled) {
if (i830_try_memory_allocation(pScrn))
@@ -2777,18 +2357,6 @@ i830_memory_init(ScrnInfoPtr pScrn)
"disabled\n");
pI830->fb_compression = FALSE;
- /* Try again, but leave DRI enabled */
- if (pI830->directRenderingType == DRI_XF86DRI) {
- if (i830_try_memory_allocation(pScrn))
- return TRUE;
- else {
- i830_reset_allocations(pScrn);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Couldn't allocate 3D memory, "
- "disabling DRI.\n");
- pI830->directRenderingType = DRI_NONE;
- }
- }
-
if (i830_try_memory_allocation(pScrn))
return TRUE;
@@ -2803,7 +2371,7 @@ i830_init_bufmgr(ScrnInfoPtr pScrn)
if (pI830->bufmgr)
return;
- if (pI830->memory_manager || pI830->use_drm_mode) {
+ if (pI830->have_gem) {
int batch_size;
batch_size = 4096 * 4;
@@ -2898,9 +2466,7 @@ I830SwapPipes(ScrnInfoPtr pScrn)
* alone in that case.
* Also make sure the DRM can handle the swap.
*/
- if (I830LVDSPresent(pScrn) && !IS_I965GM(pI830) && !IS_GM45(pI830) &&
- (pI830->directRenderingType != DRI_XF86DRI ||
- (pI830->directRenderingType == DRI_XF86DRI && pI830->drmMinor >= 10))) {
+ if (I830LVDSPresent(pScrn) && !IS_I965GM(pI830) && !IS_GM45(pI830)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "adjusting plane->pipe mappings "
"to allow for framebuffer compression\n");
for (c = 0; c < config->num_crtc; c++) {
@@ -2992,10 +2558,10 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
if (pI830->use_drm_mode) {
-#ifdef XF86DRM_MODE
- pI830->stolen_size = 0;
- pScrn->videoRam = ~0UL / KB(1);
-#endif
+ struct pci_device *const device = pI830->PciInfo;
+ int fb_bar = IS_I9XX(pI830) ? 2 : 0;
+
+ pScrn->videoRam = device->regions[fb_bar].size / 1024;
} else {
I830AdjustMemory(pScreen);
}
@@ -3005,14 +2571,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->directRenderingType = DRI_DRI2;
#endif
-#ifdef XF86DRI
- /* If DRI hasn't been explicitly disabled, try to initialize it.
- * It will be used by the memory allocator.
- */
- if (!pI830->can_resize && pI830->directRenderingType == DRI_NONE && I830DRIScreenInit(pScreen))
- pI830->directRenderingType = DRI_XF86DRI;
-#endif
-
/* Enable tiling by default */
pI830->tiling = TRUE;
@@ -3052,27 +2610,31 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->last_3d = LAST_3D_OTHER;
pI830->overlayOn = FALSE;
-#ifdef I830_XV
/*
* Set this so that the overlay allocation is factored in when
* appropriate.
*/
pI830->XvEnabled = TRUE;
-#endif
-
/* Need MMIO mapped to do GTT lookups during memory allocation. */
if (!pI830->use_drm_mode)
I830MapMMIO(pScrn);
+ /* Need FB mapped to set up the fake bufmgr if we end up doing that
+ * in i830_memory_init() -> i830_allocator_init().
+ */
+ if (!pI830->use_drm_mode) {
+ if (!I830MapMem(pScrn))
+ return FALSE;
+ pScrn->memPhysBase = (unsigned long)pI830->FbBase;
+ }
+
if (!i830_memory_init(pScrn)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Couldn't allocate video memory\n");
return FALSE;
}
- I830UnmapMMIO(pScrn);
-
i830_fixup_mtrrs(pScrn);
pI830->starting = TRUE;
@@ -3085,65 +2647,27 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!miSetPixmapDepths())
return FALSE;
-#ifdef I830_XV
if (pI830->accel == ACCEL_NONE) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Xv is disabled because it "
"needs 2D acceleration.\n");
pI830->XvEnabled = FALSE;
}
-#else
- pI830->XvEnabled = FALSE;
-#endif
if (pI830->accel != ACCEL_NONE && !pI830->use_drm_mode) {
- if (pI830->memory_manager == NULL && pI830->ring.mem->size == 0) {
+ if (!pI830->have_gem && pI830->ring.mem->size == 0) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Disabling acceleration because the ring buffer "
"allocation failed.\n");
pI830->accel = ACCEL_NONE;
}
}
-
- if (!pI830->use_drm_mode) {
- DPRINTF(PFX, "assert( if(!I830MapMem(pScrn)) )\n");
- if (!I830MapMem(pScrn))
- return FALSE;
- pScrn->memPhysBase = (unsigned long)pI830->FbBase;
- }
i830_init_bufmgr(pScrn);
-#ifdef XF86DRI
- /*
- * Setup DRI after visuals have been established, but before fbScreenInit
- * is called. fbScreenInit will eventually call into the drivers
- * InitGLXVisuals call back.
- */
- if (pI830->directRenderingType == DRI_XF86DRI) {
- if (pI830->accel == ACCEL_NONE) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DRI is disabled because it "
- "needs 2D acceleration.\n");
- pI830->directRenderingType = DRI_NONE;
- }
- }
-
- if (pI830->directRenderingType == DRI_XF86DRI &&
- !I830DRIDoMappings(pScreen))
- pI830->directRenderingType = DRI_NONE;
-
- /* If we failed for any reason, free DRI memory. */
- if (pI830->directRenderingType != DRI_XF86DRI &&
- pI830->back_buffer != NULL)
- i830_free_3d_memory(pScrn);
-
if (!pI830->use_drm_mode)
I830SwapPipes(pScrn);
-#endif
pScrn->fbOffset = pI830->front_buffer->offset;
- pI830->xoffset = (pScrn->fbOffset / pI830->cpp) % pScrn->displayWidth;
- pI830->yoffset = (pScrn->fbOffset / pI830->cpp) / pScrn->displayWidth;
-
if (!pI830->use_drm_mode) {
vgaHWSetMmioFuncs(hwp, pI830->MMIOBase, 0);
vgaHWGetIOBase(hwp);
@@ -3154,13 +2678,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
DPRINTF(PFX, "assert( if(!I830EnterVT(scrnIndex, 0)) )\n");
- if (pI830->accel <= ACCEL_XAA) {
- if (!I830InitFBManager(pScreen, &(pI830->FbMemBox))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to init memory manager\n");
- }
- }
-
if (pScrn->virtualX > pScrn->displayWidth)
pScrn->displayWidth = pScrn->virtualX;
@@ -3192,9 +2709,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86DiDGAInit (pScreen, pI830->LinearAddr + pScrn->fbOffset);
- DPRINTF(PFX,
- "assert( if(!I830InitFBManager(pScreen, &(pI830->FbMemBox))) )\n");
-
if (pI830->accel != ACCEL_NONE) {
if (!I830AccelInit(pScreen)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -3219,15 +2733,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Hardware cursor initialization failed\n");
-#ifdef XF86DRI
- /* Must be called before EnterVT, so we can acquire the DRI lock when
- * binding our memory.
- */
- if (pI830->directRenderingType == DRI_XF86DRI &&
- !I830DRIFinishScreenInit(pScreen))
- pI830->directRenderingType = DRI_NONE;
-#endif
-
/* Must force it before EnterVT, so we are in control of VT and
* later memory should be bound when allocating, e.g rotate_mem */
pScrn->vtSema = TRUE;
@@ -3260,30 +2765,22 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86DPMSInit(pScreen, xf86DPMSSet, 0);
-#ifdef I830_XV
#ifdef INTEL_XVMC
pI830->XvMCEnabled = FALSE;
- from = (pI830->directRenderingType == DRI_XF86DRI &&
- xf86GetOptValBool(pI830->Options, OPTION_XVMC,
- &pI830->XvMCEnabled)) ? X_CONFIG : X_DEFAULT;
+ from = xf86GetOptValBool(pI830->Options, OPTION_XVMC,
+ &pI830->XvMCEnabled) ? X_CONFIG : X_DEFAULT;
xf86DrvMsg(pScrn->scrnIndex, from, "Intel XvMC decoder %sabled\n",
pI830->XvMCEnabled ? "en" : "dis");
#endif
/* Init video */
if (pI830->XvEnabled)
I830InitVideo(pScreen);
-#endif
/* Setup 3D engine, needed for rotation too */
IntelEmitInvarientState(pScrn);
-#if defined(XF86DRI) || defined(DRI2)
+#if defined(DRI2)
switch (pI830->directRenderingType) {
- case DRI_XF86DRI:
- pI830->directRenderingOpen = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "direct rendering: XF86DRI Enabled\n");
- break;
case DRI_DRI2:
pI830->directRenderingOpen = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: DRI2 Enabled\n");
@@ -3324,7 +2821,7 @@ i830AdjustFrame(int scrnIndex, int x, int y, int flags)
xf86CrtcPtr crtc = output->crtc;
DPRINTF(PFX, "i830AdjustFrame: y = %d (+ %d), x = %d (+ %d)\n",
- x, pI830->xoffset, y, pI830->yoffset);
+ x, crtc->desiredX, y, crtc->desiredY);
if (pI830->use_drm_mode)
return;
@@ -3332,7 +2829,7 @@ i830AdjustFrame(int scrnIndex, int x, int y, int flags)
if (crtc && crtc->enabled)
{
/* Sync the engine before adjust frame */
- i830WaitSync(pScrn);
+ I830Sync(pScrn);
i830PipeSetBase(crtc, crtc->desiredX + x, crtc->desiredY + y);
crtc->x = output->initial_x + x;
crtc->y = output->initial_y + y;
@@ -3359,10 +2856,6 @@ I830LeaveVT(int scrnIndex, int flags)
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
I830Ptr pI830 = I830PTR(pScrn);
int ret;
-#ifndef HAVE_FREE_SHADOW
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- int o;
-#endif
DPRINTF(PFX, "Leave VT\n");
@@ -3374,32 +2867,7 @@ I830LeaveVT(int scrnIndex, int flags)
i830SetHotkeyControl(pScrn, HOTKEY_BIOS_SWITCH);
-#ifdef XF86DRI
- if (pI830->directRenderingOpen &&
- pI830->directRenderingType == DRI_XF86DRI) {
- DRILock(screenInfo.screens[pScrn->scrnIndex], 0);
-
- if (!pI830->memory_manager) {
- I830DRISetVBlankInterrupt (pScrn, FALSE);
- drmCtlUninstHandler(pI830->drmSubFD);
- }
- }
-#endif
-
-#ifndef HAVE_FREE_SHADOW
- for (o = 0; o < config->num_crtc; o++) {
- xf86CrtcPtr crtc = config->crtc[o];
-
- if (crtc->rotatedPixmap || crtc->rotatedData) {
- crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap,
- crtc->rotatedData);
- crtc->rotatedPixmap = NULL;
- crtc->rotatedData = NULL;
- }
- }
-#else
xf86RotateFreeShadow(pScrn);
-#endif
xf86_hide_cursors (pScrn);
@@ -3410,11 +2878,10 @@ I830LeaveVT(int scrnIndex, int flags)
/* Evict everything from the bufmgr, as we're about to lose ownership of
* the graphics memory.
*/
- if (!pI830->memory_manager)
+ if (!pI830->have_gem) {
intel_bufmgr_fake_evict_all(pI830->bufmgr);
-
- if (!pI830->memory_manager)
i830_stop_ring(pScrn, TRUE);
+ }
if (pI830->debug_modes) {
i830CompareRegsToSnapshot(pScrn, "After LeaveVT");
@@ -3426,8 +2893,7 @@ I830LeaveVT(int scrnIndex, int flags)
i830_unbind_all_memory(pScrn);
-#ifdef XF86DRI
- if (pI830->memory_manager && !pI830->use_drm_mode) {
+ if (pI830->have_gem && !pI830->use_drm_mode) {
int ret;
/* Tell the kernel to evict all buffer objects and block GTT usage while
@@ -3437,20 +2903,14 @@ I830LeaveVT(int scrnIndex, int flags)
if (ret != 0)
FatalError("DRM_I915_LEAVEVT failed: %s\n", strerror(ret));
}
-#endif /* XF86DRI */
- if ((pI830->accel == ACCEL_EXA || pI830->accel == ACCEL_UXA) && IS_I965G(pI830))
+ if (pI830->accel == ACCEL_UXA && IS_I965G(pI830))
gen4_render_state_cleanup(pScrn);
- if (pI830->AccelInfoRec)
- pI830->AccelInfoRec->NeedToSync = FALSE;
-
-#ifdef XF86DRI
ret = drmDropMaster(pI830->drmSubFD);
if (ret)
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "drmDropMaster failed: %s\n", strerror(ret));
-#endif
+ "drmDropMaster failed: %s\n", strerror(errno));
}
/*
@@ -3466,12 +2926,17 @@ I830EnterVT(int scrnIndex, int flags)
DPRINTF(PFX, "Enter VT\n");
-#ifdef XF86DRI
ret = drmSetMaster(pI830->drmSubFD);
- if (ret)
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "drmDropMaster failed: %s\n", strerror(ret));
-#endif
+ if (ret) {
+ if (errno == EINVAL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "drmSetMaster failed: 2.6.29 or newer kernel required for "
+ "multi-server DRI\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "drmSetMaster failed: %s\n", strerror(errno));
+ }
+ }
/*
* Only save state once per server generation since that's what most
@@ -3505,8 +2970,7 @@ I830EnterVT(int scrnIndex, int flags)
if (!pI830->use_drm_mode)
i830_disable_render_standby(pScrn);
-#ifdef XF86DRI
- if (pI830->memory_manager && !pI830->use_drm_mode) {
+ if (pI830->have_gem && !pI830->use_drm_mode) {
int ret;
/* Tell the kernel that we're back in control and ready for GTT
@@ -3516,7 +2980,6 @@ I830EnterVT(int scrnIndex, int flags)
if (ret != 0)
FatalError("DRM_I915_ENTERVT failed: %s\n", strerror(ret));
}
-#endif /* XF86DRI */
if (!i830_bind_all_memory(pScrn))
return FALSE;
@@ -3528,8 +2991,7 @@ I830EnterVT(int scrnIndex, int flags)
intel_batch_init(pScrn);
- if ((pI830->accel == ACCEL_EXA || pI830->accel == ACCEL_UXA) &&
- IS_I965G(pI830))
+ if (pI830->accel == ACCEL_UXA && IS_I965G(pI830))
gen4_render_state_init(pScrn);
if (!pI830->use_drm_mode) {
@@ -3539,7 +3001,7 @@ I830EnterVT(int scrnIndex, int flags)
}
/* Re-set up the ring. */
- if (!pI830->memory_manager) {
+ if (!pI830->have_gem) {
i830_stop_ring(pScrn, FALSE);
i830_start_ring(pScrn);
}
@@ -3568,54 +3030,6 @@ I830EnterVT(int scrnIndex, int flags)
i830DescribeOutputConfiguration(pScrn);
}
-#ifdef XF86DRI
- if (pI830->directRenderingType == DRI_XF86DRI) {
- /* HW status is fixed, we need to set it up before any drm
- * operation which accessing that page, like irq install, etc.
- */
- if (pI830->starting && !pI830->memory_manager) {
- if (pI830->hw_status != NULL && !I830DRISetHWS(pScrn)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Fail to setup hardware status page.\n");
- I830DRICloseScreen(pScrn->pScreen);
- return FALSE;
- }
- if (!pI830->memory_manager && !I830DRIInstIrqHandler(pScrn)) {
- I830DRICloseScreen(pScrn->pScreen);
- return FALSE;
- }
- }
-
- /* 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);
-
- if (!pI830->starting) {
- ScreenPtr pScreen = pScrn->pScreen;
- drmI830Sarea *sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
- int i;
-
- I830DRIResume(screenInfo.screens[scrnIndex]);
-
- if (!pI830->memory_manager)
- i830_refresh_ring(pScrn);
- I830Sync(pScrn);
-
- sarea->texAge++;
- for(i = 0; i < I830_NR_TEX_REGIONS+1 ; i++)
- sarea->texList[i].age = sarea->texAge;
-
- DPRINTF(PFX, "calling dri unlock\n");
- DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
- }
- pI830->LockHeld = 0;
- }
-#endif
-
/* Set the hotkey to just notify us. We could check its results
* periodically and attempt to do something, but it seems like we basically
* never get results when we should, and this should all be better handled
@@ -3645,9 +3059,6 @@ 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;
@@ -3665,65 +3076,42 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
vgaHWUnmapMem(pScrn);
}
- if (pI830->ScanlineColorExpandBuffers) {
- xfree(pI830->ScanlineColorExpandBuffers);
- 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->EXADriverPtr) {
- exaDriverFini(pScreen);
- xfree(pI830->EXADriverPtr);
- pI830->EXADriverPtr = NULL;
- }
-#endif
-#ifdef I830_USE_UXA
if (pI830->uxa_driver) {
uxa_driver_fini (pScreen);
xfree (pI830->uxa_driver);
pI830->uxa_driver = NULL;
}
-#endif
+ if (pI830->front_buffer) {
+ i830_set_pixmap_bo(pScreen->GetScreenPixmap(pScreen), NULL);
+ i830_free_memory(pScrn, pI830->front_buffer);
+ pI830->front_buffer = NULL;
+ }
+
xf86_cursors_fini (pScreen);
i830_allocator_fini(pScrn);
-#ifdef I830_XV
i965_free_video(pScrn);
-#endif
+ free(pI830->offscreenImages);
+ pI830->offscreenImages = NULL;
+
+ pScreen->CloseScreen = pI830->CloseScreen;
+ (*pScreen->CloseScreen) (scrnIndex, pScreen);
dri_bufmgr_destroy(pI830->bufmgr);
pI830->bufmgr = NULL;
-#ifdef XF86DRI
- if (pI830->directRenderingOpen &&
- pI830->directRenderingType == DRI_XF86DRI) {
- pI830->directRenderingOpen = FALSE;
- I830DRICloseScreen(pScreen);
- }
-#endif
-
-#ifdef DRI2
if (pI830->directRenderingOpen && pI830->directRenderingType == DRI_DRI2) {
pI830->directRenderingOpen = FALSE;
I830DRI2CloseScreen(pScreen);
}
-#endif
xf86GARTCloseScreen(scrnIndex);
pScrn->PointerMoved = pI830->PointerMoved;
pScrn->vtSema = FALSE;
pI830->closing = FALSE;
- pScreen->CloseScreen = pI830->CloseScreen;
- return (*pScreen->CloseScreen) (scrnIndex, pScreen);
+ return TRUE;
}
static ModeStatus
@@ -3825,108 +3213,6 @@ i830_pipe_to_crtc(ScrnInfoPtr pScrn, int pipe)
return NULL;
}
-#if 0
-/**
- * This function is used for testing of the screen detect functions from the
- * periodic timer.
- */
-static void
-i830MonitorDetectDebugger(ScrnInfoPtr pScrn)
-{
- Bool found_crt;
- I830Ptr pI830 = I830PTR(pScrn);
- int start, finish, i;
-
- 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();
-
- 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
-
-void
-i830WaitSync(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-
- switch (pI830->accel) {
-#ifdef I830_USE_XAA
- case ACCEL_XAA:
- if (pI830->AccelInfoRec && pI830->AccelInfoRec->NeedToSync) {
- (*pI830->AccelInfoRec->Sync)(pScrn);
- pI830->AccelInfoRec->NeedToSync = FALSE;
- }
- break;
-#endif
-#ifdef I830_USE_EXA
- case ACCEL_EXA:
- if (pI830->EXADriverPtr) {
- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
- exaWaitSync(pScreen);
- }
- break;
-#endif
-#ifdef I830_USE_UXA
- case ACCEL_UXA:
- if (pI830->uxa_driver && pI830->need_sync) {
- pI830->need_sync = FALSE;
- I830Sync(pScrn);
- }
- break;
-#endif
- default:
- break;
- }
-}
-
-void
-i830MarkSync(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-
- switch (pI830->accel) {
-#ifdef I830_USE_XAA
- case ACCEL_XAA:
- if (pI830->AccelInfoRec)
- pI830->AccelInfoRec->NeedToSync = TRUE;
- break;
-#endif
-#ifdef I830_USE_EXA
- case ACCEL_EXA:
- if (pI830->EXADriverPtr) {
- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
- exaMarkSync(pScreen);
- }
- break;
-#endif
-#ifdef I830_USE_UXA
- case ACCEL_UXA:
- if (pI830->uxa_driver)
- pI830->need_sync = TRUE;
- break;
-#endif
- default:
- break;
- }
-}
-
void
I830InitpScrn(ScrnInfoPtr pScrn)
{
diff --git a/src/i830_dvo.c b/src/i830_dvo.c
index 832c7625..a0e80743 100644
--- a/src/i830_dvo.c
+++ b/src/i830_dvo.c
@@ -61,7 +61,7 @@ static const char *ch7017_symbols[] = {
};
/* driver list */
-struct _I830DVODriver i830_dvo_drivers[] =
+static struct _I830DVODriver i830_dvo_drivers[] =
{
{
.type = I830_OUTPUT_DVO_TMDS,
@@ -370,7 +370,7 @@ static const xf86OutputFuncsRec i830_dvo_output_funcs = {
* Other chips with DVO LVDS will need to extend this to deal with the LVDS
* chip being on DVOB/C and having multiple pipes.
*/
-DisplayModePtr
+static DisplayModePtr
i830_dvo_get_current_mode (xf86OutputPtr output)
{
ScrnInfoPtr pScrn = output->scrn;
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 0a224864..824f032b 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -37,9 +37,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i810_reg.h"
#include "i915_drm.h"
#include <string.h>
-
-#define ALWAYS_SYNC 0
-#define ALWAYS_FLUSH 0
+#include <sys/mman.h>
const int I830CopyROP[16] =
{
@@ -81,21 +79,7 @@ const int I830PatternROP[16] =
ROP_1
};
-#ifdef I830_USE_UXA
static int uxa_pixmap_index;
-#endif
-
-#ifndef SERVER_1_5
-static inline void *dixLookupPrivate(DevUnion **privates, int *key)
-{
- return (*privates)[*key].ptr;
-}
-
-static inline void dixSetPrivate(DevUnion **privates, int *key, void *val)
-{
- (*privates)[*key].ptr = val;
-}
-#endif
/**
* Returns whether a given pixmap is tiled or not.
@@ -142,6 +126,9 @@ i830_get_aperture_space(ScrnInfoPtr pScrn, drm_intel_bo **bo_table, int num_bos)
{
I830Ptr pI830 = I830PTR(pScrn);
+ if (pI830->batch_bo == NULL)
+ I830FALLBACK("VT inactive\n");
+
bo_table[0] = pI830->batch_bo;
if (drm_intel_bufmgr_check_aperture_space(bo_table, num_bos) != 0) {
intel_batch_flush(pScrn, FALSE);
@@ -167,44 +154,11 @@ i830_pixmap_pitch_is_aligned(PixmapPtr pixmap)
return i830_pixmap_pitch(pixmap) % pI830->accel_pixmap_pitch_alignment == 0;
}
-static Bool
-i830_exa_pixmap_is_offscreen(PixmapPtr pPixmap)
-{
- ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
-
- if ((void *)pPixmap->devPrivate.ptr >= (void *)pI830->FbBase &&
- (void *)pPixmap->devPrivate.ptr <
- (void *)(pI830->FbBase + pI830->FbMapSize))
- {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
/**
- * I830EXASync - wait for a command to finish
- * @pScreen: current screen
- * @marker: marker command to wait for
- *
- * Wait for the command specified by @marker to finish, then return. We don't
- * actually do marker waits, though we might in the future. For now, just
- * wait for a full idle.
- */
-static void
-I830EXASync(ScreenPtr pScreen, int marker)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-
- I830Sync(pScrn);
-}
-
-/**
- * I830EXAPrepareSolid - prepare for a Solid operation, if possible
+ * Sets up hardware state for a series of solid fills.
*/
static Bool
-I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
+i830_uxa_prepare_solid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
@@ -214,7 +168,7 @@ I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
i830_get_pixmap_bo(pPixmap),
};
- if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planemask))
+ if (!UXA_PM_IS_SOLID(&pPixmap->drawable, planemask))
I830FALLBACK("planemask is not solid");
if (pPixmap->drawable.bitsPerPixel == 24)
@@ -251,7 +205,7 @@ I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
}
static void
-I830EXASolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
+i830_uxa_solid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
@@ -286,18 +240,11 @@ I830EXASolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
}
static void
-I830EXADoneSolid(PixmapPtr pPixmap)
+i830_uxa_done_solid(PixmapPtr pPixmap)
{
-#if ALWAYS_SYNC || ALWAYS_FLUSH
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
-#if ALWAYS_FLUSH
- intel_batch_flush(pScrn, FALSE);
-#endif
-#if ALWAYS_SYNC
- I830Sync(pScrn);
-#endif
-#endif
+ i830_debug_sync(pScrn);
}
/**
@@ -305,8 +252,8 @@ I830EXADoneSolid(PixmapPtr pPixmap)
* - support planemask using FULL_BLT_CMD?
*/
static Bool
-I830EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
- int ydir, int alu, Pixel planemask)
+i830_uxa_prepare_copy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
+ int ydir, int alu, Pixel planemask)
{
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
@@ -316,7 +263,7 @@ I830EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
i830_get_pixmap_bo(pDstPixmap),
};
- if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planemask))
+ if (!UXA_PM_IS_SOLID(&pSrcPixmap->drawable, planemask))
I830FALLBACK("planemask is not solid");
if (pDstPixmap->drawable.bitsPerPixel < 8)
@@ -346,8 +293,8 @@ I830EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
}
static void
-I830EXACopy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1,
- int dst_y1, int w, int h)
+i830_uxa_copy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1,
+ int dst_y1, int w, int h)
{
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
@@ -398,18 +345,11 @@ I830EXACopy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1,
}
static void
-I830EXADoneCopy(PixmapPtr pDstPixmap)
+i830_uxa_done_copy(PixmapPtr pDstPixmap)
{
-#if ALWAYS_SYNC || ALWAYS_FLUSH
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
-#if ALWAYS_FLUSH
- intel_batch_flush(pScrn, FALSE);
-#endif
-#if ALWAYS_SYNC
- I830Sync(pScrn);
-#endif
-#endif
+ i830_debug_sync(pScrn);
}
@@ -421,16 +361,9 @@ I830EXADoneCopy(PixmapPtr pDstPixmap)
void
i830_done_composite(PixmapPtr pDst)
{
-#if ALWAYS_SYNC || ALWAYS_FLUSH
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
-#if ALWAYS_FLUSH
- intel_batch_flush(pScrn, FALSE);
-#endif
-#if ALWAYS_SYNC
- I830Sync(pScrn);
-#endif
-#endif
+ i830_debug_sync(pScrn);
}
#define xFixedToFloat(val) \
@@ -516,267 +449,6 @@ i830_transform_is_affine (PictTransformPtr t)
return t->matrix[2][0] == 0 && t->matrix[2][1] == 0;
}
-#ifdef XF86DRM_MODE
-
-static void *
-I830EXACreatePixmap(ScreenPtr screen, int size, int align)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- I830Ptr i830 = I830PTR(scrn);
- struct i830_exa_pixmap_priv *new_priv;
-
- new_priv = xcalloc(1, sizeof(struct i830_exa_pixmap_priv));
- if (!new_priv)
- return NULL;
-
- if (size == 0)
- return new_priv;
-
- new_priv->bo = dri_bo_alloc(i830->bufmgr, "pixmap", size,
- i830->accel_pixmap_offset_alignment);
- if (!new_priv->bo) {
- xfree(new_priv);
- return NULL;
- }
-
- return new_priv;
-}
-
-static void
-I830EXADestroyPixmap(ScreenPtr pScreen, void *driverPriv)
-{
- struct i830_exa_pixmap_priv *priv = driverPriv;
-
- if (priv->bo)
- dri_bo_unreference(priv->bo);
- xfree(priv);
-}
-
-static Bool I830EXAPixmapIsOffscreen(PixmapPtr pPix)
-{
- struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix);
-
- if (driver_priv && driver_priv->bo)
- return TRUE;
-
- return FALSE;
-}
-
-static Bool I830EXAPrepareAccess(PixmapPtr pPix, int index)
-{
- ScreenPtr screen = pPix->drawable.pScreen;
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- I830Ptr i830 = I830PTR(scrn);
- struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix);
-
- if (!driver_priv) {
- xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: no driver private?\n",
- __FUNCTION__);
- return FALSE;
- }
-
- if (!driver_priv->bo) {
- xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: no buffer object?\n",
- __FUNCTION__);
- return TRUE;
- }
-
- intel_batch_flush(scrn, FALSE);
- if (i830->need_sync) {
- I830Sync(scrn);
- i830->need_sync = FALSE;
- }
- if (drm_intel_gem_bo_map_gtt(driver_priv->bo)) {
- xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: bo map failed\n",
- __FUNCTION__);
- return FALSE;
- }
- pPix->devPrivate.ptr = driver_priv->bo->virtual;
-
- return TRUE;
-}
-
-static void I830EXAFinishAccess(PixmapPtr pPix, int index)
-{
- ScreenPtr screen = pPix->drawable.pScreen;
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- I830Ptr i830 = I830PTR(scrn);
- struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix);
-
- if (!driver_priv) {
- xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: no driver private?\n",
- __FUNCTION__);
- return;
- }
-
- if (!driver_priv->bo) {
- xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: no buffer object?\n",
- __FUNCTION__);
- return;
- }
-
- dri_bo_unmap(driver_priv->bo);
- pPix->devPrivate.ptr = NULL;
- if (driver_priv->bo == i830->front_buffer->bo)
- i830->need_flush = TRUE;
-}
-
-static Bool I830EXAModifyPixmapHeader(PixmapPtr pPix, int width, int height,
- int depth, int bitsPerPixel, int devKind,
- pointer pPixData)
-{
- ScreenPtr pScreen = pPix->drawable.pScreen;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
- struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix);
-
- if (!driver_priv)
- return FALSE;
-
- if (pI830->use_drm_mode &&
- drmmode_is_rotate_pixmap(pScrn, pPixData, &driver_priv->bo)) {
- /* this is a rotate pixmap */
- dri_bo_unmap(driver_priv->bo);
- dri_bo_reference(driver_priv->bo);
- miModifyPixmapHeader(pPix, width, height, depth,
- bitsPerPixel, devKind, NULL);
- }
-
- if (pPixData == pI830->FbBase + pScrn->fbOffset) {
- if (driver_priv->bo)
- dri_bo_unreference(driver_priv->bo);
- driver_priv->bo =
- intel_bo_gem_create_from_name(pI830->bufmgr, "front",
- pI830->front_buffer->gem_name);
- if (!driver_priv->bo)
- return FALSE;
-
- miModifyPixmapHeader(pPix, width, height, depth,
- bitsPerPixel, devKind, NULL);
-
- return TRUE;
- }
- return FALSE;
-}
-
-#endif /* XF86DRM_MODE */
-
-Bool
-I830EXAInit(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
-
- pI830->EXADriverPtr = exaDriverAlloc();
- if (pI830->EXADriverPtr == NULL) {
- pI830->accel = ACCEL_NONE;
- return FALSE;
- }
- memset(pI830->EXADriverPtr, 0, sizeof(*pI830->EXADriverPtr));
-
- pI830->bufferOffset = 0;
- pI830->EXADriverPtr->exa_major = 2;
- /* If compiled against EXA 2.2, require 2.2 so we can use the
- * PixmapIsOffscreen hook.
- */
-#if EXA_VERSION_MINOR >= 2
- pI830->EXADriverPtr->exa_minor = 2;
-#else
- pI830->EXADriverPtr->exa_minor = 1;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "EXA compatibility mode. Output rotation rendering "
- "performance may suffer\n");
-#endif
- if (!pI830->use_drm_mode) {
- pI830->EXADriverPtr->memoryBase = pI830->FbBase;
- if (pI830->exa_offscreen) {
- pI830->EXADriverPtr->offScreenBase = pI830->exa_offscreen->offset;
- pI830->EXADriverPtr->memorySize = pI830->exa_offscreen->offset +
- pI830->exa_offscreen->size;
- } else {
- pI830->EXADriverPtr->offScreenBase = pI830->FbMapSize;
- pI830->EXADriverPtr->memorySize = pI830->FbMapSize;
- }
- pI830->EXADriverPtr->flags = EXA_OFFSCREEN_PIXMAPS;
- } else {
-#ifdef XF86DRM_MODE
- pI830->EXADriverPtr->flags = EXA_OFFSCREEN_PIXMAPS | EXA_HANDLES_PIXMAPS;
- pI830->EXADriverPtr->PrepareAccess = I830EXAPrepareAccess;
- pI830->EXADriverPtr->FinishAccess = I830EXAFinishAccess;
-#if EXA_VERSION_MINOR >= 4
- pI830->EXADriverPtr->CreatePixmap = I830EXACreatePixmap;
- pI830->EXADriverPtr->DestroyPixmap = I830EXADestroyPixmap;
- pI830->EXADriverPtr->PixmapIsOffscreen = I830EXAPixmapIsOffscreen;
- pI830->EXADriverPtr->ModifyPixmapHeader = I830EXAModifyPixmapHeader;
-#endif
-#endif /* XF86DRM_MODE */
- }
-
- DPRINTF(PFX, "EXA Mem: memoryBase 0x%x, end 0x%x, offscreen base 0x%x, "
- "memorySize 0x%x\n",
- pI830->EXADriverPtr->memoryBase,
- pI830->EXADriverPtr->memoryBase + pI830->EXADriverPtr->memorySize,
- pI830->EXADriverPtr->offScreenBase,
- pI830->EXADriverPtr->memorySize);
-
- pI830->EXADriverPtr->pixmapOffsetAlign = pI830->accel_pixmap_offset_alignment;
- pI830->EXADriverPtr->pixmapPitchAlign = pI830->accel_pixmap_pitch_alignment;
- pI830->EXADriverPtr->maxX = pI830->accel_max_x;
- pI830->EXADriverPtr->maxY = pI830->accel_max_y;
-
- /* Sync */
- pI830->EXADriverPtr->WaitMarker = I830EXASync;
-
- /* Solid fill */
- pI830->EXADriverPtr->PrepareSolid = I830EXAPrepareSolid;
- pI830->EXADriverPtr->Solid = I830EXASolid;
- pI830->EXADriverPtr->DoneSolid = I830EXADoneSolid;
-
- /* Copy */
- pI830->EXADriverPtr->PrepareCopy = I830EXAPrepareCopy;
- pI830->EXADriverPtr->Copy = I830EXACopy;
- pI830->EXADriverPtr->DoneCopy = I830EXADoneCopy;
-
- /* Composite */
- if (!IS_I9XX(pI830)) {
- pI830->EXADriverPtr->CheckComposite = i830_check_composite;
- pI830->EXADriverPtr->PrepareComposite = i830_prepare_composite;
- pI830->EXADriverPtr->Composite = i830_composite;
- pI830->EXADriverPtr->DoneComposite = i830_done_composite;
- } else if (IS_I915G(pI830) || IS_I915GM(pI830) ||
- IS_I945G(pI830) || IS_I945GM(pI830) || IS_G33CLASS(pI830))
- {
- pI830->EXADriverPtr->CheckComposite = i915_check_composite;
- pI830->EXADriverPtr->PrepareComposite = i915_prepare_composite;
- pI830->EXADriverPtr->Composite = i915_composite;
- pI830->EXADriverPtr->DoneComposite = i830_done_composite;
- } else {
- pI830->EXADriverPtr->CheckComposite = i965_check_composite;
- pI830->EXADriverPtr->PrepareComposite = i965_prepare_composite;
- pI830->EXADriverPtr->Composite = i965_composite;
- pI830->EXADriverPtr->DoneComposite = i830_done_composite;
- }
-#if EXA_VERSION_MINOR >= 2
- if (!pI830->use_drm_mode)
- pI830->EXADriverPtr->PixmapIsOffscreen = i830_exa_pixmap_is_offscreen;
-#endif
-
- if(!exaDriverInit(pScreen, pI830->EXADriverPtr)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "EXA initialization failed; trying older version\n");
- pI830->EXADriverPtr->exa_minor = 0;
- if(!exaDriverInit(pScreen, pI830->EXADriverPtr)) {
- xfree(pI830->EXADriverPtr);
- pI830->accel = ACCEL_NONE;
- return FALSE;
- }
- }
-
- I830SelectBuffer(pScrn, I830_SELECT_FRONT);
-
- return TRUE;
-}
-
dri_bo *
i830_get_pixmap_bo(PixmapPtr pixmap)
{
@@ -784,20 +456,10 @@ i830_get_pixmap_bo(PixmapPtr pixmap)
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
I830Ptr i830 = I830PTR(scrn);
-#ifdef I830_USE_UXA
- if (i830->accel == ACCEL_UXA) {
+ if (i830->accel == ACCEL_UXA)
return dixLookupPrivate(&pixmap->devPrivates, &uxa_pixmap_index);
- }
-#endif
-#ifdef XF86DRM_MODE
- if (i830->accel == ACCEL_EXA) {
- struct i830_exa_pixmap_priv *driver_priv =
- exaGetPixmapDriverPrivate(pixmap);
- return driver_priv ? driver_priv->bo : NULL;
- }
-#endif
-
- return NULL;
+ else
+ return NULL;
}
void
@@ -809,24 +471,12 @@ i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo)
if (old_bo)
dri_bo_unreference (old_bo);
-#if I830_USE_UXA
if (i830->accel == ACCEL_UXA) {
- dri_bo_reference(bo);
- dixSetPrivate(&pixmap->devPrivates, &uxa_pixmap_index, bo);
- }
-#endif
-#ifdef XF86DRM_MODE
- if (i830->accel == ACCEL_EXA) {
- struct i830_exa_pixmap_priv *driver_priv =
- exaGetPixmapDriverPrivate(pixmap);
- if (driver_priv) {
+ if (bo != NULL)
dri_bo_reference(bo);
- driver_priv->bo = bo;
- }
+ dixSetPrivate(&pixmap->devPrivates, &uxa_pixmap_index, bo);
}
-#endif
}
-#if defined(I830_USE_UXA)
static void
i830_uxa_set_pixmap_bo (PixmapPtr pixmap, dri_bo *bo)
@@ -837,8 +487,6 @@ i830_uxa_set_pixmap_bo (PixmapPtr pixmap, dri_bo *bo)
static Bool
i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
{
- ScrnInfoPtr pScrn = xf86Screens[pixmap->drawable.pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
dri_bo *bo = i830_get_pixmap_bo (pixmap);
if (bo) {
@@ -847,21 +495,28 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
I830Ptr i830 = I830PTR(scrn);
intel_batch_flush(scrn, FALSE);
- /* XXX: dri_bo_map should handle syncing for us, what's the deal? */
- if (i830->need_sync) {
- I830Sync(scrn);
- i830->need_sync = FALSE;
+
+ /* No VT sema or GEM? No GTT mapping. */
+ if (!scrn->vtSema || !i830->have_gem) {
+ if (dri_bo_map(bo, access == UXA_ACCESS_RW) != 0)
+ return FALSE;
+ pixmap->devPrivate.ptr = bo->virtual;
+ return TRUE;
}
- if (pScrn->vtSema && !pI830->use_drm_mode && pI830->memory_manager) {
+ /* Kernel manages fences at GTT map/fault time */
+ if (i830->kernel_exec_fencing) {
+ if (drm_intel_gem_bo_map_gtt(bo)) {
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: bo map failed\n",
+ __FUNCTION__);
+ return FALSE;
+ }
+ pixmap->devPrivate.ptr = bo->virtual;
+ } else { /* or not... */
if (drm_intel_bo_pin(bo, 4096) != 0)
return FALSE;
drm_intel_gem_bo_start_gtt_access(bo, access == UXA_ACCESS_RW);
- pixmap->devPrivate.ptr = pI830->FbBase + bo->offset;
- } else {
- if (dri_bo_map(bo, access == UXA_ACCESS_RW) != 0)
- return FALSE;
- pixmap->devPrivate.ptr = bo->virtual;
+ pixmap->devPrivate.ptr = i830->FbBase + bo->offset;
}
}
return TRUE;
@@ -870,8 +525,6 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
static void
i830_uxa_finish_access (PixmapPtr pixmap)
{
- ScrnInfoPtr pScrn = xf86Screens[pixmap->drawable.pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
dri_bo *bo = i830_get_pixmap_bo (pixmap);
if (bo) {
@@ -879,14 +532,20 @@ i830_uxa_finish_access (PixmapPtr pixmap)
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
I830Ptr i830 = I830PTR(scrn);
- if (pScrn->vtSema && !pI830->use_drm_mode && pI830->memory_manager)
- drm_intel_bo_unpin(bo);
- else
+ if (bo == i830->front_buffer->bo)
+ i830->need_flush = TRUE;
+
+ if (!scrn->vtSema || !i830->have_gem) {
dri_bo_unmap(bo);
+ pixmap->devPrivate.ptr = NULL;
+ return;
+ }
+ if (i830->kernel_exec_fencing)
+ drm_intel_gem_bo_unmap_gtt(bo);
+ else
+ drm_intel_bo_unpin(bo);
pixmap->devPrivate.ptr = NULL;
- if (bo == i830->front_buffer->bo)
- i830->need_flush = TRUE;
}
}
@@ -926,11 +585,7 @@ i830_uxa_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usag
if (w > 32767 || h > 32767)
return NullPixmap;
-#ifdef SERVER_1_5
pixmap = fbCreatePixmap (screen, 0, 0, depth, usage);
-#else
- pixmap = fbCreatePixmap (screen, 0, 0, depth);
-#endif
if (w && h)
{
@@ -975,18 +630,6 @@ i830_uxa_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usag
return pixmap;
}
-
-#ifndef SERVER_1_5
-static PixmapPtr
-i830_uxa_server_14_create_pixmap (ScreenPtr screen, int w, int h, int depth)
-{
- /* For server pre-1.6, we're never allocating DRI2 buffers, so no need for
- * a hint.
- */
- return i830_uxa_create_pixmap(screen, w, h, depth, 0);
-}
-#endif
-
static Bool
i830_uxa_destroy_pixmap (PixmapPtr pixmap)
{
@@ -1019,13 +662,8 @@ i830_uxa_init (ScreenPtr pScreen)
ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
I830Ptr i830 = I830PTR(scrn);
-#ifdef SERVER_1_5
if (!dixRequestPrivate(&uxa_pixmap_index, 0))
return FALSE;
-#else
- if (!AllocatePixmapPrivate(pScreen, uxa_pixmap_index, 0))
- return FALSE;
-#endif
i830->uxa_driver = uxa_driver_alloc();
if (i830->uxa_driver == NULL) {
@@ -1039,14 +677,14 @@ i830_uxa_init (ScreenPtr pScreen)
i830->uxa_driver->uxa_minor = 0;
/* Solid fill */
- i830->uxa_driver->prepare_solid = I830EXAPrepareSolid;
- i830->uxa_driver->solid = I830EXASolid;
- i830->uxa_driver->done_solid = I830EXADoneSolid;
+ i830->uxa_driver->prepare_solid = i830_uxa_prepare_solid;
+ i830->uxa_driver->solid = i830_uxa_solid;
+ i830->uxa_driver->done_solid = i830_uxa_done_solid;
/* Copy */
- i830->uxa_driver->prepare_copy = I830EXAPrepareCopy;
- i830->uxa_driver->copy = I830EXACopy;
- i830->uxa_driver->done_copy = I830EXADoneCopy;
+ i830->uxa_driver->prepare_copy = i830_uxa_prepare_copy;
+ i830->uxa_driver->copy = i830_uxa_copy;
+ i830->uxa_driver->done_copy = i830_uxa_done_copy;
/* Composite */
if (!IS_I9XX(i830)) {
@@ -1080,33 +718,10 @@ i830_uxa_init (ScreenPtr pScreen)
return FALSE;
}
-#ifdef SERVER_1_5
pScreen->CreatePixmap = i830_uxa_create_pixmap;
-#else
- pScreen->CreatePixmap = i830_uxa_server_14_create_pixmap;
-#endif
pScreen->DestroyPixmap = i830_uxa_destroy_pixmap;
- I830SelectBuffer(scrn, I830_SELECT_FRONT);
-
uxa_set_fallback_debug(pScreen, i830->fallback_debug);
return TRUE;
}
-#endif /* I830_USE_UXA */
-
-#ifdef XF86DRI
-
-#ifndef ExaOffscreenMarkUsed
-extern void ExaOffscreenMarkUsed(PixmapPtr);
-#endif
-
-unsigned long long
-I830TexOffsetStart(PixmapPtr pPix)
-{
- exaMoveInPixmap(pPix);
- ExaOffscreenMarkUsed(pPix);
-
- return exaGetPixmapOffset(pPix);
-}
-#endif
diff --git a/src/i830_hdmi.c b/src/i830_hdmi.c
index 05aa9acf..0abb1512 100644
--- a/src/i830_hdmi.c
+++ b/src/i830_hdmi.c
@@ -33,6 +33,7 @@
#include "i830.h"
#include "xf86Modes.h"
#include "i830_display.h"
+#include "X11/Xatom.h"
struct i830_hdmi_priv {
uint32_t output_reg;
@@ -40,8 +41,12 @@ struct i830_hdmi_priv {
uint32_t save_SDVO;
Bool has_hdmi_sink;
+ /* Default 0 for full RGB range 0-255, 1 is for RGB range 16-235 */
+ uint32_t broadcast_rgb;
};
+static Atom broadcast_atom;
+
static int
i830_hdmi_mode_valid(xf86OutputPtr output, DisplayModePtr mode)
{
@@ -214,7 +219,91 @@ i830_hdmi_destroy (xf86OutputPtr output)
}
}
+static void
+i830_hdmi_create_resources(xf86OutputPtr output)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ I830Ptr pI830 = I830PTR(pScrn);
+ I830OutputPrivatePtr intel_output = output->driver_private;
+ struct i830_hdmi_priv *dev_priv = intel_output->dev_priv;
+ INT32 broadcast_range[2];
+ int err;
+
+ /* only R G B are 8bit color mode */
+ if (pScrn->depth != 24 ||
+ /* only 965G and G4X platform */
+ !(IS_I965G(pI830) || IS_G4X(pI830)))
+ return;
+
+ broadcast_atom =
+ MakeAtom("BROADCAST_RGB", sizeof("BROADCAST_RGB") - 1, TRUE);
+
+ broadcast_range[0] = 0;
+ broadcast_range[1] = 1;
+ err = RRConfigureOutputProperty(output->randr_output,
+ broadcast_atom,
+ FALSE, TRUE, FALSE, 2, broadcast_range);
+ if (err != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "RRConfigureOutputProperty error, %d\n", err);
+ return;
+ }
+ /* Set the current value of the broadcast property as full range */
+ dev_priv->broadcast_rgb = 0;
+ err = RRChangeOutputProperty(output->randr_output,
+ broadcast_atom,
+ XA_INTEGER, 32, PropModeReplace,
+ 1, &dev_priv->broadcast_rgb,
+ FALSE, TRUE);
+ if (err != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "RRChangeOutputProperty error, %d\n", err);
+ return;
+ }
+}
+
+static Bool
+i830_hdmi_set_property(xf86OutputPtr output, Atom property,
+ RRPropertyValuePtr value)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ I830Ptr pI830 = I830PTR(pScrn);
+ I830OutputPrivatePtr intel_output = output->driver_private;
+ struct i830_hdmi_priv *dev_priv = intel_output->dev_priv;
+ uint32_t temp;
+
+ if (property == broadcast_atom) {
+ uint32_t val;
+
+ if (value->type != XA_INTEGER || value->format != 32 ||
+ value->size != 1)
+ {
+ return FALSE;
+ }
+
+ val = *(INT32 *)value->data;
+ if (val < 0 || val > 1)
+ {
+ return FALSE;
+ }
+ if (val == dev_priv->broadcast_rgb)
+ return TRUE;
+
+ temp = INREG(dev_priv->output_reg);
+
+ if (val == 1)
+ temp |= SDVO_COLOR_NOT_FULL_RANGE;
+ else if (val == 0)
+ temp &= ~SDVO_COLOR_NOT_FULL_RANGE;
+
+ OUTREG(dev_priv->output_reg, temp);
+ dev_priv->broadcast_rgb = val;
+ }
+ return TRUE;
+}
+
static const xf86OutputFuncsRec i830_hdmi_output_funcs = {
+ .create_resources = i830_hdmi_create_resources,
.dpms = i830_hdmi_dpms,
.save = i830_hdmi_save,
.restore = i830_hdmi_restore,
@@ -225,6 +314,7 @@ static const xf86OutputFuncsRec i830_hdmi_output_funcs = {
.commit = i830_output_commit,
.detect = i830_hdmi_detect,
.get_modes = i830_ddc_get_modes,
+ .set_property = i830_hdmi_set_property,
.destroy = i830_hdmi_destroy
};
diff --git a/src/i830_hwmc.c b/src/i830_hwmc.c
index 7360c364..fc3faaaa 100644
--- a/src/i830_hwmc.c
+++ b/src/i830_hwmc.c
@@ -35,7 +35,7 @@
struct intel_xvmc_driver *xvmc_driver;
/* set global current driver for xvmc */
-Bool intel_xvmc_set_driver(struct intel_xvmc_driver *d)
+static Bool intel_xvmc_set_driver(struct intel_xvmc_driver *d)
{
if (xvmc_driver) {
ErrorF("XvMC driver already set!\n");
diff --git a/src/i830_hwmc.h b/src/i830_hwmc.h
index d0dc15b2..062234c2 100644
--- a/src/i830_hwmc.h
+++ b/src/i830_hwmc.h
@@ -102,7 +102,6 @@ extern struct intel_xvmc_driver i915_xvmc_driver;
extern struct intel_xvmc_driver i965_xvmc_driver;
extern struct intel_xvmc_driver vld_xvmc_driver;
-extern Bool intel_xvmc_set_driver(struct intel_xvmc_driver *);
extern Bool intel_xvmc_probe(ScrnInfoPtr);
extern Bool intel_xvmc_driver_init(ScreenPtr, XF86VideoAdaptorPtr);
extern Bool intel_xvmc_screen_init(ScreenPtr);
diff --git a/src/i830_lvds.c b/src/i830_lvds.c
index 7569e99d..064810f6 100644
--- a/src/i830_lvds.c
+++ b/src/i830_lvds.c
@@ -207,12 +207,8 @@ i830_lvds_set_backlight_legacy(xf86OutputPtr output, int level)
ScrnInfoPtr pScrn = output->scrn;
I830Ptr pI830 = I830PTR(pScrn);
-#if XSERVER_LIBPCIACCESS
pci_device_cfg_write_u8(pI830->PciInfo, level,
LEGACY_BACKLIGHT_BRIGHTNESS);
-#else
- pciWriteByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS, level);
-#endif
}
static int
@@ -222,11 +218,7 @@ i830_lvds_get_backlight_legacy(xf86OutputPtr output)
I830Ptr pI830 = I830PTR(pScrn);
uint8_t lbb;
-#if XSERVER_LIBPCIACCESS
pci_device_cfg_read_u8(pI830->PciInfo, &lbb, LEGACY_BACKLIGHT_BRIGHTNESS);
-#else
- lbb = pciReadByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS);
-#endif
return lbb;
}
@@ -242,22 +234,14 @@ i830_lvds_set_backlight_combo(xf86OutputPtr output, int level)
uint32_t blc_pwm_ctl;
uint8_t lbb;
-#if XSERVER_LIBPCIACCESS
pci_device_cfg_read_u8(pI830->PciInfo, &lbb, LEGACY_BACKLIGHT_BRIGHTNESS);
-#else
- lbb = pciReadByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS);
-#endif
/*
* If LBB is zero and we're shooting for a non-zero brightness level,
* we have to increase LBB by at least 1.
*/
if (!lbb && level) {
-#if XSERVER_LIBPCIACCESS
pci_device_cfg_write_u8(pI830->PciInfo, 1,
LEGACY_BACKLIGHT_BRIGHTNESS);
-#else
- pciWriteByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS, 1);
-#endif
}
/*
@@ -881,6 +865,13 @@ i830_lvds_mode_set(xf86OutputPtr output, DisplayModePtr mode,
static xf86OutputStatus
i830_lvds_detect(xf86OutputPtr output)
{
+ /* Fallback to origin, mark LVDS always connected.
+ * From wider tests, we have seen both broken cases with
+ * ACPI lid and SWF bit. So disable them for now until we
+ * get a reliable way for LVDS detect.
+ */
+ return XF86OutputStatusConnected;
+
enum lid_status lid;
lid = i830_lvds_acpi_lid_open(output);
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 052d906e..2a697a7d 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_memory.c,v 1.9 2003/09/24 03:16:54 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -29,19 +28,6 @@ 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:
* Keith Whitwell <keith@tungstengraphics.com>
* David Dawes <dawes@xfree86.org>
@@ -64,19 +50,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* - Ring buffer
* - HW cursor block (either one block or four)
* - Overlay registers
- * - XAA linear allocator (optional)
- * - 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)
+ * - Front buffer (screen 1)
+ * - Front buffer (screen 2, only in zaphod mode)
* - 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
@@ -107,9 +86,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i830.h"
#include "i810_reg.h"
-#ifdef XF86DRI
#include "i915_drm.h"
-#endif
#define ALIGN(i,m) (((i) + (m) - 1) & ~((m) - 1))
@@ -185,7 +162,7 @@ i830_get_fence_pitch(I830Ptr pI830, unsigned long pitch, int format)
* On some chips, pitch width has to be a power of two tile width, so
* calculate that here.
*/
-unsigned long
+static unsigned long
i830_get_fence_alignment(I830Ptr pI830, unsigned long size)
{
if (IS_I965G(pI830))
@@ -225,7 +202,6 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
if (mem == NULL || mem->bound)
return TRUE;
-#ifdef XF86DRI
if (mem->bo != NULL) {
if (dri_bo_pin(mem->bo, mem->alignment) != 0) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -238,7 +214,6 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
mem->offset = mem->bo->offset;
mem->end = mem->offset + mem->size;
}
-#endif
if (!mem->bound) {
if (!pI830->gtt_acquired)
@@ -274,7 +249,6 @@ i830_unbind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
!pI830->kernel_exec_fencing)
i830_clear_tiling(pScrn, mem->fence_nr);
-#ifdef XF86DRI
if (mem->bo != NULL) {
if (dri_bo_unpin(mem->bo) == 0) {
mem->bound = FALSE;
@@ -286,7 +260,6 @@ i830_unbind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
return FALSE;
}
}
-#endif
if (mem->key == -1 || xf86UnbindGARTMemory(pScrn->scrnIndex, mem->key)) {
mem->bound = FALSE;
@@ -305,7 +278,6 @@ i830_free_memory(ScrnInfoPtr pScrn, i830_memory *mem)
/* Free any AGP memory. */
i830_unbind_memory(pScrn, mem);
-#ifdef XF86DRI
if (mem->bo != NULL) {
I830Ptr pI830 = I830PTR(pScrn);
dri_bo_unreference (mem->bo);
@@ -323,7 +295,6 @@ i830_free_memory(ScrnInfoPtr pScrn, i830_memory *mem)
xfree(mem);
return;
}
-#endif
/* Disconnect from the list of allocations */
if (mem->prev != NULL)
mem->prev->next = mem->next;
@@ -352,14 +323,12 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
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);
}
@@ -379,34 +348,12 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
pI830->cursor_mem_argb[p] = NULL;
}
pI830->front_buffer = NULL;
- pI830->xaa_scratch = NULL;
- pI830->exa_offscreen = NULL;
pI830->overlay_regs = NULL;
pI830->power_context = NULL;
-#ifdef XF86DRI
- pI830->back_buffer = NULL;
- pI830->depth_buffer = NULL;
- pI830->textures = NULL;
-#endif
pI830->ring.mem = NULL;
pI830->fake_bufmgr_mem = NULL;
}
-void
-i830_free_3d_memory(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-
-#ifdef XF86DRI
- i830_free_memory(pScrn, pI830->back_buffer);
- pI830->back_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.
@@ -417,17 +364,13 @@ i830_free_3d_memory(ScrnInfoPtr pScrn)
* addresses to reference.
*/
Bool
-i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
+i830_allocator_init(ScrnInfoPtr pScrn, unsigned long size)
{
I830Ptr pI830 = I830PTR(pScrn);
i830_memory *start, *end;
-#ifdef XF86DRI
- int dri_major, dri_minor, dri_patch;
struct drm_i915_getparam gp;
struct drm_i915_setparam sp;
int has_gem;
- int has_dri;
-#endif
start = xcalloc(1, sizeof(*start));
if (start == NULL)
@@ -452,30 +395,21 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
}
start->key = -1;
- start->offset = offset;
+ start->offset = 0;
start->end = start->offset;
start->size = 0;
start->next = end;
end->key = -1;
- end->offset = offset + size;
+ end->offset = size;
end->end = end->offset;
end->size = 0;
end->prev = start;
pI830->memory_list = start;
-#ifdef XF86DRI
has_gem = FALSE;
- has_dri = FALSE;
-
- if (pI830->directRenderingType == DRI_XF86DRI &&
- xf86LoaderCheckSymbol ("DRIQueryVersion"))
- {
- DRIQueryVersion(&dri_major, &dri_minor, &dri_patch);
- has_dri = TRUE;
- }
- if (pI830->directRenderingType >= DRI_XF86DRI)
+ if (pI830->directRenderingType >= DRI_DRI2)
{
has_gem = FALSE;
gp.param = I915_PARAM_HAS_GEM;
@@ -490,10 +424,7 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
* 5.4 or newer so we can rely on the lock being held after DRIScreenInit,
* rather than after DRIFinishScreenInit.
*/
- if ((pI830->directRenderingType == DRI_XF86DRI && has_gem && has_dri &&
- (dri_major > 5 || (dri_major == 5 && dri_minor >= 4))) ||
- (pI830->directRenderingType == DRI_DRI2 && has_gem))
- {
+ if (pI830->directRenderingType == DRI_DRI2 && has_gem) {
int mmsize;
/* Take over all of the graphics aperture minus enough to for
@@ -501,11 +432,6 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
*/
mmsize = size;
- /* EXA area is fixed. */
- if (pI830->accel == ACCEL_EXA) {
- mmsize -= ROUND_TO_PAGE(3 * pScrn->displayWidth * pI830->cpp *
- pScrn->virtualY);
- }
/* Overlay and cursors, if physical, need to be allocated outside
* of the kernel memory manager.
*/
@@ -533,14 +459,15 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
struct drm_i915_gem_init init;
int ret;
- sp.param = I915_SETPARAM_NUM_USED_FENCES;
- sp.value = 0; /* kernel gets them all */
-
- ret = drmCommandWrite(pI830->drmSubFD, DRM_I915_SETPARAM, &sp,
- sizeof(sp));
- if (ret == 0)
- pI830->kernel_exec_fencing = TRUE;
+ if (pI830->accel == ACCEL_UXA) {
+ sp.param = I915_SETPARAM_NUM_USED_FENCES;
+ sp.value = 0; /* kernel gets them all */
+ ret = drmCommandWrite(pI830->drmSubFD, DRM_I915_SETPARAM,
+ &sp, sizeof(sp));
+ if (ret == 0)
+ pI830->kernel_exec_fencing = TRUE;
+ }
init.gtt_start = pI830->memory_manager->offset;
init.gtt_end = pI830->memory_manager->offset +
pI830->memory_manager->size;
@@ -553,6 +480,7 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
i830_free_memory(pScrn, pI830->memory_manager);
pI830->memory_manager = NULL;
}
+ pI830->have_gem = TRUE;
i830_init_bufmgr(pScrn);
}
} else {
@@ -561,10 +489,7 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
i830_free_memory(pScrn, pI830->memory_manager);
pI830->memory_manager = NULL;
}
- } else {
- pI830->allocate_classic_textures = TRUE;
}
-#endif /* XF86DRI */
return TRUE;
}
@@ -579,7 +504,6 @@ i830_allocator_fini(ScrnInfoPtr pScrn)
/* The memory manager is more special */
if (pI830->memory_manager) {
- /* XXX drmMMTakedown(pI830->drmSubFD, DRM_BO_MEM_TT);*/
i830_free_memory(pScrn, pI830->memory_manager);
pI830->memory_manager = NULL;
}
@@ -797,7 +721,6 @@ i830_allocate_agp_memory(ScrnInfoPtr pScrn, i830_memory *mem, int flags)
return TRUE;
}
-#ifdef XF86DRI
static i830_memory *
i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
unsigned long size, unsigned long pitch,
@@ -876,6 +799,9 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
}
}
+ if (flags & DISABLE_REUSE)
+ drm_intel_bo_disable_reuse(mem->bo);
+
/* Insert new allocation into the list */
mem->prev = NULL;
mem->next = pI830->bo_list;
@@ -885,7 +811,6 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
return mem;
}
-#endif /* XF86DRI */
/* Allocates video memory at the given size, pitch, alignment and tile format.
*
@@ -912,9 +837,7 @@ i830_allocate_memory(ScrnInfoPtr pScrn, const char *name,
enum tile_format tile_format)
{
i830_memory *mem;
-#ifdef XF86DRI
I830Ptr pI830 = I830PTR(pScrn);
-#endif
/* Manage tile alignment and size constraints */
if (tile_format != TILE_NONE) {
@@ -934,14 +857,12 @@ i830_allocate_memory(ScrnInfoPtr pScrn, const char *name,
size = i830_get_fence_size(pI830, size);
alignment = i830_get_fence_alignment(pI830, size);
}
-#ifdef XF86DRI
if (pI830->use_drm_mode || (pI830->memory_manager &&
!(flags & NEED_PHYSICAL_ADDR) &&
!(flags & NEED_LIFETIME_FIXED)))
{
return i830_allocate_memory_bo(pScrn, name, size, pitch, alignment, flags, tile_format);
} else
-#endif /* XF86DRI */
{
mem = i830_allocate_aperture(pScrn, name, size, pitch, alignment, flags, tile_format);
if (mem == NULL)
@@ -958,8 +879,6 @@ i830_allocate_memory(ScrnInfoPtr pScrn, const char *name,
}
}
- mem->tiling = TILE_NONE;
-
return mem;
}
@@ -1066,13 +985,12 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn)
}
pI830->ring.tail_mask = pI830->ring.mem->size - 1;
+ pI830->ring.virtual_start = pI830->FbBase + pI830->ring.mem->offset;
return TRUE;
}
-#ifdef I830_XV
/**
- * Allocate space for overlay registers and XAA linear allocator (if
- * requested)
+ * Allocate space for overlay registers.
*/
static Bool
i830_allocate_overlay(ScrnInfoPtr pScrn)
@@ -1108,7 +1026,6 @@ i830_allocate_overlay(ScrnInfoPtr pScrn)
return TRUE;
}
-#endif
static Bool
IsTileable(ScrnInfoPtr pScrn, int pitch)
@@ -1144,13 +1061,6 @@ IsTileable(ScrnInfoPtr pScrn, int pitch)
}
}
-/* 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.
*
@@ -1162,91 +1072,30 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
unsigned int pitch = pScrn->displayWidth * pI830->cpp;
- unsigned long minspace, avail;
- int cacheLines, maxCacheLines;
+ unsigned long minspace;
int align;
long size, fb_height;
int flags;
i830_memory *front_buffer = NULL;
enum tile_format tile_format = TILE_NONE;
- flags = ALLOW_SHARING;
+ flags = ALLOW_SHARING|DISABLE_REUSE;
/* We'll allocate the fb such that the root window will fit regardless of
* rotation.
*/
fb_height = pScrn->virtualY;
- if (!pI830->can_resize)
- {
- if (!pI830->use_drm_mode && pScrn->virtualX > pScrn->virtualY)
- fb_height = pScrn->virtualX;
- else
- fb_height = pScrn->virtualY;
- }
-
- pI830->FbMemBox.x1 = 0;
- pI830->FbMemBox.x2 = pScrn->displayWidth;
- pI830->FbMemBox.y1 = 0;
- pI830->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.
+ * enough for the virtual screen size.
*/
minspace = pitch * pScrn->virtualY;
- avail = pScrn->videoRam * 1024;
-
- if (pI830->accel == ACCEL_XAA) {
- maxCacheLines = (avail - minspace) / pitch;
- /* This shouldn't happen. */
- if (maxCacheLines < 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Internal Error: "
- "maxCacheLines < 0 in i830_allocate_2d_memory()\n");
- maxCacheLines = 0;
- }
- 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);
+ size = ROUND_TO_PAGE(pitch * fb_height);
- cacheLines = (size + pitch - 1) / pitch;
- }
- if (cacheLines > maxCacheLines)
- cacheLines = maxCacheLines;
-
- pI830->FbMemBox.y2 += cacheLines;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Allocating %d scanlines for pixmap cache\n",
- cacheLines);
- } else {
- /* For non-XAA, 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);
-
- /* 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->tiling)
tile_format = TILE_XMAJOR;
- if (pI830->accel == ACCEL_XAA && IS_I965G(pI830))
- tile_format = TILE_NONE;
- if (pI830->use_drm_mode)
- tile_format = TILE_NONE;
if (!IsTileable(pScrn, pitch))
tile_format = TILE_NONE;
@@ -1276,7 +1125,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
return NULL;
}
- if (!pI830->use_drm_mode && pI830->FbBase)
+ if (!pI830->use_drm_mode && pI830->FbBase && front_buffer->bound)
memset (pI830->FbBase + front_buffer->offset, 0, size);
return front_buffer;
@@ -1296,6 +1145,8 @@ i830_allocate_cursor_buffers(ScrnInfoPtr pScrn)
flags = pI830->CursorNeedsPhysical ? NEED_PHYSICAL_ADDR : 0;
+ flags |= DISABLE_REUSE;
+
/* 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
@@ -1413,8 +1264,6 @@ Bool
i830_allocate_2d_memory(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
- unsigned int pitch = pScrn->displayWidth * pI830->cpp;
- long size;
if (!pI830->use_drm_mode) {
if (!xf86AgpGARTSupported() || !xf86AcquireGART(pScrn->scrnIndex)) {
@@ -1451,232 +1300,13 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
}
}
-#ifdef I830_XV
- /* Allocate overlay register space and optional XAA linear allocator
- * space. The second head in zaphod mode will share the space.
- */
if (!pI830->use_drm_mode)
i830_allocate_overlay(pScrn);
-#endif
pI830->front_buffer = i830_allocate_framebuffer(pScrn);
if (pI830->front_buffer == NULL)
return FALSE;
-#ifdef I830_USE_EXA
- if (pI830->accel == ACCEL_EXA && !pI830->use_drm_mode) {
- 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);
-
- /* 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, PITCH_NONE, 1, NEED_LIFETIME_FIXED,
- TILE_NONE);
- 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->accel == ACCEL_XAA) {
- /* 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 GEM anyway.
- */
- pI830->xaa_scratch =
- i830_allocate_memory(pScrn, "xaa scratch", MAX_SCRATCH_BUFFER_SIZE,
- PITCH_NONE, GTT_PAGE_SIZE, NEED_LIFETIME_FIXED,
- TILE_NONE);
- if (pI830->xaa_scratch == NULL) {
- pI830->xaa_scratch =
- i830_allocate_memory(pScrn, "xaa scratch",
- MIN_SCRATCH_BUFFER_SIZE, PITCH_NONE,
- GTT_PAGE_SIZE, NEED_LIFETIME_FIXED,
- TILE_NONE);
- if (pI830->xaa_scratch == NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Failed to allocate scratch buffer space\n");
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-#ifdef XF86DRI
-static unsigned int
-myLog2(unsigned int n)
-{
- unsigned int log2 = 1;
-
- while (n > 1) {
- n >>= 1;
- log2++;
- }
- return log2;
-}
-
-static Bool
-i830_allocate_backbuffer(ScrnInfoPtr pScrn, i830_memory **buffer,
- const char *name)
-{
- I830Ptr pI830 = I830PTR(pScrn);
- unsigned int pitch = pScrn->displayWidth * pI830->cpp;
- unsigned long size;
- int height;
- enum tile_format tile_format = TILE_NONE;;
-
- 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));
- tile_format = TILE_XMAJOR;
- }
- else
- {
- size = ROUND_TO_PAGE(pitch * height);
- tile_format = TILE_NONE;
- }
- *buffer = i830_allocate_memory(pScrn, name, size, pitch,
- GTT_PAGE_SIZE,
- ALIGN_BOTH_ENDS |
- ALLOW_SHARING,
- tile_format);
-
- if (*buffer == NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Failed to allocate %s space.\n", name);
- return FALSE;
- }
-
- return TRUE;
-}
-
-static Bool
-i830_allocate_depthbuffer(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
- unsigned long size;
- unsigned int pitch = pScrn->displayWidth * pI830->cpp;
- int height;
- int flags;
- enum tile_format tile_format = TILE_NONE;
-
- height = pScrn->virtualY;
-
- /* First try allocating it tiled */
- flags = ALLOW_SHARING;
- if (pI830->tiling && IsTileable(pScrn, pitch))
- {
- /* 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;
- height = ALIGN(height, 16);
- flags |= ALIGN_BOTH_ENDS;
- }
- size = ROUND_TO_PAGE(pitch * height);
-
- pI830->depth_buffer =
- i830_allocate_memory(pScrn, "depth buffer", size, pitch,
- GTT_PAGE_SIZE, flags, tile_format);
-
- if (pI830->depth_buffer == NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Failed to allocate depth buffer space.\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-Bool
-i830_allocate_texture_memory(ScrnInfoPtr pScrn)
-{
- 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",
- size / 1024);
- return FALSE;
- }
- /* Now that the DRM uses the sarea to get the offsets of the buffers,
- * and we update the classic DRM mappings and the sarea contents on
- * changes, the NEED_LIFETIME_FIXED is no longer true and should be
- * made conditional on DRM version.
- */
- pI830->textures = i830_allocate_memory(pScrn, "classic textures", size,
- PITCH_NONE,
- GTT_PAGE_SIZE,
- ALLOW_SHARING |
- NEED_LIFETIME_FIXED,
- TILE_NONE);
- if (pI830->textures == NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Failed to allocate texture space.\n");
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-static Bool
-i830_allocate_hwstatus(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
- int flags;
-
- /* 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).
- */
- flags = NEED_LIFETIME_FIXED;
- if (HWS_NEED_NONSTOLEN(pI830))
- flags |= NEED_NON_STOLEN;
- pI830->hw_status = i830_allocate_memory(pScrn, "HW status",
- HWSTATUS_PAGE_SIZE, PITCH_NONE, GTT_PAGE_SIZE, flags,
- TILE_NONE);
- if (pI830->hw_status == NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Failed to allocate hw status page.\n");
- return FALSE;
- }
return TRUE;
}
@@ -1701,31 +1331,6 @@ i830_allocate_pwrctx(ScrnInfoPtr pScrn)
return TRUE;
}
-Bool
-i830_allocate_3d_memory(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-
- DPRINTF(PFX, "i830_allocate_3d_memory\n");
-
- if (!pI830->memory_manager && HWS_NEED_GFX(pI830)) {
- if (!i830_allocate_hwstatus(pScrn))
- return FALSE;
- }
-
- if (!i830_allocate_backbuffer(pScrn, &pI830->back_buffer, "back buffer"))
- return FALSE;
-
- if (!i830_allocate_depthbuffer(pScrn))
- return FALSE;
-
- if (!i830_allocate_texture_memory(pScrn))
- return FALSE;
-
- return TRUE;
-}
-#endif
-
/**
* Sets up tiled surface registers ("fences") for the hardware.
*
@@ -1750,10 +1355,7 @@ i830_set_tiling(ScrnInfoPtr pScrn, unsigned int offset,
assert(tile_format != TILE_NONE);
- if (pI830->need_sync) {
- I830Sync(pScrn);
- pI830->need_sync = FALSE;
- }
+ I830Sync(pScrn);
if (IS_I965G(pI830))
max_fence = FENCE_NEW_NR;
diff --git a/src/i830_quirks.c b/src/i830_quirks.c
index 8680baf9..81ea3c25 100644
--- a/src/i830_quirks.c
+++ b/src/i830_quirks.c
@@ -70,12 +70,13 @@ static char *i830_dmi_data[dmi_data_max];
static void i830_dmi_store_##field(void) \
{\
FILE *f = NULL;\
+ int ret;\
f = fopen(DMIID_FILE(field), "r");\
if (f == NULL) {\
xfree(i830_dmi_data[field]); i830_dmi_data[field] = NULL;\
return;\
}\
- fread(i830_dmi_data[field], 64, 1, f);\
+ ret = fread(i830_dmi_data[field], 64, 1, f); \
fclose(f);\
}
@@ -236,6 +237,17 @@ static void quirk_msi_lvds_dmi (I830Ptr pI830)
}
}
+static void quirk_ibase_lvds (I830Ptr pI830)
+{
+ if (!i830_dmi_data[board_name]) {
+ ErrorF("Failed to load DMI info, iBase LVDS quirk not applied.\n");
+ return;
+ }
+ if (!strncmp(i830_dmi_data[board_name], "i855-W83627HF", 13)) {
+ pI830->quirk_flag |= QUIRK_IGNORE_LVDS;
+ }
+}
+
static void quirk_ivch_dvob (I830Ptr pI830)
{
pI830->quirk_flag |= QUIRK_IVCH_NEED_DVOB;
@@ -379,6 +391,9 @@ static i830_quirk i830_quirk_list[] = {
/* #19239: Mirrus Centrino laptop */
{ PCI_CHIP_I915_GM, 0x1584, 0x9800, quirk_broken_acpi_lid },
+ /* #19529: iBase MB890 board */
+ { PCI_CHIP_I855_GM, 0x8086, 0x3582, quirk_ibase_lvds },
+
{ 0, 0, 0, NULL },
};
diff --git a/src/i830_render.c b/src/i830_render.c
index 5696fa3d..4bee5ba0 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -285,7 +285,7 @@ i830_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
wrap_mode = TEXCOORDMODE_MIRROR;
break;
default:
- FatalError("Unkown repeat type %d\n", pPict->repeatType);
+ FatalError("Unknown repeat type %d\n", pPict->repeatType);
}
switch (pPict->filter) {
@@ -345,10 +345,7 @@ i830_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
ADVANCE_BATCH();
}
-#ifdef I830DEBUG
- ErrorF("try to sync to show any errors...");
- I830Sync(pScrn);
-#endif
+ i830_debug_sync(pScrn);
return TRUE;
}
@@ -569,10 +566,7 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture,
ADVANCE_BATCH();
}
-#ifdef I830DEBUG
- Error("try to sync to show any errors...");
- I830Sync(pScrn);
-#endif
+ i830_debug_sync(pScrn);
return TRUE;
}
diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index 254b866f..a4c9120e 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -49,6 +49,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i830_display.h"
#include "i810_reg.h"
#include "i830_sdvo_regs.h"
+#include "X11/Xatom.h"
/** SDVO driver private structure. */
struct i830_sdvo_priv {
@@ -110,6 +111,11 @@ struct i830_sdvo_priv {
/** DDC bus used by this SDVO output */
uint8_t ddc_bus;
+ /* Default 0 for full RGB range 0-255, 1 is for RGB range 16-235 */
+ uint32_t broadcast_rgb;
+
+ /** This flag means if we should switch ddc bus before next i2c Start */
+ Bool ddc_bus_switch;
/** State for save/restore */
/** @{ */
@@ -121,6 +127,11 @@ struct i830_sdvo_priv {
/** @} */
};
+static Atom broadcast_atom;
+
+static void
+i830_sdvo_dump(ScrnInfoPtr pScrn);
+
/**
* Writes the SDVOB or SDVOC with the given value, but always writes both
* SDVOB and SDVOC to work around apparent hardware issues (according to
@@ -375,7 +386,7 @@ i830_sdvo_read_response(xf86OutputPtr output, void *response, int response_len)
return status;
}
-int
+static int
i830_sdvo_get_pixel_multiplier(DisplayModePtr pMode)
{
if (pMode->Clock >= 100000)
@@ -1173,6 +1184,9 @@ i830_sdvo_mode_set(xf86OutputPtr output, DisplayModePtr mode,
}
i830_sdvo_write_sdvox(output, sdvox);
+
+ if (0)
+ i830_sdvo_dump(pScrn);
}
static void
@@ -1392,7 +1406,10 @@ i830_sdvo_ddc_i2c_start(I2CBusPtr b, int timeout)
I2CBusPtr i2cbus = intel_output->pI2CBus;
struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
- i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus);
+ if (dev_priv->ddc_bus_switch) {
+ i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus);
+ dev_priv->ddc_bus_switch = FALSE;
+ }
return i2cbus->I2CStart(i2cbus, timeout);
}
@@ -1403,11 +1420,13 @@ i830_sdvo_ddc_i2c_stop(I2CDevPtr d)
xf86OutputPtr output = d->pI2CBus->DriverPrivate.ptr;
I830OutputPrivatePtr intel_output = output->driver_private;
I2CBusPtr i2cbus = intel_output->pI2CBus, savebus;
+ struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
savebus = d->pI2CBus;
d->pI2CBus = i2cbus;
i2cbus->I2CStop(d);
d->pI2CBus = savebus;
+ dev_priv->ddc_bus_switch = TRUE;
}
/**
@@ -1487,7 +1506,7 @@ i830_sdvo_dump_device(xf86OutputPtr output)
i830_sdvo_dump_hdmi_buf(output);
}
-void
+static void
i830_sdvo_dump(ScrnInfoPtr pScrn)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
@@ -1570,6 +1589,14 @@ i830_sdvo_output_setup (xf86OutputPtr output, uint16_t flag)
dev_priv->is_tv = TRUE;
intel_output->needs_tv_clock = TRUE;
}
+ else if (flag & SDVO_OUTPUT_CVBS0)
+ {
+ dev_priv->controlled_output = SDVO_OUTPUT_CVBS0;
+ output->subpixel_order = SubPixelHorizontalRGB; /* XXX */
+ name_prefix="TV";
+ dev_priv->is_tv = TRUE;
+ intel_output->needs_tv_clock = TRUE;
+ }
else if (flag & SDVO_OUTPUT_RGB0)
{
dev_priv->controlled_output = SDVO_OUTPUT_RGB0;
@@ -1597,7 +1624,7 @@ i830_sdvo_output_setup (xf86OutputPtr output, uint16_t flag)
xf86DrvMsg(intel_output->pI2CBus->scrnIndex, X_WARNING,
"%s: Unknown SDVO output type (0x%02x%02x)\n",
SDVO_NAME(dev_priv),
- bytes[0], bytes[1]);
+ bytes[1], bytes[0]);
name_prefix="Unknown";
}
@@ -1702,7 +1729,6 @@ i830_sdvo_detect(xf86OutputPtr output)
{
xf86MonPtr edid_mon;
/* Check EDID in DVI-I case */
- i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus);
edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus);
if (edid_mon && !DIGITAL(edid_mon->features.input_type)) {
xfree(edid_mon);
@@ -1893,6 +1919,7 @@ i830_sdvo_destroy (xf86OutputPtr output)
xf86DestroyI2CBusRec (intel_output->pDDCBus, FALSE, FALSE);
xf86DestroyI2CDevRec (&dev_priv->d, FALSE);
xf86DestroyI2CBusRec (dev_priv->d.pI2CBus, TRUE, TRUE);
+ free(dev_priv->name);
if (output->randr_output) {
RROutputPtr randr_output = output->randr_output;
@@ -1919,7 +1946,94 @@ i830_sdvo_get_crtc(xf86OutputPtr output)
}
#endif
+static void
+i830_sdvo_create_resources(xf86OutputPtr output)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ I830Ptr pI830 = I830PTR(pScrn);
+ I830OutputPrivatePtr intel_output = output->driver_private;
+ struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
+ INT32 broadcast_range[2];
+ int err;
+
+ /* only R G B are 8bit color mode */
+ if (pScrn->depth != 24 ||
+ /* only 965G and G4X platform */
+ !(IS_I965G(pI830) || IS_G4X(pI830)) ||
+ /* only TMDS encoding */
+ !(strstr(output->name, "TMDS") || strstr(output->name, "HDMI")))
+ return;
+
+ broadcast_atom =
+ MakeAtom("BROADCAST_RGB", sizeof("BROADCAST_RGB") - 1, TRUE);
+
+ broadcast_range[0] = 0;
+ broadcast_range[1] = 1;
+ err = RRConfigureOutputProperty(output->randr_output,
+ broadcast_atom,
+ FALSE, TRUE, FALSE, 2, broadcast_range);
+ if (err != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "RRConfigureOutputProperty error, %d\n", err);
+ return;
+ }
+ /* Set the current value of the broadcast property as full range */
+ dev_priv->broadcast_rgb = 0;
+ err = RRChangeOutputProperty(output->randr_output,
+ broadcast_atom,
+ XA_INTEGER, 32, PropModeReplace,
+ 1, &dev_priv->broadcast_rgb,
+ FALSE, TRUE);
+ if (err != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "RRChangeOutputProperty error, %d\n", err);
+ return;
+ }
+}
+
+static Bool
+i830_sdvo_set_property(xf86OutputPtr output, Atom property,
+ RRPropertyValuePtr value)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ I830Ptr pI830 = I830PTR(pScrn);
+ I830OutputPrivatePtr intel_output = output->driver_private;
+ struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
+ uint32_t temp;
+
+ if (property == broadcast_atom) {
+ uint32_t val;
+
+ if (value->type != XA_INTEGER || value->format != 32 ||
+ value->size != 1)
+ {
+ return FALSE;
+ }
+
+ val = *(INT32 *)value->data;
+ if (val < 0 || val > 1)
+ {
+ return FALSE;
+ }
+ if (val == dev_priv->broadcast_rgb)
+ return TRUE;
+
+ temp = INREG(dev_priv->output_device);
+
+ if (val == 1)
+ temp |= SDVO_COLOR_NOT_FULL_RANGE;
+ else if (val == 0)
+ temp &= ~SDVO_COLOR_NOT_FULL_RANGE;
+
+ i830_sdvo_write_sdvox(output, temp);
+
+ dev_priv->broadcast_rgb = val;
+ }
+ return TRUE;
+}
+
static const xf86OutputFuncsRec i830_sdvo_output_funcs = {
+ .create_resources = i830_sdvo_create_resources,
.dpms = i830_sdvo_dpms,
.save = i830_sdvo_save,
.restore = i830_sdvo_restore,
@@ -1930,6 +2044,7 @@ static const xf86OutputFuncsRec i830_sdvo_output_funcs = {
.commit = i830_output_commit,
.detect = i830_sdvo_detect,
.get_modes = i830_sdvo_get_modes,
+ .set_property = i830_sdvo_set_property,
.destroy = i830_sdvo_destroy,
#ifdef RANDR_GET_CRTC_INTERFACE
.get_crtc = i830_sdvo_get_crtc,
@@ -2091,6 +2206,7 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device)
ddcbus->I2CStop = i830_sdvo_ddc_i2c_stop;
ddcbus->I2CAddress = i830_sdvo_ddc_i2c_address;
ddcbus->DriverPrivate.ptr = output;
+ dev_priv->ddc_bus_switch = TRUE;
if (!xf86I2CBusInit(ddcbus))
{
diff --git a/src/i830_sdvo.h b/src/i830_sdvo.h
index 798a88df..607dc5c1 100644
--- a/src/i830_sdvo.h
+++ b/src/i830_sdvo.h
@@ -27,9 +27,3 @@
Bool
i830_sdvo_init(ScrnInfoPtr pScrn, int output_device);
-
-int
-i830_sdvo_get_pixel_multiplier(DisplayModePtr pMode);
-
-void
-i830_sdvo_dump(ScrnInfoPtr pScrn);
diff --git a/src/i830_video.c b/src/i830_video.c
index 3f3aaacf..1c3a5b7c 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -23,7 +23,6 @@
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.
@@ -70,8 +69,6 @@
#include "i830_video.h"
#include "xf86xv.h"
#include <X11/extensions/Xv.h>
-#include "xaa.h"
-#include "xaalocal.h"
#include "dixstruct.h"
#include "fourcc.h"
@@ -140,11 +137,6 @@ static Atom xvSyncToVblank;
#define OVERLAY_DEBUG if (0) ErrorF
#endif
-/* Oops, I never exported this function in EXA. I meant to. */
-#ifndef exaMoveInPixmap
-void exaMoveInPixmap (PixmapPtr pPixmap);
-#endif
-
/*
* OCMD - Overlay Command Register
*/
@@ -468,7 +460,7 @@ i830_overlay_on(ScrnInfoPtr pScrn)
OUT_BATCH(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
OUT_BATCH(MI_NOOP);
ADVANCE_BATCH();
- i830WaitSync(pScrn);
+ I830Sync(pScrn);
/*
* If we turned pipe A on up above, turn it
@@ -521,7 +513,7 @@ i830_overlay_off(ScrnInfoPtr pScrn)
/*
* Wait for overlay to go idle. This has to be
- * separated from the turning off state by a WaitSync
+ * separated from the turning off state by a Sync
* to ensure the overlay will not read OCMD early and
* disable the overlay before the commands here are
* executed
@@ -531,7 +523,7 @@ i830_overlay_off(ScrnInfoPtr pScrn)
OUT_BATCH(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
OUT_BATCH(MI_NOOP);
ADVANCE_BATCH();
- i830WaitSync(pScrn);
+ I830Sync(pScrn);
}
/*
@@ -552,7 +544,7 @@ i830_overlay_off(ScrnInfoPtr pScrn)
OUT_BATCH(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
OUT_BATCH(MI_NOOP);
ADVANCE_BATCH();
- i830WaitSync(pScrn);
+ I830Sync(pScrn);
}
pI830->overlayOn = FALSE;
OVERLAY_DEBUG("overlay_off\n");
@@ -1019,7 +1011,7 @@ I830SetupImageVideoTextured(ScreenPtr pScreen)
pPriv->doubleBuffer = 0;
pPriv->rotation = RR_Rotate_0;
- pPriv->SyncToVblank = -1;
+ pPriv->SyncToVblank = 1;
/* gotta uninit this someplace, XXX: shouldn't be necessary for textured */
REGION_NULL(pScreen, &pPriv->clip);
@@ -2146,7 +2138,8 @@ i830_clip_video_helper (ScrnInfoPtr pScrn,
pPriv->desired_crtc,
&crtc_box);
- if (crtc)
+ /* For textured video, we don't actually want to clip at all. */
+ if (crtc && !pPriv->textured)
{
REGION_INIT (pScreen, &crtc_region_local, &crtc_box, 1);
crtc_region = &crtc_region_local;
@@ -2391,6 +2384,7 @@ I830PutImage(ScrnInfoPtr pScrn,
return BadAlloc;
if (!pPriv->textured && drm_intel_bo_pin(pPriv->buf, 4096) != 0) {
drm_intel_bo_unreference(pPriv->buf);
+ pPriv->buf = NULL;
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to pin xv buffer\n");
return BadAlloc;
@@ -2479,23 +2473,6 @@ I830PutImage(ScrnInfoPtr pScrn,
pPixmap = (PixmapPtr)pDraw;
}
-#ifdef I830_USE_EXA
- if (pPriv->textured && pI830->accel == ACCEL_EXA) {
- /* Force the pixmap into framebuffer so we can draw to it. */
- exaMoveInPixmap(pPixmap);
- }
-#endif
-
- if (pPriv->textured && pI830->accel <= ACCEL_XAA &&
- (((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,
@@ -2513,45 +2490,43 @@ I830PutImage(ScrnInfoPtr pScrn,
sync = FALSE;
} else if (pPriv->SyncToVblank == 0) {
sync = FALSE;
- } else if (pPriv->SyncToVblank == -1) {
- BoxRec crtc_box;
- BoxPtr pbox;
- int nbox, crtc_area, coverage = 0;
-
- i830_crtc_box(crtc, &crtc_box);
- crtc_area = i830_box_area(&crtc_box);
- pbox = REGION_RECTS(clipBoxes);
- nbox = REGION_NUM_RECTS(clipBoxes);
-
- while (nbox--) {
- coverage += i830_box_area(pbox);
- pbox++;
- }
-
- if ((coverage << 2) < crtc_area)
- sync = FALSE;
}
if (sync) {
- I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
- int event;
-
- if (IS_I965G(pI830)) {
- if (intel_crtc->pipe == 0)
- event = MI_WAIT_FOR_PIPEA_SVBLANK;
- else
- event = MI_WAIT_FOR_PIPEB_SVBLANK;
- } else {
- if (intel_crtc->pipe == 0)
- event = MI_WAIT_FOR_PIPEA_VBLANK;
- else
- event = MI_WAIT_FOR_PIPEB_VBLANK;
- }
+ BoxPtr box;
+ int y1, y2;
+ int pipe, event, load_scan_lines_pipe;
+
+ if (pI830->use_drm_mode)
+ pipe = drmmode_get_pipe_from_crtc_id(pI830->bufmgr, crtc);
+ else {
+ I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
+ pipe = intel_crtc->pipe;
+ }
- BEGIN_BATCH(2);
- OUT_BATCH(MI_WAIT_FOR_EVENT | event);
- OUT_BATCH(MI_NOOP);
- ADVANCE_BATCH();
+ if (pipe >= 0) {
+ if (pipe == 0) {
+ event = MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW;
+ load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA;
+ } else {
+ event = MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW;
+ load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB;
+ }
+
+ box = REGION_EXTENTS(unused, clipBoxes);
+ y1 = box->y1 - crtc->y;
+ y2 = box->y2 - crtc->y;
+
+ BEGIN_BATCH(5);
+ /* The documentation says that the LOAD_SCAN_LINES command
+ * always comes in pairs. Don't ask me why. */
+ OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
+ OUT_BATCH((y1 << 16) | y2);
+ OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe);
+ OUT_BATCH((y1 << 16) | y2);
+ OUT_BATCH(MI_WAIT_FOR_EVENT | event);
+ ADVANCE_BATCH();
+ }
}
if (IS_I965G(pI830)) {
@@ -2894,11 +2869,12 @@ I830InitOffscreenImages(ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
- /* need to free this someplace */
if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) {
return;
}
+ pI830->offscreenImages = offscreenImages;
+
offscreenImages[0].image = &Images[0];
offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES /*| VIDEO_CLIP_TO_VIEWPORT*/;
offscreenImages[0].alloc_surface = I830AllocateSurface;
diff --git a/src/i830_xaa.c b/src/i830_xaa.c
deleted file mode 100644
index 1f82840d..00000000
--- a/src/i830_xaa.c
+++ /dev/null
@@ -1,829 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * 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:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <assert.h>
-#include "xf86.h"
-#include "xaarop.h"
-#include "i830.h"
-#include "i810_reg.h"
-#include "mipict.h"
-
-#ifndef DO_SCANLINE_IMAGE_WRITE
-#define DO_SCANLINE_IMAGE_WRITE 0
-#endif
-
-/* 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
-
-void
-i830_xaa_composite(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-Bool
-I830XAAInit(ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoPtr;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
- I830Ptr pI830 = I830PTR(pScrn);
- int i;
- int width = 0;
- int nr_buffers = 0;
- unsigned char *ptr = NULL;
-
- if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
- ErrorF("I830XAAInit\n");
-
- pI830->AccelInfoRec = infoPtr = XAACreateInfoRec();
- if (!infoPtr)
- return FALSE;
-
- 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);
-
- }
-
- if (pI830->xaa_scratch->size != 0) {
- width = ((pScrn->displayWidth + 31) & ~31) / 8;
- nr_buffers = pI830->xaa_scratch->size / width;
- ptr = pI830->FbBase + pI830->xaa_scratch->offset;
- }
-
- 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;
-#endif
- }
-
- /* Set up pI830->bufferOffset */
- I830SelectBuffer(pScrn, I830_SELECT_FRONT);
-
- if (!XAAInit(pScreen, infoPtr))
- return FALSE;
-
- if (ps != NULL) {
- if (IS_I865G(pI830) || IS_I855(pI830) ||
- IS_845G(pI830) || IS_I830(pI830))
- {
- pI830->xaa_check_composite = i830_check_composite;
- pI830->xaa_prepare_composite = i830_prepare_composite;
- pI830->xaa_composite = i830_composite;
- pI830->xaa_done_composite = i830_done_composite;
- } else if (IS_I915G(pI830) || IS_I915GM(pI830) ||
- IS_I945G(pI830) || IS_I945GM(pI830) || IS_G33CLASS(pI830))
- {
- pI830->xaa_check_composite = i915_check_composite;
- pI830->xaa_prepare_composite = i915_prepare_composite;
- pI830->xaa_composite = i830_composite;
- pI830->xaa_done_composite = i830_done_composite;
- } else {
- pI830->xaa_check_composite = i965_check_composite;
- pI830->xaa_prepare_composite = i965_prepare_composite;
- pI830->xaa_composite = i965_composite;
- pI830->xaa_done_composite = i830_done_composite;
- }
-
- pI830->saved_composite = ps->Composite;
- ps->Composite = i830_xaa_composite;
- }
-
- return TRUE;
-}
-
-static unsigned int
-I830CheckTiling(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-
- if (pI830->bufferOffset == pI830->front_buffer->offset &&
- pI830->front_buffer->tiling != TILE_NONE)
- {
- return TRUE;
- }
-#ifdef XF86DRI
- if (pI830->back_buffer != NULL &&
- pI830->bufferOffset == pI830->back_buffer->offset &&
- pI830->back_buffer->tiling != TILE_NONE)
- {
- return TRUE;
- }
- if (pI830->depth_buffer != NULL &&
- pI830->bufferOffset == pI830->depth_buffer->offset &&
- pI830->depth_buffer->tiling != TILE_NONE)
- {
- return TRUE;
- }
-#endif
-
- return FALSE;
-}
-
-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);
-
- if (IS_I965G(pI830) && I830CheckTiling(pScrn)) {
- pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2;
- } else {
- pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);
- }
-
-#ifdef I830_USE_EXA
- /* This function gets used by I830DRIInitBuffers(), and we might not have
- * XAAGetPatternROP() available. So just use the ROPs from our EXA code
- * if available.
- */
- pI830->BR[13] |= (I830PatternROP[rop] << 16);
-#else
- pI830->BR[13] |= (XAAGetPatternROP(rop) << 16);
-#endif
-
- 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_BATCH(6);
-
- if (pScrn->bitsPerPixel == 32) {
- OUT_BATCH(COLOR_BLT_CMD | COLOR_BLT_WRITE_ALPHA |
- COLOR_BLT_WRITE_RGB);
- } else {
- OUT_BATCH(COLOR_BLT_CMD);
- }
- OUT_BATCH(pI830->BR[13]);
- OUT_BATCH((h << 16) | (w * pI830->cpp));
- OUT_BATCH(pI830->bufferOffset + (y * pScrn->displayWidth + x) *
- pI830->cpp);
- OUT_BATCH(pI830->BR[16]);
- OUT_BATCH(0);
-
- ADVANCE_BATCH();
- }
-
- if (IS_I965G(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);
-
- if (IS_I965G(pI830) && I830CheckTiling(pScrn)) {
- pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2;
- } else {
- pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);
- }
-
-#ifdef I830_USE_EXA
- /* This function gets used by I830DRIInitBuffers(), and we might not have
- * XAAGetCopyROP() available. So just use the ROPs from our EXA code
- * if available.
- */
- pI830->BR[13] |= I830CopyROP[rop] << 16;
-#else
- pI830->BR[13] |= XAAGetCopyROP(rop) << 16;
-#endif
-
- 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 = I830CheckTiling(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;
-
- {
- BEGIN_BATCH(8);
-
- if (pScrn->bitsPerPixel == 32) {
- OUT_BATCH(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
- XY_SRC_COPY_BLT_WRITE_RGB | tiled << 15 | tiled << 11);
- } else {
- OUT_BATCH(XY_SRC_COPY_BLT_CMD | tiled << 15 | tiled << 11);
- }
- OUT_BATCH(pI830->BR[13]);
- OUT_BATCH((dst_y1 << 16) | (dst_x1 & 0xffff));
- OUT_BATCH((dst_y2 << 16) | (dst_x2 & 0xffff));
- OUT_BATCH(pI830->bufferOffset);
- OUT_BATCH((src_y1 << 16) | (src_x1 & 0xffff));
- OUT_BATCH(pI830->BR[13] & 0xFFFF);
- OUT_BATCH(pI830->bufferOffset);
-
- ADVANCE_BATCH();
- }
-
- if (IS_I965G(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;
-
- if (IS_I965G(pI830) && I830CheckTiling(pScrn)) {
- pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2;
- } else {
- pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);
- }
- 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 = I830CheckTiling(pScrn);
-
- x1 = x;
- x2 = x + w;
- y1 = y;
- y2 = y + h;
-
- if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
- ErrorF("I830SubsequentMono8x8PatternFillRect\n");
-
- {
- BEGIN_BATCH(10);
-
- if (pScrn->bitsPerPixel == 32) {
- OUT_BATCH(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_BATCH(XY_MONO_PAT_BLT_CMD | tiled << 11 |
- ((patty << 8) & XY_MONO_PAT_VERT_SEED) |
- ((pattx << 12) & XY_MONO_PAT_HORT_SEED));
- }
- OUT_BATCH(pI830->BR[13]);
- OUT_BATCH((y1 << 16) | x1);
- OUT_BATCH((y2 << 16) | x2);
- OUT_BATCH(pI830->bufferOffset);
- OUT_BATCH(pI830->BR[18]); /* bg */
- OUT_BATCH(pI830->BR[19]); /* fg */
- OUT_BATCH(pI830->BR[16]); /* pattern data */
- OUT_BATCH(pI830->BR[17]);
- OUT_BATCH(0);
- ADVANCE_BATCH();
- }
-
- if (IS_I965G(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 */
- if (IS_I965G(pI830) && I830CheckTiling(pScrn)) {
- pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2;
- } else {
- 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 = I830CheckTiling(pScrn);
-
- pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -
- pI830->FbBase);
-
- if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
- ErrorF("I830SubsequentColorExpandScanline %d (addr %x)\n",
- bufno, pI830->BR[12]);
-
- {
- BEGIN_BATCH(8);
-
- if (pScrn->bitsPerPixel == 32) {
- OUT_BATCH(XY_MONO_SRC_BLT_CMD | XY_MONO_SRC_BLT_WRITE_ALPHA |
- tiled << 11 | XY_MONO_SRC_BLT_WRITE_RGB);
- } else {
- OUT_BATCH(XY_MONO_SRC_BLT_CMD | tiled << 11);
- }
- OUT_BATCH(pI830->BR[13]);
- OUT_BATCH(0); /* x1 = 0, y1 = 0 */
- OUT_BATCH(pI830->BR[11]); /* x2 = w, y2 = 1 */
- OUT_BATCH(pI830->BR[9]); /* dst addr */
- OUT_BATCH(pI830->BR[12]); /* src addr */
- OUT_BATCH(pI830->BR[18]); /* bg */
- OUT_BATCH(pI830->BR[19]); /* fg */
-
- ADVANCE_BATCH();
- }
-
- /* Advance to next scanline.
- */
- pI830->BR[9] += pScrn->displayWidth * pI830->cpp;
- I830GetNextScanlineColorExpandBuffer(pScrn);
-
- if (IS_I965G(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 */
- if (IS_I965G(pI830) && I830CheckTiling(pScrn)) {
- pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2;
- } else {
- 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 = I830CheckTiling(pScrn);
-
- pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -
- pI830->FbBase);
-
- if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
- ErrorF("I830SubsequentImageWriteScanline %d (addr %x)\n",
- bufno, pI830->BR[12]);
-
- {
- BEGIN_BATCH(8);
-
- if (pScrn->bitsPerPixel == 32) {
- OUT_BATCH(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
- tiled << 11 | XY_SRC_COPY_BLT_WRITE_RGB);
- } else {
- OUT_BATCH(XY_SRC_COPY_BLT_CMD | tiled << 11);
- }
- OUT_BATCH(pI830->BR[13]);
- OUT_BATCH(0); /* x1 = 0, y1 = 0 */
- OUT_BATCH(pI830->BR[11]); /* x2 = w, y2 = 1 */
- OUT_BATCH(pI830->BR[9]); /* dst addr */
- OUT_BATCH(0); /* source origin (0,0) */
- OUT_BATCH(pI830->BR[11] & 0xffff); /* source pitch */
- OUT_BATCH(pI830->BR[12]); /* src addr */
-
- ADVANCE_BATCH();
- }
-
- /* Advance to next scanline.
- */
- pI830->BR[9] += pScrn->displayWidth * pI830->cpp;
- I830GetNextScanlineColorExpandBuffer(pScrn);
-}
-#endif /* DO_SCANLINE_IMAGE_WRITE */
-/* Support for multiscreen */
-
-/**
- * Special case acceleration for Render acceleration of rotation operations
- * by xf86Rotate.c
- */
-void
-i830_xaa_composite(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- PictureScreenPtr ps;
- PixmapPtr pSrcPixmap, pDstPixmap;
- RegionRec region;
- BoxPtr pbox;
- int nbox;
- int i;
-
- /* Throw out cases that aren't going to be our rotation first */
- if (pMask != NULL || op != PictOpSrc || pSrc->pDrawable == NULL)
- goto fallback;
-
- if (pSrc->pDrawable->type != DRAWABLE_WINDOW ||
- pDst->pDrawable->type != DRAWABLE_PIXMAP)
- {
- goto fallback;
- }
- pSrcPixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) pSrc->pDrawable);
- pDstPixmap = (PixmapPtr)pDst->pDrawable;
-
- /* Check if the dest is one of our shadow pixmaps */
- for (i = 0; i < xf86_config->num_crtc; i++) {
- xf86CrtcPtr crtc = xf86_config->crtc[i];
-
- if (crtc->rotatedPixmap == pDstPixmap)
- break;
- }
- if (i == xf86_config->num_crtc)
- goto fallback;
-
- if (pSrcPixmap != pScreen->GetScreenPixmap(pScreen))
- goto fallback;
-
- /* OK, so we've got a Render operation on one of our shadow pixmaps, with
- * the source being the real framebuffer. We know that both of these are
- * in framebuffer, with no x/y offsets, i.e. normal pixmaps like our EXA-
- * based Render acceleration code expects.
- */
- assert(pSrcPixmap->drawable.x == 0);
- assert(pSrcPixmap->drawable.y == 0);
- assert(pDstPixmap->drawable.x == 0);
- assert(pDstPixmap->drawable.y == 0);
-
- if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
- xSrc, ySrc, 0, 0, xDst, yDst,
- width, height))
- return;
-
- if (!pI830->xaa_check_composite(op, pSrc, NULL, pDst)) {
- REGION_UNINIT(pScreen, &region);
- goto fallback;
- }
-
- if (!pI830->xaa_prepare_composite(op, pSrc, NULL, pDst,
- pSrcPixmap, NULL, pDstPixmap))
- {
- REGION_UNINIT(pScreen, &region);
- goto fallback;
- }
-
- nbox = REGION_NUM_RECTS(&region);
- pbox = REGION_RECTS(&region);
-
- xSrc -= xDst;
- ySrc -= yDst;
-
- while (nbox--)
- {
- pI830->xaa_composite(pDstPixmap,
- pbox->x1 + xSrc,
- pbox->y1 + ySrc,
- 0, 0,
- pbox->x1,
- pbox->y1,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
- pbox++;
- }
-
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-
- pI830->xaa_done_composite(pDstPixmap);
- i830MarkSync(pScrn);
-
- return;
-
-fallback:
- /* Fallback path: Call down to the next level (XAA) */
- ps = GetPictureScreenIfSet(pScreen);
-
- ps->Composite = pI830->saved_composite;
-
- ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height);
-
- pI830->saved_composite = ps->Composite;
- ps->Composite = i830_xaa_composite;
-}
diff --git a/src/i915_render.c b/src/i915_render.c
index 268dd8a1..ab04e9c9 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -270,7 +270,7 @@ i915_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
wrap_mode = TEXCOORDMODE_MIRROR;
break;
default:
- FatalError("Unkown repeat type %d\n", pPict->repeatType);
+ FatalError("Unknown repeat type %d\n", pPict->repeatType);
}
switch (pPict->filter) {
diff --git a/src/i915_video.c b/src/i915_video.c
index 93e0c86a..150cf04e 100644
--- a/src/i915_video.c
+++ b/src/i915_video.c
@@ -50,7 +50,8 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
I830Ptr pI830 = I830PTR(pScrn);
uint32_t format, ms3, s5;
BoxPtr pbox = REGION_RECTS(dstRegion);
- int nbox = REGION_NUM_RECTS(dstRegion);
+ int nbox_total = REGION_NUM_RECTS(dstRegion);
+ int nbox_this_time;
int dxo, dyo, pix_xoff, pix_yoff;
Bool planar;
@@ -73,7 +74,17 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
return;
}
- intel_batch_start_atomic(pScrn, 200 + 20 * nbox);
+#define BYTES_FOR_BOXES(n) ((200 + (n) * 20) * 4)
+#define BOXES_IN_BYTES(s) ((((s)/4) - 200) / 20)
+#define BATCH_BYTES(p) ((p)->batch_bo->size - 16)
+
+ while (nbox_total) {
+ nbox_this_time = nbox_total;
+ if (BYTES_FOR_BOXES(nbox_this_time) > BATCH_BYTES(pI830))
+ nbox_this_time = BOXES_IN_BYTES(BATCH_BYTES(pI830));
+ nbox_total -= nbox_this_time;
+
+ intel_batch_start_atomic(pScrn, 200 + 20 * nbox_this_time);
IntelEmitInvarientState(pScrn);
pI830->last_3d = LAST_3D_VIDEO;
@@ -366,7 +377,7 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
dxo = dstRegion->extents.x1;
dyo = dstRegion->extents.y1;
- while (nbox--)
+ while (nbox_this_time--)
{
int box_x1 = pbox->x1;
int box_y1 = pbox->y1;
@@ -415,7 +426,6 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
}
intel_batch_end_atomic(pScrn);
-
- i830MarkSync(pScrn);
+ }
}
diff --git a/src/i965_render.c b/src/i965_render.c
index c123a369..7583af17 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -431,7 +431,7 @@ typedef enum {
#define KERNEL(kernel_enum, kernel, masked) \
[kernel_enum] = {&kernel, sizeof(kernel), masked}
-struct wm_kernel_info {
+static struct wm_kernel_info {
void *data;
unsigned int size;
Bool has_mask;
@@ -923,6 +923,7 @@ i965_set_picture_surface_state(dri_bo *ss_bo, int ss_index,
struct brw_surface_state_padded *ss;
struct brw_surface_state local_ss;
dri_bo *pixmap_bo = i830_get_pixmap_bo(pPixmap);
+ uint32_t write_domain, read_domains;
ss = (struct brw_surface_state_padded *)ss_bo->virtual + ss_index;
@@ -952,10 +953,7 @@ i965_set_picture_surface_state(dri_bo *ss_bo, int ss_index,
local_ss.ss0.vert_line_stride_ofs = 0;
local_ss.ss0.mipmap_layout_mode = 0;
local_ss.ss0.render_cache_read_mode = 0;
- if (pixmap_bo != NULL)
- local_ss.ss1.base_addr = pixmap_bo->offset;
- else
- local_ss.ss1.base_addr = intel_get_pixmap_offset(pPixmap);
+ local_ss.ss1.base_addr = pixmap_bo->offset;
local_ss.ss2.mip_count = 0;
local_ss.ss2.render_target_rotation = 0;
@@ -967,22 +965,20 @@ i965_set_picture_surface_state(dri_bo *ss_bo, int ss_index,
memcpy(ss, &local_ss, sizeof(local_ss));
- if (pixmap_bo != NULL) {
- uint32_t write_domain, read_domains;
- if (is_dst) {
- write_domain = I915_GEM_DOMAIN_RENDER;
- read_domains = I915_GEM_DOMAIN_RENDER;
- } else {
- write_domain = 0;
- read_domains = I915_GEM_DOMAIN_SAMPLER;
- }
- dri_bo_emit_reloc(ss_bo, read_domains, write_domain,
- 0,
- ss_index * sizeof(*ss) +
- offsetof(struct brw_surface_state, ss1),
- pixmap_bo);
+ if (is_dst) {
+ write_domain = I915_GEM_DOMAIN_RENDER;
+ read_domains = I915_GEM_DOMAIN_RENDER;
+ } else {
+ write_domain = 0;
+ read_domains = I915_GEM_DOMAIN_SAMPLER;
}
+ drm_intel_bo_emit_reloc(ss_bo,
+ ss_index * sizeof(*ss) +
+ offsetof(struct brw_surface_state, ss1),
+ pixmap_bo,
+ 0,
+ read_domains, write_domain);
}
static void
@@ -1216,11 +1212,6 @@ i965_emit_composite_state(ScrnInfoPtr pScrn)
ADVANCE_BATCH();
}
-
-#ifdef I830DEBUG
- ErrorF("try to sync to show any errors...\n");
- I830Sync(pScrn);
-#endif
}
/**
@@ -1290,8 +1281,10 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
surface_state_bo = dri_bo_alloc(pI830->bufmgr, "surface_state",
3 * sizeof (brw_surface_state_padded),
4096);
- if (dri_bo_map(surface_state_bo, 1) != 0)
+ if (dri_bo_map(surface_state_bo, 1) != 0) {
+ dri_bo_unreference(surface_state_bo);
return FALSE;
+ }
/* Set up the state buffer for the destination surface */
i965_set_picture_surface_state(surface_state_bo, 0,
pDstPicture, pDst, TRUE);
@@ -1310,6 +1303,7 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
binding_table_bo = dri_bo_alloc(pI830->bufmgr, "binding_table",
3 * sizeof(uint32_t), 4096);
if (dri_bo_map (binding_table_bo, 1) != 0) {
+ dri_bo_unreference(binding_table_bo);
dri_bo_unreference(surface_state_bo);
return FALSE;
}
@@ -1605,10 +1599,7 @@ i965_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
intel_batch_end_atomic(pScrn);
-#ifdef I830DEBUG
- ErrorF("sync after 3dprimitive\n");
- I830Sync(pScrn);
-#endif
+ i830_debug_sync(pScrn);
}
void
@@ -1716,35 +1707,28 @@ gen4_render_state_cleanup(ScrnInfoPtr pScrn)
I830Ptr pI830 = I830PTR(pScrn);
struct gen4_render_state *render_state= pI830->gen4_render_state;
int i, j, k, l, m;
+ gen4_composite_op *composite_op = &render_state->composite_op;
- if (render_state->vertex_buffer_bo) {
- dri_bo_unreference (render_state->vertex_buffer_bo);
- render_state->vertex_buffer_bo = NULL;
- }
+ drm_intel_bo_unreference(composite_op->binding_table_bo);
+ drm_intel_bo_unreference(render_state->vertex_buffer_bo);
drm_intel_bo_unreference(render_state->vs_state_bo);
- render_state->vs_state_bo = NULL;
drm_intel_bo_unreference(render_state->sf_state_bo);
- render_state->sf_state_bo = NULL;
drm_intel_bo_unreference(render_state->sf_mask_state_bo);
- render_state->sf_mask_state_bo = NULL;
- for (i = 0; i < WM_KERNEL_COUNT; i++) {
+ for (i = 0; i < WM_KERNEL_COUNT; i++)
drm_intel_bo_unreference(render_state->wm_kernel_bo[i]);
- render_state->wm_kernel_bo[i] = NULL;
- }
for (i = 0; i < SAMPLER_STATE_FILTER_COUNT; i++)
for (j = 0; j < SAMPLER_STATE_EXTEND_COUNT; j++)
for (k = 0; k < SAMPLER_STATE_FILTER_COUNT; k++)
for (l = 0; l < SAMPLER_STATE_EXTEND_COUNT; l++)
- for (m = 0; m < WM_KERNEL_COUNT; m++) {
+ for (m = 0; m < WM_KERNEL_COUNT; m++)
drm_intel_bo_unreference(render_state->wm_state_bo[m][i][j][k][l]);
- render_state->wm_state_bo[m][i][j][k][l] = NULL;
- }
drm_intel_bo_unreference(render_state->cc_state_bo);
- render_state->cc_state_bo = NULL;
drm_intel_bo_unreference(render_state->sip_kernel_bo);
- render_state->sip_kernel_bo = NULL;
+
+ free(pI830->gen4_render_state);
+ pI830->gen4_render_state = NULL;
}
diff --git a/src/i965_video.c b/src/i965_video.c
index f6020d4e..d4590279 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -375,13 +375,10 @@ i965_create_dst_surface_state(ScrnInfoPtr scrn,
dest_surf_state->ss0.mipmap_layout_mode = 0;
dest_surf_state->ss0.render_cache_read_mode = 0;
- if (pixmap_bo != NULL)
- dest_surf_state->ss1.base_addr =
- intel_emit_reloc(surf_bo, offsetof(struct brw_surface_state, ss1),
- pixmap_bo, 0,
- I915_GEM_DOMAIN_SAMPLER, 0);
- else
- dest_surf_state->ss1.base_addr = intel_get_pixmap_offset(pixmap);
+ dest_surf_state->ss1.base_addr =
+ intel_emit_reloc(surf_bo, offsetof(struct brw_surface_state, ss1),
+ pixmap_bo, 0,
+ I915_GEM_DOMAIN_SAMPLER, 0);
dest_surf_state->ss2.height = scrn->virtualY - 1;
dest_surf_state->ss2.width = scrn->virtualX - 1;
@@ -775,8 +772,7 @@ i965_emit_video_setup(ScrnInfoPtr pScrn, drm_intel_bo *bind_bo, int n_src_surf)
/* brw_debug (pScrn, "after base address modify"); */
BEGIN_BATCH(38);
- /* Enable VF statistics */
- OUT_BATCH(BRW_3DSTATE_VF_STATISTICS | 1);
+ OUT_BATCH(MI_NOOP);
/* Pipe control */
OUT_BATCH(BRW_PIPE_CONTROL |
@@ -795,7 +791,6 @@ i965_emit_video_setup(ScrnInfoPtr pScrn, drm_intel_bo *bind_bo, int n_src_surf)
OUT_BATCH(0); /* sf */
/* Only the PS uses the binding table */
OUT_RELOC(bind_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
- drm_intel_bo_unreference(bind_bo);
/* Blend constant color (magenta is fun) */
OUT_BATCH(BRW_3DSTATE_CONSTANT_COLOR | 3);
@@ -1131,15 +1126,16 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
i965_emit_video_setup(pScrn, bind_bo, n_src_surf);
- BEGIN_BATCH(10);
+ BEGIN_BATCH(12);
/* Set up the pointer to our vertex buffer */
- OUT_BATCH(BRW_3DSTATE_VERTEX_BUFFERS | 2);
+ OUT_BATCH(BRW_3DSTATE_VERTEX_BUFFERS | 3);
/* four 32-bit floats per vertex */
OUT_BATCH((0 << VB0_BUFFER_INDEX_SHIFT) |
VB0_VERTEXDATA |
((4 * 4) << VB0_BUFFER_PITCH_SHIFT));
OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0, 0);
OUT_BATCH(3); /* four corners to our rectangle */
+ OUT_BATCH(0); /* reserved */
OUT_BATCH(BRW_3DPRIMITIVE |
BRW_3DPRIMITIVE_VERTEX_SEQUENTIAL |
@@ -1151,6 +1147,7 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
OUT_BATCH(1); /* single instance */
OUT_BATCH(0); /* start instance location */
OUT_BATCH(0); /* index buffer offset, ignored */
+ OUT_BATCH(MI_NOOP);
ADVANCE_BATCH();
intel_batch_end_atomic(pScrn);
@@ -1160,7 +1157,9 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
i965_post_draw_debug(pScrn);
}
- i830MarkSync(pScrn);
+ /* release reference once we're finished */
+ drm_intel_bo_unreference(bind_bo);
+
#if WATCH_STATS
i830_dump_error_state(pScrn);
#endif
diff --git a/src/ivch/Makefile.am b/src/ivch/Makefile.am
index 8b12b093..f9cc116b 100644
--- a/src/ivch/Makefile.am
+++ b/src/ivch/Makefile.am
@@ -3,7 +3,7 @@
# -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 = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
@PCIACCESS_CFLAGS@
ivch_la_LTLIBRARIES = ivch.la
diff --git a/src/local_xf86Rename.h b/src/local_xf86Rename.h
deleted file mode 100644
index e1e788f3..00000000
--- a/src/local_xf86Rename.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright © 2006 Keith Packard
- *
- * 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 the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS 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.
- */
-
-#define XF86NAME(x) intel_##x
diff --git a/src/reg_dumper/.gitignore b/src/reg_dumper/.gitignore
index 5aac542b..60a9a4f2 100644
--- a/src/reg_dumper/.gitignore
+++ b/src/reg_dumper/.gitignore
@@ -4,3 +4,4 @@ intel_idle
intel_reg_dumper
intel_stepping
intel_statuspage
+intel_lid
diff --git a/src/reg_dumper/gtt.c b/src/reg_dumper/gtt.c
index ead5935b..4a46f118 100644
--- a/src/reg_dumper/gtt.c
+++ b/src/reg_dumper/gtt.c
@@ -59,9 +59,9 @@ int main(int argc, char **argv)
else {
/* 915/945 chips has GTT range in bar 3*/
int err = 0;
- err = pci_device_map_range (pI830->pci_dev,
- pI830->pci_dev->regions[3].base_addr,
- pI830->pci_dev->regions[3].size,
+ err = pci_device_map_range (pI830->PciInfo,
+ pI830->PciInfo->regions[3].base_addr,
+ pI830->PciInfo->regions[3].size,
PCI_DEV_MAP_FLAG_WRITABLE,
(void **)&gtt);
if (err != 0) {
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
}
}
- aper_size = pI830->pci_dev->regions[2].size;
+ aper_size = pI830->PciInfo->regions[2].size;
for (start = 0; start < aper_size; start += KB(4)) {
uint32_t start_pte = INGTT(start);
diff --git a/src/reg_dumper/hotplug.c b/src/reg_dumper/hotplug.c
index 68fe5842..de463844 100644
--- a/src/reg_dumper/hotplug.c
+++ b/src/reg_dumper/hotplug.c
@@ -72,10 +72,7 @@ int main(int argc, char **argv)
if (dev->vendor_id != 0x8086)
errx(1, "Graphics card is non-intel");
- i830.PciInfo = &i830.pci_info_rec;
- i830.PciInfo->chipType = dev->device_id;
-
- i830.pci_dev = dev;
+ i830.PciInfo = dev;
mmio_bar = IS_I9XX((&i830)) ? 0 : 1;
diff --git a/src/reg_dumper/idle.c b/src/reg_dumper/idle.c
index 8d60c0ca..cbd68aa3 100644
--- a/src/reg_dumper/idle.c
+++ b/src/reg_dumper/idle.c
@@ -142,10 +142,7 @@ int main(int argc, char **argv)
if (dev->vendor_id != 0x8086)
errx(1, "Graphics card is non-intel");
- i830.PciInfo = &i830.pci_info_rec;
- i830.PciInfo->chipType = dev->device_id;
-
- i830.pci_dev = dev;
+ i830.PciInfo = dev;
mmio_bar = IS_I9XX((&i830)) ? 0 : 1;
diff --git a/src/reg_dumper/main.c b/src/reg_dumper/main.c
index 5c8ef9ed..ce883ef8 100644
--- a/src/reg_dumper/main.c
+++ b/src/reg_dumper/main.c
@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
-#include <pciaccess.h>
#include <err.h>
#include "reg_dumper.h"
@@ -62,10 +61,7 @@ int main(int argc, char **argv)
if (dev->vendor_id != 0x8086)
errx(1, "Graphics card is non-intel");
- i830.PciInfo = &i830.pci_info_rec;
- i830.PciInfo->chipType = dev->device_id;
-
- i830.pci_dev = dev;
+ i830.PciInfo = dev;
mmio_bar = IS_I9XX((&i830)) ? 0 : 1;
diff --git a/src/reg_dumper/reg_dumper.h b/src/reg_dumper/reg_dumper.h
index 9f24d5cc..8c2eb0bb 100644
--- a/src/reg_dumper/reg_dumper.h
+++ b/src/reg_dumper/reg_dumper.h
@@ -29,6 +29,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <pciaccess.h>
#include "common.h"
/** @file
@@ -45,18 +46,12 @@ typedef char Bool;
#define X_WARNING 1
#define X_ERROR 2
-struct pci_info_rec {
- uint16_t chipType;
-};
-
typedef struct _i830 {
/* Fields in common with the real pI830 */
- struct pci_info_rec *PciInfo;
+ struct pci_device *PciInfo;
Bool use_drm_mode;
/* Fields used for setting up reg_dumper */
- struct pci_device *pci_dev;
- struct pci_info_rec pci_info_rec;
volatile unsigned char *mmio;
} I830Rec, *I830Ptr;
diff --git a/src/reg_dumper/util.c b/src/reg_dumper/util.c
index 6dd1e487..4d6380e9 100644
--- a/src/reg_dumper/util.c
+++ b/src/reg_dumper/util.c
@@ -65,10 +65,7 @@ void intel_i830rec_init(I830Ptr pI830)
if (dev->vendor_id != 0x8086)
errx(1, "Graphics card is non-intel");
- pI830->PciInfo = &pI830->pci_info_rec;
- pI830->PciInfo->chipType = dev->device_id;
-
- pI830->pci_dev = dev;
+ pI830->PciInfo = dev;
mmio_bar = IS_I9XX(pI830) ? 0 : 1;
diff --git a/src/sil164/Makefile.am b/src/sil164/Makefile.am
index 7b179ab9..6d1cf378 100644
--- a/src/sil164/Makefile.am
+++ b/src/sil164/Makefile.am
@@ -3,7 +3,7 @@
# -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 = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
@PCIACCESS_CFLAGS@
sil164_la_LTLIBRARIES = sil164.la
diff --git a/src/tfp410/Makefile.am b/src/tfp410/Makefile.am
index 0dbc0212..23d9c87a 100644
--- a/src/tfp410/Makefile.am
+++ b/src/tfp410/Makefile.am
@@ -3,7 +3,7 @@
# -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 = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
@PCIACCESS_CFLAGS@
tfp410_la_LTLIBRARIES = tfp410.la
diff --git a/src/xvmc/I810XvMC.c b/src/xvmc/I810XvMC.c
index 10606de4..0754ff44 100644
--- a/src/xvmc/I810XvMC.c
+++ b/src/xvmc/I810XvMC.c
@@ -33,7 +33,6 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**
**
***************************************************************************/
-/* $XFree86: xc/lib/XvMC/hw/i810/I810XvMC.c,v 1.10 2002/10/30 12:52:01 alanh Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/src/xvmc/I810XvMC.h b/src/xvmc/I810XvMC.h
index b71d6215..9de32eba 100644
--- a/src/xvmc/I810XvMC.h
+++ b/src/xvmc/I810XvMC.h
@@ -32,7 +32,6 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*
***************************************************************************/
-/* $XFree86: xc/lib/XvMC/hw/i810/I810XvMC.h,v 1.3 2002/10/30 12:52:02 alanh Exp $ */
#ifndef I810XVMC_H
diff --git a/src/xvmc/xf86dri.c b/src/xvmc/xf86dri.c
index 96987bfa..9ea919af 100644
--- a/src/xvmc/xf86dri.c
+++ b/src/xvmc/xf86dri.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.13 2002/10/30 12:51:25 alanh Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/src/xvmc/xf86dri.h b/src/xvmc/xf86dri.h
index 81cfdfdd..5b8655de 100644
--- a/src/xvmc/xf86dri.h
+++ b/src/xvmc/xf86dri.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.8 2002/10/30 12:51:25 alanh Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/src/xvmc/xf86dristr.h b/src/xvmc/xf86dristr.h
index 3b43438e..d8989963 100644
--- a/src/xvmc/xf86dristr.h
+++ b/src/xvmc/xf86dristr.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.10 2002/10/30 12:51:25 alanh Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index e3220543..a225a4dc 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -977,69 +977,6 @@ out:
return ret;
}
-#ifndef SERVER_1_5
-void
-uxa_paint_window(WindowPtr pWin, RegionPtr pRegion, int what)
-{
- ScreenPtr screen = pWin->drawable.pScreen;
- uxa_screen_t *uxa_screen = uxa_get_screen(screen);
- DDXPointRec zeros = { 0, 0 };
-
- if (REGION_NIL(pRegion))
- return;
-
- if (uxa_screen->swappedOut) {
- uxa_check_paint_window(pWin, pRegion, what);
- return;
- }
-
- switch (what) {
- case PW_BACKGROUND:
- switch (pWin->backgroundState) {
- case None:
- return;
- case ParentRelative:
- do {
- pWin = pWin->parent;
- } while (pWin->backgroundState == ParentRelative);
- (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
- what);
- return;
- case BackgroundPixel:
- if (uxa_fill_region_solid(&pWin->drawable, pRegion,
- pWin->background.pixel,
- FB_ALLONES, GXcopy))
- return;
- break;
- case BackgroundPixmap:
- if (uxa_fill_region_tiled(&pWin->drawable, pRegion,
- pWin->background.pixmap,
- &zeros, FB_ALLONES, GXcopy))
- return;
- break;
- }
- break;
- case PW_BORDER:
- if (pWin->borderIsPixel) {
- if (uxa_fill_region_solid(&pWin->drawable, pRegion,
- pWin->border.pixel,
- FB_ALLONES, GXcopy))
- return;
- break;
- } else {
- if (uxa_fill_region_tiled(&pWin->drawable, pRegion,
- pWin->border.pixmap,
- &zeros, FB_ALLONES, GXcopy))
- return;
- break;
- }
- break;
- }
-
- uxa_check_paint_window(pWin, pRegion, what);
-}
-#endif /* !SERVER_1_5 */
-
/**
* Accelerates GetImage for solid ZPixmap downloads from framebuffer memory.
*
diff --git a/uxa/uxa-glyphs.c b/uxa/uxa-glyphs.c
index 3cb03f59..af5f5879 100644
--- a/uxa/uxa-glyphs.c
+++ b/uxa/uxa-glyphs.c
@@ -50,8 +50,6 @@
#include "mipict.h"
-#ifdef SERVER_1_5
-
#if DEBUG_GLYPH_CACHE
#define DBG_GLYPH_CACHE(a) ErrorF a
#else
@@ -873,5 +871,3 @@ uxa_glyphs (CARD8 op,
(*pScreen->DestroyPixmap) (pMaskPixmap);
}
}
-
-#endif /* SERVER_1_5 */
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index d1cd341e..3d2b7764 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -64,6 +64,16 @@
#endif
#include "damage.h"
+/* Provide substitutes for gcc's __FUNCTION__ on other compilers */
+#if !defined(__GNUC__) && !defined(__FUNCTION__)
+# if defined(__STDC__) && (__STDC_VERSION__>=199901L) /* C99 */
+# define __FUNCTION__ __func__
+# else
+# define __FUNCTION__ ""
+# endif
+#endif
+
+
/* 1.6 and earlier server compat */
#ifndef miGetCompositeClip
#define miCopyRegion fbCopyRegion
@@ -129,10 +139,6 @@ typedef struct {
CloseScreenProcPtr SavedCloseScreen;
GetImageProcPtr SavedGetImage;
GetSpansProcPtr SavedGetSpans;
-#ifndef SERVER_1_5
- PaintWindowBackgroundProcPtr SavedPaintWindowBackground;
- PaintWindowBorderProcPtr SavedPaintWindowBorder;
-#endif
CreatePixmapProcPtr SavedCreatePixmap;
DestroyPixmapProcPtr SavedDestroyPixmap;
CopyWindowProcPtr SavedCopyWindow;
@@ -171,12 +177,8 @@ extern int uxa_screen_index;
static inline uxa_screen_t *
uxa_get_screen(ScreenPtr screen)
{
-#ifdef SERVER_1_5
return (uxa_screen_t *)dixLookupPrivate(&screen->devPrivates,
&uxa_screen_index);
-#else
- return screen->devPrivates[uxa_screen_index].ptr;
-#endif
}
/** Align an offset to an arbitrary alignment */
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index edbf0d8c..b377bf53 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -818,13 +818,8 @@ uxa_create_alpha_picture (ScreenPtr pScreen,
return 0;
}
-#ifdef SERVER_1_5
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
pPictFormat->depth, 0);
-#else
- pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
- pPictFormat->depth);
-#endif
if (!pPixmap)
return 0;
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
diff --git a/uxa/uxa-unaccel.c b/uxa/uxa-unaccel.c
index f63c03b7..8f864688 100644
--- a/uxa/uxa-unaccel.c
+++ b/uxa/uxa-unaccel.c
@@ -336,24 +336,6 @@ uxa_check_get_spans (DrawablePtr pDrawable,
}
}
-#ifndef SERVER_1_5
-void
-uxa_check_paint_window (WindowPtr pWin, RegionPtr pRegion, int what)
-{
- ScreenPtr screen = pWin->drawable.pScreen;
-
- UXA_FALLBACK(("from %p (%c)\n", pWin,
- uxa_drawable_location (&pWin->drawable)));
- if (uxa_prepare_access (&pWin->drawable, UXA_ACCESS_RW)) {
- if (uxa_prepare_access_window (pWin)) {
- fbPaintWindow (pWin, pRegion, what);
- uxa_finish_access_window (pWin);
- }
- uxa_finish_access(&pWin->drawable);
- }
-}
-#endif
-
void
uxa_check_composite (CARD8 op,
PicturePtr pSrc,
diff --git a/uxa/uxa.c b/uxa/uxa.c
index b51a282d..1f2d75bc 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -40,9 +40,6 @@
#include "uxa.h"
int uxa_screen_index;
-#ifndef SERVER_1_5
-static int uxa_generation;
-#endif
/**
* uxa_get_drawable_pixmap() returns a backing pixmap for a given drawable.
@@ -370,18 +367,12 @@ uxa_close_screen(int i, ScreenPtr pScreen)
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
-#ifdef SERVER_1_5
uxa_glyphs_fini(pScreen);
-#endif
pScreen->CreateGC = uxa_screen->SavedCreateGC;
pScreen->CloseScreen = uxa_screen->SavedCloseScreen;
pScreen->GetImage = uxa_screen->SavedGetImage;
pScreen->GetSpans = uxa_screen->SavedGetSpans;
-#ifndef SERVER_1_5
- pScreen->PaintWindowBackground = uxa_screen->SavedPaintWindowBackground;
- pScreen->PaintWindowBorder = uxa_screen->SavedPaintWindowBorder;
-#endif
pScreen->CreatePixmap = uxa_screen->SavedCreatePixmap;
pScreen->DestroyPixmap = uxa_screen->SavedDestroyPixmap;
pScreen->CopyWindow = uxa_screen->SavedCopyWindow;
@@ -478,15 +469,7 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
uxa_screen->info = uxa_driver;
-#ifdef SERVER_1_5
dixSetPrivate(&screen->devPrivates, &uxa_screen_index, uxa_screen);
-#else
- if (uxa_generation != serverGeneration) {
- uxa_screen_index = AllocateScreenPrivateIndex();
- uxa_generation = serverGeneration;
- }
- screen->devPrivates[uxa_screen_index].ptr = uxa_screen;
-#endif
// exaDDXDriverInit(screen);
@@ -505,14 +488,6 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
uxa_screen->SavedGetSpans = screen->GetSpans;
screen->GetSpans = uxa_check_get_spans;
-#ifndef SERVER_1_5
- uxa_screen->SavedPaintWindowBackground = screen->PaintWindowBackground;
- screen->PaintWindowBackground = uxa_paint_window;
-
- uxa_screen->SavedPaintWindowBorder = screen->PaintWindowBorder;
- screen->PaintWindowBorder = uxa_paint_window;
-#endif /* !SERVER_1_5 */
-
uxa_screen->SavedCopyWindow = screen->CopyWindow;
screen->CopyWindow = uxa_copy_window;
@@ -530,10 +505,8 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
uxa_screen->SavedComposite = ps->Composite;
ps->Composite = uxa_composite;
-#ifdef SERVER_1_5
uxa_screen->SavedGlyphs = ps->Glyphs;
ps->Glyphs = uxa_glyphs;
-#endif
uxa_screen->SavedTriangles = ps->Triangles;
ps->Triangles = uxa_triangles;
@@ -554,9 +527,7 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
ShmRegisterFuncs(screen, &uxa_shm_funcs);
#endif
-#ifdef SERVER_1_5
uxa_glyphs_init(screen);
-#endif
LogMessage(X_INFO, "UXA(%d): Driver registered support for the following"
" operations:\n", screen->myNum);