diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-12-02 11:25:04 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-12-02 11:25:04 -0500 |
| commit | c2b5adb4868c190dd9d6dc624567fa38f1ba79af (patch) | |
| tree | 64a6336ce2ed446524c2c89b1b4d91ebca05764a | |
| parent | 0efebaa72d3b8cf377c45930c78e1a0969d6355a (diff) | |
| parent | bab9efc206ba89766c53a9042eb771e87e68c42b (diff) | |
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
vmwgfx: integer overflow in vmw_kms_update_layout_ioctl()
drm/radeon/kms: fix 2D tiling CS support on EG/CM
drm/radeon/kms: fix scanout of 2D tiled buffers on EG/CM
drm: Fix lack of CRTC disable for drm_crtc_helper_set_config(.fb=NULL)
drm/radeon/kms: add some new pci ids
drm/radeon/kms: Skip ACPI call to ATIF when possible
drm/radeon/kms: Hide debugging message
drm/radeon/kms: add some loop timeouts in pageflip code
drm/nv50/disp: silence compiler warning
drm/nouveau: fix oopses caused by clear being called on unpopulated ttms
drm/nouveau: Keep RAMIN heap within the channel.
drm/nvd0/disp: fix sor dpms typo, preventing dpms on in some situations
drm/nvc0/gr: fix TP init for transform feedback offset queries
drm/nouveau: add dumb ioctl support
| -rw-r--r-- | drivers/gpu/drm/drm_crtc_helper.c | 27 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_display.c | 45 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 6 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_object.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_sgdma.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nv50_display.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvc0_graph.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvd0_display.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/atombios_crtc.c | 35 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/evergreen.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/evergreen_cs.c | 149 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/evergreen_reg.h | 29 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/evergreend.h | 31 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/r100.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/radeon_acpi.c | 11 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/rs600.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/rv770.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 11 | ||||
| -rw-r--r-- | include/drm/drm_pciids.h | 8 |
20 files changed, 349 insertions, 48 deletions
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 3969f7553fe7..d2619d72cece 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
| @@ -456,6 +456,30 @@ done: | |||
| 456 | EXPORT_SYMBOL(drm_crtc_helper_set_mode); | 456 | EXPORT_SYMBOL(drm_crtc_helper_set_mode); |
| 457 | 457 | ||
| 458 | 458 | ||
| 459 | static int | ||
| 460 | drm_crtc_helper_disable(struct drm_crtc *crtc) | ||
| 461 | { | ||
| 462 | struct drm_device *dev = crtc->dev; | ||
| 463 | struct drm_connector *connector; | ||
| 464 | struct drm_encoder *encoder; | ||
| 465 | |||
| 466 | /* Decouple all encoders and their attached connectors from this crtc */ | ||
| 467 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | ||
| 468 | if (encoder->crtc != crtc) | ||
| 469 | continue; | ||
| 470 | |||
| 471 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
| 472 | if (connector->encoder != encoder) | ||
| 473 | continue; | ||
| 474 | |||
| 475 | connector->encoder = NULL; | ||
| 476 | } | ||
| 477 | } | ||
| 478 | |||
| 479 | drm_helper_disable_unused_functions(dev); | ||
| 480 | return 0; | ||
| 481 | } | ||
| 482 | |||
| 459 | /** | 483 | /** |
| 460 | * drm_crtc_helper_set_config - set a new config from userspace | 484 | * drm_crtc_helper_set_config - set a new config from userspace |
| 461 | * @crtc: CRTC to setup | 485 | * @crtc: CRTC to setup |
| @@ -510,8 +534,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
| 510 | (int)set->num_connectors, set->x, set->y); | 534 | (int)set->num_connectors, set->x, set->y); |
| 511 | } else { | 535 | } else { |
| 512 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id); | 536 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id); |
| 513 | set->mode = NULL; | 537 | return drm_crtc_helper_disable(set->crtc); |
| 514 | set->num_connectors = 0; | ||
| 515 | } | 538 | } |
| 516 | 539 | ||
| 517 | dev = set->crtc->dev; | 540 | dev = set->crtc->dev; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index ddbabefb4273..b12fd2c80812 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
| @@ -369,3 +369,48 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, | |||
| 369 | spin_unlock_irqrestore(&dev->event_lock, flags); | 369 | spin_unlock_irqrestore(&dev->event_lock, flags); |
| 370 | return 0; | 370 | return 0; |
| 371 | } | 371 | } |
| 372 | |||
| 373 | int | ||
| 374 | nouveau_display_dumb_create(struct drm_file *file_priv, struct drm_device *dev, | ||
| 375 | struct drm_mode_create_dumb *args) | ||
| 376 | { | ||
| 377 | struct nouveau_bo *bo; | ||
| 378 | int ret; | ||
| 379 | |||
| 380 | args->pitch = roundup(args->width * (args->bpp / 8), 256); | ||
| 381 | args->size = args->pitch * args->height; | ||
| 382 | args->size = roundup(args->size, PAGE_SIZE); | ||
| 383 | |||
| 384 | ret = nouveau_gem_new(dev, args->size, 0, TTM_PL_FLAG_VRAM, 0, 0, &bo); | ||
| 385 | if (ret) | ||
| 386 | return ret; | ||
| 387 | |||
| 388 | ret = drm_gem_handle_create(file_priv, bo->gem, &args->handle); | ||
| 389 | drm_gem_object_unreference_unlocked(bo->gem); | ||
| 390 | return ret; | ||
| 391 | } | ||
| 392 | |||
| 393 | int | ||
| 394 | nouveau_display_dumb_destroy(struct drm_file *file_priv, struct drm_device *dev, | ||
| 395 | uint32_t handle) | ||
| 396 | { | ||
| 397 | return drm_gem_handle_delete(file_priv, handle); | ||
| 398 | } | ||
| 399 | |||
| 400 | int | ||
| 401 | nouveau_display_dumb_map_offset(struct drm_file *file_priv, | ||
| 402 | struct drm_device *dev, | ||
| 403 | uint32_t handle, uint64_t *poffset) | ||
| 404 | { | ||
| 405 | struct drm_gem_object *gem; | ||
| 406 | |||
| 407 | gem = drm_gem_object_lookup(dev, file_priv, handle); | ||
| 408 | if (gem) { | ||
| 409 | struct nouveau_bo *bo = gem->driver_private; | ||
| 410 | *poffset = bo->bo.addr_space_offset; | ||
| 411 | drm_gem_object_unreference_unlocked(gem); | ||
| 412 | return 0; | ||
| 413 | } | ||
| 414 | |||
| 415 | return -ENOENT; | ||
| 416 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index 9f7bb1295262..9791d13c9e3b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
| @@ -433,6 +433,10 @@ static struct drm_driver driver = { | |||
| 433 | .gem_open_object = nouveau_gem_object_open, | 433 | .gem_open_object = nouveau_gem_object_open, |
| 434 | .gem_close_object = nouveau_gem_object_close, | 434 | .gem_close_object = nouveau_gem_object_close, |
| 435 | 435 | ||
| 436 | .dumb_create = nouveau_display_dumb_create, | ||
| 437 | .dumb_map_offset = nouveau_display_dumb_map_offset, | ||
| 438 | .dumb_destroy = nouveau_display_dumb_destroy, | ||
| 439 | |||
| 436 | .name = DRIVER_NAME, | 440 | .name = DRIVER_NAME, |
| 437 | .desc = DRIVER_DESC, | 441 | .desc = DRIVER_DESC, |
| 438 | #ifdef GIT_REVISION | 442 | #ifdef GIT_REVISION |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 29837da1098b..4c0be3a4ed88 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
| @@ -1418,6 +1418,12 @@ int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
| 1418 | struct drm_pending_vblank_event *event); | 1418 | struct drm_pending_vblank_event *event); |
| 1419 | int nouveau_finish_page_flip(struct nouveau_channel *, | 1419 | int nouveau_finish_page_flip(struct nouveau_channel *, |
| 1420 | struct nouveau_page_flip_state *); | 1420 | struct nouveau_page_flip_state *); |
| 1421 | int nouveau_display_dumb_create(struct drm_file *, struct drm_device *, | ||
| 1422 | struct drm_mode_create_dumb *args); | ||
| 1423 | int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *, | ||
| 1424 | uint32_t handle, uint64_t *offset); | ||
| 1425 | int nouveau_display_dumb_destroy(struct drm_file *, struct drm_device *, | ||
| 1426 | uint32_t handle); | ||
| 1421 | 1427 | ||
| 1422 | /* nv10_gpio.c */ | 1428 | /* nv10_gpio.c */ |
| 1423 | int nv10_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); | 1429 | int nv10_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 02222c540aee..960c0ae0c0c3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
| @@ -680,7 +680,7 @@ nouveau_gpuobj_channel_init_pramin(struct nouveau_channel *chan) | |||
| 680 | return ret; | 680 | return ret; |
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | ret = drm_mm_init(&chan->ramin_heap, base, size); | 683 | ret = drm_mm_init(&chan->ramin_heap, base, size - base); |
| 684 | if (ret) { | 684 | if (ret) { |
| 685 | NV_ERROR(dev, "Error creating PRAMIN heap: %d\n", ret); | 685 | NV_ERROR(dev, "Error creating PRAMIN heap: %d\n", ret); |
| 686 | nouveau_gpuobj_ref(NULL, &chan->ramin); | 686 | nouveau_gpuobj_ref(NULL, &chan->ramin); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index b75258a9fe44..c8a463b76c89 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
| @@ -67,7 +67,10 @@ nouveau_sgdma_clear(struct ttm_backend *be) | |||
| 67 | pci_unmap_page(dev->pdev, nvbe->pages[nvbe->nr_pages], | 67 | pci_unmap_page(dev->pdev, nvbe->pages[nvbe->nr_pages], |
| 68 | PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); | 68 | PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); |
| 69 | } | 69 | } |
| 70 | nvbe->unmap_pages = false; | ||
| 70 | } | 71 | } |
| 72 | |||
| 73 | nvbe->pages = NULL; | ||
| 71 | } | 74 | } |
| 72 | 75 | ||
| 73 | static void | 76 | static void |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index d23ca00e7d62..06de250fe617 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
| @@ -616,7 +616,7 @@ nv50_display_unk10_handler(struct drm_device *dev) | |||
| 616 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 616 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 617 | struct nv50_display *disp = nv50_display(dev); | 617 | struct nv50_display *disp = nv50_display(dev); |
| 618 | u32 unk30 = nv_rd32(dev, 0x610030), mc; | 618 | u32 unk30 = nv_rd32(dev, 0x610030), mc; |
| 619 | int i, crtc, or, type = OUTPUT_ANY; | 619 | int i, crtc, or = 0, type = OUTPUT_ANY; |
| 620 | 620 | ||
| 621 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); | 621 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); |
| 622 | disp->irq.dcb = NULL; | 622 | disp->irq.dcb = NULL; |
| @@ -708,7 +708,7 @@ nv50_display_unk20_handler(struct drm_device *dev) | |||
| 708 | struct nv50_display *disp = nv50_display(dev); | 708 | struct nv50_display *disp = nv50_display(dev); |
| 709 | u32 unk30 = nv_rd32(dev, 0x610030), tmp, pclk, script, mc = 0; | 709 | u32 unk30 = nv_rd32(dev, 0x610030), tmp, pclk, script, mc = 0; |
| 710 | struct dcb_entry *dcb; | 710 | struct dcb_entry *dcb; |
| 711 | int i, crtc, or, type = OUTPUT_ANY; | 711 | int i, crtc, or = 0, type = OUTPUT_ANY; |
| 712 | 712 | ||
| 713 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); | 713 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); |
| 714 | dcb = disp->irq.dcb; | 714 | dcb = disp->irq.dcb; |
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c index a74e501afd25..ecfafd70cf0e 100644 --- a/drivers/gpu/drm/nouveau/nvc0_graph.c +++ b/drivers/gpu/drm/nouveau/nvc0_graph.c | |||
| @@ -381,6 +381,8 @@ nvc0_graph_init_gpc_0(struct drm_device *dev) | |||
| 381 | u8 tpnr[GPC_MAX]; | 381 | u8 tpnr[GPC_MAX]; |
| 382 | int i, gpc, tpc; | 382 | int i, gpc, tpc; |
| 383 | 383 | ||
| 384 | nv_wr32(dev, TP_UNIT(0, 0, 0x5c), 1); /* affects TFB offset queries */ | ||
| 385 | |||
| 384 | /* | 386 | /* |
| 385 | * TP ROP UNKVAL(magic_not_rop_nr) | 387 | * TP ROP UNKVAL(magic_not_rop_nr) |
| 386 | * 450: 4/0/0/0 2 3 | 388 | * 450: 4/0/0/0 2 3 |
diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c index 23d63b4b3d77..cb006a718e70 100644 --- a/drivers/gpu/drm/nouveau/nvd0_display.c +++ b/drivers/gpu/drm/nouveau/nvd0_display.c | |||
| @@ -780,7 +780,7 @@ nvd0_sor_dpms(struct drm_encoder *encoder, int mode) | |||
| 780 | continue; | 780 | continue; |
| 781 | 781 | ||
| 782 | if (nv_partner != nv_encoder && | 782 | if (nv_partner != nv_encoder && |
| 783 | nv_partner->dcb->or == nv_encoder->or) { | 783 | nv_partner->dcb->or == nv_encoder->dcb->or) { |
| 784 | if (nv_partner->last_dpms == DRM_MODE_DPMS_ON) | 784 | if (nv_partner->last_dpms == DRM_MODE_DPMS_ON) |
| 785 | return; | 785 | return; |
| 786 | break; | 786 | break; |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 87631fede1f8..2b97262e3ab1 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
| @@ -1107,9 +1107,40 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1107 | return -EINVAL; | 1107 | return -EINVAL; |
| 1108 | } | 1108 | } |
| 1109 | 1109 | ||
| 1110 | if (tiling_flags & RADEON_TILING_MACRO) | 1110 | if (tiling_flags & RADEON_TILING_MACRO) { |
| 1111 | if (rdev->family >= CHIP_CAYMAN) | ||
| 1112 | tmp = rdev->config.cayman.tile_config; | ||
| 1113 | else | ||
| 1114 | tmp = rdev->config.evergreen.tile_config; | ||
| 1115 | |||
| 1116 | switch ((tmp & 0xf0) >> 4) { | ||
| 1117 | case 0: /* 4 banks */ | ||
| 1118 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_4_BANK); | ||
| 1119 | break; | ||
| 1120 | case 1: /* 8 banks */ | ||
| 1121 | default: | ||
| 1122 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_8_BANK); | ||
| 1123 | break; | ||
| 1124 | case 2: /* 16 banks */ | ||
| 1125 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_16_BANK); | ||
| 1126 | break; | ||
| 1127 | } | ||
| 1128 | |||
| 1129 | switch ((tmp & 0xf000) >> 12) { | ||
| 1130 | case 0: /* 1KB rows */ | ||
| 1131 | default: | ||
| 1132 | fb_format |= EVERGREEN_GRPH_TILE_SPLIT(EVERGREEN_ADDR_SURF_TILE_SPLIT_1KB); | ||
| 1133 | break; | ||
| 1134 | case 1: /* 2KB rows */ | ||
| 1135 | fb_format |= EVERGREEN_GRPH_TILE_SPLIT(EVERGREEN_ADDR_SURF_TILE_SPLIT_2KB); | ||
| 1136 | break; | ||
| 1137 | case 2: /* 4KB rows */ | ||
| 1138 | fb_format |= EVERGREEN_GRPH_TILE_SPLIT(EVERGREEN_ADDR_SURF_TILE_SPLIT_4KB); | ||
| 1139 | break; | ||
| 1140 | } | ||
| 1141 | |||
| 1111 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1); | 1142 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1); |
| 1112 | else if (tiling_flags & RADEON_TILING_MICRO) | 1143 | } else if (tiling_flags & RADEON_TILING_MICRO) |
| 1113 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1); | 1144 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1); |
| 1114 | 1145 | ||
| 1115 | switch (radeon_crtc->crtc_id) { | 1146 | switch (radeon_crtc->crtc_id) { |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 1d603a3335db..5e00d1670aa9 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
| @@ -82,6 +82,7 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 82 | { | 82 | { |
| 83 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 83 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
| 84 | u32 tmp = RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset); | 84 | u32 tmp = RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset); |
| 85 | int i; | ||
| 85 | 86 | ||
| 86 | /* Lock the graphics update lock */ | 87 | /* Lock the graphics update lock */ |
| 87 | tmp |= EVERGREEN_GRPH_UPDATE_LOCK; | 88 | tmp |= EVERGREEN_GRPH_UPDATE_LOCK; |
| @@ -99,7 +100,11 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 99 | (u32)crtc_base); | 100 | (u32)crtc_base); |
| 100 | 101 | ||
| 101 | /* Wait for update_pending to go high. */ | 102 | /* Wait for update_pending to go high. */ |
| 102 | while (!(RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset) & EVERGREEN_GRPH_SURFACE_UPDATE_PENDING)); | 103 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 104 | if (RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset) & EVERGREEN_GRPH_SURFACE_UPDATE_PENDING) | ||
| 105 | break; | ||
| 106 | udelay(1); | ||
| 107 | } | ||
| 103 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); | 108 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
| 104 | 109 | ||
| 105 | /* Unlock the lock, so double-buffering can take place inside vblank */ | 110 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 38e1bda73d33..cd4590aae154 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | |||
| @@ -38,6 +38,7 @@ struct evergreen_cs_track { | |||
| 38 | u32 group_size; | 38 | u32 group_size; |
| 39 | u32 nbanks; | 39 | u32 nbanks; |
| 40 | u32 npipes; | 40 | u32 npipes; |
| 41 | u32 row_size; | ||
| 41 | /* value we track */ | 42 | /* value we track */ |
| 42 | u32 nsamples; | 43 | u32 nsamples; |
| 43 | u32 cb_color_base_last[12]; | 44 | u32 cb_color_base_last[12]; |
| @@ -77,6 +78,44 @@ struct evergreen_cs_track { | |||
| 77 | struct radeon_bo *db_s_write_bo; | 78 | struct radeon_bo *db_s_write_bo; |
| 78 | }; | 79 | }; |
| 79 | 80 | ||
| 81 | static u32 evergreen_cs_get_aray_mode(u32 tiling_flags) | ||
| 82 | { | ||
| 83 | if (tiling_flags & RADEON_TILING_MACRO) | ||
| 84 | return ARRAY_2D_TILED_THIN1; | ||
| 85 | else if (tiling_flags & RADEON_TILING_MICRO) | ||
| 86 | return ARRAY_1D_TILED_THIN1; | ||
| 87 | else | ||
| 88 | return ARRAY_LINEAR_GENERAL; | ||
| 89 | } | ||
| 90 | |||
| 91 | static u32 evergreen_cs_get_num_banks(u32 nbanks) | ||
| 92 | { | ||
| 93 | switch (nbanks) { | ||
| 94 | case 2: | ||
| 95 | return ADDR_SURF_2_BANK; | ||
| 96 | case 4: | ||
| 97 | return ADDR_SURF_4_BANK; | ||
| 98 | case 8: | ||
| 99 | default: | ||
| 100 | return ADDR_SURF_8_BANK; | ||
| 101 | case 16: | ||
| 102 | return ADDR_SURF_16_BANK; | ||
| 103 | } | ||
| 104 | } | ||
| 105 | |||
| 106 | static u32 evergreen_cs_get_tile_split(u32 row_size) | ||
| 107 | { | ||
| 108 | switch (row_size) { | ||
| 109 | case 1: | ||
| 110 | default: | ||
| 111 | return ADDR_SURF_TILE_SPLIT_1KB; | ||
| 112 | case 2: | ||
| 113 | return ADDR_SURF_TILE_SPLIT_2KB; | ||
| 114 | case 4: | ||
| 115 | return ADDR_SURF_TILE_SPLIT_4KB; | ||
| 116 | } | ||
| 117 | } | ||
| 118 | |||
| 80 | static void evergreen_cs_track_init(struct evergreen_cs_track *track) | 119 | static void evergreen_cs_track_init(struct evergreen_cs_track *track) |
| 81 | { | 120 | { |
| 82 | int i; | 121 | int i; |
| @@ -490,12 +529,11 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
| 490 | } | 529 | } |
| 491 | ib[idx] &= ~Z_ARRAY_MODE(0xf); | 530 | ib[idx] &= ~Z_ARRAY_MODE(0xf); |
| 492 | track->db_z_info &= ~Z_ARRAY_MODE(0xf); | 531 | track->db_z_info &= ~Z_ARRAY_MODE(0xf); |
| 532 | ib[idx] |= Z_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); | ||
| 533 | track->db_z_info |= Z_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); | ||
| 493 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | 534 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { |
| 494 | ib[idx] |= Z_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 535 | ib[idx] |= DB_NUM_BANKS(evergreen_cs_get_num_banks(track->nbanks)); |
| 495 | track->db_z_info |= Z_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 536 | ib[idx] |= DB_TILE_SPLIT(evergreen_cs_get_tile_split(track->row_size)); |
| 496 | } else { | ||
| 497 | ib[idx] |= Z_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
| 498 | track->db_z_info |= Z_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
| 499 | } | 537 | } |
| 500 | } | 538 | } |
| 501 | break; | 539 | break; |
| @@ -618,13 +656,8 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
| 618 | "0x%04X\n", reg); | 656 | "0x%04X\n", reg); |
| 619 | return -EINVAL; | 657 | return -EINVAL; |
| 620 | } | 658 | } |
| 621 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | 659 | ib[idx] |= CB_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
| 622 | ib[idx] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 660 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
| 623 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | ||
| 624 | } else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) { | ||
| 625 | ib[idx] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
| 626 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
| 627 | } | ||
| 628 | } | 661 | } |
| 629 | break; | 662 | break; |
| 630 | case CB_COLOR8_INFO: | 663 | case CB_COLOR8_INFO: |
| @@ -640,13 +673,8 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
| 640 | "0x%04X\n", reg); | 673 | "0x%04X\n", reg); |
| 641 | return -EINVAL; | 674 | return -EINVAL; |
| 642 | } | 675 | } |
| 643 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | 676 | ib[idx] |= CB_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
| 644 | ib[idx] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 677 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
| 645 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | ||
| 646 | } else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) { | ||
| 647 | ib[idx] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
| 648 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
| 649 | } | ||
| 650 | } | 678 | } |
| 651 | break; | 679 | break; |
| 652 | case CB_COLOR0_PITCH: | 680 | case CB_COLOR0_PITCH: |
| @@ -701,6 +729,16 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
| 701 | case CB_COLOR9_ATTRIB: | 729 | case CB_COLOR9_ATTRIB: |
| 702 | case CB_COLOR10_ATTRIB: | 730 | case CB_COLOR10_ATTRIB: |
| 703 | case CB_COLOR11_ATTRIB: | 731 | case CB_COLOR11_ATTRIB: |
| 732 | r = evergreen_cs_packet_next_reloc(p, &reloc); | ||
| 733 | if (r) { | ||
| 734 | dev_warn(p->dev, "bad SET_CONTEXT_REG " | ||
| 735 | "0x%04X\n", reg); | ||
| 736 | return -EINVAL; | ||
| 737 | } | ||
| 738 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | ||
| 739 | ib[idx] |= CB_NUM_BANKS(evergreen_cs_get_num_banks(track->nbanks)); | ||
| 740 | ib[idx] |= CB_TILE_SPLIT(evergreen_cs_get_tile_split(track->row_size)); | ||
| 741 | } | ||
| 704 | break; | 742 | break; |
| 705 | case CB_COLOR0_DIM: | 743 | case CB_COLOR0_DIM: |
| 706 | case CB_COLOR1_DIM: | 744 | case CB_COLOR1_DIM: |
| @@ -1318,10 +1356,14 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, | |||
| 1318 | } | 1356 | } |
| 1319 | ib[idx+1+(i*8)+2] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1357 | ib[idx+1+(i*8)+2] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
| 1320 | if (!p->keep_tiling_flags) { | 1358 | if (!p->keep_tiling_flags) { |
| 1321 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) | 1359 | ib[idx+1+(i*8)+1] |= |
| 1322 | ib[idx+1+(i*8)+1] |= TEX_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 1360 | TEX_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
| 1323 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) | 1361 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { |
| 1324 | ib[idx+1+(i*8)+1] |= TEX_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | 1362 | ib[idx+1+(i*8)+6] |= |
| 1363 | TEX_TILE_SPLIT(evergreen_cs_get_tile_split(track->row_size)); | ||
| 1364 | ib[idx+1+(i*8)+7] |= | ||
| 1365 | TEX_NUM_BANKS(evergreen_cs_get_num_banks(track->nbanks)); | ||
| 1366 | } | ||
| 1325 | } | 1367 | } |
| 1326 | texture = reloc->robj; | 1368 | texture = reloc->robj; |
| 1327 | /* tex mip base */ | 1369 | /* tex mip base */ |
| @@ -1422,6 +1464,7 @@ int evergreen_cs_parse(struct radeon_cs_parser *p) | |||
| 1422 | { | 1464 | { |
| 1423 | struct radeon_cs_packet pkt; | 1465 | struct radeon_cs_packet pkt; |
| 1424 | struct evergreen_cs_track *track; | 1466 | struct evergreen_cs_track *track; |
| 1467 | u32 tmp; | ||
| 1425 | int r; | 1468 | int r; |
| 1426 | 1469 | ||
| 1427 | if (p->track == NULL) { | 1470 | if (p->track == NULL) { |
| @@ -1430,9 +1473,63 @@ int evergreen_cs_parse(struct radeon_cs_parser *p) | |||
| 1430 | if (track == NULL) | 1473 | if (track == NULL) |
| 1431 | return -ENOMEM; | 1474 | return -ENOMEM; |
| 1432 | evergreen_cs_track_init(track); | 1475 | evergreen_cs_track_init(track); |
| 1433 | track->npipes = p->rdev->config.evergreen.tiling_npipes; | 1476 | if (p->rdev->family >= CHIP_CAYMAN) |
| 1434 | track->nbanks = p->rdev->config.evergreen.tiling_nbanks; | 1477 | tmp = p->rdev->config.cayman.tile_config; |
| 1435 | track->group_size = p->rdev->config.evergreen.tiling_group_size; | 1478 | else |
| 1479 | tmp = p->rdev->config.evergreen.tile_config; | ||
| 1480 | |||
| 1481 | switch (tmp & 0xf) { | ||
| 1482 | case 0: | ||
| 1483 | track->npipes = 1; | ||
| 1484 | break; | ||
| 1485 | case 1: | ||
| 1486 | default: | ||
| 1487 | track->npipes = 2; | ||
| 1488 | break; | ||
| 1489 | case 2: | ||
| 1490 | track->npipes = 4; | ||
| 1491 | break; | ||
| 1492 | case 3: | ||
| 1493 | track->npipes = 8; | ||
| 1494 | break; | ||
| 1495 | } | ||
| 1496 | |||
| 1497 | switch ((tmp & 0xf0) >> 4) { | ||
| 1498 | case 0: | ||
| 1499 | track->nbanks = 4; | ||
| 1500 | break; | ||
| 1501 | case 1: | ||
| 1502 | default: | ||
| 1503 | track->nbanks = 8; | ||
| 1504 | break; | ||
| 1505 | case 2: | ||
| 1506 | track->nbanks = 16; | ||
| 1507 | break; | ||
| 1508 | } | ||
| 1509 | |||
| 1510 | switch ((tmp & 0xf00) >> 8) { | ||
| 1511 | case 0: | ||
| 1512 | track->group_size = 256; | ||
| 1513 | break; | ||
| 1514 | case 1: | ||
| 1515 | default: | ||
| 1516 | track->group_size = 512; | ||
| 1517 | break; | ||
| 1518 | } | ||
| 1519 | |||
| 1520 | switch ((tmp & 0xf000) >> 12) { | ||
| 1521 | case 0: | ||
| 1522 | track->row_size = 1; | ||
| 1523 | break; | ||
| 1524 | case 1: | ||
| 1525 | default: | ||
| 1526 | track->row_size = 2; | ||
| 1527 | break; | ||
| 1528 | case 2: | ||
| 1529 | track->row_size = 4; | ||
| 1530 | break; | ||
| 1531 | } | ||
| 1532 | |||
| 1436 | p->track = track; | 1533 | p->track = track; |
| 1437 | } | 1534 | } |
| 1438 | do { | 1535 | do { |
diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h b/drivers/gpu/drm/radeon/evergreen_reg.h index c781c92c3451..7d7f2155e34c 100644 --- a/drivers/gpu/drm/radeon/evergreen_reg.h +++ b/drivers/gpu/drm/radeon/evergreen_reg.h | |||
| @@ -42,6 +42,17 @@ | |||
| 42 | # define EVERGREEN_GRPH_DEPTH_8BPP 0 | 42 | # define EVERGREEN_GRPH_DEPTH_8BPP 0 |
| 43 | # define EVERGREEN_GRPH_DEPTH_16BPP 1 | 43 | # define EVERGREEN_GRPH_DEPTH_16BPP 1 |
| 44 | # define EVERGREEN_GRPH_DEPTH_32BPP 2 | 44 | # define EVERGREEN_GRPH_DEPTH_32BPP 2 |
| 45 | # define EVERGREEN_GRPH_NUM_BANKS(x) (((x) & 0x3) << 2) | ||
| 46 | # define EVERGREEN_ADDR_SURF_2_BANK 0 | ||
| 47 | # define EVERGREEN_ADDR_SURF_4_BANK 1 | ||
| 48 | # define EVERGREEN_ADDR_SURF_8_BANK 2 | ||
| 49 | # define EVERGREEN_ADDR_SURF_16_BANK 3 | ||
| 50 | # define EVERGREEN_GRPH_Z(x) (((x) & 0x3) << 4) | ||
| 51 | # define EVERGREEN_GRPH_BANK_WIDTH(x) (((x) & 0x3) << 6) | ||
| 52 | # define EVERGREEN_ADDR_SURF_BANK_WIDTH_1 0 | ||
| 53 | # define EVERGREEN_ADDR_SURF_BANK_WIDTH_2 1 | ||
| 54 | # define EVERGREEN_ADDR_SURF_BANK_WIDTH_4 2 | ||
| 55 | # define EVERGREEN_ADDR_SURF_BANK_WIDTH_8 3 | ||
| 45 | # define EVERGREEN_GRPH_FORMAT(x) (((x) & 0x7) << 8) | 56 | # define EVERGREEN_GRPH_FORMAT(x) (((x) & 0x7) << 8) |
| 46 | /* 8 BPP */ | 57 | /* 8 BPP */ |
| 47 | # define EVERGREEN_GRPH_FORMAT_INDEXED 0 | 58 | # define EVERGREEN_GRPH_FORMAT_INDEXED 0 |
| @@ -61,6 +72,24 @@ | |||
| 61 | # define EVERGREEN_GRPH_FORMAT_8B_BGRA1010102 5 | 72 | # define EVERGREEN_GRPH_FORMAT_8B_BGRA1010102 5 |
| 62 | # define EVERGREEN_GRPH_FORMAT_RGB111110 6 | 73 | # define EVERGREEN_GRPH_FORMAT_RGB111110 6 |
| 63 | # define EVERGREEN_GRPH_FORMAT_BGR101111 7 | 74 | # define EVERGREEN_GRPH_FORMAT_BGR101111 7 |
| 75 | # define EVERGREEN_GRPH_BANK_HEIGHT(x) (((x) & 0x3) << 11) | ||
| 76 | # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_1 0 | ||
| 77 | # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_2 1 | ||
| 78 | # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_4 2 | ||
| 79 | # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_8 3 | ||
| 80 | # define EVERGREEN_GRPH_TILE_SPLIT(x) (((x) & 0x7) << 13) | ||
| 81 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_64B 0 | ||
| 82 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_128B 1 | ||
| 83 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_256B 2 | ||
| 84 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_512B 3 | ||
| 85 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_1KB 4 | ||
| 86 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_2KB 5 | ||
| 87 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_4KB 6 | ||
| 88 | # define EVERGREEN_GRPH_MACRO_TILE_ASPECT(x) (((x) & 0x3) << 18) | ||
| 89 | # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_1 0 | ||
| 90 | # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_2 1 | ||
| 91 | # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_4 2 | ||
| 92 | # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_8 3 | ||
| 64 | # define EVERGREEN_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20) | 93 | # define EVERGREEN_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20) |
| 65 | # define EVERGREEN_GRPH_ARRAY_LINEAR_GENERAL 0 | 94 | # define EVERGREEN_GRPH_ARRAY_LINEAR_GENERAL 0 |
| 66 | # define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED 1 | 95 | # define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED 1 |
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index b937c49054d9..e00039e59a75 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
| @@ -899,6 +899,10 @@ | |||
| 899 | #define DB_HTILE_DATA_BASE 0x28014 | 899 | #define DB_HTILE_DATA_BASE 0x28014 |
| 900 | #define DB_Z_INFO 0x28040 | 900 | #define DB_Z_INFO 0x28040 |
| 901 | # define Z_ARRAY_MODE(x) ((x) << 4) | 901 | # define Z_ARRAY_MODE(x) ((x) << 4) |
| 902 | # define DB_TILE_SPLIT(x) (((x) & 0x7) << 8) | ||
| 903 | # define DB_NUM_BANKS(x) (((x) & 0x3) << 12) | ||
| 904 | # define DB_BANK_WIDTH(x) (((x) & 0x3) << 16) | ||
| 905 | # define DB_BANK_HEIGHT(x) (((x) & 0x3) << 20) | ||
| 902 | #define DB_STENCIL_INFO 0x28044 | 906 | #define DB_STENCIL_INFO 0x28044 |
| 903 | #define DB_Z_READ_BASE 0x28048 | 907 | #define DB_Z_READ_BASE 0x28048 |
| 904 | #define DB_STENCIL_READ_BASE 0x2804c | 908 | #define DB_STENCIL_READ_BASE 0x2804c |
| @@ -951,6 +955,29 @@ | |||
| 951 | # define CB_SF_EXPORT_FULL 0 | 955 | # define CB_SF_EXPORT_FULL 0 |
| 952 | # define CB_SF_EXPORT_NORM 1 | 956 | # define CB_SF_EXPORT_NORM 1 |
| 953 | #define CB_COLOR0_ATTRIB 0x28c74 | 957 | #define CB_COLOR0_ATTRIB 0x28c74 |
| 958 | # define CB_TILE_SPLIT(x) (((x) & 0x7) << 5) | ||
| 959 | # define ADDR_SURF_TILE_SPLIT_64B 0 | ||
| 960 | # define ADDR_SURF_TILE_SPLIT_128B 1 | ||
| 961 | # define ADDR_SURF_TILE_SPLIT_256B 2 | ||
| 962 | # define ADDR_SURF_TILE_SPLIT_512B 3 | ||
| 963 | # define ADDR_SURF_TILE_SPLIT_1KB 4 | ||
| 964 | # define ADDR_SURF_TILE_SPLIT_2KB 5 | ||
| 965 | # define ADDR_SURF_TILE_SPLIT_4KB 6 | ||
| 966 | # define CB_NUM_BANKS(x) (((x) & 0x3) << 10) | ||
| 967 | # define ADDR_SURF_2_BANK 0 | ||
| 968 | # define ADDR_SURF_4_BANK 1 | ||
| 969 | # define ADDR_SURF_8_BANK 2 | ||
| 970 | # define ADDR_SURF_16_BANK 3 | ||
| 971 | # define CB_BANK_WIDTH(x) (((x) & 0x3) << 13) | ||
| 972 | # define ADDR_SURF_BANK_WIDTH_1 0 | ||
| 973 | # define ADDR_SURF_BANK_WIDTH_2 1 | ||
| 974 | # define ADDR_SURF_BANK_WIDTH_4 2 | ||
| 975 | # define ADDR_SURF_BANK_WIDTH_8 3 | ||
| 976 | # define CB_BANK_HEIGHT(x) (((x) & 0x3) << 16) | ||
| 977 | # define ADDR_SURF_BANK_HEIGHT_1 0 | ||
| 978 | # define ADDR_SURF_BANK_HEIGHT_2 1 | ||
| 979 | # define ADDR_SURF_BANK_HEIGHT_4 2 | ||
| 980 | # define ADDR_SURF_BANK_HEIGHT_8 3 | ||
| 954 | #define CB_COLOR0_DIM 0x28c78 | 981 | #define CB_COLOR0_DIM 0x28c78 |
| 955 | /* only CB0-7 blocks have these regs */ | 982 | /* only CB0-7 blocks have these regs */ |
| 956 | #define CB_COLOR0_CMASK 0x28c7c | 983 | #define CB_COLOR0_CMASK 0x28c7c |
| @@ -1137,7 +1164,11 @@ | |||
| 1137 | # define SQ_SEL_1 5 | 1164 | # define SQ_SEL_1 5 |
| 1138 | #define SQ_TEX_RESOURCE_WORD5_0 0x30014 | 1165 | #define SQ_TEX_RESOURCE_WORD5_0 0x30014 |
| 1139 | #define SQ_TEX_RESOURCE_WORD6_0 0x30018 | 1166 | #define SQ_TEX_RESOURCE_WORD6_0 0x30018 |
| 1167 | # define TEX_TILE_SPLIT(x) (((x) & 0x7) << 29) | ||
| 1140 | #define SQ_TEX_RESOURCE_WORD7_0 0x3001c | 1168 | #define SQ_TEX_RESOURCE_WORD7_0 0x3001c |
| 1169 | # define TEX_BANK_WIDTH(x) (((x) & 0x3) << 8) | ||
| 1170 | # define TEX_BANK_HEIGHT(x) (((x) & 0x3) << 10) | ||
| 1171 | # define TEX_NUM_BANKS(x) (((x) & 0x3) << 16) | ||
| 1141 | 1172 | ||
| 1142 | #define SQ_VTX_CONSTANT_WORD0_0 0x30000 | 1173 | #define SQ_VTX_CONSTANT_WORD0_0 0x30000 |
| 1143 | #define SQ_VTX_CONSTANT_WORD1_0 0x30004 | 1174 | #define SQ_VTX_CONSTANT_WORD1_0 0x30004 |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index ad158ea49901..bfc08f6320f8 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
| @@ -187,13 +187,18 @@ u32 r100_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 187 | { | 187 | { |
| 188 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 188 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
| 189 | u32 tmp = ((u32)crtc_base) | RADEON_CRTC_OFFSET__OFFSET_LOCK; | 189 | u32 tmp = ((u32)crtc_base) | RADEON_CRTC_OFFSET__OFFSET_LOCK; |
| 190 | int i; | ||
| 190 | 191 | ||
| 191 | /* Lock the graphics update lock */ | 192 | /* Lock the graphics update lock */ |
| 192 | /* update the scanout addresses */ | 193 | /* update the scanout addresses */ |
| 193 | WREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset, tmp); | 194 | WREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset, tmp); |
| 194 | 195 | ||
| 195 | /* Wait for update_pending to go high. */ | 196 | /* Wait for update_pending to go high. */ |
| 196 | while (!(RREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) & RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET)); | 197 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 198 | if (RREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) & RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET) | ||
| 199 | break; | ||
| 200 | udelay(1); | ||
| 201 | } | ||
| 197 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); | 202 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
| 198 | 203 | ||
| 199 | /* Unlock the lock, so double-buffering can take place inside vblank */ | 204 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c index 3f6636bb2d7f..3516a6081dcf 100644 --- a/drivers/gpu/drm/radeon/radeon_acpi.c +++ b/drivers/gpu/drm/radeon/radeon_acpi.c | |||
| @@ -35,7 +35,8 @@ static int radeon_atif_call(acpi_handle handle) | |||
| 35 | 35 | ||
| 36 | /* Fail only if calling the method fails and ATIF is supported */ | 36 | /* Fail only if calling the method fails and ATIF is supported */ |
| 37 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 37 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
| 38 | printk(KERN_DEBUG "failed to evaluate ATIF got %s\n", acpi_format_exception(status)); | 38 | DRM_DEBUG_DRIVER("failed to evaluate ATIF got %s\n", |
| 39 | acpi_format_exception(status)); | ||
| 39 | kfree(buffer.pointer); | 40 | kfree(buffer.pointer); |
| 40 | return 1; | 41 | return 1; |
| 41 | } | 42 | } |
| @@ -50,13 +51,13 @@ int radeon_acpi_init(struct radeon_device *rdev) | |||
| 50 | acpi_handle handle; | 51 | acpi_handle handle; |
| 51 | int ret; | 52 | int ret; |
| 52 | 53 | ||
| 53 | /* No need to proceed if we're sure that ATIF is not supported */ | ||
| 54 | if (!ASIC_IS_AVIVO(rdev) || !rdev->bios) | ||
| 55 | return 0; | ||
| 56 | |||
| 57 | /* Get the device handle */ | 54 | /* Get the device handle */ |
| 58 | handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); | 55 | handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); |
| 59 | 56 | ||
| 57 | /* No need to proceed if we're sure that ATIF is not supported */ | ||
| 58 | if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle) | ||
| 59 | return 0; | ||
| 60 | |||
| 60 | /* Call the ATIF method */ | 61 | /* Call the ATIF method */ |
| 61 | ret = radeon_atif_call(handle); | 62 | ret = radeon_atif_call(handle); |
| 62 | if (ret) | 63 | if (ret) |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 481b99e89f65..b1053d640423 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
| @@ -62,6 +62,7 @@ u32 rs600_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 62 | { | 62 | { |
| 63 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 63 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
| 64 | u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); | 64 | u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); |
| 65 | int i; | ||
| 65 | 66 | ||
| 66 | /* Lock the graphics update lock */ | 67 | /* Lock the graphics update lock */ |
| 67 | tmp |= AVIVO_D1GRPH_UPDATE_LOCK; | 68 | tmp |= AVIVO_D1GRPH_UPDATE_LOCK; |
| @@ -74,7 +75,11 @@ u32 rs600_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 74 | (u32)crtc_base); | 75 | (u32)crtc_base); |
| 75 | 76 | ||
| 76 | /* Wait for update_pending to go high. */ | 77 | /* Wait for update_pending to go high. */ |
| 77 | while (!(RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING)); | 78 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 79 | if (RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING) | ||
| 80 | break; | ||
| 81 | udelay(1); | ||
| 82 | } | ||
| 78 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); | 83 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
| 79 | 84 | ||
| 80 | /* Unlock the lock, so double-buffering can take place inside vblank */ | 85 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index a983f410ab89..23ae1c60ab3d 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
| @@ -47,6 +47,7 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 47 | { | 47 | { |
| 48 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 48 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
| 49 | u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); | 49 | u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); |
| 50 | int i; | ||
| 50 | 51 | ||
| 51 | /* Lock the graphics update lock */ | 52 | /* Lock the graphics update lock */ |
| 52 | tmp |= AVIVO_D1GRPH_UPDATE_LOCK; | 53 | tmp |= AVIVO_D1GRPH_UPDATE_LOCK; |
| @@ -66,7 +67,11 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 66 | (u32)crtc_base); | 67 | (u32)crtc_base); |
| 67 | 68 | ||
| 68 | /* Wait for update_pending to go high. */ | 69 | /* Wait for update_pending to go high. */ |
| 69 | while (!(RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING)); | 70 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 71 | if (RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING) | ||
| 72 | break; | ||
| 73 | udelay(1); | ||
| 74 | } | ||
| 70 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); | 75 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
| 71 | 76 | ||
| 72 | /* Unlock the lock, so double-buffering can take place inside vblank */ | 77 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 880e285d7578..37d40545ed77 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
| @@ -1809,7 +1809,8 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, | |||
| 1809 | } | 1809 | } |
| 1810 | 1810 | ||
| 1811 | rects_size = arg->num_outputs * sizeof(struct drm_vmw_rect); | 1811 | rects_size = arg->num_outputs * sizeof(struct drm_vmw_rect); |
| 1812 | rects = kzalloc(rects_size, GFP_KERNEL); | 1812 | rects = kcalloc(arg->num_outputs, sizeof(struct drm_vmw_rect), |
| 1813 | GFP_KERNEL); | ||
| 1813 | if (unlikely(!rects)) { | 1814 | if (unlikely(!rects)) { |
| 1814 | ret = -ENOMEM; | 1815 | ret = -ENOMEM; |
| 1815 | goto out_unlock; | 1816 | goto out_unlock; |
| @@ -1824,10 +1825,10 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, | |||
| 1824 | } | 1825 | } |
| 1825 | 1826 | ||
| 1826 | for (i = 0; i < arg->num_outputs; ++i) { | 1827 | for (i = 0; i < arg->num_outputs; ++i) { |
| 1827 | if (rects->x < 0 || | 1828 | if (rects[i].x < 0 || |
| 1828 | rects->y < 0 || | 1829 | rects[i].y < 0 || |
| 1829 | rects->x + rects->w > mode_config->max_width || | 1830 | rects[i].x + rects[i].w > mode_config->max_width || |
| 1830 | rects->y + rects->h > mode_config->max_height) { | 1831 | rects[i].y + rects[i].h > mode_config->max_height) { |
| 1831 | DRM_ERROR("Invalid GUI layout.\n"); | 1832 | DRM_ERROR("Invalid GUI layout.\n"); |
| 1832 | ret = -EINVAL; | 1833 | ret = -EINVAL; |
| 1833 | goto out_free; | 1834 | goto out_free; |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index f81676f1b310..4e4fbb820e20 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
| @@ -197,6 +197,14 @@ | |||
| 197 | {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 197 | {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
| 198 | {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 198 | {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
| 199 | {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 199 | {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
| 200 | {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 201 | {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 202 | {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 203 | {0x1002, 0x6843, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 204 | {0x1002, 0x6849, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
| 205 | {0x1002, 0x6850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
| 206 | {0x1002, 0x6858, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
| 207 | {0x1002, 0x6859, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
| 200 | {0x1002, 0x6880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 208 | {0x1002, 0x6880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 201 | {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ | 209 | {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ |
| 202 | {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ | 210 | {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ |
