[Intel-gfx] [PATCH 10/12] drm/i915: extract some common olr+wedge code

Chris Wilson chris at chris-wilson.co.uk
Fri Apr 27 10:46:31 CEST 2012


On Thu, 26 Apr 2012 16:03:07 -0700, Ben Widawsky <ben at bwidawsk.net> wrote:
> +/*
> + * Compare seqno against outstanding lazy request. Emit a request if they are
> + * equal. Seqno is updated with the new value if a request was emitted.
> + */
> +static int
> +i915_gem_check_olr(struct intel_ring_buffer *ring, u32 *seqno)
> +{
> +	int ret = 0;
> +
> +	BUG_ON(!mutex_is_locked(&ring->dev->struct_mutex));
> +
> +	if (*seqno == ring->outstanding_lazy_request) {
> +		struct drm_i915_gem_request *request;
> +
> +		request = kzalloc(sizeof(*request), GFP_KERNEL);
> +		if (request == NULL)
> +			return -ENOMEM;
> +
> +		ret = i915_add_request(ring, NULL, request);
> +		if (ret) {
> +			kfree(request);
> +			return ret;
> +		}
> +
> +		*seqno = request->seqno;
I'd love for this to be BUG_ON(seqno != request->seqno) and so drop the
out parameter, as it would tidy all the callers up.
> +	}
> +
> +	return ret;
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list