Dual Display: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
Line 1: Line 1:
{{PageHeader|Dual Display}} {{DocImage|category1=Android|category2=VAR-SOM-MX6}}[[Category: VAR-SOM-MX6]]__toc__
{{PageHeader|Dual Display - Android Application Tech Note.ay}} {{DocImage|category1=Android|category2=VAR-SOM-MX6}}[[Category: VAR-SOM-MX6]]__toc__
==Dual Display on VAR-SOM-SOLO/DUAL / DART-MX6 : Android Application Tech Note.==
==Dual Display on VAR-SOM-SOLO/DUAL / DART-MX6 : Android Application Tech Note.==



Revision as of 17:40, 19 September 2018

Dual Display - Android Application Tech Note.ay

Dual Display on VAR-SOM-SOLO/DUAL / DART-MX6 : Android Application Tech Note.

  • Overview

IMX6 platform is capable of handling multiple displays.
You can drive two displays simultaneously.
See page : 15 - 19 http://cache.freescale.com/files/training/doc/ftf/2014/FTF-CON-F0119.pdf
Starting with Android 4.3 multiple displays are supported.
DART-MX6 / Solo both have LVDS0 and LVDS1 output available on the development board.

  • VAR-DT6CustomBoard:

For both channels: LVDS0/1 - LVDS Clock +4 Data lanes are accessible via Carrier board Headers.

  • VAR-SOLOCustomBoard:

LVDS0 - LVDS Clock +4 Data lanes are accessible via Carrier board Headers. LVDS1 - LVDS Clock +3 Data lanes are accessible via Carrier board Headers (only 18 bit LCD can be interfaced)
For maximum supported resolution and combination refer to http://cache.freescale.com/files/training/doc/ftf/2014/FTF-CON-F0119.pdf page no 16 for more details and combination.

  • Please note: Not all modes tested and verified.

Dual display can be in different combinations, the configuration can be like 1. Clone display (Primary is always cloned) 2. Independent display

In the case of 1. The kernel will not register another framebuffer for 2nd panel. However, will clone internally from the SOC itself via IPU framebuffer driver from the interface specific drivers. Aka LDB, HDMI, RGB.

In the case of 2. The kernel registers 2nd FB to the platform.


Use case Two LVDS - LVDS0 and LVDS1 port on SOLO

  • Hardware Setup

2 x LVDS Panel : https://www.variscite.com/products/accessories/vlcd-cap-gld-lvds/

Reference : https://www.variscite.com/wp-content/uploads/2017/12/VLCD-CAP-GLD-LVDS.pdf


  • Connect 1st panel to LVDS1 - which is enabled by default with the software. Connect straight LVDS panel header to LVDS1 as this doesn’t require special handling.
  • Connect 2nd panel to LVDS0 - which requires changes in the software.

This example uses an identical LVDS panel however you can have an asymmetric combination as well.


Top level setup should look like below

Dual LVDS Solo Setup.png

In the schematic, you will see connectors like below.

LVDS Schematic J15 J16.png


Using wires connect LVDS0 to LVDS header in the LCD panel with the following combination. Pin to pin as shown in the below with color coded.

PIN
LVDS0
PIN - J16
PIN PIN
LVDS LCD Panel Header
PIN
1
3.3 V 3.3 V
2
1
VCC - 3V VCC - 3V
2
3
GND GND
4
3
GND GND
4
5
LVDS0_TX0_N LVDS0_TX0_P
6
5
RIN0_N RIN0_P
6
7
GND LVDS0_TX1_N
8
7
GND RIN1_N
8
9
LVDS0_TX1_P GND
10
9
RIN1_P GND
10
11
LVDS0_TX2_N LVDS0_TX2_P
12
11
RIN2_N RIN2_P
12
13
GND LVDS0_CLK_N
14
13
GND RCLK_N
14
15
LVDS0_CLK_P GND
16
15
RCLK_P GND
16
17
LVDS0_TX3_N LVDS0_TX3_P
18
17
5V_CC_Backlight 5V_CC_Backlight
18
19
VCC_5V PWM_BACK_LIGHT
20
19
PWM_INPUT GND
20

Note :

  • LVDS0 provides 3 lanes but LCD just needs 2 lane LVDS input.
  • Warning! Be careful about PIN 19 of LVDS0 header, please make sure it is connected to PIN17 or PIN18 of the LCD panel header only. Connecting this pin to other pins of LCD or shorting to GND may cause permanent damage to LCD or board.

Software Changes for Multiple Display:

Android Oreo 8.0 and Android 7.1.2:

  • Software Preparation for Dual Display (Two LVDS):

