Skip to content

Conversation

@hakehuang
Copy link
Contributor

introduce a display test harness.

  1. using a camera to capture the display content.
  2. calculate fingerprint for given display at customer time
  3. in CI, compare the fingerprint with the runtime capture video frames.

please check the readme for more details

Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

Interesting approach, very comprehensive and could help testing Zephyr-based UVC cameras themselves as well maybe some day.

Out of curiosity, is it resilient to the DUT being rotated and moved slightly by accident? While looking quickly, I did not find anything to try to crop the view to the display rectangle only.

A few comments left to help move this forward.

@kartben kartben requested a review from Copilot June 14, 2025 17:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a display test harness that uses a camera to capture display output, computes fingerprints at customer runtime, and compares them against reference frames in CI.

  • Added board configuration files and overlay settings for display tests
  • Extended Twister schema and harness to support a new display_capture test mode
  • Introduced a standalone display-twister-harness Python package with camera capture and fingerprint plugins

Reviewed Changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/drivers/display/display_check/boards/*.conf/.overlay Added per-board display test memory and overlay configs
tests/drivers/display/display_check/CMakeLists.txt Defined Zephyr test project sources
scripts/schemas/twister/testsuite-schema.yaml Extended schema with optional display_capture_config
scripts/pylib/twister/twisterlib/testinstance.py Whitelisted display_capture harness
scripts/pylib/twister/twisterlib/harness.py Implemented Display_capture harness subclass
scripts/requirements-run-test.txt Added OpenCV and NumPy dependencies
scripts/pylib/display-twister-harness/{test_display.py,…} New pytest fixtures, tests, and camera capture code
scripts/pylib/display-twister-harness/camera_shield/** Core camera controller, plugin base, and plugin API
scripts/pylib/display-twister-harness/camera_shield/README.rst Usage and setup documentation
Comments suppressed due to low confidence (7)

scripts/pylib/display-twister-harness/README.rst:12

  • Typo in comment: 'reslution' should be 'resolution'.
  rex_x: 1280   # x reslution

scripts/pylib/display-twister-harness/README.rst:30

  • Typo in comment: 'direcory' should be 'directory'.
  #      directory: "./fingerprints" # fingerprints direcory to compare with not used in generate mode

scripts/pylib/display-twister-harness/README.rst:118

  • Typo in comment above: 'mutliply fingure prints' should be 'multiply fingerprint files'.
   but will help to check other defects.

scripts/pylib/display-twister-harness/camera_shield/config.yaml:1

  • The key 'rex_x' appears to be a typo; it should be 'res_x' to match the rest of the code.
case_config: {device_id: 0, fps: 30, res_y: 720, rex_x: 1280, run_time: 20}

scripts/pylib/twister/twisterlib/harness.py:632

  • [nitpick] Class names typically follow PascalCase without underscores; consider renaming to DisplayCapture for consistency.
class Display_capture(Pytest):

scripts/pylib/display-twister-harness/test_display.py:19

  • [nitpick] The docstring for get_prompt is very generic; consider describing the structure of the returned dict and possible keys.
def get_prompt(config):

tests/drivers/display/display_check/boards/mimxrt1170_evk_mimxrt1176_cm7.conf:7

  • The comment uses 'panelwidth' twice but the example calculation uses height; clarify which dimensions are used in the formula.
# Sample will allocate buffer equal to: (panelwidth / 8) * (panelwidth / 4) * pixel depth. For a

@hakehuang
Copy link
Contributor Author

Out of curiosity, is it resilient to the DUT being rotated and moved slightly by accident? While looking quickly, I did not find anything to try to crop the view to the display rectangle only.

No by current algorithm, as this could be a problem the display is wrongly goes to upside down. but it is extendable.

@hakehuang hakehuang force-pushed the screen_test_harness branch 2 times, most recently from f2cb344 to e1a1214 Compare June 16, 2025 05:23
@josuah
Copy link
Contributor

josuah commented Jun 16, 2025

It looks like this project can be used for testing a lot of things that are difficult to test automatically on Zephyr:

  • Motors
  • LEDs
  • Displays
  • Cameras (by replacing the UVC camera of the setup by a Zephyr camera, or by sending the camera output to a display)
  • GUIs plotted on display

Right away or in the future, it can be interesting to rename scripts/pylib/display-twister-harness into something more generic. Maybe scripts/pylib/webcam-twister-harness.

For what it currently does, scripts/pylib/display-twister-harness seems fit, however.

@hakehuang hakehuang force-pushed the screen_test_harness branch 4 times, most recently from 10e4383 to 3372969 Compare June 19, 2025 05:04
Copy link
Contributor

@JarmouniA JarmouniA left a comment

Choose a reason for hiding this comment

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

There is no need to add me as co-author:)

@hakehuang hakehuang force-pushed the screen_test_harness branch 4 times, most recently from 9bf7072 to c63afc4 Compare August 6, 2025 04:16
@hakehuang hakehuang requested a review from JarmouniA August 6, 2025 05:14
@hakehuang hakehuang force-pushed the screen_test_harness branch from c63afc4 to 4ff95ab Compare August 6, 2025 05:21
Copy link
Contributor

@JarmouniA JarmouniA left a comment

Choose a reason for hiding this comment

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

Last nits, otherwise looks great!

@hakehuang hakehuang force-pushed the screen_test_harness branch from 4ff95ab to 1b4e54e Compare August 6, 2025 08:49
@hakehuang hakehuang requested a review from JarmouniA August 6, 2025 10:06
@hakehuang hakehuang force-pushed the screen_test_harness branch from 1b4e54e to 99425c1 Compare August 7, 2025 05:41
JarmouniA
JarmouniA previously approved these changes Aug 7, 2025
Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

Sorry for noticing it just now, only some very small changes, but otherwise it's all ok.

@sonarqubecloud
Copy link

hakehuang and others added 2 commits August 10, 2025 11:01
display harness to validate display content

Signed-off-by: Hake Huang <[email protected]>
Co-authored-by: Abderrahmane JARMOUNI <[email protected]>
add a test case for display using  display harness

Signed-off-by: Hake Huang <[email protected]>
Co-authored-by: Abderrahmane JARMOUNI <[email protected]>
@hakehuang hakehuang requested a review from josuah August 11, 2025 10:46
@jhedberg jhedberg merged commit d627d56 into zephyrproject-rtos:main Aug 12, 2025
47 checks passed
@cfriedt cfriedt moved this to 4.3 in Release Plan Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 4.3
Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants