| .. | .. |
|---|
| 21 | 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|---|
| 22 | 22 | * DEALINGS IN THE SOFTWARE. |
|---|
| 23 | 23 | */ |
|---|
| 24 | | - |
|---|
| 24 | +#define NVIF_DEBUG_PRINT_DISABLE |
|---|
| 25 | 25 | #include "nouveau_drv.h" |
|---|
| 26 | 26 | #include "nouveau_dma.h" |
|---|
| 27 | 27 | #include "nouveau_fbcon.h" |
|---|
| 28 | + |
|---|
| 29 | +#include <nvif/push006c.h> |
|---|
| 28 | 30 | |
|---|
| 29 | 31 | int |
|---|
| 30 | 32 | nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region) |
|---|
| .. | .. |
|---|
| 32 | 34 | struct nouveau_fbdev *nfbdev = info->par; |
|---|
| 33 | 35 | struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev); |
|---|
| 34 | 36 | struct nouveau_channel *chan = drm->channel; |
|---|
| 37 | + struct nvif_push *push = chan->chan.push; |
|---|
| 35 | 38 | int ret; |
|---|
| 36 | 39 | |
|---|
| 37 | | - ret = RING_SPACE(chan, 4); |
|---|
| 40 | + ret = PUSH_WAIT(push, 4); |
|---|
| 38 | 41 | if (ret) |
|---|
| 39 | 42 | return ret; |
|---|
| 40 | 43 | |
|---|
| 41 | | - BEGIN_NV04(chan, NvSubImageBlit, 0x0300, 3); |
|---|
| 42 | | - OUT_RING(chan, (region->sy << 16) | region->sx); |
|---|
| 43 | | - OUT_RING(chan, (region->dy << 16) | region->dx); |
|---|
| 44 | | - OUT_RING(chan, (region->height << 16) | region->width); |
|---|
| 45 | | - FIRE_RING(chan); |
|---|
| 44 | + PUSH_NVSQ(push, NV05F, 0x0300, (region->sy << 16) | region->sx, |
|---|
| 45 | + 0x0304, (region->dy << 16) | region->dx, |
|---|
| 46 | + 0x0308, (region->height << 16) | region->width); |
|---|
| 47 | + PUSH_KICK(push); |
|---|
| 46 | 48 | return 0; |
|---|
| 47 | 49 | } |
|---|
| 48 | 50 | |
|---|
| .. | .. |
|---|
| 52 | 54 | struct nouveau_fbdev *nfbdev = info->par; |
|---|
| 53 | 55 | struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev); |
|---|
| 54 | 56 | struct nouveau_channel *chan = drm->channel; |
|---|
| 57 | + struct nvif_push *push = chan->chan.push; |
|---|
| 55 | 58 | int ret; |
|---|
| 56 | 59 | |
|---|
| 57 | | - ret = RING_SPACE(chan, 7); |
|---|
| 60 | + ret = PUSH_WAIT(push, 7); |
|---|
| 58 | 61 | if (ret) |
|---|
| 59 | 62 | return ret; |
|---|
| 60 | 63 | |
|---|
| 61 | | - BEGIN_NV04(chan, NvSubGdiRect, 0x02fc, 1); |
|---|
| 62 | | - OUT_RING(chan, (rect->rop != ROP_COPY) ? 1 : 3); |
|---|
| 63 | | - BEGIN_NV04(chan, NvSubGdiRect, 0x03fc, 1); |
|---|
| 64 | + PUSH_NVSQ(push, NV04A, 0x02fc, (rect->rop != ROP_COPY) ? 1 : 3); |
|---|
| 64 | 65 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || |
|---|
| 65 | 66 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) |
|---|
| 66 | | - OUT_RING(chan, ((uint32_t *)info->pseudo_palette)[rect->color]); |
|---|
| 67 | + PUSH_NVSQ(push, NV04A, 0x03fc, ((uint32_t *)info->pseudo_palette)[rect->color]); |
|---|
| 67 | 68 | else |
|---|
| 68 | | - OUT_RING(chan, rect->color); |
|---|
| 69 | | - BEGIN_NV04(chan, NvSubGdiRect, 0x0400, 2); |
|---|
| 70 | | - OUT_RING(chan, (rect->dx << 16) | rect->dy); |
|---|
| 71 | | - OUT_RING(chan, (rect->width << 16) | rect->height); |
|---|
| 72 | | - FIRE_RING(chan); |
|---|
| 69 | + PUSH_NVSQ(push, NV04A, 0x03fc, rect->color); |
|---|
| 70 | + PUSH_NVSQ(push, NV04A, 0x0400, (rect->dx << 16) | rect->dy, |
|---|
| 71 | + 0x0404, (rect->width << 16) | rect->height); |
|---|
| 72 | + PUSH_KICK(push); |
|---|
| 73 | 73 | return 0; |
|---|
| 74 | 74 | } |
|---|
| 75 | 75 | |
|---|
| .. | .. |
|---|
| 79 | 79 | struct nouveau_fbdev *nfbdev = info->par; |
|---|
| 80 | 80 | struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev); |
|---|
| 81 | 81 | struct nouveau_channel *chan = drm->channel; |
|---|
| 82 | + struct nvif_push *push = chan->chan.push; |
|---|
| 82 | 83 | uint32_t fg; |
|---|
| 83 | 84 | uint32_t bg; |
|---|
| 84 | 85 | uint32_t dsize; |
|---|
| .. | .. |
|---|
| 88 | 89 | if (image->depth != 1) |
|---|
| 89 | 90 | return -ENODEV; |
|---|
| 90 | 91 | |
|---|
| 91 | | - ret = RING_SPACE(chan, 8); |
|---|
| 92 | + ret = PUSH_WAIT(push, 8); |
|---|
| 92 | 93 | if (ret) |
|---|
| 93 | 94 | return ret; |
|---|
| 94 | 95 | |
|---|
| .. | .. |
|---|
| 101 | 102 | bg = image->bg_color; |
|---|
| 102 | 103 | } |
|---|
| 103 | 104 | |
|---|
| 104 | | - BEGIN_NV04(chan, NvSubGdiRect, 0x0be4, 7); |
|---|
| 105 | | - OUT_RING(chan, (image->dy << 16) | (image->dx & 0xffff)); |
|---|
| 106 | | - OUT_RING(chan, ((image->dy + image->height) << 16) | |
|---|
| 107 | | - ((image->dx + image->width) & 0xffff)); |
|---|
| 108 | | - OUT_RING(chan, bg); |
|---|
| 109 | | - OUT_RING(chan, fg); |
|---|
| 110 | | - OUT_RING(chan, (image->height << 16) | ALIGN(image->width, 8)); |
|---|
| 111 | | - OUT_RING(chan, (image->height << 16) | image->width); |
|---|
| 112 | | - OUT_RING(chan, (image->dy << 16) | (image->dx & 0xffff)); |
|---|
| 105 | + PUSH_NVSQ(push, NV04A, 0x0be4, (image->dy << 16) | (image->dx & 0xffff), |
|---|
| 106 | + 0x0be8, ((image->dy + image->height) << 16) | |
|---|
| 107 | + ((image->dx + image->width) & 0xffff), |
|---|
| 108 | + 0x0bec, bg, |
|---|
| 109 | + 0x0bf0, fg, |
|---|
| 110 | + 0x0bf4, (image->height << 16) | ALIGN(image->width, 8), |
|---|
| 111 | + 0x0bf8, (image->height << 16) | image->width, |
|---|
| 112 | + 0x0bfc, (image->dy << 16) | (image->dx & 0xffff)); |
|---|
| 113 | 113 | |
|---|
| 114 | 114 | dsize = ALIGN(ALIGN(image->width, 8) * image->height, 32) >> 5; |
|---|
| 115 | 115 | while (dsize) { |
|---|
| 116 | 116 | int iter_len = dsize > 128 ? 128 : dsize; |
|---|
| 117 | 117 | |
|---|
| 118 | | - ret = RING_SPACE(chan, iter_len + 1); |
|---|
| 118 | + ret = PUSH_WAIT(push, iter_len + 1); |
|---|
| 119 | 119 | if (ret) |
|---|
| 120 | 120 | return ret; |
|---|
| 121 | 121 | |
|---|
| 122 | | - BEGIN_NV04(chan, NvSubGdiRect, 0x0c00, iter_len); |
|---|
| 123 | | - OUT_RINGp(chan, data, iter_len); |
|---|
| 122 | + PUSH_NVSQ(push, NV04A, 0x0c00, data, iter_len); |
|---|
| 124 | 123 | data += iter_len; |
|---|
| 125 | 124 | dsize -= iter_len; |
|---|
| 126 | 125 | } |
|---|
| 127 | 126 | |
|---|
| 128 | | - FIRE_RING(chan); |
|---|
| 127 | + PUSH_KICK(push); |
|---|
| 129 | 128 | return 0; |
|---|
| 130 | 129 | } |
|---|
| 131 | 130 | |
|---|
| .. | .. |
|---|
| 137 | 136 | struct nouveau_drm *drm = nouveau_drm(dev); |
|---|
| 138 | 137 | struct nouveau_channel *chan = drm->channel; |
|---|
| 139 | 138 | struct nvif_device *device = &drm->client.device; |
|---|
| 139 | + struct nvif_push *push = chan->chan.push; |
|---|
| 140 | 140 | int surface_fmt, pattern_fmt, rect_fmt; |
|---|
| 141 | 141 | int ret; |
|---|
| 142 | 142 | |
|---|
| .. | .. |
|---|
| 168 | 168 | return -EINVAL; |
|---|
| 169 | 169 | } |
|---|
| 170 | 170 | |
|---|
| 171 | | - ret = nvif_object_init(&chan->user, 0x0062, |
|---|
| 171 | + ret = nvif_object_ctor(&chan->user, "fbconCtxSurf2d", 0x0062, |
|---|
| 172 | 172 | device->info.family >= NV_DEVICE_INFO_V0_CELSIUS ? |
|---|
| 173 | 173 | 0x0062 : 0x0042, NULL, 0, &nfbdev->surf2d); |
|---|
| 174 | 174 | if (ret) |
|---|
| 175 | 175 | return ret; |
|---|
| 176 | 176 | |
|---|
| 177 | | - ret = nvif_object_init(&chan->user, 0x0019, 0x0019, NULL, 0, |
|---|
| 178 | | - &nfbdev->clip); |
|---|
| 177 | + ret = nvif_object_ctor(&chan->user, "fbconCtxClip", 0x0019, 0x0019, |
|---|
| 178 | + NULL, 0, &nfbdev->clip); |
|---|
| 179 | 179 | if (ret) |
|---|
| 180 | 180 | return ret; |
|---|
| 181 | 181 | |
|---|
| 182 | | - ret = nvif_object_init(&chan->user, 0x0043, 0x0043, NULL, 0, |
|---|
| 183 | | - &nfbdev->rop); |
|---|
| 182 | + ret = nvif_object_ctor(&chan->user, "fbconCtxRop", 0x0043, 0x0043, |
|---|
| 183 | + NULL, 0, &nfbdev->rop); |
|---|
| 184 | 184 | if (ret) |
|---|
| 185 | 185 | return ret; |
|---|
| 186 | 186 | |
|---|
| 187 | | - ret = nvif_object_init(&chan->user, 0x0044, 0x0044, NULL, 0, |
|---|
| 188 | | - &nfbdev->patt); |
|---|
| 187 | + ret = nvif_object_ctor(&chan->user, "fbconCtxPatt", 0x0044, 0x0044, |
|---|
| 188 | + NULL, 0, &nfbdev->patt); |
|---|
| 189 | 189 | if (ret) |
|---|
| 190 | 190 | return ret; |
|---|
| 191 | 191 | |
|---|
| 192 | | - ret = nvif_object_init(&chan->user, 0x004a, 0x004a, NULL, 0, |
|---|
| 193 | | - &nfbdev->gdi); |
|---|
| 192 | + ret = nvif_object_ctor(&chan->user, "fbconGdiRectText", 0x004a, 0x004a, |
|---|
| 193 | + NULL, 0, &nfbdev->gdi); |
|---|
| 194 | 194 | if (ret) |
|---|
| 195 | 195 | return ret; |
|---|
| 196 | 196 | |
|---|
| 197 | | - ret = nvif_object_init(&chan->user, 0x005f, |
|---|
| 197 | + ret = nvif_object_ctor(&chan->user, "fbconImageBlit", 0x005f, |
|---|
| 198 | 198 | device->info.chipset >= 0x11 ? 0x009f : 0x005f, |
|---|
| 199 | 199 | NULL, 0, &nfbdev->blit); |
|---|
| 200 | 200 | if (ret) |
|---|
| 201 | 201 | return ret; |
|---|
| 202 | 202 | |
|---|
| 203 | | - if (RING_SPACE(chan, 49 + (device->info.chipset >= 0x11 ? 4 : 0))) { |
|---|
| 203 | + if (PUSH_WAIT(push, 49 + (device->info.chipset >= 0x11 ? 4 : 0))) { |
|---|
| 204 | 204 | nouveau_fbcon_gpu_lockup(info); |
|---|
| 205 | 205 | return 0; |
|---|
| 206 | 206 | } |
|---|
| 207 | 207 | |
|---|
| 208 | | - BEGIN_NV04(chan, NvSubCtxSurf2D, 0x0000, 1); |
|---|
| 209 | | - OUT_RING(chan, nfbdev->surf2d.handle); |
|---|
| 210 | | - BEGIN_NV04(chan, NvSubCtxSurf2D, 0x0184, 2); |
|---|
| 211 | | - OUT_RING(chan, chan->vram.handle); |
|---|
| 212 | | - OUT_RING(chan, chan->vram.handle); |
|---|
| 213 | | - BEGIN_NV04(chan, NvSubCtxSurf2D, 0x0300, 4); |
|---|
| 214 | | - OUT_RING(chan, surface_fmt); |
|---|
| 215 | | - OUT_RING(chan, info->fix.line_length | (info->fix.line_length << 16)); |
|---|
| 216 | | - OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base); |
|---|
| 217 | | - OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base); |
|---|
| 208 | + PUSH_NVSQ(push, NV042, 0x0000, nfbdev->surf2d.handle); |
|---|
| 209 | + PUSH_NVSQ(push, NV042, 0x0184, chan->vram.handle, |
|---|
| 210 | + 0x0188, chan->vram.handle); |
|---|
| 211 | + PUSH_NVSQ(push, NV042, 0x0300, surface_fmt, |
|---|
| 212 | + 0x0304, info->fix.line_length | (info->fix.line_length << 16), |
|---|
| 213 | + 0x0308, info->fix.smem_start - dev->mode_config.fb_base, |
|---|
| 214 | + 0x030c, info->fix.smem_start - dev->mode_config.fb_base); |
|---|
| 218 | 215 | |
|---|
| 219 | | - BEGIN_NV04(chan, NvSubCtxSurf2D, 0x0000, 1); |
|---|
| 220 | | - OUT_RING(chan, nfbdev->rop.handle); |
|---|
| 221 | | - BEGIN_NV04(chan, NvSubCtxSurf2D, 0x0300, 1); |
|---|
| 222 | | - OUT_RING(chan, 0x55); |
|---|
| 216 | + PUSH_NVSQ(push, NV043, 0x0000, nfbdev->rop.handle); |
|---|
| 217 | + PUSH_NVSQ(push, NV043, 0x0300, 0x55); |
|---|
| 223 | 218 | |
|---|
| 224 | | - BEGIN_NV04(chan, NvSubCtxSurf2D, 0x0000, 1); |
|---|
| 225 | | - OUT_RING(chan, nfbdev->patt.handle); |
|---|
| 226 | | - BEGIN_NV04(chan, NvSubCtxSurf2D, 0x0300, 8); |
|---|
| 227 | | - OUT_RING(chan, pattern_fmt); |
|---|
| 219 | + PUSH_NVSQ(push, NV044, 0x0000, nfbdev->patt.handle); |
|---|
| 220 | + PUSH_NVSQ(push, NV044, 0x0300, pattern_fmt, |
|---|
| 228 | 221 | #ifdef __BIG_ENDIAN |
|---|
| 229 | | - OUT_RING(chan, 2); |
|---|
| 222 | + 0x0304, 2, |
|---|
| 230 | 223 | #else |
|---|
| 231 | | - OUT_RING(chan, 1); |
|---|
| 224 | + 0x0304, 1, |
|---|
| 232 | 225 | #endif |
|---|
| 233 | | - OUT_RING(chan, 0); |
|---|
| 234 | | - OUT_RING(chan, 1); |
|---|
| 235 | | - OUT_RING(chan, ~0); |
|---|
| 236 | | - OUT_RING(chan, ~0); |
|---|
| 237 | | - OUT_RING(chan, ~0); |
|---|
| 238 | | - OUT_RING(chan, ~0); |
|---|
| 226 | + 0x0308, 0, |
|---|
| 227 | + 0x030c, 1, |
|---|
| 228 | + 0x0310, ~0, |
|---|
| 229 | + 0x0314, ~0, |
|---|
| 230 | + 0x0318, ~0, |
|---|
| 231 | + 0x031c, ~0); |
|---|
| 239 | 232 | |
|---|
| 240 | | - BEGIN_NV04(chan, NvSubCtxSurf2D, 0x0000, 1); |
|---|
| 241 | | - OUT_RING(chan, nfbdev->clip.handle); |
|---|
| 242 | | - BEGIN_NV04(chan, NvSubCtxSurf2D, 0x0300, 2); |
|---|
| 243 | | - OUT_RING(chan, 0); |
|---|
| 244 | | - OUT_RING(chan, (info->var.yres_virtual << 16) | info->var.xres_virtual); |
|---|
| 233 | + PUSH_NVSQ(push, NV019, 0x0000, nfbdev->clip.handle); |
|---|
| 234 | + PUSH_NVSQ(push, NV019, 0x0300, 0, |
|---|
| 235 | + 0x0304, (info->var.yres_virtual << 16) | info->var.xres_virtual); |
|---|
| 245 | 236 | |
|---|
| 246 | | - BEGIN_NV04(chan, NvSubImageBlit, 0x0000, 1); |
|---|
| 247 | | - OUT_RING(chan, nfbdev->blit.handle); |
|---|
| 248 | | - BEGIN_NV04(chan, NvSubImageBlit, 0x019c, 1); |
|---|
| 249 | | - OUT_RING(chan, nfbdev->surf2d.handle); |
|---|
| 250 | | - BEGIN_NV04(chan, NvSubImageBlit, 0x02fc, 1); |
|---|
| 251 | | - OUT_RING(chan, 3); |
|---|
| 252 | | - if (device->info.chipset >= 0x11 /*XXX: oclass == 0x009f*/) { |
|---|
| 253 | | - BEGIN_NV04(chan, NvSubImageBlit, 0x0120, 3); |
|---|
| 254 | | - OUT_RING(chan, 0); |
|---|
| 255 | | - OUT_RING(chan, 1); |
|---|
| 256 | | - OUT_RING(chan, 2); |
|---|
| 237 | + PUSH_NVSQ(push, NV05F, 0x0000, nfbdev->blit.handle); |
|---|
| 238 | + PUSH_NVSQ(push, NV05F, 0x019c, nfbdev->surf2d.handle); |
|---|
| 239 | + PUSH_NVSQ(push, NV05F, 0x02fc, 3); |
|---|
| 240 | + if (nfbdev->blit.oclass == 0x009f) { |
|---|
| 241 | + PUSH_NVSQ(push, NV09F, 0x0120, 0, |
|---|
| 242 | + 0x0124, 1, |
|---|
| 243 | + 0x0128, 2); |
|---|
| 257 | 244 | } |
|---|
| 258 | 245 | |
|---|
| 259 | | - BEGIN_NV04(chan, NvSubGdiRect, 0x0000, 1); |
|---|
| 260 | | - OUT_RING(chan, nfbdev->gdi.handle); |
|---|
| 261 | | - BEGIN_NV04(chan, NvSubGdiRect, 0x0198, 1); |
|---|
| 262 | | - OUT_RING(chan, nfbdev->surf2d.handle); |
|---|
| 263 | | - BEGIN_NV04(chan, NvSubGdiRect, 0x0188, 2); |
|---|
| 264 | | - OUT_RING(chan, nfbdev->patt.handle); |
|---|
| 265 | | - OUT_RING(chan, nfbdev->rop.handle); |
|---|
| 266 | | - BEGIN_NV04(chan, NvSubGdiRect, 0x0304, 1); |
|---|
| 267 | | - OUT_RING(chan, 1); |
|---|
| 268 | | - BEGIN_NV04(chan, NvSubGdiRect, 0x0300, 1); |
|---|
| 269 | | - OUT_RING(chan, rect_fmt); |
|---|
| 270 | | - BEGIN_NV04(chan, NvSubGdiRect, 0x02fc, 1); |
|---|
| 271 | | - OUT_RING(chan, 3); |
|---|
| 246 | + PUSH_NVSQ(push, NV04A, 0x0000, nfbdev->gdi.handle); |
|---|
| 247 | + PUSH_NVSQ(push, NV04A, 0x0198, nfbdev->surf2d.handle); |
|---|
| 248 | + PUSH_NVSQ(push, NV04A, 0x0188, nfbdev->patt.handle, |
|---|
| 249 | + 0x018c, nfbdev->rop.handle); |
|---|
| 250 | + PUSH_NVSQ(push, NV04A, 0x0304, 1); |
|---|
| 251 | + PUSH_NVSQ(push, NV04A, 0x0300, rect_fmt); |
|---|
| 252 | + PUSH_NVSQ(push, NV04A, 0x02fc, 3); |
|---|
| 272 | 253 | |
|---|
| 273 | | - FIRE_RING(chan); |
|---|
| 274 | | - |
|---|
| 254 | + PUSH_KICK(push); |
|---|
| 275 | 255 | return 0; |
|---|
| 276 | 256 | } |
|---|
| 277 | 257 | |
|---|