void nvhost_3dctx_restore_direct(u32 *ptr, u32 start_reg, u32 count) { ptr[0] = nvhost_opcode_incr(start_reg, count); }
static struct nvhost_hwctx *vic03_alloc_hwctx(struct nvhost_hwctx_handler *h, struct nvhost_channel *ch) { struct host1x_hwctx_handler *p = to_host1x_hwctx_handler(h); struct vic03 *v = get_vic03(ch->dev); struct host1x_hwctx *ctx; u32 *ptr; u32 syncpt = nvhost_get_devdata(ch->dev)->syncpts[0]; u32 nvhost_vic03_restore_size = 10; /* number of words written below */ nvhost_dbg_fn(""); ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) return NULL; ctx->restore_size = nvhost_vic03_restore_size; ctx->cpuva = dma_alloc_writecombine(&ch->dev->dev, ctx->restore_size * 4, &ctx->iova, GFP_KERNEL); if (!ctx->cpuva) { dev_err(&ch->dev->dev, "memory allocation failed\n"); goto fail; } ptr = ctx->cpuva; /* set app id, fce ucode size, offset */ ptr[0] = nvhost_opcode_incr(VIC_UCLASS_METHOD_OFFSET, 2); ptr[1] = NVA0B6_VIDEO_COMPOSITOR_SET_APPLICATION_ID >> 2; ptr[2] = 1; ptr[3] = nvhost_opcode_incr(VIC_UCLASS_METHOD_OFFSET, 2); ptr[4] = NVA0B6_VIDEO_COMPOSITOR_SET_FCE_UCODE_SIZE >> 2; ptr[5] = v->ucode.fce.size; ptr[6] = nvhost_opcode_incr(VIC_UCLASS_METHOD_OFFSET, 2); ptr[7] = NVA0B6_VIDEO_COMPOSITOR_SET_FCE_UCODE_OFFSET >> 2; ptr[8] = (v->ucode.dma_addr + v->ucode.fce.data_offset) >> 8; /* syncpt increment to track restore gather. */ ptr[9] = nvhost_opcode_imm_incr_syncpt( host1x_uclass_incr_syncpt_cond_op_done_v(), syncpt); kref_init(&ctx->hwctx.ref); ctx->hwctx.h = &p->h; ctx->hwctx.channel = ch; ctx->hwctx.valid = true; /* this is a preconditioning sequence... */ ctx->hwctx.save_incrs = 0; ctx->hwctx.save_slots = 0; ctx->hwctx.restore_incrs = 1; return &ctx->hwctx; fail: kfree(ctx); return NULL; }