Re: [PATCH 14/19] drm/i915: Move context initialisation to first-use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On to, 2016-04-21 at 08:08 +0100, Chris Wilson wrote:
> On Thu, Apr 21, 2016 at 09:57:03AM +0300, Joonas Lahtinen wrote:
> > 
> > On ke, 2016-04-20 at 19:42 +0100, Chris Wilson wrote:
> > > 
> > > +	if (!request->ctx->engine[engine->id].initialised) {
> > > +		ret = engine->init_context(request);
> > > +		if (ret) {
> > > +			intel_lr_context_unpin(request->ctx, engine);
> > I prefer the goto teardown path, it's easy to read and modify later on.

Meant something like this which is functionally the same but less
nesting;

	if (request->ctx->engine[engine->id].initialised)
		return 0;

	ret = engine->init_context(request);
	if (ret)
		goto out_unpin;

	request->ctx->engine[engine->id].initialised = true;

	return 0;

out_unpin:
	intel_lr_context_unpin(request->ctx, engine);

	return ret;
}

> Ah, that would lead to bugs here. After we emit init_context on this
> request, the request must run to completion as the request itself tracks
> modification to global data, e.g. the ctx->initialised flag here and the
> golden render state object's liveness tracking.
> 
> Well that deserves a comment!
> -Chris
> 
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux