summaryrefslogtreecommitdiff
path: root/shared-core
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2008-02-05 12:25:22 -0500
committerKristian Høgsberg <krh@sasori.boston.redhat.com>2008-02-13 13:34:02 -0500
commit4feb0638f1a8eb8527647ff47312ee61e3f683f9 (patch)
tree0eb0e10f379d878242f32fa07e63eaada842cbdd /shared-core
parentd63b57749f097b36df04c6beff9b35a1dd859523 (diff)
i915: Make sarea_priv setup optional.
Diffstat (limited to 'shared-core')
-rw-r--r--shared-core/i915_dma.c20
-rw-r--r--shared-core/i915_irq.c10
2 files changed, 22 insertions, 8 deletions
diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c
index 608723f4..9619525d 100644
--- a/shared-core/i915_dma.c
+++ b/shared-core/i915_dma.c
@@ -128,8 +128,14 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
dev_priv->max_validate_buffers = I915_MAX_VALIDATE_BUFFERS;
#endif
- dev_priv->sarea_priv = (drm_i915_sarea_t *)
- ((u8 *) dev_priv->sarea->handle + init->sarea_priv_offset);
+ if (init->sarea_priv_offset)
+ dev_priv->sarea_priv = (drm_i915_sarea_t *)
+ ((u8 *) dev_priv->sarea->handle +
+ init->sarea_priv_offset);
+ else {
+ /* No sarea_priv for you! */
+ dev_priv->sarea_priv = NULL;
+ }
dev_priv->ring.Start = init->ring_start;
dev_priv->ring.End = init->ring_end;
@@ -154,7 +160,9 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
dev_priv->ring.virtual_start = dev_priv->ring.map.handle;
dev_priv->cpp = init->cpp;
- dev_priv->sarea_priv->pf_current_page = 0;
+
+ if (dev_priv->sarea_priv)
+ dev_priv->sarea_priv->pf_current_page = 0;
/* We are using separate values as placeholders for mechanisms for
* private backbuffer/depthbuffer usage.
@@ -426,7 +434,8 @@ void i915_emit_breadcrumb(struct drm_device *dev)
DRM_DEBUG("Breadcrumb counter wrapped around\n");
}
- dev_priv->sarea_priv->last_enqueue = dev_priv->counter;
+ if (dev_priv->sarea_priv)
+ dev_priv->sarea_priv->last_enqueue = dev_priv->counter;
BEGIN_LP_RING(4);
OUT_RING(CMD_STORE_DWORD_IDX);
@@ -1101,7 +1110,8 @@ static int i915_execbuffer(struct drm_device *dev, void *data,
if (ret)
goto out_err0;
- sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
+ if (sarea_priv)
+ sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
/* fence */
ret = drm_fence_buffer_objects(dev, NULL, fence_arg->flags,
diff --git a/shared-core/i915_irq.c b/shared-core/i915_irq.c
index d463f6e6..fd08b6e8 100644
--- a/shared-core/i915_irq.c
+++ b/shared-core/i915_irq.c
@@ -450,7 +450,9 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
temp &= (dev_priv->irq_enable_reg | USER_INT_FLAG | VSYNC_PIPEA_FLAG |
VSYNC_PIPEB_FLAG);
- 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 (temp & USER_INT_FLAG) {
DRM_WAKEUP(&dev_priv->irq_queue);
@@ -529,7 +531,9 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
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;
}
@@ -693,7 +697,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
return -EINVAL;
}
- if (dev_priv->sarea_priv->rotation) {
+ if (!dev_priv->sarea_priv || dev_priv->sarea_priv->rotation) {
DRM_DEBUG("Rotation not supported\n");
return -EINVAL;
}