1. U-Boot: On U-Boot you require below patch to be applied.

For Android 8.0:

vendor/variscite/uboot-imx/

For Android 7.1.2:

bootable/bootloader/uboot-imx/
diff --git a/board/variscite/mx6var_som/mx6var_som.c b/board/variscite/mx6var_som/mx6var_som.c
index 526a11f..729c966 100644
--- a/board/variscite/mx6var_som/mx6var_som.c
+++ b/board/variscite/mx6var_som/mx6var_som.c
@@ -907,7 +907,7 @@ static void setup_display(void)
              | IOMUXC_GPR2_BIT_MAPPING_CH1_SPWG
              | IOMUXC_GPR2_DATA_WIDTH_CH1_18BIT
              | IOMUXC_GPR2_BIT_MAPPING_CH0_SPWG
-             | IOMUXC_GPR2_DATA_WIDTH_CH0_24BIT
+             | IOMUXC_GPR2_DATA_WIDTH_CH0_18BIT
              | IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI0
              | IOMUXC_GPR2_LVDS_CH1_MODE_ENABLED_DI0;
         writel(reg, &iomux->gpr[2]);
diff --git a/include/configs/mx6var_som.h b/include/configs/mx6var_som.h
index 1db7afb..b27f7ee 100644
--- a/include/configs/mx6var_som.h
+++ b/include/configs/mx6var_som.h
@@ -195,7 +195,7 @@
                                 "video=mxcfb0:dev=ldb; " \
                 "fi; " \
                 "setenv bootargs ${bootargs} " \
-                        "video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off;\0"
+                        "video=mxcfb1:dev=ldb video=mxcfb2:off video=mxcfb3:off;\0"

 #define CONFIG_EXTRA_ENV_SETTINGS \

Please take a note here, we enable channel 0 for solo, as 18 bit and enable fb1 set the device to LDB(LVDS).

2 Kernel:

For Android 8.0:

~/var_o_800_100/imx-o8.0.0_1.0.0_ga/android_build/kernel_imx

For Android 7.1.2:

~/var_n_712_200/n_712_200_build/kernel_imx
diff --git a/arch/arm/boot/dts/imx6qdl-var-solocb-dt6cb-displays.dtsi b/arch/arm/boot/dts/imx6qdl-var-solocb-dt6cb-displays.dtsi
index 8876245..b329e9d 100644
--- a/arch/arm/boot/dts/imx6qdl-var-solocb-dt6cb-displays.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-var-solocb-dt6cb-displays.dtsi
@@ -12,6 +12,14 @@
        interface_pix_fmt = "RGB666";
 };

