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 "rootnv50.h"
26
27#include <core/client.h>
28
29#include <nvif/class.h>
30#include <nvif/unpack.h>
31
32int
33nv50_disp_oimm_new(const struct nv50_disp_chan_func *func,
34 const struct nv50_disp_chan_mthd *mthd,
35 struct nv50_disp_root *root, int chid,
36 const struct nvkm_oclass *oclass, void *data, u32 size,
37 struct nvkm_object **pobject)
38{
39 union {
40 struct nv50_disp_overlay_v0 v0;
41 } *args = data;
42 struct nvkm_object *parent = oclass->parent;
43 struct nv50_disp *disp = root->disp;
44 int head, ret;
45
46 nvif_ioctl(parent, "create disp overlay size %d\n", size);
47 if (nvif_unpack(args->v0, 0, 0, false)) {
48 nvif_ioctl(parent, "create disp overlay vers %d head %d\n",
49 args->v0.version, args->v0.head);
50 if (args->v0.head > disp->base.head.nr)
51 return -EINVAL;
52 head = args->v0.head;
53 } else
54 return ret;
55
56 return nv50_disp_chan_new_(func, mthd, root, chid + head,
57 head, oclass, pobject);
58}
59
60const struct nv50_disp_pioc_oclass
61nv50_disp_oimm_oclass = {
62 .base.oclass = NV50_DISP_OVERLAY,
63 .base.minver = 0,
64 .base.maxver = 0,
65 .ctor = nv50_disp_oimm_new,
66 .func = &nv50_disp_pioc_func,
67 .chid = 5,
68};
69