Skip to content

Commit

Permalink
cores/video/VideoFramebuffer: Skip first frame on enable to ensure pr…
Browse files Browse the repository at this point in the history
…oper VTG/DMA synchronization.
  • Loading branch information
enjoy-digital committed Nov 5, 2023
1 parent f4e68d7 commit b0c0669
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions litex/soc/cores/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,13 +693,18 @@ def __init__(self, dram_port, hres=800, vres=600, base=0x00000000, fifo_depth=65
video_pipe_source = self.cdc.source

# Video Synchronization/Generation.
first = Signal()
fsm = FSM(reset_state="SYNC")
fsm = ClockDomainsRenamer(clock_domain)(fsm)
fsm = ResetInserter()(fsm)
self.submodules += fsm
self.specials += MultiReg(self.dma.fsm.reset, fsm.reset, clock_domain)
fsm.act("SYNC",
vtg_sink.ready.eq(~fsm.reset),
vtg_sink.ready.eq(1),
If(fsm.reset,
vtg_sink.ready.eq(0),
NextValue(first, 1)
),
If(vtg_sink.valid & vtg_sink.last,
NextState("RUN")
),
Expand All @@ -709,9 +714,13 @@ def __init__(self, dram_port, hres=800, vres=600, base=0x00000000, fifo_depth=65
vtg_sink.ready.eq(1),
If(vtg_sink.valid & vtg_sink.de,
video_pipe_source.connect(source, keep={"valid", "ready"}),
If(first,
source.valid.eq(0)
),
vtg_sink.ready.eq(source.valid & source.ready),
If(video_pipe_source.valid & video_pipe_source.last,
NextState("SYNC")
NextValue(first, 0),
NextState("SYNC"),
)
),
vtg_sink.connect(source, keep={"de", "hsync", "vsync"}),
Expand Down

0 comments on commit b0c0669

Please sign in to comment.