X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=drivers%2Fgpu%2Fdrm%2Fi915%2Fi915_debugfs.c;h=991abff94e1e6116b2d162e5af0138de0b67f3ea;hb=b2c88f5b1dea77b57759387728917a124eb1c098;hp=0d8a9a397a245edd1c38731550dbfe42a32cc4ea;hpb=926321d503406d1fefb2fae9651beca14160529a;p=deliverable%2Flinux.git diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 0d8a9a397a24..991abff94e1e 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -27,6 +27,7 @@ */ #include +#include #include #include #include @@ -1739,25 +1740,28 @@ static int i915_pipe_crc(struct seq_file *m, void *data) struct drm_device *dev = node->minor->dev; struct drm_i915_private *dev_priv = dev->dev_private; enum pipe pipe = (enum pipe)node->info_ent->data; - const struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[pipe]; - int i; - int start; + struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[pipe]; + int head, tail; if (dev_priv->pipe_crc[pipe].source == INTEL_PIPE_CRC_SOURCE_NONE) { seq_puts(m, "none\n"); return 0; } - start = atomic_read(&pipe_crc->slot) + 1; seq_puts(m, " timestamp CRC1 CRC2 CRC3 CRC4 CRC5\n"); - for (i = 0; i < INTEL_PIPE_CRC_ENTRIES_NR; i++) { - const struct intel_pipe_crc_entry *entry = - &pipe_crc->entries[(start + i) % - INTEL_PIPE_CRC_ENTRIES_NR]; + head = atomic_read(&pipe_crc->head); + tail = atomic_read(&pipe_crc->tail); + + while (CIRC_CNT(head, tail, INTEL_PIPE_CRC_ENTRIES_NR) >= 1) { + struct intel_pipe_crc_entry *entry = &pipe_crc->entries[tail]; seq_printf(m, "%12u %8x %8x %8x %8x %8x\n", entry->timestamp, entry->crc[0], entry->crc[1], entry->crc[2], entry->crc[3], entry->crc[4]); + + BUILD_BUG_ON_NOT_POWER_OF_2(INTEL_PIPE_CRC_ENTRIES_NR); + tail = (tail + 1) & (INTEL_PIPE_CRC_ENTRIES_NR - 1); + atomic_set(&pipe_crc->tail, tail); } return 0;