Commit a2991414 authored by Maarten Lankhorst's avatar Maarten Lankhorst

drm/i915: Add support for detecting vblanks when hw frame counter is unavailable.

This uses the newly created drm_accurate_vblank_count_and_time to accurately
get a vblank count when the hw counter is unavailable.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1463490484-19540-6-git-send-email-maarten.lankhorst@linux.intel.comReviewed-by: default avatarPatrik Jakobsson <patrik.jakobsson@linux.intel.com>
parent 5251f04e
...@@ -13413,6 +13413,16 @@ static int intel_atomic_prepare_commit(struct drm_device *dev, ...@@ -13413,6 +13413,16 @@ static int intel_atomic_prepare_commit(struct drm_device *dev,
return ret; return ret;
} }
u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc)
{
struct drm_device *dev = crtc->base.dev;
if (!dev->max_vblank_count)
return drm_accurate_vblank_count(&crtc->base);
return dev->driver->get_vblank_counter(dev, crtc->pipe);
}
static void intel_atomic_wait_for_vblanks(struct drm_device *dev, static void intel_atomic_wait_for_vblanks(struct drm_device *dev,
struct drm_i915_private *dev_priv, struct drm_i915_private *dev_priv,
unsigned crtc_mask) unsigned crtc_mask)
......
...@@ -1178,6 +1178,9 @@ intel_wait_for_vblank_if_active(struct drm_device *dev, int pipe) ...@@ -1178,6 +1178,9 @@ intel_wait_for_vblank_if_active(struct drm_device *dev, int pipe)
if (crtc->active) if (crtc->active)
intel_wait_for_vblank(dev, pipe); intel_wait_for_vblank(dev, pipe);
} }
u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc);
int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp); int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
void vlv_wait_port_ready(struct drm_i915_private *dev_priv, void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
struct intel_digital_port *dport, struct intel_digital_port *dport,
......
...@@ -80,9 +80,7 @@ static int usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, ...@@ -80,9 +80,7 @@ static int usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
*/ */
void intel_pipe_update_start(struct intel_crtc *crtc) void intel_pipe_update_start(struct intel_crtc *crtc)
{ {
struct drm_device *dev = crtc->base.dev;
const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode; const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
enum pipe pipe = crtc->pipe;
long timeout = msecs_to_jiffies_timeout(1); long timeout = msecs_to_jiffies_timeout(1);
int scanline, min, max, vblank_start; int scanline, min, max, vblank_start;
wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base); wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base);
...@@ -139,8 +137,7 @@ void intel_pipe_update_start(struct intel_crtc *crtc) ...@@ -139,8 +137,7 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
crtc->debug.scanline_start = scanline; crtc->debug.scanline_start = scanline;
crtc->debug.start_vbl_time = ktime_get(); crtc->debug.start_vbl_time = ktime_get();
crtc->debug.start_vbl_count = crtc->debug.start_vbl_count = intel_crtc_get_vblank_counter(crtc);
dev->driver->get_vblank_counter(dev, pipe);
trace_i915_pipe_update_vblank_evaded(crtc); trace_i915_pipe_update_vblank_evaded(crtc);
} }
...@@ -156,10 +153,9 @@ void intel_pipe_update_start(struct intel_crtc *crtc) ...@@ -156,10 +153,9 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
*/ */
void intel_pipe_update_end(struct intel_crtc *crtc) void intel_pipe_update_end(struct intel_crtc *crtc)
{ {
struct drm_device *dev = crtc->base.dev;
enum pipe pipe = crtc->pipe; enum pipe pipe = crtc->pipe;
int scanline_end = intel_get_crtc_scanline(crtc); int scanline_end = intel_get_crtc_scanline(crtc);
u32 end_vbl_count = dev->driver->get_vblank_counter(dev, pipe); u32 end_vbl_count = intel_crtc_get_vblank_counter(crtc);
ktime_t end_vbl_time = ktime_get(); ktime_t end_vbl_time = ktime_get();
trace_i915_pipe_update_end(crtc, end_vbl_count, scanline_end); trace_i915_pipe_update_end(crtc, end_vbl_count, scanline_end);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment