configure.ac | 111 man/Makefile.am | 22 man/ati.man | 2 man/radeon.man | 187 + src/AtomBios/CD_Operations.c | 9 src/AtomBios/includes/atombios.h | 92 src/Makefile.am | 32 src/ati.c | 2 src/ati_pciids_gen.h | 44 src/atombios_crtc.c | 452 ++-- src/atombios_output.c | 781 +++--- src/drmmode_display.c | 315 ++ src/drmmode_display.h | 16 src/evergreen_accel.c | 1201 ++++++++++ src/evergreen_exa.c | 1965 +++++++++++++++++ src/evergreen_reg.h | 247 ++ src/evergreen_reg_auto.h | 4039 ++++++++++++++++++++++++++++++++++++ src/evergreen_shader.c | 3124 +++++++++++++++++++++++++++ src/evergreen_shader.h | 292 ++ src/evergreen_state.h | 341 +++ src/evergreen_textured_videofuncs.c | 556 ++++ src/legacy_output.c | 5 src/local_xf86Rename.h | 23 src/pcidb/ati_pciids.csv | 50 src/r600_exa.c | 665 ++--- src/r600_shader.c | 1554 ++++++++----- src/r600_shader.h | 5 src/r600_state.h | 58 src/r600_textured_videofuncs.c | 126 - src/r6xx_accel.c | 273 -- src/radeon.h | 71 src/radeon_accel.c | 9 src/radeon_atombios.c | 25 src/radeon_atombios.h | 2 src/radeon_bios.c | 1 src/radeon_chipinfo_gen.h | 44 src/radeon_chipset_gen.h | 50 src/radeon_commonfuncs.c | 2 src/radeon_crtc.c | 4 src/radeon_cursor.c | 38 src/radeon_dri2.c | 597 ++++- src/radeon_dri2.h | 2 src/radeon_driver.c | 903 +++++--- src/radeon_exa.c | 112 src/radeon_exa_funcs.c | 146 - src/radeon_exa_render.c | 17 src/radeon_exa_shared.c | 242 ++ src/radeon_exa_shared.h | 79 src/radeon_kms.c | 198 + src/radeon_legacy_memory.c | 3 src/radeon_output.c | 32 src/radeon_pci_chipset_gen.h | 44 src/radeon_pci_device_match_gen.h | 44 src/radeon_probe.c | 1 src/radeon_probe.h | 50 src/radeon_reg.h | 6 src/radeon_textured_video.c | 36 src/radeon_textured_videofuncs.c | 2 src/radeon_vbo.c | 67 src/radeon_vbo.h | 57 src/radeon_video.c | 58 src/radeon_video.h | 1 src/theatre200.c | 8 src/theatre_detect.c | 4 64 files changed, 16818 insertions(+), 2726 deletions(-)
New commits: commit 0a1a0513a61f392580bde39cca4880f2c19abc8d Author: Alex Deucher <alexdeuc...@gmail.com> Date: Thu Feb 3 18:09:17 2011 -0500 bump version for release Signed-off-by: Alex Deucher <alexdeuc...@gmail.com> diff --git a/configure.ac b/configure.ac index 5dbf65a..db135a1 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-video-ati], - [6.13.99], + [6.14.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-video-ati]) commit ef9bfb262db7004bef3704e5d914687e50d3fca4 Author: Alex Deucher <alexdeuc...@gmail.com> Date: Tue Feb 1 19:24:44 2011 -0500 kms/pre-6xx: fix pageflipping with tiling Use UTS/DFS to tile/untile as appropriate for sw access on pre-6xx. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=33738 Signed-off-by: Alex Deucher <alexdeuc...@gmail.com> diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 2ab4510..d5ad211 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -1232,8 +1232,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height) } #endif if (tiling_flags) - radeon_bo_set_tiling(info->front_bo, - tiling_flags | RADEON_TILING_SURFACE, pitch); + radeon_bo_set_tiling(info->front_bo, tiling_flags, pitch); ret = drmModeAddFB(drmmode->fd, width, height, scrn->depth, scrn->bitsPerPixel, pitch, diff --git a/src/radeon_exa.c b/src/radeon_exa.c index 9df7251..3dbdcae 100644 --- a/src/radeon_exa.c +++ b/src/radeon_exa.c @@ -307,6 +307,7 @@ Bool RADEONPrepareAccess_CS(PixmapPtr pPix, int index) #endif Bool flush = FALSE; int ret; + uint32_t tiling_flags = 0, pitch = 0; #if X_BYTE_ORDER == X_BIG_ENDIAN /* May need to handle byte swapping in DownloadFrom/UploadToScreen */ @@ -318,16 +319,13 @@ Bool RADEONPrepareAccess_CS(PixmapPtr pPix, int index) if (!driver_priv) return FALSE; - if (info->ChipFamily >= CHIP_FAMILY_R600) { - uint32_t tiling_flags = 0, pitch = 0; - - ret = radeon_bo_get_tiling(driver_priv->bo, &tiling_flags, &pitch); - if (ret) - return FALSE; - /* untile in DFS/UTS */ - if (tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO)) - return FALSE; - } + /* check if we are tiled */ + ret = radeon_bo_get_tiling(driver_priv->bo, &tiling_flags, &pitch); + if (ret) + return FALSE; + /* untile in DFS/UTS */ + if (tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO)) + return FALSE; /* if we have more refs than just the BO then flush */ if (radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) { diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c index e80a996..e8c5571 100644 --- a/src/radeon_exa_funcs.c +++ b/src/radeon_exa_funcs.c @@ -474,6 +474,7 @@ RADEONUploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h, Bool flush = TRUE; Bool r; int i; + uint32_t tiling_flags = 0, pitch = 0; if (bpp < 8) return FALSE; @@ -482,6 +483,10 @@ RADEONUploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h, if (!driver_priv || !driver_priv->bo) return FALSE; + ret = radeon_bo_get_tiling(driver_priv->bo, &tiling_flags, &pitch); + if (ret) + ErrorF("radeon_bo_get_tiling failed\n"); + #if X_BYTE_ORDER == X_BIG_ENDIAN switch (bpp) { case 32: @@ -496,10 +501,12 @@ RADEONUploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h, /* If we know the BO won't be busy, don't bother with a scratch */ copy_dst = driver_priv->bo; copy_pitch = pDst->devKind; - if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) { - flush = FALSE; - if (!radeon_bo_is_busy(driver_priv->bo, &dst_domain)) - goto copy; + if (!(tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO))) { + if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) { + flush = FALSE; + if (!radeon_bo_is_busy(driver_priv->bo, &dst_domain)) + goto copy; + } } size = scratch_pitch * h; @@ -573,6 +580,7 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w, int ret; Bool flush = FALSE; Bool r; + uint32_t tiling_flags = 0, pitch = 0; if (bpp < 8) return FALSE; @@ -581,6 +589,10 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w, if (!driver_priv || !driver_priv->bo) return FALSE; + ret = radeon_bo_get_tiling(driver_priv->bo, &tiling_flags, &pitch); + if (ret) + ErrorF("radeon_bo_get_tiling failed\n"); + #if X_BYTE_ORDER == X_BIG_ENDIAN switch (bpp) { case 32: @@ -595,22 +607,22 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w, /* If we know the BO won't end up in VRAM anyway, don't bother with a scratch */ copy_src = driver_priv->bo; copy_pitch = pSrc->devKind; - if (radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) { - src_domain = radeon_bo_get_src_domain(driver_priv->bo); - if ((src_domain & (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM)) == - (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM)) - src_domain = 0; - else /* A write may be scheduled */ - flush = TRUE; - } + if (!(tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO))) { + if (radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) { + src_domain = radeon_bo_get_src_domain(driver_priv->bo); + if ((src_domain & (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM)) == + (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM)) + src_domain = 0; + else /* A write may be scheduled */ + flush = TRUE; + } - if (!src_domain) - radeon_bo_is_busy(driver_priv->bo, &src_domain); + if (!src_domain) + radeon_bo_is_busy(driver_priv->bo, &src_domain); - if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM) { - goto copy; + if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM) + goto copy; } - size = scratch_pitch * h; scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0); if (scratch == NULL) { commit bb16dd77321e5a64a3cb2d2ca9982117799ac1a8 Author: Alex Deucher <alexdeuc...@gmail.com> Date: Tue Feb 1 19:20:00 2011 -0500 kms/r6xx+: fix tiling and pageflipping harder Thanks for Michel for final fix. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=33738 for r6xx+ asics. A similar approach for pre-r6xx asics is pending. Signed-off-by: Alex Deucher <alexdeuc...@gmail.com> diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c index 93fa267..2eb698d 100644 --- a/src/evergreen_exa.c +++ b/src/evergreen_exa.c @@ -1534,19 +1534,28 @@ EVERGREENUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, Bool r; int i; struct r600_accel_object src_obj, dst_obj; + uint32_t tiling_flags = 0, pitch = 0; if (bpp < 8) return FALSE; driver_priv = exaGetPixmapDriverPrivate(pDst); + if (!driver_priv || !driver_priv->bo) + return FALSE; + + ret = radeon_bo_get_tiling(driver_priv->bo, &tiling_flags, &pitch); + if (ret) + ErrorF("radeon_bo_get_tiling failed\n"); /* If we know the BO won't be busy, don't bother with a scratch */ copy_dst = driver_priv->bo; copy_pitch = pDst->devKind; - if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) { - flush = FALSE; - if (!radeon_bo_is_busy(driver_priv->bo, &dst_domain)) - goto copy; + if (!(tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO))) { + if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) { + flush = FALSE; + if (!radeon_bo_is_busy(driver_priv->bo, &dst_domain)) + goto copy; + } } size = scratch_pitch * h; @@ -1646,6 +1655,8 @@ EVERGREENDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, return FALSE; driver_priv = exaGetPixmapDriverPrivate(pSrc); + if (!driver_priv || !driver_priv->bo) + return FALSE; ret = radeon_bo_get_tiling(driver_priv->bo, &tiling_flags, &pitch); if (ret) @@ -1663,13 +1674,14 @@ EVERGREENDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, else /* A write may be scheduled */ flush = TRUE; } - } - if (!src_domain) - radeon_bo_is_busy(driver_priv->bo, &src_domain); + if (!src_domain) + radeon_bo_is_busy(driver_priv->bo, &src_domain); - if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM) - goto copy; + if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM) + goto copy; + + } if (info->ChipFamily == CHIP_FAMILY_PALM) goto copy; diff --git a/src/r600_exa.c b/src/r600_exa.c index f652ab6..5fc41ad 100644 --- a/src/r600_exa.c +++ b/src/r600_exa.c @@ -1785,19 +1785,28 @@ R600UploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h, Bool r; int i; struct r600_accel_object src_obj, dst_obj; + uint32_t tiling_flags = 0, pitch = 0; if (bpp < 8) return FALSE; driver_priv = exaGetPixmapDriverPrivate(pDst); + if (!driver_priv || !driver_priv->bo) + return FALSE; + + ret = radeon_bo_get_tiling(driver_priv->bo, &tiling_flags, &pitch); + if (ret) + ErrorF("radeon_bo_get_tiling failed\n"); /* If we know the BO won't be busy, don't bother with a scratch */ copy_dst = driver_priv->bo; copy_pitch = pDst->devKind; - if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) { - flush = FALSE; - if (!radeon_bo_is_busy(driver_priv->bo, &dst_domain)) - goto copy; + if (!(tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO))) { + if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) { + flush = FALSE; + if (!radeon_bo_is_busy(driver_priv->bo, &dst_domain)) + goto copy; + } } size = scratch_pitch * h; @@ -1897,6 +1906,8 @@ R600DownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w, return FALSE; driver_priv = exaGetPixmapDriverPrivate(pSrc); + if (!driver_priv || !driver_priv->bo) + return FALSE; ret = radeon_bo_get_tiling(driver_priv->bo, &tiling_flags, &pitch); if (ret) @@ -1914,13 +1925,13 @@ R600DownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w, else /* A write may be scheduled */ flush = TRUE; } - } - if (!src_domain) - radeon_bo_is_busy(driver_priv->bo, &src_domain); + if (!src_domain) + radeon_bo_is_busy(driver_priv->bo, &src_domain); - if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM) - goto copy; + if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM) + goto copy; + } size = scratch_pitch * h; scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0); commit 9c124f781049ef11a8b19894a29b7f62975b3011 Author: Alex Deucher <alexdeuc...@gmail.com> Date: Tue Feb 1 18:59:40 2011 -0500 radeon: remove device 0x4243 0x4243 is a PCI bridge, not a gpu. See: https://bugs.freedesktop.org/show_bug.cgi?id=33815 Signed-off-by: Alex Deucher <alexdeuc...@gmail.com> diff --git a/src/ati_pciids_gen.h b/src/ati_pciids_gen.h index 5e5ced6..f7b7569 100644 --- a/src/ati_pciids_gen.h +++ b/src/ati_pciids_gen.h @@ -25,7 +25,6 @@ #define PCI_CHIP_MACH32 0x4158 #define PCI_CHIP_RS250_4237 0x4237 #define PCI_CHIP_R200_BB 0x4242 -#define PCI_CHIP_R200_BC 0x4243 #define PCI_CHIP_RS100_4336 0x4336 #define PCI_CHIP_RS200_4337 0x4337 #define PCI_CHIP_MACH64CT 0x4354 diff --git a/src/pcidb/ati_pciids.csv b/src/pcidb/ati_pciids.csv index 1f4756a..e8bfb4c 100644 --- a/src/pcidb/ati_pciids.csv +++ b/src/pcidb/ati_pciids.csv @@ -26,7 +26,6 @@ "0x4158","MACH32","MACH32",,,,,, "0x4237","RS250_4237","RS200",,1,,,1,"ATI Radeon 7000 IGP (A4+) 4237" "0x4242","R200_BB","R200",,,,1,,"ATI Radeon 8500 AIW BB (AGP)" -"0x4243","R200_BC","R200",,,,1,,"ATI Radeon 8500 AIW BC (AGP)" "0x4336","RS100_4336","RS100",1,1,,,1,"ATI Radeon IGP320M (U1) 4336" "0x4337","RS200_4337","RS200",1,1,,,1,"ATI Radeon IGP330M/340M/350M (U2) 4337" "0x4354","MACH64CT","MACH64",,,,,, diff --git a/src/radeon_chipinfo_gen.h b/src/radeon_chipinfo_gen.h index 352fa99..a90fae7 100644 --- a/src/radeon_chipinfo_gen.h +++ b/src/radeon_chipinfo_gen.h @@ -26,7 +26,6 @@ static RADEONCardInfo RADEONCards[] = { { 0x4156, CHIP_FAMILY_RV350, 0, 0, 0, 0, 0 }, { 0x4237, CHIP_FAMILY_RS200, 0, 1, 0, 0, 1 }, { 0x4242, CHIP_FAMILY_R200, 0, 0, 0, 1, 0 }, - { 0x4243, CHIP_FAMILY_R200, 0, 0, 0, 1, 0 }, { 0x4336, CHIP_FAMILY_RS100, 1, 1, 0, 0, 1 }, { 0x4337, CHIP_FAMILY_RS200, 1, 1, 0, 0, 1 }, { 0x4437, CHIP_FAMILY_RS200, 1, 1, 0, 0, 1 }, diff --git a/src/radeon_chipset_gen.h b/src/radeon_chipset_gen.h index 09a957e..2af046c 100644 --- a/src/radeon_chipset_gen.h +++ b/src/radeon_chipset_gen.h @@ -26,7 +26,6 @@ static SymTabRec RADEONChipsets[] = { { PCI_CHIP_RV350_AV, "ATI FireGL RV360 AV (AGP)" }, { PCI_CHIP_RS250_4237, "ATI Radeon 7000 IGP (A4+) 4237" }, { PCI_CHIP_R200_BB, "ATI Radeon 8500 AIW BB (AGP)" }, - { PCI_CHIP_R200_BC, "ATI Radeon 8500 AIW BC (AGP)" }, { PCI_CHIP_RS100_4336, "ATI Radeon IGP320M (U1) 4336" }, { PCI_CHIP_RS200_4337, "ATI Radeon IGP330M/340M/350M (U2) 4337" }, { PCI_CHIP_RS250_4437, "ATI Radeon Mobility 7000 IGP 4437" }, diff --git a/src/radeon_pci_chipset_gen.h b/src/radeon_pci_chipset_gen.h index d6b3b11..b4b2a79 100644 --- a/src/radeon_pci_chipset_gen.h +++ b/src/radeon_pci_chipset_gen.h @@ -26,7 +26,6 @@ PciChipsets RADEONPciChipsets[] = { { PCI_CHIP_RV350_AV, PCI_CHIP_RV350_AV, RES_SHARED_VGA }, { PCI_CHIP_RS250_4237, PCI_CHIP_RS250_4237, RES_SHARED_VGA }, { PCI_CHIP_R200_BB, PCI_CHIP_R200_BB, RES_SHARED_VGA }, - { PCI_CHIP_R200_BC, PCI_CHIP_R200_BC, RES_SHARED_VGA }, { PCI_CHIP_RS100_4336, PCI_CHIP_RS100_4336, RES_SHARED_VGA }, { PCI_CHIP_RS200_4337, PCI_CHIP_RS200_4337, RES_SHARED_VGA }, { PCI_CHIP_RS250_4437, PCI_CHIP_RS250_4437, RES_SHARED_VGA }, diff --git a/src/radeon_pci_device_match_gen.h b/src/radeon_pci_device_match_gen.h index dc34586..aa50306 100644 --- a/src/radeon_pci_device_match_gen.h +++ b/src/radeon_pci_device_match_gen.h @@ -26,7 +26,6 @@ static const struct pci_id_match radeon_device_match[] = { ATI_DEVICE_MATCH( PCI_CHIP_RV350_AV, 0 ), ATI_DEVICE_MATCH( PCI_CHIP_RS250_4237, 0 ), ATI_DEVICE_MATCH( PCI_CHIP_R200_BB, 0 ), - ATI_DEVICE_MATCH( PCI_CHIP_R200_BC, 0 ), ATI_DEVICE_MATCH( PCI_CHIP_RS100_4336, 0 ), ATI_DEVICE_MATCH( PCI_CHIP_RS200_4337, 0 ), ATI_DEVICE_MATCH( PCI_CHIP_RS250_4437, 0 ), commit 66eb81b62e5ae8e1d7bd44ed8a179e5ec1ca69af Author: Michel Dänzer <daen...@vmware.com> Date: Mon Jan 31 12:26:20 2011 +0100 UMS: Slightly improve xserver version check. This will ensure the xserver definitions necessary to compile the new code are there. xf86CrtcSetMode will be unresolved at runtime with a few xserver commits, but I'm afraid this is the best we can do. See https://bugs.freedesktop.org/show_bug.cgi?id=33719 . diff --git a/src/radeon_output.c b/src/radeon_output.c index 83aa7c3..877d711 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -1618,7 +1618,7 @@ radeon_set_mode_for_property(xf86OutputPtr output) xf86CrtcPtr crtc = output->crtc; if (crtc->enabled) { -#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,9,99,1,0) +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,9,99,901,0) xf86CrtcSetRec crtc_set_rec; crtc_set_rec.flags = (XF86CrtcSetMode | commit 3dc28c86eb57cac819e4ed650acfe1f7df6ef565 Author: Alex Deucher <alexdeuc...@gmail.com> Date: Thu Jan 27 13:09:26 2011 -0500 ums: fix build against xserver >= 1.10 xf86CrtcSetMode was removed in: http://cgit.freedesktop.org/xorg/xserver/commit/?id=8b35118c03590a7ad3786d3284bafb3f40fcb8cc diff --git a/src/radeon_output.c b/src/radeon_output.c index 689a592..83aa7c3 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -1618,8 +1618,23 @@ radeon_set_mode_for_property(xf86OutputPtr output) xf86CrtcPtr crtc = output->crtc; if (crtc->enabled) { +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,9,99,1,0) + xf86CrtcSetRec crtc_set_rec; + + crtc_set_rec.flags = (XF86CrtcSetMode | + XF86CrtcSetOutput | + XF86CrtcSetOrigin | + XF86CrtcSetRotation); + crtc_set_rec.mode = &crtc->desiredMode; + crtc_set_rec.rotation = crtc->desiredRotation; + crtc_set_rec.transform = NULL; + crtc_set_rec.x = crtc->desiredX; + crtc_set_rec.y = crtc->desiredY; + if (!xf86CrtcSet(crtc, &crtc_set_rec)) { +#else if (!xf86CrtcSetMode(crtc, &crtc->desiredMode, crtc->desiredRotation, crtc->desiredX, crtc->desiredY)) { +#endif xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set mode after propery change!\n"); return FALSE; commit f58e1354b78bf6b70120bddfe1566da3b0723f72 Author: Jerome Glisse <jgli...@redhat.com> Date: Wed Jan 26 16:13:30 2011 -0500 dp: fix displayport support by syncing with KMS code Warning the dp clock value are divided by 10 in ddx (10 times bigger than kernel value) this is somethings very picky. Signed-off-by: Jerome Glisse <jgli...@redhat.com> diff --git a/src/atombios_output.c b/src/atombios_output.c index cad506e..af0e59a 100644 --- a/src/atombios_output.c +++ b/src/atombios_output.c @@ -65,7 +65,114 @@ const char *device_name[12] = { "DFP5", }; +#define AUX_NATIVE_WRITE 0x8 +#define AUX_NATIVE_READ 0x9 + +#define AUX_I2C_WRITE 0x0 +#define AUX_I2C_READ 0x1 +#define AUX_I2C_STATUS 0x2 +#define AUX_I2C_MOT 0x4 + +#define DP_DPCD_REV 0x0 +#define DP_MAX_LINK_RATE 0x1 +#define DP_MAX_LANE_COUNT 0x2 +#define DP_MAX_DOWNSPREAD 0x3 +#define DP_NORP 0x4 +#define DP_DOWNSTREAMPORT_PRESENT 0x5 +#define DP_MAIN_LINK_CHANNEL_CONFIG 0x6 +#define DP_DP11_DOWNSTREAM_PORT_COUNT 0x7 + +/* from intel i830_dp.h */ +#define DP_LINK_BW_SET 0x100 +//# define DP_LINK_BW_1_62 0x06 +//# define DP_LINK_BW_2_7 0x0a +#define DP_LANE_COUNT_SET 0x101 +# define DP_LANE_COUNT_MASK 0x0f +# define DP_LANE_COUNT_ENHANCED_FRAME_EN (1 << 7) + +#define DP_TRAINING_PATTERN_SET 0x102 + +# define DP_TRAINING_PATTERN_DISABLE 0 +# define DP_TRAINING_PATTERN_1 1 +# define DP_TRAINING_PATTERN_2 2 +# define DP_TRAINING_PATTERN_MASK 0x3 + +# define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2) +# define DP_LINK_QUAL_PATTERN_D10_2 (1 << 2) +# define DP_LINK_QUAL_PATTERN_ERROR_RATE (2 << 2) +# define DP_LINK_QUAL_PATTERN_PRBS7 (3 << 2) +# define DP_LINK_QUAL_PATTERN_MASK (3 << 2) +# define DP_RECOVERED_CLOCK_OUT_EN (1 << 4) +# define DP_LINK_SCRAMBLING_DISABLE (1 << 5) + +# define DP_SYMBOL_ERROR_COUNT_BOTH (0 << 6) +# define DP_SYMBOL_ERROR_COUNT_DISPARITY (1 << 6) +# define DP_SYMBOL_ERROR_COUNT_SYMBOL (2 << 6) +# define DP_SYMBOL_ERROR_COUNT_MASK (3 << 6) + +#define DP_TRAINING_LANE0_SET 0x103 +#define DP_TRAINING_LANE1_SET 0x104 +#define DP_TRAINING_LANE2_SET 0x105 +#define DP_TRAINING_LANE3_SET 0x106 +# define DP_TRAIN_VOLTAGE_SWING_MASK 0x3 +# define DP_TRAIN_VOLTAGE_SWING_SHIFT 0 +# define DP_TRAIN_MAX_SWING_REACHED (1 << 2) +# define DP_TRAIN_VOLTAGE_SWING_400 (0 << 0) +# define DP_TRAIN_VOLTAGE_SWING_600 (1 << 0) +# define DP_TRAIN_VOLTAGE_SWING_800 (2 << 0) +# define DP_TRAIN_VOLTAGE_SWING_1200 (3 << 0) + +# define DP_TRAIN_PRE_EMPHASIS_MASK (3 << 3) +# define DP_TRAIN_PRE_EMPHASIS_0 (0 << 3) +# define DP_TRAIN_PRE_EMPHASIS_3_5 (1 << 3) +# define DP_TRAIN_PRE_EMPHASIS_6 (2 << 3) +# define DP_TRAIN_PRE_EMPHASIS_9_5 (3 << 3) + +# define DP_TRAIN_PRE_EMPHASIS_SHIFT 3 +# define DP_TRAIN_MAX_PRE_EMPHASIS_REACHED (1 << 5) +#define DP_DOWNSPREAD_CTRL 0x107 +# define DP_SPREAD_AMP_0_5 (1 << 4) + +#define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108 +# define DP_SET_ANSI_8B10B (1 << 0) + +#define DP_LANE0_1_STATUS 0x202 +#define DP_LANE2_3_STATUS 0x203 + +# define DP_LANE_CR_DONE (1 << 0) +# define DP_LANE_CHANNEL_EQ_DONE (1 << 1) +# define DP_LANE_SYMBOL_LOCKED (1 << 2) + +#define DP_LANE_ALIGN_STATUS_UPDATED 0x204 +#define DP_INTERLANE_ALIGN_DONE (1 << 0) +#define DP_DOWNSTREAM_PORT_STATUS_CHANGED (1 << 6) +#define DP_LINK_STATUS_UPDATED (1 << 7) + +#define DP_SINK_STATUS 0x205 + +#define DP_RECEIVE_PORT_0_STATUS (1 << 0) +#define DP_RECEIVE_PORT_1_STATUS (1 << 1) + +#define DP_ADJUST_REQUEST_LANE0_1 0x206 +#define DP_ADJUST_REQUEST_LANE2_3 0x207 + +#define DP_ADJUST_VOLTAGE_SWING_LANE0_MASK 0x03 +#define DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT 0 +#define DP_ADJUST_PRE_EMPHASIS_LANE0_MASK 0x0c +#define DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT 2 +#define DP_ADJUST_VOLTAGE_SWING_LANE1_MASK 0x30 +#define DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT 4 +#define DP_ADJUST_PRE_EMPHASIS_LANE1_MASK 0xc0 +#define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT 6 + +#define DP_LINK_STATUS_SIZE 6 +#define DP_LINK_CONFIGURATION_SIZE 9 + +#define DP_SET_POWER_D0 0x1 +#define DP_SET_POWER_D3 0x2 + static void do_displayport_link_train(xf86OutputPtr output); +static void atombios_pick_dig_encoder(xf86OutputPtr output); static int atombios_output_dac_setup(xf86OutputPtr output, int action) @@ -487,40 +594,68 @@ static const int num_dp_clocks = sizeof(dp_clocks) / sizeof(int); # define DP_LINK_BW_1_62 0x06 # define DP_LINK_BW_2_7 0x0a +static int radeon_dp_max_lane_count(xf86OutputPtr output); static int -dp_lanes_for_mode_clock(RADEONOutputPrivatePtr radeon_output, - int mode_clock) +dp_lanes_for_mode_clock(xf86OutputPtr output, int mode_clock) { + RADEONOutputPrivatePtr radeon_output = output->driver_private; int i; int max_link_bw = radeon_output->dpcd[1]; + int max_lane_count = radeon_dp_max_lane_count(output); switch (max_link_bw) { case DP_LINK_BW_1_62: default: for (i = 0; i < num_dp_clocks; i++) { - if (i % 2) - continue; - if (dp_clocks[i] > (mode_clock / 10)) { - if (i < 2) - return 1; - else if (i < 4) - return 2; - else - return 4; - } + if (i % 2) + continue; + switch (max_lane_count) { + case 1: + if (i > 1) + return 0; + break; + case 2: + if (i > 3) + return 0; + break; + case 4: + default: + break; + } + if (dp_clocks[i] > (mode_clock/10)) { + if (i < 2) + return 1; + else if (i < 4) + return 2; + else + return 4; + } } break; case DP_LINK_BW_2_7: for (i = 0; i < num_dp_clocks; i++) { - if (dp_clocks[i] > (mode_clock / 10)) { - if (i < 2) - return 1; - else if (i < 4) - return 2; - else - return 4; - } + switch (max_lane_count) { + case 1: + if (i > 1) + return 0; + break; + case 2: + if (i > 3) + return 0; + break; + case 4: + default: + break; + } + if (dp_clocks[i] > (mode_clock/10)) { + if (i < 2) + return 1; + else if (i < 4) + return 2; + else + return 4; + } } break; } @@ -529,21 +664,54 @@ dp_lanes_for_mode_clock(RADEONOutputPrivatePtr radeon_output, } static int -dp_link_clock_for_mode_clock(RADEONOutputPrivatePtr radeon_output, - int mode_clock) +dp_link_clock_for_mode_clock(xf86OutputPtr output, int mode_clock) { + RADEONOutputPrivatePtr radeon_output = output->driver_private; int i; int max_link_bw = radeon_output->dpcd[1]; + int max_lane_count = radeon_dp_max_lane_count(output); switch (max_link_bw) { case DP_LINK_BW_1_62: default: - return 16200; + for (i = 0; i < num_dp_clocks; i++) { + if (i % 2) + continue; + switch (max_lane_count) { + case 1: + if (i > 1) + return 0; + break; + case 2: + if (i > 3) + return 0; + break; + case 4: + default: + break; + } + if (dp_clocks[i] > (mode_clock/10)) + return 16200; + } break; case DP_LINK_BW_2_7: - for (i = 0; i < num_dp_clocks; i++) - if (dp_clocks[i] > (mode_clock / 10)) - return (i % 2) ? 27000 : 16200; + for (i = 0; i < num_dp_clocks; i++) { + switch (max_lane_count) { + case 1: + if (i > 1) + return 0; + break; + case 2: + if (i > 3) + return 0; + break; + case 4: + default: + break; + } + if (dp_clocks[i] > (mode_clock/10)) + return (i % 2) ? 27000 : 16200; + } break; } @@ -624,9 +792,9 @@ atombios_output_dig_encoder_setup(xf86OutputPtr output, int action) disp_data.v1.ucEncoderMode = atombios_get_encoder_mode(output); if (disp_data.v1.ucEncoderMode == ATOM_ENCODER_MODE_DP) { - if (dp_link_clock_for_mode_clock(radeon_output, clock) == 27000) + if (dp_link_clock_for_mode_clock(output, clock) == 27000) disp_data.v1.ucConfig |= ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ; - disp_data.v1.ucLaneNum = dp_lanes_for_mode_clock(radeon_output, clock); + disp_data.v1.ucLaneNum = dp_lanes_for_mode_clock(output, clock); } else if (clock > 165000) disp_data.v1.ucLaneNum = 8; else @@ -716,7 +884,7 @@ atombios_output_dig_transmitter_setup(xf86OutputPtr output, int action, uint8_t } else { if (radeon_output->MonType == MT_DP) disp_data.v1.usPixelClock = - cpu_to_le16(dp_link_clock_for_mode_clock(radeon_output, clock)); + cpu_to_le16(dp_link_clock_for_mode_clock(output, clock)); else if (clock > 165000) disp_data.v1.usPixelClock = cpu_to_le16((clock / 2) / 10); else @@ -725,7 +893,7 @@ atombios_output_dig_transmitter_setup(xf86OutputPtr output, int action, uint8_t if (IS_DCE4_VARIANT) { if (radeon_output->MonType == MT_DP) - disp_data.v3.ucLaneNum = dp_lanes_for_mode_clock(radeon_output, clock); + disp_data.v3.ucLaneNum = dp_lanes_for_mode_clock(output, clock); else if (clock > 165000) disp_data.v3.ucLaneNum = 8; else @@ -1301,6 +1469,7 @@ atombios_output_dpms(xf86OutputPtr output, int mode) if (radeon_encoder == NULL) return; + atombios_pick_dig_encoder(output); switch (radeon_encoder->encoder_id) { case ENCODER_OBJECT_ID_INTERNAL_TMDS1: @@ -1887,111 +2056,6 @@ atombios_dac_detect(xf86OutputPtr output) return MonType; } -#define AUX_NATIVE_WRITE 0x8 -#define AUX_NATIVE_READ 0x9 - -#define AUX_I2C_WRITE 0x0 -#define AUX_I2C_READ 0x1 -#define AUX_I2C_STATUS 0x2 -#define AUX_I2C_MOT 0x4 - -#define DP_DPCD_REV 0x0 -#define DP_MAX_LINK_RATE 0x1 -#define DP_MAX_LANE_COUNT 0x2 -#define DP_MAX_DOWNSPREAD 0x3 -#define DP_NORP 0x4 -#define DP_DOWNSTREAMPORT_PRESENT 0x5 -#define DP_MAIN_LINK_CHANNEL_CONFIG 0x6 -#define DP_DP11_DOWNSTREAM_PORT_COUNT 0x7 - -/* from intel i830_dp.h */ -#define DP_LINK_BW_SET 0x100 -//# define DP_LINK_BW_1_62 0x06 -//# define DP_LINK_BW_2_7 0x0a -#define DP_LANE_COUNT_SET 0x101 -# define DP_LANE_COUNT_MASK 0x0f -# define DP_LANE_COUNT_ENHANCED_FRAME_EN (1 << 7) - -#define DP_TRAINING_PATTERN_SET 0x102 - -# define DP_TRAINING_PATTERN_DISABLE 0 -# define DP_TRAINING_PATTERN_1 1 -# define DP_TRAINING_PATTERN_2 2 -# define DP_TRAINING_PATTERN_MASK 0x3 - -# define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2) -# define DP_LINK_QUAL_PATTERN_D10_2 (1 << 2) -# define DP_LINK_QUAL_PATTERN_ERROR_RATE (2 << 2) -# define DP_LINK_QUAL_PATTERN_PRBS7 (3 << 2) -# define DP_LINK_QUAL_PATTERN_MASK (3 << 2) -# define DP_RECOVERED_CLOCK_OUT_EN (1 << 4) -# define DP_LINK_SCRAMBLING_DISABLE (1 << 5) - -# define DP_SYMBOL_ERROR_COUNT_BOTH (0 << 6) -# define DP_SYMBOL_ERROR_COUNT_DISPARITY (1 << 6) -# define DP_SYMBOL_ERROR_COUNT_SYMBOL (2 << 6) -# define DP_SYMBOL_ERROR_COUNT_MASK (3 << 6) - -#define DP_TRAINING_LANE0_SET 0x103 -#define DP_TRAINING_LANE1_SET 0x104 -#define DP_TRAINING_LANE2_SET 0x105 -#define DP_TRAINING_LANE3_SET 0x106 -# define DP_TRAIN_VOLTAGE_SWING_MASK 0x3 -# define DP_TRAIN_VOLTAGE_SWING_SHIFT 0 -# define DP_TRAIN_MAX_SWING_REACHED (1 << 2) -# define DP_TRAIN_VOLTAGE_SWING_400 (0 << 0) -# define DP_TRAIN_VOLTAGE_SWING_600 (1 << 0) -# define DP_TRAIN_VOLTAGE_SWING_800 (2 << 0) -# define DP_TRAIN_VOLTAGE_SWING_1200 (3 << 0) - -# define DP_TRAIN_PRE_EMPHASIS_MASK (3 << 3) -# define DP_TRAIN_PRE_EMPHASIS_0 (0 << 3) -# define DP_TRAIN_PRE_EMPHASIS_3_5 (1 << 3) -# define DP_TRAIN_PRE_EMPHASIS_6 (2 << 3) -# define DP_TRAIN_PRE_EMPHASIS_9_5 (3 << 3) - -# define DP_TRAIN_PRE_EMPHASIS_SHIFT 3 -# define DP_TRAIN_MAX_PRE_EMPHASIS_REACHED (1 << 5) -#define DP_DOWNSPREAD_CTRL 0x107 -# define DP_SPREAD_AMP_0_5 (1 << 4) - -#define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108 -# define DP_SET_ANSI_8B10B (1 << 0) - -#define DP_LANE0_1_STATUS 0x202 -#define DP_LANE2_3_STATUS 0x203 - -# define DP_LANE_CR_DONE (1 << 0) -# define DP_LANE_CHANNEL_EQ_DONE (1 << 1) -# define DP_LANE_SYMBOL_LOCKED (1 << 2) - -#define DP_LANE_ALIGN_STATUS_UPDATED 0x204 -#define DP_INTERLANE_ALIGN_DONE (1 << 0) -#define DP_DOWNSTREAM_PORT_STATUS_CHANGED (1 << 6) -#define DP_LINK_STATUS_UPDATED (1 << 7) - -#define DP_SINK_STATUS 0x205 - -#define DP_RECEIVE_PORT_0_STATUS (1 << 0) -#define DP_RECEIVE_PORT_1_STATUS (1 << 1) - -#define DP_ADJUST_REQUEST_LANE0_1 0x206 -#define DP_ADJUST_REQUEST_LANE2_3 0x207 - -#define DP_ADJUST_VOLTAGE_SWING_LANE0_MASK 0x03 -#define DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT 0 -#define DP_ADJUST_PRE_EMPHASIS_LANE0_MASK 0x0c -#define DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT 2 -#define DP_ADJUST_VOLTAGE_SWING_LANE1_MASK 0x30 -#define DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT 4 -#define DP_ADJUST_PRE_EMPHASIS_LANE1_MASK 0xc0 -#define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT 6 - -#define DP_LINK_STATUS_SIZE 6 -#define DP_LINK_CONFIGURATION_SIZE 9 - -#define DP_SET_POWER_D0 0x1 -#define DP_SET_POWER_D3 0x2 static inline int atom_dp_get_encoder_id(xf86OutputPtr output) { @@ -2534,66 +2598,16 @@ static int radeon_dp_max_lane_count(xf86OutputPtr output) return max_lane_count; } -static int radeon_dp_max_link_bw(xf86OutputPtr output) -{ - RADEONOutputPrivatePtr radeon_output = output->driver_private; - int max_link_bw = radeon_output->dpcd[1]; - switch(max_link_bw) { - case DP_LINK_BW_1_62: - case DP_LINK_BW_2_7: - break; - default: - max_link_bw = DP_LINK_BW_1_62; - break; - } - return max_link_bw; -} - -static int radeon_dp_link_clock(uint8_t link_bw) -{ - if (link_bw == DP_LINK_BW_2_7) - return 270000; - else - return 162000; -} -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1pq4m5-0002y1...@alioth.debian.org