ChangeLog                               |  183 ++++++++++++++++++++++
 debian/changelog                        |   24 +++
 debian/rules                            |    4 
 debian/xsfbs/xsfbs.mk                   |   29 +--
 src/AtomBios/CD_Operations.c            |   61 ++++---
 src/AtomBios/Decoder.c                  |  108 +++++++------
 src/AtomBios/hwserv_drv.c               |   14 +
 src/AtomBios/includes/CD_Common_Types.h |   12 +
 src/AtomBios/includes/CD_Definitions.h  |    3 
 src/AtomBios/includes/CD_Structs.h      |   24 ++-
 src/AtomBios/includes/Decoder.h         |   24 ++-
 src/AtomBios/includes/atombios.h        |   24 ++-
 src/ati_pciids_gen.h                    |    2 
 src/atombios_crtc.c                     |   37 +++-
 src/atombios_output.c                   |   30 +--
 src/legacy_crtc.c                       |  255 ++++++++++++++------------------
 src/legacy_output.c                     |   31 +--
 src/pcidb/ati_pciids.csv                |    2 
 src/radeon.h                            |   32 +++-
 src/radeon_atombios.c                   |   54 ++++--
 src/radeon_atomwrapper.c                |    1 
 src/radeon_bios.c                       |  101 ++++++++----
 src/radeon_chipinfo_gen.h               |    2 
 src/radeon_chipset_gen.h                |    2 
 src/radeon_commonfuncs.c                |    9 -
 src/radeon_crtc.c                       |   38 ++++
 src/radeon_cursor.c                     |   16 +-
 src/radeon_driver.c                     |  139 ++++++++++++-----
 src/radeon_exa.c                        |    6 
 src/radeon_macros.h                     |   26 ---
 src/radeon_output.c                     |   11 +
 src/radeon_pci_chipset_gen.h            |    2 
 src/radeon_pci_device_match_gen.h       |    2 
 src/radeon_probe.h                      |    2 
 src/radeon_reg.h                        |   24 ++-
 src/radeon_textured_videofuncs.c        |    7 
 36 files changed, 907 insertions(+), 434 deletions(-)

New commits:
commit ecc615d2b29c695fb3870ab948a8e7945e22cadf
Author: Brice Goglin <[EMAIL PROTECTED]>
Date:   Sat Aug 2 18:54:20 2008 +0200

    Fix debian/rules build/patch dependencies

