summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@jsg.id.au>2013-02-23 17:10:28 +1100
committerJonathan Gray <jsg@jsg.id.au>2013-02-23 17:10:28 +1100
commiteef2235cb3beaa34d736fab4cd51e7bd6c8cf7eb (patch)
tree5250d22caf0b4eb23ff73887744410096fdc0ff2
parentaf10d324461c5f817c82171bd8b4f14bebf0471c (diff)
add i915_kernel_lost_context for ums (replaces inteldrm_update_ring).
-rw-r--r--sys/dev/pci/drm/i915_dma.c33
-rw-r--r--sys/dev/pci/drm/i915_drv.h1
-rw-r--r--sys/dev/pci/drm/i915_gem.c2
-rw-r--r--sys/dev/pci/drm/intel_ringbuffer.c4
4 files changed, 35 insertions, 5 deletions
diff --git a/sys/dev/pci/drm/i915_dma.c b/sys/dev/pci/drm/i915_dma.c
index d21b3008507..095e4dee290 100644
--- a/sys/dev/pci/drm/i915_dma.c
+++ b/sys/dev/pci/drm/i915_dma.c
@@ -33,6 +33,39 @@
#include "intel_drv.h"
#include "drm_crtc_helper.h"
+void
+i915_kernel_lost_context(struct drm_device * dev)
+{
+ drm_i915_private_t *dev_priv = dev->dev_private;
+#if 0
+ struct drm_i915_master_private *master_priv;
+#endif
+ struct intel_ring_buffer *ring = LP_RING(dev_priv);
+
+ /*
+ * We should never lose context on the ring with modesetting
+ * as we don't expose it to userspace
+ */
+ if (drm_core_check_feature(dev, DRIVER_MODESET))
+ return;
+
+ ring->head = I915_READ_HEAD(ring) & HEAD_ADDR;
+ ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR;
+ ring->space = ring->head - (ring->tail + I915_RING_FREE_SPACE);
+ if (ring->space < 0)
+ ring->space += ring->size;
+
+#if 0
+ if (!dev->primary->master)
+ return;
+
+ master_priv = dev->primary->master->driver_priv;
+ if (ring->head == ring->tail && master_priv->sarea_priv)
+ master_priv->sarea_priv->perf_boxes |= I915_BOX_RING_EMPTY;
+#endif
+}
+
+
int
i915_getparam(struct inteldrm_softc *dev_priv, void *data)
{
diff --git a/sys/dev/pci/drm/i915_drv.h b/sys/dev/pci/drm/i915_drv.h
index e3d5e710be4..387b01c7943 100644
--- a/sys/dev/pci/drm/i915_drv.h
+++ b/sys/dev/pci/drm/i915_drv.h
@@ -1129,6 +1129,7 @@ void intel_teardown_mchbar(struct inteldrm_softc *,
struct pci_attach_args *, int);
int i915_getparam(struct inteldrm_softc *dev_priv, void *data);
int i915_setparam(struct inteldrm_softc *dev_priv, void *data);
+void i915_kernel_lost_context(struct drm_device *);
/* i915_drv.c */
void inteldrm_wipe_mappings(struct drm_obj *);
diff --git a/sys/dev/pci/drm/i915_gem.c b/sys/dev/pci/drm/i915_gem.c
index 31ebe2cd706..32e2f272808 100644
--- a/sys/dev/pci/drm/i915_gem.c
+++ b/sys/dev/pci/drm/i915_gem.c
@@ -2227,7 +2227,7 @@ i915_gem_idle(struct inteldrm_softc *dev_priv)
/* if we hung then the timer alredy fired. */
timeout_del(&dev_priv->hangcheck_timer);
-// inteldrm_update_ring(&dev_priv->rings[RCS]);
+ i915_kernel_lost_context(dev);
i915_gem_cleanup_ringbuffer(dev);
DRM_UNLOCK();
diff --git a/sys/dev/pci/drm/intel_ringbuffer.c b/sys/dev/pci/drm/intel_ringbuffer.c
index 9e78135d7b7..6ce5382b6b6 100644
--- a/sys/dev/pci/drm/intel_ringbuffer.c
+++ b/sys/dev/pci/drm/intel_ringbuffer.c
@@ -480,11 +480,7 @@ init_ring_common(struct intel_ring_buffer *ring)
}
if (!drm_core_check_feature(ring->dev, DRIVER_MODESET))
-#ifdef notyet
i915_kernel_lost_context(ring->dev);
-#else
- ;
-#endif
else {
ring->head = I915_READ_HEAD(ring);
ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR;