]> Pileus Git - ~andy/linux/blobdiff - drivers/gpu/drm/nouveau/nv50_grctx.c
Merge branch 'core/debug' into core/urgent
[~andy/linux] / drivers / gpu / drm / nouveau / nv50_grctx.c
index 4b46d69685664fcc14f096c644395a43316a6421..881e22b249fc5e0e34750614fb241c0a77b600db 100644 (file)
@@ -172,8 +172,8 @@ static void nv50_graph_construct_xfer2(struct nouveau_grctx *ctx);
 
 /* Main function: construct the ctxprog skeleton, call the other functions. */
 
-int
-nv50_grctx_init(struct nouveau_grctx *ctx)
+static int
+nv50_grctx_generate(struct nouveau_grctx *ctx)
 {
        struct drm_nouveau_private *dev_priv = ctx->dev->dev_private;
 
@@ -210,7 +210,7 @@ nv50_grctx_init(struct nouveau_grctx *ctx)
        cp_name(ctx, cp_check_load);
        cp_bra (ctx, AUTO_LOAD, PENDING, cp_setup_auto_load);
        cp_bra (ctx, USER_LOAD, PENDING, cp_setup_load);
-       cp_bra (ctx, ALWAYS, TRUE, cp_exit);
+       cp_bra (ctx, ALWAYS, TRUE, cp_prepare_exit);
 
        /* setup for context load */
        cp_name(ctx, cp_setup_auto_load);
@@ -277,6 +277,33 @@ nv50_grctx_init(struct nouveau_grctx *ctx)
        return 0;
 }
 
+void
+nv50_grctx_fill(struct drm_device *dev, struct nouveau_gpuobj *mem)
+{
+       nv50_grctx_generate(&(struct nouveau_grctx) {
+                            .dev = dev,
+                            .mode = NOUVEAU_GRCTX_VALS,
+                            .data = mem,
+                          });
+}
+
+int
+nv50_grctx_init(struct drm_device *dev, u32 *data, u32 max, u32 *len, u32 *cnt)
+{
+       struct nouveau_grctx ctx = {
+               .dev = dev,
+               .mode = NOUVEAU_GRCTX_PROG,
+               .data = data,
+               .ctxprog_max = max
+       };
+       int ret;
+
+       ret = nv50_grctx_generate(&ctx);
+       *cnt = ctx.ctxvals_pos * 4;
+       *len = ctx.ctxprog_len;
+       return ret;
+}
+
 /*
  * Constructs MMIO part of ctxprog and ctxvals. Just a matter of knowing which
  * registers to save/restore and the default values for them.