diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_grctx.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_grctx.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_grctx.c b/drivers/gpu/drm/nouveau/nv50_grctx.c index 4b46d6968566..7ac7e6810966 100644 --- a/drivers/gpu/drm/nouveau/nv50_grctx.c +++ b/drivers/gpu/drm/nouveau/nv50_grctx.c | |||
@@ -172,8 +172,8 @@ static void nv50_graph_construct_xfer2(struct nouveau_grctx *ctx); | |||
172 | 172 | ||
173 | /* Main function: construct the ctxprog skeleton, call the other functions. */ | 173 | /* Main function: construct the ctxprog skeleton, call the other functions. */ |
174 | 174 | ||
175 | int | 175 | static int |
176 | nv50_grctx_init(struct nouveau_grctx *ctx) | 176 | nv50_grctx_generate(struct nouveau_grctx *ctx) |
177 | { | 177 | { |
178 | struct drm_nouveau_private *dev_priv = ctx->dev->dev_private; | 178 | struct drm_nouveau_private *dev_priv = ctx->dev->dev_private; |
179 | 179 | ||
@@ -277,6 +277,33 @@ nv50_grctx_init(struct nouveau_grctx *ctx) | |||
277 | return 0; | 277 | return 0; |
278 | } | 278 | } |
279 | 279 | ||
280 | void | ||
281 | nv50_grctx_fill(struct drm_device *dev, struct nouveau_gpuobj *mem) | ||
282 | { | ||
283 | nv50_grctx_generate(&(struct nouveau_grctx) { | ||
284 | .dev = dev, | ||
285 | .mode = NOUVEAU_GRCTX_VALS, | ||
286 | .data = mem, | ||
287 | }); | ||
288 | } | ||
289 | |||
290 | int | ||
291 | nv50_grctx_init(struct drm_device *dev, u32 *data, u32 max, u32 *len, u32 *cnt) | ||
292 | { | ||
293 | struct nouveau_grctx ctx = { | ||
294 | .dev = dev, | ||
295 | .mode = NOUVEAU_GRCTX_PROG, | ||
296 | .data = data, | ||
297 | .ctxprog_max = max | ||
298 | }; | ||
299 | int ret; | ||
300 | |||
301 | ret = nv50_grctx_generate(&ctx); | ||
302 | *cnt = ctx.ctxvals_pos * 4; | ||
303 | *len = ctx.ctxprog_len; | ||
304 | return ret; | ||
305 | } | ||
306 | |||
280 | /* | 307 | /* |
281 | * Constructs MMIO part of ctxprog and ctxvals. Just a matter of knowing which | 308 | * Constructs MMIO part of ctxprog and ctxvals. Just a matter of knowing which |
282 | * registers to save/restore and the default values for them. | 309 | * registers to save/restore and the default values for them. |