Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
framebuffer: fix alpha blending
  • Loading branch information
Sebastien Bourdeauducq committed May 11, 2013
1 parent e96b027 commit 8c335d6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions milkymist/framebuffer/__init__.py
Expand Up @@ -75,7 +75,11 @@ def __init__(self, nimages, latency):
for component in ["r", "g", "b"]:
incomps = [getattr(pix, component) for pix in inpixs]
outcomp = getattr(outpix, component)
self.comb += outcomp.eq(sum(incomp*factor for incomp, factor in zip(incomps, factors)) >> 8)
outcomp_full = Signal(18)
self.comb += [
outcomp_full.eq(sum(incomp*factor for incomp, factor in zip(incomps, factors))),
outcomp.eq(outcomp_full[8:])
]

pipe_stmts = []
for i in range(latency):
Expand All @@ -86,7 +90,7 @@ def __init__(self, nimages, latency):
self.comb += self.source.payload.eq(outval)

class MixFramebuffer(Module, AutoCSR):
def __init__(self, pads, *asmiports, blender_latency=3):
def __init__(self, pads, *asmiports, blender_latency=4):
pack_factor = asmiports[0].hub.dw//(2*bpp)
packed_pixels = structuring.pack_layout(pixel_layout, pack_factor)

Expand All @@ -103,7 +107,7 @@ def __init__(self, pads, *asmiports, blender_latency=3):

g.add_connection(dma, cast)
g.add_connection(cast, unpack)
g.add_connection(unpack, self.blender, sink_subr=["i"+str(n)+"/p0", "i"+str(n)+"/p1"])
g.add_connection(unpack, self.blender, sink_subr=["i"+str(n)])

self.comb += dma.generator.trigger.eq(self._enable.storage)
setattr(self, "dma"+str(n), dma)
Expand Down

0 comments on commit 8c335d6

Please sign in to comment.