cores/video: Change depth parameter to format (more explicit and we'll maybe want to support other video formats).
This commit is contained in:
parent
6d317d0882
commit
f508b131ea
|
@ -606,12 +606,15 @@ class VideoTerminal(Module):
|
||||||
|
|
||||||
class VideoFrameBuffer(Module, AutoCSR):
|
class VideoFrameBuffer(Module, AutoCSR):
|
||||||
"""Video FrameBuffer"""
|
"""Video FrameBuffer"""
|
||||||
def __init__(self, dram_port, hres=800, vres=600, base=0x00000000, fifo_depth=65536, clock_domain="sys", clock_faster_than_sys=False, depth=32):
|
def __init__(self, dram_port, hres=800, vres=600, base=0x00000000, fifo_depth=65536, clock_domain="sys", clock_faster_than_sys=False, format="rgb888"):
|
||||||
self.vtg_sink = vtg_sink = stream.Endpoint(video_timing_layout)
|
self.vtg_sink = vtg_sink = stream.Endpoint(video_timing_layout)
|
||||||
self.source = source = stream.Endpoint(video_data_layout)
|
self.source = source = stream.Endpoint(video_data_layout)
|
||||||
self.underflow = Signal()
|
self.underflow = Signal()
|
||||||
|
|
||||||
assert((depth == 32) or (depth == 16))
|
self.depth = depth = {
|
||||||
|
"rgb888" : 32,
|
||||||
|
"rgb565" : 16
|
||||||
|
}[format]
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
|
|
|
@ -1784,7 +1784,7 @@ class LiteXSoC(SoC):
|
||||||
self.comb += vt.source.connect(phy if isinstance(phy, stream.Endpoint) else phy.sink)
|
self.comb += vt.source.connect(phy if isinstance(phy, stream.Endpoint) else phy.sink)
|
||||||
|
|
||||||
# Add Video Framebuffer ------------------------------------------------------------------------
|
# Add Video Framebuffer ------------------------------------------------------------------------
|
||||||
def add_video_framebuffer(self, name="video_framebuffer", phy=None, timings="800x600@60Hz", clock_domain="sys", depth=32):
|
def add_video_framebuffer(self, name="video_framebuffer", phy=None, timings="800x600@60Hz", clock_domain="sys", format="rgb888"):
|
||||||
# Imports.
|
# Imports.
|
||||||
from litex.soc.cores.video import VideoTimingGenerator, VideoFrameBuffer
|
from litex.soc.cores.video import VideoTimingGenerator, VideoFrameBuffer
|
||||||
|
|
||||||
|
@ -1799,12 +1799,12 @@ class LiteXSoC(SoC):
|
||||||
hres = int(timings.split("@")[0].split("x")[0])
|
hres = int(timings.split("@")[0].split("x")[0])
|
||||||
vres = int(timings.split("@")[0].split("x")[1])
|
vres = int(timings.split("@")[0].split("x")[1])
|
||||||
vfb = VideoFrameBuffer(self.sdram.crossbar.get_port(),
|
vfb = VideoFrameBuffer(self.sdram.crossbar.get_port(),
|
||||||
hres = hres,
|
hres = hres,
|
||||||
vres = vres,
|
vres = vres,
|
||||||
base = base,
|
base = base,
|
||||||
|
format = format,
|
||||||
clock_domain = clock_domain,
|
clock_domain = clock_domain,
|
||||||
clock_faster_than_sys = vtg.video_timings["pix_clk"] > self.sys_clk_freq,
|
clock_faster_than_sys = vtg.video_timings["pix_clk"] > self.sys_clk_freq,
|
||||||
depth = depth
|
|
||||||
)
|
)
|
||||||
setattr(self.submodules, name, vfb)
|
setattr(self.submodules, name, vfb)
|
||||||
|
|
||||||
|
@ -1818,5 +1818,5 @@ class LiteXSoC(SoC):
|
||||||
self.add_constant("VIDEO_FRAMEBUFFER_BASE", base)
|
self.add_constant("VIDEO_FRAMEBUFFER_BASE", base)
|
||||||
self.add_constant("VIDEO_FRAMEBUFFER_HRES", hres)
|
self.add_constant("VIDEO_FRAMEBUFFER_HRES", hres)
|
||||||
self.add_constant("VIDEO_FRAMEBUFFER_VRES", vres)
|
self.add_constant("VIDEO_FRAMEBUFFER_VRES", vres)
|
||||||
self.add_constant("VIDEO_FRAMEBUFFER_DEPTH", depth)
|
self.add_constant("VIDEO_FRAMEBUFFER_DEPTH", vfb.depth)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue