All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: John.C.Harrison@Intel.com
Cc: Intel-GFX@lists.freedesktop.org
Subject: Re: [RFC 44/44] drm/i915: Fake batch support for page flips
Date: Mon, 7 Jul 2014 21:25:58 +0200	[thread overview]
Message-ID: <20140707192558.GG5821@phenom.ffwll.local> (raw)
In-Reply-To: <1403803475-16337-45-git-send-email-John.C.Harrison@Intel.com>

On Thu, Jun 26, 2014 at 06:24:35PM +0100, John.C.Harrison@Intel.com wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
> 
> Any commands written to the ring without the scheduler's knowledge can get lost
> during a pre-emption event. This checkin updates the page flip code to send the
> ring commands via the scheduler's 'fake batch' interface. Thus the page flip is
> kept safe from being clobbered.

Same comment as with the execlist series: Can't we just use mmio flips
instead? We could just restrict the scheduler to more recent platforms if
mmio flips aren't available on all platforms ...
-Daniel
> ---
>  drivers/gpu/drm/i915/intel_display.c |   84 ++++++++++++++++------------------
>  1 file changed, 40 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index fa1ffbb..8bbc5d3 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9099,8 +9099,8 @@ static int intel_gen7_queue_flip(struct drm_device *dev,
>  				 uint32_t flags)
>  {
>  	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> -	uint32_t plane_bit = 0;
> -	int len, ret;
> +	uint32_t plane_bit = 0, sched_flags;
> +	int ret;
>  
>  	switch (intel_crtc->plane) {
>  	case PLANE_A:
> @@ -9117,18 +9117,6 @@ static int intel_gen7_queue_flip(struct drm_device *dev,
>  		return -ENODEV;
>  	}
>  
> -	len = 4;
> -	if (ring->id == RCS) {
> -		len += 6;
> -		/*
> -		 * On Gen 8, SRM is now taking an extra dword to accommodate
> -		 * 48bits addresses, and we need a NOOP for the batch size to
> -		 * stay even.
> -		 */
> -		if (IS_GEN8(dev))
> -			len += 2;
> -	}
> -
>  	/*
>  	 * BSpec MI_DISPLAY_FLIP for IVB:
>  	 * "The full packet must be contained within the same cache line."
> @@ -9139,13 +9127,7 @@ static int intel_gen7_queue_flip(struct drm_device *dev,
>  	 * then do the cacheline alignment, and finally emit the
>  	 * MI_DISPLAY_FLIP.
>  	 */
> -	ret = intel_ring_cacheline_align(ring);
> -	if (ret)
> -		return ret;
> -
> -	ret = intel_ring_begin(ring, len);
> -	if (ret)
> -		return ret;
> +	sched_flags = i915_ebp_sf_cacheline_align;
>  
>  	/* Unmask the flip-done completion message. Note that the bspec says that
>  	 * we should do this for both the BCS and RCS, and that we must not unmask
> @@ -9157,32 +9139,46 @@ static int intel_gen7_queue_flip(struct drm_device *dev,
>  	 * to zero does lead to lockups within MI_DISPLAY_FLIP.
>  	 */
>  	if (ring->id == RCS) {
> -		intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
> -		intel_ring_emit(ring, DERRMR);
> -		intel_ring_emit(ring, ~(DERRMR_PIPEA_PRI_FLIP_DONE |
> -					DERRMR_PIPEB_PRI_FLIP_DONE |
> -					DERRMR_PIPEC_PRI_FLIP_DONE));
> -		if (IS_GEN8(dev))
> -			intel_ring_emit(ring, MI_STORE_REGISTER_MEM_GEN8(1) |
> -					      MI_SRM_LRM_GLOBAL_GTT);
> -		else
> -			intel_ring_emit(ring, MI_STORE_REGISTER_MEM(1) |
> -					      MI_SRM_LRM_GLOBAL_GTT);
> -		intel_ring_emit(ring, DERRMR);
> -		intel_ring_emit(ring, ring->scratch.gtt_offset + 256);
> -		if (IS_GEN8(dev)) {
> -			intel_ring_emit(ring, 0);
> -			intel_ring_emit(ring, MI_NOOP);
> -		}
> -	}
> +		uint32_t cmds[] = {
> +			MI_LOAD_REGISTER_IMM(1),
> +			DERRMR,
> +			~(DERRMR_PIPEA_PRI_FLIP_DONE |
> +				DERRMR_PIPEB_PRI_FLIP_DONE |
> +				DERRMR_PIPEC_PRI_FLIP_DONE),
> +			IS_GEN8(dev) ? (MI_STORE_REGISTER_MEM_GEN8(1) |
> +					MI_SRM_LRM_GLOBAL_GTT) :
> +				       (MI_STORE_REGISTER_MEM(1) |
> +					MI_SRM_LRM_GLOBAL_GTT),
> +			DERRMR,
> +			ring->scratch.gtt_offset + 256,
> +//		if (IS_GEN8(dev)) {
> +			0,
> +			MI_NOOP,
> +//		}
> +			MI_DISPLAY_FLIP_I915 | plane_bit,
> +			fb->pitches[0] | obj->tiling_mode,
> +			intel_crtc->unpin_work->gtt_offset,
> +			MI_NOOP
> +		};
> +		uint32_t len = sizeof(cmds) / sizeof(*cmds);
> +
> +		ret = i915_scheduler_queue_nonbatch(ring, cmds, len, &obj, 1, sched_flags);
> +	} else {
> +		uint32_t cmds[] = {
> +			MI_DISPLAY_FLIP_I915 | plane_bit,
> +			fb->pitches[0] | obj->tiling_mode,
> +			intel_crtc->unpin_work->gtt_offset,
> +			MI_NOOP
> +		};
> +		uint32_t len = sizeof(cmds) / sizeof(*cmds);
>  
> -	intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | plane_bit);
> -	intel_ring_emit(ring, (fb->pitches[0] | obj->tiling_mode));
> -	intel_ring_emit(ring, intel_crtc->unpin_work->gtt_offset);
> -	intel_ring_emit(ring, (MI_NOOP));
> +		ret = i915_scheduler_queue_nonbatch(ring, cmds, len, &obj, 1, sched_flags);
> +	}
> +	if (ret)
> +		return ret;
>  
>  	intel_mark_page_flip_active(intel_crtc);
> -	i915_add_request_wo_flush(ring);
> +
>  	return 0;
>  }
>  
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-07-07 19:25 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 17:23 [RFC 00/44] GPU scheduler for i915 driver John.C.Harrison
2014-06-26 17:23 ` [RFC 01/44] drm/i915: Corrected 'file_priv' to 'file' in 'i915_driver_preclose()' John.C.Harrison
2014-06-30 21:03   ` Jesse Barnes
2014-07-07 18:02     ` Daniel Vetter
2014-06-26 17:23 ` [RFC 02/44] drm/i915: Added getparam for native sync John.C.Harrison
2014-07-07 18:52   ` Daniel Vetter
2014-06-26 17:23 ` [RFC 03/44] drm/i915: Add extra add_request calls John.C.Harrison
2014-06-30 21:10   ` Jesse Barnes
2014-07-07 18:41     ` Daniel Vetter
2014-07-08  7:44       ` Chris Wilson
2014-06-26 17:23 ` [RFC 04/44] drm/i915: Fix null pointer dereference in error capture John.C.Harrison
2014-06-30 21:40   ` Jesse Barnes
2014-07-01  7:12     ` Chris Wilson
2014-07-07 18:49       ` Daniel Vetter
2014-07-01  7:20   ` [PATCH] drm/i915: Remove num_pages parameter to i915_error_object_create() Chris Wilson
2014-06-26 17:23 ` [RFC 05/44] drm/i915: Updating assorted register and status page definitions John.C.Harrison
2014-07-02 17:49   ` Jesse Barnes
2014-06-26 17:23 ` [RFC 06/44] drm/i915: Fixes for FIFO space queries John.C.Harrison
2014-07-02 17:50   ` Jesse Barnes
2014-06-26 17:23 ` [RFC 07/44] drm/i915: Disable 'get seqno' workaround for VLV John.C.Harrison
2014-07-02 17:51   ` Jesse Barnes
2014-07-07 18:56     ` Daniel Vetter
2014-06-26 17:23 ` [RFC 08/44] drm/i915: Added GPU scheduler config option John.C.Harrison
2014-07-07 18:58   ` Daniel Vetter
2014-06-26 17:24 ` [RFC 09/44] drm/i915: Start of GPU scheduler John.C.Harrison
2014-07-02 17:55   ` Jesse Barnes
2014-07-07 19:02   ` Daniel Vetter
2014-06-26 17:24 ` [RFC 10/44] drm/i915: Prepare retire_requests to handle out-of-order seqnos John.C.Harrison
2014-07-02 18:11   ` Jesse Barnes
2014-07-07 19:05   ` Daniel Vetter
2014-07-09 14:08     ` Daniel Vetter
2014-06-26 17:24 ` [RFC 11/44] drm/i915: Added scheduler hook into i915_seqno_passed() John.C.Harrison
2014-07-02 18:14   ` Jesse Barnes
2014-06-26 17:24 ` [RFC 12/44] drm/i915: Disable hardware semaphores when GPU scheduler is enabled John.C.Harrison
2014-07-02 18:16   ` Jesse Barnes
2014-06-26 17:24 ` [RFC 13/44] drm/i915: Added scheduler hook when closing DRM file handles John.C.Harrison
2014-07-02 18:20   ` Jesse Barnes
2014-07-23 15:10     ` John Harrison
2014-07-23 15:39       ` Jesse Barnes
2014-06-26 17:24 ` [RFC 14/44] drm/i915: Added getparam for GPU scheduler John.C.Harrison
2014-07-02 18:21   ` Jesse Barnes
2014-07-07 19:11     ` Daniel Vetter
2014-06-26 17:24 ` [RFC 15/44] drm/i915: Added deferred work handler for scheduler John.C.Harrison
2014-07-07 19:14   ` Daniel Vetter
2014-07-23 15:37     ` John Harrison
2014-07-23 18:50       ` Daniel Vetter
2014-07-24 15:42         ` John Harrison
2014-07-25  7:18           ` Daniel Vetter
2014-06-26 17:24 ` [RFC 16/44] drm/i915: Alloc early seqno John.C.Harrison
2014-07-02 18:29   ` Jesse Barnes
2014-07-23 15:11     ` John Harrison
2014-06-26 17:24 ` [RFC 17/44] drm/i915: Prelude to splitting i915_gem_do_execbuffer in two John.C.Harrison
2014-07-02 18:34   ` Jesse Barnes
2014-07-07 19:21     ` Daniel Vetter
2014-07-23 16:33       ` John Harrison
2014-07-23 18:14         ` Daniel Vetter
2014-06-26 17:24 ` [RFC 18/44] drm/i915: Added scheduler debug macro John.C.Harrison
2014-07-02 18:37   ` Jesse Barnes
2014-07-07 19:23     ` Daniel Vetter
2014-06-26 17:24 ` [RFC 19/44] drm/i915: Split i915_dem_do_execbuffer() in half John.C.Harrison
2014-06-26 17:24 ` [RFC 20/44] drm/i915: Redirect execbuffer_final() via scheduler John.C.Harrison
2014-06-26 17:24 ` [RFC 21/44] drm/i915: Added tracking/locking of batch buffer objects John.C.Harrison
2014-06-26 17:24 ` [RFC 22/44] drm/i915: Ensure OLS & PLR are always in sync John.C.Harrison
2014-06-26 17:24 ` [RFC 23/44] drm/i915: Added manipulation of OLS/PLR John.C.Harrison
2014-06-26 17:24 ` [RFC 24/44] drm/i915: Added scheduler interrupt handler hook John.C.Harrison
2014-06-26 17:24 ` [RFC 25/44] drm/i915: Added hook to catch 'unexpected' ring submissions John.C.Harrison
2014-06-26 17:24 ` [RFC 26/44] drm/i915: Added scheduler support to __wait_seqno() calls John.C.Harrison
2014-06-26 17:24 ` [RFC 27/44] drm/i915: Added scheduler support to page fault handler John.C.Harrison
2014-06-26 17:24 ` [RFC 28/44] drm/i915: Added scheduler flush calls to ring throttle and idle functions John.C.Harrison
2014-06-26 17:24 ` [RFC 29/44] drm/i915: Hook scheduler into intel_ring_idle() John.C.Harrison
2014-06-26 17:24 ` [RFC 30/44] drm/i915: Added a module parameter for allowing scheduler overrides John.C.Harrison
2014-06-26 17:24 ` [RFC 31/44] drm/i915: Implemented the GPU scheduler John.C.Harrison
2014-06-26 17:24 ` [RFC 32/44] drm/i915: Added immediate submission override to scheduler John.C.Harrison
2014-06-26 17:24 ` [RFC 33/44] drm/i915: Added trace points " John.C.Harrison
2014-06-26 17:24 ` [RFC 34/44] drm/i915: Added scheduler queue throttling by DRM file handle John.C.Harrison
2014-06-26 17:24 ` [RFC 35/44] drm/i915: Added debugfs interface to scheduler tuning parameters John.C.Harrison
2014-06-26 17:24 ` [RFC 36/44] drm/i915: Added debug state dump facilities to scheduler John.C.Harrison
2014-06-26 17:24 ` [RFC 37/44] drm/i915: Added facility for cancelling an outstanding request John.C.Harrison
2014-06-26 17:24 ` [RFC 38/44] drm/i915: Add early exit to execbuff_final() if insufficient ring space John.C.Harrison
2014-06-26 17:24 ` [RFC 39/44] drm/i915: Added support for pre-emptive scheduling John.C.Harrison
2014-06-26 17:24 ` [RFC 40/44] drm/i915: REVERTME Hack to allow IGT to test pre-emption John.C.Harrison
2014-06-26 17:24 ` [RFC 41/44] drm/i915: Added validation callback to trace points John.C.Harrison
2014-06-26 17:24 ` [RFC 42/44] drm/i915: Added scheduler statistic reporting to debugfs John.C.Harrison
2014-06-26 17:24 ` [RFC 43/44] drm/i915: Added support for submitting out-of-batch ring commands John.C.Harrison
2014-06-26 17:24 ` [RFC 44/44] drm/i915: Fake batch support for page flips John.C.Harrison
2014-07-07 19:25   ` Daniel Vetter [this message]
2014-06-26 20:44 ` [RFC 00/44] GPU scheduler for i915 driver Dave Airlie
2014-07-07 15:57   ` Daniel Vetter
2014-10-10 10:35 ` Steven Newbury
2014-10-20 10:31   ` John Harrison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140707192558.GG5821@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=Intel-GFX@lists.freedesktop.org \
    --cc=John.C.Harrison@Intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.