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

Display (bitmap overlay)

  • 403 Replies
  • 143618 Views
*

Offline Ant

  • *****
  • 509
Re: Display (bitmap overlay)
« Reply #130 on: 05 / February / 2019, 13:52:15 »
Advertisements
JediDraw can also draw UYVY bitmaps:
Code: [Select]
46530:47561436: CtrlSrv:0x00000000:
Message: 0108: JediDraw, size:0044,addr:bff00500 [00-00]
bff00500: 0000006c 00000000 0000002c bff0051c 02341200 00000000 000000c0 5652414d
bff00520: 42541000 00000000 05000004 000003c0 000001e0 00000000
JediDraw content at 0x02341200:
02341200: 00000103 023412c0 0234128c 00000000 023412a8 00000004 00000000 00000000
02341220: 000000c0 00000001 00000000 00000000 000000ff 00000000 00000000 00000000
02341240: 42600000 42a80000 00f4016e 00640064 00640064 00000000 00000000 00000000
02341260: 00000000 00000000 000000ff 00640064 00640064 00000000 00000000 00000000
02341280: 00640000 00020202 00000000 00000002 00000001 00000000 00f4016e 00f40180
023412a0: 5f8cee00 000001e0 00000038 00000054 0000016e 000000f4 00000000 00000000
46530:JediDraw [366,244] at [15991150,15991168-1603071488,480] col:00000000 [0056:0084]

see "Playback information display"  and "Shooting information display" menu
5f8cee00 - address of bitmap
« Last Edit: 05 / February / 2019, 13:54:49 by Ant »

*

Offline reyalp

  • ******
  • 14125
Re: Display (bitmap overlay)
« Reply #131 on: 05 / February / 2019, 15:59:10 »
Very nice work  :D
Probably it could be used for rendering CHDK GUI, but we need to synchronize somehow with Canon GUI drawing...
I would expect there to be some kind of "finish", "flush" or "swapbuffers" command that actually updates the screen. If we could add a hook to draw our stuff just before it executes...
Don't forget what the H stands for.

*

Offline Ant

  • *****
  • 509
Re: Display (bitmap overlay)
« Reply #132 on: 05 / February / 2019, 16:48:11 »
IIRC, LCDMsg function creates a controller to redraw itself. So we can try to use the same method.

*

Offline srsa_4c

  • ******
  • 4451
Re: Display (bitmap overlay)
« Reply #133 on: 06 / February / 2019, 12:57:04 »
JediDraw can also draw UYVY bitmaps
Turns out I've already done some research into this ~ a year ago but did not finish or publish it. This method can resize the bitmap while copying.
I would expect there to be some kind of "finish", "flush" or "swapbuffers" command that actually updates the screen. If we could add a hook to draw our stuff just before it executes...
The usual message pattern is
GraphicSystemCoreFinish
JediFinish
XimrExe

where ximrexe initiates the overlay transfer.
So, maybe catching GraphicSystemCoreFinish and adding one more jedidraw before that could enable us to overwrite the overlay. Alpha blending our overlay would be even better...

*

Offline Ant

  • *****
  • 509
Re: Display (bitmap overlay)
« Reply #134 on: 06 / February / 2019, 13:13:54 »
Yes it can resize bitmaps as well as vector images:

*

Offline Ant

  • *****
  • 509
Re: Display (bitmap overlay)
« Reply #135 on: 06 / February / 2019, 13:29:32 »
Alpha blending our overlay would be even better...

Not sure about mixing two bitmaps. As you can see JediDraw overwrites information in bitmap buffers(this screenshot was made with "Skip D6 Opacity"):


It looks like Canon uses scanned certification logo  :)
« Last Edit: 06 / February / 2019, 13:33:49 by Ant »

*

Offline srsa_4c

  • ******
  • 4451
Re: Display (bitmap overlay)
« Reply #136 on: 10 / February / 2019, 12:10:02 »
@Ant
May I ask how you made your (vector and bitmap) experiments that resulted in the above pictures? Did you build your own jedidraw struct based on an earlier captured example or you used some higher level function? If you built your own, what did you do with pointers inside those structs that are normally set by Canon code?

If we want to make use of jedidraw, we need to be able to find out how to do it on various cameras. I captured (what I believe is) the equivalent of what you posted here, and the M10 version has some significant differences. So, unless a working higher level function is found, that would mean low level research on each model.

*

Offline Ant

  • *****
  • 509
Re: Display (bitmap overlay)
« Reply #137 on: 10 / February / 2019, 13:05:08 »
Drawing bitmap was not successful and I only modified canon's messages.
To draw vector and text I used this code:
Code: [Select]
int (*Clean_data_cache_line)() = 0xFC1300B3;
int (*SflwWrpDrawStringWithinRect)() = 0xFC3F1C9B;
int (*JediDraw)() = 0xFC4BB8BB;

