Skip to content

DON'T SQUASH fix(vg_lite): force bilinear filter when translate hits pixel boundary - #10753

Open
FASTSHIFT wants to merge 2 commits into
lvgl:masterfrom
FASTSHIFT:fix_vg_lite_sub_pixel_rendering
Open

FASTSHIFT wants to merge 2 commits into
lvgl:masterfrom
FASTSHIFT:fix_vg_lite_sub_pixel_rendering

Conversation

@FASTSHIFT

Copy link
Copy Markdown
Collaborator

Check if the fractional part of a float is near 0.5 (pixel boundary).

When using VG_LITE_FILTER_POINT, the GPU samples at pixel centers. The initial sample coordinate c_step = 0.5 * step + translate. If the fractional part of translate is exactly 0.5, the sample lands on a pixel boundary where hardware rounding is ambiguous. Use a threshold around 0.5 to catch this case and force bilinear filtering for correct results.
The threshold 0.1 means: frac in [0.4, 0.6] is considered "near half".
Values like 0.25 and 0.75 (frac distance to 0.5 = 0.25) are safe.

Notes

…k for transformations

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
VG_LITE_FILTER_POINT computes the initial sample coordinate as:
  c_step = 0.5 * step + translate (from inverse matrix)

When the fractional part of translate is exactly 0.5, c_step lands on a
pixel boundary where hardware floor-rounding is ambiguous -- this causes
visible artifacts (confirmed: 0.5 fails, 0.25/0.75 are fine).

Fix lv_vg_lite_matrix_has_transform() to detect sub-pixel translations
whose fractional part falls within [0.4, 0.6] of a pixel boundary, and
return true to force VG_LITE_FILTER_BI_LINEAR in those cases.

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

PR report

Check Result
✅ Static Checks all checks passed
ℹ️ Coverage 100.0% of 1 changed line(s) (too few to enforce 50%) · overall 82.22% (vs master 82.22%, -0.00%)
➖ Performance no change in render_time
➖ Memory Usage no change
Coverage — 100.0% of 1 changed line(s) (too few to enforce 50%) · overall 82.22% (vs master 82.22%, -0.00%)

1 of 1 newly coverable line(s) are covered by the test suite.

Overall: 56010 of 68126 coverable line(s) are covered by the test suite. The latest master build, 4515eca13, covered 56007 of 68122. Commits merged to master since this branch was cut also move that comparison.

Performance — no change in render_time
Configuration render_time (ms) vs master
32b lv_conf_perf32b 19 no change
64b lv_conf_perf64b 17 no change

The full per-scene tables are in the job summary.

Memory Usage — no change

Linked image (--gc-sections)

Target Config Flash master Δ Flash RAM Δ RAM
arm-cortex-m4 standard 381.926 KB 381.926 KB +0 B 365.559 KB +0 B
arm-cortex-m4 rgb565 340.785 KB 340.785 KB +0 B 365.559 KB +0 B
arm-cortex-m4 minimal 156.406 KB 156.406 KB +0 B 75.746 KB +0 B
arm-cortex-m0plus standard 392.184 KB 392.184 KB +0 B 365.559 KB +0 B
arm-cortex-m0plus rgb565 348.312 KB 348.312 KB +0 B 365.559 KB +0 B
arm-cortex-m0plus minimal 164.464 KB 164.464 KB +0 B 75.746 KB +0 B
xtensa-esp32 standard 405.805 KB 405.805 KB +0 B 365.582 KB +0 B
xtensa-esp32 rgb565 354.602 KB 354.602 KB +0 B 365.582 KB +0 B
xtensa-esp32 minimal 175.027 KB 175.027 KB +0 B 75.746 KB +0 B
riscv32-esp32c3 standard 417.809 KB 417.809 KB +0 B 365.582 KB +0 B
riscv32-esp32c3 rgb565 369.906 KB 369.906 KB +0 B 365.582 KB +0 B
riscv32-esp32c3 minimal 178.504 KB 178.504 KB +0 B 75.746 KB +0 B

LVGL library, nothing dead-stripped

liblvgl.a in full. The linked image above only contains what the test application reaches. Useful to know how much memory LVGL will require when using a binding like MicroPython

Target Config Library master Δ
arm-cortex-m4 standard 339.410 KB 339.410 KB +0 B
arm-cortex-m4 rgb565 301.298 KB 301.298 KB +0 B
arm-cortex-m4 minimal 228.775 KB 228.775 KB +0 B
arm-cortex-m0plus standard 352.305 KB 352.305 KB +0 B
arm-cortex-m0plus rgb565 311.644 KB 311.644 KB +0 B
arm-cortex-m0plus minimal 238.922 KB 238.922 KB +0 B
xtensa-esp32 standard 437.639 KB 437.639 KB +0 B
xtensa-esp32 rgb565 387.404 KB 387.404 KB +0 B
xtensa-esp32 minimal 290.195 KB 290.195 KB +0 B
riscv32-esp32c3 standard 428.764 KB 428.764 KB +0 B
riscv32-esp32c3 rgb565 382.111 KB 382.111 KB +0 B
riscv32-esp32c3 minimal 284.627 KB 284.627 KB +0 B

Flash is text + data, RAM is data + bss.
Comparing 652979577 against 7cf49a06c.

Generated automatically

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/draw/vg_lite/lv_vg_lite_utils.h
Comment thread src/draw/vg_lite/lv_vg_lite_utils.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant