2009-06-05 20:42:42 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2008 Advanced Micro Devices, Inc.
|
|
|
|
* Copyright 2008 Red Hat Inc.
|
|
|
|
* Copyright 2009 Jerome Glisse.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors: Dave Airlie
|
|
|
|
* Alex Deucher
|
|
|
|
* Jerome Glisse
|
|
|
|
*/
|
|
|
|
#include "drmP.h"
|
|
|
|
#include "radeon.h"
|
2010-03-12 05:19:17 +08:00
|
|
|
#include "radeon_asic.h"
|
2009-09-29 02:39:19 +08:00
|
|
|
#include "atom.h"
|
|
|
|
#include "r520d.h"
|
2009-06-05 20:42:42 +08:00
|
|
|
|
2009-09-29 02:39:19 +08:00
|
|
|
/* This files gather functions specifics to: r520,rv530,rv560,rv570,r580 */
|
2009-06-05 20:42:42 +08:00
|
|
|
|
2009-09-29 02:39:19 +08:00
|
|
|
static int r520_mc_wait_for_idle(struct radeon_device *rdev)
|
2009-06-05 20:42:42 +08:00
|
|
|
{
|
|
|
|
unsigned i;
|
|
|
|
uint32_t tmp;
|
|
|
|
|
|
|
|
for (i = 0; i < rdev->usec_timeout; i++) {
|
|
|
|
/* read MC_STATUS */
|
|
|
|
tmp = RREG32_MC(R520_MC_STATUS);
|
|
|
|
if (tmp & R520_MC_STATUS_IDLE) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
DRM_UDELAY(1);
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-09-29 02:39:19 +08:00
|
|
|
static void r520_gpu_init(struct radeon_device *rdev)
|
2009-06-05 20:42:42 +08:00
|
|
|
{
|
|
|
|
unsigned pipe_select_current, gb_pipe_select, tmp;
|
|
|
|
|
2009-09-29 00:34:43 +08:00
|
|
|
rv515_vga_render_disable(rdev);
|
2009-06-05 20:42:42 +08:00
|
|
|
/*
|
|
|
|
* DST_PIPE_CONFIG 0x170C
|
|
|
|
* GB_TILE_CONFIG 0x4018
|
|
|
|
* GB_FIFO_SIZE 0x4024
|
|
|
|
* GB_PIPE_SELECT 0x402C
|
|
|
|
* GB_PIPE_SELECT2 0x4124
|
|
|
|
* Z_PIPE_SHIFT 0
|
|
|
|
* Z_PIPE_MASK 0x000000003
|
|
|
|
* GB_FIFO_SIZE2 0x4128
|
|
|
|
* SC_SFIFO_SIZE_SHIFT 0
|
|
|
|
* SC_SFIFO_SIZE_MASK 0x000000003
|
|
|
|
* SC_MFIFO_SIZE_SHIFT 2
|
|
|
|
* SC_MFIFO_SIZE_MASK 0x00000000C
|
|
|
|
* FG_SFIFO_SIZE_SHIFT 4
|
|
|
|
* FG_SFIFO_SIZE_MASK 0x000000030
|
|
|
|
* ZB_MFIFO_SIZE_SHIFT 6
|
|
|
|
* ZB_MFIFO_SIZE_MASK 0x0000000C0
|
|
|
|
* GA_ENHANCE 0x4274
|
|
|
|
* SU_REG_DEST 0x42C8
|
|
|
|
*/
|
|
|
|
/* workaround for RV530 */
|
|
|
|
if (rdev->family == CHIP_RV530) {
|
|
|
|
WREG32(0x4128, 0xFF);
|
|
|
|
}
|
|
|
|
r420_pipes_init(rdev);
|
2011-01-25 12:24:59 +08:00
|
|
|
gb_pipe_select = RREG32(R400_GB_PIPE_SELECT);
|
|
|
|
tmp = RREG32(R300_DST_PIPE_CONFIG);
|
2009-06-05 20:42:42 +08:00
|
|
|
pipe_select_current = (tmp >> 2) & 3;
|
|
|
|
tmp = (1 << pipe_select_current) |
|
|
|
|
(((gb_pipe_select >> 8) & 0xF) << 4);
|
|
|
|
WREG32_PLL(0x000D, tmp);
|
|
|
|
if (r520_mc_wait_for_idle(rdev)) {
|
|
|
|
printk(KERN_WARNING "Failed to wait MC idle while "
|
|
|
|
"programming pipes. Bad things might happen.\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void r520_vram_get_type(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
uint32_t tmp;
|
|
|
|
|
|
|
|
rdev->mc.vram_width = 128;
|
|
|
|
rdev->mc.vram_is_ddr = true;
|
|
|
|
tmp = RREG32_MC(R520_MC_CNTL0);
|
|
|
|
switch ((tmp & R520_MEM_NUM_CHANNELS_MASK) >> R520_MEM_NUM_CHANNELS_SHIFT) {
|
|
|
|
case 0:
|
|
|
|
rdev->mc.vram_width = 32;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
rdev->mc.vram_width = 64;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
rdev->mc.vram_width = 128;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
rdev->mc.vram_width = 256;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
rdev->mc.vram_width = 128;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (tmp & R520_MC_CHANNEL_SIZE)
|
|
|
|
rdev->mc.vram_width *= 2;
|
|
|
|
}
|
|
|
|
|
drm/radeon/kms: simplify memory controller setup V2
Get rid of _location and use _start/_end also simplify the
computation of vram_start|end & gtt_start|end. For R1XX-R2XX
we place VRAM at the same address of PCI aperture, those GPU
shouldn't have much memory and seems to behave better when
setup that way. For R3XX and newer we place VRAM at 0. For
R6XX-R7XX AGP we place VRAM before or after AGP aperture this
might limit to limit the VRAM size but it's very unlikely.
For IGP we don't change the VRAM placement.
Tested on (compiz,quake3,suspend/resume):
PCI/PCIE:RV280,R420,RV515,RV570,RV610,RV710
AGP:RV100,RV280,R420,RV350,RV620(RPB*),RV730
IGP:RS480(RPB*),RS690,RS780(RPB*),RS880
RPB: resume previously broken
V2 correct commit message to reflect more accurately the bug
and move VRAM placement to 0 for most of the GPU to avoid
limiting VRAM.
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-18 05:54:29 +08:00
|
|
|
void r520_mc_init(struct radeon_device *rdev)
|
2009-06-05 20:42:42 +08:00
|
|
|
{
|
2009-07-14 03:04:08 +08:00
|
|
|
|
2009-06-05 20:42:42 +08:00
|
|
|
r520_vram_get_type(rdev);
|
2009-07-11 02:44:47 +08:00
|
|
|
r100_vram_init_sizes(rdev);
|
drm/radeon/kms: simplify memory controller setup V2
Get rid of _location and use _start/_end also simplify the
computation of vram_start|end & gtt_start|end. For R1XX-R2XX
we place VRAM at the same address of PCI aperture, those GPU
shouldn't have much memory and seems to behave better when
setup that way. For R3XX and newer we place VRAM at 0. For
R6XX-R7XX AGP we place VRAM before or after AGP aperture this
might limit to limit the VRAM size but it's very unlikely.
For IGP we don't change the VRAM placement.
Tested on (compiz,quake3,suspend/resume):
PCI/PCIE:RV280,R420,RV515,RV570,RV610,RV710
AGP:RV100,RV280,R420,RV350,RV620(RPB*),RV730
IGP:RS480(RPB*),RS690,RS780(RPB*),RS880
RPB: resume previously broken
V2 correct commit message to reflect more accurately the bug
and move VRAM placement to 0 for most of the GPU to avoid
limiting VRAM.
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-18 05:54:29 +08:00
|
|
|
radeon_vram_location(rdev, &rdev->mc, 0);
|
2010-07-15 22:51:10 +08:00
|
|
|
rdev->mc.gtt_base_align = 0;
|
drm/radeon/kms: simplify memory controller setup V2
Get rid of _location and use _start/_end also simplify the
computation of vram_start|end & gtt_start|end. For R1XX-R2XX
we place VRAM at the same address of PCI aperture, those GPU
shouldn't have much memory and seems to behave better when
setup that way. For R3XX and newer we place VRAM at 0. For
R6XX-R7XX AGP we place VRAM before or after AGP aperture this
might limit to limit the VRAM size but it's very unlikely.
For IGP we don't change the VRAM placement.
Tested on (compiz,quake3,suspend/resume):
PCI/PCIE:RV280,R420,RV515,RV570,RV610,RV710
AGP:RV100,RV280,R420,RV350,RV620(RPB*),RV730
IGP:RS480(RPB*),RS690,RS780(RPB*),RS880
RPB: resume previously broken
V2 correct commit message to reflect more accurately the bug
and move VRAM placement to 0 for most of the GPU to avoid
limiting VRAM.
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-18 05:54:29 +08:00
|
|
|
if (!(rdev->flags & RADEON_IS_AGP))
|
|
|
|
radeon_gtt_location(rdev, &rdev->mc);
|
2010-03-17 08:54:38 +08:00
|
|
|
radeon_update_bandwidth_info(rdev);
|
2009-07-14 03:04:08 +08:00
|
|
|
}
|
|
|
|
|
2009-09-29 02:39:19 +08:00
|
|
|
void r520_mc_program(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
struct rv515_mc_save save;
|
|
|
|
|
|
|
|
/* Stops all mc clients */
|
|
|
|
rv515_mc_stop(rdev, &save);
|
|
|
|
|
|
|
|
/* Wait for mc idle */
|
|
|
|
if (r520_mc_wait_for_idle(rdev))
|
|
|
|
dev_warn(rdev->dev, "Wait MC idle timeout before updating MC.\n");
|
|
|
|
/* Write VRAM size in case we are limiting it */
|
|
|
|
WREG32(R_0000F8_CONFIG_MEMSIZE, rdev->mc.real_vram_size);
|
|
|
|
/* Program MC, should be a 32bits limited address space */
|
|
|
|
WREG32_MC(R_000004_MC_FB_LOCATION,
|
|
|
|
S_000004_MC_FB_START(rdev->mc.vram_start >> 16) |
|
|
|
|
S_000004_MC_FB_TOP(rdev->mc.vram_end >> 16));
|
|
|
|
WREG32(R_000134_HDP_FB_LOCATION,
|
|
|
|
S_000134_HDP_FB_START(rdev->mc.vram_start >> 16));
|
|
|
|
if (rdev->flags & RADEON_IS_AGP) {
|
|
|
|
WREG32_MC(R_000005_MC_AGP_LOCATION,
|
|
|
|
S_000005_MC_AGP_START(rdev->mc.gtt_start >> 16) |
|
|
|
|
S_000005_MC_AGP_TOP(rdev->mc.gtt_end >> 16));
|
|
|
|
WREG32_MC(R_000006_AGP_BASE, lower_32_bits(rdev->mc.agp_base));
|
|
|
|
WREG32_MC(R_000007_AGP_BASE_2,
|
|
|
|
S_000007_AGP_BASE_ADDR_2(upper_32_bits(rdev->mc.agp_base)));
|
|
|
|
} else {
|
|
|
|
WREG32_MC(R_000005_MC_AGP_LOCATION, 0xFFFFFFFF);
|
|
|
|
WREG32_MC(R_000006_AGP_BASE, 0);
|
|
|
|
WREG32_MC(R_000007_AGP_BASE_2, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
rv515_mc_resume(rdev, &save);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int r520_startup(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
int r;
|
|
|
|
|
|
|
|
r520_mc_program(rdev);
|
|
|
|
/* Resume clock */
|
|
|
|
rv515_clock_startup(rdev);
|
|
|
|
/* Initialize GPU configuration (# pipes, ...) */
|
|
|
|
r520_gpu_init(rdev);
|
|
|
|
/* Initialize GART (initialize after TTM so we can allocate
|
|
|
|
* memory through TTM but finalize after TTM) */
|
|
|
|
if (rdev->flags & RADEON_IS_PCIE) {
|
|
|
|
r = rv370_pcie_gart_enable(rdev);
|
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
}
|
2010-08-28 06:25:25 +08:00
|
|
|
|
|
|
|
/* allocate wb buffer */
|
|
|
|
r = radeon_wb_init(rdev);
|
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
|
2011-11-21 04:45:34 +08:00
|
|
|
r = radeon_fence_driver_start_ring(rdev, RADEON_RING_TYPE_GFX_INDEX);
|
|
|
|
if (r) {
|
|
|
|
dev_err(rdev->dev, "failed initializing CP fences (%d).\n", r);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-09-29 02:39:19 +08:00
|
|
|
/* Enable IRQ */
|
2009-10-01 04:18:43 +08:00
|
|
|
rs600_irq_set(rdev);
|
2010-01-07 19:39:21 +08:00
|
|
|
rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL);
|
2009-09-29 02:39:19 +08:00
|
|
|
/* 1M ring buffer */
|
|
|
|
r = r100_cp_init(rdev, 1024 * 1024);
|
|
|
|
if (r) {
|
2011-01-29 06:32:04 +08:00
|
|
|
dev_err(rdev->dev, "failed initializing CP (%d).\n", r);
|
2009-09-29 02:39:19 +08:00
|
|
|
return r;
|
|
|
|
}
|
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>
2011-11-16 00:48:34 +08:00
|
|
|
|
|
|
|
r = radeon_ib_pool_start(rdev);
|
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
|
|
|
|
r = r100_ib_test(rdev);
|
2009-09-29 02:39:19 +08:00
|
|
|
if (r) {
|
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>
2011-11-16 00:48:34 +08:00
|
|
|
dev_err(rdev->dev, "failed testing IB (%d).\n", r);
|
|
|
|
rdev->accel_working = false;
|
2009-09-29 02:39:19 +08:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int r520_resume(struct radeon_device *rdev)
|
2009-07-14 03:04:08 +08:00
|
|
|
{
|
2009-09-29 02:39:19 +08:00
|
|
|
/* Make sur GART are not working */
|
|
|
|
if (rdev->flags & RADEON_IS_PCIE)
|
|
|
|
rv370_pcie_gart_disable(rdev);
|
|
|
|
/* Resume clock before doing reset */
|
|
|
|
rv515_clock_startup(rdev);
|
|
|
|
/* Reset gpu before posting otherwise ATOM will enter infinite loop */
|
2010-03-09 22:45:11 +08:00
|
|
|
if (radeon_asic_reset(rdev)) {
|
2009-09-29 02:39:19 +08:00
|
|
|
dev_warn(rdev->dev, "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n",
|
|
|
|
RREG32(R_000E40_RBBM_STATUS),
|
|
|
|
RREG32(R_0007C0_CP_STAT));
|
|
|
|
}
|
|
|
|
/* post */
|
|
|
|
atom_asic_init(rdev->mode_info.atom_context);
|
|
|
|
/* Resume clock after posting */
|
|
|
|
rv515_clock_startup(rdev);
|
2009-12-09 12:15:38 +08:00
|
|
|
/* Initialize surface registers */
|
|
|
|
radeon_surface_init(rdev);
|
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>
2011-11-16 00:48:34 +08:00
|
|
|
|
|
|
|
rdev->accel_working = true;
|
2009-09-29 02:39:19 +08:00
|
|
|
return r520_startup(rdev);
|
2009-06-05 20:42:42 +08:00
|
|
|
}
|
2009-09-29 00:34:43 +08:00
|
|
|
|
|
|
|
int r520_init(struct radeon_device *rdev)
|
|
|
|
{
|
2009-09-29 02:39:19 +08:00
|
|
|
int r;
|
|
|
|
|
|
|
|
/* Initialize scratch registers */
|
|
|
|
radeon_scratch_init(rdev);
|
|
|
|
/* Initialize surface registers */
|
|
|
|
radeon_surface_init(rdev);
|
2010-07-15 10:13:50 +08:00
|
|
|
/* restore some register to sane defaults */
|
|
|
|
r100_restore_sanity(rdev);
|
2009-09-29 02:39:19 +08:00
|
|
|
/* TODO: disable VGA need to use VGA request */
|
|
|
|
/* BIOS*/
|
|
|
|
if (!radeon_get_bios(rdev)) {
|
|
|
|
if (ASIC_IS_AVIVO(rdev))
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
if (rdev->is_atom_bios) {
|
|
|
|
r = radeon_atombios_init(rdev);
|
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
} else {
|
|
|
|
dev_err(rdev->dev, "Expecting atombios for RV515 GPU\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
/* Reset gpu before posting otherwise ATOM will enter infinite loop */
|
2010-03-09 22:45:11 +08:00
|
|
|
if (radeon_asic_reset(rdev)) {
|
2009-09-29 02:39:19 +08:00
|
|
|
dev_warn(rdev->dev,
|
|
|
|
"GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n",
|
|
|
|
RREG32(R_000E40_RBBM_STATUS),
|
|
|
|
RREG32(R_0007C0_CP_STAT));
|
|
|
|
}
|
|
|
|
/* check if cards are posted or not */
|
2009-12-01 12:06:31 +08:00
|
|
|
if (radeon_boot_test_post_card(rdev) == false)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2009-09-29 02:39:19 +08:00
|
|
|
if (!radeon_card_posted(rdev) && rdev->bios) {
|
|
|
|
DRM_INFO("GPU not posted. posting now...\n");
|
|
|
|
atom_asic_init(rdev->mode_info.atom_context);
|
|
|
|
}
|
|
|
|
/* Initialize clocks */
|
|
|
|
radeon_get_clock_info(rdev->ddev);
|
drm/radeon/kms: simplify memory controller setup V2
Get rid of _location and use _start/_end also simplify the
computation of vram_start|end & gtt_start|end. For R1XX-R2XX
we place VRAM at the same address of PCI aperture, those GPU
shouldn't have much memory and seems to behave better when
setup that way. For R3XX and newer we place VRAM at 0. For
R6XX-R7XX AGP we place VRAM before or after AGP aperture this
might limit to limit the VRAM size but it's very unlikely.
For IGP we don't change the VRAM placement.
Tested on (compiz,quake3,suspend/resume):
PCI/PCIE:RV280,R420,RV515,RV570,RV610,RV710
AGP:RV100,RV280,R420,RV350,RV620(RPB*),RV730
IGP:RS480(RPB*),RS690,RS780(RPB*),RS880
RPB: resume previously broken
V2 correct commit message to reflect more accurately the bug
and move VRAM placement to 0 for most of the GPU to avoid
limiting VRAM.
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-18 05:54:29 +08:00
|
|
|
/* initialize AGP */
|
|
|
|
if (rdev->flags & RADEON_IS_AGP) {
|
|
|
|
r = radeon_agp_init(rdev);
|
|
|
|
if (r) {
|
|
|
|
radeon_agp_disable(rdev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* initialize memory controller */
|
|
|
|
r520_mc_init(rdev);
|
2009-09-29 02:39:19 +08:00
|
|
|
rv515_debugfs(rdev);
|
|
|
|
/* Fence driver */
|
2011-11-21 04:45:34 +08:00
|
|
|
r = radeon_fence_driver_init(rdev);
|
2009-09-29 02:39:19 +08:00
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
r = radeon_irq_kms_init(rdev);
|
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
/* Memory manager */
|
2009-11-20 21:29:23 +08:00
|
|
|
r = radeon_bo_init(rdev);
|
2009-09-29 02:39:19 +08:00
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
r = rv370_pcie_gart_init(rdev);
|
|
|
|
if (r)
|
|
|
|
return r;
|
2009-09-29 00:34:43 +08:00
|
|
|
rv515_set_safe_registers(rdev);
|
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>
2011-11-16 00:48:34 +08:00
|
|
|
|
|
|
|
r = radeon_ib_pool_init(rdev);
|
2009-09-29 02:39:19 +08:00
|
|
|
rdev->accel_working = true;
|
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>
2011-11-16 00:48:34 +08:00
|
|
|
if (r) {
|
|
|
|
dev_err(rdev->dev, "IB initialization failed (%d).\n", r);
|
|
|
|
rdev->accel_working = false;
|
|
|
|
}
|
|
|
|
|
2009-09-29 02:39:19 +08:00
|
|
|
r = r520_startup(rdev);
|
|
|
|
if (r) {
|
|
|
|
/* Somethings want wront with the accel init stop accel */
|
|
|
|
dev_err(rdev->dev, "Disabling GPU acceleration\n");
|
|
|
|
r100_cp_fini(rdev);
|
2010-08-28 06:25:25 +08:00
|
|
|
radeon_wb_fini(rdev);
|
2009-09-29 02:39:19 +08:00
|
|
|
r100_ib_fini(rdev);
|
2010-02-02 18:51:45 +08:00
|
|
|
radeon_irq_kms_fini(rdev);
|
2009-09-29 02:39:19 +08:00
|
|
|
rv370_pcie_gart_fini(rdev);
|
|
|
|
radeon_agp_fini(rdev);
|
|
|
|
rdev->accel_working = false;
|
|
|
|
}
|
2009-09-29 00:34:43 +08:00
|
|
|
return 0;
|
|
|
|
}
|