• Chris Wilson's avatar
    drm/i915/ringbuffer: EMIT_INVALIDATE *before* switch context · 928f8f42
    Chris Wilson authored
    Despite what I think the prm recommends, commit f2253bd9
    ("drm/i915/ringbuffer: EMIT_INVALIDATE after switch context") turned out
    to be a huge mistake when enabling Ironlake contexts as the GPU would
    hang on either a MI_FLUSH or PIPE_CONTROL immediately following the
    MI_SET_CONTEXT of an active mesa context (more vanilla contexts, e.g.
    simple rendercopies with igt, do not suffer).
    
    Ville found the following clue,
    
      "[DevCTG+]: For the invalidate operation of the pipe control, the
       following pointers are affected. The
       invalidate operation affects the restore of these packets. If the pipe
       control invalidate operation is completed
       before the context save, the indirect pointers will not be restored from
       memory.
       1. Pipeline State Pointer
       2. Media State Pointer
       3. Constant Buffer Packet"
    
    which suggests by us emitting the INVALIDATE prior to the MI_SET_CONTEXT,
    we prevent the context-restore from chasing the dangling pointers within
    the image, and explains why this likely prevents the GPU hang.
    Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20190419111749.3910-1-chris@chris-wilson.co.uk
    928f8f42
intel_ringbuffer.c 59.7 KB