No longer required in a lot of cases, as objects are identified over NVIF via an alternate mechanism since the rework.
Unified · Split
| @@ -51,8 +51,7 @@ nouveau_abi16_get(struct drm_file *file_priv, struct drm_device *dev) · 50 unmodified lines | ||
| 51 | 51 | * device (ie. the one that belongs to the fd it |
| 52 | 52 | * opened) |
| 53 | 53 | */ |
| 54 | − if (nvif_device_init(&cli->base.object, | |
| 55 | − NOUVEAU_ABI16_DEVICE, NV_DEVICE, | |
| 54 | + if (nvif_device_init(&cli->base.object, 0, NV_DEVICE, | |
| 56 | 55 | &args, sizeof(args), |
| 57 | 56 | &abi16->device) == 0) |
| 58 | 57 | return cli->abi16; |
| @@ -133,7 +132,6 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16, · 74 unmodified lines | ||
| 133 | 132 | |
| 134 | 133 | /* destroy channel object, all children will be killed too */ |
| 135 | 134 | if (chan->chan) { |
| 136 | − abi16->handles &= ~(1ULL << (chan->chan->user.handle & 0xffff)); | |
| 137 | 135 | nouveau_channel_idle(chan->chan); |
| 138 | 136 | nouveau_channel_del(&chan->chan); |
| 139 | 137 | } |
| @@ -268,26 +266,21 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS) · 128 unmodified lines | ||
| 268 | 266 | return nouveau_abi16_put(abi16, -EINVAL); |
| 269 | 267 | |
| 270 | 268 | /* allocate "abi16 channel" data and make up a handle for it */ |
| 271 | − init->channel = __ffs64(~abi16->handles); | |
| 272 | − if (~abi16->handles == 0) | |
| 273 | − return nouveau_abi16_put(abi16, -ENOSPC); | |
| 274 | − | |
| 275 | 269 | chan = kzalloc(sizeof(*chan), GFP_KERNEL); |
| 276 | 270 | if (!chan) |
| 277 | 271 | return nouveau_abi16_put(abi16, -ENOMEM); |
| 278 | 272 | |
| 279 | 273 | INIT_LIST_HEAD(&chan->notifiers); |
| 280 | 274 | list_add(&chan->head, &abi16->channels); |
| 281 | − abi16->handles |= (1ULL << init->channel); | |
| 282 | 275 | |
| 283 | 276 | /* create channel object and initialise dma and fence management */ |
| 284 | − ret = nouveau_channel_new(drm, device, | |
| 285 | − NOUVEAU_ABI16_CHAN(init->channel), | |
| 286 | − init->fb_ctxdma_handle, | |
| 277 | + ret = nouveau_channel_new(drm, device, init->fb_ctxdma_handle, | |
| 287 | 278 | init->tt_ctxdma_handle, &chan->chan); |
| 288 | 279 | if (ret) |
| 289 | 280 | goto done; |
| 290 | 281 | |
| 282 | + init->channel = chan->chan->chid; | |
| 283 | + | |
| 291 | 284 | if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) |
| 292 | 285 | init->pushbuf_domains = NOUVEAU_GEM_DOMAIN_VRAM | |
| 293 | 286 | NOUVEAU_GEM_DOMAIN_GART; |
| @@ -338,7 +331,7 @@ nouveau_abi16_chan(struct nouveau_abi16 *abi16, int channel) · 44 unmodified lines | ||
| 338 | 331 | struct nouveau_abi16_chan *chan; |
| 339 | 332 | |
| 340 | 333 | list_for_each_entry(chan, &abi16->channels, head) { |
| 341 | − if (chan->chan->user.handle == NOUVEAU_ABI16_CHAN(channel)) | |
| 334 | + if (chan->chan->chid == channel) | |
| 342 | 335 | return chan; |
| 343 | 336 | } |
| 344 | 337 | |
| @@ -55,10 +55,8 @@ nouveau_channel_idle(struct nouveau_channel *chan) · 54 unmodified lines | ||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | if (ret) { |
| 58 | − NV_PRINTK(err, cli, "failed to idle channel " | |
| 59 | − "0x%08x [%s]\n", | |
| 60 | − chan->user.handle, | |
| 61 | − nvxx_client(&cli->base)->name); | |
| 58 | + NV_PRINTK(err, cli, "failed to idle channel %d [%s]\n", | |
| 59 | + chan->chid, nvxx_client(&cli->base)->name); | |
| 62 | 60 | return ret; |
| 63 | 61 | } |
| 64 | 62 | } |
| @@ -89,7 +87,7 @@ nouveau_channel_del(struct nouveau_channel **pchan) · 24 unmodified lines | ||
| 89 | 87 | |
| 90 | 88 | static int |
| 91 | 89 | nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device, |
| 92 | − u32 handle, u32 size, struct nouveau_channel **pchan) | |
| 90 | + u32 size, struct nouveau_channel **pchan) | |
| 93 | 91 | { |
| 94 | 92 | struct nouveau_cli *cli = (void *)device->object.client; |
| 95 | 93 | struct nvkm_mmu *mmu = nvxx_mmu(device); |
| @@ -174,8 +172,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device, · 78 unmodified lines | ||
| 174 | 172 | } |
| 175 | 173 | } |
| 176 | 174 | |
| 177 | − ret = nvif_object_init(&device->object, NVDRM_PUSH | | |
| 178 | − (handle & 0xffff), NV_DMA_FROM_MEMORY, | |
| 175 | + ret = nvif_object_init(&device->object, 0, NV_DMA_FROM_MEMORY, | |
| 179 | 176 | &args, sizeof(args), &chan->push.ctxdma); |
| 180 | 177 | if (ret) { |
| 181 | 178 | nouveau_channel_del(pchan); |
| @@ -187,7 +184,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device, · 5 unmodified lines | ||
| 187 | 184 | |
| 188 | 185 | static int |
| 189 | 186 | nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device, |
| 190 | − u32 handle, u32 engine, struct nouveau_channel **pchan) | |
| 187 | + u32 engine, struct nouveau_channel **pchan) | |
| 191 | 188 | { |
| 192 | 189 | static const u16 oclasses[] = { MAXWELL_CHANNEL_GPFIFO_A, |
| 193 | 190 | KEPLER_CHANNEL_GPFIFO_A, |
| @@ -206,7 +203,7 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device, · 12 unmodified lines | ||
| 206 | 203 | int ret; |
| 207 | 204 | |
| 208 | 205 | /* allocate dma push buffer */ |
| 209 | − ret = nouveau_channel_prep(drm, device, handle, 0x12000, &chan); | |
| 206 | + ret = nouveau_channel_prep(drm, device, 0x12000, &chan); | |
| 210 | 207 | *pchan = chan; |
| 211 | 208 | if (ret) |
| 212 | 209 | return ret; |
| @@ -236,7 +233,7 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device, · 23 unmodified lines | ||
| 236 | 233 | size = sizeof(args.nv50); |
| 237 | 234 | } |
| 238 | 235 | |
| 239 | − ret = nvif_object_init(&device->object, handle, *oclass++, | |
| 236 | + ret = nvif_object_init(&device->object, 0, *oclass++, | |
| 240 | 237 | &args, size, &chan->user); |
| 241 | 238 | if (ret == 0) { |
| 242 | 239 | if (chan->user.oclass >= KEPLER_CHANNEL_GPFIFO_A) |
| @@ -256,7 +253,7 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device, · 13 unmodified lines | ||
| 256 | 253 | |
| 257 | 254 | static int |
| 258 | 255 | nouveau_channel_dma(struct nouveau_drm *drm, struct nvif_device *device, |
| 259 | − u32 handle, struct nouveau_channel **pchan) | |
| 256 | + struct nouveau_channel **pchan) | |
| 260 | 257 | { |
| 261 | 258 | static const u16 oclasses[] = { NV40_CHANNEL_DMA, |
| 262 | 259 | NV17_CHANNEL_DMA, |
| @@ -269,7 +266,7 @@ nouveau_channel_dma(struct nouveau_drm *drm, struct nvif_device *device, · 6 unmodified lines | ||
| 269 | 266 | int ret; |
| 270 | 267 | |
| 271 | 268 | /* allocate dma push buffer */ |
| 272 | − ret = nouveau_channel_prep(drm, device, handle, 0x10000, &chan); | |
| 269 | + ret = nouveau_channel_prep(drm, device, 0x10000, &chan); | |
| 273 | 270 | *pchan = chan; |
| 274 | 271 | if (ret) |
| 275 | 272 | return ret; |
| @@ -280,7 +277,7 @@ nouveau_channel_dma(struct nouveau_drm *drm, struct nvif_device *device, · 4 unmodified lines | ||
| 280 | 277 | args.offset = chan->push.vma.offset; |
| 281 | 278 | |
| 282 | 279 | do { |
| 283 | − ret = nvif_object_init(&device->object, handle, *oclass++, | |
| 280 | + ret = nvif_object_init(&device->object, 0, *oclass++, | |
| 284 | 281 | &args, sizeof(args), &chan->user); |
| 285 | 282 | if (ret == 0) { |
| 286 | 283 | chan->chid = args.chid; |
| @@ -401,8 +398,7 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) · 114 unmodified lines | ||
| 401 | 398 | |
| 402 | 399 | int |
| 403 | 400 | nouveau_channel_new(struct nouveau_drm *drm, struct nvif_device *device, |
| 404 | − u32 handle, u32 arg0, u32 arg1, | |
| 405 | − struct nouveau_channel **pchan) | |
| 401 | + u32 arg0, u32 arg1, struct nouveau_channel **pchan) | |
| 406 | 402 | { |
| 407 | 403 | struct nouveau_cli *cli = (void *)device->object.client; |
| 408 | 404 | bool super; |
| @@ -412,10 +408,10 @@ nouveau_channel_new(struct nouveau_drm *drm, struct nvif_device *device, · 3 unmodified lines | ||
| 412 | 408 | super = cli->base.super; |
| 413 | 409 | cli->base.super = true; |
| 414 | 410 | |
| 415 | − ret = nouveau_channel_ind(drm, device, handle, arg0, pchan); | |
| 411 | + ret = nouveau_channel_ind(drm, device, arg0, pchan); | |
| 416 | 412 | if (ret) { |
| 417 | 413 | NV_PRINTK(dbg, cli, "ib channel create, %d\n", ret); |
| 418 | − ret = nouveau_channel_dma(drm, device, handle, pchan); | |
| 414 | + ret = nouveau_channel_dma(drm, device, pchan); | |
| 419 | 415 | if (ret) { |
| 420 | 416 | NV_PRINTK(dbg, cli, "dma channel create, %d\n", ret); |
| 421 | 417 | goto done; |
| @@ -42,8 +42,7 @@ struct nouveau_channel { · 41 unmodified lines | ||
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | int nouveau_channel_new(struct nouveau_drm *, struct nvif_device *, |
| 45 | − u32 handle, u32 arg0, u32 arg1, | |
| 46 | − struct nouveau_channel **); | |
| 45 | + u32 arg0, u32 arg1, struct nouveau_channel **); | |
| 47 | 46 | void nouveau_channel_del(struct nouveau_channel **); |
| 48 | 47 | int nouveau_channel_idle(struct nouveau_channel *); |
| 49 | 48 | |
| @@ -509,9 +509,8 @@ nouveau_display_create(struct drm_device *dev) · 508 unmodified lines | ||
| 509 | 509 | int i; |
| 510 | 510 | |
| 511 | 511 | for (i = 0, ret = -ENODEV; ret && i < ARRAY_SIZE(oclass); i++) { |
| 512 | − ret = nvif_object_init(&drm->device.object, | |
| 513 | − NVDRM_DISPLAY, oclass[i], | |
| 514 | − NULL, 0, &disp->disp); | |
| 512 | + ret = nvif_object_init(&drm->device.object, 0, | |
| 513 | + oclass[i], NULL, 0, &disp->disp); | |
| 515 | 514 | } |
| 516 | 515 | |
| 517 | 516 | if (ret == 0) { |
| @@ -208,7 +208,7 @@ nouveau_accel_init(struct nouveau_drm *drm) · 207 unmodified lines | ||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (device->info.family >= NV_DEVICE_INFO_V0_KEPLER) { |
| 211 | − ret = nouveau_channel_new(drm, &drm->device, NVDRM_CHAN + 1, | |
| 211 | + ret = nouveau_channel_new(drm, &drm->device, | |
| 212 | 212 | KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_CE0| |
| 213 | 213 | KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_CE1, |
| 214 | 214 | 0, &drm->cechan); |
| @@ -221,7 +221,7 @@ nouveau_accel_init(struct nouveau_drm *drm) · 6 unmodified lines | ||
| 221 | 221 | if (device->info.chipset >= 0xa3 && |
| 222 | 222 | device->info.chipset != 0xaa && |
| 223 | 223 | device->info.chipset != 0xac) { |
| 224 | − ret = nouveau_channel_new(drm, &drm->device, NVDRM_CHAN + 1, | |
| 224 | + ret = nouveau_channel_new(drm, &drm->device, | |
| 225 | 225 | NvDmaFB, NvDmaTT, &drm->cechan); |
| 226 | 226 | if (ret) |
| 227 | 227 | NV_ERROR(drm, "failed to create ce channel, %d\n", ret); |
| @@ -233,8 +233,7 @@ nouveau_accel_init(struct nouveau_drm *drm) · 5 unmodified lines | ||
| 233 | 233 | arg1 = NvDmaTT; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | − ret = nouveau_channel_new(drm, &drm->device, NVDRM_CHAN, arg0, arg1, | |
| 237 | − &drm->channel); | |
| 236 | + ret = nouveau_channel_new(drm, &drm->device, arg0, arg1, &drm->channel); | |
| 238 | 237 | if (ret) { |
| 239 | 238 | NV_ERROR(drm, "failed to create kernel channel, %d\n", ret); |
| 240 | 239 | nouveau_accel_fini(drm); |
| @@ -403,8 +402,7 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) · 162 unmodified lines | ||
| 403 | 402 | |
| 404 | 403 | nouveau_get_hdmi_dev(drm); |
| 405 | 404 | |
| 406 | − ret = nvif_device_init(&drm->client.base.object, | |
| 407 | − NVDRM_DEVICE, NV_DEVICE, | |
| 405 | + ret = nvif_device_init(&drm->client.base.object, 0, NV_DEVICE, | |
| 408 | 406 | &(struct nv_device_v0) { |
| 409 | 407 | .device = ~0, |
| 410 | 408 | }, sizeof(struct nv_device_v0), |
| @@ -74,11 +74,6 @@ enum nouveau_drm_notify_route { · 73 unmodified lines | ||
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | 76 | enum nouveau_drm_handle { |
| 77 | − NVDRM_CLIENT = 0xffffffff, | |
| 78 | − NVDRM_DEVICE = 0xdddddddd, | |
| 79 | − NVDRM_CONTROL = 0xdddddddc, | |
| 80 | − NVDRM_DISPLAY = 0xd1500000, | |
| 81 | − NVDRM_PUSH = 0xbbbb0000, /* |= client chid */ | |
| 82 | 77 | NVDRM_CHAN = 0xcccc0000, /* |= client chid */ |
| 83 | 78 | NVDRM_NVSW = 0x55550000, |
| 84 | 79 | }; |
| @@ -682,7 +682,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, · 681 unmodified lines | ||
| 682 | 682 | return -ENOMEM; |
| 683 | 683 | |
| 684 | 684 | list_for_each_entry(temp, &abi16->channels, head) { |
| 685 | − if (temp->chan->user.handle == (NVDRM_CHAN | req->channel)) { | |
| 685 | + if (temp->chan->chid == req->channel) { | |
| 686 | 686 | chan = temp->chan; |
| 687 | 687 | break; |
| 688 | 688 | } |
| @@ -188,9 +188,8 @@ nouveau_sysfs_init(struct drm_device *dev) · 187 unmodified lines | ||
| 188 | 188 | if (!sysfs) |
| 189 | 189 | return -ENOMEM; |
| 190 | 190 | |
| 191 | − ret = nvif_object_init(&device->object, NVDRM_CONTROL, | |
| 192 | − NVIF_IOCTL_NEW_V0_CONTROL, NULL, 0, | |
| 193 | − &sysfs->ctrl); | |
| 191 | + ret = nvif_object_init(&device->object, 0, NVIF_IOCTL_NEW_V0_CONTROL, | |
| 192 | + NULL, 0, &sysfs->ctrl); | |
| 194 | 193 | if (ret == 0) |
| 195 | 194 | device_create_file(nvxx_device(device)->dev, &dev_attr_pstate); |
| 196 | 195 | |
| @@ -68,7 +68,6 @@ nv50_chan_create(struct nvif_device *device, struct nvif_object *disp, · 67 unmodified lines | ||
| 68 | 68 | const s32 *oclass, u8 head, void *data, u32 size, |
| 69 | 69 | struct nv50_chan *chan) |
| 70 | 70 | { |
| 71 | − const u32 handle = (oclass[0] << 16) | head; | |
| 72 | 71 | struct nvif_sclass *sclass; |
| 73 | 72 | int ret, i, n; |
| 74 | 73 | |
| @@ -81,7 +80,7 @@ nv50_chan_create(struct nvif_device *device, struct nvif_object *disp, · 6 unmodified lines | ||
| 81 | 80 | while (oclass[0]) { |
| 82 | 81 | for (i = 0; i < n; i++) { |
| 83 | 82 | if (sclass[i].oclass == oclass[0]) { |
| 84 | − ret = nvif_object_init(disp, handle, oclass[0], | |
| 83 | + ret = nvif_object_init(disp, 0, oclass[0], | |
| 85 | 84 | data, size, &chan->user); |
| 86 | 85 | if (ret == 0) |
| 87 | 86 | nvif_object_map(&chan->user); |
| @@ -231,8 +230,8 @@ nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, · 143 unmodified lines | ||
| 231 | 230 | if (!dmac->ptr) |
| 232 | 231 | return -ENOMEM; |
| 233 | 232 | |
| 234 | − ret = nvif_object_init(&device->object, 0xd0000000, | |
| 235 | − NV_DMA_FROM_MEMORY, &(struct nv_dma_v0) { | |
| 233 | + ret = nvif_object_init(&device->object, 0, NV_DMA_FROM_MEMORY, | |
| 234 | + &(struct nv_dma_v0) { | |
| 236 | 235 | .target = NV_DMA_V0_TARGET_PCI_US, |
| 237 | 236 | .access = NV_DMA_V0_ACCESS_RD, |
| 238 | 237 | .start = dmac->handle + 0x0000, |
| @@ -27,14 +27,6 @@ · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | #define DRM_NOUVEAU_EVENT_NVIF 0x80000000 |
| 29 | 29 | |
| 30 | −/* reserved object handles when using deprecated object APIs - these | |
| 31 | − * are here so that libdrm can allow interoperability with the new | |
| 32 | − * object APIs | |
| 33 | − */ | |
| 34 | −#define NOUVEAU_ABI16_CLIENT 0xffffffff | |
| 35 | −#define NOUVEAU_ABI16_DEVICE 0xdddddddd | |
| 36 | −#define NOUVEAU_ABI16_CHAN(n) (0xcccc0000 | (n)) | |
| 37 | − | |
| 38 | 30 | #define NOUVEAU_GEM_DOMAIN_CPU (1 << 0) |
| 39 | 31 | #define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1) |
| 40 | 32 | #define NOUVEAU_GEM_DOMAIN_GART (1 << 2) |