[Intel-gfx] [PATCH v2] drm/i915/guc: Use formalized struct definition for ads object

Chris Wilson chris at chris-wilson.co.uk
Tue Mar 7 12:36:40 UTC 2017


On Tue, Mar 07, 2017 at 11:09:36AM +0000, Michal Wajdeczko wrote:
> Manual pointer manipulation is error prone. Let compiler calculate
> right offsets for us in case we need to change ads layout.
> 
> v2: don't call it object (Chris)
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Oscar Mateo <oscar.mateo at intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>

Looks good. I would have done mine line splitting slightly differently.
For

> -	ads->reg_state_buffer = ads->reg_state_addr +
> -			sizeof(struct guc_mmio_reg_state);
> +	blob->ads.reg_state_buffer = offset +
> +		offsetof(struct __guc_ads_blob, reg_state_buffer);

I would have used

	blob->ads.reg_state_buffer =
		offset + offsetof(struct __guc_ads_blob, reg_state_buffer);

I didn't see any mistakes in the conversion, and the packing is
certainly more obvious now.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list