kopia lustrzana https://github.com/hoglet67/RGBtoHDMI
Pi Firmware: added export and m7disable params
Change-Id: I0cf0ab5581b23e3b2c7a9f6ec48094979c9ee642pull/11/head
rodzic
1fa198a423
commit
88f402c335
|
@ -12,6 +12,7 @@ typedef struct {
|
|||
const char *name;
|
||||
int min;
|
||||
int max;
|
||||
int expert;
|
||||
} param_t;
|
||||
|
||||
// Define a common interface to abstract the calibration code
|
||||
|
|
|
@ -84,41 +84,41 @@ enum {
|
|||
};
|
||||
|
||||
static param_t default_params[] = {
|
||||
{ "All offsets", 0, 5 },
|
||||
{ "A offset", 0, 5 },
|
||||
{ "B offset", 0, 5 },
|
||||
{ "C offset", 0, 5 },
|
||||
{ "D offset", 0, 5 },
|
||||
{ "E offset", 0, 5 },
|
||||
{ "F offset", 0, 5 },
|
||||
{ "Half", 0, 1 },
|
||||
{ "H offset", 0, 59 },
|
||||
{ "V offset", 0, 39 },
|
||||
{ "H width", 50, 99 },
|
||||
{ "V height", 150, 300 },
|
||||
{ "FB width", 400, 800 },
|
||||
{ "FB height", 480, 600 },
|
||||
{ "Delay", 0, 15 },
|
||||
{ NULL, 0, 0 },
|
||||
{ "All offsets", 0, 5, 0 },
|
||||
{ "A offset", 0, 5, 0 },
|
||||
{ "B offset", 0, 5, 0 },
|
||||
{ "C offset", 0, 5, 0 },
|
||||
{ "D offset", 0, 5, 0 },
|
||||
{ "E offset", 0, 5, 0 },
|
||||
{ "F offset", 0, 5, 0 },
|
||||
{ "Half", 0, 1, 0 },
|
||||
{ "H offset", 0, 59, 1 },
|
||||
{ "V offset", 0, 39, 1 },
|
||||
{ "H width", 50, 99, 1 },
|
||||
{ "V height", 150, 300, 1 },
|
||||
{ "FB width", 400, 800, 1 },
|
||||
{ "FB height", 480, 600, 1 },
|
||||
{ "Delay", 0, 15, 1 },
|
||||
{ NULL, 0, 0, 0 },
|
||||
};
|
||||
|
||||
static param_t mode7_params[] = {
|
||||
{ "All offsets", 0, 7 },
|
||||
{ "A offset", 0, 7 },
|
||||
{ "B offset", 0, 7 },
|
||||
{ "C offset", 0, 7 },
|
||||
{ "D offset", 0, 7 },
|
||||
{ "E offset", 0, 7 },
|
||||
{ "F offset", 0, 7 },
|
||||
{ "Half", 0, 1 },
|
||||
{ "H offset", 0, 39 },
|
||||
{ "V offset", 0, 39 },
|
||||
{ "H width", 50, 99 },
|
||||
{ "V height", 150, 300 },
|
||||
{ "FB width", 400, 800 },
|
||||
{ "FB height", 480, 600 },
|
||||
{ "Delay", 0, 15 },
|
||||
{ NULL, 0, 0 },
|
||||
{ "All offsets", 0, 7, 0 },
|
||||
{ "A offset", 0, 7, 0 },
|
||||
{ "B offset", 0, 7, 0 },
|
||||
{ "C offset", 0, 7, 0 },
|
||||
{ "D offset", 0, 7, 0 },
|
||||
{ "E offset", 0, 7, 0 },
|
||||
{ "F offset", 0, 7, 0 },
|
||||
{ "Half", 0, 1, 0 },
|
||||
{ "H offset", 0, 39, 1 },
|
||||
{ "V offset", 0, 39, 1 },
|
||||
{ "H width", 50, 99, 1 },
|
||||
{ "V height", 150, 300, 1 },
|
||||
{ "FB width", 400, 800, 1 },
|
||||
{ "FB height", 480, 600, 1 },
|
||||
{ "Delay", 0, 15, 1 },
|
||||
{ NULL, 0, 0, 0 },
|
||||
};
|
||||
|
||||
// =============================================================
|
||||
|
|
|
@ -52,10 +52,11 @@
|
|||
#define OFFSET_INTERLACE 20 // bit 20-21 INTERFACE
|
||||
#define MASK_INTERLACE (3 << OFFSET_INTERLACE)
|
||||
|
||||
#define BIT_NEW_DEINT 0x400000 // bit 22, indicates the new deinterlace algorithm should be used
|
||||
#define BIT_DEBUG 0x800000 // bit 23, indicated the debug grid should be displayed
|
||||
#define BIT_NEW_DEINT 0x00400000 // bit 22, indicates the new deinterlace algorithm should be used
|
||||
#define BIT_DEBUG 0x00800000 // bit 23, indicated the debug grid should be displayed
|
||||
#define BIT_MODE_DETECT 0x01000000 // bit 24, indicates mode changes should be detected
|
||||
|
||||
// bit 24-25 unused
|
||||
// bit 25 unused
|
||||
// bit 26 unavailable (used for switch detection)
|
||||
// bit 27-31 unused
|
||||
|
||||
|
|
88
src/osd.c
88
src/osd.c
|
@ -124,32 +124,36 @@ static const char *nbuffer_names[] = {
|
|||
enum {
|
||||
F_INFO,
|
||||
F_PALETTE,
|
||||
F_DEINTERLACE,
|
||||
F_SCANLINES,
|
||||
F_MUX,
|
||||
F_ELK,
|
||||
F_EXPERT,
|
||||
F_DEINTERLACE,
|
||||
F_VSYNC,
|
||||
F_MUX,
|
||||
F_PLLH,
|
||||
#ifdef MULTI_BUFFER
|
||||
F_NBUFFERS,
|
||||
#endif
|
||||
F_M7DISABLE,
|
||||
F_DEBUG
|
||||
};
|
||||
|
||||
static param_t features[] = {
|
||||
{ "Info", 0, NUM_INFOS - 1 },
|
||||
{ "Color Palette", 0, NUM_PALETTES - 1 },
|
||||
{ "Deinterlace", 0, NUM_DEINTERLACES - 1 },
|
||||
{ "Scanlines", 0, 1 },
|
||||
{ "Input Mux", 0, 1 },
|
||||
{ "Elk", 0, 1 },
|
||||
{ "Vsync", 0, 1 },
|
||||
{ "HDMI Clock", 0, 5 },
|
||||
{ "Info", 0, NUM_INFOS - 1, 0 },
|
||||
{ "Color Palette", 0, NUM_PALETTES - 1, 0 },
|
||||
{ "Scanlines", 0, 1, 0 },
|
||||
{ "Elk", 0, 1, 0 },
|
||||
{ "Expert", 0, 1, 0 },
|
||||
{ "Deinterlace", 0, NUM_DEINTERLACES - 1, 1 },
|
||||
{ "Vsync", 0, 1, 1 },
|
||||
{ "Input Mux", 0, 1, 1 },
|
||||
{ "HDMI Clock", 0, 5, 1 },
|
||||
#ifdef MULTI_BUFFER
|
||||
{ "Num Buffers", 0, 3 },
|
||||
{ "Num Buffers", 0, 3, 1 },
|
||||
#endif
|
||||
{ "Debug", 0, 1 },
|
||||
{ NULL, 0, 0 },
|
||||
{ "Mode7 Disable", 0, 1, 1 },
|
||||
{ "Debug", 0, 1, 1 },
|
||||
{ NULL, 0, 0, 0 },
|
||||
};
|
||||
|
||||
static int info = INFO_VERSION;
|
||||
|
@ -295,6 +299,10 @@ static int get_feature(int num) {
|
|||
#endif
|
||||
case F_DEBUG:
|
||||
return get_debug();
|
||||
case F_EXPERT:
|
||||
return get_expert();
|
||||
case F_M7DISABLE:
|
||||
return get_m7disable();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -336,6 +344,12 @@ static void set_feature(int num, int value) {
|
|||
set_debug(value);
|
||||
update_palette();
|
||||
break;
|
||||
case F_EXPERT:
|
||||
set_expert(value);
|
||||
break;
|
||||
case F_M7DISABLE:
|
||||
set_m7disable(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,10 +452,34 @@ void osd_refresh() {
|
|||
}
|
||||
}
|
||||
|
||||
static int next_param(param_t *params, int index) {
|
||||
int expert = get_expert();
|
||||
do {
|
||||
index++;
|
||||
if (params[index].name == NULL) {
|
||||
index = 0;
|
||||
}
|
||||
} while (!expert && params[index].expert);
|
||||
return index;
|
||||
}
|
||||
|
||||
static int current_param(param_t *params, int index) {
|
||||
int expert = get_expert();
|
||||
if (!expert && params[index].expert) {
|
||||
return next_param(params, index);
|
||||
} else {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
void osd_key(int key) {
|
||||
int value;
|
||||
param_t *params = cpld->get_params();
|
||||
|
||||
// Sanity check the current parameter is suitable for the current setting of export mode
|
||||
feature_num = current_param(features, feature_num);
|
||||
param_num = current_param(params, param_num);
|
||||
|
||||
switch (osd_state) {
|
||||
|
||||
case IDLE:
|
||||
|
@ -475,10 +513,7 @@ void osd_key(int key) {
|
|||
break;
|
||||
case OSD_SW2:
|
||||
// next param
|
||||
param_num++;
|
||||
if (params[param_num].name == NULL) {
|
||||
param_num = 0;
|
||||
}
|
||||
param_num = next_param(params, param_num);
|
||||
show_param(param_num);
|
||||
break;
|
||||
case OSD_SW3:
|
||||
|
@ -504,10 +539,7 @@ void osd_key(int key) {
|
|||
break;
|
||||
case OSD_SW2:
|
||||
// next feature
|
||||
feature_num++;
|
||||
if (features[feature_num].name == NULL) {
|
||||
feature_num = 0;
|
||||
}
|
||||
feature_num = next_param(features, feature_num);
|
||||
show_feature(feature_num);
|
||||
break;
|
||||
case OSD_SW3:
|
||||
|
@ -599,7 +631,7 @@ void osd_init() {
|
|||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_INFO, val);
|
||||
log_info("config.txt: info = %d", val);
|
||||
log_info("config.txt: info = %d", val);
|
||||
}
|
||||
prop = get_cmdline_prop("palette");
|
||||
if (prop) {
|
||||
|
@ -657,6 +689,18 @@ void osd_init() {
|
|||
set_feature(F_DEBUG, val);
|
||||
log_info("config.txt: debug = %d", val);
|
||||
}
|
||||
prop = get_cmdline_prop("expert");
|
||||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_EXPERT, val);
|
||||
log_info("config.txt: expert = %d", val);
|
||||
}
|
||||
prop = get_cmdline_prop("m7disable");
|
||||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_M7DISABLE, val);
|
||||
log_info("config.txt: m7disable = %d", val);
|
||||
}
|
||||
// Initialize the CPLD sampling points
|
||||
for (int m7 = 0; m7 <= 1; m7++) {
|
||||
char *propname = m7 ? "sampling7" : "sampling06";
|
||||
|
|
|
@ -47,6 +47,10 @@ void set_elk(int on);
|
|||
int get_elk();
|
||||
void set_debug(int on);
|
||||
int get_debug();
|
||||
void set_expert(int on);
|
||||
int get_expert();
|
||||
void set_m7disable(int on);
|
||||
int get_m7disable();
|
||||
void set_vsync(int on);
|
||||
int get_vsync();
|
||||
void set_pllh(int val);
|
||||
|
|
|
@ -818,7 +818,8 @@ skip_switch_test:
|
|||
tst r3, #BIT_MODE7
|
||||
moveq r5, #0 // Modes 0-6
|
||||
movne r5, #1 // Mode 7
|
||||
cmp r5, r0 // Check if we have changed mode
|
||||
tst r3, #BIT_MODE_DETECT // Have we been told to exit on mode change
|
||||
cmpne r5, r0 // Check if we have changed mode
|
||||
bne exit // If so, then bail, as the frame buffer needs to be resized
|
||||
|
||||
// Save a copy of the frame buffer base
|
||||
|
|
|
@ -57,17 +57,18 @@ static double pllh_clock = 0;
|
|||
// OSD parameters
|
||||
// =============================================================
|
||||
|
||||
static int elk;
|
||||
static int debug;
|
||||
static int scanlines = 0;
|
||||
static int elk = 0;
|
||||
static int debug = 0;
|
||||
static int expert = 0;
|
||||
static int m7disable = 0;
|
||||
static int scanlines = 0;
|
||||
static int deinterlace = 0;
|
||||
static int vsync;
|
||||
static int pllh;
|
||||
static int vsync = 0;
|
||||
static int pllh = 0;
|
||||
#ifdef MULTI_BUFFER
|
||||
static int nbuffers;
|
||||
static int nbuffers = 0;
|
||||
#endif
|
||||
|
||||
|
||||
// Calculated so that the constants from librpitx work
|
||||
static volatile uint32_t *gpioreg = (volatile uint32_t *)(PERIPHERAL_BASE + 0x101000UL);
|
||||
|
||||
|
@ -841,6 +842,22 @@ int get_debug() {
|
|||
return debug;
|
||||
}
|
||||
|
||||
void set_expert(int on) {
|
||||
expert = on;
|
||||
}
|
||||
|
||||
int get_expert() {
|
||||
return expert;
|
||||
}
|
||||
|
||||
void set_m7disable(int on) {
|
||||
m7disable = on;
|
||||
}
|
||||
|
||||
int get_m7disable() {
|
||||
return m7disable;
|
||||
}
|
||||
|
||||
void set_vsync(int on) {
|
||||
vsync = on;
|
||||
}
|
||||
|
@ -976,7 +993,7 @@ void rgb_to_hdmi_main() {
|
|||
osd_init();
|
||||
|
||||
// Determine initial mode
|
||||
mode7 = rgb_to_fb(capinfo, BIT_PROBE) & BIT_MODE7;
|
||||
mode7 = rgb_to_fb(capinfo, BIT_PROBE) & BIT_MODE7 & !m7disable;
|
||||
|
||||
while (1) {
|
||||
|
||||
|
@ -1003,6 +1020,9 @@ void rgb_to_hdmi_main() {
|
|||
|
||||
log_debug("Entering rgb_to_fb");
|
||||
int flags = mode7 | BIT_INITIALIZE | clear;
|
||||
if (!m7disable) {
|
||||
flags |= BIT_MODE_DETECT;
|
||||
}
|
||||
if (vsync) {
|
||||
flags |= BIT_VSYNC;
|
||||
}
|
||||
|
@ -1043,16 +1063,14 @@ void rgb_to_hdmi_main() {
|
|||
osd_key(OSD_SW3);
|
||||
}
|
||||
|
||||
// Possibly the size or offset has been adjusted, so update these
|
||||
|
||||
// Possibly the size or offset has been adjusted, so update current capinfo
|
||||
memcpy(&last_capinfo, capinfo, sizeof last_capinfo);
|
||||
cpld->get_fb_params(capinfo);
|
||||
|
||||
fb_size_changed = (capinfo->width != last_capinfo.width) || (capinfo->height != last_capinfo.height);
|
||||
active_size_changed = (capinfo->chars_per_line != last_capinfo.chars_per_line) || (capinfo->nlines != last_capinfo.nlines);
|
||||
|
||||
last_mode7 = mode7;
|
||||
mode7 = result & BIT_MODE7;
|
||||
mode7 = result & BIT_MODE7 & !m7disable;
|
||||
|
||||
if (active_size_changed) {
|
||||
clear = BIT_CLEAR;
|
||||
|
|
Ładowanie…
Reference in New Issue