aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2009-09-16 09:24:21 -0400
committerDave Airlie <airlied@redhat.com>2009-09-18 02:01:57 -0400
commit733289c2656c556d5cf36eafa1c8ec77222c359f (patch)
treebb4df1305a867baf63fba27620d6f8c0f68db1a4
parent7cbb355e947b3b426cefd9a3dc0dda3af9f9345a (diff)
drm/radeon/kms: don't fail if we fail to init GPU acceleration
Userspace can query if acceleration is working or not true get info ioctl and could fallback to software if for some reason kernel failed to initialize KMS. This should allow to give a working KMS setup in all case (even with non functionning accel). Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/radeon/r420.c2
-rw-r--r--drivers/gpu/drm/radeon/r600.c33
-rw-r--r--drivers/gpu/drm/radeon/radeon.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c44
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c3
-rw-r--r--drivers/gpu/drm/radeon/rv770.c33
-rw-r--r--include/drm/radeon_drm.h1
7 files changed, 61 insertions, 56 deletions
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
index 33a25a4377b8..2142a4781970 100644
--- a/drivers/gpu/drm/radeon/r420.c
+++ b/drivers/gpu/drm/radeon/r420.c
@@ -329,6 +329,7 @@ int r420_init(struct radeon_device *rdev)
329 return r; 329 return r;
330 } 330 }
331 r300_set_reg_safe(rdev); 331 r300_set_reg_safe(rdev);
332 rdev->accel_working = true;
332 r = r420_resume(rdev); 333 r = r420_resume(rdev);
333 if (r) { 334 if (r) {
334 /* Somethings want wront with the accel init stop accel */ 335 /* Somethings want wront with the accel init stop accel */
@@ -343,6 +344,7 @@ int r420_init(struct radeon_device *rdev)
343 r100_pci_gart_fini(rdev); 344 r100_pci_gart_fini(rdev);
344 radeon_agp_fini(rdev); 345 radeon_agp_fini(rdev);
345 radeon_irq_kms_fini(rdev); 346 radeon_irq_kms_fini(rdev);
347 rdev->accel_working = false;
346 } 348 }
347 return 0; 349 return 0;
348} 350}
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 65699e9f2025..af430d719e7f 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1573,6 +1573,7 @@ int r600_init(struct radeon_device *rdev)
1573 if (r) 1573 if (r)
1574 return r; 1574 return r;
1575 1575
1576 rdev->accel_working = true;
1576 r = r600_resume(rdev); 1577 r = r600_resume(rdev);
1577 if (r) { 1578 if (r) {
1578 if (rdev->flags & RADEON_IS_AGP) { 1579 if (rdev->flags & RADEON_IS_AGP) {
@@ -1581,22 +1582,24 @@ int r600_init(struct radeon_device *rdev)
1581 rdev->flags &= ~RADEON_IS_AGP; 1582 rdev->flags &= ~RADEON_IS_AGP;
1582 return r600_init(rdev); 1583 return r600_init(rdev);
1583 } 1584 }
1584 return r; 1585 rdev->accel_working = false;
1585 }
1586 r = radeon_ib_pool_init(rdev);
1587 if (r) {
1588 DRM_ERROR("radeon: failled initializing IB pool (%d).\n", r);
1589 return r;
1590 } 1586 }
1591 r = r600_blit_init(rdev); 1587 if (rdev->accel_working) {
1592 if (r) { 1588 r = radeon_ib_pool_init(rdev);
1593 DRM_ERROR("radeon: failled blitter (%d).\n", r); 1589 if (r) {
1594 return r; 1590 DRM_ERROR("radeon: failled initializing IB pool (%d).\n", r);
1595 } 1591 rdev->accel_working = false;
1596 r = radeon_ib_test(rdev); 1592 }
1597 if (r) { 1593 r = r600_blit_init(rdev);
1598 DRM_ERROR("radeon: failled testing IB (%d).\n", r); 1594 if (r) {
1599 return r; 1595 DRM_ERROR("radeon: failled blitter (%d).\n", r);
1596 rdev->accel_working = false;
1597 }
1598 r = radeon_ib_test(rdev);
1599 if (r) {
1600 DRM_ERROR("radeon: failled testing IB (%d).\n", r);
1601 rdev->accel_working = false;
1602 }
1600 } 1603 }
1601 return 0; 1604 return 0;
1602} 1605}
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 5bfc05612ac2..d7c4efd08928 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -793,6 +793,7 @@ struct radeon_device {
793 bool suspend; 793 bool suspend;
794 bool need_dma32; 794 bool need_dma32;
795 bool new_init_path; 795 bool new_init_path;
796 bool accel_working;
796 struct radeon_surface_reg surface_regs[RADEON_GEM_MAX_SURFACES]; 797 struct radeon_surface_reg surface_regs[RADEON_GEM_MAX_SURFACES];
797 const struct firmware *me_fw; /* all family ME firmware */ 798 const struct firmware *me_fw; /* all family ME firmware */
798 const struct firmware *pfp_fw; /* r6/700 PFP firmware */ 799 const struct firmware *pfp_fw; /* r6/700 PFP firmware */
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index db5ae73d6289..0b5014c2ae7f 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -504,6 +504,7 @@ int radeon_device_init(struct radeon_device *rdev,
504 rdev->usec_timeout = RADEON_MAX_USEC_TIMEOUT; 504 rdev->usec_timeout = RADEON_MAX_USEC_TIMEOUT;
505 rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; 505 rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
506 rdev->gpu_lockup = false; 506 rdev->gpu_lockup = false;
507 rdev->accel_working = false;
507 /* mutex initialization are all done here so we 508 /* mutex initialization are all done here so we
508 * can recall function without having locking issues */ 509 * can recall function without having locking issues */
509 mutex_init(&rdev->cs_mutex); 510 mutex_init(&rdev->cs_mutex);
@@ -649,35 +650,26 @@ int radeon_device_init(struct radeon_device *rdev,
649 /* Initialize GART (initialize after TTM so we can allocate 650 /* Initialize GART (initialize after TTM so we can allocate
650 * memory through TTM but finalize after TTM) */ 651 * memory through TTM but finalize after TTM) */
651 r = radeon_gart_enable(rdev); 652 r = radeon_gart_enable(rdev);
652 if (!r) { 653 if (r)
654 return 0;
653 r = radeon_gem_init(rdev); 655 r = radeon_gem_init(rdev);
654 } 656 if (r)
657 return 0;
655 658
656 /* 1M ring buffer */ 659 /* 1M ring buffer */
657 if (!r) { 660 r = radeon_cp_init(rdev, 1024 * 1024);
658 r = radeon_cp_init(rdev, 1024 * 1024); 661 if (r)
659 } 662 return 0;
660 if (!r) { 663 r = radeon_wb_init(rdev);
661 r = radeon_wb_init(rdev); 664 if (r)
662 if (r) { 665 DRM_ERROR("radeon: failled initializing WB (%d).\n", r);
663 DRM_ERROR("radeon: failled initializing WB (%d).\n", r); 666 r = radeon_ib_pool_init(rdev);
664 return r; 667 if (r)
665 } 668 return 0;
666 } 669 r = radeon_ib_test(rdev);
667 if (!r) { 670 if (r)
668 r = radeon_ib_pool_init(rdev); 671 return 0;
669 if (r) { 672 rdev->accel_working = true;
670 DRM_ERROR("radeon: failled initializing IB pool (%d).\n", r);
671 return r;
672 }
673 }
674 if (!r) {
675 r = radeon_ib_test(rdev);
676 if (r) {
677 DRM_ERROR("radeon: failled testing IB (%d).\n", r);
678 return r;
679 }
680 }
681 } 673 }
682 DRM_INFO("radeon: kernel modesetting successfully initialized.\n"); 674 DRM_INFO("radeon: kernel modesetting successfully initialized.\n");
683 if (radeon_testing) { 675 if (radeon_testing) {
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index ac8505fe2ca7..709bd892b3a9 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -112,6 +112,9 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
112 case RADEON_INFO_NUM_Z_PIPES: 112 case RADEON_INFO_NUM_Z_PIPES:
113 value = rdev->num_z_pipes; 113 value = rdev->num_z_pipes;
114 break; 114 break;
115 case RADEON_INFO_ACCEL_WORKING:
116 value = rdev->accel_working;
117 break;
115 default: 118 default:
116 DRM_DEBUG("Invalid request %d\n", info->request); 119 DRM_DEBUG("Invalid request %d\n", info->request);
117 return -EINVAL; 120 return -EINVAL;
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 4f2098bc7974..be2f86539ebc 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -953,6 +953,7 @@ int rv770_init(struct radeon_device *rdev)
953 if (r) 953 if (r)
954 return r; 954 return r;
955 955
956 rdev->accel_working = true;
956 r = rv770_resume(rdev); 957 r = rv770_resume(rdev);
957 if (r) { 958 if (r) {
958 if (rdev->flags & RADEON_IS_AGP) { 959 if (rdev->flags & RADEON_IS_AGP) {
@@ -961,22 +962,24 @@ int rv770_init(struct radeon_device *rdev)
961 rdev->flags &= ~RADEON_IS_AGP; 962 rdev->flags &= ~RADEON_IS_AGP;
962 return rv770_init(rdev); 963 return rv770_init(rdev);
963 } 964 }
964 return r; 965 rdev->accel_working = false;
965 }
966 r = r600_blit_init(rdev);
967 if (r) {
968 DRM_ERROR("radeon: failled blitter (%d).\n", r);
969 return r;
970 } 966 }
971 r = radeon_ib_pool_init(rdev); 967 if (rdev->accel_working) {
972 if (r) { 968 r = r600_blit_init(rdev);
973 DRM_ERROR("radeon: failled initializing IB pool (%d).\n", r); 969 if (r) {
974 return r; 970 DRM_ERROR("radeon: failled blitter (%d).\n", r);
975 } 971 rdev->accel_working = false;
976 r = radeon_ib_test(rdev); 972 }
977 if (r) { 973 r = radeon_ib_pool_init(rdev);
978 DRM_ERROR("radeon: failled testing IB (%d).\n", r); 974 if (r) {
979 return r; 975 DRM_ERROR("radeon: failled initializing IB pool (%d).\n", r);
976 rdev->accel_working = false;
977 }
978 r = radeon_ib_test(rdev);
979 if (r) {
980 DRM_ERROR("radeon: failled testing IB (%d).\n", r);
981 rdev->accel_working = false;
982 }
980 } 983 }
981 return 0; 984 return 0;
982} 985}
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 2ba61e18fc8b..b67bbd75bd20 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -899,6 +899,7 @@ struct drm_radeon_cs {
899#define RADEON_INFO_DEVICE_ID 0x00 899#define RADEON_INFO_DEVICE_ID 0x00
900#define RADEON_INFO_NUM_GB_PIPES 0x01 900#define RADEON_INFO_NUM_GB_PIPES 0x01
901#define RADEON_INFO_NUM_Z_PIPES 0x02 901#define RADEON_INFO_NUM_Z_PIPES 0x02
902#define RADEON_INFO_ACCEL_WORKING 0x03
902 903
903struct drm_radeon_info { 904struct drm_radeon_info {
904 uint32_t request; 905 uint32_t request;