diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-04-19 21:54:33 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-05-24 02:31:58 -0400 |
commit | d58086deaa32dc5e630aab222851b282f77e00bb (patch) | |
tree | 2fab5eec82dcc5fa89d7d4e876cc6e561a30cc53 /drivers/gpu/drm/nouveau/nv40_graph.c | |
parent | a8f81837c506aba186b42f0c67633e85851395b1 (diff) |
drm/nv40-50/gr: restructure grctx/prog generation
The conditional definition of the generation helper functions apparently
confuses some IDEs....
Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv40_graph.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv40_graph.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/drivers/gpu/drm/nouveau/nv40_graph.c b/drivers/gpu/drm/nouveau/nv40_graph.c index ba14a93d8afa..6d8147b07c83 100644 --- a/drivers/gpu/drm/nouveau/nv40_graph.c +++ b/drivers/gpu/drm/nouveau/nv40_graph.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include "drmP.h" | 27 | #include "drmP.h" |
28 | #include "drm.h" | 28 | #include "drm.h" |
29 | #include "nouveau_drv.h" | 29 | #include "nouveau_drv.h" |
30 | #include "nouveau_grctx.h" | ||
31 | #include "nouveau_ramht.h" | 30 | #include "nouveau_ramht.h" |
32 | 31 | ||
33 | struct nv40_graph_engine { | 32 | struct nv40_graph_engine { |
@@ -42,7 +41,6 @@ nv40_graph_context_new(struct nouveau_channel *chan, int engine) | |||
42 | struct drm_device *dev = chan->dev; | 41 | struct drm_device *dev = chan->dev; |
43 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 42 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
44 | struct nouveau_gpuobj *grctx = NULL; | 43 | struct nouveau_gpuobj *grctx = NULL; |
45 | struct nouveau_grctx ctx = {}; | ||
46 | unsigned long flags; | 44 | unsigned long flags; |
47 | int ret; | 45 | int ret; |
48 | 46 | ||
@@ -52,11 +50,7 @@ nv40_graph_context_new(struct nouveau_channel *chan, int engine) | |||
52 | return ret; | 50 | return ret; |
53 | 51 | ||
54 | /* Initialise default context values */ | 52 | /* Initialise default context values */ |
55 | ctx.dev = chan->dev; | 53 | nv40_grctx_fill(dev, grctx); |
56 | ctx.mode = NOUVEAU_GRCTX_VALS; | ||
57 | ctx.data = grctx; | ||
58 | nv40_grctx_init(&ctx); | ||
59 | |||
60 | nv_wo32(grctx, 0, grctx->vinst); | 54 | nv_wo32(grctx, 0, grctx->vinst); |
61 | 55 | ||
62 | /* init grctx pointer in ramfc, and on PFIFO if channel is | 56 | /* init grctx pointer in ramfc, and on PFIFO if channel is |
@@ -184,8 +178,7 @@ nv40_graph_init(struct drm_device *dev, int engine) | |||
184 | struct nv40_graph_engine *pgraph = nv_engine(dev, engine); | 178 | struct nv40_graph_engine *pgraph = nv_engine(dev, engine); |
185 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 179 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
186 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; | 180 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; |
187 | struct nouveau_grctx ctx = {}; | 181 | uint32_t vramsz; |
188 | uint32_t vramsz, *cp; | ||
189 | int i, j; | 182 | int i, j; |
190 | 183 | ||
191 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & | 184 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & |
@@ -193,22 +186,8 @@ nv40_graph_init(struct drm_device *dev, int engine) | |||
193 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) | | 186 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) | |
194 | NV_PMC_ENABLE_PGRAPH); | 187 | NV_PMC_ENABLE_PGRAPH); |
195 | 188 | ||
196 | cp = kmalloc(sizeof(*cp) * 256, GFP_KERNEL); | 189 | /* generate and upload context program */ |
197 | if (!cp) | 190 | nv40_grctx_init(dev, &pgraph->grctx_size); |
198 | return -ENOMEM; | ||
199 | |||
200 | ctx.dev = dev; | ||
201 | ctx.mode = NOUVEAU_GRCTX_PROG; | ||
202 | ctx.data = cp; | ||
203 | ctx.ctxprog_max = 256; | ||
204 | nv40_grctx_init(&ctx); | ||
205 | pgraph->grctx_size = ctx.ctxvals_pos * 4; | ||
206 | |||
207 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0); | ||
208 | for (i = 0; i < ctx.ctxprog_len; i++) | ||
209 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, cp[i]); | ||
210 | |||
211 | kfree(cp); | ||
212 | 191 | ||
213 | /* No context present currently */ | 192 | /* No context present currently */ |
214 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0x00000000); | 193 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0x00000000); |