kopia lustrzana https://github.com/hoglet67/RGBtoHDMI
Merge remote-tracking branch 'upstream/dev' into dev
# Conflicts: # src/rgb_to_fb.Spull/20/head
commit
5dcc730e75
18
src/defs.h
18
src/defs.h
|
@ -26,15 +26,15 @@
|
|||
#define BIT_MODE7 0x01 // bit 0, indicates mode 7
|
||||
#define BIT_PROBE 0x02 // bit 1, indicates the mode is being determined
|
||||
#define BIT_CALIBRATE 0x04 // bit 2, indicates calibration is happening
|
||||
#define BIT_OSD 0x08 // bit 3, indicated the OSD is visible
|
||||
#define BIT_OSD 0x08 // bit 3, indicates the OSD is visible
|
||||
#define BIT_MODE_DETECT 0x10 // bit 4, indicates mode changes should be detected
|
||||
#define BIT_ELK 0x20 // bit 5, indicated we are an Electron
|
||||
#define BIT_ELK 0x20 // bit 5, indicates we are an Electron
|
||||
#define BIT_SCANLINES 0x40 // bit 6, indicates scan lines should be made visible
|
||||
#define BIT_FIELD_TYPE 0x80 // bit 7, indicates the field type (0 = odd, 1 = even) of the last field
|
||||
#define BIT_CLEAR 0x100 // bit 8, indicates the frame buffer should be cleared
|
||||
#define BIT_VSYNC 0x200 // bit 9, indicates the vsync frequency is being probed
|
||||
#define BIT_VSYNC_MARKER 0x400 // bit 10, indicates red vsync line displayed
|
||||
#define BIT_DEBUG 0x800 // bit 11, indicated the debug grid should be displayed
|
||||
#define BIT_VSYNC 0x200 // bit 9, indicates the red vsync indicator should be displayed
|
||||
#define BIT_VSYNC_MARKER 0x400 // bit 10, indicates current line should be replaced by the red vsync indicator
|
||||
#define BIT_DEBUG 0x800 // bit 11, indicates the debug grid should be displayed
|
||||
|
||||
#define OFFSET_LAST_BUFFER 12 // bit 12-13 LAST_BUFFER
|
||||
#define MASK_LAST_BUFFER (3 << OFFSET_LAST_BUFFER)
|
||||
|
@ -52,12 +52,18 @@
|
|||
#define OFFSET_INTERLACE 20 // bit 20-22 INTERFACE
|
||||
#define MASK_INTERLACE (7 << OFFSET_INTERLACE)
|
||||
|
||||
// bit 23-31 unused
|
||||
#define BIT_FIELD_TYPE1 0x00800000 // bit 23, indicates the field type of the previous field
|
||||
#define BIT_FIELD_TYPE1_VALID 0x01000000 // bit 24, indicates FIELD_TYPE1 is valid
|
||||
#define BIT_FIELD_TYPE2 0x02000000 // bit 25, indicates the field type of the previous but one field
|
||||
#define BIT_FIELD_TYPE2_VALID 0x04000000 // bit 26, indicates FIELD_TYPE2 is valid
|
||||
|
||||
// bits 27-31 unused
|
||||
// R0 return value bits
|
||||
#define RET_SW1 0x02
|
||||
#define RET_SW2 0x04
|
||||
#define RET_SW3 0x08
|
||||
#define RET_EXPIRED 0x10
|
||||
#define RET_INTERLACE_CHANGED 0x20
|
||||
|
||||
// Channel definitions
|
||||
#define NUM_CHANNELS 3
|
||||
|
|
|
@ -427,13 +427,13 @@ static int get_feature(int num) {
|
|||
|
||||
static void set_feature(int num, int value) {
|
||||
switch (num) {
|
||||
break;
|
||||
case F_DEINTERLACE:
|
||||
set_deinterlace(value);
|
||||
break;
|
||||
case F_PALETTE:
|
||||
palette = value;
|
||||
osd_update_palette();
|
||||
break;
|
||||
case F_SCANLINES:
|
||||
set_scanlines(value);
|
||||
break;
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
.global sw3counter
|
||||
.global vsync_line
|
||||
.global default_vsync_line
|
||||
.global lock_fail
|
||||
|
||||
// ======================================================================
|
||||
// Macros
|
||||
|
@ -210,8 +209,9 @@ skip_swap:
|
|||
tst r3, #BIT_CLEAR
|
||||
blne clear_screen
|
||||
|
||||
// clear all the state bits apart from the following:
|
||||
// Clear the following state bits:
|
||||
bic r3, r3, #(BIT_FIELD_TYPE | BIT_CLEAR)
|
||||
bic r3, r3, #(BIT_FIELD_TYPE1_VALID | BIT_FIELD_TYPE2_VALID)
|
||||
|
||||
// In Mode 7 (or on probe) write to buffer 0, display buffer 0
|
||||
bic r3, r3, #(MASK_LAST_BUFFER | MASK_CURR_BUFFER)
|
||||
|
@ -313,13 +313,48 @@ buffer_chosen:
|
|||
bne exit
|
||||
|
||||
skip_switch_test:
|
||||
tst r3, #BIT_MODE_DETECT // Have we been told to exit on mode change
|
||||
beq skip_mode_test
|
||||
|
||||
tst r3, #BIT_MODE7
|
||||
moveq r5, #0 // Modes 0-6
|
||||
movne r5, #1 // Mode 7
|
||||
tst r3, #BIT_MODE_DETECT // Have we been told to exit on mode change
|
||||
cmpne r5, r0 // Check if we have changed mode
|
||||
cmp r5, r0 // Check if we have changed mode
|
||||
bne exit // If so, then bail, as the frame buffer needs to be resized
|
||||
|
||||
tst r3, #BIT_FIELD_TYPE2_VALID
|
||||
beq skip_interlace_test // we haven't yet seen two field, so skip the test
|
||||
|
||||
// compare BIT_FIELD_TYPE and BIT_FIELD_TYPE2
|
||||
// FT2 FT
|
||||
// 0 0 -> 0
|
||||
// 0 1 -> 1
|
||||
// 1 0 -> 1
|
||||
// 1 1 -> 0
|
||||
tst r3, #BIT_FIELD_TYPE
|
||||
eorne r3, #BIT_FIELD_TYPE2
|
||||
tst r3, #BIT_FIELD_TYPE2
|
||||
orrne r0, #RET_INTERLACE_CHANGED
|
||||
bne exit
|
||||
|
||||
skip_interlace_test:
|
||||
|
||||
// copy BIT_FIELD_TYPE_1 to BIT_FIELD_TYPE2
|
||||
tst r3, #BIT_FIELD_TYPE1
|
||||
biceq r3, #BIT_FIELD_TYPE2
|
||||
orrne r3, #BIT_FIELD_TYPE2
|
||||
tst r3, #BIT_FIELD_TYPE1_VALID // also copy the valid bit
|
||||
biceq r3, #BIT_FIELD_TYPE2_VALID
|
||||
orrne r3, #BIT_FIELD_TYPE2_VALID
|
||||
|
||||
// copy BIT_FIELD_TYPE to BIT_FIELD_TYPE1
|
||||
tst r3, #BIT_FIELD_TYPE
|
||||
biceq r3, #BIT_FIELD_TYPE1
|
||||
orrne r3, #BIT_FIELD_TYPE1
|
||||
orr r3, #BIT_FIELD_TYPE1_VALID // set the valid bit
|
||||
|
||||
skip_mode_test:
|
||||
|
||||
// Save a copy of the frame buffer base
|
||||
push {r11}
|
||||
|
||||
|
@ -457,6 +492,7 @@ skip_osd_update:
|
|||
// Flip to it on next V SYNC
|
||||
FLIP_BUFFER
|
||||
#endif
|
||||
|
||||
push {r0-r12, lr}
|
||||
bl recalculate_hdmi_clock_line_locked_update
|
||||
pop {r0-r12, lr}
|
||||
|
@ -693,3 +729,4 @@ vsync_line:
|
|||
|
||||
lock_fail:
|
||||
.word 0
|
||||
|
|
@ -87,7 +87,7 @@ static int vlockline = 5;
|
|||
static int nbuffers = 0;
|
||||
#endif
|
||||
|
||||
static int current_vlockmode = 0xffffffff;
|
||||
static int current_vlockmode = -1;
|
||||
|
||||
// Calculated so that the constants from librpitx work
|
||||
static volatile uint32_t *gpioreg = (volatile uint32_t *)(PERIPHERAL_BASE + 0x101000UL);
|
||||
|
@ -362,6 +362,9 @@ static int calibrate_sampling_clock() {
|
|||
init_gpclk(GPCLK_SOURCE, gpclk_divisor);
|
||||
log_debug("Done setting up divisor");
|
||||
|
||||
// Invalidate the current vlock mode to force an updated, as vsync_time_ns will have changed
|
||||
current_vlockmode = -1;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
|
@ -1265,6 +1268,13 @@ void rgb_to_hdmi_main() {
|
|||
calibrate_sampling_clock();
|
||||
}
|
||||
|
||||
if (result & RET_INTERLACE_CHANGED) {
|
||||
// Measure the frame time and set the sampling clock
|
||||
calibrate_sampling_clock();
|
||||
// Recalculate the HDMI clock (if the vlockmode property requires this)
|
||||
recalculate_hdmi_clock_line_locked_update();
|
||||
}
|
||||
|
||||
} while (mode7 == last_mode7 && !fb_size_changed);
|
||||
|
||||
osd_clear();
|
||||
|
|
Ładowanie…
Reference in New Issue