• Ville Syrjälä's avatar
    drm/i915/dsb: Allow intel_dsb_chain() to use DSB_WAIT_FOR_VBLANK · 51e03954
    Ville Syrjälä authored
    Allow intel_dsb_chain() to start the chained DSB
    at start of the undelaye vblank. This is slightly
    more involved than simply setting the bit as we
    must use the DEwake mechanism to eliminate pkgC
    latency.
    
    And DSB_ENABLE_DEWAKE itself is problematic in that
    it allows us to configure just a single scanline,
    and if the current scanline is already past that
    DSB_ENABLE_DEWAKE won't do anything, rendering the
    whole thing moot.
    
    The current workaround involves checking the pipe's current
    scanline with the CPU, and if it looks like we're about to
    miss the configured DEwake scanline we set DSB_FORCE_DEWAKE
    to immediately assert DEwake. This is somewhat racy since the
    hardware is making progress all the while we're checking it on
    the CPU.
    
    We can make things less racy by chaining two DSBs and handling
    the DSB_FORCE_DEWAKE stuff entirely without CPU involvement:
    1. CPU starts the first DSB immediately
    2. First DSB configures the second DSB, including its dewake_scanline
    3. First DSB starts the second w/ DSB_WAIT_FOR_VBLANK
    4. First DSB asserts DSB_FORCE_DEWAKE
    5. First DSB waits until we're outside the dewake_scanline-vblank_start
       window
    6. First DSB deasserts DSB_FORCE_DEWAKE
    
    That will guarantee that the we are fully awake when the second
    DSB starts to actually execute.
    Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240624191032.27333-12-ville.syrjala@linux.intel.comReviewed-by: default avatarAnimesh Manna <animesh.manna@intel.com>
    51e03954
intel_dsb.h 1.57 KB