aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2009-10-06 13:04:29 -0400
committerDave Airlie <airlied@redhat.com>2009-10-07 19:40:04 -0400
commitb574f251f787c5b163da5ea345525569e51775bc (patch)
tree8adad6a3934898d8c71567729db0005e2189cd26 /drivers/gpu
parent01ceae8edd7a0a6d8588dc103ad9f55e2c52cae9 (diff)
drm/radeon/kms: Fallback to non AGP when acceleration fails to initialize (v2)
When GPU acceleration is not working with AGP try to fallback to non AGP GART (either PCI or PCIE GART). This should make KMS failure on AGP less painfull. We still need to find out what is wrong when AGP fails but at least user have a lot of more chances to get a working configuration with acceleration. This patch also cleanup R600/RV770 fallback path so they use same code as others asics. Version 2 factorize agp disabling logic to avoid code duplication and bugs. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/r600.c18
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c51
-rw-r--r--drivers/gpu/drm/radeon/rv770.c18
3 files changed, 34 insertions, 53 deletions
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 9f7eb08b30aa..2cef638fa069 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1560,15 +1560,8 @@ int r600_init(struct radeon_device *rdev)
1560 if (r) 1560 if (r)
1561 return r; 1561 return r;
1562 r = r600_mc_init(rdev); 1562 r = r600_mc_init(rdev);
1563 if (r) { 1563 if (r)
1564 if (rdev->flags & RADEON_IS_AGP) {
1565 /* Retry with disabling AGP */
1566 r600_fini(rdev);
1567 rdev->flags &= ~RADEON_IS_AGP;
1568 return r600_init(rdev);
1569 }
1570 return r; 1564 return r;
1571 }
1572 /* Memory manager */ 1565 /* Memory manager */
1573 r = radeon_object_init(rdev); 1566 r = radeon_object_init(rdev);
1574 if (r) 1567 if (r)
@@ -1597,15 +1590,8 @@ int r600_init(struct radeon_device *rdev)
1597 1590
1598 r = r600_startup(rdev); 1591 r = r600_startup(rdev);
1599 if (r) { 1592 if (r) {
1600 if (rdev->flags & RADEON_IS_AGP) {
1601 /* Retry with disabling AGP */
1602 r600_fini(rdev);
1603 rdev->flags &= ~RADEON_IS_AGP;
1604 return r600_init(rdev);
1605 }
1606 r600_suspend(rdev); 1593 r600_suspend(rdev);
1607 r600_wb_fini(rdev); 1594 r600_wb_fini(rdev);
1608 radeon_ib_pool_fini(rdev);
1609 radeon_ring_fini(rdev); 1595 radeon_ring_fini(rdev);
1610 r600_pcie_gart_fini(rdev); 1596 r600_pcie_gart_fini(rdev);
1611 rdev->accel_working = false; 1597 rdev->accel_working = false;
@@ -1637,10 +1623,8 @@ void r600_fini(struct radeon_device *rdev)
1637 radeon_gem_fini(rdev); 1623 radeon_gem_fini(rdev);
1638 radeon_fence_driver_fini(rdev); 1624 radeon_fence_driver_fini(rdev);
1639 radeon_clocks_fini(rdev); 1625 radeon_clocks_fini(rdev);
1640#if __OS_HAS_AGP
1641 if (rdev->flags & RADEON_IS_AGP) 1626 if (rdev->flags & RADEON_IS_AGP)
1642 radeon_agp_fini(rdev); 1627 radeon_agp_fini(rdev);
1643#endif
1644 radeon_object_fini(rdev); 1628 radeon_object_fini(rdev);
1645 radeon_atombios_fini(rdev); 1629 radeon_atombios_fini(rdev);
1646 kfree(rdev->bios); 1630 kfree(rdev->bios);
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 2d07ccc03c43..a6b80eb236ee 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -476,6 +476,27 @@ void radeon_combios_fini(struct radeon_device *rdev)
476{ 476{
477} 477}
478 478
479void radeon_agp_disable(struct radeon_device *rdev)
480{
481 rdev->flags &= ~RADEON_IS_AGP;
482 if (rdev->family >= CHIP_R600) {
483 DRM_INFO("Forcing AGP to PCIE mode\n");
484 rdev->flags |= RADEON_IS_PCIE;
485 } else if (rdev->family >= CHIP_RV515 ||
486 rdev->family == CHIP_RV380 ||
487 rdev->family == CHIP_RV410 ||
488 rdev->family == CHIP_R423) {
489 DRM_INFO("Forcing AGP to PCIE mode\n");
490 rdev->flags |= RADEON_IS_PCIE;
491 rdev->asic->gart_tlb_flush = &rv370_pcie_gart_tlb_flush;
492 rdev->asic->gart_set_page = &rv370_pcie_gart_set_page;
493 } else {
494 DRM_INFO("Forcing AGP to PCI mode\n");
495 rdev->flags |= RADEON_IS_PCI;
496 rdev->asic->gart_tlb_flush = &r100_pci_gart_tlb_flush;
497 rdev->asic->gart_set_page = &r100_pci_gart_set_page;
498 }
499}
479 500
480/* 501/*
481 * Radeon device. 502 * Radeon device.
@@ -515,24 +536,7 @@ int radeon_device_init(struct radeon_device *rdev,
515 } 536 }
516 537
517 if (radeon_agpmode == -1) { 538 if (radeon_agpmode == -1) {
518 rdev->flags &= ~RADEON_IS_AGP; 539 radeon_agp_disable(rdev);
519 if (rdev->family >= CHIP_R600) {
520 DRM_INFO("Forcing AGP to PCIE mode\n");
521 rdev->flags |= RADEON_IS_PCIE;
522 } else if (rdev->family >= CHIP_RV515 ||
523 rdev->family == CHIP_RV380 ||
524 rdev->family == CHIP_RV410 ||
525 rdev->family == CHIP_R423) {
526 DRM_INFO("Forcing AGP to PCIE mode\n");
527 rdev->flags |= RADEON_IS_PCIE;
528 rdev->asic->gart_tlb_flush = &rv370_pcie_gart_tlb_flush;
529 rdev->asic->gart_set_page = &rv370_pcie_gart_set_page;
530 } else {
531 DRM_INFO("Forcing AGP to PCI mode\n");
532 rdev->flags |= RADEON_IS_PCI;
533 rdev->asic->gart_tlb_flush = &r100_pci_gart_tlb_flush;
534 rdev->asic->gart_set_page = &r100_pci_gart_set_page;
535 }
536 } 540 }
537 541
538 /* set DMA mask + need_dma32 flags. 542 /* set DMA mask + need_dma32 flags.
@@ -565,8 +569,17 @@ int radeon_device_init(struct radeon_device *rdev,
565 DRM_INFO("register mmio size: %u\n", (unsigned)rdev->rmmio_size); 569 DRM_INFO("register mmio size: %u\n", (unsigned)rdev->rmmio_size);
566 570
567 r = radeon_init(rdev); 571 r = radeon_init(rdev);
568 if (r) { 572 if (r)
569 return r; 573 return r;
574 if (rdev->flags & RADEON_IS_AGP && !rdev->accel_working) {
575 /* Acceleration not working on AGP card try again
576 * with fallback to PCI or PCIE GART
577 */
578 radeon_fini(rdev);
579 radeon_agp_disable(rdev);
580 r = radeon_init(rdev);
581 if (r)
582 return r;
570 } 583 }
571 if (radeon_testing) { 584 if (radeon_testing) {
572 radeon_test_moves(rdev); 585 radeon_test_moves(rdev);
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 295cf14e3c53..5c597dfa5d49 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -923,15 +923,8 @@ int rv770_init(struct radeon_device *rdev)
923 if (r) 923 if (r)
924 return r; 924 return r;
925 r = rv770_mc_init(rdev); 925 r = rv770_mc_init(rdev);
926 if (r) { 926 if (r)
927 if (rdev->flags & RADEON_IS_AGP) {
928 /* Retry with disabling AGP */
929 rv770_fini(rdev);
930 rdev->flags &= ~RADEON_IS_AGP;
931 return rv770_init(rdev);
932 }
933 return r; 927 return r;
934 }
935 /* Memory manager */ 928 /* Memory manager */
936 r = radeon_object_init(rdev); 929 r = radeon_object_init(rdev);
937 if (r) 930 if (r)
@@ -960,15 +953,8 @@ int rv770_init(struct radeon_device *rdev)
960 953
961 r = rv770_startup(rdev); 954 r = rv770_startup(rdev);
962 if (r) { 955 if (r) {
963 if (rdev->flags & RADEON_IS_AGP) {
964 /* Retry with disabling AGP */
965 rv770_fini(rdev);
966 rdev->flags &= ~RADEON_IS_AGP;
967 return rv770_init(rdev);
968 }
969 rv770_suspend(rdev); 956 rv770_suspend(rdev);
970 r600_wb_fini(rdev); 957 r600_wb_fini(rdev);
971 radeon_ib_pool_fini(rdev);
972 radeon_ring_fini(rdev); 958 radeon_ring_fini(rdev);
973 rv770_pcie_gart_fini(rdev); 959 rv770_pcie_gart_fini(rdev);
974 rdev->accel_working = false; 960 rdev->accel_working = false;
@@ -999,10 +985,8 @@ void rv770_fini(struct radeon_device *rdev)
999 radeon_gem_fini(rdev); 985 radeon_gem_fini(rdev);
1000 radeon_fence_driver_fini(rdev); 986 radeon_fence_driver_fini(rdev);
1001 radeon_clocks_fini(rdev); 987 radeon_clocks_fini(rdev);
1002#if __OS_HAS_AGP
1003 if (rdev->flags & RADEON_IS_AGP) 988 if (rdev->flags & RADEON_IS_AGP)
1004 radeon_agp_fini(rdev); 989 radeon_agp_fini(rdev);
1005#endif
1006 radeon_object_fini(rdev); 990 radeon_object_fini(rdev);
1007 radeon_atombios_fini(rdev); 991 radeon_atombios_fini(rdev);
1008 kfree(rdev->bios); 992 kfree(rdev->bios);