diff options
| author | Marcin KoĆcielnicki <koriakin@0x04.net> | 2010-01-26 13:39:20 -0500 |
|---|---|---|
| committer | Ben Skeggs <bskeggs@redhat.com> | 2010-02-08 21:48:08 -0500 |
| commit | 69c9700b544e496dc3ccf472a4f3a76dcf4abaf7 (patch) | |
| tree | 2d80752bfabdf77a42f7d432dfafed5be85f02f5 | |
| parent | a32ed69d7bb3cd259d813d71281d62993b9a70fd (diff) | |
drm/nouveau: Add getparam to get available PGRAPH units.
On nv50, this will be needed by applications using CUDA to know
how much stack/local memory to allocate.
Signed-off-by: Marcin KoĆcielnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_reg.h | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 9 | ||||
| -rw-r--r-- | include/drm/nouveau_drm.h | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_reg.h b/drivers/gpu/drm/nouveau/nouveau_reg.h index 251f1b3b38b9..aa9b310e41be 100644 --- a/drivers/gpu/drm/nouveau/nouveau_reg.h +++ b/drivers/gpu/drm/nouveau/nouveau_reg.h | |||
| @@ -99,6 +99,7 @@ | |||
| 99 | * the card will hang early on in the X init process. | 99 | * the card will hang early on in the X init process. |
| 100 | */ | 100 | */ |
| 101 | # define NV_PMC_ENABLE_UNK13 (1<<13) | 101 | # define NV_PMC_ENABLE_UNK13 (1<<13) |
| 102 | #define NV40_PMC_GRAPH_UNITS 0x00001540 | ||
| 102 | #define NV40_PMC_BACKLIGHT 0x000015f0 | 103 | #define NV40_PMC_BACKLIGHT 0x000015f0 |
| 103 | # define NV40_PMC_BACKLIGHT_MASK 0x001f0000 | 104 | # define NV40_PMC_BACKLIGHT_MASK 0x001f0000 |
| 104 | #define NV40_PMC_1700 0x00001700 | 105 | #define NV40_PMC_1700 0x00001700 |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 241e24d60eb4..fcd7610817a1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
| @@ -825,6 +825,15 @@ int nouveau_ioctl_getparam(struct drm_device *dev, void *data, | |||
| 825 | case NOUVEAU_GETPARAM_VM_VRAM_BASE: | 825 | case NOUVEAU_GETPARAM_VM_VRAM_BASE: |
| 826 | getparam->value = dev_priv->vm_vram_base; | 826 | getparam->value = dev_priv->vm_vram_base; |
| 827 | break; | 827 | break; |
| 828 | case NOUVEAU_GETPARAM_GRAPH_UNITS: | ||
| 829 | /* NV40 and NV50 versions are quite different, but register | ||
| 830 | * address is the same. User is supposed to know the card | ||
| 831 | * family anyway... */ | ||
| 832 | if (dev_priv->chipset >= 0x40) { | ||
| 833 | getparam->value = nv_rd32(dev, NV40_PMC_GRAPH_UNITS); | ||
| 834 | break; | ||
| 835 | } | ||
| 836 | /* FALLTHRU */ | ||
| 828 | default: | 837 | default: |
| 829 | NV_ERROR(dev, "unknown parameter %lld\n", getparam->param); | 838 | NV_ERROR(dev, "unknown parameter %lld\n", getparam->param); |
| 830 | return -EINVAL; | 839 | return -EINVAL; |
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h index 1e67c441ea82..f745948b61e4 100644 --- a/include/drm/nouveau_drm.h +++ b/include/drm/nouveau_drm.h | |||
| @@ -77,6 +77,7 @@ struct drm_nouveau_gpuobj_free { | |||
| 77 | #define NOUVEAU_GETPARAM_PCI_PHYSICAL 10 | 77 | #define NOUVEAU_GETPARAM_PCI_PHYSICAL 10 |
| 78 | #define NOUVEAU_GETPARAM_CHIPSET_ID 11 | 78 | #define NOUVEAU_GETPARAM_CHIPSET_ID 11 |
| 79 | #define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 | 79 | #define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 |
| 80 | #define NOUVEAU_GETPARAM_GRAPH_UNITS 13 | ||
| 80 | struct drm_nouveau_getparam { | 81 | struct drm_nouveau_getparam { |
| 81 | uint64_t param; | 82 | uint64_t param; |
| 82 | uint64_t value; | 83 | uint64_t value; |
