aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/da8xx-fb.c
diff options
context:
space:
mode:
authorAditya Nellutla <aditya.n@ti.com>2012-05-23 02:06:31 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-06-27 03:01:38 -0400
commit3b9cc4ea4735d3c73ee27ef7b829b6fe4535eefe (patch)
tree0f7dcb034408d66ebe67a16bcfdb7eaed8d562d0 /drivers/video/da8xx-fb.c
parent41a490ec019fd172f5d0356e01d8101b4708aee2 (diff)
da8xx-fb: Rounding FB size to satisfy SGX buffer requirements
In the real time use-case when SGX is used for rendering to FB buffers it has been observed that, the available memory from framebuffer driver is not sufficient for SGX under certain cases (like 16-bit WVGA resolution). SGX requires 2 swap buffers with each of the buffers aligned to lcm(line_length, PAGE_SIZE). Inorder to satisfy this requirement, we have two options, - Increase number of FB buffers (LCD_NUM_BUFFERS) to 3. This is not recommended as we end up wasting huge memory in most of the cases. - Align FB buffers to lcm(line_length, PAGE_SIZE).This ensures framebuffer size is increased to satisfy SGX requirements keeping alignment intact. This patch makes sure that FB allocates buffers aligned to above formula. Signed-off-by: Aditya Nellutla <aditya.n@ti.com> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/da8xx-fb.c')
-rw-r--r--drivers/video/da8xx-fb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 47118c75a4c0..2f24c19d7d08 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -31,6 +31,7 @@
31#include <linux/cpufreq.h> 31#include <linux/cpufreq.h>
32#include <linux/console.h> 32#include <linux/console.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/lcm.h>
34#include <video/da8xx-fb.h> 35#include <video/da8xx-fb.h>
35#include <asm/div64.h> 36#include <asm/div64.h>
36 37
@@ -1114,6 +1115,7 @@ static int __devinit fb_probe(struct platform_device *device)
1114 struct da8xx_fb_par *par; 1115 struct da8xx_fb_par *par;
1115 resource_size_t len; 1116 resource_size_t len;
1116 int ret, i; 1117 int ret, i;
1118 unsigned long ulcm;
1117 1119
1118 if (fb_pdata == NULL) { 1120 if (fb_pdata == NULL) {
1119 dev_err(&device->dev, "Can not get platform data\n"); 1121 dev_err(&device->dev, "Can not get platform data\n");
@@ -1209,7 +1211,8 @@ static int __devinit fb_probe(struct platform_device *device)
1209 1211
1210 /* allocate frame buffer */ 1212 /* allocate frame buffer */
1211 par->vram_size = lcdc_info->width * lcdc_info->height * lcd_cfg->bpp; 1213 par->vram_size = lcdc_info->width * lcdc_info->height * lcd_cfg->bpp;
1212 par->vram_size = PAGE_ALIGN(par->vram_size/8); 1214 ulcm = lcm((lcdc_info->width * lcd_cfg->bpp)/8, PAGE_SIZE);
1215 par->vram_size = roundup(par->vram_size/8, ulcm);
1213 par->vram_size = par->vram_size * LCD_NUM_BUFFERS; 1216 par->vram_size = par->vram_size * LCD_NUM_BUFFERS;
1214 1217
1215 par->vram_virt = dma_alloc_coherent(NULL, 1218 par->vram_virt = dma_alloc_coherent(NULL,