diff options
author | Paul Mundt <lethal@linux-sh.org> | 2011-01-12 00:37:42 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-01-12 00:37:42 -0500 |
commit | 83eb95b852902f952ba594447a796ad8146b9462 (patch) | |
tree | 33c199aeeae58b69ad8d6d2a33c2d96ba2b98ddf /drivers/gpu/drm/nouveau/nouveau_drv.h | |
parent | efb3e34b6176d30c4fe8635fa8e1beb6280cc2cd (diff) | |
parent | 9bbe7b984096ac45586da2adf26c14069ecb79b2 (diff) |
Merge branch 'sh/sdio' into sh-latest
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_drv.h')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 425 |
1 files changed, 286 insertions, 139 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 1c7db64c03bf..46e32573b3a3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -54,22 +54,37 @@ struct nouveau_fpriv { | |||
54 | #include "nouveau_drm.h" | 54 | #include "nouveau_drm.h" |
55 | #include "nouveau_reg.h" | 55 | #include "nouveau_reg.h" |
56 | #include "nouveau_bios.h" | 56 | #include "nouveau_bios.h" |
57 | #include "nouveau_util.h" | ||
58 | |||
57 | struct nouveau_grctx; | 59 | struct nouveau_grctx; |
60 | struct nouveau_vram; | ||
61 | #include "nouveau_vm.h" | ||
58 | 62 | ||
59 | #define MAX_NUM_DCB_ENTRIES 16 | 63 | #define MAX_NUM_DCB_ENTRIES 16 |
60 | 64 | ||
61 | #define NOUVEAU_MAX_CHANNEL_NR 128 | 65 | #define NOUVEAU_MAX_CHANNEL_NR 128 |
62 | #define NOUVEAU_MAX_TILE_NR 15 | 66 | #define NOUVEAU_MAX_TILE_NR 15 |
63 | 67 | ||
64 | #define NV50_VM_MAX_VRAM (2*1024*1024*1024ULL) | 68 | struct nouveau_vram { |
65 | #define NV50_VM_BLOCK (512*1024*1024ULL) | 69 | struct drm_device *dev; |
66 | #define NV50_VM_VRAM_NR (NV50_VM_MAX_VRAM / NV50_VM_BLOCK) | 70 | |
71 | struct nouveau_vma bar_vma; | ||
72 | u8 page_shift; | ||
73 | |||
74 | struct list_head regions; | ||
75 | u32 memtype; | ||
76 | u64 offset; | ||
77 | u64 size; | ||
78 | }; | ||
67 | 79 | ||
68 | struct nouveau_tile_reg { | 80 | struct nouveau_tile_reg { |
69 | struct nouveau_fence *fence; | ||
70 | uint32_t addr; | ||
71 | uint32_t size; | ||
72 | bool used; | 81 | bool used; |
82 | uint32_t addr; | ||
83 | uint32_t limit; | ||
84 | uint32_t pitch; | ||
85 | uint32_t zcomp; | ||
86 | struct drm_mm_node *tag_mem; | ||
87 | struct nouveau_fence *fence; | ||
73 | }; | 88 | }; |
74 | 89 | ||
75 | struct nouveau_bo { | 90 | struct nouveau_bo { |
@@ -88,6 +103,7 @@ struct nouveau_bo { | |||
88 | 103 | ||
89 | struct nouveau_channel *channel; | 104 | struct nouveau_channel *channel; |
90 | 105 | ||
106 | struct nouveau_vma vma; | ||
91 | bool mappable; | 107 | bool mappable; |
92 | bool no_vm; | 108 | bool no_vm; |
93 | 109 | ||
@@ -96,7 +112,6 @@ struct nouveau_bo { | |||
96 | struct nouveau_tile_reg *tile; | 112 | struct nouveau_tile_reg *tile; |
97 | 113 | ||
98 | struct drm_gem_object *gem; | 114 | struct drm_gem_object *gem; |
99 | struct drm_file *cpu_filp; | ||
100 | int pin_refcnt; | 115 | int pin_refcnt; |
101 | }; | 116 | }; |
102 | 117 | ||
@@ -133,20 +148,28 @@ enum nouveau_flags { | |||
133 | 148 | ||
134 | #define NVOBJ_ENGINE_SW 0 | 149 | #define NVOBJ_ENGINE_SW 0 |
135 | #define NVOBJ_ENGINE_GR 1 | 150 | #define NVOBJ_ENGINE_GR 1 |
136 | #define NVOBJ_ENGINE_DISPLAY 2 | 151 | #define NVOBJ_ENGINE_PPP 2 |
152 | #define NVOBJ_ENGINE_COPY 3 | ||
153 | #define NVOBJ_ENGINE_VP 4 | ||
154 | #define NVOBJ_ENGINE_CRYPT 5 | ||
155 | #define NVOBJ_ENGINE_BSP 6 | ||
156 | #define NVOBJ_ENGINE_DISPLAY 0xcafe0001 | ||
137 | #define NVOBJ_ENGINE_INT 0xdeadbeef | 157 | #define NVOBJ_ENGINE_INT 0xdeadbeef |
138 | 158 | ||
159 | #define NVOBJ_FLAG_DONT_MAP (1 << 0) | ||
139 | #define NVOBJ_FLAG_ZERO_ALLOC (1 << 1) | 160 | #define NVOBJ_FLAG_ZERO_ALLOC (1 << 1) |
140 | #define NVOBJ_FLAG_ZERO_FREE (1 << 2) | 161 | #define NVOBJ_FLAG_ZERO_FREE (1 << 2) |
162 | #define NVOBJ_FLAG_VM (1 << 3) | ||
163 | |||
164 | #define NVOBJ_CINST_GLOBAL 0xdeadbeef | ||
165 | |||
141 | struct nouveau_gpuobj { | 166 | struct nouveau_gpuobj { |
142 | struct drm_device *dev; | 167 | struct drm_device *dev; |
143 | struct kref refcount; | 168 | struct kref refcount; |
144 | struct list_head list; | 169 | struct list_head list; |
145 | 170 | ||
146 | struct drm_mm_node *im_pramin; | 171 | void *node; |
147 | struct nouveau_bo *im_backing; | 172 | u32 *suspend; |
148 | uint32_t *im_backing_suspend; | ||
149 | int im_bound; | ||
150 | 173 | ||
151 | uint32_t flags; | 174 | uint32_t flags; |
152 | 175 | ||
@@ -162,10 +185,29 @@ struct nouveau_gpuobj { | |||
162 | void *priv; | 185 | void *priv; |
163 | }; | 186 | }; |
164 | 187 | ||
188 | struct nouveau_page_flip_state { | ||
189 | struct list_head head; | ||
190 | struct drm_pending_vblank_event *event; | ||
191 | int crtc, bpp, pitch, x, y; | ||
192 | uint64_t offset; | ||
193 | }; | ||
194 | |||
195 | enum nouveau_channel_mutex_class { | ||
196 | NOUVEAU_UCHANNEL_MUTEX, | ||
197 | NOUVEAU_KCHANNEL_MUTEX | ||
198 | }; | ||
199 | |||
165 | struct nouveau_channel { | 200 | struct nouveau_channel { |
166 | struct drm_device *dev; | 201 | struct drm_device *dev; |
167 | int id; | 202 | int id; |
168 | 203 | ||
204 | /* references to the channel data structure */ | ||
205 | struct kref ref; | ||
206 | /* users of the hardware channel resources, the hardware | ||
207 | * context will be kicked off when it reaches zero. */ | ||
208 | atomic_t users; | ||
209 | struct mutex mutex; | ||
210 | |||
169 | /* owner of this fifo */ | 211 | /* owner of this fifo */ |
170 | struct drm_file *file_priv; | 212 | struct drm_file *file_priv; |
171 | /* mapping of the fifo itself */ | 213 | /* mapping of the fifo itself */ |
@@ -198,16 +240,17 @@ struct nouveau_channel { | |||
198 | /* PFIFO context */ | 240 | /* PFIFO context */ |
199 | struct nouveau_gpuobj *ramfc; | 241 | struct nouveau_gpuobj *ramfc; |
200 | struct nouveau_gpuobj *cache; | 242 | struct nouveau_gpuobj *cache; |
243 | void *fifo_priv; | ||
201 | 244 | ||
202 | /* PGRAPH context */ | 245 | /* PGRAPH context */ |
203 | /* XXX may be merge 2 pointers as private data ??? */ | 246 | /* XXX may be merge 2 pointers as private data ??? */ |
204 | struct nouveau_gpuobj *ramin_grctx; | 247 | struct nouveau_gpuobj *ramin_grctx; |
248 | struct nouveau_gpuobj *crypt_ctx; | ||
205 | void *pgraph_ctx; | 249 | void *pgraph_ctx; |
206 | 250 | ||
207 | /* NV50 VM */ | 251 | /* NV50 VM */ |
252 | struct nouveau_vm *vm; | ||
208 | struct nouveau_gpuobj *vm_pd; | 253 | struct nouveau_gpuobj *vm_pd; |
209 | struct nouveau_gpuobj *vm_gart_pt; | ||
210 | struct nouveau_gpuobj *vm_vram_pt[NV50_VM_VRAM_NR]; | ||
211 | 254 | ||
212 | /* Objects */ | 255 | /* Objects */ |
213 | struct nouveau_gpuobj *ramin; /* Private instmem */ | 256 | struct nouveau_gpuobj *ramin; /* Private instmem */ |
@@ -238,9 +281,11 @@ struct nouveau_channel { | |||
238 | 281 | ||
239 | struct { | 282 | struct { |
240 | struct nouveau_gpuobj *vblsem; | 283 | struct nouveau_gpuobj *vblsem; |
284 | uint32_t vblsem_head; | ||
241 | uint32_t vblsem_offset; | 285 | uint32_t vblsem_offset; |
242 | uint32_t vblsem_rval; | 286 | uint32_t vblsem_rval; |
243 | struct list_head vbl_wait; | 287 | struct list_head vbl_wait; |
288 | struct list_head flip; | ||
244 | } nvsw; | 289 | } nvsw; |
245 | 290 | ||
246 | struct { | 291 | struct { |
@@ -258,11 +303,11 @@ struct nouveau_instmem_engine { | |||
258 | int (*suspend)(struct drm_device *dev); | 303 | int (*suspend)(struct drm_device *dev); |
259 | void (*resume)(struct drm_device *dev); | 304 | void (*resume)(struct drm_device *dev); |
260 | 305 | ||
261 | int (*populate)(struct drm_device *, struct nouveau_gpuobj *, | 306 | int (*get)(struct nouveau_gpuobj *, u32 size, u32 align); |
262 | uint32_t *size); | 307 | void (*put)(struct nouveau_gpuobj *); |
263 | void (*clear)(struct drm_device *, struct nouveau_gpuobj *); | 308 | int (*map)(struct nouveau_gpuobj *); |
264 | int (*bind)(struct drm_device *, struct nouveau_gpuobj *); | 309 | void (*unmap)(struct nouveau_gpuobj *); |
265 | int (*unbind)(struct drm_device *, struct nouveau_gpuobj *); | 310 | |
266 | void (*flush)(struct drm_device *); | 311 | void (*flush)(struct drm_device *); |
267 | }; | 312 | }; |
268 | 313 | ||
@@ -279,15 +324,21 @@ struct nouveau_timer_engine { | |||
279 | 324 | ||
280 | struct nouveau_fb_engine { | 325 | struct nouveau_fb_engine { |
281 | int num_tiles; | 326 | int num_tiles; |
327 | struct drm_mm tag_heap; | ||
328 | void *priv; | ||
282 | 329 | ||
283 | int (*init)(struct drm_device *dev); | 330 | int (*init)(struct drm_device *dev); |
284 | void (*takedown)(struct drm_device *dev); | 331 | void (*takedown)(struct drm_device *dev); |
285 | 332 | ||
286 | void (*set_region_tiling)(struct drm_device *dev, int i, uint32_t addr, | 333 | void (*init_tile_region)(struct drm_device *dev, int i, |
287 | uint32_t size, uint32_t pitch); | 334 | uint32_t addr, uint32_t size, |
335 | uint32_t pitch, uint32_t flags); | ||
336 | void (*set_tile_region)(struct drm_device *dev, int i); | ||
337 | void (*free_tile_region)(struct drm_device *dev, int i); | ||
288 | }; | 338 | }; |
289 | 339 | ||
290 | struct nouveau_fifo_engine { | 340 | struct nouveau_fifo_engine { |
341 | void *priv; | ||
291 | int channels; | 342 | int channels; |
292 | 343 | ||
293 | struct nouveau_gpuobj *playlist[2]; | 344 | struct nouveau_gpuobj *playlist[2]; |
@@ -310,22 +361,11 @@ struct nouveau_fifo_engine { | |||
310 | void (*tlb_flush)(struct drm_device *dev); | 361 | void (*tlb_flush)(struct drm_device *dev); |
311 | }; | 362 | }; |
312 | 363 | ||
313 | struct nouveau_pgraph_object_method { | ||
314 | int id; | ||
315 | int (*exec)(struct nouveau_channel *chan, int grclass, int mthd, | ||
316 | uint32_t data); | ||
317 | }; | ||
318 | |||
319 | struct nouveau_pgraph_object_class { | ||
320 | int id; | ||
321 | bool software; | ||
322 | struct nouveau_pgraph_object_method *methods; | ||
323 | }; | ||
324 | |||
325 | struct nouveau_pgraph_engine { | 364 | struct nouveau_pgraph_engine { |
326 | struct nouveau_pgraph_object_class *grclass; | ||
327 | bool accel_blocked; | 365 | bool accel_blocked; |
366 | bool registered; | ||
328 | int grctx_size; | 367 | int grctx_size; |
368 | void *priv; | ||
329 | 369 | ||
330 | /* NV2x/NV3x context table (0x400780) */ | 370 | /* NV2x/NV3x context table (0x400780) */ |
331 | struct nouveau_gpuobj *ctx_table; | 371 | struct nouveau_gpuobj *ctx_table; |
@@ -342,8 +382,7 @@ struct nouveau_pgraph_engine { | |||
342 | int (*unload_context)(struct drm_device *); | 382 | int (*unload_context)(struct drm_device *); |
343 | void (*tlb_flush)(struct drm_device *dev); | 383 | void (*tlb_flush)(struct drm_device *dev); |
344 | 384 | ||
345 | void (*set_region_tiling)(struct drm_device *dev, int i, uint32_t addr, | 385 | void (*set_tile_region)(struct drm_device *dev, int i); |
346 | uint32_t size, uint32_t pitch); | ||
347 | }; | 386 | }; |
348 | 387 | ||
349 | struct nouveau_display_engine { | 388 | struct nouveau_display_engine { |
@@ -355,13 +394,19 @@ struct nouveau_display_engine { | |||
355 | }; | 394 | }; |
356 | 395 | ||
357 | struct nouveau_gpio_engine { | 396 | struct nouveau_gpio_engine { |
397 | void *priv; | ||
398 | |||
358 | int (*init)(struct drm_device *); | 399 | int (*init)(struct drm_device *); |
359 | void (*takedown)(struct drm_device *); | 400 | void (*takedown)(struct drm_device *); |
360 | 401 | ||
361 | int (*get)(struct drm_device *, enum dcb_gpio_tag); | 402 | int (*get)(struct drm_device *, enum dcb_gpio_tag); |
362 | int (*set)(struct drm_device *, enum dcb_gpio_tag, int state); | 403 | int (*set)(struct drm_device *, enum dcb_gpio_tag, int state); |
363 | 404 | ||
364 | void (*irq_enable)(struct drm_device *, enum dcb_gpio_tag, bool on); | 405 | int (*irq_register)(struct drm_device *, enum dcb_gpio_tag, |
406 | void (*)(void *, int), void *); | ||
407 | void (*irq_unregister)(struct drm_device *, enum dcb_gpio_tag, | ||
408 | void (*)(void *, int), void *); | ||
409 | bool (*irq_enable)(struct drm_device *, enum dcb_gpio_tag, bool on); | ||
365 | }; | 410 | }; |
366 | 411 | ||
367 | struct nouveau_pm_voltage_level { | 412 | struct nouveau_pm_voltage_level { |
@@ -437,6 +482,7 @@ struct nouveau_pm_engine { | |||
437 | struct nouveau_pm_level *cur; | 482 | struct nouveau_pm_level *cur; |
438 | 483 | ||
439 | struct device *hwmon; | 484 | struct device *hwmon; |
485 | struct notifier_block acpi_nb; | ||
440 | 486 | ||
441 | int (*clock_get)(struct drm_device *, u32 id); | 487 | int (*clock_get)(struct drm_device *, u32 id); |
442 | void *(*clock_pre)(struct drm_device *, struct nouveau_pm_level *, | 488 | void *(*clock_pre)(struct drm_device *, struct nouveau_pm_level *, |
@@ -449,6 +495,25 @@ struct nouveau_pm_engine { | |||
449 | int (*temp_get)(struct drm_device *); | 495 | int (*temp_get)(struct drm_device *); |
450 | }; | 496 | }; |
451 | 497 | ||
498 | struct nouveau_crypt_engine { | ||
499 | bool registered; | ||
500 | |||
501 | int (*init)(struct drm_device *); | ||
502 | void (*takedown)(struct drm_device *); | ||
503 | int (*create_context)(struct nouveau_channel *); | ||
504 | void (*destroy_context)(struct nouveau_channel *); | ||
505 | void (*tlb_flush)(struct drm_device *dev); | ||
506 | }; | ||
507 | |||
508 | struct nouveau_vram_engine { | ||
509 | int (*init)(struct drm_device *); | ||
510 | int (*get)(struct drm_device *, u64, u32 align, u32 size_nc, | ||
511 | u32 type, struct nouveau_vram **); | ||
512 | void (*put)(struct drm_device *, struct nouveau_vram **); | ||
513 | |||
514 | bool (*flags_valid)(struct drm_device *, u32 tile_flags); | ||
515 | }; | ||
516 | |||
452 | struct nouveau_engine { | 517 | struct nouveau_engine { |
453 | struct nouveau_instmem_engine instmem; | 518 | struct nouveau_instmem_engine instmem; |
454 | struct nouveau_mc_engine mc; | 519 | struct nouveau_mc_engine mc; |
@@ -459,6 +524,8 @@ struct nouveau_engine { | |||
459 | struct nouveau_display_engine display; | 524 | struct nouveau_display_engine display; |
460 | struct nouveau_gpio_engine gpio; | 525 | struct nouveau_gpio_engine gpio; |
461 | struct nouveau_pm_engine pm; | 526 | struct nouveau_pm_engine pm; |
527 | struct nouveau_crypt_engine crypt; | ||
528 | struct nouveau_vram_engine vram; | ||
462 | }; | 529 | }; |
463 | 530 | ||
464 | struct nouveau_pll_vals { | 531 | struct nouveau_pll_vals { |
@@ -577,18 +644,15 @@ struct drm_nouveau_private { | |||
577 | bool ramin_available; | 644 | bool ramin_available; |
578 | struct drm_mm ramin_heap; | 645 | struct drm_mm ramin_heap; |
579 | struct list_head gpuobj_list; | 646 | struct list_head gpuobj_list; |
647 | struct list_head classes; | ||
580 | 648 | ||
581 | struct nouveau_bo *vga_ram; | 649 | struct nouveau_bo *vga_ram; |
582 | 650 | ||
651 | /* interrupt handling */ | ||
652 | void (*irq_handler[32])(struct drm_device *); | ||
653 | bool msi_enabled; | ||
583 | struct workqueue_struct *wq; | 654 | struct workqueue_struct *wq; |
584 | struct work_struct irq_work; | 655 | struct work_struct irq_work; |
585 | struct work_struct hpd_work; | ||
586 | |||
587 | struct { | ||
588 | spinlock_t lock; | ||
589 | uint32_t hpd0_bits; | ||
590 | uint32_t hpd1_bits; | ||
591 | } hpd_state; | ||
592 | 656 | ||
593 | struct list_head vbl_waiting; | 657 | struct list_head vbl_waiting; |
594 | 658 | ||
@@ -605,8 +669,10 @@ struct drm_nouveau_private { | |||
605 | struct nouveau_bo *bo; | 669 | struct nouveau_bo *bo; |
606 | } fence; | 670 | } fence; |
607 | 671 | ||
608 | int fifo_alloc_count; | 672 | struct { |
609 | struct nouveau_channel *fifos[NOUVEAU_MAX_CHANNEL_NR]; | 673 | spinlock_t lock; |
674 | struct nouveau_channel *ptr[NOUVEAU_MAX_CHANNEL_NR]; | ||
675 | } channels; | ||
610 | 676 | ||
611 | struct nouveau_engine engine; | 677 | struct nouveau_engine engine; |
612 | struct nouveau_channel *channel; | 678 | struct nouveau_channel *channel; |
@@ -632,12 +698,14 @@ struct drm_nouveau_private { | |||
632 | uint64_t aper_free; | 698 | uint64_t aper_free; |
633 | 699 | ||
634 | struct nouveau_gpuobj *sg_ctxdma; | 700 | struct nouveau_gpuobj *sg_ctxdma; |
635 | struct page *sg_dummy_page; | 701 | struct nouveau_vma vma; |
636 | dma_addr_t sg_dummy_bus; | ||
637 | } gart_info; | 702 | } gart_info; |
638 | 703 | ||
639 | /* nv10-nv40 tiling regions */ | 704 | /* nv10-nv40 tiling regions */ |
640 | struct nouveau_tile_reg tile[NOUVEAU_MAX_TILE_NR]; | 705 | struct { |
706 | struct nouveau_tile_reg reg[NOUVEAU_MAX_TILE_NR]; | ||
707 | spinlock_t lock; | ||
708 | } tile; | ||
641 | 709 | ||
642 | /* VRAM/fb configuration */ | 710 | /* VRAM/fb configuration */ |
643 | uint64_t vram_size; | 711 | uint64_t vram_size; |
@@ -650,14 +718,12 @@ struct drm_nouveau_private { | |||
650 | uint64_t fb_aper_free; | 718 | uint64_t fb_aper_free; |
651 | int fb_mtrr; | 719 | int fb_mtrr; |
652 | 720 | ||
721 | /* BAR control (NV50-) */ | ||
722 | struct nouveau_vm *bar1_vm; | ||
723 | struct nouveau_vm *bar3_vm; | ||
724 | |||
653 | /* G8x/G9x virtual address space */ | 725 | /* G8x/G9x virtual address space */ |
654 | uint64_t vm_gart_base; | 726 | struct nouveau_vm *chan_vm; |
655 | uint64_t vm_gart_size; | ||
656 | uint64_t vm_vram_base; | ||
657 | uint64_t vm_vram_size; | ||
658 | uint64_t vm_end; | ||
659 | struct nouveau_gpuobj *vm_vram_pt[NV50_VM_VRAM_NR]; | ||
660 | int vm_vram_pt_nr; | ||
661 | 727 | ||
662 | struct nvbios vbios; | 728 | struct nvbios vbios; |
663 | 729 | ||
@@ -674,6 +740,7 @@ struct drm_nouveau_private { | |||
674 | struct backlight_device *backlight; | 740 | struct backlight_device *backlight; |
675 | 741 | ||
676 | struct nouveau_channel *evo; | 742 | struct nouveau_channel *evo; |
743 | u32 evo_alloc; | ||
677 | struct { | 744 | struct { |
678 | struct dcb_entry *dcb; | 745 | struct dcb_entry *dcb; |
679 | u16 script; | 746 | u16 script; |
@@ -686,6 +753,8 @@ struct drm_nouveau_private { | |||
686 | 753 | ||
687 | struct nouveau_fbdev *nfbdev; | 754 | struct nouveau_fbdev *nfbdev; |
688 | struct apertures_struct *apertures; | 755 | struct apertures_struct *apertures; |
756 | |||
757 | bool powered_down; | ||
689 | }; | 758 | }; |
690 | 759 | ||
691 | static inline struct drm_nouveau_private * | 760 | static inline struct drm_nouveau_private * |
@@ -719,16 +788,6 @@ nouveau_bo_ref(struct nouveau_bo *ref, struct nouveau_bo **pnvbo) | |||
719 | return 0; | 788 | return 0; |
720 | } | 789 | } |
721 | 790 | ||
722 | #define NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(id, cl, ch) do { \ | ||
723 | struct drm_nouveau_private *nv = dev->dev_private; \ | ||
724 | if (!nouveau_channel_owner(dev, (cl), (id))) { \ | ||
725 | NV_ERROR(dev, "pid %d doesn't own channel %d\n", \ | ||
726 | DRM_CURRENTPID, (id)); \ | ||
727 | return -EPERM; \ | ||
728 | } \ | ||
729 | (ch) = nv->fifos[(id)]; \ | ||
730 | } while (0) | ||
731 | |||
732 | /* nouveau_drv.c */ | 791 | /* nouveau_drv.c */ |
733 | extern int nouveau_agpmode; | 792 | extern int nouveau_agpmode; |
734 | extern int nouveau_duallink; | 793 | extern int nouveau_duallink; |
@@ -748,6 +807,7 @@ extern int nouveau_force_post; | |||
748 | extern int nouveau_override_conntype; | 807 | extern int nouveau_override_conntype; |
749 | extern char *nouveau_perflvl; | 808 | extern char *nouveau_perflvl; |
750 | extern int nouveau_perflvl_wr; | 809 | extern int nouveau_perflvl_wr; |
810 | extern int nouveau_msi; | ||
751 | 811 | ||
752 | extern int nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state); | 812 | extern int nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state); |
753 | extern int nouveau_pci_resume(struct pci_dev *pdev); | 813 | extern int nouveau_pci_resume(struct pci_dev *pdev); |
@@ -762,8 +822,10 @@ extern int nouveau_ioctl_getparam(struct drm_device *, void *data, | |||
762 | struct drm_file *); | 822 | struct drm_file *); |
763 | extern int nouveau_ioctl_setparam(struct drm_device *, void *data, | 823 | extern int nouveau_ioctl_setparam(struct drm_device *, void *data, |
764 | struct drm_file *); | 824 | struct drm_file *); |
765 | extern bool nouveau_wait_until(struct drm_device *, uint64_t timeout, | 825 | extern bool nouveau_wait_eq(struct drm_device *, uint64_t timeout, |
766 | uint32_t reg, uint32_t mask, uint32_t val); | 826 | uint32_t reg, uint32_t mask, uint32_t val); |
827 | extern bool nouveau_wait_ne(struct drm_device *, uint64_t timeout, | ||
828 | uint32_t reg, uint32_t mask, uint32_t val); | ||
767 | extern bool nouveau_wait_for_idle(struct drm_device *); | 829 | extern bool nouveau_wait_for_idle(struct drm_device *); |
768 | extern int nouveau_card_init(struct drm_device *); | 830 | extern int nouveau_card_init(struct drm_device *); |
769 | 831 | ||
@@ -775,18 +837,18 @@ extern void nouveau_mem_gart_fini(struct drm_device *); | |||
775 | extern int nouveau_mem_init_agp(struct drm_device *); | 837 | extern int nouveau_mem_init_agp(struct drm_device *); |
776 | extern int nouveau_mem_reset_agp(struct drm_device *); | 838 | extern int nouveau_mem_reset_agp(struct drm_device *); |
777 | extern void nouveau_mem_close(struct drm_device *); | 839 | extern void nouveau_mem_close(struct drm_device *); |
778 | extern struct nouveau_tile_reg *nv10_mem_set_tiling(struct drm_device *dev, | 840 | extern int nouveau_mem_detect(struct drm_device *); |
779 | uint32_t addr, | 841 | extern bool nouveau_mem_flags_valid(struct drm_device *, u32 tile_flags); |
780 | uint32_t size, | 842 | extern struct nouveau_tile_reg *nv10_mem_set_tiling( |
781 | uint32_t pitch); | 843 | struct drm_device *dev, uint32_t addr, uint32_t size, |
782 | extern void nv10_mem_expire_tiling(struct drm_device *dev, | 844 | uint32_t pitch, uint32_t flags); |
783 | struct nouveau_tile_reg *tile, | 845 | extern void nv10_mem_put_tile_region(struct drm_device *dev, |
784 | struct nouveau_fence *fence); | 846 | struct nouveau_tile_reg *tile, |
785 | extern int nv50_mem_vm_bind_linear(struct drm_device *, uint64_t virt, | 847 | struct nouveau_fence *fence); |
786 | uint32_t size, uint32_t flags, | 848 | extern const struct ttm_mem_type_manager_func nouveau_vram_manager; |
787 | uint64_t phys); | 849 | |
788 | extern void nv50_mem_vm_unbind(struct drm_device *, uint64_t virt, | 850 | /* nvc0_vram.c */ |
789 | uint32_t size); | 851 | extern const struct ttm_mem_type_manager_func nvc0_vram_manager; |
790 | 852 | ||
791 | /* nouveau_notifier.c */ | 853 | /* nouveau_notifier.c */ |
792 | extern int nouveau_notifier_init_channel(struct nouveau_channel *); | 854 | extern int nouveau_notifier_init_channel(struct nouveau_channel *); |
@@ -803,21 +865,44 @@ extern int nouveau_ioctl_notifier_free(struct drm_device *, void *data, | |||
803 | extern struct drm_ioctl_desc nouveau_ioctls[]; | 865 | extern struct drm_ioctl_desc nouveau_ioctls[]; |
804 | extern int nouveau_max_ioctl; | 866 | extern int nouveau_max_ioctl; |
805 | extern void nouveau_channel_cleanup(struct drm_device *, struct drm_file *); | 867 | extern void nouveau_channel_cleanup(struct drm_device *, struct drm_file *); |
806 | extern int nouveau_channel_owner(struct drm_device *, struct drm_file *, | ||
807 | int channel); | ||
808 | extern int nouveau_channel_alloc(struct drm_device *dev, | 868 | extern int nouveau_channel_alloc(struct drm_device *dev, |
809 | struct nouveau_channel **chan, | 869 | struct nouveau_channel **chan, |
810 | struct drm_file *file_priv, | 870 | struct drm_file *file_priv, |
811 | uint32_t fb_ctxdma, uint32_t tt_ctxdma); | 871 | uint32_t fb_ctxdma, uint32_t tt_ctxdma); |
812 | extern void nouveau_channel_free(struct nouveau_channel *); | 872 | extern struct nouveau_channel * |
873 | nouveau_channel_get_unlocked(struct nouveau_channel *); | ||
874 | extern struct nouveau_channel * | ||
875 | nouveau_channel_get(struct drm_device *, struct drm_file *, int id); | ||
876 | extern void nouveau_channel_put_unlocked(struct nouveau_channel **); | ||
877 | extern void nouveau_channel_put(struct nouveau_channel **); | ||
878 | extern void nouveau_channel_ref(struct nouveau_channel *chan, | ||
879 | struct nouveau_channel **pchan); | ||
880 | extern void nouveau_channel_idle(struct nouveau_channel *chan); | ||
813 | 881 | ||
814 | /* nouveau_object.c */ | 882 | /* nouveau_object.c */ |
883 | #define NVOBJ_CLASS(d,c,e) do { \ | ||
884 | int ret = nouveau_gpuobj_class_new((d), (c), NVOBJ_ENGINE_##e); \ | ||
885 | if (ret) \ | ||
886 | return ret; \ | ||
887 | } while(0) | ||
888 | |||
889 | #define NVOBJ_MTHD(d,c,m,e) do { \ | ||
890 | int ret = nouveau_gpuobj_mthd_new((d), (c), (m), (e)); \ | ||
891 | if (ret) \ | ||
892 | return ret; \ | ||
893 | } while(0) | ||
894 | |||
815 | extern int nouveau_gpuobj_early_init(struct drm_device *); | 895 | extern int nouveau_gpuobj_early_init(struct drm_device *); |
816 | extern int nouveau_gpuobj_init(struct drm_device *); | 896 | extern int nouveau_gpuobj_init(struct drm_device *); |
817 | extern void nouveau_gpuobj_takedown(struct drm_device *); | 897 | extern void nouveau_gpuobj_takedown(struct drm_device *); |
818 | extern int nouveau_gpuobj_suspend(struct drm_device *dev); | 898 | extern int nouveau_gpuobj_suspend(struct drm_device *dev); |
819 | extern void nouveau_gpuobj_suspend_cleanup(struct drm_device *dev); | ||
820 | extern void nouveau_gpuobj_resume(struct drm_device *dev); | 899 | extern void nouveau_gpuobj_resume(struct drm_device *dev); |
900 | extern int nouveau_gpuobj_class_new(struct drm_device *, u32 class, u32 eng); | ||
901 | extern int nouveau_gpuobj_mthd_new(struct drm_device *, u32 class, u32 mthd, | ||
902 | int (*exec)(struct nouveau_channel *, | ||
903 | u32 class, u32 mthd, u32 data)); | ||
904 | extern int nouveau_gpuobj_mthd_call(struct nouveau_channel *, u32, u32, u32); | ||
905 | extern int nouveau_gpuobj_mthd_call2(struct drm_device *, int, u32, u32, u32); | ||
821 | extern int nouveau_gpuobj_channel_init(struct nouveau_channel *, | 906 | extern int nouveau_gpuobj_channel_init(struct nouveau_channel *, |
822 | uint32_t vram_h, uint32_t tt_h); | 907 | uint32_t vram_h, uint32_t tt_h); |
823 | extern void nouveau_gpuobj_channel_takedown(struct nouveau_channel *); | 908 | extern void nouveau_gpuobj_channel_takedown(struct nouveau_channel *); |
@@ -832,21 +917,25 @@ extern int nouveau_gpuobj_new_fake(struct drm_device *, u32 pinst, u64 vinst, | |||
832 | extern int nouveau_gpuobj_dma_new(struct nouveau_channel *, int class, | 917 | extern int nouveau_gpuobj_dma_new(struct nouveau_channel *, int class, |
833 | uint64_t offset, uint64_t size, int access, | 918 | uint64_t offset, uint64_t size, int access, |
834 | int target, struct nouveau_gpuobj **); | 919 | int target, struct nouveau_gpuobj **); |
835 | extern int nouveau_gpuobj_gart_dma_new(struct nouveau_channel *, | 920 | extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, u32 handle, int class); |
836 | uint64_t offset, uint64_t size, | 921 | extern int nv50_gpuobj_dma_new(struct nouveau_channel *, int class, u64 base, |
837 | int access, struct nouveau_gpuobj **, | 922 | u64 size, int target, int access, u32 type, |
838 | uint32_t *o_ret); | 923 | u32 comp, struct nouveau_gpuobj **pobj); |
839 | extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, int class, | 924 | extern void nv50_gpuobj_dma_init(struct nouveau_gpuobj *, u32 offset, |
840 | struct nouveau_gpuobj **); | 925 | int class, u64 base, u64 size, int target, |
841 | extern int nouveau_gpuobj_sw_new(struct nouveau_channel *, int class, | 926 | int access, u32 type, u32 comp); |
842 | struct nouveau_gpuobj **); | ||
843 | extern int nouveau_ioctl_grobj_alloc(struct drm_device *, void *data, | 927 | extern int nouveau_ioctl_grobj_alloc(struct drm_device *, void *data, |
844 | struct drm_file *); | 928 | struct drm_file *); |
845 | extern int nouveau_ioctl_gpuobj_free(struct drm_device *, void *data, | 929 | extern int nouveau_ioctl_gpuobj_free(struct drm_device *, void *data, |
846 | struct drm_file *); | 930 | struct drm_file *); |
847 | 931 | ||
848 | /* nouveau_irq.c */ | 932 | /* nouveau_irq.c */ |
933 | extern int nouveau_irq_init(struct drm_device *); | ||
934 | extern void nouveau_irq_fini(struct drm_device *); | ||
849 | extern irqreturn_t nouveau_irq_handler(DRM_IRQ_ARGS); | 935 | extern irqreturn_t nouveau_irq_handler(DRM_IRQ_ARGS); |
936 | extern void nouveau_irq_register(struct drm_device *, int status_bit, | ||
937 | void (*)(struct drm_device *)); | ||
938 | extern void nouveau_irq_unregister(struct drm_device *, int status_bit); | ||
850 | extern void nouveau_irq_preinstall(struct drm_device *); | 939 | extern void nouveau_irq_preinstall(struct drm_device *); |
851 | extern int nouveau_irq_postinstall(struct drm_device *); | 940 | extern int nouveau_irq_postinstall(struct drm_device *); |
852 | extern void nouveau_irq_uninstall(struct drm_device *); | 941 | extern void nouveau_irq_uninstall(struct drm_device *); |
@@ -854,8 +943,8 @@ extern void nouveau_irq_uninstall(struct drm_device *); | |||
854 | /* nouveau_sgdma.c */ | 943 | /* nouveau_sgdma.c */ |
855 | extern int nouveau_sgdma_init(struct drm_device *); | 944 | extern int nouveau_sgdma_init(struct drm_device *); |
856 | extern void nouveau_sgdma_takedown(struct drm_device *); | 945 | extern void nouveau_sgdma_takedown(struct drm_device *); |
857 | extern int nouveau_sgdma_get_page(struct drm_device *, uint32_t offset, | 946 | extern uint32_t nouveau_sgdma_get_physical(struct drm_device *, |
858 | uint32_t *page); | 947 | uint32_t offset); |
859 | extern struct ttm_backend *nouveau_sgdma_init_ttm(struct drm_device *); | 948 | extern struct ttm_backend *nouveau_sgdma_init_ttm(struct drm_device *); |
860 | 949 | ||
861 | /* nouveau_debugfs.c */ | 950 | /* nouveau_debugfs.c */ |
@@ -966,18 +1055,25 @@ extern void nv04_fb_takedown(struct drm_device *); | |||
966 | /* nv10_fb.c */ | 1055 | /* nv10_fb.c */ |
967 | extern int nv10_fb_init(struct drm_device *); | 1056 | extern int nv10_fb_init(struct drm_device *); |
968 | extern void nv10_fb_takedown(struct drm_device *); | 1057 | extern void nv10_fb_takedown(struct drm_device *); |
969 | extern void nv10_fb_set_region_tiling(struct drm_device *, int, uint32_t, | 1058 | extern void nv10_fb_init_tile_region(struct drm_device *dev, int i, |
970 | uint32_t, uint32_t); | 1059 | uint32_t addr, uint32_t size, |
1060 | uint32_t pitch, uint32_t flags); | ||
1061 | extern void nv10_fb_set_tile_region(struct drm_device *dev, int i); | ||
1062 | extern void nv10_fb_free_tile_region(struct drm_device *dev, int i); | ||
971 | 1063 | ||
972 | /* nv30_fb.c */ | 1064 | /* nv30_fb.c */ |
973 | extern int nv30_fb_init(struct drm_device *); | 1065 | extern int nv30_fb_init(struct drm_device *); |
974 | extern void nv30_fb_takedown(struct drm_device *); | 1066 | extern void nv30_fb_takedown(struct drm_device *); |
1067 | extern void nv30_fb_init_tile_region(struct drm_device *dev, int i, | ||
1068 | uint32_t addr, uint32_t size, | ||
1069 | uint32_t pitch, uint32_t flags); | ||
1070 | extern void nv30_fb_free_tile_region(struct drm_device *dev, int i); | ||
975 | 1071 | ||
976 | /* nv40_fb.c */ | 1072 | /* nv40_fb.c */ |
977 | extern int nv40_fb_init(struct drm_device *); | 1073 | extern int nv40_fb_init(struct drm_device *); |
978 | extern void nv40_fb_takedown(struct drm_device *); | 1074 | extern void nv40_fb_takedown(struct drm_device *); |
979 | extern void nv40_fb_set_region_tiling(struct drm_device *, int, uint32_t, | 1075 | extern void nv40_fb_set_tile_region(struct drm_device *dev, int i); |
980 | uint32_t, uint32_t); | 1076 | |
981 | /* nv50_fb.c */ | 1077 | /* nv50_fb.c */ |
982 | extern int nv50_fb_init(struct drm_device *); | 1078 | extern int nv50_fb_init(struct drm_device *); |
983 | extern void nv50_fb_takedown(struct drm_device *); | 1079 | extern void nv50_fb_takedown(struct drm_device *); |
@@ -989,6 +1085,7 @@ extern void nvc0_fb_takedown(struct drm_device *); | |||
989 | 1085 | ||
990 | /* nv04_fifo.c */ | 1086 | /* nv04_fifo.c */ |
991 | extern int nv04_fifo_init(struct drm_device *); | 1087 | extern int nv04_fifo_init(struct drm_device *); |
1088 | extern void nv04_fifo_fini(struct drm_device *); | ||
992 | extern void nv04_fifo_disable(struct drm_device *); | 1089 | extern void nv04_fifo_disable(struct drm_device *); |
993 | extern void nv04_fifo_enable(struct drm_device *); | 1090 | extern void nv04_fifo_enable(struct drm_device *); |
994 | extern bool nv04_fifo_reassign(struct drm_device *, bool); | 1091 | extern bool nv04_fifo_reassign(struct drm_device *, bool); |
@@ -998,19 +1095,18 @@ extern int nv04_fifo_create_context(struct nouveau_channel *); | |||
998 | extern void nv04_fifo_destroy_context(struct nouveau_channel *); | 1095 | extern void nv04_fifo_destroy_context(struct nouveau_channel *); |
999 | extern int nv04_fifo_load_context(struct nouveau_channel *); | 1096 | extern int nv04_fifo_load_context(struct nouveau_channel *); |
1000 | extern int nv04_fifo_unload_context(struct drm_device *); | 1097 | extern int nv04_fifo_unload_context(struct drm_device *); |
1098 | extern void nv04_fifo_isr(struct drm_device *); | ||
1001 | 1099 | ||
1002 | /* nv10_fifo.c */ | 1100 | /* nv10_fifo.c */ |
1003 | extern int nv10_fifo_init(struct drm_device *); | 1101 | extern int nv10_fifo_init(struct drm_device *); |
1004 | extern int nv10_fifo_channel_id(struct drm_device *); | 1102 | extern int nv10_fifo_channel_id(struct drm_device *); |
1005 | extern int nv10_fifo_create_context(struct nouveau_channel *); | 1103 | extern int nv10_fifo_create_context(struct nouveau_channel *); |
1006 | extern void nv10_fifo_destroy_context(struct nouveau_channel *); | ||
1007 | extern int nv10_fifo_load_context(struct nouveau_channel *); | 1104 | extern int nv10_fifo_load_context(struct nouveau_channel *); |
1008 | extern int nv10_fifo_unload_context(struct drm_device *); | 1105 | extern int nv10_fifo_unload_context(struct drm_device *); |
1009 | 1106 | ||
1010 | /* nv40_fifo.c */ | 1107 | /* nv40_fifo.c */ |
1011 | extern int nv40_fifo_init(struct drm_device *); | 1108 | extern int nv40_fifo_init(struct drm_device *); |
1012 | extern int nv40_fifo_create_context(struct nouveau_channel *); | 1109 | extern int nv40_fifo_create_context(struct nouveau_channel *); |
1013 | extern void nv40_fifo_destroy_context(struct nouveau_channel *); | ||
1014 | extern int nv40_fifo_load_context(struct nouveau_channel *); | 1110 | extern int nv40_fifo_load_context(struct nouveau_channel *); |
1015 | extern int nv40_fifo_unload_context(struct drm_device *); | 1111 | extern int nv40_fifo_unload_context(struct drm_device *); |
1016 | 1112 | ||
@@ -1038,7 +1134,6 @@ extern int nvc0_fifo_load_context(struct nouveau_channel *); | |||
1038 | extern int nvc0_fifo_unload_context(struct drm_device *); | 1134 | extern int nvc0_fifo_unload_context(struct drm_device *); |
1039 | 1135 | ||
1040 | /* nv04_graph.c */ | 1136 | /* nv04_graph.c */ |
1041 | extern struct nouveau_pgraph_object_class nv04_graph_grclass[]; | ||
1042 | extern int nv04_graph_init(struct drm_device *); | 1137 | extern int nv04_graph_init(struct drm_device *); |
1043 | extern void nv04_graph_takedown(struct drm_device *); | 1138 | extern void nv04_graph_takedown(struct drm_device *); |
1044 | extern void nv04_graph_fifo_access(struct drm_device *, bool); | 1139 | extern void nv04_graph_fifo_access(struct drm_device *, bool); |
@@ -1047,10 +1142,11 @@ extern int nv04_graph_create_context(struct nouveau_channel *); | |||
1047 | extern void nv04_graph_destroy_context(struct nouveau_channel *); | 1142 | extern void nv04_graph_destroy_context(struct nouveau_channel *); |
1048 | extern int nv04_graph_load_context(struct nouveau_channel *); | 1143 | extern int nv04_graph_load_context(struct nouveau_channel *); |
1049 | extern int nv04_graph_unload_context(struct drm_device *); | 1144 | extern int nv04_graph_unload_context(struct drm_device *); |
1050 | extern void nv04_graph_context_switch(struct drm_device *); | 1145 | extern int nv04_graph_mthd_page_flip(struct nouveau_channel *chan, |
1146 | u32 class, u32 mthd, u32 data); | ||
1147 | extern struct nouveau_bitfield nv04_graph_nsource[]; | ||
1051 | 1148 | ||
1052 | /* nv10_graph.c */ | 1149 | /* nv10_graph.c */ |
1053 | extern struct nouveau_pgraph_object_class nv10_graph_grclass[]; | ||
1054 | extern int nv10_graph_init(struct drm_device *); | 1150 | extern int nv10_graph_init(struct drm_device *); |
1055 | extern void nv10_graph_takedown(struct drm_device *); | 1151 | extern void nv10_graph_takedown(struct drm_device *); |
1056 | extern struct nouveau_channel *nv10_graph_channel(struct drm_device *); | 1152 | extern struct nouveau_channel *nv10_graph_channel(struct drm_device *); |
@@ -1058,13 +1154,11 @@ extern int nv10_graph_create_context(struct nouveau_channel *); | |||
1058 | extern void nv10_graph_destroy_context(struct nouveau_channel *); | 1154 | extern void nv10_graph_destroy_context(struct nouveau_channel *); |
1059 | extern int nv10_graph_load_context(struct nouveau_channel *); | 1155 | extern int nv10_graph_load_context(struct nouveau_channel *); |
1060 | extern int nv10_graph_unload_context(struct drm_device *); | 1156 | extern int nv10_graph_unload_context(struct drm_device *); |
1061 | extern void nv10_graph_context_switch(struct drm_device *); | 1157 | extern void nv10_graph_set_tile_region(struct drm_device *dev, int i); |
1062 | extern void nv10_graph_set_region_tiling(struct drm_device *, int, uint32_t, | 1158 | extern struct nouveau_bitfield nv10_graph_intr[]; |
1063 | uint32_t, uint32_t); | 1159 | extern struct nouveau_bitfield nv10_graph_nstatus[]; |
1064 | 1160 | ||
1065 | /* nv20_graph.c */ | 1161 | /* nv20_graph.c */ |
1066 | extern struct nouveau_pgraph_object_class nv20_graph_grclass[]; | ||
1067 | extern struct nouveau_pgraph_object_class nv30_graph_grclass[]; | ||
1068 | extern int nv20_graph_create_context(struct nouveau_channel *); | 1162 | extern int nv20_graph_create_context(struct nouveau_channel *); |
1069 | extern void nv20_graph_destroy_context(struct nouveau_channel *); | 1163 | extern void nv20_graph_destroy_context(struct nouveau_channel *); |
1070 | extern int nv20_graph_load_context(struct nouveau_channel *); | 1164 | extern int nv20_graph_load_context(struct nouveau_channel *); |
@@ -1072,11 +1166,9 @@ extern int nv20_graph_unload_context(struct drm_device *); | |||
1072 | extern int nv20_graph_init(struct drm_device *); | 1166 | extern int nv20_graph_init(struct drm_device *); |
1073 | extern void nv20_graph_takedown(struct drm_device *); | 1167 | extern void nv20_graph_takedown(struct drm_device *); |
1074 | extern int nv30_graph_init(struct drm_device *); | 1168 | extern int nv30_graph_init(struct drm_device *); |
1075 | extern void nv20_graph_set_region_tiling(struct drm_device *, int, uint32_t, | 1169 | extern void nv20_graph_set_tile_region(struct drm_device *dev, int i); |
1076 | uint32_t, uint32_t); | ||
1077 | 1170 | ||
1078 | /* nv40_graph.c */ | 1171 | /* nv40_graph.c */ |
1079 | extern struct nouveau_pgraph_object_class nv40_graph_grclass[]; | ||
1080 | extern int nv40_graph_init(struct drm_device *); | 1172 | extern int nv40_graph_init(struct drm_device *); |
1081 | extern void nv40_graph_takedown(struct drm_device *); | 1173 | extern void nv40_graph_takedown(struct drm_device *); |
1082 | extern struct nouveau_channel *nv40_graph_channel(struct drm_device *); | 1174 | extern struct nouveau_channel *nv40_graph_channel(struct drm_device *); |
@@ -1085,11 +1177,9 @@ extern void nv40_graph_destroy_context(struct nouveau_channel *); | |||
1085 | extern int nv40_graph_load_context(struct nouveau_channel *); | 1177 | extern int nv40_graph_load_context(struct nouveau_channel *); |
1086 | extern int nv40_graph_unload_context(struct drm_device *); | 1178 | extern int nv40_graph_unload_context(struct drm_device *); |
1087 | extern void nv40_grctx_init(struct nouveau_grctx *); | 1179 | extern void nv40_grctx_init(struct nouveau_grctx *); |
1088 | extern void nv40_graph_set_region_tiling(struct drm_device *, int, uint32_t, | 1180 | extern void nv40_graph_set_tile_region(struct drm_device *dev, int i); |
1089 | uint32_t, uint32_t); | ||
1090 | 1181 | ||
1091 | /* nv50_graph.c */ | 1182 | /* nv50_graph.c */ |
1092 | extern struct nouveau_pgraph_object_class nv50_graph_grclass[]; | ||
1093 | extern int nv50_graph_init(struct drm_device *); | 1183 | extern int nv50_graph_init(struct drm_device *); |
1094 | extern void nv50_graph_takedown(struct drm_device *); | 1184 | extern void nv50_graph_takedown(struct drm_device *); |
1095 | extern void nv50_graph_fifo_access(struct drm_device *, bool); | 1185 | extern void nv50_graph_fifo_access(struct drm_device *, bool); |
@@ -1098,10 +1188,10 @@ extern int nv50_graph_create_context(struct nouveau_channel *); | |||
1098 | extern void nv50_graph_destroy_context(struct nouveau_channel *); | 1188 | extern void nv50_graph_destroy_context(struct nouveau_channel *); |
1099 | extern int nv50_graph_load_context(struct nouveau_channel *); | 1189 | extern int nv50_graph_load_context(struct nouveau_channel *); |
1100 | extern int nv50_graph_unload_context(struct drm_device *); | 1190 | extern int nv50_graph_unload_context(struct drm_device *); |
1101 | extern void nv50_graph_context_switch(struct drm_device *); | ||
1102 | extern int nv50_grctx_init(struct nouveau_grctx *); | 1191 | extern int nv50_grctx_init(struct nouveau_grctx *); |
1103 | extern void nv50_graph_tlb_flush(struct drm_device *dev); | 1192 | extern void nv50_graph_tlb_flush(struct drm_device *dev); |
1104 | extern void nv86_graph_tlb_flush(struct drm_device *dev); | 1193 | extern void nv86_graph_tlb_flush(struct drm_device *dev); |
1194 | extern struct nouveau_enum nv50_data_error_names[]; | ||
1105 | 1195 | ||
1106 | /* nvc0_graph.c */ | 1196 | /* nvc0_graph.c */ |
1107 | extern int nvc0_graph_init(struct drm_device *); | 1197 | extern int nvc0_graph_init(struct drm_device *); |
@@ -1113,16 +1203,22 @@ extern void nvc0_graph_destroy_context(struct nouveau_channel *); | |||
1113 | extern int nvc0_graph_load_context(struct nouveau_channel *); | 1203 | extern int nvc0_graph_load_context(struct nouveau_channel *); |
1114 | extern int nvc0_graph_unload_context(struct drm_device *); | 1204 | extern int nvc0_graph_unload_context(struct drm_device *); |
1115 | 1205 | ||
1206 | /* nv84_crypt.c */ | ||
1207 | extern int nv84_crypt_init(struct drm_device *dev); | ||
1208 | extern void nv84_crypt_fini(struct drm_device *dev); | ||
1209 | extern int nv84_crypt_create_context(struct nouveau_channel *); | ||
1210 | extern void nv84_crypt_destroy_context(struct nouveau_channel *); | ||
1211 | extern void nv84_crypt_tlb_flush(struct drm_device *dev); | ||
1212 | |||
1116 | /* nv04_instmem.c */ | 1213 | /* nv04_instmem.c */ |
1117 | extern int nv04_instmem_init(struct drm_device *); | 1214 | extern int nv04_instmem_init(struct drm_device *); |
1118 | extern void nv04_instmem_takedown(struct drm_device *); | 1215 | extern void nv04_instmem_takedown(struct drm_device *); |
1119 | extern int nv04_instmem_suspend(struct drm_device *); | 1216 | extern int nv04_instmem_suspend(struct drm_device *); |
1120 | extern void nv04_instmem_resume(struct drm_device *); | 1217 | extern void nv04_instmem_resume(struct drm_device *); |
1121 | extern int nv04_instmem_populate(struct drm_device *, struct nouveau_gpuobj *, | 1218 | extern int nv04_instmem_get(struct nouveau_gpuobj *, u32 size, u32 align); |
1122 | uint32_t *size); | 1219 | extern void nv04_instmem_put(struct nouveau_gpuobj *); |
1123 | extern void nv04_instmem_clear(struct drm_device *, struct nouveau_gpuobj *); | 1220 | extern int nv04_instmem_map(struct nouveau_gpuobj *); |
1124 | extern int nv04_instmem_bind(struct drm_device *, struct nouveau_gpuobj *); | 1221 | extern void nv04_instmem_unmap(struct nouveau_gpuobj *); |
1125 | extern int nv04_instmem_unbind(struct drm_device *, struct nouveau_gpuobj *); | ||
1126 | extern void nv04_instmem_flush(struct drm_device *); | 1222 | extern void nv04_instmem_flush(struct drm_device *); |
1127 | 1223 | ||
1128 | /* nv50_instmem.c */ | 1224 | /* nv50_instmem.c */ |
@@ -1130,26 +1226,18 @@ extern int nv50_instmem_init(struct drm_device *); | |||
1130 | extern void nv50_instmem_takedown(struct drm_device *); | 1226 | extern void nv50_instmem_takedown(struct drm_device *); |
1131 | extern int nv50_instmem_suspend(struct drm_device *); | 1227 | extern int nv50_instmem_suspend(struct drm_device *); |
1132 | extern void nv50_instmem_resume(struct drm_device *); | 1228 | extern void nv50_instmem_resume(struct drm_device *); |
1133 | extern int nv50_instmem_populate(struct drm_device *, struct nouveau_gpuobj *, | 1229 | extern int nv50_instmem_get(struct nouveau_gpuobj *, u32 size, u32 align); |
1134 | uint32_t *size); | 1230 | extern void nv50_instmem_put(struct nouveau_gpuobj *); |
1135 | extern void nv50_instmem_clear(struct drm_device *, struct nouveau_gpuobj *); | 1231 | extern int nv50_instmem_map(struct nouveau_gpuobj *); |
1136 | extern int nv50_instmem_bind(struct drm_device *, struct nouveau_gpuobj *); | 1232 | extern void nv50_instmem_unmap(struct nouveau_gpuobj *); |
1137 | extern int nv50_instmem_unbind(struct drm_device *, struct nouveau_gpuobj *); | ||
1138 | extern void nv50_instmem_flush(struct drm_device *); | 1233 | extern void nv50_instmem_flush(struct drm_device *); |
1139 | extern void nv84_instmem_flush(struct drm_device *); | 1234 | extern void nv84_instmem_flush(struct drm_device *); |
1140 | extern void nv50_vm_flush(struct drm_device *, int engine); | ||
1141 | 1235 | ||
1142 | /* nvc0_instmem.c */ | 1236 | /* nvc0_instmem.c */ |
1143 | extern int nvc0_instmem_init(struct drm_device *); | 1237 | extern int nvc0_instmem_init(struct drm_device *); |
1144 | extern void nvc0_instmem_takedown(struct drm_device *); | 1238 | extern void nvc0_instmem_takedown(struct drm_device *); |
1145 | extern int nvc0_instmem_suspend(struct drm_device *); | 1239 | extern int nvc0_instmem_suspend(struct drm_device *); |
1146 | extern void nvc0_instmem_resume(struct drm_device *); | 1240 | extern void nvc0_instmem_resume(struct drm_device *); |
1147 | extern int nvc0_instmem_populate(struct drm_device *, struct nouveau_gpuobj *, | ||
1148 | uint32_t *size); | ||
1149 | extern void nvc0_instmem_clear(struct drm_device *, struct nouveau_gpuobj *); | ||
1150 | extern int nvc0_instmem_bind(struct drm_device *, struct nouveau_gpuobj *); | ||
1151 | extern int nvc0_instmem_unbind(struct drm_device *, struct nouveau_gpuobj *); | ||
1152 | extern void nvc0_instmem_flush(struct drm_device *); | ||
1153 | 1241 | ||
1154 | /* nv04_mc.c */ | 1242 | /* nv04_mc.c */ |
1155 | extern int nv04_mc_init(struct drm_device *); | 1243 | extern int nv04_mc_init(struct drm_device *); |
@@ -1219,6 +1307,9 @@ extern u16 nouveau_bo_rd16(struct nouveau_bo *nvbo, unsigned index); | |||
1219 | extern void nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val); | 1307 | extern void nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val); |
1220 | extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index); | 1308 | extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index); |
1221 | extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val); | 1309 | extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val); |
1310 | extern void nouveau_bo_fence(struct nouveau_bo *, struct nouveau_fence *); | ||
1311 | extern int nouveau_bo_validate(struct nouveau_bo *, bool interruptible, | ||
1312 | bool no_wait_reserve, bool no_wait_gpu); | ||
1222 | 1313 | ||
1223 | /* nouveau_fence.c */ | 1314 | /* nouveau_fence.c */ |
1224 | struct nouveau_fence; | 1315 | struct nouveau_fence; |
@@ -1234,12 +1325,35 @@ extern void nouveau_fence_work(struct nouveau_fence *fence, | |||
1234 | void (*work)(void *priv, bool signalled), | 1325 | void (*work)(void *priv, bool signalled), |
1235 | void *priv); | 1326 | void *priv); |
1236 | struct nouveau_channel *nouveau_fence_channel(struct nouveau_fence *); | 1327 | struct nouveau_channel *nouveau_fence_channel(struct nouveau_fence *); |
1237 | extern bool nouveau_fence_signalled(void *obj, void *arg); | 1328 | |
1238 | extern int nouveau_fence_wait(void *obj, void *arg, bool lazy, bool intr); | 1329 | extern bool __nouveau_fence_signalled(void *obj, void *arg); |
1330 | extern int __nouveau_fence_wait(void *obj, void *arg, bool lazy, bool intr); | ||
1331 | extern int __nouveau_fence_flush(void *obj, void *arg); | ||
1332 | extern void __nouveau_fence_unref(void **obj); | ||
1333 | extern void *__nouveau_fence_ref(void *obj); | ||
1334 | |||
1335 | static inline bool nouveau_fence_signalled(struct nouveau_fence *obj) | ||
1336 | { | ||
1337 | return __nouveau_fence_signalled(obj, NULL); | ||
1338 | } | ||
1339 | static inline int | ||
1340 | nouveau_fence_wait(struct nouveau_fence *obj, bool lazy, bool intr) | ||
1341 | { | ||
1342 | return __nouveau_fence_wait(obj, NULL, lazy, intr); | ||
1343 | } | ||
1239 | extern int nouveau_fence_sync(struct nouveau_fence *, struct nouveau_channel *); | 1344 | extern int nouveau_fence_sync(struct nouveau_fence *, struct nouveau_channel *); |
1240 | extern int nouveau_fence_flush(void *obj, void *arg); | 1345 | static inline int nouveau_fence_flush(struct nouveau_fence *obj) |
1241 | extern void nouveau_fence_unref(void **obj); | 1346 | { |
1242 | extern void *nouveau_fence_ref(void *obj); | 1347 | return __nouveau_fence_flush(obj, NULL); |
1348 | } | ||
1349 | static inline void nouveau_fence_unref(struct nouveau_fence **obj) | ||
1350 | { | ||
1351 | __nouveau_fence_unref((void **)obj); | ||
1352 | } | ||
1353 | static inline struct nouveau_fence *nouveau_fence_ref(struct nouveau_fence *obj) | ||
1354 | { | ||
1355 | return __nouveau_fence_ref(obj); | ||
1356 | } | ||
1243 | 1357 | ||
1244 | /* nouveau_gem.c */ | 1358 | /* nouveau_gem.c */ |
1245 | extern int nouveau_gem_new(struct drm_device *, struct nouveau_channel *, | 1359 | extern int nouveau_gem_new(struct drm_device *, struct nouveau_channel *, |
@@ -1259,15 +1373,28 @@ extern int nouveau_gem_ioctl_cpu_fini(struct drm_device *, void *, | |||
1259 | extern int nouveau_gem_ioctl_info(struct drm_device *, void *, | 1373 | extern int nouveau_gem_ioctl_info(struct drm_device *, void *, |
1260 | struct drm_file *); | 1374 | struct drm_file *); |
1261 | 1375 | ||
1376 | /* nouveau_display.c */ | ||
1377 | int nouveau_vblank_enable(struct drm_device *dev, int crtc); | ||
1378 | void nouveau_vblank_disable(struct drm_device *dev, int crtc); | ||
1379 | int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, | ||
1380 | struct drm_pending_vblank_event *event); | ||
1381 | int nouveau_finish_page_flip(struct nouveau_channel *, | ||
1382 | struct nouveau_page_flip_state *); | ||
1383 | |||
1262 | /* nv10_gpio.c */ | 1384 | /* nv10_gpio.c */ |
1263 | int nv10_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); | 1385 | int nv10_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); |
1264 | int nv10_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state); | 1386 | int nv10_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state); |
1265 | 1387 | ||
1266 | /* nv50_gpio.c */ | 1388 | /* nv50_gpio.c */ |
1267 | int nv50_gpio_init(struct drm_device *dev); | 1389 | int nv50_gpio_init(struct drm_device *dev); |
1390 | void nv50_gpio_fini(struct drm_device *dev); | ||
1268 | int nv50_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); | 1391 | int nv50_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); |
1269 | int nv50_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state); | 1392 | int nv50_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state); |
1270 | void nv50_gpio_irq_enable(struct drm_device *, enum dcb_gpio_tag, bool on); | 1393 | int nv50_gpio_irq_register(struct drm_device *, enum dcb_gpio_tag, |
1394 | void (*)(void *, int), void *); | ||
1395 | void nv50_gpio_irq_unregister(struct drm_device *, enum dcb_gpio_tag, | ||
1396 | void (*)(void *, int), void *); | ||
1397 | bool nv50_gpio_irq_enable(struct drm_device *, enum dcb_gpio_tag, bool on); | ||
1271 | 1398 | ||
1272 | /* nv50_calc. */ | 1399 | /* nv50_calc. */ |
1273 | int nv50_calc_pll(struct drm_device *, struct pll_lims *, int clk, | 1400 | int nv50_calc_pll(struct drm_device *, struct pll_lims *, int clk, |
@@ -1334,7 +1461,9 @@ static inline void nv_wr08(struct drm_device *dev, unsigned reg, u8 val) | |||
1334 | } | 1461 | } |
1335 | 1462 | ||
1336 | #define nv_wait(dev, reg, mask, val) \ | 1463 | #define nv_wait(dev, reg, mask, val) \ |
1337 | nouveau_wait_until(dev, 2000000000ULL, (reg), (mask), (val)) | 1464 | nouveau_wait_eq(dev, 2000000000ULL, (reg), (mask), (val)) |
1465 | #define nv_wait_ne(dev, reg, mask, val) \ | ||
1466 | nouveau_wait_ne(dev, 2000000000ULL, (reg), (mask), (val)) | ||
1338 | 1467 | ||
1339 | /* PRAMIN access */ | 1468 | /* PRAMIN access */ |
1340 | static inline u32 nv_ri32(struct drm_device *dev, unsigned offset) | 1469 | static inline u32 nv_ri32(struct drm_device *dev, unsigned offset) |
@@ -1447,6 +1576,23 @@ nv_match_device(struct drm_device *dev, unsigned device, | |||
1447 | dev->pdev->subsystem_device == sub_device; | 1576 | dev->pdev->subsystem_device == sub_device; |
1448 | } | 1577 | } |
1449 | 1578 | ||
1579 | /* memory type/access flags, do not match hardware values */ | ||
1580 | #define NV_MEM_ACCESS_RO 1 | ||
1581 | #define NV_MEM_ACCESS_WO 2 | ||
1582 | #define NV_MEM_ACCESS_RW (NV_MEM_ACCESS_RO | NV_MEM_ACCESS_WO) | ||
1583 | #define NV_MEM_ACCESS_SYS 4 | ||
1584 | #define NV_MEM_ACCESS_VM 8 | ||
1585 | |||
1586 | #define NV_MEM_TARGET_VRAM 0 | ||
1587 | #define NV_MEM_TARGET_PCI 1 | ||
1588 | #define NV_MEM_TARGET_PCI_NOSNOOP 2 | ||
1589 | #define NV_MEM_TARGET_VM 3 | ||
1590 | #define NV_MEM_TARGET_GART 4 | ||
1591 | |||
1592 | #define NV_MEM_TYPE_VM 0x7f | ||
1593 | #define NV_MEM_COMP_VM 0x03 | ||
1594 | |||
1595 | /* NV_SW object class */ | ||
1450 | #define NV_SW 0x0000506e | 1596 | #define NV_SW 0x0000506e |
1451 | #define NV_SW_DMA_SEMAPHORE 0x00000060 | 1597 | #define NV_SW_DMA_SEMAPHORE 0x00000060 |
1452 | #define NV_SW_SEMAPHORE_OFFSET 0x00000064 | 1598 | #define NV_SW_SEMAPHORE_OFFSET 0x00000064 |
@@ -1457,5 +1603,6 @@ nv_match_device(struct drm_device *dev, unsigned device, | |||
1457 | #define NV_SW_VBLSEM_OFFSET 0x00000400 | 1603 | #define NV_SW_VBLSEM_OFFSET 0x00000400 |
1458 | #define NV_SW_VBLSEM_RELEASE_VALUE 0x00000404 | 1604 | #define NV_SW_VBLSEM_RELEASE_VALUE 0x00000404 |
1459 | #define NV_SW_VBLSEM_RELEASE 0x00000408 | 1605 | #define NV_SW_VBLSEM_RELEASE 0x00000408 |
1606 | #define NV_SW_PAGE_FLIP 0x00000500 | ||
1460 | 1607 | ||
1461 | #endif /* __NOUVEAU_DRV_H__ */ | 1608 | #endif /* __NOUVEAU_DRV_H__ */ |