Skip to contentSkip to conversation

drm/i915: Avoid vblank counter for platforms with DMC.

PATCH In review Rodrigo Vivi 3 participants 4 messages Jul 26, 2016 – Jul 27, 2016

Subsystems (2)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

PATCH 1/2 drm/i915: Avoid vblank counter for platforms with DMC.

Framecounter register is read-only so DMC cannot restore it after exiting DC5 and DC6.

Easiest way to go is to avoid the counter and use vblank interruptions for this platform and for all the following ones since DMC came to stay. At least while we can't change this register to read-write.

v2: drop unecessary vblank_disable_immediate.
check on DMC/CSR feature instead of gen number. add comments.
change nop function name to make it more clear. rebase after a long time.

Cc Ville Syrjälä <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/i915_irq.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +10 -4
index 7104dc1..6ae201e 100644
@@ -656,9 +656,9 @@ static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv)
  *   of horizontal active on the first line of vertical active
  */
 
-static u32 i8xx_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
+static u32 nop_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 {
-	/* Gen2 doesn't have a hardware frame counter */
+	/* Disabled hardware frame counter */
 	return 0;
 }
 
@@ -4544,9 +4544,15 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 	INIT_DELAYED_WORK(&dev_priv->gpu_error.hangcheck_work,
 			  i915_hangcheck_elapsed);
 
