drm/i915/tv: Generate better pipe timings for TV encoder
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 12 Nov 2018 16:59:58 +0000 (18:59 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 25 Jan 2019 17:09:40 +0000 (19:09 +0200)
commite3bb355c7d8b2e537673066ee223a554457ff50d
tree49777da04d49121f0035a9f23df67b0cf3d303d1
parenta0ff6779c75fe86a66b8c2eb439a40a12139eb02
drm/i915/tv: Generate better pipe timings for TV encoder

To make vblank timestamps work better with the TV encoder let's
scale the pipe timings such that the relationship between the
TV active and TV blanking periods is mirrored in the
corresponding pipe timings.

Note that in reality the pipe runs at a faster speed during the
TV vblank, and correspondigly there are periods when the pipe
is enitrely stopped. We pretend that this isn't the case and
as such we incur some error in the vblank timestamps during
the TV vblank. Further explanation of the issues in a big
comment in the code.

This makes the vblank timestamps good enough to make
i965gm (which doesn't have a working frame counter with
the TV encoder) report correct frame numbers. Previously
you could get all kinds of nonsense which resulted in
eg. glxgears reporting that it's running at twice the
actual framerate in most cases.

v2: s/IS_GEN4(dev_priv)/IS_GEN(dev_priv, 4)/ in the comment
    for consistency

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181112170000.27531-15-ville.syrjala@linux.intel.com
Reviewed-by: Imre Deak <imre.deak@intel.com>
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_tv.c