From 2a7909c0ade08c66690e6115ae49765dc47873e6 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 20 Aug 2015 14:54:19 +1000 Subject: drm/nouveau/disp: split user classes out from engine implementations Signed-off-by: Ben Skeggs --- .../gpu/drm/nouveau/nvkm/engine/disp/channv50.h | 103 +++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.h (limited to 'drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.h') diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.h new file mode 100644 index 000000000000..982d1bfe9a6b --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.h @@ -0,0 +1,103 @@ +#ifndef __NV50_DISP_CHAN_H__ +#define __NV50_DISP_CHAN_H__ +#include "nv50.h" + +struct nv50_disp_chan_impl { + struct nvkm_ofuncs base; + int chid; + int (*attach)(struct nvkm_object *, struct nvkm_object *, u32); + void (*detach)(struct nvkm_object *, int); +}; + +#include + +struct nv50_disp_chan { + struct nvkm_namedb base; + int chid; +}; + +int nv50_disp_chan_create_(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, int, int, void **); +void nv50_disp_chan_destroy(struct nv50_disp_chan *); +int nv50_disp_chan_ntfy(struct nvkm_object *, u32, struct nvkm_event **); +int nv50_disp_chan_map(struct nvkm_object *, u64 *, u32 *); +u32 nv50_disp_chan_rd32(struct nvkm_object *, u64); +void nv50_disp_chan_wr32(struct nvkm_object *, u64, u32); +extern const struct nvkm_event_func nv50_disp_chan_uevent; +int nv50_disp_chan_uevent_ctor(struct nvkm_object *, void *, u32, + struct nvkm_notify *); +void nv50_disp_chan_uevent_send(struct nv50_disp *, int); + +extern const struct nvkm_event_func gf119_disp_chan_uevent; + +#define nv50_disp_chan_init(a) \ + nvkm_namedb_init(&(a)->base) +#define nv50_disp_chan_fini(a,b) \ + nvkm_namedb_fini(&(a)->base, (b)) + +struct nv50_disp_pioc { + struct nv50_disp_chan base; +}; + +int nv50_disp_pioc_create_(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, int, int, void **); +void nv50_disp_pioc_dtor(struct nvkm_object *); +int nv50_disp_pioc_init(struct nvkm_object *); +int nv50_disp_pioc_fini(struct nvkm_object *, bool); + +int gf119_disp_pioc_init(struct nvkm_object *); +int gf119_disp_pioc_fini(struct nvkm_object *, bool); + +struct nv50_disp_mthd_list { + u32 mthd; + u32 addr; + struct { + u32 mthd; + u32 addr; + const char *name; + } data[]; +}; + +struct nv50_disp_mthd_chan { + const char *name; + u32 addr; + struct { + const char *name; + int nr; + const struct nv50_disp_mthd_list *mthd; + } data[]; +}; + +void nv50_disp_mthd_chan(struct nv50_disp *, int debug, int head, + const struct nv50_disp_mthd_chan *); + +extern const struct nv50_disp_mthd_chan nv50_disp_core_mthd_chan; +extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_base; +extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_sor; +extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_pior; +extern const struct nv50_disp_mthd_chan nv50_disp_base_mthd_chan; +extern const struct nv50_disp_mthd_list nv50_disp_base_mthd_image; +extern const struct nv50_disp_mthd_chan nv50_disp_ovly_mthd_chan; +extern const struct nv50_disp_mthd_list nv50_disp_ovly_mthd_base; + +extern const struct nv50_disp_mthd_chan g84_disp_core_mthd_chan; +extern const struct nv50_disp_mthd_list g84_disp_core_mthd_dac; +extern const struct nv50_disp_mthd_list g84_disp_core_mthd_head; +extern const struct nv50_disp_mthd_chan g84_disp_base_mthd_chan; +extern const struct nv50_disp_mthd_chan g84_disp_ovly_mthd_chan; + +extern const struct nv50_disp_mthd_chan g94_disp_core_mthd_chan; + +extern const struct nv50_disp_mthd_chan gt200_disp_ovly_mthd_chan; + +extern const struct nv50_disp_mthd_chan gf119_disp_core_mthd_chan; +extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_base; +extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_dac; +extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_sor; +extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_pior; +extern const struct nv50_disp_mthd_chan gf119_disp_base_mthd_chan; +extern const struct nv50_disp_mthd_chan gf119_disp_ovly_mthd_chan; + +extern const struct nv50_disp_mthd_chan gk104_disp_core_mthd_chan; +extern const struct nv50_disp_mthd_chan gk104_disp_ovly_mthd_chan; +#endif -- cgit v1.2.3 From 0ce41e3c66ca8958dec427f1c46f64efdda90f30 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 20 Aug 2015 14:54:19 +1000 Subject: drm/nouveau/disp: convert user classes to new-style nvkm_object Signed-off-by: Ben Skeggs --- .../gpu/drm/nouveau/nvkm/engine/disp/channv50.h | 128 ++++++++++++--------- 1 file changed, 76 insertions(+), 52 deletions(-) (limited to 'drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.h') diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.h index 982d1bfe9a6b..aee374884c96 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.h @@ -1,28 +1,40 @@ #ifndef __NV50_DISP_CHAN_H__ #define __NV50_DISP_CHAN_H__ +#define nv50_disp_chan(p) container_of((p), struct nv50_disp_chan, object) #include "nv50.h" -struct nv50_disp_chan_impl { - struct nvkm_ofuncs base; +struct nv50_disp_chan { + const struct nv50_disp_chan_func *func; + const struct nv50_disp_chan_mthd *mthd; + struct nv50_disp_root *root; int chid; - int (*attach)(struct nvkm_object *, struct nvkm_object *, u32); - void (*detach)(struct nvkm_object *, int); -}; + int head; -#include + struct nvkm_object object; +}; -struct nv50_disp_chan { - struct nvkm_namedb base; - int chid; +struct nv50_disp_chan_func { + void *(*dtor)(struct nv50_disp_chan *); + int (*init)(struct nv50_disp_chan *); + void (*fini)(struct nv50_disp_chan *); + int (*child_get)(struct nv50_disp_chan *, int index, + struct nvkm_oclass *); + int (*child_new)(struct nv50_disp_chan *, const struct nvkm_oclass *, + void *data, u32 size, struct nvkm_object **); }; -int nv50_disp_chan_create_(struct nvkm_object *, struct nvkm_object *, - struct nvkm_oclass *, int, int, void **); -void nv50_disp_chan_destroy(struct nv50_disp_chan *); -int nv50_disp_chan_ntfy(struct nvkm_object *, u32, struct nvkm_event **); -int nv50_disp_chan_map(struct nvkm_object *, u64 *, u32 *); -u32 nv50_disp_chan_rd32(struct nvkm_object *, u64); -void nv50_disp_chan_wr32(struct nvkm_object *, u64, u32); +int nv50_disp_chan_ctor(const struct nv50_disp_chan_func *, + const struct nv50_disp_chan_mthd *, + struct nv50_disp_root *, int chid, int head, + const struct nvkm_oclass *, struct nv50_disp_chan *); +int nv50_disp_chan_new_(const struct nv50_disp_chan_func *, + const struct nv50_disp_chan_mthd *, + struct nv50_disp_root *, int chid, int head, + const struct nvkm_oclass *, struct nvkm_object **); + +extern const struct nv50_disp_chan_func nv50_disp_pioc_func; +extern const struct nv50_disp_chan_func gf119_disp_pioc_func; + extern const struct nvkm_event_func nv50_disp_chan_uevent; int nv50_disp_chan_uevent_ctor(struct nvkm_object *, void *, u32, struct nvkm_notify *); @@ -30,24 +42,6 @@ void nv50_disp_chan_uevent_send(struct nv50_disp *, int); extern const struct nvkm_event_func gf119_disp_chan_uevent; -#define nv50_disp_chan_init(a) \ - nvkm_namedb_init(&(a)->base) -#define nv50_disp_chan_fini(a,b) \ - nvkm_namedb_fini(&(a)->base, (b)) - -struct nv50_disp_pioc { - struct nv50_disp_chan base; -}; - -int nv50_disp_pioc_create_(struct nvkm_object *, struct nvkm_object *, - struct nvkm_oclass *, int, int, void **); -void nv50_disp_pioc_dtor(struct nvkm_object *); -int nv50_disp_pioc_init(struct nvkm_object *); -int nv50_disp_pioc_fini(struct nvkm_object *, bool); - -int gf119_disp_pioc_init(struct nvkm_object *); -int gf119_disp_pioc_fini(struct nvkm_object *, bool); - struct nv50_disp_mthd_list { u32 mthd; u32 addr; @@ -58,9 +52,10 @@ struct nv50_disp_mthd_list { } data[]; }; -struct nv50_disp_mthd_chan { +struct nv50_disp_chan_mthd { const char *name; u32 addr; + s32 prev; struct { const char *name; int nr; @@ -68,36 +63,65 @@ struct nv50_disp_mthd_chan { } data[]; }; -void nv50_disp_mthd_chan(struct nv50_disp *, int debug, int head, - const struct nv50_disp_mthd_chan *); +void nv50_disp_chan_mthd(struct nv50_disp_chan *, int debug); -extern const struct nv50_disp_mthd_chan nv50_disp_core_mthd_chan; extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_base; extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_sor; extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_pior; -extern const struct nv50_disp_mthd_chan nv50_disp_base_mthd_chan; extern const struct nv50_disp_mthd_list nv50_disp_base_mthd_image; -extern const struct nv50_disp_mthd_chan nv50_disp_ovly_mthd_chan; -extern const struct nv50_disp_mthd_list nv50_disp_ovly_mthd_base; -extern const struct nv50_disp_mthd_chan g84_disp_core_mthd_chan; +extern const struct nv50_disp_chan_mthd g84_disp_core_chan_mthd; extern const struct nv50_disp_mthd_list g84_disp_core_mthd_dac; extern const struct nv50_disp_mthd_list g84_disp_core_mthd_head; -extern const struct nv50_disp_mthd_chan g84_disp_base_mthd_chan; -extern const struct nv50_disp_mthd_chan g84_disp_ovly_mthd_chan; - -extern const struct nv50_disp_mthd_chan g94_disp_core_mthd_chan; +extern const struct nv50_disp_chan_mthd g84_disp_base_chan_mthd; +extern const struct nv50_disp_chan_mthd g84_disp_ovly_chan_mthd; -extern const struct nv50_disp_mthd_chan gt200_disp_ovly_mthd_chan; +extern const struct nv50_disp_chan_mthd g94_disp_core_chan_mthd; -extern const struct nv50_disp_mthd_chan gf119_disp_core_mthd_chan; extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_base; extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_dac; extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_sor; extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_pior; -extern const struct nv50_disp_mthd_chan gf119_disp_base_mthd_chan; -extern const struct nv50_disp_mthd_chan gf119_disp_ovly_mthd_chan; +extern const struct nv50_disp_chan_mthd gf119_disp_base_chan_mthd; + +extern const struct nv50_disp_chan_mthd gk104_disp_core_chan_mthd; + +struct nv50_disp_pioc_oclass { + int (*ctor)(const struct nv50_disp_chan_func *, + const struct nv50_disp_chan_mthd *, + struct nv50_disp_root *, int chid, + const struct nvkm_oclass *, void *data, u32 size, + struct nvkm_object **); + struct nvkm_sclass base; + const struct nv50_disp_chan_func *func; + const struct nv50_disp_chan_mthd *mthd; + int chid; +}; + +extern const struct nv50_disp_pioc_oclass nv50_disp_oimm_oclass; +extern const struct nv50_disp_pioc_oclass nv50_disp_curs_oclass; + +extern const struct nv50_disp_pioc_oclass g84_disp_oimm_oclass; +extern const struct nv50_disp_pioc_oclass g84_disp_curs_oclass; + +extern const struct nv50_disp_pioc_oclass gt215_disp_oimm_oclass; +extern const struct nv50_disp_pioc_oclass gt215_disp_curs_oclass; + +extern const struct nv50_disp_pioc_oclass gf119_disp_oimm_oclass; +extern const struct nv50_disp_pioc_oclass gf119_disp_curs_oclass; + +extern const struct nv50_disp_pioc_oclass gk104_disp_oimm_oclass; +extern const struct nv50_disp_pioc_oclass gk104_disp_curs_oclass; + -extern const struct nv50_disp_mthd_chan gk104_disp_core_mthd_chan; -extern const struct nv50_disp_mthd_chan gk104_disp_ovly_mthd_chan; +int nv50_disp_curs_new(const struct nv50_disp_chan_func *, + const struct nv50_disp_chan_mthd *, + struct nv50_disp_root *, int chid, + const struct nvkm_oclass *, void *data, u32 size, + struct nvkm_object **); +int nv50_disp_oimm_new(const struct nv50_disp_chan_func *, + const struct nv50_disp_chan_mthd *, + struct nv50_disp_root *, int chid, + const struct nvkm_oclass *, void *data, u32 size, + struct nvkm_object **); #endif -- cgit v1.2.3