Rev 3764 | Rev 5271 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3764 | Rev 5078 | ||
---|---|---|---|
Line 160... | Line 160... | ||
160 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); |
160 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); |
161 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
161 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
162 | base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); |
162 | base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); |
163 | base = G_000100_MC_FB_START(base) << 16; |
163 | base = G_000100_MC_FB_START(base) << 16; |
164 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); |
164 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); |
- | 165 | /* Some boards seem to be configured for 128MB of sideport memory, |
|
- | 166 | * but really only have 64MB. Just skip the sideport and use |
|
- | 167 | * UMA memory. |
|
- | 168 | */ |
|
- | 169 | if (rdev->mc.igp_sideport_enabled && |
|
- | 170 | (rdev->mc.real_vram_size == (384 * 1024 * 1024))) { |
|
- | 171 | base += 128 * 1024 * 1024; |
|
- | 172 | rdev->mc.real_vram_size -= 128 * 1024 * 1024; |
|
- | 173 | rdev->mc.mc_vram_size = rdev->mc.real_vram_size; |
|
- | 174 | } |
|
Line 165... | Line 175... | ||
165 | 175 | ||
166 | /* Use K8 direct mapping for fast fb access. */ |
176 | /* Use K8 direct mapping for fast fb access. */ |
167 | rdev->fastfb_working = false; |
177 | rdev->fastfb_working = false; |
168 | h_addr = G_00005F_K8_ADDR_EXT(RREG32_MC(R_00005F_MC_MISC_UMA_CNTL)); |
178 | h_addr = G_00005F_K8_ADDR_EXT(RREG32_MC(R_00005F_MC_MISC_UMA_CNTL)); |
Line 247... | Line 257... | ||
247 | fixed20_12 sclk; |
257 | fixed20_12 sclk; |
248 | }; |
258 | }; |
Line 249... | Line 259... | ||
249 | 259 | ||
250 | static void rs690_crtc_bandwidth_compute(struct radeon_device *rdev, |
260 | static void rs690_crtc_bandwidth_compute(struct radeon_device *rdev, |
251 | struct radeon_crtc *crtc, |
261 | struct radeon_crtc *crtc, |
- | 262 | struct rs690_watermark *wm, |
|
252 | struct rs690_watermark *wm) |
263 | bool low) |
253 | { |
264 | { |
254 | struct drm_display_mode *mode = &crtc->base.mode; |
265 | struct drm_display_mode *mode = &crtc->base.mode; |
255 | fixed20_12 a, b, c; |
266 | fixed20_12 a, b, c; |
256 | fixed20_12 pclk, request_fifo_depth, tolerable_latency, estimated_width; |
267 | fixed20_12 pclk, request_fifo_depth, tolerable_latency, estimated_width; |
- | 268 | fixed20_12 consumption_time, line_time, chunk_time, read_delay_latency; |
|
- | 269 | fixed20_12 sclk, core_bandwidth, max_bandwidth; |
|
Line 257... | Line 270... | ||
257 | fixed20_12 consumption_time, line_time, chunk_time, read_delay_latency; |
270 | u32 selected_sclk; |
258 | 271 | ||
259 | if (!crtc->base.enabled) { |
272 | if (!crtc->base.enabled) { |
260 | /* FIXME: wouldn't it better to set priority mark to maximum */ |
273 | /* FIXME: wouldn't it better to set priority mark to maximum */ |
261 | wm->lb_request_fifo_depth = 4; |
274 | wm->lb_request_fifo_depth = 4; |
Line -... | Line 275... | ||
- | 275 | return; |
|
- | 276 | } |
|
- | 277 | ||
- | 278 | if (((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880)) && |
|
- | 279 | (rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) |
|
- | 280 | selected_sclk = radeon_dpm_get_sclk(rdev, low); |
|
- | 281 | else |
|
- | 282 | selected_sclk = rdev->pm.current_sclk; |
|
- | 283 | ||
- | 284 | /* sclk in Mhz */ |
|
- | 285 | a.full = dfixed_const(100); |
|
- | 286 | sclk.full = dfixed_const(selected_sclk); |
|
- | 287 | sclk.full = dfixed_div(sclk, a); |
|
- | 288 | ||
- | 289 | /* core_bandwidth = sclk(Mhz) * 16 */ |
|
262 | return; |
290 | a.full = dfixed_const(16); |
263 | } |
291 | core_bandwidth.full = dfixed_div(rdev->pm.sclk, a); |
264 | 292 | ||
265 | if (crtc->vsc.full > dfixed_const(2)) |
293 | if (crtc->vsc.full > dfixed_const(2)) |
Line 320... | Line 348... | ||
320 | b.full = dfixed_const(crtc->base.mode.crtc_hdisplay); |
348 | b.full = dfixed_const(crtc->base.mode.crtc_hdisplay); |
321 | wm->active_time.full = dfixed_mul(line_time, b); |
349 | wm->active_time.full = dfixed_mul(line_time, b); |
322 | wm->active_time.full = dfixed_div(wm->active_time, a); |
350 | wm->active_time.full = dfixed_div(wm->active_time, a); |
Line 323... | Line 351... | ||
323 | 351 | ||
324 | /* Maximun bandwidth is the minimun bandwidth of all component */ |
352 | /* Maximun bandwidth is the minimun bandwidth of all component */ |
325 | rdev->pm.max_bandwidth = rdev->pm.core_bandwidth; |
353 | max_bandwidth = core_bandwidth; |
326 | if (rdev->mc.igp_sideport_enabled) { |
354 | if (rdev->mc.igp_sideport_enabled) { |
327 | if (rdev->pm.max_bandwidth.full > rdev->pm.sideport_bandwidth.full && |
355 | if (max_bandwidth.full > rdev->pm.sideport_bandwidth.full && |
328 | rdev->pm.sideport_bandwidth.full) |
356 | rdev->pm.sideport_bandwidth.full) |
329 | rdev->pm.max_bandwidth = rdev->pm.sideport_bandwidth; |
357 | max_bandwidth = rdev->pm.sideport_bandwidth; |
- | 358 | read_delay_latency.full = dfixed_const(370 * 800); |
|
- | 359 | a.full = dfixed_const(1000); |
|
330 | read_delay_latency.full = dfixed_const(370 * 800 * 1000); |
360 | b.full = dfixed_div(rdev->pm.igp_sideport_mclk, a); |
331 | read_delay_latency.full = dfixed_div(read_delay_latency, |
361 | read_delay_latency.full = dfixed_div(read_delay_latency, b); |
332 | rdev->pm.igp_sideport_mclk); |
362 | read_delay_latency.full = dfixed_mul(read_delay_latency, a); |
333 | } else { |
363 | } else { |
334 | if (rdev->pm.max_bandwidth.full > rdev->pm.k8_bandwidth.full && |
364 | if (max_bandwidth.full > rdev->pm.k8_bandwidth.full && |
335 | rdev->pm.k8_bandwidth.full) |
365 | rdev->pm.k8_bandwidth.full) |
336 | rdev->pm.max_bandwidth = rdev->pm.k8_bandwidth; |
366 | max_bandwidth = rdev->pm.k8_bandwidth; |
337 | if (rdev->pm.max_bandwidth.full > rdev->pm.ht_bandwidth.full && |
367 | if (max_bandwidth.full > rdev->pm.ht_bandwidth.full && |
338 | rdev->pm.ht_bandwidth.full) |
368 | rdev->pm.ht_bandwidth.full) |
339 | rdev->pm.max_bandwidth = rdev->pm.ht_bandwidth; |
369 | max_bandwidth = rdev->pm.ht_bandwidth; |
340 | read_delay_latency.full = dfixed_const(5000); |
370 | read_delay_latency.full = dfixed_const(5000); |
Line 341... | Line 371... | ||
341 | } |
371 | } |
342 | 372 | ||
343 | /* sclk = system clocks(ns) = 1000 / max_bandwidth / 16 */ |
373 | /* sclk = system clocks(ns) = 1000 / max_bandwidth / 16 */ |
344 | a.full = dfixed_const(16); |
374 | a.full = dfixed_const(16); |
345 | rdev->pm.sclk.full = dfixed_mul(rdev->pm.max_bandwidth, a); |
375 | sclk.full = dfixed_mul(max_bandwidth, a); |
346 | a.full = dfixed_const(1000); |
376 | a.full = dfixed_const(1000); |
347 | rdev->pm.sclk.full = dfixed_div(a, rdev->pm.sclk); |
377 | sclk.full = dfixed_div(a, sclk); |
348 | /* Determine chunk time |
378 | /* Determine chunk time |
349 | * ChunkTime = the time it takes the DCP to send one chunk of data |
379 | * ChunkTime = the time it takes the DCP to send one chunk of data |
350 | * to the LB which consists of pipeline delay and inter chunk gap |
380 | * to the LB which consists of pipeline delay and inter chunk gap |
351 | * sclk = system clock(ns) |
381 | * sclk = system clock(ns) |
352 | */ |
382 | */ |
353 | a.full = dfixed_const(256 * 13); |
383 | a.full = dfixed_const(256 * 13); |
354 | chunk_time.full = dfixed_mul(rdev->pm.sclk, a); |
384 | chunk_time.full = dfixed_mul(sclk, a); |
Line 355... | Line 385... | ||
355 | a.full = dfixed_const(10); |
385 | a.full = dfixed_const(10); |
356 | chunk_time.full = dfixed_div(chunk_time, a); |
386 | chunk_time.full = dfixed_div(chunk_time, a); |
Line 413... | Line 443... | ||
413 | wm->priority_mark.full = dfixed_ceil(wm->priority_mark); |
443 | wm->priority_mark.full = dfixed_ceil(wm->priority_mark); |
414 | wm->priority_mark.full = wm->priority_mark_max.full - wm->priority_mark.full; |
444 | wm->priority_mark.full = wm->priority_mark_max.full - wm->priority_mark.full; |
415 | } |
445 | } |
416 | } |
446 | } |
Line 417... | Line 447... | ||
417 | 447 | ||
- | 448 | static void rs690_compute_mode_priority(struct radeon_device *rdev, |
|
- | 449 | struct rs690_watermark *wm0, |
|
- | 450 | struct rs690_watermark *wm1, |
|
- | 451 | struct drm_display_mode *mode0, |
|
- | 452 | struct drm_display_mode *mode1, |
|
- | 453 | u32 *d1mode_priority_a_cnt, |
|
418 | void rs690_bandwidth_update(struct radeon_device *rdev) |
454 | u32 *d2mode_priority_a_cnt) |
419 | { |
- | |
420 | struct drm_display_mode *mode0 = NULL; |
- | |
421 | struct drm_display_mode *mode1 = NULL; |
- | |
422 | struct rs690_watermark wm0; |
- | |
423 | struct rs690_watermark wm1; |
- | |
424 | u32 tmp; |
- | |
425 | u32 d1mode_priority_a_cnt = S_006548_D1MODE_PRIORITY_A_OFF(1); |
- | |
426 | u32 d2mode_priority_a_cnt = S_006548_D1MODE_PRIORITY_A_OFF(1); |
455 | { |
427 | fixed20_12 priority_mark02, priority_mark12, fill_rate; |
456 | fixed20_12 priority_mark02, priority_mark12, fill_rate; |
Line 428... | Line -... | ||
428 | fixed20_12 a, b; |
- | |
429 | - | ||
430 | radeon_update_display_priority(rdev); |
- | |
431 | - | ||
432 | if (rdev->mode_info.crtcs[0]->base.enabled) |
- | |
433 | mode0 = &rdev->mode_info.crtcs[0]->base.mode; |
- | |
434 | if (rdev->mode_info.crtcs[1]->base.enabled) |
- | |
435 | mode1 = &rdev->mode_info.crtcs[1]->base.mode; |
- | |
436 | /* |
- | |
437 | * Set display0/1 priority up in the memory controller for |
- | |
438 | * modes if the user specifies HIGH for displaypriority |
- | |
439 | * option. |
- | |
440 | */ |
- | |
441 | if ((rdev->disp_priority == 2) && |
- | |
442 | ((rdev->family == CHIP_RS690) || (rdev->family == CHIP_RS740))) { |
- | |
443 | tmp = RREG32_MC(R_000104_MC_INIT_MISC_LAT_TIMER); |
- | |
444 | tmp &= C_000104_MC_DISP0R_INIT_LAT; |
- | |
445 | tmp &= C_000104_MC_DISP1R_INIT_LAT; |
457 | fixed20_12 a, b; |
446 | if (mode0) |
- | |
447 | tmp |= S_000104_MC_DISP0R_INIT_LAT(1); |
458 | |
448 | if (mode1) |
- | |
449 | tmp |= S_000104_MC_DISP1R_INIT_LAT(1); |
- | |
450 | WREG32_MC(R_000104_MC_INIT_MISC_LAT_TIMER, tmp); |
- | |
451 | } |
- | |
452 | rs690_line_buffer_adjust(rdev, mode0, mode1); |
- | |
453 | - | ||
454 | if ((rdev->family == CHIP_RS690) || (rdev->family == CHIP_RS740)) |
- | |
455 | WREG32(R_006C9C_DCP_CONTROL, 0); |
- | |
456 | if ((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880)) |
- | |
457 | WREG32(R_006C9C_DCP_CONTROL, 2); |
- | |
458 | - | ||
459 | rs690_crtc_bandwidth_compute(rdev, rdev->mode_info.crtcs[0], &wm0); |
- | |
460 | rs690_crtc_bandwidth_compute(rdev, rdev->mode_info.crtcs[1], &wm1); |
- | |
461 | - | ||
462 | tmp = (wm0.lb_request_fifo_depth - 1); |
- | |
Line 463... | Line 459... | ||
463 | tmp |= (wm1.lb_request_fifo_depth - 1) << 16; |
459 | *d1mode_priority_a_cnt = S_006548_D1MODE_PRIORITY_A_OFF(1); |
464 | WREG32(R_006D58_LB_MAX_REQ_OUTSTANDING, tmp); |
460 | *d2mode_priority_a_cnt = S_006548_D1MODE_PRIORITY_A_OFF(1); |
465 | 461 | ||
466 | if (mode0 && mode1) { |
462 | if (mode0 && mode1) { |
467 | if (dfixed_trunc(wm0.dbpp) > 64) |
463 | if (dfixed_trunc(wm0->dbpp) > 64) |
468 | a.full = dfixed_mul(wm0.dbpp, wm0.num_line_pair); |
464 | a.full = dfixed_mul(wm0->dbpp, wm0->num_line_pair); |
469 | else |
465 | else |
470 | a.full = wm0.num_line_pair.full; |
466 | a.full = wm0->num_line_pair.full; |
471 | if (dfixed_trunc(wm1.dbpp) > 64) |
467 | if (dfixed_trunc(wm1->dbpp) > 64) |
472 | b.full = dfixed_mul(wm1.dbpp, wm1.num_line_pair); |
468 | b.full = dfixed_mul(wm1->dbpp, wm1->num_line_pair); |
473 | else |
469 | else |
474 | b.full = wm1.num_line_pair.full; |
470 | b.full = wm1->num_line_pair.full; |
475 | a.full += b.full; |
471 | a.full += b.full; |
476 | fill_rate.full = dfixed_div(wm0.sclk, a); |
472 | fill_rate.full = dfixed_div(wm0->sclk, a); |
477 | if (wm0.consumption_rate.full > fill_rate.full) { |
473 | if (wm0->consumption_rate.full > fill_rate.full) { |
478 | b.full = wm0.consumption_rate.full - fill_rate.full; |
474 | b.full = wm0->consumption_rate.full - fill_rate.full; |
479 | b.full = dfixed_mul(b, wm0.active_time); |
475 | b.full = dfixed_mul(b, wm0->active_time); |
480 | a.full = dfixed_mul(wm0.worst_case_latency, |
476 | a.full = dfixed_mul(wm0->worst_case_latency, |
481 | wm0.consumption_rate); |
477 | wm0->consumption_rate); |
482 | a.full = a.full + b.full; |
478 | a.full = a.full + b.full; |
483 | b.full = dfixed_const(16 * 1000); |
479 | b.full = dfixed_const(16 * 1000); |
484 | priority_mark02.full = dfixed_div(a, b); |
480 | priority_mark02.full = dfixed_div(a, b); |
485 | } else { |
481 | } else { |
486 | a.full = dfixed_mul(wm0.worst_case_latency, |
482 | a.full = dfixed_mul(wm0->worst_case_latency, |
487 | wm0.consumption_rate); |
483 | wm0->consumption_rate); |
488 | b.full = dfixed_const(16 * 1000); |
484 | b.full = dfixed_const(16 * 1000); |
489 | priority_mark02.full = dfixed_div(a, b); |
485 | priority_mark02.full = dfixed_div(a, b); |
490 | } |
486 | } |
491 | if (wm1.consumption_rate.full > fill_rate.full) { |
487 | if (wm1->consumption_rate.full > fill_rate.full) { |
492 | b.full = wm1.consumption_rate.full - fill_rate.full; |
488 | b.full = wm1->consumption_rate.full - fill_rate.full; |
493 | b.full = dfixed_mul(b, wm1.active_time); |
489 | b.full = dfixed_mul(b, wm1->active_time); |
494 | a.full = dfixed_mul(wm1.worst_case_latency, |
490 | a.full = dfixed_mul(wm1->worst_case_latency, |
495 | wm1.consumption_rate); |
491 | wm1->consumption_rate); |
496 | a.full = a.full + b.full; |
492 | a.full = a.full + b.full; |
497 | b.full = dfixed_const(16 * 1000); |
493 | b.full = dfixed_const(16 * 1000); |
498 | priority_mark12.full = dfixed_div(a, b); |
494 | priority_mark12.full = dfixed_div(a, b); |
499 | } else { |
495 | } else { |
500 | a.full = dfixed_mul(wm1.worst_case_latency, |
496 | a.full = dfixed_mul(wm1->worst_case_latency, |
501 | wm1.consumption_rate); |
497 | wm1->consumption_rate); |
502 | b.full = dfixed_const(16 * 1000); |
498 | b.full = dfixed_const(16 * 1000); |
503 | priority_mark12.full = dfixed_div(a, b); |
499 | priority_mark12.full = dfixed_div(a, b); |
504 | } |
- | |
505 | if (wm0.priority_mark.full > priority_mark02.full) |
- | |
506 | priority_mark02.full = wm0.priority_mark.full; |
500 | } |
507 | if (dfixed_trunc(priority_mark02) < 0) |
501 | if (wm0->priority_mark.full > priority_mark02.full) |
508 | priority_mark02.full = 0; |
502 | priority_mark02.full = wm0->priority_mark.full; |
509 | if (wm0.priority_mark_max.full > priority_mark02.full) |
503 | if (wm0->priority_mark_max.full > priority_mark02.full) |
510 | priority_mark02.full = wm0.priority_mark_max.full; |
- | |
511 | if (wm1.priority_mark.full > priority_mark12.full) |
- | |
512 | priority_mark12.full = wm1.priority_mark.full; |
504 | priority_mark02.full = wm0->priority_mark_max.full; |
513 | if (dfixed_trunc(priority_mark12) < 0) |
505 | if (wm1->priority_mark.full > priority_mark12.full) |
514 | priority_mark12.full = 0; |
506 | priority_mark12.full = wm1->priority_mark.full; |
515 | if (wm1.priority_mark_max.full > priority_mark12.full) |
507 | if (wm1->priority_mark_max.full > priority_mark12.full) |
516 | priority_mark12.full = wm1.priority_mark_max.full; |
508 | priority_mark12.full = wm1->priority_mark_max.full; |
517 | d1mode_priority_a_cnt = dfixed_trunc(priority_mark02); |
509 | *d1mode_priority_a_cnt = dfixed_trunc(priority_mark02); |
518 | d2mode_priority_a_cnt = dfixed_trunc(priority_mark12); |
510 | *d2mode_priority_a_cnt = dfixed_trunc(priority_mark12); |
519 | if (rdev->disp_priority == 2) { |
511 | if (rdev->disp_priority == 2) { |
520 | d1mode_priority_a_cnt |= S_006548_D1MODE_PRIORITY_A_ALWAYS_ON(1); |
512 | *d1mode_priority_a_cnt |= S_006548_D1MODE_PRIORITY_A_ALWAYS_ON(1); |
521 | d2mode_priority_a_cnt |= S_006D48_D2MODE_PRIORITY_A_ALWAYS_ON(1); |
513 | *d2mode_priority_a_cnt |= S_006D48_D2MODE_PRIORITY_A_ALWAYS_ON(1); |
522 | } |
514 | } |
523 | } else if (mode0) { |
515 | } else if (mode0) { |
524 | if (dfixed_trunc(wm0.dbpp) > 64) |
516 | if (dfixed_trunc(wm0->dbpp) > 64) |
525 | a.full = dfixed_mul(wm0.dbpp, wm0.num_line_pair); |
517 | a.full = dfixed_mul(wm0->dbpp, wm0->num_line_pair); |
526 | else |
518 | else |
527 | a.full = wm0.num_line_pair.full; |
519 | a.full = wm0->num_line_pair.full; |
528 | fill_rate.full = dfixed_div(wm0.sclk, a); |
520 | fill_rate.full = dfixed_div(wm0->sclk, a); |
529 | if (wm0.consumption_rate.full > fill_rate.full) { |
521 | if (wm0->consumption_rate.full > fill_rate.full) { |
530 | b.full = wm0.consumption_rate.full - fill_rate.full; |
522 | b.full = wm0->consumption_rate.full - fill_rate.full; |
531 | b.full = dfixed_mul(b, wm0.active_time); |
523 | b.full = dfixed_mul(b, wm0->active_time); |
532 | a.full = dfixed_mul(wm0.worst_case_latency, |
524 | a.full = dfixed_mul(wm0->worst_case_latency, |
533 | wm0.consumption_rate); |
525 | wm0->consumption_rate); |
534 | a.full = a.full + b.full; |
526 | a.full = a.full + b.full; |
535 | b.full = dfixed_const(16 * 1000); |
527 | b.full = dfixed_const(16 * 1000); |
536 | priority_mark02.full = dfixed_div(a, b); |
528 | priority_mark02.full = dfixed_div(a, b); |
537 | } else { |
529 | } else { |
538 | a.full = dfixed_mul(wm0.worst_case_latency, |
530 | a.full = dfixed_mul(wm0->worst_case_latency, |
539 | wm0.consumption_rate); |
531 | wm0->consumption_rate); |
540 | b.full = dfixed_const(16 * 1000); |
532 | b.full = dfixed_const(16 * 1000); |
541 | priority_mark02.full = dfixed_div(a, b); |
533 | priority_mark02.full = dfixed_div(a, b); |
542 | } |
- | |
543 | if (wm0.priority_mark.full > priority_mark02.full) |
- | |
544 | priority_mark02.full = wm0.priority_mark.full; |
534 | } |
545 | if (dfixed_trunc(priority_mark02) < 0) |
535 | if (wm0->priority_mark.full > priority_mark02.full) |
546 | priority_mark02.full = 0; |
536 | priority_mark02.full = wm0->priority_mark.full; |
547 | if (wm0.priority_mark_max.full > priority_mark02.full) |
537 | if (wm0->priority_mark_max.full > priority_mark02.full) |
548 | priority_mark02.full = wm0.priority_mark_max.full; |
538 | priority_mark02.full = wm0->priority_mark_max.full; |
549 | d1mode_priority_a_cnt = dfixed_trunc(priority_mark02); |
539 | *d1mode_priority_a_cnt = dfixed_trunc(priority_mark02); |
550 | if (rdev->disp_priority == 2) |
540 | if (rdev->disp_priority == 2) |
551 | d1mode_priority_a_cnt |= S_006548_D1MODE_PRIORITY_A_ALWAYS_ON(1); |
541 | *d1mode_priority_a_cnt |= S_006548_D1MODE_PRIORITY_A_ALWAYS_ON(1); |
552 | } else if (mode1) { |
542 | } else if (mode1) { |
553 | if (dfixed_trunc(wm1.dbpp) > 64) |
543 | if (dfixed_trunc(wm1->dbpp) > 64) |
554 | a.full = dfixed_mul(wm1.dbpp, wm1.num_line_pair); |
544 | a.full = dfixed_mul(wm1->dbpp, wm1->num_line_pair); |
555 | else |
545 | else |
556 | a.full = wm1.num_line_pair.full; |
546 | a.full = wm1->num_line_pair.full; |
557 | fill_rate.full = dfixed_div(wm1.sclk, a); |
547 | fill_rate.full = dfixed_div(wm1->sclk, a); |
558 | if (wm1.consumption_rate.full > fill_rate.full) { |
548 | if (wm1->consumption_rate.full > fill_rate.full) { |
559 | b.full = wm1.consumption_rate.full - fill_rate.full; |
549 | b.full = wm1->consumption_rate.full - fill_rate.full; |
560 | b.full = dfixed_mul(b, wm1.active_time); |
550 | b.full = dfixed_mul(b, wm1->active_time); |
561 | a.full = dfixed_mul(wm1.worst_case_latency, |
551 | a.full = dfixed_mul(wm1->worst_case_latency, |
562 | wm1.consumption_rate); |
552 | wm1->consumption_rate); |
563 | a.full = a.full + b.full; |
553 | a.full = a.full + b.full; |
564 | b.full = dfixed_const(16 * 1000); |
554 | b.full = dfixed_const(16 * 1000); |
565 | priority_mark12.full = dfixed_div(a, b); |
555 | priority_mark12.full = dfixed_div(a, b); |
566 | } else { |
556 | } else { |
567 | a.full = dfixed_mul(wm1.worst_case_latency, |
557 | a.full = dfixed_mul(wm1->worst_case_latency, |
568 | wm1.consumption_rate); |
558 | wm1->consumption_rate); |
569 | b.full = dfixed_const(16 * 1000); |
559 | b.full = dfixed_const(16 * 1000); |
570 | priority_mark12.full = dfixed_div(a, b); |
560 | priority_mark12.full = dfixed_div(a, b); |
571 | } |
- | |
572 | if (wm1.priority_mark.full > priority_mark12.full) |
- | |
573 | priority_mark12.full = wm1.priority_mark.full; |
561 | } |
574 | if (dfixed_trunc(priority_mark12) < 0) |
562 | if (wm1->priority_mark.full > priority_mark12.full) |
575 | priority_mark12.full = 0; |
563 | priority_mark12.full = wm1->priority_mark.full; |
576 | if (wm1.priority_mark_max.full > priority_mark12.full) |
564 | if (wm1->priority_mark_max.full > priority_mark12.full) |
577 | priority_mark12.full = wm1.priority_mark_max.full; |
565 | priority_mark12.full = wm1->priority_mark_max.full; |
- | 566 | *d2mode_priority_a_cnt = dfixed_trunc(priority_mark12); |
|
578 | d2mode_priority_a_cnt = dfixed_trunc(priority_mark12); |
567 | if (rdev->disp_priority == 2) |
Line -... | Line 568... | ||
- | 568 | *d2mode_priority_a_cnt |= S_006D48_D2MODE_PRIORITY_A_ALWAYS_ON(1); |
|
- | 569 | } |
|
- | 570 | } |
|
- | 571 | ||
- | 572 | void rs690_bandwidth_update(struct radeon_device *rdev) |
|
- | 573 | { |
|
- | 574 | struct drm_display_mode *mode0 = NULL; |
|
- | 575 | struct drm_display_mode *mode1 = NULL; |
|
- | 576 | struct rs690_watermark wm0_high, wm0_low; |
|
- | 577 | struct rs690_watermark wm1_high, wm1_low; |
|
- | 578 | u32 tmp; |
|
- | 579 | u32 d1mode_priority_a_cnt, d1mode_priority_b_cnt; |
|
- | 580 | u32 d2mode_priority_a_cnt, d2mode_priority_b_cnt; |
|
- | 581 | ||
- | 582 | radeon_update_display_priority(rdev); |
|
- | 583 | ||
- | 584 | if (rdev->mode_info.crtcs[0]->base.enabled) |
|
- | 585 | mode0 = &rdev->mode_info.crtcs[0]->base.mode; |
|
- | 586 | if (rdev->mode_info.crtcs[1]->base.enabled) |
|
- | 587 | mode1 = &rdev->mode_info.crtcs[1]->base.mode; |
|
- | 588 | /* |
|
- | 589 | * Set display0/1 priority up in the memory controller for |
|
- | 590 | * modes if the user specifies HIGH for displaypriority |
|
- | 591 | * option. |
|
- | 592 | */ |
|
- | 593 | if ((rdev->disp_priority == 2) && |
|
- | 594 | ((rdev->family == CHIP_RS690) || (rdev->family == CHIP_RS740))) { |
|
- | 595 | tmp = RREG32_MC(R_000104_MC_INIT_MISC_LAT_TIMER); |
|
- | 596 | tmp &= C_000104_MC_DISP0R_INIT_LAT; |
|
- | 597 | tmp &= C_000104_MC_DISP1R_INIT_LAT; |
|
- | 598 | if (mode0) |
|
- | 599 | tmp |= S_000104_MC_DISP0R_INIT_LAT(1); |
|
- | 600 | if (mode1) |
|
- | 601 | tmp |= S_000104_MC_DISP1R_INIT_LAT(1); |
|
- | 602 | WREG32_MC(R_000104_MC_INIT_MISC_LAT_TIMER, tmp); |
|
- | 603 | } |
|
- | 604 | rs690_line_buffer_adjust(rdev, mode0, mode1); |
|
- | 605 | ||
- | 606 | if ((rdev->family == CHIP_RS690) || (rdev->family == CHIP_RS740)) |
|
- | 607 | WREG32(R_006C9C_DCP_CONTROL, 0); |
|
- | 608 | if ((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880)) |
|
- | 609 | WREG32(R_006C9C_DCP_CONTROL, 2); |
|
- | 610 | ||
- | 611 | rs690_crtc_bandwidth_compute(rdev, rdev->mode_info.crtcs[0], &wm0_high, false); |
|
- | 612 | rs690_crtc_bandwidth_compute(rdev, rdev->mode_info.crtcs[1], &wm1_high, false); |
|
- | 613 | ||
- | 614 | rs690_crtc_bandwidth_compute(rdev, rdev->mode_info.crtcs[0], &wm0_low, true); |
|
- | 615 | rs690_crtc_bandwidth_compute(rdev, rdev->mode_info.crtcs[1], &wm1_low, true); |
|
- | 616 | ||
- | 617 | tmp = (wm0_high.lb_request_fifo_depth - 1); |
|
- | 618 | tmp |= (wm1_high.lb_request_fifo_depth - 1) << 16; |
|
- | 619 | WREG32(R_006D58_LB_MAX_REQ_OUTSTANDING, tmp); |
|
- | 620 | ||
- | 621 | rs690_compute_mode_priority(rdev, |
|
- | 622 | &wm0_high, &wm1_high, |
|
- | 623 | mode0, mode1, |
|
- | 624 | &d1mode_priority_a_cnt, &d2mode_priority_a_cnt); |
|
- | 625 | rs690_compute_mode_priority(rdev, |
|
579 | if (rdev->disp_priority == 2) |
626 | &wm0_low, &wm1_low, |
580 | d2mode_priority_a_cnt |= S_006D48_D2MODE_PRIORITY_A_ALWAYS_ON(1); |
627 | mode0, mode1, |
581 | } |
628 | &d1mode_priority_b_cnt, &d2mode_priority_b_cnt); |
582 | 629 | ||
583 | WREG32(R_006548_D1MODE_PRIORITY_A_CNT, d1mode_priority_a_cnt); |
630 | WREG32(R_006548_D1MODE_PRIORITY_A_CNT, d1mode_priority_a_cnt); |
Line 584... | Line 631... | ||
584 | WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, d1mode_priority_a_cnt); |
631 | WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, d1mode_priority_b_cnt); |
585 | WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, d2mode_priority_a_cnt); |
632 | WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, d2mode_priority_a_cnt); |
- | 633 | WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, d2mode_priority_b_cnt); |
|
586 | WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, d2mode_priority_a_cnt); |
634 | } |
Line -... | Line 635... | ||
- | 635 | ||
587 | } |
636 | uint32_t rs690_mc_rreg(struct radeon_device *rdev, uint32_t reg) |
588 | 637 | { |
|
589 | uint32_t rs690_mc_rreg(struct radeon_device *rdev, uint32_t reg) |
638 | unsigned long flags; |
- | 639 | uint32_t r; |
|
590 | { |
640 | |
591 | uint32_t r; |
641 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); |
Line 592... | Line 642... | ||
592 | 642 | WREG32(R_000078_MC_INDEX, S_000078_MC_IND_ADDR(reg)); |
|
593 | WREG32(R_000078_MC_INDEX, S_000078_MC_IND_ADDR(reg)); |
643 | r = RREG32(R_00007C_MC_DATA); |
- | 644 | WREG32(R_000078_MC_INDEX, ~C_000078_MC_IND_ADDR); |
|
- | 645 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); |
|
- | 646 | return r; |
|
594 | r = RREG32(R_00007C_MC_DATA); |
647 | } |
595 | WREG32(R_000078_MC_INDEX, ~C_000078_MC_IND_ADDR); |
648 | |
596 | return r; |
649 | void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) |
597 | } |
650 | { |
- | 651 | unsigned long flags; |
|
598 | 652 | ||
Line 599... | Line 653... | ||
599 | void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) |
653 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); |
600 | { |
654 | WREG32(R_000078_MC_INDEX, S_000078_MC_IND_ADDR(reg) | |
601 | WREG32(R_000078_MC_INDEX, S_000078_MC_IND_ADDR(reg) | |
655 | S_000078_MC_IND_WR_EN(1)); |
Line 670... | Line 724... | ||
670 | if (r) { |
724 | if (r) { |
671 | dev_err(rdev->dev, "IB initialization failed (%d).\n", r); |
725 | dev_err(rdev->dev, "IB initialization failed (%d).\n", r); |
672 | return r; |
726 | return r; |
673 | } |
727 | } |
Line -... | Line 728... | ||
- | 728 | ||
- | 729 | r = r600_audio_init(rdev); |
|
- | 730 | if (r) { |
|
- | 731 | dev_err(rdev->dev, "failed initializing audio\n"); |
|
- | 732 | return r; |
|
Line 674... | Line 733... | ||
674 | 733 | } |
|
675 | 734 | ||
Line 732... | Line 791... | ||
732 | r = rs400_gart_init(rdev); |
791 | r = rs400_gart_init(rdev); |
733 | if (r) |
792 | if (r) |
734 | return r; |
793 | return r; |
735 | rs600_set_safe_registers(rdev); |
794 | rs600_set_safe_registers(rdev); |
Line -... | Line 795... | ||
- | 795 | ||
- | 796 | /* Initialize power management */ |
|
- | 797 | radeon_pm_init(rdev); |
|
736 | 798 | ||
737 | rdev->accel_working = true; |
799 | rdev->accel_working = true; |
738 | r = rs690_startup(rdev); |
800 | r = rs690_startup(rdev); |
739 | if (r) { |
801 | if (r) { |
740 | /* Somethings want wront with the accel init stop accel */ |
802 | /* Somethings want wront with the accel init stop accel */ |