Commit 0baf823a authored by Keith Packard's avatar Keith Packard Committed by Dave Airlie

drm/i915: Move legacy breadcrumb out of the reserved status page area

Addresses in the hardware status page below index 0x20 are reserved for use
by the hardware. The legacy breadcrumb was sitting at index 5. Move it to
index 0x21, and make sure everyone uses the defined value instead of
hard-coded constants.
Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent afa21e05
...@@ -445,7 +445,7 @@ static void i915_emit_breadcrumb(struct drm_device *dev) ...@@ -445,7 +445,7 @@ static void i915_emit_breadcrumb(struct drm_device *dev)
BEGIN_LP_RING(4); BEGIN_LP_RING(4);
OUT_RING(MI_STORE_DWORD_INDEX); OUT_RING(MI_STORE_DWORD_INDEX);
OUT_RING(5 << MI_STORE_DWORD_INDEX_SHIFT); OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
OUT_RING(dev_priv->counter); OUT_RING(dev_priv->counter);
OUT_RING(0); OUT_RING(0);
ADVANCE_LP_RING(); ADVANCE_LP_RING();
...@@ -576,7 +576,7 @@ static int i915_dispatch_flip(struct drm_device * dev) ...@@ -576,7 +576,7 @@ static int i915_dispatch_flip(struct drm_device * dev)
BEGIN_LP_RING(4); BEGIN_LP_RING(4);
OUT_RING(MI_STORE_DWORD_INDEX); OUT_RING(MI_STORE_DWORD_INDEX);
OUT_RING(5 << MI_STORE_DWORD_INDEX_SHIFT); OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
OUT_RING(dev_priv->counter); OUT_RING(dev_priv->counter);
OUT_RING(0); OUT_RING(0);
ADVANCE_LP_RING(); ADVANCE_LP_RING();
...@@ -611,7 +611,6 @@ static int i915_batchbuffer(struct drm_device *dev, void *data, ...@@ -611,7 +611,6 @@ static int i915_batchbuffer(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
u32 *hw_status = dev_priv->hw_status_page;
drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *)
dev_priv->sarea_priv; dev_priv->sarea_priv;
drm_i915_batchbuffer_t *batch = data; drm_i915_batchbuffer_t *batch = data;
...@@ -637,7 +636,7 @@ static int i915_batchbuffer(struct drm_device *dev, void *data, ...@@ -637,7 +636,7 @@ static int i915_batchbuffer(struct drm_device *dev, void *data,
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
if (sarea_priv) if (sarea_priv)
sarea_priv->last_dispatch = (int)hw_status[5]; sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
return ret; return ret;
} }
...@@ -645,7 +644,6 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, ...@@ -645,7 +644,6 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
u32 *hw_status = dev_priv->hw_status_page;
drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *)
dev_priv->sarea_priv; dev_priv->sarea_priv;
drm_i915_cmdbuffer_t *cmdbuf = data; drm_i915_cmdbuffer_t *cmdbuf = data;
...@@ -673,7 +671,7 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, ...@@ -673,7 +671,7 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
} }
if (sarea_priv) if (sarea_priv)
sarea_priv->last_dispatch = (int)hw_status[5]; sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
return 0; return 0;
} }
......
...@@ -608,8 +608,9 @@ static inline void opregion_enable_asle(struct drm_device *dev) { return; } ...@@ -608,8 +608,9 @@ static inline void opregion_enable_asle(struct drm_device *dev) { return; }
* The area from dword 0x20 to 0x3ff is available for driver usage. * The area from dword 0x20 to 0x3ff is available for driver usage.
*/ */
#define READ_HWSP(dev_priv, reg) (((volatile u32*)(dev_priv->hw_status_page))[reg]) #define READ_HWSP(dev_priv, reg) (((volatile u32*)(dev_priv->hw_status_page))[reg])
#define READ_BREADCRUMB(dev_priv) READ_HWSP(dev_priv, 5) #define READ_BREADCRUMB(dev_priv) READ_HWSP(dev_priv, I915_BREADCRUMB_INDEX)
#define I915_GEM_HWS_INDEX 0x20 #define I915_GEM_HWS_INDEX 0x20
#define I915_BREADCRUMB_INDEX 0x21
extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
......
...@@ -212,12 +212,10 @@ static int i915_emit_irq(struct drm_device * dev) ...@@ -212,12 +212,10 @@ static int i915_emit_irq(struct drm_device * dev)
if (dev_priv->sarea_priv) if (dev_priv->sarea_priv)
dev_priv->sarea_priv->last_enqueue = dev_priv->counter; dev_priv->sarea_priv->last_enqueue = dev_priv->counter;
BEGIN_LP_RING(6); BEGIN_LP_RING(4);
OUT_RING(MI_STORE_DWORD_INDEX); OUT_RING(MI_STORE_DWORD_INDEX);
OUT_RING(5 << MI_STORE_DWORD_INDEX_SHIFT); OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
OUT_RING(dev_priv->counter); OUT_RING(dev_priv->counter);
OUT_RING(0);
OUT_RING(0);
OUT_RING(MI_USER_INTERRUPT); OUT_RING(MI_USER_INTERRUPT);
ADVANCE_LP_RING(); ADVANCE_LP_RING();
......
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