Rev 1221 | Rev 1233 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1221 | Rev 1230 | ||
---|---|---|---|
Line 32... | Line 32... | ||
32 | struct list_head list; |
32 | struct list_head list; |
33 | struct radeon_object *robj; |
33 | struct radeon_object *robj; |
34 | }cursor_t; |
34 | }cursor_t; |
Line -... | Line 35... | ||
- | 35 | ||
- | 36 | int init_cursor(cursor_t *cursor); |
|
- | 37 | cursor_t* __stdcall select_cursor(cursor_t *cursor); |
|
- | 38 | void __stdcall move_cursor(cursor_t *cursor, int x, int y); |
|
- | 39 | void __stdcall restore_cursor(int x, int y); |
|
35 | 40 | ||
36 | struct tag_display |
41 | struct tag_display |
37 | { |
42 | { |
38 | int x; |
43 | int x; |
39 | int y; |
44 | int y; |
Line 50... | Line 55... | ||
50 | struct list_head cursors; |
55 | struct list_head cursors; |
Line 51... | Line 56... | ||
51 | 56 | ||
52 | cursor_t *cursor; |
57 | cursor_t *cursor; |
53 | int (*init_cursor)(cursor_t*); |
58 | int (*init_cursor)(cursor_t*); |
54 | cursor_t* (*select_cursor)(display_t*, cursor_t*); |
59 | cursor_t* (__stdcall *select_cursor)(cursor_t*); |
- | 60 | void (*show_cursor)(int show); |
|
55 | void (*show_cursor)(int show); |
61 | void (__stdcall *move_cursor)(cursor_t *cursor, int x, int y); |
- | 62 | void (__stdcall *restore_cursor)(int x, int y); |
|
56 | void (*move_cursor)(int x, int y); |
63 | |
Line 57... | Line 64... | ||
57 | }; |
64 | }; |
- | 65 | ||
- | 66 | ||
- | 67 | static display_t *rdisplay; |
|
- | 68 | ||
- | 69 | ||
- | 70 | void set_crtc(struct drm_crtc *crtc) |
|
- | 71 | { |
|
- | 72 | ENTER(); |
|
Line 58... | Line 73... | ||
58 | 73 | rdisplay->crtc = crtc; |
|
59 | 74 | LEAVE(); |
|
60 | display_t *rdisplay; |
75 | } |
Line 92... | Line 107... | ||
92 | for(i = 0; i < 32; i++) |
107 | for(i = 0; i < 32; i++) |
93 | { |
108 | { |
94 | for(j = 0; j < 32; j++) |
109 | for(j = 0; j < 32; j++) |
95 | *bits++ = *src++; |
110 | *bits++ = *src++; |
96 | for(j = 0; j < CURSOR_WIDTH-32; j++) |
111 | for(j = 32; j < CURSOR_WIDTH; j++) |
97 | *bits++ = 0; |
112 | *bits++ = 0; |
98 | } |
113 | } |
99 | for(i = 0; i < CURSOR_WIDTH*(CURSOR_HEIGHT-32); i++) |
114 | for(i = 0; i < CURSOR_WIDTH*(CURSOR_HEIGHT-32); i++) |
100 | *bits++ = 0; |
115 | *bits++ = 0; |
Line 101... | Line 116... | ||
101 | 116 | ||
Line 102... | Line 117... | ||
102 | radeon_object_kunmap(cursor->robj); |
117 | radeon_object_kunmap(cursor->robj); |
103 | 118 | ||
Line -... | Line 119... | ||
- | 119 | return 0; |
|
- | 120 | }; |
|
- | 121 | ||
- | 122 | static void radeon_show_cursor(struct drm_crtc *crtc) |
|
- | 123 | { |
|
- | 124 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
|
- | 125 | struct radeon_device *rdev = crtc->dev->dev_private; |
|
- | 126 | ||
- | 127 | if (ASIC_IS_AVIVO(rdev)) { |
|
- | 128 | WREG32(RADEON_MM_INDEX, AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset); |
|
- | 129 | WREG32(RADEON_MM_DATA, AVIVO_D1CURSOR_EN | |
|
- | 130 | (AVIVO_D1CURSOR_MODE_24BPP << AVIVO_D1CURSOR_MODE_SHIFT)); |
|
- | 131 | } else { |
|
- | 132 | switch (radeon_crtc->crtc_id) { |
|
- | 133 | case 0: |
|
- | 134 | WREG32(RADEON_MM_INDEX, RADEON_CRTC_GEN_CNTL); |
|
- | 135 | break; |
|
- | 136 | case 1: |
|
- | 137 | WREG32(RADEON_MM_INDEX, RADEON_CRTC2_GEN_CNTL); |
|
- | 138 | break; |
|
- | 139 | default: |
|
- | 140 | return; |
|
- | 141 | } |
|
- | 142 | ||
- | 143 | WREG32_P(RADEON_MM_DATA, (RADEON_CRTC_CUR_EN | |
|
- | 144 | (RADEON_CRTC_CUR_MODE_24BPP << RADEON_CRTC_CUR_MODE_SHIFT)), |
|
- | 145 | ~(RADEON_CRTC_CUR_EN | RADEON_CRTC_CUR_MODE_MASK)); |
|
104 | return 0; |
146 | } |
105 | }; |
147 | } |
106 | 148 | ||
Line -... | Line 149... | ||
- | 149 | int pre_init_display(struct radeon_device *rdev) |
|
- | 150 | { |
|
107 | int init_display(struct radeon_device *rdev) |
151 | cursor_t *cursor; |
Line 108... | Line 152... | ||
108 | { |
152 | |
Line 109... | Line 153... | ||
109 | cursor_t *cursor; |
153 | ENTER(); |
110 | 154 | ||
111 | // rdisplay = get_display(); |
155 | rdisplay = GetDisplay(); |
112 | 156 | ||
- | 157 | rdisplay->ddev = rdev->ddev; |
|
- | 158 | ||
- | 159 | list_for_each_entry(cursor, &rdisplay->cursors, list) |
|
- | 160 | { |
|
- | 161 | init_cursor(cursor); |
|
- | 162 | }; |
|
- | 163 | ||
- | 164 | LEAVE(); |
|
- | 165 | ||
- | 166 | return 1; |
|
- | 167 | }; |
|
- | 168 | ||
- | 169 | int post_init_display(struct radeon_device *rdev) |
|
- | 170 | { |
|
- | 171 | cursor_t *cursor; |
|
- | 172 | ||
- | 173 | ENTER(); |
|
- | 174 | ||
- | 175 | select_cursor(rdisplay->cursor); |
|
- | 176 | ||
- | 177 | radeon_show_cursor(rdisplay->crtc); |
|
- | 178 | ||
- | 179 | rdisplay->init_cursor = init_cursor; |
|
- | 180 | rdisplay->select_cursor = select_cursor; |
|
113 | rdisplay->ddev = rdev->ddev; |
181 | rdisplay->show_cursor = NULL; |
114 | 182 | rdisplay->move_cursor = move_cursor; |
|
Line 115... | Line 183... | ||
115 | list_for_each_entry(cursor, &rdisplay->cursors, list) |
183 | rdisplay->restore_cursor = restore_cursor; |
116 | { |
184 | |
Line 141... | Line 209... | ||
141 | WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, cur_lock); |
209 | WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, cur_lock); |
142 | } |
210 | } |
143 | } |
211 | } |
144 | 212 | ||
Line 145... | Line 213... | ||
145 | cursor_t* select_cursor(display_t *display, cursor_t *cursor) |
213 | cursor_t* __stdcall select_cursor(cursor_t *cursor) |
146 | { |
214 | { |
147 | struct radeon_device *rdev; |
215 | struct radeon_device *rdev; |
148 | struct radeon_crtc *radeon_crtc; |
216 | struct radeon_crtc *radeon_crtc; |
149 | cursor_t *old; |
217 | cursor_t *old; |
150 | uint32_t gpu_addr; |
218 | uint32_t gpu_addr; |
Line 151... | Line 219... | ||
151 | 219 | ||
152 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
220 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
Line 153... | Line 221... | ||
153 | radeon_crtc = to_radeon_crtc(rdisplay->crtc); |
221 | radeon_crtc = to_radeon_crtc(rdisplay->crtc); |
Line 154... | Line 222... | ||
154 | 222 | ||
155 | old = display->cursor; |
223 | old = rdisplay->cursor; |
Line 156... | Line 224... | ||
156 | 224 | ||
157 | display->cursor = cursor; |
225 | rdisplay->cursor = cursor; |
158 | gpu_addr = cursor->robj->gpu_addr; |
226 | gpu_addr = cursor->robj->gpu_addr; |
159 | 227 | ||
160 | if (ASIC_IS_AVIVO(rdev)) |
228 | if (ASIC_IS_AVIVO(rdev)) |
161 | WREG32(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, gpu_addr); |
229 | WREG32(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, gpu_addr); |
162 | else { |
230 | else { |
- | 231 | radeon_crtc->legacy_cursor_offset = gpu_addr - radeon_crtc->legacy_display_base_addr; |
|
163 | radeon_crtc->legacy_cursor_offset = gpu_addr - radeon_crtc->legacy_display_base_addr; |
232 | /* offset is from DISP(2)_BASE_ADDRESS */ |
164 | /* offset is from DISP(2)_BASE_ADDRESS */ |
233 | WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, radeon_crtc->legacy_cursor_offset); |
Line 165... | Line 234... | ||
165 | WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, radeon_crtc->legacy_cursor_offset); |
234 | } |
166 | } |
235 | |
- | 236 | return old; |
|
- | 237 | }; |
|
167 | return old; |
238 | |
168 | }; |
239 | |
169 | - | ||
Line 170... | Line 240... | ||
170 | 240 | void __stdcall move_cursor(cursor_t *cursor, int x, int y) |
|
171 | int radeon_cursor_move(display_t *display, int x, int y) |
241 | { |
Line 172... | Line 242... | ||
172 | { |
242 | struct radeon_device *rdev; |
173 | struct drm_crtc *crtc = rdisplay->crtc; |
243 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
174 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
244 | struct drm_crtc *crtc = rdisplay->crtc; |
175 | struct radeon_device *rdev = crtc->dev->dev_private; |
245 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
176 | 246 | ||
177 | int hot_x = rdisplay->cursor->hot_x - 1; |
247 | int hot_x = cursor->hot_x; |
Line 178... | Line 248... | ||
178 | int hot_y = rdisplay->cursor->hot_y - 1; |
248 | int hot_y = cursor->hot_y; |
179 | 249 | ||
180 | radeon_lock_cursor(crtc, true); |
250 | radeon_lock_cursor(crtc, true); |
Line 181... | Line 251... | ||
181 | if (ASIC_IS_AVIVO(rdev)) |
251 | if (ASIC_IS_AVIVO(rdev)) |
182 | { |
252 | { |
183 | int w = 32; |
253 | int w = 32; |
184 | int i = 0; |
254 | int i = 0; |
Line 213... | Line 283... | ||
213 | if (w <= 0) |
283 | if (w <= 0) |
214 | w = 1; |
284 | w = 1; |
215 | } |
285 | } |
216 | #endif |
286 | #endif |
217 | 287 | WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset, |
|
218 | WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset, |
- | |
219 | (x << 16) | y); |
288 | (x << 16) | y); |
220 | WREG32(AVIVO_D1CUR_HOT_SPOT + radeon_crtc->crtc_offset, |
289 | WREG32(AVIVO_D1CUR_HOT_SPOT + radeon_crtc->crtc_offset, |
221 | (hot_x << 16) | hot_y-1); |
290 | (hot_x << 16) | hot_y); |
222 | WREG32(AVIVO_D1CUR_SIZE + radeon_crtc->crtc_offset, |
291 | WREG32(AVIVO_D1CUR_SIZE + radeon_crtc->crtc_offset, |
223 | ((w - 1) << 16) | 31); |
292 | ((w - 1) << 16) | 31); |
224 | } else { |
293 | } else { |
225 | if (crtc->mode.flags & DRM_MODE_FLAG_DBLSCAN) |
294 | if (crtc->mode.flags & DRM_MODE_FLAG_DBLSCAN) |
226 | y *= 2; |
295 | y *= 2; |
227 | 296 | ||
Line 234... | Line 303... | ||
234 | WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, |
303 | WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, |
235 | (radeon_crtc->legacy_cursor_offset + (hot_y * 256))); |
304 | (radeon_crtc->legacy_cursor_offset + (hot_y * 256))); |
236 | } |
305 | } |
237 | radeon_lock_cursor(crtc, false); |
306 | radeon_lock_cursor(crtc, false); |
238 | 307 | } |
|
239 | return 0; |
- | |
240 | }><>><>><>><>><>><>=>>>>> |
- | |
241 | 308 | ||
Line -... | Line 309... | ||
- | 309 | void __stdcall restore_cursor(int x, int y) |
|
- | 310 | { |
|
- | 311 | };><>><>><>><>><>><>=>><>><>>>>> |