]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-video.git/commitdiff
OMAPDSS: DSSCOMP: OMAPLFB: Enabling dual FB configuration for multidisplay feature
authorSunita Nadampalli <sunitan@ti.com>
Wed, 29 May 2013 21:33:29 +0000 (16:33 -0500)
committerPraneeth Bajjuri <praneeth@ti.com>
Fri, 12 Jul 2013 22:54:13 +0000 (17:54 -0500)
Change-Id: I48c81a2a242457af28e94ac8a60d4d93ed29e728
Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
Signed-off-by: Dandawate Saket <dsaket@ti.com>
Conflicts:
arch/arm/configs/android_omap_defconfig

arch/arm/boot/dts/dra7-evm.dts
arch/arm/plat-omap/android-display.c
drivers/video/omap2/dsscomp/device.c

index 880c57fd40c628084f68b601ecf581d94a377672..435024659b366fadce9d1ffde56b3a5a5a76b44b 100755 (executable)
                        0x238   0x0     /* vout1_d23 OUTPUT | MODE0 */
                >;
        };
+       display_layout {
+               compatible = "ti, omap4-dsscomp";
+               ti,num_displays = <2>;
+               ti,default_display = "lcd";
+       };
 };
 
 &i2c1 {
index ee8765908ff53cc45257f53929867b949f4b10ac..815ba4b32176577337e640d7f82a766352825e61 100644 (file)
@@ -66,28 +66,12 @@ static int __init get_hdmi_options(char *str)
 }
 early_param("omapdss.hdmi_options", get_hdmi_options);
 
-static void get_display_size(struct omap_dss_board_info *info,
-                            struct omap_android_display_data *mem)
+static void get_display_size(struct omap_dss_device *device,
+                               struct omap_android_display_data *mem)
 {
-       struct omap_dss_device *device = NULL;
-       int i;
-
-       if (!info)
+       if (!device)
                goto done;
 
-       device = info->default_device;
-       for (i = 0; i < info->num_devices; i++) {
-               if (!strcmp(default_display, info->devices[i]->name)) {
-                       device = info->devices[i];
-                       break;
-               }
-       }
-
-       if (!device) {
-               pr_warn("android_display: invalid dss device");
-               goto done;
-       }
-
        if (device->type == OMAP_DISPLAY_TYPE_HDMI &&
            hdmi_width && hdmi_height) {
                mem->width = hdmi_width;
@@ -99,8 +83,8 @@ static void get_display_size(struct omap_dss_board_info *info,
        if (device->ctrl.pixel_size)
                mem->bpp = ALIGN(device->ctrl.pixel_size, 16) >> 3;
 
-       pr_info("android_display: setting default resolution %u*%u, bpp=%u\n",
-                                       mem->width, mem->height, mem->bpp);
+       pr_info("android_display: setting %s resolution to %u*%u, bpp=%u\n",
+               device->name, mem->width, mem->height, mem->bpp);
 done:
        return;
 }
@@ -149,35 +133,25 @@ static u32 vram_size(struct omap_android_display_data *mem)
 }
 
 static void set_vram_sizes(struct sgx_omaplfb_config *sgx_config,
-                          struct omapfb_platform_data *fb,
-                          struct omap_android_display_data *mem)
+                          struct omapfb_mem_region *region,
+                          struct omap_android_display_data *mem,
+                          unsigned fbnum)
 {
-       u32 num_vram_buffers = 1;
+       u32 num_vram_buffers;
        u32 vram = 0;
-       int i;
 
-       if (sgx_config) {
-               vram += sgx_config->vram_reserve;
-               num_vram_buffers = sgx_config->vram_buffers;
-       }
-       vram += num_vram_buffers * vram_size(mem);
+       if (!sgx_config || !region || !mem)
+               return;
 
-       if (fb) {
-               /* set fb0 vram needs */
-               if (fb->mem_desc.region_cnt >= 1) {
-                       fb->mem_desc.region[0].size = vram;
-                       pr_info("android_display: setting fb0.vram to %u\n",
-                                                                       vram);
-               }
-
-               /* set global vram needs incl. additional regions specified */
-               for (i = 1; i < fb->mem_desc.region_cnt; i++)
-                       if (!fb->mem_desc.region[i].paddr)
-                               vram += fb->mem_desc.region[i].size;
-       }
+       /* Need at least 1 VRAM buffer for fb0 */
+       num_vram_buffers = max(sgx_config->vram_buffers, 1u);
 
-       pr_info("android_display: setting vram to %u\n", vram);
-       //omap_vram_set_sdram_vram(vram, 0);
+       vram += sgx_config->vram_reserve;
+       vram += num_vram_buffers * vram_size(mem);
+
+       /* set fb vram needs */
+       region->size = vram;
+       pr_info("android_display: setting fb%u.vram to %u\n", fbnum, vram);
 }
 
 /* coordinate between sgx, omapdss, dsscomp and ion needs */
