Skip to content

Commit 560c7b0

Browse files
committed
Doom: optimize framerate
1 parent 4821001 commit 560c7b0

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

libraries/ENVIE_Video_coreboot/anx7625.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,6 @@ static int anx7625_power_on_init(uint8_t bus)
773773
}
774774
ANXINFO("Init interface.\n");
775775

776-
777776
//anx7625_disable_pd_protocol(bus);
778777
anx7625_reg_read(bus, RX_P0_ADDR, OCM_FW_VERSION, &version);
779778
anx7625_reg_read(bus, RX_P0_ADDR, OCM_FW_REVERSION, &revision);
@@ -1146,8 +1145,8 @@ int stm32_dsi_config(uint8_t bus, struct edid *edid, struct display_timing *dt)
11461145

11471146
/* background value */
11481147
ltdc.Init.Backcolor.Blue = 0x00;
1149-
ltdc.Init.Backcolor.Green = 0xFF;
1150-
ltdc.Init.Backcolor.Red = 0xFF;
1148+
ltdc.Init.Backcolor.Green = 0x00;
1149+
ltdc.Init.Backcolor.Red = 0x00;
11511150

11521151
ltdc.LayerCfg->ImageWidth = lcd_x_size;
11531152
ltdc.LayerCfg->ImageHeight = lcd_y_size;
@@ -1169,8 +1168,10 @@ int stm32_dsi_config(uint8_t bus, struct edid *edid, struct display_timing *dt)
11691168

11701169
//HAL_LTDC_ProgramLineEvent(&ltdc, 0);
11711170

1172-
HAL_DSI_PatternGeneratorStart(&dsi, 0, 1);
1171+
//HAL_DSI_PatternGeneratorStart(&dsi, 0, 1);
11731172
HAL_DSI_PatternGeneratorStop(&dsi);
1173+
stm32_LCD_Clear(0);
1174+
stm32_LCD_Clear(0);
11741175
}
11751176

11761177
static void LL_FillBuffer(uint32_t LayerIndex, void *pDst, uint32_t xSize, uint32_t ySize, uint32_t OffLine, uint32_t ColorIndex)
@@ -1196,12 +1197,11 @@ static void LL_FillBuffer(uint32_t LayerIndex, void *pDst, uint32_t xSize, uint3
11961197
}
11971198
}
11981199

1199-
static uint32_t ActiveLayer = 0;
1200-
12011200
void stm32_LCD_Clear(uint32_t Color)
12021201
{
12031202
/* Clear the LCD */
1204-
LL_FillBuffer(ActiveLayer, (uint32_t *)(ltdc.LayerCfg[ActiveLayer].FBStartAdress), lcd_x_size, lcd_y_size, 0, Color);
1203+
LL_FillBuffer(pend_buffer%2, (uint32_t *)(ltdc.LayerCfg[pend_buffer%2].FBStartAdress), lcd_x_size, lcd_y_size, 0, Color);
1204+
getNextFrameBuffer();
12051205
}
12061206

12071207
void stm32_LCD_DrawImage(void *pSrc, void *pDst, uint32_t xSize, uint32_t ySize, uint32_t ColorMode)
@@ -1212,7 +1212,7 @@ void stm32_LCD_DrawImage(void *pSrc, void *pDst, uint32_t xSize, uint32_t ySize,
12121212
dma2d.Init.OutputOffset = lcd_x_size - xSize;
12131213

12141214
if (pDst == NULL) {
1215-
pDst = (uint32_t *)(ltdc.LayerCfg[ActiveLayer].FBStartAdress);
1215+
pDst = (uint32_t *)(ltdc.LayerCfg[pend_buffer%2].FBStartAdress);
12161216
}
12171217

12181218
/* Foreground Configuration */

libraries/doom/d_loop.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -715,15 +715,12 @@ void TryRunTics (void)
715715

716716
// get real tics
717717
entertic = I_GetTime() / ticdup;
718-
printf("entertic: %d\n", entertic);
719718
realtics = entertic - oldentertics;
720719
oldentertics = entertic;
721720

722721
// in singletics mode, run a single tic every time this function
723722
// is called.
724723

725-
printf("singletics: %d\n", singletics);
726-
727724
if (singletics)
728725
{
729726
BuildNewTic();
@@ -734,7 +731,6 @@ void TryRunTics (void)
734731
}
735732

736733
lowtic = GetLowTic();
737-
printf("lowtic: %d\n", lowtic);
738734

739735
availabletics = lowtic - gametic/ticdup;
740736

@@ -768,8 +764,6 @@ void TryRunTics (void)
768764

769765
// wait for new tics if needed
770766

771-
printf("gametic/ticdup + counts: %d\n", gametic/ticdup + counts);
772-
773767
while (!PlayersInGame() || lowtic < gametic/ticdup + counts)
774768
{
775769

libraries/doom/doomgeneric_arduino.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static void DMA2D_Init(uint16_t xsize, uint16_t ysize)
114114
DMA2D_Handle.LayerCfg[1].InputAlpha = 0xFF;
115115
DMA2D_Handle.LayerCfg[1].InputColorMode = DMA2D_OUTPUT_RGB565;
116116
//DMA2D_Handle.LayerCfg[1].ChromaSubSampling = cssMode;
117-
DMA2D_Handle.LayerCfg[1].InputOffset = 0;
117+
DMA2D_Handle.LayerCfg[1].InputOffset = 0; //LCD_Y_Size - ysize;
118118
DMA2D_Handle.LayerCfg[1].RedBlueSwap = DMA2D_RB_REGULAR; /* No ForeGround Red/Blue swap */
119119
DMA2D_Handle.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA; /* No ForeGround Alpha inversion */
120120

@@ -204,7 +204,6 @@ static void DMA2D_CopyBuffer(uint32_t *pSrc, uint32_t *pDst)
204204

205205
void DG_DrawFrame()
206206
{
207-
printf("calling DG_DrawFrame\n");
208207
DMA2D_CopyBuffer((uint32_t *)DG_ScreenBuffer, (uint32_t *)getNextFrameBuffer());
209208
//handleKeyInput();
210209
}

0 commit comments

Comments
 (0)