Merge pull request #1827 from enjoy-digital/video_framebuffer_skip_first_frame

cores/video/VideoFramebuffer: Skip first frame on enable to ensure pr…
This commit is contained in:
enjoy-digital 2023-11-06 09:11:26 +01:00 committed by GitHub
commit 2beeca4c95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -693,13 +693,18 @@ class VideoFrameBuffer(LiteXModule):
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")
),
@ -709,9 +714,13 @@ class VideoFrameBuffer(LiteXModule):
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"}),