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