This commit is contained in:
Phillip Burgess 2023-01-16 17:11:51 -08:00 committed by ladyada
parent 2e91831cc9
commit f603f4d8bd
3 changed files with 55 additions and 4 deletions

View file

@ -17,10 +17,6 @@ void tmds_setup_palette_symbols(const uint16_t *palette, uint32_t *symbuf, size_
void tmds_setup_palette24_symbols(const uint32_t *palette, uint32_t *symbuf, size_t n_palette);
void tmds_encode_palette_data(const uint32_t *pixbuf, const uint32_t *tmds_palette, uint32_t *symbuf, size_t n_pix, uint32_t palette_bits);
#if defined(__cplusplus)
}
#endif
// Functions from tmds_encode.S
void tmds_encode_1bpp(const uint32_t *pixbuf, uint32_t *symbuf, size_t n_pix);

View file

@ -237,3 +237,43 @@ void DVIGFX8x2::swap(bool copy_framebuffer, bool copy_palette) {
memcpy(palette[back_index], palette[1 - back_index], sizeof(palette[0]));
}
}
// 1-bit WIP --------
DVIGFX1::DVIGFX1(const uint16_t w, const uint16_t h,
const struct dvi_timing &t, vreg_voltage v,
const struct dvi_serialiser_cfg &c)
: PicoDVI(t, v, c), GFXcanvas1(w, h) {}
DVIGFX1::~DVIGFX1(void) { gfxptr = NULL; }
static void mainloop1(struct dvi_inst *inst) {
((DVIGFX1 *)gfxptr)->foo();
}
#include "libdvi/tmds_encode.h"
void DVIGFX1::foo(void) {
uint8_t *buf = getBuffer();
for (;;) {
for (uint16_t y = 0; y < HEIGHT; y++) {
const uint32_t *colourbuf = (const uint32_t*)(buf + y * (WIDTH + 7) / 8);
uint32_t *tmdsbuf;
queue_remove_blocking_u32(&dvi0.q_tmds_free, &tmdsbuf);
//tmds_encode_1bpp(colourbuf, tmdsbuf, WIDTH);
queue_add_blocking_u32(&dvi0.q_tmds_valid, &tmdsbuf);
}
}
}
bool DVIGFX1::begin(void) {
uint8_t *bufptr = getBuffer();
if ((bufptr)) {
gfxptr = this;
mainloop = mainloop1;
PicoDVI::begin();
wait_begin = false; // Set core 1 in motion
return true;
}
return false;
}

View file

@ -92,3 +92,18 @@ protected:
uint8_t back_index = 0; // Which of 2 buffers receives draw ops
volatile bool swap_wait = 0; // For syncronizing front/back buffer swap
};
class DVIGFX1 : public PicoDVI, public GFXcanvas1 {
public:
DVIGFX1(const uint16_t w = 1280, const uint16_t h = 720,
const struct dvi_timing &t = dvi_timing_1280x720p_30hz,
vreg_voltage v = VREG_VOLTAGE_1_25,
const struct dvi_serialiser_cfg &c = pimoroni_demo_hdmi_cfg);
~DVIGFX1(void);
bool begin(void);
void foo(void);
void _scanline_callback(void);
protected:
uint16_t scanline = 2; // First 2 scanlines are set up before DVI start
};