diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-08-20 14:54:22 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-08-28 12:37:44 +1000 |
commit | 9b1680d9684a8ae9335e90270fd6d63cb0d179ea (patch) | |
tree | 3cd8858b5797dfb13bfabd61d0dbaf7f2fc649c0 /drm/nouveau/include | |
parent | ed4bb4e997bd83443c9bf6766c2de60d3a2f8897 (diff) | |
download | nouveau-9b1680d9684a8ae9335e90270fd6d63cb0d179ea.tar.gz |
object: merge with handle
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drm/nouveau/include')
-rw-r--r-- | drm/nouveau/include/nvkm/core/client.h | 23 | ||||
-rw-r--r-- | drm/nouveau/include/nvkm/core/handle.h | 34 | ||||
-rw-r--r-- | drm/nouveau/include/nvkm/core/object.h | 23 |
3 files changed, 21 insertions, 59 deletions
diff --git a/drm/nouveau/include/nvkm/core/client.h b/drm/nouveau/include/nvkm/core/client.h index 5485bbac5..eaf5905a8 100644 --- a/drm/nouveau/include/nvkm/core/client.h +++ b/drm/nouveau/include/nvkm/core/client.h @@ -12,8 +12,6 @@ struct nvkm_client { struct rb_root objroot; struct rb_root dmaroot; - struct nvkm_handle *root; - bool super; void *data; int (*ntfy)(const void *, u32, const void *, u32); @@ -21,9 +19,9 @@ struct nvkm_client { struct nvkm_vm *vm; }; -bool nvkm_client_insert(struct nvkm_client *, struct nvkm_handle *); -void nvkm_client_remove(struct nvkm_client *, struct nvkm_handle *); -struct nvkm_handle *nvkm_client_search(struct nvkm_client *, u64 handle); +bool nvkm_client_insert(struct nvkm_client *, struct nvkm_object *); +void nvkm_client_remove(struct nvkm_client *, struct nvkm_object *); +struct nvkm_object *nvkm_client_search(struct nvkm_client *, u64 object); int nvkm_client_new(const char *name, u64 device, const char *cfg, const char *dbg, struct nvkm_client **); @@ -31,14 +29,6 @@ void nvkm_client_del(struct nvkm_client **); int nvkm_client_init(struct nvkm_client *); int nvkm_client_fini(struct nvkm_client *, bool suspend); -static inline struct nvkm_client * -nvkm_client(struct nvkm_object *object) -{ - while (object && object->parent) - object = object->parent; - return container_of(object, struct nvkm_client, object); -} - int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *, void *data, u32 size); int nvkm_client_notify_del(struct nvkm_client *, int index); @@ -48,12 +38,15 @@ int nvkm_client_notify_put(struct nvkm_client *, int index); /* logging for client-facing objects */ #define nvif_printk(o,l,p,f,a...) do { \ struct nvkm_object *_object = (o); \ - struct nvkm_client *_client = nvkm_client(_object); \ + struct nvkm_client *_client = _object->client; \ if (_client->debug >= NV_DBG_##l) \ - printk(KERN_##p "nouveau: %s: "f, _client->name, ##a); \ + printk(KERN_##p "nouveau: %s:%08x:%08x: "f, _client->name, \ + _object->handle, _object->oclass, ##a); \ } while(0) +#define nvif_fatal(o,f,a...) nvif_printk((o), FATAL, CRIT, f, ##a) #define nvif_error(o,f,a...) nvif_printk((o), ERROR, ERR, f, ##a) #define nvif_debug(o,f,a...) nvif_printk((o), DEBUG, INFO, f, ##a) #define nvif_trace(o,f,a...) nvif_printk((o), TRACE, INFO, f, ##a) +#define nvif_info(o,f,a...) nvif_printk((o), INFO, INFO, f, ##a) #define nvif_ioctl(o,f,a...) nvif_trace((o), "ioctl: "f, ##a) #endif diff --git a/drm/nouveau/include/nvkm/core/handle.h b/drm/nouveau/include/nvkm/core/handle.h deleted file mode 100644 index 539278916..000000000 --- a/drm/nouveau/include/nvkm/core/handle.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __NVKM_HANDLE_H__ -#define __NVKM_HANDLE_H__ -#include <core/os.h> -struct nvkm_object; - -struct nvkm_handle { - struct list_head node; - - struct list_head head; - struct list_head tree; - u32 name; - u32 priv; - - u8 route; - u64 token; - - struct nvkm_handle *parent; - struct nvkm_object *object; - - struct rb_node rb; - u64 handle; -}; - -int nvkm_handle_create(struct nvkm_handle *, u32 handle, - struct nvkm_object *, struct nvkm_handle **); -void nvkm_handle_destroy(struct nvkm_handle *); -int nvkm_handle_init(struct nvkm_handle *); -int nvkm_handle_fini(struct nvkm_handle *, bool suspend); - -struct nvkm_handle *nvkm_handle_get_class(struct nvkm_object *, u16); -struct nvkm_handle *nvkm_handle_get_vinst(struct nvkm_object *, u64); -struct nvkm_handle *nvkm_handle_get_cinst(struct nvkm_object *, u32); -void nvkm_handle_put(struct nvkm_handle *); -#endif diff --git a/drm/nouveau/include/nvkm/core/object.h b/drm/nouveau/include/nvkm/core/object.h index b4b822f61..dcd048b91 100644 --- a/drm/nouveau/include/nvkm/core/object.h +++ b/drm/nouveau/include/nvkm/core/object.h @@ -10,12 +10,15 @@ struct nvkm_object { const struct nvkm_object_func *func; struct nvkm_client *client; struct nvkm_engine *engine; - u32 oclass; + s32 oclass; u32 handle; - struct nvkm_object *parent; - u32 pclass; - atomic_t refcount; - atomic_t usecount; + + struct list_head head; + struct list_head tree; + u8 route; + u64 token; + u64 object; + struct rb_node node; }; struct nvkm_object_func { @@ -43,6 +46,8 @@ int nvkm_object_new_(const struct nvkm_object_func *, struct nvkm_object **); int nvkm_object_new(const struct nvkm_oclass *, void *data, u32 size, struct nvkm_object **); +void nvkm_object_del(struct nvkm_object **); +void *nvkm_object_dtor(struct nvkm_object *); int nvkm_object_init(struct nvkm_object *); int nvkm_object_fini(struct nvkm_object *, bool suspend); int nvkm_object_mthd(struct nvkm_object *, u32 mthd, void *data, u32 size); @@ -72,14 +77,12 @@ struct nvkm_oclass { struct nvkm_sclass base; const void *priv; const void *engn; - s32 handle; + u32 handle; + u8 route; + u64 token; u64 object; struct nvkm_client *client; struct nvkm_object *parent; struct nvkm_engine *engine; }; - -void nvkm_object_ref(struct nvkm_object *, struct nvkm_object **); -int nvkm_object_inc(struct nvkm_object *); -int nvkm_object_dec(struct nvkm_object *, bool suspend); #endif |