kopia lustrzana https://github.com/hoglet67/RGBtoHDMI
Update 16bpp display list manipulation code to cope with BCM2711 (Pi4)
rodzic
ad85656dbe
commit
c1a30a674c
14
src/defs.h
14
src/defs.h
|
|
@ -8,6 +8,10 @@
|
||||||
#define _RPI3 3
|
#define _RPI3 3
|
||||||
#define _RPI4 4
|
#define _RPI4 4
|
||||||
|
|
||||||
|
#ifdef RPI4
|
||||||
|
//#define RPI4D
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_ARM_CAPTURE
|
#ifdef USE_ARM_CAPTURE
|
||||||
#ifdef RPI4
|
#ifdef RPI4
|
||||||
#define USE_ALT_M7DEINTERLACE_CODE // uses re-ordered code for mode7 deinterlace
|
#define USE_ALT_M7DEINTERLACE_CODE // uses re-ordered code for mode7 deinterlace
|
||||||
|
|
@ -477,10 +481,18 @@ typedef struct {
|
||||||
#define CM_BASE (volatile uint32_t *)(_get_peripheral_base() + 0x101000)
|
#define CM_BASE (volatile uint32_t *)(_get_peripheral_base() + 0x101000)
|
||||||
|
|
||||||
#define SCALER_DISPLIST1 (volatile uint32_t *)(_get_peripheral_base() + 0x400024)
|
#define SCALER_DISPLIST1 (volatile uint32_t *)(_get_peripheral_base() + 0x400024)
|
||||||
#define SCALER_DISPLAY_LIST (volatile uint32_t *)(_get_peripheral_base() + 0x402000)
|
#if defined(RPI4)
|
||||||
|
#define SCALER_DISPLAY_LIST (volatile uint32_t *)(_get_peripheral_base() + 0x404000)
|
||||||
|
#else
|
||||||
|
#define SCALER_DISPLAY_LIST (volatile uint32_t *)(_get_peripheral_base() + 0x402000)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PIXEL_FORMAT 1 // RGBA4444
|
#define PIXEL_FORMAT 1 // RGBA4444
|
||||||
|
#ifdef RPI4
|
||||||
|
#define PIXEL_ORDER 2 // ABGR in BCM2711
|
||||||
|
#else
|
||||||
#define PIXEL_ORDER 3 // ABGR
|
#define PIXEL_ORDER 3 // ABGR
|
||||||
|
#endif
|
||||||
|
|
||||||
#define GREY_PIXELS 0xaaa
|
#define GREY_PIXELS 0xaaa
|
||||||
#define GREY_DETECTED_LINE_COUNT 200
|
#define GREY_DETECTED_LINE_COUNT 200
|
||||||
|
|
|
||||||
|
|
@ -277,10 +277,7 @@ static int powerup = 1;
|
||||||
static int hsync_threshold_switch = 0;
|
static int hsync_threshold_switch = 0;
|
||||||
static int resolution_status = 0;
|
static int resolution_status = 0;
|
||||||
static volatile uint32_t display_list_index = 0;
|
static volatile uint32_t display_list_index = 0;
|
||||||
|
|
||||||
#ifndef RPI4
|
|
||||||
volatile uint32_t* display_list;
|
volatile uint32_t* display_list;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef USE_ARM_CAPTURE
|
#ifndef USE_ARM_CAPTURE
|
||||||
void start_vc()
|
void start_vc()
|
||||||
|
|
@ -538,7 +535,6 @@ static int last_height = -1;
|
||||||
//Initialize the palette
|
//Initialize the palette
|
||||||
osd_update_palette();
|
osd_update_palette();
|
||||||
|
|
||||||
#ifndef RPI4
|
|
||||||
// modify display list if 16bpp to switch from RGB 565 to ARGB 4444
|
// modify display list if 16bpp to switch from RGB 565 to ARGB 4444
|
||||||
if (capinfo->bpp == 16) {
|
if (capinfo->bpp == 16) {
|
||||||
//have to wait for field sync for display list to be updated
|
//have to wait for field sync for display list to be updated
|
||||||
|
|
@ -567,7 +563,6 @@ static int last_height = -1;
|
||||||
log_info("Modified display list word at %08X = %08X", display_list_index, display_list[display_list_index]);
|
log_info("Modified display list word at %08X = %08X", display_list_index, display_list[display_list_index]);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
@ -2398,7 +2393,6 @@ void DPMS(int dpms_state) {
|
||||||
RPI_PropertyInit();
|
RPI_PropertyInit();
|
||||||
RPI_PropertyAddTag(TAG_BLANK_SCREEN, dpms_state);
|
RPI_PropertyAddTag(TAG_BLANK_SCREEN, dpms_state);
|
||||||
RPI_PropertyProcess();
|
RPI_PropertyProcess();
|
||||||
#ifndef RPI4
|
|
||||||
if (capinfo->bpp == 16) {
|
if (capinfo->bpp == 16) {
|
||||||
//have to wait for field sync for display list to be updated
|
//have to wait for field sync for display list to be updated
|
||||||
wait_for_pi_fieldsync();
|
wait_for_pi_fieldsync();
|
||||||
|
|
@ -2412,22 +2406,24 @@ void DPMS(int dpms_state) {
|
||||||
} while (dli == 0xFF000000);
|
} while (dli == 0xFF000000);
|
||||||
display_list[display_list_index] = (dli & ~0x600f) | (PIXEL_ORDER << 13) | PIXEL_FORMAT;
|
display_list[display_list_index] = (dli & ~0x600f) | (PIXEL_ORDER << 13) | PIXEL_FORMAT;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MULTI_BUFFER
|
#ifdef MULTI_BUFFER
|
||||||
void swapBuffer(int buffer) {
|
void swapBuffer(int buffer) {
|
||||||
current_display_buffer = buffer;
|
current_display_buffer = buffer;
|
||||||
#ifndef RPI4
|
|
||||||
if (capinfo->bpp == 16) {
|
if (capinfo->bpp == 16) {
|
||||||
// directly manipulate the display list in 16BPP mode otherwise display list gets reconstructed
|
// directly manipulate the display list in 16BPP mode otherwise display list gets reconstructed
|
||||||
int dli = ((int)capinfo->fb | 0xc0000000) + (buffer * capinfo->height * capinfo->pitch);
|
int dli = ((int)capinfo->fb | 0xc0000000) + (buffer * capinfo->height * capinfo->pitch);
|
||||||
do {
|
do {
|
||||||
display_list[display_list_index + 5] = dli;
|
#ifdef RPI4
|
||||||
|
display_list[display_list_index + 6] = dli;
|
||||||
|
} while (dli != display_list[display_list_index + 6]);
|
||||||
|
#else
|
||||||
|
display_list[display_list_index + 5] = dli;
|
||||||
} while (dli != display_list[display_list_index + 5]);
|
} while (dli != display_list[display_list_index + 5]);
|
||||||
} else
|
|
||||||
#endif
|
#endif
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
RPI_PropertyInit();
|
RPI_PropertyInit();
|
||||||
RPI_PropertyAddTag(TAG_SET_VIRTUAL_OFFSET, 0, capinfo->height * buffer);
|
RPI_PropertyAddTag(TAG_SET_VIRTUAL_OFFSET, 0, capinfo->height * buffer);
|
||||||
|
|
@ -3180,13 +3176,6 @@ void rgb_to_hdmi_main() {
|
||||||
log_info("Done setting up frame buffer");
|
log_info("Done setting up frame buffer");
|
||||||
//log_info("Peripheral base = %08X", _get_peripheral_base());
|
//log_info("Peripheral base = %08X", _get_peripheral_base());
|
||||||
|
|
||||||
/*
|
|
||||||
static volatile uint32_t* xdisplay_list = GPU_ARM_DBELLDATAC;
|
|
||||||
for (int i=0; i<256; i++) {
|
|
||||||
log_info("d = %08X, %08X", xdisplay_list[0], xdisplay_list[1]);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
geometry_get_fb_params(capinfo);
|
geometry_get_fb_params(capinfo);
|
||||||
capinfo->ncapture = ncapture;
|
capinfo->ncapture = ncapture;
|
||||||
calculate_fb_adjustment();
|
calculate_fb_adjustment();
|
||||||
|
|
@ -3583,9 +3572,7 @@ void kernel_main(unsigned int r0, unsigned int r1, unsigned int atags)
|
||||||
log_info("No framebuffer area marked as cached");
|
log_info("No framebuffer area marked as cached");
|
||||||
#endif
|
#endif
|
||||||
log_info("Pi Hardware detected as type %d", _get_hardware_id());
|
log_info("Pi Hardware detected as type %d", _get_hardware_id());
|
||||||
#ifndef RPI4
|
|
||||||
display_list = SCALER_DISPLAY_LIST;
|
display_list = SCALER_DISPLAY_LIST;
|
||||||
#endif
|
|
||||||
gpioreg = (volatile uint32_t *)(_get_peripheral_base() + 0x101000UL);
|
gpioreg = (volatile uint32_t *)(_get_peripheral_base() + 0x101000UL);
|
||||||
init_hardware();
|
init_hardware();
|
||||||
|
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue