Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules: lvgl: Fix coordinate handling for invert-{x,y} and swap-xy #70541

Merged

Conversation

faxe1008
Copy link
Collaborator

This patch fixes two issue in the coordinate handling of the zephyr,lvgl-pointer-input compatible:

  • If the swap-xy flag is set the coordinates need to be swapped even before the sync event is received.
  • If the invert-{x,y} property is set the coordinates should only be inverted when the state is pressed. This is because the pointer saves the coordinates of a previous press event and upon release event it reuses them, causing the inversion to be applied twice.

Resolves issue #70539.

@zephyrbot zephyrbot added the area: LVGL Light and Versatile Graphics Library Support label Mar 21, 2024
@zephyrbot zephyrbot requested review from brgl and pdgendt March 21, 2024 08:24
@Benni77
Copy link

Benni77 commented Mar 21, 2024

I have tested the fix on my side, it works great 👍️
Thanks for the super fast fix.

pdgendt
pdgendt previously approved these changes Mar 22, 2024
@faxe1008
Copy link
Collaborator Author

@fabiobaltieri finally had some cycles to come back to this, can you take a peek if thats what you had in mind? I put the additional x and y coordinate into a specialized struct for the pointer to not waste space on the other indevs. :^)

@fabiobaltieri
Copy link
Member

Yes I think this is good, can you squash the commits?

@faxe1008
Copy link
Collaborator Author

ping @fabiobaltieri I did the rebase :^)

@fabiobaltieri
Copy link
Member

fabiobaltieri commented Apr 30, 2024

@faxe1008 hey just noticed you left the squased commit comment in the commit message, wanna clean that up? I'll try to not miss the notification and reapprove immediately this time :-) (that's because you used squash when squashing, git merges the comments, you could have used "fixup" instead, it would have discarded the message of the fixup commit)

This patch fixes two issues in the coordinate handling of the
`zephyr,lvgl-pointer-input` compatible:
- If the swap-xy flag is set the coordinates need to be swapped even
  before the sync event is received.
- The coordinates are stored into an additional variable instead of the
  pending_event. This is done to prevent the double inversion for touch
  release events.

Resolves issue zephyrproject-rtos#70539.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
@glenn-andrews
Copy link
Contributor

This breaks the adafruit_2_8_tft_touch_v2 shield.

Touch presses are now rotated 180 degrees (top-left is bottom right, etc.)

glenn-andrews added a commit to glenn-andrews/zephyr that referenced this pull request May 26, 2024
zephyrproject-rtos#70541 has an
issue where if the screen has been rotated, values calculated if
invert-x or invert-y are set will be overwritten.

This breaks the adafruit_2_8_tft_touch_v2 touchscreen as the
display is rotated by 90 degrees but uses invert-x and invert-y.

This change makes the invert-x and invert-y options independent
of screen rotation.

Signed-off-by: Glenn Andrews <glenn.andrews.42@gmail.com>
tmp = point->x;
point->x = point->y;
point->y = cap->y_resolution - tmp;
point->x = data->point_y;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right. If cfg->invert_x or cfg->invert_y are set, AND the display orientation is rotated, you overwrite the inversion.

Copy link
Contributor

@larsgk larsgk May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is what breaks input for me too. I am using the Adafruit 2.8 shield and trying to just do a simple tab view. The input seems to "work" by pressing the inverse x & y positions (like the input detection is rotated 180 degrees).

FYI, I am just using the default 90 degree orientation set in the devicetree defs for the shield

glenn-andrews added a commit to glenn-andrews/zephyr that referenced this pull request May 26, 2024
zephyrproject-rtos#70541 has an
issue where if the screen has been rotated, values calculated if
invert-x or invert-y are set will be overwritten.

This breaks the adafruit_2_8_tft_touch_v2 touchscreen as the
display is rotated by 90 degrees but uses invert-x and invert-y.

This change makes the invert-x and invert-y options independent
of screen rotation.

Signed-off-by: Glenn Andrews <glenn.andrews.42@gmail.com>
@larsgk
Copy link
Contributor

larsgk commented May 27, 2024

This breaks the adafruit_2_8_tft_touch_v2 shield.

Touch presses are now rotated 180 degrees (top-left is bottom right, etc.)

Scrolling to find this comment after I made mine on the same ;) But yes, .. probably good to have the touch test sample in #67508

carlescufi pushed a commit that referenced this pull request May 27, 2024
#70541 has an
issue where if the screen has been rotated, values calculated if
invert-x or invert-y are set will be overwritten.

This breaks the adafruit_2_8_tft_touch_v2 touchscreen as the
display is rotated by 90 degrees but uses invert-x and invert-y.

This change makes the invert-x and invert-y options independent
of screen rotation.

Signed-off-by: Glenn Andrews <glenn.andrews.42@gmail.com>
ioannis-karachalios added a commit to dialog-semiconductor/zephyr that referenced this pull request May 28, 2024
This commit should take care of the changes
introduced in zephyrproject-rtos#70541.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this pull request May 28, 2024
zephyrproject-rtos/zephyr#70541 has an
issue where if the screen has been rotated, values calculated if
invert-x or invert-y are set will be overwritten.

This breaks the adafruit_2_8_tft_touch_v2 touchscreen as the
display is rotated by 90 degrees but uses invert-x and invert-y.

This change makes the invert-x and invert-y options independent
of screen rotation.

(cherry picked from commit a70bf0e)

Original-Signed-off-by: Glenn Andrews <glenn.andrews.42@gmail.com>
GitOrigin-RevId: a70bf0e
Change-Id: I889c7159335bd913b3c94b86ac98e7b86bdcbff3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5575345
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Commit-Queue: Tristan Honscheid <honscheid@google.com>
Tested-by: Tristan Honscheid <honscheid@google.com>
Reviewed-by: Tristan Honscheid <honscheid@google.com>
crazyskady pushed a commit to crazyskady/zephyr that referenced this pull request Jun 6, 2024
zephyrproject-rtos#70541 has an
issue where if the screen has been rotated, values calculated if
invert-x or invert-y are set will be overwritten.

This breaks the adafruit_2_8_tft_touch_v2 touchscreen as the
display is rotated by 90 degrees but uses invert-x and invert-y.

This change makes the invert-x and invert-y options independent
of screen rotation.

Signed-off-by: Glenn Andrews <glenn.andrews.42@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: LVGL Light and Versatile Graphics Library Support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants