aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs2015-11-23 19:00:53 -0600
committerBen Skeggs2015-12-21 21:22:28 -0600
commit4283e3f656541c4533c89b2cdc501aa6dc7da3dc (patch)
treec6f7a1a0021b626b868e173871671cb8fca4b031 /nouveau
parentcdf9029f5f2d3d7c7b77eda2a5d3ef3b44a82cdf (diff)
downloadexternal-libgbm-4283e3f656541c4533c89b2cdc501aa6dc7da3dc.tar.gz
external-libgbm-4283e3f656541c4533c89b2cdc501aa6dc7da3dc.tar.xz
external-libgbm-4283e3f656541c4533c89b2cdc501aa6dc7da3dc.zip
nouveau: make use of nouveau_drm::fd instead of nouveau_device::fd
The latter is deprecated, and will not be valid for newer clients. v2. - split out nouveau_object_find removal Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'nouveau')
-rw-r--r--nouveau/abi16.c32
-rw-r--r--nouveau/nouveau.c32
-rw-r--r--nouveau/pushbuf.c7
3 files changed, 40 insertions, 31 deletions
diff --git a/nouveau/abi16.c b/nouveau/abi16.c
index f260bf95..46350b13 100644
--- a/nouveau/abi16.c
+++ b/nouveau/abi16.c
@@ -38,7 +38,7 @@
38static int 38static int
39abi16_chan_nv04(struct nouveau_object *obj) 39abi16_chan_nv04(struct nouveau_object *obj)
40{ 40{
41 struct nouveau_device *dev = (struct nouveau_device *)obj->parent; 41 struct nouveau_drm *drm = nouveau_drm(obj);
42 struct nv04_fifo *nv04 = obj->data; 42 struct nv04_fifo *nv04 = obj->data;
43 struct drm_nouveau_channel_alloc req = { 43 struct drm_nouveau_channel_alloc req = {
44 .fb_ctxdma_handle = nv04->vram, 44 .fb_ctxdma_handle = nv04->vram,
@@ -46,7 +46,7 @@ abi16_chan_nv04(struct nouveau_object *obj)
46 }; 46 };
47 int ret; 47 int ret;
48 48
49 ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC, 49 ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
50 &req, sizeof(req)); 50 &req, sizeof(req));
51 if (ret) 51 if (ret)
52 return ret; 52 return ret;
@@ -62,12 +62,12 @@ abi16_chan_nv04(struct nouveau_object *obj)
62static int 62static int
63abi16_chan_nvc0(struct nouveau_object *obj) 63abi16_chan_nvc0(struct nouveau_object *obj)
64{ 64{
65 struct nouveau_device *dev = (struct nouveau_device *)obj->parent; 65 struct nouveau_drm *drm = nouveau_drm(obj);
66 struct drm_nouveau_channel_alloc req = {}; 66 struct drm_nouveau_channel_alloc req = {};
67 struct nvc0_fifo *nvc0 = obj->data; 67 struct nvc0_fifo *nvc0 = obj->data;
68 int ret; 68 int ret;
69 69
70 ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC, 70 ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
71 &req, sizeof(req)); 71 &req, sizeof(req));
72 if (ret) 72 if (ret)
73 return ret; 73 return ret;
@@ -83,7 +83,7 @@ abi16_chan_nvc0(struct nouveau_object *obj)
83static int 83static int
84abi16_chan_nve0(struct nouveau_object *obj) 84abi16_chan_nve0(struct nouveau_object *obj)
85{ 85{
86 struct nouveau_device *dev = (struct nouveau_device *)obj->parent; 86 struct nouveau_drm *drm = nouveau_drm(obj);
87 struct drm_nouveau_channel_alloc req = {}; 87 struct drm_nouveau_channel_alloc req = {};
88 struct nve0_fifo *nve0 = obj->data; 88 struct nve0_fifo *nve0 = obj->data;
89 int ret; 89 int ret;
@@ -93,7 +93,7 @@ abi16_chan_nve0(struct nouveau_object *obj)
93 req.tt_ctxdma_handle = nve0->engine; 93 req.tt_ctxdma_handle = nve0->engine;
94 } 94 }
95 95
96 ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC, 96 ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
97 &req, sizeof(req)); 97 &req, sizeof(req));
98 if (ret) 98 if (ret)
99 return ret; 99 return ret;
@@ -109,12 +109,12 @@ abi16_chan_nve0(struct nouveau_object *obj)
109static int 109static int
110abi16_engobj(struct nouveau_object *obj) 110abi16_engobj(struct nouveau_object *obj)
111{ 111{
112 struct nouveau_drm *drm = nouveau_drm(obj);
112 struct drm_nouveau_grobj_alloc req = { 113 struct drm_nouveau_grobj_alloc req = {
113 .channel = obj->parent->handle, 114 .channel = obj->parent->handle,
114 .handle = obj->handle, 115 .handle = obj->handle,
115 .class = obj->oclass, 116 .class = obj->oclass,
116 }; 117 };
117 struct nouveau_device *dev;
118 int ret; 118 int ret;
119 119
120 /* Older kernel versions did not have the concept of nouveau- 120 /* Older kernel versions did not have the concept of nouveau-
@@ -138,8 +138,7 @@ abi16_engobj(struct nouveau_object *obj)
138 break; 138 break;
139 } 139 }
140 140
141 dev = nouveau_object_find(obj, NOUVEAU_DEVICE_CLASS); 141 ret = drmCommandWrite(drm->fd, DRM_NOUVEAU_GROBJ_ALLOC,
142 ret = drmCommandWrite(dev->fd, DRM_NOUVEAU_GROBJ_ALLOC,
143 &req, sizeof(req)); 142 &req, sizeof(req));
144 if (ret) 143 if (ret)
145 return ret; 144 return ret;
@@ -151,17 +150,16 @@ abi16_engobj(struct nouveau_object *obj)
151static int 150static int
152abi16_ntfy(struct nouveau_object *obj) 151abi16_ntfy(struct nouveau_object *obj)
153{ 152{
153 struct nouveau_drm *drm = nouveau_drm(obj);
154 struct nv04_notify *ntfy = obj->data; 154 struct nv04_notify *ntfy = obj->data;
155 struct drm_nouveau_notifierobj_alloc req = { 155 struct drm_nouveau_notifierobj_alloc req = {
156 .channel = obj->parent->handle, 156 .channel = obj->parent->handle,
157 .handle = ntfy->object->handle, 157 .handle = ntfy->object->handle,
158 .size = ntfy->length, 158 .size = ntfy->length,
159 }; 159 };
160 struct nouveau_device *dev;
161 int ret; 160 int ret;
162 161
163 dev = nouveau_object_find(obj, NOUVEAU_DEVICE_CLASS); 162 ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_NOTIFIEROBJ_ALLOC,
164 ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_NOTIFIEROBJ_ALLOC,
165 &req, sizeof(req)); 163 &req, sizeof(req));
166 if (ret) 164 if (ret)
167 return ret; 165 return ret;
@@ -223,18 +221,17 @@ abi16_sclass(struct nouveau_object *obj, struct nouveau_sclass **psclass)
223drm_private void 221drm_private void
224abi16_delete(struct nouveau_object *obj) 222abi16_delete(struct nouveau_object *obj)
225{ 223{
226 struct nouveau_device *dev = 224 struct nouveau_drm *drm = nouveau_drm(obj);
227 nouveau_object_find(obj, NOUVEAU_DEVICE_CLASS);
228 if (obj->oclass == NOUVEAU_FIFO_CHANNEL_CLASS) { 225 if (obj->oclass == NOUVEAU_FIFO_CHANNEL_CLASS) {
229 struct drm_nouveau_channel_free req; 226 struct drm_nouveau_channel_free req;
230 req.channel = obj->handle; 227 req.channel = obj->handle;
231 drmCommandWrite(dev->fd, DRM_NOUVEAU_CHANNEL_FREE, 228 drmCommandWrite(drm->fd, DRM_NOUVEAU_CHANNEL_FREE,
232 &req, sizeof(req)); 229 &req, sizeof(req));
233 } else { 230 } else {
234 struct drm_nouveau_gpuobj_free req; 231 struct drm_nouveau_gpuobj_free req;
235 req.channel = obj->parent->handle; 232 req.channel = obj->parent->handle;
236 req.handle = obj->handle; 233 req.handle = obj->handle;
237 drmCommandWrite(dev->fd, DRM_NOUVEAU_GPUOBJ_FREE, 234 drmCommandWrite(drm->fd, DRM_NOUVEAU_GPUOBJ_FREE,
238 &req, sizeof(req)); 235 &req, sizeof(req));
239 } 236 }
240} 237}
@@ -314,6 +311,7 @@ abi16_bo_init(struct nouveau_bo *bo, uint32_t alignment,
314 union nouveau_bo_config *config) 311 union nouveau_bo_config *config)
315{ 312{
316 struct nouveau_device *dev = bo->device; 313 struct nouveau_device *dev = bo->device;
314 struct nouveau_drm *drm = nouveau_drm(&dev->object);
317 struct drm_nouveau_gem_new req = {}; 315 struct drm_nouveau_gem_new req = {};
318 struct drm_nouveau_gem_info *info = &req.info; 316 struct drm_nouveau_gem_info *info = &req.info;
319 int ret; 317 int ret;
@@ -356,7 +354,7 @@ abi16_bo_init(struct nouveau_bo *bo, uint32_t alignment,
356 if (!nouveau_device(dev)->have_bo_usage) 354 if (!nouveau_device(dev)->have_bo_usage)
357 info->tile_flags &= 0x0000ff00; 355 info->tile_flags &= 0x0000ff00;
358 356
359 ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_GEM_NEW, 357 ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_GEM_NEW,
360 &req, sizeof(req)); 358 &req, sizeof(req));
361 if (ret == 0) 359 if (ret == 0)
362 abi16_bo_info(bo, &req.info); 360 abi16_bo_info(bo, &req.info);
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index d129ae82..b474c775 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -345,8 +345,9 @@ nouveau_device_del(struct nouveau_device **pdev)
345int 345int
346nouveau_getparam(struct nouveau_device *dev, uint64_t param, uint64_t *value) 346nouveau_getparam(struct nouveau_device *dev, uint64_t param, uint64_t *value)
347{ 347{
348 struct nouveau_drm *drm = nouveau_drm(&dev->object);
348 struct drm_nouveau_getparam r = { .param = param }; 349 struct drm_nouveau_getparam r = { .param = param };
349 int fd = dev->fd, ret = 350 int fd = drm->fd, ret =
350 drmCommandWriteRead(fd, DRM_NOUVEAU_GETPARAM, &r, sizeof(r)); 351 drmCommandWriteRead(fd, DRM_NOUVEAU_GETPARAM, &r, sizeof(r));
351 *value = r.value; 352 *value = r.value;
352 return ret; 353 return ret;
@@ -355,8 +356,9 @@ nouveau_getparam(struct nouveau_device *dev, uint64_t param, uint64_t *value)
355int 356int
356nouveau_setparam(struct nouveau_device *dev, uint64_t param, uint64_t value) 357nouveau_setparam(struct nouveau_device *dev, uint64_t param, uint64_t value)
357{ 358{
359 struct nouveau_drm *drm = nouveau_drm(&dev->object);
358 struct drm_nouveau_setparam r = { .param = param, .value = value }; 360 struct drm_nouveau_setparam r = { .param = param, .value = value };
359 return drmCommandWrite(dev->fd, DRM_NOUVEAU_SETPARAM, &r, sizeof(r)); 361 return drmCommandWrite(drm->fd, DRM_NOUVEAU_SETPARAM, &r, sizeof(r));
360} 362}
361 363
362int 364int
@@ -417,6 +419,7 @@ nouveau_client_del(struct nouveau_client **pclient)
417static void 419static void
418nouveau_bo_del(struct nouveau_bo *bo) 420nouveau_bo_del(struct nouveau_bo *bo)
419{ 421{
422 struct nouveau_drm *drm = nouveau_drm(&bo->device->object);
420 struct nouveau_device_priv *nvdev = nouveau_device(bo->device); 423 struct nouveau_device_priv *nvdev = nouveau_device(bo->device);
421 struct nouveau_bo_priv *nvbo = nouveau_bo(bo); 424 struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
422 struct drm_gem_close req = { .handle = bo->handle }; 425 struct drm_gem_close req = { .handle = bo->handle };
@@ -433,11 +436,11 @@ nouveau_bo_del(struct nouveau_bo *bo)
433 * might cause the bo to be closed accidentally while 436 * might cause the bo to be closed accidentally while
434 * re-importing. 437 * re-importing.
435 */ 438 */
436 drmIoctl(bo->device->fd, DRM_IOCTL_GEM_CLOSE, &req); 439 drmIoctl(drm->fd, DRM_IOCTL_GEM_CLOSE, &req);
437 } 440 }
438 pthread_mutex_unlock(&nvdev->lock); 441 pthread_mutex_unlock(&nvdev->lock);
439 } else { 442 } else {
440 drmIoctl(bo->device->fd, DRM_IOCTL_GEM_CLOSE, &req); 443 drmIoctl(drm->fd, DRM_IOCTL_GEM_CLOSE, &req);
441 } 444 }
442 if (bo->map) 445 if (bo->map)
443 drm_munmap(bo->map, bo->size); 446 drm_munmap(bo->map, bo->size);
@@ -474,6 +477,7 @@ static int
474nouveau_bo_wrap_locked(struct nouveau_device *dev, uint32_t handle, 477nouveau_bo_wrap_locked(struct nouveau_device *dev, uint32_t handle,
475 struct nouveau_bo **pbo, int name) 478 struct nouveau_bo **pbo, int name)
476{ 479{
480 struct nouveau_drm *drm = nouveau_drm(&dev->object);
477 struct nouveau_device_priv *nvdev = nouveau_device(dev); 481 struct nouveau_device_priv *nvdev = nouveau_device(dev);
478 struct drm_nouveau_gem_info req = { .handle = handle }; 482 struct drm_nouveau_gem_info req = { .handle = handle };
479 struct nouveau_bo_priv *nvbo; 483 struct nouveau_bo_priv *nvbo;
@@ -503,7 +507,7 @@ nouveau_bo_wrap_locked(struct nouveau_device *dev, uint32_t handle,
503 } 507 }
504 } 508 }
505 509
506 ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_GEM_INFO, 510 ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_GEM_INFO,
507 &req, sizeof(req)); 511 &req, sizeof(req));
508 if (ret) 512 if (ret)
509 return ret; 513 return ret;
@@ -550,6 +554,7 @@ int
550nouveau_bo_name_ref(struct nouveau_device *dev, uint32_t name, 554nouveau_bo_name_ref(struct nouveau_device *dev, uint32_t name,
551 struct nouveau_bo **pbo) 555 struct nouveau_bo **pbo)
552{ 556{
557 struct nouveau_drm *drm = nouveau_drm(&dev->object);
553 struct nouveau_device_priv *nvdev = nouveau_device(dev); 558 struct nouveau_device_priv *nvdev = nouveau_device(dev);
554 struct nouveau_bo_priv *nvbo; 559 struct nouveau_bo_priv *nvbo;
555 struct drm_gem_open req = { .name = name }; 560 struct drm_gem_open req = { .name = name };
@@ -565,7 +570,7 @@ nouveau_bo_name_ref(struct nouveau_device *dev, uint32_t name,
565 } 570 }
566 } 571 }
567 572
568 ret = drmIoctl(dev->fd, DRM_IOCTL_GEM_OPEN, &req); 573 ret = drmIoctl(drm->fd, DRM_IOCTL_GEM_OPEN, &req);
569 if (ret == 0) { 574 if (ret == 0) {
570 ret = nouveau_bo_wrap_locked(dev, req.handle, pbo, name); 575 ret = nouveau_bo_wrap_locked(dev, req.handle, pbo, name);
571 } 576 }
@@ -578,11 +583,12 @@ int
578nouveau_bo_name_get(struct nouveau_bo *bo, uint32_t *name) 583nouveau_bo_name_get(struct nouveau_bo *bo, uint32_t *name)
579{ 584{
580 struct drm_gem_flink req = { .handle = bo->handle }; 585 struct drm_gem_flink req = { .handle = bo->handle };
586 struct nouveau_drm *drm = nouveau_drm(&bo->device->object);
581 struct nouveau_bo_priv *nvbo = nouveau_bo(bo); 587 struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
582 588
583 *name = nvbo->name; 589 *name = nvbo->name;
584 if (!*name) { 590 if (!*name) {
585 int ret = drmIoctl(bo->device->fd, DRM_IOCTL_GEM_FLINK, &req); 591 int ret = drmIoctl(drm->fd, DRM_IOCTL_GEM_FLINK, &req);
586 592
587 if (ret) { 593 if (ret) {
588 *name = 0; 594 *name = 0;
@@ -613,6 +619,7 @@ int
613nouveau_bo_prime_handle_ref(struct nouveau_device *dev, int prime_fd, 619nouveau_bo_prime_handle_ref(struct nouveau_device *dev, int prime_fd,
614 struct nouveau_bo **bo) 620 struct nouveau_bo **bo)
615{ 621{
622 struct nouveau_drm *drm = nouveau_drm(&dev->object);
616 struct nouveau_device_priv *nvdev = nouveau_device(dev); 623 struct nouveau_device_priv *nvdev = nouveau_device(dev);
617 int ret; 624 int ret;
618 unsigned int handle; 625 unsigned int handle;
@@ -620,7 +627,7 @@ nouveau_bo_prime_handle_ref(struct nouveau_device *dev, int prime_fd,
620 nouveau_bo_ref(NULL, bo); 627 nouveau_bo_ref(NULL, bo);
621 628
622 pthread_mutex_lock(&nvdev->lock); 629 pthread_mutex_lock(&nvdev->lock);
623 ret = drmPrimeFDToHandle(dev->fd, prime_fd, &handle); 630 ret = drmPrimeFDToHandle(drm->fd, prime_fd, &handle);
624 if (ret == 0) { 631 if (ret == 0) {
625 ret = nouveau_bo_wrap_locked(dev, handle, bo, 0); 632 ret = nouveau_bo_wrap_locked(dev, handle, bo, 0);
626 } 633 }
@@ -631,10 +638,11 @@ nouveau_bo_prime_handle_ref(struct nouveau_device *dev, int prime_fd,
631int 638int
632nouveau_bo_set_prime(struct nouveau_bo *bo, int *prime_fd) 639nouveau_bo_set_prime(struct nouveau_bo *bo, int *prime_fd)
633{ 640{
641 struct nouveau_drm *drm = nouveau_drm(&bo->device->object);
634 struct nouveau_bo_priv *nvbo = nouveau_bo(bo); 642 struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
635 int ret; 643 int ret;
636 644
637 ret = drmPrimeHandleToFD(bo->device->fd, nvbo->base.handle, DRM_CLOEXEC, prime_fd); 645 ret = drmPrimeHandleToFD(drm->fd, nvbo->base.handle, DRM_CLOEXEC, prime_fd);
638 if (ret) 646 if (ret)
639 return ret; 647 return ret;
640 648
@@ -646,6 +654,7 @@ int
646nouveau_bo_wait(struct nouveau_bo *bo, uint32_t access, 654nouveau_bo_wait(struct nouveau_bo *bo, uint32_t access,
647 struct nouveau_client *client) 655 struct nouveau_client *client)
648{ 656{
657 struct nouveau_drm *drm = nouveau_drm(&bo->device->object);
649 struct nouveau_bo_priv *nvbo = nouveau_bo(bo); 658 struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
650 struct drm_nouveau_gem_cpu_prep req; 659 struct drm_nouveau_gem_cpu_prep req;
651 struct nouveau_pushbuf *push; 660 struct nouveau_pushbuf *push;
@@ -669,7 +678,7 @@ nouveau_bo_wait(struct nouveau_bo *bo, uint32_t access,
669 if (access & NOUVEAU_BO_NOBLOCK) 678 if (access & NOUVEAU_BO_NOBLOCK)
670 req.flags |= NOUVEAU_GEM_CPU_PREP_NOWAIT; 679 req.flags |= NOUVEAU_GEM_CPU_PREP_NOWAIT;
671 680
672 ret = drmCommandWrite(bo->device->fd, DRM_NOUVEAU_GEM_CPU_PREP, 681 ret = drmCommandWrite(drm->fd, DRM_NOUVEAU_GEM_CPU_PREP,
673 &req, sizeof(req)); 682 &req, sizeof(req));
674 if (ret == 0) 683 if (ret == 0)
675 nvbo->access = 0; 684 nvbo->access = 0;
@@ -680,10 +689,11 @@ int
680nouveau_bo_map(struct nouveau_bo *bo, uint32_t access, 689nouveau_bo_map(struct nouveau_bo *bo, uint32_t access,
681 struct nouveau_client *client) 690 struct nouveau_client *client)
682{ 691{
692 struct nouveau_drm *drm = nouveau_drm(&bo->device->object);
683 struct nouveau_bo_priv *nvbo = nouveau_bo(bo); 693 struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
684 if (bo->map == NULL) { 694 if (bo->map == NULL) {
685 bo->map = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, 695 bo->map = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE,
686 MAP_SHARED, bo->device->fd, nvbo->map_handle); 696 MAP_SHARED, drm->fd, nvbo->map_handle);
687 if (bo->map == MAP_FAILED) { 697 if (bo->map == MAP_FAILED) {
688 bo->map = NULL; 698 bo->map = NULL;
689 return -errno; 699 return -errno;
diff --git a/nouveau/pushbuf.c b/nouveau/pushbuf.c
index 8e7dcdfa..035e3019 100644
--- a/nouveau/pushbuf.c
+++ b/nouveau/pushbuf.c
@@ -312,6 +312,7 @@ pushbuf_submit(struct nouveau_pushbuf *push, struct nouveau_object *chan)
312 struct nouveau_pushbuf_priv *nvpb = nouveau_pushbuf(push); 312 struct nouveau_pushbuf_priv *nvpb = nouveau_pushbuf(push);
313 struct nouveau_pushbuf_krec *krec = nvpb->list; 313 struct nouveau_pushbuf_krec *krec = nvpb->list;
314 struct nouveau_device *dev = push->client->device; 314 struct nouveau_device *dev = push->client->device;
315 struct nouveau_drm *drm = nouveau_drm(&dev->object);
315 struct drm_nouveau_gem_pushbuf_bo_presumed *info; 316 struct drm_nouveau_gem_pushbuf_bo_presumed *info;
316 struct drm_nouveau_gem_pushbuf_bo *kref; 317 struct drm_nouveau_gem_pushbuf_bo *kref;
317 struct drm_nouveau_gem_pushbuf req; 318 struct drm_nouveau_gem_pushbuf req;
@@ -345,7 +346,7 @@ pushbuf_submit(struct nouveau_pushbuf *push, struct nouveau_object *chan)
345 pushbuf_dump(krec, krec_id++, fifo->channel); 346 pushbuf_dump(krec, krec_id++, fifo->channel);
346 347
347#ifndef SIMULATE 348#ifndef SIMULATE
348 ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_GEM_PUSHBUF, 349 ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_GEM_PUSHBUF,
349 &req, sizeof(req)); 350 &req, sizeof(req));
350 nvpb->suffix0 = req.suffix0; 351 nvpb->suffix0 = req.suffix0;
351 nvpb->suffix1 = req.suffix1; 352 nvpb->suffix1 = req.suffix1;
@@ -536,7 +537,7 @@ nouveau_pushbuf_new(struct nouveau_client *client, struct nouveau_object *chan,
536 int nr, uint32_t size, bool immediate, 537 int nr, uint32_t size, bool immediate,
537 struct nouveau_pushbuf **ppush) 538 struct nouveau_pushbuf **ppush)
538{ 539{
539 struct nouveau_device *dev = client->device; 540 struct nouveau_drm *drm = nouveau_drm(&client->device->object);
540 struct nouveau_fifo *fifo = chan->data; 541 struct nouveau_fifo *fifo = chan->data;
541 struct nouveau_pushbuf_priv *nvpb; 542 struct nouveau_pushbuf_priv *nvpb;
542 struct nouveau_pushbuf *push; 543 struct nouveau_pushbuf *push;
@@ -551,7 +552,7 @@ nouveau_pushbuf_new(struct nouveau_client *client, struct nouveau_object *chan,
551 */ 552 */
552 req.channel = fifo->channel; 553 req.channel = fifo->channel;
553 req.nr_push = 0; 554 req.nr_push = 0;
554 ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_GEM_PUSHBUF, 555 ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_GEM_PUSHBUF,
555 &req, sizeof(req)); 556 &req, sizeof(req));
556 if (ret) 557 if (ret)
557 return ret; 558 return ret;