File Index
Files and directories
Sign in
FILE

nouveau_fence.h

File preview with syntax highlighting.

linux-6.19.14/drivers/gpu/drm/nouveau/nouveau_fence.h C
  1/* SPDX-License-Identifier: MIT */
  2#ifndef __NOUVEAU_FENCE_H__
  3#define __NOUVEAU_FENCE_H__
  4
  5#include <linux/dma-fence.h>
  6#include <nvif/event.h>
  7
  8struct nouveau_drm;
  9struct nouveau_bo;
 10
 11struct nouveau_fence {
 12	struct dma_fence base;
 13
 14	struct list_head head;
 15
 16	struct nouveau_channel __rcu *channel;
 17	unsigned long timeout;
 18};
 19
 20static inline struct nouveau_fence *
 21to_nouveau_fence(struct dma_fence *fence)
 22{
 23	return container_of(fence, struct nouveau_fence, base);
 24}
 25
 26int  nouveau_fence_create(struct nouveau_fence **, struct nouveau_channel *);
 27int  nouveau_fence_new(struct nouveau_fence **, struct nouveau_channel *);
 28void nouveau_fence_unref(struct nouveau_fence **);
 29
 30int  nouveau_fence_emit(struct nouveau_fence *);
 31bool nouveau_fence_done(struct nouveau_fence *);
 32int  nouveau_fence_wait(struct nouveau_fence *, bool lazy, bool intr);
 33int  nouveau_fence_sync(struct nouveau_bo *, struct nouveau_channel *, bool exclusive, bool intr);
 34
 35struct nouveau_fence_chan {
 36	spinlock_t lock;
 37	struct kref fence_ref;
 38
 39	struct list_head pending;
 40	struct list_head flip;
 41
 42	int  (*emit)(struct nouveau_fence *);
 43	int  (*sync)(struct nouveau_fence *, struct nouveau_channel *,
 44		     struct nouveau_channel *);
 45	u32  (*read)(struct nouveau_channel *);
 46	int  (*emit32)(struct nouveau_channel *, u64, u32);
 47	int  (*sync32)(struct nouveau_channel *, u64, u32);
 48
 49	u32 sequence;
 50	u32 context;
 51	char name[32];
 52
 53	struct work_struct uevent_work;
 54	struct nvif_event event;
 55	int notify_ref, dead, killed;
 56};
 57
 58struct nouveau_fence_priv {
 59	void (*dtor)(struct nouveau_drm *);
 60	bool (*suspend)(struct nouveau_drm *);
 61	void (*resume)(struct nouveau_drm *);
 62	int  (*context_new)(struct nouveau_channel *);
 63	void (*context_del)(struct nouveau_channel *);
 64
 65	bool uevent;
 66};
 67
 68#define nouveau_fence(drm) ((struct nouveau_fence_priv *)(drm)->fence)
 69
 70void nouveau_fence_context_new(struct nouveau_channel *, struct nouveau_fence_chan *);
 71void nouveau_fence_context_del(struct nouveau_fence_chan *);
 72void nouveau_fence_context_free(struct nouveau_fence_chan *);
 73void nouveau_fence_context_kill(struct nouveau_fence_chan *, int error);
 74
 75int nv04_fence_create(struct nouveau_drm *);
 76int nv04_fence_mthd(struct nouveau_channel *, u32, u32, u32);
 77
 78int  nv10_fence_emit(struct nouveau_fence *);
 79int  nv17_fence_sync(struct nouveau_fence *, struct nouveau_channel *,
 80		     struct nouveau_channel *);
 81u32  nv10_fence_read(struct nouveau_channel *);
 82void nv10_fence_context_del(struct nouveau_channel *);
 83void nv10_fence_destroy(struct nouveau_drm *);
 84int  nv10_fence_create(struct nouveau_drm *);
 85
 86int  nv17_fence_create(struct nouveau_drm *);
 87void nv17_fence_resume(struct nouveau_drm *drm);
 88
 89int nv50_fence_create(struct nouveau_drm *);
 90int nv84_fence_create(struct nouveau_drm *);
 91int nvc0_fence_create(struct nouveau_drm *);
 92int gv100_fence_create(struct nouveau_drm *);
 93
 94struct nv84_fence_chan {
 95	struct nouveau_fence_chan base;
 96	struct nouveau_vma *vma;
 97};
 98
 99struct nv84_fence_priv {
100	struct nouveau_fence_priv base;
101	struct nouveau_bo *bo;
102	u32 *suspend;
103	struct mutex mutex;
104};
105
106int  nv84_fence_context_new(struct nouveau_channel *);
107
108#endif
~/ Read-only file preview.