• Matt Roper's avatar
    drm/i915/skl: Simplify wm structures slightly (v2) · 4969d33e
    Matt Roper authored
    A bunch of SKL watermark-related structures have the cursor plane as a
    separate entry from the rest of the planes.  Since a previous patch
    updated I915_MAX_PLANES such that those plane arrays now have a slot for
    the cursor, update the code to use the new slot in the existing plane
    arrays and kill off the cursor-specific structures.
    
    There shouldn't be any functional change here; this is just shuffling
    around how the data is stored in some of the data structures.  The whole
    patch is generated with Coccinelle via the following semantic patch:
    
            @@ struct skl_pipe_wm_parameters WMP; @@
            - WMP.cursor
            + WMP.plane[PLANE_CURSOR]
    
            @@ struct skl_pipe_wm_parameters *WMP; @@
            - WMP->cursor
            + WMP->plane[PLANE_CURSOR]
    
            @@ @@
            struct skl_pipe_wm_parameters {
            ...
            - struct intel_plane_wm_parameters cursor;
            ...
            };
    
            @@
            struct skl_ddb_allocation DDB;
            expression E;
            @@
            - DDB.cursor[E]
            + DDB.plane[E][PLANE_CURSOR]
    
            @@
            struct skl_ddb_allocation *DDB;
            expression E;
            @@
            - DDB->cursor[E]
            + DDB->plane[E][PLANE_CURSOR]
    
            @@ @@
            struct skl_ddb_allocation {
            ...
            - struct skl_ddb_entry cursor[I915_MAX_PIPES];
            ...
            };
    
            @@
            struct skl_wm_values WMV;
            expression E1, E2;
            @@
            (
            - WMV.cursor[E1][E2]
            + WMV.plane[E1][PLANE_CURSOR][E2]
            |
            - WMV.cursor_trans[E1]
            + WMV.plane_trans[E1][PLANE_CURSOR]
            )
    
            @@
            struct skl_wm_values *WMV;
            expression E1, E2;
            @@
            (
            - WMV->cursor[E1][E2]
            + WMV->plane[E1][PLANE_CURSOR][E2]
            |
            - WMV->cursor_trans[E1]
            + WMV->plane_trans[E1][PLANE_CURSOR]
            )
    
            @@ @@
            struct skl_wm_values {
            ...
            - uint32_t cursor[I915_MAX_PIPES][8];
            ...
            - uint32_t cursor_trans[I915_MAX_PIPES];
            ...
            };
    
            @@ struct skl_wm_level WML; @@
            (
            - WML.cursor_en
            + WML.plane_en[PLANE_CURSOR]
            |
            - WML.cursor_res_b
            + WML.plane_res_b[PLANE_CURSOR]
            |
            - WML.cursor_res_l
            + WML.plane_res_l[PLANE_CURSOR]
            )
    
            @@ struct skl_wm_level *WML; @@
            (
            - WML->cursor_en
            + WML->plane_en[PLANE_CURSOR]
            |
            - WML->cursor_res_b
            + WML->plane_res_b[PLANE_CURSOR]
            |
            - WML->cursor_res_l
            + WML->plane_res_l[PLANE_CURSOR]
            )
    
            @@ @@
            struct skl_wm_level {
            ...
            - bool cursor_en;
            ...
            - uint16_t cursor_res_b;
            - uint8_t cursor_res_l;
            ...
            };
    
    v2: Use a PLANE_CURSOR enum entry rather than making the code reference
        I915_MAX_PLANES or I915_MAX_PLANES+1, which was confusing.  (Ander)
    Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
    Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    4969d33e
i915_drv.h 105 KB