diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-07-03 20:47:19 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-09-20 02:05:04 -0400 |
commit | 048a88595a66526f68636b51b1cdb5842bc0f28c (patch) | |
tree | b1d1378c1d6b87c9ab5687f355630697a2a3874a /drivers/gpu/drm | |
parent | 2e9733ff7d4f1c7185bea16041f532d6142ca40a (diff) |
drm/nouveau: make general drm modesetting init common
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_crtc.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_mem.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv04_display.c | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_crtc.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_cursor.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_display.c | 29 |
8 files changed, 32 insertions, 67 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_crtc.h b/drivers/gpu/drm/nouveau/nouveau_crtc.h index cb1ce2a09162..bf8e1289953d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_crtc.h +++ b/drivers/gpu/drm/nouveau/nouveau_crtc.h | |||
@@ -82,14 +82,13 @@ static inline struct drm_crtc *to_drm_crtc(struct nouveau_crtc *crtc) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | int nv50_crtc_create(struct drm_device *dev, int index); | 84 | int nv50_crtc_create(struct drm_device *dev, int index); |
85 | int nv50_cursor_init(struct nouveau_crtc *); | ||
86 | void nv50_cursor_fini(struct nouveau_crtc *); | ||
87 | int nv50_crtc_cursor_set(struct drm_crtc *drm_crtc, struct drm_file *file_priv, | 85 | int nv50_crtc_cursor_set(struct drm_crtc *drm_crtc, struct drm_file *file_priv, |
88 | uint32_t buffer_handle, uint32_t width, | 86 | uint32_t buffer_handle, uint32_t width, |
89 | uint32_t height); | 87 | uint32_t height); |
90 | int nv50_crtc_cursor_move(struct drm_crtc *drm_crtc, int x, int y); | 88 | int nv50_crtc_cursor_move(struct drm_crtc *drm_crtc, int x, int y); |
91 | 89 | ||
92 | int nv04_cursor_init(struct nouveau_crtc *); | 90 | int nv04_cursor_init(struct nouveau_crtc *); |
91 | int nv50_cursor_init(struct nouveau_crtc *); | ||
93 | 92 | ||
94 | struct nouveau_connector * | 93 | struct nouveau_connector * |
95 | nouveau_crtc_connector_get(struct nouveau_crtc *crtc); | 94 | nouveau_crtc_connector_get(struct nouveau_crtc *crtc); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 842cd7acde8a..0661bcc94e57 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -736,7 +736,6 @@ struct drm_nouveau_private { | |||
736 | uint64_t vram_size; | 736 | uint64_t vram_size; |
737 | uint64_t vram_sys_base; | 737 | uint64_t vram_sys_base; |
738 | 738 | ||
739 | uint64_t fb_phys; | ||
740 | uint64_t fb_available_size; | 739 | uint64_t fb_available_size; |
741 | uint64_t fb_mappable_pages; | 740 | uint64_t fb_mappable_pages; |
742 | uint64_t fb_aper_free; | 741 | uint64_t fb_aper_free; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index f9ae2fc3d6f1..bd3c39f69388 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -408,8 +408,6 @@ nouveau_mem_vram_init(struct drm_device *dev) | |||
408 | if (ret) | 408 | if (ret) |
409 | return ret; | 409 | return ret; |
410 | 410 | ||
411 | dev_priv->fb_phys = pci_resource_start(dev->pdev, 1); | ||
412 | |||
413 | ret = nouveau_ttm_global_init(dev_priv); | 411 | ret = nouveau_ttm_global_init(dev_priv); |
414 | if (ret) | 412 | if (ret) |
415 | return ret; | 413 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 07691c2eceac..2d7a4ed60142 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -657,6 +657,26 @@ nouveau_card_init(struct drm_device *dev) | |||
657 | goto out_engine; | 657 | goto out_engine; |
658 | } | 658 | } |
659 | 659 | ||
660 | /* initialise general modesetting */ | ||
661 | drm_mode_config_init(dev); | ||
662 | drm_mode_create_scaling_mode_property(dev); | ||
663 | drm_mode_create_dithering_property(dev); | ||
664 | dev->mode_config.funcs = (void *)&nouveau_mode_config_funcs; | ||
665 | dev->mode_config.fb_base = pci_resource_start(dev->pdev, 1); | ||
666 | dev->mode_config.min_width = 0; | ||
667 | dev->mode_config.min_height = 0; | ||
668 | if (dev_priv->card_type < NV_10) { | ||
669 | dev->mode_config.max_width = 2048; | ||
670 | dev->mode_config.max_height = 2048; | ||
671 | } else | ||
672 | if (dev_priv->card_type < NV_50) { | ||
673 | dev->mode_config.max_width = 4096; | ||
674 | dev->mode_config.max_height = 4096; | ||
675 | } else { | ||
676 | dev->mode_config.max_width = 8192; | ||
677 | dev->mode_config.max_height = 8192; | ||
678 | } | ||
679 | |||
660 | ret = engine->display.create(dev); | 680 | ret = engine->display.create(dev); |
661 | if (ret) | 681 | if (ret) |
662 | goto out_fifo; | 682 | goto out_fifo; |
@@ -747,6 +767,7 @@ static void nouveau_card_takedown(struct drm_device *dev) | |||
747 | } | 767 | } |
748 | 768 | ||
749 | engine->display.destroy(dev); | 769 | engine->display.destroy(dev); |
770 | drm_mode_config_cleanup(dev); | ||
750 | 771 | ||
751 | if (!dev_priv->noaccel) { | 772 | if (!dev_priv->noaccel) { |
752 | engine->fifo.takedown(dev); | 773 | engine->fifo.takedown(dev); |
diff --git a/drivers/gpu/drm/nouveau/nv04_display.c b/drivers/gpu/drm/nouveau/nv04_display.c index 1715e1464b7d..6bd8518d7b2e 100644 --- a/drivers/gpu/drm/nouveau/nv04_display.c +++ b/drivers/gpu/drm/nouveau/nv04_display.c | |||
@@ -126,27 +126,6 @@ nv04_display_create(struct drm_device *dev) | |||
126 | 126 | ||
127 | nouveau_hw_save_vga_fonts(dev, 1); | 127 | nouveau_hw_save_vga_fonts(dev, 1); |
128 | 128 | ||
129 | drm_mode_config_init(dev); | ||
130 | drm_mode_create_scaling_mode_property(dev); | ||
131 | drm_mode_create_dithering_property(dev); | ||
132 | |||
133 | dev->mode_config.funcs = (void *)&nouveau_mode_config_funcs; | ||
134 | |||
135 | dev->mode_config.min_width = 0; | ||
136 | dev->mode_config.min_height = 0; | ||
137 | switch (dev_priv->card_type) { | ||
138 | case NV_04: | ||
139 | dev->mode_config.max_width = 2048; | ||
140 | dev->mode_config.max_height = 2048; | ||
141 | break; | ||
142 | default: | ||
143 | dev->mode_config.max_width = 4096; | ||
144 | dev->mode_config.max_height = 4096; | ||
145 | break; | ||
146 | } | ||
147 | |||
148 | dev->mode_config.fb_base = dev_priv->fb_phys; | ||
149 | |||
150 | nv04_crtc_create(dev, 0); | 129 | nv04_crtc_create(dev, 0); |
151 | if (nv_two_heads(dev)) | 130 | if (nv_two_heads(dev)) |
152 | nv04_crtc_create(dev, 1); | 131 | nv04_crtc_create(dev, 1); |
@@ -235,8 +214,6 @@ nv04_display_destroy(struct drm_device *dev) | |||
235 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | 214 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) |
236 | crtc->funcs->restore(crtc); | 215 | crtc->funcs->restore(crtc); |
237 | 216 | ||
238 | drm_mode_config_cleanup(dev); | ||
239 | |||
240 | nouveau_hw_save_vga_fonts(dev, 0); | 217 | nouveau_hw_save_vga_fonts(dev, 0); |
241 | } | 218 | } |
242 | 219 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index 5d989073ba6e..882080e0b4f5 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
@@ -329,8 +329,6 @@ nv50_crtc_destroy(struct drm_crtc *crtc) | |||
329 | 329 | ||
330 | drm_crtc_cleanup(&nv_crtc->base); | 330 | drm_crtc_cleanup(&nv_crtc->base); |
331 | 331 | ||
332 | nv50_cursor_fini(nv_crtc); | ||
333 | |||
334 | nouveau_bo_unmap(nv_crtc->lut.nvbo); | 332 | nouveau_bo_unmap(nv_crtc->lut.nvbo); |
335 | nouveau_bo_ref(NULL, &nv_crtc->lut.nvbo); | 333 | nouveau_bo_ref(NULL, &nv_crtc->lut.nvbo); |
336 | nouveau_bo_unmap(nv_crtc->cursor.nvbo); | 334 | nouveau_bo_unmap(nv_crtc->cursor.nvbo); |
diff --git a/drivers/gpu/drm/nouveau/nv50_cursor.c b/drivers/gpu/drm/nouveau/nv50_cursor.c index 9752c35bb84b..adfc9b607a50 100644 --- a/drivers/gpu/drm/nouveau/nv50_cursor.c +++ b/drivers/gpu/drm/nouveau/nv50_cursor.c | |||
@@ -137,21 +137,3 @@ nv50_cursor_init(struct nouveau_crtc *nv_crtc) | |||
137 | nv_crtc->cursor.show = nv50_cursor_show; | 137 | nv_crtc->cursor.show = nv50_cursor_show; |
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
140 | |||
141 | void | ||
142 | nv50_cursor_fini(struct nouveau_crtc *nv_crtc) | ||
143 | { | ||
144 | struct drm_device *dev = nv_crtc->base.dev; | ||
145 | int idx = nv_crtc->index; | ||
146 | |||
147 | NV_DEBUG_KMS(dev, "\n"); | ||
148 | |||
149 | nv_wr32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx), 0); | ||
150 | if (!nv_wait(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx), | ||
151 | NV50_PDISPLAY_CURSOR_CURSOR_CTRL2_STATUS, 0)) { | ||
152 | NV_ERROR(dev, "timeout: CURSOR_CTRL2_STATUS == 0\n"); | ||
153 | NV_ERROR(dev, "CURSOR_CTRL2 = 0x%08x\n", | ||
154 | nv_rd32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx))); | ||
155 | } | ||
156 | } | ||
157 | |||
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index db1a5f4b711d..5754c0ac8937 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -247,6 +247,16 @@ static int nv50_display_disable(struct drm_device *dev) | |||
247 | } | 247 | } |
248 | } | 248 | } |
249 | 249 | ||
250 | for (i = 0; i < 2; i++) { | ||
251 | nv_wr32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i), 0); | ||
252 | if (!nv_wait(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i), | ||
253 | NV50_PDISPLAY_CURSOR_CURSOR_CTRL2_STATUS, 0)) { | ||
254 | NV_ERROR(dev, "timeout: CURSOR_CTRL2_STATUS == 0\n"); | ||
255 | NV_ERROR(dev, "CURSOR_CTRL2 = 0x%08x\n", | ||
256 | nv_rd32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i))); | ||
257 | } | ||
258 | } | ||
259 | |||
250 | nv50_evo_fini(dev); | 260 | nv50_evo_fini(dev); |
251 | 261 | ||
252 | for (i = 0; i < 3; i++) { | 262 | for (i = 0; i < 3; i++) { |
@@ -286,23 +296,6 @@ int nv50_display_create(struct drm_device *dev) | |||
286 | return -ENOMEM; | 296 | return -ENOMEM; |
287 | dev_priv->engine.display.priv = priv; | 297 | dev_priv->engine.display.priv = priv; |
288 | 298 | ||
289 | /* init basic kernel modesetting */ | ||
290 | drm_mode_config_init(dev); | ||
291 | |||
292 | /* Initialise some optional connector properties. */ | ||
293 | drm_mode_create_scaling_mode_property(dev); | ||
294 | drm_mode_create_dithering_property(dev); | ||
295 | |||
296 | dev->mode_config.min_width = 0; | ||
297 | dev->mode_config.min_height = 0; | ||
298 | |||
299 | dev->mode_config.funcs = (void *)&nouveau_mode_config_funcs; | ||
300 | |||
301 | dev->mode_config.max_width = 8192; | ||
302 | dev->mode_config.max_height = 8192; | ||
303 | |||
304 | dev->mode_config.fb_base = dev_priv->fb_phys; | ||
305 | |||
306 | /* Create CRTC objects */ | 299 | /* Create CRTC objects */ |
307 | for (i = 0; i < 2; i++) | 300 | for (i = 0; i < 2; i++) |
308 | nv50_crtc_create(dev, i); | 301 | nv50_crtc_create(dev, i); |
@@ -364,8 +357,6 @@ nv50_display_destroy(struct drm_device *dev) | |||
364 | 357 | ||
365 | NV_DEBUG_KMS(dev, "\n"); | 358 | NV_DEBUG_KMS(dev, "\n"); |
366 | 359 | ||
367 | drm_mode_config_cleanup(dev); | ||
368 | |||
369 | nv50_display_disable(dev); | 360 | nv50_display_disable(dev); |
370 | nouveau_irq_unregister(dev, 26); | 361 | nouveau_irq_unregister(dev, 26); |
371 | kfree(disp); | 362 | kfree(disp); |