aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_drv.h
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-10-06 02:16:59 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-12-03 00:05:18 -0500
commitcff5c1332486ced8ff4180e957e04983cb72a39e (patch)
treeec1f6687156277632aef96693c1b8eca0c022b7c /drivers/gpu/drm/nouveau/nouveau_drv.h
parent6a6b73f254123851f7f73ab5e57344a569d6a0ab (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.h23
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 */
735extern int nouveau_agpmode; 728extern int nouveau_agpmode;
736extern int nouveau_duallink; 729extern int nouveau_duallink;
@@ -805,13 +798,13 @@ extern int nouveau_ioctl_notifier_free(struct drm_device *, void *data,
805extern struct drm_ioctl_desc nouveau_ioctls[]; 798extern struct drm_ioctl_desc nouveau_ioctls[];
806extern int nouveau_max_ioctl; 799extern int nouveau_max_ioctl;
807extern void nouveau_channel_cleanup(struct drm_device *, struct drm_file *); 800extern void nouveau_channel_cleanup(struct drm_device *, struct drm_file *);
808extern int nouveau_channel_owner(struct drm_device *, struct drm_file *,
809 int channel);
810extern int nouveau_channel_alloc(struct drm_device *dev, 801extern 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);
814extern void nouveau_channel_free(struct nouveau_channel *); 805extern struct nouveau_channel *
806nouveau_channel_get(struct drm_device *, struct drm_file *, int id);
807extern void nouveau_channel_put(struct nouveau_channel **);
815 808
816/* nouveau_object.c */ 809/* nouveau_object.c */
817extern int nouveau_gpuobj_early_init(struct drm_device *); 810extern int nouveau_gpuobj_early_init(struct drm_device *);