SX20 screen refresh - DryOS Development - CHDK Forum supplierdeeply

SX20 screen refresh

  • 5 Replies
  • 3823 Views
SX20 screen refresh
« on: 02 / May / 2010, 05:56:56 »
Advertisements
I'm having problems getting the CHDK menu and other screen stuff refreshing correctly. In particular navigating from a big menu to a small menu, ie raw to main, leaves the rest of the menu drawn on screen.

I've checked many times and I believe
Code: [Select]
DEF(enabled_refresh_physical_screen, 0x9D68 + 0x28) // in FFA0499C

is correct for my camera.

The problem is that RefreshPhysicalScreen doesn't look the same as the SX10 in IDA and doesn't perform correctly when it is used. When I use RefreshPhysicalScreen I get very bad display issues, so on the recommendation in another thread or another camera I use ScreenUnlock. I think this causes new issues to do with the existing canon menus. I'm 99% sure I have got RefreshPhysicalScreen correct.

I'm at the point where I've run out of ideas. Can anyone point me in the right direction?

*

Offline whoever

  • ****
  • 280
  • IXUS950
Re: SX20 screen refresh
« Reply #1 on: 03 / May / 2010, 02:45:13 »
Find out how and in which sequence the relevant functions (LockPhysicalScreen, Enable/DisableRefreshPhysicalScreen, RefreshPhysicalScreen) are used in the firmware, and try to repeat it in your code for vid_bitmap_refresh().

For instance, in the very recent S90 port I see the sequence
   ScreenLock();
   EnableRefreshPhysicalScreen();
   ScreenUnlock();
which is probably there for a good reason (as far as I understand, ScreenLock=LockPhysicalScreen and ScreenUnlock=RefreshPhysicalScreen).

As to finding the correct addresses, if these functions are named in the firmware, as they used to be, it shouldn't be difficult to identify them beyond doubt.

Re: SX20 screen refresh
« Reply #2 on: 03 / May / 2010, 05:15:32 »
I've done quite a bit of work looking through the disassembly and there appears to be two wrapper functions around ScreenLock and ScreenUnlock which set a number of bits including enabled_refresh_physical_screen.

I can see in the disassembly that these are called in sequence in some parts. When I call them in the code below I don't get a screen refresh.

Code: [Select]
void vid_bitmap_refresh()
{
extern void _LockAndRefresh();
extern void _UnlockAndRefresh();

_LockAndRefresh();
_UnlockAndRefresh();
}

I've also tried calling ScreenLock, setting enabled_refresh_physical_screen then Unlock. As well as calling Refresh after setting the bit as well.

I've never really got any better results in any of these cases.

*

Offline whoever

  • ****
  • 280
  • IXUS950
Re: SX20 screen refresh
« Reply #3 on: 03 / May / 2010, 05:35:24 »
Well, then just keep investigating... Maybe they've changed the rules of the game... Would be unlikely though, unless it were a new DryOS revision?


Re: SX20 screen refresh
« Reply #4 on: 03 / May / 2010, 07:33:48 »
Somebody with more experience must know the answer.

Re: SX20 screen refresh
« Reply #5 on: 08 / May / 2010, 08:03:30 »
The fix for this issue is as follows:

It would appear that some DryOS cameras like the sd980 and SX20 need an extra bit set in order to perform a fullscreen refresh. This can be found in a subfunction of RefreshPhysical screen. For the SD980 this is 0x1B2DC, 0x9CF4 for the SX20.

In my build i've called this full_screen_refresh which seems to be about right.

In addition to this the SX20 doesn't like RefreshPhysicalScreen (ScreenUnlock) called on its own. If you do then the canon menus will stop being drawn correctly. After analysis it appears that there are two wrapper functions in the SX20 that are called together to signal a screen refresh. I've called this LockAndRefresh and UnLockAndRefresh. The following is my vid_bitmap_refresh which fixes the issues on the SX20.

Code: [Select]
void vid_bitmap_refresh()
{
extern int enabled_refresh_physical_screen;
extern int full_screen_refresh;

// i've tried refreshphysical screen (screen unlock) and that caused the canon and
// function menu to not display at all. This seems to work and is called in a similar
// way in other places where original OSD should be refreshed.
extern void _LockAndRefresh(); // wrapper function for screen lock
extern void _UnlockAndRefresh(); // wrapper function for screen unlock

_LockAndRefresh();

enabled_refresh_physical_screen=1;
full_screen_refresh=3; //set in ScreenUnlock underneath a CameraLog.c call sub_FFA02598

_UnlockAndRefresh();
}


 

Related Topics