Skip to content

Conversation

@danieldegrasse
Copy link
Contributor

@danieldegrasse danieldegrasse commented Nov 11, 2024

Many MIPI DBI displays support a "tearing effect" signal, which can be
configured to signal each v-sync or h-sync interval. This signal can be
used by the MIPI DBI controller to synchronize writes with the
controller, and avoid tearing effects on the screen (which occur when
the write pointer from the MCU overlaps with the panel's read pointer in
the display controller's graphics RAM).

Add the mipi_dbi_configure_te API, which allows display controllers to
configure MIPI DBI controller to wait for a TE edge before streaming
display data. Allow the tearing enable parameters to be configured via
devicetree settings, since these will vary based on the MIPI DBI
controller and display controller in use.

For an example of how this signal can be used, see the write diagrams within the ST7796S datasheet (section 10.8.3):

image

image

Depends on #81245 for some fixes to the LCDIC driver

Todo:

  • Validate changes on frdm_mcxn947 with lcd_par_s035_8080 shield
  • Validate changes on rd_rw612_bga with adafruit_2_8_tft_touch_v2 shield

@danieldegrasse danieldegrasse force-pushed the feature/mipi-dbi-te branch 3 times, most recently from 846a4ad to 2c0edc7 Compare November 18, 2024 22:16
Many MIPI DBI displays support a "tearing effect" signal, which can be
configured to signal each v-sync or h-sync interval. This signal can be
used by the MIPI DBI controller to synchronize writes with the
controller, and avoid tearing effects on the screen (which occur when
the write pointer from the MCU overlaps with the panel's read pointer in
the display controller's graphics RAM).

Add the `mipi_dbi_configure_te` API, which allows display controllers to
configure MIPI DBI controller to wait for a TE edge before streaming
display data. Allow the tearing enable parameters to be configured via
devicetree settings, since these will vary based on the MIPI DBI
controller and display controller in use.

Signed-off-by: Daniel DeGrasse <[email protected]>
Comment on lines +343 to +344
Copy link
Member

Choose a reason for hiding this comment

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

Some controllers also support TE source (DSI link or External pin). How would you propose to configure this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have an example I could look at? Not sure I follow here. Do you mean that the MIPI controller supports selecting the TE source between an on chip DSI peripheral and external pin?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing this out- one thing to note, this is a DSI controller, not a DBI controller- so it wouldn't fit within the MIPI DBI API itself.

Looking at this more, I do think we'd need something like this within the MIPI DSI API though- it looks like DSI controllers can either signal TE via a dedicated GPIO pin, or via a D-PHY trigger event on the DSI bus itself.

@danieldegrasse
Copy link
Contributor Author

@Finomnis or @faxe1008, would either of you be willing to provide feedback on this PR?

@Finomnis
Copy link
Contributor

Finomnis commented Dec 3, 2024

Sure, but probably not within the next couple of days, due to short deadlines. Remind me again in a couple of days if I forget.

Copy link
Contributor

@Finomnis Finomnis Dec 5, 2024

Choose a reason for hiding this comment

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

I'm a little confused here; the way this if statement is written, if every single frame is frame_incomplete = false, then the te_sync will only be active every other write call. Is that intended?

I feel like the else should be removed, and the if (!desc->frame_incomplete) should be an independent separate block that gets always executed regardless of the previous if block.

Feel free to correct my thoughts if I'm mistaken.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I think you are right here. We always want the next call after one with frame_incomplete = false to trigger a TE wait. I'll update this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Add support for the mipi_dbi_configure_te API within the NXP LCDIC
peripheral. Also, remove a redundant code patch in the write_command
function that was previously used to determine when the display driver
was writing to graphics RAM, as these writes should now be performed
using the mipi_dbi_write_display API.

Signed-off-by: Daniel DeGrasse <[email protected]>
Use the mipi_dbi_configure_te API within the st7796s display driver.
If the MIPI DBI controller supports the tearing enable signal, then
configure the ST7796S to output the TE line signal.

Signed-off-by: Daniel DeGrasse <[email protected]>
Configure the TE signal for the rw_rw612_bga board when using the
lcd_par_s035 shield. This signal should be handled on the rising edge in
the default configuration, since the display writes from the MCU are
faster than the panel reads data.

Signed-off-by: Daniel DeGrasse <[email protected]>
@kartben kartben assigned danieldegrasse and unassigned kartben Dec 9, 2024
@Finomnis
Copy link
Contributor

Finomnis commented Dec 9, 2024

Looks good to me so far, although I didn't put the time into checking all the registers. But the general code doesn't seem wrong to me.

@danieldegrasse
Copy link
Contributor Author

Can't approve my own PR, reassigning to @dleach02 as this touches NXP drivers

@Finomnis
Copy link
Contributor

@danieldegrasse did you confirm with an osci that this is working properly?

@jfischer-no jfischer-no requested review from erwango and removed request for dbaluta, galak, kartben and manuargue December 10, 2024 14:01
@decsny decsny removed their request for review December 10, 2024 14:32
@danieldegrasse
Copy link
Contributor Author

@danieldegrasse did you confirm with an osci that this is working properly?

I have not with latest push (as I no longer have access to the hardware), but yes I have verified the TE signal delays as expected with a signal analyzer using the LVGL sample. That didn't expose the bug you caught because LVGL will only set frame_incomplete to false once every 10 frames in the default configuration (where the framebuffer is 10% of the screen size)

@kartben kartben merged commit 72c4700 into zephyrproject-rtos:main Dec 11, 2024
24 checks passed
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.

9 participants