Display (bitmap overlay) - page 15 - General Discussion and Assistance - CHDK Forum  

Display (bitmap overlay)

  • 403 Replies
  • 123908 Views
*

Offline Ant

  • *****
  • 509
Re: Display (bitmap overlay)
« Reply #140 on: 11 / February / 2019, 05:16:56 »
Advertisements
How well is the M3 working in qemu? Does arm side mzrm messaging work, so stuff like this can be debugged?
Menu navigation works only in playback mode, without images on card(probably because of missing the Omar core).
Yes.
 https://www.magiclantern.fm/forum/index.php?topic=2864.msg211107#msg211107

Quote
Other alternative (for me) is to port a1ex's mpu exception stuff as I see no easy way to intercept this drawing path.
Probably there is another way. But it's need to check if canon code updates the pointer at 0xBFF00420 or not.

Quote
I wonder what happens if you're outside the menu

« Last Edit: 11 / February / 2019, 13:17:40 by Ant »

*

Offline srsa_4c

  • ******
  • 4451
Re: Display (bitmap overlay)
« Reply #141 on: 11 / February / 2019, 18:26:22 »
Menu navigation works only in playback mode, without images on card(probably because of missing the Omar core).
Have you published your qemu changes somewhere?

Quote
Quote
Other alternative (for me) is to port a1ex's mpu exception stuff as I see no easy way to intercept this drawing path.
Probably there is another way. But it's need to check if canon code updates the pointer at 0xBFF00420 or not.
I meant the higher level ARM side functions, many of those don't call any RAM functions and can only be intercepted with the MPU exception method.
I'm still trying to research what jedidraw is capable of (the yuv bitmap method). I already found that one of the 0x64 (100 decimal) bytes is image brightness. Would be great if it supported different image formats or transparency.

*

Offline srsa_4c

  • ******
  • 4451
