Skip to content

Commit

Permalink
Optimise Pi zero 2 capture code and modify warning
Browse files Browse the repository at this point in the history
  • Loading branch information
IanSB committed Nov 5, 2021
1 parent b949669 commit 31228ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/defs.h
Expand Up @@ -117,6 +117,7 @@
#define SCREEN_START 0x1E000000 // start of screen area
#define SCREEN_SIZE 0x02000000 // size of screen area
#define CACHED_SCREEN_OFFSET 0x01000000 // offset to cached screen area
#define WARN_12BIT // warn that 9bpp & 12bpp won't work
#define HIDE_12BIT_PROFILES // 12 bit profile won't work on Pi zero2 etc
//#define INHIBIT_DOUBLE_HEIGHT // inhibit line doubling as it causes memory stalls
//#define USE_ALT_M7DEINTERLACE_CODE // uses re-ordered code for mode7 deinterlace
Expand All @@ -129,6 +130,7 @@
#define SCREEN_START 0x1E000000 // start of screen area
#define SCREEN_SIZE 0x02000000 // size of screen area
#define CACHED_SCREEN_OFFSET 0x01000000 // offset to cached screen area
#define WARN_12BIT // warn that 9bpp & 12bpp won't work
#define HIDE_12BIT_PROFILES // 12 bit profile won't work on Pi zero2 etc
//#define INHIBIT_DOUBLE_HEIGHT // inhibit line doubling as it causes memory stalls
//#define USE_ALT_M7DEINTERLACE_CODE // uses re-ordered code for mode7 deinterlace
Expand Down
17 changes: 9 additions & 8 deletions src/rgb_to_fb.S
Expand Up @@ -2226,14 +2226,15 @@ wait_capture_count:
beq wait_capture_count
ldr r12, write_pointer
core_capture:
ACTUAL_WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8
str r12, write_pointer // write pointer is one sample behind
str r8, [r12], #4
sub r11, r11, #1
cmp r11, #0
bgt core_capture
str r12, write_pointer // final write pointer
mov r11, #0
ldr r8, [r4]
eor r0,r8, r3 // ***adjust register so r8 isn't corrupt
tst r0, #PSYNC_MASK
streq r12, write_pointer
eoreq r3, #PSYNC_MASK
streq r8, [r12], #4
subeqs r11, r11, #1
bne core_capture
str r12, write_pointer // final write pointer
str r11, sync0_flag
str r11, sync1_flag
str r11, capture_count
Expand Down
6 changes: 3 additions & 3 deletions src/rgb_to_hdmi.c
Expand Up @@ -3250,7 +3250,7 @@ void rgb_to_hdmi_main() {
}
osd_set(1, 0, osdline);
} else {
#if defined(RPI2) || defined(RPI3)
#if defined(WARN_12BIT)
if (capinfo->sample_width >= SAMPLE_WIDTH_9LO) {
osd_set(1, 0, "9/12BPP UNSUPPORTED on Zero2W, use Zero/W");
} else {
Expand Down Expand Up @@ -3298,7 +3298,7 @@ void rgb_to_hdmi_main() {
ncapture = osd_key(OSD_SW3);
}

#if defined(RPI2) || defined(RPI3)
#if defined(WARN_12BIT)
if (powerup || ((capinfo->sample_width >= SAMPLE_WIDTH_9LO) && !osd_active())) {
#else
if (powerup) {
Expand All @@ -3318,7 +3318,7 @@ void rgb_to_hdmi_main() {
}
osd_set(0, ATTR_DOUBLE_SIZE, osdline);
osd_display_interface(2);
#if defined(RPI2) || defined(RPI3)
#if defined(WARN_12BIT)
if(capinfo->sample_width >= SAMPLE_WIDTH_9LO) {
osd_set(2 + 4, 0, "9BPP & 12BPP NOT SUPPORTED on Pi Zero 2W");
osd_set(2 + 5, 0, "Please use a Pi Zero or Pi Zero W");
Expand Down

0 comments on commit 31228ff

Please sign in to comment.