diff options
author | Dave Airlie <airlied@redhat.com> | 2011-04-11 01:26:01 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-04-11 01:26:01 -0400 |
commit | d85023a3cdb48ae127e431ec216c277ed7a3cb0f (patch) | |
tree | e957a70646c1770ffe78ae793ca50a91254aeee0 /drivers/gpu | |
parent | d4864d604a8d29a0d6a13a8d882be6e21c498c22 (diff) | |
parent | a719726f4ceaf14842c80fd7e58dec40cb7022a2 (diff) |
Merge remote branch 'nouveau/drm-nouveau-fixes' of /ssd/git/drm-nouveau-next into drm-fixes
* 'nouveau/drm-nouveau-fixes' of /ssd/git/drm-nouveau-next:
drm/nvc0: improve vm flush function
drm/nv50-nvc0: remove some code that doesn't belong here
drm/nv50: use "nv86" tlb flush method on everything except 0x50/0xac
drm/nouveau: quirk for XFX GT-240X-YA
drm/nv50-nvc0: work around an evo channel hang that some people see
drm/nouveau: implement init table opcode 0x5c
drm/nouveau: fix oops on unload with disabled LVDS panel
nv30: Fix parsing of perf table
drm/nouveau: correct memtiming table parsing for nv4x
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bios.c | 53 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_mem.c | 76 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_perf.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv04_dfp.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_crtc.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_evo.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_graph.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvc0_vm.c | 24 |
10 files changed, 129 insertions, 59 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 8314a49b6b9a..90aef64b76f2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -269,7 +269,7 @@ struct init_tbl_entry { | |||
269 | int (*handler)(struct nvbios *, uint16_t, struct init_exec *); | 269 | int (*handler)(struct nvbios *, uint16_t, struct init_exec *); |
270 | }; | 270 | }; |
271 | 271 | ||
272 | static int parse_init_table(struct nvbios *, unsigned int, struct init_exec *); | 272 | static int parse_init_table(struct nvbios *, uint16_t, struct init_exec *); |
273 | 273 | ||
274 | #define MACRO_INDEX_SIZE 2 | 274 | #define MACRO_INDEX_SIZE 2 |
275 | #define MACRO_SIZE 8 | 275 | #define MACRO_SIZE 8 |
@@ -2011,6 +2011,27 @@ init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2011 | } | 2011 | } |
2012 | 2012 | ||
2013 | static int | 2013 | static int |
2014 | init_jump(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | ||
2015 | { | ||
2016 | /* | ||
2017 | * INIT_JUMP opcode: 0x5C ('\') | ||
2018 | * | ||
2019 | * offset (8 bit): opcode | ||
2020 | * offset + 1 (16 bit): offset (in bios) | ||
2021 | * | ||
2022 | * Continue execution of init table from 'offset' | ||
2023 | */ | ||
2024 | |||
2025 | uint16_t jmp_offset = ROM16(bios->data[offset + 1]); | ||
2026 | |||
2027 | if (!iexec->execute) | ||
2028 | return 3; | ||
2029 | |||
2030 | BIOSLOG(bios, "0x%04X: Jump to 0x%04X\n", offset, jmp_offset); | ||
2031 | return jmp_offset - offset; | ||
2032 | } | ||
2033 | |||
2034 | static int | ||
2014 | init_i2c_if(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2035 | init_i2c_if(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2015 | { | 2036 | { |
2016 | /* | 2037 | /* |
@@ -3659,6 +3680,7 @@ static struct init_tbl_entry itbl_entry[] = { | |||
3659 | { "INIT_ZM_REG_SEQUENCE" , 0x58, init_zm_reg_sequence }, | 3680 | { "INIT_ZM_REG_SEQUENCE" , 0x58, init_zm_reg_sequence }, |
3660 | /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ | 3681 | /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ |
3661 | { "INIT_SUB_DIRECT" , 0x5B, init_sub_direct }, | 3682 | { "INIT_SUB_DIRECT" , 0x5B, init_sub_direct }, |
3683 | { "INIT_JUMP" , 0x5C, init_jump }, | ||
3662 | { "INIT_I2C_IF" , 0x5E, init_i2c_if }, | 3684 | { "INIT_I2C_IF" , 0x5E, init_i2c_if }, |
3663 | { "INIT_COPY_NV_REG" , 0x5F, init_copy_nv_reg }, | 3685 | { "INIT_COPY_NV_REG" , 0x5F, init_copy_nv_reg }, |
3664 | { "INIT_ZM_INDEX_IO" , 0x62, init_zm_index_io }, | 3686 | { "INIT_ZM_INDEX_IO" , 0x62, init_zm_index_io }, |
@@ -3700,8 +3722,7 @@ static struct init_tbl_entry itbl_entry[] = { | |||
3700 | #define MAX_TABLE_OPS 1000 | 3722 | #define MAX_TABLE_OPS 1000 |
3701 | 3723 | ||
3702 | static int | 3724 | static int |
3703 | parse_init_table(struct nvbios *bios, unsigned int offset, | 3725 | parse_init_table(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
3704 | struct init_exec *iexec) | ||
3705 | { | 3726 | { |
3706 | /* | 3727 | /* |
3707 | * Parses all commands in an init table. | 3728 | * Parses all commands in an init table. |
@@ -6333,6 +6354,32 @@ apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf) | |||
6333 | } | 6354 | } |
6334 | } | 6355 | } |
6335 | 6356 | ||
6357 | /* XFX GT-240X-YA | ||
6358 | * | ||
6359 | * So many things wrong here, replace the entire encoder table.. | ||
6360 | */ | ||
6361 | if (nv_match_device(dev, 0x0ca3, 0x1682, 0x3003)) { | ||
6362 | if (idx == 0) { | ||
6363 | *conn = 0x02001300; /* VGA, connector 1 */ | ||
6364 | *conf = 0x00000028; | ||
6365 | } else | ||
6366 | if (idx == 1) { | ||
6367 | *conn = 0x01010312; /* DVI, connector 0 */ | ||
6368 | *conf = 0x00020030; | ||
6369 | } else | ||
6370 | if (idx == 2) { | ||
6371 | *conn = 0x01010310; /* VGA, connector 0 */ | ||
6372 | *conf = 0x00000028; | ||
6373 | } else | ||
6374 | if (idx == 3) { | ||
6375 | *conn = 0x02022362; /* HDMI, connector 2 */ | ||
6376 | *conf = 0x00020010; | ||
6377 | } else { | ||
6378 | *conn = 0x0000000e; /* EOL */ | ||
6379 | *conf = 0x00000000; | ||
6380 | } | ||
6381 | } | ||
6382 | |||
6336 | return true; | 6383 | return true; |
6337 | } | 6384 | } |
6338 | 6385 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 57e5302503db..856d56a98d1e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -1190,7 +1190,7 @@ extern int nv50_graph_load_context(struct nouveau_channel *); | |||
1190 | extern int nv50_graph_unload_context(struct drm_device *); | 1190 | extern int nv50_graph_unload_context(struct drm_device *); |
1191 | extern int nv50_grctx_init(struct nouveau_grctx *); | 1191 | extern int nv50_grctx_init(struct nouveau_grctx *); |
1192 | extern void nv50_graph_tlb_flush(struct drm_device *dev); | 1192 | extern void nv50_graph_tlb_flush(struct drm_device *dev); |
1193 | extern void nv86_graph_tlb_flush(struct drm_device *dev); | 1193 | extern void nv84_graph_tlb_flush(struct drm_device *dev); |
1194 | extern struct nouveau_enum nv50_data_error_names[]; | 1194 | extern struct nouveau_enum nv50_data_error_names[]; |
1195 | 1195 | ||
1196 | /* nvc0_graph.c */ | 1196 | /* nvc0_graph.c */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 2683377f4131..78f467fe30be 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -552,6 +552,7 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
552 | u8 tRC; /* Byte 9 */ | 552 | u8 tRC; /* Byte 9 */ |
553 | u8 tUNK_10, tUNK_11, tUNK_12, tUNK_13, tUNK_14; | 553 | u8 tUNK_10, tUNK_11, tUNK_12, tUNK_13, tUNK_14; |
554 | u8 tUNK_18, tUNK_19, tUNK_20, tUNK_21; | 554 | u8 tUNK_18, tUNK_19, tUNK_20, tUNK_21; |
555 | u8 magic_number = 0; /* Yeah... sorry*/ | ||
555 | u8 *mem = NULL, *entry; | 556 | u8 *mem = NULL, *entry; |
556 | int i, recordlen, entries; | 557 | int i, recordlen, entries; |
557 | 558 | ||
@@ -596,6 +597,12 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
596 | if (!memtimings->timing) | 597 | if (!memtimings->timing) |
597 | return; | 598 | return; |
598 | 599 | ||
600 | /* Get "some number" from the timing reg for NV_40 | ||
601 | * Used in calculations later */ | ||
602 | if(dev_priv->card_type == NV_40) { | ||
603 | magic_number = (nv_rd32(dev,0x100228) & 0x0f000000) >> 24; | ||
604 | } | ||
605 | |||
599 | entry = mem + mem[1]; | 606 | entry = mem + mem[1]; |
600 | for (i = 0; i < entries; i++, entry += recordlen) { | 607 | for (i = 0; i < entries; i++, entry += recordlen) { |
601 | struct nouveau_pm_memtiming *timing = &pm->memtimings.timing[i]; | 608 | struct nouveau_pm_memtiming *timing = &pm->memtimings.timing[i]; |
@@ -635,36 +642,51 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
635 | 642 | ||
636 | /* XXX: I don't trust the -1's and +1's... they must come | 643 | /* XXX: I don't trust the -1's and +1's... they must come |
637 | * from somewhere! */ | 644 | * from somewhere! */ |
638 | timing->reg_100224 = ((tUNK_0 + tUNK_19 + 1) << 24 | | 645 | timing->reg_100224 = (tUNK_0 + tUNK_19 + 1 + magic_number) << 24 | |
639 | tUNK_18 << 16 | | 646 | tUNK_18 << 16 | |
640 | (tUNK_1 + tUNK_19 + 1) << 8 | | 647 | (tUNK_1 + tUNK_19 + 1 + magic_number) << 8; |
641 | (tUNK_2 - 1)); | 648 | if(dev_priv->chipset == 0xa8) { |
649 | timing->reg_100224 |= (tUNK_2 - 1); | ||
650 | } else { | ||
651 | timing->reg_100224 |= (tUNK_2 + 2 - magic_number); | ||
652 | } | ||
642 | 653 | ||
643 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); | 654 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); |
644 | if(recordlen > 19) { | 655 | if(dev_priv->chipset >= 0xa3 && dev_priv->chipset < 0xaa) { |
645 | timing->reg_100228 += (tUNK_19 - 1) << 24; | 656 | timing->reg_100228 |= (tUNK_19 - 1) << 24; |
646 | }/* I cannot back-up this else-statement right now | 657 | } |
647 | else { | 658 | |
648 | timing->reg_100228 += tUNK_12 << 24; | 659 | if(dev_priv->card_type == NV_40) { |
649 | }*/ | 660 | /* NV40: don't know what the rest of the regs are.. |
650 | 661 | * And don't need to know either */ | |
651 | /* XXX: reg_10022c */ | 662 | timing->reg_100228 |= 0x20200000 | magic_number << 24; |
652 | timing->reg_10022c = tUNK_2 - 1; | 663 | } else if(dev_priv->card_type >= NV_50) { |
653 | 664 | /* XXX: reg_10022c */ | |
654 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | | 665 | timing->reg_10022c = tUNK_2 - 1; |
655 | tUNK_13 << 8 | tUNK_13); | 666 | |
656 | 667 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | | |
657 | /* XXX: +6? */ | 668 | tUNK_13 << 8 | tUNK_13); |
658 | timing->reg_100234 = (tRAS << 24 | (tUNK_19 + 6) << 8 | tRC); | 669 | |
659 | timing->reg_100234 += max(tUNK_10,tUNK_11) << 16; | 670 | timing->reg_100234 = (tRAS << 24 | tRC); |
660 | 671 | timing->reg_100234 += max(tUNK_10,tUNK_11) << 16; | |
661 | /* XXX; reg_100238, reg_10023c | 672 | |
662 | * reg: 0x00?????? | 673 | if(dev_priv->chipset < 0xa3) { |
663 | * reg_10023c: | 674 | timing->reg_100234 |= (tUNK_2 + 2) << 8; |
664 | * 0 for pre-NV50 cards | 675 | } else { |
665 | * 0x????0202 for NV50+ cards (empirical evidence) */ | 676 | /* XXX: +6? */ |
666 | if(dev_priv->card_type >= NV_50) { | 677 | timing->reg_100234 |= (tUNK_19 + 6) << 8; |
678 | } | ||
679 | |||
680 | /* XXX; reg_100238, reg_10023c | ||
681 | * reg_100238: 0x00?????? | ||
682 | * reg_10023c: 0x!!??0202 for NV50+ cards (empirical evidence) */ | ||
667 | timing->reg_10023c = 0x202; | 683 | timing->reg_10023c = 0x202; |
684 | if(dev_priv->chipset < 0xa3) { | ||
685 | timing->reg_10023c |= 0x4000000 | (tUNK_2 - 1) << 16; | ||
686 | } else { | ||
687 | /* currently unknown | ||
688 | * 10023c seen as 06xxxxxx, 0bxxxxxx or 0fxxxxxx */ | ||
689 | } | ||
668 | } | 690 | } |
669 | 691 | ||
670 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, | 692 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, |
@@ -675,7 +697,7 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
675 | timing->reg_100238, timing->reg_10023c); | 697 | timing->reg_100238, timing->reg_10023c); |
676 | } | 698 | } |
677 | 699 | ||
678 | memtimings->nr_timing = entries; | 700 | memtimings->nr_timing = entries; |
679 | memtimings->supported = true; | 701 | memtimings->supported = true; |
680 | } | 702 | } |
681 | 703 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c index ac62a1b8c4fc..670e3cb697ec 100644 --- a/drivers/gpu/drm/nouveau/nouveau_perf.c +++ b/drivers/gpu/drm/nouveau/nouveau_perf.c | |||
@@ -134,7 +134,7 @@ nouveau_perf_init(struct drm_device *dev) | |||
134 | case 0x13: | 134 | case 0x13: |
135 | case 0x15: | 135 | case 0x15: |
136 | perflvl->fanspeed = entry[55]; | 136 | perflvl->fanspeed = entry[55]; |
137 | perflvl->voltage = entry[56]; | 137 | perflvl->voltage = (recordlen > 56) ? entry[56] : 0; |
138 | perflvl->core = ROM32(entry[1]) * 10; | 138 | perflvl->core = ROM32(entry[1]) * 10; |
139 | perflvl->memory = ROM32(entry[5]) * 20; | 139 | perflvl->memory = ROM32(entry[5]) * 20; |
140 | break; | 140 | break; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 5bb2859001e2..6e2b1a6caa2d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -376,15 +376,11 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
376 | engine->graph.destroy_context = nv50_graph_destroy_context; | 376 | engine->graph.destroy_context = nv50_graph_destroy_context; |
377 | engine->graph.load_context = nv50_graph_load_context; | 377 | engine->graph.load_context = nv50_graph_load_context; |
378 | engine->graph.unload_context = nv50_graph_unload_context; | 378 | engine->graph.unload_context = nv50_graph_unload_context; |
379 | if (dev_priv->chipset != 0x86) | 379 | if (dev_priv->chipset == 0x50 || |
380 | dev_priv->chipset == 0xac) | ||
380 | engine->graph.tlb_flush = nv50_graph_tlb_flush; | 381 | engine->graph.tlb_flush = nv50_graph_tlb_flush; |
381 | else { | 382 | else |
382 | /* from what i can see nvidia do this on every | 383 | engine->graph.tlb_flush = nv84_graph_tlb_flush; |
383 | * pre-NVA3 board except NVAC, but, we've only | ||
384 | * ever seen problems on NV86 | ||
385 | */ | ||
386 | engine->graph.tlb_flush = nv86_graph_tlb_flush; | ||
387 | } | ||
388 | engine->fifo.channels = 128; | 384 | engine->fifo.channels = 128; |
389 | engine->fifo.init = nv50_fifo_init; | 385 | engine->fifo.init = nv50_fifo_init; |
390 | engine->fifo.takedown = nv50_fifo_takedown; | 386 | engine->fifo.takedown = nv50_fifo_takedown; |
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index c82db37d9f41..12098bf839c4 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | |||
@@ -581,12 +581,13 @@ static void nv04_dfp_restore(struct drm_encoder *encoder) | |||
581 | int head = nv_encoder->restore.head; | 581 | int head = nv_encoder->restore.head; |
582 | 582 | ||
583 | if (nv_encoder->dcb->type == OUTPUT_LVDS) { | 583 | if (nv_encoder->dcb->type == OUTPUT_LVDS) { |
584 | struct drm_display_mode *native_mode = nouveau_encoder_connector_get(nv_encoder)->native_mode; | 584 | struct nouveau_connector *connector = |
585 | if (native_mode) | 585 | nouveau_encoder_connector_get(nv_encoder); |
586 | call_lvds_script(dev, nv_encoder->dcb, head, LVDS_PANEL_ON, | 586 | |
587 | native_mode->clock); | 587 | if (connector && connector->native_mode) |
588 | else | 588 | call_lvds_script(dev, nv_encoder->dcb, head, |
589 | NV_ERROR(dev, "Not restoring LVDS without native mode\n"); | 589 | LVDS_PANEL_ON, |
590 | connector->native_mode->clock); | ||
590 | 591 | ||
591 | } else if (nv_encoder->dcb->type == OUTPUT_TMDS) { | 592 | } else if (nv_encoder->dcb->type == OUTPUT_TMDS) { |
592 | int clock = nouveau_hw_pllvals_to_clk | 593 | int clock = nouveau_hw_pllvals_to_clk |
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index 2b9984027f41..a19ccaa025b3 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
@@ -469,9 +469,6 @@ nv50_crtc_wait_complete(struct drm_crtc *crtc) | |||
469 | 469 | ||
470 | start = ptimer->read(dev); | 470 | start = ptimer->read(dev); |
471 | do { | 471 | do { |
472 | nv_wr32(dev, 0x61002c, 0x370); | ||
473 | nv_wr32(dev, 0x000140, 1); | ||
474 | |||
475 | if (nv_ro32(disp->ntfy, 0x000)) | 472 | if (nv_ro32(disp->ntfy, 0x000)) |
476 | return 0; | 473 | return 0; |
477 | } while (ptimer->read(dev) - start < 2000000000ULL); | 474 | } while (ptimer->read(dev) - start < 2000000000ULL); |
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.c b/drivers/gpu/drm/nouveau/nv50_evo.c index a2cfaa691e9b..c8e83c1a4de8 100644 --- a/drivers/gpu/drm/nouveau/nv50_evo.c +++ b/drivers/gpu/drm/nouveau/nv50_evo.c | |||
@@ -186,6 +186,7 @@ nv50_evo_channel_init(struct nouveau_channel *evo) | |||
186 | nv_mask(dev, 0x610028, 0x00000000, 0x00010001 << id); | 186 | nv_mask(dev, 0x610028, 0x00000000, 0x00010001 << id); |
187 | 187 | ||
188 | evo->dma.max = (4096/4) - 2; | 188 | evo->dma.max = (4096/4) - 2; |
189 | evo->dma.max &= ~7; | ||
189 | evo->dma.put = 0; | 190 | evo->dma.put = 0; |
190 | evo->dma.cur = evo->dma.put; | 191 | evo->dma.cur = evo->dma.put; |
191 | evo->dma.free = evo->dma.max - evo->dma.cur; | 192 | evo->dma.free = evo->dma.max - evo->dma.cur; |
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c index 8675b00caf18..b02a5b1e7d37 100644 --- a/drivers/gpu/drm/nouveau/nv50_graph.c +++ b/drivers/gpu/drm/nouveau/nv50_graph.c | |||
@@ -503,7 +503,7 @@ nv50_graph_tlb_flush(struct drm_device *dev) | |||
503 | } | 503 | } |
504 | 504 | ||
505 | void | 505 | void |
506 | nv86_graph_tlb_flush(struct drm_device *dev) | 506 | nv84_graph_tlb_flush(struct drm_device *dev) |
507 | { | 507 | { |
508 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 508 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
509 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; | 509 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; |
diff --git a/drivers/gpu/drm/nouveau/nvc0_vm.c b/drivers/gpu/drm/nouveau/nvc0_vm.c index 69af0ba7edd3..a0a2a0277f73 100644 --- a/drivers/gpu/drm/nouveau/nvc0_vm.c +++ b/drivers/gpu/drm/nouveau/nvc0_vm.c | |||
@@ -104,20 +104,26 @@ nvc0_vm_flush(struct nouveau_vm *vm) | |||
104 | struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem; | 104 | struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem; |
105 | struct drm_device *dev = vm->dev; | 105 | struct drm_device *dev = vm->dev; |
106 | struct nouveau_vm_pgd *vpgd; | 106 | struct nouveau_vm_pgd *vpgd; |
107 | u32 r100c80, engine; | 107 | u32 engine = (dev_priv->chan_vm == vm) ? 1 : 5; |
108 | 108 | ||
109 | pinstmem->flush(vm->dev); | 109 | pinstmem->flush(vm->dev); |
110 | 110 | ||
111 | if (vm == dev_priv->chan_vm) | 111 | spin_lock(&dev_priv->ramin_lock); |
112 | engine = 1; | ||
113 | else | ||
114 | engine = 5; | ||
115 | |||
116 | list_for_each_entry(vpgd, &vm->pgd_list, head) { | 112 | list_for_each_entry(vpgd, &vm->pgd_list, head) { |
117 | r100c80 = nv_rd32(dev, 0x100c80); | 113 | /* looks like maybe a "free flush slots" counter, the |
114 | * faster you write to 0x100cbc to more it decreases | ||
115 | */ | ||
116 | if (!nv_wait_ne(dev, 0x100c80, 0x00ff0000, 0x00000000)) { | ||
117 | NV_ERROR(dev, "vm timeout 0: 0x%08x %d\n", | ||
118 | nv_rd32(dev, 0x100c80), engine); | ||
119 | } | ||
118 | nv_wr32(dev, 0x100cb8, vpgd->obj->vinst >> 8); | 120 | nv_wr32(dev, 0x100cb8, vpgd->obj->vinst >> 8); |
119 | nv_wr32(dev, 0x100cbc, 0x80000000 | engine); | 121 | nv_wr32(dev, 0x100cbc, 0x80000000 | engine); |
120 | if (!nv_wait(dev, 0x100c80, 0xffffffff, r100c80)) | 122 | /* wait for flush to be queued? */ |
121 | NV_ERROR(dev, "vm flush timeout eng %d\n", engine); | 123 | if (!nv_wait(dev, 0x100c80, 0x00008000, 0x00008000)) { |
124 | NV_ERROR(dev, "vm timeout 1: 0x%08x %d\n", | ||
125 | nv_rd32(dev, 0x100c80), engine); | ||
126 | } | ||
122 | } | 127 | } |
128 | spin_unlock(&dev_priv->ramin_lock); | ||
123 | } | 129 | } |