diff --git a/debian/changelog b/debian/changelog
index 1e160d9..c615d2e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,8 +18,9 @@ xserver-xorg-video-ati (1:6.9.0-1+lenny2) UNRELEASED; 
urgency=low
     + Add quirk for oem x300 card (closes: #492457).
     + Fix error in driver connector table for powerbook w/ vga.
     + R300: NUM_FPU adjustments for VAP_CNTL.
+  * Fix debian/rules build/patch dependencies.
 
- -- Brice Goglin <[EMAIL PROTECTED]>  Sat, 02 Aug 2008 18:25:52 +0200
+ -- Brice Goglin <[EMAIL PROTECTED]>  Sat, 02 Aug 2008 18:54:00 +0200
 
 xserver-xorg-video-ati (1:6.9.0-1+lenny1) unstable; urgency=low
 
diff --git a/debian/rules b/debian/rules
index 28b1db1..92c7a24 100755
--- a/debian/rules
+++ b/debian/rules
@@ -31,8 +31,8 @@ endif
 # kbd_drv.a isn't phenomenally useful; kbd_drv.so more so
 confflags += --disable-static
 
-build: patch build-stamp
-build-stamp:
+build: build-stamp
+build-stamp: $(STAMP_DIR)/patch
        dh_testdir
 
        test -d obj-$(DEB_BUILD_GNU_TYPE) || mkdir obj-$(DEB_BUILD_GNU_TYPE)

commit 918039a9130a2e1e795df0e9087baff0fedd5844
Author: Brice Goglin <[EMAIL PROTECTED]>
Date:   Sat Aug 2 18:51:00 2008 +0200

    Update changelogs for new cherry-picked commits

diff --git a/ChangeLog b/ChangeLog
index 51ab107..01f72b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,186 @@
+commit 6c23ba42869a36d4a9c82ea8ba36e1098c461756
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Fri Jul 11 19:05:00 2008 -0400
+
+    R300: NUM_FPU adjustments for VAP_CNTL
+    (cherry picked from commit ab14f725676e4d4e45278c64b03fe2d328a3e439)
+
+commit 42aa10126169368845948e8669d74e08550568bc
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Mon Jul 28 17:12:41 2008 -0400
+
+    Fix error in driver connector table for powerbook w/ vga
+    (cherry picked from commit 0a505297f09aefb1b4432176a263bfdf6f256f77)
+
+commit 674f167876a99ca2171f51a6d42f4d994dd73820
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Mon Jul 28 11:09:10 2008 -0400
+
+    Add quirk for oem x300 card
+    
+    - debian bug 492457
+    (cherry picked from commit d5799ac53c3e1b2ca1da97780b171a44060c3aad)
+
+commit efbc15c5f470f941727b1a0acdc2c9b1719df245
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Mon Jul 21 13:47:09 2008 -0400
+
+    Interlaced mode fixups for AVIVO chips
+    (cherry picked from commit b0378bb145c8a915c943bef7d17f2cdecfccc891)
+
+commit cc94ae803a9d8a30d4eae8615d788033c8a23bb8
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Mon Jul 21 10:36:48 2008 -0400
+
+    Clear display priority bits before resetting them
+    (cherry picked from commit c18fad622a3c4f9572051120d83af68b625b5686)
+
+commit b92f15495e40f86abd295393745af94c377a32c9
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Mon Jul 21 10:30:41 2008 -0400
+
+    Clean up legacy display watermark setup
+    
+    - makes crtc1 and crtc2 watermark setup independant.
+    - fixes the case where only crtc2 is active
+    (cherry picked from commit dc231ff8e063313d2bcf5acccad67a9f8a7e3314)
+
+commit e96ae005ee43fd51b93fbfb981301a8c4fce0e56
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Sat Jul 19 11:34:16 2008 -0400
+
+    Add oem quirk for external tmds setup on Dell Inspiron 8600
+    
+    Noticed by fnord42 on IRC.
+    (cherry picked from commit ecb6347a3d7071890600c98c2addef3a8ca260ee)
+
+commit c4619531386d7e2959676b9fda565b755c113cd3
+Author: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
+Date:   Thu Jul 17 14:37:05 2008 +1000
+
+    Fix console switch on R500
+    
+    This patch fixes the console switch for me on R5xx.
+    
+    There are two aspects to it:
+    
+     - Fix the ordering of avivo_restore() to better match what's
+    happening in the driver & ATOM, properly locking/unlocking and
+    only enabling the CRTCs after everything has been properly
+    programmed.
+    
+     - Don't ASIC_INIT if the card has any CRTC enabled. This is the
+    best I came up with for avoiding spurrious ASIC_INIT on cards that
+    -are- POSTed but don't have the BIOS coming from c0000 on x86. The
+    problem with spurrious ASIC_INIT is that we do it before we do
+    RADEONSave(), so that screws up the console switch.
+    
+    Note that I think we also should save/restore the palette, I don't think
+    we do. right now, it's a minor issue for me because I fixed offb to be
+    able to set it on AVIVO's but it might still have to be done in the long
+    run.
+    
+    Tested with a VGA analog setup on DACA and a DVI setup on TMDS 0. I
+    haven't tested any other combo but that should get us going.
+    
+    Cheers,
+    Ben.
+    
+    Signed-off-by: Dave Airlie <[EMAIL PROTECTED]>
+    (cherry picked from commit df53d12a06fad41f00cff849458cb358ab5e2098)
+
+commit 42f9bfd17c116d365eb022a1776521d60676debb
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Tue Jul 15 17:50:32 2008 -0400
+
+    ATOM: fix for r4xx cards with no VRAM_Usage tables
+    
+    fixes bug 15954
+    (cherry picked from commit e8c07270e1fc2ee455320370692aaf90abac2773)
+
+commit b54cd719990c1dcc08e53e5cd399ffb010193855
+Author: Dave Airlie <[EMAIL PROTECTED]>
+Date:   Sat Jul 12 18:47:07 2008 +1000
+
+    atombios: fix typo in mode conversion for panel
+    (cherry picked from commit a6db4dc65aec560f3b1f37ff73ec6b0bd8207295)
+
+commit dd60db34068144236d7083b917180a8a08a26c39
+Author: Dave Airlie <[EMAIL PROTECTED]>
+Date:   Sat Jul 12 10:46:36 2008 +1000
+
+    pciid: add radeon HD3850.
+    
+    pci id from legume on #radeon
+    (cherry picked from commit a9746114369d516072d841ec356ec3ba3d0be71a)
+
+commit 09edc173cd2e93aa08947fac8693c75bf5edeac8
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Fri Jul 11 15:31:57 2008 -0400
+
+    Make sure cursor offsets are properly aligned when using EXA
+    (cherry picked from commit 810c28cc2660b73e03e4d27be97988fc5321a06f)
+
+commit 68f494379edf1fe4b21007f6a27e9f39d2ed10d6
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Fri Jul 11 14:30:17 2008 -0400
+
+    Fix cursor with multi-head and rotation
+    (cherry picked from commit 7e67d0163579a44f104e8f354a929ac9b33e4c21)
+
+commit 1b90deaa812e89e4fe51d4a142bae98450066e54
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Tue Jul 8 09:57:04 2008 -0400
+
+    Add quirk for Falcon NW laptop
+    (cherry picked from commit 9086d008fb8c3cde0633b90ce19ffbf4eded388d)
+
+commit fbac1ce622b29556b2ee537ba799d23ada7b0218
+Author: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
+Date:   Tue Jul 8 21:58:43 2008 +1000
+
+    atombios: add support for other endians.
+    
+    This is a cleaned up (in as much as atombios can be..) of benh's patch.
+    
+    airlied - removed benh's debugging for now, it might need to be put back 
later..
+    (cherry picked from commit 61f82ace0210251beb0bcc492218a75a193e1deb)
+
+commit 354676aab4cef49ca03f73baa30ecde9819db7e6
+Author: Roland Scheidegger <[EMAIL PROTECTED]>
+Date:   Mon Jul 7 14:39:47 2008 -0400
+
+    clamp tex coords (r100/r200) for textured video
+    
+    fixes bug 14904
+    (cherry picked from commit 7ae4cec8cc8c90aee5dc4fa7abcce22321d4f4eb)
+
+commit 8fc6da851c166fab36126fa60f2d24ac507e4353
+Author: Wolke Liu <[EMAIL PROTECTED]>
+Date:   Tue Jul 1 10:45:39 2008 -0400
+
+    Add pci id for FireMV 2400
+    (cherry picked from commit c037b4ce8769ad840a257e22b1e4ad58b8ed96fa)
+
+commit dc431323333e7c24d3f02e32fcee7495248f543f
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Fri Jun 27 20:36:54 2008 -0400
+
+    RADEON: IGP VGA fixes take 2
+    
+    It seems only RS300/350/400/480 are missing the primary dac
+    See bug 15708
+    (cherry picked from commit cfaa23d925e3c062cf87ea844566ac11ea02d69e)
+
+commit 6d1534fcfe11954125697208fbdc6b87dd78a341
+Author: Alex Deucher <[EMAIL PROTECTED]>
+Date:   Fri Jun 27 20:29:04 2008 -0400
+
+    Revert "IGP: attempt to fix VGA on IGP chips"
+    
+    This reverts commit e78e8a21b4040cd7f1983c241c860d9209398396.
+    (cherry picked from commit 31c27ffcb3c4c5334cf726ecd4e293a678b2a1ea)
+
 commit c83fbdfa076c107012b7dfbbfbbb2feede00542b
 Author: Alex Deucher <[EMAIL PROTECTED]>
 Date:   Thu Jun 26 19:48:45 2008 -0400
diff --git a/debian/changelog b/debian/changelog
index 45fb9bb..1e160d9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,26 @@
+xserver-xorg-video-ati (1:6.9.0-1+lenny2) UNRELEASED; urgency=low
+
+  * Cherry-pick patches from the upstream git repository:
+    + IGP VGA fixes.
+    + Add PCI ids for FireMV 2400 and HD3850.
+    + Clamp tex coords (r100/r200) for textured video (closes: #489779).
+    + Atombios: add support for other endians.
+    + Add quirk for Falcon NW laptop.
+    + Fix cursor with multi-head and rotation.
+    + Make sure cursor offsets are properly aligned when using EXA.
+    + Atombios: fix typo in mode conversion for panel.
+    + ATOM: fix for r4xx cards with no VRAM_Usage tables (closes: #467263)
+    + Fix console switch on R500.
+    + Add oem quirk for external tmds setup on Dell Inspiron 8600.
+    + Clean up legacy display watermark setup.
+    + Clear display priority bits before resetting them.
+    + Interlaced mode fixups for AVIVO chips.
+    + Add quirk for oem x300 card (closes: #492457).
+    + Fix error in driver connector table for powerbook w/ vga.
+    + R300: NUM_FPU adjustments for VAP_CNTL.
+
+ -- Brice Goglin <[EMAIL PROTECTED]>  Sat, 02 Aug 2008 18:25:52 +0200
+
 xserver-xorg-video-ati (1:6.9.0-1+lenny1) unstable; urgency=low
 
   * Do not export MACH64, MACH32 and R128 pci ids in radeon.ids,

commit c13760f21455eeaf2e9940913f82c9dff648de82
Author: Alex Deucher <[EMAIL PROTECTED]>
Date:   Fri Jul 11 19:05:00 2008 -0400

    R300: NUM_FPU adjustments for VAP_CNTL
    (cherry picked from commit ab14f725676e4d4e45278c64b03fe2d328a3e439)

diff --git a/src/radeon_commonfuncs.c b/src/radeon_commonfuncs.c
index 58fe306..d0c5229 100644
--- a/src/radeon_commonfuncs.c
+++ b/src/radeon_commonfuncs.c
@@ -158,13 +158,14 @@ static void FUNC_NAME(RADEONInit3DEngine)(ScrnInfoPtr 
pScrn)
        if (info->ChipFamily == CHIP_FAMILY_RV515)
            vap_cntl |= (2 << R300_PVS_NUM_FPUS_SHIFT);
        else if ((info->ChipFamily == CHIP_FAMILY_RV530) ||
-                (info->ChipFamily == CHIP_FAMILY_RV560))
+                (info->ChipFamily == CHIP_FAMILY_RV560) ||
+                (info->ChipFamily == CHIP_FAMILY_RV570))
            vap_cntl |= (5 << R300_PVS_NUM_FPUS_SHIFT);
-       else if (info->ChipFamily == CHIP_FAMILY_R420)
+       else if ((info->ChipFamily == CHIP_FAMILY_RV410) ||
+                (info->ChipFamily == CHIP_FAMILY_R420))
            vap_cntl |= (6 << R300_PVS_NUM_FPUS_SHIFT);
        else if ((info->ChipFamily == CHIP_FAMILY_R520) ||
-                (info->ChipFamily == CHIP_FAMILY_R580) ||
-                (info->ChipFamily == CHIP_FAMILY_RV570))
+                (info->ChipFamily == CHIP_FAMILY_R580))
            vap_cntl |= (8 << R300_PVS_NUM_FPUS_SHIFT);
        else
            vap_cntl |= (4 << R300_PVS_NUM_FPUS_SHIFT);

commit 905750745de646ff6ed2faed0f732c74c2791292
Author: Alex Deucher <[EMAIL PROTECTED]>
Date:   Mon Jul 28 17:12:41 2008 -0400

    Fix error in driver connector table for powerbook w/ vga
    (cherry picked from commit 0a505297f09aefb1b4432176a263bfdf6f256f77)

diff --git a/src/radeon_output.c b/src/radeon_output.c
index b725e0a..b22442c 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -2308,7 +2308,7 @@ static Bool RADEONSetupAppleConnectors(ScrnInfoPtr pScrn)
        info->BiosConnector[0].ddc_i2c = 
legacy_setup_i2c_bus(RADEON_GPIO_DVI_DDC);
        info->BiosConnector[0].DACType = DAC_NONE;
        info->BiosConnector[0].TMDSType = TMDS_NONE;
-       info->BiosConnector[0].ConnectorType = CONNECTOR_VGA;
+       info->BiosConnector[0].ConnectorType = CONNECTOR_LVDS;
        info->BiosConnector[0].valid = TRUE;
 
        info->BiosConnector[1].ddc_i2c = 
legacy_setup_i2c_bus(RADEON_GPIO_VGA_DDC);

commit 91e75689d4ae42742b932aef9bbade85f9578d70
Author: Alex Deucher <[EMAIL PROTECTED]>
Date:   Mon Jul 28 11:09:10 2008 -0400

    Add quirk for oem x300 card
    
    - debian bug 492457
    (cherry picked from commit d5799ac53c3e1b2ca1da97780b171a44060c3aad)

diff --git a/src/radeon_bios.c b/src/radeon_bios.c
index 35e6960..adedeb3 100644
--- a/src/radeon_bios.c
+++ b/src/radeon_bios.c
@@ -481,6 +481,16 @@ static void RADEONApplyLegacyQuirks(ScrnInfoPtr pScrn, int 
index)
        }
     }
 
