summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2021-03-26 18:23:05 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2021-03-26 18:23:05 +0000
commit4bc1b2451d6aa487e719ba2ee231ed981be1712e (patch)
treef639ebf8158cee675f9dba8c251d514806f42e3b
parentf7facb1b8a354d6cb54aaca7c147e95af61378a5 (diff)
Update to xf86-video-r128 6.12.0
-rw-r--r--driver/xf86-video-r128/ChangeLog1250
-rw-r--r--driver/xf86-video-r128/Makefile.in5
-rw-r--r--driver/xf86-video-r128/aclocal.m4286
-rwxr-xr-xdriver/xf86-video-r128/configure312
-rw-r--r--driver/xf86-video-r128/configure.ac38
-rw-r--r--driver/xf86-video-r128/man/Makefile.in1
-rw-r--r--driver/xf86-video-r128/man/r128.man24
-rw-r--r--driver/xf86-video-r128/src/Makefile.am22
-rw-r--r--driver/xf86-video-r128/src/Makefile.in42
-rw-r--r--driver/xf86-video-r128/src/compat-api.h5
-rw-r--r--driver/xf86-video-r128/src/r128.h342
-rw-r--r--driver/xf86-video-r128/src/r128_accel.c205
-rw-r--r--driver/xf86-video-r128/src/r128_crtc.c1158
-rw-r--r--driver/xf86-video-r128/src/r128_cursor.c349
-rw-r--r--driver/xf86-video-r128/src/r128_dga.c408
-rw-r--r--driver/xf86-video-r128/src/r128_dri.c248
-rw-r--r--driver/xf86-video-r128/src/r128_dripriv.h10
-rw-r--r--driver/xf86-video-r128/src/r128_driver.c3474
-rw-r--r--driver/xf86-video-r128/src/r128_exa.c68
-rw-r--r--driver/xf86-video-r128/src/r128_exa_render.c125
-rw-r--r--driver/xf86-video-r128/src/r128_output.c537
-rw-r--r--driver/xf86-video-r128/src/r128_probe.c42
-rw-r--r--driver/xf86-video-r128/src/r128_probe.h117
-rw-r--r--driver/xf86-video-r128/src/r128_reg.h16
-rw-r--r--driver/xf86-video-r128/src/r128_rop.h64
-rw-r--r--driver/xf86-video-r128/src/r128_video.c169
26 files changed, 5083 insertions, 4234 deletions
diff --git a/driver/xf86-video-r128/ChangeLog b/driver/xf86-video-r128/ChangeLog
index 938043dd0..ec30c60fc 100644
--- a/driver/xf86-video-r128/ChangeLog
+++ b/driver/xf86-video-r128/ChangeLog
@@ -1,3 +1,1253 @@
+commit 38216bdc81321a8bb70a4c7ce226194537cc63d6
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Mon Oct 22 21:01:12 2018 -0700
+
+ Version bumped to 6.12.0
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 0dc8f6d099e74a61a280e8cd8b7b93b229f95c7f
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Mon Oct 22 20:58:43 2018 -0700
+
+ Remove Dac6Bit option from man page
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 3c292d8f90eae03e6e6806a68a4f749bb39db9ba
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Mon Oct 22 20:46:20 2018 -0700
+
+ Fix for build failure when --disable-dri option is specified
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 9d62b878ce40d9b5f7887c63a4e2498a52253c36
+Author: Helmut Grohne <helmut@subdivi.de>
+Date: Mon Oct 22 19:06:15 2018 -0700
+
+ Another fix for cross build failure
+
+ While commit 11b230b removed most usage of AC_CHECK_FILE, one more of
+ it was left in the compilation build script. This will hopefully fix
+ the cross build failure for good.
+
+ Signed-off-by: Helmut Grohne <helmut@subdivi.de>
+
+commit 1b17c78941762c38e3ea37e0b259270286c18455
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sat Aug 4 13:38:53 2018 -0700
+
+ Version bumped to 6.11.102
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit b93302435030a8dc878ea330eafd5d8b87f0df03
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Aug 2 13:11:42 2018 -0700
+
+ Consolidate acquisition of many options into two functions
+
+ Move acquiring of the option settings into r128AcquireOption and
+ r128UMSOption functions.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit d82464bce67d9f7286c10fcb6c0a72d8e2fa6501
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Aug 2 12:59:30 2018 -0700
+
+ Rename R128UMSOption to r128UMSOption
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 1fe5b0c0ab444d7c902a1d348ae4d982cf5c1790
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Aug 2 12:47:54 2018 -0700
+
+ Version bumped to 6.11.101
+
+ Performed DRI1 and EXA / XAA initialization code refactoring.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit fb625410051dcf2e0bbd3bbcefe83dbc53f9a33c
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Aug 2 12:41:31 2018 -0700
+
+ Hold off enabling acceleration until EXA / XAA are fully initialized
+
+ The turn on timing is premature. Wait until completion of the
+ initialization process.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit b395a05428831faf7a0502b52c78c99a8a4d6a8e
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Aug 2 12:38:39 2018 -0700
+
+ Consolidate EXA initialization code into R128EXAInit
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 78b21efdce6f1231b0c9c8a4e801ee476acd5dc4
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Aug 2 10:44:15 2018 -0700
+
+ Deprecate R128VerboseInitEXA
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 370dc01505718dc07d444b4534794d0b988d27ad
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Aug 2 10:43:18 2018 -0700
+
+ Deprecate R128AccelInit
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 4685a918ff68e4a9e20df31c37028626b96743cb
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Aug 2 10:42:03 2018 -0700
+
+ Deprecate R128EXAAccelInit
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit d9c7c8306bb8ff4812707bd8a533da4b0b917c1b
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Aug 2 10:22:29 2018 -0700
+
+ Consolidate frame buffer initialization code
+
+ The previous implementation had duplicated code depending on which
+ standard is being used (i.e., DRI1 and / or EXA).
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit ec61d090f8286703a6557a6917976cffb141dc92
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Fri Jul 27 16:52:03 2018 -0700
+
+ Prevent disabling of EXA inside R128ScreenInit
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 641d3d42b7214d01addfd21efb692531849b4603
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Fri Jul 27 11:22:49 2018 -0700
+
+ Version bumped to 6.11.100
+
+ Performed code refactoring and made tweaks to initialization behavior.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 7dbb89d6fd11d3521b8a0085f4d9640910081bf2
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Fri Jul 27 11:08:29 2018 -0700
+
+ Move loading of EXA and XAA modules into R128PreInitAccel
+
+ Moving them away from R128ScreenInit callback function. This is how
+ other DDXs do it.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit c4c05c95ae9f1b02fcbc9f6ee431d466c1c0b519
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Jul 26 19:58:06 2018 -0700
+
+ Move RAMDAC module initialization into R128LegacyMS
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit f54469efcad4a68d86abbd55b79f4660667a5fff
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Jul 26 19:43:27 2018 -0700
+
+ Delete OPTION_DISPLAY option enumeration
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 2a903d7c00d67716815b68fb492b4d40e2f5684d
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Jul 26 19:41:06 2018 -0700
+
+ Delete USE_CRT_ONLY conditional compilation directive
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit b5f0862bbbe604605be19621ba22d60aeb68d4b9
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Jul 26 19:36:22 2018 -0700
+
+ Move many DDX UMS options into R128UMSOption
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 0ef4fbad35a1e6d20cf72c7702ffd7ebf215cdb9
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Jul 26 13:38:16 2018 -0700
+
+ Remove OPTION_DAC_8BIT option
+
+ It is no longer used.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 4e3638c612831dea400be7d0d85d4d1ea9f9a4c2
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Jul 26 10:11:59 2018 -0700
+
+ Evaluate software cursor option inside R128PreInit
+
+ Since SWCursor option is referenced only once, it should be handled
+ inside R128PreInit callback function rather than R128ScreenInit
+ callback function.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 15d245de2814128b04dea2b640c4ba0b12926f24
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Wed Jul 25 20:19:06 2018 -0700
+
+ Evaluate EXA related options inside R128PreInit
+
+ Since AccelMethod and RenderAccel options are referenced only once,
+ it should be handled inside R128PreInit callback function rather
+ than R128ScreenInit callback function.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 680aeee6730aa5b00bbc457b199b7643a6b0a1cb
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Wed Jul 25 19:50:40 2018 -0700
+
+ Evaluate NoAccel option inside R128PreInit
+
+ Since NoAccel option is referenced only once, it should be handled
+ inside R128PreInit callback function rather than R128ScreenInit
+ callback function.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 23012b520e16fe2687e50c635e6c0a1f9d740c4e
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Tue Jul 24 13:39:57 2018 -0700
+
+ Separate EXA and XAA initialization
+
+ Starting the process of separating legacy XAA and newer EXA
+ initialization code.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit fbbbcc0d33eb95869bcd0df26f3351f1531711db
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sat Jul 21 06:15:39 2018 -0700
+
+ Version bumped to 6.11.99
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 321b8997ef72507ac70b5531789ff08ca9d40ce8
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Jul 19 12:02:44 2018 -0700
+
+ Version bumped to 6.11.0
+
+ Added a temporary fix for some RAGE 128 Pro models misidentifying
+ VGA as DVI and not able to automatically select the proper screen
+ resolution via the use of EDID (Extended Display Identification).
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 1f424303840091a3b96e0a3830a966316c5e4e7f
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Jul 19 09:46:23 2018 -0700
+
+ Reorganize r128_exa.c
+
+ Stop the use of #include to include r128_exa_render.c inside
+ r128_exa.c.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 3acc004c6bfc17aca397ff2cc8c0b1a0e2d4ee63
+Author: Dylan Aïssi <bob.dybian@gmail.com>
+Date: Wed Jul 18 07:25:45 2018 -0700
+
+ Fix typo: Initalizing --> Initializing
+
+ Signed-off-by: Dylan Aïssi <bob.dybian@gmail.com>
+
+commit 11b230ba61c00c69b23c5be592cf88492113355e
+Author: Helmut Grohne <helmut@subdivi.de>
+Date: Wed Jul 18 07:04:27 2018 -0700
+
+ Fix for cross build failure
+
+ configure.ac fails to cross build from source, because it abuses
+ AC_CHECK_FILE for finding headers. AC_CHECK_FILE is supposed to find
+ files on the host system. You cannot usually expect the host system
+ to have headers, so this use is incorrect. It happens to also break
+ cross compilation.
+
+ Signed-off-by: Helmut Grohne <helmut@subdivi.de>
+
+commit d87d1aac04415d74ab32e820e9e351432c66cfdb
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Fri Jul 13 07:18:18 2018 -0700
+
+ Fix for some RAGE 128 Pro causing out of range display error
+
+ Due to faulty assumptions made by commit 2072d9a, many RAGE 128 Pro
+ VGA display will be detected as DVI, and causes out of range display
+ error with the attached monitor. While this commit is less than
+ perfect and only works on x86 platform, it avoids causing out of
+ range display error. With this fix, there is no longer the need to
+ specify the supported frequency range of the monitor inside xorg.conf.
+ The code was tested on RAGE 128 Pro Ultra 16 MB AGP.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit c857cc319809790a5414ee75fc299d835fe964a7
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Jul 12 16:11:07 2018 -0700
+
+ Convert tabs to white spaces for r128_output.c
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 0a6d7d93acf57bfd8c0005b4a08e6cd054d7a76d
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sat Jun 30 23:55:19 2018 -0500
+
+ Using __func__ string for debug message function identification
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 09f14ae89073c31118b747b8cd3663d4da9aa170
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sat Jun 30 22:56:27 2018 -0500
+
+ Remove compilation warnings related to debug messages
+
+ The variable sizes were not matching the intended print format.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 951af95a6ddb07b13304632eb4faf8b1256399a7
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sat Jun 30 22:07:08 2018 -0500
+
+ Deprecate R128TRACE macro when generating debug messages
+
+ Deprecating R128TRACE macro in favor of DEBUG macro used inside
+ OpenChrome DDX.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 16822a6a31731cb457ab35b79e5cd6f04c060625
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Tue Jun 26 17:40:11 2018 -0500
+
+ Move the location R128PreInitDRI is called
+
+ Merge it into R128LegacyMS function.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit c4c878d2ccb75fa75afe46e0e50ee9975c5c57fc
+Author: Stefan Dirsch <sndirsch@suse.de>
+Date: Mon Jun 25 15:57:02 2018 +0200
+
+ Include <stdint.h> in order to declare uint32_t
+
+ Apparently this is needed in src/atipcirename.h since xorg-server
+ 1.20 in order to still build this driver.
+
+ Signed-off-by: Stefan Dirsch <sndirsch@suse.de>
+ Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
+
+commit 6f18a15d237b5a6f4ee9d61634ff9bae827398bd
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sun Jun 17 20:20:06 2018 -0500
+
+ Move R128InitDDA2Registers to r128_crtc.c
+
+ It does not make sense for this function to be inside r128_driver.c
+ since it is only called from a function inside r128_crtc.c.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 0be9774d038322a779c34a02461342794090cd58
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sun Jun 17 20:20:05 2018 -0500
+
+ Move R128InitDDARegisters to r128_crtc.c
+
+ It does not make sense for this function to be inside r128_driver.c
+ since it is only called from a function inside r128_crtc.c.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 732ab99127538b701f71c43086c617b39d9522aa
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sun Jun 17 20:20:04 2018 -0500
+
+ Move R128RestorePLL2Registers to r128_crtc.c
+
+ r128_crtc.c is the more logical place this function should be located.
+ R128PLL2WaitForReadUpdateComplete and R128PLL2WriteUpdate functions were
+ moved as well.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 9cf18d3f147e38c2c560c5904a71c993ca50a25e
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sun Jun 17 20:20:03 2018 -0500
+
+ Move R128RestorePLLRegisters to r128_crtc.c
+
+ r128_crtc.c is the more logical place this function should be located.
+ R128PLLWaitForReadUpdateComplete and R128PLLWriteUpdate functions were
+ moved as well.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit b4edfdf93e2d73e149ff550dfc19de3de145fb71
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sun Jun 17 12:39:33 2018 -0500
+
+ Move R128RestoreDACRegisters to r128_output.c
+
+ r128_output.c is the more logical place this function should be located.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 61a116603e57e48714fd3e62310f3df79a9fecc3
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sun Jun 17 12:39:32 2018 -0500
+
+ Move R128InitDACRegisters to r128_output.c
+
+ It does not make sense for this function to be inside r128_driver.c
+ since it is only called from a function inside r128_output.c.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 6713ef02c5ee44f9c519f99934a595e5a5ac378c
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sun Jun 17 12:39:31 2018 -0500
+
+ Move R128RestoreCrtc2Registers to r128_crtc.c
+
+ r128_crtc.c is the more logical place this function should be located.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit dc218b45075ff1ffe497e25b34c528c5259ef398
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sun Jun 17 12:39:30 2018 -0500
+
+ Move R128RestoreCrtcRegisters to r128_crtc.c
+
+ r128_crtc.c is the more logical place this function should be located.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit e9564ed077af772dc3f82f15ac4c507ee1c16415
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sat Jun 16 10:24:37 2018 -0500
+
+ Move R128InitPLL2Registers to r128_crtc.c
+
+ It does not make sense for this function to be inside r128_driver.c
+ since it is only called from a function inside r128_crtc.c.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 07796aa604200a323edeb79d65d16945b60cbc63
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sat Jun 16 10:24:36 2018 -0500
+
+ Move R128InitPLLRegisters to r128_crtc.c
+
+ It does not make sense for this function to be inside r128_driver.c
+ since it is only called from a function inside r128_crtc.c.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit c63eb246927f263b20966a76d80efd9acf9713af
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sat Jun 16 10:24:35 2018 -0500
+
+ Convert R128Div to an inline function
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 5c494ca862257f1ce839febc8eda68a26353e544
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sat Jun 16 10:24:34 2018 -0500
+
+ Move R128InitCrtc2Base to r128_crtc.c
+
+ It does not make sense for this function to be inside r128_driver.c
+ since it is only called from a function inside r128_crtc.c.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 4e3da789346add1ce4505eb06a7e2c18daa2e843
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sat Jun 16 10:24:33 2018 -0500
+
+ Move R128InitCrtcBase to r128_crtc.c
+
+ It does not make sense for this function to be inside r128_driver.c
+ since it is only called from a function inside r128_crtc.c.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 7d0526f74f85f4286396cd6b761a0b908d2936df
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Jun 7 16:38:54 2018 -0500
+
+ Move R128InitCrtc2Registers to r128_crtc.c
+
+ It does not make sense for this function to be inside r128_driver.c
+ since it is only called from a function inside r128_crtc.c.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 1f4d3e04e51d4665a99ea567a19b43bb351ae631
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Thu Jun 7 16:38:22 2018 -0500
+
+ Move R128InitCrtcRegisters to r128_crtc.c
+
+ It does not make sense for this function to be inside r128_driver.c
+ since it is only called from a function inside r128_crtc.c.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 80158cdedb8b0c2320c917aefd10e90869b00ef8
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Mon Jun 4 19:45:40 2018 -0500
+
+ Move existing mode setting initialization code into R128LegacyMS
+
+ In preparation of adding a new mode setting code path.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 6572c6cd14e60994e5cd1dc2f8fcc6f88c895c36
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Mon Jun 4 19:45:20 2018 -0500
+
+ Move the location xf86CrtcConfigInit is called inside R128PreInit
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 656f5c276a2a18204d923eabcc1d0d98144505f8
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Mon Jun 4 19:44:59 2018 -0500
+
+ Refactor R128PreInitWeight
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 73cbe46437a9a5affcdd9d605421ceff38616a6a
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Mon Jun 4 19:44:39 2018 -0500
+
+ Remove R128ProbeDDC
+
+ This removes a VBE (VESA BIOS Extension) related call when probing.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 600c2f47f0edc30adb67b58121be5c4d587ddff4
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sun Jun 3 01:43:40 2018 -0500
+
+ Move R128PreInitVisual and R128PreInitGamma calls
+
+ This is similar to how the sample code for PreInit callback function
+ shown in XFree86 DDX Design (ddxDesign.pdf) design guide does it.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 237cfee9d77d8adca0ad00661e6dc99caa28ad26
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sun Jun 3 01:43:39 2018 -0500
+
+ Move the assignment to monitor field of ScrnInfoRec record
+
+ This is similar to how the sample code for PreInit callback function
+ shown in XFree86 DDX Design (ddxDesign.pdf) design guide does it.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 3c2a02971b423359747d328e1ce16e6f4f800d9a
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sun Jun 3 01:43:38 2018 -0500
+
+ Move assignment of color depth variables away from R128PreInitVisual
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 56ff44e0afd4d11d9a9daa4efd3031733b14d464
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Sun Jun 3 01:43:37 2018 -0500
+
+ Move the location where R128PreInitGamma is called
+
+ This is similar to how the sample code for PreInit callback function
+ shown in XFree86 DDX Design (ddxDesign.pdf) design guide does it.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 71d49f8697906eb0a9a7e4b5956203abef672da7
+Author: Emil Velikov <emil.velikov@collabora.com>
+Date: Mon Jul 17 13:29:14 2017 +0100
+
+ xf86-video-r128: remove the GlxSetVisualConfigs stub and friends
+
+ The function was an empty since 2008 at least. Remove it alongside the
+ unused GLX visuals code.
+
+ With this all the GL/GLX dependencies in the driver are gone.
+
+ Cc: Adam Jackson <ajax@redhat.com>
+ Cc: Connor Behan <connor.behan@gmail.com>
+ Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
+ Tested-by: Connor Behan <connor.behan@gmail.com>
+
+commit 07273966d12c2693302b13c57c5f3abe8896e11c
+Author: Mihail Konev <k.mvc@ya.ru>
+Date: Thu Jan 26 14:00:22 2017 +1000
+
+ autogen: add default patch prefix
+
+ Signed-off-by: Mihail Konev <k.mvc@ya.ru>
+
+commit b4c89cbe61828abe5e561a886db3c2e0e9ece2ef
+Author: Emil Velikov <emil.l.velikov@gmail.com>
+Date: Mon Mar 9 12:00:52 2015 +0000
+
+ autogen.sh: use quoted string variables
+
+ Place quotes around the $srcdir, $ORIGDIR and $0 variables to prevent
+ fall-outs, when they contain space.
+
+ Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
+ Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 96940667038cdba4775fb810da2d77290c9eda62
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Tue Jan 24 10:32:07 2017 +1000
+
+ autogen.sh: use exec instead of waiting for configure to finish
+
+ Syncs the invocation of configure with the one from the server.
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
+
+commit 5129d4dbc57e3a00144b6ccc23ca4c6ede9b6509
+Author: Colin Walters <walters@verbum.org>
+Date: Wed Jan 4 17:37:06 2012 -0500
+
+ autogen.sh: Implement GNOME Build API
+
+ http://people.gnome.org/~walters/docs/build-api.txt
+
+ Signed-off-by: Adam Jackson <ajax@redhat.com>
+
+commit bb4015a6b9394766d92186b4b71bbd49fa207532
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu Jan 26 11:19:23 2017 +1000
+
+ configure: Drop AM_MAINTAINER_MODE
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit b93b78f41154d24371acb1081c423351e8f370fd
+Author: Matt Turner <mattst88@gmail.com>
+Date: Tue Jan 17 14:43:12 2017 -0800
+
+ xf86-video-r128 6.10.2
+
+ Signed-off-by: Matt Turner <mattst88@gmail.com>
+
+commit 5ab23b3a8ef18ab9ff96ac8be174380d36e185e5
+Author: Adam Jackson <ajax@redhat.com>
+Date: Tue Jul 19 10:03:56 2016 -0400
+
+ Adapt Block/WakeupHandler signature for ABI 23
+
+ Signed-off-by: Adam Jackson <ajax@redhat.com>
+
+commit a589dd6baf7fa26f8ea7008ba6bd533a5ba3e76e
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Apr 13 12:41:00 2016 -0400
+
+ Remove gatos advertisement
+
+ There are many current working ways to use a TV tuner with Linux. This
+ is not one of them.
+ Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=94915
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit 3328547c840664896c12d0fd2db8f63e3a398a62
+Author: Kevin Brace <kevinbrace@gmx.com>
+Date: Wed Mar 16 18:59:23 2016 -0700
+
+ xextproto 7.1 support update to the source code
+
+ While the compilation script was updated, for some reason, the source
+ code did not get the update.
+
+ Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
+ Reviewed-by: Connor Behan <connor.behan@gmail.com>
+
+commit d3f3c9549119629ddd9447a0f9b699a909b916d5
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Thu Jan 21 22:12:25 2016 -0500
+
+ Bump to version 6.10.1
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Tested-by: Christopher Chavez <chrischavez@gmx.us>
+
+commit 562681414f38c6925da01b3fec0802f532cd9e53
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Sun Jan 17 16:45:31 2016 -0500
+
+ Assume CRT in the absence of other monitors
+
+ This patch is still untested, but it sounds like a lot of people need
+ it. Assuming that there are no monitors when DDC fails (which causes X
+ to abort with UMS) does not make sense. Some people will always have DDC
+ fail. For example, the pins are not connected on an iMac G3. For another
+ example, some RAGE128TF cards are known to lie that there is no VGA port
+ in the connector table.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit d6dd6c9ad5ba8e4950c9398d93298fea48745263
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Thu Jul 2 18:20:58 2015 -0400
+
+ Really fix bitmasks for DDC
+
+ For DDC, there is actually no difference between Pro2 cards and other
+ VGA desktop cards. Mobility / dualhead cards are the only ones that
+ differ.
+ Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91113
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Tested-by: Kevin Brace <kevinbrace@gmx.com>
+
+commit 0b0f74ac7db42c772c8dda0167154bbdcb904d4f
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Fri May 1 19:43:42 2015 -0400
+
+ Bump to version 6.10.0
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit d05022a1c398787d3f21d023a8251cb128ba9f9f
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Mon Mar 23 21:57:10 2015 -0400
+
+ Update bitmasks for DDC
+
+ A RAGE128TR chipset with a VGA port uses different i2c clock bits than
+ the VGA cards previously tested. It seems reasonable to assume that
+ other Pro2 cards are set up this way as well. In case this is incorrect,
+ a newly added xf86I2CProbeAddress() should still allow a monitor to be
+ detected.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Tested-by: Tobias Powalowski <tobias.powalowski@googlemail.com>
+
+commit b9c9779398828d4a1491e32f731aad6f79653976
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Mon Mar 23 21:51:45 2015 -0400
+
+ Look for VGA ports in the VBIOS
+
+ It appears that not all r128 chipsets marked as DFP capable have DVI
+ ports. Some have VGA which we should detect. The old driver "detected"
+ this by attempting a DVI based probe for monitors. Anything that failed
+ this was assumed to be VGA.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Tested-by: Tobias Powalowski <tobias.powalowski@googlemail.com>
+
+commit cd72de385b5600229226c3a7248a89569b452136
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Mon Mar 23 21:47:52 2015 -0400
+
+ Fix allocation of private entity
+
+ In the past, pR128Ent was only used for Xinerama-style dualhead and
+ therefore only allocated for cards with two outputs. However, recent
+ patches have repurposed pR128Ent as a general struct for things that are
+ card-specific instead of instance-specific. It therefore needs to be
+ allocated for all cards.
+ Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=89236
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Tested-by: Tobias Powalowski <tobias.powalowski@googlemail.com>
+
+commit 8c7daa148796a037ae2518154345719a735833c3
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Mar 4 00:31:33 2015 -0500
+
+ Restore PLL0 as well as PLL3
+
+ Apparently, the text mode driver can use either register to store the
+ pixel clock. The assumption made previously was apparently corrupting
+ the console on PowerPC systems. Thanks to Michael Lorenz for the patch.
+ Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=32606
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit bfff401440c5bb72fb1ce90c804f3a5623d733b0
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Mon Mar 2 16:15:16 2015 -0500
+
+ Make it easier to find EXA
+
+ As of commit e31564e1a21e73f4d20d6471da4fc7a9b63e4062, the xserver is
+ more picky about the order in which headers are included. We need to
+ account for this in order for the compile time exa.h check to succeed.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit e13dd1d338e4501c9d98c86c60806cc3d6801ea8
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Mon Mar 2 15:21:17 2015 -0500
+
+ Include dpmsconst header
+
+ Fixes the build on some systems. Thank-you to Andrew Randrianasulu for
+ the patch.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit 86533afa3dd9a3567330f157d03cd8188f89cc72
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Mon Mar 2 15:18:19 2015 -0500
+
+ Typo fix
+
+ This only affects XAA builds but still. Thank-you to Andrew
+ Randrianasulu for the patch.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit fcee44e469b22934a04bd3ee19ed101aaa176a54
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Sat Aug 23 01:24:42 2014 -0400
+
+ Silence the non-debug warnings
+
+ Some declarations of pScrn are only there for debugging purposes. This
+ should make gcc quieter on most systems.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit 089c81ed6b6efc4610e0c5e5fcb36dfd58b83439
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Sat Aug 23 01:19:25 2014 -0400
+
+ Fix whitespace near panel code
+
+ This has been bugging me.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit 0519b7b3aac61dfd57cbf3bb0da561ca9bd079cb
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Sat Aug 23 01:13:18 2014 -0400
+
+ Improve panel code
+
+ Since the driver uses PanelXRes and PanelYRes to calculate stretch
+ ratios, it should try harder to set them. For LVDS, we need to move the
+ xorg.conf check so that it executes before the BIOS check. For DVI, we
+ should read them from the mode that the X server has identified as being
+ the native one. Even then, PanelXRes and PanelYRes are not guaranteed to
+ be positive, so the driver should verify this before dividing by them.
+
+ Another problem with the old panel code was that PanelPwrDly had no sane
+ default. It was also missing the check for Rage Pro 2 which lacks RMX.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit d49c3431e92a6120b054959ce6910e8decf61c67
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Fri Jul 25 13:39:08 2014 -0700
+
+ Remove custom DGA code
+
+ I have yet to see a use for the DGA code included in the driver.
+ According to radeon commits, it should be safe to replace it with DiDGA.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit 6140081f0e8f41cf85b8e86f7a9474c20be9a2e9
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Aug 6 15:51:33 2014 -0700
+
+ Remove custom dualhead code
+
+ There are probably no reasons left to use Xinerama over xrandr. This
+ removes the screen based dualhead code and the BIOS Display option in
+ xorg.conf. Additionally, R128ValidMode() is wrapped so that it can be
+ aware of multiple displays.
+
+ Even though some Crtc functions refer to them, PanelXRes and PanelYRes
+ should be properties of the Output. If this change to the code seems
+ awkward, see http://marc.info/?t=107222330700001 for more information.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit 2072d9aa1a144e699f020a7f9e6a870e410bc9d7
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Aug 6 15:41:02 2014 -0700
+
+ Improve handling of monitor and output types
+
+ Checking for OUTPUT_DVI is not the same as checking for MT_DFP. There
+ might be r128 cards with a DVI-I connector. These have the capability of
+ driving an MT_CRT so we now check the monitor type before programming
+ DAC or TMDS registers.
+
+ This patch also removes R128ConnectorType and R128BIOSConnector because
+ they were not doing much. These data structures are more useful for the
+ radeon driver where there is a much wider range of cards.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit 6dc5e9ab12dc31ae5de24f1d5c10c4fe80e7fe07
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Thu Jul 24 00:01:46 2014 -0700
+
+ Unify byte swappers
+
+ The cursor loading function was using a lot of code to swap bytes for
+ big endian systems. For awhile now, the solid picture support for EXA
+ has had a more optimized function that does the same thing.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit 48e9b2359e8ab07095e1cb024e61b223a67cbc1a
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Thu Jul 24 00:00:24 2014 -0700
+
+ Unify allocators
+
+ RandR and Xv were using almost the same code to grab offscreen memory
+ from EXA and XAA.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit 0d901460b375599c727928634d5f1067d2279844
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Jul 16 17:47:44 2014 -0700
+
+ Use standard integers
+
+ To fix another warning, we need to be consistent about when we use
+ CARD32 an when we use uint32_t. Xorg developers have decided on the
+ latter as a convention.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit b632e89b923179b16d0d38128209427f666b963c
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Jul 16 02:20:18 2014 -0700
+
+ Remove pointless output
+
+ This removes a debug line to fix a compiler warning and make the
+ crtc1 and crtc2 code more symmetric. The number of bits per pixel is
+ easy to find out anyway.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit 866d0ad5295a7ca819b990f607d3e68582144b3b
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Jul 16 17:39:59 2014 -0700
+
+ Cleanup info struct
+
+ This removes some dead code from info. It also fixes some indentation
+ errors that were likely caused by sed.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit d05123eab19705d23310d06a299e61093abbe6cc
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Jul 16 17:23:37 2014 -0700
+
+ Cleanup entity struct
+
+ This moves HasCRTC2 into the entity to make it more similar to radeon.
+ It also removes IsDRIEnabled for being dead code.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit c95ce4251921f09101911ca5c4ff3940c38cc6b5
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Jul 16 01:29:19 2014 -0700
+
+ Get entity without code duplication
+
+ This fixes the parts of the code that were not using the helper function
+ to find the entity.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit e9ea36390ea0478c4b867df3bffdf2b122e0cb15
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Jul 16 00:57:18 2014 -0700
+
+ Change register name
+
+ Surely this is a typo.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit 3bbce42414abea6c9977ff2b023ce3210d78f008
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Jul 9 11:40:35 2014 -0700
+
+ Move display enabling code to DPMS
+
+ This ensures that DAC, TMDS and LVDS enable bits are properly saved and
+ only set in the dpms hook.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit de7fa61b06c887df7a89154bf0f07703a665263a
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Jul 9 11:37:12 2014 -0700
+
+ Split up output register functions
+
+ The old code was writing registers more often than it needed to. TMDS
+ writes were triggered by changing the mode for an LVDS panel and RMX
+ writes were triggered by changing the mode for the second crtc. This
+ splits TMDS, LVDS, DAC and RMX calls into their own functions.
+
+ Also note that routing bits have been specified. R128_FP_SEL_CRTC2 and
+ R128_LVDS_SEL_CRTC2 are always unset to make the panels use the first
+ crtc. R128_DAC_CRT_SEL_CRTC2 is unset unless LVDS is already using the
+ first crtc.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit 4c6457e1893e16546c03ca85a2fa7378b6c927f3
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Mon Jul 7 18:49:15 2014 -0700
+
+ Map and unmap the MMIO better
+
+ Now that the MMIO stays mapped during several function calls, we need to
+ remember to unmap it if any of them fail. This also fixes a PowerPC code
+ path that was not updated to work with the longer lived MMIO.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit 539320429ff1cf8918862da3f950c8740ba63ec4
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Fri Jul 4 12:44:30 2014 -0700
+
+ Only enable CRTCs for DPMSModeOn
+
+ This was suggested as a power saving tip.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit 3ed5035074540785f820906529fcce3148e0b387
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Jul 2 02:18:48 2014 -0700
+
+ Port to RandR
+
+ This rearranges the r128 code to use the Crtc and Output interfaces
+ which should make the driver easier to maintain in the long run. User
+ visible changes include DDC detection working in more cases and the
+ ability to have multiple monitors with DRI.
+
+ Some choices have been made to conserve memory. Modes can be switched up
+ to the highest resolution in xorg.conf. If this is 1024x768 for example,
+ the front buffer will be 1024x768 instead of 1024x1024. This means 90
+ and 270 degree rotations will not work. However, scalings, reflection
+ and 180 degree rotations can be set with the xrandr client program.
+ Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=75629
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit 4efc87f41d770c753ddf7f54fe334b6dbd7daf79
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Mon Apr 28 21:26:44 2014 -0700
+
+ Fix ScreenInit with noAccel
+
+ Now that EXA is on by default, we must remember to turn it off again if
+ acceleration is disabled.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit 5ef5812a7a272aa08543cfd9b633f33c35e34dbd
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Tue Mar 4 01:43:00 2014 -0800
+
+ Remove overuse of COMPOSITE_SETUP()
+
+ COMPOSITE_SETUP() involves expensive register writes so
+ R128EnterServer() should call it once when there are 3D windows and 0
+ times when there are no 3D windows.
+
+ Instead the code was calling it once when there were no 3D windows and
+ arbitrarily many times when there were 3D windows.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
+
+commit 9eb693640136bc8bcbe706d642519b4eb23286d4
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Nov 27 18:14:43 2013 -0800
+
+ Only declare PCITAG if we need it
+
+ If libpciaccess is available, we do not need to declare the deprecated
+ PciTag member because it will not be used.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit 35dc7faf9f87332f51ff0a6aa866a56eb017a950
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Thu Nov 21 22:09:57 2013 -0800
+
+ Do not disable gouraud shading for a render op
+
+ The EXA Composite hooks should not overwrite any register values
+ expected by DRI. Initial testing of the EXA support revealed that
+ R128_WINDOW_XY_OFFSET is one register where we have to be careful.
+ However, it was mostly tested using glxgears which does not stress the
+ driver very much. Going through the various 3D screensavers one by one
+ reveals a bug where certain models turn green if compositing is enabled.
+
+ It seems that if we slightly alter the values passed to R128_SETUP_CNTL
+ and R128_PM4_VC_FPU_SETUP, the 3D driver will be happy and compositing
+ will still work. The proper way would be to constantly save and restore
+ register values but this showed poor performance when dragging 3D
+ windows across the screen.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit d757fe10b9ce9493ef3cf854bc03088366aa7256
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Fri Nov 22 22:55:59 2013 -0800
+
+ Drop dependence on xf86PciInfo.h
+
+ It is about time we stop using this deprecated file and include pciids
+ locally.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit d5da29d2ff94c80c8edefd6ccf5fd05fc6018870
+Author: Tormod Volden <debian.tormod@gmail.com>
+Date: Fri Oct 25 20:31:05 2013 +0200
+
+ Do not use int10 or VBE on powerpc
+
+ VBE was already skipped in the normal path, but not when setting
+ the PROBE_DETECT flag.
+
+ Should avoid bus error seen in
+ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=622606 and
+ http://lists.x.org/archives/xorg/2012-February/053969.html
+
+ Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+
+commit ccdfcf5c05ccade823c9734212dcb865d8958cbb
+Author: Tormod Volden <debian.tormod@gmail.com>
+Date: Wed Oct 2 20:36:38 2013 +0200
+
+ r128: bump to version 6.9.2
+
+ Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
+
+commit 255cf857af35e4024486cbc2693872d020f09a29
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Mon Sep 30 23:24:54 2013 -0700
+
+ Specify NULL for the platform probe function
+
+ Apparently this has been required by the ABI since server 1.13.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit a98077959a65dfda1db900373969bd08479d3e43
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Mon Sep 30 21:12:20 2013 -0700
+
+ Minor spacing changes
+
+ A log message needed a space added, two source files needed whitespace
+ removed.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit aca6aa127f43deeed42c4d3bef8d1e6a735b4c50
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Fri Mar 8 01:02:22 2013 -0800
+
+ Swap pixmap bytes for a solid picture on big endian host
+
+ Some PowerPC users were reporting color errors that only happened with
+ EXA+DRI. This implements a recent bugfix in the Radeon driver which will
+ solve at least one of these problems.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
+commit 24f28a78fdcd056357f137650ca7f0f01c257d97
+Author: Connor Behan <connor.behan@gmail.com>
+Date: Wed Dec 19 10:41:14 2012 -0800
+
+ Remove call to obsolete miInitializeBackingStore()
+
+ Definition was deleted from Xorg during 1.14 merge window, but has been
+ a no-op since 1.10 merge window.
+
+ Signed-off-by: Connor Behan <connor.behan@gmail.com>
+
commit ef4467b4aac70b9a8a1ef1194eb02d7551be2602
Author: Dave Airlie <airlied@redhat.com>
Date: Fri Sep 28 11:25:17 2012 +1000
diff --git a/driver/xf86-video-r128/Makefile.in b/driver/xf86-video-r128/Makefile.in
index 6c432119a..916afb0f7 100644
--- a/driver/xf86-video-r128/Makefile.in
+++ b/driver/xf86-video-r128/Makefile.in
@@ -72,8 +72,8 @@ host_triplet = @host@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
- $(top_srcdir)/configure COPYING ChangeLog INSTALL config.guess \
- config.sub depcomp install-sh ltmain.sh missing
+ $(top_srcdir)/configure COPYING ChangeLog INSTALL compile \
+ config.guess config.sub depcomp install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -300,6 +300,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/driver/xf86-video-r128/aclocal.m4 b/driver/xf86-video-r128/aclocal.m4
index 075dc526f..d60a81c4e 100644
--- a/driver/xf86-video-r128/aclocal.m4
+++ b/driver/xf86-video-r128/aclocal.m4
@@ -8606,32 +8606,63 @@ m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
-# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-# serial 1 (pkg-config-0.24)
-#
-# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 12 (pkg-config-0.29.2)
-# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-# ----------------------------------
+dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+dnl 02111-1307, USA.
+dnl
+dnl As a special exception to the GNU General Public License, if you
+dnl distribute this file as part of a program that contains a
+dnl configuration script generated by Autoconf, you may include it under
+dnl the same distribution terms that you use for the rest of that
+dnl program.
+
+dnl PKG_PREREQ(MIN-VERSION)
+dnl -----------------------
+dnl Since: 0.29
+dnl
+dnl Verify that the version of the pkg-config macros are at least
+dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
+dnl installed version of pkg-config, this checks the developer's version
+dnl of pkg.m4 when generating configure.
+dnl
+dnl To ensure that this macro is defined, also add:
+dnl m4_ifndef([PKG_PREREQ],
+dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
+dnl
+dnl See the "Since" comment for each macro you use to see what version
+dnl of the macros you require.
+m4_defun([PKG_PREREQ],
+[m4_define([PKG_MACROS_VERSION], [0.29.2])
+m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
+ [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
+])dnl PKG_PREREQ
+
+dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
+dnl ----------------------------------
+dnl Since: 0.16
+dnl
+dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
+dnl first found in the path. Checks that the version of pkg-config found
+dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
+dnl used since that's the first version where most current features of
+dnl pkg-config existed.
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
@@ -8653,18 +8684,19 @@ if test -n "$PKG_CONFIG"; then
PKG_CONFIG=""
fi
fi[]dnl
-])# PKG_PROG_PKG_CONFIG
+])dnl PKG_PROG_PKG_CONFIG
-# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#
-# Check to see whether a particular set of modules exists. Similar
-# to PKG_CHECK_MODULES(), but does not set variables or print errors.
-#
-# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-# only at the first occurence in configure.ac, so if the first place
-# it's called might be skipped (such as if it is within an "if", you
-# have to call PKG_CHECK_EXISTS manually
-# --------------------------------------------------------------
+dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------------------------------
+dnl Since: 0.18
+dnl
+dnl Check to see whether a particular set of modules exists. Similar to
+dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
+dnl
+dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+dnl only at the first occurence in configure.ac, so if the first place
+dnl it's called might be skipped (such as if it is within an "if", you
+dnl have to call PKG_CHECK_EXISTS manually
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
@@ -8674,8 +8706,10 @@ m4_ifvaln([$3], [else
$3])dnl
fi])
-# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-# ---------------------------------------------
+dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+dnl ---------------------------------------------
+dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
+dnl pkg_failed based on the result.
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
@@ -8687,10 +8721,11 @@ m4_define([_PKG_CONFIG],
else
pkg_failed=untried
fi[]dnl
-])# _PKG_CONFIG
+])dnl _PKG_CONFIG
-# _PKG_SHORT_ERRORS_SUPPORTED
-# -----------------------------
+dnl _PKG_SHORT_ERRORS_SUPPORTED
+dnl ---------------------------
+dnl Internal check to see if pkg-config supports short errors.
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -8698,26 +8733,24 @@ if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
else
_pkg_short_errors_supported=no
fi[]dnl
-])# _PKG_SHORT_ERRORS_SUPPORTED
+])dnl _PKG_SHORT_ERRORS_SUPPORTED
-# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-# [ACTION-IF-NOT-FOUND])
-#
-#
-# Note that if there is a possibility the first call to
-# PKG_CHECK_MODULES might not happen, you should be sure to include an
-# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-#
-#
-# --------------------------------------------------------------
+dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl [ACTION-IF-NOT-FOUND])
+dnl --------------------------------------------------------------
+dnl Since: 0.4.0
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
+dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
-AC_MSG_CHECKING([for $1])
+AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
@@ -8727,11 +8760,11 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
- else
+ else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
@@ -8748,7 +8781,7 @@ installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -8764,16 +8797,40 @@ else
AC_MSG_RESULT([yes])
$3
fi[]dnl
-])# PKG_CHECK_MODULES
+])dnl PKG_CHECK_MODULES
-# PKG_INSTALLDIR(DIRECTORY)
-# -------------------------
-# Substitutes the variable pkgconfigdir as the location where a module
-# should install pkg-config .pc files. By default the directory is
-# $libdir/pkgconfig, but the default can be changed by passing
-# DIRECTORY. The user can override through the --with-pkgconfigdir
-# parameter.
+dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl [ACTION-IF-NOT-FOUND])
+dnl ---------------------------------------------------------------------
+dnl Since: 0.29
+dnl
+dnl Checks for existence of MODULES and gathers its build flags with
+dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
+dnl and VARIABLE-PREFIX_LIBS from --libs.
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
+dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
+dnl configure.ac.
+AC_DEFUN([PKG_CHECK_MODULES_STATIC],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+_save_PKG_CONFIG=$PKG_CONFIG
+PKG_CONFIG="$PKG_CONFIG --static"
+PKG_CHECK_MODULES($@)
+PKG_CONFIG=$_save_PKG_CONFIG[]dnl
+])dnl PKG_CHECK_MODULES_STATIC
+
+
+dnl PKG_INSTALLDIR([DIRECTORY])
+dnl -------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable pkgconfigdir as the location where a module
+dnl should install pkg-config .pc files. By default the directory is
+dnl $libdir/pkgconfig, but the default can be changed by passing
+dnl DIRECTORY. The user can override through the --with-pkgconfigdir
+dnl parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
@@ -8784,16 +8841,18 @@ AC_ARG_WITH([pkgconfigdir],
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
-]) dnl PKG_INSTALLDIR
+])dnl PKG_INSTALLDIR
-# PKG_NOARCH_INSTALLDIR(DIRECTORY)
-# -------------------------
-# Substitutes the variable noarch_pkgconfigdir as the location where a
-# module should install arch-independent pkg-config .pc files. By
-# default the directory is $datadir/pkgconfig, but the default can be
-# changed by passing DIRECTORY. The user can override through the
-# --with-noarch-pkgconfigdir parameter.
+dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
+dnl --------------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable noarch_pkgconfigdir as the location where a
+dnl module should install arch-independent pkg-config .pc files. By
+dnl default the directory is $datadir/pkgconfig, but the default can be
+dnl changed by passing DIRECTORY. The user can override through the
+dnl --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
@@ -8804,7 +8863,24 @@ AC_ARG_WITH([noarch-pkgconfigdir],
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
-]) dnl PKG_NOARCH_INSTALLDIR
+])dnl PKG_NOARCH_INSTALLDIR
+
+
+dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------
+dnl Since: 0.28
+dnl
+dnl Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])dnl PKG_CHECK_VAR
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
#
@@ -9829,7 +9905,7 @@ AC_SUBST([am__untar])
dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
dnl
-dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
@@ -9866,7 +9942,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what
# version you require.
m4_defun([XORG_MACROS_VERSION],[
-m4_define([vers_have], [1.19.0])
+m4_define([vers_have], [1.19.2])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@@ -9944,6 +10020,17 @@ AC_DEFUN([XORG_MANPAGE_SECTIONS],[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_SED])
+case $host_os in
+ solaris*)
+ # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
+ # check for a man page file found in later versions that use
+ # traditional section numbers instead
+ AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
+ [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
+ ;;
+ *) SYSV_MAN_SECTIONS=false ;;
+esac
+
if test x$APP_MAN_SUFFIX = x ; then
APP_MAN_SUFFIX=1
fi
@@ -9959,9 +10046,9 @@ if test x$LIB_MAN_DIR = x ; then
fi
if test x$FILE_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) FILE_MAN_SUFFIX=4 ;;
- *) FILE_MAN_SUFFIX=5 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) FILE_MAN_SUFFIX=4 ;;
+ *) FILE_MAN_SUFFIX=5 ;;
esac
fi
if test x$FILE_MAN_DIR = x ; then
@@ -9969,9 +10056,9 @@ if test x$FILE_MAN_DIR = x ; then
fi
if test x$MISC_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) MISC_MAN_SUFFIX=5 ;;
- *) MISC_MAN_SUFFIX=7 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) MISC_MAN_SUFFIX=5 ;;
+ *) MISC_MAN_SUFFIX=7 ;;
esac
fi
if test x$MISC_MAN_DIR = x ; then
@@ -9979,9 +10066,9 @@ if test x$MISC_MAN_DIR = x ; then
fi
if test x$DRIVER_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) DRIVER_MAN_SUFFIX=7 ;;
- *) DRIVER_MAN_SUFFIX=4 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) DRIVER_MAN_SUFFIX=7 ;;
+ *) DRIVER_MAN_SUFFIX=4 ;;
esac
fi
if test x$DRIVER_MAN_DIR = x ; then
@@ -9989,9 +10076,9 @@ if test x$DRIVER_MAN_DIR = x ; then
fi
if test x$ADMIN_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) ADMIN_MAN_SUFFIX=1m ;;
- *) ADMIN_MAN_SUFFIX=8 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) ADMIN_MAN_SUFFIX=1m ;;
+ *) ADMIN_MAN_SUFFIX=8 ;;
esac
fi
if test x$ADMIN_MAN_DIR = x ; then
@@ -10252,13 +10339,24 @@ m4_ifval([$1],
fi])
# Test for the ability of xmlto to generate a text target
+#
+# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
+# following test for empty XML docbook files.
+# For compatibility reasons use the following empty XML docbook file and if
+# it fails try it again with a non-empty XML file.
have_xmlto_text=no
cat > conftest.xml << "EOF"
EOF
AS_IF([test "$have_xmlto" = yes],
[AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
[have_xmlto_text=yes],
- [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
+ [# Try it again with a non-empty XML file.
+ cat > conftest.xml << "EOF"
+<x></x>
+EOF
+ AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
+ [have_xmlto_text=yes],
+ [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
rm -f conftest.xml
AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
@@ -11654,8 +11752,9 @@ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
-|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
-echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
+|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
+touch \$(top_srcdir)/INSTALL; \
+echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
AC_SUBST([INSTALL_CMD])
]) # XORG_INSTALL
dnl Copyright 2005 Red Hat, Inc
@@ -11716,10 +11815,11 @@ AC_DEFUN([XORG_RELEASE_VERSION],[
#
#
AC_DEFUN([XORG_CHANGELOG], [
-CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
+CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
-|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
-echo 'git directory not found: installing possibly empty changelog.' >&2)"
+|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
+touch \$(top_srcdir)/ChangeLog; \
+echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
AC_SUBST([CHANGELOG_CMD])
]) # XORG_CHANGELOG
diff --git a/driver/xf86-video-r128/configure b/driver/xf86-video-r128/configure
index 5406b41a9..60d16a26b 100755
--- a/driver/xf86-video-r128/configure
+++ b/driver/xf86-video-r128/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for xf86-video-r128 6.9.1.
+# Generated by GNU Autoconf 2.69 for xf86-video-r128 6.12.0.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>.
#
@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='xf86-video-r128'
PACKAGE_TARNAME='xf86-video-r128'
-PACKAGE_VERSION='6.9.1'
-PACKAGE_STRING='xf86-video-r128 6.9.1'
+PACKAGE_VERSION='6.12.0'
+PACKAGE_STRING='xf86-video-r128 6.12.0'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg'
PACKAGE_URL=''
@@ -775,6 +775,7 @@ infodir
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -872,6 +873,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1124,6 +1126,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1261,7 +1272,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1374,7 +1385,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures xf86-video-r128 6.9.1 to adapt to many kinds of systems.
+\`configure' configures xf86-video-r128 6.12.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1414,6 +1425,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1444,7 +1456,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of xf86-video-r128 6.9.1:";;
+ short | recursive ) echo "Configuration of xf86-video-r128 6.12.0:";;
esac
cat <<\_ACEOF
@@ -1580,7 +1592,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-xf86-video-r128 configure 6.9.1
+xf86-video-r128 configure 6.12.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1995,7 +2007,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by xf86-video-r128 $as_me 6.9.1, which was
+It was created by xf86-video-r128 $as_me 6.12.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2824,7 +2836,7 @@ fi
# Define the identity of the package.
PACKAGE='xf86-video-r128'
- VERSION='6.9.1'
+ VERSION='6.12.0'
cat >>confdefs.h <<_ACEOF
@@ -10468,10 +10480,11 @@ _ACEOF
-CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
+CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
-|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
-echo 'git directory not found: installing possibly empty changelog.' >&2)"
+|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
+touch \$(top_srcdir)/ChangeLog; \
+echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
@@ -10479,13 +10492,44 @@ echo 'git directory not found: installing possibly empty changelog.' >&2)"
macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
-|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
-echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
+|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
+touch \$(top_srcdir)/INSTALL; \
+echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
+
+case $host_os in
+ solaris*)
+ # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
+ # check for a man page file found in later versions that use
+ # traditional section numbers instead
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/man/man7/attributes.7" >&5
+$as_echo_n "checking for /usr/share/man/man7/attributes.7... " >&6; }
+if ${ac_cv_file__usr_share_man_man7_attributes_7+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ test "$cross_compiling" = yes &&
+ as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "/usr/share/man/man7/attributes.7"; then
+ ac_cv_file__usr_share_man_man7_attributes_7=yes
+else
+ ac_cv_file__usr_share_man_man7_attributes_7=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_man_man7_attributes_7" >&5
+$as_echo "$ac_cv_file__usr_share_man_man7_attributes_7" >&6; }
+if test "x$ac_cv_file__usr_share_man_man7_attributes_7" = xyes; then :
+ SYSV_MAN_SECTIONS=false
+else
+ SYSV_MAN_SECTIONS=true
+fi
+
+ ;;
+ *) SYSV_MAN_SECTIONS=false ;;
+esac
if test x$APP_MAN_SUFFIX = x ; then
APP_MAN_SUFFIX=1
@@ -10502,9 +10546,9 @@ if test x$LIB_MAN_DIR = x ; then
fi
if test x$FILE_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) FILE_MAN_SUFFIX=4 ;;
- *) FILE_MAN_SUFFIX=5 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) FILE_MAN_SUFFIX=4 ;;
+ *) FILE_MAN_SUFFIX=5 ;;
esac
fi
if test x$FILE_MAN_DIR = x ; then
@@ -10512,9 +10556,9 @@ if test x$FILE_MAN_DIR = x ; then
fi
if test x$MISC_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) MISC_MAN_SUFFIX=5 ;;
- *) MISC_MAN_SUFFIX=7 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) MISC_MAN_SUFFIX=5 ;;
+ *) MISC_MAN_SUFFIX=7 ;;
esac
fi
if test x$MISC_MAN_DIR = x ; then
@@ -10522,9 +10566,9 @@ if test x$MISC_MAN_DIR = x ; then
fi
if test x$DRIVER_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) DRIVER_MAN_SUFFIX=7 ;;
- *) DRIVER_MAN_SUFFIX=4 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) DRIVER_MAN_SUFFIX=7 ;;
+ *) DRIVER_MAN_SUFFIX=4 ;;
esac
fi
if test x$DRIVER_MAN_DIR = x ; then
@@ -10532,9 +10576,9 @@ if test x$DRIVER_MAN_DIR = x ; then
fi
if test x$ADMIN_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) ADMIN_MAN_SUFFIX=1m ;;
- *) ADMIN_MAN_SUFFIX=8 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) ADMIN_MAN_SUFFIX=1m ;;
+ *) ADMIN_MAN_SUFFIX=8 ;;
esac
fi
if test x$ADMIN_MAN_DIR = x ; then
@@ -10614,30 +10658,6 @@ AM_BACKSLASH='\'
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
-$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
- # Check whether --enable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then :
- enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
-else
- USE_MAINTAINER_MODE=no
-fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
-$as_echo "$USE_MAINTAINER_MODE" >&6; }
- if test $USE_MAINTAINER_MODE = yes; then
- MAINTAINER_MODE_TRUE=
- MAINTAINER_MODE_FALSE='#'
-else
- MAINTAINER_MODE_TRUE='#'
- MAINTAINER_MODE_FALSE=
-fi
-
- MAINT=$MAINTAINER_MODE_TRUE
-
-
-
# Initialize libtool
# Check whether --enable-static was given.
if test "${enable_static+set}" = set; then :
@@ -17962,19 +17982,19 @@ $as_echo "$_EXT_CHECK" >&6; }
# Obtain compiler/linker options for the driver dependencies
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XORG" >&5
-$as_echo_n "checking for XORG... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES" >&5
+$as_echo_n "checking for xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES... " >&6; }
if test -n "$XORG_CFLAGS"; then
pkg_cv_XORG_CFLAGS="$XORG_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.2 xproto fontsproto \$REQUIRED_MODULES\""; } >&5
- ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.3 xproto fontsproto \$REQUIRED_MODULES\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_XORG_CFLAGS=`$PKG_CONFIG --cflags "xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES" 2>/dev/null`
+ pkg_cv_XORG_CFLAGS=`$PKG_CONFIG --cflags "xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -17986,12 +18006,12 @@ if test -n "$XORG_LIBS"; then
pkg_cv_XORG_LIBS="$XORG_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.2 xproto fontsproto \$REQUIRED_MODULES\""; } >&5
- ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.3 xproto fontsproto \$REQUIRED_MODULES\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_XORG_LIBS=`$PKG_CONFIG --libs "xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES" 2>/dev/null`
+ pkg_cv_XORG_LIBS=`$PKG_CONFIG --libs "xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -18003,7 +18023,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -18012,14 +18032,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- XORG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES" 2>&1`
+ XORG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES" 2>&1`
else
- XORG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES" 2>&1`
+ XORG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$XORG_PKG_ERRORS" >&5
- as_fn_error $? "Package requirements (xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES) were not met:
+ as_fn_error $? "Package requirements (xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES) were not met:
$XORG_PKG_ERRORS
@@ -18030,7 +18050,7 @@ Alternatively, you may set the environment variables XORG_CFLAGS
and XORG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -18053,8 +18073,8 @@ $as_echo "yes" >&6; }
fi
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XEXT" >&5
-$as_echo_n "checking for XEXT... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xextproto >= 7.0.99.1" >&5
+$as_echo_n "checking for xextproto >= 7.0.99.1... " >&6; }
if test -n "$XEXT_CFLAGS"; then
pkg_cv_XEXT_CFLAGS="$XEXT_CFLAGS"
@@ -18094,7 +18114,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -18112,7 +18132,7 @@ fi
HAVE_XEXTPROTO_71="no"
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
HAVE_XEXTPROTO_71="no"
else
@@ -18137,98 +18157,26 @@ sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
# Checks for libraries.
if test "$DRI" != no; then
- as_ac_File=`$as_echo "ac_cv_file_${sdkdir}/dri.h" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${sdkdir}/dri.h" >&5
-$as_echo_n "checking for ${sdkdir}/dri.h... " >&6; }
-if eval \${$as_ac_File+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- test "$cross_compiling" = yes &&
- as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
-if test -r "${sdkdir}/dri.h"; then
- eval "$as_ac_File=yes"
-else
- eval "$as_ac_File=no"
-fi
-fi
-eval ac_res=\$$as_ac_File
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
- have_dri_h="yes"
-else
- have_dri_h="no"
-fi
-
- as_ac_File=`$as_echo "ac_cv_file_${sdkdir}/sarea.h" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${sdkdir}/sarea.h" >&5
-$as_echo_n "checking for ${sdkdir}/sarea.h... " >&6; }
-if eval \${$as_ac_File+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- test "$cross_compiling" = yes &&
- as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
-if test -r "${sdkdir}/sarea.h"; then
- eval "$as_ac_File=yes"
-else
- eval "$as_ac_File=no"
-fi
-fi
-eval ac_res=\$$as_ac_File
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
- have_sarea_h="yes"
-else
- have_sarea_h="no"
-fi
-
- as_ac_File=`$as_echo "ac_cv_file_${sdkdir}/dristruct.h" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${sdkdir}/dristruct.h" >&5
-$as_echo_n "checking for ${sdkdir}/dristruct.h... " >&6; }
-if eval \${$as_ac_File+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- test "$cross_compiling" = yes &&
- as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
-if test -r "${sdkdir}/dristruct.h"; then
- eval "$as_ac_File=yes"
-else
- eval "$as_ac_File=no"
-fi
-fi
-eval ac_res=\$$as_ac_File
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
- have_dristruct_h="yes"
-else
- have_dristruct_h="no"
-fi
-
- as_ac_File=`$as_echo "ac_cv_file_${sdkdir}/damage.h" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${sdkdir}/damage.h" >&5
-$as_echo_n "checking for ${sdkdir}/damage.h... " >&6; }
-if eval \${$as_ac_File+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- test "$cross_compiling" = yes &&
- as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
-if test -r "${sdkdir}/damage.h"; then
- eval "$as_ac_File=yes"
-else
- eval "$as_ac_File=no"
-fi
-fi
-eval ac_res=\$$as_ac_File
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
- have_damage_h="yes"
-else
- have_damage_h="no"
-fi
-
+ if test -f "${sdkdir}/dri.h"; then
+ have_dri_h="yes"
+ else
+ have_dri_h="no"
+ fi
+ if test -f "${sdkdir}/sarea.h"; then
+ have_sarea_h="yes"
+ else
+ have_sarea_h="no"
+ fi
+ if test -f "${sdkdir}/dristruct.h"; then
+ have_dristruct_h="yes"
+ else
+ have_dristruct_h="no"
+ fi
+ if test -f "${sdkdir}/damage.h"; then
+ have_damage_h="yes"
+ else
+ have_damage_h="no"
+ fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include DRI support" >&5
@@ -18256,8 +18204,8 @@ fi
if test "$DRI" = yes; then
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DRI" >&5
-$as_echo_n "checking for DRI... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdrm >= 2.2 xf86driproto" >&5
+$as_echo_n "checking for libdrm >= 2.2 xf86driproto... " >&6; }
if test -n "$DRI_CFLAGS"; then
pkg_cv_DRI_CFLAGS="$DRI_CFLAGS"
@@ -18297,7 +18245,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -18324,7 +18272,7 @@ Alternatively, you may set the environment variables DRI_CFLAGS
and DRI_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -18361,29 +18309,11 @@ $as_echo_n "checking whether to enable EXA support... " >&6; }
if test "x$EXA" = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- as_ac_File=`$as_echo "ac_cv_file_${sdkdir}/exa.h" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${sdkdir}/exa.h" >&5
-$as_echo_n "checking for ${sdkdir}/exa.h... " >&6; }
-if eval \${$as_ac_File+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- test "$cross_compiling" = yes &&
- as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
-if test -r "${sdkdir}/exa.h"; then
- eval "$as_ac_File=yes"
-else
- eval "$as_ac_File=no"
-fi
-fi
-eval ac_res=\$$as_ac_File
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
+ if test -f "${sdkdir}/exa.h"; then :
have_exa_h="yes"
else
have_exa_h="no"
fi
-
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
@@ -18397,7 +18327,7 @@ $as_echo_n "checking whether EXA version is at least 2.0.0... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <xorg-server.h>
+#include "xorg-server.h"
#include "exa.h"
#if EXA_VERSION_MAJOR < 2
#error OLD EXA!
@@ -18491,8 +18421,8 @@ fi
if test "x$XSERVER_LIBPCIACCESS" = xyes; then
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PCIACCESS" >&5
-$as_echo_n "checking for PCIACCESS... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pciaccess >= 0.8.0" >&5
+$as_echo_n "checking for pciaccess >= 0.8.0... " >&6; }
if test -n "$PCIACCESS_CFLAGS"; then
pkg_cv_PCIACCESS_CFLAGS="$PCIACCESS_CFLAGS"
@@ -18532,7 +18462,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -18559,7 +18489,7 @@ Alternatively, you may set the environment variables PCIACCESS_CFLAGS
and PCIACCESS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -18870,10 +18800,6 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
- as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
if test -z "${HAVE_XEXTPROTO_71_TRUE}" && test -z "${HAVE_XEXTPROTO_71_FALSE}"; then
as_fn_error $? "conditional \"HAVE_XEXTPROTO_71\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -19291,7 +19217,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by xf86-video-r128 $as_me 6.9.1, which was
+This file was extended by xf86-video-r128 $as_me 6.12.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -19357,7 +19283,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-xf86-video-r128 config.status 6.9.1
+xf86-video-r128 config.status 6.12.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/driver/xf86-video-r128/configure.ac b/driver/xf86-video-r128/configure.ac
index f7c49ccc6..b1c6cc7b5 100644
--- a/driver/xf86-video-r128/configure.ac
+++ b/driver/xf86-video-r128/configure.ac
@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-video-r128],
- [6.9.1],
+ [6.12.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[xf86-video-r128])
AC_CONFIG_SRCDIR([Makefile.am])
@@ -39,8 +39,6 @@ m4_ifndef([XORG_MACROS_VERSION],
XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS
-AM_MAINTAINER_MODE
-
# Initialize libtool
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
@@ -76,7 +74,7 @@ XORG_DRIVER_CHECK_EXT(XF86MISC, xf86miscproto)
XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
# Obtain compiler/linker options for the driver dependencies
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES])
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES])
PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
HAVE_XEXTPROTO_71="no")
@@ -86,14 +84,26 @@ sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
# Checks for libraries.
if test "$DRI" != no; then
- AC_CHECK_FILE([${sdkdir}/dri.h],
- [have_dri_h="yes"], [have_dri_h="no"])
- AC_CHECK_FILE([${sdkdir}/sarea.h],
- [have_sarea_h="yes"], [have_sarea_h="no"])
- AC_CHECK_FILE([${sdkdir}/dristruct.h],
- [have_dristruct_h="yes"], [have_dristruct_h="no"])
- AC_CHECK_FILE([${sdkdir}/damage.h],
- [have_damage_h="yes"], [have_damage_h="no"])
+ if test -f "${sdkdir}/dri.h"; then
+ have_dri_h="yes"
+ else
+ have_dri_h="no"
+ fi
+ if test -f "${sdkdir}/sarea.h"; then
+ have_sarea_h="yes"
+ else
+ have_sarea_h="no"
+ fi
+ if test -f "${sdkdir}/dristruct.h"; then
+ have_dristruct_h="yes"
+ else
+ have_dristruct_h="no"
+ fi
+ if test -f "${sdkdir}/damage.h"; then
+ have_damage_h="yes"
+ else
+ have_damage_h="no"
+ fi
fi
AC_MSG_CHECKING([whether to include DRI support])
@@ -121,7 +131,7 @@ CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
AC_MSG_CHECKING([whether to enable EXA support])
if test "x$EXA" = xyes; then
AC_MSG_RESULT(yes)
- AC_CHECK_FILE(${sdkdir}/exa.h, [have_exa_h="yes"], [have_exa_h="no"])
+ AS_IF([test -f "${sdkdir}/exa.h"], [have_exa_h="yes"], [have_exa_h="no"])
else
AC_MSG_RESULT(no)
fi
@@ -131,7 +141,7 @@ CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
if test "x$have_exa_h" = xyes; then
AC_MSG_CHECKING([whether EXA version is at least 2.0.0])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
-#include <xorg-server.h>
+#include "xorg-server.h"
#include "exa.h"
#if EXA_VERSION_MAJOR < 2
#error OLD EXA!
diff --git a/driver/xf86-video-r128/man/Makefile.in b/driver/xf86-video-r128/man/Makefile.in
index 26a1f696c..b99a6c1f3 100644
--- a/driver/xf86-video-r128/man/Makefile.in
+++ b/driver/xf86-video-r128/man/Makefile.in
@@ -271,6 +271,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/driver/xf86-video-r128/man/r128.man b/driver/xf86-video-r128/man/r128.man
index d490f93fa..a93157a9b 100644
--- a/driver/xf86-video-r128/man/r128.man
+++ b/driver/xf86-video-r128/man/r128.man
@@ -78,34 +78,10 @@ stable. EXA is a newer acceleration architecture with better performance for
the Render and Composite extensions. The default is
.B XAA.
.TP
-.BI "Option \*qDac6Bit\*q \*q" boolean \*q
-Enables or disables the use of 6 bits per color component when in 8 bpp
-mode (emulates VGA mode). By default, all 8 bits per color component
-are used. The default is
-.B off.
-.TP
.BI "Option \*qVideoKey\*q \*q" integer \*q
This overrides the default pixel value for the YUV video overlay key.
The default value is
.B undefined.
-.TP
-.BI "Option \*qDisplay\*q \*q" string \*q
-Select display mode for devices which support flat panels. Supported modes are:
-
-.B \*qFP\*q
-- use flat panel;
-
-.B \*qCRT\*q
-- use cathode ray tube;
-
-.B \*qMirror\*q
-- use both FP and CRT;
-
-.B \*qBIOS\*q
-- use mode as configured in the BIOS.
-
-The default is
-.B FP.
.PP
The following
diff --git a/driver/xf86-video-r128/src/Makefile.am b/driver/xf86-video-r128/src/Makefile.am
index 23e6c4929..45aafb55b 100644
--- a/driver/xf86-video-r128/src/Makefile.am
+++ b/driver/xf86-video-r128/src/Makefile.am
@@ -31,7 +31,9 @@ R128_DRI_SRCS = r128_dri.c
endif
if USE_EXA
-R128_EXA_SRCS = r128_exa.c
+R128_EXA_SRCS = \
+ r128_exa.c \
+ r128_exa_render.c
endif
AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@
@@ -40,18 +42,26 @@ r128_drv_la_LTLIBRARIES = r128_drv.la
r128_drv_la_LDFLAGS = -module -avoid-version
r128_drv_ladir = @moduledir@/drivers
r128_drv_la_SOURCES = \
- r128_accel.c r128_cursor.c r128_dga.c r128_driver.c \
- r128_video.c r128_misc.c r128_probe.c $(R128_EXA_SRCS) $(R128_DRI_SRCS)
+ r128_accel.c \
+ r128_crtc.c \
+ r128_cursor.c \
+ r128_driver.c \
+ r128_misc.c \
+ r128_output.c \
+ r128_probe.c \
+ r128_video.c \
+ $(R128_EXA_SRCS) \
+ $(R128_DRI_SRCS)
EXTRA_DIST = \
- compat-api.h \
+ compat-api.h \
+ r128.h \
r128_common.h \
r128_dri.h \
r128_dripriv.h \
- r128.h \
r128_probe.h \
r128_reg.h \
+ r128_rop.h \
r128_sarea.h \
r128_version.h \
- r128_exa_render.c \
atipcirename.h
diff --git a/driver/xf86-video-r128/src/Makefile.in b/driver/xf86-video-r128/src/Makefile.in
index b720b99be..22ee34c74 100644
--- a/driver/xf86-video-r128/src/Makefile.in
+++ b/driver/xf86-video-r128/src/Makefile.in
@@ -118,14 +118,14 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(r128_drv_ladir)"
LTLIBRARIES = $(r128_drv_la_LTLIBRARIES)
r128_drv_la_LIBADD =
-am__r128_drv_la_SOURCES_DIST = r128_accel.c r128_cursor.c r128_dga.c \
- r128_driver.c r128_video.c r128_misc.c r128_probe.c r128_exa.c \
- r128_dri.c
-@USE_EXA_TRUE@am__objects_1 = r128_exa.lo
+am__r128_drv_la_SOURCES_DIST = r128_accel.c r128_crtc.c r128_cursor.c \
+ r128_driver.c r128_misc.c r128_output.c r128_probe.c \
+ r128_video.c r128_exa.c r128_exa_render.c r128_dri.c
+@USE_EXA_TRUE@am__objects_1 = r128_exa.lo r128_exa_render.lo
@DRI_TRUE@am__objects_2 = r128_dri.lo
-am_r128_drv_la_OBJECTS = r128_accel.lo r128_cursor.lo r128_dga.lo \
- r128_driver.lo r128_video.lo r128_misc.lo r128_probe.lo \
- $(am__objects_1) $(am__objects_2)
+am_r128_drv_la_OBJECTS = r128_accel.lo r128_crtc.lo r128_cursor.lo \
+ r128_driver.lo r128_misc.lo r128_output.lo r128_probe.lo \
+ r128_video.lo $(am__objects_1) $(am__objects_2)
r128_drv_la_OBJECTS = $(am_r128_drv_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -317,6 +317,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -326,26 +327,37 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@DRI_TRUE@R128_DRI_SRCS = r128_dri.c
-@USE_EXA_TRUE@R128_EXA_SRCS = r128_exa.c
+@USE_EXA_TRUE@R128_EXA_SRCS = \
+@USE_EXA_TRUE@ r128_exa.c \
+@USE_EXA_TRUE@ r128_exa_render.c
+
AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@
r128_drv_la_LTLIBRARIES = r128_drv.la
r128_drv_la_LDFLAGS = -module -avoid-version
r128_drv_ladir = @moduledir@/drivers
r128_drv_la_SOURCES = \
- r128_accel.c r128_cursor.c r128_dga.c r128_driver.c \
- r128_video.c r128_misc.c r128_probe.c $(R128_EXA_SRCS) $(R128_DRI_SRCS)
+ r128_accel.c \
+ r128_crtc.c \
+ r128_cursor.c \
+ r128_driver.c \
+ r128_misc.c \
+ r128_output.c \
+ r128_probe.c \
+ r128_video.c \
+ $(R128_EXA_SRCS) \
+ $(R128_DRI_SRCS)
EXTRA_DIST = \
- compat-api.h \
+ compat-api.h \
+ r128.h \
r128_common.h \
r128_dri.h \
r128_dripriv.h \
- r128.h \
r128_probe.h \
r128_reg.h \
+ r128_rop.h \
r128_sarea.h \
r128_version.h \
- r128_exa_render.c \
atipcirename.h
all: all-am
@@ -426,12 +438,14 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_accel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_crtc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_cursor.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_dga.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_dri.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_driver.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_exa.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_exa_render.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_misc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_output.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_probe.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_video.Plo@am__quote@
diff --git a/driver/xf86-video-r128/src/compat-api.h b/driver/xf86-video-r128/src/compat-api.h
index 89976e41c..5583b9ad8 100644
--- a/driver/xf86-video-r128/src/compat-api.h
+++ b/driver/xf86-video-r128/src/compat-api.h
@@ -48,8 +48,13 @@
#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
+#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0)
+#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout
+#define BLOCKHANDLER_ARGS arg, pTimeout
+#else
#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
+#endif
#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
diff --git a/driver/xf86-video-r128/src/r128.h b/driver/xf86-video-r128/src/r128.h
index fdf2f2b5a..5e6502bc1 100644
--- a/driver/xf86-video-r128/src/r128.h
+++ b/driver/xf86-video-r128/src/r128.h
@@ -70,10 +70,10 @@
#define _XF86DRI_SERVER_
#include "r128_dripriv.h"
#include "dri.h"
-#include "GL/glxint.h"
#endif
#include "fb.h"
+#include "xf86Crtc.h"
#include "compat-api.h"
#include "atipcirename.h"
@@ -120,13 +120,14 @@
#if R128_DEBUG
#include "r128_version.h"
-#define R128TRACE(x) \
- do { \
- ErrorF("(**) %s(%d): ", R128_NAME, pScrn->scrnIndex); \
- ErrorF x; \
- } while (0);
+#endif
+
+#if R128_DEBUG
+#define DEBUG(x) x
+
#else
-#define R128TRACE(x)
+#define DEBUG(x)
+
#endif
@@ -135,6 +136,14 @@
#define R128_ALIGN(x,bytes) (((x) + ((bytes) - 1)) & ~((bytes) - 1))
#define R128PTR(pScrn) ((R128InfoPtr)(pScrn)->driverPrivate)
+#define R128_BIOS8(v) ((info->VBIOS[(v)]))
+#define R128_BIOS16(v) ((info->VBIOS[(v)]) | \
+ (info->VBIOS[(v) + 1] << 8))
+#define R128_BIOS32(v) ((info->VBIOS[(v)]) | \
+ (info->VBIOS[(v) + 1] << 8) | \
+ (info->VBIOS[(v) + 2] << 16) | \
+ (info->VBIOS[(v) + 3] << 24))
+
typedef struct { /* All values in XCLKS */
int ML; /* Memory Read Latency */
int MB; /* Memory Burst Length */
@@ -150,105 +159,106 @@ typedef struct { /* All values in XCLKS */
typedef struct {
/* Common registers */
- CARD32 ovr_clr;
- CARD32 ovr_wid_left_right;
- CARD32 ovr_wid_top_bottom;
- CARD32 ov0_scale_cntl;
- CARD32 mpp_tb_config;
- CARD32 mpp_gp_config;
- CARD32 subpic_cntl;
- CARD32 viph_control;
- CARD32 i2c_cntl_1;
- CARD32 gen_int_cntl;
- CARD32 cap0_trig_cntl;
- CARD32 cap1_trig_cntl;
- CARD32 bus_cntl;
- CARD32 config_cntl;
+ uint32_t ovr_clr;
+ uint32_t ovr_wid_left_right;
+ uint32_t ovr_wid_top_bottom;
+ uint32_t ov0_scale_cntl;
+ uint32_t mpp_tb_config;
+ uint32_t mpp_gp_config;
+ uint32_t subpic_cntl;
+ uint32_t viph_control;
+ uint32_t i2c_cntl_1;
+ uint32_t gen_int_cntl;
+ uint32_t cap0_trig_cntl;
+ uint32_t cap1_trig_cntl;
+ uint32_t bus_cntl;
+ uint32_t config_cntl;
/* Other registers to save for VT switches */
- CARD32 dp_datatype;
- CARD32 gen_reset_cntl;
- CARD32 clock_cntl_index;
- CARD32 amcgpio_en_reg;
- CARD32 amcgpio_mask;
+ uint32_t dp_datatype;
+ uint32_t gen_reset_cntl;
+ uint32_t clock_cntl_index;
+ uint32_t amcgpio_en_reg;
+ uint32_t amcgpio_mask;
/* CRTC registers */
- CARD32 crtc_gen_cntl;
- CARD32 crtc_ext_cntl;
- CARD32 dac_cntl;
- CARD32 crtc_h_total_disp;
- CARD32 crtc_h_sync_strt_wid;
- CARD32 crtc_v_total_disp;
- CARD32 crtc_v_sync_strt_wid;
- CARD32 crtc_offset;
- CARD32 crtc_offset_cntl;
- CARD32 crtc_pitch;
+ uint32_t crtc_gen_cntl;
+ uint32_t crtc_ext_cntl;
+ uint32_t dac_cntl;
+ uint32_t crtc_h_total_disp;
+ uint32_t crtc_h_sync_strt_wid;
+ uint32_t crtc_v_total_disp;
+ uint32_t crtc_v_sync_strt_wid;
+ uint32_t crtc_offset;
+ uint32_t crtc_offset_cntl;
+ uint32_t crtc_pitch;
/* CRTC2 registers */
- CARD32 crtc2_gen_cntl;
- CARD32 crtc2_h_total_disp;
- CARD32 crtc2_h_sync_strt_wid;
- CARD32 crtc2_v_total_disp;
- CARD32 crtc2_v_sync_strt_wid;
- CARD32 crtc2_offset;
- CARD32 crtc2_offset_cntl;
- CARD32 crtc2_pitch;
+ uint32_t crtc2_gen_cntl;
+ uint32_t crtc2_h_total_disp;
+ uint32_t crtc2_h_sync_strt_wid;
+ uint32_t crtc2_v_total_disp;
+ uint32_t crtc2_v_sync_strt_wid;
+ uint32_t crtc2_offset;
+ uint32_t crtc2_offset_cntl;
+ uint32_t crtc2_pitch;
/* Flat panel registers */
- CARD32 fp_crtc_h_total_disp;
- CARD32 fp_crtc_v_total_disp;
- CARD32 fp_gen_cntl;
- CARD32 fp_h_sync_strt_wid;
- CARD32 fp_horz_stretch;
- CARD32 fp_panel_cntl;
- CARD32 fp_v_sync_strt_wid;
- CARD32 fp_vert_stretch;
- CARD32 lvds_gen_cntl;
- CARD32 tmds_crc;
- CARD32 tmds_transmitter_cntl;
+ uint32_t fp_crtc_h_total_disp;
+ uint32_t fp_crtc_v_total_disp;
+ uint32_t fp_gen_cntl;
+ uint32_t fp_h_sync_strt_wid;
+ uint32_t fp_horz_stretch;
+ uint32_t fp_panel_cntl;
+ uint32_t fp_v_sync_strt_wid;
+ uint32_t fp_vert_stretch;
+ uint32_t lvds_gen_cntl;
+ uint32_t tmds_crc;
+ uint32_t tmds_transmitter_cntl;
/* Computed values for PLL */
- CARD32 dot_clock_freq;
- CARD32 pll_output_freq;
+ uint32_t dot_clock_freq;
+ uint32_t pll_output_freq;
int feedback_div;
int post_div;
/* PLL registers */
- CARD32 ppll_ref_div;
- CARD32 ppll_div_3;
- CARD32 htotal_cntl;
+ uint32_t ppll_ref_div;
+ uint32_t ppll_div_3;
+ uint32_t ppll_div_0;
+ uint32_t htotal_cntl;
/* Computed values for PLL2 */
- CARD32 dot_clock_freq_2;
- CARD32 pll_output_freq_2;
+ uint32_t dot_clock_freq_2;
+ uint32_t pll_output_freq_2;
int feedback_div_2;
int post_div_2;
/* PLL2 registers */
- CARD32 p2pll_ref_div;
- CARD32 p2pll_div_0;
- CARD32 htotal_cntl2;
+ uint32_t p2pll_ref_div;
+ uint32_t p2pll_div_0;
+ uint32_t htotal_cntl2;
/* DDA register */
- CARD32 dda_config;
- CARD32 dda_on_off;
+ uint32_t dda_config;
+ uint32_t dda_on_off;
/* DDA2 register */
- CARD32 dda2_config;
- CARD32 dda2_on_off;
+ uint32_t dda2_config;
+ uint32_t dda2_on_off;
/* Pallet */
Bool palette_valid;
- CARD32 palette[256];
- CARD32 palette2[256];
+ uint32_t palette[256];
+ uint32_t palette2[256];
} R128SaveRec, *R128SavePtr;
typedef struct {
- CARD16 reference_freq;
- CARD16 reference_div;
+ uint16_t reference_freq;
+ uint16_t reference_div;
unsigned min_pll_freq;
unsigned max_pll_freq;
- CARD16 xclk;
+ uint16_t xclk;
} R128PLLRec, *R128PLLPtr;
typedef struct {
@@ -260,16 +270,6 @@ typedef struct {
DisplayModePtr mode;
} R128FBLayout;
-typedef enum
-{
- MT_NONE,
- MT_CRT,
- MT_LCD,
- MT_DFP,
- MT_CTV,
- MT_STV
-} R128MonitorType;
-
#ifdef USE_EXA
struct r128_2d_state {
Bool in_use;
@@ -305,7 +305,6 @@ typedef struct {
PCITAG PciTag;
#endif
int Chipset;
- Bool Primary;
Bool FBDev;
@@ -315,28 +314,13 @@ typedef struct {
void *MMIO; /* Map of MMIO region */
void *FB; /* Map of frame buffer */
+ uint8_t *VBIOS; /* Video BIOS for mode validation on FPs */
+ int FPBIOSstart; /* Start of the flat panel info */
- CARD32 MemCntl;
- CARD32 BusCntl;
+ uint32_t MemCntl;
+ uint32_t BusCntl;
unsigned long FbMapSize; /* Size of frame buffer, in bytes */
- int Flags; /* Saved copy of mode flags */
-
- CARD8 BIOSDisplay; /* Device the BIOS is set to display to */
-
Bool HasPanelRegs; /* Current chip can connect to a FP */
- CARD8 *VBIOS; /* Video BIOS for mode validation on FPs */
- int FPBIOSstart; /* Start of the flat panel info */
-
- /* Computed values for FPs */
- int PanelXRes;
- int PanelYRes;
- int HOverPlus;
- int HSyncWidth;
- int HBlank;
- int VOverPlus;
- int VSyncWidth;
- int VBlank;
- int PanelPwrDly;
R128PLLRec pll;
R128RAMPtr ram;
@@ -351,8 +335,9 @@ typedef struct {
#ifdef HAVE_XAA_H
XAAInfoRecPtr accel;
#endif
- Bool accelOn;
+ Bool noAccel;
+ Bool accelOn;
Bool useEXA;
Bool RenderAccel;
#ifdef USE_EXA
@@ -361,24 +346,15 @@ typedef struct {
struct r128_2d_state state_2d;
#endif
- xf86CursorInfoPtr cursor;
- unsigned long cursor_start;
- unsigned long cursor_end;
-
- /*
- * XAAForceTransBlit is used to change the behavior of the XAA
- * SetupForScreenToScreenCopy function, to make it DGA-friendly.
- */
- Bool XAAForceTransBlit;
-
int fifo_slots; /* Free slots in the FIFO (64 max) */
int pix24bpp; /* Depth of pixmap for 24bpp framebuffer */
Bool dac6bits; /* Use 6 bit DAC? */
+ Bool swCursor;
/* Computed values for Rage 128 */
int pitch;
int datatype;
- CARD32 dp_gui_master_cntl;
+ uint32_t dp_gui_master_cntl;
/* Saved values for ScreenToScreenCopy */
int xdir;
@@ -403,30 +379,21 @@ typedef struct {
int scanline_direct;
int scanline_bpp; /* Only used for ImageWrite */
- DGAModePtr DGAModes;
- int numDGAModes;
- Bool DGAactive;
- int DGAViewportStatus;
- DGAFunctionRec DGAFuncs;
-
R128FBLayout CurrentLayout;
#ifdef R128DRI
Bool directRenderingEnabled;
DRIInfoPtr pDRIInfo;
int drmFD;
- drm_context_t drmCtx;
- int numVisualConfigs;
- __GLXvisualConfig *pVisualConfigs;
- R128ConfigPrivPtr pVisualConfigsPriv;
+ drm_context_t drmCtx;
- drm_handle_t fbHandle;
+ drm_handle_t fbHandle;
drmSize registerSize;
- drm_handle_t registerHandle;
+ drm_handle_t registerHandle;
Bool IsPCI; /* Current card is a PCI card */
drmSize pciSize;
- drm_handle_t pciMemHandle;
+ drm_handle_t pciMemHandle;
drmAddress PCI; /* Map */
Bool allowPageFlip; /* Enable 3d page flipping */
@@ -434,7 +401,7 @@ typedef struct {
int drmMinor;
drmSize agpSize;
- drm_handle_t agpMemHandle; /* Handle from drmAgpAlloc */
+ drm_handle_t agpMemHandle; /* Handle from drmAgpAlloc */
unsigned long agpOffset;
drmAddress AGP; /* Map */
int agpMode;
@@ -447,20 +414,20 @@ typedef struct {
/* CCE ring buffer data */
unsigned long ringStart; /* Offset into AGP space */
- drm_handle_t ringHandle; /* Handle from drmAddMap */
+ drm_handle_t ringHandle; /* Handle from drmAddMap */
drmSize ringMapSize; /* Size of map */
int ringSize; /* Size of ring (in MB) */
drmAddress ring; /* Map */
int ringSizeLog2QW;
unsigned long ringReadOffset; /* Offset into AGP space */
- drm_handle_t ringReadPtrHandle; /* Handle from drmAddMap */
+ drm_handle_t ringReadPtrHandle;/* Handle from drmAddMap */
drmSize ringReadMapSize; /* Size of map */
drmAddress ringReadPtr; /* Map */
/* CCE vertex/indirect buffer data */
unsigned long bufStart; /* Offset into AGP space */
- drm_handle_t bufHandle; /* Handle from drmAddMap */
+ drm_handle_t bufHandle; /* Handle from drmAddMap */
drmSize bufMapSize; /* Size of map */
int bufSize; /* Size of buffers (in MB) */
drmAddress buf; /* Map */
@@ -469,7 +436,7 @@ typedef struct {
/* CCE AGP Texture data */
unsigned long agpTexStart; /* Offset into AGP space */
- drm_handle_t agpTexHandle; /* Handle from drmAddMap */
+ drm_handle_t agpTexHandle; /* Handle from drmAddMap */
drmSize agpTexMapSize; /* Size of map */
int agpTexSize; /* Size of AGP tex space (in MB) */
drmAddress agpTex; /* Map */
@@ -499,18 +466,18 @@ typedef struct {
int log2TexGran;
/* Saved scissor values */
- CARD32 sc_left;
- CARD32 sc_right;
- CARD32 sc_top;
- CARD32 sc_bottom;
+ uint32_t sc_left;
+ uint32_t sc_right;
+ uint32_t sc_top;
+ uint32_t sc_bottom;
- CARD32 re_top_left;
- CARD32 re_width_height;
+ uint32_t re_top_left;
+ uint32_t re_width_height;
- CARD32 aux_sc_cntl;
+ uint32_t aux_sc_cntl;
int irq;
- CARD32 gen_int_cntl;
+ uint32_t gen_int_cntl;
Bool DMAForXv;
#endif
@@ -523,19 +490,10 @@ typedef struct {
Bool isDFP;
Bool isPro2;
- I2CBusPtr pI2CBus;
- CARD32 DDCReg;
+ Bool SwitchingMode;
+ Bool DDC;
Bool VGAAccess;
-
- /****** Added for dualhead support *******************/
- BOOL HasCRTC2; /* M3/M4 */
- BOOL IsSecondary; /* second Screen */
- BOOL IsPrimary; /* primary Screen */
- BOOL UseCRT; /* force use CRT port as primary */
- BOOL SwitchingMode;
- R128MonitorType DisplayType; /* Monitor connected on*/
-
} R128InfoRec, *R128InfoPtr;
#define R128WaitForFifo(pScrn, entries) \
@@ -544,6 +502,12 @@ do { \
info->fifo_slots -= entries; \
} while (0)
+/* Compute n/d with rounding. */
+static inline int R128Div(int n, int d)
+{
+ return (n + (d / 2)) / d;
+}
+
extern R128EntPtr R128EntPriv(ScrnInfoPtr pScrn);
extern void R128WaitForFifoFunction(ScrnInfoPtr pScrn, int entries);
extern void R128WaitForIdle(ScrnInfoPtr pScrn);
@@ -553,15 +517,48 @@ extern void R128EngineFlush(ScrnInfoPtr pScrn);
extern unsigned R128INPLL(ScrnInfoPtr pScrn, int addr);
extern void R128WaitForVerticalSync(ScrnInfoPtr pScrn);
-extern Bool R128AccelInit(ScreenPtr pScreen);
+extern Bool R128XAAAccelInit(ScreenPtr pScreen);
extern void R128EngineInit(ScrnInfoPtr pScrn);
extern Bool R128CursorInit(ScreenPtr pScreen);
-extern Bool R128DGAInit(ScreenPtr pScreen);
extern int R128MinBits(int val);
+extern xf86OutputPtr R128FirstOutput(xf86CrtcPtr crtc);
extern void R128InitVideo(ScreenPtr pScreen);
+extern void R128InitCommonRegisters(R128SavePtr save, R128InfoPtr info);
+extern void R128InitRMXRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output, DisplayModePtr mode);
+extern void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output);
+extern void R128InitLVDSRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output);
+extern void R128RestoreCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
+extern void R128RestoreDACRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
+extern void R128RestoreRMXRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
+extern void R128RestoreFPRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
+extern void R128RestoreLVDSRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
+extern void R128RestoreCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
+extern void R128RestorePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
+extern void R128RestoreDDARegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
+extern void R128RestoreCrtc2Registers(ScrnInfoPtr pScrn, R128SavePtr restore);
+extern void R128RestorePLL2Registers(ScrnInfoPtr pScrn, R128SavePtr restore);
+extern void R128RestoreDDA2Registers(ScrnInfoPtr pScrn, R128SavePtr restore);
+
+extern void r128_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg);
+extern void r128_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y);
+extern void r128_crtc_show_cursor(xf86CrtcPtr crtc);
+extern void r128_crtc_hide_cursor(xf86CrtcPtr crtc);
+extern void r128_crtc_load_cursor_image(xf86CrtcPtr crtc, unsigned char *src);
+
+extern uint32_t R128AllocateMemory(ScrnInfoPtr pScrn, void **mem_struct, int size, int align, Bool need_accel);
+extern Bool R128SetupConnectors(ScrnInfoPtr pScrn);
+extern Bool R128AllocateControllers(ScrnInfoPtr pScrn);
+extern void R128GetPanelInfoFromBIOS(xf86OutputPtr output);
+extern void R128Blank(ScrnInfoPtr pScrn);
+extern void R128Unblank(ScrnInfoPtr pScrn);
+extern void R128DPMSSetOn(xf86OutputPtr output);
+extern void R128DPMSSetOff(xf86OutputPtr output);
+extern ModeStatus R128DoValidMode(xf86OutputPtr output, DisplayModePtr mode, int flags);
+extern DisplayModePtr R128ProbeOutputModes(xf86OutputPtr output);
+
#ifdef R128DRI
extern Bool R128DRIScreenInit(ScreenPtr pScreen);
extern void R128DRICloseScreen(ScreenPtr pScreen);
@@ -604,13 +601,38 @@ extern void R128CCEFlushIndirect(ScrnInfoPtr pScrn, int discard);
extern void R128CCEReleaseIndirect(ScrnInfoPtr pScrn);
extern void R128CCEWaitForIdle(ScrnInfoPtr pScrn);
extern int R128CCEStop(ScrnInfoPtr pScrn);
+extern void R128CopySwap(uint8_t *dst, uint8_t *src, unsigned int size, int swap);
#ifdef USE_EXA
-extern Bool R128EXAInit(ScreenPtr pScreen);
+extern Bool R128EXAInit(ScreenPtr pScreen, int total);
extern Bool R128GetDatatypeBpp(int bpp, uint32_t *type);
extern Bool R128GetPixmapOffsetPitch(PixmapPtr pPix, uint32_t *pitch_offset);
extern void R128DoPrepareCopy(ScrnInfoPtr pScrn, uint32_t src_pitch_offset,
uint32_t dst_pitch_offset, uint32_t datatype, int alu, Pixel planemask);
+extern void R128Done(PixmapPtr pPixmap);
+
+#ifdef R128DRI
+extern void EmitCCE2DState(ScrnInfoPtr pScrn);
+#endif
+
+#ifdef RENDER
+extern Bool R128CCECheckComposite(int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture);
+extern Bool R128CCEPrepareComposite(int op, PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture,
+ PixmapPtr pSrc,
+ PixmapPtr pMask,
+ PixmapPtr pDst);
+extern void R128CCEComposite(PixmapPtr pDst,
+ int srcX, int srcY,
+ int maskX, int maskY,
+ int dstX, int dstY,
+ int w, int h);
+#define R128CCEDoneComposite R128Done
+#endif
#endif
@@ -626,7 +648,7 @@ extern void R128DoPrepareCopy(ScrnInfoPtr pScrn, uint32_t src_pitch_offset,
#define R128_VERBOSE 0
-#define RING_LOCALS CARD32 *__head; int __count;
+#define RING_LOCALS uint32_t *__head; int __count;
#define R128CCE_REFRESH(pScrn, info) \
do { \
@@ -667,12 +689,12 @@ do { \
xf86DrvMsg( pScrn->scrnIndex, X_INFO, \
"ADVANCE_RING() used: %d+%d=%d/%d\n", \
info->indirectBuffer->used - info->indirectStart, \
- __count * (int)sizeof(CARD32), \
+ __count * (int)sizeof(uint32_t), \
info->indirectBuffer->used - info->indirectStart + \
- __count * (int)sizeof(CARD32), \
+ __count * (int)sizeof(uint32_t), \
info->indirectBuffer->total - info->indirectStart ); \
} \
- info->indirectBuffer->used += __count * (int)sizeof(CARD32); \
+ info->indirectBuffer->used += __count * (int)sizeof(uint32_t); \
} while (0)
#define OUT_RING( x ) do { \
diff --git a/driver/xf86-video-r128/src/r128_accel.c b/driver/xf86-video-r128/src/r128_accel.c
index 1b8c0238c..589f49ba4 100644
--- a/driver/xf86-video-r128/src/r128_accel.c
+++ b/driver/xf86-video-r128/src/r128_accel.c
@@ -102,27 +102,7 @@
#include "xf86.h"
#ifdef HAVE_XAA_H
-static struct {
- int rop;
- int pattern;
-} R128_ROP[] = {
- { R128_ROP3_ZERO, R128_ROP3_ZERO }, /* GXclear */
- { R128_ROP3_DSa, R128_ROP3_DPa }, /* Gxand */
- { R128_ROP3_SDna, R128_ROP3_PDna }, /* GXandReverse */
- { R128_ROP3_S, R128_ROP3_P }, /* GXcopy */
- { R128_ROP3_DSna, R128_ROP3_DPna }, /* GXandInverted */
- { R128_ROP3_D, R128_ROP3_D }, /* GXnoop */
- { R128_ROP3_DSx, R128_ROP3_DPx }, /* GXxor */
- { R128_ROP3_DSo, R128_ROP3_DPo }, /* GXor */
- { R128_ROP3_DSon, R128_ROP3_DPon }, /* GXnor */
- { R128_ROP3_DSxn, R128_ROP3_PDxn }, /* GXequiv */
- { R128_ROP3_Dn, R128_ROP3_Dn }, /* GXinvert */
- { R128_ROP3_SDno, R128_ROP3_PDno }, /* GXorReverse */
- { R128_ROP3_Sn, R128_ROP3_Pn }, /* GXcopyInverted */
- { R128_ROP3_DSno, R128_ROP3_DPno }, /* GXorInverted */
- { R128_ROP3_DSan, R128_ROP3_DPan }, /* GXnand */
- { R128_ROP3_ONE, R128_ROP3_ONE } /* GXset */
-};
+#include "r128_rop.h"
#endif
extern int getR128EntityIndex(void);
@@ -145,9 +125,9 @@ void R128EngineReset(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- CARD32 clock_cntl_index;
- CARD32 mclk_cntl;
- CARD32 gen_reset_cntl;
+ uint32_t clock_cntl_index;
+ uint32_t mclk_cntl;
+ uint32_t gen_reset_cntl;
R128EngineFlush(pScrn);
@@ -161,7 +141,7 @@ void R128EngineReset(ScrnInfoPtr pScrn)
OUTREG(R128_GEN_RESET_CNTL, gen_reset_cntl | R128_SOFT_RESET_GUI);
INREG(R128_GEN_RESET_CNTL);
OUTREG(R128_GEN_RESET_CNTL,
- gen_reset_cntl & (CARD32)(~R128_SOFT_RESET_GUI));
+ gen_reset_cntl & (uint32_t)(~R128_SOFT_RESET_GUI));
INREG(R128_GEN_RESET_CNTL);
OUTPLL(R128_MCLK_CNTL, mclk_cntl);
@@ -182,10 +162,13 @@ void R128WaitForFifoFunction(ScrnInfoPtr pScrn, int entries)
info->fifo_slots = INREG(R128_GUI_STAT) & R128_GUI_FIFOCNT_MASK;
if (info->fifo_slots >= entries) return;
}
- R128TRACE(("FIFO timed out: %d entries, stat=0x%08x, probe=0x%08x\n",
- INREG(R128_GUI_STAT) & R128_GUI_FIFOCNT_MASK,
- INREG(R128_GUI_STAT),
- INREG(R128_GUI_PROBE)));
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "FIFO timed out: %lu entries, "
+ "stat = 0x%08lx, probe = 0x%08lx\n",
+ INREG(R128_GUI_STAT) & R128_GUI_FIFOCNT_MASK,
+ INREG(R128_GUI_STAT),
+ INREG(R128_GUI_PROBE)));
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"FIFO timed out, resetting engine...\n");
R128EngineReset(pScrn);
@@ -216,10 +199,13 @@ void R128WaitForIdle(ScrnInfoPtr pScrn)
return;
}
}
- R128TRACE(("Idle timed out: %d entries, stat=0x%08x, probe=0x%08x\n",
- INREG(R128_GUI_STAT) & R128_GUI_FIFOCNT_MASK,
- INREG(R128_GUI_STAT),
- INREG(R128_GUI_PROBE)));
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Idle timed out: %lu entries, "
+ "stat = 0x%08lx, probe = 0x%08lx\n",
+ INREG(R128_GUI_STAT) & R128_GUI_FIFOCNT_MASK,
+ INREG(R128_GUI_STAT),
+ INREG(R128_GUI_PROBE)));
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Idle timed out, resetting engine...\n");
#ifdef R128DRI
@@ -450,7 +436,7 @@ static void R128SetupForDashedLine(ScrnInfoPtr pScrn,
{
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- CARD32 pat = *(CARD32 *)(pointer)pattern;
+ uint32_t pat = *(uint32_t *)(pointer)pattern;
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
# define PAT_SHIFT(pat,n) pat << n
@@ -526,10 +512,13 @@ static void R128SubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h,
int origdxL = dxL;
int origdxR = dxR;
- R128TRACE(("Trap %d %d; L %d %d %d %d; R %d %d %d %d\n",
- y, h,
- left, dxL, dyL, eL,
- right, dxR, dyR, eR));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Trap %d %d; "
+ "L %d %d %d %d; "
+ "R %d %d %d %d\n",
+ y, h,
+ left, dxL, dyL, eL,
+ right, dxR, dyR, eR));
if (dxL < 0) dxL = -dxL; else flags |= (1 << 0) /* | (1 << 8) */;
if (dxR < 0) dxR = -dxR; else flags |= (1 << 6);
@@ -590,7 +579,7 @@ static void R128SetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
? R128_DST_Y_TOP_TO_BOTTOM
: 0)));
- if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) {
+ if (trans_color != -1) {
/* Set up for transparency */
R128WaitForFifo(pScrn, 3);
OUTREG(R128_CLR_CMP_CLR_SRC, trans_color);
@@ -680,7 +669,9 @@ static void R128SetupForColor8x8PatternFill(ScrnInfoPtr pScrn,
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- R128TRACE(("Color8x8 %d %d %d\n", trans_color, patx, paty));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Color8x8 %d %d %d\n",
+ trans_color, patx, paty));
R128WaitForFifo(pScrn, 2);
OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
@@ -708,7 +699,9 @@ static void R128SubsequentColor8x8PatternFillRect( ScrnInfoPtr pScrn,
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- R128TRACE(("Color8x8 %d,%d %d,%d %d %d\n", patx, paty, x, y, w, h));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Color8x8 %d,%d %d,%d %d %d\n",
+ patx, paty, x, y, w, h));
R128WaitForFifo(pScrn, 3);
OUTREG(R128_SRC_Y_X, (paty << 16) | patx);
OUTREG(R128_DST_Y_X, (y << 16) | x);
@@ -847,10 +840,10 @@ static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
{
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- CARD32 *p = (pointer)info->scratch_buffer[bufno];
+ uint32_t *p = (pointer)info->scratch_buffer[bufno];
int i;
int left = info->scanline_words;
- volatile CARD32 *d;
+ volatile uint32_t *d;
if (info->scanline_direct) return;
--info->scanline_h;
@@ -977,10 +970,10 @@ static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
{
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- CARD32 *p = (pointer)info->scratch_buffer[bufno];
+ uint32_t *p = (pointer)info->scratch_buffer[bufno];
int i;
int left = info->scanline_words;
- volatile CARD32 *d;
+ volatile uint32_t *d;
if (info->scanline_direct) return;
--info->scanline_h;
@@ -1017,7 +1010,10 @@ void R128EngineInit(ScrnInfoPtr pScrn)
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- R128TRACE(("EngineInit (%d/%d)\n", info->CurrentLayout.pixel_code, info->CurrentLayout.bitsPerPixel));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "EngineInit (%d/%d)\n",
+ info->CurrentLayout.pixel_code,
+ info->CurrentLayout.bitsPerPixel));
OUTREG(R128_SCALE_3D_CNTL, 0);
R128EngineReset(pScrn);
@@ -1029,13 +1025,16 @@ void R128EngineInit(ScrnInfoPtr pScrn)
case 24: info->datatype = 5; break;
case 32: info->datatype = 6; break;
default:
- R128TRACE(("Unknown depth/bpp = %d/%d (code = %d)\n",
- info->CurrentLayout.depth, info->CurrentLayout.bitsPerPixel,
- info->CurrentLayout.pixel_code));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Unknown depth/bpp = %d/%d (code = %d)\n",
+ info->CurrentLayout.depth,
+ info->CurrentLayout.bitsPerPixel,
+ info->CurrentLayout.pixel_code));
}
info->pitch = (info->CurrentLayout.displayWidth / 8) * (info->CurrentLayout.pixel_bytes == 3 ? 3 : 1);
- R128TRACE(("Pitch for acceleration = %d\n", info->pitch));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Pitch for acceleration = %d\n", info->pitch));
R128WaitForFifo(pScrn, 2);
OUTREG(R128_DEFAULT_OFFSET, pScrn->fbOffset);
@@ -1182,7 +1181,7 @@ static void R128CCESetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
ADVANCE_RING();
- if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) {
+ if (trans_color != -1) {
BEGIN_RING( 6 );
OUT_RING_REG( R128_CLR_CMP_CLR_SRC, trans_color );
@@ -1438,7 +1437,7 @@ static void R128CCESetupForDashedLine(ScrnInfoPtr pScrn,
int length, unsigned char *pattern)
{
R128InfoPtr info = R128PTR(pScrn);
- CARD32 pat = *(CARD32 *)(pointer)pattern;
+ uint32_t pat = *(uint32_t *)(pointer)pattern;
RING_LOCALS;
R128CCE_REFRESH( pScrn, info );
@@ -1746,7 +1745,7 @@ static void R128CCEAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a)
| HARDWARE_PATTERN_SCREEN_ORIGIN
| BIT_ORDER_IN_BYTE_LSBFIRST);
- if(!info->IsSecondary && xf86IsEntityShared(pScrn->entityList[0]))
+ if (xf86IsEntityShared(info->pEnt->index))
a->RestoreAccelState = R128RestoreCCEAccelState;
}
@@ -1851,75 +1850,75 @@ static void R128MMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a)
| LEFT_EDGE_CLIPPING_NEGATIVE_X
| SCANLINE_PAD_DWORD;
- if(xf86IsEntityShared(pScrn->entityList[0]))
- {
- DevUnion* pPriv;
- R128EntPtr pR128Ent;
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
- getR128EntityIndex());
- pR128Ent = pPriv->ptr;
-
- /*if there are more than one devices sharing this entity, we
- have to assign this call back, otherwise the XAA will be
- disabled */
- if(pR128Ent->HasSecondary || pR128Ent->BypassSecondary)
- a->RestoreAccelState = R128RestoreAccelState;
+ if (xf86IsEntityShared(info->pEnt->index)) {
+ /* If there are more than one devices sharing this entity, we
+ * have to assign this call back, otherwise the XAA will be
+ * disabled.
+ */
+ if (xf86GetNumEntityInstances(info->pEnt->index) > 1)
+ a->RestoreAccelState = R128RestoreAccelState;
}
}
#endif
+void R128CopySwap(uint8_t *dst, uint8_t *src, unsigned int size, int swap)
+{
+ switch(swap) {
+ case APER_0_BIG_ENDIAN_32BPP_SWAP:
+ {
+ unsigned int *d = (unsigned int *)dst;
+ unsigned int *s = (unsigned int *)src;
+ unsigned int nwords = size >> 2;
+
+ for (; nwords > 0; --nwords, ++d, ++s)
+#ifdef __powerpc__
+ asm volatile("stwbrx %0,0,%1" : : "r" (*s), "r" (d));
+#else
+ *d = ((*s >> 24) & 0xff) | ((*s >> 8) & 0xff00)
+ | ((*s & 0xff00) << 8) | ((*s & 0xff) << 24);
+#endif
+ return;
+ }
+ case APER_0_BIG_ENDIAN_16BPP_SWAP:
+ {
+ unsigned short *d = (unsigned short *)dst;
+ unsigned short *s = (unsigned short *)src;
+ unsigned int nwords = size >> 1;
+
+ for (; nwords > 0; --nwords, ++d, ++s)
+#ifdef __powerpc__
+ asm volatile("sthbrx %0,0,%1" : : "r" (*s), "r" (d));
+#else
+ *d = (*s >> 8) | (*s << 8);
+#endif
+ return;
+ }
+ }
+ if (src != dst)
+ memcpy(dst, src, size);
+}
+
/* Initialize XAA for supported acceleration and also initialize the
graphics hardware for acceleration. */
-Bool R128AccelInit(ScreenPtr pScreen)
+#ifdef HAVE_XAA_H
+Bool
+R128XAAAccelInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
R128InfoPtr info = R128PTR(pScrn);
-
-#ifdef USE_EXA
- if (info->useEXA) {
- int errmaj = 0, errmin = 0;
-
- info->exaReq.majorversion = EXA_VERSION_MAJOR;
- info->exaReq.minorversion = EXA_VERSION_MINOR;
-
- xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Loading EXA module...\n");
- if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL, &info->exaReq, &errmaj, &errmin)) {
- LoaderErrorMsg(NULL, "exa", errmaj, errmin);
- return FALSE;
- }
-
- /* Don't init EXA here because it'll be taken care of in mm init */
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Allocating EXA driver...\n");
- info->ExaDriver = exaDriverAlloc();
- if (!info->ExaDriver) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Could not allocate EXA driver...\n");
- info->accelOn = FALSE;
- }
-
- return TRUE;
- }
-#endif
-
-#ifndef HAVE_XAA_H
- return FALSE;
-#else
XAAInfoRecPtr a;
- if (!info->useEXA) {
- if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE;
- }
-
if (!(a = info->accel = XAACreateInfoRec())) return FALSE;
#ifdef R128DRI
if (info->directRenderingEnabled)
- R128CCEAccelInit(pScrn, a);
+ R128CCEAccelInit(pScrn, a);
else
#endif
- R128MMIOAccelInit(pScrn, a);
+ R128MMIOAccelInit(pScrn, a);
R128EngineInit(pScrn);
return XAAInit(pScreen, a);
-#endif
}
+#endif
diff --git a/driver/xf86-video-r128/src/r128_crtc.c b/driver/xf86-video-r128/src/r128_crtc.c
new file mode 100644
index 000000000..5dc8e1860
--- /dev/null
+++ b/driver/xf86-video-r128/src/r128_crtc.c
@@ -0,0 +1,1158 @@
+/*
+ * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
+ * VA Linux Systems Inc., Fremont, California.
+ *
+ * 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 on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
+ * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86Modes.h"
+
+#ifdef HAVE_XEXTPROTO_71
+#include "X11/extensions/dpmsconst.h"
+#else
+#define DPMS_SERVER
+#include "X11/extensions/dpms.h"
+#endif
+
+#include "r128.h"
+#include "r128_probe.h"
+#include "r128_reg.h"
+
+
+#ifndef MAX
+#define MAX(a,b) ((a)>(b)?(a):(b))
+#endif
+
+
+/* Define CRTC registers for requested video mode. */
+Bool R128InitCrtcRegisters(xf86CrtcPtr crtc, R128SavePtr save, DisplayModePtr mode)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ xf86OutputPtr output = R128FirstOutput(crtc);
+ R128OutputPrivatePtr r128_output = output->driver_private;
+
+ int format;
+ int hsync_start;
+ int hsync_wid;
+ int hsync_fudge;
+ int vsync_wid;
+ int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 };
+ int hsync_fudge_fp[] = { 0x12, 0x11, 0x09, 0x09, 0x05, 0x05 };
+// int hsync_fudge_fp_crt[] = { 0x12, 0x10, 0x08, 0x08, 0x04, 0x04 };
+
+ switch (info->CurrentLayout.pixel_code) {
+ case 4: format = 1; break;
+ case 8: format = 2; break;
+ case 15: format = 3; break; /* 555 */
+ case 16: format = 4; break; /* 565 */
+ case 24: format = 5; break; /* RGB */
+ case 32: format = 6; break; /* xRGB */
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Unsupported pixel depth (%d)\n",
+ info->CurrentLayout.bitsPerPixel);
+ return FALSE;
+ }
+
+ if (r128_output->MonType == MT_LCD || r128_output->MonType == MT_DFP)
+ hsync_fudge = hsync_fudge_fp[format-1];
+ else
+ hsync_fudge = hsync_fudge_default[format-1];
+
+ save->crtc_gen_cntl = (R128_CRTC_EXT_DISP_EN
+ | R128_CRTC_EN
+ | (format << 8)
+ | ((mode->Flags & V_DBLSCAN)
+ ? R128_CRTC_DBL_SCAN_EN
+ : 0)
+ | ((mode->Flags & V_INTERLACE)
+ ? R128_CRTC_INTERLACE_EN
+ : 0)
+ | ((mode->Flags & V_CSYNC)
+ ? R128_CRTC_CSYNC_EN
+ : 0));
+
+ if (r128_output->MonType == MT_LCD || r128_output->MonType == MT_DFP)
+ save->crtc_gen_cntl &= ~(R128_CRTC_DBL_SCAN_EN | R128_CRTC_INTERLACE_EN);
+
+ save->crtc_ext_cntl |= R128_VGA_ATI_LINEAR | R128_XCRT_CNT_EN;
+
+ save->crtc_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0xffff)
+ | (((mode->CrtcHDisplay / 8) - 1) << 16));
+
+ hsync_wid = (mode->CrtcHSyncEnd - mode->CrtcHSyncStart) / 8;
+ if (!hsync_wid) hsync_wid = 1;
+ if (hsync_wid > 0x3f) hsync_wid = 0x3f;
+
+ hsync_start = mode->CrtcHSyncStart - 8 + hsync_fudge;
+
+ save->crtc_h_sync_strt_wid = ((hsync_start & 0xfff)
+ | (hsync_wid << 16)
+ | ((mode->Flags & V_NHSYNC)
+ ? R128_CRTC_H_SYNC_POL
+ : 0));
+
+#if 1
+ /* This works for double scan mode. */
+ save->crtc_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff)
+ | ((mode->CrtcVDisplay - 1) << 16));
+#else
+ /* This is what cce/nbmode.c example code
+ does -- is this correct? */
+ save->crtc_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff)
+ | ((mode->CrtcVDisplay
+ * ((mode->Flags & V_DBLSCAN) ? 2 : 1) - 1)
+ << 16));
+#endif
+
+ vsync_wid = mode->CrtcVSyncEnd - mode->CrtcVSyncStart;
+ if (!vsync_wid) vsync_wid = 1;
+ if (vsync_wid > 0x1f) vsync_wid = 0x1f;
+
+ save->crtc_v_sync_strt_wid = (((mode->CrtcVSyncStart - 1) & 0xfff)
+ | (vsync_wid << 16)
+ | ((mode->Flags & V_NVSYNC)
+ ? R128_CRTC_V_SYNC_POL
+ : 0));
+ save->crtc_pitch = info->CurrentLayout.displayWidth / 8;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Pitch = %d bytes (virtualX = %d, "
+ "displayWidth = %d)\n",
+ save->crtc_pitch, pScrn->virtualX,
+ info->CurrentLayout.displayWidth));
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ /* Change the endianness of the aperture */
+ switch (info->CurrentLayout.pixel_code) {
+ case 15:
+ case 16: save->config_cntl |= APER_0_BIG_ENDIAN_16BPP_SWAP; break;
+ case 32: save->config_cntl |= APER_0_BIG_ENDIAN_32BPP_SWAP; break;
+ default: break;
+ }
+#endif
+
+ return TRUE;
+}
+
+/* Define CRTC2 registers for requested video mode. */
+Bool R128InitCrtc2Registers(xf86CrtcPtr crtc, R128SavePtr save, DisplayModePtr mode)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+
+ int format;
+ int hsync_start;
+ int hsync_wid;
+ int hsync_fudge;
+ int vsync_wid;
+ int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 };
+
+ switch (info->CurrentLayout.pixel_code) {
+ case 4: format = 1; break;
+ case 8: format = 2; break;
+ case 15: format = 3; break; /* 555 */
+ case 16: format = 4; break; /* 565 */
+ case 24: format = 5; break; /* RGB */
+ case 32: format = 6; break; /* xRGB */
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Unsupported pixel depth (%d)\n", info->CurrentLayout.bitsPerPixel);
+ return FALSE;
+ }
+
+ hsync_fudge = hsync_fudge_default[format-1];
+
+ save->crtc2_gen_cntl = (R128_CRTC2_EN
+ | (format << 8)
+ | ((mode->Flags & V_DBLSCAN)
+ ? R128_CRTC2_DBL_SCAN_EN
+ : 0));
+/*
+ save->crtc2_gen_cntl &= ~R128_CRTC_EXT_DISP_EN;
+ save->crtc2_gen_cntl |= (1 << 21);
+*/
+ save->crtc2_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0xffff)
+ | (((mode->CrtcHDisplay / 8) - 1) << 16));
+
+ hsync_wid = (mode->CrtcHSyncEnd - mode->CrtcHSyncStart) / 8;
+ if (!hsync_wid) hsync_wid = 1;
+ if (hsync_wid > 0x3f) hsync_wid = 0x3f;
+
+ hsync_start = mode->CrtcHSyncStart - 8 + hsync_fudge;
+
+ save->crtc2_h_sync_strt_wid = ((hsync_start & 0xfff)
+ | (hsync_wid << 16)
+ | ((mode->Flags & V_NHSYNC)
+ ? R128_CRTC2_H_SYNC_POL
+ : 0));
+
+#if 1
+ /* This works for double scan mode. */
+ save->crtc2_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff)
+ | ((mode->CrtcVDisplay - 1) << 16));
+#else
+ /* This is what cce/nbmode.c example code
+ does -- is this correct? */
+ save->crtc2_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff)
+ | ((mode->CrtcVDisplay
+ * ((mode->Flags & V_DBLSCAN) ? 2 : 1) - 1)
+ << 16));
+#endif
+
+ vsync_wid = mode->CrtcVSyncEnd - mode->CrtcVSyncStart;
+ if (!vsync_wid) vsync_wid = 1;
+ if (vsync_wid > 0x1f) vsync_wid = 0x1f;
+
+ save->crtc2_v_sync_strt_wid = (((mode->CrtcVSyncStart - 1) & 0xfff)
+ | (vsync_wid << 16)
+ | ((mode->Flags & V_NVSYNC)
+ ? R128_CRTC2_V_SYNC_POL
+ : 0));
+ save->crtc2_pitch = info->CurrentLayout.displayWidth / 8;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Pitch = %d bytes (virtualX = %d, "
+ "displayWidth = %d)\n",
+ save->crtc2_pitch, pScrn->virtualX,
+ info->CurrentLayout.displayWidth));
+ return TRUE;
+}
+
+/* Write CRTC registers. */
+void R128RestoreCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
+{
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+
+ OUTREG(R128_CRTC_GEN_CNTL, restore->crtc_gen_cntl);
+
+ OUTREGP(R128_CRTC_EXT_CNTL, restore->crtc_ext_cntl,
+ R128_CRTC_VSYNC_DIS | R128_CRTC_HSYNC_DIS | R128_CRTC_DISPLAY_DIS);
+
+ OUTREG(R128_CRTC_H_TOTAL_DISP, restore->crtc_h_total_disp);
+ OUTREG(R128_CRTC_H_SYNC_STRT_WID, restore->crtc_h_sync_strt_wid);
+ OUTREG(R128_CRTC_V_TOTAL_DISP, restore->crtc_v_total_disp);
+ OUTREG(R128_CRTC_V_SYNC_STRT_WID, restore->crtc_v_sync_strt_wid);
+ OUTREG(R128_CRTC_OFFSET, restore->crtc_offset);
+ OUTREG(R128_CRTC_OFFSET_CNTL, restore->crtc_offset_cntl);
+ OUTREG(R128_CRTC_PITCH, restore->crtc_pitch);
+}
+
+/* Write CRTC2 registers. */
+void R128RestoreCrtc2Registers(ScrnInfoPtr pScrn, R128SavePtr restore)
+{
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+
+ OUTREGP(R128_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl,
+ R128_CRTC2_DISP_DIS);
+
+ OUTREG(R128_CRTC2_H_TOTAL_DISP, restore->crtc2_h_total_disp);
+ OUTREG(R128_CRTC2_H_SYNC_STRT_WID, restore->crtc2_h_sync_strt_wid);
+ OUTREG(R128_CRTC2_V_TOTAL_DISP, restore->crtc2_v_total_disp);
+ OUTREG(R128_CRTC2_V_SYNC_STRT_WID, restore->crtc2_v_sync_strt_wid);
+ OUTREG(R128_CRTC2_OFFSET, restore->crtc2_offset);
+ OUTREG(R128_CRTC2_OFFSET_CNTL, restore->crtc2_offset_cntl);
+ OUTREG(R128_CRTC2_PITCH, restore->crtc2_pitch);
+}
+
+static Bool R128InitCrtcBase(xf86CrtcPtr crtc, R128SavePtr save, int x, int y)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ int offset = y * info->CurrentLayout.displayWidth + x;
+ int Base = pScrn->fbOffset;
+
+ switch (info->CurrentLayout.pixel_code) {
+ case 15:
+ case 16: offset *= 2; break;
+ case 24: offset *= 3; break;
+ case 32: offset *= 4; break;
+ }
+ Base += offset;
+
+ if (crtc->rotatedData != NULL)
+ Base = pScrn->fbOffset + (char *)crtc->rotatedData - (char *)info->FB;
+
+ Base &= ~7; /* 3 lower bits are always 0 */
+ if (info->CurrentLayout.pixel_code == 24)
+ Base += 8 * (Base % 3); /* Must be multiple of 8 and 3 */
+
+ save->crtc_offset = Base;
+ save->crtc_offset_cntl = 0;
+
+ return TRUE;
+}
+
+static Bool R128InitCrtc2Base(xf86CrtcPtr crtc, R128SavePtr save, int x, int y)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ int offset = y * info->CurrentLayout.displayWidth + x;
+ int Base = pScrn->fbOffset;
+
+ switch (info->CurrentLayout.pixel_code) {
+ case 15:
+ case 16: offset *= 2; break;
+ case 24: offset *= 3; break;
+ case 32: offset *= 4; break;
+ }
+ Base += offset;
+
+ if (crtc->rotatedData != NULL)
+ Base = pScrn->fbOffset + (char *)crtc->rotatedData - (char *)info->FB;
+
+ Base &= ~7; /* 3 lower bits are always 0 */
+ if (info->CurrentLayout.pixel_code == 24)
+ Base += 8 * (Base % 3); /* Must be multiple of 8 and 3 */
+
+ save->crtc2_offset = Base;
+ save->crtc2_offset_cntl = 0;
+
+ return TRUE;
+}
+
+/* Define PLL registers for requested video mode. */
+static void R128InitPLLRegisters(xf86CrtcPtr crtc, R128SavePtr save,
+ R128PLLPtr pll, double dot_clock)
+{
+#if R128_DEBUG
+ ScrnInfoPtr pScrn = crtc->scrn;
+#endif
+ unsigned long freq = dot_clock * 100;
+ struct {
+ int divider;
+ int bitvalue;
+ } *post_div,
+ post_divs[] = {
+ /* From RAGE 128 VR/RAGE 128 GL Register
+ Reference Manual (Technical Reference
+ Manual P/N RRG-G04100-C Rev. 0.04), page
+ 3-17 (PLL_DIV_[3:0]). */
+ { 1, 0 }, /* VCLK_SRC */
+ { 2, 1 }, /* VCLK_SRC/2 */
+ { 4, 2 }, /* VCLK_SRC/4 */
+ { 8, 3 }, /* VCLK_SRC/8 */
+
+ { 3, 4 }, /* VCLK_SRC/3 */
+ /* bitvalue = 5 is reserved */
+ { 6, 6 }, /* VCLK_SRC/6 */
+ { 12, 7 }, /* VCLK_SRC/12 */
+ { 0, 0 }
+ };
+
+ if (freq > pll->max_pll_freq) freq = pll->max_pll_freq;
+ if (freq * 12 < pll->min_pll_freq) freq = pll->min_pll_freq / 12;
+
+ for (post_div = &post_divs[0]; post_div->divider; ++post_div) {
+ save->pll_output_freq = post_div->divider * freq;
+ if (save->pll_output_freq >= pll->min_pll_freq
+ && save->pll_output_freq <= pll->max_pll_freq) break;
+ }
+
+ save->dot_clock_freq = freq;
+ save->feedback_div = R128Div(pll->reference_div * save->pll_output_freq,
+ pll->reference_freq);
+ save->post_div = post_div->divider;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "dc=%d, of=%d, fd=%d, pd=%d\n",
+ save->dot_clock_freq,
+ save->pll_output_freq,
+ save->feedback_div,
+ save->post_div));
+
+ save->ppll_ref_div = pll->reference_div;
+ save->ppll_div_3 = (save->feedback_div | (post_div->bitvalue << 16));
+ save->htotal_cntl = 0;
+
+}
+
+/* Define PLL2 registers for requested video mode. */
+void R128InitPLL2Registers(xf86CrtcPtr crtc, R128SavePtr save,
+ R128PLLPtr pll, double dot_clock)
+{
+#if R128_DEBUG
+ ScrnInfoPtr pScrn = crtc->scrn;
+#endif
+ unsigned long freq = dot_clock * 100;
+ struct {
+ int divider;
+ int bitvalue;
+ } *post_div,
+ post_divs[] = {
+ /* From RAGE 128 VR/RAGE 128 GL Register
+ Reference Manual (Technical Reference
+ Manual P/N RRG-G04100-C Rev. 0.04), page
+ 3-17 (PLL_DIV_[3:0]). */
+ { 1, 0 }, /* VCLK_SRC */
+ { 2, 1 }, /* VCLK_SRC/2 */
+ { 4, 2 }, /* VCLK_SRC/4 */
+ { 8, 3 }, /* VCLK_SRC/8 */
+
+ { 3, 4 }, /* VCLK_SRC/3 */
+ /* bitvalue = 5 is reserved */
+ { 6, 6 }, /* VCLK_SRC/6 */
+ { 12, 7 }, /* VCLK_SRC/12 */
+ { 0, 0 }
+ };
+
+ if (freq > pll->max_pll_freq) freq = pll->max_pll_freq;
+ if (freq * 12 < pll->min_pll_freq) freq = pll->min_pll_freq / 12;
+
+ for (post_div = &post_divs[0]; post_div->divider; ++post_div) {
+ save->pll_output_freq_2 = post_div->divider * freq;
+ if (save->pll_output_freq_2 >= pll->min_pll_freq
+ && save->pll_output_freq_2 <= pll->max_pll_freq) break;
+ }
+
+ save->dot_clock_freq_2 = freq;
+ save->feedback_div_2 = R128Div(pll->reference_div
+ * save->pll_output_freq_2,
+ pll->reference_freq);
+ save->post_div_2 = post_div->divider;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "dc=%d, of=%d, fd=%d, pd=%d\n",
+ save->dot_clock_freq_2,
+ save->pll_output_freq_2,
+ save->feedback_div_2,
+ save->post_div_2));
+
+ save->p2pll_ref_div = pll->reference_div;
+ save->p2pll_div_0 = (save->feedback_div_2 | (post_div->bitvalue<<16));
+ save->htotal_cntl2 = 0;
+}
+
+static void R128PLLWaitForReadUpdateComplete(ScrnInfoPtr pScrn)
+{
+ while (INPLL(pScrn, R128_PPLL_REF_DIV) & R128_PPLL_ATOMIC_UPDATE_R);
+}
+
+static void R128PLLWriteUpdate(ScrnInfoPtr pScrn)
+{
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+
+ while (INPLL(pScrn, R128_PPLL_REF_DIV) & R128_PPLL_ATOMIC_UPDATE_R);
+
+ OUTPLLP(pScrn, R128_PPLL_REF_DIV, R128_PPLL_ATOMIC_UPDATE_W,
+ ~R128_PPLL_ATOMIC_UPDATE_W);
+
+}
+
+static void R128PLL2WaitForReadUpdateComplete(ScrnInfoPtr pScrn)
+{
+ while (INPLL(pScrn, R128_P2PLL_REF_DIV) & R128_P2PLL_ATOMIC_UPDATE_R);
+}
+
+static void R128PLL2WriteUpdate(ScrnInfoPtr pScrn)
+{
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+
+ while (INPLL(pScrn, R128_P2PLL_REF_DIV) & R128_P2PLL_ATOMIC_UPDATE_R);
+
+ OUTPLLP(pScrn, R128_P2PLL_REF_DIV,
+ R128_P2PLL_ATOMIC_UPDATE_W,
+ ~(R128_P2PLL_ATOMIC_UPDATE_W));
+}
+
+/* Write PLL registers. */
+void R128RestorePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
+{
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+
+
+ OUTPLLP(pScrn, R128_VCLK_ECP_CNTL,
+ R128_VCLK_SRC_SEL_CPUCLK,
+ ~(R128_VCLK_SRC_SEL_MASK));
+
+ OUTPLLP(pScrn,
+ R128_PPLL_CNTL,
+ R128_PPLL_RESET
+ | R128_PPLL_ATOMIC_UPDATE_EN
+ | R128_PPLL_VGA_ATOMIC_UPDATE_EN,
+ ~(R128_PPLL_RESET
+ | R128_PPLL_ATOMIC_UPDATE_EN
+ | R128_PPLL_VGA_ATOMIC_UPDATE_EN));
+
+ OUTREGP(R128_CLOCK_CNTL_INDEX, R128_PLL_DIV_SEL, ~(R128_PLL_DIV_SEL));
+
+/* R128PLLWaitForReadUpdateComplete(pScrn);*/
+ OUTPLLP(pScrn, R128_PPLL_REF_DIV,
+ restore->ppll_ref_div, ~R128_PPLL_REF_DIV_MASK);
+/* R128PLLWriteUpdate(pScrn);
+
+ R128PLLWaitForReadUpdateComplete(pScrn);*/
+ OUTPLLP(pScrn, R128_PPLL_DIV_3,
+ restore->ppll_div_3, ~R128_PPLL_FB3_DIV_MASK);
+/* R128PLLWriteUpdate(pScrn);*/
+ OUTPLLP(pScrn, R128_PPLL_DIV_3,
+ restore->ppll_div_3, ~R128_PPLL_POST3_DIV_MASK);
+
+ R128PLLWriteUpdate(pScrn);
+ R128PLLWaitForReadUpdateComplete(pScrn);
+
+ OUTPLLP(pScrn, R128_PPLL_DIV_0,
+ restore->ppll_div_0, ~R128_PPLL_FB0_DIV_MASK);
+/* R128PLLWriteUpdate(pScrn);*/
+ OUTPLLP(pScrn, R128_PPLL_DIV_0,
+ restore->ppll_div_0, ~R128_PPLL_POST0_DIV_MASK);
+
+ R128PLLWriteUpdate(pScrn);
+ R128PLLWaitForReadUpdateComplete(pScrn);
+
+ OUTPLL(R128_HTOTAL_CNTL, restore->htotal_cntl);
+/* R128PLLWriteUpdate(pScrn);*/
+
+ OUTPLLP(pScrn, R128_PPLL_CNTL, 0, ~(R128_PPLL_RESET
+ | R128_PPLL_SLEEP
+ | R128_PPLL_ATOMIC_UPDATE_EN
+ | R128_PPLL_VGA_ATOMIC_UPDATE_EN));
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Wrote: 0x%08x 0x%08x 0x%08x (0x%08x)\n",
+ restore->ppll_ref_div,
+ restore->ppll_div_3,
+ restore->htotal_cntl,
+ INPLL(pScrn, R128_PPLL_CNTL)));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Wrote: rd=%d, fd=%d, pd=%d\n",
+ restore->ppll_ref_div & R128_PPLL_REF_DIV_MASK,
+ restore->ppll_div_3 & R128_PPLL_FB3_DIV_MASK,
+ (restore->ppll_div_3 &
+ R128_PPLL_POST3_DIV_MASK) >> 16));
+
+ usleep(5000); /* let the clock lock */
+
+ OUTPLLP(pScrn, R128_VCLK_ECP_CNTL,
+ R128_VCLK_SRC_SEL_PPLLCLK,
+ ~(R128_VCLK_SRC_SEL_MASK));
+
+}
+
+/* Write PLL2 registers. */
+void R128RestorePLL2Registers(ScrnInfoPtr pScrn, R128SavePtr restore)
+{
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+
+ OUTPLLP(pScrn, R128_V2CLK_VCLKTV_CNTL,
+ R128_V2CLK_SRC_SEL_CPUCLK,
+ ~R128_V2CLK_SRC_SEL_MASK);
+
+ OUTPLLP(pScrn,
+ R128_P2PLL_CNTL,
+ R128_P2PLL_RESET
+ | R128_P2PLL_ATOMIC_UPDATE_EN
+ | R128_P2PLL_VGA_ATOMIC_UPDATE_EN,
+ ~(R128_P2PLL_RESET
+ | R128_P2PLL_ATOMIC_UPDATE_EN
+ | R128_P2PLL_VGA_ATOMIC_UPDATE_EN));
+
+#if 1
+ OUTREGP(R128_CLOCK_CNTL_INDEX, 0, R128_PLL2_DIV_SEL_MASK);
+#endif
+
+ /*R128PLL2WaitForReadUpdateComplete(pScrn);*/
+
+ OUTPLLP(pScrn, R128_P2PLL_REF_DIV, restore->p2pll_ref_div, ~R128_P2PLL_REF_DIV_MASK);
+
+/* R128PLL2WriteUpdate(pScrn);
+ R128PLL2WaitForReadUpdateComplete(pScrn);*/
+
+ OUTPLLP(pScrn, R128_P2PLL_DIV_0,
+ restore->p2pll_div_0, ~R128_P2PLL_FB0_DIV_MASK);
+
+/* R128PLL2WriteUpdate(pScrn);
+ R128PLL2WaitForReadUpdateComplete(pScrn);*/
+
+ OUTPLLP(pScrn, R128_P2PLL_DIV_0,
+ restore->p2pll_div_0, ~R128_P2PLL_POST0_DIV_MASK);
+
+ R128PLL2WriteUpdate(pScrn);
+ R128PLL2WaitForReadUpdateComplete(pScrn);
+
+ OUTPLL(R128_HTOTAL2_CNTL, restore->htotal_cntl2);
+
+/* R128PLL2WriteUpdate(pScrn);*/
+
+ OUTPLLP(pScrn, R128_P2PLL_CNTL, 0, ~(R128_P2PLL_RESET
+ | R128_P2PLL_SLEEP
+ | R128_P2PLL_ATOMIC_UPDATE_EN
+ | R128_P2PLL_VGA_ATOMIC_UPDATE_EN));
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Wrote: 0x%08x 0x%08x 0x%08x (0x%08x)\n",
+ restore->p2pll_ref_div,
+ restore->p2pll_div_0,
+ restore->htotal_cntl2,
+ INPLL(pScrn, R128_P2PLL_CNTL)));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Wrote: rd=%d, fd=%d, pd=%d\n",
+ restore->p2pll_ref_div & R128_P2PLL_REF_DIV_MASK,
+ restore->p2pll_div_0 & R128_P2PLL_FB0_DIV_MASK,
+ (restore->p2pll_div_0 &
+ R128_P2PLL_POST0_DIV_MASK) >>16));
+
+ usleep(5000); /* Let the clock to lock */
+
+ OUTPLLP(pScrn, R128_V2CLK_VCLKTV_CNTL,
+ R128_V2CLK_SRC_SEL_P2PLLCLK,
+ ~R128_V2CLK_SRC_SEL_MASK);
+
+}
+
+/* Define DDA registers for requested video mode. */
+Bool R128InitDDARegisters(xf86CrtcPtr crtc, R128SavePtr save,
+ R128PLLPtr pll, DisplayModePtr mode)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ xf86OutputPtr output = R128FirstOutput(crtc);
+ R128OutputPrivatePtr r128_output = output->driver_private;
+
+ int DisplayFifoWidth = 128;
+ int DisplayFifoDepth = 32;
+ int XclkFreq;
+ int VclkFreq;
+ int XclksPerTransfer;
+ int XclksPerTransferPrecise;
+ int UseablePrecision;
+ int Roff;
+ int Ron;
+
+ XclkFreq = pll->xclk;
+
+ VclkFreq = R128Div(pll->reference_freq * save->feedback_div,
+ pll->reference_div * save->post_div);
+
+ if (info->isDFP && !info->isPro2 && r128_output->PanelXRes > 0) {
+ if (r128_output->PanelXRes != mode->CrtcHDisplay)
+ VclkFreq = (VclkFreq * mode->CrtcHDisplay) / r128_output->PanelXRes;
+ }
+
+ XclksPerTransfer = R128Div(XclkFreq * DisplayFifoWidth,
+ VclkFreq * (info->CurrentLayout.pixel_bytes * 8));
+
+ UseablePrecision = R128MinBits(XclksPerTransfer) + 1;
+
+ XclksPerTransferPrecise = R128Div((XclkFreq * DisplayFifoWidth)
+ << (11 - UseablePrecision),
+ VclkFreq * (info->CurrentLayout.pixel_bytes * 8));
+
+ Roff = XclksPerTransferPrecise * (DisplayFifoDepth - 4);
+
+ Ron = (4 * info->ram->MB
+ + 3 * MAX(info->ram->Trcd - 2, 0)
+ + 2 * info->ram->Trp
+ + info->ram->Twr
+ + info->ram->CL
+ + info->ram->Tr2w
+ + XclksPerTransfer) << (11 - UseablePrecision);
+
+ if (Ron + info->ram->Rloop >= Roff) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "(Ron = %d) + (Rloop = %d) >= (Roff = %d)\n",
+ Ron, info->ram->Rloop, Roff);
+ return FALSE;
+ }
+
+ save->dda_config = (XclksPerTransferPrecise
+ | (UseablePrecision << 16)
+ | (info->ram->Rloop << 20));
+
+ save->dda_on_off = (Ron << 16) | Roff;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "XclkFreq = %d; VclkFreq = %d; "
+ "per = %d, %d (useable = %d)\n",
+ XclkFreq,
+ VclkFreq,
+ XclksPerTransfer,
+ XclksPerTransferPrecise,
+ UseablePrecision));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Roff = %d, Ron = %d, Rloop = %d\n",
+ Roff, Ron, info->ram->Rloop));
+
+ return TRUE;
+}
+
+/* Define DDA2 registers for requested video mode. */
+Bool R128InitDDA2Registers(xf86CrtcPtr crtc, R128SavePtr save,
+ R128PLLPtr pll, DisplayModePtr mode)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ xf86OutputPtr output = R128FirstOutput(crtc);
+ R128OutputPrivatePtr r128_output = output->driver_private;
+
+ int DisplayFifoWidth = 128;
+ int DisplayFifoDepth = 32;
+ int XclkFreq;
+ int VclkFreq;
+ int XclksPerTransfer;
+ int XclksPerTransferPrecise;
+ int UseablePrecision;
+ int Roff;
+ int Ron;
+
+ XclkFreq = pll->xclk;
+
+ VclkFreq = R128Div(pll->reference_freq * save->feedback_div_2,
+ pll->reference_div * save->post_div_2);
+
+ if (info->isDFP && !info->isPro2 && r128_output->PanelXRes > 0) {
+ if (r128_output->PanelXRes != mode->CrtcHDisplay)
+ VclkFreq = (VclkFreq * mode->CrtcHDisplay) / r128_output->PanelXRes;
+ }
+
+ XclksPerTransfer = R128Div(XclkFreq * DisplayFifoWidth,
+ VclkFreq * (info->CurrentLayout.pixel_bytes * 8));
+
+ UseablePrecision = R128MinBits(XclksPerTransfer) + 1;
+
+ XclksPerTransferPrecise = R128Div((XclkFreq * DisplayFifoWidth)
+ << (11 - UseablePrecision),
+ VclkFreq * (info->CurrentLayout.pixel_bytes * 8));
+
+ Roff = XclksPerTransferPrecise * (DisplayFifoDepth - 4);
+
+ Ron = (4 * info->ram->MB
+ + 3 * MAX(info->ram->Trcd - 2, 0)
+ + 2 * info->ram->Trp
+ + info->ram->Twr
+ + info->ram->CL
+ + info->ram->Tr2w
+ + XclksPerTransfer) << (11 - UseablePrecision);
+
+
+ if (Ron + info->ram->Rloop >= Roff) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "(Ron = %d) + (Rloop = %d) >= (Roff = %d)\n",
+ Ron, info->ram->Rloop, Roff);
+ return FALSE;
+ }
+
+ save->dda2_config = (XclksPerTransferPrecise
+ | (UseablePrecision << 16)
+ | (info->ram->Rloop << 20));
+
+ /*save->dda2_on_off = (Ron << 16) | Roff;*/
+ /* shift most be 18 otherwise there's corruption on crtc2 */
+ save->dda2_on_off = (Ron << 18) | Roff;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "XclkFreq = %d; VclkFreq = %d; "
+ "per = %d, %d (useable = %d)\n",
+ XclkFreq,
+ VclkFreq,
+ XclksPerTransfer,
+ XclksPerTransferPrecise,
+ UseablePrecision));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Roff = %d, Ron = %d, Rloop = %d\n",
+ Roff, Ron, info->ram->Rloop));
+
+ return TRUE;
+}
+
+static void r128_crtc_load_lut(xf86CrtcPtr crtc);
+
+static void r128_crtc_dpms(xf86CrtcPtr crtc, int mode)
+{
+ int mask;
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+
+ /* XXX: The HSYNC and VSYNC bits for CRTC2 don't exist on the r128? */
+ mask = r128_crtc->crtc_id ? R128_CRTC2_DISP_DIS : (R128_CRTC_DISPLAY_DIS | R128_CRTC_HSYNC_DIS | R128_CRTC_VSYNC_DIS);
+
+ switch (mode) {
+ case DPMSModeOn:
+ if (r128_crtc->crtc_id) {
+ OUTREGP(R128_CRTC2_GEN_CNTL, 0, ~mask);
+ } else {
+ OUTREGP(R128_CRTC_EXT_CNTL, 0, ~mask);
+ }
+ break;
+ case DPMSModeStandby:
+ if (r128_crtc->crtc_id) {
+ OUTREGP(R128_CRTC2_GEN_CNTL, R128_CRTC2_DISP_DIS, ~mask);
+ } else {
+ OUTREGP(R128_CRTC_EXT_CNTL, (R128_CRTC_DISPLAY_DIS | R128_CRTC_HSYNC_DIS), ~mask);
+ }
+ break;
+ case DPMSModeSuspend:
+ if (r128_crtc->crtc_id) {
+ OUTREGP(R128_CRTC2_GEN_CNTL, R128_CRTC2_DISP_DIS, ~mask);
+ } else {
+ OUTREGP(R128_CRTC_EXT_CNTL, (R128_CRTC_DISPLAY_DIS | R128_CRTC_VSYNC_DIS), ~mask);
+ }
+ break;
+ case DPMSModeOff:
+ if (r128_crtc->crtc_id) {
+ OUTREGP(R128_CRTC2_GEN_CNTL, mask, ~mask);
+ } else {
+ OUTREGP(R128_CRTC_EXT_CNTL, mask, ~mask);
+ }
+ break;
+ }
+
+ if (mode != DPMSModeOn) {
+ if (r128_crtc->crtc_id) {
+ OUTREGP(R128_CRTC2_GEN_CNTL, 0, ~R128_CRTC2_EN);
+ } else {
+ OUTREGP(R128_CRTC_GEN_CNTL, 0, ~R128_CRTC_EN);
+ }
+ } else {
+ if (r128_crtc->crtc_id) {
+ OUTREGP(R128_CRTC2_GEN_CNTL, R128_CRTC2_EN, ~R128_CRTC2_EN);
+ } else {
+ OUTREGP(R128_CRTC_GEN_CNTL, R128_CRTC_EN, ~R128_CRTC_EN);
+ }
+ }
+
+ if (mode != DPMSModeOff)
+ r128_crtc_load_lut(crtc);
+}
+
+void r128_crtc_load_lut(xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+ int i;
+
+ if (!crtc->enabled)
+ return;
+
+ PAL_SELECT(r128_crtc->crtc_id);
+
+ for (i = 0; i < 256; i++) {
+ OUTPAL(i, r128_crtc->lut_r[i], r128_crtc->lut_g[i], r128_crtc->lut_b[i]);
+ }
+}
+
+static Bool r128_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mode)
+{
+ return TRUE;
+}
+
+static void r128_crtc_mode_prepare(xf86CrtcPtr crtc)
+{
+ r128_crtc_dpms(crtc, DPMSModeOff);
+}
+
+static void r128_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mode, int x, int y)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+ R128InfoPtr info = R128PTR(pScrn);
+ double dot_clock = adjusted_mode->Clock / 1000.0;
+
+ if (r128_crtc->cursor_offset) r128_crtc_hide_cursor(crtc);
+ xf86PrintModeline(pScrn->scrnIndex, adjusted_mode);
+ R128InitCommonRegisters(&info->ModeReg, info);
+
+ switch (r128_crtc->crtc_id) {
+ case 0:
+ R128InitCrtcRegisters(crtc, &info->ModeReg, adjusted_mode);
+ R128InitCrtcBase(crtc, &info->ModeReg, x, y);
+ if (dot_clock) {
+ R128InitPLLRegisters(crtc, &info->ModeReg, &info->pll, dot_clock);
+ R128InitDDARegisters(crtc, &info->ModeReg, &info->pll, adjusted_mode);
+ } else {
+ info->ModeReg.ppll_ref_div = info->SavedReg.ppll_ref_div;
+ info->ModeReg.ppll_div_3 = info->SavedReg.ppll_div_3;
+ info->ModeReg.htotal_cntl = info->SavedReg.htotal_cntl;
+ info->ModeReg.dda_config = info->SavedReg.dda_config;
+ info->ModeReg.dda_on_off = info->SavedReg.dda_on_off;
+ }
+ break;
+ case 1:
+ R128InitCrtc2Registers(crtc, &info->ModeReg, adjusted_mode);
+ R128InitCrtc2Base(crtc, &info->ModeReg, x, y);
+ if (dot_clock) {
+ R128InitPLL2Registers(crtc, &info->ModeReg, &info->pll, dot_clock);
+ R128InitDDA2Registers(crtc, &info->ModeReg, &info->pll, adjusted_mode);
+ }
+ break;
+ }
+
+ R128RestoreCommonRegisters(pScrn, &info->ModeReg);
+
+ switch (r128_crtc->crtc_id) {
+ case 0:
+ R128RestoreDDARegisters(pScrn, &info->ModeReg);
+ R128RestoreCrtcRegisters(pScrn, &info->ModeReg);
+ R128RestorePLLRegisters(pScrn, &info->ModeReg);
+ break;
+ case 1:
+ R128RestoreDDA2Registers(pScrn, &info->ModeReg);
+ R128RestoreCrtc2Registers(pScrn, &info->ModeReg);
+ R128RestorePLL2Registers(pScrn, &info->ModeReg);
+ break;
+ }
+
+ if (r128_crtc->cursor_offset) r128_crtc_show_cursor(crtc);
+}
+
+static void r128_crtc_mode_commit(xf86CrtcPtr crtc)
+{
+ r128_crtc_dpms(crtc, DPMSModeOn);
+}
+
+static void r128_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green, uint16_t *blue, int size)
+{
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+ int i;
+
+ for (i = 0; i < 256; i++) {
+ r128_crtc->lut_r[i] = red[i] >> 8;
+ r128_crtc->lut_g[i] = green[i] >> 8;
+ r128_crtc->lut_b[i] = blue[i] >> 8;
+ }
+
+ r128_crtc_load_lut(crtc);
+}
+
+static Bool r128_crtc_lock(xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
+
+#ifdef HAVE_XAA_H
+ if (info->accel) info->accel->Sync(pScrn);
+#endif
+#ifdef USE_EXA
+ if (info->ExaDriver) exaWaitSync(pScreen);
+#endif
+
+ return FALSE;
+}
+
+static void r128_crtc_unlock(xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
+
+#ifdef HAVE_XAA_H
+ if (info->accel) info->accel->Sync(pScrn);
+#endif
+#ifdef USE_EXA
+ if (info->ExaDriver) exaWaitSync(pScreen);
+#endif
+}
+
+static void *r128_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+ unsigned long rotate_offset = 0;
+ unsigned long rotate_pitch;
+ int cpp = pScrn->bitsPerPixel / 8;
+ int align = 4096;
+ int size;
+
+ rotate_pitch = pScrn->displayWidth * cpp;
+ size = rotate_pitch * height;
+ rotate_offset = R128AllocateMemory(pScrn, &(r128_crtc->rotate_mem), size, align, TRUE);
+
+ /* If allocations failed or if there was no accel. */
+ if (rotate_offset == 0)
+ return NULL;
+
+ return info->FB + rotate_offset;
+}
+
+static PixmapPtr r128_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ PixmapPtr rotate_pixmap;
+ unsigned long rotate_pitch;
+ int cpp = pScrn->bitsPerPixel / 8;
+
+ if (!data) data = r128_crtc_shadow_allocate(crtc, width, height);
+
+ rotate_pitch = pScrn->displayWidth * cpp;
+ rotate_pixmap = GetScratchPixmapHeader(xf86ScrnToScreen(pScrn),
+ width, height,
+ pScrn->depth,
+ pScrn->bitsPerPixel,
+ rotate_pitch,
+ data);
+
+ if (rotate_pixmap == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Couldn't allocate shadow memory for rotated CRTC\n");
+ return NULL;
+ }
+
+ return rotate_pixmap;
+}
+
+static void r128_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
+
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+
+ if (rotate_pixmap) FreeScratchPixmapHeader(rotate_pixmap);
+
+ if (data && r128_crtc->rotate_mem != NULL) {
+#ifdef USE_EXA
+ if (info->ExaDriver)
+ exaOffscreenFree(pScreen, (ExaOffscreenArea *) r128_crtc->rotate_mem);
+#endif
+#ifdef HAVE_XAA_H
+ if (info->accel)
+ xf86FreeOffscreenLinear((FBLinearPtr) r128_crtc->rotate_mem);
+#endif
+ r128_crtc->rotate_mem = NULL;
+ }
+}
+
+static const xf86CrtcFuncsRec r128_crtc_funcs = {
+ .dpms = r128_crtc_dpms,
+ .save = NULL,
+ .restore = NULL,
+ .mode_fixup = r128_crtc_mode_fixup,
+ .prepare = r128_crtc_mode_prepare,
+ .mode_set = r128_crtc_mode_set,
+ .commit = r128_crtc_mode_commit,
+ .gamma_set = r128_crtc_gamma_set,
+ .lock = r128_crtc_lock,
+ .unlock = r128_crtc_unlock,
+ .shadow_create = r128_crtc_shadow_create,
+ .shadow_allocate = r128_crtc_shadow_allocate,
+ .shadow_destroy = r128_crtc_shadow_destroy,
+ .set_cursor_colors = r128_crtc_set_cursor_colors,
+ .set_cursor_position = r128_crtc_set_cursor_position,
+ .show_cursor = r128_crtc_show_cursor,
+ .hide_cursor = r128_crtc_hide_cursor,
+ .load_cursor_image = r128_crtc_load_cursor_image,
+ .destroy = NULL,
+};
+
+Bool R128AllocateControllers(ScrnInfoPtr pScrn)
+{
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
+
+ if (pR128Ent->Controller[0])
+ return TRUE;
+
+ pR128Ent->pCrtc[0] = xf86CrtcCreate(pScrn, &r128_crtc_funcs);
+ if (!pR128Ent->pCrtc[0])
+ return FALSE;
+
+ pR128Ent->Controller[0] = xnfcalloc(sizeof(R128CrtcPrivateRec), 1);
+ if (!pR128Ent->Controller[0])
+ return FALSE;
+
+ pR128Ent->pCrtc[0]->driver_private = pR128Ent->Controller[0];
+ pR128Ent->Controller[0]->crtc_id = 0;
+
+ if (!pR128Ent->HasCRTC2)
+ return TRUE;
+
+ pR128Ent->pCrtc[1] = xf86CrtcCreate(pScrn, &r128_crtc_funcs);
+ if (!pR128Ent->pCrtc[1])
+ return FALSE;
+
+ pR128Ent->Controller[1] = xnfcalloc(sizeof(R128CrtcPrivateRec), 1);
+ if (!pR128Ent->Controller[1]) {
+ free(pR128Ent->Controller[0]);
+ return FALSE;
+ }
+
+ pR128Ent->pCrtc[1]->driver_private = pR128Ent->Controller[1];
+ pR128Ent->Controller[1]->crtc_id = 1;
+
+ return TRUE;
+}
+
+void R128Blank(ScrnInfoPtr pScrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ int o, c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ crtc = xf86_config->crtc[c];
+ for (o = 0; o < xf86_config->num_output; o++) {
+ output = xf86_config->output[o];
+ if (output->crtc != crtc)
+ continue;
+
+ output->funcs->dpms(output, DPMSModeOff);
+ }
+ crtc->funcs->dpms(crtc, DPMSModeOff);
+ }
+}
+
+void R128Unblank(ScrnInfoPtr pScrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ int o, c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ crtc = xf86_config->crtc[c];
+ if (!crtc->enabled)
+ continue;
+ crtc->funcs->dpms(crtc, DPMSModeOn);
+ for (o = 0; o < xf86_config->num_output; o++) {
+ output = xf86_config->output[o];
+ if (output->crtc != crtc)
+ continue;
+
+ output->funcs->dpms(output, DPMSModeOn);
+ }
+ }
+}
diff --git a/driver/xf86-video-r128/src/r128_cursor.c b/driver/xf86-video-r128/src/r128_cursor.c
index b76913cef..048e6c1ae 100644
--- a/driver/xf86-video-r128/src/r128_cursor.c
+++ b/driver/xf86-video-r128/src/r128_cursor.c
@@ -59,197 +59,137 @@
#include "exa.h"
#endif
-#if X_BYTE_ORDER == X_BIG_ENDIAN
-#define P_SWAP32( a , b ) \
- ((char *)a)[0] = ((char *)b)[3]; \
- ((char *)a)[1] = ((char *)b)[2]; \
- ((char *)a)[2] = ((char *)b)[1]; \
- ((char *)a)[3] = ((char *)b)[0]
-
-#define P_SWAP16( a , b ) \
- ((char *)a)[0] = ((char *)b)[1]; \
- ((char *)a)[1] = ((char *)b)[0]; \
- ((char *)a)[2] = ((char *)b)[3]; \
- ((char *)a)[3] = ((char *)b)[2]
-#endif
-
+#define CURSOR_WIDTH 64
+#define CURSOR_HEIGHT 64
-/* Set cursor foreground and background colors. */
-static void R128SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+void r128_crtc_show_cursor(xf86CrtcPtr crtc)
{
- R128InfoPtr info = R128PTR(pScrn);
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+ R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
-
- if(info->IsSecondary)
- {
- OUTREG(R128_CUR2_CLR0, bg);
- OUTREG(R128_CUR2_CLR1, fg);
- }
- else
- {
- OUTREG(R128_CUR_CLR0, bg);
- OUTREG(R128_CUR_CLR1, fg);
+ int crtc_id = r128_crtc->crtc_id;
+
+ switch (crtc_id) {
+ case 0:
+ OUTREGP(R128_CRTC_GEN_CNTL, R128_CRTC_CUR_EN, ~R128_CRTC_CUR_EN);
+ break;
+ case 1:
+ OUTREGP(R128_CRTC2_GEN_CNTL, R128_CRTC2_CUR_EN, ~R128_CRTC2_CUR_EN);
+ break;
+ default:
+ return;
}
}
-/* Set cursor position to (x,y) with offset into cursor bitmap at
- (xorigin,yorigin). */
-static void R128SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+void r128_crtc_hide_cursor(xf86CrtcPtr crtc)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- xf86CursorInfoPtr cursor = info->cursor;
- int xorigin = 0;
- int yorigin = 0;
- int total_y = pScrn->frameY1 - pScrn->frameY0;
-
- if (x < 0) xorigin = -x;
- if (y < 0) yorigin = -y;
- if (y > total_y) y = total_y;
- if (info->Flags & V_DBLSCAN) y *= 2;
- if (xorigin >= cursor->MaxWidth) xorigin = cursor->MaxWidth - 1;
- if (yorigin >= cursor->MaxHeight) yorigin = cursor->MaxHeight - 1;
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int crtc_id = r128_crtc->crtc_id;
- if(!info->IsSecondary)
- {
- OUTREG(R128_CUR_HORZ_VERT_OFF, R128_CUR_LOCK | (xorigin << 16) | yorigin);
- OUTREG(R128_CUR_HORZ_VERT_POSN, (R128_CUR_LOCK
- | ((xorigin ? 0 : x) << 16)
- | (yorigin ? 0 : y)));
- OUTREG(R128_CUR_OFFSET, info->cursor_start + yorigin * 16);
- }
- else
- {
- OUTREG(R128_CUR2_HORZ_VERT_OFF, (R128_CUR2_LOCK
- | (xorigin << 16)
- | yorigin));
- OUTREG(R128_CUR2_HORZ_VERT_POSN, (R128_CUR2_LOCK
- | ((xorigin ? 0 : x) << 16)
- | (yorigin ? 0 : y)));
- OUTREG(R128_CUR2_OFFSET,
- info->cursor_start + pScrn->fbOffset + yorigin * 16);
+ switch (crtc_id) {
+ case 0:
+ OUTREGP(R128_CRTC_GEN_CNTL, 0, ~R128_CRTC_CUR_EN);
+ break;
+ case 1:
+ OUTREGP(R128_CRTC2_GEN_CNTL, 0, ~R128_CRTC2_CUR_EN);
+ break;
+ default:
+ return;
}
}
-/* Copy cursor image from `image' to video memory. R128SetCursorPosition
- will be called after this, so we can ignore xorigin and yorigin. */
-static void R128LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image)
+void r128_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg)
{
- R128InfoPtr info = R128PTR(pScrn);
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+ R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- CARD32 *s = (pointer)image;
- CARD32 *d = (pointer)((CARD8*)info->FB + info->cursor_start);
- int y;
- CARD32 save;
-
- if(!info->IsSecondary)
- {
- save = INREG(R128_CRTC_GEN_CNTL);
- OUTREG(R128_CRTC_GEN_CNTL, save & (CARD32)~R128_CRTC_CUR_EN);
- }
- else
- {
- save = INREG(R128_CRTC2_GEN_CNTL);
- OUTREG(R128_CRTC2_GEN_CNTL, save & (CARD32)~R128_CRTC2_CUR_EN);
- }
-
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- switch(info->CurrentLayout.pixel_bytes) {
- case 4:
- case 3:
- for (y = 0; y < 64; y++) {
- P_SWAP32(d,s);
- d++; s++;
- P_SWAP32(d,s);
- d++; s++;
- P_SWAP32(d,s);
- d++; s++;
- P_SWAP32(d,s);
- d++; s++;
- }
- break;
- case 2:
- for (y = 0; y < 64; y++) {
- P_SWAP16(d,s);
- d++; s++;
- P_SWAP16(d,s);
- d++; s++;
- P_SWAP16(d,s);
- d++; s++;
- P_SWAP16(d,s);
- d++; s++;
- }
- break;
+ int crtc_id = r128_crtc->crtc_id;
+
+ switch (crtc_id) {
+ case 0:
+ OUTREG(R128_CUR_CLR0, bg);
+ OUTREG(R128_CUR_CLR1, fg);
+ break;
+ case 1:
+ OUTREG(R128_CUR2_CLR0, bg);
+ OUTREG(R128_CUR2_CLR1, fg);
+ break;
default:
- for (y = 0; y < 64; y++) {
- *d++ = *s++;
- *d++ = *s++;
- *d++ = *s++;
- *d++ = *s++;
- }
- }
-#else
- for (y = 0; y < 64; y++) {
- *d++ = *s++;
- *d++ = *s++;
- *d++ = *s++;
- *d++ = *s++;
+ return;
}
-#endif
-
- /* Set the area after the cursor to be all transparent so that we
- won't display corrupted cursors on the screen */
- for (y = 0; y < 64; y++) {
- *d++ = 0xffffffff; /* The AND bits */
- *d++ = 0xffffffff;
- *d++ = 0x00000000; /* The XOR bits */
- *d++ = 0x00000000;
- }
-
-
- if(!info->IsSecondary)
- OUTREG(R128_CRTC_GEN_CNTL, save);
- else
- OUTREG(R128_CRTC2_GEN_CNTL, save);
-
}
-/* Hide hardware cursor. */
-static void R128HideCursor(ScrnInfoPtr pScrn)
+void r128_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
-
- if(info->IsSecondary)
- OUTREGP(R128_CRTC2_GEN_CNTL, 0, ~R128_CRTC2_CUR_EN);
- else
- OUTREGP(R128_CRTC_GEN_CNTL, 0, ~R128_CRTC_CUR_EN);
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+ unsigned char *R128MMIO = info->MMIO;
+ int crtc_id = r128_crtc->crtc_id;
+
+ int xorigin = 0, yorigin = 0;
+ DisplayModePtr mode = &crtc->mode;
+
+ if (x < 0) xorigin = -x + 1;
+ if (y < 0) yorigin = -y + 1;
+ if (xorigin >= CURSOR_WIDTH) xorigin = CURSOR_WIDTH - 1;
+ if (yorigin >= CURSOR_HEIGHT) yorigin = CURSOR_HEIGHT - 1;
+
+ if (mode->Flags & V_INTERLACE)
+ y /= 2;
+ else if (mode->Flags & V_DBLSCAN)
+ y *= 2;
+
+ if(crtc_id == 0) {
+ OUTREG(R128_CUR_HORZ_VERT_OFF, (R128_CUR_LOCK | (xorigin << 16) | yorigin));
+ OUTREG(R128_CUR_HORZ_VERT_POSN, (R128_CUR_LOCK | ((xorigin ? 0 : x) << 16) | (yorigin ? 0 : y)));
+ OUTREG(R128_CUR_OFFSET, r128_crtc->cursor_offset + pScrn->fbOffset + yorigin * 16);
+ } else if (crtc_id == 1) {
+ OUTREG(R128_CUR2_HORZ_VERT_OFF, (R128_CUR2_LOCK | (xorigin << 16) | yorigin));
+ OUTREG(R128_CUR2_HORZ_VERT_POSN, (R128_CUR2_LOCK | ((xorigin ? 0 : x) << 16) | (yorigin ? 0 : y)));
+ OUTREG(R128_CUR2_OFFSET, r128_crtc->cursor_offset + pScrn->fbOffset + yorigin * 16);
+ }
}
-/* Show hardware cursor. */
-static void R128ShowCursor(ScrnInfoPtr pScrn)
+void r128_crtc_load_cursor_image(xf86CrtcPtr crtc, unsigned char *src)
{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+ int crtc_id = r128_crtc->crtc_id;
+
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
-
- if(info->IsSecondary)
- {
- OUTREGP(R128_CRTC2_GEN_CNTL, R128_CRTC2_CUR_EN,
- ~R128_CRTC2_CUR_EN);
- }
- else
- {
- OUTREGP(R128_CRTC_GEN_CNTL, R128_CRTC_CUR_EN, ~R128_CRTC_CUR_EN);
+ uint32_t save1 = 0;
+ uint32_t save2 = 0;
+
+ if (crtc_id == 0) {
+ save1 = INREG(R128_CRTC_GEN_CNTL);
+ OUTREG(R128_CRTC_GEN_CNTL, save1 & (uint32_t)~R128_CRTC_CUR_EN);
+ } else if (crtc_id == 1) {
+ save2 = INREG(R128_CRTC2_GEN_CNTL);
+ OUTREG(R128_CRTC2_GEN_CNTL, save2 & (uint32_t)~R128_CRTC2_CUR_EN);
}
-}
-/* Determine if hardware cursor is in use. */
-static Bool R128UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
-{
- ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- R128InfoPtr info = R128PTR(pScrn);
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ if (info->CurrentLayout.pixel_bytes == 4 || info->CurrentLayout.pixel_bytes == 3)
+ R128CopySwap(info->FB + r128_crtc->cursor_offset + pScrn->fbOffset, src,
+ CURSOR_WIDTH * CURSOR_HEIGHT / 4, APER_0_BIG_ENDIAN_32BPP_SWAP);
+ else if (info->CurrentLayout.pixel_bytes == 2)
+ R128CopySwap(info->FB + r128_crtc->cursor_offset + pScrn->fbOffset, src,
+ CURSOR_WIDTH * CURSOR_HEIGHT / 4, APER_0_BIG_ENDIAN_16BPP_SWAP);
+ else
+#endif
+ memcpy(info->FB + r128_crtc->cursor_offset + pScrn->fbOffset, src, CURSOR_WIDTH * CURSOR_HEIGHT / 4);
- return info->cursor_start ? TRUE : FALSE;
+ if (crtc_id == 0)
+ OUTREG(R128_CRTC_GEN_CNTL, save1);
+ else
+ OUTREG(R128_CRTC2_GEN_CNTL, save2);
}
/* Initialize hardware cursor support. */
@@ -257,77 +197,72 @@ Bool R128CursorInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
R128InfoPtr info = R128PTR(pScrn);
- xf86CursorInfoPtr cursor;
FBAreaPtr fbarea = NULL;
#ifdef USE_EXA
ExaOffscreenArea* osArea = NULL;
#else
void* osArea = NULL;
#endif
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ uint32_t cursor_offset = 0;
+ int cpp = info->CurrentLayout.pixel_bytes;
int width;
+ int width_bytes;
int height;
int size;
+ int size_bytes;
+ int c;
- int cpp = info->CurrentLayout.pixel_bytes;
-
- if (!(cursor = info->cursor = xf86CreateCursorInfoRec())) return FALSE;
-
- cursor->MaxWidth = 64;
- cursor->MaxHeight = 64;
- cursor->Flags = (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP
- | HARDWARE_CURSOR_SHOW_TRANSPARENT
- | HARDWARE_CURSOR_UPDATE_UNHIDDEN
-#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- | HARDWARE_CURSOR_BIT_ORDER_MSBFIRST
-#endif
- | HARDWARE_CURSOR_INVERT_MASK
- | HARDWARE_CURSOR_AND_SOURCE_WITH_MASK
- | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64
- | HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK);
-
- cursor->SetCursorColors = R128SetCursorColors;
- cursor->SetCursorPosition = R128SetCursorPosition;
- cursor->LoadCursorImage = R128LoadCursorImage;
- cursor->HideCursor = R128HideCursor;
- cursor->ShowCursor = R128ShowCursor;
- cursor->UseHWCursor = R128UseHWCursor;
-
- size = (cursor->MaxWidth/4) * cursor->MaxHeight;
+ size = CURSOR_WIDTH * CURSOR_HEIGHT / 4;
+ size_bytes = size * 2;
width = pScrn->displayWidth;
- height = (size*2 + 1023) / pScrn->displayWidth;
+ width_bytes = width * (pScrn->bitsPerPixel / 8);
+ height = ((size_bytes * xf86_config->num_crtc) + width_bytes - 1) / width_bytes;
if(!info->useEXA) {
fbarea = xf86AllocateOffscreenArea(pScreen, width, height,
16, NULL, NULL, NULL);
- if (fbarea) {
- info->cursor_start = R128_ALIGN((fbarea->box.x1
- + width * fbarea->box.y1)
- * cpp, 16);
- info->cursor_end = info->cursor_start + size;
- }
+ if (fbarea)
+ cursor_offset = R128_ALIGN((fbarea->box.x1 + width * fbarea->box.y1) * cpp, 16);
}
#ifdef USE_EXA
else {
osArea = exaOffscreenAlloc(pScreen, width * height, 16,
TRUE, NULL, NULL);
- if (osArea) {
- info->cursor_start = osArea->offset;
- info->cursor_end = osArea->offset + osArea->size;
- }
+ if (osArea)
+ cursor_offset = osArea->offset;
}
#endif
if ((!info->useEXA && !fbarea) || (info->useEXA && !osArea)) {
- info->cursor_start = 0;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Hardware cursor disabled"
" due to insufficient offscreen memory\n");
+ return FALSE;
+ } else {
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+
+ r128_crtc->cursor_offset = cursor_offset + (c * size);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Will use %d kb for hardware cursor %d at offset 0x%08x\n",
+ (size_bytes * xf86_config->num_crtc) / 1024, c,
+ (unsigned int)r128_crtc->cursor_offset);
+ }
}
- R128TRACE(("R128CursorInit (0x%08x-0x%08x)\n",
- info->cursor_start, info->cursor_end));
-
- return xf86InitCursor(pScreen, cursor);
+ return xf86_cursors_init(pScreen, CURSOR_WIDTH, CURSOR_HEIGHT,
+ (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
+ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
+ HARDWARE_CURSOR_SHOW_TRANSPARENT |
+ HARDWARE_CURSOR_UPDATE_UNHIDDEN |
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
+#endif
+ HARDWARE_CURSOR_INVERT_MASK |
+ HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64));
}
diff --git a/driver/xf86-video-r128/src/r128_dga.c b/driver/xf86-video-r128/src/r128_dga.c
deleted file mode 100644
index d7fee02d0..000000000
--- a/driver/xf86-video-r128/src/r128_dga.c
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Authors:
- * Ove Kåven <ovek@transgaming.com>,
- * borrowing some code from the Chips and MGA drivers.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
- /* Driver data structures */
-#include "r128.h"
-#include "r128_probe.h"
-
- /* X and server generic header files */
-#include "xf86.h"
-
- /* DGA support */
-#include "dgaproc.h"
-
-#ifdef R128DRI
-#include "r128_common.h"
-#endif
-
-static Bool R128_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
- int *, int *, int *);
-static Bool R128_SetMode(ScrnInfoPtr, DGAModePtr);
-static int R128_GetViewport(ScrnInfoPtr);
-static void R128_SetViewport(ScrnInfoPtr, int, int, int);
-#ifdef HAVE_XAA_H
-static void R128_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
-static void R128_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
-static void R128_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int,
- unsigned long);
-#endif
-
-static DGAModePtr R128SetupDGAMode(ScrnInfoPtr pScrn,
- DGAModePtr modes,
- int *num,
- int bitsPerPixel,
- int depth,
- Bool pixmap,
- int secondPitch,
- unsigned long red,
- unsigned long green,
- unsigned long blue,
- short visualClass)
-{
- R128InfoPtr info = R128PTR(pScrn);
- DGAModePtr newmodes = NULL;
- DGAModePtr currentMode;
- DisplayModePtr pMode;
- DisplayModePtr firstMode;
- unsigned int size;
- int pitch;
- int Bpp = bitsPerPixel >> 3;
-
-SECOND_PASS:
-
- pMode = firstMode = pScrn->modes;
-
- while (1) {
- pitch = pScrn->displayWidth;
- size = pitch * Bpp * pMode->VDisplay;
-
- if ((!secondPitch || (pitch != secondPitch)) &&
- (size <= info->FbMapSize)) {
-
- if (secondPitch)
- pitch = secondPitch;
-
- if (!(newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec))))
- break;
-
- modes = newmodes;
- currentMode = modes + *num;
-
- currentMode->mode = pMode;
- currentMode->flags = DGA_CONCURRENT_ACCESS;
-
- if (pixmap)
- currentMode->flags |= DGA_PIXMAP_AVAILABLE;
-
-#ifdef HAVE_XAA_H
- if (info->accel) {
- if (info->accel->SetupForSolidFill &&
- info->accel->SubsequentSolidFillRect)
- currentMode->flags |= DGA_FILL_RECT;
- if (info->accel->SetupForScreenToScreenCopy &&
- info->accel->SubsequentScreenToScreenCopy)
- currentMode->flags |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS;
- if (currentMode->flags &
- (DGA_PIXMAP_AVAILABLE | DGA_FILL_RECT |
- DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS))
- currentMode->flags &= ~DGA_CONCURRENT_ACCESS;
- }
-#endif
- if (pMode->Flags & V_DBLSCAN)
- currentMode->flags |= DGA_DOUBLESCAN;
- if (pMode->Flags & V_INTERLACE)
- currentMode->flags |= DGA_INTERLACED;
-
- currentMode->byteOrder = pScrn->imageByteOrder;
- currentMode->depth = depth;
- currentMode->bitsPerPixel = bitsPerPixel;
- currentMode->red_mask = red;
- currentMode->green_mask = green;
- currentMode->blue_mask = blue;
- currentMode->visualClass = visualClass;
- currentMode->viewportWidth = pMode->HDisplay;
- currentMode->viewportHeight = pMode->VDisplay;
- currentMode->xViewportStep = 8;
- currentMode->yViewportStep = 1;
- currentMode->viewportFlags = DGA_FLIP_RETRACE;
- currentMode->offset = 0;
- currentMode->address = (unsigned char*)info->LinearAddr;
- currentMode->bytesPerScanline = pitch * Bpp;
- currentMode->imageWidth = pitch;
- currentMode->imageHeight = (info->FbMapSize
- / currentMode->bytesPerScanline);
- currentMode->pixmapWidth = currentMode->imageWidth;
- currentMode->pixmapHeight = currentMode->imageHeight;
- currentMode->maxViewportX = (currentMode->imageWidth
- - currentMode->viewportWidth);
- /* this might need to get clamped to some maximum */
- currentMode->maxViewportY = (currentMode->imageHeight
- - currentMode->viewportHeight);
- (*num)++;
- }
-
- pMode = pMode->next;
- if (pMode == firstMode)
- break;
- }
-
- if (secondPitch) {
- secondPitch = 0;
- goto SECOND_PASS;
- }
-
- return modes;
-}
-
-Bool
-R128DGAInit(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- R128InfoPtr info = R128PTR(pScrn);
- DGAModePtr modes = NULL;
- int num = 0;
-
- /* 8 */
- modes = R128SetupDGAMode (pScrn, modes, &num, 8, 8,
- (pScrn->bitsPerPixel == 8),
- (pScrn->bitsPerPixel != 8) ? 0 : pScrn->displayWidth,
- 0, 0, 0, PseudoColor);
-
- /* 15 */
- modes = R128SetupDGAMode (pScrn, modes, &num, 16, 15,
- (pScrn->bitsPerPixel == 16),
- (pScrn->depth != 15) ? 0 : pScrn->displayWidth,
- 0x7c00, 0x03e0, 0x001f, TrueColor);
-
- modes = R128SetupDGAMode (pScrn, modes, &num, 16, 15,
- (pScrn->bitsPerPixel == 16),
- (pScrn->depth != 15) ? 0 : pScrn->displayWidth,
- 0x7c00, 0x03e0, 0x001f, DirectColor);
-
- /* 16 */
- modes = R128SetupDGAMode (pScrn, modes, &num, 16, 16,
- (pScrn->bitsPerPixel == 16),
- (pScrn->depth != 16) ? 0 : pScrn->displayWidth,
- 0xf800, 0x07e0, 0x001f, TrueColor);
-
- modes = R128SetupDGAMode (pScrn, modes, &num, 16, 16,
- (pScrn->bitsPerPixel == 16),
- (pScrn->depth != 16) ? 0 : pScrn->displayWidth,
- 0xf800, 0x07e0, 0x001f, DirectColor);
-
- /* 24 */
- modes = R128SetupDGAMode (pScrn, modes, &num, 24, 24,
- (pScrn->bitsPerPixel == 24),
- (pScrn->bitsPerPixel != 24) ? 0 : pScrn->displayWidth,
- 0xff0000, 0x00ff00, 0x0000ff, TrueColor);
-
- modes = R128SetupDGAMode (pScrn, modes, &num, 24, 24,
- (pScrn->bitsPerPixel == 24),
- (pScrn->bitsPerPixel != 24) ? 0 : pScrn->displayWidth,
- 0xff0000, 0x00ff00, 0x0000ff, DirectColor);
-
- /* 32 */
- modes = R128SetupDGAMode (pScrn, modes, &num, 32, 24,
- (pScrn->bitsPerPixel == 32),
- (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
- 0xff0000, 0x00ff00, 0x0000ff, TrueColor);
-
- modes = R128SetupDGAMode (pScrn, modes, &num, 32, 24,
- (pScrn->bitsPerPixel == 32),
- (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
- 0xff0000, 0x00ff00, 0x0000ff, DirectColor);
-
- info->numDGAModes = num;
- info->DGAModes = modes;
-
- info->DGAFuncs.OpenFramebuffer = R128_OpenFramebuffer;
- info->DGAFuncs.CloseFramebuffer = NULL;
- info->DGAFuncs.SetMode = R128_SetMode;
- info->DGAFuncs.SetViewport = R128_SetViewport;
- info->DGAFuncs.GetViewport = R128_GetViewport;
-
- info->DGAFuncs.Sync = NULL;
- info->DGAFuncs.FillRect = NULL;
- info->DGAFuncs.BlitRect = NULL;
- info->DGAFuncs.BlitTransRect = NULL;
-
-#ifdef HAVE_XAA_H
- if (info->accel) {
- info->DGAFuncs.Sync = info->accel->Sync;
- if (info->accel->SetupForSolidFill &&
- info->accel->SubsequentSolidFillRect)
- info->DGAFuncs.FillRect = R128_FillRect;
- if (info->accel->SetupForScreenToScreenCopy &&
- info->accel->SubsequentScreenToScreenCopy) {
- info->DGAFuncs.BlitRect = R128_BlitRect;
- info->DGAFuncs.BlitTransRect = R128_BlitTransRect;
- }
- }
-#endif
-
- return DGAInit(pScreen, &(info->DGAFuncs), modes, num);
-}
-
-
-static Bool
-R128_SetMode(
- ScrnInfoPtr pScrn,
- DGAModePtr pMode
-){
- static R128FBLayout SavedLayouts[MAXSCREENS];
- int indx = pScrn->pScreen->myNum;
- R128InfoPtr info = R128PTR(pScrn);
-
- if(!pMode) { /* restore the original mode */
- /* put the ScreenParameters back */
- if(info->DGAactive)
- memcpy(&info->CurrentLayout, &SavedLayouts[indx], sizeof(R128FBLayout));
-
- pScrn->currentMode = info->CurrentLayout.mode;
-
- pScrn->SwitchMode(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode));
-#ifdef R128DRI
- if (info->directRenderingEnabled) {
- R128CCE_STOP(pScrn, info);
- }
-#endif
- if (info->accelOn)
- R128EngineInit(pScrn);
-#ifdef R128DRI
- if (info->directRenderingEnabled) {
- R128CCE_START(pScrn, info);
- }
-#endif
- pScrn->AdjustFrame(ADJUST_FRAME_ARGS(pScrn, 0, 0));
- info->DGAactive = FALSE;
- } else {
- if(!info->DGAactive) { /* save the old parameters */
- memcpy(&SavedLayouts[indx], &info->CurrentLayout, sizeof(R128FBLayout));
- info->DGAactive = TRUE;
- }
-
- info->CurrentLayout.bitsPerPixel = pMode->bitsPerPixel;
- info->CurrentLayout.depth = pMode->depth;
- info->CurrentLayout.displayWidth = pMode->bytesPerScanline /
- (pMode->bitsPerPixel >> 3);
- info->CurrentLayout.pixel_bytes = pMode->bitsPerPixel / 8;
- info->CurrentLayout.pixel_code = (pMode->bitsPerPixel != 16
- ? pMode->bitsPerPixel
- : pMode->depth);
- /* R128ModeInit() will set the mode field */
-
- pScrn->SwitchMode(SWITCH_MODE_ARGS(pScrn, pMode->mode));
-
-#ifdef R128DRI
- if (info->directRenderingEnabled) {
- R128CCE_STOP(pScrn, info);
- }
-#endif
- if (info->accelOn)
- R128EngineInit(pScrn);
-#ifdef R128DRI
- if (info->directRenderingEnabled) {
- R128CCE_START(pScrn, info);
- }
-#endif
- }
-
- return TRUE;
-}
-
-
-
-static int
-R128_GetViewport(
- ScrnInfoPtr pScrn
-){
- R128InfoPtr info = R128PTR(pScrn);
-
- return info->DGAViewportStatus;
-}
-
-
-static void
-R128_SetViewport(
- ScrnInfoPtr pScrn,
- int x, int y,
- int flags
-){
- R128InfoPtr info = R128PTR(pScrn);
-
- pScrn->AdjustFrame(ADJUST_FRAME_ARGS(pScrn, x, y));
- info->DGAViewportStatus = 0; /* FIXME */
-}
-
-#ifdef HAVE_XAA_H
-static void
-R128_FillRect (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned long color
-){
- R128InfoPtr info = R128PTR(pScrn);
-
- (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0));
- (*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h);
-
- if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel)
- SET_SYNC_FLAG(info->accel);
-}
-
-static void
-R128_BlitRect(
- ScrnInfoPtr pScrn,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty
-){
- R128InfoPtr info = R128PTR(pScrn);
- int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
- int ydir = (srcy < dsty) ? -1 : 1;
-
- (*info->accel->SetupForScreenToScreenCopy)(
- pScrn, xdir, ydir, GXcopy, (CARD32)(~0), -1);
- (*info->accel->SubsequentScreenToScreenCopy)(
- pScrn, srcx, srcy, dstx, dsty, w, h);
-
- if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel)
- SET_SYNC_FLAG(info->accel);
-}
-
-
-static void
-R128_BlitTransRect(
- ScrnInfoPtr pScrn,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty,
- unsigned long color
-){
- R128InfoPtr info = R128PTR(pScrn);
- int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
- int ydir = (srcy < dsty) ? -1 : 1;
-
- info->XAAForceTransBlit = TRUE;
-
- (*info->accel->SetupForScreenToScreenCopy)(
- pScrn, xdir, ydir, GXcopy, (CARD32)(~0), color);
-
- info->XAAForceTransBlit = FALSE;
-
- (*info->accel->SubsequentScreenToScreenCopy)(
- pScrn, srcx, srcy, dstx, dsty, w, h);
-
- if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel)
- SET_SYNC_FLAG(info->accel);
-}
-#endif
-
-static Bool
-R128_OpenFramebuffer(
- ScrnInfoPtr pScrn,
- char **name,
- unsigned char **mem,
- int *size,
- int *offset,
- int *flags
-){
- R128InfoPtr info = R128PTR(pScrn);
-
- *name = NULL; /* no special device */
- *mem = (unsigned char*)info->LinearAddr;
- *size = info->FbMapSize;
- *offset = 0;
- *flags = /* DGA_NEED_ROOT */ 0; /* don't need root, just /dev/mem access */
-
- return TRUE;
-}
diff --git a/driver/xf86-video-r128/src/r128_dri.c b/driver/xf86-video-r128/src/r128_dri.c
index 67e8d1dd5..ed18fabcb 100644
--- a/driver/xf86-video-r128/src/r128_dri.c
+++ b/driver/xf86-video-r128/src/r128_dri.c
@@ -53,13 +53,11 @@
/* X and server generic header files */
#include "xf86.h"
-#include "xf86PciInfo.h"
#include "windowstr.h"
#include "shadowfb.h"
- /* GLX/DRI/DRM definitions */
+ /* DRI/DRM definitions */
#define _XF86DRI_SERVER_
-#include "GL/glxtokens.h"
#include "sarea.h"
static size_t r128_drm_page_size;
@@ -71,209 +69,6 @@ static void R128DRITransitionSingleToMulti3d(ScreenPtr pScreen);
static void R128DRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
-/* Initialize the visual configs that are supported by the hardware.
- These are combined with the visual configs that the indirect
- rendering core supports, and the intersection is exported to the
- client. */
-static Bool R128InitVisualConfigs(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- R128InfoPtr info = R128PTR(pScrn);
- int numConfigs = 0;
- __GLXvisualConfig *pConfigs = NULL;
- R128ConfigPrivPtr pR128Configs = NULL;
- R128ConfigPrivPtr *pR128ConfigPtrs = NULL;
- int i, accum, stencil, db;
-
- switch (info->CurrentLayout.pixel_code) {
- case 8: /* 8bpp mode is not support */
- case 15: /* FIXME */
- case 24: /* FIXME */
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[dri] R128DRIScreenInit failed (depth %d not supported). "
- "Disabling DRI.\n", info->CurrentLayout.pixel_code);
- return FALSE;
-
-#define R128_USE_ACCUM 1
-#define R128_USE_STENCIL 1
-#define R128_USE_DB 1
-
- case 16:
- numConfigs = 1;
- if (R128_USE_ACCUM) numConfigs *= 2;
- if (R128_USE_STENCIL) numConfigs *= 2;
- if (R128_USE_DB) numConfigs *= 2;
-
- if (!(pConfigs
- = (__GLXvisualConfig*)calloc(sizeof(__GLXvisualConfig),
- numConfigs))) {
- return FALSE;
- }
- if (!(pR128Configs
- = (R128ConfigPrivPtr)calloc(sizeof(R128ConfigPrivRec),
- numConfigs))) {
- free(pConfigs);
- return FALSE;
- }
- if (!(pR128ConfigPtrs
- = (R128ConfigPrivPtr*)calloc(sizeof(R128ConfigPrivPtr),
- numConfigs))) {
- free(pConfigs);
- free(pR128Configs);
- return FALSE;
- }
-
- i = 0;
- for (db = 0; db <= R128_USE_DB; db++) {
- for (accum = 0; accum <= R128_USE_ACCUM; accum++) {
- for (stencil = 0; stencil <= R128_USE_STENCIL; stencil++) {
- pR128ConfigPtrs[i] = &pR128Configs[i];
-
- pConfigs[i].vid = (VisualID)(-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 = 0x00000000;
- if (accum) { /* Simulated in software */
- 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;
- }
- if (db)
- pConfigs[i].doubleBuffer = TRUE;
- else
- pConfigs[i].doubleBuffer = FALSE;
- pConfigs[i].stereo = FALSE;
- pConfigs[i].bufferSize = 16;
- pConfigs[i].depthSize = 16;
- if (stencil)
- pConfigs[i].stencilSize = 8; /* Simulated in software */
- else
- pConfigs[i].stencilSize = 0;
- pConfigs[i].auxBuffers = 0;
- pConfigs[i].level = 0;
- if (accum || stencil) {
- pConfigs[i].visualRating = GLX_SLOW_CONFIG;
- } else {
- pConfigs[i].visualRating = GLX_NONE;
- }
- pConfigs[i].transparentPixel = GLX_NONE;
- pConfigs[i].transparentRed = 0;
- pConfigs[i].transparentGreen = 0;
- pConfigs[i].transparentBlue = 0;
- pConfigs[i].transparentAlpha = 0;
- pConfigs[i].transparentIndex = 0;
- i++;
- }
- }
- }
- break;
-
- case 32:
- numConfigs = 1;
- if (R128_USE_ACCUM) numConfigs *= 2;
- if (R128_USE_STENCIL) numConfigs *= 2;
- if (R128_USE_DB) numConfigs *= 2;
-
- if (!(pConfigs
- = (__GLXvisualConfig*)calloc(sizeof(__GLXvisualConfig),
- numConfigs))) {
- return FALSE;
- }
- if (!(pR128Configs
- = (R128ConfigPrivPtr)calloc(sizeof(R128ConfigPrivRec),
- numConfigs))) {
- free(pConfigs);
- return FALSE;
- }
- if (!(pR128ConfigPtrs
- = (R128ConfigPrivPtr*)calloc(sizeof(R128ConfigPrivPtr),
- numConfigs))) {
- free(pConfigs);
- free(pR128Configs);
- return FALSE;
- }
-
- i = 0;
- for (db = 0; db <= R128_USE_DB; db++) {
- for (accum = 0; accum <= R128_USE_ACCUM; accum++) {
- for (stencil = 0; stencil <= R128_USE_STENCIL; stencil++) {
- pR128ConfigPtrs[i] = &pR128Configs[i];
-
- pConfigs[i].vid = (VisualID)(-1);
- pConfigs[i].class = -1;
- pConfigs[i].rgba = TRUE;
- pConfigs[i].redSize = 8;
- pConfigs[i].greenSize = 8;
- pConfigs[i].blueSize = 8;
- pConfigs[i].alphaSize = 0;
- pConfigs[i].redMask = 0x00FF0000;
- pConfigs[i].greenMask = 0x0000FF00;
- pConfigs[i].blueMask = 0x000000FF;
- pConfigs[i].alphaMask = 0x00000000;
- if (accum) { /* Simulated in software */
- 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;
- }
- if (db)
- pConfigs[i].doubleBuffer = TRUE;
- else
- pConfigs[i].doubleBuffer = FALSE;
- pConfigs[i].stereo = FALSE;
- pConfigs[i].bufferSize = 24;
- if (stencil) {
- pConfigs[i].depthSize = 24;
- pConfigs[i].stencilSize = 8;
- } else {
- pConfigs[i].depthSize = 24;
- pConfigs[i].stencilSize = 0;
- }
- pConfigs[i].auxBuffers = 0;
- pConfigs[i].level = 0;
- if (accum) {
- pConfigs[i].visualRating = GLX_SLOW_CONFIG;
- } else {
- pConfigs[i].visualRating = GLX_NONE;
- }
- pConfigs[i].transparentPixel = GLX_NONE;
- pConfigs[i].transparentRed = 0;
- pConfigs[i].transparentGreen = 0;
- pConfigs[i].transparentBlue = 0;
- pConfigs[i].transparentAlpha = 0;
- pConfigs[i].transparentIndex = 0;
- i++;
- }
- }
- }
- break;
- }
-
- info->numVisualConfigs = numConfigs;
- info->pVisualConfigs = pConfigs;
- info->pVisualConfigsPriv = pR128Configs;
- GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pR128ConfigPtrs);
- return TRUE;
-}
-
/* Create the Rage 128-specific context information */
static Bool R128CreateContext(ScreenPtr pScreen, VisualPtr visual,
drm_context_t hwContext, void *pVisualConfigPriv,
@@ -309,7 +104,11 @@ static void R128EnterServer(ScreenPtr pScreen)
#endif
#ifdef USE_EXA
if (info->ExaDriver) exaMarkSync(pScreen);
- info->state_2d.composite_setup = FALSE;
+ /* EXA and DRI are fighting over control of the texture hardware.
+ * That means we need to setup compositing when the server wakes
+ * up if a 3D app is running.
+ */
+ if (info->have3DWindows) info->state_2d.composite_setup = FALSE;
#endif
}
@@ -394,7 +193,7 @@ static void R128DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx)
pboxSave = pbox = REGION_RECTS(prgn);
nboxSave = nbox = REGION_NUM_RECTS(prgn);
- (*info->accel->SetupForSolidFill)(pScrn, 0, GXcopy, (CARD32)(-1));
+ (*info->accel->SetupForSolidFill)(pScrn, 0, GXcopy, (uint32_t)(-1));
for (; nbox; nbox--, pbox++) {
(*info->accel->SubsequentSolidFillRect)(pScrn,
pbox->x1 + info->fbX,
@@ -412,7 +211,7 @@ static void R128DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx)
nbox = nboxSave;
/* FIXME: this needs to consider depth tiling. */
- (*info->accel->SetupForSolidFill)(pScrn, depth, GXcopy, (CARD32)(-1));
+ (*info->accel->SetupForSolidFill)(pScrn, depth, GXcopy, (uint32_t)(-1));
for (; nbox; nbox--, pbox++)
(*info->accel->SubsequentSolidFillRect)(pScrn,
pbox->x1 + info->depthX,
@@ -644,7 +443,7 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen)
static Bool R128DRIPciInit(R128InfoPtr info, ScreenPtr pScreen)
{
unsigned char *R128MMIO = info->MMIO;
- CARD32 chunk;
+ uint32_t chunk;
int ret;
int flags;
@@ -985,9 +784,8 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
int major, minor, patch;
drmVersionPtr version;
- /* Check that the GLX, DRI, and DRM modules have been loaded by testing
+ /* Check that the DRI, and DRM modules have been loaded by testing
* for known symbols in each module. */
- if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE;
if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE;
if (!xf86LoaderCheckSymbol("DRIQueryVersion")) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -1201,10 +999,6 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
/* FIXME: When are these mappings unmapped? */
- if (!R128InitVisualConfigs(pScreen)) {
- R128DRICloseScreen(pScreen);
- return FALSE;
- }
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Visual configs initialized\n");
return TRUE;
@@ -1367,14 +1161,6 @@ void R128DRICloseScreen(ScreenPtr pScreen)
DRIDestroyInfoRec(info->pDRIInfo);
info->pDRIInfo = NULL;
}
- if (info->pVisualConfigs) {
- free(info->pVisualConfigs);
- info->pVisualConfigs = NULL;
- }
- if (info->pVisualConfigsPriv) {
- free(info->pVisualConfigsPriv);
- info->pVisualConfigsPriv = NULL;
- }
}
/* Use callbacks from dri.c to support pageflipping mode for a single
@@ -1410,12 +1196,12 @@ static void R128DRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
if (!info->useEXA) {
(*info->accel->SetupForScreenToScreenCopy)(pScrn,
1, 1, GXcopy,
- (CARD32)(-1), -1);
+ (uint32_t)(-1), -1);
}
#endif
#ifdef USE_EXA
if (info->useEXA) {
- CARD32 src_pitch_offset, dst_pitch_offset, datatype;
+ uint32_t src_pitch_offset, dst_pitch_offset, datatype;
R128GetPixmapOffsetPitch(pPix, &src_pitch_offset);
dst_pitch_offset = src_pitch_offset + (info->backOffset >> 5);
@@ -1462,7 +1248,7 @@ static void R128EnablePageFlip(ScreenPtr pScreen)
if (!info->useEXA) {
(*info->accel->SetupForScreenToScreenCopy)(pScrn,
1, 1, GXcopy,
- (CARD32)(-1), -1);
+ (uint32_t)(-1), -1);
(*info->accel->SubsequentScreenToScreenCopy)(pScrn,
0,
@@ -1475,7 +1261,7 @@ static void R128EnablePageFlip(ScreenPtr pScreen)
#endif
#ifdef USE_EXA
if (info->useEXA) {
- CARD32 src_pitch_offset, dst_pitch_offset, datatype;
+ uint32_t src_pitch_offset, dst_pitch_offset, datatype;
R128GetPixmapOffsetPitch(pPix, &src_pitch_offset);
dst_pitch_offset = src_pitch_offset + (info->backOffset >> 5);
@@ -1522,9 +1308,6 @@ static void R128DRITransitionTo3d(ScreenPtr pScreen)
R128EnablePageFlip(pScreen);
info->have3DWindows = 1;
-
- if (info->cursor_start)
- xf86ForceHWCursor(pScreen, TRUE);
}
static void R128DRITransitionTo2d(ScreenPtr pScreen)
@@ -1547,7 +1330,4 @@ static void R128DRITransitionTo2d(ScreenPtr pScreen)
}
info->have3DWindows = 0;
-
- if (info->cursor_start)
- xf86ForceHWCursor(pScreen, FALSE);
}
diff --git a/driver/xf86-video-r128/src/r128_dripriv.h b/driver/xf86-video-r128/src/r128_dripriv.h
index 269bac968..f948adf01 100644
--- a/driver/xf86-video-r128/src/r128_dripriv.h
+++ b/driver/xf86-video-r128/src/r128_dripriv.h
@@ -37,18 +37,8 @@
#ifndef _R128_DRIPRIV_H_
#define _R128_DRIPRIV_H_
-#include "GL/glxint.h"
-
#define R128_MAX_DRAWABLES 256
-extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
- void **configprivs);
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} R128ConfigPrivRec, *R128ConfigPrivPtr;
-
typedef struct {
/* Nothing here yet */
int dummy;
diff --git a/driver/xf86-video-r128/src/r128_driver.c b/driver/xf86-video-r128/src/r128_driver.c
index 053a2456a..1b224241a 100644
--- a/driver/xf86-video-r128/src/r128_driver.c
+++ b/driver/xf86-video-r128/src/r128_driver.c
@@ -84,7 +84,7 @@
/* X and server generic header files */
#include "xf86.h"
#include "xf86_OSproc.h"
-#include "xf86PciInfo.h"
+#include "xf86RandR12.h"
#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
#include "xf86RAC.h"
#include "xf86Resources.h"
@@ -109,28 +109,22 @@
#endif
-#ifndef MAX
-#define MAX(a,b) ((a)>(b)?(a):(b))
-#endif
-
-#define USE_CRT_ONLY 0
-
- /* Forward definitions for driver functions */
static Bool R128CloseScreen(CLOSE_SCREEN_ARGS_DECL);
static Bool R128SaveScreen(ScreenPtr pScreen, int mode);
static void R128Save(ScrnInfoPtr pScrn);
static void R128Restore(ScrnInfoPtr pScrn);
-static Bool R128ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
-static void R128DisplayPowerManagementSet(ScrnInfoPtr pScrn,
- int PowerManagementMode, int flags);
-static void R128DisplayPowerManagementSetLCD(ScrnInfoPtr pScrn,
- int PowerManagementMode, int flags);
typedef enum {
OPTION_NOACCEL,
- OPTION_SW_CURSOR,
+ OPTION_FBDEV,
OPTION_DAC_6BIT,
- OPTION_DAC_8BIT,
+ OPTION_VGA_ACCESS,
+ OPTION_SHOW_CACHE,
+ OPTION_SW_CURSOR,
+ OPTION_VIDEO_KEY,
+ OPTION_PANEL_WIDTH,
+ OPTION_PANEL_HEIGHT,
+ OPTION_PROG_FP_REGS,
#ifdef R128DRI
OPTION_XV_DMA,
OPTION_IS_PCI,
@@ -143,27 +137,21 @@ typedef enum {
OPTION_BUFFER_SIZE,
OPTION_PAGE_FLIP,
#endif
-#if USE_CRT_ONLY
- /* FIXME: Disable CRTOnly until it is tested */
- OPTION_CRT,
-#endif
- OPTION_DISPLAY,
- OPTION_PANEL_WIDTH,
- OPTION_PANEL_HEIGHT,
- OPTION_PROG_FP_REGS,
- OPTION_FBDEV,
- OPTION_VIDEO_KEY,
- OPTION_SHOW_CACHE,
- OPTION_VGA_ACCESS,
OPTION_ACCELMETHOD,
OPTION_RENDERACCEL
} R128Opts;
static const OptionInfoRec R128Options[] = {
- { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_DAC_8BIT, "Dac8Bit", OPTV_BOOLEAN, {0}, TRUE },
+{ OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
+{ OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE },
+{ OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE },
+{ OPTION_VGA_ACCESS, "VGAAccess", OPTV_BOOLEAN, {0}, TRUE },
+{ OPTION_SHOW_CACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE },
+{ OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE },
+{ OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE },
+{ OPTION_PANEL_WIDTH, "PanelWidth", OPTV_INTEGER, {0}, FALSE },
+{ OPTION_PANEL_HEIGHT, "PanelHeight", OPTV_INTEGER, {0}, FALSE },
+{ OPTION_PROG_FP_REGS, "ProgramFPRegs", OPTV_BOOLEAN, {0}, FALSE },
#ifdef R128DRI
{ OPTION_XV_DMA, "DMAForXv", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_IS_PCI, "ForcePCIMode", OPTV_BOOLEAN, {0}, FALSE },
@@ -176,14 +164,6 @@ static const OptionInfoRec R128Options[] = {
{ OPTION_BUFFER_SIZE, "BufferSize", OPTV_INTEGER, {0}, FALSE },
{ OPTION_PAGE_FLIP, "EnablePageFlip", OPTV_BOOLEAN, {0}, FALSE },
#endif
- { OPTION_DISPLAY, "Display", OPTV_STRING, {0}, FALSE },
- { OPTION_PANEL_WIDTH, "PanelWidth", OPTV_INTEGER, {0}, FALSE },
- { OPTION_PANEL_HEIGHT, "PanelHeight", OPTV_INTEGER, {0}, FALSE },
- { OPTION_PROG_FP_REGS, "ProgramFPRegs", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE },
- { OPTION_SHOW_CACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_VGA_ACCESS, "VGAAccess", OPTV_BOOLEAN, {0}, TRUE },
{ OPTION_ACCELMETHOD, "AccelMethod", OPTV_STRING, {0}, FALSE },
{ OPTION_RENDERACCEL, "RenderAccel", OPTV_BOOLEAN, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
@@ -243,22 +223,13 @@ static Bool R128MapMMIO(ScrnInfoPtr pScrn)
if (info->FBDev) {
info->MMIO = fbdevHWMapMMIO(pScrn);
} else {
- /* If the primary screen has already mapped the MMIO region,
- use its pointer instead of mapping it a second time. */
- if (info->IsSecondary) {
- DevUnion* pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
- getR128EntityIndex());
- R128EntPtr pR128Ent = pPriv->ptr;
- R128InfoPtr info0 = R128PTR(pR128Ent->pPrimaryScrn);
- info->MMIO=info0->MMIO;
- if (info->MMIO) return TRUE;
- }
#ifndef XSERVER_LIBPCIACCESS
info->MMIO = xf86MapPciMem(pScrn->scrnIndex,
VIDMEM_MMIO | VIDMEM_READSIDEEFFECT,
info->PciTag,
info->MMIOAddr,
R128_MMIOSIZE);
+ if (!info->MMIO) return FALSE;
#else
int err = pci_device_map_range(info->PciInfo,
info->MMIOAddr,
@@ -275,7 +246,6 @@ static Bool R128MapMMIO(ScrnInfoPtr pScrn)
#endif
}
- if (!info->MMIO) return FALSE;
return TRUE;
}
@@ -403,78 +373,6 @@ void R128WaitForVerticalSync(ScrnInfoPtr pScrn)
}
}
-/* Blank screen. */
-static void R128Blank(ScrnInfoPtr pScrn)
-{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
-
- if(!info->IsSecondary)
- {
- switch(info->DisplayType)
- {
- case MT_LCD:
- OUTREGP(R128_LVDS_GEN_CNTL, R128_LVDS_DISPLAY_DIS,
- ~R128_LVDS_DISPLAY_DIS);
- break;
- case MT_CRT:
- OUTREGP(R128_CRTC_EXT_CNTL, R128_CRTC_DISPLAY_DIS, ~R128_CRTC_DISPLAY_DIS);
- break;
- case MT_DFP:
- OUTREGP(R128_FP_GEN_CNTL, R128_FP_BLANK_DIS, ~R128_FP_BLANK_DIS);
- break;
- case MT_NONE:
- default:
- break;
- }
- }
- else
- {
- OUTREGP(R128_CRTC2_GEN_CNTL, R128_CRTC2_DISP_DIS, ~R128_CRTC2_DISP_DIS);
- }
-}
-
-/* Unblank screen. */
-static void R128Unblank(ScrnInfoPtr pScrn)
-{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
-
- if(!info->IsSecondary)
- {
- switch(info->DisplayType)
- {
- case MT_LCD:
- OUTREGP(R128_LVDS_GEN_CNTL, 0,
- ~R128_LVDS_DISPLAY_DIS);
- break;
- case MT_CRT:
- OUTREGP(R128_CRTC_EXT_CNTL, 0, ~R128_CRTC_DISPLAY_DIS);
- break;
- case MT_DFP:
- OUTREGP(R128_FP_GEN_CNTL, 0, ~R128_FP_BLANK_DIS);
- break;
- case MT_NONE:
- default:
- break;
- }
- }
- else
- {
- switch(info->DisplayType)
- {
- case MT_LCD:
- case MT_DFP:
- case MT_CRT:
- OUTREGP(R128_CRTC2_GEN_CNTL, 0, ~R128_CRTC2_DISP_DIS);
- break;
- case MT_NONE:
- default:
- break;
- }
- }
-}
-
/* Compute log base 2 of val. */
int R128MinBits(int val)
{
@@ -485,26 +383,26 @@ int R128MinBits(int val)
return bits;
}
-/* Compute n/d with rounding. */
-static int R128Div(int n, int d)
+/* Finds the first output using a given crtc. */
+xf86OutputPtr R128FirstOutput(xf86CrtcPtr crtc)
{
- return (n + (d / 2)) / d;
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86OutputPtr output = xf86_config->output[0];
+ int o;
+
+ for (o = 0; o < xf86_config->num_output; o++) {
+ output = xf86_config->output[o];
+ if (output->crtc == crtc) break;
+ }
+
+ return output;
}
-/* Read the Video BIOS block and the FP registers (if applicable). */
+/* Read the Video BIOS block. */
static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
{
R128InfoPtr info = R128PTR(pScrn);
- int i;
- int FPHeader = 0;
-
-#define R128_BIOS8(v) (info->VBIOS[v])
-#define R128_BIOS16(v) (info->VBIOS[v] | \
- (info->VBIOS[(v) + 1] << 8))
-#define R128_BIOS32(v) (info->VBIOS[v] | \
- (info->VBIOS[(v) + 1] << 8) | \
- (info->VBIOS[(v) + 2] << 16) | \
- (info->VBIOS[(v) + 3] << 24))
#ifdef XSERVER_LIBPCIACCESS
int size = info->PciInfo->rom_size > R128_VBIOS_SIZE ? info->PciInfo->rom_size : R128_VBIOS_SIZE;
@@ -549,150 +447,104 @@ static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
"Video BIOS not found!\n");
}
- if(info->HasCRTC2)
- {
- if(info->IsSecondary)
- {
- /* there may be a way to detect this, for now, just assume
- second head is CRT */
- info->DisplayType = MT_CRT;
-
- if(info->DisplayType > MT_NONE)
- {
- DevUnion* pPriv;
- R128EntPtr pR128Ent;
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
- getR128EntityIndex());
- pR128Ent = pPriv->ptr;
- pR128Ent->HasSecondary = TRUE;
-
- }
- else return FALSE;
-
- }
- else
- {
- /* really need some sort of detection here */
- if (info->HasPanelRegs) {
- info->DisplayType = MT_LCD;
- } else if (info->isDFP) {
- info->DisplayType = MT_DFP;
- } else
- {
- /*DVI port has no monitor connected, try CRT port.
- If something on CRT port, treat it as primary*/
- if(xf86IsEntityShared(pScrn->entityList[0]))
- {
- DevUnion* pPriv;
- R128EntPtr pR128Ent;
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
- getR128EntityIndex());
- pR128Ent = pPriv->ptr;
- pR128Ent->BypassSecondary = TRUE;
- }
-
- info->DisplayType = MT_CRT;
-#if 0
- {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "No monitor detected!!!\n");
- return FALSE;
- }
-#endif
- }
- }
- }
- else
- {
- /*Regular Radeon ASIC, only one CRTC, but it could be
- used for DFP with a DVI output, like AIW board*/
- if(info->isDFP) info->DisplayType = MT_DFP;
- else info->DisplayType = MT_CRT;
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s Display == Type %d\n",
- (info->IsSecondary ? "Secondary" : "Primary"),
- info->DisplayType);
-
-
- if (info->VBIOS && info->DisplayType == MT_LCD) {
- info->FPBIOSstart = 0;
-
- /* FIXME: There should be direct access to the start of the FP info
- tables, but until we find out where that offset is stored, we
- must search for the ATI signature string: "M3 ". */
- for (i = 4; i < R128_VBIOS_SIZE-8; i++) {
- if (R128_BIOS8(i) == 'M' &&
- R128_BIOS8(i+1) == '3' &&
- R128_BIOS8(i+2) == ' ' &&
- R128_BIOS8(i+3) == ' ' &&
- R128_BIOS8(i+4) == ' ' &&
- R128_BIOS8(i+5) == ' ' &&
- R128_BIOS8(i+6) == ' ' &&
- R128_BIOS8(i+7) == ' ') {
- FPHeader = i-2;
- break;
- }
- }
+ return TRUE;
+}
- if (!FPHeader) return TRUE;
+/* Read the FP parameters if an LVDS panel is expected. */
+void R128GetPanelInfoFromBIOS(xf86OutputPtr output)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128OutputPrivatePtr r128_output = output->driver_private;
+ int FPHeader = 0;
+ int i;
- /* Assume that only one panel is attached and supported */
- for (i = FPHeader+20; i < FPHeader+84; i += 2) {
- if (R128_BIOS16(i) != 0) {
- info->FPBIOSstart = R128_BIOS16(i);
- break;
- }
- }
- if (!info->FPBIOSstart) return TRUE;
-
- if (!info->PanelXRes)
- info->PanelXRes = R128_BIOS16(info->FPBIOSstart+25);
- if (!info->PanelYRes)
- info->PanelYRes = R128_BIOS16(info->FPBIOSstart+27);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel size: %dx%d\n",
- info->PanelXRes, info->PanelYRes);
-
- info->PanelPwrDly = R128_BIOS8(info->FPBIOSstart+56);
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel ID: ");
- for (i = 1; i <= 24; i++)
- ErrorF("%c", R128_BIOS8(info->FPBIOSstart+i));
- ErrorF("\n");
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Type: ");
- i = R128_BIOS16(info->FPBIOSstart+29);
- if (i & 1) ErrorF("Color, ");
- else ErrorF("Monochrome, ");
- if (i & 2) ErrorF("Dual(split), ");
- else ErrorF("Single, ");
- switch ((i >> 2) & 0x3f) {
- case 0: ErrorF("STN"); break;
- case 1: ErrorF("TFT"); break;
- case 2: ErrorF("Active STN"); break;
- case 3: ErrorF("EL"); break;
- case 4: ErrorF("Plasma"); break;
- default: ErrorF("UNKNOWN"); break;
- }
- ErrorF("\n");
- if (R128_BIOS8(info->FPBIOSstart+61) & 1) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Interface: LVDS\n");
- } else {
- /* FIXME: Add Non-LVDS flat pael support */
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Non-LVDS panel interface detected! "
- "This support is untested and may not "
- "function properly\n");
- }
+ r128_output->PanelPwrDly = 200;
+ xf86GetOptValInteger(info->Options, OPTION_PANEL_WIDTH, &(r128_output->PanelXRes));
+ xf86GetOptValInteger(info->Options, OPTION_PANEL_HEIGHT, &(r128_output->PanelYRes));
+
+ if (!info->VBIOS) return;
+ info->FPBIOSstart = 0;
+
+ /* FIXME: There should be direct access to the start of the FP info
+ * tables, but until we find out where that offset is stored, we
+ * must search for the ATI signature string: "M3 ".
+ */
+ for (i = 4; i < R128_VBIOS_SIZE - 8; i++) {
+ if (R128_BIOS8(i) == 'M' &&
+ R128_BIOS8(i + 1) == '3' &&
+ R128_BIOS8(i + 2) == ' ' &&
+ R128_BIOS8(i + 3) == ' ' &&
+ R128_BIOS8(i + 4) == ' ' &&
+ R128_BIOS8(i + 5) == ' ' &&
+ R128_BIOS8(i + 6) == ' ' &&
+ R128_BIOS8(i + 7) == ' ') {
+ FPHeader = i - 2;
+ break;
+ }
+ }
+
+ if (!FPHeader) return;
+
+ /* Assume that only one panel is attached and supported */
+ for (i = FPHeader + 20; i < FPHeader + 84; i += 2) {
+ if (R128_BIOS16(i) != 0) {
+ info->FPBIOSstart = R128_BIOS16(i);
+ break;
+ }
}
- if (!info->PanelXRes || !info->PanelYRes) {
+ if (!info->FPBIOSstart) return;
+
+ if (!r128_output->PanelXRes)
+ r128_output->PanelXRes = R128_BIOS16(info->FPBIOSstart + 25);
+ if (!r128_output->PanelYRes)
+ r128_output->PanelYRes = R128_BIOS16(info->FPBIOSstart + 27);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel size: %dx%d\n",
+ r128_output->PanelXRes, r128_output->PanelYRes);
+
+ r128_output->PanelPwrDly = R128_BIOS8(info->FPBIOSstart + 56);
+
+ if (!r128_output->PanelXRes || !r128_output->PanelYRes) {
info->HasPanelRegs = FALSE;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Can't determine panel dimensions, and none specified.\n"
"\tDisabling programming of FP registers.\n");
}
- return TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel ID: ");
+ for (i = 1; i <= 24; i++)
+ ErrorF("%c", R128_BIOS8(info->FPBIOSstart + i));
+
+ ErrorF("\n");
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Type: ");
+ i = R128_BIOS16(info->FPBIOSstart + 29);
+ if (i & 1) ErrorF("Color, ");
+ else ErrorF("Monochrome, ");
+ if (i & 2) ErrorF("Dual(split), ");
+ else ErrorF("Single, ");
+
+ switch ((i >> 2) & 0x3f) {
+ case 0: ErrorF("STN"); break;
+ case 1: ErrorF("TFT"); break;
+ case 2: ErrorF("Active STN"); break;
+ case 3: ErrorF("EL"); break;
+ case 4: ErrorF("Plasma"); break;
+ default: ErrorF("UNKNOWN"); break;
+ }
+
+ ErrorF("\n");
+
+ if (R128_BIOS8(info->FPBIOSstart + 61) & 1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Interface: LVDS\n");
+ } else {
+ /* FIXME: Add Non-LVDS flat pael support */
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Non-LVDS panel interface detected! "
+ "This support is untested and may not "
+ "function properly\n");
+ }
}
/* Read PLL parameters from BIOS block. Default to typical values if there
@@ -718,15 +570,10 @@ static Bool R128GetPLLParameters(ScrnInfoPtr pScrn)
pll->min_pll_freq = 12500;
pll->max_pll_freq = 25000;
- /* need to memory map the io to use INPLL since it
- has not been done yet at this point in the startup */
- R128MapMMIO(pScrn);
x_mpll_ref_fb_div = INPLL(pScrn, R128_X_MPLL_REF_FB_DIV);
xclk_cntl = INPLL(pScrn, R128_XCLK_CNTL) & 0x7;
pll->reference_div =
INPLL(pScrn,R128_PPLL_REF_DIV) & R128_PPLL_REF_DIV_MASK;
- /* unmap it again */
- R128UnmapMMIO(pScrn);
Nx = (x_mpll_ref_fb_div & 0x00FF00) >> 8;
M = (x_mpll_ref_fb_div & 0x0000FF);
@@ -749,10 +596,11 @@ static Bool R128GetPLLParameters(ScrnInfoPtr pScrn)
pll->max_pll_freq = 25000;
pll->xclk = 10300;
} else {
- CARD16 bios_header = R128_BIOS16(0x48);
- CARD16 pll_info_block = R128_BIOS16(bios_header + 0x30);
- R128TRACE(("Header at 0x%04x; PLL Information at 0x%04x\n",
- bios_header, pll_info_block));
+ uint16_t bios_header = R128_BIOS16(0x48);
+ uint16_t pll_info_block = R128_BIOS16(bios_header + 0x30);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Header at 0x%04x; PLL Information at 0x%04x\n",
+ bios_header, pll_info_block));
pll->reference_freq = R128_BIOS16(pll_info_block + 0x0e);
pll->reference_div = R128_BIOS16(pll_info_block + 0x10);
@@ -776,8 +624,6 @@ static Bool R128GetPLLParameters(ScrnInfoPtr pScrn)
/* This is called by R128PreInit to set up the default visual. */
static Bool R128PreInitVisual(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
-
if (!xf86SetDepthBpp(pScrn, 0, 0, 0, (Support24bppFb
| Support32bppFb
| SupportConvert32to24
@@ -799,23 +645,6 @@ static Bool R128PreInitVisual(ScrnInfoPtr pScrn)
xf86PrintDepthBpp(pScrn);
- info->fifo_slots = 0;
- info->pix24bpp = xf86GetBppFromDepth(pScrn, pScrn->depth);
- info->CurrentLayout.bitsPerPixel = pScrn->bitsPerPixel;
- info->CurrentLayout.depth = pScrn->depth;
- info->CurrentLayout.pixel_bytes = pScrn->bitsPerPixel / 8;
- info->CurrentLayout.pixel_code = (pScrn->bitsPerPixel != 16
- ? pScrn->bitsPerPixel
- : pScrn->depth);
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Pixel depth = %d bits stored in %d byte%s (%d bpp pixmaps)\n",
- pScrn->depth,
- info->CurrentLayout.pixel_bytes,
- info->CurrentLayout.pixel_bytes > 1 ? "s" : "",
- info->pix24bpp);
-
-
if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE;
if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) {
@@ -832,29 +661,33 @@ static Bool R128PreInitVisual(ScrnInfoPtr pScrn)
static Bool R128PreInitWeight(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
+ rgb defaultWeight = { 0, 0, 0 };
- /* Save flag for 6 bit DAC to use for
- setting CRTC registers. Otherwise use
- an 8 bit DAC, even if xf86SetWeight sets
- pScrn->rgbBits to some value other than
- 8. */
- info->dac6bits = FALSE;
- if (pScrn->depth > 8) {
- rgb defaultWeight = { 0, 0, 0 };
- if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE;
+ /*
+ * Save flag for 6 bit DAC to use for setting CRTC registers.
+ * Otherwise use an 8 bit DAC, even if xf86SetWeight sets
+ * pScrn->rgbBits to some value other than 8.
+ */
+ if (pScrn->depth <= 8) {
+ if (info->dac6bits) {
+ pScrn->rgbBits = 6;
+ } else {
+ pScrn->rgbBits = 8;
+ }
} else {
- pScrn->rgbBits = 8;
- if (xf86ReturnOptValBool(info->Options, OPTION_DAC_6BIT, FALSE)) {
- pScrn->rgbBits = 6;
- info->dac6bits = TRUE;
- }
+ info->dac6bits = FALSE;
+ pScrn->rgbBits = 8;
}
+
+ if (pScrn->depth > 8) {
+ if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE;
+ }
+
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using %d bits per RGB (%d bit DAC)\n",
- pScrn->rgbBits, info->dac6bits ? 6 : 8);
+ "Using %d bits per RGB (%d bit DAC)\n",
+ pScrn->rgbBits, info->dac6bits ? 6 : 8);
return TRUE;
-
}
/* This is called by R128PreInit to handle config file overrides for things
@@ -863,6 +696,7 @@ static Bool R128PreInitWeight(ScrnInfoPtr pScrn)
static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
unsigned char *R128MMIO = info->MMIO;
EntityInfoPtr pEnt = info->pEnt;
GDevPtr dev = pEnt->device;
@@ -957,7 +791,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
} else {
info->isDFP = FALSE;
info->isPro2 = FALSE;
- info->HasCRTC2 = FALSE;
+ pR128Ent->HasCRTC2 = FALSE;
switch (info->Chipset) {
/* R128 Pro and Pro2 can have DFP, we will deal with it.
No support for dual-head/xinerama yet.
@@ -1010,7 +844,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
case PCI_CHIP_RAGE128ML:
info->HasPanelRegs = TRUE;
/* which chips support dualhead? */
- info->HasCRTC2 = TRUE;
+ pR128Ent->HasCRTC2 = TRUE;
break;
case PCI_CHIP_RAGE128RE:
case PCI_CHIP_RAGE128RF:
@@ -1036,7 +870,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
/* Read registers used to determine options */
from = X_PROBED;
- R128MapMMIO(pScrn);
+ if (!R128MapMMIO(pScrn)) return FALSE;
R128MMIO = info->MMIO;
if (info->FBDev)
@@ -1047,42 +881,6 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
info->MemCntl = INREG(R128_MEM_CNTL);
info->BusCntl = INREG(R128_BUS_CNTL);
- /* On non-flat panel systems, the default is to display to the CRT,
- and on flat panel systems, the default is to display to the flat
- panel unless the user explicity chooses otherwise using the "Display"
- config file setting. BIOS_5_SCRATCH holds the display device on flat
- panel systems only. */
- if (info->HasPanelRegs) {
- char *Display = xf86GetOptValString(info->Options, OPTION_DISPLAY);
-
- if (info->FBDev)
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Option \"Display\" ignored "
- "(framebuffer device determines display type)\n");
- else if (info->IsPrimary || info->IsSecondary)
- info->BIOSDisplay = R128_DUALHEAD;
- else if (!Display || !xf86NameCmp(Display, "FP"))
- info->BIOSDisplay = R128_BIOS_DISPLAY_FP;
- else if (!xf86NameCmp(Display, "BIOS"))
- info->BIOSDisplay = INREG8(R128_BIOS_5_SCRATCH);
- else if (!xf86NameCmp(Display, "Mirror"))
- info->BIOSDisplay = R128_BIOS_DISPLAY_FP_CRT;
- else if (!xf86NameCmp(Display, "CRT"))
- info->BIOSDisplay = R128_BIOS_DISPLAY_CRT;
- else {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Unsupported type \"%s\" specified for Option \"Display\".\n"
- "\tSupported types are: "
- "\"BIOS\", \"Mirror\", \"CRT\" and \"FP\"\n", Display);
- return FALSE;
- }
- } else {
- info->BIOSDisplay = R128_BIOS_DISPLAY_CRT;
- }
-
- R128MMIO = NULL;
- R128UnmapMMIO(pScrn);
-
/* RAM */
switch (info->MemCntl & 0x3) {
case 0: /* SDR SGRAM 1:1 */
@@ -1121,75 +919,12 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, from,
"VideoRAM: %d kByte (%s)\n", pScrn->videoRam, info->ram->name);
- if (info->IsPrimary) {
- pScrn->videoRam /= 2;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using %dk of videoram for primary head\n",
- pScrn->videoRam);
- }
-
- if (info->IsSecondary) {
- pScrn->videoRam /= 2;
- info->LinearAddr += pScrn->videoRam * 1024;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using %dk of videoram for secondary head\n",
- pScrn->videoRam);
- }
-
pScrn->videoRam &= ~1023;
info->FbMapSize = pScrn->videoRam * 1024;
-
- /* Flat panel (part 2) */
- switch (info->BIOSDisplay) {
- case R128_DUALHEAD:
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Dual display\n");
- break;
- case R128_BIOS_DISPLAY_FP:
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Using flat panel for display\n");
- break;
- case R128_BIOS_DISPLAY_CRT:
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Using external CRT for display\n");
- break;
- case R128_BIOS_DISPLAY_FP_CRT:
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Using both flat panel and external CRT "
- "for display\n");
- break;
- }
-
- if (info->HasPanelRegs) {
- /* Panel width/height overrides */
- info->PanelXRes = 0;
- info->PanelYRes = 0;
- if (xf86GetOptValInteger(info->Options,
- OPTION_PANEL_WIDTH, &(info->PanelXRes))) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Flat panel width: %d\n", info->PanelXRes);
- }
- if (xf86GetOptValInteger(info->Options,
- OPTION_PANEL_HEIGHT, &(info->PanelYRes))) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Flat panel height: %d\n", info->PanelYRes);
- }
- }
-
#ifdef R128DRI
- /* DMA for Xv */
- info->DMAForXv = xf86ReturnOptValBool(info->Options, OPTION_XV_DMA, FALSE);
- if (info->DMAForXv) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Will try to use DMA for Xv image transfers\n");
- }
-
- /* AGP/PCI */
- if (xf86ReturnOptValBool(info->Options, OPTION_IS_PCI, FALSE)) {
- info->IsPCI = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forced into PCI-only mode\n");
- } else {
+ /* AGP/PCI */
+ if (!info->IsPCI) {
switch (info->Chipset) {
case PCI_CHIP_RAGE128LE:
case PCI_CHIP_RAGE128RE:
@@ -1257,6 +992,7 @@ static Bool R128PreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
#endif
if (!xf86LoadSubModule(pScrn, "ddc")) return FALSE;
+ if (!xf86LoadSubModule(pScrn, "i2c")) return FALSE;
#if defined(__powerpc__) || defined(__alpha__) || defined(__sparc__)
/* Int10 is broken on PPC and some Alphas */
@@ -1282,474 +1018,12 @@ static Bool R128PreInitGamma(ScrnInfoPtr pScrn)
return TRUE;
}
-static void
-R128I2CGetBits(I2CBusPtr b, int *Clock, int *data)
-{
- ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex];
- R128InfoPtr info = R128PTR(pScrn);
- unsigned long val;
- unsigned char *R128MMIO = info->MMIO;
-
- /* Get the result. */
- val = INREG(info->DDCReg);
- *Clock = (val & R128_GPIO_MONID_Y_3) != 0;
- *data = (val & R128_GPIO_MONID_Y_0) != 0;
-
-}
-
-static void
-R128I2CPutBits(I2CBusPtr b, int Clock, int data)
-{
- ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex];
- R128InfoPtr info = R128PTR(pScrn);
- unsigned long val;
- unsigned char *R128MMIO = info->MMIO;
-
- val = INREG(info->DDCReg)
- & ~(CARD32)(R128_GPIO_MONID_EN_0 | R128_GPIO_MONID_EN_3);
- val |= (Clock ? 0:R128_GPIO_MONID_EN_3);
- val |= (data ? 0:R128_GPIO_MONID_EN_0);
- OUTREG(info->DDCReg, val);
-}
-
-
-static Bool
-R128I2cInit(ScrnInfoPtr pScrn)
-{
- R128InfoPtr info = R128PTR(pScrn);
- if ( !xf86LoadSubModule(pScrn, "i2c") ) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to load i2c module\n");
- return FALSE;
- }
-
- info->pI2CBus = xf86CreateI2CBusRec();
- if(!info->pI2CBus) return FALSE;
-
- info->pI2CBus->BusName = "DDC";
- info->pI2CBus->scrnIndex = pScrn->scrnIndex;
- info->DDCReg = R128_GPIO_MONID;
- info->pI2CBus->I2CPutBits = R128I2CPutBits;
- info->pI2CBus->I2CGetBits = R128I2CGetBits;
- info->pI2CBus->AcknTimeout = 5;
-
- if (!xf86I2CBusInit(info->pI2CBus)) {
- return FALSE;
- }
- return TRUE;
-}
-
-/* return TRUE is a DFP is indeed connected to a DVI port */
-static Bool R128GetDFPInfo(ScrnInfoPtr pScrn)
-{
- R128InfoPtr info = R128PTR(pScrn);
- int i;
- xf86MonPtr MonInfo = NULL;
- xf86MonPtr ddc;
- unsigned char *R128MMIO = info->MMIO;
-
- if(!R128I2cInit(pScrn)){
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "I2C initialization failed!\n");
- }
-
- OUTREG(info->DDCReg, (INREG(info->DDCReg)
- | R128_GPIO_MONID_MASK_0 | R128_GPIO_MONID_MASK_3));
-
- OUTREG(info->DDCReg, INREG(info->DDCReg)
- & ~(CARD32)(R128_GPIO_MONID_A_0 | R128_GPIO_MONID_A_3));
-
- MonInfo = xf86DoEDID_DDC2(XF86_SCRN_ARG(pScrn), info->pI2CBus);
- if(!MonInfo) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "No DFP detected\n");
- return FALSE;
- }
- xf86SetDDCproperties(pScrn, MonInfo);
- ddc = pScrn->monitor->DDC;
-
- for(i=0; i<4; i++)
- {
- if((ddc->det_mon[i].type == 0) &&
- (ddc->det_mon[i].section.d_timings.h_active > 0) &&
- (ddc->det_mon[i].section.d_timings.v_active > 0))
- {
- info->PanelXRes =
- ddc->det_mon[i].section.d_timings.h_active;
- info->PanelYRes =
- ddc->det_mon[i].section.d_timings.v_active;
-
- info->HOverPlus =
- ddc->det_mon[i].section.d_timings.h_sync_off;
- info->HSyncWidth =
- ddc->det_mon[i].section.d_timings.h_sync_width;
- info->HBlank =
- ddc->det_mon[i].section.d_timings.h_blanking;
- info->VOverPlus =
- ddc->det_mon[i].section.d_timings.v_sync_off;
- info->VSyncWidth =
- ddc->det_mon[i].section.d_timings.v_sync_width;
- info->VBlank =
- ddc->det_mon[i].section.d_timings.v_blanking;
- }
- }
- return TRUE;
-}
-
-
-static void R128SetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag)
-{
- int i;
- xf86MonPtr ddc = pScrn->monitor->DDC;
- if(flag) /*HSync*/
- {
- for(i=0; i<4; i++)
- {
- if(ddc->det_mon[i].type == DS_RANGES)
- {
- pScrn->monitor->nHsync = 1;
- pScrn->monitor->hsync[0].lo =
- ddc->det_mon[i].section.ranges.min_h;
- pScrn->monitor->hsync[0].hi =
- ddc->det_mon[i].section.ranges.max_h;
- return;
- }
- }
- /*if no sync ranges detected in detailed timing table,
- let's try to derive them from supported VESA modes
- Are we doing too much here!!!?
- **/
- i = 0;
- if(ddc->timings1.t1 & 0x02) /*800x600@56*/
- {
- pScrn->monitor->hsync[i].lo =
- pScrn->monitor->hsync[i].hi = 35.2;
- i++;
- }
- if(ddc->timings1.t1 & 0x04) /*640x480@75*/
- {
- pScrn->monitor->hsync[i].lo =
- pScrn->monitor->hsync[i].hi = 37.5;
- i++;
- }
- if((ddc->timings1.t1 & 0x08) || (ddc->timings1.t1 & 0x01))
- {
- pScrn->monitor->hsync[i].lo =
- pScrn->monitor->hsync[i].hi = 37.9;
- i++;
- }
- if(ddc->timings1.t2 & 0x40)
- {
- pScrn->monitor->hsync[i].lo =
- pScrn->monitor->hsync[i].hi = 46.9;
- i++;
- }
- if((ddc->timings1.t2 & 0x80) || (ddc->timings1.t2 & 0x08))
- {
- pScrn->monitor->hsync[i].lo =
- pScrn->monitor->hsync[i].hi = 48.1;
- i++;
- }
- if(ddc->timings1.t2 & 0x04)
- {
- pScrn->monitor->hsync[i].lo =
- pScrn->monitor->hsync[i].hi = 56.5;
- i++;
- }
- if(ddc->timings1.t2 & 0x02)
- {
- pScrn->monitor->hsync[i].lo =
- pScrn->monitor->hsync[i].hi = 60.0;
- i++;
- }
- if(ddc->timings1.t2 & 0x01)
- {
- pScrn->monitor->hsync[i].lo =
- pScrn->monitor->hsync[i].hi = 64.0;
- i++;
- }
- pScrn->monitor->nHsync = i;
- }
- else /*Vrefresh*/
- {
- for(i=0; i<4; i++)
- {
- if(ddc->det_mon[i].type == DS_RANGES)
- {
- pScrn->monitor->nVrefresh = 1;
- pScrn->monitor->vrefresh[0].lo =
- ddc->det_mon[i].section.ranges.min_v;
- pScrn->monitor->vrefresh[0].hi =
- ddc->det_mon[i].section.ranges.max_v;
- return;
- }
- }
- i = 0;
- if(ddc->timings1.t1 & 0x02) /*800x600@56*/
- {
- pScrn->monitor->vrefresh[i].lo =
- pScrn->monitor->vrefresh[i].hi = 56;
- i++;
- }
- if((ddc->timings1.t1 & 0x01) || (ddc->timings1.t2 & 0x08))
- {
- pScrn->monitor->vrefresh[i].lo =
- pScrn->monitor->vrefresh[i].hi = 60;
- i++;
- }
- if(ddc->timings1.t2 & 0x04)
- {
- pScrn->monitor->vrefresh[i].lo =
- pScrn->monitor->vrefresh[i].hi = 70;
- i++;
- }
- if((ddc->timings1.t1 & 0x08) || (ddc->timings1.t2 & 0x80))
- {
- pScrn->monitor->vrefresh[i].lo =
- pScrn->monitor->vrefresh[i].hi = 72;
- i++;
- }
- if((ddc->timings1.t1 & 0x04) || (ddc->timings1.t2 & 0x40)
- || (ddc->timings1.t2 & 0x02) || (ddc->timings1.t2 & 0x01))
- {
- pScrn->monitor->vrefresh[i].lo =
- pScrn->monitor->vrefresh[i].hi = 75;
- i++;
- }
- pScrn->monitor->nVrefresh = i;
- }
-}
-
-/***********
- free's xf86ValidateModes routine deosn't work well with DFPs
- here is our own validation routine. All modes between
- 640<=XRes<=MaxRes and 480<=YRes<=MaxYRes will be permitted.
- NOTE: RageProII doesn't support rmx, can only work with the
- standard modes the monitor can support (scale).
-************/
-
-static int R128ValidateFPModes(ScrnInfoPtr pScrn)
-{
- int i, j, count=0, width, height;
- R128InfoPtr info = R128PTR(pScrn);
- DisplayModePtr last = NULL, new = NULL, first = NULL;
- xf86MonPtr ddc;
-
- /* Free any allocated modes during configuration. We don't need them*/
- while (pScrn->modes)
- {
- xf86DeleteMode(&pScrn->modes, pScrn->modes);
- }
- while (pScrn->modePool)
- {
- xf86DeleteMode(&pScrn->modePool, pScrn->modePool);
- }
-
- pScrn->virtualX = pScrn->display->virtualX;
- pScrn->virtualY = pScrn->display->virtualY;
-
- /* If no mode specified in config, we use native resolution*/
- if(!pScrn->display->modes[0])
- {
- pScrn->display->modes[0] = xnfalloc(16);
- sprintf(pScrn->display->modes[0], "%dx%d",
- info->PanelXRes, info->PanelYRes);
- }
-
- for(i=0; pScrn->display->modes[i] != NULL; i++)
- {
- if (sscanf(pScrn->display->modes[i], "%dx%d", &width, &height) == 2)
- {
-
- if(width < 640 || width > info->PanelXRes ||
- height < 480 || height > info->PanelYRes)
- {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Mode %s is out of range.\n"
- "Valid mode should be between 640x480-%dx%d\n",
- pScrn->display->modes[i], info->PanelXRes, info->PanelYRes);
- continue;
- }
-
- new = xnfcalloc(1, sizeof(DisplayModeRec));
- new->prev = last;
- new->name = xnfalloc(strlen(pScrn->display->modes[i]) + 1);
- strcpy(new->name, pScrn->display->modes[i]);
- new->HDisplay = new->CrtcHDisplay = width;
- new->VDisplay = new->CrtcVDisplay = height;
-
- ddc = pScrn->monitor->DDC;
- for(j=0; j<DET_TIMINGS; j++)
- {
- /*We use native mode clock only*/
- if(ddc->det_mon[j].type == 0){
- new->Clock = ddc->det_mon[j].section.d_timings.clock / 1000;
- break;
- }
- }
-
- if(new->prev) new->prev->next = new;
- last = new;
- if(!first) first = new;
- pScrn->display->virtualX =
- pScrn->virtualX = MAX(pScrn->virtualX, width);
- pScrn->display->virtualY =
- pScrn->virtualY = MAX(pScrn->virtualY, height);
- count++;
- }
- else
- {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Mode name %s is invalid\n", pScrn->display->modes[i]);
- continue;
- }
- }
-
- if(last)
- {
- last->next = first;
- first->prev = last;
- pScrn->modes = first;
-
- /*FIXME: May need to validate line pitch here*/
- {
- int dummy = 0;
- switch(pScrn->depth / 8)
- {
- case 1:
- dummy = 128 - pScrn->virtualX % 128;
- break;
- case 2:
- dummy = 32 - pScrn->virtualX % 32;
- break;
- case 3:
- case 4:
- dummy = 16 - pScrn->virtualX % 16;
- }
- pScrn->displayWidth = pScrn->virtualX + dummy;
- }
-
- }
-
- return count;
-}
-
-
-/* This is called by R128PreInit to validate modes and compute parameters
- for all of the valid modes. */
-static Bool R128PreInitModes(ScrnInfoPtr pScrn)
-{
- R128InfoPtr info = R128PTR(pScrn);
- ClockRangePtr clockRanges;
- int modesFound;
-
- if(info->isDFP) {
- R128MapMem(pScrn);
- info->BIOSDisplay = R128_BIOS_DISPLAY_FP;
- /* validate if DFP really connected. */
- if(!R128GetDFPInfo(pScrn)) {
- info->isDFP = FALSE;
- info->BIOSDisplay = R128_BIOS_DISPLAY_CRT;
- } else if(!info->isPro2) {
- /* RageProII doesn't support rmx, we can't use native-mode
- stretching for other non-native modes. It will rely on
- whatever VESA modes monitor can support. */
- modesFound = R128ValidateFPModes(pScrn);
- if(modesFound < 1) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "No valid mode found for this DFP/LCD\n");
- R128UnmapMem(pScrn);
- return FALSE;
-
- }
- }
- R128UnmapMem(pScrn);
- }
-
- if(!info->isDFP || info->isPro2) {
- /* Get mode information */
- pScrn->progClock = TRUE;
- clockRanges = xnfcalloc(sizeof(*clockRanges), 1);
- clockRanges->next = NULL;
- clockRanges->minClock = info->pll.min_pll_freq;
- clockRanges->maxClock = info->pll.max_pll_freq * 10;
- clockRanges->clockIndex = -1;
- if (info->HasPanelRegs || info->isDFP) {
- clockRanges->interlaceAllowed = FALSE;
- clockRanges->doubleScanAllowed = FALSE;
- } else {
- clockRanges->interlaceAllowed = TRUE;
- clockRanges->doubleScanAllowed = TRUE;
- }
-
- if(pScrn->monitor->DDC) {
- /*if we still don't know sync range yet, let's try EDID.
- Note that, since we can have dual heads, the Xconfigurator
- may not be able to probe both monitors correctly through
- vbe probe function (R128ProbeDDC). Here we provide an
- additional way to auto-detect sync ranges if they haven't
- been added to XF86Config manually.
- **/
- if(pScrn->monitor->nHsync <= 0)
- R128SetSyncRangeFromEdid(pScrn, 1);
- if(pScrn->monitor->nVrefresh <= 0)
- R128SetSyncRangeFromEdid(pScrn, 0);
- }
-
- modesFound = xf86ValidateModes(pScrn,
- pScrn->monitor->Modes,
- pScrn->display->modes,
- clockRanges,
- NULL, /* linePitches */
- 8 * 64, /* minPitch */
- 8 * 1024, /* maxPitch */
-/*
- * ATI docs say pitchInc must be 8 * 64, but this doesn't permit a pitch of
- * 800 bytes, which is known to work on the Rage128 LF on clamshell iBooks
- */
- 8 * 32, /* pitchInc */
- 128, /* minHeight */
- 2048, /* maxHeight */
- pScrn->display->virtualX,
- pScrn->display->virtualY,
- info->FbMapSize,
- LOOKUP_BEST_REFRESH);
-
- if (modesFound < 1 && info->FBDev) {
- fbdevHWUseBuildinMode(pScrn);
- pScrn->displayWidth = fbdevHWGetLineLength(pScrn)/(pScrn->bitsPerPixel/8);
- modesFound = 1;
- }
-
- if (modesFound == -1) return FALSE;
- xf86PruneDriverModes(pScrn);
- if (!modesFound || !pScrn->modes) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
- return FALSE;
- }
- xf86SetCrtcForModes(pScrn, 0);
- }
- /* Set DPI */
- pScrn->currentMode = pScrn->modes;
- xf86PrintModes(pScrn);
-
- xf86SetDpi(pScrn, 0, 0);
-
- /* Get ScreenInit function */
- if (!xf86LoadSubModule(pScrn, "fb")) return FALSE;
-
- info->CurrentLayout.displayWidth = pScrn->displayWidth;
- info->CurrentLayout.mode = pScrn->currentMode;
-
- return TRUE;
-}
-
/* This is called by R128PreInit to initialize the hardware cursor. */
static Bool R128PreInitCursor(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
- if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) {
+ if (!info->swCursor) {
if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
}
return TRUE;
@@ -1757,9 +1031,10 @@ static Bool R128PreInitCursor(ScrnInfoPtr pScrn)
static Bool R128PreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10)
{
+#if !defined(__powerpc__) && !defined(__alpha__)
R128InfoPtr info = R128PTR(pScrn);
-#if 1 && !defined(__alpha__) && !defined(__powerpc__)
- /* int10 is broken on some Alphas */
+
+ /* int10 is broken on some Alphas and powerpc */
if (xf86LoadSubModule(pScrn, "int10")) {
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n");
*ppInt10 = xf86InitInt10(info->pEnt->index);
@@ -1773,21 +1048,6 @@ static Bool R128PreInitDRI(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
- if (xf86ReturnOptValBool(info->Options, OPTION_CCE_PIO, FALSE)) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing CCE into PIO mode\n");
- info->CCEMode = R128_DEFAULT_CCE_PIO_MODE;
- } else {
- info->CCEMode = R128_DEFAULT_CCE_BM_MODE;
- }
-
- if (xf86ReturnOptValBool(info->Options, OPTION_NO_SECURITY, FALSE)) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "WARNING!!! CCE Security checks disabled!!! **********\n");
- info->CCESecure = FALSE;
- } else {
- info->CCESecure = TRUE;
- }
-
info->agpMode = R128_DEFAULT_AGP_MODE;
info->agpSize = R128_DEFAULT_AGP_SIZE;
info->ringSize = R128_DEFAULT_RING_SIZE;
@@ -1886,75 +1146,318 @@ static Bool R128PreInitDRI(ScrnInfoPtr pScrn)
}
#endif
+static Bool R128PreInitControllers(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int found = 0;
+ int i;
+
+ if (!R128GetBIOSParameters(pScrn, pInt10))
+ return FALSE;
+
+ if (!R128GetPLLParameters(pScrn))
+ return FALSE;
+
+ if (!R128AllocateControllers(pScrn))
+ return FALSE;
+
+ if (!R128SetupConnectors(pScrn))
+ return FALSE;
+
+ for (i = 0; i < config->num_output; i++) {
+ xf86OutputPtr output = config->output[i];
+
+ output->status = (*output->funcs->detect) (output);
+ if (output->status == XF86OutputStatusConnected)
+ found++;
+ }
+ return !!found;
+}
+
static void
-R128ProbeDDC(ScrnInfoPtr pScrn, int indx)
+r128UMSOption(ScrnInfoPtr pScrn)
{
- vbeInfoPtr pVbe;
- if (xf86LoadSubModule(pScrn, "vbe")) {
- pVbe = VBEInit(NULL,indx);
- ConfiguredMonitor = vbeDoEDID(pVbe, NULL);
- vbeFree(pVbe);
+ R128InfoPtr info = R128PTR(pScrn);
+
+ info->dac6bits = xf86ReturnOptValBool(info->Options,
+ OPTION_DAC_6BIT, FALSE);
+
+#if defined(__powerpc__) && defined(__linux__)
+ if (xf86ReturnOptValBool(info->Options, OPTION_FBDEV, TRUE))
+#else
+ if (xf86ReturnOptValBool(info->Options, OPTION_FBDEV, FALSE))
+#endif
+ {
+ info->FBDev = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Using framebuffer device.\n");
}
+
+ /* By default, don't access VGA IOs on PowerPC or SPARC. */
+#if defined(__powerpc__) || defined(__sparc__) || !defined(WITH_VGAHW)
+ info->VGAAccess = FALSE;
+#else
+ info->VGAAccess = TRUE;
+#endif
+
+#ifdef WITH_VGAHW
+ xf86GetOptValBool(info->Options, OPTION_VGA_ACCESS,
+ &info->VGAAccess);
+ if (info->VGAAccess) {
+ if (!xf86LoadSubModule(pScrn, "vgahw"))
+ info->VGAAccess = FALSE;
+ else {
+ if (!vgaHWGetHWRec(pScrn))
+ info->VGAAccess = FALSE;
+ }
+
+ if (!info->VGAAccess) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Loading VGA module failed, trying to "
+ "run without it.\n");
+ }
+ } else
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "VGAAccess option set to FALSE, VGA "
+ "module load skipped.\n");
+ if (info->VGAAccess) {
+ vgaHWSetStdFuncs(VGAHWPTR(pScrn));
+ vgaHWGetIOBase(VGAHWPTR(pScrn));
+ }
+#else
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "VGAHW support not compiled, VGA "
+ "module load skipped.\n");
+#endif
+
+ if (xf86ReturnOptValBool(info->Options,
+ OPTION_SHOW_CACHE, FALSE)) {
+ info->showCache = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "ShowCache enabled.\n");
+ }
+
+ if (xf86ReturnOptValBool(info->Options,
+ OPTION_SW_CURSOR, FALSE)) {
+ info->swCursor = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Software cursor requested.\n");
+ }
+
+ if(xf86GetOptValInteger(info->Options,
+ OPTION_VIDEO_KEY, &info->videoKey)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Video key set to 0x%x.\n", info->videoKey);
+ } else {
+ info->videoKey = 0x1E;
+ }
+
+#ifdef R128DRI
+ /* DMA for Xv */
+ info->DMAForXv = xf86ReturnOptValBool(info->Options,
+ OPTION_XV_DMA, FALSE);
+ if (info->DMAForXv) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Will try to use DMA for Xv image transfers.\n");
+ }
+
+ /* Force PCI Mode */
+ info->IsPCI = xf86ReturnOptValBool(info->Options,
+ OPTION_IS_PCI, FALSE);
+ if (info->IsPCI) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Forced into PCI only mode.\n");
+ }
+
+ if (xf86ReturnOptValBool(info->Options, OPTION_CCE_PIO, FALSE)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Forcing CCE into PIO mode.\n");
+ info->CCEMode = R128_DEFAULT_CCE_PIO_MODE;
+ } else {
+ info->CCEMode = R128_DEFAULT_CCE_BM_MODE;
+ }
+
+ if (xf86ReturnOptValBool(info->Options, OPTION_NO_SECURITY, FALSE)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "WARNING!!! CCE Security checks disabled!!!\n");
+ info->CCESecure = FALSE;
+ } else {
+ info->CCESecure = TRUE;
+ }
+
+
+#endif
}
-/* R128PreInit is called once at server startup. */
-Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
+static void
+r128AcquireOption(ScrnInfoPtr pScrn)
{
- R128InfoPtr info;
+ R128InfoPtr info = R128PTR(pScrn);
+#ifdef USE_EXA
+ char *optstr;
+#endif
+
+ if (xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) {
+ info->noAccel = TRUE;
+ }
+
+#ifdef USE_EXA
+ if (!info->noAccel) {
+ optstr = (char *) xf86GetOptValString(info->Options,
+ OPTION_ACCELMETHOD);
+ if (optstr) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "AccelMethod option found.\n");
+ if (xf86NameCmp(optstr, "EXA") == 0) {
+ info->useEXA = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "AccelMethod is set to EXA, turning "
+ "EXA on.\n");
+ }
+ }
+
+#ifdef RENDER
+ info->RenderAccel = xf86ReturnOptValBool(info->Options,
+ OPTION_RENDERACCEL,
+ TRUE);
+ if (info->RenderAccel)
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Acceleration of RENDER operations will be "
+ "enabled upon successful loading of DRI and "
+ "EXA.\n");
+#endif
+ }
+#endif
+
+ r128UMSOption(pScrn);
+}
+
+static Bool R128CRTCResize(ScrnInfoPtr pScrn, int width, int height)
+{
+ pScrn->virtualX = width;
+ pScrn->virtualY = height;
+ return TRUE;
+}
+
+static const xf86CrtcConfigFuncsRec R128CRTCResizeFuncs = {
+ R128CRTCResize
+};
+
+static Bool R128LegacyMS(ScrnInfoPtr pScrn)
+{
+ R128InfoPtr info = R128PTR(pScrn);
xf86Int10InfoPtr pInt10 = NULL;
+ Bool ret = FALSE;
- R128TRACE(("R128PreInit\n"));
+ if (info->FBDev) {
+ /* check for linux framebuffer device */
+ if (!xf86LoadSubModule(pScrn, "fbdevhw")) goto exit;
+ if (!fbdevHWInit(pScrn, info->PciInfo, NULL)) goto exit;
+ pScrn->SwitchMode = fbdevHWSwitchModeWeak();
+ pScrn->AdjustFrame = fbdevHWAdjustFrameWeak();
+ pScrn->ValidMode = fbdevHWValidModeWeak();
+ } else {
+ if (!R128PreInitInt10(pScrn, &pInt10)) goto exit;
+ }
- if (pScrn->numEntities != 1) return FALSE;
+ if (!R128PreInitConfig(pScrn)) goto freeInt10;
- if (!R128GetRec(pScrn)) return FALSE;
+ xf86CrtcSetSizeRange(pScrn, 320, 200, 4096, 4096);
- info = R128PTR(pScrn);
+ if (!R128PreInitCursor(pScrn)) goto freeInt10;
- info->IsSecondary = FALSE;
- info->IsPrimary = FALSE;
- info->SwitchingMode = FALSE;
+ /* Don't fail on this one */
+ info->DDC = R128PreInitDDC(pScrn, pInt10);
- info->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
- if (info->pEnt->location.type != BUS_PCI) goto fail;
+ if (!R128PreInitControllers(pScrn, pInt10)) goto freeInt10;
- if(xf86IsEntityShared(pScrn->entityList[0]))
- {
- if(xf86IsPrimInitDone(pScrn->entityList[0]))
- {
- DevUnion* pPriv;
- R128EntPtr pR128Ent;
- info->IsSecondary = TRUE;
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
- getR128EntityIndex());
- pR128Ent = pPriv->ptr;
- if(pR128Ent->BypassSecondary) return FALSE;
- pR128Ent->pSecondaryScrn = pScrn;
+#ifdef R128DRI
+ if (!R128PreInitDRI(pScrn)) goto freeInt10;
+#endif
+
+ ret = TRUE;
+freeInt10:
+ /* Free int10 info */
+ if (pInt10) {
+ xf86FreeInt10(pInt10);
+ }
+
+exit:
+ return ret;
+}
+
+static void
+R128PreInitAccel(ScrnInfoPtr pScrn)
+{
+ R128InfoPtr info = R128PTR(pScrn);
+#ifdef USE_EXA
+ int errmaj, errmin;
+#endif
+
+ if (!info->noAccel) {
+ if (info->useEXA) {
+#ifdef USE_EXA
+ info->exaReq.majorversion = EXA_VERSION_MAJOR;
+ info->exaReq.minorversion = EXA_VERSION_MINOR;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Loading EXA module...\n");
+ if (LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL,
+ &info->exaReq, &errmaj, &errmin)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Loading EXA module.\n");
+ } else {
+ LoaderErrorMsg(NULL, "exa", errmaj, errmin);
+ }
+#endif
}
- else
- {
- DevUnion* pPriv;
- R128EntPtr pR128Ent;
- info->IsPrimary = TRUE;
- xf86SetPrimInitDone(pScrn->entityList[0]);
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
- getR128EntityIndex());
- pR128Ent = pPriv->ptr;
- pR128Ent->pPrimaryScrn = pScrn;
- pR128Ent->IsDRIEnabled = FALSE;
- pR128Ent->BypassSecondary = FALSE;
- pR128Ent->HasSecondary = FALSE;
- pR128Ent->RestorePrimary = FALSE;
- pR128Ent->IsSecondaryRestored = FALSE;
+
+ if ((!info->useEXA) ||
+ ((info->useEXA) && (!info->accelOn))) {
+#ifdef HAVE_XAA_H
+ if (xf86LoadSubModule(pScrn, "xaa")) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Loading XAA module.\n");
+ }
+#endif
}
}
+}
+
+/* R128PreInit is called once at server startup. */
+Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
+{
+ R128InfoPtr info;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s\n", __func__));
if (flags & PROBE_DETECT) {
- R128ProbeDDC(pScrn, info->pEnt->index);
- return TRUE;
+ return TRUE;
+ }
+
+ pScrn->monitor = pScrn->confScreen->monitor;
+
+ if (!R128PreInitVisual(pScrn)) {
+ return FALSE;
}
- info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index);
+ if (!R128PreInitGamma(pScrn)) {
+ return FALSE;
+ }
+
+ if (pScrn->numEntities != 1) return FALSE;
+
+ if (!R128GetRec(pScrn)) return FALSE;
+
+ info = R128PTR(pScrn);
+ info->SwitchingMode = FALSE;
+ info->MMIO = NULL;
+
+ info->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+ if (info->pEnt->location.type != BUS_PCI) goto fail;
+
+ info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"PCI bus %d card %d func %d\n",
@@ -1963,17 +1466,31 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
PCI_DEV_FUNC(info->PciInfo));
#ifndef XSERVER_LIBPCIACCESS
- info->PciTag = pciTag(PCI_DEV_BUS(info->PciInfo),
+ info->PciTag = pciTag(PCI_DEV_BUS(info->PciInfo),
PCI_DEV_DEV(info->PciInfo),
PCI_DEV_FUNC(info->PciInfo));
+
if (xf86RegisterResources(info->pEnt->index, 0, ResNone)) goto fail;
if (xf86SetOperatingState(resVga, info->pEnt->index, ResUnusedOpr)) goto fail;
- pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_VIEWPORT | RAC_CURSOR;
+ pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_VIEWPORT | RAC_CURSOR;
#endif
- pScrn->monitor = pScrn->confScreen->monitor;
- if (!R128PreInitVisual(pScrn)) goto fail;
+ info->fifo_slots = 0;
+ info->pix24bpp = xf86GetBppFromDepth(pScrn, pScrn->depth);
+ info->CurrentLayout.bitsPerPixel = pScrn->bitsPerPixel;
+ info->CurrentLayout.depth = pScrn->depth;
+ info->CurrentLayout.pixel_bytes = pScrn->bitsPerPixel / 8;
+ info->CurrentLayout.pixel_code = (pScrn->bitsPerPixel != 16
+ ? pScrn->bitsPerPixel
+ : pScrn->depth);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Pixel depth = %d bits stored in %d byte%s (%d bpp pixmaps)\n",
+ pScrn->depth,
+ info->CurrentLayout.pixel_bytes,
+ info->CurrentLayout.pixel_bytes > 1 ? "s" : "",
+ info->pix24bpp);
/* We can't do this until we have a
pScrn->display. */
@@ -1982,94 +1499,52 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
memcpy(info->Options, R128Options, sizeof(R128Options));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, info->Options);
- /* By default, don't do VGA IOs on ppc */
-#if defined(__powerpc__) || defined(__sparc__) || !defined(WITH_VGAHW)
- info->VGAAccess = FALSE;
-#else
- info->VGAAccess = TRUE;
-#endif
+ info->noAccel = FALSE;
+ info->accelOn = FALSE;
-#ifdef WITH_VGAHW
- xf86GetOptValBool(info->Options, OPTION_VGA_ACCESS, &info->VGAAccess);
- if (info->VGAAccess) {
- if (!xf86LoadSubModule(pScrn, "vgahw"))
- info->VGAAccess = FALSE;
- else {
- if (!vgaHWGetHWRec(pScrn))
- info->VGAAccess = FALSE;
- }
- if (!info->VGAAccess)
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Loading VGA module failed,"
- " trying to run without it\n");
- } else
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VGAAccess option set to FALSE,"
- " VGA module load skipped\n");
- if (info->VGAAccess) {
- vgaHWSetStdFuncs(VGAHWPTR(pScrn));
- vgaHWGetIOBase(VGAHWPTR(pScrn));
- }
-#else
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VGAHW support not compiled, VGA "
- "module load skipped\n");
+ info->useEXA = FALSE;
+#ifdef USE_EXA
+#ifndef HAVE_XAA_H
+ info->useEXA = TRUE;
+#endif
#endif
+ info->swCursor = FALSE;
+ r128AcquireOption(pScrn);
if (!R128PreInitWeight(pScrn)) goto fail;
- if(xf86GetOptValInteger(info->Options, OPTION_VIDEO_KEY, &(info->videoKey))) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n",
- info->videoKey);
- } else {
- info->videoKey = 0x1E;
- }
-
- if (xf86ReturnOptValBool(info->Options, OPTION_SHOW_CACHE, FALSE)) {
- info->showCache = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache enabled\n");
- }
+ /* Allocate an xf86CrtcConfig */
+ xf86CrtcConfigInit(pScrn, &R128CRTCResizeFuncs);
-#if defined(__powerpc__) && defined(__linux__)
- if (xf86ReturnOptValBool(info->Options, OPTION_FBDEV, TRUE))
-#else
- if (xf86ReturnOptValBool(info->Options, OPTION_FBDEV, FALSE))
-#endif
- {
- info->FBDev = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Using framebuffer device\n");
- }
+ R128LegacyMS(pScrn);
- if (info->FBDev) {
- /* check for linux framebuffer device */
- if (!xf86LoadSubModule(pScrn, "fbdevhw")) return FALSE;
- if (!fbdevHWInit(pScrn, info->PciInfo, NULL)) return FALSE;
- pScrn->SwitchMode = fbdevHWSwitchModeWeak();
- pScrn->AdjustFrame = fbdevHWAdjustFrameWeak();
- pScrn->ValidMode = fbdevHWValidModeWeak();
+ if (!xf86InitialConfiguration(pScrn, TRUE)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n");
+ goto fail;
}
+ pScrn->displayWidth = (pScrn->virtualX + 63) & ~63;
- if (!info->FBDev)
- if (!R128PreInitInt10(pScrn, &pInt10)) goto fail;
-
- if (!R128PreInitConfig(pScrn)) goto fail;
-
- if (!R128GetBIOSParameters(pScrn, pInt10)) goto fail;
-
- if (!R128GetPLLParameters(pScrn)) goto fail;
+ /* Set display resolution */
+ xf86SetDpi(pScrn, 0, 0);
- /* Don't fail on this one */
- R128PreInitDDC(pScrn, pInt10);
+ /* Get ScreenInit function */
+ if (!xf86LoadSubModule(pScrn, "fb")) return FALSE;
- if (!R128PreInitGamma(pScrn)) goto fail;
+ R128PreInitAccel(pScrn);
- if (!R128PreInitModes(pScrn)) goto fail;
+ info->CurrentLayout.displayWidth = pScrn->displayWidth;
- if (!R128PreInitCursor(pScrn)) goto fail;
+ if (!xf86RandR12PreInit(pScrn)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "RandR initialization failure\n");
+ goto fail;
+ }
-#ifdef R128DRI
- if (!R128PreInitDRI(pScrn)) goto fail;
-#endif
+ if (pScrn->modes == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
+ goto fail;
+ }
/* Free the video bios (if applicable) */
if (info->VBIOS) {
@@ -2077,13 +1552,8 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
info->VBIOS = NULL;
}
- /* Free int10 info */
- if (pInt10)
- xf86FreeInt10(pInt10);
-
- xf86DrvMsg(pScrn->scrnIndex, X_NOTICE,
- "For information on using the multimedia capabilities\n\tof this"
- " adapter, please see http://gatos.sf.net.\n");
+ if (info->MMIO) R128UnmapMMIO(pScrn);
+ info->MMIO = NULL;
return TRUE;
@@ -2096,14 +1566,14 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
info->VBIOS = NULL;
}
- /* Free int10 info */
- if (pInt10)
- xf86FreeInt10(pInt10);
-
#ifdef WITH_VGAHW
if (info->VGAAccess)
vgaHWFreeHWRec(pScrn);
#endif
+
+ if (info->MMIO) R128UnmapMMIO(pScrn);
+ info->MMIO = NULL;
+
R128FreeRec(pScrn);
return FALSE;
}
@@ -2113,56 +1583,66 @@ static void R128LoadPalette(ScrnInfoPtr pScrn, int numColors,
int *indices, LOCO *colors, VisualPtr pVisual)
{
R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- int i, j;
- int idx;
- unsigned char r, g, b;
-
- /* If the second monitor is connected, we also
- need to deal with the secondary palette*/
- if (info->IsSecondary) j = 1;
- else j = 0;
-
- PAL_SELECT(j);
-
-
- /* Select palette 0 (main CRTC) if using FP-enabled chip */
- /*if (info->HasPanelRegs || info->isDFP) PAL_SELECT(0);*/
-
- if (info->CurrentLayout.depth == 15) {
- /* 15bpp mode. This sends 32 values. */
- for (i = 0; i < numColors; i++) {
- idx = indices[i];
- r = colors[idx].red;
- g = colors[idx].green;
- b = colors[idx].blue;
- OUTPAL(idx * 8, r, g, b);
- }
- }
- else if (info->CurrentLayout.depth == 16) {
- /* 16bpp mode. This sends 64 values. */
- /* There are twice as many green values as
- there are values for red and blue. So,
- we take each red and blue pair, and
- combine it with each of the two green
- values. */
- for (i = 0; i < numColors; i++) {
- idx = indices[i];
- r = colors[idx / 2].red;
- g = colors[idx].green;
- b = colors[idx / 2].blue;
- OUTPAL(idx * 4, r, g, b);
- }
- }
- else {
- /* 8bpp mode. This sends 256 values. */
- for (i = 0; i < numColors; i++) {
- idx = indices[i];
- r = colors[idx].red;
- b = colors[idx].blue;
- g = colors[idx].green;
- OUTPAL(idx, r, g, b);
- }
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int i, j;
+ int c, index;
+ uint16_t lut_r[256], lut_g[256], lut_b[256];
+
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+
+ for (i = 0 ; i < 256; i++) {
+ lut_r[i] = r128_crtc->lut_r[i] << 8;
+ lut_g[i] = r128_crtc->lut_g[i] << 8;
+ lut_b[i] = r128_crtc->lut_b[i] << 8;
+ }
+
+ switch (info->CurrentLayout.depth) {
+ case 15:
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+ for (j = 0; j < 8; j++) {
+ lut_r[index * 8 + j] = colors[index].red << 8;
+ lut_g[index * 8 + j] = colors[index].green << 8;
+ lut_b[index * 8 + j] = colors[index].blue << 8;
+ }
+ }
+ case 16:
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+
+ /* XXX: The old version of R128LoadPalette did not do this and
+ * the old version of RADEONLoadPalette has a comment asking why.
+ */
+ if (i <= 31) {
+ for (j = 0; j < 8; j++) {
+ lut_r[index * 8 + j] = colors[index].red << 8;
+ lut_b[index * 8 + j] = colors[index].blue << 8;
+ }
+ }
+
+ for (j = 0; j < 4; j++) {
+ lut_g[index * 4 + j] = colors[index].green << 8;
+ }
+ }
+ default:
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+ lut_r[index] = colors[index].red << 8;
+ lut_g[index] = colors[index].green << 8;
+ lut_b[index] = colors[index].blue << 8;
+ }
+ break;
+ }
+
+ /* Make the change through RandR */
+#ifdef RANDR_12_INTERFACE
+ if (crtc->randr_crtc)
+ RRCrtcGammaSet(crtc->randr_crtc, lut_r, lut_g, lut_b);
+ else
+#endif
+ crtc->funcs->gamma_set(crtc, lut_r, lut_g, lut_b, 256);
}
}
@@ -2187,51 +1667,6 @@ R128BlockHandler(BLOCKHANDLER_ARGS_DECL)
}
}
-#ifdef USE_EXA
-Bool R128VerboseInitEXA(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- R128InfoPtr info = R128PTR(pScrn);
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Going to init EXA...\n");
-
- if (R128EXAInit(pScreen)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EXA Acceleration enabled\n");
- info->accelOn = TRUE;
-
- return TRUE;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "EXA Acceleration initialization failed\n");
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EXA Acceleration disabled\n");
- info->accelOn = FALSE;
-
- return FALSE;
- }
-}
-#endif
-
-void R128VerboseInitAccel(Bool noAccel, ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- R128InfoPtr info = R128PTR(pScrn);
-
- if (!noAccel) {
- if (R128AccelInit(pScreen)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration enabled\n");
- info->accelOn = TRUE;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Acceleration initialization failed\n");
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n");
- info->accelOn = FALSE;
- }
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n");
- info->accelOn = FALSE;
- }
-}
-
/* Called at the start of each server generation. */
Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
{
@@ -2239,40 +1674,22 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
R128InfoPtr info = R128PTR(pScrn);
BoxRec MemBox;
int width_bytes = (pScrn->displayWidth *
- info->CurrentLayout.pixel_bytes);
- int x1 = 0, x2 = 0, y1 = 0, y2 = 0;
- Bool noAccel;
+ info->CurrentLayout.pixel_bytes);
+ int scanlines;
+ int total = info->FbMapSize;
+ FBAreaPtr fbarea = NULL;
+#ifdef R128DRI
+ int cpp = info->CurrentLayout.pixel_bytes;
+ int x1 = 0, x2 = 0, y1 = 0, y2 = 0;
#ifdef USE_EXA
ExaOffscreenArea* osArea = NULL;
-#else
- void* osArea = NULL;
-#endif
- char *optstr;
-
- R128TRACE(("R128ScreenInit %x %d\n", pScrn->memPhysBase, pScrn->fbOffset));
- info->useEXA = FALSE;
-#ifdef USE_EXA
-#ifndef HAVE_XAA_H
- info->useEXA = TRUE;
-#endif
-#endif
+#endif /* USE_EXA */
+#endif /* R128DRI */
-#ifdef USE_EXA
- optstr = (char *)xf86GetOptValString(info->Options, OPTION_ACCELMETHOD);
- if (optstr != NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AccelMethod option found\n");
- if (xf86NameCmp(optstr, "EXA") == 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AccelMethod is set to EXA, turning EXA on\n");
- info->useEXA = TRUE;
- }
- }
-#ifdef RENDER
- info->RenderAccel = xf86ReturnOptValBool(info->Options, OPTION_RENDERACCEL, TRUE);
- if (info->RenderAccel)
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration of RENDER operations will be enabled"
- "upon successful loading of DRI and EXA\n");
-#endif
-#endif
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s %lx %lx\n",
+ __func__,
+ pScrn->memPhysBase, pScrn->fbOffset));
#ifdef R128DRI
/* Turn off the CCE for now. */
@@ -2282,7 +1699,7 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
if (!R128MapMem(pScrn)) return FALSE;
pScrn->fbOffset = 0;
- if(info->IsSecondary) pScrn->fbOffset = pScrn->videoRam * 1024;
+ //if(info->IsSecondary) pScrn->fbOffset = pScrn->videoRam * 1024;
#ifdef R128DRI
info->fbX = 0;
info->fbY = 0;
@@ -2293,14 +1710,6 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
info->PaletteSavedOnVT = FALSE;
R128Save(pScrn);
- if (info->FBDev) {
- if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE;
- } else {
- if (!R128ModeInit(pScrn, pScrn->currentMode)) return FALSE;
- }
-
- R128SaveScreen(pScreen, SCREEN_SAVER_ON);
- pScrn->AdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
/* Visual setup */
miClearVisualTypes();
@@ -2310,21 +1719,17 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
pScrn->defaultVisual)) return FALSE;
miSetPixmapDepths ();
- noAccel = xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE);
-
#ifdef R128DRI
/* Setup DRI after visuals have been
established, but before fbScreenInit is
- called. fbScreenInit will eventually
- call the driver's InitGLXVisuals call
- back. */
+ called. */
{
/* FIXME: When we move to dynamic allocation of back and depth
buffers, we will want to revisit the following check for 3
times the virtual size of the screen below. */
int maxy = info->FbMapSize / width_bytes;
- if (noAccel) {
+ if (info->noAccel) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Acceleration disabled, not initializing the DRI\n");
info->directRenderingEnabled = FALSE;
@@ -2336,33 +1741,7 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
info->CurrentLayout.pixel_bytes * 3 + 1023) / 1024);
info->directRenderingEnabled = FALSE;
} else {
- if(info->IsSecondary)
- info->directRenderingEnabled = FALSE;
- else
- {
- /* Xinerama has sync problem with DRI, disable it for now */
- if(xf86IsEntityShared(pScrn->entityList[0]))
- {
- info->directRenderingEnabled = FALSE;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Direct Rendering Disabled -- "
- "Dual-head configuration is not working with DRI "
- "at present.\nPlease use only one Device/Screen "
- "section in your XFConfig file.\n");
- }
- else
- info->directRenderingEnabled =
- R128DRIScreenInit(pScreen);
- if(xf86IsEntityShared(pScrn->entityList[0]))
- {
- DevUnion* pPriv;
- R128EntPtr pR128Ent;
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
- getR128EntityIndex());
- pR128Ent = pPriv->ptr;
- pR128Ent->IsDRIEnabled = info->directRenderingEnabled;
- }
- }
+ info->directRenderingEnabled = R128DRIScreenInit(pScreen);
}
}
#endif
@@ -2397,11 +1776,8 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
/* Memory manager setup */
#ifdef R128DRI
if (info->directRenderingEnabled) {
- FBAreaPtr fbarea = NULL;
- int cpp = info->CurrentLayout.pixel_bytes;
int bufferSize = pScrn->virtualY * width_bytes;
- int l, total;
- int scanlines;
+ int l;
switch (info->CCEMode) {
case R128_DEFAULT_CCE_PIO_MODE:
@@ -2461,19 +1837,26 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
info->textureSize = 0;
}
- total = info->FbMapSize - info->textureSize;
- scanlines = total / width_bytes;
- if (scanlines > 8191) scanlines = 8191;
+ total = info->FbMapSize - info->textureSize;
+ }
+#endif /* R128DRI */
+
+ scanlines = total / width_bytes;
+ if (scanlines > 8191) scanlines = 8191;
- /* Recalculate the texture offset and size to accomodate any
- * rounding to a whole number of scanlines.
- */
- info->textureOffset = scanlines * width_bytes;
+#ifdef R128DRI
+ if (info->directRenderingEnabled)
+ /*
+ * Recalculate the texture offset and size to accomodate any
+ * rounding to a whole number of scanlines.
+ */
+ info->textureOffset = scanlines * width_bytes;
+#endif /* R128DRI */
- MemBox.x1 = 0;
- MemBox.y1 = 0;
- MemBox.x2 = pScrn->displayWidth;
- MemBox.y2 = scanlines;
+ MemBox.x1 = 0;
+ MemBox.y1 = 0;
+ MemBox.x2 = pScrn->displayWidth;
+ MemBox.y2 = scanlines;
if (!info->useEXA) {
if (!xf86InitFBManager(pScreen, &MemBox)) {
@@ -2504,28 +1887,45 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
width, height);
}
- R128VerboseInitAccel(noAccel, pScreen);
- }
- }
+ if (!info->noAccel) {
+ if (R128XAAAccelInit(pScreen)) {
+ info->accelOn = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "XAA acceleration enabled.\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Acceleration disabled.\n");
+ }
+ }
+ }
+ }
#ifdef USE_EXA
- else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Filling in EXA memory info\n");
-
- R128VerboseInitAccel(noAccel, pScreen);
- info->ExaDriver->offScreenBase = pScrn->virtualY * width_bytes;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Filled in offs\n");
-
- /* Don't give EXA the true full memory size, because the
- textureSize sized chunk on the end is handled by DRI */
- info->ExaDriver->memorySize = total;
-
- R128VerboseInitEXA(pScreen);
- }
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Filling in EXA memory info\n");
+
+
+ /*
+ * Don't give EXA the true full memory size, because
+ * the textureSize sized chunk on the end is handled
+ * by DRI.
+ */
+ if (R128EXAInit(pScreen, total)) {
+ info->accelOn = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "EXA Acceleration enabled.\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "EXA Acceleration initialization "
+ "failed.\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Acceleration disabled.\n");
+ }
+ }
#endif
+#ifdef R128DRI
+ if (info->directRenderingEnabled) {
/* Allocate the shared back buffer */
if(!info->useEXA) {
fbarea = xf86AllocateOffscreenArea(pScreen,
@@ -2635,70 +2035,25 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
"Reserved %d kb for textures at offset 0x%x\n",
info->textureSize/1024, info->textureOffset);
}
- else
#endif /* R128DRI */
- {
- MemBox.x1 = 0;
- MemBox.y1 = 0;
- MemBox.x2 = pScrn->displayWidth;
- y2 = (info->FbMapSize
- / (pScrn->displayWidth *
- info->CurrentLayout.pixel_bytes));
- /* The acceleration engine uses 14 bit
- signed coordinates, so we can't have any
- drawable caches beyond this region. */
- if (y2 > 8191) y2 = 8191;
- MemBox.y2 = y2;
-
- if (!info->useEXA) {
- if (!xf86InitFBManager(pScreen, &MemBox)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Memory manager initialization to (%d,%d) (%d,%d) failed\n",
- MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2);
- return FALSE;
- } else {
- int width, height;
- FBAreaPtr fbarea;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Memory manager initialized to (%d,%d) (%d,%d)\n",
- MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2);
- if ((fbarea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, 2, 0, NULL, NULL, NULL))) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Reserved area from (%d,%d) to (%d,%d)\n",
- fbarea->box.x1, fbarea->box.y1,
- fbarea->box.x2, fbarea->box.y2);
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to reserve area\n");
- }
- if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, 0, 0, 0)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Largest offscreen area available: %d x %d\n",
- width, height);
- }
- R128VerboseInitAccel(noAccel, pScreen);
- }
- }
-#ifdef USE_EXA
- else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Filling in EXA memory info\n");
-
- R128VerboseInitAccel(noAccel, pScreen);
- info->ExaDriver->offScreenBase = pScrn->virtualY * width_bytes;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Filled in offs\n");
+ pScrn->vtSema = TRUE;
+ /* xf86CrtcRotate accesses pScrn->pScreen */
+ pScrn->pScreen = pScreen;
- info->ExaDriver->memorySize = info->FbMapSize;
- R128VerboseInitEXA(pScreen);
- }
-#endif
+ if (info->FBDev) {
+ if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE;
+ } else {
+ if (!xf86SetDesiredModes(pScrn)) return FALSE;
}
+ R128SaveScreen(pScreen, SCREEN_SAVER_ON);
+ //pScrn->AdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
+
/* DGA setup */
- R128DGAInit(pScreen);
+#ifdef XFreeXDGA
+ xf86DiDGAInit(pScreen, info->LinearAddr + pScrn->fbOffset);
+#endif
/* Backing store setup */
xf86SetBackingStore(pScreen);
@@ -2710,13 +2065,10 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
/* Hardware cursor setup */
- if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) {
+ if (!info->swCursor) {
if (R128CursorInit(pScreen)) {
int width, height;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using hardware cursor (scanline %ld)\n",
- info->cursor_start / pScrn->displayWidth);
if (xf86QueryLargestOffscreenArea(pScreen, &width, &height,
0, 0, 0)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -2729,35 +2081,16 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n");
}
} else {
- info->cursor_start = 0;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n");
}
- /* Colormap setup */
- if (!miCreateDefColormap(pScreen)) return FALSE;
- if (!xf86HandleColormaps(pScreen, 256, info->dac6bits ? 6 : 8,
- (info->FBDev ? fbdevHWLoadPaletteWeak() :
- R128LoadPalette), NULL,
- CMAP_PALETTED_TRUECOLOR
- | CMAP_RELOAD_ON_MODE_SWITCH
-#if 0 /* This option messes up text mode! (eich@suse.de) */
- | CMAP_LOAD_EVEN_IF_OFFSCREEN
-#endif
- )) return FALSE;
-
/* DPMS setup - FIXME: also for mirror mode in non-fbdev case? - Michel */
if (info->FBDev)
xf86DPMSInit(pScreen, fbdevHWDPMSSetWeak(), 0);
+ else
+ xf86DPMSInit(pScreen, xf86DPMSSet, 0);
- else {
- if (info->DisplayType == MT_LCD)
- xf86DPMSInit(pScreen, R128DisplayPowerManagementSetLCD, 0);
- else
- xf86DPMSInit(pScreen, R128DisplayPowerManagementSet, 0);
- }
-
- if (!info->IsSecondary)
- R128InitVideo(pScreen);
+ R128InitVideo(pScreen);
/* Provide SaveScreen */
pScreen->SaveScreen = R128SaveScreen;
@@ -2789,11 +2122,25 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
info->BlockHandler = pScreen->BlockHandler;
pScreen->BlockHandler = R128BlockHandler;
+ if (!xf86CrtcScreenInit(pScreen)) return FALSE;
+
+ /* Colormap setup */
+ if (!miCreateDefColormap(pScreen)) return FALSE;
+ if (!xf86HandleColormaps(pScreen, 256, info->dac6bits ? 6 : 8,
+ (info->FBDev ? fbdevHWLoadPaletteWeak() :
+ R128LoadPalette), NULL,
+ CMAP_PALETTED_TRUECOLOR
+ | CMAP_RELOAD_ON_MODE_SWITCH
+#if 0 /* This option messes up text mode! (eich@suse.de) */
+ | CMAP_LOAD_EVEN_IF_OFFSCREEN
+#endif
+ )) return FALSE;
+
return TRUE;
}
/* Write common registers (initialized to 0). */
-static void R128RestoreCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
+void R128RestoreCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
@@ -2816,68 +2163,42 @@ static void R128RestoreCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
OUTREG(R128_CONFIG_CNTL, restore->config_cntl);
}
-/* Write CRTC registers. */
-static void R128RestoreCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
+/* Write RMX registers */
+void R128RestoreRMXRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- OUTREG(R128_CRTC_GEN_CNTL, restore->crtc_gen_cntl);
-
- OUTREGP(R128_CRTC_EXT_CNTL, restore->crtc_ext_cntl,
- R128_CRTC_VSYNC_DIS | R128_CRTC_HSYNC_DIS | R128_CRTC_DISPLAY_DIS);
-
- OUTREGP(R128_DAC_CNTL, restore->dac_cntl,
- R128_DAC_RANGE_CNTL | R128_DAC_BLANKING);
-
- OUTREG(R128_CRTC_H_TOTAL_DISP, restore->crtc_h_total_disp);
- OUTREG(R128_CRTC_H_SYNC_STRT_WID, restore->crtc_h_sync_strt_wid);
- OUTREG(R128_CRTC_V_TOTAL_DISP, restore->crtc_v_total_disp);
- OUTREG(R128_CRTC_V_SYNC_STRT_WID, restore->crtc_v_sync_strt_wid);
- OUTREG(R128_CRTC_OFFSET, restore->crtc_offset);
- OUTREG(R128_CRTC_OFFSET_CNTL, restore->crtc_offset_cntl);
- OUTREG(R128_CRTC_PITCH, restore->crtc_pitch);
+ OUTREG(R128_FP_HORZ_STRETCH, restore->fp_horz_stretch);
+ OUTREG(R128_FP_VERT_STRETCH, restore->fp_vert_stretch);
+ OUTREG(R128_FP_CRTC_H_TOTAL_DISP, restore->fp_crtc_h_total_disp);
+ OUTREG(R128_FP_CRTC_V_TOTAL_DISP, restore->fp_crtc_v_total_disp);
+ OUTREG(R128_FP_H_SYNC_STRT_WID, restore->fp_h_sync_strt_wid);
+ OUTREG(R128_FP_V_SYNC_STRT_WID, restore->fp_v_sync_strt_wid);
}
-/* Write CRTC2 registers. */
-static void R128RestoreCrtc2Registers(ScrnInfoPtr pScrn,
- R128SavePtr restore)
+/* Write flat panel registers */
+void R128RestoreFPRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
- R128InfoPtr info = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- OUTREGP(R128_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl,
- R128_CRTC2_DISP_DIS);
-
- OUTREG(R128_CRTC2_H_TOTAL_DISP, restore->crtc2_h_total_disp);
- OUTREG(R128_CRTC2_H_SYNC_STRT_WID, restore->crtc2_h_sync_strt_wid);
- OUTREG(R128_CRTC2_V_TOTAL_DISP, restore->crtc2_v_total_disp);
- OUTREG(R128_CRTC2_V_SYNC_STRT_WID, restore->crtc2_v_sync_strt_wid);
- OUTREG(R128_CRTC2_OFFSET, restore->crtc2_offset);
- OUTREG(R128_CRTC2_OFFSET_CNTL, restore->crtc2_offset_cntl);
- OUTREG(R128_CRTC2_PITCH, restore->crtc2_pitch);
+ OUTREG(R128_TMDS_CRC, restore->tmds_crc);
+ OUTREG(R128_TMDS_TRANSMITTER_CNTL, restore->tmds_transmitter_cntl);
+ OUTREG(R128_FP_PANEL_CNTL, restore->fp_panel_cntl);
+ OUTREG(R128_FP_GEN_CNTL, restore->fp_gen_cntl & ~(uint32_t)R128_FP_BLANK_DIS);
}
-/* Write flat panel registers */
-static void R128RestoreFPRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
+/* Write LVDS registers */
+void R128RestoreLVDSRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
R128InfoPtr info = R128PTR(pScrn);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
unsigned char *R128MMIO = info->MMIO;
- CARD32 tmp;
+ uint32_t tmp;
- if (info->BIOSDisplay != R128_DUALHEAD)
- OUTREG(R128_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl);
- OUTREG(R128_FP_HORZ_STRETCH, restore->fp_horz_stretch);
- OUTREG(R128_FP_VERT_STRETCH, restore->fp_vert_stretch);
- OUTREG(R128_FP_CRTC_H_TOTAL_DISP, restore->fp_crtc_h_total_disp);
- OUTREG(R128_FP_CRTC_V_TOTAL_DISP, restore->fp_crtc_v_total_disp);
- OUTREG(R128_FP_H_SYNC_STRT_WID, restore->fp_h_sync_strt_wid);
- OUTREG(R128_FP_V_SYNC_STRT_WID, restore->fp_v_sync_strt_wid);
- OUTREG(R128_TMDS_CRC, restore->tmds_crc);
- OUTREG(R128_FP_PANEL_CNTL, restore->fp_panel_cntl);
- OUTREG(R128_FP_GEN_CNTL, restore->fp_gen_cntl & ~(CARD32)R128_FP_BLANK_DIS);
-
- if(info->isDFP) return;
+ xf86OutputPtr output = R128FirstOutput(pR128Ent->pCrtc[0]);
+ R128OutputPrivatePtr r128_output = output->driver_private;
tmp = INREG(R128_LVDS_GEN_CNTL);
if ((tmp & (R128_LVDS_ON | R128_LVDS_BLON)) ==
@@ -2886,185 +2207,19 @@ static void R128RestoreFPRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
} else {
if (restore->lvds_gen_cntl & (R128_LVDS_ON | R128_LVDS_BLON)) {
OUTREG(R128_LVDS_GEN_CNTL,
- restore->lvds_gen_cntl & (CARD32)~R128_LVDS_BLON);
- usleep(R128PTR(pScrn)->PanelPwrDly * 1000);
+ restore->lvds_gen_cntl & (uint32_t)~R128_LVDS_BLON);
+ usleep(r128_output->PanelPwrDly * 1000);
OUTREG(R128_LVDS_GEN_CNTL, restore->lvds_gen_cntl);
} else {
OUTREG(R128_LVDS_GEN_CNTL, restore->lvds_gen_cntl | R128_LVDS_BLON);
- usleep(R128PTR(pScrn)->PanelPwrDly * 1000);
+ usleep(r128_output->PanelPwrDly * 1000);
OUTREG(R128_LVDS_GEN_CNTL, restore->lvds_gen_cntl);
}
}
}
-static void R128PLLWaitForReadUpdateComplete(ScrnInfoPtr pScrn)
-{
- while (INPLL(pScrn, R128_PPLL_REF_DIV) & R128_PPLL_ATOMIC_UPDATE_R);
-}
-
-static void R128PLLWriteUpdate(ScrnInfoPtr pScrn)
-{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
-
- while (INPLL(pScrn, R128_PPLL_REF_DIV) & R128_PPLL_ATOMIC_UPDATE_R);
-
- OUTPLLP(pScrn, R128_PPLL_REF_DIV, R128_PPLL_ATOMIC_UPDATE_W,
- ~R128_PPLL_ATOMIC_UPDATE_W);
-
-}
-
-static void R128PLL2WaitForReadUpdateComplete(ScrnInfoPtr pScrn)
-{
- while (INPLL(pScrn, R128_P2PLL_REF_DIV) & R128_P2PLL_ATOMIC_UPDATE_R);
-}
-
-static void R128PLL2WriteUpdate(ScrnInfoPtr pScrn)
-{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
-
- while (INPLL(pScrn, R128_P2PLL_REF_DIV) & R128_P2PLL_ATOMIC_UPDATE_R);
-
- OUTPLLP(pScrn, R128_P2PLL_REF_DIV,
- R128_P2PLL_ATOMIC_UPDATE_W,
- ~(R128_P2PLL_ATOMIC_UPDATE_W));
-}
-
-/* Write PLL registers. */
-static void R128RestorePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
-{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
-
-
- OUTPLLP(pScrn, R128_VCLK_ECP_CNTL,
- R128_VCLK_SRC_SEL_CPUCLK,
- ~(R128_VCLK_SRC_SEL_MASK));
-
- OUTPLLP(pScrn,
- R128_PPLL_CNTL,
- R128_PPLL_RESET
- | R128_PPLL_ATOMIC_UPDATE_EN
- | R128_PPLL_VGA_ATOMIC_UPDATE_EN,
- ~(R128_PPLL_RESET
- | R128_PPLL_ATOMIC_UPDATE_EN
- | R128_PPLL_VGA_ATOMIC_UPDATE_EN));
-
- OUTREGP(R128_CLOCK_CNTL_INDEX, R128_PLL_DIV_SEL, ~(R128_PLL_DIV_SEL));
-
-/* R128PLLWaitForReadUpdateComplete(pScrn);*/
- OUTPLLP(pScrn, R128_PPLL_REF_DIV,
- restore->ppll_ref_div, ~R128_PPLL_REF_DIV_MASK);
-/* R128PLLWriteUpdate(pScrn);
-
- R128PLLWaitForReadUpdateComplete(pScrn);*/
- OUTPLLP(pScrn, R128_PPLL_DIV_3,
- restore->ppll_div_3, ~R128_PPLL_FB3_DIV_MASK);
-/* R128PLLWriteUpdate(pScrn);*/
- OUTPLLP(pScrn, R128_PPLL_DIV_3,
- restore->ppll_div_3, ~R128_PPLL_POST3_DIV_MASK);
-
- R128PLLWriteUpdate(pScrn);
- R128PLLWaitForReadUpdateComplete(pScrn);
-
- OUTPLL(R128_HTOTAL_CNTL, restore->htotal_cntl);
-/* R128PLLWriteUpdate(pScrn);*/
-
- OUTPLLP(pScrn, R128_PPLL_CNTL, 0, ~(R128_PPLL_RESET
- | R128_PPLL_SLEEP
- | R128_PPLL_ATOMIC_UPDATE_EN
- | R128_PPLL_VGA_ATOMIC_UPDATE_EN));
-
- R128TRACE(("Wrote: 0x%08x 0x%08x 0x%08x (0x%08x)\n",
- restore->ppll_ref_div,
- restore->ppll_div_3,
- restore->htotal_cntl,
- INPLL(pScrn, R128_PPLL_CNTL)));
- R128TRACE(("Wrote: rd=%d, fd=%d, pd=%d\n",
- restore->ppll_ref_div & R128_PPLL_REF_DIV_MASK,
- restore->ppll_div_3 & R128_PPLL_FB3_DIV_MASK,
- (restore->ppll_div_3 & R128_PPLL_POST3_DIV_MASK) >> 16));
-
- usleep(5000); /* let the clock lock */
-
- OUTPLLP(pScrn, R128_VCLK_ECP_CNTL,
- R128_VCLK_SRC_SEL_PPLLCLK,
- ~(R128_VCLK_SRC_SEL_MASK));
-
-}
-
-/* Write PLL2 registers. */
-static void R128RestorePLL2Registers(ScrnInfoPtr pScrn, R128SavePtr restore)
-{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
-
- OUTPLLP(pScrn, R128_V2CLK_VCLKTV_CNTL,
- R128_V2CLK_SRC_SEL_CPUCLK,
- ~R128_V2CLK_SRC_SEL_MASK);
-
- OUTPLLP(pScrn,
- R128_P2PLL_CNTL,
- R128_P2PLL_RESET
- | R128_P2PLL_ATOMIC_UPDATE_EN
- | R128_P2PLL_VGA_ATOMIC_UPDATE_EN,
- ~(R128_P2PLL_RESET
- | R128_P2PLL_ATOMIC_UPDATE_EN
- | R128_P2PLL_VGA_ATOMIC_UPDATE_EN));
-
-#if 1
- OUTREGP(R128_CLOCK_CNTL_INDEX, 0, R128_PLL2_DIV_SEL_MASK);
-#endif
-
- /*R128PLL2WaitForReadUpdateComplete(pScrn);*/
-
- OUTPLLP(pScrn, R128_P2PLL_REF_DIV, restore->p2pll_ref_div, ~R128_P2PLL_REF_DIV_MASK);
-
-/* R128PLL2WriteUpdate(pScrn);
- R128PLL2WaitForReadUpdateComplete(pScrn);*/
-
- OUTPLLP(pScrn, R128_P2PLL_DIV_0,
- restore->p2pll_div_0, ~R128_P2PLL_FB0_DIV_MASK);
-
-/* R128PLL2WriteUpdate(pScrn);
- R128PLL2WaitForReadUpdateComplete(pScrn);*/
-
- OUTPLLP(pScrn, R128_P2PLL_DIV_0,
- restore->p2pll_div_0, ~R128_P2PLL_POST0_DIV_MASK);
-
- R128PLL2WriteUpdate(pScrn);
- R128PLL2WaitForReadUpdateComplete(pScrn);
-
- OUTPLL(R128_HTOTAL2_CNTL, restore->htotal_cntl2);
-
-/* R128PLL2WriteUpdate(pScrn);*/
-
- OUTPLLP(pScrn, R128_P2PLL_CNTL, 0, ~(R128_P2PLL_RESET
- | R128_P2PLL_SLEEP
- | R128_P2PLL_ATOMIC_UPDATE_EN
- | R128_P2PLL_VGA_ATOMIC_UPDATE_EN));
-
- R128TRACE(("Wrote: 0x%08x 0x%08x 0x%08x (0x%08x)\n",
- restore->p2pll_ref_div,
- restore->p2pll_div_0,
- restore->htotal_cntl2,
- INPLL(pScrn, R128_P2PLL_CNTL)));
- R128TRACE(("Wrote: rd=%d, fd=%d, pd=%d\n",
- restore->p2pll_ref_div & R128_P2PLL_REF_DIV_MASK,
- restore->p2pll_div_0 & R128_P2PLL_FB0_DIV_MASK,
- (restore->p2pll_div_0 & R128_P2PLL_POST0_DIV_MASK) >>16));
-
- usleep(5000); /* Let the clock to lock */
-
- OUTPLLP(pScrn, R128_V2CLK_VCLKTV_CNTL,
- R128_V2CLK_SRC_SEL_P2PLLCLK,
- ~R128_V2CLK_SRC_SEL_MASK);
-
-}
-
/* Write DDA registers. */
-static void R128RestoreDDARegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
+void R128RestoreDDARegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
@@ -3074,7 +2229,7 @@ static void R128RestoreDDARegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
}
/* Write DDA registers. */
-static void R128RestoreDDA2Registers(ScrnInfoPtr pScrn, R128SavePtr restore)
+void R128RestoreDDA2Registers(ScrnInfoPtr pScrn, R128SavePtr restore)
{
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
@@ -3083,126 +2238,6 @@ static void R128RestoreDDA2Registers(ScrnInfoPtr pScrn, R128SavePtr restore)
OUTREG(R128_DDA2_ON_OFF, restore->dda2_on_off);
}
-/* Write palette data. */
-static void R128RestorePalette(ScrnInfoPtr pScrn, R128SavePtr restore)
-{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- int i;
-
- if (!restore->palette_valid) return;
-
- PAL_SELECT(1);
- OUTPAL_START(0);
- for (i = 0; i < 256; i++) {
- R128WaitForFifo(pScrn, 32); /* delay */
- OUTPAL_NEXT_CARD32(restore->palette2[i]);
- }
-
- PAL_SELECT(0);
- OUTPAL_START(0);
- for (i = 0; i < 256; i++) {
- R128WaitForFifo(pScrn, 32); /* delay */
- OUTPAL_NEXT_CARD32(restore->palette[i]);
- }
-
-}
-
-/* Write out state to define a new video mode. */
-static void R128RestoreMode(ScrnInfoPtr pScrn, R128SavePtr restore)
-{
- R128InfoPtr info = R128PTR(pScrn);
- DevUnion* pPriv;
- R128EntPtr pR128Ent;
- static R128SaveRec restore0;
-
- R128TRACE(("R128RestoreMode(%p)\n", restore));
- if(!info->HasCRTC2)
- {
- R128RestoreCommonRegisters(pScrn, restore);
- R128RestoreDDARegisters(pScrn, restore);
- R128RestoreCrtcRegisters(pScrn, restore);
- if((info->DisplayType == MT_DFP) ||
- (info->DisplayType == MT_LCD))
- {
- R128RestoreFPRegisters(pScrn, restore);
- }
- R128RestorePLLRegisters(pScrn, restore);
- return;
- }
-
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
- getR128EntityIndex());
- pR128Ent = pPriv->ptr;
-
-
- /*****
- When changing mode with Dual-head card (VE/M6), care must
- be taken for the special order in setting registers. CRTC2 has
- to be set before changing CRTC_EXT register.
- In the dual-head setup, X server calls this routine twice with
- primary and secondary pScrn pointers respectively. The calls
- can come with different order. Regardless the order of X server issuing
- the calls, we have to ensure we set registers in the right order!!!
- Otherwise we may get a blank screen.
- *****/
-
- if(info->IsSecondary)
- {
- if (!pR128Ent->RestorePrimary && !info->SwitchingMode)
- R128RestoreCommonRegisters(pScrn, restore);
- R128RestoreDDA2Registers(pScrn, restore);
- R128RestoreCrtc2Registers(pScrn, restore);
- R128RestorePLL2Registers(pScrn, restore);
-
- if(info->SwitchingMode) return;
-
- pR128Ent->IsSecondaryRestored = TRUE;
-
- if(pR128Ent->RestorePrimary)
- {
- R128InfoPtr info0 = R128PTR(pR128Ent->pPrimaryScrn);
- pR128Ent->RestorePrimary = FALSE;
-
- R128RestoreCrtcRegisters(pScrn, &restore0);
- if((info0->DisplayType == MT_DFP) ||
- (info0->DisplayType == MT_LCD))
- {
- R128RestoreFPRegisters(pScrn, &restore0);
- }
-
- R128RestorePLLRegisters(pScrn, &restore0);
- pR128Ent->IsSecondaryRestored = FALSE;
-
- }
- }
- else
- {
- if (!pR128Ent->IsSecondaryRestored)
- R128RestoreCommonRegisters(pScrn, restore);
- R128RestoreDDARegisters(pScrn, restore);
- if(!pR128Ent->HasSecondary || pR128Ent->IsSecondaryRestored
- || info->SwitchingMode)
- {
- pR128Ent->IsSecondaryRestored = FALSE;
- R128RestoreCrtcRegisters(pScrn, restore);
- if((info->DisplayType == MT_DFP) ||
- (info->DisplayType == MT_LCD))
- {
- R128RestoreFPRegisters(pScrn, restore);
- }
- R128RestorePLLRegisters(pScrn, restore);
- }
- else
- {
- memcpy(&restore0, restore, sizeof(restore0));
- pR128Ent->RestorePrimary = TRUE;
- }
- }
-
- R128RestorePalette(pScrn, restore);
-}
-
/* Read common registers. */
static void R128SaveCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
{
@@ -3249,8 +2284,6 @@ static void R128SaveFPRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- if (info->BIOSDisplay != R128_DUALHEAD)
- save->crtc2_gen_cntl = INREG(R128_CRTC2_GEN_CNTL);
save->fp_crtc_h_total_disp = INREG(R128_FP_CRTC_H_TOTAL_DISP);
save->fp_crtc_v_total_disp = INREG(R128_FP_CRTC_V_TOTAL_DISP);
save->fp_gen_cntl = INREG(R128_FP_GEN_CNTL);
@@ -3285,16 +2318,20 @@ static void R128SavePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
{
save->ppll_ref_div = INPLL(pScrn, R128_PPLL_REF_DIV);
save->ppll_div_3 = INPLL(pScrn, R128_PPLL_DIV_3);
+ save->ppll_div_0 = INPLL(pScrn, R128_PPLL_DIV_0);
save->htotal_cntl = INPLL(pScrn, R128_HTOTAL_CNTL);
- R128TRACE(("Read: 0x%08x 0x%08x 0x%08x\n",
- save->ppll_ref_div,
- save->ppll_div_3,
- save->htotal_cntl));
- R128TRACE(("Read: rd=%d, fd=%d, pd=%d\n",
- save->ppll_ref_div & R128_PPLL_REF_DIV_MASK,
- save->ppll_div_3 & R128_PPLL_FB3_DIV_MASK,
- (save->ppll_div_3 & R128_PPLL_POST3_DIV_MASK) >> 16));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Read: 0x%08x 0x%08x 0x%08x\n",
+ save->ppll_ref_div,
+ save->ppll_div_3,
+ save->htotal_cntl));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Read: rd=%d, fd=%d, pd=%d\n",
+ save->ppll_ref_div & R128_PPLL_REF_DIV_MASK,
+ save->ppll_div_3 & R128_PPLL_FB3_DIV_MASK,
+ (save->ppll_div_3 &
+ R128_PPLL_POST3_DIV_MASK) >> 16));
}
/* Read PLL2 registers. */
@@ -3304,14 +2341,17 @@ static void R128SavePLL2Registers(ScrnInfoPtr pScrn, R128SavePtr save)
save->p2pll_div_0 = INPLL(pScrn, R128_P2PLL_DIV_0);
save->htotal_cntl2 = INPLL(pScrn, R128_HTOTAL2_CNTL);
- R128TRACE(("Read: 0x%08x 0x%08x 0x%08x\n",
- save->p2pll_ref_div,
- save->p2pll_div_0,
- save->htotal_cntl2));
- R128TRACE(("Read: rd=%d, fd=%d, pd=%d\n",
- save->p2pll_ref_div & R128_P2PLL_REF_DIV_MASK,
- save->p2pll_div_0 & R128_P2PLL_FB0_DIV_MASK,
- (save->p2pll_div_0 & R128_P2PLL_POST0_DIV_MASK) >> 16));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Read: 0x%08x 0x%08x 0x%08x\n",
+ save->p2pll_ref_div,
+ save->p2pll_div_0,
+ save->htotal_cntl2));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Read: rd=%d, fd=%d, pd=%d\n",
+ save->p2pll_ref_div & R128_P2PLL_REF_DIV_MASK,
+ save->p2pll_div_0 & R128_P2PLL_FB0_DIV_MASK,
+ (save->p2pll_div_0 &
+ R128_P2PLL_POST0_DIV_MASK) >> 16));
}
/* Read DDA registers. */
@@ -3354,30 +2394,27 @@ static void R128SavePalette(ScrnInfoPtr pScrn, R128SavePtr save)
static void R128SaveMode(ScrnInfoPtr pScrn, R128SavePtr save)
{
R128InfoPtr info = R128PTR(pScrn);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
- R128TRACE(("R128SaveMode(%p)\n", save));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s(%p)\n", __func__, save));
- if(info->IsSecondary)
- {
+ R128SaveCommonRegisters(pScrn, save);
+ R128SaveCrtcRegisters(pScrn, save);
+ R128SavePLLRegisters(pScrn, save);
+ R128SaveDDARegisters(pScrn, save);
+ if (pR128Ent->HasCRTC2) {
R128SaveCrtc2Registers(pScrn, save);
R128SavePLL2Registers(pScrn, save);
R128SaveDDA2Registers(pScrn, save);
}
- else
- {
- R128SaveCommonRegisters(pScrn, save);
- R128SaveCrtcRegisters(pScrn, save);
- if((info->DisplayType == MT_DFP) ||
- (info->DisplayType == MT_LCD))
- {
- R128SaveFPRegisters(pScrn, save);
- }
- R128SavePLLRegisters(pScrn, save);
- R128SaveDDARegisters(pScrn, save);
- R128SavePalette(pScrn, save);
+ if (info->HasPanelRegs) {
+ R128SaveFPRegisters(pScrn, save);
}
+ R128SavePalette(pScrn, save);
- R128TRACE(("R128SaveMode returns %p\n", save));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s returns %p\n", __func__, save));
}
/* Save everything needed to restore the original VC state. */
@@ -3387,52 +2424,52 @@ static void R128Save(ScrnInfoPtr pScrn)
unsigned char *R128MMIO = info->MMIO;
R128SavePtr save = &info->SavedReg;
- R128TRACE(("R128Save\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s\n", __func__));
if (info->FBDev) {
fbdevHWSave(pScrn);
return;
}
- if (!info->IsSecondary) {
#ifdef WITH_VGAHW
- if (info->VGAAccess) {
- vgaHWPtr hwp = VGAHWPTR(pScrn);
+ if (info->VGAAccess) {
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
- vgaHWUnlock(hwp);
+ vgaHWUnlock(hwp);
# if defined(__powerpc__)
- /* temporary hack to prevent crashing on PowerMacs when trying to
- * read VGA fonts and colormap, will find a better solution
- * in the future. TODO: Check if there's actually some VGA stuff
- * setup in the card at all !!
- */
- vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* Save mode only */
+ /* temporary hack to prevent crashing on PowerMacs when trying to
+ * read VGA fonts and colormap, will find a better solution
+ * in the future. TODO: Check if there's actually some VGA stuff
+ * setup in the card at all !!
+ */
+ vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* Save mode only */
# else
- /* Save mode * & fonts & cmap */
- vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS);
+ /* Save mode * & fonts & cmap */
+ vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS);
# endif
- vgaHWLock(hwp);
- }
+ vgaHWLock(hwp);
+ }
#endif
- save->dp_datatype = INREG(R128_DP_DATATYPE);
- save->gen_reset_cntl = INREG(R128_GEN_RESET_CNTL);
- save->clock_cntl_index = INREG(R128_CLOCK_CNTL_INDEX);
- save->amcgpio_en_reg = INREG(R128_AMCGPIO_EN_REG);
- save->amcgpio_mask = INREG(R128_AMCGPIO_MASK);
- }
+ save->dp_datatype = INREG(R128_DP_DATATYPE);
+ save->gen_reset_cntl = INREG(R128_GEN_RESET_CNTL);
+ save->clock_cntl_index = INREG(R128_CLOCK_CNTL_INDEX);
+ save->amcgpio_en_reg = INREG(R128_AMCGPIO_EN_REG);
+ save->amcgpio_mask = INREG(R128_AMCGPIO_MASK);
R128SaveMode(pScrn, save);
-
}
/* Restore the original (text) mode. */
static void R128Restore(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
unsigned char *R128MMIO = info->MMIO;
R128SavePtr restore = &info->SavedReg;
- R128TRACE(("R128Restore\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s\n", __func__));
if (info->FBDev) {
fbdevHWRestore(pScrn);
return;
@@ -3440,47 +2477,39 @@ static void R128Restore(ScrnInfoPtr pScrn)
R128Blank(pScrn);
- R128RestoreMode(pScrn, restore);
-
- if (!info->IsSecondary) {
- OUTREG(R128_AMCGPIO_MASK, restore->amcgpio_mask);
- OUTREG(R128_AMCGPIO_EN_REG, restore->amcgpio_en_reg);
- OUTREG(R128_CLOCK_CNTL_INDEX, restore->clock_cntl_index);
- OUTREG(R128_GEN_RESET_CNTL, restore->gen_reset_cntl);
- OUTREG(R128_DP_DATATYPE, restore->dp_datatype);
+ R128RestoreCommonRegisters(pScrn, restore);
+ if (pR128Ent->HasCRTC2) {
+ R128RestoreDDA2Registers(pScrn, restore);
+ R128RestoreCrtc2Registers(pScrn, restore);
+ R128RestorePLL2Registers(pScrn, restore);
}
+ R128RestoreDDARegisters(pScrn, restore);
+ R128RestoreCrtcRegisters(pScrn, restore);
+ R128RestorePLLRegisters(pScrn, restore);
+ R128RestoreDACRegisters(pScrn, restore);
+ R128RestoreRMXRegisters(pScrn, restore);
+ R128RestoreFPRegisters(pScrn, restore);
+ R128RestoreLVDSRegisters(pScrn, restore);
+
+ OUTREG(R128_AMCGPIO_MASK, restore->amcgpio_mask);
+ OUTREG(R128_AMCGPIO_EN_REG, restore->amcgpio_en_reg);
+ OUTREG(R128_CLOCK_CNTL_INDEX, restore->clock_cntl_index);
+ OUTREG(R128_GEN_RESET_CNTL, restore->gen_reset_cntl);
+ OUTREG(R128_DP_DATATYPE, restore->dp_datatype);
#ifdef WITH_VGAHW
if (info->VGAAccess) {
vgaHWPtr hwp = VGAHWPTR(pScrn);
- if (!info->IsSecondary) {
- vgaHWUnlock(hwp);
+ vgaHWUnlock(hwp);
# if defined(__powerpc__)
- /* Temporary hack to prevent crashing on PowerMacs when trying to
- * write VGA fonts, will find a better solution in the future
- */
- vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE );
+ /* Temporary hack to prevent crashing on PowerMacs when trying to
+ * write VGA fonts, will find a better solution in the future
+ */
+ vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE );
# else
- vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS );
+ vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS );
# endif
- vgaHWLock(hwp);
- } else {
- R128EntPtr pR128Ent = R128EntPriv(pScrn);
- ScrnInfoPtr pScrn0 = pR128Ent->pPrimaryScrn;
- R128InfoPtr info0 = R128PTR(pScrn0);
- vgaHWPtr hwp0;
-
- if (info0->VGAAccess) {
- hwp0 = VGAHWPTR(pScrn0);
- vgaHWUnlock(hwp0);
-#if defined(__powerpc__)
- vgaHWRestore(pScrn0, &hwp0->SavedReg, VGA_SR_MODE);
-#else
- vgaHWRestore(pScrn0, &hwp0->SavedReg, VGA_SR_MODE | VGA_SR_FONTS );
-#endif
- vgaHWLock(hwp0);
- }
- }
+ vgaHWLock(hwp);
}
#endif
@@ -3489,7 +2518,7 @@ static void R128Restore(ScrnInfoPtr pScrn)
}
/* Define common registers for requested video mode. */
-static void R128InitCommonRegisters(R128SavePtr save, R128InfoPtr info)
+void R128InitCommonRegisters(R128SavePtr save, R128InfoPtr info)
{
save->ovr_clr = 0;
save->ovr_wid_left_right = 0;
@@ -3515,257 +2544,37 @@ static void R128InitCommonRegisters(R128SavePtr save, R128InfoPtr info)
save->bus_cntl |= R128_BUS_RD_DISCARD_EN | R128_BUS_RD_ABORT_EN;
}
-/* Define CRTC registers for requested video mode. */
-static Bool R128InitCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr save,
- DisplayModePtr mode, R128InfoPtr info)
-{
- int format;
- int hsync_start;
- int hsync_wid;
- int hsync_fudge;
- int vsync_wid;
- int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 };
- int hsync_fudge_fp[] = { 0x12, 0x11, 0x09, 0x09, 0x05, 0x05 };
-// int hsync_fudge_fp_crt[] = { 0x12, 0x10, 0x08, 0x08, 0x04, 0x04 };
-
- switch (info->CurrentLayout.pixel_code) {
- case 4: format = 1; break;
- case 8: format = 2; break;
- case 15: format = 3; break; /* 555 */
- case 16: format = 4; break; /* 565 */
- case 24: format = 5; break; /* RGB */
- case 32: format = 6; break; /* xRGB */
- default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Unsupported pixel depth (%d)\n",
- info->CurrentLayout.bitsPerPixel);
- return FALSE;
- }
-
- if ((info->DisplayType == MT_DFP) ||
- (info->DisplayType == MT_LCD))
- hsync_fudge = hsync_fudge_fp[format-1];
- else
- hsync_fudge = hsync_fudge_default[format-1];
-
- save->crtc_gen_cntl = (R128_CRTC_EXT_DISP_EN
- | R128_CRTC_EN
- | (format << 8)
- | ((mode->Flags & V_DBLSCAN)
- ? R128_CRTC_DBL_SCAN_EN
- : 0)
- | ((mode->Flags & V_INTERLACE)
- ? R128_CRTC_INTERLACE_EN
- : 0)
- | ((mode->Flags & V_CSYNC)
- ? R128_CRTC_CSYNC_EN
- : 0));
-
- if((info->DisplayType == MT_DFP) ||
- (info->DisplayType == MT_LCD))
- {
- save->crtc_ext_cntl = R128_VGA_ATI_LINEAR |
- R128_XCRT_CNT_EN;
- save->crtc_gen_cntl &= ~(R128_CRTC_DBL_SCAN_EN |
- R128_CRTC_INTERLACE_EN);
- }
- else
- save->crtc_ext_cntl = R128_VGA_ATI_LINEAR |
- R128_XCRT_CNT_EN |
- R128_CRTC_CRT_ON;
-
- save->dac_cntl = (R128_DAC_MASK_ALL
- | R128_DAC_VGA_ADR_EN
- | (info->dac6bits ? 0 : R128_DAC_8BIT_EN));
-
-
- if(info->isDFP && !info->isPro2)
- {
- if(info->PanelXRes < mode->CrtcHDisplay)
- mode->HDisplay = mode->CrtcHDisplay = info->PanelXRes;
- if(info->PanelYRes < mode->CrtcVDisplay)
- mode->VDisplay = mode->CrtcVDisplay = info->PanelYRes;
- mode->CrtcHTotal = mode->CrtcHDisplay + info->HBlank;
- mode->CrtcHSyncStart = mode->CrtcHDisplay + info->HOverPlus;
- mode->CrtcHSyncEnd = mode->CrtcHSyncStart + info->HSyncWidth;
- mode->CrtcVTotal = mode->CrtcVDisplay + info->VBlank;
- mode->CrtcVSyncStart = mode->CrtcVDisplay + info->VOverPlus;
- mode->CrtcVSyncEnd = mode->CrtcVSyncStart + info->VSyncWidth;
- }
-
- save->crtc_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0xffff)
- | (((mode->CrtcHDisplay / 8) - 1) << 16));
-
- hsync_wid = (mode->CrtcHSyncEnd - mode->CrtcHSyncStart) / 8;
- if (!hsync_wid) hsync_wid = 1;
- if (hsync_wid > 0x3f) hsync_wid = 0x3f;
-
- hsync_start = mode->CrtcHSyncStart - 8 + hsync_fudge;
-
- save->crtc_h_sync_strt_wid = ((hsync_start & 0xfff)
- | (hsync_wid << 16)
- | ((mode->Flags & V_NHSYNC)
- ? R128_CRTC_H_SYNC_POL
- : 0));
-
-#if 1
- /* This works for double scan mode. */
- save->crtc_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff)
- | ((mode->CrtcVDisplay - 1) << 16));
-#else
- /* This is what cce/nbmode.c example code
- does -- is this correct? */
- save->crtc_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff)
- | ((mode->CrtcVDisplay
- * ((mode->Flags & V_DBLSCAN) ? 2 : 1) - 1)
- << 16));
-#endif
-
- vsync_wid = mode->CrtcVSyncEnd - mode->CrtcVSyncStart;
- if (!vsync_wid) vsync_wid = 1;
- if (vsync_wid > 0x1f) vsync_wid = 0x1f;
-
- save->crtc_v_sync_strt_wid = (((mode->CrtcVSyncStart - 1) & 0xfff)
- | (vsync_wid << 16)
- | ((mode->Flags & V_NVSYNC)
- ? R128_CRTC_V_SYNC_POL
- : 0));
- save->crtc_offset = 0;
- save->crtc_offset_cntl = 0;
- save->crtc_pitch = info->CurrentLayout.displayWidth / 8;
-
- R128TRACE(("Pitch = %d bytes (virtualX = %d, displayWidth = %d)\n",
- save->crtc_pitch, pScrn->virtualX, info->CurrentLayout.displayWidth));
-
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- /* Change the endianness of the aperture */
- switch (info->CurrentLayout.pixel_code) {
- case 15:
- case 16: save->config_cntl |= APER_0_BIG_ENDIAN_16BPP_SWAP; break;
- case 32: save->config_cntl |= APER_0_BIG_ENDIAN_32BPP_SWAP; break;
- default: break;
- }
-#endif
-
- return TRUE;
-}
-
-/* Define CRTC2 registers for requested video mode. */
-static Bool R128InitCrtc2Registers(ScrnInfoPtr pScrn, R128SavePtr save,
- DisplayModePtr mode, R128InfoPtr info)
+/* Define RMX registers for the requested video mode. */
+void R128InitRMXRegisters(R128SavePtr orig, R128SavePtr save,
+ xf86OutputPtr output, DisplayModePtr mode)
{
- int format;
- int hsync_start;
- int hsync_wid;
- int hsync_fudge;
- int vsync_wid;
- int bytpp;
- int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 };
+ R128OutputPrivatePtr r128_output = output->driver_private;
- switch (info->CurrentLayout.pixel_code) {
- case 4: format = 1; bytpp = 0; break;
- case 8: format = 2; bytpp = 1; break;
- case 15: format = 3; bytpp = 2; break; /* 555 */
- case 16: format = 4; bytpp = 2; break; /* 565 */
- case 24: format = 5; bytpp = 3; break; /* RGB */
- case 32: format = 6; bytpp = 4; break; /* xRGB */
- default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Unsupported pixel depth (%d)\n", info->CurrentLayout.bitsPerPixel);
- return FALSE;
- }
- R128TRACE(("Format = %d (%d bytes per pixel)\n", format, bytpp));
-
- hsync_fudge = hsync_fudge_default[format-1];
-
- save->crtc2_gen_cntl = (R128_CRTC2_EN
- | (format << 8)
- | ((mode->Flags & V_DBLSCAN)
- ? R128_CRTC2_DBL_SCAN_EN
- : 0));
-/*
- save->crtc2_gen_cntl &= ~R128_CRTC_EXT_DISP_EN;
- save->crtc2_gen_cntl |= (1 << 21);
-*/
- save->crtc2_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0xffff)
- | (((mode->CrtcHDisplay / 8) - 1) << 16));
-
- hsync_wid = (mode->CrtcHSyncEnd - mode->CrtcHSyncStart) / 8;
- if (!hsync_wid) hsync_wid = 1;
- if (hsync_wid > 0x3f) hsync_wid = 0x3f;
-
- hsync_start = mode->CrtcHSyncStart - 8 + hsync_fudge;
-
- save->crtc2_h_sync_strt_wid = ((hsync_start & 0xfff)
- | (hsync_wid << 16)
- | ((mode->Flags & V_NHSYNC)
- ? R128_CRTC2_H_SYNC_POL
- : 0));
-
-#if 1
- /* This works for double scan mode. */
- save->crtc2_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff)
- | ((mode->CrtcVDisplay - 1) << 16));
-#else
- /* This is what cce/nbmode.c example code
- does -- is this correct? */
- save->crtc2_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff)
- | ((mode->CrtcVDisplay
- * ((mode->Flags & V_DBLSCAN) ? 2 : 1) - 1)
- << 16));
-#endif
-
- vsync_wid = mode->CrtcVSyncEnd - mode->CrtcVSyncStart;
- if (!vsync_wid) vsync_wid = 1;
- if (vsync_wid > 0x1f) vsync_wid = 0x1f;
-
- save->crtc2_v_sync_strt_wid = (((mode->CrtcVSyncStart - 1) & 0xfff)
- | (vsync_wid << 16)
- | ((mode->Flags & V_NVSYNC)
- ? R128_CRTC2_V_SYNC_POL
- : 0));
-
- save->crtc2_offset = 0;
- save->crtc2_offset_cntl = 0;
-
- save->crtc2_pitch = info->CurrentLayout.displayWidth / 8;
-
- R128TRACE(("Pitch = %d bytes (virtualX = %d, displayWidth = %d)\n",
- save->crtc2_pitch, pScrn->virtualX,
- info->CurrentLayout.displayWidth));
- return TRUE;
-}
-
-/* Define CRTC registers for requested video mode. */
-static void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save,
- DisplayModePtr mode, R128InfoPtr info)
-{
int xres = mode->CrtcHDisplay;
int yres = mode->CrtcVDisplay;
float Hratio, Vratio;
- if (info->BIOSDisplay == R128_BIOS_DISPLAY_CRT) {
- save->crtc_ext_cntl |= R128_CRTC_CRT_ON;
- save->crtc2_gen_cntl = 0;
- save->fp_gen_cntl = orig->fp_gen_cntl;
- save->fp_gen_cntl &= ~(R128_FP_FPON |
- R128_FP_CRTC_USE_SHADOW_VEND |
- R128_FP_CRTC_HORZ_DIV2_EN |
- R128_FP_CRTC_HOR_CRT_DIV2_DIS |
- R128_FP_USE_SHADOW_EN);
- save->fp_gen_cntl |= (R128_FP_SEL_CRTC2 |
- R128_FP_CRTC_DONT_SHADOW_VPAR);
- save->fp_panel_cntl = orig->fp_panel_cntl & (CARD32)~R128_FP_DIGON;
- save->lvds_gen_cntl = orig->lvds_gen_cntl &
- (CARD32)~(R128_LVDS_ON | R128_LVDS_BLON);
+ save->fp_crtc_h_total_disp = save->crtc_h_total_disp;
+ save->fp_crtc_v_total_disp = save->crtc_v_total_disp;
+ save->fp_h_sync_strt_wid = save->crtc_h_sync_strt_wid;
+ save->fp_v_sync_strt_wid = save->crtc_v_sync_strt_wid;
+
+ if (r128_output->MonType != MT_DFP && r128_output->MonType != MT_LCD)
return;
- }
- if (xres > info->PanelXRes) xres = info->PanelXRes;
- if (yres > info->PanelYRes) yres = info->PanelYRes;
+ if (r128_output->PanelXRes == 0 || r128_output->PanelYRes == 0) {
+ xres = r128_output->PanelXRes;
+ yres = r128_output->PanelYRes;
- Hratio = (float)xres/(float)info->PanelXRes;
- Vratio = (float)yres/(float)info->PanelYRes;
+ Hratio = 1.0;
+ Vratio = 1.0;
+ } else {
+ if (xres > r128_output->PanelXRes) xres = r128_output->PanelXRes;
+ if (yres > r128_output->PanelYRes) yres = r128_output->PanelYRes;
+
+ Hratio = (float)xres/(float)r128_output->PanelXRes;
+ Vratio = (float)yres/(float)r128_output->PanelYRes;
+ }
save->fp_horz_stretch =
(((((int)(Hratio * R128_HORZ_STRETCH_RATIO_MAX + 0.5))
@@ -3775,7 +2584,7 @@ static void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save,
R128_HORZ_STRETCH_RESERVED)));
save->fp_horz_stretch &= ~R128_HORZ_AUTO_RATIO_FIX_EN;
save->fp_horz_stretch &= ~R128_AUTO_HORZ_RATIO;
- if (xres == info->PanelXRes)
+ if (xres == r128_output->PanelXRes)
save->fp_horz_stretch &= ~(R128_HORZ_STRETCH_BLEND | R128_HORZ_STRETCH_ENABLE);
else
save->fp_horz_stretch |= (R128_HORZ_STRETCH_BLEND | R128_HORZ_STRETCH_ENABLE);
@@ -3786,312 +2595,56 @@ static void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save,
(orig->fp_vert_stretch & (R128_VERT_PANEL_SIZE |
R128_VERT_STRETCH_RESERVED)));
save->fp_vert_stretch &= ~R128_VERT_AUTO_RATIO_EN;
- if (yres == info->PanelYRes)
+ if (yres == r128_output->PanelYRes)
save->fp_vert_stretch &= ~(R128_VERT_STRETCH_ENABLE | R128_VERT_STRETCH_BLEND);
else
save->fp_vert_stretch |= (R128_VERT_STRETCH_ENABLE | R128_VERT_STRETCH_BLEND);
-
- save->fp_gen_cntl = (orig->fp_gen_cntl &
- (CARD32)~(R128_FP_SEL_CRTC2 |
- R128_FP_CRTC_USE_SHADOW_VEND |
- R128_FP_CRTC_HORZ_DIV2_EN |
- R128_FP_CRTC_HOR_CRT_DIV2_DIS |
- R128_FP_USE_SHADOW_EN));
-
- save->fp_panel_cntl = orig->fp_panel_cntl;
- save->lvds_gen_cntl = orig->lvds_gen_cntl;
- save->tmds_crc = orig->tmds_crc;
-
- /* Disable CRT output by disabling CRT output and setting the CRT
- DAC to use CRTC2, which we set to 0's. In the future, we will
- want to use the dual CRTC capabilities of the R128 to allow both
- the flat panel and external CRT to either simultaneously display
- the same image or display two different images. */
-
-
- if(!info->isDFP){
- if (info->BIOSDisplay == R128_BIOS_DISPLAY_FP_CRT) {
- save->crtc_ext_cntl |= R128_CRTC_CRT_ON;
- } else if (info->BIOSDisplay == R128_DUALHEAD) {
- save->crtc_ext_cntl |= R128_CRTC_CRT_ON;
- save->dac_cntl |= R128_DAC_CRT_SEL_CRTC2;
- save->dac_cntl |= R128_DAC_PALETTE2_SNOOP_EN;
- } else {
- save->crtc_ext_cntl &= ~R128_CRTC_CRT_ON;
- save->dac_cntl |= R128_DAC_CRT_SEL_CRTC2;
- save->crtc2_gen_cntl = 0;
- }
- }
-
- /* WARNING: Be careful about turning on the flat panel */
- if(info->isDFP){
- save->fp_gen_cntl = orig->fp_gen_cntl;
-
- save->fp_gen_cntl &= ~(R128_FP_CRTC_USE_SHADOW_VEND |
- R128_FP_CRTC_USE_SHADOW_ROWCUR |
- R128_FP_CRTC_HORZ_DIV2_EN |
- R128_FP_CRTC_HOR_CRT_DIV2_DIS |
- R128_FP_CRT_SYNC_SEL |
- R128_FP_USE_SHADOW_EN);
-
- save->fp_panel_cntl |= (R128_FP_DIGON | R128_FP_BLON);
- save->fp_gen_cntl |= (R128_FP_FPON | R128_FP_TDMS_EN |
- R128_FP_CRTC_DONT_SHADOW_VPAR | R128_FP_CRTC_DONT_SHADOW_HEND);
- save->tmds_transmitter_cntl = (orig->tmds_transmitter_cntl
- & ~(CARD32)R128_TMDS_PLLRST) | R128_TMDS_PLLEN;
- }
- else
- save->lvds_gen_cntl |= (R128_LVDS_ON | R128_LVDS_BLON);
-
- save->fp_crtc_h_total_disp = save->crtc_h_total_disp;
- save->fp_crtc_v_total_disp = save->crtc_v_total_disp;
- save->fp_h_sync_strt_wid = save->crtc_h_sync_strt_wid;
- save->fp_v_sync_strt_wid = save->crtc_v_sync_strt_wid;
-}
-
-/* Define PLL registers for requested video mode. */
-static void R128InitPLLRegisters(ScrnInfoPtr pScrn, R128SavePtr save,
- R128PLLPtr pll, double dot_clock)
-{
- unsigned long freq = dot_clock * 100;
- struct {
- int divider;
- int bitvalue;
- } *post_div,
- post_divs[] = {
- /* From RAGE 128 VR/RAGE 128 GL Register
- Reference Manual (Technical Reference
- Manual P/N RRG-G04100-C Rev. 0.04), page
- 3-17 (PLL_DIV_[3:0]). */
- { 1, 0 }, /* VCLK_SRC */
- { 2, 1 }, /* VCLK_SRC/2 */
- { 4, 2 }, /* VCLK_SRC/4 */
- { 8, 3 }, /* VCLK_SRC/8 */
-
- { 3, 4 }, /* VCLK_SRC/3 */
- /* bitvalue = 5 is reserved */
- { 6, 6 }, /* VCLK_SRC/6 */
- { 12, 7 }, /* VCLK_SRC/12 */
- { 0, 0 }
- };
-
- if (freq > pll->max_pll_freq) freq = pll->max_pll_freq;
- if (freq * 12 < pll->min_pll_freq) freq = pll->min_pll_freq / 12;
-
- for (post_div = &post_divs[0]; post_div->divider; ++post_div) {
- save->pll_output_freq = post_div->divider * freq;
- if (save->pll_output_freq >= pll->min_pll_freq
- && save->pll_output_freq <= pll->max_pll_freq) break;
- }
-
- save->dot_clock_freq = freq;
- save->feedback_div = R128Div(pll->reference_div * save->pll_output_freq,
- pll->reference_freq);
- save->post_div = post_div->divider;
-
- R128TRACE(("dc=%d, of=%d, fd=%d, pd=%d\n",
- save->dot_clock_freq,
- save->pll_output_freq,
- save->feedback_div,
- save->post_div));
-
- save->ppll_ref_div = pll->reference_div;
- save->ppll_div_3 = (save->feedback_div | (post_div->bitvalue << 16));
- save->htotal_cntl = 0;
-
-}
-
-/* Define PLL2 registers for requested video mode. */
-static void R128InitPLL2Registers(ScrnInfoPtr pScrn, R128SavePtr save,
- R128PLLPtr pll, double dot_clock)
-{
- unsigned long freq = dot_clock * 100;
- struct {
- int divider;
- int bitvalue;
- } *post_div,
- post_divs[] = {
- /* From RAGE 128 VR/RAGE 128 GL Register
- Reference Manual (Technical Reference
- Manual P/N RRG-G04100-C Rev. 0.04), page
- 3-17 (PLL_DIV_[3:0]). */
- { 1, 0 }, /* VCLK_SRC */
- { 2, 1 }, /* VCLK_SRC/2 */
- { 4, 2 }, /* VCLK_SRC/4 */
- { 8, 3 }, /* VCLK_SRC/8 */
-
- { 3, 4 }, /* VCLK_SRC/3 */
- /* bitvalue = 5 is reserved */
- { 6, 6 }, /* VCLK_SRC/6 */
- { 12, 7 }, /* VCLK_SRC/12 */
- { 0, 0 }
- };
-
- if (freq > pll->max_pll_freq) freq = pll->max_pll_freq;
- if (freq * 12 < pll->min_pll_freq) freq = pll->min_pll_freq / 12;
-
- for (post_div = &post_divs[0]; post_div->divider; ++post_div) {
- save->pll_output_freq_2 = post_div->divider * freq;
- if (save->pll_output_freq_2 >= pll->min_pll_freq
- && save->pll_output_freq_2 <= pll->max_pll_freq) break;
- }
-
- save->dot_clock_freq_2 = freq;
- save->feedback_div_2 = R128Div(pll->reference_div
- * save->pll_output_freq_2,
- pll->reference_freq);
- save->post_div_2 = post_div->divider;
-
- R128TRACE(("dc=%d, of=%d, fd=%d, pd=%d\n",
- save->dot_clock_freq_2,
- save->pll_output_freq_2,
- save->feedback_div_2,
- save->post_div_2));
-
- save->p2pll_ref_div = pll->reference_div;
- save->p2pll_div_0 = (save->feedback_div_2 | (post_div->bitvalue<<16));
- save->htotal_cntl2 = 0;
}
-/* Define DDA registers for requested video mode. */
-static Bool R128InitDDARegisters(ScrnInfoPtr pScrn, R128SavePtr save,
- R128PLLPtr pll, R128InfoPtr info,
- DisplayModePtr mode)
+/* Define flat panel registers for the requested video mode. */
+void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output)
{
- int DisplayFifoWidth = 128;
- int DisplayFifoDepth = 32;
- int XclkFreq;
- int VclkFreq;
- int XclksPerTransfer;
- int XclksPerTransferPrecise;
- int UseablePrecision;
- int Roff;
- int Ron;
-
- XclkFreq = pll->xclk;
-
- VclkFreq = R128Div(pll->reference_freq * save->feedback_div,
- pll->reference_div * save->post_div);
-
- if(info->isDFP && !info->isPro2){
- if(info->PanelXRes != mode->CrtcHDisplay)
- VclkFreq = (VclkFreq * mode->CrtcHDisplay)/info->PanelXRes;
- }
-
- XclksPerTransfer = R128Div(XclkFreq * DisplayFifoWidth,
- VclkFreq * (info->CurrentLayout.pixel_bytes * 8));
-
- UseablePrecision = R128MinBits(XclksPerTransfer) + 1;
-
- XclksPerTransferPrecise = R128Div((XclkFreq * DisplayFifoWidth)
- << (11 - UseablePrecision),
- VclkFreq * (info->CurrentLayout.pixel_bytes * 8));
+ xf86CrtcPtr crtc = output->crtc;
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
- Roff = XclksPerTransferPrecise * (DisplayFifoDepth - 4);
-
- Ron = (4 * info->ram->MB
- + 3 * MAX(info->ram->Trcd - 2, 0)
- + 2 * info->ram->Trp
- + info->ram->Twr
- + info->ram->CL
- + info->ram->Tr2w
- + XclksPerTransfer) << (11 - UseablePrecision);
-
- if (Ron + info->ram->Rloop >= Roff) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "(Ron = %d) + (Rloop = %d) >= (Roff = %d)\n",
- Ron, info->ram->Rloop, Roff);
- return FALSE;
- }
+ /* WARNING: Be careful about turning on the flat panel */
+ save->fp_gen_cntl = orig->fp_gen_cntl;
+ save->fp_panel_cntl = orig->fp_panel_cntl;
+ save->tmds_transmitter_cntl = orig->tmds_transmitter_cntl;
+ save->tmds_crc = orig->tmds_crc;
- save->dda_config = (XclksPerTransferPrecise
- | (UseablePrecision << 16)
- | (info->ram->Rloop << 20));
+ if (r128_crtc->crtc_id)
+ save->fp_gen_cntl |= R128_FP_SEL_CRTC2;
+ else
+ save->fp_gen_cntl &= ~R128_FP_SEL_CRTC2;
- save->dda_on_off = (Ron << 16) | Roff;
+ save->fp_gen_cntl &= ~(R128_FP_CRTC_USE_SHADOW_VEND |
+ R128_FP_CRTC_USE_SHADOW_ROWCUR |
+ R128_FP_CRTC_HORZ_DIV2_EN |
+ R128_FP_CRTC_HOR_CRT_DIV2_DIS |
+ R128_FP_CRT_SYNC_SEL |
+ R128_FP_USE_SHADOW_EN);
- R128TRACE(("XclkFreq = %d; VclkFreq = %d; per = %d, %d (useable = %d)\n",
- XclkFreq,
- VclkFreq,
- XclksPerTransfer,
- XclksPerTransferPrecise,
- UseablePrecision));
- R128TRACE(("Roff = %d, Ron = %d, Rloop = %d\n",
- Roff, Ron, info->ram->Rloop));
+ save->fp_gen_cntl |= (R128_FP_CRTC_DONT_SHADOW_VPAR |
+ R128_FP_CRTC_DONT_SHADOW_HEND);
- return TRUE;
+ save->fp_panel_cntl |= (R128_FP_DIGON | R128_FP_BLON);
+ save->tmds_transmitter_cntl &= ~R128_TMDS_PLLRST;
+ save->tmds_transmitter_cntl |= R128_TMDS_PLLEN;
}
-/* Define DDA2 registers for requested video mode. */
-static Bool R128InitDDA2Registers(ScrnInfoPtr pScrn, R128SavePtr save,
- R128PLLPtr pll, R128InfoPtr info,
- DisplayModePtr mode)
+/* Define LVDS registers for the requested video mode. */
+void R128InitLVDSRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output)
{
- int DisplayFifoWidth = 128;
- int DisplayFifoDepth = 32;
- int XclkFreq;
- int VclkFreq;
- int XclksPerTransfer;
- int XclksPerTransferPrecise;
- int UseablePrecision;
- int Roff;
- int Ron;
-
- XclkFreq = pll->xclk;
-
- VclkFreq = R128Div(pll->reference_freq * save->feedback_div_2,
- pll->reference_div * save->post_div_2);
-
- if(info->isDFP && !info->isPro2){
- if(info->PanelXRes != mode->CrtcHDisplay)
- VclkFreq = (VclkFreq * mode->CrtcHDisplay)/info->PanelXRes;
- }
-
- XclksPerTransfer = R128Div(XclkFreq * DisplayFifoWidth,
- VclkFreq * (info->CurrentLayout.pixel_bytes * 8));
-
- UseablePrecision = R128MinBits(XclksPerTransfer) + 1;
-
- XclksPerTransferPrecise = R128Div((XclkFreq * DisplayFifoWidth)
- << (11 - UseablePrecision),
- VclkFreq * (info->CurrentLayout.pixel_bytes * 8));
+ xf86CrtcPtr crtc = output->crtc;
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
- Roff = XclksPerTransferPrecise * (DisplayFifoDepth - 4);
+ save->lvds_gen_cntl = orig->lvds_gen_cntl;
- Ron = (4 * info->ram->MB
- + 3 * MAX(info->ram->Trcd - 2, 0)
- + 2 * info->ram->Trp
- + info->ram->Twr
- + info->ram->CL
- + info->ram->Tr2w
- + XclksPerTransfer) << (11 - UseablePrecision);
-
-
- if (Ron + info->ram->Rloop >= Roff) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "(Ron = %d) + (Rloop = %d) >= (Roff = %d)\n",
- Ron, info->ram->Rloop, Roff);
- return FALSE;
- }
-
- save->dda2_config = (XclksPerTransferPrecise
- | (UseablePrecision << 16)
- | (info->ram->Rloop << 20));
-
- /*save->dda2_on_off = (Ron << 16) | Roff;*/
- /* shift most be 18 otherwise there's corruption on crtc2 */
- save->dda2_on_off = (Ron << 18) | Roff;
-
- R128TRACE(("XclkFreq = %d; VclkFreq = %d; per = %d, %d (useable = %d)\n",
- XclkFreq,
- VclkFreq,
- XclksPerTransfer,
- XclksPerTransferPrecise,
- UseablePrecision));
- R128TRACE(("Roff = %d, Ron = %d, Rloop = %d\n",
- Roff, Ron, info->ram->Rloop));
-
- return TRUE;
+ if (r128_crtc->crtc_id)
+ save->lvds_gen_cntl |= R128_LVDS_SEL_CRTC2;
+ else
+ save->lvds_gen_cntl &= ~R128_LVDS_SEL_CRTC2;
}
#if 0
@@ -4103,122 +2656,6 @@ static void R128InitPalette(R128SavePtr save)
}
#endif
-/* Define registers for a requested video mode. */
-static Bool R128Init(ScrnInfoPtr pScrn, DisplayModePtr mode, R128SavePtr save)
-{
- R128InfoPtr info = R128PTR(pScrn);
- double dot_clock = mode->Clock/1000.0;
-
-#if R128_DEBUG
- ErrorF("%-12.12s %7.2f %4d %4d %4d %4d %4d %4d %4d %4d (%d,%d)",
- mode->name,
- dot_clock,
-
- mode->HDisplay,
- mode->HSyncStart,
- mode->HSyncEnd,
- mode->HTotal,
-
- mode->VDisplay,
- mode->VSyncStart,
- mode->VSyncEnd,
- mode->VTotal,
- pScrn->depth,
- pScrn->bitsPerPixel);
- if (mode->Flags & V_DBLSCAN) ErrorF(" D");
- if (mode->Flags & V_CSYNC) ErrorF(" C");
- if (mode->Flags & V_INTERLACE) ErrorF(" I");
- if (mode->Flags & V_PHSYNC) ErrorF(" +H");
- if (mode->Flags & V_NHSYNC) ErrorF(" -H");
- if (mode->Flags & V_PVSYNC) ErrorF(" +V");
- if (mode->Flags & V_NVSYNC) ErrorF(" -V");
- ErrorF("\n");
- ErrorF("%-12.12s %7.2f %4d %4d %4d %4d %4d %4d %4d %4d (%d,%d)",
- mode->name,
- dot_clock,
-
- mode->CrtcHDisplay,
- mode->CrtcHSyncStart,
- mode->CrtcHSyncEnd,
- mode->CrtcHTotal,
-
- mode->CrtcVDisplay,
- mode->CrtcVSyncStart,
- mode->CrtcVSyncEnd,
- mode->CrtcVTotal,
- pScrn->depth,
- pScrn->bitsPerPixel);
- if (mode->Flags & V_DBLSCAN) ErrorF(" D");
- if (mode->Flags & V_CSYNC) ErrorF(" C");
- if (mode->Flags & V_INTERLACE) ErrorF(" I");
- if (mode->Flags & V_PHSYNC) ErrorF(" +H");
- if (mode->Flags & V_NHSYNC) ErrorF(" -H");
- if (mode->Flags & V_PVSYNC) ErrorF(" +V");
- if (mode->Flags & V_NVSYNC) ErrorF(" -V");
- ErrorF("\n");
-#endif
-
- info->Flags = mode->Flags;
-
- if(info->IsSecondary)
- {
- if (!R128InitCrtc2Registers(pScrn, save,
- pScrn->currentMode,info))
- return FALSE;
- R128InitPLL2Registers(pScrn, save, &info->pll, dot_clock);
- if (!R128InitDDA2Registers(pScrn, save, &info->pll, info, mode))
- return FALSE;
- }
- else
- {
- R128InitCommonRegisters(save, info);
- if(!R128InitCrtcRegisters(pScrn, save, mode, info))
- return FALSE;
- if(dot_clock)
- {
- R128InitPLLRegisters(pScrn, save, &info->pll, dot_clock);
- if (!R128InitDDARegisters(pScrn, save, &info->pll, info, mode))
- return FALSE;
- }
- else
- {
- save->ppll_ref_div = info->SavedReg.ppll_ref_div;
- save->ppll_div_3 = info->SavedReg.ppll_div_3;
- save->htotal_cntl = info->SavedReg.htotal_cntl;
- save->dda_config = info->SavedReg.dda_config;
- save->dda_on_off = info->SavedReg.dda_on_off;
- }
- /* not used for now */
- /*if (!info->PaletteSavedOnVT) RADEONInitPalette(save);*/
- }
-
- if (((info->DisplayType == MT_DFP) ||
- (info->DisplayType == MT_LCD)))
- {
- R128InitFPRegisters(&info->SavedReg, save, mode, info);
- }
-
- R128TRACE(("R128Init returns %p\n", save));
- return TRUE;
-}
-
-/* Initialize a new mode. */
-static Bool R128ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
-{
- R128InfoPtr info = R128PTR(pScrn);
-
- if (!R128Init(pScrn, mode, &info->ModeReg)) return FALSE;
- /* FIXME? DRILock/DRIUnlock here? */
- pScrn->vtSema = TRUE;
- R128Blank(pScrn);
- R128RestoreMode(pScrn, &info->ModeReg);
- R128Unblank(pScrn);
-
- info->CurrentLayout.mode = mode;
-
- return TRUE;
-}
-
static Bool R128SaveScreen(ScreenPtr pScreen, int mode)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
@@ -4249,74 +2686,64 @@ Bool R128SwitchMode(SWITCH_MODE_ARGS_DECL)
Bool ret;
info->SwitchingMode = TRUE;
- ret = R128ModeInit(pScrn, mode);
+ ret = xf86SetSingleMode(pScrn, mode, RR_Rotate_0);
info->SwitchingMode = FALSE;
return ret;
}
-/* Used to disallow modes that are not supported by the hardware. */
-ModeStatus R128ValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode,
- Bool verbose, int flags)
+ModeStatus R128DoValidMode(xf86OutputPtr output, DisplayModePtr mode, int flags)
{
- SCRN_INFO_PTR(arg);
- R128InfoPtr info = R128PTR(pScrn);
+ ScrnInfoPtr pScrn = output->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128OutputPrivatePtr r128_output = output->driver_private;
+ int i, j;
- if (info->BIOSDisplay == R128_BIOS_DISPLAY_CRT)
- return MODE_OK;
+ if (r128_output->MonType == MT_CRT)
+ return MODE_OK;
- if(info->isDFP) {
- if(info->PanelXRes < mode->CrtcHDisplay ||
- info->PanelYRes < mode->CrtcVDisplay)
- return MODE_NOMODE;
- else
- return MODE_OK;
- }
-
- if (info->DisplayType == MT_LCD) {
+ if (r128_output->MonType == MT_DFP || r128_output->MonType == MT_LCD) {
if (mode->Flags & V_INTERLACE) return MODE_NO_INTERLACE;
if (mode->Flags & V_DBLSCAN) return MODE_NO_DBLESCAN;
}
- if (info->DisplayType == MT_LCD &&
- info->VBIOS) {
- int i;
- for (i = info->FPBIOSstart+64; R128_BIOS16(i) != 0; i += 2) {
- int j = R128_BIOS16(i);
+ if (r128_output->MonType == MT_LCD && info->VBIOS) {
+ for (i = info->FPBIOSstart + 64; R128_BIOS16(i) != 0; i += 2) {
+ j = R128_BIOS16(i);
if (mode->CrtcHDisplay == R128_BIOS16(j) &&
- mode->CrtcVDisplay == R128_BIOS16(j+2)) {
+ mode->CrtcVDisplay == R128_BIOS16(j + 2)) {
if ((flags & MODECHECK_FINAL) == MODECHECK_FINAL) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Modifying mode according to VBIOS: %ix%i [pclk %.1f MHz] for FP to: ",
- mode->CrtcHDisplay,mode->CrtcVDisplay,
- (float)mode->Clock/1000);
+ mode->CrtcHDisplay, mode->CrtcVDisplay,
+ (float)mode->Clock / 1000);
/* Assume we are using expanded mode */
- if (R128_BIOS16(j+5)) j = R128_BIOS16(j+5);
- else j += 9;
+ if (R128_BIOS16(j + 5)) j = R128_BIOS16(j + 5);
+ else j += 9;
- mode->Clock = (CARD32)R128_BIOS16(j) * 10;
+ mode->Clock = (uint32_t)R128_BIOS16(j) * 10;
mode->HDisplay = mode->CrtcHDisplay =
- ((R128_BIOS16(j+10) & 0x01ff)+1)*8;
+ ((R128_BIOS16(j + 10) & 0x01ff) + 1) * 8;
mode->HSyncStart = mode->CrtcHSyncStart =
- ((R128_BIOS16(j+12) & 0x01ff)+1)*8;
+ ((R128_BIOS16(j + 12) & 0x01ff) + 1) * 8;
mode->HSyncEnd = mode->CrtcHSyncEnd =
- mode->CrtcHSyncStart + (R128_BIOS8(j+14) & 0x1f);
+ mode->CrtcHSyncStart + (R128_BIOS8(j + 14) & 0x1f);
mode->HTotal = mode->CrtcHTotal =
- ((R128_BIOS16(j+8) & 0x01ff)+1)*8;
+ ((R128_BIOS16(j + 8) & 0x01ff) + 1) * 8;
mode->VDisplay = mode->CrtcVDisplay =
- (R128_BIOS16(j+17) & 0x07ff)+1;
+ (R128_BIOS16(j + 17) & 0x07ff) + 1;
mode->VSyncStart = mode->CrtcVSyncStart =
- (R128_BIOS16(j+19) & 0x07ff)+1;
+ (R128_BIOS16(j + 19) & 0x07ff) + 1;
mode->VSyncEnd = mode->CrtcVSyncEnd =
- mode->CrtcVSyncStart + ((R128_BIOS16(j+19) >> 11) & 0x1f);
+ mode->CrtcVSyncStart + ((R128_BIOS16(j + 19) >> 11) & 0x1f);
mode->VTotal = mode->CrtcVTotal =
- (R128_BIOS16(j+15) & 0x07ff)+1;
+ (R128_BIOS16(j + 15) & 0x07ff) + 1;
xf86ErrorF("%ix%i [pclk %.1f MHz]\n",
mode->CrtcHDisplay,mode->CrtcVDisplay,
- (float)mode->Clock/1000);
+ (float)mode->Clock/ 1000);
}
return MODE_OK;
}
@@ -4332,6 +2759,17 @@ ModeStatus R128ValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode,
return MODE_OK;
}
+/* Used to disallow modes that are not supported by the hardware. */
+ModeStatus R128ValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode,
+ Bool verbose, int flags)
+{
+ SCRN_INFO_PTR(arg);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
+ xf86OutputPtr output = R128FirstOutput(pR128Ent->pCrtc[0]);
+
+ return R128DoValidMode(output, mode, flags);
+}
+
/* Adjust viewport into virtual desktop such that (0,0) in viewport space
is (x,y) in virtual space. */
void R128AdjustFrame(ADJUST_FRAME_ARGS_DECL)
@@ -4358,14 +2796,7 @@ void R128AdjustFrame(ADJUST_FRAME_ARGS_DECL)
if (info->CurrentLayout.pixel_code == 24)
Base += 8 * (Base % 3); /* Must be multiple of 8 and 3 */
- if(info->IsSecondary)
- {
- Base += pScrn->fbOffset;
- OUTREG(R128_CRTC2_OFFSET, Base);
- }
- else
OUTREG(R128_CRTC_OFFSET, Base);
-
}
/* Called when VT switching back to the X server. Reinitialize the video
@@ -4375,11 +2806,18 @@ Bool R128EnterVT(VT_FUNC_ARGS_DECL)
SCRN_INFO_PTR(arg);
R128InfoPtr info = R128PTR(pScrn);
- R128TRACE(("R128EnterVT\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s\n", __func__));
+
+ pScrn->vtSema = TRUE;
if (info->FBDev) {
if (!fbdevHWEnterVT(VT_FUNC_ARGS)) return FALSE;
- } else
- if (!R128ModeInit(pScrn, pScrn->currentMode)) return FALSE;
+ } else {
+ if (!xf86SetDesiredModes(pScrn)) return FALSE;
+ }
+
+ //if (!R128ModeInit(pScrn, pScrn->currentMode)) return FALSE;
+
if (info->accelOn)
R128EngineInit(pScrn);
@@ -4396,7 +2834,7 @@ Bool R128EnterVT(VT_FUNC_ARGS_DECL)
#endif
info->PaletteSavedOnVT = FALSE;
- pScrn->AdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
+ //pScrn->AdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
return TRUE;
}
@@ -4409,7 +2847,8 @@ void R128LeaveVT(VT_FUNC_ARGS_DECL)
R128InfoPtr info = R128PTR(pScrn);
R128SavePtr save = &info->ModeReg;
- R128TRACE(("R128LeaveVT\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s\n", __func__));
#ifdef R128DRI
if (info->directRenderingEnabled) {
DRILock(pScrn->pScreen, 0);
@@ -4437,7 +2876,8 @@ static Bool R128CloseScreen(CLOSE_SCREEN_ARGS_DECL)
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
R128InfoPtr info = R128PTR(pScrn);
- R128TRACE(("R128CloseScreen\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s\n", __func__));
#ifdef R128DRI
/* Disable direct rendering */
@@ -4468,12 +2908,6 @@ static Bool R128CloseScreen(CLOSE_SCREEN_ARGS_DECL)
if (info->scratch_save) free(info->scratch_save);
info->scratch_save = NULL;
- if (info->cursor) xf86DestroyCursorInfoRec(info->cursor);
- info->cursor = NULL;
-
- if (info->DGAModes) free(info->DGAModes);
- info->DGAModes = NULL;
-
if (info->adaptor) {
free(info->adaptor->pPortPrivates[0].ptr);
xf86XVFreeVideoAdaptorRec(info->adaptor);
@@ -4492,7 +2926,8 @@ void R128FreeScreen(FREE_SCREEN_ARGS_DECL)
SCRN_INFO_PTR(arg);
R128InfoPtr info = R128PTR(pScrn);
- R128TRACE(("R128FreeScreen\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s\n", __func__));
if (info == NULL)
return;
#ifdef WITH_VGAHW
@@ -4501,130 +2936,3 @@ void R128FreeScreen(FREE_SCREEN_ARGS_DECL)
#endif
R128FreeRec(pScrn);
}
-
-/* Sets VESA Display Power Management Signaling (DPMS) Mode. */
-static void R128DisplayPowerManagementSet(ScrnInfoPtr pScrn,
- int PowerManagementMode, int flags)
-{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- int mask = (R128_CRTC_DISPLAY_DIS
- | R128_CRTC_HSYNC_DIS
- | R128_CRTC_VSYNC_DIS);
- int mask2 = R128_CRTC2_DISP_DIS;
-
- switch (PowerManagementMode) {
- case DPMSModeOn:
- /* Screen: On; HSync: On, VSync: On */
- if (info->IsSecondary)
- OUTREGP(R128_CRTC2_GEN_CNTL, 0, ~mask2);
- else
- OUTREGP(R128_CRTC_EXT_CNTL, 0, ~mask);
- break;
- case DPMSModeStandby:
- /* Screen: Off; HSync: Off, VSync: On */
- if (info->IsSecondary)
- OUTREGP(R128_CRTC2_GEN_CNTL, R128_CRTC2_DISP_DIS, ~mask2);
- else
- OUTREGP(R128_CRTC_EXT_CNTL,
- R128_CRTC_DISPLAY_DIS | R128_CRTC_HSYNC_DIS, ~mask);
- break;
- case DPMSModeSuspend:
- /* Screen: Off; HSync: On, VSync: Off */
- if (info->IsSecondary)
- OUTREGP(R128_CRTC2_GEN_CNTL, R128_CRTC2_DISP_DIS, ~mask2);
- else
- OUTREGP(R128_CRTC_EXT_CNTL,
- R128_CRTC_DISPLAY_DIS | R128_CRTC_VSYNC_DIS, ~mask);
- break;
- case DPMSModeOff:
- /* Screen: Off; HSync: Off, VSync: Off */
- if (info->IsSecondary)
- OUTREGP(R128_CRTC2_GEN_CNTL, mask2, ~mask2);
- else
- OUTREGP(R128_CRTC_EXT_CNTL, mask, ~mask);
- break;
- }
- if(info->isDFP) {
- switch (PowerManagementMode) {
- case DPMSModeOn:
- OUTREG(R128_FP_GEN_CNTL, INREG(R128_FP_GEN_CNTL) | (R128_FP_FPON | R128_FP_TDMS_EN));
- break;
- case DPMSModeStandby:
- case DPMSModeSuspend:
- case DPMSModeOff:
- OUTREG(R128_FP_GEN_CNTL, INREG(R128_FP_GEN_CNTL) & ~(R128_FP_FPON | R128_FP_TDMS_EN));
- break;
- }
- }
-}
-
-static int r128_set_backlight_enable(ScrnInfoPtr pScrn, int on);
-
-static void R128DisplayPowerManagementSetLCD(ScrnInfoPtr pScrn,
- int PowerManagementMode, int flags)
-{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- int mask = R128_LVDS_DISPLAY_DIS;
-
- switch (PowerManagementMode) {
- case DPMSModeOn:
- /* Screen: On; HSync: On, VSync: On */
- OUTREGP(R128_LVDS_GEN_CNTL, 0, ~mask);
- r128_set_backlight_enable(pScrn, 1);
- break;
- case DPMSModeStandby:
- /* Fall through */
- case DPMSModeSuspend:
- /* Fall through */
- break;
- case DPMSModeOff:
- /* Screen: Off; HSync: Off, VSync: Off */
- OUTREGP(R128_LVDS_GEN_CNTL, mask, ~mask);
- r128_set_backlight_enable(pScrn, 0);
- break;
- }
-}
-
-static int r128_set_backlight_enable(ScrnInfoPtr pScrn, int on)
-{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- unsigned int lvds_gen_cntl = INREG(R128_LVDS_GEN_CNTL);
-
- lvds_gen_cntl |= (/*R128_LVDS_BL_MOD_EN |*/ R128_LVDS_BLON);
- if (on) {
- lvds_gen_cntl |= R128_LVDS_DIGON;
- if (!(lvds_gen_cntl & R128_LVDS_ON)) {
- lvds_gen_cntl &= ~R128_LVDS_BLON;
- OUTREG(R128_LVDS_GEN_CNTL, lvds_gen_cntl);
- (void)INREG(R128_LVDS_GEN_CNTL);
- usleep(10000);
- lvds_gen_cntl |= R128_LVDS_BLON;
- OUTREG(R128_LVDS_GEN_CNTL, lvds_gen_cntl);
- }
-#if 0
- lvds_gen_cntl &= ~R128_LVDS_BL_MOD_LEVEL_MASK;
- lvds_gen_cntl |= (0xFF /* backlight_conv[level] */ <<
- R128_LVDS_BL_MOD_LEVEL_SHIFT);
-#endif
- lvds_gen_cntl |= (R128_LVDS_ON | R128_LVDS_EN);
- lvds_gen_cntl &= ~R128_LVDS_DISPLAY_DIS;
- } else {
-#if 0
- lvds_gen_cntl &= ~R128_LVDS_BL_MOD_LEVEL_MASK;
- lvds_gen_cntl |= (0xFF /* backlight_conv[0] */ <<
- R128_LVDS_BL_MOD_LEVEL_SHIFT);
-#endif
- lvds_gen_cntl |= R128_LVDS_DISPLAY_DIS;
- OUTREG(R128_LVDS_GEN_CNTL, lvds_gen_cntl);
- usleep(10);
- lvds_gen_cntl &= ~(R128_LVDS_ON | R128_LVDS_EN | R128_LVDS_BLON
- | R128_LVDS_DIGON);
- }
-
- OUTREG(R128_LVDS_GEN_CNTL, lvds_gen_cntl);
-
- return 0;
-}
diff --git a/driver/xf86-video-r128/src/r128_exa.c b/driver/xf86-video-r128/src/r128_exa.c
index 2a628a8c4..cf9b74f60 100644
--- a/driver/xf86-video-r128/src/r128_exa.c
+++ b/driver/xf86-video-r128/src/r128_exa.c
@@ -36,31 +36,10 @@
#include "exa.h"
#include "r128_reg.h"
+#include "r128_rop.h"
#include "xf86.h"
-static struct {
- int rop;
- int pattern;
-} R128_ROP[] = {
- { R128_ROP3_ZERO, R128_ROP3_ZERO }, /* GXclear */
- { R128_ROP3_DSa, R128_ROP3_DPa }, /* Gxand */
- { R128_ROP3_SDna, R128_ROP3_PDna }, /* GXandReverse */
- { R128_ROP3_S, R128_ROP3_P }, /* GXcopy */
- { R128_ROP3_DSna, R128_ROP3_DPna }, /* GXandInverted */
- { R128_ROP3_D, R128_ROP3_D }, /* GXnoop */
- { R128_ROP3_DSx, R128_ROP3_DPx }, /* GXxor */
- { R128_ROP3_DSo, R128_ROP3_DPo }, /* GXor */
- { R128_ROP3_DSon, R128_ROP3_DPon }, /* GXnor */
- { R128_ROP3_DSxn, R128_ROP3_PDxn }, /* GXequiv */
- { R128_ROP3_Dn, R128_ROP3_Dn }, /* GXinvert */
- { R128_ROP3_SDno, R128_ROP3_PDno }, /* GXorReverse */
- { R128_ROP3_Sn, R128_ROP3_Pn }, /* GXcopyInverted */
- { R128_ROP3_DSno, R128_ROP3_DPno }, /* GXorInverted */
- { R128_ROP3_DSan, R128_ROP3_DPan }, /* GXnand */
- { R128_ROP3_ONE, R128_ROP3_ONE } /* GXset */
-};
-
/* Assumes that depth 15 and 16 can be used as depth 16, which is okay since we
* require src and dest datatypes to be equal.
*/
@@ -92,12 +71,14 @@ static Bool R128GetOffsetPitch(PixmapPtr pPix, int bpp, uint32_t *pitch_offset,
R128InfoPtr info = R128PTR(pScrn);
if (pitch > 16320 || pitch % info->ExaDriver->pixmapPitchAlign != 0) {
- R128TRACE(("Bad pitch 0x%08x\n", pitch));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Bad pitch 0x%08x\n", pitch));
return FALSE;
}
if (offset % info->ExaDriver->pixmapOffsetAlign != 0) {
- R128TRACE(("Bad offset 0x%08x\n", offset));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Bad offset 0x%08x\n", offset));
return FALSE;
}
@@ -143,7 +124,7 @@ static void Emit2DState(ScrnInfoPtr pScrn)
}
#ifdef R128DRI
-static void EmitCCE2DState(ScrnInfoPtr pScrn)
+void EmitCCE2DState(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
int has_src = info->state_2d.src_pitch_offset;
@@ -182,11 +163,13 @@ R128PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
uint32_t datatype, dst_pitch_offset;
if (!R128GetDatatypeBpp(bpp, &datatype)) {
- R128TRACE(("R128GetDatatypeBpp failed\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "R128GetDatatypeBpp failed\n"));
return FALSE;
}
if (!R128GetPixmapOffsetPitch(pPixmap, &dst_pitch_offset)) {
- R128TRACE(("R128GetPixmapOffsetPitch failed\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "R128GetPixmapOffsetPitch failed\n"));
return FALSE;
}
if (info->state_2d.in_use) return FALSE;
@@ -281,15 +264,19 @@ R128PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
uint32_t datatype, src_pitch_offset, dst_pitch_offset;
if (!R128GetDatatypeBpp(bpp, &datatype)) {
- R128TRACE(("R128GetDatatypeBpp failed\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "R128GetDatatypeBpp failed\n"));
return FALSE;
}
if (!R128GetPixmapOffsetPitch(pSrcPixmap, &src_pitch_offset)) {
- R128TRACE(("R128GetPixmapOffsetPitch source failed\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "R128GetPixmapOffsetPitch source "
+ "failed\n"));
return FALSE;
}
if (!R128GetPixmapOffsetPitch(pDstPixmap, &dst_pitch_offset)) {
- R128TRACE(("R128GetPixmapOffsetPitch dest failed\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "R128GetPixmapOffsetPitch dest failed\n"));
return FALSE;
}
if (info->state_2d.in_use) return FALSE;
@@ -327,7 +314,7 @@ R128Sync(ScreenPtr pScreen, int marker)
R128WaitForIdle(xf86ScreenToScrn(pScreen));
}
-static void
+void
R128Done(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
@@ -404,22 +391,29 @@ R128CCESync(ScreenPtr pScreen, int marker)
R128CCEWaitForIdle(xf86ScreenToScrn(pScreen));
}
-#ifdef RENDER
-#include "r128_exa_render.c"
-#endif
-
#endif
Bool
-R128EXAInit(ScreenPtr pScreen)
+R128EXAInit(ScreenPtr pScreen, int total)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
R128InfoPtr info = R128PTR(pScrn);
+ info->ExaDriver = exaDriverAlloc();
+ if (!info->ExaDriver) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Could not allocate EXA driver...\n");
+ return FALSE;
+ }
+
info->ExaDriver->exa_major = EXA_VERSION_MAJOR;
info->ExaDriver->exa_minor = EXA_VERSION_MINOR;
info->ExaDriver->memoryBase = info->FB + pScrn->fbOffset;
+ info->ExaDriver->offScreenBase = pScrn->virtualY *
+ (pScrn->displayWidth *
+ info->CurrentLayout.pixel_bytes);
+ info->ExaDriver->memorySize = total;
info->ExaDriver->flags = EXA_OFFSCREEN_PIXMAPS | EXA_OFFSCREEN_ALIGN_POT;
#if EXA_VERSION_MAJOR > 2 || (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 3)
@@ -476,7 +470,7 @@ R128EXAInit(ScreenPtr pScreen)
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Initalizing 2D acceleration engine...\n");
+ "Initializing 2D acceleration engine...\n");
R128EngineInit(pScrn);
diff --git a/driver/xf86-video-r128/src/r128_exa_render.c b/driver/xf86-video-r128/src/r128_exa_render.c
index db14bb126..0d81a09a6 100644
--- a/driver/xf86-video-r128/src/r128_exa_render.c
+++ b/driver/xf86-video-r128/src/r128_exa_render.c
@@ -34,14 +34,24 @@
/* The following is based on the kdrive ATI driver. */
-#include <stdio.h>
-#include <string.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if defined(R128DRI) && defined(RENDER)
+#include "xf86.h"
+#include "exa.h"
+
+#include "r128.h"
+#include "r128_reg.h"
+#include "r128_rop.h"
+
static struct {
Bool dst_alpha;
Bool src_alpha;
- CARD32 sblend;
- CARD32 dblend;
+ uint32_t sblend;
+ uint32_t dblend;
} R128BlendOp[] = {
/* Clear */
{0, 0, R128_ALPHA_BLEND_ZERO , R128_ALPHA_BLEND_ZERO},
@@ -102,6 +112,17 @@ R128SolidPixmap(ScreenPtr pScreen, uint32_t solid)
return NULL;
}
info->ExaDriver->WaitMarker(pScreen, 0);
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ if (pScrn->bitsPerPixel == 32)
+ R128CopySwap(info->ExaDriver->memoryBase + exaGetPixmapOffset(pPix), (uint8_t*)&solid, 4,
+ APER_0_BIG_ENDIAN_32BPP_SWAP);
+ else if (pScrn->bitsPerPixel == 16)
+ R128CopySwap(info->ExaDriver->memoryBase + exaGetPixmapOffset(pPix), (uint8_t*)&solid, 4,
+ APER_0_BIG_ENDIAN_16BPP_SWAP);
+ else
+ /* Fall through for 8 bpp */
+#endif
memcpy(info->ExaDriver->memoryBase + exaGetPixmapOffset(pPix), &solid, 4);
return pPix;
@@ -146,8 +167,10 @@ R128GetDatatypePict2(uint32_t format, uint32_t *type)
static Bool
R128CheckCompositeTexture(PicturePtr pPict, PicturePtr pDstPict, int op)
{
+#if R128_DEBUG
ScreenPtr pScreen = pDstPict->pDrawable->pScreen;
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+#endif
unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
uint32_t tmp1;
@@ -159,66 +182,84 @@ R128CheckCompositeTexture(PicturePtr pPict, PicturePtr pDstPict, int op)
int h = pPict->pDrawable->height;
if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0)) {
- R128TRACE(("NPOT repeat unsupported (%dx%d)\n", w, h));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "NPOT repeat unsupported (%dx%d)\n", w, h));
return FALSE;
}
}
if (pPict->filter != PictFilterNearest && pPict->filter != PictFilterBilinear) {
- R128TRACE(("Unsupported filter 0x%x\n", pPict->filter));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Unsupported filter 0x%x\n",
+ pPict->filter));
return FALSE;
}
/* The radeon driver has a long explanation about this part that I don't really understand */
if (pPict->transform != 0 && repeatType == RepeatNone && PICT_FORMAT_A(pPict->format) == 0) {
if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PICT_FORMAT_A(pDstPict->format) == 0))) {
- R128TRACE(("REPEAT_NONE unsupported for transformed xRGB source\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "REPEAT_NONE unsupported for "
+ "transformed xRGB source\n"));
return FALSE;
}
}
if (!R128TransformAffineOrScaled(pPict->transform)) {
- R128TRACE(("Non-affine transforms not supported\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Non-affine transforms not supported\n"));
return FALSE;
}
return TRUE;
}
-static Bool
+Bool
R128CCECheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture)
{
+#if R128_DEBUG
ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+#endif
PixmapPtr pSrcPixmap, pDstPixmap;
uint32_t tmp1;
/* Check for unsupported compositing operations. */
if (op >= sizeof(R128BlendOp) / sizeof(R128BlendOp[0])) {
- R128TRACE(("Unsupported Composite op 0x%x\n", op));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Unsupported Composite op 0x%x\n", op));
return FALSE;
}
pDstPixmap = R128GetDrawablePixmap(pDstPicture->pDrawable);
if (pDstPixmap->drawable.width > 1024 || pDstPixmap->drawable.height > 1024) {
- R128TRACE(("Dest w/h too large (%d,%d).\n", pDstPixmap->drawable.width, pDstPixmap->drawable.height));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Dest w/h too large (%d,%d).\n",
+ pDstPixmap->drawable.width,
+ pDstPixmap->drawable.height));
return FALSE;
}
if (pSrcPicture->pDrawable) {
pSrcPixmap = R128GetDrawablePixmap(pSrcPicture->pDrawable);
if (pSrcPixmap->drawable.width > 1024 || pSrcPixmap->drawable.height > 1024) {
- R128TRACE(("Source w/h too large (%d,%d).\n", pSrcPixmap->drawable.width, pSrcPixmap->drawable.height));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Source w/h too large (%d,%d).\n",
+ pSrcPixmap->drawable.width,
+ pSrcPixmap->drawable.height));
return FALSE;
}
} else if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill) {
- R128TRACE(("Gradient pictures not supported yet\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Gradient pictures not supported yet\n"));
return FALSE;
}
if (pDstPicture->format == PICT_a8) {
if (R128BlendOp[op].src_alpha || R128BlendOp[op].dst_alpha || pMaskPicture != NULL) {
- R128TRACE(("Alpha blending unsupported with A8 dst?\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Alpha blending unsupported with "
+ "A8 dst?\n"));
return FALSE;
}
} else {
@@ -231,16 +272,22 @@ R128CCECheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, P
if (pMaskPicture->pDrawable) {
pMaskPixmap = R128GetDrawablePixmap(pMaskPicture->pDrawable);
if (pMaskPixmap->drawable.width > 1024 || pMaskPixmap->drawable.height > 1024) {
- R128TRACE(("Mask w/h too large (%d,%d).\n", pMaskPixmap->drawable.width, pMaskPixmap->drawable.height));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Mask w/h too large (%d,%d).\n",
+ pMaskPixmap->drawable.width,
+ pMaskPixmap->drawable.height));
return FALSE;
}
} else if (pMaskPicture->pSourcePict->type != SourcePictTypeSolidFill) {
- R128TRACE(("Gradient pictures not supported yet\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Gradient pictures not supported yet\n"));
return FALSE;
}
if (pMaskPicture->componentAlpha && R128BlendOp[op].src_alpha) {
- R128TRACE(("Component alpha not supported with source alpha blending\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Component alpha not supported with "
+ "source alpha blending\n"));
return FALSE;
}
@@ -269,7 +316,8 @@ R128TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit, uint32_t *txsize, u
pitch = exaGetPixmapPitch(pPix);
if ((pitch & (pitch - 1)) != 0) {
- R128TRACE(("NPOT pitch 0x%x unsupported\n", pitch));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "NPOT pitch 0x%x unsupported\n", pitch));
return FALSE;
}
@@ -283,7 +331,8 @@ R128TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit, uint32_t *txsize, u
} else if (pPict->filter == PictFilterNearest) {
*tex_cntl_c |= R128_MIN_BLEND_NEAREST | R128_MAG_BLEND_NEAREST;
} else {
- R128TRACE(("Bad filter 0x%x\n", pPict->filter));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Bad filter 0x%x\n", pPict->filter));
return FALSE;
}
@@ -301,7 +350,9 @@ R128TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit, uint32_t *txsize, u
if (pPict->repeat && w == 1 && h == 1) {
l2p = 0;
} else if (pPict->repeat && l2p != l2w) {
- R128TRACE(("Repeat not supported for pitch != width\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Repeat not supported for pitch != "
+ "width\n"));
return FALSE;
}
@@ -339,7 +390,7 @@ do { \
R128_TEX_MAP_ALPHA_IN_TEXTURE | \
R128_TEX_CACHE_LINE_SIZE_4QW); \
OUT_RING_REG(R128_SETUP_CNTL, \
- R128_COLOR_SOLID_COLOR | \
+ R128_COLOR_GOURAUD | \
R128_PRIM_TYPE_TRI | \
R128_TEXTURE_ST_MULT_W | \
R128_STARTING_VERTEX_1 | \
@@ -347,9 +398,9 @@ do { \
R128_SUB_PIX_4BITS); \
OUT_RING_REG(R128_PM4_VC_FPU_SETUP, \
R128_FRONT_DIR_CCW | \
- R128_BACKFACE_CULL | \
+ R128_BACKFACE_SOLID | \
R128_FRONTFACE_SOLID | \
- R128_FPU_COLOR_SOLID | \
+ R128_FPU_COLOR_GOURAUD | \
R128_FPU_SUB_PIX_4BITS | \
R128_FPU_MODE_3D | \
R128_TRAP_BITS_DISABLE | \
@@ -364,7 +415,7 @@ do { \
ADVANCE_RING(); \
} while(0)
-static Bool
+Bool
R128CCEPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
{
@@ -383,7 +434,8 @@ R128CCEPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
if (pDstPicture->format == PICT_a8) {
if (R128BlendOp[op].dst_alpha) {
- R128TRACE(("Can't dst alpha blend A8\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Can't dst alpha blend A8\n"));
return FALSE;
}
dstDatatype = R128_DATATYPE_Y8;
@@ -394,7 +446,9 @@ R128CCEPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
if (!pSrc) {
pSrc = R128SolidPixmap(pScreen, cpu_to_le32(pSrcPicture->pSourcePict->solidFill.color));
if (!pSrc) {
- R128TRACE(("Failed to create solid scratch pixmap\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Failed to create solid scratch "
+ "pixmap\n"));
return FALSE;
}
add_src = TRUE;
@@ -407,7 +461,9 @@ R128CCEPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
if (!pSrcPicture->pDrawable)
pScreen->DestroyPixmap(pSrc);
info->state_2d.has_mask = FALSE;
- R128TRACE(("Failed to create solid scratch pixmap\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Failed to create "
+ "solid scratch pixmap\n"));
return FALSE;
}
add_msk = TRUE;
@@ -447,12 +503,7 @@ R128CCEPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
if (!info->state_2d.composite_setup) {
COMPOSITE_SETUP();
- /* DRI and EXA are fighting over control of the texture hardware.
- * That means we need to set up the compositing hardware every time
- * while a 3D app is running and once after it closes.
- */
- if (!info->have3DWindows)
- info->state_2d.composite_setup = TRUE;
+ info->state_2d.composite_setup = TRUE;
}
/* We cannot guarantee that this register will stay zero - DRI needs it too. */
@@ -576,9 +627,9 @@ R128CCEPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
return TRUE;
}
-typedef union { float f; CARD32 i; } fi_type;
+typedef union { float f; uint32_t i; } fi_type;
-static inline CARD32
+static inline uint32_t
R128FloatAsInt(float val)
{
fi_type fi;
@@ -609,7 +660,7 @@ do { \
OUT_RING(R128FloatAsInt((((float)(_srcY)) + 0.5) / (info->state_2d.heights[0]))); \
} while (0)
-static void
+void
R128CCEComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, int w, int h)
{
ScreenPtr pScreen = pDst->drawable.pScreen;
@@ -692,4 +743,4 @@ R128CCEComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, int d
ADVANCE_RING();
}
-#define R128CCEDoneComposite R128Done
+#endif
diff --git a/driver/xf86-video-r128/src/r128_output.c b/driver/xf86-video-r128/src/r128_output.c
new file mode 100644
index 000000000..96d650fb8
--- /dev/null
+++ b/driver/xf86-video-r128/src/r128_output.c
@@ -0,0 +1,537 @@
+/*
+ * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
+ * VA Linux Systems Inc., Fremont, California.
+ *
+ * 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 on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
+ * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86Modes.h"
+
+#ifdef HAVE_XEXTPROTO_71
+#include "X11/extensions/dpmsconst.h"
+#else
+#define DPMS_SERVER
+#include "X11/extensions/dpms.h"
+#endif
+
+#include "r128.h"
+#include "r128_probe.h"
+#include "r128_reg.h"
+
+static void R128ConnectorFindMonitor(ScrnInfoPtr pScrn, xf86OutputPtr output);
+
+/* Define DAC registers for the requested video mode. */
+void R128InitDACRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ xf86CrtcPtr crtc = output->crtc;
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+
+ save->dac_cntl = (R128_DAC_MASK_ALL | R128_DAC_VGA_ADR_EN |
+ (!r128_crtc->crtc_id ? 0 : R128_DAC_CRT_SEL_CRTC2) |
+ (info->dac6bits ? 0 : R128_DAC_8BIT_EN));
+}
+
+/* Write DAC registers */
+void R128RestoreDACRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
+{
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+
+ OUTREGP(R128_DAC_CNTL, restore->dac_cntl,
+ R128_DAC_RANGE_CNTL | R128_DAC_BLANKING);
+}
+
+static void r128_dpms(xf86OutputPtr output, int mode)
+{
+ switch(mode) {
+ case DPMSModeOn:
+ R128DPMSSetOn(output);
+ break;
+ case DPMSModeStandby:
+ case DPMSModeSuspend:
+ case DPMSModeOff:
+ R128DPMSSetOff(output);
+ break;
+ }
+}
+
+static void r128_save(xf86OutputPtr output)
+{
+}
+
+static void r128_restore(xf86OutputPtr output)
+{
+}
+
+static int r128_mode_valid(xf86OutputPtr output, DisplayModePtr mode)
+{
+ return MODE_OK;
+}
+
+static Bool r128_mode_fixup(xf86OutputPtr output, DisplayModePtr mode, DisplayModePtr adjusted_mode)
+{
+ return TRUE;
+}
+
+static void r128_mode_prepare(xf86OutputPtr output)
+{
+ r128_dpms(output, DPMSModeOff);
+}
+
+static void r128_mode_set(xf86OutputPtr output, DisplayModePtr mode, DisplayModePtr adjusted_mode)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128OutputPrivatePtr r128_output = output->driver_private;
+ xf86CrtcPtr crtc = output->crtc;
+ R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
+
+ if (r128_crtc->crtc_id == 0 && !info->isPro2)
+ R128InitRMXRegisters(&info->SavedReg, &info->ModeReg, output, adjusted_mode);
+
+ if (r128_output->MonType == MT_DFP)
+ R128InitFPRegisters(&info->SavedReg, &info->ModeReg, output);
+ else if (r128_output->MonType == MT_LCD)
+ R128InitLVDSRegisters(&info->SavedReg, &info->ModeReg, output);
+ else if (r128_output->MonType == MT_CRT)
+ R128InitDACRegisters(&info->SavedReg, &info->ModeReg, output);
+
+ if (r128_crtc->crtc_id == 0 && !info->isPro2)
+ R128RestoreRMXRegisters(pScrn, &info->ModeReg);
+
+ if (r128_output->MonType == MT_DFP)
+ R128RestoreFPRegisters(pScrn, &info->ModeReg);
+ else if (r128_output->MonType == MT_LCD)
+ R128RestoreLVDSRegisters(pScrn, &info->ModeReg);
+ else if (r128_output->MonType == MT_CRT)
+ R128RestoreDACRegisters(pScrn, &info->ModeReg);
+}
+
+static void r128_mode_commit(xf86OutputPtr output)
+{
+ r128_dpms(output, DPMSModeOn);
+}
+
+static xf86OutputStatus r128_detect(xf86OutputPtr output)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ R128OutputPrivatePtr r128_output = output->driver_private;
+
+ r128_output->MonType = MT_UNKNOWN;
+ R128ConnectorFindMonitor(pScrn, output);
+
+ if (r128_output->MonType == MT_UNKNOWN) {
+ output->subpixel_order = SubPixelUnknown;
+ return XF86OutputStatusUnknown;
+ } else if (r128_output->MonType == MT_NONE) {
+ output->subpixel_order = SubPixelUnknown;
+ return XF86OutputStatusDisconnected;
+ } else {
+ switch(r128_output->MonType) {
+ case MT_LCD:
+ case MT_DFP:
+ output->subpixel_order = SubPixelHorizontalRGB;
+ break;
+ default:
+ output->subpixel_order = SubPixelNone;
+ break;
+ }
+
+ return XF86OutputStatusConnected;
+ }
+}
+
+static DisplayModePtr r128_get_modes(xf86OutputPtr output)
+{
+ DisplayModePtr modes;
+ modes = R128ProbeOutputModes(output);
+ return modes;
+}
+
+static void r128_destroy(xf86OutputPtr output)
+{
+ if (output->driver_private)
+ free(output->driver_private);
+}
+
+static const xf86OutputFuncsRec r128_output_funcs = {
+ .dpms = r128_dpms,
+ .save = r128_save,
+ .restore = r128_restore,
+ .mode_valid = r128_mode_valid,
+ .mode_fixup = r128_mode_fixup,
+ .prepare = r128_mode_prepare,
+ .mode_set = r128_mode_set,
+ .commit = r128_mode_commit,
+ .detect = r128_detect,
+ .get_modes = r128_get_modes,
+ .destroy = r128_destroy,
+};
+
+void R128DPMSSetOn(xf86OutputPtr output)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ R128OutputPrivatePtr r128_output = output->driver_private;
+ R128MonitorType MonType = r128_output->MonType;
+ R128SavePtr save = &info->ModeReg;
+
+ switch(MonType) {
+ case MT_LCD:
+ OUTREGP(R128_LVDS_GEN_CNTL, R128_LVDS_BLON, ~R128_LVDS_BLON);
+ usleep(r128_output->PanelPwrDly * 1000);
+ OUTREGP(R128_LVDS_GEN_CNTL, R128_LVDS_ON, ~R128_LVDS_ON);
+ save->lvds_gen_cntl |= (R128_LVDS_ON | R128_LVDS_BLON);
+ break;
+ case MT_DFP:
+ OUTREGP(R128_FP_GEN_CNTL, (R128_FP_FPON | R128_FP_TMDS_EN), ~(R128_FP_FPON | R128_FP_TMDS_EN));
+ save->fp_gen_cntl |= (R128_FP_FPON | R128_FP_TMDS_EN);
+ break;
+ case MT_CRT:
+ OUTREGP(R128_CRTC_EXT_CNTL, R128_CRTC_CRT_ON, ~R128_CRTC_CRT_ON);
+ save->crtc_ext_cntl |= R128_CRTC_CRT_ON;
+ break;
+ default:
+ break;
+ }
+}
+
+void R128DPMSSetOff(xf86OutputPtr output)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ R128OutputPrivatePtr r128_output = output->driver_private;
+ R128MonitorType MonType = r128_output->MonType;
+ R128SavePtr save = &info->ModeReg;
+
+ switch(MonType) {
+ case MT_LCD:
+ OUTREGP(R128_LVDS_GEN_CNTL, 0, ~(R128_LVDS_BLON | R128_LVDS_ON));
+ save->lvds_gen_cntl &= ~(R128_LVDS_BLON | R128_LVDS_ON);
+ break;
+ case MT_DFP:
+ OUTREGP(R128_FP_GEN_CNTL, 0, ~(R128_FP_FPON | R128_FP_TMDS_EN));
+ save->fp_gen_cntl &= ~(R128_FP_FPON | R128_FP_TMDS_EN);
+ break;
+ case MT_CRT:
+ OUTREGP(R128_CRTC_EXT_CNTL, 0, ~(R128_CRTC_CRT_ON));
+ save->crtc_ext_cntl &= ~(R128_CRTC_CRT_ON);
+ break;
+ default:
+ break;
+ }
+}
+
+static R128MonitorType R128DisplayDDCConnected(xf86OutputPtr output)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ R128InfoPtr info = R128PTR(pScrn);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ R128OutputPrivatePtr r128_output = output->driver_private;
+
+ R128MonitorType MonType = MT_CRT;
+ xf86MonPtr *MonInfo = &output->MonInfo;
+ uint32_t mask1, mask2;
+
+ if (r128_output->type == OUTPUT_LVDS) {
+ return MT_LCD;
+ } else if (r128_output->type == OUTPUT_VGA) {
+ mask1 = R128_GPIO_MONID_MASK_1 | (pR128Ent->HasCRTC2 ? R128_GPIO_MONID_MASK_3 : R128_GPIO_MONID_MASK_2);
+ mask2 = R128_GPIO_MONID_A_1 | (pR128Ent->HasCRTC2 ? R128_GPIO_MONID_A_3 : R128_GPIO_MONID_A_2);
+ } else {
+ mask1 = R128_GPIO_MONID_MASK_0 | R128_GPIO_MONID_MASK_3;
+ mask2 = R128_GPIO_MONID_A_0 | R128_GPIO_MONID_A_3;
+ }
+
+ if (r128_output->pI2CBus) {
+ R128I2CBusPtr pR128I2CBus = &(r128_output->ddc_i2c);
+
+ /* XXX: Radeon does something here to appease old monitors. */
+ OUTREG(pR128I2CBus->ddc_reg, INREG(pR128I2CBus->ddc_reg) | mask1);
+ OUTREG(pR128I2CBus->ddc_reg, INREG(pR128I2CBus->ddc_reg) & ~mask2);
+ *MonInfo = xf86DoEDID_DDC2(XF86_SCRN_ARG(pScrn), r128_output->pI2CBus);
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "DDC2/I2C is not properly initialized\n");
+ return MT_NONE;
+ }
+
+ if (*MonInfo) {
+ if (r128_output->type == OUTPUT_VGA) {
+ MonType = MT_CRT;
+ } else {
+ if ((*MonInfo)->rawData[0x14] & 0x80)
+ MonType = MT_DFP;
+ else
+ MonType = MT_CRT;
+ }
+ }
+
+ return MonType;
+}
+
+static void R128ConnectorFindMonitor(ScrnInfoPtr pScrn, xf86OutputPtr output)
+{
+ R128OutputPrivatePtr r128_output = output->driver_private;
+
+ /* XXX: We should figure out how the DAC and BIOS scratch registers work
+ * to handle the non-DDC case. */
+ if (r128_output->MonType == MT_UNKNOWN)
+ r128_output->MonType = R128DisplayDDCConnected(output);
+}
+
+DisplayModePtr R128ProbeOutputModes(xf86OutputPtr output)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ R128OutputPrivatePtr r128_output = output->driver_private;
+ DisplayModePtr modes = NULL;
+ DisplayModePtr mode;
+ xf86MonPtr edid_mon;
+
+ if (r128_output->pI2CBus) {
+ edid_mon = xf86OutputGetEDID(output, r128_output->pI2CBus);
+ xf86OutputSetEDID(output, edid_mon);
+ modes = xf86OutputGetEDIDModes(output);
+ }
+
+ /* Letting this function return NULL would be a bad idea. With old cards
+ * like r128, users often specify a small resolution in order to get DRI.
+ * If the X server has to guess modes, the list it comes up with includes
+ * high resolutions.
+ */
+ if (!modes)
+ modes = xf86GetDefaultModes();
+
+ for (mode = modes; mode != NULL; mode = mode->next) {
+ if (r128_output->type == OUTPUT_DVI) {
+ if (mode->type & (M_T_DRIVER | M_T_PREFERRED)) {
+ r128_output->PanelXRes = mode->HDisplay;
+ r128_output->PanelYRes = mode->VDisplay;
+ }
+ }
+
+ xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
+ if (mode->status == MODE_OK)
+ mode->status = R128DoValidMode(output, mode, MODECHECK_FINAL);
+ }
+
+ xf86ValidateModesUserConfig(pScrn, modes);
+ xf86PruneInvalidModes(pScrn, &modes, FALSE);
+
+ return modes;
+}
+
+static xf86OutputPtr R128OutputCreate(ScrnInfoPtr pScrn, const char *name, int i)
+{
+ char buf[32];
+ sprintf(buf, name, i);
+ return xf86OutputCreate(pScrn, &r128_output_funcs, buf);
+}
+
+static void R128I2CGetBits(I2CBusPtr b, int *Clock, int *data)
+{
+ ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex];
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned long val;
+ unsigned char *R128MMIO = info->MMIO;
+ R128I2CBusPtr pR128I2CBus = b->DriverPrivate.ptr;
+
+ /* Get the result. */
+ val = INREG(pR128I2CBus->ddc_reg);
+ *Clock = (val & pR128I2CBus->get_clk_mask) != 0;
+ *data = (val & pR128I2CBus->get_data_mask) != 0;
+}
+
+static void R128I2CPutBits(I2CBusPtr b, int Clock, int data)
+{
+ ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex];
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned long val;
+ unsigned char *R128MMIO = info->MMIO;
+ R128I2CBusPtr pR128I2CBus = b->DriverPrivate.ptr;
+
+ val = INREG(pR128I2CBus->ddc_reg)
+ & ~(uint32_t)(pR128I2CBus->put_clk_mask | pR128I2CBus->put_data_mask);
+ val |= (Clock ? 0 : pR128I2CBus->put_clk_mask);
+ val |= (data ? 0 : pR128I2CBus->put_data_mask);
+ OUTREG(pR128I2CBus->ddc_reg, val);
+}
+
+static Bool R128I2CInit(xf86OutputPtr output, I2CBusPtr *bus_ptr, char *name)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ R128OutputPrivatePtr r128_output = output->driver_private;
+ R128I2CBusPtr pR128I2CBus = &(r128_output->ddc_i2c);
+ I2CBusPtr pI2CBus;
+
+ pI2CBus = xf86CreateI2CBusRec();
+ if(!pI2CBus) return FALSE;
+
+ pI2CBus->BusName = name;
+ pI2CBus->scrnIndex = pScrn->scrnIndex;
+ pI2CBus->I2CPutBits = R128I2CPutBits;
+ pI2CBus->I2CGetBits = R128I2CGetBits;
+ pI2CBus->AcknTimeout = 5;
+
+ pI2CBus->DriverPrivate.ptr = (pointer)pR128I2CBus;
+ if (!xf86I2CBusInit(pI2CBus)) return FALSE;
+
+ *bus_ptr = pI2CBus;
+ return TRUE;
+}
+
+void R128GetConnectorInfoFromBIOS(ScrnInfoPtr pScrn, R128OutputType *otypes)
+{
+ R128InfoPtr info = R128PTR(pScrn);
+ uint16_t bios_header, offset;
+ uint32_t i;
+
+ for (i = 0; i < R128_MAX_BIOS_CONNECTOR; i++) {
+ otypes[i] = OUTPUT_NONE;
+ }
+
+ /* non-x86 platform */
+ if (!info->VBIOS) {
+ otypes[0] = OUTPUT_VGA;
+ return;
+ }
+
+ bios_header = R128_BIOS16(0x48);
+ offset = R128_BIOS16(bios_header + 0x40);
+ if (offset) {
+ otypes[0] = OUTPUT_LVDS;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Found FP table, assuming FP connector.\n");
+ } else {
+ bios_header = R128_BIOS16(0x48);
+ offset = R128_BIOS16(bios_header + 0x34);
+ if (offset) {
+ otypes[0] = OUTPUT_DVI;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Found DVI table, assuming DVI connector.\n");
+ }
+ }
+
+ offset = R128_BIOS16(bios_header + 0x2e);
+ if (offset) {
+ if (otypes[0] == OUTPUT_NONE) {
+ otypes[0] = OUTPUT_VGA;
+ } else {
+ otypes[1] = OUTPUT_VGA;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Found CRT table, assuming VGA connector.\n");
+ }
+}
+
+Bool R128SetupConnectors(ScrnInfoPtr pScrn)
+{
+ R128InfoPtr info = R128PTR(pScrn);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
+
+ R128OutputType otypes[R128_MAX_BIOS_CONNECTOR];
+ xf86OutputPtr output;
+ int num_vga = 0;
+ int num_dvi = 0;
+ int i;
+
+ R128GetConnectorInfoFromBIOS(pScrn, otypes);
+
+ for (i = 0; i < R128_MAX_BIOS_CONNECTOR; i++) {
+ if (otypes[i] == OUTPUT_VGA)
+ num_vga++;
+ else if (otypes[i] == OUTPUT_DVI)
+ num_dvi++;
+ }
+
+ for (i = 0; i < R128_MAX_BIOS_CONNECTOR; i++) {
+ if (otypes[i] == OUTPUT_NONE) continue;
+
+ R128I2CBusRec i2c;
+ R128OutputPrivatePtr r128_output;
+
+ r128_output = xnfcalloc(sizeof(R128OutputPrivateRec), 1);
+ if (!r128_output) return FALSE;
+
+ r128_output->MonType = MT_UNKNOWN;
+ r128_output->type = otypes[i];
+ r128_output->num = i;
+
+ if (otypes[i] == OUTPUT_LVDS) {
+ output = R128OutputCreate(pScrn, "LVDS", 0);
+ } else if (otypes[i] == OUTPUT_VGA) {
+ output = R128OutputCreate(pScrn, "VGA-%d", --num_vga);
+ } else {
+ output = R128OutputCreate(pScrn, "DVI-%d", --num_dvi);
+ }
+
+ if (!output) return FALSE;
+ output->interlaceAllowed = TRUE;
+ output->doubleScanAllowed = TRUE;
+ output->driver_private = r128_output;
+ output->possible_clones = 0;
+ if (otypes[i] == OUTPUT_LVDS || !pR128Ent->HasCRTC2)
+ output->possible_crtcs = 1;
+ else
+ output->possible_crtcs = 2;
+
+ if (otypes[i] != OUTPUT_LVDS && info->DDC) {
+ i2c.ddc_reg = R128_GPIO_MONID;
+ if (otypes[i] == OUTPUT_VGA && !pR128Ent->HasCRTC2) {
+ i2c.put_clk_mask = R128_GPIO_MONID_EN_2;
+ i2c.get_clk_mask = R128_GPIO_MONID_Y_2;
+ } else {
+ i2c.put_clk_mask = R128_GPIO_MONID_EN_3;
+ i2c.get_clk_mask = R128_GPIO_MONID_Y_3;
+ }
+ if (otypes[i] == OUTPUT_VGA) {
+ i2c.put_data_mask = R128_GPIO_MONID_EN_1;
+ i2c.get_data_mask = R128_GPIO_MONID_Y_1;
+ } else {
+ i2c.put_data_mask = R128_GPIO_MONID_EN_0;
+ i2c.get_data_mask = R128_GPIO_MONID_Y_0;
+ }
+ r128_output->ddc_i2c = i2c;
+ R128I2CInit(output, &r128_output->pI2CBus, output->name);
+ }
+
+ if (otypes[i] == OUTPUT_LVDS)
+ R128GetPanelInfoFromBIOS(output);
+ }
+
+ return TRUE;
+}
diff --git a/driver/xf86-video-r128/src/r128_probe.c b/driver/xf86-video-r128/src/r128_probe.c
index 15e4a7785..363904e49 100644
--- a/driver/xf86-video-r128/src/r128_probe.c
+++ b/driver/xf86-video-r128/src/r128_probe.c
@@ -43,14 +43,11 @@
#include "atipcirename.h"
#include "xf86.h"
-#include "xf86PciInfo.h"
-
#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
#include "xf86Resources.h"
#endif
-#include "compat-api.h"
#include "r128_probe.h"
#ifndef XSERVER_LIBPCIACCESS
@@ -237,6 +234,7 @@ r128_get_scrninfo(int entity_num)
{
ScrnInfoPtr pScrn = NULL;
EntityInfoPtr pEnt;
+ DevUnion* pPriv;
pScrn = xf86ConfigPciEntity(pScrn, 0, entity_num, R128PciChipsets,
NULL,
@@ -264,6 +262,20 @@ r128_get_scrninfo(int entity_num)
pEnt = xf86GetEntityInfo(entity_num);
+ /* Allocate private entity used for convenience with one or two heads. */
+ if (gR128EntityIndex < 0) {
+ gR128EntityIndex = xf86AllocateEntityPrivateIndex();
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gR128EntityIndex);
+
+ if (!pPriv->ptr) {
+ R128EntPtr pR128Ent;
+ pPriv->ptr = xnfcalloc(sizeof(R128EntRec), 1);
+ pR128Ent = pPriv->ptr;
+ pR128Ent->HasSecondary = FALSE;
+ pR128Ent->IsSecondaryRestored = FALSE;
+ }
+ }
+
/* mobility cards support Dual-Head, mark the entity as sharable*/
if (pEnt->chipset == PCI_CHIP_RAGE128LE ||
pEnt->chipset == PCI_CHIP_RAGE128LF ||
@@ -271,7 +283,6 @@ r128_get_scrninfo(int entity_num)
pEnt->chipset == PCI_CHIP_RAGE128ML)
{
static int instance = 0;
- DevUnion* pPriv;
xf86SetEntitySharable(entity_num);
@@ -279,24 +290,6 @@ r128_get_scrninfo(int entity_num)
pScrn->entityList[0],
instance);
- if (gR128EntityIndex < 0)
- {
- gR128EntityIndex = xf86AllocateEntityPrivateIndex();
-
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
- gR128EntityIndex);
-
- if (!pPriv->ptr)
- {
- R128EntPtr pR128Ent;
- pPriv->ptr = xnfcalloc(sizeof(R128EntRec), 1);
- pR128Ent = pPriv->ptr;
- pR128Ent->IsDRIEnabled = FALSE;
- pR128Ent->BypassSecondary = FALSE;
- pR128Ent->HasSecondary = FALSE;
- pR128Ent->IsSecondaryRestored = FALSE;
- }
- }
instance++;
}
@@ -379,6 +372,9 @@ _X_EXPORT DriverRec R128 =
NULL,
#ifdef XSERVER_LIBPCIACCESS
r128_device_match,
- r128_pci_probe
+ r128_pci_probe,
+#endif
+#ifdef XSERVER_PLATFORM_BUS
+ NULL
#endif
};
diff --git a/driver/xf86-video-r128/src/r128_probe.h b/driver/xf86-video-r128/src/r128_probe.h
index 41fc0e474..0b54d2135 100644
--- a/driver/xf86-video-r128/src/r128_probe.h
+++ b/driver/xf86-video-r128/src/r128_probe.h
@@ -37,21 +37,130 @@
#define _R128_PROBE_H_ 1
#include "xf86str.h"
+#include "xf86DDC.h"
+#include "randrstr.h"
+#include "xf86Crtc.h"
+
+#include "compat-api.h"
+
+#ifdef USE_EXA
+#include "exa.h"
+#endif
+
+/* Chip definitions */
+#define PCI_VENDOR_ATI 0x1002
+#define PCI_CHIP_RAGE128LE 0x4C45
+#define PCI_CHIP_RAGE128LF 0x4C46
+#define PCI_CHIP_RAGE128MF 0x4D46
+#define PCI_CHIP_RAGE128ML 0x4D4C
+#define PCI_CHIP_RAGE128PA 0x5041
+#define PCI_CHIP_RAGE128PB 0x5042
+#define PCI_CHIP_RAGE128PC 0x5043
+#define PCI_CHIP_RAGE128PD 0x5044
+#define PCI_CHIP_RAGE128PE 0x5045
+#define PCI_CHIP_RAGE128PF 0x5046
+#define PCI_CHIP_RAGE128PG 0x5047
+#define PCI_CHIP_RAGE128PH 0x5048
+#define PCI_CHIP_RAGE128PI 0x5049
+#define PCI_CHIP_RAGE128PJ 0x504A
+#define PCI_CHIP_RAGE128PK 0x504B
+#define PCI_CHIP_RAGE128PL 0x504C
+#define PCI_CHIP_RAGE128PM 0x504D
+#define PCI_CHIP_RAGE128PN 0x504E
+#define PCI_CHIP_RAGE128PO 0x504F
+#define PCI_CHIP_RAGE128PP 0x5050
+#define PCI_CHIP_RAGE128PQ 0x5051
+#define PCI_CHIP_RAGE128PR 0x5052
+#define PCI_CHIP_RAGE128PS 0x5053
+#define PCI_CHIP_RAGE128PT 0x5054
+#define PCI_CHIP_RAGE128PU 0x5055
+#define PCI_CHIP_RAGE128PV 0x5056
+#define PCI_CHIP_RAGE128PW 0x5057
+#define PCI_CHIP_RAGE128PX 0x5058
+#define PCI_CHIP_RAGE128RE 0x5245
+#define PCI_CHIP_RAGE128RF 0x5246
+#define PCI_CHIP_RAGE128RG 0x5247
+#define PCI_CHIP_RAGE128RK 0x524B
+#define PCI_CHIP_RAGE128RL 0x524C
+#define PCI_CHIP_RAGE128SE 0x5345
+#define PCI_CHIP_RAGE128SF 0x5346
+#define PCI_CHIP_RAGE128SG 0x5347
+#define PCI_CHIP_RAGE128SH 0x5348
+#define PCI_CHIP_RAGE128SK 0x534B
+#define PCI_CHIP_RAGE128SL 0x534C
+#define PCI_CHIP_RAGE128SM 0x534D
+#define PCI_CHIP_RAGE128SN 0x534E
+#define PCI_CHIP_RAGE128TF 0x5446
+#define PCI_CHIP_RAGE128TL 0x544C
+#define PCI_CHIP_RAGE128TR 0x5452
+#define PCI_CHIP_RAGE128TS 0x5453
+#define PCI_CHIP_RAGE128TT 0x5454
+#define PCI_CHIP_RAGE128TU 0x5455
extern DriverRec R128;
-typedef struct
+typedef enum
{
- Bool IsDRIEnabled;
+ MT_UNKNOWN = -1,
+ MT_NONE = 0,
+ MT_CRT = 1,
+ MT_LCD = 2,
+ MT_DFP = 3,
+ MT_CTV = 4,
+ MT_STV = 5
+} R128MonitorType;
+
+typedef enum
+{
+ OUTPUT_NONE,
+ OUTPUT_VGA,
+ OUTPUT_DVI,
+ OUTPUT_LVDS
+} R128OutputType;
+
+typedef struct {
+ uint32_t ddc_reg;
+ uint32_t put_clk_mask;
+ uint32_t put_data_mask;
+ uint32_t get_clk_mask;
+ uint32_t get_data_mask;
+} R128I2CBusRec, *R128I2CBusPtr;
+typedef struct _R128CrtcPrivateRec {
+ void *rotate_mem;
+ int crtc_id;
+ uint32_t cursor_offset;
+ /* Lookup table values to be set when the CRTC is enabled */
+ uint8_t lut_r[256], lut_g[256], lut_b[256];
+} R128CrtcPrivateRec, *R128CrtcPrivatePtr;
+
+typedef struct _R128OutputPrivateRec {
+ int num;
+ R128OutputType type;
+ R128MonitorType MonType;
+ I2CBusPtr pI2CBus;
+ R128I2CBusRec ddc_i2c;
+ int PanelXRes;
+ int PanelYRes;
+ int PanelPwrDly;
+} R128OutputPrivateRec, *R128OutputPrivatePtr;
+
+#define R128_MAX_CRTC 2
+#define R128_MAX_BIOS_CONNECTOR 2
+
+typedef struct
+{
Bool HasSecondary;
- Bool BypassSecondary;
+ Bool HasCRTC2;
/*These two registers are used to make sure the CRTC2 is
retored before CRTC_EXT, otherwise it could lead to blank screen.*/
Bool IsSecondaryRestored;
Bool RestorePrimary;
- ScrnInfoPtr pSecondaryScrn;
+ xf86CrtcPtr pCrtc[R128_MAX_CRTC];
+ R128CrtcPrivatePtr Controller[R128_MAX_CRTC];
+
+ ScrnInfoPtr pSecondaryScrn;
ScrnInfoPtr pPrimaryScrn;
} R128EntRec, *R128EntPtr;
diff --git a/driver/xf86-video-r128/src/r128_reg.h b/driver/xf86-video-r128/src/r128_reg.h
index dac22e6b0..b147e0071 100644
--- a/driver/xf86-video-r128/src/r128_reg.h
+++ b/driver/xf86-video-r128/src/r128_reg.h
@@ -57,12 +57,12 @@
#define OUTREG16(addr, val) MMIO_OUT16(R128MMIO, addr, val)
#define OUTREG(addr, val) MMIO_OUT32(R128MMIO, addr, val)
-#define ADDRREG(addr) ((volatile CARD32 *)(pointer)(R128MMIO + (addr)))
+#define ADDRREG(addr) ((volatile uint32_t *)(pointer)(R128MMIO + (addr)))
#define OUTREGP(addr, val, mask) \
do { \
- CARD32 tmp = INREG(addr); \
+ uint32_t tmp = INREG(addr); \
tmp &= (mask); \
tmp |= ((val) & ~(mask)); \
OUTREG(addr, tmp); \
@@ -78,7 +78,7 @@
#define OUTPLLP(pScrn, addr, val, mask) \
do { \
- CARD32 tmp = INPLL(pScrn, addr); \
+ uint32_t tmp = INPLL(pScrn, addr); \
tmp &= (mask); \
tmp |= ((val) & ~(mask)); \
OUTPLL(addr, tmp); \
@@ -94,7 +94,7 @@
OUTREG(R128_PALETTE_DATA, ((r) << 16) | ((g) << 8) | (b)); \
} while (0)
-#define OUTPAL_NEXT_CARD32(v) \
+#define OUTPAL_NEXT_uint32_t(v) \
do { \
OUTREG(R128_PALETTE_DATA, (v & 0x00ffffff)); \
} while (0)
@@ -114,12 +114,12 @@
#define PAL_SELECT(idx) \
do { \
- CARD32 tmp = INREG(R128_DAC_CNTL); \
+ uint32_t tmp = INREG(R128_DAC_CNTL); \
if (idx) { \
OUTREG(R128_DAC_CNTL, tmp | R128_DAC_PALETTE_ACC_CTL); \
} else { \
OUTREG(R128_DAC_CNTL, tmp & \
- (CARD32)~R128_DAC_PALETTE_ACC_CTL); \
+ (uint32_t)~R128_DAC_PALETTE_ACC_CTL); \
} \
} while (0)
@@ -599,7 +599,7 @@
#define R128_FP_GEN_CNTL 0x0284
# define R128_FP_FPON (1 << 0)
# define R128_FP_BLANK_DIS (1 << 1)
-# define R128_FP_TDMS_EN (1 << 2)
+# define R128_FP_TMDS_EN (1 << 2)
# define R128_FP_DETECT_SENSE (1 << 8)
# define R128_FP_SEL_CRTC2 (1 << 13)
# define R128_FP_CRTC_DONT_SHADOW_VPAR (1 << 16)
@@ -905,6 +905,8 @@
# define R128_PPLL_ATOMIC_UPDATE_EN (1 << 16)
# define R128_PPLL_VGA_ATOMIC_UPDATE_EN (1 << 17)
#define R128_PPLL_DIV_0 0x0004 /* PLL */
+# define R128_PPLL_FB0_DIV_MASK 0x07ff
+# define R128_PPLL_POST0_DIV_MASK 0x00070000
#define R128_PPLL_DIV_1 0x0005 /* PLL */
#define R128_PPLL_DIV_2 0x0006 /* PLL */
#define R128_PPLL_DIV_3 0x0007 /* PLL */
diff --git a/driver/xf86-video-r128/src/r128_rop.h b/driver/xf86-video-r128/src/r128_rop.h
new file mode 100644
index 000000000..6b9886889
--- /dev/null
+++ b/driver/xf86-video-r128/src/r128_rop.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
+ * Precision Insight, Inc., Cedar Park, Texas, and
+ * VA Linux Systems Inc., Fremont, California.
+ *
+ * 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 on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
+ * SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. Faith <faith@valinux.com>
+ * Kevin E. Martin <martin@valinux.com>
+ *
+ */
+
+#ifndef _R128_ROP_H_
+#define _R128_ROP_H_
+
+#include "r128_reg.h"
+
+static struct {
+ int rop;
+ int pattern;
+} R128_ROP[] = {
+ { R128_ROP3_ZERO, R128_ROP3_ZERO }, /* GXclear */
+ { R128_ROP3_DSa, R128_ROP3_DPa }, /* Gxand */
+ { R128_ROP3_SDna, R128_ROP3_PDna }, /* GXandReverse */
+ { R128_ROP3_S, R128_ROP3_P }, /* GXcopy */
+ { R128_ROP3_DSna, R128_ROP3_DPna }, /* GXandInverted */
+ { R128_ROP3_D, R128_ROP3_D }, /* GXnoop */
+ { R128_ROP3_DSx, R128_ROP3_DPx }, /* GXxor */
+ { R128_ROP3_DSo, R128_ROP3_DPo }, /* GXor */
+ { R128_ROP3_DSon, R128_ROP3_DPon }, /* GXnor */
+ { R128_ROP3_DSxn, R128_ROP3_PDxn }, /* GXequiv */
+ { R128_ROP3_Dn, R128_ROP3_Dn }, /* GXinvert */
+ { R128_ROP3_SDno, R128_ROP3_PDno }, /* GXorReverse */
+ { R128_ROP3_Sn, R128_ROP3_Pn }, /* GXcopyInverted */
+ { R128_ROP3_DSno, R128_ROP3_DPno }, /* GXorInverted */
+ { R128_ROP3_DSan, R128_ROP3_DPan }, /* GXnand */
+ { R128_ROP3_ONE, R128_ROP3_ONE } /* GXset */
+};
+#endif
+
diff --git a/driver/xf86-video-r128/src/r128_video.c b/driver/xf86-video-r128/src/r128_video.c
index bb5a6553a..cac430193 100644
--- a/driver/xf86-video-r128/src/r128_video.c
+++ b/driver/xf86-video-r128/src/r128_video.c
@@ -59,8 +59,8 @@ typedef struct {
void* BufferHandle;
int videoOffset;
RegionRec clip;
- CARD32 colorKey;
- CARD32 videoStatus;
+ uint32_t colorKey;
+ uint32_t videoStatus;
Time offTime;
Time freeTime;
int ecp_div;
@@ -226,7 +226,7 @@ R128SetupImageVideo(ScreenPtr pScreen)
return NULL;
adapt->type = XvWindowMask | XvInputMask | XvImageMask;
- adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
+ adapt->flags = VIDEO_OVERLAID_IMAGES /*| VIDEO_CLIP_TO_VIEWPORT*/;
adapt->name = "ATI Rage128 Video Overlay";
adapt->nEncodings = 1;
adapt->pEncodings = &DummyEncoding;
@@ -405,7 +405,7 @@ R128DMA(
#define BUFSIZE (R128_BUFFER_SIZE - R128_HOSTDATA_BLIT_OFFSET)
#define MAXPASSES (MAXHEIGHT/(BUFSIZE/(MAXWIDTH*2))+1)
- unsigned char *fb = (CARD8*)info->FB;
+ unsigned char *fb = (uint8_t*)info->FB;
unsigned char *buf;
int err=-1, i, idx, offset, hpass, passes, srcpassbytes, dstpassbytes;
int sizes[MAXPASSES], list[MAXPASSES];
@@ -572,78 +572,80 @@ R128CopyData420(
}
-static CARD32
+uint32_t
R128AllocateMemory(
- ScrnInfoPtr pScrn,
- void **mem_struct,
- int size
+ ScrnInfoPtr pScrn,
+ void **mem_struct,
+ int size,
+ int align,
+ Bool need_accel
){
- R128InfoPtr info = R128PTR(pScrn);
- ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
- int offset = 0;
+ R128InfoPtr info = R128PTR(pScrn);
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
+ Bool do_linear = !need_accel;
+ uint32_t offset = 0;
- if(!info->useEXA) {
+#ifdef HAVE_XAA_H
+ if (!info->accel && need_accel)
+ do_linear = FALSE;
+ else
+ do_linear = TRUE;
+#endif
+#ifdef USE_EXA
+ if (info->ExaDriver) {
+ ExaOffscreenArea *area = *mem_struct;
+
+ if (area != NULL) {
+ if (area->size >= size) return area->offset;
+
+ exaOffscreenFree(pScreen, area);
+ }
+
+ area = exaOffscreenAlloc(pScreen, size, align, TRUE, NULL, NULL);
+ *mem_struct = area;
+
+ if (area == NULL) return 0;
+ offset = area->offset;
+ }
+#endif
+ if (!info->useEXA && do_linear) {
FBLinearPtr linear = *mem_struct;
int cpp = info->CurrentLayout.pixel_bytes;
- /* XAA allocates in units of pixels at the screen bpp, so adjust size appropriately. */
- size = (size + cpp - 1) / cpp;
+ /* XAA allocates in units of pixels at the screen bpp, so adjust size appropriately. */
+ size = (size + cpp - 1) / cpp;
+ align = (align + cpp - 1) / cpp;
if(linear) {
- if(linear->size >= size)
- return linear->offset * cpp;
+ if(linear->size >= size)
+ return linear->offset * cpp;
- if(xf86ResizeOffscreenLinear(linear, size))
- return linear->offset * cpp;
+ if(xf86ResizeOffscreenLinear(linear, size))
+ return linear->offset * cpp;
- xf86FreeOffscreenLinear(linear);
+ xf86FreeOffscreenLinear(linear);
}
-
- linear = xf86AllocateOffscreenLinear(pScreen, size, 8,
- NULL, NULL, NULL);
+ linear = xf86AllocateOffscreenLinear(pScreen, size, align, NULL, NULL, NULL);
*mem_struct = linear;
if(!linear) {
- int max_size;
-
- xf86QueryLargestOffscreenLinear(pScreen, &max_size, 8,
- PRIORITY_EXTREME);
+ int max_size;
- if(max_size < size)
- return 0;
+ xf86QueryLargestOffscreenLinear(pScreen, &max_size, align, PRIORITY_EXTREME);
+ if(max_size < size) return 0;
- xf86PurgeUnlockedOffscreenAreas(pScreen);
- linear = xf86AllocateOffscreenLinear(pScreen, size, 8,
- NULL, NULL, NULL);
+ xf86PurgeUnlockedOffscreenAreas(pScreen);
+ linear = xf86AllocateOffscreenLinear(pScreen, size, align, NULL, NULL, NULL);
- if(!linear) return 0;
+ *mem_struct = linear;
+ if(!linear) return 0;
}
- offset = linear->offset * cpp;
- }
-#ifdef USE_EXA
- else {
- /* EXA support based on mga driver */
- ExaOffscreenArea *area = *mem_struct;
-
- if(area) {
- if(area->size >= size)
- return area->offset;
-
- exaOffscreenFree(pScrn->pScreen, area);
- }
-
- area = exaOffscreenAlloc(pScrn->pScreen, size, 64, TRUE, NULL, NULL);
- *mem_struct = area;
-
- if(!area) return 0;
-
- offset = area->offset;
- }
-#endif
+ offset = linear->offset * cpp;
+ }
- return offset;
+ return offset;
}
static void
@@ -659,12 +661,16 @@ R128DisplayVideo422(
short drw_w, short drw_h
){
R128InfoPtr info = R128PTR(pScrn);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
+ xf86OutputPtr output = R128FirstOutput(pR128Ent->pCrtc[0]);
+ R128OutputPrivatePtr r128_output = output->driver_private;
unsigned char *R128MMIO = info->MMIO;
R128PortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr;
+
int v_inc, h_inc, step_by, tmp, v_inc_shift;
int p1_h_accum_init, p23_h_accum_init;
int p1_v_accum_init;
- Bool rmx_active;
+ Bool rmx_active = FALSE;
R128ECP(pScrn, pPriv);
@@ -673,10 +679,11 @@ R128DisplayVideo422(
v_inc_shift++;
if (pScrn->currentMode->Flags & V_DBLSCAN)
v_inc_shift--;
-
- rmx_active = INREG(R128_FP_VERT_STRETCH) & R128_VERT_STRETCH_ENABLE;
+
+ if (r128_output->PanelYRes > 0)
+ rmx_active = INREG(R128_FP_VERT_STRETCH) & R128_VERT_STRETCH_ENABLE;
if (rmx_active) {
- v_inc = ((src_h * pScrn->currentMode->CrtcVDisplay / info->PanelYRes) << v_inc_shift) / drw_h;
+ v_inc = ((src_h * pScrn->currentMode->CrtcVDisplay / r128_output->PanelYRes) << v_inc_shift) / drw_h;
} else {
v_inc = (src_h << v_inc_shift) / drw_h;
}
@@ -745,22 +752,26 @@ R128DisplayVideo420(
short drw_w, short drw_h
){
R128InfoPtr info = R128PTR(pScrn);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
+ xf86OutputPtr output = R128FirstOutput(pR128Ent->pCrtc[0]);
+ R128OutputPrivatePtr r128_output = output->driver_private;
unsigned char *R128MMIO = info->MMIO;
R128PortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr;
int v_inc, h_inc, step_by, tmp, leftUV, v_inc_shift;
int p1_h_accum_init, p23_h_accum_init;
int p1_v_accum_init, p23_v_accum_init;
- Bool rmx_active;
+ Bool rmx_active = FALSE;
v_inc_shift = 20;
if (pScrn->currentMode->Flags & V_INTERLACE)
v_inc_shift++;
if (pScrn->currentMode->Flags & V_DBLSCAN)
v_inc_shift--;
-
- rmx_active = INREG(R128_FP_VERT_STRETCH) & R128_VERT_STRETCH_ENABLE;
+
+ if (r128_output->PanelYRes > 0)
+ rmx_active = INREG(R128_FP_VERT_STRETCH) & R128_VERT_STRETCH_ENABLE;
if (rmx_active) {
- v_inc = ((src_h * pScrn->currentMode->CrtcVDisplay / info->PanelYRes) << v_inc_shift) / drw_h;
+ v_inc = ((src_h * pScrn->currentMode->CrtcVDisplay / r128_output->PanelYRes) << v_inc_shift) / drw_h;
} else {
v_inc = (src_h << v_inc_shift) / drw_h;
}
@@ -841,17 +852,24 @@ R128PutImage(
){
R128InfoPtr info = R128PTR(pScrn);
R128PortPrivPtr pPriv = (R128PortPrivPtr)data;
- unsigned char *fb = (CARD8*)info->FB;
+ unsigned char *fb = (uint8_t*)info->FB;
INT32 xa, xb, ya, yb;
int new_size, offset, s1offset, s2offset, s3offset;
int srcPitch, srcPitch2, dstPitch;
int d1line, d2line, d3line, d1offset, d2offset, d3offset;
int top, left, npixels, nlines;
BoxRec dstBox;
- CARD32 tmp;
+ uint32_t tmp;
+
+ /* Currently, the video is only visible on the first monitor.
+ * In the future we could try to make this smarter, or just implement
+ * textured video. */
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcPtr crtc = xf86_config->crtc[0];
+
#if X_BYTE_ORDER == X_BIG_ENDIAN
unsigned char *R128MMIO = info->MMIO;
- CARD32 config_cntl = INREG(R128_CONFIG_CNTL);
+ uint32_t config_cntl = INREG(R128_CONFIG_CNTL);
/* We need to disable byte swapping, or the data gets mangled */
OUTREG(R128_CONFIG_CNTL, config_cntl &
@@ -893,10 +911,10 @@ R128PutImage(
clipBoxes, width, height))
return Success;
- dstBox.x1 -= pScrn->frameX0;
- dstBox.x2 -= pScrn->frameX0;
- dstBox.y1 -= pScrn->frameY0;
- dstBox.y2 -= pScrn->frameY0;
+ dstBox.x1 -= crtc->x;
+ dstBox.x2 -= crtc->x;
+ dstBox.y1 -= crtc->y;
+ dstBox.y2 -= crtc->y;
switch(id) {
case FOURCC_YV12:
@@ -922,11 +940,12 @@ R128PutImage(
break;
}
- if(!(pPriv->videoOffset = R128AllocateMemory(pScrn, &(pPriv->BufferHandle),
- pPriv->doubleBuffer ? (new_size << 1) : new_size)))
- {
- return BadAlloc;
- }
+ pPriv->videoOffset = R128AllocateMemory(pScrn, &(pPriv->BufferHandle),
+ pPriv->doubleBuffer ? (new_size << 1) : new_size,
+ 64, FALSE);
+
+ if (pPriv->videoOffset == 0)
+ return BadAlloc;
pPriv->currentBuffer ^= 1;