Esempio n. 1
0
File: nv50.c Progetto: 24hours/linux
static int
nv50_disp_data_ctor(struct nouveau_object *parent,
		    struct nouveau_object *engine,
		    struct nouveau_oclass *oclass, void *data, u32 size,
		    struct nouveau_object **pobject)
{
	struct nv50_disp_priv *priv = (void *)engine;
	struct nouveau_engctx *ectx;
	int ret = -EBUSY;

	/* no context needed for channel objects... */
	if (nv_mclass(parent) != NV_DEVICE_CLASS) {
		atomic_inc(&parent->refcount);
		*pobject = parent;
		return 1;
	}

	/* allocate display hardware to client */
	mutex_lock(&nv_subdev(priv)->mutex);
	if (list_empty(&nv_engine(priv)->contexts)) {
		ret = nouveau_engctx_create(parent, engine, oclass, NULL,
					    0x10000, 0x10000,
					    NVOBJ_FLAG_HEAP, &ectx);
		*pobject = nv_object(ectx);
	}
	mutex_unlock(&nv_subdev(priv)->mutex);
	return ret;
}
Esempio n. 2
0
int
_nouveau_xtensa_engctx_ctor(struct nouveau_object *parent,
			    struct nouveau_object *engine,
			    struct nouveau_oclass *oclass, void *data, u32 size,
			    struct nouveau_object **pobject)
{
	struct nouveau_engctx *engctx;
	int ret;

	ret = nouveau_engctx_create(parent, engine, oclass, NULL,
				    0x10000, 0x1000,
				    NVOBJ_FLAG_ZERO_ALLOC, &engctx);
	*pobject = nv_object(engctx);
	return ret;
}