Commit 69c9700b authored by Marcin Kościelnicki's avatar Marcin Kościelnicki Committed by Ben Skeggs

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: default avatarMarcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent a32ed69d
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
* the card will hang early on in the X init process. * the card will hang early on in the X init process.
*/ */
# define NV_PMC_ENABLE_UNK13 (1<<13) # define NV_PMC_ENABLE_UNK13 (1<<13)
#define NV40_PMC_GRAPH_UNITS 0x00001540
#define NV40_PMC_BACKLIGHT 0x000015f0 #define NV40_PMC_BACKLIGHT 0x000015f0
# define NV40_PMC_BACKLIGHT_MASK 0x001f0000 # define NV40_PMC_BACKLIGHT_MASK 0x001f0000
#define NV40_PMC_1700 0x00001700 #define NV40_PMC_1700 0x00001700
......
...@@ -825,6 +825,15 @@ int nouveau_ioctl_getparam(struct drm_device *dev, void *data, ...@@ -825,6 +825,15 @@ int nouveau_ioctl_getparam(struct drm_device *dev, void *data,
case NOUVEAU_GETPARAM_VM_VRAM_BASE: case NOUVEAU_GETPARAM_VM_VRAM_BASE:
getparam->value = dev_priv->vm_vram_base; getparam->value = dev_priv->vm_vram_base;
break; break;
case NOUVEAU_GETPARAM_GRAPH_UNITS:
/* NV40 and NV50 versions are quite different, but register
* address is the same. User is supposed to know the card
* family anyway... */
if (dev_priv->chipset >= 0x40) {
getparam->value = nv_rd32(dev, NV40_PMC_GRAPH_UNITS);
break;
}
/* FALLTHRU */
default: default:
NV_ERROR(dev, "unknown parameter %lld\n", getparam->param); NV_ERROR(dev, "unknown parameter %lld\n", getparam->param);
return -EINVAL; return -EINVAL;
......
...@@ -77,6 +77,7 @@ struct drm_nouveau_gpuobj_free { ...@@ -77,6 +77,7 @@ struct drm_nouveau_gpuobj_free {
#define NOUVEAU_GETPARAM_PCI_PHYSICAL 10 #define NOUVEAU_GETPARAM_PCI_PHYSICAL 10
#define NOUVEAU_GETPARAM_CHIPSET_ID 11 #define NOUVEAU_GETPARAM_CHIPSET_ID 11
#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 #define NOUVEAU_GETPARAM_VM_VRAM_BASE 12
#define NOUVEAU_GETPARAM_GRAPH_UNITS 13
struct drm_nouveau_getparam { struct drm_nouveau_getparam {
uint64_t param; uint64_t param;
uint64_t value; uint64_t value;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment