• Damien Lespiau's avatar
    drm/i915: Make the intel_device_info structure kept in dev_priv writable · 5c969aa7
    Damien Lespiau authored
    Turns out it'd be nice to change some device information at run-time or simply
    have some code to fill in the info struct instead of having to declare the
    values in 30+ structures.
    
    What prompted this change is handling fused out display/pipe and tweaking
    num_pipes at run-time, but I'm quite sure we'll find other flags/limits to
    stick into dev_priv->info.
    
    Most of the changes were done with a sed:
    sed -i -e 's/dev_priv->info->/dev_priv->info./g' drivers/gpu/drm/i915/*[ch]
    
    with a few tweaks to make it all work:
    - Change the field definition in struct drm_i915_private
    - adjust i915_dump_device_info()
    - adjust i915_driver_load()
    - adjust the INTEL_INFO() macro
    
    v2: cast the info pointer returned by INTEL_INFO() to be const to catch
        uses that would modify the structure post-initialization.
        (Ville Syrjälä)
    
    v3: Redo the patch onto latest drm-nightly,
        Keep the info field const to catch post initialization writes
        instead of the v2 solution,
        Use a direct structure copy for the initial info initialization to
        use the compiler type safety (Ville Syrjälä)
    
    Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com> (for v2)
    Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (for v2)
    Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    5c969aa7
i915_reg.h 222 KB