• M
    drm/i915/gen9: Compute DDB allocation at atomic check time (v4) · 98d39494
    Matt Roper 提交于
    Calculate the DDB blocks needed to satisfy the current atomic
    transaction at atomic check time.  This is a prerequisite to calculating
    SKL watermarks during the 'check' phase and rejecting any configurations
    that we can't find valid watermarks for.
    
    Due to the nature of DDB allocation, it's possible for the addition of a
    new CRTC to make the watermark configuration already in use on another,
    unchanged CRTC become invalid.  A change in which CRTC's are active
    triggers a recompute of the entire DDB, which unfortunately means we
    need to disallow any other atomic commits from racing with such an
    update.  If the active CRTC's change, we need to grab the lock on all
    CRTC's and run all CRTC's through their 'check' handler to recompute and
    re-check their per-CRTC DDB allocations.
    
    Note that with this patch we only compute the DDB allocation but we
    don't actually use the computed values during watermark programming yet.
    For ease of review/testing/bisecting, we still recompute the DDB at
    watermark programming time and just WARN() if it doesn't match the
    precomputed values.  A future patch will switch over to using the
    precomputed values once we're sure they're being properly computed.
    
    Another clarifying note:  DDB allocation itself shouldn't ever fail with
    the algorithm we use today (i.e., we have enough DDB blocks on BXT to
    support the minimum needs of the worst-case scenario of every pipe/plane
    enabled at full size).  However the watermarks calculations based on the
    DDB may fail and we'll be moving those to the atomic check as well in
    future patches.
    
    v2:
     - Skip DDB calculations in the rare case where our transaction doesn't
       actually touch any CRTC's at all.  Assuming at least one CRTC state
       is present in our transaction, then it means we can't race with any
       transactions that would update dev_priv->active_crtcs (which requires
       _all_ CRTC locks).
    
    v3:
     - Also calculate DDB during initial hw readout, to prevent using
       incorrect bios values. (Maarten)
    
    v4:
     - Use new distrust_bios_wm flag instead of skip_initial_wm (which was
       never actually set).
     - Set intel_state->active_pipe_changes instead of just realloc_pipes
    
    Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Cc: Lyude Paul <cpaul@redhat.com>
    Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
    Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
    Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Reviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Link: http://patchwork.freedesktop.org/patch/msgid/1463061971-19638-10-git-send-email-matthew.d.roper@intel.com
    98d39494
i915_drv.h 115.1 KB