+    /* X300 card with extra non-existent DVI port */
+    if (info->Chipset == PCI_CHIP_RV370_5B60 &&
+       PCI_SUB_VENDOR_ID(info->PciInfo) == 0x17af &&
+       PCI_SUB_DEVICE_ID(info->PciInfo) == 0x201e &&
+       index == 2) {
+       if (info->BiosConnector[index].ConnectorType == CONNECTOR_DVI_I) {
+           info->BiosConnector[index].valid = FALSE;
+       }
+    }
+
 }
 
 static Bool RADEONGetLegacyConnectorInfoFromBIOS (ScrnInfoPtr pScrn)

commit d12e519bed2e91e4c19a39e26020fda1f4548956
Author: Alex Deucher <[EMAIL PROTECTED]>
Date:   Mon Jul 21 13:47:09 2008 -0400

    Interlaced mode fixups for AVIVO chips
    (cherry picked from commit b0378bb145c8a915c943bef7d17f2cdecfccc891)

diff --git a/src/atombios_crtc.c b/src/atombios_crtc.c
index 02478b1..06efe5c 100644
--- a/src/atombios_crtc.c
+++ b/src/atombios_crtc.c
@@ -490,6 +490,12 @@ atombios_crtc_mode_set(xf86CrtcPtr crtc,
        /* unlock the mode regs */
        OUTREG(AVIVO_D1SCL_UPDATE + radeon_crtc->crtc_offset, 0);
 
+       if (adjusted_mode->Flags & V_INTERLACE)
+           OUTREG(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset,
+                  AVIVO_D1MODE_INTERLEAVE_EN);
+       else
+           OUTREG(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset,
+                  0);
     }
 
     atombios_crtc_set_pll(crtc, adjusted_mode, pll_flags);
diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c
index d480416..13c2b9c 100644
--- a/src/radeon_cursor.c
+++ b/src/radeon_cursor.c
@@ -209,11 +209,6 @@ radeon_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, 
int y)
     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 (IS_AVIVO_VARIANT) {
        /* avivo cursor spans the full fb width */
        if (crtc->rotatedData == NULL) {
@@ -226,6 +221,11 @@ radeon_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, 
int y)
        OUTREG(AVIVO_D1CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) 
| yorigin);
        avivo_lock_cursor(crtc, FALSE);
     } else {
+       if (mode->Flags & V_INTERLACE)
+           y /= 2;
+       else if (mode->Flags & V_DBLSCAN)
+           y *= 2;
+
        if (crtc_id == 0) {
            OUTREG(RADEON_CUR_HORZ_VERT_OFF,  (RADEON_CUR_LOCK
                                               | (xorigin << 16)
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index bb154de..e067cb7 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -4239,6 +4239,7 @@ avivo_save(ScrnInfoPtr pScrn, RADEONSavePtr save)
     state->grph1.desktop_height = INREG(AVIVO_D1MODE_DESKTOP_HEIGHT);
     state->grph1.viewport_start = INREG(AVIVO_D1MODE_VIEWPORT_START);
     state->grph1.viewport_size = INREG(AVIVO_D1MODE_VIEWPORT_SIZE);
+    state->grph1.mode_data_format = INREG(AVIVO_D1MODE_DATA_FORMAT);
 
     state->crtc2.pll_source = INREG(AVIVO_PCLK_CRTC2_CNTL);
 
@@ -4279,6 +4280,7 @@ avivo_save(ScrnInfoPtr pScrn, RADEONSavePtr save)
     state->grph2.desktop_height = INREG(AVIVO_D2MODE_DESKTOP_HEIGHT);
     state->grph2.viewport_start = INREG(AVIVO_D2MODE_VIEWPORT_START);
     state->grph2.viewport_size = INREG(AVIVO_D2MODE_VIEWPORT_SIZE);
+    state->grph2.mode_data_format = INREG(AVIVO_D2MODE_DATA_FORMAT);
 
     if (IS_DCE3_VARIANT) {
        /* save DVOA regs */
@@ -4536,12 +4538,14 @@ avivo_restore(ScrnInfoPtr pScrn, RADEONSavePtr restore)
     OUTREG(AVIVO_D1MODE_DESKTOP_HEIGHT, state->grph1.desktop_height);
     OUTREG(AVIVO_D1MODE_VIEWPORT_START, state->grph1.viewport_start);
     OUTREG(AVIVO_D1MODE_VIEWPORT_SIZE, state->grph1.viewport_size);
+    OUTREG(AVIVO_D1MODE_DATA_FORMAT, state->grph1.mode_data_format);
     OUTREG(AVIVO_D1SCL_UPDATE, 0);
 
     OUTREG(AVIVO_D2SCL_UPDATE, AVIVO_D1SCL_UPDATE_LOCK);
     OUTREG(AVIVO_D2MODE_DESKTOP_HEIGHT, state->grph2.desktop_height);
     OUTREG(AVIVO_D2MODE_VIEWPORT_START, state->grph2.viewport_start);
     OUTREG(AVIVO_D2MODE_VIEWPORT_SIZE, state->grph2.viewport_size);
+    OUTREG(AVIVO_D2MODE_DATA_FORMAT, state->grph2.mode_data_format);
     OUTREG(AVIVO_D2SCL_UPDATE, 0);
 
     /* Set the PLL */
diff --git a/src/radeon_output.c b/src/radeon_output.c
index ade0b00..b725e0a 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -580,6 +580,13 @@ radeon_mode_fixup(xf86OutputPtr output, DisplayModePtr 
mode,
        }
     }
 
+    if (IS_AVIVO_VARIANT) {
+       /* hw bug */
+       if ((mode->Flags & V_INTERLACE)
+           && (mode->CrtcVSyncStart < (mode->CrtcVDisplay + 2)))
+           adjusted_mode->CrtcVSyncStart = adjusted_mode->CrtcVDisplay + 2;
+    }
+
     return TRUE;
 }
 
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 2837671..35d622d 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -313,6 +313,7 @@ struct avivo_grph_state {
     uint32_t desktop_height;
     uint32_t viewport_start;
     uint32_t viewport_size;
+    uint32_t mode_data_format;
 };
 
 struct avivo_state
diff --git a/src/radeon_reg.h b/src/radeon_reg.h
index dd47dc4..3b3a8e5 100644
--- a/src/radeon_reg.h
+++ b/src/radeon_reg.h
@@ -3602,6 +3602,8 @@
 #define AVIVO_DC_LUTA_WHITE_OFFSET_GREEN        0x64d4
 #define AVIVO_DC_LUTA_WHITE_OFFSET_RED          0x64d8
 
+#define AVIVO_D1MODE_DATA_FORMAT                0x6528
+#       define AVIVO_D1MODE_INTERLEAVE_EN       (1 << 0)
 #define AVIVO_D1MODE_DESKTOP_HEIGHT             0x652c
 #define AVIVO_D1MODE_VIEWPORT_START             0x6580
 #define AVIVO_D1MODE_VIEWPORT_SIZE              0x6584
@@ -3654,6 +3656,7 @@
 #define AVIVO_D2CUR_SIZE                        0x6c10
 #define AVIVO_D2CUR_POSITION                    0x6c14
 
+#define AVIVO_D2MODE_DATA_FORMAT                0x6d28
 #define AVIVO_D2MODE_DESKTOP_HEIGHT             0x6d2c
 #define AVIVO_D2MODE_VIEWPORT_START             0x6d80
 #define AVIVO_D2MODE_VIEWPORT_SIZE              0x6d84

commit 1574d11f66b1f5479b8b2fe6919f7f5a0c3e6cf7
Author: Alex Deucher <[EMAIL PROTECTED]>
Date:   Mon Jul 21 10:36:48 2008 -0400

    Clear display priority bits before resetting them
    (cherry picked from commit c18fad622a3c4f9572051120d83af68b625b5686)

diff --git a/src/legacy_crtc.c b/src/legacy_crtc.c
index e5561e8..f7216f9 100644
--- a/src/legacy_crtc.c
+++ b/src/legacy_crtc.c
@@ -1369,6 +1369,8 @@ RADEONInitDispBandwidthLegacy(ScrnInfoPtr pScrn,
      */
     if ((info->DispPriority == 2) && IS_R300_VARIANT) {
        uint32_t mc_init_misc_lat_timer = INREG(R300_MC_INIT_MISC_LAT_TIMER);
+       mc_init_misc_lat_timer &= ~(R300_MC_DISP1R_INIT_LAT_MASK << 
R300_MC_DISP1R_INIT_LAT_SHIFT);
+       mc_init_misc_lat_timer &= ~(R300_MC_DISP0R_INIT_LAT_MASK << 
R300_MC_DISP0R_INIT_LAT_SHIFT);
        if (pRADEONEnt->pCrtc[1]->enabled)
            mc_init_misc_lat_timer |= (1 << R300_MC_DISP1R_INIT_LAT_SHIFT); /* 
display 1 */
        if (pRADEONEnt->pCrtc[0]->enabled)
@@ -1376,7 +1378,6 @@ RADEONInitDispBandwidthLegacy(ScrnInfoPtr pScrn,
        OUTREG(R300_MC_INIT_MISC_LAT_TIMER, mc_init_misc_lat_timer);
     }
 
-
     /* R420 and RV410 family not supported yet */
     if (info->ChipFamily == CHIP_FAMILY_R420 || info->ChipFamily == 
CHIP_FAMILY_RV410) return; 
 
diff --git a/src/radeon_reg.h b/src/radeon_reg.h
index 3967f95..dd47dc4 100644
--- a/src/radeon_reg.h
+++ b/src/radeon_reg.h
@@ -1033,7 +1033,9 @@
 #define RADEON_NB_TOM                       0x15c
 #define R300_MC_INIT_MISC_LAT_TIMER         0x180
 #       define R300_MC_DISP0R_INIT_LAT_SHIFT 8
+#       define R300_MC_DISP0R_INIT_LAT_MASK  0xf
 #       define R300_MC_DISP1R_INIT_LAT_SHIFT 12
+#       define R300_MC_DISP1R_INIT_LAT_MASK  0xf
 #define RADEON_MCLK_CNTL                    0x0012 /* PLL */
 #       define RADEON_FORCEON_MCLKA         (1 << 16)
 #       define RADEON_FORCEON_MCLKB         (1 << 17)

commit 1e99aaf7033e76c157572da23c31030aba0d5ce3
Author: Alex Deucher <[EMAIL PROTECTED]>
Date:   Mon Jul 21 10:30:41 2008 -0400

    Clean up legacy display watermark setup
    
    - makes crtc1 and crtc2 watermark setup independant.
    - fixes the case where only crtc2 is active
    (cherry picked from commit dc231ff8e063313d2bcf5acccad67a9f8a7e3314)

diff --git a/src/legacy_crtc.c b/src/legacy_crtc.c
index 3df61a7..e5561e8 100644
--- a/src/legacy_crtc.c
+++ b/src/legacy_crtc.c
@@ -1327,9 +1327,12 @@ radeon_update_tv_routing(ScrnInfoPtr pScrn, 
RADEONSavePtr restore)
 }
 
 /* Calculate display buffer watermark to prevent buffer underflow */
-static void
-RADEONInitDispBandwidth2(ScrnInfoPtr pScrn, RADEONInfoPtr info, int 
pixel_bytes2, DisplayModePtr mode1, DisplayModePtr mode2)
+void
+RADEONInitDispBandwidthLegacy(ScrnInfoPtr pScrn,
+                             DisplayModePtr mode1, int pixel_bytes1,
+                             DisplayModePtr mode2, int pixel_bytes2)
 {
+    RADEONInfoPtr info = RADEONPTR(pScrn);
     RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
     unsigned char *RADEONMMIO = info->MMIO;
 
@@ -1352,10 +1355,10 @@ RADEONInitDispBandwidth2(ScrnInfoPtr pScrn, 
RADEONInfoPtr info, int pixel_bytes2
     float min_mem_eff = 0.8;
     float sclk_eff, sclk_delay;
     float mc_latency_mclk, mc_latency_sclk, cur_latency_mclk, cur_latency_sclk;
-    float disp_latency, disp_latency_overhead, disp_drain_rate, 
disp_drain_rate2;
+    float disp_latency, disp_latency_overhead, disp_drain_rate = 0, 
disp_drain_rate2;
     float pix_clk, pix_clk2; /* in MHz */
     int cur_size = 16;       /* in octawords */
-    int critical_point, critical_point2;
+    int critical_point = 0, critical_point2;
     int stop_req, max_stop_req;
     float read_return_rate, time_disp1_drop_priority;
 
@@ -1366,11 +1369,10 @@ RADEONInitDispBandwidth2(ScrnInfoPtr pScrn, 
RADEONInfoPtr info, int pixel_bytes2
      */
     if ((info->DispPriority == 2) && IS_R300_VARIANT) {
        uint32_t mc_init_misc_lat_timer = INREG(R300_MC_INIT_MISC_LAT_TIMER);
-       if (pRADEONEnt->pCrtc[1]->enabled) {
-           mc_init_misc_lat_timer |= 0x1100; /* display 0 and 1 */
-       } else {
-           mc_init_misc_lat_timer |= 0x0100; /* display 0 only */
-       }
+       if (pRADEONEnt->pCrtc[1]->enabled)
+           mc_init_misc_lat_timer |= (1 << R300_MC_DISP1R_INIT_LAT_SHIFT); /* 
display 1 */
+       if (pRADEONEnt->pCrtc[0]->enabled)
+           mc_init_misc_lat_timer |= (1 << R300_MC_DISP0R_INIT_LAT_SHIFT); /* 
display 0 */
        OUTREG(R300_MC_INIT_MISC_LAT_TIMER, mc_init_misc_lat_timer);
     }
 
@@ -1383,15 +1385,17 @@ RADEONInitDispBandwidth2(ScrnInfoPtr pScrn, 
RADEONInfoPtr info, int pixel_bytes2
      */
     mem_bw = info->mclk * (info->RamWidth / 8) * (info->IsDDR ? 2 : 1);
 
-    pix_clk = mode1->Clock/1000.0;
-    if (mode2)
+    pix_clk = 0;
+    pix_clk2 = 0;
+    peak_disp_bw = 0;
+    if (mode1) {
+       pix_clk = mode1->Clock/1000.0;
+       peak_disp_bw += (pix_clk * pixel_bytes1);
+    }
+    if (mode2) {
        pix_clk2 = mode2->Clock/1000.0;
-    else
-       pix_clk2 = 0;
-
-    peak_disp_bw = (pix_clk * info->CurrentLayout.pixel_bytes);
-    if (pixel_bytes2)
-      peak_disp_bw += (pix_clk2 * pixel_bytes2);
+       peak_disp_bw += (pix_clk2 * pixel_bytes2);
+    }
 
     if (peak_disp_bw >= mem_bw * min_mem_eff) {
        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
@@ -1399,20 +1403,6 @@ RADEONInitDispBandwidth2(ScrnInfoPtr pScrn, 
RADEONInfoPtr info, int pixel_bytes2
                   "If you have flickering problem, try to lower resolution, 
refresh rate, or color depth\n");
     }
 
-    /*  CRTC1
-        Set GRPH_BUFFER_CNTL register using h/w defined optimal values.
-       GRPH_STOP_REQ <= MIN[ 0x7C, (CRTC_H_DISP + 1) * (bit depth) / 0x10 ]
-    */
-    stop_req = mode1->HDisplay * info->CurrentLayout.pixel_bytes / 16;
-
-    /* setup Max GRPH_STOP_REQ default value */
-    if (IS_RV100_VARIANT)
-       max_stop_req = 0x5c;
-    else
-       max_stop_req  = 0x7c;
-    if (stop_req > max_stop_req)
-       stop_req = max_stop_req;
-
     /*  Get values from the EXT_MEM_CNTL register...converting its contents. */
     temp = INREG(RADEON_MEM_TIMING_CNTL);
     if ((info->ChipFamily == CHIP_FAMILY_RV100) || info->IsIGP) { /* RV100, 
M6, IGPs */
@@ -1435,9 +1425,8 @@ RADEONInitDispBandwidth2(ScrnInfoPtr pScrn, RADEONInfoPtr 
info, int pixel_bytes2
     }
 
     if (IS_R300_VARIANT) {
-
        /* on the R300, Tcas is included in Trbs.
-       */
+        */
        temp = INREG(RADEON_MEM_CNTL);
        data = (R300_MEM_NUM_CHANNELS_MASK & temp);
        if (data == 1) {
@@ -1473,7 +1462,8 @@ RADEONInitDispBandwidth2(ScrnInfoPtr pScrn, RADEONInfoPtr 
info, int pixel_bytes2
            sclk_eff = info->sclk;
     }
 
-    /* Find the memory controller latency for the display client.
+    /*
+      Find the memory controller latency for the display client.
     */
     if (IS_R300_VARIANT) {
        /*not enough for R350 ???*/
@@ -1527,89 +1517,107 @@ RADEONInitDispBandwidth2(ScrnInfoPtr pScrn, 
RADEONInfoPtr info, int pixel_bytes2
     mc_latency_sclk = mc_latency_sclk + disp_latency_overhead + 
cur_latency_sclk;
     disp_latency = MAX(mc_latency_mclk, mc_latency_sclk);
 
-    /*
-      Find the drain rate of the display buffer.
-    */
-    disp_drain_rate = pix_clk / (16.0/info->CurrentLayout.pixel_bytes);
-    if (pixel_bytes2)
-       disp_drain_rate2 = pix_clk2 / (16.0/pixel_bytes2);
+    /* setup Max GRPH_STOP_REQ default value */
+    if (IS_RV100_VARIANT)
+       max_stop_req = 0x5c;
     else
-       disp_drain_rate2 = 0;
+       max_stop_req  = 0x7c;
 
-    /*
-      Find the critical point of the display buffer.
-    */
-    critical_point= (uint32_t)(disp_drain_rate * disp_latency + 0.5);
+    if (mode1) {
+       /*  CRTC1
+           Set GRPH_BUFFER_CNTL register using h/w defined optimal values.
+           GRPH_STOP_REQ <= MIN[ 0x7C, (CRTC_H_DISP + 1) * (bit depth) / 0x10 ]
+       */
+       stop_req = mode1->HDisplay * pixel_bytes1 / 16;
 
-    /* ???? */
-    /*
-    temp = (info->SavedReg.grph_buffer_cntl & RADEON_GRPH_CRITICAL_POINT_MASK) 
>> RADEON_GRPH_CRITICAL_POINT_SHIFT;
-    if (critical_point < temp) critical_point = temp;
-    */
-    if (info->DispPriority == 2) {
-       critical_point = 0;
-    }
+       if (stop_req > max_stop_req)
+           stop_req = max_stop_req;
 
-    /*
-      The critical point should never be above max_stop_req-4.  Setting
-      GRPH_CRITICAL_CNTL = 0 will thus force high priority all the time.
-    */
-    if (max_stop_req - critical_point < 4) critical_point = 0;
+       /*
+         Find the drain rate of the display buffer.
+       */
+       disp_drain_rate = pix_clk / (16.0/pixel_bytes1);
 
-    if (critical_point == 0 && mode2 && info->ChipFamily == CHIP_FAMILY_R300) {
-       /* some R300 cards have problem with this set to 0, when CRTC2 is 
enabled.*/
-       critical_point = 0x10;
-    }
+       /*
+         Find the critical point of the display buffer.
+       */
+       critical_point= (uint32_t)(disp_drain_rate * disp_latency + 0.5);
 
-    temp = info->SavedReg->grph_buffer_cntl;
-    temp &= ~(RADEON_GRPH_STOP_REQ_MASK);
-    temp |= (stop_req << RADEON_GRPH_STOP_REQ_SHIFT);
-    temp &= ~(RADEON_GRPH_START_REQ_MASK);
-    if ((info->ChipFamily == CHIP_FAMILY_R350) &&
-       (stop_req > 0x15)) {
-       stop_req -= 0x10;
-    }
-    temp |= (stop_req << RADEON_GRPH_START_REQ_SHIFT);
+       /* ???? */
+       /*
+         temp = (info->SavedReg.grph_buffer_cntl & 
RADEON_GRPH_CRITICAL_POINT_MASK) >> RADEON_GRPH_CRITICAL_POINT_SHIFT;
+         if (critical_point < temp) critical_point = temp;
+       */
+       if (info->DispPriority == 2) {
+           critical_point = 0;
+       }
 
-    temp |= RADEON_GRPH_BUFFER_SIZE;
-    temp &= ~(RADEON_GRPH_CRITICAL_CNTL   |
-             RADEON_GRPH_CRITICAL_AT_SOF |
-             RADEON_GRPH_STOP_CNTL);
-    /*
-      Write the result into the register.
-    */
-    OUTREG(RADEON_GRPH_BUFFER_CNTL, ((temp & ~RADEON_GRPH_CRITICAL_POINT_MASK) 
|
-                                    (critical_point << 
RADEON_GRPH_CRITICAL_POINT_SHIFT)));
+       /*
+         The critical point should never be above max_stop_req-4.  Setting
+         GRPH_CRITICAL_CNTL = 0 will thus force high priority all the time.
+       */
+       if (max_stop_req - critical_point < 4) critical_point = 0;
+
+       if (critical_point == 0 && mode2 && info->ChipFamily == 
CHIP_FAMILY_R300) {
+           /* some R300 cards have problem with this set to 0, when CRTC2 is 
enabled.*/
+           critical_point = 0x10;
+       }
+
+       temp = info->SavedReg->grph_buffer_cntl;
+       temp &= ~(RADEON_GRPH_STOP_REQ_MASK);
+       temp |= (stop_req << RADEON_GRPH_STOP_REQ_SHIFT);
+       temp &= ~(RADEON_GRPH_START_REQ_MASK);
+       if ((info->ChipFamily == CHIP_FAMILY_R350) &&
+           (stop_req > 0x15)) {
+           stop_req -= 0x10;
+       }
+       temp |= (stop_req << RADEON_GRPH_START_REQ_SHIFT);
+
+       temp |= RADEON_GRPH_BUFFER_SIZE;
+       temp &= ~(RADEON_GRPH_CRITICAL_CNTL   |
+                 RADEON_GRPH_CRITICAL_AT_SOF |
+                 RADEON_GRPH_STOP_CNTL);
+       /*
+         Write the result into the register.
+       */
+       OUTREG(RADEON_GRPH_BUFFER_CNTL, ((temp & 
~RADEON_GRPH_CRITICAL_POINT_MASK) |
+                                        (critical_point << 
RADEON_GRPH_CRITICAL_POINT_SHIFT)));
 
 #if 0
-    if ((info->ChipFamily == CHIP_FAMILY_RS400) ||
-       (info->ChipFamily == CHIP_FAMILY_RS480)) {
-       /* attempt to program RS400 disp regs correctly ??? */
-       temp = info->SavedReg->disp1_req_cntl1;
-       temp &= ~(RS400_DISP1_START_REQ_LEVEL_MASK |
-                 RS400_DISP1_STOP_REQ_LEVEL_MASK);
-       OUTREG(RS400_DISP1_REQ_CNTL1, (temp |
-                                      (critical_point << 
RS400_DISP1_START_REQ_LEVEL_SHIFT) |
-                                      (critical_point << 
RS400_DISP1_STOP_REQ_LEVEL_SHIFT)));
-       temp = info->SavedReg->dmif_mem_cntl1;
-       temp &= ~(RS400_DISP1_CRITICAL_POINT_START_MASK |
-                 RS400_DISP1_CRITICAL_POINT_STOP_MASK);
-       OUTREG(RS400_DMIF_MEM_CNTL1, (temp |
-                                     (critical_point << 
RS400_DISP1_CRITICAL_POINT_START_SHIFT) |
-                                     (critical_point << 
RS400_DISP1_CRITICAL_POINT_STOP_SHIFT)));
-    }
+       if ((info->ChipFamily == CHIP_FAMILY_RS400) ||
+           (info->ChipFamily == CHIP_FAMILY_RS480)) {
+           /* attempt to program RS400 disp regs correctly ??? */
+           temp = info->SavedReg->disp1_req_cntl1;
+           temp &= ~(RS400_DISP1_START_REQ_LEVEL_MASK |
+                     RS400_DISP1_STOP_REQ_LEVEL_MASK);
+           OUTREG(RS400_DISP1_REQ_CNTL1, (temp |
+                                          (critical_point << 
RS400_DISP1_START_REQ_LEVEL_SHIFT) |
+                                          (critical_point << 
RS400_DISP1_STOP_REQ_LEVEL_SHIFT)));
+           temp = info->SavedReg->dmif_mem_cntl1;
+           temp &= ~(RS400_DISP1_CRITICAL_POINT_START_MASK |
+                     RS400_DISP1_CRITICAL_POINT_STOP_MASK);
+           OUTREG(RS400_DMIF_MEM_CNTL1, (temp |
+                                         (critical_point << 
RS400_DISP1_CRITICAL_POINT_START_SHIFT) |
+                                         (critical_point << 
RS400_DISP1_CRITICAL_POINT_STOP_SHIFT)));
+       }
 #endif
 
-    xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
-                  "GRPH_BUFFER_CNTL from %x to %x\n",
-                  (unsigned int)info->SavedReg->grph_buffer_cntl,
-                  (unsigned int)INREG(RADEON_GRPH_BUFFER_CNTL));
+       xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
+                      "GRPH_BUFFER_CNTL from %x to %x\n",
+                      (unsigned int)info->SavedReg->grph_buffer_cntl,
+                      (unsigned int)INREG(RADEON_GRPH_BUFFER_CNTL));
+    }
 
     if (mode2) {
        stop_req = mode2->HDisplay * pixel_bytes2 / 16;
 
        if (stop_req > max_stop_req) stop_req = max_stop_req;
 
+       /*
+         Find the drain rate of the display buffer.
+       */
+       disp_drain_rate2 = pix_clk2 / (16.0/pixel_bytes2);
+
        temp = info->SavedReg->grph2_buffer_cntl;
        temp &= ~(RADEON_GRPH_STOP_REQ_MASK);
        temp |= (stop_req << RADEON_GRPH_STOP_REQ_SHIFT);
@@ -1629,7 +1637,10 @@ RADEONInitDispBandwidth2(ScrnInfoPtr pScrn, 
RADEONInfoPtr info, int pixel_bytes2
            critical_point2 = 0;
        else {
            read_return_rate = MIN(info->sclk, 
info->mclk*(info->RamWidth*(info->IsDDR+1)/128));
-           time_disp1_drop_priority = critical_point / (read_return_rate - 
disp_drain_rate);
+           if (mode1)
+               time_disp1_drop_priority = critical_point / (read_return_rate - 
disp_drain_rate);
+           else
+               time_disp1_drop_priority = 0;
 
            critical_point2 = (uint32_t)((disp_latency + 
time_disp1_drop_priority + 
                                        disp_latency) * disp_drain_rate2 + 0.5);
@@ -1681,45 +1692,6 @@ RADEONInitDispBandwidth2(ScrnInfoPtr pScrn, 
RADEONInfoPtr info, int pixel_bytes2
 }
 
 void
-RADEONInitDispBandwidth(ScrnInfoPtr pScrn)
-{
-    RADEONInfoPtr info = RADEONPTR(pScrn);
-    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-    DisplayModePtr mode1, mode2;
-    int pixel_bytes2 = 0;
-
-    if (info->IsPrimary || info->IsSecondary)
-       mode1 = &xf86_config->crtc[0]->mode;
-    else
-       mode1 = info->CurrentLayout.mode;
-    mode2 = NULL;
-    pixel_bytes2 = info->CurrentLayout.pixel_bytes;
-
-    if (xf86_config->num_crtc == 2) {
-      pixel_bytes2 = 0;
-      mode2 = NULL;
-
-      if (xf86_config->crtc[1]->enabled && xf86_config->crtc[0]->enabled) {
-       pixel_bytes2 = info->CurrentLayout.pixel_bytes;
-       mode1 = &xf86_config->crtc[0]->mode;
-       mode2 = &xf86_config->crtc[1]->mode;
-      } else if (xf86_config->crtc[0]->enabled) {
-       mode1 = &xf86_config->crtc[0]->mode;
-      } else if (xf86_config->crtc[1]->enabled) {
-       mode1 = &xf86_config->crtc[1]->mode;
-      } else
-       return;
-    } else {
-       if (xf86_config->crtc[0]->enabled)
-           mode1 = &xf86_config->crtc[0]->mode;
-       else
-           return;
-    }
-
-    RADEONInitDispBandwidth2(pScrn, info, pixel_bytes2, mode1, mode2);
-}
-
-void
 legacy_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
                     DisplayModePtr adjusted_mode, int x, int y)
 {
diff --git a/src/radeon.h b/src/radeon.h
index 0b8df3d..f68fa0f 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -817,7 +817,6 @@ do {                                                        
                \
 extern void legacy_crtc_dpms(xf86CrtcPtr crtc, int mode);
 extern void legacy_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
                                 DisplayModePtr adjusted_mode, int x, int y);
-extern void RADEONInitDispBandwidth(ScrnInfoPtr pScrn);
 extern void RADEONRestoreCommonRegisters(ScrnInfoPtr pScrn,
                                         RADEONSavePtr restore);
 extern void RADEONRestoreCrtcRegisters(ScrnInfoPtr pScrn,
@@ -924,6 +923,7 @@ extern DisplayModePtr RADEONCrtcFindClosestMode(xf86CrtcPtr 
crtc,
                                                DisplayModePtr pMode);
 extern void RADEONUnblank(ScrnInfoPtr pScrn);
 extern Bool RADEONSetTiling(ScrnInfoPtr pScrn);
+extern void RADEONInitDispBandwidth(ScrnInfoPtr pScrn);
 
 /* radeon_cursor.c */
 extern Bool RADEONCursorInit(ScreenPtr pScreen);
diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c
index c63b650..9e5f672 100644
--- a/src/radeon_crtc.c
+++ b/src/radeon_crtc.c
@@ -58,6 +58,10 @@ extern void atombios_crtc_mode_set(xf86CrtcPtr crtc,
                                   DisplayModePtr adjusted_mode,
                                   int x, int y);
 extern void atombios_crtc_dpms(xf86CrtcPtr crtc, int mode);
+extern void
+RADEONInitDispBandwidthLegacy(ScrnInfoPtr pScrn,
+                             DisplayModePtr mode1, int pixel_bytes1,
+                             DisplayModePtr mode2, int pixel_bytes2);
 
 void
 radeon_crtc_dpms(xf86CrtcPtr crtc, int mode)
@@ -567,6 +571,40 @@ static const xf86CrtcFuncsRec radeon_crtc_funcs = {
     .destroy = NULL, /* XXX */
 };
 
+void
+RADEONInitDispBandwidth(ScrnInfoPtr pScrn)
+{
+    RADEONInfoPtr info = RADEONPTR(pScrn);
+    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    DisplayModePtr mode1 = NULL, mode2 = NULL;
+    int pixel_bytes1 = info->CurrentLayout.pixel_bytes;
+    int pixel_bytes2 = info->CurrentLayout.pixel_bytes;
+
+    if (xf86_config->num_crtc == 2) {
+       if (xf86_config->crtc[1]->enabled &&
+           xf86_config->crtc[0]->enabled) {
+           mode1 = &xf86_config->crtc[0]->mode;
+           mode2 = &xf86_config->crtc[1]->mode;
+       } else if (xf86_config->crtc[0]->enabled) {
+           mode1 = &xf86_config->crtc[0]->mode;
+       } else if (xf86_config->crtc[1]->enabled) {
+           mode2 = &xf86_config->crtc[1]->mode;
+       } else
+           return;
+    } else {
+       if (info->IsPrimary)
+           mode1 = &xf86_config->crtc[0]->mode;
+       else if (info->IsSecondary)
+           mode2 = &xf86_config->crtc[0]->mode;
+       else if (xf86_config->crtc[0]->enabled)
+           mode1 = &xf86_config->crtc[0]->mode;
+       else
+           return;
+    }
+
+    RADEONInitDispBandwidthLegacy(pScrn, mode1, pixel_bytes1, mode2, 
pixel_bytes2);
+}


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to