2012-04-30 03:30:00 +00:00
|
|
|
#ifndef __NOUVEAU_FENCE_H__
|
|
|
|
#define __NOUVEAU_FENCE_H__
|
|
|
|
|
2016-10-25 12:00:45 +00:00
|
|
|
#include <linux/dma-fence.h>
|
2014-01-09 10:03:11 +00:00
|
|
|
#include <nvif/notify.h>
|
|
|
|
|
2012-07-19 22:17:34 +00:00
|
|
|
struct nouveau_drm;
|
2014-01-09 10:03:11 +00:00
|
|
|
struct nouveau_bo;
|
2012-07-19 22:17:34 +00:00
|
|
|
|
2012-04-30 03:30:00 +00:00
|
|
|
struct nouveau_fence {
|
2016-10-25 12:00:45 +00:00
|
|
|
struct dma_fence base;
|
2014-01-09 10:03:11 +00:00
|
|
|
|
2012-04-30 03:30:00 +00:00
|
|
|
struct list_head head;
|
|
|
|
|
2013-02-14 03:43:21 +00:00
|
|
|
bool sysmem;
|
|
|
|
|
2014-12-01 09:11:06 +00:00
|
|
|
struct nouveau_channel __rcu *channel;
|
2012-04-30 03:30:00 +00:00
|
|
|
unsigned long timeout;
|
|
|
|
};
|
|
|
|
|
2013-02-14 03:43:21 +00:00
|
|
|
int nouveau_fence_new(struct nouveau_channel *, bool sysmem,
|
|
|
|
struct nouveau_fence **);
|
2012-04-30 03:30:00 +00:00
|
|
|
void nouveau_fence_unref(struct nouveau_fence **);
|
|
|
|
|
|
|
|
int nouveau_fence_emit(struct nouveau_fence *, struct nouveau_channel *);
|
|
|
|
bool nouveau_fence_done(struct nouveau_fence *);
|
2016-10-25 12:00:45 +00:00
|
|
|
void nouveau_fence_work(struct dma_fence *, void (*)(void *), void *);
|
2012-04-30 03:30:00 +00:00
|
|
|
int nouveau_fence_wait(struct nouveau_fence *, bool lazy, bool intr);
|
2014-09-16 09:15:07 +00:00
|
|
|
int nouveau_fence_sync(struct nouveau_bo *, struct nouveau_channel *, bool exclusive, bool intr);
|
2012-04-30 03:30:00 +00:00
|
|
|
|
2012-04-30 03:55:29 +00:00
|
|
|
struct nouveau_fence_chan {
|
2014-01-09 10:03:11 +00:00
|
|
|
spinlock_t lock;
|
2014-09-29 08:06:18 +00:00
|
|
|
struct kref fence_ref;
|
|
|
|
|
2012-04-30 03:55:29 +00:00
|
|
|
struct list_head pending;
|
2012-07-22 01:55:54 +00:00
|
|
|
struct list_head flip;
|
|
|
|
|
2013-02-14 03:20:17 +00:00
|
|
|
int (*emit)(struct nouveau_fence *);
|
|
|
|
int (*sync)(struct nouveau_fence *, struct nouveau_channel *,
|
|
|
|
struct nouveau_channel *);
|
|
|
|
u32 (*read)(struct nouveau_channel *);
|
|
|
|
int (*emit32)(struct nouveau_channel *, u64, u32);
|
|
|
|
int (*sync32)(struct nouveau_channel *, u64, u32);
|
|
|
|
|
2012-04-30 03:55:29 +00:00
|
|
|
u32 sequence;
|
2014-01-09 10:03:11 +00:00
|
|
|
u32 context;
|
2014-09-29 08:06:18 +00:00
|
|
|
char name[32];
|
2014-01-09 10:03:11 +00:00
|
|
|
|
|
|
|
struct nvif_notify notify;
|
2014-12-01 09:11:06 +00:00
|
|
|
int notify_ref, dead;
|
2012-04-30 03:55:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nouveau_fence_priv {
|
2012-07-19 22:17:34 +00:00
|
|
|
void (*dtor)(struct nouveau_drm *);
|
|
|
|
bool (*suspend)(struct nouveau_drm *);
|
|
|
|
void (*resume)(struct nouveau_drm *);
|
2012-07-19 00:51:42 +00:00
|
|
|
int (*context_new)(struct nouveau_channel *);
|
|
|
|
void (*context_del)(struct nouveau_channel *);
|
2013-01-31 04:57:33 +00:00
|
|
|
|
2016-06-01 13:10:02 +00:00
|
|
|
u32 contexts;
|
|
|
|
u64 context_base;
|
2013-01-31 04:57:33 +00:00
|
|
|
bool uevent;
|
2012-04-30 03:55:29 +00:00
|
|
|
};
|
|
|
|
|
2012-07-19 22:17:34 +00:00
|
|
|
#define nouveau_fence(drm) ((struct nouveau_fence_priv *)(drm)->fence)
|
|
|
|
|
2014-01-09 10:03:11 +00:00
|
|
|
void nouveau_fence_context_new(struct nouveau_channel *, struct nouveau_fence_chan *);
|
2012-04-30 03:55:29 +00:00
|
|
|
void nouveau_fence_context_del(struct nouveau_fence_chan *);
|
2014-09-29 08:06:18 +00:00
|
|
|
void nouveau_fence_context_free(struct nouveau_fence_chan *);
|
2012-04-30 03:55:29 +00:00
|
|
|
|
2012-07-19 22:17:34 +00:00
|
|
|
int nv04_fence_create(struct nouveau_drm *);
|
2012-04-30 03:55:29 +00:00
|
|
|
int nv04_fence_mthd(struct nouveau_channel *, u32, u32, u32);
|
|
|
|
|
2012-07-22 01:55:54 +00:00
|
|
|
int nv10_fence_emit(struct nouveau_fence *);
|
|
|
|
int nv17_fence_sync(struct nouveau_fence *, struct nouveau_channel *,
|
|
|
|
struct nouveau_channel *);
|
|
|
|
u32 nv10_fence_read(struct nouveau_channel *);
|
|
|
|
void nv10_fence_context_del(struct nouveau_channel *);
|
2012-07-19 22:17:34 +00:00
|
|
|
void nv10_fence_destroy(struct nouveau_drm *);
|
|
|
|
int nv10_fence_create(struct nouveau_drm *);
|
2013-02-14 02:59:36 +00:00
|
|
|
|
|
|
|
int nv17_fence_create(struct nouveau_drm *);
|
2012-12-25 17:13:22 +00:00
|
|
|
void nv17_fence_resume(struct nouveau_drm *drm);
|
2012-07-22 01:55:54 +00:00
|
|
|
|
2012-07-19 22:17:34 +00:00
|
|
|
int nv50_fence_create(struct nouveau_drm *);
|
|
|
|
int nv84_fence_create(struct nouveau_drm *);
|
|
|
|
int nvc0_fence_create(struct nouveau_drm *);
|
2012-07-22 01:55:54 +00:00
|
|
|
|
2015-08-20 04:54:18 +00:00
|
|
|
int nouveau_flip_complete(struct nvif_notify *);
|
2012-04-30 03:55:29 +00:00
|
|
|
|
2013-02-13 23:28:37 +00:00
|
|
|
struct nv84_fence_chan {
|
|
|
|
struct nouveau_fence_chan base;
|
2015-01-14 05:36:34 +00:00
|
|
|
struct nvkm_vma vma;
|
|
|
|
struct nvkm_vma vma_gart;
|
2013-02-13 23:28:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nv84_fence_priv {
|
|
|
|
struct nouveau_fence_priv base;
|
|
|
|
struct nouveau_bo *bo;
|
2013-02-14 03:43:21 +00:00
|
|
|
struct nouveau_bo *bo_gart;
|
2013-02-13 23:28:37 +00:00
|
|
|
u32 *suspend;
|
|
|
|
};
|
|
|
|
|
|
|
|
int nv84_fence_context_new(struct nouveau_channel *);
|
|
|
|
|
2012-04-30 03:30:00 +00:00
|
|
|
#endif
|