2 * Copyright 2007 Ben Skeggs
3 * Copyright 2007 Stephane Marchesin
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
20 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 #include "nv_include.h"
28 void NVSync(ScrnInfoPtr pScrn)
30 NVPtr pNv = NVPTR(pScrn);
31 struct nouveau_channel *chan = pNv->chan;
32 struct nouveau_grobj *gr = pNv->Nv2D ? pNv->Nv2D : pNv->NvImageBlit;
37 /* Wait for nvchannel to go completely idle */
38 nouveau_notifier_reset(pNv->notify0, 0);
39 BEGIN_RING(chan, gr, 0x104, 1);
41 BEGIN_RING(chan, gr, 0x100, 1);
44 if (nouveau_notifier_wait_status(pNv->notify0, 0,
45 NV_NOTIFY_STATE_STATUS_COMPLETED,
49 FatalError("GPU hang\n");
55 NVInitDma(ScrnInfoPtr pScrn)
57 NVPtr pNv = NVPTR(pScrn);
60 ret = nouveau_channel_alloc(pNv->dev, NvDmaFB, NvDmaTT, &pNv->chan);
62 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
63 "Error creating GPU channel: %d\n", ret);
67 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
68 "Opened GPU channel %d\n", pNv->chan->id);