xref: /linux/drivers/gpu/drm/nouveau/dispnv50/base907c.c (revision 53e0a3e70de69dc9f498d26c6b5495b2771ee374)
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
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  */
22 #include "base.h"
23 
24 static void
25 base907c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
26 {
27 	u32 *push;
28 	if ((push = evo_wait(&wndw->wndw, 10))) {
29 		evo_mthd(push, 0x0084, 1);
30 		evo_data(push, asyw->image.mode << 8 |
31 			       asyw->image.interval << 4);
32 		evo_mthd(push, 0x00c0, 1);
33 		evo_data(push, asyw->image.handle[0]);
34 		evo_mthd(push, 0x0400, 5);
35 		evo_data(push, asyw->image.offset[0] >> 8);
36 		evo_data(push, 0x00000000);
37 		evo_data(push, asyw->image.h << 16 | asyw->image.w);
38 		evo_data(push, asyw->image.layout << 24 |
39 			       asyw->image.pitch[0] |
40 			       asyw->image.block);
41 		evo_data(push, asyw->image.format << 8);
42 		evo_kick(push, &wndw->wndw);
43 	}
44 }
45 
46 static const struct nv50_wndw_func
47 base907c = {
48 	.acquire = base507c_acquire,
49 	.release = base507c_release,
50 	.sema_set = base507c_sema_set,
51 	.sema_clr = base507c_sema_clr,
52 	.ntfy_reset = base507c_ntfy_reset,
53 	.ntfy_set = base507c_ntfy_set,
54 	.ntfy_clr = base507c_ntfy_clr,
55 	.ntfy_wait_begun = base507c_ntfy_wait_begun,
56 	.image_set = base907c_image_set,
57 	.image_clr = base507c_image_clr,
58 	.lut = base507c_lut,
59 	.update = base507c_update,
60 };
61 
62 int
63 base907c_new(struct nouveau_drm *drm, int head, s32 oclass,
64 	     struct nv50_wndw **pwndw)
65 {
66 	return base507c_new_(&base907c, base507c_format, drm, head, oclass,
67 			     0x00000002 << (head * 4), pwndw);
68 }
69