diff options
author | Pauli Nieminen <suokkos@gmail.com> | 2010-02-11 12:25:47 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-02-17 23:47:54 -0500 |
commit | 44ca7478d46aaad488d916f7262253e000ee60f9 (patch) | |
tree | 112f20f173526a087f3a9e8c419f0ad1875bd1cb /drivers/gpu/drm/radeon/r200.c | |
parent | d80eeb0f347b6effa06e11e7cbcb2e6c559bf404 (diff) |
drm/radeon: Add asic hook for dma copy to r200 cards.
r200 cards have dma engine which can be used to tranfer data
between vram and system memory.
r300 dma engine registers match r200 dma engine. Enabling
dma copy for r200 is simple as hooking r200 asic to already
existing function r300_copy_dma.
Rename r300_dma_copy to r200_dma_copyto reflect that supports
starts from r200 cards.
v2: Created a new asic object for r200 cards.
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r200.c')
-rw-r--r-- | drivers/gpu/drm/radeon/r200.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c index ff1e0cd608bf..1146c9909c2c 100644 --- a/drivers/gpu/drm/radeon/r200.c +++ b/drivers/gpu/drm/radeon/r200.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "radeon_reg.h" | 31 | #include "radeon_reg.h" |
32 | #include "radeon.h" | 32 | #include "radeon.h" |
33 | 33 | ||
34 | #include "r100d.h" | ||
34 | #include "r200_reg_safe.h" | 35 | #include "r200_reg_safe.h" |
35 | 36 | ||
36 | #include "r100_track.h" | 37 | #include "r100_track.h" |
@@ -79,6 +80,51 @@ static int r200_get_vtx_size_0(uint32_t vtx_fmt_0) | |||
79 | return vtx_size; | 80 | return vtx_size; |
80 | } | 81 | } |
81 | 82 | ||
83 | int r200_copy_dma(struct radeon_device *rdev, | ||
84 | uint64_t src_offset, | ||
85 | uint64_t dst_offset, | ||
86 | unsigned num_pages, | ||
87 | struct radeon_fence *fence) | ||
88 | { | ||
89 | uint32_t size; | ||
90 | uint32_t cur_size; | ||
91 | int i, num_loops; | ||
92 | int r = 0; | ||
93 | |||
94 | /* radeon pitch is /64 */ | ||
95 | size = num_pages << PAGE_SHIFT; | ||
96 | num_loops = DIV_ROUND_UP(size, 0x1FFFFF); | ||
97 | r = radeon_ring_lock(rdev, num_loops * 4 + 64); | ||
98 | if (r) { | ||
99 | DRM_ERROR("radeon: moving bo (%d).\n", r); | ||
100 | return r; | ||
101 | } | ||
102 | /* Must wait for 2D idle & clean before DMA or hangs might happen */ | ||
103 | radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
104 | radeon_ring_write(rdev, (1 << 16)); | ||
105 | for (i = 0; i < num_loops; i++) { | ||
106 | cur_size = size; | ||
107 | if (cur_size > 0x1FFFFF) { | ||
108 | cur_size = 0x1FFFFF; | ||
109 | } | ||
110 | size -= cur_size; | ||
111 | radeon_ring_write(rdev, PACKET0(0x720, 2)); | ||
112 | radeon_ring_write(rdev, src_offset); | ||
113 | radeon_ring_write(rdev, dst_offset); | ||
114 | radeon_ring_write(rdev, cur_size | (1 << 31) | (1 << 30)); | ||
115 | src_offset += cur_size; | ||
116 | dst_offset += cur_size; | ||
117 | } | ||
118 | radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
119 | radeon_ring_write(rdev, RADEON_WAIT_DMA_GUI_IDLE); | ||
120 | if (fence) { | ||
121 | r = radeon_fence_emit(rdev, fence); | ||
122 | } | ||
123 | radeon_ring_unlock_commit(rdev); | ||
124 | return r; | ||
125 | } | ||
126 | |||
127 | |||
82 | static int r200_get_vtx_size_1(uint32_t vtx_fmt_1) | 128 | static int r200_get_vtx_size_1(uint32_t vtx_fmt_1) |
83 | { | 129 | { |
84 | int vtx_size, i, tex_size; | 130 | int vtx_size, i, tex_size; |