• P
    drm/i915/skl: SKL Watermark Computation · 2d41c0b5
    Pradeep Bhat 提交于
    This patch implements the watermark algorithm and its necessary
    functions. Two function pointers skl_update_wm and
    skl_update_sprite_wm are provided. The skl_update_wm will update
    the watermarks for the crtc provided as an argument and then
    checks for change in DDB allocation for other active pipes and
    recomputes the watermarks for those Pipes and planes as well.
    Finally it does the register programming for all dirty pipes.
    The trigger of the Watermark double buffer registers will have
    to be once the plane configurations are done by the caller.
    
    v2: fixed the divide-by-0 error in the results computation func.
        Also reworked the PLANE_WM register values computation func to
        make it more compact. Incorporated all other review comments
        from Damien.
    
    v3: Changed the skl_compute_plane_wm function to now return success
        or failure. Also the result blocks and lines are computed here
        instead of in skl_compute_wm_results function.
    
    v4: Adjust skl_ddb_alloc_changed() to the new planes/cursor split
        (Damien)
    
    v5: Reworked the affected functions to implement new plane/cursor
        split.
    
    v6: Rework the logic that triggers the DDB allocation and WM computation
        of skl_update_other_pipe_wm() to not depend on non-computed DDB
        values.
        Always give a valid cursor_width (at boot it's 0) to keep the
        invariant that we consider the cursor plane always enabled.
        Otherwise we end up dividing by 0 in skl_compute_plane_wm()
        (Damien Lespiau)
    
    v7: Spell out allocation
        skl_ddb_ functions should have the ddb as first argument
        Make the skl_ddb_alloc_changed() parameters const
        (Damien)
    
    v8: Rebase on top of the crtc->primary changes
    
    v9: Split the staging results structure to not exceed the 1Kb stack
        allocation in skl_update_wm()
    
    v10: Make skl_pipe_pixel_rate() take a pointer to the pipe config
         Add a comment about overflow considerations for skl_wm_method1()
         Various additions of const
         Various use of sizeof(variable) instead of sizeof(type)
         Various move of variable definitons to a narrower scope
         Zero initialize some stack allocated structures to make sure we
         don't have garbage in case we don't write all the values
         (Ville)
    
    v11: Remove non-necessary default number of blocks/lines when the plane
         is disabled (Ville)
    Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: NPradeep Bhat <pradeep.bhat@intel.com>
    Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
    Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
    2d41c0b5
i915_drv.h 92.1 KB