| .. | .. |
|---|
| 22 | 22 | #include "head.h" |
|---|
| 23 | 23 | #include "core.h" |
|---|
| 24 | 24 | |
|---|
| 25 | | -static void |
|---|
| 25 | +#include <nvif/push507c.h> |
|---|
| 26 | + |
|---|
| 27 | +#include <nvhw/class/cl827d.h> |
|---|
| 28 | + |
|---|
| 29 | +static int |
|---|
| 26 | 30 | head827d_curs_clr(struct nv50_head *head) |
|---|
| 27 | 31 | { |
|---|
| 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 | | - } |
|---|
| 32 | + struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push; |
|---|
| 33 | + const int i = head->base.index; |
|---|
| 34 | + int ret; |
|---|
| 35 | + |
|---|
| 36 | + if ((ret = PUSH_WAIT(push, 4))) |
|---|
| 37 | + return ret; |
|---|
| 38 | + |
|---|
| 39 | + PUSH_MTHD(push, NV827D, HEAD_SET_CONTROL_CURSOR(i), |
|---|
| 40 | + NVDEF(NV827D, HEAD_SET_CONTROL_CURSOR, ENABLE, DISABLE) | |
|---|
| 41 | + NVDEF(NV827D, HEAD_SET_CONTROL_CURSOR, FORMAT, A8R8G8B8) | |
|---|
| 42 | + NVDEF(NV827D, HEAD_SET_CONTROL_CURSOR, SIZE, W64_H64)); |
|---|
| 43 | + |
|---|
| 44 | + PUSH_MTHD(push, NV827D, HEAD_SET_CONTEXT_DMA_CURSOR(i), 0x00000000); |
|---|
| 45 | + return 0; |
|---|
| 37 | 46 | } |
|---|
| 38 | 47 | |
|---|
| 39 | | -static void |
|---|
| 48 | +static int |
|---|
| 40 | 49 | head827d_curs_set(struct nv50_head *head, struct nv50_head_atom *asyh) |
|---|
| 41 | 50 | { |
|---|
| 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 | | - } |
|---|
| 51 | + struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push; |
|---|
| 52 | + const int i = head->base.index; |
|---|
| 53 | + int ret; |
|---|
| 54 | + |
|---|
| 55 | + if ((ret = PUSH_WAIT(push, 5))) |
|---|
| 56 | + return ret; |
|---|
| 57 | + |
|---|
| 58 | + PUSH_MTHD(push, NV827D, HEAD_SET_CONTROL_CURSOR(i), |
|---|
| 59 | + NVDEF(NV827D, HEAD_SET_CONTROL_CURSOR, ENABLE, ENABLE) | |
|---|
| 60 | + NVVAL(NV827D, HEAD_SET_CONTROL_CURSOR, FORMAT, asyh->curs.format) | |
|---|
| 61 | + NVVAL(NV827D, HEAD_SET_CONTROL_CURSOR, SIZE, asyh->curs.layout) | |
|---|
| 62 | + NVVAL(NV827D, HEAD_SET_CONTROL_CURSOR, HOT_SPOT_X, 0) | |
|---|
| 63 | + NVVAL(NV827D, HEAD_SET_CONTROL_CURSOR, HOT_SPOT_Y, 0) | |
|---|
| 64 | + NVDEF(NV827D, HEAD_SET_CONTROL_CURSOR, COMPOSITION, ALPHA_BLEND) | |
|---|
| 65 | + NVDEF(NV827D, HEAD_SET_CONTROL_CURSOR, SUB_OWNER, NONE), |
|---|
| 66 | + |
|---|
| 67 | + HEAD_SET_OFFSET_CURSOR(i), asyh->curs.offset >> 8); |
|---|
| 68 | + |
|---|
| 69 | + PUSH_MTHD(push, NV827D, HEAD_SET_CONTEXT_DMA_CURSOR(i), asyh->curs.handle); |
|---|
| 70 | + return 0; |
|---|
| 53 | 71 | } |
|---|
| 54 | 72 | |
|---|
| 55 | | -static void |
|---|
| 73 | +static int |
|---|
| 56 | 74 | head827d_core_set(struct nv50_head *head, struct nv50_head_atom *asyh) |
|---|
| 57 | 75 | { |
|---|
| 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 | | - } |
|---|
| 76 | + struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push; |
|---|
| 77 | + const int i = head->base.index; |
|---|
| 78 | + int ret; |
|---|
| 79 | + |
|---|
| 80 | + if ((ret = PUSH_WAIT(push, 9))) |
|---|
| 81 | + return ret; |
|---|
| 82 | + |
|---|
| 83 | + PUSH_MTHD(push, NV827D, HEAD_SET_OFFSET(i, 0), |
|---|
| 84 | + NVVAL(NV827D, HEAD_SET_OFFSET, ORIGIN, asyh->core.offset >> 8)); |
|---|
| 85 | + |
|---|
| 86 | + PUSH_MTHD(push, NV827D, HEAD_SET_SIZE(i), |
|---|
| 87 | + NVVAL(NV827D, HEAD_SET_SIZE, WIDTH, asyh->core.w) | |
|---|
| 88 | + NVVAL(NV827D, HEAD_SET_SIZE, HEIGHT, asyh->core.h), |
|---|
| 89 | + |
|---|
| 90 | + HEAD_SET_STORAGE(i), |
|---|
| 91 | + NVVAL(NV827D, HEAD_SET_STORAGE, BLOCK_HEIGHT, asyh->core.blockh) | |
|---|
| 92 | + NVVAL(NV827D, HEAD_SET_STORAGE, PITCH, asyh->core.pitch >> 8) | |
|---|
| 93 | + NVVAL(NV827D, HEAD_SET_STORAGE, PITCH, asyh->core.blocks) | |
|---|
| 94 | + NVVAL(NV827D, HEAD_SET_STORAGE, MEMORY_LAYOUT, asyh->core.layout), |
|---|
| 95 | + |
|---|
| 96 | + HEAD_SET_PARAMS(i), |
|---|
| 97 | + NVVAL(NV827D, HEAD_SET_PARAMS, FORMAT, asyh->core.format) | |
|---|
| 98 | + NVDEF(NV827D, HEAD_SET_PARAMS, SUPER_SAMPLE, X1_AA) | |
|---|
| 99 | + NVDEF(NV827D, HEAD_SET_PARAMS, GAMMA, LINEAR), |
|---|
| 100 | + |
|---|
| 101 | + HEAD_SET_CONTEXT_DMAS_ISO(i, 0), |
|---|
| 102 | + NVVAL(NV827D, HEAD_SET_CONTEXT_DMAS_ISO, HANDLE, asyh->core.handle)); |
|---|
| 103 | + |
|---|
| 104 | + PUSH_MTHD(push, NV827D, HEAD_SET_VIEWPORT_POINT_IN(i, 0), |
|---|
| 105 | + NVVAL(NV827D, HEAD_SET_VIEWPORT_POINT_IN, X, asyh->core.x) | |
|---|
| 106 | + NVVAL(NV827D, HEAD_SET_VIEWPORT_POINT_IN, Y, asyh->core.y)); |
|---|
| 107 | + return 0; |
|---|
| 75 | 108 | } |
|---|
| 76 | 109 | |
|---|
| 77 | | -static void |
|---|
| 110 | +static int |
|---|
| 78 | 111 | head827d_olut_clr(struct nv50_head *head) |
|---|
| 79 | 112 | { |
|---|
| 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 | | - } |
|---|
| 113 | + struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push; |
|---|
| 114 | + const int i = head->base.index; |
|---|
| 115 | + int ret; |
|---|
| 116 | + |
|---|
| 117 | + if ((ret = PUSH_WAIT(push, 4))) |
|---|
| 118 | + return ret; |
|---|
| 119 | + |
|---|
| 120 | + PUSH_MTHD(push, NV827D, HEAD_SET_BASE_LUT_LO(i), |
|---|
| 121 | + NVDEF(NV827D, HEAD_SET_BASE_LUT_LO, ENABLE, DISABLE)); |
|---|
| 122 | + |
|---|
| 123 | + PUSH_MTHD(push, NV827D, HEAD_SET_CONTEXT_DMA_LUT(i), 0x00000000); |
|---|
| 124 | + return 0; |
|---|
| 89 | 125 | } |
|---|
| 90 | 126 | |
|---|
| 91 | | -static void |
|---|
| 127 | +static int |
|---|
| 92 | 128 | head827d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh) |
|---|
| 93 | 129 | { |
|---|
| 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 | | - } |
|---|
| 130 | + struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push; |
|---|
| 131 | + const int i = head->base.index; |
|---|
| 132 | + int ret; |
|---|
| 133 | + |
|---|
| 134 | + if ((ret = PUSH_WAIT(push, 5))) |
|---|
| 135 | + return ret; |
|---|
| 136 | + |
|---|
| 137 | + PUSH_MTHD(push, NV827D, HEAD_SET_BASE_LUT_LO(i), |
|---|
| 138 | + NVDEF(NV827D, HEAD_SET_BASE_LUT_LO, ENABLE, ENABLE) | |
|---|
| 139 | + NVVAL(NV827D, HEAD_SET_BASE_LUT_LO, MODE, asyh->olut.mode) | |
|---|
| 140 | + NVVAL(NV827D, HEAD_SET_BASE_LUT_LO, ORIGIN, 0), |
|---|
| 141 | + |
|---|
| 142 | + HEAD_SET_BASE_LUT_HI(i), |
|---|
| 143 | + NVVAL(NV827D, HEAD_SET_BASE_LUT_HI, ORIGIN, asyh->olut.offset >> 8)); |
|---|
| 144 | + |
|---|
| 145 | + PUSH_MTHD(push, NV827D, HEAD_SET_CONTEXT_DMA_LUT(i), asyh->olut.handle); |
|---|
| 146 | + return 0; |
|---|
| 104 | 147 | } |
|---|
| 105 | 148 | |
|---|
| 106 | 149 | const struct nv50_head_func |
|---|
| .. | .. |
|---|
| 108 | 151 | .view = head507d_view, |
|---|
| 109 | 152 | .mode = head507d_mode, |
|---|
| 110 | 153 | .olut = head507d_olut, |
|---|
| 154 | + .olut_size = 256, |
|---|
| 111 | 155 | .olut_set = head827d_olut_set, |
|---|
| 112 | 156 | .olut_clr = head827d_olut_clr, |
|---|
| 113 | 157 | .core_calc = head507d_core_calc, |
|---|