diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2010-05-16 11:27:03 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-05-18 02:19:27 -0400 |
commit | 1471ca9aa71cd37b6a7476bb6f06a3a8622ea1bd (patch) | |
tree | 3bf5ef9fea79b0b92220cfcc3842db7afb5cd63d /drivers/gpu/drm/nouveau/nouveau_fbcon.c | |
parent | 3da1f33e79a5922c1a31077e7b33aba1cec19b94 (diff) |
fbdev: allow passing more than one aperture for handoff
It removes a hack from nouveau code which had to detect which
region to pass to kick vesafb/efifb.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Peter Jones <pjones@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_fbcon.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_fbcon.c | 84 |
1 files changed, 25 insertions, 59 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index f29fa8c117ce..292c7ff95105 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -152,44 +152,6 @@ static void nouveau_fbcon_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, | |||
152 | *blue = nv_crtc->lut.b[regno]; | 152 | *blue = nv_crtc->lut.b[regno]; |
153 | } | 153 | } |
154 | 154 | ||
155 | #if defined(__i386__) || defined(__x86_64__) | ||
156 | static bool | ||
157 | nouveau_fbcon_has_vesafb_or_efifb(struct drm_device *dev) | ||
158 | { | ||
159 | struct pci_dev *pdev = dev->pdev; | ||
160 | int ramin; | ||
161 | |||
162 | if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB && | ||
163 | screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) | ||
164 | return false; | ||
165 | |||
166 | if (screen_info.lfb_base < pci_resource_start(pdev, 1)) | ||
167 | goto not_fb; | ||
168 | |||
169 | if (screen_info.lfb_base + screen_info.lfb_size >= | ||
170 | pci_resource_start(pdev, 1) + pci_resource_len(pdev, 1)) | ||
171 | goto not_fb; | ||
172 | |||
173 | return true; | ||
174 | not_fb: | ||
175 | ramin = 2; | ||
176 | if (pci_resource_len(pdev, ramin) == 0) { | ||
177 | ramin = 3; | ||
178 | if (pci_resource_len(pdev, ramin) == 0) | ||
179 | return false; | ||
180 | } | ||
181 | |||
182 | if (screen_info.lfb_base < pci_resource_start(pdev, ramin)) | ||
183 | return false; | ||
184 | |||
185 | if (screen_info.lfb_base + screen_info.lfb_size >= | ||
186 | pci_resource_start(pdev, ramin) + pci_resource_len(pdev, ramin)) | ||
187 | return false; | ||
188 | |||
189 | return true; | ||
190 | } | ||
191 | #endif | ||
192 | |||
193 | static void | 155 | static void |
194 | nouveau_fbcon_zfill(struct drm_device *dev, struct nouveau_fbdev *nfbdev) | 156 | nouveau_fbcon_zfill(struct drm_device *dev, struct nouveau_fbdev *nfbdev) |
195 | { | 157 | { |
@@ -219,7 +181,9 @@ nouveau_fbcon_create(struct nouveau_fbdev *nfbdev, | |||
219 | struct nouveau_framebuffer *nouveau_fb; | 181 | struct nouveau_framebuffer *nouveau_fb; |
220 | struct nouveau_bo *nvbo; | 182 | struct nouveau_bo *nvbo; |
221 | struct drm_mode_fb_cmd mode_cmd; | 183 | struct drm_mode_fb_cmd mode_cmd; |
222 | struct device *device = &dev->pdev->dev; | 184 | struct pci_dev *pdev = dev->pdev; |
185 | struct device *device = &pdev->dev; | ||
186 | struct apertures_struct *aper; | ||
223 | int size, ret; | 187 | int size, ret; |
224 | 188 | ||
225 | mode_cmd.width = sizes->surface_width; | 189 | mode_cmd.width = sizes->surface_width; |
@@ -299,28 +263,30 @@ nouveau_fbcon_create(struct nouveau_fbdev *nfbdev, | |||
299 | drm_fb_helper_fill_var(info, &nfbdev->helper, sizes->fb_width, sizes->fb_height); | 263 | drm_fb_helper_fill_var(info, &nfbdev->helper, sizes->fb_width, sizes->fb_height); |
300 | 264 | ||
301 | /* FIXME: we really shouldn't expose mmio space at all */ | 265 | /* FIXME: we really shouldn't expose mmio space at all */ |
302 | info->fix.mmio_start = pci_resource_start(dev->pdev, 1); | 266 | info->fix.mmio_start = pci_resource_start(pdev, 1); |
303 | info->fix.mmio_len = pci_resource_len(dev->pdev, 1); | 267 | info->fix.mmio_len = pci_resource_len(pdev, 1); |
304 | 268 | ||
305 | /* Set aperture base/size for vesafb takeover */ | 269 | /* Set aperture base/size for vesafb takeover */ |
306 | #if defined(__i386__) || defined(__x86_64__) | 270 | aper = info->apertures = alloc_apertures(3); |
307 | if (nouveau_fbcon_has_vesafb_or_efifb(dev)) { | 271 | if (!info->apertures) { |
308 | /* Some NVIDIA VBIOS' are stupid and decide to put the | 272 | ret = -ENOMEM; |
309 | * framebuffer in the middle of the PRAMIN BAR for | 273 | goto out_unref; |
310 | * whatever reason. We need to know the exact lfb_base | 274 | } |
311 | * to get vesafb kicked off, and the only reliable way | 275 | |
312 | * we have left is to find out lfb_base the same way | 276 | aper->ranges[0].base = pci_resource_start(pdev, 1); |
313 | * vesafb did. | 277 | aper->ranges[0].size = pci_resource_len(pdev, 1); |
314 | */ | 278 | aper->count = 1; |
315 | info->aperture_base = screen_info.lfb_base; | 279 | |
316 | info->aperture_size = screen_info.lfb_size; | 280 | if (pci_resource_len(pdev, 2)) { |
317 | if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB) | 281 | aper->ranges[aper->count].base = pci_resource_start(pdev, 2); |
318 | info->aperture_size *= 65536; | 282 | aper->ranges[aper->count].size = pci_resource_len(pdev, 2); |
319 | } else | 283 | aper->count++; |
320 | #endif | 284 | } |
321 | { | 285 | |
322 | info->aperture_base = info->fix.mmio_start; | 286 | if (pci_resource_len(pdev, 3)) { |
323 | info->aperture_size = info->fix.mmio_len; | 287 | aper->ranges[aper->count].base = pci_resource_start(pdev, 3); |
288 | aper->ranges[aper->count].size = pci_resource_len(pdev, 3); | ||
289 | aper->count++; | ||
324 | } | 290 | } |
325 | 291 | ||
326 | info->pixmap.size = 64*1024; | 292 | info->pixmap.size = 64*1024; |