diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-10-05 22:46:40 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-12-21 04:01:16 -0500 |
commit | 27d5030a235d89842ed70e18d924f017b34a496d (patch) | |
tree | 688eeb2c6139b79bf793447994c90d2184c60442 /drivers/gpu/drm/nouveau | |
parent | 549cd872b0777bd72a66daa56558af28ec20d8a5 (diff) |
drm/nouveau: move master modesetting init to nouveau_display
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_display.c | 47 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_fb.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 27 |
4 files changed, 51 insertions, 27 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 7e88cd7f2b99..017d4ea12b1e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -147,12 +147,57 @@ nouveau_user_framebuffer_create(struct drm_device *dev, | |||
147 | return &nouveau_fb->base; | 147 | return &nouveau_fb->base; |
148 | } | 148 | } |
149 | 149 | ||
150 | const struct drm_mode_config_funcs nouveau_mode_config_funcs = { | 150 | static const struct drm_mode_config_funcs nouveau_mode_config_funcs = { |
151 | .fb_create = nouveau_user_framebuffer_create, | 151 | .fb_create = nouveau_user_framebuffer_create, |
152 | .output_poll_changed = nouveau_fbcon_output_poll_changed, | 152 | .output_poll_changed = nouveau_fbcon_output_poll_changed, |
153 | }; | 153 | }; |
154 | 154 | ||
155 | int | 155 | int |
156 | nouveau_display_create(struct drm_device *dev) | ||
157 | { | ||
158 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
159 | struct nouveau_display_engine *disp = &dev_priv->engine.display; | ||
160 | int ret; | ||
161 | |||
162 | drm_mode_config_init(dev); | ||
163 | drm_mode_create_scaling_mode_property(dev); | ||
164 | drm_mode_create_dithering_property(dev); | ||
165 | |||
166 | dev->mode_config.funcs = (void *)&nouveau_mode_config_funcs; | ||
167 | dev->mode_config.fb_base = pci_resource_start(dev->pdev, 1); | ||
168 | |||
169 | dev->mode_config.min_width = 0; | ||
170 | dev->mode_config.min_height = 0; | ||
171 | if (dev_priv->card_type < NV_10) { | ||
172 | dev->mode_config.max_width = 2048; | ||
173 | dev->mode_config.max_height = 2048; | ||
174 | } else | ||
175 | if (dev_priv->card_type < NV_50) { | ||
176 | dev->mode_config.max_width = 4096; | ||
177 | dev->mode_config.max_height = 4096; | ||
178 | } else { | ||
179 | dev->mode_config.max_width = 8192; | ||
180 | dev->mode_config.max_height = 8192; | ||
181 | } | ||
182 | |||
183 | ret = disp->create(dev); | ||
184 | if (ret) | ||
185 | return ret; | ||
186 | |||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | void | ||
191 | nouveau_display_destroy(struct drm_device *dev) | ||
192 | { | ||
193 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
194 | struct nouveau_display_engine *disp = &dev_priv->engine.display; | ||
195 | |||
196 | disp->destroy(dev); | ||
197 | drm_mode_config_cleanup(dev); | ||
198 | } | ||
199 | |||
200 | int | ||
156 | nouveau_vblank_enable(struct drm_device *dev, int crtc) | 201 | nouveau_vblank_enable(struct drm_device *dev, int crtc) |
157 | { | 202 | { |
158 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 203 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index c99490d6ee7c..a55bae1e1e50 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -1442,6 +1442,8 @@ extern int nouveau_gem_ioctl_info(struct drm_device *, void *, | |||
1442 | struct drm_file *); | 1442 | struct drm_file *); |
1443 | 1443 | ||
1444 | /* nouveau_display.c */ | 1444 | /* nouveau_display.c */ |
1445 | int nouveau_display_create(struct drm_device *dev); | ||
1446 | void nouveau_display_destroy(struct drm_device *dev); | ||
1445 | int nouveau_vblank_enable(struct drm_device *dev, int crtc); | 1447 | int nouveau_vblank_enable(struct drm_device *dev, int crtc); |
1446 | void nouveau_vblank_disable(struct drm_device *dev, int crtc); | 1448 | void nouveau_vblank_disable(struct drm_device *dev, int crtc); |
1447 | int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, | 1449 | int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fb.h b/drivers/gpu/drm/nouveau/nouveau_fb.h index f4dd30150879..f3fb649fe454 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fb.h +++ b/drivers/gpu/drm/nouveau/nouveau_fb.h | |||
@@ -42,8 +42,6 @@ nouveau_framebuffer(struct drm_framebuffer *fb) | |||
42 | return container_of(fb, struct nouveau_framebuffer, base); | 42 | return container_of(fb, struct nouveau_framebuffer, base); |
43 | } | 43 | } |
44 | 44 | ||
45 | extern const struct drm_mode_config_funcs nouveau_mode_config_funcs; | ||
46 | |||
47 | int nouveau_framebuffer_init(struct drm_device *dev, struct nouveau_framebuffer *nouveau_fb, | 45 | int nouveau_framebuffer_init(struct drm_device *dev, struct nouveau_framebuffer *nouveau_fb, |
48 | struct drm_mode_fb_cmd2 *mode_cmd, struct nouveau_bo *nvbo); | 46 | struct drm_mode_fb_cmd2 *mode_cmd, struct nouveau_bo *nvbo); |
49 | #endif /* __NOUVEAU_FB_H__ */ | 47 | #endif /* __NOUVEAU_FB_H__ */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 3d5cf6bb1c74..f3ee58283af0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -733,27 +733,7 @@ nouveau_card_init(struct drm_device *dev) | |||
733 | if (ret) | 733 | if (ret) |
734 | goto out_fifo; | 734 | goto out_fifo; |
735 | 735 | ||
736 | /* initialise general modesetting */ | 736 | ret = nouveau_display_create(dev); |
737 | drm_mode_config_init(dev); | ||
738 | drm_mode_create_scaling_mode_property(dev); | ||
739 | drm_mode_create_dithering_property(dev); | ||
740 | dev->mode_config.funcs = (void *)&nouveau_mode_config_funcs; | ||
741 | dev->mode_config.fb_base = pci_resource_start(dev->pdev, 1); | ||
742 | dev->mode_config.min_width = 0; | ||
743 | dev->mode_config.min_height = 0; | ||
744 | if (dev_priv->card_type < NV_10) { | ||
745 | dev->mode_config.max_width = 2048; | ||
746 | dev->mode_config.max_height = 2048; | ||
747 | } else | ||
748 | if (dev_priv->card_type < NV_50) { | ||
749 | dev->mode_config.max_width = 4096; | ||
750 | dev->mode_config.max_height = 4096; | ||
751 | } else { | ||
752 | dev->mode_config.max_width = 8192; | ||
753 | dev->mode_config.max_height = 8192; | ||
754 | } | ||
755 | |||
756 | ret = engine->display.create(dev); | ||
757 | if (ret) | 737 | if (ret) |
758 | goto out_irq; | 738 | goto out_irq; |
759 | 739 | ||
@@ -789,7 +769,7 @@ out_fence: | |||
789 | nouveau_fence_fini(dev); | 769 | nouveau_fence_fini(dev); |
790 | out_disp: | 770 | out_disp: |
791 | nouveau_backlight_exit(dev); | 771 | nouveau_backlight_exit(dev); |
792 | engine->display.destroy(dev); | 772 | nouveau_display_destroy(dev); |
793 | out_irq: | 773 | out_irq: |
794 | nouveau_irq_fini(dev); | 774 | nouveau_irq_fini(dev); |
795 | out_fifo: | 775 | out_fifo: |
@@ -850,8 +830,7 @@ static void nouveau_card_takedown(struct drm_device *dev) | |||
850 | } | 830 | } |
851 | 831 | ||
852 | nouveau_backlight_exit(dev); | 832 | nouveau_backlight_exit(dev); |
853 | engine->display.destroy(dev); | 833 | nouveau_display_destroy(dev); |
854 | drm_mode_config_cleanup(dev); | ||
855 | 834 | ||
856 | if (!dev_priv->noaccel) { | 835 | if (!dev_priv->noaccel) { |
857 | engine->fifo.takedown(dev); | 836 | engine->fifo.takedown(dev); |