@@ -187,24 +161,46 @@ void omap_android_display_setup(struct omap_dss_board_info *dss,
                               struct omapfb_platform_data *fb)
 {
        struct sgx_omaplfb_config *p_sgx_config = NULL;
+       int i = 0;
+       u32 omapfb_vram = 0;
+       u32 num_configs = 1;
+
+       if (sgx)
+               num_configs = sgx->num_configs;
+
+       for (i = 0; i < num_configs; ++i) {
+               if (!sgx || !sgx->configs)
+                       p_sgx_config = sgx_omaplfb_get(i);
+               else
+                       p_sgx_config = &(sgx->configs[i]);
+
+               struct omap_android_display_data mem = {
+                       .bpp = 4,
+                       .width = 1280,
+                       .height = 720,
+               };
+
+               if (i == 0 && i < dss->num_devices)
+                       get_display_size(dss->devices[i], &mem);
+
+               if (dsscomp)
+                       set_tiler1d_slot_size(dsscomp, &mem);
+
+               /* skip region if no sgx_config associated with it
+               * or it has size pre-set by board configuration
+               */
+               if (i < fb->mem_desc.region_cnt &&
+               !fb->mem_desc.region[i].size)
+                       set_vram_sizes(p_sgx_config, &fb->mem_desc.region[i],
+                                       &mem, i);
+               sgx_omaplfb_set(i, p_sgx_config);
+       }
 
-       struct omap_android_display_data mem = {
-               .bpp = 4,
-               .width = 1920,
-               .height = 1080,
-       };
-
-       if (!sgx || !sgx->configs)
-               p_sgx_config = sgx_omaplfb_get(0);
-       else
-               p_sgx_config = &(sgx->configs[0]);
-
-       get_display_size(dss, &mem);
-
-       if (dsscomp)
-               set_tiler1d_slot_size(dsscomp, &mem);
-
-       set_vram_sizes(p_sgx_config, fb, &mem);
+       /* set global vram needs incl. additional regions specified */
+       for (i = 0; i < fb->mem_desc.region_cnt; i++)
+               if (!fb->mem_desc.region[i].paddr)
+                       omapfb_vram += fb->mem_desc.region[i].size;
 
-       sgx_omaplfb_set(0, p_sgx_config);
+       pr_info("android_display: setting vram to %u\n", omapfb_vram);
+       //omap_vram_set_sdram_vram(omapfb_vram, 0);
 }
index 26fbab907d2031fee5ceb40567a4d993d80bc8b3..c2b9229cafcd743a5f34a4df32d517791d0050a0 100755 (executable)
@@ -46,7 +46,7 @@
 #include "../dss/dss.h"
 
 #include <linux/debugfs.h>
-
+#include <plat/android-display.h>
 
 static DECLARE_WAIT_QUEUE_HEAD(waitq);
 static DEFINE_MUTEX(wait_mtx);
@@ -651,6 +651,13 @@ static int dsscomp_probe(struct platform_device *pdev)
 {
        int ret;
        int r = 0;
+       int num_displays = 1;
+       struct device_node *node;
+       struct omap_dss_board_info display_layout_data;
+       struct dsscomp_platform_data dsscomp_config;
+       struct sgx_omaplfb_platform_data omaplfb_plat_data;
+       struct omapfb_platform_data fb_pdata;
+
        struct dsscomp_dev *cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
        if (!cdev) {
                pr_err("dsscomp: failed to allocate device.\n");
@@ -695,6 +702,33 @@ static int dsscomp_probe(struct platform_device *pdev)
        fill_cache(cdev);
        fill_platform_info(cdev);
 
+
+       node = of_find_node_by_name(NULL, "display_layout");
+       if (node) {
+               of_property_read_u32(node, "ti,num_displays",
+                               &num_displays);
+       }
+
+       memset(&display_layout_data, 0x00, sizeof(display_layout_data));
+       memset(&dsscomp_config, 0x00, sizeof(dsscomp_config));
+       memset(&omaplfb_plat_data, 0x00, sizeof(omaplfb_plat_data));
+       memset(&fb_pdata, 0x00, sizeof(fb_pdata));
+
+       display_layout_data.num_devices = num_displays;
+       display_layout_data.devices = cdev->displays;
+       display_layout_data.default_device = cdev->displays[0];
+       dsscomp_config.tiler1d_slotsz = SZ_16M;
+       omaplfb_plat_data.num_configs = num_displays;
+       omaplfb_plat_data.configs = NULL;
+       fb_pdata.mem_desc.region_cnt = num_displays;
+
+       omap_android_display_setup(&display_layout_data,
+                               &dsscomp_config,
+                               &omaplfb_plat_data,
+                               &fb_pdata);
+
+       omapfb_set_platform_data(&fb_pdata);
+
        /* initialize queues */
        dsscomp_queue_init(cdev);
        dsscomp_gralloc_init(cdev);