OSDN Git Service

drm/i915: Streamline the artihmetic
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 29 Apr 2020 18:54:57 +0000 (21:54 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 4 May 2020 15:44:53 +0000 (18:44 +0300)
commit2dd43144e824afffd5ee31ce0df02c47afe83d76
treee714351ecb889a7da3e52adcc6d6326e5638a8d2
parent41ee86d6ee820604adf7fdc873062d19804ba1cd
drm/i915: Streamline the artihmetic

All these ROUNDING_FACTORs and whatnot are making this thing hard to
read. Get rid of them. And let's massage some of the fractions to
give us less questionable intermediate results and perhaps less
divisions.

Also looks like a good helping of 64bit math stuff is needed to
avoid some of overflows present in the current code. There
might still be a few overflows, namely when calculating
link_clks_available/samples_room (would require a huge hblank
though), and potentially when calculating hblank_rise (not sure
how large link_clks_active can get).

It looks like we're still not calculating exactly what the spec says
since we truncate tu_data and tu_line early. But I'm too lazy to
figure out if we could avoid that.

v2: Fix typo in commit msg (Uma)
    Remove ROUNDING_FACTOR define (Uma)
    s/5*link_clk+5*cdclk/5*(link_clk+cdclk)/ (Chris)

Cc: Anshuman Gupta <anshuman.gupta@intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200429185457.26235-3-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
drivers/gpu/drm/i915/display/intel_audio.c