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 "head.h" 23 #include "core.h" 24 25 static void 26 head827d_curs_clr(struct nv50_head *head) 27 { 28 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; 29 u32 *push; 30 if ((push = evo_wait(core, 4))) { 31 evo_mthd(push, 0x0880 + head->base.index * 0x400, 1); 32 evo_data(push, 0x05000000); 33 evo_mthd(push, 0x089c + head->base.index * 0x400, 1); 34 evo_data(push, 0x00000000); 35 evo_kick(push, core); 36 } 37 } 38 39 static void 40 head827d_curs_set(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 *push; 44 if ((push = evo_wait(core, 5))) { 45 evo_mthd(push, 0x0880 + head->base.index * 0x400, 2); 46 evo_data(push, 0x80000000 | asyh->curs.layout << 26 | 47 asyh->curs.format << 24); 48 evo_data(push, asyh->curs.offset >> 8); 49 evo_mthd(push, 0x089c + head->base.index * 0x400, 1); 50 evo_data(push, asyh->curs.handle); 51 evo_kick(push, core); 52 } 53 } 54 55 static void 56 head827d_core_set(struct nv50_head *head, struct nv50_head_atom *asyh) 57 { 58 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; 59 u32 *push; 60 if ((push = evo_wait(core, 9))) { 61 evo_mthd(push, 0x0860 + head->base.index * 0x400, 1); 62 evo_data(push, asyh->core.offset >> 8); 63 evo_mthd(push, 0x0868 + head->base.index * 0x400, 4); 64 evo_data(push, asyh->core.h << 16 | asyh->core.w); 65 evo_data(push, asyh->core.layout << 20 | 66 (asyh->core.pitch >> 8) << 8 | 67 asyh->core.blocks << 8 | 68 asyh->core.blockh); 69 evo_data(push, asyh->core.format << 8); 70 evo_data(push, asyh->core.handle); 71 evo_mthd(push, 0x08c0 + head->base.index * 0x400, 1); 72 evo_data(push, asyh->core.y << 16 | asyh->core.x); 73 evo_kick(push, core); 74 } 75 } 76 77 static void 78 head827d_olut_clr(struct nv50_head *head) 79 { 80 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; 81 u32 *push; 82 if ((push = evo_wait(core, 4))) { 83 evo_mthd(push, 0x0840 + (head->base.index * 0x400), 1); 84 evo_data(push, 0x00000000); 85 evo_mthd(push, 0x085c + (head->base.index * 0x400), 1); 86 evo_data(push, 0x00000000); 87 evo_kick(push, core); 88 } 89 } 90 91 static void 92 head827d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh) 93 { 94 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; 95 u32 *push; 96 if ((push = evo_wait(core, 5))) { 97 evo_mthd(push, 0x0840 + (head->base.index * 0x400), 2); 98 evo_data(push, 0x80000000 | asyh->olut.mode << 30); 99 evo_data(push, asyh->olut.offset >> 8); 100 evo_mthd(push, 0x085c + (head->base.index * 0x400), 1); 101 evo_data(push, asyh->olut.handle); 102 evo_kick(push, core); 103 } 104 } 105 106 const struct nv50_head_func 107 head827d = { 108 .view = head507d_view, 109 .mode = head507d_mode, 110 .olut = head507d_olut, 111 .olut_size = 256, 112 .olut_set = head827d_olut_set, 113 .olut_clr = head827d_olut_clr, 114 .core_calc = head507d_core_calc, 115 .core_set = head827d_core_set, 116 .core_clr = head507d_core_clr, 117 .curs_layout = head507d_curs_layout, 118 .curs_format = head507d_curs_format, 119 .curs_set = head827d_curs_set, 120 .curs_clr = head827d_curs_clr, 121 .base = head507d_base, 122 .ovly = head507d_ovly, 123 .dither = head507d_dither, 124 .procamp = head507d_procamp, 125 }; 126