+&mxcfb2 {
+       disp_dev = "ldb";
+       interface_pix_fmt = "RGB666";
+       default_bpp = <16>;
+       int_clk = <0>;
+       late_init = <0>;
+};
+
 &i2c3 {
        touch: ft5x06_ts@38 {
                compatible = "edt,edt-ft5x06";
@@ -28,22 +36,21 @@

        lvds-channel@0 {
                fsl,data-mapping = "spwg";
-               fsl,data-width = <24>;
-               crtc = "ipu1-di0";
+               fsl,data-width = <18>;
                status = "okay";

                display-timings {
                        native-mode = <&timing0>;
                        timing0: hsd100pxn1 {
-                               clock-frequency = <35714000>;
+                               clock-frequency = <32000000>;
                                hactive = <800>;
                                vactive = <480>;
-                               hback-porch = <24>;
-                               hfront-porch = <15>;
-                               vback-porch = <13>;
-                               vfront-porch = <20>;
-                               hsync-len = <20>;
-                               vsync-len = <13>;
+                               hback-porch = <39>;
+                               hfront-porch = <39>;
+                               vback-porch = <29>;
+                               vfront-porch = <13>;
+                               hsync-len = <47>;
+                               vsync-len = <2>;
                        };
                };
        };

@@ -51,7 +58,6 @@
        lvds-channel@1 {
                fsl,data-mapping = "spwg";
                fsl,data-width = <18>;
-               crtc = "ipu1-di1";
                primary;
                status = "okay";
  • Software Preparation for Dual Display (LVDS + HDMI):
  • Kernel:

For Android 8.0:

~/var_o_800_100/imx-o8.0.0_1.0.0_ga/android_build/kernel_imx

Compile the kernel with following changes in the device tree below.

http://variwiki.com/index.php?title=VAR-SOM-MX6_Android&release=RELEASE_O8.0.0_1.0.0_VAR-SOM-MX6#Build_boot.img


For Android 7.1.2:

~/var_n_712_200/n_712_200_build/kernel_imx

Compile the kernel with following changes in the device tree below

http://variwiki.com/index.php?title=VAR-SOM-MX6_Android&release=RELEASE_N7.1.2_2.0.0_VAR-SOM-MX6#Build_boot.img

Device Tree Changes :

diff --git a/arch/arm/boot/dts/imx6qdl-var-solocb-dt6cb-displays.dtsi b/arch/arm/boot/dts/imx6qdl-var-solocb-dt6cb-displays.dtsi
index 8876245..7332dcb 100644
--- a/arch/arm/boot/dts/imx6qdl-var-solocb-dt6cb-displays.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-var-solocb-dt6cb-displays.dtsi
@@ -29,7 +29,6 @@
        lvds-channel@0 {
                fsl,data-mapping = "spwg";
                fsl,data-width = <24>;
-               crtc = "ipu1-di0";
                status = "okay";

                display-timings {
@@ -51,7 +50,6 @@
        lvds-channel@1 {
                fsl,data-mapping = "spwg";
                fsl,data-width = <18>;
-               crtc = "ipu1-di1";
                primary;
                status = "okay";

Install the boot image to respective platform and then at U-Boot prompt change the bootargs

U-Boot prompt commands:

=> setenv videoargs 'setenv bootargs ${bootargs} video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24 video=mxcfb1:dev=ldb video=mxcfb2:off video=mxcfb3:off;'
=> saveenv
=> reset

3. Android Framework changes (Optional for Android 8.0 only):

If you wish to have activities to be launched on secondary panel Add the line <feature name="android.software.activities_on_secondary_displays" /> to tablet_core_hardware.xml This file is located at /system/etc/permissions/ on the Android On the source side, the file is located at For Android 8.0: android_build/variscite/var_mx6/tablet_core_hardware.xml This feature is required for setLaunchDisplayId(<display number>) to work.

4. Compile the image for your platform following

For Android 8.0:

http://variwiki.com/index.php?title=VAR-SOM-MX6_Android&release=RELEASE_O8.0.0_1.0.0_VAR-SOM-MX6#Build_Android_Images

For Android 7.1.2:

http://variwiki.com/index.php?title=VAR-SOM-MX6_Android&release=RELEASE_N7.1.2_2.0.0_VAR-SOM-MX6#Build_Android_Images and program the image to VAR-SOM-SOLO/DUAL or DART-MX6

Testing Multiple Display on Android:

By default, Android operates in clone mode, but if you wish to have two different content on two different panels; your Android application must explicitly tell which display it wants to render the Surface. You can use the presentation mode.

Customers are advised to use the presentation mode for testing/prototyping.

More information about the presentation mode available here : https://developer.android.com/reference/android/app/Presentation


Reference:

<Your_Android_Build>/development/samples/ApiDemos->./src/com/example/android/apis/app/PresentationWithMediaRouterActivity.java

is where you can findsample code for reference.


If you wish to build apk for ApiDemos use below steps.

For Android 8.0:

$ cd ~/var_o_800_100/imx-o8.0.0_1.0.0_ga/android_build
$ source build/envsetup.sh
$ lunch var_mx6-eng
$ or
$ lunch var_mx6-userdebug
$ cd development/samples/ApiDemos
$ mm

This should generate

out/target/product/var_mx6/testcases/ApiDemos/ApiDemos.apk

copy apk to your present directory from which you can install on the platform

Connect OTG and use adb to install using below command.

$ adb install ApiDemos.apk

For Android 7.1.2:

$ cd ~/var_n_712_200/n_712_200_build
$ source build/envsetup.sh
$ lunch var_mx6-eng
$ or
$ lunch var_mx6-user
$ cd development/samples/ApiDemos
$ mm

This will generate apk on

out/target/product/var_mx6/data/app/ApiDemos/ApiDemos.apk

path which you can install on the platform.

Copy apk to your present directory from which you can install on the platform.

$ adb install ApiDemos.apk


Note: For LVDS + HDMI case, at command prompt run below commands

# echo 0 > /sys/class/graphics/fb2/blank

By default, Android will clone the primary display to secondary unless you specify in the application layer for which display to use using presentation mode.

  • Your screen should look like this after installation

Android Dual Display Launcher.png


  • Click on API Demos

Android Dual Display API Demo.png


  • Click on App should give you screen as below

Android Dual Display API Demo Click1.png


  • Click on Activity Should give you screen as below

Android Dual Display API Demo Click2.png


  • Click on Presentation with Media Router

Now you should see different outputs on each display, as seen below: