i915: Make use of sarea_priv conditional.
We fail ioctls that depend on the sarea_priv with EINVAL. Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:

committed by
Dave Airlie

parent
546b0974c3
commit
c99b058f13
@@ -55,7 +55,8 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller)
|
|||||||
if (ring->space >= n)
|
if (ring->space >= n)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dev_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT;
|
if (dev_priv->sarea_priv)
|
||||||
|
dev_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT;
|
||||||
|
|
||||||
if (ring->head != last_head)
|
if (ring->head != last_head)
|
||||||
i = 0;
|
i = 0;
|
||||||
@@ -128,7 +129,7 @@ void i915_kernel_lost_context(struct drm_device * dev)
|
|||||||
if (ring->space < 0)
|
if (ring->space < 0)
|
||||||
ring->space += ring->Size;
|
ring->space += ring->Size;
|
||||||
|
|
||||||
if (ring->head == ring->tail)
|
if (ring->head == ring->tail && dev_priv->sarea_priv)
|
||||||
dev_priv->sarea_priv->perf_boxes |= I915_BOX_RING_EMPTY;
|
dev_priv->sarea_priv->perf_boxes |= I915_BOX_RING_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,10 +434,11 @@ static void i915_emit_breadcrumb(struct drm_device *dev)
|
|||||||
drm_i915_private_t *dev_priv = dev->dev_private;
|
drm_i915_private_t *dev_priv = dev->dev_private;
|
||||||
RING_LOCALS;
|
RING_LOCALS;
|
||||||
|
|
||||||
dev_priv->sarea_priv->last_enqueue = ++dev_priv->counter;
|
dev_priv->counter++;
|
||||||
|
|
||||||
if (dev_priv->counter > 0x7FFFFFFFUL)
|
if (dev_priv->counter > 0x7FFFFFFFUL)
|
||||||
dev_priv->sarea_priv->last_enqueue = dev_priv->counter = 1;
|
dev_priv->counter = 0;
|
||||||
|
if (dev_priv->sarea_priv)
|
||||||
|
dev_priv->sarea_priv->last_enqueue = dev_priv->counter;
|
||||||
|
|
||||||
BEGIN_LP_RING(4);
|
BEGIN_LP_RING(4);
|
||||||
OUT_RING(MI_STORE_DWORD_INDEX);
|
OUT_RING(MI_STORE_DWORD_INDEX);
|
||||||
@@ -534,6 +536,9 @@ static int i915_dispatch_flip(struct drm_device * dev)
|
|||||||
drm_i915_private_t *dev_priv = dev->dev_private;
|
drm_i915_private_t *dev_priv = dev->dev_private;
|
||||||
RING_LOCALS;
|
RING_LOCALS;
|
||||||
|
|
||||||
|
if (!dev_priv->sarea_priv)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
DRM_DEBUG("%s: page=%d pfCurrentPage=%d\n",
|
DRM_DEBUG("%s: page=%d pfCurrentPage=%d\n",
|
||||||
__func__,
|
__func__,
|
||||||
dev_priv->current_page,
|
dev_priv->current_page,
|
||||||
@@ -628,7 +633,8 @@ static int i915_batchbuffer(struct drm_device *dev, void *data,
|
|||||||
ret = i915_dispatch_batchbuffer(dev, batch);
|
ret = i915_dispatch_batchbuffer(dev, batch);
|
||||||
mutex_unlock(&dev->struct_mutex);
|
mutex_unlock(&dev->struct_mutex);
|
||||||
|
|
||||||
sarea_priv->last_dispatch = (int)hw_status[5];
|
if (sarea_priv)
|
||||||
|
sarea_priv->last_dispatch = (int)hw_status[5];
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -663,7 +669,8 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
sarea_priv->last_dispatch = (int)hw_status[5];
|
if (sarea_priv)
|
||||||
|
sarea_priv->last_dispatch = (int)hw_status[5];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -427,7 +427,9 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
|
|||||||
I915_WRITE(IMR, dev_priv->irq_mask_reg);
|
I915_WRITE(IMR, dev_priv->irq_mask_reg);
|
||||||
(void) I915_READ(IIR); /* Flush posted writes */
|
(void) I915_READ(IIR); /* Flush posted writes */
|
||||||
|
|
||||||
dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
|
if (dev_priv->sarea_priv)
|
||||||
|
dev_priv->sarea_priv->last_dispatch =
|
||||||
|
READ_BREADCRUMB(dev_priv);
|
||||||
|
|
||||||
if (iir & I915_USER_INTERRUPT) {
|
if (iir & I915_USER_INTERRUPT) {
|
||||||
dev_priv->mm.irq_gem_seqno = i915_get_gem_seqno(dev);
|
dev_priv->mm.irq_gem_seqno = i915_get_gem_seqno(dev);
|
||||||
@@ -456,10 +458,11 @@ static int i915_emit_irq(struct drm_device * dev)
|
|||||||
|
|
||||||
DRM_DEBUG("\n");
|
DRM_DEBUG("\n");
|
||||||
|
|
||||||
dev_priv->sarea_priv->last_enqueue = ++dev_priv->counter;
|
dev_priv->counter++;
|
||||||
|
|
||||||
if (dev_priv->counter > 0x7FFFFFFFUL)
|
if (dev_priv->counter > 0x7FFFFFFFUL)
|
||||||
dev_priv->sarea_priv->last_enqueue = dev_priv->counter = 1;
|
dev_priv->counter = 1;
|
||||||
|
if (dev_priv->sarea_priv)
|
||||||
|
dev_priv->sarea_priv->last_enqueue = dev_priv->counter;
|
||||||
|
|
||||||
BEGIN_LP_RING(6);
|
BEGIN_LP_RING(6);
|
||||||
OUT_RING(MI_STORE_DWORD_INDEX);
|
OUT_RING(MI_STORE_DWORD_INDEX);
|
||||||
@@ -503,11 +506,15 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
|
|||||||
READ_BREADCRUMB(dev_priv));
|
READ_BREADCRUMB(dev_priv));
|
||||||
|
|
||||||
if (READ_BREADCRUMB(dev_priv) >= irq_nr) {
|
if (READ_BREADCRUMB(dev_priv) >= irq_nr) {
|
||||||
dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
|
if (dev_priv->sarea_priv) {
|
||||||
|
dev_priv->sarea_priv->last_dispatch =
|
||||||
|
READ_BREADCRUMB(dev_priv);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT;
|
if (dev_priv->sarea_priv)
|
||||||
|
dev_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT;
|
||||||
|
|
||||||
i915_user_irq_get(dev);
|
i915_user_irq_get(dev);
|
||||||
DRM_WAIT_ON(ret, dev_priv->irq_queue, 3 * DRM_HZ,
|
DRM_WAIT_ON(ret, dev_priv->irq_queue, 3 * DRM_HZ,
|
||||||
@@ -519,7 +526,9 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
|
|||||||
READ_BREADCRUMB(dev_priv), (int)dev_priv->counter);
|
READ_BREADCRUMB(dev_priv), (int)dev_priv->counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
|
if (dev_priv->sarea_priv)
|
||||||
|
dev_priv->sarea_priv->last_dispatch =
|
||||||
|
READ_BREADCRUMB(dev_priv);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -682,7 +691,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
|
|||||||
struct list_head *list;
|
struct list_head *list;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!dev_priv) {
|
if (!dev_priv || !dev_priv->sarea_priv) {
|
||||||
DRM_ERROR("%s called with no initialization\n", __func__);
|
DRM_ERROR("%s called with no initialization\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user