[Intel-gfx] [PATCH v6] drm/i915 : Added Programming of the MOCS

Chris Wilson chris at chris-wilson.co.uk
Tue Jun 30 08:12:17 PDT 2015


On Tue, Jun 30, 2015 at 03:59:08PM +0100, Peter Antoine wrote:
> +int intel_rcs_context_init_mocs(struct drm_i915_gem_request *req)
> +{
> +	int ret = 0;
> +	struct drm_i915_mocs_table t;
> +
> +	if (get_mocs_settings(req->ring->dev, &t)) {
> +		u32 table_size;
> +
> +		/*
> +		 * OK. For each supported ring:
> +		 *  number of mocs entries * 2 dwords for each control_value
> +		 *  plus number of mocs entries /2 dwords for l3cc values.
> +		 *
> +		 *  Plus 1 for the load command and 1 for the NOOP per ring
> +		 *  and the l3cc programming.
> +		 */
> +		table_size = GEN9_NUM_MOCS_RINGS *
> +				((2 * GEN9_NUM_MOCS_ENTRIES) + 2) +
> +				GEN9_NUM_MOCS_ENTRIES + 2;
> +
> +		ret = intel_logical_ring_begin(req, table_size);
> +		if (ret) {
> +			DRM_DEBUG("intel_logical_ring_begin failed %d\n", ret);
> +			return ret;
> +		}
> +
> +		/* program the control registers */
> +		emit_mocs_control_table(req->ringbuf, &t, GEN9_GFX_MOCS_0);

I wanted the ring_begin pushed down a level so that I didn't need a pen
and paper to review your calculations of space required, and reduce it
down a notch from trying to immediately reserve almost the entire skl 
ring buffer for itself.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list