FS#12462 - TMS320DM320 runtime improvement by disabling ImageBuffer clock

Attached to Project: Rockbox
Opened by Tomasz Moń (desowin) - Sunday, 18 December 2011, 08:04 GMT
Last edited by Tomasz Moń (desowin) - Monday, 19 December 2011, 06:41 GMT
Task Type Patches
Category Drivers
Status Closed
Assigned To Tomasz Moń (desowin)
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


TMS320DM320 devices running Rockbox operates with constantly running ImageBuffer clock. This leads to increased power consumption. This clock seems to be required to send interrupt from DSP to ARM.

On m:robe 500, ImageBuffer is used for LCD updates. On Sansa Connect, using it caused over 6 times increase in whole screen update and over 7 times more fps when updating 1/4 screen (both when unboosted; tested using test_fps).

Attaches are two patches.
imagebuffer_clock_on_demand.patch - this patch makes DSP turn on and off clock just for the mere moment of interrupting ARM. On Sansa Connect it resulted in 40 minutes runtime enhancement.
connect-lcd-dma.patch - this patch makes use of ImageBuffer for faster screen updates (mentioned above).

Unfortunately, applying those two patches in single build is prone to race conditions (actual check in DSP code is well, wrong, as DSP and ARM run concurently).
To solve the problem I can think of two possible solutions:
1) Handle ImageBuffer clock enable/disable entrinely to DSP
2) Search for some other way for DSP to interrupt ARM without the need for running ImageBuffer clock

As I don't have m:robe 500, I cannot test the impact on runtime of imagebuffer patch on this device. To run proper test one would need to disable the LCD_USE_DMA in lcd-mr500.c (screen update turns on IMGBUF clock), as well as change the IMGBUF clock initialization in pcm-mr500.c.
This task depends upon

Closed by  Tomasz Moń (desowin)
Monday, 19 December 2011, 06:41 GMT
Reason for closing:  Accepted
Additional comments about closing:  Sansa Connect LCD patch commited as r31357. ImageBuffer clock on demand commited as r31358.
Comment by Tomasz Moń (desowin) - Sunday, 18 December 2011, 09:03 GMT
Actually, in the datasheet section about Coprocessor subsystem Clock Control there is note that the enable bits in IO_CLK_MOD1 and CP_CLKC are logically ORed, hence it is not prone to race conditions :-)

Attached are modified versions of both patches.
imagebuffer_clock_on_demand_v2.patch can be tested as is on m:robe 500.
Comment by Tomasz Moń (desowin) - Sunday, 18 December 2011, 11:18 GMT
Sychronised connect lcd patch to current SVN.