diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-07-11 05:05:01 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-10-02 23:12:49 -0400 |
commit | 861d21074bbb141b0cc165a61c11f571571cda12 (patch) | |
tree | fd5755cab318f77276044a40bcc274a6f8fe1ec1 /drivers/gpu/drm/nouveau/nouveau_drv.h | |
parent | 0134a97979a0abc1c756b0fe491e074693c2bdf5 (diff) |
drm/nouveau/fb: merge fb/vram and port to subdev interfaces
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_drv.h')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 146 |
1 files changed, 17 insertions, 129 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index b4595990f5e8..c7bc6ecad601 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -45,6 +45,23 @@ | |||
45 | #include "ttm/ttm_memory.h" | 45 | #include "ttm/ttm_memory.h" |
46 | #include "ttm/ttm_module.h" | 46 | #include "ttm/ttm_module.h" |
47 | 47 | ||
48 | #define XXX_THIS_IS_A_HACK | ||
49 | #include <subdev/fb.h> | ||
50 | |||
51 | enum blah { | ||
52 | NV_MEM_TYPE_UNKNOWN = 0, | ||
53 | NV_MEM_TYPE_STOLEN, | ||
54 | NV_MEM_TYPE_SGRAM, | ||
55 | NV_MEM_TYPE_SDRAM, | ||
56 | NV_MEM_TYPE_DDR1, | ||
57 | NV_MEM_TYPE_DDR2, | ||
58 | NV_MEM_TYPE_DDR3, | ||
59 | NV_MEM_TYPE_GDDR2, | ||
60 | NV_MEM_TYPE_GDDR3, | ||
61 | NV_MEM_TYPE_GDDR4, | ||
62 | NV_MEM_TYPE_GDDR5 | ||
63 | }; | ||
64 | |||
48 | struct nouveau_fpriv { | 65 | struct nouveau_fpriv { |
49 | spinlock_t lock; | 66 | spinlock_t lock; |
50 | struct list_head channels; | 67 | struct list_head channels; |
@@ -76,29 +93,8 @@ struct nouveau_mem; | |||
76 | #define NOUVEAU_MAX_CHANNEL_NR 4096 | 93 | #define NOUVEAU_MAX_CHANNEL_NR 4096 |
77 | #define NOUVEAU_MAX_TILE_NR 15 | 94 | #define NOUVEAU_MAX_TILE_NR 15 |
78 | 95 | ||
79 | struct nouveau_mem { | ||
80 | struct drm_device *dev; | ||
81 | |||
82 | struct nouveau_vma bar_vma; | ||
83 | struct nouveau_vma vma[2]; | ||
84 | u8 page_shift; | ||
85 | |||
86 | struct drm_mm_node *tag; | ||
87 | struct list_head regions; | ||
88 | dma_addr_t *pages; | ||
89 | u32 memtype; | ||
90 | u64 offset; | ||
91 | u64 size; | ||
92 | struct sg_table *sg; | ||
93 | }; | ||
94 | |||
95 | struct nouveau_tile_reg { | 96 | struct nouveau_tile_reg { |
96 | bool used; | 97 | bool used; |
97 | uint32_t addr; | ||
98 | uint32_t limit; | ||
99 | uint32_t pitch; | ||
100 | uint32_t zcomp; | ||
101 | struct drm_mm_node *tag_mem; | ||
102 | struct nouveau_fence *fence; | 98 | struct nouveau_fence *fence; |
103 | }; | 99 | }; |
104 | 100 | ||
@@ -324,21 +320,6 @@ struct nouveau_instmem_engine { | |||
324 | void (*flush)(struct drm_device *); | 320 | void (*flush)(struct drm_device *); |
325 | }; | 321 | }; |
326 | 322 | ||
327 | struct nouveau_fb_engine { | ||
328 | int num_tiles; | ||
329 | struct drm_mm tag_heap; | ||
330 | void *priv; | ||
331 | |||
332 | int (*init)(struct drm_device *dev); | ||
333 | void (*takedown)(struct drm_device *dev); | ||
334 | |||
335 | void (*init_tile_region)(struct drm_device *dev, int i, | ||
336 | uint32_t addr, uint32_t size, | ||
337 | uint32_t pitch, uint32_t flags); | ||
338 | void (*set_tile_region)(struct drm_device *dev, int i); | ||
339 | void (*free_tile_region)(struct drm_device *dev, int i); | ||
340 | }; | ||
341 | |||
342 | struct nouveau_display_engine { | 323 | struct nouveau_display_engine { |
343 | void *priv; | 324 | void *priv; |
344 | int (*early_init)(struct drm_device *); | 325 | int (*early_init)(struct drm_device *); |
@@ -519,24 +500,10 @@ struct nouveau_pm_engine { | |||
519 | int (*temp_get)(struct drm_device *); | 500 | int (*temp_get)(struct drm_device *); |
520 | }; | 501 | }; |
521 | 502 | ||
522 | struct nouveau_vram_engine { | ||
523 | struct nouveau_mm mm; | ||
524 | |||
525 | int (*init)(struct drm_device *); | ||
526 | void (*takedown)(struct drm_device *dev); | ||
527 | int (*get)(struct drm_device *, u64, u32 align, u32 size_nc, | ||
528 | u32 type, struct nouveau_mem **); | ||
529 | void (*put)(struct drm_device *, struct nouveau_mem **); | ||
530 | |||
531 | bool (*flags_valid)(struct drm_device *, u32 tile_flags); | ||
532 | }; | ||
533 | |||
534 | struct nouveau_engine { | 503 | struct nouveau_engine { |
535 | struct nouveau_instmem_engine instmem; | 504 | struct nouveau_instmem_engine instmem; |
536 | struct nouveau_fb_engine fb; | ||
537 | struct nouveau_display_engine display; | 505 | struct nouveau_display_engine display; |
538 | struct nouveau_pm_engine pm; | 506 | struct nouveau_pm_engine pm; |
539 | struct nouveau_vram_engine vram; | ||
540 | }; | 507 | }; |
541 | 508 | ||
542 | enum nv04_fp_display_regs { | 509 | enum nv04_fp_display_regs { |
@@ -714,24 +681,6 @@ struct drm_nouveau_private { | |||
714 | spinlock_t lock; | 681 | spinlock_t lock; |
715 | } tile; | 682 | } tile; |
716 | 683 | ||
717 | /* VRAM/fb configuration */ | ||
718 | enum { | ||
719 | NV_MEM_TYPE_UNKNOWN = 0, | ||
720 | NV_MEM_TYPE_STOLEN, | ||
721 | NV_MEM_TYPE_SGRAM, | ||
722 | NV_MEM_TYPE_SDRAM, | ||
723 | NV_MEM_TYPE_DDR1, | ||
724 | NV_MEM_TYPE_DDR2, | ||
725 | NV_MEM_TYPE_DDR3, | ||
726 | NV_MEM_TYPE_GDDR2, | ||
727 | NV_MEM_TYPE_GDDR3, | ||
728 | NV_MEM_TYPE_GDDR4, | ||
729 | NV_MEM_TYPE_GDDR5 | ||
730 | } vram_type; | ||
731 | uint64_t vram_size; | ||
732 | uint64_t vram_sys_base; | ||
733 | bool vram_rank_B; | ||
734 | |||
735 | uint64_t fb_available_size; | 684 | uint64_t fb_available_size; |
736 | uint64_t fb_mappable_pages; | 685 | uint64_t fb_mappable_pages; |
737 | uint64_t fb_aper_free; | 686 | uint64_t fb_aper_free; |
@@ -1047,55 +996,6 @@ int nouveau_ttm_mmap(struct file *, struct vm_area_struct *); | |||
1047 | /* nouveau_hdmi.c */ | 996 | /* nouveau_hdmi.c */ |
1048 | void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *); | 997 | void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *); |
1049 | 998 | ||
1050 | /* nv04_fb.c */ | ||
1051 | extern int nv04_fb_vram_init(struct drm_device *); | ||
1052 | extern int nv04_fb_init(struct drm_device *); | ||
1053 | extern void nv04_fb_takedown(struct drm_device *); | ||
1054 | |||
1055 | /* nv10_fb.c */ | ||
1056 | extern int nv10_fb_vram_init(struct drm_device *dev); | ||
1057 | extern int nv1a_fb_vram_init(struct drm_device *dev); | ||
1058 | extern int nv10_fb_init(struct drm_device *); | ||
1059 | extern void nv10_fb_takedown(struct drm_device *); | ||
1060 | extern void nv10_fb_init_tile_region(struct drm_device *dev, int i, | ||
1061 | uint32_t addr, uint32_t size, | ||
1062 | uint32_t pitch, uint32_t flags); | ||
1063 | extern void nv10_fb_set_tile_region(struct drm_device *dev, int i); | ||
1064 | extern void nv10_fb_free_tile_region(struct drm_device *dev, int i); | ||
1065 | |||
1066 | /* nv20_fb.c */ | ||
1067 | extern int nv20_fb_vram_init(struct drm_device *dev); | ||
1068 | extern int nv20_fb_init(struct drm_device *); | ||
1069 | extern void nv20_fb_takedown(struct drm_device *); | ||
1070 | extern void nv20_fb_init_tile_region(struct drm_device *dev, int i, | ||
1071 | uint32_t addr, uint32_t size, | ||
1072 | uint32_t pitch, uint32_t flags); | ||
1073 | extern void nv20_fb_set_tile_region(struct drm_device *dev, int i); | ||
1074 | extern void nv20_fb_free_tile_region(struct drm_device *dev, int i); | ||
1075 | |||
1076 | /* nv30_fb.c */ | ||
1077 | extern int nv30_fb_init(struct drm_device *); | ||
1078 | extern void nv30_fb_takedown(struct drm_device *); | ||
1079 | extern void nv30_fb_init_tile_region(struct drm_device *dev, int i, | ||
1080 | uint32_t addr, uint32_t size, | ||
1081 | uint32_t pitch, uint32_t flags); | ||
1082 | extern void nv30_fb_free_tile_region(struct drm_device *dev, int i); | ||
1083 | |||
1084 | /* nv40_fb.c */ | ||
1085 | extern int nv40_fb_vram_init(struct drm_device *dev); | ||
1086 | extern int nv40_fb_init(struct drm_device *); | ||
1087 | extern void nv40_fb_takedown(struct drm_device *); | ||
1088 | extern void nv40_fb_set_tile_region(struct drm_device *dev, int i); | ||
1089 | |||
1090 | /* nv50_fb.c */ | ||
1091 | extern int nv50_fb_init(struct drm_device *); | ||
1092 | extern void nv50_fb_takedown(struct drm_device *); | ||
1093 | extern void nv50_fb_vm_trap(struct drm_device *, int display); | ||
1094 | |||
1095 | /* nvc0_fb.c */ | ||
1096 | extern int nvc0_fb_init(struct drm_device *); | ||
1097 | extern void nvc0_fb_takedown(struct drm_device *); | ||
1098 | |||
1099 | /* nv04_graph.c */ | 999 | /* nv04_graph.c */ |
1100 | extern int nv04_graph_create(struct drm_device *); | 1000 | extern int nv04_graph_create(struct drm_device *); |
1101 | extern int nv04_graph_object_new(struct nouveau_channel *, int, u32, u16); | 1001 | extern int nv04_graph_object_new(struct nouveau_channel *, int, u32, u16); |
@@ -1488,18 +1388,6 @@ nv44_graph_class(struct drm_device *dev) | |||
1488 | return !(0x0baf & (1 << (dev_priv->chipset & 0x0f))); | 1388 | return !(0x0baf & (1 << (dev_priv->chipset & 0x0f))); |
1489 | } | 1389 | } |
1490 | 1390 | ||
1491 | int nv50_vram_init(struct drm_device *); | ||
1492 | void nv50_vram_fini(struct drm_device *); | ||
1493 | int nv50_vram_new(struct drm_device *, u64 size, u32 align, u32 size_nc, | ||
1494 | u32 memtype, struct nouveau_mem **); | ||
1495 | void nv50_vram_del(struct drm_device *, struct nouveau_mem **); | ||
1496 | bool nv50_vram_flags_valid(struct drm_device *, u32 tile_flags); | ||
1497 | |||
1498 | int nvc0_vram_init(struct drm_device *); | ||
1499 | int nvc0_vram_new(struct drm_device *, u64 size, u32 align, u32 ncmin, | ||
1500 | u32 memtype, struct nouveau_mem **); | ||
1501 | bool nvc0_vram_flags_valid(struct drm_device *, u32 tile_flags); | ||
1502 | |||
1503 | /* memory type/access flags, do not match hardware values */ | 1391 | /* memory type/access flags, do not match hardware values */ |
1504 | #define NV_MEM_ACCESS_RO 1 | 1392 | #define NV_MEM_ACCESS_RO 1 |
1505 | #define NV_MEM_ACCESS_WO 2 | 1393 | #define NV_MEM_ACCESS_WO 2 |