aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/r100.c
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2011-11-15 11:48:34 -0500
committerDave Airlie <airlied@redhat.com>2011-12-20 14:52:12 -0500
commitb15ba51207e54245409d6f46e20dab36f906eed1 (patch)
treeb34a37395efa5be0a9af4ba5b627e43813713ed3 /drivers/gpu/drm/radeon/r100.c
parent1b37078b7ddf35cab12ac6544187e3636d50c0dc (diff)
drm/radeon: introduce a sub allocator and convert ib pool to it v4
Somewhat specializaed sub-allocator designed to perform sub-allocation for command buffer not only for current cs ioctl but for future command submission ioctl as well. Patch also convert current ib pool to use the sub allocator. Idea is that ib poll buffer can be share with other command buffer submission not having 64K granularity. v2 Harmonize pool handling and add suspend/resume callback to pin/unpin sa bo (tested on rv280, rv370, r420, rv515, rv610, rv710, redwood, cayman, rs480, rs690, rs880) v3 Simplify allocator v4 Fix radeon_ib_get error path to properly free fence Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r100.c')
-rw-r--r--drivers/gpu/drm/radeon/r100.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index d7fd5aa47053..657040b15b06 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -3752,28 +3752,10 @@ int r100_ib_test(struct radeon_device *rdev)
3752 3752
3753void r100_ib_fini(struct radeon_device *rdev) 3753void r100_ib_fini(struct radeon_device *rdev)
3754{ 3754{
3755 radeon_ib_pool_suspend(rdev);
3755 radeon_ib_pool_fini(rdev); 3756 radeon_ib_pool_fini(rdev);
3756} 3757}
3757 3758
3758int r100_ib_init(struct radeon_device *rdev)
3759{
3760 int r;
3761
3762 r = radeon_ib_pool_init(rdev);
3763 if (r) {
3764 dev_err(rdev->dev, "failed initializing IB pool (%d).\n", r);
3765 r100_ib_fini(rdev);
3766 return r;
3767 }
3768 r = r100_ib_test(rdev);
3769 if (r) {
3770 dev_err(rdev->dev, "failed testing IB (%d).\n", r);
3771 r100_ib_fini(rdev);
3772 return r;
3773 }
3774 return 0;
3775}
3776
3777void r100_mc_stop(struct radeon_device *rdev, struct r100_mc_save *save) 3759void r100_mc_stop(struct radeon_device *rdev, struct r100_mc_save *save)
3778{ 3760{
3779 /* Shutdown CP we shouldn't need to do that but better be safe than 3761 /* Shutdown CP we shouldn't need to do that but better be safe than
@@ -3932,11 +3914,18 @@ static int r100_startup(struct radeon_device *rdev)
3932 dev_err(rdev->dev, "failed initializing CP (%d).\n", r); 3914 dev_err(rdev->dev, "failed initializing CP (%d).\n", r);
3933 return r; 3915 return r;
3934 } 3916 }
3935 r = r100_ib_init(rdev); 3917
3918 r = radeon_ib_pool_start(rdev);
3919 if (r)
3920 return r;
3921
3922 r = r100_ib_test(rdev);
3936 if (r) { 3923 if (r) {
3937 dev_err(rdev->dev, "failed initializing IB (%d).\n", r); 3924 dev_err(rdev->dev, "failed testing IB (%d).\n", r);
3925 rdev->accel_working = false;
3938 return r; 3926 return r;
3939 } 3927 }
3928
3940 return 0; 3929 return 0;
3941} 3930}
3942 3931
@@ -3959,11 +3948,14 @@ int r100_resume(struct radeon_device *rdev)
3959 r100_clock_startup(rdev); 3948 r100_clock_startup(rdev);
3960 /* Initialize surface registers */ 3949 /* Initialize surface registers */
3961 radeon_surface_init(rdev); 3950 radeon_surface_init(rdev);
3951
3952 rdev->accel_working = true;
3962 return r100_startup(rdev); 3953 return r100_startup(rdev);
3963} 3954}
3964 3955
3965int r100_suspend(struct radeon_device *rdev) 3956int r100_suspend(struct radeon_device *rdev)
3966{ 3957{
3958 radeon_ib_pool_suspend(rdev);
3967 r100_cp_disable(rdev); 3959 r100_cp_disable(rdev);
3968 radeon_wb_disable(rdev); 3960 radeon_wb_disable(rdev);
3969 r100_irq_disable(rdev); 3961 r100_irq_disable(rdev);
@@ -4082,7 +4074,14 @@ int r100_init(struct radeon_device *rdev)
4082 return r; 4074 return r;
4083 } 4075 }
4084 r100_set_safe_registers(rdev); 4076 r100_set_safe_registers(rdev);
4077
4078 r = radeon_ib_pool_init(rdev);
4085 rdev->accel_working = true; 4079 rdev->accel_working = true;
4080 if (r) {
4081 dev_err(rdev->dev, "IB initialization failed (%d).\n", r);
4082 rdev->accel_working = false;
4083 }
4084
4086 r = r100_startup(rdev); 4085 r = r100_startup(rdev);
4087 if (r) { 4086 if (r) {
4088 /* Somethings want wront with the accel init stop accel */ 4087 /* Somethings want wront with the accel init stop accel */