diff options
-rw-r--r-- | Documentation/arm/OMAP/DSS | 10 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/Kconfig | 1 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-ioctl.c | 14 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-main.c | 69 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb.h | 5 |
5 files changed, 52 insertions, 47 deletions
diff --git a/Documentation/arm/OMAP/DSS b/Documentation/arm/OMAP/DSS index a564ceea9e98..4484e021290e 100644 --- a/Documentation/arm/OMAP/DSS +++ b/Documentation/arm/OMAP/DSS | |||
@@ -285,7 +285,10 @@ FB0 +-- GFX ---- LCD ---- LCD | |||
285 | Misc notes | 285 | Misc notes |
286 | ---------- | 286 | ---------- |
287 | 287 | ||
288 | OMAP FB allocates the framebuffer memory using the OMAP VRAM allocator. | 288 | OMAP FB allocates the framebuffer memory using the standard dma allocator. You |
289 | can enable Contiguous Memory Allocator (CONFIG_CMA) to improve the dma | ||
290 | allocator, and if CMA is enabled, you use "cma=" kernel parameter to increase | ||
291 | the global memory area for CMA. | ||
289 | 292 | ||
290 | Using DSI DPLL to generate pixel clock it is possible produce the pixel clock | 293 | Using DSI DPLL to generate pixel clock it is possible produce the pixel clock |
291 | of 86.5MHz (max possible), and with that you get 1280x1024@57 output from DVI. | 294 | of 86.5MHz (max possible), and with that you get 1280x1024@57 output from DVI. |
@@ -301,11 +304,6 @@ framebuffer parameters. | |||
301 | Kernel boot arguments | 304 | Kernel boot arguments |
302 | --------------------- | 305 | --------------------- |
303 | 306 | ||
304 | vram=<size>[,<physaddr>] | ||
305 | - Amount of total VRAM to preallocate and optionally a physical start | ||
306 | memory address. For example, "10M". omapfb allocates memory for | ||
307 | framebuffers from VRAM. | ||
308 | |||
309 | omapfb.mode=<display>:<mode>[,...] | 307 | omapfb.mode=<display>:<mode>[,...] |
310 | - Default video mode for specified displays. For example, | 308 | - Default video mode for specified displays. For example, |
311 | "dvi:800x400MR-24@60". See drivers/video/modedb.c. | 309 | "dvi:800x400MR-24@60". See drivers/video/modedb.c. |
diff --git a/drivers/video/omap2/omapfb/Kconfig b/drivers/video/omap2/omapfb/Kconfig index 4ea17dc3258c..4cb12ce68855 100644 --- a/drivers/video/omap2/omapfb/Kconfig +++ b/drivers/video/omap2/omapfb/Kconfig | |||
@@ -2,7 +2,6 @@ menuconfig FB_OMAP2 | |||
2 | tristate "OMAP2+ frame buffer support" | 2 | tristate "OMAP2+ frame buffer support" |
3 | depends on FB && OMAP2_DSS && !DRM_OMAP | 3 | depends on FB && OMAP2_DSS && !DRM_OMAP |
4 | 4 | ||
5 | select OMAP2_VRAM | ||
6 | select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3 | 5 | select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3 |
7 | select FB_CFB_FILLRECT | 6 | select FB_CFB_FILLRECT |
8 | select FB_CFB_COPYAREA | 7 | select FB_CFB_COPYAREA |
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c index 606b89f12351..574c1708f749 100644 --- a/drivers/video/omap2/omapfb/omapfb-ioctl.c +++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c | |||
@@ -31,7 +31,6 @@ | |||
31 | 31 | ||
32 | #include <video/omapdss.h> | 32 | #include <video/omapdss.h> |
33 | #include <plat/vrfb.h> | 33 | #include <plat/vrfb.h> |
34 | #include <plat/vram.h> | ||
35 | 34 | ||
36 | #include "omapfb.h" | 35 | #include "omapfb.h" |
37 | 36 | ||
@@ -853,14 +852,15 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg) | |||
853 | break; | 852 | break; |
854 | 853 | ||
855 | case OMAPFB_GET_VRAM_INFO: { | 854 | case OMAPFB_GET_VRAM_INFO: { |
856 | unsigned long vram, free, largest; | ||
857 | |||
858 | DBG("ioctl GET_VRAM_INFO\n"); | 855 | DBG("ioctl GET_VRAM_INFO\n"); |
859 | 856 | ||
860 | omap_vram_get_info(&vram, &free, &largest); | 857 | /* |
861 | p.vram_info.total = vram; | 858 | * We don't have the ability to get this vram info anymore. |
862 | p.vram_info.free = free; | 859 | * Fill in something that should keep the applications working. |
863 | p.vram_info.largest_free_block = largest; | 860 | */ |
861 | p.vram_info.total = SZ_1M * 64; | ||
862 | p.vram_info.free = SZ_1M * 64; | ||
863 | p.vram_info.largest_free_block = SZ_1M * 64; | ||
864 | 864 | ||
865 | if (copy_to_user((void __user *)arg, &p.vram_info, | 865 | if (copy_to_user((void __user *)arg, &p.vram_info, |
866 | sizeof(p.vram_info))) | 866 | sizeof(p.vram_info))) |
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 16db1589bd91..84c10121de48 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -32,7 +32,6 @@ | |||
32 | 32 | ||
33 | #include <video/omapdss.h> | 33 | #include <video/omapdss.h> |
34 | #include <plat/cpu.h> | 34 | #include <plat/cpu.h> |
35 | #include <plat/vram.h> | ||
36 | #include <plat/vrfb.h> | 35 | #include <plat/vrfb.h> |
37 | 36 | ||
38 | #include "omapfb.h" | 37 | #include "omapfb.h" |
@@ -1336,24 +1335,25 @@ static void omapfb_free_fbmem(struct fb_info *fbi) | |||
1336 | 1335 | ||
1337 | rg = ofbi->region; | 1336 | rg = ofbi->region; |
1338 | 1337 | ||
1339 | WARN_ON(atomic_read(&rg->map_count)); | 1338 | if (rg->token == NULL) |
1340 | 1339 | return; | |
1341 | if (rg->paddr) | ||
1342 | if (omap_vram_free(rg->paddr, rg->size)) | ||
1343 | dev_err(fbdev->dev, "VRAM FREE failed\n"); | ||
1344 | 1340 | ||
1345 | if (rg->vaddr) | 1341 | WARN_ON(atomic_read(&rg->map_count)); |
1346 | iounmap(rg->vaddr); | ||
1347 | 1342 | ||
1348 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) { | 1343 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) { |
1349 | /* unmap the 0 angle rotation */ | 1344 | /* unmap the 0 angle rotation */ |
1350 | if (rg->vrfb.vaddr[0]) { | 1345 | if (rg->vrfb.vaddr[0]) { |
1351 | iounmap(rg->vrfb.vaddr[0]); | 1346 | iounmap(rg->vrfb.vaddr[0]); |
1352 | omap_vrfb_release_ctx(&rg->vrfb); | ||
1353 | rg->vrfb.vaddr[0] = NULL; | 1347 | rg->vrfb.vaddr[0] = NULL; |
1354 | } | 1348 | } |
1349 | |||
1350 | omap_vrfb_release_ctx(&rg->vrfb); | ||
1355 | } | 1351 | } |
1356 | 1352 | ||
1353 | dma_free_attrs(fbdev->dev, rg->size, rg->token, rg->dma_handle, | ||
1354 | &rg->attrs); | ||
1355 | |||
1356 | rg->token = NULL; | ||
1357 | rg->vaddr = NULL; | 1357 | rg->vaddr = NULL; |
1358 | rg->paddr = 0; | 1358 | rg->paddr = 0; |
1359 | rg->alloc = 0; | 1359 | rg->alloc = 0; |
@@ -1388,7 +1388,9 @@ static int omapfb_alloc_fbmem(struct fb_info *fbi, unsigned long size, | |||
1388 | struct omapfb_info *ofbi = FB2OFB(fbi); | 1388 | struct omapfb_info *ofbi = FB2OFB(fbi); |
1389 | struct omapfb2_device *fbdev = ofbi->fbdev; | 1389 | struct omapfb2_device *fbdev = ofbi->fbdev; |
1390 | struct omapfb2_mem_region *rg; | 1390 | struct omapfb2_mem_region *rg; |
1391 | void __iomem *vaddr; | 1391 | void *token; |
1392 | DEFINE_DMA_ATTRS(attrs); | ||
1393 | dma_addr_t dma_handle; | ||
1392 | int r; | 1394 | int r; |
1393 | 1395 | ||
1394 | rg = ofbi->region; | 1396 | rg = ofbi->region; |
@@ -1403,42 +1405,43 @@ static int omapfb_alloc_fbmem(struct fb_info *fbi, unsigned long size, | |||
1403 | 1405 | ||
1404 | size = PAGE_ALIGN(size); | 1406 | size = PAGE_ALIGN(size); |
1405 | 1407 | ||
1406 | if (!paddr) { | 1408 | WARN_ONCE(paddr, |
1407 | DBG("allocating %lu bytes for fb %d\n", size, ofbi->id); | 1409 | "reserving memory at predefined address not supported\n"); |
1408 | r = omap_vram_alloc(size, &paddr); | ||
1409 | } else { | ||
1410 | DBG("reserving %lu bytes at %lx for fb %d\n", size, paddr, | ||
1411 | ofbi->id); | ||
1412 | r = omap_vram_reserve(paddr, size); | ||
1413 | } | ||
1414 | 1410 | ||
1415 | if (r) { | 1411 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); |
1412 | |||
1413 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) | ||
1414 | dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs); | ||
1415 | |||
1416 | DBG("allocating %lu bytes for fb %d\n", size, ofbi->id); | ||
1417 | |||
1418 | token = dma_alloc_attrs(fbdev->dev, size, &dma_handle, | ||
1419 | GFP_KERNEL, &attrs); | ||
1420 | |||
1421 | if (token == NULL) { | ||
1416 | dev_err(fbdev->dev, "failed to allocate framebuffer\n"); | 1422 | dev_err(fbdev->dev, "failed to allocate framebuffer\n"); |
1417 | return -ENOMEM; | 1423 | return -ENOMEM; |
1418 | } | 1424 | } |
1419 | 1425 | ||
1420 | if (ofbi->rotation_type != OMAP_DSS_ROT_VRFB) { | 1426 | DBG("allocated VRAM paddr %lx, vaddr %p\n", |
1421 | vaddr = ioremap_wc(paddr, size); | 1427 | (unsigned long)dma_handle, token); |
1422 | |||
1423 | if (!vaddr) { | ||
1424 | dev_err(fbdev->dev, "failed to ioremap framebuffer\n"); | ||
1425 | omap_vram_free(paddr, size); | ||
1426 | return -ENOMEM; | ||
1427 | } | ||
1428 | 1428 | ||
1429 | DBG("allocated VRAM paddr %lx, vaddr %p\n", paddr, vaddr); | 1429 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) { |
1430 | } else { | ||
1431 | r = omap_vrfb_request_ctx(&rg->vrfb); | 1430 | r = omap_vrfb_request_ctx(&rg->vrfb); |
1432 | if (r) { | 1431 | if (r) { |
1432 | dma_free_attrs(fbdev->dev, size, token, dma_handle, | ||
1433 | &attrs); | ||
1433 | dev_err(fbdev->dev, "vrfb create ctx failed\n"); | 1434 | dev_err(fbdev->dev, "vrfb create ctx failed\n"); |
1434 | return r; | 1435 | return r; |
1435 | } | 1436 | } |
1436 | |||
1437 | vaddr = NULL; | ||
1438 | } | 1437 | } |
1439 | 1438 | ||
1440 | rg->paddr = paddr; | 1439 | rg->attrs = attrs; |
1441 | rg->vaddr = vaddr; | 1440 | rg->token = token; |
1441 | rg->dma_handle = dma_handle; | ||
1442 | |||
1443 | rg->paddr = (unsigned long)dma_handle; | ||
1444 | rg->vaddr = (void __iomem *)token; | ||
1442 | rg->size = size; | 1445 | rg->size = size; |
1443 | rg->alloc = 1; | 1446 | rg->alloc = 1; |
1444 | 1447 | ||
diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h index 5ced9b334d35..5f72bf9017fc 100644 --- a/drivers/video/omap2/omapfb/omapfb.h +++ b/drivers/video/omap2/omapfb/omapfb.h | |||
@@ -28,6 +28,8 @@ | |||
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #include <linux/rwsem.h> | 30 | #include <linux/rwsem.h> |
31 | #include <linux/dma-attrs.h> | ||
32 | #include <linux/dma-mapping.h> | ||
31 | 33 | ||
32 | #include <video/omapdss.h> | 34 | #include <video/omapdss.h> |
33 | 35 | ||
@@ -49,6 +51,9 @@ extern bool omapfb_debug; | |||
49 | 51 | ||
50 | struct omapfb2_mem_region { | 52 | struct omapfb2_mem_region { |
51 | int id; | 53 | int id; |
54 | struct dma_attrs attrs; | ||
55 | void *token; | ||
56 | dma_addr_t dma_handle; | ||
52 | u32 paddr; | 57 | u32 paddr; |
53 | void __iomem *vaddr; | 58 | void __iomem *vaddr; |
54 | struct vrfb vrfb; | 59 | struct vrfb vrfb; |