diff options
author | Kristian Høgsberg <krh@redhat.com> | 2008-08-20 11:20:13 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2008-10-18 07:10:51 +1000 |
commit | c99b058f132388a666544d293392d52d1def6b12 (patch) | |
tree | d9417f12dfa2957af7c0fa86f47be29691c0cd97 /drivers/gpu/drm/i915/i915_dma.c | |
parent | 546b0974c39657017407c86fe79811100b60700d (diff) | |
download | talos-op-linux-c99b058f132388a666544d293392d52d1def6b12.tar.gz talos-op-linux-c99b058f132388a666544d293392d52d1def6b12.zip |
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>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_dma.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index d71c89f8802e..048da791ca66 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -55,7 +55,8 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller) if (ring->space >= n) 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) i = 0; @@ -128,7 +129,7 @@ void i915_kernel_lost_context(struct drm_device * dev) if (ring->space < 0) 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; } @@ -433,10 +434,11 @@ static void i915_emit_breadcrumb(struct drm_device *dev) drm_i915_private_t *dev_priv = dev->dev_private; RING_LOCALS; - dev_priv->sarea_priv->last_enqueue = ++dev_priv->counter; - + dev_priv->counter++; 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); 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; RING_LOCALS; + if (!dev_priv->sarea_priv) + return -EINVAL; + DRM_DEBUG("%s: page=%d pfCurrentPage=%d\n", __func__, dev_priv->current_page, @@ -628,7 +633,8 @@ static int i915_batchbuffer(struct drm_device *dev, void *data, ret = i915_dispatch_batchbuffer(dev, batch); 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; } @@ -663,7 +669,8 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, return ret; } - sarea_priv->last_dispatch = (int)hw_status[5]; + if (sarea_priv) + sarea_priv->last_dispatch = (int)hw_status[5]; return 0; } |