Skip to content

Commit 724d6a2

Browse files
committed
Doom: Software scaling to 640x480
1 parent 601e694 commit 724d6a2

File tree

4 files changed

+18
-47
lines changed

4 files changed

+18
-47
lines changed

libraries/ENVIE_Video_coreboot/anx7625.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -908,8 +908,8 @@ static void stm32_LayerInit(uint16_t LayerIndex, uint32_t FB_Address)
908908
Layercfg.Backcolor.Red = 0;
909909
Layercfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA;
910910
Layercfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA;
911-
Layercfg.ImageWidth = 320;
912-
Layercfg.ImageHeight = 200;
911+
Layercfg.ImageWidth = lcd_x_size;
912+
Layercfg.ImageHeight = lcd_y_size;
913913

914914
HAL_LTDC_ConfigLayer(&ltdc, &Layercfg, LayerIndex);
915915
}
@@ -1168,7 +1168,7 @@ int stm32_dsi_config(uint8_t bus, struct edid *edid, struct display_timing *dt)
11681168

11691169
//HAL_LTDC_ProgramLineEvent(&ltdc, 0);
11701170

1171-
//HAL_DSI_PatternGeneratorStart(&dsi, 0, 1);
1171+
HAL_DSI_PatternGeneratorStart(&dsi, 0, 1);
11721172
HAL_DSI_PatternGeneratorStop(&dsi);
11731173
stm32_LCD_Clear(0);
11741174
stm32_LCD_Clear(0);

libraries/ENVIE_Video_coreboot/edid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ static void dump_breakdown(unsigned char *edid)
10861086
*/
10871087
struct edid_mode known_modes[NUM_KNOWN_MODES] = {
10881088
[EDID_MODE_320x240_60Hz] = {
1089-
.name = "320x240@60Hz", .pixel_clock = 25750, .refresh = 60,
1089+
.name = "320x240@60Hz", .pixel_clock = 25200, .refresh = 60,
10901090
.ha = 320, .hbl = 80, .hso = 48, .hspw = 32,
10911091
.va = 200, .vbl = 16, .vso = 6, .vspw = 3,
10921092
.phsync = '-', .pvsync = '-' },

libraries/doom/doomgeneric.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include <stdint.h>
55

6-
#define DOOMGENERIC_RESX 320
7-
#define DOOMGENERIC_RESY 200
6+
#define DOOMGENERIC_RESX 640
7+
#define DOOMGENERIC_RESY 400
88

99

1010
extern uint32_t* DG_ScreenBuffer;

libraries/doom/i_video.c

Lines changed: 12 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -256,50 +256,21 @@ void I_UpdateNoBlit (void)
256256
void I_FinishUpdate (void)
257257
{
258258

259-
260-
#if 0
261-
int y;
262-
int x_offset, y_offset, x_offset_end;
263-
unsigned char *line_in, *line_out;
264-
265-
/* Offsets in case FB is bigger than DOOM */
266-
/* 600 = s_Fb heigt, 200 screenheight */
267-
/* 600 = s_Fb heigt, 200 screenheight */
268-
/* 2048 =s_Fb width, 320 screenwidth */
269-
y_offset = (((s_Fb.yres - (SCREENHEIGHT * fb_scaling)) * s_Fb.bits_per_pixel/8)) / 2;
270-
x_offset = (((s_Fb.xres - (SCREENWIDTH * fb_scaling)) * s_Fb.bits_per_pixel/8)) / 2; // XXX: siglent FB hack: /4 instead of /2, since it seems to handle the resolution in a funny way
271-
//x_offset = 0;
272-
x_offset_end = ((s_Fb.xres - (SCREENWIDTH * fb_scaling)) * s_Fb.bits_per_pixel/8) - x_offset;
273-
274-
/* DRAW SCREEN */
275-
line_in = (unsigned char *) I_VideoBuffer;
276-
line_out = (unsigned char *) I_VideoBuffer_FB;
277-
278-
y = SCREENHEIGHT;
279-
280-
while (y--)
281-
{
282-
int i;
283-
for (i = 0; i < fb_scaling; i++) {
284-
line_out += x_offset;
285-
#ifdef CMAP256
286-
for (fb_scaling == 1) {
287-
memcpy(line_out, line_in, SCREENWIDTH); /* fb_width is bigger than Doom SCREENWIDTH... */
288-
} else {
289-
//XXX FIXME fb_scaling support!
290-
}
291-
#else
292-
cmap_to_rgb565((void*)line_out, (void*)line_in, SCREENWIDTH);
293-
//cmap_to_fb((void*)line_out, (void*)line_in, SCREENWIDTH);
294-
#endif
295-
line_out += (SCREENWIDTH * fb_scaling * (s_Fb.bits_per_pixel/8)) + x_offset_end;
259+
uint8_t* inbuf = I_VideoBuffer;
260+
uint8_t* outbuf = I_VideoBuffer_FB;
261+
262+
for (uint32_t i = 0; i < SCREENHEIGHT; i++) {
263+
uint8_t* inbuf_temp = inbuf;
264+
uint8_t* outbuf_temp = outbuf;
265+
for (uint32_t pix = 0; pix < SCREENWIDTH; pix++) {
266+
*outbuf++ = *inbuf;
267+
*outbuf++ = *inbuf++;
296268
}
297-
line_in += SCREENWIDTH;
269+
memcpy(outbuf, outbuf_temp, SCREENWIDTH * 2);
270+
outbuf += SCREENWIDTH * 2;
298271
}
299-
#endif
300272

301-
//memcpy(DG_ScreenBuffer, I_VideoBuffer_FB, (SCREENHEIGHT * fb_scaling * (s_Fb.bits_per_pixel / 8)) * s_Fb.xres);
302-
DG_ScreenBuffer = I_VideoBuffer;
273+
DG_ScreenBuffer = I_VideoBuffer_FB;
303274

304275
DG_DrawFrame();
305276
}

0 commit comments

Comments
 (0)