void draw_rectangle_mzrm(coord x1, coord y1, coord x2, coord y2, int cl, int flags)
{
int JDarr[96] = {
0x00c00101, 0x02341380, 0xfd82d41c, 0x00000000, 0x02341358, 0x00000004, 0x00000000, 0x00000000,
0x000000c0, 0x00000001, 0x00000000, 0x00000000, 0x000000ff, 0x00000000, 0x00000000, 0x00000000,
0x42c80000, 0x42c80000, 0x01180208, 0x00640064, 0x00640064, 0x00000000, 0x00000000, 0x0234134c,
0x00000000, 0x00000000, 0x000000ff, 0x00640064, 0x00640064, 0x00000000, 0x00000000, 0x00000000,
0x00640100, 0x00000000, 0x0003f30c, 0x0000000c, 0x00000001, 0xffa0a0a0, 0x00000000, 0x00000000,
0x000002d0, 0x000001e0, 0xafafafaf, 0xafafafaf, 0xafafafaf, 0xafafafaf, 0xafafafaf, 0xafafafaf
};

int buf[9] = {
0x5652414D, 0x42541000, 0, 0x5000004, 0x3C0, 0x1E0, 0, 0, 0x60
};

JDarr[1] = &JDarr[0];

JDarr[4] = &JDarr[38];
JDarr[23] = &JDarr[35];
 
*(float*)(&JDarr[16]) = x1;
*(float*)(&JDarr[17]) = y1;
JDarr[18] = x2 + (y2 << 16);
JDarr[37] = cl;
JDarr[25] = 0x20001;

Clean_data_cache_line(JDarr, 0xC0);
JediDraw(buf, JDarr, 0, 0xC0);
}

void draw_string_mzrm(coord x, coord y, const char *s, int cl)
{
int buf[9] = {
0x5652414D, 0x42541000, 0, 0x5000004, 0x3C0, 0x1E0, 0, 0, 0x60
};
SflwWrpDrawStringWithinRect(buf, x << 16, y << 16, 0, 0, s, strlen(s), 0, 0, 0x64, 0);
}
transfer_src_overlay need to be called too.

*

Offline Ant

  • *****
  • 509
Re: Display (bitmap overlay)
« Reply #138 on: 10 / February / 2019, 13:57:48 »
Now bitmap drawing  is OK:


Code: [Select]
void draw_rectangle_mzrm(coord x1, coord y1, coord x2, coord y2, int cl, int flags)
{
int JDarr[96] = {
0x00000103, 0x02341d40, 0x02341d0c, 0x00000000, 0x02341d28, 0x00000004, 0x00000000, 0x00000000,
0x000000c0, 0x00000001, 0x00000000, 0x00000000, 0x000000ff, 0x00000000, 0x00000000, 0x00000000,
0x42de0000, 0x42e80000, 0x00F00168, 0x00640064, 0x00640064, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x000000ff, 0x00640064, 0x00640064, 0x00000000, 0x00000000, 0x00000000,
0x00640000, 0x00020202, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x01E002D0, 0x01E002E0,
0x5f8cee00, 0x000001e0, 0x00000000, 0x00000000, 0x000002d0, 0x000001e0, 0xaaaaaaaa, 0xaaaaaaaa
};

int buf[9] = {
0x5652414D, 0x42541000, 0, 0x5000004, 0x3C0, 0x1E0, 0, 0, 0x60
};

JDarr[1] = &JDarr[0];
JDarr[4] = &JDarr[42];
JDarr[2] = &JDarr[35];

JDarr[40] = *(int*)(0xC154); // bitmap buffer
JDarr[25] = 0x00020001; // border thickness
JDarr[26] = 0x00A000FF; // border color

Clean_data_cache_line(JDarr, 0xC0);
JediDraw(buf, JDarr, 0, 0xC0);
}
« Last Edit: 10 / February / 2019, 15:09:42 by Ant »

*

Offline srsa_4c

  • ******
  • 4451
Re: Display (bitmap overlay)
« Reply #139 on: 10 / February / 2019, 18:40:32 »
Now bitmap drawing  is OK
That's not bad. I wonder what happens if you're outside the menu (I mean, there are 2 rgba buffers and the menu draws on the second one).
How well is the M3 working in qemu? Does arm side mzrm messaging work, so stuff like this can be debugged? Other alternative (for me) is to port a1ex's mpu exception stuff as I see no easy way to intercept this drawing path.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal