wndwc57e.c (4b4193256c8d3bc3a5397b5cd9494c2ad386317d) wndwc57e.c (8ef23b6f6a79e6fa2a169081d2d76011fffa0482)
1/*
2 * Copyright 2018 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the

--- 66 unchanged lines hidden (view full) ---

75 NVVAL(NVC57E, SET_SIZE_IN, HEIGHT, asyw->state.src_h >> 16));
76
77 PUSH_MTHD(push, NVC57E, SET_SIZE_OUT,
78 NVVAL(NVC57E, SET_SIZE_OUT, WIDTH, asyw->state.crtc_w) |
79 NVVAL(NVC57E, SET_SIZE_OUT, HEIGHT, asyw->state.crtc_h));
80 return 0;
81}
82
1/*
2 * Copyright 2018 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the

--- 66 unchanged lines hidden (view full) ---

75 NVVAL(NVC57E, SET_SIZE_IN, HEIGHT, asyw->state.src_h >> 16));
76
77 PUSH_MTHD(push, NVC57E, SET_SIZE_OUT,
78 NVVAL(NVC57E, SET_SIZE_OUT, WIDTH, asyw->state.crtc_w) |
79 NVVAL(NVC57E, SET_SIZE_OUT, HEIGHT, asyw->state.crtc_h));
80 return 0;
81}
82
83static int
83int
84wndwc57e_csc_clr(struct nv50_wndw *wndw)
85{
86 struct nvif_push *push = wndw->wndw.push;
87 const u32 identity[12] = {
88 0x00010000, 0x00000000, 0x00000000, 0x00000000,
89 0x00000000, 0x00010000, 0x00000000, 0x00000000,
90 0x00000000, 0x00000000, 0x00010000, 0x00000000,
91 };
92 int ret;
93
94 if ((ret = PUSH_WAIT(push, 1 + ARRAY_SIZE(identity))))
95 return ret;
96
97 PUSH_MTHD(push, NVC57E, SET_FMT_COEFFICIENT_C00, identity, ARRAY_SIZE(identity));
98 return 0;
99}
100
84wndwc57e_csc_clr(struct nv50_wndw *wndw)
85{
86 struct nvif_push *push = wndw->wndw.push;
87 const u32 identity[12] = {
88 0x00010000, 0x00000000, 0x00000000, 0x00000000,
89 0x00000000, 0x00010000, 0x00000000, 0x00000000,
90 0x00000000, 0x00000000, 0x00010000, 0x00000000,
91 };
92 int ret;
93
94 if ((ret = PUSH_WAIT(push, 1 + ARRAY_SIZE(identity))))
95 return ret;
96
97 PUSH_MTHD(push, NVC57E, SET_FMT_COEFFICIENT_C00, identity, ARRAY_SIZE(identity));
98 return 0;
99}
100
101static int
101int
102wndwc57e_csc_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
103{
104 struct nvif_push *push = wndw->wndw.push;
105 int ret;
106
107 if ((ret = PUSH_WAIT(push, 13)))
108 return ret;
109
110 PUSH_MTHD(push, NVC57E, SET_FMT_COEFFICIENT_C00, asyw->csc.matrix, 12);
111 return 0;
112}
113
102wndwc57e_csc_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
103{
104 struct nvif_push *push = wndw->wndw.push;
105 int ret;
106
107 if ((ret = PUSH_WAIT(push, 13)))
108 return ret;
109
110 PUSH_MTHD(push, NVC57E, SET_FMT_COEFFICIENT_C00, asyw->csc.matrix, 12);
111 return 0;
112}
113
114static int
114int
115wndwc57e_ilut_clr(struct nv50_wndw *wndw)
116{
117 struct nvif_push *push = wndw->wndw.push;
118 int ret;
119
120 if ((ret = PUSH_WAIT(push, 2)))
121 return ret;
122
123 PUSH_MTHD(push, NVC57E, SET_CONTEXT_DMA_ILUT, 0x00000000);
124 return 0;
125}
126
115wndwc57e_ilut_clr(struct nv50_wndw *wndw)
116{
117 struct nvif_push *push = wndw->wndw.push;
118 int ret;
119
120 if ((ret = PUSH_WAIT(push, 2)))
121 return ret;
122
123 PUSH_MTHD(push, NVC57E, SET_CONTEXT_DMA_ILUT, 0x00000000);
124 return 0;
125}
126
127static int
127int
128wndwc57e_ilut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
129{
130 struct nvif_push *push = wndw->wndw.push;
131 int ret;
132
133 if ((ret = PUSH_WAIT(push, 4)))
134 return ret;
135

--- 38 unchanged lines hidden (view full) ---

174 /* INTERPOLATE modes require a "next" entry to interpolate with,
175 * so we replicate the last entry to deal with this for now.
176 */
177 writew(readw(mem - 8), mem + 0);
178 writew(readw(mem - 6), mem + 2);
179 writew(readw(mem - 4), mem + 4);
180}
181
128wndwc57e_ilut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
129{
130 struct nvif_push *push = wndw->wndw.push;
131 int ret;
132
133 if ((ret = PUSH_WAIT(push, 4)))
134 return ret;
135

--- 38 unchanged lines hidden (view full) ---

174 /* INTERPOLATE modes require a "next" entry to interpolate with,
175 * so we replicate the last entry to deal with this for now.
176 */
177 writew(readw(mem - 8), mem + 0);
178 writew(readw(mem - 6), mem + 2);
179 writew(readw(mem - 4), mem + 4);
180}
181
182static bool
182bool
183wndwc57e_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, int size)
184{
185 if (size = size ? size : 1024, size != 256 && size != 1024)
186 return false;
187
188 if (size == 256)
189 asyw->xlut.i.mode = NVC57E_SET_ILUT_CONTROL_MODE_DIRECT8;
190 else

--- 56 unchanged lines hidden ---
183wndwc57e_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, int size)
184{
185 if (size = size ? size : 1024, size != 256 && size != 1024)
186 return false;
187
188 if (size == 256)
189 asyw->xlut.i.mode = NVC57E_SET_ILUT_CONTROL_MODE_DIRECT8;
190 else

--- 56 unchanged lines hidden ---