linux/drivers/gpu/drm/nouveau/core/include/core/parent.h
<<
>>
Prefs
   1#ifndef __NOUVEAU_PARENT_H__
   2#define __NOUVEAU_PARENT_H__
   3
   4#include <core/device.h>
   5#include <core/object.h>
   6
   7struct nouveau_sclass {
   8        struct nouveau_sclass *sclass;
   9        struct nouveau_engine *engine;
  10        struct nouveau_oclass *oclass;
  11};
  12
  13struct nouveau_parent {
  14        struct nouveau_object base;
  15
  16        struct nouveau_sclass *sclass;
  17        u64 engine;
  18
  19        int  (*context_attach)(struct nouveau_object *,
  20                               struct nouveau_object *);
  21        int  (*context_detach)(struct nouveau_object *, bool suspend,
  22                               struct nouveau_object *);
  23
  24        int  (*object_attach)(struct nouveau_object *parent,
  25                              struct nouveau_object *object, u32 name);
  26        void (*object_detach)(struct nouveau_object *parent, int cookie);
  27};
  28
  29static inline struct nouveau_parent *
  30nv_parent(void *obj)
  31{
  32#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
  33        if (unlikely(!(nv_iclass(obj, NV_PARENT_CLASS))))
  34                nv_assert("BAD CAST -> NvParent, %08x", nv_hclass(obj));
  35#endif
  36        return obj;
  37}
  38
  39#define nouveau_parent_create(p,e,c,v,s,m,d)                                   \
  40        nouveau_parent_create_((p), (e), (c), (v), (s), (m),                   \
  41                               sizeof(**d), (void **)d)
  42#define nouveau_parent_init(p)                                                 \
  43        nouveau_object_init(&(p)->base)
  44#define nouveau_parent_fini(p,s)                                               \
  45        nouveau_object_fini(&(p)->base, (s))
  46
  47int  nouveau_parent_create_(struct nouveau_object *, struct nouveau_object *,
  48                            struct nouveau_oclass *, u32 pclass,
  49                            struct nouveau_oclass *, u64 engcls,
  50                            int size, void **);
  51void nouveau_parent_destroy(struct nouveau_parent *);
  52
  53void _nouveau_parent_dtor(struct nouveau_object *);
  54#define _nouveau_parent_init nouveau_object_init
  55#define _nouveau_parent_fini nouveau_object_fini
  56
  57int nouveau_parent_sclass(struct nouveau_object *, u16 handle,
  58                          struct nouveau_object **pengine,
  59                          struct nouveau_oclass **poclass);
  60
  61#endif
  62