Re: Display (bitmap overlay)
« Reply #142 on: 24 / February / 2019, 08:01:21 »
On the m10, one of the bytes in the JediDraw struct appears to control mixing the old drawings and the new. It is initially 0x64 (this 0x64 is separate from those words that are set to 0x640064). From Ant's example, it looks like this struct member is either missing or located elsewhere on the m3. On the m10, it's in the second word of the big struct.
I could not find this until I stopped experimenting with changing the fw's JediDraw messages on-the-fly: Canon uses multiple layers for almost everything, so many of the changes have no visible effects because lower and upper layers are concealing them.
Also found a possible hook, called right after GraphicSystemCoreFinish is sent. Did not test it yet.
Code: [Select]
loc_FC20DA5A: 6 refs ▼
 push      {r4, lr}
 movs      r4, #0
 bl        0xfc3eb656 ; <GraphicSystemCoreFinish>
 ldr       r0, =0xC500 @ FC20DA74 ; <ptr_hook_after_gscf>
 ldr       r0, [r0, #0]
 cbz       r0, 0xfc20da6c
 blx       r0
 mov       r4, r0
loc_FC20DA6C: 1 refs ▲
 mov       r0, r4
 pop       {r4, pc}

*

Offline Ant

  • *****
  • 509
Re: Display (bitmap overlay)
« Reply #143 on: 24 / February / 2019, 10:18:00 »
From Ant's example, it looks like this struct member is either missing or located elsewhere on the m3. On the m10, it's in the second word of the big struct.

Do you mean this word 006a64a0[+128]: 00640100 ?
There need to see your logs. Which GUI elemets use this mixing?

Quote
many of the changes have no visible effects
Just in case: did you call Clean_data_cache_line?

P.S. attached my log...
« Last Edit: 24 / February / 2019, 10:39:34 by Ant »


*

Offline srsa_4c

  • ******
  • 4451
Re: Display (bitmap overlay)
« Reply #144 on: 24 / February / 2019, 10:38:05 »
Do you mean this word 006a64a0[+128]: 00640100 ?
I don't know. Here's mine (m10, all words are hex):
Code: [Select]
17810: [CtrlSrv] JD, abb 0;
*R0: 460560
5652414d,
41e7eb00,
0,
5000004,
3c0,
1e0,
0,
*R1: 1abeb40
2000103,    -> drawing type and direction
640202,     -> byte2: percentage of new drawing vs old content at the same place (defaults to 100)
4c,         -> never changes
1abec20,    -> points after this struct
1abebdc,    -> points to bitmap descriptor, inside this struct
0,
1abebf8,    -> points to some coordinates, inside this struct
4,
0,
0,
e0,         -> length of this struct in bytes
1,
0,
0,
ff,
0,
0,
0,          -> pointer in some other JD messages
0,
43eb0000,   -> destination coordinate in float
438c8000,   -> destination coordinate in float
9600c8,     -> destination height, width
0,
640064,     -> influences pixel data interpretation
640064,     -> influences pixel data interpretation
0,          -> influences pixel data interpretation
0,
0,          -> pointer in some other JD messages
0,
0,
20001,      -> border width
3e3e3eff,   -> border color
640064,     -> 080008 makes grey border dark blue
640064,     -> 080008 makes grey border vanish
0,
0,
200,        -> crash when byte1 changed
0,
0,
2,          -> crash when altered
10107,      -> junk word
140000,     -> y, x offset in src
7800a0,     -> height, width to copy
a000a0,     -> full height, width
5823cb00,   -> bitmap (yuv) buffer
0,          -> junk word
0,          -> ? some coords
9,          -> ? some coords
2d0,        -> ? some coords
1d4,        -> ? some coords
c0,         -> junk
1,          -> junk
0,          -> junk
0,          -> junk
ff,         -> junk
0,          -> junk
Quote
Which GUI elemets use this mixing?
I only hand-picked some JD structs, none of them has a value different from 0x64. Historically, Canon has been avoiding overlapping graphics as far as I can tell.

Quote
Just in case: did you call Clean_data_cache_line?
Yes, I based my function on your example.

A logged session (startup in playback mode and entering thumbnail-view) of JD structs is attached.

edit:
Added some empirical notes to some struct members. byte0: lsb in a word, byte3: msb in a word
« Last Edit: 24 / February / 2019, 12:05:09 by srsa_4c »

*

Offline srsa_4c

  • ******
  • 4451
Re: Display (bitmap overlay)
« Reply #145 on: 24 / February / 2019, 11:01:45 »
Quote
Just in case: did you call Clean_data_cache_line?
Oops. I was not doing this during that part of research, so that may be it.  :-[
But the multiple layer stuff I mentioned still stands (drop shadow, borders, etc).

*

Offline Ant

  • *****
  • 509
Re: Display (bitmap overlay)
« Reply #146 on: 24 / February / 2019, 11:15:58 »
(drop shadow, borders, etc).
If you mean shadow around OSD icons - it's a border that can be modified in JD structure.

Your JD structure is slightly different. Can you specify your mixing word?

Quote
Historically, Canon has been avoiding overlapping graphics as far as I can tell.
Found this situation: see histogram and focus frame.


But this is vector graphic. Not sure this possible for bitmaps...
« Last Edit: 24 / February / 2019, 11:27:38 by Ant »

*

Offline srsa_4c

  • ******
  • 4451
Re: Display (bitmap overlay)
« Reply #147 on: 24 / February / 2019, 12:04:06 »
(drop shadow, borders, etc).
If you mean shadow around OSD icons - it's a border that can be modified in JD structure.

Your JD structure is slightly different. Can you specify your mixing word?
Not sure what mixing word is, but I added notes to the example struct above. JD can draw borders by itself, but I think the drop shadow is not specified in the same message as the yuv bitmap.

Quote
Found this situation: see histogram and focus frame.
Yeah, and seems like there's more of that. It's very likely though that the histogram and/or grid and/or focus rect is drawn onto the other rgba surface, so only the end result is mixed.


*

Offline Ant

  • *****
  • 509
Re: Display (bitmap overlay)
« Reply #148 on: 24 / February / 2019, 12:48:48 »
It's very likely though that the histogram and/or grid and/or focus rect is drawn onto the other rgba surface, so only the end result is mixed.

Yes. Focus frame is drawn at 42703000 and histogram is drawn at 42541000.
I also found the third type of JD structure used for histogram:
Code: [Select]
21170:22189900: CtrlSrv:0x00000000:
Message: 0108: JediDraw, size:0044,addr:bff00500 [11-10]
bff00500: 0000006c 00000000 0000002c bff0051c 02341680 00000000 000004a0 5652414d
bff00520: 42541000 00000000 05000004 000003c0 000001e0 00000000
JediDraw content at 0x02341680:
02341680: 00400105 02341b20 00000000 00000000 02341b0c 00000004 00000000 00000000
023416a0: 000004a0 00000001 00000100 00000080 f0f0f0ff 0234170c 00247864 00000000
023416c0: 43b98000 422c0000 00aa0100 00640064 00640064 00000000 00000000 00000000
023416e0: 00000000 00000000 000000ff 00640064 00640064 00000000 00000000 00000000
02341700: 00640000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
02341720: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
02341740: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
02341760: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
02341780: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
023417a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
023417c0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
023417e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
02341800: 00000000 00000001 00000001 00000001 00000001 00000001 00000001 00000000
02341820: 00000000 00000000 00000000 00000001 00000000 00000001 00000000 00000001
02341840: 00000000 00000001 00000001 00000001 00000001 00000001 00000001 00000001
02341860: 00000000 00000001 00000001 00000001 00000001 00000001 00000001 00000000
02341880: 00000001 00000001 00000001 00000001 00000001 00000001 00000002 00000001
023418a0: 00000001 00000001 00000001 00000001 00000001 00000002 00000002 00000002
023418c0: 00000002 00000002 00000002 00000002 00000002 00000001 00000001 00000002
023418e0: 00000001 00000002 00000002 00000002 00000002 00000002 00000002 00000002
02341900: 00000002 00000003 00000003 00000003 00000003 00000002 00000003 00000003
02341920: 00000002 00000003 00000005 00000006 00000005 00000005 00000005 00000006
02341940: 00000006 00000008 00000008 0000000b 0000000b 00000009 00000007 00000007
02341960: 00000008 00000008 00000007 00000007 00000007 00000009 00000008 00000009
02341980: 00000007 00000007 0000000b 00000009 00000009 0000000b 0000000a 00000009
023419a0: 0000000a 0000000a 0000000c 0000000c 0000000d 0000000d 0000000d 0000000f
023419c0: 0000000d 00000010 00000014 00000014 0000000f 00000010 0000000f 00000014
023419e0: 00000016 00000017 00000015 00000013 00000015 00000017 00000017 00000018
02341a00: 00000018 00000017 00000019 00000016 00000017 00000017 00000018 0000001a
02341a20: 00000019 0000001e 00000020 00000021 00000021 00000022 00000026 00000027
02341a40: 0000002b 00000031 0000002c 0000002b 0000002d 0000002f 00000030 00000032
02341a60: 00000032 00000037 00000037 0000003f 0000003f 00000037 00000034 00000039
02341a80: 00000039 00000043 0000004a 0000004f 0000004b 00000048 0000004c 00000048
02341aa0: 00000050 00000051 0000004e 0000004f 0000004e 00000055 00000053 00000052
02341ac0: 00000056 0000005d 0000005f 00000061 00000068 00000065 0000006b 00000071
02341ae0: 0000007c 0000008e 000000ab 000000b5 0000009a 00000099 000000b6 00000064
02341b00: 0000005f 00000098 00000333 00000173 0000002b 00000100 000000aa 00000000
21170:JediDraw [256,170] at [000,000-000,000] col:00000000 [0371:0043]

*

Offline srsa_4c

  • ******
  • 4451
Re: Display (bitmap overlay)
« Reply #149 on: 28 / February / 2019, 14:12:45 »
found a possible hook, called right after GraphicSystemCoreFinish is sent. Did not test it yet.
Calling my jedidraw (drawing yuv bitmap, same size as the one in the playback information display menu) from that hook worked. This method obviously only updates that bitmap when the Canon overlay is being drawn.

From Ant's example, it looks like this struct member is either missing or located elsewhere on the m3. On the m10, it's in the second word of the big struct.

Do you mean this word 006a64a0[+128]: 00640100 ?
There need to see your logs. Which GUI elemets use this mixing?
In playback mode when multiple thumbnails are shown at once, scrolling through them at max speed (by holding down 'up' or 'down') fires jedidraw messages where that byte is less than 100.

I started collecting bigger logs by using one of the RAM areas that appear to be unused for a longer time. (I filled a large part of RAM with a magic word and used a function to find untouched areas).
For logging format, I currently output each jedidraw (and other) message in one line, csv format. This log can then be loaded in a spreadsheet (LibreOffice Calc in my case) which can help evaluating some of the words in those messages.

 

Related Topics