Skip to contentSkip to conversation

drm/i915: init hardware to a known state on resume v3

PATCH In review Jesse Barnes 2 participants 2 messages Apr 23, 2013 – Apr 24, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: init hardware to a known state on resume v3

From: Zou Nanhai <[email protected]>

Needed on SNB to avoid some RC6 related hangs.

v2: remove unneeded defines (Ken)
v3: update to agp-less driver (Jesse)
fixup for new GEM APIs (Jesse)
make debugfs use new locking (Jesse)

---
 drivers/gpu/drm/i915/Makefile       |    1 +
 drivers/gpu/drm/i915/i915_debugfs.c |   22 +
 drivers/gpu/drm/i915/i915_drv.c     |    8 +-
 drivers/gpu/drm/i915/i915_drv.h     |    7 +
 drivers/gpu/drm/i915/i965_defines.h |  141 +++++
 drivers/gpu/drm/i915/intel_3d.c     | 1085 +++++++++++++++++++++++++++++++++++
 6 files changed, 1263 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/i915/i965_defines.h
 create mode 100644 drivers/gpu/drm/i915/intel_3d.c
drivers/gpu/drm/i915/Makefile +1 -0
index 91f3ac6..6253390 100644
@@ -32,6 +32,7 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o \
 	  intel_fb.o \
 	  intel_tv.o \
 	  intel_dvo.o \
+	  intel_3d.o \
 	  intel_ringbuffer.o \
 	  intel_overlay.o \
 	  intel_sprite.o \
drivers/gpu/drm/i915/i915_debugfs.c +22 -0
index a55630a..eb93539 100644
@@ -1444,6 +1444,26 @@ out:
 	return 0;
 }
 
+static int i915_gem_framebuffer_draw_3drect(struct seq_file *m, void *data)
+{
+	struct drm_info_node *node = (struct drm_info_node *) m->private;
+	struct drm_device *dev = node->minor->dev;
+	drm_i915_private_t *dev_priv = dev->dev_private;
+	struct intel_crtc *crtc;
+	int pipe;
+
+	drm_modeset_lock_all(dev);
+	for_each_pipe(pipe) {
+		crtc = to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
+		if (!crtc->base.fb)
+			continue;
+		i915_render_rect(dev, to_intel_framebuffer(crtc->base.fb),
+				 100, 100, 100, 100);
+	}
+	drm_modeset_unlock_all(dev);
+	return 0;
+}
+
 static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
@@ -2110,6 +2130,8 @@ static struct drm_info_list i915_debugfs_list[] = {
 	{"i915_fbc_status", i915_fbc_status, 0},
 	{"i915_sr_status", i915_sr_status, 0},
 	{"i915_opregion", i915_opregion, 0},
+
+	{"i915_draw_rect",i915_gem_framebuffer_draw_3drect, 0},
 	{"i915_gem_framebuffer", i915_gem_framebuffer_info, 0},
 	{"i915_context_status", i915_context_status, 0},
 	{"i915_gen6_forcewake_count", i915_gen6_forcewake_count_info, 0},
drivers/gpu/drm/i915/i915_drv.c +7 -1
index 624cdfc..e31f305 100644
@@ -512,7 +512,9 @@ static int i915_drm_freeze(struct drm_device *dev)
 
 	/* If KMS is active, we do the leavevt stuff here */
 	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-		int error = i915_gem_idle(dev);
+		int error;
+		gen6_suspend_workaround(dev);
+		error = i915_gem_idle(dev);
 		if (error) {
 			dev_err(&dev->pdev->dev,
 				"GEM idle failed, resume might fail\n");
@@ -639,6 +641,10 @@ static int __i915_drm_thaw(struct drm_device *dev)
 		dev_priv->enable_hotplug_processing = true;
 		/* Config may have changed between suspend and resume */
 		intel_resume_hotplug(dev);
+
+		mutex_lock(&dev->struct_mutex);
+		gen6_wakeup_workaround(dev);
+		mutex_unlock(&dev->struct_mutex);
 	}
 
 	intel_opregion_init(dev);
drivers/gpu/drm/i915/i915_drv.h +7 -0
index a4234a8..4626e79 100644
@@ -1862,6 +1862,13 @@ extern bool i915_semaphore_is_enabled(struct drm_device *dev);
 int i915_reg_read_ioctl(struct drm_device *dev, void *data,
 			struct drm_file *file);
 
+extern void gen6_wakeup_workaround (struct drm_device *dev);
+extern void gen6_suspend_workaround (struct drm_device *dev);
+
+struct intel_framebuffer;
+extern void i915_render_rect(struct drm_device *dev,
+		struct intel_framebuffer *fb, int x, int y, int w, int h);
+
 /* overlay */
 #ifdef CONFIG_DEBUG_FS
 extern struct intel_overlay_error_state *intel_overlay_capture_error_state(struct drm_device *dev);
drivers/gpu/drm/i915/i965_defines.h new file +141 -0

141 lines not on this page · raw message

drivers/gpu/drm/i915/intel_3d.c new file +1085 -0

1,085 lines not on this page · raw message

Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 3 lines · Jesse Barnes

From: Zou Nanhai <[email protected]>

Needed on SNB to avoid some RC6 related hangs.

IIRC, the wa was not for a hang, but for render corruption.

Quoted 7 lines

v2: remove unneeded defines (Ken)
v3: update to agp-less driver (Jesse)
fixup for new GEM APIs (Jesse)
make debugfs use new locking (Jesse)

Hmm, why do you want to emit gen6 state on gen7+? Please tidy up the state emission, it is very very ugly, contains lots of redundancy and some interesting choice of hard coded magic. The emit_wa() flush/idle sequence doesn't do what you want, whereas emit_rect() does. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre