diff options
-rw-r--r-- | sys/dev/pci/drm/i915_dma.c | 27 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915_drv.h | 2 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915_irq.c | 9 |
3 files changed, 20 insertions, 18 deletions
diff --git a/sys/dev/pci/drm/i915_dma.c b/sys/dev/pci/drm/i915_dma.c index 4abc916e120..986d62d7ee4 100644 --- a/sys/dev/pci/drm/i915_dma.c +++ b/sys/dev/pci/drm/i915_dma.c @@ -550,11 +550,14 @@ int i915_dispatch_batchbuffer(struct drm_device * dev, return 0; } -void i915_dispatch_flip(struct drm_device * dev) +int i915_dispatch_flip(struct drm_device * dev) { drm_i915_private_t *dev_priv = dev->dev_private; RING_LOCALS; + if (dev_priv->sarea_priv == NULL) + return EINVAL; + DRM_DEBUG("page=%d pfCurrentPage=%d\n", dev_priv->current_page, dev_priv->sarea_priv->pf_current_page); @@ -581,6 +584,7 @@ void i915_dispatch_flip(struct drm_device * dev) i915_emit_breadcrumb(dev); dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; + return (0); } int i915_quiescent(struct drm_device *dev) @@ -609,8 +613,6 @@ int i915_batchbuffer(struct drm_device *dev, void *data, struct drm_file *file_priv) { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; - drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) - dev_priv->sarea_priv; drm_i915_batchbuffer_t *batch = data; int ret; @@ -628,15 +630,15 @@ int i915_batchbuffer(struct drm_device *dev, void *data, LOCK_TEST_WITH_RETURN(dev, file_priv); if (batch->num_cliprects && DRM_VERIFYAREA_READ(batch->cliprects, - batch->num_cliprects * - sizeof(struct drm_clip_rect))) + batch->num_cliprects * sizeof(struct drm_clip_rect))) return EFAULT; DRM_LOCK(); ret = i915_dispatch_batchbuffer(dev, batch); DRM_UNLOCK(); - sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); + if (dev_priv->sarea_priv != NULL) + dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); return ret; } @@ -644,7 +646,6 @@ int i915_cmdbuffer(struct drm_device *dev, void *data, struct drm_file *file_priv) { drm_i915_private_t *dev_priv = (drm_i915_private_t *)dev->dev_private; - drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *)dev_priv->sarea_priv; drm_i915_cmdbuffer_t *cmdbuf = data; int ret; @@ -672,21 +673,24 @@ int i915_cmdbuffer(struct drm_device *dev, void *data, return ret; } - sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); + if (dev_priv->sarea_priv != NULL) + dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); return 0; } int i915_flip_bufs(struct drm_device *dev, void *data, struct drm_file *file_priv) { + int ret; + DRM_DEBUG("\n"); LOCK_TEST_WITH_RETURN(dev, file_priv); DRM_LOCK(); - i915_dispatch_flip(dev); + ret = i915_dispatch_flip(dev); DRM_UNLOCK(); - return 0; + return (ret); } @@ -848,8 +852,7 @@ void i915_driver_lastclose(struct drm_device * dev) { drm_i915_private_t *dev_priv = dev->dev_private; - /* agp off can use this to get called before dev_priv */ - if (!dev_priv) + if (dev_priv == NULL) return; dev_priv->sarea_priv = NULL; diff --git a/sys/dev/pci/drm/i915_drv.h b/sys/dev/pci/drm/i915_drv.h index d2078a21642..6d1d600d8a5 100644 --- a/sys/dev/pci/drm/i915_drv.h +++ b/sys/dev/pci/drm/i915_drv.h @@ -218,7 +218,7 @@ extern int i915_driver_device_is_agp(struct drm_device * dev); extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); extern void i915_emit_breadcrumb(struct drm_device *dev); -extern void i915_dispatch_flip(struct drm_device *); +extern int i915_dispatch_flip(struct drm_device *); extern int i915_emit_mi_flush(struct drm_device *dev, uint32_t flush); extern int i915_driver_firstopen(struct drm_device *dev); extern int i915_dispatch_batchbuffer(struct drm_device * dev, diff --git a/sys/dev/pci/drm/i915_irq.c b/sys/dev/pci/drm/i915_irq.c index b0d268960ff..d51aff13131 100644 --- a/sys/dev/pci/drm/i915_irq.c +++ b/sys/dev/pci/drm/i915_irq.c @@ -200,7 +200,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) I915_WRITE(IIR, iir); (void) I915_READ(IIR); /* Flush posted writes */ - if (dev_priv->sarea_priv) + if (dev_priv->sarea_priv != NULL) dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); if (iir & I915_USER_INTERRUPT) { @@ -259,7 +259,7 @@ int i915_wait_irq(struct drm_device * dev, int irq_nr) READ_BREADCRUMB(dev_priv)); if (READ_BREADCRUMB(dev_priv) >= irq_nr) { - if (dev_priv->sarea_priv) { + if (dev_priv->sarea_priv != NULL) { dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); } @@ -276,9 +276,8 @@ int i915_wait_irq(struct drm_device * dev, int irq_nr) READ_BREADCRUMB(dev_priv), (int)dev_priv->counter); } - if (dev_priv->sarea_priv) - dev_priv->sarea_priv->last_dispatch = - READ_BREADCRUMB(dev_priv); + if (dev_priv->sarea_priv != NULL) + dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); return ret; } |