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