i915: Make sarea_priv setup optional.
authorKristian Høgsberg <krh@redhat.com>
Tue, 5 Feb 2008 17:25:22 +0000 (12:25 -0500)
committerKristian Høgsberg <krh@sasori.boston.redhat.com>
Wed, 13 Feb 2008 18:34:02 +0000 (13:34 -0500)
shared-core/i915_dma.c
shared-core/i915_irq.c

index 608723f..9619525 100644 (file)
@@ -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, 
index d463f6e..fd08b6e 100644 (file)
@@ -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;
        }