aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/include/nvif/object.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/include/nvif/object.h')
-rw-r--r--drivers/gpu/drm/nouveau/include/nvif/object.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvif/object.h b/drivers/gpu/drm/nouveau/include/nvif/object.h
index 8d815967767f..9e58b305b020 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/object.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/object.h
@@ -66,6 +66,35 @@ void nvif_object_unmap(struct nvif_object *);
66 66
67#define nvif_mthd(a,b,c,d) nvif_object_mthd((a), (b), (c), (d)) 67#define nvif_mthd(a,b,c,d) nvif_object_mthd((a), (b), (c), (d))
68 68
69struct nvif_mclass {
70 s32 oclass;
71 int version;
72};
73
74#define nvif_mclass(o,m) ({ \
75 struct nvif_object *object = (o); \
76 struct nvif_sclass *sclass; \
77 const typeof(m[0]) *mclass = (m); \
78 int ret = -ENODEV; \
79 int cnt, i, j; \
80 \
81 cnt = nvif_object_sclass_get(object, &sclass); \
82 if (cnt >= 0) { \
83 for (i = 0; ret < 0 && mclass[i].oclass; i++) { \
84 for (j = 0; j < cnt; j++) { \
85 if (mclass[i].oclass == sclass[j].oclass && \
86 mclass[i].version >= sclass[j].minver && \
87 mclass[i].version <= sclass[j].maxver) { \
88 ret = i; \
89 break; \
90 } \
91 } \
92 } \
93 nvif_object_sclass_put(&sclass); \
94 } \
95 ret; \
96})
97
69/*XXX*/ 98/*XXX*/
70#include <core/object.h> 99#include <core/object.h>
71#define nvxx_object(a) ({ \ 100#define nvxx_object(a) ({ \