1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include "channv50.h"
25#include "head.h"
26#include "rootnv50.h"
27
28#include <core/client.h>
29
30#include <nvif/class.h>
31#include <nvif/cl507a.h>
32#include <nvif/unpack.h>
33
34int
35nv50_disp_curs_new(const struct nv50_disp_chan_func *func,
36 const struct nv50_disp_chan_mthd *mthd,
37 struct nv50_disp_root *root, int ctrl, int user,
38 const struct nvkm_oclass *oclass, void *data, u32 size,
39 struct nvkm_object **pobject)
40{
41 union {
42 struct nv50_disp_cursor_v0 v0;
43 } *args = data;
44 struct nvkm_object *parent = oclass->parent;
45 struct nv50_disp *disp = root->disp;
46 int head, ret = -ENOSYS;
47
48 nvif_ioctl(parent, "create disp cursor size %d\n", size);
49 if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
50 nvif_ioctl(parent, "create disp cursor vers %d head %d\n",
51 args->v0.version, args->v0.head);
52 if (!nvkm_head_find(&disp->base, args->v0.head))
53 return -EINVAL;
54 head = args->v0.head;
55 } else
56 return ret;
57
58 return nv50_disp_chan_new_(func, mthd, root, ctrl + head, user + head,
59 head, oclass, pobject);
60}
61
62const struct nv50_disp_pioc_oclass
63nv50_disp_curs_oclass = {
64 .base.oclass = NV50_DISP_CURSOR,
65 .base.minver = 0,
66 .base.maxver = 0,
67 .ctor = nv50_disp_curs_new,
68 .func = &nv50_disp_pioc_func,
69 .chid = { 7, 7 },
70};
71