1 /* $NetBSD: head.h,v 1.2 2021/12/18 23:45:35 riastradh Exp $ */ 2 3 /* SPDX-License-Identifier: MIT */ 4 #ifndef __NVKM_DISP_HEAD_H__ 5 #define __NVKM_DISP_HEAD_H__ 6 #include "priv.h" 7 8 struct nvkm_head { 9 const struct nvkm_head_func *func; 10 struct nvkm_disp *disp; 11 int id; 12 13 struct list_head head; 14 15 struct nvkm_head_state { 16 u16 htotal; 17 u16 hsynce; 18 u16 hblanke; 19 u16 hblanks; 20 u16 vtotal; 21 u16 vsynce; 22 u16 vblanke; 23 u16 vblanks; 24 u32 hz; 25 26 /* Prior to GF119, these are set by the OR. */ 27 struct { 28 u8 depth; 29 } or; 30 } arm, asy; 31 }; 32 33 int nvkm_head_new_(const struct nvkm_head_func *, struct nvkm_disp *, int id); 34 void nvkm_head_del(struct nvkm_head **); 35 int nvkm_head_mthd_scanoutpos(struct nvkm_object *, 36 struct nvkm_head *, void *, u32); 37 struct nvkm_head *nvkm_head_find(struct nvkm_disp *, int id); 38 39 struct nvkm_head_func { 40 void (*state)(struct nvkm_head *, struct nvkm_head_state *); 41 void (*rgpos)(struct nvkm_head *, u16 *hline, u16 *vline); 42 void (*rgclk)(struct nvkm_head *, int div); 43 void (*vblank_get)(struct nvkm_head *); 44 void (*vblank_put)(struct nvkm_head *); 45 }; 46 47 void nv50_head_rgpos(struct nvkm_head *, u16 *, u16 *); 48 49 #define HEAD_MSG(h,l,f,a...) do { \ 50 struct nvkm_head *_h = (h); \ 51 nvkm_##l(&_h->disp->engine.subdev, "head-%d: "f"\n", _h->id, ##a); \ 52 } while(0) 53 #define HEAD_WARN(h,f,a...) HEAD_MSG((h), warn, f, ##a) 54 #define HEAD_DBG(h,f,a...) HEAD_MSG((h), debug, f, ##a) 55 56 int nv04_head_new(struct nvkm_disp *, int id); 57 58 int nv50_head_cnt(struct nvkm_disp *, unsigned long *); 59 int nv50_head_new(struct nvkm_disp *, int id); 60 61 int gf119_head_cnt(struct nvkm_disp *, unsigned long *); 62 int gf119_head_new(struct nvkm_disp *, int id); 63 void gf119_head_rgclk(struct nvkm_head *, int); 64 65 int gv100_head_cnt(struct nvkm_disp *, unsigned long *); 66 int gv100_head_new(struct nvkm_disp *, int id); 67 #endif 68