kopia lustrzana https://github.com/hoglet67/RGBtoHDMI
Add resolution change warning, change config.txt and fix bug in osd update
rodzic
b73673911f
commit
9c4b74b7de
|
@ -177,7 +177,7 @@ void sendDAC(int dac, int value)
|
|||
case 2: // dac084s085
|
||||
{
|
||||
int packet = (dac << 14) | 0x1000 | (value << 4);
|
||||
RPI_SetGpioValue(STROBE_PIN, 1);
|
||||
RPI_SetGpioValue(STROBE_PIN, 1);
|
||||
delay_in_arm_cycles(500);
|
||||
RPI_SetGpioValue(STROBE_PIN, 0);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
|
|
|
@ -283,7 +283,7 @@ void geometry_get_fb_params(capture_info_t *capinfo) {
|
|||
}
|
||||
|
||||
if (v_size43 == v_size && h_size > h_size43) {
|
||||
h_size43 = (h_size43 * 800) / 720; //adjust 4:3 ratio on widescreen resolutions to account for 800 pixel wide integer sample capture
|
||||
h_size43 = (h_size43 * 800) / 720; //adjust 4:3 ratio on widescreen resolutions to account for 800 pixel wide integer sample capture
|
||||
if (h_size43 > h_size) {
|
||||
h_size43 = h_size;
|
||||
}
|
||||
|
|
|
@ -1592,7 +1592,7 @@ void osd_update_palette() {
|
|||
void osd_clear() {
|
||||
if (active) {
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
osd_update((uint32_t *) (capinfo->v_adjust * capinfo->pitch + capinfo->h_adjust + capinfo->fb), capinfo->pitch);
|
||||
osd_update((uint32_t *) (capinfo->fb + capinfo->pitch * capinfo->height * get_current_display_buffer() + capinfo->pitch * capinfo->v_adjust + capinfo->h_adjust), capinfo->pitch);
|
||||
active = 0;
|
||||
osd_update_palette();
|
||||
}
|
||||
|
@ -1601,7 +1601,7 @@ void osd_clear() {
|
|||
void osd_clear_no_palette() {
|
||||
if (active) {
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
osd_update((uint32_t *) (capinfo->v_adjust * capinfo->pitch + capinfo->h_adjust + capinfo->fb), capinfo->pitch);
|
||||
osd_update((uint32_t *) (capinfo->fb + capinfo->pitch * capinfo->height * get_current_display_buffer() + capinfo->pitch * capinfo->v_adjust + capinfo->h_adjust), capinfo->pitch);
|
||||
active = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1947,7 +1947,7 @@ void osd_set(int line, int attr, char *text) {
|
|||
len = LINELEN;
|
||||
}
|
||||
strncpy(buffer + line * LINELEN, text, len);
|
||||
osd_update((uint32_t *) (capinfo->v_adjust * capinfo->pitch + capinfo->h_adjust + capinfo->fb), capinfo->pitch);
|
||||
osd_update((uint32_t *) (capinfo->fb + capinfo->pitch * capinfo->height * get_current_display_buffer() + capinfo->pitch * capinfo->v_adjust + capinfo->h_adjust), capinfo->pitch);
|
||||
}
|
||||
|
||||
int osd_active() {
|
||||
|
|
|
@ -673,11 +673,11 @@ key_press_reset:
|
|||
ldr r8, [r4]
|
||||
mov r0, #0
|
||||
tst r8, #SW1_MASK
|
||||
addeq r0, r0, #1
|
||||
orreq r0, r0, #1
|
||||
tst r8, #SW2_MASK
|
||||
addeq r0, r0, #1
|
||||
orreq r0, r0, #2
|
||||
tst r8, #SW3_MASK
|
||||
addeq r0, r0, #1
|
||||
orreq r0, r0, #4
|
||||
pop {r4-r12, lr}
|
||||
mov pc, lr
|
||||
|
||||
|
|
|
@ -156,7 +156,9 @@ static int lines_per_frame = 0;
|
|||
static int one_line_time_ns = 0;
|
||||
static int adjusted_clock;
|
||||
static int reboot_required = 0;
|
||||
static int resolution_warning = 0;
|
||||
static int vlock_limited = 0;
|
||||
static int current_display_buffer = 0;
|
||||
#ifdef MULTI_BUFFER
|
||||
static int nbuffers = 0;
|
||||
#endif
|
||||
|
@ -1064,7 +1066,7 @@ static void cpld_init() {
|
|||
|
||||
int keycount = key_press_reset();
|
||||
log_info("Keycount = %d", keycount);
|
||||
if (keycount == 3) {
|
||||
if (keycount == 7) {
|
||||
cpld = &cpld_null;
|
||||
cpld_version_id = 0xfff;
|
||||
}
|
||||
|
@ -1619,12 +1621,17 @@ int total_N_frames(capture_info_t *capinfo, int n, int mode7, int elk) {
|
|||
#ifdef MULTI_BUFFER
|
||||
void swapBuffer(int buffer) {
|
||||
RPI_PropertyInit();
|
||||
current_display_buffer = buffer;
|
||||
RPI_PropertyAddTag(TAG_SET_VIRTUAL_OFFSET, 0, capinfo->height * buffer);
|
||||
// Use version that doesn't wait for the response
|
||||
RPI_PropertyProcessNoCheck();
|
||||
}
|
||||
#endif
|
||||
|
||||
int get_current_display_buffer() {
|
||||
return current_display_buffer;
|
||||
}
|
||||
|
||||
void set_profile(int val) {
|
||||
log_info("Setting profile to %d", val);
|
||||
profile = val;
|
||||
|
@ -1651,15 +1658,16 @@ int get_paletteControl() {
|
|||
}
|
||||
|
||||
void set_resolution(int mode, const char *name, int reboot) {
|
||||
char osdline[80];
|
||||
//char osdline[80];
|
||||
if (resolution != mode) {
|
||||
if (osd_active()) {
|
||||
sprintf(osdline, "New setting requires reboot on menu exit");
|
||||
osd_set(1, 0, osdline);
|
||||
}
|
||||
// if (osd_active()) {
|
||||
// sprintf(osdline, "New setting requires reboot on menu exit");
|
||||
// osd_set(1, 0, osdline);
|
||||
// }
|
||||
reboot_required = reboot;
|
||||
resolution = mode;
|
||||
strcpy(resolution_name, name);
|
||||
resolution_warning = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1983,6 +1991,7 @@ void rgb_to_hdmi_main() {
|
|||
capinfo->h_adjust = 0;
|
||||
capinfo->border = 0;
|
||||
cpld->set_mode(0);
|
||||
current_display_buffer = 0;
|
||||
// Determine initial sync polarity (and correct whether inversion required or not)
|
||||
capinfo->detected_sync_type = cpld->analyse(-1);
|
||||
log_info("Detected polarity state at startup = %s (%s)", sync_names[capinfo->detected_sync_type & SYNC_BIT_MASK], mixed_names[(capinfo->detected_sync_type & SYNC_BIT_MIXED_SYNC) ? 1 : 0]);
|
||||
|
@ -1993,14 +2002,14 @@ void rgb_to_hdmi_main() {
|
|||
int keycount = key_press_reset();
|
||||
log_info("Keycount = %d", keycount);
|
||||
switch(keycount) {
|
||||
case 3 :
|
||||
case 7 :
|
||||
{
|
||||
log_info("Entering CPLD reprogram mode");
|
||||
forcereprogram = 1;
|
||||
do {} while (key_press_reset() != 0);
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
case 1 :
|
||||
{
|
||||
if ((strcmp(resolution_name, "Default@60Hz") != 0 || scaling != 0)) {
|
||||
log_info("Resetting output resolution to Default@60Hz");
|
||||
|
@ -2024,7 +2033,7 @@ void rgb_to_hdmi_main() {
|
|||
|
||||
}
|
||||
|
||||
|
||||
resolution_warning = 0;
|
||||
clear = BIT_CLEAR;
|
||||
while (1) {
|
||||
log_info("-----------------------LOOP------------------------");
|
||||
|
@ -2125,11 +2134,19 @@ void rgb_to_hdmi_main() {
|
|||
#endif
|
||||
|
||||
if (!osd_active() && reboot_required) {
|
||||
int a = 13;
|
||||
file_save_config(resolution_name, scaling, frontend);
|
||||
// Wait a while to allow UART time to empty
|
||||
for (delay = 0; delay < 100000; delay++) {
|
||||
a = a * 13;
|
||||
delay_in_arm_cycles(100000000);
|
||||
if (resolution_warning != 0) {
|
||||
osd_set(0, 0, "Hold menu during reset to recover");
|
||||
osd_set(1, 0, "if no display at new resolution.");
|
||||
|
||||
for (int i = 5; i > 0; i--) {
|
||||
sprintf(osdline, "Rebooting in %d secs ", i);
|
||||
log_info(osdline);
|
||||
osd_set(3, 0, osdline);
|
||||
delay_in_arm_cycles(1000000000);
|
||||
}
|
||||
}
|
||||
reboot();
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ int get_autoswitch();
|
|||
void set_debug(int on);
|
||||
int get_debug();
|
||||
|
||||
int get_current_display_buffer();
|
||||
|
||||
// Actions
|
||||
void action_calibrate_clocks();
|
||||
void action_calibrate_auto();
|
||||
|
|
|
@ -85,7 +85,10 @@ kernel=kernelrpi3.img
|
|||
# Custom video settings
|
||||
# =====================================================================
|
||||
|
||||
#resolution=Auto
|
||||
## Auto
|
||||
#resolution=Default@60Hz
|
||||
## Default @ 60Hz
|
||||
|
||||
#scaling=0
|
||||
scaling_kernel=8
|
||||
|
||||
#frontend=0
|
||||
|
|
Ładowanie…
Reference in New Issue