Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

framebuffer: fix alpha blending

  • Loading branch information...
commit 8c335d66fdd1ef8a62dcd9c81904b947cde6ad2e 1 parent e96b027
Sébastien Bourdeauducq authored

Showing 1 changed file with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. 10  milkymist/framebuffer/__init__.py
10  milkymist/framebuffer/__init__.py
@@ -75,7 +75,11 @@ def __init__(self, nimages, latency):
75 75
 			for component in ["r", "g", "b"]:
76 76
 				incomps = [getattr(pix, component) for pix in inpixs]
77 77
 				outcomp = getattr(outpix, component)
78  
-				self.comb += outcomp.eq(sum(incomp*factor for incomp, factor in zip(incomps, factors)) >> 8)
  78
+				outcomp_full = Signal(18)
  79
+				self.comb += [
  80
+					outcomp_full.eq(sum(incomp*factor for incomp, factor in zip(incomps, factors))),
  81
+					outcomp.eq(outcomp_full[8:])
  82
+				]
79 83
 
80 84
 		pipe_stmts = []
81 85
 		for i in range(latency):
@@ -86,7 +90,7 @@ def __init__(self, nimages, latency):
86 90
 		self.comb += self.source.payload.eq(outval)
87 91
 
88 92
 class MixFramebuffer(Module, AutoCSR):
89  
-	def __init__(self, pads, *asmiports, blender_latency=3):
  93
+	def __init__(self, pads, *asmiports, blender_latency=4):
90 94
 		pack_factor = asmiports[0].hub.dw//(2*bpp)
91 95
 		packed_pixels = structuring.pack_layout(pixel_layout, pack_factor)
92 96
 		
@@ -103,7 +107,7 @@ def __init__(self, pads, *asmiports, blender_latency=3):
103 107
 
104 108
 			g.add_connection(dma, cast)
105 109
 			g.add_connection(cast, unpack)
106  
-			g.add_connection(unpack, self.blender, sink_subr=["i"+str(n)+"/p0", "i"+str(n)+"/p1"])
  110
+			g.add_connection(unpack, self.blender, sink_subr=["i"+str(n)])
107 111
 
108 112
 			self.comb += dma.generator.trigger.eq(self._enable.storage)
109 113
 			setattr(self, "dma"+str(n), dma)

0 notes on commit 8c335d6

Please sign in to comment.
Something went wrong with that request. Please try again.