1ccd27db8SBen Skeggs /* 2ccd27db8SBen Skeggs * Copyright 2018 Red Hat Inc. 3ccd27db8SBen Skeggs * 4ccd27db8SBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a 5ccd27db8SBen Skeggs * copy of this software and associated documentation files (the "Software"), 6ccd27db8SBen Skeggs * to deal in the Software without restriction, including without limitation 7ccd27db8SBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8ccd27db8SBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the 9ccd27db8SBen Skeggs * Software is furnished to do so, subject to the following conditions: 10ccd27db8SBen Skeggs * 11ccd27db8SBen Skeggs * The above copyright notice and this permission notice shall be included in 12ccd27db8SBen Skeggs * all copies or substantial portions of the Software. 13ccd27db8SBen Skeggs * 14ccd27db8SBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15ccd27db8SBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16ccd27db8SBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17ccd27db8SBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18ccd27db8SBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19ccd27db8SBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20ccd27db8SBen Skeggs * OTHER DEALINGS IN THE SOFTWARE. 21ccd27db8SBen Skeggs */ 22ccd27db8SBen Skeggs #include "base.h" 23ccd27db8SBen Skeggs 24ccd27db8SBen Skeggs static void 25ccd27db8SBen Skeggs base907c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) 26ccd27db8SBen Skeggs { 27ccd27db8SBen Skeggs u32 *push; 28ccd27db8SBen Skeggs if ((push = evo_wait(&wndw->wndw, 10))) { 29ccd27db8SBen Skeggs evo_mthd(push, 0x0084, 1); 30ccd27db8SBen Skeggs evo_data(push, asyw->image.mode << 8 | 31ccd27db8SBen Skeggs asyw->image.interval << 4); 32ccd27db8SBen Skeggs evo_mthd(push, 0x00c0, 1); 33261fcfa9SBen Skeggs evo_data(push, asyw->image.handle[0]); 34ccd27db8SBen Skeggs evo_mthd(push, 0x0400, 5); 35261fcfa9SBen Skeggs evo_data(push, asyw->image.offset[0] >> 8); 36ccd27db8SBen Skeggs evo_data(push, 0x00000000); 37ccd27db8SBen Skeggs evo_data(push, asyw->image.h << 16 | asyw->image.w); 38ccd27db8SBen Skeggs evo_data(push, asyw->image.layout << 24 | 39261fcfa9SBen Skeggs asyw->image.pitch[0] | 40ccd27db8SBen Skeggs asyw->image.block); 41ccd27db8SBen Skeggs evo_data(push, asyw->image.format << 8); 42ccd27db8SBen Skeggs evo_kick(push, &wndw->wndw); 43ccd27db8SBen Skeggs } 44ccd27db8SBen Skeggs } 45ccd27db8SBen Skeggs 46*119608a7SBen Skeggs static void 47*119608a7SBen Skeggs base907c_xlut_clr(struct nv50_wndw *wndw) 48*119608a7SBen Skeggs { 49*119608a7SBen Skeggs u32 *push; 50*119608a7SBen Skeggs if ((push = evo_wait(&wndw->wndw, 6))) { 51*119608a7SBen Skeggs evo_mthd(push, 0x00e0, 1); 52*119608a7SBen Skeggs evo_data(push, 0x00000000); 53*119608a7SBen Skeggs evo_mthd(push, 0x00e8, 1); 54*119608a7SBen Skeggs evo_data(push, 0x00000000); 55*119608a7SBen Skeggs evo_mthd(push, 0x00fc, 1); 56*119608a7SBen Skeggs evo_data(push, 0x00000000); 57*119608a7SBen Skeggs evo_kick(push, &wndw->wndw); 58*119608a7SBen Skeggs } 59*119608a7SBen Skeggs } 60*119608a7SBen Skeggs 61*119608a7SBen Skeggs static void 62*119608a7SBen Skeggs base907c_xlut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) 63*119608a7SBen Skeggs { 64*119608a7SBen Skeggs u32 *push; 65*119608a7SBen Skeggs if ((push = evo_wait(&wndw->wndw, 6))) { 66*119608a7SBen Skeggs evo_mthd(push, 0x00e0, 3); 67*119608a7SBen Skeggs evo_data(push, asyw->xlut.i.enable << 30 | 68*119608a7SBen Skeggs asyw->xlut.i.mode << 24); 69*119608a7SBen Skeggs evo_data(push, asyw->xlut.i.offset >> 8); 70*119608a7SBen Skeggs evo_data(push, 0x40000000); 71*119608a7SBen Skeggs evo_mthd(push, 0x00fc, 1); 72*119608a7SBen Skeggs evo_data(push, asyw->xlut.handle); 73*119608a7SBen Skeggs evo_kick(push, &wndw->wndw); 74*119608a7SBen Skeggs } 75*119608a7SBen Skeggs } 76*119608a7SBen Skeggs 77*119608a7SBen Skeggs static void 78*119608a7SBen Skeggs base907c_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) 79*119608a7SBen Skeggs { 80*119608a7SBen Skeggs asyw->xlut.i.mode = 7; 81*119608a7SBen Skeggs asyw->xlut.i.enable = 2; 82*119608a7SBen Skeggs } 83*119608a7SBen Skeggs 84ccd27db8SBen Skeggs static const struct nv50_wndw_func 85ccd27db8SBen Skeggs base907c = { 86ccd27db8SBen Skeggs .acquire = base507c_acquire, 87ccd27db8SBen Skeggs .release = base507c_release, 88ccd27db8SBen Skeggs .sema_set = base507c_sema_set, 89ccd27db8SBen Skeggs .sema_clr = base507c_sema_clr, 90ccd27db8SBen Skeggs .ntfy_reset = base507c_ntfy_reset, 91ccd27db8SBen Skeggs .ntfy_set = base507c_ntfy_set, 92ccd27db8SBen Skeggs .ntfy_clr = base507c_ntfy_clr, 93ccd27db8SBen Skeggs .ntfy_wait_begun = base507c_ntfy_wait_begun, 94*119608a7SBen Skeggs .ilut = base907c_ilut, 95*119608a7SBen Skeggs .olut_core = true, 96*119608a7SBen Skeggs .xlut_set = base907c_xlut_set, 97*119608a7SBen Skeggs .xlut_clr = base907c_xlut_clr, 98ccd27db8SBen Skeggs .image_set = base907c_image_set, 99ccd27db8SBen Skeggs .image_clr = base507c_image_clr, 10053e0a3e7SBen Skeggs .update = base507c_update, 101ccd27db8SBen Skeggs }; 102ccd27db8SBen Skeggs 103ccd27db8SBen Skeggs int 104ccd27db8SBen Skeggs base907c_new(struct nouveau_drm *drm, int head, s32 oclass, 105ccd27db8SBen Skeggs struct nv50_wndw **pwndw) 106ccd27db8SBen Skeggs { 10753e0a3e7SBen Skeggs return base507c_new_(&base907c, base507c_format, drm, head, oclass, 10853e0a3e7SBen Skeggs 0x00000002 << (head * 4), pwndw); 109ccd27db8SBen Skeggs } 110