CTP coordinates do not match screen size

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CTP coordinates do not match screen size

Jump to solution
2,362 Views
dennis3
Contributor V

Hello,

I've added a custom LCD with touch panel to an imx8m processor.  The LCD is 720x1280.  The CTP has the same size.  Both my custom LCD driver and built in touch screen driver (GT911) seem to work properly.  Android boots and I can see the UI properly.

However, once in Android, the touch coordinates do not seem to generate touch events in the correct spot.  Vertical coordinates are fairly close if not right but horizontal coordinates are pretty incorrect.  If I touch the right half of the screen, the UI doesn't respond at all.  If I touch the left half, I get touch events on the UI, but they are offset from the location I touch.

At the kernel level, I enabled debugging on the touch driver and can see that all touch events are generated properly.  The delivered events have the right x,y coordinates over the entire panel regardless of what the UI is doing.

There appears to be a virtual offset being used and I don't know if it's a problem with the display or something else.  Here is a snippet from 

> dumpsys input

Motion Ranges:

      X: source=0x00001002, min=-778.000, max=1498.000, flat=0.000, fuzz=0.000, resolution=0.000

      Y: source=0x00001002, min=0.000, max=1279.000, flat=0.000, fuzz=0.000, resolution=0.000

      PRESSURE: source=0x00001002, min=0.000, max=1.000, flat=0.000, fuzz=0.000, resolution=0.000

      SIZE: source=0x00001002, min=0.000, max=1.000, flat=0.000, fuzz=0.000, resolution=0.000

      TOUCH_MAJOR: source=0x00001002, min=0.000, max=2612.112, flat=0.000, fuzz=0.000, resolution=0.000

      TOUCH_MINOR: source=0x00001002, min=0.000, max=2612.112, flat=0.000, fuzz=0.000, resolution=0.000

      TOOL_MAJOR: source=0x00001002, min=0.000, max=2612.112, flat=0.000, fuzz=0.000, resolution=0.000

      TOOL_MINOR: source=0x00001002, min=0.000, max=2612.112, flat=0.000, fuzz=0.000, resolution=0.000

    Touch Input Mapper (mode - direct):

      Parameters:

        GestureMode: multi-touch

        DeviceType: touchScreen

        AssociatedDisplay: hasAssociatedDisplay=true, isExternal=false, displayId=''

        OrientationAware: true

      Raw Touch Axes:

        X: min=0, max=720, flat=0, fuzz=0, resolution=0

        Y: min=0, max=1280, flat=0, fuzz=0, resolution=0

It's clear the raw touch axes are correct but I don't know why the Motion range is -778 to 1498.  Is this what's causing the issue?  How do I correct this?

Thank you for any input.

Tags (5)
0 Kudos
1 Solution
2,110 Views
dennis3
Contributor V

This problem went away when we upgraded to newer AOSP version of Android.

View solution in original post

0 Kudos
8 Replies
2,111 Views
dennis3
Contributor V

This problem went away when we upgraded to newer AOSP version of Android.

0 Kudos
2,110 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

This is problem is due because the AOSP launcher's layout not fit in your display's resolution. Unfortunately, this is out of our scope, you will need to customize your Android AOSP to make work your new LCD display. Or, you could go with professional service support. They should help you for sure. 

Professional Support for Processors and Microcontrollers | NXP 

Best regards,

Diego.

0 Kudos
2,110 Views
dennis3
Contributor V

Thank you,  

I'd since figured as well that the display in Android isn't matching the size of our physical display.

Android log is reporting:

DisplayManagerService: Display device added: DisplayDeviceInfo{"Built-in Screen": uniqueId="local:0", 1920 x 1080, modeId 1, defaultModeId 1, supportedModes [{id=1, width=1920, height=1080, fps=60.0}], colorMode 0, supportedColorModes [0], HdrCapabilities android.view.Display$HdrCapabilities@40f16308, density 320, 320.0 x 320.0 dpi, appVsyncOff 1000000, presDeadline 16666667, touch INTERNAL, rotation 0, type BUILT_IN, state UNKNOWN, FLAG_DEFAULT_DISPLAY, FLAG_ROTATES_WITH_CONTENT, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}

DisplayManagerService: Display device added: DisplayDeviceInfo{"HDMI Screen": uniqueId="local:1", 720 x 1280, modeId 2, defaultModeId 2, supportedModes [{id=2, width=720, height=1280, fps=60.000004}], colorMode 0, supportedColorModes [0], HdrCapabilities android.view.Display$HdrCapabilities@40f16308, density 213, 213.0 x 213.0 dpi, appVsyncOff 1000000, presDeadline 16666666, touch EXTERNAL, rotation 0, type HDMI, state UNKNOWN, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS, FLAG_PRESENTATION}

It seems a simple problem of android getting confused which display is internal and which is external.  The Built in screen should be the 720x1280 display and HDMI should be 1920x1080.

If I simply change the command line parameters to exclude androidboot.primary_display=imx-drm then I no longer get an HDMI screen and and the LCD correctly reports as the built in display.  In this case Android never switches to running the display on the LCD though and it remains showing the Linux boot logo (4 tuxes).

We're using 

 DCSS->hdmi

 LCDIF->lcd

Is this something I can change in the DTS file or is this Android improperly detecting the hardware?

0 Kudos
2,110 Views
dennis3
Contributor V

Additional info.

 if I remove HDMI completely and disabled the LCDIF.

so DCSS -> mipi_dsi -> mipi_dsi_bridge -> my mipi_panel

In this case, the display is set up properly with the correct resolution 720x1280 and the touch panel now is mapped correctly.

The only caveat is we no longer have HDMI out.  So the question still remains how to properly drive the LCD and HDMI at the same time.  Can the LCDif drive HDMI? There are no examples of this in the DTS files but maybe that would be a solution.  Alternatively, it seems like there is somewhere in Android that just needs correctly configured at runtime.

0 Kudos
2,110 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

The most exact example that we have is to use the device tree for the dual display. However, in that device tree. We only have support for the MIPI-DSI to HDMI bridge and the HDMI output. I suggest you to use that device tree but implementing the configuration that you made with the LCD module. The device tree is the following one:

Image-fsl-imx8mq-evk-dual-display.dtb

However, as I said before, this is out of our scope of support.

Best regards,

Diego.

0 Kudos
2,110 Views
dennis3
Contributor V

This is what I did originally that didn't work.

0 Kudos
2,110 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

I do not know if you could solve that problem in the device tree. But a solution could be executing that command line in the init.rc file. 

on property:dev.bootcomplete=1     exec - system system -- /system/bin/sh <custom script path>

Best regards,

Diego.

0 Kudos
2,110 Views
dennis3
Contributor V

I'm familiar enough with adding init.rc custom scripts.

I don't know what you would put in <custom script path> though.  What shell commands can fix the display mixup?

0 Kudos