-	if (IS_GEN2(dev_priv)) {
+	if (IS_GEN2(dev_priv) || HAS_CSR(dev_priv)) {
+		/*
+		 * Disable HW frame counters for gen2 where it doens't exit
+		 * and for platforms with DMC firmware, because
+		 * frame counter are read-only registers and DMC cannot
+		 * restore it after exiting DC5/DC6.
+		 */
 		dev->max_vblank_count = 0;
-		dev->driver->get_vblank_counter = i8xx_get_vblank_counter;
+		dev->driver->get_vblank_counter = nop_get_vblank_counter;
 	} else if (IS_G4X(dev_priv) || INTEL_INFO(dev_priv)->gen >= 5) {
 		dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
 		dev->driver->get_vblank_counter = g4x_get_vblank_counter;
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#1 lore raw

PATCH 2/2 drm/i915: Use drm_vblank_count() on gen2 for crc frame count

From: Ville Syrjälä <[email protected]>

Gen2 doesn't have a hardware frame counter, so let's use the sw counter value instead.

v2: Rodrigo: Rebase patch:
- using drm_crtc_vblank_{get,put} since legacy is no longer available
- declare struct dev when needed since dev_priv become the default.

Testcase: igt/kms_pipe_crc_basic/read-crc-pipe-?-frame-sequence

---
 drivers/gpu/drm/i915/i915_debugfs.c | 11 +++++++++++
 drivers/gpu/drm/i915/i915_irq.c     |  8 ++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +11 -0
index 9aa62c5..327a091 100644
@@ -4130,6 +4130,14 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
 			goto out;
 		}
 
+		if (dev->max_vblank_count == 0) {
+			ret = drm_crtc_vblank_get(&crtc->base);
+			if (ret) {
+				kfree(entries);
+				return ret;
+			}
+		}
+
 		/*
 		 * When IPS gets enabled, the pipe CRC changes. Since IPS gets
 		 * enabled and disabled dynamically based on package C states,
@@ -4182,6 +4190,9 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
 			hsw_trans_edp_pipe_A_crc_wa(dev, false);
 
 		hsw_enable_ips(crtc);
+
+		if (dev->max_vblank_count == 0)
+			drm_crtc_vblank_put(&crtc->base);
 	}
 
 	ret = 0;
drivers/gpu/drm/i915/i915_irq.c +6 -2
index 6ae201e..a8b5e3a 100644
@@ -1491,6 +1491,7 @@ static void display_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
 					 uint32_t crc2, uint32_t crc3,
 					 uint32_t crc4)
 {
+	struct drm_device *dev = &dev_priv->drm;
 	struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[pipe];
 	struct intel_pipe_crc_entry *entry;
 	int head, tail;
@@ -1514,8 +1515,11 @@ static void display_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
 
 	entry = &pipe_crc->entries[head];
 
-	entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm,
-								 pipe);
+	if (dev->max_vblank_count == 0)
+		entry->frame = drm_vblank_count(dev, pipe);
+	else
+		entry->frame = dev_priv->drm.driver->get_vblank_counter(dev,
+									pipe);
 	entry->crc[0] = crc0;
 	entry->crc[1] = crc1;
 	entry->crc[2] = crc2;
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH 2/2] drm/i915: Use drm_vblank_count() on gen2 for crc frame count

Quoted 1 line · Rodrigo Vivi

From: Ville Syrjälä <[email protected]>

I believe we should change the subject and commit message if the patch that disables hw counter for platforms with DMC is accepted. But since that is uncertain and I didn't want to change what Ville had done, I just sent this rebased version for now.

Quoted 80 lines

Gen2 doesn't have a hardware frame counter, so let's use the sw counter value instead.

v2: Rodrigo: Rebase patch:
- using drm_crtc_vblank_{get,put} since legacy is no longer available
- declare struct dev when needed since dev_priv become the default.

Testcase: igt/kms_pipe_crc_basic/read-crc-pipe-?-frame-sequence

---
 drivers/gpu/drm/i915/i915_debugfs.c | 11 +++++++++++
 drivers/gpu/drm/i915/i915_irq.c     |  8 ++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +11 -0
index 9aa62c5..327a091 100644
@@ -4130,6 +4130,14 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
                        goto out;
                }
 
+               if (dev->max_vblank_count == 0) {
+                       ret = drm_crtc_vblank_get(&crtc->base);
+                       if (ret) {
+                               kfree(entries);
+                               return ret;
+                       }
+               }
+
                /*
                 * When IPS gets enabled, the pipe CRC changes. Since IPS gets
                 * enabled and disabled dynamically based on package C states,
@@ -4182,6 +4190,9 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
                        hsw_trans_edp_pipe_A_crc_wa(dev, false);
 
                hsw_enable_ips(crtc);
+
+               if (dev->max_vblank_count == 0)
+                       drm_crtc_vblank_put(&crtc->base);
        }
 
        ret = 0;
drivers/gpu/drm/i915/i915_irq.c +6 -3
index 6ae201e..a8b5e3a 100644
@@ -1491,6 +1491,7 @@ static void display_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
                                         uint32_t crc2, uint32_t crc3,
                                         uint32_t crc4)
 {
+       struct drm_device *dev = &dev_priv->drm;
        struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[pipe];
        struct intel_pipe_crc_entry *entry;
        int head, tail;
@@ -1514,8 +1515,11 @@ static void display_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
 
        entry = &pipe_crc->entries[head];
 
-       entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm,
-                                                                pipe);
+       if (dev->max_vblank_count == 0)
+               entry->frame = drm_vblank_count(dev, pipe);
+       else
+               entry->frame = dev_priv->drm.driver->get_vblank_counter(dev,
+                                                                       pipe);
        entry->crc[0] = crc0;
        entry->crc[1] = crc1;
        entry->crc[2] = crc2;
--

2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

✗ Ro.CI.BAT: failure for series starting with [1/2] drm/i915: Avoid vblank counter for platforms with DMC.

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915: Avoid vblank counter for platforms with DMC.
URL : https://patchwork.freedesktop.org/series/10289/
State : failure

== Summary ==

Series 10289v1 Series without cover letter
http://patchwork.freedesktop.org/api/1.0/series/10289/revisions/1/mbox

Test drv_module_reload_basic:

                pass       -> DMESG-WARN (fi-skl-i5-6260u)
Test gem_exec_suspend:
        Subgroup basic-s3:
                incomplete -> PASS       (fi-hsw-i7-4770k)
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
Test kms_cursor_legacy:
        Subgroup basic-cursor-vs-flip-legacy:
                fail       -> PASS       (ro-ilk1-i5-650)
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup basic-cursor-vs-flip-varying-size:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup basic-flip-vs-cursor-legacy:
                fail       -> PASS       (ro-hsw-i7-4770r)
                pass       -> FAIL       (ro-bdw-i5-5250u)
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup basic-flip-vs-cursor-varying-size:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
Test kms_flip:
        Subgroup basic-flip-vs-dpms:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup basic-flip-vs-modeset:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup basic-flip-vs-wf_vblank:
                fail       -> PASS       (ro-byt-n2820)
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup basic-plain-flip:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
Test kms_frontbuffer_tracking:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-a:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup hang-read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup hang-read-crc-pipe-c:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup nonblocking-crc-pipe-a:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup nonblocking-crc-pipe-a-frame-sequence:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup nonblocking-crc-pipe-b:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup nonblocking-crc-pipe-b-frame-sequence:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup nonblocking-crc-pipe-c:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup nonblocking-crc-pipe-c-frame-sequence:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup read-crc-pipe-a:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup read-crc-pipe-a-frame-sequence:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup read-crc-pipe-b-frame-sequence:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup read-crc-pipe-c:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup read-crc-pipe-c-frame-sequence:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup suspend-read-crc-pipe-a:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup suspend-read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup suspend-read-crc-pipe-c:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
        Subgroup basic-rte:
                pass       -> DMESG-WARN (fi-skl-i5-6260u)
fi-hsw-i7-4770k  total:200  pass:178  dwarn:0   dfail:0   fail:1   skip:20 
fi-kbl-qkkr      total:239  pass:180  dwarn:29  dfail:0   fail:4   skip:26 
fi-skl-i5-6260u  total:239  pass:194  dwarn:31  dfail:0   fail:0   skip:14 
fi-skl-i7-6700k  total:239  pass:180  dwarn:30  dfail:0   fail:1   skip:28 
fi-snb-i7-2600   total:239  pass:197  dwarn:0   dfail:0   fail:0   skip:42 
ro-bdw-i5-5250u  total:239  pass:217  dwarn:4   dfail:0   fail:2   skip:16 
ro-bdw-i7-5557U  total:239  pass:222  dwarn:1   dfail:0   fail:0   skip:16 
ro-bdw-i7-5600u  total:239  pass:206  dwarn:0   dfail:0   fail:1   skip:32 
ro-bsw-n3050     total:239  pass:193  dwarn:0   dfail:0   fail:4   skip:42 
ro-byt-n2820     total:239  pass:196  dwarn:0   dfail:0   fail:3   skip:40 
ro-hsw-i3-4010u  total:239  pass:213  dwarn:0   dfail:0   fail:0   skip:26 
ro-hsw-i7-4770r  total:239  pass:213  dwarn:0   dfail:0   fail:0   skip:26 
ro-ilk-i7-620lm  total:239  pass:172  dwarn:1   dfail:0   fail:1   skip:65 
ro-ilk1-i5-650   total:234  pass:172  dwarn:0   dfail:0   fail:2   skip:60 
ro-ivb-i7-3770   total:239  pass:204  dwarn:0   dfail:0   fail:0   skip:35 
ro-ivb2-i7-3770  total:239  pass:208  dwarn:0   dfail:0   fail:0   skip:31 
ro-snb-i7-2620M  total:239  pass:197  dwarn:0   dfail:0   fail:1   skip:41 

ro-skl3-i5-6260u failed to connect after reboot

Results at /archive/results/CI_IGT_test/RO_Patchwork_1616/

a53dfb0 drm-intel-nightly: 2016y-07m-26d-17h-51m-26s UTC integration manifest 817a203 drm/i915: Use drm_vblank_count() on gen2 for crc frame count 5cf6ee83a drm/i915: Avoid vblank counter for platforms with DMC.

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx