[Intel-gfx] [PATCH 09/13] drm/i915: Compact Gen8 semaphore initialization

Chris Wilson chris at chris-wilson.co.uk
Tue Jun 28 12:05:25 UTC 2016


On Mon, Jun 27, 2016 at 03:04:16PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Replace the macro initializer with a programatic loop which
> results in smaller code and hopefully just as clear.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ringbuffer.c | 16 +++++++++++++++-
>  drivers/gpu/drm/i915/intel_ringbuffer.h | 12 ------------
>  2 files changed, 15 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 691f82199d3c..088d75397d1b 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -2876,13 +2876,27 @@ static int gen6_ring_flush(struct drm_i915_gem_request *req,
>  static void intel_ring_init_semaphores(struct drm_i915_private *dev_priv,
>  				       struct intel_engine_cs *engine)
>  {
> +	int i;
> +
>  	if (!i915_semaphore_is_enabled(dev_priv))
>  		return;
>  
>  	if (INTEL_GEN(dev_priv) >= 8) {
>  		engine->semaphore.sync_to = gen8_ring_sync;
>  		engine->semaphore.signal = gen8_xcs_signal;
> -		GEN8_RING_SEMAPHORE_INIT(engine);
> +
> +		if (dev_priv->semaphore_obj) {

Something is broken if we reach here without semaphore_obj and
semaphores enabled.

Hmm. Currently we create the semaphore_obj before creating initialising
the semaphore vfuncs on the render ring. Don't you need to do the same
here?

intel_ring_init_seamphores() {
	if (!semaphores_is_enabled(dev_priv))
		return;
	
	if (INTEL_GEN(dev_priv) >= 8 && !dev_priv->semaphore_obj) {
		semaphore_obj = i915_gem_object_create()
		if (!semaphore_obj)
			i915.enable_semaphores = 0;
		return;
	}

	if (INTEL_GEN(dev_priv) >= 8) {
	} else { /* semaphores_is_enabled() should not be true for < 6 */
	}
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list