Commit 0ad72863 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: port to nvif client/device/objects

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 967e7bde
...@@ -338,6 +338,7 @@ nouveau-y += nouveau_drm.o nouveau_chan.o nouveau_dma.o nouveau_fence.o ...@@ -338,6 +338,7 @@ nouveau-y += nouveau_drm.o nouveau_chan.o nouveau_dma.o nouveau_fence.o
nouveau-y += nouveau_vga.o nouveau_agp.o nouveau-y += nouveau_vga.o nouveau_agp.o
nouveau-y += nouveau_ttm.o nouveau_sgdma.o nouveau_bo.o nouveau_gem.o nouveau-y += nouveau_ttm.o nouveau_sgdma.o nouveau_bo.o nouveau_gem.o
nouveau-y += nouveau_prime.o nouveau_abi16.o nouveau-y += nouveau_prime.o nouveau_abi16.o
nouveau-y += nouveau_nvif.o
nouveau-y += nv04_fence.o nv10_fence.o nv17_fence.o nouveau-y += nv04_fence.o nv10_fence.o nv17_fence.o
nouveau-y += nv50_fence.o nv84_fence.o nvc0_fence.o nouveau-y += nv50_fence.o nv84_fence.o nvc0_fence.o
......
...@@ -70,6 +70,8 @@ nv04_display_create(struct drm_device *dev) ...@@ -70,6 +70,8 @@ nv04_display_create(struct drm_device *dev)
if (!disp) if (!disp)
return -ENOMEM; return -ENOMEM;
nvif_object_map(nvif_object(&drm->device));
nouveau_display(dev)->priv = disp; nouveau_display(dev)->priv = disp;
nouveau_display(dev)->dtor = nv04_display_destroy; nouveau_display(dev)->dtor = nv04_display_destroy;
nouveau_display(dev)->init = nv04_display_init; nouveau_display(dev)->init = nv04_display_init;
...@@ -144,6 +146,7 @@ void ...@@ -144,6 +146,7 @@ void
nv04_display_destroy(struct drm_device *dev) nv04_display_destroy(struct drm_device *dev)
{ {
struct nv04_display *disp = nv04_display(dev); struct nv04_display *disp = nv04_display(dev);
struct nouveau_drm *drm = nouveau_drm(dev);
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_crtc *crtc; struct drm_crtc *crtc;
...@@ -170,6 +173,8 @@ nv04_display_destroy(struct drm_device *dev) ...@@ -170,6 +173,8 @@ nv04_display_destroy(struct drm_device *dev)
nouveau_display(dev)->priv = NULL; nouveau_display(dev)->priv = NULL;
kfree(disp); kfree(disp);
nvif_object_unmap(nvif_object(&drm->device));
} }
int int
......
...@@ -27,9 +27,6 @@ ...@@ -27,9 +27,6 @@
#include "hw.h" #include "hw.h"
#include <subdev/bios/pll.h> #include <subdev/bios/pll.h>
#include <subdev/fb.h>
#include <subdev/clock.h>
#include <subdev/timer.h>
#define CHIPSET_NFORCE 0x01a0 #define CHIPSET_NFORCE 0x01a0
#define CHIPSET_NFORCE2 0x01f0 #define CHIPSET_NFORCE2 0x01f0
......
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
#include <drm/i2c/ch7006.h> #include <drm/i2c/ch7006.h>
#include <subdev/i2c.h>
static struct nouveau_i2c_board_info nv04_tv_encoder_info[] = { static struct nouveau_i2c_board_info nv04_tv_encoder_info[] = {
{ {
{ {
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <core/device.h> #include <core/device.h>
#include <subdev/bios/gpio.h> #include <subdev/bios/gpio.h>
#include <subdev/gpio.h>
MODULE_PARM_DESC(tv_norm, "Default TV norm.\n" MODULE_PARM_DESC(tv_norm, "Default TV norm.\n"
"\t\tSupported: PAL, PAL-M, PAL-N, PAL-Nc, NTSC-M, NTSC-J,\n" "\t\tSupported: PAL, PAL-M, PAL-N, PAL-Nc, NTSC-M, NTSC-J,\n"
......
...@@ -27,47 +27,34 @@ ...@@ -27,47 +27,34 @@
#include <core/class.h> #include <core/class.h>
#include <core/mm.h> #include <core/mm.h>
#include <subdev/fb.h>
#include <subdev/timer.h>
#include <subdev/instmem.h>
#include <engine/graph.h>
#include "nouveau_drm.h" #include "nouveau_drm.h"
#include "nouveau_dma.h" #include "nouveau_dma.h"
#include "nouveau_gem.h" #include "nouveau_gem.h"
#include "nouveau_chan.h" #include "nouveau_chan.h"
#include "nouveau_abi16.h" #include "nouveau_abi16.h"
void nouveau_drm_hack_device(struct nouveau_drm *, struct nvif_device *);
struct nouveau_abi16 * struct nouveau_abi16 *
nouveau_abi16_get(struct drm_file *file_priv, struct drm_device *dev) nouveau_abi16_get(struct drm_file *file_priv, struct drm_device *dev)
{ {
struct nouveau_cli *cli = nouveau_cli(file_priv); struct nouveau_cli *cli = nouveau_cli(file_priv);
struct nouveau_drm *drm = nouveau_drm(dev);
mutex_lock(&cli->mutex); mutex_lock(&cli->mutex);
if (!cli->abi16) { if (!cli->abi16) {
struct nouveau_abi16 *abi16; struct nouveau_abi16 *abi16;
cli->abi16 = abi16 = kzalloc(sizeof(*abi16), GFP_KERNEL); cli->abi16 = abi16 = kzalloc(sizeof(*abi16), GFP_KERNEL);
if (cli->abi16) { if (cli->abi16) {
INIT_LIST_HEAD(&abi16->channels); INIT_LIST_HEAD(&abi16->channels);
abi16->client = nv_object(cli);
/* allocate device object targeting client's default /* allocate device object targeting client's default
* device (ie. the one that belongs to the fd it * device (ie. the one that belongs to the fd it
* opened) * opened)
*/ */
if (nouveau_object_new(abi16->client, NVDRM_CLIENT, if (nvif_device_init(&cli->base.base, NULL,
NVDRM_DEVICE, 0x0080, NVDRM_DEVICE, NV_DEVICE_CLASS,
&(struct nv_device_class) { &(struct nv_device_class) {
.device = ~0ULL, .device = ~0ULL,
}, }, sizeof(struct nv_device_class),
sizeof(struct nv_device_class), &abi16->device) == 0)
(struct nouveau_object **)
&abi16->device.object) == 0) {
nouveau_drm_hack_device(drm, &abi16->device);
return cli->abi16; return cli->abi16;
}
kfree(cli->abi16); kfree(cli->abi16);
cli->abi16 = NULL; cli->abi16 = NULL;
...@@ -81,7 +68,7 @@ nouveau_abi16_get(struct drm_file *file_priv, struct drm_device *dev) ...@@ -81,7 +68,7 @@ nouveau_abi16_get(struct drm_file *file_priv, struct drm_device *dev)
int int
nouveau_abi16_put(struct nouveau_abi16 *abi16, int ret) nouveau_abi16_put(struct nouveau_abi16 *abi16, int ret)
{ {
struct nouveau_cli *cli = (void *)abi16->client; struct nouveau_cli *cli = (void *)nvif_client(&abi16->device.base);
mutex_unlock(&cli->mutex); mutex_unlock(&cli->mutex);
return ret; return ret;
} }
...@@ -144,7 +131,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16, ...@@ -144,7 +131,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,
/* destroy channel object, all children will be killed too */ /* destroy channel object, all children will be killed too */
if (chan->chan) { if (chan->chan) {
abi16->handles &= ~(1ULL << (chan->chan->handle & 0xffff)); abi16->handles &= ~(1ULL << (chan->chan->object->handle & 0xffff));
nouveau_channel_del(&chan->chan); nouveau_channel_del(&chan->chan);
} }
...@@ -155,7 +142,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16, ...@@ -155,7 +142,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,
void void
nouveau_abi16_fini(struct nouveau_abi16 *abi16) nouveau_abi16_fini(struct nouveau_abi16 *abi16)
{ {
struct nouveau_cli *cli = (void *)abi16->client; struct nouveau_cli *cli = (void *)nvif_client(&abi16->device.base);
struct nouveau_abi16_chan *chan, *temp; struct nouveau_abi16_chan *chan, *temp;
/* cleanup channels */ /* cleanup channels */
...@@ -164,7 +151,7 @@ nouveau_abi16_fini(struct nouveau_abi16 *abi16) ...@@ -164,7 +151,7 @@ nouveau_abi16_fini(struct nouveau_abi16 *abi16)
} }
/* destroy the device object */ /* destroy the device object */
nouveau_object_del(abi16->client, NVDRM_CLIENT, NVDRM_DEVICE); nvif_device_fini(&abi16->device);
kfree(cli->abi16); kfree(cli->abi16);
cli->abi16 = NULL; cli->abi16 = NULL;
...@@ -251,7 +238,6 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS) ...@@ -251,7 +238,6 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev);
struct nouveau_abi16_chan *chan; struct nouveau_abi16_chan *chan;
struct nouveau_client *client;
struct nvif_device *device; struct nvif_device *device;
struct nouveau_instmem *imem; struct nouveau_instmem *imem;
struct nouveau_fb *pfb; struct nouveau_fb *pfb;
...@@ -263,7 +249,6 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS) ...@@ -263,7 +249,6 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
if (!drm->channel) if (!drm->channel)
return nouveau_abi16_put(abi16, -ENODEV); return nouveau_abi16_put(abi16, -ENODEV);
client = nv_client(abi16->client);
device = &abi16->device; device = &abi16->device;
imem = nvkm_instmem(device); imem = nvkm_instmem(device);
pfb = nvkm_fb(device); pfb = nvkm_fb(device);
...@@ -298,8 +283,8 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS) ...@@ -298,8 +283,8 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
abi16->handles |= (1ULL << init->channel); abi16->handles |= (1ULL << init->channel);
/* create channel object and initialise dma and fence management */ /* create channel object and initialise dma and fence management */
ret = nouveau_channel_new(drm, cli, NVDRM_DEVICE, NVDRM_CHAN | ret = nouveau_channel_new(drm, device, NVDRM_CHAN | init->channel,
init->channel, init->fb_ctxdma_handle, init->fb_ctxdma_handle,
init->tt_ctxdma_handle, &chan->chan); init->tt_ctxdma_handle, &chan->chan);
if (ret) if (ret)
goto done; goto done;
...@@ -330,7 +315,7 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS) ...@@ -330,7 +315,7 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
goto done; goto done;
if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) { if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
ret = nouveau_bo_vma_add(chan->ntfy, client->vm, ret = nouveau_bo_vma_add(chan->ntfy, cli->vm,
&chan->ntfy_vma); &chan->ntfy_vma);
if (ret) if (ret)
goto done; goto done;
...@@ -361,7 +346,7 @@ nouveau_abi16_ioctl_channel_free(ABI16_IOCTL_ARGS) ...@@ -361,7 +346,7 @@ nouveau_abi16_ioctl_channel_free(ABI16_IOCTL_ARGS)
return -ENOMEM; return -ENOMEM;
list_for_each_entry(chan, &abi16->channels, head) { list_for_each_entry(chan, &abi16->channels, head) {
if (chan->chan->handle == (NVDRM_CHAN | req->channel)) { if (chan->chan->object->handle == (NVDRM_CHAN | req->channel)) {
nouveau_abi16_chan_fini(abi16, chan); nouveau_abi16_chan_fini(abi16, chan);
return nouveau_abi16_put(abi16, 0); return nouveau_abi16_put(abi16, 0);
} }
...@@ -392,8 +377,10 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS) ...@@ -392,8 +377,10 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS)
return nouveau_abi16_put(abi16, 0); return nouveau_abi16_put(abi16, 0);
} }
ret = nouveau_object_new(abi16->client, NVDRM_CHAN | init->channel, /*XXX*/
init->handle, init->class, NULL, 0, &object); ret = nouveau_object_new(nv_object(nvkm_client(&abi16->device.base)),
NVDRM_CHAN | init->channel, init->handle,
init->class, NULL, 0, &object);
return nouveau_abi16_put(abi16, ret); return nouveau_abi16_put(abi16, ret);
} }
...@@ -418,7 +405,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) ...@@ -418,7 +405,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
return nouveau_abi16_put(abi16, -EINVAL); return nouveau_abi16_put(abi16, -EINVAL);
list_for_each_entry(temp, &abi16->channels, head) { list_for_each_entry(temp, &abi16->channels, head) {
if (temp->chan->handle == (NVDRM_CHAN | info->channel)) { if (temp->chan->object->handle == (NVDRM_CHAN | info->channel)) {
chan = temp; chan = temp;
break; break;
} }
...@@ -456,9 +443,11 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) ...@@ -456,9 +443,11 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
args.limit += chan->ntfy->bo.offset; args.limit += chan->ntfy->bo.offset;
} }
ret = nouveau_object_new(abi16->client, chan->chan->handle, /*XXX*/
ntfy->handle, 0x003d, &args, ret = nouveau_object_new(nv_object(nvkm_client(&abi16->device.base)),
sizeof(args), &object); NVDRM_CHAN | info->channel, ntfy->handle,
NV_DMA_IN_MEMORY_CLASS, &args, sizeof(args),
&object);
if (ret) if (ret)
goto done; goto done;
...@@ -483,7 +472,7 @@ nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS) ...@@ -483,7 +472,7 @@ nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS)
return -ENOMEM; return -ENOMEM;
list_for_each_entry(temp, &abi16->channels, head) { list_for_each_entry(temp, &abi16->channels, head) {
if (temp->chan->handle == (NVDRM_CHAN | fini->channel)) { if (temp->chan->object->handle == (NVDRM_CHAN | fini->channel)) {
chan = temp; chan = temp;
break; break;
} }
...@@ -495,7 +484,9 @@ nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS) ...@@ -495,7 +484,9 @@ nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS)
/* synchronize with the user channel and destroy the gpu object */ /* synchronize with the user channel and destroy the gpu object */
nouveau_channel_idle(chan->chan); nouveau_channel_idle(chan->chan);
ret = nouveau_object_del(abi16->client, chan->chan->handle, fini->handle); /*XXX*/
ret = nouveau_object_del(nv_object(nvkm_client(&abi16->device.base)),
chan->chan->object->handle, fini->handle);
if (ret) if (ret)
return nouveau_abi16_put(abi16, ret); return nouveau_abi16_put(abi16, ret);
......
...@@ -28,7 +28,6 @@ struct nouveau_abi16_chan { ...@@ -28,7 +28,6 @@ struct nouveau_abi16_chan {
}; };
struct nouveau_abi16 { struct nouveau_abi16 {
struct nouveau_object *client;
struct nvif_device device; struct nvif_device device;
struct list_head channels; struct list_head channels;
u64 handles; u64 handles;
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
* SOFTWARE. * SOFTWARE.
*/ */
#include <subdev/bios.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include "nouveau_drm.h" #include "nouveau_drm.h"
......
...@@ -30,10 +30,6 @@ ...@@ -30,10 +30,6 @@
#include <core/engine.h> #include <core/engine.h>
#include <linux/swiotlb.h> #include <linux/swiotlb.h>
#include <subdev/fb.h>
#include <subdev/vm.h>
#include <subdev/bar.h>
#include "nouveau_drm.h" #include "nouveau_drm.h"
#include "nouveau_dma.h" #include "nouveau_dma.h"
#include "nouveau_fence.h" #include "nouveau_fence.h"
...@@ -951,6 +947,7 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr, ...@@ -951,6 +947,7 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
{ {
struct nouveau_drm *drm = nouveau_bdev(bo->bdev); struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
struct nouveau_channel *chan = drm->ttm.chan; struct nouveau_channel *chan = drm->ttm.chan;
struct nouveau_cli *cli = (void *)nvif_client(&chan->device->base);
struct nouveau_fence *fence; struct nouveau_fence *fence;
int ret; int ret;
...@@ -964,7 +961,7 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr, ...@@ -964,7 +961,7 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
return ret; return ret;
} }
mutex_lock_nested(&chan->cli->mutex, SINGLE_DEPTH_NESTING); mutex_lock_nested(&cli->mutex, SINGLE_DEPTH_NESTING);
ret = nouveau_fence_sync(bo->sync_obj, chan); ret = nouveau_fence_sync(bo->sync_obj, chan);
if (ret == 0) { if (ret == 0) {
ret = drm->ttm.move(chan, bo, &bo->mem, new_mem); ret = drm->ttm.move(chan, bo, &bo->mem, new_mem);
...@@ -979,7 +976,7 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr, ...@@ -979,7 +976,7 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
} }
} }
} }
mutex_unlock(&chan->cli->mutex); mutex_unlock(&cli->mutex);
return ret; return ret;
} }
...@@ -1011,9 +1008,7 @@ nouveau_bo_move_init(struct nouveau_drm *drm) ...@@ -1011,9 +1008,7 @@ nouveau_bo_move_init(struct nouveau_drm *drm)
int ret; int ret;
do { do {
struct nouveau_object *object;
struct nouveau_channel *chan; struct nouveau_channel *chan;
u32 handle = (mthd->engine << 16) | mthd->oclass;
if (mthd->engine) if (mthd->engine)
chan = drm->cechan; chan = drm->cechan;
...@@ -1022,13 +1017,14 @@ nouveau_bo_move_init(struct nouveau_drm *drm) ...@@ -1022,13 +1017,14 @@ nouveau_bo_move_init(struct nouveau_drm *drm)
if (chan == NULL) if (chan == NULL)
continue; continue;
ret = nouveau_object_new(nv_object(drm), chan->handle, handle, ret = nvif_object_init(chan->object, NULL,
mthd->oclass, NULL, 0, &object); mthd->oclass | (mthd->engine << 16),
mthd->oclass, NULL, 0,
&drm->ttm.copy);
if (ret == 0) { if (ret == 0) {
ret = mthd->init(chan, handle); ret = mthd->init(chan, drm->ttm.copy.handle);
if (ret) { if (ret) {
nouveau_object_del(nv_object(drm), nvif_object_fini(&drm->ttm.copy);
chan->handle, handle);
continue; continue;
} }
......
...@@ -27,12 +27,6 @@ ...@@ -27,12 +27,6 @@
#include <core/device.h> #include <core/device.h>
#include <core/class.h> #include <core/class.h>
#include <subdev/fb.h>
#include <subdev/vm.h>
#include <subdev/instmem.h>
#include <engine/software.h>
#include "nouveau_drm.h" #include "nouveau_drm.h"
#include "nouveau_dma.h" #include "nouveau_dma.h"
#include "nouveau_bo.h" #include "nouveau_bo.h"
...@@ -47,7 +41,7 @@ module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400); ...@@ -47,7 +41,7 @@ module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400);
int int
nouveau_channel_idle(struct nouveau_channel *chan) nouveau_channel_idle(struct nouveau_channel *chan)
{ {
struct nouveau_cli *cli = chan->cli; struct nouveau_cli *cli = (void *)nvif_client(chan->object);
struct nouveau_fence *fence = NULL; struct nouveau_fence *fence = NULL;
int ret; int ret;
...@@ -59,7 +53,7 @@ nouveau_channel_idle(struct nouveau_channel *chan) ...@@ -59,7 +53,7 @@ nouveau_channel_idle(struct nouveau_channel *chan)
if (ret) if (ret)
NV_PRINTK(error, cli, "failed to idle channel 0x%08x [%s]\n", NV_PRINTK(error, cli, "failed to idle channel 0x%08x [%s]\n",
chan->handle, cli->base.name); chan->object->handle, nvkm_client(&cli->base)->name);
return ret; return ret;
} }
...@@ -68,36 +62,36 @@ nouveau_channel_del(struct nouveau_channel **pchan) ...@@ -68,36 +62,36 @@ nouveau_channel_del(struct nouveau_channel **pchan)
{ {
struct nouveau_channel *chan = *pchan; struct nouveau_channel *chan = *pchan;
if (chan) { if (chan) {
struct nouveau_object *client = nv_object(chan->cli);
if (chan->fence) { if (chan->fence) {
nouveau_channel_idle(chan); nouveau_channel_idle(chan);
nouveau_fence(chan->drm)->context_del(chan); nouveau_fence(chan->drm)->context_del(chan);
} }
nouveau_object_del(client, NVDRM_DEVICE, chan->handle); nvif_object_fini(&chan->nvsw);
nouveau_object_del(client, NVDRM_DEVICE, chan->push.handle); nvif_object_fini(&chan->gart);
nvif_object_fini(&chan->vram);
nvif_object_ref(NULL, &chan->object);
nvif_object_fini(&chan->push.ctxdma);
nouveau_bo_vma_del(chan->push.buffer, &chan->push.vma); nouveau_bo_vma_del(chan->push.buffer, &chan->push.vma);
nouveau_bo_unmap(chan->push.buffer); nouveau_bo_unmap(chan->push.buffer);
if (chan->push.buffer && chan->push.buffer->pin_refcnt) if (chan->push.buffer && chan->push.buffer->pin_refcnt)
nouveau_bo_unpin(chan->push.buffer); nouveau_bo_unpin(chan->push.buffer);
nouveau_bo_ref(NULL, &chan->push.buffer); nouveau_bo_ref(NULL, &chan->push.buffer);
nvif_device_ref(NULL, &chan->device);
kfree(chan); kfree(chan);
} }
*pchan = NULL; *pchan = NULL;
} }
static int static int
nouveau_channel_prep(struct nouveau_drm *drm, struct nouveau_cli *cli, nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device,
u32 parent, u32 handle, u32 size, u32 handle, u32 size, struct nouveau_channel **pchan)
struct nouveau_channel **pchan)
{ {
struct nvif_device *device = &drm->device; struct nouveau_cli *cli = (void *)nvif_client(&device->base);
struct nouveau_instmem *imem = nvkm_instmem(device); struct nouveau_instmem *imem = nvkm_instmem(device);
struct nouveau_vmmgr *vmm = nvkm_vmmgr(device); struct nouveau_vmmgr *vmm = nvkm_vmmgr(device);
struct nouveau_fb *pfb = nvkm_fb(device); struct nouveau_fb *pfb = nvkm_fb(device);
struct nouveau_client *client = &cli->base;
struct nv_dma_class args = {}; struct nv_dma_class args = {};
struct nouveau_channel *chan; struct nouveau_channel *chan;
struct nouveau_object *push;
u32 target; u32 target;
int ret; int ret;
...@@ -105,9 +99,8 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nouveau_cli *cli, ...@@ -105,9 +99,8 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nouveau_cli *cli,
if (!chan) if (!chan)
return -ENOMEM; return -ENOMEM;
chan->cli = cli; nvif_device_ref(device, &chan->device);
chan->drm = drm; chan->drm = drm;
chan->handle = handle;
/* allocate memory for dma push buffer */ /* allocate memory for dma push buffer */
target = TTM_PL_FLAG_TT; target = TTM_PL_FLAG_TT;
...@@ -132,10 +125,9 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nouveau_cli *cli, ...@@ -132,10 +125,9 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nouveau_cli *cli,
* we be able to call out to other (indirect) push buffers * we be able to call out to other (indirect) push buffers
*/ */
chan->push.vma.offset = chan->push.buffer->bo.offset; chan->push.vma.offset = chan->push.buffer->bo.offset;
chan->push.handle = NVDRM_PUSH | (handle & 0xffff);
if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) { if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
ret = nouveau_bo_vma_add(chan->push.buffer, client->vm, ret = nouveau_bo_vma_add(chan->push.buffer, cli->vm,
&chan->push.vma); &chan->push.vma);
if (ret) { if (ret) {
nouveau_channel_del(pchan); nouveau_channel_del(pchan);
...@@ -144,7 +136,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nouveau_cli *cli, ...@@ -144,7 +136,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nouveau_cli *cli,
args.flags = NV_DMA_TARGET_VM | NV_DMA_ACCESS_VM; args.flags = NV_DMA_TARGET_VM | NV_DMA_ACCESS_VM;
args.start = 0; args.start = 0;
args.limit = client->vm->vmm->limit - 1; args.limit = cli->vm->vmm->limit - 1;
} else } else
if (chan->push.buffer->bo.mem.mem_type == TTM_PL_VRAM) { if (chan->push.buffer->bo.mem.mem_type == TTM_PL_VRAM) {
u64 limit = pfb->ram->size - imem->reserved - 1; u64 limit = pfb->ram->size - imem->reserved - 1;
...@@ -174,9 +166,9 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nouveau_cli *cli, ...@@ -174,9 +166,9 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nouveau_cli *cli,
} }
} }
ret = nouveau_object_new(nv_object(chan->cli), parent, ret = nvif_object_init(nvif_object(device), NULL, NVDRM_PUSH |
chan->push.handle, 0x0002, (handle & 0xffff), NV_DMA_FROM_MEMORY_CLASS,
&args, sizeof(args), &push); &args, sizeof(args), &chan->push.ctxdma);
if (ret) { if (ret) {
nouveau_channel_del(pchan); nouveau_channel_del(pchan);
return ret; return ret;
...@@ -186,9 +178,8 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nouveau_cli *cli, ...@@ -186,9 +178,8 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nouveau_cli *cli,
} }
static int static int
nouveau_channel_ind(struct nouveau_drm *drm, struct nouveau_cli *cli, nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device,
u32 parent, u32 handle, u32 engine, u32 handle, u32 engine, struct nouveau_channel **pchan)
struct nouveau_channel **pchan)
{ {
static const u16 oclasses[] = { NVE0_CHANNEL_IND_CLASS, static const u16 oclasses[] = { NVE0_CHANNEL_IND_CLASS,
NVC0_CHANNEL_IND_CLASS, NVC0_CHANNEL_IND_CLASS,
...@@ -201,22 +192,20 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nouveau_cli *cli, ...@@ -201,22 +192,20 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nouveau_cli *cli,
int ret; int ret;
/* allocate dma push buffer */ /* allocate dma push buffer */
ret = nouveau_channel_prep(drm, cli, parent, handle, 0x12000, &chan); ret = nouveau_channel_prep(drm, device, handle, 0x12000, &chan);
*pchan = chan; *pchan = chan;
if (ret) if (ret)
return ret; return ret;
/* create channel object */ /* create channel object */
args.pushbuf = chan->push.handle; args.pushbuf = chan->push.ctxdma.handle;
args.ioffset = 0x10000 + chan->push.vma.offset; args.ioffset = 0x10000 + chan->push.vma.offset;
args.ilength = 0x02000; args.ilength = 0x02000;
args.engine = engine; args.engine = engine;
do { do {
ret = nouveau_object_new(nv_object(cli), parent, handle, ret = nvif_object_new(nvif_object(device), handle, *oclass++,
*oclass++, &args, sizeof(args), &args, sizeof(args), &chan->object);
(struct nouveau_object **)
&chan->object);
if (ret == 0) if (ret == 0)
return ret; return ret;
} while (*oclass); } while (*oclass);
...@@ -226,8 +215,8 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nouveau_cli *cli, ...@@ -226,8 +215,8 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nouveau_cli *cli,
} }
static int static int
nouveau_channel_dma(struct nouveau_drm *drm, struct nouveau_cli *cli, nouveau_channel_dma(struct nouveau_drm *drm, struct nvif_device *device,
u32 parent, u32 handle, struct nouveau_channel **pchan) u32 handle, struct nouveau_channel **pchan)
{ {
static const u16 oclasses[] = { NV40_CHANNEL_DMA_CLASS, static const u16 oclasses[] = { NV40_CHANNEL_DMA_CLASS,
NV17_CHANNEL_DMA_CLASS, NV17_CHANNEL_DMA_CLASS,
...@@ -240,20 +229,18 @@ nouveau_channel_dma(struct nouveau_drm *drm, struct nouveau_cli *cli, ...@@ -240,20 +229,18 @@ nouveau_channel_dma(struct nouveau_drm *drm, struct nouveau_cli *cli,
int ret; int ret;
/* allocate dma push buffer */ /* allocate dma push buffer */
ret = nouveau_channel_prep(drm, cli, parent, handle, 0x10000, &chan); ret = nouveau_channel_prep(drm, device, handle, 0x10000, &chan);
*pchan = chan; *pchan = chan;
if (ret) if (ret)
return ret; return ret;
/* create channel object */ /* create channel object */
args.pushbuf = chan->push.handle; args.pushbuf = chan->push.ctxdma.handle;
args.offset = chan->push.vma.offset; args.offset = chan->push.vma.offset;
do { do {
ret = nouveau_object_new(nv_object(cli), parent, handle, ret = nvif_object_new(nvif_object(device), handle, *oclass++,
*oclass++, &args, sizeof(args), &args, sizeof(args), &chan->object);
(struct nouveau_object **)
&chan->object);
if (ret == 0) if (ret == 0)
return ret; return ret;
} while (ret && *oclass); } while (ret && *oclass);
...@@ -265,13 +252,12 @@ nouveau_channel_dma(struct nouveau_drm *drm, struct nouveau_cli *cli, ...@@ -265,13 +252,12 @@ nouveau_channel_dma(struct nouveau_drm *drm, struct nouveau_cli *cli,
static int static int
nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
{ {
struct nouveau_client *client = nv_client(chan->cli); struct nvif_device *device = chan->device;
struct nvif_device *device = &chan->drm->device; struct nouveau_cli *cli = (void *)nvif_client(&device->base);
struct nouveau_instmem *imem = nvkm_instmem(device); struct nouveau_instmem *imem = nvkm_instmem(device);
struct nouveau_vmmgr *vmm = nvkm_vmmgr(device); struct nouveau_vmmgr *vmm = nvkm_vmmgr(device);
struct nouveau_fb *pfb = nvkm_fb(device); struct nouveau_fb *pfb = nvkm_fb(device);
struct nouveau_software_chan *swch; struct nouveau_software_chan *swch;
struct nouveau_object *object;
struct nv_dma_class args = {}; struct nv_dma_class args = {};
int ret, i; int ret, i;
...@@ -280,22 +266,23 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) ...@@ -280,22 +266,23 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) { if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
args.flags = NV_DMA_TARGET_VM | NV_DMA_ACCESS_VM; args.flags = NV_DMA_TARGET_VM | NV_DMA_ACCESS_VM;
args.start = 0; args.start = 0;
args.limit = client->vm->vmm->limit - 1; args.limit = cli->vm->vmm->limit - 1;
} else { } else {
args.flags = NV_DMA_TARGET_VRAM | NV_DMA_ACCESS_RDWR; args.flags = NV_DMA_TARGET_VRAM | NV_DMA_ACCESS_RDWR;
args.start = 0; args.start = 0;
args.limit = pfb->ram->size - imem->reserved - 1; args.limit = pfb->ram->size - imem->reserved - 1;
} }
ret = nouveau_object_new(nv_object(client), chan->handle, vram, ret = nvif_object_init(chan->object, NULL, vram,
0x003d, &args, sizeof(args), &object); NV_DMA_IN_MEMORY_CLASS, &args,
sizeof(args), &chan->vram);
if (ret) if (ret)
return ret; return ret;
if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) { if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
args.flags = NV_DMA_TARGET_VM | NV_DMA_ACCESS_VM; args.flags = NV_DMA_TARGET_VM | NV_DMA_ACCESS_VM;
args.start = 0; args.start = 0;
args.limit = client->vm->vmm->limit - 1; args.limit = cli->vm->vmm->limit - 1;
} else } else
if (chan->drm->agp.stat == ENABLED) { if (chan->drm->agp.stat == ENABLED) {
args.flags = NV_DMA_TARGET_AGP | NV_DMA_ACCESS_RDWR; args.flags = NV_DMA_TARGET_AGP | NV_DMA_ACCESS_RDWR;
...@@ -308,17 +295,15 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) ...@@ -308,17 +295,15 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
args.limit = vmm->limit - 1; args.limit = vmm->limit - 1;
} }
ret = nouveau_object_new(nv_object(client), chan->handle, gart, ret = nvif_object_init(chan->object, NULL, gart,
0x003d, &args, sizeof(args), &object); NV_DMA_IN_MEMORY_CLASS, &args,
sizeof(args), &chan->gart);
if (ret) if (ret)
return ret; return ret;
chan->vram = vram;
chan->gart = gart;
} }
/* initialise dma tracking parameters */ /* initialise dma tracking parameters */
switch (nv_hclass(chan->object) & 0x00ff) { switch (chan->object->oclass & 0x00ff) {
case 0x006b: case 0x006b:
case 0x006e: case 0x006e:
chan->user_put = 0x40; chan->user_put = 0x40;
...@@ -350,12 +335,12 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) ...@@ -350,12 +335,12 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
/* allocate software object class (used for fences on <= nv05) */ /* allocate software object class (used for fences on <= nv05) */
if (device->info.family < NV_DEVICE_INFO_V0_CELSIUS) { if (device->info.family < NV_DEVICE_INFO_V0_CELSIUS) {
ret = nouveau_object_new(nv_object(client), chan->handle, ret = nvif_object_init(chan->object, NULL, NvSw, 0x006e,
NvSw, 0x006e, NULL, 0, &object); NULL, 0, &chan->nvsw);
if (ret) if (ret)
return ret; return ret;
swch = (void *)object->parent; swch = (void *)nvkm_object(&chan->nvsw)->parent;
swch->flip = nouveau_flip_complete; swch->flip = nouveau_flip_complete;
swch->flip_data = chan; swch->flip_data = chan;
...@@ -373,16 +358,17 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) ...@@ -373,16 +358,17 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
} }
int int
nouveau_channel_new(struct nouveau_drm *drm, struct nouveau_cli *cli, nouveau_channel_new(struct nouveau_drm *drm, struct nvif_device *device,
u32 parent, u32 handle, u32 arg0, u32 arg1, u32 handle, u32 arg0, u32 arg1,
struct nouveau_channel **pchan) struct nouveau_channel **pchan)
{ {
struct nouveau_cli *cli = (void *)nvif_client(&device->base);
int ret; int ret;
ret = nouveau_channel_ind(drm, cli, parent, handle, arg0, pchan); ret = nouveau_channel_ind(drm, device, handle, arg0, pchan);
if (ret) { if (ret) {
NV_PRINTK(debug, cli, "ib channel create, %d\n", ret); NV_PRINTK(debug, cli, "ib channel create, %d\n", ret);
ret = nouveau_channel_dma(drm, cli, parent, handle, pchan); ret = nouveau_channel_dma(drm, device, handle, pchan);
if (ret) { if (ret) {
NV_PRINTK(debug, cli, "dma channel create, %d\n", ret); NV_PRINTK(debug, cli, "dma channel create, %d\n", ret);
return ret; return ret;
......
#ifndef __NOUVEAU_CHAN_H__ #ifndef __NOUVEAU_CHAN_H__
#define __NOUVEAU_CHAN_H__ #define __NOUVEAU_CHAN_H__
struct nouveau_cli; #include <nvif/object.h>
struct nvif_device;
struct nouveau_channel { struct nouveau_channel {
struct nouveau_cli *cli; struct nvif_device *device;
struct nouveau_drm *drm; struct nouveau_drm *drm;
u32 handle; struct nvif_object vram;
u32 vram; struct nvif_object gart;
u32 gart; struct nvif_object nvsw;
struct { struct {
struct nouveau_bo *buffer; struct nouveau_bo *buffer;
struct nouveau_vma vma; struct nouveau_vma vma;
u32 handle; struct nvif_object ctxdma;
} push; } push;
/* TODO: this will be reworked in the near future */ /* TODO: this will be reworked in the near future */
...@@ -38,8 +39,8 @@ struct nouveau_channel { ...@@ -38,8 +39,8 @@ struct nouveau_channel {
}; };
int nouveau_channel_new(struct nouveau_drm *, struct nouveau_cli *, int nouveau_channel_new(struct nouveau_drm *, struct nvif_device *,
u32 parent, u32 handle, u32 arg0, u32 arg1, u32 handle, u32 arg0, u32 arg1,
struct nouveau_channel **); struct nouveau_channel **);
void nouveau_channel_del(struct nouveau_channel **); void nouveau_channel_del(struct nouveau_channel **);
int nouveau_channel_idle(struct nouveau_channel *); int nouveau_channel_idle(struct nouveau_channel *);
......
...@@ -42,10 +42,6 @@ ...@@ -42,10 +42,6 @@
#include "nouveau_encoder.h" #include "nouveau_encoder.h"
#include "nouveau_crtc.h" #include "nouveau_crtc.h"
#include <subdev/i2c.h>
#include <subdev/gpio.h>
#include <engine/disp.h>
#include <nvif/event.h> #include <nvif/event.h>
MODULE_PARM_DESC(tv_disable, "Disable TV-out detection"); MODULE_PARM_DESC(tv_disable, "Disable TV-out detection");
......
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
#include "nouveau_fence.h" #include "nouveau_fence.h"
#include <engine/disp.h>
#include <core/class.h> #include <core/class.h>
#include <nvif/event.h> #include <nvif/event.h>
...@@ -102,7 +100,7 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos, ...@@ -102,7 +100,7 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,
int ret, retry = 1; int ret, retry = 1;
do { do {
ret = nv_exec(disp->core, mthd, &args, sizeof(args)); ret = nvif_exec(&disp->disp, mthd, &args, sizeof(args));
if (ret != 0) if (ret != 0)
return 0; return 0;
...@@ -399,10 +397,10 @@ nouveau_display_create_properties(struct drm_device *dev) ...@@ -399,10 +397,10 @@ nouveau_display_create_properties(struct drm_device *dev)
struct nouveau_display *disp = nouveau_display(dev); struct nouveau_display *disp = nouveau_display(dev);
int gen; int gen;
if (nv_mclass(disp->core) < NV50_DISP_CLASS) if (disp->disp.oclass < NV50_DISP_CLASS)
gen = 0; gen = 0;
else else
if (nv_mclass(disp->core) < NVD0_DISP_CLASS) if (disp->disp.oclass < NVD0_DISP_CLASS)
gen = 1; gen = 1;
else else
gen = 2; gen = 2;
...@@ -488,14 +486,14 @@ nouveau_display_create(struct drm_device *dev) ...@@ -488,14 +486,14 @@ nouveau_display_create(struct drm_device *dev)
int i; int i;
for (i = 0, ret = -ENODEV; ret && i < ARRAY_SIZE(oclass); i++) { for (i = 0, ret = -ENODEV; ret && i < ARRAY_SIZE(oclass); i++) {
ret = nouveau_object_new(nv_object(drm), NVDRM_DEVICE, ret = nvif_object_init(nvif_object(&drm->device), NULL,
NVDRM_DISPLAY, oclass[i], NVDRM_DISPLAY, oclass[i],
NULL, 0, &disp->core); NULL, 0, &disp->disp);
} }
if (ret == 0) { if (ret == 0) {
nouveau_display_create_properties(dev); nouveau_display_create_properties(dev);
if (nv_mclass(disp->core) < NV50_DISP_CLASS) if (disp->disp.oclass < NV50_DISP_CLASS)
ret = nv04_display_create(dev); ret = nv04_display_create(dev);
else else
ret = nv50_display_create(dev); ret = nv50_display_create(dev);
...@@ -528,7 +526,6 @@ void ...@@ -528,7 +526,6 @@ void
nouveau_display_destroy(struct drm_device *dev) nouveau_display_destroy(struct drm_device *dev)
{ {
struct nouveau_display *disp = nouveau_display(dev); struct nouveau_display *disp = nouveau_display(dev);
struct nouveau_drm *drm = nouveau_drm(dev);
nouveau_backlight_exit(dev); nouveau_backlight_exit(dev);
nouveau_display_vblank_fini(dev); nouveau_display_vblank_fini(dev);
...@@ -539,7 +536,7 @@ nouveau_display_destroy(struct drm_device *dev) ...@@ -539,7 +536,7 @@ nouveau_display_destroy(struct drm_device *dev)
if (disp->dtor) if (disp->dtor)
disp->dtor(dev); disp->dtor(dev);
nouveau_object_del(nv_object(drm), NVDRM_DEVICE, NVDRM_DISPLAY); nvif_object_fini(&disp->disp);
nouveau_drm(dev)->display = NULL; nouveau_drm(dev)->display = NULL;
kfree(disp); kfree(disp);
...@@ -690,12 +687,15 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, ...@@ -690,12 +687,15 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
struct nouveau_bo *old_bo = nouveau_framebuffer(crtc->primary->fb)->nvbo; struct nouveau_bo *old_bo = nouveau_framebuffer(crtc->primary->fb)->nvbo;
struct nouveau_bo *new_bo = nouveau_framebuffer(fb)->nvbo; struct nouveau_bo *new_bo = nouveau_framebuffer(fb)->nvbo;
struct nouveau_page_flip_state *s; struct nouveau_page_flip_state *s;
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan;
struct nouveau_cli *cli;
struct nouveau_fence *fence; struct nouveau_fence *fence;
int ret; int ret;
if (!drm->channel) chan = drm->channel;
if (!chan)
return -ENODEV; return -ENODEV;
cli = (void *)nvif_client(&chan->device->base);
s = kzalloc(sizeof(*s), GFP_KERNEL); s = kzalloc(sizeof(*s), GFP_KERNEL);
if (!s) if (!s)
...@@ -707,7 +707,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, ...@@ -707,7 +707,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
goto fail_free; goto fail_free;
} }
mutex_lock(&chan->cli->mutex); mutex_lock(&cli->mutex);
/* synchronise rendering channel with the kernel's channel */ /* synchronise rendering channel with the kernel's channel */
spin_lock(&new_bo->bo.bdev->fence_lock); spin_lock(&new_bo->bo.bdev->fence_lock);
...@@ -761,7 +761,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, ...@@ -761,7 +761,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
ret = nouveau_page_flip_emit(chan, old_bo, new_bo, s, &fence); ret = nouveau_page_flip_emit(chan, old_bo, new_bo, s, &fence);
if (ret) if (ret)
goto fail_unreserve; goto fail_unreserve;
mutex_unlock(&chan->cli->mutex); mutex_unlock(&cli->mutex);
/* Update the crtc struct and cleanup */ /* Update the crtc struct and cleanup */
crtc->primary->fb = fb; crtc->primary->fb = fb;
...@@ -777,7 +777,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, ...@@ -777,7 +777,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
drm_vblank_put(dev, nouveau_crtc(crtc)->index); drm_vblank_put(dev, nouveau_crtc(crtc)->index);
ttm_bo_unreserve(&old_bo->bo); ttm_bo_unreserve(&old_bo->bo);
fail_unpin: fail_unpin:
mutex_unlock(&chan->cli->mutex); mutex_unlock(&cli->mutex);
if (old_bo != new_bo) if (old_bo != new_bo)
nouveau_bo_unpin(new_bo); nouveau_bo_unpin(new_bo);
fail_free: fail_free:
......
...@@ -12,6 +12,8 @@ struct nouveau_framebuffer { ...@@ -12,6 +12,8 @@ struct nouveau_framebuffer {
u32 r_handle; u32 r_handle;
u32 r_format; u32 r_format;
u32 r_pitch; u32 r_pitch;
struct nvif_object h_base[4];
struct nvif_object h_core;
}; };
static inline struct nouveau_framebuffer * static inline struct nouveau_framebuffer *
...@@ -39,7 +41,7 @@ struct nouveau_display { ...@@ -39,7 +41,7 @@ struct nouveau_display {
int (*fb_ctor)(struct drm_framebuffer *); int (*fb_ctor)(struct drm_framebuffer *);
void (*fb_dtor)(struct drm_framebuffer *); void (*fb_dtor)(struct drm_framebuffer *);
struct nouveau_object *core; struct nvif_object disp;
struct drm_property *dithering_mode; struct drm_property *dithering_mode;
struct drm_property *dithering_depth; struct drm_property *dithering_depth;
......
...@@ -84,12 +84,13 @@ void ...@@ -84,12 +84,13 @@ void
nv50_dma_push(struct nouveau_channel *chan, struct nouveau_bo *bo, nv50_dma_push(struct nouveau_channel *chan, struct nouveau_bo *bo,
int delta, int length) int delta, int length)
{ {
struct nouveau_cli *cli = (void *)nvif_client(&chan->device->base);
struct nouveau_bo *pb = chan->push.buffer; struct nouveau_bo *pb = chan->push.buffer;
struct nouveau_vma *vma; struct nouveau_vma *vma;
int ip = (chan->dma.ib_put * 2) + chan->dma.ib_base; int ip = (chan->dma.ib_put * 2) + chan->dma.ib_base;
u64 offset; u64 offset;
vma = nouveau_bo_vma_find(bo, nv_client(chan->cli)->vm); vma = nouveau_bo_vma_find(bo, cli->vm);
BUG_ON(!vma); BUG_ON(!vma);
offset = vma->offset + delta; offset = vma->offset + delta;
......
...@@ -32,9 +32,6 @@ ...@@ -32,9 +32,6 @@
#include <core/class.h> #include <core/class.h>
#include <subdev/gpio.h>
#include <subdev/i2c.h>
static void static void
nouveau_dp_probe_oui(struct drm_device *dev, struct nouveau_i2c_port *auxch, nouveau_dp_probe_oui(struct drm_device *dev, struct nouveau_i2c_port *auxch,
u8 *dpcd) u8 *dpcd)
......
...@@ -30,18 +30,10 @@ ...@@ -30,18 +30,10 @@
#include "drmP.h" #include "drmP.h"
#include "drm_crtc_helper.h" #include "drm_crtc_helper.h"
#include <core/device.h> #include <core/device.h>
#include <core/client.h>
#include <core/gpuobj.h> #include <core/gpuobj.h>
#include <core/class.h> #include <core/class.h>
#include <core/option.h> #include <core/option.h>
#include <engine/device.h>
#include <engine/disp.h>
#include <engine/fifo.h>
#include <engine/software.h>
#include <subdev/vm.h>
#include "nouveau_drm.h" #include "nouveau_drm.h"
#include "nouveau_dma.h" #include "nouveau_dma.h"
#include "nouveau_ttm.h" #include "nouveau_ttm.h"
...@@ -109,40 +101,34 @@ static int ...@@ -109,40 +101,34 @@ static int
nouveau_cli_create(u64 name, const char *sname, nouveau_cli_create(u64 name, const char *sname,
int size, void **pcli) int size, void **pcli)
{ {
struct nouveau_cli *cli; struct nouveau_cli *cli = *pcli = kzalloc(size, GFP_KERNEL);
int ret; if (cli) {
int ret = nvif_client_init(NULL, NULL, sname, name,
*pcli = NULL; nouveau_config, nouveau_debug,
ret = nouveau_client_create_(sname, name, nouveau_config, &cli->base);
nouveau_debug, size, pcli); if (ret == 0)
cli = *pcli; mutex_init(&cli->mutex);
if (ret) {
if (cli)
nouveau_client_destroy(&cli->base);
*pcli = NULL;
return ret; return ret;
} }
return -ENOMEM;
mutex_init(&cli->mutex);
return 0;
} }
static void static void
nouveau_cli_destroy(struct nouveau_cli *cli) nouveau_cli_destroy(struct nouveau_cli *cli)
{ {
struct nouveau_object *client = nv_object(cli); nouveau_vm_ref(NULL, &nvkm_client(&cli->base)->vm, NULL);
nouveau_vm_ref(NULL, &cli->base.vm, NULL); nvif_client_fini(&cli->base);
nouveau_client_fini(&cli->base, false);
atomic_set(&client->refcount, 1);
nouveau_object_ref(NULL, &client);
} }
static void static void
nouveau_accel_fini(struct nouveau_drm *drm) nouveau_accel_fini(struct nouveau_drm *drm)
{ {
nouveau_gpuobj_ref(NULL, &drm->notify);
nouveau_channel_del(&drm->channel); nouveau_channel_del(&drm->channel);
nvif_object_fini(&drm->ntfy);
nouveau_gpuobj_ref(NULL, &drm->notify);
nvif_object_fini(&drm->nvsw);
nouveau_channel_del(&drm->cechan); nouveau_channel_del(&drm->cechan);
nvif_object_fini(&drm->ttm.copy);
if (drm->fence) if (drm->fence)
nouveau_fence(drm)->dtor(drm); nouveau_fence(drm)->dtor(drm);
} }
...@@ -151,7 +137,6 @@ static void ...@@ -151,7 +137,6 @@ static void
nouveau_accel_init(struct nouveau_drm *drm) nouveau_accel_init(struct nouveau_drm *drm)
{ {
struct nvif_device *device = &drm->device; struct nvif_device *device = &drm->device;
struct nouveau_object *object;
u32 arg0, arg1; u32 arg0, arg1;
u32 sclass[16]; u32 sclass[16];
int ret, i; int ret, i;
...@@ -163,8 +148,7 @@ nouveau_accel_init(struct nouveau_drm *drm) ...@@ -163,8 +148,7 @@ nouveau_accel_init(struct nouveau_drm *drm)
/*XXX: this is crap, but the fence/channel stuff is a little /*XXX: this is crap, but the fence/channel stuff is a little
* backwards in some places. this will be fixed. * backwards in some places. this will be fixed.
*/ */
ret = nouveau_parent_lclass(nvkm_object(device), sclass, ret = nvif_object_sclass(&device->base, sclass, ARRAY_SIZE(sclass));
ARRAY_SIZE(sclass));
if (ret < 0) if (ret < 0)
return; return;
...@@ -202,8 +186,7 @@ nouveau_accel_init(struct nouveau_drm *drm) ...@@ -202,8 +186,7 @@ nouveau_accel_init(struct nouveau_drm *drm)
} }
if (device->info.family >= NV_DEVICE_INFO_V0_KEPLER) { if (device->info.family >= NV_DEVICE_INFO_V0_KEPLER) {
ret = nouveau_channel_new(drm, &drm->client, NVDRM_DEVICE, ret = nouveau_channel_new(drm, &drm->device, NVDRM_CHAN + 1,
NVDRM_CHAN + 1,
NVE0_CHANNEL_IND_ENGINE_CE0 | NVE0_CHANNEL_IND_ENGINE_CE0 |
NVE0_CHANNEL_IND_ENGINE_CE1, 0, NVE0_CHANNEL_IND_ENGINE_CE1, 0,
&drm->cechan); &drm->cechan);
...@@ -216,9 +199,8 @@ nouveau_accel_init(struct nouveau_drm *drm) ...@@ -216,9 +199,8 @@ nouveau_accel_init(struct nouveau_drm *drm)
if (device->info.chipset >= 0xa3 && if (device->info.chipset >= 0xa3 &&
device->info.chipset != 0xaa && device->info.chipset != 0xaa &&
device->info.chipset != 0xac) { device->info.chipset != 0xac) {
ret = nouveau_channel_new(drm, &drm->client, NVDRM_DEVICE, ret = nouveau_channel_new(drm, &drm->device, NVDRM_CHAN + 1,
NVDRM_CHAN + 1, NvDmaFB, NvDmaTT, NvDmaFB, NvDmaTT, &drm->cechan);
&drm->cechan);
if (ret) if (ret)
NV_ERROR(drm, "failed to create ce channel, %d\n", ret); NV_ERROR(drm, "failed to create ce channel, %d\n", ret);
...@@ -229,18 +211,18 @@ nouveau_accel_init(struct nouveau_drm *drm) ...@@ -229,18 +211,18 @@ nouveau_accel_init(struct nouveau_drm *drm)
arg1 = NvDmaTT; arg1 = NvDmaTT;
} }
ret = nouveau_channel_new(drm, &drm->client, NVDRM_DEVICE, NVDRM_CHAN, ret = nouveau_channel_new(drm, &drm->device, NVDRM_CHAN, arg0, arg1,
arg0, arg1, &drm->channel); &drm->channel);
if (ret) { if (ret) {
NV_ERROR(drm, "failed to create kernel channel, %d\n", ret); NV_ERROR(drm, "failed to create kernel channel, %d\n", ret);
nouveau_accel_fini(drm); nouveau_accel_fini(drm);
return; return;
} }
ret = nouveau_object_new(nv_object(drm), NVDRM_CHAN, NVDRM_NVSW, ret = nvif_object_init(drm->channel->object, NULL, NVDRM_NVSW,
nouveau_abi16_swclass(drm), NULL, 0, &object); nouveau_abi16_swclass(drm), NULL, 0, &drm->nvsw);
if (ret == 0) { if (ret == 0) {
struct nouveau_software_chan *swch = (void *)object->parent; struct nouveau_software_chan *swch;
ret = RING_SPACE(drm->channel, 2); ret = RING_SPACE(drm->channel, 2);
if (ret == 0) { if (ret == 0) {
if (device->info.family < NV_DEVICE_INFO_V0_FERMI) { if (device->info.family < NV_DEVICE_INFO_V0_FERMI) {
...@@ -252,7 +234,7 @@ nouveau_accel_init(struct nouveau_drm *drm) ...@@ -252,7 +234,7 @@ nouveau_accel_init(struct nouveau_drm *drm)
OUT_RING (drm->channel, 0x001f0000); OUT_RING (drm->channel, 0x001f0000);
} }
} }
swch = (void *)object->parent; swch = (void *)nvkm_object(&drm->nvsw)->parent;
swch->flip = nouveau_flip_complete; swch->flip = nouveau_flip_complete;
swch->flip_data = drm->channel; swch->flip_data = drm->channel;
} }
...@@ -272,15 +254,15 @@ nouveau_accel_init(struct nouveau_drm *drm) ...@@ -272,15 +254,15 @@ nouveau_accel_init(struct nouveau_drm *drm)
return; return;
} }
ret = nouveau_object_new(nv_object(drm), ret = nvif_object_init(drm->channel->object, NULL, NvNotify0,
drm->channel->handle, NvNotify0, NV_DMA_IN_MEMORY_CLASS,
0x003d, &(struct nv_dma_class) { &(struct nv_dma_class) {
.flags = NV_DMA_TARGET_VRAM | .flags = NV_DMA_TARGET_VRAM |
NV_DMA_ACCESS_RDWR, NV_DMA_ACCESS_RDWR,
.start = drm->notify->addr, .start = drm->notify->addr,
.limit = drm->notify->addr + 31 .limit = drm->notify->addr + 31
}, sizeof(struct nv_dma_class), }, sizeof(struct nv_dma_class),
&object); &drm->ntfy);
if (ret) { if (ret) {
nouveau_accel_fini(drm); nouveau_accel_fini(drm);
return; return;
...@@ -373,27 +355,6 @@ nouveau_get_hdmi_dev(struct nouveau_drm *drm) ...@@ -373,27 +355,6 @@ nouveau_get_hdmi_dev(struct nouveau_drm *drm)
} }
} }
void
nouveau_drm_hack_device(struct nouveau_drm *drm, struct nvif_device *device)
{
drm->device.info.chipset = nvkm_device(&drm->device)->chipset;
switch (nvkm_device(&drm->device)->card_type) {
case NV_04: device->info.family = NV_DEVICE_INFO_V0_TNT; break;
case NV_10: device->info.family = NV_DEVICE_INFO_V0_CELSIUS; break;
case NV_11: device->info.family = NV_DEVICE_INFO_V0_CELSIUS; break;
case NV_20: device->info.family = NV_DEVICE_INFO_V0_KELVIN; break;
case NV_30: device->info.family = NV_DEVICE_INFO_V0_RANKINE; break;
case NV_40: device->info.family = NV_DEVICE_INFO_V0_CURIE; break;
case NV_50: device->info.family = NV_DEVICE_INFO_V0_TESLA; break;
case NV_C0: device->info.family = NV_DEVICE_INFO_V0_FERMI; break;
case NV_E0: device->info.family = NV_DEVICE_INFO_V0_KEPLER; break;
case GM100: device->info.family = NV_DEVICE_INFO_V0_MAXWELL; break;
default:
BUG_ON(1);
break;
}
}
static int static int
nouveau_drm_load(struct drm_device *dev, unsigned long flags) nouveau_drm_load(struct drm_device *dev, unsigned long flags)
{ {
...@@ -408,7 +369,8 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -408,7 +369,8 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
dev->dev_private = drm; dev->dev_private = drm;
drm->dev = dev; drm->dev = dev;
nouveau_client(drm)->debug = nouveau_dbgopt(nouveau_debug, "DRM"); nvkm_client(&drm->client.base)->debug =
nouveau_dbgopt(nouveau_debug, "DRM");
INIT_LIST_HEAD(&drm->clients); INIT_LIST_HEAD(&drm->clients);
spin_lock_init(&drm->tile.lock); spin_lock_init(&drm->tile.lock);
...@@ -422,8 +384,8 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -422,8 +384,8 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
/* dummy device object, doesn't init anything, but allows /* dummy device object, doesn't init anything, but allows
* agp code access to registers * agp code access to registers
*/ */
ret = nouveau_object_new(nv_object(drm), NVDRM_CLIENT, ret = nvif_device_init(&drm->client.base.base, NULL,
NVDRM_DEVICE, 0x0080, NVDRM_DEVICE, NV_DEVICE_CLASS,
&(struct nv_device_class) { &(struct nv_device_class) {
.device = ~0, .device = ~0,
.disable = .disable =
...@@ -431,30 +393,25 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -431,30 +393,25 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
NV_DEVICE_DISABLE_IDENTIFY), NV_DEVICE_DISABLE_IDENTIFY),
.debug0 = ~0, .debug0 = ~0,
}, sizeof(struct nv_device_class), }, sizeof(struct nv_device_class),
(struct nouveau_object **) &drm->device);
&drm->device.object);
if (ret) if (ret)
goto fail_device; goto fail_device;
nouveau_drm_hack_device(drm, &drm->device);
nouveau_agp_reset(drm); nouveau_agp_reset(drm);
nouveau_object_del(nv_object(drm), NVDRM_CLIENT, NVDRM_DEVICE); nvif_device_fini(&drm->device);
} }
ret = nouveau_object_new(nv_object(drm), NVDRM_CLIENT, NVDRM_DEVICE, ret = nvif_device_init(&drm->client.base.base, NULL, NVDRM_DEVICE,
0x0080, &(struct nv_device_class) { NV_DEVICE_CLASS,
&(struct nv_device_class) {
.device = ~0, .device = ~0,
.disable = 0, .disable = 0,
.debug0 = 0, .debug0 = 0,
}, sizeof(struct nv_device_class), }, sizeof(struct nv_device_class),
(struct nouveau_object **) &drm->device);
&drm->device.object);
if (ret) if (ret)
goto fail_device; goto fail_device;
nouveau_drm_hack_device(drm, &drm->device);
dev->irq_enabled = true; dev->irq_enabled = true;
/* workaround an odd issue on nvc1 by disabling the device's /* workaround an odd issue on nvc1 by disabling the device's
...@@ -473,7 +430,7 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -473,7 +430,7 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
if (ret) if (ret)
goto fail_device; goto fail_device;
drm->client.base.vm = drm->client.vm; nvkm_client(&drm->client.base)->vm = drm->client.vm;
} }
ret = nouveau_ttm_init(drm); ret = nouveau_ttm_init(drm);
...@@ -519,6 +476,7 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -519,6 +476,7 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
nouveau_agp_fini(drm); nouveau_agp_fini(drm);
nouveau_vga_fini(drm); nouveau_vga_fini(drm);
fail_device: fail_device:
nvif_device_fini(&drm->device);
nouveau_cli_destroy(&drm->client); nouveau_cli_destroy(&drm->client);
return ret; return ret;
} }
...@@ -544,6 +502,7 @@ nouveau_drm_unload(struct drm_device *dev) ...@@ -544,6 +502,7 @@ nouveau_drm_unload(struct drm_device *dev)
nouveau_agp_fini(drm); nouveau_agp_fini(drm);
nouveau_vga_fini(drm); nouveau_vga_fini(drm);
nvif_device_fini(&drm->device);
if (drm->hdmi_device) if (drm->hdmi_device)
pci_dev_put(drm->hdmi_device); pci_dev_put(drm->hdmi_device);
nouveau_cli_destroy(&drm->client); nouveau_cli_destroy(&drm->client);
...@@ -554,10 +513,12 @@ void ...@@ -554,10 +513,12 @@ void
nouveau_drm_device_remove(struct drm_device *dev) nouveau_drm_device_remove(struct drm_device *dev)
{ {
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_client *client;
struct nouveau_object *device; struct nouveau_object *device;
dev->irq_enabled = false; dev->irq_enabled = false;
device = drm->client.base.device; client = nvkm_client(&drm->client.base);
device = client->device;
drm_put_dev(dev); drm_put_dev(dev);
nouveau_object_ref(NULL, &device); nouveau_object_ref(NULL, &device);
...@@ -612,13 +573,13 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime) ...@@ -612,13 +573,13 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime)
} }
list_for_each_entry(cli, &drm->clients, head) { list_for_each_entry(cli, &drm->clients, head) {
ret = nouveau_client_fini(&cli->base, true); ret = nvif_client_suspend(&cli->base);
if (ret) if (ret)
goto fail_client; goto fail_client;
} }
NV_INFO(drm, "suspending kernel object tree...\n"); NV_INFO(drm, "suspending kernel object tree...\n");
ret = nouveau_client_fini(&drm->client.base, true); ret = nvif_client_suspend(&drm->client.base);
if (ret) if (ret)
goto fail_client; goto fail_client;
...@@ -627,7 +588,7 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime) ...@@ -627,7 +588,7 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime)
fail_client: fail_client:
list_for_each_entry_continue_reverse(cli, &drm->clients, head) { list_for_each_entry_continue_reverse(cli, &drm->clients, head) {
nouveau_client_init(&cli->base); nvif_client_resume(&cli->base);
} }
if (drm->fence && nouveau_fence(drm)->resume) if (drm->fence && nouveau_fence(drm)->resume)
...@@ -675,7 +636,7 @@ nouveau_do_resume(struct drm_device *dev) ...@@ -675,7 +636,7 @@ nouveau_do_resume(struct drm_device *dev)
nouveau_agp_reset(drm); nouveau_agp_reset(drm);
NV_INFO(drm, "resuming kernel object tree...\n"); NV_INFO(drm, "resuming kernel object tree...\n");
nouveau_client_init(&drm->client.base); nvif_client_resume(&drm->client.base);
nouveau_agp_init(drm); nouveau_agp_init(drm);
NV_INFO(drm, "resuming client object trees...\n"); NV_INFO(drm, "resuming client object trees...\n");
...@@ -683,7 +644,7 @@ nouveau_do_resume(struct drm_device *dev) ...@@ -683,7 +644,7 @@ nouveau_do_resume(struct drm_device *dev)
nouveau_fence(drm)->resume(drm); nouveau_fence(drm)->resume(drm);
list_for_each_entry(cli, &drm->clients, head) { list_for_each_entry(cli, &drm->clients, head) {
nouveau_client_init(&cli->base); nvif_client_resume(&cli->base);
} }
nouveau_run_vbios_init(dev); nouveau_run_vbios_init(dev);
...@@ -779,6 +740,8 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv) ...@@ -779,6 +740,8 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv)
if (ret) if (ret)
goto out_suspend; goto out_suspend;
cli->base.super = false;
if (drm->device.info.family >= NV_DEVICE_INFO_V0_TESLA) { if (drm->device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
ret = nouveau_vm_new(nvkm_device(&drm->device), 0, (1ULL << 40), ret = nouveau_vm_new(nvkm_device(&drm->device), 0, (1ULL << 40),
0x1000, &cli->vm); 0x1000, &cli->vm);
...@@ -787,7 +750,7 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv) ...@@ -787,7 +750,7 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv)
goto out_suspend; goto out_suspend;
} }
cli->base.vm = cli->vm; nvkm_client(&cli->base)->vm = cli->vm;
} }
fpriv->driver_priv = cli; fpriv->driver_priv = cli;
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#include <core/client.h> #include <core/client.h>
#include <core/event.h> #include <core/event.h>
#include <nvif/client.h>
#include <nvif/device.h>
#include <subdev/vm.h> #include <subdev/vm.h>
#include <drmP.h> #include <drmP.h>
...@@ -53,6 +56,17 @@ struct nouveau_drm_tile { ...@@ -53,6 +56,17 @@ struct nouveau_drm_tile {
bool used; bool used;
}; };
enum nouveau_drm_object_route {
NVDRM_OBJECT_NVIF = 0,
NVDRM_OBJECT_USIF,
NVDRM_OBJECT_ABI16,
};
enum nouveau_drm_notify_route {
NVDRM_NOTIFY_NVIF = 0,
NVDRM_NOTIFY_USIF
};
enum nouveau_drm_handle { enum nouveau_drm_handle {
NVDRM_CLIENT = 0xffffffff, NVDRM_CLIENT = 0xffffffff,
NVDRM_DEVICE = 0xdddddddd, NVDRM_DEVICE = 0xdddddddd,
...@@ -64,7 +78,7 @@ enum nouveau_drm_handle { ...@@ -64,7 +78,7 @@ enum nouveau_drm_handle {
}; };
struct nouveau_cli { struct nouveau_cli {
struct nouveau_client base; struct nvif_client base;
struct nouveau_vm *vm; /*XXX*/ struct nouveau_vm *vm; /*XXX*/
struct list_head head; struct list_head head;
struct mutex mutex; struct mutex mutex;
...@@ -78,31 +92,6 @@ nouveau_cli(struct drm_file *fpriv) ...@@ -78,31 +92,6 @@ nouveau_cli(struct drm_file *fpriv)
} }
#include <nvif/object.h> #include <nvif/object.h>
#undef nvif_object
#undef nvif_rd08
#undef nvif_rd16
#undef nvif_rd32
#undef nvif_wr08
#undef nvif_wr16
#undef nvif_wr32
#undef nvif_mask
#undef nvkm_object
#undef nvif_exec
#define nvif_object(a) ({ \
struct nvif_object *_object = (a)->object; \
(struct nouveau_object *)_object; \
})
#define nvif_rd08(a,b) nv_ro08(nvif_object(a), (b))
#define nvif_rd16(a,b) nv_ro16(nvif_object(a), (b))
#define nvif_rd32(a,b) nv_ro32(nvif_object(a), (b))
#define nvif_wr08(a,b,c) nv_wo08(nvif_object(a), (b), (c))
#define nvif_wr16(a,b,c) nv_wo16(nvif_object(a), (b), (c))
#define nvif_wr32(a,b,c) nv_wo32(nvif_object(a), (b), (c))
#define nvif_mask(a,b,c,d) nv_mo32(nvif_object(a), (b), (c), (d))
#define nvkm_object(a) nvif_object(a)
#define nvif_exec(a,b,c,d) nv_exec(nvkm_object(a), (b), (c), (d))
#include <nvif/device.h> #include <nvif/device.h>
extern int nouveau_runtime_pm; extern int nouveau_runtime_pm;
...@@ -134,6 +123,7 @@ struct nouveau_drm { ...@@ -134,6 +123,7 @@ struct nouveau_drm {
struct ttm_buffer_object *, struct ttm_buffer_object *,
struct ttm_mem_reg *, struct ttm_mem_reg *); struct ttm_mem_reg *, struct ttm_mem_reg *);
struct nouveau_channel *chan; struct nouveau_channel *chan;
struct nvif_object copy;
int mtrr; int mtrr;
} ttm; } ttm;
...@@ -151,6 +141,8 @@ struct nouveau_drm { ...@@ -151,6 +141,8 @@ struct nouveau_drm {
struct nouveau_channel *channel; struct nouveau_channel *channel;
struct nouveau_gpuobj *notify; struct nouveau_gpuobj *notify;
struct nouveau_fbdev *fbcon; struct nouveau_fbdev *fbcon;
struct nvif_object nvsw;
struct nvif_object ntfy;
/* nv10-nv40 tiling regions */ /* nv10-nv40 tiling regions */
struct { struct {
...@@ -192,7 +184,7 @@ void nouveau_drm_device_remove(struct drm_device *dev); ...@@ -192,7 +184,7 @@ void nouveau_drm_device_remove(struct drm_device *dev);
#define NV_PRINTK(l,c,f,a...) do { \ #define NV_PRINTK(l,c,f,a...) do { \
struct nouveau_cli *_cli = (c); \ struct nouveau_cli *_cli = (c); \
nv_##l(_cli, f, ##a); \ nv_##l(_cli->base.base.priv, f, ##a); \
} while(0) } while(0)
#define NV_FATAL(drm,f,a...) NV_PRINTK(fatal, &(drm)->client, f, ##a) #define NV_FATAL(drm,f,a...) NV_PRINTK(fatal, &(drm)->client, f, ##a)
#define NV_ERROR(drm,f,a...) NV_PRINTK(error, &(drm)->client, f, ##a) #define NV_ERROR(drm,f,a...) NV_PRINTK(error, &(drm)->client, f, ##a)
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
#include <core/client.h> #include <core/client.h>
#include <core/device.h> #include <core/device.h>
#include <subdev/fb.h>
MODULE_PARM_DESC(nofbaccel, "Disable fbcon acceleration"); MODULE_PARM_DESC(nofbaccel, "Disable fbcon acceleration");
static int nouveau_nofbaccel = 0; static int nouveau_nofbaccel = 0;
module_param_named(nofbaccel, nouveau_nofbaccel, int, 0400); module_param_named(nofbaccel, nouveau_nofbaccel, int, 0400);
...@@ -241,6 +239,13 @@ nouveau_fbcon_accel_fini(struct drm_device *dev) ...@@ -241,6 +239,13 @@ nouveau_fbcon_accel_fini(struct drm_device *dev)
fbcon->helper.fbdev->flags |= FBINFO_HWACCEL_DISABLED; fbcon->helper.fbdev->flags |= FBINFO_HWACCEL_DISABLED;
console_unlock(); console_unlock();
nouveau_channel_idle(drm->channel); nouveau_channel_idle(drm->channel);
nvif_object_fini(&fbcon->twod);
nvif_object_fini(&fbcon->blit);
nvif_object_fini(&fbcon->gdi);
nvif_object_fini(&fbcon->patt);
nvif_object_fini(&fbcon->rop);
nvif_object_fini(&fbcon->clip);
nvif_object_fini(&fbcon->surf2d);
} }
} }
...@@ -352,7 +357,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, ...@@ -352,7 +357,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
chan = nouveau_nofbaccel ? NULL : drm->channel; chan = nouveau_nofbaccel ? NULL : drm->channel;
if (chan && device->info.family >= NV_DEVICE_INFO_V0_TESLA) { if (chan && device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
ret = nouveau_bo_vma_add(nvbo, nv_client(chan->cli)->vm, ret = nouveau_bo_vma_add(nvbo, drm->client.vm,
&fbcon->nouveau_fb.vma); &fbcon->nouveau_fb.vma);
if (ret) { if (ret) {
NV_ERROR(drm, "failed to map fb into chan: %d\n", ret); NV_ERROR(drm, "failed to map fb into chan: %d\n", ret);
......
...@@ -37,6 +37,13 @@ struct nouveau_fbdev { ...@@ -37,6 +37,13 @@ struct nouveau_fbdev {
struct list_head fbdev_list; struct list_head fbdev_list;
struct drm_device *dev; struct drm_device *dev;
unsigned int saved_flags; unsigned int saved_flags;
struct nvif_object surf2d;
struct nvif_object clip;
struct nvif_object rop;
struct nvif_object patt;
struct nvif_object gdi;
struct nvif_object blit;
struct nvif_object twod;
}; };
void nouveau_fbcon_restore(void); void nouveau_fbcon_restore(void);
......
...@@ -33,8 +33,6 @@ ...@@ -33,8 +33,6 @@
#include "nouveau_dma.h" #include "nouveau_dma.h"
#include "nouveau_fence.h" #include "nouveau_fence.h"
#include <engine/fifo.h>
struct fence_work { struct fence_work {
struct work_struct base; struct work_struct base;
struct list_head head; struct list_head head;
...@@ -184,7 +182,7 @@ nouveau_fence_wait_uevent(struct nouveau_fence *fence, bool intr) ...@@ -184,7 +182,7 @@ nouveau_fence_wait_uevent(struct nouveau_fence *fence, bool intr)
{ {
struct nouveau_channel *chan = fence->channel; struct nouveau_channel *chan = fence->channel;
struct nouveau_fifo *pfifo = nvkm_fifo(&chan->drm->device); struct nouveau_fifo *pfifo = nvkm_fifo(chan->device);
struct nouveau_fence_priv *priv = chan->drm->fence; struct nouveau_fence_priv *priv = chan->drm->fence;
struct nouveau_fence_wait wait = { .priv = priv }; struct nouveau_fence_wait wait = { .priv = priv };
int ret = 0; int ret = 0;
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
* *
*/ */
#include <subdev/fb.h>
#include "nouveau_drm.h" #include "nouveau_drm.h"
#include "nouveau_dma.h" #include "nouveau_dma.h"
#include "nouveau_fence.h" #include "nouveau_fence.h"
...@@ -696,7 +694,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, ...@@ -696,7 +694,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
return -ENOMEM; return -ENOMEM;
list_for_each_entry(temp, &abi16->channels, head) { list_for_each_entry(temp, &abi16->channels, head) {
if (temp->chan->handle == (NVDRM_CHAN | req->channel)) { if (temp->chan->object->handle == (NVDRM_CHAN | req->channel)) {
chan = temp->chan; chan = temp->chan;
break; break;
} }
......
...@@ -34,10 +34,6 @@ ...@@ -34,10 +34,6 @@
#include "nouveau_drm.h" #include "nouveau_drm.h"
#include "nouveau_hwmon.h" #include "nouveau_hwmon.h"
#include <subdev/gpio.h>
#include <subdev/timer.h>
#include <subdev/therm.h>
#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE)) #if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
static ssize_t static ssize_t
nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf) nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf)
......
/*
* Copyright 2014 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs <bskeggs@redhat.com>
*/
/*******************************************************************************
* NVIF client driver - NVKM directly linked
******************************************************************************/
#include <core/client.h>
#include <core/notify.h>
#include <core/ioctl.h>
#include <nvif/client.h>
#include <nvif/driver.h>
#include <nvif/notify.h>
#include <nvif/event.h>
#include <nvif/ioctl.h>
#include "nouveau_drm.h"
static void
nvkm_client_unmap(void *priv, void *ptr, u32 size)
{
iounmap(ptr);
}
static void *
nvkm_client_map(void *priv, u64 handle, u32 size)
{
return ioremap(handle, size);
}
static int
nvkm_client_ioctl(void *priv, bool super, void *data, u32 size, void **hack)
{
return nvkm_ioctl(priv, super, data, size, hack);
}
static int
nvkm_client_resume(void *priv)
{
return nouveau_client_init(priv);
}
static int
nvkm_client_suspend(void *priv)
{
return nouveau_client_fini(priv, true);
}
static void
nvkm_client_fini(void *priv)
{
struct nouveau_object *client = priv;
nouveau_client_fini(nv_client(client), false);
atomic_set(&client->refcount, 1);
nouveau_object_ref(NULL, &client);
}
static int
nvkm_client_ntfy(const void *header, u32 length, const void *data, u32 size)
{
const union {
struct nvif_notify_req_v0 v0;
} *args = header;
u8 route;
if (length == sizeof(args->v0) && args->v0.version == 0) {
route = args->v0.route;
} else {
WARN_ON(1);
return NVKM_NOTIFY_DROP;
}
switch (route) {
case NVDRM_NOTIFY_NVIF:
return nvif_notify(header, length, data, size);
default:
WARN_ON(1);
break;
}
return NVKM_NOTIFY_DROP;
}
static int
nvkm_client_init(const char *name, u64 device, const char *cfg,
const char *dbg, void **ppriv)
{
struct nouveau_client *client;
int ret;
ret = nouveau_client_create(name, device, cfg, dbg, &client);
*ppriv = client;
if (ret)
return ret;
client->ntfy = nvkm_client_ntfy;
return 0;
}
const struct nvif_driver
nvif_driver_nvkm = {
.name = "nvkm",
.init = nvkm_client_init,
.fini = nvkm_client_fini,
.suspend = nvkm_client_suspend,
.resume = nvkm_client_resume,
.ioctl = nvkm_client_ioctl,
.map = nvkm_client_map,
.unmap = nvkm_client_unmap,
.keep = false,
};
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <subdev/fb.h>
#include "nouveau_drm.h" #include "nouveau_drm.h"
#include "nouveau_ttm.h" #include "nouveau_ttm.h"
......
...@@ -48,7 +48,8 @@ nouveau_sysfs_pstate_get(struct device *d, struct device_attribute *a, char *b) ...@@ -48,7 +48,8 @@ nouveau_sysfs_pstate_get(struct device *d, struct device_attribute *a, char *b)
char *buf = b; char *buf = b;
int ret, i; int ret, i;
ret = nv_exec(sysfs->ctrl, NV_CONTROL_PSTATE_INFO, &info, sizeof(info)); ret = nvif_exec(&sysfs->ctrl, NV_CONTROL_PSTATE_INFO,
&info, sizeof(info));
if (ret) if (ret)
return ret; return ret;
...@@ -60,7 +61,7 @@ nouveau_sysfs_pstate_get(struct device *d, struct device_attribute *a, char *b) ...@@ -60,7 +61,7 @@ nouveau_sysfs_pstate_get(struct device *d, struct device_attribute *a, char *b)
.index = 0, .index = 0,
}; };
ret = nv_exec(sysfs->ctrl, NV_CONTROL_PSTATE_ATTR, ret = nvif_exec(&sysfs->ctrl, NV_CONTROL_PSTATE_ATTR,
&attr, sizeof(attr)); &attr, sizeof(attr));
if (ret) if (ret)
return ret; return ret;
...@@ -75,7 +76,7 @@ nouveau_sysfs_pstate_get(struct device *d, struct device_attribute *a, char *b) ...@@ -75,7 +76,7 @@ nouveau_sysfs_pstate_get(struct device *d, struct device_attribute *a, char *b)
attr.index = 0; attr.index = 0;
do { do {
attr.state = state; attr.state = state;
ret = nv_exec(sysfs->ctrl, NV_CONTROL_PSTATE_ATTR, ret = nvif_exec(&sysfs->ctrl, NV_CONTROL_PSTATE_ATTR,
&attr, sizeof(attr)); &attr, sizeof(attr));
if (ret) if (ret)
return ret; return ret;
...@@ -139,7 +140,8 @@ nouveau_sysfs_pstate_set(struct device *d, struct device_attribute *a, ...@@ -139,7 +140,8 @@ nouveau_sysfs_pstate_set(struct device *d, struct device_attribute *a,
args.ustate = value; args.ustate = value;
} }
ret = nv_exec(sysfs->ctrl, NV_CONTROL_PSTATE_USER, &args, sizeof(args)); ret = nvif_exec(&sysfs->ctrl, NV_CONTROL_PSTATE_USER,
&args, sizeof(args));
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -156,9 +158,9 @@ nouveau_sysfs_fini(struct drm_device *dev) ...@@ -156,9 +158,9 @@ nouveau_sysfs_fini(struct drm_device *dev)
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nvif_device *device = &drm->device; struct nvif_device *device = &drm->device;
if (sysfs->ctrl) { if (sysfs->ctrl.priv) {
device_remove_file(nv_device_base(nvkm_device(device)), &dev_attr_pstate); device_remove_file(nv_device_base(nvkm_device(device)), &dev_attr_pstate);
nouveau_object_del(nv_object(drm), NVDRM_DEVICE, NVDRM_CONTROL); nvif_object_fini(&sysfs->ctrl);
} }
drm->sysfs = NULL; drm->sysfs = NULL;
...@@ -177,7 +179,7 @@ nouveau_sysfs_init(struct drm_device *dev) ...@@ -177,7 +179,7 @@ nouveau_sysfs_init(struct drm_device *dev)
if (!sysfs) if (!sysfs)
return -ENOMEM; return -ENOMEM;
ret = nouveau_object_new(nv_object(drm), NVDRM_DEVICE, NVDRM_CONTROL, ret = nvif_object_init(nvif_object(&drm->device), NULL, NVDRM_CONTROL,
NV_CONTROL_CLASS, NULL, 0, &sysfs->ctrl); NV_CONTROL_CLASS, NULL, 0, &sysfs->ctrl);
if (ret == 0) if (ret == 0)
device_create_file(nv_device_base(nvkm_device(device)), &dev_attr_pstate); device_create_file(nv_device_base(nvkm_device(device)), &dev_attr_pstate);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "nouveau_drm.h" #include "nouveau_drm.h"
struct nouveau_sysfs { struct nouveau_sysfs {
struct nouveau_object *ctrl; struct nvif_object ctrl;
}; };
static inline struct nouveau_sysfs * static inline struct nouveau_sysfs *
......
...@@ -24,10 +24,6 @@ ...@@ -24,10 +24,6 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. * USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <subdev/fb.h>
#include <subdev/vm.h>
#include <subdev/instmem.h>
#include "nouveau_drm.h" #include "nouveau_drm.h"
#include "nouveau_ttm.h" #include "nouveau_ttm.h"
#include "nouveau_gem.h" #include "nouveau_gem.h"
......
...@@ -142,7 +142,6 @@ nv04_fbcon_accel_init(struct fb_info *info) ...@@ -142,7 +142,6 @@ nv04_fbcon_accel_init(struct fb_info *info)
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
struct nvif_device *device = &drm->device; struct nvif_device *device = &drm->device;
struct nouveau_object *object;
int surface_fmt, pattern_fmt, rect_fmt; int surface_fmt, pattern_fmt, rect_fmt;
int ret; int ret;
...@@ -174,35 +173,35 @@ nv04_fbcon_accel_init(struct fb_info *info) ...@@ -174,35 +173,35 @@ nv04_fbcon_accel_init(struct fb_info *info)
return -EINVAL; return -EINVAL;
} }
ret = nouveau_object_new(nv_object(chan->cli), NVDRM_CHAN, NvCtxSurf2D, ret = nvif_object_init(chan->object, NULL, NvCtxSurf2D,
device->info.family >= NV_DEVICE_INFO_V0_CELSIUS ? 0x0062 : 0x0042, device->info.family >= NV_DEVICE_INFO_V0_CELSIUS ?
NULL, 0, &object); 0x0062 : 0x0042, NULL, 0, &nfbdev->surf2d);
if (ret) if (ret)
return ret; return ret;
ret = nouveau_object_new(nv_object(chan->cli), NVDRM_CHAN, NvClipRect, ret = nvif_object_init(chan->object, NULL, NvClipRect, 0x0019, NULL, 0,
0x0019, NULL, 0, &object); &nfbdev->clip);
if (ret) if (ret)
return ret; return ret;
ret = nouveau_object_new(nv_object(chan->cli), NVDRM_CHAN, NvRop, ret = nvif_object_init(chan->object, NULL, NvRop, 0x0043, NULL, 0,
0x0043, NULL, 0, &object); &nfbdev->rop);
if (ret) if (ret)
return ret; return ret;
ret = nouveau_object_new(nv_object(chan->cli), NVDRM_CHAN, NvImagePatt, ret = nvif_object_init(chan->object, NULL, NvImagePatt, 0x0044, NULL, 0,
0x0044, NULL, 0, &object); &nfbdev->patt);
if (ret) if (ret)
return ret; return ret;
ret = nouveau_object_new(nv_object(chan->cli), NVDRM_CHAN, NvGdiRect, ret = nvif_object_init(chan->object, NULL, NvGdiRect, 0x004a, NULL, 0,
0x004a, NULL, 0, &object); &nfbdev->gdi);
if (ret) if (ret)
return ret; return ret;
ret = nouveau_object_new(nv_object(chan->cli), NVDRM_CHAN, NvImageBlit, ret = nvif_object_init(chan->object, NULL, NvImageBlit,
device->info.chipset >= 0x11 ? 0x009f : 0x005f, device->info.chipset >= 0x11 ? 0x009f : 0x005f,
NULL, 0, &object); NULL, 0, &nfbdev->blit);
if (ret) if (ret)
return ret; return ret;
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include <engine/fifo.h>
#include "nouveau_drm.h" #include "nouveau_drm.h"
#include "nouveau_dma.h" #include "nouveau_dma.h"
#include "nouveau_fence.h" #include "nouveau_fence.h"
......
...@@ -60,7 +60,11 @@ void ...@@ -60,7 +60,11 @@ void
nv10_fence_context_del(struct nouveau_channel *chan) nv10_fence_context_del(struct nouveau_channel *chan)
{ {
struct nv10_fence_chan *fctx = chan->fence; struct nv10_fence_chan *fctx = chan->fence;
int i;
nouveau_fence_context_del(&fctx->base); nouveau_fence_context_del(&fctx->base);
for (i = 0; i < ARRAY_SIZE(fctx->head); i++)
nvif_object_fini(&fctx->head[i]);
nvif_object_fini(&fctx->sema);
chan->fence = NULL; chan->fence = NULL;
kfree(fctx); kfree(fctx);
} }
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
struct nv10_fence_chan { struct nv10_fence_chan {
struct nouveau_fence_chan base; struct nouveau_fence_chan base;
struct nvif_object sema;
struct nvif_object head[4];
}; };
struct nv10_fence_priv { struct nv10_fence_priv {
......
...@@ -33,11 +33,12 @@ int ...@@ -33,11 +33,12 @@ int
nv17_fence_sync(struct nouveau_fence *fence, nv17_fence_sync(struct nouveau_fence *fence,
struct nouveau_channel *prev, struct nouveau_channel *chan) struct nouveau_channel *prev, struct nouveau_channel *chan)
{ {
struct nouveau_cli *cli = (void *)nvif_client(&prev->device->base);
struct nv10_fence_priv *priv = chan->drm->fence; struct nv10_fence_priv *priv = chan->drm->fence;
u32 value; u32 value;
int ret; int ret;
if (!mutex_trylock(&prev->cli->mutex)) if (!mutex_trylock(&cli->mutex))
return -EBUSY; return -EBUSY;
spin_lock(&priv->lock); spin_lock(&priv->lock);
...@@ -64,7 +65,7 @@ nv17_fence_sync(struct nouveau_fence *fence, ...@@ -64,7 +65,7 @@ nv17_fence_sync(struct nouveau_fence *fence,
FIRE_RING (chan); FIRE_RING (chan);
} }
mutex_unlock(&prev->cli->mutex); mutex_unlock(&cli->mutex);
return 0; return 0;
} }
...@@ -74,7 +75,6 @@ nv17_fence_context_new(struct nouveau_channel *chan) ...@@ -74,7 +75,6 @@ nv17_fence_context_new(struct nouveau_channel *chan)
struct nv10_fence_priv *priv = chan->drm->fence; struct nv10_fence_priv *priv = chan->drm->fence;
struct nv10_fence_chan *fctx; struct nv10_fence_chan *fctx;
struct ttm_mem_reg *mem = &priv->bo->bo.mem; struct ttm_mem_reg *mem = &priv->bo->bo.mem;
struct nouveau_object *object;
u32 start = mem->start * PAGE_SIZE; u32 start = mem->start * PAGE_SIZE;
u32 limit = start + mem->size - 1; u32 limit = start + mem->size - 1;
int ret = 0; int ret = 0;
...@@ -88,15 +88,15 @@ nv17_fence_context_new(struct nouveau_channel *chan) ...@@ -88,15 +88,15 @@ nv17_fence_context_new(struct nouveau_channel *chan)
fctx->base.read = nv10_fence_read; fctx->base.read = nv10_fence_read;
fctx->base.sync = nv17_fence_sync; fctx->base.sync = nv17_fence_sync;
ret = nouveau_object_new(nv_object(chan->cli), chan->handle, ret = nvif_object_init(chan->object, NULL, NvSema,
NvSema, 0x0002, NV_DMA_FROM_MEMORY_CLASS,
&(struct nv_dma_class) { &(struct nv_dma_class) {
.flags = NV_DMA_TARGET_VRAM | .flags = NV_DMA_TARGET_VRAM |
NV_DMA_ACCESS_RDWR, NV_DMA_ACCESS_RDWR,
.start = start, .start = start,
.limit = limit, .limit = limit,
}, sizeof(struct nv_dma_class), }, sizeof(struct nv_dma_class),
&object); &fctx->sema);
if (ret) if (ret)
nv10_fence_context_del(chan); nv10_fence_context_del(chan);
return ret; return ret;
......
...@@ -37,15 +37,8 @@ ...@@ -37,15 +37,8 @@
#include "nouveau_fence.h" #include "nouveau_fence.h"
#include "nv50_display.h" #include "nv50_display.h"
#include <core/client.h>
#include <core/gpuobj.h>
#include <core/class.h> #include <core/class.h>
#include <subdev/timer.h>
#include <subdev/bar.h>
#include <subdev/fb.h>
#include <subdev/i2c.h>
#define EVO_DMA_NR 9 #define EVO_DMA_NR 9
#define EVO_MASTER (0x00) #define EVO_MASTER (0x00)
...@@ -62,7 +55,7 @@ ...@@ -62,7 +55,7 @@
#define EVO_CORE_HANDLE (0xd1500000) #define EVO_CORE_HANDLE (0xd1500000)
#define EVO_CHAN_HANDLE(t,i) (0xd15c0000 | (((t) & 0x00ff) << 8) | (i)) #define EVO_CHAN_HANDLE(t,i) (0xd15c0000 | (((t) & 0x00ff) << 8) | (i))
#define EVO_CHAN_OCLASS(t,c) ((nv_hclass(c) & 0xff00) | ((t) & 0x00ff)) #define EVO_CHAN_OCLASS(t,c) (((c)->oclass & 0xff00) | ((t) & 0x00ff))
#define EVO_PUSH_HANDLE(t,i) (0xd15b0000 | (i) | \ #define EVO_PUSH_HANDLE(t,i) (0xd15b0000 | (i) | \
(((NV50_DISP_##t##_CLASS) & 0x00ff) << 8)) (((NV50_DISP_##t##_CLASS) & 0x00ff) << 8))
...@@ -71,34 +64,29 @@ ...@@ -71,34 +64,29 @@
*****************************************************************************/ *****************************************************************************/
struct nv50_chan { struct nv50_chan {
struct nouveau_object *user; struct nvif_object user;
u32 handle;
}; };
static int static int
nv50_chan_create(struct nouveau_object *core, u32 bclass, u8 head, nv50_chan_create(struct nvif_object *disp, u32 bclass, u8 head,
void *data, u32 size, struct nv50_chan *chan) void *data, u32 size, struct nv50_chan *chan)
{ {
struct nouveau_object *client = nv_pclass(core, NV_CLIENT_CLASS); const u32 oclass = EVO_CHAN_OCLASS(bclass, disp);
const u32 oclass = EVO_CHAN_OCLASS(bclass, core);
const u32 handle = EVO_CHAN_HANDLE(bclass, head); const u32 handle = EVO_CHAN_HANDLE(bclass, head);
int ret; int ret;
ret = nouveau_object_new(client, EVO_CORE_HANDLE, handle, ret = nvif_object_init(disp, NULL, handle, oclass, data, size,
oclass, data, size, &chan->user); &chan->user);
if (ret) if (ret)
return ret; return ret;
chan->handle = handle;
return 0; return 0;
} }
static void static void
nv50_chan_destroy(struct nouveau_object *core, struct nv50_chan *chan) nv50_chan_destroy(struct nv50_chan *chan)
{ {
struct nouveau_object *client = nv_pclass(core, NV_CLIENT_CLASS); nvif_object_fini(&chan->user);
if (chan->handle)
nouveau_object_del(client, EVO_CORE_HANDLE, chan->handle);
} }
/****************************************************************************** /******************************************************************************
...@@ -110,16 +98,16 @@ struct nv50_pioc { ...@@ -110,16 +98,16 @@ struct nv50_pioc {
}; };
static void static void
nv50_pioc_destroy(struct nouveau_object *core, struct nv50_pioc *pioc) nv50_pioc_destroy(struct nv50_pioc *pioc)
{ {
nv50_chan_destroy(core, &pioc->base); nv50_chan_destroy(&pioc->base);
} }
static int static int
nv50_pioc_create(struct nouveau_object *core, u32 bclass, u8 head, nv50_pioc_create(struct nvif_object *disp, u32 bclass, u8 head,
void *data, u32 size, struct nv50_pioc *pioc) void *data, u32 size, struct nv50_pioc *pioc)
{ {
return nv50_chan_create(core, bclass, head, data, size, &pioc->base); return nv50_chan_create(disp, bclass, head, data, size, &pioc->base);
} }
/****************************************************************************** /******************************************************************************
...@@ -131,6 +119,9 @@ struct nv50_dmac { ...@@ -131,6 +119,9 @@ struct nv50_dmac {
dma_addr_t handle; dma_addr_t handle;
u32 *ptr; u32 *ptr;
struct nvif_object sync;
struct nvif_object vram;
/* Protects against concurrent pushbuf access to this channel, lock is /* Protects against concurrent pushbuf access to this channel, lock is
* grabbed by evo_wait (if the pushbuf reservation is successful) and * grabbed by evo_wait (if the pushbuf reservation is successful) and
* dropped again by evo_kick. */ * dropped again by evo_kick. */
...@@ -138,68 +129,73 @@ struct nv50_dmac { ...@@ -138,68 +129,73 @@ struct nv50_dmac {
}; };
static void static void
nv50_dmac_destroy(struct nouveau_object *core, struct nv50_dmac *dmac) nv50_dmac_destroy(struct nv50_dmac *dmac, struct nvif_object *disp)
{ {
nvif_object_fini(&dmac->vram);
nvif_object_fini(&dmac->sync);
nv50_chan_destroy(&dmac->base);
if (dmac->ptr) { if (dmac->ptr) {
struct pci_dev *pdev = nv_device(core)->pdev; struct pci_dev *pdev = nvkm_device(nvif_device(disp))->pdev;
pci_free_consistent(pdev, PAGE_SIZE, dmac->ptr, dmac->handle); pci_free_consistent(pdev, PAGE_SIZE, dmac->ptr, dmac->handle);
} }
nv50_chan_destroy(core, &dmac->base);
} }
static int static int
nv50_dmac_create(struct nouveau_object *core, u32 bclass, u8 head, nv50_dmac_create(struct nvif_object *disp, u32 bclass, u8 head,
void *data, u32 size, u64 syncbuf, void *data, u32 size, u64 syncbuf,
struct nv50_dmac *dmac) struct nv50_dmac *dmac)
{ {
struct nouveau_fb *pfb = nouveau_fb(core); struct nouveau_fb *pfb = nvkm_fb(nvif_device(disp));
struct nouveau_object *client = nv_pclass(core, NV_CLIENT_CLASS); struct nvif_object pushbuf;
struct nouveau_object *object; u32 handle = *(u32 *)data;
u32 pushbuf = *(u32 *)data;
int ret; int ret;
mutex_init(&dmac->lock); mutex_init(&dmac->lock);
dmac->ptr = pci_alloc_consistent(nv_device(core)->pdev, PAGE_SIZE, dmac->ptr = pci_alloc_consistent(nvkm_device(nvif_device(disp))->pdev,
&dmac->handle); PAGE_SIZE, &dmac->handle);
if (!dmac->ptr) if (!dmac->ptr)
return -ENOMEM; return -ENOMEM;
ret = nouveau_object_new(client, NVDRM_DEVICE, pushbuf, ret = nvif_object_init(nvif_object(nvif_device(disp)), NULL, handle,
NV_DMA_FROM_MEMORY_CLASS, NV_DMA_FROM_MEMORY_CLASS,
&(struct nv_dma_class) { &(struct nv_dma_class) {
.flags = NV_DMA_TARGET_PCI_US | .flags = NV_DMA_TARGET_PCI_US |
NV_DMA_ACCESS_RD, NV_DMA_ACCESS_RD,
.start = dmac->handle + 0x0000, .start = dmac->handle + 0x0000,
.limit = dmac->handle + 0x0fff, .limit = dmac->handle + 0x0fff,
}, sizeof(struct nv_dma_class), &object); }, sizeof(struct nv_dma_class), &pushbuf);
if (ret) if (ret)
return ret; return ret;
ret = nv50_chan_create(core, bclass, head, data, size, &dmac->base); ret = nv50_chan_create(disp, bclass, head, data, size, &dmac->base);
nvif_object_fini(&pushbuf);
if (ret) if (ret)
return ret; return ret;
ret = nouveau_object_new(client, dmac->base.handle, NvEvoSync, ret = nvif_object_init(&dmac->base.user, NULL, NvEvoSync,
NV_DMA_IN_MEMORY_CLASS, NV_DMA_IN_MEMORY_CLASS,
&(struct nv_dma_class) { &(struct nv_dma_class) {
.flags = NV_DMA_TARGET_VRAM | .flags = NV_DMA_TARGET_VRAM |
NV_DMA_ACCESS_RDWR, NV_DMA_ACCESS_RDWR,
.start = syncbuf + 0x0000, .start = syncbuf + 0x0000,
.limit = syncbuf + 0x0fff, .limit = syncbuf + 0x0fff,
}, sizeof(struct nv_dma_class), &object); }, sizeof(struct nv_dma_class),
&dmac->sync);
if (ret) if (ret)
return ret; return ret;
ret = nouveau_object_new(client, dmac->base.handle, NvEvoVRAM, ret = nvif_object_init(&dmac->base.user, NULL, NvEvoVRAM,
NV_DMA_IN_MEMORY_CLASS, NV_DMA_IN_MEMORY_CLASS,
&(struct nv_dma_class) { &(struct nv_dma_class) {
.flags = NV_DMA_TARGET_VRAM | .flags = NV_DMA_TARGET_VRAM |
NV_DMA_ACCESS_RDWR, NV_DMA_ACCESS_RDWR,
.start = 0, .start = 0,
.limit = pfb->ram->size - 1, .limit = pfb->ram->size - 1,
}, sizeof(struct nv_dma_class), &object); }, sizeof(struct nv_dma_class),
&dmac->vram);
if (ret) if (ret)
return ret; return ret;
...@@ -243,10 +239,16 @@ struct nv50_head { ...@@ -243,10 +239,16 @@ struct nv50_head {
#define nv50_ovly(c) (&nv50_head(c)->ovly) #define nv50_ovly(c) (&nv50_head(c)->ovly)
#define nv50_oimm(c) (&nv50_head(c)->oimm) #define nv50_oimm(c) (&nv50_head(c)->oimm)
#define nv50_chan(c) (&(c)->base.base) #define nv50_chan(c) (&(c)->base.base)
#define nv50_vers(c) nv_mclass(nv50_chan(c)->user) #define nv50_vers(c) nv50_chan(c)->user.oclass
struct nv50_fbdma {
struct list_head head;
struct nvif_object core;
struct nvif_object base[4];
};
struct nv50_disp { struct nv50_disp {
struct nouveau_object *core; struct nvif_object *disp;
struct nv50_mast mast; struct nv50_mast mast;
struct list_head fbdma; struct list_head fbdma;
...@@ -275,16 +277,16 @@ static u32 * ...@@ -275,16 +277,16 @@ static u32 *
evo_wait(void *evoc, int nr) evo_wait(void *evoc, int nr)
{ {
struct nv50_dmac *dmac = evoc; struct nv50_dmac *dmac = evoc;
u32 put = nv_ro32(dmac->base.user, 0x0000) / 4; u32 put = nvif_rd32(&dmac->base.user, 0x0000) / 4;
mutex_lock(&dmac->lock); mutex_lock(&dmac->lock);
if (put + nr >= (PAGE_SIZE / 4) - 8) { if (put + nr >= (PAGE_SIZE / 4) - 8) {
dmac->ptr[put] = 0x20000000; dmac->ptr[put] = 0x20000000;
nv_wo32(dmac->base.user, 0x0000, 0x00000000); nvif_wr32(&dmac->base.user, 0x0000, 0x00000000);
if (!nv_wait(dmac->base.user, 0x0004, ~0, 0x00000000)) { if (!nvkm_wait(&dmac->base.user, 0x0004, ~0, 0x00000000)) {
mutex_unlock(&dmac->lock); mutex_unlock(&dmac->lock);
nv_error(dmac->base.user, "channel stalled\n"); nv_error(nvkm_object(&dmac->base.user), "channel stalled\n");
return NULL; return NULL;
} }
...@@ -298,7 +300,7 @@ static void ...@@ -298,7 +300,7 @@ static void
evo_kick(u32 *push, void *evoc) evo_kick(u32 *push, void *evoc)
{ {
struct nv50_dmac *dmac = evoc; struct nv50_dmac *dmac = evoc;
nv_wo32(dmac->base.user, 0x0000, (push - dmac->ptr) << 2); nvif_wr32(&dmac->base.user, 0x0000, (push - dmac->ptr) << 2);
mutex_unlock(&dmac->lock); mutex_unlock(&dmac->lock);
} }
...@@ -408,7 +410,7 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, ...@@ -408,7 +410,7 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb,
if (unlikely(push == NULL)) if (unlikely(push == NULL))
return -EBUSY; return -EBUSY;
if (chan && nv_mclass(chan->object) < NV84_CHANNEL_IND_CLASS) { if (chan && chan->object->oclass < NV84_CHANNEL_IND_CLASS) {
ret = RING_SPACE(chan, 8); ret = RING_SPACE(chan, 8);
if (ret) if (ret)
return ret; return ret;
...@@ -422,14 +424,14 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, ...@@ -422,14 +424,14 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb,
OUT_RING (chan, sync->addr); OUT_RING (chan, sync->addr);
OUT_RING (chan, sync->data); OUT_RING (chan, sync->data);
} else } else
if (chan && nv_mclass(chan->object) < NVC0_CHANNEL_IND_CLASS) { if (chan && chan->object->oclass < NVC0_CHANNEL_IND_CLASS) {
u64 addr = nv84_fence_crtc(chan, nv_crtc->index) + sync->addr; u64 addr = nv84_fence_crtc(chan, nv_crtc->index) + sync->addr;
ret = RING_SPACE(chan, 12); ret = RING_SPACE(chan, 12);
if (ret) if (ret)
return ret; return ret;
BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 1); BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 1);
OUT_RING (chan, chan->vram); OUT_RING (chan, chan->vram.handle);
BEGIN_NV04(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4); BEGIN_NV04(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4);
OUT_RING (chan, upper_32_bits(addr ^ 0x10)); OUT_RING (chan, upper_32_bits(addr ^ 0x10));
OUT_RING (chan, lower_32_bits(addr ^ 0x10)); OUT_RING (chan, lower_32_bits(addr ^ 0x10));
...@@ -1066,7 +1068,7 @@ nv50_crtc_lut_load(struct drm_crtc *crtc) ...@@ -1066,7 +1068,7 @@ nv50_crtc_lut_load(struct drm_crtc *crtc)
u16 g = nv_crtc->lut.g[i] >> 2; u16 g = nv_crtc->lut.g[i] >> 2;
u16 b = nv_crtc->lut.b[i] >> 2; u16 b = nv_crtc->lut.b[i] >> 2;
if (nv_mclass(disp->core) < NVD0_DISP_CLASS) { if (disp->disp->oclass < NVD0_DISP_CLASS) {
writew(r + 0x0000, lut + (i * 0x08) + 0); writew(r + 0x0000, lut + (i * 0x08) + 0);
writew(g + 0x0000, lut + (i * 0x08) + 2); writew(g + 0x0000, lut + (i * 0x08) + 2);
writew(b + 0x0000, lut + (i * 0x08) + 4); writew(b + 0x0000, lut + (i * 0x08) + 4);
...@@ -1133,8 +1135,8 @@ nv50_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) ...@@ -1133,8 +1135,8 @@ nv50_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
{ {
struct nv50_curs *curs = nv50_curs(crtc); struct nv50_curs *curs = nv50_curs(crtc);
struct nv50_chan *chan = nv50_chan(curs); struct nv50_chan *chan = nv50_chan(curs);
nv_wo32(chan->user, 0x0084, (y << 16) | (x & 0xffff)); nvif_wr32(&chan->user, 0x0084, (y << 16) | (x & 0xffff));
nv_wo32(chan->user, 0x0080, 0x00000000); nvif_wr32(&chan->user, 0x0080, 0x00000000);
return 0; return 0;
} }
...@@ -1161,11 +1163,16 @@ nv50_crtc_destroy(struct drm_crtc *crtc) ...@@ -1161,11 +1163,16 @@ nv50_crtc_destroy(struct drm_crtc *crtc)
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
struct nv50_disp *disp = nv50_disp(crtc->dev); struct nv50_disp *disp = nv50_disp(crtc->dev);
struct nv50_head *head = nv50_head(crtc); struct nv50_head *head = nv50_head(crtc);
struct nv50_fbdma *fbdma;
nv50_dmac_destroy(disp->core, &head->ovly.base); list_for_each_entry(fbdma, &disp->fbdma, head) {
nv50_pioc_destroy(disp->core, &head->oimm.base); nvif_object_fini(&fbdma->base[nv_crtc->index]);
nv50_dmac_destroy(disp->core, &head->sync.base); }
nv50_pioc_destroy(disp->core, &head->curs.base);
nv50_dmac_destroy(&head->ovly.base, disp->disp);
nv50_pioc_destroy(&head->oimm.base);
nv50_dmac_destroy(&head->sync.base, disp->disp);
nv50_pioc_destroy(&head->curs.base);
/*XXX: this shouldn't be necessary, but the core doesn't call /*XXX: this shouldn't be necessary, but the core doesn't call
* disconnect() during the cleanup paths * disconnect() during the cleanup paths
...@@ -1220,7 +1227,7 @@ nv50_cursor_set_offset(struct nouveau_crtc *nv_crtc, uint32_t offset) ...@@ -1220,7 +1227,7 @@ nv50_cursor_set_offset(struct nouveau_crtc *nv_crtc, uint32_t offset)
} }
static int static int
nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index) nv50_crtc_create(struct drm_device *dev, int index)
{ {
struct nv50_disp *disp = nv50_disp(dev); struct nv50_disp *disp = nv50_disp(dev);
struct nv50_head *head; struct nv50_head *head;
...@@ -1269,7 +1276,7 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index) ...@@ -1269,7 +1276,7 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index)
nv50_crtc_lut_load(crtc); nv50_crtc_lut_load(crtc);
/* allocate cursor resources */ /* allocate cursor resources */
ret = nv50_pioc_create(disp->core, NV50_DISP_CURS_CLASS, index, ret = nv50_pioc_create(disp->disp, NV50_DISP_CURS_CLASS, index,
&(struct nv50_display_curs_class) { &(struct nv50_display_curs_class) {
.head = index, .head = index,
}, sizeof(struct nv50_display_curs_class), }, sizeof(struct nv50_display_curs_class),
...@@ -1294,7 +1301,7 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index) ...@@ -1294,7 +1301,7 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index)
goto out; goto out;
/* allocate page flip / sync resources */ /* allocate page flip / sync resources */
ret = nv50_dmac_create(disp->core, NV50_DISP_SYNC_CLASS, index, ret = nv50_dmac_create(disp->disp, NV50_DISP_SYNC_CLASS, index,
&(struct nv50_display_sync_class) { &(struct nv50_display_sync_class) {
.pushbuf = EVO_PUSH_HANDLE(SYNC, index), .pushbuf = EVO_PUSH_HANDLE(SYNC, index),
.head = index, .head = index,
...@@ -1307,7 +1314,7 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index) ...@@ -1307,7 +1314,7 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index)
head->sync.data = 0x00000000; head->sync.data = 0x00000000;
/* allocate overlay resources */ /* allocate overlay resources */
ret = nv50_pioc_create(disp->core, NV50_DISP_OIMM_CLASS, index, ret = nv50_pioc_create(disp->disp, NV50_DISP_OIMM_CLASS, index,
&(struct nv50_display_oimm_class) { &(struct nv50_display_oimm_class) {
.head = index, .head = index,
}, sizeof(struct nv50_display_oimm_class), }, sizeof(struct nv50_display_oimm_class),
...@@ -1315,7 +1322,7 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index) ...@@ -1315,7 +1322,7 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index)
if (ret) if (ret)
goto out; goto out;
ret = nv50_dmac_create(disp->core, NV50_DISP_OVLY_CLASS, index, ret = nv50_dmac_create(disp->disp, NV50_DISP_OVLY_CLASS, index,
&(struct nv50_display_ovly_class) { &(struct nv50_display_ovly_class) {
.pushbuf = EVO_PUSH_HANDLE(OVLY, index), .pushbuf = EVO_PUSH_HANDLE(OVLY, index),
.head = index, .head = index,
...@@ -1347,7 +1354,7 @@ nv50_dac_dpms(struct drm_encoder *encoder, int mode) ...@@ -1347,7 +1354,7 @@ nv50_dac_dpms(struct drm_encoder *encoder, int mode)
if (mode == DRM_MODE_DPMS_SUSPEND || mode == DRM_MODE_DPMS_OFF) if (mode == DRM_MODE_DPMS_SUSPEND || mode == DRM_MODE_DPMS_OFF)
dpms_ctrl |= 0x00000004; dpms_ctrl |= 0x00000004;
nv_call(disp->core, NV50_DISP_DAC_PWR + or, dpms_ctrl); nvif_exec(disp->disp, NV50_DISP_DAC_PWR + or, &dpms_ctrl, sizeof(dpms_ctrl));
} }
static bool static bool
...@@ -1460,7 +1467,7 @@ nv50_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector) ...@@ -1460,7 +1467,7 @@ nv50_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector)
if (load == 0) if (load == 0)
load = 340; load = 340;
ret = nv_exec(disp->core, NV50_DISP_DAC_LOAD + or, &load, sizeof(load)); ret = nvif_exec(disp->disp, NV50_DISP_DAC_LOAD + or, &load, sizeof(load));
if (ret || !load) if (ret || !load)
return connector_status_disconnected; return connector_status_disconnected;
...@@ -1531,7 +1538,7 @@ nv50_audio_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode) ...@@ -1531,7 +1538,7 @@ nv50_audio_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode)
drm_edid_to_eld(&nv_connector->base, nv_connector->edid); drm_edid_to_eld(&nv_connector->base, nv_connector->edid);
nv_exec(disp->core, NVA3_DISP_SOR_HDA_ELD + nv_encoder->or, nvif_exec(disp->disp, NVA3_DISP_SOR_HDA_ELD + nv_encoder->or,
nv_connector->base.eld, nv_connector->base.eld,
nv_connector->base.eld[2] * 4); nv_connector->base.eld[2] * 4);
} }
...@@ -1542,7 +1549,7 @@ nv50_audio_disconnect(struct drm_encoder *encoder) ...@@ -1542,7 +1549,7 @@ nv50_audio_disconnect(struct drm_encoder *encoder)
struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
struct nv50_disp *disp = nv50_disp(encoder->dev); struct nv50_disp *disp = nv50_disp(encoder->dev);
nv_exec(disp->core, NVA3_DISP_SOR_HDA_ELD + nv_encoder->or, NULL, 0); nvif_exec(disp->disp, NVA3_DISP_SOR_HDA_ELD + nv_encoder->or, NULL, 0);
} }
/****************************************************************************** /******************************************************************************
...@@ -1558,6 +1565,7 @@ nv50_hdmi_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode) ...@@ -1558,6 +1565,7 @@ nv50_hdmi_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode)
const u32 moff = (nv_crtc->index << 3) | nv_encoder->or; const u32 moff = (nv_crtc->index << 3) | nv_encoder->or;
u32 rekey = 56; /* binary driver, and tegra constant */ u32 rekey = 56; /* binary driver, and tegra constant */
u32 max_ac_packet; u32 max_ac_packet;
u32 data;
nv_connector = nouveau_encoder_connector_get(nv_encoder); nv_connector = nouveau_encoder_connector_get(nv_encoder);
if (!drm_detect_hdmi_monitor(nv_connector->edid)) if (!drm_detect_hdmi_monitor(nv_connector->edid))
...@@ -1568,9 +1576,8 @@ nv50_hdmi_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode) ...@@ -1568,9 +1576,8 @@ nv50_hdmi_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode)
max_ac_packet -= 18; /* constant from tegra */ max_ac_packet -= 18; /* constant from tegra */
max_ac_packet /= 32; max_ac_packet /= 32;
nv_call(disp->core, NV84_DISP_SOR_HDMI_PWR + moff, data = NV84_DISP_SOR_HDMI_PWR_STATE_ON | (max_ac_packet << 16) | rekey;
NV84_DISP_SOR_HDMI_PWR_STATE_ON | nvif_exec(disp->disp, NV84_DISP_SOR_HDMI_PWR + moff, &data, sizeof(data));
(max_ac_packet << 16) | rekey);
nv50_audio_mode_set(encoder, mode); nv50_audio_mode_set(encoder, mode);
} }
...@@ -1581,10 +1588,11 @@ nv50_hdmi_disconnect(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc) ...@@ -1581,10 +1588,11 @@ nv50_hdmi_disconnect(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
struct nv50_disp *disp = nv50_disp(encoder->dev); struct nv50_disp *disp = nv50_disp(encoder->dev);
const u32 moff = (nv_crtc->index << 3) | nv_encoder->or; const u32 moff = (nv_crtc->index << 3) | nv_encoder->or;
u32 data = 0;
nv50_audio_disconnect(encoder); nv50_audio_disconnect(encoder);
nv_call(disp->core, NV84_DISP_SOR_HDMI_PWR + moff, 0x00000000); nvif_exec(disp->disp, NV84_DISP_SOR_HDMI_PWR + moff, &data, sizeof(data));
} }
/****************************************************************************** /******************************************************************************
...@@ -1597,7 +1605,7 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode) ...@@ -1597,7 +1605,7 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode)
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct nv50_disp *disp = nv50_disp(dev); struct nv50_disp *disp = nv50_disp(dev);
struct drm_encoder *partner; struct drm_encoder *partner;
u32 mthd; u32 mthd, data;
nv_encoder->last_dpms = mode; nv_encoder->last_dpms = mode;
...@@ -1620,13 +1628,15 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode) ...@@ -1620,13 +1628,15 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode)
mthd |= nv_encoder->or; mthd |= nv_encoder->or;
if (nv_encoder->dcb->type == DCB_OUTPUT_DP) { if (nv_encoder->dcb->type == DCB_OUTPUT_DP) {
nv_call(disp->core, NV50_DISP_SOR_PWR | mthd, 1); data = 1;
nvif_exec(disp->disp, NV50_DISP_SOR_PWR | mthd, &data, sizeof(data));
mthd |= NV94_DISP_SOR_DP_PWR; mthd |= NV94_DISP_SOR_DP_PWR;
} else { } else {
mthd |= NV50_DISP_SOR_PWR; mthd |= NV50_DISP_SOR_PWR;
} }
nv_call(disp->core, mthd, (mode == DRM_MODE_DPMS_ON)); data = (mode == DRM_MODE_DPMS_ON);
nvif_exec(disp->disp, mthd, &data, sizeof(data));
} }
static bool static bool
...@@ -1749,7 +1759,7 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode, ...@@ -1749,7 +1759,7 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode,
lvds |= 0x0200; lvds |= 0x0200;
} }
nv_call(disp->core, NV50_DISP_SOR_LVDS_SCRIPT + nv_encoder->or, lvds); nvif_exec(disp->disp, NV50_DISP_SOR_LVDS_SCRIPT + nv_encoder->or, &lvds, sizeof(lvds));
break; break;
case DCB_OUTPUT_DP: case DCB_OUTPUT_DP:
if (nv_connector->base.display_info.bpc == 6) { if (nv_connector->base.display_info.bpc == 6) {
...@@ -1878,7 +1888,7 @@ nv50_pior_dpms(struct drm_encoder *encoder, int mode) ...@@ -1878,7 +1888,7 @@ nv50_pior_dpms(struct drm_encoder *encoder, int mode)
struct nv50_disp *disp = nv50_disp(encoder->dev); struct nv50_disp *disp = nv50_disp(encoder->dev);
u32 mthd = (nv_encoder->dcb->type << 12) | nv_encoder->or; u32 mthd = (nv_encoder->dcb->type << 12) | nv_encoder->or;
u32 ctrl = (mode == DRM_MODE_DPMS_ON); u32 ctrl = (mode == DRM_MODE_DPMS_ON);
nv_call(disp->core, NV50_DISP_PIOR_PWR + mthd, ctrl); nvif_exec(disp->disp, NV50_DISP_PIOR_PWR + mthd, &ctrl, sizeof(ctrl));
} }
static bool static bool
...@@ -2046,25 +2056,13 @@ nv50_pior_create(struct drm_connector *connector, struct dcb_output *dcbe) ...@@ -2046,25 +2056,13 @@ nv50_pior_create(struct drm_connector *connector, struct dcb_output *dcbe)
* Framebuffer * Framebuffer
*****************************************************************************/ *****************************************************************************/
struct nv50_fbdma {
struct list_head head;
u32 name;
};
static void static void
nv50_fbdma_fini(struct drm_device *dev, struct nv50_fbdma *fbdma) nv50_fbdma_fini(struct nv50_fbdma *fbdma)
{ {
struct nv50_disp *disp = nv50_disp(dev); int i;
struct nv50_mast *mast = nv50_mast(dev); for (i = 0; i < ARRAY_SIZE(fbdma->base); i++)
struct nouveau_object *client = nv_pclass(disp->core, NV_CLIENT_CLASS); nvif_object_fini(&fbdma->base[i]);
struct drm_crtc *crtc; nvif_object_fini(&fbdma->core);
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
struct nv50_sync *sync = nv50_sync(crtc);
nouveau_object_del(client, sync->base.base.handle, fbdma->name);
}
nouveau_object_del(client, mast->base.base.handle, fbdma->name);
list_del(&fbdma->head); list_del(&fbdma->head);
kfree(fbdma); kfree(fbdma);
} }
...@@ -2075,15 +2073,13 @@ nv50_fbdma_init(struct drm_device *dev, u32 name, u64 offset, u64 length, u8 kin ...@@ -2075,15 +2073,13 @@ nv50_fbdma_init(struct drm_device *dev, u32 name, u64 offset, u64 length, u8 kin
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nv50_disp *disp = nv50_disp(dev); struct nv50_disp *disp = nv50_disp(dev);
struct nv50_mast *mast = nv50_mast(dev); struct nv50_mast *mast = nv50_mast(dev);
struct nouveau_object *client = nv_pclass(disp->core, NV_CLIENT_CLASS);
struct nouveau_object *object;
struct nv_dma_class args; struct nv_dma_class args;
struct nv50_fbdma *fbdma; struct nv50_fbdma *fbdma;
struct drm_crtc *crtc; struct drm_crtc *crtc;
int ret; int ret;
list_for_each_entry(fbdma, &disp->fbdma, head) { list_for_each_entry(fbdma, &disp->fbdma, head) {
if (fbdma->name == name) if (fbdma->core.handle == name)
return 0; return 0;
} }
...@@ -2091,7 +2087,6 @@ nv50_fbdma_init(struct drm_device *dev, u32 name, u64 offset, u64 length, u8 kin ...@@ -2091,7 +2087,6 @@ nv50_fbdma_init(struct drm_device *dev, u32 name, u64 offset, u64 length, u8 kin
if (!fbdma) if (!fbdma)
return -ENOMEM; return -ENOMEM;
list_add(&fbdma->head, &disp->fbdma); list_add(&fbdma->head, &disp->fbdma);
fbdma->name = name;
args.flags = NV_DMA_TARGET_VRAM | NV_DMA_ACCESS_RDWR; args.flags = NV_DMA_TARGET_VRAM | NV_DMA_ACCESS_RDWR;
args.start = offset; args.start = offset;
...@@ -2114,23 +2109,22 @@ nv50_fbdma_init(struct drm_device *dev, u32 name, u64 offset, u64 length, u8 kin ...@@ -2114,23 +2109,22 @@ nv50_fbdma_init(struct drm_device *dev, u32 name, u64 offset, u64 length, u8 kin
} }
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
struct nv50_sync *sync = nv50_sync(crtc); struct nv50_head *head = nv50_head(crtc);
ret = nouveau_object_new(client, sync->base.base.handle, int ret = nvif_object_init(&head->sync.base.base.user, NULL,
fbdma->name, NV_DMA_IN_MEMORY_CLASS, name, NV_DMA_IN_MEMORY_CLASS,
&args, sizeof(args), &object); &args, sizeof(args),
&fbdma->base[head->base.index]);
if (ret) { if (ret) {
printk(KERN_ERR "fail %d %08x %d\n", nv50_head(crtc)->base.index, fbdma->name, ret); nv50_fbdma_fini(fbdma);
nv50_fbdma_fini(dev, fbdma);
return ret; return ret;
} }
} }
ret = nouveau_object_new(client, mast->base.base.handle, fbdma->name, ret = nvif_object_init(&mast->base.base.user, NULL, name,
NV_DMA_IN_MEMORY_CLASS, &args, sizeof(args), NV_DMA_IN_MEMORY_CLASS, &args, sizeof(args),
&object); &fbdma->core);
if (ret) { if (ret) {
printk(KERN_ERR "fail %08x %d\n", fbdma->name, ret); nv50_fbdma_fini(fbdma);
nv50_fbdma_fini(dev, fbdma);
return ret; return ret;
} }
...@@ -2173,12 +2167,12 @@ nv50_fb_ctor(struct drm_framebuffer *fb) ...@@ -2173,12 +2167,12 @@ nv50_fb_ctor(struct drm_framebuffer *fb)
return -EINVAL; return -EINVAL;
} }
if (nv_mclass(disp->core) < NV84_DISP_CLASS) { if (disp->disp->oclass < NV84_DISP_CLASS) {
nv_fb->r_pitch = kind ? (((fb->pitches[0] / 4) << 4) | tile) : nv_fb->r_pitch = kind ? (((fb->pitches[0] / 4) << 4) | tile) :
(fb->pitches[0] | 0x00100000); (fb->pitches[0] | 0x00100000);
nv_fb->r_format |= kind << 16; nv_fb->r_format |= kind << 16;
} else } else
if (nv_mclass(disp->core) < NVD0_DISP_CLASS) { if (disp->disp->oclass < NVD0_DISP_CLASS) {
nv_fb->r_pitch = kind ? (((fb->pitches[0] / 4) << 4) | tile) : nv_fb->r_pitch = kind ? (((fb->pitches[0] / 4) << 4) | tile) :
(fb->pitches[0] | 0x00100000); (fb->pitches[0] | 0x00100000);
} else { } else {
...@@ -2228,10 +2222,10 @@ nv50_display_destroy(struct drm_device *dev) ...@@ -2228,10 +2222,10 @@ nv50_display_destroy(struct drm_device *dev)
struct nv50_fbdma *fbdma, *fbtmp; struct nv50_fbdma *fbdma, *fbtmp;
list_for_each_entry_safe(fbdma, fbtmp, &disp->fbdma, head) { list_for_each_entry_safe(fbdma, fbtmp, &disp->fbdma, head) {
nv50_fbdma_fini(dev, fbdma); nv50_fbdma_fini(fbdma);
} }
nv50_dmac_destroy(disp->core, &disp->mast.base); nv50_dmac_destroy(&disp->mast.base, disp->disp);
nouveau_bo_unmap(disp->sync); nouveau_bo_unmap(disp->sync);
if (disp->sync) if (disp->sync)
...@@ -2264,7 +2258,7 @@ nv50_display_create(struct drm_device *dev) ...@@ -2264,7 +2258,7 @@ nv50_display_create(struct drm_device *dev)
nouveau_display(dev)->fini = nv50_display_fini; nouveau_display(dev)->fini = nv50_display_fini;
nouveau_display(dev)->fb_ctor = nv50_fb_ctor; nouveau_display(dev)->fb_ctor = nv50_fb_ctor;
nouveau_display(dev)->fb_dtor = nv50_fb_dtor; nouveau_display(dev)->fb_dtor = nv50_fb_dtor;
disp->core = nouveau_display(dev)->core; disp->disp = &nouveau_display(dev)->disp;
/* small shared memory area we use for notifiers and semaphores */ /* small shared memory area we use for notifiers and semaphores */
ret = nouveau_bo_new(dev, 4096, 0x1000, TTM_PL_FLAG_VRAM, ret = nouveau_bo_new(dev, 4096, 0x1000, TTM_PL_FLAG_VRAM,
...@@ -2284,7 +2278,7 @@ nv50_display_create(struct drm_device *dev) ...@@ -2284,7 +2278,7 @@ nv50_display_create(struct drm_device *dev)
goto out; goto out;
/* allocate master evo channel */ /* allocate master evo channel */
ret = nv50_dmac_create(disp->core, NV50_DISP_MAST_CLASS, 0, ret = nv50_dmac_create(disp->disp, NV50_DISP_MAST_CLASS, 0,
&(struct nv50_display_mast_class) { &(struct nv50_display_mast_class) {
.pushbuf = EVO_PUSH_HANDLE(MAST, 0), .pushbuf = EVO_PUSH_HANDLE(MAST, 0),
}, sizeof(struct nv50_display_mast_class), }, sizeof(struct nv50_display_mast_class),
...@@ -2293,13 +2287,13 @@ nv50_display_create(struct drm_device *dev) ...@@ -2293,13 +2287,13 @@ nv50_display_create(struct drm_device *dev)
goto out; goto out;
/* create crtc objects to represent the hw heads */ /* create crtc objects to represent the hw heads */
if (nv_mclass(disp->core) >= NVD0_DISP_CLASS) if (disp->disp->oclass >= NVD0_DISP_CLASS)
crtcs = nvif_rd32(device, 0x022448); crtcs = nvif_rd32(device, 0x022448);
else else
crtcs = 2; crtcs = 2;
for (i = 0; i < crtcs; i++) { for (i = 0; i < crtcs; i++) {
ret = nv50_crtc_create(dev, disp->core, i); ret = nv50_crtc_create(dev, i);
if (ret) if (ret)
goto out; goto out;
} }
......
...@@ -154,7 +154,6 @@ nv50_fbcon_accel_init(struct fb_info *info) ...@@ -154,7 +154,6 @@ nv50_fbcon_accel_init(struct fb_info *info)
struct drm_device *dev = nfbdev->dev; struct drm_device *dev = nfbdev->dev;
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
struct nouveau_object *object;
int ret, format; int ret, format;
switch (info->var.bits_per_pixel) { switch (info->var.bits_per_pixel) {
...@@ -184,8 +183,8 @@ nv50_fbcon_accel_init(struct fb_info *info) ...@@ -184,8 +183,8 @@ nv50_fbcon_accel_init(struct fb_info *info)
return -EINVAL; return -EINVAL;
} }
ret = nouveau_object_new(nv_object(chan->cli), NVDRM_CHAN, Nv2D, ret = nvif_object_init(chan->object, NULL, Nv2D, 0x502d, NULL, 0,
0x502d, NULL, 0, &object); &nfbdev->twod);
if (ret) if (ret)
return ret; return ret;
......
...@@ -38,7 +38,6 @@ nv50_fence_context_new(struct nouveau_channel *chan) ...@@ -38,7 +38,6 @@ nv50_fence_context_new(struct nouveau_channel *chan)
struct nv10_fence_priv *priv = chan->drm->fence; struct nv10_fence_priv *priv = chan->drm->fence;
struct nv10_fence_chan *fctx; struct nv10_fence_chan *fctx;
struct ttm_mem_reg *mem = &priv->bo->bo.mem; struct ttm_mem_reg *mem = &priv->bo->bo.mem;
struct nouveau_object *object;
u32 start = mem->start * PAGE_SIZE; u32 start = mem->start * PAGE_SIZE;
u32 limit = start + mem->size - 1; u32 limit = start + mem->size - 1;
int ret, i; int ret, i;
...@@ -52,15 +51,15 @@ nv50_fence_context_new(struct nouveau_channel *chan) ...@@ -52,15 +51,15 @@ nv50_fence_context_new(struct nouveau_channel *chan)
fctx->base.read = nv10_fence_read; fctx->base.read = nv10_fence_read;
fctx->base.sync = nv17_fence_sync; fctx->base.sync = nv17_fence_sync;
ret = nouveau_object_new(nv_object(chan->cli), chan->handle, ret = nvif_object_init(chan->object, NULL, NvSema,
NvSema, 0x003d, NV_DMA_IN_MEMORY_CLASS,
&(struct nv_dma_class) { &(struct nv_dma_class) {
.flags = NV_DMA_TARGET_VRAM | .flags = NV_DMA_TARGET_VRAM |
NV_DMA_ACCESS_RDWR, NV_DMA_ACCESS_RDWR,
.start = start, .start = start,
.limit = limit, .limit = limit,
}, sizeof(struct nv_dma_class), }, sizeof(struct nv_dma_class),
&object); &fctx->sema);
/* dma objects for display sync channel semaphore blocks */ /* dma objects for display sync channel semaphore blocks */
for (i = 0; !ret && i < dev->mode_config.num_crtc; i++) { for (i = 0; !ret && i < dev->mode_config.num_crtc; i++) {
...@@ -68,15 +67,15 @@ nv50_fence_context_new(struct nouveau_channel *chan) ...@@ -68,15 +67,15 @@ nv50_fence_context_new(struct nouveau_channel *chan)
u32 start = bo->bo.mem.start * PAGE_SIZE; u32 start = bo->bo.mem.start * PAGE_SIZE;
u32 limit = start + bo->bo.mem.size - 1; u32 limit = start + bo->bo.mem.size - 1;
ret = nouveau_object_new(nv_object(chan->cli), chan->handle, ret = nvif_object_init(chan->object, NULL, NvEvoSema0 + i,
NvEvoSema0 + i, 0x003d, NV_DMA_IN_MEMORY_CLASS,
&(struct nv_dma_class) { &(struct nv_dma_class) {
.flags = NV_DMA_TARGET_VRAM | .flags = NV_DMA_TARGET_VRAM |
NV_DMA_ACCESS_RDWR, NV_DMA_ACCESS_RDWR,
.start = start, .start = start,
.limit = limit, .limit = limit,
}, sizeof(struct nv_dma_class), }, sizeof(struct nv_dma_class),
&object); &fctx->head[i]);
} }
if (ret) if (ret)
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <core/client.h> #include <core/client.h>
#include <core/class.h> #include <core/class.h>
#include <engine/fifo.h>
#include "nouveau_drm.h" #include "nouveau_drm.h"
#include "nouveau_dma.h" #include "nouveau_dma.h"
#include "nouveau_fence.h" #include "nouveau_fence.h"
...@@ -47,7 +45,7 @@ nv84_fence_emit32(struct nouveau_channel *chan, u64 virtual, u32 sequence) ...@@ -47,7 +45,7 @@ nv84_fence_emit32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
int ret = RING_SPACE(chan, 8); int ret = RING_SPACE(chan, 8);
if (ret == 0) { if (ret == 0) {
BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 1); BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 1);
OUT_RING (chan, chan->vram); OUT_RING (chan, chan->vram.handle);
BEGIN_NV04(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 5); BEGIN_NV04(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 5);
OUT_RING (chan, upper_32_bits(virtual)); OUT_RING (chan, upper_32_bits(virtual));
OUT_RING (chan, lower_32_bits(virtual)); OUT_RING (chan, lower_32_bits(virtual));
...@@ -65,7 +63,7 @@ nv84_fence_sync32(struct nouveau_channel *chan, u64 virtual, u32 sequence) ...@@ -65,7 +63,7 @@ nv84_fence_sync32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
int ret = RING_SPACE(chan, 7); int ret = RING_SPACE(chan, 7);
if (ret == 0) { if (ret == 0) {
BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 1); BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 1);
OUT_RING (chan, chan->vram); OUT_RING (chan, chan->vram.handle);
BEGIN_NV04(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4); BEGIN_NV04(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4);
OUT_RING (chan, upper_32_bits(virtual)); OUT_RING (chan, upper_32_bits(virtual));
OUT_RING (chan, lower_32_bits(virtual)); OUT_RING (chan, lower_32_bits(virtual));
...@@ -140,7 +138,7 @@ int ...@@ -140,7 +138,7 @@ int
nv84_fence_context_new(struct nouveau_channel *chan) nv84_fence_context_new(struct nouveau_channel *chan)
{ {
struct nouveau_fifo_chan *fifo = nvkm_fifo_chan(chan); struct nouveau_fifo_chan *fifo = nvkm_fifo_chan(chan);
struct nouveau_cli *cli = chan->cli; struct nouveau_cli *cli = (void *)nvif_client(&chan->device->base);
struct nv84_fence_priv *priv = chan->drm->fence; struct nv84_fence_priv *priv = chan->drm->fence;
struct nv84_fence_chan *fctx; struct nv84_fence_chan *fctx;
int ret, i; int ret, i;
......
...@@ -154,11 +154,10 @@ nvc0_fbcon_accel_init(struct fb_info *info) ...@@ -154,11 +154,10 @@ nvc0_fbcon_accel_init(struct fb_info *info)
struct nouveau_framebuffer *fb = &nfbdev->nouveau_fb; struct nouveau_framebuffer *fb = &nfbdev->nouveau_fb;
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
struct nouveau_object *object;
int ret, format; int ret, format;
ret = nouveau_object_new(nv_object(chan->cli), NVDRM_CHAN, Nv2D, ret = nvif_object_init(chan->object, NULL, Nv2D, 0x902d, NULL, 0,
0x902d, NULL, 0, &object); &nfbdev->twod);
if (ret) if (ret)
return ret; return ret;
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <core/client.h> #include <core/client.h>
#include <core/class.h> #include <core/class.h>
#include <engine/fifo.h>
#include "nouveau_drm.h" #include "nouveau_drm.h"
#include "nouveau_dma.h" #include "nouveau_dma.h"
#include "nouveau_fence.h" #include "nouveau_fence.h"
......
...@@ -58,9 +58,7 @@ nvif_client_fini(struct nvif_client *client) ...@@ -58,9 +58,7 @@ nvif_client_fini(struct nvif_client *client)
const struct nvif_driver * const struct nvif_driver *
nvif_drivers[] = { nvif_drivers[] = {
#ifdef __KERNEL__ #ifdef __KERNEL__
#if 0
&nvif_driver_nvkm, &nvif_driver_nvkm,
#endif
#else #else
&nvif_driver_lib, &nvif_driver_lib,
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment