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/video | |
| 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/video')
| -rw-r--r-- | drivers/video/efifb.c | 11 | ||||
| -rw-r--r-- | drivers/video/fbmem.c | 29 | ||||
| -rw-r--r-- | drivers/video/fbsysfs.c | 1 | ||||
| -rw-r--r-- | drivers/video/offb.c | 28 | ||||
| -rw-r--r-- | drivers/video/vesafb.c | 11 |
5 files changed, 60 insertions, 20 deletions
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c index 581d2dbf675a..3b986567111a 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/efifb.c | |||
| @@ -165,7 +165,7 @@ static void efifb_destroy(struct fb_info *info) | |||
| 165 | { | 165 | { |
| 166 | if (info->screen_base) | 166 | if (info->screen_base) |
| 167 | iounmap(info->screen_base); | 167 | iounmap(info->screen_base); |
| 168 | release_mem_region(info->aperture_base, info->aperture_size); | 168 | release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); |
| 169 | framebuffer_release(info); | 169 | framebuffer_release(info); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| @@ -289,8 +289,13 @@ static int __devinit efifb_probe(struct platform_device *dev) | |||
| 289 | info->pseudo_palette = info->par; | 289 | info->pseudo_palette = info->par; |
| 290 | info->par = NULL; | 290 | info->par = NULL; |
| 291 | 291 | ||
| 292 | info->aperture_base = efifb_fix.smem_start; | 292 | info->apertures = alloc_apertures(1); |
| 293 | info->aperture_size = size_remap; | 293 | if (!info->apertures) { |
| 294 | err = -ENOMEM; | ||
| 295 | goto err_release_fb; | ||
| 296 | } | ||
| 297 | info->apertures->ranges[0].base = efifb_fix.smem_start; | ||
| 298 | info->apertures->ranges[0].size = size_remap; | ||
| 294 | 299 | ||
| 295 | info->screen_base = ioremap(efifb_fix.smem_start, efifb_fix.smem_len); | 300 | info->screen_base = ioremap(efifb_fix.smem_start, efifb_fix.smem_len); |
| 296 | if (!info->screen_base) { | 301 | if (!info->screen_base) { |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index a15b44e9c003..03f2dc2470b5 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
| @@ -1468,16 +1468,39 @@ static int fb_check_foreignness(struct fb_info *fi) | |||
| 1468 | return 0; | 1468 | return 0; |
| 1469 | } | 1469 | } |
| 1470 | 1470 | ||
| 1471 | static bool fb_do_apertures_overlap(struct fb_info *gen, struct fb_info *hw) | 1471 | static bool apertures_overlap(struct aperture *gen, struct aperture *hw) |
| 1472 | { | 1472 | { |
| 1473 | /* is the generic aperture base the same as the HW one */ | 1473 | /* is the generic aperture base the same as the HW one */ |
| 1474 | if (gen->aperture_base == hw->aperture_base) | 1474 | if (gen->base == hw->base) |
| 1475 | return true; | 1475 | return true; |
| 1476 | /* is the generic aperture base inside the hw base->hw base+size */ | 1476 | /* is the generic aperture base inside the hw base->hw base+size */ |
| 1477 | if (gen->aperture_base > hw->aperture_base && gen->aperture_base <= hw->aperture_base + hw->aperture_size) | 1477 | if (gen->base > hw->base && gen->base <= hw->base + hw->size) |
| 1478 | return true; | 1478 | return true; |
| 1479 | return false; | 1479 | return false; |
| 1480 | } | 1480 | } |
| 1481 | |||
| 1482 | static bool fb_do_apertures_overlap(struct fb_info *gen, struct fb_info *hw) | ||
| 1483 | { | ||
| 1484 | int i, j; | ||
| 1485 | struct apertures_struct *hwa = hw->apertures; | ||
| 1486 | struct apertures_struct *gena = gen->apertures; | ||
| 1487 | if (!hwa || !gena) | ||
| 1488 | return false; | ||
| 1489 | |||
| 1490 | for (i = 0; i < hwa->count; ++i) { | ||
| 1491 | struct aperture *h = &hwa->ranges[i]; | ||
| 1492 | for (j = 0; j < gena->count; ++j) { | ||
| 1493 | struct aperture *g = &gena->ranges[j]; | ||
| 1494 | printk(KERN_DEBUG "checking generic (%llx %llx) vs hw (%llx %llx)\n", | ||
| 1495 | g->base, g->size, h->base, h->size); | ||
| 1496 | if (apertures_overlap(g, h)) | ||
| 1497 | return true; | ||
| 1498 | } | ||
| 1499 | } | ||
| 1500 | |||
| 1501 | return false; | ||
| 1502 | } | ||
| 1503 | |||
| 1481 | /** | 1504 | /** |
| 1482 | * register_framebuffer - registers a frame buffer device | 1505 | * register_framebuffer - registers a frame buffer device |
| 1483 | * @fb_info: frame buffer info structure | 1506 | * @fb_info: frame buffer info structure |
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index 81aa3129c17d..0a08f1341227 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c | |||
| @@ -80,6 +80,7 @@ EXPORT_SYMBOL(framebuffer_alloc); | |||
| 80 | */ | 80 | */ |
| 81 | void framebuffer_release(struct fb_info *info) | 81 | void framebuffer_release(struct fb_info *info) |
| 82 | { | 82 | { |
| 83 | kfree(info->apertures); | ||
| 83 | kfree(info); | 84 | kfree(info); |
| 84 | } | 85 | } |
| 85 | EXPORT_SYMBOL(framebuffer_release); | 86 | EXPORT_SYMBOL(framebuffer_release); |
diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 61f8b8f919b0..46dda7d8aaee 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c | |||
| @@ -285,7 +285,7 @@ static void offb_destroy(struct fb_info *info) | |||
| 285 | { | 285 | { |
| 286 | if (info->screen_base) | 286 | if (info->screen_base) |
| 287 | iounmap(info->screen_base); | 287 | iounmap(info->screen_base); |
| 288 | release_mem_region(info->aperture_base, info->aperture_size); | 288 | release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); |
| 289 | framebuffer_release(info); | 289 | framebuffer_release(info); |
| 290 | } | 290 | } |
| 291 | 291 | ||
| @@ -491,8 +491,11 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
| 491 | var->vmode = FB_VMODE_NONINTERLACED; | 491 | var->vmode = FB_VMODE_NONINTERLACED; |
| 492 | 492 | ||
| 493 | /* set offb aperture size for generic probing */ | 493 | /* set offb aperture size for generic probing */ |
| 494 | info->aperture_base = address; | 494 | info->apertures = alloc_apertures(1); |
| 495 | info->aperture_size = fix->smem_len; | 495 | if (!info->apertures) |
| 496 | goto out_aper; | ||
| 497 | info->apertures->ranges[0].base = address; | ||
| 498 | info->apertures->ranges[0].size = fix->smem_len; | ||
| 496 | 499 | ||
| 497 | info->fbops = &offb_ops; | 500 | info->fbops = &offb_ops; |
| 498 | info->screen_base = ioremap(address, fix->smem_len); | 501 | info->screen_base = ioremap(address, fix->smem_len); |
| @@ -501,17 +504,20 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
| 501 | 504 | ||
| 502 | fb_alloc_cmap(&info->cmap, 256, 0); | 505 | fb_alloc_cmap(&info->cmap, 256, 0); |
| 503 | 506 | ||
| 504 | if (register_framebuffer(info) < 0) { | 507 | if (register_framebuffer(info) < 0) |
| 505 | iounmap(par->cmap_adr); | 508 | goto out_err; |
| 506 | par->cmap_adr = NULL; | ||
| 507 | iounmap(info->screen_base); | ||
| 508 | framebuffer_release(info); | ||
| 509 | release_mem_region(res_start, res_size); | ||
| 510 | return; | ||
| 511 | } | ||
| 512 | 509 | ||
| 513 | printk(KERN_INFO "fb%d: Open Firmware frame buffer device on %s\n", | 510 | printk(KERN_INFO "fb%d: Open Firmware frame buffer device on %s\n", |
| 514 | info->node, full_name); | 511 | info->node, full_name); |
| 512 | return; | ||
| 513 | |||
| 514 | out_err: | ||
| 515 | iounmap(info->screen_base); | ||
| 516 | out_aper: | ||
| 517 | iounmap(par->cmap_adr); | ||
| 518 | par->cmap_adr = NULL; | ||
| 519 | framebuffer_release(info); | ||
| 520 | release_mem_region(res_start, res_size); | ||
| 515 | } | 521 | } |
| 516 | 522 | ||
| 517 | 523 | ||
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 0cadf7aee27e..090aa1a9be6e 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
| @@ -177,7 +177,7 @@ static void vesafb_destroy(struct fb_info *info) | |||
| 177 | { | 177 | { |
| 178 | if (info->screen_base) | 178 | if (info->screen_base) |
| 179 | iounmap(info->screen_base); | 179 | iounmap(info->screen_base); |
| 180 | release_mem_region(info->aperture_base, info->aperture_size); | 180 | release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); |
| 181 | framebuffer_release(info); | 181 | framebuffer_release(info); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| @@ -295,8 +295,13 @@ static int __init vesafb_probe(struct platform_device *dev) | |||
| 295 | info->par = NULL; | 295 | info->par = NULL; |
| 296 | 296 | ||
| 297 | /* set vesafb aperture size for generic probing */ | 297 | /* set vesafb aperture size for generic probing */ |
| 298 | info->aperture_base = screen_info.lfb_base; | 298 | info->apertures = alloc_apertures(1); |
| 299 | info->aperture_size = size_total; | 299 | if (!info->apertures) { |
| 300 | err = -ENOMEM; | ||
| 301 | goto err; | ||
| 302 | } | ||
| 303 | info->apertures->ranges[0].base = screen_info.lfb_base; | ||
| 304 | info->apertures->ranges[0].size = size_total; | ||
| 300 | 305 | ||
| 301 | info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len); | 306 | info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len); |
| 302 | if (!info->screen_base) { | 307 | if (!info->screen_base) { |
