• Ville Syrjälä's avatar
    drm/i915: Rewrite VLV/CHV watermark code · ae80152d
    Ville Syrjälä authored
    Assuming the PND deadline mechanism works reasonably we should do
    memory requests as early as possible so that PND has schedule the
    requests more intelligently. Currently we're still calculating
    the watermarks as if VLV/CHV are identical to g4x, which isn't
    the case.
    
    The current code also seems to calculate insufficient watermarks
    and hence we're seeing some underruns, especially on high resolution
    displays.
    
    To fix it just rip out the current code and replace is with something
    that tries to utilize PND as efficiently as possible.
    
    We now calculate the WM watermark to trigger when the FIFO still has
    256us worth of data. 256us is the maximum deadline value supoorted by
    PND, so issuing memory requests earlier would mean we probably couldn't
    utilize the full FIFO as PND would attempt to return the data at
    least in at least 256us. We also clamp the watermark to at least 8
    cachelines as that's the magic watermark that enabling trickle feed
    would also impose. I'm assuming it matches some burst size.
    
    In theory we could just enable trickle feed and ignore the WM values,
    except trickle feed doesn't work with max fifo mode anyway, so we'd
    still need to calculate the SR watermarks. It seems cleaner to just
    disable trickle feed and calculate all watermarks the same way. Also
    trickle feed wouldn't account for the 256us max deadline value, thoguh
    that may be a moot point in non-max fifo mode sicne the FIFOs are fairly
    small.
    
    On VLV max fifo mode can be used with either primary or sprite planes.
    So the code now also checks all the planes (apart from the cursor)
    when calculating the SR plane watermark.
    
    We don't have to worry about the WM1 watermarks since we're using the
    PND deadline scheme which means the hardware ignores WM1 values.
    
    v2: Use plane->state->fb instead of plane->fb
    Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    ae80152d
i915_drv.h 98.2 KB