aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2009-09-10 15:46:48 -0400
committerDave Airlie <airlied@redhat.com>2009-09-11 01:53:59 -0400
commit6cf8a3f58806f12b975a89cfd7edf01566ff80a0 (patch)
tree5c940fa2e6651b7157744758cf008fb2d578db83 /drivers/gpu
parent923f6848e1686059ef8d272d1fca4d3577911a41 (diff)
drm/radeon/kms: move modeset init outside of GPU init
We are splitting GPU & modeset init so that it's easier to abord only remaining GPU init when somethings fails. We want to always provide enough funcionalities to get fbcon and a shadowfb X working. Only acceptable error during initialization are memory allocation failure or io mapping failure. 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/radeon.h4
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c20
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c22
3 files changed, 25 insertions, 21 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index d6ff4e012063..23ede0e4783e 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -933,6 +933,10 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
933#define radeon_clear_surface_reg(rdev, r) ((rdev)->asic->clear_surface_reg((rdev), (r))) 933#define radeon_clear_surface_reg(rdev, r) ((rdev)->asic->clear_surface_reg((rdev), (r)))
934#define radeon_bandwidth_update(rdev) (rdev)->asic->bandwidth_update((rdev)) 934#define radeon_bandwidth_update(rdev) (rdev)->asic->bandwidth_update((rdev))
935 935
936/* Common functions */
937int radeon_modeset_init(struct radeon_device *rdev);
938void radeon_modeset_fini(struct radeon_device *rdev);
939
936/* r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 */ 940/* r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 */
937void r100_cp_disable(struct radeon_device *rdev); 941void r100_cp_disable(struct radeon_device *rdev);
938void r100_pci_gart_tlb_flush(struct radeon_device *rdev); 942void r100_pci_gart_tlb_flush(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index bf6939497e15..72f6262ea73b 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -469,9 +469,6 @@ void radeon_combios_fini(struct radeon_device *rdev)
469{ 469{
470} 470}
471 471
472int radeon_modeset_init(struct radeon_device *rdev);
473void radeon_modeset_fini(struct radeon_device *rdev);
474
475 472
476/* 473/*
477 * Radeon device. 474 * Radeon device.
@@ -481,7 +478,7 @@ int radeon_device_init(struct radeon_device *rdev,
481 struct pci_dev *pdev, 478 struct pci_dev *pdev,
482 uint32_t flags) 479 uint32_t flags)
483{ 480{
484 int r, ret = 0; 481 int r;
485 int dma_bits; 482 int dma_bits;
486 483
487 DRM_INFO("radeon: Initializing kernel modesetting.\n"); 484 DRM_INFO("radeon: Initializing kernel modesetting.\n");
@@ -660,33 +657,22 @@ int radeon_device_init(struct radeon_device *rdev,
660 return r; 657 return r;
661 } 658 }
662 } 659 }
663 ret = r;
664 }
665 r = radeon_modeset_init(rdev);
666 if (r) {
667 return r;
668 }
669 if (!ret) {
670 DRM_INFO("radeon: kernel modesetting successfully initialized.\n");
671 } 660 }
661 DRM_INFO("radeon: kernel modesetting successfully initialized.\n");
672 if (radeon_testing) { 662 if (radeon_testing) {
673 radeon_test_moves(rdev); 663 radeon_test_moves(rdev);
674 } 664 }
675 if (radeon_benchmarking) { 665 if (radeon_benchmarking) {
676 radeon_benchmark(rdev); 666 radeon_benchmark(rdev);
677 } 667 }
678 return ret; 668 return 0;
679} 669}
680 670
681void radeon_device_fini(struct radeon_device *rdev) 671void radeon_device_fini(struct radeon_device *rdev)
682{ 672{
683 if (rdev == NULL || rdev->rmmio == NULL) {
684 return;
685 }
686 DRM_INFO("radeon: finishing device.\n"); 673 DRM_INFO("radeon: finishing device.\n");
687 rdev->shutdown = true; 674 rdev->shutdown = true;
688 /* Order matter so becarefull if you rearrange anythings */ 675 /* Order matter so becarefull if you rearrange anythings */
689 radeon_modeset_fini(rdev);
690 if (!rdev->new_init_path) { 676 if (!rdev->new_init_path) {
691 radeon_ib_pool_fini(rdev); 677 radeon_ib_pool_fini(rdev);
692 radeon_cp_fini(rdev); 678 radeon_cp_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index dce09ada32bc..ac8505fe2ca7 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -54,12 +54,23 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
54 flags |= RADEON_IS_PCI; 54 flags |= RADEON_IS_PCI;
55 } 55 }
56 56
57 /* radeon_device_init should report only fatal error
58 * like memory allocation failure or iomapping failure,
59 * or memory manager initialization failure, it must
60 * properly initialize the GPU MC controller and permit
61 * VRAM allocation
62 */
57 r = radeon_device_init(rdev, dev, dev->pdev, flags); 63 r = radeon_device_init(rdev, dev, dev->pdev, flags);
58 if (r) { 64 if (r) {
59 DRM_ERROR("Failed to initialize radeon, disabling IOCTL\n"); 65 DRM_ERROR("Fatal error while trying to initialize radeon.\n");
60 radeon_device_fini(rdev); 66 return r;
61 kfree(rdev); 67 }
62 dev->dev_private = NULL; 68 /* Again modeset_init should fail only on fatal error
69 * otherwise it should provide enough functionalities
70 * for shadowfb to run
71 */
72 r = radeon_modeset_init(rdev);
73 if (r) {
63 return r; 74 return r;
64 } 75 }
65 return 0; 76 return 0;
@@ -69,6 +80,9 @@ int radeon_driver_unload_kms(struct drm_device *dev)
69{ 80{
70 struct radeon_device *rdev = dev->dev_private; 81 struct radeon_device *rdev = dev->dev_private;
71 82
83 if (rdev == NULL)
84 return 0;
85 radeon_modeset_fini(rdev);
72 radeon_device_fini(rdev); 86 radeon_device_fini(rdev);
73 kfree(rdev); 87 kfree(rdev);
74 dev->dev_private = NULL; 88 dev->dev_private = NULL;