1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include "head.h"
23#include "core.h"
24
25static void
26head917d_dither(struct nv50_head *head, struct nv50_head_atom *asyh)
27{
28 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
29 u32 *push;
30 if ((push = evo_wait(core, 2))) {
31 evo_mthd(push, 0x04a0 + (head->base.index * 0x0300), 1);
32 evo_data(push, asyh->dither.mode << 3 |
33 asyh->dither.bits << 1 |
34 asyh->dither.enable);
35 evo_kick(push, core);
36 }
37}
38
39static void
40head917d_base(struct nv50_head *head, struct nv50_head_atom *asyh)
41{
42 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
43 u32 bounds = 0;
44 u32 *push;
45
46 if (asyh->base.cpp) {
47 switch (asyh->base.cpp) {
48 case 8: bounds |= 0x00000500; break;
49 case 4: bounds |= 0x00000300; break;
50 case 2: bounds |= 0x00000100; break;
51 case 1: bounds |= 0x00000000; break;
52 default:
53 WARN_ON(1);
54 break;
55 }
56 bounds |= 0x00020001;
57 }
58
59 if ((push = evo_wait(core, 2))) {
60 evo_mthd(push, 0x04d0 + head->base.index * 0x300, 1);
61 evo_data(push, bounds);
62 evo_kick(push, core);
63 }
64}
65
66int
67head917d_curs_layout(struct nv50_head *head, struct nv50_wndw_atom *asyw,
68 struct nv50_head_atom *asyh)
69{
70 switch (asyw->state.fb->width) {
71 case 32: asyh->curs.layout = 0; break;
72 case 64: asyh->curs.layout = 1; break;
73 case 128: asyh->curs.layout = 2; break;
74 case 256: asyh->curs.layout = 3; break;
75 default:
76 return -EINVAL;
77 }
78 return 0;
79}
80
81const struct nv50_head_func
82head917d = {
83 .view = head907d_view,
84 .mode = head907d_mode,
85 .olut = head907d_olut,
86 .olut_set = head907d_olut_set,
87 .olut_clr = head907d_olut_clr,
88 .core_calc = head507d_core_calc,
89 .core_set = head907d_core_set,
90 .core_clr = head907d_core_clr,
91 .curs_layout = head917d_curs_layout,
92 .curs_format = head507d_curs_format,
93 .curs_set = head907d_curs_set,
94 .curs_clr = head907d_curs_clr,
95 .base = head917d_base,
96 .ovly = head907d_ovly,
97 .dither = head917d_dither,
98 .procamp = head907d_procamp,
99 .or = head907d_or,
100};
101