• Dave Gordon's avatar
    drm/i915: Consolidate ring freespace calculations · ebd0fd4b
    Dave Gordon authored
    There are numerous places in the code where the driver's idea of
    how much space is left in a ring is updated using the driver's
    latest notions of the positions of 'head' and 'tail' for the ring.
    Among them are some that update one or both of these values before
    (re)doing the calculation. In particular, there are four different
    places in the code where 'last_retired_head' is copied to 'head'
    and then set to -1; and two of these do not have a guard to check
    that it has actually been updated since last time it was consumed,
    leaving the possibility that the dummy -1 can be transferred from
    'last_retired_head' to 'head', causing the space calculation to
    produce 'impossible' results (previously seen on Android/VLV).
    
    This code therefore consolidates all the calculation and updating of
    these values, such that there is only one place where the ring space
    is updated, and it ALWAYS uses (and consumes) 'last_retired_head' if
    (and ONLY if) it has been updated since the last call.
    Signed-off-by: default avatarDave Gordon <david.s.gordon@intel.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    ebd0fd4b
intel_lrc.c 56.8 KB