diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2010-09-01 01:24:34 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-09-24 02:22:42 -0400 |
commit | fbd2895e45aebdb3d3ea73a3a796cf3bb9c912da (patch) | |
tree | 1939bf1e1f66d6f7b4e7528e7105b5a0517822eb /drivers/gpu/drm/nouveau/nv04_instmem.c | |
parent | 6c3d7ef25e3b4a0ea511b1e9d4a0a212750874a6 (diff) |
drm/nouveau: rework init ordering so nv50_instmem.c can be less bad
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv04_instmem.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv04_instmem.c | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/drivers/gpu/drm/nouveau/nv04_instmem.c b/drivers/gpu/drm/nouveau/nv04_instmem.c index 3aba7674560..15cd468f4c2 100644 --- a/drivers/gpu/drm/nouveau/nv04_instmem.c +++ b/drivers/gpu/drm/nouveau/nv04_instmem.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "drmP.h" | 1 | #include "drmP.h" |
2 | #include "drm.h" | 2 | #include "drm.h" |
3 | #include "nouveau_drv.h" | 3 | #include "nouveau_drv.h" |
4 | #include "nouveau_ramht.h" | ||
4 | 5 | ||
5 | /* returns the size of fifo context */ | 6 | /* returns the size of fifo context */ |
6 | static int | 7 | static int |
@@ -18,42 +19,6 @@ nouveau_fifo_ctx_size(struct drm_device *dev) | |||
18 | } | 19 | } |
19 | 20 | ||
20 | static void | 21 | static void |
21 | nv04_instmem_determine_amount(struct drm_device *dev) | ||
22 | { | ||
23 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
24 | int i; | ||
25 | |||
26 | /* Figure out how much instance memory we need */ | ||
27 | if (dev_priv->card_type >= NV_40) { | ||
28 | /* We'll want more instance memory than this on some NV4x cards. | ||
29 | * There's a 16MB aperture to play with that maps onto the end | ||
30 | * of vram. For now, only reserve a small piece until we know | ||
31 | * more about what each chipset requires. | ||
32 | */ | ||
33 | switch (dev_priv->chipset) { | ||
34 | case 0x40: | ||
35 | case 0x47: | ||
36 | case 0x49: | ||
37 | case 0x4b: | ||
38 | dev_priv->ramin_rsvd_vram = (2 * 1024 * 1024); | ||
39 | break; | ||
40 | default: | ||
41 | dev_priv->ramin_rsvd_vram = (1 * 1024 * 1024); | ||
42 | break; | ||
43 | } | ||
44 | } else { | ||
45 | /*XXX: what *are* the limits on <NV40 cards? | ||
46 | */ | ||
47 | dev_priv->ramin_rsvd_vram = (512 * 1024); | ||
48 | } | ||
49 | NV_DEBUG(dev, "RAMIN size: %dKiB\n", dev_priv->ramin_rsvd_vram >> 10); | ||
50 | |||
51 | /* Clear all of it, except the BIOS image that's in the first 64KiB */ | ||
52 | for (i = 64 * 1024; i < dev_priv->ramin_rsvd_vram; i += 4) | ||
53 | nv_wi32(dev, i, 0x00000000); | ||
54 | } | ||
55 | |||
56 | static void | ||
57 | nv04_instmem_configure_fixed_tables(struct drm_device *dev) | 22 | nv04_instmem_configure_fixed_tables(struct drm_device *dev) |
58 | { | 23 | { |
59 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 24 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
@@ -103,12 +68,24 @@ nv04_instmem_configure_fixed_tables(struct drm_device *dev) | |||
103 | int nv04_instmem_init(struct drm_device *dev) | 68 | int nv04_instmem_init(struct drm_device *dev) |
104 | { | 69 | { |
105 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 70 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
71 | struct nouveau_gpuobj *ramht = NULL; | ||
106 | uint32_t offset; | 72 | uint32_t offset; |
107 | int ret; | 73 | int ret; |
108 | 74 | ||
109 | nv04_instmem_determine_amount(dev); | ||
110 | nv04_instmem_configure_fixed_tables(dev); | 75 | nv04_instmem_configure_fixed_tables(dev); |
111 | 76 | ||
77 | /* Setup shared RAMHT */ | ||
78 | ret = nouveau_gpuobj_new_fake(dev, dev_priv->ramht_offset, ~0, | ||
79 | dev_priv->ramht_size, | ||
80 | NVOBJ_FLAG_ZERO_ALLOC, &ramht); | ||
81 | if (ret) | ||
82 | return ret; | ||
83 | |||
84 | ret = nouveau_ramht_new(dev, ramht, &dev_priv->ramht); | ||
85 | nouveau_gpuobj_ref(NULL, &ramht); | ||
86 | if (ret) | ||
87 | return ret; | ||
88 | |||
112 | /* Create a heap to manage RAMIN allocations, we don't allocate | 89 | /* Create a heap to manage RAMIN allocations, we don't allocate |
113 | * the space that was reserved for RAMHT/FC/RO. | 90 | * the space that was reserved for RAMHT/FC/RO. |
114 | */ | 91 | */ |