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