diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2010-10-06 02:16:59 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-12-03 00:05:18 -0500 |
commit | cff5c1332486ced8ff4180e957e04983cb72a39e (patch) | |
tree | ec1f6687156277632aef96693c1b8eca0c022b7c /drivers/gpu/drm/nouveau/nouveau_drv.h | |
parent | 6a6b73f254123851f7f73ab5e57344a569d6a0ab (diff) |
drm/nouveau: add more fine-grained locking to channel list + structures
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_drv.h')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 04bc56cf4f1a..c3f102125083 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -166,6 +166,7 @@ struct nouveau_channel { | |||
166 | struct drm_device *dev; | 166 | struct drm_device *dev; |
167 | int id; | 167 | int id; |
168 | 168 | ||
169 | atomic_t refcount; | ||
169 | struct mutex mutex; | 170 | struct mutex mutex; |
170 | 171 | ||
171 | /* owner of this fifo */ | 172 | /* owner of this fifo */ |
@@ -607,8 +608,10 @@ struct drm_nouveau_private { | |||
607 | struct nouveau_bo *bo; | 608 | struct nouveau_bo *bo; |
608 | } fence; | 609 | } fence; |
609 | 610 | ||
610 | int fifo_alloc_count; | 611 | struct { |
611 | struct nouveau_channel *fifos[NOUVEAU_MAX_CHANNEL_NR]; | 612 | spinlock_t lock; |
613 | struct nouveau_channel *ptr[NOUVEAU_MAX_CHANNEL_NR]; | ||
614 | } channels; | ||
612 | 615 | ||
613 | struct nouveau_engine engine; | 616 | struct nouveau_engine engine; |
614 | struct nouveau_channel *channel; | 617 | struct nouveau_channel *channel; |
@@ -721,16 +724,6 @@ nouveau_bo_ref(struct nouveau_bo *ref, struct nouveau_bo **pnvbo) | |||
721 | return 0; | 724 | return 0; |
722 | } | 725 | } |
723 | 726 | ||
724 | #define NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(id, cl, ch) do { \ | ||
725 | struct drm_nouveau_private *nv = dev->dev_private; \ | ||
726 | if (!nouveau_channel_owner(dev, (cl), (id))) { \ | ||
727 | NV_ERROR(dev, "pid %d doesn't own channel %d\n", \ | ||
728 | DRM_CURRENTPID, (id)); \ | ||
729 | return -EPERM; \ | ||
730 | } \ | ||
731 | (ch) = nv->fifos[(id)]; \ | ||
732 | } while (0) | ||
733 | |||
734 | /* nouveau_drv.c */ | 727 | /* nouveau_drv.c */ |
735 | extern int nouveau_agpmode; | 728 | extern int nouveau_agpmode; |
736 | extern int nouveau_duallink; | 729 | extern int nouveau_duallink; |
@@ -805,13 +798,13 @@ extern int nouveau_ioctl_notifier_free(struct drm_device *, void *data, | |||
805 | extern struct drm_ioctl_desc nouveau_ioctls[]; | 798 | extern struct drm_ioctl_desc nouveau_ioctls[]; |
806 | extern int nouveau_max_ioctl; | 799 | extern int nouveau_max_ioctl; |
807 | extern void nouveau_channel_cleanup(struct drm_device *, struct drm_file *); | 800 | extern void nouveau_channel_cleanup(struct drm_device *, struct drm_file *); |
808 | extern int nouveau_channel_owner(struct drm_device *, struct drm_file *, | ||
809 | int channel); | ||
810 | extern int nouveau_channel_alloc(struct drm_device *dev, | 801 | extern int nouveau_channel_alloc(struct drm_device *dev, |
811 | struct nouveau_channel **chan, | 802 | struct nouveau_channel **chan, |
812 | struct drm_file *file_priv, | 803 | struct drm_file *file_priv, |
813 | uint32_t fb_ctxdma, uint32_t tt_ctxdma); | 804 | uint32_t fb_ctxdma, uint32_t tt_ctxdma); |
814 | extern void nouveau_channel_free(struct nouveau_channel *); | 805 | extern struct nouveau_channel * |
806 | nouveau_channel_get(struct drm_device *, struct drm_file *, int id); | ||
807 | extern void nouveau_channel_put(struct nouveau_channel **); | ||
815 | 808 | ||
816 | /* nouveau_object.c */ | 809 | /* nouveau_object.c */ |
817 | extern int nouveau_gpuobj_early_init(struct drm_device *); | 810 | extern int nouveau_gpuobj_early_init(struct drm_device *); |